@ultrst-armada/kloks 2.2.7 → 2.2.8
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/.krusbl-release-attestation.json +3 -3
- package/package.json +1 -1
- package/packages/backend/dist/auth/OidcBffEnv.d.ts +14 -12
- package/packages/backend/dist/auth/OidcBffEnv.test.d.ts +1 -0
- package/packages/backend/dist/auth/index.js +1 -1
- package/packages/backend/dist/{chunk-SEKPSCWP.js → chunk-NR7OXPB3.js} +69 -21
- package/packages/backend/dist/node.js +1 -1
- package/packages/state-graph/dist/browser.js +8 -8
- package/packages/state-graph/dist/index.js +8 -8
- package/packages/state-graph/dist/spatial/index.js +1 -1
- package/packages/state-graph/dist/{chunk-UKTICGGV.js → chunk-7N2LLBUW.js} +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/kloks",
|
|
4
|
-
"version": "2.2.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "2.2.8",
|
|
5
|
+
"sourceCommit": "5c29834311d8c525ec703ef51b34de2c50f54987",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "44742095336"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All runtime configuration for ULTRST deployments is reached using these
|
|
3
|
+
* four canonical bindings. Application credentials are kept in the protected
|
|
4
|
+
* system database, never passed as Worker/Vercel/local environment variables.
|
|
5
|
+
*/
|
|
1
6
|
export interface CanonicalApplicationAuthEnvironment {
|
|
2
7
|
APP_URL?: unknown;
|
|
3
8
|
SYSTEM_DATABASE_URL?: unknown;
|
|
4
9
|
SYSTEM_DATABASE_URL_2?: unknown;
|
|
5
10
|
SYSTEM_DATABASE_URL_3?: unknown;
|
|
6
|
-
LUTH_OAUTH_CLIENT_ID?: unknown;
|
|
7
|
-
LUTH_OAUTH_CLIENT_SECRET?: unknown;
|
|
8
|
-
LUTH_OAUTH_BFF_SECRET?: unknown;
|
|
9
11
|
[key: string]: unknown;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Resolve a *fresh* application credential on every request. A revoked Luth
|
|
15
|
+
* client or removed origin stops new operations immediately, rather than
|
|
16
|
+
* remaining authorized by a stale in-memory credential cache.
|
|
15
17
|
*/
|
|
16
18
|
export declare function createCanonicalApplicationOAuthBff(request: Request, env: CanonicalApplicationAuthEnvironment, applicationId: string): {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
handle: (current: Request) => Promise<Response>;
|
|
20
|
+
getSession: (current: Request) => Promise<import("./OidcBff.js").OAuthBffSession>;
|
|
21
|
+
start: (current: Request) => Promise<Response>;
|
|
22
|
+
callback: (current: Request) => Promise<Response>;
|
|
23
|
+
session: (current: Request) => Promise<Response>;
|
|
24
|
+
signOut: (current: Request) => Promise<Response>;
|
|
23
25
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -314,34 +314,82 @@ function createOAuthBff(config) {
|
|
|
314
314
|
import { neon } from "@neondatabase/serverless";
|
|
315
315
|
import { DEFAULT_LUTH_URL } from "@dinilmusick/gutts/auth";
|
|
316
316
|
function createCanonicalApplicationOAuthBff(request, env, applicationId) {
|
|
317
|
-
if (!/^[a-z0-9][a-z0-9_-]{0,119}$/.test(applicationId))
|
|
318
|
-
|
|
319
|
-
const clientId = String(env.LUTH_OAUTH_CLIENT_ID || "").trim();
|
|
320
|
-
const clientSecret = String(env.LUTH_OAUTH_CLIENT_SECRET || "").trim();
|
|
321
|
-
const secret = String(env.LUTH_OAUTH_BFF_SECRET || "");
|
|
322
|
-
const dbUrl = String(env.SYSTEM_DATABASE_URL || env.SYSTEM_DATABASE_URL_2 || env.SYSTEM_DATABASE_URL_3 || "");
|
|
323
|
-
if (!origin || !clientId || !clientSecret || secret.length < 32 || !dbUrl) {
|
|
324
|
-
throw new Error("CANONICAL_APP_AUTH_NOT_PROVISIONED");
|
|
317
|
+
if (!/^[a-z0-9][a-z0-9_-]{0,119}$/.test(applicationId)) {
|
|
318
|
+
throw new Error("INVALID_APP_ID");
|
|
325
319
|
}
|
|
320
|
+
const origin = String(env.APP_URL || "").trim();
|
|
321
|
+
const candidates = [
|
|
322
|
+
env.SYSTEM_DATABASE_URL,
|
|
323
|
+
env.SYSTEM_DATABASE_URL_2,
|
|
324
|
+
env.SYSTEM_DATABASE_URL_3
|
|
325
|
+
].filter((value) => typeof value === "string" && !!value.trim()).map((value) => value.trim());
|
|
326
|
+
if (!origin || !candidates.length) throw new Error("CANONICAL_APP_AUTH_NOT_PROVISIONED");
|
|
326
327
|
const verifiedOrigin = new URL(origin);
|
|
327
328
|
if (verifiedOrigin.origin !== origin.replace(/\/$/, "") || !["http:", "https:"].includes(verifiedOrigin.protocol) || new URL(request.url).origin !== verifiedOrigin.origin) {
|
|
328
329
|
throw new Error("APPLICATION_ORIGIN_MISMATCH");
|
|
329
330
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
331
|
+
async function resolve(current) {
|
|
332
|
+
if (new URL(current.url).origin !== verifiedOrigin.origin) {
|
|
333
|
+
throw new Error("APPLICATION_ORIGIN_MISMATCH");
|
|
334
|
+
}
|
|
335
|
+
const settingsKey = applicationId + "|" + verifiedOrigin.origin;
|
|
336
|
+
const statement = `
|
|
337
|
+
SELECT c."clientId" AS client_id,
|
|
338
|
+
cred.credentials #> ARRAY['applicationOAuth', $3::text] AS settings
|
|
339
|
+
FROM public."ultrst-apps" a
|
|
340
|
+
JOIN public.luth_ecosystems e ON e.id = a.ecosystem_id
|
|
341
|
+
JOIN public.luth_auth_origins o
|
|
342
|
+
ON o.app_id = a.app_id AND o.ecosystem_id = a.ecosystem_id
|
|
343
|
+
JOIN public."oauthClient" c
|
|
344
|
+
ON c.metadata->>'appId' = a.app_id
|
|
345
|
+
AND c.metadata->>'origin' = o.origin
|
|
346
|
+
JOIN public."ultrst-credentials" cred ON cred.id = 'system'
|
|
347
|
+
WHERE a.app_id = $1 AND a.status = 'active' AND e.status = 'active'
|
|
348
|
+
AND o.origin = $2 AND o.enabled = true
|
|
349
|
+
AND COALESCE(c.disabled, false) = false
|
|
350
|
+
LIMIT 2
|
|
351
|
+
`;
|
|
352
|
+
let lastError;
|
|
353
|
+
for (const dbUrl of candidates) {
|
|
354
|
+
const sql = neon(dbUrl);
|
|
355
|
+
let rows;
|
|
356
|
+
try {
|
|
357
|
+
rows = [...await sql(statement, [applicationId, verifiedOrigin.origin, settingsKey])];
|
|
358
|
+
} catch (error) {
|
|
359
|
+
lastError = error;
|
|
360
|
+
continue;
|
|
342
361
|
}
|
|
362
|
+
if (rows.length !== 1) throw new Error("CANONICAL_APP_AUTH_NOT_PROVISIONED");
|
|
363
|
+
const raw = rows[0].settings;
|
|
364
|
+
const credential = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
365
|
+
if (typeof credential.clientId !== "string" || typeof credential.clientSecret !== "string" || typeof credential.bffSecret !== "string" || credential.bffSecret.length < 32 || credential.clientId !== rows[0].client_id || !credential.clientSecret) {
|
|
366
|
+
throw new Error("CANONICAL_APP_AUTH_NOT_PROVISIONED");
|
|
367
|
+
}
|
|
368
|
+
return createOAuthBff({
|
|
369
|
+
appId: applicationId,
|
|
370
|
+
issuer: DEFAULT_LUTH_URL.replace(/\/$/, "") + "/api/auth",
|
|
371
|
+
clientId: credential.clientId,
|
|
372
|
+
clientSecret: credential.clientSecret,
|
|
373
|
+
redirectUri: verifiedOrigin.origin + "/api/auth/oidc/callback",
|
|
374
|
+
encryptionSecret: credential.bffSecret,
|
|
375
|
+
database: {
|
|
376
|
+
async query(query, values) {
|
|
377
|
+
const result = await sql(query, [...values]);
|
|
378
|
+
return { rows: [...result] };
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
343
382
|
}
|
|
344
|
-
|
|
383
|
+
throw new Error(lastError ? "SYSTEM_DATABASE_UNAVAILABLE" : "CANONICAL_APP_AUTH_NOT_PROVISIONED");
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
handle: async (current) => (await resolve(current)).handle(current),
|
|
387
|
+
getSession: async (current) => (await resolve(current)).getSession(current),
|
|
388
|
+
start: async (current) => (await resolve(current)).start(current),
|
|
389
|
+
callback: async (current) => (await resolve(current)).callback(current),
|
|
390
|
+
session: async (current) => (await resolve(current)).session(current),
|
|
391
|
+
signOut: async (current) => (await resolve(current)).signOut(current)
|
|
392
|
+
};
|
|
345
393
|
}
|
|
346
394
|
|
|
347
395
|
export {
|
|
@@ -252,7 +252,7 @@ import {
|
|
|
252
252
|
validateProjectGraph,
|
|
253
253
|
validateUniversalConnection,
|
|
254
254
|
zoomAtPoint
|
|
255
|
-
} from "./chunk-
|
|
255
|
+
} from "./chunk-7N2LLBUW.js";
|
|
256
256
|
import {
|
|
257
257
|
BaseHandle,
|
|
258
258
|
DataHandle,
|
|
@@ -261,7 +261,6 @@ import {
|
|
|
261
261
|
ViewHandle,
|
|
262
262
|
instantiateSubgraph
|
|
263
263
|
} from "./chunk-OXUDG6HE.js";
|
|
264
|
-
import "./chunk-RHRXPY2U.js";
|
|
265
264
|
import {
|
|
266
265
|
LifecycleCycleError,
|
|
267
266
|
LifecycleGraph,
|
|
@@ -285,6 +284,7 @@ import {
|
|
|
285
284
|
CustomViewWindow,
|
|
286
285
|
DEFAULT_GRAPH_SETTINGS
|
|
287
286
|
} from "./chunk-5KP74NMF.js";
|
|
287
|
+
import "./chunk-RHRXPY2U.js";
|
|
288
288
|
import {
|
|
289
289
|
AttractionEngine,
|
|
290
290
|
GhostInferenceEngine,
|
|
@@ -294,12 +294,6 @@ import {
|
|
|
294
294
|
getBeamPoints,
|
|
295
295
|
useMagneticTraces
|
|
296
296
|
} from "./chunk-JXDJZSFW.js";
|
|
297
|
-
import {
|
|
298
|
-
ConnectionRuleStore,
|
|
299
|
-
HandleTypeRegistry,
|
|
300
|
-
WireTypeRegistry,
|
|
301
|
-
initializeDefaultGraphRules
|
|
302
|
-
} from "./chunk-TZOL3RN7.js";
|
|
303
297
|
import {
|
|
304
298
|
AutoSolidify,
|
|
305
299
|
SpatialEngine,
|
|
@@ -310,6 +304,12 @@ import {
|
|
|
310
304
|
SolidConnection,
|
|
311
305
|
ViewLink
|
|
312
306
|
} from "./chunk-OYN4ZEZC.js";
|
|
307
|
+
import {
|
|
308
|
+
ConnectionRuleStore,
|
|
309
|
+
HandleTypeRegistry,
|
|
310
|
+
WireTypeRegistry,
|
|
311
|
+
initializeDefaultGraphRules
|
|
312
|
+
} from "./chunk-TZOL3RN7.js";
|
|
313
313
|
import {
|
|
314
314
|
CompatibilityMatrix
|
|
315
315
|
} from "./chunk-ISFNY7EZ.js";
|
|
@@ -252,7 +252,7 @@ import {
|
|
|
252
252
|
validateProjectGraph,
|
|
253
253
|
validateUniversalConnection,
|
|
254
254
|
zoomAtPoint
|
|
255
|
-
} from "./chunk-
|
|
255
|
+
} from "./chunk-7N2LLBUW.js";
|
|
256
256
|
import {
|
|
257
257
|
BaseHandle,
|
|
258
258
|
DataHandle,
|
|
@@ -261,7 +261,6 @@ import {
|
|
|
261
261
|
ViewHandle,
|
|
262
262
|
instantiateSubgraph
|
|
263
263
|
} from "./chunk-OXUDG6HE.js";
|
|
264
|
-
import "./chunk-RHRXPY2U.js";
|
|
265
264
|
import {
|
|
266
265
|
LifecycleCycleError,
|
|
267
266
|
LifecycleGraph,
|
|
@@ -285,6 +284,7 @@ import {
|
|
|
285
284
|
CustomViewWindow,
|
|
286
285
|
DEFAULT_GRAPH_SETTINGS
|
|
287
286
|
} from "./chunk-5KP74NMF.js";
|
|
287
|
+
import "./chunk-RHRXPY2U.js";
|
|
288
288
|
import {
|
|
289
289
|
AttractionEngine,
|
|
290
290
|
GhostInferenceEngine,
|
|
@@ -294,12 +294,6 @@ import {
|
|
|
294
294
|
getBeamPoints,
|
|
295
295
|
useMagneticTraces
|
|
296
296
|
} from "./chunk-JXDJZSFW.js";
|
|
297
|
-
import {
|
|
298
|
-
ConnectionRuleStore,
|
|
299
|
-
HandleTypeRegistry,
|
|
300
|
-
WireTypeRegistry,
|
|
301
|
-
initializeDefaultGraphRules
|
|
302
|
-
} from "./chunk-TZOL3RN7.js";
|
|
303
297
|
import {
|
|
304
298
|
AutoSolidify,
|
|
305
299
|
SpatialEngine,
|
|
@@ -310,6 +304,12 @@ import {
|
|
|
310
304
|
SolidConnection,
|
|
311
305
|
ViewLink
|
|
312
306
|
} from "./chunk-OYN4ZEZC.js";
|
|
307
|
+
import {
|
|
308
|
+
ConnectionRuleStore,
|
|
309
|
+
HandleTypeRegistry,
|
|
310
|
+
WireTypeRegistry,
|
|
311
|
+
initializeDefaultGraphRules
|
|
312
|
+
} from "./chunk-TZOL3RN7.js";
|
|
313
313
|
import {
|
|
314
314
|
CompatibilityMatrix
|
|
315
315
|
} from "./chunk-ISFNY7EZ.js";
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
getBeamPoints,
|
|
8
8
|
useMagneticTraces
|
|
9
9
|
} from "../chunk-JXDJZSFW.js";
|
|
10
|
-
import "../chunk-TZOL3RN7.js";
|
|
11
10
|
import {
|
|
12
11
|
AutoSolidify,
|
|
13
12
|
SpatialEngine,
|
|
14
13
|
TraceEngine
|
|
15
14
|
} from "../chunk-OV4JVTNY.js";
|
|
16
15
|
import "../chunk-OYN4ZEZC.js";
|
|
16
|
+
import "../chunk-TZOL3RN7.js";
|
|
17
17
|
import "../chunk-ISFNY7EZ.js";
|
|
18
18
|
export {
|
|
19
19
|
AttractionEngine,
|
|
@@ -7,10 +7,6 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AttractionEngine
|
|
9
9
|
} from "./chunk-JXDJZSFW.js";
|
|
10
|
-
import {
|
|
11
|
-
HandleTypeRegistry,
|
|
12
|
-
WireTypeRegistry
|
|
13
|
-
} from "./chunk-TZOL3RN7.js";
|
|
14
10
|
import {
|
|
15
11
|
AutoSolidify,
|
|
16
12
|
TraceEngine
|
|
@@ -18,6 +14,10 @@ import {
|
|
|
18
14
|
import {
|
|
19
15
|
SolidConnection
|
|
20
16
|
} from "./chunk-OYN4ZEZC.js";
|
|
17
|
+
import {
|
|
18
|
+
HandleTypeRegistry,
|
|
19
|
+
WireTypeRegistry
|
|
20
|
+
} from "./chunk-TZOL3RN7.js";
|
|
21
21
|
import {
|
|
22
22
|
CompatibilityMatrix
|
|
23
23
|
} from "./chunk-ISFNY7EZ.js";
|