@palmetto/users-sdk 0.0.12 → 0.0.13
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/__generated__/schema.d.ts +731 -0
- package/dist/__generated__/schema.js +1 -0
- package/dist/base-client.d.ts +18 -0
- package/dist/base-client.js +32 -0
- package/dist/client.d.ts +56 -21
- package/dist/client.js +97 -47
- package/dist/main.js +1 -17
- package/dist/result.js +4 -9
- package/package.json +1 -1
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
export interface paths {
|
|
2
|
+
"/api/health": {
|
|
3
|
+
parameters: {
|
|
4
|
+
query?: never;
|
|
5
|
+
header?: never;
|
|
6
|
+
path?: never;
|
|
7
|
+
cookie?: never;
|
|
8
|
+
};
|
|
9
|
+
get: operations["HealthController_getHealth"];
|
|
10
|
+
put?: never;
|
|
11
|
+
post?: never;
|
|
12
|
+
delete?: never;
|
|
13
|
+
options?: never;
|
|
14
|
+
head?: never;
|
|
15
|
+
patch?: never;
|
|
16
|
+
trace?: never;
|
|
17
|
+
};
|
|
18
|
+
"/api/users/me": {
|
|
19
|
+
parameters: {
|
|
20
|
+
query?: never;
|
|
21
|
+
header?: never;
|
|
22
|
+
path?: never;
|
|
23
|
+
cookie?: never;
|
|
24
|
+
};
|
|
25
|
+
get: operations["UsersController_getMe"];
|
|
26
|
+
put?: never;
|
|
27
|
+
post?: never;
|
|
28
|
+
delete?: never;
|
|
29
|
+
options?: never;
|
|
30
|
+
head?: never;
|
|
31
|
+
patch?: never;
|
|
32
|
+
trace?: never;
|
|
33
|
+
};
|
|
34
|
+
"/api/users": {
|
|
35
|
+
parameters: {
|
|
36
|
+
query?: never;
|
|
37
|
+
header?: never;
|
|
38
|
+
path?: never;
|
|
39
|
+
cookie?: never;
|
|
40
|
+
};
|
|
41
|
+
get?: never;
|
|
42
|
+
put?: never;
|
|
43
|
+
post: operations["UsersController_create"];
|
|
44
|
+
delete?: never;
|
|
45
|
+
options?: never;
|
|
46
|
+
head?: never;
|
|
47
|
+
patch?: never;
|
|
48
|
+
trace?: never;
|
|
49
|
+
};
|
|
50
|
+
"/api/users/{id}": {
|
|
51
|
+
parameters: {
|
|
52
|
+
query?: never;
|
|
53
|
+
header?: never;
|
|
54
|
+
path?: never;
|
|
55
|
+
cookie?: never;
|
|
56
|
+
};
|
|
57
|
+
get: operations["UsersController_get"];
|
|
58
|
+
put?: never;
|
|
59
|
+
post?: never;
|
|
60
|
+
delete?: never;
|
|
61
|
+
options?: never;
|
|
62
|
+
head?: never;
|
|
63
|
+
patch?: never;
|
|
64
|
+
trace?: never;
|
|
65
|
+
};
|
|
66
|
+
"/api/users/{id}/token": {
|
|
67
|
+
parameters: {
|
|
68
|
+
query?: never;
|
|
69
|
+
header?: never;
|
|
70
|
+
path?: never;
|
|
71
|
+
cookie?: never;
|
|
72
|
+
};
|
|
73
|
+
get?: never;
|
|
74
|
+
put?: never;
|
|
75
|
+
post: operations["UsersController_getPersonalAccessToken"];
|
|
76
|
+
delete?: never;
|
|
77
|
+
options?: never;
|
|
78
|
+
head?: never;
|
|
79
|
+
patch?: never;
|
|
80
|
+
trace?: never;
|
|
81
|
+
};
|
|
82
|
+
"/api/organizations/{id}": {
|
|
83
|
+
parameters: {
|
|
84
|
+
query?: never;
|
|
85
|
+
header?: never;
|
|
86
|
+
path?: never;
|
|
87
|
+
cookie?: never;
|
|
88
|
+
};
|
|
89
|
+
get: operations["OrganizationsController_getOrganization"];
|
|
90
|
+
put?: never;
|
|
91
|
+
post?: never;
|
|
92
|
+
delete?: never;
|
|
93
|
+
options?: never;
|
|
94
|
+
head?: never;
|
|
95
|
+
patch?: never;
|
|
96
|
+
trace?: never;
|
|
97
|
+
};
|
|
98
|
+
"/api/organizations": {
|
|
99
|
+
parameters: {
|
|
100
|
+
query?: never;
|
|
101
|
+
header?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
cookie?: never;
|
|
104
|
+
};
|
|
105
|
+
get?: never;
|
|
106
|
+
put?: never;
|
|
107
|
+
post: operations["OrganizationsController_create"];
|
|
108
|
+
delete?: never;
|
|
109
|
+
options?: never;
|
|
110
|
+
head?: never;
|
|
111
|
+
patch?: never;
|
|
112
|
+
trace?: never;
|
|
113
|
+
};
|
|
114
|
+
"/api/auth/token": {
|
|
115
|
+
parameters: {
|
|
116
|
+
query?: never;
|
|
117
|
+
header?: never;
|
|
118
|
+
path?: never;
|
|
119
|
+
cookie?: never;
|
|
120
|
+
};
|
|
121
|
+
get?: never;
|
|
122
|
+
put?: never;
|
|
123
|
+
post: operations["AuthController_generateToken"];
|
|
124
|
+
delete?: never;
|
|
125
|
+
options?: never;
|
|
126
|
+
head?: never;
|
|
127
|
+
patch?: never;
|
|
128
|
+
trace?: never;
|
|
129
|
+
};
|
|
130
|
+
"/api/sign-ups": {
|
|
131
|
+
parameters: {
|
|
132
|
+
query?: never;
|
|
133
|
+
header?: never;
|
|
134
|
+
path?: never;
|
|
135
|
+
cookie?: never;
|
|
136
|
+
};
|
|
137
|
+
get?: never;
|
|
138
|
+
put?: never;
|
|
139
|
+
post: operations["SignUpsController_create"];
|
|
140
|
+
delete?: never;
|
|
141
|
+
options?: never;
|
|
142
|
+
head?: never;
|
|
143
|
+
patch?: never;
|
|
144
|
+
trace?: never;
|
|
145
|
+
};
|
|
146
|
+
"/api/sign-ups/{token}": {
|
|
147
|
+
parameters: {
|
|
148
|
+
query?: never;
|
|
149
|
+
header?: never;
|
|
150
|
+
path?: never;
|
|
151
|
+
cookie?: never;
|
|
152
|
+
};
|
|
153
|
+
get: operations["SignUpsController_findOne"];
|
|
154
|
+
put?: never;
|
|
155
|
+
post?: never;
|
|
156
|
+
delete?: never;
|
|
157
|
+
options?: never;
|
|
158
|
+
head?: never;
|
|
159
|
+
patch: operations["SignUpsController_update"];
|
|
160
|
+
trace?: never;
|
|
161
|
+
};
|
|
162
|
+
"/api/sign-ups/{token}/user": {
|
|
163
|
+
parameters: {
|
|
164
|
+
query?: never;
|
|
165
|
+
header?: never;
|
|
166
|
+
path?: never;
|
|
167
|
+
cookie?: never;
|
|
168
|
+
};
|
|
169
|
+
get?: never;
|
|
170
|
+
put?: never;
|
|
171
|
+
post: operations["SignUpsController_createUser"];
|
|
172
|
+
delete?: never;
|
|
173
|
+
options?: never;
|
|
174
|
+
head?: never;
|
|
175
|
+
patch?: never;
|
|
176
|
+
trace?: never;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export type webhooks = Record<string, never>;
|
|
180
|
+
export interface components {
|
|
181
|
+
schemas: {
|
|
182
|
+
/** User */
|
|
183
|
+
UserDto: {
|
|
184
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
185
|
+
id: string;
|
|
186
|
+
meta: {
|
|
187
|
+
/**
|
|
188
|
+
* Format: date-time
|
|
189
|
+
* @description Created at timestamp
|
|
190
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
191
|
+
*/
|
|
192
|
+
createdAt: string;
|
|
193
|
+
/**
|
|
194
|
+
* Format: date-time
|
|
195
|
+
* @description Updated at timestamp
|
|
196
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
197
|
+
*/
|
|
198
|
+
updatedAt?: string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* @description Auth0 ID
|
|
202
|
+
* @example auth0|1234567890
|
|
203
|
+
*/
|
|
204
|
+
auth0Id: null;
|
|
205
|
+
/**
|
|
206
|
+
* Format: email
|
|
207
|
+
* @description Email
|
|
208
|
+
* @example test@test.com
|
|
209
|
+
*/
|
|
210
|
+
email: string;
|
|
211
|
+
/**
|
|
212
|
+
* @description First name
|
|
213
|
+
* @example John
|
|
214
|
+
*/
|
|
215
|
+
firstName: string;
|
|
216
|
+
/**
|
|
217
|
+
* @description Last name
|
|
218
|
+
* @example Doe
|
|
219
|
+
*/
|
|
220
|
+
lastName: string;
|
|
221
|
+
/**
|
|
222
|
+
* @description User permissions
|
|
223
|
+
* @example {
|
|
224
|
+
* "photon:blueprint": [
|
|
225
|
+
* "read",
|
|
226
|
+
* "write"
|
|
227
|
+
* ]
|
|
228
|
+
* }
|
|
229
|
+
*/
|
|
230
|
+
permissions: {
|
|
231
|
+
[key: string]: string[];
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* @description Phone number
|
|
235
|
+
* @example +18048675309
|
|
236
|
+
*/
|
|
237
|
+
phoneNumber: string;
|
|
238
|
+
/**
|
|
239
|
+
* @description Organization ID
|
|
240
|
+
* @example 66e3367b141b81fb54ec4e1f
|
|
241
|
+
*/
|
|
242
|
+
organizationId: string;
|
|
243
|
+
/**
|
|
244
|
+
* @description Has Personal Access Token
|
|
245
|
+
* @example false
|
|
246
|
+
*/
|
|
247
|
+
hasPAT: boolean;
|
|
248
|
+
};
|
|
249
|
+
/** CreateUser */
|
|
250
|
+
CreateUserDto: {
|
|
251
|
+
/**
|
|
252
|
+
* @description Auth0 ID
|
|
253
|
+
* @example auth0|1234567890
|
|
254
|
+
*/
|
|
255
|
+
auth0Id: string;
|
|
256
|
+
/**
|
|
257
|
+
* Format: email
|
|
258
|
+
* @description Email
|
|
259
|
+
* @example test@test.com
|
|
260
|
+
*/
|
|
261
|
+
email: string;
|
|
262
|
+
/**
|
|
263
|
+
* @description First name
|
|
264
|
+
* @example John
|
|
265
|
+
*/
|
|
266
|
+
firstName: string;
|
|
267
|
+
/**
|
|
268
|
+
* @description Last name
|
|
269
|
+
* @example Doe
|
|
270
|
+
*/
|
|
271
|
+
lastName: string;
|
|
272
|
+
/**
|
|
273
|
+
* @description Phone number
|
|
274
|
+
* @example +18048675309
|
|
275
|
+
*/
|
|
276
|
+
phoneNumber: string;
|
|
277
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
278
|
+
organizationId: string;
|
|
279
|
+
grants?: {
|
|
280
|
+
/**
|
|
281
|
+
* @description Grant Entity
|
|
282
|
+
* @example photon:blueprint
|
|
283
|
+
*/
|
|
284
|
+
entity: string;
|
|
285
|
+
/**
|
|
286
|
+
* @description Operation
|
|
287
|
+
* @example read
|
|
288
|
+
*/
|
|
289
|
+
operation: string;
|
|
290
|
+
/**
|
|
291
|
+
* @description Deny
|
|
292
|
+
* @example false
|
|
293
|
+
*/
|
|
294
|
+
deny?: boolean;
|
|
295
|
+
}[];
|
|
296
|
+
};
|
|
297
|
+
/** User Personal Access Token */
|
|
298
|
+
UserPersonalAccessTokenDto: {
|
|
299
|
+
/**
|
|
300
|
+
* @description User ID
|
|
301
|
+
* @example 66e3367b141b81fb54ec4e1f
|
|
302
|
+
*/
|
|
303
|
+
id: string;
|
|
304
|
+
/** @description Personal access token */
|
|
305
|
+
personalAccessToken?: string;
|
|
306
|
+
};
|
|
307
|
+
/** Organization */
|
|
308
|
+
OrganizationDto: {
|
|
309
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
310
|
+
id: string;
|
|
311
|
+
meta: {
|
|
312
|
+
/**
|
|
313
|
+
* Format: date-time
|
|
314
|
+
* @description Created at timestamp
|
|
315
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
316
|
+
*/
|
|
317
|
+
createdAt: string;
|
|
318
|
+
/**
|
|
319
|
+
* Format: date-time
|
|
320
|
+
* @description Updated at timestamp
|
|
321
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
322
|
+
*/
|
|
323
|
+
updatedAt?: string;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* @description Name
|
|
327
|
+
* @example Palmetto
|
|
328
|
+
*/
|
|
329
|
+
name: string;
|
|
330
|
+
/**
|
|
331
|
+
* @description Organization permissions
|
|
332
|
+
* @example {
|
|
333
|
+
* "photon:blueprint": [
|
|
334
|
+
* "read",
|
|
335
|
+
* "write"
|
|
336
|
+
* ]
|
|
337
|
+
* }
|
|
338
|
+
*/
|
|
339
|
+
permissions: {
|
|
340
|
+
[key: string]: string[];
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
/** CreateOrganization */
|
|
344
|
+
CreateOrganizationDto: {
|
|
345
|
+
/**
|
|
346
|
+
* @description Name
|
|
347
|
+
* @example Organization Name
|
|
348
|
+
*/
|
|
349
|
+
name: string;
|
|
350
|
+
/** @description Grants */
|
|
351
|
+
grants?: {
|
|
352
|
+
/**
|
|
353
|
+
* @description Grant Entity
|
|
354
|
+
* @example photon:blueprint
|
|
355
|
+
*/
|
|
356
|
+
entity: string;
|
|
357
|
+
/**
|
|
358
|
+
* @description Operation
|
|
359
|
+
* @example read
|
|
360
|
+
*/
|
|
361
|
+
operation: string;
|
|
362
|
+
/**
|
|
363
|
+
* @description Deny
|
|
364
|
+
* @example false
|
|
365
|
+
*/
|
|
366
|
+
deny?: boolean;
|
|
367
|
+
}[];
|
|
368
|
+
};
|
|
369
|
+
/** TokenInput */
|
|
370
|
+
TokenInputDto: {
|
|
371
|
+
/** @enum {string} */
|
|
372
|
+
grant_type: "authorization_code";
|
|
373
|
+
code: string;
|
|
374
|
+
} | {
|
|
375
|
+
/** @enum {string} */
|
|
376
|
+
grant_type: "refresh_token";
|
|
377
|
+
refresh_token: string;
|
|
378
|
+
};
|
|
379
|
+
/** TokenResponse */
|
|
380
|
+
TokenResponseDto: {
|
|
381
|
+
access_token: string;
|
|
382
|
+
id_token: string;
|
|
383
|
+
refresh_token: string;
|
|
384
|
+
expires_in: number;
|
|
385
|
+
};
|
|
386
|
+
/** CreateSignUp */
|
|
387
|
+
CreateSignUpDto: {
|
|
388
|
+
/** Format: uri */
|
|
389
|
+
redirectUrl: string;
|
|
390
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
391
|
+
organizationId?: string;
|
|
392
|
+
};
|
|
393
|
+
/** SignUpToken */
|
|
394
|
+
SignUpTokenDto: {
|
|
395
|
+
token: string;
|
|
396
|
+
};
|
|
397
|
+
/** SignUp */
|
|
398
|
+
SignUpDto: {
|
|
399
|
+
/** Format: uri */
|
|
400
|
+
redirectUrl: string;
|
|
401
|
+
auth0Id?: string;
|
|
402
|
+
userId?: string;
|
|
403
|
+
organizationId?: string;
|
|
404
|
+
};
|
|
405
|
+
/** UpdateSignUp */
|
|
406
|
+
UpdateSignUpDto: {
|
|
407
|
+
/** @example auth0|6fexxxxxxxxxxxxxxxx */
|
|
408
|
+
auth0Id: string;
|
|
409
|
+
};
|
|
410
|
+
/** CreateSignUp */
|
|
411
|
+
CreateSignUpUserDto: {
|
|
412
|
+
/** @example John */
|
|
413
|
+
firstName: string;
|
|
414
|
+
/** @example Smith */
|
|
415
|
+
lastName: string;
|
|
416
|
+
/** @example +13015558080 */
|
|
417
|
+
phoneNumber: string;
|
|
418
|
+
organization?: {
|
|
419
|
+
/** @example My Organization */
|
|
420
|
+
name: string;
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
/** Paging */
|
|
424
|
+
PagingDto: {
|
|
425
|
+
/** @description Limit of records per page */
|
|
426
|
+
limit: number;
|
|
427
|
+
/** @description Current page */
|
|
428
|
+
page: number;
|
|
429
|
+
/** @description Record count this page starts on */
|
|
430
|
+
pageStart: number;
|
|
431
|
+
/** @description Record count this page ends on */
|
|
432
|
+
pageEnd: number;
|
|
433
|
+
/** @description The count of records in total */
|
|
434
|
+
totalRecords: number;
|
|
435
|
+
/** @description The count of pages in total */
|
|
436
|
+
totalPages: number;
|
|
437
|
+
};
|
|
438
|
+
PaginatedListDto: {
|
|
439
|
+
paging: components["schemas"]["PagingDto"];
|
|
440
|
+
};
|
|
441
|
+
ListDto: Record<string, never>;
|
|
442
|
+
/** Grant */
|
|
443
|
+
GrantDto: {
|
|
444
|
+
/**
|
|
445
|
+
* @description Grant entity
|
|
446
|
+
* @example photon:tasks
|
|
447
|
+
*/
|
|
448
|
+
entity: string;
|
|
449
|
+
/**
|
|
450
|
+
* @description Grant operation
|
|
451
|
+
* @example read
|
|
452
|
+
*/
|
|
453
|
+
operation: string;
|
|
454
|
+
/**
|
|
455
|
+
* @description Deny grant
|
|
456
|
+
* @example false
|
|
457
|
+
*/
|
|
458
|
+
deny?: boolean;
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
responses: never;
|
|
462
|
+
parameters: never;
|
|
463
|
+
requestBodies: never;
|
|
464
|
+
headers: never;
|
|
465
|
+
pathItems: never;
|
|
466
|
+
}
|
|
467
|
+
export type $defs = Record<string, never>;
|
|
468
|
+
export interface operations {
|
|
469
|
+
HealthController_getHealth: {
|
|
470
|
+
parameters: {
|
|
471
|
+
query?: never;
|
|
472
|
+
header?: never;
|
|
473
|
+
path?: never;
|
|
474
|
+
cookie?: never;
|
|
475
|
+
};
|
|
476
|
+
requestBody?: never;
|
|
477
|
+
responses: {
|
|
478
|
+
200: {
|
|
479
|
+
headers: {
|
|
480
|
+
[name: string]: unknown;
|
|
481
|
+
};
|
|
482
|
+
content?: never;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
UsersController_getMe: {
|
|
487
|
+
parameters: {
|
|
488
|
+
query?: never;
|
|
489
|
+
header?: never;
|
|
490
|
+
path?: never;
|
|
491
|
+
cookie?: never;
|
|
492
|
+
};
|
|
493
|
+
requestBody?: never;
|
|
494
|
+
responses: {
|
|
495
|
+
200: {
|
|
496
|
+
headers: {
|
|
497
|
+
[name: string]: unknown;
|
|
498
|
+
};
|
|
499
|
+
content: {
|
|
500
|
+
"application/json": components["schemas"]["UserDto"];
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
UsersController_create: {
|
|
506
|
+
parameters: {
|
|
507
|
+
query?: never;
|
|
508
|
+
header?: never;
|
|
509
|
+
path?: never;
|
|
510
|
+
cookie?: never;
|
|
511
|
+
};
|
|
512
|
+
requestBody: {
|
|
513
|
+
content: {
|
|
514
|
+
"application/json": components["schemas"]["CreateUserDto"];
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
responses: {
|
|
518
|
+
200: {
|
|
519
|
+
headers: {
|
|
520
|
+
[name: string]: unknown;
|
|
521
|
+
};
|
|
522
|
+
content: {
|
|
523
|
+
"application/json": components["schemas"]["UserDto"];
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
UsersController_get: {
|
|
529
|
+
parameters: {
|
|
530
|
+
query?: never;
|
|
531
|
+
header?: never;
|
|
532
|
+
path: {
|
|
533
|
+
id: string;
|
|
534
|
+
};
|
|
535
|
+
cookie?: never;
|
|
536
|
+
};
|
|
537
|
+
requestBody?: never;
|
|
538
|
+
responses: {
|
|
539
|
+
200: {
|
|
540
|
+
headers: {
|
|
541
|
+
[name: string]: unknown;
|
|
542
|
+
};
|
|
543
|
+
content: {
|
|
544
|
+
"application/json": components["schemas"]["UserDto"];
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
UsersController_getPersonalAccessToken: {
|
|
550
|
+
parameters: {
|
|
551
|
+
query?: never;
|
|
552
|
+
header?: never;
|
|
553
|
+
path: {
|
|
554
|
+
id: string;
|
|
555
|
+
};
|
|
556
|
+
cookie?: never;
|
|
557
|
+
};
|
|
558
|
+
requestBody?: never;
|
|
559
|
+
responses: {
|
|
560
|
+
200: {
|
|
561
|
+
headers: {
|
|
562
|
+
[name: string]: unknown;
|
|
563
|
+
};
|
|
564
|
+
content: {
|
|
565
|
+
"application/json": components["schemas"]["UserPersonalAccessTokenDto"];
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
OrganizationsController_getOrganization: {
|
|
571
|
+
parameters: {
|
|
572
|
+
query?: never;
|
|
573
|
+
header?: never;
|
|
574
|
+
path: {
|
|
575
|
+
id: string;
|
|
576
|
+
};
|
|
577
|
+
cookie?: never;
|
|
578
|
+
};
|
|
579
|
+
requestBody?: never;
|
|
580
|
+
responses: {
|
|
581
|
+
200: {
|
|
582
|
+
headers: {
|
|
583
|
+
[name: string]: unknown;
|
|
584
|
+
};
|
|
585
|
+
content: {
|
|
586
|
+
"application/json": components["schemas"]["OrganizationDto"];
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
OrganizationsController_create: {
|
|
592
|
+
parameters: {
|
|
593
|
+
query?: never;
|
|
594
|
+
header?: never;
|
|
595
|
+
path?: never;
|
|
596
|
+
cookie?: never;
|
|
597
|
+
};
|
|
598
|
+
requestBody: {
|
|
599
|
+
content: {
|
|
600
|
+
"application/json": components["schemas"]["CreateOrganizationDto"];
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
responses: {
|
|
604
|
+
200: {
|
|
605
|
+
headers: {
|
|
606
|
+
[name: string]: unknown;
|
|
607
|
+
};
|
|
608
|
+
content: {
|
|
609
|
+
"application/json": components["schemas"]["OrganizationDto"];
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
AuthController_generateToken: {
|
|
615
|
+
parameters: {
|
|
616
|
+
query?: never;
|
|
617
|
+
header?: never;
|
|
618
|
+
path?: never;
|
|
619
|
+
cookie?: never;
|
|
620
|
+
};
|
|
621
|
+
requestBody: {
|
|
622
|
+
content: {
|
|
623
|
+
"application/json": components["schemas"]["TokenInputDto"];
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
responses: {
|
|
627
|
+
200: {
|
|
628
|
+
headers: {
|
|
629
|
+
[name: string]: unknown;
|
|
630
|
+
};
|
|
631
|
+
content: {
|
|
632
|
+
"application/json": components["schemas"]["TokenResponseDto"];
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
SignUpsController_create: {
|
|
638
|
+
parameters: {
|
|
639
|
+
query?: never;
|
|
640
|
+
header?: never;
|
|
641
|
+
path?: never;
|
|
642
|
+
cookie?: never;
|
|
643
|
+
};
|
|
644
|
+
requestBody: {
|
|
645
|
+
content: {
|
|
646
|
+
"application/json": components["schemas"]["CreateSignUpDto"];
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
responses: {
|
|
650
|
+
200: {
|
|
651
|
+
headers: {
|
|
652
|
+
[name: string]: unknown;
|
|
653
|
+
};
|
|
654
|
+
content: {
|
|
655
|
+
"application/json": components["schemas"]["SignUpTokenDto"];
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
};
|
|
659
|
+
};
|
|
660
|
+
SignUpsController_findOne: {
|
|
661
|
+
parameters: {
|
|
662
|
+
query?: never;
|
|
663
|
+
header?: never;
|
|
664
|
+
path: {
|
|
665
|
+
token: string;
|
|
666
|
+
};
|
|
667
|
+
cookie?: never;
|
|
668
|
+
};
|
|
669
|
+
requestBody?: never;
|
|
670
|
+
responses: {
|
|
671
|
+
200: {
|
|
672
|
+
headers: {
|
|
673
|
+
[name: string]: unknown;
|
|
674
|
+
};
|
|
675
|
+
content: {
|
|
676
|
+
"application/json": components["schemas"]["SignUpDto"];
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
SignUpsController_update: {
|
|
682
|
+
parameters: {
|
|
683
|
+
query?: never;
|
|
684
|
+
header?: never;
|
|
685
|
+
path: {
|
|
686
|
+
token: string;
|
|
687
|
+
};
|
|
688
|
+
cookie?: never;
|
|
689
|
+
};
|
|
690
|
+
requestBody: {
|
|
691
|
+
content: {
|
|
692
|
+
"application/json": components["schemas"]["UpdateSignUpDto"];
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
responses: {
|
|
696
|
+
200: {
|
|
697
|
+
headers: {
|
|
698
|
+
[name: string]: unknown;
|
|
699
|
+
};
|
|
700
|
+
content: {
|
|
701
|
+
"application/json": components["schemas"]["SignUpDto"];
|
|
702
|
+
};
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
};
|
|
706
|
+
SignUpsController_createUser: {
|
|
707
|
+
parameters: {
|
|
708
|
+
query?: never;
|
|
709
|
+
header?: never;
|
|
710
|
+
path: {
|
|
711
|
+
token: string;
|
|
712
|
+
};
|
|
713
|
+
cookie?: never;
|
|
714
|
+
};
|
|
715
|
+
requestBody: {
|
|
716
|
+
content: {
|
|
717
|
+
"application/json": components["schemas"]["CreateSignUpUserDto"];
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
responses: {
|
|
721
|
+
200: {
|
|
722
|
+
headers: {
|
|
723
|
+
[name: string]: unknown;
|
|
724
|
+
};
|
|
725
|
+
content: {
|
|
726
|
+
"application/json": components["schemas"]["SignUpDto"];
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
};
|
|
731
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Middleware } from "openapi-fetch";
|
|
2
|
+
export interface CreateClientOptions {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
authToken?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApiOptions {
|
|
7
|
+
authToken?: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export declare class BaseClient<TPaths extends object> {
|
|
11
|
+
protected client: Client<TPaths, `${string}/${string}`>;
|
|
12
|
+
protected headers: Headers;
|
|
13
|
+
constructor(opts: CreateClientOptions);
|
|
14
|
+
setAuthToken(authToken: string): void;
|
|
15
|
+
use(...middleware: Middleware[]): void;
|
|
16
|
+
protected generateHeaders(opts?: ApiOptions): Headers;
|
|
17
|
+
protected mergeHeaders(overrides: Record<string, string>): Headers;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import createClient from "openapi-fetch";
|
|
2
|
+
export class BaseClient {
|
|
3
|
+
constructor(opts) {
|
|
4
|
+
this.client = createClient({ baseUrl: opts.apiUrl });
|
|
5
|
+
this.headers = new Headers();
|
|
6
|
+
if (opts.authToken) {
|
|
7
|
+
this.setAuthToken(opts.authToken);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
setAuthToken(authToken) {
|
|
11
|
+
this.headers.set("Authorization", `Bearer ${authToken}`);
|
|
12
|
+
}
|
|
13
|
+
use(...middleware) {
|
|
14
|
+
this.client.use(...middleware);
|
|
15
|
+
}
|
|
16
|
+
generateHeaders(opts) {
|
|
17
|
+
const headers = (opts === null || opts === void 0 ? void 0 : opts.headers)
|
|
18
|
+
? this.mergeHeaders(opts.headers)
|
|
19
|
+
: new Headers(this.headers);
|
|
20
|
+
if (opts === null || opts === void 0 ? void 0 : opts.authToken) {
|
|
21
|
+
headers.set("Authorization", `Bearer ${opts.authToken}`);
|
|
22
|
+
}
|
|
23
|
+
return headers;
|
|
24
|
+
}
|
|
25
|
+
mergeHeaders(overrides) {
|
|
26
|
+
const merged = new Headers(this.headers);
|
|
27
|
+
for (const key in overrides) {
|
|
28
|
+
merged.set(key, overrides[key]);
|
|
29
|
+
}
|
|
30
|
+
return merged;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { paths } from "./__generated__/schema";
|
|
2
|
+
import { ApiOptions, BaseClient } from "./base-client";
|
|
3
|
+
export type GetSignUpInput = paths["/api/sign-ups/{token}"]["get"]["parameters"]["path"];
|
|
4
|
+
export type GetSignUpResponse = paths["/api/sign-ups/{token}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
5
|
+
export type CreateSignUpUserInput = paths["/api/sign-ups/{token}/user"]["post"]["parameters"]["path"] & paths["/api/sign-ups/{token}/user"]["post"]["requestBody"]["content"]["application/json"];
|
|
6
|
+
export interface GetAuthTokenInput {
|
|
7
|
+
code: string;
|
|
5
8
|
}
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
headers?: Record<string, string>;
|
|
9
|
+
export interface RefreshTokenInput {
|
|
10
|
+
refreshToken: string;
|
|
9
11
|
}
|
|
10
|
-
export declare class UsersApiClient {
|
|
11
|
-
private client;
|
|
12
|
-
private headers;
|
|
13
|
-
constructor(opts: CreateClientOptions);
|
|
14
|
-
setAuthToken(authToken: string): void;
|
|
15
|
-
use(...middleware: Middleware[]): void;
|
|
12
|
+
export declare class UsersApiClient extends BaseClient<paths> {
|
|
16
13
|
me(opts?: ApiOptions): Promise<import("./result").ResultOk<{
|
|
17
|
-
auth0Id: string;
|
|
18
|
-
email: string;
|
|
19
14
|
id: string;
|
|
15
|
+
meta: {
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt?: string;
|
|
18
|
+
};
|
|
19
|
+
auth0Id: null;
|
|
20
|
+
email: string;
|
|
20
21
|
firstName: string;
|
|
21
22
|
lastName: string;
|
|
22
23
|
permissions: {
|
|
@@ -24,15 +25,49 @@ export declare class UsersApiClient {
|
|
|
24
25
|
};
|
|
25
26
|
phoneNumber: string;
|
|
26
27
|
organizationId: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
hasPAT: boolean;
|
|
29
|
+
}> | import("./result").ResultErr<{
|
|
30
|
+
code: "NOT_AUTHENTICATED";
|
|
31
|
+
}> | import("./result").ResultErr<{
|
|
32
|
+
code: "UNKNOWN_ERROR";
|
|
33
|
+
}>>;
|
|
34
|
+
getSignUp({ token }: GetSignUpInput, opts?: ApiOptions): Promise<import("./result").ResultErr<{
|
|
35
|
+
code: "UNKNOWN_ERROR";
|
|
36
|
+
}> | import("./result").ResultOk<{
|
|
37
|
+
redirectUrl: string;
|
|
38
|
+
auth0Id?: string;
|
|
39
|
+
userId?: string;
|
|
40
|
+
organizationId?: string;
|
|
31
41
|
}> | import("./result").ResultErr<{
|
|
42
|
+
code: "NOT_FOUND";
|
|
43
|
+
}>>;
|
|
44
|
+
createSignUpUser({ token, ...body }: CreateSignUpUserInput, opts?: ApiOptions): Promise<import("./result").ResultErr<{
|
|
32
45
|
code: "NOT_AUTHENTICATED";
|
|
33
46
|
}> | import("./result").ResultErr<{
|
|
34
47
|
code: "UNKNOWN_ERROR";
|
|
48
|
+
}> | import("./result").ResultOk<{
|
|
49
|
+
redirectUrl: string;
|
|
50
|
+
auth0Id?: string;
|
|
51
|
+
userId?: string;
|
|
52
|
+
organizationId?: string;
|
|
53
|
+
}> | import("./result").ResultErr<{
|
|
54
|
+
code: "INVALID_STATE";
|
|
55
|
+
}>>;
|
|
56
|
+
getAuthToken({ code }: GetAuthTokenInput, opts?: ApiOptions): Promise<import("./result").ResultErr<{
|
|
57
|
+
code: "UNKNOWN_ERROR";
|
|
58
|
+
}> | import("./result").ResultOk<{
|
|
59
|
+
access_token: string;
|
|
60
|
+
id_token: string;
|
|
61
|
+
refresh_token: string;
|
|
62
|
+
expires_in: number;
|
|
63
|
+
}>>;
|
|
64
|
+
refreshToken({ refreshToken }: RefreshTokenInput, opts?: ApiOptions): Promise<import("./result").ResultErr<{
|
|
65
|
+
code: "UNKNOWN_ERROR";
|
|
66
|
+
}> | import("./result").ResultOk<{
|
|
67
|
+
access_token: string;
|
|
68
|
+
id_token: string;
|
|
69
|
+
refresh_token: string;
|
|
70
|
+
expires_in: number;
|
|
35
71
|
}>>;
|
|
36
|
-
|
|
37
|
-
protected mergeHeaders(overrides: Record<string, string>): Headers;
|
|
72
|
+
private getToken;
|
|
38
73
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,57 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
4
9
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.client = (0, openapi_fetch_1.default)({ baseUrl: opts.apiUrl });
|
|
14
|
-
this.headers = new Headers();
|
|
15
|
-
if (opts.authToken) {
|
|
16
|
-
this.setAuthToken(opts.authToken);
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
17
18
|
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { BaseClient } from "./base-client";
|
|
22
|
+
import { Ok, Err } from "./result";
|
|
23
|
+
export class UsersApiClient extends BaseClient {
|
|
24
|
+
me(opts) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const { data, response } = yield this.client.GET("/api/users/me", {
|
|
27
|
+
headers: this.generateHeaders(opts),
|
|
28
|
+
});
|
|
29
|
+
if (data) {
|
|
30
|
+
return Ok(data);
|
|
31
|
+
}
|
|
32
|
+
switch (response.status) {
|
|
33
|
+
case 401:
|
|
34
|
+
case 404:
|
|
35
|
+
return Err("NOT_AUTHENTICATED");
|
|
36
|
+
default:
|
|
37
|
+
return Err("UNKNOWN_ERROR");
|
|
38
|
+
}
|
|
39
|
+
});
|
|
18
40
|
}
|
|
19
|
-
|
|
20
|
-
this
|
|
41
|
+
getSignUp(_a, opts_1) {
|
|
42
|
+
return __awaiter(this, arguments, void 0, function* ({ token }, opts) {
|
|
43
|
+
const { data, response } = yield this.client.GET("/api/sign-ups/{token}", {
|
|
44
|
+
params: { path: { token } },
|
|
45
|
+
headers: this.generateHeaders(opts),
|
|
46
|
+
});
|
|
47
|
+
if (data) {
|
|
48
|
+
return Ok(data);
|
|
49
|
+
}
|
|
50
|
+
switch (response.status) {
|
|
51
|
+
case 404:
|
|
52
|
+
return Err("NOT_FOUND");
|
|
53
|
+
default:
|
|
54
|
+
return Err("UNKNOWN_ERROR");
|
|
55
|
+
}
|
|
56
|
+
});
|
|
21
57
|
}
|
|
22
|
-
|
|
23
|
-
this
|
|
58
|
+
createSignUpUser(_a, opts) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
var { token } = _a, body = __rest(_a, ["token"]);
|
|
61
|
+
const { data, response } = yield this.client.POST("/api/sign-ups/{token}/user", {
|
|
62
|
+
headers: this.generateHeaders(opts),
|
|
63
|
+
params: { path: { token } },
|
|
64
|
+
body,
|
|
65
|
+
});
|
|
66
|
+
if (data) {
|
|
67
|
+
return Ok(data);
|
|
68
|
+
}
|
|
69
|
+
switch (response.status) {
|
|
70
|
+
case 401:
|
|
71
|
+
return Err("NOT_AUTHENTICATED");
|
|
72
|
+
case 409:
|
|
73
|
+
return Err("INVALID_STATE");
|
|
74
|
+
default:
|
|
75
|
+
return Err("UNKNOWN_ERROR");
|
|
76
|
+
}
|
|
77
|
+
});
|
|
24
78
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
79
|
+
getAuthToken(_a, opts_1) {
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* ({ code }, opts) {
|
|
81
|
+
return this.getToken({ grant_type: "authorization_code", code }, opts);
|
|
28
82
|
});
|
|
29
|
-
if (data) {
|
|
30
|
-
return (0, result_1.Ok)(data);
|
|
31
|
-
}
|
|
32
|
-
switch (response.status) {
|
|
33
|
-
case 401:
|
|
34
|
-
case 404:
|
|
35
|
-
return (0, result_1.Err)("NOT_AUTHENTICATED");
|
|
36
|
-
default:
|
|
37
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
38
|
-
}
|
|
39
83
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return headers;
|
|
84
|
+
refreshToken(_a, opts_1) {
|
|
85
|
+
return __awaiter(this, arguments, void 0, function* ({ refreshToken }, opts) {
|
|
86
|
+
return this.getToken({
|
|
87
|
+
grant_type: "refresh_token",
|
|
88
|
+
refresh_token: refreshToken,
|
|
89
|
+
}, opts);
|
|
90
|
+
});
|
|
48
91
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
getToken(input, opts) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const { data, response } = yield this.client.POST("/api/auth/token", {
|
|
95
|
+
headers: this.generateHeaders(opts),
|
|
96
|
+
body: input,
|
|
97
|
+
});
|
|
98
|
+
if (data) {
|
|
99
|
+
return Ok(data);
|
|
100
|
+
}
|
|
101
|
+
switch (response.status) {
|
|
102
|
+
default:
|
|
103
|
+
return Err("UNKNOWN_ERROR");
|
|
104
|
+
}
|
|
105
|
+
});
|
|
55
106
|
}
|
|
56
107
|
}
|
|
57
|
-
exports.UsersApiClient = UsersApiClient;
|
package/dist/main.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./client"), exports);
|
|
1
|
+
export * from "./client";
|
package/dist/result.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.
|
|
3
|
-
exports.Err = Err;
|
|
4
|
-
exports.Ok = Ok;
|
|
5
|
-
exports.assertOk = assertOk;
|
|
6
|
-
function Err(code, extra) {
|
|
7
|
-
return { ok: false, error: { ...extra, code } };
|
|
1
|
+
export function Err(code, extra) {
|
|
2
|
+
return { ok: false, error: Object.assign(Object.assign({}, extra), { code }) };
|
|
8
3
|
}
|
|
9
|
-
function Ok(data) {
|
|
4
|
+
export function Ok(data) {
|
|
10
5
|
return { ok: true, data };
|
|
11
6
|
}
|
|
12
|
-
function assertOk(result) {
|
|
7
|
+
export function assertOk(result) {
|
|
13
8
|
if (!result.ok) {
|
|
14
9
|
throw new Error("Result was an error!");
|
|
15
10
|
}
|