sf-plugin-data 0.3.0 → 0.5.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 (46) hide show
  1. package/README.md +34 -15
  2. package/docs/artifact-format.md +4 -4
  3. package/docs/capabilities.md +10 -10
  4. package/docs/git-workflow.md +5 -6
  5. package/docs/handover.md +32 -32
  6. package/lib/api.d.ts +7 -0
  7. package/lib/api.js +5 -1
  8. package/lib/commands/data360/delete.d.ts +57 -12
  9. package/lib/commands/data360/delete.js +191 -42
  10. package/lib/commands/data360/deploy.d.ts +14 -2
  11. package/lib/commands/data360/deploy.js +32 -20
  12. package/lib/commands/data360/publish.d.ts +2 -2
  13. package/lib/commands/data360/publish.js +14 -12
  14. package/lib/commands/data360/retrieve.d.ts +1 -4
  15. package/lib/commands/data360/retrieve.js +17 -32
  16. package/lib/errors/codes/calculated-insight.js +1 -1
  17. package/lib/errors/codes/data-graph.js +2 -2
  18. package/lib/errors/codes/data-stream.js +1 -1
  19. package/lib/errors/codes/data-transform.js +1 -1
  20. package/lib/errors/codes/dlo.js +1 -1
  21. package/lib/errors/codes/dmo.js +1 -1
  22. package/lib/errors/codes/general.js +6 -4
  23. package/lib/errors/codes/identity-resolution.js +1 -1
  24. package/lib/errors/codes/mapping.js +1 -1
  25. package/lib/errors/codes/relationship.js +1 -1
  26. package/lib/errors/codes/segment.js +2 -2
  27. package/lib/services/command-native-data-graph.js +1 -1
  28. package/lib/services/command-native-dmo.js +1 -1
  29. package/lib/services/delete-calculated-insight.js +1 -1
  30. package/lib/services/delete-identity-resolution.js +1 -1
  31. package/lib/services/delete-segment.js +1 -1
  32. package/lib/services/native-data-graph-crd.d.ts +2 -2
  33. package/lib/services/native-data-graph-crd.js +2 -2
  34. package/lib/services/operation-diagnostic.js +1 -1
  35. package/lib/services/publish-segment.d.ts +1 -1
  36. package/lib/services/run-delete.d.ts +43 -0
  37. package/lib/services/run-delete.js +111 -0
  38. package/lib/services/run-deploy.d.ts +51 -0
  39. package/lib/services/run-deploy.js +107 -0
  40. package/lib/services/run-options.d.ts +23 -0
  41. package/lib/services/run-options.js +38 -0
  42. package/lib/services/run-retrieve.d.ts +3 -3
  43. package/lib/services/run-retrieve.js +6 -2
  44. package/lib/transport/connect-client.d.ts +8 -0
  45. package/lib/transport/connect-client.js +25 -1
  46. package/package.json +1 -1
package/README.md CHANGED
@@ -73,7 +73,7 @@ sf data360 delete -o target -m segment:Old_Segment
73
73
 
74
74
  # Deploy what changed in Git since main, and delete what was deleted
75
75
  sf data360 deploy -o target --changed-since main --preview
76
- sf data360 delete -o target --changed-since main --confirm-delete
76
+ sf data360 delete -o target --changed-since main
77
77
  ```
78
78
 
79
79
  The commands:
@@ -107,7 +107,7 @@ space of the org; see [Data spaces](#data-spaces).
107
107
  | [Calculated insights](docs/types/calculated-insight.md), `calculated-insight` | Available | Available | Available | Available | `sf data360 publish`; `--draft` |
108
108
  | [Segments](docs/types/segment.md), `segment` | Available | Available | Available | Available | `sf data360 publish`; schedule; `--allow-processing` |
109
109
  | [Segment members](docs/types/segment.md#export-segment-members) | Available | Unavailable | Available | Unavailable | Read: `sf data360 segment members export`; update: `sf data360 publish` |
110
- | [Data graphs](docs/types/data-graph.md), `data-graph` | Available | Available | Available | Available | Schedule; `--allow-processing`; `--wait-timeout` |
110
+ | [Data graphs](docs/types/data-graph.md), `data-graph` | Available | Available | Available | Available | Schedule; `--allow-processing`; `--wait` |
111
111
  | [Identity resolution](docs/types/identity-resolution.md), `identity-resolution` | Available | Available | Available | Available | `--async`; `--allow-processing` |
112
112
  | Source object definitions | Unavailable | Unavailable | Unavailable | Unavailable | Connectors and credentials are not handled |
113
113
  | Kit templates | Unavailable | Unavailable | Unavailable | Unavailable | Data kits are not handled |
@@ -164,7 +164,7 @@ are left out, and deploy keeps them. The exact layout of each file is on its typ
164
164
  Retrieve without `-m` selects every component of every type in the run's data space, as if
165
165
  each type were named bare; `-m` narrows the run.
166
166
  - Deploy and delete always name their components, or take them from Git with
167
- `--changed-since`. Deploy also takes files and folders with `--source-dir` (`-d`).
167
+ `--changed-since`. Deploy also takes files and folders with `--source-dir`.
168
168
 
169
169
  ### Preview first
170
170
 
@@ -218,10 +218,11 @@ first, then identity resolution, calculated insights and segments, transforms, r
218
218
  mappings, DMOs, DLOs, and data streams last. Each phase finishes before the next starts.
219
219
 
220
220
  - Components are selected by name with `-m`. A delete reads no local file, except for a mapping,
221
- which it finds through its local file like deploy does. A `-m` delete needs
222
- no confirmation flag, so check it with `--preview` first.
223
- - `--changed-since <ref>` deletes the components whose files were deleted in that Git range. It
224
- always needs `--confirm-delete` (not with `--preview`).
221
+ which it finds through its local file like deploy does.
222
+ - `--changed-since <ref>` deletes the components whose files were deleted in that Git range.
223
+ - Before deleting, the command lists what it would delete and asks once (no answer within 30
224
+ seconds is no). Without a terminal or with `--json` it refuses unless you pass `--no-prompt`
225
+ (`-r`); check the selection with `--preview` first.
225
226
  - A component the org does not have reports `unchanged`.
226
227
  - A data stream keeps its landing DLO unless you add `--delete-dlo`.
227
228
  - `sf data360 delete -m dmo:<Name>__dlm --field <Field__c>` removes single fields of a DMO.
@@ -351,15 +352,15 @@ What the plugin does:
351
352
 
352
353
  ### Deploy from another data space (only if you have more than one data space)
353
354
 
354
- `sf data360 deploy --dataspace <target> --allow-cross-dataspace` (short `-c`) deploys files of
355
+ `sf data360 deploy --dataspace <target> --allow-cross-dataspace` deploys files of
355
356
  another data space into `<target>`. Each file's `c__dataSpace` says where it comes from. Without
356
357
  the flag such a file is refused, and the message names the flag.
357
358
 
358
359
  ```bash
359
360
  # See every rename first; nothing is written
360
- sf data360 deploy -o myOrg --dataspace dataspace2 -c -d data360/dmo/Order__dlm.dmo-meta.json -d data360/segments/Audience.segment.json --preview
361
+ sf data360 deploy -o myOrg --dataspace dataspace2 --allow-cross-dataspace --source-dir data360/dmo/Order__dlm.dmo-meta.json --source-dir data360/segments/Audience.segment.json --preview
361
362
  # Then deploy
362
- sf data360 deploy -o myOrg --dataspace dataspace2 -c -d data360/dmo/Order__dlm.dmo-meta.json -d data360/segments/Audience.segment.json --allow-processing
363
+ sf data360 deploy -o myOrg --dataspace dataspace2 --allow-cross-dataspace --source-dir data360/dmo/Order__dlm.dmo-meta.json --source-dir data360/segments/Audience.segment.json --allow-processing
363
364
  ```
364
365
 
365
366
  - **What is translated:** DMOs, mappings, relationships, UI, Waterfall and SQL (DBT)
@@ -454,8 +455,8 @@ sf data360 deploy -o myOrg --dataspace dataspace2 -c -d data360/dmo/Order__dlm.d
454
455
  mapping as Salesforce stores it, the same file a retrieve of the target data space writes.
455
456
  That name is known only after the deploy, so another file already at that path does not stop
456
457
  the deploy: the copy is reported as not written, in the output and in the `--json` warnings.
457
- - A copy file selected beside its original (for example `-d data360` after an earlier `-c`
458
- run) would deploy the same item twice; the deploy is refused before any write
458
+ - A copy file selected beside its original (for example `--source-dir data360` after an earlier
459
+ `--allow-cross-dataspace` run) would deploy the same item twice; the deploy is refused before any write
459
460
  (`DUPLICATE_IDENTITY`) and names both files.
460
461
  - A DLO gets no copy file; the output shows its new data space.
461
462
 
@@ -571,8 +572,8 @@ The few things to know per type. Each type page has the full rules and error cod
571
572
  start processing; deletes cannot be undone.
572
573
  - Retrieve, delete and field delete write files only below `data360/` and refuse symbolic links
573
574
  and paths outside it; `segment members export` writes its CSV or JSON to `--output-file`
574
- (by default under `data/<data space>/`). A differing existing file is replaced only with
575
- `--overwrite` (`-x`) on retrieve.
575
+ (by default under `data/<data space>/`). A retrieve replaces a local file whose
576
+ content differs from the org (Git shows the change) and leaves identical files unchanged.
576
577
  - No retry and no rollback of writes: after an `unknown` result, check the org first.
577
578
  - Not every Salesforce behaviour is tested for every type, data space or org; the type pages
578
579
  name what is untested.
@@ -599,11 +600,29 @@ a page under [docs/errors](docs/errors/README.md).
599
600
  data spaces with their prefixes and, when a name in `names` is an identity resolution output
600
601
  (or `names` is left out), its rulesets. A data space the org lacks fails with
601
602
  `UNKNOWN_DATASPACE`.
602
- - `runRetrieve(connection, { dataspace?, metadata?, outputDir?, overwrite?, apiVersion? })`: runs
603
+ - `runRetrieve(connection, { dataspace?, metadata?, outputDir?, apiVersion? })`: runs
603
604
  `sf data360 retrieve` with those flags and returns the same envelope `--json` shows. It does
604
605
  not throw for a refusal; the envelope's `status` and diagnostics say what happened, and
605
606
  `exitCodeOf(envelope)` gives the exit code the command would use. The connection's API version
606
607
  is restored afterwards.
608
+ - `runDeploy(connection, options?)` and `runDelete(connection, options?)`: run
609
+ `sf data360 deploy` and `sf data360 delete` over the connection and return the same envelope
610
+ `--json` shows (types `DeployOptions`, `DeleteOptions`, `DeployEnvelope`, `DeleteEnvelope`).
611
+ The options are the flags in camelCase. Both take `preview`, `metadata`, `dataspace`,
612
+ `apiVersion` (default `auto`), `changedSince` and `projectDir` (the folder holding `data360/`
613
+ and the Git repository; default the current directory). `runDeploy` also takes `sourceDir`
614
+ (relative to `projectDir`), `allowCrossDataspace`, `allowProcessing`, `allowFieldRemoval`,
615
+ `allowDataspaceRemoval`, `async`, `draft` and `wait` (whole minutes). `runDelete` also takes
616
+ `deleteDlo`, `field`, `keepLocalFiles` and `outputDir`. `runDelete` never asks: calling it is
617
+ the confirmation (as `--no-prompt`); a delete runs its services at API 68.0. Nothing is
618
+ printed, `process.exitCode` is left alone and the connection's API version is restored
619
+ afterwards. A refusal comes back as an envelope; only options the CLI refuses while parsing
620
+ (`changedSince` with `metadata` or `sourceDir`, a `wait` below 1 or not whole, a malformed
621
+ deploy `apiVersion`) throw an `OptionError` with `code` `INVALID_OPTION` and `exitCode` 2.
622
+ Every REST and Metadata API call uses the given connection, except the Metadata API
623
+ destructive change of a DMO field removal (`allowFieldRemoval`, `field`) and of a mapping
624
+ delete or pair removal: it runs `sf project deploy start` for the connection's username, so it
625
+ needs the Salesforce CLI installed and that user authorized in it.
607
626
 
608
627
  ## Local development
609
628
 
@@ -104,7 +104,7 @@ file of another data space than the run's is `SEGMENT_DATASPACE_MISMATCH`.
104
104
  The file holds no `parameters` (the API has no write for them). A model name must start with a letter or digit and hold only
105
105
  letters, digits and underscores, and two model names may not differ only in case; another
106
106
  name is refused with `INVALID_SEGMENT_DOCUMENT`. A repeat retrieve of an unchanged segment
107
- writes nothing (`unchanged`); with `--overwrite`, the SQL file of a model the segment no
107
+ writes nothing (`unchanged`); when the segment changed, the SQL file of a model it no
108
108
  longer has is removed.
109
109
 
110
110
  Deploy, delete and `--changed-since` read the same files. The JSON or any of its SQL files,
@@ -264,7 +264,7 @@ keys or extra keys. Those values are sent as authored and Salesforce decides.
264
264
  - Record IDs and other runtime observations of the object are not saved.
265
265
 
266
266
  The file is indented with two spaces and ends with LF. Identical bytes are
267
- unchanged; a differing file requires `--overwrite` (DMO names are unique in the org,
267
+ unchanged; a differing file is replaced (DMO names are unique in the org,
268
268
  so the file at the path is the same DMO whatever data space it names). The
269
269
  writer rejects linked paths and files above 1 MiB, stages the complete file under
270
270
  the OS temp directory and publishes it by rename or exclusive hard link. Writer
@@ -305,7 +305,7 @@ codes: `UNSAFE_PATH`, `OVERWRITE_REQUIRED`, `OUTPUT_CHANGED`, `OUTPUT_FAILED`,
305
305
  space, which must be the run's: `MAPPING_DATASPACE_MISMATCH` otherwise;
306
306
  `LEGACY_DATASPACE_KEY` for the old `identity.dataSpace`), `identity` with `apiName`
307
307
  only, and `spec`. Mapping names are unique in the org, so the file at the path is the
308
- same mapping whatever data space it names (`--overwrite` replaces it). It may name a
308
+ same mapping whatever data space it names (a retrieve replaces it). It may name a
309
309
  custom or a standard DMO in `spec.targetEntityDeveloperName`, under the name Salesforce
310
310
  stores in the mapping's data space (`ds2_ContactPointEmail__dlm` with `EmailAddress__c`
311
311
  for a standard DMO copy in `dataspace2`). The first mapping onto a standard DMO copy that
@@ -489,7 +489,7 @@ org's relationship name; if the binding exists only under another name, delete
489
489
  refuses with `RELATIONSHIP_NAME_MISMATCH` and names it.
490
490
 
491
491
  The file is indented with two spaces and ends with LF. Identical bytes are
492
- unchanged; a differing file requires `--overwrite` (relationship names are unique in the
492
+ unchanged; a differing file is replaced (relationship names are unique in the
493
493
  org). Writer codes:
494
494
  `UNSAFE_PATH`, `OVERWRITE_REQUIRED`, `OUTPUT_CHANGED`, `OUTPUT_FAILED`,
495
495
  `PARTIAL_RELATIONSHIP_OUTPUT`.
@@ -8,7 +8,7 @@ whole run; with several families selected its diagnostic names the family (for e
8
8
  transform, which reads at API 68 only). The families then run one after another: DLO, DMO,
9
9
  mapping, relationship, Segment, calculated insight and identity resolution first, then data
10
10
  streams, data transforms and data graphs. Each keeps its own rules (inventory refusals,
11
- `--overwrite`, identical bytes `unchanged`). A failing component or family does not stop
11
+ differing files replaced, identical bytes `unchanged`). A failing component or family does not stop
12
12
  the others; their files are kept and the result is the worst status (`failed` over
13
13
  `blocked` over `success`). A failing graph gets its own diagnostic and the next graph still
14
14
  runs. Retrieve only reads.
@@ -16,7 +16,7 @@ runs. Retrieve only reads.
16
16
  Live on `isolated-source` (2026-11-14, `auto`): one retrieve of a DMO, an Ingestion API
17
17
  stream, a transform, two graphs and an identity resolution ruleset retrieved all six in one
18
18
  `success` result. A repeat reported the DMO, ruleset, transform and graphs `unchanged`; the
19
- stream was refused with `OVERWRITE_REQUIRED` because Salesforce returns its field mappings in a
19
+ stream file is written again (`retrieved`) because Salesforce returns its field mappings in a
20
20
  different order on each read, and the file keeps that order (also for a stream retrieved alone).
21
21
 
22
22
  ## Delete phases — 2026-11-14
@@ -30,8 +30,9 @@ relationships, mappings, DMOs and DLOs (in that order), P0 data streams. Each fa
30
30
  its own delete checks. A phase starts only after every item of the previous one settled; a
31
31
  blocked, failed or unconfirmed item stops the run, and an item Salesforce accepted but still
32
32
  processes (`deletion-processing`) stops the later phases (`DELETE_PHASE_NOT_SETTLED`;
33
- rerun the same delete once it reads absent). A `-m` delete needs no confirmation flag;
34
- `--confirm-delete` is accepted only with `--changed-since`. Every item carries `family`.
33
+ rerun the same delete once it reads absent). Without `--preview` the command lists what it
34
+ would delete and asks once (`DELETE_CANCELLED` on no); without a terminal or with `--json` it
35
+ needs `--no-prompt` (`CONFIRMATION_REQUIRED`). Every item carries `family`.
35
36
 
36
37
  - Before the first delete (read-only, preview too) each selected transform, Segment, IR,
37
38
  CI and graph is read from the org by name with the existing readers: transform through
@@ -73,8 +74,7 @@ rerun the same delete once it reads absent). A `-m` delete needs no confirmation
73
74
  mapping stays refused.
74
75
  - `--changed-since <ref>`: the components of the canonical plugin files deleted in the
75
76
  range (committed or staged) are deleted through the same phases; changed and added files
76
- are not part of a delete. Exclusive with `-m`; `--delete-dlo` is refused. Execution
77
- always needs `--confirm-delete`; preview does not. Each family runs from its merge-base document (identity from content), every
77
+ are not part of a delete. Exclusive with `-m`; `--delete-dlo` is refused. Each family runs from its merge-base document (identity from content), every
78
78
  deleted path must still be absent right before each phase and before each source-family
79
79
  write (`BLOCKED_GIT_LIFECYCLE`), and each candidate's data space must equal the requested
80
80
  one. A relationship takes its source DMO from the base content; a data transform resolves
@@ -102,7 +102,7 @@ file's optional `schedule` is sent with its own schedule PUT when it differs, an
102
102
  without it leaves the schedule alone. A
103
103
  DLO file named like the landing DLO of a stream the deploy creates is refused after the
104
104
  stream's read-only comparison, before any write (`DATA_STREAM_DLO_COLLISION`); beside an
105
- existing stream it deploys. `--wait-timeout` applies to every selected graph and needs
105
+ existing stream it deploys. `--wait` applies to every selected graph and needs
106
106
  one. Preview runs every phase read-only (also after a blocked phase) and reports items
107
107
  whose parents an earlier phase creates as `planned-dependencies` (`DEPENDENCIES_PLANNED`,
108
108
  `MAPPING_DEPENDENCIES_PLANNED`): a mapping or transform on a new stream's landing DLO, a
@@ -124,14 +124,14 @@ stays lowercase. All six graphs in `isolated-source` retrieve at `auto` and prev
124
124
  `unchanged` on route 68.0. Deploy runs graphs as the last phase of any selection,
125
125
  explicit or `--changed-since`.
126
126
 
127
- Create waits up to `--wait-timeout` while the graph builds: `creating` with empty
127
+ Create waits up to `--wait` (minutes) while the graph builds: `creating` with empty
128
128
  generated names (empty names on a non-ready read are not authored values), then `ready`
129
129
  before the day-zero names exist, then metadata `Inprogress` for about 5 minutes,
130
130
  sometimes briefly missing. The POST is resent only after a 429/503 answer. A create the plugin cannot confirm
131
131
  reports `failed`/`unknown` with `DATA_GRAPH_CREATE_UNCONFIRMED` naming the step
132
132
  (`request`, `response`, `settlement`, `identity`, `deadline`); an unchanged repeat deploy or a
133
133
  retrieve confirms the graph. Retrieve resolves a relative
134
- `-d`/`--output-dir` against the current directory for every family.
134
+ `--output-dir` against the current directory for every family.
135
135
 
136
136
  Create sends the authored root, related objects, fields and schedule and needs
137
137
  `--allow-processing`; Salesforce adds key-qualifier fields to related objects and can
@@ -476,7 +476,7 @@ not created by a mapping file either (only the `ssot__` spelling is). Proven liv
476
476
  `data360:plugin-dataspace-prefix-rule-acceptance-api68`); transforms and graphs are covered by
477
477
  unit tests only.
478
478
 
479
- Cross-data-space deploy (2026-11-21, `--allow-cross-dataspace` / `-c`): a selected file whose
479
+ Cross-data-space deploy (2026-11-21, `--allow-cross-dataspace`): a selected file whose
480
480
  `c__dataSpace` is not the run's is translated in memory before any other check, with the
481
481
  prefixes of the same one `GET /ssot/data-spaces` (read early only when such a file is selected).
482
482
  Rule renames only: the data space prefix on, off or swapped (custom DMOs, segments, Waterfall
@@ -38,7 +38,7 @@ after every item of the previous one settled:
38
38
  batch; an identity resolution runs before a calculated insight or Segment on its
39
39
  unified DMO, which start only once the ruleset is published.
40
40
  4. Data graphs, after the ruleset whose unified DMO they use is published.
41
- `--wait-timeout` applies to each graph and is refused when the range holds none.
41
+ `--wait` applies to each graph and is refused when the range holds none.
42
42
 
43
43
  A data transform changed in the range is created or updated by name in the transform
44
44
  phase. A DLO file named like the
@@ -63,7 +63,7 @@ and deleted again is ignored.
63
63
 
64
64
  Deploy does not delete: candidates are listed in `result.selection.deletions` (family,
65
65
  API name, path) and as `Not deleted: <family>:<name>` lines that name the matching
66
- `sf data360 delete --changed-since <ref> --confirm-delete` command, and nothing is
66
+ `sf data360 delete --changed-since <ref>` command, and nothing is
67
67
  written for them.
68
68
 
69
69
  ### Deleting with `sf data360 delete --changed-since`
@@ -71,10 +71,9 @@ written for them.
71
71
  `sf data360 delete --changed-since <ref>` takes the same Git selection and deletes the
72
72
  components of the files deleted in the range; files changed or added in the range are
73
73
  not part of a delete. It is exclusive with `--metadata` and refuses `--delete-dlo`
74
- (`INVALID_STREAM_DELETE_SELECTION`). Execution always needs `--confirm-delete`
75
- (`DESTRUCTIVE_CONFIRMATION_REQUIRED` otherwise, before any org call), even for one
76
- family; `--preview` runs without it. `--confirm-delete` belongs to `--changed-since`
77
- only: a delete by name with `-m` runs without it.
74
+ (`INVALID_STREAM_DELETE_SELECTION`). Like every delete it lists the components and asks
75
+ once before deleting; without a terminal or with `--json` it needs `--no-prompt`
76
+ (`CONFIRMATION_REQUIRED` otherwise, before any org call). `--preview` never asks.
78
77
 
79
78
  - The candidates run through the same phases as any delete, in reverse order: graphs,
80
79
  then identity resolution, calculated insights and Segments (a dependent before what it
package/docs/handover.md CHANGED
@@ -263,12 +263,12 @@ queue item Q4. User decisions 2026-11-17: extend the existing publish command, n
263
263
  flag, wait for the result with a timeout, report a timeout as still processing.
264
264
 
265
265
  - Command shape: `sf data360 publish -m segment:Name` (new `-m`, segment only) or
266
- `-d data360/segments/Name.segment.json` (or one of its SQL files). The calculated-insight path
267
- (`-d` with a CI file) is unchanged. `-m` and `-d` are exclusive; another `-m` family is
268
- `INVALID_SELECTION`. New `--wait-timeout <seconds>` (default 1800), segment only; with a CI
269
- file or below 1 it is `INVALID_WAIT_TIMEOUT_SCOPE` (hint and page now name publish too).
266
+ `--source-dir data360/segments/Name.segment.json` (or one of its SQL files). The calculated-insight path
267
+ (`--source-dir` with a CI file) is unchanged. `-m` and `--source-dir` are exclusive; another `-m` family is
268
+ `INVALID_SELECTION`. New `--wait <minutes>` (`-w`, default 30), segment only; with a CI
269
+ file or below 1 it is `INVALID_WAIT_SCOPE` (hint and page now name publish too).
270
270
  - Service `src/services/publish-segment.ts`: GET `/ssot/segments/{Name}` (404 is
271
- `SEGMENT_PUBLISH_ADMISSION_FAILED`; name, data space and `1sg` ID are checked); with `-d` the
271
+ `SEGMENT_PUBLISH_ADMISSION_FAILED`; name, data space and `1sg` ID are checked); with `--source-dir` the
272
272
  org must hold the file (`carriesDefinition` on the lenient projection, otherwise
273
273
  `SEGMENT_PUBLISH_DEFINITION_MISMATCH`). Then one POST
274
274
  `/services/data/v68.0/ssot/segments/{marketSegmentId}/actions/publish` with an empty body
@@ -284,17 +284,17 @@ flag, wait for the result with a timeout, report a timeout as still processing.
284
284
  never resent (transport rule: writes repeat only when provably unsent).
285
285
  - PROCESSING/COUNTING: not checked locally; Salesforce decides (memory rule "the API decides";
286
286
  nothing local proves a refusal, and a refusal is reported with its text).
287
- - Verbatim `-d` file: `readDeployInputs` refuses it with `VERBATIM_NOT_DEPLOYABLE` before auth.
287
+ - Verbatim `--source-dir` file: `readDeployInputs` refuses it with `VERBATIM_NOT_DEPLOYABLE` before auth.
288
288
  `-m` reads the org segment raw and needs no model of it.
289
289
  - Found live: JSforce never sends a POST whose `body` is undefined; the request hangs unsent (a
290
290
  first live attempt hung, was stopped after two minutes, and the segment showed no publish
291
291
  status). `body: ''` goes out as `Content-Length: 0`. The client test pins `body === ''`.
292
292
  - Tests: `test/segment-publish-command.test.mjs` (route/body/no resend on 503 and reset, wait to
293
293
  SUCCESS, republish past an earlier SUCCESS, timeout, FAILED, preview, PROCESSING/COUNTING sent,
294
- 4xx text, unconfirmed answers, absent, `-d` match/mismatch, verbatim, flag refusals, help);
294
+ 4xx text, unconfirmed answers, absent, `--source-dir` match/mismatch, verbatim, flag refusals, help);
295
295
  `test/cli.test.mjs` publish flags. CI tests unchanged and green.
296
296
  - Docs: README (segment table row, Public Segment workflow publish paragraph), error pages for the
297
- six new codes and the `INVALID_WAIT_TIMEOUT_SCOPE` page, `docs/errors/README.md`.
297
+ six new codes and the `INVALID_WAIT_SCOPE` page, `docs/errors/README.md`.
298
298
  - Live (isolated-source, `00Daj000010xkZNEAY`): one `CliQ4Seg` DBT segment (`WHERE 1 = 0`, zero members) deployed with the plugin; `sf data360 publish -m segment:CliQ4Seg` sent one POST (PUBLISHING at once), read every 30 s and reported `published` / `confirmed-published`, `publishStatus` SUCCESS after 922 s (exit 0); then `sf data360 delete -m segment:CliQ4Seg` reported `deleted` and a GET answered ITEM_NOT_FOUND. Nothing else touched. DB entry `.claude/skills/_verification-db/entries/data360/data360-q4-segment-publish-api68.json` (validated, not rebuilt, not committed); evidence `F:/Temp/cli-q4-p6w2Im`.
299
299
  - Open: Q5 (member read). sfmc.guide not edited (segments page: publish row/command).
300
300
 
@@ -598,7 +598,7 @@ A graph whose GET reads `status: draft` is written as-is with reason `DATA_GRAPH
598
598
  hint and page; thrown in `retrieveNativeDataGraph` after the identity check). Chosen over carrying
599
599
  `creationMode: DRAFT` with a create-only deploy: POST of a draft works, but a draft GET has no
600
600
  `creationMode`, no schedule and no root node type (strict deploy needs it), never reaches `ready`
601
- (create settlement would wait for the whole `--wait-timeout` and report failed), cannot be PUT
601
+ (create settlement would wait for the whole `--wait` and report failed), cannot be PUT
602
602
  ("only when Active or Error") and is refused by delete (needs `ready`); a draft path through
603
603
  create, settlement, update and delete is far larger than one verbatim reason. `lastRunStatus` is
604
604
  now a server-owned top-level key (dropped on retrieve, admitted in deploy-mode GET projection).
@@ -1220,7 +1220,7 @@ Plan `sf_plugin_data_offpattern_20261114` chunk S (checkpoint decision "Segment
1220
1220
  `INVALID_SEGMENT_DOCUMENT` on retrieve (Salesforce allows more).
1221
1221
  - `SegmentDeployInput` gains `codePaths` (model order); digest is length-prefixed over JSON +
1222
1222
  SQL files. Missing/extra/misnamed `<Name>.segment.*` file, `sql` in the JSON, or the old
1223
- single-file form: `INVALID_SOURCE`. `-d` with any member file or the folder works.
1223
+ single-file form: `INVALID_SOURCE`. `--source-dir` with any member file or the folder works.
1224
1224
  - Git: a change to the JSON or any SQL file selects the segment; a SQL file deleted while
1225
1225
  the JSON stays is a change; JSON + every base model SQL deleted is one delete candidate
1226
1226
  (`codePaths`); a JSON deleted with a SQL file left blocks.
@@ -1243,7 +1243,7 @@ Plan `sf_plugin_data_offpattern_20261114` chunk S (checkpoint decision "Segment
1243
1243
  Plan `sf_plugin_data_offpattern_20261114` chunk E1b.
1244
1244
 
1245
1245
  - Deploy, publish and delete read `data360/calculatedInsights/<Name>__cio.calculatedInsight-meta.json`
1246
- plus `...-meta.sql` under the project root (`-m calculated-insight:Name__cio`, `-d` with
1246
+ plus `...-meta.sql` under the project root (`-m calculated-insight:Name__cio`, `--source-dir` with
1247
1247
  either file, a folder walk). The JSON is joined with exactly its SQL; a missing JSON or
1248
1248
  SQL, `expression` in the JSON, or any other `<Name>__cio.calculatedInsight-meta.*` file
1249
1249
  beside them is `INVALID_SOURCE`. The old XML/JSON pair paths are recognised nowhere in
@@ -1452,7 +1452,7 @@ decision of the same day). Version stays 0.1.0. Committed as 5a9b989; live read-
1452
1452
  - Several transforms in one delete (user decision 2026-11-14): allowed; each is resolved by
1453
1453
  name and deleted on its own in P2. Test: `one delete takes several transforms and deletes
1454
1454
  each in P2` (test/crud-delete-pipeline.test.mjs).
1455
- - `sf data360 delete` selects by name with `-m` only. `-d`/`--source-dir` and
1455
+ - `sf data360 delete` selects by name with `-m` only. `--source-dir` and
1456
1456
  `--transform-target-id` are removed from the command. `--confirm-delete` has
1457
1457
  `dependsOn: ['changed-since']` (oclif refuses it beside `-m`) and is required only for a
1458
1458
  `--changed-since` real run (preview without it). `-m` real runs pass `confirmDelete: true` /
@@ -1504,7 +1504,7 @@ each in P2` (test/crud-delete-pipeline.test.mjs).
1504
1504
  families `unchanged` without executor call, transform 0 matches `unchanged` and 2+
1505
1505
  refused (`-m` and Git), relationship colon selector (deletes by name, case-insensitive,
1506
1506
  0 unchanged, 2+ refused, wrong source DMO refused, five malformed forms refused), parser
1507
- refuses `-d`/`--source-dir`/`--transform-target-id` and `-m … --confirm-delete`,
1507
+ refuses `--source-dir`/`--transform-target-id` and `-m … --confirm-delete`,
1508
1508
  `--changed-since` still needs `--confirm-delete`. Removed as obsolete (file-input
1509
1509
  behaviour): CI pair byte drift ×2, CI JSON-companion selection, IR file byte drift ×3,
1510
1510
  transform file byte drift (replaced by org-definition drift), the multi-phase
@@ -1786,7 +1786,7 @@ Chunk B2 of the CRUD pipeline plan. Version stays 0.1.0; nothing committed.
1786
1786
  before any write: a stream whose landing DLO matches a selected DLO file is
1787
1787
  preflighted and refused only when the outcome is `create`; an existing stream's DLO
1788
1788
  file deploys in P1 (the API decides). A transform is named by exactly one
1789
- `data-transform:` member, or by its own file path in `--source-dir`. `--wait-timeout` needs ≥ 1 graph
1789
+ `data-transform:` member, or by its own file path in `--source-dir`. `--wait` needs ≥ 1 graph
1790
1790
  in the selection (explicit or Git; the early `--changed-since` refusal is gone) and
1791
1791
  applies to each graph. `nativeRoute` is also set when a transform is selected (DLOs
1792
1792
  settle before the transform). The P3 local admission now runs whenever a P0/P1/P2 stage
@@ -1800,15 +1800,15 @@ Chunk B2 of the CRUD pipeline plan. Version stays 0.1.0; nothing committed.
1800
1800
  links); new `DATA_STREAM_DLO_COLLISION` (page, index). `NATIVE_GRAPH_SELECTION_UNSUPPORTED`
1801
1801
  stays for retrieve only (one `data-graph:<Name>` per retrieve); deploy no longer emits
1802
1802
  it; hint/page rewritten. Hints/pages of `INVALID_TRANSFORM_SELECTION` and
1803
- `INVALID_WAIT_TIMEOUT_SCOPE` describe the new rules. Kept narrow refusal: a transform in
1803
+ `INVALID_WAIT_SCOPE` describe the new rules. Kept narrow refusal: a transform in
1804
1804
  a `--changed-since` range, because `--transform-operation` is not accepted with it.
1805
1805
  - Tests: new `test/crud-pipeline.test.mjs` (6): phase planning + helpers; full mixed run
1806
- stream → mapping → transform → IR (PUBLISHED) → graph with `--wait-timeout`; failed
1806
+ stream → mapping → transform → IR (PUBLISHED) → graph with `--wait`; failed
1807
1807
  stream / blocked transform stop later stages; preview planned parents (mapping and
1808
1808
  transform on a new landing DLO, graph on a new IR output) and compared parents when they
1809
1809
  exist; M2: new stream + DLO file refused before any write (execute and preview),
1810
1810
  existing stream + its DLO file deploys; transform member beside `--source-dir` files
1811
- accepted; transform selection and wait-timeout refusals.
1811
+ accepted; transform selection and `--wait` refusals.
1812
1812
  Updated obsolete refusal tests in IR, CI, stream and graph suites. Full suite 2816
1813
1813
  (2814 pass, 2 skipped).
1814
1814
  - Live (`isolated-source`, org 00Daj000010xkZNEAY verified, zero writes): scratch Git
@@ -1830,7 +1830,7 @@ Handover for C (IR + graph live):
1830
1830
  planned when the IR is a create.
1831
1831
  - Resume point: live run of the approved IR (`Individual_<4hex>`, label "CliIR probe
1832
1832
  <hex>") + graph (`CliGraphCP_<hex>`) on its unified DMO in one deploy with
1833
- `--allow-processing` (and `--wait-timeout` if needed); then record evidence. The graph
1833
+ `--allow-processing` (and `--wait` if needed); then record evidence. The graph
1834
1834
  stage resolves the org via `resolveTargetOrg` once per stage and reuses one graph
1835
1835
  context for all graphs.
1836
1836
  - Constraints: phases sequential; preview runs every stage; no new refusals for mixes;
@@ -1905,7 +1905,7 @@ Handover for B2 (P0 streams, P2 transforms, P4 graphs):
1905
1905
  - P4 graph waits for P3: use `identityResolutionEdges` (already covers graphs) so a graph
1906
1906
  needing a selected IR is reported planned in preview (IR create) and runs after the IR
1907
1907
  stage. Remaining from the plan: stream DLO collision with a P1 DLO (M2), transform DLO
1908
- bindings planned in preview, `--wait-timeout` / transform flags scope in mixed runs.
1908
+ bindings planned in preview, `--wait` / transform flags scope in mixed runs.
1909
1909
  - Constraints: phases run sequentially and execution stops on the first non-success;
1910
1910
  preview runs every stage (`continueAfterBlocked`) and returns the first non-success;
1911
1911
  P3 local checks (version, space, IR/CI/Segment shape, dependency order) run before any
@@ -2274,7 +2274,7 @@ Version stays 0.1.0; nothing pushed.
2274
2274
  - Tests in `test/native-data-graph-crd.test.mjs`: recorded creating echo, failed-check
2275
2275
  values (request/response/settlement), deploy item diagnostic, delete waiting through
2276
2276
  lingering metadata, delete budget, delete that leaves the graph ready. Three delete
2277
- deadline tests now tick 900 s. Also: a create POST still open at `--wait-timeout`
2277
+ deadline tests now tick 900 s. Also: a create POST still open at `--wait`
2278
2278
  (`deadline`), a delete whose item reads `deleting` past 12 reads, and the empty-name drop
2279
2279
  applying only to non-ready reads. Review: two rounds, zero must-fix.
2280
2280
 
@@ -2379,9 +2379,9 @@ Version stays 0.1.0; nothing pushed.
2379
2379
  Individual graph, while the API itself supports unified roots and updates (widening
2380
2380
  the native path is a separate package). The create settlement now treats a missing
2381
2381
  metadata entry or an echo without generated names as still building, waits up to
2382
- `--wait-timeout` with progress on stderr, and stops at once on a failed or deleting
2382
+ `--wait` with progress on stderr, and stops at once on a failed or deleting
2383
2383
  state; it never re-POSTs. This does not fix the create failure itself (see below).
2384
- - Retrieve resolves a relative `-d`/`--output-dir` against the current directory for
2384
+ - Retrieve resolves a relative `--output-dir` against the current directory for
2385
2385
  every family.
2386
2386
 
2387
2387
  Live, `isolated-source`. Raw probe at API 68: CI draft create 56 s, publish 55 s,
@@ -2391,7 +2391,7 @@ passed on retry. Native 68 graph PUT update works (label/description 45 s; addin
2391
2391
  field and a related object 288 s); raw API 68 also creates, updates and deletes
2392
2392
  unified-root graphs. After the change, all at `auto`: retrieve of two existing run CIs
2393
2393
  exit 0; a fixture CI created, published, deployed unchanged three times and deleted,
2394
- all exit 0; graph retrieve with a relative `-d` exit 0.
2394
+ all exit 0; graph retrieve with a relative `--output-dir` exit 0.
2395
2395
 
2396
2396
  Graph create settlement live result: still failing. Two live creates (CliGraphP9_8c71,
2397
2397
  CliGraphP10_8c71) exited 1 `failed`/`unknown` 46-48 s after start, within about one
@@ -4621,7 +4621,7 @@ its SOQL recipe supplied no executable identity endpoint, so read-only SObject
4621
4621
  Organization query plus independent CLI Organization query/core alias binding
4622
4622
  verified SOURCE. Exact ownership ledger IDs and ACTIVE desired labels checked.
4623
4623
  One actual public `node <repo>/bin/run.js data360 deploy -o <sourceAlias>
4624
- --api-version 65.0 -d <retainedCompanion> --allow-processing --json` returned
4624
+ --api-version 65.0 --source-dir <retainedCompanion> --allow-processing --json` returned
4625
4625
  exit0/status success, unchanged/not-attempted, preflight unchanged/present,
4626
4626
  requiredEffects[], diagnostics[]. No pair edit/new update/create/delete/refresh,
4627
4627
  activation, cleanup or target request. Original unknown update was never replayed.
@@ -4745,7 +4745,7 @@ matched the expected SOURCE alias before mutation. Target was untouched.
4745
4745
 
4746
4746
  - Exact retrieve: exit 0, portable schemaVersion 1 identity-resolution artifact.
4747
4747
  - Edited only Individual `LastUpdated` -> `MostFrequent` before effect checks.
4748
- - Deploy `-d <portable> --api-version auto --preview --json`: exit 0, `update`,
4748
+ - Deploy `--source-dir <portable> --api-version auto --preview --json`: exit 0, `update`,
4749
4749
  publication/generated-output-provisioning effects, 56 read dispatches, zero writes/jobs.
4750
4750
  - Deploy without `--allow-processing`: exit 1, blocked acknowledgement diagnostic,
4751
4751
  `not-attempted`, 56 read dispatches, zero writes/jobs.
@@ -4759,8 +4759,8 @@ matched the expected SOURCE alias before mutation. Target was untouched.
4759
4759
  instrumentation proved 200 reads (16 facade, 100 native GET, 84 Metadata
4760
4760
  readMetadata), zero mutation/job dispatches, not merely an unchanged label.
4761
4761
 
4762
- Retrieve used `-m identity-resolution:<owned-ir> -d <portable>`; deploy used only
4763
- `-d <portable>` because deploy source-dir and metadata selectors are mutually
4762
+ Retrieve used `-m identity-resolution:<owned-ir> --output-dir <portable>`; deploy used only
4763
+ `--source-dir <portable>` because deploy source-dir and metadata selectors are mutually
4764
4764
  exclusive. Two harness argument mistakes failed locally `INVALID_SELECTION`
4765
4765
  with no requests; not plugin bugs. No production code or tests changed.
4766
4766
 
@@ -7124,7 +7124,7 @@ before Metadata), with two successful standard Metadata retrieves. No list sweep
7124
7124
  public retrieve blocked UNKNOWN_SEGMENT_CONFIGURATION, demonstrating the exact
7125
7125
  missing classification fixed above.
7126
7126
  - Actual `node bin/run.js data360 retrieve -o mcnext-sdo -m segment:A1Probe5952383596d846c6
7127
- -d <owned OS-temp output> --json` succeeded exit0/status success, one retrieved
7127
+ --output-dir <owned OS-temp output> --json` succeeded exit0/status success, one retrieved
7128
7128
  XML/JSON pair, errors=[]; public command with installed Metadata CLI 2.151.7.
7129
7129
  Both independently acquired representations passed exact pair correlation.
7130
7130
  - Repeated same actual public command returned exit0/status success/unchanged for
@@ -8305,7 +8305,7 @@ not silently skipped. Unprovable inventory fails before any object writes.
8305
8305
  CLI `-o` is parsed as a string and then resolved with core `Org.create` only after
8306
8306
  selection/scope validation; core still owns aliases/configured target-org/auth.
8307
8307
  The existing per-object `retrieveDmo` projector and `writeDmoDocument` remain the
8308
- only acquisition/publication path. `-d` project root, `-x` differing-byte permission,
8308
+ only acquisition/publication path. `--output-dir` project root, `-x` differing-byte permission,
8309
8309
  canonical authored-only files, plugin-owned version provenance and standard outer
8310
8310
  CLI envelope are unchanged. Envelope selection is expanded exact names; diagnostics
8311
8311
  add optional per-object identity, static safe code/message. All selected objects
@@ -8647,7 +8647,7 @@ verification under the parent's per-finished-slice approval.
8647
8647
  ## Public CLI and exact result shape
8648
8648
 
8649
8649
  `sf data360 deploy --preview` now requires exactly one repeatable/non-greedy source
8650
- mode: `-d/--source-dir` explicit authored JSON file OR directory, repeated as needed;
8650
+ mode: `--source-dir` explicit authored JSON file OR directory, repeated as needed;
8651
8651
  OR `-m/--metadata dmo:ExactName__dlm`, repeated, resolving project artifacts from
8652
8652
  captured cwd. Existing resolver owns all strict authored-only JSON, no-link bounded
8653
8653
  path, duplicate/missing/malformed selection semantics. No bare type, implicit all,
@@ -8767,7 +8767,7 @@ Changed folder: sf-plugin-data360 yes, current 0.1.0, new version not assigned
8767
8767
  input-resolver-only fallback authorized by the parent to avoid oversized command +
8768
8768
  filesystem + envelope work. Next worker starts in src/commands/data360/deploy.ts,
8769
8769
  reads retrieve.ts envelope/core flags and preflight-dmo-deploy.ts. Add repeatable,
8770
- non-greedy `-d/--source-dir` string (file OR directory, NOT Flags.directory) OR
8770
+ non-greedy `--source-dir` string (file OR directory, NOT Flags.directory) OR
8771
8771
  `-m/--metadata`; call resolver with captured cwd. No implicit selection/bare types.
8772
8772
  Add --preview, core optionalOrg/API 65.0/default scope; preflight every validated
8773
8773
  item with preflightDmoDeploy(document, connection, apiVersion, dataSpace). Read-only
@@ -9348,7 +9348,7 @@ output after completion; no self-referential commit hash is embedded here.
9348
9348
  ## Next command slice (not implemented here)
9349
9349
 
9350
9350
  Wire `sf data360 retrieve -m dmo:Name__dlm` only, with actual CMS definitions:
9351
- repeatable/non-greedy `-m, --metadata`; `-d, --output-dir` directory exists:false,
9351
+ repeatable/non-greedy `-m, --metadata`; `--output-dir` directory exists:false,
9352
9352
  project-root default cwd; `-x, --overwrite` boolean default false. Add core default
9353
9353
  org/`-o` override, explicit API 65.0 and default data space. Read actual CMS base
9354
9354
  flag/envelope behavior first. Authenticate only after bounded selector validation;
package/lib/api.d.ts CHANGED
@@ -11,3 +11,10 @@ export { exitCodeOf } from './exit-code.js';
11
11
  export { runRetrieve } from './services/run-retrieve.js';
12
12
  export type { RetrieveOptions } from './services/run-retrieve.js';
13
13
  export type { RetrieveEnvelope } from './commands/data360/retrieve.js';
14
+ export { runDeploy } from './services/run-deploy.js';
15
+ export type { DeployOptions } from './services/run-deploy.js';
16
+ export type { DeployEnvelope } from './commands/data360/deploy.js';
17
+ export { runDelete } from './services/run-delete.js';
18
+ export type { DeleteOptions } from './services/run-delete.js';
19
+ export type { DeleteEnvelope } from './commands/data360/delete.js';
20
+ export { OptionError } from './services/run-options.js';
package/lib/api.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Library entry `sf-plugin-data/api`: functions other plugins call over a Connection they hold.
2
- // Nothing here prints or exits; refusals are thrown as typed errors with a `code`.
2
+ // Nothing here prints or exits; refusals are thrown as typed errors with a `code`, except the
3
+ // run* commands, which return the command's envelope (they throw only OptionError).
3
4
  export { SegmentError } from './artifacts/segment-document.js';
4
5
  export { listSegments, resolveSegment } from './services/segment-lookup.js';
5
6
  export { crossSpaceContext } from './services/cross-space-context.js';
@@ -8,3 +9,6 @@ export { listDataSpaces } from './services/list-data-spaces.js';
8
9
  export { CrossSpaceError } from './services/cross-dataspace-deploy.js';
9
10
  export { exitCodeOf } from './exit-code.js';
10
11
  export { runRetrieve } from './services/run-retrieve.js';
12
+ export { runDeploy } from './services/run-deploy.js';
13
+ export { runDelete } from './services/run-delete.js';
14
+ export { OptionError } from './services/run-options.js';