sf-plugin-data 0.0.0-stage → 0.2.0

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 (256) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +589 -2
  3. package/bin/run.js +4 -0
  4. package/docs/artifact-format.md +527 -0
  5. package/docs/capabilities.md +1208 -0
  6. package/docs/git-workflow.md +160 -0
  7. package/docs/handover.md +10446 -0
  8. package/lib/api.d.ts +7 -0
  9. package/lib/api.js +7 -0
  10. package/lib/artifacts/code-fields.d.ts +49 -0
  11. package/lib/artifacts/code-fields.js +142 -0
  12. package/lib/artifacts/data-graph-document.d.ts +29 -0
  13. package/lib/artifacts/data-graph-document.js +52 -0
  14. package/lib/artifacts/data-space-field.d.ts +65 -0
  15. package/lib/artifacts/data-space-field.js +98 -0
  16. package/lib/artifacts/data-stream-document.d.ts +264 -0
  17. package/lib/artifacts/data-stream-document.js +680 -0
  18. package/lib/artifacts/data-transform-document.d.ts +152 -0
  19. package/lib/artifacts/data-transform-document.js +560 -0
  20. package/lib/artifacts/dependency-selection.d.ts +51 -0
  21. package/lib/artifacts/dependency-selection.js +154 -0
  22. package/lib/artifacts/dlo-document.d.ts +93 -0
  23. package/lib/artifacts/dlo-document.js +253 -0
  24. package/lib/artifacts/enum-case.d.ts +39 -0
  25. package/lib/artifacts/enum-case.js +67 -0
  26. package/lib/artifacts/git-deploy-selection.d.ts +68 -0
  27. package/lib/artifacts/git-deploy-selection.js +474 -0
  28. package/lib/artifacts/identity-resolution-document.d.ts +133 -0
  29. package/lib/artifacts/identity-resolution-document.js +625 -0
  30. package/lib/artifacts/mapping-document.d.ts +1 -0
  31. package/lib/artifacts/mapping-document.js +1 -0
  32. package/lib/artifacts/native-calculated-insight-document.d.ts +142 -0
  33. package/lib/artifacts/native-calculated-insight-document.js +321 -0
  34. package/lib/artifacts/native-data-graph-document.d.ts +124 -0
  35. package/lib/artifacts/native-data-graph-document.js +780 -0
  36. package/lib/artifacts/native-dmo-document.d.ts +151 -0
  37. package/lib/artifacts/native-dmo-document.js +313 -0
  38. package/lib/artifacts/native-mapping-document.d.ts +67 -0
  39. package/lib/artifacts/native-mapping-document.js +187 -0
  40. package/lib/artifacts/native-relationship-document.d.ts +76 -0
  41. package/lib/artifacts/native-relationship-document.js +232 -0
  42. package/lib/artifacts/path-selector.d.ts +55 -0
  43. package/lib/artifacts/path-selector.js +167 -0
  44. package/lib/artifacts/read-deploy-input.d.ts +239 -0
  45. package/lib/artifacts/read-deploy-input.js +1359 -0
  46. package/lib/artifacts/segment-document.d.ts +183 -0
  47. package/lib/artifacts/segment-document.js +570 -0
  48. package/lib/artifacts/verbatim-document.d.ts +203 -0
  49. package/lib/artifacts/verbatim-document.js +339 -0
  50. package/lib/artifacts/write-data-graph.d.ts +17 -0
  51. package/lib/artifacts/write-data-graph.js +162 -0
  52. package/lib/artifacts/write-data-stream.d.ts +11 -0
  53. package/lib/artifacts/write-data-stream.js +175 -0
  54. package/lib/artifacts/write-data-transform.d.ts +11 -0
  55. package/lib/artifacts/write-data-transform.js +180 -0
  56. package/lib/artifacts/write-dlo.d.ts +11 -0
  57. package/lib/artifacts/write-dlo.js +158 -0
  58. package/lib/artifacts/write-identity-resolution.d.ts +18 -0
  59. package/lib/artifacts/write-identity-resolution.js +165 -0
  60. package/lib/artifacts/write-mapping-definition.d.ts +17 -0
  61. package/lib/artifacts/write-mapping-definition.js +127 -0
  62. package/lib/artifacts/write-member-export.d.ts +88 -0
  63. package/lib/artifacts/write-member-export.js +199 -0
  64. package/lib/artifacts/write-native-calculated-insight.d.ts +21 -0
  65. package/lib/artifacts/write-native-calculated-insight.js +176 -0
  66. package/lib/artifacts/write-native-dmo.d.ts +11 -0
  67. package/lib/artifacts/write-native-dmo.js +158 -0
  68. package/lib/artifacts/write-native-mapping.d.ts +11 -0
  69. package/lib/artifacts/write-native-mapping.js +157 -0
  70. package/lib/artifacts/write-native-relationship.d.ts +11 -0
  71. package/lib/artifacts/write-native-relationship.js +157 -0
  72. package/lib/artifacts/write-segment.d.ts +26 -0
  73. package/lib/artifacts/write-segment.js +212 -0
  74. package/lib/commands/data360/delete.d.ts +280 -0
  75. package/lib/commands/data360/delete.js +2297 -0
  76. package/lib/commands/data360/deploy.d.ts +303 -0
  77. package/lib/commands/data360/deploy.js +2400 -0
  78. package/lib/commands/data360/publish.d.ts +93 -0
  79. package/lib/commands/data360/publish.js +292 -0
  80. package/lib/commands/data360/retrieve.d.ts +322 -0
  81. package/lib/commands/data360/retrieve.js +1963 -0
  82. package/lib/commands/data360/segment/members/export.d.ts +101 -0
  83. package/lib/commands/data360/segment/members/export.js +318 -0
  84. package/lib/errors/codes/calculated-insight.d.ts +2 -0
  85. package/lib/errors/codes/calculated-insight.js +25 -0
  86. package/lib/errors/codes/data-graph.d.ts +2 -0
  87. package/lib/errors/codes/data-graph.js +22 -0
  88. package/lib/errors/codes/data-stream.d.ts +2 -0
  89. package/lib/errors/codes/data-stream.js +70 -0
  90. package/lib/errors/codes/data-transform.d.ts +2 -0
  91. package/lib/errors/codes/data-transform.js +35 -0
  92. package/lib/errors/codes/dependency.d.ts +2 -0
  93. package/lib/errors/codes/dependency.js +11 -0
  94. package/lib/errors/codes/dlo.d.ts +2 -0
  95. package/lib/errors/codes/dlo.js +31 -0
  96. package/lib/errors/codes/dmo.d.ts +2 -0
  97. package/lib/errors/codes/dmo.js +28 -0
  98. package/lib/errors/codes/general.d.ts +2 -0
  99. package/lib/errors/codes/general.js +57 -0
  100. package/lib/errors/codes/identity-resolution.d.ts +2 -0
  101. package/lib/errors/codes/identity-resolution.js +24 -0
  102. package/lib/errors/codes/mapping.d.ts +2 -0
  103. package/lib/errors/codes/mapping.js +42 -0
  104. package/lib/errors/codes/relationship.d.ts +2 -0
  105. package/lib/errors/codes/relationship.js +21 -0
  106. package/lib/errors/codes/segment.d.ts +2 -0
  107. package/lib/errors/codes/segment.js +49 -0
  108. package/lib/errors/registry.d.ts +60 -0
  109. package/lib/errors/registry.js +123 -0
  110. package/lib/plugin.d.ts +5 -0
  111. package/lib/plugin.js +5 -0
  112. package/lib/services/acquire-retrieve-selection.d.ts +43 -0
  113. package/lib/services/acquire-retrieve-selection.js +145 -0
  114. package/lib/services/bind-identity-resolution-dependencies.d.ts +53 -0
  115. package/lib/services/bind-identity-resolution-dependencies.js +238 -0
  116. package/lib/services/bind-segment-dependencies.d.ts +49 -0
  117. package/lib/services/bind-segment-dependencies.js +115 -0
  118. package/lib/services/bounded-reads.d.ts +17 -0
  119. package/lib/services/bounded-reads.js +42 -0
  120. package/lib/services/calculated-insight-sql-checks.d.ts +33 -0
  121. package/lib/services/calculated-insight-sql-checks.js +193 -0
  122. package/lib/services/command-dlo.d.ts +48 -0
  123. package/lib/services/command-dlo.js +103 -0
  124. package/lib/services/command-native-data-graph.d.ts +54 -0
  125. package/lib/services/command-native-data-graph.js +485 -0
  126. package/lib/services/command-native-data-stream.d.ts +104 -0
  127. package/lib/services/command-native-data-stream.js +257 -0
  128. package/lib/services/command-native-dmo.d.ts +124 -0
  129. package/lib/services/command-native-dmo.js +338 -0
  130. package/lib/services/command-native-mapping.d.ts +65 -0
  131. package/lib/services/command-native-mapping.js +129 -0
  132. package/lib/services/command-native-relationship.d.ts +46 -0
  133. package/lib/services/command-native-relationship.js +103 -0
  134. package/lib/services/cross-dataspace-deploy.d.ts +111 -0
  135. package/lib/services/cross-dataspace-deploy.js +493 -0
  136. package/lib/services/cross-dataspace-rename.d.ts +74 -0
  137. package/lib/services/cross-dataspace-rename.js +1314 -0
  138. package/lib/services/cross-dataspace-sql.d.ts +109 -0
  139. package/lib/services/cross-dataspace-sql.js +1301 -0
  140. package/lib/services/cross-space-context.d.ts +23 -0
  141. package/lib/services/cross-space-context.js +36 -0
  142. package/lib/services/crud-plan.d.ts +137 -0
  143. package/lib/services/crud-plan.js +408 -0
  144. package/lib/services/data-space-check.d.ts +89 -0
  145. package/lib/services/data-space-check.js +162 -0
  146. package/lib/services/data-space-prefix.d.ts +77 -0
  147. package/lib/services/data-space-prefix.js +127 -0
  148. package/lib/services/data-transform-space.d.ts +31 -0
  149. package/lib/services/data-transform-space.js +79 -0
  150. package/lib/services/delete-calculated-insight.d.ts +44 -0
  151. package/lib/services/delete-calculated-insight.js +101 -0
  152. package/lib/services/delete-data-transform.d.ts +52 -0
  153. package/lib/services/delete-data-transform.js +222 -0
  154. package/lib/services/delete-dmo-field.d.ts +211 -0
  155. package/lib/services/delete-dmo-field.js +472 -0
  156. package/lib/services/delete-identity-resolution.d.ts +43 -0
  157. package/lib/services/delete-identity-resolution.js +295 -0
  158. package/lib/services/delete-segment.d.ts +42 -0
  159. package/lib/services/delete-segment.js +248 -0
  160. package/lib/services/deploy-result.d.ts +54 -0
  161. package/lib/services/deploy-result.js +60 -0
  162. package/lib/services/escaped-copy.d.ts +23 -0
  163. package/lib/services/escaped-copy.js +88 -0
  164. package/lib/services/execute-calculated-insight-deploy.d.ts +42 -0
  165. package/lib/services/execute-calculated-insight-deploy.js +96 -0
  166. package/lib/services/execute-data-transform-deploy.d.ts +56 -0
  167. package/lib/services/execute-data-transform-deploy.js +168 -0
  168. package/lib/services/execute-native-identity-resolution-deploy.d.ts +48 -0
  169. package/lib/services/execute-native-identity-resolution-deploy.js +360 -0
  170. package/lib/services/execute-segment-deploy.d.ts +45 -0
  171. package/lib/services/execute-segment-deploy.js +393 -0
  172. package/lib/services/local-file-removal.d.ts +36 -0
  173. package/lib/services/local-file-removal.js +103 -0
  174. package/lib/services/native-calculated-insight.d.ts +87 -0
  175. package/lib/services/native-calculated-insight.js +164 -0
  176. package/lib/services/native-crm-data-stream.d.ts +91 -0
  177. package/lib/services/native-crm-data-stream.js +272 -0
  178. package/lib/services/native-data-graph-context.d.ts +12 -0
  179. package/lib/services/native-data-graph-context.js +139 -0
  180. package/lib/services/native-data-graph-crd.d.ts +261 -0
  181. package/lib/services/native-data-graph-crd.js +866 -0
  182. package/lib/services/native-data-stream.d.ts +329 -0
  183. package/lib/services/native-data-stream.js +1830 -0
  184. package/lib/services/native-dlo.d.ts +163 -0
  185. package/lib/services/native-dlo.js +402 -0
  186. package/lib/services/native-dmo.d.ts +191 -0
  187. package/lib/services/native-dmo.js +614 -0
  188. package/lib/services/native-mapping.d.ts +255 -0
  189. package/lib/services/native-mapping.js +1226 -0
  190. package/lib/services/native-relationship.d.ts +132 -0
  191. package/lib/services/native-relationship.js +512 -0
  192. package/lib/services/operation-diagnostic.d.ts +83 -0
  193. package/lib/services/operation-diagnostic.js +272 -0
  194. package/lib/services/preflight-calculated-insight-deploy.d.ts +58 -0
  195. package/lib/services/preflight-calculated-insight-deploy.js +95 -0
  196. package/lib/services/preflight-data-transform-deploy.d.ts +33 -0
  197. package/lib/services/preflight-data-transform-deploy.js +104 -0
  198. package/lib/services/preflight-identity-resolution-deploy.d.ts +107 -0
  199. package/lib/services/preflight-identity-resolution-deploy.js +281 -0
  200. package/lib/services/preflight-segment-deploy.d.ts +31 -0
  201. package/lib/services/preflight-segment-deploy.js +109 -0
  202. package/lib/services/publish-calculated-insight.d.ts +40 -0
  203. package/lib/services/publish-calculated-insight.js +95 -0
  204. package/lib/services/publish-segment.d.ts +65 -0
  205. package/lib/services/publish-segment.js +194 -0
  206. package/lib/services/readback-pace.d.ts +16 -0
  207. package/lib/services/readback-pace.js +23 -0
  208. package/lib/services/retrieve-data-transform.d.ts +26 -0
  209. package/lib/services/retrieve-data-transform.js +65 -0
  210. package/lib/services/retrieve-identity-resolution.d.ts +40 -0
  211. package/lib/services/retrieve-identity-resolution.js +87 -0
  212. package/lib/services/retrieve-inventory.d.ts +32 -0
  213. package/lib/services/retrieve-inventory.js +151 -0
  214. package/lib/services/retrieve-segment.d.ts +120 -0
  215. package/lib/services/retrieve-segment.js +502 -0
  216. package/lib/services/segment-lookup.d.ts +46 -0
  217. package/lib/services/segment-lookup.js +108 -0
  218. package/lib/services/segment-members.d.ts +144 -0
  219. package/lib/services/segment-members.js +402 -0
  220. package/lib/services/select-native-retrieve.d.ts +60 -0
  221. package/lib/services/select-native-retrieve.js +226 -0
  222. package/lib/services/settle-calculated-insight.d.ts +22 -0
  223. package/lib/services/settle-calculated-insight.js +53 -0
  224. package/lib/services/sql-tokens.d.ts +58 -0
  225. package/lib/services/sql-tokens.js +147 -0
  226. package/lib/transport/api-version.d.ts +36 -0
  227. package/lib/transport/api-version.js +89 -0
  228. package/lib/transport/bound-ssot.d.ts +27 -0
  229. package/lib/transport/bound-ssot.js +116 -0
  230. package/lib/transport/calculated-insight-rest.d.ts +28 -0
  231. package/lib/transport/calculated-insight-rest.js +62 -0
  232. package/lib/transport/connect-client.d.ts +129 -0
  233. package/lib/transport/connect-client.js +446 -0
  234. package/lib/transport/connect-diagnostic.d.ts +89 -0
  235. package/lib/transport/connect-diagnostic.js +331 -0
  236. package/lib/transport/data-graph-rest.d.ts +27 -0
  237. package/lib/transport/data-graph-rest.js +76 -0
  238. package/lib/transport/data-stream-rest.d.ts +62 -0
  239. package/lib/transport/data-stream-rest.js +348 -0
  240. package/lib/transport/data-transform-rest.d.ts +25 -0
  241. package/lib/transport/data-transform-rest.js +100 -0
  242. package/lib/transport/dlo-native-rest.d.ts +22 -0
  243. package/lib/transport/dlo-native-rest.js +89 -0
  244. package/lib/transport/dlo-rest.d.ts +23 -0
  245. package/lib/transport/dlo-rest.js +135 -0
  246. package/lib/transport/dmo-native-rest.d.ts +18 -0
  247. package/lib/transport/dmo-native-rest.js +55 -0
  248. package/lib/transport/dmo-rest.d.ts +30 -0
  249. package/lib/transport/dmo-rest.js +163 -0
  250. package/lib/transport/mapping-rest.d.ts +63 -0
  251. package/lib/transport/mapping-rest.js +341 -0
  252. package/lib/transport/project-metadata.d.ts +36 -0
  253. package/lib/transport/project-metadata.js +118 -0
  254. package/lib/transport/relationship-rest.d.ts +43 -0
  255. package/lib/transport/relationship-rest.js +201 -0
  256. package/package.json +96 -4
@@ -0,0 +1,142 @@
1
+ import type { CodeField, CodeFile } from './code-fields.js';
2
+ /** Payload-free refusal; never include SQL or response content in diagnostics. */
3
+ export declare class CalculatedInsightError extends Error {
4
+ readonly code: string;
5
+ constructor(code: string);
6
+ }
7
+ /**
8
+ * Fields of the API 68 GET that the file leaves out: the org sets them, no create/update input
9
+ * takes them, or Salesforce derives them from the SQL.
10
+ * - Status and run history: `calculatedInsightStatus`, `definitionStatus`, `isEnabled`,
11
+ * `lastCalcInsightStatus*`, `lastRun*`.
12
+ * - `dimensions`, `measures`: derived from the SELECT list (no separate input).
13
+ * - `sourceCiId`, `sourceCiName`: org record links (`sourceCiDevName` is kept; the input names
14
+ * the source by developer name).
15
+ * - `creationType`, `subType`: set by how the insight was created; no input field.
16
+ */
17
+ export declare const calculatedInsightServerFields: readonly string[];
18
+ /** The SQL lives in `<apiName>.calculatedInsight-meta.sql` next to the JSON. */
19
+ export declare const calculatedInsightCodeFields: readonly CodeField[];
20
+ /**
21
+ * One calculated insight as the API 68 GET returns it, without the server fields. The file
22
+ * keeps its data space in the top-level `c__dataSpace` key instead of Salesforce's `dataSpace`:
23
+ * serialize and parse translate between the two, so `dataSpace` (sent as `dataSpaceName`)
24
+ * always comes from `c__dataSpace`.
25
+ */
26
+ export type NativeCalculatedInsight = Record<string, unknown> & {
27
+ apiName: string;
28
+ dataSpace: string;
29
+ expression: string;
30
+ };
31
+ /**
32
+ * Undo the HTML escaping Connect REST applies without the plain-text request header (`&gt;`,
33
+ * `&#39;`, …), as files of older plugin versions hold it, in one pass, so `&amp;lt;` becomes
34
+ * `&lt;`. Unknown or invalid references stay as they are. Never applied to a response: the client
35
+ * asks for plain text (plainTextHeaders).
36
+ * @param {string} text Escaped text.
37
+ * @returns {string} Plain text.
38
+ */
39
+ export declare function unescapeSalesforceHtml(text: string): string;
40
+ /**
41
+ * Structural check only: what to send and whether it works is Salesforce's decision.
42
+ * @param {unknown} value Complete document (JSON with the SQL joined back).
43
+ * @returns {NativeCalculatedInsight} Checked copy.
44
+ */
45
+ export declare function validateNativeCalculatedInsight(value: unknown): NativeCalculatedInsight;
46
+ /**
47
+ * Project an API 68 GET body to the file form: server fields dropped. The SQL reads as stored:
48
+ * the client asks Salesforce for plain text (plainTextHeaders).
49
+ * @param {unknown} raw GET response.
50
+ * @returns {NativeCalculatedInsight} Retrievable document.
51
+ */
52
+ export declare function observeNativeCalculatedInsight(raw: unknown): NativeCalculatedInsight;
53
+ /**
54
+ * The JSON text and the code files of one document. The `.sql` file ends with exactly one `\n`.
55
+ * @param {unknown} value Complete document.
56
+ * @returns {{json: string; files: CodeFile[]}} JSON (sorted keys, LF) and the SQL file.
57
+ */
58
+ export declare function serializeNativeCalculatedInsight(value: unknown): {
59
+ json: string;
60
+ files: CodeFile[];
61
+ };
62
+ /**
63
+ * The refusal of an insight file whose `c__dataSpace` is not the run's data space.
64
+ * @param {object} document The insight.
65
+ * @param {string} document.apiName Its name.
66
+ * @param {string} document.dataSpace Its data space (the file's c__dataSpace).
67
+ * @param {string} dataSpace The run's data space.
68
+ * @param {boolean} [crossSpace] A deploy, which --allow-cross-dataspace can translate: say so.
69
+ * @returns {CalculatedInsightError} CI_DATASPACE_MISMATCH with an explanation.
70
+ */
71
+ export declare function calculatedInsightSpaceMismatch(document: {
72
+ apiName: string;
73
+ dataSpace: string;
74
+ }, dataSpace: string, crossSpace?: boolean): CalculatedInsightError;
75
+ /**
76
+ * Read one document back from its JSON text and code files. Trailing line breaks of the `.sql`
77
+ * file are not part of `expression`.
78
+ * @param {string} json JSON file text.
79
+ * @param {readonly CodeFile[]} files Code file contents.
80
+ * @returns {NativeCalculatedInsight} Complete document.
81
+ */
82
+ export declare function parseNativeCalculatedInsight(json: string, files: readonly CodeFile[]): NativeCalculatedInsight;
83
+ /**
84
+ * GET keys the create/update input (`CdpCalculatedInsightInputRepresentation`) names
85
+ * differently. Live API 68 (isolated-source, 2026-11-15): `dataSpace` and `isFromPackage`
86
+ * are rejected as unrecognised, so the renames are required; `sourceCiDevName` follows the
87
+ * schema, not live-tested.
88
+ */
89
+ export declare const calculatedInsightInputKeys: Readonly<Record<string, string>>;
90
+ /**
91
+ * Keys whose GET value is UPPER_SNAKE (`NOT_SCHEDULED`) while the input lists PascalCase
92
+ * (`NotScheduled`). Live API 68: `publishScheduleInterval` must be PascalCase on POST and
93
+ * PATCH; `definitionType` and `queryDialect` are accepted in either form on POST;
94
+ * `historyPublishScheduleInterval` follows the schema, not live-tested.
95
+ */
96
+ export declare const calculatedInsightInputEnums: readonly string[];
97
+ /**
98
+ * The create/update body of one document: every key as authored, with the input names and
99
+ * enum forms of the two tables above. A null value is left out (the GET reports an unset
100
+ * field as null; the input documents that some unset fields must be omitted). The PATCH body
101
+ * leaves out `apiName`, which is in the route, and the definition type and schedule fields
102
+ * while they equal the org value (see `unchangedOnUpdate`).
103
+ * @param {NativeCalculatedInsight} document Complete document (SQL joined).
104
+ * @param {'create' | 'update'} operation POST or PATCH.
105
+ * @param {NativeCalculatedInsight} [observed] Org document an update is based on.
106
+ * @returns {Record<string, unknown>} Request body.
107
+ */
108
+ export declare function calculatedInsightInputBody(document: NativeCalculatedInsight, operation: 'create' | 'update', observed?: NativeCalculatedInsight): Record<string, unknown>;
109
+ /**
110
+ * Whether the org insight already holds the document: every key of the document equals the
111
+ * org GET projected with {@link observeNativeCalculatedInsight}. Keys the file leaves out are
112
+ * not compared, so a retrieved file deploys back unchanged and a shorter authored file too.
113
+ * @param {NativeCalculatedInsight} desired Document from the files.
114
+ * @param {NativeCalculatedInsight} observed Projected org document.
115
+ * @returns {boolean} True when nothing would change.
116
+ */
117
+ export declare function calculatedInsightMatches(desired: NativeCalculatedInsight, observed: NativeCalculatedInsight): boolean;
118
+ /** The planning view of one insight: kind, identity and what its SQL reads (ordering only). */
119
+ export type CalculatedInsightReference = {
120
+ kind: 'calculated-insight';
121
+ identity: {
122
+ dataSpace: string;
123
+ apiName: string;
124
+ };
125
+ spec: {
126
+ dependencies: Array<{
127
+ kind: 'dmo' | 'calculated-insight';
128
+ dataSpace: string;
129
+ apiName: string;
130
+ }>;
131
+ };
132
+ };
133
+ /**
134
+ * The planning view of one document. Dependencies are every distinct `<Name>__dlm` and other
135
+ * `<Name>__cio` token in the SQL: a deploy orders the insight after the selected DMOs, IRs
136
+ * (through their unified DMOs) and insights it names. No SQL is parsed; a name in a comment
137
+ * or string only adds an ordering edge, and a missing object is Salesforce's answer.
138
+ * @param {NativeCalculatedInsight} document Complete document.
139
+ * @returns {CalculatedInsightReference} Planning view.
140
+ */
141
+ export declare function calculatedInsightReference(document: NativeCalculatedInsight): CalculatedInsightReference;
142
+ export { calculatedInsightName } from './path-selector.js';
@@ -0,0 +1,321 @@
1
+ import { calculatedInsightName } from './path-selector.js';
2
+ import { sameProperty } from './enum-case.js';
3
+ import { joinCodeFields, splitCodeFields } from './code-fields.js';
4
+ import { dataSpaceKey, readSingleDataSpace } from './data-space-field.js';
5
+ import { crossSpaceSentence, explainInput } from '../services/operation-diagnostic.js';
6
+ /** Payload-free refusal; never include SQL or response content in diagnostics. */
7
+ export class CalculatedInsightError extends Error {
8
+ code;
9
+ constructor(code) {
10
+ super('Calculated insight configuration could not be admitted.');
11
+ this.code = code;
12
+ this.name = 'CalculatedInsightError';
13
+ }
14
+ }
15
+ /**
16
+ * Fields of the API 68 GET that the file leaves out: the org sets them, no create/update input
17
+ * takes them, or Salesforce derives them from the SQL.
18
+ * - Status and run history: `calculatedInsightStatus`, `definitionStatus`, `isEnabled`,
19
+ * `lastCalcInsightStatus*`, `lastRun*`.
20
+ * - `dimensions`, `measures`: derived from the SELECT list (no separate input).
21
+ * - `sourceCiId`, `sourceCiName`: org record links (`sourceCiDevName` is kept; the input names
22
+ * the source by developer name).
23
+ * - `creationType`, `subType`: set by how the insight was created; no input field.
24
+ */
25
+ export const calculatedInsightServerFields = [
26
+ 'calculatedInsightStatus',
27
+ 'creationType',
28
+ 'definitionStatus',
29
+ 'dimensions',
30
+ 'isEnabled',
31
+ 'lastCalcInsightStatusDateTime',
32
+ 'lastCalcInsightStatusErrorCode',
33
+ 'lastRunDateTime',
34
+ 'lastRunStatus',
35
+ 'lastRunStatusDateTime',
36
+ 'lastRunStatusErrorCode',
37
+ 'measures',
38
+ 'sourceCiId',
39
+ 'sourceCiName',
40
+ 'subType',
41
+ ];
42
+ /** The SQL lives in `<apiName>.calculatedInsight-meta.sql` next to the JSON. */
43
+ export const calculatedInsightCodeFields = [
44
+ { path: ['expression'], extension: 'sql' },
45
+ ];
46
+ const entities = {
47
+ amp: '&',
48
+ apos: "'",
49
+ gt: '>',
50
+ lt: '<',
51
+ quot: '"',
52
+ };
53
+ /**
54
+ * Undo the HTML escaping Connect REST applies without the plain-text request header (`&gt;`,
55
+ * `&#39;`, …), as files of older plugin versions hold it, in one pass, so `&amp;lt;` becomes
56
+ * `&lt;`. Unknown or invalid references stay as they are. Never applied to a response: the client
57
+ * asks for plain text (plainTextHeaders).
58
+ * @param {string} text Escaped text.
59
+ * @returns {string} Plain text.
60
+ */
61
+ export function unescapeSalesforceHtml(text) {
62
+ return text.replaceAll(/&(?:(amp|apos|gt|lt|quot)|#(\d{1,7})|#[Xx]([\dA-Fa-f]{1,6}));/gu, (match, name, decimal, hex) => {
63
+ if (name)
64
+ return entities[name];
65
+ const code = decimal === undefined ? Number.parseInt(hex, 16) : Number(decimal);
66
+ return code > 0x10_ff_ff || (code >= 0xd8_00 && code <= 0xdf_ff)
67
+ ? match
68
+ : String.fromCodePoint(code);
69
+ });
70
+ }
71
+ /**
72
+ * The same keys, sorted, so a repeat retrieve writes identical bytes.
73
+ * @param {Record<string, unknown>} value Top-level object.
74
+ * @returns {Record<string, unknown>} Sorted copy.
75
+ */
76
+ function sorted(value) {
77
+ return Object.fromEntries(Object.keys(value)
78
+ // eslint-disable-next-line unicorn/no-array-sort -- Sorting a new key array.
79
+ .sort()
80
+ .map((key) => [key, value[key]]));
81
+ }
82
+ /**
83
+ * Structural check only: what to send and whether it works is Salesforce's decision.
84
+ * @param {unknown} value Complete document (JSON with the SQL joined back).
85
+ * @returns {NativeCalculatedInsight} Checked copy.
86
+ */
87
+ export function validateNativeCalculatedInsight(value) {
88
+ if (!value || typeof value !== 'object' || Array.isArray(value))
89
+ throw new CalculatedInsightError('INVALID_CI_DOCUMENT');
90
+ const document = structuredClone(value);
91
+ if (typeof document.apiName !== 'string' || !calculatedInsightName.test(document.apiName))
92
+ throw new CalculatedInsightError('INVALID_CI_NAME');
93
+ if (typeof document.dataSpace !== 'string' ||
94
+ !document.dataSpace ||
95
+ typeof document.expression !== 'string' ||
96
+ !document.expression.trim())
97
+ throw new CalculatedInsightError('INVALID_CI_DOCUMENT');
98
+ return document;
99
+ }
100
+ /**
101
+ * Project an API 68 GET body to the file form: server fields dropped. The SQL reads as stored:
102
+ * the client asks Salesforce for plain text (plainTextHeaders).
103
+ * @param {unknown} raw GET response.
104
+ * @returns {NativeCalculatedInsight} Retrievable document.
105
+ */
106
+ export function observeNativeCalculatedInsight(raw) {
107
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
108
+ throw new CalculatedInsightError('INVALID_CI_DOCUMENT');
109
+ const body = { ...raw };
110
+ for (const key of calculatedInsightServerFields)
111
+ delete body[key];
112
+ return validateNativeCalculatedInsight(sorted(body));
113
+ }
114
+ /**
115
+ * The text without its trailing line breaks (`\n` or `\r\n`, any number). Salesforce stores a
116
+ * calculated insight's SQL without the final line break of the `.sql` file.
117
+ * @param {string} text SQL text.
118
+ * @returns {string} Text without trailing line breaks.
119
+ */
120
+ function withoutTrailingLineBreaks(text) {
121
+ return text.replace(/(?:\r?\n)+$/u, '');
122
+ }
123
+ /**
124
+ * The JSON text and the code files of one document. The `.sql` file ends with exactly one `\n`.
125
+ * @param {unknown} value Complete document.
126
+ * @returns {{json: string; files: CodeFile[]}} JSON (sorted keys, LF) and the SQL file.
127
+ */
128
+ export function serializeNativeCalculatedInsight(value) {
129
+ const { document, files } = splitCodeFields(validateNativeCalculatedInsight(value), calculatedInsightCodeFields, () => new CalculatedInsightError('INVALID_CI_DOCUMENT'));
130
+ const file = { ...document };
131
+ file[dataSpaceKey] = file.dataSpace;
132
+ delete file.dataSpace;
133
+ return {
134
+ json: `${JSON.stringify(sorted(file), undefined, 2)}\n`,
135
+ files: files.map((file) => ({ ...file, text: `${withoutTrailingLineBreaks(file.text)}\n` })),
136
+ };
137
+ }
138
+ /**
139
+ * The refusal of an insight file whose `c__dataSpace` is not the run's data space.
140
+ * @param {object} document The insight.
141
+ * @param {string} document.apiName Its name.
142
+ * @param {string} document.dataSpace Its data space (the file's c__dataSpace).
143
+ * @param {string} dataSpace The run's data space.
144
+ * @param {boolean} [crossSpace] A deploy, which --allow-cross-dataspace can translate: say so.
145
+ * @returns {CalculatedInsightError} CI_DATASPACE_MISMATCH with an explanation.
146
+ */
147
+ export function calculatedInsightSpaceMismatch(document, dataSpace, crossSpace = false) {
148
+ return explainInput(new CalculatedInsightError('CI_DATASPACE_MISMATCH'), `${document.apiName} names the data space ${document.dataSpace} in ${dataSpaceKey}, but the run's data space is ${dataSpace}. Run the command with --dataspace ${document.dataSpace}, or correct the file.${crossSpace ? crossSpaceSentence(dataSpace) : ''}`);
149
+ }
150
+ /**
151
+ * Refuse a calculated insight file problem, naming the key.
152
+ * @param {string} code Refusal code.
153
+ * @param {string} keyPath Key path.
154
+ * @param {string} problem What is wrong with it.
155
+ * @returns {CalculatedInsightError} Refusal with an explanation.
156
+ */
157
+ function refuseFile(code, keyPath, problem) {
158
+ return explainInput(new CalculatedInsightError(code), `The calculated insight file cannot be deployed: ${keyPath} ${problem}. Correct the file, or retrieve the insight again.`);
159
+ }
160
+ /**
161
+ * The parsed file with its `c__dataSpace` moved to Salesforce's `dataSpace` key. A file that still
162
+ * carries `dataSpace` itself is refused (pre-alpha: not migrated).
163
+ * @param {unknown} parsed Parsed JSON.
164
+ * @returns {unknown} Document in the GET's key names.
165
+ */
166
+ function fromFileDataSpace(parsed) {
167
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
168
+ throw new CalculatedInsightError('INVALID_CI_DOCUMENT');
169
+ const file = { ...parsed };
170
+ if (Object.hasOwn(file, 'dataSpace'))
171
+ throw refuseFile('LEGACY_DATASPACE_KEY', 'dataSpace', `is Salesforce's key; the file names its data space in the top-level key ${dataSpaceKey}`);
172
+ file.dataSpace = readSingleDataSpace(file, refuseFile);
173
+ delete file[dataSpaceKey];
174
+ return file;
175
+ }
176
+ /**
177
+ * Read one document back from its JSON text and code files. Trailing line breaks of the `.sql`
178
+ * file are not part of `expression`.
179
+ * @param {string} json JSON file text.
180
+ * @param {readonly CodeFile[]} files Code file contents.
181
+ * @returns {NativeCalculatedInsight} Complete document.
182
+ */
183
+ export function parseNativeCalculatedInsight(json, files) {
184
+ let parsed;
185
+ try {
186
+ parsed = JSON.parse(json);
187
+ }
188
+ catch {
189
+ throw new CalculatedInsightError('INVALID_CI_DOCUMENT');
190
+ }
191
+ const document = validateNativeCalculatedInsight(joinCodeFields(fromFileDataSpace(parsed), calculatedInsightCodeFields, files, () => new CalculatedInsightError('INVALID_CI_DOCUMENT')));
192
+ document.expression = withoutTrailingLineBreaks(document.expression);
193
+ return document;
194
+ }
195
+ /**
196
+ * GET keys the create/update input (`CdpCalculatedInsightInputRepresentation`) names
197
+ * differently. Live API 68 (isolated-source, 2026-11-15): `dataSpace` and `isFromPackage`
198
+ * are rejected as unrecognised, so the renames are required; `sourceCiDevName` follows the
199
+ * schema, not live-tested.
200
+ */
201
+ export const calculatedInsightInputKeys = {
202
+ dataSpace: 'dataSpaceName',
203
+ isFromPackage: 'createdFromPackage',
204
+ sourceCiDevName: 'sourceDeveloperName',
205
+ };
206
+ /**
207
+ * Keys whose GET value is UPPER_SNAKE (`NOT_SCHEDULED`) while the input lists PascalCase
208
+ * (`NotScheduled`). Live API 68: `publishScheduleInterval` must be PascalCase on POST and
209
+ * PATCH; `definitionType` and `queryDialect` are accepted in either form on POST;
210
+ * `historyPublishScheduleInterval` follows the schema, not live-tested.
211
+ */
212
+ export const calculatedInsightInputEnums = [
213
+ 'definitionType',
214
+ 'historyPublishScheduleInterval',
215
+ 'publishScheduleInterval',
216
+ 'queryDialect',
217
+ ];
218
+ /**
219
+ * Whether one insight key holds the same value in the file and the org; the enum keys above
220
+ * ignore letter case (`not_scheduled` equals `NOT_SCHEDULED`).
221
+ * @param {string} key Document key.
222
+ * @param {unknown} left One value.
223
+ * @param {unknown} right The other value.
224
+ * @returns {boolean} Whether the key is unchanged.
225
+ */
226
+ function sameCalculatedInsightValue(key, left, right) {
227
+ return sameProperty(key, left, right, calculatedInsightEnumKeys);
228
+ }
229
+ const calculatedInsightEnumKeys = new Set(calculatedInsightInputEnums);
230
+ /**
231
+ * `NOT_SCHEDULED` → `NotScheduled`; any other value stays as authored.
232
+ * @param {unknown} value Authored value.
233
+ * @returns {unknown} Input form.
234
+ */
235
+ function inputEnum(value) {
236
+ return typeof value === 'string' && /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/u.test(value)
237
+ ? value
238
+ .split('_')
239
+ .map((part) => part[0] + part.slice(1).toLowerCase())
240
+ .join('')
241
+ : value;
242
+ }
243
+ /**
244
+ * Keys an update leaves out while they equal the org value. Salesforce refuses any
245
+ * `definitionType` on PATCH, and any schedule field on a streaming insight ("You can't
246
+ * schedule the calculated insight because it's streaming"), even an unchanged one (live
247
+ * API 68). A changed value is sent, so the refusal stays Salesforce's answer.
248
+ */
249
+ const unchangedOnUpdate = new Set([
250
+ 'definitionType',
251
+ 'historyPublishScheduleInterval',
252
+ 'historyPublishScheduleTimeZone',
253
+ 'historyPublishTime',
254
+ 'publishScheduleEndDate',
255
+ 'publishScheduleInterval',
256
+ 'publishScheduleStartDateTime',
257
+ 'publishScheduleTimeZone',
258
+ ]);
259
+ /**
260
+ * The create/update body of one document: every key as authored, with the input names and
261
+ * enum forms of the two tables above. A null value is left out (the GET reports an unset
262
+ * field as null; the input documents that some unset fields must be omitted). The PATCH body
263
+ * leaves out `apiName`, which is in the route, and the definition type and schedule fields
264
+ * while they equal the org value (see `unchangedOnUpdate`).
265
+ * @param {NativeCalculatedInsight} document Complete document (SQL joined).
266
+ * @param {'create' | 'update'} operation POST or PATCH.
267
+ * @param {NativeCalculatedInsight} [observed] Org document an update is based on.
268
+ * @returns {Record<string, unknown>} Request body.
269
+ */
270
+ export function calculatedInsightInputBody(document, operation, observed) {
271
+ const body = {};
272
+ for (const [key, value] of Object.entries(validateNativeCalculatedInsight(document))) {
273
+ if (operation === 'update' &&
274
+ unchangedOnUpdate.has(key) &&
275
+ observed &&
276
+ sameCalculatedInsightValue(key, value, observed[key]))
277
+ continue;
278
+ if (value === null || (operation === 'update' && key === 'apiName'))
279
+ continue;
280
+ body[calculatedInsightInputKeys[key] ?? key] = calculatedInsightInputEnums.includes(key)
281
+ ? inputEnum(value)
282
+ : value;
283
+ }
284
+ return body;
285
+ }
286
+ /**
287
+ * Whether the org insight already holds the document: every key of the document equals the
288
+ * org GET projected with {@link observeNativeCalculatedInsight}. Keys the file leaves out are
289
+ * not compared, so a retrieved file deploys back unchanged and a shorter authored file too.
290
+ * @param {NativeCalculatedInsight} desired Document from the files.
291
+ * @param {NativeCalculatedInsight} observed Projected org document.
292
+ * @returns {boolean} True when nothing would change.
293
+ */
294
+ export function calculatedInsightMatches(desired, observed) {
295
+ return Object.keys(desired).every((key) => sameCalculatedInsightValue(key, desired[key], observed[key]));
296
+ }
297
+ /**
298
+ * The planning view of one document. Dependencies are every distinct `<Name>__dlm` and other
299
+ * `<Name>__cio` token in the SQL: a deploy orders the insight after the selected DMOs, IRs
300
+ * (through their unified DMOs) and insights it names. No SQL is parsed; a name in a comment
301
+ * or string only adds an ordering edge, and a missing object is Salesforce's answer.
302
+ * @param {NativeCalculatedInsight} document Complete document.
303
+ * @returns {CalculatedInsightReference} Planning view.
304
+ */
305
+ export function calculatedInsightReference(document) {
306
+ const names = new Map();
307
+ for (const match of document.expression.matchAll(/\b[A-Za-z][A-Za-z0-9_]*__(dlm|cio)\b/gu))
308
+ if (match[0] !== document.apiName)
309
+ names.set(match[0], match[1] === 'dlm' ? 'dmo' : 'calculated-insight');
310
+ return {
311
+ kind: 'calculated-insight',
312
+ identity: { dataSpace: document.dataSpace, apiName: document.apiName },
313
+ spec: {
314
+ dependencies: [...names]
315
+ // eslint-disable-next-line unicorn/no-array-sort -- Sorting a new array.
316
+ .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
317
+ .map(([apiName, kind]) => ({ kind, dataSpace: document.dataSpace, apiName })),
318
+ },
319
+ };
320
+ }
321
+ export { calculatedInsightName } from './path-selector.js';
@@ -0,0 +1,124 @@
1
+ import type { DocumentMode } from './verbatim-document.js';
2
+ import { DataGraphError } from './data-graph-document.js';
3
+ /**
4
+ * A data graph file: Salesforce's graph definition in `definition`, its data space in the
5
+ * top-level `c__dataSpace`. The definition may name Salesforce's own `dataspaceName` (retrieve
6
+ * writes it as read); the two must agree, and a definition without it takes it from
7
+ * `c__dataSpace` (the create body sends it).
8
+ */
9
+ export type NativeDataGraphDocument = {
10
+ schemaVersion: 1;
11
+ kind: 'native-data-graph';
12
+ apiVersion: '68.0';
13
+ c__dataSpace: string;
14
+ definition: Record<string, unknown>;
15
+ };
16
+ export type NativeDataGraphObservation = {
17
+ id: string;
18
+ createdDate: string;
19
+ /** One of the recorded states; a retrieve-mode observation takes any status as read. */
20
+ status: 'creating' | 'processing' | 'ready' | 'deleting' | 'editing' | 'editing_no_version_update' | 'editing_post_sync';
21
+ definitionFingerprint: string;
22
+ document: NativeDataGraphDocument;
23
+ target: Record<string, unknown>;
24
+ };
25
+ /**
26
+ * Admit saved native68 definitions by structure; the API decides what it accepts. Retrieve mode
27
+ * keeps unknown keys and unset (`null`) values, and checks only the name, data space, root
28
+ * object, schedule shape and node tree; a deploy of such a file refuses and names the key.
29
+ * `c__dataSpace` names the data space; `definition.dataspaceName`, when present, must equal it,
30
+ * and the returned definition always names it.
31
+ * @param {unknown} value Native document.
32
+ * @param {DocumentMode} mode Strictness (deploy by default).
33
+ * @returns {NativeDataGraphDocument} Detached admitted input with normalised enum spellings.
34
+ */
35
+ export declare function validateNativeDataGraphDocument(value: unknown, mode?: DocumentMode): NativeDataGraphDocument;
36
+ /**
37
+ * The data graph document of a definition that names its data space (`dataspaceName`).
38
+ * @param {Record<string, unknown>} definition Graph definition (checked by the validator).
39
+ * @returns {unknown} Document candidate for validateNativeDataGraphDocument.
40
+ */
41
+ export declare function nativeDataGraphDocumentOf(definition: Record<string, unknown>): unknown;
42
+ /**
43
+ * The data space a graph GET names (`dataspaceName`): the graph's real data space, read before
44
+ * anything is projected. A GET without a usable one is DATA_GRAPH_DATASPACE_UNREADABLE.
45
+ * @param {unknown} value Graph GET body.
46
+ * @returns {string} Data space.
47
+ */
48
+ export declare function nativeDataGraphSpace(value: unknown): string;
49
+ /**
50
+ * The refusal of a data graph whose file, or whose graph in the org, is in another data space
51
+ * than the run's.
52
+ * @param {string} name Graph name.
53
+ * @param {string} found The data space of the file or the org graph.
54
+ * @param {string} dataSpace The run's data space.
55
+ * @param {'file' | 'org'} where Whether the file or the org graph names `found`.
56
+ * @param {boolean} [crossSpace] A deploy --allow-cross-dataspace can translate: say so.
57
+ * @returns {DataGraphError} DATA_GRAPH_DATASPACE_MISMATCH with an explanation.
58
+ */
59
+ export declare function nativeDataGraphSpaceMismatch(name: string, found: string, dataSpace: string, where: 'file' | 'org', crossSpace?: boolean): DataGraphError;
60
+ /**
61
+ * Whether no node or field of a native GET reports dependencies or related segments.
62
+ * Delete requires this; retrieve and update do not.
63
+ * @param {unknown} value Native GET response (or its observed target).
64
+ * @returns {boolean} True when every dependency and related-segment array is empty.
65
+ */
66
+ export declare function nativeDataGraphUnreferenced(value: unknown): boolean;
67
+ /**
68
+ * Hash detached JSON with stable object keys while retaining every array order.
69
+ * @param {unknown} value JSON evidence.
70
+ * @returns {string} SHA256 evidence digest.
71
+ */
72
+ export declare function nativeGraphFingerprint(value: unknown): string;
73
+ /**
74
+ * Roundtrip qualified native GET data without treating record IDs as portable authority.
75
+ * Retrieve mode takes a graph in any status, keeps unknown keys (and a nonempty
76
+ * `extendedProperties`) and drops empty or `null` generated names.
77
+ * @param {unknown} value Native GET response.
78
+ * @param {DocumentMode} mode Strictness (deploy by default).
79
+ * @returns {NativeDataGraphDocument} Complete authored request representation.
80
+ */
81
+ export declare function nativeDataGraphDocumentFromResponse(value: unknown, mode?: DocumentMode): NativeDataGraphDocument;
82
+ /**
83
+ * Project an authored native document into its API68 create body: the authored definition as
84
+ * written (any root, related objects with their joins, field settings, schedules), without the
85
+ * graph-level generated DMO/mapping/transform names, fragment DMOs and join/field developer names.
86
+ * The node `devName` is kept: both recorded API68 creates sent one and the server replaced it.
87
+ * @param {unknown} value Native document.
88
+ * @returns {Record<string, unknown>} Detached create body.
89
+ */
90
+ export declare function nativeDataGraphCreateDefinition(value: unknown): Record<string, unknown>;
91
+ /**
92
+ * Build the PUT body from the authored definition: the file is the desired state. Fields and
93
+ * related objects are sent as the file lists them, so a field or related object the file leaves
94
+ * out is not sent and Salesforce answers (at API 68 it refuses removals with 400); a root change
95
+ * and another related object are sent too. Retained nodes and fields keep the generated names of
96
+ * the fresh target; a node whose object differs (a new root, another related object) and all
97
+ * nodes below it are sent without generated names. Key-qualifier fields Salesforce added (named
98
+ * by another field's keyQualifierName) are kept when the file leaves them out: a PUT without them
99
+ * keeps them (live, API 68). Omitted settings of the graph, a retained node or a retained field
100
+ * keep the target's values. Entries keep the target's order; new ones follow in authored order.
101
+ * A retained node keeps the target's label: Salesforce sets node labels itself, from the object's
102
+ * label, and keeps them when a POST or PUT sends another one (live, API 68, 2026-11-22/23).
103
+ * Refused: a different name or data space (they identify the target graph), a join change of a
104
+ * retained related object (DATA_GRAPH_JOIN_CHANGE; Salesforce ignores it), and a different type,
105
+ * reference or projected name of a retained node (assigned by the API: a recorded API68 create
106
+ * sent `standard` for a unified root and read `derived` back, 2026-11-12).
107
+ * @param {unknown} baseline Fresh independently bound native GET.
108
+ * @param {NativeDataGraphDocument} desired Authored intent, not target authority.
109
+ * @param {DocumentMode} mode Strictness of both documents (retrieve keeps unknown keys).
110
+ * @param {boolean} [superset] Readback only: keep every target field the authored node does not
111
+ * name (Salesforce adds fields, such as key qualifiers or data source fields on bridge nodes).
112
+ * @returns {Record<string, unknown>} Complete target-bound PUT payload.
113
+ */
114
+ export declare function buildNativeDataGraphUpdateRequest(baseline: unknown, desired: NativeDataGraphDocument, mode?: DocumentMode, superset?: boolean): Record<string, unknown>;
115
+ /**
116
+ * Bind independently read projection and generated identities; readiness is not computation proof.
117
+ * Retrieve mode takes any status, ID and creation date as read and does not require the generated
118
+ * names of a ready graph; the authored settings must still hold.
119
+ * @param {unknown} value Native GET response.
120
+ * @param {NativeDataGraphDocument} expected Authored intent.
121
+ * @param {DocumentMode} mode Strictness (deploy by default).
122
+ * @returns {NativeDataGraphObservation} Detached nonvolatile evidence.
123
+ */
124
+ export declare function observeNativeDataGraph(value: unknown, expected: NativeDataGraphDocument, mode?: DocumentMode): NativeDataGraphObservation;