@elementumai/edk 0.9.9 → 0.9.11

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.
Files changed (72) hide show
  1. package/dist-sdk/src/catalog/factories.d.ts +8 -1
  2. package/dist-sdk/src/catalog/factories.js +13 -1
  3. package/dist-sdk/src/catalog/index.d.ts +2 -2
  4. package/dist-sdk/src/catalog/index.js +1 -1
  5. package/dist-sdk/src/catalog/types.d.ts +19 -2
  6. package/dist-sdk/src/catalog/types.js +1 -0
  7. package/dist-sdk/src/engine/build/context.d.ts +5 -0
  8. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +3 -3
  9. package/dist-sdk/src/entities/access-policy/from-tf.js +27 -8
  10. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +13 -0
  11. package/dist-sdk/src/entities/access-policy/to-tf.js +34 -3
  12. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +13 -7
  13. package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
  14. package/dist-sdk/src/entities/app/build.d.ts +15 -2
  15. package/dist-sdk/src/entities/app/build.js +6 -0
  16. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +13 -3
  17. package/dist-sdk/src/entities/app/from-tf.js +6 -3
  18. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  19. package/dist-sdk/src/entities/app/to-tf.js +7 -1
  20. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +78 -19
  21. package/dist-sdk/src/entities/automation/from-tf.js +113 -1
  22. package/dist-sdk/src/entities/automation/module.js +1 -0
  23. package/dist-sdk/src/entities/automation/script-code.d.ts +7 -0
  24. package/dist-sdk/src/entities/automation/script-code.js +17 -3
  25. package/dist-sdk/src/entities/automation/tasks.js +17 -0
  26. package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
  27. package/dist-sdk/src/entities/automation/to-tf.js +162 -46
  28. package/dist-sdk/src/entities/automation/types.js +1 -0
  29. package/dist-sdk/src/entities/dashboard/from-tf.js +11 -2
  30. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
  31. package/dist-sdk/src/entities/dashboard/to-tf.js +4 -0
  32. package/dist-sdk/src/entities/datamine/from-tf.js +23 -3
  33. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -1
  34. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +8 -0
  35. package/dist-sdk/src/entities/dynamic-layout/dialect.js +12 -0
  36. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +7 -0
  37. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +64 -10
  38. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +54 -6
  39. package/dist-sdk/src/entities/element/build.d.ts +7 -0
  40. package/dist-sdk/src/entities/element/from-tf.js +1 -1
  41. package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
  42. package/dist-sdk/src/entities/element/to-tf.js +19 -1
  43. package/dist-sdk/src/entities/field/build.d.ts +10 -1
  44. package/dist-sdk/src/entities/field/build.js +2 -1
  45. package/dist-sdk/src/entities/field/calc/index.js +7 -7
  46. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -0
  47. package/dist-sdk/src/entities/field/calc/runtime.js +32 -0
  48. package/dist-sdk/src/entities/field/calc/types.d.ts +6 -0
  49. package/dist-sdk/src/entities/file-reader/to-tf.js +10 -2
  50. package/dist-sdk/src/entities/relationship/build.d.ts +14 -7
  51. package/dist-sdk/src/entities/relationship/from-tf.js +14 -14
  52. package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
  53. package/dist-sdk/src/entities/relationship/to-tf.js +18 -0
  54. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
  55. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +21 -0
  56. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +16 -4
  57. package/dist-sdk/src/entities/skill/tools.d.ts +10 -0
  58. package/dist-sdk/src/entities/skill/tools.js +10 -0
  59. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +7 -0
  60. package/dist-sdk/src/entities/skill-tool/from-tf.js +22 -2
  61. package/dist-sdk/src/entities/skill-tool/to-tf.js +21 -0
  62. package/dist-sdk/src/entities/table/catalog-render.js +2 -1
  63. package/dist-sdk/src/entities/view/from-tf.js +9 -0
  64. package/dist-sdk/src/entities/view/to-tf.d.ts +7 -0
  65. package/dist-sdk/src/entities/view/to-tf.js +34 -5
  66. package/dist-sdk/src/entities/widget/build.d.ts +17 -7
  67. package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
  68. package/dist-sdk/src/entities/widget/from-tf.js +132 -18
  69. package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
  70. package/dist-sdk/src/entities/widget/to-tf.js +40 -0
  71. package/dist-sdk/src/graph/types.d.ts +8 -0
  72. package/package.json +1 -1
@@ -5,6 +5,12 @@ import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
5
5
  import { fieldRefToTfValue } from "../field/to-tf.js";
6
6
  import { WIDGET_RESOURCE_TYPE } from "./module.js";
7
7
  import { filterToTf } from "../access-policy/to-tf.js";
8
+ export function relationshipTargetsFromBag(relationships) {
9
+ return Object.values(relationships ?? {}).map((relationship) => ({
10
+ kind: relationship.target?.__kind,
11
+ refName: relationship.target?.refName,
12
+ }));
13
+ }
8
14
  export function widgetsToTf(widgets, opts) {
9
15
  const blocks = [];
10
16
  for (const [key, widget] of Object.entries(widgets ?? {})) {
@@ -19,6 +25,7 @@ export function widgetsToTf(widgets, opts) {
19
25
  const target = resolveAspect(widget.target, `${where}.target`, opts);
20
26
  if (target === undefined)
21
27
  continue;
28
+ diagnoseRelatedRecordsJoin(where, target, opts);
22
29
  const body = { name: widget.name ?? "", object_id: target.value };
23
30
  // Always emitted, even empty — the provider schema treats columns as
24
31
  // always-present on related-object/related-link widgets, so omitting
@@ -86,6 +93,24 @@ export function widgetsToTf(widgets, opts) {
86
93
  }
87
94
  return blocks;
88
95
  }
96
+ function diagnoseRelatedRecordsJoin(where, target, opts) {
97
+ if (target.refName === undefined || target.kind === undefined)
98
+ return;
99
+ const isSelf = target.kind === opts.scope && target.refName === opts.ownerRefName;
100
+ if (isSelf)
101
+ return;
102
+ const matches = (opts.relationshipTargets ?? []).some((relationship) => {
103
+ const kind = relationship.kind === "element"
104
+ ? "element"
105
+ : relationship.kind === "table"
106
+ ? "table"
107
+ : "app";
108
+ return kind === target.kind && relationship.refName === target.refName;
109
+ });
110
+ if (matches)
111
+ return;
112
+ opts.diagnostics.push(`${where}: relatedRecords lists records through an authored relationships[] join on this ${opts.scope}, not through a child relationField or autoRelate. Add relationships.<key> targeting "${target.refName}" whose columns join comparable stored values. Do not join this object's system "id" (HANDLE) to a child relationField.`);
113
+ }
89
114
  function buttonBody(widget) {
90
115
  const body = {
91
116
  name: widget.name ?? "",
@@ -134,6 +159,21 @@ function resolveColumns(columns, target, where, opts) {
134
159
  out.push(value);
135
160
  continue;
136
161
  }
162
+ if (value != null && value.__kind === "recordIdentity") {
163
+ if (value.target === undefined) {
164
+ opts.diagnostics.push(`${where}[${index}]: record identity has no target; dropped`);
165
+ continue;
166
+ }
167
+ const identityTarget = resolveAspect(value.target, `${where}[${index}].target`, opts);
168
+ if (identityTarget === undefined)
169
+ continue;
170
+ if (target.kind !== identityTarget.kind || target.refName !== identityTarget.refName) {
171
+ opts.diagnostics.push(`${where}[${index}]: record identity target does not match widget target; dropped`);
172
+ continue;
173
+ }
174
+ out.push(target.value);
175
+ continue;
176
+ }
137
177
  if (value == null) {
138
178
  opts.diagnostics.push(`${where}[${index}]: field reference is unresolved (skipped during extract); dropped`);
139
179
  continue;
@@ -362,12 +362,20 @@ export interface BuildChildContext {
362
362
  * catalog (#490).
363
363
  */
364
364
  readonly fieldNamesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
365
+ /**
366
+ * Field resource addresses for every app/element in this build, keyed the
367
+ * same way as {@link fieldNamesByAppRefName}. A calculation addresses a
368
+ * found record's field by field id, so a cross-app `recordSearch` output
369
+ * used in a formula needs the searched aspect's field resources.
370
+ */
371
+ readonly fieldAddressesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
365
372
  /** Pulled roots may retain picklist labels removed from the live field. */
366
373
  readonly allowUnknownPicklistOptions?: boolean;
367
374
  /** Every app/element/table stream root in this build, by refName (see `ToTfContext.workspaceAspects`). */
368
375
  readonly workspaceAspects?: ReadonlyMap<string, {
369
376
  readonly kind: ChildResourceScope | "table";
370
377
  readonly tfLabel: string;
378
+ readonly streamRootEntity?: DeployableEntity;
371
379
  }>;
372
380
  /** The current app/element/table entity, forwarded for owner-local reference resolution. */
373
381
  readonly streamRootEntity?: DeployableEntity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementumai/edk",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "description": "Elementum Development Kit — statically typed SDK for building Elementum apps, automations, and agents",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",