@salesforce/source-deploy-retrieve 6.9.1 → 7.0.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.
Files changed (96) hide show
  1. package/lib/src/client/diagnosticUtil.d.ts +0 -2
  2. package/lib/src/client/diagnosticUtil.js +23 -25
  3. package/lib/src/client/diagnosticUtil.js.map +1 -1
  4. package/lib/src/client/index.d.ts +1 -2
  5. package/lib/src/client/index.js +1 -3
  6. package/lib/src/client/index.js.map +1 -1
  7. package/lib/src/client/metadataApiDeploy.d.ts +0 -6
  8. package/lib/src/client/metadataApiDeploy.js +49 -48
  9. package/lib/src/client/metadataApiDeploy.js.map +1 -1
  10. package/lib/src/client/metadataApiRetrieve.js +2 -0
  11. package/lib/src/client/metadataApiRetrieve.js.map +1 -1
  12. package/lib/src/client/types.d.ts +0 -92
  13. package/lib/src/client/types.js.map +1 -1
  14. package/lib/src/collections/componentSet.d.ts +9 -13
  15. package/lib/src/collections/componentSet.js +47 -46
  16. package/lib/src/collections/componentSet.js.map +1 -1
  17. package/lib/src/collections/componentSetBuilder.d.ts +3 -2
  18. package/lib/src/collections/componentSetBuilder.js +5 -1
  19. package/lib/src/collections/componentSetBuilder.js.map +1 -1
  20. package/lib/src/collections/lazyCollection.js +5 -0
  21. package/lib/src/collections/lazyCollection.js.map +1 -1
  22. package/lib/src/convert/convertContext.d.ts +3 -11
  23. package/lib/src/convert/convertContext.js +33 -27
  24. package/lib/src/convert/convertContext.js.map +1 -1
  25. package/lib/src/convert/metadataConverter.d.ts +0 -2
  26. package/lib/src/convert/metadataConverter.js +38 -37
  27. package/lib/src/convert/metadataConverter.js.map +1 -1
  28. package/lib/src/convert/streams.d.ts +1 -1
  29. package/lib/src/convert/streams.js +14 -13
  30. package/lib/src/convert/streams.js.map +1 -1
  31. package/lib/src/convert/transformers/decomposedMetadataTransformer.d.ts +0 -2
  32. package/lib/src/convert/transformers/decomposedMetadataTransformer.js +27 -29
  33. package/lib/src/convert/transformers/decomposedMetadataTransformer.js.map +1 -1
  34. package/lib/src/convert/transformers/defaultMetadataTransformer.d.ts +0 -3
  35. package/lib/src/convert/transformers/defaultMetadataTransformer.js +61 -61
  36. package/lib/src/convert/transformers/defaultMetadataTransformer.js.map +1 -1
  37. package/lib/src/convert/transformers/staticResourceMetadataTransformer.d.ts +0 -10
  38. package/lib/src/convert/transformers/staticResourceMetadataTransformer.js +34 -38
  39. package/lib/src/convert/transformers/staticResourceMetadataTransformer.js.map +1 -1
  40. package/lib/src/index.d.ts +1 -1
  41. package/lib/src/index.js +1 -2
  42. package/lib/src/index.js.map +1 -1
  43. package/lib/src/registry/coverage.js +1 -1
  44. package/lib/src/registry/coverage.js.map +1 -1
  45. package/lib/src/resolve/adapters/baseSourceAdapter.d.ts +0 -1
  46. package/lib/src/resolve/adapters/baseSourceAdapter.js +10 -8
  47. package/lib/src/resolve/adapters/baseSourceAdapter.js.map +1 -1
  48. package/lib/src/resolve/adapters/defaultSourceAdapter.js +4 -0
  49. package/lib/src/resolve/adapters/defaultSourceAdapter.js.map +1 -1
  50. package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.d.ts +0 -5
  51. package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.js +6 -8
  52. package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.js.map +1 -1
  53. package/lib/src/resolve/adapters/matchingContentSourceAdapter.d.ts +0 -1
  54. package/lib/src/resolve/adapters/matchingContentSourceAdapter.js +4 -4
  55. package/lib/src/resolve/adapters/matchingContentSourceAdapter.js.map +1 -1
  56. package/lib/src/resolve/connectionResolver.js +5 -4
  57. package/lib/src/resolve/connectionResolver.js.map +1 -1
  58. package/lib/src/resolve/manifestResolver.d.ts +0 -1
  59. package/lib/src/resolve/manifestResolver.js +21 -21
  60. package/lib/src/resolve/manifestResolver.js.map +1 -1
  61. package/lib/src/resolve/metadataResolver.d.ts +0 -6
  62. package/lib/src/resolve/metadataResolver.js +7 -9
  63. package/lib/src/resolve/metadataResolver.js.map +1 -1
  64. package/lib/src/resolve/sourceComponent.d.ts +16 -16
  65. package/lib/src/resolve/sourceComponent.js +36 -38
  66. package/lib/src/resolve/sourceComponent.js.map +1 -1
  67. package/lib/src/resolve/treeContainers.js +2 -1
  68. package/lib/src/resolve/treeContainers.js.map +1 -1
  69. package/lib/src/utils/fileSystemHandler.d.ts +0 -6
  70. package/lib/src/utils/fileSystemHandler.js +1 -15
  71. package/lib/src/utils/fileSystemHandler.js.map +1 -1
  72. package/lib/src/utils/index.d.ts +0 -1
  73. package/lib/src/utils/index.js +1 -3
  74. package/lib/src/utils/index.js.map +1 -1
  75. package/package.json +13 -22
  76. package/lib/src/client/deployStrategies/auraDeploy.d.ts +0 -12
  77. package/lib/src/client/deployStrategies/auraDeploy.js +0 -175
  78. package/lib/src/client/deployStrategies/auraDeploy.js.map +0 -1
  79. package/lib/src/client/deployStrategies/baseDeploy.d.ts +0 -21
  80. package/lib/src/client/deployStrategies/baseDeploy.js +0 -81
  81. package/lib/src/client/deployStrategies/baseDeploy.js.map +0 -1
  82. package/lib/src/client/deployStrategies/containerDeploy.d.ts +0 -15
  83. package/lib/src/client/deployStrategies/containerDeploy.js +0 -145
  84. package/lib/src/client/deployStrategies/containerDeploy.js.map +0 -1
  85. package/lib/src/client/deployStrategies/index.d.ts +0 -6
  86. package/lib/src/client/deployStrategies/index.js +0 -25
  87. package/lib/src/client/deployStrategies/index.js.map +0 -1
  88. package/lib/src/client/deployStrategies/lwcDeploy.d.ts +0 -9
  89. package/lib/src/client/deployStrategies/lwcDeploy.js +0 -125
  90. package/lib/src/client/deployStrategies/lwcDeploy.js.map +0 -1
  91. package/lib/src/client/retrieveUtil.d.ts +0 -4
  92. package/lib/src/client/retrieveUtil.js +0 -120
  93. package/lib/src/client/retrieveUtil.js.map +0 -1
  94. package/lib/src/client/toolingApi.d.ts +0 -29
  95. package/lib/src/client/toolingApi.js +0 -120
  96. package/lib/src/client/toolingApi.js.map +0 -1
@@ -1,21 +0,0 @@
1
- import { Connection } from '@salesforce/core';
2
- import { SaveResult } from 'jsforce';
3
- import { SourceComponent } from '../../resolve';
4
- import { SourceDeployResult } from '../types';
5
- export declare abstract class BaseDeploy {
6
- private static readonly TOOLING_PATH_SEP;
7
- connection: Connection;
8
- component: SourceComponent;
9
- namespace: string;
10
- constructor(connection: Connection);
11
- buildMetadataField(metadataContent: string): {
12
- label?: string;
13
- packageVersions?: string;
14
- status?: string;
15
- apiVersion: string;
16
- };
17
- upsertBundle(Id?: string): Promise<SaveResult>;
18
- protected toolingCreate(type: string, record: Record<string, unknown>): Promise<SaveResult>;
19
- protected getFormattedPaths(filepath: string): string[];
20
- abstract deploy(component: SourceComponent, namespace: string): Promise<SourceDeployResult>;
21
- }
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseDeploy = void 0;
4
- /*
5
- * Copyright (c) 2020, salesforce.com, inc.
6
- * All rights reserved.
7
- * Licensed under the BSD 3-Clause license.
8
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
- */
10
- /* eslint @typescript-eslint/no-unsafe-assignment:0, @typescript-eslint/no-unsafe-call:0, @typescript-eslint/no-unsafe-member-access:0 */
11
- const path_1 = require("path");
12
- const core_1 = require("@salesforce/core");
13
- const graceful_fs_1 = require("graceful-fs");
14
- const xmldom_1 = require("@xmldom/xmldom");
15
- core_1.Messages.importMessagesDirectory(__dirname);
16
- const messages = core_1.Messages.load('@salesforce/source-deploy-retrieve', 'sdr', [
17
- 'error_parsing_metadata_file',
18
- 'error_creating_metadata_type',
19
- ]);
20
- class BaseDeploy {
21
- constructor(connection) {
22
- this.connection = connection;
23
- }
24
- buildMetadataField(metadataContent) {
25
- try {
26
- const parser = new xmldom_1.DOMParser();
27
- const document = parser.parseFromString(metadataContent, 'text/xml');
28
- const apiVersion = document.getElementsByTagName('apiVersion')[0].textContent;
29
- const statusNode = document.getElementsByTagName('status')[0];
30
- const packageNode = document.getElementsByTagName('packageVersions')[0];
31
- const descriptionNode = document.getElementsByTagName('description')[0];
32
- const labelNode = document.getElementsByTagName('label')[0];
33
- return {
34
- apiVersion,
35
- ...(statusNode ? { status: statusNode.textContent } : {}),
36
- ...(packageNode ? { packageVersions: packageNode.textContent } : {}),
37
- ...(descriptionNode ? { description: descriptionNode.textContent } : {}),
38
- ...(labelNode ? { label: labelNode.textContent } : {}),
39
- };
40
- }
41
- catch (e) {
42
- throw new core_1.SfError(messages.getMessage('error_parsing_metadata_file'), 'DeployError');
43
- }
44
- }
45
- // If bundle already exists then use Id and update existing
46
- // else, create a new bundle
47
- async upsertBundle(Id) {
48
- const metadataContent = (0, graceful_fs_1.readFileSync)(this.component.xml, 'utf8');
49
- const metadataField = this.buildMetadataField(metadataContent);
50
- let bundleResult;
51
- if (Id) {
52
- const bundleObject = { Id, Metadata: metadataField };
53
- bundleResult = await this.connection.tooling.update(this.component.type.name, bundleObject);
54
- }
55
- else {
56
- const bundleObject = {
57
- FullName: this.component.fullName,
58
- Metadata: metadataField,
59
- };
60
- bundleResult = await this.toolingCreate(this.component.type.name, bundleObject);
61
- }
62
- if (!bundleResult.success) {
63
- throw new core_1.SfError(messages.getMessage('error_creating_metadata_type', [this.component.type.name]), 'DeployError');
64
- }
65
- return bundleResult;
66
- }
67
- async toolingCreate(type, record) {
68
- return await this.connection.tooling.create(type, record);
69
- }
70
- getFormattedPaths(filepath) {
71
- const pathParts = filepath.split(path_1.sep);
72
- const typeFolderIndex = pathParts.findIndex((part) => part === this.component.type.directoryName);
73
- return [
74
- pathParts.slice(typeFolderIndex).join(BaseDeploy.TOOLING_PATH_SEP),
75
- pathParts.slice(typeFolderIndex + 1).join(BaseDeploy.TOOLING_PATH_SEP),
76
- ];
77
- }
78
- }
79
- exports.BaseDeploy = BaseDeploy;
80
- BaseDeploy.TOOLING_PATH_SEP = '/';
81
- //# sourceMappingURL=baseDeploy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"baseDeploy.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C,OAAO,EAAE;YACzB,MAAM,IAAI,cAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;SACnH;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,MAA+B;QACzE,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IAES,iBAAiB,CAAC,QAAgB;QAC1C,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC;QAEtC,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAElG,OAAO;YACL,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;YAClE,SAAS,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;SACvE,CAAC;IACJ,CAAC;;AA9EH,gCAiFC;AAhFyB,2BAAgB,GAAG,GAAG,CAAC"}
@@ -1,15 +0,0 @@
1
- import { SaveResult } from 'jsforce';
2
- import { ContainerAsyncRequest, RecordId, SourceDeployResult } from '../types';
3
- import { SourceComponent } from '../../resolve';
4
- import { BaseDeploy } from './baseDeploy';
5
- export declare class ContainerDeploy extends BaseDeploy {
6
- private static readonly CONTAINER_ASYNC_REQUEST;
7
- private static readonly METADATA_CONTAINER;
8
- deploy(component: SourceComponent, namespace: string): Promise<SourceDeployResult>;
9
- createMetadataContainer(): Promise<SaveResult>;
10
- createContainerMember(outboundFiles: string[], container: SaveResult): Promise<SaveResult>;
11
- getContentEntity(metadataType: string, fileName: string, namespace: string): Promise<string | undefined>;
12
- createContainerAsyncRequest(container: SaveResult): Promise<SaveResult>;
13
- pollContainerStatus(containerId: RecordId): Promise<ContainerAsyncRequest>;
14
- private buildSourceDeployResult;
15
- }
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContainerDeploy = void 0;
4
- /*
5
- * Copyright (c) 2020, salesforce.com, inc.
6
- * All rights reserved.
7
- * Licensed under the BSD 3-Clause license.
8
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
- */
10
- const graceful_fs_1 = require("graceful-fs");
11
- const kit_1 = require("@salesforce/kit");
12
- const core_1 = require("@salesforce/core");
13
- const toolingApi_1 = require("../toolingApi");
14
- const types_1 = require("../types");
15
- const path_1 = require("../../utils/path");
16
- const baseDeploy_1 = require("./baseDeploy");
17
- core_1.Messages.importMessagesDirectory(__dirname);
18
- const messages = core_1.Messages.load('@salesforce/source-deploy-retrieve', 'sdr', [
19
- 'beta_tapi_mdcontainer_error',
20
- 'beta_tapi_car_error',
21
- 'beta_tapi_membertype_error',
22
- ]);
23
- class ContainerDeploy extends baseDeploy_1.BaseDeploy {
24
- async deploy(component, namespace) {
25
- this.component = component;
26
- this.namespace = namespace;
27
- const sourcePath = component.content;
28
- const metadataPath = component.xml;
29
- const container = await this.createMetadataContainer();
30
- await this.createContainerMember([sourcePath, metadataPath], container);
31
- const asyncRequest = await this.createContainerAsyncRequest(container);
32
- const containerRequestStatus = await this.pollContainerStatus(asyncRequest.id);
33
- return this.buildSourceDeployResult(containerRequestStatus);
34
- }
35
- async createMetadataContainer() {
36
- const metadataContainer = await this.toolingCreate(ContainerDeploy.METADATA_CONTAINER, {
37
- Name: `Deploy_MDC_${Date.now()}`,
38
- });
39
- if (!metadataContainer.success) {
40
- throw new core_1.SfError(messages.getMessage('beta_tapi_mdcontainer_error'), 'DeployError');
41
- }
42
- return metadataContainer;
43
- }
44
- async createContainerMember(outboundFiles, container) {
45
- const id = container.id;
46
- const metadataContent = (0, graceful_fs_1.readFileSync)(outboundFiles[1], 'utf8');
47
- const metadataField = this.buildMetadataField(metadataContent);
48
- const body = (0, graceful_fs_1.readFileSync)(outboundFiles[0], 'utf8');
49
- const fileName = (0, path_1.baseName)(outboundFiles[0]);
50
- const entityId = await this.getContentEntity(this.component.type.name, fileName, this.namespace);
51
- const containerMemberObject = {
52
- MetadataContainerId: id,
53
- FullName: fileName,
54
- Body: body,
55
- Metadata: metadataField,
56
- ...(entityId ? { contentEntityId: entityId } : {}),
57
- };
58
- const containerMember = await this.toolingCreate(toolingApi_1.deployTypes.get(this.component.type.name), containerMemberObject);
59
- if (!containerMember.success) {
60
- throw new core_1.SfError(messages.getMessage('beta_tapi_membertype_error', [this.component.type.name]), 'DeployError');
61
- }
62
- return containerMember;
63
- }
64
- async getContentEntity(metadataType, fileName, namespace) {
65
- const queryResult = (await this.connection.tooling.query(`Select Id from ${metadataType} where Name = '${fileName}' and NamespacePrefix = '${namespace}'`));
66
- return queryResult && queryResult.records.length === 1 ? queryResult.records[0].Id : undefined;
67
- }
68
- async createContainerAsyncRequest(container) {
69
- const contAsyncRequest = await this.toolingCreate(ContainerDeploy.CONTAINER_ASYNC_REQUEST, {
70
- MetadataContainerId: container.id,
71
- });
72
- if (!contAsyncRequest.success) {
73
- throw new core_1.SfError(messages.getMessage('beta_tapi_car_error'), 'DeployError');
74
- }
75
- return contAsyncRequest;
76
- }
77
- async pollContainerStatus(containerId) {
78
- let count = 0;
79
- let containerStatus;
80
- do {
81
- if (count > 0) {
82
- await (0, kit_1.sleep)(100);
83
- }
84
- containerStatus = (await this.connection.tooling.retrieve(ContainerDeploy.CONTAINER_ASYNC_REQUEST, containerId));
85
- count++;
86
- } while (containerStatus.State === "Queued" /* ToolingDeployStatus.Queued */ && count <= 30);
87
- return containerStatus;
88
- }
89
- buildSourceDeployResult(containerRequest) {
90
- const componentDeployment = {
91
- component: this.component,
92
- status: types_1.ComponentStatus.Unchanged,
93
- diagnostics: [],
94
- };
95
- const deployMessages = [];
96
- const { componentSuccesses, componentFailures } = containerRequest.DeployDetails;
97
- if (componentSuccesses) {
98
- if (Array.isArray(componentSuccesses)) {
99
- deployMessages.push(...componentSuccesses);
100
- }
101
- else {
102
- deployMessages.push(componentSuccesses);
103
- }
104
- }
105
- if (componentFailures) {
106
- if (Array.isArray(componentFailures)) {
107
- deployMessages.push(...componentFailures);
108
- }
109
- else {
110
- deployMessages.push(componentFailures);
111
- }
112
- }
113
- for (const message of deployMessages) {
114
- if (message.changed === true || message.changed === 'true') {
115
- componentDeployment.status = types_1.ComponentStatus.Changed;
116
- }
117
- else if (message.created === true || message.created === 'true') {
118
- componentDeployment.status = types_1.ComponentStatus.Created;
119
- }
120
- else if (message.deleted === true || message.deleted === 'true') {
121
- componentDeployment.status = types_1.ComponentStatus.Deleted;
122
- }
123
- else if (message.success === false || message.success === 'false') {
124
- componentDeployment.status = types_1.ComponentStatus.Failed;
125
- componentDeployment.diagnostics.push({
126
- error: message.problem,
127
- problemType: message.problemType,
128
- filePath: this.component.content,
129
- lineNumber: Number(message.lineNumber),
130
- columnNumber: Number(message.columnNumber),
131
- });
132
- }
133
- }
134
- return {
135
- id: containerRequest.Id,
136
- status: containerRequest.State,
137
- success: containerRequest.State === "Completed" /* ToolingDeployStatus.Completed */,
138
- components: [componentDeployment],
139
- };
140
- }
141
- }
142
- exports.ContainerDeploy = ContainerDeploy;
143
- ContainerDeploy.CONTAINER_ASYNC_REQUEST = 'ContainerAsyncRequest';
144
- ContainerDeploy.METADATA_CONTAINER = 'MetadataContainer';
145
- //# sourceMappingURL=containerDeploy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerDeploy.js","sourceRoot":"","sources":["../../../../src/client/deployStrategies/containerDeploy.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6CAA2C;AAC3C,yCAAwC;AACxC,2CAAqD;AAGrD,8CAA4C;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D;iBAAM,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE;gBACnE,mBAAmB,CAAC,MAAM,GAAG,uBAAe,CAAC,MAAM,CAAC;gBACpD,mBAAmB,CAAC,WAAW,CAAC,IAAI,CAAC;oBACnC,KAAK,EAAE,OAAO,CAAC,OAAO;oBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;oBAChC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBACtC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;iBAC3C,CAAC,CAAC;aACJ;SACF;QAED,OAAO;YACL,EAAE,EAAE,gBAAgB,CAAC,EAAE;YACvB,MAAM,EAAE,gBAAgB,CAAC,KAAK;YAC9B,OAAO,EAAE,gBAAgB,CAAC,KAAK,oDAAkC;YACjE,UAAU,EAAE,CAAC,mBAAmB,CAAC;SAClC,CAAC;IACJ,CAAC;;AA7IH,0CA8IC;AA7IyB,uCAAuB,GAAG,uBAAuB,CAAC;AAClD,kCAAkB,GAAG,mBAAmB,CAAC"}
@@ -1,6 +0,0 @@
1
- import { Connection } from '@salesforce/core';
2
- import { BaseDeploy } from './baseDeploy';
3
- export { ContainerDeploy } from './containerDeploy';
4
- export { AuraDeploy } from './auraDeploy';
5
- export { LwcDeploy } from './lwcDeploy';
6
- export declare const getDeployStrategy: (type: string, connection: Connection) => BaseDeploy;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDeployStrategy = exports.LwcDeploy = exports.AuraDeploy = exports.ContainerDeploy = void 0;
4
- const registry_1 = require("../../registry");
5
- const containerDeploy_1 = require("./containerDeploy");
6
- const auraDeploy_1 = require("./auraDeploy");
7
- const lwcDeploy_1 = require("./lwcDeploy");
8
- var containerDeploy_2 = require("./containerDeploy");
9
- Object.defineProperty(exports, "ContainerDeploy", { enumerable: true, get: function () { return containerDeploy_2.ContainerDeploy; } });
10
- var auraDeploy_2 = require("./auraDeploy");
11
- Object.defineProperty(exports, "AuraDeploy", { enumerable: true, get: function () { return auraDeploy_2.AuraDeploy; } });
12
- var lwcDeploy_2 = require("./lwcDeploy");
13
- Object.defineProperty(exports, "LwcDeploy", { enumerable: true, get: function () { return lwcDeploy_2.LwcDeploy; } });
14
- const getDeployStrategy = (type, connection) => {
15
- switch (type) {
16
- case registry_1.registry.types.auradefinitionbundle.name:
17
- return new auraDeploy_1.AuraDeploy(connection);
18
- case registry_1.registry.types.lightningcomponentbundle.name:
19
- return new lwcDeploy_1.LwcDeploy(connection);
20
- default:
21
- return new containerDeploy_1.ContainerDeploy(connection);
22
- }
23
- };
24
- exports.getDeployStrategy = getDeployStrategy;
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/deployStrategies/index.ts"],"names":[],"mappings":";;;AAOA,6CAA0C;AAE1C,uDAAoD;AACpD,6CAA0C;AAC1C,2CAAwC;AAExC,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAEX,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,UAAsB,EAAc,EAAE;IACpF,QAAQ,IAAI,EAAE;QACZ,KAAK,mBAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI;YAC3C,OAAO,IAAI,uBAAU,CAAC,UAAU,CAAC,CAAC;QACpC,KAAK,mBAAQ,CAAC,KAAK,CAAC,wBAAwB,CAAC,IAAI;YAC/C,OAAO,IAAI,qBAAS,CAAC,UAAU,CAAC,CAAC;QACnC;YACE,OAAO,IAAI,iCAAe,CAAC,UAAU,CAAC,CAAC;KAC1C;AACH,CAAC,CAAC;AATW,QAAA,iBAAiB,qBAS5B"}
@@ -1,9 +0,0 @@
1
- import { SourceComponent } from '../..';
2
- import { ComponentDeployment, LightningComponentResource, SourceDeployResult } from '../types';
3
- import { BaseDeploy } from './baseDeploy';
4
- export declare class LwcDeploy extends BaseDeploy {
5
- deploy(component: SourceComponent, namespace: string): Promise<SourceDeployResult>;
6
- buildResourceList(): Promise<LightningComponentResource[]>;
7
- upsert(lightningResources: LightningComponentResource[]): Promise<ComponentDeployment>;
8
- private findLightningResources;
9
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2020, salesforce.com, inc.
4
- * All rights reserved.
5
- * Licensed under the BSD 3-Clause license.
6
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.LwcDeploy = void 0;
10
- const path_1 = require("path");
11
- const graceful_fs_1 = require("graceful-fs");
12
- const types_1 = require("../types");
13
- const utils_1 = require("../../utils");
14
- const toolingApi_1 = require("../toolingApi");
15
- const diagnosticUtil_1 = require("../diagnosticUtil");
16
- const baseDeploy_1 = require("./baseDeploy");
17
- class LwcDeploy extends baseDeploy_1.BaseDeploy {
18
- async deploy(component, namespace) {
19
- this.component = component;
20
- this.namespace = namespace;
21
- const lwcResources = await this.buildResourceList();
22
- const componentDeployment = await this.upsert(lwcResources);
23
- let status = "Completed" /* ToolingDeployStatus.Completed */;
24
- if (componentDeployment.diagnostics.length > 0) {
25
- status =
26
- componentDeployment.status !== types_1.ComponentStatus.Failed
27
- ? "CompletedPartial" /* ToolingDeployStatus.CompletedPartial */
28
- : "Failed" /* ToolingDeployStatus.Failed */;
29
- }
30
- return {
31
- id: undefined,
32
- status,
33
- success: status === "Completed" /* ToolingDeployStatus.Completed */,
34
- components: [componentDeployment],
35
- };
36
- }
37
- async buildResourceList() {
38
- const sourceFiles = this.component.walkContent();
39
- sourceFiles.push(this.component.xml);
40
- const lightningResources = [];
41
- const existingResources = await this.findLightningResources();
42
- const lightningBundle = existingResources[0]
43
- ? await this.upsertBundle(existingResources[0].LightningComponentBundleId)
44
- : await this.upsertBundle();
45
- const bundleId = lightningBundle.id;
46
- sourceFiles.forEach((sourceFile) => {
47
- const source = (0, graceful_fs_1.readFileSync)(sourceFile, 'utf8');
48
- const isMetaSource = sourceFile === this.component.xml;
49
- const format = isMetaSource ? 'js' : (0, utils_1.extName)(sourceFile);
50
- let match;
51
- if (existingResources.length > 0) {
52
- match = existingResources.find((resource) => sourceFile.endsWith((0, path_1.normalize)(resource.FilePath)));
53
- }
54
- // If resource exists in org, assign the matching Id
55
- // else, assign the id of the bundle it's associated with
56
- const lightningResource = {
57
- FilePath: sourceFile,
58
- Source: source,
59
- Format: format,
60
- ...(match ? { Id: match.Id } : { LightningComponentBundleId: bundleId }),
61
- };
62
- // This is to ensure that the base file is deployed first for lwc
63
- // otherwise there is a `no base file found` error
64
- // eslint-disable-next-line no-unused-expressions
65
- lightningResource.Format === 'js' && !isMetaSource
66
- ? lightningResources.unshift(lightningResource)
67
- : lightningResources.push(lightningResource);
68
- });
69
- return lightningResources;
70
- }
71
- async upsert(lightningResources) {
72
- const type = this.component.type.name;
73
- const deployment = {
74
- status: types_1.ComponentStatus.Unchanged,
75
- component: this.component,
76
- diagnostics: [],
77
- };
78
- const diagnosticUtil = new diagnosticUtil_1.DiagnosticUtil('tooling');
79
- let partialSuccess = false;
80
- let allCreate = true;
81
- // first resource needs to be created first, so force sync
82
- for (const resource of lightningResources) {
83
- try {
84
- if (resource.Id) {
85
- const formattedDef = {
86
- Source: resource.Source,
87
- Id: resource.Id,
88
- };
89
- await this.connection.tooling.update(toolingApi_1.deployTypes.get(type), formattedDef);
90
- allCreate = false;
91
- partialSuccess = true;
92
- }
93
- else {
94
- const formattedDef = {
95
- LightningComponentBundleId: resource.LightningComponentBundleId,
96
- Format: resource.Format,
97
- Source: resource.Source,
98
- FilePath: this.getFormattedPaths(resource.FilePath)[0],
99
- };
100
- await this.toolingCreate(toolingApi_1.deployTypes.get(type), formattedDef);
101
- }
102
- }
103
- catch (e) {
104
- const diagnostic = diagnosticUtil.parseDeployDiagnostic(this.component, e.message);
105
- deployment.diagnostics.push(diagnostic);
106
- }
107
- }
108
- if (deployment.diagnostics.length > 0) {
109
- deployment.status = partialSuccess ? types_1.ComponentStatus.Changed : types_1.ComponentStatus.Failed;
110
- }
111
- else if (allCreate) {
112
- deployment.status = types_1.ComponentStatus.Created;
113
- }
114
- else {
115
- deployment.status = types_1.ComponentStatus.Changed;
116
- }
117
- return deployment;
118
- }
119
- async findLightningResources() {
120
- const lightningResourceResult = await this.connection.tooling.query(`Select LightningComponentBundleId, Id, Format, Source, FilePath from LightningComponentResource where LightningComponentBundle.DeveloperName = '${this.component.fullName}' and LightningComponentBundle.NamespacePrefix = '${this.namespace}'`);
121
- return lightningResourceResult.records;
122
- }
123
- }
124
- exports.LwcDeploy = LwcDeploy;
125
- //# sourceMappingURL=lwcDeploy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lwcDeploy.js","sourceRoot":"","sources":["../../../../src/client/deployStrategies/lwcDeploy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAAiC;AACjC,6CAA2C;AAE3C,oCAMkB;AAClB,uCAAsC;AACtC,8CAA4C;AAC5C,sDAAmD;AACnD,6CAA0C;AAE1C,MAAa,SAAU,SAAQ,uBAAU;IAChC,KAAK,CAAC,MAAM,CAAC,SAA0B,EAAE,SAAiB;QAC/D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACpD,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,MAAM,kDAAgC,CAAC;QAC3C,IAAI,mBAAmB,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9C,MAAM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AC,UAAU,CAAC,OAAO,CAAC,KAAK,CACjE,mJAAmJ,IAAI,CAAC,SAAS,CAAC,QAAQ,qDAAqD,IAAI,CAAC,SAAS,GAAG,CACjP,CAAC;QACF,OAAO,uBAAuB,CAAC,OAAuC,CAAC;IACzE,CAAC;CACF;AA/GD,8BA+GC"}
@@ -1,4 +0,0 @@
1
- import { SourceComponent } from '../resolve';
2
- import { QueryResult } from './types';
3
- export declare function buildQuery(mdComponent: SourceComponent, namespace?: string): string;
4
- export declare function queryToFileMap(queryResult: QueryResult, mdComponent: SourceComponent, overrideOutputPath?: string): Map<string, string>;
@@ -1,120 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queryToFileMap = exports.buildQuery = void 0;
4
- /*
5
- * Copyright (c) 2020, salesforce.com, inc.
6
- * All rights reserved.
7
- * Licensed under the BSD 3-Clause license.
8
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
- */
10
- const path_1 = require("path");
11
- const utils_1 = require("../utils");
12
- function buildQuery(mdComponent, namespace = '') {
13
- let queryString = '';
14
- const typeName = mdComponent.type.name;
15
- const fullName = mdComponent.fullName;
16
- switch (typeName) {
17
- case 'ApexClass':
18
- case 'ApexTrigger':
19
- queryString = `Select Id, ApiVersion, Body, Name, NamespacePrefix, Status from ${typeName} where Name = '${fullName}' and NamespacePrefix = '${namespace}'`;
20
- break;
21
- case 'ApexComponent':
22
- case 'ApexPage':
23
- queryString = `Select Id, ApiVersion, Name, NamespacePrefix, Markup from ${typeName} where Name = '${fullName}' and NamespacePrefix = '${namespace}'`;
24
- break;
25
- case 'AuraDefinitionBundle':
26
- queryString = 'Select Id, AuraDefinitionBundle.ApiVersion, AuraDefinitionBundle.DeveloperName, ';
27
- queryString += `AuraDefinitionBundle.NamespacePrefix, DefType, Source from AuraDefinition where AuraDefinitionBundle.DeveloperName = '${fullName}' and AuraDefinitionBundle.NamespacePrefix = '${namespace}'`;
28
- break;
29
- case 'LightningComponentBundle':
30
- queryString =
31
- 'Select Id, LightningComponentBundle.DeveloperName, LightningComponentBundle.NamespacePrefix, FilePath, Source from LightningComponentResource ';
32
- queryString += `where LightningComponentBundle.DeveloperName = '${fullName}' and LightningComponentBundle.NamespacePrefix = '${namespace}'`;
33
- break;
34
- default:
35
- queryString = '';
36
- }
37
- return queryString;
38
- }
39
- exports.buildQuery = buildQuery;
40
- function getAuraSourceName(componentPath, fileNamePrefix, defType) {
41
- const cmpParentName = (0, path_1.join)((0, path_1.dirname)(componentPath), fileNamePrefix);
42
- switch (defType) {
43
- case 'APPLICATION':
44
- return `${cmpParentName}.app`;
45
- case 'COMPONENT':
46
- return `${cmpParentName}.cmp`;
47
- case 'DOCUMENTATION':
48
- return `${cmpParentName}.auradoc`;
49
- case 'STYLE':
50
- return `${cmpParentName}.css`;
51
- case 'EVENT':
52
- return `${cmpParentName}.evt`;
53
- case 'DESIGN':
54
- return `${cmpParentName}.design`;
55
- case 'SVG':
56
- return `${cmpParentName}.svg`;
57
- case 'CONTROLLER':
58
- return `${cmpParentName}Controller.js`;
59
- case 'HELPER':
60
- return `${cmpParentName}Helper.js`;
61
- case 'RENDERER':
62
- return `${cmpParentName}Renderer.js`;
63
- case 'TOKENS':
64
- return `${cmpParentName}.tokens`;
65
- case 'INTERFACE':
66
- return `${cmpParentName}.intf`;
67
- default:
68
- return '';
69
- }
70
- }
71
- function queryToFileMap(queryResult, mdComponent, overrideOutputPath) {
72
- const typeName = mdComponent.type.name;
73
- let apiVersion;
74
- let status;
75
- let record;
76
- // If output is defined it overrides where the component will be stored
77
- const mdSourcePath = overrideOutputPath ? (0, utils_1.trimMetaXmlSuffix)(overrideOutputPath) : mdComponent.walkContent()[0];
78
- const saveFilesMap = new Map();
79
- switch (typeName) {
80
- case 'ApexClass':
81
- case 'ApexTrigger':
82
- record = queryResult.records[0];
83
- status = record.Status;
84
- apiVersion = record.ApiVersion;
85
- saveFilesMap.set(mdSourcePath, record.Body);
86
- break;
87
- case 'ApexComponent':
88
- case 'ApexPage':
89
- record = queryResult.records[0];
90
- apiVersion = record.ApiVersion;
91
- saveFilesMap.set(mdSourcePath, record.Markup);
92
- break;
93
- case 'AuraDefinitionBundle': {
94
- const auraRecord = queryResult.records;
95
- apiVersion = auraRecord[0].AuraDefinitionBundle.ApiVersion;
96
- auraRecord.forEach((item) => {
97
- const cmpName = getAuraSourceName(mdSourcePath, mdComponent.name, item.DefType);
98
- saveFilesMap.set(cmpName, item.Source);
99
- });
100
- break;
101
- }
102
- case 'LightningComponentBundle': {
103
- const lwcRecord = queryResult.records;
104
- const bundleParentPath = mdSourcePath.substring(0, mdSourcePath.lastIndexOf(`${path_1.sep}lwc`));
105
- lwcRecord.forEach((item) => {
106
- const cmpName = (0, path_1.join)(bundleParentPath, item.FilePath);
107
- saveFilesMap.set(cmpName, item.Source);
108
- });
109
- break;
110
- }
111
- default:
112
- }
113
- // NOTE: LightningComponentBundle query results returns the -meta.xml file
114
- if (typeName !== 'LightningComponentBundle') {
115
- saveFilesMap.set((0, utils_1.generateMetaXMLPath)(mdSourcePath), (0, utils_1.generateMetaXML)(typeName, apiVersion, status));
116
- }
117
- return saveFilesMap;
118
- }
119
- exports.queryToFileMap = queryToFileMap;
120
- //# sourceMappingURL=retrieveUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retrieveUtil.js","sourceRoot":"","sources":["../../../src/client/retrieveUtil.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,+BAA0C;AAC1C,oCAAmF;AAInF,SAAgB,UAAU,CAAC,WAA4B,EAAE,SAAS,GAAG,EAAE;IACrE,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;IACvC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEtC,QAAQ,QAAQ,EAAE;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa;YAChB,WAAW,G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U,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC;YAC3D,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC1B,MAAM,OAAO,GAAG,iBAAiB,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAChF,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,MAAM;SACP;QACD,KAAK,0BAA0B,CAAC,CAAC;YAC/B,MAAM,SAAS,GAAG,WAAW,CAAC,OAAsB,CAAC;YACrD,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,UAAG,KAAK,CAAC,CAAC,CAAC;YAC1F,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACzB,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtD,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,MAAM;SACP;QACD,QAAQ;KACT;IAED,0EAA0E;IAC1E,IAAI,QAAQ,KAAK,0BAA0B,EAAE;QAC3C,YAAY,CAAC,GAAG,CAAC,IAAA,2BAAmB,EAAC,YAAY,CAAC,EAAE,IAAA,uBAAe,EAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;KACpG;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArDD,wCAqDC"}
@@ -1,29 +0,0 @@
1
- import { Connection } from '@salesforce/core';
2
- import { SourcePath } from '../common';
3
- import { MetadataResolver, SourceComponent } from '../resolve';
4
- import { ComponentSet } from '../collections';
5
- import { RegistryAccess } from '../registry';
6
- import { SourceDeployResult, SourceRetrieveResult } from './types';
7
- declare type WithNamespace = {
8
- namespace?: string;
9
- };
10
- export declare type ToolingDeployOptions = WithNamespace;
11
- export declare type ToolingRetrieveOptions = WithNamespace & {
12
- output?: string;
13
- };
14
- export declare const deployTypes: Map<string, string>;
15
- export declare class ToolingApi {
16
- protected connection: Connection;
17
- protected resolver: MetadataResolver;
18
- protected registry: RegistryAccess;
19
- constructor(connection: Connection, resolver: MetadataResolver, registry?: RegistryAccess);
20
- retrieveWithPaths(options: ToolingRetrieveOptions & {
21
- paths: string[];
22
- }): Promise<SourceRetrieveResult>;
23
- retrieve(options: ToolingRetrieveOptions & {
24
- components: ComponentSet;
25
- }): Promise<SourceRetrieveResult>;
26
- deploy(components: SourceComponent | SourceComponent[], options?: ToolingDeployOptions): Promise<SourceDeployResult>;
27
- deployWithPaths(path: SourcePath, options?: ToolingDeployOptions): Promise<SourceDeployResult>;
28
- }
29
- export {};