Skip to content

Commit

Permalink
Merge pull request #679 from forcedotcom/sh/source-tracked-email-temp…
Browse files Browse the repository at this point in the history
…lates

fix: resolve fullname correctly for EmailTemplateFolder
  • Loading branch information
WillieRuemmele authored Sep 25, 2024
2 parents d459d45 + d7b76a5 commit c472e70
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 14 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
},
"dependencies": {
"@oclif/core": "^4.0.20",
"@salesforce/core": "^8.5.4",
"@salesforce/kit": "^3.2.1",
"@salesforce/source-deploy-retrieve": "^12.6.0",
"@salesforce/core": "^8.6.1",
"@salesforce/kit": "^3.2.3",
"@salesforce/source-deploy-retrieve": "^12.7.1",
"@salesforce/ts-types": "^2.0.12",
"fast-xml-parser": "^4.5.0",
"graceful-fs": "^4.2.11",
Expand Down
4 changes: 3 additions & 1 deletion src/shared/remoteSourceTrackingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,9 @@ export const remoteChangeElementToChangeResult = (rce: RemoteChangeElement): Cha
...rce,
...(mappingsForSourceMemberTypesToMetadataType.has(rce.type)
? {
name: rce.name.split('/')[0],
// SNOWFLAKE: EmailTemplateFolder is treated as an alias for EmailFolder so it has a mapping.
// The name must be handled differently than with bundle types.
name: rce.type === 'EmailTemplateFolder' ? rce.name : rce.name.split('/')[0],
type: mappingsForSourceMemberTypesToMetadataType.get(rce.type),
}
: {}),
Expand Down
45 changes: 43 additions & 2 deletions test/unit/remoteSourceTracking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ import { MockTestOrgData, instantiateContext, stubContext, restoreContext } from
import { EnvVars, envVars, Logger, Messages, Org } from '@salesforce/core';
import { expect } from 'chai';
import { ComponentStatus } from '@salesforce/source-deploy-retrieve';
import { RemoteSourceTrackingService, calculateTimeout, Contents } from '../../src/shared/remoteSourceTrackingService';
import { RemoteSyncInput, SourceMember, MemberRevision } from '../../src/shared/types';
import {
RemoteSourceTrackingService,
calculateTimeout,
Contents,
remoteChangeElementToChangeResult,
} from '../../src/shared/remoteSourceTrackingService';
import { RemoteSyncInput, SourceMember, MemberRevision, RemoteChangeElement } from '../../src/shared/types';
import * as mocks from '../../src/shared/remoteSourceTrackingService';

Messages.importMessagesDirectory(__dirname);
Expand Down Expand Up @@ -93,6 +98,42 @@ describe('remoteSourceTrackingService', () => {
org,
projectPath: await $$.localPathRetriever($$.id),
});

describe('remoteChangeElementToChangeResult()', () => {
it('should return correct ChangeResult for EmailTemplateFolder', () => {
const rce: RemoteChangeElement = {
name: 'level1/level2/level3',
type: 'EmailTemplateFolder',
deleted: false,
modified: true,
};
const changeResult = remoteChangeElementToChangeResult(rce);
expect(changeResult).to.deep.equal({
origin: 'remote',
name: 'level1/level2/level3',
type: 'EmailFolder',
deleted: false,
modified: true,
});
});

it('should return correct ChangeResult for LightningComponentResource', () => {
const rce: RemoteChangeElement = {
name: 'fooLWC/bar',
type: 'LightningComponentResource',
deleted: false,
modified: true,
};
const changeResult = remoteChangeElementToChangeResult(rce);
expect(changeResult).to.deep.equal({
origin: 'remote',
name: 'fooLWC',
type: 'LightningComponentBundle',
deleted: false,
modified: true,
});
});
});
});

describe('getServerMaxRevision', () => {
Expand Down
64 changes: 56 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.8.1"

"@salesforce/core@^8.5.1", "@salesforce/core@^8.5.2", "@salesforce/core@^8.5.4":
"@salesforce/core@^8.5.1":
version "8.5.4"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.5.4.tgz#1cdd669462d2c2859b72135d1138a1b790b1fbcc"
integrity sha512-dO8tzFxq811qNPeKPPO2OA2KPYW5rO0YRinW/+7zmRJW3EtNpe93dsQVGwBSAAYrSbYeBwiKdliNqNTN7tKJ0A==
Expand All @@ -570,6 +570,30 @@
semver "^7.6.3"
ts-retry-promise "^0.8.1"

"@salesforce/core@^8.5.7", "@salesforce/core@^8.6.1":
version "8.6.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.6.1.tgz#180c489447190632cf48364a077510989fc1dea2"
integrity sha512-bOS6YIjk3IFzFtZcQXUIbJQ740Gh6EyzlcvoBpDpFA5eaz5ZrS0dO1e0rU6Gn4V1FZkvt84gQXA5G1M8tTNKVw==
dependencies:
"@jsforce/jsforce-node" "^3.4.1"
"@salesforce/kit" "^3.2.2"
"@salesforce/schemas" "^1.9.0"
"@salesforce/ts-types" "^2.0.10"
ajv "^8.17.1"
change-case "^4.1.2"
fast-levenshtein "^3.0.0"
faye "^1.4.0"
form-data "^4.0.0"
js2xmlparser "^4.0.1"
jsonwebtoken "9.0.2"
jszip "3.10.1"
pino "^9.4.0"
pino-abstract-transport "^1.2.0"
pino-pretty "^11.2.2"
proper-lockfile "^4.1.2"
semver "^7.6.3"
ts-retry-promise "^0.8.1"

"@salesforce/dev-config@^4.3.1":
version "4.3.1"
resolved "https://registry.yarnpkg.com/@salesforce/dev-config/-/dev-config-4.3.1.tgz#4dac8245df79d675258b50e1d24e8c636eaa5e10"
Expand Down Expand Up @@ -614,6 +638,13 @@
dependencies:
"@salesforce/ts-types" "^2.0.12"

"@salesforce/kit@^3.2.3":
version "3.2.3"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-3.2.3.tgz#a7293c384ef6133191fe3590e604e3896fdecf4a"
integrity sha512-X8rZouLt06dxRkn+uYTwywWDS/NqZ783AyomGqgtWdUxF61EOJvu0ehtcYeutx9Ng08uuZ+s6wNvWiDsdhUcPg==
dependencies:
"@salesforce/ts-types" "^2.0.12"

"@salesforce/prettier-config@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@salesforce/prettier-config/-/prettier-config-0.0.3.tgz#ba648d4886bb38adabe073dbea0b3a91b3753bb0"
Expand All @@ -624,16 +655,16 @@
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.9.0.tgz#ba477a112653a20b4edcf989c61c57bdff9aa3ca"
integrity sha512-LiN37zG5ODT6z70sL1fxF7BQwtCX9JOWofSU8iliSNIM+WDEeinnoFtVqPInRSNt8I0RiJxIKCrqstsmQRBNvA==

"@salesforce/source-deploy-retrieve@^12.6.0":
version "12.6.2"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-12.6.2.tgz#eb9ab120621c80a404b9ec45a2b102f3f2befbff"
integrity sha512-ucEt/CyzL4ovMc2cYREk4meQzKe6/FlY/D09yLmOQ118Oec680ehEhJ1kGRE/I7HTzfgQP3Fy2GzhQX1bOYC5Q==
"@salesforce/source-deploy-retrieve@^12.7.1":
version "12.7.1"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-12.7.1.tgz#5e828fb721edac136d0903624d82cb5f9e197f21"
integrity sha512-duFgp76CHA8coLEkl9QYmJJmJrHHiU4EtRkBv3hP0H0lTDaMdwCjfxAexGLxT2PCRsE5fbZgwJg+wYFLJHZkIw==
dependencies:
"@salesforce/core" "^8.5.2"
"@salesforce/core" "^8.5.7"
"@salesforce/kit" "^3.2.2"
"@salesforce/ts-types" "^2.0.12"
fast-levenshtein "^3.0.0"
fast-xml-parser "^4.4.1"
fast-xml-parser "^4.5.0"
got "^11.8.6"
graceful-fs "^4.2.11"
ignore "^5.3.2"
Expand Down Expand Up @@ -2441,7 +2472,7 @@ fast-uri@^3.0.1:
resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.1.tgz#cddd2eecfc83a71c1be2cc2ef2061331be8a7134"
integrity sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==

fast-xml-parser@^4.4.1, fast-xml-parser@^4.5.0:
fast-xml-parser@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz#2882b7d01a6825dfdf909638f2de0256351def37"
integrity sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==
Expand Down Expand Up @@ -4475,6 +4506,23 @@ pino@^9.3.2:
sonic-boom "^4.0.1"
thread-stream "^3.0.0"

pino@^9.4.0:
version "9.4.0"
resolved "https://registry.yarnpkg.com/pino/-/pino-9.4.0.tgz#e4600ff199efc744856a5b3b71c53e38998eae5a"
integrity sha512-nbkQb5+9YPhQRz/BeQmrWpEknAaqjpAqRK8NwJpmrX/JHu7JuZC5G1CeAwJDJfGes4h+YihC6in3Q2nGb+Y09w==
dependencies:
atomic-sleep "^1.0.0"
fast-redact "^3.1.1"
on-exit-leak-free "^2.1.0"
pino-abstract-transport "^1.2.0"
pino-std-serializers "^7.0.0"
process-warning "^4.0.0"
quick-format-unescaped "^4.0.3"
real-require "^0.2.0"
safe-stable-stringify "^2.3.1"
sonic-boom "^4.0.1"
thread-stream "^3.0.0"

pkg-dir@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
Expand Down

0 comments on commit c472e70

Please sign in to comment.