endpoints-sdk-cli 2.1.3 → 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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.2.0](https://github.com/matsuri-tech/endpoints-sdk-cli/compare/v2.1.3...v2.2.0) (2022-01-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * make it work with repositories whose main branch is not master ([574c1e8](https://github.com/matsuri-tech/endpoints-sdk-cli/commit/574c1e8d769cb6402ba32472f602db8a73ed7ec4))
11
+
5
12
  ### [2.1.3](https://github.com/matsuri-tech/endpoints-sdk-cli/compare/v2.1.2...v2.1.3) (2020-12-04)
6
13
 
7
14
 
package/README.md CHANGED
@@ -17,7 +17,7 @@ $ npm install -g endpoints-sdk-cli
17
17
  $ mes COMMAND
18
18
  running command...
19
19
  $ mes (-v|--version|version)
20
- endpoints-sdk-cli/2.1.3 darwin-x64 node-v12.17.0
20
+ endpoints-sdk-cli/2.2.0 darwin-x64 node-v16.6.0
21
21
  $ mes --help [COMMAND]
22
22
  USAGE
23
23
  $ mes COMMAND
@@ -74,7 +74,7 @@ EXAMPLES
74
74
  $ mes add https://github.com/[username/repository].git
75
75
  ```
76
76
 
77
- _See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.1.3/src/commands/add.ts)_
77
+ _See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.2.0/src/commands/add.ts)_
78
78
 
79
79
  ## `mes help [COMMAND]`
80
80
 
@@ -102,7 +102,7 @@ USAGE
102
102
  $ mes install
103
103
  ```
104
104
 
105
- _See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.1.3/src/commands/install.ts)_
105
+ _See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.2.0/src/commands/install.ts)_
106
106
 
107
107
  ## `mes update [SERVICE]`
108
108
 
@@ -113,7 +113,7 @@ USAGE
113
113
  $ mes update [SERVICE]
114
114
  ```
115
115
 
116
- _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.1.3/src/commands/update.ts)_
116
+ _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.2.0/src/commands/update.ts)_
117
117
  <!-- commandsstop -->
118
118
 
119
119
 
@@ -22,7 +22,8 @@ class Repository {
22
22
  }
23
23
  checkout(workspace) {
24
24
  const file = path.resolve(this.cache, workspace, '.endpoints.json');
25
- child_process_1.execSync(`cd ${this.cache} && git checkout origin/master -- ${file}`);
25
+ const mainBranch = child_process_1.execSync(`cd ${this.cache}; git rev-parse --abbrev-ref origin/HEAD`).toString().trim();
26
+ child_process_1.execSync(`cd ${this.cache}; git checkout ${mainBranch} -- ${file}`);
26
27
  return JSON.parse(fs.readFileSync(file).toString());
27
28
  }
28
29
  revParse() {
@@ -0,0 +1,4 @@
1
+ import * as v1 from "./m2m-notifications.v1";
2
+ export declare const m2mNotifications: {
3
+ v1: typeof v1;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.m2mNotifications = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable */
6
+ const v1 = tslib_1.__importStar(require("./m2m-notifications.v1"));
7
+ exports.m2mNotifications = { v1 };
@@ -0,0 +1,50 @@
1
+ /**
2
+ * A function that returns the URL part common to the endpoints.
3
+ */
4
+ export declare const root: () => string;
5
+ /**
6
+ * health check
7
+ *
8
+ */
9
+ export declare const healthCheck: () => string;
10
+ /**
11
+ * 通知を登録する
12
+ *
13
+ */
14
+ export declare const registerNotification: () => string;
15
+ /**
16
+ * 自分宛の通知をserviceIdを使って取得する
17
+ *
18
+ */
19
+ export declare const findNotificationsByServiceId: ({ id }: {
20
+ id: string;
21
+ }) => string;
22
+ /**
23
+ * 通知のステータスを更新する
24
+ *
25
+ */
26
+ export declare const updateNotificationStatus: ({ id }: {
27
+ id: string;
28
+ }) => string;
29
+ /**
30
+ * 通知の購読を更新する
31
+ *
32
+ */
33
+ export declare const saveSubscription: () => string;
34
+ /**
35
+ * 自分の購読している通知を取得する
36
+ *
37
+ */
38
+ export declare const findMySubscriptions: () => string;
39
+ export declare const m2mNotifications_v1: {
40
+ healthCheck: () => string;
41
+ registerNotification: () => string;
42
+ findNotificationsByServiceId: ({ id }: {
43
+ id: string;
44
+ }) => string;
45
+ updateNotificationStatus: ({ id }: {
46
+ id: string;
47
+ }) => string;
48
+ saveSubscription: () => string;
49
+ findMySubscriptions: () => string;
50
+ };
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.m2mNotifications_v1 = exports.findMySubscriptions = exports.saveSubscription = exports.updateNotificationStatus = exports.findNotificationsByServiceId = exports.registerNotification = 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 = "";
12
+ }
13
+ if (process.env.NODE_ENV === "localDev") {
14
+ __root = "";
15
+ }
16
+ if (process.env.NODE_ENV === "development") {
17
+ __root = "https://api-notifications.dev.m2msystems.cloud";
18
+ }
19
+ if (process.env.NODE_ENV === "production") {
20
+ __root = "https://api-notifications.m2msystems.cloud";
21
+ }
22
+ return __root;
23
+ };
24
+ /**
25
+ * health check
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.registerNotification = () => {
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}/${`notifications`}`;
56
+ return __queries ? `${__path}?${__queries}` : __path;
57
+ };
58
+ /**
59
+ * 自分宛の通知をserviceIdを使って取得する
60
+ *
61
+ */
62
+ exports.findNotificationsByServiceId = ({ 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}/${`notifications/by_service_id/${id}`}`;
73
+ return __queries ? `${__path}?${__queries}` : __path;
74
+ };
75
+ /**
76
+ * 通知のステータスを更新する
77
+ *
78
+ */
79
+ exports.updateNotificationStatus = ({ id }) => {
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}/${`notifications/${id}`}`;
90
+ return __queries ? `${__path}?${__queries}` : __path;
91
+ };
92
+ /**
93
+ * 通知の購読を更新する
94
+ *
95
+ */
96
+ exports.saveSubscription = () => {
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}/${`subscriptions`}`;
107
+ return __queries ? `${__path}?${__queries}` : __path;
108
+ };
109
+ /**
110
+ * 自分の購読している通知を取得する
111
+ *
112
+ */
113
+ exports.findMySubscriptions = () => {
114
+ const __root = exports.root();
115
+ const __queries = Object.entries({})
116
+ .filter(([_, value]) => {
117
+ return value !== undefined;
118
+ })
119
+ .map(([key, value]) => {
120
+ return `${key}=${value}`;
121
+ })
122
+ .join("&");
123
+ const __path = `${__root}/${`subscriptions`}`;
124
+ return __queries ? `${__path}?${__queries}` : __path;
125
+ };
126
+ exports.m2mNotifications_v1 = {
127
+ healthCheck: exports.healthCheck,
128
+ registerNotification: exports.registerNotification,
129
+ findNotificationsByServiceId: exports.findNotificationsByServiceId,
130
+ updateNotificationStatus: exports.updateNotificationStatus,
131
+ saveSubscription: exports.saveSubscription,
132
+ findMySubscriptions: exports.findMySubscriptions,
133
+ };
@@ -0,0 +1,4 @@
1
+ import * as v1 from "./m2m-users.v1";
2
+ export declare const m2mUsers: {
3
+ v1: typeof v1;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.m2mUsers = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable */
6
+ const v1 = tslib_1.__importStar(require("./m2m-users.v1"));
7
+ exports.m2mUsers = { v1 };
@@ -0,0 +1,210 @@
1
+ /**
2
+ * A function that returns the URL part common to the endpoints.
3
+ */
4
+ export declare const root: () => string;
5
+ /**
6
+ * ヘルスチェック
7
+ *
8
+ */
9
+ export declare const healthCheck: () => string;
10
+ /**
11
+ * 会社を作成する
12
+ *
13
+ */
14
+ export declare const createCompany: () => string;
15
+ /**
16
+ * 会社情報を取得する
17
+ *
18
+ */
19
+ export declare const getCompany: ({ id }: {
20
+ id: string;
21
+ }) => string;
22
+ /**
23
+ * 会社情報を更新する
24
+ *
25
+ */
26
+ export declare const updateCompany: () => string;
27
+ /**
28
+ * 会社情報を更新する
29
+ *
30
+ */
31
+ export declare const updateCompanyPatch: () => string;
32
+ /**
33
+ * idを指定して複数の会社情報を取得する
34
+ * @param {string} company_ids a,b,c
35
+ */
36
+ export declare const findCompaniesByIds: ({ company_ids, }: {
37
+ company_ids?: string | undefined;
38
+ }) => string;
39
+ /**
40
+ * ユーザーを作成する
41
+ *
42
+ */
43
+ export declare const createUser: () => string;
44
+ /**
45
+ * ユーザーを取得する
46
+ *
47
+ */
48
+ export declare const findUserById: ({ id }: {
49
+ id: string;
50
+ }) => string;
51
+ /**
52
+ * ユーザーを更新する
53
+ *
54
+ */
55
+ export declare const updateUser: ({ id }: {
56
+ id: string;
57
+ }) => string;
58
+ /**
59
+ * ユーザーを更新する
60
+ *
61
+ */
62
+ export declare const updateUserPatch: ({ id }: {
63
+ id: string;
64
+ }) => string;
65
+ /**
66
+ * ユーザーを強制的に有効化する
67
+ *
68
+ */
69
+ export declare const activateUserByAdmin: ({ id }: {
70
+ id: string;
71
+ }) => string;
72
+ /**
73
+ * ユーザーを無効化する
74
+ *
75
+ */
76
+ export declare const deactivateUser: ({ id }: {
77
+ id: string;
78
+ }) => string;
79
+ /**
80
+ * パスワードリセットのメールを送信する
81
+ *
82
+ */
83
+ export declare const sendResetPasswordEmail: () => string;
84
+ /**
85
+ * パスワードをリセットする
86
+ *
87
+ */
88
+ export declare const resetPassword: () => string;
89
+ /**
90
+ * アクティベーションメールを送信する
91
+ *
92
+ */
93
+ export declare const sendActivationEmail: () => string;
94
+ /**
95
+ * ユーザーを有効化する
96
+ *
97
+ */
98
+ export declare const activateUser: () => string;
99
+ /**
100
+ * 認可スコープを設定する
101
+ *
102
+ */
103
+ export declare const setAuthorityScope: () => string;
104
+ /**
105
+ * メールを指定してユーザーを取得する
106
+ *
107
+ */
108
+ export declare const findUserByEmail: () => string;
109
+ /**
110
+ * ユーザーの権限を更新する
111
+ *
112
+ */
113
+ export declare const updateAuthority: ({ id }: {
114
+ id: string;
115
+ }) => string;
116
+ /**
117
+ * companyIdからユーザーを取得する
118
+ * @param {string} statuses BeforeVerification,Active,Deactivated
119
+ */
120
+ export declare const findUsersByCompanyId: ({ statuses }: {
121
+ statuses?: string | undefined;
122
+ }) => string;
123
+ /**
124
+ * ログインする
125
+ *
126
+ */
127
+ export declare const login: () => string;
128
+ /**
129
+ * ログインする
130
+ *
131
+ */
132
+ export declare const loginWithSlash: () => string;
133
+ /**
134
+ * JWKを取得する
135
+ *
136
+ */
137
+ export declare const getJwks: () => string;
138
+ /**
139
+ * 公開鍵を取得する
140
+ *
141
+ */
142
+ export declare const getPublicKeys: () => string;
143
+ /**
144
+ * MFAのコードを発行する
145
+ *
146
+ */
147
+ export declare const publishMFACode: () => string;
148
+ /**
149
+ * MFAを使ってログインする
150
+ *
151
+ */
152
+ export declare const loginWithMFA: () => string;
153
+ /**
154
+ * usersに存在しないアカウントのトークンを作成する(deprecated)
155
+ *
156
+ */
157
+ export declare const generateToken: () => string;
158
+ /**
159
+ * usersに存在しないアカウントのトークンを作成する
160
+ *
161
+ */
162
+ export declare const generateUserToken: () => string;
163
+ export declare const m2mUsers_v1: {
164
+ healthCheck: () => string;
165
+ createCompany: () => string;
166
+ getCompany: ({ id }: {
167
+ id: string;
168
+ }) => string;
169
+ updateCompany: () => string;
170
+ updateCompanyPatch: () => string;
171
+ findCompaniesByIds: ({ company_ids, }: {
172
+ company_ids?: string | undefined;
173
+ }) => string;
174
+ createUser: () => string;
175
+ findUserById: ({ id }: {
176
+ id: string;
177
+ }) => string;
178
+ updateUser: ({ id }: {
179
+ id: string;
180
+ }) => string;
181
+ updateUserPatch: ({ id }: {
182
+ id: string;
183
+ }) => string;
184
+ activateUserByAdmin: ({ id }: {
185
+ id: string;
186
+ }) => string;
187
+ deactivateUser: ({ id }: {
188
+ id: string;
189
+ }) => string;
190
+ sendResetPasswordEmail: () => string;
191
+ resetPassword: () => string;
192
+ sendActivationEmail: () => string;
193
+ activateUser: () => string;
194
+ setAuthorityScope: () => string;
195
+ findUserByEmail: () => string;
196
+ updateAuthority: ({ id }: {
197
+ id: string;
198
+ }) => string;
199
+ findUsersByCompanyId: ({ statuses }: {
200
+ statuses?: string | undefined;
201
+ }) => string;
202
+ login: () => string;
203
+ loginWithSlash: () => string;
204
+ getJwks: () => string;
205
+ getPublicKeys: () => string;
206
+ publishMFACode: () => string;
207
+ loginWithMFA: () => string;
208
+ generateToken: () => string;
209
+ generateUserToken: () => string;
210
+ };
@@ -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
+ };
@@ -1 +1 @@
1
- {"version":"2.1.3","commands":{"add":{"id":"add","description":"\nadd service to dependencies & make endpoints files.\n\n1. make endpoints.config.json for version control.\n\n{\n \"dependencies\": {\n \"service-name\": {\n \"version\": \"26177ed7e673daf0cc5a69e9793dd863424d272f\",\n \"repository\": \"git@github.com:[username/repository].git\"\n }\n }\n}\n\n> service name is inferred from Repository name.\n\n2. make src/endpoints/[service-name].ts\n","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"examples":["$ mes add [username/repository]","$ mes add [username/repository] --version [commmit hash]","$ mes add [username/repository] -v [commmit hash]","$ mes add [username/repository] -v latest","$ mes add [username/repository] --workspace [workspace directory]","$ mes add [username/repository] -w [workspace directory]","$ mes add /Users/.../local-repository/","$ mes add ./local-repository","$ mes add git@github.com:[username/repository].git","$ mes add https://github.com/[username/repository].git"],"flags":{"version":{"name":"version","type":"option","char":"v","description":"latest or commit hash"},"workspace":{"name":"workspace","type":"option","char":"w","description":"a path to workspace containing .endpoints.json"}},"args":[{"name":"repository"}]},"install":{"id":"install","description":"generate endpoints files based on endpoints.config.json","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"update":{"id":"update","description":"update service version & regenerate endpoints files","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"service"}]}}}
1
+ {"version":"2.2.0","commands":{"add":{"id":"add","description":"\nadd service to dependencies & make endpoints files.\n\n1. make endpoints.config.json for version control.\n\n{\n \"dependencies\": {\n \"service-name\": {\n \"version\": \"26177ed7e673daf0cc5a69e9793dd863424d272f\",\n \"repository\": \"git@github.com:[username/repository].git\"\n }\n }\n}\n\n> service name is inferred from Repository name.\n\n2. make src/endpoints/[service-name].ts\n","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"examples":["$ mes add [username/repository]","$ mes add [username/repository] --version [commmit hash]","$ mes add [username/repository] -v [commmit hash]","$ mes add [username/repository] -v latest","$ mes add [username/repository] --workspace [workspace directory]","$ mes add [username/repository] -w [workspace directory]","$ mes add /Users/.../local-repository/","$ mes add ./local-repository","$ mes add git@github.com:[username/repository].git","$ mes add https://github.com/[username/repository].git"],"flags":{"version":{"name":"version","type":"option","char":"v","description":"latest or commit hash"},"workspace":{"name":"workspace","type":"option","char":"w","description":"a path to workspace containing .endpoints.json"}},"args":[{"name":"repository"}]},"install":{"id":"install","description":"generate endpoints files based on endpoints.config.json","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"update":{"id":"update","description":"update service version & regenerate endpoints files","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"service"}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "endpoints-sdk-cli",
3
3
  "description": "endpoints sdk cli",
4
- "version": "2.1.3",
4
+ "version": "2.2.0",
5
5
  "author": "hrdtbs",
6
6
  "bin": {
7
7
  "mes": "./bin/run"