sf-plugin-data 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +589 -2
- package/bin/run.js +4 -0
- package/docs/artifact-format.md +527 -0
- package/docs/capabilities.md +1208 -0
- package/docs/git-workflow.md +160 -0
- package/docs/handover.md +10446 -0
- package/lib/api.d.ts +7 -0
- package/lib/api.js +7 -0
- package/lib/artifacts/code-fields.d.ts +49 -0
- package/lib/artifacts/code-fields.js +142 -0
- package/lib/artifacts/data-graph-document.d.ts +29 -0
- package/lib/artifacts/data-graph-document.js +52 -0
- package/lib/artifacts/data-space-field.d.ts +65 -0
- package/lib/artifacts/data-space-field.js +98 -0
- package/lib/artifacts/data-stream-document.d.ts +264 -0
- package/lib/artifacts/data-stream-document.js +680 -0
- package/lib/artifacts/data-transform-document.d.ts +152 -0
- package/lib/artifacts/data-transform-document.js +560 -0
- package/lib/artifacts/dependency-selection.d.ts +51 -0
- package/lib/artifacts/dependency-selection.js +154 -0
- package/lib/artifacts/dlo-document.d.ts +93 -0
- package/lib/artifacts/dlo-document.js +253 -0
- package/lib/artifacts/enum-case.d.ts +39 -0
- package/lib/artifacts/enum-case.js +67 -0
- package/lib/artifacts/git-deploy-selection.d.ts +68 -0
- package/lib/artifacts/git-deploy-selection.js +474 -0
- package/lib/artifacts/identity-resolution-document.d.ts +133 -0
- package/lib/artifacts/identity-resolution-document.js +625 -0
- package/lib/artifacts/mapping-document.d.ts +1 -0
- package/lib/artifacts/mapping-document.js +1 -0
- package/lib/artifacts/native-calculated-insight-document.d.ts +142 -0
- package/lib/artifacts/native-calculated-insight-document.js +321 -0
- package/lib/artifacts/native-data-graph-document.d.ts +124 -0
- package/lib/artifacts/native-data-graph-document.js +780 -0
- package/lib/artifacts/native-dmo-document.d.ts +151 -0
- package/lib/artifacts/native-dmo-document.js +313 -0
- package/lib/artifacts/native-mapping-document.d.ts +67 -0
- package/lib/artifacts/native-mapping-document.js +187 -0
- package/lib/artifacts/native-relationship-document.d.ts +76 -0
- package/lib/artifacts/native-relationship-document.js +232 -0
- package/lib/artifacts/path-selector.d.ts +55 -0
- package/lib/artifacts/path-selector.js +167 -0
- package/lib/artifacts/read-deploy-input.d.ts +239 -0
- package/lib/artifacts/read-deploy-input.js +1359 -0
- package/lib/artifacts/segment-document.d.ts +183 -0
- package/lib/artifacts/segment-document.js +570 -0
- package/lib/artifacts/verbatim-document.d.ts +203 -0
- package/lib/artifacts/verbatim-document.js +339 -0
- package/lib/artifacts/write-data-graph.d.ts +17 -0
- package/lib/artifacts/write-data-graph.js +162 -0
- package/lib/artifacts/write-data-stream.d.ts +11 -0
- package/lib/artifacts/write-data-stream.js +175 -0
- package/lib/artifacts/write-data-transform.d.ts +11 -0
- package/lib/artifacts/write-data-transform.js +180 -0
- package/lib/artifacts/write-dlo.d.ts +11 -0
- package/lib/artifacts/write-dlo.js +158 -0
- package/lib/artifacts/write-identity-resolution.d.ts +18 -0
- package/lib/artifacts/write-identity-resolution.js +165 -0
- package/lib/artifacts/write-mapping-definition.d.ts +17 -0
- package/lib/artifacts/write-mapping-definition.js +127 -0
- package/lib/artifacts/write-member-export.d.ts +88 -0
- package/lib/artifacts/write-member-export.js +199 -0
- package/lib/artifacts/write-native-calculated-insight.d.ts +21 -0
- package/lib/artifacts/write-native-calculated-insight.js +176 -0
- package/lib/artifacts/write-native-dmo.d.ts +11 -0
- package/lib/artifacts/write-native-dmo.js +158 -0
- package/lib/artifacts/write-native-mapping.d.ts +11 -0
- package/lib/artifacts/write-native-mapping.js +157 -0
- package/lib/artifacts/write-native-relationship.d.ts +11 -0
- package/lib/artifacts/write-native-relationship.js +157 -0
- package/lib/artifacts/write-segment.d.ts +26 -0
- package/lib/artifacts/write-segment.js +212 -0
- package/lib/commands/data360/delete.d.ts +280 -0
- package/lib/commands/data360/delete.js +2297 -0
- package/lib/commands/data360/deploy.d.ts +303 -0
- package/lib/commands/data360/deploy.js +2400 -0
- package/lib/commands/data360/publish.d.ts +93 -0
- package/lib/commands/data360/publish.js +292 -0
- package/lib/commands/data360/retrieve.d.ts +322 -0
- package/lib/commands/data360/retrieve.js +1963 -0
- package/lib/commands/data360/segment/members/export.d.ts +101 -0
- package/lib/commands/data360/segment/members/export.js +318 -0
- package/lib/errors/codes/calculated-insight.d.ts +2 -0
- package/lib/errors/codes/calculated-insight.js +25 -0
- package/lib/errors/codes/data-graph.d.ts +2 -0
- package/lib/errors/codes/data-graph.js +22 -0
- package/lib/errors/codes/data-stream.d.ts +2 -0
- package/lib/errors/codes/data-stream.js +70 -0
- package/lib/errors/codes/data-transform.d.ts +2 -0
- package/lib/errors/codes/data-transform.js +35 -0
- package/lib/errors/codes/dependency.d.ts +2 -0
- package/lib/errors/codes/dependency.js +11 -0
- package/lib/errors/codes/dlo.d.ts +2 -0
- package/lib/errors/codes/dlo.js +31 -0
- package/lib/errors/codes/dmo.d.ts +2 -0
- package/lib/errors/codes/dmo.js +28 -0
- package/lib/errors/codes/general.d.ts +2 -0
- package/lib/errors/codes/general.js +57 -0
- package/lib/errors/codes/identity-resolution.d.ts +2 -0
- package/lib/errors/codes/identity-resolution.js +24 -0
- package/lib/errors/codes/mapping.d.ts +2 -0
- package/lib/errors/codes/mapping.js +42 -0
- package/lib/errors/codes/relationship.d.ts +2 -0
- package/lib/errors/codes/relationship.js +21 -0
- package/lib/errors/codes/segment.d.ts +2 -0
- package/lib/errors/codes/segment.js +49 -0
- package/lib/errors/registry.d.ts +60 -0
- package/lib/errors/registry.js +123 -0
- package/lib/plugin.d.ts +5 -0
- package/lib/plugin.js +5 -0
- package/lib/services/acquire-retrieve-selection.d.ts +43 -0
- package/lib/services/acquire-retrieve-selection.js +145 -0
- package/lib/services/bind-identity-resolution-dependencies.d.ts +53 -0
- package/lib/services/bind-identity-resolution-dependencies.js +238 -0
- package/lib/services/bind-segment-dependencies.d.ts +49 -0
- package/lib/services/bind-segment-dependencies.js +115 -0
- package/lib/services/bounded-reads.d.ts +17 -0
- package/lib/services/bounded-reads.js +42 -0
- package/lib/services/calculated-insight-sql-checks.d.ts +33 -0
- package/lib/services/calculated-insight-sql-checks.js +193 -0
- package/lib/services/command-dlo.d.ts +48 -0
- package/lib/services/command-dlo.js +103 -0
- package/lib/services/command-native-data-graph.d.ts +54 -0
- package/lib/services/command-native-data-graph.js +485 -0
- package/lib/services/command-native-data-stream.d.ts +104 -0
- package/lib/services/command-native-data-stream.js +257 -0
- package/lib/services/command-native-dmo.d.ts +124 -0
- package/lib/services/command-native-dmo.js +338 -0
- package/lib/services/command-native-mapping.d.ts +65 -0
- package/lib/services/command-native-mapping.js +129 -0
- package/lib/services/command-native-relationship.d.ts +46 -0
- package/lib/services/command-native-relationship.js +103 -0
- package/lib/services/cross-dataspace-deploy.d.ts +111 -0
- package/lib/services/cross-dataspace-deploy.js +493 -0
- package/lib/services/cross-dataspace-rename.d.ts +74 -0
- package/lib/services/cross-dataspace-rename.js +1314 -0
- package/lib/services/cross-dataspace-sql.d.ts +109 -0
- package/lib/services/cross-dataspace-sql.js +1301 -0
- package/lib/services/cross-space-context.d.ts +23 -0
- package/lib/services/cross-space-context.js +36 -0
- package/lib/services/crud-plan.d.ts +137 -0
- package/lib/services/crud-plan.js +408 -0
- package/lib/services/data-space-check.d.ts +89 -0
- package/lib/services/data-space-check.js +162 -0
- package/lib/services/data-space-prefix.d.ts +77 -0
- package/lib/services/data-space-prefix.js +127 -0
- package/lib/services/data-transform-space.d.ts +31 -0
- package/lib/services/data-transform-space.js +79 -0
- package/lib/services/delete-calculated-insight.d.ts +44 -0
- package/lib/services/delete-calculated-insight.js +101 -0
- package/lib/services/delete-data-transform.d.ts +52 -0
- package/lib/services/delete-data-transform.js +222 -0
- package/lib/services/delete-dmo-field.d.ts +211 -0
- package/lib/services/delete-dmo-field.js +472 -0
- package/lib/services/delete-identity-resolution.d.ts +43 -0
- package/lib/services/delete-identity-resolution.js +295 -0
- package/lib/services/delete-segment.d.ts +42 -0
- package/lib/services/delete-segment.js +248 -0
- package/lib/services/deploy-result.d.ts +54 -0
- package/lib/services/deploy-result.js +60 -0
- package/lib/services/escaped-copy.d.ts +23 -0
- package/lib/services/escaped-copy.js +88 -0
- package/lib/services/execute-calculated-insight-deploy.d.ts +42 -0
- package/lib/services/execute-calculated-insight-deploy.js +96 -0
- package/lib/services/execute-data-transform-deploy.d.ts +56 -0
- package/lib/services/execute-data-transform-deploy.js +168 -0
- package/lib/services/execute-native-identity-resolution-deploy.d.ts +48 -0
- package/lib/services/execute-native-identity-resolution-deploy.js +360 -0
- package/lib/services/execute-segment-deploy.d.ts +45 -0
- package/lib/services/execute-segment-deploy.js +393 -0
- package/lib/services/local-file-removal.d.ts +36 -0
- package/lib/services/local-file-removal.js +103 -0
- package/lib/services/native-calculated-insight.d.ts +87 -0
- package/lib/services/native-calculated-insight.js +164 -0
- package/lib/services/native-crm-data-stream.d.ts +91 -0
- package/lib/services/native-crm-data-stream.js +272 -0
- package/lib/services/native-data-graph-context.d.ts +12 -0
- package/lib/services/native-data-graph-context.js +139 -0
- package/lib/services/native-data-graph-crd.d.ts +261 -0
- package/lib/services/native-data-graph-crd.js +866 -0
- package/lib/services/native-data-stream.d.ts +329 -0
- package/lib/services/native-data-stream.js +1830 -0
- package/lib/services/native-dlo.d.ts +163 -0
- package/lib/services/native-dlo.js +402 -0
- package/lib/services/native-dmo.d.ts +191 -0
- package/lib/services/native-dmo.js +614 -0
- package/lib/services/native-mapping.d.ts +255 -0
- package/lib/services/native-mapping.js +1226 -0
- package/lib/services/native-relationship.d.ts +132 -0
- package/lib/services/native-relationship.js +512 -0
- package/lib/services/operation-diagnostic.d.ts +83 -0
- package/lib/services/operation-diagnostic.js +272 -0
- package/lib/services/preflight-calculated-insight-deploy.d.ts +58 -0
- package/lib/services/preflight-calculated-insight-deploy.js +95 -0
- package/lib/services/preflight-data-transform-deploy.d.ts +33 -0
- package/lib/services/preflight-data-transform-deploy.js +104 -0
- package/lib/services/preflight-identity-resolution-deploy.d.ts +107 -0
- package/lib/services/preflight-identity-resolution-deploy.js +281 -0
- package/lib/services/preflight-segment-deploy.d.ts +31 -0
- package/lib/services/preflight-segment-deploy.js +109 -0
- package/lib/services/publish-calculated-insight.d.ts +40 -0
- package/lib/services/publish-calculated-insight.js +95 -0
- package/lib/services/publish-segment.d.ts +65 -0
- package/lib/services/publish-segment.js +194 -0
- package/lib/services/readback-pace.d.ts +16 -0
- package/lib/services/readback-pace.js +23 -0
- package/lib/services/retrieve-data-transform.d.ts +26 -0
- package/lib/services/retrieve-data-transform.js +65 -0
- package/lib/services/retrieve-identity-resolution.d.ts +40 -0
- package/lib/services/retrieve-identity-resolution.js +87 -0
- package/lib/services/retrieve-inventory.d.ts +32 -0
- package/lib/services/retrieve-inventory.js +151 -0
- package/lib/services/retrieve-segment.d.ts +120 -0
- package/lib/services/retrieve-segment.js +502 -0
- package/lib/services/segment-lookup.d.ts +46 -0
- package/lib/services/segment-lookup.js +108 -0
- package/lib/services/segment-members.d.ts +144 -0
- package/lib/services/segment-members.js +402 -0
- package/lib/services/select-native-retrieve.d.ts +60 -0
- package/lib/services/select-native-retrieve.js +226 -0
- package/lib/services/settle-calculated-insight.d.ts +22 -0
- package/lib/services/settle-calculated-insight.js +53 -0
- package/lib/services/sql-tokens.d.ts +58 -0
- package/lib/services/sql-tokens.js +147 -0
- package/lib/transport/api-version.d.ts +36 -0
- package/lib/transport/api-version.js +89 -0
- package/lib/transport/bound-ssot.d.ts +27 -0
- package/lib/transport/bound-ssot.js +116 -0
- package/lib/transport/calculated-insight-rest.d.ts +28 -0
- package/lib/transport/calculated-insight-rest.js +62 -0
- package/lib/transport/connect-client.d.ts +129 -0
- package/lib/transport/connect-client.js +446 -0
- package/lib/transport/connect-diagnostic.d.ts +89 -0
- package/lib/transport/connect-diagnostic.js +331 -0
- package/lib/transport/data-graph-rest.d.ts +27 -0
- package/lib/transport/data-graph-rest.js +76 -0
- package/lib/transport/data-stream-rest.d.ts +62 -0
- package/lib/transport/data-stream-rest.js +348 -0
- package/lib/transport/data-transform-rest.d.ts +25 -0
- package/lib/transport/data-transform-rest.js +100 -0
- package/lib/transport/dlo-native-rest.d.ts +22 -0
- package/lib/transport/dlo-native-rest.js +89 -0
- package/lib/transport/dlo-rest.d.ts +23 -0
- package/lib/transport/dlo-rest.js +135 -0
- package/lib/transport/dmo-native-rest.d.ts +18 -0
- package/lib/transport/dmo-native-rest.js +55 -0
- package/lib/transport/dmo-rest.d.ts +30 -0
- package/lib/transport/dmo-rest.js +163 -0
- package/lib/transport/mapping-rest.d.ts +63 -0
- package/lib/transport/mapping-rest.js +341 -0
- package/lib/transport/project-metadata.d.ts +36 -0
- package/lib/transport/project-metadata.js +118 -0
- package/lib/transport/relationship-rest.d.ts +43 -0
- package/lib/transport/relationship-rest.js +201 -0
- package/package.json +96 -4
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { dataTransformName } from '../artifacts/data-transform-document.js';
|
|
2
|
+
import { dataTransformSpaceById, readDataTransformSpaces } from './data-transform-space.js';
|
|
3
|
+
import { NativeMappingError } from '../artifacts/native-mapping-document.js';
|
|
4
|
+
import { ConnectClient } from '../transport/connect-client.js';
|
|
5
|
+
/** Stream and graph API names, as their exact selectors accept them. */
|
|
6
|
+
const componentName = /^[A-Za-z][A-Za-z0-9_]{0,199}$/u;
|
|
7
|
+
/**
|
|
8
|
+
* Every API name a list route returns, following its `limit`/`offset` paging until `totalSize`
|
|
9
|
+
* (or, without it, a short or empty page). Extra envelope keys are ignored; a malformed answer
|
|
10
|
+
* stops the listing (NATIVE_INVENTORY_UNCONFIRMED). An entry without a usable API name is skipped
|
|
11
|
+
* with a warning, an entry that names only other data spaces is left out and a repeated name is
|
|
12
|
+
* listed once. A page that adds no new name ends the listing (a server ignoring the offset).
|
|
13
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated connection.
|
|
14
|
+
* @param {string} version Numeric API version of the reads.
|
|
15
|
+
* @param {InventoryRoute} route The family's list route.
|
|
16
|
+
* @param {string[]} [warnings] Receives one warning per skipped entry.
|
|
17
|
+
* @returns {Promise<string[]>} Sorted API names.
|
|
18
|
+
*/
|
|
19
|
+
async function listNames(connection, version, route, warnings) {
|
|
20
|
+
const client = new ConnectClient(connection, version);
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
const names = [];
|
|
23
|
+
for (let offset = 0;;) {
|
|
24
|
+
const page = await client.get(route.url(offset));
|
|
25
|
+
const entries = page?.[route.key];
|
|
26
|
+
if (!page || typeof page !== 'object' || !Array.isArray(entries))
|
|
27
|
+
throw new NativeMappingError('NATIVE_INVENTORY_UNCONFIRMED');
|
|
28
|
+
let named = 0;
|
|
29
|
+
let added = 0;
|
|
30
|
+
for (const [index, entry] of entries.entries()) {
|
|
31
|
+
const item = (entry && typeof entry === 'object' ? entry : {});
|
|
32
|
+
const value = item[route.nameKey];
|
|
33
|
+
const apiName = typeof value === 'string' ? value : undefined;
|
|
34
|
+
if (apiName === undefined || !route.pattern.test(apiName)) {
|
|
35
|
+
warnings?.push(`${route.family} inventory: skipped ${apiName === undefined ? `the entry at position ${offset + index}` : `"${apiName}"`} because it has no usable API name.`);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
named++;
|
|
39
|
+
if (seen.has(apiName))
|
|
40
|
+
continue;
|
|
41
|
+
seen.add(apiName);
|
|
42
|
+
added++;
|
|
43
|
+
const spaces = route.spaces(item);
|
|
44
|
+
if (spaces === undefined)
|
|
45
|
+
route.unresolved?.push({ apiName, entry: item });
|
|
46
|
+
else if (spaces.length === 0 || spaces.includes(route.dataSpace))
|
|
47
|
+
names.push(apiName);
|
|
48
|
+
}
|
|
49
|
+
if (route.pageSize === undefined)
|
|
50
|
+
break;
|
|
51
|
+
offset += entries.length;
|
|
52
|
+
const total = page.totalSize;
|
|
53
|
+
const more = typeof total === 'number' && Number.isSafeInteger(total)
|
|
54
|
+
? offset < total
|
|
55
|
+
: entries.length >= route.pageSize;
|
|
56
|
+
if (entries.length === 0 || !more || (named > 0 && added === 0))
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
names.sort();
|
|
60
|
+
return names;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A string, or nothing.
|
|
64
|
+
* @param {unknown} value Any value.
|
|
65
|
+
* @returns {string[]} The non-empty string alone, else empty.
|
|
66
|
+
*/
|
|
67
|
+
const named = (value) => (typeof value === 'string' && value ? [value] : []);
|
|
68
|
+
/**
|
|
69
|
+
* Every data stream `GET /ssot/data-streams` lists (`limit` 1 to 200, `offset`), kept unless its
|
|
70
|
+
* DLO names only other data spaces than the run's.
|
|
71
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated connection.
|
|
72
|
+
* @param {string} version Numeric API version.
|
|
73
|
+
* @param {string[]} [warnings] Receives one warning per skipped entry.
|
|
74
|
+
* @param {string} [dataSpace] The run's data space.
|
|
75
|
+
* @returns {Promise<string[]>} Sorted stream API names.
|
|
76
|
+
*/
|
|
77
|
+
export async function listDataStreamNames(connection, version, warnings, dataSpace = 'default') {
|
|
78
|
+
return listNames(connection, version, {
|
|
79
|
+
family: 'data-stream',
|
|
80
|
+
url: (offset) => `/services/data/v${version}/ssot/data-streams?limit=200&offset=${offset}`,
|
|
81
|
+
pageSize: 200,
|
|
82
|
+
key: 'dataStreams',
|
|
83
|
+
nameKey: 'name',
|
|
84
|
+
pattern: componentName,
|
|
85
|
+
dataSpace,
|
|
86
|
+
spaces: (entry) => {
|
|
87
|
+
const info = entry.dataLakeObjectInfo
|
|
88
|
+
?.dataSpaceInfo;
|
|
89
|
+
return Array.isArray(info)
|
|
90
|
+
? info.flatMap((space) => named(space?.name))
|
|
91
|
+
: [];
|
|
92
|
+
},
|
|
93
|
+
}, warnings);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Every data transform of the run's data space that `GET /ssot/data-transforms` lists (pages of
|
|
97
|
+
* at most 20, `offset`; the list ignores `?dataspace=`, live API 68). An entry is in the data
|
|
98
|
+
* space its `dataSpaceName` names; for one without it, one SOQL read of the org's
|
|
99
|
+
* MktDataTransform records names it by the entry's record `id`, and a transform without any data
|
|
100
|
+
* space there (a system transform) is listed in default only.
|
|
101
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated connection.
|
|
102
|
+
* @param {string[]} [warnings] Receives one warning per skipped entry.
|
|
103
|
+
* @param {string} [dataSpace] The run's data space.
|
|
104
|
+
* @returns {Promise<string[]>} Sorted transform names.
|
|
105
|
+
*/
|
|
106
|
+
export async function listDataTransformNames(connection, warnings, dataSpace = 'default') {
|
|
107
|
+
const unresolved = [];
|
|
108
|
+
const names = await listNames(connection, '68.0', {
|
|
109
|
+
family: 'data-transform',
|
|
110
|
+
unresolved,
|
|
111
|
+
url: (offset) => `/services/data/v68.0/ssot/data-transforms?limit=20&offset=${offset}`,
|
|
112
|
+
pageSize: 20,
|
|
113
|
+
key: 'dataTransforms',
|
|
114
|
+
nameKey: 'name',
|
|
115
|
+
pattern: dataTransformName,
|
|
116
|
+
dataSpace,
|
|
117
|
+
spaces: (entry) => {
|
|
118
|
+
const space = named(entry.dataSpaceName);
|
|
119
|
+
return space.length > 0 ? space : undefined;
|
|
120
|
+
},
|
|
121
|
+
}, warnings);
|
|
122
|
+
if (unresolved.length === 0)
|
|
123
|
+
return names;
|
|
124
|
+
const client = new ConnectClient(connection, '68.0');
|
|
125
|
+
const spaces = await readDataTransformSpaces(async (query) => client.soql(query));
|
|
126
|
+
// By the record ID of the list entry only: the record's Name is a label.
|
|
127
|
+
for (const { apiName, entry } of unresolved)
|
|
128
|
+
if (dataTransformSpaceById(entry.id, spaces) === dataSpace)
|
|
129
|
+
names.push(apiName);
|
|
130
|
+
names.sort();
|
|
131
|
+
return names;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Every data graph of one data space `GET /ssot/data-graphs/metadata?dataspace=` lists (the route
|
|
135
|
+
* filters by it and has no paging); each entry's own `dataspaceName` must name it too.
|
|
136
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated connection.
|
|
137
|
+
* @param {string[]} [warnings] Receives one warning per skipped entry.
|
|
138
|
+
* @param {string} [dataSpace] The run's data space.
|
|
139
|
+
* @returns {Promise<string[]>} Sorted graph developer names.
|
|
140
|
+
*/
|
|
141
|
+
export async function listDataGraphNames(connection, warnings, dataSpace = 'default') {
|
|
142
|
+
return listNames(connection, '68.0', {
|
|
143
|
+
family: 'data-graph',
|
|
144
|
+
url: () => `/services/data/v68.0/ssot/data-graphs/metadata?dataspace=${encodeURIComponent(dataSpace)}`,
|
|
145
|
+
key: 'dataGraphMetadata',
|
|
146
|
+
nameKey: 'developerName',
|
|
147
|
+
pattern: componentName,
|
|
148
|
+
dataSpace,
|
|
149
|
+
spaces: (entry) => named(entry.dataspaceName),
|
|
150
|
+
}, warnings);
|
|
151
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { Connection } from '@salesforce/core';
|
|
2
|
+
import { SegmentError } from '../artifacts/segment-document.js';
|
|
3
|
+
import type { SegmentDocument, SegmentSchedule } from '../artifacts/segment-document.js';
|
|
4
|
+
import type { ApiVersionSelection } from '../transport/api-version.js';
|
|
5
|
+
import type { DocumentMode } from '../artifacts/verbatim-document.js';
|
|
6
|
+
export type SegmentAcquisition = {
|
|
7
|
+
/** The reported identity: the requested name in the run's data space. */
|
|
8
|
+
identity: {
|
|
9
|
+
dataSpace: string;
|
|
10
|
+
apiName: string;
|
|
11
|
+
};
|
|
12
|
+
candidate?: SegmentDocument;
|
|
13
|
+
blockers: string[];
|
|
14
|
+
expectations?: {
|
|
15
|
+
runtime: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
/** The plugin-built explanation of the first blocker, when it has one. */
|
|
18
|
+
explanation?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Project the schedule of a segment GET onto the write shape of the file (live API 68,
|
|
22
|
+
* 2026-11-18): `publishScheduleInfo` gives `frequency`, `interval`, `daysOfWeek` (read as a plain
|
|
23
|
+
* list; an empty one is left out) and `time` (from `timeInfo`, which Salesforce reads back as
|
|
24
|
+
* null); `publishScheduleStartDateTime`, `publishScheduleEndDate` and
|
|
25
|
+
* `publishScheduleEndDateTime` give `startDateTime`, `endDate` and `endDateTime`;
|
|
26
|
+
* `nextScheduledDate` is left out, and so is `publishInterval` beside `publishScheduleInfo`.
|
|
27
|
+
* Without `publishScheduleInfo`, a refresh other than NO_REFRESH (an hourly interval) keeps its
|
|
28
|
+
* `publishInterval`. A segment with NO_REFRESH and no dates has no schedule, so retrieve leaves
|
|
29
|
+
* the key out. Schedule details the plugin does not know (another `publishScheduleInfo` key, a
|
|
30
|
+
* `frequency` that is not text, `daysOfWeek` that is not a list) are UNSUPPORTED_SEGMENT_VARIANT
|
|
31
|
+
* on retrieve; a deploy-mode read gives `opaqueSegmentSchedule`, so a file without `schedule`
|
|
32
|
+
* still deploys and keeps the org schedule.
|
|
33
|
+
* @param {Record<string, unknown>} raw The segment inside the GET response.
|
|
34
|
+
* @param {DocumentMode} [mode] `deploy` (target reads) or `retrieve`.
|
|
35
|
+
* @returns {SegmentSchedule | undefined} Projected schedule, or undefined for none.
|
|
36
|
+
*/
|
|
37
|
+
export declare function projectSegmentSchedule(raw: Record<string, unknown>, mode?: DocumentMode): SegmentSchedule | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Admit an exact response without discarding unknown potentially meaningful fields. Retrieve mode
|
|
40
|
+
* reads `segments[0]` of any wrapper, keeps keys the plugin does not know in `spec` (and extra
|
|
41
|
+
* `includeDbt` keys in `spec.includeDbt`), does not check the observed fields, and refuses only
|
|
42
|
+
* what the file cannot represent (no DBT configuration, parameters, a schedule the file cannot
|
|
43
|
+
* hold, another source kind, a model name unfit for a file), so the segment is written verbatim;
|
|
44
|
+
* the model SQL is kept as read (plain text, plainTextHeaders).
|
|
45
|
+
* Segments of other types than DBT are projected by `projectTypedSegment`.
|
|
46
|
+
* @param {unknown} response Untrusted API68 exact GET response.
|
|
47
|
+
* @param {string} apiName Requested exact identity.
|
|
48
|
+
* @param {DocumentMode} [mode] `deploy` (strict) or `retrieve` (keeps unknown keys).
|
|
49
|
+
* @param {ReadonlyMap<string, string>} [children] Waterfall child definition ID to API name.
|
|
50
|
+
* @returns {{candidate: SegmentDocument; runtime: Record<string, unknown>}} Detached portable and private projections.
|
|
51
|
+
*/
|
|
52
|
+
export declare function projectSegment(response: unknown, apiName: string, mode?: DocumentMode, children?: ReadonlyMap<string, string>): {
|
|
53
|
+
candidate: SegmentDocument;
|
|
54
|
+
runtime: Record<string, unknown>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The refusal of a segment that the org holds in another data space than the run's. Its name is
|
|
58
|
+
* unique in the org (Salesforce stores a non-default segment as `<prefix>_<Name>`), so a read by
|
|
59
|
+
* name finds it wherever it is.
|
|
60
|
+
* @param {string} apiName Segment name.
|
|
61
|
+
* @param {unknown} found The data space the org names for it.
|
|
62
|
+
* @param {string} dataSpace The run's data space.
|
|
63
|
+
* @returns {SegmentError} SEGMENT_DATASPACE_MISMATCH with an explanation.
|
|
64
|
+
*/
|
|
65
|
+
export declare function segmentSpaceMismatch(apiName: string, found: unknown, dataSpace: string): SegmentError;
|
|
66
|
+
/**
|
|
67
|
+
* Acquire one API68 Segment of the run's data space by its exact (stored) name; the GET needs no
|
|
68
|
+
* data space (live API 68: the stored name is unique in the org), and a segment of another data
|
|
69
|
+
* space is SEGMENT_DATASPACE_MISMATCH.
|
|
70
|
+
* A failed GET is never absence evidence; no runtime writes are available. A retrieve of a
|
|
71
|
+
* Waterfall with child segments, without `children`, names them with one segment list read
|
|
72
|
+
* (their definition IDs are org-specific); when that read fails the criteria stay as read.
|
|
73
|
+
* @param {Connection} connection Authenticated command-owned API68 connection.
|
|
74
|
+
* @param {string} apiName Exact selected identity.
|
|
75
|
+
* @param {string | ApiVersionSelection} apiVersion Requested fixed API version.
|
|
76
|
+
* @param {string} dataSpace The run's data space.
|
|
77
|
+
* @param {DocumentMode} [mode] `deploy` (strict) or `retrieve` (keeps what the plugin does not model).
|
|
78
|
+
* @param {ReadonlyMap<string, string>} [children] Waterfall child definition ID to API name.
|
|
79
|
+
* @returns {Promise<SegmentAcquisition>} Detached portable candidate and private runtime baseline.
|
|
80
|
+
*/
|
|
81
|
+
export declare function retrieveSegment(connection: Pick<Connection, 'instanceUrl' | 'request' | 'getApiVersion' | 'getUsername'>, apiName: string, apiVersion: string | ApiVersionSelection, dataSpace: string, mode?: DocumentMode, children?: ReadonlyMap<string, string>): Promise<SegmentAcquisition>;
|
|
82
|
+
/**
|
|
83
|
+
* Name the child segments of a Waterfall read in retrieve mode (retrieve and delete): one
|
|
84
|
+
* segment list read per connection maps each definition ID to its API name. Nothing is read for
|
|
85
|
+
* another segment type or a Waterfall without children; a failed list read names nothing.
|
|
86
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated API 68 connection.
|
|
87
|
+
* @param {unknown} response Segment GET response.
|
|
88
|
+
* @returns {Promise<ReadonlyMap<string, string> | undefined>} Definition ID to API name.
|
|
89
|
+
*/
|
|
90
|
+
export declare function segmentChildNames(connection: Pick<Connection, 'instanceUrl' | 'request'>, response: unknown): Promise<ReadonlyMap<string, string> | undefined>;
|
|
91
|
+
/**
|
|
92
|
+
* Every segment of the run's data space the API 68 list returns, following its
|
|
93
|
+
* `batchSize`/`offset` paging until `totalSize` (or, without it, until a short or empty page).
|
|
94
|
+
* The list is filtered by each entry's own `dataSpace`, never by a query parameter. Extra envelope
|
|
95
|
+
* keys are ignored; a malformed page stops the listing (SEGMENT_ACQUISITION_FAILED). An entry
|
|
96
|
+
* without a usable API name or data space is skipped with a warning, a segment of another data
|
|
97
|
+
* space is left out and a repeated name is listed once. A page that adds no new name ends the
|
|
98
|
+
* listing (a server ignoring the offset).
|
|
99
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated API 68 connection.
|
|
100
|
+
* @param {string[]} [warnings] Receives one warning per skipped entry.
|
|
101
|
+
* @param {string} [dataSpace] The run's data space.
|
|
102
|
+
* @returns {Promise<string[]>} Sorted API names.
|
|
103
|
+
*/
|
|
104
|
+
export declare function listSegmentNames(connection: Pick<Connection, 'instanceUrl' | 'request'>, warnings?: string[], dataSpace?: string): Promise<string[]>;
|
|
105
|
+
/**
|
|
106
|
+
* The entries of the segment list in one data space (or, without one, in every data space), as
|
|
107
|
+
* `listSegmentNames` pages and filters them, in list order.
|
|
108
|
+
* @param {Pick<Connection, 'instanceUrl' | 'request'>} connection Authenticated API 68 connection.
|
|
109
|
+
* @param {string[]} [warnings] Receives one warning per skipped entry.
|
|
110
|
+
* @param {string} [dataSpace] Data space to keep; undefined keeps every one.
|
|
111
|
+
* @param {object} [options] Options.
|
|
112
|
+
* @param {boolean} [options.queryDataSpace] Also send the data space as `dataspace` query parameter
|
|
113
|
+
* (the list filters by it); only the segment lookup asks for it.
|
|
114
|
+
* @returns {Promise<Array<Record<string, unknown> & {apiName: string}>>} Listed segments.
|
|
115
|
+
*/
|
|
116
|
+
export declare function listSegmentEntries(connection: Pick<Connection, 'instanceUrl' | 'request'>, warnings?: string[], dataSpace?: string, options?: {
|
|
117
|
+
queryDataSpace?: boolean;
|
|
118
|
+
}): Promise<Array<Record<string, unknown> & {
|
|
119
|
+
apiName: string;
|
|
120
|
+
}>>;
|