@bisondesk/documents-sdk 1.0.315 → 1.0.316

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.
@@ -0,0 +1,59 @@
1
+ import { AttachmentValue } from '@bisondesk/commons-sdk/types';
2
+ export type FinanceLineV1 = {
3
+ associations: {
4
+ others: {
5
+ vehicleId: string;
6
+ label: string;
7
+ }[];
8
+ sales: {
9
+ id: string;
10
+ vehicleId: string;
11
+ label: string;
12
+ }[];
13
+ purchases: {
14
+ id: string;
15
+ vehicleId: string;
16
+ label: string;
17
+ }[];
18
+ };
19
+ description: string;
20
+ id: string;
21
+ lineCode: string;
22
+ quantity: string;
23
+ unitPriceExclusive: string;
24
+ vatCode: string;
25
+ vatCoefficient: string;
26
+ };
27
+ export type FinanceDocumentV1 = {
28
+ id: string;
29
+ branchId: string;
30
+ type: 'Sale Finance' | 'Purchase Finance';
31
+ subtype: 'Invoice' | 'Credit Note' | 'Proforma' | 'Purchase Order';
32
+ reference: string;
33
+ attachment: AttachmentValue;
34
+ lines: FinanceLineV1[];
35
+ notes?: string;
36
+ createdAt: string;
37
+ createdBy: string;
38
+ issueDate: string;
39
+ paidAt?: string;
40
+ paymentNotes?: string;
41
+ amount?: string;
42
+ dueDate?: string;
43
+ organizationSummary?: {
44
+ id: string;
45
+ code: string;
46
+ name: string;
47
+ country: string;
48
+ vatNumber?: string;
49
+ addressLine1?: string;
50
+ addressLine2?: string;
51
+ addressLine3?: string;
52
+ postcode?: string;
53
+ city?: string;
54
+ email?: string;
55
+ phone?: string;
56
+ fax?: string;
57
+ };
58
+ };
59
+ //# sourceMappingURL=legacy.d.ts.map
@@ -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,E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AM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB,YAAY,CAAC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/documents-sdk",
3
- "version": "1.0.315",
3
+ "version": "1.0.316",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "npx tsc --build tsconfig.cjs.json & npx tsc --build tsconfig.esm.json",
@@ -17,7 +17,6 @@
17
17
  "joi": "17.4.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/node": "16.11.7",
21
20
  "typescript": "4.7.4"
22
21
  },
23
22
  "main": "./lib/cjs/*",
@@ -0,0 +1,26 @@
1
+ export type FinanceBookingEvent = {
2
+ id: string;
3
+ branchId: string;
4
+ actionAt: string;
5
+ userId: string;
6
+ tenantId: string;
7
+ type: 'Sale Finance' | 'Purchase Finance';
8
+ };
9
+
10
+ export type FinanceBooking = {
11
+ branchId: string; // same tenantId can have different companies
12
+ bookingNumber: string; // same booking number can and will exist across different "branches", unique => BranchId / Journal / Booking Number
13
+ documentId: string;
14
+
15
+ booked: true;
16
+ journal?: string;
17
+ amount?: string;
18
+ reportingPeriod?: number;
19
+ reportingYear?: number;
20
+ paid: boolean;
21
+
22
+ createdAt: string;
23
+ createdBy: string;
24
+ modifiedAt: string;
25
+ modifiedBy: string;
26
+ };
@@ -1,6 +1,7 @@
1
1
  import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
2
2
  import { AttachmentValue, PhoneNumberValue, SearchPermissions } from '@bisondesk/commons-sdk/types';
3
- import { FinanceBooking, FinanceDocument } from '@bisondesk/core-sdk/types/documents';
3
+ import { FinanceBooking } from './booking';
4
+ import { FinanceDocumentV1 } from './legacy';
4
5
 
5
6
  export enum AdministrativeDocType {
6
7
  General = 'General Administrative',
@@ -9,6 +10,8 @@ export enum AdministrativeDocType {
9
10
  Sale = 'Sale Administrative',
10
11
  }
11
12
 
13
+ export type FinanceDocument = FinanceDocumentV1 | FinanceDocumentV2;
14
+
12
15
  export type Association = {
13
16
  businessEntityId: BusinessEntityIds;
14
17
  id: string;
@@ -199,7 +202,7 @@ export type SearchAdministrativeDocument = {
199
202
  };
200
203
 
201
204
  export const isFinanceDocumentV2 = (
202
- arg: FinanceDocumentV2 | FinanceDocument
205
+ arg: FinanceDocumentV2 | FinanceDocumentV1
203
206
  ): arg is FinanceDocumentV2 => {
204
207
  return (arg as FinanceDocumentV2).version === 2;
205
208
  };
@@ -249,3 +252,15 @@ export type FinanceDocumentBisondeskSettings = {
249
252
  templateId: string;
250
253
  };
251
254
  };
255
+
256
+ export type FinanceDocumentPayment = { documentId: string } & (
257
+ | { paid: true; paidAt: string; comment?: string }
258
+ | { paid: false; paidAt?: undefined; comment?: undefined }
259
+ );
260
+
261
+ export enum FinanceDocumentSubtype {
262
+ Invoice = 'Invoice',
263
+ CreditNote = 'Credit Note',
264
+ Proforma = 'Proforma',
265
+ PurchaseOrder = 'Purchase Order',
266
+ }
@@ -0,0 +1,19 @@
1
+ export type FinanceDocumentEvent = {
2
+ id: string;
3
+ actionAt: string;
4
+ action: 'upsert' | 'delete';
5
+ userId: string;
6
+ tenantId: string;
7
+ type: 'Sale Finance' | 'Purchase Finance';
8
+ subtype: string; // Invoice, Credit Note, etc.
9
+ };
10
+
11
+ export type AdminDocumentEvent = {
12
+ id: string;
13
+ actionAt: string;
14
+ action: 'upsert' | 'delete';
15
+ userId: string;
16
+ tenantId: string;
17
+ type: string;
18
+ subtype: string;
19
+ };
@@ -0,0 +1,55 @@
1
+ import { AttachmentValue } from '@bisondesk/commons-sdk/types';
2
+
3
+ export type FinanceLineV1 = {
4
+ associations: {
5
+ others: { vehicleId: string; label: string }[];
6
+ sales: { id: string; vehicleId: string; label: string }[];
7
+ purchases: { id: string; vehicleId: string; label: string }[];
8
+ };
9
+ description: string;
10
+ id: string;
11
+ lineCode: string;
12
+ quantity: string;
13
+ unitPriceExclusive: string;
14
+ vatCode: string;
15
+ vatCoefficient: string;
16
+ };
17
+
18
+ export type FinanceDocumentV1 = {
19
+ id: string;
20
+ branchId: string;
21
+
22
+ type: 'Sale Finance' | 'Purchase Finance';
23
+ subtype: 'Invoice' | 'Credit Note' | 'Proforma' | 'Purchase Order';
24
+ reference: string;
25
+
26
+ attachment: AttachmentValue;
27
+ lines: FinanceLineV1[];
28
+ notes?: string;
29
+
30
+ createdAt: string;
31
+ createdBy: string;
32
+ issueDate: string;
33
+ paidAt?: string;
34
+ paymentNotes?: string;
35
+ amount?: string;
36
+ dueDate?: string;
37
+
38
+ organizationSummary?: {
39
+ id: string;
40
+ code: string;
41
+ name: string;
42
+ country: string;
43
+ vatNumber?: string;
44
+
45
+ addressLine1?: string;
46
+ addressLine2?: string;
47
+ addressLine3?: string;
48
+ postcode?: string;
49
+ city?: string;
50
+
51
+ email?: string;
52
+ phone?: string;
53
+ fax?: string;
54
+ };
55
+ };