@constructive-sdk/cli 0.12.7 → 0.12.8
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/admin/cli/commands/app-achievement.js +38 -15
- package/admin/cli/commands/app-admin-grant.js +38 -15
- package/admin/cli/commands/app-grant.js +40 -16
- package/admin/cli/commands/app-level-requirement.js +42 -17
- package/admin/cli/commands/app-level.js +40 -16
- package/admin/cli/commands/app-limit-default.js +32 -12
- package/admin/cli/commands/app-limit.js +36 -14
- package/admin/cli/commands/app-membership-default.js +40 -16
- package/admin/cli/commands/app-membership.js +58 -25
- package/admin/cli/commands/app-owner-grant.js +38 -15
- package/admin/cli/commands/app-permission-default.js +30 -11
- package/admin/cli/commands/app-permission.js +36 -14
- package/admin/cli/commands/app-step.js +38 -15
- package/admin/cli/commands/claimed-invite.js +38 -15
- package/admin/cli/commands/invite.js +50 -21
- package/admin/cli/commands/membership-type.js +34 -13
- package/admin/cli/commands/org-admin-grant.js +40 -16
- package/admin/cli/commands/org-chart-edge-grant.js +44 -18
- package/admin/cli/commands/org-chart-edge.js +42 -17
- package/admin/cli/commands/org-claimed-invite.js +40 -16
- package/admin/cli/commands/org-get-managers-record.js +30 -11
- package/admin/cli/commands/org-get-subordinates-record.js +30 -11
- package/admin/cli/commands/org-grant.js +42 -17
- package/admin/cli/commands/org-invite.js +54 -23
- package/admin/cli/commands/org-limit-default.js +32 -12
- package/admin/cli/commands/org-limit.js +38 -15
- package/admin/cli/commands/org-member.js +34 -13
- package/admin/cli/commands/org-membership-default.js +44 -18
- package/admin/cli/commands/org-membership.js +58 -25
- package/admin/cli/commands/org-owner-grant.js +40 -16
- package/admin/cli/commands/org-permission-default.js +32 -12
- package/admin/cli/commands/org-permission.js +36 -14
- package/admin/cli/utils.d.ts +38 -0
- package/admin/cli/utils.js +96 -0
- package/auth/cli/commands/audit-log.js +42 -17
- package/auth/cli/commands/connected-account.js +42 -17
- package/auth/cli/commands/crypto-address.js +40 -16
- package/auth/cli/commands/email.js +40 -16
- package/auth/cli/commands/phone-number.js +42 -17
- package/auth/cli/commands/role-type.js +30 -11
- package/auth/cli/commands/user.js +80 -16
- package/auth/cli/utils.d.ts +38 -0
- package/auth/cli/utils.js +96 -0
- package/esm/admin/cli/commands/app-achievement.js +39 -16
- package/esm/admin/cli/commands/app-admin-grant.js +39 -16
- package/esm/admin/cli/commands/app-grant.js +41 -17
- package/esm/admin/cli/commands/app-level-requirement.js +43 -18
- package/esm/admin/cli/commands/app-level.js +41 -17
- package/esm/admin/cli/commands/app-limit-default.js +33 -13
- package/esm/admin/cli/commands/app-limit.js +37 -15
- package/esm/admin/cli/commands/app-membership-default.js +41 -17
- package/esm/admin/cli/commands/app-membership.js +59 -26
- package/esm/admin/cli/commands/app-owner-grant.js +39 -16
- package/esm/admin/cli/commands/app-permission-default.js +31 -12
- package/esm/admin/cli/commands/app-permission.js +37 -15
- package/esm/admin/cli/commands/app-step.js +39 -16
- package/esm/admin/cli/commands/claimed-invite.js +39 -16
- package/esm/admin/cli/commands/invite.js +51 -22
- package/esm/admin/cli/commands/membership-type.js +35 -14
- package/esm/admin/cli/commands/org-admin-grant.js +41 -17
- package/esm/admin/cli/commands/org-chart-edge-grant.js +45 -19
- package/esm/admin/cli/commands/org-chart-edge.js +43 -18
- package/esm/admin/cli/commands/org-claimed-invite.js +41 -17
- package/esm/admin/cli/commands/org-get-managers-record.js +31 -12
- package/esm/admin/cli/commands/org-get-subordinates-record.js +31 -12
- package/esm/admin/cli/commands/org-grant.js +43 -18
- package/esm/admin/cli/commands/org-invite.js +55 -24
- package/esm/admin/cli/commands/org-limit-default.js +33 -13
- package/esm/admin/cli/commands/org-limit.js +39 -16
- package/esm/admin/cli/commands/org-member.js +35 -14
- package/esm/admin/cli/commands/org-membership-default.js +45 -19
- package/esm/admin/cli/commands/org-membership.js +59 -26
- package/esm/admin/cli/commands/org-owner-grant.js +41 -17
- package/esm/admin/cli/commands/org-permission-default.js +33 -13
- package/esm/admin/cli/commands/org-permission.js +37 -15
- package/esm/admin/cli/utils.d.ts +38 -0
- package/esm/admin/cli/utils.js +90 -0
- package/esm/auth/cli/commands/audit-log.js +43 -18
- package/esm/auth/cli/commands/connected-account.js +43 -18
- package/esm/auth/cli/commands/crypto-address.js +41 -17
- package/esm/auth/cli/commands/email.js +41 -17
- package/esm/auth/cli/commands/phone-number.js +43 -18
- package/esm/auth/cli/commands/role-type.js +31 -12
- package/esm/auth/cli/commands/user.js +81 -17
- package/esm/auth/cli/utils.d.ts +38 -0
- package/esm/auth/cli/utils.js +90 -0
- package/esm/objects/cli/commands/commit.js +45 -19
- package/esm/objects/cli/commands/get-all-record.js +31 -12
- package/esm/objects/cli/commands/object.js +41 -17
- package/esm/objects/cli/commands/ref.js +37 -15
- package/esm/objects/cli/commands/store.js +37 -15
- package/esm/objects/cli/utils.d.ts +38 -0
- package/esm/objects/cli/utils.js +90 -0
- package/esm/public/cli/commands/api-module.js +37 -15
- package/esm/public/cli/commands/api-schema.js +35 -14
- package/esm/public/cli/commands/api.js +41 -17
- package/esm/public/cli/commands/app-achievement.js +39 -16
- package/esm/public/cli/commands/app-admin-grant.js +39 -16
- package/esm/public/cli/commands/app-grant.js +41 -17
- package/esm/public/cli/commands/app-level-requirement.js +43 -18
- package/esm/public/cli/commands/app-level.js +41 -17
- package/esm/public/cli/commands/app-limit-default.js +33 -13
- package/esm/public/cli/commands/app-limit.js +37 -15
- package/esm/public/cli/commands/app-membership-default.js +41 -17
- package/esm/public/cli/commands/app-membership.js +59 -26
- package/esm/public/cli/commands/app-owner-grant.js +39 -16
- package/esm/public/cli/commands/app-permission-default.js +31 -12
- package/esm/public/cli/commands/app-permission.js +37 -15
- package/esm/public/cli/commands/app-step.js +39 -16
- package/esm/public/cli/commands/app.js +45 -19
- package/esm/public/cli/commands/ast-migration.js +53 -23
- package/esm/public/cli/commands/audit-log.js +43 -18
- package/esm/public/cli/commands/blueprint-template.js +67 -30
- package/esm/public/cli/commands/blueprint.js +61 -27
- package/esm/public/cli/commands/check-constraint.js +55 -24
- package/esm/public/cli/commands/claimed-invite.js +39 -16
- package/esm/public/cli/commands/commit.js +45 -19
- package/esm/public/cli/commands/connected-account.js +43 -18
- package/esm/public/cli/commands/connected-accounts-module.js +41 -17
- package/esm/public/cli/commands/crypto-address.js +41 -17
- package/esm/public/cli/commands/crypto-addresses-module.js +43 -18
- package/esm/public/cli/commands/crypto-auth-module.js +55 -24
- package/esm/public/cli/commands/database-provision-module.js +55 -24
- package/esm/public/cli/commands/database-transfer.js +55 -24
- package/esm/public/cli/commands/database.js +43 -18
- package/esm/public/cli/commands/default-ids-module.js +31 -12
- package/esm/public/cli/commands/default-privilege.js +41 -17
- package/esm/public/cli/commands/denormalized-table-field.js +51 -22
- package/esm/public/cli/commands/domain.js +39 -16
- package/esm/public/cli/commands/email.js +41 -17
- package/esm/public/cli/commands/emails-module.js +41 -17
- package/esm/public/cli/commands/embedding-chunk.js +63 -28
- package/esm/public/cli/commands/encrypted-secrets-module.js +37 -15
- package/esm/public/cli/commands/enum.js +51 -22
- package/esm/public/cli/commands/field.js +75 -34
- package/esm/public/cli/commands/foreign-key-constraint.js +63 -28
- package/esm/public/cli/commands/full-text-search.js +45 -19
- package/esm/public/cli/commands/get-all-record.js +31 -12
- package/esm/public/cli/commands/hierarchy-module.js +67 -30
- package/esm/public/cli/commands/index.js +65 -29
- package/esm/public/cli/commands/invite.js +51 -22
- package/esm/public/cli/commands/invites-module.js +55 -24
- package/esm/public/cli/commands/levels-module.js +79 -36
- package/esm/public/cli/commands/limits-module.js +63 -28
- package/esm/public/cli/commands/membership-type.js +35 -14
- package/esm/public/cli/commands/membership-types-module.js +37 -15
- package/esm/public/cli/commands/memberships-module.js +89 -41
- package/esm/public/cli/commands/migrate-file.js +33 -13
- package/esm/public/cli/commands/node-type-registry.js +89 -19
- package/esm/public/cli/commands/object.js +41 -17
- package/esm/public/cli/commands/org-admin-grant.js +41 -17
- package/esm/public/cli/commands/org-chart-edge-grant.js +45 -19
- package/esm/public/cli/commands/org-chart-edge.js +43 -18
- package/esm/public/cli/commands/org-claimed-invite.js +41 -17
- package/esm/public/cli/commands/org-get-managers-record.js +31 -12
- package/esm/public/cli/commands/org-get-subordinates-record.js +31 -12
- package/esm/public/cli/commands/org-grant.js +43 -18
- package/esm/public/cli/commands/org-invite.js +55 -24
- package/esm/public/cli/commands/org-limit-default.js +33 -13
- package/esm/public/cli/commands/org-limit.js +39 -16
- package/esm/public/cli/commands/org-member.js +35 -14
- package/esm/public/cli/commands/org-membership-default.js +45 -19
- package/esm/public/cli/commands/org-membership.js +59 -26
- package/esm/public/cli/commands/org-owner-grant.js +41 -17
- package/esm/public/cli/commands/org-permission-default.js +33 -13
- package/esm/public/cli/commands/org-permission.js +37 -15
- package/esm/public/cli/commands/permissions-module.js +61 -27
- package/esm/public/cli/commands/phone-number.js +43 -18
- package/esm/public/cli/commands/phone-numbers-module.js +41 -17
- package/esm/public/cli/commands/policy.js +61 -27
- package/esm/public/cli/commands/primary-key-constraint.js +53 -23
- package/esm/public/cli/commands/profiles-module.js +63 -28
- package/esm/public/cli/commands/ref.js +37 -15
- package/esm/public/cli/commands/relation-provision.js +89 -41
- package/esm/public/cli/commands/rls-module.js +49 -21
- package/esm/public/cli/commands/role-type.js +31 -12
- package/esm/public/cli/commands/schema-grant.js +39 -16
- package/esm/public/cli/commands/schema.js +55 -24
- package/esm/public/cli/commands/secrets-module.js +37 -15
- package/esm/public/cli/commands/secure-table-provision.js +63 -28
- package/esm/public/cli/commands/sessions-module.js +49 -21
- package/esm/public/cli/commands/site-metadatum.js +39 -16
- package/esm/public/cli/commands/site-module.js +37 -15
- package/esm/public/cli/commands/site-theme.js +35 -14
- package/esm/public/cli/commands/site.js +45 -19
- package/esm/public/cli/commands/sql-action.js +53 -23
- package/esm/public/cli/commands/store.js +37 -15
- package/esm/public/cli/commands/table-grant.js +45 -19
- package/esm/public/cli/commands/table-template-module.js +45 -19
- package/esm/public/cli/commands/table.js +65 -29
- package/esm/public/cli/commands/trigger-function.js +39 -16
- package/esm/public/cli/commands/trigger.js +53 -23
- package/esm/public/cli/commands/unique-constraint.js +55 -24
- package/esm/public/cli/commands/user-auth-module.js +79 -36
- package/esm/public/cli/commands/user.js +81 -17
- package/esm/public/cli/commands/users-module.js +41 -17
- package/esm/public/cli/commands/view-grant.js +41 -17
- package/esm/public/cli/commands/view-rule.js +39 -16
- package/esm/public/cli/commands/view-table.js +35 -14
- package/esm/public/cli/commands/view.js +59 -26
- package/esm/public/cli/commands.js +3 -3
- package/esm/public/cli/executor.d.ts +1 -1
- package/esm/public/cli/utils.d.ts +38 -0
- package/esm/public/cli/utils.js +90 -0
- package/esm/public/orm/index.d.ts +2 -2
- package/esm/public/orm/index.js +2 -2
- package/esm/public/orm/input-types.d.ts +161 -147
- package/esm/public/orm/models/index.d.ts +1 -1
- package/esm/public/orm/models/index.js +1 -1
- package/objects/cli/commands/commit.js +44 -18
- package/objects/cli/commands/get-all-record.js +30 -11
- package/objects/cli/commands/object.js +40 -16
- package/objects/cli/commands/ref.js +36 -14
- package/objects/cli/commands/store.js +36 -14
- package/objects/cli/utils.d.ts +38 -0
- package/objects/cli/utils.js +96 -0
- package/package.json +3 -3
- package/public/cli/commands/api-module.js +36 -14
- package/public/cli/commands/api-schema.js +34 -13
- package/public/cli/commands/api.js +40 -16
- package/public/cli/commands/app-achievement.js +38 -15
- package/public/cli/commands/app-admin-grant.js +38 -15
- package/public/cli/commands/app-grant.js +40 -16
- package/public/cli/commands/app-level-requirement.js +42 -17
- package/public/cli/commands/app-level.js +40 -16
- package/public/cli/commands/app-limit-default.js +32 -12
- package/public/cli/commands/app-limit.js +36 -14
- package/public/cli/commands/app-membership-default.js +40 -16
- package/public/cli/commands/app-membership.js +58 -25
- package/public/cli/commands/app-owner-grant.js +38 -15
- package/public/cli/commands/app-permission-default.js +30 -11
- package/public/cli/commands/app-permission.js +36 -14
- package/public/cli/commands/app-step.js +38 -15
- package/public/cli/commands/app.js +44 -18
- package/public/cli/commands/ast-migration.js +52 -22
- package/public/cli/commands/audit-log.js +42 -17
- package/public/cli/commands/blueprint-template.js +66 -29
- package/public/cli/commands/blueprint.js +60 -26
- package/public/cli/commands/check-constraint.js +54 -23
- package/public/cli/commands/claimed-invite.js +38 -15
- package/public/cli/commands/commit.js +44 -18
- package/public/cli/commands/connected-account.js +42 -17
- package/public/cli/commands/connected-accounts-module.js +40 -16
- package/public/cli/commands/crypto-address.js +40 -16
- package/public/cli/commands/crypto-addresses-module.js +42 -17
- package/public/cli/commands/crypto-auth-module.js +54 -23
- package/public/cli/commands/database-provision-module.js +54 -23
- package/public/cli/commands/database-transfer.js +54 -23
- package/public/cli/commands/database.js +42 -17
- package/public/cli/commands/default-ids-module.js +30 -11
- package/public/cli/commands/default-privilege.js +40 -16
- package/public/cli/commands/denormalized-table-field.js +50 -21
- package/public/cli/commands/domain.js +38 -15
- package/public/cli/commands/email.js +40 -16
- package/public/cli/commands/emails-module.js +40 -16
- package/public/cli/commands/embedding-chunk.js +62 -27
- package/public/cli/commands/encrypted-secrets-module.js +36 -14
- package/public/cli/commands/enum.js +50 -21
- package/public/cli/commands/field.js +74 -33
- package/public/cli/commands/foreign-key-constraint.js +62 -27
- package/public/cli/commands/full-text-search.js +44 -18
- package/public/cli/commands/get-all-record.js +30 -11
- package/public/cli/commands/hierarchy-module.js +66 -29
- package/public/cli/commands/index.js +64 -28
- package/public/cli/commands/invite.js +50 -21
- package/public/cli/commands/invites-module.js +54 -23
- package/public/cli/commands/levels-module.js +78 -35
- package/public/cli/commands/limits-module.js +62 -27
- package/public/cli/commands/membership-type.js +34 -13
- package/public/cli/commands/membership-types-module.js +36 -14
- package/public/cli/commands/memberships-module.js +88 -40
- package/public/cli/commands/migrate-file.js +32 -12
- package/public/cli/commands/node-type-registry.js +88 -18
- package/public/cli/commands/object.js +40 -16
- package/public/cli/commands/org-admin-grant.js +40 -16
- package/public/cli/commands/org-chart-edge-grant.js +44 -18
- package/public/cli/commands/org-chart-edge.js +42 -17
- package/public/cli/commands/org-claimed-invite.js +40 -16
- package/public/cli/commands/org-get-managers-record.js +30 -11
- package/public/cli/commands/org-get-subordinates-record.js +30 -11
- package/public/cli/commands/org-grant.js +42 -17
- package/public/cli/commands/org-invite.js +54 -23
- package/public/cli/commands/org-limit-default.js +32 -12
- package/public/cli/commands/org-limit.js +38 -15
- package/public/cli/commands/org-member.js +34 -13
- package/public/cli/commands/org-membership-default.js +44 -18
- package/public/cli/commands/org-membership.js +58 -25
- package/public/cli/commands/org-owner-grant.js +40 -16
- package/public/cli/commands/org-permission-default.js +32 -12
- package/public/cli/commands/org-permission.js +36 -14
- package/public/cli/commands/permissions-module.js +60 -26
- package/public/cli/commands/phone-number.js +42 -17
- package/public/cli/commands/phone-numbers-module.js +40 -16
- package/public/cli/commands/policy.js +60 -26
- package/public/cli/commands/primary-key-constraint.js +52 -22
- package/public/cli/commands/profiles-module.js +62 -27
- package/public/cli/commands/ref.js +36 -14
- package/public/cli/commands/relation-provision.js +88 -40
- package/public/cli/commands/rls-module.js +48 -20
- package/public/cli/commands/role-type.js +30 -11
- package/public/cli/commands/schema-grant.js +38 -15
- package/public/cli/commands/schema.js +54 -23
- package/public/cli/commands/secrets-module.js +36 -14
- package/public/cli/commands/secure-table-provision.js +62 -27
- package/public/cli/commands/sessions-module.js +48 -20
- package/public/cli/commands/site-metadatum.js +38 -15
- package/public/cli/commands/site-module.js +36 -14
- package/public/cli/commands/site-theme.js +34 -13
- package/public/cli/commands/site.js +44 -18
- package/public/cli/commands/sql-action.js +52 -22
- package/public/cli/commands/store.js +36 -14
- package/public/cli/commands/table-grant.js +44 -18
- package/public/cli/commands/table-template-module.js +44 -18
- package/public/cli/commands/table.js +64 -28
- package/public/cli/commands/trigger-function.js +38 -15
- package/public/cli/commands/trigger.js +52 -22
- package/public/cli/commands/unique-constraint.js +54 -23
- package/public/cli/commands/user-auth-module.js +78 -35
- package/public/cli/commands/user.js +80 -16
- package/public/cli/commands/users-module.js +40 -16
- package/public/cli/commands/view-grant.js +40 -16
- package/public/cli/commands/view-rule.js +38 -15
- package/public/cli/commands/view-table.js +34 -13
- package/public/cli/commands/view.js +58 -25
- package/public/cli/commands.js +3 -3
- package/public/cli/executor.d.ts +1 -1
- package/public/cli/utils.d.ts +38 -0
- package/public/cli/utils.js +96 -0
- package/public/orm/index.d.ts +2 -2
- package/public/orm/index.js +2 -2
- package/public/orm/input-types.d.ts +161 -147
- package/public/orm/models/index.d.ts +1 -1
- package/public/orm/models/index.js +4 -4
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { extractFirst } from 'inquirerer';
|
|
7
7
|
import { getClient } from '../executor';
|
|
8
|
-
import { coerceAnswers, stripUndefined } from '../utils';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
9
|
const fieldSchema = {
|
|
10
10
|
id: 'uuid',
|
|
11
11
|
databaseId: 'uuid',
|
|
@@ -32,7 +32,7 @@ const fieldSchema = {
|
|
|
32
32
|
createdAt: 'string',
|
|
33
33
|
updatedAt: 'string',
|
|
34
34
|
};
|
|
35
|
-
const usage = '\nfield <command>\n\nCommands:\n list List
|
|
35
|
+
const usage = '\nfield <command>\n\nCommands:\n list List field records\n find-first Find first matching field record\n get Get a field by ID\n create Create a new field\n update Update an existing field\n delete Delete a field\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\n --help, -h Show this help message\n';
|
|
36
36
|
export default async (argv, prompter, _options) => {
|
|
37
37
|
if (argv.help || argv.h) {
|
|
38
38
|
console.log(usage);
|
|
@@ -45,7 +45,7 @@ export default async (argv, prompter, _options) => {
|
|
|
45
45
|
type: 'autocomplete',
|
|
46
46
|
name: 'subcommand',
|
|
47
47
|
message: 'What do you want to do?',
|
|
48
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
48
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
49
49
|
},
|
|
50
50
|
]);
|
|
51
51
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -56,6 +56,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
56
56
|
switch (subcommand) {
|
|
57
57
|
case 'list':
|
|
58
58
|
return handleList(argv, prompter);
|
|
59
|
+
case 'find-first':
|
|
60
|
+
return handleFindFirst(argv, prompter);
|
|
59
61
|
case 'get':
|
|
60
62
|
return handleGet(argv, prompter);
|
|
61
63
|
case 'create':
|
|
@@ -69,39 +71,37 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
69
71
|
process.exit(1);
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
async function handleList(
|
|
74
|
+
async function handleList(argv, _prompter) {
|
|
73
75
|
try {
|
|
76
|
+
const defaultSelect = {
|
|
77
|
+
id: true,
|
|
78
|
+
databaseId: true,
|
|
79
|
+
tableId: true,
|
|
80
|
+
name: true,
|
|
81
|
+
label: true,
|
|
82
|
+
description: true,
|
|
83
|
+
smartTags: true,
|
|
84
|
+
isRequired: true,
|
|
85
|
+
apiRequired: true,
|
|
86
|
+
defaultValue: true,
|
|
87
|
+
defaultValueAst: true,
|
|
88
|
+
type: true,
|
|
89
|
+
fieldOrder: true,
|
|
90
|
+
regexp: true,
|
|
91
|
+
chk: true,
|
|
92
|
+
chkExpr: true,
|
|
93
|
+
min: true,
|
|
94
|
+
max: true,
|
|
95
|
+
tags: true,
|
|
96
|
+
category: true,
|
|
97
|
+
module: true,
|
|
98
|
+
scope: true,
|
|
99
|
+
createdAt: true,
|
|
100
|
+
updatedAt: true,
|
|
101
|
+
};
|
|
102
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
74
103
|
const client = getClient();
|
|
75
|
-
const result = await client.field
|
|
76
|
-
.findMany({
|
|
77
|
-
select: {
|
|
78
|
-
id: true,
|
|
79
|
-
databaseId: true,
|
|
80
|
-
tableId: true,
|
|
81
|
-
name: true,
|
|
82
|
-
label: true,
|
|
83
|
-
description: true,
|
|
84
|
-
smartTags: true,
|
|
85
|
-
isRequired: true,
|
|
86
|
-
apiRequired: true,
|
|
87
|
-
defaultValue: true,
|
|
88
|
-
defaultValueAst: true,
|
|
89
|
-
type: true,
|
|
90
|
-
fieldOrder: true,
|
|
91
|
-
regexp: true,
|
|
92
|
-
chk: true,
|
|
93
|
-
chkExpr: true,
|
|
94
|
-
min: true,
|
|
95
|
-
max: true,
|
|
96
|
-
tags: true,
|
|
97
|
-
category: true,
|
|
98
|
-
module: true,
|
|
99
|
-
scope: true,
|
|
100
|
-
createdAt: true,
|
|
101
|
-
updatedAt: true,
|
|
102
|
-
},
|
|
103
|
-
})
|
|
104
|
-
.execute();
|
|
104
|
+
const result = await client.field.findMany(findManyArgs).execute();
|
|
105
105
|
console.log(JSON.stringify(result, null, 2));
|
|
106
106
|
}
|
|
107
107
|
catch (error) {
|
|
@@ -112,6 +112,47 @@ async function handleList(_argv, _prompter) {
|
|
|
112
112
|
process.exit(1);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
async function handleFindFirst(argv, _prompter) {
|
|
116
|
+
try {
|
|
117
|
+
const defaultSelect = {
|
|
118
|
+
id: true,
|
|
119
|
+
databaseId: true,
|
|
120
|
+
tableId: true,
|
|
121
|
+
name: true,
|
|
122
|
+
label: true,
|
|
123
|
+
description: true,
|
|
124
|
+
smartTags: true,
|
|
125
|
+
isRequired: true,
|
|
126
|
+
apiRequired: true,
|
|
127
|
+
defaultValue: true,
|
|
128
|
+
defaultValueAst: true,
|
|
129
|
+
type: true,
|
|
130
|
+
fieldOrder: true,
|
|
131
|
+
regexp: true,
|
|
132
|
+
chk: true,
|
|
133
|
+
chkExpr: true,
|
|
134
|
+
min: true,
|
|
135
|
+
max: true,
|
|
136
|
+
tags: true,
|
|
137
|
+
category: true,
|
|
138
|
+
module: true,
|
|
139
|
+
scope: true,
|
|
140
|
+
createdAt: true,
|
|
141
|
+
updatedAt: true,
|
|
142
|
+
};
|
|
143
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
144
|
+
const client = getClient();
|
|
145
|
+
const result = await client.field.findFirst(findFirstArgs).execute();
|
|
146
|
+
console.log(JSON.stringify(result, null, 2));
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error('Failed to find record.');
|
|
150
|
+
if (error instanceof Error) {
|
|
151
|
+
console.error(error.message);
|
|
152
|
+
}
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
115
156
|
async function handleGet(argv, prompter) {
|
|
116
157
|
try {
|
|
117
158
|
const answers = await prompter.prompt(argv, [
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { extractFirst } from 'inquirerer';
|
|
7
7
|
import { getClient } from '../executor';
|
|
8
|
-
import { coerceAnswers, stripUndefined } from '../utils';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
9
|
const fieldSchema = {
|
|
10
10
|
id: 'uuid',
|
|
11
11
|
databaseId: 'uuid',
|
|
@@ -26,7 +26,7 @@ const fieldSchema = {
|
|
|
26
26
|
createdAt: 'string',
|
|
27
27
|
updatedAt: 'string',
|
|
28
28
|
};
|
|
29
|
-
const usage = '\nforeign-key-constraint <command>\n\nCommands:\n list List
|
|
29
|
+
const usage = '\nforeign-key-constraint <command>\n\nCommands:\n list List foreignKeyConstraint records\n find-first Find first matching foreignKeyConstraint record\n get Get a foreignKeyConstraint by ID\n create Create a new foreignKeyConstraint\n update Update an existing foreignKeyConstraint\n delete Delete a foreignKeyConstraint\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\n --help, -h Show this help message\n';
|
|
30
30
|
export default async (argv, prompter, _options) => {
|
|
31
31
|
if (argv.help || argv.h) {
|
|
32
32
|
console.log(usage);
|
|
@@ -39,7 +39,7 @@ export default async (argv, prompter, _options) => {
|
|
|
39
39
|
type: 'autocomplete',
|
|
40
40
|
name: 'subcommand',
|
|
41
41
|
message: 'What do you want to do?',
|
|
42
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
42
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
43
43
|
},
|
|
44
44
|
]);
|
|
45
45
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -50,6 +50,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
50
50
|
switch (subcommand) {
|
|
51
51
|
case 'list':
|
|
52
52
|
return handleList(argv, prompter);
|
|
53
|
+
case 'find-first':
|
|
54
|
+
return handleFindFirst(argv, prompter);
|
|
53
55
|
case 'get':
|
|
54
56
|
return handleGet(argv, prompter);
|
|
55
57
|
case 'create':
|
|
@@ -63,33 +65,31 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
63
65
|
process.exit(1);
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
async function handleList(
|
|
68
|
+
async function handleList(argv, _prompter) {
|
|
67
69
|
try {
|
|
70
|
+
const defaultSelect = {
|
|
71
|
+
id: true,
|
|
72
|
+
databaseId: true,
|
|
73
|
+
tableId: true,
|
|
74
|
+
name: true,
|
|
75
|
+
description: true,
|
|
76
|
+
smartTags: true,
|
|
77
|
+
type: true,
|
|
78
|
+
fieldIds: true,
|
|
79
|
+
refTableId: true,
|
|
80
|
+
refFieldIds: true,
|
|
81
|
+
deleteAction: true,
|
|
82
|
+
updateAction: true,
|
|
83
|
+
category: true,
|
|
84
|
+
module: true,
|
|
85
|
+
scope: true,
|
|
86
|
+
tags: true,
|
|
87
|
+
createdAt: true,
|
|
88
|
+
updatedAt: true,
|
|
89
|
+
};
|
|
90
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
68
91
|
const client = getClient();
|
|
69
|
-
const result = await client.foreignKeyConstraint
|
|
70
|
-
.findMany({
|
|
71
|
-
select: {
|
|
72
|
-
id: true,
|
|
73
|
-
databaseId: true,
|
|
74
|
-
tableId: true,
|
|
75
|
-
name: true,
|
|
76
|
-
description: true,
|
|
77
|
-
smartTags: true,
|
|
78
|
-
type: true,
|
|
79
|
-
fieldIds: true,
|
|
80
|
-
refTableId: true,
|
|
81
|
-
refFieldIds: true,
|
|
82
|
-
deleteAction: true,
|
|
83
|
-
updateAction: true,
|
|
84
|
-
category: true,
|
|
85
|
-
module: true,
|
|
86
|
-
scope: true,
|
|
87
|
-
tags: true,
|
|
88
|
-
createdAt: true,
|
|
89
|
-
updatedAt: true,
|
|
90
|
-
},
|
|
91
|
-
})
|
|
92
|
-
.execute();
|
|
92
|
+
const result = await client.foreignKeyConstraint.findMany(findManyArgs).execute();
|
|
93
93
|
console.log(JSON.stringify(result, null, 2));
|
|
94
94
|
}
|
|
95
95
|
catch (error) {
|
|
@@ -100,6 +100,41 @@ async function handleList(_argv, _prompter) {
|
|
|
100
100
|
process.exit(1);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
async function handleFindFirst(argv, _prompter) {
|
|
104
|
+
try {
|
|
105
|
+
const defaultSelect = {
|
|
106
|
+
id: true,
|
|
107
|
+
databaseId: true,
|
|
108
|
+
tableId: true,
|
|
109
|
+
name: true,
|
|
110
|
+
description: true,
|
|
111
|
+
smartTags: true,
|
|
112
|
+
type: true,
|
|
113
|
+
fieldIds: true,
|
|
114
|
+
refTableId: true,
|
|
115
|
+
refFieldIds: true,
|
|
116
|
+
deleteAction: true,
|
|
117
|
+
updateAction: true,
|
|
118
|
+
category: true,
|
|
119
|
+
module: true,
|
|
120
|
+
scope: true,
|
|
121
|
+
tags: true,
|
|
122
|
+
createdAt: true,
|
|
123
|
+
updatedAt: true,
|
|
124
|
+
};
|
|
125
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
126
|
+
const client = getClient();
|
|
127
|
+
const result = await client.foreignKeyConstraint.findFirst(findFirstArgs).execute();
|
|
128
|
+
console.log(JSON.stringify(result, null, 2));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
console.error('Failed to find record.');
|
|
132
|
+
if (error instanceof Error) {
|
|
133
|
+
console.error(error.message);
|
|
134
|
+
}
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
103
138
|
async function handleGet(argv, prompter) {
|
|
104
139
|
try {
|
|
105
140
|
const answers = await prompter.prompt(argv, [
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { extractFirst } from 'inquirerer';
|
|
7
7
|
import { getClient } from '../executor';
|
|
8
|
-
import { coerceAnswers, stripUndefined } from '../utils';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
9
|
const fieldSchema = {
|
|
10
10
|
id: 'uuid',
|
|
11
11
|
databaseId: 'uuid',
|
|
@@ -17,7 +17,7 @@ const fieldSchema = {
|
|
|
17
17
|
createdAt: 'string',
|
|
18
18
|
updatedAt: 'string',
|
|
19
19
|
};
|
|
20
|
-
const usage = '\nfull-text-search <command>\n\nCommands:\n list List
|
|
20
|
+
const usage = '\nfull-text-search <command>\n\nCommands:\n list List fullTextSearch records\n find-first Find first matching fullTextSearch record\n get Get a fullTextSearch by ID\n create Create a new fullTextSearch\n update Update an existing fullTextSearch\n delete Delete a fullTextSearch\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\n --help, -h Show this help message\n';
|
|
21
21
|
export default async (argv, prompter, _options) => {
|
|
22
22
|
if (argv.help || argv.h) {
|
|
23
23
|
console.log(usage);
|
|
@@ -30,7 +30,7 @@ export default async (argv, prompter, _options) => {
|
|
|
30
30
|
type: 'autocomplete',
|
|
31
31
|
name: 'subcommand',
|
|
32
32
|
message: 'What do you want to do?',
|
|
33
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
33
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
34
34
|
},
|
|
35
35
|
]);
|
|
36
36
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -41,6 +41,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
41
41
|
switch (subcommand) {
|
|
42
42
|
case 'list':
|
|
43
43
|
return handleList(argv, prompter);
|
|
44
|
+
case 'find-first':
|
|
45
|
+
return handleFindFirst(argv, prompter);
|
|
44
46
|
case 'get':
|
|
45
47
|
return handleGet(argv, prompter);
|
|
46
48
|
case 'create':
|
|
@@ -54,24 +56,22 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
54
56
|
process.exit(1);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
async function handleList(
|
|
59
|
+
async function handleList(argv, _prompter) {
|
|
58
60
|
try {
|
|
61
|
+
const defaultSelect = {
|
|
62
|
+
id: true,
|
|
63
|
+
databaseId: true,
|
|
64
|
+
tableId: true,
|
|
65
|
+
fieldId: true,
|
|
66
|
+
fieldIds: true,
|
|
67
|
+
weights: true,
|
|
68
|
+
langs: true,
|
|
69
|
+
createdAt: true,
|
|
70
|
+
updatedAt: true,
|
|
71
|
+
};
|
|
72
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
59
73
|
const client = getClient();
|
|
60
|
-
const result = await client.fullTextSearch
|
|
61
|
-
.findMany({
|
|
62
|
-
select: {
|
|
63
|
-
id: true,
|
|
64
|
-
databaseId: true,
|
|
65
|
-
tableId: true,
|
|
66
|
-
fieldId: true,
|
|
67
|
-
fieldIds: true,
|
|
68
|
-
weights: true,
|
|
69
|
-
langs: true,
|
|
70
|
-
createdAt: true,
|
|
71
|
-
updatedAt: true,
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
.execute();
|
|
74
|
+
const result = await client.fullTextSearch.findMany(findManyArgs).execute();
|
|
75
75
|
console.log(JSON.stringify(result, null, 2));
|
|
76
76
|
}
|
|
77
77
|
catch (error) {
|
|
@@ -82,6 +82,32 @@ async function handleList(_argv, _prompter) {
|
|
|
82
82
|
process.exit(1);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
async function handleFindFirst(argv, _prompter) {
|
|
86
|
+
try {
|
|
87
|
+
const defaultSelect = {
|
|
88
|
+
id: true,
|
|
89
|
+
databaseId: true,
|
|
90
|
+
tableId: true,
|
|
91
|
+
fieldId: true,
|
|
92
|
+
fieldIds: true,
|
|
93
|
+
weights: true,
|
|
94
|
+
langs: true,
|
|
95
|
+
createdAt: true,
|
|
96
|
+
updatedAt: true,
|
|
97
|
+
};
|
|
98
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
99
|
+
const client = getClient();
|
|
100
|
+
const result = await client.fullTextSearch.findFirst(findFirstArgs).execute();
|
|
101
|
+
console.log(JSON.stringify(result, null, 2));
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error('Failed to find record.');
|
|
105
|
+
if (error instanceof Error) {
|
|
106
|
+
console.error(error.message);
|
|
107
|
+
}
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
85
111
|
async function handleGet(argv, prompter) {
|
|
86
112
|
try {
|
|
87
113
|
const answers = await prompter.prompt(argv, [
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { extractFirst } from 'inquirerer';
|
|
7
7
|
import { getClient } from '../executor';
|
|
8
|
-
import { coerceAnswers, stripUndefined } from '../utils';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
9
|
const fieldSchema = {
|
|
10
10
|
path: 'string',
|
|
11
11
|
data: 'json',
|
|
12
12
|
};
|
|
13
|
-
const usage = '\nget-all-record <command>\n\nCommands:\n list List
|
|
13
|
+
const usage = '\nget-all-record <command>\n\nCommands:\n list List getAllRecord records\n find-first Find first matching getAllRecord record\n create Create a new getAllRecord\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\n --help, -h Show this help message\n';
|
|
14
14
|
export default async (argv, prompter, _options) => {
|
|
15
15
|
if (argv.help || argv.h) {
|
|
16
16
|
console.log(usage);
|
|
@@ -23,7 +23,7 @@ export default async (argv, prompter, _options) => {
|
|
|
23
23
|
type: 'autocomplete',
|
|
24
24
|
name: 'subcommand',
|
|
25
25
|
message: 'What do you want to do?',
|
|
26
|
-
options: ['list', 'create'],
|
|
26
|
+
options: ['list', 'find-first', 'create'],
|
|
27
27
|
},
|
|
28
28
|
]);
|
|
29
29
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -34,6 +34,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
34
34
|
switch (subcommand) {
|
|
35
35
|
case 'list':
|
|
36
36
|
return handleList(argv, prompter);
|
|
37
|
+
case 'find-first':
|
|
38
|
+
return handleFindFirst(argv, prompter);
|
|
37
39
|
case 'create':
|
|
38
40
|
return handleCreate(argv, prompter);
|
|
39
41
|
default:
|
|
@@ -41,17 +43,15 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
41
43
|
process.exit(1);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
|
-
async function handleList(
|
|
46
|
+
async function handleList(argv, _prompter) {
|
|
45
47
|
try {
|
|
48
|
+
const defaultSelect = {
|
|
49
|
+
path: true,
|
|
50
|
+
data: true,
|
|
51
|
+
};
|
|
52
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
46
53
|
const client = getClient();
|
|
47
|
-
const result = await client.getAllRecord
|
|
48
|
-
.findMany({
|
|
49
|
-
select: {
|
|
50
|
-
path: true,
|
|
51
|
-
data: true,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
.execute();
|
|
54
|
+
const result = await client.getAllRecord.findMany(findManyArgs).execute();
|
|
55
55
|
console.log(JSON.stringify(result, null, 2));
|
|
56
56
|
}
|
|
57
57
|
catch (error) {
|
|
@@ -62,6 +62,25 @@ async function handleList(_argv, _prompter) {
|
|
|
62
62
|
process.exit(1);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
async function handleFindFirst(argv, _prompter) {
|
|
66
|
+
try {
|
|
67
|
+
const defaultSelect = {
|
|
68
|
+
path: true,
|
|
69
|
+
data: true,
|
|
70
|
+
};
|
|
71
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
72
|
+
const client = getClient();
|
|
73
|
+
const result = await client.getAllRecord.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
|
+
}
|
|
65
84
|
async function handleCreate(argv, prompter) {
|
|
66
85
|
try {
|
|
67
86
|
const rawAnswers = await prompter.prompt(argv, [
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { extractFirst } from 'inquirerer';
|
|
7
7
|
import { getClient } from '../executor';
|
|
8
|
-
import { coerceAnswers, stripUndefined } from '../utils';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
9
|
const fieldSchema = {
|
|
10
10
|
id: 'uuid',
|
|
11
11
|
databaseId: 'uuid',
|
|
@@ -28,7 +28,7 @@ const fieldSchema = {
|
|
|
28
28
|
isManagerOfFunction: 'string',
|
|
29
29
|
createdAt: 'string',
|
|
30
30
|
};
|
|
31
|
-
const usage = '\nhierarchy-module <command>\n\nCommands:\n list List
|
|
31
|
+
const usage = '\nhierarchy-module <command>\n\nCommands:\n list List hierarchyModule records\n find-first Find first matching hierarchyModule record\n get Get a hierarchyModule by ID\n create Create a new hierarchyModule\n update Update an existing hierarchyModule\n delete Delete a hierarchyModule\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\n --help, -h Show this help message\n';
|
|
32
32
|
export default async (argv, prompter, _options) => {
|
|
33
33
|
if (argv.help || argv.h) {
|
|
34
34
|
console.log(usage);
|
|
@@ -41,7 +41,7 @@ export default async (argv, prompter, _options) => {
|
|
|
41
41
|
type: 'autocomplete',
|
|
42
42
|
name: 'subcommand',
|
|
43
43
|
message: 'What do you want to do?',
|
|
44
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
44
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
45
45
|
},
|
|
46
46
|
]);
|
|
47
47
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -52,6 +52,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
52
52
|
switch (subcommand) {
|
|
53
53
|
case 'list':
|
|
54
54
|
return handleList(argv, prompter);
|
|
55
|
+
case 'find-first':
|
|
56
|
+
return handleFindFirst(argv, prompter);
|
|
55
57
|
case 'get':
|
|
56
58
|
return handleGet(argv, prompter);
|
|
57
59
|
case 'create':
|
|
@@ -65,35 +67,33 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
65
67
|
process.exit(1);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
async function handleList(
|
|
70
|
+
async function handleList(argv, _prompter) {
|
|
69
71
|
try {
|
|
72
|
+
const defaultSelect = {
|
|
73
|
+
id: true,
|
|
74
|
+
databaseId: true,
|
|
75
|
+
schemaId: true,
|
|
76
|
+
privateSchemaId: true,
|
|
77
|
+
chartEdgesTableId: true,
|
|
78
|
+
chartEdgesTableName: true,
|
|
79
|
+
hierarchySprtTableId: true,
|
|
80
|
+
hierarchySprtTableName: true,
|
|
81
|
+
chartEdgeGrantsTableId: true,
|
|
82
|
+
chartEdgeGrantsTableName: true,
|
|
83
|
+
entityTableId: true,
|
|
84
|
+
usersTableId: true,
|
|
85
|
+
prefix: true,
|
|
86
|
+
privateSchemaName: true,
|
|
87
|
+
sprtTableName: true,
|
|
88
|
+
rebuildHierarchyFunction: true,
|
|
89
|
+
getSubordinatesFunction: true,
|
|
90
|
+
getManagersFunction: true,
|
|
91
|
+
isManagerOfFunction: true,
|
|
92
|
+
createdAt: true,
|
|
93
|
+
};
|
|
94
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
70
95
|
const client = getClient();
|
|
71
|
-
const result = await client.hierarchyModule
|
|
72
|
-
.findMany({
|
|
73
|
-
select: {
|
|
74
|
-
id: true,
|
|
75
|
-
databaseId: true,
|
|
76
|
-
schemaId: true,
|
|
77
|
-
privateSchemaId: true,
|
|
78
|
-
chartEdgesTableId: true,
|
|
79
|
-
chartEdgesTableName: true,
|
|
80
|
-
hierarchySprtTableId: true,
|
|
81
|
-
hierarchySprtTableName: true,
|
|
82
|
-
chartEdgeGrantsTableId: true,
|
|
83
|
-
chartEdgeGrantsTableName: true,
|
|
84
|
-
entityTableId: true,
|
|
85
|
-
usersTableId: true,
|
|
86
|
-
prefix: true,
|
|
87
|
-
privateSchemaName: true,
|
|
88
|
-
sprtTableName: true,
|
|
89
|
-
rebuildHierarchyFunction: true,
|
|
90
|
-
getSubordinatesFunction: true,
|
|
91
|
-
getManagersFunction: true,
|
|
92
|
-
isManagerOfFunction: true,
|
|
93
|
-
createdAt: true,
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
.execute();
|
|
96
|
+
const result = await client.hierarchyModule.findMany(findManyArgs).execute();
|
|
97
97
|
console.log(JSON.stringify(result, null, 2));
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
@@ -104,6 +104,43 @@ async function handleList(_argv, _prompter) {
|
|
|
104
104
|
process.exit(1);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
async function handleFindFirst(argv, _prompter) {
|
|
108
|
+
try {
|
|
109
|
+
const defaultSelect = {
|
|
110
|
+
id: true,
|
|
111
|
+
databaseId: true,
|
|
112
|
+
schemaId: true,
|
|
113
|
+
privateSchemaId: true,
|
|
114
|
+
chartEdgesTableId: true,
|
|
115
|
+
chartEdgesTableName: true,
|
|
116
|
+
hierarchySprtTableId: true,
|
|
117
|
+
hierarchySprtTableName: true,
|
|
118
|
+
chartEdgeGrantsTableId: true,
|
|
119
|
+
chartEdgeGrantsTableName: true,
|
|
120
|
+
entityTableId: true,
|
|
121
|
+
usersTableId: true,
|
|
122
|
+
prefix: true,
|
|
123
|
+
privateSchemaName: true,
|
|
124
|
+
sprtTableName: true,
|
|
125
|
+
rebuildHierarchyFunction: true,
|
|
126
|
+
getSubordinatesFunction: true,
|
|
127
|
+
getManagersFunction: true,
|
|
128
|
+
isManagerOfFunction: true,
|
|
129
|
+
createdAt: true,
|
|
130
|
+
};
|
|
131
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
132
|
+
const client = getClient();
|
|
133
|
+
const result = await client.hierarchyModule.findFirst(findFirstArgs).execute();
|
|
134
|
+
console.log(JSON.stringify(result, null, 2));
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
console.error('Failed to find record.');
|
|
138
|
+
if (error instanceof Error) {
|
|
139
|
+
console.error(error.message);
|
|
140
|
+
}
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
107
144
|
async function handleGet(argv, prompter) {
|
|
108
145
|
try {
|
|
109
146
|
const answers = await prompter.prompt(argv, [
|