@elementumai/edk 0.9.18 → 0.9.20

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 (219) hide show
  1. package/README.md +154 -9
  2. package/dist-sdk/src/catalog/factories.d.ts +35 -1
  3. package/dist-sdk/src/catalog/factories.js +36 -0
  4. package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
  5. package/dist-sdk/src/catalog/from-authoring.js +34 -9
  6. package/dist-sdk/src/catalog/index.d.ts +2 -2
  7. package/dist-sdk/src/catalog/index.js +2 -2
  8. package/dist-sdk/src/catalog/org.d.ts +39 -1
  9. package/dist-sdk/src/catalog/org.js +460 -50
  10. package/dist-sdk/src/catalog/render.js +6 -6
  11. package/dist-sdk/src/catalog/token.js +7 -0
  12. package/dist-sdk/src/catalog/types.d.ts +44 -1
  13. package/dist-sdk/src/catalog/types.js +13 -0
  14. package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
  15. package/dist-sdk/src/core/triggers/on-demand.js +10 -2
  16. package/dist-sdk/src/engine/build/context.d.ts +1 -1
  17. package/dist-sdk/src/engine/ei/run.d.ts +149 -0
  18. package/dist-sdk/src/engine/ei/run.js +1132 -0
  19. package/dist-sdk/src/engine/logging.d.ts +17 -0
  20. package/dist-sdk/src/engine/logging.js +18 -0
  21. package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
  22. package/dist-sdk/src/engine/pull/ref-only.js +64 -27
  23. package/dist-sdk/src/engine/pull/result-output.d.ts +8 -0
  24. package/dist-sdk/src/engine/pull/result-output.js +88 -4
  25. package/dist-sdk/src/engine/tf/expr.js +39 -14
  26. package/dist-sdk/src/engine/tf/index.d.ts +3 -3
  27. package/dist-sdk/src/engine/tf/index.js +2 -2
  28. package/dist-sdk/src/engine/tf/labels.d.ts +8 -0
  29. package/dist-sdk/src/engine/tf/labels.js +13 -0
  30. package/dist-sdk/src/engine/tf/model.d.ts +22 -1
  31. package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
  32. package/dist-sdk/src/engine/tf/parse.js +197 -10
  33. package/dist-sdk/src/engine/tf/render.d.ts +4 -2
  34. package/dist-sdk/src/engine/tf/render.js +41 -7
  35. package/dist-sdk/src/engine/validation.d.ts +39 -0
  36. package/dist-sdk/src/engine/validation.js +85 -0
  37. package/dist-sdk/src/engine/workspace/loader.js +49 -12
  38. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
  39. package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
  40. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
  41. package/dist-sdk/src/entities/access-policy/to-tf.js +16 -6
  42. package/dist-sdk/src/entities/agent/build.d.ts +4 -16
  43. package/dist-sdk/src/entities/agent/build.js +40 -5
  44. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
  45. package/dist-sdk/src/entities/agent/to-tf.js +6 -3
  46. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
  47. package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
  48. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  49. package/dist-sdk/src/entities/agent-tool/to-tf.js +29 -6
  50. package/dist-sdk/src/entities/app/build.d.ts +98 -19
  51. package/dist-sdk/src/entities/app/build.js +51 -19
  52. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
  53. package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
  54. package/dist-sdk/src/entities/app/from-tf.js +11 -5
  55. package/dist-sdk/src/entities/app/index.d.ts +6 -5
  56. package/dist-sdk/src/entities/app/index.js +2 -0
  57. package/dist-sdk/src/entities/app/module.js +18 -2
  58. package/dist-sdk/src/entities/app/to-tf.js +21 -11
  59. package/dist-sdk/src/entities/automation/build.d.ts +49 -6
  60. package/dist-sdk/src/entities/automation/build.js +163 -19
  61. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
  62. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +320 -39
  63. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
  64. package/dist-sdk/src/entities/automation/from-tf.js +563 -74
  65. package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
  66. package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
  67. package/dist-sdk/src/entities/automation/index.d.ts +2 -2
  68. package/dist-sdk/src/entities/automation/index.js +1 -1
  69. package/dist-sdk/src/entities/automation/module.d.ts +2 -0
  70. package/dist-sdk/src/entities/automation/module.js +93 -8
  71. package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
  72. package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
  73. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
  74. package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
  75. package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
  76. package/dist-sdk/src/entities/automation/script-code.js +91 -5
  77. package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
  78. package/dist-sdk/src/entities/automation/system-ref-name.js +48 -0
  79. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -0
  80. package/dist-sdk/src/entities/automation/task-output-labels.js +47 -0
  81. package/dist-sdk/src/entities/automation/tasks.d.ts +53 -4
  82. package/dist-sdk/src/entities/automation/tasks.js +38 -9
  83. package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
  84. package/dist-sdk/src/entities/automation/to-tf.js +647 -167
  85. package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
  86. package/dist-sdk/src/entities/automation/triggers.js +4 -0
  87. package/dist-sdk/src/entities/automation/types.js +1 -0
  88. package/dist-sdk/src/entities/chart/from-tf.js +33 -17
  89. package/dist-sdk/src/entities/chart/module.js +3 -1
  90. package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
  91. package/dist-sdk/src/entities/chart/printer.js +26 -16
  92. package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
  93. package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
  94. package/dist-sdk/src/entities/chart/to-tf.js +21 -12
  95. package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
  96. package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
  97. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
  98. package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
  99. package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
  100. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +72 -30
  101. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
  102. package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
  103. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
  104. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
  105. package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
  106. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
  107. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
  108. package/dist-sdk/src/entities/element/build.d.ts +33 -13
  109. package/dist-sdk/src/entities/element/build.js +5 -1
  110. package/dist-sdk/src/entities/element/from-tf.d.ts +12 -0
  111. package/dist-sdk/src/entities/element/from-tf.js +64 -3
  112. package/dist-sdk/src/entities/element/index.d.ts +5 -2
  113. package/dist-sdk/src/entities/element/index.js +2 -0
  114. package/dist-sdk/src/entities/element/module.js +11 -3
  115. package/dist-sdk/src/entities/element/to-tf.js +20 -2
  116. package/dist-sdk/src/entities/field/build.d.ts +14 -1
  117. package/dist-sdk/src/entities/field/build.js +3 -0
  118. package/dist-sdk/src/entities/field/from-tf.d.ts +3 -0
  119. package/dist-sdk/src/entities/field/from-tf.js +50 -1
  120. package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
  121. package/dist-sdk/src/entities/field/media-types.js +30 -0
  122. package/dist-sdk/src/entities/field/module.js +1 -0
  123. package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
  124. package/dist-sdk/src/entities/field/to-tf.js +142 -22
  125. package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
  126. package/dist-sdk/src/entities/file-reader/module.js +1 -0
  127. package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
  128. package/dist-sdk/src/entities/file-reader/types.js +1 -1
  129. package/dist-sdk/src/entities/portal/build.d.ts +26 -0
  130. package/dist-sdk/src/entities/portal/build.js +37 -0
  131. package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
  132. package/dist-sdk/src/entities/portal/from-tf.js +75 -0
  133. package/dist-sdk/src/entities/portal/index.d.ts +1 -0
  134. package/dist-sdk/src/entities/portal/index.js +1 -0
  135. package/dist-sdk/src/entities/portal/module.d.ts +3 -0
  136. package/dist-sdk/src/entities/portal/module.js +28 -0
  137. package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
  138. package/dist-sdk/src/entities/portal/to-tf.js +73 -0
  139. package/dist-sdk/src/entities/portal/types.d.ts +1 -0
  140. package/dist-sdk/src/entities/portal/types.js +1 -0
  141. package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
  142. package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
  143. package/dist-sdk/src/entities/relationship/module.js +2 -0
  144. package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
  145. package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
  146. package/dist-sdk/src/entities/relationship/to-tf.d.ts +10 -0
  147. package/dist-sdk/src/entities/relationship/to-tf.js +31 -13
  148. package/dist-sdk/src/entities/search-table/module.js +1 -0
  149. package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
  150. package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
  151. package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
  152. package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
  153. package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
  154. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
  155. package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
  156. package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
  157. package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
  158. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
  159. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
  160. package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -2
  161. package/dist-sdk/src/entities/shared/filters/index.d.ts +25 -2
  162. package/dist-sdk/src/entities/shared/filters/index.js +38 -5
  163. package/dist-sdk/src/entities/shared/filters/print.js +31 -3
  164. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +25 -3
  165. package/dist-sdk/src/entities/shared/filters/tf-codec.js +51 -15
  166. package/dist-sdk/src/entities/shared/filters/types.d.ts +22 -5
  167. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
  168. package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
  169. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
  170. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
  171. package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
  172. package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
  173. package/dist-sdk/src/entities/skill/access-policy.js +101 -0
  174. package/dist-sdk/src/entities/skill/build.d.ts +3 -0
  175. package/dist-sdk/src/entities/skill/build.js +3 -0
  176. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
  177. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +23 -1
  178. package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
  179. package/dist-sdk/src/entities/skill/from-tf.js +70 -22
  180. package/dist-sdk/src/entities/skill/index.d.ts +2 -0
  181. package/dist-sdk/src/entities/skill/index.js +1 -0
  182. package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
  183. package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
  184. package/dist-sdk/src/entities/skill/module.js +1 -0
  185. package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
  186. package/dist-sdk/src/entities/skill/to-tf.js +19 -6
  187. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  188. package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
  189. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
  190. package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -6
  191. package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
  192. package/dist-sdk/src/entities/table/catalog.js +66 -0
  193. package/dist-sdk/src/entities/table/module.js +2 -1
  194. package/dist-sdk/src/entities/table/to-tf.js +5 -5
  195. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +89 -0
  196. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +277 -0
  197. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +51 -0
  198. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +360 -0
  199. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +151 -0
  200. package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
  201. package/dist-sdk/src/entities/view/from-tf.d.ts +6 -3
  202. package/dist-sdk/src/entities/view/from-tf.js +161 -14
  203. package/dist-sdk/src/entities/view/module.js +30 -3
  204. package/dist-sdk/src/entities/view/to-tf.d.ts +24 -2
  205. package/dist-sdk/src/entities/view/to-tf.js +95 -9
  206. package/dist-sdk/src/entities/view/types.d.ts +4 -15
  207. package/dist-sdk/src/entities/view/types.js +17 -15
  208. package/dist-sdk/src/entities/widget/build.d.ts +16 -1
  209. package/dist-sdk/src/entities/widget/build.js +11 -1
  210. package/dist-sdk/src/entities/widget/to-tf.js +36 -10
  211. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +38 -10
  212. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  213. package/dist-sdk/src/graph/index.d.ts +54 -0
  214. package/dist-sdk/src/graph/index.js +30 -0
  215. package/dist-sdk/src/graph/modules.js +2 -0
  216. package/dist-sdk/src/graph/types.d.ts +133 -2
  217. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  218. package/dist-sdk/src/internal/sdk-package.js +1 -0
  219. package/package.json +11 -1
@@ -0,0 +1,360 @@
1
+ import { workspaceAspectKey } from "../../engine/build/context.js";
2
+ import { EntityTfError } from "../../engine/entity.js";
3
+ import { expr } from "../../engine/tf/index.js";
4
+ import { authoredFieldKeysFromPayload, fieldRefToTfValue } from "../field/to-tf.js";
5
+ import { SUB_TYPE_BY_TYPE_KEY } from "../field/types.js";
6
+ import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
7
+ import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "./types.js";
8
+ import { AGENT_VIEW_SPEC_FILTER_PROPS, AGENT_VIEW_SPEC_ID_PROPS, agentViewFontFamily, } from "./agent-view-layout.js";
9
+ const PLATFORM_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
10
+ const HEX_COLOR = /^#[0-9a-fA-F]{3,8}$/;
11
+ const FONT_FAMILIES = new Set(Object.values(agentViewFontFamily));
12
+ const FILTER_PROPS = new Set(AGENT_VIEW_SPEC_FILTER_PROPS);
13
+ const ID_PROPS = AGENT_VIEW_SPEC_ID_PROPS;
14
+ /** Blocks the admin UI's JSON editor re-applies (its managed-view authoring policy). */
15
+ const SYSTEM_FIELD_KEYS = new Set(SYSTEM_FIELD_ID_ATTR_BY_KEY.keys());
16
+ const UI_EDITABLE_BLOCKS = new Set([
17
+ "ActionCardBlock", "BodyBlock", "BulletsBlock", "CardBlock", "DataTableBlock", "DetailsFieldsBlock",
18
+ "DetailsListBlock", "DividerBlock", "HeaderBlock", "RowBlock", "SpacerBlock", "StackBlock",
19
+ ]);
20
+ export function agentViewLayoutToTf(layout, where, opts) {
21
+ const attrs = {};
22
+ const image = layout.image;
23
+ if (image !== undefined) {
24
+ const attachment = unsafeId(image.attachment);
25
+ if (attachment !== undefined) {
26
+ if (!PLATFORM_ID.test(attachment))
27
+ throw new EntityTfError(`${where}.image.attachment: "${attachment}" is not a platform id`);
28
+ attrs["image_url"] = `/api/v1/attachments/${attachment}`;
29
+ }
30
+ else if (typeof image.url === "string" && image.url !== "") {
31
+ attrs["image_url"] = image.url;
32
+ }
33
+ else {
34
+ throw new EntityTfError(`${where}.image must be { attachment: unsafePlatformId(...) } or { url: "..." }`);
35
+ }
36
+ }
37
+ if (layout.header !== undefined && layout.header !== "")
38
+ attrs["header"] = layout.header;
39
+ if (layout.subHeader !== undefined && layout.subHeader !== "")
40
+ attrs["sub_header"] = layout.subHeader;
41
+ const branding = layout.branding ?? {};
42
+ for (const [key, attr] of [["backgroundColor", "background_color"], ["primaryColor", "primary_color"]]) {
43
+ const color = branding[key];
44
+ if (color === undefined || color === "")
45
+ continue;
46
+ if (!HEX_COLOR.test(color))
47
+ throw new EntityTfError(`${where}.branding.${key}: "${color}" is not a hex colour (#RGB to #RRGGBBAA)`);
48
+ attrs[attr] = color;
49
+ }
50
+ if (branding.fontFamily !== undefined) {
51
+ if (!FONT_FAMILIES.has(branding.fontFamily)) {
52
+ throw new EntityTfError(`${where}.branding.fontFamily: "${branding.fontFamily}" is not one of ${[...FONT_FAMILIES].join(", ")}`);
53
+ }
54
+ attrs["font_family"] = branding.fontFamily;
55
+ }
56
+ if (layout.customView !== undefined) {
57
+ attrs["custom_view"] = expr.jsonencode(viewBlocksToTf(layout.customView, `${where}.customView`, opts, { editorPolicy: true }));
58
+ }
59
+ return attrs;
60
+ }
61
+ /** A blocks layout → its HCL value (wrap it in `jsonencode`). */
62
+ export function viewBlocksToTf(spec, where, opts, policy) {
63
+ const doc = record(spec);
64
+ if (doc === undefined)
65
+ throw new EntityTfError(`${where} must be an object`);
66
+ const elements = record(doc["elements"]);
67
+ if (typeof doc["root"] !== "string" || doc["root"] === "")
68
+ throw new EntityTfError(`${where}.root must name an element`);
69
+ if (elements === undefined || Object.keys(elements).length === 0)
70
+ throw new EntityTfError(`${where}.elements must have at least one element`);
71
+ checkStructure(doc["root"], elements, where, opts.diagnostics);
72
+ const out = {};
73
+ for (const [key, value] of Object.entries(doc)) {
74
+ if (key === "elements")
75
+ continue;
76
+ out[key] = literal(value, `${where}.${key}`, opts);
77
+ }
78
+ const outElements = {};
79
+ for (const [id, raw] of Object.entries(elements)) {
80
+ const element = record(raw);
81
+ const elementWhere = `${where}.elements.${id}`;
82
+ const type = typeof element["type"] === "string" ? element["type"] : "";
83
+ if (policy.editorPolicy)
84
+ policyWarnings(type, element, elementWhere, opts.diagnostics);
85
+ const outElement = {};
86
+ for (const [key, value] of Object.entries(element)) {
87
+ outElement[key] = key === "props"
88
+ ? propsToTf(type, value, `${elementWhere}.props`, opts)
89
+ : key === "on"
90
+ ? deepSourceRefs(value, `${elementWhere}.on`, opts)
91
+ : literal(value, `${elementWhere}.${key}`, opts);
92
+ }
93
+ outElements[id] = outElement;
94
+ }
95
+ out["elements"] = outElements;
96
+ return out;
97
+ }
98
+ function propsToTf(type, props, where, opts) {
99
+ const rec = record(props);
100
+ if (rec === undefined)
101
+ return literal(props, where, opts);
102
+ const idProps = ID_PROPS[type] ?? {};
103
+ const out = {};
104
+ for (const [key, value] of Object.entries(rec)) {
105
+ const propWhere = `${where}.${key}`;
106
+ const kind = idProps[key];
107
+ if (kind === "field" && (isReference(value) || SYSTEM_FIELD_KEYS.has(value))) {
108
+ // A string here is a system field key ("status", "createdAt", ...).
109
+ out[key] = fieldRef(value, propWhere, opts);
110
+ }
111
+ else if (kind === "app" && isReference(value)) {
112
+ out[key] = appRef(value, propWhere, opts);
113
+ }
114
+ else if (FILTER_PROPS.has(key)) {
115
+ out[key] = deepRefs(value, propWhere, opts);
116
+ }
117
+ else if (type === "ButtonBlock" && key === "buttons" && Array.isArray(value)) {
118
+ out[key] = value.map((item, i) => buttonToTf(item, `${propWhere}[${i}]`, opts));
119
+ }
120
+ else {
121
+ out[key] = literal(value, propWhere, opts);
122
+ }
123
+ }
124
+ return out;
125
+ }
126
+ function buttonToTf(item, where, opts) {
127
+ const rec = record(item);
128
+ if (rec === undefined)
129
+ return literal(item, where, opts);
130
+ const out = {};
131
+ for (const [key, value] of Object.entries(rec)) {
132
+ const id = key === "viewId" ? unsafeId(value) : undefined;
133
+ out[key] = id !== undefined
134
+ ? id
135
+ : key === "onPress"
136
+ ? deepSourceRefs(value, `${where}.${key}`, opts)
137
+ : literal(value, `${where}.${key}`, opts);
138
+ }
139
+ return out;
140
+ }
141
+ /** Actions (`on` events, button `onPress`): app or element references may sit at any depth. */
142
+ function deepSourceRefs(value, where, opts) {
143
+ if (isReference(value)) {
144
+ const kind = value.__kind;
145
+ if (kind === undefined || kind === "app" || kind === "element")
146
+ return appRef(value, where, opts);
147
+ throw new EntityTfError(`${where}: only app or element references (or unsafePlatformId(...)) are allowed inside actions`);
148
+ }
149
+ if (Array.isArray(value))
150
+ return value.map((item, i) => deepSourceRefs(item, `${where}[${i}]`, opts));
151
+ const rec = record(value);
152
+ if (rec !== undefined) {
153
+ const out = {};
154
+ for (const [key, child] of Object.entries(rec))
155
+ out[checkKey(key, where)] = deepSourceRefs(child, `${where}.${key}`, opts);
156
+ return out;
157
+ }
158
+ return literal(value, where, opts);
159
+ }
160
+ function appRef(value, where, opts) {
161
+ const id = unsafeId(value);
162
+ if (id !== undefined)
163
+ return id;
164
+ const token = value;
165
+ const kind = token.__kind === "element" ? "element" : "app";
166
+ const refName = token.refName ?? "";
167
+ if (kind === (opts.ownerKind ?? "app") && refName === opts.ownerRefName)
168
+ return opts.objectId;
169
+ const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, refName));
170
+ if (sibling !== undefined)
171
+ return expr.resourceAttr(kind === "app" ? "elementum_app" : "elementum_element", sibling.tfLabel, ["id"]);
172
+ if (opts.orgRefs === undefined)
173
+ throw new EntityTfError(`${where}: app "${refName}" cannot be resolved here; use unsafePlatformId(...)`);
174
+ return resolveForeignRef(kind, { name: token.name ?? refName, namespace: token.namespace }, opts.orgRefs, opts.diagnostics, where).value;
175
+ }
176
+ function fieldRef(value, where, opts) {
177
+ const id = unsafeId(value);
178
+ if (id !== undefined)
179
+ return id;
180
+ const token = value;
181
+ const ownerKind = opts.ownerKind ?? "app";
182
+ if (token.parent !== undefined && (token.parent !== opts.ownerRefName || (token.parentKind ?? ownerKind) !== ownerKind)) {
183
+ return foreignFieldRef(value, where, opts);
184
+ }
185
+ const before = opts.diagnostics.length;
186
+ const resolved = opts.resolveField(value, where);
187
+ if (resolved === undefined) {
188
+ const reason = opts.diagnostics.slice(before).join("; ");
189
+ throw new EntityTfError(reason !== "" ? reason : `${where}: field reference does not resolve`);
190
+ }
191
+ return resolved;
192
+ }
193
+ /**
194
+ * Another app's or element's field. A field of a sibling in this workspace is
195
+ * its resource, so Terraform creates the field before the layout that names
196
+ * it; any other owner's field is a data lookup scoped to that owner (the chart
197
+ * datasource rule).
198
+ */
199
+ function foreignFieldRef(value, where, opts) {
200
+ const token = value;
201
+ if (token.parentKind !== undefined && token.parentKind !== "app" && token.parentKind !== "element") {
202
+ throw new EntityTfError(`${where}: fields of a ${token.parentKind} cannot be referenced here; use unsafePlatformId(...)`);
203
+ }
204
+ const kind = token.parentKind ?? "app";
205
+ if (token.refName === undefined || token.refName === "")
206
+ throw new EntityTfError(`${where}: field ref is missing its key`);
207
+ if (opts.orgRefs === undefined)
208
+ throw new EntityTfError(`${where}: the "${token.parent}" field "${token.refName}" cannot be resolved here; use unsafePlatformId(...)`);
209
+ const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, token.parent));
210
+ const siblingType = sibling === undefined ? undefined : siblingFieldType(sibling.streamRootEntity?.payload, token.refName);
211
+ const direct = sibling !== undefined && siblingType !== undefined
212
+ ? fieldRefToTfValue(siblingType, token.refName, sibling.tfLabel, kind, authoredFieldKeysFromPayload(sibling.streamRootEntity?.payload))
213
+ : undefined;
214
+ if (direct !== undefined)
215
+ return direct;
216
+ const owner = sibling !== undefined
217
+ ? { value: expr.resourceAttr(kind === "app" ? "elementum_app" : "elementum_element", sibling.tfLabel, ["id"]), tfLabel: sibling.tfLabel }
218
+ : resolveForeignRef(kind, { name: token.parentName ?? token.parent, namespace: token.parentNamespace }, opts.orgRefs, opts.diagnostics, where);
219
+ const fieldName = token.name ?? token.refName;
220
+ // The label every entity's build uses for this field, so one lookup is emitted per field.
221
+ const label = foreignFieldDataLabel(kind, owner.tfLabel, fieldName);
222
+ opts.orgRefs.foreignField("elementum_field", label, owner.value, fieldName);
223
+ return expr.dataAttr("elementum_field", label, ["id"]);
224
+ }
225
+ /** A sibling root's authored field type, from its wire field entry (`{ <typeKey>: { __refName } }`). */
226
+ function siblingFieldType(payload, refName) {
227
+ const fields = payload?.fields;
228
+ const entry = fields?.find((field) => Object.values(field)[0]?.__refName === refName);
229
+ const typeKey = entry === undefined ? undefined : Object.keys(entry)[0];
230
+ return typeKey === undefined ? undefined : SUB_TYPE_BY_TYPE_KEY.get(typeKey)?.authoringType;
231
+ }
232
+ /** Nested filter values: references may sit at any depth. */
233
+ function deepRefs(value, where, opts) {
234
+ if (isReference(value)) {
235
+ const kind = value.__kind;
236
+ return kind === "app" || kind === "element" ? appRef(value, where, opts) : fieldRef(value, where, opts);
237
+ }
238
+ if (Array.isArray(value))
239
+ return value.map((item, i) => deepRefs(item, `${where}[${i}]`, opts));
240
+ const rec = record(value);
241
+ if (rec !== undefined) {
242
+ const out = {};
243
+ for (const [key, child] of Object.entries(rec))
244
+ out[checkKey(key, where)] = deepRefs(child, `${where}.${key}`, opts);
245
+ return out;
246
+ }
247
+ return literal(value, where, opts);
248
+ }
249
+ /** Plain JSON outside the id positions. */
250
+ function literal(value, where, opts) {
251
+ if (value === null || typeof value === "string" || typeof value === "boolean")
252
+ return value;
253
+ if (typeof value === "number") {
254
+ if (!Number.isFinite(value))
255
+ throw new EntityTfError(`${where}: ${value} is not a JSON number`);
256
+ return value;
257
+ }
258
+ if (Array.isArray(value))
259
+ return value.map((item, i) => literal(item, `${where}[${i}]`, opts));
260
+ if (isReference(value)) {
261
+ throw new EntityTfError(`${where}: references are only allowed at the custom view's id props; use a plain value here`);
262
+ }
263
+ const rec = record(value);
264
+ if (rec === undefined)
265
+ throw new EntityTfError(`${where}: ${typeof value} is not a JSON value`);
266
+ const out = {};
267
+ for (const [key, child] of Object.entries(rec))
268
+ out[checkKey(key, where)] = literal(child, `${where}.${key}`, opts);
269
+ return out;
270
+ }
271
+ function checkStructure(root, elements, where, diagnostics) {
272
+ // The platform's schema rejects these, so they fail the build.
273
+ if (!(root in elements))
274
+ throw new EntityTfError(`${where}.root "${root}" is not an element`);
275
+ for (const [id, raw] of Object.entries(elements)) {
276
+ const element = record(raw);
277
+ if (element === undefined || typeof element["type"] !== "string")
278
+ throw new EntityTfError(`${where}.elements.${id} must be a block with a type`);
279
+ if (record(element["props"]) === undefined)
280
+ throw new EntityTfError(`${where}.elements.${id}.props must be an object`);
281
+ const children = element["children"];
282
+ if (children !== undefined && !Array.isArray(children))
283
+ throw new EntityTfError(`${where}.elements.${id}.children must be a list of element ids`);
284
+ }
285
+ // The platform stores these (its schema does not cross-check child ids), but
286
+ // the page fails to render them. Warn rather than fail, so a pulled layout
287
+ // still builds and round-trips; fixing it is the author's call.
288
+ for (const [id, raw] of Object.entries(elements)) {
289
+ const children = record(raw)?.["children"];
290
+ if (record(raw)?.["repeat"] !== undefined && (!Array.isArray(children) || children.length === 0)) {
291
+ diagnostics.push(`${where}.elements.${id}.repeat: a repeated element needs a child element as its template; the page will fail to render this custom view`);
292
+ }
293
+ if (!Array.isArray(children))
294
+ continue;
295
+ for (const child of children) {
296
+ if (typeof child !== "string" || !(child in elements)) {
297
+ diagnostics.push(`${where}.elements.${id}.children: "${String(child)}" is not an element; the page will fail to render this custom view`);
298
+ }
299
+ }
300
+ }
301
+ const state = new Map();
302
+ let cycle;
303
+ const visit = (id, path) => {
304
+ if (cycle !== undefined || state.get(id) === "done")
305
+ return;
306
+ if (state.get(id) === "visiting") {
307
+ cycle = [...path, id].join(" → ");
308
+ return;
309
+ }
310
+ state.set(id, "visiting");
311
+ const children = record(elements[id])?.["children"];
312
+ if (Array.isArray(children))
313
+ for (const child of children)
314
+ if (typeof child === "string" && child in elements)
315
+ visit(child, [...path, id]);
316
+ state.set(id, "done");
317
+ };
318
+ for (const id of Object.keys(elements))
319
+ visit(id, []);
320
+ if (cycle !== undefined)
321
+ diagnostics.push(`${where}: children form a cycle (${cycle}); the page will fail to render this custom view`);
322
+ }
323
+ function policyWarnings(type, element, where, diagnostics) {
324
+ const reason = !UI_EDITABLE_BLOCKS.has(type)
325
+ ? `${type} is outside the admin UI editor's block list`
326
+ : type === "DataTableBlock" && record(element["props"])?.["rows"] === undefined
327
+ ? "a DataTableBlock without static rows is outside the admin UI editor's policy"
328
+ : element["on"] !== undefined
329
+ ? "`on` handlers are outside the admin UI editor's policy"
330
+ : hasExpression(element["props"])
331
+ ? "`$` expressions are outside the admin UI editor's policy"
332
+ : undefined;
333
+ if (reason !== undefined) {
334
+ diagnostics.push(`${where}: ${reason}; the platform renders it, but the admin UI's JSON editor will not re-apply it`);
335
+ }
336
+ }
337
+ function hasExpression(value) {
338
+ if (Array.isArray(value))
339
+ return value.some(hasExpression);
340
+ const rec = record(value);
341
+ if (rec === undefined)
342
+ return false;
343
+ return Object.entries(rec).some(([key, child]) => key.startsWith("$") || hasExpression(child));
344
+ }
345
+ function checkKey(key, where) {
346
+ if (key === "$expr")
347
+ throw new EntityTfError(`${where}: the object key "$expr" is reserved and cannot appear in a custom view`);
348
+ return key;
349
+ }
350
+ function isReference(value) {
351
+ const rec = record(value);
352
+ return rec !== undefined && (typeof rec["__kind"] === "string" || rec["__unsafe"] === "platformId");
353
+ }
354
+ function unsafeId(value) {
355
+ const rec = record(value);
356
+ return rec !== undefined && rec["__unsafe"] === "platformId" && typeof rec["value"] === "string" ? rec["value"] : undefined;
357
+ }
358
+ function record(value) {
359
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
360
+ }
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Elementum Blocks layouts with typed references, shared by two views:
3
+ *
4
+ * - the agent managed view layout customization (PF-5983): the Welcome landing
5
+ * screen an agent view shows before the first message, authored on
6
+ * `agentViews.<key>.layout` (its `customView` is a blocks layout);
7
+ * - the Custom view (PF-5633), whose whole page is a blocks layout, authored on
8
+ * `customViews.<key>.layout`.
9
+ *
10
+ * A blocks layout is an Elementum Blocks (Ragnarok) spec — the generated
11
+ * `ElementumBlocksSpec` — with platform ids replaced by typed references at
12
+ * the per-block id positions listed in `AGENT_VIEW_SPEC_ID_PROPS`, inside
13
+ * nested filters, and inside actions (`on` events, button `onPress`).
14
+ */
15
+ import type { AppCatalogRef, ElementCatalogRef, FieldRef } from "../../catalog/types.js";
16
+ import type { UnsafePlatformId } from "../../core/platform-id.js";
17
+ import type { SystemFieldKey } from "../../core/system-fields.js";
18
+ import type { ElementumBlocksElement, ElementumBlocksSpec } from "./ragnarok.js";
19
+ /** Font families the agent view renders. */
20
+ export declare const agentViewFontFamily: {
21
+ readonly system: "system";
22
+ readonly sans: "sans";
23
+ readonly serif: "serif";
24
+ readonly mono: "mono";
25
+ };
26
+ export type AgentViewFontFamily = (typeof agentViewFontFamily)[keyof typeof agentViewFontFamily];
27
+ /** A hex colour, `#RGB` to `#RRGGBBAA`. Build checks the digits. */
28
+ export type AgentViewHexColor = `#${string}`;
29
+ /**
30
+ * The hero image: an attachment uploaded to this environment (the admin UI's
31
+ * upload, stored as `/api/v1/attachments/<id>`), or an external URL.
32
+ */
33
+ export type AgentViewImage = {
34
+ readonly attachment: UnsafePlatformId;
35
+ readonly url?: never;
36
+ } | {
37
+ readonly url: string;
38
+ readonly attachment?: never;
39
+ };
40
+ export interface AgentViewBranding {
41
+ readonly backgroundColor?: AgentViewHexColor;
42
+ readonly primaryColor?: AgentViewHexColor;
43
+ /** Defaults to `system`. */
44
+ readonly fontFamily?: AgentViewFontFamily;
45
+ }
46
+ /** A block's source: the view's own app or element, another app or element, or one by id. */
47
+ export type ViewBlocksSource = AppCatalogRef | ElementCatalogRef | UnsafePlatformId;
48
+ /** A self-fetching block's field: the view owner's, another app's or element's, or one by id. */
49
+ export type ViewBlocksField = FieldRef | SystemFieldKey | UnsafePlatformId;
50
+ /** A reference allowed anywhere inside a nested filter prop. */
51
+ export type ViewBlocksFilterRef = ViewBlocksSource | ViewBlocksField;
52
+ /** Same as `ViewBlocksSource` (the agent view name). */
53
+ export type AgentViewSpecApp = ViewBlocksSource;
54
+ /** Same as `ViewBlocksField` (the agent view name). */
55
+ export type AgentViewSpecField = ViewBlocksField;
56
+ /** Same as `ViewBlocksFilterRef` (the agent view name). */
57
+ export type AgentViewSpecFilterRef = ViewBlocksFilterRef;
58
+ /**
59
+ * Per block type, the top-level props that hold platform ids. Ids are scoped
60
+ * per block, not by prop name: DetailsFieldsBlock's `fields[].fieldId` is a
61
+ * render identity, not a field lookup.
62
+ */
63
+ export declare const AGENT_VIEW_SPEC_ID_PROPS: {
64
+ readonly DataTableBlock: {
65
+ readonly aspectId: "app";
66
+ readonly selectedAspectId: "app";
67
+ };
68
+ readonly ListCollectionBlock: {
69
+ readonly aspectId: "app";
70
+ readonly selectedAspectId: "app";
71
+ };
72
+ readonly ListControlsBlock: {
73
+ readonly filterAspectId: "app";
74
+ };
75
+ readonly ChartBlock: {
76
+ readonly aspectId: "app";
77
+ readonly fieldId: "field";
78
+ readonly groupByFieldId: "field";
79
+ readonly dateFieldId: "field";
80
+ };
81
+ readonly MetricsRowBlock: {
82
+ readonly aspectId: "app";
83
+ };
84
+ };
85
+ /** Props holding nested filter structures, where references may sit at any depth. */
86
+ export declare const AGENT_VIEW_SPEC_FILTER_PROPS: readonly ["filterJson", "filterFields", "quickFilters"];
87
+ type IdPropsFor<T> = T extends keyof typeof AGENT_VIEW_SPEC_ID_PROPS ? (typeof AGENT_VIEW_SPEC_ID_PROPS)[T] : Record<never, never>;
88
+ type FilterProp = (typeof AGENT_VIEW_SPEC_FILTER_PROPS)[number];
89
+ /**
90
+ * Replace the plain-string arm of a prop with a typed reference. `""` stays
91
+ * allowed: the platform accepts an empty id, and unsafePlatformId rejects one.
92
+ */
93
+ type WithRef<V, R> = V extends string ? R | "" : V;
94
+ /** Allow a reference wherever a string sits inside a nested value. */
95
+ type WithDeepRefs<V> = V extends string ? V | ViewBlocksFilterRef : V extends ReadonlyArray<infer I> ? ReadonlyArray<WithDeepRefs<I>> : V extends object ? {
96
+ readonly [K in keyof V]: WithDeepRefs<V[K]>;
97
+ } : V;
98
+ /** Allow an app or element reference wherever a string sits inside an action (e.g. createRecord's aspectId). */
99
+ type WithDeepSourceRefs<V> = V extends string ? V | ViewBlocksSource : V extends ReadonlyArray<infer I> ? ReadonlyArray<WithDeepSourceRefs<I>> : V extends object ? {
100
+ readonly [K in keyof V]: WithDeepSourceRefs<V[K]>;
101
+ } : V;
102
+ type MapProps<T, P> = P extends unknown ? {
103
+ readonly [K in keyof P]: K extends keyof IdPropsFor<T> ? WithRef<P[K], IdPropsFor<T>[K] extends "field" ? ViewBlocksField : ViewBlocksSource> : K extends FilterProp ? WithDeepRefs<P[K]> : T extends "ButtonBlock" ? K extends "buttons" ? MapButtons<P[K]> : P[K] : P[K];
104
+ } : never;
105
+ /**
106
+ * ButtonBlock items: link items name another managed view by id, and action
107
+ * items (`onPress`, e.g. createRecord) may name an app or element.
108
+ */
109
+ type MapButtons<V> = V extends ReadonlyArray<infer I> ? ReadonlyArray<MapButton<I>> : V;
110
+ type MapButton<I> = I extends {
111
+ readonly viewId?: string;
112
+ } ? Omit<I, "viewId"> & {
113
+ readonly viewId?: UnsafePlatformId;
114
+ } : I extends {
115
+ readonly onPress: infer A;
116
+ } ? Omit<I, "onPress"> & {
117
+ readonly onPress: WithDeepSourceRefs<A>;
118
+ } : I;
119
+ type MapElement<E> = E extends {
120
+ readonly type: infer T;
121
+ readonly props: infer P;
122
+ } ? Omit<E, "props" | "on"> & {
123
+ readonly props: MapProps<T, P>;
124
+ readonly on?: E extends {
125
+ readonly on?: infer O;
126
+ } ? WithDeepSourceRefs<O> : never;
127
+ } : E;
128
+ /** One block of a blocks layout. */
129
+ export type ViewBlock = MapElement<ElementumBlocksElement>;
130
+ /** A blocks layout: an Elementum Blocks spec with typed references. */
131
+ export type ViewBlocksLayout = Omit<ElementumBlocksSpec, "elements"> & {
132
+ readonly elements: {
133
+ readonly [key: string]: ViewBlock;
134
+ };
135
+ };
136
+ /** One block of an agent view's custom view. */
137
+ export type AgentViewBlock = ViewBlock;
138
+ /** An agent view's custom view: a blocks layout. */
139
+ export type AgentViewCustomView = ViewBlocksLayout;
140
+ /** The layout customization of an agent view (the admin UI's Layout panel). */
141
+ export interface AppAgentViewLayout {
142
+ readonly image?: AgentViewImage;
143
+ /** The UI's "Welcome header". When unset the page shows its default greeting. */
144
+ readonly header?: string;
145
+ /** The UI's "Welcome sub-header". When unset the page shows the agent's first message. */
146
+ readonly subHeader?: string;
147
+ readonly branding?: AgentViewBranding;
148
+ /** The custom JSON view below the chat. When unset there is none. */
149
+ readonly customView?: AgentViewCustomView;
150
+ }
151
+ export {};
@@ -0,0 +1,21 @@
1
+ /** Font families the agent view renders. */
2
+ export const agentViewFontFamily = {
3
+ system: "system",
4
+ sans: "sans",
5
+ serif: "serif",
6
+ mono: "mono",
7
+ };
8
+ /**
9
+ * Per block type, the top-level props that hold platform ids. Ids are scoped
10
+ * per block, not by prop name: DetailsFieldsBlock's `fields[].fieldId` is a
11
+ * render identity, not a field lookup.
12
+ */
13
+ export const AGENT_VIEW_SPEC_ID_PROPS = {
14
+ DataTableBlock: { aspectId: "app", selectedAspectId: "app" },
15
+ ListCollectionBlock: { aspectId: "app", selectedAspectId: "app" },
16
+ ListControlsBlock: { filterAspectId: "app" },
17
+ ChartBlock: { aspectId: "app", fieldId: "field", groupByFieldId: "field", dateFieldId: "field" },
18
+ MetricsRowBlock: { aspectId: "app" },
19
+ };
20
+ /** Props holding nested filter structures, where references may sit at any depth. */
21
+ export const AGENT_VIEW_SPEC_FILTER_PROPS = ["filterJson", "filterFields", "quickFilters"];
@@ -6,8 +6,9 @@
6
6
  * module never names the app's own resource type.
7
7
  */
8
8
  import { type FromTfContext } from "../../engine/pull/context.js";
9
- import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
10
- import type { NormalizedAgentView, NormalizedCalendarView, NormalizedDashboardView, NormalizedKanbanView, NormalizedLayout, NormalizedListView } from "../app/deserializer/normalize.js";
9
+ import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
10
+ import { type NormalizedManagedViewSort } from "./build.js";
11
+ import type { NormalizedAgentView, NormalizedCalendarView, NormalizedCustomView, NormalizedDashboardView, NormalizedKanbanView, NormalizedLayout, NormalizedListView } from "../app/deserializer/normalize.js";
11
12
  /** Report every attribute key not in `known` as dialect growth — shared by all four view/section passes below. */
12
13
  export interface ViewOwner {
13
14
  /** The owner's resource type ("elementum_app") — what `object_id`/`aspect_id` must reference. */
@@ -28,7 +29,9 @@ export interface ViewsFromTfResult {
28
29
  readonly kanbanViews: readonly NormalizedKanbanView[];
29
30
  readonly dashboardViews: readonly NormalizedDashboardView[];
30
31
  readonly agentViews: readonly NormalizedAgentView[];
32
+ readonly customViews: readonly NormalizedCustomView[];
31
33
  readonly viewOrder?: readonly string[];
32
34
  }
33
35
  /** All three view resource kinds → the normalized shapes the app printer consumes. */
34
- export declare function viewsFromTf(layoutBlocks: readonly TfBlock[], listViewBlocks: readonly TfBlock[], calendarViewBlocks: readonly TfBlock[], kanbanViewBlocks: readonly TfBlock[], dashboardViewBlocks: readonly TfBlock[], agentViewBlocks: readonly TfBlock[], managedViewOrderBlocks: readonly TfBlock[], owner: ViewOwner, ctx: FromTfContext): ViewsFromTfResult;
36
+ export declare function viewsFromTf(layoutBlocks: readonly TfBlock[], listViewBlocks: readonly TfBlock[], calendarViewBlocks: readonly TfBlock[], kanbanViewBlocks: readonly TfBlock[], dashboardViewBlocks: readonly TfBlock[], agentViewBlocks: readonly TfBlock[], managedViewOrderBlocks: readonly TfBlock[], owner: ViewOwner, ctx: FromTfContext, customViewBlocks?: readonly TfBlock[]): ViewsFromTfResult;
37
+ export declare function managedViewSortFromTf(value: TfValue | undefined, owner: ViewOwner, where: string, ctx: FromTfContext): NormalizedManagedViewSort | undefined;