@elementumai/edk 0.9.19 → 0.10.1
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 +159 -7
- package/dist-sdk/src/catalog/factories.d.ts +33 -2
- package/dist-sdk/src/catalog/factories.js +40 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +11 -0
- package/dist-sdk/src/catalog/types.d.ts +40 -1
- package/dist-sdk/src/catalog/types.js +12 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
- package/dist-sdk/src/core/triggers/on-demand.js +17 -2
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +169 -0
- package/dist-sdk/src/engine/ei/run.js +1219 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +113 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
- package/dist-sdk/src/engine/tf/labels.js +54 -3
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +93 -4
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +44 -0
- package/dist-sdk/src/engine/validation.js +95 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +20 -6
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +105 -22
- package/dist-sdk/src/entities/app/build.js +107 -10
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -2
- package/dist-sdk/src/entities/app/index.d.ts +7 -6
- package/dist-sdk/src/entities/app/index.js +2 -8
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +40 -13
- package/dist-sdk/src/entities/automation/build.d.ts +56 -6
- package/dist-sdk/src/entities/automation/build.js +230 -26
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
- package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
- package/dist-sdk/src/entities/automation/from-tf.js +791 -131
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +107 -15
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +20 -0
- package/dist-sdk/src/entities/automation/script-code.js +109 -5
- package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
- package/dist-sdk/src/entities/automation/tasks.js +86 -24
- package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
- package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
- package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +28 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +62 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +16 -16
- package/dist-sdk/src/entities/field/build.d.ts +17 -3
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
- package/dist-sdk/src/entities/field/from-tf.js +244 -49
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +2 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
- package/dist-sdk/src/entities/field/to-tf.js +137 -15
- package/dist-sdk/src/entities/field/types.d.ts +2 -0
- package/dist-sdk/src/entities/field/types.js +27 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +20 -8
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +23 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +19 -4
- package/dist-sdk/src/entities/shared/filters/print.js +24 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +20 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +8 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +14 -6
- package/dist-sdk/src/entities/skill/from-tf.js +70 -15
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.js +14 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
- package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +2 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +28 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +133 -13
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
- package/dist-sdk/src/entities/view/to-tf.js +86 -18
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -15
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- 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/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +41 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +12 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +83 -4
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +16 -3
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
import type { ApprovalChainRef, AppOrElementRef, DatamineRef, FieldRef } from "../../catalog/index.js";
|
|
12
12
|
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
13
13
|
import type { RecordShape } from "../field/record-shape.js";
|
|
14
|
-
import { type InferTriggerType, type TriggerInputFieldDef, type TriggerInputSchema } from "../../core/triggers/on-demand.js";
|
|
15
|
-
import type {
|
|
14
|
+
import { type InferTriggerType, type WithOnDemandTriggeredBy, type TriggerInputFieldDef, type TriggerInputSchema } from "../../core/triggers/on-demand.js";
|
|
15
|
+
import type { OnDemandParamTypeAlias } from "../shared/types/field-types.js";
|
|
16
16
|
import type { Filter } from "./filter.js";
|
|
17
17
|
import { type TriggerChain } from "./build.js";
|
|
18
18
|
/**
|
|
@@ -63,7 +63,7 @@ export declare function schedule(opts: ScheduleTriggerOptions): TriggerChain<Sch
|
|
|
63
63
|
* the wire trigger-parameter declarations — a bare type parameter would be
|
|
64
64
|
* erased and deploy a trigger with no declared inputs.
|
|
65
65
|
*/
|
|
66
|
-
type TriggerInputShorthand = Exclude<
|
|
66
|
+
type TriggerInputShorthand = Exclude<OnDemandParamTypeAlias, "record">;
|
|
67
67
|
export type TriggerInputSchemaSpec = Record<string, TriggerInputFieldDef | TriggerInputShorthand>;
|
|
68
68
|
/** Normalize a spec entry to the full def shape (type level). */
|
|
69
69
|
type NormalizeSpec<S extends TriggerInputSchemaSpec> = {
|
|
@@ -71,7 +71,9 @@ type NormalizeSpec<S extends TriggerInputSchemaSpec> = {
|
|
|
71
71
|
type: S[K];
|
|
72
72
|
} : Extract<S[K], TriggerInputFieldDef>;
|
|
73
73
|
};
|
|
74
|
-
export declare function onDemand<S extends TriggerInputSchemaSpec>(schema: S
|
|
74
|
+
export declare function onDemand<S extends TriggerInputSchemaSpec>(schema: S & {
|
|
75
|
+
readonly triggeredBy?: never;
|
|
76
|
+
}): TriggerChain<WithOnDemandTriggeredBy<InferTriggerType<NormalizeSpec<S> & TriggerInputSchema>, NormalizeSpec<S>>>;
|
|
75
77
|
export interface WebhookTriggerOptions {
|
|
76
78
|
readonly authenticated?: boolean;
|
|
77
79
|
/** Pre-built wire custom-response envelope. */
|
|
@@ -133,11 +135,15 @@ export interface AttachmentTriggerOutput<A extends AppOrElementRef = AppOrElemen
|
|
|
133
135
|
readonly record: RecordShape<A>;
|
|
134
136
|
/**
|
|
135
137
|
* Trigger attachment payload. `id` is the live ATTACHMENT_ID wire key
|
|
136
|
-
* (`refs["Attachment Id"]`)
|
|
137
|
-
* aren't typed yet — follow-up.
|
|
138
|
+
* (`refs["Attachment Id"]`).
|
|
138
139
|
*/
|
|
139
140
|
readonly attachment: {
|
|
140
141
|
readonly id: string;
|
|
142
|
+
readonly name: string;
|
|
143
|
+
readonly url: string;
|
|
144
|
+
readonly mediaType: string;
|
|
145
|
+
readonly size: number;
|
|
146
|
+
readonly description: string;
|
|
141
147
|
readonly [key: string]: unknown;
|
|
142
148
|
};
|
|
143
149
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
|
|
1
2
|
import { serializeOnDemandTrigger, } from "../../core/triggers/on-demand.js";
|
|
2
3
|
import { chainableTrigger } from "./build.js";
|
|
3
4
|
function recordTriggerFields(opts) {
|
|
@@ -65,6 +66,9 @@ export function schedule(opts) {
|
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
export function onDemand(schema) {
|
|
69
|
+
if (Object.hasOwn(schema, "triggeredBy")) {
|
|
70
|
+
throw new EdkValidationError('onDemand input "triggeredBy" is reserved: ctx.trigger.triggeredBy is the user who ran the automation. Rename the input.');
|
|
71
|
+
}
|
|
68
72
|
const normalized = Object.fromEntries(Object.entries(schema).map(([k, v]) => [k, typeof v === "string" ? { type: v } : v]));
|
|
69
73
|
return chainableTrigger({
|
|
70
74
|
wire: serializeOnDemandTrigger(normalized),
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* is load-bearing (to-tf maps authored → resource by it); the declared rows
|
|
18
18
|
* need only an accurate `resourceType` for from-tf recognition.
|
|
19
19
|
*/
|
|
20
|
+
import { type ChildResourceScope } from "../../engine/tf/labels.js";
|
|
20
21
|
export interface AutomationSubType {
|
|
21
22
|
/** Wire discriminant: a trigger `wire` key or a `ActionDef.key`. */
|
|
22
23
|
readonly typeKey: string;
|
|
@@ -28,6 +29,14 @@ export interface AutomationSubType {
|
|
|
28
29
|
/** The automation's own resource + its versioning/publish resource. */
|
|
29
30
|
export declare const AUTOMATION_RESOURCE_TYPE = "elementum_automation";
|
|
30
31
|
export declare const WORKFLOW_PUBLISH_RESOURCE_TYPE = "elementum_workflow_publish";
|
|
32
|
+
/**
|
|
33
|
+
* Terraform label of an owned automation. ei labels an element automation
|
|
34
|
+
* `SanitizeName(handle)_SanitizeName(name)` and an app automation
|
|
35
|
+
* `apps_<ns>_<ns>_<automation>`. A bag key that is already that full export
|
|
36
|
+
* label is kept. Every emitter that references an automation resource must
|
|
37
|
+
* use this so the address exists.
|
|
38
|
+
*/
|
|
39
|
+
export declare function automationResourceLabel(ownerTfLabel: string, refName: string, scope?: ChildResourceScope, handle?: string): string;
|
|
31
40
|
export declare const TABLE_RECORDS_SEARCH_TASK_RESOURCE_TYPE = "elementum_table_records_search_task";
|
|
32
41
|
/** Trigger kinds. One trigger per automation. Phase 1: onDemand only. */
|
|
33
42
|
export declare const TRIGGER_SUB_TYPES: readonly AutomationSubType[];
|
|
@@ -17,9 +17,26 @@
|
|
|
17
17
|
* is load-bearing (to-tf maps authored → resource by it); the declared rows
|
|
18
18
|
* need only an accurate `resourceType` for from-tf recognition.
|
|
19
19
|
*/
|
|
20
|
+
import { appScopedResourceLabel, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/labels.js";
|
|
20
21
|
/** The automation's own resource + its versioning/publish resource. */
|
|
21
22
|
export const AUTOMATION_RESOURCE_TYPE = "elementum_automation";
|
|
22
23
|
export const WORKFLOW_PUBLISH_RESOURCE_TYPE = "elementum_workflow_publish";
|
|
24
|
+
/**
|
|
25
|
+
* Terraform label of an owned automation. ei labels an element automation
|
|
26
|
+
* `SanitizeName(handle)_SanitizeName(name)` and an app automation
|
|
27
|
+
* `apps_<ns>_<ns>_<automation>`. A bag key that is already that full export
|
|
28
|
+
* label is kept. Every emitter that references an automation resource must
|
|
29
|
+
* use this so the address exists.
|
|
30
|
+
*/
|
|
31
|
+
export function automationResourceLabel(ownerTfLabel, refName, scope = "app", handle) {
|
|
32
|
+
const child = tsLabelToTfLabel(refName);
|
|
33
|
+
if (scope !== "element")
|
|
34
|
+
return appScopedResourceLabel(ownerTfLabel, child);
|
|
35
|
+
const prefix = handle !== undefined && handle !== "" ? sanitizeName(handle) : ownerTfLabel;
|
|
36
|
+
if (prefix !== "" && (child === prefix || child.startsWith(`${prefix}_`)))
|
|
37
|
+
return child;
|
|
38
|
+
return prefix === "" ? child : `${prefix}_${child}`;
|
|
39
|
+
}
|
|
23
40
|
export const TABLE_RECORDS_SEARCH_TASK_RESOURCE_TYPE = "elementum_table_records_search_task";
|
|
24
41
|
/** Trigger kinds. One trigger per automation. Phase 1: onDemand only. */
|
|
25
42
|
export const TRIGGER_SUB_TYPES = [
|
|
@@ -52,6 +69,7 @@ export const TASK_SUB_TYPES = [
|
|
|
52
69
|
{ typeKey: "variable", resourceType: "elementum_variable_task", implemented: true },
|
|
53
70
|
{ typeKey: "updateVariable", resourceType: "elementum_update_variable_task", implemented: true },
|
|
54
71
|
{ typeKey: "updateField", resourceType: "elementum_update_field_task", implemented: true },
|
|
72
|
+
{ typeKey: "bulkUpdateFields", resourceType: "elementum_bulk_update_fields_task", implemented: true },
|
|
55
73
|
{ typeKey: "recordSearch", resourceType: "elementum_record_search_task", implemented: true },
|
|
56
74
|
{ typeKey: "tableRecordsSearch", resourceType: TABLE_RECORDS_SEARCH_TASK_RESOURCE_TYPE, implemented: true },
|
|
57
75
|
{ typeKey: "createRecord", resourceType: "elementum_create_record_task", implemented: true },
|
|
@@ -75,6 +93,7 @@ export const TASK_SUB_TYPES = [
|
|
|
75
93
|
{ typeKey: "approvalStatusUpdate", resourceType: "elementum_approval_status_update_task", implemented: true },
|
|
76
94
|
{ typeKey: "addWatcher", resourceType: "elementum_add_watcher_task", implemented: true },
|
|
77
95
|
{ typeKey: "saveAttachment", resourceType: "elementum_save_attachment_task", implemented: true },
|
|
96
|
+
{ typeKey: "unzip", resourceType: "elementum_unzip_file_task", implemented: true },
|
|
78
97
|
{ typeKey: "userSearch", resourceType: "elementum_user_search_task", implemented: true },
|
|
79
98
|
{ typeKey: "userGroupSearch", resourceType: "elementum_user_group_search_task", implemented: true },
|
|
80
99
|
{ typeKey: "aspectRecordFieldLocking", resourceType: "elementum_aspect_record_field_locking_task", implemented: true },
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - on_demand trigger: the DECLARED parameter name (the authored schema key;
|
|
17
17
|
* the wire's triggerReference name is the Mobius-canonicalized form —
|
|
18
18
|
* reverse-mapped here via the declared names).
|
|
19
|
-
* - variable task:
|
|
19
|
+
* - variable task: each variable's name (buildVariableTaskRefs).
|
|
20
20
|
* - execute_script: "Result" for the whole result, "result.<prop>" per
|
|
21
21
|
* output-schema property.
|
|
22
22
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - on_demand trigger: the DECLARED parameter name (the authored schema key;
|
|
17
17
|
* the wire's triggerReference name is the Mobius-canonicalized form —
|
|
18
18
|
* reverse-mapped here via the declared names).
|
|
19
|
-
* - variable task:
|
|
19
|
+
* - variable task: each variable's name (buildVariableTaskRefs).
|
|
20
20
|
* - execute_script: "Result" for the whole result, "result.<prop>" per
|
|
21
21
|
* output-schema property.
|
|
22
22
|
*/
|
|
@@ -163,7 +163,15 @@ function opaqueSubscriptionFromTf(value, where, ctx) {
|
|
|
163
163
|
? columns.map((column) => plainObject(column)?.["name"]).filter((name) => typeof name === "string")
|
|
164
164
|
: [];
|
|
165
165
|
const hasUiRoles = columnNames.includes("Label") && (columnNames.includes("Value") || columnNames.includes("Series"));
|
|
166
|
-
|
|
166
|
+
const hasStatement = decodedWith !== undefined && plainObject(decodedWith)?.["statement"] !== undefined;
|
|
167
|
+
// UI charts that group by a second picklist join the synthetic datasource by
|
|
168
|
+
// expression instead of carrying a with.statement.
|
|
169
|
+
const joins = rec?.["joins"];
|
|
170
|
+
const hasExpressionJoins = Array.isArray(joins) && joins.length > 0 && joins.every((join) => {
|
|
171
|
+
const joinObject = plainObject(join);
|
|
172
|
+
return joinObject?.["left_expression"] !== undefined && joinObject["right_expression"] !== undefined;
|
|
173
|
+
});
|
|
174
|
+
if (typeof datasourceId !== "string" || !hasUiRoles || (!hasStatement && !hasExpressionJoins))
|
|
167
175
|
return undefined;
|
|
168
176
|
const attributes = {};
|
|
169
177
|
for (const [key, item] of Object.entries(rec)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { workspaceAspectKey, } from "../../engine/build/context.js";
|
|
2
2
|
import { EntityTfError } from "../../engine/entity.js";
|
|
3
3
|
import { expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
4
|
-
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
4
|
+
import { authoredFieldKeysFromPayload, fieldRefToTfValue, } from "../field/to-tf.js";
|
|
5
5
|
import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
|
|
6
6
|
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
7
7
|
import { CHART_RESOURCE_TYPE } from "./types.js";
|
|
@@ -19,7 +19,14 @@ function datasourceId(ref, opts, where) {
|
|
|
19
19
|
const local = opts.workspaceAspects?.get(workspaceAspectKey(kind, ref.refName));
|
|
20
20
|
if (local !== undefined) {
|
|
21
21
|
const type = ref.__kind === "app" ? APP_RESOURCE_TYPE : ref.__kind === "element" ? "elementum_element" : ref.__kind === "task" ? "elementum_task" : TABLE_RESOURCE_TYPE;
|
|
22
|
-
return {
|
|
22
|
+
return {
|
|
23
|
+
ref,
|
|
24
|
+
kind,
|
|
25
|
+
id: expr.resourceAttr(type, local.tfLabel, ["id"]),
|
|
26
|
+
tfLabel: local.tfLabel,
|
|
27
|
+
local: true,
|
|
28
|
+
fieldOwnership: authoredFieldKeysFromPayload(local.streamRootEntity?.payload),
|
|
29
|
+
};
|
|
23
30
|
}
|
|
24
31
|
const name = ref.name ?? ref.refName;
|
|
25
32
|
if (ref.__kind === "app" || ref.__kind === "element") {
|
|
@@ -52,7 +59,7 @@ function fieldId(ref, datasource, opts, where) {
|
|
|
52
59
|
throw new EntityTfError(`${where}: app/element fields cannot belong to a table datasource`);
|
|
53
60
|
if (datasource.local && datasource.ref.__kind !== "task") {
|
|
54
61
|
const scope = datasource.ref.__kind === "element" ? "element" : "app";
|
|
55
|
-
const direct = fieldRefToTfValue(ref.fieldType ?? "", ref.refName, datasource.tfLabel, scope);
|
|
62
|
+
const direct = fieldRefToTfValue(ref.fieldType ?? "", ref.refName, datasource.tfLabel, scope, datasource.fieldOwnership);
|
|
56
63
|
if (direct !== undefined)
|
|
57
64
|
return direct;
|
|
58
65
|
}
|
|
@@ -19,4 +19,6 @@ export const dataLookupModules = [
|
|
|
19
19
|
lookup("organization", "elementum_organization", ""),
|
|
20
20
|
lookup("permission-template", "elementum_permission_template", "template"),
|
|
21
21
|
lookup("stored-function", "elementum_stored_function", "name"),
|
|
22
|
+
// Task inputs built from secret() reference existing vault entries by key.
|
|
23
|
+
lookup("vault-entry", "elementum_vault_entry", "key", true),
|
|
22
24
|
];
|
|
@@ -52,6 +52,17 @@ export interface DynamicLayoutFieldComponent {
|
|
|
52
52
|
readonly fullWidth?: boolean;
|
|
53
53
|
readonly dependsOn?: readonly string[];
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Properties the layout editor offers on every block. Most blocks render only
|
|
57
|
+
* `label`; the editor stores and shows the rest, so they round-trip.
|
|
58
|
+
*/
|
|
59
|
+
export interface DynamicLayoutBlockCommon {
|
|
60
|
+
readonly label?: string;
|
|
61
|
+
readonly title?: string;
|
|
62
|
+
readonly collapsed?: boolean;
|
|
63
|
+
readonly hidden?: boolean;
|
|
64
|
+
readonly sideNavItem?: boolean;
|
|
65
|
+
}
|
|
55
66
|
/** One automation trigger parameter an automation button supplies. */
|
|
56
67
|
export interface DynamicLayoutAutomationButtonInput {
|
|
57
68
|
/** On-demand trigger parameter of the button's automation (or of `automation`). */
|
|
@@ -103,9 +114,12 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
103
114
|
readonly className?: string;
|
|
104
115
|
};
|
|
105
116
|
readonly row: {
|
|
117
|
+
/** Equal-width grid columns (1-12); the row then ignores `justifyContent` and `wrap`. */
|
|
118
|
+
readonly columns?: number;
|
|
106
119
|
readonly gap?: DynamicLayoutCssLength;
|
|
107
120
|
readonly alignItems?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
108
121
|
readonly justifyContent?: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
122
|
+
/** The renderer wraps a row that leaves this unset. */
|
|
109
123
|
readonly wrap?: boolean;
|
|
110
124
|
readonly className?: string;
|
|
111
125
|
};
|
|
@@ -162,8 +176,7 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
162
176
|
readonly variant?: "default" | "outline" | "ghost";
|
|
163
177
|
readonly icon?: string;
|
|
164
178
|
};
|
|
165
|
-
readonly updateBlock: {
|
|
166
|
-
readonly title?: string;
|
|
179
|
+
readonly updateBlock: DynamicLayoutBlockCommon & {
|
|
167
180
|
readonly fields?: readonly AppViewFieldRef[];
|
|
168
181
|
readonly submitLabel?: string;
|
|
169
182
|
};
|
|
@@ -188,32 +201,14 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
188
201
|
readonly currency?: string;
|
|
189
202
|
readonly locale?: string;
|
|
190
203
|
};
|
|
191
|
-
readonly stageBlock:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
readonly
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
readonly
|
|
198
|
-
|
|
199
|
-
readonly title?: string;
|
|
200
|
-
};
|
|
201
|
-
readonly approvalsBlock: {
|
|
202
|
-
readonly label?: string;
|
|
203
|
-
};
|
|
204
|
-
readonly attachmentsBlock: {
|
|
205
|
-
readonly label?: string;
|
|
206
|
-
readonly title?: string;
|
|
207
|
-
};
|
|
208
|
-
readonly relatedTasksBlock: {
|
|
209
|
-
readonly label?: string;
|
|
210
|
-
};
|
|
211
|
-
readonly relationshipsBlock: {
|
|
212
|
-
readonly label?: string;
|
|
213
|
-
};
|
|
214
|
-
readonly relatedItemsBlock: {
|
|
215
|
-
readonly label?: string;
|
|
216
|
-
readonly title?: string;
|
|
204
|
+
readonly stageBlock: DynamicLayoutBlockCommon;
|
|
205
|
+
readonly slaBlock: DynamicLayoutBlockCommon;
|
|
206
|
+
readonly activityLogBlock: DynamicLayoutBlockCommon;
|
|
207
|
+
readonly approvalsBlock: DynamicLayoutBlockCommon;
|
|
208
|
+
readonly attachmentsBlock: DynamicLayoutBlockCommon;
|
|
209
|
+
readonly relatedTasksBlock: DynamicLayoutBlockCommon;
|
|
210
|
+
readonly relationshipsBlock: DynamicLayoutBlockCommon;
|
|
211
|
+
readonly relatedItemsBlock: DynamicLayoutBlockCommon & {
|
|
217
212
|
readonly fieldName?: string;
|
|
218
213
|
readonly color?: string;
|
|
219
214
|
readonly fullWidth?: boolean;
|
|
@@ -222,9 +217,7 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
222
217
|
/** Record filter over the related app's or element's fields. */
|
|
223
218
|
readonly filter?: Filter<FieldRef, never>;
|
|
224
219
|
};
|
|
225
|
-
readonly surveysBlock:
|
|
226
|
-
readonly label?: string;
|
|
227
|
-
};
|
|
220
|
+
readonly surveysBlock: DynamicLayoutBlockCommon;
|
|
228
221
|
}
|
|
229
222
|
type ExactlyOneVariant<Map extends object> = {
|
|
230
223
|
[K in keyof Map]: {
|
|
@@ -18,6 +18,7 @@ export interface DynamicLayoutWire {
|
|
|
18
18
|
export interface DynamicLayoutToTfOptions {
|
|
19
19
|
readonly ownerRefName: string;
|
|
20
20
|
readonly ownerTfLabel: string;
|
|
21
|
+
readonly ownerHandle?: string;
|
|
21
22
|
/** Owning stream root kind; defaults to `"app"`. Elements have no stages. */
|
|
22
23
|
readonly scope?: ChildResourceScope;
|
|
23
24
|
readonly objectId: TfValue;
|
|
@@ -2,7 +2,7 @@ import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
|
2
2
|
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
3
3
|
import { expr, isCanonicalTsLabel, isTfExpr, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
4
4
|
import { filterToTf } from "../access-policy/to-tf.js";
|
|
5
|
-
import { AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE } from "../automation/types.js";
|
|
5
|
+
import { AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, automationResourceLabel } from "../automation/types.js";
|
|
6
6
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
7
7
|
import { targetFilterFieldResolver } from "../relationship/to-tf.js";
|
|
8
8
|
import { filterTfToWire } from "../shared/filters/tf-codec.js";
|
|
@@ -288,7 +288,7 @@ function automationButtonInput(rec, inputs, where, opts) {
|
|
|
288
288
|
return [];
|
|
289
289
|
}
|
|
290
290
|
out["parameter_id"] = isActiveAutomation(target?.token.refName ?? "", opts)
|
|
291
|
-
? expr.dataAttr(AUTOMATION_RESOURCE_TYPE, publishedAutomationLookup(label, inputs
|
|
291
|
+
? expr.dataAttr(AUTOMATION_RESOURCE_TYPE, publishedAutomationLookup(label, inputs), ["parameter_ids", { index: name }])
|
|
292
292
|
: expr.resourceAttr("elementum_on_demand_trigger", label, ["parameter_ids", { index: name }]);
|
|
293
293
|
}
|
|
294
294
|
if (Array.isArray(rec["fieldRefParams"])) {
|
|
@@ -453,7 +453,7 @@ function resolveAutomation(token, where, opts) {
|
|
|
453
453
|
opts.diagnostics.push(`${where}: automation key "${refName}" is not a canonical tsLabel; dropped`);
|
|
454
454
|
return undefined;
|
|
455
455
|
}
|
|
456
|
-
return expr.resourceAttr(
|
|
456
|
+
return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationResourceLabel(opts.ownerTfLabel, refName, scopeOf(opts), scopeOf(opts) === "element" ? opts.ownerHandle : undefined), ["id"]);
|
|
457
457
|
}
|
|
458
458
|
function isActiveAutomation(refName, opts) {
|
|
459
459
|
return opts.workspaceAspects?.get(workspaceAspectKey(scopeOf(opts), opts.ownerRefName))
|
|
@@ -465,14 +465,16 @@ function isActiveAutomation(refName, opts) {
|
|
|
465
465
|
* after publish, as run-automation tasks do. The data address is
|
|
466
466
|
* module-global, so it is scoped to this layout.
|
|
467
467
|
*/
|
|
468
|
-
function publishedAutomationLookup(automationLabel, inputs
|
|
468
|
+
function publishedAutomationLookup(automationLabel, inputs) {
|
|
469
469
|
const label = `${automationLabel}_for_${inputs.layoutLabel}`;
|
|
470
470
|
inputs.automationLookups.set(`${AUTOMATION_RESOURCE_TYPE}.${label}`, {
|
|
471
471
|
kind: "data",
|
|
472
472
|
type: AUTOMATION_RESOURCE_TYPE,
|
|
473
473
|
label,
|
|
474
474
|
attrs: {
|
|
475
|
-
|
|
475
|
+
// From the automation, not the layout's owner: see the run-automation
|
|
476
|
+
// lookup in automation/to-tf.ts (edk#1514).
|
|
477
|
+
app_id: expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationLabel, ["app_id"]),
|
|
476
478
|
id: expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationLabel, ["id"]),
|
|
477
479
|
depends_on: [expr.resourceAttr(WORKFLOW_PUBLISH_RESOURCE_TYPE, automationLabel)],
|
|
478
480
|
},
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import type { AutoShareOptions } from "../app/auto-share.js";
|
|
1
2
|
import { type AppOrElementRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
|
|
2
3
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
4
|
import type { AccessPolicyOptions } from "../access-policy/build.js";
|
|
4
5
|
import type { ElementDynamicLayout } from "../dynamic-layout/build.js";
|
|
5
|
-
import { type
|
|
6
|
+
import { type AppViewBags, type AppViewRefs, type AppCategory, type AppCustomView, type AppCloudOptions, type AppDashboard, type AppField, type AppFieldRefs, type AppLayout, type AppRecordCreateForm, type AppSystemFieldOverride } from "../app/build.js";
|
|
6
7
|
import { type DisplayBlock } from "../app/display-blocks.js";
|
|
7
8
|
import type { AppRelationship } from "../relationship/build.js";
|
|
8
9
|
import type { AppRole } from "../role/build.js";
|
|
9
10
|
import type { AppWidget } from "../widget/build.js";
|
|
10
11
|
import { type ElementSystemFieldKey } from "./system-fields.js";
|
|
12
|
+
/** A Custom view on an element. Agents are app-owned, so an element's Custom view has none. */
|
|
13
|
+
export type ElementCustomView = Omit<AppCustomView, "agent"> & {
|
|
14
|
+
readonly agent?: never;
|
|
15
|
+
};
|
|
11
16
|
export type { AppCalendarView, AppCategory, AppDashboard, AppDashboardView, AppField, AppKanbanView, AppLayout, AppListView, AppRecordCreateForm, AppRecordCreateFormSection, AppSystemFieldOverride, PicklistOption } from "../app/build.js";
|
|
12
17
|
export type { AppRelationship, AppRelationshipColumn } from "../relationship/build.js";
|
|
13
18
|
export type { AppWidget, CreateRecordWidget, LinkRecordsWidget, RelatedRecordsWidget, RunAutomationWidget, RunAutomationWidgetParameter, WidgetButtonStyle, WidgetButtonType } from "../widget/build.js";
|
|
@@ -16,6 +21,13 @@ export { ELEMENT_SYSTEM_FIELD_KEYS, type ElementSystemFieldKey } from "./system-
|
|
|
16
21
|
export interface ElementSystemFields {
|
|
17
22
|
readonly id?: AppSystemFieldOverride;
|
|
18
23
|
readonly title?: AppSystemFieldOverride;
|
|
24
|
+
/**
|
|
25
|
+
* The element carries the platform's audit fields (Created on/by, Updated
|
|
26
|
+
* on/by). The platform adds them to apps but only to some elements, and
|
|
27
|
+
* EDK cannot create them, so referencing `createdAt`, `createdBy`,
|
|
28
|
+
* `updatedAt` or `updatedBy` on an element without this is a build error.
|
|
29
|
+
*/
|
|
30
|
+
readonly audit?: boolean;
|
|
19
31
|
}
|
|
20
32
|
/**
|
|
21
33
|
* The source table a LINKED element maps to — an existing table in the
|
|
@@ -36,7 +48,14 @@ export interface ElementCloudConnection {
|
|
|
36
48
|
/** The record-id source column on the mapped table. */
|
|
37
49
|
readonly idColumnName?: string;
|
|
38
50
|
}
|
|
39
|
-
|
|
51
|
+
/** An element's managed views: an app's view bags without agent views. */
|
|
52
|
+
export type ElementViewBags = Omit<AppViewBags, "agentViews" | "customViews"> & {
|
|
53
|
+
/** Custom views (pages of Elementum Blocks), keyed by view ref name. */
|
|
54
|
+
readonly customViews?: Readonly<Record<string, ElementCustomView>>;
|
|
55
|
+
};
|
|
56
|
+
/** Element options; `V` carries the view bags so `ref().views` keeps their keys. */
|
|
57
|
+
export type ElementV2Options<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, V extends ElementViewBags = ElementViewBags> = ElementV2OptionsBase<F, R> & V;
|
|
58
|
+
interface ElementV2OptionsBase<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> extends EntityDeployOptions {
|
|
40
59
|
/** Required platform handle (business acronym, e.g. "PRD") — distinct from the refName. */
|
|
41
60
|
readonly handle: string;
|
|
42
61
|
readonly name: string;
|
|
@@ -57,6 +76,8 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
|
|
|
57
76
|
readonly cloudConnection?: ElementCloudConnection;
|
|
58
77
|
/** Whether the comments display block is enabled. Omit to leave the platform's current value alone. */
|
|
59
78
|
readonly commentsEnabled?: boolean;
|
|
79
|
+
/** Automatic record sharing toggles. Omit to leave the platform setting untouched. */
|
|
80
|
+
readonly autoShare?: AutoShareOptions;
|
|
60
81
|
/** Fields keyed by ref name. At least one required by the compose API. */
|
|
61
82
|
readonly fields: F;
|
|
62
83
|
/**
|
|
@@ -106,15 +127,8 @@ export interface ElementV2Options<F extends Record<string, AppField> = Record<st
|
|
|
106
127
|
* condition, and save-group keys.
|
|
107
128
|
*/
|
|
108
129
|
readonly dynamicLayouts?: Readonly<Record<string, ElementDynamicLayout>>;
|
|
109
|
-
/** Saved list views, keyed by view ref name. */
|
|
110
|
-
readonly listViews?: Readonly<Record<string, AppListView>>;
|
|
111
|
-
/** Calendar views, keyed by stable view ref name. */
|
|
112
|
-
readonly calendarViews?: Readonly<Record<string, AppCalendarView>>;
|
|
113
|
-
/** Kanban views, keyed by stable view ref name. */
|
|
114
|
-
readonly kanbanViews?: Readonly<Record<string, AppKanbanView>>;
|
|
115
130
|
readonly dashboards?: Readonly<Record<string, AppDashboard>>;
|
|
116
131
|
readonly widgets?: Readonly<Record<string, AppWidget>>;
|
|
117
|
-
readonly dashboardViews?: Readonly<Record<string, AppDashboardView>>;
|
|
118
132
|
/**
|
|
119
133
|
* Typed new-record form (`elementum_record_create_form`). Mutually
|
|
120
134
|
* exclusive with `recordCreateDisplayBlocks` — author one or the other,
|
|
@@ -172,10 +186,11 @@ type ElementSystemFieldRefs<Parent extends string = string> = {
|
|
|
172
186
|
* record`). `id`/`title` round out the bag the same way `AppRef` folds in
|
|
173
187
|
* its full `SystemFieldKey` set — a finite, closed term, not a wide index.
|
|
174
188
|
*/
|
|
175
|
-
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>, {
|
|
189
|
+
export type ElementRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, RefName extends string = string, V extends ElementViewBags = ElementViewBags> = Extract<AppOrElementRef<RefName>, {
|
|
176
190
|
readonly __kind: "element";
|
|
177
191
|
}> & {
|
|
178
192
|
readonly fields: AppFieldRefs<F, RefName> & ElementSystemFieldRefs<RefName> & R;
|
|
193
|
+
readonly views: AppViewRefs<V, RefName>;
|
|
179
194
|
};
|
|
180
195
|
/**
|
|
181
196
|
* The configured result of `element` — its reference surface (`ref()`)
|
|
@@ -183,9 +198,9 @@ export type ElementRef<F extends Record<string, AppField> = Record<string, AppFi
|
|
|
183
198
|
* argument**, not a constructor option — see `AppConfigured` in
|
|
184
199
|
* `src/aspects/build.ts` for the full rationale (identical here).
|
|
185
200
|
*/
|
|
186
|
-
export interface ElementConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never
|
|
187
|
-
ref<const RefName extends string>(refName: RefName): ElementRef<F, R, RefName>;
|
|
201
|
+
export interface ElementConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, V extends ElementViewBags = ElementViewBags> {
|
|
202
|
+
ref<const RefName extends string>(refName: RefName): ElementRef<F, R, RefName, V>;
|
|
188
203
|
def(refName: string): DeployableEntity;
|
|
189
204
|
}
|
|
190
205
|
/** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
|
|
191
|
-
export declare function element<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never
|
|
206
|
+
export declare function element<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>, const V extends ElementViewBags = ElementViewBags>(opts: ElementV2Options<F, R, V>): ElementConfigured<F, R, V>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { slimTokens } from "../../catalog/index.js";
|
|
2
2
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY } from "../../core/system-fields.js";
|
|
3
|
-
import { assertNoSystemKeyCollision, picklistOptionLabels, serializeField, } from "../app/build.js";
|
|
3
|
+
import { appViewRefs, assertNoSystemKeyCollision, picklistOptionLabels, serializeField, } from "../app/build.js";
|
|
4
4
|
import { serializeDisplayBlocks } from "../app/display-blocks.js";
|
|
5
5
|
import { ELEMENT_SYSTEM_FIELD_KEYS } from "./system-fields.js";
|
|
6
6
|
export { ELEMENT_SYSTEM_FIELD_KEYS } from "./system-fields.js";
|
|
@@ -105,6 +105,7 @@ export function element(opts) {
|
|
|
105
105
|
name: opts.name,
|
|
106
106
|
...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
|
|
107
107
|
fields,
|
|
108
|
+
views: appViewRefs(opts, { refName, name: opts.name, ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}) }, "element"),
|
|
108
109
|
};
|
|
109
110
|
},
|
|
110
111
|
def(refName) {
|
|
@@ -124,6 +125,8 @@ export function element(opts) {
|
|
|
124
125
|
...(opts.cloudOptions !== undefined ? { cloudOptions: opts.cloudOptions } : {}),
|
|
125
126
|
...(opts.cloudConnection !== undefined ? { cloudConnection: opts.cloudConnection } : {}),
|
|
126
127
|
...(opts.commentsEnabled !== undefined ? { commentsEnabled: opts.commentsEnabled } : {}),
|
|
128
|
+
...(opts.autoShare !== undefined ? { autoShare: opts.autoShare } : {}),
|
|
129
|
+
...(opts.systemFields?.audit === true ? { auditFields: true } : {}),
|
|
127
130
|
fields: [
|
|
128
131
|
...serializeElementSystemFields(opts.systemFields),
|
|
129
132
|
...Object.entries(opts.fields).map(([bagKey, field]) => serializeField(field, bagKey)),
|
|
@@ -137,6 +140,7 @@ export function element(opts) {
|
|
|
137
140
|
...(opts.dashboards !== undefined ? { dashboards: opts.dashboards } : {}),
|
|
138
141
|
...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
|
|
139
142
|
...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
|
|
143
|
+
...(opts.customViews !== undefined ? { customViews: opts.customViews } : {}),
|
|
140
144
|
...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
|
|
141
145
|
...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
|
|
142
146
|
...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
|
|
@@ -17,6 +17,7 @@ export interface ElementFromTfViewBlocks {
|
|
|
17
17
|
readonly calendarViewBlocks: readonly TfBlock[];
|
|
18
18
|
readonly kanbanViewBlocks: readonly TfBlock[];
|
|
19
19
|
readonly dashboardViewBlocks: readonly TfBlock[];
|
|
20
|
+
readonly customViewBlocks?: readonly TfBlock[];
|
|
20
21
|
readonly managedViewOrderBlocks: readonly TfBlock[];
|
|
21
22
|
readonly recordCreateFormBlocks: readonly TfBlock[];
|
|
22
23
|
readonly dynamicLayoutBlocks?: readonly TfBlock[];
|
|
@@ -26,3 +27,13 @@ export interface ElementFromTfViewBlocks {
|
|
|
26
27
|
readonly widgetBlocks: readonly TfBlock[];
|
|
27
28
|
}
|
|
28
29
|
export declare function elementFromTf(elementBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: ElementFromTfViewBlocks, accessPolicyBlocks?: readonly TfBlock[], roleBlocks?: readonly TfBlock[]): ElementFromTfResult;
|
|
30
|
+
/**
|
|
31
|
+
* The export references an element's audit fields only when the platform
|
|
32
|
+
* gave it those fields, which EDK cannot otherwise observe: through its
|
|
33
|
+
* `<label>_(created|updated)_(at|by)_field_id` locals, or, in the element's
|
|
34
|
+
* own automations, through a trigger's Created/Updated outputs. Locals
|
|
35
|
+
* blocks are skipped by callers: `ei` defines those locals on every element.
|
|
36
|
+
* An authored field with the same display name wins over trigger-output
|
|
37
|
+
* heuristics.
|
|
38
|
+
*/
|
|
39
|
+
export declare function referencesElementAuditFields(label: string, blocks: readonly TfBlock[], authoredFieldNames?: ReadonlySet<string>): boolean;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* `NormalizedApp` shape (`type: "ELEMENT"`) that `printElementV2` consumes.
|
|
4
4
|
* Mirrors `app/from-tf.ts` without app-only status/stages dialect.
|
|
5
5
|
*/
|
|
6
|
+
import { autoShareFromTf } from "../app/auto-share.js";
|
|
6
7
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES } from "../../core/system-fields.js";
|
|
7
8
|
import { EntityTfError } from "../../engine/entity.js";
|
|
8
9
|
import { dataRefLabel, optionalBoolean, optionalString } from "../../engine/pull/context.js";
|
|
@@ -28,6 +29,7 @@ const KNOWN_ELEMENT_ATTRS = new Set([
|
|
|
28
29
|
"category_id",
|
|
29
30
|
"cloud_link_id",
|
|
30
31
|
"comments_enabled",
|
|
32
|
+
"auto_share",
|
|
31
33
|
"cloud_mapping_snowflake_database",
|
|
32
34
|
"cloud_mapping_snowflake_schema",
|
|
33
35
|
"cloud_mapping_snowflake_table",
|
|
@@ -75,6 +77,7 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
75
77
|
const titleFieldDescription = optionalString(attrs, "title_field_description", `element "${label}"`, ctx);
|
|
76
78
|
const idFieldDescription = optionalString(attrs, "id_field_description", `element "${label}"`, ctx);
|
|
77
79
|
const commentsEnabled = optionalBoolean(attrs, "comments_enabled", `element "${label}"`, ctx);
|
|
80
|
+
const autoShare = autoShareFromTf(attrs["auto_share"], `element "${label}"`, ctx.diagnostics);
|
|
78
81
|
// Snowflake cloud mapping — a LINKED element's Cloud Link + Database/Schema/
|
|
79
82
|
// Table + column-name wiring. Real and round-tripped: elementToTf re-sends
|
|
80
83
|
// it on build (create-only — the table binding is immutable once set).
|
|
@@ -146,7 +149,7 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
146
149
|
ctx.diagnostics.push(`element "${label}": no import block in the stream — adoption has no identity to bind`);
|
|
147
150
|
}
|
|
148
151
|
const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, ownerRefName: refName, scope: "element", ownerType: "ELEMENT_ASPECT" }, ctx);
|
|
149
|
-
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, [], viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "element" }, ctx);
|
|
152
|
+
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, customViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, [], viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "element" }, ctx, viewBlocks.customViewBlocks);
|
|
150
153
|
if (viewBlocks.recordCreateFormBlocks.length > 1) {
|
|
151
154
|
ctx.diagnostics.push(`element "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
|
|
152
155
|
}
|
|
@@ -169,6 +172,11 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
169
172
|
accessPolicies.push(entry);
|
|
170
173
|
}
|
|
171
174
|
const roles = rolesFromTf(roleBlocks, accessPolicyOwner, ctx);
|
|
175
|
+
const auditFields = referencesElementAuditFields(label, [
|
|
176
|
+
...Object.values(viewBlocks).flatMap((blocks) => blocks ?? []),
|
|
177
|
+
...accessPolicyBlocks,
|
|
178
|
+
...roleBlocks,
|
|
179
|
+
], new Set(fields.map(({ field }) => field.name.toLowerCase())));
|
|
172
180
|
const element = {
|
|
173
181
|
id: elementId ?? "",
|
|
174
182
|
name,
|
|
@@ -186,11 +194,14 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
186
194
|
...(cloudOptions !== undefined && { cloudOptions }),
|
|
187
195
|
...(cloudConnection !== undefined && { cloudConnection }),
|
|
188
196
|
...(commentsEnabled !== undefined && { commentsEnabled }),
|
|
197
|
+
...(autoShare !== undefined && { autoShare }),
|
|
198
|
+
...(auditFields && { auditFields }),
|
|
189
199
|
...(layouts.length > 0 && { layouts }),
|
|
190
200
|
...(listViews.length > 0 && { listViews }),
|
|
191
201
|
...(calendarViews.length > 0 && { calendarViews }),
|
|
192
202
|
...(kanbanViews.length > 0 && { kanbanViews }),
|
|
193
203
|
...(dashboardViews.length > 0 && { dashboardViews }),
|
|
204
|
+
...(customViews.length > 0 && { customViews }),
|
|
194
205
|
...(dashboards.length > 0 && { dashboards }),
|
|
195
206
|
...(widgets.length > 0 && { widgets }),
|
|
196
207
|
...(recordCreateForm !== undefined && { recordCreateForm }),
|
|
@@ -205,3 +216,53 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
205
216
|
function systemEntry(key, name, type, tag, description) {
|
|
206
217
|
return { key, field: { id: "", name, type, tags: [tag], ...(description !== undefined && { description }) } };
|
|
207
218
|
}
|
|
219
|
+
const AUDIT_TRIGGER_REF_NAME = /^(?:Created|Updated) (?:At|On|By)\b/i;
|
|
220
|
+
/**
|
|
221
|
+
* The export references an element's audit fields only when the platform
|
|
222
|
+
* gave it those fields, which EDK cannot otherwise observe: through its
|
|
223
|
+
* `<label>_(created|updated)_(at|by)_field_id` locals, or, in the element's
|
|
224
|
+
* own automations, through a trigger's Created/Updated outputs. Locals
|
|
225
|
+
* blocks are skipped by callers: `ei` defines those locals on every element.
|
|
226
|
+
* An authored field with the same display name wins over trigger-output
|
|
227
|
+
* heuristics.
|
|
228
|
+
*/
|
|
229
|
+
export function referencesElementAuditFields(label, blocks, authoredFieldNames = new Set()) {
|
|
230
|
+
const auditLocal = new RegExp(`^${label}_(?:created|updated)_(?:at|by)_field_id$`);
|
|
231
|
+
const ownedTriggers = elementTriggerAddresses(label, blocks);
|
|
232
|
+
const visit = (value) => {
|
|
233
|
+
if (Array.isArray(value))
|
|
234
|
+
return value.some(visit);
|
|
235
|
+
if (typeof value !== "object" || value === null)
|
|
236
|
+
return false;
|
|
237
|
+
const node = value;
|
|
238
|
+
if (node["$expr"] === "local" && typeof node["name"] === "string" && auditLocal.test(node["name"]))
|
|
239
|
+
return true;
|
|
240
|
+
if (node["$expr"] === "resource-attr" && ownedTriggers.has(`${String(node["type"])}.${String(node["label"])}`)) {
|
|
241
|
+
const path = node["path"];
|
|
242
|
+
const index = path?.[1]?.index;
|
|
243
|
+
if (path?.[0] === "refs" &&
|
|
244
|
+
typeof index === "string" &&
|
|
245
|
+
AUDIT_TRIGGER_REF_NAME.test(index) &&
|
|
246
|
+
!authoredFieldNames.has(index.toLowerCase()))
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
return Object.values(node).some(visit);
|
|
250
|
+
};
|
|
251
|
+
return blocks.some((block) => block.kind !== "locals" && visit(block.attrs));
|
|
252
|
+
}
|
|
253
|
+
/** `<type>.<label>` of the triggers on automations whose `app_id` is this element. */
|
|
254
|
+
function elementTriggerAddresses(label, blocks) {
|
|
255
|
+
const isResource = (value, type, labels) => {
|
|
256
|
+
const node = value;
|
|
257
|
+
return typeof node === "object" && node !== null && node["$expr"] === "resource-attr" && node["type"] === type &&
|
|
258
|
+
typeof node["label"] === "string" && (labels === undefined ? node["label"] === label : labels.has(node["label"]));
|
|
259
|
+
};
|
|
260
|
+
const automations = new Set(blocks.flatMap((block) => block.kind === "resource" && block.type === "elementum_automation" && block.label !== undefined &&
|
|
261
|
+
isResource(block.attrs["app_id"], "elementum_element")
|
|
262
|
+
? [block.label]
|
|
263
|
+
: []));
|
|
264
|
+
return new Set(blocks.flatMap((block) => block.kind === "resource" && block.type?.endsWith("_trigger") === true &&
|
|
265
|
+
isResource(block.attrs["automation"], "elementum_automation", automations)
|
|
266
|
+
? [`${block.type}.${block.label}`]
|
|
267
|
+
: []));
|
|
268
|
+
}
|