@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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Sort directions accepted by every managed-view resource. */
|
|
2
|
+
export const managedViewSortDirection = {
|
|
3
|
+
ascending: "ASC",
|
|
4
|
+
descending: "DESC",
|
|
5
|
+
};
|
|
6
|
+
/** Optional aggregations accepted by a managed-view sort order. */
|
|
7
|
+
export const managedViewSortAggregation = {
|
|
8
|
+
average: "AVERAGE",
|
|
9
|
+
count: "COUNT",
|
|
10
|
+
maximum: "MAX",
|
|
11
|
+
minimum: "MIN",
|
|
12
|
+
sum: "SUM",
|
|
13
|
+
};
|
|
14
|
+
/** Row-density values accepted by a managed list view. */
|
|
15
|
+
export const listViewDensity = {
|
|
16
|
+
comfortable: "COMFORTABLE",
|
|
17
|
+
compact: "COMPACT",
|
|
18
|
+
standard: "STANDARD",
|
|
19
|
+
};
|
|
@@ -11,6 +11,7 @@ import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf
|
|
|
11
11
|
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
12
12
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
13
13
|
import { filterFromTf, principalList } from "../access-policy/from-tf.js";
|
|
14
|
+
import { listViewDensity, } from "./build.js";
|
|
14
15
|
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, KNOWN_AGENT_VIEW_ATTRS, KNOWN_CALENDAR_VIEW_ATTRS, KNOWN_DASHBOARD_VIEW_ATTRS, KNOWN_KANBAN_VIEW_ATTRS, KNOWN_LAYOUT_ATTRS, KNOWN_LAYOUT_SECTION_ATTRS, KNOWN_LIST_VIEW_ATTRS, KNOWN_MANAGED_VIEW_ORDER_ATTRS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, SECTION_TYPE_FROM_WIRE, SYSTEM_FIELD_KEY_BY_ID_ATTR, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
15
16
|
function viewFilter(value, owner, where) {
|
|
16
17
|
return value === undefined ? undefined : filterFromTf(value, {
|
|
@@ -100,10 +101,7 @@ function dashboardViewFromTf(block, owner, ctx) {
|
|
|
100
101
|
return undefined;
|
|
101
102
|
}
|
|
102
103
|
const scope = owner.scope ?? "app";
|
|
103
|
-
const sort =
|
|
104
|
-
if (attrs["sort"] !== undefined && sort === undefined) {
|
|
105
|
-
ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
|
|
106
|
-
}
|
|
104
|
+
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
107
105
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
108
106
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
109
107
|
const filter = viewFilter(attrs["filter"], owner, where);
|
|
@@ -160,10 +158,7 @@ function typedFieldViewFromTf(block, owner, resourceType, knownAttrs, includeAll
|
|
|
160
158
|
? fieldRefFromTf(attrs["display_by_field"], owner.label, owner.ownerTfLabel, scope, ctx)
|
|
161
159
|
: undefined;
|
|
162
160
|
const allowedFilterFields = includeAllowedFilterFields ? readFields("allowed_filter_fields") : undefined;
|
|
163
|
-
const sort =
|
|
164
|
-
if (attrs["sort"] !== undefined && sort === undefined) {
|
|
165
|
-
ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
|
|
166
|
-
}
|
|
161
|
+
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
167
162
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
168
163
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
169
164
|
const filter = viewFilter(attrs["filter"], owner, where);
|
|
@@ -199,10 +194,7 @@ function agentViewFromTf(block, owner, ctx) {
|
|
|
199
194
|
return undefined;
|
|
200
195
|
}
|
|
201
196
|
const scope = owner.scope ?? "app";
|
|
202
|
-
const sort =
|
|
203
|
-
if (attrs["sort"] !== undefined && sort === undefined) {
|
|
204
|
-
ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
|
|
205
|
-
}
|
|
197
|
+
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
206
198
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
207
199
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
208
200
|
const filter = viewFilter(attrs["filter"], owner, where);
|
|
@@ -284,6 +276,8 @@ function sectionFromTf(raw, ownerLabel, ownerTfLabel, scope, where, ctx) {
|
|
|
284
276
|
section.icon = rec["icon"];
|
|
285
277
|
if (typeof rec["color"] === "string")
|
|
286
278
|
section.color = rec["color"];
|
|
279
|
+
if (typeof rec["max_columns"] === "number")
|
|
280
|
+
section.maxColumns = rec["max_columns"];
|
|
287
281
|
const fieldIds = rec["field_ids"];
|
|
288
282
|
if (Array.isArray(fieldIds)) {
|
|
289
283
|
const fields = [];
|
|
@@ -355,27 +349,83 @@ function listViewFromTf(block, owner, ctx) {
|
|
|
355
349
|
// produced inconsistent result after apply", .sort was null but is still
|
|
356
350
|
// reported non-null) on ANY list view with either attribute set. Round-
|
|
357
351
|
// round-tripping both values avoids ever manufacturing that diff. Filters
|
|
358
|
-
//
|
|
352
|
+
// and sorts decode through their shared typed codecs.
|
|
359
353
|
const filter = viewFilter(attrs["filter"], owner, where);
|
|
360
|
-
const sort =
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
354
|
+
const sort = managedViewSortFromTf(attrs["sort"], owner, where, ctx);
|
|
355
|
+
const density = listViewDensityFromTf(attrs["density"], where, ctx);
|
|
356
|
+
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
357
|
+
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
364
358
|
return {
|
|
365
359
|
key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
|
|
366
360
|
name,
|
|
367
361
|
columns,
|
|
368
362
|
...(typeof attrs["allow_record_creation"] === "boolean" && { allowRecordCreation: attrs["allow_record_creation"] }),
|
|
369
|
-
...(
|
|
363
|
+
...(density !== undefined && { density }),
|
|
370
364
|
...(typeof attrs["rows"] === "number" && { rows: attrs["rows"] }),
|
|
371
365
|
...(filter !== undefined && { filter }),
|
|
372
366
|
...(sort !== undefined && { sort }),
|
|
367
|
+
...(userIds !== undefined && { userIds }),
|
|
368
|
+
...(groupIds !== undefined && { groupIds }),
|
|
373
369
|
};
|
|
374
370
|
}
|
|
375
371
|
/** `jsonencode({...})` → its decoded payload; undefined for any other shape. */
|
|
376
372
|
function jsonencodeValue(v) {
|
|
377
373
|
return v !== undefined && isTfExpr(v) && v.$expr === "jsonencode" ? v.value : undefined;
|
|
378
374
|
}
|
|
375
|
+
function managedViewSortFromTf(value, owner, where, ctx) {
|
|
376
|
+
if (value === undefined)
|
|
377
|
+
return undefined;
|
|
378
|
+
const decoded = jsonencodeValue(value);
|
|
379
|
+
if (decoded === undefined) {
|
|
380
|
+
ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
const sort = plainObject(decoded);
|
|
384
|
+
if (sort === undefined || Object.keys(sort).some((key) => key !== "orders") || !Array.isArray(sort["orders"])) {
|
|
385
|
+
ctx.diagnostics.push(`${where}: sort must be { orders: [...] }; dropped`);
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
const orders = [];
|
|
389
|
+
for (const [index, rawOrder] of sort["orders"].entries()) {
|
|
390
|
+
const order = plainObject(rawOrder);
|
|
391
|
+
const direction = order?.["direction"];
|
|
392
|
+
const aggregation = order?.["aggregation"];
|
|
393
|
+
if (order === undefined
|
|
394
|
+
|| Object.keys(order).some((key) => key !== "field" && key !== "aggregation" && key !== "direction")
|
|
395
|
+
|| (direction !== "ASC" && direction !== "DESC")
|
|
396
|
+
|| !isManagedViewSortAggregation(aggregation)) {
|
|
397
|
+
ctx.diagnostics.push(`${where}: sort.orders[${index}] has an invalid managed-view order; dropped sort`);
|
|
398
|
+
return undefined;
|
|
399
|
+
}
|
|
400
|
+
const rawField = order["field"];
|
|
401
|
+
const field = typeof rawField === "string"
|
|
402
|
+
? (PLATFORM_ID.test(rawField) ? rawField : undefined)
|
|
403
|
+
: fieldRefFromTf(rawField, owner.label, owner.ownerTfLabel, owner.scope ?? "app", ctx);
|
|
404
|
+
if (field === undefined) {
|
|
405
|
+
ctx.diagnostics.push(`${where}: sort.orders[${index}].field does not resolve to a field; dropped sort`);
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
408
|
+
orders.push({
|
|
409
|
+
field,
|
|
410
|
+
...(aggregation !== undefined ? { aggregation } : {}),
|
|
411
|
+
direction,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
return { orders };
|
|
415
|
+
}
|
|
416
|
+
const PLATFORM_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
417
|
+
function isManagedViewSortAggregation(value) {
|
|
418
|
+
return value === undefined || value === null || value === "AVERAGE" || value === "COUNT" || value === "MAX" || value === "MIN" || value === "SUM";
|
|
419
|
+
}
|
|
420
|
+
function listViewDensityFromTf(value, where, ctx) {
|
|
421
|
+
if (value === undefined)
|
|
422
|
+
return undefined;
|
|
423
|
+
if (value === listViewDensity.comfortable || value === listViewDensity.compact || value === listViewDensity.standard) {
|
|
424
|
+
return value;
|
|
425
|
+
}
|
|
426
|
+
ctx.diagnostics.push(`${where}: density must be COMFORTABLE, COMPACT, or STANDARD; dropped`);
|
|
427
|
+
return undefined;
|
|
428
|
+
}
|
|
379
429
|
function managedViewOrderFromTf(block, owner, keyByAddress, ctx) {
|
|
380
430
|
const label = block.label ?? "?";
|
|
381
431
|
const attrs = block.attrs;
|
|
@@ -7,18 +7,11 @@ import { type EntityKindModule } from "../../graph/types.js";
|
|
|
7
7
|
export declare const viewModule: EntityKindModule;
|
|
8
8
|
/**
|
|
9
9
|
* `elementum_managed_view_order` is a singleton per aspect with no identity
|
|
10
|
-
* of its own
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* mis-binding it. So: scoped for the build-vs-export (build does emit it, so a
|
|
17
|
-
* stream mismatch still gets caught) but NOT adoptable. Left unresolved:
|
|
18
|
-
* whether a plan/apply against an app whose view order already exists on
|
|
19
|
-
* the platform treats this as a safe no-op create or errors "already
|
|
20
|
-
* exists" — not yet verified live. Until confirmed, treat a fresh
|
|
21
|
-
* `elementum apply` on an adopted app with pre-existing list views as a real open
|
|
22
|
-
* risk, not a settled case.
|
|
10
|
+
* of its own: its import/state id is the owning app or element id. That id is
|
|
11
|
+
* therefore intentionally shared with the owner's resource at a different
|
|
12
|
+
* Terraform resource type, just like `elementum_record_create_form`.
|
|
13
|
+
* Adoption scopes identity by resource type, so both bindings can be safely
|
|
14
|
+
* imported and recognized on re-pull. Leaving this resource unadopted makes a
|
|
15
|
+
* freshly pulled workspace plan a create that would reorder the live views.
|
|
23
16
|
*/
|
|
24
17
|
export declare const managedViewOrderModule: EntityKindModule;
|
|
@@ -31,19 +31,12 @@ export const viewModule = {
|
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* `elementum_managed_view_order` is a singleton per aspect with no identity
|
|
34
|
-
* of its own
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* mis-binding it. So: scoped for the build-vs-export (build does emit it, so a
|
|
41
|
-
* stream mismatch still gets caught) but NOT adoptable. Left unresolved:
|
|
42
|
-
* whether a plan/apply against an app whose view order already exists on
|
|
43
|
-
* the platform treats this as a safe no-op create or errors "already
|
|
44
|
-
* exists" — not yet verified live. Until confirmed, treat a fresh
|
|
45
|
-
* `elementum apply` on an adopted app with pre-existing list views as a real open
|
|
46
|
-
* risk, not a settled case.
|
|
34
|
+
* of its own: its import/state id is the owning app or element id. That id is
|
|
35
|
+
* therefore intentionally shared with the owner's resource at a different
|
|
36
|
+
* Terraform resource type, just like `elementum_record_create_form`.
|
|
37
|
+
* Adoption scopes identity by resource type, so both bindings can be safely
|
|
38
|
+
* imported and recognized on re-pull. Leaving this resource unadopted makes a
|
|
39
|
+
* freshly pulled workspace plan a create that would reorder the live views.
|
|
47
40
|
*/
|
|
48
41
|
export const managedViewOrderModule = {
|
|
49
42
|
kind: "managed-view-order",
|
|
@@ -56,7 +49,7 @@ export const managedViewOrderModule = {
|
|
|
56
49
|
resource: {
|
|
57
50
|
shape: "single",
|
|
58
51
|
resourceType: MANAGED_VIEW_ORDER_RESOURCE_TYPE,
|
|
59
|
-
adoptable:
|
|
52
|
+
adoptable: true,
|
|
60
53
|
},
|
|
61
54
|
data: NO_DATA,
|
|
62
55
|
lifecycle: NO_LIFECYCLE,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed-view visibility — who can see a saved list/calendar/kanban/dashboard/
|
|
3
|
+
* agent view. Maps to HCL `user_ids` / `group_ids` on view resources (not
|
|
4
|
+
* `elementum_access_policy`, which is record-level on the owning aspect).
|
|
5
|
+
*/
|
|
6
|
+
import type { AccessPolicyGroupRef, AccessPolicyUserRef } from "../access-policy/principal.js";
|
|
7
|
+
export interface ManagedViewSharing {
|
|
8
|
+
readonly userIds?: readonly AccessPolicyUserRef[];
|
|
9
|
+
readonly groupIds?: readonly AccessPolicyGroupRef[];
|
|
10
|
+
}
|
|
@@ -11,14 +11,16 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
13
13
|
import type { Filter } from "../shared/filters/types.js";
|
|
14
|
-
import type {
|
|
14
|
+
import type { ManagedViewSharing } from "./sharing.js";
|
|
15
|
+
import type { ListViewDensity, ManagedViewSort } from "./build.js";
|
|
16
|
+
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
15
17
|
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
16
18
|
/** The authored field-ref shape post-`slimTokens`: a system key string, or a slimmed `FieldRef` token. */
|
|
17
19
|
export type ViewFieldRefWire = string | {
|
|
18
20
|
readonly __kind?: string;
|
|
19
21
|
readonly refName?: string;
|
|
20
22
|
readonly fieldType?: string;
|
|
21
|
-
};
|
|
23
|
+
} | UnsafePlatformId;
|
|
22
24
|
export interface AppLayoutSectionWire {
|
|
23
25
|
readonly type?: string;
|
|
24
26
|
readonly displayLocation?: string;
|
|
@@ -27,23 +29,23 @@ export interface AppLayoutSectionWire {
|
|
|
27
29
|
readonly name?: string;
|
|
28
30
|
readonly icon?: string;
|
|
29
31
|
readonly color?: string;
|
|
32
|
+
readonly maxColumns?: number;
|
|
30
33
|
readonly fields?: readonly ViewFieldRefWire[];
|
|
31
34
|
}
|
|
32
35
|
export interface AppLayoutWire {
|
|
33
36
|
readonly sections: readonly AppLayoutSectionWire[];
|
|
34
37
|
}
|
|
35
|
-
export interface AppListViewWire {
|
|
38
|
+
export interface AppListViewWire extends ManagedViewSharing {
|
|
36
39
|
readonly name?: string;
|
|
37
40
|
readonly columns?: readonly ViewFieldRefWire[];
|
|
38
41
|
readonly allowRecordCreation?: boolean;
|
|
39
|
-
readonly density?:
|
|
42
|
+
readonly density?: ListViewDensity;
|
|
40
43
|
readonly rows?: number;
|
|
41
44
|
/** Provider filter tree; authored field tokens resolve to deployed field IDs. */
|
|
42
45
|
readonly filter?: Filter;
|
|
43
|
-
|
|
44
|
-
readonly sort?: unknown;
|
|
46
|
+
readonly sort?: ManagedViewSort;
|
|
45
47
|
}
|
|
46
|
-
export interface AppAgentViewWire {
|
|
48
|
+
export interface AppAgentViewWire extends ManagedViewSharing {
|
|
47
49
|
readonly name?: string;
|
|
48
50
|
readonly agent?: {
|
|
49
51
|
readonly refName?: string;
|
|
@@ -51,32 +53,30 @@ export interface AppAgentViewWire {
|
|
|
51
53
|
};
|
|
52
54
|
readonly allowRecordCreation?: boolean;
|
|
53
55
|
readonly filter?: Filter;
|
|
54
|
-
readonly sort?:
|
|
55
|
-
readonly userIds?: readonly AccessPolicyUserRef[];
|
|
56
|
-
readonly groupIds?: readonly AccessPolicyGroupRef[];
|
|
56
|
+
readonly sort?: ManagedViewSort;
|
|
57
57
|
readonly displayOrder?: number;
|
|
58
58
|
}
|
|
59
|
-
export interface AppCalendarViewWire {
|
|
59
|
+
export interface AppCalendarViewWire extends ManagedViewSharing {
|
|
60
60
|
readonly name?: string;
|
|
61
61
|
readonly columns?: readonly ViewFieldRefWire[];
|
|
62
62
|
readonly displayByField?: ViewFieldRefWire;
|
|
63
63
|
readonly allowRecordCreation?: boolean;
|
|
64
64
|
readonly filter?: Filter;
|
|
65
|
-
readonly sort?:
|
|
66
|
-
readonly userIds?: readonly AccessPolicyUserRef[];
|
|
67
|
-
readonly groupIds?: readonly AccessPolicyGroupRef[];
|
|
65
|
+
readonly sort?: ManagedViewSort;
|
|
68
66
|
}
|
|
69
67
|
export interface AppKanbanViewWire extends AppCalendarViewWire {
|
|
70
68
|
readonly allowedFilterFields?: readonly ViewFieldRefWire[];
|
|
71
69
|
}
|
|
72
|
-
export interface AppDashboardViewWire {
|
|
70
|
+
export interface AppDashboardViewWire extends ManagedViewSharing {
|
|
73
71
|
readonly name?: string;
|
|
74
|
-
readonly dashboard?:
|
|
72
|
+
readonly dashboard?: {
|
|
73
|
+
readonly __kind?: string;
|
|
74
|
+
readonly refName?: string;
|
|
75
|
+
readonly parent?: string;
|
|
76
|
+
} | string;
|
|
75
77
|
readonly allowRecordCreation?: boolean;
|
|
76
78
|
readonly filter?: Filter;
|
|
77
|
-
readonly sort?:
|
|
78
|
-
readonly userIds?: readonly AccessPolicyUserRef[];
|
|
79
|
-
readonly groupIds?: readonly AccessPolicyGroupRef[];
|
|
79
|
+
readonly sort?: ManagedViewSort;
|
|
80
80
|
}
|
|
81
81
|
export interface ViewToTfOptions {
|
|
82
82
|
/** Owning authoring refName, for validating catalog-token parents. */
|
|
@@ -94,6 +94,8 @@ export interface ViewToTfOptions {
|
|
|
94
94
|
readonly aspectName: string;
|
|
95
95
|
/** The owning aspect's id reference — computed by the caller. */
|
|
96
96
|
readonly objectId: TfValue;
|
|
97
|
+
/** App stage terraform labels declared by systemFields.stage.options. */
|
|
98
|
+
readonly stageTfLabels?: ReadonlySet<string>;
|
|
97
99
|
/** Declared sibling dashboard keys, for fail-fast dashboard-view references. */
|
|
98
100
|
readonly dashboardKeys?: ReadonlySet<string>;
|
|
99
101
|
readonly orgRefs?: OrgRefLookup;
|
|
@@ -13,9 +13,18 @@ import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToT
|
|
|
13
13
|
import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
|
|
14
14
|
import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
|
|
15
15
|
import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
|
|
16
|
+
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
16
17
|
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
17
18
|
/** Elements only have `id`/`title` as real system fields (no status/stage/audit fields) — see `element/locals.ts`. */
|
|
18
19
|
const ELEMENT_SYSTEM_FIELD_KEYS = new Set(["id", "title"]);
|
|
20
|
+
function appendViewSharingAttrs(attrs, view, where, ctx) {
|
|
21
|
+
const userIds = principalListToTf(view.userIds, "elementum_user", `${where}.userIds`, ctx);
|
|
22
|
+
const groupIds = principalListToTf(view.groupIds, "elementum_group", `${where}.groupIds`, ctx);
|
|
23
|
+
if (userIds !== undefined)
|
|
24
|
+
attrs["user_ids"] = userIds;
|
|
25
|
+
if (groupIds !== undefined)
|
|
26
|
+
attrs["group_ids"] = groupIds;
|
|
27
|
+
}
|
|
19
28
|
/** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
|
|
20
29
|
export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts) {
|
|
21
30
|
const { ownerRefName, ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
|
|
@@ -26,6 +35,11 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
26
35
|
diagnostics.push(`layouts key "${stageKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
|
|
27
36
|
continue;
|
|
28
37
|
}
|
|
38
|
+
const stageTfLabel = tsLabelToTfLabel(stageKey);
|
|
39
|
+
if (opts.stageTfLabels !== undefined && !opts.stageTfLabels.has(stageTfLabel)) {
|
|
40
|
+
diagnostics.push(`layouts.${stageKey} has no matching authored stage option; dropped`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
29
43
|
blocks.push(layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics));
|
|
30
44
|
}
|
|
31
45
|
const viewAddressByKey = new Map();
|
|
@@ -35,16 +49,17 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
35
49
|
continue;
|
|
36
50
|
}
|
|
37
51
|
const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
|
|
52
|
+
const where = `listViews.${viewKey}`;
|
|
38
53
|
const attrs = {
|
|
39
54
|
aspect_id: objectId,
|
|
40
55
|
name: view.name ?? "",
|
|
41
56
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
42
|
-
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope,
|
|
57
|
+
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
|
|
43
58
|
density: view.density ?? "STANDARD",
|
|
44
59
|
rows: view.rows ?? 25,
|
|
45
60
|
};
|
|
46
61
|
if (view.filter !== undefined) {
|
|
47
|
-
attrs.filter = filterToTf(view.filter,
|
|
62
|
+
attrs.filter = filterToTf(view.filter, `${where}.filter`, {
|
|
48
63
|
ownerTfLabel,
|
|
49
64
|
scope,
|
|
50
65
|
objectId,
|
|
@@ -52,7 +67,8 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
69
|
if (view.sort !== undefined)
|
|
55
|
-
attrs.sort =
|
|
70
|
+
attrs.sort = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
|
|
71
|
+
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
56
72
|
blocks.push({ kind: "resource", type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
57
73
|
viewAddressByKey.set(viewKey, { type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel });
|
|
58
74
|
}
|
|
@@ -91,13 +107,8 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
91
107
|
if (view.filter !== undefined)
|
|
92
108
|
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
|
|
93
109
|
if (view.sort !== undefined)
|
|
94
|
-
attrs["sort"] =
|
|
95
|
-
|
|
96
|
-
const groupIds = principalListToTf(view.groupIds, "elementum_group", `${where}.groupIds`, principalCtx);
|
|
97
|
-
if (userIds !== undefined)
|
|
98
|
-
attrs["user_ids"] = userIds;
|
|
99
|
-
if (groupIds !== undefined)
|
|
100
|
-
attrs["group_ids"] = groupIds;
|
|
110
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
|
|
111
|
+
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
101
112
|
blocks.push({ kind: "resource", type: resourceType, label: tfLabel, attrs });
|
|
102
113
|
viewAddressByKey.set(viewKey, { type: resourceType, label: tfLabel });
|
|
103
114
|
}
|
|
@@ -111,7 +122,15 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
111
122
|
diagnostics.push(`dashboardViews.${viewKey} collides with another view using that key; dropped`);
|
|
112
123
|
continue;
|
|
113
124
|
}
|
|
114
|
-
|
|
125
|
+
if (typeof view.dashboard === "string") {
|
|
126
|
+
diagnostics.push(`dashboardViews.${viewKey}.dashboard must be a typed dashboard ref; dropped`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (view.dashboard?.__kind !== "dashboard" || view.dashboard.parent !== opts.ownerRefName) {
|
|
130
|
+
diagnostics.push(`dashboardViews.${viewKey}.dashboard must reference a dashboard owned by ${JSON.stringify(opts.ownerRefName)}; dropped`);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const dashboardKey = view.dashboard.refName ?? "";
|
|
115
134
|
if (!isCanonicalTsLabel(dashboardKey)) {
|
|
116
135
|
diagnostics.push(`dashboardViews.${viewKey}.dashboard is not a declared canonical dashboard key; dropped`);
|
|
117
136
|
continue;
|
|
@@ -124,19 +143,14 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
124
143
|
const attrs = {
|
|
125
144
|
aspect_id: objectId,
|
|
126
145
|
name: view.name ?? "",
|
|
127
|
-
dashboard_id: expr.resourceAttr(
|
|
146
|
+
dashboard_id: expr.resourceAttr(DASHBOARD_RESOURCE_TYPE, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(dashboardKey), scope), ["id"]),
|
|
128
147
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
129
148
|
};
|
|
130
149
|
if (view.filter !== undefined)
|
|
131
150
|
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
|
|
132
151
|
if (view.sort !== undefined)
|
|
133
|
-
attrs["sort"] =
|
|
134
|
-
|
|
135
|
-
const groupIds = principalListToTf(view.groupIds, "elementum_group", `dashboardViews.${viewKey}.groupIds`, principalCtx);
|
|
136
|
-
if (userIds !== undefined)
|
|
137
|
-
attrs["user_ids"] = userIds;
|
|
138
|
-
if (groupIds !== undefined)
|
|
139
|
-
attrs["group_ids"] = groupIds;
|
|
152
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `dashboardViews.${viewKey}.sort`, diagnostics);
|
|
153
|
+
appendViewSharingAttrs(attrs, view, `dashboardViews.${viewKey}`, principalCtx);
|
|
140
154
|
blocks.push({ kind: "resource", type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
141
155
|
viewAddressByKey.set(viewKey, { type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel });
|
|
142
156
|
}
|
|
@@ -168,13 +182,8 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
168
182
|
if (view.filter !== undefined)
|
|
169
183
|
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
|
|
170
184
|
if (view.sort !== undefined)
|
|
171
|
-
attrs["sort"] =
|
|
172
|
-
|
|
173
|
-
const groupIds = principalListToTf(view.groupIds, "elementum_group", `agentViews.${viewKey}.groupIds`, principalCtx);
|
|
174
|
-
if (userIds !== undefined)
|
|
175
|
-
attrs["user_ids"] = userIds;
|
|
176
|
-
if (groupIds !== undefined)
|
|
177
|
-
attrs["group_ids"] = groupIds;
|
|
185
|
+
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `agentViews.${viewKey}.sort`, diagnostics);
|
|
186
|
+
appendViewSharingAttrs(attrs, view, `agentViews.${viewKey}`, principalCtx);
|
|
178
187
|
if (view.displayOrder !== undefined)
|
|
179
188
|
attrs["display_order"] = view.displayOrder;
|
|
180
189
|
blocks.push({ kind: "resource", type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
|
|
@@ -219,6 +228,20 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
219
228
|
}
|
|
220
229
|
return { blocks };
|
|
221
230
|
}
|
|
231
|
+
function managedViewSortToTf(sort, ownerTfLabel, scope, where, diagnostics) {
|
|
232
|
+
const orders = [];
|
|
233
|
+
for (const [index, order] of sort.orders.entries()) {
|
|
234
|
+
const field = fieldRefToTfValue(order.field, ownerTfLabel, scope, `${where}.orders[${index}].field`, diagnostics);
|
|
235
|
+
if (field === undefined)
|
|
236
|
+
continue;
|
|
237
|
+
orders.push({
|
|
238
|
+
field,
|
|
239
|
+
aggregation: order.aggregation ?? null,
|
|
240
|
+
direction: order.direction,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return expr.jsonencode({ orders });
|
|
244
|
+
}
|
|
222
245
|
function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics) {
|
|
223
246
|
const sections = [];
|
|
224
247
|
for (const section of layout.sections) {
|
|
@@ -246,6 +269,8 @@ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics
|
|
|
246
269
|
sec.icon = section.icon;
|
|
247
270
|
if (section.color !== undefined)
|
|
248
271
|
sec.color = section.color;
|
|
272
|
+
if (section.maxColumns !== undefined)
|
|
273
|
+
sec.max_columns = section.maxColumns;
|
|
249
274
|
const where = `layouts.${stageKey} section "${section.name ?? ""}"`;
|
|
250
275
|
const fields = (section.fields ?? []).filter((f) => {
|
|
251
276
|
if (typeof f === "string" && LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS.has(f)) {
|
|
@@ -289,6 +314,12 @@ function resolveFieldRefs(refs, ownerTfLabel, scope, where, diagnostics) {
|
|
|
289
314
|
return out;
|
|
290
315
|
}
|
|
291
316
|
function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
|
|
317
|
+
if (typeof ref === "object" && ref !== null && "__unsafe" in ref) {
|
|
318
|
+
if (ref.__unsafe === "platformId")
|
|
319
|
+
return ref.value;
|
|
320
|
+
diagnostics.push(`${where}: unsafe field id has an unrecognized shape; dropped`);
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
292
323
|
if (typeof ref === "string") {
|
|
293
324
|
if (scope === "element" && !ELEMENT_SYSTEM_FIELD_KEYS.has(ref)) {
|
|
294
325
|
diagnostics.push(`${where}: "${ref}" is not a known system field key on an element; dropped`);
|
|
@@ -301,6 +332,10 @@ function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
|
|
|
301
332
|
}
|
|
302
333
|
return expr.local(`${ownerTfLabel}_${attr}`);
|
|
303
334
|
}
|
|
335
|
+
if (ref == null) {
|
|
336
|
+
diagnostics.push(`${where}: field reference is unresolved (skipped during extract); dropped`);
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
304
339
|
const refName = ref.refName ?? "";
|
|
305
340
|
if (!SUB_TYPE_BY_AUTHORING_TYPE.has(ref.fieldType ?? "")) {
|
|
306
341
|
diagnostics.push(`${where}: field "${refName}" (type ${ref.fieldType ?? "?"}) has no terraform field resource mapping; dropped`);
|
|
@@ -75,6 +75,7 @@ export const KNOWN_LAYOUT_SECTION_ATTRS = new Set([
|
|
|
75
75
|
"name",
|
|
76
76
|
"icon",
|
|
77
77
|
"color",
|
|
78
|
+
"max_columns",
|
|
78
79
|
"field_ids",
|
|
79
80
|
"modules",
|
|
80
81
|
]);
|
|
@@ -88,6 +89,8 @@ export const KNOWN_LIST_VIEW_ATTRS = new Set([
|
|
|
88
89
|
"rows",
|
|
89
90
|
"filter",
|
|
90
91
|
"sort",
|
|
92
|
+
"user_ids",
|
|
93
|
+
"group_ids",
|
|
91
94
|
]);
|
|
92
95
|
export const KNOWN_AGENT_VIEW_ATTRS = new Set([
|
|
93
96
|
"aspect_id",
|
|
@@ -83,5 +83,5 @@ export interface VisualFlowConfigured {
|
|
|
83
83
|
def(refName: string): DeployableEntity;
|
|
84
84
|
}
|
|
85
85
|
/** Define the immutable visual process diagram attached to an app. */
|
|
86
|
-
export declare function
|
|
86
|
+
export declare function visualFlow(opts: DefineVisualFlowOptions): VisualFlowConfigured;
|
|
87
87
|
export {};
|
|
@@ -30,31 +30,31 @@ export function flowObjectTarget(object, name) {
|
|
|
30
30
|
return { object, ...(name !== undefined ? { name } : {}) };
|
|
31
31
|
}
|
|
32
32
|
/** Define the immutable visual process diagram attached to an app. */
|
|
33
|
-
export function
|
|
33
|
+
export function visualFlow(opts) {
|
|
34
34
|
const owner = opts.app;
|
|
35
35
|
if (owner?.__kind !== "app") {
|
|
36
|
-
throw new EdkValidationError("
|
|
36
|
+
throw new EdkValidationError("visualFlow requires an app owner because elements do not expose stages.");
|
|
37
37
|
}
|
|
38
38
|
if (Object.keys(opts.stages).length === 0)
|
|
39
|
-
throw new EdkValidationError("
|
|
39
|
+
throw new EdkValidationError("visualFlow requires at least one stage.");
|
|
40
40
|
for (const [stageKey, stage] of Object.entries(opts.stages)) {
|
|
41
41
|
if (stageKey.trim() === "")
|
|
42
|
-
throw new EdkValidationError("
|
|
42
|
+
throw new EdkValidationError("visualFlow stage keys must be non-empty.");
|
|
43
43
|
const keys = new Set(Object.keys(stage.nodes));
|
|
44
44
|
for (const [key, node] of Object.entries(stage.nodes)) {
|
|
45
45
|
if (!Number.isFinite(node.x) || !Number.isFinite(node.y)) {
|
|
46
|
-
throw new EdkValidationError(`
|
|
46
|
+
throw new EdkValidationError(`visualFlow node ${JSON.stringify(key)}: x and y must be finite numbers.`);
|
|
47
47
|
}
|
|
48
48
|
if (node.action?.kind === "agent" && node.action.agent.parent !== owner.refName) {
|
|
49
|
-
throw new EdkValidationError(`
|
|
49
|
+
throw new EdkValidationError(`visualFlow node ${JSON.stringify(key)}: agent must belong to ${owner.__kind} ${JSON.stringify(owner.refName)}.`);
|
|
50
50
|
}
|
|
51
51
|
if (node.action?.kind === "automation" && node.action.automation.parent !== owner.refName) {
|
|
52
|
-
throw new EdkValidationError(`
|
|
52
|
+
throw new EdkValidationError(`visualFlow node ${JSON.stringify(key)}: automation must belong to ${owner.__kind} ${JSON.stringify(owner.refName)}.`);
|
|
53
53
|
}
|
|
54
54
|
for (const connection of node.connectsTo ?? []) {
|
|
55
55
|
const target = typeof connection === "string" ? connection : connection.target;
|
|
56
56
|
if (!keys.has(target))
|
|
57
|
-
throw new EdkValidationError(`
|
|
57
|
+
throw new EdkValidationError(`visualFlow node ${JSON.stringify(key)} connects to unknown node ${JSON.stringify(target)} in stage ${JSON.stringify(stageKey)}.`);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { visualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, type DefineVisualFlowOptions, type VisualFlowAction, type VisualFlowConnection, type VisualFlowNode, type VisualFlowPosition, type VisualFlowStage, type VisualFlowSymbol, type VisualFlowTarget, } from "./build.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { visualFlow, flowAgentAction, flowApiAction, flowAutomationAction, flowObjectAction, flowObjectTarget, flowUserAction, visualFlowPosition, visualFlowSymbol, } from "./build.js";
|
|
@@ -36,6 +36,6 @@ export const visualFlowModule = {
|
|
|
36
36
|
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
37
37
|
}),
|
|
38
38
|
};
|
|
39
|
-
}, toTf: (entity, ctx) => visualFlowToTf(entity, { appRefName: ctx.appRefName, appTfLabel: ctx.appTfLabel, parentScope: ctx.parentScope, orgRefs: ctx.orgRefs, workspaceAspects: ctx.workspaceAspects }) },
|
|
39
|
+
}, toTf: (entity, ctx) => visualFlowToTf(entity, { appRefName: ctx.appRefName, appTfLabel: ctx.appTfLabel, parentScope: ctx.parentScope, orgRefs: ctx.orgRefs, workspaceAspects: ctx.workspaceAspects, diagnostics: ctx.diagnostics }) },
|
|
40
40
|
canvas: { participates: true, label: "Visual flow", glyph: "⇢", component: "generic" }, catalog: NO_CATALOG,
|
|
41
41
|
};
|