@carthooks/arcubase-cli 0.1.18 → 0.1.20

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 (31) hide show
  1. package/bundle/arcubase-admin.mjs +423 -34
  2. package/bundle/arcubase.mjs +423 -34
  3. package/dist/generated/help_examples.generated.d.ts +205 -0
  4. package/dist/generated/help_examples.generated.d.ts.map +1 -0
  5. package/dist/generated/help_examples.generated.js +282 -0
  6. package/dist/generated/zod_registry.generated.d.ts.map +1 -1
  7. package/dist/generated/zod_registry.generated.js +1 -1
  8. package/dist/runtime/execute.d.ts.map +1 -1
  9. package/dist/runtime/execute.js +84 -17
  10. package/dist/runtime/help_examples.d.ts +10 -0
  11. package/dist/runtime/help_examples.d.ts.map +1 -0
  12. package/dist/runtime/help_examples.js +48 -0
  13. package/package.json +4 -3
  14. package/sdk-dist/docs/runtime-reference/access-rule.md +12 -10
  15. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/assign-users.json +23 -0
  16. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/create.json +95 -0
  17. package/sdk-dist/docs/runtime-reference/help-examples/user/row/bulk-update.json +23 -0
  18. package/sdk-dist/docs/runtime-reference/help-examples/user/row/selection-action.json +25 -0
  19. package/sdk-dist/generated/help_examples.generated.ts +289 -0
  20. package/sdk-dist/generated/zod_registry.generated.ts +1 -1
  21. package/sdk-dist/types/common.ts +1 -0
  22. package/sdk-dist/types/entity.ts +1 -1
  23. package/sdk-dist/types/kiosk-ui.ts +1 -1
  24. package/sdk-dist/types/tenant.ts +1 -1
  25. package/src/generated/help_examples.generated.ts +289 -0
  26. package/src/generated/zod_registry.generated.ts +1 -1
  27. package/src/runtime/execute.ts +98 -25
  28. package/src/runtime/help_examples.ts +61 -0
  29. package/src/tests/execute_validation.test.ts +88 -10
  30. package/src/tests/help.test.ts +35 -1
  31. package/src/tests/zod_registry.test.ts +38 -0
@@ -0,0 +1,289 @@
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.create": {
47
+ "command": [
48
+ "access-rule",
49
+ "create"
50
+ ],
51
+ "examples": [
52
+ {
53
+ "title": "full access for a specific arcubaseUserId",
54
+ "body": {
55
+ "name": "Admin full access",
56
+ "enabled": true,
57
+ "type": "form",
58
+ "options": {
59
+ "user_scope": [
60
+ {
61
+ "type": "user",
62
+ "id": 2188889977
63
+ }
64
+ ],
65
+ "policy": {
66
+ "key": "custom",
67
+ "actions": [
68
+ "view",
69
+ "add",
70
+ "edit",
71
+ "delete"
72
+ ],
73
+ "all_fields_read": true,
74
+ "all_fields_write": true
75
+ },
76
+ "list_options": {}
77
+ }
78
+ }
79
+ },
80
+ {
81
+ "title": "department can view/add/edit only rows created by themselves",
82
+ "body": {
83
+ "name": "Sales own rows",
84
+ "enabled": true,
85
+ "type": "form",
86
+ "options": {
87
+ "user_scope": [
88
+ {
89
+ "type": "department",
90
+ "id": 2188881201
91
+ }
92
+ ],
93
+ "policy": {
94
+ "key": "custom",
95
+ "actions": [
96
+ "view",
97
+ "add",
98
+ "edit"
99
+ ],
100
+ "all_fields_read": true,
101
+ "all_fields_write": true,
102
+ "condition": {
103
+ "mode": "and",
104
+ "conditions": [
105
+ {
106
+ "column": "creator",
107
+ "operator": "$eq",
108
+ "value": "[[current_user]]",
109
+ "value_from": 0,
110
+ "value_relation": ""
111
+ }
112
+ ]
113
+ }
114
+ },
115
+ "list_options": {}
116
+ }
117
+ },
118
+ "notes": [
119
+ "department scope includes child departments",
120
+ "row-owner isolation uses [[current_user]] on creator"
121
+ ]
122
+ },
123
+ {
124
+ "title": "role actor can view rows matching a complex AND/OR condition",
125
+ "body": {
126
+ "name": "Sales manager review queue",
127
+ "enabled": true,
128
+ "type": "form",
129
+ "options": {
130
+ "user_scope": [
131
+ {
132
+ "type": "actor",
133
+ "id": 2188883301
134
+ }
135
+ ],
136
+ "policy": {
137
+ "key": "custom",
138
+ "actions": [
139
+ "view",
140
+ "edit"
141
+ ],
142
+ "all_fields_read": true,
143
+ "all_fields_write": true,
144
+ "condition": {
145
+ "mode": "and",
146
+ "conditions": [
147
+ {
148
+ "column": ":1004",
149
+ "operator": "$eq",
150
+ "value": "pending",
151
+ "value_from": 0,
152
+ "value_relation": ""
153
+ },
154
+ {
155
+ "column": "",
156
+ "operator": "",
157
+ "value": null,
158
+ "value_from": 0,
159
+ "value_relation": "",
160
+ "subset": {
161
+ "mode": "or",
162
+ "conditions": [
163
+ {
164
+ "column": "creator",
165
+ "operator": "$eq",
166
+ "value": "[[current_user]]",
167
+ "value_from": 0,
168
+ "value_relation": ""
169
+ },
170
+ {
171
+ "column": ":1005",
172
+ "operator": "$eq",
173
+ "value": "high",
174
+ "value_from": 0,
175
+ "value_relation": ""
176
+ }
177
+ ]
178
+ }
179
+ }
180
+ ]
181
+ }
182
+ },
183
+ "list_options": {}
184
+ }
185
+ },
186
+ "notes": [
187
+ "actor means Arcubase role id",
188
+ "condition mode \"and\" and \"or\" are canonical; legacy \"all\" also reads as AND",
189
+ "nested OR uses subset and leaves the wrapper column/operator empty"
190
+ ]
191
+ }
192
+ ]
193
+ },
194
+ "user.row.bulk-update": {
195
+ "command": [
196
+ "row",
197
+ "bulk-update"
198
+ ],
199
+ "examples": [
200
+ {
201
+ "title": "bulk update explicit row ids",
202
+ "body": {
203
+ "selection": {
204
+ "type": "ids",
205
+ "ids": [
206
+ 2188890411,
207
+ 2188890412
208
+ ],
209
+ "length": 2
210
+ },
211
+ "fields": [
212
+ {
213
+ "id": 1003,
214
+ "action": {
215
+ "type": "set",
216
+ "value": 2
217
+ }
218
+ }
219
+ ]
220
+ }
221
+ },
222
+ {
223
+ "title": "bulk update rows selected by a search condition",
224
+ "body": {
225
+ "selection": {
226
+ "type": "condition",
227
+ "condition": {
228
+ "selectAll": true,
229
+ "q": "SO-1001"
230
+ },
231
+ "length": 0
232
+ },
233
+ "fields": [
234
+ {
235
+ "id": 1003,
236
+ "action": {
237
+ "type": "set",
238
+ "value": 2
239
+ }
240
+ }
241
+ ]
242
+ },
243
+ "notes": [
244
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
245
+ ]
246
+ }
247
+ ]
248
+ },
249
+ "user.row.selection-action": {
250
+ "command": [
251
+ "row",
252
+ "selection-action"
253
+ ],
254
+ "examples": [
255
+ {
256
+ "title": "run a custom action against explicit row ids",
257
+ "body": {
258
+ "selection": {
259
+ "type": "ids",
260
+ "ids": [
261
+ 2188890411
262
+ ],
263
+ "length": 1
264
+ }
265
+ },
266
+ "notes": [
267
+ "pass the backend action code with --action",
268
+ "for query action, use ids or all selection instead of condition selection"
269
+ ]
270
+ },
271
+ {
272
+ "title": "run a custom action against a filtered selection",
273
+ "body": {
274
+ "selection": {
275
+ "type": "condition",
276
+ "condition": {
277
+ "selectAll": true,
278
+ "q": "SO-1001"
279
+ },
280
+ "length": 0
281
+ }
282
+ },
283
+ "notes": [
284
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
285
+ ]
286
+ }
287
+ ]
288
+ }
289
+ } as const satisfies Record<string, { command: readonly string[]; examples: readonly GeneratedHelpExample[] }>
@@ -12,7 +12,7 @@ export const PermitColumnSchema: z.ZodTypeAny = z.lazy(() => z.object({ "field_i
12
12
 
13
13
  export const PermitSearchColumnSchema: z.ZodTypeAny = z.lazy(() => z.object({ "default": z.boolean().optional(), "default_value": z.array(z.number()).optional(), "field_id": z.number().optional(), "infilter": z.boolean().optional(), "is_field": z.boolean().optional(), "pinned": z.boolean().optional(), "prop": z.string().optional(), "wildcard": z.boolean().optional() }).strict())
14
14
 
15
- export const PermitEntityPropSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("created"), z.literal("updated"), z.literal("creator")]))
15
+ export const PermitEntityPropSchema: z.ZodTypeAny = z.lazy(() => z.string().min(1))
16
16
 
17
17
  export const PermitValueFromSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal(1), z.literal(2), z.literal(3)]))
18
18
 
@@ -291,6 +291,7 @@ export interface ActionBulkUpdateAction {
291
291
 
292
292
  export interface KioskConfig {
293
293
  interactiveMode?: string;
294
+ lookupCondition?: PermitConditionSet;
294
295
  lookupFields?: number[];
295
296
  options?: Record<string, any>;
296
297
  printers?: Record<string, any>[];
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  /** @format int32 */
14
- import type { PermitEntityEvent, NotificationPayloadMode, NotificationNotificationType, MagicStringPartType, ActionBulkUpdate, ActionBulkUpdateAction, GormDeletedAt, KioskConfig, KioskScreen, AiOptions, ApiEndpoint, ApiEndpointParam, ApiOptions, App, AppOptions, Assets, Button, CustomAction, EntityFrontEvent, EntityKioskFlow, EntityOptions, EntityPrintTemplate, Fields, MagicString, MagicStringPart, PermitUserScope, ErrorResponse } from './common'
14
+ import type { PermitValueFrom, PermitEntityProp, PermitEntityEvent, NotificationPayloadMode, NotificationNotificationType, MagicStringPartType, ActionBulkUpdate, ActionBulkUpdateAction, GormDeletedAt, KioskConfig, KioskScreen, AiOptions, ApiEndpoint, ApiEndpointParam, ApiOptions, App, AppOptions, Assets, Button, CustomAction, EntityFrontEvent, EntityKioskFlow, EntityOptions, EntityPrintTemplate, Fields, MagicString, MagicStringPart, PermitConditionSet, PermitRecordCondition, PermitUserScope, ErrorResponse } from './common'
15
15
 
16
16
  export enum FieldInitMode {
17
17
  FieldInitModeStatic = 0,
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  /** @format int32 */
14
- import type { WorkflowStateType, PermitEntityEvent, NotificationPayloadMode, NotificationNotificationType, PronounsType, MagicStringPartType, KioskConfig, KioskScreen, AiOptions, ApiEndpoint, ApiEndpointParam, ApiOptions, Button, CustomAction, DataRecord, EntityFrontEvent, EntityOptions, EntityVO, Fields, MagicString, MagicStringPart, DataRecordProcess, DataRecordResource, DataRecordTrans, PostqueryAppendData, PostqueryUserData, PostqueryAssetsData, PostqueryDepartmentData, PostqueryLinktoData, StorageUrlSets, ErrorResponse, OpenAPITenantInfo } from './common'
14
+ import type { WorkflowStateType, PermitValueFrom, PermitEntityProp, PermitEntityEvent, NotificationPayloadMode, NotificationNotificationType, PronounsType, MagicStringPartType, KioskConfig, KioskScreen, AiOptions, ApiEndpoint, ApiEndpointParam, ApiOptions, Button, CustomAction, DataRecord, EntityFrontEvent, EntityOptions, EntityVO, Fields, MagicString, MagicStringPart, DataRecordProcess, DataRecordResource, DataRecordTrans, PermitConditionSet, PermitRecordCondition, PostqueryAppendData, PostqueryUserData, PostqueryAssetsData, PostqueryDepartmentData, PostqueryLinktoData, StorageUrlSets, ErrorResponse, OpenAPITenantInfo } from './common'
15
15
 
16
16
  export interface CheckPrintDuplicateReqVO {
17
17
  /** kiosk flow id */
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  /** @format int32 */
14
- import type { MagicStringPartType, GormDeletedAt, KioskConfig, KioskScreen, ApiEndpoint, ApiEndpointParam, EntityKioskFlow, MagicString, MagicStringPart, PermitUserScope, SqlNullTime, CommonPagination, ErrorResponse } from './common'
14
+ import type { PermitValueFrom, PermitEntityProp, MagicStringPartType, GormDeletedAt, KioskConfig, KioskScreen, ApiEndpoint, ApiEndpointParam, EntityKioskFlow, MagicString, MagicStringPart, PermitConditionSet, PermitRecordCondition, PermitUserScope, SqlNullTime, CommonPagination, ErrorResponse } from './common'
15
15
 
16
16
  export enum TenantUserMetaDataPolicy {
17
17
  TenantUserMetaDataPolicyNone = 1,
@@ -0,0 +1,289 @@
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.create": {
47
+ "command": [
48
+ "access-rule",
49
+ "create"
50
+ ],
51
+ "examples": [
52
+ {
53
+ "title": "full access for a specific arcubaseUserId",
54
+ "body": {
55
+ "name": "Admin full access",
56
+ "enabled": true,
57
+ "type": "form",
58
+ "options": {
59
+ "user_scope": [
60
+ {
61
+ "type": "user",
62
+ "id": 2188889977
63
+ }
64
+ ],
65
+ "policy": {
66
+ "key": "custom",
67
+ "actions": [
68
+ "view",
69
+ "add",
70
+ "edit",
71
+ "delete"
72
+ ],
73
+ "all_fields_read": true,
74
+ "all_fields_write": true
75
+ },
76
+ "list_options": {}
77
+ }
78
+ }
79
+ },
80
+ {
81
+ "title": "department can view/add/edit only rows created by themselves",
82
+ "body": {
83
+ "name": "Sales own rows",
84
+ "enabled": true,
85
+ "type": "form",
86
+ "options": {
87
+ "user_scope": [
88
+ {
89
+ "type": "department",
90
+ "id": 2188881201
91
+ }
92
+ ],
93
+ "policy": {
94
+ "key": "custom",
95
+ "actions": [
96
+ "view",
97
+ "add",
98
+ "edit"
99
+ ],
100
+ "all_fields_read": true,
101
+ "all_fields_write": true,
102
+ "condition": {
103
+ "mode": "and",
104
+ "conditions": [
105
+ {
106
+ "column": "creator",
107
+ "operator": "$eq",
108
+ "value": "[[current_user]]",
109
+ "value_from": 0,
110
+ "value_relation": ""
111
+ }
112
+ ]
113
+ }
114
+ },
115
+ "list_options": {}
116
+ }
117
+ },
118
+ "notes": [
119
+ "department scope includes child departments",
120
+ "row-owner isolation uses [[current_user]] on creator"
121
+ ]
122
+ },
123
+ {
124
+ "title": "role actor can view rows matching a complex AND/OR condition",
125
+ "body": {
126
+ "name": "Sales manager review queue",
127
+ "enabled": true,
128
+ "type": "form",
129
+ "options": {
130
+ "user_scope": [
131
+ {
132
+ "type": "actor",
133
+ "id": 2188883301
134
+ }
135
+ ],
136
+ "policy": {
137
+ "key": "custom",
138
+ "actions": [
139
+ "view",
140
+ "edit"
141
+ ],
142
+ "all_fields_read": true,
143
+ "all_fields_write": true,
144
+ "condition": {
145
+ "mode": "and",
146
+ "conditions": [
147
+ {
148
+ "column": ":1004",
149
+ "operator": "$eq",
150
+ "value": "pending",
151
+ "value_from": 0,
152
+ "value_relation": ""
153
+ },
154
+ {
155
+ "column": "",
156
+ "operator": "",
157
+ "value": null,
158
+ "value_from": 0,
159
+ "value_relation": "",
160
+ "subset": {
161
+ "mode": "or",
162
+ "conditions": [
163
+ {
164
+ "column": "creator",
165
+ "operator": "$eq",
166
+ "value": "[[current_user]]",
167
+ "value_from": 0,
168
+ "value_relation": ""
169
+ },
170
+ {
171
+ "column": ":1005",
172
+ "operator": "$eq",
173
+ "value": "high",
174
+ "value_from": 0,
175
+ "value_relation": ""
176
+ }
177
+ ]
178
+ }
179
+ }
180
+ ]
181
+ }
182
+ },
183
+ "list_options": {}
184
+ }
185
+ },
186
+ "notes": [
187
+ "actor means Arcubase role id",
188
+ "condition mode \"and\" and \"or\" are canonical; legacy \"all\" also reads as AND",
189
+ "nested OR uses subset and leaves the wrapper column/operator empty"
190
+ ]
191
+ }
192
+ ]
193
+ },
194
+ "user.row.bulk-update": {
195
+ "command": [
196
+ "row",
197
+ "bulk-update"
198
+ ],
199
+ "examples": [
200
+ {
201
+ "title": "bulk update explicit row ids",
202
+ "body": {
203
+ "selection": {
204
+ "type": "ids",
205
+ "ids": [
206
+ 2188890411,
207
+ 2188890412
208
+ ],
209
+ "length": 2
210
+ },
211
+ "fields": [
212
+ {
213
+ "id": 1003,
214
+ "action": {
215
+ "type": "set",
216
+ "value": 2
217
+ }
218
+ }
219
+ ]
220
+ }
221
+ },
222
+ {
223
+ "title": "bulk update rows selected by a search condition",
224
+ "body": {
225
+ "selection": {
226
+ "type": "condition",
227
+ "condition": {
228
+ "selectAll": true,
229
+ "q": "SO-1001"
230
+ },
231
+ "length": 0
232
+ },
233
+ "fields": [
234
+ {
235
+ "id": 1003,
236
+ "action": {
237
+ "type": "set",
238
+ "value": 2
239
+ }
240
+ }
241
+ ]
242
+ },
243
+ "notes": [
244
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
245
+ ]
246
+ }
247
+ ]
248
+ },
249
+ "user.row.selection-action": {
250
+ "command": [
251
+ "row",
252
+ "selection-action"
253
+ ],
254
+ "examples": [
255
+ {
256
+ "title": "run a custom action against explicit row ids",
257
+ "body": {
258
+ "selection": {
259
+ "type": "ids",
260
+ "ids": [
261
+ 2188890411
262
+ ],
263
+ "length": 1
264
+ }
265
+ },
266
+ "notes": [
267
+ "pass the backend action code with --action",
268
+ "for query action, use ids or all selection instead of condition selection"
269
+ ]
270
+ },
271
+ {
272
+ "title": "run a custom action against a filtered selection",
273
+ "body": {
274
+ "selection": {
275
+ "type": "condition",
276
+ "condition": {
277
+ "selectAll": true,
278
+ "q": "SO-1001"
279
+ },
280
+ "length": 0
281
+ }
282
+ },
283
+ "notes": [
284
+ "condition selection uses row-query style keys such as q, tab, and filter_:1002"
285
+ ]
286
+ }
287
+ ]
288
+ }
289
+ } as const satisfies Record<string, { command: readonly string[]; examples: readonly GeneratedHelpExample[] }>
@@ -12,7 +12,7 @@ export const PermitColumnSchema: z.ZodTypeAny = z.lazy(() => z.object({ "field_i
12
12
 
13
13
  export const PermitSearchColumnSchema: z.ZodTypeAny = z.lazy(() => z.object({ "default": z.boolean().optional(), "default_value": z.array(z.number()).optional(), "field_id": z.number().optional(), "infilter": z.boolean().optional(), "is_field": z.boolean().optional(), "pinned": z.boolean().optional(), "prop": z.string().optional(), "wildcard": z.boolean().optional() }).strict())
14
14
 
15
- export const PermitEntityPropSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("created"), z.literal("updated"), z.literal("creator")]))
15
+ export const PermitEntityPropSchema: z.ZodTypeAny = z.lazy(() => z.string().min(1))
16
16
 
17
17
  export const PermitValueFromSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal(1), z.literal(2), z.literal(3)]))
18
18