@vulog/aima-document 1.2.17 → 1.2.19

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 CHANGED
@@ -78,4 +78,6 @@ declare const getUserDocuments: (client: Client, userId: string, types?: Persona
78
78
 
79
79
  declare const updateDocumentStatus: (client: Client, userId: string, documentId: number, document: DocumentStatusReview) => Promise<DocumentFull>;
80
80
 
81
- export { type DocumentBody, type DocumentByFranchise, type DocumentByService, type DocumentFull, type DocumentStatus, type DocumentStatusReview, type DocumentSummary, type DocumentType, type FileUrl, type PersonalInformationDocument, type PersonalInformationDocumentType, createOrUpdateDocument, getUserDocuments, personalInformationDocumentTypeSchema, personalInformationDocumentTypes, updateDocumentStatus };
81
+ declare const deleteDocument: (client: Client, userId: string, documentId: number) => Promise<void>;
82
+
83
+ export { type DocumentBody, type DocumentByFranchise, type DocumentByService, type DocumentFull, type DocumentStatus, type DocumentStatusReview, type DocumentSummary, type DocumentType, type FileUrl, type PersonalInformationDocument, type PersonalInformationDocumentType, createOrUpdateDocument, deleteDocument, getUserDocuments, personalInformationDocumentTypeSchema, personalInformationDocumentTypes, updateDocumentStatus };
package/dist/index.d.ts CHANGED
@@ -78,4 +78,6 @@ declare const getUserDocuments: (client: Client, userId: string, types?: Persona
78
78
 
79
79
  declare const updateDocumentStatus: (client: Client, userId: string, documentId: number, document: DocumentStatusReview) => Promise<DocumentFull>;
80
80
 
81
- export { type DocumentBody, type DocumentByFranchise, type DocumentByService, type DocumentFull, type DocumentStatus, type DocumentStatusReview, type DocumentSummary, type DocumentType, type FileUrl, type PersonalInformationDocument, type PersonalInformationDocumentType, createOrUpdateDocument, getUserDocuments, personalInformationDocumentTypeSchema, personalInformationDocumentTypes, updateDocumentStatus };
81
+ declare const deleteDocument: (client: Client, userId: string, documentId: number) => Promise<void>;
82
+
83
+ export { type DocumentBody, type DocumentByFranchise, type DocumentByService, type DocumentFull, type DocumentStatus, type DocumentStatusReview, type DocumentSummary, type DocumentType, type FileUrl, type PersonalInformationDocument, type PersonalInformationDocumentType, createOrUpdateDocument, deleteDocument, getUserDocuments, personalInformationDocumentTypeSchema, personalInformationDocumentTypes, updateDocumentStatus };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  createOrUpdateDocument: () => createOrUpdateDocument,
24
+ deleteDocument: () => deleteDocument,
24
25
  getUserDocuments: () => getUserDocuments,
25
26
  personalInformationDocumentTypeSchema: () => personalInformationDocumentTypeSchema,
26
27
  personalInformationDocumentTypes: () => personalInformationDocumentTypes,
@@ -104,9 +105,28 @@ var updateDocumentStatus = async (client, userId, documentId, document) => {
104
105
  }
105
106
  return client.put(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/documents/${documentId}`, document).then(({ data }) => data);
106
107
  };
108
+
109
+ // src/deleteDocument.ts
110
+ var import_zod5 = require("zod");
111
+ var schema4 = import_zod5.z.object({
112
+ userId: import_zod5.z.string().nonempty().uuid(),
113
+ documentId: import_zod5.z.number().positive().int()
114
+ });
115
+ var deleteDocument = async (client, userId, documentId) => {
116
+ const result = schema4.safeParse({ userId, documentId });
117
+ if (!result.success) {
118
+ throw new TypeError("Invalid args", {
119
+ cause: result.error.issues
120
+ });
121
+ }
122
+ await client.delete(
123
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/documents/${documentId}`
124
+ );
125
+ };
107
126
  // Annotate the CommonJS export names for ESM import in node:
108
127
  0 && (module.exports = {
109
128
  createOrUpdateDocument,
129
+ deleteDocument,
110
130
  getUserDocuments,
111
131
  personalInformationDocumentTypeSchema,
112
132
  personalInformationDocumentTypes,
package/dist/index.mjs CHANGED
@@ -74,8 +74,27 @@ var updateDocumentStatus = async (client, userId, documentId, document) => {
74
74
  }
75
75
  return client.put(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/documents/${documentId}`, document).then(({ data }) => data);
76
76
  };
77
+
78
+ // src/deleteDocument.ts
79
+ import { z as z5 } from "zod";
80
+ var schema4 = z5.object({
81
+ userId: z5.string().nonempty().uuid(),
82
+ documentId: z5.number().positive().int()
83
+ });
84
+ var deleteDocument = async (client, userId, documentId) => {
85
+ const result = schema4.safeParse({ userId, documentId });
86
+ if (!result.success) {
87
+ throw new TypeError("Invalid args", {
88
+ cause: result.error.issues
89
+ });
90
+ }
91
+ await client.delete(
92
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/documents/${documentId}`
93
+ );
94
+ };
77
95
  export {
78
96
  createOrUpdateDocument,
97
+ deleteDocument,
79
98
  getUserDocuments,
80
99
  personalInformationDocumentTypeSchema,
81
100
  personalInformationDocumentTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-document",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
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": "MIT",
21
21
  "dependencies": {
22
- "@vulog/aima-client": "1.2.17",
23
- "@vulog/aima-core": "1.2.17"
22
+ "@vulog/aima-client": "1.2.19",
23
+ "@vulog/aima-core": "1.2.19"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.25.76"
@@ -0,0 +1,20 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ const schema = z.object({
5
+ userId: z.string().nonempty().uuid(),
6
+ documentId: z.number().positive().int(),
7
+ });
8
+
9
+ export const deleteDocument = async (client: Client, userId: string, documentId: number) => {
10
+ const result = schema.safeParse({ userId, documentId });
11
+ if (!result.success) {
12
+ throw new TypeError('Invalid args', {
13
+ cause: result.error.issues,
14
+ });
15
+ }
16
+
17
+ await client.delete<void>(
18
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/documents/${documentId}`
19
+ );
20
+ };
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from './createOrUpdateDocument';
2
2
  export * from './getUserDocuments';
3
3
  export * from './types';
4
4
  export * from './updateDocumentStatus';
5
+ export * from './deleteDocument';