@salesforce/b2c-tooling-sdk 0.8.0 → 0.8.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/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/operations/ods/index.d.ts +2 -0
- package/dist/cjs/operations/ods/index.js +1 -0
- package/dist/cjs/operations/ods/index.js.map +1 -1
- package/dist/cjs/operations/ods/wait-for-clone.d.ts +46 -0
- package/dist/cjs/operations/ods/wait-for-clone.js +100 -0
- package/dist/cjs/operations/ods/wait-for-clone.js.map +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operations/ods/index.d.ts +2 -0
- package/dist/esm/operations/ods/index.js +1 -0
- package/dist/esm/operations/ods/index.js.map +1 -1
- package/dist/esm/operations/ods/wait-for-clone.d.ts +46 -0
- package/dist/esm/operations/ods/wait-for-clone.js +100 -0
- package/dist/esm/operations/ods/wait-for-clone.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -16,8 +16,9 @@ export { executeJob, getJobExecution, waitForJob, searchJobExecutions, findRunni
|
|
|
16
16
|
export type { JobExecution, JobStepExecution, JobExecutionStatus, JobExecutionParameter, ExecuteJobOptions, WaitForJobOptions, SearchJobExecutionsOptions, JobExecutionSearchResult, SiteArchiveImportOptions, SiteArchiveImportResult, SiteArchiveExportOptions, SiteArchiveExportResult, ExportDataUnitsConfiguration, ExportSitesConfiguration, ExportGlobalDataConfiguration, } from './operations/jobs/index.js';
|
|
17
17
|
export { searchDocs, readDoc, readDocByQuery, listDocs, loadSearchIndex, listSchemas, readSchema, readSchemaByQuery, searchSchemas, downloadDocs, } from './docs/index.js';
|
|
18
18
|
export type { DocEntry, SearchIndex, SearchResult, SchemaEntry, SchemaIndex, SchemaSearchResult, DownloadDocsOptions, DownloadDocsResult, } from './docs/index.js';
|
|
19
|
-
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './operations/ods/index.js';
|
|
19
|
+
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError, } from './operations/ods/index.js';
|
|
20
20
|
export type { SandboxState, WaitForSandboxOptions, WaitForSandboxPollInfo } from './operations/ods/index.js';
|
|
21
|
+
export type { CloneState, WaitForCloneOptions, WaitForClonePollInfo } from './operations/ods/index.js';
|
|
21
22
|
export { buildCipReportSql, describeCipTable, executeCipReport, getCipReportByName, listCipReports, listCipTables, } from './operations/cip/index.js';
|
|
22
23
|
export type { CipColumnMetadata, CipDescribeTableOptions, CipDescribeTableResult, CipListTablesOptions, CipListTablesResult, CipReportDefinition, CipReportExecutionOptions, CipReportParamType, CipReportParamDefinition, CipReportQueryExecutor, CipReportQueryResult, CipReportSqlResult, CipTableMetadata, } from './operations/cip/index.js';
|
|
23
24
|
export { getUser, getUserByLogin, listUsers, createUser, updateUser, deleteUser, purgeUser, resetUser, grantRole, revokeRole, } from './operations/users/index.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { executeJob, getJobExecution, waitForJob, searchJobExecutions, findRunni
|
|
|
21
21
|
// Docs - Documentation search
|
|
22
22
|
export { searchDocs, readDoc, readDocByQuery, listDocs, loadSearchIndex, listSchemas, readSchema, readSchemaByQuery, searchSchemas, downloadDocs, } from './docs/index.js';
|
|
23
23
|
// Operations - ODS
|
|
24
|
-
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './operations/ods/index.js';
|
|
24
|
+
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError, } from './operations/ods/index.js';
|
|
25
25
|
// Operations - CIP
|
|
26
26
|
export { buildCipReportSql, describeCipTable, executeCipReport, getCipReportByName, listCipReports, listCipTables, } from './operations/cip/index.js';
|
|
27
27
|
// Operations - Users
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAG7G,OAAO;AACP,OAAO,EAAC,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAGlH,SAAS;AACT,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAe9G,yCAAyC;AACzC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAiBzB,2BAA2B;AAC3B,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAGhD,UAAU;AACV,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,EAC9B,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AA2E5B,oBAAoB;AACpB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAYpC,oBAAoB;AACpB,OAAO,EACL,UAAU,EACV,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AAmBpC,8BAA8B;AAC9B,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AAYzB,mBAAmB;AACnB,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAG7G,OAAO;AACP,OAAO,EAAC,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EA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,GACxB,MAAM,4BAA4B,CAAC;AAmBpC,8BAA8B;AAC9B,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AAYzB,mBAAmB;AACnB,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAKnC,mBAAmB;AACnB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AAiBnC,qBAAqB;AACrB,OAAO,EACL,OAAO,EACP,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,6BAA6B,CAAC;AAErC,qBAAqB;AACrB,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE/D,6BAA6B;AAC7B,OAAO,EAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,4BAA4B,CAAC;AAE1E,WAAW;AACX,OAAO,EAAC,4BAA4B,EAAE,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAEvG,eAAe;AACf,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC"}
|
|
@@ -6,3 +6,5 @@
|
|
|
6
6
|
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, } from './sandbox-lookup.js';
|
|
7
7
|
export { waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './wait-for-sandbox.js';
|
|
8
8
|
export type { SandboxState, WaitForSandboxOptions, WaitForSandboxPollInfo } from './wait-for-sandbox.js';
|
|
9
|
+
export { waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError } from './wait-for-clone.js';
|
|
10
|
+
export type { CloneState, WaitForCloneOptions, WaitForClonePollInfo } from './wait-for-clone.js';
|
|
@@ -10,4 +10,5 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, } from './sandbox-lookup.js';
|
|
12
12
|
export { waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './wait-for-sandbox.js';
|
|
13
|
+
export { waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError } from './wait-for-clone.js';
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/operations/ods/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/operations/ods/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { OdsClient } from '../../clients/ods.js';
|
|
2
|
+
export type CloneState = 'COMPLETED' | 'FAILED' | 'IN_PROGRESS' | 'PENDING' | (string & {});
|
|
3
|
+
export declare class ClonePollingTimeoutError extends Error {
|
|
4
|
+
readonly sandboxId: string;
|
|
5
|
+
readonly cloneId: string;
|
|
6
|
+
readonly timeoutSeconds: number;
|
|
7
|
+
readonly lastStatus?: CloneState | undefined;
|
|
8
|
+
constructor(sandboxId: string, cloneId: string, timeoutSeconds: number, lastStatus?: CloneState | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare class ClonePollingError extends Error {
|
|
11
|
+
readonly sandboxId: string;
|
|
12
|
+
readonly cloneId: string;
|
|
13
|
+
constructor(sandboxId: string, cloneId: string, message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class CloneFailedError extends Error {
|
|
16
|
+
readonly sandboxId: string;
|
|
17
|
+
readonly cloneId: string;
|
|
18
|
+
readonly status: CloneState;
|
|
19
|
+
constructor(sandboxId: string, cloneId: string, status: CloneState);
|
|
20
|
+
}
|
|
21
|
+
export interface WaitForClonePollInfo {
|
|
22
|
+
sandboxId: string;
|
|
23
|
+
cloneId: string;
|
|
24
|
+
elapsedSeconds: number;
|
|
25
|
+
status: CloneState;
|
|
26
|
+
progressPercentage?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface WaitForCloneOptions {
|
|
29
|
+
sandboxId: string;
|
|
30
|
+
cloneId: string;
|
|
31
|
+
pollIntervalSeconds: number;
|
|
32
|
+
timeoutSeconds: number;
|
|
33
|
+
onPoll?: (info: WaitForClonePollInfo) => void;
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Waits for a sandbox clone to reach COMPLETED or FAILED state by polling its status.
|
|
38
|
+
*
|
|
39
|
+
* @param client - ODS client for API calls
|
|
40
|
+
* @param options - Polling configuration options
|
|
41
|
+
*
|
|
42
|
+
* @throws {ClonePollingTimeoutError} If the timeout is exceeded before completion
|
|
43
|
+
* @throws {ClonePollingError} If the API request fails
|
|
44
|
+
* @throws {CloneFailedError} If the clone enters the FAILED state
|
|
45
|
+
*/
|
|
46
|
+
export declare function waitForClone(client: OdsClient, options: WaitForCloneOptions): Promise<void>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { getLogger } from '../../logging/logger.js';
|
|
7
|
+
export class ClonePollingTimeoutError extends Error {
|
|
8
|
+
sandboxId;
|
|
9
|
+
cloneId;
|
|
10
|
+
timeoutSeconds;
|
|
11
|
+
lastStatus;
|
|
12
|
+
constructor(sandboxId, cloneId, timeoutSeconds, lastStatus) {
|
|
13
|
+
super(`Timeout waiting for clone ${cloneId} of sandbox ${sandboxId} after ${timeoutSeconds} seconds${lastStatus ? ` (lastStatus=${lastStatus})` : ''}`);
|
|
14
|
+
this.sandboxId = sandboxId;
|
|
15
|
+
this.cloneId = cloneId;
|
|
16
|
+
this.timeoutSeconds = timeoutSeconds;
|
|
17
|
+
this.lastStatus = lastStatus;
|
|
18
|
+
this.name = 'ClonePollingTimeoutError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class ClonePollingError extends Error {
|
|
22
|
+
sandboxId;
|
|
23
|
+
cloneId;
|
|
24
|
+
constructor(sandboxId, cloneId, message) {
|
|
25
|
+
super(`Failed to fetch clone status for ${cloneId} of sandbox ${sandboxId}: ${message}`);
|
|
26
|
+
this.sandboxId = sandboxId;
|
|
27
|
+
this.cloneId = cloneId;
|
|
28
|
+
this.name = 'ClonePollingError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class CloneFailedError extends Error {
|
|
32
|
+
sandboxId;
|
|
33
|
+
cloneId;
|
|
34
|
+
status;
|
|
35
|
+
constructor(sandboxId, cloneId, status) {
|
|
36
|
+
super(`Clone ${cloneId} of sandbox ${sandboxId} failed`);
|
|
37
|
+
this.sandboxId = sandboxId;
|
|
38
|
+
this.cloneId = cloneId;
|
|
39
|
+
this.status = status;
|
|
40
|
+
this.name = 'CloneFailedError';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function defaultSleep(ms) {
|
|
44
|
+
await new Promise((resolve) => {
|
|
45
|
+
setTimeout(resolve, ms);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Waits for a sandbox clone to reach COMPLETED or FAILED state by polling its status.
|
|
50
|
+
*
|
|
51
|
+
* @param client - ODS client for API calls
|
|
52
|
+
* @param options - Polling configuration options
|
|
53
|
+
*
|
|
54
|
+
* @throws {ClonePollingTimeoutError} If the timeout is exceeded before completion
|
|
55
|
+
* @throws {ClonePollingError} If the API request fails
|
|
56
|
+
* @throws {CloneFailedError} If the clone enters the FAILED state
|
|
57
|
+
*/
|
|
58
|
+
export async function waitForClone(client, options) {
|
|
59
|
+
const logger = getLogger();
|
|
60
|
+
const { sandboxId, cloneId, pollIntervalSeconds, timeoutSeconds } = options;
|
|
61
|
+
const sleepFn = options.sleep ?? defaultSleep;
|
|
62
|
+
const startTime = Date.now();
|
|
63
|
+
const pollIntervalMs = pollIntervalSeconds * 1000;
|
|
64
|
+
const timeoutMs = timeoutSeconds * 1000;
|
|
65
|
+
await sleepFn(pollIntervalMs);
|
|
66
|
+
let lastStatus;
|
|
67
|
+
while (true) {
|
|
68
|
+
const elapsedSeconds = Math.round((Date.now() - startTime) / 1000);
|
|
69
|
+
if (timeoutSeconds > 0 && Date.now() - startTime > timeoutMs) {
|
|
70
|
+
throw new ClonePollingTimeoutError(sandboxId, cloneId, timeoutSeconds, lastStatus);
|
|
71
|
+
}
|
|
72
|
+
const result = await client.GET('/sandboxes/{sandboxId}/clones/{cloneId}', {
|
|
73
|
+
params: {
|
|
74
|
+
path: { sandboxId, cloneId },
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (!result.data?.data) {
|
|
78
|
+
throw new ClonePollingError(sandboxId, cloneId, result.response?.statusText || 'Unknown error');
|
|
79
|
+
}
|
|
80
|
+
const clone = result.data.data;
|
|
81
|
+
const currentStatus = clone.status || 'unknown';
|
|
82
|
+
lastStatus = currentStatus;
|
|
83
|
+
logger.trace({ sandboxId, cloneId, elapsedSeconds, status: currentStatus }, '[ODS] Clone poll');
|
|
84
|
+
options.onPoll?.({
|
|
85
|
+
sandboxId,
|
|
86
|
+
cloneId,
|
|
87
|
+
elapsedSeconds,
|
|
88
|
+
status: currentStatus,
|
|
89
|
+
progressPercentage: clone.progressPercentage,
|
|
90
|
+
});
|
|
91
|
+
if (currentStatus === 'COMPLETED') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (currentStatus === 'FAILED') {
|
|
95
|
+
throw new CloneFailedError(sandboxId, cloneId, currentStatus);
|
|
96
|
+
}
|
|
97
|
+
await sleepFn(pollIntervalMs);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=wait-for-clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-clone.js","sourceRoot":"","sources":["../../../../src/operations/ods/wait-for-clone.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAIlD,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAE/B;IACA;IACA;IACA;IAJlB,YACkB,SAAiB,EACjB,OAAe,EACf,cAAsB,EACtB,UAAuB;QAEvC,KAAK,CACH,6BAA6B,OAAO,eAAe,SAAS,UAAU,cAAc,WAClF,UAAU,CAAC,CAAC,C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aAAa,EAAC,EAAE,kBAAkB,CAAC,CAAC;QAC9F,OAAO,CAAC,MAAM,EAAE,CAAC;YACf,SAAS;YACT,OAAO;YACP,cAAc;YACd,MAAM,EAAE,aAAa;YACrB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;SAC7C,CAAC,CAAC;QAEH,IAAI,aAAa,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO;QACT,CAAC;QAED,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -16,8 +16,9 @@ export { executeJob, getJobExecution, waitForJob, searchJobExecutions, findRunni
|
|
|
16
16
|
export type { JobExecution, JobStepExecution, JobExecutionStatus, JobExecutionParameter, ExecuteJobOptions, WaitForJobOptions, SearchJobExecutionsOptions, JobExecutionSearchResult, SiteArchiveImportOptions, SiteArchiveImportResult, SiteArchiveExportOptions, SiteArchiveExportResult, ExportDataUnitsConfiguration, ExportSitesConfiguration, ExportGlobalDataConfiguration, } from './operations/jobs/index.js';
|
|
17
17
|
export { searchDocs, readDoc, readDocByQuery, listDocs, loadSearchIndex, listSchemas, readSchema, readSchemaByQuery, searchSchemas, downloadDocs, } from './docs/index.js';
|
|
18
18
|
export type { DocEntry, SearchIndex, SearchResult, SchemaEntry, SchemaIndex, SchemaSearchResult, DownloadDocsOptions, DownloadDocsResult, } from './docs/index.js';
|
|
19
|
-
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './operations/ods/index.js';
|
|
19
|
+
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError, } from './operations/ods/index.js';
|
|
20
20
|
export type { SandboxState, WaitForSandboxOptions, WaitForSandboxPollInfo } from './operations/ods/index.js';
|
|
21
|
+
export type { CloneState, WaitForCloneOptions, WaitForClonePollInfo } from './operations/ods/index.js';
|
|
21
22
|
export { buildCipReportSql, describeCipTable, executeCipReport, getCipReportByName, listCipReports, listCipTables, } from './operations/cip/index.js';
|
|
22
23
|
export type { CipColumnMetadata, CipDescribeTableOptions, CipDescribeTableResult, CipListTablesOptions, CipListTablesResult, CipReportDefinition, CipReportExecutionOptions, CipReportParamType, CipReportParamDefinition, CipReportQueryExecutor, CipReportQueryResult, CipReportSqlResult, CipTableMetadata, } from './operations/cip/index.js';
|
|
23
24
|
export { getUser, getUserByLogin, listUsers, createUser, updateUser, deleteUser, purgeUser, resetUser, grantRole, revokeRole, } from './operations/users/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { executeJob, getJobExecution, waitForJob, searchJobExecutions, findRunni
|
|
|
21
21
|
// Docs - Documentation search
|
|
22
22
|
export { searchDocs, readDoc, readDocByQuery, listDocs, loadSearchIndex, listSchemas, readSchema, readSchemaByQuery, searchSchemas, downloadDocs, } from './docs/index.js';
|
|
23
23
|
// Operations - ODS
|
|
24
|
-
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './operations/ods/index.js';
|
|
24
|
+
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError, } from './operations/ods/index.js';
|
|
25
25
|
// Operations - CIP
|
|
26
26
|
export { buildCipReportSql, describeCipTable, executeCipReport, getCipReportByName, listCipReports, listCipTables, } from './operations/cip/index.js';
|
|
27
27
|
// Operations - Users
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAG7G,OAAO;AACP,OAAO,EAAC,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAGlH,SAAS;AACT,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAe9G,yCAAyC;AACzC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAiBzB,2BAA2B;AAC3B,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAGhD,UAAU;AACV,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,EAC9B,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AA2E5B,oBAAoB;AACpB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAYpC,oBAAoB;AACpB,OAAO,EACL,UAAU,EACV,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AAmBpC,8BAA8B;AAC9B,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AAYzB,mBAAmB;AACnB,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAG7G,OAAO;AACP,OAAO,EAAC,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAGlH,SAAS;AACT,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAe9G,yCAAyC;AACzC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,SAAS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B,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAKnC,mBAAmB;AACnB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AAiBnC,qBAAqB;AACrB,OAAO,EACL,OAAO,EACP,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,6BAA6B,CAAC;AAErC,qBAAqB;AACrB,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE/D,6BAA6B;AAC7B,OAAO,EAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,4BAA4B,CAAC;AAE1E,WAAW;AACX,OAAO,EAAC,4BAA4B,EAAE,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAEvG,eAAe;AACf,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC"}
|
|
@@ -6,3 +6,5 @@
|
|
|
6
6
|
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, } from './sandbox-lookup.js';
|
|
7
7
|
export { waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './wait-for-sandbox.js';
|
|
8
8
|
export type { SandboxState, WaitForSandboxOptions, WaitForSandboxPollInfo } from './wait-for-sandbox.js';
|
|
9
|
+
export { waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError } from './wait-for-clone.js';
|
|
10
|
+
export type { CloneState, WaitForCloneOptions, WaitForClonePollInfo } from './wait-for-clone.js';
|
|
@@ -10,4 +10,5 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { isUuid, isFriendlySandboxId, parseFriendlySandboxId, resolveSandboxId, SandboxNotFoundError, } from './sandbox-lookup.js';
|
|
12
12
|
export { waitForSandbox, SandboxPollingTimeoutError, SandboxPollingError, SandboxTerminalStateError, } from './wait-for-sandbox.js';
|
|
13
|
+
export { waitForClone, ClonePollingTimeoutError, ClonePollingError, CloneFailedError } from './wait-for-clone.js';
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/operations/ods/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/operations/ods/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { OdsClient } from '../../clients/ods.js';
|
|
2
|
+
export type CloneState = 'COMPLETED' | 'FAILED' | 'IN_PROGRESS' | 'PENDING' | (string & {});
|
|
3
|
+
export declare class ClonePollingTimeoutError extends Error {
|
|
4
|
+
readonly sandboxId: string;
|
|
5
|
+
readonly cloneId: string;
|
|
6
|
+
readonly timeoutSeconds: number;
|
|
7
|
+
readonly lastStatus?: CloneState | undefined;
|
|
8
|
+
constructor(sandboxId: string, cloneId: string, timeoutSeconds: number, lastStatus?: CloneState | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare class ClonePollingError extends Error {
|
|
11
|
+
readonly sandboxId: string;
|
|
12
|
+
readonly cloneId: string;
|
|
13
|
+
constructor(sandboxId: string, cloneId: string, message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class CloneFailedError extends Error {
|
|
16
|
+
readonly sandboxId: string;
|
|
17
|
+
readonly cloneId: string;
|
|
18
|
+
readonly status: CloneState;
|
|
19
|
+
constructor(sandboxId: string, cloneId: string, status: CloneState);
|
|
20
|
+
}
|
|
21
|
+
export interface WaitForClonePollInfo {
|
|
22
|
+
sandboxId: string;
|
|
23
|
+
cloneId: string;
|
|
24
|
+
elapsedSeconds: number;
|
|
25
|
+
status: CloneState;
|
|
26
|
+
progressPercentage?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface WaitForCloneOptions {
|
|
29
|
+
sandboxId: string;
|
|
30
|
+
cloneId: string;
|
|
31
|
+
pollIntervalSeconds: number;
|
|
32
|
+
timeoutSeconds: number;
|
|
33
|
+
onPoll?: (info: WaitForClonePollInfo) => void;
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Waits for a sandbox clone to reach COMPLETED or FAILED state by polling its status.
|
|
38
|
+
*
|
|
39
|
+
* @param client - ODS client for API calls
|
|
40
|
+
* @param options - Polling configuration options
|
|
41
|
+
*
|
|
42
|
+
* @throws {ClonePollingTimeoutError} If the timeout is exceeded before completion
|
|
43
|
+
* @throws {ClonePollingError} If the API request fails
|
|
44
|
+
* @throws {CloneFailedError} If the clone enters the FAILED state
|
|
45
|
+
*/
|
|
46
|
+
export declare function waitForClone(client: OdsClient, options: WaitForCloneOptions): Promise<void>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { getLogger } from '../../logging/logger.js';
|
|
7
|
+
export class ClonePollingTimeoutError extends Error {
|
|
8
|
+
sandboxId;
|
|
9
|
+
cloneId;
|
|
10
|
+
timeoutSeconds;
|
|
11
|
+
lastStatus;
|
|
12
|
+
constructor(sandboxId, cloneId, timeoutSeconds, lastStatus) {
|
|
13
|
+
super(`Timeout waiting for clone ${cloneId} of sandbox ${sandboxId} after ${timeoutSeconds} seconds${lastStatus ? ` (lastStatus=${lastStatus})` : ''}`);
|
|
14
|
+
this.sandboxId = sandboxId;
|
|
15
|
+
this.cloneId = cloneId;
|
|
16
|
+
this.timeoutSeconds = timeoutSeconds;
|
|
17
|
+
this.lastStatus = lastStatus;
|
|
18
|
+
this.name = 'ClonePollingTimeoutError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class ClonePollingError extends Error {
|
|
22
|
+
sandboxId;
|
|
23
|
+
cloneId;
|
|
24
|
+
constructor(sandboxId, cloneId, message) {
|
|
25
|
+
super(`Failed to fetch clone status for ${cloneId} of sandbox ${sandboxId}: ${message}`);
|
|
26
|
+
this.sandboxId = sandboxId;
|
|
27
|
+
this.cloneId = cloneId;
|
|
28
|
+
this.name = 'ClonePollingError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class CloneFailedError extends Error {
|
|
32
|
+
sandboxId;
|
|
33
|
+
cloneId;
|
|
34
|
+
status;
|
|
35
|
+
constructor(sandboxId, cloneId, status) {
|
|
36
|
+
super(`Clone ${cloneId} of sandbox ${sandboxId} failed`);
|
|
37
|
+
this.sandboxId = sandboxId;
|
|
38
|
+
this.cloneId = cloneId;
|
|
39
|
+
this.status = status;
|
|
40
|
+
this.name = 'CloneFailedError';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function defaultSleep(ms) {
|
|
44
|
+
await new Promise((resolve) => {
|
|
45
|
+
setTimeout(resolve, ms);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Waits for a sandbox clone to reach COMPLETED or FAILED state by polling its status.
|
|
50
|
+
*
|
|
51
|
+
* @param client - ODS client for API calls
|
|
52
|
+
* @param options - Polling configuration options
|
|
53
|
+
*
|
|
54
|
+
* @throws {ClonePollingTimeoutError} If the timeout is exceeded before completion
|
|
55
|
+
* @throws {ClonePollingError} If the API request fails
|
|
56
|
+
* @throws {CloneFailedError} If the clone enters the FAILED state
|
|
57
|
+
*/
|
|
58
|
+
export async function waitForClone(client, options) {
|
|
59
|
+
const logger = getLogger();
|
|
60
|
+
const { sandboxId, cloneId, pollIntervalSeconds, timeoutSeconds } = options;
|
|
61
|
+
const sleepFn = options.sleep ?? defaultSleep;
|
|
62
|
+
const startTime = Date.now();
|
|
63
|
+
const pollIntervalMs = pollIntervalSeconds * 1000;
|
|
64
|
+
const timeoutMs = timeoutSeconds * 1000;
|
|
65
|
+
await sleepFn(pollIntervalMs);
|
|
66
|
+
let lastStatus;
|
|
67
|
+
while (true) {
|
|
68
|
+
const elapsedSeconds = Math.round((Date.now() - startTime) / 1000);
|
|
69
|
+
if (timeoutSeconds > 0 && Date.now() - startTime > timeoutMs) {
|
|
70
|
+
throw new ClonePollingTimeoutError(sandboxId, cloneId, timeoutSeconds, lastStatus);
|
|
71
|
+
}
|
|
72
|
+
const result = await client.GET('/sandboxes/{sandboxId}/clones/{cloneId}', {
|
|
73
|
+
params: {
|
|
74
|
+
path: { sandboxId, cloneId },
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (!result.data?.data) {
|
|
78
|
+
throw new ClonePollingError(sandboxId, cloneId, result.response?.statusText || 'Unknown error');
|
|
79
|
+
}
|
|
80
|
+
const clone = result.data.data;
|
|
81
|
+
const currentStatus = clone.status || 'unknown';
|
|
82
|
+
lastStatus = currentStatus;
|
|
83
|
+
logger.trace({ sandboxId, cloneId, elapsedSeconds, status: currentStatus }, '[ODS] Clone poll');
|
|
84
|
+
options.onPoll?.({
|
|
85
|
+
sandboxId,
|
|
86
|
+
cloneId,
|
|
87
|
+
elapsedSeconds,
|
|
88
|
+
status: currentStatus,
|
|
89
|
+
progressPercentage: clone.progressPercentage,
|
|
90
|
+
});
|
|
91
|
+
if (currentStatus === 'COMPLETED') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (currentStatus === 'FAILED') {
|
|
95
|
+
throw new CloneFailedError(sandboxId, cloneId, currentStatus);
|
|
96
|
+
}
|
|
97
|
+
await sleepFn(pollIntervalMs);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=wait-for-clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-clone.js","sourceRoot":"","sources":["../../../../src/operations/ods/wait-for-clone.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAIlD,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAE/B;IACA;IACA;IACA;IAJlB,YACkB,SAAiB,EACjB,OAAe,EACf,cAAsB,EACtB,UAAuB;QAEvC,KAAK,CACH,6BAA6B,OAAO,eAAe,SAAS,UAAU,cAAc,WAClF,UAAU,CAAC,CAAC,CAAC,gBAAgB,UAAU,GAAG,CAAC,CAAC,CAAC,EAC/C,EAAE,CACH,CAAC;QATc,cAAS,GAAT,SAAS,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,mBAAc,GAAd,cAAc,CAAQ;QACtB,eAAU,GAAV,UAAU,CAAa;QAOvC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF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AAC;QAED,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/b2c-tooling-sdk",
|
|
3
3
|
"description": "Core tooling library for Salesforce B2C Commerce CLI",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"author": "Charles Lavery",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "SalesforceCommerceCloud/b2c-developer-tooling",
|