Skip to content

Commit

Permalink
feat: migrate from @salesforce/core v6 -> v7 (#5556)
Browse files Browse the repository at this point in the history
* chore: @salesforce/core v6.7.4 -> v7.2.0

* chore: @salesforce/source-deploy-retrieve v10.3.3 -> v11.0.1

* chore: @salesforce/source-tracking v5.1.11 -> v6.0.2

* chore: @salesforce/apex-node v4.0.5 -> v5.0.0-beta.0

* chore: jsforce v2.0.0-beta.29 -> @jsforce/jsforce-node v3.1.0

* chore: replace @salesforce/core/lib/testSetup with @salesforce/core/testSetup in imports

* chore: @salesforce/templates v60.1.0 -> v60.1.2

* chore: change all interfaces to types to match new standard

* chore: change all imports of jsforce to @jsforce/jsforce-node

* chore: @salesforce/apex-node v5.0.0-beta.0 -> v6.0.0

* revert: undo explicitly setting extensionName to salesforcedx-vscode-core when undefined

* chore: update all salesforce dependencies to latest version

* test: mock Logger, Messages, and SfError in @salesforce/core for workspaceContextUtil.test.ts

* test: mock StateAggregator in @salesforce/core for workspaceContextUtil.test.ts

* test: mock AuthInfo and Connection in @salesforce/core for workspaceContextUtil.test.ts

* test: utilize Jest mock function

* chore: fix missing semicolon reported by lerna lint

* chore: remove JsonMap from export type TelemetryModelJson

---------

Co-authored-by: peternhale <peternhale@users.noreply.github.com>
Co-authored-by: Mingxuan Zhang <132491513+mingxuanzhangsfdx@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 30, 2024
1 parent 6115fa1 commit 60957b5
Show file tree
Hide file tree
Showing 130 changed files with 786 additions and 1,117 deletions.
714 changes: 177 additions & 537 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 16 additions & 10 deletions packages/salesforcedx-apex-debugger/src/adapter/apexDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ export type TraceCategory =
| 'breakpoints'
| 'streaming';

export interface LaunchRequestArguments
extends DebugProtocol.LaunchRequestArguments {
export type LaunchRequestArguments = DebugProtocol.LaunchRequestArguments & {
// comma separated list of trace selectors (see TraceCategory)
trace?: boolean | string;
userIdFilter?: string[];
Expand All @@ -117,11 +116,11 @@ export interface LaunchRequestArguments
connectType?: string;
workspaceSettings: WorkspaceSettings;
lineBreakpointInfo?: LineBreakpointInfo[];
}
};

export interface SetExceptionBreakpointsArguments {
export type SetExceptionBreakpointsArguments = {
exceptionInfo: ExceptionBreakpointInfo;
}
};

export class ApexDebugStackFrameInfo {
public readonly requestId: string;
Expand Down Expand Up @@ -245,7 +244,7 @@ export class ApexVariable extends Variable {

export type FilterType = 'named' | 'indexed' | 'all';

export interface VariableContainer {
export type VariableContainer = {
expand(
session: ApexDebug,
filter: FilterType,
Expand All @@ -254,7 +253,7 @@ export interface VariableContainer {
): Promise<ApexVariable[]>;

getNumberOfChildren(): number | undefined;
}
};

export type ScopeType = 'local' | 'static' | 'global';

Expand Down Expand Up @@ -744,7 +743,9 @@ export class ApexDebug extends LoggingDebugSession {
else {
this.sendEvent(
new Event(SEND_METRIC_EVENT, {
subject: nls.localize('interactive_debugger_launched_successfully'),
subject: nls.localize(
'interactive_debugger_launched_successfully'
),
type: 'startInteractiveDebuggerSuccess'
})
);
Expand All @@ -762,13 +763,18 @@ export class ApexDebug extends LoggingDebugSession {
if (error === undefined) {
this.sendEvent(
new Event(SEND_METRIC_EVENT, {
subject: nls.localize('isv_debugger_session_authentication_invalid'),
subject: nls.localize(
'isv_debugger_session_authentication_invalid'
),
type: 'startIsvDebuggerAuthenticationInvalid'
})
);
}
// telemetry for invalid org-isv-debugger-url
else if (String(error) === "TypeError: Cannot read properties of undefined (reading 'pathname')") {
else if (
String(error) ===
"TypeError: Cannot read properties of undefined (reading 'pathname')"
) {
this.sendEvent(
new Event(SEND_METRIC_EVENT, {
subject: nls.localize('org_isv_debugger_url_invalid'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

export interface ExceptionBreakpointInfo {
export type ExceptionBreakpointInfo = {
label: string;
typeref: string;
breakMode: string;
uri?: string;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

export interface LineBreakpointInfo {
export type LineBreakpointInfo = {
uri: string;
typeref: string;
lines: number[];
}
};

export interface LineBreakpointsInTyperef {
export type LineBreakpointsInTyperef = {
typeref: string;
lines: number[];
}
};

export interface ApexBreakpointLocation {
export type ApexBreakpointLocation = {
line: number;
breakpointId: string;
}
};
82 changes: 42 additions & 40 deletions packages/salesforcedx-apex-debugger/src/commands/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,32 @@
* 2. Input those responses into {@link http://json2ts.com/} to generate Typescript interfaces.
* 3. Remove duplicate interfaces that are used in more than one response object.
* 4. Fixed bogus generated interface ReferenceEnum
*
* NOTE: These interfaces were converted to types during the Core v6 -> v7 upgrade to conform to new standards.
*/
export interface DebuggerResponse {
export type DebuggerResponse = {
referencesResponse: ReferencesResponse;
frameResponse: FrameResponse;
stateResponse: StateResponse;
}
};

export interface ReferencesResponse {
export type ReferencesResponse = {
references: References;
}
};

export interface FrameResponse {
export type FrameResponse = {
frame: Frame;
}
};

export interface StateResponse {
export type StateResponse = {
state: State;
}
};

export interface References {
export type References = {
references: Reference[];
}
};

export interface Reference {
export type Reference = {
type: string;
id: number;
typeRef: string;
Expand All @@ -44,79 +46,79 @@ export interface Reference {
offset?: number;
value?: Value[];
tuple?: Tuple[];
}
};

export interface Value {
export type Value = {
name: string;
declaredTypeRef: string;
nameForMessages: string;
ref?: number;
value?: string;
}
};

export interface Field extends Value {
export type Field = Value & {
index: number;
}
};

export interface Tuple {
export type Tuple = {
key: Value;
value: Value;
}
};

export interface Frame {
export type Frame = {
locals: Locals;
statics: Statics;
globals: Globals;
stackFrame: StackFrame;
references?: References;
}
};

export interface Locals {
export type Locals = {
frameNumber: number;
local: LocalValue[];
}
};

export interface LocalValue extends Value {
export type LocalValue = Value & {
slot: number;
}
};

export interface Statics {
export type Statics = {
typeRef: string;
static: Value[];
}
};

export interface Globals {
export type Globals = {
global: Value[];
}
};

export interface StackFrame {
export type StackFrame = {
typeRef: string;
fullName: string;
lineNumber: number;
frameNumber: number;
}
};

export interface State {
export type State = {
locals: Locals;
statics: Statics;
globals: Globals;
stack: Stack;
references?: References;
}
};

export interface Stack {
export type Stack = {
stackFrame: StackFrame[];
}
};

export interface DebuggerRequest {
export type DebuggerRequest = {
getReferencesRequest: GetReferenceRequest;
}
};

export interface GetReferenceRequest {
export type GetReferenceRequest = {
reference: ReferenceRequest[];
}
};

export interface ReferenceRequest {
export type ReferenceRequest = {
reference: number;
offset?: number;
}
};
12 changes: 6 additions & 6 deletions packages/salesforcedx-apex-debugger/src/core/streamingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export enum ApexDebuggerEventType {
SystemWarning
}

export interface StreamingEvent {
export type StreamingEvent = {
createdDate: string;
replayId: number;
type: string;
}
};

export interface ApexDebuggerEvent {
export type ApexDebuggerEvent = {
SessionId: string;
RequestId?: string;
BreakpointId?: string;
Expand All @@ -43,12 +43,12 @@ export interface ApexDebuggerEvent {
FileName?: string;
Line?: number;
Stacktrace?: string;
}
};

export interface DebuggerMessage {
export type DebuggerMessage = {
event: StreamingEvent;
sobject: ApexDebuggerEvent;
}
};

export class StreamingClientInfo {
public readonly channel: string;
Expand Down
12 changes: 6 additions & 6 deletions packages/salesforcedx-apex-debugger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ export enum VscodeDebuggerMessageType {
Error
}

export interface VscodeDebuggerMessage {
export type VscodeDebuggerMessage = {
type: VscodeDebuggerMessageType;
message: string;
}
};

export interface WorkspaceSettings {
export type WorkspaceSettings = {
proxyUrl: string;
proxyStrictSSL: boolean;
proxyAuth: string;
connectionTimeoutMs: number;
setBreakpointTimeoutMs: number;
}
};

// Define Metric object to be used for sending attributes to AppInsights telemetry
// NOTE: Refer to attribute names 'message' and 'eventName' defined in sendTelemetryEvent() in telemetryReporter.d.ts, which match the names in AppInsights telemetry
export interface Metric {
export type Metric = {
message: string; // match 'subject' attribute in Event from messages.d.ts
eventName: string; // match 'type' attribute in Event from messages.d.ts
}
};

// Type guard to check if the object conforms to Metric
export const isMetric = (input: unknown): input is Metric =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ export enum Step {
Run
}

export interface LaunchRequestArguments
extends DebugProtocol.LaunchRequestArguments {
export type LaunchRequestArguments = DebugProtocol.LaunchRequestArguments & {
logFile: string;
stopOnEntry?: boolean | true;
trace?: boolean | string;
lineBreakpointInfo?: LineBreakpointInfo[];
projectPath: string | undefined;
}
};

export class ApexVariable extends Variable {
public readonly type: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

export interface LineBreakpointInfo {
export type LineBreakpointInfo = {
uri: string;
typeref: string;
lines: number[];
}
};

export { BreakpointUtil } from './breakpointUtil';
import { BreakpointUtil } from './breakpointUtil';
export const breakpointUtil = BreakpointUtil.getInstance();

0 comments on commit 60957b5

Please sign in to comment.