@elementumai/edk 0.9.2 → 0.9.6
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/README.md +34 -26
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
- package/dist-sdk/pull/util.d.ts +1 -1
- package/dist-sdk/pull/util.js +3 -3
- package/dist-sdk/src/catalog/factories.d.ts +49 -10
- package/dist-sdk/src/catalog/factories.js +94 -13
- package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
- package/dist-sdk/src/catalog/from-authoring.js +7 -7
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/org.js +62 -4
- package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
- package/dist-sdk/src/catalog/render-helpers.js +1 -1
- package/dist-sdk/src/catalog/render.d.ts +1 -0
- package/dist-sdk/src/catalog/render.js +2 -2
- package/dist-sdk/src/catalog/token.js +11 -4
- package/dist-sdk/src/catalog/types.d.ts +33 -4
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +10 -10
- package/dist-sdk/src/core/index.js +9 -9
- package/dist-sdk/src/core/render-tree.d.ts +1 -1
- package/dist-sdk/src/core/render-tree.js +1 -2
- package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
- package/dist-sdk/src/core/types/ai-provider.js +1 -1
- package/dist-sdk/src/core/types/app.d.ts +66 -30
- package/dist-sdk/src/core/types/app.js +2 -2
- package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
- package/dist-sdk/src/core/types/aspect-category.js +4 -4
- package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
- package/dist-sdk/src/core/types/cloud-link.js +3 -3
- package/dist-sdk/src/core/types/display-block.d.ts +2 -2
- package/dist-sdk/src/core/types/display-block.js +2 -2
- package/dist-sdk/src/core/types/group.d.ts +1 -1
- package/dist-sdk/src/core/types/group.js +1 -1
- package/dist-sdk/src/core/types/user.d.ts +1 -1
- package/dist-sdk/src/core/types/user.js +1 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
- package/dist-sdk/src/engine/build/context.d.ts +20 -13
- package/dist-sdk/src/engine/entity.d.ts +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +34 -0
- package/dist-sdk/src/engine/pull/context.js +14 -0
- package/dist-sdk/src/engine/pull/org.d.ts +9 -0
- package/dist-sdk/src/engine/pull/org.js +33 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
- package/dist-sdk/src/engine/pull/ref-only.js +204 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +6 -2
- package/dist-sdk/src/engine/tf/expr.js +18 -13
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/model.d.ts +8 -1
- package/dist-sdk/src/engine/tf/model.js +4 -0
- package/dist-sdk/src/engine/tf/parse.js +13 -2
- package/dist-sdk/src/engine/tf/render.js +4 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +4 -5
- package/dist-sdk/src/entities/access-policy/build.js +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -4
- package/dist-sdk/src/entities/access-policy/from-tf.js +12 -13
- package/dist-sdk/src/entities/access-policy/principal.d.ts +14 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +14 -2
- package/dist-sdk/src/entities/access-policy/to-tf.js +36 -6
- package/dist-sdk/src/entities/agent/build.d.ts +3 -3
- package/dist-sdk/src/entities/agent/build.js +5 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +6 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -18
- package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/agent/from-tf.js +12 -4
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -2
- package/dist-sdk/src/entities/agent/to-tf.js +56 -8
- package/dist-sdk/src/entities/agent/tools.d.ts +38 -23
- package/dist-sdk/src/entities/agent/tools.js +21 -7
- package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
- package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
- package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
- package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
- package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
- package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
- package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
- package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
- package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -7
- package/dist-sdk/src/entities/agent-tool/from-tf.js +48 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +10 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +76 -28
- package/dist-sdk/src/entities/agent-tool/types.d.ts +0 -1
- package/dist-sdk/src/entities/agent-tool/types.js +10 -37
- package/dist-sdk/src/entities/app/build.d.ts +97 -42
- package/dist-sdk/src/entities/app/build.js +25 -14
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +32 -24
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +1 -1
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +2 -0
- package/dist-sdk/src/entities/app/index.d.ts +11 -8
- package/dist-sdk/src/entities/app/index.js +10 -7
- package/dist-sdk/src/entities/app/module.js +2 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/to-tf.js +22 -6
- package/dist-sdk/src/entities/approval-chain/build.d.ts +1 -1
- package/dist-sdk/src/entities/approval-chain/build.js +5 -5
- package/dist-sdk/src/entities/approval-chain/index.d.ts +1 -1
- package/dist-sdk/src/entities/approval-chain/index.js +1 -1
- package/dist-sdk/src/entities/approval-chain/printer.js +2 -2
- package/dist-sdk/src/entities/automation/build.d.ts +172 -94
- package/dist-sdk/src/entities/automation/build.js +159 -68
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
- package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +11 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +164 -198
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -2
- package/dist-sdk/src/entities/automation/from-tf.js +510 -80
- package/dist-sdk/src/entities/automation/index.d.ts +9 -12
- package/dist-sdk/src/entities/automation/index.js +11 -13
- package/dist-sdk/src/entities/automation/module.js +74 -6
- package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
- package/dist-sdk/src/entities/automation/operators.js +10 -37
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +13 -22
- package/dist-sdk/src/entities/automation/serialize.js +1 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +153 -89
- package/dist-sdk/src/entities/automation/tasks.js +64 -11
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/to-tf.js +342 -71
- package/dist-sdk/src/entities/automation/triggers.d.ts +17 -10
- package/dist-sdk/src/entities/automation/triggers.js +7 -1
- package/dist-sdk/src/entities/automation/types.d.ts +3 -2
- package/dist-sdk/src/entities/automation/types.js +3 -2
- package/dist-sdk/src/entities/chart/build.d.ts +95 -0
- package/dist-sdk/src/entities/chart/build.js +42 -0
- package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
- package/dist-sdk/src/entities/chart/from-tf.js +269 -0
- package/dist-sdk/src/entities/chart/index.d.ts +4 -0
- package/dist-sdk/src/entities/chart/index.js +3 -0
- package/dist-sdk/src/entities/chart/module.d.ts +3 -0
- package/dist-sdk/src/entities/chart/module.js +61 -0
- package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
- package/dist-sdk/src/entities/chart/printer.js +104 -0
- package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
- package/dist-sdk/src/entities/chart/to-tf.js +150 -0
- package/dist-sdk/src/entities/chart/types.d.ts +53 -0
- package/dist-sdk/src/entities/chart/types.js +22 -0
- package/dist-sdk/src/entities/dashboard/build.d.ts +34 -7
- package/dist-sdk/src/entities/dashboard/build.js +16 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +22 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +16 -3
- package/dist-sdk/src/entities/dashboard/to-tf.js +37 -10
- package/dist-sdk/src/entities/datamine/module.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +4 -3
- package/dist-sdk/src/entities/dynamic-layout/build.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +43 -5
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +12 -6
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +10 -10
- package/dist-sdk/src/entities/element/build.d.ts +25 -32
- package/dist-sdk/src/entities/element/build.js +15 -32
- package/dist-sdk/src/entities/element/index.d.ts +7 -5
- package/dist-sdk/src/entities/element/index.js +7 -4
- package/dist-sdk/src/entities/element/module.js +7 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/element/to-tf.js +7 -3
- package/dist-sdk/src/entities/field/build.d.ts +51 -24
- package/dist-sdk/src/entities/field/build.js +31 -6
- package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
- package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
- package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
- package/dist-sdk/src/entities/field/calc/date.js +120 -29
- package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
- package/dist-sdk/src/entities/field/calc/index.js +82 -139
- package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
- package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
- package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
- package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
- package/dist-sdk/src/entities/field/calc/text.js +43 -31
- package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
- package/dist-sdk/src/entities/field/calc/types.js +1 -22
- package/dist-sdk/src/entities/field/calc.d.ts +71 -48
- package/dist-sdk/src/entities/field/calc.js +5 -15
- package/dist-sdk/src/entities/field/calculation-types.js +10 -3
- package/dist-sdk/src/entities/field/from-tf.js +156 -10
- package/dist-sdk/src/entities/field/locals.d.ts +11 -3
- package/dist-sdk/src/entities/field/locals.js +15 -2
- package/dist-sdk/src/entities/field/module.js +23 -6
- package/dist-sdk/src/entities/field/record-shape.d.ts +24 -10
- package/dist-sdk/src/entities/field/to-tf.d.ts +40 -1
- package/dist-sdk/src/entities/field/to-tf.js +293 -35
- package/dist-sdk/src/entities/field/types.d.ts +1 -1
- package/dist-sdk/src/entities/field/types.js +7 -1
- package/dist-sdk/src/entities/file-reader/build.d.ts +5 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +1 -1
- package/dist-sdk/src/entities/org/cloud-link.js +4 -5
- package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
- package/dist-sdk/src/entities/org/email-alias.js +12 -0
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/phone-provider.js +4 -7
- package/dist-sdk/src/entities/organization/build.d.ts +214 -2
- package/dist-sdk/src/entities/organization/build.js +145 -4
- package/dist-sdk/src/entities/organization/index.d.ts +1 -1
- package/dist-sdk/src/entities/organization/index.js +1 -1
- package/dist-sdk/src/entities/organization/module.js +4 -1
- package/dist-sdk/src/entities/organization/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/organization/to-tf.js +118 -1
- package/dist-sdk/src/entities/phone-service/build.d.ts +1 -1
- package/dist-sdk/src/entities/phone-service/build.js +2 -2
- package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +5 -3
- package/dist-sdk/src/entities/phone-service/index.d.ts +1 -1
- package/dist-sdk/src/entities/phone-service/index.js +1 -1
- package/dist-sdk/src/entities/phone-service/types.js +1 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +9 -1
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +5 -13
- package/dist-sdk/src/entities/search-table/build.d.ts +4 -4
- package/dist-sdk/src/entities/search-table/build.js +13 -13
- package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
- package/dist-sdk/src/entities/search-table/index.js +2 -2
- package/dist-sdk/src/entities/search-table/printer.js +5 -5
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +21 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +32 -1
- package/dist-sdk/src/entities/shared/context.d.ts +25 -24
- package/dist-sdk/src/entities/shared/context.js +36 -35
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +10 -3
- package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -1
- package/dist-sdk/src/entities/shared/filters/index.js +11 -4
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
- package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
- package/dist-sdk/src/entities/shared/ref.js +8 -3
- package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
- package/dist-sdk/src/entities/skill/build.d.ts +2 -2
- package/dist-sdk/src/entities/skill/build.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +26 -7
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/module.js +2 -2
- package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/skill/to-tf.js +2 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +4 -3
- package/dist-sdk/src/entities/skill/tools.js +4 -3
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +42 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -6
- package/dist-sdk/src/entities/table/build.d.ts +1 -1
- package/dist-sdk/src/entities/table/build.js +9 -9
- package/dist-sdk/src/entities/table/catalog-render.js +9 -1
- package/dist-sdk/src/entities/table/deserializer/normalize.js +4 -4
- package/dist-sdk/src/entities/table/fields/types.d.ts +1 -1
- package/dist-sdk/src/entities/table/fields/types.js +1 -1
- package/dist-sdk/src/entities/table/index.d.ts +2 -2
- package/dist-sdk/src/entities/table/index.js +3 -3
- package/dist-sdk/src/entities/table/module.js +1 -1
- package/dist-sdk/src/entities/table/to-tf.js +22 -30
- package/dist-sdk/src/entities/task/build.d.ts +1 -1
- package/dist-sdk/src/entities/task/build.js +5 -5
- package/dist-sdk/src/entities/task/index.d.ts +1 -1
- package/dist-sdk/src/entities/task/index.js +1 -1
- package/dist-sdk/src/entities/view/build.d.ts +46 -0
- package/dist-sdk/src/entities/view/build.js +19 -0
- package/dist-sdk/src/entities/view/from-tf.js +68 -18
- package/dist-sdk/src/entities/view/module.d.ts +6 -13
- package/dist-sdk/src/entities/view/module.js +7 -14
- package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
- package/dist-sdk/src/entities/view/sharing.js +6 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +21 -19
- package/dist-sdk/src/entities/view/to-tf.js +61 -26
- package/dist-sdk/src/entities/view/types.js +3 -0
- package/dist-sdk/src/entities/visual-flow/build.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/build.js +8 -8
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/module.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +3 -3
- package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +3 -7
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +9 -7
- package/dist-sdk/src/graph/index.d.ts +5 -1
- package/dist-sdk/src/graph/index.js +4 -1
- package/dist-sdk/src/graph/modules.js +6 -1
- package/dist-sdk/src/graph/types.d.ts +52 -1
- package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
- package/dist-sdk/src/internal/safe-identifier.js +13 -0
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +12 -3
|
@@ -1,8 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public field-component keys are listed exhaustively against the authoring
|
|
3
|
+
* variant map. Adding a field component there without adding it here is a
|
|
4
|
+
* compile-time error instead of silently falling through generic snake-case
|
|
5
|
+
* serialization.
|
|
6
|
+
*/
|
|
7
|
+
const DYNAMIC_LAYOUT_FIELD_COMPONENT_PUBLIC_KEYS = {
|
|
8
|
+
textField: true,
|
|
9
|
+
numberField: true,
|
|
10
|
+
decimalField: true,
|
|
11
|
+
dateField: true,
|
|
12
|
+
datetimeField: true,
|
|
13
|
+
booleanField: true,
|
|
14
|
+
picklistField: true,
|
|
15
|
+
multiPicklistField: true,
|
|
16
|
+
richTextField: true,
|
|
17
|
+
attachmentField: true,
|
|
18
|
+
groupField: true,
|
|
19
|
+
jsonField: true,
|
|
20
|
+
qrCodeField: true,
|
|
21
|
+
userField: true,
|
|
22
|
+
calculationField: true,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Public TypeScript key -> pre-snake-case provider/exporter key exceptions.
|
|
26
|
+
* Authored and pulled TypeScript says `richTextField`; the stable HCL dialect
|
|
27
|
+
* remains `html_field`.
|
|
28
|
+
*/
|
|
29
|
+
const DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_OVERRIDES = {
|
|
30
|
+
richTextField: "htmlField",
|
|
31
|
+
};
|
|
32
|
+
const dynamicLayoutFieldComponentKeys = Object.keys(DYNAMIC_LAYOUT_FIELD_COMPONENT_PUBLIC_KEYS);
|
|
33
|
+
export const DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY = new Map(dynamicLayoutFieldComponentKeys.map((key) => [
|
|
34
|
+
key,
|
|
35
|
+
DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_OVERRIDES[key] ?? key,
|
|
36
|
+
]));
|
|
37
|
+
export const DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS = new Set(dynamicLayoutFieldComponentKeys);
|
|
38
|
+
export function dynamicLayoutFieldComponentWireKey(publicKey) {
|
|
39
|
+
const wireKey = DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY.get(publicKey);
|
|
40
|
+
if (wireKey === undefined)
|
|
41
|
+
throw new Error(`unknown dynamic-layout field component key: ${publicKey}`);
|
|
42
|
+
return wireKey;
|
|
43
|
+
}
|
|
6
44
|
export const DYNAMIC_LAYOUT_COMPARISON_KEYS = new Set([
|
|
7
45
|
"equals", "notEquals", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual",
|
|
8
46
|
"contains", "notContains", "in", "notIn", "empty", "notEmpty",
|
|
@@ -2,7 +2,7 @@ import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../
|
|
|
2
2
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
3
3
|
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
4
4
|
import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
|
|
5
|
-
import { DYNAMIC_LAYOUT_COMPARISON_KEYS,
|
|
5
|
+
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY, } from "./dialect.js";
|
|
6
6
|
const KNOWN_ATTRS = new Set([
|
|
7
7
|
"app_id", "stage_id", "name", "description", "active", "document_id", "document_version",
|
|
8
8
|
"root_component", "components", "conditions", "save_groups", "field_validations", "dependencies",
|
|
@@ -70,12 +70,18 @@ function componentMap(values, owner, ctx, where) {
|
|
|
70
70
|
const out = {};
|
|
71
71
|
for (const [id, raw] of Object.entries(values)) {
|
|
72
72
|
const component = camelObject(plainObject(raw) ?? {});
|
|
73
|
-
for (const
|
|
74
|
-
const field = plainUnknownObject(component[
|
|
75
|
-
if (field === undefined
|
|
73
|
+
for (const [publicKey, wireKey] of DYNAMIC_LAYOUT_FIELD_COMPONENT_WIRE_KEY_BY_PUBLIC_KEY) {
|
|
74
|
+
const field = plainUnknownObject(component[wireKey]);
|
|
75
|
+
if (field === undefined)
|
|
76
76
|
continue;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (field["fieldId"] !== undefined) {
|
|
78
|
+
field["field"] = fieldKey(field["fieldId"], owner, ctx, `${where}.components.${id}.${publicKey}`);
|
|
79
|
+
delete field["fieldId"];
|
|
80
|
+
}
|
|
81
|
+
if (publicKey !== wireKey) {
|
|
82
|
+
component[publicKey] = field;
|
|
83
|
+
delete component[wireKey];
|
|
84
|
+
}
|
|
79
85
|
}
|
|
80
86
|
const update = plainUnknownObject(component["updateBlock"]);
|
|
81
87
|
if (update !== undefined && Array.isArray(update["fieldIds"])) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
3
|
+
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
3
4
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
4
5
|
import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "../view/types.js";
|
|
5
6
|
import { DYNAMIC_LAYOUT_RESOURCE_TYPE } from "./module.js";
|
|
6
|
-
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS } from "./dialect.js";
|
|
7
|
+
import { DYNAMIC_LAYOUT_COMPARISON_KEYS, DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS, dynamicLayoutFieldComponentWireKey, } from "./dialect.js";
|
|
7
8
|
export function dynamicLayoutsToTf(layouts, opts) {
|
|
8
9
|
const blocks = [];
|
|
9
10
|
for (const [key, layout] of Object.entries(layouts ?? {})) {
|
|
@@ -56,8 +57,12 @@ function componentMap(components, where, opts) {
|
|
|
56
57
|
for (const [key, value] of Object.entries(component)) {
|
|
57
58
|
if (value === undefined)
|
|
58
59
|
continue;
|
|
59
|
-
if (
|
|
60
|
-
|
|
60
|
+
if (key === "htmlField") {
|
|
61
|
+
opts.diagnostics.push(`${where}.components[${JSON.stringify(componentId)}].htmlField: legacy component key is not supported; use richTextField; dropped`);
|
|
62
|
+
}
|
|
63
|
+
else if (DYNAMIC_LAYOUT_FIELD_COMPONENT_KEYS.has(key)) {
|
|
64
|
+
const wireKey = dynamicLayoutFieldComponentWireKey(key);
|
|
65
|
+
attrs[snakeKey(wireKey)] = fieldComponent(value, `${where}.components[${JSON.stringify(componentId)}].${key}`, opts);
|
|
61
66
|
}
|
|
62
67
|
else if (key === "updateBlock") {
|
|
63
68
|
const rec = object(value);
|
|
@@ -237,12 +242,7 @@ function resolveAspect(token, where, opts) {
|
|
|
237
242
|
opts.diagnostics.push(`${where}: target aspect has no name/refName; dropped`);
|
|
238
243
|
return undefined;
|
|
239
244
|
}
|
|
240
|
-
|
|
241
|
-
if (kind === "element")
|
|
242
|
-
opts.orgRefs.foreignElement(label, name);
|
|
243
|
-
else
|
|
244
|
-
opts.orgRefs.foreignApp(label, name);
|
|
245
|
-
return expr.dataAttr(kind === "app" ? "elementum_app" : "elementum_element", label, ["id"]);
|
|
245
|
+
return resolveForeignRef(kind, { name, namespace: token?.namespace }, opts.orgRefs, opts.diagnostics, where).value;
|
|
246
246
|
}
|
|
247
247
|
function snakeObject(value, where, opts) {
|
|
248
248
|
const out = {};
|
|
@@ -1,35 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* v2 element authoring — `defineElement`.
|
|
3
|
-
*
|
|
4
|
-
* Elements are not apps — they're a dedicated entity kind with their own
|
|
5
|
-
* builder/printer — but a pulled real-world element proved they carry nearly
|
|
6
|
-
* every authoring slot an app does (category icon/color, namespace,
|
|
7
|
-
* description, cloud options, display blocks). The one genuinely new
|
|
8
|
-
* concept is a **linked** element's cloud mapping: a Cloud Link + Database +
|
|
9
|
-
* Schema + Table pointing at an existing table in the customer's cloud
|
|
10
|
-
* database, vs. a **standard** element (no `cloudConnection`), whose table
|
|
11
|
-
* Elementum manages — a shape `defineApp` has no slot for. Reusing `defineApp`
|
|
12
|
-
* for elements is why that data was silently dropped on pull.
|
|
13
|
-
*
|
|
14
|
-
* Produces a `DeployableEntity` of kind `element` with `parent: "org"` (elements are
|
|
15
|
-
* org-owned, like apps). The payload is the same compose-body shape
|
|
16
|
-
* `defineApp({ type: "ELEMENT" })` produced before this split — fields are
|
|
17
|
-
* authored inline; the cloud link is a `CatalogRef` token resolved at deploy.
|
|
18
|
-
* Deployed via the same wire client compose path apps use.
|
|
19
|
-
*
|
|
20
|
-
* Field/category serialization is genuinely shared with apps and elements, so this imports `serializeField`
|
|
21
|
-
* and its types directly from `src/aspects/build.ts` rather than duplicating
|
|
22
|
-
* them.
|
|
23
|
-
*/
|
|
24
1
|
import { type AppOrElementRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
|
|
25
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
26
3
|
import type { AccessPolicyOptions } from "../access-policy/build.js";
|
|
27
|
-
import type
|
|
4
|
+
import { type AppCalendarView, type AppCategory, type AppCloudOptions, type AppDashboard, type AppDashboardView, type AppField, type AppFieldRefs, type AppKanbanView, type AppLayout, type AppListView, type AppRecordCreateForm, type AppSystemFieldOverride } from "../app/build.js";
|
|
28
5
|
import { type DisplayBlock } from "../app/display-blocks.js";
|
|
29
|
-
import { type AppCategory, type AppCloudOptions, type AppField, type AppFieldRefs, type AppLayout, type AppCalendarView, type AppDashboard, type AppDashboardView, type AppKanbanView, type AppListView, type AppRecordCreateForm, type AppSystemFieldOverride } from "../app/build.js";
|
|
30
|
-
export type { AppCalendarView, AppCategory, AppDashboard, AppDashboardView, AppField, AppKanbanView, AppLayout, AppListView, AppRecordCreateForm, AppRecordCreateFormSection, AppSystemFieldOverride, PicklistOption, } from "../app/build.js";
|
|
31
6
|
import type { AppRelationship } from "../relationship/build.js";
|
|
7
|
+
import type { AppRole } from "../role/build.js";
|
|
32
8
|
import type { AppWidget } from "../widget/build.js";
|
|
9
|
+
export type { AppCalendarView, AppCategory, AppDashboard, AppDashboardView, AppField, AppKanbanView, AppLayout, AppListView, AppRecordCreateForm, AppRecordCreateFormSection, AppSystemFieldOverride, PicklistOption } from "../app/build.js";
|
|
10
|
+
export type { AppRelationship, AppRelationshipColumn } from "../relationship/build.js";
|
|
11
|
+
export type { AppWidget, CreateRecordWidget, LinkRecordsWidget, RelatedRecordsWidget, RunAutomationWidget, RunAutomationWidgetParameter, WidgetButtonStyle, WidgetButtonType } from "../widget/build.js";
|
|
33
12
|
/** The system fields elements actually have (per `locals.ts`) — unlike apps, no status/stage/audit fields. */
|
|
34
13
|
export type ElementSystemFieldKey = "id" | "title";
|
|
35
14
|
export declare const ELEMENT_SYSTEM_FIELD_KEYS: readonly ElementSystemFieldKey[];
|
|
@@ -38,8 +17,6 @@ export interface ElementSystemFields {
|
|
|
38
17
|
readonly id?: AppSystemFieldOverride;
|
|
39
18
|
readonly title?: AppSystemFieldOverride;
|
|
40
19
|
}
|
|
41
|
-
export type { AppWidget, CreateRecordWidget, LinkRecordsWidget, RelatedRecordsWidget, RunAutomationWidget, RunAutomationWidgetParameter, WidgetButtonStyle, WidgetButtonType } from "../widget/build.js";
|
|
42
|
-
export type { AppRelationship, AppRelationshipColumn } from "../relationship/build.js";
|
|
43
20
|
/**
|
|
44
21
|
* The source table a LINKED element maps to — an existing table in the
|
|
45
22
|
* customer's cloud database, vs. a STANDARD element (no `cloudConnection`),
|
|
@@ -126,6 +103,22 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
|
|
|
126
103
|
/** Custom roles keyed by stable authoring name. */
|
|
127
104
|
readonly roles?: Readonly<Record<string, AppRole>>;
|
|
128
105
|
}
|
|
106
|
+
/** `id`/`title`'s platform field type — `id` is `HANDLE`, `title` is `TEXT`, same as an app's (`SYSTEM_FIELD_TAG_TO_TYPE`). */
|
|
107
|
+
type ElementSystemFieldTypeByKey = {
|
|
108
|
+
readonly id: "HANDLE";
|
|
109
|
+
readonly title: "TEXT";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Per-element-system-field `FieldRef`s, each carrying its own literal
|
|
113
|
+
* `fieldType` — a plain `Record<ElementSystemFieldKey, FieldRef<RefName>>`
|
|
114
|
+
* would leave `FieldType` on its `string` default (only `Parent` gets filled
|
|
115
|
+
* positionally), collapsing `RecordShape`'s `id`/`title` values to the
|
|
116
|
+
* generic `"text"` case (see `SystemFieldRefs` in `entities/app/build.ts`,
|
|
117
|
+
* the identical fix for an app's fuller system-field set).
|
|
118
|
+
*/
|
|
119
|
+
type ElementSystemFieldRefs<Parent extends string = string> = {
|
|
120
|
+
readonly [K in ElementSystemFieldKey]: FieldRef<Parent, K, ElementSystemFieldTypeByKey[K]>;
|
|
121
|
+
};
|
|
129
122
|
/**
|
|
130
123
|
* An element's reference surface: identity plus its fields (the only bag
|
|
131
124
|
* other entities may point at). Generic over the authored `fields:` bag
|
|
@@ -133,17 +126,17 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
|
|
|
133
126
|
* `entities/app/build.ts` for the full rationale, including why `R`'s
|
|
134
127
|
* default is `Record<never, never>` rather than a wide `Record<string,
|
|
135
128
|
* FieldRef>` (a `string`-keyed index signature anywhere here poisons
|
|
136
|
-
* `DeepRef`'s downstream re-mapping for `ctx.trigger.record`/`ctx.
|
|
129
|
+
* `DeepRef`'s downstream re-mapping for `ctx.trigger.record`/`ctx.actions.<t>.
|
|
137
130
|
* record`). `id`/`title` round out the bag the same way `AppRef` folds in
|
|
138
131
|
* its full `SystemFieldKey` set — a finite, closed term, not a wide index.
|
|
139
132
|
*/
|
|
140
133
|
export type ElementRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string> = Extract<AppOrElementRef<RefName>, {
|
|
141
134
|
readonly __kind: "element";
|
|
142
135
|
}> & {
|
|
143
|
-
readonly fields: AppFieldRefs<F, RefName> &
|
|
136
|
+
readonly fields: AppFieldRefs<F, RefName> & ElementSystemFieldRefs<RefName> & R;
|
|
144
137
|
};
|
|
145
138
|
/**
|
|
146
|
-
* The configured result of `
|
|
139
|
+
* The configured result of `element` — its reference surface (`ref()`)
|
|
147
140
|
* and its deployable entity (`def()`). Both take `refName` as a **call-time
|
|
148
141
|
* argument**, not a constructor option — see `AppConfigured` in
|
|
149
142
|
* `src/aspects/build.ts` for the full rationale (identical here).
|
|
@@ -153,4 +146,4 @@ export interface ElementConfigured<F extends Record<string, AppField> = Record<s
|
|
|
153
146
|
def(refName: string): DeployableEntity;
|
|
154
147
|
}
|
|
155
148
|
/** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
|
|
156
|
-
export declare function
|
|
149
|
+
export declare function element<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>>(opts: ElementV2Options<F, R>): ElementConfigured<F, R>;
|
|
@@ -1,33 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* v2 element authoring — `defineElement`.
|
|
3
|
-
*
|
|
4
|
-
* Elements are not apps — they're a dedicated entity kind with their own
|
|
5
|
-
* builder/printer — but a pulled real-world element proved they carry nearly
|
|
6
|
-
* every authoring slot an app does (category icon/color, namespace,
|
|
7
|
-
* description, cloud options, display blocks). The one genuinely new
|
|
8
|
-
* concept is a **linked** element's cloud mapping: a Cloud Link + Database +
|
|
9
|
-
* Schema + Table pointing at an existing table in the customer's cloud
|
|
10
|
-
* database, vs. a **standard** element (no `cloudConnection`), whose table
|
|
11
|
-
* Elementum manages — a shape `defineApp` has no slot for. Reusing `defineApp`
|
|
12
|
-
* for elements is why that data was silently dropped on pull.
|
|
13
|
-
*
|
|
14
|
-
* Produces a `DeployableEntity` of kind `element` with `parent: "org"` (elements are
|
|
15
|
-
* org-owned, like apps). The payload is the same compose-body shape
|
|
16
|
-
* `defineApp({ type: "ELEMENT" })` produced before this split — fields are
|
|
17
|
-
* authored inline; the cloud link is a `CatalogRef` token resolved at deploy.
|
|
18
|
-
* Deployed via the same wire client compose path apps use.
|
|
19
|
-
*
|
|
20
|
-
* Field/category serialization is genuinely shared with apps and elements, so this imports `serializeField`
|
|
21
|
-
* and its types directly from `src/aspects/build.ts` rather than duplicating
|
|
22
|
-
* them.
|
|
23
|
-
*/
|
|
24
1
|
import { slimTokens } from "../../catalog/index.js";
|
|
25
2
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY } from "../../core/system-fields.js";
|
|
26
|
-
import { serializeDisplayBlocks } from "../app/display-blocks.js";
|
|
27
3
|
import { assertNoSystemKeyCollision, picklistOptionLabels, serializeField, } from "../app/build.js";
|
|
4
|
+
import { serializeDisplayBlocks } from "../app/display-blocks.js";
|
|
28
5
|
export const ELEMENT_SYSTEM_FIELD_KEYS = ["id", "title"];
|
|
29
6
|
/**
|
|
30
|
-
* Client-side validation for `
|
|
7
|
+
* Client-side validation for `element` — the authoring-time home for
|
|
31
8
|
* element validation rules, so a malformed definition fails at define time
|
|
32
9
|
* rather than as an opaque platform error during apply.
|
|
33
10
|
*
|
|
@@ -38,10 +15,10 @@ export const ELEMENT_SYSTEM_FIELD_KEYS = ["id", "title"];
|
|
|
38
15
|
*/
|
|
39
16
|
function validateElementOptions(opts) {
|
|
40
17
|
if (opts.handle !== undefined && !/^[A-Za-z]+$/.test(opts.handle)) {
|
|
41
|
-
throw new Error(`
|
|
18
|
+
throw new Error(`element "${opts.name}": handle "${opts.handle}" must be letters only (A–Z or a–z).`);
|
|
42
19
|
}
|
|
43
20
|
if (opts.namespace !== undefined && !/^[a-z]+$/.test(opts.namespace)) {
|
|
44
|
-
throw new Error(`
|
|
21
|
+
throw new Error(`element "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
|
|
45
22
|
}
|
|
46
23
|
}
|
|
47
24
|
/** Serialize authored `systemFields` overrides into compose entries — mirrors `serializeSystemFields` in `app/build.ts`, scoped to id/title (no picklist branch needed). */
|
|
@@ -62,15 +39,15 @@ function serializeElementSystemFields(overrides) {
|
|
|
62
39
|
});
|
|
63
40
|
}
|
|
64
41
|
/** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
|
|
65
|
-
export function
|
|
42
|
+
export function element(opts) {
|
|
66
43
|
validateElementOptions(opts);
|
|
67
44
|
const fieldEntries = Object.values(opts.fields);
|
|
68
45
|
if (fieldEntries.length === 0) {
|
|
69
|
-
throw new Error(`
|
|
46
|
+
throw new Error(`element "${opts.name}" requires at least one field.`);
|
|
70
47
|
}
|
|
71
48
|
return {
|
|
72
49
|
ref(refName) {
|
|
73
|
-
// See `
|
|
50
|
+
// See `app`'s `ref()` for why `handle` here is the bag key —
|
|
74
51
|
// `def()` carries it as `serializeField`'s internal `__refName` marker so
|
|
75
52
|
// `applyV2`'s field reconciliation can match this field by bag key
|
|
76
53
|
// instead of `name`, which would otherwise break on a rename.
|
|
@@ -109,10 +86,16 @@ export function defineElement(opts) {
|
|
|
109
86
|
tags: [tag],
|
|
110
87
|
};
|
|
111
88
|
}
|
|
112
|
-
return {
|
|
89
|
+
return {
|
|
90
|
+
__kind: "element",
|
|
91
|
+
refName: refName,
|
|
92
|
+
name: opts.name,
|
|
93
|
+
...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
|
|
94
|
+
fields,
|
|
95
|
+
};
|
|
113
96
|
},
|
|
114
97
|
def(refName) {
|
|
115
|
-
assertNoSystemKeyCollision("
|
|
98
|
+
assertNoSystemKeyCollision("element", opts.name, opts.fields, opts.systemFields);
|
|
116
99
|
const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
|
|
117
100
|
const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
|
|
118
101
|
const payload = {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* v2 element authoring — `
|
|
2
|
+
* v2 element authoring — `element`. Org-owned; deploys via the same
|
|
3
3
|
* wire client compose path apps use. Elements are not apps — see
|
|
4
4
|
* `src/elements/build.ts`'s header for why this is a dedicated module rather
|
|
5
|
-
* than folding into `src/aspects/` (which still owns `
|
|
5
|
+
* than folding into `src/aspects/` (which still owns `app` and the
|
|
6
6
|
* field/print internals genuinely shared between both aspect kinds).
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
8
|
+
export { element, type ElementCloudConnection, type ElementConfigured, type ElementRef, type ElementV2Options, } from "./build.js";
|
|
9
9
|
export { type AppRecordCreateForm, type AppRecordCreateFormSection } from "../app/build.js";
|
|
10
|
+
export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, type ListViewDensity, type ManagedViewSort, type ManagedViewSortAggregation, type ManagedViewSortDirection, type ManagedViewSortField, type ManagedViewSortOrder, } from "../view/build.js";
|
|
10
11
|
export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
|
|
11
|
-
export { type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize } from "../dashboard/build.js";
|
|
12
|
-
export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField,
|
|
12
|
+
export { dashboardRecordsWidget, dashboardWidgetSize, type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize, } from "../dashboard/build.js";
|
|
13
|
+
export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, groupField, jsonField, multiPicklistField, numberField, picklistField, relationField, richTextField, textField, userField, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type NumericFieldFormat, type NumericFieldOptions, type PicklistFieldOptions, type RelationFieldOptions, type QrFieldFormat, type TextFieldOptions, } from "../field/build.js";
|
|
14
|
+
export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, type ConcatExprType, type DateDifUnit, type DateTimeTruncPrecision, type Expr, type ExprType, type FieldRefExprType, type OrderByDirection, type Predicate, type PredicateOp, type StringAggOptions, type StringAggOrderBy, type WeekdayMode, } from "../field/calc.js";
|
|
13
15
|
export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
|
|
14
16
|
export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
|
|
15
17
|
export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* v2 element authoring — `
|
|
2
|
+
* v2 element authoring — `element`. Org-owned; deploys via the same
|
|
3
3
|
* wire client compose path apps use. Elements are not apps — see
|
|
4
4
|
* `src/elements/build.ts`'s header for why this is a dedicated module rather
|
|
5
|
-
* than folding into `src/aspects/` (which still owns `
|
|
5
|
+
* than folding into `src/aspects/` (which still owns `app` and the
|
|
6
6
|
* field/print internals genuinely shared between both aspect kinds).
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { element, } from "./build.js";
|
|
9
|
+
export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, } from "../view/build.js";
|
|
10
|
+
export { dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
|
|
11
|
+
export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, groupField, jsonField, multiPicklistField, numberField, picklistField, relationField, richTextField, textField, userField, } from "../field/build.js";
|
|
12
|
+
export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, } from "../field/calc.js";
|
|
10
13
|
export { groupId, userId } from "../access-policy/build.js";
|
|
11
14
|
export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
|
|
12
15
|
export { serviceAccountRef } from "../service-account/ref.js";
|
|
@@ -57,7 +57,7 @@ export const elementModule = {
|
|
|
57
57
|
resource: { shape: "single", resourceType: ELEMENT_RESOURCE_TYPE, adoptable: true },
|
|
58
58
|
// Foreign/referenced elements: `data.elementum_element` stubs (apps export
|
|
59
59
|
// --recursive=false) and build-time lookups share this facet.
|
|
60
|
-
data: { participates: true, lookupAttr: "name", referencedByBuild: true },
|
|
60
|
+
data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
|
|
61
61
|
canvas: { participates: true, label: "Elements", glyph: "▦", component: "appDetail" },
|
|
62
62
|
lifecycle: {
|
|
63
63
|
participates: true,
|
|
@@ -70,12 +70,16 @@ export const elementModule = {
|
|
|
70
70
|
diagnostics: ctx.diagnostics,
|
|
71
71
|
workspaceAspects: ctx.workspaceAspects,
|
|
72
72
|
});
|
|
73
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
blocks: result.blocks,
|
|
75
|
+
fieldAddresses: result.fieldAddresses,
|
|
76
|
+
fieldNames: result.fieldNames,
|
|
77
|
+
};
|
|
74
78
|
},
|
|
75
79
|
appendLocals: (localsAttrs, ctx) => {
|
|
76
80
|
appendElementLocals(localsAttrs, ctx.appTfLabel);
|
|
77
81
|
if (ctx.fieldAddresses !== undefined) {
|
|
78
|
-
appendFieldLocals(localsAttrs, ctx.fieldAddresses);
|
|
82
|
+
appendFieldLocals(localsAttrs, ctx.fieldAddresses, ctx.blocks);
|
|
79
83
|
}
|
|
80
84
|
},
|
|
81
85
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Element emission: `
|
|
2
|
+
* Element emission: `element` DeployableEntity → `elementum_element` +
|
|
3
3
|
* field resources in ei's dialect. No status_options/stages (apps always
|
|
4
4
|
* emit those; element captures do not).
|
|
5
5
|
*/
|
|
@@ -9,6 +9,7 @@ import { type TfBlock } from "../../engine/tf/index.js";
|
|
|
9
9
|
export interface ElementToTfResult {
|
|
10
10
|
readonly blocks: readonly TfBlock[];
|
|
11
11
|
readonly fieldAddresses: ReadonlyMap<string, string>;
|
|
12
|
+
readonly fieldNames: ReadonlyMap<string, string>;
|
|
12
13
|
}
|
|
13
14
|
/** `elementum_element` + one field resource per custom field. */
|
|
14
15
|
export declare function elementToTf(entity: DeployableEntity, ctx: ToTfContext): ElementToTfResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Element emission: `
|
|
2
|
+
* Element emission: `element` DeployableEntity → `elementum_element` +
|
|
3
3
|
* field resources in ei's dialect. No status_options/stages (apps always
|
|
4
4
|
* emit those; element captures do not).
|
|
5
5
|
*/
|
|
6
6
|
import { EntityTfError } from "../../engine/entity.js";
|
|
7
|
-
import { expr } from "../../engine/tf/index.js";
|
|
7
|
+
import { expr, snakeSlug } from "../../engine/tf/index.js";
|
|
8
8
|
import { accessPolicyToTf } from "../access-policy/to-tf.js";
|
|
9
9
|
import { dashboardsToTf } from "../dashboard/to-tf.js";
|
|
10
10
|
import { fieldToTf } from "../field/to-tf.js";
|
|
@@ -102,6 +102,7 @@ export function elementToTf(entity, ctx) {
|
|
|
102
102
|
}
|
|
103
103
|
const blocks = [];
|
|
104
104
|
const fieldAddresses = new Map();
|
|
105
|
+
const fieldNames = new Map();
|
|
105
106
|
const objectId = expr.resourceAttr(ELEMENT_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
|
|
106
107
|
for (const fieldEntry of payload.fields ?? []) {
|
|
107
108
|
const typeKey = Object.keys(fieldEntry)[0];
|
|
@@ -109,6 +110,9 @@ export function elementToTf(entity, ctx) {
|
|
|
109
110
|
continue;
|
|
110
111
|
const inner = fieldEntry[typeKey];
|
|
111
112
|
const name = inner.name ?? "";
|
|
113
|
+
const fieldKey = inner.__refName ?? snakeSlug(name);
|
|
114
|
+
if (fieldKey !== "" && name !== "")
|
|
115
|
+
fieldNames.set(fieldKey, name);
|
|
112
116
|
const systemTag = inner.tags?.find((tag) => SYSTEM_FIELD_TAGS.has(tag));
|
|
113
117
|
if (systemTag !== undefined) {
|
|
114
118
|
switch (systemTag) {
|
|
@@ -226,5 +230,5 @@ export function elementToTf(entity, ctx) {
|
|
|
226
230
|
label: ctx.appTfLabel,
|
|
227
231
|
attrs: elementAttrs,
|
|
228
232
|
});
|
|
229
|
-
return { blocks, fieldAddresses };
|
|
233
|
+
return { blocks, fieldAddresses, fieldNames };
|
|
230
234
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Typed field factories — the authoring surface for `
|
|
3
|
-
* `
|
|
2
|
+
* Typed field factories — the authoring surface for `app`'s (and
|
|
3
|
+
* `element`'s) `fields:` bag. One factory per field sub-type row
|
|
4
4
|
* (types.ts), each taking only the options valid for its kind:
|
|
5
5
|
*
|
|
6
6
|
* fields: {
|
|
@@ -16,8 +16,13 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { AppField, AppPicklistConfig, PicklistOption } from "../app/build.js";
|
|
18
18
|
import type { AppOrElementRef, FieldRef } from "../../catalog/index.js";
|
|
19
|
-
import type { Expr, ExprType } from "./calc/types.js";
|
|
19
|
+
import type { AppFieldOfExprType, CalculationInclude, Expr, ExprContext, ExprType, ExprTypeOf, FieldRefOfExprType } from "./calc/types.js";
|
|
20
20
|
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
21
|
+
import type { AspectFieldQrFormat, AspectNumericFieldFormat } from "../../../elementum-entity-client/clients/aspects/models/format.js";
|
|
22
|
+
/** Statically typed display options for NUMBER and DECIMAL fields. */
|
|
23
|
+
export type NumericFieldFormat = AspectNumericFieldFormat;
|
|
24
|
+
/** Statically typed QR display options for text fields. */
|
|
25
|
+
export type QrFieldFormat = AspectFieldQrFormat;
|
|
21
26
|
/** Options every field kind accepts (everything on {@link AppField} that isn't kind-specific). */
|
|
22
27
|
export interface BaseFieldOptions {
|
|
23
28
|
readonly name: string;
|
|
@@ -30,13 +35,12 @@ export interface BaseFieldOptions {
|
|
|
30
35
|
readonly defaultValue?: unknown;
|
|
31
36
|
/** Platform semantic role tags for system fields (e.g. `["STATUS"]`). */
|
|
32
37
|
readonly tags?: readonly string[];
|
|
33
|
-
/**
|
|
34
|
-
* A calculated-field expression (from the `calc.*` builder). When set, the
|
|
35
|
-
* field serializes as a calculated field; the factory's kind is the
|
|
36
|
-
* declared output type.
|
|
37
|
-
*/
|
|
38
|
-
readonly expression?: Expr<ExprType>;
|
|
39
38
|
}
|
|
39
|
+
type ScalarExpression<T extends ExprType> = Expr<T, "single", ExprContext>;
|
|
40
|
+
type WithExpression<T extends ExprType> = {
|
|
41
|
+
/** @deprecated Prefer `calculatedField({ name, expression })` for calculated values. */
|
|
42
|
+
readonly expression?: ScalarExpression<T>;
|
|
43
|
+
};
|
|
40
44
|
/** Extra options for the picklist kinds (`picklistField` / `multiPicklistField`). */
|
|
41
45
|
export interface PicklistFieldOptions extends BaseFieldOptions {
|
|
42
46
|
/** Static options; omit for dynamic picklists (`config.dynamic`). */
|
|
@@ -44,16 +48,22 @@ export interface PicklistFieldOptions extends BaseFieldOptions {
|
|
|
44
48
|
/** Parent picklist for a dependent dropdown. */
|
|
45
49
|
readonly parentField?: FieldRef;
|
|
46
50
|
readonly config?: AppPicklistConfig;
|
|
51
|
+
/** @deprecated Prefer `calculatedField({ name, expression })`. */
|
|
52
|
+
readonly expression?: ScalarExpression<"picklist" | "multiPicklist">;
|
|
47
53
|
}
|
|
48
54
|
/** Extra options for the numeric kinds (`numberField` / `decimalField`). */
|
|
49
55
|
export interface NumericFieldOptions extends BaseFieldOptions {
|
|
50
|
-
readonly numericFormat?:
|
|
56
|
+
readonly numericFormat?: NumericFieldFormat;
|
|
51
57
|
/** `decimalField` only — display/storage precision. */
|
|
52
58
|
readonly decimalPlaces?: number;
|
|
59
|
+
/** @deprecated Prefer `calculatedField({ name, expression })`. */
|
|
60
|
+
readonly expression?: ScalarExpression<"number" | "decimal">;
|
|
53
61
|
}
|
|
54
62
|
/** Extra options for `textField`. */
|
|
55
63
|
export interface TextFieldOptions extends BaseFieldOptions {
|
|
56
|
-
readonly qrFormat?:
|
|
64
|
+
readonly qrFormat?: QrFieldFormat;
|
|
65
|
+
/** @deprecated Prefer `calculatedField({ name, expression })`. */
|
|
66
|
+
readonly expression?: ScalarExpression<"text" | "uuid">;
|
|
57
67
|
}
|
|
58
68
|
/**
|
|
59
69
|
* Options for `relationField` — a dynamic dropdown sourced from another
|
|
@@ -74,44 +84,61 @@ export interface RelationFieldOptions extends BaseFieldOptions {
|
|
|
74
84
|
export declare function textField(opts: TextFieldOptions): AppField & {
|
|
75
85
|
readonly type: "TEXT";
|
|
76
86
|
};
|
|
77
|
-
export declare function
|
|
78
|
-
readonly type: "
|
|
87
|
+
export declare function richTextField(opts: BaseFieldOptions): AppField & {
|
|
88
|
+
readonly type: "RICH_TEXT";
|
|
79
89
|
};
|
|
80
|
-
export declare function numberField(opts: NumericFieldOptions): AppField & {
|
|
90
|
+
export declare function numberField(opts: Omit<NumericFieldOptions, "expression"> & WithExpression<"number">): AppField & {
|
|
81
91
|
readonly type: "NUMBER";
|
|
82
92
|
};
|
|
83
|
-
export declare function decimalField(opts: NumericFieldOptions): AppField & {
|
|
93
|
+
export declare function decimalField(opts: Omit<NumericFieldOptions, "expression"> & WithExpression<"decimal">): AppField & {
|
|
84
94
|
readonly type: "DECIMAL";
|
|
85
95
|
};
|
|
86
|
-
export declare function booleanField(opts: BaseFieldOptions): AppField & {
|
|
96
|
+
export declare function booleanField(opts: BaseFieldOptions & WithExpression<"bool">): AppField & {
|
|
87
97
|
readonly type: "BOOLEAN";
|
|
88
98
|
};
|
|
89
|
-
export declare function dateField(opts: BaseFieldOptions): AppField & {
|
|
99
|
+
export declare function dateField(opts: BaseFieldOptions & WithExpression<"date">): AppField & {
|
|
90
100
|
readonly type: "DATE";
|
|
91
101
|
};
|
|
92
|
-
export declare function dateTimeField(opts: BaseFieldOptions): AppField & {
|
|
102
|
+
export declare function dateTimeField(opts: BaseFieldOptions & WithExpression<"datetime">): AppField & {
|
|
93
103
|
readonly type: "DATETIME";
|
|
94
104
|
};
|
|
95
|
-
export declare function userField(opts: BaseFieldOptions): AppField & {
|
|
105
|
+
export declare function userField(opts: BaseFieldOptions & WithExpression<"user">): AppField & {
|
|
96
106
|
readonly type: "USER";
|
|
97
107
|
};
|
|
98
|
-
export declare function groupField(opts: BaseFieldOptions): AppField & {
|
|
108
|
+
export declare function groupField(opts: BaseFieldOptions & WithExpression<"group">): AppField & {
|
|
99
109
|
readonly type: "GROUP";
|
|
100
110
|
};
|
|
101
|
-
export declare function attachmentField(opts: BaseFieldOptions): AppField & {
|
|
111
|
+
export declare function attachmentField(opts: BaseFieldOptions & WithExpression<"attachment">): AppField & {
|
|
102
112
|
readonly type: "ATTACHMENT";
|
|
103
113
|
};
|
|
104
|
-
export declare function jsonField(opts: BaseFieldOptions): AppField & {
|
|
114
|
+
export declare function jsonField(opts: BaseFieldOptions & WithExpression<"json">): AppField & {
|
|
105
115
|
readonly type: "JSON";
|
|
106
116
|
};
|
|
107
|
-
export declare function picklistField(opts: PicklistFieldOptions): AppField & {
|
|
117
|
+
export declare function picklistField(opts: Omit<PicklistFieldOptions, "expression"> & WithExpression<"picklist">): AppField & {
|
|
108
118
|
readonly type: "PICKLIST";
|
|
109
119
|
};
|
|
110
|
-
export declare function multiPicklistField(opts: PicklistFieldOptions): AppField & {
|
|
120
|
+
export declare function multiPicklistField(opts: Omit<PicklistFieldOptions, "expression"> & WithExpression<"multiPicklist">): AppField & {
|
|
111
121
|
readonly type: "MULTI_PICKLIST";
|
|
112
122
|
};
|
|
113
123
|
export declare function relationField(opts: RelationFieldOptions): AppField & {
|
|
114
124
|
readonly type: "RELATION";
|
|
115
125
|
};
|
|
126
|
+
type FieldTypeForExpr<T extends ExprType> = T extends "number" ? "NUMBER" : T extends "decimal" ? "DECIMAL" : T extends "bool" ? "BOOLEAN" : T extends "date" ? "DATE" : T extends "datetime" ? "DATETIME" : T extends "handle" ? "HANDLE" : T extends "html" ? "HTML" : T extends "json" ? "JSON" : T extends "picklist" ? "PICKLIST" : T extends "multiPicklist" ? "MULTI_PICKLIST" : T extends "user" ? "USER" : T extends "group" ? "GROUP" : T extends "attachment" ? "ATTACHMENT" : "TEXT";
|
|
127
|
+
type CalculatedFieldExpression = Expr<ExprType, "single", ExprContext> | AppFieldOfExprType<ExprType> | FieldRefOfExprType<ExprType> | string | number | boolean;
|
|
128
|
+
type CalculatedFieldExprType<E extends CalculatedFieldExpression> = Extract<ExprTypeOf<E>, ExprType>;
|
|
129
|
+
export type CalculatedFieldOptions<E extends CalculatedFieldExpression> = BaseFieldOptions & {
|
|
130
|
+
readonly expression: E;
|
|
131
|
+
readonly include?: CalculationInclude;
|
|
132
|
+
readonly numericFormat?: CalculatedFieldExprType<E> extends "number" | "decimal" ? NumericFieldFormat : never;
|
|
133
|
+
readonly decimalPlaces?: CalculatedFieldExprType<E> extends "decimal" ? number : never;
|
|
134
|
+
readonly qrFormat?: CalculatedFieldExprType<E> extends "text" | "handle" ? QrFieldFormat : never;
|
|
135
|
+
};
|
|
136
|
+
export type InferredCalculatedField<E extends CalculatedFieldExpression> = AppField & {
|
|
137
|
+
readonly type: FieldTypeForExpr<CalculatedFieldExprType<E>>;
|
|
138
|
+
readonly expression: Expr<CalculatedFieldExprType<E>, "single", ExprContext>;
|
|
139
|
+
};
|
|
140
|
+
/** Create a calculated field whose platform field kind is inferred from its expression. */
|
|
141
|
+
export declare function calculatedField<const E extends CalculatedFieldExpression>(opts: CalculatedFieldOptions<E>): InferredCalculatedField<E>;
|
|
116
142
|
/** Authoring field type → its factory's exported name (the printer's emission table). */
|
|
117
143
|
export declare const FIELD_FACTORY_BY_TYPE: ReadonlyMap<string, string>;
|
|
144
|
+
export {};
|