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,527 @@
1
+ # Artifact formats
2
+
3
+ ## Public Graph document
4
+
5
+ Retrieve writes each data graph as `data360/dataGraphs/Name.native-dataGraph.json` at the
6
+ project root: `schemaVersion: 1`, `kind: native-data-graph`, `apiVersion: 68.0`, the
7
+ graph's data space in `c__dataSpace` and the `definition` as the API 68 GET returns it
8
+ (name, label, description, data space, root object, type, schedules, real-time settings, and
9
+ the root node with its fields, joins (`path`) and related objects), without server facts such
10
+ as IDs, status and dates. The file name must equal `definition.name`.
11
+
12
+ `c__dataSpace` must equal `definition.dataspaceName` when the definition names it
13
+ (`INVALID_DATASPACE_FIELD` otherwise); a definition without `dataspaceName` takes it from
14
+ `c__dataSpace`, and the create sends it. The file's data space must be the run's
15
+ (`--dataspace`, `default` when omitted; `DATA_GRAPH_DATASPACE_MISMATCH` otherwise, also for an
16
+ org graph of that name in another data space: graph names are unique in the org). Object
17
+ names are the names Salesforce stores in that data space (`ds2_Individual__dlm` for a
18
+ standard DMO copy outside `default`).
19
+
20
+ Deploy treats the file as the desired state of an existing graph. Fields and related objects
21
+ are sent as the file lists them, so a field or related object the file leaves out is not
22
+ sent; Salesforce decides and, at API 68, refuses removals, a root change and another related
23
+ object in place of an existing one with 400, reported as rejected. Key-qualifier fields that
24
+ Salesforce added (`KQ_` fields named by another field's `keyQualifierName`) are kept when
25
+ the file leaves them out. Generated names (node and field `devName`, join `devName`,
26
+ `fragmentDMOName` and the graph's generated DMO, mapping and transform names) are taken
27
+ from the org for objects it already holds and left out for new ones. Omitted settings keep
28
+ the org values. The plugin refuses, before any write, a join change of an existing related
29
+ object (`DATA_GRAPH_JOIN_CHANGE`: Salesforce accepts it but keeps the old join) and a
30
+ different type, reference or projected name of an existing node (assigned by Salesforce).
31
+ A node's `type` may be left out: a create then sends none and Salesforce assigns it, and an
32
+ update keeps the org value. The name and the data space identify the graph; a file with
33
+ another name addresses another graph.
34
+
35
+ ## Public identity resolution file
36
+
37
+ Retrieve writes each ruleset as
38
+ `data360/identityResolution/<Name>.identityResolution.json` at the project root:
39
+ `schemaVersion: 1`, `kind: identity-resolution`, the ruleset's data space in `c__dataSpace`,
40
+ `identity: {apiName}` and `spec` with the configuration. Its references (the secondary DMO,
41
+ the match and reconciliation entities and fields, the DLO sources and the unified and link
42
+ outputs) carry no data space: they are all in the ruleset's data space and named as
43
+ Salesforce stores them there. Outside `default` that is `<prefix>_<type>_<rulesetId>` for the
44
+ ruleset (`ds2_Individual_cx2a`), `ds2_Individual__dlm` with `FirstName__c` for a standard DMO
45
+ copy and its fields. The old `identity.dataSpace` and a `dataSpace` key in a reference are
46
+ refused (`LEGACY_DATASPACE_KEY`). The file's data space must be the run's
47
+ (`IDENTITY_RESOLUTION_DATASPACE_MISMATCH` otherwise, also for an org ruleset of that name in
48
+ another data space), and a non-default file whose name lacks the prefix of the org's data
49
+ space list is refused before any write (`IDENTITY_RESOLUTION_NAME_NOT_STORED`).
50
+
51
+ ## Public calculated insight files
52
+
53
+ Retrieve writes each calculated insight as
54
+ `data360/calculatedInsights/Name__cio.calculatedInsight-meta.json` (the API 68 GET body,
55
+ key names and enums as returned, without status, run and derived fields) and
56
+ `data360/calculatedInsights/Name__cio.calculatedInsight-meta.sql` (the expression as
57
+ plain SQL, ending with one LF), under the project root. Trailing line breaks of the SQL
58
+ file are not part of the `expression` that deploy sends and compares.
59
+
60
+ The JSON names the insight's data space in the top-level `c__dataSpace` string instead of
61
+ Salesforce's `dataSpace` key: retrieve checks that the GET names the run's data space and
62
+ writes it there, and deploy sends it as `dataSpaceName`. A file that still has `dataSpace`
63
+ is refused (`LEGACY_DATASPACE_KEY`), a missing or blank `c__dataSpace` is
64
+ `INVALID_DATASPACE_FIELD`, and one that is not the run's data space (`--dataspace`,
65
+ `default` when omitted) is `CI_DATASPACE_MISMATCH`.
66
+
67
+ Deploy, publish and delete read the same two files. Either file or the exact selector
68
+ selects the insight; the JSON is joined with exactly its SQL file. A missing JSON or
69
+ SQL file, an `expression` kept in the JSON, any other `Name__cio.calculatedInsight-meta.*`
70
+ file beside them, duplicate keys, a name that differs from the file name, links and
71
+ hard links block. A length-prefixed SHA256 digest binds the bytes of both files;
72
+ revalidation checks bytes and the frozen document before dispatch. Any key, status,
73
+ schedule and SQL is admitted; deploy sends the document as written (input key names and
74
+ enum forms translated, an unchanged `definitionType` left out of a PATCH) and Salesforce
75
+ decides.
76
+
77
+ ## Public segment files
78
+
79
+ Retrieve writes each segment as
80
+ `data360/segments/<Name>.segment.json` at the project root (identity, label,
81
+ description, segment type, `segmentOn` DMO, lookback, an optional `schedule`, and the list
82
+ of model names) and one `<Name>.segment.<model>.sql` per model beside it (that model's
83
+ `sql`, plain text, bytes as returned). A UI segment holds its criteria as a JSON object in
84
+ `includeCriteria` instead of models; other types (for example Waterfall or Dynamic) hold
85
+ neither, and the lookback only when the segment has one. A Waterfall holds its child
86
+ segments as `childSegments`, a list of segment API names in priority order (Salesforce
87
+ stores definition IDs; retrieve names them, deploy sends the IDs of the target org). A
88
+ file without `childSegments` leaves the children of the org segment alone; an empty list
89
+ is refused (`INVALID_SEGMENT_DOCUMENT`). `schedule` is the refresh
90
+ schedule in the shape the write takes (`frequency`, `interval`, `daysOfWeek` as a list,
91
+ `startDateTime`, `endDate`, `endDateTime`, optional `time` with `hour`, `minute` and
92
+ `timeZone`, or an hourly `publishInterval` when the read has no schedule details);
93
+ retrieve leaves it out for a segment that does not refresh, and `nextScheduledDate` is not
94
+ kept. On deploy, a file without `schedule` leaves the org schedule alone; one with it is
95
+ sent when a key it states differs from the org schedule (keys it leaves out keep their org
96
+ value), and `{"frequency": "None"}` turns it off.
97
+ The top-level `c__dataSpace` string names the segment's data space (the old
98
+ `identity.dataSpace` and `spec.segmentOn.dataSpace` keys are `LEGACY_DATASPACE_KEY`); the
99
+ `segmentOn` DMO and every Waterfall child are in that data space. `identity.apiName` and the
100
+ file name are the name Salesforce stores: `<prefix>_<Name>` in a non-default data space
101
+ (`ds2_Spring` in `dataspace2`), sent unchanged as `developerName` on create (Salesforce keeps a
102
+ name that has the prefix); a file there without the prefix is `SEGMENT_NAME_NOT_STORED`, and a
103
+ file of another data space than the run's is `SEGMENT_DATASPACE_MISMATCH`.
104
+ The file holds no `parameters` (the API has no write for them). A model name must start with a letter or digit and hold only
105
+ letters, digits and underscores, and two model names may not differ only in case; another
106
+ name is refused with `INVALID_SEGMENT_DOCUMENT`. A repeat retrieve of an unchanged segment
107
+ writes nothing (`unchanged`); with `--overwrite`, the SQL file of a model the segment no
108
+ longer has is removed.
109
+
110
+ Deploy, delete and `--changed-since` read the same files. The JSON or any of its SQL files,
111
+ or the exact selector, selects the segment; the JSON is joined with exactly one SQL file
112
+ per model. A missing JSON or SQL file, a `sql` kept in the JSON, any other
113
+ `<Name>.segment.*` file beside them, duplicate keys, a name that differs from the file
114
+ name, links and hard links block (`INVALID_SOURCE`). A length-prefixed SHA256 digest binds
115
+ the bytes of all files; revalidation checks bytes and the frozen document before dispatch.
116
+
117
+ ## Public data transform document
118
+
119
+ Retrieve writes each data transform as `data360/dataTransforms/<Name>.dataTransform.json`
120
+ under the project root, for custom, system and packaged transforms alike:
121
+
122
+ ```json
123
+ {
124
+ "apiVersion": "68.0",
125
+ "c__dataSpace": "default",
126
+ "definition": { "name": "Name", "label": "…", "type": "BATCH", "definition": { "…": "…" } },
127
+ "kind": "data-transform",
128
+ "schedule": {
129
+ "frequency": "Daily",
130
+ "interval": 1,
131
+ "time": { "hour": 3, "minute": 15, "timeZone": "GMT" }
132
+ },
133
+ "schemaVersion": 1
134
+ }
135
+ ```
136
+
137
+ `c__dataSpace` names the transform's data space and must agree with `definition.dataSpaceName`
138
+ when the definition names one (`INVALID_DATASPACE_FIELD` otherwise; kept and sent as written). A
139
+ transform whose GET has no `dataSpaceName` takes its data space from its MktDataTransform record
140
+ (SOQL); one without any data space there (a system transform) is in `default` only. A file of
141
+ another data space than the run's, or one whose name the org holds in another data space, is
142
+ `TRANSFORM_DATASPACE_MISMATCH`.
143
+
144
+ `definition` is the native create/update input as the API 68 GET returns it, without
145
+ server-owned keys, the schedule inside a definition, or the server-owned keys of each
146
+ output object. `schedule` is the schedule GET projected onto the keys its PUT takes:
147
+ `frequency`, `interval`, `daysOfWeek`, and `time` with `hour`, `minute` and `timeZone`
148
+ (from `time.timezone.zoneId`); `nextScheduledDate` and `type` are left out. A file may add
149
+ the write-only `shouldForceSpecifiedMinutes`: the PUT takes it, the GET never returns it,
150
+ and it is not compared. A transform that is never scheduled or turned
151
+ off gets no `schedule` key, so a deploy of the file leaves the target org's schedule alone. A system transform's per-definition map
152
+ (`{ "schedule": { "<Day0Name>": { … } }, "type": "Transform" }`) keeps the map with each
153
+ entry projected the same way and without the outer `type`. When the schedule read fails,
154
+ the file has no `schedule`, with a warning.
155
+
156
+ `schedule` is optional. Without it, deploy leaves the org schedule alone. With it, deploy
157
+ compares it with the org's projected schedule (frequency ignoring letter case,
158
+ `shouldForceSpecifiedMinutes` not compared) and, when it differs, sends it as written with
159
+ `PUT …/data-transforms/{name}/schedule`, then reads it back (it must have the file's
160
+ frequency). After a definition write it first waits, at most 5 minutes, until the transform
161
+ is no longer `PROCESSING` (`TRANSFORM_SCHEDULE_NOT_SENT` otherwise);
162
+ `TRANSFORM_SCHEDULE_REJECTED` reports Salesforce's refusal of that schedule PUT. `{ "frequency": "None" }`
163
+ turns the schedule off. A schedule that is not an object is refused
164
+ (`UNSUPPORTED_TRANSFORM_INPUT`). A schedule copied to another org makes the transform run
165
+ there (`TRANSFORM_SCHEDULE_CHANGE`).
166
+
167
+ ## Public data stream document
168
+
169
+ Retrieve writes each data stream as `data360/data-stream/<ApiName>.data-stream-meta.json`
170
+ in one of two shapes, both with `schemaVersion: 1`, `kind: "data-stream"`, the top-level
171
+ `c__dataSpace` (every data space of the landing DLO, sorted, read from the DLO) and
172
+ `identity: {apiName}`. The list only mirrors the DLO: deploy refuses a list without the run's
173
+ data space, one that differs from the DLO's data spaces, and, for a new stream (whose create
174
+ puts the DLO into the run's data space), more than one entry (`STREAM_DATASPACE_MISMATCH`).
175
+ The old `identity.dataSpace` is refused (`LEGACY_DATASPACE_KEY`).
176
+
177
+ - **Ingestion API stream:** `spec` holds `connectorType` (`IngestApi`), `connectionName`,
178
+ `event`, `datastreamType` (`INGEST_API`), `refreshMode`, `label`, `newDlo` (`name`,
179
+ `label`, `category` when the DLO has one, `eventDateTimeFieldName`, `primaryKey`),
180
+ `additiveFieldMappings` (`sourceFieldLabel`, `targetFieldName` without `__c`,
181
+ `targetFieldReturntype`) and `formulaMappings` (`targetFieldName`, `formula` plain,
182
+ `targetFieldReturntype`), plus the read-only `observed` section.
183
+ - **Any other connector** (Salesforce CRM `SalesforceDotCom` tested live; others such as
184
+ S3 untested): `spec` is the stream GET without server-owned keys, system fields and
185
+ system mappings, with `connectorInfo.connectorType` naming the connector. Its
186
+ `dataLakeObjectInfo.dataSpaceInfo` (Salesforce's own list) must name the same data spaces
187
+ as `c__dataSpace` (`STREAM_DATASPACE_MISMATCH`); deploy fills it from `c__dataSpace` when
188
+ the file leaves it out.
189
+
190
+ Create and update send the file as written and Salesforce decides; its 4xx answer to the
191
+ first write is reported as rejected, and a failure after an earlier write as unknown. Of
192
+ the Ingestion API file, the plugin itself refuses only an additive mapping whose
193
+ `sourceFieldLabel` names no event field, or several (`UNSUPPORTED_STREAM_MAPPING_SOURCE`:
194
+ Salesforce stores it unchecked as a mapping that never carries data), and a change of
195
+ `refreshMode`, the DLO label, category, event time field or primary key of an existing
196
+ stream (`UNSUPPORTED_STREAM_SETTINGS_CHANGE`: Salesforce answers 200 and keeps the old
197
+ value). A mapping left out of the file is sent as a removal (an empty formula). Of the
198
+ other-connector file, a plain mapping change is refused (`UNSUPPORTED_STREAM_SETTINGS_CHANGE`):
199
+ the stream update takes no `sourceFieldName`.
200
+
201
+ ## Public native DMO document
202
+
203
+ Exact `dmo:ApiName__dlm` retrieval writes
204
+ `<project-root>/data360/dmo/<ApiName>__dlm.dmo-meta.json`. The full API name,
205
+ including `__dlm`, is kept in the filename and in the identity. This is the only
206
+ DMO artifact format.
207
+
208
+ ```json
209
+ {
210
+ "schemaVersion": 1,
211
+ "kind": "dmo",
212
+ "c__dataSpace": "default",
213
+ "identity": { "apiName": "Customer__dlm" },
214
+ "spec": {
215
+ "label": "Customer",
216
+ "category": "Profile",
217
+ "description": "Customer master records",
218
+ "fields": [
219
+ { "name": "CustomerId__c", "label": "Customer Id", "dataType": "Text", "isPrimaryKey": true },
220
+ { "name": "SignupDate__c", "label": "Signup Date", "dataType": "Date", "isPrimaryKey": false }
221
+ ]
222
+ }
223
+ }
224
+ ```
225
+
226
+ ### Shape checks
227
+
228
+ The plugin validates the shape only:
229
+
230
+ - The document has exactly `schemaVersion: 1`, `kind: "dmo"`, `c__dataSpace`, `identity`
231
+ and `spec`.
232
+ - `c__dataSpace` is the DMO's data space: a nonblank, trimmed name. It must be the run's
233
+ data space (`--dataspace`, `default` when omitted; `DMO_DATASPACE_MISMATCH` otherwise).
234
+ The old `identity.dataSpace` key is refused (`LEGACY_DATASPACE_KEY`); any other invalid
235
+ value is `INVALID_DATASPACE_FIELD`.
236
+ - `identity` has exactly `apiName` (a letter, then letters, digits or underscores,
237
+ ending `__dlm`). In a non-default data space it is the name Salesforce stores there: a
238
+ standard DMO copy is `<prefix>_<Name>__dlm` (`ds2_Individual__dlm`) with fields without
239
+ `ssot__`, and a custom DMO keeps its own name.
240
+ - `spec` needs a nonblank `label`, a nonblank `category`, an optional string
241
+ `description` and a nonempty `fields` array. Other `spec` keys are allowed.
242
+ - Each field needs a `name` ending `__c` that is unique regardless of case, a
243
+ nonblank `label`, a nonempty string `dataType` and a boolean `isPrimaryKey`. Other
244
+ field keys are allowed, except the runtime keys `id`, `recordId`, `recordID`,
245
+ `createdDate`, `lastModifiedDate`, `isEnabled`, `isEditable`, `isSegmentable`,
246
+ `status` and `type`.
247
+
248
+ Shape failures are reported as `INVALID_DMO_DOCUMENT` or `INVALID_DMO_FIELD`. There
249
+ is no allowlist for categories, data types, label length, the number of primary
250
+ keys or extra keys. Those values are sent as authored and Salesforce decides.
251
+
252
+ ### What retrieval saves
253
+
254
+ - The object label, category, a nonempty description and all returned fields.
255
+ The category is saved in the input spelling (`Profile`, `Engagement`, `Other`),
256
+ although reads return upper case.
257
+ - The field `type` returned by reads is saved as `dataType`. A missing
258
+ `isPrimaryKey` is saved as `false`. The runtime keys listed above are dropped.
259
+ - Generated fields are left out: fields read as `creationType` `System`, the
260
+ system fields `DataSource__c`, `DataSourceObject__c` and
261
+ `InternalOrganization__c`, and names starting with `KQ_`. A primary key is always
262
+ saved, and so are the standard fields of a standard DMO. Keys that only reads
263
+ return (`creationType`, `isDistinct`, `usageTag`, `keyQualifierName`) are kept.
264
+ - Record IDs and other runtime observations of the object are not saved.
265
+
266
+ The file is indented with two spaces and ends with LF. Identical bytes are
267
+ unchanged; a differing file requires `--overwrite` (DMO names are unique in the org,
268
+ so the file at the path is the same DMO whatever data space it names). The
269
+ writer rejects linked paths and files above 1 MiB, stages the complete file under
270
+ the OS temp directory and publishes it by rename or exclusive hard link. Writer
271
+ codes: `UNSAFE_PATH`, `OVERWRITE_REQUIRED`, `OUTPUT_CHANGED`, `OUTPUT_FAILED`,
272
+ `PARTIAL_DMO_OUTPUT`.
273
+
274
+ ### What deployment sends
275
+
276
+ - Object and field names are sent without their `__dlm` / `__c` suffix.
277
+ - `creationType`, `isDistinct`, `usageTag` and `keyQualifierName` are never sent. A
278
+ file value that differs from the org is reported with the warning
279
+ `DMO_FIELD_KEY_NOT_SENT`; the outcome stays `created`, `updated` or `unchanged`.
280
+ - Generated fields (`DataSource__c`, `DataSourceObject__c`,
281
+ `InternalOrganization__c`, names starting with `KQ_`, or `creationType: System`)
282
+ are left out of a create. A definition may also omit them for an update; a deploy
283
+ never removes them (`delete --field` does on request).
284
+ - An absent `spec.description` is not managed: an update leaves the target value as
285
+ is. An explicit empty string clears it.
286
+ - Field `description` and `isDynamicLookup` are accepted by the API but never
287
+ returned by reads, and a field description does not appear in the Data Model UI.
288
+ They are sent when a field is created or otherwise edited; a change to them alone
289
+ cannot be detected or confirmed.
290
+ - An update sends the object label, a changed description, a changed category
291
+ (Salesforce rejects category changes), changed extra `spec` keys, and the edited
292
+ and added fields.
293
+ - A standard DMO (`creationType` `Standard` in the target, for example
294
+ `ssot__Brand__dlm`) uses the same file. An update sends only the edited and added
295
+ custom fields, the label when it differs, a changed description and changed extra
296
+ `spec` keys. `spec.category` is required by the file shape but ignored: it is
297
+ never sent or compared. Standard and system fields may be left out of
298
+ `spec.fields`; one that is listed must equal the target (`isMapped` and
299
+ `keyQualifierName` are not compared), otherwise the deploy is refused with
300
+ `UNSUPPORTED_DMO_FIELD_CHANGE`. A new field must be a plain custom field: no double
301
+ underscore before `__c` and no `creationType` other than `Custom`
302
+ (`UNSUPPORTED_DMO_FIELD_ADDITION`).
303
+ - A mapping file (`data360/mapping/<MappingApiName>.mapping-meta.json`) holds
304
+ `schemaVersion` 1, `kind` `mapping`, the top-level `c__dataSpace` (the mapping's data
305
+ space, which must be the run's: `MAPPING_DATASPACE_MISMATCH` otherwise;
306
+ `LEGACY_DATASPACE_KEY` for the old `identity.dataSpace`), `identity` with `apiName`
307
+ only, and `spec`. Mapping names are unique in the org, so the file at the path is the
308
+ same mapping whatever data space it names (`--overwrite` replaces it). It may name a
309
+ custom or a standard DMO in `spec.targetEntityDeveloperName`, under the name Salesforce
310
+ stores in the mapping's data space (`ds2_ContactPointEmail__dlm` with `EmailAddress__c`
311
+ for a standard DMO copy in `dataspace2`). The first mapping onto a standard DMO copy that
312
+ does not exist yet is sent once more in the default spelling when Salesforce answers the
313
+ copy spelling with 404 (see [mapping reference](types/mapping.md)). On a standard DMO the
314
+ authored pairs use the standard field names (for example `Id__c` to `ssot__Id__c`)
315
+ and the generated pairs read `DataSource__c` to `ssot__DataSourceId__c`,
316
+ `DataSourceObject__c` to `ssot__DataSourceObjectId__c`, `InternalOrganization__c`
317
+ to `ssot__InternalOrganizationId__c` and `KQ_Id__c` to `KQ_Id__c`; on a custom DMO
318
+ the generated pairs are same-name. Retrieve saves the authored pairs only and deploy
319
+ never sends generated pairs. Both decide which pairs are generated with one rule,
320
+ from fresh reads of the source data lake object and the target DMO, so a pair that
321
+ retrieve leaves out is never read as a removal. When those reads fail, retrieve
322
+ refuses the mapping with `MAPPING_GENERATED_PAIRS_UNPROVEN` and writes nothing for
323
+ it. The authored key pair is always saved. A file may list only the authored pairs, for a create and for a
324
+ deploy onto the existing mapping alike: the generated pairs are taken from the
325
+ org's copy and treated as part of the file. The authored primary-key pair must stay
326
+ in the file (`MAPPING_PROTECTED_PAIR_REQUIRED`). A deploy removes every authored
327
+ pair that the file no longer lists, including a pair onto a standard field; the
328
+ generated pairs and the key pair (source primary key onto target primary key, any
329
+ name and type) stay in the mapping. Pairs are sent as the file lists them, whatever
330
+ their data types and names, one source onto several targets and targets another
331
+ mapping also holds; Salesforce decides. Pairs whose data types differ get the
332
+ preview notice `MAPPING_FIELD_TYPES_DIFFER`. Salesforce requires a pair joining the
333
+ two primary keys when a mapping is created.
334
+ `sf data360 delete -m mapping:<MappingApiName>` deletes a mapping whatever pairs it
335
+ holds and then removes its local file (see Local files after delete). Only the last mapping of a custom DMO is refused
336
+ (`MAPPING_LAST_MAPPING_DELETE_BLOCKED`); delete the DMO instead. Creating the first mapping onto a standard
337
+ DMO that is not yet enabled activates it permanently; preview and create report
338
+ `MAPPING_ACTIVATES_STANDARD_DMO`. A pair may be removed from a mapping file even
339
+ when another mapping targets the same field. Observed at API 68 through the plugin:
340
+ a mapping created onto an already active standard DMO from a file with two authored
341
+ pairs, the retrieved file deploying back unchanged, the activation notice in a
342
+ preview, a first mapping created onto an inactive standard DMO, a pair onto a
343
+ standard field removed by deploying the retrieved file without it, the removal
344
+ of a field shared by two mappings of a custom DMO, and hand-written mapping files
345
+ with the authored pairs only deploying back unchanged onto a custom and a standard
346
+ DMO, one of them adding a pair and dropping another.
347
+ The optional `spec.label` is the mapping's label (Metadata API `masterLabel` of
348
+ `ObjectSourceTargetMap`, which the native routes do not carry). Retrieve fills it,
349
+ except when it equals the mapping's own name (the default Salesforce gives a mapping
350
+ created without one) or when its Metadata API read fails (then with a warning). A
351
+ file without `spec.label` leaves the org's label alone; a different label is set by
352
+ one Metadata API `updateMetadata` after the pair writes, carrying every pair the
353
+ mapping currently has and no other (a pair left out is kept, a pair sent is added).
354
+ - A data lake object file (`data360/dlo/<FullApiName>__dll.dlo-meta.json`) for an
355
+ existing data lake object may omit the fields Salesforce generated:
356
+ `cdp_sys_SourceVersion__c`, `DataSource__c`, `DataSourceObject__c`,
357
+ `InternalOrganization__c`, `cdp_sys_PartitionDate__c` on Engagement data lake
358
+ objects and the key qualifier `KQ_<Name>__c` of another field (`KQ_Id__c` for the
359
+ primary key, `KQ_RefId__c` for a relationship source field). They stay as they
360
+ are, and retrieve leaves them out of the file; the fields named by
361
+ `eventDateTimeFieldName` and `recordModifiedFieldName` are always saved. Any other field of the target that the file
362
+ omits is refused (`UNSUPPORTED_DLO_FIELD_CHANGE`). A listed field is compared on
363
+ the keys the file states: keys only the org's copy carries are ignored, and a
364
+ stated key that differs is refused with the same code.
365
+ - A data lake object file holds `schemaVersion` 1, `kind` `dlo`, the top-level key
366
+ `c__dataSpace` (every data space the DLO belongs to: a list of names sorted by name, at
367
+ least one, none repeated), `identity` with `apiName` only, and `spec`. The old
368
+ `identity.dataSpace` key is refused (`LEGACY_DATASPACE_KEY`); a filtered membership
369
+ `{ "name": …, "filter": … }` is recognised but refused until a filter is proven live
370
+ (`UNSUPPORTED_DATASPACE_FILTER`); any other invalid value is `INVALID_DATASPACE_FIELD`.
371
+ The list must hold the run's data space (`--dataspace`, `default` when omitted;
372
+ `DLO_DATASPACE_MISMATCH` otherwise). Deploy adds the DLO to listed data spaces it is not
373
+ in, and removes it from unlisted ones only with `--allow-dataspace-removal`.
374
+ - The data lake object `spec` holds `label`, `category`, `fields` and, optionally,
375
+ `eventDateTimeFieldName`: the full name (with `__c`) of one of the listed fields
376
+ that dates each record. Engagement data lake objects need it; create sends it
377
+ without the suffix and retrieval saves it. The category is sent as written and
378
+ Salesforce decides. Neither the category nor the event field can change after
379
+ create: a changed value is refused with `UNSUPPORTED_DLO_CATEGORY_CHANGE` or
380
+ `UNSUPPORTED_DLO_EVENT_FIELD_CHANGE` before any write.
381
+ - The data lake object `spec` may also hold `recordModifiedFieldName`, the full name
382
+ (with `__c`) of the field that marks the newest version of a record. Create sends
383
+ it without the suffix; an update sends it only when it differs from the org, and
384
+ Salesforce decides (it sets the field on a DLO without one and refuses a change once
385
+ one is set). The data model object file never holds `isSegmentable`: Salesforce
386
+ derives it and rejects it as input.
387
+
388
+ - A custom field that exists in the target and is missing from the file is a
389
+ removal. `sf data360 deploy --allow-field-removal` removes such fields with one
390
+ Metadata API destructive change for `CustomField`
391
+ `<ObjectName>__dlm.<FieldName>__c`, after the PATCH for other changes. The
392
+ primary-key field must stay in the file. A field that is currently mapped is
393
+ removed only when the same command also deploys every
394
+ `data360/mapping/<MappingApiName>.mapping-meta.json` file whose mapping holds a
395
+ pair with that `targetFieldDeveloperName`, with the pair removed from the file.
396
+ The removal runs in the DMO position; Salesforce drops the field's pairs with it,
397
+ and those mapping files deploy afterwards and find the pairs already gone.
398
+ Otherwise the deploy is refused with `DMO_FIELD_REMOVAL_MAPPED` before any write,
399
+ naming those files and the single command.
400
+ - `sf data360 delete -m dmo:<Name__dlm> --field <Field__c>` removes
401
+ named custom fields in the org with one destructive change (Salesforce drops their
402
+ mapping pairs with them), then overwrites this file
403
+ and the `data360/mapping/<MappingApiName>.mapping-meta.json` file of every mapping
404
+ that lost a pair with the current definition. Only files that already exist under
405
+ `--output-dir` (default: current directory) are refreshed in the same form retrieve
406
+ writes; none is created or removed.
407
+ - The `isMapped` marker on a field is saved as retrieved but describes the mapping,
408
+ not the DMO: it is never sent, compared or required.
409
+
410
+ Refused before any write: changing an existing field's `dataType` or
411
+ `isPrimaryKey`, omitting a custom field that exists in the target without
412
+ `--allow-field-removal`, omitting the target's primary-key field
413
+ (`UNSUPPORTED_DMO_FIELD_CHANGE`), adding a generated field or a second primary key
414
+ (`UNSUPPORTED_DMO_FIELD_ADDITION`) and creating a namespaced DMO
415
+ (`UNSUPPORTED_DMO_TARGET`). A whole-DMO delete is sent for every DMO, standard ones
416
+ included, and Salesforce decides. Every DMO other than a standard one and an
417
+ unprefixed custom one (platform-generated and namespaced DMOs included) is written
418
+ like a standard DMO, and Salesforce decides the rest.
419
+
420
+ Field removal is observed at API 68 on empty custom DMOs, unmapped and mapped by two
421
+ mappings, and on one standard DMO. Removing a data-bearing field is not verified.
422
+ Standard DMO writes are observed at API 68 through the plugin on one standard DMO in
423
+ two orgs, active in only one of them (add and relabel a custom field; remove it with
424
+ `--allow-field-removal` and with `delete --field`; object description set and
425
+ cleared); a category change and standard DMOs in active use are not tested. Writes to
426
+ platform-generated DMOs are observed at API 68 through the raw API.
427
+
428
+ The values Salesforce accepted in live verification at API 68 (categories, field
429
+ data types, label length and key rules) are listed in the [DMO reference](types/dmo.md).
430
+ That verification used empty, unmapped custom DMOs in the default data space.
431
+ Data-bearing DMOs, non-default data spaces, other API versions,
432
+ relationships and SQL/flex DMOs are not qualified.
433
+
434
+ DMOs use only `data360/dmo/<ApiName>__dlm.dmo-meta.json`.
435
+
436
+ ## Public native relationship document
437
+
438
+ `sf data360 retrieve -m relationship:<Dmo__dlm>` writes one file per relationship
439
+ whose source is that DMO, at
440
+ `<project-root>/data360/relationship/<Name>.relationship-meta.json`.
441
+
442
+ ```json
443
+ {
444
+ "schemaVersion": 1,
445
+ "kind": "relationship",
446
+ "c__dataSpace": "default",
447
+ "identity": {
448
+ "apiName": "Order_CustomerId_map_Customer_Id_1794467679481"
449
+ },
450
+ "spec": {
451
+ "sourceObjectName": "Order__dlm",
452
+ "sourceFieldName": "CustomerId__c",
453
+ "targetObjectName": "Customer__dlm",
454
+ "targetFieldName": "Id__c",
455
+ "cardinality": "ManyToOne",
456
+ "relationshipOwner": "DataCloud",
457
+ "label": "Order to customer"
458
+ }
459
+ }
460
+ ```
461
+
462
+ Shape checks:
463
+
464
+ - The document has exactly `schemaVersion: 1`, `kind: "relationship"`, `c__dataSpace`,
465
+ `identity` and `spec`; `c__dataSpace` is the relationship's data space (the run's,
466
+ `UNSUPPORTED_RELATIONSHIP_DATASPACE` otherwise; `LEGACY_DATASPACE_KEY` for the old
467
+ `identity.dataSpace`), and `identity` has exactly `apiName` (a letter, then letters,
468
+ digits or underscores).
469
+ - `spec` has the six keys shown and may have `label` (a nonblank, trimmed text). The source object ends `__dlm` and the
470
+ source field `__c`; the target object and field are any API names: a DMO and its
471
+ custom field, or a CRM object and field with `relationshipOwner` `SObject` (for
472
+ example `Account` and `Id`). `cardinality` and `relationshipOwner` are nonblank strings sent as written;
473
+ Salesforce decides which values it accepts.
474
+ - The file name must equal `identity.apiName` and the file must sit in a
475
+ `data360/relationship/` folder. Shape failures are reported as
476
+ `INVALID_RELATIONSHIP_DOCUMENT`.
477
+
478
+ Salesforce generates the relationship name (the example's shape). Retrieval saves
479
+ that name, the six authored values and the label (the Metadata API `masterLabel`;
480
+ left out when there is no record); the id, object and field labels, status and
481
+ creation type are not saved. A hand-written file may use any valid name, because
482
+ deploy finds the relationship by the file's name and otherwise by its binding:
483
+ source object and field, target object and field. A file without `label` leaves the
484
+ org's label as it is. Other values than the org's are sent as one Metadata API
485
+ `updateMetadata` of the whole record; Salesforce decides which it accepts. Two
486
+ files with the same binding in one command are refused (`DUPLICATE_IDENTITY`).
487
+ Delete uses the file to learn the source DMO, and the selector name must be the
488
+ org's relationship name; if the binding exists only under another name, delete
489
+ refuses with `RELATIONSHIP_NAME_MISMATCH` and names it.
490
+
491
+ The file is indented with two spaces and ends with LF. Identical bytes are
492
+ unchanged; a differing file requires `--overwrite` (relationship names are unique in the
493
+ org). Writer codes:
494
+ `UNSAFE_PATH`, `OVERWRITE_REQUIRED`, `OUTPUT_CHANGED`, `OUTPUT_FAILED`,
495
+ `PARTIAL_RELATIONSHIP_OUTPUT`.
496
+
497
+ ## Local files after delete
498
+
499
+ After a confirmed deletion, `sf data360 delete` removes the deleted component's local
500
+ file: on the outcome `deleted` (mutation `confirmed-deleted`) and on
501
+ `deletion-processing` (mutation `acknowledged-processing`, Salesforce accepted the
502
+ deletion and is finishing it). Removed are the files under `data360/` in the current
503
+ directory for `dlo`, `dmo` and `relationship`, and `data-stream` (with
504
+ `--delete-dlo` also the linked data lake object's file); for a mapping the file of
505
+ that name or the hand-written file whose binding matches; for a data transform
506
+ `data360/dataTransforms/<Name>.dataTransform.json` and for a calculated insight both
507
+ `data360/calculatedInsights/<Name>.calculatedInsight-meta.json` and
508
+ `.calculatedInsight-meta.sql` in the current directory; for a segment
509
+ `data360/segments/<Name>.segment.json` and every `<Name>.segment.*.sql` beside it; and for
510
+ an identity resolution or data graph its canonical file
511
+ (`data360/identityResolution/<Name>.identityResolution.json`,
512
+ `data360/dataGraphs/<Name>.native-dataGraph.json`), all in the current directory. Files are found by name at these paths; only the
513
+ segments folder is listed, for the segment's SQL files. Mapping files of mappings
514
+ Salesforce removes together with a deleted DMO are not removed, because those
515
+ mappings are not items of the command.
516
+
517
+ Each file is removed on its own with one unlink. Only regular files are removed:
518
+ directories, symbolic links, junctions, files reached through a linked folder and
519
+ hard-linked files are refused (`UNSAFE_PATH`), as is any path outside the project's
520
+ `data360` folder. Each result item lists
521
+ `removedLocalFiles` with an outcome per file: `removed`, `not-present`, `kept` or
522
+ `failed`. A failed removal keeps the confirmed org result, and the command exits
523
+ nonzero with `LOCAL_FILE_REMOVAL_FAILED`. `--keep-local-files` keeps every file
524
+ (outcome `kept`). `--preview` removes nothing and lists the files as `localFiles` with
525
+ `exists`. The outcomes unchanged, blocked, failed, unknown, rejected and
526
+ deletion-unconfirmed remove
527
+ nothing. `delete --field` removes no file; it refreshes the DMO and mapping files.