@selvajs/platform 0.17.0-beta.3 → 0.17.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/README.md +25 -28
- package/dist/access/rules.d.ts +20 -26
- package/dist/access/rules.d.ts.map +1 -1
- package/dist/access/rules.js +16 -16
- package/dist/access/rules.js.map +1 -1
- package/dist/auth/interface.d.ts +99 -116
- package/dist/auth/interface.d.ts.map +1 -1
- package/dist/auth/types.d.ts +1 -4
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/bindings/interface.d.ts +19 -32
- package/dist/bindings/interface.d.ts.map +1 -1
- package/dist/bindings/interface.js +6 -12
- package/dist/bindings/interface.js.map +1 -1
- package/dist/computeServer/interface.d.ts +34 -41
- package/dist/computeServer/interface.d.ts.map +1 -1
- package/dist/computeServer/secrets.d.ts +16 -20
- package/dist/computeServer/secrets.d.ts.map +1 -1
- package/dist/computeServer/secrets.js +11 -12
- package/dist/computeServer/secrets.js.map +1 -1
- package/dist/computeServer/types.d.ts +15 -17
- package/dist/computeServer/types.d.ts.map +1 -1
- package/dist/computeServer/types.js.map +1 -1
- package/dist/computeServer/utils.d.ts +8 -14
- package/dist/computeServer/utils.d.ts.map +1 -1
- package/dist/computeServer/utils.js +8 -16
- package/dist/computeServer/utils.js.map +1 -1
- package/dist/config.d.ts +16 -39
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -2
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +12 -19
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +6 -10
- package/dist/context.js.map +1 -1
- package/dist/data/interface.d.ts +32 -47
- package/dist/data/interface.d.ts.map +1 -1
- package/dist/data/interface.js +7 -10
- package/dist/data/interface.js.map +1 -1
- package/dist/definitions/interface.d.ts +24 -31
- package/dist/definitions/interface.d.ts.map +1 -1
- package/dist/definitions/schemas.d.ts.map +1 -1
- package/dist/definitions/schemas.js +6 -9
- package/dist/definitions/schemas.js.map +1 -1
- package/dist/definitions/types.d.ts +26 -42
- package/dist/definitions/types.d.ts.map +1 -1
- package/dist/definitions/types.js +0 -1
- package/dist/definitions/types.js.map +1 -1
- package/dist/errors/interface.d.ts +4 -8
- package/dist/errors/interface.d.ts.map +1 -1
- package/dist/errors/interface.js.map +1 -1
- package/dist/errors.d.ts +2 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -5
- package/dist/errors.js.map +1 -1
- package/dist/events/audit.d.ts +13 -26
- package/dist/events/audit.d.ts.map +1 -1
- package/dist/events/interface.d.ts +17 -33
- package/dist/events/interface.d.ts.map +1 -1
- package/dist/events/interface.js +7 -22
- package/dist/events/interface.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/invites/interface.d.ts +3 -9
- package/dist/invites/interface.d.ts.map +1 -1
- package/dist/invites/types.d.ts +4 -11
- package/dist/invites/types.d.ts.map +1 -1
- package/dist/logging/interface.d.ts +19 -33
- package/dist/logging/interface.d.ts.map +1 -1
- package/dist/logging/interface.js +9 -17
- package/dist/logging/interface.js.map +1 -1
- package/dist/metrics/interface.d.ts +16 -31
- package/dist/metrics/interface.d.ts.map +1 -1
- package/dist/metrics/interface.js +1 -5
- package/dist/metrics/interface.js.map +1 -1
- package/dist/organizations/interface.d.ts +14 -23
- package/dist/organizations/interface.d.ts.map +1 -1
- package/dist/organizations/paths.d.ts +9 -12
- package/dist/organizations/paths.d.ts.map +1 -1
- package/dist/organizations/paths.js +12 -16
- package/dist/organizations/paths.js.map +1 -1
- package/dist/organizations/schemas.d.ts +10 -19
- package/dist/organizations/schemas.d.ts.map +1 -1
- package/dist/organizations/schemas.js +10 -19
- package/dist/organizations/schemas.js.map +1 -1
- package/dist/organizations/types.d.ts +3 -4
- package/dist/organizations/types.d.ts.map +1 -1
- package/dist/pagination.d.ts +13 -21
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/permissions/interface.d.ts +12 -21
- package/dist/permissions/interface.d.ts.map +1 -1
- package/dist/permissions/types.d.ts +5 -5
- package/dist/permissions/types.js +5 -5
- package/dist/platformProjects/interface.d.ts +7 -14
- package/dist/platformProjects/interface.d.ts.map +1 -1
- package/dist/platformProjects/types.d.ts +1 -4
- package/dist/platformProjects/types.d.ts.map +1 -1
- package/dist/projects/interface.d.ts +12 -17
- package/dist/projects/interface.d.ts.map +1 -1
- package/dist/shareLinks/interface.d.ts +5 -8
- package/dist/shareLinks/interface.d.ts.map +1 -1
- package/dist/shareLinks/schemas.d.ts.map +1 -1
- package/dist/shareLinks/schemas.js +1 -5
- package/dist/shareLinks/schemas.js.map +1 -1
- package/dist/shareLinks/types.d.ts +5 -6
- package/dist/shareLinks/types.d.ts.map +1 -1
- package/dist/shareLinks/types.js.map +1 -1
- package/dist/solveCache/interface.d.ts +32 -46
- package/dist/solveCache/interface.d.ts.map +1 -1
- package/dist/solveCache/interface.js.map +1 -1
- package/dist/storage/assetClasses.d.ts +16 -24
- package/dist/storage/assetClasses.d.ts.map +1 -1
- package/dist/storage/assetClasses.js +21 -28
- package/dist/storage/assetClasses.js.map +1 -1
- package/dist/storage/cacheBust.d.ts +12 -14
- package/dist/storage/cacheBust.d.ts.map +1 -1
- package/dist/storage/cacheBust.js +12 -14
- package/dist/storage/cacheBust.js.map +1 -1
- package/dist/storage/image.d.ts +9 -13
- package/dist/storage/image.d.ts.map +1 -1
- package/dist/storage/image.js +9 -13
- package/dist/storage/image.js.map +1 -1
- package/dist/userProfile/interface.d.ts +1 -1
- package/dist/userProfile/types.d.ts +1 -5
- package/dist/userProfile/types.d.ts.map +1 -1
- package/dist/userProfile/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,8 +2,6 @@ import type { RequestContext } from '../context.js';
|
|
|
2
2
|
import type { ComputeConfig, ComputeServerConfig } from './types.js';
|
|
3
3
|
import type { SecretVerificationReport } from './secrets.js';
|
|
4
4
|
/**
|
|
5
|
-
* Compute-server configuration. Architecture spec §4.8.
|
|
6
|
-
*
|
|
7
5
|
* One config doc holds *all* servers (platform + org-private) plus the
|
|
8
6
|
* global `defaultServerId` and per-org `orgDefaults` map. Authorization is
|
|
9
7
|
* the route layer's job — `manage_compute` for platform-server mutations,
|
|
@@ -12,75 +10,70 @@ import type { SecretVerificationReport } from './secrets.js';
|
|
|
12
10
|
*/
|
|
13
11
|
export interface GetConfigOptions {
|
|
14
12
|
/**
|
|
15
|
-
* Include each server's decrypted `apiKey`. Defaults to `false
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
13
|
+
* Include each server's decrypted `apiKey`. Defaults to `false` — most
|
|
14
|
+
* callers (pickers, page loaders, the resolver) only need connection
|
|
15
|
+
* metadata, and decrypting every stored key costs one decrypt per server
|
|
16
|
+
* per call on the solve path.
|
|
19
17
|
*
|
|
20
|
-
* Set this only when you
|
|
21
|
-
* admin/org save handlers, which diff and preserve keys across a write.
|
|
22
|
-
* a single server's key
|
|
23
|
-
*
|
|
18
|
+
* Set this only when you need every server's key at once — the
|
|
19
|
+
* admin/org save handlers, which diff and preserve keys across a write.
|
|
20
|
+
* For a single server's key, resolve the server first and call
|
|
21
|
+
* `getServerApiKey` for just that one.
|
|
24
22
|
*/
|
|
25
23
|
includeApiKeys?: boolean;
|
|
26
24
|
}
|
|
27
25
|
export interface IComputeServerStore {
|
|
28
26
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* Reads the full config. Callers apply the visibility predicate from
|
|
28
|
+
* `serversVisibleTo` themselves — the store does not pre-filter, since the
|
|
29
|
+
* same row set is needed at different scopes (admin manage vs. org manage
|
|
30
|
+
* vs. solve).
|
|
33
31
|
*
|
|
34
|
-
* Servers come back with `apiKey: undefined` unless `includeApiKeys` is
|
|
35
|
-
*
|
|
36
|
-
* use `hasApiKey` for that.
|
|
32
|
+
* Servers come back with `apiKey: undefined` unless `includeApiKeys` is
|
|
33
|
+
* set, so a returned server says nothing about whether a key is *stored*
|
|
34
|
+
* — use `hasApiKey` for that.
|
|
37
35
|
*/
|
|
38
36
|
getConfig(ctx: RequestContext, opts?: GetConfigOptions): Promise<ComputeConfig>;
|
|
39
37
|
/**
|
|
40
|
-
* Decrypted `apiKey` for a single server, or `undefined` when the server
|
|
41
|
-
* no key stored, does not exist, or its ciphertext cannot be
|
|
42
|
-
* under the current `SELVA_AT_REST_KEY` (
|
|
43
|
-
*
|
|
38
|
+
* Decrypted `apiKey` for a single server, or `undefined` when the server
|
|
39
|
+
* has no key stored, does not exist, or its ciphertext cannot be
|
|
40
|
+
* authenticated under the current `SELVA_AT_REST_KEY` (the solve fails
|
|
41
|
+
* later at Rhino.Compute rather than here).
|
|
44
42
|
*
|
|
45
|
-
*
|
|
43
|
+
* The narrow path onto the solve hot path: resolve a server from the
|
|
46
44
|
* key-free config, then fetch that one key.
|
|
47
45
|
*/
|
|
48
46
|
getServerApiKey(ctx: RequestContext, serverId: string): Promise<string | undefined>;
|
|
49
|
-
/**
|
|
50
|
-
* Replace the entire platform-server set + global `defaultServerId`.
|
|
51
|
-
* Org-private rows and `orgDefaults` are left untouched.
|
|
52
|
-
*/
|
|
47
|
+
/** Replaces the entire platform-server set + global `defaultServerId`. Org-private rows and `orgDefaults` are left untouched. */
|
|
53
48
|
savePlatformServers(ctx: RequestContext, servers: ComputeServerConfig[], defaultServerId: string | undefined): Promise<void>;
|
|
54
49
|
/**
|
|
55
|
-
*
|
|
50
|
+
* Replaces the org-private server set for `orgId` and (optionally) updates
|
|
56
51
|
* `orgDefaults[orgId]`. Platform rows are left untouched.
|
|
57
52
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
53
|
+
* `defaultServerId: null` clears the org's override; `undefined` leaves
|
|
54
|
+
* the existing value alone.
|
|
60
55
|
*/
|
|
61
56
|
saveOrgServers(ctx: RequestContext, orgId: string, servers: ComputeServerConfig[], defaultServerId?: string | null): Promise<void>;
|
|
62
57
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* `serverId === null` clears the override.
|
|
58
|
+
* Sets or clears `orgDefaults[orgId]`. The route layer must verify the
|
|
59
|
+
* chosen server is visible to the org before calling this. `serverId ===
|
|
60
|
+
* null` clears the override.
|
|
67
61
|
*/
|
|
68
62
|
setOrgDefault(ctx: RequestContext, orgId: string, serverId: string | null): Promise<void>;
|
|
69
63
|
/**
|
|
70
|
-
* Hard-
|
|
64
|
+
* Hard-deletes this org's compute rows: org-private servers, the
|
|
71
65
|
* `orgDefaults[orgId]` entry, and any references to this org inside
|
|
72
66
|
* platform servers' `sharedWith` allowlists. No-op when none exist.
|
|
73
|
-
* Called from `deleteOrg` so soft-deleting an org
|
|
67
|
+
* Called from `deleteOrg` so soft-deleting an org doesn't leave its
|
|
74
68
|
* compute config behind.
|
|
75
69
|
*/
|
|
76
70
|
deleteByOrg(ctx: RequestContext, orgId: string): Promise<void>;
|
|
77
71
|
/**
|
|
78
|
-
* Boot-time integrity check:
|
|
79
|
-
*
|
|
80
|
-
* `SELVA_AT_REST_KEY`. Does
|
|
81
|
-
* caller (boot health) decides whether to refuse boot / drive
|
|
82
|
-
* to 503.
|
|
83
|
-
* optional so a hypothetical non-encrypting store can omit it.
|
|
72
|
+
* Boot-time integrity check: decrypts every stored `apiKey` and reports
|
|
73
|
+
* any that are plaintext-at-rest or fail to decrypt under the current
|
|
74
|
+
* `SELVA_AT_REST_KEY`. Does not throw — returns a structured report so
|
|
75
|
+
* the caller (boot health) decides whether to refuse boot / drive
|
|
76
|
+
* `/api/health` to 503. Optional so a non-encrypting store can omit it.
|
|
84
77
|
*/
|
|
85
78
|
verifySecrets?(): Promise<SecretVerificationReport>;
|
|
86
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/computeServer/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE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CAAC,IAAI,CAAC,CAAC;IAE1F;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACpD"}
|
|
@@ -2,39 +2,35 @@
|
|
|
2
2
|
* AES-256-GCM envelope for at-rest secrets (e.g. compute API keys).
|
|
3
3
|
*
|
|
4
4
|
* Wire format: `enc:v1:<base64(iv|tag|ciphertext)>`. The version prefix lets
|
|
5
|
-
*
|
|
6
|
-
* at rest — on disk (local provider) or in the DB (Supabase provider).
|
|
5
|
+
* a future migration to a new algorithm tell old and new envelopes apart.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Defends against backup leaks, accidental file/DB sharing, and read-only
|
|
8
|
+
* storage access — not against an attacker who also has the master key
|
|
9
|
+
* (`SELVA_AT_REST_KEY` env var, process memory). This is encryption at rest,
|
|
10
|
+
* not a secret manager.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Pure `node:crypto`, no fs or DB coupling, so the local and Supabase
|
|
13
|
+
* compute-server stores share this one implementation.
|
|
15
14
|
*/
|
|
16
15
|
export declare function isEncryptedSecret(value: string): boolean;
|
|
17
16
|
export declare function encryptSecret(plaintext: string, key: Buffer): string;
|
|
18
17
|
export declare function decryptSecret(envelope: string, key: Buffer): string;
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
19
|
+
* Decodes a `SELVA_AT_REST_KEY` env var into a 32-byte buffer (64-char hex or
|
|
20
|
+
* base64, with or without padding). Throws on anything else so a
|
|
21
|
+
* misconfigured key fails loudly at boot instead of silently producing
|
|
22
|
+
* ciphertext nothing can decrypt.
|
|
24
23
|
*/
|
|
25
24
|
export declare function decodeSecretKey(raw: string): Buffer;
|
|
26
25
|
/**
|
|
27
26
|
* Result of a compute-server store's `verifySecrets()`. One `failures` entry
|
|
28
27
|
* per server whose `apiKey` couldn't be loaded:
|
|
29
|
-
* - `plaintext_on_disk` — the field exists but isn't an `enc:v1:` envelope
|
|
30
|
-
*
|
|
28
|
+
* - `plaintext_on_disk` — the field exists but isn't an `enc:v1:` envelope:
|
|
29
|
+
* a hand-edit, a legacy row from before encryption, or a migration
|
|
31
30
|
* regression. Security-relevant.
|
|
32
|
-
* - `key_mismatch`
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* Storage-agnostic (`plaintext_on_disk` reads "plaintext at rest" for both the
|
|
37
|
-
* file- and DB-backed stores) so boot health can treat every provider alike.
|
|
31
|
+
* - `key_mismatch` — envelope is valid but GCM auth-tag verification fails
|
|
32
|
+
* under the current `SELVA_AT_REST_KEY`: the key was rotated, or the data
|
|
33
|
+
* came from another deployment.
|
|
38
34
|
*/
|
|
39
35
|
export type SecretVerificationFailureReason = 'key_mismatch' | 'plaintext_on_disk';
|
|
40
36
|
export interface SecretVerificationFailure {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/computeServer/secrets.ts"],"names":[],"mappings":"AAOA
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/computeServer/secrets.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAYpE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAcnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQnD;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,cAAc,GAAG,mBAAmB,CAAC;AAEnF,MAAM,WAAW,yBAAyB;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,+BAA+B,CAAC;IACxC,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACxC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,oEAAoE;IACpE,cAAc,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -7,16 +7,15 @@ const PREFIX = 'enc:v1:';
|
|
|
7
7
|
* AES-256-GCM envelope for at-rest secrets (e.g. compute API keys).
|
|
8
8
|
*
|
|
9
9
|
* Wire format: `enc:v1:<base64(iv|tag|ciphertext)>`. The version prefix lets
|
|
10
|
-
*
|
|
11
|
-
* at rest — on disk (local provider) or in the DB (Supabase provider).
|
|
10
|
+
* a future migration to a new algorithm tell old and new envelopes apart.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Defends against backup leaks, accidental file/DB sharing, and read-only
|
|
13
|
+
* storage access — not against an attacker who also has the master key
|
|
14
|
+
* (`SELVA_AT_REST_KEY` env var, process memory). This is encryption at rest,
|
|
15
|
+
* not a secret manager.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Pure `node:crypto`, no fs or DB coupling, so the local and Supabase
|
|
18
|
+
* compute-server stores share this one implementation.
|
|
20
19
|
*/
|
|
21
20
|
export function isEncryptedSecret(value) {
|
|
22
21
|
return value.startsWith(PREFIX);
|
|
@@ -50,10 +49,10 @@ export function decryptSecret(envelope, key) {
|
|
|
50
49
|
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf8');
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
52
|
+
* Decodes a `SELVA_AT_REST_KEY` env var into a 32-byte buffer (64-char hex or
|
|
53
|
+
* base64, with or without padding). Throws on anything else so a
|
|
54
|
+
* misconfigured key fails loudly at boot instead of silently producing
|
|
55
|
+
* ciphertext nothing can decrypt.
|
|
57
56
|
*/
|
|
58
57
|
export function decodeSecretKey(raw) {
|
|
59
58
|
if (/^[0-9a-fA-F]{64}$/.test(raw))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/computeServer/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzB
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/computeServer/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzB;;;;;;;;;;;;;GAaG;AAEH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,GAAW;IAC3D,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACvB,M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,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACxF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IAC1C,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClE,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACvC,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,GAAG,CAAC;IAClC,MAAM,IAAI,KAAK,CACd,uEAAuE;QACtE,+FAA+F,CAChG,CAAC;AACH,CAAC"}
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
* Compute servers belong to one of two scopes — never both.
|
|
3
3
|
*
|
|
4
4
|
* - **Platform server** (`scope: 'platform'`) — created by `manage_compute`.
|
|
5
|
-
* `sharedWith` controls which orgs see it. The
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* `sharedWith` controls which orgs see it. The global `defaultServerId`
|
|
6
|
+
* (in {@link ComputeConfig}) must reference a platform server and is
|
|
7
|
+
* *always* visible to every org regardless of `sharedWith`.
|
|
8
8
|
*
|
|
9
9
|
* - **Org-private server** (`scope: 'org'`) — created by an org owner/admin
|
|
10
10
|
* with `manage_org_compute`. Visible only to its `ownerOrgId`. Gated by
|
|
11
11
|
* the `ALLOW_ORG_COMPUTE_OVERRIDE` platform flag.
|
|
12
|
-
*
|
|
13
|
-
* Architecture spec §4.8.
|
|
14
12
|
*/
|
|
15
13
|
export type ComputeServerConfig = PlatformComputeServer | OrgComputeServer;
|
|
16
14
|
interface ComputeServerCommon {
|
|
@@ -19,16 +17,16 @@ interface ComputeServerCommon {
|
|
|
19
17
|
/** Base URL of the Rhino.Compute instance. */
|
|
20
18
|
serverUrl: string;
|
|
21
19
|
/**
|
|
22
|
-
* Sent as `RhinoComputeKey` header. Populated only when the config was
|
|
23
|
-
* with `includeApiKeys
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* Sent as the `RhinoComputeKey` header. Populated only when the config was
|
|
21
|
+
* read with `includeApiKeys` — `undefined` means "not loaded" as often as
|
|
22
|
+
* it means "none stored"; use {@link ComputeServerCommon.hasApiKey} to
|
|
23
|
+
* tell those apart.
|
|
26
24
|
*/
|
|
27
25
|
apiKey?: string;
|
|
28
26
|
/**
|
|
29
|
-
* Whether a key is stored
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* Whether a key is stored, independent of whether `apiKey` was loaded —
|
|
28
|
+
* lets pickers and admin pages show "key set" without decrypting a secret
|
|
29
|
+
* they'd only throw away.
|
|
32
30
|
*/
|
|
33
31
|
hasApiKey?: boolean;
|
|
34
32
|
/** Default: 30000. */
|
|
@@ -55,15 +53,15 @@ export interface OrgComputeServer extends ComputeServerCommon {
|
|
|
55
53
|
export interface ComputeConfig {
|
|
56
54
|
servers: ComputeServerConfig[];
|
|
57
55
|
/**
|
|
58
|
-
* Global default. Must reference a platform server.
|
|
59
|
-
*
|
|
60
|
-
*
|
|
56
|
+
* Global default. Must reference a platform server. Usable by every org
|
|
57
|
+
* regardless of that server's `sharedWith` — the baseline every user falls
|
|
58
|
+
* back to.
|
|
61
59
|
*/
|
|
62
60
|
defaultServerId?: string;
|
|
63
61
|
/**
|
|
64
62
|
* Per-org default override. `orgDefaults[orgId]` must reference a server
|
|
65
|
-
*
|
|
66
|
-
* `
|
|
63
|
+
* visible to `orgId` (a platform server with `orgId` in `sharedWith` or
|
|
64
|
+
* `'all'`, or an org server owned by `orgId`).
|
|
67
65
|
*/
|
|
68
66
|
orgDefaults?: Record<string, string>;
|
|
69
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/computeServer/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/computeServer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;AAE3E,UAAU,mBAAmB;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IACjE,KAAK,EAAE,UAAU,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC5D,KAAK,EAAE,KAAK,CAAC;IACb,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAMD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,mBAAmB,GAAG,CAAC,IAAI,qBAAqB,CAEnF;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,mBAAmB,GAAG,CAAC,IAAI,gBAAgB,CAEzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/computeServer/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/computeServer/types.ts"],"names":[],"mappings":"AAwEA,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,UAAU,gBAAgB,CAAC,CAAsB;IACtD,OAAO,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAsB;IACjD,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC;AAC1B,CAAC"}
|
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
import { type ComputeConfig, type ComputeServerConfig } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Servers an org can see in pickers and use for solves
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ∪ org-private servers owned by this org
|
|
7
|
-
*
|
|
8
|
-
* The global default is always included — it's the floor of the system.
|
|
3
|
+
* Servers an org can see in pickers and use for solves:
|
|
4
|
+
* platform servers shared with this org (or `'all'`, or the global default)
|
|
5
|
+
* ∪ org-private servers owned by this org.
|
|
9
6
|
*/
|
|
10
7
|
export declare function serversVisibleTo(config: ComputeConfig, orgId: string | null | undefined): ComputeServerConfig[];
|
|
11
8
|
/**
|
|
12
|
-
*
|
|
13
|
-
* Returns `undefined` if neither is set or
|
|
9
|
+
* Resolves the default server id for an org: per-org override, then global
|
|
10
|
+
* default. Returns `undefined` if neither is set or visible.
|
|
14
11
|
*/
|
|
15
12
|
export declare function defaultServerIdFor(config: ComputeConfig, orgId: string | null | undefined): string | undefined;
|
|
16
13
|
/**
|
|
17
|
-
*
|
|
14
|
+
* Resolves a definition's compute server, in order:
|
|
18
15
|
* 1. Definition pin (`computeServerId`) if visible to the project's org.
|
|
19
16
|
* 2. `orgDefaults[orgId]` if set.
|
|
20
17
|
* 3. Global `defaultServerId`.
|
|
21
18
|
*
|
|
22
|
-
*
|
|
19
|
+
* Throws if no usable server exists.
|
|
23
20
|
*/
|
|
24
21
|
export interface ResolveOptions {
|
|
25
22
|
/** Per-definition pin. Falls through silently if not visible. */
|
|
26
23
|
definitionPin?: string | null;
|
|
27
24
|
}
|
|
28
25
|
export declare function resolveServerForOrg(config: ComputeConfig, orgId: string | null | undefined, opts?: ResolveOptions): ComputeServerConfig;
|
|
29
|
-
/**
|
|
30
|
-
* Lookup by id, regardless of scope or visibility. Useful in admin contexts
|
|
31
|
-
* that need to display a server independently of the visibility filter.
|
|
32
|
-
*/
|
|
26
|
+
/** Lookup by id, ignoring scope or visibility — for admin contexts that display a server outside the visibility filter. */
|
|
33
27
|
export declare function findServerById(config: ComputeConfig, id: string): ComputeServerConfig | undefined;
|
|
34
28
|
export declare function platformServers(config: ComputeConfig): import("./types.js").PlatformComputeServer[];
|
|
35
29
|
export declare function orgServersFor(config: ComputeConfig, orgId: string): ComputeServerConfig[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/computeServer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,MAAM,YAAY,CAAC;AAEpB
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/computeServer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,mBAAmB,EAAE,CAWvB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAYpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC9B,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,IAAI,GAAE,cAAmB,GACvB,mBAAmB,CAoBrB;AAED,2HAA2H;AAC3H,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAEjG;AAMD,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,gDAEpD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,yBAEjE"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { isOrgServer, isPlatformServer } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Servers an org can see in pickers and use for solves
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ∪ org-private servers owned by this org
|
|
7
|
-
*
|
|
8
|
-
* The global default is always included — it's the floor of the system.
|
|
3
|
+
* Servers an org can see in pickers and use for solves:
|
|
4
|
+
* platform servers shared with this org (or `'all'`, or the global default)
|
|
5
|
+
* ∪ org-private servers owned by this org.
|
|
9
6
|
*/
|
|
10
7
|
export function serversVisibleTo(config, orgId) {
|
|
11
8
|
return config.servers.filter((s) => {
|
|
@@ -23,8 +20,8 @@ export function serversVisibleTo(config, orgId) {
|
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
* Returns `undefined` if neither is set or
|
|
23
|
+
* Resolves the default server id for an org: per-org override, then global
|
|
24
|
+
* default. Returns `undefined` if neither is set or visible.
|
|
28
25
|
*/
|
|
29
26
|
export function defaultServerIdFor(config, orgId) {
|
|
30
27
|
const visible = serversVisibleTo(config, orgId);
|
|
@@ -48,8 +45,7 @@ export function resolveServerForOrg(config, orgId, opts = {}) {
|
|
|
48
45
|
const pinned = visible.find((s) => s.id === opts.definitionPin);
|
|
49
46
|
if (pinned)
|
|
50
47
|
return pinned;
|
|
51
|
-
//
|
|
52
|
-
// was set.
|
|
48
|
+
// Not visible — admin may have un-shared the server since the pin was set. Fall through.
|
|
53
49
|
}
|
|
54
50
|
const defaultId = defaultServerIdFor(config, orgId);
|
|
55
51
|
if (defaultId) {
|
|
@@ -57,14 +53,10 @@ export function resolveServerForOrg(config, orgId, opts = {}) {
|
|
|
57
53
|
if (found)
|
|
58
54
|
return found;
|
|
59
55
|
}
|
|
60
|
-
// Last resort
|
|
61
|
-
// and during initial setup before a default is chosen.
|
|
56
|
+
// Last resort: first visible server. Mainly hit in tests and initial setup before a default is chosen.
|
|
62
57
|
return visible[0];
|
|
63
58
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Lookup by id, regardless of scope or visibility. Useful in admin contexts
|
|
66
|
-
* that need to display a server independently of the visibility filter.
|
|
67
|
-
*/
|
|
59
|
+
/** Lookup by id, ignoring scope or visibility — for admin contexts that display a server outside the visibility filter. */
|
|
68
60
|
export function findServerById(config, id) {
|
|
69
61
|
return config.servers.find((s) => s.id === id);
|
|
70
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/computeServer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,gBAAgB,EAGhB,MAAM,YAAY,CAAC;AAEpB
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/computeServer/utils.ts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OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAqB,EAAE,KAAa;IACjE,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -5,26 +5,16 @@ import type { IEventSink } from './events/interface.js';
|
|
|
5
5
|
import type { ISolveMetricSink } from './metrics/interface.js';
|
|
6
6
|
import type { IBindingResolver } from './bindings/interface.js';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
* are created by users. `ctx.actingOrgId` resolves per-request.
|
|
8
|
+
* `single`: one org per deployment, created at setup; `ctx.actingOrgId` resolves to it for
|
|
9
|
+
* every user. `multi`: orgs are first-class, created by users; `ctx.actingOrgId` resolves
|
|
10
|
+
* per-request.
|
|
12
11
|
*/
|
|
13
12
|
export type TenancyMode = 'single' | 'multi';
|
|
14
|
-
/**
|
|
15
|
-
* White-label branding. All fields optional; the selva app applies sensible
|
|
16
|
-
* "Selva" defaults for anything omitted. Use this to rebrand the instance
|
|
17
|
-
* (header name, footer copyright, landing-page copy, page titles) without
|
|
18
|
-
* forking the UI.
|
|
19
|
-
*/
|
|
13
|
+
/** White-label branding. Omitted fields fall back to "Selva" defaults in the selva app. */
|
|
20
14
|
export interface SelvaBranding {
|
|
21
|
-
/** Product name shown in header, footer, page titles. Default: "Selva". */
|
|
22
15
|
name?: string;
|
|
23
|
-
/** Footer copyright owner. Default: same as `name`. */
|
|
24
16
|
copyrightName?: string;
|
|
25
|
-
/** Landing-page tagline under the product name. */
|
|
26
17
|
tagline?: string;
|
|
27
|
-
/** Meta description for SEO / social previews. */
|
|
28
18
|
description?: string;
|
|
29
19
|
}
|
|
30
20
|
/** Opt-in platform features. All default false when absent. */
|
|
@@ -36,17 +26,14 @@ export interface SelvaFlags {
|
|
|
36
26
|
/** Authenticated users may create new orgs. */
|
|
37
27
|
ALLOW_ORG_CREATION?: boolean;
|
|
38
28
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* token-resolution path stops honouring any existing tokens.
|
|
29
|
+
* Anonymous external access via tokenized URLs. When off, share-link admin
|
|
30
|
+
* routes reject mint/list/revoke and existing tokens stop resolving.
|
|
42
31
|
*/
|
|
43
32
|
ENABLE_SHARING?: boolean;
|
|
44
33
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* from every list, and access rules treat them as inaccessible. Existing
|
|
49
|
-
* data is preserved; flipping back on restores access.
|
|
34
|
+
* Projects owned by instance admins, granted to orgs or users without normal
|
|
35
|
+
* membership. When off, `/admin/projects` 404s and platform-visibility
|
|
36
|
+
* projects are hidden and inaccessible; data survives the toggle either way.
|
|
50
37
|
*/
|
|
51
38
|
ENABLE_PLATFORM_PROJECTS?: boolean;
|
|
52
39
|
}
|
|
@@ -55,33 +42,23 @@ export interface SelvaConfig {
|
|
|
55
42
|
flags?: SelvaFlags;
|
|
56
43
|
branding?: SelvaBranding;
|
|
57
44
|
auth: IAuthProvider;
|
|
58
|
-
/**
|
|
59
|
-
* Orgs, projects, members, definitions, compute config, user profiles,
|
|
60
|
-
* and platform permissions. All database-layer concerns live here.
|
|
61
|
-
*/
|
|
45
|
+
/** Orgs, projects, members, definitions, compute config, user profiles, platform permissions. */
|
|
62
46
|
data: IDataProvider;
|
|
63
47
|
/** Blob storage — .gh/.ghx files, archived versions, images. */
|
|
64
48
|
storage: IStorageProvider;
|
|
65
|
-
/**
|
|
49
|
+
/** Defaults to `NoopEventSink`. */
|
|
66
50
|
events?: IEventSink;
|
|
67
|
-
/**
|
|
68
|
-
* Optional. Records per-solve timing (wall time of the Rhino.Compute solve
|
|
69
|
-
* call). Defaults to `NoopSolveMetricSink`, which discards every metric.
|
|
70
|
-
* Supply a real sink to persist or aggregate solve durations.
|
|
71
|
-
*/
|
|
51
|
+
/** Records per-solve wall time. Defaults to `NoopSolveMetricSink`, which discards every metric. */
|
|
72
52
|
solveMetrics?: ISolveMetricSink;
|
|
73
53
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* any solve involving a server-resolved input to error loudly until a real
|
|
78
|
-
* resolver is configured. Hosts that want server-resolved inputs must supply one.
|
|
54
|
+
* Resolves values for inputs marked `source.kind === 'server'`. Defaults to
|
|
55
|
+
* `NoopBindingResolver`, which resolves nothing — hosts that use server-resolved
|
|
56
|
+
* inputs must supply a real resolver.
|
|
79
57
|
*/
|
|
80
58
|
bindingResolver?: IBindingResolver;
|
|
81
59
|
}
|
|
82
60
|
export type SelvaConfigFactory = (env: Record<string, string | undefined>) => SelvaConfig;
|
|
83
|
-
/** Safe accessor — omitted flags resolve to false. */
|
|
84
61
|
export declare function isFlagEnabled(config: SelvaConfig, flag: keyof SelvaFlags): boolean;
|
|
85
|
-
/**
|
|
62
|
+
/** Identity function for type inference and IDE autocomplete. */
|
|
86
63
|
export declare function defineConfig(config: SelvaConfig | SelvaConfigFactory): SelvaConfig | SelvaConfigFactory;
|
|
87
64
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAA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G,IAAI,EAAE,aAAa,CAAC;IACpB,gEAAgE;IAChE,OAAO,EAAE,gBAAgB,CAAC;IAC1B,mCAAmC;IACnC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,mGAAmG;IACnG,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC;;;;OAIG;IACH,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,WAAW,CAAC;AAE1F,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,UAAU,GAAG,OAAO,CAElF;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAC3B,MAAM,EAAE,WAAW,GAAG,kBAAkB,GACtC,WAAW,GAAG,kBAAkB,CAElC"}
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/** Safe accessor — omitted flags resolve to false. */
|
|
2
1
|
export function isFlagEnabled(config, flag) {
|
|
3
2
|
return Boolean(config.flags?.[flag]);
|
|
4
3
|
}
|
|
5
|
-
/**
|
|
4
|
+
/** Identity function for type inference and IDE autocomplete. */
|
|
6
5
|
export function defineConfig(config) {
|
|
7
6
|
return config;
|
|
8
7
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAkEA,MAAM,UAAU,aAAa,CAAC,MAAmB,EAAE,IAAsB;IACxE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAC3B,MAAwC;IAExC,OAAO,MAAM,CAAC;AACf,CAAC"}
|