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.
- package/LICENSE +21 -0
- package/README.md +589 -2
- package/bin/run.js +4 -0
- package/docs/artifact-format.md +527 -0
- package/docs/capabilities.md +1208 -0
- package/docs/git-workflow.md +160 -0
- package/docs/handover.md +10446 -0
- package/lib/api.d.ts +7 -0
- package/lib/api.js +7 -0
- package/lib/artifacts/code-fields.d.ts +49 -0
- package/lib/artifacts/code-fields.js +142 -0
- package/lib/artifacts/data-graph-document.d.ts +29 -0
- package/lib/artifacts/data-graph-document.js +52 -0
- package/lib/artifacts/data-space-field.d.ts +65 -0
- package/lib/artifacts/data-space-field.js +98 -0
- package/lib/artifacts/data-stream-document.d.ts +264 -0
- package/lib/artifacts/data-stream-document.js +680 -0
- package/lib/artifacts/data-transform-document.d.ts +152 -0
- package/lib/artifacts/data-transform-document.js +560 -0
- package/lib/artifacts/dependency-selection.d.ts +51 -0
- package/lib/artifacts/dependency-selection.js +154 -0
- package/lib/artifacts/dlo-document.d.ts +93 -0
- package/lib/artifacts/dlo-document.js +253 -0
- package/lib/artifacts/enum-case.d.ts +39 -0
- package/lib/artifacts/enum-case.js +67 -0
- package/lib/artifacts/git-deploy-selection.d.ts +68 -0
- package/lib/artifacts/git-deploy-selection.js +474 -0
- package/lib/artifacts/identity-resolution-document.d.ts +133 -0
- package/lib/artifacts/identity-resolution-document.js +625 -0
- package/lib/artifacts/mapping-document.d.ts +1 -0
- package/lib/artifacts/mapping-document.js +1 -0
- package/lib/artifacts/native-calculated-insight-document.d.ts +142 -0
- package/lib/artifacts/native-calculated-insight-document.js +321 -0
- package/lib/artifacts/native-data-graph-document.d.ts +124 -0
- package/lib/artifacts/native-data-graph-document.js +780 -0
- package/lib/artifacts/native-dmo-document.d.ts +151 -0
- package/lib/artifacts/native-dmo-document.js +313 -0
- package/lib/artifacts/native-mapping-document.d.ts +67 -0
- package/lib/artifacts/native-mapping-document.js +187 -0
- package/lib/artifacts/native-relationship-document.d.ts +76 -0
- package/lib/artifacts/native-relationship-document.js +232 -0
- package/lib/artifacts/path-selector.d.ts +55 -0
- package/lib/artifacts/path-selector.js +167 -0
- package/lib/artifacts/read-deploy-input.d.ts +239 -0
- package/lib/artifacts/read-deploy-input.js +1359 -0
- package/lib/artifacts/segment-document.d.ts +183 -0
- package/lib/artifacts/segment-document.js +570 -0
- package/lib/artifacts/verbatim-document.d.ts +203 -0
- package/lib/artifacts/verbatim-document.js +339 -0
- package/lib/artifacts/write-data-graph.d.ts +17 -0
- package/lib/artifacts/write-data-graph.js +162 -0
- package/lib/artifacts/write-data-stream.d.ts +11 -0
- package/lib/artifacts/write-data-stream.js +175 -0
- package/lib/artifacts/write-data-transform.d.ts +11 -0
- package/lib/artifacts/write-data-transform.js +180 -0
- package/lib/artifacts/write-dlo.d.ts +11 -0
- package/lib/artifacts/write-dlo.js +158 -0
- package/lib/artifacts/write-identity-resolution.d.ts +18 -0
- package/lib/artifacts/write-identity-resolution.js +165 -0
- package/lib/artifacts/write-mapping-definition.d.ts +17 -0
- package/lib/artifacts/write-mapping-definition.js +127 -0
- package/lib/artifacts/write-member-export.d.ts +88 -0
- package/lib/artifacts/write-member-export.js +199 -0
- package/lib/artifacts/write-native-calculated-insight.d.ts +21 -0
- package/lib/artifacts/write-native-calculated-insight.js +176 -0
- package/lib/artifacts/write-native-dmo.d.ts +11 -0
- package/lib/artifacts/write-native-dmo.js +158 -0
- package/lib/artifacts/write-native-mapping.d.ts +11 -0
- package/lib/artifacts/write-native-mapping.js +157 -0
- package/lib/artifacts/write-native-relationship.d.ts +11 -0
- package/lib/artifacts/write-native-relationship.js +157 -0
- package/lib/artifacts/write-segment.d.ts +26 -0
- package/lib/artifacts/write-segment.js +212 -0
- package/lib/commands/data360/delete.d.ts +280 -0
- package/lib/commands/data360/delete.js +2297 -0
- package/lib/commands/data360/deploy.d.ts +303 -0
- package/lib/commands/data360/deploy.js +2400 -0
- package/lib/commands/data360/publish.d.ts +93 -0
- package/lib/commands/data360/publish.js +292 -0
- package/lib/commands/data360/retrieve.d.ts +322 -0
- package/lib/commands/data360/retrieve.js +1963 -0
- package/lib/commands/data360/segment/members/export.d.ts +101 -0
- package/lib/commands/data360/segment/members/export.js +318 -0
- package/lib/errors/codes/calculated-insight.d.ts +2 -0
- package/lib/errors/codes/calculated-insight.js +25 -0
- package/lib/errors/codes/data-graph.d.ts +2 -0
- package/lib/errors/codes/data-graph.js +22 -0
- package/lib/errors/codes/data-stream.d.ts +2 -0
- package/lib/errors/codes/data-stream.js +70 -0
- package/lib/errors/codes/data-transform.d.ts +2 -0
- package/lib/errors/codes/data-transform.js +35 -0
- package/lib/errors/codes/dependency.d.ts +2 -0
- package/lib/errors/codes/dependency.js +11 -0
- package/lib/errors/codes/dlo.d.ts +2 -0
- package/lib/errors/codes/dlo.js +31 -0
- package/lib/errors/codes/dmo.d.ts +2 -0
- package/lib/errors/codes/dmo.js +28 -0
- package/lib/errors/codes/general.d.ts +2 -0
- package/lib/errors/codes/general.js +57 -0
- package/lib/errors/codes/identity-resolution.d.ts +2 -0
- package/lib/errors/codes/identity-resolution.js +24 -0
- package/lib/errors/codes/mapping.d.ts +2 -0
- package/lib/errors/codes/mapping.js +42 -0
- package/lib/errors/codes/relationship.d.ts +2 -0
- package/lib/errors/codes/relationship.js +21 -0
- package/lib/errors/codes/segment.d.ts +2 -0
- package/lib/errors/codes/segment.js +49 -0
- package/lib/errors/registry.d.ts +60 -0
- package/lib/errors/registry.js +123 -0
- package/lib/plugin.d.ts +5 -0
- package/lib/plugin.js +5 -0
- package/lib/services/acquire-retrieve-selection.d.ts +43 -0
- package/lib/services/acquire-retrieve-selection.js +145 -0
- package/lib/services/bind-identity-resolution-dependencies.d.ts +53 -0
- package/lib/services/bind-identity-resolution-dependencies.js +238 -0
- package/lib/services/bind-segment-dependencies.d.ts +49 -0
- package/lib/services/bind-segment-dependencies.js +115 -0
- package/lib/services/bounded-reads.d.ts +17 -0
- package/lib/services/bounded-reads.js +42 -0
- package/lib/services/calculated-insight-sql-checks.d.ts +33 -0
- package/lib/services/calculated-insight-sql-checks.js +193 -0
- package/lib/services/command-dlo.d.ts +48 -0
- package/lib/services/command-dlo.js +103 -0
- package/lib/services/command-native-data-graph.d.ts +54 -0
- package/lib/services/command-native-data-graph.js +485 -0
- package/lib/services/command-native-data-stream.d.ts +104 -0
- package/lib/services/command-native-data-stream.js +257 -0
- package/lib/services/command-native-dmo.d.ts +124 -0
- package/lib/services/command-native-dmo.js +338 -0
- package/lib/services/command-native-mapping.d.ts +65 -0
- package/lib/services/command-native-mapping.js +129 -0
- package/lib/services/command-native-relationship.d.ts +46 -0
- package/lib/services/command-native-relationship.js +103 -0
- package/lib/services/cross-dataspace-deploy.d.ts +111 -0
- package/lib/services/cross-dataspace-deploy.js +493 -0
- package/lib/services/cross-dataspace-rename.d.ts +74 -0
- package/lib/services/cross-dataspace-rename.js +1314 -0
- package/lib/services/cross-dataspace-sql.d.ts +109 -0
- package/lib/services/cross-dataspace-sql.js +1301 -0
- package/lib/services/cross-space-context.d.ts +23 -0
- package/lib/services/cross-space-context.js +36 -0
- package/lib/services/crud-plan.d.ts +137 -0
- package/lib/services/crud-plan.js +408 -0
- package/lib/services/data-space-check.d.ts +89 -0
- package/lib/services/data-space-check.js +162 -0
- package/lib/services/data-space-prefix.d.ts +77 -0
- package/lib/services/data-space-prefix.js +127 -0
- package/lib/services/data-transform-space.d.ts +31 -0
- package/lib/services/data-transform-space.js +79 -0
- package/lib/services/delete-calculated-insight.d.ts +44 -0
- package/lib/services/delete-calculated-insight.js +101 -0
- package/lib/services/delete-data-transform.d.ts +52 -0
- package/lib/services/delete-data-transform.js +222 -0
- package/lib/services/delete-dmo-field.d.ts +211 -0
- package/lib/services/delete-dmo-field.js +472 -0
- package/lib/services/delete-identity-resolution.d.ts +43 -0
- package/lib/services/delete-identity-resolution.js +295 -0
- package/lib/services/delete-segment.d.ts +42 -0
- package/lib/services/delete-segment.js +248 -0
- package/lib/services/deploy-result.d.ts +54 -0
- package/lib/services/deploy-result.js +60 -0
- package/lib/services/escaped-copy.d.ts +23 -0
- package/lib/services/escaped-copy.js +88 -0
- package/lib/services/execute-calculated-insight-deploy.d.ts +42 -0
- package/lib/services/execute-calculated-insight-deploy.js +96 -0
- package/lib/services/execute-data-transform-deploy.d.ts +56 -0
- package/lib/services/execute-data-transform-deploy.js +168 -0
- package/lib/services/execute-native-identity-resolution-deploy.d.ts +48 -0
- package/lib/services/execute-native-identity-resolution-deploy.js +360 -0
- package/lib/services/execute-segment-deploy.d.ts +45 -0
- package/lib/services/execute-segment-deploy.js +393 -0
- package/lib/services/local-file-removal.d.ts +36 -0
- package/lib/services/local-file-removal.js +103 -0
- package/lib/services/native-calculated-insight.d.ts +87 -0
- package/lib/services/native-calculated-insight.js +164 -0
- package/lib/services/native-crm-data-stream.d.ts +91 -0
- package/lib/services/native-crm-data-stream.js +272 -0
- package/lib/services/native-data-graph-context.d.ts +12 -0
- package/lib/services/native-data-graph-context.js +139 -0
- package/lib/services/native-data-graph-crd.d.ts +261 -0
- package/lib/services/native-data-graph-crd.js +866 -0
- package/lib/services/native-data-stream.d.ts +329 -0
- package/lib/services/native-data-stream.js +1830 -0
- package/lib/services/native-dlo.d.ts +163 -0
- package/lib/services/native-dlo.js +402 -0
- package/lib/services/native-dmo.d.ts +191 -0
- package/lib/services/native-dmo.js +614 -0
- package/lib/services/native-mapping.d.ts +255 -0
- package/lib/services/native-mapping.js +1226 -0
- package/lib/services/native-relationship.d.ts +132 -0
- package/lib/services/native-relationship.js +512 -0
- package/lib/services/operation-diagnostic.d.ts +83 -0
- package/lib/services/operation-diagnostic.js +272 -0
- package/lib/services/preflight-calculated-insight-deploy.d.ts +58 -0
- package/lib/services/preflight-calculated-insight-deploy.js +95 -0
- package/lib/services/preflight-data-transform-deploy.d.ts +33 -0
- package/lib/services/preflight-data-transform-deploy.js +104 -0
- package/lib/services/preflight-identity-resolution-deploy.d.ts +107 -0
- package/lib/services/preflight-identity-resolution-deploy.js +281 -0
- package/lib/services/preflight-segment-deploy.d.ts +31 -0
- package/lib/services/preflight-segment-deploy.js +109 -0
- package/lib/services/publish-calculated-insight.d.ts +40 -0
- package/lib/services/publish-calculated-insight.js +95 -0
- package/lib/services/publish-segment.d.ts +65 -0
- package/lib/services/publish-segment.js +194 -0
- package/lib/services/readback-pace.d.ts +16 -0
- package/lib/services/readback-pace.js +23 -0
- package/lib/services/retrieve-data-transform.d.ts +26 -0
- package/lib/services/retrieve-data-transform.js +65 -0
- package/lib/services/retrieve-identity-resolution.d.ts +40 -0
- package/lib/services/retrieve-identity-resolution.js +87 -0
- package/lib/services/retrieve-inventory.d.ts +32 -0
- package/lib/services/retrieve-inventory.js +151 -0
- package/lib/services/retrieve-segment.d.ts +120 -0
- package/lib/services/retrieve-segment.js +502 -0
- package/lib/services/segment-lookup.d.ts +46 -0
- package/lib/services/segment-lookup.js +108 -0
- package/lib/services/segment-members.d.ts +144 -0
- package/lib/services/segment-members.js +402 -0
- package/lib/services/select-native-retrieve.d.ts +60 -0
- package/lib/services/select-native-retrieve.js +226 -0
- package/lib/services/settle-calculated-insight.d.ts +22 -0
- package/lib/services/settle-calculated-insight.js +53 -0
- package/lib/services/sql-tokens.d.ts +58 -0
- package/lib/services/sql-tokens.js +147 -0
- package/lib/transport/api-version.d.ts +36 -0
- package/lib/transport/api-version.js +89 -0
- package/lib/transport/bound-ssot.d.ts +27 -0
- package/lib/transport/bound-ssot.js +116 -0
- package/lib/transport/calculated-insight-rest.d.ts +28 -0
- package/lib/transport/calculated-insight-rest.js +62 -0
- package/lib/transport/connect-client.d.ts +129 -0
- package/lib/transport/connect-client.js +446 -0
- package/lib/transport/connect-diagnostic.d.ts +89 -0
- package/lib/transport/connect-diagnostic.js +331 -0
- package/lib/transport/data-graph-rest.d.ts +27 -0
- package/lib/transport/data-graph-rest.js +76 -0
- package/lib/transport/data-stream-rest.d.ts +62 -0
- package/lib/transport/data-stream-rest.js +348 -0
- package/lib/transport/data-transform-rest.d.ts +25 -0
- package/lib/transport/data-transform-rest.js +100 -0
- package/lib/transport/dlo-native-rest.d.ts +22 -0
- package/lib/transport/dlo-native-rest.js +89 -0
- package/lib/transport/dlo-rest.d.ts +23 -0
- package/lib/transport/dlo-rest.js +135 -0
- package/lib/transport/dmo-native-rest.d.ts +18 -0
- package/lib/transport/dmo-native-rest.js +55 -0
- package/lib/transport/dmo-rest.d.ts +30 -0
- package/lib/transport/dmo-rest.js +163 -0
- package/lib/transport/mapping-rest.d.ts +63 -0
- package/lib/transport/mapping-rest.js +341 -0
- package/lib/transport/project-metadata.d.ts +36 -0
- package/lib/transport/project-metadata.js +118 -0
- package/lib/transport/relationship-rest.d.ts +43 -0
- package/lib/transport/relationship-rest.js +201 -0
- package/package.json +96 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jörn Berkefeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,590 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Data360 Salesforce CLI plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`sf-plugin-data` adds the `sf data360` commands to Salesforce CLI. They copy Data Cloud (Data 360) configuration between an org and files on your disk: you retrieve components into JSON
|
|
4
|
+
files, keep them in Git, edit them, preview what a deploy would change and deploy them to the
|
|
5
|
+
same or another org. The plugin can also delete components, publish segments and calculated
|
|
6
|
+
insights, and export the members of a segment.
|
|
7
|
+
|
|
8
|
+
What it is not:
|
|
9
|
+
|
|
10
|
+
- **Not a backup, restore or migration tool.** It handles the component types listed in the
|
|
11
|
+
[type overview](#type-overview), not everything Data Cloud holds, and never copies data rows.
|
|
12
|
+
- **Not side-effect free.** Deploying a stream, a segment, a graph or an identity resolution
|
|
13
|
+
ruleset can start processing in the org. Run `--preview` first.
|
|
14
|
+
|
|
15
|
+
Background, evidence and the Salesforce behaviour behind each type are on sfmc.guide:
|
|
16
|
+
[Data Cloud DevOps](https://sfmc.guide/next/data-cloud-devops/) and
|
|
17
|
+
[Data spaces](https://sfmc.guide/next/data-spaces/).
|
|
18
|
+
|
|
19
|
+
## Install and sign in
|
|
20
|
+
|
|
21
|
+
You need Salesforce CLI, Node.js `^22.22.2 || ^24.15.0` and npm. Until the package is
|
|
22
|
+
published, install it from a checkout of this repository:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm ci
|
|
26
|
+
npm run build
|
|
27
|
+
sf plugins link .
|
|
28
|
+
sf data360 --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Sign in to a Data Cloud org with the usual Salesforce CLI login and pass its alias with
|
|
32
|
+
`--target-org` (or `-o`):
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
sf org login web --alias source
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Your user needs the Data Cloud permissions for the components you work with. Linking the plugin
|
|
39
|
+
does not grant any org access. `datacloud`, `d360` and `dc` work as aliases of `data360`, for
|
|
40
|
+
example `sf dc retrieve`.
|
|
41
|
+
|
|
42
|
+
## Use it in VS Code
|
|
43
|
+
|
|
44
|
+
- **Data 360 DevTools** (pre-release, not yet published) runs these commands from right-click menus
|
|
45
|
+
and the Command Palette in VS Code, and groups your files by data space in a side panel.
|
|
46
|
+
- It brings its own copy of this plugin, so no `sf plugins install` or link is needed there.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
# 1. Retrieve components into ./data360/
|
|
52
|
+
sf data360 retrieve -o source -m dlo -m dmo -m mapping
|
|
53
|
+
|
|
54
|
+
# 2. Edit the files, then see what a deploy would do (read-only)
|
|
55
|
+
sf data360 deploy -o target -m dmo:Customer__dlm -m mapping:Customer_Map --preview
|
|
56
|
+
|
|
57
|
+
# 3. Deploy
|
|
58
|
+
sf data360 deploy -o target -m dmo:Customer__dlm -m mapping:Customer_Map
|
|
59
|
+
|
|
60
|
+
# Delete a component by name (preview first)
|
|
61
|
+
sf data360 delete -o target -m segment:Old_Segment --preview
|
|
62
|
+
sf data360 delete -o target -m segment:Old_Segment
|
|
63
|
+
|
|
64
|
+
# Deploy what changed in Git since main, and delete what was deleted
|
|
65
|
+
sf data360 deploy -o target --changed-since main --preview
|
|
66
|
+
sf data360 delete -o target --changed-since main --confirm-delete
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The commands:
|
|
70
|
+
|
|
71
|
+
| Command | What it does |
|
|
72
|
+
| ----------------------------------- | ------------------------------------------------------------------------ |
|
|
73
|
+
| `sf data360 retrieve` | Saves components from the org as files under `data360/`. |
|
|
74
|
+
| `sf data360 deploy` | Creates or updates components from files; `--preview` only compares. |
|
|
75
|
+
| `sf data360 delete` | Deletes components by name, or the ones whose files a Git range deleted. |
|
|
76
|
+
| `sf data360 publish` | Publishes one segment or one calculated insight. |
|
|
77
|
+
| `sf data360 segment members export` | Writes the members of a published segment to a CSV or JSON file. |
|
|
78
|
+
|
|
79
|
+
Every command has `--help` with all flags, and `--json` for machine-readable output.
|
|
80
|
+
|
|
81
|
+
## Type overview
|
|
82
|
+
|
|
83
|
+
Each row is one component type. The first cell links to the type's reference page and names the
|
|
84
|
+
selector you use with `-m`. **Available** means the plugin has that operation; **Unavailable**
|
|
85
|
+
means the plugin has none (it does not mean Salesforce lacks it). Every type works in any data
|
|
86
|
+
space of the org; see [Data spaces](#data-spaces).
|
|
87
|
+
|
|
88
|
+
| Type | Retrieve | Create | Update | Delete | More |
|
|
89
|
+
| ------------------------------------------------------------------------------- | ----------- | ----------- | ----------- | ----------- | ---------------------------------------------------------------------------- |
|
|
90
|
+
| [Data streams](docs/types/data-stream.md), `data-stream` | Available | Available | Available | Available | `--delete-dlo` deletes the landing DLO with the stream; `--allow-processing` |
|
|
91
|
+
| [Data Lake Objects (DLOs)](docs/types/dlo.md), `dlo` | Available | Available | Available | Available | Data space membership; `--allow-dataspace-removal` |
|
|
92
|
+
| [Data Model Objects (DMOs)](docs/types/dmo.md), `dmo` | Available | Available | Available | Available | Field delete (`delete --field`); `--allow-field-removal` |
|
|
93
|
+
| [DLO-to-DMO mappings](docs/types/mapping.md), `mapping` | Available | Available | Available | Available | Mapping label |
|
|
94
|
+
| [DMO field relationships](docs/types/relationship.md), `relationship` | Available | Available | Available | Available | Retrieve by source DMO (`relationship:<Dmo__dlm>`) |
|
|
95
|
+
| [Data transforms](docs/types/data-transform.md), `data-transform` | Available | Available | Available | Available | Schedule |
|
|
96
|
+
| [Calculated insights](docs/types/calculated-insight.md), `calculated-insight` | Available | Available | Available | Available | `sf data360 publish`; `--draft` |
|
|
97
|
+
| [Segments](docs/types/segment.md), `segment` | Available | Available | Available | Available | `sf data360 publish`; schedule; `--allow-processing` |
|
|
98
|
+
| [Segment members](docs/types/segment.md#export-segment-members) | Available | Unavailable | Available | Unavailable | Read: `sf data360 segment members export`; update: `sf data360 publish` |
|
|
99
|
+
| [Data graphs](docs/types/data-graph.md), `data-graph` | Available | Available | Available | Available | Schedule; `--allow-processing`; `--wait-timeout` |
|
|
100
|
+
| [Identity resolution](docs/types/identity-resolution.md), `identity-resolution` | Available | Available | Available | Available | `--async`; `--allow-processing` |
|
|
101
|
+
| Source object definitions | Unavailable | Unavailable | Unavailable | Unavailable | Connectors and credentials are not handled |
|
|
102
|
+
| Kit templates | Unavailable | Unavailable | Unavailable | Unavailable | Data kits are not handled |
|
|
103
|
+
| Kit definitions | Unavailable | Unavailable | Unavailable | Unavailable | Data kits are not handled |
|
|
104
|
+
| Kit membership | Unavailable | Unavailable | Unavailable | Unavailable | Data kits are not handled |
|
|
105
|
+
|
|
106
|
+
Segment members are the rows Salesforce computes when a segment is published, so they cannot be
|
|
107
|
+
created or deleted. Cross-type deletes, the delete order and local file removal are described in
|
|
108
|
+
[Delete](docs/types/delete.md).
|
|
109
|
+
|
|
110
|
+
## What it does that the Data Cloud UI does not
|
|
111
|
+
|
|
112
|
+
- **Change an existing relationship's label and cardinality in place.** The UI only lets you
|
|
113
|
+
activate or delete an existing relationship.
|
|
114
|
+
- **Create, update and delete SQL (DBT) segments**, with the SQL in its own `.sql` file. The UI
|
|
115
|
+
builds segments only visually.
|
|
116
|
+
- **Retrieve many components in one command** into files you keep in Git.
|
|
117
|
+
- **Deploy only what changed in a Git range** with `--changed-since`, and delete what the range
|
|
118
|
+
deleted.
|
|
119
|
+
- **Deploy or delete related components of several types in one command**, in dependency order:
|
|
120
|
+
for example DLOs, DMOs, mappings and a relationship in one deploy, or data graphs before the
|
|
121
|
+
identity resolution ruleset they use in one delete.
|
|
122
|
+
|
|
123
|
+
## How it works
|
|
124
|
+
|
|
125
|
+
### Files on disk
|
|
126
|
+
|
|
127
|
+
Retrieve writes one folder per type under `data360/` in the current directory (or
|
|
128
|
+
`--output-dir`). Each component is one JSON file named after it; segments and calculated
|
|
129
|
+
insights keep their SQL in separate `.sql` files next to the JSON.
|
|
130
|
+
|
|
131
|
+
| Type | File |
|
|
132
|
+
| ------------------- | ------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| Data stream | `data360/data-stream/<Name>.data-stream-meta.json` |
|
|
134
|
+
| DLO | `data360/dlo/<Name>__dll.dlo-meta.json` |
|
|
135
|
+
| DMO | `data360/dmo/<Name>__dlm.dmo-meta.json` |
|
|
136
|
+
| Mapping | `data360/mapping/<Name>.mapping-meta.json` |
|
|
137
|
+
| Relationship | `data360/relationship/<Name>.relationship-meta.json` |
|
|
138
|
+
| Data transform | `data360/dataTransforms/<Name>.dataTransform.json` |
|
|
139
|
+
| Calculated insight | `data360/calculatedInsights/<Name>.calculatedInsight-meta.json` and `.calculatedInsight-meta.sql` |
|
|
140
|
+
| Segment | `data360/segments/<Name>.segment.json` and `<Name>.segment.<model>.sql` |
|
|
141
|
+
| Data graph | `data360/dataGraphs/<Name>.native-dataGraph.json` |
|
|
142
|
+
| Identity resolution | `data360/identityResolution/<Name>.identityResolution.json` |
|
|
143
|
+
|
|
144
|
+
The files hold what you need to recreate a component in another org: no record IDs, no
|
|
145
|
+
values Salesforce generates, no status. Fields and mapping pairs that Salesforce adds by itself
|
|
146
|
+
are left out, and deploy keeps them. The exact layout of each file is on its type page and in
|
|
147
|
+
[artifact format](docs/artifact-format.md).
|
|
148
|
+
|
|
149
|
+
### Selecting components
|
|
150
|
+
|
|
151
|
+
- `-m <type>:<Name>` selects one component; repeat `-m` to select several, of any types.
|
|
152
|
+
- For retrieve, a bare type (`-m dmo`) selects every component of that type the org lists.
|
|
153
|
+
Retrieve without `-m` selects every DLO, DMO and mapping.
|
|
154
|
+
- Deploy and delete always name their components, or take them from Git with
|
|
155
|
+
`--changed-since`. Deploy also takes files and folders with `--source-dir` (`-d`).
|
|
156
|
+
|
|
157
|
+
### Preview first
|
|
158
|
+
|
|
159
|
+
`sf data360 deploy --preview` and `sf data360 delete --preview` read the org and report, per
|
|
160
|
+
component, what would happen: `create`, `update`, `unchanged`, `delete`, or `blocked` with the
|
|
161
|
+
reason. They never write to the org and never change local files. When a component needs another
|
|
162
|
+
component that the same command creates first, the preview cannot compare it yet and reports
|
|
163
|
+
`planned-dependencies` for it.
|
|
164
|
+
|
|
165
|
+
### Deploy
|
|
166
|
+
|
|
167
|
+
- **Order.** One deploy can hold components of several types; the plugin sorts them by
|
|
168
|
+
dependency. Data streams go first, then the native objects in the order DLO, DMO, mapping,
|
|
169
|
+
relationship, then transforms, calculated insights, segments and identity resolution, and data
|
|
170
|
+
graphs last. Each component settles before the next one that depends on it is written.
|
|
171
|
+
- **Sent as written, Salesforce decides.** The plugin sends the file as you wrote it and reports
|
|
172
|
+
Salesforce's answer as the component's error. It keeps no list of allowed values of its own.
|
|
173
|
+
It refuses a change before any write only where Salesforce would accept the request but not
|
|
174
|
+
apply it, or where the change cannot be undone (for example removing fields); the type pages
|
|
175
|
+
list these refusals.
|
|
176
|
+
- **Size.** One deploy takes at most 256 components and 512 links between them. A larger
|
|
177
|
+
selection stops before any write with `DEPENDENCY_LIMIT_EXCEEDED`; split it into smaller
|
|
178
|
+
deploys and run them one after another.
|
|
179
|
+
- **Unchanged components are not written.** Deploying the same file again reports `unchanged`.
|
|
180
|
+
Values that differ only in letter case (`Text` and `text`) count as equal.
|
|
181
|
+
- **Processing.** Creating or updating a data stream, segment, data graph or identity resolution
|
|
182
|
+
ruleset makes Salesforce start processing, so these need `--allow-processing`. Transforms and
|
|
183
|
+
calculated insights do not, but a deployed schedule makes them run in the target org; preview
|
|
184
|
+
warns about that.
|
|
185
|
+
- **Stops on the first problem.** A blocked, failed or unknown result stops the deploy; later
|
|
186
|
+
components report `not-attempted`. Components already written stay written: there is no
|
|
187
|
+
rollback.
|
|
188
|
+
- **Unknown outcome.** When the plugin cannot tell whether a write happened (for example the
|
|
189
|
+
connection dropped), the result says `unknown`. Check the org before you run the deploy
|
|
190
|
+
again; the plugin never repeats such a write by itself.
|
|
191
|
+
|
|
192
|
+
### Retrieve is lenient, deploy is strict
|
|
193
|
+
|
|
194
|
+
- Retrieve never refuses a component because the org returns something the plugin does not
|
|
195
|
+
recognise. One failing component never stops the others.
|
|
196
|
+
- A setting the plugin does not recognise stays in the retrieved file. Deploy refuses such a
|
|
197
|
+
file and names the setting.
|
|
198
|
+
- A component the file format cannot hold is saved exactly as Salesforce returned it, with a
|
|
199
|
+
warning. Deploy skips such a file in a folder or Git deploy and refuses it when you name it
|
|
200
|
+
(error `VERBATIM_NOT_DEPLOYABLE`). You can still delete the component by name.
|
|
201
|
+
|
|
202
|
+
### Delete
|
|
203
|
+
|
|
204
|
+
`sf data360 delete` takes any mix of types and deletes them in reverse dependency order: graphs
|
|
205
|
+
first, then identity resolution, calculated insights and segments, transforms, relationships,
|
|
206
|
+
mappings, DMOs, DLOs, and data streams last. Each phase finishes before the next starts.
|
|
207
|
+
|
|
208
|
+
- Components are selected by name with `-m`. A delete reads no local file, except for a mapping,
|
|
209
|
+
which it finds through its local file like deploy does. A `-m` delete needs
|
|
210
|
+
no confirmation flag, so check it with `--preview` first.
|
|
211
|
+
- `--changed-since <ref>` deletes the components whose files were deleted in that Git range. It
|
|
212
|
+
always needs `--confirm-delete` (not with `--preview`).
|
|
213
|
+
- A component the org does not have reports `unchanged`.
|
|
214
|
+
- A data stream keeps its landing DLO unless you add `--delete-dlo`.
|
|
215
|
+
- `sf data360 delete -m dmo:<Name>__dlm --field <Field__c>` removes single fields of a DMO.
|
|
216
|
+
|
|
217
|
+
Details, including what is read before anything is deleted: [Delete](docs/types/delete.md).
|
|
218
|
+
|
|
219
|
+
### Local files after delete
|
|
220
|
+
|
|
221
|
+
After a confirmed deletion, `sf data360 delete` also removes the deleted component's local file
|
|
222
|
+
(and its `.sql` files) at its usual path under `data360/`. It does the same when Salesforce has
|
|
223
|
+
accepted the deletion and is still finishing it. Pass `--keep-local-files` to keep the files.
|
|
224
|
+
|
|
225
|
+
- `--preview` removes nothing; it lists the files that would go.
|
|
226
|
+
- Only regular files inside the project's `data360` folder are removed, one at a time.
|
|
227
|
+
- If a file cannot be removed, the org result stays as it is and the command exits with an
|
|
228
|
+
error; remove that file by hand instead of repeating the delete.
|
|
229
|
+
- A `--changed-since` delete removes no file: its files are already gone in Git.
|
|
230
|
+
- A field delete (`--field`) removes no file; it refreshes the DMO and mapping files.
|
|
231
|
+
|
|
232
|
+
The JSON fields and every case are in [Delete](docs/types/delete.md#local-files-after-delete).
|
|
233
|
+
|
|
234
|
+
### Output, JSON and error codes
|
|
235
|
+
|
|
236
|
+
Human output prints one line per component, such as `created dmo Customer__dlm`. The suffix
|
|
237
|
+
` (server is still processing)` means Salesforce accepted the change and is still working on it.
|
|
238
|
+
The exit code is 0 only when every component was created, updated, deleted or unchanged.
|
|
239
|
+
|
|
240
|
+
Every problem carries a plugin error code, a short hint and a link to the code's page:
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
IDENTITY_RESOLUTION_NOT_SETTLED: <message, including Salesforce's own detail when there is one>
|
|
244
|
+
Hint: <what went wrong and what to do>
|
|
245
|
+
Docs: https://github.com/JoernBerkefeld/sf-plugin-data/blob/v<version>/docs/errors/identity-resolution/IDENTITY_RESOLUTION_NOT_SETTLED.md
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
With `--json`, each diagnostic has the same `hint` and `docs` fields next to `code` and
|
|
249
|
+
`message`. The full list, grouped by type, is in [docs/errors/README.md](docs/errors/README.md).
|
|
250
|
+
|
|
251
|
+
When Salesforce refuses a request, the message shows its HTTP status, error code and
|
|
252
|
+
explanation. HTTP 429 and 503 mean rate limits or availability problems: wait and try again.
|
|
253
|
+
Reads are retried a few times by themselves; writes are not.
|
|
254
|
+
|
|
255
|
+
### API version
|
|
256
|
+
|
|
257
|
+
Every type uses Data Cloud API 68 by default (`--api-version auto`). DLOs, DMOs, mappings and
|
|
258
|
+
relationships also accept an explicit version from `61.0` up, which the plugin keeps instead of
|
|
259
|
+
upgrading. The other types accept `auto` or `68.0`. `--api-version latest` is not accepted.
|
|
260
|
+
|
|
261
|
+
## Data spaces
|
|
262
|
+
|
|
263
|
+
Every command runs in one data space, chosen with the optional `--dataspace NAME`;
|
|
264
|
+
`--data-space` is a compatibility alias. Neither spelling has a CLI default of its own: leave
|
|
265
|
+
both out and the command works in `default`. A command never works on all data spaces at once,
|
|
266
|
+
and an unknown data space stops it before any read or write.
|
|
267
|
+
|
|
268
|
+
- **The file names its data space.** Every file carries the top-level key `c__dataSpace`. Deploy
|
|
269
|
+
and delete refuse a file of another data space than the run's, before any write. Deploy can
|
|
270
|
+
translate some of them with `--allow-cross-dataspace` (below).
|
|
271
|
+
- **DLOs follow the run's data space** and can belong to several data spaces. Their file lists
|
|
272
|
+
all of them in `c__dataSpace`. Deploy adds the DLO to the listed data spaces it is not in yet.
|
|
273
|
+
It removes the DLO from a data space the file no longer lists only with
|
|
274
|
+
`--allow-dataspace-removal`. Delete refuses a DLO that also belongs to another data space.
|
|
275
|
+
- **Data streams** belong to the data spaces of their landing DLO; change them through the DLO
|
|
276
|
+
file.
|
|
277
|
+
- **Names are what Salesforce stores.** Every data space has a prefix, chosen when it was
|
|
278
|
+
created. Outside `default`, Salesforce puts that prefix in front of some names: in a data
|
|
279
|
+
space with the prefix `ds2`, a standard DMO is a copy such as `ds2_Individual__dlm` (fields
|
|
280
|
+
without `ssot__`), a segment is stored as `ds2_<Name>`, and an identity resolution ruleset as
|
|
281
|
+
`ds2_<type>_<rulesetId>`. Files carry these names, and the plugin adds or removes no prefix.
|
|
282
|
+
- **First mapping onto a standard DMO copy.** The copy exists only once something is mapped
|
|
283
|
+
onto it in that data space. Deploy the mapping, not a DMO file, to create it; the plugin
|
|
284
|
+
sends the mapping the way Salesforce takes it. This works for the copy of an `ssot__` DMO;
|
|
285
|
+
the copy of a standard DMO without `ssot__` (`ds2_StaticCurrencyRates_Home__dlm`) the plugin
|
|
286
|
+
cannot create yet: map a DLO onto it in the data space in Salesforce.
|
|
287
|
+
|
|
288
|
+
### Name prefixes (only if you have more than one data space)
|
|
289
|
+
|
|
290
|
+
Custom DMOs, calculated insights, data transforms and data graphs have names that are unique in
|
|
291
|
+
the whole org, whatever their data space. So their names carry the prefix of their data space,
|
|
292
|
+
as Salesforce does itself for segments and identity resolution rulesets. This keeps names from
|
|
293
|
+
clashing between data spaces and shows at a glance where a component belongs. Examples for
|
|
294
|
+
`dataspace2` with the prefix `ds2`:
|
|
295
|
+
|
|
296
|
+
- Custom DMO: `ds2_Order__dlm`
|
|
297
|
+
- Calculated insight: `ds2_Spend__cio`
|
|
298
|
+
- Data transform: `ds2_CopyOrders`
|
|
299
|
+
- Data graph: `ds2_OrderGraph`
|
|
300
|
+
|
|
301
|
+
What the plugin does:
|
|
302
|
+
|
|
303
|
+
- In a data space other than `default`, the name must start with that space's prefix and an
|
|
304
|
+
underscore. In `default`, it must not start with the prefix of another data space.
|
|
305
|
+
- **Deploy of a new component** with a name that breaks the rule is refused before the first
|
|
306
|
+
write of the whole deploy (`DMO_PREFIX_MISMATCH`, `CI_PREFIX_MISMATCH`,
|
|
307
|
+
`TRANSFORM_PREFIX_MISMATCH`, `DATA_GRAPH_PREFIX_MISMATCH`).
|
|
308
|
+
- **Deploy of an existing component** and **retrieve** only warn; the plugin never renames
|
|
309
|
+
anything in the org.
|
|
310
|
+
- Only what you make yourself is checked. Standard DMOs and their copies, objects Salesforce
|
|
311
|
+
generates and packaged components are not.
|
|
312
|
+
- With only the `default` data space nothing is checked and nothing extra is read.
|
|
313
|
+
|
|
314
|
+
### Deploy from another data space (only if you have more than one data space)
|
|
315
|
+
|
|
316
|
+
`sf data360 deploy --dataspace <target> --allow-cross-dataspace` (short `-c`) deploys files of
|
|
317
|
+
another data space into `<target>`. Each file's `c__dataSpace` says where it comes from. Without
|
|
318
|
+
the flag such a file is refused, and the message names the flag.
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# See every rename first; nothing is written
|
|
322
|
+
sf data360 deploy -o myOrg --dataspace dataspace2 -c -d data360/dmo/Order__dlm.dmo-meta.json -d data360/segments/Audience.segment.json --preview
|
|
323
|
+
# Then deploy
|
|
324
|
+
sf data360 deploy -o myOrg --dataspace dataspace2 -c -d data360/dmo/Order__dlm.dmo-meta.json -d data360/segments/Audience.segment.json --allow-processing
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
- **What is translated:** DMOs, mappings, relationships, UI, Waterfall and SQL (DBT)
|
|
328
|
+
segments, calculated insights (classic and SQL Insights Builder), data graphs, identity
|
|
329
|
+
resolution rulesets, STL data transforms (load, join, formula, filter, SQL filter, aggregate,
|
|
330
|
+
append and output nodes) and DCSQL data transforms. A DLO is added to the target data space;
|
|
331
|
+
nothing in it is renamed.
|
|
332
|
+
- **How names change:** by fixed rules, with the prefixes from the org's list of data spaces.
|
|
333
|
+
- Custom DMOs and segments get, lose or swap the prefix: `Order__dlm` becomes
|
|
334
|
+
`ds2_Order__dlm`, `Audience` becomes `ds2_Audience`.
|
|
335
|
+
- A standard DMO becomes its copy and its fields lose `ssot__`: `ssot__Individual__dlm`
|
|
336
|
+
becomes `ds2_Individual__dlm`, `ssot__FirstName__c` becomes `FirstName__c`.
|
|
337
|
+
- Data graphs, data transforms and rulesets get, lose or swap the prefix: `PhoneGraph`
|
|
338
|
+
becomes `ds2_PhoneGraph`, ruleset `Individual_t1` becomes `ds2_Individual_t1` (the ruleset
|
|
339
|
+
ID stays).
|
|
340
|
+
- Identity resolution outputs: when their ruleset is in the same deploy,
|
|
341
|
+
`UnifiedssotIndividual<Id>__dlm` becomes `ds2_UnifiedIndividual<Id>__dlm`. Otherwise deploy
|
|
342
|
+
reads the org's ruleset list once and takes the output of the one ruleset of the same type
|
|
343
|
+
in the target data space; none or several are refused. The outputs of the oldest `default`
|
|
344
|
+
ruleset have no suffix (`UnifiedIndividual__dlm`) and are always placed from that list.
|
|
345
|
+
- The names Salesforce generates for one graph (its helper DMOs and transform, join and field
|
|
346
|
+
developer names) are left out; Salesforce generates new ones. A node developer name is
|
|
347
|
+
rebuilt as Salesforce builds it: `ds2_PhoneGraph_ds2_ContactPointPhone`.
|
|
348
|
+
- In a transform, a field after a join written with the side's qualifier (`R.FirstName__c`)
|
|
349
|
+
is placed by that side. Output DLO names stay, and a DLO has only one writing transform
|
|
350
|
+
across data spaces: give the copy another output object, or delete the source transform.
|
|
351
|
+
- A mapping keeps its DLO side; it is found by its DLO and DMO, as always.
|
|
352
|
+
- Calculated insights get, lose or swap the prefix: `Spend__cio` becomes `ds2_Spend__cio`.
|
|
353
|
+
- **SQL is renamed name by name** (calculated insights, DBT segment models and DCSQL transforms):
|
|
354
|
+
- Tables follow the rules above. A DLO (`__dll`) keeps its name. Another insight (`__cio`)
|
|
355
|
+
gets the prefix.
|
|
356
|
+
- A column follows the rules of its table, through the table name, its alias, a `WITH` block
|
|
357
|
+
or a subquery: `i.ssot__FirstName__c` on `ssot__Individual__dlm i` becomes
|
|
358
|
+
`i.FirstName__c`.
|
|
359
|
+
- A column without a table in front is renamed only when every table of the query spells it
|
|
360
|
+
the same way. Otherwise write the table or alias in front of it.
|
|
361
|
+
- Texts in single quotes and comments never change. `WITH` block names, aliases and column
|
|
362
|
+
aliases are your names and stay. Double quotes and backticks are names.
|
|
363
|
+
- A column alias works without `AS` after a closing bracket, a field, a number or a text
|
|
364
|
+
(`SUM(x) total__c`, `i.FirstName__c fn__c`), as Salesforce accepts it. Right after an
|
|
365
|
+
operator word such as `NOT`, `OR`, `IS`, `BETWEEN … AND` or `EXISTS`, the next name is a
|
|
366
|
+
column to rename, not an alias: write `AS` there if you mean an alias. An alias still
|
|
367
|
+
spelled like the old data space (`COUNT(x) ssot__Total__c`) is refused.
|
|
368
|
+
- SQL ignores case, the rules do not: a name with its rule part in another case
|
|
369
|
+
(`SSOT__ID__C`, `Individual__DLM`) is refused. Write `ssot__`, `__c` and `__dlm` in lower case.
|
|
370
|
+
- Salesforce accepts an insight left in the `default` spelling in another data space, then
|
|
371
|
+
fails it about three minutes after activation without a message. So after the rewrite
|
|
372
|
+
every name of the SQL outside texts and comments must be placed, and none may keep the old
|
|
373
|
+
spelling.
|
|
374
|
+
- A name equal to a column alias reads that alias in `ORDER BY` and `HAVING` (also `SORT BY`,
|
|
375
|
+
`DISTRIBUTE BY`, `CLUSTER BY`, `QUALIFY`), as Spark reads it. In `WHERE` and `GROUP BY` it
|
|
376
|
+
reads the table's column. After `UNION`, `ORDER BY` reads the names of the first branch
|
|
377
|
+
(its aliases and its columns): a name the first branch does not put out is refused there.
|
|
378
|
+
- In a DCSQL transform the columns land by name in the fields of the node's output object
|
|
379
|
+
(`relation_name`). An alias spelled like an output field follows that field, and so do its
|
|
380
|
+
uses in `ORDER BY` and `HAVING`
|
|
381
|
+
(`AS ssot__Name__c` becomes `AS Name__c` when the field becomes `Name__c`). A `GROUP BY`
|
|
382
|
+
name equal to such a renamed alias is refused, because Spark reads it as a
|
|
383
|
+
table column when one exists and as the alias otherwise: group by the expression itself. An
|
|
384
|
+
alias of the column of the same name (`s.Id__c AS Id__c`) is not refused, since that column
|
|
385
|
+
exists. A column without
|
|
386
|
+
an alias is refused when its name and its field's name no longer match in the target (an
|
|
387
|
+
output DLO keeps its fields, so `SELECT ssot__Id__c …` into it is refused): write it with
|
|
388
|
+
`AS` and the field name as the source data space spells it. `*` over a table that is not a
|
|
389
|
+
DLO is refused too, and so is `*` over a DLO when the output fields change: list the columns.
|
|
390
|
+
- A DCSQL node whose `relation_name` names no output object of the transform is an
|
|
391
|
+
intermediate model: its `relation_name` follows the object rules, and its columns are
|
|
392
|
+
checked the same way against that object's fields as the other nodes read them (a DLO keeps
|
|
393
|
+
its fields; a DMO's fields follow its rule, and a custom DMO's never change, so `*` over a DLO
|
|
394
|
+
into one is kept). A node without a `relation_name` is refused. A node's `config`
|
|
395
|
+
(`materialized: table`) is kept, but a value in it that holds an object or field name
|
|
396
|
+
(`unique_key: Id__c`) is refused.
|
|
397
|
+
- Positions are reported per SQL file, line and column.
|
|
398
|
+
- **Nothing is guessed.** A name no rule places exactly is listed, and the whole deploy is
|
|
399
|
+
refused before any write (`CROSS_DATASPACE_UNRESOLVED`). For example, `ds2_Order__dlm`
|
|
400
|
+
towards `default` can be a standard copy or a custom DMO: select its retrieved DMO file too.
|
|
401
|
+
- **Graphs, rulesets and transforms are checked completely.** Salesforce accepts a graph left in
|
|
402
|
+
the `default` spelling in another data space and builds it on the `default` objects. So after
|
|
403
|
+
the translation every object and field name must be covered, and none may keep the old
|
|
404
|
+
spelling; otherwise the file is refused (`CROSS_DATASPACE_UNRESOLVED`).
|
|
405
|
+
- **Not translated yet:** STL transforms with any other node, transforms of other types (such
|
|
406
|
+
as streaming SQL), and data streams. Under the flag they are refused before any write
|
|
407
|
+
(`CROSS_DATASPACE_UNSUPPORTED`).
|
|
408
|
+
- **`--preview`** lists every rename (file, place in the file, old and new name, rule) and the
|
|
409
|
+
copy files it would write. It writes nothing.
|
|
410
|
+
- **Copy files:** after an item has deployed, deploy writes its translated file under the new
|
|
411
|
+
name, for example `data360/dmo/ds2_Order__dlm.dmo-meta.json`, and for an insight or DBT
|
|
412
|
+
segment its SQL files beside it. Your original files never change.
|
|
413
|
+
- A copy goes only to a new path. An existing file with the same content is reused; one with
|
|
414
|
+
other content stops the deploy before any write (`CROSS_DATASPACE_COPY_CONFLICT`).
|
|
415
|
+
- A mapping or relationship copy takes the name Salesforce gave it. A mapping copy holds the
|
|
416
|
+
mapping as Salesforce stores it, the same file a retrieve of the target data space writes.
|
|
417
|
+
That name is known only after the deploy, so another file already at that path does not stop
|
|
418
|
+
the deploy: the copy is reported as not written, in the output and in the `--json` warnings.
|
|
419
|
+
- A copy file selected beside its original (for example `-d data360` after an earlier `-c`
|
|
420
|
+
run) would deploy the same item twice; the deploy is refused before any write
|
|
421
|
+
(`DUPLICATE_IDENTITY`) and names both files.
|
|
422
|
+
- A DLO gets no copy file; the output shows its new data space.
|
|
423
|
+
|
|
424
|
+
Each type page has a "Data spaces" section with its own rules. The
|
|
425
|
+
[Data spaces guide on sfmc.guide](https://sfmc.guide/next/data-spaces/) explains the concept and
|
|
426
|
+
the Salesforce behaviour.
|
|
427
|
+
|
|
428
|
+
## Per-type notes
|
|
429
|
+
|
|
430
|
+
The few things to know per type. Each type page has the full rules and error codes.
|
|
431
|
+
|
|
432
|
+
### Data streams
|
|
433
|
+
|
|
434
|
+
- Create the stream first: it creates its landing DLO. Then create the DMO, then the mapping.
|
|
435
|
+
- Salesforce gives a new Ingestion API stream a name of its own. Deploy shows that name in its
|
|
436
|
+
result (`targetApiName` in JSON output); retrieve the stream under that name and keep that
|
|
437
|
+
file.
|
|
438
|
+
- Ingestion API streams and Salesforce CRM streams are tested; other connectors are sent as
|
|
439
|
+
written.
|
|
440
|
+
- Delete keeps the landing DLO unless you add `--delete-dlo`, and is refused while something
|
|
441
|
+
else still uses the stream or its DLO.
|
|
442
|
+
- Reference: [Data streams](docs/types/data-stream.md).
|
|
443
|
+
|
|
444
|
+
### DLOs
|
|
445
|
+
|
|
446
|
+
- Category and, for Engagement DLOs, the event time field cannot change after create.
|
|
447
|
+
- An existing DLO takes label changes and new fields; other field changes are refused.
|
|
448
|
+
- For a stream's landing DLO, add fields through the stream.
|
|
449
|
+
- Reference: [DLOs](docs/types/dlo.md).
|
|
450
|
+
|
|
451
|
+
### DMOs
|
|
452
|
+
|
|
453
|
+
- Custom DMOs are fully managed. Standard and generated DMOs take custom fields, labels and the
|
|
454
|
+
description; the plugin never creates a standard DMO.
|
|
455
|
+
- Fields missing from the file are removed only with `--allow-field-removal`. A mapped field is
|
|
456
|
+
removed only when the same deploy also updates every mapping that uses it.
|
|
457
|
+
- `delete --field` removes single fields, also standard and generated ones.
|
|
458
|
+
- Reference: [DMOs](docs/types/dmo.md).
|
|
459
|
+
|
|
460
|
+
### Mappings
|
|
461
|
+
|
|
462
|
+
- The file is the list of field pairs the mapping should have; deploy adds and removes pairs to
|
|
463
|
+
match it. Pairs Salesforce generates stay.
|
|
464
|
+
- The first mapping onto a standard DMO that is not enabled yet enables it permanently; preview
|
|
465
|
+
warns about it.
|
|
466
|
+
- The last mapping of a custom DMO cannot be deleted on its own: delete the DMO instead.
|
|
467
|
+
- Reference: [Mappings](docs/types/mapping.md).
|
|
468
|
+
|
|
469
|
+
### Relationships
|
|
470
|
+
|
|
471
|
+
- Retrieve takes the source DMO: `relationship:<Dmo__dlm>` saves all of its relationships.
|
|
472
|
+
- Label, cardinality and source field can change in place. Deploy never deletes relationships.
|
|
473
|
+
- Both objects must be mapped before Salesforce accepts a relationship.
|
|
474
|
+
- Reference: [Relationships](docs/types/relationship.md).
|
|
475
|
+
|
|
476
|
+
### Data transforms
|
|
477
|
+
|
|
478
|
+
- The file holds the transform as Salesforce returns it, plus its schedule. A file without a
|
|
479
|
+
schedule leaves the org's schedule alone.
|
|
480
|
+
- A deployed schedule makes the transform run in the target org. Deploy never starts a run.
|
|
481
|
+
- Formula, SQL filter and DCSQL SQL are written plain: the plugin asks Salesforce for plain
|
|
482
|
+
text. Salesforce never decodes HTML entities it is sent, so deploy refuses an expression
|
|
483
|
+
holding one outside texts (`>`, `'`): write the character itself.
|
|
484
|
+
- Deploy refuses a file whose text is an HTML-escaped copy of the org's text
|
|
485
|
+
(`HTML_ESCAPED_FILE`, all types): Salesforce would store the entities literally.
|
|
486
|
+
- A DLO is written by one transform only, whatever the data space. A transform copied into
|
|
487
|
+
another data space keeps its output DLO names, so it needs another output object, or the
|
|
488
|
+
source transform deleted first. Salesforce's validation issues are shown with
|
|
489
|
+
`TRANSFORM_VALIDATION_FAILED`.
|
|
490
|
+
- A SQL filter refuses `<>`; write `!=`.
|
|
491
|
+
- Reference: [Data transforms](docs/types/data-transform.md).
|
|
492
|
+
|
|
493
|
+
### Calculated insights
|
|
494
|
+
|
|
495
|
+
- The SQL is kept in its own `.sql` file. `--draft` deploys a draft; `sf data360 publish`
|
|
496
|
+
activates it.
|
|
497
|
+
- Some SQL is accepted by Salesforce but fails a few minutes after publish without a message,
|
|
498
|
+
for example a table alias or a `--` comment in a classic insight. Deploy warns about each such
|
|
499
|
+
spot with file, line and column, and still deploys
|
|
500
|
+
([`CI_SQL_FAILS_SILENTLY`](docs/errors/calculated-insight/CI_SQL_FAILS_SILENTLY.md)).
|
|
501
|
+
- Reference: [Calculated insights](docs/types/calculated-insight.md).
|
|
502
|
+
|
|
503
|
+
### Segments
|
|
504
|
+
|
|
505
|
+
- SQL (DBT) segments keep each model in its own `.sql` file; segments built in the canvas keep
|
|
506
|
+
their criteria in the JSON file.
|
|
507
|
+
- Create and update need `--allow-processing`. A deployed schedule makes the segment publish in
|
|
508
|
+
the target org.
|
|
509
|
+
- The DMO the segment is built on must exist in the target org.
|
|
510
|
+
- `sf data360 publish -m segment:<Name>` publishes and waits for the result (`--async` starts
|
|
511
|
+
it and returns at once); `sf data360 segment members export -m segment:<Name>` writes the members as CSV or JSON.
|
|
512
|
+
- Reference: [Segments](docs/types/segment.md).
|
|
513
|
+
|
|
514
|
+
### Data graphs
|
|
515
|
+
|
|
516
|
+
- Salesforce refuses removing fields or related objects and changing the root. The plugin
|
|
517
|
+
refuses join changes, which Salesforce would accept but not apply.
|
|
518
|
+
- A file with another name creates another graph; graphs are not renamed.
|
|
519
|
+
- Graphs deploy last and are deleted first.
|
|
520
|
+
- Reference: [Data graphs](docs/types/data-graph.md).
|
|
521
|
+
|
|
522
|
+
### Identity resolution
|
|
523
|
+
|
|
524
|
+
- Create and update wait until the ruleset is published, which can take minutes. `--async`
|
|
525
|
+
returns as soon as Salesforce accepts the change; run the same deploy again later to check.
|
|
526
|
+
- The configuration type and the secondary DMO cannot change.
|
|
527
|
+
- Reference: [Identity resolution](docs/types/identity-resolution.md).
|
|
528
|
+
|
|
529
|
+
## Safety and limits
|
|
530
|
+
|
|
531
|
+
- Run `--preview` before every deploy and delete.
|
|
532
|
+
- Use a sandbox or test org first. Deploys of streams, segments, graphs and identity resolution
|
|
533
|
+
start processing; deletes cannot be undone.
|
|
534
|
+
- Retrieve, delete and field delete write files only below `data360/` and refuse symbolic links
|
|
535
|
+
and paths outside it; `segment members export` writes its CSV or JSON to `--output-file`
|
|
536
|
+
(by default under `data/<data space>/`). A differing existing file is replaced only with
|
|
537
|
+
`--overwrite` (`-x`) on retrieve.
|
|
538
|
+
- No retry and no rollback of writes: after an `unknown` result, check the org first.
|
|
539
|
+
- Not every Salesforce behaviour is tested for every type, data space or org; the type pages
|
|
540
|
+
name what is untested.
|
|
541
|
+
|
|
542
|
+
## Use it from another plugin
|
|
543
|
+
|
|
544
|
+
Other plugins can import `sf-plugin-data/api` and call it with a `Connection` from
|
|
545
|
+
`@salesforce/core` (`(await Org.create({ aliasOrUsername })).getConnection()`). The functions read
|
|
546
|
+
with API 68, print nothing and never exit; a refusal is thrown as an error with a `code` that has
|
|
547
|
+
a page under [docs/errors](docs/errors/README.md).
|
|
548
|
+
|
|
549
|
+
- `listSegments(connection, { dataSpace })`: every segment of one data space with `apiName`,
|
|
550
|
+
`marketSegmentId` (the record ID, `1sg…`), `dataSpace`, `segmentOnApiName`, `segmentStatus` and
|
|
551
|
+
`publishStatus`. An incomplete list fails with `SEGMENT_ACQUISITION_FAILED`.
|
|
552
|
+
- `resolveSegment(connection, { dataSpace, apiName })` or `{ dataSpace, marketSegmentId }`: one
|
|
553
|
+
segment, matched exactly. A segment of another data space fails with `SEGMENT_OTHER_DATASPACE`,
|
|
554
|
+
no segment at all with `SEGMENT_NOT_FOUND`.
|
|
555
|
+
- `crossSpaceContext(connection, { from, to, names? })`: what the rename rules of
|
|
556
|
+
[salesforce-data360-rules](https://www.npmjs.com/package/salesforce-data360-rules) need to turn
|
|
557
|
+
names of one data space into those of another (`placeDmo` for DMO names, `translateSegmentName`, …): the org's
|
|
558
|
+
data spaces with their prefixes and, when a name in `names` is an identity resolution output
|
|
559
|
+
(or `names` is left out), its rulesets. A data space the org lacks fails with
|
|
560
|
+
`UNKNOWN_DATASPACE`.
|
|
561
|
+
|
|
562
|
+
## Local development
|
|
563
|
+
|
|
564
|
+
```sh
|
|
565
|
+
npm ci
|
|
566
|
+
npm run build
|
|
567
|
+
npm run lint
|
|
568
|
+
npm test
|
|
569
|
+
node bin/run.js data360 --help
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
`bin/run.js` runs the commands from the checkout without installing them into Salesforce CLI.
|
|
573
|
+
The tests run offline and never contact an org. `npm run smoke` runs the quick command and
|
|
574
|
+
documentation checks; `npm run smoke:package` packs the plugin and checks the package in an
|
|
575
|
+
isolated installation.
|
|
576
|
+
|
|
577
|
+
To try an installed copy, use a separate Salesforce CLI profile rather than your everyday one:
|
|
578
|
+
other plugins installed there may claim the same `data360` command names.
|
|
579
|
+
|
|
580
|
+
## More documentation
|
|
581
|
+
|
|
582
|
+
- [Type reference pages](docs/types/): one page per type, plus [Delete](docs/types/delete.md).
|
|
583
|
+
- [Error codes](docs/errors/README.md).
|
|
584
|
+
- [Artifact format](docs/artifact-format.md): the file layout.
|
|
585
|
+
- [Git workflow](docs/git-workflow.md): `--changed-since` and review flow.
|
|
586
|
+
- [Capabilities](docs/capabilities.md): the status of each type.
|
|
587
|
+
- [Data Cloud DevOps on sfmc.guide](https://sfmc.guide/next/data-cloud-devops/) and
|
|
588
|
+
[Data spaces on sfmc.guide](https://sfmc.guide/next/data-spaces/).
|
|
589
|
+
|
|
590
|
+
Release notes are in GitHub Releases.
|
package/bin/run.js
ADDED