@deliverart/sdk-js-user 0.1.1 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @deliverart/sdk-js-user
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2fe05cf: Remove plugin class
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -20,9 +20,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- UserPlugin: () => UserPlugin,
23
+ CreateUser: () => CreateUser,
24
+ DeleteUser: () => DeleteUser,
25
+ GetMe: () => GetMe,
26
+ GetUserDetails: () => GetUserDetails,
27
+ GetUsers: () => GetUsers,
28
+ UpdateUser: () => UpdateUser,
29
+ createUserInputSchema: () => createUserInputSchema,
30
+ createUserResponseSchema: () => createUserResponseSchema,
31
+ deleteUserInputSchema: () => deleteUserInputSchema,
32
+ deleteUserResponseSchema: () => deleteUserResponseSchema,
33
+ getMeInputSchema: () => getMeInputSchema,
34
+ getMeResponseSchema: () => getMeResponseSchema,
35
+ getUserDetailsInputSchema: () => getUserDetailsInputSchema,
36
+ getUserDetailsResponseSchema: () => getUserDetailsResponseSchema,
37
+ getUsersInputSchema: () => getUsersInputSchema,
38
+ getUsersQuerySchema: () => getUsersQuerySchema,
39
+ getUsersResponseSchema: () => getUsersResponseSchema,
24
40
  securityRoleSchema: () => securityRoleSchema,
25
41
  securityRoles: () => securityRoles,
42
+ updateUserInputSchema: () => updateUserInputSchema,
43
+ updateUserResponseSchema: () => updateUserResponseSchema,
26
44
  userSchema: () => userSchema,
27
45
  userStepSchema: () => userStepSchema,
28
46
  userSteps: () => userSteps,
@@ -105,56 +123,172 @@ var writableUserSchema = userSchema.pick({
105
123
  plainPassword: import_zod2.z.string().optional()
106
124
  }).partial();
107
125
 
108
- // src/plugin.ts
126
+ // src/requests/CreateUser.ts
127
+ var import_sdk_js_core = require("@deliverart/sdk-js-core");
128
+ var createUserInputSchema = writableUserSchema.required();
129
+ var createUserResponseSchema = userSchema;
130
+ var CreateUser = class extends import_sdk_js_core.AbstractApiRequest {
131
+ method = "POST";
132
+ contentType = "application/json";
133
+ accept = "application/json";
134
+ inputSchema = createUserInputSchema;
135
+ outputSchema = createUserResponseSchema;
136
+ querySchema = void 0;
137
+ headersSchema = void 0;
138
+ constructor(input) {
139
+ super(input);
140
+ }
141
+ getPath() {
142
+ return "/users";
143
+ }
144
+ };
145
+
146
+ // src/requests/DeleteUser.ts
147
+ var import_sdk_js_core2 = require("@deliverart/sdk-js-core");
148
+ var import_zod3 = require("zod");
149
+ var deleteUserInputSchema = import_zod3.z.undefined();
150
+ var deleteUserResponseSchema = import_zod3.z.undefined();
151
+ var DeleteUser = class extends import_sdk_js_core2.AbstractApiRequest {
152
+ method = "DELETE";
153
+ contentType = "application/json";
154
+ accept = "application/json";
155
+ inputSchema = deleteUserInputSchema;
156
+ outputSchema = deleteUserResponseSchema;
157
+ querySchema = void 0;
158
+ headersSchema = void 0;
159
+ userId;
160
+ constructor(userId) {
161
+ super();
162
+ this.userId = userId;
163
+ }
164
+ getPath() {
165
+ return `/users/${this.userId}`;
166
+ }
167
+ };
168
+
169
+ // src/requests/GetMe.ts
170
+ var import_sdk_js_core3 = require("@deliverart/sdk-js-core");
171
+ var import_zod4 = require("zod");
172
+ var getMeInputSchema = import_zod4.z.undefined();
173
+ var getMeResponseSchema = userSchema;
174
+ var GetMe = class extends import_sdk_js_core3.AbstractApiRequest {
175
+ method = "GET";
176
+ contentType = "application/json";
177
+ accept = "application/json";
178
+ inputSchema = getMeInputSchema;
179
+ outputSchema = getMeResponseSchema;
180
+ querySchema = void 0;
181
+ headersSchema = void 0;
182
+ constructor() {
183
+ super();
184
+ }
185
+ getPath() {
186
+ return "/me";
187
+ }
188
+ };
189
+
190
+ // src/requests/GetUserDetails.ts
191
+ var import_sdk_js_core4 = require("@deliverart/sdk-js-core");
192
+ var import_zod5 = require("zod");
193
+ var getUserDetailsInputSchema = import_zod5.z.undefined();
194
+ var getUserDetailsResponseSchema = userSchema;
195
+ var GetUserDetails = class extends import_sdk_js_core4.AbstractApiRequest {
196
+ method = "GET";
197
+ contentType = "application/json";
198
+ accept = "application/json";
199
+ inputSchema = getUserDetailsInputSchema;
200
+ outputSchema = getUserDetailsResponseSchema;
201
+ querySchema = void 0;
202
+ headersSchema = void 0;
203
+ userId;
204
+ constructor(userId) {
205
+ super();
206
+ this.userId = userId;
207
+ }
208
+ getPath() {
209
+ return `/users/${this.userId}`;
210
+ }
211
+ };
212
+
213
+ // src/requests/GetUsers.ts
214
+ var import_sdk_js_core5 = require("@deliverart/sdk-js-core");
109
215
  var import_sdk_js_global_types2 = require("@deliverart/sdk-js-global-types");
110
- var UserPlugin = class {
111
- setup(client) {
112
- return {
113
- me: {
114
- async get() {
115
- const response = await client.http.get("/me");
116
- return response.data;
117
- }
118
- },
119
- users: {
120
- async list(params) {
121
- const response = await client.http.get(`/users`, { params });
122
- return { data: response.data, pagination: (0, import_sdk_js_global_types2.responseToPagination)(response) };
123
- },
124
- async get(id) {
125
- const response = await client.http.get(`/users/${id}`);
126
- return response.data;
127
- },
128
- async update(id, data) {
129
- const response = await client.http.patch(`/users/${id}`, data, {
130
- headers: {
131
- "Content-Type": "application/merge-patch+json",
132
- Accept: "application/json"
133
- }
134
- });
135
- return response.data;
136
- },
137
- async create(data) {
138
- const response = await client.http.post(`/users`, data, {
139
- headers: {
140
- "Content-Type": "application/json",
141
- Accept: "application/json"
142
- }
143
- });
144
- return response.data;
145
- },
146
- async delete(id) {
147
- await client.http.delete(`/users/${id}`);
148
- }
149
- }
150
- };
216
+ var import_zod6 = require("zod");
217
+ var getUsersQuerySchema = import_zod6.z.object({
218
+ email: import_zod6.z.string().optional(),
219
+ firstName: import_zod6.z.string().optional(),
220
+ lastName: import_zod6.z.string().optional(),
221
+ suspended: import_zod6.z.string().optional(),
222
+ "order[createdAt]": import_zod6.z.enum(["asc", "desc"]).optional(),
223
+ page: import_zod6.z.coerce.number().optional(),
224
+ "roles[]": import_zod6.z.array(import_zod6.z.enum(securityRoles)).optional()
225
+ });
226
+ var getUsersResponseSchema = (0, import_sdk_js_global_types2.createPaginatedSchema)(userSchema);
227
+ var getUsersInputSchema = import_zod6.z.undefined();
228
+ var GetUsers = class extends import_sdk_js_core5.AbstractApiRequest {
229
+ method = "GET";
230
+ contentType = "application/json";
231
+ accept = "application/json";
232
+ inputSchema = getUsersInputSchema;
233
+ outputSchema = getUsersResponseSchema;
234
+ querySchema = getUsersQuerySchema;
235
+ headersSchema = void 0;
236
+ constructor(options) {
237
+ super(void 0, options);
238
+ }
239
+ getPath() {
240
+ return "/users";
241
+ }
242
+ parseResponse(data, rawResponse) {
243
+ const users = import_zod6.z.array(userSchema).parse(data);
244
+ return this.validateOutput({ data: users, pagination: (0, import_sdk_js_global_types2.responseToPagination)(rawResponse) });
245
+ }
246
+ };
247
+
248
+ // src/requests/UpdateUser.ts
249
+ var import_sdk_js_core6 = require("@deliverart/sdk-js-core");
250
+ var updateUserInputSchema = writableUserSchema;
251
+ var updateUserResponseSchema = userSchema;
252
+ var UpdateUser = class extends import_sdk_js_core6.AbstractApiRequest {
253
+ method = "PATCH";
254
+ contentType = "application/merge-patch+json";
255
+ accept = "application/json";
256
+ inputSchema = updateUserInputSchema;
257
+ outputSchema = updateUserResponseSchema;
258
+ querySchema = void 0;
259
+ headersSchema = void 0;
260
+ userId;
261
+ constructor(userId, input) {
262
+ super(input);
263
+ this.userId = userId;
264
+ }
265
+ getPath() {
266
+ return `/users/${this.userId}`;
151
267
  }
152
268
  };
153
269
  // Annotate the CommonJS export names for ESM import in node:
154
270
  0 && (module.exports = {
155
- UserPlugin,
271
+ CreateUser,
272
+ DeleteUser,
273
+ GetMe,
274
+ GetUserDetails,
275
+ GetUsers,
276
+ UpdateUser,
277
+ createUserInputSchema,
278
+ createUserResponseSchema,
279
+ deleteUserInputSchema,
280
+ deleteUserResponseSchema,
281
+ getMeInputSchema,
282
+ getMeResponseSchema,
283
+ getUserDetailsInputSchema,
284
+ getUserDetailsResponseSchema,
285
+ getUsersInputSchema,
286
+ getUsersQuerySchema,
287
+ getUsersResponseSchema,
156
288
  securityRoleSchema,
157
289
  securityRoles,
290
+ updateUserInputSchema,
291
+ updateUserResponseSchema,
158
292
  userSchema,
159
293
  userStepSchema,
160
294
  userSteps,