sf-plugin-data 0.4.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.
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
 
@@ -604,6 +605,24 @@ a page under [docs/errors](docs/errors/README.md).
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
 
@@ -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';
@@ -20,6 +20,7 @@ import { createNativeDmoDeleteClient } from '../../transport/dmo-native-rest.js'
20
20
  import type { BoundSsot } from '../../transport/bound-ssot.js';
21
21
  import { deleteNativeDmo, previewDeleteNativeDmo } from '../../services/native-dmo.js';
22
22
  import { SfCommand } from '@salesforce/sf-plugins-core';
23
+ import type { Interfaces } from '@oclif/core';
23
24
  import { Connection } from '@salesforce/core';
24
25
  import { createDloClient } from '../../transport/dlo-rest.js';
25
26
  import { createNativeDloDeleteClient } from '../../transport/dlo-native-rest.js';
@@ -158,19 +159,19 @@ export type DeleteEnvelope = {
158
159
  export default class Delete extends SfCommand<DeleteEnvelope> {
159
160
  static readonly aliases: string[];
160
161
  static readonly summary = "Delete exact Data360 Transforms, Segments, IR owners, streams, DLOs, DMOs, single custom DMO fields or mappings.";
161
- static readonly description = "One delete can carry any mix of families, each named exactly with -m. It runs them in reverse dependency order, one phase after the other: graphs, then identity resolution, calculated insights and Segments (a dependent before the component it needs, including a graph or CI/Segment on the unified DMO of a selected IR), then data transforms, then relationships, mappings, DMOs and DLOs, then data streams. A phase starts only after every item of the previous one settled; a blocked, failed or unconfirmed item stops the run, and an item Salesforce is still processing stops the later phases with DELETE_PHASE_NOT_SETTLED (status processing, exit 69, when nothing failed). A -m delete needs no confirmation flag: check the selection with --preview first. Before the first delete, the current definition of each selected transform, Segment, IR, CI and graph is read from the org by its name (read-only); one the org does not have reports unchanged. A transform name resolves to its target ID through the complete transform list: no match is unchanged, two or more matches (ignoring case) are refused with TRANSFORM_TARGET_NOT_RESOLVED. --changed-since <ref> selects the canonical plugin files deleted since the merge base with that reference (every family; changed files are ignored) and deletes their components in the same phase order. Identity and definition come from each file's base content; a path present again is not a delete, while a rename (also one split across commit, index and worktree), an unstaged deletion or a deleted file of no known family blocks before any org call (BLOCKED_GIT_LIFECYCLE). A --changed-since delete needs --confirm-delete (--preview runs without it; --confirm-delete is accepted only with --changed-since), takes no -m or --delete-dlo, and removes no local file. A deleted data transform is resolved by its name like a -m one; a relationship takes its source DMO from the base content; a stream file deleted together with its landing DLO file deletes the stream with its DLO. --preview runs every phase read-only and reports an item whose selected dependents an earlier phase deletes as planned-dependencies (DEPENDENCIES_PLANNED) without checking it further. A stream selected together with its landing DLO is deleted with --delete-dlo semantics and the DLO item reports removedWith the stream; the last mapping of a custom DMO selected together with that DMO is not sent on its own and reports removedWith the DMO; it reports deleted only once its own read answers 404 after the DMO deletion, otherwise deletion-unconfirmed (MAPPING_DELETION_UNCONFIRMED). data-transform:Name uses auto/API68 in the run data space (TRANSFORM_DATASPACE_MISMATCH for another). Preview is GET-only. A target of any owner or namespace is deleted with one native DELETE (Salesforce decides; a 4xx answer is reported as rejected); one whose status is PROCESSING is refused before it (TRANSFORM_DELETE_PROCESSING, in --preview too); settlement needs complete bounded inventory omission of both ID and name, otherwise the result is deletion-unconfirmed (never replay). No DLO, run or data cleanup; exhaustive external-consumer exclusion is not established. segment:Name uses auto/API68 in the run data space (the stored name, <prefix>_<Name> outside default; SEGMENT_DATASPACE_MISMATCH for another). Fresh source bindings and exact runtime/private identity are checked before one native DELETE. Only independent absence or a preserved DELETING/PROCESSING read acknowledges the result; HTTP204 alone is insufficient. No replay, Segment XML, shared-DMO deletion or physical-output cleanup guarantee. identity-resolution:ObjectApiName uses auto/API68 in the run data space (the stored name, <prefix>_<type>_<rulesetId> outside default; IDENTITY_RESOLUTION_DATASPACE_MISMATCH for another) and deletes a present owner that is not PUBLISHING or DELETING. A fresh target-local ID is resolved before one native68 DELETE; bounded exact ID/name absence confirms owner-definition deletion only. Exhaustive external-consumer exclusion and physical profile/output cleanup remain unverified. IR never cascades, runs processing, replays writes or falls back to another API. data-graph:Name uses auto/API68 in the run data space (graph names are unique in the org; DATA_GRAPH_DATASPACE_MISMATCH for a graph of another). Fresh identity, created date, definition, root and ready checks plus explicit empty native dependency/related-segment arrays are mandatory. A draft graph (never built, retrieved as-is) is deleted by name with the same scope and dependency checks. Exhaustive external-consumer exclusion remains unverified; no generated-resource cleanup, storage or credit guarantee. A Graph delete never cascades. calculated-insight:Name__cio uses --api-version auto (68.0) or 68.0 in the run data space (the GET must name it, CI_IDENTITY_CHANGED otherwise). The insight is read by name with the API 68 GET (absent is unchanged; it must answer with that name and data space), deleted with one DELETE in any status, schedule or SQL (Salesforce decides; a 4xx answer is reported as rejected), then read until it answers 404. CI never cascades; no compute, storage or credits guarantee. Exact data-stream:ApiName selects guarded IngestApi stream deletion at auto/API68 in the run data space (its DLO must belong to it). The linked DLO is preserved by default; --delete-dlo explicitly acknowledges deleting that exclusively linked DLO. Selected stream and linked DLO checks only, not unrelated-org preservation. Native routes default to API68; explicit numeric pins are preserved. Relationship deletion (relationship:SourceDmo__dlm:Name; a bare relationship:Name is refused with INVALID_SELECTION) runs first in its phase, before mappings, DMOs and DLOs. The relationships of the named source DMO are listed and the name is looked up ignoring letter case: no match is unchanged, two matches are refused (AMBIGUOUS_RELATIONSHIP_TARGET), and a match whose source object is another DMO is refused (RELATIONSHIP_TARGET_BINDING_MISMATCH). In a --changed-since delete the source DMO and binding come from the deleted file, and when its name is absent but the binding exists under another name the delete is refused with RELATIONSHIP_NAME_MISMATCH. Otherwise one DELETE is sent and its absence confirmed by listing again; a 4xx answer is reported as rejected. --preview only lists. A mapping:Name with a valid local data360/mapping/Name.mapping-meta.json file (with --changed-since, the deleted file's base content) is found in the org the way deploy finds it: by the file's source DLO and target DMO, whatever Salesforce named it (the org name is reported as targetApiName). No org mapping with that binding is unchanged; two or more are refused with AMBIGUOUS_MAPPING_TARGET before any write. Otherwise the exact name is read, and a mapping that reads absent (404) reports unchanged. Mapping deletion runs at native API 61 and up (default 68) and deletes the whole mapping with one Metadata API destructive deployment (ObjectSourceTargetMap), whatever pairs it holds, also onto a standard DMO (Salesforce refuses the last mapping onto a standard DMO copy in a data space other than default; a Failed destructive deployment is reported as rejected). Afterwards the mapping must read absent and the other mappings and the fields of the DMO must be unchanged. The last mapping of a custom DMO is refused before any write (MAPPING_LAST_MAPPING_DELETE_BLOCKED) because Salesforce does not delete it; delete the DMO instead, which removes its mapping. Qualification uses empty custom fixtures, not populated-data guarantees. --preview performs zero writes and reports the planned step. Any partial failure stops the batch; no retries or rollback. Whole-DMO deletion is sent for every DMO, a standard one (creationType Standard) and one read without a creationType included, and Salesforce decides: a 4xx answer is reported as rejected (for example, Salesforce refuses to delete a platform-generated DMO while the identity resolution or graph that owns it exists). Field-level delete: exactly one dmo:Name__dlm with one or more --field Name__c removes the named fields from that DMO. It is the one delete operation that changes mappings it was not given and writes project files. Reads first: every field must exist on the DMO. Any field but the primary key may be named, also the standard, system and generated fields of any DMO: Salesforce decides, and a refused destructive change is reported as rejected. This is the only command that removes such platform-owned fields; every mapping pair targeting a named field is collected, and a mapped field is refused only when the mapping list fails; one that no mapping lists a pair for has no pair to lose and is removed. Then one Metadata API destructive change for all fields, sent once and never retried; Salesforce drops the mapping pairs of the removed fields itself. Fresh reads right before it must still match the plan, and polled reads afterwards must show the fields absent, exactly the collected pairs gone and every other mapping, pair, DMO property and field unchanged; any other difference fails with DMO_FIELD_REMOVAL_SIDE_EFFECT. Nothing is rolled back. After success the existing data360/dmo and data360/mapping files under --output-dir (default: current directory) are overwritten with the current definitions; absent files are not created and no file is deleted. A failed file refresh keeps the confirmed org result and the run is partial (exit 68, LOCAL_REFRESH_FAILED). --field --preview writes nothing and reports pairs, fields and files. --field cannot be combined with another selector, --changed-since or --delete-dlo. Local files: after a confirmed deletion (deleted, or a DLO, DMO, Segment or IR Salesforce accepted and is still deleting) the component's own local file is removed by default, one regular file at a time at its canonical path and never a folder: data360/dlo, data360/dmo, data360/relationship, data360/data-stream, data360/dataTransforms, data360/identityResolution and data360/dataGraphs files, both files of a CI (data360/calculatedInsights/Name__cio.calculatedInsight-meta.json and .calculatedInsight-meta.sql) and the Segment files (data360/segments/Name.segment.json and every Name.segment.*.sql beside it) under the current directory (with --delete-dlo also the linked DLO's file), and the mapping file of that name or the one whose binding matches. Links, hard-linked files and paths outside those folders are refused. Nothing is removed on --preview, which lists the files instead, nor for unchanged, blocked, failed, rejected or unconfirmed deletions. --keep-local-files keeps them. A failed removal keeps the confirmed org result and the run is partial (exit 68) with LOCAL_FILE_REMOVAL_FAILED when a deletion is confirmed, otherwise processing (exit 69).";
162
+ static readonly description = "One delete can carry any mix of families, each named exactly with -m. It runs them in reverse dependency order, one phase after the other: graphs, then identity resolution, calculated insights and Segments (a dependent before the component it needs, including a graph or CI/Segment on the unified DMO of a selected IR), then data transforms, then relationships, mappings, DMOs and DLOs, then data streams. A phase starts only after every item of the previous one settled; a blocked, failed or unconfirmed item stops the run, and an item Salesforce is still processing stops the later phases with DELETE_PHASE_NOT_SETTLED (status processing, exit 69, when nothing failed). Without --preview the delete first runs the same selection read-only, lists every component it would delete and asks once (y/yes deletes; no, no answer within 30 seconds or a failed question sends nothing and reports DELETE_CANCELLED with exit 0); nothing to delete asks nothing. Without a terminal, or with --json, a delete needs --no-prompt (-r) and is otherwise refused before any org call with CONFIRMATION_REQUIRED. --preview never asks. Before the first delete, the current definition of each selected transform, Segment, IR, CI and graph is read from the org by its name (read-only); one the org does not have reports unchanged. A transform name resolves to its target ID through the complete transform list: no match is unchanged, two or more matches (ignoring case) are refused with TRANSFORM_TARGET_NOT_RESOLVED. --changed-since <ref> selects the canonical plugin files deleted since the merge base with that reference (every family; changed files are ignored) and deletes their components in the same phase order. Identity and definition come from each file's base content; a path present again is not a delete, while a rename (also one split across commit, index and worktree), an unstaged deletion or a deleted file of no known family blocks before any org call (BLOCKED_GIT_LIFECYCLE). A --changed-since delete takes no -m or --delete-dlo, and removes no local file. A deleted data transform is resolved by its name like a -m one; a relationship takes its source DMO from the base content; a stream file deleted together with its landing DLO file deletes the stream with its DLO. --preview runs every phase read-only and reports an item whose selected dependents an earlier phase deletes as planned-dependencies (DEPENDENCIES_PLANNED) without checking it further. A stream selected together with its landing DLO is deleted with --delete-dlo semantics and the DLO item reports removedWith the stream; the last mapping of a custom DMO selected together with that DMO is not sent on its own and reports removedWith the DMO; it reports deleted only once its own read answers 404 after the DMO deletion, otherwise deletion-unconfirmed (MAPPING_DELETION_UNCONFIRMED). data-transform:Name uses auto/API68 in the run data space (TRANSFORM_DATASPACE_MISMATCH for another). Preview is GET-only. A target of any owner or namespace is deleted with one native DELETE (Salesforce decides; a 4xx answer is reported as rejected); one whose status is PROCESSING is refused before it (TRANSFORM_DELETE_PROCESSING, in --preview too); settlement needs complete bounded inventory omission of both ID and name, otherwise the result is deletion-unconfirmed (never replay). No DLO, run or data cleanup; exhaustive external-consumer exclusion is not established. segment:Name uses auto/API68 in the run data space (the stored name, <prefix>_<Name> outside default; SEGMENT_DATASPACE_MISMATCH for another). Fresh source bindings and exact runtime/private identity are checked before one native DELETE. Only independent absence or a preserved DELETING/PROCESSING read acknowledges the result; HTTP204 alone is insufficient. No replay, Segment XML, shared-DMO deletion or physical-output cleanup guarantee. identity-resolution:ObjectApiName uses auto/API68 in the run data space (the stored name, <prefix>_<type>_<rulesetId> outside default; IDENTITY_RESOLUTION_DATASPACE_MISMATCH for another) and deletes a present owner that is not PUBLISHING or DELETING. A fresh target-local ID is resolved before one native68 DELETE; bounded exact ID/name absence confirms owner-definition deletion only. Exhaustive external-consumer exclusion and physical profile/output cleanup remain unverified. IR never cascades, runs processing, replays writes or falls back to another API. data-graph:Name uses auto/API68 in the run data space (graph names are unique in the org; DATA_GRAPH_DATASPACE_MISMATCH for a graph of another). Fresh identity, created date, definition, root and ready checks plus explicit empty native dependency/related-segment arrays are mandatory. A draft graph (never built, retrieved as-is) is deleted by name with the same scope and dependency checks. Exhaustive external-consumer exclusion remains unverified; no generated-resource cleanup, storage or credit guarantee. A Graph delete never cascades. calculated-insight:Name__cio uses --api-version auto (68.0) or 68.0 in the run data space (the GET must name it, CI_IDENTITY_CHANGED otherwise). The insight is read by name with the API 68 GET (absent is unchanged; it must answer with that name and data space), deleted with one DELETE in any status, schedule or SQL (Salesforce decides; a 4xx answer is reported as rejected), then read until it answers 404. CI never cascades; no compute, storage or credits guarantee. Exact data-stream:ApiName selects guarded IngestApi stream deletion at auto/API68 in the run data space (its DLO must belong to it). The linked DLO is preserved by default; --delete-dlo explicitly acknowledges deleting that exclusively linked DLO. Selected stream and linked DLO checks only, not unrelated-org preservation. Native routes default to API68; explicit numeric pins are preserved. Relationship deletion (relationship:SourceDmo__dlm:Name; a bare relationship:Name is refused with INVALID_SELECTION) runs first in its phase, before mappings, DMOs and DLOs. The relationships of the named source DMO are listed and the name is looked up ignoring letter case: no match is unchanged, two matches are refused (AMBIGUOUS_RELATIONSHIP_TARGET), and a match whose source object is another DMO is refused (RELATIONSHIP_TARGET_BINDING_MISMATCH). In a --changed-since delete the source DMO and binding come from the deleted file, and when its name is absent but the binding exists under another name the delete is refused with RELATIONSHIP_NAME_MISMATCH. Otherwise one DELETE is sent and its absence confirmed by listing again; a 4xx answer is reported as rejected. --preview only lists. A mapping:Name with a valid local data360/mapping/Name.mapping-meta.json file (with --changed-since, the deleted file's base content) is found in the org the way deploy finds it: by the file's source DLO and target DMO, whatever Salesforce named it (the org name is reported as targetApiName). No org mapping with that binding is unchanged; two or more are refused with AMBIGUOUS_MAPPING_TARGET before any write. Otherwise the exact name is read, and a mapping that reads absent (404) reports unchanged. Mapping deletion runs at native API 61 and up (default 68) and deletes the whole mapping with one Metadata API destructive deployment (ObjectSourceTargetMap), whatever pairs it holds, also onto a standard DMO (Salesforce refuses the last mapping onto a standard DMO copy in a data space other than default; a Failed destructive deployment is reported as rejected). Afterwards the mapping must read absent and the other mappings and the fields of the DMO must be unchanged. The last mapping of a custom DMO is refused before any write (MAPPING_LAST_MAPPING_DELETE_BLOCKED) because Salesforce does not delete it; delete the DMO instead, which removes its mapping. Qualification uses empty custom fixtures, not populated-data guarantees. --preview performs zero writes and reports the planned step. Any partial failure stops the batch; no retries or rollback. Whole-DMO deletion is sent for every DMO, a standard one (creationType Standard) and one read without a creationType included, and Salesforce decides: a 4xx answer is reported as rejected (for example, Salesforce refuses to delete a platform-generated DMO while the identity resolution or graph that owns it exists). Field-level delete: exactly one dmo:Name__dlm with one or more --field Name__c removes the named fields from that DMO. It is the one delete operation that changes mappings it was not given and writes project files. Reads first: every field must exist on the DMO. Any field but the primary key may be named, also the standard, system and generated fields of any DMO: Salesforce decides, and a refused destructive change is reported as rejected. This is the only command that removes such platform-owned fields; every mapping pair targeting a named field is collected, and a mapped field is refused only when the mapping list fails; one that no mapping lists a pair for has no pair to lose and is removed. Then one Metadata API destructive change for all fields, sent once and never retried; Salesforce drops the mapping pairs of the removed fields itself. Fresh reads right before it must still match the plan, and polled reads afterwards must show the fields absent, exactly the collected pairs gone and every other mapping, pair, DMO property and field unchanged; any other difference fails with DMO_FIELD_REMOVAL_SIDE_EFFECT. Nothing is rolled back. After success the existing data360/dmo and data360/mapping files under --output-dir (default: current directory) are overwritten with the current definitions; absent files are not created and no file is deleted. A failed file refresh keeps the confirmed org result and the run is partial (exit 68, LOCAL_REFRESH_FAILED). --field --preview writes nothing and reports pairs, fields and files. --field cannot be combined with another selector, --changed-since or --delete-dlo. Local files: after a confirmed deletion (deleted, or a DLO, DMO, Segment or IR Salesforce accepted and is still deleting) the component's own local file is removed by default, one regular file at a time at its canonical path and never a folder: data360/dlo, data360/dmo, data360/relationship, data360/data-stream, data360/dataTransforms, data360/identityResolution and data360/dataGraphs files, both files of a CI (data360/calculatedInsights/Name__cio.calculatedInsight-meta.json and .calculatedInsight-meta.sql) and the Segment files (data360/segments/Name.segment.json and every Name.segment.*.sql beside it) under the current directory (with --delete-dlo also the linked DLO's file), and the mapping file of that name or the one whose binding matches. Links, hard-linked files and paths outside those folders are refused. Nothing is removed on --preview, which lists the files instead, nor for unchanged, blocked, failed, rejected or unconfirmed deletions. --keep-local-files keeps them. A failed removal keeps the confirmed org result and the run is partial (exit 68) with LOCAL_FILE_REMOVAL_FAILED when a deletion is confirmed, otherwise processing (exit 69).";
162
163
  static readonly flags: {
163
- 'target-org': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
164
- metadata: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
165
- 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
166
- dataspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
167
- preview: import("@oclif/core/interfaces").BooleanFlag<boolean>;
168
- 'changed-since': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
169
- 'confirm-delete': import("@oclif/core/interfaces").BooleanFlag<boolean>;
170
- 'delete-dlo': import("@oclif/core/interfaces").BooleanFlag<boolean>;
171
- field: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
172
- 'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
173
- 'keep-local-files': import("@oclif/core/interfaces").BooleanFlag<boolean>;
164
+ 'target-org': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
165
+ metadata: Interfaces.OptionFlag<string[] | undefined, Interfaces.CustomOptions>;
166
+ 'api-version': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
167
+ dataspace: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
168
+ preview: Interfaces.BooleanFlag<boolean>;
169
+ 'changed-since': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
170
+ 'no-prompt': Interfaces.BooleanFlag<boolean>;
171
+ 'delete-dlo': Interfaces.BooleanFlag<boolean>;
172
+ field: Interfaces.OptionFlag<string[] | undefined, Interfaces.CustomOptions>;
173
+ 'output-dir': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
174
+ 'keep-local-files': Interfaces.BooleanFlag<boolean>;
174
175
  };
175
176
  protected deleteDataTransform: typeof deleteDataTransform;
176
177
  protected createDataTransformClient: typeof createDataTransformClient;
@@ -194,6 +195,7 @@ export default class Delete extends SfCommand<DeleteEnvelope> {
194
195
  protected readStreamLinkedDlo: typeof readStreamLinkedDlo;
195
196
  protected preflightDeleteDataStream: typeof preflightDeleteDataStream;
196
197
  protected executeDeleteDataStream: typeof executeDeleteDataStream;
198
+ protected streamConnection: (target: string, version: string) => Promise<Connection>;
197
199
  protected createDataStreamClients: (target: string, version: string) => Promise<Parameters<typeof executeDeleteDataStream>[1]>;
198
200
  protected createMappingClient: typeof createMappingClient;
199
201
  protected createMappingSender: (target: string, version: string) => BoundSsot;
@@ -276,5 +278,48 @@ export default class Delete extends SfCommand<DeleteEnvelope> {
276
278
  * @returns {Promise<DeleteEnvelope>} Payload-free deletion evidence.
277
279
  */
278
280
  run(): Promise<DeleteEnvelope>;
281
+ /**
282
+ * Whether a person can answer the confirmation question: stdin and stdout are terminals.
283
+ * @returns {boolean} True in an interactive terminal.
284
+ */
285
+ protected interactiveTerminal(): boolean;
286
+ /**
287
+ * Report data graph progress while the delete waits (for example a retried graph DELETE).
288
+ * oclif logToStderr suppresses output in JSON mode; progress must remain visible.
289
+ * @param {string} message One progress line.
290
+ */
291
+ protected graphProgress(message: string): void;
292
+ /**
293
+ * The project root: where data360/ lives (local files removed or refreshed, relative
294
+ * --output-dir) and the Git selection runs. The CLI uses the current directory.
295
+ * @returns {string} Absolute project root.
296
+ */
297
+ protected projectDirectory(): string;
298
+ /**
299
+ * Ask once whether to delete; no answer within 30 seconds is no.
300
+ * @param {string} message Question and the components it deletes.
301
+ * @returns {Promise<boolean>} True only for an explicit yes.
302
+ */
303
+ protected confirmDeletion(message: string): Promise<boolean>;
304
+ /**
305
+ * The envelope of a delete whose silent preview did not succeed: its refusal, nothing sent and
306
+ * nothing asked.
307
+ * @param {DeleteEnvelope} preview Envelope of the silent preview (blocked, failed or other).
308
+ * @returns {DeleteEnvelope} The preview's status, items and diagnostics.
309
+ */
310
+ private refusedPreview;
311
+ /**
312
+ * The envelope of a delete the user did not confirm: the preview items, nothing sent.
313
+ * @param {DeleteEnvelope} preview Envelope of the silent preview.
314
+ * @returns {DeleteEnvelope} Cancelled envelope, status success.
315
+ */
316
+ private cancelled;
317
+ /**
318
+ * Run the delete, or its preview, and complete the envelope.
319
+ * @param {DeleteFlags} flags Parsed flags.
320
+ * @param {boolean} quiet No output and no exit code: the preview before the question.
321
+ * @returns {Promise<DeleteEnvelope>} Payload-free deletion evidence.
322
+ */
323
+ private execute;
279
324
  }
280
325
  export {};