@toa.io/extensions.configuration 1.0.0-alpha.31 → 1.0.0-alpha.310
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/components/configuration.values/manifest.toa.yaml +151 -0
- package/components/configuration.values/migrations/0002-indexes.yaml +7 -0
- package/components/configuration.values/operations/create.js +32 -0
- package/components/configuration.values/operations/fetch.js +13 -0
- package/components/configuration.values/operations/get.js +19 -0
- package/components/configuration.values/operations/lib/map.js +22 -0
- package/components/configuration.values/operations/lib/resolve.js +24 -0
- package/components/configuration.values/operations/list.js +11 -0
- package/components/configuration.values/source/create.ts +56 -0
- package/components/configuration.values/source/fetch.ts +26 -0
- package/components/configuration.values/source/get.ts +32 -0
- package/components/configuration.values/source/lib/map.ts +36 -0
- package/components/configuration.values/source/lib/resolve.ts +57 -0
- package/components/configuration.values/source/list.ts +21 -0
- package/components/configuration.values/tsconfig.json +10 -0
- package/components/configuration.values/types/index.d.ts +3 -0
- package/components/configuration.values/types/toa.d.ts +69 -0
- package/package.json +21 -10
- package/readme.md +178 -50
- package/transpiled/Aspect.d.ts +19 -4
- package/transpiled/Aspect.js +62 -9
- package/transpiled/Aspect.js.map +1 -1
- package/transpiled/Client.d.ts +59 -0
- package/transpiled/Client.js +171 -0
- package/transpiled/Client.js.map +1 -0
- package/transpiled/Composition.d.ts +14 -0
- package/transpiled/Composition.js +38 -0
- package/transpiled/Composition.js.map +1 -0
- package/transpiled/Factory.d.ts +9 -2
- package/transpiled/Factory.js +21 -9
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Secret.d.ts +15 -0
- package/transpiled/Secret.js +26 -0
- package/transpiled/Secret.js.map +1 -0
- package/transpiled/UI.d.ts +25 -0
- package/transpiled/UI.js +173 -0
- package/transpiled/UI.js.map +1 -0
- package/transpiled/configuration.d.ts +7 -2
- package/transpiled/configuration.js +33 -43
- package/transpiled/configuration.js.map +1 -1
- package/transpiled/index.d.ts +3 -3
- package/transpiled/index.js +4 -9
- package/transpiled/index.js.map +1 -1
- package/ui/dist/_app/env.js +1 -0
- package/ui/dist/_app/immutable/assets/0.BGFdDICE.css +2 -0
- package/ui/dist/_app/immutable/assets/ui.BghF56l_.css +1 -0
- package/ui/dist/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/ui/dist/_app/immutable/chunks/BkLAzDsj.js +1 -0
- package/ui/dist/_app/immutable/chunks/C_aaOW6e.js +1 -0
- package/ui/dist/_app/immutable/chunks/CcD_ISxM.js +3 -0
- package/ui/dist/_app/immutable/chunks/Ccdp29n0.js +6 -0
- package/ui/dist/_app/immutable/chunks/Dw75U_Lh.js +50 -0
- package/ui/dist/_app/immutable/chunks/sXOccAdQ.js +8 -0
- package/ui/dist/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/ui/dist/_app/immutable/entry/app.DgOXi1S4.js +2 -0
- package/ui/dist/_app/immutable/entry/start.C5YMpV87.js +1 -0
- package/ui/dist/_app/immutable/nodes/0.BGAo0V8q.js +1 -0
- package/ui/dist/_app/immutable/nodes/1.DYGSbNvw.js +1 -0
- package/ui/dist/_app/immutable/nodes/2.nR_WPY04.js +1 -0
- package/ui/dist/_app/immutable/nodes/3.p9Hd9gcE.js +1 -0
- package/ui/dist/_app/immutable/nodes/4.Chf5nqMR.js +1 -0
- package/ui/dist/_app/version.json +1 -0
- package/ui/dist/apple-touch-icon.png +0 -0
- package/ui/dist/favicon-96x96.png +0 -0
- package/ui/dist/favicon.ico +0 -0
- package/ui/dist/index.html +57 -0
- package/ui/dist/robots.txt +3 -0
- package/notes/consistency.md +0 -69
- package/schemas/annotation.cos.yaml +0 -1
- package/schemas/manifest.cos.yaml +0 -2
- package/source/Aspect.test.ts +0 -15
- package/source/Aspect.ts +0 -23
- package/source/Factory.ts +0 -12
- package/source/configuration.test.ts +0 -90
- package/source/configuration.ts +0 -59
- package/source/deployment.test.ts +0 -21
- package/source/deployment.ts +0 -86
- package/source/index.ts +0 -3
- package/source/manifest.test.ts +0 -15
- package/source/manifest.ts +0 -15
- package/source/schemas.ts +0 -9
- package/transpiled/Aspect.test.d.ts +0 -1
- package/transpiled/Aspect.test.js +0 -15
- package/transpiled/Aspect.test.js.map +0 -1
- package/transpiled/configuration.test.d.ts +0 -1
- package/transpiled/configuration.test.js +0 -64
- package/transpiled/configuration.test.js.map +0 -1
- package/transpiled/deployment.d.ts +0 -8
- package/transpiled/deployment.js +0 -88
- package/transpiled/deployment.js.map +0 -1
- package/transpiled/deployment.test.d.ts +0 -1
- package/transpiled/deployment.test.js +0 -18
- package/transpiled/deployment.test.js.map +0 -1
- package/transpiled/manifest.d.ts +0 -6
- package/transpiled/manifest.js +0 -35
- package/transpiled/manifest.js.map +0 -1
- package/transpiled/manifest.test.d.ts +0 -1
- package/transpiled/manifest.test.js +0 -14
- package/transpiled/manifest.test.js.map +0 -1
- package/transpiled/schemas.d.ts +0 -3
- package/transpiled/schemas.js +0 -33
- package/transpiled/schemas.js.map +0 -1
- package/transpiled/tsconfig.tsbuildinfo +0 -1
- package/tsconfig.json +0 -9
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { Connector } from '@toa.io/core';
|
|
4
|
+
import { uiPort } from '@toa.io/definitions/extensions.configuration';
|
|
5
|
+
import { UI } from './UI.js';
|
|
6
|
+
/** Hosts the values component in the service process. */
|
|
7
|
+
export class Composition extends Connector {
|
|
8
|
+
host;
|
|
9
|
+
constructor(host) {
|
|
10
|
+
super();
|
|
11
|
+
this.host = host;
|
|
12
|
+
}
|
|
13
|
+
async open() {
|
|
14
|
+
const composition = await this.host.composition(components().paths);
|
|
15
|
+
await composition.connect();
|
|
16
|
+
this.depends(composition);
|
|
17
|
+
// connected here rather than declared as a dependency: dependencies are connected
|
|
18
|
+
// before `open` runs, so one added from inside it would never be
|
|
19
|
+
const ui = new UI(uiPort());
|
|
20
|
+
await ui.connect();
|
|
21
|
+
this.depends(ui);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function components() {
|
|
25
|
+
const labels = [];
|
|
26
|
+
const paths = [];
|
|
27
|
+
for (const entry of entries()) {
|
|
28
|
+
labels.push(entry.name.replace('.', '-'));
|
|
29
|
+
paths.push(resolve(ROOT, entry.name));
|
|
30
|
+
}
|
|
31
|
+
return { labels, paths };
|
|
32
|
+
}
|
|
33
|
+
function entries() {
|
|
34
|
+
const entries = readdirSync(ROOT, { withFileTypes: true });
|
|
35
|
+
return entries.filter((entry) => entry.isDirectory());
|
|
36
|
+
}
|
|
37
|
+
const ROOT = resolve(import.meta.dirname, '../components/');
|
|
38
|
+
//# sourceMappingURL=Composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Composition.js","sourceRoot":"","sources":["../source/Composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAA;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAG5B,yDAAyD;AACzD,MAAM,OAAO,WAAY,SAAQ,SAAS;IACvB,IAAI,CAAM;IAE3B,YAAmB,IAAU;QAC3B,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEkB,KAAK,CAAC,IAAI;QAC3B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAA;QAEnE,MAAM,WAAW,CAAC,OAAO,EAAE,CAAA;QAE3B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAEzB,kFAAkF;QAClF,iEAAiE;QACjE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,CAAA;QAE3B,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;QAElB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAClB,CAAC;CACF;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC;AAED,SAAS,OAAO;IACd,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1D,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;AACvD,CAAC;AAOD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA"}
|
package/transpiled/Factory.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
1
|
+
import { type Connector, type Locator } from '@toa.io/core';
|
|
2
|
+
import type { extensions } from '@toa.io/core/types';
|
|
3
|
+
import type { Manifest } from '@toa.io/definitions/extensions.configuration';
|
|
3
4
|
export declare class Factory implements extensions.Factory {
|
|
5
|
+
private readonly host;
|
|
6
|
+
private client;
|
|
7
|
+
constructor(host: Host);
|
|
4
8
|
aspect(locator: Locator, manifest: Manifest): extensions.Aspect;
|
|
9
|
+
service(): Connector;
|
|
10
|
+
private shared;
|
|
5
11
|
}
|
|
12
|
+
export type Host = extensions.Host;
|
package/transpiled/Factory.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Aspect } from './Aspect.js';
|
|
2
|
+
import { Client } from './Client.js';
|
|
3
|
+
import { Composition } from './Composition.js';
|
|
4
|
+
import { overridden } from './configuration.js';
|
|
5
|
+
export class Factory {
|
|
6
|
+
host;
|
|
7
|
+
client = null;
|
|
8
|
+
constructor(host) {
|
|
9
|
+
this.host = host;
|
|
10
|
+
}
|
|
7
11
|
aspect(locator, manifest) {
|
|
8
|
-
const
|
|
9
|
-
return new
|
|
12
|
+
const client = overridden(locator) ? null : this.shared();
|
|
13
|
+
return new Aspect(locator, manifest, client);
|
|
14
|
+
}
|
|
15
|
+
// nothing connects to this, so a halt takes the whole of it
|
|
16
|
+
service() {
|
|
17
|
+
return this.host.gate(async () => new Composition(this.host));
|
|
18
|
+
}
|
|
19
|
+
shared() {
|
|
20
|
+
if (this.client === null || this.client.disposed)
|
|
21
|
+
this.client = new Client(this.host);
|
|
22
|
+
return this.client;
|
|
10
23
|
}
|
|
11
24
|
}
|
|
12
|
-
exports.Factory = Factory;
|
|
13
25
|
//# sourceMappingURL=Factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,MAAM,OAAO,OAAO;IACD,IAAI,CAAM;IACnB,MAAM,GAAkB,IAAI,CAAA;IAEpC,YAAmB,IAAU;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,MAAM,CAAC,OAAgB,EAAE,QAAkB;QAChD,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAA;QAEzD,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;IAC9C,CAAC;IAED,4DAA4D;IACrD,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/D,CAAC;IAEO,MAAM;QACZ,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAErF,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
/**
|
|
3
|
+
* A configuration value that must not leak: a string only to whoever asks for it.
|
|
4
|
+
*
|
|
5
|
+
* This is what a value declared `format: secret` is on a component's context.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Secret {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(value: string);
|
|
10
|
+
unwrap(): string;
|
|
11
|
+
toString(): string;
|
|
12
|
+
toJSON(): string;
|
|
13
|
+
[inspect.custom](): string;
|
|
14
|
+
}
|
|
15
|
+
export declare const REDACTED = "<REDACTED>";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
/**
|
|
3
|
+
* A configuration value that must not leak: a string only to whoever asks for it.
|
|
4
|
+
*
|
|
5
|
+
* This is what a value declared `format: secret` is on a component's context.
|
|
6
|
+
*/
|
|
7
|
+
export class Secret {
|
|
8
|
+
#value;
|
|
9
|
+
constructor(value) {
|
|
10
|
+
this.#value = value;
|
|
11
|
+
}
|
|
12
|
+
unwrap() {
|
|
13
|
+
return this.#value;
|
|
14
|
+
}
|
|
15
|
+
toString() {
|
|
16
|
+
return REDACTED;
|
|
17
|
+
}
|
|
18
|
+
toJSON() {
|
|
19
|
+
return REDACTED;
|
|
20
|
+
}
|
|
21
|
+
[inspect.custom]() {
|
|
22
|
+
return REDACTED;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export const REDACTED = '<REDACTED>';
|
|
26
|
+
//# sourceMappingURL=Secret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Secret.js","sourceRoot":"","sources":["../source/Secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;;;GAIG;AACH,MAAM,OAAO,MAAM;IACR,MAAM,CAAQ;IAEvB,YAAmB,KAAa;QAC9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAEM,QAAQ;QACb,OAAO,QAAQ,CAAA;IACjB,CAAC;IAEM,MAAM;QACX,OAAO,QAAQ,CAAA;IACjB,CAAC;IAEM,CAAC,OAAO,CAAC,MAAM,CAAC;QACrB,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Connector } from '@toa.io/core';
|
|
2
|
+
/**
|
|
3
|
+
* Serves the configuration UI: the directory `ui` builds, and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* The page is a single-page application whose mount path is baked into the bundle,
|
|
6
|
+
* so this server routes relative to `UI_PATH` — which is also what the ingress
|
|
7
|
+
* forwards. `/configuration/*` is left alone: that is the component's own API.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UI extends Connector {
|
|
10
|
+
private readonly server;
|
|
11
|
+
private readonly port;
|
|
12
|
+
private readonly root;
|
|
13
|
+
constructor(port: number, root?: string);
|
|
14
|
+
protected open(): Promise<void>;
|
|
15
|
+
protected close(): Promise<void>;
|
|
16
|
+
private listen;
|
|
17
|
+
private respond;
|
|
18
|
+
/**
|
|
19
|
+
* The file a request lands on, or `null` when nothing does. A path that exists is
|
|
20
|
+
* served as it is; anything else that could be a route falls back to the page,
|
|
21
|
+
* because the client router — not this server — knows what routes there are.
|
|
22
|
+
*/
|
|
23
|
+
private resolve;
|
|
24
|
+
private send;
|
|
25
|
+
}
|
package/transpiled/UI.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as http from 'node:http';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { Connector } from '@toa.io/core';
|
|
5
|
+
import { console } from 'openspan';
|
|
6
|
+
import { UI_PATH } from '@toa.io/definitions/extensions.configuration';
|
|
7
|
+
/**
|
|
8
|
+
* Serves the configuration UI: the directory `ui` builds, and nothing else.
|
|
9
|
+
*
|
|
10
|
+
* The page is a single-page application whose mount path is baked into the bundle,
|
|
11
|
+
* so this server routes relative to `UI_PATH` — which is also what the ingress
|
|
12
|
+
* forwards. `/configuration/*` is left alone: that is the component's own API.
|
|
13
|
+
*/
|
|
14
|
+
export class UI extends Connector {
|
|
15
|
+
server = http.createServer();
|
|
16
|
+
port;
|
|
17
|
+
root;
|
|
18
|
+
constructor(port, root = SITE) {
|
|
19
|
+
super();
|
|
20
|
+
this.port = port;
|
|
21
|
+
this.root = root;
|
|
22
|
+
this.server.on('request', (request, response) => {
|
|
23
|
+
this.listen(request, response);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async open() {
|
|
27
|
+
/*
|
|
28
|
+
* A taken port is a real error: uniqueness across services is settled at export
|
|
29
|
+
* time, so nothing here has to negotiate for one.
|
|
30
|
+
*/
|
|
31
|
+
await new Promise((resolve, reject) => {
|
|
32
|
+
const failed = (error) => {
|
|
33
|
+
this.server.off('listening', listening);
|
|
34
|
+
reject(error);
|
|
35
|
+
};
|
|
36
|
+
const listening = () => {
|
|
37
|
+
this.server.off('error', failed);
|
|
38
|
+
resolve();
|
|
39
|
+
};
|
|
40
|
+
this.server.once('error', failed);
|
|
41
|
+
this.server.once('listening', listening);
|
|
42
|
+
this.server.listen(this.port);
|
|
43
|
+
});
|
|
44
|
+
if (!isFile(path.join(this.root, 'index.html')))
|
|
45
|
+
console.warn('Configuration UI is not built', { root: this.root });
|
|
46
|
+
console.info('Configuration UI started', { port: this.port, path: UI_PATH + '/' });
|
|
47
|
+
}
|
|
48
|
+
async close() {
|
|
49
|
+
const closed = new Promise((resolve) => this.server.once('close', () => {
|
|
50
|
+
resolve();
|
|
51
|
+
}));
|
|
52
|
+
this.server.close();
|
|
53
|
+
this.server.closeAllConnections();
|
|
54
|
+
await closed;
|
|
55
|
+
}
|
|
56
|
+
listen(request, response) {
|
|
57
|
+
void this.respond(request, response).catch((error) => {
|
|
58
|
+
console.error('Configuration UI failure', { message: error.message });
|
|
59
|
+
if (!response.writableEnded)
|
|
60
|
+
response.writeHead(500).end();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async respond(request, response) {
|
|
64
|
+
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
65
|
+
response.writeHead(405, { allow: 'GET, HEAD' }).end();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const pathname = decode(request.url ?? '/');
|
|
69
|
+
if (pathname === null) {
|
|
70
|
+
response.writeHead(400).end();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// the port is the explorer's alone, so the root is the way in
|
|
74
|
+
if (pathname === '/') {
|
|
75
|
+
response.writeHead(302, { location: UI_PATH + '/' }).end();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const file = this.resolve(pathname);
|
|
79
|
+
if (file === null)
|
|
80
|
+
response.writeHead(404).end();
|
|
81
|
+
else
|
|
82
|
+
await this.send(file, request, response);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The file a request lands on, or `null` when nothing does. A path that exists is
|
|
86
|
+
* served as it is; anything else that could be a route falls back to the page,
|
|
87
|
+
* because the client router — not this server — knows what routes there are.
|
|
88
|
+
*/
|
|
89
|
+
resolve(pathname) {
|
|
90
|
+
if (!pathname.startsWith(UI_PATH))
|
|
91
|
+
return null;
|
|
92
|
+
const relative = pathname.slice(UI_PATH.length);
|
|
93
|
+
if (relative !== '' && !relative.startsWith('/'))
|
|
94
|
+
return null;
|
|
95
|
+
const file = path.join(this.root, relative);
|
|
96
|
+
if (file !== this.root && !file.startsWith(this.root + path.sep))
|
|
97
|
+
return null;
|
|
98
|
+
if (isFile(file))
|
|
99
|
+
return file;
|
|
100
|
+
/*
|
|
101
|
+
* A missing asset is missing, but a route can look like one: `identity.passkeys` is a
|
|
102
|
+
* component, not a file with an extension. What this server would have served is what
|
|
103
|
+
* it knows how to serve, so anything else is a route and falls back to the page — as
|
|
104
|
+
* does anything ending in a slash, which is no name for a file at all.
|
|
105
|
+
*/
|
|
106
|
+
const asset = !relative.endsWith('/') && path.extname(relative) in TYPES;
|
|
107
|
+
return asset ? null : path.join(this.root, 'index.html');
|
|
108
|
+
}
|
|
109
|
+
async send(file, request, response) {
|
|
110
|
+
const stats = await fs.promises.stat(file).catch(() => null);
|
|
111
|
+
if (stats === null) {
|
|
112
|
+
response
|
|
113
|
+
.writeHead(503, { 'content-type': 'text/plain' })
|
|
114
|
+
.end('The configuration UI is not built. Run `npm run build:ui`.\n');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
response.writeHead(200, {
|
|
118
|
+
'content-type': TYPES[path.extname(file)] ?? 'application/octet-stream',
|
|
119
|
+
'content-length': stats.size,
|
|
120
|
+
'cache-control': caching(path.relative(this.root, file))
|
|
121
|
+
});
|
|
122
|
+
if (request.method === 'HEAD')
|
|
123
|
+
response.end();
|
|
124
|
+
else
|
|
125
|
+
fs.createReadStream(file).pipe(response);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function decode(url) {
|
|
129
|
+
try {
|
|
130
|
+
return decodeURIComponent(url.split('?')[0]);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function isFile(file) {
|
|
137
|
+
return fs.existsSync(file) && fs.statSync(file).isFile();
|
|
138
|
+
}
|
|
139
|
+
/** Where `npm run build:ui` puts the page, from both `source` and `transpiled`. */
|
|
140
|
+
const SITE = path.resolve(import.meta.dirname, '..', 'ui', 'dist');
|
|
141
|
+
/** Assets under this prefix carry their build hash in the name. */
|
|
142
|
+
const IMMUTABLE = path.join('_app', 'immutable');
|
|
143
|
+
const FOREVER = 'public, max-age=31536000, immutable';
|
|
144
|
+
/** The icons: named without a hash, so they are re-read, but rarely. */
|
|
145
|
+
const ICONS = new Set(['favicon.ico', 'favicon-96x96.png', 'apple-touch-icon.png']);
|
|
146
|
+
const DAY = 'public, max-age=86400';
|
|
147
|
+
/**
|
|
148
|
+
* How long what is served may be held. The page is never cached — it names the assets,
|
|
149
|
+
* and their names carry the build. An icon is named for what it is rather than for its
|
|
150
|
+
* content, so it is asked about again, but not on every page load.
|
|
151
|
+
*/
|
|
152
|
+
function caching(relative) {
|
|
153
|
+
if (relative.startsWith(IMMUTABLE))
|
|
154
|
+
return FOREVER;
|
|
155
|
+
return ICONS.has(relative) ? DAY : 'no-cache';
|
|
156
|
+
}
|
|
157
|
+
const TYPES = {
|
|
158
|
+
'.css': 'text/css; charset=utf-8',
|
|
159
|
+
'.html': 'text/html; charset=utf-8',
|
|
160
|
+
'.ico': 'image/x-icon',
|
|
161
|
+
'.jpg': 'image/jpeg',
|
|
162
|
+
'.js': 'text/javascript; charset=utf-8',
|
|
163
|
+
'.json': 'application/json; charset=utf-8',
|
|
164
|
+
'.map': 'application/json; charset=utf-8',
|
|
165
|
+
'.png': 'image/png',
|
|
166
|
+
'.svg': 'image/svg+xml',
|
|
167
|
+
'.txt': 'text/plain; charset=utf-8',
|
|
168
|
+
'.webmanifest': 'application/manifest+json',
|
|
169
|
+
'.webp': 'image/webp',
|
|
170
|
+
'.woff': 'font/woff',
|
|
171
|
+
'.woff2': 'font/woff2'
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=UI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UI.js","sourceRoot":"","sources":["../source/UI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAA;AAEtE;;;;;;GAMG;AACH,MAAM,OAAO,EAAG,SAAQ,SAAS;IACd,MAAM,GAAgB,IAAI,CAAC,YAAY,EAAE,CAAA;IACzC,IAAI,CAAQ;IACZ,IAAI,CAAQ;IAE7B,YAAmB,IAAY,EAAE,IAAI,GAAW,IAAI;QAClD,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;YAC9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAChC,CAAC,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AE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAElE,mEAAmE;AACnE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAChD,MAAM,OAAO,GAAG,qCAAqC,CAAA;AAErD,wEAAwE;AACxE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,mBAAmB,EAAE,sBAAsB,CAAC,CAAC,CAAA;AACnF,MAAM,GAAG,GAAG,uBAAuB,CAAA;AAEnC;;;;GAIG;AACH,SAAS,OAAO,CAAC,QAAgB;IAC/B,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,OAAO,CAAA;IAElD,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAA;AAC/C,CAAC;AAED,MAAM,KAAK,GAA2B;IACpC,MAAM,EAAE,yBAAyB;IACjC,OAAO,EAAE,0BAA0B;IACnC,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,gCAAgC;IACvC,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,iCAAiC;IACzC,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,2BAA2B;IACnC,cAAc,EAAE,2BAA2B;IAC3C,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;CACvB,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { type Locator } from '@toa.io/core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { Manifest } from '@toa.io/definitions/extensions.configuration';
|
|
3
|
+
/** The variable is set, so the values service is not consulted. */
|
|
4
|
+
export declare function overridden(locator: Locator): boolean;
|
|
5
|
+
/** The variable, the manifest defaults, then the schema. */
|
|
6
|
+
export declare function local(locator: Locator, manifest: Manifest): Node;
|
|
7
|
+
/** A copy of the value with the schema applied and the secrets substituted. */
|
|
8
|
+
export declare function fit(raw: object, manifest: Manifest): Node;
|
|
4
9
|
export type Node = Record<string, unknown>;
|
|
@@ -1,49 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.get = void 0;
|
|
27
|
-
const generic_1 = require("@toa.io/generic");
|
|
28
|
-
const schemas = __importStar(require("@toa.io/schemas"));
|
|
29
|
-
const deployment_1 = require("./deployment");
|
|
30
|
-
function get(locator, manifest) {
|
|
31
|
-
const values = getConfiguration(locator.uppercase);
|
|
32
|
-
substituteSecrets(values);
|
|
1
|
+
import { add, environment } from '@toa.io/generic';
|
|
2
|
+
import * as schemas from '@toa.io/schemas';
|
|
3
|
+
import { PREFIX, SECRET_RX, assertSecrets } from '@toa.io/definitions/extensions.configuration';
|
|
4
|
+
import { Secret } from './Secret.js';
|
|
5
|
+
/** The variable is set, so the values service is not consulted. */
|
|
6
|
+
export function overridden(locator) {
|
|
7
|
+
return environment.get(PREFIX + locator.uppercase) !== undefined;
|
|
8
|
+
}
|
|
9
|
+
/** The variable, the manifest defaults, then the schema. */
|
|
10
|
+
export function local(locator, manifest) {
|
|
11
|
+
const values = read(locator.uppercase);
|
|
33
12
|
if (manifest.defaults !== undefined)
|
|
34
|
-
|
|
13
|
+
add(values, manifest.defaults);
|
|
14
|
+
return fit(values, manifest);
|
|
15
|
+
}
|
|
16
|
+
/** A copy of the value with the schema applied and the secrets substituted. */
|
|
17
|
+
export function fit(raw, manifest) {
|
|
18
|
+
// a copy of the caller's, and one of this realm: what came over the wire is JSON anyway
|
|
19
|
+
const values = JSON.parse(JSON.stringify(raw));
|
|
20
|
+
// the schema sees the references, which are the strings it declares
|
|
21
|
+
validate(values, manifest);
|
|
22
|
+
substituteSecrets(values);
|
|
23
|
+
return values;
|
|
24
|
+
}
|
|
25
|
+
function validate(values, manifest) {
|
|
35
26
|
const schema = schemas.schema(manifest.schema);
|
|
36
27
|
schema.validate(values);
|
|
37
|
-
|
|
28
|
+
assertSecrets(manifest.schema, values);
|
|
38
29
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
const string = process.env[variable];
|
|
30
|
+
function read(suffix) {
|
|
31
|
+
const variable = PREFIX + suffix;
|
|
32
|
+
const string = environment.get(variable);
|
|
43
33
|
if (string === undefined)
|
|
44
34
|
return {};
|
|
45
35
|
else
|
|
46
|
-
return
|
|
36
|
+
return JSON.parse(string);
|
|
47
37
|
}
|
|
48
38
|
function substituteSecrets(configuration) {
|
|
49
39
|
for (const [key, value] of Object.entries(configuration)) {
|
|
@@ -51,16 +41,16 @@ function substituteSecrets(configuration) {
|
|
|
51
41
|
substituteSecrets(value);
|
|
52
42
|
if (typeof value !== 'string')
|
|
53
43
|
continue;
|
|
54
|
-
const match = value.match(
|
|
44
|
+
const match = value.match(SECRET_RX);
|
|
55
45
|
if (match === null)
|
|
56
46
|
continue;
|
|
57
47
|
const name = match.groups?.variable;
|
|
58
|
-
configuration[key] = getSecret(name);
|
|
48
|
+
configuration[key] = new Secret(getSecret(name));
|
|
59
49
|
}
|
|
60
50
|
}
|
|
61
51
|
function getSecret(name) {
|
|
62
|
-
const variable =
|
|
63
|
-
const value =
|
|
52
|
+
const variable = PREFIX + '_' + name;
|
|
53
|
+
const value = environment.get(variable);
|
|
64
54
|
if (value === undefined)
|
|
65
55
|
throw new Error(`${variable} is not set.`);
|
|
66
56
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../source/configuration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../source/configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,MAAM,EACN,SAAS,EACT,aAAa,EACd,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIpC,mEAAmE;AACnE,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,CAAA;AAClE,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,KAAK,CAAC,OAAgB,EAAE,QAAkB;IACxD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAEtC,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAEnE,OAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC9B,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,QAAkB;IACjD,wFAAwF;IACxF,MAAM,MAAM,GAAG,IAAI,CAAC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CAAC,SAAS,CAAC,IAAK,CAAC,CAAC,CAAA;IACnD,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,QAAQ,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,CAAA;IACpC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAEvC,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,cAAc,CAAC,CAAA;IAEnE,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/transpiled/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { components } from './Composition.ts';
|
|
2
|
+
export { Factory } from './Factory.ts';
|
|
3
|
+
export { Secret } from './Secret.ts';
|
package/transpiled/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "manifest", { enumerable: true, get: function () { return manifest_1.manifest; } });
|
|
6
|
-
var deployment_1 = require("./deployment");
|
|
7
|
-
Object.defineProperty(exports, "deployment", { enumerable: true, get: function () { return deployment_1.deployment; } });
|
|
8
|
-
var Factory_1 = require("./Factory");
|
|
9
|
-
Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return Factory_1.Factory; } });
|
|
1
|
+
export { components } from './Composition.js';
|
|
2
|
+
export { Factory } from './Factory.js';
|
|
3
|
+
// what a value declared `format: secret` is on a component's context
|
|
4
|
+
export { Secret } from './Secret.js';
|
|
10
5
|
//# sourceMappingURL=index.js.map
|
package/transpiled/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,qEAAqE;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const env={}
|