@deliverart/sdk-js-user 0.0.0-dev-20260721002647

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.js ADDED
@@ -0,0 +1,372 @@
1
+ // src/models.ts
2
+ import { datetimeSchema } from "@deliverart/sdk-js-global-types";
3
+ import { z as z2 } from "zod";
4
+
5
+ // src/types.ts
6
+ import { iriNullableSchema, iriSchema } from "@deliverart/sdk-js-global-types";
7
+ import { z } from "zod";
8
+ var securityRoles = [
9
+ // Role used for describe single operations
10
+ "ROLE_CUSTOMER_ACCESS",
11
+ "ROLE_BUNDLE_ACCESS",
12
+ "ROLE_DELIVERY_ACCESS",
13
+ "ROLE_POINT_OF_SALE_ACCESS",
14
+ "ROLE_MENU_ACCESS",
15
+ "ROLE_INTEGRATION_ACCESS",
16
+ "ROLE_ORDER_ACCESS",
17
+ "ROLE_LEAD_ACCESS",
18
+ "ROLE_COMPANY_ACCESS",
19
+ "ROLE_USER_ACCESS",
20
+ "ROLE_SUBSCRIPTION_ACCESS",
21
+ "ROLE_PAYMENT_ACCESS",
22
+ "ROLE_PAYMENT_CONFIG_ACCESS",
23
+ "ROLE_STATS_ACCESS",
24
+ "ROLE_DEV_ACCESS",
25
+ // Role ADMIN for single operations
26
+ "ROLE_CUSTOMER_ADMIN",
27
+ "ROLE_BUNDLE_ADMIN",
28
+ "ROLE_DELIVERY_ADMIN",
29
+ "ROLE_POINT_OF_SALE_ADMIN",
30
+ "ROLE_MENU_ADMIN",
31
+ "ROLE_INTEGRATION_ADMIN",
32
+ "ROLE_ORDER_ADMIN",
33
+ "ROLE_LEAD_ADMIN",
34
+ "ROLE_COMPANY_ADMIN",
35
+ "ROLE_USER_ADMIN",
36
+ "ROLE_SUBSCRIPTION_ADMIN",
37
+ "ROLE_PAYMENT_ADMIN",
38
+ "ROLE_PAYMENT_CONFIG_ADMIN",
39
+ "ROLE_STATS_ADMIN",
40
+ "ROLE_DEV_ADMIN",
41
+ // Role for the users
42
+ "ROLE_COURIER",
43
+ "ROLE_CUSTOMER",
44
+ "ROLE_ECOMMERCE_CUSTOMER",
45
+ "ROLE_MANAGER",
46
+ "ROLE_SUPER_ADMIN",
47
+ "ROLE_KITCHEN",
48
+ // Default user role
49
+ "ROLE_USER"
50
+ ];
51
+ var securityRoleSchema = z.enum(securityRoles);
52
+ var userSteps = [
53
+ "registration",
54
+ "verify_email",
55
+ "create_company",
56
+ "create_point_of_sale"
57
+ ];
58
+ var userStepSchema = z.enum(userSteps);
59
+ var userPreferredLocales = ["it", "en"];
60
+ var userPreferredLocaleSchema = z.enum(userPreferredLocales);
61
+ var userIriSchema = iriSchema("/users/:id");
62
+ var userNullableIriSchema = iriNullableSchema("/users/:id");
63
+
64
+ // src/models.ts
65
+ var userSchema = z2.object({
66
+ id: z2.string(),
67
+ firstName: z2.string(),
68
+ lastName: z2.string(),
69
+ email: z2.email(),
70
+ preferredLocale: userPreferredLocaleSchema,
71
+ roles: securityRoleSchema.array(),
72
+ completedSteps: userStepSchema.array(),
73
+ emailVerified: z2.boolean(),
74
+ suspended: z2.boolean(),
75
+ createdAt: datetimeSchema,
76
+ updatedAt: datetimeSchema
77
+ });
78
+ var writableUserSchema = userSchema.pick({
79
+ firstName: true,
80
+ lastName: true,
81
+ roles: true,
82
+ email: true,
83
+ preferredLocale: true
84
+ }).extend({
85
+ plainPassword: z2.string().optional()
86
+ }).partial();
87
+ var emailVerificationCodeStatusSchema = z2.object({
88
+ email: z2.email().nullable(),
89
+ emailVerified: z2.boolean(),
90
+ expiresInSeconds: z2.number().int().nullable(),
91
+ cooldownSeconds: z2.number().int(),
92
+ remainingAttempts: z2.number().int()
93
+ });
94
+ var usersQuerySchema = z2.object({
95
+ email: z2.string().optional(),
96
+ firstName: z2.string().optional(),
97
+ lastName: z2.string().optional(),
98
+ suspended: z2.string().optional(),
99
+ "order[createdAt]": z2.enum(["asc", "desc"]).optional(),
100
+ page: z2.coerce.number().optional(),
101
+ roles: z2.array(z2.enum(securityRoles)).optional()
102
+ });
103
+
104
+ // src/requests/CreateUser.ts
105
+ import { AbstractApiRequest } from "@deliverart/sdk-js-core";
106
+ var createUserInputSchema = writableUserSchema.required();
107
+ var createUserResponseSchema = userSchema;
108
+ var CreateUser = class extends AbstractApiRequest {
109
+ constructor(input) {
110
+ super(input);
111
+ this.method = "POST";
112
+ this.contentType = "application/json";
113
+ this.accept = "application/json";
114
+ this.inputSchema = createUserInputSchema;
115
+ this.outputSchema = createUserResponseSchema;
116
+ this.querySchema = void 0;
117
+ this.headersSchema = void 0;
118
+ }
119
+ getPath() {
120
+ return "/users";
121
+ }
122
+ };
123
+
124
+ // src/requests/DeleteUser.ts
125
+ import { AbstractApiRequest as AbstractApiRequest2 } from "@deliverart/sdk-js-core";
126
+ import { emptyResponseSchema } from "@deliverart/sdk-js-global-types";
127
+ import { z as z3 } from "zod";
128
+ var deleteUserInputSchema = z3.undefined();
129
+ var deleteUserResponseSchema = emptyResponseSchema;
130
+ var DeleteUser = class extends AbstractApiRequest2 {
131
+ constructor(userId) {
132
+ super(void 0);
133
+ this.method = "DELETE";
134
+ this.contentType = "application/json";
135
+ this.accept = "application/json";
136
+ this.inputSchema = deleteUserInputSchema;
137
+ this.outputSchema = deleteUserResponseSchema;
138
+ this.querySchema = void 0;
139
+ this.headersSchema = void 0;
140
+ this.userId = userId;
141
+ }
142
+ getPath() {
143
+ return `/users/${this.userId}`;
144
+ }
145
+ };
146
+
147
+ // src/requests/GetMe.ts
148
+ import { AbstractApiRequest as AbstractApiRequest3 } from "@deliverart/sdk-js-core";
149
+ import { z as z4 } from "zod";
150
+ var getMeInputSchema = z4.undefined();
151
+ var getMeResponseSchema = userSchema;
152
+ var GetMe = class extends AbstractApiRequest3 {
153
+ constructor() {
154
+ super(void 0);
155
+ this.method = "GET";
156
+ this.contentType = "application/json";
157
+ this.accept = "application/json";
158
+ this.inputSchema = getMeInputSchema;
159
+ this.outputSchema = getMeResponseSchema;
160
+ this.querySchema = void 0;
161
+ this.headersSchema = void 0;
162
+ }
163
+ getPath() {
164
+ return "/me";
165
+ }
166
+ };
167
+
168
+ // src/requests/GetUserDetails.ts
169
+ import { AbstractApiRequest as AbstractApiRequest4 } from "@deliverart/sdk-js-core";
170
+ import { z as z5 } from "zod";
171
+ var getUserDetailsInputSchema = z5.undefined();
172
+ var getUserDetailsResponseSchema = userSchema;
173
+ var GetUserDetails = class extends AbstractApiRequest4 {
174
+ constructor(userId) {
175
+ super(void 0);
176
+ this.method = "GET";
177
+ this.contentType = "application/json";
178
+ this.accept = "application/json";
179
+ this.inputSchema = getUserDetailsInputSchema;
180
+ this.outputSchema = getUserDetailsResponseSchema;
181
+ this.querySchema = void 0;
182
+ this.headersSchema = void 0;
183
+ this.userId = userId;
184
+ }
185
+ getPath() {
186
+ return `/users/${this.userId}`;
187
+ }
188
+ };
189
+
190
+ // src/requests/GetUsers.ts
191
+ import { AbstractApiRequest as AbstractApiRequest5 } from "@deliverart/sdk-js-core";
192
+ import { createPaginatedSchema } from "@deliverart/sdk-js-global-types";
193
+ import { z as z6 } from "zod";
194
+ var getUsersQuerySchema = usersQuerySchema;
195
+ var getUsersInputSchema = z6.undefined();
196
+ var getUsersResponseSchema = createPaginatedSchema(userSchema);
197
+ var GetUsers = class extends AbstractApiRequest5 {
198
+ constructor(options) {
199
+ super(void 0, options);
200
+ this.method = "GET";
201
+ this.contentType = "application/json";
202
+ this.accept = "application/json";
203
+ this.inputSchema = getUsersInputSchema;
204
+ this.outputSchema = getUsersResponseSchema;
205
+ this.querySchema = getUsersQuerySchema;
206
+ this.headersSchema = void 0;
207
+ // Declare list behavior
208
+ this.listItemSchema = userSchema;
209
+ this.paginationDefaultEnabled = true;
210
+ }
211
+ getPath() {
212
+ return "/users";
213
+ }
214
+ };
215
+
216
+ // src/requests/SendCurrentUserEmailVerificationCode.ts
217
+ import { AbstractApiRequest as AbstractApiRequest6 } from "@deliverart/sdk-js-core";
218
+ import { z as z7 } from "zod";
219
+ var sendCurrentUserEmailVerificationCodeInputSchema = z7.undefined();
220
+ var sendCurrentUserEmailVerificationCodeResponseSchema = emailVerificationCodeStatusSchema;
221
+ var SendCurrentUserEmailVerificationCode = class extends AbstractApiRequest6 {
222
+ constructor() {
223
+ super(void 0);
224
+ this.method = "POST";
225
+ this.contentType = "application/json";
226
+ this.accept = "application/json";
227
+ this.inputSchema = sendCurrentUserEmailVerificationCodeInputSchema;
228
+ this.outputSchema = sendCurrentUserEmailVerificationCodeResponseSchema;
229
+ this.querySchema = void 0;
230
+ this.headersSchema = void 0;
231
+ }
232
+ getPath() {
233
+ return "/users/me/email-verification/send";
234
+ }
235
+ };
236
+
237
+ // src/requests/SendEmailVerificationCodeByEmail.ts
238
+ import { AbstractApiRequest as AbstractApiRequest7 } from "@deliverart/sdk-js-core";
239
+ import { z as z8 } from "zod";
240
+ var sendEmailVerificationCodeByEmailInputSchema = z8.object({
241
+ email: z8.email(),
242
+ enforceCooldown: z8.boolean().optional()
243
+ });
244
+ var sendEmailVerificationCodeByEmailResponseSchema = emailVerificationCodeStatusSchema;
245
+ var SendEmailVerificationCodeByEmail = class extends AbstractApiRequest7 {
246
+ constructor(input) {
247
+ super(input);
248
+ this.method = "POST";
249
+ this.contentType = "application/json";
250
+ this.accept = "application/json";
251
+ this.inputSchema = sendEmailVerificationCodeByEmailInputSchema;
252
+ this.outputSchema = sendEmailVerificationCodeByEmailResponseSchema;
253
+ this.querySchema = void 0;
254
+ this.headersSchema = void 0;
255
+ }
256
+ getPath() {
257
+ return "/users/email-verification/send";
258
+ }
259
+ };
260
+
261
+ // src/requests/UpdateUser.ts
262
+ import { AbstractApiRequest as AbstractApiRequest8 } from "@deliverart/sdk-js-core";
263
+ var updateUserInputSchema = writableUserSchema;
264
+ var updateUserResponseSchema = userSchema;
265
+ var UpdateUser = class extends AbstractApiRequest8 {
266
+ constructor(userId, input) {
267
+ super(input);
268
+ this.method = "PATCH";
269
+ this.contentType = "application/merge-patch+json";
270
+ this.accept = "application/json";
271
+ this.inputSchema = updateUserInputSchema;
272
+ this.outputSchema = updateUserResponseSchema;
273
+ this.querySchema = void 0;
274
+ this.headersSchema = void 0;
275
+ this.userId = userId;
276
+ }
277
+ getPath() {
278
+ return `/users/${this.userId}`;
279
+ }
280
+ };
281
+
282
+ // src/requests/VerifyCurrentUserEmailVerificationCode.ts
283
+ import { AbstractApiRequest as AbstractApiRequest9 } from "@deliverart/sdk-js-core";
284
+ import { z as z9 } from "zod";
285
+ var verifyCurrentUserEmailVerificationCodeInputSchema = z9.object({
286
+ code: z9.string().regex(/^\d{6}$/)
287
+ });
288
+ var verifyCurrentUserEmailVerificationCodeResponseSchema = emailVerificationCodeStatusSchema;
289
+ var VerifyCurrentUserEmailVerificationCode = class extends AbstractApiRequest9 {
290
+ constructor(input) {
291
+ super(input);
292
+ this.method = "POST";
293
+ this.contentType = "application/json";
294
+ this.accept = "application/json";
295
+ this.inputSchema = verifyCurrentUserEmailVerificationCodeInputSchema;
296
+ this.outputSchema = verifyCurrentUserEmailVerificationCodeResponseSchema;
297
+ this.querySchema = void 0;
298
+ this.headersSchema = void 0;
299
+ }
300
+ getPath() {
301
+ return "/users/me/email-verification/verify";
302
+ }
303
+ };
304
+
305
+ // src/requests/VerifyEmailVerificationCodeByEmail.ts
306
+ import { AbstractApiRequest as AbstractApiRequest10 } from "@deliverart/sdk-js-core";
307
+ import { z as z10 } from "zod";
308
+ var verifyEmailVerificationCodeByEmailInputSchema = z10.object({
309
+ email: z10.email(),
310
+ code: z10.string().regex(/^\d{6}$/)
311
+ });
312
+ var verifyEmailVerificationCodeByEmailResponseSchema = emailVerificationCodeStatusSchema;
313
+ var VerifyEmailVerificationCodeByEmail = class extends AbstractApiRequest10 {
314
+ constructor(input) {
315
+ super(input);
316
+ this.method = "POST";
317
+ this.contentType = "application/json";
318
+ this.accept = "application/json";
319
+ this.inputSchema = verifyEmailVerificationCodeByEmailInputSchema;
320
+ this.outputSchema = verifyEmailVerificationCodeByEmailResponseSchema;
321
+ this.querySchema = void 0;
322
+ this.headersSchema = void 0;
323
+ }
324
+ getPath() {
325
+ return "/users/email-verification/verify";
326
+ }
327
+ };
328
+ export {
329
+ CreateUser,
330
+ DeleteUser,
331
+ GetMe,
332
+ GetUserDetails,
333
+ GetUsers,
334
+ SendCurrentUserEmailVerificationCode,
335
+ SendEmailVerificationCodeByEmail,
336
+ UpdateUser,
337
+ VerifyCurrentUserEmailVerificationCode,
338
+ VerifyEmailVerificationCodeByEmail,
339
+ createUserInputSchema,
340
+ createUserResponseSchema,
341
+ deleteUserInputSchema,
342
+ deleteUserResponseSchema,
343
+ emailVerificationCodeStatusSchema,
344
+ getMeInputSchema,
345
+ getMeResponseSchema,
346
+ getUserDetailsInputSchema,
347
+ getUserDetailsResponseSchema,
348
+ getUsersInputSchema,
349
+ getUsersQuerySchema,
350
+ getUsersResponseSchema,
351
+ securityRoleSchema,
352
+ securityRoles,
353
+ sendCurrentUserEmailVerificationCodeInputSchema,
354
+ sendCurrentUserEmailVerificationCodeResponseSchema,
355
+ sendEmailVerificationCodeByEmailInputSchema,
356
+ sendEmailVerificationCodeByEmailResponseSchema,
357
+ updateUserInputSchema,
358
+ updateUserResponseSchema,
359
+ userIriSchema,
360
+ userNullableIriSchema,
361
+ userPreferredLocaleSchema,
362
+ userPreferredLocales,
363
+ userSchema,
364
+ userStepSchema,
365
+ userSteps,
366
+ usersQuerySchema,
367
+ verifyCurrentUserEmailVerificationCodeInputSchema,
368
+ verifyCurrentUserEmailVerificationCodeResponseSchema,
369
+ verifyEmailVerificationCodeByEmailInputSchema,
370
+ verifyEmailVerificationCodeByEmailResponseSchema,
371
+ writableUserSchema
372
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@deliverart/sdk-js-user",
3
+ "description": "Deliverart JavaScript SDK for User Management",
4
+ "version": "0.0.0-dev-20260721002647",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "tsup": {
9
+ "tsconfig": "./tsconfig.json"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "dependencies": {
21
+ "zod": "4.3.5",
22
+ "@deliverart/sdk-js-core": "0.0.0-dev-20260721002647",
23
+ "@deliverart/sdk-js-global-types": "0.0.0-dev-20260721002647"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "scripts": {
29
+ "build": "tsup src/index.ts --dts --format esm,cjs",
30
+ "dev": "tsup src/index.ts --dts --watch"
31
+ }
32
+ }