endpoints-sdk-cli 2.3.3 → 2.4.1

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.
@@ -0,0 +1,577 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.m2mUsers_v1 = exports.generateUserToken = exports.generateToken = exports.loginWithMFA = exports.publishMFACode = exports.getPublicKeys = exports.getJwks = exports.loginWithSlash = exports.login = exports.updateUserByAdmin = exports.findUsersByCompanyId = exports.updateAuthority = exports.findUserByEmail = exports.setAuthorityScope = exports.activateUser = exports.sendActivationEmail = exports.resetPassword = exports.sendResetPasswordEmail = exports.deactivateUser = exports.activateUserByAdmin = exports.updateUserPatch = exports.updateUser = exports.findUserById = exports.createUser = exports.findCompaniesByIds = exports.updateCompanyPatch = exports.updateCompany = exports.getCompany = exports.createCompany = exports.healthCheck = exports.root = void 0;
4
+ /* eslint-disable */
5
+ /**
6
+ * A function that returns the URL part common to the endpoints.
7
+ */
8
+ const root = () => {
9
+ let __root = "";
10
+ if (process.env.NODE_ENV === "local") {
11
+ __root = "http://localhost:8080";
12
+ }
13
+ if (process.env.NODE_ENV === "localDev") {
14
+ __root = "https://api-users.dev.m2msystems.cloud";
15
+ }
16
+ if (process.env.NODE_ENV === "development") {
17
+ __root = "https://api-users.dev.m2msystems.cloud";
18
+ }
19
+ if (process.env.NODE_ENV === "production") {
20
+ __root = "https://api.m2msystems.cloud";
21
+ }
22
+ return __root;
23
+ };
24
+ exports.root = root;
25
+ /**
26
+ * ヘルスチェック
27
+ *
28
+ */
29
+ const healthCheck = () => {
30
+ const __root = (0, exports.root)();
31
+ const __queries = Object.entries({})
32
+ .filter(([_, value]) => {
33
+ return value !== undefined;
34
+ })
35
+ .map(([key, value]) => {
36
+ return `${key}=${value}`;
37
+ })
38
+ .join("&");
39
+ const __path = `${__root}/${`health_check`}`;
40
+ return __queries ? `${__path}?${__queries}` : __path;
41
+ };
42
+ exports.healthCheck = healthCheck;
43
+ /**
44
+ * 会社を作成する
45
+ *
46
+ */
47
+ const createCompany = () => {
48
+ const __root = (0, exports.root)();
49
+ const __queries = Object.entries({})
50
+ .filter(([_, value]) => {
51
+ return value !== undefined;
52
+ })
53
+ .map(([key, value]) => {
54
+ return `${key}=${value}`;
55
+ })
56
+ .join("&");
57
+ const __path = `${__root}/${`companies/`}`;
58
+ return __queries ? `${__path}?${__queries}` : __path;
59
+ };
60
+ exports.createCompany = createCompany;
61
+ /**
62
+ * 会社情報を取得する
63
+ *
64
+ */
65
+ const getCompany = ({ id }) => {
66
+ const __root = (0, exports.root)();
67
+ const __queries = Object.entries({})
68
+ .filter(([_, value]) => {
69
+ return value !== undefined;
70
+ })
71
+ .map(([key, value]) => {
72
+ return `${key}=${value}`;
73
+ })
74
+ .join("&");
75
+ const __path = `${__root}/${`companies/${id}`}`;
76
+ return __queries ? `${__path}?${__queries}` : __path;
77
+ };
78
+ exports.getCompany = getCompany;
79
+ /**
80
+ * 会社情報を更新する
81
+ *
82
+ */
83
+ const updateCompany = () => {
84
+ const __root = (0, exports.root)();
85
+ const __queries = Object.entries({})
86
+ .filter(([_, value]) => {
87
+ return value !== undefined;
88
+ })
89
+ .map(([key, value]) => {
90
+ return `${key}=${value}`;
91
+ })
92
+ .join("&");
93
+ const __path = `${__root}/${`companies/`}`;
94
+ return __queries ? `${__path}?${__queries}` : __path;
95
+ };
96
+ exports.updateCompany = updateCompany;
97
+ /**
98
+ * 会社情報を更新する
99
+ *
100
+ */
101
+ const updateCompanyPatch = () => {
102
+ const __root = (0, exports.root)();
103
+ const __queries = Object.entries({})
104
+ .filter(([_, value]) => {
105
+ return value !== undefined;
106
+ })
107
+ .map(([key, value]) => {
108
+ return `${key}=${value}`;
109
+ })
110
+ .join("&");
111
+ const __path = `${__root}/${`companies/`}`;
112
+ return __queries ? `${__path}?${__queries}` : __path;
113
+ };
114
+ exports.updateCompanyPatch = updateCompanyPatch;
115
+ /**
116
+ * idを指定して複数の会社情報を取得する
117
+ * @param {string} company_ids a,b,c
118
+ */
119
+ const findCompaniesByIds = ({ company_ids, }) => {
120
+ const __root = (0, exports.root)();
121
+ const __queries = Object.entries({ company_ids })
122
+ .filter(([_, value]) => {
123
+ return value !== undefined;
124
+ })
125
+ .map(([key, value]) => {
126
+ return `${key}=${value}`;
127
+ })
128
+ .join("&");
129
+ const __path = `${__root}/${`companies/find_by_ids`}`;
130
+ return __queries ? `${__path}?${__queries}` : __path;
131
+ };
132
+ exports.findCompaniesByIds = findCompaniesByIds;
133
+ /**
134
+ * ユーザーを作成する
135
+ *
136
+ */
137
+ const createUser = () => {
138
+ const __root = (0, exports.root)();
139
+ const __queries = Object.entries({})
140
+ .filter(([_, value]) => {
141
+ return value !== undefined;
142
+ })
143
+ .map(([key, value]) => {
144
+ return `${key}=${value}`;
145
+ })
146
+ .join("&");
147
+ const __path = `${__root}/${`users/`}`;
148
+ return __queries ? `${__path}?${__queries}` : __path;
149
+ };
150
+ exports.createUser = createUser;
151
+ /**
152
+ * ユーザーを取得する
153
+ *
154
+ */
155
+ const findUserById = ({ id }) => {
156
+ const __root = (0, exports.root)();
157
+ const __queries = Object.entries({})
158
+ .filter(([_, value]) => {
159
+ return value !== undefined;
160
+ })
161
+ .map(([key, value]) => {
162
+ return `${key}=${value}`;
163
+ })
164
+ .join("&");
165
+ const __path = `${__root}/${`users/${id}`}`;
166
+ return __queries ? `${__path}?${__queries}` : __path;
167
+ };
168
+ exports.findUserById = findUserById;
169
+ /**
170
+ * ユーザーを更新する
171
+ *
172
+ */
173
+ const updateUser = ({ id }) => {
174
+ const __root = (0, exports.root)();
175
+ const __queries = Object.entries({})
176
+ .filter(([_, value]) => {
177
+ return value !== undefined;
178
+ })
179
+ .map(([key, value]) => {
180
+ return `${key}=${value}`;
181
+ })
182
+ .join("&");
183
+ const __path = `${__root}/${`users/${id}`}`;
184
+ return __queries ? `${__path}?${__queries}` : __path;
185
+ };
186
+ exports.updateUser = updateUser;
187
+ /**
188
+ * ユーザーを更新する
189
+ *
190
+ */
191
+ const updateUserPatch = ({ id }) => {
192
+ const __root = (0, exports.root)();
193
+ const __queries = Object.entries({})
194
+ .filter(([_, value]) => {
195
+ return value !== undefined;
196
+ })
197
+ .map(([key, value]) => {
198
+ return `${key}=${value}`;
199
+ })
200
+ .join("&");
201
+ const __path = `${__root}/${`users/${id}`}`;
202
+ return __queries ? `${__path}?${__queries}` : __path;
203
+ };
204
+ exports.updateUserPatch = updateUserPatch;
205
+ /**
206
+ * ユーザーを強制的に有効化する
207
+ *
208
+ */
209
+ const activateUserByAdmin = ({ id }) => {
210
+ const __root = (0, exports.root)();
211
+ const __queries = Object.entries({})
212
+ .filter(([_, value]) => {
213
+ return value !== undefined;
214
+ })
215
+ .map(([key, value]) => {
216
+ return `${key}=${value}`;
217
+ })
218
+ .join("&");
219
+ const __path = `${__root}/${`users/${id}/admin_activate`}`;
220
+ return __queries ? `${__path}?${__queries}` : __path;
221
+ };
222
+ exports.activateUserByAdmin = activateUserByAdmin;
223
+ /**
224
+ * ユーザーを無効化する
225
+ *
226
+ */
227
+ const deactivateUser = ({ id }) => {
228
+ const __root = (0, exports.root)();
229
+ const __queries = Object.entries({})
230
+ .filter(([_, value]) => {
231
+ return value !== undefined;
232
+ })
233
+ .map(([key, value]) => {
234
+ return `${key}=${value}`;
235
+ })
236
+ .join("&");
237
+ const __path = `${__root}/${`users/${id}/deactivate`}`;
238
+ return __queries ? `${__path}?${__queries}` : __path;
239
+ };
240
+ exports.deactivateUser = deactivateUser;
241
+ /**
242
+ * パスワードリセットのメールを送信する
243
+ *
244
+ */
245
+ const sendResetPasswordEmail = () => {
246
+ const __root = (0, exports.root)();
247
+ const __queries = Object.entries({})
248
+ .filter(([_, value]) => {
249
+ return value !== undefined;
250
+ })
251
+ .map(([key, value]) => {
252
+ return `${key}=${value}`;
253
+ })
254
+ .join("&");
255
+ const __path = `${__root}/${`users/reset_password_email`}`;
256
+ return __queries ? `${__path}?${__queries}` : __path;
257
+ };
258
+ exports.sendResetPasswordEmail = sendResetPasswordEmail;
259
+ /**
260
+ * パスワードをリセットする
261
+ *
262
+ */
263
+ const resetPassword = () => {
264
+ const __root = (0, exports.root)();
265
+ const __queries = Object.entries({})
266
+ .filter(([_, value]) => {
267
+ return value !== undefined;
268
+ })
269
+ .map(([key, value]) => {
270
+ return `${key}=${value}`;
271
+ })
272
+ .join("&");
273
+ const __path = `${__root}/${`users/reset_password`}`;
274
+ return __queries ? `${__path}?${__queries}` : __path;
275
+ };
276
+ exports.resetPassword = resetPassword;
277
+ /**
278
+ * アクティベーションメールを送信する
279
+ *
280
+ */
281
+ const sendActivationEmail = () => {
282
+ const __root = (0, exports.root)();
283
+ const __queries = Object.entries({})
284
+ .filter(([_, value]) => {
285
+ return value !== undefined;
286
+ })
287
+ .map(([key, value]) => {
288
+ return `${key}=${value}`;
289
+ })
290
+ .join("&");
291
+ const __path = `${__root}/${`users/activation_email`}`;
292
+ return __queries ? `${__path}?${__queries}` : __path;
293
+ };
294
+ exports.sendActivationEmail = sendActivationEmail;
295
+ /**
296
+ * ユーザーを有効化する
297
+ *
298
+ */
299
+ const activateUser = () => {
300
+ const __root = (0, exports.root)();
301
+ const __queries = Object.entries({})
302
+ .filter(([_, value]) => {
303
+ return value !== undefined;
304
+ })
305
+ .map(([key, value]) => {
306
+ return `${key}=${value}`;
307
+ })
308
+ .join("&");
309
+ const __path = `${__root}/${`users/activate`}`;
310
+ return __queries ? `${__path}?${__queries}` : __path;
311
+ };
312
+ exports.activateUser = activateUser;
313
+ /**
314
+ * 認可スコープを設定する
315
+ *
316
+ */
317
+ const setAuthorityScope = () => {
318
+ const __root = (0, exports.root)();
319
+ const __queries = Object.entries({})
320
+ .filter(([_, value]) => {
321
+ return value !== undefined;
322
+ })
323
+ .map(([key, value]) => {
324
+ return `${key}=${value}`;
325
+ })
326
+ .join("&");
327
+ const __path = `${__root}/${`users/scope`}`;
328
+ return __queries ? `${__path}?${__queries}` : __path;
329
+ };
330
+ exports.setAuthorityScope = setAuthorityScope;
331
+ /**
332
+ * メールを指定してユーザーを取得する
333
+ *
334
+ */
335
+ const findUserByEmail = () => {
336
+ const __root = (0, exports.root)();
337
+ const __queries = Object.entries({})
338
+ .filter(([_, value]) => {
339
+ return value !== undefined;
340
+ })
341
+ .map(([key, value]) => {
342
+ return `${key}=${value}`;
343
+ })
344
+ .join("&");
345
+ const __path = `${__root}/${`users/find_by_email`}`;
346
+ return __queries ? `${__path}?${__queries}` : __path;
347
+ };
348
+ exports.findUserByEmail = findUserByEmail;
349
+ /**
350
+ * ユーザーの権限を更新する
351
+ *
352
+ */
353
+ const updateAuthority = ({ id }) => {
354
+ const __root = (0, exports.root)();
355
+ const __queries = Object.entries({})
356
+ .filter(([_, value]) => {
357
+ return value !== undefined;
358
+ })
359
+ .map(([key, value]) => {
360
+ return `${key}=${value}`;
361
+ })
362
+ .join("&");
363
+ const __path = `${__root}/${`users/authority/${id}`}`;
364
+ return __queries ? `${__path}?${__queries}` : __path;
365
+ };
366
+ exports.updateAuthority = updateAuthority;
367
+ /**
368
+ * companyIdからユーザーを取得する
369
+ * @param {string} statuses BeforeVerification,Active,Deactivated
370
+ */
371
+ const findUsersByCompanyId = ({ statuses }) => {
372
+ const __root = (0, exports.root)();
373
+ const __queries = Object.entries({ statuses })
374
+ .filter(([_, value]) => {
375
+ return value !== undefined;
376
+ })
377
+ .map(([key, value]) => {
378
+ return `${key}=${value}`;
379
+ })
380
+ .join("&");
381
+ const __path = `${__root}/${`users/find_by_company_id`}`;
382
+ return __queries ? `${__path}?${__queries}` : __path;
383
+ };
384
+ exports.findUsersByCompanyId = findUsersByCompanyId;
385
+ /**
386
+ * ユーザー情報をAdminが変更する
387
+ *
388
+ */
389
+ const updateUserByAdmin = ({ id }) => {
390
+ const __root = (0, exports.root)();
391
+ const __queries = Object.entries({})
392
+ .filter(([_, value]) => {
393
+ return value !== undefined;
394
+ })
395
+ .map(([key, value]) => {
396
+ return `${key}=${value}`;
397
+ })
398
+ .join("&");
399
+ const __path = `${__root}/${`users/${id}/admin_update`}`;
400
+ return __queries ? `${__path}?${__queries}` : __path;
401
+ };
402
+ exports.updateUserByAdmin = updateUserByAdmin;
403
+ /**
404
+ * ログインする
405
+ *
406
+ */
407
+ const login = () => {
408
+ const __root = (0, exports.root)();
409
+ const __queries = Object.entries({})
410
+ .filter(([_, value]) => {
411
+ return value !== undefined;
412
+ })
413
+ .map(([key, value]) => {
414
+ return `${key}=${value}`;
415
+ })
416
+ .join("&");
417
+ const __path = `${__root}/${`login`}`;
418
+ return __queries ? `${__path}?${__queries}` : __path;
419
+ };
420
+ exports.login = login;
421
+ /**
422
+ * ログインする
423
+ *
424
+ */
425
+ const loginWithSlash = () => {
426
+ const __root = (0, exports.root)();
427
+ const __queries = Object.entries({})
428
+ .filter(([_, value]) => {
429
+ return value !== undefined;
430
+ })
431
+ .map(([key, value]) => {
432
+ return `${key}=${value}`;
433
+ })
434
+ .join("&");
435
+ const __path = `${__root}/${`login/`}`;
436
+ return __queries ? `${__path}?${__queries}` : __path;
437
+ };
438
+ exports.loginWithSlash = loginWithSlash;
439
+ /**
440
+ * JWKを取得する
441
+ *
442
+ */
443
+ const getJwks = () => {
444
+ const __root = (0, exports.root)();
445
+ const __queries = Object.entries({})
446
+ .filter(([_, value]) => {
447
+ return value !== undefined;
448
+ })
449
+ .map(([key, value]) => {
450
+ return `${key}=${value}`;
451
+ })
452
+ .join("&");
453
+ const __path = `${__root}/${`login/jwks`}`;
454
+ return __queries ? `${__path}?${__queries}` : __path;
455
+ };
456
+ exports.getJwks = getJwks;
457
+ /**
458
+ * 公開鍵を取得する
459
+ *
460
+ */
461
+ const getPublicKeys = () => {
462
+ const __root = (0, exports.root)();
463
+ const __queries = Object.entries({})
464
+ .filter(([_, value]) => {
465
+ return value !== undefined;
466
+ })
467
+ .map(([key, value]) => {
468
+ return `${key}=${value}`;
469
+ })
470
+ .join("&");
471
+ const __path = `${__root}/${`login/public_keys`}`;
472
+ return __queries ? `${__path}?${__queries}` : __path;
473
+ };
474
+ exports.getPublicKeys = getPublicKeys;
475
+ /**
476
+ * MFAのコードを発行する
477
+ *
478
+ */
479
+ const publishMFACode = () => {
480
+ const __root = (0, exports.root)();
481
+ const __queries = Object.entries({})
482
+ .filter(([_, value]) => {
483
+ return value !== undefined;
484
+ })
485
+ .map(([key, value]) => {
486
+ return `${key}=${value}`;
487
+ })
488
+ .join("&");
489
+ const __path = `${__root}/${`login/publish_mfa_code`}`;
490
+ return __queries ? `${__path}?${__queries}` : __path;
491
+ };
492
+ exports.publishMFACode = publishMFACode;
493
+ /**
494
+ * MFAを使ってログインする
495
+ *
496
+ */
497
+ const loginWithMFA = () => {
498
+ const __root = (0, exports.root)();
499
+ const __queries = Object.entries({})
500
+ .filter(([_, value]) => {
501
+ return value !== undefined;
502
+ })
503
+ .map(([key, value]) => {
504
+ return `${key}=${value}`;
505
+ })
506
+ .join("&");
507
+ const __path = `${__root}/${`login/mfa_login`}`;
508
+ return __queries ? `${__path}?${__queries}` : __path;
509
+ };
510
+ exports.loginWithMFA = loginWithMFA;
511
+ /**
512
+ * usersに存在しないアカウントのトークンを作成する(deprecated)
513
+ *
514
+ */
515
+ const generateToken = () => {
516
+ const __root = (0, exports.root)();
517
+ const __queries = Object.entries({})
518
+ .filter(([_, value]) => {
519
+ return value !== undefined;
520
+ })
521
+ .map(([key, value]) => {
522
+ return `${key}=${value}`;
523
+ })
524
+ .join("&");
525
+ const __path = `${__root}/${`guest/token`}`;
526
+ return __queries ? `${__path}?${__queries}` : __path;
527
+ };
528
+ exports.generateToken = generateToken;
529
+ /**
530
+ * usersに存在しないアカウントのトークンを作成する
531
+ *
532
+ */
533
+ const generateUserToken = () => {
534
+ const __root = (0, exports.root)();
535
+ const __queries = Object.entries({})
536
+ .filter(([_, value]) => {
537
+ return value !== undefined;
538
+ })
539
+ .map(([key, value]) => {
540
+ return `${key}=${value}`;
541
+ })
542
+ .join("&");
543
+ const __path = `${__root}/${`generate/token`}`;
544
+ return __queries ? `${__path}?${__queries}` : __path;
545
+ };
546
+ exports.generateUserToken = generateUserToken;
547
+ exports.m2mUsers_v1 = {
548
+ healthCheck: exports.healthCheck,
549
+ createCompany: exports.createCompany,
550
+ getCompany: exports.getCompany,
551
+ updateCompany: exports.updateCompany,
552
+ updateCompanyPatch: exports.updateCompanyPatch,
553
+ findCompaniesByIds: exports.findCompaniesByIds,
554
+ createUser: exports.createUser,
555
+ findUserById: exports.findUserById,
556
+ updateUser: exports.updateUser,
557
+ updateUserPatch: exports.updateUserPatch,
558
+ activateUserByAdmin: exports.activateUserByAdmin,
559
+ deactivateUser: exports.deactivateUser,
560
+ sendResetPasswordEmail: exports.sendResetPasswordEmail,
561
+ resetPassword: exports.resetPassword,
562
+ sendActivationEmail: exports.sendActivationEmail,
563
+ activateUser: exports.activateUser,
564
+ setAuthorityScope: exports.setAuthorityScope,
565
+ findUserByEmail: exports.findUserByEmail,
566
+ updateAuthority: exports.updateAuthority,
567
+ findUsersByCompanyId: exports.findUsersByCompanyId,
568
+ updateUserByAdmin: exports.updateUserByAdmin,
569
+ login: exports.login,
570
+ loginWithSlash: exports.loginWithSlash,
571
+ getJwks: exports.getJwks,
572
+ getPublicKeys: exports.getPublicKeys,
573
+ publishMFACode: exports.publishMFACode,
574
+ loginWithMFA: exports.loginWithMFA,
575
+ generateToken: exports.generateToken,
576
+ generateUserToken: exports.generateUserToken,
577
+ };
@@ -0,0 +1,8 @@
1
+ import * as v3 from "./sumyca.v3";
2
+ import * as guestV3 from "./sumyca.guest-v3";
3
+ import * as managerV3 from "./sumyca.manager-v3";
4
+ export declare const sumyca: {
5
+ v3: typeof v3;
6
+ guestV3: typeof guestV3;
7
+ managerV3: typeof managerV3;
8
+ };