@carthooks/arcubase-cli 0.1.6 → 0.1.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/bundle/arcubase-admin.mjs +1041 -5061
- package/bundle/arcubase.mjs +1041 -5061
- package/dist/generated/command_registry.generated.d.ts +693 -2812
- package/dist/generated/command_registry.generated.d.ts.map +1 -1
- package/dist/generated/command_registry.generated.js +812 -4100
- package/dist/generated/type_index.generated.d.ts +8 -397
- package/dist/generated/type_index.generated.d.ts.map +1 -1
- package/dist/generated/type_index.generated.js +8 -403
- package/dist/generated/zod_registry.generated.d.ts +33 -261
- package/dist/generated/zod_registry.generated.d.ts.map +1 -1
- package/dist/generated/zod_registry.generated.js +36 -365
- package/dist/runtime/body_loader.d.ts.map +1 -1
- package/dist/runtime/body_loader.js +12 -0
- package/dist/runtime/command_registry.d.ts +3 -21
- package/dist/runtime/command_registry.d.ts.map +1 -1
- package/dist/runtime/command_registry.js +17 -23
- package/dist/runtime/env.d.ts +0 -2
- package/dist/runtime/env.d.ts.map +1 -1
- package/dist/runtime/env.js +0 -2
- package/dist/runtime/execute.d.ts +3 -3
- package/dist/runtime/execute.d.ts.map +1 -1
- package/dist/runtime/execute.js +53 -157
- package/dist/runtime/http.d.ts +1 -1
- package/dist/runtime/http.d.ts.map +1 -1
- package/dist/runtime/http.js +1 -5
- package/dist/runtime/upload.js +3 -3
- package/dist/runtime/zod_registry.d.ts.map +1 -1
- package/dist/runtime/zod_registry.js +7 -24
- package/dist/tests/bootstrap.test.js +1 -12
- package/dist/tests/command_registry.test.js +81 -28
- package/dist/tests/execute_validation.test.js +175 -510
- package/dist/tests/help.test.js +39 -63
- package/dist/tests/upload.test.js +4 -5
- package/dist/tests/zod_registry.test.js +0 -10
- package/package.json +1 -1
- package/sdk-dist/docs/runtime-reference/README.md +20 -36
- package/sdk-dist/docs/runtime-reference/entity-schema/README.md +4 -5
- package/sdk-dist/docs/runtime-reference/entity-schema/linkto.md +3 -3
- package/sdk-dist/docs/runtime-reference/entity-schema/query.md +3 -3
- package/sdk-dist/docs/runtime-reference/entity-schema/relation.md +3 -3
- package/sdk-dist/docs/runtime-reference/entity-schema/relationfield.md +3 -3
- package/sdk-dist/docs/runtime-reference/entity-schema/subform.md +2 -2
- package/sdk-dist/docs/runtime-reference/entity-schema.md +4 -4
- package/sdk-dist/docs/runtime-reference/examples/README.md +2 -2
- package/sdk-dist/docs/runtime-reference/examples/oms-01/README.md +12 -12
- package/sdk-dist/docs/runtime-reference/examples/oms-01/app-overview.md +1 -1
- package/sdk-dist/docs/runtime-reference/row-crud.md +11 -32
- package/sdk-dist/docs/runtime-reference/search-and-bulk-actions.md +16 -47
- package/sdk-dist/docs/runtime-reference/table-lifecycle.md +11 -27
- package/sdk-dist/docs/runtime-reference/uploads.md +1 -1
- package/sdk-dist/docs/runtime-reference/workflow/README.md +19 -0
- package/sdk-dist/generated/command_registry.generated.ts +814 -4102
- package/sdk-dist/generated/type_index.generated.ts +8 -403
- package/sdk-dist/generated/zod_registry.generated.ts +44 -500
- package/sdk-dist/types/app.ts +3 -10
- package/sdk-dist/types/common.ts +7 -0
- package/sdk-dist/types/global-action.ts +2 -1
- package/src/generated/command_registry.generated.ts +814 -4102
- package/src/generated/type_index.generated.ts +8 -403
- package/src/generated/zod_registry.generated.ts +44 -500
- package/src/runtime/body_loader.ts +11 -0
- package/src/runtime/command_registry.ts +22 -44
- package/src/runtime/env.ts +0 -4
- package/src/runtime/execute.ts +58 -168
- package/src/runtime/http.ts +2 -6
- package/src/runtime/upload.ts +3 -3
- package/src/runtime/zod_registry.ts +7 -25
- package/src/tests/bootstrap.test.ts +1 -12
- package/src/tests/command_registry.test.ts +81 -31
- package/src/tests/execute_validation.test.ts +199 -640
- package/src/tests/help.test.ts +36 -70
- package/src/tests/upload.test.ts +4 -5
- package/src/tests/zod_registry.test.ts +0 -13
- package/sdk-dist/docs/runtime-reference/app-discovery.md +0 -84
|
@@ -42,18 +42,12 @@ const examplesIndexDocHint = {
|
|
|
42
42
|
title: 'Examples index',
|
|
43
43
|
file: '/opt/arcubase-sdk/docs/runtime-reference/examples/README.md',
|
|
44
44
|
};
|
|
45
|
-
const appDiscoveryDocHint = {
|
|
46
|
-
title: 'App discovery',
|
|
47
|
-
file: '/opt/arcubase-sdk/docs/runtime-reference/app-discovery.md',
|
|
48
|
-
};
|
|
49
45
|
const docHintIndex = {
|
|
50
46
|
AppCreateByTenantsReqVO: [
|
|
51
|
-
appDiscoveryDocHint,
|
|
52
47
|
{ title: 'Table lifecycle', file: '/opt/arcubase-sdk/docs/runtime-reference/table-lifecycle.md' },
|
|
53
48
|
examplesIndexDocHint,
|
|
54
49
|
],
|
|
55
50
|
AppCreateEntityReqVO: [
|
|
56
|
-
appDiscoveryDocHint,
|
|
57
51
|
{ title: 'Table lifecycle', file: '/opt/arcubase-sdk/docs/runtime-reference/table-lifecycle.md' },
|
|
58
52
|
examplesIndexDocHint,
|
|
59
53
|
],
|
|
@@ -131,25 +125,14 @@ export function getDocHints(typeName) {
|
|
|
131
125
|
}
|
|
132
126
|
const commandDocHintIndex = {
|
|
133
127
|
'admin.app.createAppByTenants': [
|
|
134
|
-
appDiscoveryDocHint,
|
|
135
128
|
{ title: 'Table lifecycle', file: '/opt/arcubase-sdk/docs/runtime-reference/table-lifecycle.md' },
|
|
136
129
|
examplesIndexDocHint,
|
|
137
130
|
],
|
|
138
|
-
'admin.app.listApps': [
|
|
139
|
-
appDiscoveryDocHint,
|
|
140
|
-
examplesIndexDocHint,
|
|
141
|
-
],
|
|
142
|
-
'admin.app.inventory': [
|
|
143
|
-
appDiscoveryDocHint,
|
|
144
|
-
examplesIndexDocHint,
|
|
145
|
-
],
|
|
146
131
|
'admin.app.createEntity': [
|
|
147
|
-
appDiscoveryDocHint,
|
|
148
132
|
{ title: 'Table lifecycle', file: '/opt/arcubase-sdk/docs/runtime-reference/table-lifecycle.md' },
|
|
149
133
|
examplesIndexDocHint,
|
|
150
134
|
],
|
|
151
135
|
'admin.entity.adminGetEntityInfo': [
|
|
152
|
-
appDiscoveryDocHint,
|
|
153
136
|
{ title: 'Table lifecycle', file: '/opt/arcubase-sdk/docs/runtime-reference/table-lifecycle.md' },
|
|
154
137
|
examplesIndexDocHint,
|
|
155
138
|
],
|
|
@@ -159,34 +142,34 @@ const commandDocHintIndex = {
|
|
|
159
142
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
160
143
|
examplesIndexDocHint,
|
|
161
144
|
],
|
|
162
|
-
'user.
|
|
145
|
+
'user.workflow.insertEntity': [
|
|
163
146
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
164
147
|
{ title: 'Uploads', file: '/opt/arcubase-sdk/docs/runtime-reference/uploads.md' },
|
|
165
148
|
examplesIndexDocHint,
|
|
166
149
|
],
|
|
167
|
-
'user.
|
|
150
|
+
'user.workflow.queryEntity': [
|
|
168
151
|
{ title: 'Search and bulk actions', file: '/opt/arcubase-sdk/docs/runtime-reference/search-and-bulk-actions.md' },
|
|
169
152
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
170
153
|
examplesIndexDocHint,
|
|
171
154
|
],
|
|
172
|
-
'user.
|
|
155
|
+
'user.workflow.getEntityRow': [
|
|
173
156
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
174
157
|
examplesIndexDocHint,
|
|
175
158
|
],
|
|
176
|
-
'user.
|
|
159
|
+
'user.workflow.updateEntityRow': [
|
|
177
160
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
178
161
|
{ title: 'Uploads', file: '/opt/arcubase-sdk/docs/runtime-reference/uploads.md' },
|
|
179
162
|
examplesIndexDocHint,
|
|
180
163
|
],
|
|
181
|
-
'user.
|
|
164
|
+
'user.workflow.queryEntitySelection': [
|
|
182
165
|
{ title: 'Search and bulk actions', file: '/opt/arcubase-sdk/docs/runtime-reference/search-and-bulk-actions.md' },
|
|
183
166
|
examplesIndexDocHint,
|
|
184
167
|
],
|
|
185
|
-
'user.
|
|
168
|
+
'user.workflow.deleteEntityRow': [
|
|
186
169
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
187
170
|
examplesIndexDocHint,
|
|
188
171
|
],
|
|
189
|
-
'user.
|
|
172
|
+
'user.workflow.restoreEntityRow': [
|
|
190
173
|
{ title: 'Row CRUD', file: '/opt/arcubase-sdk/docs/runtime-reference/row-crud.md' },
|
|
191
174
|
examplesIndexDocHint,
|
|
192
175
|
],
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import { loadRuntimeEnv } from '../runtime/env.js';
|
|
4
|
-
test('loadRuntimeEnv requires base url
|
|
4
|
+
test('loadRuntimeEnv requires base url and access token', () => {
|
|
5
5
|
assert.throws(() => loadRuntimeEnv('admin', {}), /ARCUBASE_BASE_URL is required/);
|
|
6
6
|
});
|
|
7
7
|
test('loadRuntimeEnv returns normalized runtime env', () => {
|
|
8
8
|
const env = loadRuntimeEnv('admin', {
|
|
9
9
|
ARCUBASE_BASE_URL: ' http://example.com ',
|
|
10
|
-
ARCUBASE_TENANT_ID: ' tenant-1 ',
|
|
11
10
|
ARCUBASE_ACCESS_TOKEN: ' token-1 ',
|
|
12
11
|
ARCUBASE_TRACE_ID: ' trace-1 '
|
|
13
12
|
});
|
|
14
13
|
assert.deepEqual(env, {
|
|
15
14
|
ARCUBASE_BASE_URL: 'http://example.com',
|
|
16
|
-
ARCUBASE_TENANT_ID: 'tenant-1',
|
|
17
15
|
ARCUBASE_ACCESS_TOKEN: 'token-1',
|
|
18
|
-
ARCUBASE_HOST: undefined,
|
|
19
16
|
ARCUBASE_TRACE_ID: 'trace-1',
|
|
20
17
|
ARCUBASE_SUBJECT_TYPE: undefined,
|
|
21
18
|
ARCUBASE_SUBJECT_ID: undefined,
|
|
@@ -25,17 +22,13 @@ test('loadRuntimeEnv returns normalized runtime env', () => {
|
|
|
25
22
|
test('loadRuntimeEnv accepts admin-prefixed runtime env', () => {
|
|
26
23
|
const env = loadRuntimeEnv('admin', {
|
|
27
24
|
ARCUBASE_ADMIN_BASE_URL: ' https://admin.example.com ',
|
|
28
|
-
ARCUBASE_ADMIN_TENANT_ID: ' tenant-admin ',
|
|
29
25
|
ARCUBASE_ADMIN_ACCESS_TOKEN: ' token-admin ',
|
|
30
|
-
ARCUBASE_ADMIN_HOST: ' tenant-admin.arcubase.co ',
|
|
31
26
|
ARCUBASE_ADMIN_SUBJECT_TYPE: ' system_admin ',
|
|
32
27
|
ARCUBASE_ADMIN_SUBJECT_ID: ' user-admin ',
|
|
33
28
|
});
|
|
34
29
|
assert.deepEqual(env, {
|
|
35
30
|
ARCUBASE_BASE_URL: 'https://admin.example.com',
|
|
36
|
-
ARCUBASE_TENANT_ID: 'tenant-admin',
|
|
37
31
|
ARCUBASE_ACCESS_TOKEN: 'token-admin',
|
|
38
|
-
ARCUBASE_HOST: 'tenant-admin.arcubase.co',
|
|
39
32
|
ARCUBASE_TRACE_ID: undefined,
|
|
40
33
|
ARCUBASE_SUBJECT_TYPE: 'system_admin',
|
|
41
34
|
ARCUBASE_SUBJECT_ID: 'user-admin',
|
|
@@ -45,17 +38,13 @@ test('loadRuntimeEnv accepts admin-prefixed runtime env', () => {
|
|
|
45
38
|
test('loadRuntimeEnv accepts user-prefixed runtime env', () => {
|
|
46
39
|
const env = loadRuntimeEnv('user', {
|
|
47
40
|
ARCUBASE_USER_BASE_URL: ' https://user.example.com ',
|
|
48
|
-
ARCUBASE_USER_TENANT_ID: ' tenant-user ',
|
|
49
41
|
ARCUBASE_USER_ACCESS_TOKEN: ' token-user ',
|
|
50
|
-
ARCUBASE_USER_HOST: ' tenant-user.arcubase.co ',
|
|
51
42
|
ARCUBASE_USER_SUBJECT_TYPE: ' service_account ',
|
|
52
43
|
ARCUBASE_USER_SUBJECT_ID: ' sa-user ',
|
|
53
44
|
});
|
|
54
45
|
assert.deepEqual(env, {
|
|
55
46
|
ARCUBASE_BASE_URL: 'https://user.example.com',
|
|
56
|
-
ARCUBASE_TENANT_ID: 'tenant-user',
|
|
57
47
|
ARCUBASE_ACCESS_TOKEN: 'token-user',
|
|
58
|
-
ARCUBASE_HOST: 'tenant-user.arcubase.co',
|
|
59
48
|
ARCUBASE_TRACE_ID: undefined,
|
|
60
49
|
ARCUBASE_SUBJECT_TYPE: 'service_account',
|
|
61
50
|
ARCUBASE_SUBJECT_ID: 'sa-user',
|
|
@@ -1,34 +1,87 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import { adminCommands, userCommands } from '../generated/command_registry.generated.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
function commandPaths(commands) {
|
|
5
|
+
return commands.map((item) => item.commandPath.join(' ')).sort();
|
|
6
|
+
}
|
|
7
|
+
test('admin surface is restricted to reset white list', () => {
|
|
8
|
+
const actual = commandPaths(adminCommands);
|
|
9
|
+
const expected = [
|
|
10
|
+
'app create',
|
|
11
|
+
'app delete',
|
|
12
|
+
'app get',
|
|
13
|
+
'app list',
|
|
14
|
+
'app update',
|
|
15
|
+
'table create',
|
|
16
|
+
'table delete',
|
|
17
|
+
'table get',
|
|
18
|
+
'table list',
|
|
19
|
+
'table rename',
|
|
20
|
+
'table update-schema',
|
|
21
|
+
'access-rule assign-users',
|
|
22
|
+
'access-rule create',
|
|
23
|
+
'access-rule delete',
|
|
24
|
+
'access-rule get',
|
|
25
|
+
'access-rule list',
|
|
26
|
+
'access-rule update',
|
|
27
|
+
'workflow create-version',
|
|
28
|
+
'workflow deploy',
|
|
29
|
+
'workflow get',
|
|
30
|
+
'workflow update',
|
|
31
|
+
].sort();
|
|
32
|
+
assert.deepEqual(actual, expected);
|
|
7
33
|
});
|
|
8
|
-
test('
|
|
9
|
-
|
|
34
|
+
test('user surface is restricted to reset white list', () => {
|
|
35
|
+
const actual = commandPaths(userCommands);
|
|
36
|
+
const expected = [
|
|
37
|
+
'entry',
|
|
38
|
+
'profile get',
|
|
39
|
+
'profile update',
|
|
40
|
+
'row bulk-update',
|
|
41
|
+
'row create',
|
|
42
|
+
'row delete',
|
|
43
|
+
'row get',
|
|
44
|
+
'row query',
|
|
45
|
+
'row selection-action',
|
|
46
|
+
'row update',
|
|
47
|
+
'table dataset',
|
|
48
|
+
'table get',
|
|
49
|
+
'table relation-options',
|
|
50
|
+
'upload check-mobile',
|
|
51
|
+
'upload mobile',
|
|
52
|
+
'upload preview',
|
|
53
|
+
'upload token',
|
|
54
|
+
'workflow approve',
|
|
55
|
+
'workflow countersign',
|
|
56
|
+
'workflow forward',
|
|
57
|
+
'workflow process-map',
|
|
58
|
+
'workflow query-approve-users',
|
|
59
|
+
'workflow query-nodes',
|
|
60
|
+
'workflow resolve',
|
|
61
|
+
'workflow retract',
|
|
62
|
+
'workflow rollback',
|
|
63
|
+
].sort();
|
|
64
|
+
assert.deepEqual(actual, expected);
|
|
10
65
|
});
|
|
11
|
-
test('
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const suggestions = findCommandSuggestions('entity', 'admin-delete-entity-row');
|
|
33
|
-
assert.ok(suggestions.some((item) => item.binary === 'arcubase' && item.moduleName === 'rows' && item.commandName === 'delete-entity-row'));
|
|
66
|
+
test('black list commands are removed from registry', () => {
|
|
67
|
+
const all = new Set([...commandPaths(adminCommands), ...commandPaths(userCommands)]);
|
|
68
|
+
const forbidden = [
|
|
69
|
+
'app inventory',
|
|
70
|
+
'app list-apps',
|
|
71
|
+
'app create-entity',
|
|
72
|
+
'entity admin-get-entity-info',
|
|
73
|
+
'entity admin-save-entity',
|
|
74
|
+
'ingress create-entity-ingress',
|
|
75
|
+
'workflow query-entity',
|
|
76
|
+
'workflow insert-entity',
|
|
77
|
+
'workflow update-entity-row',
|
|
78
|
+
'workflow delete-entity-row',
|
|
79
|
+
'workflow restore-entity-row',
|
|
80
|
+
'workflow query-entity-selection',
|
|
81
|
+
'profile change-password',
|
|
82
|
+
'profile auth-channels',
|
|
83
|
+
];
|
|
84
|
+
for (const item of forbidden) {
|
|
85
|
+
assert.equal(all.has(item), false, `${item} should not exist`);
|
|
86
|
+
}
|
|
34
87
|
});
|