@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
|
@@ -18,7 +18,7 @@ const fieldSchema = {
|
|
|
18
18
|
createdAt: 'string',
|
|
19
19
|
updatedAt: 'string',
|
|
20
20
|
};
|
|
21
|
-
const usage = '\nconnected-account <command>\n\nCommands:\n list List
|
|
21
|
+
const usage = '\nconnected-account <command>\n\nCommands:\n list List connectedAccount records\n find-first Find first matching connectedAccount record\n get Get a connectedAccount by ID\n create Create a new connectedAccount\n update Update an existing connectedAccount\n delete Delete a connectedAccount\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';
|
|
22
22
|
exports.default = async (argv, prompter, _options) => {
|
|
23
23
|
if (argv.help || argv.h) {
|
|
24
24
|
console.log(usage);
|
|
@@ -31,7 +31,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
31
31
|
type: 'autocomplete',
|
|
32
32
|
name: 'subcommand',
|
|
33
33
|
message: 'What do you want to do?',
|
|
34
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
34
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
35
35
|
},
|
|
36
36
|
]);
|
|
37
37
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -42,6 +42,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
42
42
|
switch (subcommand) {
|
|
43
43
|
case 'list':
|
|
44
44
|
return handleList(argv, prompter);
|
|
45
|
+
case 'find-first':
|
|
46
|
+
return handleFindFirst(argv, prompter);
|
|
45
47
|
case 'get':
|
|
46
48
|
return handleGet(argv, prompter);
|
|
47
49
|
case 'create':
|
|
@@ -55,23 +57,21 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
55
57
|
process.exit(1);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
async function handleList(
|
|
60
|
+
async function handleList(argv, _prompter) {
|
|
59
61
|
try {
|
|
62
|
+
const defaultSelect = {
|
|
63
|
+
id: true,
|
|
64
|
+
ownerId: true,
|
|
65
|
+
service: true,
|
|
66
|
+
identifier: true,
|
|
67
|
+
details: true,
|
|
68
|
+
isVerified: true,
|
|
69
|
+
createdAt: true,
|
|
70
|
+
updatedAt: true,
|
|
71
|
+
};
|
|
72
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
60
73
|
const client = (0, executor_1.getClient)();
|
|
61
|
-
const result = await client.connectedAccount
|
|
62
|
-
.findMany({
|
|
63
|
-
select: {
|
|
64
|
-
id: true,
|
|
65
|
-
ownerId: true,
|
|
66
|
-
service: true,
|
|
67
|
-
identifier: true,
|
|
68
|
-
details: true,
|
|
69
|
-
isVerified: true,
|
|
70
|
-
createdAt: true,
|
|
71
|
-
updatedAt: true,
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
.execute();
|
|
74
|
+
const result = await client.connectedAccount.findMany(findManyArgs).execute();
|
|
75
75
|
console.log(JSON.stringify(result, null, 2));
|
|
76
76
|
}
|
|
77
77
|
catch (error) {
|
|
@@ -82,6 +82,31 @@ async function handleList(_argv, _prompter) {
|
|
|
82
82
|
process.exit(1);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
async function handleFindFirst(argv, _prompter) {
|
|
86
|
+
try {
|
|
87
|
+
const defaultSelect = {
|
|
88
|
+
id: true,
|
|
89
|
+
ownerId: true,
|
|
90
|
+
service: true,
|
|
91
|
+
identifier: true,
|
|
92
|
+
details: true,
|
|
93
|
+
isVerified: true,
|
|
94
|
+
createdAt: true,
|
|
95
|
+
updatedAt: true,
|
|
96
|
+
};
|
|
97
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
98
|
+
const client = (0, executor_1.getClient)();
|
|
99
|
+
const result = await client.connectedAccount.findFirst(findFirstArgs).execute();
|
|
100
|
+
console.log(JSON.stringify(result, null, 2));
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.error('Failed to find record.');
|
|
104
|
+
if (error instanceof Error) {
|
|
105
|
+
console.error(error.message);
|
|
106
|
+
}
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
85
110
|
async function handleGet(argv, prompter) {
|
|
86
111
|
try {
|
|
87
112
|
const answers = await prompter.prompt(argv, [
|
|
@@ -17,7 +17,7 @@ const fieldSchema = {
|
|
|
17
17
|
createdAt: 'string',
|
|
18
18
|
updatedAt: 'string',
|
|
19
19
|
};
|
|
20
|
-
const usage = '\ncrypto-address <command>\n\nCommands:\n list List
|
|
20
|
+
const usage = '\ncrypto-address <command>\n\nCommands:\n list List cryptoAddress records\n find-first Find first matching cryptoAddress record\n get Get a cryptoAddress by ID\n create Create a new cryptoAddress\n update Update an existing cryptoAddress\n delete Delete a cryptoAddress\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n\n --help, -h Show this help message\n';
|
|
21
21
|
exports.default = async (argv, prompter, _options) => {
|
|
22
22
|
if (argv.help || argv.h) {
|
|
23
23
|
console.log(usage);
|
|
@@ -30,7 +30,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
30
30
|
type: 'autocomplete',
|
|
31
31
|
name: 'subcommand',
|
|
32
32
|
message: 'What do you want to do?',
|
|
33
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
33
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
34
34
|
},
|
|
35
35
|
]);
|
|
36
36
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -41,6 +41,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
41
41
|
switch (subcommand) {
|
|
42
42
|
case 'list':
|
|
43
43
|
return handleList(argv, prompter);
|
|
44
|
+
case 'find-first':
|
|
45
|
+
return handleFindFirst(argv, prompter);
|
|
44
46
|
case 'get':
|
|
45
47
|
return handleGet(argv, prompter);
|
|
46
48
|
case 'create':
|
|
@@ -54,22 +56,20 @@ 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
|
+
ownerId: true,
|
|
64
|
+
address: true,
|
|
65
|
+
isVerified: true,
|
|
66
|
+
isPrimary: true,
|
|
67
|
+
createdAt: true,
|
|
68
|
+
updatedAt: true,
|
|
69
|
+
};
|
|
70
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
59
71
|
const client = (0, executor_1.getClient)();
|
|
60
|
-
const result = await client.cryptoAddress
|
|
61
|
-
.findMany({
|
|
62
|
-
select: {
|
|
63
|
-
id: true,
|
|
64
|
-
ownerId: true,
|
|
65
|
-
address: true,
|
|
66
|
-
isVerified: true,
|
|
67
|
-
isPrimary: true,
|
|
68
|
-
createdAt: true,
|
|
69
|
-
updatedAt: true,
|
|
70
|
-
},
|
|
71
|
-
})
|
|
72
|
-
.execute();
|
|
72
|
+
const result = await client.cryptoAddress.findMany(findManyArgs).execute();
|
|
73
73
|
console.log(JSON.stringify(result, null, 2));
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
@@ -80,6 +80,30 @@ async function handleList(_argv, _prompter) {
|
|
|
80
80
|
process.exit(1);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
async function handleFindFirst(argv, _prompter) {
|
|
84
|
+
try {
|
|
85
|
+
const defaultSelect = {
|
|
86
|
+
id: true,
|
|
87
|
+
ownerId: true,
|
|
88
|
+
address: true,
|
|
89
|
+
isVerified: true,
|
|
90
|
+
isPrimary: true,
|
|
91
|
+
createdAt: true,
|
|
92
|
+
updatedAt: true,
|
|
93
|
+
};
|
|
94
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
95
|
+
const client = (0, executor_1.getClient)();
|
|
96
|
+
const result = await client.cryptoAddress.findFirst(findFirstArgs).execute();
|
|
97
|
+
console.log(JSON.stringify(result, null, 2));
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.error('Failed to find record.');
|
|
101
|
+
if (error instanceof Error) {
|
|
102
|
+
console.error(error.message);
|
|
103
|
+
}
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
83
107
|
async function handleGet(argv, prompter) {
|
|
84
108
|
try {
|
|
85
109
|
const answers = await prompter.prompt(argv, [
|
|
@@ -17,7 +17,7 @@ const fieldSchema = {
|
|
|
17
17
|
createdAt: 'string',
|
|
18
18
|
updatedAt: 'string',
|
|
19
19
|
};
|
|
20
|
-
const usage = '\nemail <command>\n\nCommands:\n list List
|
|
20
|
+
const usage = '\nemail <command>\n\nCommands:\n list List email records\n find-first Find first matching email record\n get Get a email by ID\n create Create a new email\n update Update an existing email\n delete Delete a email\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n\n --help, -h Show this help message\n';
|
|
21
21
|
exports.default = async (argv, prompter, _options) => {
|
|
22
22
|
if (argv.help || argv.h) {
|
|
23
23
|
console.log(usage);
|
|
@@ -30,7 +30,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
30
30
|
type: 'autocomplete',
|
|
31
31
|
name: 'subcommand',
|
|
32
32
|
message: 'What do you want to do?',
|
|
33
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
33
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
34
34
|
},
|
|
35
35
|
]);
|
|
36
36
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -41,6 +41,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
41
41
|
switch (subcommand) {
|
|
42
42
|
case 'list':
|
|
43
43
|
return handleList(argv, prompter);
|
|
44
|
+
case 'find-first':
|
|
45
|
+
return handleFindFirst(argv, prompter);
|
|
44
46
|
case 'get':
|
|
45
47
|
return handleGet(argv, prompter);
|
|
46
48
|
case 'create':
|
|
@@ -54,22 +56,20 @@ 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
|
+
ownerId: true,
|
|
64
|
+
email: true,
|
|
65
|
+
isVerified: true,
|
|
66
|
+
isPrimary: true,
|
|
67
|
+
createdAt: true,
|
|
68
|
+
updatedAt: true,
|
|
69
|
+
};
|
|
70
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
59
71
|
const client = (0, executor_1.getClient)();
|
|
60
|
-
const result = await client.email
|
|
61
|
-
.findMany({
|
|
62
|
-
select: {
|
|
63
|
-
id: true,
|
|
64
|
-
ownerId: true,
|
|
65
|
-
email: true,
|
|
66
|
-
isVerified: true,
|
|
67
|
-
isPrimary: true,
|
|
68
|
-
createdAt: true,
|
|
69
|
-
updatedAt: true,
|
|
70
|
-
},
|
|
71
|
-
})
|
|
72
|
-
.execute();
|
|
72
|
+
const result = await client.email.findMany(findManyArgs).execute();
|
|
73
73
|
console.log(JSON.stringify(result, null, 2));
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
@@ -80,6 +80,30 @@ async function handleList(_argv, _prompter) {
|
|
|
80
80
|
process.exit(1);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
async function handleFindFirst(argv, _prompter) {
|
|
84
|
+
try {
|
|
85
|
+
const defaultSelect = {
|
|
86
|
+
id: true,
|
|
87
|
+
ownerId: true,
|
|
88
|
+
email: true,
|
|
89
|
+
isVerified: true,
|
|
90
|
+
isPrimary: true,
|
|
91
|
+
createdAt: true,
|
|
92
|
+
updatedAt: true,
|
|
93
|
+
};
|
|
94
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
95
|
+
const client = (0, executor_1.getClient)();
|
|
96
|
+
const result = await client.email.findFirst(findFirstArgs).execute();
|
|
97
|
+
console.log(JSON.stringify(result, null, 2));
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.error('Failed to find record.');
|
|
101
|
+
if (error instanceof Error) {
|
|
102
|
+
console.error(error.message);
|
|
103
|
+
}
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
83
107
|
async function handleGet(argv, prompter) {
|
|
84
108
|
try {
|
|
85
109
|
const answers = await prompter.prompt(argv, [
|
|
@@ -18,7 +18,7 @@ const fieldSchema = {
|
|
|
18
18
|
createdAt: 'string',
|
|
19
19
|
updatedAt: 'string',
|
|
20
20
|
};
|
|
21
|
-
const usage = '\nphone-number <command>\n\nCommands:\n list List
|
|
21
|
+
const usage = '\nphone-number <command>\n\nCommands:\n list List phoneNumber records\n find-first Find first matching phoneNumber record\n get Get a phoneNumber by ID\n create Create a new phoneNumber\n update Update an existing phoneNumber\n delete Delete a phoneNumber\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';
|
|
22
22
|
exports.default = async (argv, prompter, _options) => {
|
|
23
23
|
if (argv.help || argv.h) {
|
|
24
24
|
console.log(usage);
|
|
@@ -31,7 +31,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
31
31
|
type: 'autocomplete',
|
|
32
32
|
name: 'subcommand',
|
|
33
33
|
message: 'What do you want to do?',
|
|
34
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
34
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
35
35
|
},
|
|
36
36
|
]);
|
|
37
37
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -42,6 +42,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
42
42
|
switch (subcommand) {
|
|
43
43
|
case 'list':
|
|
44
44
|
return handleList(argv, prompter);
|
|
45
|
+
case 'find-first':
|
|
46
|
+
return handleFindFirst(argv, prompter);
|
|
45
47
|
case 'get':
|
|
46
48
|
return handleGet(argv, prompter);
|
|
47
49
|
case 'create':
|
|
@@ -55,23 +57,21 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
55
57
|
process.exit(1);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
async function handleList(
|
|
60
|
+
async function handleList(argv, _prompter) {
|
|
59
61
|
try {
|
|
62
|
+
const defaultSelect = {
|
|
63
|
+
id: true,
|
|
64
|
+
ownerId: true,
|
|
65
|
+
cc: true,
|
|
66
|
+
number: true,
|
|
67
|
+
isVerified: true,
|
|
68
|
+
isPrimary: true,
|
|
69
|
+
createdAt: true,
|
|
70
|
+
updatedAt: true,
|
|
71
|
+
};
|
|
72
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
60
73
|
const client = (0, executor_1.getClient)();
|
|
61
|
-
const result = await client.phoneNumber
|
|
62
|
-
.findMany({
|
|
63
|
-
select: {
|
|
64
|
-
id: true,
|
|
65
|
-
ownerId: true,
|
|
66
|
-
cc: true,
|
|
67
|
-
number: true,
|
|
68
|
-
isVerified: true,
|
|
69
|
-
isPrimary: true,
|
|
70
|
-
createdAt: true,
|
|
71
|
-
updatedAt: true,
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
.execute();
|
|
74
|
+
const result = await client.phoneNumber.findMany(findManyArgs).execute();
|
|
75
75
|
console.log(JSON.stringify(result, null, 2));
|
|
76
76
|
}
|
|
77
77
|
catch (error) {
|
|
@@ -82,6 +82,31 @@ async function handleList(_argv, _prompter) {
|
|
|
82
82
|
process.exit(1);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
async function handleFindFirst(argv, _prompter) {
|
|
86
|
+
try {
|
|
87
|
+
const defaultSelect = {
|
|
88
|
+
id: true,
|
|
89
|
+
ownerId: true,
|
|
90
|
+
cc: true,
|
|
91
|
+
number: true,
|
|
92
|
+
isVerified: true,
|
|
93
|
+
isPrimary: true,
|
|
94
|
+
createdAt: true,
|
|
95
|
+
updatedAt: true,
|
|
96
|
+
};
|
|
97
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
98
|
+
const client = (0, executor_1.getClient)();
|
|
99
|
+
const result = await client.phoneNumber.findFirst(findFirstArgs).execute();
|
|
100
|
+
console.log(JSON.stringify(result, null, 2));
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.error('Failed to find record.');
|
|
104
|
+
if (error instanceof Error) {
|
|
105
|
+
console.error(error.message);
|
|
106
|
+
}
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
85
110
|
async function handleGet(argv, prompter) {
|
|
86
111
|
try {
|
|
87
112
|
const answers = await prompter.prompt(argv, [
|
|
@@ -12,7 +12,7 @@ const fieldSchema = {
|
|
|
12
12
|
id: 'int',
|
|
13
13
|
name: 'string',
|
|
14
14
|
};
|
|
15
|
-
const usage = '\nrole-type <command>\n\nCommands:\n list List
|
|
15
|
+
const usage = '\nrole-type <command>\n\nCommands:\n list List roleType records\n find-first Find first matching roleType record\n get Get a roleType by ID\n create Create a new roleType\n update Update an existing roleType\n delete Delete a roleType\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';
|
|
16
16
|
exports.default = async (argv, prompter, _options) => {
|
|
17
17
|
if (argv.help || argv.h) {
|
|
18
18
|
console.log(usage);
|
|
@@ -25,7 +25,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
25
25
|
type: 'autocomplete',
|
|
26
26
|
name: 'subcommand',
|
|
27
27
|
message: 'What do you want to do?',
|
|
28
|
-
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
28
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
29
29
|
},
|
|
30
30
|
]);
|
|
31
31
|
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
@@ -36,6 +36,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
36
36
|
switch (subcommand) {
|
|
37
37
|
case 'list':
|
|
38
38
|
return handleList(argv, prompter);
|
|
39
|
+
case 'find-first':
|
|
40
|
+
return handleFindFirst(argv, prompter);
|
|
39
41
|
case 'get':
|
|
40
42
|
return handleGet(argv, prompter);
|
|
41
43
|
case 'create':
|
|
@@ -49,17 +51,15 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
|
49
51
|
process.exit(1);
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
async function handleList(
|
|
54
|
+
async function handleList(argv, _prompter) {
|
|
53
55
|
try {
|
|
56
|
+
const defaultSelect = {
|
|
57
|
+
id: true,
|
|
58
|
+
name: true,
|
|
59
|
+
};
|
|
60
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
54
61
|
const client = (0, executor_1.getClient)();
|
|
55
|
-
const result = await client.roleType
|
|
56
|
-
.findMany({
|
|
57
|
-
select: {
|
|
58
|
-
id: true,
|
|
59
|
-
name: true,
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
.execute();
|
|
62
|
+
const result = await client.roleType.findMany(findManyArgs).execute();
|
|
63
63
|
console.log(JSON.stringify(result, null, 2));
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
@@ -70,6 +70,25 @@ async function handleList(_argv, _prompter) {
|
|
|
70
70
|
process.exit(1);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
async function handleFindFirst(argv, _prompter) {
|
|
74
|
+
try {
|
|
75
|
+
const defaultSelect = {
|
|
76
|
+
id: true,
|
|
77
|
+
name: true,
|
|
78
|
+
};
|
|
79
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
80
|
+
const client = (0, executor_1.getClient)();
|
|
81
|
+
const result = await client.roleType.findFirst(findFirstArgs).execute();
|
|
82
|
+
console.log(JSON.stringify(result, null, 2));
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error('Failed to find record.');
|
|
86
|
+
if (error instanceof Error) {
|
|
87
|
+
console.error(error.message);
|
|
88
|
+
}
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
73
92
|
async function handleGet(argv, prompter) {
|
|
74
93
|
try {
|
|
75
94
|
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, [
|
package/auth/cli/utils.d.ts
CHANGED
|
@@ -47,4 +47,42 @@ export declare function unflattenDotNotation(answers: Record<string, unknown>):
|
|
|
47
47
|
* @param paths - Comma-separated dot-notation field paths (e.g. 'clientMutationId,result.accessToken')
|
|
48
48
|
* @returns The nested select object for the ORM
|
|
49
49
|
*/
|
|
50
|
+
/**
|
|
51
|
+
* Parse a CLI flag as an integer.
|
|
52
|
+
* Handles minimist delivering numbers or strings depending on the input.
|
|
53
|
+
* Returns undefined when the flag is missing or not a valid number.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseIntFlag(argv: Record<string, unknown>, name: string): number | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Parse a CLI flag as a string.
|
|
58
|
+
* Returns undefined when the flag is missing or not a string.
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseStringFlag(argv: Record<string, unknown>, name: string): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Parse --orderBy flag as a comma-separated list of enum values.
|
|
63
|
+
* e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC']
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseOrderByFlag(argv: Record<string, unknown>): string[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Parse --select flag into a select object, falling back to a default.
|
|
68
|
+
* e.g. --select id,name → { id: true, name: true }
|
|
69
|
+
*/
|
|
70
|
+
export declare function parseSelectFlag(argv: Record<string, unknown>, defaultSelect: Record<string, unknown>): Record<string, unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Build the full findManyArgs object from CLI argv.
|
|
73
|
+
* Parses all pagination, filtering, ordering, and field selection flags
|
|
74
|
+
* in one call. Accepts an optional `extraWhere` to merge with dot-notation
|
|
75
|
+
* --where flags (used by the search handler to inject search clauses).
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* const findManyArgs = parseFindManyArgs(argv, { id: true, name: true });
|
|
79
|
+
* const result = await client.user.findMany(findManyArgs).execute();
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseFindManyArgs<T = Record<string, unknown>>(argv: Record<string, unknown>, defaultSelect: Record<string, unknown>, extraWhere?: Record<string, unknown>): T;
|
|
82
|
+
/**
|
|
83
|
+
* Build findFirst args from CLI argv.
|
|
84
|
+
* Like parseFindManyArgs but only includes select, where, and condition
|
|
85
|
+
* (no pagination flags — findFirst returns the first matching record).
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseFindFirstArgs<T = Record<string, unknown>>(argv: Record<string, unknown>, defaultSelect: Record<string, unknown>): T;
|
|
50
88
|
export declare function buildSelectFromPaths(paths: string): Record<string, unknown>;
|