@bisondesk/documents-sdk 1.0.316 → 1.0.318
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/documents.d.ts +6 -0
- package/lib/apis/documents.d.ts.map +1 -0
- package/lib/apis/documents.js +71 -0
- package/lib/apis/documents.js.map +1 -0
- package/lib/types/{types/booking.d.ts → booking.d.ts} +2 -0
- package/lib/types/booking.d.ts.map +1 -0
- package/lib/types/booking.js.map +1 -0
- package/lib/types/document-categories.d.ts +42 -0
- package/lib/types/document-categories.d.ts.map +1 -0
- package/lib/types/document-categories.js +11 -0
- package/lib/types/document-categories.js.map +1 -0
- package/lib/types/{types/documents.d.ts → documents.d.ts} +46 -40
- package/lib/types/documents.d.ts.map +1 -0
- package/lib/{esm/types → types}/documents.js +14 -16
- package/lib/types/documents.js.map +1 -0
- package/lib/types/embeddings.d.ts +19 -0
- package/lib/types/embeddings.d.ts.map +1 -0
- package/lib/types/embeddings.js +7 -0
- package/lib/types/embeddings.js.map +1 -0
- package/lib/types/{types/events.d.ts → events.d.ts} +0 -2
- package/lib/types/{types/events.d.ts.map → events.d.ts.map} +1 -1
- package/lib/{cjs/types → types}/events.js.map +1 -1
- package/lib/types/{types/legacy.d.ts → legacy.d.ts} +1 -0
- package/lib/types/legacy.d.ts.map +1 -0
- package/lib/types/legacy.js.map +1 -0
- package/lib/types/ocr.d.ts +45 -0
- package/lib/types/ocr.d.ts.map +1 -0
- package/lib/types/ocr.js +28 -0
- package/lib/types/ocr.js.map +1 -0
- package/lib/types/scans.d.ts +10 -0
- package/lib/types/scans.d.ts.map +1 -0
- package/lib/types/scans.js.map +1 -0
- package/lib/types/search.d.ts +36 -0
- package/lib/types/search.d.ts.map +1 -0
- package/lib/types/search.js +2 -0
- package/lib/types/search.js.map +1 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +2 -0
- package/lib/utils.js.map +1 -0
- package/package.json +13 -20
- package/src/apis/documents.ts +96 -0
- package/src/types/booking.ts +3 -0
- package/src/types/document-categories.ts +22 -4
- package/src/types/documents.ts +54 -53
- package/src/types/embeddings.ts +23 -0
- package/src/types/events.ts +0 -2
- package/src/types/legacy.ts +1 -0
- package/src/types/ocr.ts +47 -0
- package/src/types/scans.ts +7 -1
- package/src/types/search.ts +42 -0
- package/src/utils.ts +1 -0
- package/tsconfig.deploy.json +5 -0
- package/tsconfig.deploy.tsbuildinfo +1 -0
- package/tsconfig.json +1 -2
- package/lib/cjs/types/booking.js +0 -3
- package/lib/cjs/types/booking.js.map +0 -1
- package/lib/cjs/types/document-categories.js +0 -9
- package/lib/cjs/types/document-categories.js.map +0 -1
- package/lib/cjs/types/documents.js +0 -61
- package/lib/cjs/types/documents.js.map +0 -1
- package/lib/cjs/types/events.js +0 -3
- package/lib/cjs/types/legacy.js +0 -3
- package/lib/cjs/types/legacy.js.map +0 -1
- package/lib/cjs/types/scans.js +0 -3
- package/lib/cjs/types/scans.js.map +0 -1
- package/lib/cjs/types/vat.js +0 -15
- package/lib/cjs/types/vat.js.map +0 -1
- package/lib/esm/types/booking.js.map +0 -1
- package/lib/esm/types/document-categories.js +0 -6
- package/lib/esm/types/document-categories.js.map +0 -1
- package/lib/esm/types/documents.js.map +0 -1
- package/lib/esm/types/events.js.map +0 -1
- package/lib/esm/types/legacy.js.map +0 -1
- package/lib/esm/types/scans.js.map +0 -1
- package/lib/tsconfig.cjs.tsbuildinfo +0 -1
- package/lib/tsconfig.esm.tsbuildinfo +0 -1
- package/lib/types/types/booking.d.ts.map +0 -1
- package/lib/types/types/document-categories.d.ts +0 -29
- package/lib/types/types/document-categories.d.ts.map +0 -1
- package/lib/types/types/documents.d.ts.map +0 -1
- package/lib/types/types/legacy.d.ts.map +0 -1
- package/lib/types/types/scans.d.ts +0 -6
- package/lib/types/types/scans.d.ts.map +0 -1
- package/tsconfig.cjs.json +0 -8
- package/tsconfig.esm.json +0 -8
- /package/lib/{esm/types → types}/booking.js +0 -0
- /package/lib/{esm/types → types}/events.js +0 -0
- /package/lib/{esm/types → types}/legacy.js +0 -0
- /package/lib/{esm/types → types}/scans.js +0 -0
- /package/lib/types/{types/vat.d.ts → vat.d.ts} +0 -0
- /package/lib/types/{types/vat.d.ts.map → vat.d.ts.map} +0 -0
- /package/lib/{esm/types → types}/vat.js +0 -0
- /package/lib/{esm/types → types}/vat.js.map +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FinanceBooking } from '../types/booking.js';
|
|
2
|
+
import { AdministrativeDocument, FinanceDocument } from '../types/documents.js';
|
|
3
|
+
export declare const upsertFinanceDoc: (tenantId: string, doc: FinanceDocument) => Promise<FinanceDocument>;
|
|
4
|
+
export declare const upsertAdminDoc: (tenantId: string, doc: AdministrativeDocument) => Promise<AdministrativeDocument>;
|
|
5
|
+
export declare const upsertFinanceBooking: (tenantId: string, booking: FinanceBooking) => Promise<FinanceBooking>;
|
|
6
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"/","sources":["apis/documents.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEhF,eAAO,MAAM,gBAAgB,aACjB,MAAM,OACX,eAAe,KACnB,QAAQ,eAAe,CAuBzB,CAAC;AAEF,eAAO,MAAM,cAAc,aACf,MAAM,OACX,sBAAsB,KAC1B,QAAQ,sBAAsB,CA0BhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,aACrB,MAAM,WACP,cAAc,KACtB,QAAQ,cAAc,CA0BxB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
|
|
2
|
+
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
3
|
+
import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
|
|
4
|
+
import fetch from 'node-fetch';
|
|
5
|
+
export const upsertFinanceDoc = async (tenantId, doc) => {
|
|
6
|
+
const auth = await getAdminAuth();
|
|
7
|
+
const response = await fetch(`${process.env.CORE_API_ORIGIN}/api/documents/finance`, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: {
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
Authorization: auth,
|
|
12
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify(doc),
|
|
15
|
+
});
|
|
16
|
+
if (response.status === 200) {
|
|
17
|
+
return response.json();
|
|
18
|
+
}
|
|
19
|
+
const body = await response.text();
|
|
20
|
+
throw new XError('core-sdk.documents.upsert-finance-doc-fail', {
|
|
21
|
+
tenantId,
|
|
22
|
+
doc,
|
|
23
|
+
response: body,
|
|
24
|
+
status: response.status,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const upsertAdminDoc = async (tenantId, doc) => {
|
|
28
|
+
const auth = await getAdminAuth();
|
|
29
|
+
const response = await fetch(`${process.env.CORE_API_ORIGIN}/api/documents/administrative`, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
Authorization: auth,
|
|
34
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(doc),
|
|
37
|
+
});
|
|
38
|
+
if (response.status === 200) {
|
|
39
|
+
return response.json();
|
|
40
|
+
}
|
|
41
|
+
const body = await response.text();
|
|
42
|
+
throw new XError('core-sdk.documents.upsert-admin-doc-fail', {
|
|
43
|
+
tenantId,
|
|
44
|
+
doc,
|
|
45
|
+
response: body,
|
|
46
|
+
status: response.status,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export const upsertFinanceBooking = async (tenantId, booking) => {
|
|
50
|
+
const auth = await getAdminAuth();
|
|
51
|
+
const response = await fetch(`${process.env.CORE_API_ORIGIN}/api/documents/finance/booking`, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
headers: {
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
Authorization: auth,
|
|
56
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
57
|
+
},
|
|
58
|
+
body: JSON.stringify(booking),
|
|
59
|
+
});
|
|
60
|
+
if (response.status === 200) {
|
|
61
|
+
return response.json();
|
|
62
|
+
}
|
|
63
|
+
const body = await response.text();
|
|
64
|
+
throw new XError('core-sdk.documents.upsert-finance-booking-fail', {
|
|
65
|
+
tenantId,
|
|
66
|
+
booking,
|
|
67
|
+
response: body,
|
|
68
|
+
status: response.status,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"/","sources":["apis/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAmB,MAAM,YAAY,CAAC;AAI7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,QAAgB,EAChB,GAAoB,EACM,EAAE;IAC5B,MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,wBAAwB,EAAE;QAC7F,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,IAAI;YACnB,CAAC,sBAAsB,CAAC,EAAE,QAAQ;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SA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MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,MAAM,KAAK,CACpC,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,gCAAgC,EAC9D;QACE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,IAAI;YACnB,CAAC,sBAAsB,CAAC,EAAE,QAAQ;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,IAAI,EAAS,CAAC;IAChC,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,MAAM,CAAC,gDAAgD,EAAE;QACjE,QAAQ;QACR,OAAO;QACP,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';\nimport { XError } from '@bisondesk/commons-sdk/errors';\nimport { getAdminAuth } from '@bisondesk/commons-sdk/fetch';\nimport fetch, { Response } from 'node-fetch';\nimport { FinanceBooking } from '../types/booking.js';\nimport { AdministrativeDocument, FinanceDocument } from '../types/documents.js';\n\nexport const upsertFinanceDoc = async (\n tenantId: string,\n doc: FinanceDocument\n): Promise<FinanceDocument> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/documents/finance`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n body: JSON.stringify(doc),\n });\n\n if (response.status === 200) {\n return response.json() as any;\n }\n\n const body = await response.text();\n throw new XError('core-sdk.documents.upsert-finance-doc-fail', {\n tenantId,\n doc,\n response: body,\n status: response.status,\n });\n};\n\nexport const upsertAdminDoc = async (\n tenantId: string,\n doc: AdministrativeDocument\n): Promise<AdministrativeDocument> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/documents/administrative`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n body: JSON.stringify(doc),\n }\n );\n\n if (response.status === 200) {\n return response.json() as any;\n }\n\n const body = await response.text();\n throw new XError('core-sdk.documents.upsert-admin-doc-fail', {\n tenantId,\n doc,\n response: body,\n status: response.status,\n });\n};\n\nexport const upsertFinanceBooking = async (\n tenantId: string,\n booking: FinanceBooking\n): Promise<FinanceBooking> => {\n const auth = await getAdminAuth();\n const response: Response = await fetch(\n `${process.env.CORE_API_ORIGIN}/api/documents/finance/booking`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: auth,\n [TENANT_ID_ADMIN_HEADER]: tenantId,\n },\n body: JSON.stringify(booking),\n }\n );\n\n if (response.status === 200) {\n return response.json() as any;\n }\n\n const body = await response.text();\n throw new XError('core-sdk.documents.upsert-finance-booking-fail', {\n tenantId,\n booking,\n response: body,\n status: response.status,\n });\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FinanceDocument } from './documents.js';
|
|
1
2
|
export type FinanceBookingEvent = {
|
|
2
3
|
id: string;
|
|
3
4
|
branchId: string;
|
|
@@ -5,6 +6,7 @@ export type FinanceBookingEvent = {
|
|
|
5
6
|
userId: string;
|
|
6
7
|
tenantId: string;
|
|
7
8
|
type: 'Sale Finance' | 'Purchase Finance';
|
|
9
|
+
version: FinanceDocument['version'];
|
|
8
10
|
};
|
|
9
11
|
export type FinanceBooking = {
|
|
10
12
|
branchId: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking.d.ts","sourceRoot":"/","sources":["types/booking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC1C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,OAAO,CAAC;IAEd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking.js","sourceRoot":"/","sources":["types/booking.ts"],"names":[],"mappings":"","sourcesContent":["import { FinanceDocument } from './documents.js';\n\nexport type FinanceBookingEvent = {\n id: string;\n branchId: string;\n actionAt: string;\n userId: string;\n tenantId: string;\n type: 'Sale Finance' | 'Purchase Finance';\n version: FinanceDocument['version'];\n};\n\nexport type FinanceBooking = {\n branchId: string; // same tenantId can have different companies\n bookingNumber: string; // same booking number can and will exist across different \"branches\", unique => BranchId / Journal / Booking Number\n documentId: string;\n\n booked: true;\n journal?: string;\n amount?: string;\n reportingPeriod?: number;\n reportingYear?: number;\n paid: boolean;\n\n createdAt: string;\n createdBy: string;\n modifiedAt: string;\n modifiedBy: string;\n};\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TransactionType } from '@bisondesk/commons-sdk/types';
|
|
2
|
+
export declare enum DocumentCategoryVisibility {
|
|
3
|
+
Standard = "standard",
|
|
4
|
+
Private = "private"
|
|
5
|
+
}
|
|
6
|
+
export declare enum DocumentCategoryType {
|
|
7
|
+
Administrative = "administrative",
|
|
8
|
+
Finance = "finance"
|
|
9
|
+
}
|
|
10
|
+
type BaseDocumentCategory = {
|
|
11
|
+
createdAt: string;
|
|
12
|
+
branchId: string;
|
|
13
|
+
id: string;
|
|
14
|
+
code: string;
|
|
15
|
+
type: DocumentCategoryType;
|
|
16
|
+
title: string;
|
|
17
|
+
};
|
|
18
|
+
export type AdministrativeDocumentCategory = BaseDocumentCategory & {
|
|
19
|
+
type: DocumentCategoryType.Administrative;
|
|
20
|
+
};
|
|
21
|
+
export type FinanceDocumentCategory = BaseDocumentCategory & {
|
|
22
|
+
type: DocumentCategoryType.Finance;
|
|
23
|
+
journal: string;
|
|
24
|
+
visibility: DocumentCategoryVisibility;
|
|
25
|
+
transactionTypes: [TransactionType, ...TransactionType[]];
|
|
26
|
+
validators?: string[];
|
|
27
|
+
};
|
|
28
|
+
export type DocumentCategory = AdministrativeDocumentCategory | FinanceDocumentCategory;
|
|
29
|
+
export type NewDocumentCategory = Omit<FinanceDocumentCategory, 'id' | 'createdAt'> | Omit<AdministrativeDocumentCategory, 'id' | 'createdAt'>;
|
|
30
|
+
export type FinanceDocumentLineCategory = {
|
|
31
|
+
createdAt: string;
|
|
32
|
+
branchId: string;
|
|
33
|
+
categoryId: string;
|
|
34
|
+
id: string;
|
|
35
|
+
code: string;
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
glAccount: string;
|
|
39
|
+
};
|
|
40
|
+
export type NewFinanceDocumentLineCategory = Omit<FinanceDocumentLineCategory, 'id' | 'createdAt'>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=document-categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-categories.d.ts","sourceRoot":"/","sources":["types/document-categories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,oBAAY,0BAA0B;IACpC,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,oBAAY,oBAAoB;IAC9B,cAAc,mBAAmB;IACjC,OAAO,YAAY;CACpB;AAED,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,oBAAoB,GAAG;IAClE,IAAI,EAAE,oBAAoB,CAAC,cAAc,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG;IAC3D,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,0BAA0B,CAAC;IACvC,gBAAgB,EAAE,CAAC,eAAe,EAAE,GAAG,eAAe,EAAE,CAAC,CAAC;IAC1D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,8BAA8B,GAAG,uBAAuB,CAAC;AAExF,MAAM,MAAM,mBAAmB,GAC3B,IAAI,CAAC,uBAAuB,EAAE,IAAI,GAAG,WAAW,CAAC,GACjD,IAAI,CAAC,8BAA8B,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC;AAE7D,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,2BAA2B,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var DocumentCategoryVisibility;
|
|
2
|
+
(function (DocumentCategoryVisibility) {
|
|
3
|
+
DocumentCategoryVisibility["Standard"] = "standard";
|
|
4
|
+
DocumentCategoryVisibility["Private"] = "private";
|
|
5
|
+
})(DocumentCategoryVisibility || (DocumentCategoryVisibility = {}));
|
|
6
|
+
export var DocumentCategoryType;
|
|
7
|
+
(function (DocumentCategoryType) {
|
|
8
|
+
DocumentCategoryType["Administrative"] = "administrative";
|
|
9
|
+
DocumentCategoryType["Finance"] = "finance";
|
|
10
|
+
})(DocumentCategoryType || (DocumentCategoryType = {}));
|
|
11
|
+
//# sourceMappingURL=document-categories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-categories.js","sourceRoot":"/","sources":["types/document-categories.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,mDAAqB,CAAA;IACrB,iDAAmB,CAAA;AACrB,CAAC,EAHW,0BAA0B,KAA1B,0BAA0B,QAGrC;AAED,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,yDAAiC,CAAA;IACjC,2CAAmB,CAAA;AACrB,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B","sourcesContent":["import { TransactionType } from '@bisondesk/commons-sdk/types';\n\nexport enum DocumentCategoryVisibility {\n Standard = 'standard',\n Private = 'private',\n}\n\nexport enum DocumentCategoryType {\n Administrative = 'administrative',\n Finance = 'finance',\n}\n\ntype BaseDocumentCategory = {\n createdAt: string;\n branchId: string;\n id: string;\n code: string;\n type: DocumentCategoryType;\n title: string;\n};\n\nexport type AdministrativeDocumentCategory = BaseDocumentCategory & {\n type: DocumentCategoryType.Administrative;\n};\n\nexport type FinanceDocumentCategory = BaseDocumentCategory & {\n type: DocumentCategoryType.Finance;\n journal: string;\n visibility: DocumentCategoryVisibility;\n transactionTypes: [TransactionType, ...TransactionType[]];\n validators?: string[];\n};\n\nexport type DocumentCategory = AdministrativeDocumentCategory | FinanceDocumentCategory;\n\nexport type NewDocumentCategory =\n | Omit<FinanceDocumentCategory, 'id' | 'createdAt'>\n | Omit<AdministrativeDocumentCategory, 'id' | 'createdAt'>;\n\nexport type FinanceDocumentLineCategory = {\n createdAt: string;\n branchId: string;\n categoryId: string;\n id: string;\n code: string;\n title: string;\n description: string;\n glAccount: string;\n};\n\nexport type NewFinanceDocumentLineCategory = Omit<FinanceDocumentLineCategory, 'id' | 'createdAt'>;\n"]}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
|
|
2
|
-
import { AttachmentValue, PhoneNumberValue
|
|
3
|
-
import {
|
|
4
|
-
import { FinanceDocumentV1 } from './legacy';
|
|
5
|
-
export declare enum AdministrativeDocType {
|
|
6
|
-
General = "General Administrative",
|
|
7
|
-
Logistics = "Logistics Administrative",
|
|
8
|
-
Purchase = "Purchase Administrative",
|
|
9
|
-
Sale = "Sale Administrative"
|
|
10
|
-
}
|
|
2
|
+
import { AttachmentValue, PhoneNumberValue } from '@bisondesk/commons-sdk/types';
|
|
3
|
+
import { FinanceDocumentV1 } from './legacy.js';
|
|
11
4
|
export type FinanceDocument = FinanceDocumentV1 | FinanceDocumentV2;
|
|
12
5
|
export type Association = {
|
|
13
6
|
businessEntityId: BusinessEntityIds;
|
|
@@ -58,21 +51,17 @@ export declare enum FinanceDocType {
|
|
|
58
51
|
Sale = "Sale Finance",
|
|
59
52
|
Purchase = "Purchase Finance"
|
|
60
53
|
}
|
|
61
|
-
export declare enum FinanceDocumentGenerateSubtype {
|
|
62
|
-
Invoice = "Invoice",
|
|
63
|
-
CreditNote = "Credit Note"
|
|
64
|
-
}
|
|
65
54
|
type BaseDocument = {
|
|
66
55
|
id: string;
|
|
67
56
|
branchId: string;
|
|
68
57
|
attachment: AttachmentValue;
|
|
69
|
-
subtype: string;
|
|
70
58
|
createdAt: string;
|
|
71
59
|
createdBy: string;
|
|
72
60
|
};
|
|
73
61
|
export type FinanceDocumentV2 = BaseDocument & {
|
|
74
62
|
version: 2.0;
|
|
75
63
|
reference: string;
|
|
64
|
+
subtype: FinanceDocumentSubtype;
|
|
76
65
|
type: FinanceDocType;
|
|
77
66
|
category: string;
|
|
78
67
|
organizationSummary: OrgSummary;
|
|
@@ -81,6 +70,7 @@ export type FinanceDocumentV2 = BaseDocument & {
|
|
|
81
70
|
invoiceId?: string;
|
|
82
71
|
issueDate: string;
|
|
83
72
|
lines: FinanceDocumentLine[];
|
|
73
|
+
paymentNotes?: string;
|
|
84
74
|
notes?: string;
|
|
85
75
|
salesperson: {
|
|
86
76
|
name: string;
|
|
@@ -106,37 +96,58 @@ export type NewFinanceDocumentV2 = Omit<FinanceDocumentV2, 'id' | 'createdAt' |
|
|
|
106
96
|
lines: Omit<FinanceDocumentLine, 'id'>[];
|
|
107
97
|
};
|
|
108
98
|
export type AdministrativeDocument = BaseDocument & {
|
|
109
|
-
type: AdministrativeDocType;
|
|
110
99
|
tags?: string[];
|
|
100
|
+
category: string;
|
|
111
101
|
associations?: Association[];
|
|
112
102
|
organizationSummary?: OrgSummary;
|
|
113
103
|
};
|
|
114
104
|
export type NewAdministrativeDocument = Omit<AdministrativeDocument, 'id' | 'createdAt' | 'createdBy'>;
|
|
115
105
|
export declare enum DraftProcessStatus {
|
|
116
|
-
|
|
106
|
+
Prefill = "Prefill",
|
|
117
107
|
Unprocessed = "Unprocessed",
|
|
118
|
-
|
|
108
|
+
Processed = "Processed",
|
|
109
|
+
BusinessValid = "BusinessValid",
|
|
110
|
+
AccountingValid = "AccountingValid",
|
|
111
|
+
Completed = "Completed",
|
|
112
|
+
Rejected = "Rejected"
|
|
119
113
|
}
|
|
120
114
|
type DraftProcessing = {
|
|
121
115
|
status: DraftProcessStatus;
|
|
122
|
-
businessValid: boolean;
|
|
123
|
-
accountingValid: boolean;
|
|
124
|
-
rejectedAt?: string;
|
|
125
|
-
rejectedBy?: string;
|
|
126
|
-
rejectionReason?: string;
|
|
127
116
|
failedValidationRules?: string[];
|
|
117
|
+
documentType?: DocumentType;
|
|
118
|
+
vatTotalCheck?: string;
|
|
119
|
+
totalCheck?: string;
|
|
128
120
|
};
|
|
129
121
|
export declare enum DocumentType {
|
|
130
122
|
Finance = "Finance Document",
|
|
131
123
|
Administrative = "Administrative Document"
|
|
132
124
|
}
|
|
133
|
-
type
|
|
134
|
-
|
|
125
|
+
type DraftStatusLogEntry = {
|
|
126
|
+
at: string;
|
|
127
|
+
by: string;
|
|
128
|
+
};
|
|
129
|
+
type DraftStatusLog = {
|
|
130
|
+
[key in DraftProcessStatus]?: DraftStatusLogEntry;
|
|
131
|
+
};
|
|
132
|
+
type BaseDocumentDraft = (BaseDocument & DraftProcessing) & ({
|
|
133
|
+
status: Exclude<DraftProcessStatus, DraftProcessStatus.Rejected>;
|
|
134
|
+
} | {
|
|
135
|
+
status: DraftProcessStatus.Rejected;
|
|
136
|
+
rejectedAt?: string;
|
|
137
|
+
rejectedBy?: string;
|
|
138
|
+
rejectionReason?: string;
|
|
139
|
+
}) & {
|
|
140
|
+
log?: DraftStatusLog;
|
|
135
141
|
};
|
|
136
142
|
export type DocumentDraft<T = FinanceDocumentV2 | AdministrativeDocument> = Partial<T> & BaseDocumentDraft;
|
|
143
|
+
export type DocumentDraftListMeta = {
|
|
144
|
+
status: DraftProcessStatus;
|
|
145
|
+
count: number;
|
|
146
|
+
}[];
|
|
137
147
|
export declare enum DraftActions {
|
|
138
148
|
Delete = "delete",
|
|
139
149
|
Validate = "validate",
|
|
150
|
+
Reject = "reject",
|
|
140
151
|
Submit = "submit",
|
|
141
152
|
ValidateBusinessRules = "validate_business_rules",
|
|
142
153
|
ValidateAccountingRules = "validate_accounting_rules"
|
|
@@ -144,25 +155,16 @@ export declare enum DraftActions {
|
|
|
144
155
|
export type RejectDraftRequest = {
|
|
145
156
|
reason?: string;
|
|
146
157
|
};
|
|
147
|
-
export type NewDocumentDraft<T = NewFinanceDocumentV2 | NewAdministrativeDocument> = Partial<T> & Omit<
|
|
158
|
+
export type NewDocumentDraft<T = NewFinanceDocumentV2 | NewAdministrativeDocument> = Partial<T> & Omit<BaseDocumentDraft, 'id' | 'createdAt' | 'createdBy' | 'subtype'> & {
|
|
148
159
|
subtype?: string;
|
|
149
160
|
documentType?: DocumentType;
|
|
150
161
|
};
|
|
151
|
-
export type SearchFinanceDocument = {
|
|
152
|
-
doc: FinanceDocumentV2;
|
|
153
|
-
permissions: SearchPermissions;
|
|
154
|
-
booking?: FinanceBooking;
|
|
155
|
-
};
|
|
156
|
-
export type SearchAdministrativeDocument = {
|
|
157
|
-
doc: AdministrativeDocument;
|
|
158
|
-
permissions: SearchPermissions;
|
|
159
|
-
};
|
|
160
162
|
export declare const isFinanceDocumentV2: (arg: FinanceDocumentV2 | FinanceDocumentV1) => arg is FinanceDocumentV2;
|
|
161
|
-
export declare const
|
|
162
|
-
export declare const isAdministrativeDocumentDraft: (draft: DocumentDraft) => draft is DocumentDraft<AdministrativeDocument>;
|
|
163
|
-
export declare const isFinanceDocumentDraft: (arg: DocumentDraft | NewDocumentDraft) => arg is DocumentDraft<FinanceDocumentV2>;
|
|
163
|
+
export declare const isFinanceDocumentV1: (arg: FinanceDocumentV2 | FinanceDocumentV1) => arg is FinanceDocumentV1;
|
|
164
|
+
export declare const isAdministrativeDocumentDraft: (draft: DocumentDraft | NewDocumentDraft) => draft is DocumentDraft<AdministrativeDocument> | NewDocumentDraft<AdministrativeDocument>;
|
|
165
|
+
export declare const isFinanceDocumentDraft: (arg: DocumentDraft | NewDocumentDraft) => arg is DocumentDraft<FinanceDocumentV2> | NewDocumentDraft<FinanceDocumentV2>;
|
|
164
166
|
export type FinanceDocumentGenerateRequest = Omit<FinanceDocumentV2, 'id' | 'attachment' | 'createdAt' | 'createdBy' | 'version' | 'reference' | 'lines' | 'subtype'> & {
|
|
165
|
-
subtype:
|
|
167
|
+
subtype: FinanceDocumentSubtype;
|
|
166
168
|
lines: Omit<FinanceDocumentLine, 'id'>[];
|
|
167
169
|
};
|
|
168
170
|
export type DocumentGenerateRequestEvent = {
|
|
@@ -175,11 +177,11 @@ export type FinanceDocumentSettings<M = {}> = {
|
|
|
175
177
|
meta: M;
|
|
176
178
|
};
|
|
177
179
|
export type FinanceDocumentBisondeskSettings = {
|
|
178
|
-
[
|
|
180
|
+
[FinanceDocumentSubtype.Invoice]: {
|
|
179
181
|
prefix: string;
|
|
180
182
|
templateId: string;
|
|
181
183
|
};
|
|
182
|
-
[
|
|
184
|
+
[FinanceDocumentSubtype.CreditNote]: {
|
|
183
185
|
prefix: string;
|
|
184
186
|
templateId: string;
|
|
185
187
|
};
|
|
@@ -201,5 +203,9 @@ export declare enum FinanceDocumentSubtype {
|
|
|
201
203
|
Proforma = "Proforma",
|
|
202
204
|
PurchaseOrder = "Purchase Order"
|
|
203
205
|
}
|
|
206
|
+
export declare enum FinanceDocumentActions {
|
|
207
|
+
PAY_FINANCE_DOCUMENT = "pay_finance_document",
|
|
208
|
+
DELETE_FINANCE_DOCUMENT = "delete_finance_document"
|
|
209
|
+
}
|
|
204
210
|
export {};
|
|
205
211
|
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"/","sources":["types/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,e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1D;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,CAC3D,CAAC;AAEF,oBAAY,sBAAsB;IAChC,OAAO,YAAY;IACnB,UAAU,gBAAgB;IAC1B,QAAQ,aAAa;IACrB,aAAa,mBAAmB;CACjC;AAED,oBAAY,sBAAsB;IAChC,oBAAoB,yBAAyB;IAC7C,uBAAuB,4BAA4B;CACpD"}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
export var AdministrativeDocType;
|
|
2
|
-
(function (AdministrativeDocType) {
|
|
3
|
-
AdministrativeDocType["General"] = "General Administrative";
|
|
4
|
-
AdministrativeDocType["Logistics"] = "Logistics Administrative";
|
|
5
|
-
AdministrativeDocType["Purchase"] = "Purchase Administrative";
|
|
6
|
-
AdministrativeDocType["Sale"] = "Sale Administrative";
|
|
7
|
-
})(AdministrativeDocType || (AdministrativeDocType = {}));
|
|
8
1
|
export var FinanceDocType;
|
|
9
2
|
(function (FinanceDocType) {
|
|
10
3
|
FinanceDocType["Sale"] = "Sale Finance";
|
|
11
4
|
FinanceDocType["Purchase"] = "Purchase Finance";
|
|
12
5
|
})(FinanceDocType || (FinanceDocType = {}));
|
|
13
|
-
export var FinanceDocumentGenerateSubtype;
|
|
14
|
-
(function (FinanceDocumentGenerateSubtype) {
|
|
15
|
-
FinanceDocumentGenerateSubtype["Invoice"] = "Invoice";
|
|
16
|
-
FinanceDocumentGenerateSubtype["CreditNote"] = "Credit Note";
|
|
17
|
-
})(FinanceDocumentGenerateSubtype || (FinanceDocumentGenerateSubtype = {}));
|
|
18
6
|
export var DraftProcessStatus;
|
|
19
7
|
(function (DraftProcessStatus) {
|
|
20
|
-
DraftProcessStatus["
|
|
8
|
+
DraftProcessStatus["Prefill"] = "Prefill";
|
|
21
9
|
DraftProcessStatus["Unprocessed"] = "Unprocessed";
|
|
22
|
-
DraftProcessStatus["
|
|
10
|
+
DraftProcessStatus["Processed"] = "Processed";
|
|
11
|
+
DraftProcessStatus["BusinessValid"] = "BusinessValid";
|
|
12
|
+
DraftProcessStatus["AccountingValid"] = "AccountingValid";
|
|
13
|
+
DraftProcessStatus["Completed"] = "Completed";
|
|
14
|
+
DraftProcessStatus["Rejected"] = "Rejected";
|
|
23
15
|
})(DraftProcessStatus || (DraftProcessStatus = {}));
|
|
24
16
|
export var DocumentType;
|
|
25
17
|
(function (DocumentType) {
|
|
@@ -30,6 +22,7 @@ export var DraftActions;
|
|
|
30
22
|
(function (DraftActions) {
|
|
31
23
|
DraftActions["Delete"] = "delete";
|
|
32
24
|
DraftActions["Validate"] = "validate";
|
|
25
|
+
DraftActions["Reject"] = "reject";
|
|
33
26
|
DraftActions["Submit"] = "submit";
|
|
34
27
|
DraftActions["ValidateBusinessRules"] = "validate_business_rules";
|
|
35
28
|
DraftActions["ValidateAccountingRules"] = "validate_accounting_rules";
|
|
@@ -37,8 +30,8 @@ export var DraftActions;
|
|
|
37
30
|
export const isFinanceDocumentV2 = (arg) => {
|
|
38
31
|
return arg.version === 2;
|
|
39
32
|
};
|
|
40
|
-
export const
|
|
41
|
-
return
|
|
33
|
+
export const isFinanceDocumentV1 = (arg) => {
|
|
34
|
+
return arg.version == null;
|
|
42
35
|
};
|
|
43
36
|
export const isAdministrativeDocumentDraft = (draft) => draft.documentType === DocumentType.Administrative;
|
|
44
37
|
export const isFinanceDocumentDraft = (arg) => {
|
|
@@ -51,4 +44,9 @@ export var FinanceDocumentSubtype;
|
|
|
51
44
|
FinanceDocumentSubtype["Proforma"] = "Proforma";
|
|
52
45
|
FinanceDocumentSubtype["PurchaseOrder"] = "Purchase Order";
|
|
53
46
|
})(FinanceDocumentSubtype || (FinanceDocumentSubtype = {}));
|
|
47
|
+
export var FinanceDocumentActions;
|
|
48
|
+
(function (FinanceDocumentActions) {
|
|
49
|
+
FinanceDocumentActions["PAY_FINANCE_DOCUMENT"] = "pay_finance_document";
|
|
50
|
+
FinanceDocumentActions["DELETE_FINANCE_DOCUMENT"] = "delete_finance_document";
|
|
51
|
+
})(FinanceDocumentActions || (FinanceDocumentActions = {}));
|
|
54
52
|
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"/","sources":["types/documents.ts"],"names":[],"mappings":"AA2DA,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,+CAA6B,CAAA;AAC/B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAkED,MAAM,CAAN,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,iDAA2B,CAAA;IAC3B,6CAAuB,CAAA;IACvB,qDAA+B,CAAA;IAC/B,yDAAmC,CAAA;IACnC,6CAAuB,CAAA;IACvB,2CAAqB,CAAA;AACvB,CAAC,EARW,kBAAkB,KAAlB,kBAAkB,QAQ7B;AAUD,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,4CAA4B,CAAA;IAC5B,0DAA0C,CAAA;AAC5C,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AA6BD,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,iEAAiD,CAAA;IACjD,qEAAqD,CAAA;AACvD,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAYD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAA0C,EAChB,EAAE;IAC5B,OAAQ,GAAyB,CAAC,OAAO,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAA0C,EAChB,EAAE;IAC5B,OAAQ,GAAyB,CAAC,OAAO,IAAI,IAAI,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,KAAuC,EACoD,EAAE,CAC7F,KAAK,CAAC,YAAY,KAAK,YAAY,CAAC,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,GAAqC,EAC0C,EAAE;IACjF,OAAO,GAAG,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CAAC;AACnD,CAAC,CAAC;AAsCF,MAAM,CAAN,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,oDAA0B,CAAA;IAC1B,+CAAqB,CAAA;IACrB,0DAAgC,CAAA;AAClC,CAAC,EALW,sBAAsB,KAAtB,sBAAsB,QAKjC;AAED,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,uEAA6C,CAAA;IAC7C,6EAAmD,CAAA;AACrD,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC","sourcesContent":["import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';\nimport { AttachmentValue, PhoneNumberValue } from '@bisondesk/commons-sdk/types';\nimport { FinanceDocumentV1 } from './legacy.js';\n\nexport type FinanceDocument = FinanceDocumentV1 | FinanceDocumentV2;\n\nexport type Association = {\n businessEntityId: BusinessEntityIds;\n id: string;\n description: string;\n tags?: string[];\n};\n\nexport type FinanceDocumentLine = {\n id: string;\n category: string; // abstraction used to map lines to GL accounts (e.g., deposit, insurance)\n amount: string;\n amountExcl: string; // quantity * unit price\n description: string;\n foreign?: {\n amount: string;\n amountExcl: string;\n unitPriceExcl: string;\n vatAmount: string;\n };\n invoiceLineId?: string; // used by credit notes\n quantity: string;\n associations?: Association[];\n unitPriceExcl: string;\n vatAmount: string;\n vatCode: string;\n vatPercentage: string;\n vatReason?: string;\n};\n\ntype OrgSummary = {\n id: string;\n code: number;\n name: string;\n vatNumber?: string;\n\n addressLine1?: string;\n addressLine2?: string;\n postcode?: string;\n city?: string;\n country: string;\n\n emails?: string[];\n phone?: PhoneNumberValue;\n\n // TODO person name?\n contact?: {\n name: string;\n username: string;\n };\n\n language: string; // needed?\n};\n\nexport enum FinanceDocType {\n Sale = 'Sale Finance',\n Purchase = 'Purchase Finance',\n}\n\ntype BaseDocument = {\n id: string;\n branchId: string;\n attachment: AttachmentValue;\n createdAt: string;\n createdBy: string;\n};\n\nexport type FinanceDocumentV2 = BaseDocument & {\n version: 2.0;\n reference: string;\n subtype: FinanceDocumentSubtype;\n type: FinanceDocType;\n category: string;\n organizationSummary: OrgSummary;\n\n dueDate?: string;\n transferDescription?: string; // we ask clients to put this as description of the transfer\n invoiceId?: string; // mandatory in credit notes but forbidden in invoices\n issueDate: string;\n lines: FinanceDocumentLine[];\n paymentNotes?: string;\n notes?: string;\n salesperson: {\n name: string;\n username: string;\n };\n tags: string[]; // optional values used to improve document search\n total: {\n amountExcl: string;\n amount: string;\n currencyCode: string; // from the branch\n foreign?: {\n amount: string;\n amountExcl: string;\n vatAmount: string;\n currencyCode: string;\n exchangeRate: string;\n };\n vatAmount: string;\n };\n\n paidAt?: string;\n};\n\nexport type NewFinanceDocumentV2 = Omit<\n FinanceDocumentV2,\n 'id' | 'createdAt' | 'createdBy' | 'lines'\n> & {\n lines: Omit<FinanceDocumentLine, 'id'>[];\n};\n\nexport type AdministrativeDocument = BaseDocument & {\n tags?: string[];\n category: string;\n associations?: Association[];\n organizationSummary?: OrgSummary;\n};\n\nexport type NewAdministrativeDocument = Omit<\n AdministrativeDocument,\n 'id' | 'createdAt' | 'createdBy'\n>;\n\nexport enum DraftProcessStatus {\n Prefill = 'Prefill',\n Unprocessed = 'Unprocessed',\n Processed = 'Processed',\n BusinessValid = 'BusinessValid',\n AccountingValid = 'AccountingValid',\n Completed = 'Completed',\n Rejected = 'Rejected',\n}\n\ntype DraftProcessing = {\n status: DraftProcessStatus;\n failedValidationRules?: string[];\n documentType?: DocumentType;\n vatTotalCheck?: string;\n totalCheck?: string;\n};\n\nexport enum DocumentType {\n Finance = 'Finance Document',\n Administrative = 'Administrative Document',\n}\n\ntype DraftStatusLogEntry = {\n at: string;\n by: string;\n};\n\ntype DraftStatusLog = { [key in DraftProcessStatus]?: DraftStatusLogEntry };\n\ntype BaseDocumentDraft = (BaseDocument & DraftProcessing) &\n (\n | {\n status: Exclude<DraftProcessStatus, DraftProcessStatus.Rejected>;\n }\n | {\n status: DraftProcessStatus.Rejected;\n rejectedAt?: string;\n rejectedBy?: string;\n rejectionReason?: string;\n }\n ) & {\n log?: DraftStatusLog;\n };\n\nexport type DocumentDraft<T = FinanceDocumentV2 | AdministrativeDocument> = Partial<T> &\n BaseDocumentDraft;\n\nexport type DocumentDraftListMeta = { status: DraftProcessStatus; count: number }[];\n\nexport enum DraftActions {\n Delete = 'delete',\n Validate = 'validate',\n Reject = 'reject',\n Submit = 'submit',\n ValidateBusinessRules = 'validate_business_rules',\n ValidateAccountingRules = 'validate_accounting_rules',\n}\n\nexport type RejectDraftRequest = {\n reason?: string;\n};\n\nexport type NewDocumentDraft<T = NewFinanceDocumentV2 | NewAdministrativeDocument> = Partial<T> &\n Omit<BaseDocumentDraft, 'id' | 'createdAt' | 'createdBy' | 'subtype'> & {\n subtype?: string;\n documentType?: DocumentType;\n };\n\nexport const isFinanceDocumentV2 = (\n arg: FinanceDocumentV2 | FinanceDocumentV1\n): arg is FinanceDocumentV2 => {\n return (arg as FinanceDocumentV2).version === 2;\n};\n\nexport const isFinanceDocumentV1 = (\n arg: FinanceDocumentV2 | FinanceDocumentV1\n): arg is FinanceDocumentV1 => {\n return (arg as FinanceDocumentV2).version == null;\n};\n\nexport const isAdministrativeDocumentDraft = (\n draft: DocumentDraft | NewDocumentDraft\n): draft is DocumentDraft<AdministrativeDocument> | NewDocumentDraft<AdministrativeDocument> =>\n draft.documentType === DocumentType.Administrative;\n\nexport const isFinanceDocumentDraft = (\n arg: DocumentDraft | NewDocumentDraft\n): arg is DocumentDraft<FinanceDocumentV2> | NewDocumentDraft<FinanceDocumentV2> => {\n return arg.documentType === DocumentType.Finance;\n};\n\nexport type FinanceDocumentGenerateRequest = Omit<\n FinanceDocumentV2,\n 'id' | 'attachment' | 'createdAt' | 'createdBy' | 'version' | 'reference' | 'lines' | 'subtype'\n> & {\n subtype: FinanceDocumentSubtype;\n lines: Omit<FinanceDocumentLine, 'id'>[];\n};\n\n// TODO\nexport type DocumentGenerateRequestEvent = {\n tenantId: string;\n docId: string;\n request: FinanceDocumentGenerateRequest;\n};\n\nexport type FinanceDocumentSettings<M = {}> = {\n provider: string;\n meta: M;\n};\n\nexport type FinanceDocumentBisondeskSettings = {\n [FinanceDocumentSubtype.Invoice]: {\n prefix: string;\n templateId: string;\n };\n [FinanceDocumentSubtype.CreditNote]: {\n prefix: string;\n templateId: string;\n };\n};\n\nexport type FinanceDocumentPayment = { documentId: string } & (\n | { paid: true; paidAt: string; comment?: string }\n | { paid: false; paidAt?: undefined; comment?: undefined }\n);\n\nexport enum FinanceDocumentSubtype {\n Invoice = 'Invoice',\n CreditNote = 'Credit Note',\n Proforma = 'Proforma',\n PurchaseOrder = 'Purchase Order',\n}\n\nexport enum FinanceDocumentActions {\n PAY_FINANCE_DOCUMENT = 'pay_finance_document',\n DELETE_FINANCE_DOCUMENT = 'delete_finance_document',\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum EmbeddingType {
|
|
2
|
+
FinancialDocument = "financialDocument",
|
|
3
|
+
AdminDocument = "adminDocument",
|
|
4
|
+
Line = "line"
|
|
5
|
+
}
|
|
6
|
+
export type DocumentEmbedding = {
|
|
7
|
+
id: string;
|
|
8
|
+
documentId: string;
|
|
9
|
+
embedding: number[];
|
|
10
|
+
type: EmbeddingType;
|
|
11
|
+
active: boolean;
|
|
12
|
+
category?: string;
|
|
13
|
+
subcategory?: string;
|
|
14
|
+
};
|
|
15
|
+
export type DocumentEmbeddingDB = {
|
|
16
|
+
data: Omit<DocumentEmbedding, 'embedding'>;
|
|
17
|
+
embedding: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=embeddings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeddings.d.ts","sourceRoot":"/","sources":["types/embeddings.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;IAC/B,IAAI,SAAS;CACd;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAEhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAGhC,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var EmbeddingType;
|
|
2
|
+
(function (EmbeddingType) {
|
|
3
|
+
EmbeddingType["FinancialDocument"] = "financialDocument";
|
|
4
|
+
EmbeddingType["AdminDocument"] = "adminDocument";
|
|
5
|
+
EmbeddingType["Line"] = "line";
|
|
6
|
+
})(EmbeddingType || (EmbeddingType = {}));
|
|
7
|
+
//# sourceMappingURL=embeddings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeddings.js","sourceRoot":"/","sources":["types/embeddings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,wDAAuC,CAAA;IACvC,gDAA+B,CAAA;IAC/B,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB","sourcesContent":["export enum EmbeddingType {\n FinancialDocument = 'financialDocument',\n AdminDocument = 'adminDocument',\n Line = 'line',\n}\n\nexport type DocumentEmbedding = {\n id: string;\n documentId: string;\n embedding: number[];\n type: EmbeddingType;\n active: boolean;\n\n category?: string;\n subcategory?: string;\n};\n\nexport type DocumentEmbeddingDB = {\n // since the column needs to be indexed its stored separately\n // so in the DB this type is slightly different\n data: Omit<DocumentEmbedding, 'embedding'>;\n embedding: string;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"","sourcesContent":["export type FinanceDocumentEvent = {\n id: string;\n actionAt: string;\n action: 'upsert' | 'delete';\n userId: string;\n tenantId: string;\n type: 'Sale Finance' | 'Purchase Finance';\n subtype: string; // Invoice, Credit Note, etc.\n};\n\nexport type AdminDocumentEvent = {\n id: string;\n actionAt: string;\n action: 'upsert' | 'delete';\n userId: string;\n tenantId: string;\n
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"/","sources":["types/events.ts"],"names":[],"mappings":"","sourcesContent":["export type FinanceDocumentEvent = {\n id: string;\n actionAt: string;\n action: 'upsert' | 'delete';\n userId: string;\n tenantId: string;\n type: 'Sale Finance' | 'Purchase Finance';\n subtype: string; // Invoice, Credit Note, etc.\n};\n\nexport type AdminDocumentEvent = {\n id: string;\n actionAt: string;\n action: 'upsert' | 'delete';\n userId: string;\n tenantId: string;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy.d.ts","sourceRoot":"/","sources":["types/legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,EAAE;QACZ,MAAM,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC/C,KAAK,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,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,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"/","sources":["types/legacy.ts"],"names":[],"mappings":"","sourcesContent":["import { AttachmentValue } from '@bisondesk/commons-sdk/types';\n\nexport type FinanceLineV1 = {\n associations: {\n others: { vehicleId: string; label: string }[];\n sales: { id: string; vehicleId: string; label: string }[];\n purchases: { id: string; vehicleId: string; label: string }[];\n };\n description: string;\n id: string;\n lineCode: string;\n quantity: string;\n unitPriceExclusive: string;\n vatCode: string;\n vatCoefficient: string;\n};\n\nexport type FinanceDocumentV1 = {\n id: string;\n branchId: string;\n version?: 1.0;\n\n type: 'Sale Finance' | 'Purchase Finance';\n subtype: 'Invoice' | 'Credit Note' | 'Proforma' | 'Purchase Order';\n reference: string;\n\n attachment: AttachmentValue;\n lines: FinanceLineV1[];\n notes?: string;\n\n createdAt: string;\n createdBy: string;\n issueDate: string;\n paidAt?: string;\n paymentNotes?: string;\n amount?: string;\n dueDate?: string;\n\n organizationSummary?: {\n id: string;\n code: string;\n name: string;\n country: string;\n vatNumber?: string;\n\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n postcode?: string;\n city?: string;\n\n email?: string;\n phone?: string;\n fax?: string;\n };\n};\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare enum OCRBlockType {
|
|
2
|
+
CELL = "CELL",
|
|
3
|
+
KEY_VALUE_SET = "KEY_VALUE_SET",
|
|
4
|
+
LAYOUT_FIGURE = "LAYOUT_FIGURE",
|
|
5
|
+
LAYOUT_FOOTER = "LAYOUT_FOOTER",
|
|
6
|
+
LAYOUT_HEADER = "LAYOUT_HEADER",
|
|
7
|
+
LAYOUT_KEY_VALUE = "LAYOUT_KEY_VALUE",
|
|
8
|
+
LAYOUT_LIST = "LAYOUT_LIST",
|
|
9
|
+
LAYOUT_PAGE_NUMBER = "LAYOUT_PAGE_NUMBER",
|
|
10
|
+
LAYOUT_SECTION_HEADER = "LAYOUT_SECTION_HEADER",
|
|
11
|
+
LAYOUT_TABLE = "LAYOUT_TABLE",
|
|
12
|
+
LAYOUT_TEXT = "LAYOUT_TEXT",
|
|
13
|
+
LAYOUT_TITLE = "LAYOUT_TITLE",
|
|
14
|
+
LINE = "LINE",
|
|
15
|
+
MERGED_CELL = "MERGED_CELL",
|
|
16
|
+
PAGE = "PAGE",
|
|
17
|
+
QUERY = "QUERY",
|
|
18
|
+
QUERY_RESULT = "QUERY_RESULT",
|
|
19
|
+
SELECTION_ELEMENT = "SELECTION_ELEMENT",
|
|
20
|
+
SIGNATURE = "SIGNATURE",
|
|
21
|
+
TABLE = "TABLE",
|
|
22
|
+
TABLE_FOOTER = "TABLE_FOOTER",
|
|
23
|
+
TABLE_TITLE = "TABLE_TITLE",
|
|
24
|
+
TITLE = "TITLE",
|
|
25
|
+
WORD = "WORD"
|
|
26
|
+
}
|
|
27
|
+
export interface OCRPoint {
|
|
28
|
+
X?: number;
|
|
29
|
+
Y?: number;
|
|
30
|
+
}
|
|
31
|
+
export type OCRBlock = {
|
|
32
|
+
Id?: string;
|
|
33
|
+
BlockType?: OCRBlockType;
|
|
34
|
+
Text?: string;
|
|
35
|
+
Confidence?: number;
|
|
36
|
+
Geometry?: {
|
|
37
|
+
Polygon?: OCRPoint[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type OCRDocument = {
|
|
41
|
+
Blocks?: OCRBlock[];
|
|
42
|
+
orientation: number;
|
|
43
|
+
hasCurrency: boolean;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=ocr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr.d.ts","sourceRoot":"/","sources":["types/ocr.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
package/lib/types/ocr.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var OCRBlockType;
|
|
2
|
+
(function (OCRBlockType) {
|
|
3
|
+
OCRBlockType["CELL"] = "CELL";
|
|
4
|
+
OCRBlockType["KEY_VALUE_SET"] = "KEY_VALUE_SET";
|
|
5
|
+
OCRBlockType["LAYOUT_FIGURE"] = "LAYOUT_FIGURE";
|
|
6
|
+
OCRBlockType["LAYOUT_FOOTER"] = "LAYOUT_FOOTER";
|
|
7
|
+
OCRBlockType["LAYOUT_HEADER"] = "LAYOUT_HEADER";
|
|
8
|
+
OCRBlockType["LAYOUT_KEY_VALUE"] = "LAYOUT_KEY_VALUE";
|
|
9
|
+
OCRBlockType["LAYOUT_LIST"] = "LAYOUT_LIST";
|
|
10
|
+
OCRBlockType["LAYOUT_PAGE_NUMBER"] = "LAYOUT_PAGE_NUMBER";
|
|
11
|
+
OCRBlockType["LAYOUT_SECTION_HEADER"] = "LAYOUT_SECTION_HEADER";
|
|
12
|
+
OCRBlockType["LAYOUT_TABLE"] = "LAYOUT_TABLE";
|
|
13
|
+
OCRBlockType["LAYOUT_TEXT"] = "LAYOUT_TEXT";
|
|
14
|
+
OCRBlockType["LAYOUT_TITLE"] = "LAYOUT_TITLE";
|
|
15
|
+
OCRBlockType["LINE"] = "LINE";
|
|
16
|
+
OCRBlockType["MERGED_CELL"] = "MERGED_CELL";
|
|
17
|
+
OCRBlockType["PAGE"] = "PAGE";
|
|
18
|
+
OCRBlockType["QUERY"] = "QUERY";
|
|
19
|
+
OCRBlockType["QUERY_RESULT"] = "QUERY_RESULT";
|
|
20
|
+
OCRBlockType["SELECTION_ELEMENT"] = "SELECTION_ELEMENT";
|
|
21
|
+
OCRBlockType["SIGNATURE"] = "SIGNATURE";
|
|
22
|
+
OCRBlockType["TABLE"] = "TABLE";
|
|
23
|
+
OCRBlockType["TABLE_FOOTER"] = "TABLE_FOOTER";
|
|
24
|
+
OCRBlockType["TABLE_TITLE"] = "TABLE_TITLE";
|
|
25
|
+
OCRBlockType["TITLE"] = "TITLE";
|
|
26
|
+
OCRBlockType["WORD"] = "WORD";
|
|
27
|
+
})(OCRBlockType || (OCRBlockType = {}));
|
|
28
|
+
//# sourceMappingURL=ocr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr.js","sourceRoot":"/","sources":["types/ocr.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAyBX;AAzBD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+CAA+B,CAAA;IAC/B,+CAA+B,CAAA;IAC/B,+CAA+B,CAAA;IAC/B,+CAA+B,CAAA;IAC/B,qDAAqC,CAAA;IACrC,2CAA2B,CAAA;IAC3B,yDAAyC,CAAA;IACzC,+DAA+C,CAAA;IAC/C,6CAA6B,CAAA;IAC7B,2CAA2B,CAAA;IAC3B,6CAA6B,CAAA;IAC7B,6BAAa,CAAA;IACb,2CAA2B,CAAA;IAC3B,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,6CAA6B,CAAA;IAC7B,uDAAuC,CAAA;IACvC,uCAAuB,CAAA;IACvB,+BAAe,CAAA;IACf,6CAA6B,CAAA;IAC7B,2CAA2B,CAAA;IAC3B,+BAAe,CAAA;IACf,6BAAa,CAAA;AACf,CAAC,EAzBW,YAAY,KAAZ,YAAY,QAyBvB","sourcesContent":["export enum OCRBlockType {\n CELL = 'CELL',\n KEY_VALUE_SET = 'KEY_VALUE_SET',\n LAYOUT_FIGURE = 'LAYOUT_FIGURE',\n LAYOUT_FOOTER = 'LAYOUT_FOOTER',\n LAYOUT_HEADER = 'LAYOUT_HEADER',\n LAYOUT_KEY_VALUE = 'LAYOUT_KEY_VALUE',\n LAYOUT_LIST = 'LAYOUT_LIST',\n LAYOUT_PAGE_NUMBER = 'LAYOUT_PAGE_NUMBER',\n LAYOUT_SECTION_HEADER = 'LAYOUT_SECTION_HEADER',\n LAYOUT_TABLE = 'LAYOUT_TABLE',\n LAYOUT_TEXT = 'LAYOUT_TEXT',\n LAYOUT_TITLE = 'LAYOUT_TITLE',\n LINE = 'LINE',\n MERGED_CELL = 'MERGED_CELL',\n PAGE = 'PAGE',\n QUERY = 'QUERY',\n QUERY_RESULT = 'QUERY_RESULT',\n SELECTION_ELEMENT = 'SELECTION_ELEMENT',\n SIGNATURE = 'SIGNATURE',\n TABLE = 'TABLE',\n TABLE_FOOTER = 'TABLE_FOOTER',\n TABLE_TITLE = 'TABLE_TITLE',\n TITLE = 'TITLE',\n WORD = 'WORD',\n}\n\nexport interface OCRPoint {\n X?: number;\n Y?: number;\n}\n\nexport type OCRBlock = {\n Id?: string;\n BlockType?: OCRBlockType;\n Text?: string;\n Confidence?: number;\n Geometry?: {\n Polygon?: OCRPoint[];\n };\n};\n\nexport type OCRDocument = {\n Blocks?: OCRBlock[];\n orientation: number;\n hasCurrency: boolean;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DocumentType } from './documents.js';
|
|
2
|
+
export type NewDocumentScanEvent = {
|
|
3
|
+
tenantId: string;
|
|
4
|
+
source: string;
|
|
5
|
+
fileUrl: string;
|
|
6
|
+
documentType?: DocumentType;
|
|
7
|
+
existingDraftId?: string;
|
|
8
|
+
skipSplit?: boolean;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=scans.d.ts.map
|