@carthooks/arcubase-cli 0.1.20 → 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 (36) hide show
  1. package/bundle/arcubase-admin.mjs +339 -51
  2. package/bundle/arcubase.mjs +339 -51
  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 +114 -0
  7. package/dist/generated/help_examples.generated.d.ts.map +1 -1
  8. package/dist/generated/help_examples.generated.js +155 -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 +104 -31
  17. package/dist/runtime/zod_registry.d.ts.map +1 -1
  18. package/dist/runtime/zod_registry.js +8 -0
  19. package/package.json +1 -1
  20. package/sdk-dist/api/admin/ingress.ts +11 -0
  21. package/sdk-dist/docs/runtime-reference/access-rule.md +19 -0
  22. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/bulk-apply.json +105 -0
  23. package/sdk-dist/generated/command_registry.generated.ts +21 -0
  24. package/sdk-dist/generated/help_examples.generated.ts +155 -0
  25. package/sdk-dist/generated/type_index.generated.ts +4 -0
  26. package/sdk-dist/generated/zod_registry.generated.ts +6 -0
  27. package/sdk-dist/types/ingress.ts +31 -0
  28. package/src/generated/command_registry.generated.ts +21 -0
  29. package/src/generated/help_examples.generated.ts +155 -0
  30. package/src/generated/type_index.generated.ts +4 -0
  31. package/src/generated/zod_registry.generated.ts +6 -0
  32. package/src/runtime/execute.ts +159 -51
  33. package/src/runtime/zod_registry.ts +8 -0
  34. package/src/tests/command_registry.test.ts +1 -0
  35. package/src/tests/execute_validation.test.ts +86 -0
  36. package/src/tests/help.test.ts +13 -0
@@ -0,0 +1,105 @@
1
+ {
2
+ "scope": "admin",
3
+ "command": ["access-rule", "bulk-apply"],
4
+ "examples": [
5
+ {
6
+ "title": "upsert permission matrix by rule name in one transaction",
7
+ "body": {
8
+ "mode": "upsert_by_name",
9
+ "items": [
10
+ {
11
+ "table_id": 2188893443,
12
+ "name": "Customer archive - sales owns rows",
13
+ "enabled": true,
14
+ "type": "form",
15
+ "options": {
16
+ "user_scope": [{"type": "department", "id": 2188881201}],
17
+ "policy": {
18
+ "key": "custom",
19
+ "actions": ["view", "add", "edit"],
20
+ "all_fields_read": true,
21
+ "all_fields_write": true,
22
+ "condition": {
23
+ "mode": "and",
24
+ "conditions": [
25
+ {"column": "creator", "operator": "$eq", "value": "[[current_user]]", "value_from": 0, "value_relation": ""}
26
+ ]
27
+ }
28
+ },
29
+ "list_options": {}
30
+ }
31
+ },
32
+ {
33
+ "table_id": 2188893444,
34
+ "name": "Lead review - manager queue",
35
+ "enabled": true,
36
+ "type": "form",
37
+ "options": {
38
+ "user_scope": [{"type": "actor", "id": 2188883301}],
39
+ "policy": {
40
+ "key": "custom",
41
+ "actions": ["view", "edit"],
42
+ "all_fields_read": true,
43
+ "all_fields_write": true,
44
+ "condition": {
45
+ "mode": "and",
46
+ "conditions": [
47
+ {"column": ":1004", "operator": "$eq", "value": "pending", "value_from": 0, "value_relation": ""},
48
+ {
49
+ "column": "",
50
+ "operator": "",
51
+ "value": null,
52
+ "value_from": 0,
53
+ "value_relation": "",
54
+ "subset": {
55
+ "mode": "or",
56
+ "conditions": [
57
+ {"column": "creator", "operator": "$eq", "value": "[[current_user]]", "value_from": 0, "value_relation": ""},
58
+ {"column": ":1005", "operator": "$eq", "value": "high", "value_from": 0, "value_relation": ""}
59
+ ]
60
+ }
61
+ }
62
+ ]
63
+ }
64
+ },
65
+ "list_options": {}
66
+ }
67
+ }
68
+ ]
69
+ },
70
+ "notes": [
71
+ "mode upsert_by_name is for idempotent setup; rule names must be unique within each table",
72
+ "department, actor, and specific user scopes all use options.user_scope",
73
+ "row-owner isolation uses [[current_user]] in policy.condition"
74
+ ]
75
+ },
76
+ {
77
+ "title": "preview updates for existing rule ids",
78
+ "body": {
79
+ "mode": "update_existing",
80
+ "dry_run": true,
81
+ "items": [
82
+ {
83
+ "table_id": 2188893443,
84
+ "rule_id": 2188893557,
85
+ "enabled": true,
86
+ "options": {
87
+ "user_scope": [{"type": "user", "id": 2188889901}],
88
+ "policy": {
89
+ "key": "custom",
90
+ "actions": ["view"],
91
+ "all_fields_read": true,
92
+ "all_fields_write": false
93
+ },
94
+ "list_options": {}
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ "notes": [
100
+ "dry_run true returns the planned operations without writing",
101
+ "update_existing requires rule_id on every item"
102
+ ]
103
+ }
104
+ ]
105
+ }
@@ -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",
@@ -43,6 +43,161 @@ export const helpExamplesIndex = {
43
43
  }
44
44
  ]
45
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
+ },
46
201
  "admin.access-rule.create": {
47
202
  "command": [
48
203
  "access-rule",
@@ -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",
@@ -43,6 +43,161 @@ export const helpExamplesIndex = {
43
43
  }
44
44
  ]
45
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
+ },
46
201
  "admin.access-rule.create": {
47
202
  "command": [
48
203
  "access-rule",
@@ -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,