endpoints-sdk-cli 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +5 -5
- package/lib/classes/Config.d.ts +20 -0
- package/lib/classes/Config.js +52 -0
- package/lib/classes/Repository.d.ts +38 -0
- package/lib/classes/Repository.js +60 -0
- package/lib/commands/add.js +17 -28
- package/lib/commands/install.js +14 -12
- package/lib/commands/update.js +19 -16
- package/lib/endpoints/m2m-core.d.ts +4 -0
- package/lib/endpoints/m2m-core.js +7 -0
- package/lib/endpoints/m2m-core.v1.d.ts +527 -0
- package/lib/endpoints/m2m-core.v1.js +1084 -0
- package/lib/endpoints/m2m-notifications.d.ts +4 -0
- package/lib/endpoints/m2m-notifications.js +7 -0
- package/lib/endpoints/m2m-notifications.v1.d.ts +50 -0
- package/lib/endpoints/m2m-notifications.v1.js +133 -0
- package/lib/endpoints/m2m-users.d.ts +4 -0
- package/lib/endpoints/m2m-users.js +7 -0
- package/lib/endpoints/m2m-users.v1.d.ts +210 -0
- package/lib/endpoints/m2m-users.v1.js +529 -0
- package/lib/index.js +1 -0
- package/lib/makeFiles.d.ts +7 -0
- package/lib/makeFiles.js +21 -0
- package/lib/templates/files/endpoints.d.ts +8 -0
- package/lib/templates/files/endpoints.js +21 -0
- package/lib/templates/files/index.d.ts +2 -0
- package/lib/templates/files/index.js +7 -0
- package/lib/templates/files/indexFile.d.ts +8 -0
- package/lib/templates/files/indexFile.js +16 -0
- package/lib/templates/functions/endpoint.d.ts +2 -0
- package/lib/templates/functions/endpoint.js +89 -0
- package/lib/templates/functions/index.d.ts +2 -0
- package/lib/templates/functions/index.js +5 -0
- package/lib/templates/functions/root.d.ts +6 -0
- package/lib/templates/functions/root.js +30 -0
- package/lib/templates/index.d.ts +2 -0
- package/lib/templates/index.js +6 -0
- package/lib/utils/format.d.ts +1 -0
- package/lib/utils/format.js +8 -0
- package/lib/utils/unique.d.ts +1 -0
- package/lib/utils/unique.js +14 -0
- package/oclif.manifest.json +1 -1
- package/package.json +17 -17
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +0 -4
- package/lib/parts/makeEndpointsFiles.d.ts +0 -6
- package/lib/parts/makeEndpointsFiles.js +0 -41
- package/lib/parts/makeEndpointsSourceFromRepository.d.ts +0 -11
- package/lib/parts/makeEndpointsSourceFromRepository.js +0 -37
- package/lib/types.d.ts +0 -30
- package/lib/types.js +0 -1
- package/lib/utils/extractServiceNameFromPath.d.ts +0 -1
- package/lib/utils/extractServiceNameFromPath.js +0 -8
- package/lib/utils/getConfig.d.ts +0 -1
- package/lib/utils/getConfig.js +0 -12
- package/lib/utils/inferRepository.d.ts +0 -1
- package/lib/utils/inferRepository.js +0 -20
- package/lib/utils/parseEndpoints.d.ts +0 -23
- package/lib/utils/parseEndpoints.js +0 -74
- package/lib/utils/parseUrl.d.ts +0 -17
- package/lib/utils/parseUrl.js +0 -43
- package/lib/utils/updateConfigFile.d.ts +0 -6
- package/lib/utils/updateConfigFile.js +0 -20
|
@@ -0,0 +1,529 @@
|
|
|
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.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
|
+
exports.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
|
+
/**
|
|
25
|
+
* ヘルスチェック
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
exports.healthCheck = () => {
|
|
29
|
+
const __root = exports.root();
|
|
30
|
+
const __queries = Object.entries({})
|
|
31
|
+
.filter(([_, value]) => {
|
|
32
|
+
return value !== undefined;
|
|
33
|
+
})
|
|
34
|
+
.map(([key, value]) => {
|
|
35
|
+
return `${key}=${value}`;
|
|
36
|
+
})
|
|
37
|
+
.join("&");
|
|
38
|
+
const __path = `${__root}/${`health_check`}`;
|
|
39
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 会社を作成する
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
exports.createCompany = () => {
|
|
46
|
+
const __root = exports.root();
|
|
47
|
+
const __queries = Object.entries({})
|
|
48
|
+
.filter(([_, value]) => {
|
|
49
|
+
return value !== undefined;
|
|
50
|
+
})
|
|
51
|
+
.map(([key, value]) => {
|
|
52
|
+
return `${key}=${value}`;
|
|
53
|
+
})
|
|
54
|
+
.join("&");
|
|
55
|
+
const __path = `${__root}/${`companies/`}`;
|
|
56
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* 会社情報を取得する
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
exports.getCompany = ({ id }) => {
|
|
63
|
+
const __root = exports.root();
|
|
64
|
+
const __queries = Object.entries({})
|
|
65
|
+
.filter(([_, value]) => {
|
|
66
|
+
return value !== undefined;
|
|
67
|
+
})
|
|
68
|
+
.map(([key, value]) => {
|
|
69
|
+
return `${key}=${value}`;
|
|
70
|
+
})
|
|
71
|
+
.join("&");
|
|
72
|
+
const __path = `${__root}/${`companies/${id}`}`;
|
|
73
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 会社情報を更新する
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
exports.updateCompany = () => {
|
|
80
|
+
const __root = exports.root();
|
|
81
|
+
const __queries = Object.entries({})
|
|
82
|
+
.filter(([_, value]) => {
|
|
83
|
+
return value !== undefined;
|
|
84
|
+
})
|
|
85
|
+
.map(([key, value]) => {
|
|
86
|
+
return `${key}=${value}`;
|
|
87
|
+
})
|
|
88
|
+
.join("&");
|
|
89
|
+
const __path = `${__root}/${`companies/`}`;
|
|
90
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* 会社情報を更新する
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
exports.updateCompanyPatch = () => {
|
|
97
|
+
const __root = exports.root();
|
|
98
|
+
const __queries = Object.entries({})
|
|
99
|
+
.filter(([_, value]) => {
|
|
100
|
+
return value !== undefined;
|
|
101
|
+
})
|
|
102
|
+
.map(([key, value]) => {
|
|
103
|
+
return `${key}=${value}`;
|
|
104
|
+
})
|
|
105
|
+
.join("&");
|
|
106
|
+
const __path = `${__root}/${`companies/`}`;
|
|
107
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* idを指定して複数の会社情報を取得する
|
|
111
|
+
* @param {string} company_ids a,b,c
|
|
112
|
+
*/
|
|
113
|
+
exports.findCompaniesByIds = ({ company_ids, }) => {
|
|
114
|
+
const __root = exports.root();
|
|
115
|
+
const __queries = Object.entries({ company_ids })
|
|
116
|
+
.filter(([_, value]) => {
|
|
117
|
+
return value !== undefined;
|
|
118
|
+
})
|
|
119
|
+
.map(([key, value]) => {
|
|
120
|
+
return `${key}=${value}`;
|
|
121
|
+
})
|
|
122
|
+
.join("&");
|
|
123
|
+
const __path = `${__root}/${`companies/find_by_ids`}`;
|
|
124
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* ユーザーを作成する
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
130
|
+
exports.createUser = () => {
|
|
131
|
+
const __root = exports.root();
|
|
132
|
+
const __queries = Object.entries({})
|
|
133
|
+
.filter(([_, value]) => {
|
|
134
|
+
return value !== undefined;
|
|
135
|
+
})
|
|
136
|
+
.map(([key, value]) => {
|
|
137
|
+
return `${key}=${value}`;
|
|
138
|
+
})
|
|
139
|
+
.join("&");
|
|
140
|
+
const __path = `${__root}/${`users/`}`;
|
|
141
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* ユーザーを取得する
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
exports.findUserById = ({ id }) => {
|
|
148
|
+
const __root = exports.root();
|
|
149
|
+
const __queries = Object.entries({})
|
|
150
|
+
.filter(([_, value]) => {
|
|
151
|
+
return value !== undefined;
|
|
152
|
+
})
|
|
153
|
+
.map(([key, value]) => {
|
|
154
|
+
return `${key}=${value}`;
|
|
155
|
+
})
|
|
156
|
+
.join("&");
|
|
157
|
+
const __path = `${__root}/${`users/${id}`}`;
|
|
158
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* ユーザーを更新する
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
exports.updateUser = ({ id }) => {
|
|
165
|
+
const __root = exports.root();
|
|
166
|
+
const __queries = Object.entries({})
|
|
167
|
+
.filter(([_, value]) => {
|
|
168
|
+
return value !== undefined;
|
|
169
|
+
})
|
|
170
|
+
.map(([key, value]) => {
|
|
171
|
+
return `${key}=${value}`;
|
|
172
|
+
})
|
|
173
|
+
.join("&");
|
|
174
|
+
const __path = `${__root}/${`users/${id}`}`;
|
|
175
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* ユーザーを更新する
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
exports.updateUserPatch = ({ id }) => {
|
|
182
|
+
const __root = exports.root();
|
|
183
|
+
const __queries = Object.entries({})
|
|
184
|
+
.filter(([_, value]) => {
|
|
185
|
+
return value !== undefined;
|
|
186
|
+
})
|
|
187
|
+
.map(([key, value]) => {
|
|
188
|
+
return `${key}=${value}`;
|
|
189
|
+
})
|
|
190
|
+
.join("&");
|
|
191
|
+
const __path = `${__root}/${`users/${id}`}`;
|
|
192
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* ユーザーを強制的に有効化する
|
|
196
|
+
*
|
|
197
|
+
*/
|
|
198
|
+
exports.activateUserByAdmin = ({ id }) => {
|
|
199
|
+
const __root = exports.root();
|
|
200
|
+
const __queries = Object.entries({})
|
|
201
|
+
.filter(([_, value]) => {
|
|
202
|
+
return value !== undefined;
|
|
203
|
+
})
|
|
204
|
+
.map(([key, value]) => {
|
|
205
|
+
return `${key}=${value}`;
|
|
206
|
+
})
|
|
207
|
+
.join("&");
|
|
208
|
+
const __path = `${__root}/${`users/${id}/admin_activate`}`;
|
|
209
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* ユーザーを無効化する
|
|
213
|
+
*
|
|
214
|
+
*/
|
|
215
|
+
exports.deactivateUser = ({ id }) => {
|
|
216
|
+
const __root = exports.root();
|
|
217
|
+
const __queries = Object.entries({})
|
|
218
|
+
.filter(([_, value]) => {
|
|
219
|
+
return value !== undefined;
|
|
220
|
+
})
|
|
221
|
+
.map(([key, value]) => {
|
|
222
|
+
return `${key}=${value}`;
|
|
223
|
+
})
|
|
224
|
+
.join("&");
|
|
225
|
+
const __path = `${__root}/${`users/${id}/deactivate`}`;
|
|
226
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* パスワードリセットのメールを送信する
|
|
230
|
+
*
|
|
231
|
+
*/
|
|
232
|
+
exports.sendResetPasswordEmail = () => {
|
|
233
|
+
const __root = exports.root();
|
|
234
|
+
const __queries = Object.entries({})
|
|
235
|
+
.filter(([_, value]) => {
|
|
236
|
+
return value !== undefined;
|
|
237
|
+
})
|
|
238
|
+
.map(([key, value]) => {
|
|
239
|
+
return `${key}=${value}`;
|
|
240
|
+
})
|
|
241
|
+
.join("&");
|
|
242
|
+
const __path = `${__root}/${`users/reset_password_email`}`;
|
|
243
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* パスワードをリセットする
|
|
247
|
+
*
|
|
248
|
+
*/
|
|
249
|
+
exports.resetPassword = () => {
|
|
250
|
+
const __root = exports.root();
|
|
251
|
+
const __queries = Object.entries({})
|
|
252
|
+
.filter(([_, value]) => {
|
|
253
|
+
return value !== undefined;
|
|
254
|
+
})
|
|
255
|
+
.map(([key, value]) => {
|
|
256
|
+
return `${key}=${value}`;
|
|
257
|
+
})
|
|
258
|
+
.join("&");
|
|
259
|
+
const __path = `${__root}/${`users/reset_password`}`;
|
|
260
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* アクティベーションメールを送信する
|
|
264
|
+
*
|
|
265
|
+
*/
|
|
266
|
+
exports.sendActivationEmail = () => {
|
|
267
|
+
const __root = exports.root();
|
|
268
|
+
const __queries = Object.entries({})
|
|
269
|
+
.filter(([_, value]) => {
|
|
270
|
+
return value !== undefined;
|
|
271
|
+
})
|
|
272
|
+
.map(([key, value]) => {
|
|
273
|
+
return `${key}=${value}`;
|
|
274
|
+
})
|
|
275
|
+
.join("&");
|
|
276
|
+
const __path = `${__root}/${`users/activation_email`}`;
|
|
277
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* ユーザーを有効化する
|
|
281
|
+
*
|
|
282
|
+
*/
|
|
283
|
+
exports.activateUser = () => {
|
|
284
|
+
const __root = exports.root();
|
|
285
|
+
const __queries = Object.entries({})
|
|
286
|
+
.filter(([_, value]) => {
|
|
287
|
+
return value !== undefined;
|
|
288
|
+
})
|
|
289
|
+
.map(([key, value]) => {
|
|
290
|
+
return `${key}=${value}`;
|
|
291
|
+
})
|
|
292
|
+
.join("&");
|
|
293
|
+
const __path = `${__root}/${`users/activate`}`;
|
|
294
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* 認可スコープを設定する
|
|
298
|
+
*
|
|
299
|
+
*/
|
|
300
|
+
exports.setAuthorityScope = () => {
|
|
301
|
+
const __root = exports.root();
|
|
302
|
+
const __queries = Object.entries({})
|
|
303
|
+
.filter(([_, value]) => {
|
|
304
|
+
return value !== undefined;
|
|
305
|
+
})
|
|
306
|
+
.map(([key, value]) => {
|
|
307
|
+
return `${key}=${value}`;
|
|
308
|
+
})
|
|
309
|
+
.join("&");
|
|
310
|
+
const __path = `${__root}/${`users/scope`}`;
|
|
311
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* メールを指定してユーザーを取得する
|
|
315
|
+
*
|
|
316
|
+
*/
|
|
317
|
+
exports.findUserByEmail = () => {
|
|
318
|
+
const __root = 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/find_by_email`}`;
|
|
328
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* ユーザーの権限を更新する
|
|
332
|
+
*
|
|
333
|
+
*/
|
|
334
|
+
exports.updateAuthority = ({ id }) => {
|
|
335
|
+
const __root = exports.root();
|
|
336
|
+
const __queries = Object.entries({})
|
|
337
|
+
.filter(([_, value]) => {
|
|
338
|
+
return value !== undefined;
|
|
339
|
+
})
|
|
340
|
+
.map(([key, value]) => {
|
|
341
|
+
return `${key}=${value}`;
|
|
342
|
+
})
|
|
343
|
+
.join("&");
|
|
344
|
+
const __path = `${__root}/${`users/authority/${id}`}`;
|
|
345
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* companyIdからユーザーを取得する
|
|
349
|
+
* @param {string} statuses BeforeVerification,Active,Deactivated
|
|
350
|
+
*/
|
|
351
|
+
exports.findUsersByCompanyId = ({ statuses }) => {
|
|
352
|
+
const __root = exports.root();
|
|
353
|
+
const __queries = Object.entries({ statuses })
|
|
354
|
+
.filter(([_, value]) => {
|
|
355
|
+
return value !== undefined;
|
|
356
|
+
})
|
|
357
|
+
.map(([key, value]) => {
|
|
358
|
+
return `${key}=${value}`;
|
|
359
|
+
})
|
|
360
|
+
.join("&");
|
|
361
|
+
const __path = `${__root}/${`users/find_by_company_id`}`;
|
|
362
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* ログインする
|
|
366
|
+
*
|
|
367
|
+
*/
|
|
368
|
+
exports.login = () => {
|
|
369
|
+
const __root = exports.root();
|
|
370
|
+
const __queries = Object.entries({})
|
|
371
|
+
.filter(([_, value]) => {
|
|
372
|
+
return value !== undefined;
|
|
373
|
+
})
|
|
374
|
+
.map(([key, value]) => {
|
|
375
|
+
return `${key}=${value}`;
|
|
376
|
+
})
|
|
377
|
+
.join("&");
|
|
378
|
+
const __path = `${__root}/${`login`}`;
|
|
379
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* ログインする
|
|
383
|
+
*
|
|
384
|
+
*/
|
|
385
|
+
exports.loginWithSlash = () => {
|
|
386
|
+
const __root = exports.root();
|
|
387
|
+
const __queries = Object.entries({})
|
|
388
|
+
.filter(([_, value]) => {
|
|
389
|
+
return value !== undefined;
|
|
390
|
+
})
|
|
391
|
+
.map(([key, value]) => {
|
|
392
|
+
return `${key}=${value}`;
|
|
393
|
+
})
|
|
394
|
+
.join("&");
|
|
395
|
+
const __path = `${__root}/${`login/`}`;
|
|
396
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* JWKを取得する
|
|
400
|
+
*
|
|
401
|
+
*/
|
|
402
|
+
exports.getJwks = () => {
|
|
403
|
+
const __root = exports.root();
|
|
404
|
+
const __queries = Object.entries({})
|
|
405
|
+
.filter(([_, value]) => {
|
|
406
|
+
return value !== undefined;
|
|
407
|
+
})
|
|
408
|
+
.map(([key, value]) => {
|
|
409
|
+
return `${key}=${value}`;
|
|
410
|
+
})
|
|
411
|
+
.join("&");
|
|
412
|
+
const __path = `${__root}/${`login/jwks`}`;
|
|
413
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* 公開鍵を取得する
|
|
417
|
+
*
|
|
418
|
+
*/
|
|
419
|
+
exports.getPublicKeys = () => {
|
|
420
|
+
const __root = exports.root();
|
|
421
|
+
const __queries = Object.entries({})
|
|
422
|
+
.filter(([_, value]) => {
|
|
423
|
+
return value !== undefined;
|
|
424
|
+
})
|
|
425
|
+
.map(([key, value]) => {
|
|
426
|
+
return `${key}=${value}`;
|
|
427
|
+
})
|
|
428
|
+
.join("&");
|
|
429
|
+
const __path = `${__root}/${`login/public_keys`}`;
|
|
430
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* MFAのコードを発行する
|
|
434
|
+
*
|
|
435
|
+
*/
|
|
436
|
+
exports.publishMFACode = () => {
|
|
437
|
+
const __root = exports.root();
|
|
438
|
+
const __queries = Object.entries({})
|
|
439
|
+
.filter(([_, value]) => {
|
|
440
|
+
return value !== undefined;
|
|
441
|
+
})
|
|
442
|
+
.map(([key, value]) => {
|
|
443
|
+
return `${key}=${value}`;
|
|
444
|
+
})
|
|
445
|
+
.join("&");
|
|
446
|
+
const __path = `${__root}/${`login/publish_mfa_code`}`;
|
|
447
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* MFAを使ってログインする
|
|
451
|
+
*
|
|
452
|
+
*/
|
|
453
|
+
exports.loginWithMFA = () => {
|
|
454
|
+
const __root = exports.root();
|
|
455
|
+
const __queries = Object.entries({})
|
|
456
|
+
.filter(([_, value]) => {
|
|
457
|
+
return value !== undefined;
|
|
458
|
+
})
|
|
459
|
+
.map(([key, value]) => {
|
|
460
|
+
return `${key}=${value}`;
|
|
461
|
+
})
|
|
462
|
+
.join("&");
|
|
463
|
+
const __path = `${__root}/${`login/mfa_login`}`;
|
|
464
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* usersに存在しないアカウントのトークンを作成する(deprecated)
|
|
468
|
+
*
|
|
469
|
+
*/
|
|
470
|
+
exports.generateToken = () => {
|
|
471
|
+
const __root = exports.root();
|
|
472
|
+
const __queries = Object.entries({})
|
|
473
|
+
.filter(([_, value]) => {
|
|
474
|
+
return value !== undefined;
|
|
475
|
+
})
|
|
476
|
+
.map(([key, value]) => {
|
|
477
|
+
return `${key}=${value}`;
|
|
478
|
+
})
|
|
479
|
+
.join("&");
|
|
480
|
+
const __path = `${__root}/${`guest/token`}`;
|
|
481
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* usersに存在しないアカウントのトークンを作成する
|
|
485
|
+
*
|
|
486
|
+
*/
|
|
487
|
+
exports.generateUserToken = () => {
|
|
488
|
+
const __root = exports.root();
|
|
489
|
+
const __queries = Object.entries({})
|
|
490
|
+
.filter(([_, value]) => {
|
|
491
|
+
return value !== undefined;
|
|
492
|
+
})
|
|
493
|
+
.map(([key, value]) => {
|
|
494
|
+
return `${key}=${value}`;
|
|
495
|
+
})
|
|
496
|
+
.join("&");
|
|
497
|
+
const __path = `${__root}/${`generate/token`}`;
|
|
498
|
+
return __queries ? `${__path}?${__queries}` : __path;
|
|
499
|
+
};
|
|
500
|
+
exports.m2mUsers_v1 = {
|
|
501
|
+
healthCheck: exports.healthCheck,
|
|
502
|
+
createCompany: exports.createCompany,
|
|
503
|
+
getCompany: exports.getCompany,
|
|
504
|
+
updateCompany: exports.updateCompany,
|
|
505
|
+
updateCompanyPatch: exports.updateCompanyPatch,
|
|
506
|
+
findCompaniesByIds: exports.findCompaniesByIds,
|
|
507
|
+
createUser: exports.createUser,
|
|
508
|
+
findUserById: exports.findUserById,
|
|
509
|
+
updateUser: exports.updateUser,
|
|
510
|
+
updateUserPatch: exports.updateUserPatch,
|
|
511
|
+
activateUserByAdmin: exports.activateUserByAdmin,
|
|
512
|
+
deactivateUser: exports.deactivateUser,
|
|
513
|
+
sendResetPasswordEmail: exports.sendResetPasswordEmail,
|
|
514
|
+
resetPassword: exports.resetPassword,
|
|
515
|
+
sendActivationEmail: exports.sendActivationEmail,
|
|
516
|
+
activateUser: exports.activateUser,
|
|
517
|
+
setAuthorityScope: exports.setAuthorityScope,
|
|
518
|
+
findUserByEmail: exports.findUserByEmail,
|
|
519
|
+
updateAuthority: exports.updateAuthority,
|
|
520
|
+
findUsersByCompanyId: exports.findUsersByCompanyId,
|
|
521
|
+
login: exports.login,
|
|
522
|
+
loginWithSlash: exports.loginWithSlash,
|
|
523
|
+
getJwks: exports.getJwks,
|
|
524
|
+
getPublicKeys: exports.getPublicKeys,
|
|
525
|
+
publishMFACode: exports.publishMFACode,
|
|
526
|
+
loginWithMFA: exports.loginWithMFA,
|
|
527
|
+
generateToken: exports.generateToken,
|
|
528
|
+
generateUserToken: exports.generateUserToken,
|
|
529
|
+
};
|
package/lib/index.js
CHANGED
package/lib/makeFiles.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeFiles = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
|
+
const templates = tslib_1.__importStar(require("./templates"));
|
|
7
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
8
|
+
const format_1 = require("./utils/format");
|
|
9
|
+
const makeName = (...args) => {
|
|
10
|
+
return args.filter(e => Boolean(e)).join('.');
|
|
11
|
+
};
|
|
12
|
+
exports.makeFiles = ({ repository, workspace, config }) => {
|
|
13
|
+
const files = [];
|
|
14
|
+
Object.entries(repository.data).forEach(([version, period]) => {
|
|
15
|
+
const content = templates.files.endpoints({ repository, version, period, config });
|
|
16
|
+
const basename = makeName(repository.name, workspace, version);
|
|
17
|
+
files.push({ version, basename });
|
|
18
|
+
fs.writeFileSync(path.resolve(config.output, `${basename}.ts`), format_1.format(content));
|
|
19
|
+
});
|
|
20
|
+
fs.writeFileSync(path.resolve(config.output, `${makeName(repository.name, workspace)}.ts`), format_1.format(templates.files.index({ files, repository })));
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from '../../classes/Config';
|
|
2
|
+
import type { Repository, Period } from '../../classes/Repository';
|
|
3
|
+
export declare const endpoints: ({ repository, version, period, config, }: {
|
|
4
|
+
repository: Repository;
|
|
5
|
+
version: string;
|
|
6
|
+
period: Period;
|
|
7
|
+
config: Config;
|
|
8
|
+
}) => string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.endpoints = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const templates = tslib_1.__importStar(require("../functions"));
|
|
6
|
+
const camelCase_1 = require("../../utils/camelCase");
|
|
7
|
+
exports.endpoints = ({ repository, version, period, config, }) => {
|
|
8
|
+
const names = [];
|
|
9
|
+
const fns = Object.entries(period.api).map(([_name, endpoint]) => {
|
|
10
|
+
const name = camelCase_1.camelCase(_name);
|
|
11
|
+
names.push(name);
|
|
12
|
+
return templates.endpoint(name, endpoint);
|
|
13
|
+
});
|
|
14
|
+
const exportFns = `export const ${camelCase_1.camelCase(repository.name)}_${camelCase_1.camelCase(version)} = {${names.join(',')}}`;
|
|
15
|
+
return [
|
|
16
|
+
'/* eslint-disable */',
|
|
17
|
+
templates.root({ period, config }),
|
|
18
|
+
...fns,
|
|
19
|
+
exportFns,
|
|
20
|
+
].join('');
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.index = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var indexFile_1 = require("./indexFile");
|
|
6
|
+
Object.defineProperty(exports, "index", { enumerable: true, get: function () { return indexFile_1.indexFile; } });
|
|
7
|
+
tslib_1.__exportStar(require("./endpoints"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.indexFile = void 0;
|
|
4
|
+
const camelCase_1 = require("../../utils/camelCase");
|
|
5
|
+
exports.indexFile = ({ files, repository, }) => {
|
|
6
|
+
return `
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
${files
|
|
9
|
+
.map(({ version, basename }) => {
|
|
10
|
+
return `import * as ${camelCase_1.camelCase(version)} from './${basename}'`;
|
|
11
|
+
})
|
|
12
|
+
.join('\n')}
|
|
13
|
+
export const ${camelCase_1.camelCase(repository.name)} = {${files
|
|
14
|
+
.map(({ version }) => camelCase_1.camelCase(version))
|
|
15
|
+
.join(',')}}`;
|
|
16
|
+
};
|