sf-plugin-data 0.5.0 → 0.5.1
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/lib/commands/data360/delete.js +3 -2
- package/lib/commands/data360/deploy.js +3 -2
- package/lib/commands/data360/list/dataspace.js +12 -5
- package/lib/commands/data360/publish.js +4 -2
- package/lib/commands/data360/retrieve.js +14 -5
- package/lib/commands/data360/segment/members/export.js +4 -1
- package/package.json +1 -1
|
@@ -566,7 +566,8 @@ export default class Delete extends SfCommand {
|
|
|
566
566
|
deleteCalculatedInsight = deleteCalculatedInsight;
|
|
567
567
|
/** The org ID of the connection this run resolved (provenance only); unset before that. */
|
|
568
568
|
resolvedOrgId;
|
|
569
|
-
//
|
|
569
|
+
// Without --target-org an unusable org is TARGET_ORG_REQUIRED; a given one is
|
|
570
|
+
// AUTHENTICATION_FAILED, as in publish.
|
|
570
571
|
resolveConnection = async (alias) => {
|
|
571
572
|
try {
|
|
572
573
|
const aggregator = await ConfigAggregator.create();
|
|
@@ -580,7 +581,7 @@ export default class Delete extends SfCommand {
|
|
|
580
581
|
});
|
|
581
582
|
}
|
|
582
583
|
catch {
|
|
583
|
-
throw new DloError('TARGET_ORG_REQUIRED');
|
|
584
|
+
throw new DloError(alias === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED');
|
|
584
585
|
}
|
|
585
586
|
};
|
|
586
587
|
/**
|
|
@@ -19,7 +19,7 @@ import { preflightDataStream, executeDataStream, } from '../../services/command-
|
|
|
19
19
|
import { verifyDataStreamInputDigest } from '../../artifacts/read-deploy-input.js';
|
|
20
20
|
import { DataStreamError } from '../../artifacts/data-stream-document.js';
|
|
21
21
|
import { dataStreamApiVersion } from '../../transport/api-version.js';
|
|
22
|
-
import { ConnectClient } from '../../transport/connect-client.js';
|
|
22
|
+
import { ConnectClient, ConnectError } from '../../transport/connect-client.js';
|
|
23
23
|
import { createDataStreamClient, createDataStreamReferenceReader, } from '../../transport/data-stream-rest.js';
|
|
24
24
|
import { preflightMapping, executeMapping } from '../../services/command-native-mapping.js';
|
|
25
25
|
import { createMappingClient } from '../../transport/mapping-rest.js';
|
|
@@ -101,8 +101,9 @@ const resolveTargetOrg = async (aliasOrUsername) => {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
catch (error) {
|
|
104
|
+
// A given --target-org that cannot be used is an authentication failure (cause kept).
|
|
104
105
|
if (aliasOrUsername)
|
|
105
|
-
throw error;
|
|
106
|
+
throw Object.assign(new ConnectError('AUTHENTICATION_FAILED'), { cause: error });
|
|
106
107
|
return undefined;
|
|
107
108
|
}
|
|
108
109
|
};
|
|
@@ -58,11 +58,18 @@ export default class ListDataSpace extends SfCommand {
|
|
|
58
58
|
connection = await this.resolveConnection(flags['target-org']);
|
|
59
59
|
}
|
|
60
60
|
catch {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
62
|
+
envelope.diagnostics.errors.push(flags['target-org'] === undefined
|
|
63
|
+
? {
|
|
64
|
+
code: 'TARGET_ORG_REQUIRED',
|
|
65
|
+
message: 'No usable target org: pass -o with an authenticated alias or username, or set target-org.',
|
|
66
|
+
retryable: false,
|
|
67
|
+
}
|
|
68
|
+
: {
|
|
69
|
+
code: 'AUTHENTICATION_FAILED',
|
|
70
|
+
message: 'The target org given with -o is unknown or not authenticated: log in to it with sf org login web, or pass another alias or username.',
|
|
71
|
+
retryable: false,
|
|
72
|
+
});
|
|
66
73
|
return this.finish(envelope);
|
|
67
74
|
}
|
|
68
75
|
try {
|
|
@@ -137,7 +137,8 @@ export default class Publish extends SfCommand {
|
|
|
137
137
|
await this.verifyCalculatedInsightInput(input);
|
|
138
138
|
};
|
|
139
139
|
await verifyInput();
|
|
140
|
-
|
|
140
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
141
|
+
code = flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED';
|
|
141
142
|
const connection = await this.resolveConnection(flags['target-org']);
|
|
142
143
|
code = 'CI_ADMISSION_FAILED';
|
|
143
144
|
const context = this.calculatedInsightContext(connection, dataSpace);
|
|
@@ -225,7 +226,8 @@ export default class Publish extends SfCommand {
|
|
|
225
226
|
await this.verifySegmentInput(input);
|
|
226
227
|
};
|
|
227
228
|
await verifyInput();
|
|
228
|
-
|
|
229
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
230
|
+
code = flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED';
|
|
229
231
|
const connection = await this.resolveConnection(flags['target-org']);
|
|
230
232
|
const result = await this.publishSegment(apiName, connection, { requested: '68.0', restSelector: 'v68.0', soapNumeric: '68.0' }, {
|
|
231
233
|
preview: flags.preview,
|
|
@@ -627,7 +627,9 @@ export default class Retrieve extends SfCommand {
|
|
|
627
627
|
org = await this.resolveOrg(flags['target-org']);
|
|
628
628
|
}
|
|
629
629
|
catch {
|
|
630
|
-
|
|
630
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
631
|
+
const code = flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED';
|
|
632
|
+
return { status: 'blocked', selection: selectors, code };
|
|
631
633
|
}
|
|
632
634
|
const connection = org.getConnection('68.0');
|
|
633
635
|
envelope.provenance.sourceOrgId ??= org.getOrgId();
|
|
@@ -741,7 +743,9 @@ export default class Retrieve extends SfCommand {
|
|
|
741
743
|
org = await this.resolveOrg(flags['target-org']);
|
|
742
744
|
}
|
|
743
745
|
catch {
|
|
744
|
-
|
|
746
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
747
|
+
const code = flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED';
|
|
748
|
+
return { status: 'blocked', selection: selectors, code };
|
|
745
749
|
}
|
|
746
750
|
const connection = org.getConnection(version);
|
|
747
751
|
const target = flags['target-org'] ?? connection.getUsername();
|
|
@@ -1008,7 +1012,9 @@ export default class Retrieve extends SfCommand {
|
|
|
1008
1012
|
org = await this.resolveOrg(flags['target-org']);
|
|
1009
1013
|
}
|
|
1010
1014
|
catch {
|
|
1011
|
-
|
|
1015
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
1016
|
+
const code = flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED';
|
|
1017
|
+
return { status: 'blocked', selection: selectors, code };
|
|
1012
1018
|
}
|
|
1013
1019
|
const connection = org.getConnection(version);
|
|
1014
1020
|
const target = flags['target-org'] ?? connection.getUsername();
|
|
@@ -1335,7 +1341,9 @@ export default class Retrieve extends SfCommand {
|
|
|
1335
1341
|
org = await this.resolveOrg(flags['target-org']);
|
|
1336
1342
|
}
|
|
1337
1343
|
catch {
|
|
1338
|
-
|
|
1344
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
1345
|
+
const code = flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED';
|
|
1346
|
+
return { status: 'blocked', selection: selectors, code };
|
|
1339
1347
|
}
|
|
1340
1348
|
let selection = selectors;
|
|
1341
1349
|
const before = envelope.diagnostics.errors.length;
|
|
@@ -1960,7 +1968,8 @@ export default class Retrieve extends SfCommand {
|
|
|
1960
1968
|
org = await this.resolveOrg(flags['target-org']);
|
|
1961
1969
|
}
|
|
1962
1970
|
catch {
|
|
1963
|
-
|
|
1971
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
1972
|
+
throw new DataSpaceError(flags['target-org'] === undefined ? 'TARGET_ORG_REQUIRED' : 'AUTHENTICATION_FAILED');
|
|
1964
1973
|
}
|
|
1965
1974
|
const connection = org.getConnection('68.0');
|
|
1966
1975
|
return openBoundSsot(flags['target-org'] ?? '', '68.0', async () => connection);
|
|
@@ -163,7 +163,10 @@ export default class SegmentMembersExport extends SfCommand {
|
|
|
163
163
|
connection = await this.resolveConnection(flags['target-org']);
|
|
164
164
|
}
|
|
165
165
|
catch {
|
|
166
|
-
|
|
166
|
+
// A given --target-org that cannot be used is an authentication failure.
|
|
167
|
+
return flags['target-org'] === undefined
|
|
168
|
+
? fail('TARGET_ORG_REQUIRED', 'No usable target org: pass -o with an authenticated alias or username, or set target-org.')
|
|
169
|
+
: fail('AUTHENTICATION_FAILED', 'The target org given with -o is unknown or not authenticated: log in to it with sf org login web, or pass another alias or username.');
|
|
167
170
|
}
|
|
168
171
|
const sender = this.createSender
|
|
169
172
|
? this.createSender(connection, version)
|