sf-plugin-data 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jörn Berkefeld
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,258 @@
1
- # Temporary Holding Version
1
+ # Data360 Salesforce CLI plugin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `sf-plugin-data` is an independently authored TypeScript/ESM
4
+ plugin for portable Data360 configuration. **Bounded explicit DMO retrieval is
5
+ implemented; strictly read-only deployment preview, bounded guarded creation and label updates are available.** Current retrieval capability is
6
+ owned by the common service (API 65.0/default, qualified generated recipe and semantics),
7
+ not a permanent DMO architecture. This is not yet a general migration tool or a
8
+ published release.
9
+
10
+ ```sh
11
+ sf data360 retrieve -o source --api-version 65.0 --data-space default -m dmo:Example__dlm -d ./project --json
12
+ sf data360 retrieve -o source -m dmo:Example__dlm -d ./project -x
13
+ ```
14
+
15
+ `-m/--metadata` is repeatable/non-greedy: exact `dmo:ApiName` selectors coalesce
16
+ and sort without an inventory request. `-m dmo` retrieves all DMOs in the selected
17
+ space using complete inventory; omitting selectors retrieves all implemented
18
+ families (currently DMO only). There is no `--all` flag. Mixed type/exact selections
19
+ coalesce. Empty inventory succeeds with no files. Unsupported objects are not
20
+ silently skipped: diagnostics identify each object and precise capability/error
21
+ code, successful file receipts are retained, and the aggregate exits nonzero. `-o/--target-org` overrides the configured default org. `-d/--output-dir`
22
+ is a project root, default cwd; output is `data360/default/dmo/<api-name>.json`.
23
+ `-x/--overwrite` permits differing file replacement; identical bytes are unchanged.
24
+ Selectors and API 65.0/default scope are validated before core org resolution or
25
+ resource reads; the common service remains the per-object capability boundary.
26
+ `--json` uses Salesforce CLI's normal outer result wrapper containing a versioned
27
+ `sf-data360-retrieve` envelope with status, metadata, diagnostics, provenance and
28
+ result. Both retrieve and deploy resolve `metadata.plugin.version` and
29
+ `provenance.pluginVersion` from this plugin's own package metadata, not the host
30
+ Salesforce CLI version. Blocked/failed work exits 1, success exits 0. Parser/auth flag failures use
31
+ core CLI diagnostics; runtime errors never include remote payloads. No org mutation.
32
+
33
+ A common offline `joinDmoConnectMetadataFields` helper now joins arbitrary
34
+ nonempty field counts and all 12 authored types with exact identity, primary,
35
+ dynamic and explicit qualifier semantics. Generated fields stay outside authored
36
+ fields; unqualified replay semantics remain blockers. The common object projector
37
+ now qualifies complete acquired inputs before the service/command publishes an
38
+ authored candidate; no fixed authored count or fixture-specific command rule applies.
39
+
40
+ Internal `preflightDmoDeploy` now performs read-only target-aware comparison for
41
+ one explicitly supplied authored DMO and API 65.0/default connection. Complete
42
+ inventory alone proves absence; existing targets must pass common full retrieval.
43
+ Field reordering alone is unchanged. Public preview opts into qualified object and
44
+ existing non-primary field label updates; unsupported differences and unknown target semantics fail closed. Its preview
45
+ contains static diagnostics, never requests, raw org IDs or remote payloads.
46
+ `sf data360 deploy --preview` now uses this service for every explicitly selected
47
+ local authored input. API 65.0/default scope remains service-owned. Execution
48
+ admission requires Other category with a nondynamic Text primary key; other
49
+ portable offline schemas are blocked before target reads because current readback
50
+ cannot qualify them. Authored counts and other field types remain unrestricted.
51
+ Internal `executeDmoCreate` now performs fresh preflight, a single guarded create only
52
+ on proven absence, and independent qualified readback. Existing equality is a no-op;
53
+ existing differences remain blocked. HTTP success alone is not verified creation;
54
+ ambiguous failures retain `mutation: unknown` and require target inspection, never
55
+ automatic retry or rollback. Public CLI creation delegates to this service through `executeDmoDeploy`;
56
+ qualification remains synthetic only, not broader deployment or live acceptance.
57
+ Metadata SOAP reads refuse same-origin and cross-origin redirects through an
58
+ operation-local transport guard; core still owns credentials and SOAP parsing,
59
+ and the caller connection/global transport defaults are unchanged.
60
+
61
+ Internal offline `buildDmoUpdateDelta` constructs a minimal candidate PATCH and a
62
+ nondestructive expected overlay, or returns blockers only. It preserves target-only
63
+ fields and omitted descriptions; no removal/tombstone syntax exists. This is not
64
+ itself mutation authorization. Public preview and `executeDmoDeploy` now admit only object and existing
65
+ non-primary field label changes within the qualified Other/default/API 65 scope.
66
+ The selection is fully admitted before writes, then freshly qualified per item;
67
+ independent readback must match the overlay and preserve full runtime state. New
68
+ fields, descriptions, primary-key labels and other unproven changes block atomically.
69
+ Results distinguish `confirmed-updated`, `not-attempted` and `unknown`; ambiguity
70
+ stops the public selection without retry or rollback.
71
+ API 65 PATCH
72
+ routing is documented. Retained synthetic PATCH evidence now qualifies the observed
73
+ existing-field display override and complete authored overlay offline; the common
74
+ projector reconciles Connect labels with Metadata field overrides while preserving
75
+ base/master observations. This is one recorded checkpoint, not general update or
76
+ new-field preservation acceptance. HTTP 200 can contain old state, so
77
+ execution independently GETs and qualifies readback.
78
+
79
+ An internal read-only `readDeployInputs` resolver now admits explicit authored JSON
80
+ files/directories or repeated exact `dmo:ApiName` project selectors. Identical paths
81
+ coalesce; different files claiming the same identity fail. No selection, bare types,
82
+ mixed modes, malformed JSON, duplicate JSON keys, runtime projections and linked
83
+ paths fail closed. Directory mode is bounded and strict: every descendant file must
84
+ be authored DMO JSON; unrelated files are not silently ignored. This input-only
85
+ resolver is wired to preview and execution; input admission alone never authorizes writes.
86
+
87
+ ## Package identity and command aliases
88
+
89
+ The user-selected current npm identity is **`sf-plugin-data`**, unscoped, at
90
+ version `0.1.0`. The repository and directory remain `sf-plugin-data360` under
91
+ GitHub owner `JoernBerkefeld`. This is a local product-naming change, not a claim
92
+ that npm will accept the name or an attempt to bypass npm restrictions. No lookup
93
+ or publication of the new name has been performed; restriction resolution and
94
+ release approval remain separate work.
95
+
96
+ Canonical commands remain `sf data360 retrieve` and `sf data360 deploy`.
97
+ `datacloud`, `d360` and `dc` are equivalent topic aliases for both operations,
98
+ including their flags and help. There are only two command implementations and
99
+ no `sf data` registrations. Aliases retain canonical `sf-data360-*` envelopes,
100
+ provenance command strings, `data360/...` layout and DMO schema/kind; only plugin
101
+ identity metadata changes. API 65.0/default limitations remain unchanged.
102
+
103
+ Historical evidence: the old unscoped `sf-plugin-data360` lookup returned `E404`
104
+ on 2026-10-26, but its later manual publication was rejected with npm `E403`
105
+ spam detection. Earlier scoped artifacts and the rejected unscoped artifacts
106
+ remain historical evidence only and must not be reused for the current name.
107
+ The existing `v0.1.0` tag at `a328066` still identifies `sf-plugin-data360`, not
108
+ this local rename. Earlier commit/push/tag approval does not authorize new
109
+ history changes or reuse of that tag. Any future release requires fresh explicit
110
+ approval, a tree-bound inspected artifact and separate npm restriction resolution.
111
+
112
+ ## Local development
113
+
114
+ Requires Node `^22.22.2 || ^24.15.0` and npm. Run from this independent repository:
115
+
116
+ ```sh
117
+ npm ci --no-workspaces
118
+ npm run lint
119
+ npm test
120
+ npm run smoke
121
+ npm run smoke:package
122
+ node bin/run.js data360 --help
123
+ node bin/run.js data360 retrieve --help
124
+ node bin/run.js data360 deploy --help
125
+ npm pack --dry-run --json
126
+ ```
127
+
128
+ The `bin/run.js` executable is a development/help runner, not a replacement `sf`
129
+ binary. The package's oclif metadata exposes `data360` and the `datacloud`, `d360`,
130
+ `dc` alias topics to Salesforce CLI. Each supports bare topic help and command help.
131
+ Do not install into a shared CLI profile for acceptance: other installed plugins
132
+ may own the same topic. Packaged CLI installation acceptance will use a dedicated
133
+ profile and exact unsigned-package allowlist in a later slice.
134
+
135
+ ### Read-only deploy preview
136
+
137
+ ```sh
138
+ sf data360 deploy --preview -o target -d ./project/data360/default/dmo --json
139
+ sf data360 deploy --preview -o target -d ./authored.json -d ./more-authored.json
140
+ sf data360 deploy --preview -o target -m dmo:Example__dlm -m dmo:Another__dlm --json
141
+ ```
142
+
143
+ Exactly one repeatable/non-greedy mode is required: `-d/--source-dir` selects explicit
144
+ files or directories; `-m/--metadata` selects exact project members from cwd.
145
+ No bare type, omitted selection or implicit deploy-all is allowed. All sources
146
+ resolve and validate before target inspection. Core `-o/--target-org` supports the
147
+ configured default org and explicit override; `--api-version` defaults to 65.0 and
148
+ `--data-space` to default, with capability checks delegated to preflight.
149
+
150
+ The normal core JSON wrapper contains `sf-data360-deploy` contract version 1.0.0,
151
+ status/metadata/diagnostics/provenance/result and one advisory `preview` item per
152
+ input. `create` means complete-inventory absence, not an executed create;
153
+ `update` means an admitted object/existing non-primary field label delta, not an executed update;
154
+ `unchanged` means qualified no-op. `blocked-changes` and `blocked` make aggregate
155
+ status blocked/exit 1; unexpected failures make status failed/exit 1. Mixed results
156
+ remain visible. Preview writes no local artifact/report and performs no mutations.
157
+ Without `--preview`, the same explicit selection performs guarded creation or bounded label updates. The whole
158
+ selection is preflighted before any executor call; a known blocker or preflight failure
159
+ prevents all writes. Each executor independently repeats fresh preflight; unchanged
160
+ items do not write. Execution is sequential and stops on the first blocked, failed or
161
+ unknown-mutation item. This is not atomic and provides no concurrency guarantee.
162
+ Execution items use `operation: execute`, `outcome: created|updated|unchanged|blocked|failed|not-attempted`,
163
+ `mutation: confirmed-created|confirmed-updated|not-attempted|unknown`, optional preflight and diagnostics.
164
+ Prior completed receipts remain visible; remaining items are explicitly not-attempted.
165
+ Only all-created/updated/unchanged results yield aggregate success/exit 0; blocked/failed
166
+ execution exits 1 even after prior mutations. Unknown mutation means creation or update may have
167
+ occurred: inspect target before another attempt. No retry or rollback. Additions, descriptions,
168
+ primary-key labels and other unproven changes (including mixed edits) block before writes.
169
+ Parser/auth flag errors retain core formatting. No public plan or saved-plan infrastructure.
170
+
171
+ ## Scope and safety
172
+
173
+ `projectCommonDmoConnectMetadata` now composes the shared offline field join and
174
+ object semantics in one common implementation used by actual retrieval. Recognized Other generated defaults retain a successful projection across
175
+ varied authored counts/types; unproven generated recipes, taxonomy, storage or
176
+ execution semantics remain explicit blockers. Explicit date references resolve
177
+ exactly to authored DateTime fields; missing Engagement event designation is a
178
+ specific blocker, never inferred. Complete nonempty relationships are retained
179
+ but unsupported. Incomplete status, blockers or absent candidates prevent publication;
180
+ no new live replay acceptance is claimed.
181
+
182
+ Seven planned families are tracked in [capabilities](docs/capabilities.md).
183
+ An internal read-only Salesforce-core transport now accepts an explicit API
184
+ version and only same-origin `/services/data/v<version>/ssot/` requests. It rejects
185
+ redirects and emits payload-free structured errors. Explicit DMO retrieval is now wired to the CLI;
186
+ no resource-family support is implied. Internal DMO list pagination now uses the
187
+ official offset contract, rejects malformed/overlapping pages and unexpected next
188
+ links, and fails closed at the documented offset ceiling rather than returning a
189
+ partial inventory. It does not provide a consistent snapshot during concurrent
190
+ org changes. An internal portable DMO validator/serializer now covers a narrow,
191
+ offline custom schema with all 12 nested input field types, dynamic lookup and
192
+ field category, strict unknown-field rejection and ordered-field preservation.
193
+ Raw projection produces an explicitly incomplete diagnostic candidate, retaining
194
+ qualifiers, semantic metadata and generated fields in separate configuration.
195
+ A separate internal relationship helper now acquires incoming/outgoing raw metadata
196
+ in an explicit data space, requiring total-size consistency and bounded offset
197
+ completion. API 65.0 live inspection confirmed HTTP 204 for an empty initial list,
198
+ optional count metadata, and sourceObject/targetObject endpoint records. Unknown envelopes block; raw entry fields are preserved. It is not yet
199
+ bound to field projection: candidates still carry RELATIONSHIPS_NOT_ACQUIRED and
200
+ must never be exported alone from that incomplete helper. Qualified
201
+ relationship replay and broader generated-field replay remain unimplemented;
202
+ qualified authored filesystem publication is available below. A second offline helper joins exact Connect/Metadata identities for
203
+ one proven relationship-free Other shape, binds qualifiers by explicit metadata
204
+ reference, and uses authoritative primary/dynamic flags. It retains full readback
205
+ expectations and now verifies the autonomous create identity for that exact local
206
+ profile: remove one terminal case-sensitive `__dlm` from a validated non-namespaced
207
+ custom name, preserving case and internal single underscores. It returns an offline
208
+ `projected` result with no identity blocker, not a deployable artifact or request.
209
+ A pure internal Other create-request mapper now rechecks the complete joined
210
+ projection and explicitly binds only evidenced source/target `default` space.
211
+ It preserves authored `__c` field names and excludes generated fields, org IDs
212
+ and read-only metadata. It performs no transport. An internal read-only
213
+ `retrieveDmo` service now acquires detail, Metadata CustomObject and complete
214
+ relationships using an existing Salesforce core connection, explicitly at API
215
+ 65.0/default only. It validates both projection and mapper, returning the full
216
+ projection/expectations rather than a detached candidate. Missing/ambiguous
217
+ Metadata or incomplete relationships fail without partial results. The retrieve
218
+ command delegates to this service and passes only its candidate to the writer. The approved Git artifact contains only
219
+ `schemaVersion`, `kind`, `identity` and `spec`; runtime source expectations remain
220
+ internal. A separate `buildOtherDmoCreateRequestFromDocument` mapper accepts this
221
+ standalone authored JSON with explicit default target binding, validates it and
222
+ maps only Other with one Text primary and one DateTime nonprimary field, both
223
+ without dynamic lookup. It preserves exact names, labels, field order and optional
224
+ object description; unsupported semantics and runtime keys reject. This offline
225
+ mapping is not deploy acceptance: deployment must separately validate the authored
226
+ file and later verify target readback. Profile and Engagement remain
227
+ pending; no writable Metadata projection is provided. Public creation uses the guarded common executor, not this narrow mapper alone. See the exact subset and evidence in the artifact document.
228
+ The separate common `buildDmoCreateRequestFromDocument` offline mapper accepts
229
+ all 12 documented field types, Profile/Other/Engagement, any nonempty authored
230
+ field count, boolean dynamic lookup, optional field category/description and
231
+ explicit exact DateTime event/record-modified references. It constructs a fresh
232
+ allowlisted request from authored JSON; source and explicit target remain default.
233
+ Actual retrieval now uses the common projector and mapper; unknown or incomplete
234
+ semantic variants return specific blockers and no file. Profile/Engagement generated
235
+ replay remains unqualified, not a separate category implementation. No general
236
+ export/deployment or new live API acceptance is claimed.
237
+
238
+ An internal `writeDmoDocument(candidate, projectRoot, overwrite)` validates
239
+ standalone DMO/default authored JSON independently through the common mapper, serializes canonically and
240
+ writes `data360/default/dmo/<api-name>.json` beneath the project root. Identical
241
+ bytes are unchanged; differing regular files require overwrite. Linked ancestors,
242
+ linked destinations and directory/file collisions reject. Complete flushed staging
243
+ uses OS temp and atomic rename/exclusive hard-link publication; cross-volume
244
+ publication fails closed, with no copy fallback. There is a residual concurrent
245
+ filesystem replacement race between path validation and publication; this is not
246
+ a hostile-process filesystem sandbox. The command now delegates output here unchanged.
247
+ No org was contacted or changed by synthetic tests. Smoke tests retain isolated
248
+ state in newly allocated OS-temp roots; they never delete recursively. Windows
249
+ contributors on this workspace machine must use `F:/Temp` for TEMP, TMP (when set),
250
+ TMPDIR (when set), and actual Node `os.tmpdir()`. Verification rejects mismatches.
251
+ Linux CI uses its normal OS temp directory.
252
+
253
+ See [artifact format status](docs/artifact-format.md),
254
+ [Git workflow](docs/git-workflow.md), and [handover](docs/handover.md).
255
+ Release notes belong in GitHub Releases; this npm package has no changelog file.
256
+ The release workflow is prepared but requires a future approved remote, npm
257
+ ownership/trusted-publisher configuration and release verification. No publication
258
+ or remote creation is authorized by this bootstrap.
package/bin/run.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { execute } from '@oclif/core';
3
+
4
+ await execute({ dir: import.meta.url });