@bisondesk/documents-sdk 1.0.317 → 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/types/document-categories.d.ts +17 -4
- package/lib/types/document-categories.d.ts.map +1 -1
- package/lib/types/document-categories.js +5 -0
- package/lib/types/document-categories.js.map +1 -1
- package/lib/types/documents.d.ts +38 -34
- package/lib/types/documents.d.ts.map +1 -1
- package/lib/types/documents.js +7 -17
- package/lib/types/documents.js.map +1 -1
- package/lib/types/embeddings.d.ts +3 -2
- package/lib/types/embeddings.d.ts.map +1 -1
- package/lib/types/embeddings.js +2 -1
- package/lib/types/embeddings.js.map +1 -1
- package/lib/types/events.d.ts +0 -2
- package/lib/types/events.d.ts.map +1 -1
- package/lib/types/events.js.map +1 -1
- 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/package.json +2 -2
- package/src/types/document-categories.ts +22 -4
- package/src/types/documents.ts +42 -49
- package/src/types/embeddings.ts +5 -2
- package/src/types/events.ts +0 -2
- package/src/types/ocr.ts +47 -0
- package/tsconfig.deploy.json +5 -0
- package/tsconfig.deploy.tsbuildinfo +1 -0
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -3,19 +3,31 @@ export declare enum DocumentCategoryVisibility {
|
|
|
3
3
|
Standard = "standard",
|
|
4
4
|
Private = "private"
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export declare enum DocumentCategoryType {
|
|
7
|
+
Administrative = "administrative",
|
|
8
|
+
Finance = "finance"
|
|
9
|
+
}
|
|
10
|
+
type BaseDocumentCategory = {
|
|
7
11
|
createdAt: string;
|
|
8
12
|
branchId: string;
|
|
9
13
|
id: string;
|
|
10
14
|
code: string;
|
|
15
|
+
type: DocumentCategoryType;
|
|
11
16
|
title: string;
|
|
17
|
+
};
|
|
18
|
+
export type AdministrativeDocumentCategory = BaseDocumentCategory & {
|
|
19
|
+
type: DocumentCategoryType.Administrative;
|
|
20
|
+
};
|
|
21
|
+
export type FinanceDocumentCategory = BaseDocumentCategory & {
|
|
22
|
+
type: DocumentCategoryType.Finance;
|
|
12
23
|
journal: string;
|
|
13
24
|
visibility: DocumentCategoryVisibility;
|
|
14
25
|
transactionTypes: [TransactionType, ...TransactionType[]];
|
|
15
26
|
validators?: string[];
|
|
16
27
|
};
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
28
|
+
export type DocumentCategory = AdministrativeDocumentCategory | FinanceDocumentCategory;
|
|
29
|
+
export type NewDocumentCategory = Omit<FinanceDocumentCategory, 'id' | 'createdAt'> | Omit<AdministrativeDocumentCategory, 'id' | 'createdAt'>;
|
|
30
|
+
export type FinanceDocumentLineCategory = {
|
|
19
31
|
createdAt: string;
|
|
20
32
|
branchId: string;
|
|
21
33
|
categoryId: string;
|
|
@@ -25,5 +37,6 @@ export type DocumentLineCategory = {
|
|
|
25
37
|
description: string;
|
|
26
38
|
glAccount: string;
|
|
27
39
|
};
|
|
28
|
-
export type
|
|
40
|
+
export type NewFinanceDocumentLineCategory = Omit<FinanceDocumentLineCategory, 'id' | 'createdAt'>;
|
|
41
|
+
export {};
|
|
29
42
|
//# sourceMappingURL=document-categories.d.ts.map
|
|
@@ -1 +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,
|
|
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,YA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AAI,GAAG,WAAW,CAAC,CAAC"}
|
|
@@ -3,4 +3,9 @@ export var DocumentCategoryVisibility;
|
|
|
3
3
|
DocumentCategoryVisibility["Standard"] = "standard";
|
|
4
4
|
DocumentCategoryVisibility["Private"] = "private";
|
|
5
5
|
})(DocumentCategoryVisibility || (DocumentCategoryVisibility = {}));
|
|
6
|
+
export var DocumentCategoryType;
|
|
7
|
+
(function (DocumentCategoryType) {
|
|
8
|
+
DocumentCategoryType["Administrative"] = "administrative";
|
|
9
|
+
DocumentCategoryType["Finance"] = "finance";
|
|
10
|
+
})(DocumentCategoryType || (DocumentCategoryType = {}));
|
|
6
11
|
//# sourceMappingURL=document-categories.js.map
|
|
@@ -1 +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","sourcesContent":["import { TransactionType } from '@bisondesk/commons-sdk/types';\n\nexport enum DocumentCategoryVisibility {\n Standard = 'standard',\n Private = 'private',\n}\n\nexport
|
|
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"]}
|
package/lib/types/documents.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import type { Block } from '@aws-sdk/client-textract';
|
|
2
1
|
import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
|
|
3
2
|
import { AttachmentValue, PhoneNumberValue } from '@bisondesk/commons-sdk/types';
|
|
4
3
|
import { FinanceDocumentV1 } from './legacy.js';
|
|
5
|
-
export declare enum AdministrativeDocType {
|
|
6
|
-
General = "General Administrative",
|
|
7
|
-
Logistics = "Logistics Administrative",
|
|
8
|
-
Purchase = "Purchase Administrative",
|
|
9
|
-
Sale = "Sale Administrative"
|
|
10
|
-
}
|
|
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;
|
|
@@ -107,37 +96,58 @@ export type NewFinanceDocumentV2 = Omit<FinanceDocumentV2, 'id' | 'createdAt' |
|
|
|
107
96
|
lines: Omit<FinanceDocumentLine, 'id'>[];
|
|
108
97
|
};
|
|
109
98
|
export type AdministrativeDocument = BaseDocument & {
|
|
110
|
-
type: AdministrativeDocType;
|
|
111
99
|
tags?: string[];
|
|
100
|
+
category: string;
|
|
112
101
|
associations?: Association[];
|
|
113
102
|
organizationSummary?: OrgSummary;
|
|
114
103
|
};
|
|
115
104
|
export type NewAdministrativeDocument = Omit<AdministrativeDocument, 'id' | 'createdAt' | 'createdBy'>;
|
|
116
105
|
export declare enum DraftProcessStatus {
|
|
117
|
-
|
|
106
|
+
Prefill = "Prefill",
|
|
118
107
|
Unprocessed = "Unprocessed",
|
|
119
|
-
|
|
108
|
+
Processed = "Processed",
|
|
109
|
+
BusinessValid = "BusinessValid",
|
|
110
|
+
AccountingValid = "AccountingValid",
|
|
111
|
+
Completed = "Completed",
|
|
112
|
+
Rejected = "Rejected"
|
|
120
113
|
}
|
|
121
114
|
type DraftProcessing = {
|
|
122
115
|
status: DraftProcessStatus;
|
|
123
|
-
businessValid: boolean;
|
|
124
|
-
accountingValid: boolean;
|
|
125
|
-
rejectedAt?: string;
|
|
126
|
-
rejectedBy?: string;
|
|
127
|
-
rejectionReason?: string;
|
|
128
116
|
failedValidationRules?: string[];
|
|
117
|
+
documentType?: DocumentType;
|
|
118
|
+
vatTotalCheck?: string;
|
|
119
|
+
totalCheck?: string;
|
|
129
120
|
};
|
|
130
121
|
export declare enum DocumentType {
|
|
131
122
|
Finance = "Finance Document",
|
|
132
123
|
Administrative = "Administrative Document"
|
|
133
124
|
}
|
|
134
|
-
type
|
|
135
|
-
|
|
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;
|
|
136
141
|
};
|
|
137
142
|
export type DocumentDraft<T = FinanceDocumentV2 | AdministrativeDocument> = Partial<T> & BaseDocumentDraft;
|
|
143
|
+
export type DocumentDraftListMeta = {
|
|
144
|
+
status: DraftProcessStatus;
|
|
145
|
+
count: number;
|
|
146
|
+
}[];
|
|
138
147
|
export declare enum DraftActions {
|
|
139
148
|
Delete = "delete",
|
|
140
149
|
Validate = "validate",
|
|
150
|
+
Reject = "reject",
|
|
141
151
|
Submit = "submit",
|
|
142
152
|
ValidateBusinessRules = "validate_business_rules",
|
|
143
153
|
ValidateAccountingRules = "validate_accounting_rules"
|
|
@@ -145,17 +155,16 @@ export declare enum DraftActions {
|
|
|
145
155
|
export type RejectDraftRequest = {
|
|
146
156
|
reason?: string;
|
|
147
157
|
};
|
|
148
|
-
export type NewDocumentDraft<T = NewFinanceDocumentV2 | NewAdministrativeDocument> = Partial<T> & Omit<
|
|
158
|
+
export type NewDocumentDraft<T = NewFinanceDocumentV2 | NewAdministrativeDocument> = Partial<T> & Omit<BaseDocumentDraft, 'id' | 'createdAt' | 'createdBy' | 'subtype'> & {
|
|
149
159
|
subtype?: string;
|
|
150
160
|
documentType?: DocumentType;
|
|
151
161
|
};
|
|
152
162
|
export declare const isFinanceDocumentV2: (arg: FinanceDocumentV2 | FinanceDocumentV1) => arg is FinanceDocumentV2;
|
|
153
163
|
export declare const isFinanceDocumentV1: (arg: FinanceDocumentV2 | FinanceDocumentV1) => arg is FinanceDocumentV1;
|
|
154
|
-
export declare const
|
|
155
|
-
export declare const
|
|
156
|
-
export declare const isFinanceDocumentDraft: (arg: DocumentDraft | NewDocumentDraft) => arg is DocumentDraft<FinanceDocumentV2>;
|
|
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>;
|
|
157
166
|
export type FinanceDocumentGenerateRequest = Omit<FinanceDocumentV2, 'id' | 'attachment' | 'createdAt' | 'createdBy' | 'version' | 'reference' | 'lines' | 'subtype'> & {
|
|
158
|
-
subtype:
|
|
167
|
+
subtype: FinanceDocumentSubtype;
|
|
159
168
|
lines: Omit<FinanceDocumentLine, 'id'>[];
|
|
160
169
|
};
|
|
161
170
|
export type DocumentGenerateRequestEvent = {
|
|
@@ -168,11 +177,11 @@ export type FinanceDocumentSettings<M = {}> = {
|
|
|
168
177
|
meta: M;
|
|
169
178
|
};
|
|
170
179
|
export type FinanceDocumentBisondeskSettings = {
|
|
171
|
-
[
|
|
180
|
+
[FinanceDocumentSubtype.Invoice]: {
|
|
172
181
|
prefix: string;
|
|
173
182
|
templateId: string;
|
|
174
183
|
};
|
|
175
|
-
[
|
|
184
|
+
[FinanceDocumentSubtype.CreditNote]: {
|
|
176
185
|
prefix: string;
|
|
177
186
|
templateId: string;
|
|
178
187
|
};
|
|
@@ -194,11 +203,6 @@ export declare enum FinanceDocumentSubtype {
|
|
|
194
203
|
Proforma = "Proforma",
|
|
195
204
|
PurchaseOrder = "Purchase Order"
|
|
196
205
|
}
|
|
197
|
-
export type OCRDocument = {
|
|
198
|
-
Blocks?: Block[];
|
|
199
|
-
orientation: number;
|
|
200
|
-
hasCurrency: boolean;
|
|
201
|
-
};
|
|
202
206
|
export declare enum FinanceDocumentActions {
|
|
203
207
|
PAY_FINANCE_DOCUMENT = "pay_finance_document",
|
|
204
208
|
DELETE_FINANCE_DOCUMENT = "delete_finance_document"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.d.ts","sourceRoot":"/","sources":["types/documents.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,eAAe,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE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
|
package/lib/types/documents.js
CHANGED
|
@@ -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";
|
|
@@ -40,9 +33,6 @@ export const isFinanceDocumentV2 = (arg) => {
|
|
|
40
33
|
export const isFinanceDocumentV1 = (arg) => {
|
|
41
34
|
return arg.version == null;
|
|
42
35
|
};
|
|
43
|
-
export const isAdministrativeDocument = (arg) => {
|
|
44
|
-
return Object.values(AdministrativeDocType).includes(arg.type);
|
|
45
|
-
};
|
|
46
36
|
export const isAdministrativeDocumentDraft = (draft) => draft.documentType === DocumentType.Administrative;
|
|
47
37
|
export const isFinanceDocumentDraft = (arg) => {
|
|
48
38
|
return arg.documentType === DocumentType.Finance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.js","sourceRoot":"/","sources":["types/documents.ts"],"names":[],"mappings":"
|
|
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,WAA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honeNumberValue } 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"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare enum EmbeddingType {
|
|
2
|
-
|
|
2
|
+
FinancialDocument = "financialDocument",
|
|
3
|
+
AdminDocument = "adminDocument",
|
|
3
4
|
Line = "line"
|
|
4
5
|
}
|
|
5
6
|
export type DocumentEmbedding = {
|
|
@@ -9,7 +10,7 @@ export type DocumentEmbedding = {
|
|
|
9
10
|
type: EmbeddingType;
|
|
10
11
|
active: boolean;
|
|
11
12
|
category?: string;
|
|
12
|
-
|
|
13
|
+
subcategory?: string;
|
|
13
14
|
};
|
|
14
15
|
export type DocumentEmbeddingDB = {
|
|
15
16
|
data: Omit<DocumentEmbedding, 'embedding'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.d.ts","sourceRoot":"/","sources":["types/embeddings.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,
|
|
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"}
|
package/lib/types/embeddings.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var EmbeddingType;
|
|
2
2
|
(function (EmbeddingType) {
|
|
3
|
-
EmbeddingType["
|
|
3
|
+
EmbeddingType["FinancialDocument"] = "financialDocument";
|
|
4
|
+
EmbeddingType["AdminDocument"] = "adminDocument";
|
|
4
5
|
EmbeddingType["Line"] = "line";
|
|
5
6
|
})(EmbeddingType || (EmbeddingType = {}));
|
|
6
7
|
//# sourceMappingURL=embeddings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.js","sourceRoot":"/","sources":["types/embeddings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
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"]}
|
package/lib/types/events.d.ts
CHANGED
|
@@ -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"}
|
package/lib/types/events.js.map
CHANGED
|
@@ -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,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"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bisondesk/documents-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.318",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "npx tsc --build",
|
|
7
|
+
"build": "npx tsc --build tsconfig.deploy.json",
|
|
8
8
|
"clean": "rm -rf lib *.tsbuildinfo",
|
|
9
9
|
"unittest": "echo \"No test specified\"",
|
|
10
10
|
"integrationtest": "echo \"No test specified\"",
|
|
@@ -5,21 +5,39 @@ export enum DocumentCategoryVisibility {
|
|
|
5
5
|
Private = 'private',
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export enum DocumentCategoryType {
|
|
9
|
+
Administrative = 'administrative',
|
|
10
|
+
Finance = 'finance',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type BaseDocumentCategory = {
|
|
9
14
|
createdAt: string;
|
|
10
15
|
branchId: string;
|
|
11
16
|
id: string;
|
|
12
17
|
code: string;
|
|
18
|
+
type: DocumentCategoryType;
|
|
13
19
|
title: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type AdministrativeDocumentCategory = BaseDocumentCategory & {
|
|
23
|
+
type: DocumentCategoryType.Administrative;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type FinanceDocumentCategory = BaseDocumentCategory & {
|
|
27
|
+
type: DocumentCategoryType.Finance;
|
|
14
28
|
journal: string;
|
|
15
29
|
visibility: DocumentCategoryVisibility;
|
|
16
30
|
transactionTypes: [TransactionType, ...TransactionType[]];
|
|
17
31
|
validators?: string[];
|
|
18
32
|
};
|
|
19
33
|
|
|
20
|
-
export type
|
|
34
|
+
export type DocumentCategory = AdministrativeDocumentCategory | FinanceDocumentCategory;
|
|
35
|
+
|
|
36
|
+
export type NewDocumentCategory =
|
|
37
|
+
| Omit<FinanceDocumentCategory, 'id' | 'createdAt'>
|
|
38
|
+
| Omit<AdministrativeDocumentCategory, 'id' | 'createdAt'>;
|
|
21
39
|
|
|
22
|
-
export type
|
|
40
|
+
export type FinanceDocumentLineCategory = {
|
|
23
41
|
createdAt: string;
|
|
24
42
|
branchId: string;
|
|
25
43
|
categoryId: string;
|
|
@@ -30,4 +48,4 @@ export type DocumentLineCategory = {
|
|
|
30
48
|
glAccount: string;
|
|
31
49
|
};
|
|
32
50
|
|
|
33
|
-
export type
|
|
51
|
+
export type NewFinanceDocumentLineCategory = Omit<FinanceDocumentLineCategory, 'id' | 'createdAt'>;
|