@google-cloud/debug-agent
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -114,2 +114,11 @@ import { GoogleAuthOptions } from '@google-cloud/common'; | ||
minorVersion_?: string; | ||
/** | ||
* The flag to decide whether to enable breakpoint canary. | ||
*/ | ||
enableCanary?: boolean; | ||
/** | ||
* The flag to decide whether to allow individual setbreakpoint request to | ||
* override the canary behavior. | ||
*/ | ||
allowCanaryOverride?: boolean; | ||
}; | ||
@@ -116,0 +125,0 @@ /** |
@@ -30,2 +30,4 @@ "use strict"; | ||
minorVersion_: undefined, | ||
enableCanary: undefined, | ||
allowCanaryOverride: undefined, | ||
}, | ||
@@ -32,0 +34,0 @@ appPathRelativeToRepository: undefined, |
@@ -11,2 +11,3 @@ /*! | ||
private nextWaitToken; | ||
private agentId; | ||
apiUrl: string; | ||
@@ -27,2 +28,3 @@ /** | ||
debuggee: Debuggee; | ||
agentId: string; | ||
}) => void): void; | ||
@@ -29,0 +31,0 @@ /** |
@@ -32,2 +32,3 @@ "use strict"; | ||
this.nextWaitToken = null; | ||
this.agentId = null; | ||
this.apiUrl = `https://${debug.apiEndpoint}/v2/controller`; | ||
@@ -63,2 +64,3 @@ if (config && config.apiUrl) { | ||
debuggee.id = body.debuggee.id; | ||
this.agentId = body.agentId; | ||
callback(null, body); | ||
@@ -81,2 +83,5 @@ } | ||
} | ||
if (that.agentId) { | ||
query.agentId = that.agentId; | ||
} | ||
const uri = this.apiUrl + | ||
@@ -83,0 +88,0 @@ '/debuggees/' + |
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { Debug, PackageInfo } from '../client/stackdriver/debug'; | ||
import { Debuggee } from '../debuggee'; | ||
import { CanaryMode, Debuggee } from '../debuggee'; | ||
import * as stackdriver from '../types/stackdriver'; | ||
@@ -12,2 +12,12 @@ import { DebugAgentConfig, Logger, LogLevel, ResolvedDebugAgentConfig } from './config'; | ||
/** | ||
* Environments that this system might be running in. | ||
* Helps provide platform-specific information and integration. | ||
*/ | ||
export declare enum Platforms { | ||
/** Google Cloud Functions */ | ||
CLOUD_FUNCTION = "cloud_function", | ||
/** Any other platform. */ | ||
DEFAULT = "default" | ||
} | ||
/** | ||
* CachedPromise stores a promise. This promise can be resolved by calling | ||
@@ -96,3 +106,10 @@ * function resolve() and can only be resolved once. | ||
minorVersion_?: string; | ||
enableCanary?: boolean; | ||
allowCanaryOverride?: boolean; | ||
}, sourceContext: SourceContext | undefined, onGCP: boolean, packageInfo: PackageInfo, description?: string, errorMessage?: string): Debuggee; | ||
/** | ||
* Use environment vars to infer the current platform. | ||
* For now this is only Cloud Functions and other. | ||
*/ | ||
private static getPlatform; | ||
static runningOnGCP(): Promise<boolean>; | ||
@@ -199,3 +216,7 @@ static getClusterNameFromMetadata(): Promise<string>; | ||
}): string; | ||
static _getCanaryMode(serviceContext: { | ||
enableCanary?: boolean; | ||
allowCanaryOverride?: boolean; | ||
}): CanaryMode; | ||
} | ||
export {}; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Debuglet = exports.CachedPromise = void 0; | ||
exports.Debuglet = exports.CachedPromise = exports.Platforms = void 0; | ||
const assert = require("assert"); | ||
@@ -52,2 +52,13 @@ const consoleLogLevel = require("console-log-level"); | ||
/** | ||
* Environments that this system might be running in. | ||
* Helps provide platform-specific information and integration. | ||
*/ | ||
var Platforms; | ||
(function (Platforms) { | ||
/** Google Cloud Functions */ | ||
Platforms["CLOUD_FUNCTION"] = "cloud_function"; | ||
/** Any other platform. */ | ||
Platforms["DEFAULT"] = "default"; | ||
})(Platforms = exports.Platforms || (exports.Platforms = {})); | ||
/** | ||
* Formats a breakpoint object prefixed with a provided message as a string | ||
@@ -377,2 +388,3 @@ * intended for logging. | ||
projectid: projectId, | ||
platform: Debuglet.getPlatform(), | ||
}; | ||
@@ -414,2 +426,3 @@ if (serviceContext) { | ||
packageInfo, | ||
canaryMode: Debuglet._getCanaryMode(serviceContext), | ||
}; | ||
@@ -421,2 +434,14 @@ if (sourceContext) { | ||
} | ||
/** | ||
* Use environment vars to infer the current platform. | ||
* For now this is only Cloud Functions and other. | ||
*/ | ||
static getPlatform() { | ||
const { FUNCTION_NAME, FUNCTION_TARGET } = process.env; | ||
// (In theory) only the Google Cloud Functions environment will have these env vars. | ||
if (FUNCTION_NAME || FUNCTION_TARGET) { | ||
return Platforms.CLOUD_FUNCTION; | ||
} | ||
return Platforms.DEFAULT; | ||
} | ||
static runningOnGCP() { | ||
@@ -867,2 +892,18 @@ return metadata.isAvailable(); | ||
} | ||
static _getCanaryMode(serviceContext) { | ||
const enableCanary = serviceContext === null || serviceContext === void 0 ? void 0 : serviceContext.enableCanary; | ||
const allowCanaryOverride = serviceContext === null || serviceContext === void 0 ? void 0 : serviceContext.allowCanaryOverride; | ||
if (enableCanary && allowCanaryOverride) { | ||
return 'CANARY_MODE_DEFAULT_ENABLED'; | ||
} | ||
else if (enableCanary && !allowCanaryOverride) { | ||
return 'CANARY_MODE_ALWAYS_ENABLED'; | ||
} | ||
else if (!enableCanary && allowCanaryOverride) { | ||
return 'CANARY_MODE_DEFAULT_DISABLED'; | ||
} | ||
else { | ||
return 'CANARY_MODE_ALWAYS_DISABLED'; | ||
} | ||
} | ||
} | ||
@@ -869,0 +910,0 @@ exports.Debuglet = Debuglet; |
import { PackageInfo } from './client/stackdriver/debug'; | ||
import { StatusMessage } from './client/stackdriver/status-message'; | ||
export declare type CanaryMode = 'CANARY_MODE_UNSPECIFIED' | 'CANARY_MODE_ALWAYS_ENABLED' | 'CANARY_MODE_ALWAYS_DISABLED' | 'CANARY_MODE_DEFAULT_ENABLED' | 'CANARY_MODE_DEFAULT_DISABLED'; | ||
export interface DebuggeeProperties { | ||
@@ -16,2 +17,3 @@ project?: string; | ||
packageInfo?: PackageInfo; | ||
canaryMode?: CanaryMode; | ||
} | ||
@@ -33,2 +35,3 @@ export declare class Debuggee { | ||
isInactive?: boolean; | ||
canaryMode?: CanaryMode; | ||
/** | ||
@@ -35,0 +38,0 @@ * Creates a Debuggee service object. |
@@ -60,2 +60,3 @@ "use strict"; | ||
this.agentVersion = properties.agentVersion; | ||
this.canaryMode = properties.canaryMode; | ||
if (properties.labels) { | ||
@@ -62,0 +63,0 @@ this.labels = properties.labels; |
@@ -60,2 +60,3 @@ export declare type Action = 'CAPTURE' | 'LOG'; | ||
successOnTimeout?: boolean; | ||
agentId?: string; | ||
} | ||
@@ -62,0 +63,0 @@ export interface ListBreakpointsResponse { |
{ | ||
"name": "@google-cloud/debug-agent", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"author": "Google Inc.", | ||
@@ -78,3 +78,3 @@ "description": "Stackdriver Debug Agent for Node.js", | ||
"linkinator": "^2.0.0", | ||
"mocha": "^7.0.0", | ||
"mocha": "^8.0.0", | ||
"mv": "^2.1.1", | ||
@@ -85,3 +85,3 @@ "ncp": "^2.0.0", | ||
"proxyquire": "^2.0.0", | ||
"teeny-request": "^6.0.0", | ||
"teeny-request": "^7.0.0", | ||
"tmp-promise": "^3.0.0", | ||
@@ -88,0 +88,0 @@ "typescript": "^3.8.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
437811
5628
26