@carthooks/arcubase-cli 0.1.2 → 0.1.3
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 +907 -10
- package/bundle/arcubase.mjs +907 -10
- package/dist/runtime/command_registry.d.ts +8 -0
- package/dist/runtime/command_registry.d.ts.map +1 -1
- package/dist/runtime/command_registry.js +35 -0
- package/dist/runtime/entity_save_schema.d.ts +15 -0
- package/dist/runtime/entity_save_schema.d.ts.map +1 -0
- package/dist/runtime/entity_save_schema.js +641 -0
- package/dist/runtime/errors.d.ts +10 -0
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/execute.d.ts.map +1 -1
- package/dist/runtime/execute.js +89 -10
- package/dist/runtime/zod_registry.d.ts +6 -0
- package/dist/runtime/zod_registry.d.ts.map +1 -1
- package/dist/runtime/zod_registry.js +133 -0
- package/dist/tests/command_registry.test.js +5 -0
- package/dist/tests/entity_save_schema.test.d.ts +2 -0
- package/dist/tests/entity_save_schema.test.d.ts.map +1 -0
- package/dist/tests/entity_save_schema.test.js +221 -0
- package/dist/tests/execute_validation.test.js +450 -0
- package/dist/tests/help.test.js +33 -0
- package/package.json +1 -1
- package/sdk-dist/docs/runtime-reference/README.md +177 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/README.md +120 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/address.md +34 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/boolean.md +37 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/button.md +47 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/checkbox.md +61 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/datasets.md +35 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/datetime.md +40 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/department.md +33 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/departments.md +34 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/divider.md +39 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/file.md +44 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/formula.md +44 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/image.md +43 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/linkto.md +67 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/location.md +32 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/lookup.md +41 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/member.md +37 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/members.md +31 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/number.md +70 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/query.md +50 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/radio.md +53 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/relation.md +55 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/relationfield.md +38 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/rollup.md +54 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/select.md +63 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/selects.md +51 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/serialnumber.md +48 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/signature.md +31 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/status.md +70 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/subform.md +74 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/tags.md +19 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/text.md +76 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/textarea.md +47 -0
- package/sdk-dist/docs/runtime-reference/entity-schema/workflow_status.md +17 -0
- package/sdk-dist/docs/runtime-reference/entity-schema.md +197 -0
- package/sdk-dist/docs/runtime-reference/examples/README.md +51 -0
- package/sdk-dist/docs/runtime-reference/examples/crm-01/README.md +20 -0
- package/sdk-dist/docs/runtime-reference/examples/mes-01/README.md +21 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/README.md +164 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/app-overview.md +79 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/create-app.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/goods-receipt.create-entity.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/goods-receipt.schema.json +159 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/item-master.create-entity.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/item-master.schema.json +179 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/picking-list.create-entity.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/picking-list.schema.json +168 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/purchase-order.create-entity.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/purchase-order.schema.json +417 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.bulk-update.json +22 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.create-entity.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.query.json +10 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.row.insert.json +28 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.schema.json +398 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.selection.condition.json +13 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/sales-order.selection.ids.json +7 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/stock-issue.create-entity.json +3 -0
- package/sdk-dist/docs/runtime-reference/examples/oms-01/stock-issue.schema.json +137 -0
- package/sdk-dist/docs/runtime-reference/examples/wms-01/README.md +21 -0
- package/sdk-dist/docs/runtime-reference/row-crud.md +186 -0
- package/sdk-dist/docs/runtime-reference/search-and-bulk-actions.md +494 -0
- package/sdk-dist/docs/runtime-reference/table-lifecycle.md +123 -0
- package/sdk-dist/docs/runtime-reference/workflow/README.md +19 -0
- package/src/runtime/command_registry.ts +47 -0
- package/src/runtime/entity_save_schema.ts +708 -0
- package/src/runtime/errors.ts +11 -0
- package/src/runtime/execute.ts +123 -10
- package/src/runtime/zod_registry.ts +154 -0
- package/src/tests/command_registry.test.ts +6 -0
- package/src/tests/entity_save_schema.test.ts +236 -0
- package/src/tests/execute_validation.test.ts +598 -0
- package/src/tests/help.test.ts +39 -0
|
@@ -6,4 +6,12 @@ export declare function listCommands(scope: CommandScope): readonly CommandDef[]
|
|
|
6
6
|
export declare function findCommand(scope: CommandScope, moduleName: string, commandName: string): CommandDef | null;
|
|
7
7
|
export declare function listModules(scope: CommandScope): string[];
|
|
8
8
|
export declare function listModuleCommands(scope: CommandScope, moduleName: string): readonly CommandDef[];
|
|
9
|
+
export type CommandSuggestion = {
|
|
10
|
+
scope: CommandScope;
|
|
11
|
+
moduleName: string;
|
|
12
|
+
commandName: string;
|
|
13
|
+
binary: 'arcubase-admin' | 'arcubase';
|
|
14
|
+
score: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function findCommandSuggestions(moduleName: string, commandName: string, limit?: number): CommandSuggestion[];
|
|
9
17
|
//# sourceMappingURL=command_registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command_registry.d.ts","sourceRoot":"","sources":["../../src/runtime/command_registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAExF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA;AAEtC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAA;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvF,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,UAAU,EAAE,CAEvE;AAED,wBAAgB,WAA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AAA;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,iBAAiB,EAAE,CAoB9G"}
|
|
@@ -12,3 +12,38 @@ export function listModules(scope) {
|
|
|
12
12
|
export function listModuleCommands(scope, moduleName) {
|
|
13
13
|
return listCommands(scope).filter((item) => item.commandPath[0] === moduleName);
|
|
14
14
|
}
|
|
15
|
+
function levenshtein(a, b) {
|
|
16
|
+
const dp = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
|
|
17
|
+
for (let i = 0; i <= a.length; i += 1)
|
|
18
|
+
dp[i][0] = i;
|
|
19
|
+
for (let j = 0; j <= b.length; j += 1)
|
|
20
|
+
dp[0][j] = j;
|
|
21
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
22
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
23
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
24
|
+
dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return dp[a.length][b.length];
|
|
28
|
+
}
|
|
29
|
+
export function findCommandSuggestions(moduleName, commandName, limit = 3) {
|
|
30
|
+
const suggestions = [];
|
|
31
|
+
for (const scope of ['admin', 'user']) {
|
|
32
|
+
for (const command of listCommands(scope)) {
|
|
33
|
+
const [candidateModule, candidateCommand] = command.commandPath;
|
|
34
|
+
const moduleScore = candidateModule === moduleName ? 0 : levenshtein(candidateModule, moduleName || '');
|
|
35
|
+
const commandScore = candidateCommand === commandName ? 0 : levenshtein(candidateCommand, commandName || '');
|
|
36
|
+
const score = commandScore * 3 + moduleScore;
|
|
37
|
+
suggestions.push({
|
|
38
|
+
scope,
|
|
39
|
+
moduleName: candidateModule,
|
|
40
|
+
commandName: candidateCommand,
|
|
41
|
+
binary: scope === 'admin' ? 'arcubase-admin' : 'arcubase',
|
|
42
|
+
score,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return suggestions
|
|
47
|
+
.sort((a, b) => a.score - b.score || a.binary.localeCompare(b.binary) || a.moduleName.localeCompare(b.moduleName) || a.commandName.localeCompare(b.commandName))
|
|
48
|
+
.slice(0, limit);
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BaseFieldSchema: z.ZodTypeAny;
|
|
3
|
+
export declare const SubformFieldSchema: z.ZodTypeAny;
|
|
4
|
+
export declare const FieldVOSchema: z.ZodTypeAny;
|
|
5
|
+
export declare const EntitySaveReqVOSchemaOverride: z.ZodTypeAny;
|
|
6
|
+
export declare const AppCreateByTenantsReqVOSchemaOverride: z.ZodTypeAny;
|
|
7
|
+
export declare const EntityQueryReqVOSchemaOverride: z.ZodTypeAny;
|
|
8
|
+
export declare const InsertReqVOSchemaOverride: z.ZodTypeAny;
|
|
9
|
+
export declare const EntityUpdateReqVOSchemaOverride: z.ZodTypeAny;
|
|
10
|
+
export declare const EntitySelectionActionReqVOSchemaOverride: z.ZodTypeAny;
|
|
11
|
+
export declare const EntityBulkUpdateReqVOSchemaOverride: z.ZodTypeAny;
|
|
12
|
+
export declare const EntityTagsSelectionReqVOSchemaOverride: z.ZodTypeAny;
|
|
13
|
+
export declare const EntityTagsBatchReqVOSchemaOverride: z.ZodTypeAny;
|
|
14
|
+
export declare const EntityInvokeBatchOperatorReqVOSchemaOverride: z.ZodTypeAny;
|
|
15
|
+
//# sourceMappingURL=entity_save_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity_save_schema.d.ts","sourceRoot":"","sources":["../../src/runtime/entity_save_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAoRvB,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,UAA6C,CAAA;AAE7E,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,UAQlC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,UAK7B,CAAA;AAoKD,eAAO,MAAM,6BAA6B,EAAE,CAAC,CAAC,UAA8E,CAAA;AAO5H,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,UAI3C,CAAA;AAEX,eAAO,MAAM,8BAA8B,EAAE,CAAC,CAAC,UASpC,CAAA;AAEX,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,UAaxC,CAAA;AAEF,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,UA4B9C,CAAA;AA4EF,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,UAOxD,CAAA;AAwED,eAAO,MAAM,mCAAmC,EAAE,CAAC,CAAC,UAOzC,CAAA;AAEX,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,UAG5C,CAAA;AAEX,eAAO,MAAM,kCAAkC,EAAE,CAAC,CAAC,UAIxC,CAAA;AAEX,eAAO,MAAM,4CAA4C,EAAE,CAAC,CAAC,UAQlD,CAAA"}
|