@carthooks/arcubase-cli 0.1.4 → 0.1.5
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 +188 -210
- package/bundle/arcubase.mjs +188 -210
- package/dist/generated/command_registry.generated.d.ts +36 -112
- package/dist/generated/command_registry.generated.d.ts.map +1 -1
- package/dist/generated/command_registry.generated.js +40 -163
- package/dist/generated/type_index.generated.d.ts +0 -12
- package/dist/generated/type_index.generated.d.ts.map +1 -1
- package/dist/generated/type_index.generated.js +0 -12
- package/dist/generated/zod_registry.generated.d.ts +1 -19
- package/dist/generated/zod_registry.generated.d.ts.map +1 -1
- package/dist/generated/zod_registry.generated.js +0 -21
- package/dist/runtime/command_registry.d.ts +19 -1
- package/dist/runtime/command_registry.d.ts.map +1 -1
- package/dist/runtime/command_registry.js +19 -1
- package/dist/runtime/execute.d.ts.map +1 -1
- package/dist/runtime/execute.js +119 -9
- package/dist/runtime/zod_registry.d.ts.map +1 -1
- package/dist/runtime/zod_registry.js +24 -7
- package/dist/tests/command_registry.test.js +11 -4
- package/dist/tests/execute_validation.test.js +72 -17
- package/dist/tests/help.test.js +16 -9
- package/package.json +1 -1
- package/sdk-dist/api/admin/app.ts +8 -1
- package/sdk-dist/docs/runtime-reference/README.md +24 -16
- package/sdk-dist/docs/runtime-reference/app-discovery.md +68 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/README.md +2 -2
- package/sdk-dist/docs/runtime-reference/entity-schema/subform.md +2 -2
- package/sdk-dist/docs/runtime-reference/entity-schema.md +2 -2
- package/sdk-dist/docs/runtime-reference/examples/README.md +1 -1
- package/sdk-dist/docs/runtime-reference/examples/oms-01/README.md +4 -4
- package/sdk-dist/docs/runtime-reference/examples/oms-01/app-overview.md +1 -1
- package/sdk-dist/docs/runtime-reference/row-crud.md +6 -6
- package/sdk-dist/docs/runtime-reference/search-and-bulk-actions.md +5 -5
- package/sdk-dist/docs/runtime-reference/table-lifecycle.md +24 -8
- package/sdk-dist/docs/runtime-reference/uploads.md +1 -1
- package/sdk-dist/generated/command_registry.generated.ts +40 -163
- package/sdk-dist/generated/type_index.generated.ts +0 -12
- package/sdk-dist/generated/zod_registry.generated.ts +0 -36
- package/sdk-dist/types/app.ts +7 -0
- package/src/generated/command_registry.generated.ts +40 -163
- package/src/generated/type_index.generated.ts +0 -12
- package/src/generated/zod_registry.generated.ts +0 -36
- package/src/runtime/command_registry.ts +38 -2
- package/src/runtime/execute.ts +127 -9
- package/src/runtime/zod_registry.ts +25 -7
- package/src/tests/command_registry.test.ts +13 -4
- package/src/tests/execute_validation.test.ts +78 -17
- package/src/tests/help.test.ts +17 -9
- package/sdk-dist/docs/runtime-reference/workflow/README.md +0 -19
|
@@ -103,6 +103,22 @@ export const adminCommands = [
|
|
|
103
103
|
"scalarParams": [],
|
|
104
104
|
"responseType": "AppCreateByTenantsRespVO"
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"scope": "admin",
|
|
108
|
+
"module": "app",
|
|
109
|
+
"functionName": "listApps",
|
|
110
|
+
"commandPath": [
|
|
111
|
+
"app",
|
|
112
|
+
"list-apps"
|
|
113
|
+
],
|
|
114
|
+
"method": "GET",
|
|
115
|
+
"endpoint": "/apps",
|
|
116
|
+
"endpointParams": [],
|
|
117
|
+
"controller": "App.ListApps",
|
|
118
|
+
"requestType": null,
|
|
119
|
+
"scalarParams": [],
|
|
120
|
+
"responseType": "AppListRespVO"
|
|
121
|
+
},
|
|
106
122
|
{
|
|
107
123
|
"scope": "admin",
|
|
108
124
|
"module": "app",
|
|
@@ -3108,88 +3124,6 @@ export const adminCommands = [
|
|
|
3108
3124
|
}
|
|
3109
3125
|
],
|
|
3110
3126
|
"responseType": "TenantUsageDailyRespVO"
|
|
3111
|
-
},
|
|
3112
|
-
{
|
|
3113
|
-
"scope": "admin",
|
|
3114
|
-
"module": "workflow",
|
|
3115
|
-
"functionName": "deployEntityWorkflow",
|
|
3116
|
-
"commandPath": [
|
|
3117
|
-
"workflow",
|
|
3118
|
-
"deploy-entity-workflow"
|
|
3119
|
-
],
|
|
3120
|
-
"method": "POST",
|
|
3121
|
-
"endpoint": "/apps/:app_id/entity/:entity_id/workflow/deploy",
|
|
3122
|
-
"endpointParams": [
|
|
3123
|
-
"app_id",
|
|
3124
|
-
"entity_id"
|
|
3125
|
-
],
|
|
3126
|
-
"controller": "Entity.WorkflowDeploy",
|
|
3127
|
-
"requestType": "EntityWorkflowDeployReqVO",
|
|
3128
|
-
"scalarParams": [],
|
|
3129
|
-
"responseType": "EntityWorkflowDeployRespVO"
|
|
3130
|
-
},
|
|
3131
|
-
{
|
|
3132
|
-
"scope": "admin",
|
|
3133
|
-
"module": "workflow",
|
|
3134
|
-
"functionName": "getEntityWorkflow",
|
|
3135
|
-
"commandPath": [
|
|
3136
|
-
"workflow",
|
|
3137
|
-
"get-entity-workflow"
|
|
3138
|
-
],
|
|
3139
|
-
"method": "GET",
|
|
3140
|
-
"endpoint": "/apps/:app_id/entity/:entity_id/workflow",
|
|
3141
|
-
"endpointParams": [
|
|
3142
|
-
"app_id",
|
|
3143
|
-
"entity_id"
|
|
3144
|
-
],
|
|
3145
|
-
"controller": "Entity.WorkflowGet",
|
|
3146
|
-
"requestType": null,
|
|
3147
|
-
"scalarParams": [
|
|
3148
|
-
{
|
|
3149
|
-
"name": "workingId",
|
|
3150
|
-
"type": "string",
|
|
3151
|
-
"hasDefault": true
|
|
3152
|
-
}
|
|
3153
|
-
],
|
|
3154
|
-
"responseType": "EntityWorkflowGetRespVO"
|
|
3155
|
-
},
|
|
3156
|
-
{
|
|
3157
|
-
"scope": "admin",
|
|
3158
|
-
"module": "workflow",
|
|
3159
|
-
"functionName": "createEntityWorkflowVersion",
|
|
3160
|
-
"commandPath": [
|
|
3161
|
-
"workflow",
|
|
3162
|
-
"create-entity-workflow-version"
|
|
3163
|
-
],
|
|
3164
|
-
"method": "POST",
|
|
3165
|
-
"endpoint": "/apps/:app_id/entity/:entity_id/workflow/new",
|
|
3166
|
-
"endpointParams": [
|
|
3167
|
-
"app_id",
|
|
3168
|
-
"entity_id"
|
|
3169
|
-
],
|
|
3170
|
-
"controller": "Entity.WorkflowNewVersion",
|
|
3171
|
-
"requestType": null,
|
|
3172
|
-
"scalarParams": [],
|
|
3173
|
-
"responseType": "EntityWorkflowNewVersionRespVO"
|
|
3174
|
-
},
|
|
3175
|
-
{
|
|
3176
|
-
"scope": "admin",
|
|
3177
|
-
"module": "workflow",
|
|
3178
|
-
"functionName": "updateEntityWorkflow",
|
|
3179
|
-
"commandPath": [
|
|
3180
|
-
"workflow",
|
|
3181
|
-
"update-entity-workflow"
|
|
3182
|
-
],
|
|
3183
|
-
"method": "POST",
|
|
3184
|
-
"endpoint": "/apps/:app_id/entity/:entity_id/workflow",
|
|
3185
|
-
"endpointParams": [
|
|
3186
|
-
"app_id",
|
|
3187
|
-
"entity_id"
|
|
3188
|
-
],
|
|
3189
|
-
"controller": "Entity.WorkflowUpdate",
|
|
3190
|
-
"requestType": "EntityWorkflowUpdateReqVO",
|
|
3191
|
-
"scalarParams": [],
|
|
3192
|
-
"responseType": "EntityWorkflowUpdateRespVO"
|
|
3193
3127
|
}
|
|
3194
3128
|
] as const
|
|
3195
3129
|
|
|
@@ -4307,10 +4241,10 @@ export const userCommands = [
|
|
|
4307
4241
|
},
|
|
4308
4242
|
{
|
|
4309
4243
|
"scope": "user",
|
|
4310
|
-
"module": "
|
|
4244
|
+
"module": "rows",
|
|
4311
4245
|
"functionName": "putEntityQueryKeeper",
|
|
4312
4246
|
"commandPath": [
|
|
4313
|
-
"
|
|
4247
|
+
"rows",
|
|
4314
4248
|
"put-entity-query-keeper"
|
|
4315
4249
|
],
|
|
4316
4250
|
"method": "POST",
|
|
@@ -4326,10 +4260,10 @@ export const userCommands = [
|
|
|
4326
4260
|
},
|
|
4327
4261
|
{
|
|
4328
4262
|
"scope": "user",
|
|
4329
|
-
"module": "
|
|
4263
|
+
"module": "rows",
|
|
4330
4264
|
"functionName": "queryEntity",
|
|
4331
4265
|
"commandPath": [
|
|
4332
|
-
"
|
|
4266
|
+
"rows",
|
|
4333
4267
|
"query-entity"
|
|
4334
4268
|
],
|
|
4335
4269
|
"method": "POST",
|
|
@@ -4345,10 +4279,10 @@ export const userCommands = [
|
|
|
4345
4279
|
},
|
|
4346
4280
|
{
|
|
4347
4281
|
"scope": "user",
|
|
4348
|
-
"module": "
|
|
4282
|
+
"module": "rows",
|
|
4349
4283
|
"functionName": "filterEntityQuery",
|
|
4350
4284
|
"commandPath": [
|
|
4351
|
-
"
|
|
4285
|
+
"rows",
|
|
4352
4286
|
"filter-entity-query"
|
|
4353
4287
|
],
|
|
4354
4288
|
"method": "POST",
|
|
@@ -4364,10 +4298,10 @@ export const userCommands = [
|
|
|
4364
4298
|
},
|
|
4365
4299
|
{
|
|
4366
4300
|
"scope": "user",
|
|
4367
|
-
"module": "
|
|
4301
|
+
"module": "rows",
|
|
4368
4302
|
"functionName": "queryEntitySelection",
|
|
4369
4303
|
"commandPath": [
|
|
4370
|
-
"
|
|
4304
|
+
"rows",
|
|
4371
4305
|
"query-entity-selection"
|
|
4372
4306
|
],
|
|
4373
4307
|
"method": "POST",
|
|
@@ -4384,29 +4318,10 @@ export const userCommands = [
|
|
|
4384
4318
|
},
|
|
4385
4319
|
{
|
|
4386
4320
|
"scope": "user",
|
|
4387
|
-
"module": "
|
|
4388
|
-
"functionName": "resolveEntityWorkflow",
|
|
4389
|
-
"commandPath": [
|
|
4390
|
-
"workflow",
|
|
4391
|
-
"resolve-entity-workflow"
|
|
4392
|
-
],
|
|
4393
|
-
"method": "POST",
|
|
4394
|
-
"endpoint": "/entity/:app_id/:entity_id/resolve-workflow",
|
|
4395
|
-
"endpointParams": [
|
|
4396
|
-
"app_id",
|
|
4397
|
-
"entity_id"
|
|
4398
|
-
],
|
|
4399
|
-
"controller": "UserAction.EntityResolveWorkflow",
|
|
4400
|
-
"requestType": "EntityResolveWorkflowReqVO",
|
|
4401
|
-
"scalarParams": [],
|
|
4402
|
-
"responseType": "EntityResolveWorkflowRespVO"
|
|
4403
|
-
},
|
|
4404
|
-
{
|
|
4405
|
-
"scope": "user",
|
|
4406
|
-
"module": "workflow",
|
|
4321
|
+
"module": "rows",
|
|
4407
4322
|
"functionName": "getEntityRow",
|
|
4408
4323
|
"commandPath": [
|
|
4409
|
-
"
|
|
4324
|
+
"rows",
|
|
4410
4325
|
"get-entity-row"
|
|
4411
4326
|
],
|
|
4412
4327
|
"method": "GET",
|
|
@@ -4429,10 +4344,10 @@ export const userCommands = [
|
|
|
4429
4344
|
},
|
|
4430
4345
|
{
|
|
4431
4346
|
"scope": "user",
|
|
4432
|
-
"module": "
|
|
4347
|
+
"module": "rows",
|
|
4433
4348
|
"functionName": "deleteEntityRow",
|
|
4434
4349
|
"commandPath": [
|
|
4435
|
-
"
|
|
4350
|
+
"rows",
|
|
4436
4351
|
"delete-entity-row"
|
|
4437
4352
|
],
|
|
4438
4353
|
"method": "POST",
|
|
@@ -4448,10 +4363,10 @@ export const userCommands = [
|
|
|
4448
4363
|
},
|
|
4449
4364
|
{
|
|
4450
4365
|
"scope": "user",
|
|
4451
|
-
"module": "
|
|
4366
|
+
"module": "rows",
|
|
4452
4367
|
"functionName": "restoreEntityRow",
|
|
4453
4368
|
"commandPath": [
|
|
4454
|
-
"
|
|
4369
|
+
"rows",
|
|
4455
4370
|
"restore-entity-row"
|
|
4456
4371
|
],
|
|
4457
4372
|
"method": "POST",
|
|
@@ -4467,10 +4382,10 @@ export const userCommands = [
|
|
|
4467
4382
|
},
|
|
4468
4383
|
{
|
|
4469
4384
|
"scope": "user",
|
|
4470
|
-
"module": "
|
|
4385
|
+
"module": "rows",
|
|
4471
4386
|
"functionName": "updateEntityRow",
|
|
4472
4387
|
"commandPath": [
|
|
4473
|
-
"
|
|
4388
|
+
"rows",
|
|
4474
4389
|
"update-entity-row"
|
|
4475
4390
|
],
|
|
4476
4391
|
"method": "PUT",
|
|
@@ -4487,10 +4402,10 @@ export const userCommands = [
|
|
|
4487
4402
|
},
|
|
4488
4403
|
{
|
|
4489
4404
|
"scope": "user",
|
|
4490
|
-
"module": "
|
|
4405
|
+
"module": "rows",
|
|
4491
4406
|
"functionName": "validateEntityUniq",
|
|
4492
4407
|
"commandPath": [
|
|
4493
|
-
"
|
|
4408
|
+
"rows",
|
|
4494
4409
|
"validate-entity-uniq"
|
|
4495
4410
|
],
|
|
4496
4411
|
"method": "POST",
|
|
@@ -4506,10 +4421,10 @@ export const userCommands = [
|
|
|
4506
4421
|
},
|
|
4507
4422
|
{
|
|
4508
4423
|
"scope": "user",
|
|
4509
|
-
"module": "
|
|
4424
|
+
"module": "rows",
|
|
4510
4425
|
"functionName": "insertEntity",
|
|
4511
4426
|
"commandPath": [
|
|
4512
|
-
"
|
|
4427
|
+
"rows",
|
|
4513
4428
|
"insert-entity"
|
|
4514
4429
|
],
|
|
4515
4430
|
"method": "POST",
|
|
@@ -4525,10 +4440,10 @@ export const userCommands = [
|
|
|
4525
4440
|
},
|
|
4526
4441
|
{
|
|
4527
4442
|
"scope": "user",
|
|
4528
|
-
"module": "
|
|
4443
|
+
"module": "rows",
|
|
4529
4444
|
"functionName": "prepareEntityInsert",
|
|
4530
4445
|
"commandPath": [
|
|
4531
|
-
"
|
|
4446
|
+
"rows",
|
|
4532
4447
|
"prepare-entity-insert"
|
|
4533
4448
|
],
|
|
4534
4449
|
"method": "POST",
|
|
@@ -4544,48 +4459,10 @@ export const userCommands = [
|
|
|
4544
4459
|
},
|
|
4545
4460
|
{
|
|
4546
4461
|
"scope": "user",
|
|
4547
|
-
"module": "
|
|
4548
|
-
"functionName": "queryEntityWorkflowApproveUsers",
|
|
4549
|
-
"commandPath": [
|
|
4550
|
-
"workflow",
|
|
4551
|
-
"query-entity-workflow-approve-users"
|
|
4552
|
-
],
|
|
4553
|
-
"method": "POST",
|
|
4554
|
-
"endpoint": "/entity/:app_id/:entity_id/query-approve-users",
|
|
4555
|
-
"endpointParams": [
|
|
4556
|
-
"app_id",
|
|
4557
|
-
"entity_id"
|
|
4558
|
-
],
|
|
4559
|
-
"controller": "UserAction.EntityWorkflowApproveUsers",
|
|
4560
|
-
"requestType": null,
|
|
4561
|
-
"scalarParams": [],
|
|
4562
|
-
"responseType": "EntityWorkflowApproveUsersRespVO"
|
|
4563
|
-
},
|
|
4564
|
-
{
|
|
4565
|
-
"scope": "user",
|
|
4566
|
-
"module": "workflow",
|
|
4567
|
-
"functionName": "queryEntityWorkflowNodes",
|
|
4568
|
-
"commandPath": [
|
|
4569
|
-
"workflow",
|
|
4570
|
-
"query-entity-workflow-nodes"
|
|
4571
|
-
],
|
|
4572
|
-
"method": "POST",
|
|
4573
|
-
"endpoint": "/entity/:app_id/:entity_id/query-workflow-nodes",
|
|
4574
|
-
"endpointParams": [
|
|
4575
|
-
"app_id",
|
|
4576
|
-
"entity_id"
|
|
4577
|
-
],
|
|
4578
|
-
"controller": "UserAction.EntityWorkflowNodes",
|
|
4579
|
-
"requestType": null,
|
|
4580
|
-
"scalarParams": [],
|
|
4581
|
-
"responseType": "EntityWorkflowNodesRespVO"
|
|
4582
|
-
},
|
|
4583
|
-
{
|
|
4584
|
-
"scope": "user",
|
|
4585
|
-
"module": "workflow",
|
|
4462
|
+
"module": "rows",
|
|
4586
4463
|
"functionName": "getEntitySubformItems",
|
|
4587
4464
|
"commandPath": [
|
|
4588
|
-
"
|
|
4465
|
+
"rows",
|
|
4589
4466
|
"get-entity-subform-items"
|
|
4590
4467
|
],
|
|
4591
4468
|
"method": "POST",
|
|
@@ -282,10 +282,6 @@ export const typeIndex = {
|
|
|
282
282
|
"file": "/opt/arcubase-sdk/types/user-action.ts",
|
|
283
283
|
"dependencies": []
|
|
284
284
|
},
|
|
285
|
-
"EntityResolveWorkflowReqVO": {
|
|
286
|
-
"file": "/opt/arcubase-sdk/types/user-action.ts",
|
|
287
|
-
"dependencies": []
|
|
288
|
-
},
|
|
289
285
|
"EntitySaveCustomKeysReqVO": {
|
|
290
286
|
"file": "/opt/arcubase-sdk/types/entity.ts",
|
|
291
287
|
"dependencies": [
|
|
@@ -344,14 +340,6 @@ export const typeIndex = {
|
|
|
344
340
|
"file": "/opt/arcubase-sdk/types/common.ts",
|
|
345
341
|
"dependencies": []
|
|
346
342
|
},
|
|
347
|
-
"EntityWorkflowDeployReqVO": {
|
|
348
|
-
"file": "/opt/arcubase-sdk/types/workflow.ts",
|
|
349
|
-
"dependencies": []
|
|
350
|
-
},
|
|
351
|
-
"EntityWorkflowUpdateReqVO": {
|
|
352
|
-
"file": "/opt/arcubase-sdk/types/workflow.ts",
|
|
353
|
-
"dependencies": []
|
|
354
|
-
},
|
|
355
343
|
"FetchWidgetsDataReqVO": {
|
|
356
344
|
"file": "/opt/arcubase-sdk/types/user-action.ts",
|
|
357
345
|
"dependencies": []
|
|
@@ -268,8 +268,6 @@ export const EntityQueryOrderVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "c
|
|
|
268
268
|
|
|
269
269
|
export const EntityQueryReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "limit": z.number().optional(), "offset": z.number().optional(), "policy_id": z.string().optional(), "search": z.record(z.string(), z.any()).optional(), "sorts": z.array(EntityQueryOrderVOSchema).optional(), "view_mode": z.string().optional(), "withSubForm": z.boolean().optional() }).strict())
|
|
270
270
|
|
|
271
|
-
export const EntityResolveWorkflowReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "approve_users": z.array(z.number()).optional(), "closeCurrentTasks": z.boolean().optional(), "node_id": z.number().optional(), "policy_id": z.string().optional(), "record_id": z.number().optional(), "version_id": z.number().optional() }).strict())
|
|
272
|
-
|
|
273
271
|
export const EntitySaveCustomKeysFieldVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "id": z.number().optional(), "key": z.string().optional() }).strict())
|
|
274
272
|
|
|
275
273
|
export const EntitySaveCustomKeysReqVOSchema: z.ZodTypeAny = z.lazy(() => z.array(EntitySaveCustomKeysFieldVOSchema))
|
|
@@ -314,34 +312,6 @@ export const EntityValidateUniqFieldVOSchema: z.ZodTypeAny = z.lazy(() => z.obje
|
|
|
314
312
|
|
|
315
313
|
export const EntityValidateUniqReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "fields": z.array(EntityValidateUniqFieldVOSchema).optional(), "record_id": z.number().optional() }).strict())
|
|
316
314
|
|
|
317
|
-
export const ActionBulkUpdateActionSchema: z.ZodTypeAny = z.lazy(() => z.object({ "number_add": z.number().optional(), "number_mul": z.number().optional(), "number_sub": z.number().optional(), "text_append": z.string().optional(), "text_prepend": z.string().optional(), "text_replace": z.string().optional(), "text_search": z.string().optional(), "type": z.string().optional(), "value": z.any().optional() }).strict())
|
|
318
|
-
|
|
319
|
-
export const ActionBulkUpdateSchema: z.ZodTypeAny = z.lazy(() => z.object({ "action": ActionBulkUpdateActionSchema.optional(), "id": z.number().optional() }).strict())
|
|
320
|
-
|
|
321
|
-
export const WorkflowActionConfigSchema: z.ZodTypeAny = z.lazy(() => z.object({ "enabled": z.boolean().optional(), "options": z.object({ "comment_required": z.boolean().optional(), "desc": z.string().optional(), "modifiers": z.array(ActionBulkUpdateSchema).optional() }).strict().optional() }).strict())
|
|
322
|
-
|
|
323
|
-
export const WorkflowVoteTypeSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal(0), z.literal(1)]))
|
|
324
|
-
|
|
325
|
-
export const NotificationWebhookConfigSchema: z.ZodTypeAny = z.lazy(() => z.object({ "mode": NotificationPayloadModeSchema.optional(), "template": z.string().optional(), "url": z.string().optional(), "version": z.string().optional() }).strict())
|
|
326
|
-
|
|
327
|
-
export const WorkflowConfigNodeSchema: z.ZodTypeAny = z.lazy(() => z.object({ "data": z.object({ "actions": z.record(z.string(), WorkflowActionConfigSchema).optional(), "approver_actions": z.array(z.number()).optional(), "approvers": z.array(PermitUserScopeSchema).optional(), "auto_forward": z.boolean().optional(), "cc": z.array(PermitUserScopeSchema).optional(), "fields": z.array(z.number()).optional(), "notify_email": z.boolean().optional(), "notify_email_tmpl": z.object({ "body": z.string().optional(), "subject": z.string().optional() }).strict().optional(), "submit_condition": z.array(z.number()).optional(), "use_cc": z.boolean().optional(), "vote_type": WorkflowVoteTypeSchema.optional(), "webhooks": z.array(NotificationWebhookConfigSchema).optional() }).strict().optional(), "events": z.array(z.number()).optional(), "id": z.string().optional(), "label": z.string().optional(), "mode": z.string().optional(), "position": z.array(z.number()).optional(), "type": z.string().optional() }).strict())
|
|
328
|
-
|
|
329
|
-
export const WorkflowConfigDiagramSchema: z.ZodTypeAny = z.lazy(() => z.object({ "edges": z.array(z.number()).optional(), "id_seq": z.number().optional(), "nodes": z.array(WorkflowConfigNodeSchema).optional(), "viewport": z.array(z.number()).optional() }).strict())
|
|
330
|
-
|
|
331
|
-
export const WorkflowAutoApproveRuleSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal(1), z.literal(2), z.literal(3)]))
|
|
332
|
-
|
|
333
|
-
export const WorkflowRetractRuleSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal(1), z.literal(2), z.literal(3)]))
|
|
334
|
-
|
|
335
|
-
export const WorkflowSLATriggerSchema: z.ZodTypeAny = z.lazy(() => z.object({ "hasUpdateField": z.boolean().optional(), "hasWebhook": z.boolean().optional(), "modifiers": z.array(ActionBulkUpdateSchema).optional(), "time_point": z.number().optional(), "webhook": NotificationWebhookConfigSchema.optional() }).strict())
|
|
336
|
-
|
|
337
|
-
export const WorkflowSLAConfigSchema: z.ZodTypeAny = z.lazy(() => z.object({ "ddl": z.number().optional(), "enabled": z.boolean().optional(), "id": z.string().optional(), "name": z.string().optional(), "nodes": z.array(z.string()).optional(), "triggers": z.array(WorkflowSLATriggerSchema).optional() }).strict())
|
|
338
|
-
|
|
339
|
-
export const WorkflowOptionsSchema: z.ZodTypeAny = z.lazy(() => z.object({ "allow_urge": z.boolean().optional(), "allow_view_diagram": z.boolean().optional(), "auto_approve_rule": WorkflowAutoApproveRuleSchema.optional(), "retract_rule": WorkflowRetractRuleSchema.optional(), "sla": z.array(WorkflowSLAConfigSchema).optional() }).strict())
|
|
340
|
-
|
|
341
|
-
export const EntityWorkflowDeployReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "diagram": WorkflowConfigDiagramSchema.optional(), "id": z.number().optional(), "options": WorkflowOptionsSchema.optional() }).strict())
|
|
342
|
-
|
|
343
|
-
export const EntityWorkflowUpdateReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "diagram": WorkflowConfigDiagramSchema.optional(), "id": z.number().optional(), "options": WorkflowOptionsSchema.optional() }).strict())
|
|
344
|
-
|
|
345
315
|
export const EntityUtilsQueryOrderSchema: z.ZodTypeAny = z.lazy(() => z.object({ "column": z.string().optional(), "order": z.string().optional() }).strict())
|
|
346
316
|
|
|
347
317
|
export const FetchWidgetsDataReqVOSchema: z.ZodTypeAny = z.lazy(() => z.object({ "dashboard_id": z.number().optional(), "ingress_hash_id": z.string().optional(), "ingress_id": z.number().optional(), "querys": z.object({ "search": z.record(z.string(), z.any()).optional(), "sorts": z.array(EntityUtilsQueryOrderSchema).optional() }).strict().optional(), "type": WidgetsTypeCodeSchema.optional() }).strict())
|
|
@@ -518,7 +488,6 @@ export const generatedRequestTypes = [
|
|
|
518
488
|
"EntityQueryLinkToValuesReqVO",
|
|
519
489
|
"EntityQueryRelationReqVO",
|
|
520
490
|
"EntityQueryReqVO",
|
|
521
|
-
"EntityResolveWorkflowReqVO",
|
|
522
491
|
"EntitySaveCustomKeysReqVO",
|
|
523
492
|
"EntitySaveNameReqVO",
|
|
524
493
|
"EntitySaveReqVO",
|
|
@@ -531,8 +500,6 @@ export const generatedRequestTypes = [
|
|
|
531
500
|
"EntityUpdateReqVO",
|
|
532
501
|
"EntityUpdateSuccessScreenReqVO",
|
|
533
502
|
"EntityValidateUniqReqVO",
|
|
534
|
-
"EntityWorkflowDeployReqVO",
|
|
535
|
-
"EntityWorkflowUpdateReqVO",
|
|
536
503
|
"FetchWidgetsDataReqVO",
|
|
537
504
|
"GetOrganizationTreeReqVO",
|
|
538
505
|
"GetOrganizationUsersReqVO",
|
|
@@ -648,7 +615,6 @@ export const bodySchemas = {
|
|
|
648
615
|
"EntityQueryLinkToValuesReqVO": EntityQueryLinkToValuesReqVOSchema,
|
|
649
616
|
"EntityQueryRelationReqVO": EntityQueryRelationReqVOSchema,
|
|
650
617
|
"EntityQueryReqVO": EntityQueryReqVOSchema,
|
|
651
|
-
"EntityResolveWorkflowReqVO": EntityResolveWorkflowReqVOSchema,
|
|
652
618
|
"EntitySaveCustomKeysReqVO": EntitySaveCustomKeysReqVOSchema,
|
|
653
619
|
"EntitySaveNameReqVO": EntitySaveNameReqVOSchema,
|
|
654
620
|
"EntitySaveReqVO": EntitySaveReqVOSchema,
|
|
@@ -661,8 +627,6 @@ export const bodySchemas = {
|
|
|
661
627
|
"EntityUpdateReqVO": EntityUpdateReqVOSchema,
|
|
662
628
|
"EntityUpdateSuccessScreenReqVO": EntityUpdateSuccessScreenReqVOSchema,
|
|
663
629
|
"EntityValidateUniqReqVO": EntityValidateUniqReqVOSchema,
|
|
664
|
-
"EntityWorkflowDeployReqVO": EntityWorkflowDeployReqVOSchema,
|
|
665
|
-
"EntityWorkflowUpdateReqVO": EntityWorkflowUpdateReqVOSchema,
|
|
666
630
|
"FetchWidgetsDataReqVO": FetchWidgetsDataReqVOSchema,
|
|
667
631
|
"GetOrganizationTreeReqVO": GetOrganizationTreeReqVOSchema,
|
|
668
632
|
"GetOrganizationUsersReqVO": GetOrganizationUsersReqVOSchema,
|
|
@@ -3,10 +3,46 @@ import { adminCommands, userCommands } from '../generated/command_registry.gener
|
|
|
3
3
|
export { adminCommands, userCommands }
|
|
4
4
|
|
|
5
5
|
export type CommandScope = 'admin' | 'user'
|
|
6
|
-
|
|
6
|
+
type GeneratedCommandDef = (typeof adminCommands)[number] | (typeof userCommands)[number]
|
|
7
|
+
|
|
8
|
+
type CustomCommandDef = {
|
|
9
|
+
scope: CommandScope
|
|
10
|
+
module: string
|
|
11
|
+
functionName: string
|
|
12
|
+
commandPath: readonly [string, string]
|
|
13
|
+
method: string
|
|
14
|
+
endpoint: string
|
|
15
|
+
endpointParams: readonly string[]
|
|
16
|
+
controller: string
|
|
17
|
+
requestType: string | null
|
|
18
|
+
scalarParams: readonly { name: string; type: string; hasDefault: boolean }[]
|
|
19
|
+
responseType: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type CommandDef = GeneratedCommandDef | CustomCommandDef
|
|
23
|
+
|
|
24
|
+
const customAdminCommands: readonly CustomCommandDef[] = [
|
|
25
|
+
{
|
|
26
|
+
scope: 'admin',
|
|
27
|
+
module: 'app',
|
|
28
|
+
functionName: 'inventory',
|
|
29
|
+
commandPath: ['app', 'inventory'],
|
|
30
|
+
method: 'GET',
|
|
31
|
+
endpoint: '/apps',
|
|
32
|
+
endpointParams: [],
|
|
33
|
+
controller: 'Runtime.AppInventory',
|
|
34
|
+
requestType: null,
|
|
35
|
+
scalarParams: [],
|
|
36
|
+
responseType: 'AppInventoryRespVO',
|
|
37
|
+
},
|
|
38
|
+
] as const
|
|
39
|
+
|
|
40
|
+
const customUserCommands: readonly CustomCommandDef[] = []
|
|
7
41
|
|
|
8
42
|
export function listCommands(scope: CommandScope): readonly CommandDef[] {
|
|
9
|
-
return scope === 'admin'
|
|
43
|
+
return scope === 'admin'
|
|
44
|
+
? [...adminCommands, ...customAdminCommands]
|
|
45
|
+
: [...userCommands, ...customUserCommands]
|
|
10
46
|
}
|
|
11
47
|
|
|
12
48
|
export function findCommand(scope: CommandScope, moduleName: string, commandName: string): CommandDef | null {
|
package/src/runtime/execute.ts
CHANGED
|
@@ -23,10 +23,118 @@ type CustomUploadSummary = {
|
|
|
23
23
|
data: ReturnType<typeof summarizeUploadResult>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
type AppInventoryItem = {
|
|
27
|
+
id: string
|
|
28
|
+
name: string
|
|
29
|
+
entities: Array<{ id: string; name: string }>
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
function summarizeUploadResult(value: Awaited<ReturnType<typeof uploadLocalFile>>) {
|
|
27
33
|
return value
|
|
28
34
|
}
|
|
29
35
|
|
|
36
|
+
function parseJSONResponse(raw: string): unknown {
|
|
37
|
+
if (!raw) return null
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(raw)
|
|
40
|
+
} catch {
|
|
41
|
+
return raw
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function unwrapResponseData(payload: unknown): unknown {
|
|
46
|
+
return isRecord(payload) && 'data' in payload ? payload.data : payload
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function formatUpstreamError(payload: unknown): string {
|
|
50
|
+
if (typeof payload === 'string') {
|
|
51
|
+
return payload
|
|
52
|
+
}
|
|
53
|
+
if (isRecord(payload) && isRecord(payload.error) && typeof payload.error.message === 'string') {
|
|
54
|
+
return payload.error.message
|
|
55
|
+
}
|
|
56
|
+
return JSON.stringify(payload)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function extractApps(payload: unknown): Array<{ id: string; name: string }> {
|
|
60
|
+
const data = unwrapResponseData(payload)
|
|
61
|
+
if (!Array.isArray(data)) return []
|
|
62
|
+
return data
|
|
63
|
+
.filter((item): item is Record<string, unknown> => isRecord(item))
|
|
64
|
+
.filter((item) => item.id !== undefined && typeof item.name === 'string')
|
|
65
|
+
.map((item) => ({
|
|
66
|
+
id: String(item.id),
|
|
67
|
+
name: item.name as string,
|
|
68
|
+
}))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function extractEntities(payload: unknown): Array<{ id: string; name: string }> {
|
|
72
|
+
const data = unwrapResponseData(payload)
|
|
73
|
+
if (!Array.isArray(data)) return []
|
|
74
|
+
return data
|
|
75
|
+
.filter((item): item is Record<string, unknown> => isRecord(item))
|
|
76
|
+
.filter((item) => item.id !== undefined && typeof item.name === 'string')
|
|
77
|
+
.map((item) => ({
|
|
78
|
+
id: String(item.id),
|
|
79
|
+
name: item.name as string,
|
|
80
|
+
}))
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function executeAppInventory(runtimeEnv: RuntimeEnv, fetchImpl: typeof fetch) {
|
|
84
|
+
const appsResponse = await fetchImpl(buildURL(runtimeEnv.ARCUBASE_BASE_URL, '/apps'), {
|
|
85
|
+
method: 'GET',
|
|
86
|
+
headers: buildRequestHeaders(runtimeEnv),
|
|
87
|
+
})
|
|
88
|
+
const appsRaw = await appsResponse.text()
|
|
89
|
+
const appsPayload = parseJSONResponse(appsRaw)
|
|
90
|
+
if (!appsResponse.ok) {
|
|
91
|
+
throw new CLIError('UPSTREAM_REQUEST_FAILED', formatUpstreamError(appsPayload), 1)
|
|
92
|
+
}
|
|
93
|
+
if (isRecord(appsPayload) && appsPayload.error) {
|
|
94
|
+
throw new CLIError('UPSTREAM_BODY_ERROR', formatUpstreamError(appsPayload), 1, {
|
|
95
|
+
endpoint: '/apps',
|
|
96
|
+
method: 'GET',
|
|
97
|
+
upstreamError: appsPayload.error,
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
const apps = extractApps(appsPayload)
|
|
101
|
+
const items: AppInventoryItem[] = []
|
|
102
|
+
for (const app of apps) {
|
|
103
|
+
const entitiesResponse = await fetchImpl(buildURL(runtimeEnv.ARCUBASE_BASE_URL, `/apps/${encodeURIComponent(app.id)}/entities`), {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
headers: {
|
|
106
|
+
...buildRequestHeaders(runtimeEnv),
|
|
107
|
+
'Content-Type': 'application/json',
|
|
108
|
+
},
|
|
109
|
+
body: JSON.stringify({}),
|
|
110
|
+
})
|
|
111
|
+
const entitiesRaw = await entitiesResponse.text()
|
|
112
|
+
const entitiesPayload = parseJSONResponse(entitiesRaw)
|
|
113
|
+
if (!entitiesResponse.ok) {
|
|
114
|
+
throw new CLIError('UPSTREAM_REQUEST_FAILED', formatUpstreamError(entitiesPayload), 1)
|
|
115
|
+
}
|
|
116
|
+
if (isRecord(entitiesPayload) && entitiesPayload.error) {
|
|
117
|
+
throw new CLIError('UPSTREAM_BODY_ERROR', formatUpstreamError(entitiesPayload), 1, {
|
|
118
|
+
endpoint: `/apps/${app.id}/entities`,
|
|
119
|
+
method: 'POST',
|
|
120
|
+
upstreamError: entitiesPayload.error,
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
items.push({
|
|
124
|
+
...app,
|
|
125
|
+
entities: extractEntities(entitiesPayload),
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
kind: 'result',
|
|
130
|
+
commandPath: ['app', 'inventory'] as const,
|
|
131
|
+
status: 200,
|
|
132
|
+
data: {
|
|
133
|
+
apps: items,
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
30
138
|
export function renderRootHelp(scope: CommandScope): string {
|
|
31
139
|
const binary = scope === 'admin' ? 'arcubase-admin' : 'arcubase'
|
|
32
140
|
const items = listModules(scope).map((item) => ` - ${item}`)
|
|
@@ -35,7 +143,7 @@ export function renderRootHelp(scope: CommandScope): string {
|
|
|
35
143
|
'',
|
|
36
144
|
...(scope === 'admin'
|
|
37
145
|
? ['use arcubase-admin for app, entity shell, and schema management', '']
|
|
38
|
-
: ['use arcubase for
|
|
146
|
+
: ['use arcubase for rows, search, selection actions, and bulk actions', '']),
|
|
39
147
|
'modules:',
|
|
40
148
|
...items,
|
|
41
149
|
...(scope === 'user' ? ['','special commands:',' - upload <local-file>'] : []),
|
|
@@ -53,7 +161,7 @@ export function renderModuleHelp(scope: CommandScope, moduleName: string): strin
|
|
|
53
161
|
'',
|
|
54
162
|
...(scope === 'admin'
|
|
55
163
|
? ['use arcubase-admin for app, entity shell, and schema management', '']
|
|
56
|
-
: ['use arcubase for
|
|
164
|
+
: ['use arcubase for rows, search, selection actions, and bulk actions', '']),
|
|
57
165
|
'commands:',
|
|
58
166
|
...items.map((item) => ` - ${item.commandPath[1]}`),
|
|
59
167
|
].join('\n')
|
|
@@ -61,11 +169,11 @@ export function renderModuleHelp(scope: CommandScope, moduleName: string): strin
|
|
|
61
169
|
|
|
62
170
|
function buildUnknownCommandDetails(scope: CommandScope, moduleName: string, commandName: string): { suggestions?: string[]; reason?: string; hint?: string } | undefined {
|
|
63
171
|
const suggestions = findCommandSuggestions(moduleName, commandName).map((item) => `${item.binary} ${item.moduleName} ${item.commandName}`)
|
|
64
|
-
if (scope === 'admin' && moduleName === 'workflow' && suggestions.some((item) => item.startsWith('arcubase
|
|
172
|
+
if (scope === 'admin' && moduleName === 'workflow' && suggestions.some((item) => item.startsWith('arcubase rows '))) {
|
|
65
173
|
return {
|
|
66
174
|
suggestions,
|
|
67
|
-
reason: `${moduleName} ${commandName} is a
|
|
68
|
-
hint: `use: arcubase
|
|
175
|
+
reason: `${moduleName} ${commandName} is not a valid command group; use arcubase rows for row operations`,
|
|
176
|
+
hint: `use: arcubase rows ${commandName}`,
|
|
69
177
|
}
|
|
70
178
|
}
|
|
71
179
|
return suggestions.length > 0 ? { suggestions } : undefined
|
|
@@ -92,8 +200,15 @@ export function renderCommandHelp(scope: CommandScope, moduleName: string, comma
|
|
|
92
200
|
? [
|
|
93
201
|
'next step:',
|
|
94
202
|
' - switch to arcubase for row operations',
|
|
95
|
-
' - row insert: arcubase
|
|
96
|
-
' - row query: arcubase
|
|
203
|
+
' - row insert: arcubase rows insert-entity --app-id <app_id> --entity-id <entity_id> --body-file insert.json',
|
|
204
|
+
' - row query: arcubase rows query-entity --app-id <app_id> --entity-id <entity_id> --body-file query.json',
|
|
205
|
+
]
|
|
206
|
+
: []),
|
|
207
|
+
...(scope === 'admin' && moduleName === 'app' && commandName === 'inventory'
|
|
208
|
+
? [
|
|
209
|
+
'purpose:',
|
|
210
|
+
' - list all accessible apps and each app entity list in one call sequence',
|
|
211
|
+
' - use this before asking the user for app_id',
|
|
97
212
|
]
|
|
98
213
|
: []),
|
|
99
214
|
...(docHints.length > 0
|
|
@@ -340,7 +455,7 @@ function validateActionSpecificBody(
|
|
|
340
455
|
return
|
|
341
456
|
}
|
|
342
457
|
|
|
343
|
-
if (command.module === '
|
|
458
|
+
if (command.module === 'rows' && command.functionName === 'queryEntitySelection') {
|
|
344
459
|
const action = flagValue(flags, 'action')
|
|
345
460
|
const selection = body.selection
|
|
346
461
|
if (!isRecord(selection) || typeof selection.type !== 'string') {
|
|
@@ -354,7 +469,7 @@ function validateActionSpecificBody(
|
|
|
354
469
|
if (action === 'query') {
|
|
355
470
|
if (type === 'condition') {
|
|
356
471
|
throwBodyValidationFailure(
|
|
357
|
-
'selection.type=condition is not supported for action=query; use selection.type=ids or selection.type=all, or use
|
|
472
|
+
'selection.type=condition is not supported for action=query; use selection.type=ids or selection.type=all, or use rows query-entity for search conditions',
|
|
358
473
|
command.requestType,
|
|
359
474
|
'body.selection.type',
|
|
360
475
|
scope,
|
|
@@ -449,6 +564,9 @@ export async function executeCLI(scope: CommandScope, argv: string[], env?: Runt
|
|
|
449
564
|
if (!command) {
|
|
450
565
|
throw new CLIError('UNKNOWN_COMMAND', `unknown command: ${moduleName} ${commandName}`, 2, buildUnknownCommandDetails(scope, moduleName, commandName))
|
|
451
566
|
}
|
|
567
|
+
if (scope === 'admin' && moduleName === 'app' && commandName === 'inventory') {
|
|
568
|
+
return executeAppInventory(runtimeEnv, fetchImpl)
|
|
569
|
+
}
|
|
452
570
|
|
|
453
571
|
const endpoint = normalizeExternalEndpoint(resolveEndpoint(command.endpoint, parsed.flags))
|
|
454
572
|
const scalarQuery = buildScalarQuery(command, parsed.flags)
|