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,348 @@
1
+ import { displayableApiText, getConnectDiagnostic, retainConnectDiagnostic, } from './connect-diagnostic.js';
2
+ import { replaceExplanation } from '../services/operation-diagnostic.js';
3
+ import { DataStreamError, buildDataStreamCreateBody, buildDataStreamPatchBody, crmDataStreamWriteBody, crmDeploySpec, isCrmDataStreamDocument, validateCrmDataStreamDocument, } from '../artifacts/data-stream-document.js';
4
+ import { dataStreamApiVersion } from './api-version.js';
5
+ import { ConnectError } from './connect-client.js';
6
+ import { openBoundSsot } from './bound-ssot.js';
7
+ /** Metadata API type of a data stream; its record name is the stream name. */
8
+ export const streamMetadataType = 'DataStreamDefinition';
9
+ const name = /^[A-Za-z][A-Za-z0-9_]{0,199}$/u;
10
+ const developerName = /^[A-Za-z][A-Za-z0-9_]*$/u;
11
+ const id = /^[A-Za-z0-9]{18}$/u;
12
+ const readId = /^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/u;
13
+ /**
14
+ * Admit an exact connection record ID as one encoded path segment.
15
+ * @param {string} value Candidate 15/18-character ID.
16
+ * @returns {string} Connection resource path.
17
+ */
18
+ function connectionPath(value) {
19
+ if (typeof value !== 'string' || !readId.test(value))
20
+ throw new ConnectError('INVALID_REQUEST');
21
+ return `connections/${encodeURIComponent(value)}`;
22
+ }
23
+ /**
24
+ * Admit an exact developer name or record ID as one encoded dependency path segment.
25
+ * @param {string} value Candidate identity.
26
+ * @returns {string} Dependency resource suffix.
27
+ */
28
+ function dependencyPath(value) {
29
+ if (typeof value !== 'string' || (!developerName.test(value) && !readId.test(value)))
30
+ throw new ConnectError('INVALID_REQUEST');
31
+ return `${encodeURIComponent(value)}/dependencies`;
32
+ }
33
+ /**
34
+ * Construct native connection/dependency readers. Family admission validates bodies and decides.
35
+ * @param {ConnectClient} reader Authenticated native GET transport.
36
+ * @param {string} apiVersion Qualified stream pin (API68 only).
37
+ * @returns {DataStreamReferenceReader} Read-only native routes.
38
+ */
39
+ export function createDataStreamReferenceReader(reader, apiVersion = 'auto') {
40
+ const root = `/services/data/v${dataStreamApiVersion(apiVersion)}/ssot`;
41
+ const read = async (path) => {
42
+ const value = await reader.get(`${root}/${path}`);
43
+ if (!value || typeof value !== 'object' || Array.isArray(value))
44
+ throw new ConnectError('REQUEST_FAILED');
45
+ const resource = value;
46
+ if (Object.keys(resource).length === 0 ||
47
+ ['error', 'errors', 'errorCode', 'body', 'result'].some((key) => Object.hasOwn(resource, key)) ||
48
+ (Object.hasOwn(resource, 'success') && resource.success !== true))
49
+ throw new ConnectError('REQUEST_FAILED');
50
+ return resource;
51
+ };
52
+ return {
53
+ connections: {
54
+ list: async (offset = 0) => read(`connections?connectorType=IngestApi&limit=200&offset=${offset}`),
55
+ get: async (connectionId) => read(connectionPath(connectionId)),
56
+ schema: async (connectionId) => read(`${connectionPath(connectionId)}/schema`),
57
+ },
58
+ dependencies: {
59
+ stream: async (identity) => read(`data-streams/${dependencyPath(identity)}`),
60
+ dlo: async (identity) => read(`data-lake-objects/${dependencyPath(identity)}`),
61
+ },
62
+ };
63
+ }
64
+ /** Genuine native HTTP failure, without response text or credentials. */
65
+ export class DataStreamHttpError extends DataStreamError {
66
+ status;
67
+ constructor(code, status) {
68
+ super(code);
69
+ this.status = status;
70
+ }
71
+ }
72
+ /**
73
+ * Construct bounded stream transport. Writes go over the bound in-process connection and are
74
+ * never resent once they may have reached Salesforce; they are not lifecycle authorization.
75
+ * @param {string} targetOrg Existing CLI org alias.
76
+ * @param {ConnectClient} reader Authenticated native GET transport.
77
+ * @param {string} apiVersion Initial qualified pin only.
78
+ * @param {BoundSsot} [sender] The command's shared sender; defaults to one opened for targetOrg.
79
+ * @returns {DataStreamClient} Internal operations; no command wiring.
80
+ */
81
+ export function createDataStreamClient(targetOrg, reader, apiVersion = 'auto', sender) {
82
+ const version = dataStreamApiVersion(apiVersion);
83
+ const endpoint = `/services/data/v${version}/ssot/data-streams`;
84
+ if (!targetOrg || targetOrg.startsWith('-') || /[\p{Cc}]/u.test(targetOrg))
85
+ throw new DataStreamError('INVALID_STREAM_ORG');
86
+ const bound = sender ?? openBoundSsot(targetOrg, version);
87
+ /**
88
+ * Resolve a safe pagination offset; response echoes may omit filters, never change them.
89
+ * @param {unknown} value Server URL.
90
+ * @param {string} connectionName Selected connection.
91
+ * @param {boolean} continuation Require complete filters on a URL that would be followed.
92
+ * @returns {number} Bounded integer offset.
93
+ */
94
+ function pageOffset(value, connectionName, continuation) {
95
+ if (typeof value !== 'string' || /[\\\s#%]/u.test(value) || !value.startsWith(`${endpoint}?`))
96
+ throw new DataStreamError('INVALID_STREAM_PAGE');
97
+ const url = new URL(value, 'https://pagination.invalid');
98
+ const keys = [...url.searchParams.keys()];
99
+ if (new Set(keys).size !== keys.length ||
100
+ keys.some((key) => !['connectionName', 'includeMappings', 'limit', 'offset'].includes(key)) ||
101
+ url.searchParams.get('limit') !== '200' ||
102
+ (url.searchParams.has('connectionName') &&
103
+ url.searchParams.get('connectionName') !== connectionName) ||
104
+ (url.searchParams.has('includeMappings') &&
105
+ url.searchParams.get('includeMappings') !== 'true') ||
106
+ (continuation &&
107
+ (url.searchParams.get('connectionName') !== connectionName ||
108
+ url.searchParams.get('includeMappings') !== 'true')))
109
+ throw new DataStreamError('INVALID_STREAM_PAGE');
110
+ const offset = url.searchParams.get('offset');
111
+ if (!offset || !/^(?:0|[1-9]\d*)$/u.test(offset) || Number(offset) > 2000)
112
+ throw new DataStreamError('INVALID_STREAM_PAGE');
113
+ return Number(offset);
114
+ }
115
+ /**
116
+ * Read a complete selected-connection inventory; never return partial evidence.
117
+ * @param {string} connectionName Exact developer name.
118
+ * @returns {Promise<Array<Record<string, unknown>>>} Detached raw stream inventory.
119
+ */
120
+ async function list(connectionName) {
121
+ if (!name.test(connectionName))
122
+ throw new DataStreamError('INVALID_STREAM_CONNECTION');
123
+ const entries = [];
124
+ const identities = new Set();
125
+ const recordIds = new Set();
126
+ const offsets = new Set();
127
+ let offset = 0;
128
+ let total;
129
+ for (let pageIndex = 0; pageIndex < 20; pageIndex++) {
130
+ if (offsets.has(offset))
131
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
132
+ offsets.add(offset);
133
+ const value = await reader.get(`${endpoint}?connectionName=${connectionName}&includeMappings=true&limit=200&offset=${offset}`);
134
+ if (!value || typeof value !== 'object' || Array.isArray(value))
135
+ throw new DataStreamError('INVALID_STREAM_PAGE');
136
+ const page = value;
137
+ if (Object.keys(page).some((key) => !['currentPageUrl', 'nextPageUrl', 'totalSize', 'dataStreams'].includes(key)) ||
138
+ !Array.isArray(page.dataStreams) ||
139
+ page.dataStreams.length > 200 ||
140
+ !Number.isSafeInteger(page.totalSize) ||
141
+ page.totalSize < 0 ||
142
+ (total !== undefined && total !== page.totalSize))
143
+ throw new DataStreamError('INVALID_STREAM_PAGE');
144
+ total = page.totalSize;
145
+ const echoed = pageOffset(page.currentPageUrl, connectionName, false);
146
+ // Observed first-page offset is 1 for request offset 0. Do not follow that echo.
147
+ if (echoed !== offset && !(offset === 0 && echoed === 1))
148
+ throw new DataStreamError('INVALID_STREAM_PAGE');
149
+ for (const value of page.dataStreams) {
150
+ if (!value || typeof value !== 'object' || Array.isArray(value))
151
+ throw new DataStreamError('INVALID_STREAM_PAGE');
152
+ const item = value;
153
+ if (typeof item.name !== 'string' ||
154
+ !name.test(item.name) ||
155
+ typeof item.recordId !== 'string' ||
156
+ !id.test(item.recordId) ||
157
+ item.dataSource !== connectionName)
158
+ throw new DataStreamError('INVALID_STREAM_PAGE');
159
+ if (identities.has(item.name.toLowerCase()) || recordIds.has(item.recordId))
160
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
161
+ identities.add(item.name.toLowerCase());
162
+ recordIds.add(item.recordId);
163
+ entries.push(structuredClone(item));
164
+ }
165
+ if (entries.length > total)
166
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
167
+ if (entries.length === total) {
168
+ if (page.nextPageUrl != undefined && page.nextPageUrl !== '')
169
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
170
+ return entries;
171
+ }
172
+ if (page.dataStreams.length === 0)
173
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
174
+ const next = pageOffset(page.nextPageUrl, connectionName, true);
175
+ if (next !== offset + 200)
176
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
177
+ offset = next;
178
+ }
179
+ throw new DataStreamError('INCOMPLETE_STREAM_LIST');
180
+ }
181
+ /**
182
+ * Send one native mutation on the bound connection. It is never resent once it may have
183
+ * reached Salesforce, and never after a token refresh; the caller's read-back decides.
184
+ * @param {'POST' | 'PATCH' | 'DELETE'} method Qualified HTTP verb.
185
+ * @param {string} suffix Checked target/query suffix.
186
+ * @param {unknown} [body] Operation-specific body, absent for DELETE.
187
+ * @returns {Promise<unknown>} Untrusted echo or undefined, never settlement proof.
188
+ */
189
+ async function send(method, suffix, body) {
190
+ const noContent = Symbol('stream-no-content');
191
+ let response;
192
+ try {
193
+ response = await bound.request(method, endpoint + suffix, noContent, body);
194
+ }
195
+ catch (error) {
196
+ if (!(error instanceof ConnectError))
197
+ throw error;
198
+ const status = error.code === 'AUTHENTICATION_FAILED' ? 401 : error.statusCode;
199
+ throw retainConnectDiagnostic(new DataStreamHttpError(status === undefined ? 'STREAM_REQUEST_UNCONFIRMED' : 'STREAM_HTTP_ERROR', status), getConnectDiagnostic(error));
200
+ }
201
+ if (method === 'DELETE') {
202
+ if (response !== noContent)
203
+ throw new DataStreamHttpError('STREAM_DELETE_UNCONFIRMED');
204
+ return;
205
+ }
206
+ if (response === noContent)
207
+ throw new DataStreamHttpError('STREAM_REQUEST_UNCONFIRMED', 204);
208
+ if (!response || typeof response !== 'object' || Array.isArray(response))
209
+ throw new DataStreamHttpError('INVALID_STREAM_RESPONSE');
210
+ return response;
211
+ }
212
+ return {
213
+ get: async (nameOrId) => {
214
+ if (!name.test(nameOrId) && !readId.test(nameOrId))
215
+ throw new DataStreamError('INVALID_STREAM_NAME');
216
+ try {
217
+ return await reader.get(`${endpoint}/${nameOrId}?includeMappings=true`);
218
+ }
219
+ catch (error) {
220
+ if (error instanceof ConnectError)
221
+ throw new DataStreamHttpError(error.code, error.statusCode);
222
+ throw new DataStreamHttpError('STREAM_REQUEST_UNCONFIRMED');
223
+ }
224
+ },
225
+ list,
226
+ create: async (document, sourceFields) => send('POST', '', isCrmDataStreamDocument(document)
227
+ ? crmDataStreamWriteBody(crmDeploySpec(validateCrmDataStreamDocument(document)))
228
+ : buildDataStreamCreateBody(document, sourceFields)),
229
+ update: async (recordId, document) => {
230
+ if (!id.test(recordId))
231
+ throw new DataStreamError('INVALID_STREAM_TARGET_ID');
232
+ return send('PATCH', `/${recordId}`, buildDataStreamPatchBody(document));
233
+ },
234
+ patch: async (recordId, body) => {
235
+ if (!id.test(recordId))
236
+ throw new DataStreamError('INVALID_STREAM_TARGET_ID');
237
+ if (!body || typeof body !== 'object' || Array.isArray(body) || !body.datastreamType)
238
+ throw new DataStreamError('EMPTY_STREAM_PATCH');
239
+ return send('PATCH', `/${recordId}`, body);
240
+ },
241
+ delete: async (recordId, deleteDlo) => {
242
+ if (!id.test(recordId) || typeof deleteDlo !== 'boolean')
243
+ throw new DataStreamError('INVALID_STREAM_TARGET_ID');
244
+ await send('DELETE', `/${recordId}?shouldDeleteDataLakeObject=${String(deleteDlo)}`);
245
+ },
246
+ ...(bound.metadata ? { relabel: relabelCall(bound.metadata) } : {}),
247
+ };
248
+ }
249
+ /**
250
+ * Salesforce's refusal of a stream label update: nothing was changed. Texts pass the display
251
+ * filter of REST errors; a text that does not pass is left out.
252
+ * @param {string} apiName Stream name.
253
+ * @param {Array<{code?: unknown; message?: unknown}>} problems Salesforce's answers.
254
+ * @returns {DataStreamError} STREAM_LABEL_UPDATE_REJECTED with an explanation.
255
+ */
256
+ function labelRefusal(apiName, problems) {
257
+ const said = problems
258
+ .slice(0, 3)
259
+ .map(({ code, message }) => [
260
+ typeof code === 'string' && /^[\w:.-]{1,80}$/u.test(code) ? code : undefined,
261
+ displayableApiText(message),
262
+ ]
263
+ .filter(Boolean)
264
+ .join(': '))
265
+ .filter(Boolean);
266
+ const error = new DataStreamError('STREAM_LABEL_UPDATE_REJECTED');
267
+ replaceExplanation(error, `Salesforce refused the Metadata API update of the ${streamMetadataType} ${apiName}${said.length > 0 ? `: ${said.join('; ').replace(/\.$/u, '')}` : ' without a text the plugin can show'}. The label was not changed.`);
268
+ return error;
269
+ }
270
+ /**
271
+ * A Metadata API answer as a list of records.
272
+ * @param {unknown} value One record or several.
273
+ * @returns {unknown[]} Records.
274
+ */
275
+ function metadataRecords(value) {
276
+ if (value === undefined || value === null)
277
+ return [];
278
+ return Array.isArray(value) ? value : [value];
279
+ }
280
+ /**
281
+ * Whether a Metadata API value is an explicit nil (`xsi:nil`), which a write must not send back.
282
+ * @param {unknown} value Record value.
283
+ * @returns {boolean} Explicit nil.
284
+ */
285
+ function metadataNil(value) {
286
+ if (!value || typeof value !== 'object' || Array.isArray(value))
287
+ return false;
288
+ const attributes = value.$;
289
+ return (!!attributes &&
290
+ typeof attributes === 'object' &&
291
+ attributes['xsi:nil'] === 'true');
292
+ }
293
+ /** SOAP faults where Salesforce refused the request itself, so nothing was applied. */
294
+ const clientFault = /^(?:soapenv:Client|sf:(?:INVALID_\w+|MALFORMED_\w+|REQUEST_LIMIT_EXCEEDED|INSUFFICIENT_ACCESS|API_DISABLED_FOR_ORG|UNSUPPORTED_API_VERSION))$/u;
295
+ /**
296
+ * The stream label update on the bound Connection: read the DataStreamDefinition, replace its
297
+ * label, send one `updateMetadata`. Salesforce decides; its refusal is reported with its text.
298
+ * @param {Function} open The bound sender's Metadata API.
299
+ * @returns {Function} relabel(apiName, label, send).
300
+ */
301
+ function relabelCall(open) {
302
+ return async (apiName, label, send = async (write) => write()) => {
303
+ if (!name.test(apiName) || typeof label !== 'string' || label === '')
304
+ throw new DataStreamError('INVALID_STREAM_NAME');
305
+ const api = await open();
306
+ let current;
307
+ try {
308
+ current = metadataRecords(await api.read(streamMetadataType, [apiName])).find((entry) => !!entry &&
309
+ typeof entry === 'object' &&
310
+ entry.fullName === apiName);
311
+ }
312
+ catch {
313
+ // Only a read failed: nothing was written.
314
+ const error = new DataStreamError('STREAM_LABEL_READ_FAILED');
315
+ replaceExplanation(error, `The Metadata API read of the ${streamMetadataType} ${apiName} before its label update failed, so the update was not sent.`);
316
+ throw error;
317
+ }
318
+ if (!current)
319
+ throw labelRefusal(apiName, []);
320
+ const record = {
321
+ ...Object.fromEntries(Object.entries(current).filter(([, value]) => !metadataNil(value))),
322
+ masterLabel: label,
323
+ };
324
+ await send(async () => {
325
+ let answer;
326
+ try {
327
+ answer = await api.update(streamMetadataType, record);
328
+ }
329
+ catch (error) {
330
+ // Only a client fault is Salesforce refusing the request; a server fault (soapenv:Server,
331
+ // sf:UNKNOWN_EXCEPTION) may follow an applied update, so it stays unconfirmed.
332
+ const fault = error;
333
+ if (typeof fault?.name === 'string' && clientFault.test(fault.name))
334
+ throw labelRefusal(apiName, [{ code: fault.name, message: fault.message }]);
335
+ throw new DataStreamError('STREAM_REQUEST_UNCONFIRMED');
336
+ }
337
+ const [result] = metadataRecords(answer);
338
+ if (result?.success === true)
339
+ return;
340
+ if (result?.success === false)
341
+ throw labelRefusal(apiName, metadataRecords(result.errors).map((entry) => {
342
+ const problem = (entry ?? {});
343
+ return { code: problem.statusCode, message: problem.message };
344
+ }));
345
+ throw new DataStreamError('STREAM_REQUEST_UNCONFIRMED');
346
+ });
347
+ };
348
+ }
@@ -0,0 +1,25 @@
1
+ import { ConnectClient } from './connect-client.js';
2
+ export type DataTransformClient = {
3
+ get: (nameOrId: string) => Promise<unknown>;
4
+ schedule: (nameOrId: string) => Promise<unknown>;
5
+ list: (offset?: number) => Promise<unknown>;
6
+ validate: (input: unknown) => Promise<unknown>;
7
+ create: (input: unknown) => Promise<unknown>;
8
+ update: (targetId: string, input: unknown) => Promise<unknown>;
9
+ /** Replace the schedule of one transform, sent as written; Salesforce decides. */
10
+ setSchedule: (targetId: string, schedule: Record<string, unknown>) => Promise<unknown>;
11
+ /** The data space of every transform of the org (SOQL), read once per client. */
12
+ dataSpaces: () => Promise<ReadonlyMap<string, string | null>>;
13
+ delete: (targetId: string) => Promise<unknown>;
14
+ };
15
+ /**
16
+ * Bind only the native API68 definition lifecycle contract, in any data space: transform names
17
+ * are unique in the org, so the routes take no data space (the list ignores one, live API 68);
18
+ * a transform on DMOs names its data space in the input's `dataSpaceName`, sent as written.
19
+ * Callers authorize create-only POST, identity-bound full-input PUT or schedule PUT; no runs.
20
+ * @param {ConstructorParameters<typeof ConnectClient>[0]} connection Existing authenticated receiver.
21
+ * @param {string} apiVersion Exact native API version.
22
+ * @param {string} dataSpace The run's data space (a data space name).
23
+ * @returns {DataTransformClient} Single-attempt reads, validation, definition and schedule writes.
24
+ */
25
+ export declare function createDataTransformClient(connection: ConstructorParameters<typeof ConnectClient>[0], apiVersion: string, dataSpace: string): DataTransformClient;
@@ -0,0 +1,100 @@
1
+ import { ConnectClient } from './connect-client.js';
2
+ import { buildDataTransformInput, DataTransformError, dataTransformName, dataTransformId, } from '../artifacts/data-transform-document.js';
3
+ import { isDataSpaceName } from '../artifacts/data-space-field.js';
4
+ import { readDataTransformSpaces } from '../services/data-transform-space.js';
5
+ /** Native transport with no authentication replay or implicit write fallback. */
6
+ class DataTransformTransport extends ConnectClient {
7
+ /**
8
+ * Dispatch one fixed route without refresh, retry or redirects.
9
+ * @param {string} route Qualified root-relative endpoint.
10
+ * @param {'GET' | 'POST' | 'PUT' | 'DELETE'} method Read or definition validation.
11
+ * @param {Record<string, unknown>} [body] Admitted input projection only.
12
+ * @returns {Promise<unknown>} Untrusted native response.
13
+ */
14
+ async request(route, method, body) {
15
+ return this.send({
16
+ method,
17
+ url: this.safeUrl(route),
18
+ ...(body === undefined
19
+ ? {}
20
+ : { body: JSON.stringify(body), headers: { 'content-type': 'application/json' } }),
21
+ }, this.noRefreshReceiver());
22
+ }
23
+ }
24
+ /**
25
+ * Bind only the native API68 definition lifecycle contract, in any data space: transform names
26
+ * are unique in the org, so the routes take no data space (the list ignores one, live API 68);
27
+ * a transform on DMOs names its data space in the input's `dataSpaceName`, sent as written.
28
+ * Callers authorize create-only POST, identity-bound full-input PUT or schedule PUT; no runs.
29
+ * @param {ConstructorParameters<typeof ConnectClient>[0]} connection Existing authenticated receiver.
30
+ * @param {string} apiVersion Exact native API version.
31
+ * @param {string} dataSpace The run's data space (a data space name).
32
+ * @returns {DataTransformClient} Single-attempt reads, validation, definition and schedule writes.
33
+ */
34
+ export function createDataTransformClient(connection, apiVersion, dataSpace) {
35
+ if (apiVersion !== '68.0' || !isDataSpaceName(dataSpace))
36
+ throw new DataTransformError('INVALID_TRANSFORM_SCOPE');
37
+ const transport = new DataTransformTransport(connection, apiVersion);
38
+ const origin = connection.instanceUrl;
39
+ const request = connection.request;
40
+ /** Reject rebinding the authenticated receiver between admission and dispatch. */
41
+ function checkBinding() {
42
+ if (connection.instanceUrl !== origin || connection.request !== request)
43
+ throw new DataTransformError('TRANSFORM_CONNECTION_DRIFT');
44
+ }
45
+ const endpoint = '/services/data/v68.0/ssot/data-transforms';
46
+ let spaces;
47
+ /**
48
+ * Validate a name or native transform record ID, never an arbitrary URL.
49
+ * @param {string} nameOrId Selected exact identity.
50
+ * @returns {string} Fixed item route.
51
+ */
52
+ function item(nameOrId) {
53
+ checkBinding();
54
+ if (typeof nameOrId !== 'string' ||
55
+ !(dataTransformName.test(nameOrId) || dataTransformId.test(nameOrId)))
56
+ throw new DataTransformError('INVALID_TRANSFORM_SELECTION');
57
+ return `${endpoint}/${nameOrId}`;
58
+ }
59
+ return {
60
+ get: async (nameOrId) => transport.request(item(nameOrId), 'GET'),
61
+ schedule: async (nameOrId) => transport.request(`${item(nameOrId)}/schedule`, 'GET'),
62
+ list: async (offset) => {
63
+ checkBinding();
64
+ if (offset !== undefined &&
65
+ (!Number.isSafeInteger(offset) || offset < 0 || offset > 2000 || offset % 20 !== 0))
66
+ throw new DataTransformError('INVALID_TRANSFORM_OFFSET');
67
+ return transport.request(`${endpoint}?limit=20&orderBy=NameAsc${offset === undefined ? '' : `&offset=${offset}`}`, 'GET');
68
+ },
69
+ validate: async (input) => {
70
+ checkBinding();
71
+ return transport.request(`${endpoint}-validation`, 'POST', buildDataTransformInput(input));
72
+ },
73
+ create: async (input) => {
74
+ checkBinding();
75
+ return transport.request(endpoint, 'POST', buildDataTransformInput(input));
76
+ },
77
+ delete: async (targetId) => {
78
+ if (typeof targetId !== 'string' || !dataTransformId.test(targetId))
79
+ throw new DataTransformError('INVALID_TRANSFORM_TARGET_ID');
80
+ return transport.request(item(targetId), 'DELETE');
81
+ },
82
+ update: async (targetId, input) => {
83
+ if (typeof targetId !== 'string' || !dataTransformId.test(targetId))
84
+ throw new DataTransformError('INVALID_TRANSFORM_TARGET_ID');
85
+ return transport.request(item(targetId), 'PUT', buildDataTransformInput(input));
86
+ },
87
+ dataSpaces: async () => {
88
+ checkBinding();
89
+ spaces ??= readDataTransformSpaces(async (query) => transport.soql(query));
90
+ return spaces;
91
+ },
92
+ setSchedule: async (targetId, schedule) => {
93
+ if (typeof targetId !== 'string' || !dataTransformId.test(targetId))
94
+ throw new DataTransformError('INVALID_TRANSFORM_TARGET_ID');
95
+ if (!schedule || typeof schedule !== 'object' || Array.isArray(schedule))
96
+ throw new DataTransformError('UNSUPPORTED_TRANSFORM_INPUT');
97
+ return transport.request(`${item(targetId)}/schedule`, 'PUT', structuredClone(schedule));
98
+ },
99
+ };
100
+ }
@@ -0,0 +1,22 @@
1
+ import { ConnectClient } from './connect-client.js';
2
+ import type { DloClient } from './dlo-rest.js';
3
+ export type DloDeleteClient = Pick<DloClient, 'get' | 'delete'> & {
4
+ /** What Salesforce lists as depending on the DLO; Salesforce refuses its DELETE while any remain. */
5
+ dependencies: (apiName: string) => Promise<unknown>;
6
+ };
7
+ /**
8
+ * Map transport failures to DLO codes while keeping the safe API diagnostic.
9
+ * Any GET 404 means absent, matching the child adapter: the live DLO 404 body uses
10
+ * INVALID_INPUT, not ITEM_NOT_FOUND, so a strict body check would never match.
11
+ * @param {unknown} error Transport failure.
12
+ * @returns {unknown} DloError with retained diagnostic, or the original error.
13
+ */
14
+ export declare function dloFailure(error: unknown): unknown;
15
+ /**
16
+ * Bind DLO delete reads and the exact-ID DELETE to one authenticated Connection.
17
+ * @param {string} targetOrg Resolved username of the target org.
18
+ * @param {string} apiVersion Native API version (default/auto 68).
19
+ * @param {Function} [connect] Supplies the authenticated Connection; tests inject a synthetic one.
20
+ * @returns {DloDeleteClient} Name GET and ID DELETE, each sent at most once.
21
+ */
22
+ export declare function createNativeDloDeleteClient(targetOrg: string, apiVersion?: string, connect?: () => Promise<ConstructorParameters<typeof ConnectClient>[0]>): DloDeleteClient;
@@ -0,0 +1,89 @@
1
+ import { AuthInfo, Connection } from '@salesforce/core';
2
+ import { ConnectClient, ConnectError } from './connect-client.js';
3
+ import { getConnectDiagnostic, retainConnectDiagnostic } from './connect-diagnostic.js';
4
+ import { DloError, dloName } from '../artifacts/dlo-document.js';
5
+ import { nativeApiVersion } from './api-version.js';
6
+ const recordId = /^[A-Za-z0-9]{18}$/u;
7
+ /** Single-attempt DLO routes on the bound Connection: no child CLI, refresh, retry or redirect. */
8
+ class DloTransport extends ConnectClient {
9
+ /**
10
+ * Dispatch one fixed DLO route.
11
+ * @param {string} route Root-relative endpoint.
12
+ * @param {'GET' | 'DELETE'} method Read or exact-ID delete.
13
+ * @param {unknown} [noContent] Sentinel JSforce returns for HTTP 204.
14
+ * @returns {Promise<unknown>} Untrusted native response.
15
+ */
16
+ async request(route, method, noContent) {
17
+ return this.send({ method, url: this.safeUrl(route) }, this.noRefreshReceiver(), noContent);
18
+ }
19
+ }
20
+ /**
21
+ * Map transport failures to DLO codes while keeping the safe API diagnostic.
22
+ * Any GET 404 means absent, matching the child adapter: the live DLO 404 body uses
23
+ * INVALID_INPUT, not ITEM_NOT_FOUND, so a strict body check would never match.
24
+ * @param {unknown} error Transport failure.
25
+ * @returns {unknown} DloError with retained diagnostic, or the original error.
26
+ */
27
+ export function dloFailure(error) {
28
+ if (!(error instanceof ConnectError))
29
+ return error;
30
+ const status = error.code === 'AUTHENTICATION_FAILED' ? 401 : error.statusCode;
31
+ return retainConnectDiagnostic(new DloError(status === undefined ? 'DLO_REQUEST_UNCONFIRMED' : 'DLO_HTTP_ERROR', status), getConnectDiagnostic(error));
32
+ }
33
+ /**
34
+ * Bind DLO delete reads and the exact-ID DELETE to one authenticated Connection.
35
+ * @param {string} targetOrg Resolved username of the target org.
36
+ * @param {string} apiVersion Native API version (default/auto 68).
37
+ * @param {Function} [connect] Supplies the authenticated Connection; tests inject a synthetic one.
38
+ * @returns {DloDeleteClient} Name GET and ID DELETE, each sent at most once.
39
+ */
40
+ export function createNativeDloDeleteClient(targetOrg, apiVersion = '68.0', connect) {
41
+ const version = nativeApiVersion(apiVersion);
42
+ const endpoint = `/services/data/v${version}/ssot/data-lake-objects`;
43
+ const open = connect ??
44
+ (async () => Connection.create({
45
+ authInfo: await AuthInfo.create({ username: targetOrg }),
46
+ connectionOptions: { version },
47
+ }));
48
+ let transport;
49
+ const bound = () => (transport ??= (async () => new DloTransport(await open(), version))());
50
+ return {
51
+ get: async (apiName) => {
52
+ if (!dloName.test(apiName))
53
+ throw new DloError('INVALID_DLO_NAME');
54
+ const client = await bound();
55
+ try {
56
+ return await client.request(`${endpoint}/${apiName}`, 'GET');
57
+ }
58
+ catch (error) {
59
+ throw dloFailure(error);
60
+ }
61
+ },
62
+ dependencies: async (apiName) => {
63
+ if (!dloName.test(apiName))
64
+ throw new DloError('INVALID_DLO_NAME');
65
+ const client = await bound();
66
+ try {
67
+ return await client.request(`${endpoint}/${apiName}/dependencies`, 'GET');
68
+ }
69
+ catch (error) {
70
+ throw dloFailure(error);
71
+ }
72
+ },
73
+ delete: async (id) => {
74
+ if (!recordId.test(id))
75
+ throw new DloError('INVALID_DLO_TARGET_ID');
76
+ const client = await bound();
77
+ const noContent = Symbol('dlo-deleted');
78
+ let response;
79
+ try {
80
+ response = await client.request(`${endpoint}/${id}`, 'DELETE', noContent);
81
+ }
82
+ catch (error) {
83
+ throw dloFailure(error);
84
+ }
85
+ if (response !== noContent)
86
+ throw new DloError('DLO_DELETE_UNCONFIRMED');
87
+ },
88
+ };
89
+ }
@@ -0,0 +1,23 @@
1
+ import type { BoundSsot } from './bound-ssot.js';
2
+ export type DloClient = {
3
+ get: (apiName: string) => Promise<unknown>;
4
+ create: (body: Record<string, unknown>) => Promise<unknown>;
5
+ update: (id: string, body: Record<string, unknown>) => Promise<unknown>;
6
+ delete: (id: string) => Promise<void>;
7
+ /** Add DLOs to a data space with one PUT; members it does not name stay (live API 68). */
8
+ putMembers: (dataSpace: string, memberNames: string[]) => Promise<unknown>;
9
+ /** Remove one DLO from a data space; the DLO itself is kept. */
10
+ removeMember: (dataSpace: string, memberName: string) => Promise<unknown>;
11
+ };
12
+ /**
13
+ * Build a minimal API68 client on the bound in-process connection. Writes are never resent
14
+ * after they may have reached Salesforce; only an actual HTTP 404 indicates absence.
15
+ * @param {string} targetOrg Explicit authenticated org alias or username.
16
+ * @param {string} apiVersion Numeric >=61 or default/auto 68; admission is not live qualification.
17
+ * @param {BoundSsot} [sender] The command's shared sender; defaults to one opened for targetOrg.
18
+ * @param {ReadonlyMap<string, unknown>} [listed] Entries of this run's DLO listing at the same
19
+ * version, by name. A listed name's GET answers with its entry in the item GET's envelope,
20
+ * which Salesforce returns byte for byte the same, instead of another request.
21
+ * @returns {DloClient} Four operations; the caller's read-back decides what a write did.
22
+ */
23
+ export declare function createDloClient(targetOrg: string, apiVersion?: string, sender?: BoundSsot, listed?: ReadonlyMap<string, unknown>): DloClient;