@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 = '\ntable <command>\n\nCommands:\n list List
|
|
30
|
+
const usage = '\ntable <command>\n\nCommands:\n list List table records\n find-first Find first matching table record\n get Get a table by ID\n create Create a new table\n update Update an existing table\n delete Delete a table\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
|
+
schemaId: true,
|
|
75
|
+
name: true,
|
|
76
|
+
label: true,
|
|
77
|
+
description: true,
|
|
78
|
+
smartTags: true,
|
|
79
|
+
category: true,
|
|
80
|
+
module: true,
|
|
81
|
+
scope: true,
|
|
82
|
+
useRls: true,
|
|
83
|
+
timestamps: true,
|
|
84
|
+
peoplestamps: true,
|
|
85
|
+
pluralName: true,
|
|
86
|
+
singularName: true,
|
|
87
|
+
tags: true,
|
|
88
|
+
inheritsId: true,
|
|
89
|
+
createdAt: true,
|
|
90
|
+
updatedAt: true,
|
|
91
|
+
};
|
|
92
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
69
93
|
const client = getClient();
|
|
70
|
-
const result = await client.table
|
|
71
|
-
.findMany({
|
|
72
|
-
select: {
|
|
73
|
-
id: true,
|
|
74
|
-
databaseId: true,
|
|
75
|
-
schemaId: true,
|
|
76
|
-
name: true,
|
|
77
|
-
label: true,
|
|
78
|
-
description: true,
|
|
79
|
-
smartTags: true,
|
|
80
|
-
category: true,
|
|
81
|
-
module: true,
|
|
82
|
-
scope: true,
|
|
83
|
-
useRls: true,
|
|
84
|
-
timestamps: true,
|
|
85
|
-
peoplestamps: true,
|
|
86
|
-
pluralName: true,
|
|
87
|
-
singularName: true,
|
|
88
|
-
tags: true,
|
|
89
|
-
inheritsId: true,
|
|
90
|
-
createdAt: true,
|
|
91
|
-
updatedAt: true,
|
|
92
|
-
},
|
|
93
|
-
})
|
|
94
|
-
.execute();
|
|
94
|
+
const result = await client.table.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
|
+
schemaId: true,
|
|
111
|
+
name: true,
|
|
112
|
+
label: true,
|
|
113
|
+
description: true,
|
|
114
|
+
smartTags: true,
|
|
115
|
+
category: true,
|
|
116
|
+
module: true,
|
|
117
|
+
scope: true,
|
|
118
|
+
useRls: true,
|
|
119
|
+
timestamps: true,
|
|
120
|
+
peoplestamps: true,
|
|
121
|
+
pluralName: true,
|
|
122
|
+
singularName: true,
|
|
123
|
+
tags: true,
|
|
124
|
+
inheritsId: true,
|
|
125
|
+
createdAt: true,
|
|
126
|
+
updatedAt: true,
|
|
127
|
+
};
|
|
128
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
129
|
+
const client = getClient();
|
|
130
|
+
const result = await client.table.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
|
databaseId: 'uuid',
|
|
@@ -14,7 +14,7 @@ const fieldSchema = {
|
|
|
14
14
|
createdAt: 'string',
|
|
15
15
|
updatedAt: 'string',
|
|
16
16
|
};
|
|
17
|
-
const usage = '\ntrigger-function <command>\n\nCommands:\n list List
|
|
17
|
+
const usage = '\ntrigger-function <command>\n\nCommands:\n list List triggerFunction records\n find-first Find first matching triggerFunction record\n get Get a triggerFunction by ID\n create Create a new triggerFunction\n update Update an existing triggerFunction\n delete Delete a triggerFunction\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';
|
|
18
18
|
export default async (argv, prompter, _options) => {
|
|
19
19
|
if (argv.help || argv.h) {
|
|
20
20
|
console.log(usage);
|
|
@@ -27,7 +27,7 @@ export default async (argv, prompter, _options) => {
|
|
|
27
27
|
type: 'autocomplete',
|
|
28
28
|
name: 'subcommand',
|
|
29
29
|
message: 'What do you want to do?',
|
|
30
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
30
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
31
31
|
},
|
|
32
32
|
]);
|
|
33
33
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -38,6 +38,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
38
38
|
switch (subcommand) {
|
|
39
39
|
case 'list':
|
|
40
40
|
return handleList(argv, prompter);
|
|
41
|
+
case 'find-first':
|
|
42
|
+
return handleFindFirst(argv, prompter);
|
|
41
43
|
case 'get':
|
|
42
44
|
return handleGet(argv, prompter);
|
|
43
45
|
case 'create':
|
|
@@ -51,21 +53,19 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
51
53
|
process.exit(1);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
async function handleList(
|
|
56
|
+
async function handleList(argv, _prompter) {
|
|
55
57
|
try {
|
|
58
|
+
const defaultSelect = {
|
|
59
|
+
id: true,
|
|
60
|
+
databaseId: true,
|
|
61
|
+
name: true,
|
|
62
|
+
code: true,
|
|
63
|
+
createdAt: true,
|
|
64
|
+
updatedAt: true,
|
|
65
|
+
};
|
|
66
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
56
67
|
const client = getClient();
|
|
57
|
-
const result = await client.triggerFunction
|
|
58
|
-
.findMany({
|
|
59
|
-
select: {
|
|
60
|
-
id: true,
|
|
61
|
-
databaseId: true,
|
|
62
|
-
name: true,
|
|
63
|
-
code: true,
|
|
64
|
-
createdAt: true,
|
|
65
|
-
updatedAt: true,
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
.execute();
|
|
68
|
+
const result = await client.triggerFunction.findMany(findManyArgs).execute();
|
|
69
69
|
console.log(JSON.stringify(result, null, 2));
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
@@ -76,6 +76,29 @@ async function handleList(_argv, _prompter) {
|
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
async function handleFindFirst(argv, _prompter) {
|
|
80
|
+
try {
|
|
81
|
+
const defaultSelect = {
|
|
82
|
+
id: true,
|
|
83
|
+
databaseId: true,
|
|
84
|
+
name: true,
|
|
85
|
+
code: true,
|
|
86
|
+
createdAt: true,
|
|
87
|
+
updatedAt: true,
|
|
88
|
+
};
|
|
89
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
90
|
+
const client = getClient();
|
|
91
|
+
const result = await client.triggerFunction.findFirst(findFirstArgs).execute();
|
|
92
|
+
console.log(JSON.stringify(result, null, 2));
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.error('Failed to find record.');
|
|
96
|
+
if (error instanceof Error) {
|
|
97
|
+
console.error(error.message);
|
|
98
|
+
}
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
79
102
|
async function handleGet(argv, prompter) {
|
|
80
103
|
try {
|
|
81
104
|
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',
|
|
@@ -21,7 +21,7 @@ const fieldSchema = {
|
|
|
21
21
|
createdAt: 'string',
|
|
22
22
|
updatedAt: 'string',
|
|
23
23
|
};
|
|
24
|
-
const usage = '\ntrigger <command>\n\nCommands:\n list List
|
|
24
|
+
const usage = '\ntrigger <command>\n\nCommands:\n list List trigger records\n find-first Find first matching trigger record\n get Get a trigger by ID\n create Create a new trigger\n update Update an existing trigger\n delete Delete a trigger\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';
|
|
25
25
|
export default async (argv, prompter, _options) => {
|
|
26
26
|
if (argv.help || argv.h) {
|
|
27
27
|
console.log(usage);
|
|
@@ -34,7 +34,7 @@ export default async (argv, prompter, _options) => {
|
|
|
34
34
|
type: 'autocomplete',
|
|
35
35
|
name: 'subcommand',
|
|
36
36
|
message: 'What do you want to do?',
|
|
37
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
37
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
38
38
|
},
|
|
39
39
|
]);
|
|
40
40
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -45,6 +45,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
45
45
|
switch (subcommand) {
|
|
46
46
|
case 'list':
|
|
47
47
|
return handleList(argv, prompter);
|
|
48
|
+
case 'find-first':
|
|
49
|
+
return handleFindFirst(argv, prompter);
|
|
48
50
|
case 'get':
|
|
49
51
|
return handleGet(argv, prompter);
|
|
50
52
|
case 'create':
|
|
@@ -58,28 +60,26 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
58
60
|
process.exit(1);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
|
-
async function handleList(
|
|
63
|
+
async function handleList(argv, _prompter) {
|
|
62
64
|
try {
|
|
65
|
+
const defaultSelect = {
|
|
66
|
+
id: true,
|
|
67
|
+
databaseId: true,
|
|
68
|
+
tableId: true,
|
|
69
|
+
name: true,
|
|
70
|
+
event: true,
|
|
71
|
+
functionName: true,
|
|
72
|
+
smartTags: true,
|
|
73
|
+
category: true,
|
|
74
|
+
module: true,
|
|
75
|
+
scope: true,
|
|
76
|
+
tags: true,
|
|
77
|
+
createdAt: true,
|
|
78
|
+
updatedAt: true,
|
|
79
|
+
};
|
|
80
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
63
81
|
const client = getClient();
|
|
64
|
-
const result = await client.trigger
|
|
65
|
-
.findMany({
|
|
66
|
-
select: {
|
|
67
|
-
id: true,
|
|
68
|
-
databaseId: true,
|
|
69
|
-
tableId: true,
|
|
70
|
-
name: true,
|
|
71
|
-
event: true,
|
|
72
|
-
functionName: true,
|
|
73
|
-
smartTags: true,
|
|
74
|
-
category: true,
|
|
75
|
-
module: true,
|
|
76
|
-
scope: true,
|
|
77
|
-
tags: true,
|
|
78
|
-
createdAt: true,
|
|
79
|
-
updatedAt: true,
|
|
80
|
-
},
|
|
81
|
-
})
|
|
82
|
-
.execute();
|
|
82
|
+
const result = await client.trigger.findMany(findManyArgs).execute();
|
|
83
83
|
console.log(JSON.stringify(result, null, 2));
|
|
84
84
|
}
|
|
85
85
|
catch (error) {
|
|
@@ -90,6 +90,36 @@ async function handleList(_argv, _prompter) {
|
|
|
90
90
|
process.exit(1);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
+
async function handleFindFirst(argv, _prompter) {
|
|
94
|
+
try {
|
|
95
|
+
const defaultSelect = {
|
|
96
|
+
id: true,
|
|
97
|
+
databaseId: true,
|
|
98
|
+
tableId: true,
|
|
99
|
+
name: true,
|
|
100
|
+
event: true,
|
|
101
|
+
functionName: true,
|
|
102
|
+
smartTags: true,
|
|
103
|
+
category: true,
|
|
104
|
+
module: true,
|
|
105
|
+
scope: true,
|
|
106
|
+
tags: true,
|
|
107
|
+
createdAt: true,
|
|
108
|
+
updatedAt: true,
|
|
109
|
+
};
|
|
110
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
111
|
+
const client = getClient();
|
|
112
|
+
const result = await client.trigger.findFirst(findFirstArgs).execute();
|
|
113
|
+
console.log(JSON.stringify(result, null, 2));
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Failed to find record.');
|
|
117
|
+
if (error instanceof Error) {
|
|
118
|
+
console.error(error.message);
|
|
119
|
+
}
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
93
123
|
async function handleGet(argv, prompter) {
|
|
94
124
|
try {
|
|
95
125
|
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
|
createdAt: 'string',
|
|
23
23
|
updatedAt: 'string',
|
|
24
24
|
};
|
|
25
|
-
const usage = '\nunique-constraint <command>\n\nCommands:\n list List
|
|
25
|
+
const usage = '\nunique-constraint <command>\n\nCommands:\n list List uniqueConstraint records\n find-first Find first matching uniqueConstraint record\n get Get a uniqueConstraint by ID\n create Create a new uniqueConstraint\n update Update an existing uniqueConstraint\n delete Delete a uniqueConstraint\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
|
+
tableId: true,
|
|
70
|
+
name: true,
|
|
71
|
+
description: true,
|
|
72
|
+
smartTags: true,
|
|
73
|
+
type: true,
|
|
74
|
+
fieldIds: true,
|
|
75
|
+
category: true,
|
|
76
|
+
module: true,
|
|
77
|
+
scope: true,
|
|
78
|
+
tags: true,
|
|
79
|
+
createdAt: true,
|
|
80
|
+
updatedAt: true,
|
|
81
|
+
};
|
|
82
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
64
83
|
const client = getClient();
|
|
65
|
-
const result = await client.uniqueConstraint
|
|
66
|
-
.findMany({
|
|
67
|
-
select: {
|
|
68
|
-
id: true,
|
|
69
|
-
databaseId: true,
|
|
70
|
-
tableId: true,
|
|
71
|
-
name: true,
|
|
72
|
-
description: true,
|
|
73
|
-
smartTags: true,
|
|
74
|
-
type: true,
|
|
75
|
-
fieldIds: true,
|
|
76
|
-
category: true,
|
|
77
|
-
module: true,
|
|
78
|
-
scope: true,
|
|
79
|
-
tags: true,
|
|
80
|
-
createdAt: true,
|
|
81
|
-
updatedAt: true,
|
|
82
|
-
},
|
|
83
|
-
})
|
|
84
|
-
.execute();
|
|
84
|
+
const result = await client.uniqueConstraint.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
|
+
tableId: true,
|
|
101
|
+
name: true,
|
|
102
|
+
description: true,
|
|
103
|
+
smartTags: true,
|
|
104
|
+
type: true,
|
|
105
|
+
fieldIds: true,
|
|
106
|
+
category: true,
|
|
107
|
+
module: true,
|
|
108
|
+
scope: true,
|
|
109
|
+
tags: true,
|
|
110
|
+
createdAt: true,
|
|
111
|
+
updatedAt: true,
|
|
112
|
+
};
|
|
113
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
114
|
+
const client = getClient();
|
|
115
|
+
const result = await client.uniqueConstraint.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
|
oneTimeTokenFunction: 'string',
|
|
35
35
|
extendTokenExpires: 'string',
|
|
36
36
|
};
|
|
37
|
-
const usage = '\nuser-auth-module <command>\n\nCommands:\n list List
|
|
37
|
+
const usage = '\nuser-auth-module <command>\n\nCommands:\n list List userAuthModule records\n find-first Find first matching userAuthModule record\n get Get a userAuthModule by ID\n create Create a new userAuthModule\n update Update an existing userAuthModule\n delete Delete a userAuthModule\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
|
+
emailsTableId: true,
|
|
83
|
+
usersTableId: true,
|
|
84
|
+
secretsTableId: true,
|
|
85
|
+
encryptedTableId: true,
|
|
86
|
+
sessionsTableId: true,
|
|
87
|
+
sessionCredentialsTableId: true,
|
|
88
|
+
auditsTableId: true,
|
|
89
|
+
auditsTableName: true,
|
|
90
|
+
signInFunction: true,
|
|
91
|
+
signUpFunction: true,
|
|
92
|
+
signOutFunction: true,
|
|
93
|
+
setPasswordFunction: true,
|
|
94
|
+
resetPasswordFunction: true,
|
|
95
|
+
forgotPasswordFunction: true,
|
|
96
|
+
sendVerificationEmailFunction: true,
|
|
97
|
+
verifyEmailFunction: true,
|
|
98
|
+
verifyPasswordFunction: true,
|
|
99
|
+
checkPasswordFunction: true,
|
|
100
|
+
sendAccountDeletionEmailFunction: true,
|
|
101
|
+
deleteAccountFunction: true,
|
|
102
|
+
signInOneTimeTokenFunction: true,
|
|
103
|
+
oneTimeTokenFunction: true,
|
|
104
|
+
extendTokenExpires: true,
|
|
105
|
+
};
|
|
106
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
76
107
|
const client = getClient();
|
|
77
|
-
const result = await client.userAuthModule
|
|
78
|
-
.findMany({
|
|
79
|
-
select: {
|
|
80
|
-
id: true,
|
|
81
|
-
databaseId: true,
|
|
82
|
-
schemaId: true,
|
|
83
|
-
emailsTableId: true,
|
|
84
|
-
usersTableId: true,
|
|
85
|
-
secretsTableId: true,
|
|
86
|
-
encryptedTableId: true,
|
|
87
|
-
sessionsTableId: true,
|
|
88
|
-
sessionCredentialsTableId: true,
|
|
89
|
-
auditsTableId: true,
|
|
90
|
-
auditsTableName: true,
|
|
91
|
-
signInFunction: true,
|
|
92
|
-
signUpFunction: true,
|
|
93
|
-
signOutFunction: true,
|
|
94
|
-
setPasswordFunction: true,
|
|
95
|
-
resetPasswordFunction: true,
|
|
96
|
-
forgotPasswordFunction: true,
|
|
97
|
-
sendVerificationEmailFunction: true,
|
|
98
|
-
verifyEmailFunction: true,
|
|
99
|
-
verifyPasswordFunction: true,
|
|
100
|
-
checkPasswordFunction: true,
|
|
101
|
-
sendAccountDeletionEmailFunction: true,
|
|
102
|
-
deleteAccountFunction: true,
|
|
103
|
-
signInOneTimeTokenFunction: true,
|
|
104
|
-
oneTimeTokenFunction: true,
|
|
105
|
-
extendTokenExpires: true,
|
|
106
|
-
},
|
|
107
|
-
})
|
|
108
|
-
.execute();
|
|
108
|
+
const result = await client.userAuthModule.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
|
+
emailsTableId: true,
|
|
126
|
+
usersTableId: true,
|
|
127
|
+
secretsTableId: true,
|
|
128
|
+
encryptedTableId: true,
|
|
129
|
+
sessionsTableId: true,
|
|
130
|
+
sessionCredentialsTableId: true,
|
|
131
|
+
auditsTableId: true,
|
|
132
|
+
auditsTableName: true,
|
|
133
|
+
signInFunction: true,
|
|
134
|
+
signUpFunction: true,
|
|
135
|
+
signOutFunction: true,
|
|
136
|
+
setPasswordFunction: true,
|
|
137
|
+
resetPasswordFunction: true,
|
|
138
|
+
forgotPasswordFunction: true,
|
|
139
|
+
sendVerificationEmailFunction: true,
|
|
140
|
+
verifyEmailFunction: true,
|
|
141
|
+
verifyPasswordFunction: true,
|
|
142
|
+
checkPasswordFunction: true,
|
|
143
|
+
sendAccountDeletionEmailFunction: true,
|
|
144
|
+
deleteAccountFunction: true,
|
|
145
|
+
signInOneTimeTokenFunction: true,
|
|
146
|
+
oneTimeTokenFunction: true,
|
|
147
|
+
extendTokenExpires: true,
|
|
148
|
+
};
|
|
149
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
150
|
+
const client = getClient();
|
|
151
|
+
const result = await client.userAuthModule.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, [
|