prodlysfcli 1.0.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/README.md +271 -0
- package/lib/commands/prodly/checkin.d.ts +19 -0
- package/lib/commands/prodly/checkin.js +123 -0
- package/lib/commands/prodly/checkin.js.map +1 -0
- package/lib/commands/prodly/checkout.d.ts +20 -0
- package/lib/commands/prodly/checkout.js +130 -0
- package/lib/commands/prodly/checkout.js.map +1 -0
- package/lib/commands/prodly/deploy.d.ts +26 -0
- package/lib/commands/prodly/deploy.js +262 -0
- package/lib/commands/prodly/deploy.js.map +1 -0
- package/lib/commands/prodly/jobs.d.ts +15 -0
- package/lib/commands/prodly/jobs.js +33 -0
- package/lib/commands/prodly/jobs.js.map +1 -0
- package/lib/commands/prodly/manage.d.ts +24 -0
- package/lib/commands/prodly/manage.js +167 -0
- package/lib/commands/prodly/manage.js.map +1 -0
- package/lib/constants/index.d.ts +5 -0
- package/lib/constants/index.js +6 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/services/connections.d.ts +7 -0
- package/lib/services/connections.js +109 -0
- package/lib/services/connections.js.map +1 -0
- package/lib/services/connections.types.d.ts +31 -0
- package/lib/services/connections.types.js +2 -0
- package/lib/services/connections.types.js.map +1 -0
- package/lib/services/instances.d.ts +7 -0
- package/lib/services/instances.js +94 -0
- package/lib/services/instances.js.map +1 -0
- package/lib/services/instances.types.d.ts +40 -0
- package/lib/services/instances.types.js +2 -0
- package/lib/services/instances.types.js.map +1 -0
- package/lib/services/jobs.d.ts +4 -0
- package/lib/services/jobs.js +26 -0
- package/lib/services/jobs.js.map +1 -0
- package/lib/services/jobs.types.d.ts +13 -0
- package/lib/services/jobs.types.js +2 -0
- package/lib/services/jobs.types.js.map +1 -0
- package/lib/services/queries.d.ts +8 -0
- package/lib/services/queries.js +54 -0
- package/lib/services/queries.js.map +1 -0
- package/lib/types/prodly.d.ts +67 -0
- package/lib/types/prodly.js +2 -0
- package/lib/types/prodly.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/index.js.map +1 -0
- package/messages/prodly.checkin.md +15 -0
- package/messages/prodly.checkout.md +15 -0
- package/messages/prodly.deploy.md +14 -0
- package/messages/prodly.jobs.md +8 -0
- package/messages/prodly.json +43 -0
- package/messages/prodly.manage.md +12 -0
- package/oclif.lock +8039 -0
- package/oclif.manifest.json +557 -0
- package/package.json +189 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
3
|
+
import { ORG_ID_REG_EXP, ORG_TYPE_PRODUCTION, ORG_TYPE_SANDBOX, ORG_TYPE_SCRATCH_ORG } from '../constants/index.js';
|
|
4
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
5
|
+
const prodlyMessages = Messages.loadMessages('prodlysfcli', 'prodly');
|
|
6
|
+
const createConnection = async ({ hubConn, name, org }) => {
|
|
7
|
+
const trailSlashRegex = /\/$/;
|
|
8
|
+
let type = '';
|
|
9
|
+
if (await org.determineIfScratch())
|
|
10
|
+
type = ORG_TYPE_SCRATCH_ORG;
|
|
11
|
+
else if (await org.determineIfSandbox())
|
|
12
|
+
type = ORG_TYPE_SANDBOX;
|
|
13
|
+
else
|
|
14
|
+
type = ORG_TYPE_PRODUCTION;
|
|
15
|
+
const connection = {
|
|
16
|
+
Name: name ? name : `${org.getUsername()} ${org.getOrgId()}`,
|
|
17
|
+
PDRI__Access_Token__c: org.getConnection().getConnectionOptions().accessToken,
|
|
18
|
+
PDRI__Active__c: true,
|
|
19
|
+
PDRI__Instance_URL__c: org.getConnection().getConnectionOptions().instanceUrl?.replace(trailSlashRegex, ''),
|
|
20
|
+
PDRI__Org_Type__c: type,
|
|
21
|
+
PDRI__OrganizationId__c: org.getOrgId(),
|
|
22
|
+
PDRI__User_Id__c: org.getConnection().getConnectionOptions().userId,
|
|
23
|
+
PDRI__Username__c: org.getUsername(),
|
|
24
|
+
};
|
|
25
|
+
const retrievedConnection = await hubConn.create('PDRI__Connection__c', connection);
|
|
26
|
+
return retrievedConnection.id;
|
|
27
|
+
};
|
|
28
|
+
const getConnectionId = async ({ hubConn, orgId, print }) => {
|
|
29
|
+
if (print)
|
|
30
|
+
print(`Retrieving the connection record ID for org ${orgId}.`);
|
|
31
|
+
const query = `
|
|
32
|
+
SELECT
|
|
33
|
+
Id
|
|
34
|
+
FROM
|
|
35
|
+
PDRI__Connection__c
|
|
36
|
+
WHERE
|
|
37
|
+
PDRI__OrganizationId__c = '${orgId}' AND PDRI__Active__c = true
|
|
38
|
+
ORDER BY
|
|
39
|
+
CreatedDate DESC
|
|
40
|
+
LIMIT 1`;
|
|
41
|
+
if (print)
|
|
42
|
+
print('Running query: ' + query);
|
|
43
|
+
// Query the org
|
|
44
|
+
const result = await hubConn.query(query);
|
|
45
|
+
if (print)
|
|
46
|
+
print('Query result: ', result);
|
|
47
|
+
if (!result?.records || result.records.length === 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (print)
|
|
51
|
+
print('Connection record: ' + result.records[0].Id);
|
|
52
|
+
return result.records[0].Id;
|
|
53
|
+
};
|
|
54
|
+
const queryConnection = async ({ connectionNameOrId, hubConn, print }) => {
|
|
55
|
+
if (print)
|
|
56
|
+
print('Querying connection: ' + connectionNameOrId);
|
|
57
|
+
const isId = ORG_ID_REG_EXP.test(connectionNameOrId);
|
|
58
|
+
const query = `
|
|
59
|
+
SELECT
|
|
60
|
+
Id, Name, PDRI__OrganizationId__c
|
|
61
|
+
FROM
|
|
62
|
+
PDRI__Connection__c
|
|
63
|
+
WHERE
|
|
64
|
+
PDRI__Active__c = true AND ${isId ? 'Id' : 'Name'} = '${connectionNameOrId}'
|
|
65
|
+
ORDER BY
|
|
66
|
+
lastmodifieddate DESC
|
|
67
|
+
LIMIT 1`;
|
|
68
|
+
if (print)
|
|
69
|
+
print(`Running source query:${query}`);
|
|
70
|
+
const result = await hubConn.query(query);
|
|
71
|
+
if (!result?.records || result.records.length === 0) {
|
|
72
|
+
throw new SfError(prodlyMessages.getMessage('errorNoConnectionFound', [connectionNameOrId]));
|
|
73
|
+
}
|
|
74
|
+
return result.records[0];
|
|
75
|
+
};
|
|
76
|
+
const queryConnections = async ({ connectionIds, hubConn, print }) => {
|
|
77
|
+
if (print)
|
|
78
|
+
print('Querying connections');
|
|
79
|
+
if (connectionIds.length === 0) {
|
|
80
|
+
return new Map();
|
|
81
|
+
}
|
|
82
|
+
const query = `
|
|
83
|
+
SELECT
|
|
84
|
+
Id, Name, PDRI__Instance_URL__c
|
|
85
|
+
FROM
|
|
86
|
+
PDRI__Connection__c
|
|
87
|
+
WHERE
|
|
88
|
+
Id IN (${connectionIds.map((connectionId) => `'${connectionId}'`).join(',')})`;
|
|
89
|
+
if (print)
|
|
90
|
+
print('Running source query: ' + query);
|
|
91
|
+
const result = await hubConn.query(query);
|
|
92
|
+
if (!result.records || result.records.length === 0) {
|
|
93
|
+
throw new SfError(prodlyMessages.getMessage('errorNoConnectionFound', connectionIds));
|
|
94
|
+
}
|
|
95
|
+
const connections = new Map();
|
|
96
|
+
result.records.forEach((connection) => {
|
|
97
|
+
connections.set(connection.Id, connection);
|
|
98
|
+
});
|
|
99
|
+
return connections;
|
|
100
|
+
};
|
|
101
|
+
const updateConnection = async ({ connectionId, hubConn, org }) => {
|
|
102
|
+
const connection = {
|
|
103
|
+
Id: connectionId,
|
|
104
|
+
PDRI__Access_Token__c: org.getConnection()?.getConnectionOptions()?.accessToken,
|
|
105
|
+
};
|
|
106
|
+
return hubConn.update('PDRI__Connection__c', connection);
|
|
107
|
+
};
|
|
108
|
+
export { createConnection, getConnectionId, queryConnection, queryConnections, updateConnection };
|
|
109
|
+
//# sourceMappingURL=connections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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QACnD,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;IAE9B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACpC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAuB,KAAK,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;IACpF,MAAM,UAAU,GAAG;QACjB,EAAE,EAAE,YAAY;QAChB,qBAAqB,EAAE,GAAG,CAAC,aAAa,EAAE,EAAE,oBAAoB,EAAE,EAAE,WAAW;KAChF,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Connection, Org } from '@salesforce/core';
|
|
2
|
+
import { SaveResult } from 'jsforce';
|
|
3
|
+
import { ProdlyConnection } from '../types/prodly.js';
|
|
4
|
+
type printFn = (message?: string | undefined, ...args: unknown[]) => void;
|
|
5
|
+
export type CreateConnectionFn = ({ hubConn, name, org, print, }: {
|
|
6
|
+
hubConn: Connection;
|
|
7
|
+
name: string | undefined;
|
|
8
|
+
org: Org;
|
|
9
|
+
print?: printFn;
|
|
10
|
+
}) => Promise<string | undefined>;
|
|
11
|
+
export type GetConnectionIdFn = ({ hubConn, orgId, print, }: {
|
|
12
|
+
hubConn: Connection;
|
|
13
|
+
orgId: string;
|
|
14
|
+
print?: printFn;
|
|
15
|
+
}) => Promise<string | null | undefined>;
|
|
16
|
+
export type QueryConnectionFn = ({ connectionNameOrId, hubConn, print, }: {
|
|
17
|
+
connectionNameOrId: string;
|
|
18
|
+
hubConn: Connection;
|
|
19
|
+
print?: printFn;
|
|
20
|
+
}) => Promise<ProdlyConnection>;
|
|
21
|
+
export type QueryConnectionsFn = ({ connectionIds, hubConn, print, }: {
|
|
22
|
+
connectionIds: string[];
|
|
23
|
+
hubConn: Connection;
|
|
24
|
+
print?: printFn;
|
|
25
|
+
}) => Promise<Map<string, ProdlyConnection>>;
|
|
26
|
+
export type UpdateConnectionFn = ({ connectionId, hubConn, org, }: {
|
|
27
|
+
connectionId: string;
|
|
28
|
+
hubConn: Connection;
|
|
29
|
+
org: Org;
|
|
30
|
+
}) => Promise<SaveResult>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections.types.js","sourceRoot":"","sources":["../../src/services/connections.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GetManagedInstanceFn, GetManagedInstancesFn, ManageInstanceAsyncFn, ManageInstanceFn, UnmanageInstanceFn } from './instances.types.js';
|
|
2
|
+
declare const getManagedInstances: GetManagedInstancesFn;
|
|
3
|
+
declare const getManagedInstance: GetManagedInstanceFn;
|
|
4
|
+
declare const manageInstance: ManageInstanceFn;
|
|
5
|
+
declare const manageInstanceAsync: ManageInstanceAsyncFn;
|
|
6
|
+
declare const unmanageInstance: UnmanageInstanceFn;
|
|
7
|
+
export { getManagedInstance, getManagedInstances, manageInstance, manageInstanceAsync, unmanageInstance };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { SfError } from '@salesforce/core';
|
|
2
|
+
import { delay } from '../utils/index.js';
|
|
3
|
+
import { jobCompletion } from './jobs.js';
|
|
4
|
+
const BASE_PATH = '/services/apexrest/PDRI/v1/instances';
|
|
5
|
+
const getManagedInstances = async ({ hubConn, print }) => {
|
|
6
|
+
if (print)
|
|
7
|
+
print('Retrieving all managed instances.');
|
|
8
|
+
const managedInstances = await hubConn.request(`${hubConn.instanceUrl}${BASE_PATH}`);
|
|
9
|
+
return managedInstances;
|
|
10
|
+
};
|
|
11
|
+
const getManagedInstance = async ({ hubConn, orgId, print }) => {
|
|
12
|
+
if (print)
|
|
13
|
+
print(`Retrieving the managed instance ID for org ${orgId}.`);
|
|
14
|
+
const managedInstances = await getManagedInstances({ hubConn });
|
|
15
|
+
const managedInstance = managedInstances.instances.find((instance) => instance.platformInstanceId === orgId);
|
|
16
|
+
return managedInstance;
|
|
17
|
+
};
|
|
18
|
+
const manageInstance = async ({ body, hubConn, orgId, print }) => {
|
|
19
|
+
if (print) {
|
|
20
|
+
print(`Managing instance for org ID ${orgId}.`);
|
|
21
|
+
print(`Manage instance body: ${JSON.stringify(body)}`);
|
|
22
|
+
}
|
|
23
|
+
const request = {
|
|
24
|
+
body: JSON.stringify(body),
|
|
25
|
+
method: 'POST',
|
|
26
|
+
url: BASE_PATH,
|
|
27
|
+
};
|
|
28
|
+
const res = await hubConn.request(request);
|
|
29
|
+
if (print)
|
|
30
|
+
print(`Manage instance response ${res}.`);
|
|
31
|
+
const jobsWrapper = JSON.parse(res);
|
|
32
|
+
const jobId = jobsWrapper.jobs[0].id;
|
|
33
|
+
if (!jobId) {
|
|
34
|
+
throw new SfError('No job ID returned after submitting an instance to be managed.');
|
|
35
|
+
}
|
|
36
|
+
if (print) {
|
|
37
|
+
print(`Manage instance job ID ${jobId}.`);
|
|
38
|
+
print(`Waiting for completion of the manage instance job ID ${jobId}.`);
|
|
39
|
+
}
|
|
40
|
+
// Currently wait for no jobs to be returned, which mean the job completed, but bad way of doing this.
|
|
41
|
+
let completedJob = null;
|
|
42
|
+
for (let i = 0; i < 1800; i++) {
|
|
43
|
+
if (print)
|
|
44
|
+
print('Calling job completion check.');
|
|
45
|
+
// eslint-disable-next-line no-await-in-loop
|
|
46
|
+
const job = await jobCompletion({ jobId, hubConn, print });
|
|
47
|
+
if (print)
|
|
48
|
+
print('Completed job completion check.');
|
|
49
|
+
if (job) {
|
|
50
|
+
if (print)
|
|
51
|
+
print('Job completed.');
|
|
52
|
+
completedJob = job;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line no-await-in-loop
|
|
56
|
+
await delay(1000);
|
|
57
|
+
}
|
|
58
|
+
if (!completedJob) {
|
|
59
|
+
throw new SfError('Manage instance job did not complete within the allowed time.');
|
|
60
|
+
}
|
|
61
|
+
const managedInstance = JSON.parse(completedJob.resultData);
|
|
62
|
+
return { jobId: completedJob.id, managedInstance };
|
|
63
|
+
};
|
|
64
|
+
const manageInstanceAsync = async ({ body, hubConn, print }) => {
|
|
65
|
+
const request = {
|
|
66
|
+
body: JSON.stringify(body),
|
|
67
|
+
method: 'POST',
|
|
68
|
+
url: BASE_PATH,
|
|
69
|
+
};
|
|
70
|
+
const res = await hubConn.request(request);
|
|
71
|
+
if (print) {
|
|
72
|
+
print('Manage instance response:');
|
|
73
|
+
print(res);
|
|
74
|
+
}
|
|
75
|
+
const jobsWrapper = JSON.parse(res);
|
|
76
|
+
const jobId = jobsWrapper.jobs[0].id;
|
|
77
|
+
if (!jobId) {
|
|
78
|
+
throw new SfError('No job ID returned after submitting an instance to be managed.');
|
|
79
|
+
}
|
|
80
|
+
return jobId;
|
|
81
|
+
};
|
|
82
|
+
const unmanageInstance = async ({ hubConn, instanceId, print }) => {
|
|
83
|
+
if (print)
|
|
84
|
+
print(`Unmanaging instance with ID ${instanceId}.`);
|
|
85
|
+
const path = `${BASE_PATH}/${instanceId}`;
|
|
86
|
+
const request = {
|
|
87
|
+
method: 'DELETE',
|
|
88
|
+
url: path,
|
|
89
|
+
};
|
|
90
|
+
await hubConn.request(request);
|
|
91
|
+
return;
|
|
92
|
+
};
|
|
93
|
+
export { getManagedInstance, getManagedInstances, manageInstance, manageInstanceAsync, unmanageInstance };
|
|
94
|
+
//# sourceMappingURL=instances.js.map
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AI,UAAU,EAAE,CAAC;IAE1C,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,QAAiB;QACzB,GAAG,EAAE,IAAI;KACV,CAAC;IACF,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/B,OAAO;AACT,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { ManagedInstance, ManagedInstances } from '../types/prodly.js';
|
|
3
|
+
type printFn = (message: string) => void;
|
|
4
|
+
export type GetManagedInstancesFn = ({ hubConn, print, }: {
|
|
5
|
+
hubConn: Connection;
|
|
6
|
+
print?: printFn;
|
|
7
|
+
}) => Promise<ManagedInstances>;
|
|
8
|
+
export type GetManagedInstanceFn = ({ hubConn, orgId, print, }: {
|
|
9
|
+
hubConn: Connection;
|
|
10
|
+
orgId: string | undefined;
|
|
11
|
+
print?: printFn;
|
|
12
|
+
}) => Promise<ManagedInstance | undefined>;
|
|
13
|
+
export type ManageInstanceFn = ({ body, hubConn, orgId, print, }: {
|
|
14
|
+
body: {
|
|
15
|
+
[key: string]: {
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
orgId: string;
|
|
20
|
+
hubConn: Connection;
|
|
21
|
+
print?: printFn;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
jobId: string;
|
|
24
|
+
managedInstance: ManagedInstance;
|
|
25
|
+
}>;
|
|
26
|
+
export type ManageInstanceAsyncFn = ({ body, hubConn, print, }: {
|
|
27
|
+
body: {
|
|
28
|
+
[key: string]: {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
hubConn: Connection;
|
|
33
|
+
print?: printFn;
|
|
34
|
+
}) => Promise<string>;
|
|
35
|
+
export type UnmanageInstanceFn = ({ instanceId, hubConn, print, }: {
|
|
36
|
+
instanceId: string;
|
|
37
|
+
hubConn: Connection;
|
|
38
|
+
print?: printFn;
|
|
39
|
+
}) => Promise<void>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instances.types.js","sourceRoot":"","sources":["../../src/services/instances.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JOB_STATUS_COMPLETED } from '../constants/index.js';
|
|
2
|
+
const BASE_PATH = '/services/apexrest/PDRI/v1/jobs';
|
|
3
|
+
const getJob = async ({ hubConn, jobId }) => {
|
|
4
|
+
const path = `${BASE_PATH}/${jobId}`;
|
|
5
|
+
const res = await hubConn.request(`${hubConn.instanceUrl}${path}`);
|
|
6
|
+
const jobsWrapper = JSON.parse(res);
|
|
7
|
+
return jobsWrapper.jobs[0];
|
|
8
|
+
};
|
|
9
|
+
const jobCompletion = async ({ hubConn, jobId, print }) => {
|
|
10
|
+
const path = `${BASE_PATH}/${jobId}`;
|
|
11
|
+
const res = await hubConn.request(`${hubConn.instanceUrl}${path}`);
|
|
12
|
+
if (print)
|
|
13
|
+
print(`Job status result ${JSON.stringify(res)}.`);
|
|
14
|
+
const jobsWrapper = JSON.parse(res);
|
|
15
|
+
const job = jobsWrapper.jobs[0];
|
|
16
|
+
if (print)
|
|
17
|
+
print(`Job status job ${JSON.stringify(job)}.`);
|
|
18
|
+
if (job.status === JOB_STATUS_COMPLETED) {
|
|
19
|
+
return job;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export { getJob, jobCompletion };
|
|
26
|
+
//# sourceMappingURL=jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/services/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA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,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { Job } from '../types/prodly.js';
|
|
3
|
+
type printFn = (message: string) => void;
|
|
4
|
+
export type GetJobFn = ({ hubConn, jobId }: {
|
|
5
|
+
hubConn: Connection;
|
|
6
|
+
jobId: string;
|
|
7
|
+
}) => Promise<Job | undefined>;
|
|
8
|
+
export type JobCompletionFn = ({ hubConn, jobId, print, }: {
|
|
9
|
+
hubConn: Connection;
|
|
10
|
+
jobId: string;
|
|
11
|
+
print?: printFn;
|
|
12
|
+
}) => Promise<Job | undefined>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.types.js","sourceRoot":"","sources":["../../src/services/jobs.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
declare const getDeploymentEntityId: ({ dataEntityFlag, dataEntityType, hubConn, print, }: {
|
|
3
|
+
dataEntityFlag: string;
|
|
4
|
+
dataEntityType: string;
|
|
5
|
+
hubConn: Connection;
|
|
6
|
+
print?: ((message?: string | undefined, ...args: unknown[]) => void) | undefined;
|
|
7
|
+
}) => Promise<string | undefined>;
|
|
8
|
+
export { getDeploymentEntityId };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
2
|
+
import { ORG_ID_REG_EXP } from '../constants/index.js';
|
|
3
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
4
|
+
const prodlyMessages = Messages.loadMessages('prodlysfcli', 'prodly');
|
|
5
|
+
const getDeploymentEntityId = async ({ dataEntityFlag, dataEntityType, hubConn, print, }) => {
|
|
6
|
+
const isId = ORG_ID_REG_EXP.test(dataEntityFlag);
|
|
7
|
+
if (print)
|
|
8
|
+
print('Is org ID: ' + isId);
|
|
9
|
+
let queryWhereClause = '';
|
|
10
|
+
if (isId && dataEntityType === 'PDRI__DataSet__c') {
|
|
11
|
+
queryWhereClause = `PDRI__Active__c = true AND Id = '${dataEntityFlag}' `;
|
|
12
|
+
}
|
|
13
|
+
else if (isId && dataEntityType === 'PDRI__Deployment_Plan__c') {
|
|
14
|
+
queryWhereClause = `Id = '${dataEntityFlag}'`;
|
|
15
|
+
}
|
|
16
|
+
else if (!isId && dataEntityType === 'PDRI__DataSet__c') {
|
|
17
|
+
queryWhereClause = `PDRI__Active__c = true AND Name = '${dataEntityFlag}'`;
|
|
18
|
+
}
|
|
19
|
+
else if (!isId && dataEntityType === 'PDRI__Deployment_Plan__c') {
|
|
20
|
+
queryWhereClause = `Name = '${dataEntityFlag}'`;
|
|
21
|
+
}
|
|
22
|
+
const query = `
|
|
23
|
+
SELECT
|
|
24
|
+
Id, Name
|
|
25
|
+
FROM
|
|
26
|
+
${dataEntityType}
|
|
27
|
+
WHERE
|
|
28
|
+
${queryWhereClause}
|
|
29
|
+
ORDER BY
|
|
30
|
+
lastmodifieddate DESC
|
|
31
|
+
LIMIT ${isId ? 1 : 2}`;
|
|
32
|
+
if (print)
|
|
33
|
+
print('Running query: ' + query);
|
|
34
|
+
const result = await hubConn.query(query);
|
|
35
|
+
if (!result?.records || result.records.length === 0) {
|
|
36
|
+
if (dataEntityType === 'PDRI__DataSet__c') {
|
|
37
|
+
throw new SfError(prodlyMessages.getMessage('errorNoDataSetFound', [dataEntityFlag]));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new SfError(prodlyMessages.getMessage('errorNoDeploymentPlanFound', [dataEntityFlag]));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (result.records.length > 1) {
|
|
44
|
+
if (dataEntityType === 'PDRI__DataSet__c') {
|
|
45
|
+
throw new SfError(prodlyMessages.getMessage('errorMultipleDataSetsFound', [dataEntityFlag]));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
throw new SfError(prodlyMessages.getMessage('errorMultipleDeploymentPlansFound', [dataEntityFlag]));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result.records[0].Id;
|
|
52
|
+
};
|
|
53
|
+
export { getDeploymentEntityId };
|
|
54
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/services/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,cAAc,GAAG,QAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAEtE,MAAM,qBAAqB,GAAG,KAAK,EAAE,EACnC,cAAc,EACd,cAAc,EACd,OAAO,EACP,KAAK,GAMN,EAA+B,EAAE;IAChC,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACjD,IAAI,KAAK;QAAE,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAEvC,IAAI,gBAAgB,GAAG,EAAE,CAAC;IAC1B,IAAI,IAAI,IAAI,cAAc,KAAK,kBAAkB,EAAE,CAAC;QAClD,gBAAgB,GAAG,oCAAoC,cAAc,IAAI,CAAC;IAC5E,CAAC;SAAM,IAAI,IAAI,IAAI,cAAc,KAAK,0BAA0B,EAAE,CAAC;QACjE,gBAAgB,GAAG,SAAS,cAAc,GAAG,CAAC;IAChD,CAAC;SAAM,IAAI,CAAC,IAAI,IAAI,cAAc,KAAK,kBAAkB,EAAE,CAAC;QAC1D,gBAAgB,GAAG,sCAAsC,cAAc,GAAG,CAAC;IAC7E,CAAC;SAAM,IAAI,CAAC,IAAI,IAAI,cAAc,KAAK,0BAA0B,EAAE,CAA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 -0,0 +1,67 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
export type ManagedInstances = {
|
|
3
|
+
instances: ManagedInstance[];
|
|
4
|
+
};
|
|
5
|
+
export type ManagedInstance = {
|
|
6
|
+
connectionId: string;
|
|
7
|
+
controlInstance: boolean;
|
|
8
|
+
id: string;
|
|
9
|
+
instanceName: string;
|
|
10
|
+
instanceType: string;
|
|
11
|
+
instanceUrl: string;
|
|
12
|
+
platformInstanceId: string;
|
|
13
|
+
};
|
|
14
|
+
export type ProdlyConnection = {
|
|
15
|
+
Id: string;
|
|
16
|
+
Name: string;
|
|
17
|
+
PDRI__Instance_URL__c: string;
|
|
18
|
+
PDRI__OrganizationId__c: string;
|
|
19
|
+
};
|
|
20
|
+
export type Jobs = {
|
|
21
|
+
jobs: Job[];
|
|
22
|
+
};
|
|
23
|
+
export type Job = {
|
|
24
|
+
currentStep: string;
|
|
25
|
+
error: string;
|
|
26
|
+
finished: string;
|
|
27
|
+
id: string;
|
|
28
|
+
isBlocking: boolean;
|
|
29
|
+
managedInstanceId: string;
|
|
30
|
+
metadata: string;
|
|
31
|
+
operationType: string;
|
|
32
|
+
resultData: string;
|
|
33
|
+
started: string;
|
|
34
|
+
status: string;
|
|
35
|
+
userId: string;
|
|
36
|
+
};
|
|
37
|
+
export type DeployOptions = {
|
|
38
|
+
dataSetId?: string;
|
|
39
|
+
deactivateAllEvents: boolean;
|
|
40
|
+
deploymentName?: string;
|
|
41
|
+
deploymentNotes?: string;
|
|
42
|
+
deploymentPlanId?: string;
|
|
43
|
+
destinationInstanceId: string;
|
|
44
|
+
hubConn: Connection;
|
|
45
|
+
queryFilter?: string;
|
|
46
|
+
simulation: boolean;
|
|
47
|
+
sourceInstanceId?: string;
|
|
48
|
+
};
|
|
49
|
+
export type CheckoutOptions = {
|
|
50
|
+
branchFlag: string | undefined;
|
|
51
|
+
dataSetId: string | undefined;
|
|
52
|
+
deactivateAllEvents: boolean;
|
|
53
|
+
deploymentNameFlag: string | undefined;
|
|
54
|
+
deploymentNotes: string | undefined;
|
|
55
|
+
deploymentPlanId: string | undefined;
|
|
56
|
+
hubConn: Connection;
|
|
57
|
+
mangedInstanceId: string;
|
|
58
|
+
};
|
|
59
|
+
export type CheckinOptions = {
|
|
60
|
+
branchFlag: string | undefined;
|
|
61
|
+
comment: string | undefined;
|
|
62
|
+
dataSetId: string | undefined;
|
|
63
|
+
deploymentNotes: string | undefined;
|
|
64
|
+
deploymentPlanId: string | undefined;
|
|
65
|
+
hubConn: Connection;
|
|
66
|
+
mangedInstanceId: string;
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prodly.js","sourceRoot":"","sources":["../../src/types/prodly.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAE/F,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
prodly:checkin command
|
|
4
|
+
|
|
5
|
+
# examples
|
|
6
|
+
|
|
7
|
+
- <%= config.bin %> prodly:checkin --target-org test-utxac7gbati9@example.com --target-dev-hub jsmith@acme.com
|
|
8
|
+
Save managed data to the branch associated with the managed instance identified by the target username.
|
|
9
|
+
The instance should be managed by the Prodly account associated with the provided DevHub control org.
|
|
10
|
+
- <%= config.bin %> prodly:checkin -u test-utxac7gbati9@example.com
|
|
11
|
+
Save managed data to the branch associated with the managed instance identified by the target username.
|
|
12
|
+
The instance should be managed by the Prodly account associated with the default DevHub control org.
|
|
13
|
+
- <%= config.bin %> prodly:checkin -i f50616b6-57b1-4941-802f-ee0e2506f217
|
|
14
|
+
Save managed data to the branch associated with the managed instance identified by the provided ID.
|
|
15
|
+
The instance should be managed by the Prodly account associated with the default DevHub control org.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
prodly:checkout command
|
|
4
|
+
|
|
5
|
+
# examples
|
|
6
|
+
|
|
7
|
+
- <%= config.bin %> prodly:checkin --target-org test-utxac7gbati9@example.com --target-dev-hub jsmith@acme.com
|
|
8
|
+
Save managed data to the branch associated with the managed instance identified by the target username.
|
|
9
|
+
The instance should be managed by the Prodly account associated with the provided DevHub control org.
|
|
10
|
+
- <%= config.bin %> prodly:checkin -u test-utxac7gbati9@example.com
|
|
11
|
+
Save managed data to the branch associated with the managed instance identified by the target username.
|
|
12
|
+
The instance should be managed by the Prodly account associated with the default DevHub control org.
|
|
13
|
+
- <%= config.bin %> prodly:checkin -i f50616b6-57b1-4941-802f-ee0e2506f217
|
|
14
|
+
Save managed data to the branch associated with the managed instance identified by the provided ID.
|
|
15
|
+
The instance should be managed by the Prodly account associated with the default DevHub control org.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
prodly:deploy command
|
|
4
|
+
|
|
5
|
+
# examples
|
|
6
|
+
|
|
7
|
+
- <%= config.bin %> prodly:deploy -n scratchorg -u FixesScratchOrg -v MainDevHub
|
|
8
|
+
Command output... deploying from the dev hub, the control org, to the scratch org, auto managed with provided name.
|
|
9
|
+
- <%= config.bin %> prodly:deploy --target-org test-utxac7gbati9@example.com --target-dev-hub jsmith@acme.com
|
|
10
|
+
Command output... deploying from the dev hub, the control org, to the scratch org. Long param names.
|
|
11
|
+
- <%= config.bin %> prodly:deploy -u test-utxac7gbati9@example.com -v jsmith@acme.com -d "UAT Sandbox Connection"
|
|
12
|
+
Command output... deploying from the scratch org to the UAT sandbox, using the named connection record in the dev hub, control org.
|
|
13
|
+
- <%= config.bin %> prodly:deploy --target-org test-utxac7gbati9@example.com --target-dev-hub jsmith@acme.com --source "UAT Sandbox Connection"
|
|
14
|
+
Command output... deploying to the scratch org from the UAT sandbox, using the named connection record in the dev hub, control org. Long param names.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branchFlagDescription": "branch name for deployment",
|
|
3
|
+
"commandDescription": "Launches an Prodly relational data deployment.",
|
|
4
|
+
"commentFlagDescription": "comment for the command versioning commit",
|
|
5
|
+
"connectionFlagDescription": "connection to use for the managed instance",
|
|
6
|
+
"dataSetFlagDescription": "name or record ID of the data set to deploy",
|
|
7
|
+
"deactivateFlagDescription": "deactivate all events for the deployment",
|
|
8
|
+
"deplomentNameFlagDescription": "name for the deployment",
|
|
9
|
+
"deploymentPlanFlagDescription": "name or record ID of the deployment plan to deploy",
|
|
10
|
+
"destinationFlagDescription": "destination managed instance ID",
|
|
11
|
+
"instanceFlagDescription": "managed instance ID on which to perform the action",
|
|
12
|
+
"instanceNameFlagDescription": "connection and managed instance name",
|
|
13
|
+
"listFlagDescription": "list all managed instances",
|
|
14
|
+
"manageFlagDescription": "manage a new instance",
|
|
15
|
+
"notesFlagDescription": "notes for the deployment",
|
|
16
|
+
"printFlagDescription": "print the managed instances in a standard format in addition to returning structured data",
|
|
17
|
+
"queryFilterFlagDescription": "query filter override for a data set deployment",
|
|
18
|
+
"simulationFlagDescription": "perform a data simulation",
|
|
19
|
+
"sourceFlagDescription": "source managed instance ID",
|
|
20
|
+
"unmanageFlagDescription": "unmanage the specified instance",
|
|
21
|
+
"versionFlagDescription": "version the new managed instance, branch created and data deployed to the org",
|
|
22
|
+
"jobIdFlagSummary": "Prodly Job ID",
|
|
23
|
+
|
|
24
|
+
"errorDatasetAndPlanFlags": "Specify either the data set or deployment plan parameter, but not both.",
|
|
25
|
+
"errorDeploymentNameFlag": "Deployment name flag is required.",
|
|
26
|
+
"errorJobNotFound": "Job not found.",
|
|
27
|
+
"errorManageLabelFlag": "Instance name flag is required when managing an instance",
|
|
28
|
+
"errorManagedInstaceNotFound": "Managed instance not found for the specified org id",
|
|
29
|
+
"errorManagedInstaceNotProvided": "Managed instance is not provided for unmanage",
|
|
30
|
+
"errorMultipleDataSetsFound": "Multiple active data sets with the name '%s' found in the dev hub control org.",
|
|
31
|
+
"errorMultipleDeploymentPlansFound": "Multiple deployment plans with the name '%s' found in the dev hub control org.",
|
|
32
|
+
"errorMultipleManageFlags": "Multiple operation flags specified for the manage command",
|
|
33
|
+
"errorNoConnectionFound": "No connection found",
|
|
34
|
+
"errorNoDataSetFound": "No active data set with the name or record ID '%s' found in the dev hub control org.",
|
|
35
|
+
"errorNoDatasetAndPlanFlags": "Specify either the data set or deployment plan parameter.",
|
|
36
|
+
"errorNoDeploymentPlanFound": "No deployment plan with the name or record ID '%s' found in the dev hub control org.",
|
|
37
|
+
"errorNoManageFlags": "No operation flag specified for the manage command",
|
|
38
|
+
"errorNoOrgWithManageFlags": "No org specified with the manage flag",
|
|
39
|
+
"errorPrintFlagNoListFlag": "Print flag only specified with the list operation flag",
|
|
40
|
+
"errorVersionFlagNoManageFlag": "Version flag only specified with the manage operation flag",
|
|
41
|
+
|
|
42
|
+
"unmanageInstancePrompt": "Unmanaging is a destructive and irreversible change which will delete all record mappings for this instance. Provide the instance ID if you are sure you want to continue? "
|
|
43
|
+
}
|