sf-plugin-data 0.1.0 → 0.3.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 -21
- package/README.md +618 -240
- package/docs/artifact-format.md +528 -633
- package/docs/capabilities.md +1160 -168
- package/docs/git-workflow.md +135 -12
- package/docs/handover.md +7826 -12
- package/lib/api.d.ts +13 -0
- package/lib/api.js +10 -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 +222 -6
- package/lib/artifacts/read-deploy-input.js +1213 -53
- 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 +2347 -0
- package/lib/commands/data360/deploy.d.ts +235 -16
- package/lib/commands/data360/deploy.js +2339 -102
- package/lib/commands/data360/list/dataspace.d.ts +53 -0
- package/lib/commands/data360/list/dataspace.js +109 -0
- package/lib/commands/data360/publish.d.ts +93 -0
- package/lib/commands/data360/publish.js +298 -0
- package/lib/commands/data360/retrieve.d.ts +283 -14
- package/lib/commands/data360/retrieve.js +1945 -95
- package/lib/commands/data360/segment/members/export.d.ts +101 -0
- package/lib/commands/data360/segment/members/export.js +320 -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 +58 -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/exit-code.d.ts +10 -0
- package/lib/exit-code.js +24 -0
- package/lib/plugin.d.ts +1 -0
- package/lib/plugin.js +3 -1
- 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 +38 -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 +92 -0
- package/lib/services/data-space-check.js +169 -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/list-data-spaces.d.ts +17 -0
- package/lib/services/list-data-spaces.js +24 -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/run-retrieve.d.ts +24 -0
- package/lib/services/run-retrieve.js +51 -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 +94 -32
- package/lib/transport/connect-client.js +318 -178
- 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 +29 -6
- package/lib/artifacts/dmo-document.d.ts +0 -181
- package/lib/artifacts/dmo-document.js +0 -848
- package/lib/artifacts/dmo-update-delta.d.ts +0 -28
- package/lib/artifacts/dmo-update-delta.js +0 -86
- package/lib/artifacts/write-other-dmo.d.ts +0 -17
- package/lib/artifacts/write-other-dmo.js +0 -140
- package/lib/services/execute-dmo-create.d.ts +0 -24
- package/lib/services/execute-dmo-create.js +0 -118
- package/lib/services/execute-dmo-deploy.d.ts +0 -33
- package/lib/services/execute-dmo-deploy.js +0 -197
- package/lib/services/preflight-dmo-deploy.d.ts +0 -69
- package/lib/services/preflight-dmo-deploy.js +0 -161
- package/lib/services/retrieve-other-dmo.d.ts +0 -46
- package/lib/services/retrieve-other-dmo.js +0 -140
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Pure path rules shared by Git selection and editor integrations. Keep this module free of any
|
|
2
|
+
// import other than `node:path` so it can be bundled on its own.
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export const dloName = /^[A-Za-z][A-Za-z0-9_]{0,199}__dll$/u;
|
|
5
|
+
export const nativeDmoName = /^[A-Za-z][A-Za-z0-9_]{0,199}__dlm$/u;
|
|
6
|
+
export const nativeMappingName = /^[A-Za-z][A-Za-z0-9_]{0,239}$/u;
|
|
7
|
+
export const nativeRelationshipName = /^[A-Za-z][A-Za-z0-9_]{0,239}$/u;
|
|
8
|
+
export const dataTransformName = /^[A-Za-z][A-Za-z0-9_]{0,199}$/u;
|
|
9
|
+
export const dataGraphName = /^[A-Za-z][A-Za-z0-9_]{0,199}$/u;
|
|
10
|
+
export const identityResolutionName = /^[A-Za-z][A-Za-z0-9_]{0,199}$/u;
|
|
11
|
+
export const calculatedInsightName = /^[A-Za-z][A-Za-z0-9_]{0,194}__cio$/u;
|
|
12
|
+
export const segmentName = /^[A-Za-z][A-Za-z0-9_]{0,199}$/u;
|
|
13
|
+
export const ciJsonSuffix = '.calculatedInsight-meta.json';
|
|
14
|
+
export const ciSqlSuffix = '.calculatedInsight-meta.sql';
|
|
15
|
+
/** Family by file suffix; every family lives under `data360/` at the project root. */
|
|
16
|
+
export const families = [
|
|
17
|
+
{
|
|
18
|
+
kind: 'dmo',
|
|
19
|
+
suffix: '.dmo-meta.json',
|
|
20
|
+
directory: ['data360', 'dmo'],
|
|
21
|
+
name: (value) => nativeDmoName.test(value),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
kind: 'dlo',
|
|
25
|
+
suffix: '.dlo-meta.json',
|
|
26
|
+
directory: ['data360', 'dlo'],
|
|
27
|
+
name: (value) => dloName.test(value) && value.endsWith('__dll'),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
kind: 'mapping',
|
|
31
|
+
suffix: '.mapping-meta.json',
|
|
32
|
+
directory: ['data360', 'mapping'],
|
|
33
|
+
name: (value) => nativeMappingName.test(value),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
kind: 'relationship',
|
|
37
|
+
suffix: '.relationship-meta.json',
|
|
38
|
+
directory: ['data360', 'relationship'],
|
|
39
|
+
name: (value) => nativeRelationshipName.test(value),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
kind: 'data-stream',
|
|
43
|
+
suffix: '.data-stream-meta.json',
|
|
44
|
+
directory: ['data360', 'data-stream'],
|
|
45
|
+
name: (value) => /^[A-Za-z][A-Za-z0-9_]{0,199}$/u.test(value),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
kind: 'data-transform',
|
|
49
|
+
suffix: '.dataTransform.json',
|
|
50
|
+
directory: ['data360', 'dataTransforms'],
|
|
51
|
+
name: (value) => dataTransformName.test(value),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
kind: 'data-graph',
|
|
55
|
+
suffix: '.native-dataGraph.json',
|
|
56
|
+
directory: ['data360', 'dataGraphs'],
|
|
57
|
+
name: (value) => dataGraphName.test(value),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
kind: 'identity-resolution',
|
|
61
|
+
suffix: '.identityResolution.json',
|
|
62
|
+
directory: ['data360', 'identityResolution'],
|
|
63
|
+
name: (value) => identityResolutionName.test(value),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
kind: 'calculated-insight',
|
|
67
|
+
suffix: ciJsonSuffix,
|
|
68
|
+
directory: ['data360', 'calculatedInsights'],
|
|
69
|
+
name: (value) => calculatedInsightName.test(value),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
kind: 'segment',
|
|
73
|
+
suffix: '.segment.json',
|
|
74
|
+
directory: ['data360', 'segments'],
|
|
75
|
+
name: (value) => segmentName.test(value),
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
// The SQL file of a calculated insight selects (or, deleted, deletes) the insight like its JSON.
|
|
79
|
+
export const ciSql = (file) => /\.calculatedInsight-meta\.sql$/iu.test(file);
|
|
80
|
+
// A segment's SQL file (`<Name>.segment.<model>.sql`) selects the segment like its JSON.
|
|
81
|
+
export const segmentSql = (file) => {
|
|
82
|
+
const entry = path.posix.basename(file).toLowerCase();
|
|
83
|
+
return entry.includes('.segment.') && entry.endsWith('.sql');
|
|
84
|
+
};
|
|
85
|
+
export const segmentSqlPattern = /^([A-Za-z][A-Za-z0-9_]*)\.segment\.([A-Za-z0-9][A-Za-z0-9_]*)\.sql$/u;
|
|
86
|
+
/**
|
|
87
|
+
* Map one project-relative POSIX path to its family and canonical name.
|
|
88
|
+
* @param {string} file Project-relative POSIX path.
|
|
89
|
+
* @returns {object | undefined} Family and canonical name (`__cio` included for calculated
|
|
90
|
+
* insights), or undefined when the path is not a canonical component file.
|
|
91
|
+
*/
|
|
92
|
+
export function classifyComponentPath(file) {
|
|
93
|
+
if (ciSql(file)) {
|
|
94
|
+
const name = path.posix.basename(file).slice(0, -ciSqlSuffix.length);
|
|
95
|
+
if (!calculatedInsightName.test(name) ||
|
|
96
|
+
file !== `data360/calculatedInsights/${name}${ciSqlSuffix}`)
|
|
97
|
+
return undefined;
|
|
98
|
+
return { kind: 'calculated-insight', name };
|
|
99
|
+
}
|
|
100
|
+
if (segmentSql(file)) {
|
|
101
|
+
const match = segmentSqlPattern.exec(path.posix.basename(file));
|
|
102
|
+
if (!match || !segmentName.test(match[1]) || file !== `data360/segments/${match[0]}`)
|
|
103
|
+
return undefined;
|
|
104
|
+
return { kind: 'segment', name: match[1] };
|
|
105
|
+
}
|
|
106
|
+
const family = families.find(({ suffix }) => file.toLowerCase().endsWith(suffix.toLowerCase()));
|
|
107
|
+
if (!family)
|
|
108
|
+
return undefined;
|
|
109
|
+
const name = path.posix.basename(file).slice(0, -family.suffix.length);
|
|
110
|
+
if (!family.name(name) || file !== [...family.directory, `${name}${family.suffix}`].join('/'))
|
|
111
|
+
return undefined;
|
|
112
|
+
return { kind: family.kind, name };
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The `sf data360 deploy/retrieve -m` selector of a component file. A calculated insight's SQL
|
|
116
|
+
* file and a segment's `<Name>.segment.<model>.sql` file map to their owner. Only POSIX paths
|
|
117
|
+
* (`/` separators) relative to the project root are recognised; anything else is undefined.
|
|
118
|
+
* @param {string} relativePath Project-relative POSIX path.
|
|
119
|
+
* @returns {object | undefined} Family, name and `kind:name` selector, or undefined; never throws.
|
|
120
|
+
*/
|
|
121
|
+
export function selectorForPath(relativePath) {
|
|
122
|
+
if (typeof relativePath !== 'string')
|
|
123
|
+
return undefined;
|
|
124
|
+
const component = classifyComponentPath(relativePath);
|
|
125
|
+
return component && { ...component, selector: `${component.kind}:${component.name}` };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The source DMO a relationship file names: `spec.sourceObjectName` of a normal document, or
|
|
129
|
+
* `verbatim.native.sourceObject.name` of one retrieved as-is.
|
|
130
|
+
* @param {unknown} document Parsed file content.
|
|
131
|
+
* @returns {string | undefined} A valid DMO API name, or undefined.
|
|
132
|
+
*/
|
|
133
|
+
function relationshipSourceDmo(document) {
|
|
134
|
+
const bag = (value) => value && typeof value === 'object' && !Array.isArray(value)
|
|
135
|
+
? value
|
|
136
|
+
: undefined;
|
|
137
|
+
const root = bag(document);
|
|
138
|
+
const source = bag(root?.spec)?.sourceObjectName ?? bag(bag(bag(root?.verbatim)?.native)?.sourceObject)?.name;
|
|
139
|
+
return typeof source === 'string' && nativeDmoName.test(source) ? source : undefined;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The exact `sf data360 delete -m` selector of a component file. Every family deletes by its
|
|
143
|
+
* deploy selector except a relationship, which also names its source DMO
|
|
144
|
+
* (`relationship:<SourceDmo__dlm>:<Name>`), read from the file's content.
|
|
145
|
+
* @param {string} relativePath Project-relative POSIX path.
|
|
146
|
+
* @param {string} documentText The file's text (only read for a relationship).
|
|
147
|
+
* @returns {string | undefined} The selector, or undefined (unknown path, or a relationship whose
|
|
148
|
+
* text is not JSON or names no valid source DMO); never throws.
|
|
149
|
+
*/
|
|
150
|
+
export function deleteSelectorFor(relativePath, documentText) {
|
|
151
|
+
const component = selectorForPath(relativePath);
|
|
152
|
+
if (!component)
|
|
153
|
+
return undefined;
|
|
154
|
+
if (component.kind !== 'relationship')
|
|
155
|
+
return component.selector;
|
|
156
|
+
if (typeof documentText !== 'string')
|
|
157
|
+
return undefined;
|
|
158
|
+
let document;
|
|
159
|
+
try {
|
|
160
|
+
document = JSON.parse(documentText);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
const source = relationshipSourceDmo(document);
|
|
166
|
+
return source && `relationship:${source}:${component.name}`;
|
|
167
|
+
}
|
|
@@ -1,23 +1,239 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataTransformDocument } from './data-transform-document.js';
|
|
2
|
+
import type { NativeDataGraphDocument } from './native-data-graph-document.js';
|
|
3
|
+
import type { CrmDataStreamDocument, DataStreamDocument } from './data-stream-document.js';
|
|
4
|
+
import type { NativeMappingDocument } from './native-mapping-document.js';
|
|
5
|
+
import type { NativeRelationshipDocument } from './native-relationship-document.js';
|
|
6
|
+
import type { NativeDmoDocument } from './native-dmo-document.js';
|
|
7
|
+
import type { DloDocument } from './dlo-document.js';
|
|
8
|
+
import type { DeletedArtifactKind } from './path-selector.js';
|
|
9
|
+
import type { SegmentDocument } from './segment-document.js';
|
|
10
|
+
import type { IdentityResolutionDocument } from './identity-resolution-document.js';
|
|
11
|
+
import type { CalculatedInsightReference as CalculatedInsightReference, NativeCalculatedInsight } from './native-calculated-insight-document.js';
|
|
12
|
+
import type { VerbatimDocument } from './verbatim-document.js';
|
|
13
|
+
/** Refusals of the c__dataSpace key that a selected file keeps instead of INVALID_SOURCE. */
|
|
14
|
+
declare const dataSpaceFieldCodes: readonly ["LEGACY_DATASPACE_KEY", "INVALID_DATASPACE_FIELD", "UNSUPPORTED_DATASPACE_FILTER"];
|
|
15
|
+
type DataSpaceFieldCode = (typeof dataSpaceFieldCodes)[number];
|
|
16
|
+
/**
|
|
17
|
+
* A segment file: its JSON or one of its SQL files.
|
|
18
|
+
* @param {string} file Path.
|
|
19
|
+
* @returns {boolean} Whether the base name is `X.segment.json` or `X.segment.*.sql`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isSegmentMember: (file: string) => boolean;
|
|
2
22
|
/** Payload-free local selection refusal. */
|
|
3
23
|
export declare class DeployInputError extends Error {
|
|
4
|
-
readonly code: 'INVALID_SELECTION' | 'UNSAFE_SOURCE' | 'INVALID_SOURCE' | 'DUPLICATE_IDENTITY';
|
|
5
|
-
constructor(code: 'INVALID_SELECTION' | 'UNSAFE_SOURCE' | 'INVALID_SOURCE' | 'DUPLICATE_IDENTITY');
|
|
24
|
+
readonly code: 'INVALID_SELECTION' | 'UNSAFE_SOURCE' | 'INVALID_SOURCE' | 'DUPLICATE_IDENTITY' | 'UNSUPPORTED_SEGMENT_XML' | 'VERBATIM_NOT_DEPLOYABLE' | DataSpaceFieldCode;
|
|
25
|
+
constructor(code: 'INVALID_SELECTION' | 'UNSAFE_SOURCE' | 'INVALID_SOURCE' | 'DUPLICATE_IDENTITY' | 'UNSUPPORTED_SEGMENT_XML' | 'VERBATIM_NOT_DEPLOYABLE' | DataSpaceFieldCode, message?: string);
|
|
6
26
|
}
|
|
7
|
-
export type
|
|
27
|
+
export type SegmentDeployInput = {
|
|
28
|
+
/** `data360/segments/<apiName>.segment.json` under the project root. */
|
|
29
|
+
path: string;
|
|
30
|
+
/** The SQL file of each model next to it, `<apiName>.segment.<model>.sql`, in model order. */
|
|
31
|
+
codePaths: readonly string[];
|
|
32
|
+
/** The JSON with every model's SQL joined back. */
|
|
33
|
+
document: SegmentDocument;
|
|
34
|
+
inputDigest: string;
|
|
35
|
+
};
|
|
36
|
+
export type SupportedDeployInput = SegmentDeployInput;
|
|
37
|
+
export type IdentityResolutionDeployInput = {
|
|
38
|
+
path: string;
|
|
39
|
+
document: IdentityResolutionDocument;
|
|
40
|
+
inputDigest: string;
|
|
41
|
+
};
|
|
42
|
+
export type CalculatedInsightDeployInput = {
|
|
43
|
+
/** `data360/calculatedInsights/<apiName>.calculatedInsight-meta.json`. */
|
|
44
|
+
path: string;
|
|
45
|
+
/** The SQL file next to it, `<apiName>.calculatedInsight-meta.sql`. */
|
|
46
|
+
companionPath: string;
|
|
47
|
+
/** The JSON with its SQL joined back. */
|
|
48
|
+
native: NativeCalculatedInsight;
|
|
49
|
+
/** Kind, identity and the objects the SQL names, for selection and ordering. */
|
|
50
|
+
document: CalculatedInsightReference;
|
|
51
|
+
inputDigest: string;
|
|
52
|
+
};
|
|
53
|
+
export type DloDeployInput = {
|
|
54
|
+
path: string;
|
|
55
|
+
document: DloDocument;
|
|
56
|
+
inputDigest: string;
|
|
57
|
+
};
|
|
58
|
+
export type NativeDmoDeployInput = {
|
|
59
|
+
path: string;
|
|
60
|
+
document: NativeDmoDocument;
|
|
61
|
+
inputDigest: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Identify a native DMO input by its canonical path.
|
|
65
|
+
* @param {object} input Captured input.
|
|
66
|
+
* @param {string} input.path Selected path.
|
|
67
|
+
* @returns {boolean} Native canonical path.
|
|
68
|
+
*/
|
|
69
|
+
export declare function isNativeDmoInput(input: {
|
|
70
|
+
path: string;
|
|
71
|
+
}): input is NativeDmoDeployInput;
|
|
72
|
+
export type MappingDeployInput = {
|
|
73
|
+
path: string;
|
|
74
|
+
document: NativeMappingDocument;
|
|
75
|
+
inputDigest: string;
|
|
76
|
+
};
|
|
77
|
+
export type DataStreamDeployInput = {
|
|
78
|
+
path: string;
|
|
79
|
+
document: DataStreamDocument | CrmDataStreamDocument;
|
|
80
|
+
inputDigest: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Re-admit every exact local byte and immutable logical input before relying on it.
|
|
84
|
+
* @param {DataStreamDeployInput} input Captured stream admission.
|
|
85
|
+
* @returns {Promise<void>} Resolves only without local drift.
|
|
86
|
+
*/
|
|
87
|
+
export declare function verifyDataStreamInputDigest(input: DataStreamDeployInput): Promise<void>;
|
|
88
|
+
export type NativeDataGraphDeployInput = {
|
|
89
|
+
path: string;
|
|
90
|
+
document: NativeDataGraphDocument;
|
|
91
|
+
inputDigest: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Re-admit native Graph exact bytes and logical intent before mutation.
|
|
95
|
+
* @param {NativeDataGraphDeployInput} input Captured source.
|
|
96
|
+
*/
|
|
97
|
+
export declare function verifyNativeDataGraphInputDigest(input: NativeDataGraphDeployInput): Promise<void>;
|
|
98
|
+
export type DataTransformDeployInput = {
|
|
99
|
+
path: string;
|
|
100
|
+
document: DataTransformDocument;
|
|
101
|
+
inputDigest: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Re-admit exact Transform bytes and logical intent immediately before mutation.
|
|
105
|
+
* @param {DataTransformDeployInput} input Captured immutable admission.
|
|
106
|
+
* @returns {Promise<void>} Resolves only without local drift.
|
|
107
|
+
*/
|
|
108
|
+
export declare function verifyDataTransformInputDigest(input: DataTransformDeployInput): Promise<void>;
|
|
109
|
+
export type RelationshipDeployInput = {
|
|
8
110
|
path: string;
|
|
9
|
-
document:
|
|
111
|
+
document: NativeRelationshipDocument;
|
|
112
|
+
inputDigest: string;
|
|
10
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* Admit canonical relationship JSON whose file name is the relationship name.
|
|
116
|
+
* @param {string} file Exact local relationship member.
|
|
117
|
+
* @returns {Promise<RelationshipDeployInput>} Immutable content and byte binding.
|
|
118
|
+
*/
|
|
119
|
+
export declare function readRelationshipInput(file: string): Promise<RelationshipDeployInput>;
|
|
120
|
+
/**
|
|
121
|
+
* The document the file holds: for an input translated into another data space, the original.
|
|
122
|
+
* @param {{document: unknown}} input Admitted input.
|
|
123
|
+
* @param {unknown} input.document Its document, translated or as read.
|
|
124
|
+
* @returns {unknown} The file's document.
|
|
125
|
+
*/
|
|
126
|
+
export declare function authoredDocument(input: {
|
|
127
|
+
document: unknown;
|
|
128
|
+
}): unknown;
|
|
129
|
+
/**
|
|
130
|
+
* The insight document the files hold: for an insight translated into another data space, the
|
|
131
|
+
* original.
|
|
132
|
+
* @param {{native: unknown}} input Admitted calculated insight input.
|
|
133
|
+
* @param {unknown} input.native Its insight document, translated or as read.
|
|
134
|
+
* @returns {unknown} The files' insight document.
|
|
135
|
+
*/
|
|
136
|
+
export declare function authoredNative(input: {
|
|
137
|
+
native: unknown;
|
|
138
|
+
}): unknown;
|
|
139
|
+
/**
|
|
140
|
+
* A frozen copy of an admitted input that carries a translated document (and for a calculated
|
|
141
|
+
* insight its translated insight document); its file checks still compare against what the
|
|
142
|
+
* files hold.
|
|
143
|
+
* @param {T} input Admitted input.
|
|
144
|
+
* @param {unknown} document Translated document.
|
|
145
|
+
* @param {unknown} [native] Translated insight document of a calculated insight.
|
|
146
|
+
* @returns {T} The translated input.
|
|
147
|
+
* @template T
|
|
148
|
+
*/
|
|
149
|
+
export declare function translatedDeployInput<T extends {
|
|
150
|
+
document: unknown;
|
|
151
|
+
}>(input: T, document: unknown, native?: unknown): T;
|
|
152
|
+
export type DeployInput = DataTransformDeployInput | NativeDataGraphDeployInput | DataStreamDeployInput | MappingDeployInput | RelationshipDeployInput | NativeDmoDeployInput | SupportedDeployInput | IdentityResolutionDeployInput | CalculatedInsightDeployInput | DloDeployInput;
|
|
153
|
+
/**
|
|
154
|
+
* Verify only immutable local bytes and identity, independent of legitimate remote stage changes.
|
|
155
|
+
* @param {DloDeployInput} input Original input.
|
|
156
|
+
* @returns {Promise<void>} Resolves only without local drift.
|
|
157
|
+
*/
|
|
158
|
+
export declare function verifyDloInputDigest(input: DloDeployInput): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Narrow executable families; IR admission does not authorize public routing.
|
|
161
|
+
* @param {DeployInput} input Admitted input.
|
|
162
|
+
* @returns {boolean} Whether an existing public route supports this family.
|
|
163
|
+
*/
|
|
164
|
+
export declare function isSupportedDeployInput(input: DeployInput): input is SupportedDeployInput | CalculatedInsightDeployInput;
|
|
165
|
+
/**
|
|
166
|
+
* Re-admit an IR snapshot before relying on the original immutable bytes.
|
|
167
|
+
* @param {IdentityResolutionDeployInput} input Captured admission.
|
|
168
|
+
* @returns {Promise<void>} Resolves only for unchanged exact bytes.
|
|
169
|
+
*/
|
|
170
|
+
export declare function verifyIdentityResolutionInputDigest(input: IdentityResolutionDeployInput): Promise<void>;
|
|
11
171
|
export type DeployInputFlags = {
|
|
12
172
|
cwd: string;
|
|
13
173
|
sourceDir?: readonly string[];
|
|
14
174
|
metadata?: readonly string[];
|
|
175
|
+
/**
|
|
176
|
+
* Verbatim files (retrieved as-is) are skipped with a warning inside a selected folder and
|
|
177
|
+
* refused (VERBATIM_NOT_DEPLOYABLE) when named directly. `skip` also skips named ones: a Git
|
|
178
|
+
* range names every changed file.
|
|
179
|
+
*/
|
|
180
|
+
verbatim?: 'skip';
|
|
15
181
|
};
|
|
16
182
|
/**
|
|
17
|
-
*
|
|
183
|
+
* The warnings of the verbatim files a {@link readDeployInputs} call skipped, one per file.
|
|
184
|
+
* @param {readonly unknown[]} inputs Array that call returned.
|
|
185
|
+
* @returns {readonly string[]} Warnings; empty for any other array.
|
|
186
|
+
*/
|
|
187
|
+
export declare function skippedVerbatimWarnings(inputs: readonly unknown[]): readonly string[];
|
|
188
|
+
/**
|
|
189
|
+
* Re-admit the JSON and SQL files before relying on captured logical content or bytes.
|
|
190
|
+
* @param {CalculatedInsightDeployInput} input Original immutable admission.
|
|
191
|
+
* @returns {Promise<void>} Resolves only for unchanged original bytes.
|
|
192
|
+
*/
|
|
193
|
+
export declare function verifyCalculatedInsightInputDigest(input: CalculatedInsightDeployInput): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Revalidate JSON bytes and logical intent before relying on captured admission.
|
|
196
|
+
* @param {SegmentDeployInput} input Previously admitted JSON.
|
|
197
|
+
* @returns {Promise<void>} Resolves only if original bytes and content remain unchanged.
|
|
198
|
+
*/
|
|
199
|
+
export declare function verifySegmentInputDigest(input: SegmentDeployInput): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Capture admitted exact bytes without changing the existing input shape or Segment JSON digest.
|
|
202
|
+
* @param {DeployInput} input Previously admitted local input.
|
|
203
|
+
* @returns {Promise<string>} Exact byte digest after identity/content re-admission.
|
|
204
|
+
*/
|
|
205
|
+
export declare function captureDeployInputDigest(input: DeployInput): Promise<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Resolve explicit authored files/directories or exact project-relative DMO/Segment selectors, read-only.
|
|
18
208
|
* Limits are 256 files, 1 MiB per file, 1024 visited entries and 16 directory levels.
|
|
19
209
|
* Repeated identical selections coalesce; different files claiming one identity fail closed.
|
|
20
210
|
* @param {DeployInputFlags} flags Explicit mutually exclusive source modes and captured cwd.
|
|
21
211
|
* @returns {Promise<DeployInput[]>} Sorted, independently validated authored inputs.
|
|
22
212
|
*/
|
|
23
213
|
export declare function readDeployInputs(flags: DeployInputFlags): Promise<DeployInput[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Admit bytes of a file read from a Git revision (no worktree file exists) by the family
|
|
216
|
+
* validator, and take the identity from the content, which must agree with the canonical name.
|
|
217
|
+
* The file is read as retrieve writes it (retrieve mode): a delete needs its family, identity
|
|
218
|
+
* and what the delete itself uses, not a deployable definition.
|
|
219
|
+
* @param {DeletedArtifactKind} kind Family derived from the canonical path.
|
|
220
|
+
* @param {string} name Canonical name derived from the path.
|
|
221
|
+
* @param {Buffer} bytes Exact revision bytes (the JSON file).
|
|
222
|
+
* @param {Array<{name?: string; bytes: Buffer}>} [code] SQL file bytes from the same revision: the
|
|
223
|
+
* calculated insight's one SQL file, or one per segment model (`name` is the model).
|
|
224
|
+
* @returns {object} Content identity and the validated base document (deeply frozen), plus the
|
|
225
|
+
* source DMO of a relationship.
|
|
226
|
+
*/
|
|
227
|
+
export declare function admitDeletedArtifact(kind: DeletedArtifactKind, name: string, bytes: Buffer, code?: ReadonlyArray<{
|
|
228
|
+
name?: string;
|
|
229
|
+
bytes: Buffer;
|
|
230
|
+
}>): {
|
|
231
|
+
/** No single data space for a DLO: its spaces are the document's c__dataSpace list. */
|
|
232
|
+
identity: {
|
|
233
|
+
dataSpace?: string;
|
|
234
|
+
apiName: string;
|
|
235
|
+
};
|
|
236
|
+
document: DeployInput['document'] | VerbatimDocument;
|
|
237
|
+
sourceObjectName?: string;
|
|
238
|
+
};
|
|
239
|
+
export { type DeletedArtifactKind } from './path-selector.js';
|