@constructive-sdk/cli 0.20.8 → 0.21.0
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/{esm/public/cli/commands/append-field-smart-tags.d.ts → admin/cli/commands/usage-snapshot.d.ts} +1 -1
- package/admin/cli/commands/usage-snapshot.js +316 -0
- package/admin/cli/commands.js +3 -1
- package/admin/cli/executor.d.ts +1 -0
- package/admin/orm/index.d.ts +2 -0
- package/admin/orm/index.js +2 -0
- package/admin/orm/input-types.d.ts +129 -0
- package/admin/orm/models/index.d.ts +1 -0
- package/admin/orm/models/index.js +3 -1
- package/admin/orm/models/usageSnapshot.d.ts +56 -0
- package/admin/orm/models/usageSnapshot.js +100 -0
- package/{public/cli/commands/append-field-smart-tags.d.ts → esm/admin/cli/commands/usage-snapshot.d.ts} +1 -1
- package/esm/admin/cli/commands/usage-snapshot.js +314 -0
- package/esm/admin/cli/commands.js +3 -1
- package/esm/admin/cli/executor.d.ts +1 -0
- package/esm/admin/orm/index.d.ts +2 -0
- package/esm/admin/orm/index.js +2 -0
- package/esm/admin/orm/input-types.d.ts +129 -0
- package/esm/admin/orm/models/index.d.ts +1 -0
- package/esm/admin/orm/models/index.js +1 -0
- package/esm/admin/orm/models/usageSnapshot.d.ts +56 -0
- package/esm/admin/orm/models/usageSnapshot.js +96 -0
- package/esm/public/cli/commands/{append-table-smart-tags.d.ts → usage-snapshot.d.ts} +1 -1
- package/esm/public/cli/commands/usage-snapshot.js +314 -0
- package/esm/public/cli/commands.js +3 -5
- package/esm/public/cli/executor.d.ts +1 -10
- package/esm/public/orm/index.d.ts +2 -10
- package/esm/public/orm/index.js +2 -0
- package/esm/public/orm/input-types.d.ts +129 -22
- package/esm/public/orm/models/index.d.ts +1 -0
- package/esm/public/orm/models/index.js +1 -0
- package/esm/public/orm/models/usageSnapshot.d.ts +56 -0
- package/esm/public/orm/models/usageSnapshot.js +96 -0
- package/esm/public/orm/mutation/index.d.ts +1 -17
- package/esm/public/orm/mutation/index.js +0 -24
- package/package.json +6 -6
- package/public/cli/commands/{append-table-smart-tags.d.ts → usage-snapshot.d.ts} +1 -1
- package/public/cli/commands/usage-snapshot.js +316 -0
- package/public/cli/commands.js +3 -5
- package/public/cli/executor.d.ts +1 -10
- package/public/orm/index.d.ts +2 -10
- package/public/orm/index.js +2 -0
- package/public/orm/input-types.d.ts +129 -22
- package/public/orm/models/index.d.ts +1 -0
- package/public/orm/models/index.js +3 -1
- package/public/orm/models/usageSnapshot.d.ts +56 -0
- package/public/orm/models/usageSnapshot.js +100 -0
- package/public/orm/mutation/index.d.ts +1 -17
- package/public/orm/mutation/index.js +0 -24
- package/esm/public/cli/commands/append-field-smart-tags.js +0 -34
- package/esm/public/cli/commands/append-table-smart-tags.js +0 -34
- package/public/cli/commands/append-field-smart-tags.js +0 -36
- package/public/cli/commands/append-table-smart-tags.js +0 -36
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { OrmClient } from '../client';
|
|
7
7
|
import { QueryBuilder } from '../query-builder';
|
|
8
8
|
import type { InferSelectResult, StrictSelect } from '../select-types';
|
|
9
|
-
import type { SendAccountDeletionEmailInput, SignOutInput, AcceptDatabaseTransferInput, CancelDatabaseTransferInput, RejectDatabaseTransferInput, DisconnectAccountInput, RevokeApiKeyInput, RevokeSessionInput, VerifyPasswordInput, VerifyTotpInput, SubmitAppInviteCodeInput, SubmitOrgInviteCodeInput, CheckPasswordInput, ConfirmDeleteAccountInput, SetPasswordInput, VerifyEmailInput, FreezeObjectsInput, InitEmptyRepoInput, ConstructBlueprintInput, ProvisionNewUserInput, ResetPasswordInput, RemoveNodeAtPathInput, CopyTemplateToBlueprintInput, ProvisionSpatialRelationInput, BootstrapUserInput, SetFieldOrderInput,
|
|
9
|
+
import type { SendAccountDeletionEmailInput, SignOutInput, AcceptDatabaseTransferInput, CancelDatabaseTransferInput, RejectDatabaseTransferInput, DisconnectAccountInput, RevokeApiKeyInput, RevokeSessionInput, VerifyPasswordInput, VerifyTotpInput, SubmitAppInviteCodeInput, SubmitOrgInviteCodeInput, CheckPasswordInput, ConfirmDeleteAccountInput, SetPasswordInput, VerifyEmailInput, FreezeObjectsInput, InitEmptyRepoInput, ConstructBlueprintInput, ProvisionNewUserInput, ResetPasswordInput, RemoveNodeAtPathInput, CopyTemplateToBlueprintInput, ProvisionSpatialRelationInput, BootstrapUserInput, SetFieldOrderInput, ProvisionUniqueConstraintInput, ProvisionFullTextSearchInput, ProvisionIndexInput, SetDataAtPathInput, SetPropsAndCommitInput, ProvisionDatabaseWithUserInput, InsertNodeAtPathInput, UpdateNodeAtPathInput, SetAndCommitInput, ProvisionRelationInput, ApplyRlsInput, SignInCrossOriginInput, CreateUserDatabaseInput, ExtendTokenExpiresInput, CreateApiKeyInput, SendVerificationEmailInput, ForgotPasswordInput, SignUpInput, RequestCrossOriginTokenInput, SignInInput, ProvisionTableInput, ProvisionBucketInput, SendAccountDeletionEmailPayload, SignOutPayload, AcceptDatabaseTransferPayload, CancelDatabaseTransferPayload, RejectDatabaseTransferPayload, DisconnectAccountPayload, RevokeApiKeyPayload, RevokeSessionPayload, VerifyPasswordPayload, VerifyTotpPayload, SubmitAppInviteCodePayload, SubmitOrgInviteCodePayload, CheckPasswordPayload, ConfirmDeleteAccountPayload, SetPasswordPayload, VerifyEmailPayload, FreezeObjectsPayload, InitEmptyRepoPayload, ConstructBlueprintPayload, ProvisionNewUserPayload, ResetPasswordPayload, RemoveNodeAtPathPayload, CopyTemplateToBlueprintPayload, ProvisionSpatialRelationPayload, BootstrapUserPayload, SetFieldOrderPayload, ProvisionUniqueConstraintPayload, ProvisionFullTextSearchPayload, ProvisionIndexPayload, SetDataAtPathPayload, SetPropsAndCommitPayload, ProvisionDatabaseWithUserPayload, InsertNodeAtPathPayload, UpdateNodeAtPathPayload, SetAndCommitPayload, ProvisionRelationPayload, ApplyRlsPayload, SignInCrossOriginPayload, CreateUserDatabasePayload, ExtendTokenExpiresPayload, CreateApiKeyPayload, SendVerificationEmailPayload, ForgotPasswordPayload, SignUpPayload, RequestCrossOriginTokenPayload, SignInPayload, ProvisionTablePayload, ProvisionBucketPayload, SendAccountDeletionEmailPayloadSelect, SignOutPayloadSelect, AcceptDatabaseTransferPayloadSelect, CancelDatabaseTransferPayloadSelect, RejectDatabaseTransferPayloadSelect, DisconnectAccountPayloadSelect, RevokeApiKeyPayloadSelect, RevokeSessionPayloadSelect, VerifyPasswordPayloadSelect, VerifyTotpPayloadSelect, SubmitAppInviteCodePayloadSelect, SubmitOrgInviteCodePayloadSelect, CheckPasswordPayloadSelect, ConfirmDeleteAccountPayloadSelect, SetPasswordPayloadSelect, VerifyEmailPayloadSelect, FreezeObjectsPayloadSelect, InitEmptyRepoPayloadSelect, ConstructBlueprintPayloadSelect, ProvisionNewUserPayloadSelect, ResetPasswordPayloadSelect, RemoveNodeAtPathPayloadSelect, CopyTemplateToBlueprintPayloadSelect, ProvisionSpatialRelationPayloadSelect, BootstrapUserPayloadSelect, SetFieldOrderPayloadSelect, ProvisionUniqueConstraintPayloadSelect, ProvisionFullTextSearchPayloadSelect, ProvisionIndexPayloadSelect, SetDataAtPathPayloadSelect, SetPropsAndCommitPayloadSelect, ProvisionDatabaseWithUserPayloadSelect, InsertNodeAtPathPayloadSelect, UpdateNodeAtPathPayloadSelect, SetAndCommitPayloadSelect, ProvisionRelationPayloadSelect, ApplyRlsPayloadSelect, SignInCrossOriginPayloadSelect, CreateUserDatabasePayloadSelect, ExtendTokenExpiresPayloadSelect, CreateApiKeyPayloadSelect, SendVerificationEmailPayloadSelect, ForgotPasswordPayloadSelect, SignUpPayloadSelect, RequestCrossOriginTokenPayloadSelect, SignInPayloadSelect, ProvisionTablePayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
|
|
10
10
|
export interface SendAccountDeletionEmailVariables {
|
|
11
11
|
input: SendAccountDeletionEmailInput;
|
|
12
12
|
}
|
|
@@ -97,12 +97,6 @@ export interface BootstrapUserVariables {
|
|
|
97
97
|
export interface SetFieldOrderVariables {
|
|
98
98
|
input: SetFieldOrderInput;
|
|
99
99
|
}
|
|
100
|
-
export interface AppendFieldSmartTagsVariables {
|
|
101
|
-
input: AppendFieldSmartTagsInput;
|
|
102
|
-
}
|
|
103
|
-
export interface AppendTableSmartTagsVariables {
|
|
104
|
-
input: AppendTableSmartTagsInput;
|
|
105
|
-
}
|
|
106
100
|
/**
|
|
107
101
|
* Variables for provisionUniqueConstraint
|
|
108
102
|
* Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.
|
|
@@ -346,16 +340,6 @@ export declare function createMutationOperations(client: OrmClient): {
|
|
|
346
340
|
} & StrictSelect<S, SetFieldOrderPayloadSelect>) => QueryBuilder<{
|
|
347
341
|
setFieldOrder: InferSelectResult<SetFieldOrderPayload, S> | null;
|
|
348
342
|
}>;
|
|
349
|
-
appendFieldSmartTags: <S extends AppendFieldSmartTagsPayloadSelect>(args: AppendFieldSmartTagsVariables, options: {
|
|
350
|
-
select: S;
|
|
351
|
-
} & StrictSelect<S, AppendFieldSmartTagsPayloadSelect>) => QueryBuilder<{
|
|
352
|
-
appendFieldSmartTags: InferSelectResult<AppendFieldSmartTagsPayload, S> | null;
|
|
353
|
-
}>;
|
|
354
|
-
appendTableSmartTags: <S extends AppendTableSmartTagsPayloadSelect>(args: AppendTableSmartTagsVariables, options: {
|
|
355
|
-
select: S;
|
|
356
|
-
} & StrictSelect<S, AppendTableSmartTagsPayloadSelect>) => QueryBuilder<{
|
|
357
|
-
appendTableSmartTags: InferSelectResult<AppendTableSmartTagsPayload, S> | null;
|
|
358
|
-
}>;
|
|
359
343
|
provisionUniqueConstraint: <S extends ProvisionUniqueConstraintPayloadSelect>(args: ProvisionUniqueConstraintVariables, options: {
|
|
360
344
|
select: S;
|
|
361
345
|
} & StrictSelect<S, ProvisionUniqueConstraintPayloadSelect>) => QueryBuilder<{
|
|
@@ -314,30 +314,6 @@ export function createMutationOperations(client) {
|
|
|
314
314
|
},
|
|
315
315
|
], connectionFieldsMap, 'SetFieldOrderPayload'),
|
|
316
316
|
}),
|
|
317
|
-
appendFieldSmartTags: (args, options) => new QueryBuilder({
|
|
318
|
-
client,
|
|
319
|
-
operation: 'mutation',
|
|
320
|
-
operationName: 'AppendFieldSmartTags',
|
|
321
|
-
fieldName: 'appendFieldSmartTags',
|
|
322
|
-
...buildCustomDocument('mutation', 'AppendFieldSmartTags', 'appendFieldSmartTags', options.select, args, [
|
|
323
|
-
{
|
|
324
|
-
name: 'input',
|
|
325
|
-
type: 'AppendFieldSmartTagsInput!',
|
|
326
|
-
},
|
|
327
|
-
], connectionFieldsMap, 'AppendFieldSmartTagsPayload'),
|
|
328
|
-
}),
|
|
329
|
-
appendTableSmartTags: (args, options) => new QueryBuilder({
|
|
330
|
-
client,
|
|
331
|
-
operation: 'mutation',
|
|
332
|
-
operationName: 'AppendTableSmartTags',
|
|
333
|
-
fieldName: 'appendTableSmartTags',
|
|
334
|
-
...buildCustomDocument('mutation', 'AppendTableSmartTags', 'appendTableSmartTags', options.select, args, [
|
|
335
|
-
{
|
|
336
|
-
name: 'input',
|
|
337
|
-
type: 'AppendTableSmartTagsInput!',
|
|
338
|
-
},
|
|
339
|
-
], connectionFieldsMap, 'AppendTableSmartTagsPayload'),
|
|
340
|
-
}),
|
|
341
317
|
provisionUniqueConstraint: (args, options) => new QueryBuilder({
|
|
342
318
|
client,
|
|
343
319
|
operation: 'mutation',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-sdk/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive CLI SDK - Auto-generated GraphQL CLI with ORM client, context management, and interactive prompts",
|
|
6
6
|
"main": "index.js",
|
|
@@ -46,21 +46,21 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@0no-co/graphql.web": "^1.1.2",
|
|
49
|
-
"@constructive-io/graphql-query": "^3.
|
|
50
|
-
"@constructive-io/graphql-types": "^3.
|
|
49
|
+
"@constructive-io/graphql-query": "^3.23.0",
|
|
50
|
+
"@constructive-io/graphql-types": "^3.9.0",
|
|
51
51
|
"appstash": "^0.7.0",
|
|
52
|
-
"gql-ast": "^3.
|
|
52
|
+
"gql-ast": "^3.9.0",
|
|
53
53
|
"graphql": "16.13.0",
|
|
54
54
|
"inquirerer": "^4.7.0",
|
|
55
55
|
"nested-obj": "^0.2.2",
|
|
56
56
|
"yanse": "^0.2.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@constructive-io/graphql-codegen": "^4.
|
|
59
|
+
"@constructive-io/graphql-codegen": "^4.40.0",
|
|
60
60
|
"@types/node": "^22.19.11",
|
|
61
61
|
"makage": "^0.3.0",
|
|
62
62
|
"tsx": "^4.19.0",
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "c665e2443ec98da61e9f372cf663cb9973afef4b"
|
|
66
66
|
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* CLI commands for UsageSnapshot
|
|
5
|
+
* @generated by @constructive-io/graphql-codegen
|
|
6
|
+
* DO NOT EDIT - changes will be overwritten
|
|
7
|
+
*/
|
|
8
|
+
const inquirerer_1 = require("inquirerer");
|
|
9
|
+
const executor_1 = require("../executor");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const fieldSchema = {
|
|
12
|
+
databaseId: 'uuid',
|
|
13
|
+
metricName: 'string',
|
|
14
|
+
metricValue: 'int',
|
|
15
|
+
dimensions: 'json',
|
|
16
|
+
capturedAt: 'string',
|
|
17
|
+
id: 'uuid',
|
|
18
|
+
};
|
|
19
|
+
const usage = '\nusage-snapshot <command>\n\nCommands:\n list List usageSnapshot records\n find-first Find first matching usageSnapshot record\n get Get a usageSnapshot by ID\n create Create a new usageSnapshot\n update Update an existing usageSnapshot\n delete Delete a usageSnapshot\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n\n --help, -h Show this help message\n';
|
|
20
|
+
exports.default = async (argv, prompter, _options) => {
|
|
21
|
+
if (argv.help || argv.h) {
|
|
22
|
+
console.log(usage);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
const { first: subcommand, newArgv } = (0, inquirerer_1.extractFirst)(argv);
|
|
26
|
+
if (!subcommand) {
|
|
27
|
+
const answer = await prompter.prompt(argv, [
|
|
28
|
+
{
|
|
29
|
+
type: 'autocomplete',
|
|
30
|
+
name: 'subcommand',
|
|
31
|
+
message: 'What do you want to do?',
|
|
32
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
36
|
+
}
|
|
37
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
38
|
+
};
|
|
39
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
40
|
+
switch (subcommand) {
|
|
41
|
+
case 'list':
|
|
42
|
+
return handleList(argv, prompter);
|
|
43
|
+
case 'find-first':
|
|
44
|
+
return handleFindFirst(argv, prompter);
|
|
45
|
+
case 'get':
|
|
46
|
+
return handleGet(argv, prompter);
|
|
47
|
+
case 'create':
|
|
48
|
+
return handleCreate(argv, prompter);
|
|
49
|
+
case 'update':
|
|
50
|
+
return handleUpdate(argv, prompter);
|
|
51
|
+
case 'delete':
|
|
52
|
+
return handleDelete(argv, prompter);
|
|
53
|
+
default:
|
|
54
|
+
console.log(usage);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function handleList(argv, _prompter) {
|
|
59
|
+
try {
|
|
60
|
+
const defaultSelect = {
|
|
61
|
+
databaseId: true,
|
|
62
|
+
metricName: true,
|
|
63
|
+
metricValue: true,
|
|
64
|
+
dimensions: true,
|
|
65
|
+
capturedAt: true,
|
|
66
|
+
id: true,
|
|
67
|
+
};
|
|
68
|
+
const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
|
|
69
|
+
const client = (0, executor_1.getClient)();
|
|
70
|
+
const result = await client.usageSnapshot.findMany(findManyArgs).execute();
|
|
71
|
+
console.log(JSON.stringify(result, null, 2));
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error('Failed to list records.');
|
|
75
|
+
if (error instanceof Error) {
|
|
76
|
+
console.error(error.message);
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function handleFindFirst(argv, _prompter) {
|
|
82
|
+
try {
|
|
83
|
+
const defaultSelect = {
|
|
84
|
+
databaseId: true,
|
|
85
|
+
metricName: true,
|
|
86
|
+
metricValue: true,
|
|
87
|
+
dimensions: true,
|
|
88
|
+
capturedAt: true,
|
|
89
|
+
id: true,
|
|
90
|
+
};
|
|
91
|
+
const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
|
|
92
|
+
const client = (0, executor_1.getClient)();
|
|
93
|
+
const result = await client.usageSnapshot.findFirst(findFirstArgs).execute();
|
|
94
|
+
console.log(JSON.stringify(result, null, 2));
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('Failed to find record.');
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
console.error(error.message);
|
|
100
|
+
}
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function handleGet(argv, prompter) {
|
|
105
|
+
try {
|
|
106
|
+
const answers = await prompter.prompt(argv, [
|
|
107
|
+
{
|
|
108
|
+
type: 'text',
|
|
109
|
+
name: 'id',
|
|
110
|
+
message: 'id',
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
]);
|
|
114
|
+
const client = (0, executor_1.getClient)();
|
|
115
|
+
const result = await client.usageSnapshot
|
|
116
|
+
.findOne({
|
|
117
|
+
id: answers.id,
|
|
118
|
+
select: {
|
|
119
|
+
databaseId: true,
|
|
120
|
+
metricName: true,
|
|
121
|
+
metricValue: true,
|
|
122
|
+
dimensions: true,
|
|
123
|
+
capturedAt: true,
|
|
124
|
+
id: true,
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
.execute();
|
|
128
|
+
console.log(JSON.stringify(result, null, 2));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
console.error('Record not found.');
|
|
132
|
+
if (error instanceof Error) {
|
|
133
|
+
console.error(error.message);
|
|
134
|
+
}
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function handleCreate(argv, prompter) {
|
|
139
|
+
try {
|
|
140
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
141
|
+
{
|
|
142
|
+
type: 'text',
|
|
143
|
+
name: 'databaseId',
|
|
144
|
+
message: 'databaseId',
|
|
145
|
+
required: true,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'text',
|
|
149
|
+
name: 'metricName',
|
|
150
|
+
message: 'metricName',
|
|
151
|
+
required: true,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'text',
|
|
155
|
+
name: 'metricValue',
|
|
156
|
+
message: 'metricValue',
|
|
157
|
+
required: false,
|
|
158
|
+
skipPrompt: true,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: 'json',
|
|
162
|
+
name: 'dimensions',
|
|
163
|
+
message: 'dimensions',
|
|
164
|
+
required: false,
|
|
165
|
+
skipPrompt: true,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: 'text',
|
|
169
|
+
name: 'capturedAt',
|
|
170
|
+
message: 'capturedAt',
|
|
171
|
+
required: false,
|
|
172
|
+
skipPrompt: true,
|
|
173
|
+
},
|
|
174
|
+
]);
|
|
175
|
+
const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
|
|
176
|
+
const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
|
|
177
|
+
const client = (0, executor_1.getClient)();
|
|
178
|
+
const result = await client.usageSnapshot
|
|
179
|
+
.create({
|
|
180
|
+
data: {
|
|
181
|
+
databaseId: cleanedData.databaseId,
|
|
182
|
+
metricName: cleanedData.metricName,
|
|
183
|
+
metricValue: cleanedData.metricValue,
|
|
184
|
+
dimensions: cleanedData.dimensions,
|
|
185
|
+
capturedAt: cleanedData.capturedAt,
|
|
186
|
+
},
|
|
187
|
+
select: {
|
|
188
|
+
databaseId: true,
|
|
189
|
+
metricName: true,
|
|
190
|
+
metricValue: true,
|
|
191
|
+
dimensions: true,
|
|
192
|
+
capturedAt: true,
|
|
193
|
+
id: true,
|
|
194
|
+
},
|
|
195
|
+
})
|
|
196
|
+
.execute();
|
|
197
|
+
console.log(JSON.stringify(result, null, 2));
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
console.error('Failed to create record.');
|
|
201
|
+
if (error instanceof Error) {
|
|
202
|
+
console.error(error.message);
|
|
203
|
+
}
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async function handleUpdate(argv, prompter) {
|
|
208
|
+
try {
|
|
209
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
210
|
+
{
|
|
211
|
+
type: 'text',
|
|
212
|
+
name: 'id',
|
|
213
|
+
message: 'id',
|
|
214
|
+
required: true,
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
type: 'text',
|
|
218
|
+
name: 'databaseId',
|
|
219
|
+
message: 'databaseId',
|
|
220
|
+
required: false,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
type: 'text',
|
|
224
|
+
name: 'metricName',
|
|
225
|
+
message: 'metricName',
|
|
226
|
+
required: false,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: 'text',
|
|
230
|
+
name: 'metricValue',
|
|
231
|
+
message: 'metricValue',
|
|
232
|
+
required: false,
|
|
233
|
+
skipPrompt: true,
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: 'json',
|
|
237
|
+
name: 'dimensions',
|
|
238
|
+
message: 'dimensions',
|
|
239
|
+
required: false,
|
|
240
|
+
skipPrompt: true,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
type: 'text',
|
|
244
|
+
name: 'capturedAt',
|
|
245
|
+
message: 'capturedAt',
|
|
246
|
+
required: false,
|
|
247
|
+
skipPrompt: true,
|
|
248
|
+
},
|
|
249
|
+
]);
|
|
250
|
+
const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
|
|
251
|
+
const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
|
|
252
|
+
const client = (0, executor_1.getClient)();
|
|
253
|
+
const result = await client.usageSnapshot
|
|
254
|
+
.update({
|
|
255
|
+
where: {
|
|
256
|
+
id: answers.id,
|
|
257
|
+
},
|
|
258
|
+
data: {
|
|
259
|
+
databaseId: cleanedData.databaseId,
|
|
260
|
+
metricName: cleanedData.metricName,
|
|
261
|
+
metricValue: cleanedData.metricValue,
|
|
262
|
+
dimensions: cleanedData.dimensions,
|
|
263
|
+
capturedAt: cleanedData.capturedAt,
|
|
264
|
+
},
|
|
265
|
+
select: {
|
|
266
|
+
databaseId: true,
|
|
267
|
+
metricName: true,
|
|
268
|
+
metricValue: true,
|
|
269
|
+
dimensions: true,
|
|
270
|
+
capturedAt: true,
|
|
271
|
+
id: true,
|
|
272
|
+
},
|
|
273
|
+
})
|
|
274
|
+
.execute();
|
|
275
|
+
console.log(JSON.stringify(result, null, 2));
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
console.error('Failed to update record.');
|
|
279
|
+
if (error instanceof Error) {
|
|
280
|
+
console.error(error.message);
|
|
281
|
+
}
|
|
282
|
+
process.exit(1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
async function handleDelete(argv, prompter) {
|
|
286
|
+
try {
|
|
287
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
288
|
+
{
|
|
289
|
+
type: 'text',
|
|
290
|
+
name: 'id',
|
|
291
|
+
message: 'id',
|
|
292
|
+
required: true,
|
|
293
|
+
},
|
|
294
|
+
]);
|
|
295
|
+
const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
|
|
296
|
+
const client = (0, executor_1.getClient)();
|
|
297
|
+
const result = await client.usageSnapshot
|
|
298
|
+
.delete({
|
|
299
|
+
where: {
|
|
300
|
+
id: answers.id,
|
|
301
|
+
},
|
|
302
|
+
select: {
|
|
303
|
+
id: true,
|
|
304
|
+
},
|
|
305
|
+
})
|
|
306
|
+
.execute();
|
|
307
|
+
console.log(JSON.stringify(result, null, 2));
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
console.error('Failed to delete record.');
|
|
311
|
+
if (error instanceof Error) {
|
|
312
|
+
console.error(error.message);
|
|
313
|
+
}
|
|
314
|
+
process.exit(1);
|
|
315
|
+
}
|
|
316
|
+
}
|
package/public/cli/commands.js
CHANGED
|
@@ -143,6 +143,7 @@ const user_connected_account_1 = __importDefault(require("./commands/user-connec
|
|
|
143
143
|
const commit_1 = __importDefault(require("./commands/commit"));
|
|
144
144
|
const pubkey_setting_1 = __importDefault(require("./commands/pubkey-setting"));
|
|
145
145
|
const rate_limits_module_1 = __importDefault(require("./commands/rate-limits-module"));
|
|
146
|
+
const usage_snapshot_1 = __importDefault(require("./commands/usage-snapshot"));
|
|
146
147
|
const app_membership_default_1 = __importDefault(require("./commands/app-membership-default"));
|
|
147
148
|
const org_membership_default_1 = __importDefault(require("./commands/org-membership-default"));
|
|
148
149
|
const rls_setting_1 = __importDefault(require("./commands/rls-setting"));
|
|
@@ -208,8 +209,6 @@ const copy_template_to_blueprint_1 = __importDefault(require("./commands/copy-te
|
|
|
208
209
|
const provision_spatial_relation_1 = __importDefault(require("./commands/provision-spatial-relation"));
|
|
209
210
|
const bootstrap_user_1 = __importDefault(require("./commands/bootstrap-user"));
|
|
210
211
|
const set_field_order_1 = __importDefault(require("./commands/set-field-order"));
|
|
211
|
-
const append_field_smart_tags_1 = __importDefault(require("./commands/append-field-smart-tags"));
|
|
212
|
-
const append_table_smart_tags_1 = __importDefault(require("./commands/append-table-smart-tags"));
|
|
213
212
|
const provision_unique_constraint_1 = __importDefault(require("./commands/provision-unique-constraint"));
|
|
214
213
|
const provision_full_text_search_1 = __importDefault(require("./commands/provision-full-text-search"));
|
|
215
214
|
const provision_index_1 = __importDefault(require("./commands/provision-index"));
|
|
@@ -366,6 +365,7 @@ const createCommandMap = () => ({
|
|
|
366
365
|
commit: commit_1.default,
|
|
367
366
|
'pubkey-setting': pubkey_setting_1.default,
|
|
368
367
|
'rate-limits-module': rate_limits_module_1.default,
|
|
368
|
+
'usage-snapshot': usage_snapshot_1.default,
|
|
369
369
|
'app-membership-default': app_membership_default_1.default,
|
|
370
370
|
'org-membership-default': org_membership_default_1.default,
|
|
371
371
|
'rls-setting': rls_setting_1.default,
|
|
@@ -431,8 +431,6 @@ const createCommandMap = () => ({
|
|
|
431
431
|
'provision-spatial-relation': provision_spatial_relation_1.default,
|
|
432
432
|
'bootstrap-user': bootstrap_user_1.default,
|
|
433
433
|
'set-field-order': set_field_order_1.default,
|
|
434
|
-
'append-field-smart-tags': append_field_smart_tags_1.default,
|
|
435
|
-
'append-table-smart-tags': append_table_smart_tags_1.default,
|
|
436
434
|
'provision-unique-constraint': provision_unique_constraint_1.default,
|
|
437
435
|
'provision-full-text-search': provision_full_text_search_1.default,
|
|
438
436
|
'provision-index': provision_index_1.default,
|
|
@@ -456,7 +454,7 @@ const createCommandMap = () => ({
|
|
|
456
454
|
'provision-table': provision_table_1.default,
|
|
457
455
|
'provision-bucket': provision_bucket_1.default,
|
|
458
456
|
});
|
|
459
|
-
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n get-all-record getAllRecord CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n object object CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n spatial-relation spatialRelation CRUD operations\n partition partition CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n session-secrets-module sessionSecretsModule CRUD operations\n identity-providers-module identityProvidersModule CRUD operations\n realtime-module realtimeModule CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n function function CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n cors-setting corsSetting CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n api-setting apiSetting CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n blueprint-construction blueprintConstruction CRUD operations\n storage-module storageModule CRUD operations\n entity-type-provision entityTypeProvision CRUD operations\n webauthn-credentials-module webauthnCredentialsModule CRUD operations\n webauthn-auth-module webauthnAuthModule CRUD operations\n notifications-module notificationsModule CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-member-profile orgMemberProfile CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n app-limit-credit appLimitCredit CRUD operations\n app-limit-credit-code-item appLimitCreditCodeItem CRUD operations\n app-limit-credit-redemption appLimitCreditRedemption CRUD operations\n org-limit orgLimit CRUD operations\n org-limit-credit orgLimitCredit CRUD operations\n org-limit-aggregate orgLimitAggregate CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n webauthn-credential webauthnCredential CRUD operations\n app-invite appInvite CRUD operations\n app-claimed-invite appClaimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n agent-thread agentThread CRUD operations\n agent-message agentMessage CRUD operations\n agent-task agentTask CRUD operations\n role-type roleType CRUD operations\n identity-provider identityProvider CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n app-limit-credit-code appLimitCreditCode CRUD operations\n app-limit-caps-default appLimitCapsDefault CRUD operations\n org-limit-caps-default orgLimitCapsDefault CRUD operations\n app-limit-cap appLimitCap CRUD operations\n org-limit-cap orgLimitCap CRUD operations\n membership-type membershipType CRUD operations\n migrate-file migrateFile CRUD operations\n devices-module devicesModule CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n user-connected-account userConnectedAccount CRUD operations\n commit commit CRUD operations\n pubkey-setting pubkeySetting CRUD operations\n rate-limits-module rateLimitsModule CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n rls-setting rlsSetting CRUD operations\n app-limit-event appLimitEvent CRUD operations\n org-limit-event orgLimitEvent CRUD operations\n rls-module rlsModule CRUD operations\n database-setting databaseSetting CRUD operations\n plans-module plansModule CRUD operations\n sql-action sqlAction CRUD operations\n billing-module billingModule CRUD operations\n ast-migration astMigration CRUD operations\n user user CRUD operations\n org-membership-setting orgMembershipSetting CRUD operations\n webauthn-setting webauthnSetting CRUD operations\n app-membership appMembership CRUD operations\n billing-provider-module billingProviderModule CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-user-agent currentUserAgent\n current-ip-address currentIpAddress\n require-step-up requireStepUp\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n resolve-blueprint-field Resolves a field_name within a given table_id to a field_id. Throws if no match is found. Used by construct_blueprint to translate user-authored field names (e.g. \"location\") into field UUIDs for downstream provisioning procedures. table_id must already be resolved (via resolve_blueprint_table) before calling this.\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n resolve-blueprint-table Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n disconnect-account disconnectAccount\n revoke-api-key revokeApiKey\n revoke-session revokeSession\n verify-password verifyPassword\n verify-totp verifyTotp\n submit-app-invite-code submitAppInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry \u2014 provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure.\n provision-new-user provisionNewUser\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n provision-spatial-relation Idempotent provisioner for metaschema_public.spatial_relation. Inserts a row declaring a spatial predicate between two geometry/geography columns (owner and target). Called from construct_blueprint when a relation entry has $type=RelationSpatial. Graceful: re-running with the same (source_table_id, name) returns the existing id without modifying the row. Operator whitelist and st_dwithin \u2194 param_name pairing are enforced by the spatial_relation table CHECKs. Both fields must already exist \u2014 this is a metadata-only insert.\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n append-field-smart-tags appendFieldSmartTags\n append-table-smart-tags appendTableSmartTags\n provision-unique-constraint Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n provision-full-text-search Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n provision-index Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n provision-database-with-user provisionDatabaseWithUser\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n provision-relation Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n apply-rls applyRls\n sign-in-cross-origin signInCrossOrigin\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n create-api-key createApiKey\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n sign-up signUp\n request-cross-origin-token requestCrossOriginToken\n sign-in signIn\n provision-table Composable table provisioning: creates or finds a table, then creates fields (so Data* modules can reference them), applies N nodes (Data* modules), enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n\n --help, -h Show this help message\n --version, -v Show version\n";
|
|
457
|
+
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n get-all-record getAllRecord CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n object object CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n spatial-relation spatialRelation CRUD operations\n partition partition CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n session-secrets-module sessionSecretsModule CRUD operations\n identity-providers-module identityProvidersModule CRUD operations\n realtime-module realtimeModule CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n function function CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n cors-setting corsSetting CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n api-setting apiSetting CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n blueprint-construction blueprintConstruction CRUD operations\n storage-module storageModule CRUD operations\n entity-type-provision entityTypeProvision CRUD operations\n webauthn-credentials-module webauthnCredentialsModule CRUD operations\n webauthn-auth-module webauthnAuthModule CRUD operations\n notifications-module notificationsModule CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-member-profile orgMemberProfile CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n app-limit-credit appLimitCredit CRUD operations\n app-limit-credit-code-item appLimitCreditCodeItem CRUD operations\n app-limit-credit-redemption appLimitCreditRedemption CRUD operations\n org-limit orgLimit CRUD operations\n org-limit-credit orgLimitCredit CRUD operations\n org-limit-aggregate orgLimitAggregate CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n webauthn-credential webauthnCredential CRUD operations\n app-invite appInvite CRUD operations\n app-claimed-invite appClaimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n agent-thread agentThread CRUD operations\n agent-message agentMessage CRUD operations\n agent-task agentTask CRUD operations\n role-type roleType CRUD operations\n identity-provider identityProvider CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n app-limit-credit-code appLimitCreditCode CRUD operations\n app-limit-caps-default appLimitCapsDefault CRUD operations\n org-limit-caps-default orgLimitCapsDefault CRUD operations\n app-limit-cap appLimitCap CRUD operations\n org-limit-cap orgLimitCap CRUD operations\n membership-type membershipType CRUD operations\n migrate-file migrateFile CRUD operations\n devices-module devicesModule CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n user-connected-account userConnectedAccount CRUD operations\n commit commit CRUD operations\n pubkey-setting pubkeySetting CRUD operations\n rate-limits-module rateLimitsModule CRUD operations\n usage-snapshot usageSnapshot CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n rls-setting rlsSetting CRUD operations\n app-limit-event appLimitEvent CRUD operations\n org-limit-event orgLimitEvent CRUD operations\n rls-module rlsModule CRUD operations\n database-setting databaseSetting CRUD operations\n plans-module plansModule CRUD operations\n sql-action sqlAction CRUD operations\n billing-module billingModule CRUD operations\n ast-migration astMigration CRUD operations\n user user CRUD operations\n org-membership-setting orgMembershipSetting CRUD operations\n webauthn-setting webauthnSetting CRUD operations\n app-membership appMembership CRUD operations\n billing-provider-module billingProviderModule CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-user-agent currentUserAgent\n current-ip-address currentIpAddress\n require-step-up requireStepUp\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n resolve-blueprint-field Resolves a field_name within a given table_id to a field_id. Throws if no match is found. Used by construct_blueprint to translate user-authored field names (e.g. \"location\") into field UUIDs for downstream provisioning procedures. table_id must already be resolved (via resolve_blueprint_table) before calling this.\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n resolve-blueprint-table Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n disconnect-account disconnectAccount\n revoke-api-key revokeApiKey\n revoke-session revokeSession\n verify-password verifyPassword\n verify-totp verifyTotp\n submit-app-invite-code submitAppInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Six phases: (0) entity_type_provision for each membership_type entry \u2014 provisions entity tables, membership modules, and security, (1) provision_table() for each table with nodes[], fields[], policies[], and grants (table-level indexes/fts/unique_constraints are deferred), (2) provision_relation() for each relation, (3) provision_index() for top-level + deferred indexes, (4) provision_full_text_search() for top-level + deferred FTS, (5) provision_unique_constraint() for top-level + deferred unique constraints. Phase 0 entity tables are added to the table_map so subsequent phases can reference them by name. Table-level indexes/fts/unique_constraints are deferred to phases 3-5 so they can reference columns created by relations in phase 2. Returns the construction record ID on success, NULL on failure.\n provision-new-user provisionNewUser\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n provision-spatial-relation Idempotent provisioner for metaschema_public.spatial_relation. Inserts a row declaring a spatial predicate between two geometry/geography columns (owner and target). Called from construct_blueprint when a relation entry has $type=RelationSpatial. Graceful: re-running with the same (source_table_id, name) returns the existing id without modifying the row. Operator whitelist and st_dwithin \u2194 param_name pairing are enforced by the spatial_relation table CHECKs. Both fields must already exist \u2014 this is a metadata-only insert.\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n provision-unique-constraint Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n provision-full-text-search Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n provision-index Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n provision-database-with-user provisionDatabaseWithUser\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n provision-relation Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n apply-rls applyRls\n sign-in-cross-origin signInCrossOrigin\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n create-api-key createApiKey\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n sign-up signUp\n request-cross-origin-token requestCrossOriginToken\n sign-in signIn\n provision-table Composable table provisioning: creates or finds a table, then creates fields (so Data* modules can reference them), applies N nodes (Data* modules), enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n\n --help, -h Show this help message\n --version, -v Show version\n";
|
|
460
458
|
const commands = async (argv, prompter, options) => {
|
|
461
459
|
if (argv.help || argv.h) {
|
|
462
460
|
console.log(usage);
|
package/public/cli/executor.d.ts
CHANGED
|
@@ -131,6 +131,7 @@ export declare function getClient(contextName?: string): {
|
|
|
131
131
|
commit: import("../orm").CommitModel;
|
|
132
132
|
pubkeySetting: import("../orm").PubkeySettingModel;
|
|
133
133
|
rateLimitsModule: import("../orm").RateLimitsModuleModel;
|
|
134
|
+
usageSnapshot: import("../orm").UsageSnapshotModel;
|
|
134
135
|
appMembershipDefault: import("../orm").AppMembershipDefaultModel;
|
|
135
136
|
orgMembershipDefault: import("../orm").OrgMembershipDefaultModel;
|
|
136
137
|
rlsSetting: import("../orm").RlsSettingModel;
|
|
@@ -391,16 +392,6 @@ export declare function getClient(contextName?: string): {
|
|
|
391
392
|
} & import("../orm").StrictSelect<S, import("../orm/input-types").SetFieldOrderPayloadSelect>) => import("../orm").QueryBuilder<{
|
|
392
393
|
setFieldOrder: import("../orm").InferSelectResult<import("../orm/input-types").SetFieldOrderPayload, S> | null;
|
|
393
394
|
}>;
|
|
394
|
-
appendFieldSmartTags: <S extends import("../orm/input-types").AppendFieldSmartTagsPayloadSelect>(args: import("../orm/mutation").AppendFieldSmartTagsVariables, options: {
|
|
395
|
-
select: S;
|
|
396
|
-
} & import("../orm").StrictSelect<S, import("../orm/input-types").AppendFieldSmartTagsPayloadSelect>) => import("../orm").QueryBuilder<{
|
|
397
|
-
appendFieldSmartTags: import("../orm").InferSelectResult<import("../orm/input-types").AppendFieldSmartTagsPayload, S> | null;
|
|
398
|
-
}>;
|
|
399
|
-
appendTableSmartTags: <S extends import("../orm/input-types").AppendTableSmartTagsPayloadSelect>(args: import("../orm/mutation").AppendTableSmartTagsVariables, options: {
|
|
400
|
-
select: S;
|
|
401
|
-
} & import("../orm").StrictSelect<S, import("../orm/input-types").AppendTableSmartTagsPayloadSelect>) => import("../orm").QueryBuilder<{
|
|
402
|
-
appendTableSmartTags: import("../orm").InferSelectResult<import("../orm/input-types").AppendTableSmartTagsPayload, S> | null;
|
|
403
|
-
}>;
|
|
404
395
|
provisionUniqueConstraint: <S extends import("../orm/input-types").ProvisionUniqueConstraintPayloadSelect>(args: import("../orm/mutation").ProvisionUniqueConstraintVariables, options: {
|
|
405
396
|
select: S;
|
|
406
397
|
} & import("../orm").StrictSelect<S, import("../orm/input-types").ProvisionUniqueConstraintPayloadSelect>) => import("../orm").QueryBuilder<{
|
package/public/orm/index.d.ts
CHANGED
|
@@ -130,6 +130,7 @@ import { UserConnectedAccountModel } from './models/userConnectedAccount';
|
|
|
130
130
|
import { CommitModel } from './models/commit';
|
|
131
131
|
import { PubkeySettingModel } from './models/pubkeySetting';
|
|
132
132
|
import { RateLimitsModuleModel } from './models/rateLimitsModule';
|
|
133
|
+
import { UsageSnapshotModel } from './models/usageSnapshot';
|
|
133
134
|
import { AppMembershipDefaultModel } from './models/appMembershipDefault';
|
|
134
135
|
import { OrgMembershipDefaultModel } from './models/orgMembershipDefault';
|
|
135
136
|
import { RlsSettingModel } from './models/rlsSetting';
|
|
@@ -310,6 +311,7 @@ export declare function createClient(config: OrmClientConfig): {
|
|
|
310
311
|
commit: CommitModel;
|
|
311
312
|
pubkeySetting: PubkeySettingModel;
|
|
312
313
|
rateLimitsModule: RateLimitsModuleModel;
|
|
314
|
+
usageSnapshot: UsageSnapshotModel;
|
|
313
315
|
appMembershipDefault: AppMembershipDefaultModel;
|
|
314
316
|
orgMembershipDefault: OrgMembershipDefaultModel;
|
|
315
317
|
rlsSetting: RlsSettingModel;
|
|
@@ -570,16 +572,6 @@ export declare function createClient(config: OrmClientConfig): {
|
|
|
570
572
|
} & import("./select-types").StrictSelect<S, import("./input-types").SetFieldOrderPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
571
573
|
setFieldOrder: import("./select-types").InferSelectResult<import("./input-types").SetFieldOrderPayload, S> | null;
|
|
572
574
|
}>;
|
|
573
|
-
appendFieldSmartTags: <S extends import("./input-types").AppendFieldSmartTagsPayloadSelect>(args: import("./mutation").AppendFieldSmartTagsVariables, options: {
|
|
574
|
-
select: S;
|
|
575
|
-
} & import("./select-types").StrictSelect<S, import("./input-types").AppendFieldSmartTagsPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
576
|
-
appendFieldSmartTags: import("./select-types").InferSelectResult<import("./input-types").AppendFieldSmartTagsPayload, S> | null;
|
|
577
|
-
}>;
|
|
578
|
-
appendTableSmartTags: <S extends import("./input-types").AppendTableSmartTagsPayloadSelect>(args: import("./mutation").AppendTableSmartTagsVariables, options: {
|
|
579
|
-
select: S;
|
|
580
|
-
} & import("./select-types").StrictSelect<S, import("./input-types").AppendTableSmartTagsPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
581
|
-
appendTableSmartTags: import("./select-types").InferSelectResult<import("./input-types").AppendTableSmartTagsPayload, S> | null;
|
|
582
|
-
}>;
|
|
583
575
|
provisionUniqueConstraint: <S extends import("./input-types").ProvisionUniqueConstraintPayloadSelect>(args: import("./mutation").ProvisionUniqueConstraintVariables, options: {
|
|
584
576
|
select: S;
|
|
585
577
|
} & import("./select-types").StrictSelect<S, import("./input-types").ProvisionUniqueConstraintPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
package/public/orm/index.js
CHANGED
|
@@ -153,6 +153,7 @@ const userConnectedAccount_1 = require("./models/userConnectedAccount");
|
|
|
153
153
|
const commit_1 = require("./models/commit");
|
|
154
154
|
const pubkeySetting_1 = require("./models/pubkeySetting");
|
|
155
155
|
const rateLimitsModule_1 = require("./models/rateLimitsModule");
|
|
156
|
+
const usageSnapshot_1 = require("./models/usageSnapshot");
|
|
156
157
|
const appMembershipDefault_1 = require("./models/appMembershipDefault");
|
|
157
158
|
const orgMembershipDefault_1 = require("./models/orgMembershipDefault");
|
|
158
159
|
const rlsSetting_1 = require("./models/rlsSetting");
|
|
@@ -341,6 +342,7 @@ function createClient(config) {
|
|
|
341
342
|
commit: new commit_1.CommitModel(client),
|
|
342
343
|
pubkeySetting: new pubkeySetting_1.PubkeySettingModel(client),
|
|
343
344
|
rateLimitsModule: new rateLimitsModule_1.RateLimitsModuleModel(client),
|
|
345
|
+
usageSnapshot: new usageSnapshot_1.UsageSnapshotModel(client),
|
|
344
346
|
appMembershipDefault: new appMembershipDefault_1.AppMembershipDefaultModel(client),
|
|
345
347
|
orgMembershipDefault: new orgMembershipDefault_1.OrgMembershipDefaultModel(client),
|
|
346
348
|
rlsSetting: new rlsSetting_1.RlsSettingModel(client),
|