@aifabrix/miso-client 4.22.3 → 4.23.0
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/CHANGELOG.md +28 -0
- package/README.md +6 -0
- package/dist/bootstrap/identity.d.ts +4 -0
- package/dist/bootstrap/identity.d.ts.map +1 -0
- package/dist/bootstrap/identity.js +28 -0
- package/dist/bootstrap/identity.js.map +1 -0
- package/dist/bootstrap/index.d.ts +11 -0
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/bootstrap/index.js +50 -0
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/bootstrap/json.d.ts +3 -0
- package/dist/bootstrap/json.d.ts.map +1 -0
- package/dist/bootstrap/json.js +26 -0
- package/dist/bootstrap/json.js.map +1 -0
- package/dist/bootstrap/runtime.d.ts +41 -0
- package/dist/bootstrap/runtime.d.ts.map +1 -0
- package/dist/bootstrap/runtime.js +210 -0
- package/dist/bootstrap/runtime.js.map +1 -0
- package/dist/bootstrap/transport.d.ts +15 -0
- package/dist/bootstrap/transport.d.ts.map +1 -0
- package/dist/bootstrap/transport.js +177 -0
- package/dist/bootstrap/transport.js.map +1 -0
- package/dist/bootstrap/types.d.ts +48 -0
- package/dist/bootstrap/types.d.ts.map +1 -0
- package/dist/bootstrap/types.js +13 -0
- package/dist/bootstrap/types.js.map +1 -0
- package/dist/bootstrap/validation.d.ts +4 -0
- package/dist/bootstrap/validation.d.ts.map +1 -0
- package/dist/bootstrap/validation.js +99 -0
- package/dist/bootstrap/validation.js.map +1 -0
- package/dist/services/auth-environment-token.d.ts +1 -1
- package/dist/services/auth-environment-token.d.ts.map +1 -1
- package/dist/services/auth-environment-token.js +9 -40
- package/dist/services/auth-environment-token.js.map +1 -1
- package/dist/utils/client-token-manager.d.ts.map +1 -1
- package/dist/utils/client-token-manager.js +8 -35
- package/dist/utils/client-token-manager.js.map +1 -1
- package/dist/utils/internal-http-client.d.ts.map +1 -1
- package/dist/utils/internal-http-client.js +7 -0
- package/dist/utils/internal-http-client.js.map +1 -1
- package/dist/utils/runtime-guard.d.ts +9 -0
- package/dist/utils/runtime-guard.d.ts.map +1 -0
- package/dist/utils/runtime-guard.js +12 -0
- package/dist/utils/runtime-guard.js.map +1 -0
- package/package.json +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.23.0] - 2026-09-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Server secrets initialization** - Added the Node-only `@aifabrix/miso-client/bootstrap` entrypoint with `initSecrets()`, a shared runtime client, secret accessors, lifecycle notifications and awaitable cleanup.
|
|
15
|
+
- **Older-controller compatibility** - Unset/local mode reuses existing credentials and dotenv precedence without loading Azure Identity, probing managed identity or calling the bootstrap endpoint.
|
|
16
|
+
- **Opt-in managed identity** - Added optional Azure Identity support, identity-only broker requests, strict v1 response validation, token-only SDK configuration and in-memory refresh. Managed-identity mode requires the new controller contract; protected-API denial integration, canonical parity fixtures and live Azure certification remain incomplete and are required before production rollout.
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
|
|
20
|
+
- **Bootstrap isolation** - Pin the validated controller URL, isolate bootstrap HTTP interceptors, reject redirects, bound identity/HTTP operations, sanitize errors and prevent local-credential fallback after managed-identity failure.
|
|
21
|
+
- **Runtime lifecycle** - Guard outbound requests after invalidation or close, enforce independent token/secret deadlines, suppress late refresh results and make shutdown idempotent.
|
|
22
|
+
|
|
23
|
+
### Technical
|
|
24
|
+
|
|
25
|
+
- **Validation** - Added unit and fresh-process package checks for local compatibility, browser exclusion, managed-identity startup, expiry, cancellation and redaction. Publishing CI runs the package smoke check after building.
|
|
26
|
+
- **Release process** - Stage version-line release branches for human PR review before main promotion and npm publication.
|
|
27
|
+
|
|
28
|
+
## [4.22.4] - 2026-09-13
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **Client token fetch in Jest** - Load Node `http`/`https` agents with `require` and import axios statically so environment-token and InternalHttpClient token bootstrap no longer use ESM `import()` (which fails in the Jest VM without `--experimental-vm-modules`).
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **TypeScript 6 / nodenext** - Updated compiler, ESLint, and lockfile module resolution for TypeScript 6.0.3.
|
|
37
|
+
|
|
10
38
|
## [4.22.3] - 2026-09-13
|
|
11
39
|
|
|
12
40
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1191,3 +1191,9 @@ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) fi
|
|
|
1191
1191
|
---
|
|
1192
1192
|
|
|
1193
1193
|
**Made with ❤️ by eSystems Nordic Ltd.**
|
|
1194
|
+
|
|
1195
|
+
### Optional server secrets initialization
|
|
1196
|
+
|
|
1197
|
+
Use `initSecrets()` from `@aifabrix/miso-client/bootstrap` for a shared local/Azure
|
|
1198
|
+
startup API. Unset or `local` auth mode uses existing credentials without Azure calls
|
|
1199
|
+
or a new controller endpoint. See [the startup guide](docs/managed-identity-bootstrap.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/bootstrap/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjE,mFAAmF;AACnF,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAmB9E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createIdentityProvider = createIdentityProvider;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
/** Load only the official managed-identity credential, never a developer chain. */
|
|
6
|
+
async function createIdentityProvider() {
|
|
7
|
+
try {
|
|
8
|
+
const { ManagedIdentityCredential } = await import("@azure/identity");
|
|
9
|
+
const credential = new ManagedIdentityCredential({
|
|
10
|
+
clientId: process.env.AZURE_CLIENT_ID,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
async getToken(scope, abortSignal) {
|
|
14
|
+
const token = await credential.getToken(scope, { abortSignal });
|
|
15
|
+
if (!token)
|
|
16
|
+
throw new types_1.BootstrapError("identity-unavailable");
|
|
17
|
+
return {
|
|
18
|
+
token: token.token,
|
|
19
|
+
expiresAt: new Date(token.expiresOnTimestamp),
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new types_1.BootstrapError("identity-unavailable");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/bootstrap/identity.ts"],"names":[],"mappings":";;AAGA,wDAmBC;AAtBD,mCAAiE;AAEjE,mFAAmF;AAC5E,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC;QACH,MAAM,EAAE,yBAAyB,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACtE,MAAM,UAAU,GAAG,IAAI,yBAAyB,CAAC;YAC/C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;SACtC,CAAC,CAAC;QACH,OAAO;YACL,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW;gBAC/B,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;gBAChE,IAAI,CAAC,KAAK;oBAAE,MAAM,IAAI,sBAAc,CAAC,sBAAsB,CAAC,CAAC;gBAC7D,OAAO;oBACL,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;iBAC9C,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,sBAAc,CAAC,sBAAsB,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InitSecretsOptions, SecretsRuntime } from "./types";
|
|
2
|
+
export type { BootstrapContext, BootstrapTokenProvider, InitSecretsOptions, SecretsRuntime, RuntimeInvalidationReason, } from "./types";
|
|
3
|
+
export { BootstrapError } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Initialize one Node-only secrets runtime. Unset/local mode uses existing config
|
|
6
|
+
* and never imports Azure Identity or contacts the broker. Azure mode is explicit.
|
|
7
|
+
* @param options Optional caller-owned identity provider for controlled hosts/tests.
|
|
8
|
+
* @returns Initialized client, secret accessors, subscriptions and close operation.
|
|
9
|
+
*/
|
|
10
|
+
export declare function initSecrets(options?: InitSecretsOptions): Promise<SecretsRuntime>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bootstrap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,kBAAkB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI7E,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,cAAc,CAAC,CAqBzB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BootstrapError = void 0;
|
|
4
|
+
exports.initSecrets = initSecrets;
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const runtime_1 = require("./runtime");
|
|
7
|
+
const transport_1 = require("./transport");
|
|
8
|
+
var types_2 = require("./types");
|
|
9
|
+
Object.defineProperty(exports, "BootstrapError", { enumerable: true, get: function () { return types_2.BootstrapError; } });
|
|
10
|
+
/**
|
|
11
|
+
* Initialize one Node-only secrets runtime. Unset/local mode uses existing config
|
|
12
|
+
* and never imports Azure Identity or contacts the broker. Azure mode is explicit.
|
|
13
|
+
* @param options Optional caller-owned identity provider for controlled hosts/tests.
|
|
14
|
+
* @returns Initialized client, secret accessors, subscriptions and close operation.
|
|
15
|
+
*/
|
|
16
|
+
async function initSecrets(options = {}) {
|
|
17
|
+
const mode = process.env.MISO_AUTH_MODE;
|
|
18
|
+
if (mode === undefined || mode === "local")
|
|
19
|
+
return localRuntime();
|
|
20
|
+
if (mode !== "azure-managed-identity")
|
|
21
|
+
throw new types_1.BootstrapError("unknown-auth-mode");
|
|
22
|
+
const settings = (0, transport_1.azureSettings)();
|
|
23
|
+
const provider = options.tokenProvider ??
|
|
24
|
+
(await (await import("./identity.js")).createIdentityProvider());
|
|
25
|
+
const state = new runtime_1.RuntimeState((signal) => (0, transport_1.fetchSnapshot)(provider, settings, signal));
|
|
26
|
+
try {
|
|
27
|
+
await state.start();
|
|
28
|
+
return await (0, runtime_1.createRuntime)(state, state.config(settings.controllerUrl));
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
await state.close();
|
|
32
|
+
throw error instanceof types_1.BootstrapError
|
|
33
|
+
? error
|
|
34
|
+
: new types_1.BootstrapError("initialization-failed");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function localRuntime() {
|
|
38
|
+
const state = new runtime_1.RuntimeState();
|
|
39
|
+
try {
|
|
40
|
+
const { loadConfig } = await import("../utils/config-loader.js");
|
|
41
|
+
const config = loadConfig();
|
|
42
|
+
state.local(process.env);
|
|
43
|
+
return await (0, runtime_1.createRuntime)(state, config);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
await state.close();
|
|
47
|
+
throw new types_1.BootstrapError("local-configuration");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bootstrap/index.ts"],"names":[],"mappings":";;;AAmBA,kCAuBC;AA1CD,mCAA6E;AAC7E,uCAAwD;AACxD,2CAA2D;AAS3D,iCAAyC;AAAhC,uGAAA,cAAc,OAAA;AAEvB;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAC/B,UAA8B,EAAE;IAEhC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IACxC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,YAAY,EAAE,CAAC;IAClE,IAAI,IAAI,KAAK,wBAAwB;QACnC,MAAM,IAAI,sBAAc,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,IAAA,yBAAa,GAAE,CAAC;IACjC,MAAM,QAAQ,GACZ,OAAO,CAAC,aAAa;QACrB,CAAC,MAAM,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,IAAI,sBAAY,CAAC,CAAC,MAAM,EAAE,EAAE,CACxC,IAAA,yBAAa,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAC1C,CAAC;IACF,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,OAAO,MAAM,IAAA,uBAAa,EAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,KAAK,YAAY,sBAAc;YACnC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,sBAAc,CAAC,uBAAuB,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,MAAM,KAAK,GAAG,IAAI,sBAAY,EAAE,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAC5B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,OAAO,MAAM,IAAA,uBAAa,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,IAAI,sBAAc,CAAC,qBAAqB,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/bootstrap/json.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAgBtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBrokerJson = parseBrokerJson;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
/** Reject duplicate object members before JSON.parse can silently replace them. */
|
|
6
|
+
function parseBrokerJson(input) {
|
|
7
|
+
const tokens = input.match(/"(?:\\.|[^"\\])*"|[{}[\]:,]|[^\s{}[\]:,]+/g) || [];
|
|
8
|
+
const stack = [];
|
|
9
|
+
tokens.forEach((token, index) => {
|
|
10
|
+
if (token === "{")
|
|
11
|
+
stack.push(new Set());
|
|
12
|
+
else if (token === "[")
|
|
13
|
+
stack.push(null);
|
|
14
|
+
else if (token === "}" || token === "]")
|
|
15
|
+
stack.pop();
|
|
16
|
+
else if (token.startsWith('"') && tokens[index + 1] === ":") {
|
|
17
|
+
const keys = stack[stack.length - 1];
|
|
18
|
+
const key = JSON.parse(token);
|
|
19
|
+
if (!keys || keys.has(key))
|
|
20
|
+
throw new types_1.BootstrapError("protocol-error");
|
|
21
|
+
keys.add(key);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return JSON.parse(input);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/bootstrap/json.ts"],"names":[],"mappings":";;AAGA,0CAgBC;AAnBD,mCAAyC;AAEzC,mFAAmF;AACnF,SAAgB,eAAe,CAAC,KAAa;IAC3C,MAAM,MAAM,GACV,KAAK,CAAC,KAAK,CAAC,4CAA4C,CAAC,IAAI,EAAE,CAAC;IAClE,MAAM,KAAK,GAA8B,EAAE,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,KAAK,KAAK,GAAG;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;aACpC,IAAI,KAAK,KAAK,GAAG;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACpC,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG;YAAE,KAAK,CAAC,GAAG,EAAE,CAAC;aAChD,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACrC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAW,CAAC;YACxC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,sBAAc,CAAC,gBAAgB,CAAC,CAAC;YACvE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MisoClient } from "../miso-client";
|
|
2
|
+
import type { MisoClientConfig } from "../types/config.types";
|
|
3
|
+
import { BootstrapSnapshot, SecretsRuntime } from "./types";
|
|
4
|
+
/** Private state is deliberately absent from runtime diagnostics/serialization. */
|
|
5
|
+
export declare class RuntimeState {
|
|
6
|
+
private readonly fetch?;
|
|
7
|
+
private values;
|
|
8
|
+
private snapshot?;
|
|
9
|
+
private received;
|
|
10
|
+
private monotonic;
|
|
11
|
+
private reason?;
|
|
12
|
+
private changes;
|
|
13
|
+
private invalidations;
|
|
14
|
+
private controller;
|
|
15
|
+
private timer?;
|
|
16
|
+
private pending?;
|
|
17
|
+
private nextAttempt;
|
|
18
|
+
private closing?;
|
|
19
|
+
private context?;
|
|
20
|
+
constructor(fetch?: ((signal: AbortSignal) => Promise<BootstrapSnapshot>) | undefined);
|
|
21
|
+
start(): Promise<void>;
|
|
22
|
+
local(values: NodeJS.ProcessEnv): void;
|
|
23
|
+
private now;
|
|
24
|
+
private assertValid;
|
|
25
|
+
token(): Promise<string | undefined>;
|
|
26
|
+
private refresh;
|
|
27
|
+
private performRefresh;
|
|
28
|
+
private accept;
|
|
29
|
+
private schedule;
|
|
30
|
+
private handleFailure;
|
|
31
|
+
private invalidate;
|
|
32
|
+
private emit;
|
|
33
|
+
private subscribe;
|
|
34
|
+
config(url: string): MisoClientConfig;
|
|
35
|
+
private get;
|
|
36
|
+
runtime(client: MisoClient): SecretsRuntime;
|
|
37
|
+
close(client?: MisoClient): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/** Construct SDK connections only after provider initialization succeeds. */
|
|
40
|
+
export declare function createRuntime(state: RuntimeState, config: MisoClientConfig): Promise<SecretsRuntime>;
|
|
41
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/bootstrap/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EAGL,iBAAiB,EAEjB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,mFAAmF;AACnF,qBAAa,YAAY;IAkBrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAjBzB,OAAO,CAAC,MAAM,CAA+C;IAC7D,OAAO,CAAC,QAAQ,CAAC,CAAoB;IACrC,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAC,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAAgD;IAC/D,OAAO,CAAC,aAAa,CAEjB;IACJ,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,KAAK,CAAC,CAAgC;IAC9C,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,OAAO,CAAC,CAA6B;gBAG1B,KAAK,CAAC,GAAE,CACvB,MAAM,EAAE,WAAW,KAChB,OAAO,CAAC,iBAAiB,CAAC,aAAA;IAG3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,IAAI;IAQtC,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,WAAW;IAUb,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;YAiB5B,OAAO;YAYP,cAAc;IAa5B,OAAO,CAAC,MAAM;IAiCd,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,SAAS;IAWjB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB;IAqBrC,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,cAAc;IAsB3C,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAiB1C;AAED,6EAA6E;AAC7E,wBAAsB,aAAa,CACjC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAUzB"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeState = void 0;
|
|
4
|
+
exports.createRuntime = createRuntime;
|
|
5
|
+
const miso_client_1 = require("../miso-client");
|
|
6
|
+
const runtime_guard_1 = require("../utils/runtime-guard");
|
|
7
|
+
const transport_1 = require("./transport");
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
/** Private state is deliberately absent from runtime diagnostics/serialization. */
|
|
10
|
+
class RuntimeState {
|
|
11
|
+
constructor(fetch) {
|
|
12
|
+
this.fetch = fetch;
|
|
13
|
+
this.values = Object.create(null);
|
|
14
|
+
this.received = 0;
|
|
15
|
+
this.monotonic = 0;
|
|
16
|
+
this.changes = new Set();
|
|
17
|
+
this.invalidations = new Set();
|
|
18
|
+
this.controller = new AbortController();
|
|
19
|
+
this.nextAttempt = 0;
|
|
20
|
+
}
|
|
21
|
+
async start() {
|
|
22
|
+
if (this.fetch)
|
|
23
|
+
await this.refresh();
|
|
24
|
+
}
|
|
25
|
+
local(values) {
|
|
26
|
+
this.values = Object.fromEntries(Object.entries(values).filter((entry) => typeof entry[1] === "string"));
|
|
27
|
+
}
|
|
28
|
+
now() {
|
|
29
|
+
return Math.max(Date.now(), this.received + performance.now() - this.monotonic);
|
|
30
|
+
}
|
|
31
|
+
assertValid() {
|
|
32
|
+
if (!this.reason &&
|
|
33
|
+
this.snapshot &&
|
|
34
|
+
this.now() >= Date.parse(this.snapshot.expiresAt) - 30000)
|
|
35
|
+
this.invalidate("snapshot-expired");
|
|
36
|
+
if (this.reason)
|
|
37
|
+
throw new types_1.BootstrapError(this.reason);
|
|
38
|
+
}
|
|
39
|
+
async token() {
|
|
40
|
+
this.assertValid();
|
|
41
|
+
if (!this.fetch)
|
|
42
|
+
return undefined;
|
|
43
|
+
if (!this.snapshot ||
|
|
44
|
+
this.now() >= Date.parse(this.snapshot.clientTokenExpiresAt) - 30000)
|
|
45
|
+
await this.refresh();
|
|
46
|
+
this.assertValid();
|
|
47
|
+
if (!this.snapshot ||
|
|
48
|
+
this.now() >= Date.parse(this.snapshot.clientTokenExpiresAt) - 30000)
|
|
49
|
+
throw new types_1.BootstrapError("unavailable");
|
|
50
|
+
return this.snapshot.clientToken;
|
|
51
|
+
}
|
|
52
|
+
async refresh() {
|
|
53
|
+
this.assertValid();
|
|
54
|
+
if (this.pending)
|
|
55
|
+
return this.pending;
|
|
56
|
+
if (performance.now() < this.nextAttempt)
|
|
57
|
+
return Promise.reject(new types_1.BootstrapError("unavailable"));
|
|
58
|
+
this.nextAttempt = performance.now() + 30000;
|
|
59
|
+
this.pending = this.performRefresh().finally(() => {
|
|
60
|
+
this.pending = undefined;
|
|
61
|
+
});
|
|
62
|
+
return this.pending;
|
|
63
|
+
}
|
|
64
|
+
async performRefresh() {
|
|
65
|
+
try {
|
|
66
|
+
const snapshot = await this.fetch(this.controller.signal);
|
|
67
|
+
this.assertValid();
|
|
68
|
+
this.accept(snapshot);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
this.handleFailure(error);
|
|
72
|
+
throw error instanceof types_1.BootstrapError
|
|
73
|
+
? error
|
|
74
|
+
: new types_1.BootstrapError("unavailable");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
accept(snapshot) {
|
|
78
|
+
if (this.context &&
|
|
79
|
+
Object.keys(this.context).some((key) => this.context[key] !==
|
|
80
|
+
snapshot.context[key]))
|
|
81
|
+
throw new types_1.BootstrapError("protocol-error");
|
|
82
|
+
if (this.snapshot && this.snapshot.clientId !== snapshot.clientId)
|
|
83
|
+
throw new types_1.BootstrapError("protocol-error");
|
|
84
|
+
const names = new Set([
|
|
85
|
+
...Object.keys(this.values),
|
|
86
|
+
...Object.keys(snapshot.configuration),
|
|
87
|
+
]);
|
|
88
|
+
const changed = [...names].filter((key) => this.values[key] !== snapshot.configuration[key]);
|
|
89
|
+
this.snapshot = snapshot;
|
|
90
|
+
this.context = Object.freeze({ ...snapshot.context });
|
|
91
|
+
this.values = { ...snapshot.configuration };
|
|
92
|
+
this.received = Date.now();
|
|
93
|
+
this.monotonic = performance.now();
|
|
94
|
+
this.schedule(Math.max(1, Date.parse(snapshot.refreshAfter) - this.now() - Math.random() * 10000));
|
|
95
|
+
this.emit(this.changes, Object.freeze(changed));
|
|
96
|
+
}
|
|
97
|
+
schedule(ms) {
|
|
98
|
+
clearTimeout(this.timer);
|
|
99
|
+
this.timer = setTimeout(() => {
|
|
100
|
+
void this.refresh().catch(() => undefined);
|
|
101
|
+
}, ms);
|
|
102
|
+
this.timer.unref();
|
|
103
|
+
}
|
|
104
|
+
handleFailure(error) {
|
|
105
|
+
if (error instanceof types_1.BootstrapError &&
|
|
106
|
+
["authorization-denied", "protocol-error"].includes(error.code)) {
|
|
107
|
+
this.invalidate(error.code);
|
|
108
|
+
}
|
|
109
|
+
else if (!this.reason && this.snapshot) {
|
|
110
|
+
this.schedule(Math.min(30000, Math.max(1, Date.parse(this.snapshot.expiresAt) - 30000 - this.now())));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
invalidate(reason) {
|
|
114
|
+
if (this.reason === reason || (this.reason && reason !== "closed"))
|
|
115
|
+
return;
|
|
116
|
+
this.reason = reason;
|
|
117
|
+
this.values = Object.create(null);
|
|
118
|
+
this.snapshot = undefined;
|
|
119
|
+
clearTimeout(this.timer);
|
|
120
|
+
this.controller.abort();
|
|
121
|
+
this.emit(this.invalidations, reason);
|
|
122
|
+
}
|
|
123
|
+
emit(listeners, value) {
|
|
124
|
+
for (const listener of [...listeners]) {
|
|
125
|
+
try {
|
|
126
|
+
listener(value);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
/* Never expose listener errors or secret values. */
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
subscribe(listeners, handler) {
|
|
134
|
+
this.assertValid();
|
|
135
|
+
listeners.add(handler);
|
|
136
|
+
return () => {
|
|
137
|
+
listeners.delete(handler);
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
config(url) {
|
|
141
|
+
this.assertValid();
|
|
142
|
+
if (!this.snapshot)
|
|
143
|
+
throw new types_1.BootstrapError("unavailable");
|
|
144
|
+
return {
|
|
145
|
+
clientId: this.snapshot.clientId,
|
|
146
|
+
controllerUrl: url,
|
|
147
|
+
onClientTokenRefresh: async () => ({
|
|
148
|
+
token: (await this.token()),
|
|
149
|
+
expiresIn: Math.max(1, Math.floor((Date.parse(this.snapshot.clientTokenExpiresAt) -
|
|
150
|
+
30000 -
|
|
151
|
+
this.now()) /
|
|
152
|
+
1000)),
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
get(name) {
|
|
157
|
+
this.assertValid();
|
|
158
|
+
return Object.prototype.hasOwnProperty.call(this.values, name)
|
|
159
|
+
? this.values[name]
|
|
160
|
+
: undefined;
|
|
161
|
+
}
|
|
162
|
+
runtime(client) {
|
|
163
|
+
const runtime = {
|
|
164
|
+
client,
|
|
165
|
+
context: this.context,
|
|
166
|
+
secrets: Object.freeze({
|
|
167
|
+
get: (name) => this.get(name),
|
|
168
|
+
require: (name) => {
|
|
169
|
+
const value = this.get(name);
|
|
170
|
+
if (!value)
|
|
171
|
+
throw new types_1.BootstrapError("missing-secret");
|
|
172
|
+
return value;
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
onSecretsChanged: (handler) => this.subscribe(this.changes, handler),
|
|
176
|
+
onInvalidated: (handler) => this.subscribe(this.invalidations, handler),
|
|
177
|
+
close: () => this.close(client),
|
|
178
|
+
};
|
|
179
|
+
Object.defineProperty(runtime, "client", { enumerable: false });
|
|
180
|
+
return Object.freeze(runtime);
|
|
181
|
+
}
|
|
182
|
+
close(client) {
|
|
183
|
+
if (this.closing)
|
|
184
|
+
return this.closing;
|
|
185
|
+
this.closing = Promise.resolve()
|
|
186
|
+
.then(() => (0, transport_1.abortable)(client?.disconnect() ?? Promise.resolve(), AbortSignal.timeout(5000)))
|
|
187
|
+
.catch(() => {
|
|
188
|
+
throw new types_1.BootstrapError("cleanup-failed");
|
|
189
|
+
});
|
|
190
|
+
this.invalidate("closed");
|
|
191
|
+
this.changes.clear();
|
|
192
|
+
this.invalidations.clear();
|
|
193
|
+
return this.closing;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.RuntimeState = RuntimeState;
|
|
197
|
+
/** Construct SDK connections only after provider initialization succeeds. */
|
|
198
|
+
async function createRuntime(state, config) {
|
|
199
|
+
(0, runtime_guard_1.registerRuntimeGuard)(config, { token: () => state.token() });
|
|
200
|
+
const client = new miso_client_1.MisoClient(config);
|
|
201
|
+
try {
|
|
202
|
+
await client.initialize();
|
|
203
|
+
return state.runtime(client);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
await state.close(client);
|
|
207
|
+
throw new types_1.BootstrapError("initialization-failed");
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1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AC;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAzPD,oCAyPC;AAED,6EAA6E;AACtE,KAAK,UAAU,aAAa,CACjC,KAAmB,EACnB,MAAwB;IAExB,IAAA,oCAAoB,EAAC,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,wBAAU,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,sBAAc,CAAC,uBAAuB,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BootstrapSnapshot, BootstrapTokenProvider } from "./types";
|
|
2
|
+
/** Deployment settings are required only for explicitly enabled Azure mode. */
|
|
3
|
+
export declare function azureSettings(): {
|
|
4
|
+
controllerUrl: string;
|
|
5
|
+
url: string;
|
|
6
|
+
scope: string;
|
|
7
|
+
};
|
|
8
|
+
/** Bound even providers that fail to honor cancellation. */
|
|
9
|
+
export declare function abortable<T>(work: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
10
|
+
/** One bounded identity+HTTP operation; never retains raw errors. */
|
|
11
|
+
export declare function fetchSnapshot(provider: BootstrapTokenProvider, settings: {
|
|
12
|
+
url: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
}, signal: AbortSignal): Promise<BootstrapSnapshot>;
|
|
15
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/bootstrap/transport.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAIjB,+EAA+E;AAC/E,wBAAgB,aAAa,IAAI;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAqBA;AAED,4DAA4D;AAC5D,wBAAsB,SAAS,CAAC,CAAC,EAC/B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,CAAC,CAAC,CAeZ;AAiID,qEAAqE;AACrE,wBAAsB,aAAa,CACjC,QAAQ,EAAE,sBAAsB,EAChC,QAAQ,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EACxC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAoB5B"}
|