chore: stop tracking TypeScript emit under packages/*/src

Ignore .js/.js.map/.d.ts/.d.ts.map next to sources (tsc outDir is dist).
Preserve hand-written packages/auth/src/types/base58-universal.d.ts.

Made-with: Cursor
This commit is contained in:
defiQUG
2026-04-07 22:08:37 -07:00
parent 27c4012431
commit 923b703d97
149 changed files with 8 additions and 5504 deletions

View File

@@ -1,45 +0,0 @@
/**
* OCR service client
*/
import { StorageClient } from '@the-order/storage';
export interface OCRResult {
text: string;
confidence: number;
words: Array<{
text: string;
confidence: number;
bbox: {
x0: number;
y0: number;
x1: number;
y1: number;
};
}>;
}
export declare class OCRClient {
private storageClient?;
constructor(storageClient?: StorageClient);
/**
* Process document from storage key with retry logic
*/
processFromStorage(storageKey: string, options?: {
maxRetries?: number;
initialDelay?: number;
}): Promise<OCRResult>;
/**
* Process document from buffer with retry logic
*/
processBuffer(buffer: Buffer, options?: {
maxRetries?: number;
initialDelay?: number;
}): Promise<OCRResult>;
/**
* Process with external OCR service
*/
private processWithExternalService;
/**
* Process with local Tesseract.js
*/
private processWithTesseract;
}
//# sourceMappingURL=client.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1D,CAAC,CAAC;CACJ;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,aAAa,CAAC,CAAgB;gBAE1B,aAAa,CAAC,EAAE,aAAa;IAIzC;;OAEG;IACG,kBAAkB,CACtB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,SAAS,CAAC;IASrB;;OAEG;IACG,aAAa,CACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,SAAS,CAAC;IAkCrB;;OAEG;YACW,0BAA0B;IAkBxC;;OAEG;YACW,oBAAoB;CAwBnC"}

View File

@@ -1,97 +0,0 @@
/**
* OCR service client
*/
import { createWorker } from 'tesseract.js';
import { getEnv } from '@the-order/shared';
export class OCRClient {
storageClient;
constructor(storageClient) {
this.storageClient = storageClient;
}
/**
* Process document from storage key with retry logic
*/
async processFromStorage(storageKey, options) {
if (!this.storageClient) {
throw new Error('Storage client required for processing from storage');
}
const fileBuffer = await this.storageClient.download(storageKey);
return this.processBuffer(fileBuffer, options);
}
/**
* Process document from buffer with retry logic
*/
async processBuffer(buffer, options) {
const maxRetries = options?.maxRetries ?? 3;
const initialDelay = options?.initialDelay ?? 1000;
let lastError = null;
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const env = getEnv();
// Use external OCR service if configured
if (env.OCR_SERVICE_URL) {
return await this.processWithExternalService(buffer);
}
// Fallback to local Tesseract.js
return await this.processWithTesseract(buffer);
}
catch (error) {
lastError = error instanceof Error ? error : new Error(String(error));
// Don't retry on the last attempt
if (attempt === maxRetries - 1) {
throw lastError;
}
// Exponential backoff: delay = initialDelay * 2^attempt
const delay = initialDelay * Math.pow(2, attempt);
await new Promise((resolve) => setTimeout(resolve, delay));
}
}
// This should never be reached, but TypeScript needs it
throw lastError || new Error('OCR processing failed after retries');
}
/**
* Process with external OCR service
*/
async processWithExternalService(buffer) {
const env = getEnv();
const response = await fetch(`${env.OCR_SERVICE_URL}/process`, {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
Authorization: `Bearer ${env.OCR_SERVICE_API_KEY}`,
},
body: buffer,
});
if (!response.ok) {
throw new Error(`OCR service error: ${response.status}`);
}
return (await response.json());
}
/**
* Process with local Tesseract.js
*/
async processWithTesseract(buffer) {
const worker = await createWorker('eng');
try {
const { data } = await worker.recognize(buffer);
return {
text: data.text,
confidence: data.confidence || 0,
words: data.words.map((word) => ({
text: word.text,
confidence: word.confidence || 0,
bbox: {
x0: word.bbox.x0,
y0: word.bbox.y0,
x1: word.bbox.x1,
y1: word.bbox.y1,
},
})),
};
}
finally {
await worker.terminate();
}
}
}
//# sourceMappingURL=client.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAa3C,MAAM,OAAO,SAAS;IACZ,aAAa,CAAiB;IAEtC,YAAY,aAA6B;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,UAAkB,EAClB,OAAwD;QAExD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CACjB,MAAc,EACd,OAAwD;QAExD,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,C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,CAAC;CACF"}

View File

@@ -1,5 +0,0 @@
/**
* OCR service client
*/
export * from './client';
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC"}

View File

@@ -1,5 +0,0 @@
/**
* OCR service client
*/
export * from './client';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC"}