@lssm/integration.runtime 0.0.0-canary-20251217083314 → 1.41.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/integration.runtime",
3
- "version": "0.0.0-canary-20251217083314",
3
+ "version": "1.41.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -23,26 +23,26 @@
23
23
  "test": "bun test"
24
24
  },
25
25
  "dependencies": {
26
- "@lssm/lib.contracts": "0.0.0-canary-20251217083314",
27
- "@lssm/lib.logger": "0.0.0-canary-20251217083314",
26
+ "@lssm/lib.contracts": "1.41.1",
27
+ "@lssm/lib.logger": "1.41.1",
28
28
  "@google-cloud/secret-manager": "^6.1.1",
29
29
  "google-gax": "^5.0.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@lssm/tool.tsdown": "0.0.0-canary-20251217083314",
33
- "@lssm/tool.typescript": "0.0.0-canary-20251217083314",
32
+ "@lssm/tool.tsdown": "1.41.1",
33
+ "@lssm/tool.typescript": "1.41.1",
34
34
  "tsdown": "^0.17.4",
35
35
  "typescript": "^5.9.3"
36
36
  },
37
37
  "exports": {
38
- ".": "./dist/index.js",
39
- "./health": "./dist/health.js",
40
- "./runtime": "./dist/runtime.js",
41
- "./secrets": "./dist/secrets/index.js",
42
- "./secrets/env-secret-provider": "./dist/secrets/env-secret-provider.js",
43
- "./secrets/gcp-secret-manager": "./dist/secrets/gcp-secret-manager.js",
44
- "./secrets/manager": "./dist/secrets/manager.js",
45
- "./secrets/provider": "./dist/secrets/provider.js",
38
+ ".": "./src/index.ts",
39
+ "./health": "./src/health.ts",
40
+ "./runtime": "./src/runtime.ts",
41
+ "./secrets": "./src/secrets/index.ts",
42
+ "./secrets/env-secret-provider": "./src/secrets/env-secret-provider.ts",
43
+ "./secrets/gcp-secret-manager": "./src/secrets/gcp-secret-manager.ts",
44
+ "./secrets/manager": "./src/secrets/manager.ts",
45
+ "./secrets/provider": "./src/secrets/provider.ts",
46
46
  "./*": "./*"
47
47
  },
48
48
  "publishConfig": {
package/dist/health.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { IntegrationContext, IntegrationTelemetryEmitter } from "./runtime.js";
2
- import { IntegrationConnectionHealth } from "@lssm/lib.contracts/integrations/connection";
3
-
4
- //#region src/health.d.ts
5
- interface IntegrationHealthCheckResult extends IntegrationConnectionHealth {
6
- metadata?: Record<string, string>;
7
- }
8
- type IntegrationHealthCheckExecutor = (context: IntegrationContext) => Promise<void>;
9
- interface IntegrationHealthServiceOptions {
10
- telemetry?: IntegrationTelemetryEmitter;
11
- now?: () => Date;
12
- }
13
- declare class IntegrationHealthService {
14
- private readonly telemetry?;
15
- private readonly nowFn;
16
- constructor(options?: IntegrationHealthServiceOptions);
17
- check(context: IntegrationContext, executor: IntegrationHealthCheckExecutor): Promise<IntegrationHealthCheckResult>;
18
- private emitTelemetry;
19
- }
20
- //#endregion
21
- export { IntegrationHealthCheckExecutor, IntegrationHealthCheckResult, IntegrationHealthService, IntegrationHealthServiceOptions };
package/dist/health.js DELETED
@@ -1,69 +0,0 @@
1
- //#region src/health.ts
2
- var IntegrationHealthService = class {
3
- telemetry;
4
- nowFn;
5
- constructor(options = {}) {
6
- this.telemetry = options.telemetry;
7
- this.nowFn = options.now ?? (() => /* @__PURE__ */ new Date());
8
- }
9
- async check(context, executor) {
10
- const start = this.nowFn();
11
- try {
12
- await executor(context);
13
- const end = this.nowFn();
14
- const result = {
15
- status: "connected",
16
- checkedAt: end,
17
- latencyMs: end.getTime() - start.getTime()
18
- };
19
- this.emitTelemetry(context, result, "success");
20
- return result;
21
- } catch (error) {
22
- const end = this.nowFn();
23
- const message = error instanceof Error ? error.message : "Unknown error";
24
- const code = extractErrorCode(error);
25
- const result = {
26
- status: "error",
27
- checkedAt: end,
28
- latencyMs: end.getTime() - start.getTime(),
29
- errorMessage: message,
30
- errorCode: code
31
- };
32
- this.emitTelemetry(context, result, "error", code, message);
33
- return result;
34
- }
35
- }
36
- emitTelemetry(context, result, status, errorCode, errorMessage) {
37
- if (!this.telemetry) return;
38
- this.telemetry.record({
39
- tenantId: context.tenantId,
40
- appId: context.appId,
41
- environment: context.environment,
42
- slotId: context.slotId,
43
- integrationKey: context.spec.meta.key,
44
- integrationVersion: context.spec.meta.version,
45
- connectionId: context.connection.meta.id,
46
- status,
47
- durationMs: result.latencyMs,
48
- errorCode,
49
- errorMessage,
50
- occurredAt: result.checkedAt ?? this.nowFn(),
51
- metadata: {
52
- ...context.trace ? {
53
- blueprint: `${context.trace.blueprintName}.v${context.trace.blueprintVersion}`,
54
- configVersion: context.trace.configVersion
55
- } : {},
56
- status: result.status
57
- }
58
- });
59
- }
60
- };
61
- function extractErrorCode(error) {
62
- if (!error || typeof error !== "object") return void 0;
63
- const candidate = error;
64
- if (candidate.code == null) return void 0;
65
- return String(candidate.code);
66
- }
67
-
68
- //#endregion
69
- export { IntegrationHealthService };
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { ParsedSecretUri, SecretFetchOptions, SecretPayloadEncoding, SecretProvider, SecretProviderError, SecretReference, SecretRotationResult, SecretValue, SecretWritePayload, normalizeSecretPayload, parseSecretUri } from "./secrets/provider.js";
2
- import { IntegrationCallContext, IntegrationCallError, IntegrationCallGuard, IntegrationCallGuardOptions, IntegrationCallResult, IntegrationContext, IntegrationInvocationStatus, IntegrationTelemetryEmitter, IntegrationTelemetryEvent, IntegrationTraceMetadata, connectionStatusLabel, ensureConnectionReady } from "./runtime.js";
3
- import { IntegrationHealthCheckExecutor, IntegrationHealthCheckResult, IntegrationHealthService, IntegrationHealthServiceOptions } from "./health.js";
4
- import { GcpSecretManagerProvider } from "./secrets/gcp-secret-manager.js";
5
- import { EnvSecretProvider } from "./secrets/env-secret-provider.js";
6
- import { SecretProviderManager, SecretProviderManagerOptions } from "./secrets/manager.js";
7
- import "./secrets/index.js";
8
- export { EnvSecretProvider, GcpSecretManagerProvider, IntegrationCallContext, IntegrationCallError, IntegrationCallGuard, IntegrationCallGuardOptions, IntegrationCallResult, IntegrationContext, IntegrationHealthCheckExecutor, IntegrationHealthCheckResult, IntegrationHealthService, IntegrationHealthServiceOptions, IntegrationInvocationStatus, IntegrationTelemetryEmitter, IntegrationTelemetryEvent, IntegrationTraceMetadata, ParsedSecretUri, SecretFetchOptions, SecretPayloadEncoding, SecretProvider, SecretProviderError, SecretProviderManager, SecretProviderManagerOptions, SecretReference, SecretRotationResult, SecretValue, SecretWritePayload, connectionStatusLabel, ensureConnectionReady, normalizeSecretPayload, parseSecretUri };
package/dist/index.js DELETED
@@ -1,9 +0,0 @@
1
- import { IntegrationHealthService } from "./health.js";
2
- import { IntegrationCallGuard, connectionStatusLabel, ensureConnectionReady } from "./runtime.js";
3
- import { SecretProviderError, normalizeSecretPayload, parseSecretUri } from "./secrets/provider.js";
4
- import { GcpSecretManagerProvider } from "./secrets/gcp-secret-manager.js";
5
- import { EnvSecretProvider } from "./secrets/env-secret-provider.js";
6
- import { SecretProviderManager } from "./secrets/manager.js";
7
- import "./secrets/index.js";
8
-
9
- export { EnvSecretProvider, GcpSecretManagerProvider, IntegrationCallGuard, IntegrationHealthService, SecretProviderError, SecretProviderManager, connectionStatusLabel, ensureConnectionReady, normalizeSecretPayload, parseSecretUri };
package/dist/runtime.d.ts DELETED
@@ -1,99 +0,0 @@
1
- import { SecretProvider } from "./secrets/provider.js";
2
- import { ConnectionStatus, IntegrationConnection } from "@lssm/lib.contracts/integrations/connection";
3
- import { ResolvedAppConfig, ResolvedIntegration } from "@lssm/lib.contracts/app-config/runtime";
4
- import { IntegrationSpec } from "@lssm/lib.contracts/integrations/spec";
5
-
6
- //#region src/runtime.d.ts
7
- interface IntegrationTraceMetadata {
8
- blueprintName: string;
9
- blueprintVersion: number;
10
- configVersion: number;
11
- }
12
- interface IntegrationTelemetryEvent {
13
- tenantId: string;
14
- appId: string;
15
- environment?: string;
16
- slotId?: string;
17
- integrationKey: string;
18
- integrationVersion: number;
19
- connectionId: string;
20
- status: 'success' | 'error';
21
- durationMs?: number;
22
- errorCode?: string;
23
- errorMessage?: string;
24
- occurredAt: Date;
25
- metadata?: Record<string, string | number | boolean>;
26
- }
27
- interface IntegrationTelemetryEmitter {
28
- record(event: IntegrationTelemetryEvent): Promise<void> | void;
29
- }
30
- type IntegrationInvocationStatus = 'success' | 'error';
31
- interface IntegrationContext {
32
- tenantId: string;
33
- appId: string;
34
- environment?: string;
35
- slotId?: string;
36
- spec: IntegrationSpec;
37
- connection: IntegrationConnection;
38
- secretProvider: SecretProvider;
39
- secretReference: string;
40
- trace: IntegrationTraceMetadata;
41
- config?: Record<string, unknown>;
42
- }
43
- interface IntegrationCallContext {
44
- tenantId: string;
45
- appId: string;
46
- environment?: string;
47
- blueprintName: string;
48
- blueprintVersion: number;
49
- configVersion: number;
50
- slotId: string;
51
- operation: string;
52
- }
53
- interface IntegrationCallError {
54
- code: string;
55
- message: string;
56
- retryable: boolean;
57
- cause?: unknown;
58
- }
59
- interface IntegrationCallResult<T> {
60
- success: boolean;
61
- data?: T;
62
- error?: IntegrationCallError;
63
- metadata: {
64
- latencyMs: number;
65
- connectionId: string;
66
- ownershipMode: IntegrationConnection['ownershipMode'];
67
- attempts: number;
68
- };
69
- }
70
- interface IntegrationCallGuardOptions {
71
- telemetry?: IntegrationTelemetryEmitter;
72
- maxAttempts?: number;
73
- backoffMs?: number;
74
- shouldRetry?: (error: unknown, attempt: number) => boolean;
75
- sleep?: (ms: number) => Promise<void>;
76
- now?: () => Date;
77
- }
78
- declare class IntegrationCallGuard {
79
- private readonly secretProvider;
80
- private readonly telemetry?;
81
- private readonly maxAttempts;
82
- private readonly backoffMs;
83
- private readonly shouldRetry;
84
- private readonly sleep;
85
- private readonly now;
86
- constructor(secretProvider: SecretProvider, options?: IntegrationCallGuardOptions);
87
- executeWithGuards<T>(slotId: string, operation: string, _input: unknown, resolvedConfig: ResolvedAppConfig, executor: (connection: IntegrationConnection, secrets: Record<string, string>) => Promise<T>): Promise<IntegrationCallResult<T>>;
88
- private findIntegration;
89
- private fetchSecrets;
90
- private parseSecret;
91
- private emitTelemetry;
92
- private failure;
93
- private makeContext;
94
- private errorCodeFor;
95
- }
96
- declare function ensureConnectionReady(integration: ResolvedIntegration): void;
97
- declare function connectionStatusLabel(status: ConnectionStatus): string;
98
- //#endregion
99
- export { IntegrationCallContext, IntegrationCallError, IntegrationCallGuard, IntegrationCallGuardOptions, IntegrationCallResult, IntegrationContext, IntegrationInvocationStatus, IntegrationTelemetryEmitter, IntegrationTelemetryEvent, IntegrationTraceMetadata, connectionStatusLabel, ensureConnectionReady };
package/dist/runtime.js DELETED
@@ -1,186 +0,0 @@
1
- import { performance } from "node:perf_hooks";
2
-
3
- //#region src/runtime.ts
4
- const DEFAULT_MAX_ATTEMPTS = 3;
5
- const DEFAULT_BACKOFF_MS = 250;
6
- var IntegrationCallGuard = class {
7
- telemetry;
8
- maxAttempts;
9
- backoffMs;
10
- shouldRetry;
11
- sleep;
12
- now;
13
- constructor(secretProvider, options = {}) {
14
- this.secretProvider = secretProvider;
15
- this.telemetry = options.telemetry;
16
- this.maxAttempts = Math.max(1, options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
17
- this.backoffMs = options.backoffMs ?? DEFAULT_BACKOFF_MS;
18
- this.shouldRetry = options.shouldRetry ?? ((error) => typeof error === "object" && error !== null && "retryable" in error && Boolean(error.retryable));
19
- this.sleep = options.sleep ?? ((ms) => ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms)));
20
- this.now = options.now ?? (() => /* @__PURE__ */ new Date());
21
- }
22
- async executeWithGuards(slotId, operation, _input, resolvedConfig, executor) {
23
- const integration = this.findIntegration(slotId, resolvedConfig);
24
- if (!integration) return this.failure({
25
- tenantId: resolvedConfig.tenantId,
26
- appId: resolvedConfig.appId,
27
- environment: resolvedConfig.environment,
28
- blueprintName: resolvedConfig.blueprintName,
29
- blueprintVersion: resolvedConfig.blueprintVersion,
30
- configVersion: resolvedConfig.configVersion,
31
- slotId,
32
- operation
33
- }, void 0, {
34
- code: "SLOT_NOT_BOUND",
35
- message: `Integration slot "${slotId}" is not bound for tenant "${resolvedConfig.tenantId}".`,
36
- retryable: false
37
- }, 0);
38
- const status = integration.connection.status;
39
- if (status === "disconnected" || status === "error") return this.failure(this.makeContext(slotId, operation, resolvedConfig), integration, {
40
- code: "CONNECTION_NOT_READY",
41
- message: `Integration connection "${integration.connection.meta.label}" is in status "${status}".`,
42
- retryable: false
43
- }, 0);
44
- const secrets = await this.fetchSecrets(integration.connection);
45
- let attempt = 0;
46
- const started = performance.now();
47
- while (attempt < this.maxAttempts) {
48
- attempt += 1;
49
- try {
50
- const data = await executor(integration.connection, secrets);
51
- const duration = performance.now() - started;
52
- this.emitTelemetry(this.makeContext(slotId, operation, resolvedConfig), integration, "success", duration);
53
- return {
54
- success: true,
55
- data,
56
- metadata: {
57
- latencyMs: duration,
58
- connectionId: integration.connection.meta.id,
59
- ownershipMode: integration.connection.ownershipMode,
60
- attempts: attempt
61
- }
62
- };
63
- } catch (error) {
64
- const duration = performance.now() - started;
65
- this.emitTelemetry(this.makeContext(slotId, operation, resolvedConfig), integration, "error", duration, this.errorCodeFor(error), error instanceof Error ? error.message : String(error));
66
- const retryable = this.shouldRetry(error, attempt);
67
- if (!retryable || attempt >= this.maxAttempts) return {
68
- success: false,
69
- error: {
70
- code: this.errorCodeFor(error),
71
- message: error instanceof Error ? error.message : String(error),
72
- retryable,
73
- cause: error
74
- },
75
- metadata: {
76
- latencyMs: duration,
77
- connectionId: integration.connection.meta.id,
78
- ownershipMode: integration.connection.ownershipMode,
79
- attempts: attempt
80
- }
81
- };
82
- await this.sleep(this.backoffMs);
83
- }
84
- }
85
- return {
86
- success: false,
87
- error: {
88
- code: "UNKNOWN_ERROR",
89
- message: "Integration call failed after retries.",
90
- retryable: false
91
- },
92
- metadata: {
93
- latencyMs: performance.now() - started,
94
- connectionId: integration.connection.meta.id,
95
- ownershipMode: integration.connection.ownershipMode,
96
- attempts: this.maxAttempts
97
- }
98
- };
99
- }
100
- findIntegration(slotId, config) {
101
- return config.integrations.find((integration) => integration.slot.slotId === slotId);
102
- }
103
- async fetchSecrets(connection) {
104
- if (!this.secretProvider.canHandle(connection.secretRef)) throw new Error(`Secret provider "${this.secretProvider.id}" cannot handle reference "${connection.secretRef}".`);
105
- const secret = await this.secretProvider.getSecret(connection.secretRef);
106
- return this.parseSecret(secret);
107
- }
108
- parseSecret(secret) {
109
- const text = new TextDecoder().decode(secret.data);
110
- try {
111
- const parsed = JSON.parse(text);
112
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
113
- const entries = Object.entries(parsed).filter(([, value]) => typeof value === "string" || typeof value === "number" || typeof value === "boolean");
114
- return Object.fromEntries(entries.map(([key, value]) => [key, String(value)]));
115
- }
116
- } catch {}
117
- return { secret: text };
118
- }
119
- emitTelemetry(context, integration, status, durationMs, errorCode, errorMessage) {
120
- if (!this.telemetry || !integration) return;
121
- this.telemetry.record({
122
- tenantId: context.tenantId,
123
- appId: context.appId,
124
- environment: context.environment,
125
- slotId: context.slotId,
126
- integrationKey: integration.connection.meta.integrationKey,
127
- integrationVersion: integration.connection.meta.integrationVersion,
128
- connectionId: integration.connection.meta.id,
129
- status,
130
- durationMs,
131
- errorCode,
132
- errorMessage,
133
- occurredAt: this.now(),
134
- metadata: {
135
- blueprint: `${context.blueprintName}.v${context.blueprintVersion}`,
136
- configVersion: context.configVersion,
137
- operation: context.operation
138
- }
139
- });
140
- }
141
- failure(context, integration, error, attempts) {
142
- if (integration) this.emitTelemetry(context, integration, "error", 0, error.code, error.message);
143
- return {
144
- success: false,
145
- error,
146
- metadata: {
147
- latencyMs: 0,
148
- connectionId: integration?.connection.meta.id ?? "unknown",
149
- ownershipMode: integration?.connection.ownershipMode ?? "managed",
150
- attempts
151
- }
152
- };
153
- }
154
- makeContext(slotId, operation, config) {
155
- return {
156
- tenantId: config.tenantId,
157
- appId: config.appId,
158
- environment: config.environment,
159
- blueprintName: config.blueprintName,
160
- blueprintVersion: config.blueprintVersion,
161
- configVersion: config.configVersion,
162
- slotId,
163
- operation
164
- };
165
- }
166
- errorCodeFor(error) {
167
- if (typeof error === "object" && error !== null && "code" in error && typeof error.code === "string") return error.code;
168
- return "PROVIDER_ERROR";
169
- }
170
- };
171
- function ensureConnectionReady(integration) {
172
- const status = integration.connection.status;
173
- if (status === "disconnected" || status === "error") throw new Error(`Integration connection "${integration.connection.meta.label}" is in status "${status}".`);
174
- }
175
- function connectionStatusLabel(status) {
176
- switch (status) {
177
- case "connected": return "connected";
178
- case "disconnected": return "disconnected";
179
- case "error": return "error";
180
- case "unknown":
181
- default: return "unknown";
182
- }
183
- }
184
-
185
- //#endregion
186
- export { IntegrationCallGuard, connectionStatusLabel, ensureConnectionReady };
@@ -1,31 +0,0 @@
1
- import { SecretProvider, SecretReference, SecretRotationResult, SecretValue, SecretWritePayload } from "./provider.js";
2
-
3
- //#region src/secrets/env-secret-provider.d.ts
4
- interface EnvSecretProviderOptions {
5
- /**
6
- * Optional map to alias secret references to environment variable names.
7
- * Useful when referencing secrets from other providers (e.g. gcp://...)
8
- * while still allowing local overrides.
9
- */
10
- aliases?: Record<string, string>;
11
- }
12
- /**
13
- * Environment-variable backed secret provider. Read-only by design.
14
- * Allows overriding other secret providers by deriving environment variable
15
- * names from secret references (or by using explicit aliases).
16
- */
17
- declare class EnvSecretProvider implements SecretProvider {
18
- readonly id = "env";
19
- private readonly aliases;
20
- constructor(options?: EnvSecretProviderOptions);
21
- canHandle(reference: SecretReference): boolean;
22
- getSecret(reference: SecretReference): Promise<SecretValue>;
23
- setSecret(reference: SecretReference, _payload: SecretWritePayload): Promise<SecretRotationResult>;
24
- rotateSecret(reference: SecretReference, _payload: SecretWritePayload): Promise<SecretRotationResult>;
25
- deleteSecret(reference: SecretReference): Promise<void>;
26
- private resolveEnvKey;
27
- private deriveEnvKey;
28
- private forbiddenError;
29
- }
30
- //#endregion
31
- export { EnvSecretProvider };
@@ -1,81 +0,0 @@
1
- import { SecretProviderError, parseSecretUri } from "./provider.js";
2
-
3
- //#region src/secrets/env-secret-provider.ts
4
- /**
5
- * Environment-variable backed secret provider. Read-only by design.
6
- * Allows overriding other secret providers by deriving environment variable
7
- * names from secret references (or by using explicit aliases).
8
- */
9
- var EnvSecretProvider = class {
10
- id = "env";
11
- aliases;
12
- constructor(options = {}) {
13
- this.aliases = options.aliases ?? {};
14
- }
15
- canHandle(reference) {
16
- const envKey = this.resolveEnvKey(reference);
17
- return envKey !== void 0 && process.env[envKey] !== void 0;
18
- }
19
- async getSecret(reference) {
20
- const envKey = this.resolveEnvKey(reference);
21
- if (!envKey) throw new SecretProviderError({
22
- message: `Unable to resolve environment variable for reference "${reference}".`,
23
- provider: this.id,
24
- reference,
25
- code: "INVALID"
26
- });
27
- const value = process.env[envKey];
28
- if (value === void 0) throw new SecretProviderError({
29
- message: `Environment variable "${envKey}" not found for reference "${reference}".`,
30
- provider: this.id,
31
- reference,
32
- code: "NOT_FOUND"
33
- });
34
- return {
35
- data: Buffer.from(value, "utf-8"),
36
- version: "current",
37
- metadata: {
38
- source: "env",
39
- envKey
40
- },
41
- retrievedAt: /* @__PURE__ */ new Date()
42
- };
43
- }
44
- async setSecret(reference, _payload) {
45
- throw this.forbiddenError("setSecret", reference);
46
- }
47
- async rotateSecret(reference, _payload) {
48
- throw this.forbiddenError("rotateSecret", reference);
49
- }
50
- async deleteSecret(reference) {
51
- throw this.forbiddenError("deleteSecret", reference);
52
- }
53
- resolveEnvKey(reference) {
54
- if (!reference) return;
55
- if (this.aliases[reference]) return this.aliases[reference];
56
- if (!reference.includes("://")) return reference;
57
- try {
58
- const parsed = parseSecretUri(reference);
59
- if (parsed.provider === "env") return parsed.path;
60
- if (parsed.extras?.env) return parsed.extras.env;
61
- return this.deriveEnvKey(parsed.path);
62
- } catch {
63
- return reference;
64
- }
65
- }
66
- deriveEnvKey(path) {
67
- if (!path) return void 0;
68
- return path.split(/[\/:\-\.]/).filter(Boolean).map((segment) => segment.replace(/[^a-zA-Z0-9]/g, "_").replace(/_{2,}/g, "_").toUpperCase()).join("_");
69
- }
70
- forbiddenError(operation, reference) {
71
- return new SecretProviderError({
72
- message: `EnvSecretProvider is read-only. "${operation}" is not allowed for ${reference}.`,
73
- provider: this.id,
74
- reference,
75
- code: "FORBIDDEN"
76
- });
77
- }
78
- };
79
-
80
- //#endregion
81
- export { EnvSecretProvider };
@@ -1,32 +0,0 @@
1
- import { SecretProvider, SecretReference, SecretRotationResult, SecretValue, SecretWritePayload } from "./provider.js";
2
- import { SecretManagerServiceClient, protos } from "@google-cloud/secret-manager";
3
- import { CallOptions } from "google-gax";
4
-
5
- //#region src/secrets/gcp-secret-manager.d.ts
6
- type SecretManagerClient = SecretManagerServiceClient;
7
- interface GcpSecretManagerProviderOptions {
8
- projectId?: string;
9
- client?: SecretManagerClient;
10
- clientOptions?: ConstructorParameters<typeof SecretManagerServiceClient>[0];
11
- defaultReplication?: protos.google.cloud.secretmanager.v1.IReplication;
12
- }
13
- declare class GcpSecretManagerProvider implements SecretProvider {
14
- readonly id = "gcp-secret-manager";
15
- private readonly client;
16
- private readonly explicitProjectId?;
17
- private readonly replication;
18
- constructor(options?: GcpSecretManagerProviderOptions);
19
- canHandle(reference: SecretReference): boolean;
20
- getSecret(reference: SecretReference, options?: {
21
- version?: string;
22
- }, callOptions?: CallOptions): Promise<SecretValue>;
23
- setSecret(reference: SecretReference, payload: SecretWritePayload): Promise<SecretRotationResult>;
24
- rotateSecret(reference: SecretReference, payload: SecretWritePayload): Promise<SecretRotationResult>;
25
- deleteSecret(reference: SecretReference): Promise<void>;
26
- private parseReference;
27
- private buildNames;
28
- private buildVersionName;
29
- private ensureSecretExists;
30
- }
31
- //#endregion
32
- export { GcpSecretManagerProvider };