@ultrst-armada/kloks 2.2.9 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.krusbl-release-attestation.json +3 -3
- package/package.json +1 -1
- package/packages/backend/dist/auth/LuthOAuthUserInfo.d.ts +10 -0
- package/packages/backend/dist/auth/OidcBff.d.ts +3 -2
- package/packages/backend/dist/auth/OidcBffEnv.d.ts +6 -7
- package/packages/backend/dist/auth/index.d.ts +0 -3
- package/packages/backend/dist/auth/index.js +2 -26
- package/packages/backend/dist/{chunk-AKVBFHHD.js → chunk-2SNWR4FI.js} +88 -57
- package/packages/backend/dist/{chunk-UI7AYFAU.js → chunk-363J52AF.js} +0 -48
- package/packages/backend/dist/{chunk-GCVR257U.js → chunk-3SDRLTD6.js} +1 -1
- package/packages/backend/dist/chunk-7HD7OEUY.js +177 -0
- package/packages/backend/dist/chunk-B5DCG4UC.js +602 -0
- package/packages/backend/dist/{chunk-7XTURV44.js → chunk-F7BO3GLA.js} +2 -2
- package/packages/backend/dist/{chunk-RHW75K46.js → chunk-IAW6N73D.js} +49 -1
- package/packages/backend/dist/{chunk-IRKJ6HKP.js → chunk-IXEKOWY4.js} +1 -1
- package/packages/backend/dist/{chunk-4X4QGVAO.js → chunk-NRW4TECO.js} +1 -1
- package/packages/backend/dist/{chunk-3ZL2DX73.js → chunk-PAU25K7F.js} +5 -172
- package/packages/backend/dist/{chunk-NUBA6A5T.js → chunk-VN2NR3KT.js} +1 -1
- package/packages/backend/dist/{chunk-R4B3KPHY.js → chunk-YFISFDBW.js} +36 -15
- package/packages/backend/dist/control-plane/ControlPlaneManager.d.ts +6 -3
- package/packages/backend/dist/index.d.ts +0 -2
- package/packages/backend/dist/index.js +7 -25
- package/packages/backend/dist/krnl-services.js +6 -6
- package/packages/backend/dist/node.d.ts +0 -1
- package/packages/backend/dist/node.js +20 -95
- package/packages/backend/dist/provider-services/index.js +7 -7
- package/packages/backend/dist/provider-services/node.d.ts +2 -0
- package/packages/backend/dist/provider-services/node.js +15 -4
- package/packages/backend/dist/provider-services/saved-account-crypto.d.ts +19 -0
- package/packages/backend/dist/provider-services/saved-account-probe.d.ts +26 -0
- package/packages/backend/dist/provider-services/saved-account-store.d.ts +29 -0
- package/packages/backend/dist/services/node.js +5 -4
- package/packages/backend/dist/srkl/index.js +3 -2
- package/packages/backend/dist/workspace/node.js +5 -4
- package/packages/backend/dist/{workspaceFileCore-XPT6WTFY.js → workspaceFileCore-2KCVSECY.js} +3 -2
- package/packages/client/dist/auth.d.ts +9 -21
- package/packages/client/dist/auth.js +1 -23
- package/packages/client/dist/chunk-QGZHKLOK.js +75 -0
- package/packages/client/dist/index.d.ts +2 -3
- package/packages/client/dist/index.js +1 -23
- package/packages/backend/dist/auth/BaseAccountProvider.d.ts +0 -7
- package/packages/backend/dist/auth/CanonicalAuthClient.d.ts +0 -6
- package/packages/backend/dist/auth/UnifiedAuthCore.d.ts +0 -23
- package/packages/backend/dist/auth/UniversalLuthInitialization.d.ts +0 -55
- package/packages/backend/dist/chunk-2COYZMUJ.js +0 -78
- package/packages/backend/dist/chunk-MDTLU7H4.js +0 -58
- package/packages/backend/dist/chunk-U5VPYALB.js +0 -261
- package/packages/backend/dist/luth/LuthDiscoveryService.d.ts +0 -15
- package/packages/backend/dist/luth/index.d.ts +0 -1
- package/packages/client/dist/chunk-4HR374IB.js +0 -148
- /package/packages/backend/dist/{auth/UnifiedAuthCore.test.d.ts → provider-services/saved-account-store.test.d.ts} +0 -0
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setWorkingWorkspaceConfig,
|
|
13
13
|
syncWorkspace,
|
|
14
14
|
workingWorkspaceService
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VN2NR3KT.js";
|
|
16
16
|
import {
|
|
17
17
|
CompositeBackend,
|
|
18
18
|
EndpointGenerator,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
parseGraphJsonFile,
|
|
28
28
|
validateGraphDocument,
|
|
29
29
|
workspaceGraphService
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-NRW4TECO.js";
|
|
31
31
|
import {
|
|
32
32
|
CANONICAL_SRKL_URL,
|
|
33
33
|
SrklClient,
|
|
@@ -80,8 +80,12 @@ import {
|
|
|
80
80
|
GitLabProviderService,
|
|
81
81
|
GoogleAccountProviderService,
|
|
82
82
|
GoogleDriveProviderService,
|
|
83
|
-
VercelProviderService
|
|
84
|
-
|
|
83
|
+
VercelProviderService,
|
|
84
|
+
listSavedProviderAccounts,
|
|
85
|
+
readSavedProviderAccount,
|
|
86
|
+
revokeSavedProviderAccount,
|
|
87
|
+
saveVerifiedProviderAccount
|
|
88
|
+
} from "./chunk-B5DCG4UC.js";
|
|
85
89
|
import {
|
|
86
90
|
CanonicalStorageProviderService
|
|
87
91
|
} from "./chunk-GZTZ376X.js";
|
|
@@ -93,7 +97,7 @@ import {
|
|
|
93
97
|
import {
|
|
94
98
|
createCanonicalApplicationOAuthBff,
|
|
95
99
|
createOAuthBff
|
|
96
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-2SNWR4FI.js";
|
|
97
101
|
import {
|
|
98
102
|
BackendProvider,
|
|
99
103
|
useBackend,
|
|
@@ -111,7 +115,7 @@ import {
|
|
|
111
115
|
import {
|
|
112
116
|
WorkspaceCloneSyncEngine
|
|
113
117
|
} from "./chunk-CDRHYO44.js";
|
|
114
|
-
import "./chunk-
|
|
118
|
+
import "./chunk-IAW6N73D.js";
|
|
115
119
|
import "./chunk-GIUAFRAA.js";
|
|
116
120
|
import "./chunk-LAKCKX3I.js";
|
|
117
121
|
import "./chunk-LPM5E2A2.js";
|
|
@@ -132,16 +136,6 @@ import {
|
|
|
132
136
|
import {
|
|
133
137
|
SkipoBase
|
|
134
138
|
} from "./chunk-LMY6MGFD.js";
|
|
135
|
-
import {
|
|
136
|
-
LuthAuthClient,
|
|
137
|
-
LuthAuthClient2,
|
|
138
|
-
LuthAuthError,
|
|
139
|
-
createLuthAuthClient,
|
|
140
|
-
createLuthAuthClient2,
|
|
141
|
-
createUniversalLuthRuntimeService,
|
|
142
|
-
resolveClientEnvironment,
|
|
143
|
-
resolveClientOrigin
|
|
144
|
-
} from "./chunk-MDTLU7H4.js";
|
|
145
139
|
import {
|
|
146
140
|
BackendRegistry,
|
|
147
141
|
ConcurrencyConflictError,
|
|
@@ -237,7 +231,7 @@ import {
|
|
|
237
231
|
readUserWorkspaceStorageFile,
|
|
238
232
|
verifyGoogleDriveAuthorizationState,
|
|
239
233
|
writeUserWorkspaceStorageFile
|
|
240
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-YFISFDBW.js";
|
|
241
235
|
import {
|
|
242
236
|
formatCanonicalWorkspaceFolderName,
|
|
243
237
|
sanitizeWorkspaceName
|
|
@@ -256,7 +250,7 @@ import {
|
|
|
256
250
|
syncWorkspaceDataToBucket,
|
|
257
251
|
syncWorkspaceDeleteToBucket,
|
|
258
252
|
updateWorkspace
|
|
259
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-F7BO3GLA.js";
|
|
260
254
|
import {
|
|
261
255
|
configureLocalWorkspaceFileAdapter,
|
|
262
256
|
deleteWorkspaceFile,
|
|
@@ -268,12 +262,12 @@ import {
|
|
|
268
262
|
normalizeWorkspaceStoragePath,
|
|
269
263
|
readWorkspaceFile,
|
|
270
264
|
writeWorkspaceFile
|
|
271
|
-
} from "./chunk-
|
|
265
|
+
} from "./chunk-3SDRLTD6.js";
|
|
272
266
|
import {
|
|
273
267
|
getPrimarySrklDeploymentUrl,
|
|
274
268
|
getSrklAccounts,
|
|
275
269
|
srklListBackblazeBuckets
|
|
276
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-IXEKOWY4.js";
|
|
277
271
|
import {
|
|
278
272
|
completeGoogleDriveAuthorization,
|
|
279
273
|
createBackblazeStorageConnection,
|
|
@@ -298,17 +292,14 @@ import {
|
|
|
298
292
|
testGoogleDriveConnectionForUser,
|
|
299
293
|
toPublicStorageConnection,
|
|
300
294
|
writeGoogleDriveFileForConnection
|
|
301
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-PAU25K7F.js";
|
|
296
|
+
import "./chunk-7HD7OEUY.js";
|
|
302
297
|
import {
|
|
303
298
|
cleanDbUrl,
|
|
304
299
|
configureUnifiedDatabaseEnvironmentResolver,
|
|
305
300
|
getUnifiedDbUrl,
|
|
306
301
|
queryUnifiedDb
|
|
307
302
|
} from "./chunk-3RTRATDJ.js";
|
|
308
|
-
import {
|
|
309
|
-
loginSystemUser,
|
|
310
|
-
resolveUserFromToken
|
|
311
|
-
} from "./chunk-2COYZMUJ.js";
|
|
312
303
|
import {
|
|
313
304
|
authorizeB2,
|
|
314
305
|
b2DeleteFileVersion,
|
|
@@ -415,62 +406,6 @@ var FunctionalityTable = class extends BaseDataProvider {
|
|
|
415
406
|
}
|
|
416
407
|
};
|
|
417
408
|
|
|
418
|
-
// src/luth/LuthDiscoveryService.ts
|
|
419
|
-
import { DEFAULT_LUTH_URL } from "@dinilmusick/gutts/auth";
|
|
420
|
-
var cachedLuthUrls = null;
|
|
421
|
-
var roundRobinIndex = 0;
|
|
422
|
-
async function getRegisteredLuthDeploymentUrls(queryDb) {
|
|
423
|
-
if (cachedLuthUrls && Date.now() < cachedLuthUrls.expiresAt && cachedLuthUrls.urls.length > 0) {
|
|
424
|
-
return cachedLuthUrls.urls;
|
|
425
|
-
}
|
|
426
|
-
if (queryDb) {
|
|
427
|
-
try {
|
|
428
|
-
const res = await queryDb(
|
|
429
|
-
`SELECT url FROM "ultrst-luth-deployments" WHERE is_active = true ORDER BY is_primary DESC, priority DESC, created_at ASC`,
|
|
430
|
-
[]
|
|
431
|
-
);
|
|
432
|
-
if (res.rows.length > 0) {
|
|
433
|
-
const urls = res.rows.map((r) => String(r.url || "").trim().replace(/\/+$/, "")).filter(Boolean);
|
|
434
|
-
if (urls.length > 0) {
|
|
435
|
-
cachedLuthUrls = { urls, expiresAt: Date.now() + 5 * 60 * 1e3 };
|
|
436
|
-
return urls;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
} catch {
|
|
440
|
-
try {
|
|
441
|
-
const res2 = await queryDb(
|
|
442
|
-
`SELECT origin FROM "ultrst-apps" WHERE app_id = 'luth' AND status = 'active' AND origin IS NOT NULL LIMIT 1`,
|
|
443
|
-
[]
|
|
444
|
-
);
|
|
445
|
-
if (res2.rows.length > 0 && res2.rows[0].origin) {
|
|
446
|
-
const u = String(res2.rows[0].origin).trim().replace(/\/+$/, "");
|
|
447
|
-
cachedLuthUrls = { urls: [u], expiresAt: Date.now() + 5 * 60 * 1e3 };
|
|
448
|
-
return [u];
|
|
449
|
-
}
|
|
450
|
-
} catch {
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
const fallback = [DEFAULT_LUTH_URL];
|
|
455
|
-
cachedLuthUrls = { urls: fallback, expiresAt: Date.now() + 5 * 60 * 1e3 };
|
|
456
|
-
return fallback;
|
|
457
|
-
}
|
|
458
|
-
async function getPrimaryLuthDeploymentUrl(queryDb) {
|
|
459
|
-
const urls = await getRegisteredLuthDeploymentUrls(queryDb);
|
|
460
|
-
return urls[0] || DEFAULT_LUTH_URL;
|
|
461
|
-
}
|
|
462
|
-
async function getNextLuthDeploymentUrl(queryDb) {
|
|
463
|
-
const urls = await getRegisteredLuthDeploymentUrls(queryDb);
|
|
464
|
-
if (urls.length === 0) return DEFAULT_LUTH_URL;
|
|
465
|
-
const next = urls[roundRobinIndex % urls.length];
|
|
466
|
-
roundRobinIndex = (roundRobinIndex + 1) % urls.length;
|
|
467
|
-
return next;
|
|
468
|
-
}
|
|
469
|
-
function clearLuthDiscoveryCache() {
|
|
470
|
-
cachedLuthUrls = null;
|
|
471
|
-
roundRobinIndex = 0;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
409
|
// src/architecture/types.ts
|
|
475
410
|
function validateServiceDefinition(def) {
|
|
476
411
|
if (def.deployment === "remote" && def.runtime !== "server") {
|
|
@@ -4620,7 +4555,6 @@ export {
|
|
|
4620
4555
|
BucketStorageService,
|
|
4621
4556
|
CANONICAL_SRKL_URL,
|
|
4622
4557
|
CallbackRegistry,
|
|
4623
|
-
LuthAuthClient2 as CanonicalAuthClient,
|
|
4624
4558
|
CanonicalStorageProviderService,
|
|
4625
4559
|
CloudflareProviderService,
|
|
4626
4560
|
CloudflareResourceFetcher,
|
|
@@ -4665,8 +4599,6 @@ export {
|
|
|
4665
4599
|
LoadBalancer,
|
|
4666
4600
|
LocalFSAdapter,
|
|
4667
4601
|
LockManager,
|
|
4668
|
-
LuthAuthClient,
|
|
4669
|
-
LuthAuthError,
|
|
4670
4602
|
MCPEngine,
|
|
4671
4603
|
MetricsLogger,
|
|
4672
4604
|
ModelCatalogService,
|
|
@@ -4722,7 +4654,6 @@ export {
|
|
|
4722
4654
|
buildProjectsList,
|
|
4723
4655
|
classifyAndFormatError,
|
|
4724
4656
|
cleanDbUrl,
|
|
4725
|
-
clearLuthDiscoveryCache,
|
|
4726
4657
|
completeGoogleDriveAuthorization,
|
|
4727
4658
|
completeGoogleDriveAuthorizationCallback,
|
|
4728
4659
|
computeDeploymentFinalWeight,
|
|
@@ -4735,7 +4666,6 @@ export {
|
|
|
4735
4666
|
createBackend,
|
|
4736
4667
|
createBackendClient,
|
|
4737
4668
|
createCanonicalApplicationOAuthBff,
|
|
4738
|
-
createLuthAuthClient2 as createCanonicalAuthClient,
|
|
4739
4669
|
createCompositeService,
|
|
4740
4670
|
createCredential,
|
|
4741
4671
|
createEmptyContract,
|
|
@@ -4746,12 +4676,10 @@ export {
|
|
|
4746
4676
|
createGraphAssetFolder as createGraphAssetSubfolder,
|
|
4747
4677
|
createGraphPackage,
|
|
4748
4678
|
createLocalService,
|
|
4749
|
-
createLuthAuthClient,
|
|
4750
4679
|
createOAuthBff,
|
|
4751
4680
|
createRemoteService,
|
|
4752
4681
|
createSSEResponse,
|
|
4753
4682
|
createSrklClient,
|
|
4754
|
-
createUniversalLuthRuntimeService,
|
|
4755
4683
|
createWavBuffer,
|
|
4756
4684
|
createWorkspace,
|
|
4757
4685
|
createWorkspaceGraph,
|
|
@@ -4805,15 +4733,12 @@ export {
|
|
|
4805
4733
|
getGatewayConfig,
|
|
4806
4734
|
getGoogleDriveAccountIdentityForUser,
|
|
4807
4735
|
getGraphPackageById,
|
|
4808
|
-
getNextLuthDeploymentUrl,
|
|
4809
|
-
getPrimaryLuthDeploymentUrl,
|
|
4810
4736
|
getPrimarySrklDeploymentUrl2 as getPrimarySrklCoreDeploymentUrl,
|
|
4811
4737
|
getPrimarySrklDeploymentUrl,
|
|
4812
4738
|
getProjectById,
|
|
4813
4739
|
getProviderMeta,
|
|
4814
4740
|
getPublicRouteByPath,
|
|
4815
4741
|
getPublicRoutes,
|
|
4816
|
-
getRegisteredLuthDeploymentUrls,
|
|
4817
4742
|
getSrklAccounts,
|
|
4818
4743
|
getSrklAccounts2 as getSrklCoreAccounts,
|
|
4819
4744
|
getSrklStatus,
|
|
@@ -4867,6 +4792,7 @@ export {
|
|
|
4867
4792
|
listGoogleDriveFoldersForConnection,
|
|
4868
4793
|
listProjectSamples,
|
|
4869
4794
|
listProviders,
|
|
4795
|
+
listSavedProviderAccounts,
|
|
4870
4796
|
listUserStorageConnections,
|
|
4871
4797
|
listUserStorageConnectionsWithSecrets,
|
|
4872
4798
|
listUserWorkspaceStorageFiles,
|
|
@@ -4874,7 +4800,6 @@ export {
|
|
|
4874
4800
|
listWorkspaceGraphs,
|
|
4875
4801
|
loadCredentialManifest,
|
|
4876
4802
|
loadWorkspaceData,
|
|
4877
|
-
loginSystemUser,
|
|
4878
4803
|
matchGatewayIngress,
|
|
4879
4804
|
matchGatewayIngressAsync,
|
|
4880
4805
|
mcpEngine,
|
|
@@ -4895,6 +4820,7 @@ export {
|
|
|
4895
4820
|
persistGoogleDriveTokens,
|
|
4896
4821
|
queryUnifiedDb,
|
|
4897
4822
|
readGoogleDriveFileForConnection,
|
|
4823
|
+
readSavedProviderAccount,
|
|
4898
4824
|
readUserWorkspaceStorageFile,
|
|
4899
4825
|
readWorkspaceFile,
|
|
4900
4826
|
recordExecution,
|
|
@@ -4903,19 +4829,17 @@ export {
|
|
|
4903
4829
|
renameAppInWorkspaceData,
|
|
4904
4830
|
renameS3Folder,
|
|
4905
4831
|
resolveBackblazeEndpoint,
|
|
4906
|
-
resolveClientEnvironment,
|
|
4907
|
-
resolveClientOrigin,
|
|
4908
4832
|
resolveDynamicRouteFromDb,
|
|
4909
4833
|
resolveSystemDatabaseClusterNodes,
|
|
4910
4834
|
resolveSystemDatabaseUrl,
|
|
4911
4835
|
resolveSystemDatabaseUrlCandidates,
|
|
4912
|
-
resolveUserFromToken,
|
|
4913
4836
|
resolveUserStorageConnectionSecret,
|
|
4914
4837
|
resolveUserWorkspaceStorageAssociation,
|
|
4915
4838
|
resolveWorkspaceConnection,
|
|
4916
4839
|
resolveWorkspaceDir,
|
|
4917
4840
|
resumeCloudflarePagesProject,
|
|
4918
4841
|
resumeVercelProject,
|
|
4842
|
+
revokeSavedProviderAccount,
|
|
4919
4843
|
sanitizeWorkspaceName,
|
|
4920
4844
|
saveAssetToGraph,
|
|
4921
4845
|
saveAssetToPool,
|
|
@@ -4924,6 +4848,7 @@ export {
|
|
|
4924
4848
|
saveGraphPackage,
|
|
4925
4849
|
saveProject,
|
|
4926
4850
|
saveProjectSample,
|
|
4851
|
+
saveVerifiedProviderAccount,
|
|
4927
4852
|
saveWorkspaceData,
|
|
4928
4853
|
saveWorkspaceGraph,
|
|
4929
4854
|
scanAssetPool,
|
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
calculateProviderCapacity,
|
|
4
4
|
createFlyMachine,
|
|
5
5
|
getFlyMachine,
|
|
6
|
-
getRailwayAccount,
|
|
7
6
|
invokeFlyMachineHttp,
|
|
8
|
-
listFlyApps,
|
|
9
7
|
listFlyMachines,
|
|
10
|
-
listGoogleCloudRunServices,
|
|
11
|
-
listRenderServices,
|
|
12
8
|
mutateFlyMachine,
|
|
13
9
|
rankComputeRoutes,
|
|
14
10
|
resolveComputeSpec,
|
|
15
11
|
selectComputeRoute,
|
|
16
12
|
validateComputeSpec
|
|
17
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-363J52AF.js";
|
|
18
14
|
import {
|
|
19
15
|
fetchCloudflareCapacity,
|
|
20
|
-
fetchVercelCapacity
|
|
21
|
-
|
|
16
|
+
fetchVercelCapacity,
|
|
17
|
+
getRailwayAccount,
|
|
18
|
+
listFlyApps,
|
|
19
|
+
listGoogleCloudRunServices,
|
|
20
|
+
listRenderServices
|
|
21
|
+
} from "../chunk-IAW6N73D.js";
|
|
22
22
|
import {
|
|
23
23
|
getGeminiQuotaStatus,
|
|
24
24
|
listGeminiModels
|
|
@@ -2,3 +2,5 @@
|
|
|
2
2
|
export * from './facades.js';
|
|
3
3
|
export * from './storage-facades.js';
|
|
4
4
|
export * from './storage-node.js';
|
|
5
|
+
export { saveVerifiedProviderAccount, listSavedProviderAccounts, readSavedProviderAccount, revokeSavedProviderAccount, } from './saved-account-store.js';
|
|
6
|
+
export type { PublicSavedProviderAccount, ProviderAccountQuery, } from './saved-account-store.js';
|
|
@@ -7,12 +7,16 @@ import {
|
|
|
7
7
|
GitLabProviderService,
|
|
8
8
|
GoogleAccountProviderService,
|
|
9
9
|
GoogleDriveProviderService,
|
|
10
|
-
VercelProviderService
|
|
11
|
-
|
|
10
|
+
VercelProviderService,
|
|
11
|
+
listSavedProviderAccounts,
|
|
12
|
+
readSavedProviderAccount,
|
|
13
|
+
revokeSavedProviderAccount,
|
|
14
|
+
saveVerifiedProviderAccount
|
|
15
|
+
} from "../chunk-B5DCG4UC.js";
|
|
12
16
|
import {
|
|
13
17
|
CanonicalStorageProviderService
|
|
14
18
|
} from "../chunk-GZTZ376X.js";
|
|
15
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-IAW6N73D.js";
|
|
16
20
|
import "../chunk-GIUAFRAA.js";
|
|
17
21
|
import "../chunk-LAKCKX3I.js";
|
|
18
22
|
import "../chunk-LPM5E2A2.js";
|
|
@@ -24,7 +28,10 @@ import "../chunk-CTBVXX5C.js";
|
|
|
24
28
|
import "../chunk-HJE4CVKY.js";
|
|
25
29
|
import "../chunk-MQ6AHJ6X.js";
|
|
26
30
|
import "../chunk-G6FLQJS6.js";
|
|
31
|
+
import "../chunk-7HD7OEUY.js";
|
|
32
|
+
import "../chunk-3RTRATDJ.js";
|
|
27
33
|
import "../chunk-I6T64MLT.js";
|
|
34
|
+
import "../chunk-IP6XWQU2.js";
|
|
28
35
|
import "../chunk-EMSSTOOK.js";
|
|
29
36
|
export {
|
|
30
37
|
BackblazeB2ProviderService,
|
|
@@ -36,5 +43,9 @@ export {
|
|
|
36
43
|
GitLabProviderService,
|
|
37
44
|
GoogleAccountProviderService,
|
|
38
45
|
GoogleDriveProviderService,
|
|
39
|
-
VercelProviderService
|
|
46
|
+
VercelProviderService,
|
|
47
|
+
listSavedProviderAccounts,
|
|
48
|
+
readSavedProviderAccount,
|
|
49
|
+
revokeSavedProviderAccount,
|
|
50
|
+
saveVerifiedProviderAccount
|
|
40
51
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Server-only AEAD. The canonical system-owned wrapping key remains in Kloks. */
|
|
2
|
+
export interface ProviderSecretEnvelope {
|
|
3
|
+
version: 1;
|
|
4
|
+
algorithm: 'AES-GCM-256';
|
|
5
|
+
iv: string;
|
|
6
|
+
ciphertext: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BoundSecret {
|
|
9
|
+
ownerUserId: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
id: string;
|
|
12
|
+
providerId: string;
|
|
13
|
+
resourceKind: string;
|
|
14
|
+
accountScope: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
region: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function encryptSavedCredential(secret: string, key: string, bound: BoundSecret): Promise<ProviderSecretEnvelope>;
|
|
19
|
+
export declare function decryptSavedCredential(envelope: ProviderSecretEnvelope, key: string, bound: BoundSecret): Promise<string>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Do not add undocumented providers: this is the live API allowlist. */
|
|
2
|
+
export type SavedProviderId = 'cloudflare' | 'vercel' | 'fly' | 'railway' | 'render' | 'google-cloud-run';
|
|
3
|
+
export type SavedResourceKind = 'workers' | 'pages' | 'projects' | 'deployments' | 'apps' | 'services' | 'identity';
|
|
4
|
+
export interface SavedProviderInput {
|
|
5
|
+
providerId: SavedProviderId;
|
|
6
|
+
resourceKind: SavedResourceKind;
|
|
7
|
+
credential: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
accountScope?: string;
|
|
10
|
+
projectId?: string;
|
|
11
|
+
region?: string;
|
|
12
|
+
}
|
|
13
|
+
export type ValidatedProviderInput = Required<SavedProviderInput>;
|
|
14
|
+
export interface ProviderInventory {
|
|
15
|
+
providerId: SavedProviderId;
|
|
16
|
+
resourceKind: SavedResourceKind;
|
|
17
|
+
resources: Array<{
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}>;
|
|
21
|
+
complete: false;
|
|
22
|
+
checkedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function validateSavedProviderInput(value: unknown): ValidatedProviderInput;
|
|
25
|
+
/** A read proves only current access to this exact API page, not free quota. */
|
|
26
|
+
export declare function readProviderInventory(input: ValidatedProviderInput, transport?: typeof fetch): Promise<ProviderInventory>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SavedProviderInput, ProviderInventory } from './saved-account-probe.js';
|
|
2
|
+
type Result = {
|
|
3
|
+
rows: Array<Record<string, any>>;
|
|
4
|
+
};
|
|
5
|
+
export type ProviderAccountQuery = (sql: string, params?: unknown[]) => Promise<Result>;
|
|
6
|
+
export interface PublicSavedProviderAccount {
|
|
7
|
+
id: string;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
providerId: string;
|
|
10
|
+
resourceKind: string;
|
|
11
|
+
accountScope: string;
|
|
12
|
+
projectId: string;
|
|
13
|
+
region: string;
|
|
14
|
+
label: string;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
checkedAt: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function saveVerifiedProviderAccount(ownerUserId: string, workspaceId: string, input: SavedProviderInput, options?: {
|
|
20
|
+
query?: ProviderAccountQuery;
|
|
21
|
+
transport?: typeof fetch;
|
|
22
|
+
}): Promise<PublicSavedProviderAccount>;
|
|
23
|
+
export declare function listSavedProviderAccounts(ownerUserId: string, workspaceId: string, query?: ProviderAccountQuery): Promise<PublicSavedProviderAccount[]>;
|
|
24
|
+
export declare function readSavedProviderAccount(ownerUserId: string, workspaceId: string, id: string, options?: {
|
|
25
|
+
query?: ProviderAccountQuery;
|
|
26
|
+
transport?: typeof fetch;
|
|
27
|
+
}): Promise<ProviderInventory>;
|
|
28
|
+
export declare function revokeSavedProviderAccount(ownerUserId: string, workspaceId: string, id: string, query?: ProviderAccountQuery): Promise<boolean>;
|
|
29
|
+
export {};
|
|
@@ -12,15 +12,16 @@ import {
|
|
|
12
12
|
parseGraphJsonFile,
|
|
13
13
|
validateGraphDocument,
|
|
14
14
|
workspaceGraphService
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-NRW4TECO.js";
|
|
16
16
|
import "../chunk-AUNIGE6Q.js";
|
|
17
17
|
import "../chunk-TRJVVNO7.js";
|
|
18
18
|
import "../chunk-HUY4272L.js";
|
|
19
19
|
import "../chunk-5Y7K7HAT.js";
|
|
20
20
|
import "../chunk-LMY6MGFD.js";
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-F7BO3GLA.js";
|
|
22
|
+
import "../chunk-3SDRLTD6.js";
|
|
23
|
+
import "../chunk-PAU25K7F.js";
|
|
24
|
+
import "../chunk-7HD7OEUY.js";
|
|
24
25
|
import "../chunk-3RTRATDJ.js";
|
|
25
26
|
import "../chunk-I6T64MLT.js";
|
|
26
27
|
import "../chunk-IP6XWQU2.js";
|
|
@@ -15,8 +15,9 @@ import {
|
|
|
15
15
|
getPrimarySrklDeploymentUrl,
|
|
16
16
|
getSrklAccounts,
|
|
17
17
|
srklListBackblazeBuckets
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
} from "../chunk-IXEKOWY4.js";
|
|
19
|
+
import "../chunk-PAU25K7F.js";
|
|
20
|
+
import "../chunk-7HD7OEUY.js";
|
|
20
21
|
import "../chunk-3RTRATDJ.js";
|
|
21
22
|
import "../chunk-I6T64MLT.js";
|
|
22
23
|
import "../chunk-IP6XWQU2.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
WorkspaceFS,
|
|
6
6
|
remoteWorkspaceService,
|
|
7
7
|
workingWorkspaceService
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-VN2NR3KT.js";
|
|
9
9
|
import "../chunk-TRJVVNO7.js";
|
|
10
10
|
import "../chunk-LC6ULEM2.js";
|
|
11
11
|
import "../chunk-5Y7K7HAT.js";
|
|
@@ -17,9 +17,10 @@ import {
|
|
|
17
17
|
formatCanonicalWorkspaceFolderName,
|
|
18
18
|
sanitizeWorkspaceName
|
|
19
19
|
} from "../chunk-FZKBTF34.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-F7BO3GLA.js";
|
|
21
|
+
import "../chunk-3SDRLTD6.js";
|
|
22
|
+
import "../chunk-PAU25K7F.js";
|
|
23
|
+
import "../chunk-7HD7OEUY.js";
|
|
23
24
|
import "../chunk-3RTRATDJ.js";
|
|
24
25
|
import "../chunk-I6T64MLT.js";
|
|
25
26
|
import "../chunk-IP6XWQU2.js";
|
package/packages/backend/dist/{workspaceFileCore-XPT6WTFY.js → workspaceFileCore-2KCVSECY.js}
RENAMED
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
normalizeWorkspaceStoragePath,
|
|
10
10
|
readWorkspaceFile,
|
|
11
11
|
writeWorkspaceFile
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-3SDRLTD6.js";
|
|
13
|
+
import "./chunk-PAU25K7F.js";
|
|
14
|
+
import "./chunk-7HD7OEUY.js";
|
|
14
15
|
import "./chunk-3RTRATDJ.js";
|
|
15
16
|
import "./chunk-I6T64MLT.js";
|
|
16
17
|
import "./chunk-IP6XWQU2.js";
|
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '@dinilmusick/gutts/auth';
|
|
3
|
-
export { ApplicationAuthClient, ApplicationAuthClientConfig, LuthAuthClient as CanonicalAuthClient, DEFAULT_LUTH_URL, DeploymentEnvironment, EmailSignInCredentials, EmailSignUpData, GoogleSignInOptions, LuthAuthClient, LuthAuthClientConfig, LuthAuthError, LuthAuthTokenStore, LuthSession, LuthSessionResult, LuthUser, RegisterApplicationResult, createApplicationAuthClient, createLuthAuthClient as createCanonicalAuthClient, createLuthAuthClient, hydrateLuthTokenFromUrl, resolveClientEnvironment, resolveClientOrigin } from '@dinilmusick/gutts/auth';
|
|
1
|
+
export { DEFAULT_LUTH_URL } from '@dinilmusick/gutts/auth';
|
|
4
2
|
|
|
5
3
|
interface LuthPrincipal {
|
|
6
4
|
id: string;
|
|
7
5
|
email: string;
|
|
8
6
|
name: string;
|
|
9
|
-
role:
|
|
7
|
+
role: 'user';
|
|
10
8
|
}
|
|
11
9
|
declare const CANONICAL_PUBLIC_ROUTES: (string | RegExp)[];
|
|
10
|
+
/** Never interpret a cookie, API key, user ID or Origin as a Luth token. */
|
|
12
11
|
declare function extractLuthToken(request: Request): string;
|
|
13
|
-
declare function isPublicRoute(
|
|
12
|
+
declare function isPublicRoute(path: string, extraPublicRoutes?: (string | RegExp)[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Verify the official OAuth Provider token on every protected request.
|
|
15
|
+
* Never forward an application cookie; never cache identity across revocation.
|
|
16
|
+
*/
|
|
14
17
|
declare function verifyLuthRequest(request: Request, options?: {
|
|
15
18
|
luthUrl?: string;
|
|
16
19
|
extraPublicRoutes?: (string | RegExp)[];
|
|
17
20
|
}): Promise<LuthPrincipal | Response | null>;
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
id: string;
|
|
21
|
-
url: string;
|
|
22
|
-
label?: string;
|
|
23
|
-
environment?: DeploymentEnvironment;
|
|
24
|
-
isActive: boolean;
|
|
25
|
-
isPrimary?: boolean;
|
|
26
|
-
priority?: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Creates an authenticated fetch function that automatically injects Luth bearer headers and credentials: 'include'. */
|
|
30
|
-
declare function createUniversalAuthFetch(authClient: {
|
|
31
|
-
getAuthHeaders: () => HeadersInit;
|
|
32
|
-
}): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
33
|
-
|
|
34
|
-
export { CANONICAL_PUBLIC_ROUTES, type LuthDeploymentRecord, type LuthPrincipal, createUniversalAuthFetch, extractLuthToken, isPublicRoute, verifyLuthRequest };
|
|
22
|
+
export { CANONICAL_PUBLIC_ROUTES, type LuthPrincipal, extractLuthToken, isPublicRoute, verifyLuthRequest };
|
|
@@ -1,36 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ApplicationAuthClient,
|
|
3
2
|
CANONICAL_PUBLIC_ROUTES,
|
|
4
3
|
DEFAULT_LUTH_URL,
|
|
5
|
-
LuthAuthClient,
|
|
6
|
-
LuthAuthClient2,
|
|
7
|
-
LuthAuthError,
|
|
8
|
-
createApplicationAuthClient,
|
|
9
|
-
createLuthAuthClient,
|
|
10
|
-
createLuthAuthClient2,
|
|
11
|
-
createUniversalAuthFetch,
|
|
12
4
|
extractLuthToken,
|
|
13
|
-
hydrateLuthTokenFromUrl,
|
|
14
5
|
isPublicRoute,
|
|
15
|
-
resolveClientEnvironment,
|
|
16
|
-
resolveClientOrigin,
|
|
17
6
|
verifyLuthRequest
|
|
18
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QGZHKLOK.js";
|
|
19
8
|
export {
|
|
20
|
-
ApplicationAuthClient,
|
|
21
9
|
CANONICAL_PUBLIC_ROUTES,
|
|
22
|
-
LuthAuthClient2 as CanonicalAuthClient,
|
|
23
10
|
DEFAULT_LUTH_URL,
|
|
24
|
-
LuthAuthClient,
|
|
25
|
-
LuthAuthError,
|
|
26
|
-
createApplicationAuthClient,
|
|
27
|
-
createLuthAuthClient2 as createCanonicalAuthClient,
|
|
28
|
-
createLuthAuthClient,
|
|
29
|
-
createUniversalAuthFetch,
|
|
30
11
|
extractLuthToken,
|
|
31
|
-
hydrateLuthTokenFromUrl,
|
|
32
12
|
isPublicRoute,
|
|
33
|
-
resolveClientEnvironment,
|
|
34
|
-
resolveClientOrigin,
|
|
35
13
|
verifyLuthRequest
|
|
36
14
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/auth.ts
|
|
2
|
+
import { DEFAULT_LUTH_URL as DEFAULT_LUTH_URL2 } from "@dinilmusick/gutts/auth";
|
|
3
|
+
|
|
4
|
+
// src/UniversalLuthGuard.ts
|
|
5
|
+
import { DEFAULT_LUTH_URL } from "@dinilmusick/gutts/auth";
|
|
6
|
+
var CANONICAL_PUBLIC_ROUTES = [
|
|
7
|
+
"/health",
|
|
8
|
+
"/api/health",
|
|
9
|
+
"/api/status",
|
|
10
|
+
"/api/auth/oidc/start",
|
|
11
|
+
"/api/auth/oidc/callback",
|
|
12
|
+
"/api/auth/oidc/session",
|
|
13
|
+
"/api/auth/oidc/logout",
|
|
14
|
+
/^\/api(\/v1)?\/database\/status$/,
|
|
15
|
+
/^\/api(\/v1)?\/guest(\/.*)?$/,
|
|
16
|
+
/^\/api(\/v1)?\/spec(\/.*)?$/
|
|
17
|
+
];
|
|
18
|
+
function extractLuthToken(request) {
|
|
19
|
+
const authorization = request.headers.get("authorization") || "";
|
|
20
|
+
const match = /^Bearer ([A-Za-z0-9._~-]{16,2048})$/i.exec(authorization.trim());
|
|
21
|
+
return match?.[1] || "";
|
|
22
|
+
}
|
|
23
|
+
function isPublicRoute(path, extraPublicRoutes = []) {
|
|
24
|
+
return [...CANONICAL_PUBLIC_ROUTES, ...extraPublicRoutes].some((route) => typeof route === "string" ? route === path : route.test(path));
|
|
25
|
+
}
|
|
26
|
+
function deny(request, unavailable = false) {
|
|
27
|
+
const mcp = new URL(request.url).pathname.includes("/mcp");
|
|
28
|
+
const status = unavailable ? 503 : 401;
|
|
29
|
+
const message = unavailable ? "Luth OAuth provider unavailable." : "Valid OAuth 2.1 Bearer token required.";
|
|
30
|
+
return Response.json(mcp ? {
|
|
31
|
+
jsonrpc: "2.0",
|
|
32
|
+
id: null,
|
|
33
|
+
error: { code: unavailable ? -32603 : -32001, message }
|
|
34
|
+
} : { success: false, error: message }, {
|
|
35
|
+
status,
|
|
36
|
+
headers: { "cache-control": "no-store" }
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function verifyLuthRequest(request, options) {
|
|
40
|
+
const path = new URL(request.url).pathname;
|
|
41
|
+
if (request.method === "OPTIONS" || isPublicRoute(path, options?.extraPublicRoutes)) return null;
|
|
42
|
+
const token = extractLuthToken(request);
|
|
43
|
+
if (!token) return deny(request);
|
|
44
|
+
try {
|
|
45
|
+
const issuer = new URL(options?.luthUrl || DEFAULT_LUTH_URL);
|
|
46
|
+
if (issuer.protocol !== "https:") return deny(request, true);
|
|
47
|
+
const response = await fetch(new URL("/api/auth/oauth2/userinfo", issuer.origin), {
|
|
48
|
+
method: "GET",
|
|
49
|
+
credentials: "omit",
|
|
50
|
+
cache: "no-store",
|
|
51
|
+
redirect: "error",
|
|
52
|
+
headers: { authorization: "Bearer " + token, accept: "application/json" }
|
|
53
|
+
});
|
|
54
|
+
if (response.status === 401 || response.status === 403) return deny(request);
|
|
55
|
+
if (!response.ok) return deny(request, true);
|
|
56
|
+
const body = await response.json();
|
|
57
|
+
if (typeof body.sub !== "string" || !body.sub || typeof body.email !== "string" || !body.email) return deny(request);
|
|
58
|
+
return {
|
|
59
|
+
id: body.sub,
|
|
60
|
+
email: body.email,
|
|
61
|
+
name: typeof body.name === "string" && body.name ? body.name : body.email,
|
|
62
|
+
role: "user"
|
|
63
|
+
};
|
|
64
|
+
} catch {
|
|
65
|
+
return deny(request, true);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
CANONICAL_PUBLIC_ROUTES,
|
|
71
|
+
extractLuthToken,
|
|
72
|
+
isPublicRoute,
|
|
73
|
+
verifyLuthRequest,
|
|
74
|
+
DEFAULT_LUTH_URL2 as DEFAULT_LUTH_URL
|
|
75
|
+
};
|