@vulog/aima-user 1.2.29 → 1.2.31
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.cjs +483 -0
- package/dist/index.d.cts +327 -0
- package/dist/index.d.mts +222 -200
- package/dist/index.mjs +411 -570
- package/package.json +21 -8
- package/{tsup.config.ts → tsdown.config.ts} +1 -1
- package/dist/index.d.ts +0 -305
- package/dist/index.js +0 -668
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/dist/index.js
DELETED
|
@@ -1,668 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
acceptTAndC: () => acceptTAndC,
|
|
24
|
-
accountStatus: () => accountStatus,
|
|
25
|
-
addLabelForUser: () => addLabelForUser,
|
|
26
|
-
assignBillingGroup: () => assignBillingGroup,
|
|
27
|
-
createBusinessProfile: () => createBusinessProfile,
|
|
28
|
-
createUser: () => createUser,
|
|
29
|
-
findUser: () => findUser,
|
|
30
|
-
getEntity: () => getEntity,
|
|
31
|
-
getFleetBillingGroups: () => getFleetBillingGroups,
|
|
32
|
-
getLabelsForUser: () => getLabelsForUser,
|
|
33
|
-
getProfilePersonalInfoById: () => getProfilePersonalInfoById,
|
|
34
|
-
getRegistrationOverview: () => getRegistrationOverview,
|
|
35
|
-
getUserById: () => getUserById,
|
|
36
|
-
getUserPersonalInfoById: () => getUserPersonalInfoById,
|
|
37
|
-
getUsers: () => getUsers,
|
|
38
|
-
getUsersByIds: () => getUsersByIds,
|
|
39
|
-
getUsersPIByIds: () => getUsersPIByIds,
|
|
40
|
-
personalInformationProfileTypeSchema: () => personalInformationProfileTypeSchema,
|
|
41
|
-
personalInformationProfileTypes: () => personalInformationProfileTypes,
|
|
42
|
-
personalInformationUserPaths: () => personalInformationUserPaths,
|
|
43
|
-
personalInformationUserTypeSchema: () => personalInformationUserTypeSchema,
|
|
44
|
-
personalInformationUserTypes: () => personalInformationUserTypes,
|
|
45
|
-
registerUserToService: () => registerUserToService,
|
|
46
|
-
removeLabelForUser: () => removeLabelForUser,
|
|
47
|
-
setServicesStatus: () => setServicesStatus,
|
|
48
|
-
unassignBillingGroup: () => unassignBillingGroup,
|
|
49
|
-
updateProfilePersonalInfo: () => updateProfilePersonalInfo,
|
|
50
|
-
updateUser: () => updateUser,
|
|
51
|
-
updateUserPersonalInfo: () => updateUserPersonalInfo
|
|
52
|
-
});
|
|
53
|
-
module.exports = __toCommonJS(index_exports);
|
|
54
|
-
|
|
55
|
-
// src/acceptTAndC.ts
|
|
56
|
-
var import_zod = require("zod");
|
|
57
|
-
var schema = import_zod.z.object({
|
|
58
|
-
userId: import_zod.z.string().uuid(),
|
|
59
|
-
cityId: import_zod.z.string().uuid()
|
|
60
|
-
});
|
|
61
|
-
var acceptTAndC = async (client, userId, cityId) => {
|
|
62
|
-
const result = schema.safeParse({ userId, cityId });
|
|
63
|
-
if (!result.success) {
|
|
64
|
-
throw new TypeError("Invalid args", {
|
|
65
|
-
cause: result.error.issues
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
await client.post(
|
|
69
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities/${cityId}/users/${userId}/agreements`
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// src/assignBillingGroup.ts
|
|
74
|
-
var import_zod2 = require("zod");
|
|
75
|
-
var schema2 = import_zod2.z.object({
|
|
76
|
-
entityId: import_zod2.z.string().trim().min(1).uuid(),
|
|
77
|
-
billingGroupId: import_zod2.z.string().trim().min(1).uuid()
|
|
78
|
-
});
|
|
79
|
-
var assignBillingGroup = async (client, entityId, billingGroupId) => {
|
|
80
|
-
const result = schema2.safeParse({ entityId, billingGroupId });
|
|
81
|
-
if (!result.success) {
|
|
82
|
-
throw new TypeError("Invalid args", {
|
|
83
|
-
cause: result.error.issues
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
await client.post(
|
|
87
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/billingGroup/${result.data.billingGroupId}/entities/${result.data.entityId}`
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// src/unassignBillingGroup.ts
|
|
92
|
-
var import_zod3 = require("zod");
|
|
93
|
-
var schema3 = import_zod3.z.object({
|
|
94
|
-
entityId: import_zod3.z.string().trim().min(1).uuid(),
|
|
95
|
-
billingGroupId: import_zod3.z.string().trim().min(1).uuid()
|
|
96
|
-
});
|
|
97
|
-
var unassignBillingGroup = async (client, entityId, billingGroupId) => {
|
|
98
|
-
const result = schema3.safeParse({ entityId, billingGroupId });
|
|
99
|
-
if (!result.success) {
|
|
100
|
-
throw new TypeError("Invalid args", {
|
|
101
|
-
cause: result.error.issues
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
await client.delete(
|
|
105
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/billingGroup/${billingGroupId}/entities/${entityId}`
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
// src/createBusinessProfile.ts
|
|
110
|
-
var import_zod4 = require("zod");
|
|
111
|
-
var createBusinessProfileSchema = import_zod4.z.object({
|
|
112
|
-
userId: import_zod4.z.string().nonempty().uuid(),
|
|
113
|
-
businessId: import_zod4.z.string().nonempty().uuid(),
|
|
114
|
-
data: import_zod4.z.object({
|
|
115
|
-
emailConsent: import_zod4.z.boolean(),
|
|
116
|
-
email: import_zod4.z.string().email(),
|
|
117
|
-
requestId: import_zod4.z.string().nonempty().uuid(),
|
|
118
|
-
costCenterId: import_zod4.z.string().uuid().nullish()
|
|
119
|
-
})
|
|
120
|
-
});
|
|
121
|
-
var createBusinessProfile = async (client, userId, businessId, data) => {
|
|
122
|
-
const result = createBusinessProfileSchema.safeParse({
|
|
123
|
-
userId,
|
|
124
|
-
businessId,
|
|
125
|
-
data
|
|
126
|
-
});
|
|
127
|
-
if (!result.success) {
|
|
128
|
-
throw new TypeError("Invalid argd", {
|
|
129
|
-
cause: result.error.issues
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return client.post(
|
|
133
|
-
`/boapi/proxy/business/fleets/${client.clientOptions.fleetId}/business/${businessId}/user/${userId}`,
|
|
134
|
-
result.data
|
|
135
|
-
).then(({ data: p }) => p);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// src/createUser.ts
|
|
139
|
-
var import_zod5 = require("zod");
|
|
140
|
-
var createUserSchema = import_zod5.z.object({
|
|
141
|
-
userName: import_zod5.z.string().min(1),
|
|
142
|
-
password: import_zod5.z.string().min(1),
|
|
143
|
-
locale: import_zod5.z.string().length(5),
|
|
144
|
-
email: import_zod5.z.string().min(1).email(),
|
|
145
|
-
dataPrivacyConsent: import_zod5.z.boolean().optional(),
|
|
146
|
-
profilingConsent: import_zod5.z.boolean().optional(),
|
|
147
|
-
marketingConsent: import_zod5.z.boolean().optional(),
|
|
148
|
-
phoneNumber: import_zod5.z.string().optional()
|
|
149
|
-
});
|
|
150
|
-
var createUserOptionsSchema = import_zod5.z.object({
|
|
151
|
-
tcApproval: import_zod5.z.boolean().default(true),
|
|
152
|
-
skipUserNotification: import_zod5.z.boolean().default(false)
|
|
153
|
-
}).default({
|
|
154
|
-
tcApproval: true,
|
|
155
|
-
skipUserNotification: false
|
|
156
|
-
});
|
|
157
|
-
var createUser = async (client, user, option) => {
|
|
158
|
-
const resultUser = createUserSchema.safeParse(user);
|
|
159
|
-
if (!resultUser.success) {
|
|
160
|
-
throw new TypeError("Invalid user", {
|
|
161
|
-
cause: resultUser.error.issues
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
const resultOptions = createUserOptionsSchema.safeParse(option);
|
|
165
|
-
if (!resultOptions.success) {
|
|
166
|
-
throw new TypeError("Invalid options", {
|
|
167
|
-
cause: resultOptions.error.issues
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
const searchParams = new URLSearchParams();
|
|
171
|
-
searchParams.append("tcApproval", resultOptions.data.tcApproval.toString());
|
|
172
|
-
searchParams.append("skipUserNotification", resultOptions.data.skipUserNotification.toString());
|
|
173
|
-
return client.post(
|
|
174
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/userDefault?${searchParams.toString()}`,
|
|
175
|
-
resultUser.data
|
|
176
|
-
).then(({ data }) => data);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// src/findUser.ts
|
|
180
|
-
var import_zod7 = require("zod");
|
|
181
|
-
|
|
182
|
-
// src/types.ts
|
|
183
|
-
var import_zod6 = require("zod");
|
|
184
|
-
var accountStatus = ["INCOMPLETE", "PENDING", "APPROVED", "REJECTED", "SUSPENDED", "ARCHIVED"];
|
|
185
|
-
var personalInformationUserTypes = [
|
|
186
|
-
"IDENTITY",
|
|
187
|
-
"USERNAME",
|
|
188
|
-
"BIRTH",
|
|
189
|
-
"NATIONALITY",
|
|
190
|
-
"NOTES",
|
|
191
|
-
"GENDER",
|
|
192
|
-
"PERSONAL_COMPANY",
|
|
193
|
-
"FISCAL",
|
|
194
|
-
"ADDRESS",
|
|
195
|
-
"MEMBERSHIP"
|
|
196
|
-
];
|
|
197
|
-
var personalInformationUserPaths = [
|
|
198
|
-
"/identity/firstName",
|
|
199
|
-
"/identity/lastName",
|
|
200
|
-
"/identity/middleName",
|
|
201
|
-
"/identity/preferredName",
|
|
202
|
-
"/birth/birthDate",
|
|
203
|
-
"/birth/countryBirth",
|
|
204
|
-
"/birth/provinceBirth",
|
|
205
|
-
"/birth/cityBirth",
|
|
206
|
-
"/nationality",
|
|
207
|
-
"/notes",
|
|
208
|
-
"/gender",
|
|
209
|
-
"/personalCompany/companyName",
|
|
210
|
-
"/personalCompany/companyVat",
|
|
211
|
-
"/personalCompany/companyAddress/streetName",
|
|
212
|
-
"/personalCompany/companyAddress/city",
|
|
213
|
-
"/personalCompany/companyAddress/postalCode",
|
|
214
|
-
"/personalCompany/companyAddress/region",
|
|
215
|
-
"/personalCompany/companyAddress/country",
|
|
216
|
-
"/personalCompany/companyAddress/number",
|
|
217
|
-
"/personalCompany/companyAddress/addressAdditionalInformation",
|
|
218
|
-
"/fiscalInformation/fiscal",
|
|
219
|
-
"/fiscalInformation/personalVatNumber",
|
|
220
|
-
"/fiscalInformation/sdi",
|
|
221
|
-
"/fiscalInformation/pecAddress",
|
|
222
|
-
"/fiscalInformation/marketReference",
|
|
223
|
-
"/address/streetName",
|
|
224
|
-
"/address/city",
|
|
225
|
-
"/address/postalCode",
|
|
226
|
-
"/address/region",
|
|
227
|
-
"/address/country",
|
|
228
|
-
"/address/number",
|
|
229
|
-
"/address/addressAdditionalInformation",
|
|
230
|
-
"/membership"
|
|
231
|
-
];
|
|
232
|
-
var personalInformationUserTypeSchema = import_zod6.z.enum(personalInformationUserTypes);
|
|
233
|
-
var personalInformationProfileTypes = ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
|
|
234
|
-
var personalInformationProfileTypeSchema = import_zod6.z.enum(personalInformationProfileTypes);
|
|
235
|
-
|
|
236
|
-
// src/findUser.ts
|
|
237
|
-
var searchTypes = ["email", "username", "phoneNumber"];
|
|
238
|
-
var querySchema = import_zod7.z.object({
|
|
239
|
-
searchType: import_zod7.z.enum(searchTypes),
|
|
240
|
-
searchQuery: import_zod7.z.string().min(1),
|
|
241
|
-
types: import_zod7.z.array(personalInformationUserTypeSchema).min(1)
|
|
242
|
-
});
|
|
243
|
-
var findUser = async (client, searchType, searchQuery, types) => {
|
|
244
|
-
const result = querySchema.safeParse({
|
|
245
|
-
searchType,
|
|
246
|
-
searchQuery,
|
|
247
|
-
types
|
|
248
|
-
});
|
|
249
|
-
if (!result.success) {
|
|
250
|
-
throw new TypeError("Invalid arguments", {
|
|
251
|
-
cause: result.error.issues
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
return client.post(
|
|
255
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/pi/find?types=${result.data.types.join(",")}`,
|
|
256
|
-
{
|
|
257
|
-
[result.data.searchType]: result.data.searchQuery
|
|
258
|
-
}
|
|
259
|
-
).then(({ data }) => data);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
// src/getProfilePersonalInfoById.ts
|
|
263
|
-
var import_zod8 = require("zod");
|
|
264
|
-
var argsSchema = import_zod8.z.object({
|
|
265
|
-
userId: import_zod8.z.string().trim().min(1).uuid(),
|
|
266
|
-
profileId: import_zod8.z.string().trim().min(1).uuid(),
|
|
267
|
-
types: import_zod8.z.array(personalInformationProfileTypeSchema).min(1)
|
|
268
|
-
});
|
|
269
|
-
var getProfilePersonalInfoById = async (client, userId, profileId, types) => {
|
|
270
|
-
const result = argsSchema.safeParse({ userId, profileId, types });
|
|
271
|
-
if (!result.success) {
|
|
272
|
-
throw new TypeError("Invalid args", {
|
|
273
|
-
cause: result.error.issues
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
return client.get(
|
|
277
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${result.data.userId}/profiles/${result.data.profileId}/pi?types=${result.data.types.join(",")}`
|
|
278
|
-
).then(({ data }) => data);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// src/getRegistrationOverview.ts
|
|
282
|
-
var import_zod9 = require("zod");
|
|
283
|
-
var getRegistrationOverview = async (client, userId) => {
|
|
284
|
-
const result = import_zod9.z.string().uuid().safeParse(userId);
|
|
285
|
-
if (!result.success) {
|
|
286
|
-
throw new TypeError("Invalid userId", {
|
|
287
|
-
cause: result.error.issues
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
return client.get(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/services`).then(({ data: { userId: uid, ...data } }) => data);
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
// src/getUserById.ts
|
|
294
|
-
var import_zod10 = require("zod");
|
|
295
|
-
var getUserById = async (client, id, addAccountStatus = false) => {
|
|
296
|
-
const result = import_zod10.z.string().trim().min(1).uuid().safeParse(id);
|
|
297
|
-
if (!result.success) {
|
|
298
|
-
throw new TypeError("Invalid id", {
|
|
299
|
-
cause: result.error.issues
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
const user = await client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${id}/status`).then(({ data }) => data);
|
|
303
|
-
if (addAccountStatus) {
|
|
304
|
-
user.accountStatus = await client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${id}`).then(({ data: { accountStatus: accountStatus2 } }) => accountStatus2);
|
|
305
|
-
}
|
|
306
|
-
return user;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// src/getUserPersonalInfoById.ts
|
|
310
|
-
var import_zod11 = require("zod");
|
|
311
|
-
var argsSchema2 = import_zod11.z.object({
|
|
312
|
-
id: import_zod11.z.string().trim().min(1).uuid(),
|
|
313
|
-
types: import_zod11.z.array(personalInformationUserTypeSchema).min(1)
|
|
314
|
-
});
|
|
315
|
-
var getUserPersonalInfoById = async (client, id, types) => {
|
|
316
|
-
const result = argsSchema2.safeParse({ id, types });
|
|
317
|
-
if (!result.success) {
|
|
318
|
-
throw new TypeError("Invalid args", {
|
|
319
|
-
cause: result.error.issues
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
return client.get(
|
|
323
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${result.data.id}/pi?types=${result.data.types.join(",")}`
|
|
324
|
-
).then(({ data }) => data);
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// src/getUsersPIByIds.ts
|
|
328
|
-
var import_zod12 = require("zod");
|
|
329
|
-
var argsSchema3 = import_zod12.z.object({
|
|
330
|
-
ids: import_zod12.z.array(import_zod12.z.string().trim().min(1).uuid()).min(1),
|
|
331
|
-
types: import_zod12.z.array(personalInformationUserTypeSchema).min(1)
|
|
332
|
-
});
|
|
333
|
-
var getUsersPIByIds = async (client, ids, types) => {
|
|
334
|
-
const result = argsSchema3.safeParse({ ids, types });
|
|
335
|
-
if (!result.success) {
|
|
336
|
-
throw new TypeError("Invalid args", {
|
|
337
|
-
cause: result.error.issues
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
return client.post(
|
|
341
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/pi/list?${result.data.types.map((type) => `types=${type}`).join("&")}`,
|
|
342
|
-
{
|
|
343
|
-
userIds: result.data.ids
|
|
344
|
-
}
|
|
345
|
-
).then(({ data }) => data.content);
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
// src/label.ts
|
|
349
|
-
var import_zod13 = require("zod");
|
|
350
|
-
var schema4 = import_zod13.z.object({
|
|
351
|
-
userId: import_zod13.z.string().uuid()
|
|
352
|
-
});
|
|
353
|
-
var schemaData = import_zod13.z.object({
|
|
354
|
-
userId: import_zod13.z.string().uuid(),
|
|
355
|
-
labelId: import_zod13.z.number().positive()
|
|
356
|
-
});
|
|
357
|
-
var getLabelsForUser = async (client, userId) => {
|
|
358
|
-
const result = schema4.safeParse({ userId });
|
|
359
|
-
if (!result.success) {
|
|
360
|
-
throw new TypeError("Invalid args", {
|
|
361
|
-
cause: result.error.issues
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
return client.get(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/userLabels`).then(({ data }) => data);
|
|
365
|
-
};
|
|
366
|
-
var addLabelForUser = async (client, userId, labelId) => {
|
|
367
|
-
const result = schemaData.safeParse({ userId, labelId });
|
|
368
|
-
if (!result.success) {
|
|
369
|
-
throw new TypeError("Invalid args", {
|
|
370
|
-
cause: result.error.issues
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
await client.post(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/userLabels`, {
|
|
374
|
-
labelId
|
|
375
|
-
});
|
|
376
|
-
};
|
|
377
|
-
var removeLabelForUser = async (client, userId, labelId) => {
|
|
378
|
-
const result = schemaData.safeParse({ userId, labelId });
|
|
379
|
-
if (!result.success) {
|
|
380
|
-
throw new TypeError("Invalid args", {
|
|
381
|
-
cause: result.error.issues
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
await client.delete(
|
|
385
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/userLabels/${labelId}`
|
|
386
|
-
);
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
// src/setServicesStatus.ts
|
|
390
|
-
var import_zod14 = require("zod");
|
|
391
|
-
var registrationStatus = ["APPROVED", "INCOMPLETE", "PENDING", "REJECTED", "SUSPENDED", "UNREGISTERED"];
|
|
392
|
-
var schema5 = import_zod14.z.object({
|
|
393
|
-
disableEmailNotification: import_zod14.z.boolean(),
|
|
394
|
-
operatorProfileId: import_zod14.z.string().uuid(),
|
|
395
|
-
actions: import_zod14.z.array(
|
|
396
|
-
import_zod14.z.object({
|
|
397
|
-
reasonForChange: import_zod14.z.string(),
|
|
398
|
-
serviceId: import_zod14.z.string().uuid(),
|
|
399
|
-
status: import_zod14.z.enum(registrationStatus)
|
|
400
|
-
})
|
|
401
|
-
).min(1)
|
|
402
|
-
});
|
|
403
|
-
var setServicesStatus = async (client, profileId, servicesUpdate) => {
|
|
404
|
-
const resultProfileId = import_zod14.z.string().uuid().safeParse(profileId);
|
|
405
|
-
if (!resultProfileId.success) {
|
|
406
|
-
throw new TypeError("Invalid profileId", {
|
|
407
|
-
cause: resultProfileId.error.issues
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
const resultServices = schema5.safeParse(servicesUpdate);
|
|
411
|
-
if (!resultServices.success) {
|
|
412
|
-
throw new TypeError("Invalid servicesUpdate", {
|
|
413
|
-
cause: resultServices.error.issues
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
await client.post(
|
|
417
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/profiles/${profileId}/serviceRegistrations`,
|
|
418
|
-
servicesUpdate
|
|
419
|
-
);
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
// src/registerUserToService.ts
|
|
423
|
-
var import_zod15 = require("zod");
|
|
424
|
-
var registerUserToService = async (client, entityId, serviceId) => {
|
|
425
|
-
const resultEntityId = import_zod15.z.string().uuid().safeParse(entityId);
|
|
426
|
-
if (!resultEntityId.success) {
|
|
427
|
-
throw new TypeError("Invalid entityId", {
|
|
428
|
-
cause: resultEntityId.error.issues
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
const resultServiceId = import_zod15.z.string().uuid().safeParse(serviceId);
|
|
432
|
-
if (!resultServiceId.success) {
|
|
433
|
-
throw new TypeError("Invalid serviceId", {
|
|
434
|
-
cause: resultServiceId.error.issues
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
await client.put(
|
|
438
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}/services/${serviceId}`
|
|
439
|
-
);
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
// src/updateProfilePersonalInfo.ts
|
|
443
|
-
var import_zod16 = require("zod");
|
|
444
|
-
var paths = ["/phoneNumber", "/email", "/idNumber"];
|
|
445
|
-
var schema6 = import_zod16.z.object({
|
|
446
|
-
userId: import_zod16.z.string().trim().min(1).uuid(),
|
|
447
|
-
profileId: import_zod16.z.string().trim().min(1).uuid(),
|
|
448
|
-
actions: import_zod16.z.array(
|
|
449
|
-
import_zod16.z.union([
|
|
450
|
-
import_zod16.z.object({
|
|
451
|
-
op: import_zod16.z.enum(["add", "replace"]),
|
|
452
|
-
path: import_zod16.z.enum(paths),
|
|
453
|
-
value: import_zod16.z.string().min(1)
|
|
454
|
-
}),
|
|
455
|
-
import_zod16.z.object({
|
|
456
|
-
op: import_zod16.z.literal("remove"),
|
|
457
|
-
path: import_zod16.z.enum(paths)
|
|
458
|
-
})
|
|
459
|
-
])
|
|
460
|
-
).min(1)
|
|
461
|
-
});
|
|
462
|
-
var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
|
|
463
|
-
const result = schema6.safeParse({ userId, profileId, actions });
|
|
464
|
-
if (!result.success) {
|
|
465
|
-
throw new TypeError("Invalid args", {
|
|
466
|
-
cause: result.error.issues
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
await client.patch(
|
|
470
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/profiles/${profileId}/pi`,
|
|
471
|
-
actions,
|
|
472
|
-
{
|
|
473
|
-
headers: {
|
|
474
|
-
"Content-Type": "application/json-patch+json"
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
);
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
// src/updateUser.ts
|
|
481
|
-
var import_zod17 = require("zod");
|
|
482
|
-
var schema7 = import_zod17.z.object({
|
|
483
|
-
id: import_zod17.z.string().trim().min(1).uuid(),
|
|
484
|
-
user: import_zod17.z.object({
|
|
485
|
-
locale: import_zod17.z.string(),
|
|
486
|
-
accountStatus: import_zod17.z.enum(accountStatus),
|
|
487
|
-
dataPrivacyConsent: import_zod17.z.boolean(),
|
|
488
|
-
marketingConsent: import_zod17.z.boolean(),
|
|
489
|
-
surveyConsent: import_zod17.z.boolean(),
|
|
490
|
-
shareDataConsent: import_zod17.z.boolean(),
|
|
491
|
-
profilingConsent: import_zod17.z.boolean(),
|
|
492
|
-
membershipNumber: import_zod17.z.string()
|
|
493
|
-
}).partial()
|
|
494
|
-
});
|
|
495
|
-
var updateUser = async (client, id, user) => {
|
|
496
|
-
const result = schema7.safeParse({ id, user });
|
|
497
|
-
if (!result.success) {
|
|
498
|
-
throw new TypeError("Invalid args", {
|
|
499
|
-
cause: result.error.issues
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${id}`, user).then(({ data }) => data);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
// src/updateUserPersonalInfo.ts
|
|
506
|
-
var import_zod18 = require("zod");
|
|
507
|
-
var schema8 = import_zod18.z.object({
|
|
508
|
-
userId: import_zod18.z.string().trim().min(1).uuid(),
|
|
509
|
-
actions: import_zod18.z.array(
|
|
510
|
-
import_zod18.z.union([
|
|
511
|
-
import_zod18.z.object({
|
|
512
|
-
op: import_zod18.z.enum(["add", "replace"]),
|
|
513
|
-
path: import_zod18.z.enum(personalInformationUserPaths),
|
|
514
|
-
value: import_zod18.z.string().min(1)
|
|
515
|
-
}),
|
|
516
|
-
import_zod18.z.object({
|
|
517
|
-
op: import_zod18.z.literal("remove"),
|
|
518
|
-
path: import_zod18.z.enum(personalInformationUserPaths)
|
|
519
|
-
})
|
|
520
|
-
])
|
|
521
|
-
).min(1)
|
|
522
|
-
});
|
|
523
|
-
var updateUserPersonalInfo = async (client, userId, actions) => {
|
|
524
|
-
const result = schema8.safeParse({ userId, actions });
|
|
525
|
-
if (!result.success) {
|
|
526
|
-
throw new TypeError("Invalid args", {
|
|
527
|
-
cause: result.error.issues
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
await client.patch(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/${userId}/pi`, actions, {
|
|
531
|
-
headers: {
|
|
532
|
-
"Content-Type": "application/json-patch+json"
|
|
533
|
-
}
|
|
534
|
-
}).then(({ data }) => data);
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
// src/getEntity.ts
|
|
538
|
-
var import_zod19 = require("zod");
|
|
539
|
-
var getEntity = async (client, entityId) => {
|
|
540
|
-
const result = import_zod19.z.string().trim().min(1).uuid().safeParse(entityId);
|
|
541
|
-
if (!result.success) {
|
|
542
|
-
throw new TypeError("Invalid entity id", {
|
|
543
|
-
cause: result.error.issues
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
const entity = await client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}`).then(({ data }) => data);
|
|
547
|
-
return entity;
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
// src/getFleetBillingGroups.ts
|
|
551
|
-
var import_aima_core = require("@vulog/aima-core");
|
|
552
|
-
var getFleetBillingGroups = async (client, options) => {
|
|
553
|
-
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)().default({});
|
|
554
|
-
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
555
|
-
if (!resultOptions.success) {
|
|
556
|
-
throw new TypeError("Invalid options", {
|
|
557
|
-
cause: resultOptions.error.issues
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
const finalOptions = resultOptions.data;
|
|
561
|
-
const searchParams = new URLSearchParams();
|
|
562
|
-
searchParams.append("page", finalOptions.page.toString());
|
|
563
|
-
searchParams.append("size", finalOptions.pageSize.toString());
|
|
564
|
-
return client.get(
|
|
565
|
-
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/billingGroup?${searchParams.toString()}`
|
|
566
|
-
).then(({ data, headers }) => {
|
|
567
|
-
return {
|
|
568
|
-
data,
|
|
569
|
-
page: headers.number,
|
|
570
|
-
pageSize: headers.size,
|
|
571
|
-
total: headers.totalelements,
|
|
572
|
-
totalPages: headers.totalpages
|
|
573
|
-
};
|
|
574
|
-
}).catch((error) => {
|
|
575
|
-
throw new Error(`Failed to get fleet billing groups: ${error.message}`);
|
|
576
|
-
});
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
// src/getUsersByIds.ts
|
|
580
|
-
var import_zod20 = require("zod");
|
|
581
|
-
var argsSchema4 = import_zod20.z.object({
|
|
582
|
-
ids: import_zod20.z.array(import_zod20.z.string().trim().min(1).uuid()).min(1)
|
|
583
|
-
});
|
|
584
|
-
var getUsersByIds = async (client, ids) => {
|
|
585
|
-
const result = argsSchema4.safeParse({ ids });
|
|
586
|
-
if (!result.success) {
|
|
587
|
-
throw new TypeError("Invalid args", {
|
|
588
|
-
cause: result.error.issues
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/list`, result.data.ids).then(({ data }) => data);
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
// src/getUsers.ts
|
|
595
|
-
var import_aima_core2 = require("@vulog/aima-core");
|
|
596
|
-
var import_zod21 = require("zod");
|
|
597
|
-
var statusSchema = import_zod21.z.enum(["PENDING", "INCOMPLETE", "SUSPENDED", "REJECTED", "APPROVED"]);
|
|
598
|
-
var profileTypeSchema = import_zod21.z.enum(["Single", "Business"]);
|
|
599
|
-
var userFiltersSchema = import_zod21.z.object({
|
|
600
|
-
status: statusSchema.optional(),
|
|
601
|
-
profileType: profileTypeSchema.optional(),
|
|
602
|
-
serviceId: import_zod21.z.string().uuid().optional()
|
|
603
|
-
});
|
|
604
|
-
var sortSchema = import_zod21.z.enum(["registrationDate", "userName", "firstName", "lastName", "updateDate"]);
|
|
605
|
-
var getUsers = async (client, options) => {
|
|
606
|
-
const paginableOptionsSchema = (0, import_aima_core2.createPaginableOptionsSchema)(
|
|
607
|
-
userFiltersSchema.default({}),
|
|
608
|
-
sortSchema.optional().default("registrationDate")
|
|
609
|
-
).default({});
|
|
610
|
-
const resultOptions = paginableOptionsSchema.safeParse(options);
|
|
611
|
-
if (!resultOptions.success) {
|
|
612
|
-
throw new TypeError("Invalid options", {
|
|
613
|
-
cause: resultOptions.error.issues
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
const finalOptions = resultOptions.data;
|
|
617
|
-
const searchParams = new URLSearchParams();
|
|
618
|
-
searchParams.append("page", finalOptions.page.toString());
|
|
619
|
-
searchParams.append("size", finalOptions.pageSize.toString());
|
|
620
|
-
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
621
|
-
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
622
|
-
if (value === void 0) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
searchParams.append(key, value);
|
|
626
|
-
});
|
|
627
|
-
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users?${searchParams.toString()}`).then(({ data, headers }) => {
|
|
628
|
-
return {
|
|
629
|
-
data,
|
|
630
|
-
page: headers.number,
|
|
631
|
-
pageSize: headers.size,
|
|
632
|
-
total: headers.totalelements,
|
|
633
|
-
totalPages: headers.totalpages
|
|
634
|
-
};
|
|
635
|
-
});
|
|
636
|
-
};
|
|
637
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
638
|
-
0 && (module.exports = {
|
|
639
|
-
acceptTAndC,
|
|
640
|
-
accountStatus,
|
|
641
|
-
addLabelForUser,
|
|
642
|
-
assignBillingGroup,
|
|
643
|
-
createBusinessProfile,
|
|
644
|
-
createUser,
|
|
645
|
-
findUser,
|
|
646
|
-
getEntity,
|
|
647
|
-
getFleetBillingGroups,
|
|
648
|
-
getLabelsForUser,
|
|
649
|
-
getProfilePersonalInfoById,
|
|
650
|
-
getRegistrationOverview,
|
|
651
|
-
getUserById,
|
|
652
|
-
getUserPersonalInfoById,
|
|
653
|
-
getUsers,
|
|
654
|
-
getUsersByIds,
|
|
655
|
-
getUsersPIByIds,
|
|
656
|
-
personalInformationProfileTypeSchema,
|
|
657
|
-
personalInformationProfileTypes,
|
|
658
|
-
personalInformationUserPaths,
|
|
659
|
-
personalInformationUserTypeSchema,
|
|
660
|
-
personalInformationUserTypes,
|
|
661
|
-
registerUserToService,
|
|
662
|
-
removeLabelForUser,
|
|
663
|
-
setServicesStatus,
|
|
664
|
-
unassignBillingGroup,
|
|
665
|
-
updateProfilePersonalInfo,
|
|
666
|
-
updateUser,
|
|
667
|
-
updateUserPersonalInfo
|
|
668
|
-
});
|
|
File without changes
|