@palmetto/users-sdk 0.1.0 → 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/dist/__generated__/schema.d.ts +500 -23
- package/dist/__generated__/schema.js +2 -1
- package/dist/client.d.ts +101 -3
- package/dist/client.js +118 -15
- package/dist/main.d.ts +1 -0
- package/dist/main.js +17 -1
- package/package.json +4 -3
- package/dist/base-client.d.ts +0 -18
- package/dist/base-client.js +0 -32
- package/dist/result.d.ts +0 -19
- package/dist/result.js +0 -11
|
@@ -28,7 +28,7 @@ export interface paths {
|
|
|
28
28
|
delete?: never;
|
|
29
29
|
options?: never;
|
|
30
30
|
head?: never;
|
|
31
|
-
patch
|
|
31
|
+
patch: operations["UsersController_updateMe"];
|
|
32
32
|
trace?: never;
|
|
33
33
|
};
|
|
34
34
|
"/api/users": {
|
|
@@ -38,7 +38,7 @@ export interface paths {
|
|
|
38
38
|
path?: never;
|
|
39
39
|
cookie?: never;
|
|
40
40
|
};
|
|
41
|
-
get
|
|
41
|
+
get: operations["UsersController_findAll"];
|
|
42
42
|
put?: never;
|
|
43
43
|
post: operations["UsersController_create"];
|
|
44
44
|
delete?: never;
|
|
@@ -57,10 +57,10 @@ export interface paths {
|
|
|
57
57
|
get: operations["UsersController_get"];
|
|
58
58
|
put?: never;
|
|
59
59
|
post?: never;
|
|
60
|
-
delete
|
|
60
|
+
delete: operations["UsersController_delete"];
|
|
61
61
|
options?: never;
|
|
62
62
|
head?: never;
|
|
63
|
-
patch
|
|
63
|
+
patch: operations["UsersController_update"];
|
|
64
64
|
trace?: never;
|
|
65
65
|
};
|
|
66
66
|
"/api/users/{id}/token": {
|
|
@@ -79,6 +79,22 @@ export interface paths {
|
|
|
79
79
|
patch?: never;
|
|
80
80
|
trace?: never;
|
|
81
81
|
};
|
|
82
|
+
"/api/users/{id}/grants": {
|
|
83
|
+
parameters: {
|
|
84
|
+
query?: never;
|
|
85
|
+
header?: never;
|
|
86
|
+
path?: never;
|
|
87
|
+
cookie?: never;
|
|
88
|
+
};
|
|
89
|
+
get?: never;
|
|
90
|
+
put?: never;
|
|
91
|
+
post: operations["UsersController_addGrant"];
|
|
92
|
+
delete: operations["UsersController_removeGrant"];
|
|
93
|
+
options?: never;
|
|
94
|
+
head?: never;
|
|
95
|
+
patch?: never;
|
|
96
|
+
trace?: never;
|
|
97
|
+
};
|
|
82
98
|
"/api/organizations/{id}": {
|
|
83
99
|
parameters: {
|
|
84
100
|
query?: never;
|
|
@@ -92,7 +108,7 @@ export interface paths {
|
|
|
92
108
|
delete?: never;
|
|
93
109
|
options?: never;
|
|
94
110
|
head?: never;
|
|
95
|
-
patch
|
|
111
|
+
patch: operations["OrganizationsController_update"];
|
|
96
112
|
trace?: never;
|
|
97
113
|
};
|
|
98
114
|
"/api/organizations": {
|
|
@@ -134,8 +150,10 @@ export interface paths {
|
|
|
134
150
|
path?: never;
|
|
135
151
|
cookie?: never;
|
|
136
152
|
};
|
|
137
|
-
|
|
153
|
+
/** Get pending sign ups */
|
|
154
|
+
get: operations["SignUpsController_findAll"];
|
|
138
155
|
put?: never;
|
|
156
|
+
/** Create Sign Up */
|
|
139
157
|
post: operations["SignUpsController_create"];
|
|
140
158
|
delete?: never;
|
|
141
159
|
options?: never;
|
|
@@ -150,12 +168,14 @@ export interface paths {
|
|
|
150
168
|
path?: never;
|
|
151
169
|
cookie?: never;
|
|
152
170
|
};
|
|
171
|
+
/** Find Sign Up By Token */
|
|
153
172
|
get: operations["SignUpsController_findOne"];
|
|
154
173
|
put?: never;
|
|
155
174
|
post?: never;
|
|
156
175
|
delete?: never;
|
|
157
176
|
options?: never;
|
|
158
177
|
head?: never;
|
|
178
|
+
/** Update Sign Up By Token */
|
|
159
179
|
patch: operations["SignUpsController_update"];
|
|
160
180
|
trace?: never;
|
|
161
181
|
};
|
|
@@ -168,6 +188,7 @@ export interface paths {
|
|
|
168
188
|
};
|
|
169
189
|
get?: never;
|
|
170
190
|
put?: never;
|
|
191
|
+
/** Create User By Sign Up Token */
|
|
171
192
|
post: operations["SignUpsController_createUser"];
|
|
172
193
|
delete?: never;
|
|
173
194
|
options?: never;
|
|
@@ -175,6 +196,40 @@ export interface paths {
|
|
|
175
196
|
patch?: never;
|
|
176
197
|
trace?: never;
|
|
177
198
|
};
|
|
199
|
+
"/api/sign-ups/{id}": {
|
|
200
|
+
parameters: {
|
|
201
|
+
query?: never;
|
|
202
|
+
header?: never;
|
|
203
|
+
path?: never;
|
|
204
|
+
cookie?: never;
|
|
205
|
+
};
|
|
206
|
+
get?: never;
|
|
207
|
+
put?: never;
|
|
208
|
+
post?: never;
|
|
209
|
+
/** Delete Sign Up */
|
|
210
|
+
delete: operations["SignUpsController_delete"];
|
|
211
|
+
options?: never;
|
|
212
|
+
head?: never;
|
|
213
|
+
patch?: never;
|
|
214
|
+
trace?: never;
|
|
215
|
+
};
|
|
216
|
+
"/api/search/users": {
|
|
217
|
+
parameters: {
|
|
218
|
+
query?: never;
|
|
219
|
+
header?: never;
|
|
220
|
+
path?: never;
|
|
221
|
+
cookie?: never;
|
|
222
|
+
};
|
|
223
|
+
get?: never;
|
|
224
|
+
put?: never;
|
|
225
|
+
/** Search users */
|
|
226
|
+
post: operations["SearchUsersController_search"];
|
|
227
|
+
delete?: never;
|
|
228
|
+
options?: never;
|
|
229
|
+
head?: never;
|
|
230
|
+
patch?: never;
|
|
231
|
+
trace?: never;
|
|
232
|
+
};
|
|
178
233
|
}
|
|
179
234
|
export type webhooks = Record<string, never>;
|
|
180
235
|
export interface components {
|
|
@@ -246,6 +301,24 @@ export interface components {
|
|
|
246
301
|
*/
|
|
247
302
|
hasPAT: boolean;
|
|
248
303
|
};
|
|
304
|
+
/** UpdateUser */
|
|
305
|
+
UpdateUserDto: {
|
|
306
|
+
/**
|
|
307
|
+
* @description First name
|
|
308
|
+
* @example John
|
|
309
|
+
*/
|
|
310
|
+
firstName?: string;
|
|
311
|
+
/**
|
|
312
|
+
* @description Last name
|
|
313
|
+
* @example Doe
|
|
314
|
+
*/
|
|
315
|
+
lastName?: string;
|
|
316
|
+
/**
|
|
317
|
+
* @description Phone number
|
|
318
|
+
* @example +18048675309
|
|
319
|
+
*/
|
|
320
|
+
phoneNumber?: string;
|
|
321
|
+
};
|
|
249
322
|
/** CreateUser */
|
|
250
323
|
CreateUserDto: {
|
|
251
324
|
/**
|
|
@@ -304,6 +377,19 @@ export interface components {
|
|
|
304
377
|
/** @description Personal access token */
|
|
305
378
|
personalAccessToken?: string;
|
|
306
379
|
};
|
|
380
|
+
/** GrantInput */
|
|
381
|
+
GrantInputDto: {
|
|
382
|
+
/**
|
|
383
|
+
* @description Grant Entity
|
|
384
|
+
* @example photon:blueprint
|
|
385
|
+
*/
|
|
386
|
+
entity: string;
|
|
387
|
+
/**
|
|
388
|
+
* @description Operation
|
|
389
|
+
* @example read
|
|
390
|
+
*/
|
|
391
|
+
operation: string;
|
|
392
|
+
};
|
|
307
393
|
/** Organization */
|
|
308
394
|
OrganizationDto: {
|
|
309
395
|
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
@@ -366,6 +452,14 @@ export interface components {
|
|
|
366
452
|
deny?: boolean;
|
|
367
453
|
}[];
|
|
368
454
|
};
|
|
455
|
+
/** UpdateOrganization */
|
|
456
|
+
UpdateOrganizationDto: {
|
|
457
|
+
/**
|
|
458
|
+
* @description Organization name
|
|
459
|
+
* @example Updated Organization Name
|
|
460
|
+
*/
|
|
461
|
+
name: string;
|
|
462
|
+
};
|
|
369
463
|
/** TokenInput */
|
|
370
464
|
TokenInputDto: {
|
|
371
465
|
/** @enum {string} */
|
|
@@ -389,11 +483,25 @@ export interface components {
|
|
|
389
483
|
redirectUrl: string;
|
|
390
484
|
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
391
485
|
organizationId?: string;
|
|
486
|
+
firstName?: string;
|
|
487
|
+
lastName?: string;
|
|
488
|
+
/** Format: email */
|
|
489
|
+
email?: string;
|
|
392
490
|
};
|
|
393
491
|
/** SignUpToken */
|
|
394
492
|
SignUpTokenDto: {
|
|
395
493
|
token: string;
|
|
396
494
|
};
|
|
495
|
+
/** SignUpAdmin */
|
|
496
|
+
SignUpAdminDto: {
|
|
497
|
+
id: string;
|
|
498
|
+
auth0Id?: string;
|
|
499
|
+
userId?: string;
|
|
500
|
+
organizationId?: string;
|
|
501
|
+
firstName?: string;
|
|
502
|
+
lastName?: string;
|
|
503
|
+
email?: string;
|
|
504
|
+
};
|
|
397
505
|
/** SignUp */
|
|
398
506
|
SignUpDto: {
|
|
399
507
|
/** Format: uri */
|
|
@@ -401,6 +509,9 @@ export interface components {
|
|
|
401
509
|
auth0Id?: string;
|
|
402
510
|
userId?: string;
|
|
403
511
|
organizationId?: string;
|
|
512
|
+
firstName?: string;
|
|
513
|
+
lastName?: string;
|
|
514
|
+
email?: string;
|
|
404
515
|
};
|
|
405
516
|
/** UpdateSignUp */
|
|
406
517
|
UpdateSignUpDto: {
|
|
@@ -420,25 +531,152 @@ export interface components {
|
|
|
420
531
|
name: string;
|
|
421
532
|
};
|
|
422
533
|
};
|
|
423
|
-
/**
|
|
424
|
-
|
|
425
|
-
/** @
|
|
426
|
-
|
|
427
|
-
|
|
534
|
+
/** SearchUser */
|
|
535
|
+
SearchUserDto: {
|
|
536
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
537
|
+
id: string;
|
|
538
|
+
meta: {
|
|
539
|
+
/**
|
|
540
|
+
* Format: date-time
|
|
541
|
+
* @description Created at timestamp
|
|
542
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
543
|
+
*/
|
|
544
|
+
createdAt: string;
|
|
545
|
+
/**
|
|
546
|
+
* Format: date-time
|
|
547
|
+
* @description Updated at timestamp
|
|
548
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
549
|
+
*/
|
|
550
|
+
updatedAt?: string;
|
|
551
|
+
};
|
|
552
|
+
/**
|
|
553
|
+
* @description Auth0 ID
|
|
554
|
+
* @example auth0|1234567890
|
|
555
|
+
*/
|
|
556
|
+
auth0Id: null;
|
|
557
|
+
/**
|
|
558
|
+
* Format: email
|
|
559
|
+
* @description Email
|
|
560
|
+
* @example test@test.com
|
|
561
|
+
*/
|
|
562
|
+
email: string;
|
|
563
|
+
/**
|
|
564
|
+
* @description First name
|
|
565
|
+
* @example John
|
|
566
|
+
*/
|
|
567
|
+
firstName: string;
|
|
568
|
+
/**
|
|
569
|
+
* @description Last name
|
|
570
|
+
* @example Doe
|
|
571
|
+
*/
|
|
572
|
+
lastName: string;
|
|
573
|
+
/**
|
|
574
|
+
* @description User permissions
|
|
575
|
+
* @example {
|
|
576
|
+
* "photon:blueprint": [
|
|
577
|
+
* "read",
|
|
578
|
+
* "write"
|
|
579
|
+
* ]
|
|
580
|
+
* }
|
|
581
|
+
*/
|
|
582
|
+
permissions: {
|
|
583
|
+
[key: string]: string[];
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* @description Phone number
|
|
587
|
+
* @example +18048675309
|
|
588
|
+
*/
|
|
589
|
+
phoneNumber: string;
|
|
590
|
+
/**
|
|
591
|
+
* @description Organization ID
|
|
592
|
+
* @example 66e3367b141b81fb54ec4e1f
|
|
593
|
+
*/
|
|
594
|
+
organizationId: string;
|
|
595
|
+
/**
|
|
596
|
+
* @description Has Personal Access Token
|
|
597
|
+
* @example false
|
|
598
|
+
*/
|
|
599
|
+
hasPAT: boolean;
|
|
600
|
+
};
|
|
601
|
+
/** SearchUsersInput */
|
|
602
|
+
SearchUsersInputDto: {
|
|
603
|
+
/** @default 1 */
|
|
428
604
|
page: number;
|
|
429
|
-
/** @
|
|
430
|
-
|
|
431
|
-
/** @
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
605
|
+
/** @default 10 */
|
|
606
|
+
limit: number;
|
|
607
|
+
/** @default */
|
|
608
|
+
query: string;
|
|
609
|
+
/**
|
|
610
|
+
* @default []
|
|
611
|
+
* @example [
|
|
612
|
+
* {
|
|
613
|
+
* "filter": "organizationId",
|
|
614
|
+
* "operation": {
|
|
615
|
+
* "equals": "64d4f9994aaabec07646c9aa"
|
|
616
|
+
* }
|
|
617
|
+
* }
|
|
618
|
+
* ]
|
|
619
|
+
*/
|
|
620
|
+
filters: ({
|
|
621
|
+
/** @enum {string} */
|
|
622
|
+
filter: "organizationId";
|
|
623
|
+
operation: {
|
|
624
|
+
equals: string;
|
|
625
|
+
/** @default false */
|
|
626
|
+
inverse: boolean;
|
|
627
|
+
} | {
|
|
628
|
+
in: string[];
|
|
629
|
+
/** @default false */
|
|
630
|
+
inverse: boolean;
|
|
631
|
+
};
|
|
632
|
+
} | {
|
|
633
|
+
/** @enum {string} */
|
|
634
|
+
filter: "email";
|
|
635
|
+
operation: {
|
|
636
|
+
equals: string;
|
|
637
|
+
/** @default false */
|
|
638
|
+
inverse: boolean;
|
|
639
|
+
};
|
|
640
|
+
} | {
|
|
641
|
+
/** @enum {string} */
|
|
642
|
+
filter: "firstName";
|
|
643
|
+
operation: {
|
|
644
|
+
equals: string;
|
|
645
|
+
/** @default false */
|
|
646
|
+
inverse: boolean;
|
|
647
|
+
};
|
|
648
|
+
} | {
|
|
649
|
+
/** @enum {string} */
|
|
650
|
+
filter: "lastName";
|
|
651
|
+
operation: {
|
|
652
|
+
equals: string;
|
|
653
|
+
/** @default false */
|
|
654
|
+
inverse: boolean;
|
|
655
|
+
};
|
|
656
|
+
})[];
|
|
437
657
|
};
|
|
658
|
+
/** PaginatedList */
|
|
438
659
|
PaginatedListDto: {
|
|
439
|
-
|
|
660
|
+
data: unknown[];
|
|
661
|
+
paging: {
|
|
662
|
+
/** @description Limit of records per page */
|
|
663
|
+
limit: number;
|
|
664
|
+
/** @description Current page */
|
|
665
|
+
page: number;
|
|
666
|
+
/** @description Record count this page starts on */
|
|
667
|
+
pageStart: number;
|
|
668
|
+
/** @description Record count this page ends on */
|
|
669
|
+
pageEnd: number;
|
|
670
|
+
/** @description The count of records in total */
|
|
671
|
+
totalRecords: number;
|
|
672
|
+
/** @description The count of pages in total */
|
|
673
|
+
totalPages: number;
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
/** List */
|
|
677
|
+
ListDto: {
|
|
678
|
+
data: unknown[];
|
|
440
679
|
};
|
|
441
|
-
ListDto: Record<string, never>;
|
|
442
680
|
/** Grant */
|
|
443
681
|
GrantDto: {
|
|
444
682
|
/**
|
|
@@ -502,6 +740,55 @@ export interface operations {
|
|
|
502
740
|
};
|
|
503
741
|
};
|
|
504
742
|
};
|
|
743
|
+
UsersController_updateMe: {
|
|
744
|
+
parameters: {
|
|
745
|
+
query?: never;
|
|
746
|
+
header?: never;
|
|
747
|
+
path?: never;
|
|
748
|
+
cookie?: never;
|
|
749
|
+
};
|
|
750
|
+
requestBody: {
|
|
751
|
+
content: {
|
|
752
|
+
"application/json": components["schemas"]["UpdateUserDto"];
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
responses: {
|
|
756
|
+
200: {
|
|
757
|
+
headers: {
|
|
758
|
+
[name: string]: unknown;
|
|
759
|
+
};
|
|
760
|
+
content: {
|
|
761
|
+
"application/json": components["schemas"]["UserDto"];
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
UsersController_findAll: {
|
|
767
|
+
parameters: {
|
|
768
|
+
query?: {
|
|
769
|
+
page?: number;
|
|
770
|
+
limit?: number;
|
|
771
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
772
|
+
organizationId?: string;
|
|
773
|
+
};
|
|
774
|
+
header?: never;
|
|
775
|
+
path?: never;
|
|
776
|
+
cookie?: never;
|
|
777
|
+
};
|
|
778
|
+
requestBody?: never;
|
|
779
|
+
responses: {
|
|
780
|
+
200: {
|
|
781
|
+
headers: {
|
|
782
|
+
[name: string]: unknown;
|
|
783
|
+
};
|
|
784
|
+
content: {
|
|
785
|
+
"application/json": {
|
|
786
|
+
data: components["schemas"]["UserDto"][];
|
|
787
|
+
} & components["schemas"]["PaginatedListDto"];
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
};
|
|
505
792
|
UsersController_create: {
|
|
506
793
|
parameters: {
|
|
507
794
|
query?: never;
|
|
@@ -515,7 +802,7 @@ export interface operations {
|
|
|
515
802
|
};
|
|
516
803
|
};
|
|
517
804
|
responses: {
|
|
518
|
-
|
|
805
|
+
201: {
|
|
519
806
|
headers: {
|
|
520
807
|
[name: string]: unknown;
|
|
521
808
|
};
|
|
@@ -546,7 +833,7 @@ export interface operations {
|
|
|
546
833
|
};
|
|
547
834
|
};
|
|
548
835
|
};
|
|
549
|
-
|
|
836
|
+
UsersController_delete: {
|
|
550
837
|
parameters: {
|
|
551
838
|
query?: never;
|
|
552
839
|
header?: never;
|
|
@@ -556,8 +843,52 @@ export interface operations {
|
|
|
556
843
|
cookie?: never;
|
|
557
844
|
};
|
|
558
845
|
requestBody?: never;
|
|
846
|
+
responses: {
|
|
847
|
+
204: {
|
|
848
|
+
headers: {
|
|
849
|
+
[name: string]: unknown;
|
|
850
|
+
};
|
|
851
|
+
content?: never;
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
};
|
|
855
|
+
UsersController_update: {
|
|
856
|
+
parameters: {
|
|
857
|
+
query?: never;
|
|
858
|
+
header?: never;
|
|
859
|
+
path: {
|
|
860
|
+
id: string;
|
|
861
|
+
};
|
|
862
|
+
cookie?: never;
|
|
863
|
+
};
|
|
864
|
+
requestBody: {
|
|
865
|
+
content: {
|
|
866
|
+
"application/json": components["schemas"]["UpdateUserDto"];
|
|
867
|
+
};
|
|
868
|
+
};
|
|
559
869
|
responses: {
|
|
560
870
|
200: {
|
|
871
|
+
headers: {
|
|
872
|
+
[name: string]: unknown;
|
|
873
|
+
};
|
|
874
|
+
content: {
|
|
875
|
+
"application/json": components["schemas"]["UserDto"];
|
|
876
|
+
};
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
};
|
|
880
|
+
UsersController_getPersonalAccessToken: {
|
|
881
|
+
parameters: {
|
|
882
|
+
query?: never;
|
|
883
|
+
header?: never;
|
|
884
|
+
path: {
|
|
885
|
+
id: string;
|
|
886
|
+
};
|
|
887
|
+
cookie?: never;
|
|
888
|
+
};
|
|
889
|
+
requestBody?: never;
|
|
890
|
+
responses: {
|
|
891
|
+
201: {
|
|
561
892
|
headers: {
|
|
562
893
|
[name: string]: unknown;
|
|
563
894
|
};
|
|
@@ -567,6 +898,56 @@ export interface operations {
|
|
|
567
898
|
};
|
|
568
899
|
};
|
|
569
900
|
};
|
|
901
|
+
UsersController_addGrant: {
|
|
902
|
+
parameters: {
|
|
903
|
+
query?: never;
|
|
904
|
+
header?: never;
|
|
905
|
+
path: {
|
|
906
|
+
id: string;
|
|
907
|
+
};
|
|
908
|
+
cookie?: never;
|
|
909
|
+
};
|
|
910
|
+
requestBody: {
|
|
911
|
+
content: {
|
|
912
|
+
"application/json": components["schemas"]["GrantInputDto"];
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
responses: {
|
|
916
|
+
201: {
|
|
917
|
+
headers: {
|
|
918
|
+
[name: string]: unknown;
|
|
919
|
+
};
|
|
920
|
+
content: {
|
|
921
|
+
"application/json": components["schemas"]["UserDto"];
|
|
922
|
+
};
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
};
|
|
926
|
+
UsersController_removeGrant: {
|
|
927
|
+
parameters: {
|
|
928
|
+
query?: never;
|
|
929
|
+
header?: never;
|
|
930
|
+
path: {
|
|
931
|
+
id: string;
|
|
932
|
+
};
|
|
933
|
+
cookie?: never;
|
|
934
|
+
};
|
|
935
|
+
requestBody: {
|
|
936
|
+
content: {
|
|
937
|
+
"application/json": components["schemas"]["GrantInputDto"];
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
responses: {
|
|
941
|
+
200: {
|
|
942
|
+
headers: {
|
|
943
|
+
[name: string]: unknown;
|
|
944
|
+
};
|
|
945
|
+
content: {
|
|
946
|
+
"application/json": components["schemas"]["UserDto"];
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
};
|
|
570
951
|
OrganizationsController_getOrganization: {
|
|
571
952
|
parameters: {
|
|
572
953
|
query?: never;
|
|
@@ -588,6 +969,31 @@ export interface operations {
|
|
|
588
969
|
};
|
|
589
970
|
};
|
|
590
971
|
};
|
|
972
|
+
OrganizationsController_update: {
|
|
973
|
+
parameters: {
|
|
974
|
+
query?: never;
|
|
975
|
+
header?: never;
|
|
976
|
+
path: {
|
|
977
|
+
id: string;
|
|
978
|
+
};
|
|
979
|
+
cookie?: never;
|
|
980
|
+
};
|
|
981
|
+
requestBody: {
|
|
982
|
+
content: {
|
|
983
|
+
"application/json": components["schemas"]["UpdateOrganizationDto"];
|
|
984
|
+
};
|
|
985
|
+
};
|
|
986
|
+
responses: {
|
|
987
|
+
200: {
|
|
988
|
+
headers: {
|
|
989
|
+
[name: string]: unknown;
|
|
990
|
+
};
|
|
991
|
+
content: {
|
|
992
|
+
"application/json": components["schemas"]["OrganizationDto"];
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
};
|
|
591
997
|
OrganizationsController_create: {
|
|
592
998
|
parameters: {
|
|
593
999
|
query?: never;
|
|
@@ -634,6 +1040,32 @@ export interface operations {
|
|
|
634
1040
|
};
|
|
635
1041
|
};
|
|
636
1042
|
};
|
|
1043
|
+
SignUpsController_findAll: {
|
|
1044
|
+
parameters: {
|
|
1045
|
+
query?: {
|
|
1046
|
+
page?: number;
|
|
1047
|
+
limit?: number;
|
|
1048
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
1049
|
+
organizationId?: string;
|
|
1050
|
+
};
|
|
1051
|
+
header?: never;
|
|
1052
|
+
path?: never;
|
|
1053
|
+
cookie?: never;
|
|
1054
|
+
};
|
|
1055
|
+
requestBody?: never;
|
|
1056
|
+
responses: {
|
|
1057
|
+
200: {
|
|
1058
|
+
headers: {
|
|
1059
|
+
[name: string]: unknown;
|
|
1060
|
+
};
|
|
1061
|
+
content: {
|
|
1062
|
+
"application/json": {
|
|
1063
|
+
data: components["schemas"]["SignUpAdminDto"][];
|
|
1064
|
+
} & components["schemas"]["PaginatedListDto"];
|
|
1065
|
+
};
|
|
1066
|
+
};
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
637
1069
|
SignUpsController_create: {
|
|
638
1070
|
parameters: {
|
|
639
1071
|
query?: never;
|
|
@@ -728,4 +1160,49 @@ export interface operations {
|
|
|
728
1160
|
};
|
|
729
1161
|
};
|
|
730
1162
|
};
|
|
1163
|
+
SignUpsController_delete: {
|
|
1164
|
+
parameters: {
|
|
1165
|
+
query?: never;
|
|
1166
|
+
header?: never;
|
|
1167
|
+
path: {
|
|
1168
|
+
id: string;
|
|
1169
|
+
};
|
|
1170
|
+
cookie?: never;
|
|
1171
|
+
};
|
|
1172
|
+
requestBody?: never;
|
|
1173
|
+
responses: {
|
|
1174
|
+
/** @description Successfully removed */
|
|
1175
|
+
204: {
|
|
1176
|
+
headers: {
|
|
1177
|
+
[name: string]: unknown;
|
|
1178
|
+
};
|
|
1179
|
+
content?: never;
|
|
1180
|
+
};
|
|
1181
|
+
};
|
|
1182
|
+
};
|
|
1183
|
+
SearchUsersController_search: {
|
|
1184
|
+
parameters: {
|
|
1185
|
+
query?: never;
|
|
1186
|
+
header?: never;
|
|
1187
|
+
path?: never;
|
|
1188
|
+
cookie?: never;
|
|
1189
|
+
};
|
|
1190
|
+
requestBody: {
|
|
1191
|
+
content: {
|
|
1192
|
+
"application/json": components["schemas"]["SearchUsersInputDto"];
|
|
1193
|
+
};
|
|
1194
|
+
};
|
|
1195
|
+
responses: {
|
|
1196
|
+
201: {
|
|
1197
|
+
headers: {
|
|
1198
|
+
[name: string]: unknown;
|
|
1199
|
+
};
|
|
1200
|
+
content: {
|
|
1201
|
+
"application/json": {
|
|
1202
|
+
data: components["schemas"]["SearchUserDto"][];
|
|
1203
|
+
} & components["schemas"]["PaginatedListDto"];
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
};
|
|
1207
|
+
};
|
|
731
1208
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { BaseSdkClient, RequestOptions } from "@palmetto/base-sdk-client";
|
|
1
|
+
import { BaseSdkClient, CreateSdkClientInput, RequestOptions } from "@palmetto/base-sdk-client";
|
|
2
2
|
import { paths } from "./__generated__/schema";
|
|
3
|
+
export type UpdateMeInput = paths["/api/users/me"]["patch"]["requestBody"]["content"]["application/json"];
|
|
4
|
+
export type UpdateMeResponse = paths["/api/users/me"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
5
|
+
export type GetUsersInput = NonNullable<paths["/api/users"]["get"]["parameters"]["query"]>;
|
|
6
|
+
export type GetUsersResponse = paths["/api/users"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
7
|
+
export type GetOrganizationInput = paths["/api/organizations/{id}"]["get"]["parameters"]["path"];
|
|
8
|
+
export type GetOrganizationResponse = paths["/api/organizations/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
9
|
+
export type UpdateOrganizationInput = paths["/api/organizations/{id}"]["patch"]["parameters"]["path"] & paths["/api/organizations/{id}"]["patch"]["requestBody"]["content"]["application/json"];
|
|
10
|
+
export type UpdateOrganizationResponse = paths["/api/organizations/{id}"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
11
|
+
export type CreateSignUpInput = paths["/api/sign-ups"]["post"]["requestBody"]["content"]["application/json"];
|
|
12
|
+
export type CreateSignUpResponse = paths["/api/sign-ups"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
3
13
|
export type GetSignUpInput = paths["/api/sign-ups/{token}"]["get"]["parameters"]["path"];
|
|
4
14
|
export type GetSignUpResponse = paths["/api/sign-ups/{token}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
5
15
|
export type CreateSignUpUserInput = paths["/api/sign-ups/{token}/user"]["post"]["parameters"]["path"] & paths["/api/sign-ups/{token}/user"]["post"]["requestBody"]["content"]["application/json"];
|
|
@@ -10,6 +20,7 @@ export interface RefreshTokenInput {
|
|
|
10
20
|
refreshToken: string;
|
|
11
21
|
}
|
|
12
22
|
export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
23
|
+
constructor(input: CreateSdkClientInput);
|
|
13
24
|
me(opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
14
25
|
id: string;
|
|
15
26
|
meta: {
|
|
@@ -31,15 +42,99 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
31
42
|
}> | import("@palmetto/result").ResultErr<{
|
|
32
43
|
code: "UNKNOWN_ERROR";
|
|
33
44
|
}>>;
|
|
45
|
+
updateMe(input: UpdateMeInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
46
|
+
id: string;
|
|
47
|
+
meta: {
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt?: string;
|
|
50
|
+
};
|
|
51
|
+
auth0Id: null;
|
|
52
|
+
email: string;
|
|
53
|
+
firstName: string;
|
|
54
|
+
lastName: string;
|
|
55
|
+
permissions: {
|
|
56
|
+
[key: string]: string[];
|
|
57
|
+
};
|
|
58
|
+
phoneNumber: string;
|
|
59
|
+
organizationId: string;
|
|
60
|
+
hasPAT: boolean;
|
|
61
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
62
|
+
code: "UNKNOWN_ERROR";
|
|
63
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
64
|
+
code: "BAD_REQUEST";
|
|
65
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
66
|
+
code: "NOT_FOUND";
|
|
67
|
+
}>>;
|
|
68
|
+
getUsers(input: GetUsersInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultErr<{
|
|
69
|
+
code: "UNKNOWN_ERROR";
|
|
70
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
71
|
+
code: "BAD_REQUEST";
|
|
72
|
+
}> | import("@palmetto/result").ResultOk<{
|
|
73
|
+
data: import("./__generated__/schema").components["schemas"]["UserDto"][];
|
|
74
|
+
} & {
|
|
75
|
+
data: unknown[];
|
|
76
|
+
paging: {
|
|
77
|
+
limit: number;
|
|
78
|
+
page: number;
|
|
79
|
+
pageStart: number;
|
|
80
|
+
pageEnd: number;
|
|
81
|
+
totalRecords: number;
|
|
82
|
+
totalPages: number;
|
|
83
|
+
};
|
|
84
|
+
}>>;
|
|
85
|
+
getOrganizationById({ id }: GetOrganizationInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultErr<{
|
|
86
|
+
code: "UNKNOWN_ERROR";
|
|
87
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
88
|
+
code: "BAD_REQUEST";
|
|
89
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
90
|
+
code: "NOT_FOUND";
|
|
91
|
+
}> | import("@palmetto/result").ResultOk<{
|
|
92
|
+
id: string;
|
|
93
|
+
meta: {
|
|
94
|
+
createdAt: string;
|
|
95
|
+
updatedAt?: string;
|
|
96
|
+
};
|
|
97
|
+
name: string;
|
|
98
|
+
permissions: {
|
|
99
|
+
[key: string]: string[];
|
|
100
|
+
};
|
|
101
|
+
}>>;
|
|
102
|
+
updateOrganization({ id, ...input }: UpdateOrganizationInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultErr<{
|
|
103
|
+
code: "UNKNOWN_ERROR";
|
|
104
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
105
|
+
code: "BAD_REQUEST";
|
|
106
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
107
|
+
code: "NOT_FOUND";
|
|
108
|
+
}> | import("@palmetto/result").ResultOk<{
|
|
109
|
+
id: string;
|
|
110
|
+
meta: {
|
|
111
|
+
createdAt: string;
|
|
112
|
+
updatedAt?: string;
|
|
113
|
+
};
|
|
114
|
+
name: string;
|
|
115
|
+
permissions: {
|
|
116
|
+
[key: string]: string[];
|
|
117
|
+
};
|
|
118
|
+
}>>;
|
|
119
|
+
createSignUp(input: CreateSignUpInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultErr<{
|
|
120
|
+
code: "UNKNOWN_ERROR";
|
|
121
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
122
|
+
code: "BAD_REQUEST";
|
|
123
|
+
}> | import("@palmetto/result").ResultOk<{
|
|
124
|
+
token: string;
|
|
125
|
+
}>>;
|
|
34
126
|
getSignUp({ token }: GetSignUpInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultErr<{
|
|
35
127
|
code: "UNKNOWN_ERROR";
|
|
128
|
+
}> | import("@palmetto/result").ResultErr<{
|
|
129
|
+
code: "NOT_FOUND";
|
|
36
130
|
}> | import("@palmetto/result").ResultOk<{
|
|
37
131
|
redirectUrl: string;
|
|
38
132
|
auth0Id?: string;
|
|
39
133
|
userId?: string;
|
|
40
134
|
organizationId?: string;
|
|
41
|
-
|
|
42
|
-
|
|
135
|
+
firstName?: string;
|
|
136
|
+
lastName?: string;
|
|
137
|
+
email?: string;
|
|
43
138
|
}>>;
|
|
44
139
|
createSignUpUser({ token, ...body }: CreateSignUpUserInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultErr<{
|
|
45
140
|
code: "NOT_AUTHENTICATED";
|
|
@@ -50,6 +145,9 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
50
145
|
auth0Id?: string;
|
|
51
146
|
userId?: string;
|
|
52
147
|
organizationId?: string;
|
|
148
|
+
firstName?: string;
|
|
149
|
+
lastName?: string;
|
|
150
|
+
email?: string;
|
|
53
151
|
}> | import("@palmetto/result").ResultErr<{
|
|
54
152
|
code: "INVALID_STATE";
|
|
55
153
|
}>>;
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -18,23 +19,124 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
19
|
}
|
|
19
20
|
return t;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.UsersApiClient = void 0;
|
|
24
|
+
const base_sdk_client_1 = require("@palmetto/base-sdk-client");
|
|
25
|
+
const result_1 = require("@palmetto/result");
|
|
26
|
+
const SDK_VERSION_SLUG = "palmetto-users-sdk/0.2.0";
|
|
27
|
+
class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
28
|
+
constructor(input) {
|
|
29
|
+
super(Object.assign(Object.assign({}, input), { sdkVersion: SDK_VERSION_SLUG }));
|
|
30
|
+
}
|
|
24
31
|
me(opts) {
|
|
25
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
33
|
const { data, response } = yield this.client.GET("/api/users/me", {
|
|
27
34
|
headers: this.generateHeaders(opts),
|
|
28
35
|
});
|
|
29
36
|
if (data) {
|
|
30
|
-
return Ok(data);
|
|
37
|
+
return (0, result_1.Ok)(data);
|
|
31
38
|
}
|
|
32
39
|
switch (response.status) {
|
|
33
40
|
case 401:
|
|
34
41
|
case 404:
|
|
35
|
-
return Err("NOT_AUTHENTICATED");
|
|
42
|
+
return (0, result_1.Err)("NOT_AUTHENTICATED");
|
|
43
|
+
default:
|
|
44
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
updateMe(input, opts) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const { data, response } = yield this.client.PATCH("/api/users/me", {
|
|
51
|
+
body: input,
|
|
52
|
+
headers: this.generateHeaders(opts),
|
|
53
|
+
});
|
|
54
|
+
if (data) {
|
|
55
|
+
return (0, result_1.Ok)(data);
|
|
56
|
+
}
|
|
57
|
+
switch (response.status) {
|
|
58
|
+
case 400:
|
|
59
|
+
return (0, result_1.Err)("BAD_REQUEST");
|
|
60
|
+
case 404:
|
|
61
|
+
return (0, result_1.Err)("NOT_FOUND");
|
|
62
|
+
default:
|
|
63
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
getUsers(input, opts) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const { data, response } = yield this.client.GET("/api/users", {
|
|
70
|
+
params: { query: input },
|
|
71
|
+
headers: this.generateHeaders(opts),
|
|
72
|
+
});
|
|
73
|
+
if (data) {
|
|
74
|
+
return (0, result_1.Ok)(data);
|
|
75
|
+
}
|
|
76
|
+
switch (response.status) {
|
|
77
|
+
case 400:
|
|
78
|
+
return (0, result_1.Err)("BAD_REQUEST");
|
|
79
|
+
default:
|
|
80
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getOrganizationById(_a, opts_1) {
|
|
85
|
+
return __awaiter(this, arguments, void 0, function* ({ id }, opts) {
|
|
86
|
+
const { data, response } = yield this.client.GET("/api/organizations/{id}", {
|
|
87
|
+
params: { path: { id } },
|
|
88
|
+
headers: this.generateHeaders(opts),
|
|
89
|
+
});
|
|
90
|
+
if (data) {
|
|
91
|
+
return (0, result_1.Ok)(data);
|
|
92
|
+
}
|
|
93
|
+
switch (response.status) {
|
|
94
|
+
case 400:
|
|
95
|
+
return (0, result_1.Err)("BAD_REQUEST");
|
|
96
|
+
case 404:
|
|
97
|
+
return (0, result_1.Err)("NOT_FOUND");
|
|
98
|
+
default:
|
|
99
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
updateOrganization(_a, opts) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
var { id } = _a, input = __rest(_a, ["id"]);
|
|
106
|
+
const { data, response } = yield this.client.PATCH("/api/organizations/{id}", {
|
|
107
|
+
params: {
|
|
108
|
+
path: { id },
|
|
109
|
+
},
|
|
110
|
+
body: input,
|
|
111
|
+
headers: this.generateHeaders(opts),
|
|
112
|
+
});
|
|
113
|
+
if (data) {
|
|
114
|
+
return (0, result_1.Ok)(data);
|
|
115
|
+
}
|
|
116
|
+
switch (response.status) {
|
|
117
|
+
case 400:
|
|
118
|
+
return (0, result_1.Err)("BAD_REQUEST");
|
|
119
|
+
case 404:
|
|
120
|
+
return (0, result_1.Err)("NOT_FOUND");
|
|
121
|
+
default:
|
|
122
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
createSignUp(input, opts) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const { data, response } = yield this.client.POST("/api/sign-ups", {
|
|
129
|
+
body: input,
|
|
130
|
+
headers: this.generateHeaders(opts),
|
|
131
|
+
});
|
|
132
|
+
if (data) {
|
|
133
|
+
return (0, result_1.Ok)(data);
|
|
134
|
+
}
|
|
135
|
+
switch (response.status) {
|
|
136
|
+
case 400:
|
|
137
|
+
return (0, result_1.Err)("BAD_REQUEST");
|
|
36
138
|
default:
|
|
37
|
-
return Err("UNKNOWN_ERROR");
|
|
139
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
38
140
|
}
|
|
39
141
|
});
|
|
40
142
|
}
|
|
@@ -45,13 +147,13 @@ export class UsersApiClient extends BaseSdkClient {
|
|
|
45
147
|
headers: this.generateHeaders(opts),
|
|
46
148
|
});
|
|
47
149
|
if (data) {
|
|
48
|
-
return Ok(data);
|
|
150
|
+
return (0, result_1.Ok)(data);
|
|
49
151
|
}
|
|
50
152
|
switch (response.status) {
|
|
51
153
|
case 404:
|
|
52
|
-
return Err("NOT_FOUND");
|
|
154
|
+
return (0, result_1.Err)("NOT_FOUND");
|
|
53
155
|
default:
|
|
54
|
-
return Err("UNKNOWN_ERROR");
|
|
156
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
55
157
|
}
|
|
56
158
|
});
|
|
57
159
|
}
|
|
@@ -64,15 +166,15 @@ export class UsersApiClient extends BaseSdkClient {
|
|
|
64
166
|
body,
|
|
65
167
|
});
|
|
66
168
|
if (data) {
|
|
67
|
-
return Ok(data);
|
|
169
|
+
return (0, result_1.Ok)(data);
|
|
68
170
|
}
|
|
69
171
|
switch (response.status) {
|
|
70
172
|
case 401:
|
|
71
|
-
return Err("NOT_AUTHENTICATED");
|
|
173
|
+
return (0, result_1.Err)("NOT_AUTHENTICATED");
|
|
72
174
|
case 409:
|
|
73
|
-
return Err("INVALID_STATE");
|
|
175
|
+
return (0, result_1.Err)("INVALID_STATE");
|
|
74
176
|
default:
|
|
75
|
-
return Err("UNKNOWN_ERROR");
|
|
177
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
76
178
|
}
|
|
77
179
|
});
|
|
78
180
|
}
|
|
@@ -96,7 +198,7 @@ export class UsersApiClient extends BaseSdkClient {
|
|
|
96
198
|
body: input,
|
|
97
199
|
});
|
|
98
200
|
if (data) {
|
|
99
|
-
return Ok({
|
|
201
|
+
return (0, result_1.Ok)({
|
|
100
202
|
accessToken: data.access_token,
|
|
101
203
|
idToken: data.id_token,
|
|
102
204
|
refreshToken: data.refresh_token,
|
|
@@ -105,8 +207,9 @@ export class UsersApiClient extends BaseSdkClient {
|
|
|
105
207
|
}
|
|
106
208
|
switch (response.status) {
|
|
107
209
|
default:
|
|
108
|
-
return Err("UNKNOWN_ERROR");
|
|
210
|
+
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
109
211
|
}
|
|
110
212
|
});
|
|
111
213
|
}
|
|
112
214
|
}
|
|
215
|
+
exports.UsersApiClient = UsersApiClient;
|
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@palmetto/users-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "./dist/main.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"lint": "eslint . --fix --cache",
|
|
14
14
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
15
15
|
"tc": "tsc --noEmit",
|
|
16
|
+
"start:dev": "tsc --watch",
|
|
16
17
|
"build": "tsc",
|
|
17
18
|
"generate": "node ./scripts/generateApiSchema.mjs",
|
|
18
19
|
"prepublishOnly": "yarn build",
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
"typescript": "5.5.4"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@palmetto/base-sdk-client": "
|
|
37
|
-
"@palmetto/result": "
|
|
37
|
+
"@palmetto/base-sdk-client": "1.1.0",
|
|
38
|
+
"@palmetto/result": "1.2.0",
|
|
38
39
|
"openapi-fetch": "^0.12.2"
|
|
39
40
|
},
|
|
40
41
|
"publishConfig": {
|
package/dist/base-client.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/base-client.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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/result.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface ResultOk<TData = unknown> {
|
|
2
|
-
ok: true;
|
|
3
|
-
data: TData;
|
|
4
|
-
}
|
|
5
|
-
export interface ResultErr<TError = unknown> {
|
|
6
|
-
ok: false;
|
|
7
|
-
error: TError;
|
|
8
|
-
}
|
|
9
|
-
export type Result<TData = unknown, TError = unknown> = ResultOk<TData> | ResultErr<TError>;
|
|
10
|
-
export type InferResultData<TResult extends Result> = TResult extends ResultOk<infer TData> ? TData : never;
|
|
11
|
-
export type InferResultError<TResult extends Result> = TResult extends ResultErr<infer TError> ? TError : never;
|
|
12
|
-
export declare function Err<TCode extends string>(code: TCode): ResultErr<{
|
|
13
|
-
code: TCode;
|
|
14
|
-
}>;
|
|
15
|
-
export declare function Err<TCode extends string, TExtra extends Record<string, unknown>>(code: TCode, extra: TExtra): ResultErr<TExtra & {
|
|
16
|
-
code: TCode;
|
|
17
|
-
}>;
|
|
18
|
-
export declare function Ok<TData = unknown>(data: TData): ResultOk<TData>;
|
|
19
|
-
export declare function assertOk(result: Result): asserts result is ResultOk;
|
package/dist/result.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function Err(code, extra) {
|
|
2
|
-
return { ok: false, error: Object.assign(Object.assign({}, extra), { code }) };
|
|
3
|
-
}
|
|
4
|
-
export function Ok(data) {
|
|
5
|
-
return { ok: true, data };
|
|
6
|
-
}
|
|
7
|
-
export function assertOk(result) {
|
|
8
|
-
if (!result.ok) {
|
|
9
|
-
throw new Error("Result was an error!");
|
|
10
|
-
}
|
|
11
|
-
}
|