@constructive-sdk/cli 1.9.1 → 1.9.3
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/{api/cli/commands/platform-api-module.d.ts → admin/cli/commands/org-chart-edge-grant.d.ts} +1 -1
- package/{api/cli/commands/platform-api-module.js → admin/cli/commands/org-chart-edge-grant.js} +137 -53
- package/{esm/api/cli/commands/platform-api-module.d.ts → admin/cli/commands/org-chart-edge.d.ts} +1 -1
- package/{api/cli/commands/api-module.js → admin/cli/commands/org-chart-edge.js} +86 -60
- package/admin/cli/commands/org-get-managers-record.d.ts +8 -0
- package/admin/cli/commands/org-get-managers-record.js +126 -0
- package/admin/cli/commands/org-get-subordinates-record.d.ts +8 -0
- package/admin/cli/commands/org-get-subordinates-record.js +126 -0
- package/admin/cli/commands/org-is-manager-of.d.ts +8 -0
- package/admin/cli/commands/org-is-manager-of.js +45 -0
- package/admin/cli/commands.js +11 -1
- package/admin/cli/executor.d.ts +9 -0
- package/admin/orm/index.d.ts +13 -0
- package/admin/orm/index.js +8 -0
- package/admin/orm/input-types.d.ts +399 -0
- package/admin/orm/models/index.d.ts +4 -0
- package/admin/orm/models/index.js +9 -1
- package/admin/orm/models/orgChartEdge.d.ts +54 -0
- package/admin/orm/models/orgChartEdge.js +104 -0
- package/admin/orm/models/orgChartEdgeGrant.d.ts +54 -0
- package/{api/orm/models/platformApiModule.js → admin/orm/models/orgChartEdgeGrant.js} +27 -27
- package/admin/orm/models/orgGetManagersRecord.d.ts +30 -0
- package/admin/orm/models/orgGetManagersRecord.js +59 -0
- package/admin/orm/models/orgGetSubordinatesRecord.d.ts +30 -0
- package/admin/orm/models/orgGetSubordinatesRecord.js +59 -0
- package/admin/orm/query/index.d.ts +11 -0
- package/admin/orm/query/index.js +24 -0
- package/api/cli/commands/{api-module.d.ts → domain-type.d.ts} +1 -1
- package/api/cli/commands/domain-type.js +466 -0
- package/api/cli/commands/table.js +22 -0
- package/api/cli/commands.js +3 -5
- package/api/cli/executor.d.ts +1 -2
- package/api/orm/index.d.ts +2 -4
- package/api/orm/index.js +2 -4
- package/api/orm/input-types.d.ts +378 -468
- package/api/orm/input-types.js +2 -2
- package/api/orm/models/domainType.d.ts +54 -0
- package/api/orm/models/{apiModule.js → domainType.js} +27 -27
- package/api/orm/models/index.d.ts +1 -2
- package/api/orm/models/index.js +4 -6
- package/compute/cli/commands/function-api-binding.js +12 -0
- package/compute/cli/commands/platform-function-api-binding.js +12 -0
- package/compute/cli/commands/platform-function-invocation.js +22 -0
- package/compute/orm/input-types.d.ts +42 -3
- package/esm/admin/cli/commands/org-chart-edge-grant.d.ts +8 -0
- package/esm/{api/cli/commands/platform-api-module.js → admin/cli/commands/org-chart-edge-grant.js} +137 -53
- package/esm/admin/cli/commands/org-chart-edge.d.ts +8 -0
- package/esm/{api/cli/commands/api-module.js → admin/cli/commands/org-chart-edge.js} +86 -60
- package/esm/admin/cli/commands/org-get-managers-record.d.ts +8 -0
- package/esm/admin/cli/commands/org-get-managers-record.js +124 -0
- package/esm/admin/cli/commands/org-get-subordinates-record.d.ts +8 -0
- package/esm/admin/cli/commands/org-get-subordinates-record.js +124 -0
- package/esm/admin/cli/commands/org-is-manager-of.d.ts +8 -0
- package/esm/admin/cli/commands/org-is-manager-of.js +43 -0
- package/esm/admin/cli/commands.js +11 -1
- package/esm/admin/cli/executor.d.ts +9 -0
- package/esm/admin/orm/index.d.ts +13 -0
- package/esm/admin/orm/index.js +8 -0
- package/esm/admin/orm/input-types.d.ts +399 -0
- package/esm/admin/orm/models/index.d.ts +4 -0
- package/esm/admin/orm/models/index.js +4 -0
- package/esm/admin/orm/models/orgChartEdge.d.ts +54 -0
- package/esm/admin/orm/models/orgChartEdge.js +100 -0
- package/esm/admin/orm/models/orgChartEdgeGrant.d.ts +54 -0
- package/esm/{api/orm/models/platformApiModule.js → admin/orm/models/orgChartEdgeGrant.js} +25 -25
- package/esm/admin/orm/models/orgGetManagersRecord.d.ts +30 -0
- package/esm/admin/orm/models/orgGetManagersRecord.js +55 -0
- package/esm/admin/orm/models/orgGetSubordinatesRecord.d.ts +30 -0
- package/esm/admin/orm/models/orgGetSubordinatesRecord.js +55 -0
- package/esm/admin/orm/query/index.d.ts +11 -0
- package/esm/admin/orm/query/index.js +24 -0
- package/esm/api/cli/commands/{api-module.d.ts → domain-type.d.ts} +1 -1
- package/esm/api/cli/commands/domain-type.js +464 -0
- package/esm/api/cli/commands/table.js +22 -0
- package/esm/api/cli/commands.js +3 -5
- package/esm/api/cli/executor.d.ts +1 -2
- package/esm/api/orm/index.d.ts +2 -4
- package/esm/api/orm/index.js +2 -4
- package/esm/api/orm/input-types.d.ts +378 -468
- package/esm/api/orm/input-types.js +2 -2
- package/esm/api/orm/models/domainType.d.ts +54 -0
- package/esm/api/orm/models/{apiModule.js → domainType.js} +25 -25
- package/esm/api/orm/models/index.d.ts +1 -2
- package/esm/api/orm/models/index.js +1 -2
- package/esm/compute/cli/commands/function-api-binding.js +12 -0
- package/esm/compute/cli/commands/platform-function-api-binding.js +12 -0
- package/esm/compute/cli/commands/platform-function-invocation.js +22 -0
- package/esm/compute/orm/input-types.d.ts +42 -3
- package/esm/modules/cli/commands/api-surface-module.js +0 -44
- package/esm/modules/cli/commands/billing-module.js +22 -0
- package/esm/modules/orm/input-types.d.ts +9 -16
- package/modules/cli/commands/api-surface-module.js +0 -44
- package/modules/cli/commands/billing-module.js +22 -0
- package/modules/orm/input-types.d.ts +9 -16
- package/package.json +5 -5
- package/api/orm/models/apiModule.d.ts +0 -54
- package/api/orm/models/platformApiModule.d.ts +0 -54
- package/esm/api/orm/models/apiModule.d.ts +0 -54
- package/esm/api/orm/models/platformApiModule.d.ts +0 -54
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CLI commands for
|
|
2
|
+
* CLI commands for OrgChartEdge
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
@@ -7,15 +7,16 @@ import { extractFirst } from 'inquirerer';
|
|
|
7
7
|
import { getClient } from '../executor';
|
|
8
8
|
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
9
|
const fieldSchema = {
|
|
10
|
-
|
|
10
|
+
childId: 'uuid',
|
|
11
11
|
createdAt: 'string',
|
|
12
|
-
|
|
13
|
-
databaseId: 'uuid',
|
|
12
|
+
entityId: 'uuid',
|
|
14
13
|
id: 'uuid',
|
|
15
|
-
|
|
14
|
+
parentId: 'uuid',
|
|
15
|
+
positionLevel: 'int',
|
|
16
|
+
positionTitle: 'string',
|
|
16
17
|
updatedAt: 'string',
|
|
17
18
|
};
|
|
18
|
-
const usage = '\
|
|
19
|
+
const usage = '\norg-chart-edge <command>\n\nCommands:\n list List orgChartEdge records\n find-first Find first matching orgChartEdge record\n get Get a orgChartEdge by ID\n create Create a new orgChartEdge\n update Update an existing orgChartEdge\n delete Delete a orgChartEdge\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\n --help, -h Show this help message\n';
|
|
19
20
|
export default async (argv, prompter, _options) => {
|
|
20
21
|
if (argv.help || argv.h) {
|
|
21
22
|
console.log(usage);
|
|
@@ -57,17 +58,18 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
57
58
|
async function handleList(argv, _prompter) {
|
|
58
59
|
try {
|
|
59
60
|
const defaultSelect = {
|
|
60
|
-
|
|
61
|
+
childId: true,
|
|
61
62
|
createdAt: true,
|
|
62
|
-
|
|
63
|
-
databaseId: true,
|
|
63
|
+
entityId: true,
|
|
64
64
|
id: true,
|
|
65
|
-
|
|
65
|
+
parentId: true,
|
|
66
|
+
positionLevel: true,
|
|
67
|
+
positionTitle: true,
|
|
66
68
|
updatedAt: true,
|
|
67
69
|
};
|
|
68
70
|
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
69
71
|
const client = getClient();
|
|
70
|
-
const result = await client.
|
|
72
|
+
const result = await client.orgChartEdge.findMany(findManyArgs).execute();
|
|
71
73
|
console.log(JSON.stringify(result, null, 2));
|
|
72
74
|
}
|
|
73
75
|
catch (error) {
|
|
@@ -81,17 +83,18 @@ async function handleList(argv, _prompter) {
|
|
|
81
83
|
async function handleFindFirst(argv, _prompter) {
|
|
82
84
|
try {
|
|
83
85
|
const defaultSelect = {
|
|
84
|
-
|
|
86
|
+
childId: true,
|
|
85
87
|
createdAt: true,
|
|
86
|
-
|
|
87
|
-
databaseId: true,
|
|
88
|
+
entityId: true,
|
|
88
89
|
id: true,
|
|
89
|
-
|
|
90
|
+
parentId: true,
|
|
91
|
+
positionLevel: true,
|
|
92
|
+
positionTitle: true,
|
|
90
93
|
updatedAt: true,
|
|
91
94
|
};
|
|
92
95
|
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
93
96
|
const client = getClient();
|
|
94
|
-
const result = await client.
|
|
97
|
+
const result = await client.orgChartEdge.findFirst(findFirstArgs).execute();
|
|
95
98
|
console.log(JSON.stringify(result, null, 2));
|
|
96
99
|
}
|
|
97
100
|
catch (error) {
|
|
@@ -113,16 +116,17 @@ async function handleGet(argv, prompter) {
|
|
|
113
116
|
},
|
|
114
117
|
]);
|
|
115
118
|
const client = getClient();
|
|
116
|
-
const result = await client.
|
|
119
|
+
const result = await client.orgChartEdge
|
|
117
120
|
.findOne({
|
|
118
121
|
id: answers.id,
|
|
119
122
|
select: {
|
|
120
|
-
|
|
123
|
+
childId: true,
|
|
121
124
|
createdAt: true,
|
|
122
|
-
|
|
123
|
-
databaseId: true,
|
|
125
|
+
entityId: true,
|
|
124
126
|
id: true,
|
|
125
|
-
|
|
127
|
+
parentId: true,
|
|
128
|
+
positionLevel: true,
|
|
129
|
+
positionTitle: true,
|
|
126
130
|
updatedAt: true,
|
|
127
131
|
},
|
|
128
132
|
})
|
|
@@ -142,47 +146,58 @@ async function handleCreate(argv, prompter) {
|
|
|
142
146
|
const rawAnswers = await prompter.prompt(argv, [
|
|
143
147
|
{
|
|
144
148
|
type: 'text',
|
|
145
|
-
name: '
|
|
146
|
-
message: '
|
|
149
|
+
name: 'childId',
|
|
150
|
+
message: 'childId',
|
|
147
151
|
required: true,
|
|
148
152
|
},
|
|
149
153
|
{
|
|
150
|
-
type: '
|
|
151
|
-
name: '
|
|
152
|
-
message: '
|
|
154
|
+
type: 'text',
|
|
155
|
+
name: 'entityId',
|
|
156
|
+
message: 'entityId',
|
|
153
157
|
required: true,
|
|
154
158
|
},
|
|
155
159
|
{
|
|
156
160
|
type: 'text',
|
|
157
|
-
name: '
|
|
158
|
-
message: '
|
|
159
|
-
required:
|
|
161
|
+
name: 'parentId',
|
|
162
|
+
message: 'parentId',
|
|
163
|
+
required: false,
|
|
164
|
+
skipPrompt: true,
|
|
160
165
|
},
|
|
161
166
|
{
|
|
162
167
|
type: 'text',
|
|
163
|
-
name: '
|
|
164
|
-
message: '
|
|
165
|
-
required:
|
|
168
|
+
name: 'positionLevel',
|
|
169
|
+
message: 'positionLevel',
|
|
170
|
+
required: false,
|
|
171
|
+
skipPrompt: true,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'text',
|
|
175
|
+
name: 'positionTitle',
|
|
176
|
+
message: 'positionTitle',
|
|
177
|
+
required: false,
|
|
178
|
+
skipPrompt: true,
|
|
166
179
|
},
|
|
167
180
|
]);
|
|
168
181
|
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
169
182
|
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
170
183
|
const client = getClient();
|
|
171
|
-
const result = await client.
|
|
184
|
+
const result = await client.orgChartEdge
|
|
172
185
|
.create({
|
|
173
186
|
data: {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
childId: cleanedData.childId,
|
|
188
|
+
entityId: cleanedData.entityId,
|
|
189
|
+
parentId: cleanedData.parentId,
|
|
190
|
+
positionLevel: cleanedData.positionLevel,
|
|
191
|
+
positionTitle: cleanedData.positionTitle,
|
|
178
192
|
},
|
|
179
193
|
select: {
|
|
180
|
-
|
|
194
|
+
childId: true,
|
|
181
195
|
createdAt: true,
|
|
182
|
-
|
|
183
|
-
databaseId: true,
|
|
196
|
+
entityId: true,
|
|
184
197
|
id: true,
|
|
185
|
-
|
|
198
|
+
parentId: true,
|
|
199
|
+
positionLevel: true,
|
|
200
|
+
positionTitle: true,
|
|
186
201
|
updatedAt: true,
|
|
187
202
|
},
|
|
188
203
|
})
|
|
@@ -208,50 +223,61 @@ async function handleUpdate(argv, prompter) {
|
|
|
208
223
|
},
|
|
209
224
|
{
|
|
210
225
|
type: 'text',
|
|
211
|
-
name: '
|
|
212
|
-
message: '
|
|
226
|
+
name: 'childId',
|
|
227
|
+
message: 'childId',
|
|
213
228
|
required: false,
|
|
214
229
|
},
|
|
215
230
|
{
|
|
216
|
-
type: '
|
|
217
|
-
name: '
|
|
218
|
-
message: '
|
|
231
|
+
type: 'text',
|
|
232
|
+
name: 'entityId',
|
|
233
|
+
message: 'entityId',
|
|
234
|
+
required: false,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: 'text',
|
|
238
|
+
name: 'parentId',
|
|
239
|
+
message: 'parentId',
|
|
219
240
|
required: false,
|
|
241
|
+
skipPrompt: true,
|
|
220
242
|
},
|
|
221
243
|
{
|
|
222
244
|
type: 'text',
|
|
223
|
-
name: '
|
|
224
|
-
message: '
|
|
245
|
+
name: 'positionLevel',
|
|
246
|
+
message: 'positionLevel',
|
|
225
247
|
required: false,
|
|
248
|
+
skipPrompt: true,
|
|
226
249
|
},
|
|
227
250
|
{
|
|
228
251
|
type: 'text',
|
|
229
|
-
name: '
|
|
230
|
-
message: '
|
|
252
|
+
name: 'positionTitle',
|
|
253
|
+
message: 'positionTitle',
|
|
231
254
|
required: false,
|
|
255
|
+
skipPrompt: true,
|
|
232
256
|
},
|
|
233
257
|
]);
|
|
234
258
|
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
235
259
|
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
236
260
|
const client = getClient();
|
|
237
|
-
const result = await client.
|
|
261
|
+
const result = await client.orgChartEdge
|
|
238
262
|
.update({
|
|
239
263
|
where: {
|
|
240
264
|
id: answers.id,
|
|
241
265
|
},
|
|
242
266
|
data: {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
267
|
+
childId: cleanedData.childId,
|
|
268
|
+
entityId: cleanedData.entityId,
|
|
269
|
+
parentId: cleanedData.parentId,
|
|
270
|
+
positionLevel: cleanedData.positionLevel,
|
|
271
|
+
positionTitle: cleanedData.positionTitle,
|
|
247
272
|
},
|
|
248
273
|
select: {
|
|
249
|
-
|
|
274
|
+
childId: true,
|
|
250
275
|
createdAt: true,
|
|
251
|
-
|
|
252
|
-
databaseId: true,
|
|
276
|
+
entityId: true,
|
|
253
277
|
id: true,
|
|
254
|
-
|
|
278
|
+
parentId: true,
|
|
279
|
+
positionLevel: true,
|
|
280
|
+
positionTitle: true,
|
|
255
281
|
updatedAt: true,
|
|
256
282
|
},
|
|
257
283
|
})
|
|
@@ -278,7 +304,7 @@ async function handleDelete(argv, prompter) {
|
|
|
278
304
|
]);
|
|
279
305
|
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
280
306
|
const client = getClient();
|
|
281
|
-
const result = await client.
|
|
307
|
+
const result = await client.orgChartEdge
|
|
282
308
|
.delete({
|
|
283
309
|
where: {
|
|
284
310
|
id: answers.id,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for OrgGetManagersRecord
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
7
|
+
declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for OrgGetManagersRecord
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { extractFirst } from 'inquirerer';
|
|
7
|
+
import { getClient } from '../executor';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
|
+
const fieldSchema = {
|
|
10
|
+
depth: 'int',
|
|
11
|
+
userId: 'uuid',
|
|
12
|
+
};
|
|
13
|
+
const usage = '\norg-get-managers-record <command>\n\nCommands:\n list List orgGetManagersRecord records\n find-first Find first matching orgGetManagersRecord record\n create Create a new orgGetManagersRecord\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\n --help, -h Show this help message\n';
|
|
14
|
+
export default async (argv, prompter, _options) => {
|
|
15
|
+
if (argv.help || argv.h) {
|
|
16
|
+
console.log(usage);
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
const { first: subcommand, newArgv } = extractFirst(argv);
|
|
20
|
+
if (!subcommand) {
|
|
21
|
+
const answer = await prompter.prompt(argv, [
|
|
22
|
+
{
|
|
23
|
+
type: 'autocomplete',
|
|
24
|
+
name: 'subcommand',
|
|
25
|
+
message: 'What do you want to do?',
|
|
26
|
+
options: ['list', 'find-first', 'create'],
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
30
|
+
}
|
|
31
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
32
|
+
};
|
|
33
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
34
|
+
switch (subcommand) {
|
|
35
|
+
case 'list':
|
|
36
|
+
return handleList(argv, prompter);
|
|
37
|
+
case 'find-first':
|
|
38
|
+
return handleFindFirst(argv, prompter);
|
|
39
|
+
case 'create':
|
|
40
|
+
return handleCreate(argv, prompter);
|
|
41
|
+
default:
|
|
42
|
+
console.log(usage);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function handleList(argv, _prompter) {
|
|
47
|
+
try {
|
|
48
|
+
const defaultSelect = {
|
|
49
|
+
depth: true,
|
|
50
|
+
userId: true,
|
|
51
|
+
};
|
|
52
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
53
|
+
const client = getClient();
|
|
54
|
+
const result = await client.orgGetManagersRecord.findMany(findManyArgs).execute();
|
|
55
|
+
console.log(JSON.stringify(result, null, 2));
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error('Failed to list records.');
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
console.error(error.message);
|
|
61
|
+
}
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function handleFindFirst(argv, _prompter) {
|
|
66
|
+
try {
|
|
67
|
+
const defaultSelect = {
|
|
68
|
+
depth: true,
|
|
69
|
+
userId: true,
|
|
70
|
+
};
|
|
71
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
72
|
+
const client = getClient();
|
|
73
|
+
const result = await client.orgGetManagersRecord.findFirst(findFirstArgs).execute();
|
|
74
|
+
console.log(JSON.stringify(result, null, 2));
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error('Failed to find record.');
|
|
78
|
+
if (error instanceof Error) {
|
|
79
|
+
console.error(error.message);
|
|
80
|
+
}
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function handleCreate(argv, prompter) {
|
|
85
|
+
try {
|
|
86
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
87
|
+
{
|
|
88
|
+
type: 'text',
|
|
89
|
+
name: 'depth',
|
|
90
|
+
message: 'depth',
|
|
91
|
+
required: true,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
name: 'userId',
|
|
96
|
+
message: 'userId',
|
|
97
|
+
required: true,
|
|
98
|
+
},
|
|
99
|
+
]);
|
|
100
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
101
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
102
|
+
const client = getClient();
|
|
103
|
+
const result = await client.orgGetManagersRecord
|
|
104
|
+
.create({
|
|
105
|
+
data: {
|
|
106
|
+
depth: cleanedData.depth,
|
|
107
|
+
userId: cleanedData.userId,
|
|
108
|
+
},
|
|
109
|
+
select: {
|
|
110
|
+
depth: true,
|
|
111
|
+
userId: true,
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
.execute();
|
|
115
|
+
console.log(JSON.stringify(result, null, 2));
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error('Failed to create record.');
|
|
119
|
+
if (error instanceof Error) {
|
|
120
|
+
console.error(error.message);
|
|
121
|
+
}
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for OrgGetSubordinatesRecord
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
7
|
+
declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for OrgGetSubordinatesRecord
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { extractFirst } from 'inquirerer';
|
|
7
|
+
import { getClient } from '../executor';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
|
+
const fieldSchema = {
|
|
10
|
+
depth: 'int',
|
|
11
|
+
userId: 'uuid',
|
|
12
|
+
};
|
|
13
|
+
const usage = '\norg-get-subordinates-record <command>\n\nCommands:\n list List orgGetSubordinatesRecord records\n find-first Find first matching orgGetSubordinatesRecord record\n create Create a new orgGetSubordinatesRecord\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\n --help, -h Show this help message\n';
|
|
14
|
+
export default async (argv, prompter, _options) => {
|
|
15
|
+
if (argv.help || argv.h) {
|
|
16
|
+
console.log(usage);
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
const { first: subcommand, newArgv } = extractFirst(argv);
|
|
20
|
+
if (!subcommand) {
|
|
21
|
+
const answer = await prompter.prompt(argv, [
|
|
22
|
+
{
|
|
23
|
+
type: 'autocomplete',
|
|
24
|
+
name: 'subcommand',
|
|
25
|
+
message: 'What do you want to do?',
|
|
26
|
+
options: ['list', 'find-first', 'create'],
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
30
|
+
}
|
|
31
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
32
|
+
};
|
|
33
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
34
|
+
switch (subcommand) {
|
|
35
|
+
case 'list':
|
|
36
|
+
return handleList(argv, prompter);
|
|
37
|
+
case 'find-first':
|
|
38
|
+
return handleFindFirst(argv, prompter);
|
|
39
|
+
case 'create':
|
|
40
|
+
return handleCreate(argv, prompter);
|
|
41
|
+
default:
|
|
42
|
+
console.log(usage);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function handleList(argv, _prompter) {
|
|
47
|
+
try {
|
|
48
|
+
const defaultSelect = {
|
|
49
|
+
depth: true,
|
|
50
|
+
userId: true,
|
|
51
|
+
};
|
|
52
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
53
|
+
const client = getClient();
|
|
54
|
+
const result = await client.orgGetSubordinatesRecord.findMany(findManyArgs).execute();
|
|
55
|
+
console.log(JSON.stringify(result, null, 2));
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error('Failed to list records.');
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
console.error(error.message);
|
|
61
|
+
}
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function handleFindFirst(argv, _prompter) {
|
|
66
|
+
try {
|
|
67
|
+
const defaultSelect = {
|
|
68
|
+
depth: true,
|
|
69
|
+
userId: true,
|
|
70
|
+
};
|
|
71
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
72
|
+
const client = getClient();
|
|
73
|
+
const result = await client.orgGetSubordinatesRecord.findFirst(findFirstArgs).execute();
|
|
74
|
+
console.log(JSON.stringify(result, null, 2));
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error('Failed to find record.');
|
|
78
|
+
if (error instanceof Error) {
|
|
79
|
+
console.error(error.message);
|
|
80
|
+
}
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function handleCreate(argv, prompter) {
|
|
85
|
+
try {
|
|
86
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
87
|
+
{
|
|
88
|
+
type: 'text',
|
|
89
|
+
name: 'depth',
|
|
90
|
+
message: 'depth',
|
|
91
|
+
required: true,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
name: 'userId',
|
|
96
|
+
message: 'userId',
|
|
97
|
+
required: true,
|
|
98
|
+
},
|
|
99
|
+
]);
|
|
100
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
101
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
102
|
+
const client = getClient();
|
|
103
|
+
const result = await client.orgGetSubordinatesRecord
|
|
104
|
+
.create({
|
|
105
|
+
data: {
|
|
106
|
+
depth: cleanedData.depth,
|
|
107
|
+
userId: cleanedData.userId,
|
|
108
|
+
},
|
|
109
|
+
select: {
|
|
110
|
+
depth: true,
|
|
111
|
+
userId: true,
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
.execute();
|
|
115
|
+
console.log(JSON.stringify(result, null, 2));
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error('Failed to create record.');
|
|
119
|
+
if (error instanceof Error) {
|
|
120
|
+
console.error(error.message);
|
|
121
|
+
}
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for query orgIsManagerOf
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
7
|
+
declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getClient } from '../executor';
|
|
2
|
+
export default async (argv, prompter, _options) => {
|
|
3
|
+
try {
|
|
4
|
+
if (argv.help || argv.h) {
|
|
5
|
+
console.log('org-is-manager-of - orgIsManagerOf\n\nUsage: org-is-manager-of [OPTIONS]\n');
|
|
6
|
+
process.exit(0);
|
|
7
|
+
}
|
|
8
|
+
const answers = await prompter.prompt(argv, [
|
|
9
|
+
{
|
|
10
|
+
type: 'text',
|
|
11
|
+
name: 'managerId',
|
|
12
|
+
message: 'managerId',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'text',
|
|
16
|
+
name: 'maxDepth',
|
|
17
|
+
message: 'maxDepth (number)',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'text',
|
|
21
|
+
name: 'targetEntityId',
|
|
22
|
+
message: 'targetEntityId',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
26
|
+
name: 'userId',
|
|
27
|
+
message: 'userId',
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
const client = getClient();
|
|
31
|
+
const result = await client.query
|
|
32
|
+
.orgIsManagerOf(answers)
|
|
33
|
+
.execute();
|
|
34
|
+
console.log(JSON.stringify(result, null, 2));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error('Failed: orgIsManagerOf');
|
|
38
|
+
if (error instanceof Error) {
|
|
39
|
+
console.error(error.message);
|
|
40
|
+
}
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -19,7 +19,11 @@ import appPermissionDefaultGrantCmd from './commands/app-permission-default-gran
|
|
|
19
19
|
import appPermissionDefaultPermissionCmd from './commands/app-permission-default-permission';
|
|
20
20
|
import membershipTypeCmd from './commands/membership-type';
|
|
21
21
|
import orgAdminGrantCmd from './commands/org-admin-grant';
|
|
22
|
+
import orgChartEdgeCmd from './commands/org-chart-edge';
|
|
23
|
+
import orgChartEdgeGrantCmd from './commands/org-chart-edge-grant';
|
|
22
24
|
import orgClaimedInviteCmd from './commands/org-claimed-invite';
|
|
25
|
+
import orgGetManagersRecordCmd from './commands/org-get-managers-record';
|
|
26
|
+
import orgGetSubordinatesRecordCmd from './commands/org-get-subordinates-record';
|
|
23
27
|
import orgGrantCmd from './commands/org-grant';
|
|
24
28
|
import orgInviteCmd from './commands/org-invite';
|
|
25
29
|
import orgMemberCmd from './commands/org-member';
|
|
@@ -36,6 +40,7 @@ import appPermissionsGetByMaskCmd from './commands/app-permissions-get-by-mask';
|
|
|
36
40
|
import appPermissionsGetMaskCmd from './commands/app-permissions-get-mask';
|
|
37
41
|
import appPermissionsGetMaskByNamesCmd from './commands/app-permissions-get-mask-by-names';
|
|
38
42
|
import appPermissionsGetPaddedMaskCmd from './commands/app-permissions-get-padded-mask';
|
|
43
|
+
import orgIsManagerOfCmd from './commands/org-is-manager-of';
|
|
39
44
|
import orgPermissionsGetByMaskCmd from './commands/org-permissions-get-by-mask';
|
|
40
45
|
import orgPermissionsGetMaskCmd from './commands/org-permissions-get-mask';
|
|
41
46
|
import orgPermissionsGetMaskByNamesCmd from './commands/org-permissions-get-mask-by-names';
|
|
@@ -59,7 +64,11 @@ const createCommandMap = () => ({
|
|
|
59
64
|
'app-permission-default-permission': appPermissionDefaultPermissionCmd,
|
|
60
65
|
'membership-type': membershipTypeCmd,
|
|
61
66
|
'org-admin-grant': orgAdminGrantCmd,
|
|
67
|
+
'org-chart-edge': orgChartEdgeCmd,
|
|
68
|
+
'org-chart-edge-grant': orgChartEdgeGrantCmd,
|
|
62
69
|
'org-claimed-invite': orgClaimedInviteCmd,
|
|
70
|
+
'org-get-managers-record': orgGetManagersRecordCmd,
|
|
71
|
+
'org-get-subordinates-record': orgGetSubordinatesRecordCmd,
|
|
63
72
|
'org-grant': orgGrantCmd,
|
|
64
73
|
'org-invite': orgInviteCmd,
|
|
65
74
|
'org-member': orgMemberCmd,
|
|
@@ -76,6 +85,7 @@ const createCommandMap = () => ({
|
|
|
76
85
|
'app-permissions-get-mask': appPermissionsGetMaskCmd,
|
|
77
86
|
'app-permissions-get-mask-by-names': appPermissionsGetMaskByNamesCmd,
|
|
78
87
|
'app-permissions-get-padded-mask': appPermissionsGetPaddedMaskCmd,
|
|
88
|
+
'org-is-manager-of': orgIsManagerOfCmd,
|
|
79
89
|
'org-permissions-get-by-mask': orgPermissionsGetByMaskCmd,
|
|
80
90
|
'org-permissions-get-mask': orgPermissionsGetMaskCmd,
|
|
81
91
|
'org-permissions-get-mask-by-names': orgPermissionsGetMaskByNamesCmd,
|
|
@@ -84,7 +94,7 @@ const createCommandMap = () => ({
|
|
|
84
94
|
'submit-app-invite-code': submitAppInviteCodeCmd,
|
|
85
95
|
'submit-org-invite-code': submitOrgInviteCodeCmd,
|
|
86
96
|
});
|
|
87
|
-
const usage = '\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n app-admin-grant appAdminGrant CRUD operations\n app-claimed-invite appClaimedInvite CRUD operations\n app-grant appGrant CRUD operations\n app-invite appInvite CRUD operations\n app-membership appMembership CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-permission appPermission CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n app-permission-default-grant appPermissionDefaultGrant CRUD operations\n app-permission-default-permission appPermissionDefaultPermission CRUD operations\n membership-type membershipType CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n org-grant orgGrant CRUD operations\n org-invite orgInvite CRUD operations\n org-member orgMember CRUD operations\n org-member-profile orgMemberProfile CRUD operations\n org-membership orgMembership CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n org-membership-setting orgMembershipSetting CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-permission orgPermission CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n org-permission-default-grant orgPermissionDefaultGrant CRUD operations\n org-permission-default-permission orgPermissionDefaultPermission CRUD operations\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n app-permissions-get-mask appPermissionsGetMask\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n org-permissions-get-mask orgPermissionsGetMask\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n submit-app-invite-code submitAppInviteCode\n submit-org-invite-code submitOrgInviteCode\n\n --help, -h Show this help message\n --version, -v Show version\n';
|
|
97
|
+
const usage = '\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n app-admin-grant appAdminGrant CRUD operations\n app-claimed-invite appClaimedInvite CRUD operations\n app-grant appGrant CRUD operations\n app-invite appInvite CRUD operations\n app-membership appMembership CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-permission appPermission CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n app-permission-default-grant appPermissionDefaultGrant CRUD operations\n app-permission-default-permission appPermissionDefaultPermission CRUD operations\n membership-type membershipType CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n org-grant orgGrant CRUD operations\n org-invite orgInvite CRUD operations\n org-member orgMember CRUD operations\n org-member-profile orgMemberProfile CRUD operations\n org-membership orgMembership CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n org-membership-setting orgMembershipSetting CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-permission orgPermission CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n org-permission-default-grant orgPermissionDefaultGrant CRUD operations\n org-permission-default-permission orgPermissionDefaultPermission CRUD operations\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n app-permissions-get-mask appPermissionsGetMask\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-is-manager-of orgIsManagerOf\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n org-permissions-get-mask orgPermissionsGetMask\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n submit-app-invite-code submitAppInviteCode\n submit-org-invite-code submitOrgInviteCode\n\n --help, -h Show this help message\n --version, -v Show version\n';
|
|
88
98
|
export const commands = async (argv, prompter, options) => {
|
|
89
99
|
if (argv.help || argv.h) {
|
|
90
100
|
console.log(usage);
|