@carthooks/arcubase-cli 0.1.19 → 0.1.21

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.
Files changed (44) hide show
  1. package/bundle/arcubase-admin.mjs +727 -45
  2. package/bundle/arcubase.mjs +727 -45
  3. package/dist/generated/command_registry.generated.d.ts +15 -0
  4. package/dist/generated/command_registry.generated.d.ts.map +1 -1
  5. package/dist/generated/command_registry.generated.js +21 -0
  6. package/dist/generated/help_examples.generated.d.ts +319 -0
  7. package/dist/generated/help_examples.generated.d.ts.map +1 -0
  8. package/dist/generated/help_examples.generated.js +437 -0
  9. package/dist/generated/type_index.generated.d.ts +4 -0
  10. package/dist/generated/type_index.generated.d.ts.map +1 -1
  11. package/dist/generated/type_index.generated.js +4 -0
  12. package/dist/generated/zod_registry.generated.d.ts +4 -1
  13. package/dist/generated/zod_registry.generated.d.ts.map +1 -1
  14. package/dist/generated/zod_registry.generated.js +4 -0
  15. package/dist/runtime/execute.d.ts.map +1 -1
  16. package/dist/runtime/execute.js +155 -17
  17. package/dist/runtime/help_examples.d.ts +10 -0
  18. package/dist/runtime/help_examples.d.ts.map +1 -0
  19. package/dist/runtime/help_examples.js +48 -0
  20. package/dist/runtime/zod_registry.d.ts.map +1 -1
  21. package/dist/runtime/zod_registry.js +8 -0
  22. package/package.json +4 -3
  23. package/sdk-dist/api/admin/ingress.ts +11 -0
  24. package/sdk-dist/docs/runtime-reference/access-rule.md +19 -0
  25. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/assign-users.json +23 -0
  26. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/bulk-apply.json +105 -0
  27. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/create.json +95 -0
  28. package/sdk-dist/docs/runtime-reference/help-examples/user/row/bulk-update.json +23 -0
  29. package/sdk-dist/docs/runtime-reference/help-examples/user/row/selection-action.json +25 -0
  30. package/sdk-dist/generated/command_registry.generated.ts +21 -0
  31. package/sdk-dist/generated/help_examples.generated.ts +444 -0
  32. package/sdk-dist/generated/type_index.generated.ts +4 -0
  33. package/sdk-dist/generated/zod_registry.generated.ts +6 -0
  34. package/sdk-dist/types/ingress.ts +31 -0
  35. package/src/generated/command_registry.generated.ts +21 -0
  36. package/src/generated/help_examples.generated.ts +444 -0
  37. package/src/generated/type_index.generated.ts +4 -0
  38. package/src/generated/zod_registry.generated.ts +6 -0
  39. package/src/runtime/execute.ts +223 -37
  40. package/src/runtime/help_examples.ts +61 -0
  41. package/src/runtime/zod_registry.ts +8 -0
  42. package/src/tests/command_registry.test.ts +1 -0
  43. package/src/tests/execute_validation.test.ts +113 -0
  44. package/src/tests/help.test.ts +45 -0
@@ -0,0 +1,23 @@
1
+ {
2
+ "scope": "user",
3
+ "command": ["row", "bulk-update"],
4
+ "examples": [
5
+ {
6
+ "title": "bulk update explicit row ids",
7
+ "body": {
8
+ "selection": {"type": "ids", "ids": [2188890411, 2188890412], "length": 2},
9
+ "fields": [{"id": 1003, "action": {"type": "set", "value": 2}}]
10
+ }
11
+ },
12
+ {
13
+ "title": "bulk update rows selected by a search condition",
14
+ "body": {
15
+ "selection": {"type": "condition", "condition": {"selectAll": true, "q": "SO-1001"}, "length": 0},
16
+ "fields": [{"id": 1003, "action": {"type": "set", "value": 2}}]
17
+ },
18
+ "notes": [
19
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
20
+ ]
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "scope": "user",
3
+ "command": ["row", "selection-action"],
4
+ "examples": [
5
+ {
6
+ "title": "run a custom action against explicit row ids",
7
+ "body": {
8
+ "selection": {"type": "ids", "ids": [2188890411], "length": 1}
9
+ },
10
+ "notes": [
11
+ "pass the backend action code with --action",
12
+ "for query action, use ids or all selection instead of condition selection"
13
+ ]
14
+ },
15
+ {
16
+ "title": "run a custom action against a filtered selection",
17
+ "body": {
18
+ "selection": {"type": "condition", "condition": {"selectAll": true, "q": "SO-1001"}, "length": 0}
19
+ },
20
+ "notes": [
21
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -475,6 +475,27 @@ export const adminCommands = [
475
475
  "queryParams": [],
476
476
  "responseType": "AppIngressUpdateRespVO"
477
477
  },
478
+ {
479
+ "scope": "admin",
480
+ "module": "access-rule",
481
+ "functionName": "bulkApplyEntityIngress",
482
+ "commandPath": [
483
+ "access-rule",
484
+ "bulk-apply"
485
+ ],
486
+ "method": "POST",
487
+ "endpoint": "/api/apps/:app_id/access-rules/bulk-apply",
488
+ "pathParams": [
489
+ {
490
+ "param": "app_id",
491
+ "flag": "app-id"
492
+ }
493
+ ],
494
+ "controller": "App.IngressBulkApply",
495
+ "requestType": "AppIngressBulkApplyReqVO",
496
+ "queryParams": [],
497
+ "responseType": "AppIngressBulkApplyRespVO"
498
+ },
478
499
  {
479
500
  "scope": "admin",
480
501
  "module": "workflow",
@@ -0,0 +1,444 @@
1
+ // Generated by scripts/generate-help-examples.mjs. Do not edit by hand.
2
+
3
+ export type GeneratedHelpExample = {
4
+ title: string
5
+ body?: unknown
6
+ notes?: readonly string[]
7
+ }
8
+
9
+ export const helpExamplesIndex = {
10
+ "admin.access-rule.assign-users": {
11
+ "command": [
12
+ "access-rule",
13
+ "assign-users"
14
+ ],
15
+ "examples": [
16
+ {
17
+ "title": "replace user_scope with user, department, and actor scopes",
18
+ "body": {
19
+ "update": [
20
+ "user_scope"
21
+ ],
22
+ "options": {
23
+ "user_scope": [
24
+ {
25
+ "type": "user",
26
+ "id": 2188889901
27
+ },
28
+ {
29
+ "type": "department",
30
+ "id": 2188881201
31
+ },
32
+ {
33
+ "type": "actor",
34
+ "id": 2188883301
35
+ }
36
+ ]
37
+ }
38
+ },
39
+ "notes": [
40
+ "id must be numeric arcubaseUserId, department ID, or actor ID",
41
+ "assign-users updates user_scope only and preserves the existing policy"
42
+ ]
43
+ }
44
+ ]
45
+ },
46
+ "admin.access-rule.bulk-apply": {
47
+ "command": [
48
+ "access-rule",
49
+ "bulk-apply"
50
+ ],
51
+ "examples": [
52
+ {
53
+ "title": "upsert permission matrix by rule name in one transaction",
54
+ "body": {
55
+ "mode": "upsert_by_name",
56
+ "items": [
57
+ {
58
+ "table_id": 2188893443,
59
+ "name": "Customer archive - sales owns rows",
60
+ "enabled": true,
61
+ "type": "form",
62
+ "options": {
63
+ "user_scope": [
64
+ {
65
+ "type": "department",
66
+ "id": 2188881201
67
+ }
68
+ ],
69
+ "policy": {
70
+ "key": "custom",
71
+ "actions": [
72
+ "view",
73
+ "add",
74
+ "edit"
75
+ ],
76
+ "all_fields_read": true,
77
+ "all_fields_write": true,
78
+ "condition": {
79
+ "mode": "and",
80
+ "conditions": [
81
+ {
82
+ "column": "creator",
83
+ "operator": "$eq",
84
+ "value": "[[current_user]]",
85
+ "value_from": 0,
86
+ "value_relation": ""
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ "list_options": {}
92
+ }
93
+ },
94
+ {
95
+ "table_id": 2188893444,
96
+ "name": "Lead review - manager queue",
97
+ "enabled": true,
98
+ "type": "form",
99
+ "options": {
100
+ "user_scope": [
101
+ {
102
+ "type": "actor",
103
+ "id": 2188883301
104
+ }
105
+ ],
106
+ "policy": {
107
+ "key": "custom",
108
+ "actions": [
109
+ "view",
110
+ "edit"
111
+ ],
112
+ "all_fields_read": true,
113
+ "all_fields_write": true,
114
+ "condition": {
115
+ "mode": "and",
116
+ "conditions": [
117
+ {
118
+ "column": ":1004",
119
+ "operator": "$eq",
120
+ "value": "pending",
121
+ "value_from": 0,
122
+ "value_relation": ""
123
+ },
124
+ {
125
+ "column": "",
126
+ "operator": "",
127
+ "value": null,
128
+ "value_from": 0,
129
+ "value_relation": "",
130
+ "subset": {
131
+ "mode": "or",
132
+ "conditions": [
133
+ {
134
+ "column": "creator",
135
+ "operator": "$eq",
136
+ "value": "[[current_user]]",
137
+ "value_from": 0,
138
+ "value_relation": ""
139
+ },
140
+ {
141
+ "column": ":1005",
142
+ "operator": "$eq",
143
+ "value": "high",
144
+ "value_from": 0,
145
+ "value_relation": ""
146
+ }
147
+ ]
148
+ }
149
+ }
150
+ ]
151
+ }
152
+ },
153
+ "list_options": {}
154
+ }
155
+ }
156
+ ]
157
+ },
158
+ "notes": [
159
+ "mode upsert_by_name is for idempotent setup; rule names must be unique within each table",
160
+ "department, actor, and specific user scopes all use options.user_scope",
161
+ "row-owner isolation uses [[current_user]] in policy.condition"
162
+ ]
163
+ },
164
+ {
165
+ "title": "preview updates for existing rule ids",
166
+ "body": {
167
+ "mode": "update_existing",
168
+ "dry_run": true,
169
+ "items": [
170
+ {
171
+ "table_id": 2188893443,
172
+ "rule_id": 2188893557,
173
+ "enabled": true,
174
+ "options": {
175
+ "user_scope": [
176
+ {
177
+ "type": "user",
178
+ "id": 2188889901
179
+ }
180
+ ],
181
+ "policy": {
182
+ "key": "custom",
183
+ "actions": [
184
+ "view"
185
+ ],
186
+ "all_fields_read": true,
187
+ "all_fields_write": false
188
+ },
189
+ "list_options": {}
190
+ }
191
+ }
192
+ ]
193
+ },
194
+ "notes": [
195
+ "dry_run true returns the planned operations without writing",
196
+ "update_existing requires rule_id on every item"
197
+ ]
198
+ }
199
+ ]
200
+ },
201
+ "admin.access-rule.create": {
202
+ "command": [
203
+ "access-rule",
204
+ "create"
205
+ ],
206
+ "examples": [
207
+ {
208
+ "title": "full access for a specific arcubaseUserId",
209
+ "body": {
210
+ "name": "Admin full access",
211
+ "enabled": true,
212
+ "type": "form",
213
+ "options": {
214
+ "user_scope": [
215
+ {
216
+ "type": "user",
217
+ "id": 2188889977
218
+ }
219
+ ],
220
+ "policy": {
221
+ "key": "custom",
222
+ "actions": [
223
+ "view",
224
+ "add",
225
+ "edit",
226
+ "delete"
227
+ ],
228
+ "all_fields_read": true,
229
+ "all_fields_write": true
230
+ },
231
+ "list_options": {}
232
+ }
233
+ }
234
+ },
235
+ {
236
+ "title": "department can view/add/edit only rows created by themselves",
237
+ "body": {
238
+ "name": "Sales own rows",
239
+ "enabled": true,
240
+ "type": "form",
241
+ "options": {
242
+ "user_scope": [
243
+ {
244
+ "type": "department",
245
+ "id": 2188881201
246
+ }
247
+ ],
248
+ "policy": {
249
+ "key": "custom",
250
+ "actions": [
251
+ "view",
252
+ "add",
253
+ "edit"
254
+ ],
255
+ "all_fields_read": true,
256
+ "all_fields_write": true,
257
+ "condition": {
258
+ "mode": "and",
259
+ "conditions": [
260
+ {
261
+ "column": "creator",
262
+ "operator": "$eq",
263
+ "value": "[[current_user]]",
264
+ "value_from": 0,
265
+ "value_relation": ""
266
+ }
267
+ ]
268
+ }
269
+ },
270
+ "list_options": {}
271
+ }
272
+ },
273
+ "notes": [
274
+ "department scope includes child departments",
275
+ "row-owner isolation uses [[current_user]] on creator"
276
+ ]
277
+ },
278
+ {
279
+ "title": "role actor can view rows matching a complex AND/OR condition",
280
+ "body": {
281
+ "name": "Sales manager review queue",
282
+ "enabled": true,
283
+ "type": "form",
284
+ "options": {
285
+ "user_scope": [
286
+ {
287
+ "type": "actor",
288
+ "id": 2188883301
289
+ }
290
+ ],
291
+ "policy": {
292
+ "key": "custom",
293
+ "actions": [
294
+ "view",
295
+ "edit"
296
+ ],
297
+ "all_fields_read": true,
298
+ "all_fields_write": true,
299
+ "condition": {
300
+ "mode": "and",
301
+ "conditions": [
302
+ {
303
+ "column": ":1004",
304
+ "operator": "$eq",
305
+ "value": "pending",
306
+ "value_from": 0,
307
+ "value_relation": ""
308
+ },
309
+ {
310
+ "column": "",
311
+ "operator": "",
312
+ "value": null,
313
+ "value_from": 0,
314
+ "value_relation": "",
315
+ "subset": {
316
+ "mode": "or",
317
+ "conditions": [
318
+ {
319
+ "column": "creator",
320
+ "operator": "$eq",
321
+ "value": "[[current_user]]",
322
+ "value_from": 0,
323
+ "value_relation": ""
324
+ },
325
+ {
326
+ "column": ":1005",
327
+ "operator": "$eq",
328
+ "value": "high",
329
+ "value_from": 0,
330
+ "value_relation": ""
331
+ }
332
+ ]
333
+ }
334
+ }
335
+ ]
336
+ }
337
+ },
338
+ "list_options": {}
339
+ }
340
+ },
341
+ "notes": [
342
+ "actor means Arcubase role id",
343
+ "condition mode \"and\" and \"or\" are canonical; legacy \"all\" also reads as AND",
344
+ "nested OR uses subset and leaves the wrapper column/operator empty"
345
+ ]
346
+ }
347
+ ]
348
+ },
349
+ "user.row.bulk-update": {
350
+ "command": [
351
+ "row",
352
+ "bulk-update"
353
+ ],
354
+ "examples": [
355
+ {
356
+ "title": "bulk update explicit row ids",
357
+ "body": {
358
+ "selection": {
359
+ "type": "ids",
360
+ "ids": [
361
+ 2188890411,
362
+ 2188890412
363
+ ],
364
+ "length": 2
365
+ },
366
+ "fields": [
367
+ {
368
+ "id": 1003,
369
+ "action": {
370
+ "type": "set",
371
+ "value": 2
372
+ }
373
+ }
374
+ ]
375
+ }
376
+ },
377
+ {
378
+ "title": "bulk update rows selected by a search condition",
379
+ "body": {
380
+ "selection": {
381
+ "type": "condition",
382
+ "condition": {
383
+ "selectAll": true,
384
+ "q": "SO-1001"
385
+ },
386
+ "length": 0
387
+ },
388
+ "fields": [
389
+ {
390
+ "id": 1003,
391
+ "action": {
392
+ "type": "set",
393
+ "value": 2
394
+ }
395
+ }
396
+ ]
397
+ },
398
+ "notes": [
399
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
400
+ ]
401
+ }
402
+ ]
403
+ },
404
+ "user.row.selection-action": {
405
+ "command": [
406
+ "row",
407
+ "selection-action"
408
+ ],
409
+ "examples": [
410
+ {
411
+ "title": "run a custom action against explicit row ids",
412
+ "body": {
413
+ "selection": {
414
+ "type": "ids",
415
+ "ids": [
416
+ 2188890411
417
+ ],
418
+ "length": 1
419
+ }
420
+ },
421
+ "notes": [
422
+ "pass the backend action code with --action",
423
+ "for query action, use ids or all selection instead of condition selection"
424
+ ]
425
+ },
426
+ {
427
+ "title": "run a custom action against a filtered selection",
428
+ "body": {
429
+ "selection": {
430
+ "type": "condition",
431
+ "condition": {
432
+ "selectAll": true,
433
+ "q": "SO-1001"
434
+ },
435
+ "length": 0
436
+ }
437
+ },
438
+ "notes": [
439
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
440
+ ]
441
+ }
442
+ ]
443
+ }
444
+ } as const satisfies Record<string, { command: readonly string[]; examples: readonly GeneratedHelpExample[] }>
@@ -9,6 +9,10 @@ export const typeIndex = {
9
9
  "file": "types/app.ts",
10
10
  "dependencies": []
11
11
  },
12
+ "AppIngressBulkApplyReqVO": {
13
+ "file": "types/ingress.ts",
14
+ "dependencies": []
15
+ },
12
16
  "AppIngressCreateReqVO": {
13
17
  "file": "types/ingress.ts",
14
18
  "dependencies": []
@@ -34,6 +34,10 @@ export const PermitUserScopeSchema: z.ZodTypeAny = z.lazy(() => z.object({ "data
34
34
 
35
35
  export const EntityIngressOptionsSchema: z.ZodTypeAny = z.lazy(() => z.object({ "i18n_name": I18NTextSchema.optional(), "list_options": PermitEntityListOptionsSchema.optional(), "policy": PermitPolicySchema.optional(), "user_scope": z.array(PermitUserScopeSchema).optional() }).strict())
36
36
 
37
+ export const AppIngressBulkApplyItemVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "enabled": z.boolean().optional(), "name": z.string().optional(), "options": EntityIngressOptionsSchema.optional(), "rule_id": z.number().optional(), "table_id": z.number().optional(), "type": z.string().optional() }).strict())
38
+
39
+ export const AppIngressBulkApplyReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "dry_run": z.boolean().optional(), "items": z.array(AppIngressBulkApplyItemVOSchema).optional(), "mode": z.string().optional() }).strict())
40
+
37
41
  export const AppIngressCreateReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "enabled": z.boolean().optional(), "entity_id": z.number().optional(), "icon_name": z.string().optional(), "name": z.string().optional(), "options": EntityIngressOptionsSchema.optional(), "type": z.string().optional(), "url": z.string().optional() }).strict())
38
42
 
39
43
  export const AppIngressUpdateReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "enabled": z.boolean().optional(), "name": z.string().optional(), "options": EntityIngressOptionsSchema.optional(), "update": z.array(z.string()).optional() }).strict())
@@ -165,6 +169,7 @@ export const UserProfileUpdateReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object(
165
169
  export const generatedRequestTypes = [
166
170
  "AppCreateByTenantsReqVO",
167
171
  "AppCreateEntityReqVO",
172
+ "AppIngressBulkApplyReqVO",
168
173
  "AppIngressCreateReqVO",
169
174
  "AppIngressUpdateReqVO",
170
175
  "AppUpdateAppReqVO",
@@ -191,6 +196,7 @@ export const generatedRequestTypes = [
191
196
  export const bodySchemas = {
192
197
  "AppCreateByTenantsReqVO": AppCreateByTenantsReqVOSchema,
193
198
  "AppCreateEntityReqVO": AppCreateEntityReqVOSchema,
199
+ "AppIngressBulkApplyReqVO": AppIngressBulkApplyReqVOSchema,
194
200
  "AppIngressCreateReqVO": AppIngressCreateReqVOSchema,
195
201
  "AppIngressUpdateReqVO": AppIngressUpdateReqVOSchema,
196
202
  "AppUpdateAppReqVO": AppUpdateAppReqVOSchema,
@@ -53,6 +53,37 @@ export interface AppIngressBlockVO {
53
53
  content?: string;
54
54
  }
55
55
 
56
+ export interface AppIngressBulkApplyItemRespVO {
57
+ enabled?: boolean;
58
+ index?: number;
59
+ name?: string;
60
+ operation?: string;
61
+ rule_id?: number;
62
+ table_id?: number;
63
+ }
64
+
65
+ export interface AppIngressBulkApplyItemVO {
66
+ enabled?: boolean;
67
+ name?: string;
68
+ options?: EntityIngressOptions;
69
+ rule_id?: number;
70
+ table_id?: number;
71
+ type?: string;
72
+ }
73
+
74
+ export interface AppIngressBulkApplyReqVO {
75
+ dry_run?: boolean;
76
+ items?: AppIngressBulkApplyItemVO[];
77
+ mode?: string;
78
+ }
79
+
80
+ export interface AppIngressBulkApplyRespVO {
81
+ app_id?: number;
82
+ applied_count?: number;
83
+ dry_run?: boolean;
84
+ items?: AppIngressBulkApplyItemRespVO[];
85
+ }
86
+
56
87
  export interface AppIngressCreateReqVO {
57
88
  enabled?: boolean;
58
89
  entity_id?: number;
@@ -475,6 +475,27 @@ export const adminCommands = [
475
475
  "queryParams": [],
476
476
  "responseType": "AppIngressUpdateRespVO"
477
477
  },
478
+ {
479
+ "scope": "admin",
480
+ "module": "access-rule",
481
+ "functionName": "bulkApplyEntityIngress",
482
+ "commandPath": [
483
+ "access-rule",
484
+ "bulk-apply"
485
+ ],
486
+ "method": "POST",
487
+ "endpoint": "/api/apps/:app_id/access-rules/bulk-apply",
488
+ "pathParams": [
489
+ {
490
+ "param": "app_id",
491
+ "flag": "app-id"
492
+ }
493
+ ],
494
+ "controller": "App.IngressBulkApply",
495
+ "requestType": "AppIngressBulkApplyReqVO",
496
+ "queryParams": [],
497
+ "responseType": "AppIngressBulkApplyRespVO"
498
+ },
478
499
  {
479
500
  "scope": "admin",
480
501
  "module": "workflow",