sf-plugin-data 0.1.0 → 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 (269) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +572 -240
  3. package/docs/artifact-format.md +527 -633
  4. package/docs/capabilities.md +1159 -168
  5. package/docs/git-workflow.md +135 -12
  6. package/docs/handover.md +7826 -12
  7. package/lib/api.d.ts +7 -0
  8. package/lib/api.js +7 -0
  9. package/lib/artifacts/code-fields.d.ts +49 -0
  10. package/lib/artifacts/code-fields.js +142 -0
  11. package/lib/artifacts/data-graph-document.d.ts +29 -0
  12. package/lib/artifacts/data-graph-document.js +52 -0
  13. package/lib/artifacts/data-space-field.d.ts +65 -0
  14. package/lib/artifacts/data-space-field.js +98 -0
  15. package/lib/artifacts/data-stream-document.d.ts +264 -0
  16. package/lib/artifacts/data-stream-document.js +680 -0
  17. package/lib/artifacts/data-transform-document.d.ts +152 -0
  18. package/lib/artifacts/data-transform-document.js +560 -0
  19. package/lib/artifacts/dependency-selection.d.ts +51 -0
  20. package/lib/artifacts/dependency-selection.js +154 -0
  21. package/lib/artifacts/dlo-document.d.ts +93 -0
  22. package/lib/artifacts/dlo-document.js +253 -0
  23. package/lib/artifacts/enum-case.d.ts +39 -0
  24. package/lib/artifacts/enum-case.js +67 -0
  25. package/lib/artifacts/git-deploy-selection.d.ts +68 -0
  26. package/lib/artifacts/git-deploy-selection.js +474 -0
  27. package/lib/artifacts/identity-resolution-document.d.ts +133 -0
  28. package/lib/artifacts/identity-resolution-document.js +625 -0
  29. package/lib/artifacts/mapping-document.d.ts +1 -0
  30. package/lib/artifacts/mapping-document.js +1 -0
  31. package/lib/artifacts/native-calculated-insight-document.d.ts +142 -0
  32. package/lib/artifacts/native-calculated-insight-document.js +321 -0
  33. package/lib/artifacts/native-data-graph-document.d.ts +124 -0
  34. package/lib/artifacts/native-data-graph-document.js +780 -0
  35. package/lib/artifacts/native-dmo-document.d.ts +151 -0
  36. package/lib/artifacts/native-dmo-document.js +313 -0
  37. package/lib/artifacts/native-mapping-document.d.ts +67 -0
  38. package/lib/artifacts/native-mapping-document.js +187 -0
  39. package/lib/artifacts/native-relationship-document.d.ts +76 -0
  40. package/lib/artifacts/native-relationship-document.js +232 -0
  41. package/lib/artifacts/path-selector.d.ts +55 -0
  42. package/lib/artifacts/path-selector.js +167 -0
  43. package/lib/artifacts/read-deploy-input.d.ts +222 -6
  44. package/lib/artifacts/read-deploy-input.js +1213 -53
  45. package/lib/artifacts/segment-document.d.ts +183 -0
  46. package/lib/artifacts/segment-document.js +570 -0
  47. package/lib/artifacts/verbatim-document.d.ts +203 -0
  48. package/lib/artifacts/verbatim-document.js +339 -0
  49. package/lib/artifacts/write-data-graph.d.ts +17 -0
  50. package/lib/artifacts/write-data-graph.js +162 -0
  51. package/lib/artifacts/write-data-stream.d.ts +11 -0
  52. package/lib/artifacts/write-data-stream.js +175 -0
  53. package/lib/artifacts/write-data-transform.d.ts +11 -0
  54. package/lib/artifacts/write-data-transform.js +180 -0
  55. package/lib/artifacts/write-dlo.d.ts +11 -0
  56. package/lib/artifacts/write-dlo.js +158 -0
  57. package/lib/artifacts/write-identity-resolution.d.ts +18 -0
  58. package/lib/artifacts/write-identity-resolution.js +165 -0
  59. package/lib/artifacts/write-mapping-definition.d.ts +17 -0
  60. package/lib/artifacts/write-mapping-definition.js +127 -0
  61. package/lib/artifacts/write-member-export.d.ts +88 -0
  62. package/lib/artifacts/write-member-export.js +199 -0
  63. package/lib/artifacts/write-native-calculated-insight.d.ts +21 -0
  64. package/lib/artifacts/write-native-calculated-insight.js +176 -0
  65. package/lib/artifacts/write-native-dmo.d.ts +11 -0
  66. package/lib/artifacts/write-native-dmo.js +158 -0
  67. package/lib/artifacts/write-native-mapping.d.ts +11 -0
  68. package/lib/artifacts/write-native-mapping.js +157 -0
  69. package/lib/artifacts/write-native-relationship.d.ts +11 -0
  70. package/lib/artifacts/write-native-relationship.js +157 -0
  71. package/lib/artifacts/write-segment.d.ts +26 -0
  72. package/lib/artifacts/write-segment.js +212 -0
  73. package/lib/commands/data360/delete.d.ts +280 -0
  74. package/lib/commands/data360/delete.js +2297 -0
  75. package/lib/commands/data360/deploy.d.ts +234 -15
  76. package/lib/commands/data360/deploy.js +2292 -100
  77. package/lib/commands/data360/publish.d.ts +93 -0
  78. package/lib/commands/data360/publish.js +292 -0
  79. package/lib/commands/data360/retrieve.d.ts +260 -13
  80. package/lib/commands/data360/retrieve.js +1880 -85
  81. package/lib/commands/data360/segment/members/export.d.ts +101 -0
  82. package/lib/commands/data360/segment/members/export.js +318 -0
  83. package/lib/errors/codes/calculated-insight.d.ts +2 -0
  84. package/lib/errors/codes/calculated-insight.js +25 -0
  85. package/lib/errors/codes/data-graph.d.ts +2 -0
  86. package/lib/errors/codes/data-graph.js +22 -0
  87. package/lib/errors/codes/data-stream.d.ts +2 -0
  88. package/lib/errors/codes/data-stream.js +70 -0
  89. package/lib/errors/codes/data-transform.d.ts +2 -0
  90. package/lib/errors/codes/data-transform.js +35 -0
  91. package/lib/errors/codes/dependency.d.ts +2 -0
  92. package/lib/errors/codes/dependency.js +11 -0
  93. package/lib/errors/codes/dlo.d.ts +2 -0
  94. package/lib/errors/codes/dlo.js +31 -0
  95. package/lib/errors/codes/dmo.d.ts +2 -0
  96. package/lib/errors/codes/dmo.js +28 -0
  97. package/lib/errors/codes/general.d.ts +2 -0
  98. package/lib/errors/codes/general.js +57 -0
  99. package/lib/errors/codes/identity-resolution.d.ts +2 -0
  100. package/lib/errors/codes/identity-resolution.js +24 -0
  101. package/lib/errors/codes/mapping.d.ts +2 -0
  102. package/lib/errors/codes/mapping.js +42 -0
  103. package/lib/errors/codes/relationship.d.ts +2 -0
  104. package/lib/errors/codes/relationship.js +21 -0
  105. package/lib/errors/codes/segment.d.ts +2 -0
  106. package/lib/errors/codes/segment.js +49 -0
  107. package/lib/errors/registry.d.ts +60 -0
  108. package/lib/errors/registry.js +123 -0
  109. package/lib/plugin.d.ts +1 -0
  110. package/lib/plugin.js +3 -1
  111. package/lib/services/acquire-retrieve-selection.d.ts +43 -0
  112. package/lib/services/acquire-retrieve-selection.js +145 -0
  113. package/lib/services/bind-identity-resolution-dependencies.d.ts +53 -0
  114. package/lib/services/bind-identity-resolution-dependencies.js +238 -0
  115. package/lib/services/bind-segment-dependencies.d.ts +49 -0
  116. package/lib/services/bind-segment-dependencies.js +115 -0
  117. package/lib/services/bounded-reads.d.ts +17 -0
  118. package/lib/services/bounded-reads.js +42 -0
  119. package/lib/services/calculated-insight-sql-checks.d.ts +33 -0
  120. package/lib/services/calculated-insight-sql-checks.js +193 -0
  121. package/lib/services/command-dlo.d.ts +48 -0
  122. package/lib/services/command-dlo.js +103 -0
  123. package/lib/services/command-native-data-graph.d.ts +54 -0
  124. package/lib/services/command-native-data-graph.js +485 -0
  125. package/lib/services/command-native-data-stream.d.ts +104 -0
  126. package/lib/services/command-native-data-stream.js +257 -0
  127. package/lib/services/command-native-dmo.d.ts +124 -0
  128. package/lib/services/command-native-dmo.js +338 -0
  129. package/lib/services/command-native-mapping.d.ts +65 -0
  130. package/lib/services/command-native-mapping.js +129 -0
  131. package/lib/services/command-native-relationship.d.ts +46 -0
  132. package/lib/services/command-native-relationship.js +103 -0
  133. package/lib/services/cross-dataspace-deploy.d.ts +111 -0
  134. package/lib/services/cross-dataspace-deploy.js +493 -0
  135. package/lib/services/cross-dataspace-rename.d.ts +74 -0
  136. package/lib/services/cross-dataspace-rename.js +1314 -0
  137. package/lib/services/cross-dataspace-sql.d.ts +109 -0
  138. package/lib/services/cross-dataspace-sql.js +1301 -0
  139. package/lib/services/cross-space-context.d.ts +23 -0
  140. package/lib/services/cross-space-context.js +36 -0
  141. package/lib/services/crud-plan.d.ts +137 -0
  142. package/lib/services/crud-plan.js +408 -0
  143. package/lib/services/data-space-check.d.ts +89 -0
  144. package/lib/services/data-space-check.js +162 -0
  145. package/lib/services/data-space-prefix.d.ts +77 -0
  146. package/lib/services/data-space-prefix.js +127 -0
  147. package/lib/services/data-transform-space.d.ts +31 -0
  148. package/lib/services/data-transform-space.js +79 -0
  149. package/lib/services/delete-calculated-insight.d.ts +44 -0
  150. package/lib/services/delete-calculated-insight.js +101 -0
  151. package/lib/services/delete-data-transform.d.ts +52 -0
  152. package/lib/services/delete-data-transform.js +222 -0
  153. package/lib/services/delete-dmo-field.d.ts +211 -0
  154. package/lib/services/delete-dmo-field.js +472 -0
  155. package/lib/services/delete-identity-resolution.d.ts +43 -0
  156. package/lib/services/delete-identity-resolution.js +295 -0
  157. package/lib/services/delete-segment.d.ts +42 -0
  158. package/lib/services/delete-segment.js +248 -0
  159. package/lib/services/deploy-result.d.ts +54 -0
  160. package/lib/services/deploy-result.js +60 -0
  161. package/lib/services/escaped-copy.d.ts +23 -0
  162. package/lib/services/escaped-copy.js +88 -0
  163. package/lib/services/execute-calculated-insight-deploy.d.ts +42 -0
  164. package/lib/services/execute-calculated-insight-deploy.js +96 -0
  165. package/lib/services/execute-data-transform-deploy.d.ts +56 -0
  166. package/lib/services/execute-data-transform-deploy.js +168 -0
  167. package/lib/services/execute-native-identity-resolution-deploy.d.ts +48 -0
  168. package/lib/services/execute-native-identity-resolution-deploy.js +360 -0
  169. package/lib/services/execute-segment-deploy.d.ts +45 -0
  170. package/lib/services/execute-segment-deploy.js +393 -0
  171. package/lib/services/local-file-removal.d.ts +36 -0
  172. package/lib/services/local-file-removal.js +103 -0
  173. package/lib/services/native-calculated-insight.d.ts +87 -0
  174. package/lib/services/native-calculated-insight.js +164 -0
  175. package/lib/services/native-crm-data-stream.d.ts +91 -0
  176. package/lib/services/native-crm-data-stream.js +272 -0
  177. package/lib/services/native-data-graph-context.d.ts +12 -0
  178. package/lib/services/native-data-graph-context.js +139 -0
  179. package/lib/services/native-data-graph-crd.d.ts +261 -0
  180. package/lib/services/native-data-graph-crd.js +866 -0
  181. package/lib/services/native-data-stream.d.ts +329 -0
  182. package/lib/services/native-data-stream.js +1830 -0
  183. package/lib/services/native-dlo.d.ts +163 -0
  184. package/lib/services/native-dlo.js +402 -0
  185. package/lib/services/native-dmo.d.ts +191 -0
  186. package/lib/services/native-dmo.js +614 -0
  187. package/lib/services/native-mapping.d.ts +255 -0
  188. package/lib/services/native-mapping.js +1226 -0
  189. package/lib/services/native-relationship.d.ts +132 -0
  190. package/lib/services/native-relationship.js +512 -0
  191. package/lib/services/operation-diagnostic.d.ts +83 -0
  192. package/lib/services/operation-diagnostic.js +272 -0
  193. package/lib/services/preflight-calculated-insight-deploy.d.ts +58 -0
  194. package/lib/services/preflight-calculated-insight-deploy.js +95 -0
  195. package/lib/services/preflight-data-transform-deploy.d.ts +33 -0
  196. package/lib/services/preflight-data-transform-deploy.js +104 -0
  197. package/lib/services/preflight-identity-resolution-deploy.d.ts +107 -0
  198. package/lib/services/preflight-identity-resolution-deploy.js +281 -0
  199. package/lib/services/preflight-segment-deploy.d.ts +31 -0
  200. package/lib/services/preflight-segment-deploy.js +109 -0
  201. package/lib/services/publish-calculated-insight.d.ts +40 -0
  202. package/lib/services/publish-calculated-insight.js +95 -0
  203. package/lib/services/publish-segment.d.ts +65 -0
  204. package/lib/services/publish-segment.js +194 -0
  205. package/lib/services/readback-pace.d.ts +16 -0
  206. package/lib/services/readback-pace.js +23 -0
  207. package/lib/services/retrieve-data-transform.d.ts +26 -0
  208. package/lib/services/retrieve-data-transform.js +65 -0
  209. package/lib/services/retrieve-identity-resolution.d.ts +40 -0
  210. package/lib/services/retrieve-identity-resolution.js +87 -0
  211. package/lib/services/retrieve-inventory.d.ts +32 -0
  212. package/lib/services/retrieve-inventory.js +151 -0
  213. package/lib/services/retrieve-segment.d.ts +120 -0
  214. package/lib/services/retrieve-segment.js +502 -0
  215. package/lib/services/segment-lookup.d.ts +46 -0
  216. package/lib/services/segment-lookup.js +108 -0
  217. package/lib/services/segment-members.d.ts +144 -0
  218. package/lib/services/segment-members.js +402 -0
  219. package/lib/services/select-native-retrieve.d.ts +60 -0
  220. package/lib/services/select-native-retrieve.js +226 -0
  221. package/lib/services/settle-calculated-insight.d.ts +22 -0
  222. package/lib/services/settle-calculated-insight.js +53 -0
  223. package/lib/services/sql-tokens.d.ts +58 -0
  224. package/lib/services/sql-tokens.js +147 -0
  225. package/lib/transport/api-version.d.ts +36 -0
  226. package/lib/transport/api-version.js +89 -0
  227. package/lib/transport/bound-ssot.d.ts +27 -0
  228. package/lib/transport/bound-ssot.js +116 -0
  229. package/lib/transport/calculated-insight-rest.d.ts +28 -0
  230. package/lib/transport/calculated-insight-rest.js +62 -0
  231. package/lib/transport/connect-client.d.ts +94 -32
  232. package/lib/transport/connect-client.js +318 -178
  233. package/lib/transport/connect-diagnostic.d.ts +89 -0
  234. package/lib/transport/connect-diagnostic.js +331 -0
  235. package/lib/transport/data-graph-rest.d.ts +27 -0
  236. package/lib/transport/data-graph-rest.js +76 -0
  237. package/lib/transport/data-stream-rest.d.ts +62 -0
  238. package/lib/transport/data-stream-rest.js +348 -0
  239. package/lib/transport/data-transform-rest.d.ts +25 -0
  240. package/lib/transport/data-transform-rest.js +100 -0
  241. package/lib/transport/dlo-native-rest.d.ts +22 -0
  242. package/lib/transport/dlo-native-rest.js +89 -0
  243. package/lib/transport/dlo-rest.d.ts +23 -0
  244. package/lib/transport/dlo-rest.js +135 -0
  245. package/lib/transport/dmo-native-rest.d.ts +18 -0
  246. package/lib/transport/dmo-native-rest.js +55 -0
  247. package/lib/transport/dmo-rest.d.ts +30 -0
  248. package/lib/transport/dmo-rest.js +163 -0
  249. package/lib/transport/mapping-rest.d.ts +63 -0
  250. package/lib/transport/mapping-rest.js +341 -0
  251. package/lib/transport/project-metadata.d.ts +36 -0
  252. package/lib/transport/project-metadata.js +118 -0
  253. package/lib/transport/relationship-rest.d.ts +43 -0
  254. package/lib/transport/relationship-rest.js +201 -0
  255. package/package.json +29 -6
  256. package/lib/artifacts/dmo-document.d.ts +0 -181
  257. package/lib/artifacts/dmo-document.js +0 -848
  258. package/lib/artifacts/dmo-update-delta.d.ts +0 -28
  259. package/lib/artifacts/dmo-update-delta.js +0 -86
  260. package/lib/artifacts/write-other-dmo.d.ts +0 -17
  261. package/lib/artifacts/write-other-dmo.js +0 -140
  262. package/lib/services/execute-dmo-create.d.ts +0 -24
  263. package/lib/services/execute-dmo-create.js +0 -118
  264. package/lib/services/execute-dmo-deploy.d.ts +0 -33
  265. package/lib/services/execute-dmo-deploy.js +0 -197
  266. package/lib/services/preflight-dmo-deploy.d.ts +0 -69
  267. package/lib/services/preflight-dmo-deploy.js +0 -161
  268. package/lib/services/retrieve-other-dmo.d.ts +0 -46
  269. package/lib/services/retrieve-other-dmo.js +0 -140
@@ -0,0 +1,101 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { Connection } from '@salesforce/core';
3
+ import { plugin } from '../../../../plugin.js';
4
+ import type { MemberFormat } from '../../../../artifacts/write-member-export.js';
5
+ import type { DetailColumn, SegmentCandidate, SegmentSummary } from '../../../../services/segment-members.js';
6
+ import type { BoundSsot } from '../../../../transport/bound-ssot.js';
7
+ export type SegmentMembersEnvelope = {
8
+ contract: 'sf-data360-segment-members';
9
+ contractVersion: '1.0.0';
10
+ status: 'success' | 'blocked' | 'failed';
11
+ metadata: {
12
+ operation: 'segment-members-export';
13
+ apiVersion: string;
14
+ plugin: typeof plugin;
15
+ };
16
+ provenance: {
17
+ command: 'sf data360 segment members export';
18
+ generatedAt: string;
19
+ };
20
+ diagnostics: {
21
+ warnings: string[];
22
+ errors: Array<{
23
+ code: string;
24
+ message: string;
25
+ retryable: false;
26
+ }>;
27
+ };
28
+ result: {
29
+ segment?: Omit<SegmentSummary, 'membershipDmo' | 'segmentOn' | 'displayName'>;
30
+ includeDetails: boolean;
31
+ resultFormat: MemberFormat;
32
+ outputFile?: string;
33
+ rowsWritten: number;
34
+ totalCount?: number;
35
+ pages: number;
36
+ columnHeaders?: ColumnHeaders;
37
+ columns?: Array<DetailColumn & {
38
+ header: string;
39
+ }>;
40
+ routes: Array<{
41
+ operation: string;
42
+ apiVersion: string;
43
+ transport: 'native';
44
+ }>;
45
+ };
46
+ };
47
+ type ColumnHeaders = 'label' | 'api-name';
48
+ /**
49
+ * Export the members of one published segment as CSV or JSON rows: a data export, written
50
+ * outside the `data360/` definition folders.
51
+ */
52
+ export default class SegmentMembersExport extends SfCommand<SegmentMembersEnvelope> {
53
+ static readonly aliases: string[];
54
+ static readonly summary = "Export the members of one published segment as CSV or JSON.";
55
+ static readonly description = "Reads the members of the segment named by -m segment:<API name, record ID or display name> (in the run data space, --dataspace, default: default; --api-version auto (68.0), 67.0 or 68.0) and writes them as data rows to --output-file, by default data/<data space>/<display name>-<YYYY-MM-DD_HH-mm-ss>.csv below the working directory (data/default/... in the default data space) (the display name made file-safe like the mcnext export: control characters and < > : \" / \\ | ? * become -, whitespace runs -, leading and trailing dots and spaces dropped; the API name when the segment has no display name; a later file in the same second gets _2, _3, ...; never a data360/ definition folder; an existing --output-file is replaced). The segment is read first: an API name directly (GET /ssot/segments/{Name}); otherwise the segment list (GET /ssot/segments) is searched for the exact MarketSegment record ID or the exact display name, as the Data Cloud UI shows them (case matters; no match is SEGMENT_MEMBERS_NOT_FOUND). When several segments share that display name, a terminal asks which one (\"Multiple segments match that name. Choose one:\"); with --json or without a terminal the export stops with SEGMENT_SELECTION_AMBIGUOUS and lists each name, API name and ID. Basic mode reads GET /ssot/segments/{Name}/members page by page with limit (--limit rows per request, default 1000; Salesforce decides the maximum, 2000 worked in a test) and offset (--offset first row, default 0) until totalCount rows are read; --fields, --filters and --order-by are sent as given and Salesforce decides (its default is the member ID and a few membership columns). A member count that changes during the read (a publish finished) is SEGMENT_MEMBERS_CHANGED. --include-details instead joins the latest membership DMO to the DMO the segment is built on and writes every field of that DMO per member, through one Data 360 SQL query (POST /ssot/query-sql, rows read page by page up to the row count); a member with more than one detail row is SEGMENT_MEMBER_DETAILS_AMBIGUOUS. Its CSV header and JSON keys are the field labels (--column-headers label, default; an empty label uses the API name, a repeated header gets _2, _3, ...) or the field API names (--column-headers api-name); basic mode always uses the names Salesforce returns. Detail values of DATE fields are written as YYYY-MM-DD and of DATE_TIME fields with a space instead of the T (offset kept); basic mode writes values as Salesforce returns them. Members exist only after a publish finished (sf data360 publish); before that the export is empty with a warning. Reads retry after network errors, HTTP 429 and 503; any other Salesforce error ends the export (SEGMENT_MEMBERS_READ_FAILED) and no file is left. --result-format csv (default; basic mode: header from the first row, so a segment without members gives an empty file; --include-details: header from the DMO fields, written even without members; --column-delimiter as a name or the character: COMMA or \",\", SEMICOLON or \";\", TAB, PIPE or \"|\", CARET or \"^\", BACKQUOTE or \"`\") or json (an array of row objects). Read-only: nothing in the org changes.";
56
+ static readonly examples: string[];
57
+ static readonly flags: {
58
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
59
+ metadata: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
60
+ 'output-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
61
+ 'result-format': import("@oclif/core/interfaces").OptionFlag<"json" | "csv", import("@oclif/core/interfaces").CustomOptions>;
62
+ 'include-details': import("@oclif/core/interfaces").BooleanFlag<boolean>;
63
+ fields: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
64
+ filters: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
65
+ 'order-by': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
66
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
67
+ offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
68
+ 'column-delimiter': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
69
+ 'column-headers': import("@oclif/core/interfaces").OptionFlag<"label" | "api-name", import("@oclif/core/interfaces").CustomOptions>;
70
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
71
+ dataspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
72
+ };
73
+ protected createSender?: (connection: Connection, version: string) => BoundSsot;
74
+ protected reportProgress: (message: string) => void;
75
+ protected pause?: (milliseconds: number) => Promise<void>;
76
+ protected cwd: () => string;
77
+ protected resolveConnection: (alias?: string) => Promise<Connection>;
78
+ /**
79
+ * A person can answer a prompt: a terminal on stdin and no --json.
80
+ * @returns {boolean} Whether to ask.
81
+ */
82
+ protected interactive(): boolean;
83
+ /**
84
+ * Ask which of several segments to export.
85
+ * @param {SegmentCandidate[]} candidates Segments sharing the selection.
86
+ * @returns {Promise<SegmentCandidate>} The chosen segment.
87
+ */
88
+ protected chooseSegment(candidates: SegmentCandidate[]): Promise<SegmentCandidate>;
89
+ /**
90
+ * Validate the selection before auth, then read and write the members.
91
+ * @returns {Promise<SegmentMembersEnvelope>} Export receipt.
92
+ */
93
+ run(): Promise<SegmentMembersEnvelope>;
94
+ /**
95
+ * Set the exit code and print the human summary.
96
+ * @param {SegmentMembersEnvelope} envelope Filled receipt.
97
+ * @returns {SegmentMembersEnvelope} The same receipt.
98
+ */
99
+ private finish;
100
+ }
101
+ export {};
@@ -0,0 +1,318 @@
1
+ import select from '@inquirer/select';
2
+ import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { AuthInfo, ConfigAggregator, Connection, StateAggregator } from '@salesforce/core';
4
+ import { plugin } from '../../../../plugin.js';
5
+ import { isDataSpaceName } from '../../../../artifacts/data-space-field.js';
6
+ import { dataSpaceCheckOf } from '../../../../services/data-space-check.js';
7
+ import { formatMemberValue, memberColumnHeaders, memberDelimiter, memberDelimiterOptions, memberOutputFile, writeMemberExport, } from '../../../../artifacts/write-member-export.js';
8
+ import { describeCandidate, discoverMemberDetails, readDetailPages, readMemberPages, resolveSegmentSelection, SegmentMembersError, } from '../../../../services/segment-members.js';
9
+ import { operationDiagnostic } from '../../../../services/operation-diagnostic.js';
10
+ import { openBoundSsot } from '../../../../transport/bound-ssot.js';
11
+ import { ConnectError } from '../../../../transport/connect-client.js';
12
+ import { annotateDiagnostics, formatDiagnostic } from '../../../../errors/registry.js';
13
+ /**
14
+ * Export the members of one published segment as CSV or JSON rows: a data export, written
15
+ * outside the `data360/` definition folders.
16
+ */
17
+ export default class SegmentMembersExport extends SfCommand {
18
+ static aliases = [
19
+ 'datacloud:segment:members:export',
20
+ 'd360:segment:members:export',
21
+ 'dc:segment:members:export',
22
+ ];
23
+ static summary = 'Export the members of one published segment as CSV or JSON.';
24
+ static description = 'Reads the members of the segment named by -m segment:<API name, record ID or display name> (in the run data space, --dataspace, default: default; --api-version auto (68.0), 67.0 or 68.0) and writes them as data rows to --output-file, by default data/<data space>/<display name>-<YYYY-MM-DD_HH-mm-ss>.csv below the working directory (data/default/... in the default data space) (the display name made file-safe like the mcnext export: control characters and < > : " / \\ | ? * become -, whitespace runs -, leading and trailing dots and spaces dropped; the API name when the segment has no display name; a later file in the same second gets _2, _3, ...; never a data360/ definition folder; an existing --output-file is replaced). The segment is read first: an API name directly (GET /ssot/segments/{Name}); otherwise the segment list (GET /ssot/segments) is searched for the exact MarketSegment record ID or the exact display name, as the Data Cloud UI shows them (case matters; no match is SEGMENT_MEMBERS_NOT_FOUND). When several segments share that display name, a terminal asks which one ("Multiple segments match that name. Choose one:"); with --json or without a terminal the export stops with SEGMENT_SELECTION_AMBIGUOUS and lists each name, API name and ID. Basic mode reads GET /ssot/segments/{Name}/members page by page with limit (--limit rows per request, default 1000; Salesforce decides the maximum, 2000 worked in a test) and offset (--offset first row, default 0) until totalCount rows are read; --fields, --filters and --order-by are sent as given and Salesforce decides (its default is the member ID and a few membership columns). A member count that changes during the read (a publish finished) is SEGMENT_MEMBERS_CHANGED. --include-details instead joins the latest membership DMO to the DMO the segment is built on and writes every field of that DMO per member, through one Data 360 SQL query (POST /ssot/query-sql, rows read page by page up to the row count); a member with more than one detail row is SEGMENT_MEMBER_DETAILS_AMBIGUOUS. Its CSV header and JSON keys are the field labels (--column-headers label, default; an empty label uses the API name, a repeated header gets _2, _3, ...) or the field API names (--column-headers api-name); basic mode always uses the names Salesforce returns. Detail values of DATE fields are written as YYYY-MM-DD and of DATE_TIME fields with a space instead of the T (offset kept); basic mode writes values as Salesforce returns them. Members exist only after a publish finished (sf data360 publish); before that the export is empty with a warning. Reads retry after network errors, HTTP 429 and 503; any other Salesforce error ends the export (SEGMENT_MEMBERS_READ_FAILED) and no file is left. --result-format csv (default; basic mode: header from the first row, so a segment without members gives an empty file; --include-details: header from the DMO fields, written even without members; --column-delimiter as a name or the character: COMMA or ",", SEMICOLON or ";", TAB, PIPE or "|", CARET or "^", BACKQUOTE or "`") or json (an array of row objects). Read-only: nothing in the org changes.';
25
+ static examples = [
26
+ 'sf data360 segment members export -o target -m segment:My_Segment',
27
+ 'sf data360 segment members export -o target -m "segment:My Segment" --column-delimiter ";"',
28
+ 'sf data360 segment members export -o target -m segment:1sgXXXXXXXXXXXXXXX',
29
+ 'sf data360 segment members export -o target -m segment:My_Segment --include-details --column-headers api-name',
30
+ 'sf data360 segment members export -o target -m segment:My_Segment --result-format json --output-file members.json',
31
+ 'sf data360 segment members export -o target -m segment:My_Segment --include-details',
32
+ ];
33
+ static flags = {
34
+ 'target-org': Flags.string({
35
+ char: 'o',
36
+ summary: 'Authenticated target org alias or username.',
37
+ }),
38
+ metadata: Flags.string({
39
+ char: 'm',
40
+ summary: 'The segment to export: segment:<API name, record ID or display name>.',
41
+ }),
42
+ 'output-file': Flags.string({
43
+ char: 'f',
44
+ summary: 'File to write; default data/default/<display name>-<timestamp>.<format>.',
45
+ }),
46
+ 'result-format': Flags.option({
47
+ options: ['csv', 'json'],
48
+ default: 'csv',
49
+ summary: 'Output format: csv or json.',
50
+ })(),
51
+ 'include-details': Flags.boolean({
52
+ default: false,
53
+ summary: 'Write every field of the DMO the segment is built on per member (SQL query).',
54
+ }),
55
+ fields: Flags.string({ summary: 'Basic mode: fields parameter of the members route.' }),
56
+ filters: Flags.string({ summary: 'Basic mode: filters parameter of the members route.' }),
57
+ 'order-by': Flags.string({ summary: 'Basic mode: orderBy parameter of the members route.' }),
58
+ limit: Flags.integer({ default: 1000, min: 1, summary: 'Rows per request.' }),
59
+ offset: Flags.integer({ default: 0, min: 0, summary: 'Basic mode: first row to read.' }),
60
+ 'column-delimiter': Flags.option({
61
+ options: memberDelimiterOptions,
62
+ default: 'COMMA',
63
+ summary: 'CSV column delimiter: a name (COMMA, SEMICOLON, TAB, ...) or the character.',
64
+ })(),
65
+ 'column-headers': Flags.option({
66
+ options: ['label', 'api-name'],
67
+ default: 'label',
68
+ summary: '--include-details: header from field labels (default) or API names.',
69
+ })(),
70
+ 'api-version': Flags.string({ summary: 'auto (68.0), 67.0 or 68.0.' }),
71
+ dataspace: Flags.string({
72
+ aliases: ['data-space'],
73
+ summary: "The run's data space (default: default): the segment must be in it, and the detail query runs in it.",
74
+ }),
75
+ };
76
+ createSender;
77
+ reportProgress = (message) => {
78
+ // oclif logToStderr suppresses output in JSON mode; progress must remain visible.
79
+ process.stderr.write(`${message}\n`);
80
+ };
81
+ pause;
82
+ cwd = () => process.cwd();
83
+ resolveConnection = async (alias) => {
84
+ const aggregator = await ConfigAggregator.create();
85
+ const state = await StateAggregator.getInstance();
86
+ const target = alias ?? aggregator.getPropertyValue('target-org');
87
+ return Connection.create({
88
+ authInfo: await AuthInfo.create({
89
+ username: target ? state.aliases.resolveUsername(target) : undefined,
90
+ }),
91
+ connectionOptions: { version: '68.0' },
92
+ });
93
+ };
94
+ /**
95
+ * A person can answer a prompt: a terminal on stdin and no --json.
96
+ * @returns {boolean} Whether to ask.
97
+ */
98
+ interactive() {
99
+ return Boolean(process.stdin.isTTY) && !this.jsonEnabled();
100
+ }
101
+ /**
102
+ * Ask which of several segments to export.
103
+ * @param {SegmentCandidate[]} candidates Segments sharing the selection.
104
+ * @returns {Promise<SegmentCandidate>} The chosen segment.
105
+ */
106
+ async chooseSegment(candidates) {
107
+ const index = await select({
108
+ message: 'Multiple segments match that name. Choose one:',
109
+ choices: candidates.map((candidate, value) => ({
110
+ name: describeCandidate(candidate),
111
+ value,
112
+ })),
113
+ });
114
+ return candidates[index];
115
+ }
116
+ /**
117
+ * Validate the selection before auth, then read and write the members.
118
+ * @returns {Promise<SegmentMembersEnvelope>} Export receipt.
119
+ */
120
+ async run() {
121
+ const { flags } = (await this.parse(SegmentMembersExport));
122
+ const requested = flags['api-version'] ?? 'auto';
123
+ const version = requested === 'auto' ? '68.0' : requested;
124
+ const envelope = {
125
+ contract: 'sf-data360-segment-members',
126
+ contractVersion: '1.0.0',
127
+ status: 'blocked',
128
+ metadata: { operation: 'segment-members-export', apiVersion: requested, plugin },
129
+ provenance: {
130
+ command: 'sf data360 segment members export',
131
+ generatedAt: new Date().toISOString(),
132
+ },
133
+ diagnostics: { warnings: [], errors: [] },
134
+ result: {
135
+ includeDetails: flags['include-details'],
136
+ resultFormat: flags['result-format'],
137
+ rowsWritten: 0,
138
+ pages: 0,
139
+ routes: [],
140
+ },
141
+ };
142
+ const fail = (code, message) => {
143
+ envelope.diagnostics.errors.push({ code, message, retryable: false });
144
+ return this.finish(envelope);
145
+ };
146
+ const member = flags.metadata;
147
+ const selection = member?.startsWith('segment:') ? member.slice(8) : undefined;
148
+ // eslint-disable-next-line no-control-regex -- control characters are refused, not matched
149
+ if (!selection?.trim() || selection.length > 255 || /[\u0000-\u001F\u007F]/u.test(selection))
150
+ return fail('INVALID_SELECTION', 'Name exactly one segment with -m segment:<API name, record ID or display name>.');
151
+ if (flags['include-details'] &&
152
+ (flags.fields !== undefined ||
153
+ flags.filters !== undefined ||
154
+ flags['order-by'] !== undefined ||
155
+ flags.offset !== 0))
156
+ return fail('INVALID_SELECTION', '--fields, --filters, --order-by and --offset apply to basic mode only, not with --include-details.');
157
+ const dataSpace = flags.dataspace ?? 'default';
158
+ if (!['67.0', '68.0'].includes(version) || !isDataSpaceName(dataSpace))
159
+ return fail('INVALID_SCOPE', 'Segment members are read at --api-version auto (68.0), 67.0 or 68.0 in one data space (--dataspace).');
160
+ let connection;
161
+ try {
162
+ connection = await this.resolveConnection(flags['target-org']);
163
+ }
164
+ catch {
165
+ return fail('TARGET_ORG_REQUIRED', 'No usable target org: pass -o with an authenticated alias or username, or set target-org.');
166
+ }
167
+ const sender = this.createSender
168
+ ? this.createSender(connection, version)
169
+ : openBoundSsot(connection.getUsername() ?? '', version, async () => connection);
170
+ const route = (operation) => {
171
+ envelope.result.routes.push({ operation, apiVersion: version, transport: 'native' });
172
+ };
173
+ try {
174
+ route('segments.get');
175
+ const interactive = this.interactive();
176
+ // The data space of a segment the API name names elsewhere, for the not-found message.
177
+ let elsewhere;
178
+ const segment = await resolveSegmentSelection(sender, version, selection, {
179
+ dataSpace,
180
+ elsewhere: (space) => {
181
+ elsewhere = space;
182
+ },
183
+ listed: () => route('segments.list'),
184
+ ...(interactive
185
+ ? {
186
+ choose: async (candidates) => {
187
+ try {
188
+ return await this.chooseSegment(candidates);
189
+ }
190
+ catch {
191
+ throw new SegmentMembersError('SEGMENT_SELECTION_AMBIGUOUS', `"${selection}" matches ${candidates.length} segments in the data space ${dataSpace} and none was chosen.`);
192
+ }
193
+ },
194
+ }
195
+ : {}),
196
+ });
197
+ if (!segment) {
198
+ // Salesforce stores a segment of a non-default data space as <prefix>_<Name>.
199
+ let prefix;
200
+ if (dataSpace !== 'default')
201
+ try {
202
+ prefix = await dataSpaceCheckOf(this, async () => sender).prefixOf(dataSpace);
203
+ }
204
+ catch {
205
+ prefix = undefined;
206
+ }
207
+ return fail('SEGMENT_MEMBERS_NOT_FOUND', `No segment in the data space ${dataSpace} of the org has the API name, record ID or display name "${selection}".${elsewhere === undefined ? '' : ` A segment of that API name is in the data space ${elsewhere}; run the command with --dataspace ${elsewhere} to export it.`} Check the exact value (case matters${dataSpace === 'default' ? '' : `; a segment of the data space ${dataSpace} is stored as ${prefix ?? '<prefix>'}_<Name>`}).`);
208
+ }
209
+ const apiName = segment.apiName;
210
+ envelope.result.segment = {
211
+ apiName: segment.apiName,
212
+ marketSegmentId: segment.marketSegmentId,
213
+ dataSpace: segment.dataSpace,
214
+ ...(segment.publishStatus ? { publishStatus: segment.publishStatus } : {}),
215
+ ...(segment.lastPublishedEndDateTime
216
+ ? { lastPublishedEndDateTime: segment.lastPublishedEndDateTime }
217
+ : {}),
218
+ ...(segment.lastSegmentMemberCount === undefined
219
+ ? {}
220
+ : { lastSegmentMemberCount: segment.lastSegmentMemberCount }),
221
+ };
222
+ const file = await memberOutputFile(flags['output-file'], segment.displayName ?? apiName, flags['result-format'], this.cwd(), undefined, dataSpace);
223
+ const delimiter = memberDelimiter(flags['column-delimiter']);
224
+ const report = (read, total) => {
225
+ envelope.result.pages++;
226
+ envelope.result.totalCount = total;
227
+ this.reportProgress(`Segment ${apiName}: ${read} of ${total} members read.`);
228
+ };
229
+ let rows;
230
+ if (flags['include-details']) {
231
+ route('metadata.get');
232
+ const { sql, columns } = await discoverMemberDetails(sender, version, segment, dataSpace);
233
+ const headers = memberColumnHeaders(columns, flags['column-headers']);
234
+ envelope.result.columnHeaders = flags['column-headers'];
235
+ envelope.result.columns = columns.map((column, index) => ({
236
+ ...column,
237
+ header: headers[index],
238
+ }));
239
+ route('query-sql.post');
240
+ route('query-sql.rows');
241
+ rows = await writeMemberExport(file, flags['result-format'], delimiter, flags['result-format'] === 'csv' ? headers : undefined, async (sink) => {
242
+ let read = 0;
243
+ for await (const page of readDetailPages(sender, version, sql, columns.length, flags.limit, this.pause, dataSpace)) {
244
+ await sink.write(page.rows.map((row) => Object.fromEntries(headers.map((header, index) => [
245
+ header,
246
+ formatMemberValue(row[index], columns[index].dataType),
247
+ ]))));
248
+ read += page.rows.length;
249
+ report(read, page.totalCount);
250
+ }
251
+ });
252
+ }
253
+ else {
254
+ envelope.result.columnHeaders = 'api-name';
255
+ route('segments.members');
256
+ rows = await writeMemberExport(file, flags['result-format'], delimiter, undefined, async (sink) => {
257
+ let read = 0;
258
+ for await (const page of readMemberPages(sender, version, apiName, {
259
+ fields: flags.fields,
260
+ filters: flags.filters,
261
+ orderBy: flags['order-by'],
262
+ limit: flags.limit,
263
+ offset: flags.offset,
264
+ })) {
265
+ await sink.write(page.rows);
266
+ read += page.rows.length;
267
+ report(read, page.totalCount);
268
+ }
269
+ });
270
+ }
271
+ envelope.result.rowsWritten = rows;
272
+ envelope.result.outputFile = file;
273
+ envelope.status = 'success';
274
+ if (rows === 0 && segment.publishStatus !== 'SUCCESS')
275
+ envelope.diagnostics.warnings.push(`Segment ${apiName} has no members to read: Salesforce fills them only after a publish finished (publishStatus ${segment.publishStatus ?? 'not reported'}). Publish it with sf data360 publish -m segment:${apiName}.`);
276
+ }
277
+ catch (error) {
278
+ envelope.status = envelope.result.segment ? 'failed' : 'blocked';
279
+ const output = !(error instanceof SegmentMembersError || error instanceof ConnectError);
280
+ envelope.diagnostics.errors.push({
281
+ code: error instanceof SegmentMembersError
282
+ ? error.code
283
+ : error instanceof ConnectError
284
+ ? error.code === 'REQUEST_FAILED'
285
+ ? 'SEGMENT_MEMBERS_READ_FAILED'
286
+ : error.code
287
+ : 'SEGMENT_MEMBERS_OUTPUT_FAILED',
288
+ message: operationDiagnostic(error, output
289
+ ? 'The output file could not be written; no output file was left. Nothing in the org changed.'
290
+ : 'No output file was left. Nothing in the org changed.'),
291
+ retryable: false,
292
+ });
293
+ }
294
+ return this.finish(envelope);
295
+ }
296
+ /**
297
+ * Set the exit code and print the human summary.
298
+ * @param {SegmentMembersEnvelope} envelope Filled receipt.
299
+ * @returns {SegmentMembersEnvelope} The same receipt.
300
+ */
301
+ finish(envelope) {
302
+ if (envelope.status !== 'success')
303
+ process.exitCode = 1;
304
+ annotateDiagnostics(envelope);
305
+ if (!this.jsonEnabled()) {
306
+ const { result } = envelope;
307
+ if (envelope.status === 'success')
308
+ this.log(`Saved ${result.rowsWritten} segment members to ${result.outputFile}.`);
309
+ else
310
+ this.log(`Segment members export: ${envelope.status}.`);
311
+ for (const warning of envelope.diagnostics.warnings)
312
+ this.log(`Warning: ${warning}`);
313
+ for (const diagnostic of envelope.diagnostics.errors)
314
+ this.log(formatDiagnostic(diagnostic));
315
+ }
316
+ return envelope;
317
+ }
318
+ }
@@ -0,0 +1,2 @@
1
+ /** CLI hints for Calculated insight error codes. Long-form pages: docs/errors/calculated-insight/<CODE>.md */
2
+ export declare const hints: Readonly<Record<string, string>>;
@@ -0,0 +1,25 @@
1
+ /** CLI hints for Calculated insight error codes. Long-form pages: docs/errors/calculated-insight/<CODE>.md */
2
+ export const hints = {
3
+ CI_ACQUISITION_FAILED: 'The calculated insight list from the target org could not be read completely. Check access to the org, then rerun the retrieve.',
4
+ CI_ADMISSION_FAILED: 'The calculated insight file or its read from the org did not pass, so nothing was sent. Run the command with --preview, fix the file, data space or target access, then rerun.',
5
+ CI_DATASPACE_MISMATCH: "The calculated insight file's c__dataSpace is not the data space of the run. Run with the --dataspace the file names, or correct c__dataSpace, then rerun.",
6
+ CI_DELETION_UNCONFIRMED: 'The DELETE was sent but the plugin could not confirm the calculated insight is gone. Do not resend; check the org, then rerun the delete to confirm absence.',
7
+ CI_IDENTITY_CHANGED: 'The calculated insight in the org has a different API name or data space than selected. Nothing was written or sent; check the selector and the JSON file, then rerun.',
8
+ CI_INPUT_DRIFT: 'The delete options changed while the command was running, so nothing was deleted. Rerun the delete once with the intended flags.',
9
+ CI_MUTATION_UNCONFIRMED: 'The deploy request was sent but the plugin could not confirm the result. Do not resend; preview or retrieve the calculated insight to see its state first.',
10
+ CI_NOT_FOUND: 'The calculated insight does not exist in the target org. Check the API name and the target org, then rerun the retrieve.',
11
+ CI_PREFIX_MISMATCH: "A calculated insight name does not match its data space's prefix (ds2_ in dataspace2; no other space's prefix in default). A new insight is refused, an existing one only warned about.",
12
+ CI_PUBLICATION_UNCONFIRMED: 'The publish request was sent but the plugin could not confirm the calculated insight is ACTIVE. Do not resend; run publish with --preview to check its state.',
13
+ CI_PUBLISH_STARTED: 'With --async the publish was sent and Salesforce accepted it; the command did not wait until the calculated insight is ACTIVE. Run publish with --preview later: unchanged means it is ACTIVE.',
14
+ CI_RUNTIME_UNKNOWN: 'The calculated insight could not be read from the org, and the answer was not a clear not-found. Check access and the API name, then rerun.',
15
+ CI_SETTLEMENT_MISMATCH: 'After the write, the calculated insight in the org differs from the files that were sent. Do not resend; retrieve it and compare before another attempt.',
16
+ CI_SETTLEMENT_TIMEOUT: 'The calculated insight did not reach the expected state within 120 seconds after the write. Do not resend; check later and rerun the same command to confirm.',
17
+ CI_SQL_FAILS_SILENTLY: 'The SQL holds something Salesforce accepts on deploy and publish but cannot run, so the insight ends in ERROR a few minutes later without a message. The deploy goes ahead; change the SQL as the warning says.',
18
+ CI_UNEXPECTED_ABSENCE: 'After the write, the calculated insight was not found in the org. Do not resend; check the org, then rerun the same command to see the current state.',
19
+ CI_UNEXPECTED_STATE: 'After the write, the calculated insight moved to an unexpected status. Do not resend; check its status in Data 360 before another attempt.',
20
+ CI_VISUAL_DRAFT_WITHOUT_SQL: 'A Visual Builder draft has no SQL in the API until it is published (Salesforce returns a placeholder instead). Retrieve wrote it as-is without a SQL file, and deploy refuses that file; publish it in Data Cloud, then retrieve it again.',
21
+ INVALID_CI_DOCUMENT: 'The calculated insight document lacks its API name, data space or SQL, or is not a JSON object. Retrieve the calculated insight again.',
22
+ INVALID_CI_NAME: 'The calculated insight API name is not valid. Use the full API name that starts with a letter and ends in __cio, for example ExampleInsight__cio.',
23
+ INVALID_CI_SCOPE: 'The calculated insight request used an unsupported API version, data space name or option. Use --api-version auto or 68.0 and a valid data space name.',
24
+ PARTIAL_CI_OUTPUT: 'Only one of the two calculated insight files was written to disk. Check the JSON and SQL files, then rerun the retrieve with --overwrite.',
25
+ };
@@ -0,0 +1,2 @@
1
+ /** CLI hints for Data graph error codes. Long-form pages: docs/errors/data-graph/<CODE>.md */
2
+ export declare const hints: Readonly<Record<string, string>>;
@@ -0,0 +1,22 @@
1
+ /** CLI hints for Data graph error codes. Long-form pages: docs/errors/data-graph/<CODE>.md */
2
+ export const hints = {
3
+ DATA_GRAPH_CHANGE_NOT_APPLIED: 'The graph read back after an accepted update has another join than the file (a newly added related object or a concurrent edit). Retrieve the graph; to change a join, delete the graph and create it again.',
4
+ DATA_GRAPH_CREATE_UNCONFIRMED: 'The graph create request was sent, but the graph could not be confirmed in time. It may exist: retrieve it or rerun the same deploy before changing anything.',
5
+ DATA_GRAPH_DATASPACE_MISMATCH: "The data graph file's c__dataSpace, or the graph of that name in the org, is in another data space than the run. Graph names are unique in the org; rerun with the --dataspace the message names, or correct c__dataSpace.",
6
+ DATA_GRAPH_DATASPACE_UNREADABLE: 'The org answered the read of the data graph without a usable data space (dataspaceName), so the plugin cannot tell where the graph is and wrote or changed nothing. Rerun; if it repeats, check the graph in Data Cloud.',
7
+ DATA_GRAPH_DEPENDENCY_OTHER_DATASPACE: "The root DMO of the graph is in another data space than the graph. Name the DMO of the graph's own data space (a standard DMO copy outside default is <prefix>_<Name>), then rerun.",
8
+ DATA_GRAPH_DRAFT: 'The data graph is a draft that was never built, so it was retrieved as-is. A draft cannot be deployed or edited through the API; build or edit it in Salesforce. A delete removes it.',
9
+ DATA_GRAPH_IDENTITY_MISMATCH: 'The org answered the read of a data graph with a different graph name than the one selected. Check the exact name, including case, in --metadata data-graph:<Name> and in the file, then rerun.',
10
+ DATA_GRAPH_JOIN_CHANGE: 'The file changes the join of a related object the graph already has. Salesforce accepts such a change but keeps the old join, so the plugin does not send it. Keep the join of the org, or delete the graph and create it again.',
11
+ DATA_GRAPH_OWNER: 'The graph root is a unified DMO created by the named identity resolution ruleset, which is published. No action is needed.',
12
+ DATA_GRAPH_OWNER_NOT_FOUND: 'The graph root is a unified DMO, but no identity resolution ruleset in the target creates it. Deploy the ruleset that produces it first, then preview the graph again.',
13
+ DATA_GRAPH_OWNER_NOT_PUBLISHED: 'The identity resolution ruleset that creates the graph root is not published yet. Wait until it is PUBLISHED (rerun its deploy to check), then preview the graph again.',
14
+ DATA_GRAPH_PENDING: 'A data graph of that name is still being built, or was just deleted and is still listed, so the deploy cannot write it now. Wait a few minutes, then rerun the same deploy.',
15
+ DATA_GRAPH_PREFIX_MISMATCH: "A data graph name does not match its data space's prefix (ds2_ in dataspace2; no other space's prefix in default). A new graph is refused, an existing one only warned about.",
16
+ DATA_GRAPH_ROOT_NOT_FOUND: 'The root DMO of the graph does not exist in the target org. Deploy that DMO, or the identity resolution ruleset that creates it, then preview the graph again.',
17
+ INVALID_NATIVE_DATA_GRAPH_NAME: 'The data graph name is not a valid API name. Use a name that starts with a letter and has only letters, digits and underscores, at most 200 characters.',
18
+ INVALID_NATIVE_DATA_GRAPH_SCOPE: 'Data graphs work only with API version 68.0. Use --api-version auto or 68.0, then rerun.',
19
+ NATIVE_GRAPH_RETRIEVE_BLOCKED: 'The data graph could not be retrieved or written to disk. Check the graph name, your org access and the output folder (use --overwrite to replace a changed file), then rerun.',
20
+ PARTIAL_DATA_GRAPH_OUTPUT: 'The graph file was written, but the final check of it failed, so it may not match the org. Inspect the .native-dataGraph.json file and retrieve again with --overwrite.',
21
+ UNSUPPORTED_DATA_GRAPH_CONFIGURATION: 'The data graph definition or the answer from the org has a shape the plugin cannot check. Retrieve the graph again to get a supported file, or simplify the definition, then rerun.',
22
+ };
@@ -0,0 +1,2 @@
1
+ /** CLI hints for Data stream error codes. Long-form pages: docs/errors/data-stream/<CODE>.md */
2
+ export declare const hints: Readonly<Record<string, string>>;
@@ -0,0 +1,70 @@
1
+ /** CLI hints for Data stream error codes. Long-form pages: docs/errors/data-stream/<CODE>.md */
2
+ export const hints = {
3
+ AMBIGUOUS_STREAM_BINDING: 'Several data streams on the connection read the same event, or a listed stream belongs to another connection. Keep one stream per event in Salesforce, then rerun.',
4
+ AMBIGUOUS_STREAM_CONNECTION: 'The Ingestion API connection could not be identified exactly once in the org. Check that spec.connectionName names one existing connection, then rerun.',
5
+ AMBIGUOUS_STREAM_EVENT: 'The stream could not be tied to exactly one event of its connection: the connection has no event, names one twice, or several events fit the stream. Retrieve wrote the stream as-is.',
6
+ DATA_STREAM_DELETE_UNCONFIRMED: 'The stream delete stopped on an unexpected error. If the result says mutation unknown, inspect the stream and its DLO in the org before you run the delete again.',
7
+ DATA_STREAM_DLO_COLLISION: 'A DLO file in the selection names the landing DLO of a data stream this deploy would create. The new stream creates and owns that DLO: remove the DLO file from the selection, then rerun.',
8
+ DATA_STREAM_REQUEST_UNCONFIRMED: 'The stream deploy stopped on an unexpected error. If the result says mutation unknown, inspect the stream in the org before you deploy again.',
9
+ DATA_STREAM_RETRIEVE_FAILED: 'The stream retrieve stopped on an unexpected error. Check the target org, your access and the network, then rerun the retrieve.',
10
+ EMPTY_STREAM_PATCH: 'The plugin tried to build a stream update with no mapping to add. Nothing was sent; rerun the deploy, and report it if it happens again.',
11
+ INCOMPLETE_CONNECTION_LIST: "The list of Ingestion API connections was incomplete or had an unexpected shape. Check the org's connections; the plugin supports fewer than 200 of them.",
12
+ INCOMPLETE_STREAM_DEPENDENCIES: "Salesforce's dependency list for the stream or its DLO was incomplete or had an unexpected shape. Rerun the delete; if the result says mutation unknown, inspect the org first.",
13
+ INCOMPLETE_STREAM_LIST: "The connection's data stream list could not be read completely, for example because pages repeated or totals changed. Rerun the command; avoid changing streams while it runs.",
14
+ INVALID_STREAM_BINDING: 'A stream, connection, event or primary key name of the stream selection is not a valid developer name. Use the exact names from a retrieved stream file, then rerun.',
15
+ INVALID_STREAM_CONNECTION: 'The connection name used to list streams is not a valid developer name. Fix spec.connectionName so it starts with a letter and uses only letters, digits and underscores.',
16
+ INVALID_STREAM_DELETE_SELECTION: 'A data stream is selected for deletion as exact data-stream:ApiName, and --delete-dlo is not taken with --changed-since. Fix -m or the flags, then rerun the delete.',
17
+ INVALID_STREAM_DELETE_SURVIVOR: 'A DLO that should stay after the stream delete could not be checked. This is an internal guard; rerun the delete and report it if it happens again.',
18
+ INVALID_STREAM_DLO: "The stream's linked DLO could not be read as exactly one matching DLO with its data spaces. Check the DLO in the org, then rerun.",
19
+ INVALID_STREAM_DOCUMENT: 'A data stream document does not have the expected JSON structure. Retrieve the stream again, or compare the local file with a freshly retrieved one.',
20
+ INVALID_STREAM_LABEL: 'The landing DLO label in spec.newDlo.label is longer than 40 characters. Shorten it to 40 characters or fewer.',
21
+ INVALID_STREAM_MAPPING: 'An entry in spec.additiveFieldMappings or spec.formulaMappings is not valid. Write target names without __c, and use each target only once.',
22
+ INVALID_STREAM_NAME: 'A stream, connection, event, DLO or field name is not a valid developer name. Use a letter first, then only letters, digits and underscores; DLO names end in __dll.',
23
+ INVALID_STREAM_OBSERVED: 'The read-only observed section of the stream file is malformed or has duplicate entries. Do not edit observed; retrieve the stream again to refresh it.',
24
+ INVALID_STREAM_ORG: 'The target org alias or username is empty or not valid for the stream requests. Pass a valid alias or username with -o, then rerun.',
25
+ INVALID_STREAM_PAGE: "A page of the connection's data stream list had an unexpected shape or page link. Rerun the command; report it if it keeps happening.",
26
+ INVALID_STREAM_PRIMARY_KEY: 'The primary key does not match: it must be one source field of the event, and the only key field of the DLO. Check spec.newDlo.primaryKey against the org.',
27
+ INVALID_STREAM_READ: 'Salesforce returned a stream, connection or DLO answer that is not a JSON object where one was expected. Rerun the command; report it if it keeps happening.',
28
+ INVALID_STREAM_RESPONSE: 'Salesforce accepted the stream create or update but its answer was not a JSON object. The write may have happened; inspect the stream in the org before you deploy again.',
29
+ INVALID_STREAM_SCHEMA: "The connection's event does not match the stream: no event of that name, unsupported availability, or fields without a type or label, or named twice. Check spec.event and the schema.",
30
+ INVALID_STREAM_TARGET_ID: 'The stream record ID or delete option for an update or delete request was not valid. Nothing was sent; rerun the command and report it if it happens again.',
31
+ PARTIAL_STREAM_OUTPUT: 'The stream file was written, but the final check of its contents failed. Open data360/data-stream/<ApiName>.data-stream-meta.json, then retrieve again with --overwrite.',
32
+ STREAM_BINDING_DRIFT: 'The stream, its event or its connection changed between two reads, or reads disagreed. Wait until nobody changes the stream, then rerun; inspect the org first if mutation is unknown.',
33
+ STREAM_CHANGE_NOT_APPLIED: 'Salesforce accepted the stream write, but the stream still differs from the file in the named parts. Retrieve the stream to see what it holds; change the rest in Salesforce.',
34
+ STREAM_CONNECTION_MISMATCH: "The stream's Ingestion API connection was found but is not connected or its details differ. Check the connection's status in the org, then rerun.",
35
+ STREAM_CREATE_IDENTITY_UNCONFIRMED: "The stream create was sent, but the new stream could not be found on the connection with the returned name and ID. Inspect the connection's streams before you deploy again.",
36
+ STREAM_CREATE_PERSISTENCE_UNCONFIRMED: 'The new stream was found, but its DLO label, primary key or default mappings differ from the request. Inspect the stream in the org before you deploy again.',
37
+ STREAM_CREATE_SETTLEMENT_UNCONFIRMED: 'The stream was created but did not become ACTIVE within 15 minutes, or reached another status. Check the stream and its DLO in the org before you deploy again.',
38
+ STREAM_CREATE_UNCONFIRMED: "Salesforce accepted the stream create but its answer lacked a valid stream name or record ID. A stream may exist; inspect the connection's streams before you deploy again.",
39
+ STREAM_DATASPACE_MISMATCH: "The stream file's c__dataSpace list does not name the run's data space, differs from its DLO's data spaces, or lists several for a new stream. Change spaces with the DLO file.",
40
+ STREAM_DELETE_DEPENDENCIES_BLOCKED: 'Something still depends on the stream or its DLO. Remove those dependencies, such as mappings or segments, then rerun the delete; inspect the org first if mutation is unknown.',
41
+ STREAM_DELETE_DLO_REQUIRES_STREAM_SELECTION: '--delete-dlo only applies to data stream deletion. Select data-stream:ApiName members, or remove --delete-dlo to delete other components.',
42
+ STREAM_DELETE_GUARD_DRIFT: 'The stream, its connection or source fields changed during the delete checks or after the request. Inspect the stream in the org, then rerun the delete with --preview.',
43
+ STREAM_DELETE_INPUT_DRIFT: 'The delete options changed while the command ran. Nothing more was sent; rerun the delete with the options you want.',
44
+ STREAM_DELETE_PARENT_DRIFT: 'The stream was deleted, but its kept DLO changed or could not be read the same way. Check the DLO in the org before anything else.',
45
+ STREAM_DELETE_SETTLEMENT_UNCONFIRMED: 'The stream delete was sent, but its absence was not confirmed within 15 minutes. Check the stream and its DLO in the org before you run the delete again.',
46
+ STREAM_DELETE_SURVIVOR_DRIFT: 'A DLO that should stay unchanged by the stream delete changed. This is an internal guard; check that DLO in the org before anything else.',
47
+ STREAM_DELETE_UNCONFIRMED: 'Salesforce answered the stream DELETE without the expected empty success. The stream may be deleted; check it in the org before you run the delete again.',
48
+ STREAM_DLO_DRIFT: "The stream's DLO fields or identity differ from what the stream reports. Wait until the DLO is not being changed, then rerun; inspect the org first if mutation is unknown.",
49
+ STREAM_EXISTING_BINDING_REQUIRES_UPDATE: 'A stream already exists for this connection and event, so it cannot be created. Retrieve it, edit the retrieved file, then deploy again.',
50
+ STREAM_FILENAME_COLLISION: 'The output folder has a file whose name differs from the stream file only by case or trailing dots or spaces, or the existing file holds another stream. Rename or move it.',
51
+ STREAM_HTTP_ERROR: 'Salesforce answered a stream create, update or delete with an error status. The change may still have happened; read the HTTP status, then inspect the org before you retry.',
52
+ STREAM_LABEL_READ_FAILED: 'The Metadata API read of the stream definition before its label update failed, so the update was not sent. Nothing was changed; rerun the deploy.',
53
+ STREAM_LABEL_UPDATE_REJECTED: 'Salesforce refused the Metadata API update of the stream label (DataStreamDefinition); the label was not changed. Read the message, correct the label in the file, then rerun.',
54
+ STREAM_NOT_READY: 'The stream or its DLO is not ACTIVE, for example still processing. Wait until both show ACTIVE in the org, then rerun.',
55
+ STREAM_PROPOSED_DLO_EXISTS: 'A DLO with the name in spec.newDlo.name exists. Choose another name, or delete the old DLO first if it is no longer needed.',
56
+ STREAM_REQUEST_UNCONFIRMED: 'A stream request did not return a readable HTTP status. For a create, update or delete, the change may have happened; inspect the org, then rerun.',
57
+ STREAM_SNAPSHOT_PENDING: 'The stream or its DLO switched between ACTIVE and PROCESSING between two reads. Wait until processing is finished, then rerun.',
58
+ STREAM_SOURCE_DRIFT: "The stream's source fields differ from the fields of its connection event. Check the event schema in the org; the stream may need to be refreshed in Salesforce.",
59
+ STREAM_TARGET_MISMATCH: 'The stream with this name is not the stream found on the connection. Check spec.connectionName and the stream name, then retrieve the stream again.',
60
+ STREAM_UPDATE_PRESERVATION_FAILED: 'After the stream update, settings, mappings or DLO fields outside the requested additions changed. Inspect the stream and its DLO in the org before anything else.',
61
+ STREAM_UPDATE_SETTLEMENT_UNCONFIRMED: 'The stream update was sent, but the new mappings and ACTIVE status were not confirmed within 15 minutes. Check the stream in the org before you deploy again.',
62
+ STREAM_UPDATE_TARGET_ABSENT: 'The stream to update was no longer found on the connection. Check whether it was deleted, then rerun the deploy with --preview.',
63
+ UNSUPPORTED_STREAM_CONNECTOR: 'The stream GET names no connector type, or the Ingestion API connector with another stream type, which fits no stream file. Retrieve wrote it as-is; manage it in Salesforce.',
64
+ UNSUPPORTED_STREAM_DATASPACE: "The stream's landing DLO does not belong to the run's data space. Run the command with --dataspace set to one of the data spaces of that DLO.",
65
+ UNSUPPORTED_STREAM_MAPPING_SOURCE: 'A sourceFieldLabel in spec.additiveFieldMappings matches no field of the event, or several. Salesforce would store such a mapping unchecked and it would carry no data. Use the exact label of one source field.',
66
+ UNSUPPORTED_STREAM_PROJECTION: 'The stream has a mapping the file cannot represent: from a field the event lacks or from a label several event fields share, onto a field the DLO lacks, or with both source and formula. Manage it in Salesforce.',
67
+ UNSUPPORTED_STREAM_READ: 'The Ingestion API stream read is outside what the stream file can hold: another stream type, no refresh mode, no data space, or missing names or lists. Manage this stream in Salesforce.',
68
+ UNSUPPORTED_STREAM_SETTINGS_CHANGE: 'The file changes what no stream update changes: the refresh mode, DLO label, category, event time field or primary key, or a plain CRM field mapping. Use the values from a freshly retrieved file.',
69
+ UNSUPPORTED_STREAM_SPEC: 'The Ingestion API stream file uses a value outside its shape. Use schemaVersion 1, IngestApi and INGEST_API; a stream of another connector keeps its connector in spec.connectorInfo.',
70
+ };
@@ -0,0 +1,2 @@
1
+ /** CLI hints for Data transform error codes. Long-form pages: docs/errors/data-transform/<CODE>.md */
2
+ export declare const hints: Readonly<Record<string, string>>;