@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
|
@@ -16,7 +16,7 @@ const fieldSchema = {
|
|
|
16
16
|
createdAt: 'string',
|
|
17
17
|
updatedAt: 'string',
|
|
18
18
|
};
|
|
19
|
-
const usage = '\ntrigger-function <command>\n\nCommands:\n list List
|
|
19
|
+
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';
|
|
20
20
|
exports.default = async (argv, prompter, _options) => {
|
|
21
21
|
if (argv.help || argv.h) {
|
|
22
22
|
console.log(usage);
|
|
@@ -29,7 +29,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
29
29
|
type: 'autocomplete',
|
|
30
30
|
name: 'subcommand',
|
|
31
31
|
message: 'What do you want to do?',
|
|
32
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
32
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
33
33
|
},
|
|
34
34
|
]);
|
|
35
35
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -40,6 +40,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
40
40
|
switch (subcommand) {
|
|
41
41
|
case 'list':
|
|
42
42
|
return handleList(argv, prompter);
|
|
43
|
+
case 'find-first':
|
|
44
|
+
return handleFindFirst(argv, prompter);
|
|
43
45
|
case 'get':
|
|
44
46
|
return handleGet(argv, prompter);
|
|
45
47
|
case 'create':
|
|
@@ -53,21 +55,19 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
53
55
|
process.exit(1);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
|
-
async function handleList(
|
|
58
|
+
async function handleList(argv, _prompter) {
|
|
57
59
|
try {
|
|
60
|
+
const defaultSelect = {
|
|
61
|
+
id: true,
|
|
62
|
+
databaseId: true,
|
|
63
|
+
name: true,
|
|
64
|
+
code: true,
|
|
65
|
+
createdAt: true,
|
|
66
|
+
updatedAt: true,
|
|
67
|
+
};
|
|
68
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
58
69
|
const client = (0, executor_1.getClient)();
|
|
59
|
-
const result = await client.triggerFunction
|
|
60
|
-
.findMany({
|
|
61
|
-
select: {
|
|
62
|
-
id: true,
|
|
63
|
-
databaseId: true,
|
|
64
|
-
name: true,
|
|
65
|
-
code: true,
|
|
66
|
-
createdAt: true,
|
|
67
|
-
updatedAt: true,
|
|
68
|
-
},
|
|
69
|
-
})
|
|
70
|
-
.execute();
|
|
70
|
+
const result = await client.triggerFunction.findMany(findManyArgs).execute();
|
|
71
71
|
console.log(JSON.stringify(result, null, 2));
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
@@ -78,6 +78,29 @@ async function handleList(_argv, _prompter) {
|
|
|
78
78
|
process.exit(1);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
async function handleFindFirst(argv, _prompter) {
|
|
82
|
+
try {
|
|
83
|
+
const defaultSelect = {
|
|
84
|
+
id: true,
|
|
85
|
+
databaseId: true,
|
|
86
|
+
name: true,
|
|
87
|
+
code: true,
|
|
88
|
+
createdAt: true,
|
|
89
|
+
updatedAt: true,
|
|
90
|
+
};
|
|
91
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
92
|
+
const client = (0, executor_1.getClient)();
|
|
93
|
+
const result = await client.triggerFunction.findFirst(findFirstArgs).execute();
|
|
94
|
+
console.log(JSON.stringify(result, null, 2));
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('Failed to find record.');
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
console.error(error.message);
|
|
100
|
+
}
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
81
104
|
async function handleGet(argv, prompter) {
|
|
82
105
|
try {
|
|
83
106
|
const answers = await prompter.prompt(argv, [
|
|
@@ -23,7 +23,7 @@ const fieldSchema = {
|
|
|
23
23
|
createdAt: 'string',
|
|
24
24
|
updatedAt: 'string',
|
|
25
25
|
};
|
|
26
|
-
const usage = '\ntrigger <command>\n\nCommands:\n list List
|
|
26
|
+
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';
|
|
27
27
|
exports.default = async (argv, prompter, _options) => {
|
|
28
28
|
if (argv.help || argv.h) {
|
|
29
29
|
console.log(usage);
|
|
@@ -36,7 +36,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
36
36
|
type: 'autocomplete',
|
|
37
37
|
name: 'subcommand',
|
|
38
38
|
message: 'What do you want to do?',
|
|
39
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
39
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
40
40
|
},
|
|
41
41
|
]);
|
|
42
42
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -47,6 +47,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
47
47
|
switch (subcommand) {
|
|
48
48
|
case 'list':
|
|
49
49
|
return handleList(argv, prompter);
|
|
50
|
+
case 'find-first':
|
|
51
|
+
return handleFindFirst(argv, prompter);
|
|
50
52
|
case 'get':
|
|
51
53
|
return handleGet(argv, prompter);
|
|
52
54
|
case 'create':
|
|
@@ -60,28 +62,26 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
60
62
|
process.exit(1);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
async function handleList(
|
|
65
|
+
async function handleList(argv, _prompter) {
|
|
64
66
|
try {
|
|
67
|
+
const defaultSelect = {
|
|
68
|
+
id: true,
|
|
69
|
+
databaseId: true,
|
|
70
|
+
tableId: true,
|
|
71
|
+
name: true,
|
|
72
|
+
event: true,
|
|
73
|
+
functionName: true,
|
|
74
|
+
smartTags: true,
|
|
75
|
+
category: true,
|
|
76
|
+
module: true,
|
|
77
|
+
scope: true,
|
|
78
|
+
tags: true,
|
|
79
|
+
createdAt: true,
|
|
80
|
+
updatedAt: true,
|
|
81
|
+
};
|
|
82
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
65
83
|
const client = (0, executor_1.getClient)();
|
|
66
|
-
const result = await client.trigger
|
|
67
|
-
.findMany({
|
|
68
|
-
select: {
|
|
69
|
-
id: true,
|
|
70
|
-
databaseId: true,
|
|
71
|
-
tableId: true,
|
|
72
|
-
name: true,
|
|
73
|
-
event: true,
|
|
74
|
-
functionName: true,
|
|
75
|
-
smartTags: 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.trigger.findMany(findManyArgs).execute();
|
|
85
85
|
console.log(JSON.stringify(result, null, 2));
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
@@ -92,6 +92,36 @@ 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
|
+
event: true,
|
|
103
|
+
functionName: true,
|
|
104
|
+
smartTags: true,
|
|
105
|
+
category: true,
|
|
106
|
+
module: true,
|
|
107
|
+
scope: true,
|
|
108
|
+
tags: true,
|
|
109
|
+
createdAt: true,
|
|
110
|
+
updatedAt: true,
|
|
111
|
+
};
|
|
112
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
113
|
+
const client = (0, executor_1.getClient)();
|
|
114
|
+
const result = await client.trigger.findFirst(findFirstArgs).execute();
|
|
115
|
+
console.log(JSON.stringify(result, null, 2));
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error('Failed to find record.');
|
|
119
|
+
if (error instanceof Error) {
|
|
120
|
+
console.error(error.message);
|
|
121
|
+
}
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
95
125
|
async function handleGet(argv, prompter) {
|
|
96
126
|
try {
|
|
97
127
|
const answers = await prompter.prompt(argv, [
|
|
@@ -24,7 +24,7 @@ const fieldSchema = {
|
|
|
24
24
|
createdAt: 'string',
|
|
25
25
|
updatedAt: 'string',
|
|
26
26
|
};
|
|
27
|
-
const usage = '\nunique-constraint <command>\n\nCommands:\n list List
|
|
27
|
+
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';
|
|
28
28
|
exports.default = async (argv, prompter, _options) => {
|
|
29
29
|
if (argv.help || argv.h) {
|
|
30
30
|
console.log(usage);
|
|
@@ -37,7 +37,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
37
37
|
type: 'autocomplete',
|
|
38
38
|
name: 'subcommand',
|
|
39
39
|
message: 'What do you want to do?',
|
|
40
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
40
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
41
41
|
},
|
|
42
42
|
]);
|
|
43
43
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -48,6 +48,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
48
48
|
switch (subcommand) {
|
|
49
49
|
case 'list':
|
|
50
50
|
return handleList(argv, prompter);
|
|
51
|
+
case 'find-first':
|
|
52
|
+
return handleFindFirst(argv, prompter);
|
|
51
53
|
case 'get':
|
|
52
54
|
return handleGet(argv, prompter);
|
|
53
55
|
case 'create':
|
|
@@ -61,29 +63,27 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
61
63
|
process.exit(1);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
async function handleList(
|
|
66
|
+
async function handleList(argv, _prompter) {
|
|
65
67
|
try {
|
|
68
|
+
const defaultSelect = {
|
|
69
|
+
id: true,
|
|
70
|
+
databaseId: true,
|
|
71
|
+
tableId: true,
|
|
72
|
+
name: true,
|
|
73
|
+
description: true,
|
|
74
|
+
smartTags: true,
|
|
75
|
+
type: true,
|
|
76
|
+
fieldIds: true,
|
|
77
|
+
category: true,
|
|
78
|
+
module: true,
|
|
79
|
+
scope: true,
|
|
80
|
+
tags: true,
|
|
81
|
+
createdAt: true,
|
|
82
|
+
updatedAt: true,
|
|
83
|
+
};
|
|
84
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
66
85
|
const client = (0, executor_1.getClient)();
|
|
67
|
-
const result = await client.uniqueConstraint
|
|
68
|
-
.findMany({
|
|
69
|
-
select: {
|
|
70
|
-
id: true,
|
|
71
|
-
databaseId: true,
|
|
72
|
-
tableId: true,
|
|
73
|
-
name: true,
|
|
74
|
-
description: true,
|
|
75
|
-
smartTags: true,
|
|
76
|
-
type: true,
|
|
77
|
-
fieldIds: true,
|
|
78
|
-
category: true,
|
|
79
|
-
module: true,
|
|
80
|
-
scope: true,
|
|
81
|
-
tags: true,
|
|
82
|
-
createdAt: true,
|
|
83
|
-
updatedAt: true,
|
|
84
|
-
},
|
|
85
|
-
})
|
|
86
|
-
.execute();
|
|
86
|
+
const result = await client.uniqueConstraint.findMany(findManyArgs).execute();
|
|
87
87
|
console.log(JSON.stringify(result, null, 2));
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
@@ -94,6 +94,37 @@ async function handleList(_argv, _prompter) {
|
|
|
94
94
|
process.exit(1);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
+
async function handleFindFirst(argv, _prompter) {
|
|
98
|
+
try {
|
|
99
|
+
const defaultSelect = {
|
|
100
|
+
id: true,
|
|
101
|
+
databaseId: true,
|
|
102
|
+
tableId: true,
|
|
103
|
+
name: true,
|
|
104
|
+
description: true,
|
|
105
|
+
smartTags: true,
|
|
106
|
+
type: true,
|
|
107
|
+
fieldIds: true,
|
|
108
|
+
category: true,
|
|
109
|
+
module: true,
|
|
110
|
+
scope: true,
|
|
111
|
+
tags: true,
|
|
112
|
+
createdAt: true,
|
|
113
|
+
updatedAt: true,
|
|
114
|
+
};
|
|
115
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
116
|
+
const client = (0, executor_1.getClient)();
|
|
117
|
+
const result = await client.uniqueConstraint.findFirst(findFirstArgs).execute();
|
|
118
|
+
console.log(JSON.stringify(result, null, 2));
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
console.error('Failed to find record.');
|
|
122
|
+
if (error instanceof Error) {
|
|
123
|
+
console.error(error.message);
|
|
124
|
+
}
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
97
128
|
async function handleGet(argv, prompter) {
|
|
98
129
|
try {
|
|
99
130
|
const answers = await prompter.prompt(argv, [
|
|
@@ -36,7 +36,7 @@ const fieldSchema = {
|
|
|
36
36
|
oneTimeTokenFunction: 'string',
|
|
37
37
|
extendTokenExpires: 'string',
|
|
38
38
|
};
|
|
39
|
-
const usage = '\nuser-auth-module <command>\n\nCommands:\n list List
|
|
39
|
+
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';
|
|
40
40
|
exports.default = async (argv, prompter, _options) => {
|
|
41
41
|
if (argv.help || argv.h) {
|
|
42
42
|
console.log(usage);
|
|
@@ -49,7 +49,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
49
49
|
type: 'autocomplete',
|
|
50
50
|
name: 'subcommand',
|
|
51
51
|
message: 'What do you want to do?',
|
|
52
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
52
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
53
53
|
},
|
|
54
54
|
]);
|
|
55
55
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -60,6 +60,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
60
60
|
switch (subcommand) {
|
|
61
61
|
case 'list':
|
|
62
62
|
return handleList(argv, prompter);
|
|
63
|
+
case 'find-first':
|
|
64
|
+
return handleFindFirst(argv, prompter);
|
|
63
65
|
case 'get':
|
|
64
66
|
return handleGet(argv, prompter);
|
|
65
67
|
case 'create':
|
|
@@ -73,41 +75,39 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
73
75
|
process.exit(1);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
async function handleList(
|
|
78
|
+
async function handleList(argv, _prompter) {
|
|
77
79
|
try {
|
|
80
|
+
const defaultSelect = {
|
|
81
|
+
id: true,
|
|
82
|
+
databaseId: true,
|
|
83
|
+
schemaId: true,
|
|
84
|
+
emailsTableId: true,
|
|
85
|
+
usersTableId: true,
|
|
86
|
+
secretsTableId: true,
|
|
87
|
+
encryptedTableId: true,
|
|
88
|
+
sessionsTableId: true,
|
|
89
|
+
sessionCredentialsTableId: true,
|
|
90
|
+
auditsTableId: true,
|
|
91
|
+
auditsTableName: true,
|
|
92
|
+
signInFunction: true,
|
|
93
|
+
signUpFunction: true,
|
|
94
|
+
signOutFunction: true,
|
|
95
|
+
setPasswordFunction: true,
|
|
96
|
+
resetPasswordFunction: true,
|
|
97
|
+
forgotPasswordFunction: true,
|
|
98
|
+
sendVerificationEmailFunction: true,
|
|
99
|
+
verifyEmailFunction: true,
|
|
100
|
+
verifyPasswordFunction: true,
|
|
101
|
+
checkPasswordFunction: true,
|
|
102
|
+
sendAccountDeletionEmailFunction: true,
|
|
103
|
+
deleteAccountFunction: true,
|
|
104
|
+
signInOneTimeTokenFunction: true,
|
|
105
|
+
oneTimeTokenFunction: true,
|
|
106
|
+
extendTokenExpires: true,
|
|
107
|
+
};
|
|
108
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
78
109
|
const client = (0, executor_1.getClient)();
|
|
79
|
-
const result = await client.userAuthModule
|
|
80
|
-
.findMany({
|
|
81
|
-
select: {
|
|
82
|
-
id: true,
|
|
83
|
-
databaseId: true,
|
|
84
|
-
schemaId: true,
|
|
85
|
-
emailsTableId: true,
|
|
86
|
-
usersTableId: true,
|
|
87
|
-
secretsTableId: true,
|
|
88
|
-
encryptedTableId: true,
|
|
89
|
-
sessionsTableId: true,
|
|
90
|
-
sessionCredentialsTableId: true,
|
|
91
|
-
auditsTableId: true,
|
|
92
|
-
auditsTableName: true,
|
|
93
|
-
signInFunction: true,
|
|
94
|
-
signUpFunction: true,
|
|
95
|
-
signOutFunction: true,
|
|
96
|
-
setPasswordFunction: true,
|
|
97
|
-
resetPasswordFunction: true,
|
|
98
|
-
forgotPasswordFunction: true,
|
|
99
|
-
sendVerificationEmailFunction: true,
|
|
100
|
-
verifyEmailFunction: true,
|
|
101
|
-
verifyPasswordFunction: true,
|
|
102
|
-
checkPasswordFunction: true,
|
|
103
|
-
sendAccountDeletionEmailFunction: true,
|
|
104
|
-
deleteAccountFunction: true,
|
|
105
|
-
signInOneTimeTokenFunction: true,
|
|
106
|
-
oneTimeTokenFunction: true,
|
|
107
|
-
extendTokenExpires: true,
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
.execute();
|
|
110
|
+
const result = await client.userAuthModule.findMany(findManyArgs).execute();
|
|
111
111
|
console.log(JSON.stringify(result, null, 2));
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
@@ -118,6 +118,49 @@ async function handleList(_argv, _prompter) {
|
|
|
118
118
|
process.exit(1);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
+
async function handleFindFirst(argv, _prompter) {
|
|
122
|
+
try {
|
|
123
|
+
const defaultSelect = {
|
|
124
|
+
id: true,
|
|
125
|
+
databaseId: true,
|
|
126
|
+
schemaId: true,
|
|
127
|
+
emailsTableId: true,
|
|
128
|
+
usersTableId: true,
|
|
129
|
+
secretsTableId: true,
|
|
130
|
+
encryptedTableId: true,
|
|
131
|
+
sessionsTableId: true,
|
|
132
|
+
sessionCredentialsTableId: true,
|
|
133
|
+
auditsTableId: true,
|
|
134
|
+
auditsTableName: true,
|
|
135
|
+
signInFunction: true,
|
|
136
|
+
signUpFunction: true,
|
|
137
|
+
signOutFunction: true,
|
|
138
|
+
setPasswordFunction: true,
|
|
139
|
+
resetPasswordFunction: true,
|
|
140
|
+
forgotPasswordFunction: true,
|
|
141
|
+
sendVerificationEmailFunction: true,
|
|
142
|
+
verifyEmailFunction: true,
|
|
143
|
+
verifyPasswordFunction: true,
|
|
144
|
+
checkPasswordFunction: true,
|
|
145
|
+
sendAccountDeletionEmailFunction: true,
|
|
146
|
+
deleteAccountFunction: true,
|
|
147
|
+
signInOneTimeTokenFunction: true,
|
|
148
|
+
oneTimeTokenFunction: true,
|
|
149
|
+
extendTokenExpires: true,
|
|
150
|
+
};
|
|
151
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
152
|
+
const client = (0, executor_1.getClient)();
|
|
153
|
+
const result = await client.userAuthModule.findFirst(findFirstArgs).execute();
|
|
154
|
+
console.log(JSON.stringify(result, null, 2));
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
console.error('Failed to find record.');
|
|
158
|
+
if (error instanceof Error) {
|
|
159
|
+
console.error(error.message);
|
|
160
|
+
}
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
121
164
|
async function handleGet(argv, prompter) {
|
|
122
165
|
try {
|
|
123
166
|
const answers = await prompter.prompt(argv, [
|
|
@@ -21,7 +21,7 @@ const fieldSchema = {
|
|
|
21
21
|
displayNameTrgmSimilarity: 'float',
|
|
22
22
|
searchScore: 'float',
|
|
23
23
|
};
|
|
24
|
-
const usage = '\nuser <command>\n\nCommands:\n list List
|
|
24
|
+
const usage = '\nuser <command>\n\nCommands:\n list List user records\n find-first Find first matching user record\n search <query> Search user records\n get Get a user by ID\n create Create a new user\n update Update an existing user\n delete Delete a user\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\nSearch Options:\n <query> Search query string (required)\n --limit <n> Max number of records to return\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --orderBy <values> Comma-separated list of ordering values\n\n --help, -h Show this help message\n';
|
|
25
25
|
exports.default = async (argv, prompter, _options) => {
|
|
26
26
|
if (argv.help || argv.h) {
|
|
27
27
|
console.log(usage);
|
|
@@ -34,7 +34,7 @@ exports.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', 'search', 'get', 'create', 'update', 'delete'],
|
|
38
38
|
},
|
|
39
39
|
]);
|
|
40
40
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -45,6 +45,10 @@ 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);
|
|
50
|
+
case 'search':
|
|
51
|
+
return handleSearch(argv, prompter);
|
|
48
52
|
case 'get':
|
|
49
53
|
return handleGet(argv, prompter);
|
|
50
54
|
case 'create':
|
|
@@ -58,22 +62,20 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
58
62
|
process.exit(1);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
async function handleList(
|
|
65
|
+
async function handleList(argv, _prompter) {
|
|
62
66
|
try {
|
|
67
|
+
const defaultSelect = {
|
|
68
|
+
id: true,
|
|
69
|
+
username: true,
|
|
70
|
+
displayName: true,
|
|
71
|
+
profilePicture: true,
|
|
72
|
+
type: true,
|
|
73
|
+
createdAt: true,
|
|
74
|
+
updatedAt: true,
|
|
75
|
+
};
|
|
76
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
63
77
|
const client = (0, executor_1.getClient)();
|
|
64
|
-
const result = await client.user
|
|
65
|
-
.findMany({
|
|
66
|
-
select: {
|
|
67
|
-
id: true,
|
|
68
|
-
username: true,
|
|
69
|
-
displayName: true,
|
|
70
|
-
profilePicture: true,
|
|
71
|
-
type: true,
|
|
72
|
-
createdAt: true,
|
|
73
|
-
updatedAt: true,
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
.execute();
|
|
78
|
+
const result = await client.user.findMany(findManyArgs).execute();
|
|
77
79
|
console.log(JSON.stringify(result, null, 2));
|
|
78
80
|
}
|
|
79
81
|
catch (error) {
|
|
@@ -84,6 +86,68 @@ async function handleList(_argv, _prompter) {
|
|
|
84
86
|
process.exit(1);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
async function handleFindFirst(argv, _prompter) {
|
|
90
|
+
try {
|
|
91
|
+
const defaultSelect = {
|
|
92
|
+
id: true,
|
|
93
|
+
username: true,
|
|
94
|
+
displayName: true,
|
|
95
|
+
profilePicture: true,
|
|
96
|
+
type: true,
|
|
97
|
+
createdAt: true,
|
|
98
|
+
updatedAt: true,
|
|
99
|
+
};
|
|
100
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
101
|
+
const client = (0, executor_1.getClient)();
|
|
102
|
+
const result = await client.user.findFirst(findFirstArgs).execute();
|
|
103
|
+
console.log(JSON.stringify(result, null, 2));
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error('Failed to find record.');
|
|
107
|
+
if (error instanceof Error) {
|
|
108
|
+
console.error(error.message);
|
|
109
|
+
}
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function handleSearch(argv, _prompter) {
|
|
114
|
+
try {
|
|
115
|
+
const query = Array.isArray(argv._) && argv._.length > 0 ? String(argv._[0]) : undefined;
|
|
116
|
+
if (!query) {
|
|
117
|
+
console.error('Error: search requires a <query> argument');
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
const searchWhere = {
|
|
121
|
+
searchTsv: {
|
|
122
|
+
query,
|
|
123
|
+
},
|
|
124
|
+
trgmDisplayName: {
|
|
125
|
+
value: query,
|
|
126
|
+
threshold: 0.3,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
const defaultSelect = {
|
|
130
|
+
id: true,
|
|
131
|
+
username: true,
|
|
132
|
+
displayName: true,
|
|
133
|
+
profilePicture: true,
|
|
134
|
+
type: true,
|
|
135
|
+
createdAt: true,
|
|
136
|
+
updatedAt: true,
|
|
137
|
+
};
|
|
138
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect, searchWhere);
|
|
139
|
+
const client = (0, executor_1.getClient)();
|
|
140
|
+
const result = await client.user.findMany(findManyArgs).execute();
|
|
141
|
+
console.log(JSON.stringify(result, null, 2));
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
console.error('Failed to search records.');
|
|
145
|
+
if (error instanceof Error) {
|
|
146
|
+
console.error(error.message);
|
|
147
|
+
}
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
87
151
|
async function handleGet(argv, prompter) {
|
|
88
152
|
try {
|
|
89
153
|
const answers = await prompter.prompt(argv, [
|