@36node/auth-sdk 1.0.0-pr-3-7e961969aa

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # auth-sdk-ts
2
+
3
+ Typescript auth sdk for 36node/auth service.
package/dist/main.js ADDED
@@ -0,0 +1,612 @@
1
+
2
+ function $parcel$exportWildcard(dest, source) {
3
+ Object.keys(source).forEach(function(key) {
4
+ if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
5
+ return;
6
+ }
7
+
8
+ Object.defineProperty(dest, key, {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return source[key];
12
+ }
13
+ });
14
+ });
15
+
16
+ return dest;
17
+ }
18
+
19
+ function $parcel$export(e, n, v, s) {
20
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
21
+ }
22
+ // Generated by openapi-ts-gen. DO NOT EDIT
23
+ /* eslint-disable */ var $c47aa81bb7e816d4$exports = {};
24
+
25
+ $parcel$export($c47aa81bb7e816d4$exports, "CoreAPIClient", () => $c47aa81bb7e816d4$export$353cb576ea2f33a4);
26
+ // Generated by openapi-ts-gen. DO NOT EDIT
27
+ /* eslint-disable */ class $c47aa81bb7e816d4$export$353cb576ea2f33a4 {
28
+ constructor(client){
29
+ this.hello = (req, config = {})=>{
30
+ return this.client.request({
31
+ ...config,
32
+ url: `/hello`,
33
+ method: "get"
34
+ });
35
+ };
36
+ this.login = (req, config = {})=>{
37
+ return this.client.request({
38
+ ...config,
39
+ url: `/auth/@login`,
40
+ method: "post",
41
+ data: req.body
42
+ });
43
+ };
44
+ this.loginByEmail = (req, config = {})=>{
45
+ return this.client.request({
46
+ ...config,
47
+ url: `/auth/@loginByEmail`,
48
+ method: "post",
49
+ data: req.body
50
+ });
51
+ };
52
+ this.loginByPhone = (req, config = {})=>{
53
+ return this.client.request({
54
+ ...config,
55
+ url: `/auth/@loginByPhone`,
56
+ method: "post",
57
+ data: req.body
58
+ });
59
+ };
60
+ this.register = (req, config = {})=>{
61
+ return this.client.request({
62
+ ...config,
63
+ url: `/auth/@register`,
64
+ method: "post",
65
+ data: req.body
66
+ });
67
+ };
68
+ this.registerByPhone = (req, config = {})=>{
69
+ return this.client.request({
70
+ ...config,
71
+ url: `/auth/@registerByPhone`,
72
+ method: "post",
73
+ data: req.body
74
+ });
75
+ };
76
+ this.registerByEmail = (req, config = {})=>{
77
+ return this.client.request({
78
+ ...config,
79
+ url: `/auth/@registerByEmail`,
80
+ method: "post",
81
+ data: req.body
82
+ });
83
+ };
84
+ this.signToken = (req, config = {})=>{
85
+ return this.client.request({
86
+ ...config,
87
+ url: `/auth/@signToken`,
88
+ method: "post",
89
+ data: req.body
90
+ });
91
+ };
92
+ this.refresh = (req, config = {})=>{
93
+ return this.client.request({
94
+ ...config,
95
+ url: `/auth/@refresh`,
96
+ method: "post",
97
+ data: req.body
98
+ });
99
+ };
100
+ this.createUser = (req, config = {})=>{
101
+ return this.client.request({
102
+ ...config,
103
+ url: `/users`,
104
+ method: "post",
105
+ data: req.body
106
+ });
107
+ };
108
+ this.listUsers = (req, config = {})=>{
109
+ return this.client.request({
110
+ ...config,
111
+ url: `/users`,
112
+ method: "get",
113
+ params: $c47aa81bb7e816d4$var$pick(req, [
114
+ "ns",
115
+ "ns_start",
116
+ "_sort",
117
+ "id",
118
+ "name_like",
119
+ "username_like",
120
+ "nickname_like",
121
+ "username",
122
+ "email",
123
+ "phone",
124
+ "registerRegion",
125
+ "roles",
126
+ "_limit",
127
+ "_offset"
128
+ ])
129
+ });
130
+ };
131
+ this.getUser = (req, config = {})=>{
132
+ $c47aa81bb7e816d4$var$checkPathParams("getUser", req, [
133
+ "userId"
134
+ ]);
135
+ return this.client.request({
136
+ ...config,
137
+ url: `/users/${req.userId}`,
138
+ method: "get"
139
+ });
140
+ };
141
+ this.updateUser = (req, config = {})=>{
142
+ $c47aa81bb7e816d4$var$checkPathParams("updateUser", req, [
143
+ "userId"
144
+ ]);
145
+ return this.client.request({
146
+ ...config,
147
+ url: `/users/${req.userId}`,
148
+ method: "patch",
149
+ data: req.body
150
+ });
151
+ };
152
+ this.deleteUser = (req, config = {})=>{
153
+ $c47aa81bb7e816d4$var$checkPathParams("deleteUser", req, [
154
+ "userId"
155
+ ]);
156
+ return this.client.request({
157
+ ...config,
158
+ url: `/users/${req.userId}`,
159
+ method: "delete"
160
+ });
161
+ };
162
+ this.verifyIdentity = (req, config = {})=>{
163
+ $c47aa81bb7e816d4$var$checkPathParams("verifyIdentity", req, [
164
+ "userId"
165
+ ]);
166
+ return this.client.request({
167
+ ...config,
168
+ url: `/users/${req.userId}/@verifyIdentity`,
169
+ method: "post"
170
+ });
171
+ };
172
+ this.resetPassword = (req, config = {})=>{
173
+ $c47aa81bb7e816d4$var$checkPathParams("resetPassword", req, [
174
+ "userId"
175
+ ]);
176
+ return this.client.request({
177
+ ...config,
178
+ url: `/users/${req.userId}/@resetPassword`,
179
+ method: "post",
180
+ data: req.body
181
+ });
182
+ };
183
+ this.updatePassword = (req, config = {})=>{
184
+ $c47aa81bb7e816d4$var$checkPathParams("updatePassword", req, [
185
+ "userId"
186
+ ]);
187
+ return this.client.request({
188
+ ...config,
189
+ url: `/users/${req.userId}/@updatePassword`,
190
+ method: "post",
191
+ data: req.body
192
+ });
193
+ };
194
+ this.createNamespace = (req, config = {})=>{
195
+ return this.client.request({
196
+ ...config,
197
+ url: `/namespaces`,
198
+ method: "post",
199
+ data: req.body
200
+ });
201
+ };
202
+ this.listNamespaces = (req, config = {})=>{
203
+ return this.client.request({
204
+ ...config,
205
+ url: `/namespaces`,
206
+ method: "get",
207
+ params: $c47aa81bb7e816d4$var$pick(req, [
208
+ "ns",
209
+ "ns_start",
210
+ "_sort",
211
+ "name_like",
212
+ "labels",
213
+ "key",
214
+ "_limit",
215
+ "_offset"
216
+ ])
217
+ });
218
+ };
219
+ this.getNamespace = (req, config = {})=>{
220
+ $c47aa81bb7e816d4$var$checkPathParams("getNamespace", req, [
221
+ "namespaceIdOrKey"
222
+ ]);
223
+ return this.client.request({
224
+ ...config,
225
+ url: `/namespaces/${req.namespaceIdOrKey}`,
226
+ method: "get"
227
+ });
228
+ };
229
+ this.updateNamespace = (req, config = {})=>{
230
+ $c47aa81bb7e816d4$var$checkPathParams("updateNamespace", req, [
231
+ "namespaceId"
232
+ ]);
233
+ return this.client.request({
234
+ ...config,
235
+ url: `/namespaces/${req.namespaceId}`,
236
+ method: "patch",
237
+ data: req.body
238
+ });
239
+ };
240
+ this.deleteNamespace = (req, config = {})=>{
241
+ $c47aa81bb7e816d4$var$checkPathParams("deleteNamespace", req, [
242
+ "namespaceId"
243
+ ]);
244
+ return this.client.request({
245
+ ...config,
246
+ url: `/namespaces/${req.namespaceId}`,
247
+ method: "delete"
248
+ });
249
+ };
250
+ this.createSession = (req, config = {})=>{
251
+ return this.client.request({
252
+ ...config,
253
+ url: `/sessions`,
254
+ method: "post",
255
+ data: req.body
256
+ });
257
+ };
258
+ this.listSessions = (req, config = {})=>{
259
+ return this.client.request({
260
+ ...config,
261
+ url: `/sessions`,
262
+ method: "get",
263
+ params: $c47aa81bb7e816d4$var$pick(req, [
264
+ "_sort",
265
+ "key",
266
+ "client",
267
+ "uid",
268
+ "_limit",
269
+ "_offset"
270
+ ])
271
+ });
272
+ };
273
+ this.getSession = (req, config = {})=>{
274
+ $c47aa81bb7e816d4$var$checkPathParams("getSession", req, [
275
+ "sessionId"
276
+ ]);
277
+ return this.client.request({
278
+ ...config,
279
+ url: `/sessions/${req.sessionId}`,
280
+ method: "get"
281
+ });
282
+ };
283
+ this.updateSession = (req, config = {})=>{
284
+ $c47aa81bb7e816d4$var$checkPathParams("updateSession", req, [
285
+ "sessionId"
286
+ ]);
287
+ return this.client.request({
288
+ ...config,
289
+ url: `/sessions/${req.sessionId}`,
290
+ method: "patch",
291
+ data: req.body
292
+ });
293
+ };
294
+ this.deleteSession = (req, config = {})=>{
295
+ $c47aa81bb7e816d4$var$checkPathParams("deleteSession", req, [
296
+ "sessionId"
297
+ ]);
298
+ return this.client.request({
299
+ ...config,
300
+ url: `/sessions/${req.sessionId}`,
301
+ method: "delete"
302
+ });
303
+ };
304
+ this.createCaptcha = (req, config = {})=>{
305
+ return this.client.request({
306
+ ...config,
307
+ url: `/captchas`,
308
+ method: "post",
309
+ data: req.body
310
+ });
311
+ };
312
+ this.listCaptchas = (req, config = {})=>{
313
+ return this.client.request({
314
+ ...config,
315
+ url: `/captchas`,
316
+ method: "get",
317
+ params: $c47aa81bb7e816d4$var$pick(req, [
318
+ "_sort",
319
+ "code",
320
+ "key",
321
+ "_limit",
322
+ "_offset"
323
+ ])
324
+ });
325
+ };
326
+ this.getCaptcha = (req, config = {})=>{
327
+ $c47aa81bb7e816d4$var$checkPathParams("getCaptcha", req, [
328
+ "captchaId"
329
+ ]);
330
+ return this.client.request({
331
+ ...config,
332
+ url: `/captchas/${req.captchaId}`,
333
+ method: "get"
334
+ });
335
+ };
336
+ this.updateCaptcha = (req, config = {})=>{
337
+ $c47aa81bb7e816d4$var$checkPathParams("updateCaptcha", req, [
338
+ "captchaId"
339
+ ]);
340
+ return this.client.request({
341
+ ...config,
342
+ url: `/captchas/${req.captchaId}`,
343
+ method: "patch",
344
+ data: req.body
345
+ });
346
+ };
347
+ this.deleteCaptcha = (req, config = {})=>{
348
+ $c47aa81bb7e816d4$var$checkPathParams("deleteCaptcha", req, [
349
+ "captchaId"
350
+ ]);
351
+ return this.client.request({
352
+ ...config,
353
+ url: `/captchas/${req.captchaId}`,
354
+ method: "delete"
355
+ });
356
+ };
357
+ this.sendEmail = (req, config = {})=>{
358
+ return this.client.request({
359
+ ...config,
360
+ url: `/email/@sendEmail`,
361
+ method: "post",
362
+ data: req.body
363
+ });
364
+ };
365
+ this.createEmailRecord = (req, config = {})=>{
366
+ return this.client.request({
367
+ ...config,
368
+ url: `/email/records`,
369
+ method: "post",
370
+ data: req.body
371
+ });
372
+ };
373
+ this.listEmailRecords = (req, config = {})=>{
374
+ return this.client.request({
375
+ ...config,
376
+ url: `/email/records`,
377
+ method: "get",
378
+ params: $c47aa81bb7e816d4$var$pick(req, [
379
+ "status",
380
+ "_sort",
381
+ "createdAt_gt",
382
+ "createdAt_lt",
383
+ "sentAt_gt",
384
+ "sentAt_lt",
385
+ "from",
386
+ "to",
387
+ "_limit",
388
+ "_offset"
389
+ ])
390
+ });
391
+ };
392
+ this.getEmailRecord = (req, config = {})=>{
393
+ $c47aa81bb7e816d4$var$checkPathParams("getEmailRecord", req, [
394
+ "emailRecordId"
395
+ ]);
396
+ return this.client.request({
397
+ ...config,
398
+ url: `/email/records/${req.emailRecordId}`,
399
+ method: "get"
400
+ });
401
+ };
402
+ this.updateEmailRecord = (req, config = {})=>{
403
+ $c47aa81bb7e816d4$var$checkPathParams("updateEmailRecord", req, [
404
+ "emailRecordId"
405
+ ]);
406
+ return this.client.request({
407
+ ...config,
408
+ url: `/email/records/${req.emailRecordId}`,
409
+ method: "patch",
410
+ data: req.body
411
+ });
412
+ };
413
+ this.deleteEmailRecord = (req, config = {})=>{
414
+ $c47aa81bb7e816d4$var$checkPathParams("deleteEmailRecord", req, [
415
+ "emailRecordId"
416
+ ]);
417
+ return this.client.request({
418
+ ...config,
419
+ url: `/email/records/${req.emailRecordId}`,
420
+ method: "delete"
421
+ });
422
+ };
423
+ this.listRegions = (req, config = {})=>{
424
+ return this.client.request({
425
+ ...config,
426
+ url: `/region`,
427
+ method: "get"
428
+ });
429
+ };
430
+ this.sendSms = (req, config = {})=>{
431
+ return this.client.request({
432
+ ...config,
433
+ url: `/sms/@sendSms`,
434
+ method: "post",
435
+ data: req.body
436
+ });
437
+ };
438
+ this.createSmsRecord = (req, config = {})=>{
439
+ return this.client.request({
440
+ ...config,
441
+ url: `/sms/records`,
442
+ method: "post",
443
+ data: req.body
444
+ });
445
+ };
446
+ this.listSmsRecords = (req, config = {})=>{
447
+ return this.client.request({
448
+ ...config,
449
+ url: `/sms/records`,
450
+ method: "get",
451
+ params: $c47aa81bb7e816d4$var$pick(req, [
452
+ "status",
453
+ "_sort",
454
+ "createdAt_gt",
455
+ "createdAt_lt",
456
+ "sentAt_gt",
457
+ "sentAt_lt",
458
+ "phone",
459
+ "sign",
460
+ "_limit",
461
+ "_offset"
462
+ ])
463
+ });
464
+ };
465
+ this.getSmsRecord = (req, config = {})=>{
466
+ $c47aa81bb7e816d4$var$checkPathParams("getSmsRecord", req, [
467
+ "smsRecordId"
468
+ ]);
469
+ return this.client.request({
470
+ ...config,
471
+ url: `/sms/records/${req.smsRecordId}`,
472
+ method: "get"
473
+ });
474
+ };
475
+ this.updateSmsRecord = (req, config = {})=>{
476
+ $c47aa81bb7e816d4$var$checkPathParams("updateSmsRecord", req, [
477
+ "smsRecordId"
478
+ ]);
479
+ return this.client.request({
480
+ ...config,
481
+ url: `/sms/records/${req.smsRecordId}`,
482
+ method: "patch",
483
+ data: req.body
484
+ });
485
+ };
486
+ this.deleteSmsRecord = (req, config = {})=>{
487
+ $c47aa81bb7e816d4$var$checkPathParams("deleteSmsRecord", req, [
488
+ "smsRecordId"
489
+ ]);
490
+ return this.client.request({
491
+ ...config,
492
+ url: `/sms/records/${req.smsRecordId}`,
493
+ method: "delete"
494
+ });
495
+ };
496
+ if (!client.defaults.baseURL) throw new Error("client's baseURL MUST specified");
497
+ this.client = client;
498
+ }
499
+ }
500
+ function $c47aa81bb7e816d4$var$checkPathParams(op, req, ks) {
501
+ ks.forEach((p)=>{
502
+ if (!req[p]) throw new Error(`${p} is required for ${op}`);
503
+ });
504
+ }
505
+ function $c47aa81bb7e816d4$var$pick(o, ks) {
506
+ return ks.reduce((r, p)=>{
507
+ r[p] = o[p];
508
+ return r;
509
+ }, {});
510
+ }
511
+
512
+
513
+ var $63f14b9c71c969bd$exports = {};
514
+
515
+ $parcel$export($63f14b9c71c969bd$exports, "EmailStatus", () => $63f14b9c71c969bd$export$96fb7dfa641b77fb);
516
+ $parcel$export($63f14b9c71c969bd$exports, "SmsStatus", () => $63f14b9c71c969bd$export$fc906f0c09f48d75);
517
+ $parcel$export($63f14b9c71c969bd$exports, "ListUsersRequest", () => $63f14b9c71c969bd$export$5381d8f52f57bd1);
518
+ $parcel$export($63f14b9c71c969bd$exports, "ListNamespacesRequest", () => $63f14b9c71c969bd$export$e73f6f358f36a136);
519
+ $parcel$export($63f14b9c71c969bd$exports, "ListSessionsRequest", () => $63f14b9c71c969bd$export$3be39bb5c5d3e6d1);
520
+ $parcel$export($63f14b9c71c969bd$exports, "ListCaptchasRequest", () => $63f14b9c71c969bd$export$ecd3dbc11728e32f);
521
+ $parcel$export($63f14b9c71c969bd$exports, "ListEmailRecordsRequest", () => $63f14b9c71c969bd$export$72915f6295fc8ec7);
522
+ $parcel$export($63f14b9c71c969bd$exports, "ListSmsRecordsRequest", () => $63f14b9c71c969bd$export$c2c207c1201b978a);
523
+ // Generated by openapi-ts-gen. DO NOT EDIT
524
+ /* eslint-disable */ var $63f14b9c71c969bd$export$96fb7dfa641b77fb;
525
+ (function(EmailStatus) {
526
+ EmailStatus["PENDING"] = "pending";
527
+ EmailStatus["SENT"] = "sent";
528
+ })($63f14b9c71c969bd$export$96fb7dfa641b77fb || ($63f14b9c71c969bd$export$96fb7dfa641b77fb = {}));
529
+ var $63f14b9c71c969bd$export$fc906f0c09f48d75;
530
+ (function(SmsStatus) {
531
+ SmsStatus["PENDING"] = "pending";
532
+ SmsStatus["SENT"] = "sent";
533
+ })($63f14b9c71c969bd$export$fc906f0c09f48d75 || ($63f14b9c71c969bd$export$fc906f0c09f48d75 = {}));
534
+ var $63f14b9c71c969bd$export$5381d8f52f57bd1;
535
+ (function(ListUsersRequest) {
536
+ let Sort;
537
+ (function(Sort) {
538
+ Sort["CREATED_AT"] = "createdAt";
539
+ Sort["CREATED_AT_DESC"] = "-createdAt";
540
+ Sort["UPDATED_AT"] = "updatedAt";
541
+ Sort["UPDATED_AT_DESC"] = "-updatedAt";
542
+ })(Sort = ListUsersRequest.Sort || (ListUsersRequest.Sort = {}));
543
+ })($63f14b9c71c969bd$export$5381d8f52f57bd1 || ($63f14b9c71c969bd$export$5381d8f52f57bd1 = {}));
544
+ var $63f14b9c71c969bd$export$e73f6f358f36a136;
545
+ (function(ListNamespacesRequest) {
546
+ let Sort;
547
+ (function(Sort) {
548
+ Sort["CREATED_AT"] = "createdAt";
549
+ Sort["CREATED_AT_DESC"] = "-createdAt";
550
+ Sort["UPDATED_AT"] = "updatedAt";
551
+ Sort["UPDATED_AT_DESC"] = "-updatedAt";
552
+ Sort["KEY"] = "key";
553
+ Sort["KEY_DESC"] = "-key";
554
+ Sort["NAME"] = "name";
555
+ Sort["NAME_DESC"] = "-name";
556
+ })(Sort = ListNamespacesRequest.Sort || (ListNamespacesRequest.Sort = {}));
557
+ })($63f14b9c71c969bd$export$e73f6f358f36a136 || ($63f14b9c71c969bd$export$e73f6f358f36a136 = {}));
558
+ var $63f14b9c71c969bd$export$3be39bb5c5d3e6d1;
559
+ (function(ListSessionsRequest) {
560
+ let Sort;
561
+ (function(Sort) {
562
+ Sort["CREATED_AT"] = "createdAt";
563
+ Sort["CREATED_AT_DESC"] = "-createdAt";
564
+ Sort["UPDATED_AT"] = "updatedAt";
565
+ Sort["UPDATED_AT_DESC"] = "-updatedAt";
566
+ Sort["EXPIRE_AT"] = "expireAt";
567
+ Sort["EXPIRE_AT_DESC"] = "-expireAt";
568
+ })(Sort = ListSessionsRequest.Sort || (ListSessionsRequest.Sort = {}));
569
+ })($63f14b9c71c969bd$export$3be39bb5c5d3e6d1 || ($63f14b9c71c969bd$export$3be39bb5c5d3e6d1 = {}));
570
+ var $63f14b9c71c969bd$export$ecd3dbc11728e32f;
571
+ (function(ListCaptchasRequest) {
572
+ let Sort;
573
+ (function(Sort) {
574
+ Sort["CREATED_AT"] = "createdAt";
575
+ Sort["CREATED_AT_DESC"] = "-createdAt";
576
+ Sort["UPDATED_AT"] = "updatedAt";
577
+ Sort["UPDATED_AT_DESC"] = "-updatedAt";
578
+ Sort["EXPIRE_AT"] = "expireAt";
579
+ Sort["EXPIRE_AT_DESC"] = "-expireAt";
580
+ })(Sort = ListCaptchasRequest.Sort || (ListCaptchasRequest.Sort = {}));
581
+ })($63f14b9c71c969bd$export$ecd3dbc11728e32f || ($63f14b9c71c969bd$export$ecd3dbc11728e32f = {}));
582
+ var $63f14b9c71c969bd$export$72915f6295fc8ec7;
583
+ (function(ListEmailRecordsRequest) {
584
+ let Sort;
585
+ (function(Sort) {
586
+ Sort["CREATED_AT"] = "createdAt";
587
+ Sort["CREATED_AT_DESC"] = "-createdAt";
588
+ Sort["UPDATED_AT"] = "updatedAt";
589
+ Sort["UPDATED_AT_DESC"] = "-updatedAt";
590
+ Sort["SENT_AT"] = "sentAt";
591
+ Sort["SENT_AT_DESC"] = "-sentAt";
592
+ })(Sort = ListEmailRecordsRequest.Sort || (ListEmailRecordsRequest.Sort = {}));
593
+ })($63f14b9c71c969bd$export$72915f6295fc8ec7 || ($63f14b9c71c969bd$export$72915f6295fc8ec7 = {}));
594
+ var $63f14b9c71c969bd$export$c2c207c1201b978a;
595
+ (function(ListSmsRecordsRequest) {
596
+ let Sort;
597
+ (function(Sort) {
598
+ Sort["CREATED_AT"] = "createdAt";
599
+ Sort["CREATED_AT_DESC"] = "-createdAt";
600
+ Sort["UPDATED_AT"] = "updatedAt";
601
+ Sort["UPDATED_AT_DESC"] = "-updatedAt";
602
+ Sort["SENT_AT"] = "sentAt";
603
+ Sort["SENT_AT_DESC"] = "-sentAt";
604
+ })(Sort = ListSmsRecordsRequest.Sort || (ListSmsRecordsRequest.Sort = {}));
605
+ })($63f14b9c71c969bd$export$c2c207c1201b978a || ($63f14b9c71c969bd$export$c2c207c1201b978a = {}));
606
+
607
+
608
+ $parcel$exportWildcard(module.exports, $c47aa81bb7e816d4$exports);
609
+ $parcel$exportWildcard(module.exports, $63f14b9c71c969bd$exports);
610
+
611
+
612
+ //# sourceMappingURL=main.js.map