@vulog/aima-document 1.1.26 → 1.1.27
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/dist/index.d.mts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +8 -8
- package/dist/index.mjs +6 -6
- package/package.json +3 -3
- package/src/{createDocument.ts → createOrUpdateDocument.ts} +3 -3
- package/src/index.ts +2 -2
- package/src/types.ts +10 -3
- package/src/{updateDocument.ts → updateDocumentStatus.ts} +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,7 @@ type FileUrl = {
|
|
|
19
19
|
url: string;
|
|
20
20
|
name: string;
|
|
21
21
|
};
|
|
22
|
+
type DocumentStatus = 'MISSING' | 'VALID' | 'INVALID' | 'EXPIRED' | 'PENDING_REVIEW';
|
|
22
23
|
type DocumentFull = {
|
|
23
24
|
id: number;
|
|
24
25
|
fleetId: string;
|
|
@@ -28,17 +29,20 @@ type DocumentFull = {
|
|
|
28
29
|
expirationDate?: string;
|
|
29
30
|
files: FileUrl[];
|
|
30
31
|
uploadUrls: FileUrl[];
|
|
31
|
-
status:
|
|
32
|
+
status: DocumentStatus;
|
|
32
33
|
reviewer?: string;
|
|
33
34
|
issuingCountry?: 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW';
|
|
34
35
|
issuingOffice: string;
|
|
35
36
|
issuingDate: string;
|
|
36
37
|
dlClass: string;
|
|
37
38
|
};
|
|
38
|
-
type
|
|
39
|
+
type DocumentBody = Partial<Omit<DocumentFull, 'id' | 'fleetId' | 'documentType' | 'files' | 'uploadUrls'> | 'status' | 'reviewer'> & {
|
|
39
40
|
documentType: string;
|
|
40
41
|
};
|
|
41
|
-
type
|
|
42
|
+
type DocumentStatusReview = {
|
|
43
|
+
status: DocumentStatus;
|
|
44
|
+
reviewer: string;
|
|
45
|
+
};
|
|
42
46
|
type DocumentByService = {
|
|
43
47
|
serviceId: string;
|
|
44
48
|
areMandatoryPresent: boolean;
|
|
@@ -56,10 +60,10 @@ type DocumentSummary = {
|
|
|
56
60
|
documentByFranchise: DocumentByFranchise[] | null;
|
|
57
61
|
};
|
|
58
62
|
|
|
59
|
-
declare const
|
|
63
|
+
declare const createOrUpdateDocument: (client: Client, userId: string, document: DocumentBody) => Promise<DocumentFull>;
|
|
60
64
|
|
|
61
65
|
declare const getUserDocuments: (client: Client, userId: string) => Promise<DocumentSummary>;
|
|
62
66
|
|
|
63
|
-
declare const
|
|
67
|
+
declare const updateDocumentStatus: (client: Client, userId: string, documentId: number, document: DocumentStatusReview) => Promise<DocumentFull>;
|
|
64
68
|
|
|
65
|
-
export { type DocumentByFranchise, type DocumentByService, type
|
|
69
|
+
export { type DocumentBody, type DocumentByFranchise, type DocumentByService, type DocumentFull, type DocumentStatus, type DocumentStatusReview, type DocumentSummary, type DocumentType, type FileUrl, createOrUpdateDocument, getUserDocuments, updateDocumentStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ type FileUrl = {
|
|
|
19
19
|
url: string;
|
|
20
20
|
name: string;
|
|
21
21
|
};
|
|
22
|
+
type DocumentStatus = 'MISSING' | 'VALID' | 'INVALID' | 'EXPIRED' | 'PENDING_REVIEW';
|
|
22
23
|
type DocumentFull = {
|
|
23
24
|
id: number;
|
|
24
25
|
fleetId: string;
|
|
@@ -28,17 +29,20 @@ type DocumentFull = {
|
|
|
28
29
|
expirationDate?: string;
|
|
29
30
|
files: FileUrl[];
|
|
30
31
|
uploadUrls: FileUrl[];
|
|
31
|
-
status:
|
|
32
|
+
status: DocumentStatus;
|
|
32
33
|
reviewer?: string;
|
|
33
34
|
issuingCountry?: 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW';
|
|
34
35
|
issuingOffice: string;
|
|
35
36
|
issuingDate: string;
|
|
36
37
|
dlClass: string;
|
|
37
38
|
};
|
|
38
|
-
type
|
|
39
|
+
type DocumentBody = Partial<Omit<DocumentFull, 'id' | 'fleetId' | 'documentType' | 'files' | 'uploadUrls'> | 'status' | 'reviewer'> & {
|
|
39
40
|
documentType: string;
|
|
40
41
|
};
|
|
41
|
-
type
|
|
42
|
+
type DocumentStatusReview = {
|
|
43
|
+
status: DocumentStatus;
|
|
44
|
+
reviewer: string;
|
|
45
|
+
};
|
|
42
46
|
type DocumentByService = {
|
|
43
47
|
serviceId: string;
|
|
44
48
|
areMandatoryPresent: boolean;
|
|
@@ -56,10 +60,10 @@ type DocumentSummary = {
|
|
|
56
60
|
documentByFranchise: DocumentByFranchise[] | null;
|
|
57
61
|
};
|
|
58
62
|
|
|
59
|
-
declare const
|
|
63
|
+
declare const createOrUpdateDocument: (client: Client, userId: string, document: DocumentBody) => Promise<DocumentFull>;
|
|
60
64
|
|
|
61
65
|
declare const getUserDocuments: (client: Client, userId: string) => Promise<DocumentSummary>;
|
|
62
66
|
|
|
63
|
-
declare const
|
|
67
|
+
declare const updateDocumentStatus: (client: Client, userId: string, documentId: number, document: DocumentStatusReview) => Promise<DocumentFull>;
|
|
64
68
|
|
|
65
|
-
export { type DocumentByFranchise, type DocumentByService, type
|
|
69
|
+
export { type DocumentBody, type DocumentByFranchise, type DocumentByService, type DocumentFull, type DocumentStatus, type DocumentStatusReview, type DocumentSummary, type DocumentType, type FileUrl, createOrUpdateDocument, getUserDocuments, updateDocumentStatus };
|
package/dist/index.js
CHANGED
|
@@ -20,18 +20,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
|
|
23
|
+
createOrUpdateDocument: () => createOrUpdateDocument,
|
|
24
24
|
getUserDocuments: () => getUserDocuments,
|
|
25
|
-
|
|
25
|
+
updateDocumentStatus: () => updateDocumentStatus
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
|
-
// src/
|
|
29
|
+
// src/createOrUpdateDocument.ts
|
|
30
30
|
var import_zod = require("zod");
|
|
31
31
|
var schema = import_zod.z.object({
|
|
32
32
|
userId: import_zod.z.string().nonempty().uuid()
|
|
33
33
|
});
|
|
34
|
-
var
|
|
34
|
+
var createOrUpdateDocument = async (client, userId, document) => {
|
|
35
35
|
const result = schema.safeParse({ userId });
|
|
36
36
|
if (!result.success) {
|
|
37
37
|
throw new TypeError("Invalid args", {
|
|
@@ -59,13 +59,13 @@ var getUserDocuments = async (client, userId) => {
|
|
|
59
59
|
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/documents`).then(({ data }) => data);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
// src/
|
|
62
|
+
// src/updateDocumentStatus.ts
|
|
63
63
|
var import_zod3 = require("zod");
|
|
64
64
|
var schema3 = import_zod3.z.object({
|
|
65
65
|
userId: import_zod3.z.string().nonempty().uuid(),
|
|
66
66
|
documentId: import_zod3.z.number().nonnegative().int()
|
|
67
67
|
});
|
|
68
|
-
var
|
|
68
|
+
var updateDocumentStatus = async (client, userId, documentId, document) => {
|
|
69
69
|
const result = schema3.safeParse({ userId, documentId });
|
|
70
70
|
if (!result.success) {
|
|
71
71
|
throw new TypeError("Invalid args", {
|
|
@@ -79,7 +79,7 @@ var updateDocument = async (client, userId, documentId, document) => {
|
|
|
79
79
|
};
|
|
80
80
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
81
|
0 && (module.exports = {
|
|
82
|
-
|
|
82
|
+
createOrUpdateDocument,
|
|
83
83
|
getUserDocuments,
|
|
84
|
-
|
|
84
|
+
updateDocumentStatus
|
|
85
85
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/createOrUpdateDocument.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
var schema = z.object({
|
|
4
4
|
userId: z.string().nonempty().uuid()
|
|
5
5
|
});
|
|
6
|
-
var
|
|
6
|
+
var createOrUpdateDocument = async (client, userId, document) => {
|
|
7
7
|
const result = schema.safeParse({ userId });
|
|
8
8
|
if (!result.success) {
|
|
9
9
|
throw new TypeError("Invalid args", {
|
|
@@ -31,13 +31,13 @@ var getUserDocuments = async (client, userId) => {
|
|
|
31
31
|
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/documents`).then(({ data }) => data);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
// src/
|
|
34
|
+
// src/updateDocumentStatus.ts
|
|
35
35
|
import { z as z3 } from "zod";
|
|
36
36
|
var schema3 = z3.object({
|
|
37
37
|
userId: z3.string().nonempty().uuid(),
|
|
38
38
|
documentId: z3.number().nonnegative().int()
|
|
39
39
|
});
|
|
40
|
-
var
|
|
40
|
+
var updateDocumentStatus = async (client, userId, documentId, document) => {
|
|
41
41
|
const result = schema3.safeParse({ userId, documentId });
|
|
42
42
|
if (!result.success) {
|
|
43
43
|
throw new TypeError("Invalid args", {
|
|
@@ -50,7 +50,7 @@ var updateDocument = async (client, userId, documentId, document) => {
|
|
|
50
50
|
).then(({ data }) => data);
|
|
51
51
|
};
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
createOrUpdateDocument,
|
|
54
54
|
getUserDocuments,
|
|
55
|
-
|
|
55
|
+
updateDocumentStatus
|
|
56
56
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-document",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Vulog",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.1.
|
|
23
|
-
"@vulog/aima-core": "1.1.
|
|
22
|
+
"@vulog/aima-client": "1.1.27",
|
|
23
|
+
"@vulog/aima-core": "1.1.27"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^3.24.1"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DocumentBody, DocumentFull } from './types';
|
|
5
5
|
|
|
6
6
|
const schema = z.object({
|
|
7
7
|
userId: z.string().nonempty().uuid(),
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const createOrUpdateDocument = async (
|
|
11
11
|
client: Client,
|
|
12
12
|
userId: string,
|
|
13
|
-
document:
|
|
13
|
+
document: DocumentBody
|
|
14
14
|
): Promise<DocumentFull> => {
|
|
15
15
|
const result = schema.safeParse({ userId });
|
|
16
16
|
if (!result.success) {
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -19,6 +19,8 @@ export type FileUrl = {
|
|
|
19
19
|
name: string;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
export type DocumentStatus = 'MISSING' | 'VALID' | 'INVALID' | 'EXPIRED' | 'PENDING_REVIEW';
|
|
23
|
+
|
|
22
24
|
export type DocumentFull = {
|
|
23
25
|
id: number;
|
|
24
26
|
fleetId: string;
|
|
@@ -28,7 +30,7 @@ export type DocumentFull = {
|
|
|
28
30
|
expirationDate?: string;
|
|
29
31
|
files: FileUrl[];
|
|
30
32
|
uploadUrls: FileUrl[];
|
|
31
|
-
status:
|
|
33
|
+
status: DocumentStatus;
|
|
32
34
|
reviewer?: string;
|
|
33
35
|
issuingCountry?:
|
|
34
36
|
| 'AD'
|
|
@@ -286,11 +288,16 @@ export type DocumentFull = {
|
|
|
286
288
|
dlClass: string;
|
|
287
289
|
};
|
|
288
290
|
|
|
289
|
-
export type
|
|
291
|
+
export type DocumentBody = Partial<
|
|
292
|
+
Omit<DocumentFull, 'id' | 'fleetId' | 'documentType' | 'files' | 'uploadUrls'> | 'status' | 'reviewer'
|
|
293
|
+
> & {
|
|
290
294
|
documentType: string;
|
|
291
295
|
};
|
|
292
296
|
|
|
293
|
-
export type
|
|
297
|
+
export type DocumentStatusReview = {
|
|
298
|
+
status: DocumentStatus;
|
|
299
|
+
reviewer: string;
|
|
300
|
+
};
|
|
294
301
|
|
|
295
302
|
export type DocumentByService = {
|
|
296
303
|
serviceId: string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DocumentStatusReview, DocumentFull } from './types';
|
|
5
5
|
|
|
6
6
|
const schema = z.object({
|
|
7
7
|
userId: z.string().nonempty().uuid(),
|
|
8
8
|
documentId: z.number().nonnegative().int(),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const updateDocumentStatus = async (
|
|
12
12
|
client: Client,
|
|
13
13
|
userId: string,
|
|
14
14
|
documentId: number,
|
|
15
|
-
document:
|
|
15
|
+
document: DocumentStatusReview
|
|
16
16
|
): Promise<DocumentFull> => {
|
|
17
17
|
const result = schema.safeParse({ userId, documentId });
|
|
18
18
|
if (!result.success) {
|