@elementumai/edk 0.8.0-preview.11 → 0.8.2-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +510 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +83 -4
- package/dist-sdk/src/catalog/from-authoring.js +19 -2
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +134 -50
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +18 -0
- package/dist-sdk/src/catalog/types.d.ts +75 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +58 -0
- package/dist-sdk/src/engine/build/context.js +11 -1
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +54 -0
- package/dist-sdk/src/engine/tf/labels.js +75 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +15 -0
- package/dist-sdk/src/engine/tf/parse.js +162 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +66 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +187 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +43 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +164 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/build.d.ts +2 -0
- package/dist-sdk/src/entities/agent/build.js +1 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +257 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +29 -9
- package/dist-sdk/src/entities/agent/from-tf.js +146 -19
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +14 -4
- package/dist-sdk/src/entities/agent/to-tf.d.ts +46 -1
- package/dist-sdk/src/entities/agent/to-tf.js +160 -14
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +64 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.js +14 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.d.ts +40 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +47 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +176 -30
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +91 -13
- package/dist-sdk/src/entities/app/build.js +63 -5
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -22
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +10 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +45 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +62 -42
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +206 -47
- package/dist-sdk/src/entities/automation/filter.d.ts +37 -3
- package/dist-sdk/src/entities/automation/filter.js +54 -3
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1344 -222
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1291 -230
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +44 -13
- package/dist-sdk/src/entities/element/build.js +45 -3
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +28 -14
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +26 -3
- package/dist-sdk/src/entities/field/build.d.ts +61 -14
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +46 -11
- package/dist-sdk/src/entities/field/to-tf.js +166 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- 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/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +59 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +46 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +128 -11
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +7 -1
- package/dist-sdk/src/entities/skill/to-tf.d.ts +26 -0
- package/dist-sdk/src/entities/skill/to-tf.js +65 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +37 -8
- package/dist-sdk/src/entities/skill/tools.js +43 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +34 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.js +128 -18
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +13 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +164 -25
- package/dist-sdk/src/entities/skill-tool/types.d.ts +5 -7
- package/dist-sdk/src/entities/skill-tool/types.js +47 -11
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +39 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +8 -1
- package/dist-sdk/src/graph/types.d.ts +98 -4
- package/package.json +49 -16
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -69,7 +69,7 @@ type NormalizeSpec<S extends TriggerInputSchemaSpec> = {
|
|
|
69
69
|
type: S[K];
|
|
70
70
|
} : Extract<S[K], TriggerInputFieldDef>;
|
|
71
71
|
};
|
|
72
|
-
export declare function onDemand<S extends TriggerInputSchemaSpec, Options extends OnDemandTriggerOptions =
|
|
72
|
+
export declare function onDemand<S extends TriggerInputSchemaSpec, Options extends OnDemandTriggerOptions = Record<string, never>>(schema: S, options?: Options): TriggerChain<InferTriggerType<NormalizeSpec<S> & TriggerInputSchema, Options>>;
|
|
73
73
|
export interface WebhookTriggerOptions {
|
|
74
74
|
readonly authenticated?: boolean;
|
|
75
75
|
/** Pre-built wire custom-response envelope. */
|
|
@@ -183,6 +183,14 @@ export interface SlackMessageTriggerOutput {
|
|
|
183
183
|
readonly content: string;
|
|
184
184
|
readonly messageId: string;
|
|
185
185
|
readonly meta: Record<string, unknown>;
|
|
186
|
+
/** Compatibility aliases retained for existing automations. */
|
|
187
|
+
readonly slackThreadId: string;
|
|
188
|
+
readonly slackChannelId: string;
|
|
189
|
+
readonly messageAuthorEmail: string;
|
|
190
|
+
readonly messageAuthorId: string;
|
|
191
|
+
readonly messageAuthorName: string;
|
|
192
|
+
readonly messageContent: string;
|
|
193
|
+
readonly messageMetadata: Record<string, unknown>;
|
|
186
194
|
}
|
|
187
195
|
/** Fires when a Slack message is received. */
|
|
188
196
|
export declare function slackMessage(): TriggerChain<SlackMessageTriggerOutput>;
|
|
@@ -31,12 +31,17 @@ export declare const WORKFLOW_PUBLISH_RESOURCE_TYPE = "elementum_workflow_publis
|
|
|
31
31
|
/** Trigger kinds. One trigger per automation. Phase 1: onDemand only. */
|
|
32
32
|
export declare const TRIGGER_SUB_TYPES: readonly AutomationSubType[];
|
|
33
33
|
/**
|
|
34
|
-
* Task kinds.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* Task kinds. All rows are implemented as of `aiFileAnalysis` (the last
|
|
35
|
+
* holdout — it needs its `elementum_ai_file_reader` target to also round-trip,
|
|
36
|
+
* see `entities/file-reader/types.ts`). `variable` (setVariable's create
|
|
37
|
+
* form) is the one worth calling out: the tf dialect carries ONE variable per
|
|
38
|
+
* task as variable_name/variable_type/value, and the provider's variable_id
|
|
39
|
+
* is COMPUTED, so the compose-path client UUID never reaches HCL. A future
|
|
40
|
+
* new task kind lands here declared-only first (see the doc comment on
|
|
41
|
+
* {@link ALL_AUTOMATION_TASK_TYPE_SET} below) until its row flips implemented.
|
|
38
42
|
*/
|
|
39
43
|
export declare const TASK_SUB_TYPES: readonly AutomationSubType[];
|
|
44
|
+
export declare const BRANCH_SUB_TYPES: readonly AutomationSubType[];
|
|
40
45
|
export declare const ALL_AUTOMATION_SUB_TYPES: readonly AutomationSubType[];
|
|
41
46
|
export declare const AUTOMATION_SUB_TYPE_BY_TYPE_KEY: ReadonlyMap<string, AutomationSubType>;
|
|
42
47
|
export declare const AUTOMATION_SUB_TYPE_BY_RESOURCE: ReadonlyMap<string, AutomationSubType>;
|
|
@@ -51,3 +56,23 @@ export declare const IMPLEMENTED_TASK_RESOURCE_TYPES: readonly string[];
|
|
|
51
56
|
export declare const IMPLEMENTED_AUTOMATION_RESOURCE_TYPES: readonly string[];
|
|
52
57
|
/** Every declared automation-family resource type — the partition recognizes these by name. */
|
|
53
58
|
export declare const ALL_AUTOMATION_RESOURCE_TYPES: readonly string[];
|
|
59
|
+
export declare const AUTOMATION_RESOURCE_TYPES: readonly string[];
|
|
60
|
+
export declare const AUTOMATION_TRIGGER_TYPES: readonly string[];
|
|
61
|
+
export declare const AUTOMATION_TASK_TYPES: readonly string[];
|
|
62
|
+
export declare const AUTOMATION_BRANCH_TYPES: string[];
|
|
63
|
+
export declare const AUTOMATION_TRIGGER_TYPE_SET: ReadonlySet<string>;
|
|
64
|
+
export declare const AUTOMATION_TASK_TYPE_SET: ReadonlySet<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Every DECLARED task resource type, implemented or not — for from-tf's graph
|
|
67
|
+
* walk (which task blocks belong to this automation's tree) and its
|
|
68
|
+
* dependency-recognition checks. Deliberately broader than
|
|
69
|
+
* {@link AUTOMATION_TASK_TYPE_SET} (implemented-only, the adoption/build-vs-export
|
|
70
|
+
* scope): a declared-but-unimplemented type (none currently declared — a
|
|
71
|
+
* future new task kind lands here first, before its row flips implemented)
|
|
72
|
+
* must still be walked into the task graph so from-tf's own dedicated
|
|
73
|
+
* diagnostic for it fires, rather than the block silently falling out of the
|
|
74
|
+
* graph and surfacing as an unrelated "unresolved parent"/"orphaned task"
|
|
75
|
+
* error.
|
|
76
|
+
*/
|
|
77
|
+
export declare const ALL_AUTOMATION_TASK_TYPE_SET: ReadonlySet<string>;
|
|
78
|
+
export declare const AUTOMATION_BRANCH_TYPE_SET: ReadonlySet<string>;
|
|
@@ -23,60 +23,69 @@ export const WORKFLOW_PUBLISH_RESOURCE_TYPE = "elementum_workflow_publish";
|
|
|
23
23
|
/** Trigger kinds. One trigger per automation. Phase 1: onDemand only. */
|
|
24
24
|
export const TRIGGER_SUB_TYPES = [
|
|
25
25
|
{ typeKey: "onDemand", resourceType: "elementum_on_demand_trigger", implemented: true },
|
|
26
|
-
{ typeKey: "createRecord", resourceType: "elementum_record_created_trigger" },
|
|
27
|
-
{ typeKey: "updateRecord", resourceType: "elementum_record_updated_trigger" },
|
|
28
|
-
{ typeKey: "webhook", resourceType: "elementum_webhook_trigger" },
|
|
29
|
-
{ typeKey: "approvalChain", resourceType: "elementum_approval_chain_trigger" },
|
|
30
|
-
{ typeKey: "attachment", resourceType: "elementum_attachment_added_trigger" },
|
|
31
|
-
{ typeKey: "datamine", resourceType: "elementum_datamine_trigger" },
|
|
32
|
-
{ typeKey: "emailReceived", resourceType: "elementum_email_ingestion_trigger" },
|
|
33
|
-
{ typeKey: "commentAdded", resourceType: "elementum_comment_added_trigger" },
|
|
34
|
-
{ typeKey: "conversationEnd", resourceType: "elementum_agent_conversation_ended_trigger" },
|
|
35
|
-
{ typeKey: "slackMessage", resourceType: "elementum_slack_message_trigger" },
|
|
26
|
+
{ typeKey: "createRecord", resourceType: "elementum_record_created_trigger", implemented: true },
|
|
27
|
+
{ typeKey: "updateRecord", resourceType: "elementum_record_updated_trigger", implemented: true },
|
|
28
|
+
{ typeKey: "webhook", resourceType: "elementum_webhook_trigger", implemented: true },
|
|
29
|
+
{ typeKey: "approvalChain", resourceType: "elementum_approval_chain_trigger", implemented: true },
|
|
30
|
+
{ typeKey: "attachment", resourceType: "elementum_attachment_added_trigger", implemented: true },
|
|
31
|
+
{ typeKey: "datamine", resourceType: "elementum_datamine_trigger", implemented: true },
|
|
32
|
+
{ typeKey: "emailReceived", resourceType: "elementum_email_ingestion_trigger", implemented: true },
|
|
33
|
+
{ typeKey: "commentAdded", resourceType: "elementum_comment_added_trigger", implemented: true },
|
|
34
|
+
{ typeKey: "conversationEnd", resourceType: "elementum_agent_conversation_ended_trigger", implemented: true },
|
|
35
|
+
{ typeKey: "slackMessage", resourceType: "elementum_slack_message_trigger", implemented: true },
|
|
36
|
+
{ typeKey: "survey", resourceType: "elementum_survey_trigger", implemented: true },
|
|
36
37
|
];
|
|
37
38
|
/**
|
|
38
|
-
* Task kinds.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Task kinds. All rows are implemented as of `aiFileAnalysis` (the last
|
|
40
|
+
* holdout — it needs its `elementum_ai_file_reader` target to also round-trip,
|
|
41
|
+
* see `entities/file-reader/types.ts`). `variable` (setVariable's create
|
|
42
|
+
* form) is the one worth calling out: the tf dialect carries ONE variable per
|
|
43
|
+
* task as variable_name/variable_type/value, and the provider's variable_id
|
|
44
|
+
* is COMPUTED, so the compose-path client UUID never reaches HCL. A future
|
|
45
|
+
* new task kind lands here declared-only first (see the doc comment on
|
|
46
|
+
* {@link ALL_AUTOMATION_TASK_TYPE_SET} below) until its row flips implemented.
|
|
42
47
|
*/
|
|
43
48
|
export const TASK_SUB_TYPES = [
|
|
44
49
|
{ typeKey: "executeScript", resourceType: "elementum_execute_script_task", implemented: true },
|
|
45
50
|
{ typeKey: "variable", resourceType: "elementum_variable_task", implemented: true },
|
|
46
|
-
|
|
47
|
-
{ typeKey: "
|
|
48
|
-
{ typeKey: "
|
|
49
|
-
{ typeKey: "
|
|
50
|
-
{ typeKey: "
|
|
51
|
-
{ typeKey: "
|
|
52
|
-
{ typeKey: "
|
|
53
|
-
{ typeKey: "
|
|
54
|
-
{ typeKey: "
|
|
55
|
-
{ typeKey: "
|
|
56
|
-
{ typeKey: "
|
|
57
|
-
{ typeKey: "
|
|
58
|
-
{ typeKey: "
|
|
59
|
-
{ typeKey: "
|
|
60
|
-
{ typeKey: "
|
|
61
|
-
{ typeKey: "
|
|
62
|
-
{ typeKey: "
|
|
63
|
-
{ typeKey: "
|
|
64
|
-
{ typeKey: "
|
|
65
|
-
{ typeKey: "
|
|
66
|
-
{ typeKey: "
|
|
67
|
-
{ typeKey: "
|
|
68
|
-
{ typeKey: "
|
|
69
|
-
{ typeKey: "
|
|
70
|
-
{ typeKey: "
|
|
71
|
-
{ typeKey: "
|
|
72
|
-
{ typeKey: "
|
|
73
|
-
{ typeKey: "
|
|
51
|
+
{ typeKey: "updateVariable", resourceType: "elementum_update_variable_task", implemented: true },
|
|
52
|
+
{ typeKey: "updateField", resourceType: "elementum_update_field_task", implemented: true },
|
|
53
|
+
{ typeKey: "recordSearch", resourceType: "elementum_record_search_task", implemented: true },
|
|
54
|
+
{ typeKey: "tableRecordsSearch", resourceType: "elementum_table_records_search_task", implemented: true },
|
|
55
|
+
{ typeKey: "createRecord", resourceType: "elementum_create_record_task", implemented: true },
|
|
56
|
+
{ typeKey: "findRelatedRecords", resourceType: "elementum_find_related_records_task", implemented: true },
|
|
57
|
+
{ typeKey: "relateRecords", resourceType: "elementum_relate_records_task", implemented: true },
|
|
58
|
+
{ typeKey: "sendEmail", resourceType: "elementum_send_email_task", implemented: true },
|
|
59
|
+
{ typeKey: "message", resourceType: "elementum_message_task", implemented: true },
|
|
60
|
+
{ typeKey: "notification", resourceType: "elementum_notification_task", implemented: true },
|
|
61
|
+
{ typeKey: "aiAgent", resourceType: "elementum_ai_agent_task", implemented: true },
|
|
62
|
+
{ typeKey: "aiClassify", resourceType: "elementum_ai_classify_task", implemented: true },
|
|
63
|
+
{ typeKey: "aiSummarize", resourceType: "elementum_ai_summarize_task", implemented: true },
|
|
64
|
+
{ typeKey: "aiTransform", resourceType: "elementum_ai_transform_task", implemented: true },
|
|
65
|
+
{ typeKey: "aiSearchTable", resourceType: "elementum_ai_search_table_task", implemented: true },
|
|
66
|
+
{ typeKey: "aiFileAnalysis", resourceType: "elementum_ai_file_read_task", implemented: true },
|
|
67
|
+
{ typeKey: "api", resourceType: "elementum_api_task", implemented: true },
|
|
68
|
+
{ typeKey: "calculation", resourceType: "elementum_calculation_task", implemented: true },
|
|
69
|
+
{ typeKey: "procedure", resourceType: "elementum_procedure_task", implemented: true },
|
|
70
|
+
{ typeKey: "runAutomation", resourceType: "elementum_run_automation_task", implemented: true },
|
|
71
|
+
{ typeKey: "documentModel", resourceType: "elementum_file_reader_task", implemented: true },
|
|
72
|
+
{ typeKey: "approvalChain", resourceType: "elementum_approval_chain_task", implemented: true },
|
|
73
|
+
{ typeKey: "approvalStatusUpdate", resourceType: "elementum_approval_status_update_task", implemented: true },
|
|
74
|
+
{ typeKey: "addWatcher", resourceType: "elementum_add_watcher_task", implemented: true },
|
|
75
|
+
{ typeKey: "saveAttachment", resourceType: "elementum_save_attachment_task", implemented: true },
|
|
76
|
+
{ typeKey: "userSearch", resourceType: "elementum_user_search_task", implemented: true },
|
|
77
|
+
{ typeKey: "aspectRecordFieldLocking", resourceType: "elementum_aspect_record_field_locking_task", implemented: true },
|
|
78
|
+
{ typeKey: "initiateCall", resourceType: "elementum_initiate_call_task", implemented: true },
|
|
74
79
|
// Operators (branching) — later phases:
|
|
75
|
-
{ typeKey: "forEach", resourceType: "elementum_for_each_task" },
|
|
76
|
-
{ typeKey: "forkJoin", resourceType: "elementum_fork_join_task" },
|
|
77
|
-
{ typeKey: "switch", resourceType: "elementum_switch_task" },
|
|
80
|
+
{ typeKey: "forEach", resourceType: "elementum_for_each_task", implemented: true },
|
|
81
|
+
{ typeKey: "forkJoin", resourceType: "elementum_fork_join_task", implemented: true },
|
|
82
|
+
{ typeKey: "switch", resourceType: "elementum_switch_task", implemented: true },
|
|
78
83
|
];
|
|
79
|
-
export const
|
|
84
|
+
export const BRANCH_SUB_TYPES = [
|
|
85
|
+
{ typeKey: "switchCase", resourceType: "elementum_switch_case", implemented: true },
|
|
86
|
+
{ typeKey: "forkJoinBranch", resourceType: "elementum_fork_join_branch", implemented: true },
|
|
87
|
+
];
|
|
88
|
+
export const ALL_AUTOMATION_SUB_TYPES = [...TRIGGER_SUB_TYPES, ...TASK_SUB_TYPES, ...BRANCH_SUB_TYPES];
|
|
80
89
|
export const AUTOMATION_SUB_TYPE_BY_TYPE_KEY = new Map(ALL_AUTOMATION_SUB_TYPES.map((t) => [t.typeKey, t]));
|
|
81
90
|
export const AUTOMATION_SUB_TYPE_BY_RESOURCE = new Map(ALL_AUTOMATION_SUB_TYPES.map((t) => [t.resourceType, t]));
|
|
82
91
|
/** Trigger/task resource types the terraform path round-trips today. */
|
|
@@ -92,6 +101,7 @@ export const IMPLEMENTED_AUTOMATION_RESOURCE_TYPES = [
|
|
|
92
101
|
WORKFLOW_PUBLISH_RESOURCE_TYPE,
|
|
93
102
|
...IMPLEMENTED_TRIGGER_RESOURCE_TYPES,
|
|
94
103
|
...IMPLEMENTED_TASK_RESOURCE_TYPES,
|
|
104
|
+
...BRANCH_SUB_TYPES.map((t) => t.resourceType),
|
|
95
105
|
];
|
|
96
106
|
/** Every declared automation-family resource type — the partition recognizes these by name. */
|
|
97
107
|
export const ALL_AUTOMATION_RESOURCE_TYPES = [
|
|
@@ -99,3 +109,23 @@ export const ALL_AUTOMATION_RESOURCE_TYPES = [
|
|
|
99
109
|
WORKFLOW_PUBLISH_RESOURCE_TYPE,
|
|
100
110
|
...ALL_AUTOMATION_SUB_TYPES.map((t) => t.resourceType),
|
|
101
111
|
];
|
|
112
|
+
export const AUTOMATION_RESOURCE_TYPES = IMPLEMENTED_AUTOMATION_RESOURCE_TYPES;
|
|
113
|
+
export const AUTOMATION_TRIGGER_TYPES = IMPLEMENTED_TRIGGER_RESOURCE_TYPES;
|
|
114
|
+
export const AUTOMATION_TASK_TYPES = IMPLEMENTED_TASK_RESOURCE_TYPES;
|
|
115
|
+
export const AUTOMATION_BRANCH_TYPES = BRANCH_SUB_TYPES.map((t) => t.resourceType);
|
|
116
|
+
export const AUTOMATION_TRIGGER_TYPE_SET = new Set(AUTOMATION_TRIGGER_TYPES);
|
|
117
|
+
export const AUTOMATION_TASK_TYPE_SET = new Set(AUTOMATION_TASK_TYPES);
|
|
118
|
+
/**
|
|
119
|
+
* Every DECLARED task resource type, implemented or not — for from-tf's graph
|
|
120
|
+
* walk (which task blocks belong to this automation's tree) and its
|
|
121
|
+
* dependency-recognition checks. Deliberately broader than
|
|
122
|
+
* {@link AUTOMATION_TASK_TYPE_SET} (implemented-only, the adoption/build-vs-export
|
|
123
|
+
* scope): a declared-but-unimplemented type (none currently declared — a
|
|
124
|
+
* future new task kind lands here first, before its row flips implemented)
|
|
125
|
+
* must still be walked into the task graph so from-tf's own dedicated
|
|
126
|
+
* diagnostic for it fires, rather than the block silently falling out of the
|
|
127
|
+
* graph and surfacing as an unrelated "unresolved parent"/"orphaned task"
|
|
128
|
+
* error.
|
|
129
|
+
*/
|
|
130
|
+
export const ALL_AUTOMATION_TASK_TYPE_SET = new Set(TASK_SUB_TYPES.map((t) => t.resourceType));
|
|
131
|
+
export const AUTOMATION_BRANCH_TYPE_SET = new Set(AUTOMATION_BRANCH_TYPES);
|
|
@@ -24,9 +24,18 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { type AspectRef, type CloudLinkRef, type FieldRef } from "../../catalog/index.js";
|
|
26
26
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
27
|
+
import type { AccessPolicyOptions } from "../access-policy/build.js";
|
|
27
28
|
import { type DisplayBlock } from "../app/display-blocks.js";
|
|
28
|
-
import { type AppCategory, type AppCloudOptions, type AppField, type AppLayout, type AppListView } from "../app/build.js";
|
|
29
|
-
export type { AppCategory, AppField, AppLayout, AppListView, PicklistOption } from "../app/build.js";
|
|
29
|
+
import { type AppCategory, type AppCloudOptions, type AppField, type AppFieldRefs, type AppLayout, type AppListView, type AppSystemFieldOverride } from "../app/build.js";
|
|
30
|
+
export type { AppCategory, AppField, AppLayout, AppListView, AppSystemFieldOverride, PicklistOption } from "../app/build.js";
|
|
31
|
+
/** The system fields elements actually have (per `locals.ts`) — unlike apps, no status/stage/audit fields. */
|
|
32
|
+
export type ElementSystemFieldKey = "id" | "title";
|
|
33
|
+
export declare const ELEMENT_SYSTEM_FIELD_KEYS: readonly ElementSystemFieldKey[];
|
|
34
|
+
/** Overrides for an element's platform-owned `id`/`title` fields — see `AppSystemFields` for the full rationale. */
|
|
35
|
+
export interface ElementSystemFields {
|
|
36
|
+
readonly id?: AppSystemFieldOverride;
|
|
37
|
+
readonly title?: AppSystemFieldOverride;
|
|
38
|
+
}
|
|
30
39
|
/**
|
|
31
40
|
* The source table a LINKED element maps to — an existing table in the
|
|
32
41
|
* customer's cloud database, vs. a STANDARD element (no `cloudConnection`),
|
|
@@ -47,7 +56,7 @@ export interface ElementCloudConnection {
|
|
|
47
56
|
/** The record-id source column on the mapped table. */
|
|
48
57
|
readonly idColumnName?: string;
|
|
49
58
|
}
|
|
50
|
-
export interface ElementV2Options extends EntityDeployOptions {
|
|
59
|
+
export interface ElementV2Options<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> extends EntityDeployOptions {
|
|
51
60
|
/** The platform's aspect handle (business acronym, e.g. "PRD") — distinct from the refName. Omit to let the platform assign one. */
|
|
52
61
|
readonly handle?: string;
|
|
53
62
|
readonly name: string;
|
|
@@ -69,13 +78,19 @@ export interface ElementV2Options extends EntityDeployOptions {
|
|
|
69
78
|
/** Whether the comments display block is enabled. Omit to leave the platform's current value alone. */
|
|
70
79
|
readonly commentsEnabled?: boolean;
|
|
71
80
|
/** Fields keyed by ref name. At least one required by the compose API. */
|
|
72
|
-
readonly fields:
|
|
81
|
+
readonly fields: F;
|
|
82
|
+
/**
|
|
83
|
+
* Overrides for the platform's auto-provisioned `id`/`title` fields — the
|
|
84
|
+
* only two system fields an element has (per `locals.ts`, unlike an app's
|
|
85
|
+
* fuller set). Omit entirely to keep the deploy defaults.
|
|
86
|
+
*/
|
|
87
|
+
readonly systemFields?: ElementSystemFields;
|
|
73
88
|
/**
|
|
74
|
-
* Platform-managed (system) fields that exist on every element but are not authored here
|
|
75
|
-
*
|
|
89
|
+
* Platform-managed (system) fields that exist on every element but are not authored here.
|
|
90
|
+
* These flow into `ref().fields` so other entities can reference them by typed
|
|
76
91
|
* handle, but are **never included in the deploy payload** (the platform owns them).
|
|
77
92
|
*/
|
|
78
|
-
readonly readonlyFields?:
|
|
93
|
+
readonly readonlyFields?: R;
|
|
79
94
|
/** Record-view (LAYOUT surface) display blocks. */
|
|
80
95
|
readonly displayBlocks?: readonly DisplayBlock[];
|
|
81
96
|
/** New-record form (CREATE surface) display blocks. */
|
|
@@ -89,10 +104,26 @@ export interface ElementV2Options extends EntityDeployOptions {
|
|
|
89
104
|
readonly listViews?: Readonly<Record<string, AppListView>>;
|
|
90
105
|
/** Display order of `listViews` (by key). Defaults to declaration order. */
|
|
91
106
|
readonly viewOrder?: readonly string[];
|
|
107
|
+
/**
|
|
108
|
+
* Element-level sharing & row-level-security policies (`elementum_access_policy`), in declaration order.
|
|
109
|
+
* Creating the element also has the platform mint a separate creator policy
|
|
110
|
+
* (the creating user, typically `whereTrue`) that is not authored here.
|
|
111
|
+
*/
|
|
112
|
+
readonly accessPolicies?: readonly AccessPolicyOptions[];
|
|
92
113
|
}
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
114
|
+
/**
|
|
115
|
+
* An element's reference surface: identity plus its fields (the only bag
|
|
116
|
+
* other entities may point at). Generic over the authored `fields:` bag
|
|
117
|
+
* (`F`) and `readonlyFields:` bag (`R`) — see `AppRef` in
|
|
118
|
+
* `entities/app/build.ts` for the full rationale, including why `R`'s
|
|
119
|
+
* default is `Record<never, never>` rather than a wide `Record<string,
|
|
120
|
+
* FieldRef>` (a `string`-keyed index signature anywhere here poisons
|
|
121
|
+
* `DeepRef`'s downstream re-mapping for `ctx.trigger.record`/`ctx.tasks.<t>.
|
|
122
|
+
* record`). `id`/`title` round out the bag the same way `AppRef` folds in
|
|
123
|
+
* its full `SystemFieldKey` set — a finite, closed term, not a wide index.
|
|
124
|
+
*/
|
|
125
|
+
export type ElementRef<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> = AspectRef & {
|
|
126
|
+
readonly fields: AppFieldRefs<F> & Record<ElementSystemFieldKey, FieldRef> & R;
|
|
96
127
|
};
|
|
97
128
|
/**
|
|
98
129
|
* The configured result of `defineElement` — its reference surface (`ref()`)
|
|
@@ -100,9 +131,9 @@ export type ElementRef = AspectRef & {
|
|
|
100
131
|
* argument**, not a constructor option — see `AppConfigured` in
|
|
101
132
|
* `src/aspects/build.ts` for the full rationale (identical here).
|
|
102
133
|
*/
|
|
103
|
-
export interface ElementConfigured {
|
|
104
|
-
ref(refName: string): ElementRef
|
|
134
|
+
export interface ElementConfigured<F extends Record<string, AppField> = Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>> {
|
|
135
|
+
ref(refName: string): ElementRef<F, R>;
|
|
105
136
|
def(refName: string): DeployableEntity;
|
|
106
137
|
}
|
|
107
138
|
/** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
|
|
108
|
-
export declare function defineElement(opts: ElementV2Options): ElementConfigured
|
|
139
|
+
export declare function defineElement<F extends Record<string, AppField>, R extends Record<string, FieldRef> = Record<never, never>>(opts: ElementV2Options<F, R>): ElementConfigured<F, R>;
|
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
* them.
|
|
24
24
|
*/
|
|
25
25
|
import { slimTokens } from "../../catalog/index.js";
|
|
26
|
+
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY } from "../../core/system-fields.js";
|
|
26
27
|
import { serializeDisplayBlocks } from "../app/display-blocks.js";
|
|
27
|
-
import { serializeField, } from "../app/build.js";
|
|
28
|
+
import { assertNoSystemKeyCollision, serializeField, } from "../app/build.js";
|
|
29
|
+
export const ELEMENT_SYSTEM_FIELD_KEYS = ["id", "title"];
|
|
28
30
|
/**
|
|
29
31
|
* Client-side validation for `defineElement` — the authoring-time home for
|
|
30
32
|
* element validation rules, so a malformed definition fails at define time
|
|
@@ -43,6 +45,23 @@ function validateElementOptions(opts) {
|
|
|
43
45
|
throw new Error(`defineElement "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
/** Serialize authored `systemFields` overrides into compose entries — mirrors `serializeSystemFields` in `app/build.ts`, scoped to id/title (no picklist branch needed). */
|
|
49
|
+
function serializeElementSystemFields(overrides) {
|
|
50
|
+
if (overrides === undefined)
|
|
51
|
+
return [];
|
|
52
|
+
return ELEMENT_SYSTEM_FIELD_KEYS.filter((key) => overrides[key] !== undefined).map((key) => {
|
|
53
|
+
const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
|
|
54
|
+
const override = overrides[key];
|
|
55
|
+
const field = {
|
|
56
|
+
name: override.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key],
|
|
57
|
+
type: key === "id" ? "HANDLE" : "TEXT",
|
|
58
|
+
required: SYSTEM_FIELD_REQUIRED[key],
|
|
59
|
+
tags: [tag],
|
|
60
|
+
...(override.description !== undefined ? { description: override.description } : {}),
|
|
61
|
+
};
|
|
62
|
+
return serializeField(field, key);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
46
65
|
/** Build a v2 element entity: org-owned, compose-body payload. Exposes `.ref(refName)` and `.def(refName)`. */
|
|
47
66
|
export function defineElement(opts) {
|
|
48
67
|
validateElementOptions(opts);
|
|
@@ -63,18 +82,37 @@ export function defineElement(opts) {
|
|
|
63
82
|
refName: bagKey,
|
|
64
83
|
name: field.name,
|
|
65
84
|
parent: refName,
|
|
85
|
+
parentKind: "element",
|
|
86
|
+
parentName: opts.name,
|
|
66
87
|
fieldType: field.type,
|
|
67
88
|
...(field.tags !== undefined ? { tags: field.tags } : {}),
|
|
68
89
|
};
|
|
69
90
|
}
|
|
70
91
|
if (opts.readonlyFields !== undefined) {
|
|
71
92
|
for (const [bagKey, ref] of Object.entries(opts.readonlyFields)) {
|
|
72
|
-
fields[bagKey] = { ...ref, refName: bagKey, parent: refName };
|
|
93
|
+
fields[bagKey] = { ...ref, refName: bagKey, parent: refName, parentKind: "element", parentName: opts.name };
|
|
73
94
|
}
|
|
74
95
|
}
|
|
96
|
+
for (const key of ELEMENT_SYSTEM_FIELD_KEYS) {
|
|
97
|
+
if (fields[key] !== undefined)
|
|
98
|
+
continue;
|
|
99
|
+
const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
|
|
100
|
+
const override = opts.systemFields?.[key];
|
|
101
|
+
fields[key] = {
|
|
102
|
+
__kind: "field",
|
|
103
|
+
refName: key,
|
|
104
|
+
name: override?.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key],
|
|
105
|
+
parent: refName,
|
|
106
|
+
parentKind: "element",
|
|
107
|
+
parentName: opts.name,
|
|
108
|
+
fieldType: key === "id" ? "HANDLE" : "TEXT",
|
|
109
|
+
tags: [tag],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
75
112
|
return { __kind: "element", refName: refName, name: opts.name, fields };
|
|
76
113
|
},
|
|
77
114
|
def(refName) {
|
|
115
|
+
assertNoSystemKeyCollision("defineElement", opts.name, opts.fields, opts.systemFields);
|
|
78
116
|
const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
|
|
79
117
|
const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
|
|
80
118
|
const payload = {
|
|
@@ -90,12 +128,16 @@ export function defineElement(opts) {
|
|
|
90
128
|
...(opts.cloudOptions !== undefined ? { cloudOptions: opts.cloudOptions } : {}),
|
|
91
129
|
...(opts.cloudConnection !== undefined ? { cloudConnection: opts.cloudConnection } : {}),
|
|
92
130
|
...(opts.commentsEnabled !== undefined ? { commentsEnabled: opts.commentsEnabled } : {}),
|
|
93
|
-
fields:
|
|
131
|
+
fields: [
|
|
132
|
+
...serializeElementSystemFields(opts.systemFields),
|
|
133
|
+
...Object.entries(opts.fields).map(([bagKey, field]) => serializeField(field, bagKey)),
|
|
134
|
+
],
|
|
94
135
|
...(displayBlocks !== undefined ? { displayBlocks } : {}),
|
|
95
136
|
...(recordCreateDisplayBlocks !== undefined ? { recordCreateDisplayBlocks } : {}),
|
|
96
137
|
...(opts.layouts !== undefined ? { layouts: opts.layouts } : {}),
|
|
97
138
|
...(opts.listViews !== undefined ? { listViews: opts.listViews } : {}),
|
|
98
139
|
...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
|
|
140
|
+
...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
|
|
99
141
|
};
|
|
100
142
|
return {
|
|
101
143
|
kind: "element",
|
|
@@ -16,4 +16,4 @@ export interface ElementFromTfViewBlocks {
|
|
|
16
16
|
readonly listViewBlocks: readonly TfBlock[];
|
|
17
17
|
readonly managedViewOrderBlocks: readonly TfBlock[];
|
|
18
18
|
}
|
|
19
|
-
export declare function elementFromTf(elementBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: ElementFromTfViewBlocks): ElementFromTfResult;
|
|
19
|
+
export declare function elementFromTf(elementBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: ElementFromTfViewBlocks, accessPolicyBlocks?: readonly TfBlock[]): ElementFromTfResult;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { EntityTfError } from "../../engine/entity.js";
|
|
7
7
|
import { dataRefLabel, optionalBoolean, optionalString } from "../../engine/pull/context.js";
|
|
8
8
|
import { tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
9
|
+
import { accessPolicyFromTf } from "../access-policy/from-tf.js";
|
|
9
10
|
import { fieldFromTf } from "../field/from-tf.js";
|
|
10
11
|
import { viewsFromTf } from "../view/from-tf.js";
|
|
11
12
|
import { ELEMENT_RESOURCE_TYPE } from "./module.js";
|
|
@@ -35,7 +36,7 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
35
36
|
layoutBlocks: [],
|
|
36
37
|
listViewBlocks: [],
|
|
37
38
|
managedViewOrderBlocks: [],
|
|
38
|
-
}) {
|
|
39
|
+
}, accessPolicyBlocks = []) {
|
|
39
40
|
const label = elementBlock.label;
|
|
40
41
|
if (label === undefined || label === "") {
|
|
41
42
|
throw new EntityTfError("elementum_element block is missing its label");
|
|
@@ -56,11 +57,8 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
56
57
|
if (handle === undefined) {
|
|
57
58
|
ctx.diagnostics.push(`element "${label}": export stream carries no handle; derived "${label.toUpperCase()}"`);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
ctx.diagnostics.push(`element "${label}": ${key} has no authoring slot yet (systemFields overrides are name only); dropped`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
60
|
+
const titleFieldDescription = optionalString(attrs, "title_field_description", `element "${label}"`, ctx);
|
|
61
|
+
const idFieldDescription = optionalString(attrs, "id_field_description", `element "${label}"`, ctx);
|
|
64
62
|
const commentsEnabled = optionalBoolean(attrs, "comments_enabled", `element "${label}"`, ctx);
|
|
65
63
|
// Snowflake cloud mapping — a LINKED element's Cloud Link + Database/Schema/
|
|
66
64
|
// Table + column-name wiring. Real and round-tripped: elementToTf re-sends
|
|
@@ -112,12 +110,14 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
112
110
|
}
|
|
113
111
|
const fields = [];
|
|
114
112
|
const titleName = optionalString(attrs, "title_field_name", `element "${label}"`, ctx);
|
|
115
|
-
if (titleName !== undefined)
|
|
116
|
-
fields.push(systemEntry("title", titleName, "TEXT", "TITLE"));
|
|
113
|
+
if (titleName !== undefined || titleFieldDescription !== undefined) {
|
|
114
|
+
fields.push(systemEntry("title", titleName ?? "Title", "TEXT", "TITLE", titleFieldDescription));
|
|
115
|
+
}
|
|
117
116
|
const idName = optionalString(attrs, "id_field_name", `element "${label}"`, ctx);
|
|
118
|
-
if (idName !== undefined)
|
|
119
|
-
fields.push(systemEntry("id", idName, "TEXT", "HANDLE"));
|
|
120
|
-
|
|
117
|
+
if (idName !== undefined || idFieldDescription !== undefined) {
|
|
118
|
+
fields.push(systemEntry("id", idName ?? "ID", "TEXT", "HANDLE", idFieldDescription));
|
|
119
|
+
}
|
|
120
|
+
const owner = { type: ELEMENT_RESOURCE_TYPE, label, scope: "element" };
|
|
121
121
|
for (const block of fieldBlocks) {
|
|
122
122
|
const entry = fieldFromTf(block, owner, ctx);
|
|
123
123
|
if (entry !== undefined)
|
|
@@ -127,7 +127,20 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
127
127
|
if (elementId === undefined) {
|
|
128
128
|
ctx.diagnostics.push(`element "${label}": no import block in the stream — adoption has no identity to bind`);
|
|
129
129
|
}
|
|
130
|
-
const { layouts, listViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label }, ctx);
|
|
130
|
+
const { layouts, listViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.managedViewOrderBlocks, { type: ELEMENT_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "element" }, ctx);
|
|
131
|
+
const accessPolicyOwner = {
|
|
132
|
+
type: ELEMENT_RESOURCE_TYPE,
|
|
133
|
+
label,
|
|
134
|
+
ownerRefName: refName,
|
|
135
|
+
ownerTfLabel: label,
|
|
136
|
+
scope: "element",
|
|
137
|
+
};
|
|
138
|
+
const accessPolicies = [];
|
|
139
|
+
for (const block of accessPolicyBlocks) {
|
|
140
|
+
const entry = accessPolicyFromTf(block, accessPolicyOwner, ctx);
|
|
141
|
+
if (entry !== undefined)
|
|
142
|
+
accessPolicies.push(entry);
|
|
143
|
+
}
|
|
131
144
|
const element = {
|
|
132
145
|
id: elementId ?? "",
|
|
133
146
|
name,
|
|
@@ -147,9 +160,10 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
147
160
|
...(layouts.length > 0 && { layouts }),
|
|
148
161
|
...(listViews.length > 0 && { listViews }),
|
|
149
162
|
...(viewOrder !== undefined && { viewOrder }),
|
|
163
|
+
...(accessPolicies.length > 0 && { accessPolicies }),
|
|
150
164
|
};
|
|
151
165
|
return { element, ...(cloudLinkHandle !== undefined && { cloudLinkHandle }) };
|
|
152
166
|
}
|
|
153
|
-
function systemEntry(key, name, type, tag) {
|
|
154
|
-
return { key, field: { id: "", name, type, tags: [tag] } };
|
|
167
|
+
function systemEntry(key, name, type, tag, description) {
|
|
168
|
+
return { key, field: { id: "", name, type, tags: [tag], ...(description !== undefined && { description }) } };
|
|
155
169
|
}
|
|
@@ -6,4 +6,7 @@
|
|
|
6
6
|
* field/print internals genuinely shared between both aspect kinds).
|
|
7
7
|
*/
|
|
8
8
|
export { defineElement, type ElementCloudConnection, type ElementConfigured, type ElementRef, type ElementV2Options, } from "./build.js";
|
|
9
|
-
export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, textField, userField, type BaseFieldOptions, type NumericFieldOptions, type PicklistFieldOptions, type TextFieldOptions, } from "../field/build.js";
|
|
9
|
+
export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, relationField, textField, userField, type BaseFieldOptions, type NumericFieldOptions, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, } from "../field/build.js";
|
|
10
|
+
export { type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyUserRef } from "../access-policy/build.js";
|
|
11
|
+
export * as accessPolicyFilter from "../access-policy/filter.js";
|
|
12
|
+
export { type AccessPolicyFilter, type AccessPolicyFilterValue, type CurrentUserFilterValue } from "../access-policy/filter.js";
|
|
@@ -6,4 +6,5 @@
|
|
|
6
6
|
* field/print internals genuinely shared between both aspect kinds).
|
|
7
7
|
*/
|
|
8
8
|
export { defineElement, } from "./build.js";
|
|
9
|
-
export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, textField, userField, } from "../field/build.js";
|
|
9
|
+
export { attachmentField, booleanField, dateField, dateTimeField, decimalField, groupField, htmlField, jsonField, multiPicklistField, numberField, picklistField, relationField, textField, userField, } from "../field/build.js";
|
|
10
|
+
export * as accessPolicyFilter from "../access-policy/filter.js";
|
|
@@ -21,11 +21,12 @@ function extractElementStreamRoot(stream, ctx) {
|
|
|
21
21
|
const layoutBlocks = viewBlocks.filter((b) => b.type === LAYOUT_RESOURCE_TYPE);
|
|
22
22
|
const listViewBlocks = viewBlocks.filter((b) => b.type === LIST_VIEW_RESOURCE_TYPE);
|
|
23
23
|
const managedViewOrderBlocks = stream.byKind.get("managed-view-order") ?? [];
|
|
24
|
+
const accessPolicyBlocks = stream.byKind.get("access-policy") ?? [];
|
|
24
25
|
const { element, cloudLinkHandle } = elementFromTf(elementBlocks[0], fieldBlocks, ctx, {
|
|
25
26
|
layoutBlocks,
|
|
26
27
|
listViewBlocks,
|
|
27
28
|
managedViewOrderBlocks,
|
|
28
|
-
});
|
|
29
|
+
}, accessPolicyBlocks);
|
|
29
30
|
return {
|
|
30
31
|
instance: element,
|
|
31
32
|
...(cloudLinkHandle !== undefined && { cloudLinkHandle }),
|
|
@@ -46,9 +47,11 @@ export const elementModule = {
|
|
|
46
47
|
extractStreamRoot: extractElementStreamRoot,
|
|
47
48
|
toTf: (entity, ctx) => {
|
|
48
49
|
const result = elementToTf(entity, {
|
|
50
|
+
appRefName: ctx.appRefName,
|
|
49
51
|
appTfLabel: ctx.appTfLabel,
|
|
50
52
|
orgRefs: ctx.orgRefs,
|
|
51
53
|
diagnostics: ctx.diagnostics,
|
|
54
|
+
workspaceAspects: ctx.workspaceAspects,
|
|
52
55
|
});
|
|
53
56
|
return { blocks: result.blocks, fieldAddresses: result.fieldAddresses };
|
|
54
57
|
},
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { EntityTfError } from "../../engine/entity.js";
|
|
7
7
|
import { expr } from "../../engine/tf/index.js";
|
|
8
|
+
import { accessPolicyToTf } from "../access-policy/to-tf.js";
|
|
8
9
|
import { fieldToTf } from "../field/to-tf.js";
|
|
9
10
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
10
11
|
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
@@ -128,19 +129,41 @@ export function elementToTf(entity, ctx) {
|
|
|
128
129
|
}
|
|
129
130
|
continue;
|
|
130
131
|
}
|
|
131
|
-
const field = fieldToTf(typeKey, inner, {
|
|
132
|
+
const field = fieldToTf(typeKey, inner, {
|
|
133
|
+
ownerTfLabel: ctx.appTfLabel,
|
|
134
|
+
appRefName: ctx.appRefName,
|
|
135
|
+
scope: "element",
|
|
136
|
+
objectId,
|
|
137
|
+
diagnostics: ctx.diagnostics,
|
|
138
|
+
orgRefs: ctx.orgRefs,
|
|
139
|
+
workspaceAspects: ctx.workspaceAspects,
|
|
140
|
+
});
|
|
132
141
|
if (field === undefined)
|
|
133
142
|
continue;
|
|
134
143
|
blocks.push(field.block);
|
|
135
144
|
fieldAddresses.set(field.bagKey, field.address);
|
|
136
145
|
}
|
|
137
146
|
const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.viewOrder, {
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
ownerTfLabel: ctx.appTfLabel,
|
|
148
|
+
scope: "element",
|
|
149
|
+
aspectName: payload.name ?? "",
|
|
140
150
|
objectId,
|
|
141
151
|
diagnostics: ctx.diagnostics,
|
|
142
152
|
});
|
|
143
153
|
blocks.push(...viewBlocks);
|
|
154
|
+
// Authored entries only. Creating an element also has the platform mint a
|
|
155
|
+
// creator policy (userIds = [you]) that is NOT in this payload — pull
|
|
156
|
+
// will see it; we never emit it here.
|
|
157
|
+
for (const [index, entry] of (payload.accessPolicies ?? []).entries()) {
|
|
158
|
+
const { block } = accessPolicyToTf(entry, index, {
|
|
159
|
+
ownerTfLabel: ctx.appTfLabel,
|
|
160
|
+
scope: "element",
|
|
161
|
+
objectId,
|
|
162
|
+
orgRefs: ctx.orgRefs,
|
|
163
|
+
diagnostics: ctx.diagnostics,
|
|
164
|
+
});
|
|
165
|
+
blocks.push(block);
|
|
166
|
+
}
|
|
144
167
|
blocks.unshift({
|
|
145
168
|
kind: "resource",
|
|
146
169
|
type: ELEMENT_RESOURCE_TYPE,
|