@ultrst-armada/kloks 2.2.6 → 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-5SKQBVYU.js → chunk-AMI5MY6E.js} +2 -2
- package/packages/backend/dist/{chunk-4LRMJIJ4.js → chunk-FFQJ4USX.js} +1 -1
- package/packages/backend/dist/chunk-G6FLQJS6.js +496 -0
- package/packages/backend/dist/{chunk-4NTZRTRY.js → chunk-GIUAFRAA.js} +1 -1
- package/packages/backend/dist/{chunk-OJCSPAFE.js → chunk-GZTZ376X.js} +1 -1
- package/packages/backend/dist/{chunk-4BCTI7BL.js → chunk-LAKCKX3I.js} +1 -1
- package/packages/backend/dist/{chunk-YTJTF7LS.js → chunk-LPM5E2A2.js} +2 -2
- package/packages/backend/dist/{chunk-5S5CDQXD.js → chunk-MQ6AHJ6X.js} +2 -2
- package/packages/backend/dist/{chunk-SEKPSCWP.js → chunk-NR7OXPB3.js} +69 -21
- package/packages/backend/dist/{chunk-2DVRZKOK.js → chunk-QZDTABQX.js} +2 -2
- package/packages/backend/dist/{chunk-3V5B2BOP.js → chunk-RHW75K46.js} +1 -1
- package/packages/backend/dist/{chunk-FGZA6PDX.js → chunk-U5VPYALB.js} +4 -4
- package/packages/backend/dist/chunk-UI7AYFAU.js +364 -0
- package/packages/backend/dist/{client-S4R4MZ6K.js → client-R5FY5AP7.js} +2 -2
- package/packages/backend/dist/index.js +38 -12
- package/packages/backend/dist/krnl-services.js +2 -2
- package/packages/backend/dist/node.js +33 -33
- package/packages/backend/dist/provider-services/compute-routing.d.ts +65 -0
- package/packages/backend/dist/provider-services/compute-routing.test.d.ts +1 -0
- package/packages/backend/dist/provider-services/fly-machines.d.ts +52 -0
- package/packages/backend/dist/provider-services/fly-machines.test.d.ts +1 -0
- package/packages/backend/dist/provider-services/free-compute.d.ts +5 -0
- package/packages/backend/dist/provider-services/free-compute.test.d.ts +1 -0
- package/packages/backend/dist/provider-services/google/cloud-run.js +1 -1
- package/packages/backend/dist/provider-services/google/cloud-shell.js +1 -1
- package/packages/backend/dist/provider-services/google/cloud-storage.js +1 -1
- package/packages/backend/dist/provider-services/google/drive.js +1 -1
- package/packages/backend/dist/provider-services/google/gemini.js +3 -3
- package/packages/backend/dist/provider-services/google/index.js +3 -3
- package/packages/backend/dist/provider-services/google/vertex-ai.js +1 -1
- package/packages/backend/dist/provider-services/index.d.ts +3 -0
- package/packages/backend/dist/provider-services/index.js +39 -13
- package/packages/backend/dist/provider-services/node.js +11 -11
- package/packages/backend/dist/provider-services/storage/dropbox.js +4 -4
- package/packages/backend/dist/provider-services/storage/github.js +4 -4
- package/packages/backend/dist/provider-services/storage/node.js +7 -7
- package/packages/backend/dist/provider-services/storage.js +6 -6
- package/packages/backend/dist/provider-services/types.d.ts +16 -2
- package/packages/state-graph/dist/browser.js +25 -25
- package/packages/state-graph/dist/index.js +25 -25
- package/packages/state-graph/dist/spatial/index.js +1 -1
- package/packages/backend/dist/chunk-FFYTCLFC.js +0 -93
- package/packages/backend/dist/chunk-LN274IE5.js +0 -414
- package/packages/backend/dist/{chunk-5CZUAEAD.js → chunk-R4B3KPHY.js} +5 -5
- package/packages/state-graph/dist/{chunk-YUJC367F.js → chunk-7N2LLBUW.js} +7 -7
|
@@ -8,22 +8,22 @@ import {
|
|
|
8
8
|
GoogleAccountProviderService,
|
|
9
9
|
GoogleDriveProviderService,
|
|
10
10
|
VercelProviderService
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-U5VPYALB.js";
|
|
12
12
|
import {
|
|
13
13
|
CanonicalStorageProviderService
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-GZTZ376X.js";
|
|
15
|
+
import "../chunk-RHW75K46.js";
|
|
16
|
+
import "../chunk-GIUAFRAA.js";
|
|
17
|
+
import "../chunk-LAKCKX3I.js";
|
|
18
|
+
import "../chunk-LPM5E2A2.js";
|
|
19
19
|
import "../chunk-O25T5KCE.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-QZDTABQX.js";
|
|
21
|
+
import "../chunk-FFQJ4USX.js";
|
|
22
|
+
import "../chunk-AMI5MY6E.js";
|
|
23
23
|
import "../chunk-CTBVXX5C.js";
|
|
24
24
|
import "../chunk-HJE4CVKY.js";
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-MQ6AHJ6X.js";
|
|
26
|
+
import "../chunk-G6FLQJS6.js";
|
|
27
27
|
import "../chunk-I6T64MLT.js";
|
|
28
28
|
import "../chunk-EMSSTOOK.js";
|
|
29
29
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDropboxStorageService
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-QZDTABQX.js";
|
|
4
|
+
import "../../chunk-AMI5MY6E.js";
|
|
5
5
|
import "../../chunk-HJE4CVKY.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-MQ6AHJ6X.js";
|
|
7
|
+
import "../../chunk-G6FLQJS6.js";
|
|
8
8
|
import "../../chunk-I6T64MLT.js";
|
|
9
9
|
import "../../chunk-EMSSTOOK.js";
|
|
10
10
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createGitHubStorageService
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-FFQJ4USX.js";
|
|
4
|
+
import "../../chunk-AMI5MY6E.js";
|
|
5
5
|
import "../../chunk-HJE4CVKY.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-MQ6AHJ6X.js";
|
|
7
|
+
import "../../chunk-G6FLQJS6.js";
|
|
8
8
|
import "../../chunk-I6T64MLT.js";
|
|
9
9
|
import "../../chunk-EMSSTOOK.js";
|
|
10
10
|
export {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CanonicalStorageProviderService
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-GZTZ376X.js";
|
|
4
|
+
import "../../chunk-LPM5E2A2.js";
|
|
5
5
|
import "../../chunk-O25T5KCE.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-QZDTABQX.js";
|
|
7
|
+
import "../../chunk-FFQJ4USX.js";
|
|
8
|
+
import "../../chunk-AMI5MY6E.js";
|
|
9
9
|
import "../../chunk-CTBVXX5C.js";
|
|
10
10
|
import "../../chunk-HJE4CVKY.js";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-MQ6AHJ6X.js";
|
|
12
|
+
import "../../chunk-G6FLQJS6.js";
|
|
13
13
|
import "../../chunk-I6T64MLT.js";
|
|
14
14
|
import "../../chunk-EMSSTOOK.js";
|
|
15
15
|
export {
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createCanonicalStorageService,
|
|
3
3
|
getCanonicalStorageCapabilities,
|
|
4
4
|
listCanonicalStorageProviders
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-LPM5E2A2.js";
|
|
6
6
|
import "../chunk-O25T5KCE.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-QZDTABQX.js";
|
|
8
|
+
import "../chunk-FFQJ4USX.js";
|
|
9
|
+
import "../chunk-AMI5MY6E.js";
|
|
10
10
|
import "../chunk-CTBVXX5C.js";
|
|
11
11
|
import {
|
|
12
12
|
UnsupportedStorageOperation,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
normalizeStoragePath,
|
|
15
15
|
readOnlyService
|
|
16
16
|
} from "../chunk-HJE4CVKY.js";
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-MQ6AHJ6X.js";
|
|
18
|
+
import "../chunk-G6FLQJS6.js";
|
|
19
19
|
import "../chunk-I6T64MLT.js";
|
|
20
20
|
import "../chunk-EMSSTOOK.js";
|
|
21
21
|
export {
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
/** Canonical provider/service identity and quota contracts. No secrets are persisted here. */
|
|
2
2
|
export type ProviderCategory = 'suite' | 'deployment' | 'cloud' | 'ai' | 'storage' | 'developer';
|
|
3
3
|
export type ProviderStatus = 'ready' | 'catalogued' | 'excluded';
|
|
4
|
-
export type CredentialMode = 'api-token' | 'api-key' | 'oauth2' | 'application-key';
|
|
5
|
-
export type RenewalPolicy = 'daily' | 'monthly' | 'ongoing' | 'unknown' | 'trial';
|
|
4
|
+
export type CredentialMode = 'api-token' | 'api-key' | 'aws-sigv4' | 'oauth2' | 'application-key';
|
|
5
|
+
export type RenewalPolicy = 'daily' | 'weekly' | 'monthly' | 'ongoing' | 'unknown' | 'trial';
|
|
6
|
+
export interface FreeComputeOffer {
|
|
7
|
+
providerId: string;
|
|
8
|
+
allowance: string;
|
|
9
|
+
renewal: RenewalPolicy;
|
|
10
|
+
quotaScope: 'account' | 'workspace' | 'organization' | 'project' | 'billing-account' | 'subscription' | 'namespace';
|
|
11
|
+
workload: 'vm' | 'container' | 'function' | 'gpu' | 'sandbox' | 'ci' | 'notebook' | 'browser' | 'developer';
|
|
12
|
+
access: 'general' | 'restricted';
|
|
13
|
+
sourceUrl: string;
|
|
14
|
+
notes: string;
|
|
15
|
+
verifiedDate: string;
|
|
16
|
+
/** Catalogued allowance is NEVER proof of available account capacity. */
|
|
17
|
+
allocationEnabled: false;
|
|
18
|
+
}
|
|
6
19
|
export interface ProviderDefinition {
|
|
7
20
|
/** A suite groups related service adapters and can expose its own identity API. */
|
|
8
21
|
kind?: 'suite' | 'service';
|
|
9
22
|
id: string;
|
|
10
23
|
name: string;
|
|
24
|
+
freeCompute?: FreeComputeOffer;
|
|
11
25
|
category: ProviderCategory;
|
|
12
26
|
status: ProviderStatus;
|
|
13
27
|
parentId?: string;
|
|
@@ -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,22 +261,15 @@ import {
|
|
|
261
261
|
ViewHandle,
|
|
262
262
|
instantiateSubgraph
|
|
263
263
|
} from "./chunk-OXUDG6HE.js";
|
|
264
|
-
import "./chunk-RHRXPY2U.js";
|
|
265
|
-
import {
|
|
266
|
-
AttractionEngine,
|
|
267
|
-
GhostInferenceEngine,
|
|
268
|
-
GhostLayoutResolver,
|
|
269
|
-
GhostTracePathBuilder,
|
|
270
|
-
calculateSocketCoordinates,
|
|
271
|
-
getBeamPoints,
|
|
272
|
-
useMagneticTraces
|
|
273
|
-
} from "./chunk-JXDJZSFW.js";
|
|
274
264
|
import {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
265
|
+
LifecycleCycleError,
|
|
266
|
+
LifecycleGraph,
|
|
267
|
+
SKIPO_STATE,
|
|
268
|
+
SkipoStateEngine,
|
|
269
|
+
useLifecycleScope,
|
|
270
|
+
useSkipoBind,
|
|
271
|
+
useSkipoState
|
|
272
|
+
} from "./chunk-EW4ACSZB.js";
|
|
280
273
|
import {
|
|
281
274
|
CommandApi,
|
|
282
275
|
GhostStore,
|
|
@@ -291,6 +284,16 @@ import {
|
|
|
291
284
|
CustomViewWindow,
|
|
292
285
|
DEFAULT_GRAPH_SETTINGS
|
|
293
286
|
} from "./chunk-5KP74NMF.js";
|
|
287
|
+
import "./chunk-RHRXPY2U.js";
|
|
288
|
+
import {
|
|
289
|
+
AttractionEngine,
|
|
290
|
+
GhostInferenceEngine,
|
|
291
|
+
GhostLayoutResolver,
|
|
292
|
+
GhostTracePathBuilder,
|
|
293
|
+
calculateSocketCoordinates,
|
|
294
|
+
getBeamPoints,
|
|
295
|
+
useMagneticTraces
|
|
296
|
+
} from "./chunk-JXDJZSFW.js";
|
|
294
297
|
import {
|
|
295
298
|
AutoSolidify,
|
|
296
299
|
SpatialEngine,
|
|
@@ -301,18 +304,15 @@ import {
|
|
|
301
304
|
SolidConnection,
|
|
302
305
|
ViewLink
|
|
303
306
|
} from "./chunk-OYN4ZEZC.js";
|
|
307
|
+
import {
|
|
308
|
+
ConnectionRuleStore,
|
|
309
|
+
HandleTypeRegistry,
|
|
310
|
+
WireTypeRegistry,
|
|
311
|
+
initializeDefaultGraphRules
|
|
312
|
+
} from "./chunk-TZOL3RN7.js";
|
|
304
313
|
import {
|
|
305
314
|
CompatibilityMatrix
|
|
306
315
|
} from "./chunk-ISFNY7EZ.js";
|
|
307
|
-
import {
|
|
308
|
-
LifecycleCycleError,
|
|
309
|
-
LifecycleGraph,
|
|
310
|
-
SKIPO_STATE,
|
|
311
|
-
SkipoStateEngine,
|
|
312
|
-
useLifecycleScope,
|
|
313
|
-
useSkipoBind,
|
|
314
|
-
useSkipoState
|
|
315
|
-
} from "./chunk-EW4ACSZB.js";
|
|
316
316
|
export {
|
|
317
317
|
ALL_GRAPH_TYPES,
|
|
318
318
|
ArrangementNodeModel,
|
|
@@ -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,22 +261,15 @@ import {
|
|
|
261
261
|
ViewHandle,
|
|
262
262
|
instantiateSubgraph
|
|
263
263
|
} from "./chunk-OXUDG6HE.js";
|
|
264
|
-
import "./chunk-RHRXPY2U.js";
|
|
265
|
-
import {
|
|
266
|
-
AttractionEngine,
|
|
267
|
-
GhostInferenceEngine,
|
|
268
|
-
GhostLayoutResolver,
|
|
269
|
-
GhostTracePathBuilder,
|
|
270
|
-
calculateSocketCoordinates,
|
|
271
|
-
getBeamPoints,
|
|
272
|
-
useMagneticTraces
|
|
273
|
-
} from "./chunk-JXDJZSFW.js";
|
|
274
264
|
import {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
265
|
+
LifecycleCycleError,
|
|
266
|
+
LifecycleGraph,
|
|
267
|
+
SKIPO_STATE,
|
|
268
|
+
SkipoStateEngine,
|
|
269
|
+
useLifecycleScope,
|
|
270
|
+
useSkipoBind,
|
|
271
|
+
useSkipoState
|
|
272
|
+
} from "./chunk-EW4ACSZB.js";
|
|
280
273
|
import {
|
|
281
274
|
CommandApi,
|
|
282
275
|
GhostStore,
|
|
@@ -291,6 +284,16 @@ import {
|
|
|
291
284
|
CustomViewWindow,
|
|
292
285
|
DEFAULT_GRAPH_SETTINGS
|
|
293
286
|
} from "./chunk-5KP74NMF.js";
|
|
287
|
+
import "./chunk-RHRXPY2U.js";
|
|
288
|
+
import {
|
|
289
|
+
AttractionEngine,
|
|
290
|
+
GhostInferenceEngine,
|
|
291
|
+
GhostLayoutResolver,
|
|
292
|
+
GhostTracePathBuilder,
|
|
293
|
+
calculateSocketCoordinates,
|
|
294
|
+
getBeamPoints,
|
|
295
|
+
useMagneticTraces
|
|
296
|
+
} from "./chunk-JXDJZSFW.js";
|
|
294
297
|
import {
|
|
295
298
|
AutoSolidify,
|
|
296
299
|
SpatialEngine,
|
|
@@ -301,18 +304,15 @@ import {
|
|
|
301
304
|
SolidConnection,
|
|
302
305
|
ViewLink
|
|
303
306
|
} from "./chunk-OYN4ZEZC.js";
|
|
307
|
+
import {
|
|
308
|
+
ConnectionRuleStore,
|
|
309
|
+
HandleTypeRegistry,
|
|
310
|
+
WireTypeRegistry,
|
|
311
|
+
initializeDefaultGraphRules
|
|
312
|
+
} from "./chunk-TZOL3RN7.js";
|
|
304
313
|
import {
|
|
305
314
|
CompatibilityMatrix
|
|
306
315
|
} from "./chunk-ISFNY7EZ.js";
|
|
307
|
-
import {
|
|
308
|
-
LifecycleCycleError,
|
|
309
|
-
LifecycleGraph,
|
|
310
|
-
SKIPO_STATE,
|
|
311
|
-
SkipoStateEngine,
|
|
312
|
-
useLifecycleScope,
|
|
313
|
-
useSkipoBind,
|
|
314
|
-
useSkipoState
|
|
315
|
-
} from "./chunk-EW4ACSZB.js";
|
|
316
316
|
|
|
317
317
|
// src/index.ts
|
|
318
318
|
import {
|
|
@@ -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,
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createProviderClient
|
|
3
|
-
} from "./chunk-5S5CDQXD.js";
|
|
4
|
-
|
|
5
|
-
// src/provider-services/capacity.ts
|
|
6
|
-
function calculateProviderCapacity(snapshot, now = /* @__PURE__ */ new Date(), maxAgeMs = 10 * 6e4) {
|
|
7
|
-
const checkedAt = now.toISOString();
|
|
8
|
-
const unknown = (reason) => ({ status: "unknown", weight: 0, percentRemaining: null, bottleneck: null, reason, checkedAt });
|
|
9
|
-
const timestamp = Date.parse(snapshot.capturedAt);
|
|
10
|
-
if (!Number.isFinite(timestamp) || now.getTime() < timestamp - 3e4 || now.getTime() - timestamp > maxAgeMs) return unknown("Telemetry is stale or undated");
|
|
11
|
-
if (snapshot.error || snapshot.coverage === "unavailable") {
|
|
12
|
-
return unknown(snapshot.error || "Provider quota telemetry unavailable");
|
|
13
|
-
}
|
|
14
|
-
const enforced = snapshot.metrics.filter((m) => m.enforceable);
|
|
15
|
-
if (!enforced.length) return unknown("No provider-confirmed renewable quota windows");
|
|
16
|
-
if (snapshot.coverage !== "complete") return unknown("Required quota coverage is incomplete");
|
|
17
|
-
let bottleneck = null;
|
|
18
|
-
let minimum = 1;
|
|
19
|
-
for (const metric of enforced) {
|
|
20
|
-
if (metric.source !== "provider" || !validQuota(metric) || !metric.resetAt || Date.parse(metric.resetAt) <= now.getTime()) {
|
|
21
|
-
return unknown("Quota metric missing, estimated, or outside its reset window: " + metric.id);
|
|
22
|
-
}
|
|
23
|
-
const remaining = Math.max(0, Math.min(1, (metric.limit - metric.used) / metric.limit));
|
|
24
|
-
if (!bottleneck || remaining < minimum) {
|
|
25
|
-
minimum = remaining;
|
|
26
|
-
bottleneck = metric;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const status = minimum === 0 ? "exhausted" : "eligible";
|
|
30
|
-
return {
|
|
31
|
-
status,
|
|
32
|
-
weight: status === "eligible" ? Number(minimum.toFixed(4)) : 0,
|
|
33
|
-
percentRemaining: Math.round(minimum * 100),
|
|
34
|
-
bottleneck: bottleneck?.id ?? null,
|
|
35
|
-
reason: status === "eligible" ? "Provider-measured quota remaining" : "A required quota is exhausted",
|
|
36
|
-
checkedAt
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function validQuota(metric) {
|
|
40
|
-
return metric.used !== null && metric.limit !== null && Number.isFinite(metric.used) && Number.isFinite(metric.limit) && metric.used >= 0 && metric.limit > 0 && typeof metric.resetAt === "string" && Number.isFinite(Date.parse(metric.resetAt));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// src/provider-services/compute-operations.ts
|
|
44
|
-
function connectionFor(input, expected) {
|
|
45
|
-
if (input.providerId !== expected) throw new Error("Credential/provider mismatch");
|
|
46
|
-
return input;
|
|
47
|
-
}
|
|
48
|
-
function requiredProject(input, name, pattern) {
|
|
49
|
-
if (!pattern.test(input)) throw new Error("Invalid " + name);
|
|
50
|
-
return input;
|
|
51
|
-
}
|
|
52
|
-
async function getRailwayAccount(connection, transport = fetch) {
|
|
53
|
-
const client = createProviderClient(connectionFor(connection, "railway"), transport);
|
|
54
|
-
const { data } = await client.request({
|
|
55
|
-
path: "/graphql/v2",
|
|
56
|
-
method: "POST",
|
|
57
|
-
body: { query: "query FrnesIdentity { me { name email } }" }
|
|
58
|
-
});
|
|
59
|
-
if (data.errors?.length || !data.data?.me || typeof data.data.me !== "object" || !(typeof data.data.me.email === "string" && data.data.me.email.trim() || typeof data.data.me.name === "string" && data.data.me.name.trim()))
|
|
60
|
-
throw new Error("Railway account token could not be authorized");
|
|
61
|
-
return data.data.me;
|
|
62
|
-
}
|
|
63
|
-
async function listFlyApps(connection, transport = fetch) {
|
|
64
|
-
const client = createProviderClient(connectionFor(connection, "fly"), transport);
|
|
65
|
-
const { data } = await client.request({ path: "/v1/apps" });
|
|
66
|
-
if (!Array.isArray(data?.apps) || data.apps.some((item) => typeof item.name !== "string" || !item.name))
|
|
67
|
-
throw new Error("Invalid Fly Machines app listing");
|
|
68
|
-
return data.apps;
|
|
69
|
-
}
|
|
70
|
-
async function listRenderServices(connection, transport = fetch) {
|
|
71
|
-
const client = createProviderClient(connectionFor(connection, "render"), transport);
|
|
72
|
-
const { data } = await client.request({ path: "/v1/services", query: { limit: 20 } });
|
|
73
|
-
if (!Array.isArray(data) || data.some((item) => typeof item.service?.id !== "string" || !item.service.id || typeof item.service.name !== "string" || !item.service.name))
|
|
74
|
-
throw new Error("Invalid Render services response");
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
async function listGoogleCloudRunServices(connection, project, region, transport = fetch) {
|
|
78
|
-
connectionFor(connection, "google-cloud-run");
|
|
79
|
-
const projectId = requiredProject(project, "Google project ID", /^[a-z][a-z0-9-]{4,61}[a-z0-9]$/);
|
|
80
|
-
const location = requiredProject(region, "Google Cloud location", /^[a-z][a-z0-9-]{1,40}$/);
|
|
81
|
-
const { data } = await createProviderClient(connection, transport).request({ path: `/v2/projects/${projectId}/locations/${location}/services` });
|
|
82
|
-
if (!data || data.services !== void 0 && (!Array.isArray(data.services) || data.services.some((item) => typeof item.name !== "string" || !item.name)))
|
|
83
|
-
throw new Error("Invalid Cloud Run service listing");
|
|
84
|
-
return data.services || [];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
calculateProviderCapacity,
|
|
89
|
-
getRailwayAccount,
|
|
90
|
-
listFlyApps,
|
|
91
|
-
listRenderServices,
|
|
92
|
-
listGoogleCloudRunServices
|
|
93
|
-
};
|