Skip to content

Commit

Permalink
feat!: sfdx-core7, jsforce-node (#1280)
Browse files Browse the repository at this point in the history
* feat: core7, jsforce-node

BREAKING CHANGE: sfdx-core7, jsforce-node
  • Loading branch information
mshanemc authored Apr 10, 2024
1 parent da3c97b commit 7d8d111
Show file tree
Hide file tree
Showing 46 changed files with 548 additions and 1,816 deletions.
1,818 changes: 378 additions & 1,440 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/component-resolution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
// @ts-ignore
import { ComponentSet, ZipTreeContainer } from '@salesforce/source-deploy-retrieve';
import * as fs from 'fs';
import fs from 'fs';

/**
* Print the component count of a file or directory path by type.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"node": ">=18.0.0"
},
"dependencies": {
"@salesforce/core": "^6.7.3",
"@salesforce/core": "^7.0.0",
"@salesforce/kit": "^3.1.0",
"@salesforce/ts-types": "^2.0.9",
"fast-levenshtein": "^3.0.0",
Expand All @@ -40,7 +40,8 @@
"ts-retry-promise": "^0.7.1"
},
"devDependencies": {
"@salesforce/cli-plugins-testkit": "^5.1.14",
"@jsforce/jsforce-node": "^3.1.0",
"@salesforce/cli-plugins-testkit": "^5.2.0",
"@salesforce/dev-scripts": "^8.5.0",
"@types/deep-equal-in-any-order": "^1.0.1",
"@types/fast-levenshtein": "^0.0.4",
Expand All @@ -49,8 +50,7 @@
"@types/minimatch": "^5.1.2",
"deep-equal-in-any-order": "^1.1.19",
"deepmerge": "^4.3.1",
"eslint-plugin-sf-plugin": "^1.17.5",
"jsforce": "^2.0.0-beta.29",
"eslint-plugin-sf-plugin": "^1.18.0",
"mocha-junit-reporter": "^1.23.3",
"mocha-snap": "^5.0.0",
"ts-node": "^10.9.2",
Expand Down
10 changes: 5 additions & 5 deletions src/client/metadataApiDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import { join, relative, resolve as pathResolve, sep } from 'node:path';
import { format } from 'node:util';
import { isString } from '@salesforce/ts-types';
import * as JSZip from 'jszip';
import * as fs from 'graceful-fs';
import JSZip from 'jszip';
import fs from 'graceful-fs';
import { Lifecycle, Messages, SfError } from '@salesforce/core';
import { ensureArray } from '@salesforce/kit';
import { RegistryAccess } from '../registry/registryAccess';
Expand Down Expand Up @@ -70,7 +70,7 @@ export type MetadataApiDeployOptions = {
*/
mdapiPath?: string;
registry?: RegistryAccess;
} & MetadataTransferOptions
} & MetadataTransferOptions;

export class MetadataApiDeploy extends MetadataTransfer<
MetadataApiDeployStatus,
Expand Down Expand Up @@ -417,12 +417,12 @@ const buildFileResponsesFromComponentSet =
export type ScopedPreDeploy = {
componentSet: ComponentSet;
orgId: string;
}
};

/**
* register a listener to `scopedPostDeploy`
*/
export type ScopedPostDeploy = {
deployResult: DeployResult;
orgId: string;
}
};
8 changes: 4 additions & 4 deletions src/client/metadataApiRetrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'node:path';
import * as fs from 'graceful-fs';
import * as JSZip from 'jszip';
import fs from 'graceful-fs';
import JSZip from 'jszip';
import { asBoolean, isString } from '@salesforce/ts-types';
import { Messages, SfError, Lifecycle } from '@salesforce/core';
import { ensureArray } from '@salesforce/kit';
Expand Down Expand Up @@ -260,15 +260,15 @@ export class MetadataApiRetrieve extends MetadataTransfer<
export type ScopedPreRetrieve = {
componentSet: ComponentSet;
orgId: string;
}
};

/**
* register a listener to `scopedPostRetrieve`
*/
export type ScopedPostRetrieve = {
retrieveResult: RetrieveResult;
orgId: string;
}
};

const handleMdapiResponse = async (options: MetadataApiRetrieveOptions, zipFileContents: Buffer): Promise<void> => {
const name = options.zipFileName ?? 'unpackaged.zip';
Expand Down
4 changes: 2 additions & 2 deletions src/client/metadataTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import { AnyJson, isNumber } from '@salesforce/ts-types';
import * as fs from 'graceful-fs';
import fs from 'graceful-fs';
import { SfdxFileFormat } from '../convert/types';
import { MetadataConverter } from '../convert/metadataConverter';
import { ComponentSet } from '../collections/componentSet';
Expand All @@ -32,7 +32,7 @@ export type MetadataTransferOptions = {
components?: ComponentSet;
apiVersion?: string;
id?: string;
}
};

export abstract class MetadataTransfer<
Status extends MetadataRequestStatus,
Expand Down
2 changes: 1 addition & 1 deletion src/client/retrieveExtract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import * as path from 'node:path';
import { Logger } from '@salesforce/core';
import { isString } from '@salesforce/ts-types';
import * as fs from 'graceful-fs';
import fs from 'graceful-fs';
import { ConvertOutputConfig } from '../convert/types';
import { MetadataConverter } from '../convert/metadataConverter';
import { ComponentSet } from '../collections/componentSet';
Expand Down
44 changes: 22 additions & 22 deletions src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,30 @@ type FileResponseBase = {
fullName: string;
type: string;
filePath?: string;
}
};

export type FileResponseSuccess = {
state: Exclude<ComponentStatus, ComponentStatus.Failed>;
} & FileResponseBase
} & FileResponseBase;

export type FileResponseFailure = {
state: ComponentStatus.Failed;
lineNumber?: number;
columnNumber?: number;
error: string;
problemType: 'Warning' | 'Error';
} & FileResponseBase
} & FileResponseBase;

export type FileResponse = FileResponseSuccess | FileResponseFailure;
export type MetadataTransferResult = {
response: MetadataRequestStatus;
components?: ComponentSet;
getFileResponses(): FileResponse[];
}
};

export type AsyncResult = {
id: RecordId;
}
};

export enum RequestStatus {
Pending = 'Pending',
Expand All @@ -93,7 +93,7 @@ export type MetadataRequestStatus = {
status: RequestStatus;
success: boolean;
done: boolean;
}
};

export type RetrieveFailure = {
component?: MetadataComponent;
Expand Down Expand Up @@ -135,7 +135,7 @@ export type MetadataApiDeployStatus = {
rollbackOnError: boolean;
startDate?: string;
stateDetail?: string;
} & MetadataRequestStatus
} & MetadataRequestStatus;

export type DeployDetails = {
componentFailures?: DeployMessage | DeployMessage[];
Expand All @@ -153,7 +153,7 @@ export type RunTestResult = {
numTestsRun: string;
successes?: Successes[] | Successes;
totalTime: string;
}
};

export type CodeCoverage = {
id: string;
Expand All @@ -162,20 +162,20 @@ export type CodeCoverage = {
numLocations: string;
numLocationsNotCovered: string;
type: string;
}
};

export type LocationsNotCovered = {
column: string;
line: string;
numExecutions: string;
time: string;
}
};

export type CodeCoverageWarnings = {
id: string;
message: string;
namespace: string;
}
};

export type Failures = {
id: string;
Expand All @@ -186,14 +186,14 @@ export type Failures = {
stackTrace: string;
time: string;
type: string;
}
};

export type Successes = {
id: string;
methodName: string;
name: string;
time: string;
}
};

export type BooleanString = 'true' | 'false' | true | false;

Expand Down Expand Up @@ -263,7 +263,7 @@ export type MetadataApiRetrieveStatus = {
messages?: RetrieveMessage[] | RetrieveMessage;
/** `base64` encoded string */
zipFile: string;
}
};

// ------------------------------------------------
// Client options
Expand All @@ -280,7 +280,7 @@ export type PackageOption = {
* default to `<process.cwd()>/PackageOption.name`.
*/
outputDir?: SourcePath;
}
};

export type PackageOptions = string[] | PackageOption[];

Expand All @@ -297,7 +297,7 @@ export type RetrieveExtractOptions = {
* `PackageOption.outputDir` for packaged source.
*/
outputDir: SourcePath;
}
};

export type RetrieveOptions = {
/**
Expand Down Expand Up @@ -334,7 +334,7 @@ export type RetrieveOptions = {
* Specifies whether to suppress the <Pre|Post><Retrieve> events
*/
suppressEvents?: boolean;
}
};

export type MetadataApiDeployOptions = {
allowMissingFiles?: boolean;
Expand All @@ -352,27 +352,27 @@ export type MetadataApiDeployOptions = {
* Set to true to use the REST API for deploying.
*/
rest?: boolean;
}
};

export type StdValueSetRecord = {
Id: string;
MasterLabel: string;
Metadata: { standardValue: Array<Record<string, unknown>> };
}
};

export type ListMetadataQuery = {
type: string;
folder?: string;
}
};

export type DeployVersionData = {
apiVersion: string;
manifestVersion: string | undefined;
webService: 'SOAP' | 'REST';
}
};

export type RetrieveVersionData = {
apiVersion: string;
manifestVersion: string;
}
};
export type MetadataApiRetrieveOptions = MetadataTransferOptions & RetrieveOptions & { registry?: RegistryAccess };
4 changes: 2 additions & 2 deletions src/collections/componentSetBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import * as path from 'node:path';
import { StateAggregator, Logger, SfError, Messages } from '@salesforce/core';
import * as fs from 'graceful-fs';
import * as minimatch from 'minimatch';
import fs from 'graceful-fs';
import minimatch from 'minimatch';
import { MetadataComponent } from '../resolve/types';
import { ComponentSet } from '../collections/componentSet';
import { RegistryAccess } from '../registry/registryAccess';
Expand Down
10 changes: 5 additions & 5 deletions src/collections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ComponentSet } from './componentSet';
export type PackageTypeMembers = {
name: string;
members: string[];
}
};

export type PackageManifestObject = {
Package: {
Expand All @@ -22,7 +22,7 @@ export type PackageManifestObject = {
fullName?: string;
[XML_NS_KEY]?: string;
};
}
};

// TODO NEXT MAJOR: use a string union type
export enum DestructiveChangesType {
Expand All @@ -43,7 +43,7 @@ export type FromSourceOptions = {
* File paths or directory paths of deleted components, i.e., destructive changes.
*/
fsDeletePaths?: string[];
} & OptionalTreeRegistryOptions
} & OptionalTreeRegistryOptions;

export type FromManifestOptions = {
/**
Expand Down Expand Up @@ -75,7 +75,7 @@ export type FromManifestOptions = {
* path to a `destructiveChangesPost.xml` file in XML format
*/
destructivePost?: string;
} & OptionalTreeRegistryOptions
} & OptionalTreeRegistryOptions;

export type FromConnectionOptions = {
/**
Expand All @@ -94,4 +94,4 @@ export type FromConnectionOptions = {
* array of metadata type names to use for `connection.metadata.list()`
*/
metadataTypes?: string[];
} & OptionalTreeRegistryOptions
} & OptionalTreeRegistryOptions;
2 changes: 1 addition & 1 deletion src/convert/replacements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { readFile } from 'node:fs/promises';
import { Transform, Readable } from 'node:stream';
import { sep, posix, join, isAbsolute } from 'node:path';
import { Lifecycle, Messages, SfError, SfProject } from '@salesforce/core';
import * as minimatch from 'minimatch';
import minimatch from 'minimatch';
import { Env } from '@salesforce/kit';
import { ensureString, isString } from '@salesforce/ts-types';
import { SourcePath } from '../common/types';
Expand Down
2 changes: 1 addition & 1 deletion src/convert/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { basename, dirname, isAbsolute, join } from 'node:path';
import { pipeline as cbPipeline, Readable, Stream, Transform, Writable } from 'node:stream';
import { promisify } from 'node:util';
import { Messages, SfError } from '@salesforce/core';
import * as JSZip from 'jszip';
import JSZip from 'jszip';
import { createWriteStream, existsSync, promises as fsPromises } from 'graceful-fs';
import { JsonMap } from '@salesforce/ts-types';
import { XMLBuilder } from 'fast-xml-parser';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { basename, dirname, isAbsolute, join, relative } from 'node:path';
import { Readable } from 'node:stream';
import * as JSZip from 'jszip';
import JSZip from 'jszip';
import { getExtension } from 'mime';
import { JsonMap } from '@salesforce/ts-types';
import { createWriteStream } from 'graceful-fs';
Expand Down
2 changes: 1 addition & 1 deletion src/convert/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export type MetadataTransformer = {
defaultDirectory?: string;
toMetadataFormat(component: SourceComponent): Promise<WriteInfo[]>;
toSourceFormat(component: SourceComponent, mergeWith?: SourceComponent): Promise<WriteInfo[]>;
}
};

// --------------
// PUBLIC
Expand Down
Loading

0 comments on commit 7d8d111

Please sign in to comment.