@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
|
@@ -19,7 +19,7 @@ const fieldSchema = {
|
|
|
19
19
|
logo: 'string',
|
|
20
20
|
dbname: 'string',
|
|
21
21
|
};
|
|
22
|
-
const usage = '\nsite <command>\n\nCommands:\n list List
|
|
22
|
+
const usage = '\nsite <command>\n\nCommands:\n list List site records\n find-first Find first matching site record\n get Get a site by ID\n create Create a new site\n update Update an existing site\n delete Delete a site\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';
|
|
23
23
|
exports.default = async (argv, prompter, _options) => {
|
|
24
24
|
if (argv.help || argv.h) {
|
|
25
25
|
console.log(usage);
|
|
@@ -32,7 +32,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
32
32
|
type: 'autocomplete',
|
|
33
33
|
name: 'subcommand',
|
|
34
34
|
message: 'What do you want to do?',
|
|
35
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
35
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
36
36
|
},
|
|
37
37
|
]);
|
|
38
38
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -43,6 +43,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
43
43
|
switch (subcommand) {
|
|
44
44
|
case 'list':
|
|
45
45
|
return handleList(argv, prompter);
|
|
46
|
+
case 'find-first':
|
|
47
|
+
return handleFindFirst(argv, prompter);
|
|
46
48
|
case 'get':
|
|
47
49
|
return handleGet(argv, prompter);
|
|
48
50
|
case 'create':
|
|
@@ -56,24 +58,22 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
56
58
|
process.exit(1);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
async function handleList(
|
|
61
|
+
async function handleList(argv, _prompter) {
|
|
60
62
|
try {
|
|
63
|
+
const defaultSelect = {
|
|
64
|
+
id: true,
|
|
65
|
+
databaseId: true,
|
|
66
|
+
title: true,
|
|
67
|
+
description: true,
|
|
68
|
+
ogImage: true,
|
|
69
|
+
favicon: true,
|
|
70
|
+
appleTouchIcon: true,
|
|
71
|
+
logo: true,
|
|
72
|
+
dbname: true,
|
|
73
|
+
};
|
|
74
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
61
75
|
const client = (0, executor_1.getClient)();
|
|
62
|
-
const result = await client.site
|
|
63
|
-
.findMany({
|
|
64
|
-
select: {
|
|
65
|
-
id: true,
|
|
66
|
-
databaseId: true,
|
|
67
|
-
title: true,
|
|
68
|
-
description: true,
|
|
69
|
-
ogImage: true,
|
|
70
|
-
favicon: true,
|
|
71
|
-
appleTouchIcon: true,
|
|
72
|
-
logo: true,
|
|
73
|
-
dbname: true,
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
.execute();
|
|
76
|
+
const result = await client.site.findMany(findManyArgs).execute();
|
|
77
77
|
console.log(JSON.stringify(result, null, 2));
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
@@ -84,6 +84,32 @@ async function handleList(_argv, _prompter) {
|
|
|
84
84
|
process.exit(1);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
async function handleFindFirst(argv, _prompter) {
|
|
88
|
+
try {
|
|
89
|
+
const defaultSelect = {
|
|
90
|
+
id: true,
|
|
91
|
+
databaseId: true,
|
|
92
|
+
title: true,
|
|
93
|
+
description: true,
|
|
94
|
+
ogImage: true,
|
|
95
|
+
favicon: true,
|
|
96
|
+
appleTouchIcon: true,
|
|
97
|
+
logo: true,
|
|
98
|
+
dbname: true,
|
|
99
|
+
};
|
|
100
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
101
|
+
const client = (0, executor_1.getClient)();
|
|
102
|
+
const result = await client.site.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
|
+
}
|
|
87
113
|
async function handleGet(argv, prompter) {
|
|
88
114
|
try {
|
|
89
115
|
const answers = await prompter.prompt(argv, [
|
|
@@ -23,7 +23,7 @@ const fieldSchema = {
|
|
|
23
23
|
actionId: 'uuid',
|
|
24
24
|
actorId: 'uuid',
|
|
25
25
|
};
|
|
26
|
-
const usage = '\nsql-action <command>\n\nCommands:\n list List
|
|
26
|
+
const usage = '\nsql-action <command>\n\nCommands:\n list List sqlAction records\n find-first Find first matching sqlAction record\n create Create a new sqlAction\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', 'create'],
|
|
39
|
+
options: ['list', 'find-first', 'create'],
|
|
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 'create':
|
|
51
53
|
return handleCreate(argv, prompter);
|
|
52
54
|
default:
|
|
@@ -54,28 +56,26 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
54
56
|
process.exit(1);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
async function handleList(
|
|
59
|
+
async function handleList(argv, _prompter) {
|
|
58
60
|
try {
|
|
61
|
+
const defaultSelect = {
|
|
62
|
+
id: true,
|
|
63
|
+
name: true,
|
|
64
|
+
databaseId: true,
|
|
65
|
+
deploy: true,
|
|
66
|
+
deps: true,
|
|
67
|
+
payload: true,
|
|
68
|
+
content: true,
|
|
69
|
+
revert: true,
|
|
70
|
+
verify: true,
|
|
71
|
+
createdAt: true,
|
|
72
|
+
action: true,
|
|
73
|
+
actionId: true,
|
|
74
|
+
actorId: true,
|
|
75
|
+
};
|
|
76
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
59
77
|
const client = (0, executor_1.getClient)();
|
|
60
|
-
const result = await client.sqlAction
|
|
61
|
-
.findMany({
|
|
62
|
-
select: {
|
|
63
|
-
id: true,
|
|
64
|
-
name: true,
|
|
65
|
-
databaseId: true,
|
|
66
|
-
deploy: true,
|
|
67
|
-
deps: true,
|
|
68
|
-
payload: true,
|
|
69
|
-
content: true,
|
|
70
|
-
revert: true,
|
|
71
|
-
verify: true,
|
|
72
|
-
createdAt: true,
|
|
73
|
-
action: true,
|
|
74
|
-
actionId: true,
|
|
75
|
-
actorId: true,
|
|
76
|
-
},
|
|
77
|
-
})
|
|
78
|
-
.execute();
|
|
78
|
+
const result = await client.sqlAction.findMany(findManyArgs).execute();
|
|
79
79
|
console.log(JSON.stringify(result, null, 2));
|
|
80
80
|
}
|
|
81
81
|
catch (error) {
|
|
@@ -86,6 +86,36 @@ async function handleList(_argv, _prompter) {
|
|
|
86
86
|
process.exit(1);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
async function handleFindFirst(argv, _prompter) {
|
|
90
|
+
try {
|
|
91
|
+
const defaultSelect = {
|
|
92
|
+
id: true,
|
|
93
|
+
name: true,
|
|
94
|
+
databaseId: true,
|
|
95
|
+
deploy: true,
|
|
96
|
+
deps: true,
|
|
97
|
+
payload: true,
|
|
98
|
+
content: true,
|
|
99
|
+
revert: true,
|
|
100
|
+
verify: true,
|
|
101
|
+
createdAt: true,
|
|
102
|
+
action: true,
|
|
103
|
+
actionId: true,
|
|
104
|
+
actorId: true,
|
|
105
|
+
};
|
|
106
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
107
|
+
const client = (0, executor_1.getClient)();
|
|
108
|
+
const result = await client.sqlAction.findFirst(findFirstArgs).execute();
|
|
109
|
+
console.log(JSON.stringify(result, null, 2));
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.error('Failed to find record.');
|
|
113
|
+
if (error instanceof Error) {
|
|
114
|
+
console.error(error.message);
|
|
115
|
+
}
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
89
119
|
async function handleCreate(argv, prompter) {
|
|
90
120
|
try {
|
|
91
121
|
const rawAnswers = await prompter.prompt(argv, [
|
|
@@ -15,7 +15,7 @@ const fieldSchema = {
|
|
|
15
15
|
hash: 'uuid',
|
|
16
16
|
createdAt: 'string',
|
|
17
17
|
};
|
|
18
|
-
const usage = '\nstore <command>\n\nCommands:\n list List
|
|
18
|
+
const usage = '\nstore <command>\n\nCommands:\n list List store records\n find-first Find first matching store record\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\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';
|
|
19
19
|
exports.default = async (argv, prompter, _options) => {
|
|
20
20
|
if (argv.help || argv.h) {
|
|
21
21
|
console.log(usage);
|
|
@@ -28,7 +28,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
28
28
|
type: 'autocomplete',
|
|
29
29
|
name: 'subcommand',
|
|
30
30
|
message: 'What do you want to do?',
|
|
31
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
31
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
32
32
|
},
|
|
33
33
|
]);
|
|
34
34
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -39,6 +39,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
39
39
|
switch (subcommand) {
|
|
40
40
|
case 'list':
|
|
41
41
|
return handleList(argv, prompter);
|
|
42
|
+
case 'find-first':
|
|
43
|
+
return handleFindFirst(argv, prompter);
|
|
42
44
|
case 'get':
|
|
43
45
|
return handleGet(argv, prompter);
|
|
44
46
|
case 'create':
|
|
@@ -52,20 +54,18 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
52
54
|
process.exit(1);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
async function handleList(
|
|
57
|
+
async function handleList(argv, _prompter) {
|
|
56
58
|
try {
|
|
59
|
+
const defaultSelect = {
|
|
60
|
+
id: true,
|
|
61
|
+
name: true,
|
|
62
|
+
databaseId: true,
|
|
63
|
+
hash: true,
|
|
64
|
+
createdAt: true,
|
|
65
|
+
};
|
|
66
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
57
67
|
const client = (0, executor_1.getClient)();
|
|
58
|
-
const result = await client.store
|
|
59
|
-
.findMany({
|
|
60
|
-
select: {
|
|
61
|
-
id: true,
|
|
62
|
-
name: true,
|
|
63
|
-
databaseId: true,
|
|
64
|
-
hash: true,
|
|
65
|
-
createdAt: true,
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
.execute();
|
|
68
|
+
const result = await client.store.findMany(findManyArgs).execute();
|
|
69
69
|
console.log(JSON.stringify(result, null, 2));
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
@@ -76,6 +76,28 @@ 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
|
+
name: true,
|
|
84
|
+
databaseId: true,
|
|
85
|
+
hash: true,
|
|
86
|
+
createdAt: true,
|
|
87
|
+
};
|
|
88
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
89
|
+
const client = (0, executor_1.getClient)();
|
|
90
|
+
const result = await client.store.findFirst(findFirstArgs).execute();
|
|
91
|
+
console.log(JSON.stringify(result, null, 2));
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error('Failed to find record.');
|
|
95
|
+
if (error instanceof Error) {
|
|
96
|
+
console.error(error.message);
|
|
97
|
+
}
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
79
101
|
async function handleGet(argv, prompter) {
|
|
80
102
|
try {
|
|
81
103
|
const answers = await prompter.prompt(argv, [
|
|
@@ -19,7 +19,7 @@ const fieldSchema = {
|
|
|
19
19
|
createdAt: 'string',
|
|
20
20
|
updatedAt: 'string',
|
|
21
21
|
};
|
|
22
|
-
const usage = '\ntable-grant <command>\n\nCommands:\n list List
|
|
22
|
+
const usage = '\ntable-grant <command>\n\nCommands:\n list List tableGrant records\n find-first Find first matching tableGrant record\n get Get a tableGrant by ID\n create Create a new tableGrant\n update Update an existing tableGrant\n delete Delete a tableGrant\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';
|
|
23
23
|
exports.default = async (argv, prompter, _options) => {
|
|
24
24
|
if (argv.help || argv.h) {
|
|
25
25
|
console.log(usage);
|
|
@@ -32,7 +32,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
32
32
|
type: 'autocomplete',
|
|
33
33
|
name: 'subcommand',
|
|
34
34
|
message: 'What do you want to do?',
|
|
35
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
35
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
36
36
|
},
|
|
37
37
|
]);
|
|
38
38
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -43,6 +43,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
43
43
|
switch (subcommand) {
|
|
44
44
|
case 'list':
|
|
45
45
|
return handleList(argv, prompter);
|
|
46
|
+
case 'find-first':
|
|
47
|
+
return handleFindFirst(argv, prompter);
|
|
46
48
|
case 'get':
|
|
47
49
|
return handleGet(argv, prompter);
|
|
48
50
|
case 'create':
|
|
@@ -56,24 +58,22 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
56
58
|
process.exit(1);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
async function handleList(
|
|
61
|
+
async function handleList(argv, _prompter) {
|
|
60
62
|
try {
|
|
63
|
+
const defaultSelect = {
|
|
64
|
+
id: true,
|
|
65
|
+
databaseId: true,
|
|
66
|
+
tableId: true,
|
|
67
|
+
privilege: true,
|
|
68
|
+
granteeName: true,
|
|
69
|
+
fieldIds: true,
|
|
70
|
+
isGrant: true,
|
|
71
|
+
createdAt: true,
|
|
72
|
+
updatedAt: true,
|
|
73
|
+
};
|
|
74
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
61
75
|
const client = (0, executor_1.getClient)();
|
|
62
|
-
const result = await client.tableGrant
|
|
63
|
-
.findMany({
|
|
64
|
-
select: {
|
|
65
|
-
id: true,
|
|
66
|
-
databaseId: true,
|
|
67
|
-
tableId: true,
|
|
68
|
-
privilege: true,
|
|
69
|
-
granteeName: true,
|
|
70
|
-
fieldIds: true,
|
|
71
|
-
isGrant: true,
|
|
72
|
-
createdAt: true,
|
|
73
|
-
updatedAt: true,
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
.execute();
|
|
76
|
+
const result = await client.tableGrant.findMany(findManyArgs).execute();
|
|
77
77
|
console.log(JSON.stringify(result, null, 2));
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
@@ -84,6 +84,32 @@ async function handleList(_argv, _prompter) {
|
|
|
84
84
|
process.exit(1);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
async function handleFindFirst(argv, _prompter) {
|
|
88
|
+
try {
|
|
89
|
+
const defaultSelect = {
|
|
90
|
+
id: true,
|
|
91
|
+
databaseId: true,
|
|
92
|
+
tableId: true,
|
|
93
|
+
privilege: true,
|
|
94
|
+
granteeName: true,
|
|
95
|
+
fieldIds: true,
|
|
96
|
+
isGrant: 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.tableGrant.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
|
+
}
|
|
87
113
|
async function handleGet(argv, prompter) {
|
|
88
114
|
try {
|
|
89
115
|
const answers = await prompter.prompt(argv, [
|
|
@@ -19,7 +19,7 @@ const fieldSchema = {
|
|
|
19
19
|
nodeType: 'string',
|
|
20
20
|
data: 'json',
|
|
21
21
|
};
|
|
22
|
-
const usage = '\ntable-template-module <command>\n\nCommands:\n list List
|
|
22
|
+
const usage = '\ntable-template-module <command>\n\nCommands:\n list List tableTemplateModule records\n find-first Find first matching tableTemplateModule record\n get Get a tableTemplateModule by ID\n create Create a new tableTemplateModule\n update Update an existing tableTemplateModule\n delete Delete a tableTemplateModule\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';
|
|
23
23
|
exports.default = async (argv, prompter, _options) => {
|
|
24
24
|
if (argv.help || argv.h) {
|
|
25
25
|
console.log(usage);
|
|
@@ -32,7 +32,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
32
32
|
type: 'autocomplete',
|
|
33
33
|
name: 'subcommand',
|
|
34
34
|
message: 'What do you want to do?',
|
|
35
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
35
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
36
36
|
},
|
|
37
37
|
]);
|
|
38
38
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -43,6 +43,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
43
43
|
switch (subcommand) {
|
|
44
44
|
case 'list':
|
|
45
45
|
return handleList(argv, prompter);
|
|
46
|
+
case 'find-first':
|
|
47
|
+
return handleFindFirst(argv, prompter);
|
|
46
48
|
case 'get':
|
|
47
49
|
return handleGet(argv, prompter);
|
|
48
50
|
case 'create':
|
|
@@ -56,24 +58,22 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
56
58
|
process.exit(1);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
async function handleList(
|
|
61
|
+
async function handleList(argv, _prompter) {
|
|
60
62
|
try {
|
|
63
|
+
const defaultSelect = {
|
|
64
|
+
id: true,
|
|
65
|
+
databaseId: true,
|
|
66
|
+
schemaId: true,
|
|
67
|
+
privateSchemaId: true,
|
|
68
|
+
tableId: true,
|
|
69
|
+
ownerTableId: true,
|
|
70
|
+
tableName: true,
|
|
71
|
+
nodeType: true,
|
|
72
|
+
data: true,
|
|
73
|
+
};
|
|
74
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
61
75
|
const client = (0, executor_1.getClient)();
|
|
62
|
-
const result = await client.tableTemplateModule
|
|
63
|
-
.findMany({
|
|
64
|
-
select: {
|
|
65
|
-
id: true,
|
|
66
|
-
databaseId: true,
|
|
67
|
-
schemaId: true,
|
|
68
|
-
privateSchemaId: true,
|
|
69
|
-
tableId: true,
|
|
70
|
-
ownerTableId: true,
|
|
71
|
-
tableName: true,
|
|
72
|
-
nodeType: true,
|
|
73
|
-
data: true,
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
.execute();
|
|
76
|
+
const result = await client.tableTemplateModule.findMany(findManyArgs).execute();
|
|
77
77
|
console.log(JSON.stringify(result, null, 2));
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
@@ -84,6 +84,32 @@ async function handleList(_argv, _prompter) {
|
|
|
84
84
|
process.exit(1);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
async function handleFindFirst(argv, _prompter) {
|
|
88
|
+
try {
|
|
89
|
+
const defaultSelect = {
|
|
90
|
+
id: true,
|
|
91
|
+
databaseId: true,
|
|
92
|
+
schemaId: true,
|
|
93
|
+
privateSchemaId: true,
|
|
94
|
+
tableId: true,
|
|
95
|
+
ownerTableId: true,
|
|
96
|
+
tableName: true,
|
|
97
|
+
nodeType: true,
|
|
98
|
+
data: true,
|
|
99
|
+
};
|
|
100
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
101
|
+
const client = (0, executor_1.getClient)();
|
|
102
|
+
const result = await client.tableTemplateModule.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
|
+
}
|
|
87
113
|
async function handleGet(argv, prompter) {
|
|
88
114
|
try {
|
|
89
115
|
const answers = await prompter.prompt(argv, [
|
|
@@ -29,7 +29,7 @@ const fieldSchema = {
|
|
|
29
29
|
createdAt: 'string',
|
|
30
30
|
updatedAt: 'string',
|
|
31
31
|
};
|
|
32
|
-
const usage = '\ntable <command>\n\nCommands:\n list List
|
|
32
|
+
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';
|
|
33
33
|
exports.default = async (argv, prompter, _options) => {
|
|
34
34
|
if (argv.help || argv.h) {
|
|
35
35
|
console.log(usage);
|
|
@@ -42,7 +42,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
42
42
|
type: 'autocomplete',
|
|
43
43
|
name: 'subcommand',
|
|
44
44
|
message: 'What do you want to do?',
|
|
45
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
45
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
46
46
|
},
|
|
47
47
|
]);
|
|
48
48
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -53,6 +53,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
53
53
|
switch (subcommand) {
|
|
54
54
|
case 'list':
|
|
55
55
|
return handleList(argv, prompter);
|
|
56
|
+
case 'find-first':
|
|
57
|
+
return handleFindFirst(argv, prompter);
|
|
56
58
|
case 'get':
|
|
57
59
|
return handleGet(argv, prompter);
|
|
58
60
|
case 'create':
|
|
@@ -66,34 +68,32 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
66
68
|
process.exit(1);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
async function handleList(
|
|
71
|
+
async function handleList(argv, _prompter) {
|
|
70
72
|
try {
|
|
73
|
+
const defaultSelect = {
|
|
74
|
+
id: true,
|
|
75
|
+
databaseId: true,
|
|
76
|
+
schemaId: true,
|
|
77
|
+
name: true,
|
|
78
|
+
label: true,
|
|
79
|
+
description: true,
|
|
80
|
+
smartTags: true,
|
|
81
|
+
category: true,
|
|
82
|
+
module: true,
|
|
83
|
+
scope: true,
|
|
84
|
+
useRls: true,
|
|
85
|
+
timestamps: true,
|
|
86
|
+
peoplestamps: true,
|
|
87
|
+
pluralName: true,
|
|
88
|
+
singularName: true,
|
|
89
|
+
tags: true,
|
|
90
|
+
inheritsId: true,
|
|
91
|
+
createdAt: true,
|
|
92
|
+
updatedAt: true,
|
|
93
|
+
};
|
|
94
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
71
95
|
const client = (0, executor_1.getClient)();
|
|
72
|
-
const result = await client.table
|
|
73
|
-
.findMany({
|
|
74
|
-
select: {
|
|
75
|
-
id: true,
|
|
76
|
-
databaseId: true,
|
|
77
|
-
schemaId: true,
|
|
78
|
-
name: true,
|
|
79
|
-
label: true,
|
|
80
|
-
description: true,
|
|
81
|
-
smartTags: true,
|
|
82
|
-
category: true,
|
|
83
|
-
module: true,
|
|
84
|
-
scope: true,
|
|
85
|
-
useRls: true,
|
|
86
|
-
timestamps: true,
|
|
87
|
-
peoplestamps: true,
|
|
88
|
-
pluralName: true,
|
|
89
|
-
singularName: true,
|
|
90
|
-
tags: true,
|
|
91
|
-
inheritsId: true,
|
|
92
|
-
createdAt: true,
|
|
93
|
-
updatedAt: true,
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
.execute();
|
|
96
|
+
const result = await client.table.findMany(findManyArgs).execute();
|
|
97
97
|
console.log(JSON.stringify(result, null, 2));
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
@@ -104,6 +104,42 @@ async function handleList(_argv, _prompter) {
|
|
|
104
104
|
process.exit(1);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
async function handleFindFirst(argv, _prompter) {
|
|
108
|
+
try {
|
|
109
|
+
const defaultSelect = {
|
|
110
|
+
id: true,
|
|
111
|
+
databaseId: true,
|
|
112
|
+
schemaId: true,
|
|
113
|
+
name: true,
|
|
114
|
+
label: true,
|
|
115
|
+
description: true,
|
|
116
|
+
smartTags: true,
|
|
117
|
+
category: true,
|
|
118
|
+
module: true,
|
|
119
|
+
scope: true,
|
|
120
|
+
useRls: true,
|
|
121
|
+
timestamps: true,
|
|
122
|
+
peoplestamps: true,
|
|
123
|
+
pluralName: true,
|
|
124
|
+
singularName: true,
|
|
125
|
+
tags: true,
|
|
126
|
+
inheritsId: true,
|
|
127
|
+
createdAt: true,
|
|
128
|
+
updatedAt: true,
|
|
129
|
+
};
|
|
130
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
131
|
+
const client = (0, executor_1.getClient)();
|
|
132
|
+
const result = await client.table.findFirst(findFirstArgs).execute();
|
|
133
|
+
console.log(JSON.stringify(result, null, 2));
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.error('Failed to find record.');
|
|
137
|
+
if (error instanceof Error) {
|
|
138
|
+
console.error(error.message);
|
|
139
|
+
}
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
107
143
|
async function handleGet(argv, prompter) {
|
|
108
144
|
try {
|
|
109
145
|
const answers = await prompter.prompt(argv, [
|