@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',
|
|
@@ -27,7 +27,7 @@ const fieldSchema = {
|
|
|
27
27
|
createdAt: 'string',
|
|
28
28
|
updatedAt: 'string',
|
|
29
29
|
};
|
|
30
|
-
const usage = '\nindex <command>\n\nCommands:\n list List
|
|
30
|
+
const usage = '\nindex <command>\n\nCommands:\n list List index records\n find-first Find first matching index record\n get Get a index by ID\n create Create a new index\n update Update an existing index\n delete Delete a index\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';
|
|
31
31
|
export default async (argv, prompter, _options) => {
|
|
32
32
|
if (argv.help || argv.h) {
|
|
33
33
|
console.log(usage);
|
|
@@ -40,7 +40,7 @@ export default async (argv, prompter, _options) => {
|
|
|
40
40
|
type: 'autocomplete',
|
|
41
41
|
name: 'subcommand',
|
|
42
42
|
message: 'What do you want to do?',
|
|
43
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
43
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
44
44
|
},
|
|
45
45
|
]);
|
|
46
46
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -51,6 +51,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
51
51
|
switch (subcommand) {
|
|
52
52
|
case 'list':
|
|
53
53
|
return handleList(argv, prompter);
|
|
54
|
+
case 'find-first':
|
|
55
|
+
return handleFindFirst(argv, prompter);
|
|
54
56
|
case 'get':
|
|
55
57
|
return handleGet(argv, prompter);
|
|
56
58
|
case 'create':
|
|
@@ -64,34 +66,32 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
64
66
|
process.exit(1);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
async function handleList(
|
|
69
|
+
async function handleList(argv, _prompter) {
|
|
68
70
|
try {
|
|
71
|
+
const defaultSelect = {
|
|
72
|
+
id: true,
|
|
73
|
+
databaseId: true,
|
|
74
|
+
tableId: true,
|
|
75
|
+
name: true,
|
|
76
|
+
fieldIds: true,
|
|
77
|
+
includeFieldIds: true,
|
|
78
|
+
accessMethod: true,
|
|
79
|
+
indexParams: true,
|
|
80
|
+
whereClause: true,
|
|
81
|
+
isUnique: true,
|
|
82
|
+
options: true,
|
|
83
|
+
opClasses: true,
|
|
84
|
+
smartTags: true,
|
|
85
|
+
category: true,
|
|
86
|
+
module: true,
|
|
87
|
+
scope: true,
|
|
88
|
+
tags: true,
|
|
89
|
+
createdAt: true,
|
|
90
|
+
updatedAt: true,
|
|
91
|
+
};
|
|
92
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
69
93
|
const client = getClient();
|
|
70
|
-
const result = await client.index
|
|
71
|
-
.findMany({
|
|
72
|
-
select: {
|
|
73
|
-
id: true,
|
|
74
|
-
databaseId: true,
|
|
75
|
-
tableId: true,
|
|
76
|
-
name: true,
|
|
77
|
-
fieldIds: true,
|
|
78
|
-
includeFieldIds: true,
|
|
79
|
-
accessMethod: true,
|
|
80
|
-
indexParams: true,
|
|
81
|
-
whereClause: true,
|
|
82
|
-
isUnique: true,
|
|
83
|
-
options: true,
|
|
84
|
-
opClasses: true,
|
|
85
|
-
smartTags: true,
|
|
86
|
-
category: true,
|
|
87
|
-
module: true,
|
|
88
|
-
scope: true,
|
|
89
|
-
tags: true,
|
|
90
|
-
createdAt: true,
|
|
91
|
-
updatedAt: true,
|
|
92
|
-
},
|
|
93
|
-
})
|
|
94
|
-
.execute();
|
|
94
|
+
const result = await client.index.findMany(findManyArgs).execute();
|
|
95
95
|
console.log(JSON.stringify(result, null, 2));
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
@@ -102,6 +102,42 @@ async function handleList(_argv, _prompter) {
|
|
|
102
102
|
process.exit(1);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
async function handleFindFirst(argv, _prompter) {
|
|
106
|
+
try {
|
|
107
|
+
const defaultSelect = {
|
|
108
|
+
id: true,
|
|
109
|
+
databaseId: true,
|
|
110
|
+
tableId: true,
|
|
111
|
+
name: true,
|
|
112
|
+
fieldIds: true,
|
|
113
|
+
includeFieldIds: true,
|
|
114
|
+
accessMethod: true,
|
|
115
|
+
indexParams: true,
|
|
116
|
+
whereClause: true,
|
|
117
|
+
isUnique: true,
|
|
118
|
+
options: true,
|
|
119
|
+
opClasses: true,
|
|
120
|
+
smartTags: true,
|
|
121
|
+
category: true,
|
|
122
|
+
module: true,
|
|
123
|
+
scope: true,
|
|
124
|
+
tags: true,
|
|
125
|
+
createdAt: true,
|
|
126
|
+
updatedAt: true,
|
|
127
|
+
};
|
|
128
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
129
|
+
const client = getClient();
|
|
130
|
+
const result = await client.index.findFirst(findFirstArgs).execute();
|
|
131
|
+
console.log(JSON.stringify(result, null, 2));
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error('Failed to find record.');
|
|
135
|
+
if (error instanceof Error) {
|
|
136
|
+
console.error(error.message);
|
|
137
|
+
}
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
105
141
|
async function handleGet(argv, prompter) {
|
|
106
142
|
try {
|
|
107
143
|
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
|
email: 'string',
|
|
@@ -20,7 +20,7 @@ const fieldSchema = {
|
|
|
20
20
|
createdAt: 'string',
|
|
21
21
|
updatedAt: 'string',
|
|
22
22
|
};
|
|
23
|
-
const usage = '\ninvite <command>\n\nCommands:\n list List
|
|
23
|
+
const usage = '\ninvite <command>\n\nCommands:\n list List invite records\n find-first Find first matching invite record\n get Get a invite by ID\n create Create a new invite\n update Update an existing invite\n delete Delete a invite\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';
|
|
24
24
|
export default async (argv, prompter, _options) => {
|
|
25
25
|
if (argv.help || argv.h) {
|
|
26
26
|
console.log(usage);
|
|
@@ -33,7 +33,7 @@ export default async (argv, prompter, _options) => {
|
|
|
33
33
|
type: 'autocomplete',
|
|
34
34
|
name: 'subcommand',
|
|
35
35
|
message: 'What do you want to do?',
|
|
36
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
36
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
37
37
|
},
|
|
38
38
|
]);
|
|
39
39
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -44,6 +44,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
44
44
|
switch (subcommand) {
|
|
45
45
|
case 'list':
|
|
46
46
|
return handleList(argv, prompter);
|
|
47
|
+
case 'find-first':
|
|
48
|
+
return handleFindFirst(argv, prompter);
|
|
47
49
|
case 'get':
|
|
48
50
|
return handleGet(argv, prompter);
|
|
49
51
|
case 'create':
|
|
@@ -57,27 +59,25 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
57
59
|
process.exit(1);
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
async function handleList(
|
|
62
|
+
async function handleList(argv, _prompter) {
|
|
61
63
|
try {
|
|
64
|
+
const defaultSelect = {
|
|
65
|
+
id: true,
|
|
66
|
+
email: true,
|
|
67
|
+
senderId: true,
|
|
68
|
+
inviteToken: true,
|
|
69
|
+
inviteValid: true,
|
|
70
|
+
inviteLimit: true,
|
|
71
|
+
inviteCount: true,
|
|
72
|
+
multiple: true,
|
|
73
|
+
data: true,
|
|
74
|
+
expiresAt: true,
|
|
75
|
+
createdAt: true,
|
|
76
|
+
updatedAt: true,
|
|
77
|
+
};
|
|
78
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
62
79
|
const client = getClient();
|
|
63
|
-
const result = await client.invite
|
|
64
|
-
.findMany({
|
|
65
|
-
select: {
|
|
66
|
-
id: true,
|
|
67
|
-
email: true,
|
|
68
|
-
senderId: true,
|
|
69
|
-
inviteToken: true,
|
|
70
|
-
inviteValid: true,
|
|
71
|
-
inviteLimit: true,
|
|
72
|
-
inviteCount: true,
|
|
73
|
-
multiple: true,
|
|
74
|
-
data: true,
|
|
75
|
-
expiresAt: true,
|
|
76
|
-
createdAt: true,
|
|
77
|
-
updatedAt: true,
|
|
78
|
-
},
|
|
79
|
-
})
|
|
80
|
-
.execute();
|
|
80
|
+
const result = await client.invite.findMany(findManyArgs).execute();
|
|
81
81
|
console.log(JSON.stringify(result, null, 2));
|
|
82
82
|
}
|
|
83
83
|
catch (error) {
|
|
@@ -88,6 +88,35 @@ async function handleList(_argv, _prompter) {
|
|
|
88
88
|
process.exit(1);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
async function handleFindFirst(argv, _prompter) {
|
|
92
|
+
try {
|
|
93
|
+
const defaultSelect = {
|
|
94
|
+
id: true,
|
|
95
|
+
email: true,
|
|
96
|
+
senderId: true,
|
|
97
|
+
inviteToken: true,
|
|
98
|
+
inviteValid: true,
|
|
99
|
+
inviteLimit: true,
|
|
100
|
+
inviteCount: true,
|
|
101
|
+
multiple: true,
|
|
102
|
+
data: true,
|
|
103
|
+
expiresAt: true,
|
|
104
|
+
createdAt: true,
|
|
105
|
+
updatedAt: true,
|
|
106
|
+
};
|
|
107
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
108
|
+
const client = getClient();
|
|
109
|
+
const result = await client.invite.findFirst(findFirstArgs).execute();
|
|
110
|
+
console.log(JSON.stringify(result, null, 2));
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error('Failed to find record.');
|
|
114
|
+
if (error instanceof Error) {
|
|
115
|
+
console.error(error.message);
|
|
116
|
+
}
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
91
120
|
async function handleGet(argv, prompter) {
|
|
92
121
|
try {
|
|
93
122
|
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',
|
|
@@ -22,7 +22,7 @@ const fieldSchema = {
|
|
|
22
22
|
membershipType: 'int',
|
|
23
23
|
entityTableId: 'uuid',
|
|
24
24
|
};
|
|
25
|
-
const usage = '\ninvites-module <command>\n\nCommands:\n list List
|
|
25
|
+
const usage = '\ninvites-module <command>\n\nCommands:\n list List invitesModule records\n find-first Find first matching invitesModule record\n get Get a invitesModule by ID\n create Create a new invitesModule\n update Update an existing invitesModule\n delete Delete a invitesModule\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';
|
|
26
26
|
export default async (argv, prompter, _options) => {
|
|
27
27
|
if (argv.help || argv.h) {
|
|
28
28
|
console.log(usage);
|
|
@@ -35,7 +35,7 @@ export default async (argv, prompter, _options) => {
|
|
|
35
35
|
type: 'autocomplete',
|
|
36
36
|
name: 'subcommand',
|
|
37
37
|
message: 'What do you want to do?',
|
|
38
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
38
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
39
39
|
},
|
|
40
40
|
]);
|
|
41
41
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -46,6 +46,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
46
46
|
switch (subcommand) {
|
|
47
47
|
case 'list':
|
|
48
48
|
return handleList(argv, prompter);
|
|
49
|
+
case 'find-first':
|
|
50
|
+
return handleFindFirst(argv, prompter);
|
|
49
51
|
case 'get':
|
|
50
52
|
return handleGet(argv, prompter);
|
|
51
53
|
case 'create':
|
|
@@ -59,29 +61,27 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
59
61
|
process.exit(1);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
async function handleList(
|
|
64
|
+
async function handleList(argv, _prompter) {
|
|
63
65
|
try {
|
|
66
|
+
const defaultSelect = {
|
|
67
|
+
id: true,
|
|
68
|
+
databaseId: true,
|
|
69
|
+
schemaId: true,
|
|
70
|
+
privateSchemaId: true,
|
|
71
|
+
emailsTableId: true,
|
|
72
|
+
usersTableId: true,
|
|
73
|
+
invitesTableId: true,
|
|
74
|
+
claimedInvitesTableId: true,
|
|
75
|
+
invitesTableName: true,
|
|
76
|
+
claimedInvitesTableName: true,
|
|
77
|
+
submitInviteCodeFunction: true,
|
|
78
|
+
prefix: true,
|
|
79
|
+
membershipType: true,
|
|
80
|
+
entityTableId: true,
|
|
81
|
+
};
|
|
82
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
64
83
|
const client = getClient();
|
|
65
|
-
const result = await client.invitesModule
|
|
66
|
-
.findMany({
|
|
67
|
-
select: {
|
|
68
|
-
id: true,
|
|
69
|
-
databaseId: true,
|
|
70
|
-
schemaId: true,
|
|
71
|
-
privateSchemaId: true,
|
|
72
|
-
emailsTableId: true,
|
|
73
|
-
usersTableId: true,
|
|
74
|
-
invitesTableId: true,
|
|
75
|
-
claimedInvitesTableId: true,
|
|
76
|
-
invitesTableName: true,
|
|
77
|
-
claimedInvitesTableName: true,
|
|
78
|
-
submitInviteCodeFunction: true,
|
|
79
|
-
prefix: true,
|
|
80
|
-
membershipType: true,
|
|
81
|
-
entityTableId: true,
|
|
82
|
-
},
|
|
83
|
-
})
|
|
84
|
-
.execute();
|
|
84
|
+
const result = await client.invitesModule.findMany(findManyArgs).execute();
|
|
85
85
|
console.log(JSON.stringify(result, null, 2));
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
@@ -92,6 +92,37 @@ async function handleList(_argv, _prompter) {
|
|
|
92
92
|
process.exit(1);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
async function handleFindFirst(argv, _prompter) {
|
|
96
|
+
try {
|
|
97
|
+
const defaultSelect = {
|
|
98
|
+
id: true,
|
|
99
|
+
databaseId: true,
|
|
100
|
+
schemaId: true,
|
|
101
|
+
privateSchemaId: true,
|
|
102
|
+
emailsTableId: true,
|
|
103
|
+
usersTableId: true,
|
|
104
|
+
invitesTableId: true,
|
|
105
|
+
claimedInvitesTableId: true,
|
|
106
|
+
invitesTableName: true,
|
|
107
|
+
claimedInvitesTableName: true,
|
|
108
|
+
submitInviteCodeFunction: true,
|
|
109
|
+
prefix: true,
|
|
110
|
+
membershipType: true,
|
|
111
|
+
entityTableId: true,
|
|
112
|
+
};
|
|
113
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
114
|
+
const client = getClient();
|
|
115
|
+
const result = await client.invitesModule.findFirst(findFirstArgs).execute();
|
|
116
|
+
console.log(JSON.stringify(result, null, 2));
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
console.error('Failed to find record.');
|
|
120
|
+
if (error instanceof Error) {
|
|
121
|
+
console.error(error.message);
|
|
122
|
+
}
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
95
126
|
async function handleGet(argv, prompter) {
|
|
96
127
|
try {
|
|
97
128
|
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',
|
|
@@ -34,7 +34,7 @@ const fieldSchema = {
|
|
|
34
34
|
entityTableId: 'uuid',
|
|
35
35
|
actorTableId: 'uuid',
|
|
36
36
|
};
|
|
37
|
-
const usage = '\nlevels-module <command>\n\nCommands:\n list List
|
|
37
|
+
const usage = '\nlevels-module <command>\n\nCommands:\n list List levelsModule records\n find-first Find first matching levelsModule record\n get Get a levelsModule by ID\n create Create a new levelsModule\n update Update an existing levelsModule\n delete Delete a levelsModule\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';
|
|
38
38
|
export default async (argv, prompter, _options) => {
|
|
39
39
|
if (argv.help || argv.h) {
|
|
40
40
|
console.log(usage);
|
|
@@ -47,7 +47,7 @@ export default async (argv, prompter, _options) => {
|
|
|
47
47
|
type: 'autocomplete',
|
|
48
48
|
name: 'subcommand',
|
|
49
49
|
message: 'What do you want to do?',
|
|
50
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
50
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
51
51
|
},
|
|
52
52
|
]);
|
|
53
53
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -58,6 +58,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
58
58
|
switch (subcommand) {
|
|
59
59
|
case 'list':
|
|
60
60
|
return handleList(argv, prompter);
|
|
61
|
+
case 'find-first':
|
|
62
|
+
return handleFindFirst(argv, prompter);
|
|
61
63
|
case 'get':
|
|
62
64
|
return handleGet(argv, prompter);
|
|
63
65
|
case 'create':
|
|
@@ -71,41 +73,39 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
71
73
|
process.exit(1);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
|
-
async function handleList(
|
|
76
|
+
async function handleList(argv, _prompter) {
|
|
75
77
|
try {
|
|
78
|
+
const defaultSelect = {
|
|
79
|
+
id: true,
|
|
80
|
+
databaseId: true,
|
|
81
|
+
schemaId: true,
|
|
82
|
+
privateSchemaId: true,
|
|
83
|
+
stepsTableId: true,
|
|
84
|
+
stepsTableName: true,
|
|
85
|
+
achievementsTableId: true,
|
|
86
|
+
achievementsTableName: true,
|
|
87
|
+
levelsTableId: true,
|
|
88
|
+
levelsTableName: true,
|
|
89
|
+
levelRequirementsTableId: true,
|
|
90
|
+
levelRequirementsTableName: true,
|
|
91
|
+
completedStep: true,
|
|
92
|
+
incompletedStep: true,
|
|
93
|
+
tgAchievement: true,
|
|
94
|
+
tgAchievementToggle: true,
|
|
95
|
+
tgAchievementToggleBoolean: true,
|
|
96
|
+
tgAchievementBoolean: true,
|
|
97
|
+
upsertAchievement: true,
|
|
98
|
+
tgUpdateAchievements: true,
|
|
99
|
+
stepsRequired: true,
|
|
100
|
+
levelAchieved: true,
|
|
101
|
+
prefix: true,
|
|
102
|
+
membershipType: true,
|
|
103
|
+
entityTableId: true,
|
|
104
|
+
actorTableId: true,
|
|
105
|
+
};
|
|
106
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
76
107
|
const client = getClient();
|
|
77
|
-
const result = await client.levelsModule
|
|
78
|
-
.findMany({
|
|
79
|
-
select: {
|
|
80
|
-
id: true,
|
|
81
|
-
databaseId: true,
|
|
82
|
-
schemaId: true,
|
|
83
|
-
privateSchemaId: true,
|
|
84
|
-
stepsTableId: true,
|
|
85
|
-
stepsTableName: true,
|
|
86
|
-
achievementsTableId: true,
|
|
87
|
-
achievementsTableName: true,
|
|
88
|
-
levelsTableId: true,
|
|
89
|
-
levelsTableName: true,
|
|
90
|
-
levelRequirementsTableId: true,
|
|
91
|
-
levelRequirementsTableName: true,
|
|
92
|
-
completedStep: true,
|
|
93
|
-
incompletedStep: true,
|
|
94
|
-
tgAchievement: true,
|
|
95
|
-
tgAchievementToggle: true,
|
|
96
|
-
tgAchievementToggleBoolean: true,
|
|
97
|
-
tgAchievementBoolean: true,
|
|
98
|
-
upsertAchievement: true,
|
|
99
|
-
tgUpdateAchievements: true,
|
|
100
|
-
stepsRequired: true,
|
|
101
|
-
levelAchieved: true,
|
|
102
|
-
prefix: true,
|
|
103
|
-
membershipType: true,
|
|
104
|
-
entityTableId: true,
|
|
105
|
-
actorTableId: true,
|
|
106
|
-
},
|
|
107
|
-
})
|
|
108
|
-
.execute();
|
|
108
|
+
const result = await client.levelsModule.findMany(findManyArgs).execute();
|
|
109
109
|
console.log(JSON.stringify(result, null, 2));
|
|
110
110
|
}
|
|
111
111
|
catch (error) {
|
|
@@ -116,6 +116,49 @@ async function handleList(_argv, _prompter) {
|
|
|
116
116
|
process.exit(1);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
+
async function handleFindFirst(argv, _prompter) {
|
|
120
|
+
try {
|
|
121
|
+
const defaultSelect = {
|
|
122
|
+
id: true,
|
|
123
|
+
databaseId: true,
|
|
124
|
+
schemaId: true,
|
|
125
|
+
privateSchemaId: true,
|
|
126
|
+
stepsTableId: true,
|
|
127
|
+
stepsTableName: true,
|
|
128
|
+
achievementsTableId: true,
|
|
129
|
+
achievementsTableName: true,
|
|
130
|
+
levelsTableId: true,
|
|
131
|
+
levelsTableName: true,
|
|
132
|
+
levelRequirementsTableId: true,
|
|
133
|
+
levelRequirementsTableName: true,
|
|
134
|
+
completedStep: true,
|
|
135
|
+
incompletedStep: true,
|
|
136
|
+
tgAchievement: true,
|
|
137
|
+
tgAchievementToggle: true,
|
|
138
|
+
tgAchievementToggleBoolean: true,
|
|
139
|
+
tgAchievementBoolean: true,
|
|
140
|
+
upsertAchievement: true,
|
|
141
|
+
tgUpdateAchievements: true,
|
|
142
|
+
stepsRequired: true,
|
|
143
|
+
levelAchieved: true,
|
|
144
|
+
prefix: true,
|
|
145
|
+
membershipType: true,
|
|
146
|
+
entityTableId: true,
|
|
147
|
+
actorTableId: true,
|
|
148
|
+
};
|
|
149
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
150
|
+
const client = getClient();
|
|
151
|
+
const result = await client.levelsModule.findFirst(findFirstArgs).execute();
|
|
152
|
+
console.log(JSON.stringify(result, null, 2));
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
console.error('Failed to find record.');
|
|
156
|
+
if (error instanceof Error) {
|
|
157
|
+
console.error(error.message);
|
|
158
|
+
}
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
119
162
|
async function handleGet(argv, prompter) {
|
|
120
163
|
try {
|
|
121
164
|
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
|
entityTableId: 'uuid',
|
|
27
27
|
actorTableId: 'uuid',
|
|
28
28
|
};
|
|
29
|
-
const usage = '\nlimits-module <command>\n\nCommands:\n list List
|
|
29
|
+
const usage = '\nlimits-module <command>\n\nCommands:\n list List limitsModule records\n find-first Find first matching limitsModule record\n get Get a limitsModule by ID\n create Create a new limitsModule\n update Update an existing limitsModule\n delete Delete a limitsModule\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
|
+
schemaId: true,
|
|
74
|
+
privateSchemaId: true,
|
|
75
|
+
tableId: true,
|
|
76
|
+
tableName: true,
|
|
77
|
+
defaultTableId: true,
|
|
78
|
+
defaultTableName: true,
|
|
79
|
+
limitIncrementFunction: true,
|
|
80
|
+
limitDecrementFunction: true,
|
|
81
|
+
limitIncrementTrigger: true,
|
|
82
|
+
limitDecrementTrigger: true,
|
|
83
|
+
limitUpdateTrigger: true,
|
|
84
|
+
limitCheckFunction: true,
|
|
85
|
+
prefix: true,
|
|
86
|
+
membershipType: true,
|
|
87
|
+
entityTableId: true,
|
|
88
|
+
actorTableId: true,
|
|
89
|
+
};
|
|
90
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
68
91
|
const client = getClient();
|
|
69
|
-
const result = await client.limitsModule
|
|
70
|
-
.findMany({
|
|
71
|
-
select: {
|
|
72
|
-
id: true,
|
|
73
|
-
databaseId: true,
|
|
74
|
-
schemaId: true,
|
|
75
|
-
privateSchemaId: true,
|
|
76
|
-
tableId: true,
|
|
77
|
-
tableName: true,
|
|
78
|
-
defaultTableId: true,
|
|
79
|
-
defaultTableName: true,
|
|
80
|
-
limitIncrementFunction: true,
|
|
81
|
-
limitDecrementFunction: true,
|
|
82
|
-
limitIncrementTrigger: true,
|
|
83
|
-
limitDecrementTrigger: true,
|
|
84
|
-
limitUpdateTrigger: true,
|
|
85
|
-
limitCheckFunction: true,
|
|
86
|
-
prefix: true,
|
|
87
|
-
membershipType: true,
|
|
88
|
-
entityTableId: true,
|
|
89
|
-
actorTableId: true,
|
|
90
|
-
},
|
|
91
|
-
})
|
|
92
|
-
.execute();
|
|
92
|
+
const result = await client.limitsModule.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
|
+
schemaId: true,
|
|
109
|
+
privateSchemaId: true,
|
|
110
|
+
tableId: true,
|
|
111
|
+
tableName: true,
|
|
112
|
+
defaultTableId: true,
|
|
113
|
+
defaultTableName: true,
|
|
114
|
+
limitIncrementFunction: true,
|
|
115
|
+
limitDecrementFunction: true,
|
|
116
|
+
limitIncrementTrigger: true,
|
|
117
|
+
limitDecrementTrigger: true,
|
|
118
|
+
limitUpdateTrigger: true,
|
|
119
|
+
limitCheckFunction: true,
|
|
120
|
+
prefix: true,
|
|
121
|
+
membershipType: true,
|
|
122
|
+
entityTableId: true,
|
|
123
|
+
actorTableId: true,
|
|
124
|
+
};
|
|
125
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
126
|
+
const client = getClient();
|
|
127
|
+
const result = await client.limitsModule.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, [
|