@akashnetwork/chain-sdk 1.0.0-alpha.35 → 1.0.0-alpha.37
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/dist/cjs/generated/createProviderSDK.cjs +10 -1
- package/dist/cjs/generated/createProviderSDK.cjs.map +2 -2
- package/dist/cjs/generated/protos/akash/manifest/v2beta3/service.cjs +85 -3
- package/dist/cjs/generated/protos/akash/manifest/v2beta3/service.cjs.map +2 -2
- package/dist/cjs/generated/protos/akash/provider/lease/v1/service.cjs +276 -0
- package/dist/cjs/generated/protos/akash/provider/lease/v1/service.cjs.map +2 -2
- package/dist/cjs/generated/protos/akash/provider/lease/v1/service_akash.cjs +10 -0
- package/dist/cjs/generated/protos/akash/provider/lease/v1/service_akash.cjs.map +2 -2
- package/dist/cjs/generated/protos/index.provider.akash.v1.cjs +3 -0
- package/dist/cjs/generated/protos/index.provider.akash.v1.cjs.map +2 -2
- package/dist/cjs/generated/protos/index.provider.akash.v2beta3.cjs +2 -1
- package/dist/cjs/generated/protos/index.provider.akash.v2beta3.cjs.map +2 -2
- package/dist/cjs/sdk/transport/runCall.cjs +19 -5
- package/dist/cjs/sdk/transport/runCall.cjs.map +2 -2
- package/dist/cjs/sdl/manifest/generateManifest.cjs +3 -0
- package/dist/cjs/sdl/manifest/generateManifest.cjs.map +2 -2
- package/dist/cjs/sdl/manifest/generateManifestVersion.cjs +1 -1
- package/dist/cjs/sdl/manifest/generateManifestVersion.cjs.map +2 -2
- package/dist/cjs/sdl/validateSDL/validateSDL.cjs +24 -1
- package/dist/cjs/sdl/validateSDL/validateSDL.cjs.map +2 -2
- package/dist/cjs/sdl/validateSDL/validateSDLInput.cjs +67 -46
- package/dist/cjs/sdl/validateSDL/validateSDLInput.cjs.map +2 -2
- package/dist/esm/{chunk-WBBS4OZV.js → chunk-R42YS74B.js} +118 -56
- package/dist/esm/chunk-R42YS74B.js.map +7 -0
- package/dist/esm/{chunk-HBXYMZWF.js → chunk-SQUBF6EZ.js} +279 -3
- package/dist/esm/chunk-SQUBF6EZ.js.map +7 -0
- package/dist/esm/{chunk-COR2HJ6D.js → chunk-UZXCPKLQ.js} +85 -3
- package/dist/esm/chunk-UZXCPKLQ.js.map +7 -0
- package/dist/esm/generated/protos/index.provider.akash.v1.js +8 -2
- package/dist/esm/generated/protos/index.provider.akash.v2beta3.js +5 -3
- package/dist/esm/index.js +13 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.web.js +2 -2
- package/dist/esm/{service_akash-AAROYIZB.js → service_akash-BILCZWQI.js} +15 -3
- package/dist/esm/service_akash-BILCZWQI.js.map +7 -0
- package/dist/sdl-schema.yaml +5 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/generated/createProviderSDK.d.ts +14 -0
- package/dist/types/generated/protos/akash/manifest/v2beta3/service.d.ts +19 -0
- package/dist/types/generated/protos/akash/provider/lease/v1/service.d.ts +43 -0
- package/dist/types/generated/protos/akash/provider/lease/v1/service_akash.d.ts +9 -1
- package/dist/types/generated/protos/index.provider.akash.v1.d.ts +1 -1
- package/dist/types/generated/protos/index.provider.akash.v2beta3.d.ts +1 -1
- package/dist/types/sdl/validateSDL/validateSDLInput.d.ts +5 -0
- package/package.json +1 -1
- package/dist/esm/chunk-COR2HJ6D.js.map +0 -7
- package/dist/esm/chunk-HBXYMZWF.js.map +0 -7
- package/dist/esm/chunk-WBBS4OZV.js.map +0 -7
- package/dist/esm/service_akash-AAROYIZB.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../src/generated/protos/akash/provider/lease/v1/service_akash.ts"],
|
|
4
|
-
"sourcesContent": ["import { SendManifestRequest, SendManifestResponse, ServiceLogsRequest, ServiceLogsResponse, ServiceStatusRequest, ServiceStatusResponse } from \"./service.ts\";\n\nexport const LeaseRPC = {\n typeName: \"akash.provider.lease.v1.LeaseRPC\",\n methods: {\n sendManifest: {\n name: \"SendManifest\",\n input: SendManifestRequest,\n output: SendManifestResponse,\n get parent() { return LeaseRPC; },\n },\n serviceStatus: {\n name: \"ServiceStatus\",\n input: ServiceStatusRequest,\n output: ServiceStatusResponse,\n get parent() { return LeaseRPC; },\n },\n streamServiceStatus: {\n name: \"StreamServiceStatus\",\n kind: \"server_streaming\",\n input: ServiceStatusRequest,\n output: ServiceStatusResponse,\n get parent() { return LeaseRPC; },\n },\n serviceLogs: {\n name: \"ServiceLogs\",\n input: ServiceLogsRequest,\n output: ServiceLogsResponse,\n get parent() { return LeaseRPC; },\n },\n streamServiceLogs: {\n name: \"StreamServiceLogs\",\n kind: \"server_streaming\",\n input: ServiceLogsRequest,\n output: ServiceLogsResponse,\n get parent() { return LeaseRPC; },\n },\n },\n} as const;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { AttestationQuoteRequest, AttestationQuoteResponse, SendManifestRequest, SendManifestResponse, ServiceLogsRequest, ServiceLogsResponse, ServiceStatusRequest, ServiceStatusResponse } from \"./service.ts\";\n\nexport const LeaseRPC = {\n typeName: \"akash.provider.lease.v1.LeaseRPC\",\n methods: {\n sendManifest: {\n name: \"SendManifest\",\n input: SendManifestRequest,\n output: SendManifestResponse,\n get parent() { return LeaseRPC; },\n },\n serviceStatus: {\n name: \"ServiceStatus\",\n input: ServiceStatusRequest,\n output: ServiceStatusResponse,\n get parent() { return LeaseRPC; },\n },\n streamServiceStatus: {\n name: \"StreamServiceStatus\",\n kind: \"server_streaming\",\n input: ServiceStatusRequest,\n output: ServiceStatusResponse,\n get parent() { return LeaseRPC; },\n },\n serviceLogs: {\n name: \"ServiceLogs\",\n input: ServiceLogsRequest,\n output: ServiceLogsResponse,\n get parent() { return LeaseRPC; },\n },\n streamServiceLogs: {\n name: \"StreamServiceLogs\",\n kind: \"server_streaming\",\n input: ServiceLogsRequest,\n output: ServiceLogsResponse,\n get parent() { return LeaseRPC; },\n },\n attestationQuote: {\n name: \"AttestationQuote\",\n httpMethod: \"post\",\n httpPath: \"/v1/lease/attestation/quote\",\n input: AttestationQuoteRequest,\n output: AttestationQuoteResponse,\n get parent() { return LeaseRPC; },\n },\n },\n} as const;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmM;AAE5L,MAAM,WAAW;AAAA,EACtB,UAAU;AAAA,EACV,SAAS;AAAA,IACP,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,IAAI,SAAS;AAAE,eAAO;AAAA,MAAU;AAAA,IAClC;AAAA,IACA,eAAe;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,IAAI,SAAS;AAAE,eAAO;AAAA,MAAU;AAAA,IAClC;AAAA,IACA,qBAAqB;AAAA,MACnB,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,IAAI,SAAS;AAAE,eAAO;AAAA,MAAU;AAAA,IAClC;AAAA,IACA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,IAAI,SAAS;AAAE,eAAO;AAAA,MAAU;AAAA,IAClC;AAAA,IACA,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,IAAI,SAAS;AAAE,eAAO;AAAA,MAAU;AAAA,IAClC;AAAA,IACA,kBAAkB;AAAA,MAChB,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,IAAI,SAAS;AAAE,eAAO;AAAA,MAAU;AAAA,IAClC;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var index_provider_akash_v1_exports = {};
|
|
20
20
|
__export(index_provider_akash_v1_exports, {
|
|
21
|
+
AttestationGPUReport: () => import_service.AttestationGPUReport,
|
|
22
|
+
AttestationQuoteRequest: () => import_service.AttestationQuoteRequest,
|
|
23
|
+
AttestationQuoteResponse: () => import_service.AttestationQuoteResponse,
|
|
21
24
|
BidEngineStatus: () => import_status.BidEngineStatus,
|
|
22
25
|
BidScreeningRequest: () => import_validation.BidScreeningRequest,
|
|
23
26
|
BidScreeningResponse: () => import_validation.BidScreeningResponse,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/generated/protos/index.provider.akash.v1.ts"],
|
|
4
|
-
"sourcesContent": ["export { ResourcePair } from \"./akash/inventory/v1/resourcepair.ts\";\nexport { CPUInfo, CPU } from \"./akash/inventory/v1/cpu.ts\";\nexport { GPUInfo, GPU } from \"./akash/inventory/v1/gpu.ts\";\nexport { MemoryInfo, Memory } from \"./akash/inventory/v1/memory.ts\";\nexport { NodeResources } from \"./akash/inventory/v1/resources.ts\";\nexport { NodeCapabilities, Node } from \"./akash/inventory/v1/node.ts\";\nexport { StorageInfo, Storage } from \"./akash/inventory/v1/storage.ts\";\nexport { Cluster } from \"./akash/inventory/v1/cluster.ts\";\nexport { LeaseServiceStatus, LeaseIPStatus, ForwarderPortStatus, ServiceStatus, SendManifestRequest, SendManifestResponse, ServiceLogsRequest, ServiceLogs, ServiceLogsResponse, ShellRequest, ServiceStatusRequest, ServiceStatusResponse } from \"./akash/provider/lease/v1/service.ts\";\nexport { ResourcesMetric, Leases, ReservationsMetric, Reservations, Inventory, ClusterStatus, BidEngineStatus, ManifestStatus, Status } from \"./akash/provider/v1/status.ts\";\nexport { BidScreeningRequest, BidScreeningResponse } from \"./akash/provider/v1/validation.ts\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,iBAA6B;AAC7B,iBAA6B;AAC7B,oBAAmC;AACnC,uBAA8B;AAC9B,kBAAuC;AACvC,qBAAqC;AACrC,qBAAwB;AACxB,
|
|
4
|
+
"sourcesContent": ["export { ResourcePair } from \"./akash/inventory/v1/resourcepair.ts\";\nexport { CPUInfo, CPU } from \"./akash/inventory/v1/cpu.ts\";\nexport { GPUInfo, GPU } from \"./akash/inventory/v1/gpu.ts\";\nexport { MemoryInfo, Memory } from \"./akash/inventory/v1/memory.ts\";\nexport { NodeResources } from \"./akash/inventory/v1/resources.ts\";\nexport { NodeCapabilities, Node } from \"./akash/inventory/v1/node.ts\";\nexport { StorageInfo, Storage } from \"./akash/inventory/v1/storage.ts\";\nexport { Cluster } from \"./akash/inventory/v1/cluster.ts\";\nexport { LeaseServiceStatus, LeaseIPStatus, ForwarderPortStatus, ServiceStatus, SendManifestRequest, SendManifestResponse, ServiceLogsRequest, ServiceLogs, ServiceLogsResponse, ShellRequest, ServiceStatusRequest, ServiceStatusResponse, AttestationQuoteRequest, AttestationGPUReport, AttestationQuoteResponse } from \"./akash/provider/lease/v1/service.ts\";\nexport { ResourcesMetric, Leases, ReservationsMetric, Reservations, Inventory, ClusterStatus, BidEngineStatus, ManifestStatus, Status } from \"./akash/provider/v1/status.ts\";\nexport { BidScreeningRequest, BidScreeningResponse } from \"./akash/provider/v1/validation.ts\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,iBAA6B;AAC7B,iBAA6B;AAC7B,oBAAmC;AACnC,uBAA8B;AAC9B,kBAAuC;AACvC,qBAAqC;AACrC,qBAAwB;AACxB,qBAA2T;AAC3T,oBAA6I;AAC7I,wBAA0D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,7 +25,8 @@ __export(index_provider_akash_v2beta3_exports, {
|
|
|
25
25
|
ServiceExposeHTTPOptions: () => import_httpoptions.ServiceExposeHTTPOptions,
|
|
26
26
|
ServiceParams: () => import_service.ServiceParams,
|
|
27
27
|
ServicePermissions: () => import_service.ServicePermissions,
|
|
28
|
-
StorageParams: () => import_service.StorageParams
|
|
28
|
+
StorageParams: () => import_service.StorageParams,
|
|
29
|
+
TEEParams: () => import_service.TEEParams
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(index_provider_akash_v2beta3_exports);
|
|
31
32
|
var import_httpoptions = require("./akash/manifest/v2beta3/httpoptions.cjs");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/generated/protos/index.provider.akash.v2beta3.ts"],
|
|
4
|
-
"sourcesContent": ["export { ServiceExposeHTTPOptions } from \"./akash/manifest/v2beta3/httpoptions.ts\";\nexport { ServiceExpose } from \"./akash/manifest/v2beta3/serviceexpose.ts\";\nexport { StorageParams, ServicePermissions, ServiceParams, ImageCredentials, Service } from \"./akash/manifest/v2beta3/service.ts\";\nexport { Group } from \"./akash/manifest/v2beta3/group.ts\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAyC;AACzC,2BAA8B;AAC9B,
|
|
4
|
+
"sourcesContent": ["export { ServiceExposeHTTPOptions } from \"./akash/manifest/v2beta3/httpoptions.ts\";\nexport { ServiceExpose } from \"./akash/manifest/v2beta3/serviceexpose.ts\";\nexport { StorageParams, ServicePermissions, TEEParams, ServiceParams, ImageCredentials, Service } from \"./akash/manifest/v2beta3/service.ts\";\nexport { Group } from \"./akash/manifest/v2beta3/group.ts\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAyC;AACzC,2BAA8B;AAC9B,qBAAuG;AACvG,mBAAsB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,15 +44,17 @@ function runStreamingCall(options) {
|
|
|
44
44
|
signal
|
|
45
45
|
};
|
|
46
46
|
let doneCalled = false;
|
|
47
|
-
|
|
47
|
+
const onAbort = () => {
|
|
48
48
|
const it = options.req.message[Symbol.asyncIterator]();
|
|
49
49
|
if (!doneCalled) {
|
|
50
|
-
it.throw?.(
|
|
50
|
+
it.throw?.(signal.reason).catch(() => {
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
it.return?.().catch(() => {
|
|
54
54
|
});
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
57
|
+
const removeAbortListener = () => signal.removeEventListener("abort", onAbort);
|
|
56
58
|
return next(req).then((res) => {
|
|
57
59
|
return {
|
|
58
60
|
...res,
|
|
@@ -62,13 +64,25 @@ function runStreamingCall(options) {
|
|
|
62
64
|
return {
|
|
63
65
|
next() {
|
|
64
66
|
return it.next().then((r) => {
|
|
65
|
-
if (r.done
|
|
67
|
+
if (r.done === true) {
|
|
66
68
|
doneCalled = true;
|
|
69
|
+
removeAbortListener();
|
|
67
70
|
}
|
|
68
71
|
return r;
|
|
69
72
|
}, abort);
|
|
73
|
+
},
|
|
74
|
+
// If a consumer abandons the stream early (e.g. `break`s out of a
|
|
75
|
+
// `for await`), the runtime calls throw()/return() rather than draining
|
|
76
|
+
// to completion. Drop the abort listener on those paths too, and forward
|
|
77
|
+
// to the underlying iterator so it can release its own resources.
|
|
78
|
+
throw(e) {
|
|
79
|
+
removeAbortListener();
|
|
80
|
+
return it.throw ? it.throw(e) : Promise.reject(e);
|
|
81
|
+
},
|
|
82
|
+
return(value) {
|
|
83
|
+
removeAbortListener();
|
|
84
|
+
return it.return ? it.return(value) : Promise.resolve({ done: true, value });
|
|
70
85
|
}
|
|
71
|
-
// We deliberately omit throw/return.
|
|
72
86
|
};
|
|
73
87
|
}
|
|
74
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdk/transport/runCall.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Interceptor } from \"@connectrpc/connect\";\nimport { getAbortSignalReason } from \"@connectrpc/connect/protocol\";\n\nimport type { DeepPartial } from \"../../encoding/typeEncodingHelpers.ts\";\nimport { mapStream } from \"../client/stream.ts\";\nimport type { MessageDesc, MessageInitShape, MessageShape } from \"../client/types.ts\";\nimport { TransportError } from \"./TransportError.ts\";\nimport type { StreamRequest, StreamResponse, UnaryRequest, UnaryResponse } from \"./types.ts\";\n\n/**\n * UnaryFn represents the client-side invocation of a unary RPC - a method\n * that takes a single input message, and responds with a single output\n * message.\n * A Transport implements such a function, and makes it available to\n * interceptors.\n */\ntype UnaryFn<\n I extends MessageDesc,\n O extends MessageDesc,\n> = (req: UnaryRequest<I, O>) => Promise<UnaryResponse<I, O>>;\n\n/**\n * Runs a unary method with the given interceptors. Note that this function\n * is only used when implementing a Transport.\n */\nexport function runUnaryCall<\n I extends MessageDesc,\n O extends MessageDesc,\n>(options: {\n req: Omit<UnaryRequest<I, O>, \"signal\" | \"message\"> & {\n message: MessageInitShape<I>;\n };\n next: UnaryFn<I, O>;\n timeoutMs?: number;\n signal?: AbortSignal;\n interceptors?: Interceptor[];\n}): Promise<UnaryResponse<I, O>> {\n const next = composeInterceptors(options.next, options.interceptors);\n const { signal, abort } = createAbortSignal(options);\n\n const req = {\n ...options.req,\n message: options.req.method.input.fromPartial(options.req.message as DeepPartial<I>) as MessageShape<I>,\n signal,\n };\n return next(req).catch(abort);\n}\n\n/**\n * StreamingFn represents the client-side invocation of a streaming RPC - a\n * method that takes zero or more input messages, and responds with zero or\n * more output messages.\n * A Transport implements such a function, and makes it available to\n * interceptors.\n */\ntype StreamingFn<\n I extends MessageDesc = MessageDesc,\n O extends MessageDesc = MessageDesc,\n> = (req: StreamRequest<I, O>) => Promise<StreamResponse<I, O>>;\n\n/**\n * Runs a server-streaming method with the given interceptors. Note that this\n * function is only used when implementing a Transport.\n */\nexport function runStreamingCall<\n I extends MessageDesc,\n O extends MessageDesc,\n>(options: {\n req: Omit<StreamRequest<I, O>, \"signal\" | \"message\"> & {\n message: AsyncIterable<MessageInitShape<I>>;\n };\n next: StreamingFn<I, O>;\n timeoutMs?: number;\n signal?: AbortSignal;\n interceptors?: Interceptor[];\n}): Promise<StreamResponse<I, O>> {\n const next = composeInterceptors(options.next, options.interceptors);\n const { signal, abort } = createAbortSignal(options);\n const req = {\n ...options.req,\n message: mapStream(options.req.message, (message) => options.req.method.input.fromPartial(message as DeepPartial<I>) as MessageShape<I>),\n signal,\n };\n let doneCalled = false;\n // Call return on the request iterable to indicate\n // that we will no longer consume it and it should\n // cleanup any allocated resources.\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAqC;AAGrC,oBAA0B;AAE1B,4BAA+B;AAmBxB,SAAS,aAGd,SAQ+B;AAC/B,QAAM,OAAO,oBAAoB,QAAQ,MAAM,QAAQ,YAAY;AACnE,QAAM,EAAE,QAAQ,MAAM,IAAI,kBAAkB,OAAO;AAEnD,QAAM,MAAM;AAAA,IACV,GAAG,QAAQ;AAAA,IACX,SAAS,QAAQ,IAAI,OAAO,MAAM,YAAY,QAAQ,IAAI,OAAyB;AAAA,IACnF;AAAA,EACF;AACA,SAAO,KAAK,GAAG,EAAE,MAAM,KAAK;AAC9B;AAkBO,SAAS,iBAGd,SAQgC;AAChC,QAAM,OAAO,oBAAoB,QAAQ,MAAM,QAAQ,YAAY;AACnE,QAAM,EAAE,QAAQ,MAAM,IAAI,kBAAkB,OAAO;AACnD,QAAM,MAAM;AAAA,IACV,GAAG,QAAQ;AAAA,IACX,aAAS,yBAAU,QAAQ,IAAI,SAAS,CAAC,YAAY,QAAQ,IAAI,OAAO,MAAM,YAAY,OAAyB,CAAoB;AAAA,IACvI;AAAA,EACF;AACA,MAAI,aAAa;AAIjB,
|
|
4
|
+
"sourcesContent": ["import type { Interceptor } from \"@connectrpc/connect\";\nimport { getAbortSignalReason } from \"@connectrpc/connect/protocol\";\n\nimport type { DeepPartial } from \"../../encoding/typeEncodingHelpers.ts\";\nimport { mapStream } from \"../client/stream.ts\";\nimport type { MessageDesc, MessageInitShape, MessageShape } from \"../client/types.ts\";\nimport { TransportError } from \"./TransportError.ts\";\nimport type { StreamRequest, StreamResponse, UnaryRequest, UnaryResponse } from \"./types.ts\";\n\n/**\n * UnaryFn represents the client-side invocation of a unary RPC - a method\n * that takes a single input message, and responds with a single output\n * message.\n * A Transport implements such a function, and makes it available to\n * interceptors.\n */\ntype UnaryFn<\n I extends MessageDesc,\n O extends MessageDesc,\n> = (req: UnaryRequest<I, O>) => Promise<UnaryResponse<I, O>>;\n\n/**\n * Runs a unary method with the given interceptors. Note that this function\n * is only used when implementing a Transport.\n */\nexport function runUnaryCall<\n I extends MessageDesc,\n O extends MessageDesc,\n>(options: {\n req: Omit<UnaryRequest<I, O>, \"signal\" | \"message\"> & {\n message: MessageInitShape<I>;\n };\n next: UnaryFn<I, O>;\n timeoutMs?: number;\n signal?: AbortSignal;\n interceptors?: Interceptor[];\n}): Promise<UnaryResponse<I, O>> {\n const next = composeInterceptors(options.next, options.interceptors);\n const { signal, abort } = createAbortSignal(options);\n\n const req = {\n ...options.req,\n message: options.req.method.input.fromPartial(options.req.message as DeepPartial<I>) as MessageShape<I>,\n signal,\n };\n return next(req).catch(abort);\n}\n\n/**\n * StreamingFn represents the client-side invocation of a streaming RPC - a\n * method that takes zero or more input messages, and responds with zero or\n * more output messages.\n * A Transport implements such a function, and makes it available to\n * interceptors.\n */\ntype StreamingFn<\n I extends MessageDesc = MessageDesc,\n O extends MessageDesc = MessageDesc,\n> = (req: StreamRequest<I, O>) => Promise<StreamResponse<I, O>>;\n\n/**\n * Runs a server-streaming method with the given interceptors. Note that this\n * function is only used when implementing a Transport.\n */\nexport function runStreamingCall<\n I extends MessageDesc,\n O extends MessageDesc,\n>(options: {\n req: Omit<StreamRequest<I, O>, \"signal\" | \"message\"> & {\n message: AsyncIterable<MessageInitShape<I>>;\n };\n next: StreamingFn<I, O>;\n timeoutMs?: number;\n signal?: AbortSignal;\n interceptors?: Interceptor[];\n}): Promise<StreamResponse<I, O>> {\n const next = composeInterceptors(options.next, options.interceptors);\n const { signal, abort } = createAbortSignal(options);\n const req = {\n ...options.req,\n message: mapStream(options.req.message, (message) => options.req.method.input.fromPartial(message as DeepPartial<I>) as MessageShape<I>),\n signal,\n };\n let doneCalled = false;\n // Call return on the request iterable to indicate\n // that we will no longer consume it and it should\n // cleanup any allocated resources.\n const onAbort = () => {\n const it = options.req.message[Symbol.asyncIterator]();\n // If the signal is aborted due to an error, we want to throw\n // the error to the request iterator.\n if (!doneCalled) {\n it.throw?.(signal.reason).catch(() => {\n // throw returns a promise, which we don't care about.\n //\n // Uncaught promises are thrown at sometime/somewhere by the event loop,\n // this is to ensure error is caught and ignored.\n });\n }\n it.return?.().catch(() => {\n // return returns a promise, which we don't care about.\n //\n // Uncaught promises are thrown at sometime/somewhere by the event loop,\n // this is to ensure error is caught and ignored.\n });\n };\n // `signal` is a composite AbortSignal produced by AbortSignal.any(). Node keeps\n // such signals reachable (via its internal `gcPersistentSignals` set) for as long\n // as they have an \"abort\" listener, so they can still fire. Registering with\n // `{ once: true }` lets Node drop this listener automatically once the signal\n // aborts; on every non-aborting terminal path we remove it explicitly via\n // `removeAbortListener()`. Without this, the listener closure keeps the entire\n // request graph reachable forever - for every stream that ends without aborting -\n // which leaks memory unboundedly on long-running processes.\n signal.addEventListener(\"abort\", onAbort, { once: true });\n const removeAbortListener = () => signal.removeEventListener(\"abort\", onAbort);\n\n return next(req).then((res) => {\n return {\n ...res,\n message: {\n [Symbol.asyncIterator]() {\n const it = res.message[Symbol.asyncIterator]();\n return {\n next() {\n return it.next().then((r) => {\n if (r.done === true) {\n doneCalled = true;\n // The stream completed normally, so the composite signal will\n // never abort and the abort listener would otherwise linger\n // forever. Remove it so the signal - and the request graph its\n // closure captures - becomes collectable.\n removeAbortListener();\n }\n return r;\n }, abort);\n },\n // If a consumer abandons the stream early (e.g. `break`s out of a\n // `for await`), the runtime calls throw()/return() rather than draining\n // to completion. Drop the abort listener on those paths too, and forward\n // to the underlying iterator so it can release its own resources.\n throw(e: unknown) {\n removeAbortListener();\n return it.throw ? it.throw(e) : Promise.reject(e);\n },\n return(value?: unknown) {\n removeAbortListener();\n return it.return ? it.return(value) : Promise.resolve({ done: true, value } as IteratorResult<MessageShape<O>>);\n },\n };\n },\n },\n };\n }, abort);\n}\n\nfunction createAbortSignal(options: {\n timeoutMs?: number;\n signal?: AbortSignal;\n}) {\n const controller = new AbortController();\n const signals: AbortSignal[] = [controller.signal];\n let timeoutSignal: AbortSignal | undefined;\n if (options.timeoutMs !== undefined) {\n timeoutSignal = AbortSignal.timeout(options.timeoutMs);\n signals.push(timeoutSignal);\n }\n if (options.signal !== undefined) {\n signals.push(options.signal);\n }\n const signal = AbortSignal.any(signals);\n return {\n signal,\n abort(reason: unknown): Promise<never> {\n // We peek at the deadline signal because fetch() will throw an error on\n // abort that discards the signal reason.\n const error = timeoutSignal?.aborted\n ? TransportError.from(getAbortSignalReason(timeoutSignal), TransportError.Code.DeadlineExceeded)\n : TransportError.from(reason);\n controller.abort(error);\n return Promise.reject(error);\n },\n };\n}\n\nfunction composeInterceptors<T>(\n next: T,\n interceptors: Interceptor[] | undefined,\n): T {\n if (!interceptors) return next;\n\n let i = interceptors.length;\n while (i--) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next = interceptors[i](next as (() => any)) as T;\n }\n return next;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAqC;AAGrC,oBAA0B;AAE1B,4BAA+B;AAmBxB,SAAS,aAGd,SAQ+B;AAC/B,QAAM,OAAO,oBAAoB,QAAQ,MAAM,QAAQ,YAAY;AACnE,QAAM,EAAE,QAAQ,MAAM,IAAI,kBAAkB,OAAO;AAEnD,QAAM,MAAM;AAAA,IACV,GAAG,QAAQ;AAAA,IACX,SAAS,QAAQ,IAAI,OAAO,MAAM,YAAY,QAAQ,IAAI,OAAyB;AAAA,IACnF;AAAA,EACF;AACA,SAAO,KAAK,GAAG,EAAE,MAAM,KAAK;AAC9B;AAkBO,SAAS,iBAGd,SAQgC;AAChC,QAAM,OAAO,oBAAoB,QAAQ,MAAM,QAAQ,YAAY;AACnE,QAAM,EAAE,QAAQ,MAAM,IAAI,kBAAkB,OAAO;AACnD,QAAM,MAAM;AAAA,IACV,GAAG,QAAQ;AAAA,IACX,aAAS,yBAAU,QAAQ,IAAI,SAAS,CAAC,YAAY,QAAQ,IAAI,OAAO,MAAM,YAAY,OAAyB,CAAoB;AAAA,IACvI;AAAA,EACF;AACA,MAAI,aAAa;AAIjB,QAAM,UAAU,MAAM;AACpB,UAAM,KAAK,QAAQ,IAAI,QAAQ,OAAO,aAAa,EAAE;AAGr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;AACA,MAAI,QAAQ,WAAW,QAAW;AAChC,YAAQ,KAAK,QAAQ,MAAM;AAAA,EAC7B;AACA,QAAM,SAAS,YAAY,IAAI,OAAO;AACtC,SAAO;AAAA,IACL;AAAA,IACA,MAAM,QAAiC;AAGrC,YAAM,QAAQ,eAAe,UACzB,qCAAe,SAAK,sCAAqB,aAAa,GAAG,qCAAe,KAAK,gBAAgB,IAC7F,qCAAe,KAAK,MAAM;AAC9B,iBAAW,MAAM,KAAK;AACtB,aAAO,QAAQ,OAAO,KAAK;AAAA,IAC7B;AAAA,EACF;AACF;AAEA,SAAS,oBACP,MACA,cACG;AACH,MAAI,CAAC,aAAc,QAAO;AAE1B,MAAI,IAAI,aAAa;AACrB,SAAO,KAAK;AAEV,WAAO,aAAa,CAAC,EAAE,IAAmB;AAAA,EAC5C;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -229,6 +229,9 @@ function buildParams(service) {
|
|
|
229
229
|
if (service.params.permissions) {
|
|
230
230
|
result.permissions = service.params.permissions;
|
|
231
231
|
}
|
|
232
|
+
if (service.params.tee) {
|
|
233
|
+
result.tee = import_service.TEEParams.fromPartial({ type: service.params.tee, attestation: true });
|
|
234
|
+
}
|
|
232
235
|
return result;
|
|
233
236
|
}
|
|
234
237
|
function buildManifestExpose(service, endpointSequenceNumbers) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdl/manifest/generateManifest.ts"],
|
|
4
|
-
"sourcesContent": ["import { PlacementRequirements, SignedBy } from \"../../generated/protos/akash/base/attributes/v1/attribute.ts\";\nimport { CPU } from \"../../generated/protos/akash/base/resources/v1beta4/cpu.ts\";\nimport { GPU } from \"../../generated/protos/akash/base/resources/v1beta4/gpu.ts\";\nimport { Memory } from \"../../generated/protos/akash/base/resources/v1beta4/memory.ts\";\nimport { Resources } from \"../../generated/protos/akash/base/resources/v1beta4/resources.ts\";\nimport { Storage } from \"../../generated/protos/akash/base/resources/v1beta4/storage.ts\";\nimport { DeploymentReclamation } from \"../../generated/protos/akash/deployment/v1/deployment.ts\";\nimport { GroupSpec } from \"../../generated/protos/akash/deployment/v1beta4/groupspec.ts\";\nimport { ResourceUnit } from \"../../generated/protos/akash/deployment/v1beta4/resourceunit.ts\";\nimport { Group } from \"../../generated/protos/akash/manifest/v2beta3/group.ts\";\nimport { ImageCredentials, Service, ServiceParams, StorageParams } from \"../../generated/protos/akash/manifest/v2beta3/service.ts\";\nimport { ServiceExpose } from \"../../generated/protos/akash/manifest/v2beta3/serviceexpose.ts\";\nimport type { ValidationError } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray } from \"../utils.ts\";\nimport type { SDLInput } from \"../validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"../validateSDL/validateSDL.ts\";\nimport {\n buildHttpOptions,\n buildResourceAttributes,\n buildServiceEndpoints,\n buildStorageAttributes,\n computeEndpointSequenceNumbers,\n encodeResourceValue,\n parseCpuUnits,\n parseGpuUnits,\n parseMemoryBytes,\n parseServiceProto,\n parseStorageBytes,\n type SDLCompute,\n type SDLService,\n transformGpuAttributes,\n} from \"./manifestUtils.ts\";\nimport { minWindowToDuration } from \"./reclamationDuration.ts\";\n\nexport interface GenerateManifestOkResult {\n groups: Group[];\n groupSpecs: GroupSpec[];\n reclamation?: DeploymentReclamation;\n}\n\nexport type Manifest = GenerateManifestOkResult[\"groups\"];\nexport type GenerateManifestResult =\n | { ok?: false; value: ValidationError[] }\n | { ok: true; value: GenerateManifestOkResult };\nexport function generateManifest(sdl: SDLInput): GenerateManifestResult {\n const errors = validateSDL(sdl);\n if (errors) return { ok: false, value: errors };\n\n const endpointSequenceNumbers = computeEndpointSequenceNumbers(sdl.services);\n const groupsMap = new Map<string, {\n dgroup: GroupSpec;\n boundComputes: Record<string, number>;\n }>();\n const resourceIds = new Map<string, number>();\n\n const deploymentsByPlacement = new Map<string, [string, { profile: string; count: number }][]>();\n for (const [svcName, placements] of Object.entries(sdl.deployment)) {\n for (const [placementName, deployment] of Object.entries(placements)) {\n let list = deploymentsByPlacement.get(placementName);\n if (!list) {\n list = [];\n deploymentsByPlacement.set(placementName, list);\n }\n list.push([svcName, deployment]);\n }\n }\n for (const list of deploymentsByPlacement.values()) {\n list.sort(([a], [b]) => a.localeCompare(b));\n }\n\n const services = Object.entries(sdl.services).sort(([a], [b]) => a.localeCompare(b));\n\n for (const [svcName, service] of services) {\n for (const [placementName, svcdepl] of Object.entries(sdl.deployment[svcName])) {\n const compute = sdl.profiles.compute[svcdepl.profile];\n const infra = sdl.profiles.placement[placementName];\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n denom: pricing.denom,\n amount: pricing.amount?.toString(),\n };\n\n let group = groupsMap.get(placementName);\n\n if (!group) {\n group = {\n dgroup: GroupSpec.fromPartial({\n name: placementName,\n resources: [],\n requirements: PlacementRequirements.fromPartial({\n attributes: buildResourceAttributes(infra.attributes),\n signedBy: SignedBy.fromPartial({\n allOf: infra.signedBy?.allOf,\n anyOf: infra.signedBy?.anyOf,\n }),\n }),\n }),\n boundComputes: {},\n };\n\n groupsMap.set(placementName, group);\n }\n\n const profileKey = `${placementName}:${svcdepl.profile}`;\n const location = group.boundComputes[svcdepl.profile];\n\n if (location === undefined) {\n const resId = group.dgroup.resources.length > 0\n ? group.dgroup.resources.length + 1\n : 1;\n\n resourceIds.set(profileKey, resId);\n\n const resources = buildResources(resId, compute, service, endpointSequenceNumbers);\n\n group.dgroup.resources.push(\n ResourceUnit.fromPartial({\n resource: resources,\n count: svcdepl.count,\n price,\n }),\n );\n\n group.boundComputes[svcdepl.profile] = group.dgroup.resources.length - 1;\n } else {\n if (!resourceIds.has(profileKey)) {\n resourceIds.set(profileKey, group.dgroup.resources[location].resource!.id);\n }\n\n group.dgroup.resources[location].count += svcdepl.count;\n group.dgroup.resources[location].resource!.endpoints.push(\n ...buildServiceEndpoints(service, endpointSequenceNumbers),\n );\n }\n }\n }\n\n for (const group of groupsMap.values()) {\n for (const resourceUnit of group.dgroup.resources) {\n resourceUnit.resource!.endpoints.sort(\n (a, b) => a.kind - b.kind || a.sequenceNumber - b.sequenceNumber,\n );\n }\n }\n\n const sortedGroupNames = [...groupsMap.keys()].sort();\n let groups: Group[] | undefined;\n let groupSpecs: GroupSpec[] | undefined;\n let reclamation: DeploymentReclamation | undefined;\n\n const manifest = {\n // reclamation is a `MsgCreateDeployment` field, not a manifest group, and is\n // not needed in every call \u2014 so it's lazy like `groups`/`groupSpecs`.\n // `validateSDL` (run above) already guaranteed `min_window` is valid, so\n // `minWindowToDuration` never throws here.\n get reclamation() {\n if (sdl.reclamation && !reclamation) {\n reclamation = DeploymentReclamation.fromPartial({\n minWindow: minWindowToDuration(sdl.reclamation.min_window),\n });\n }\n return reclamation;\n },\n get groups() {\n groups ??= sortedGroupNames.map((placementName) => {\n const deployments = deploymentsByPlacement.get(placementName)!;\n\n return Group.fromPartial({\n name: placementName,\n services: deployments.map(([svcName]) => {\n const service = sdl.services[svcName];\n const deployment = sdl.deployment[svcName][placementName];\n const compute = sdl.profiles.compute[deployment.profile];\n const resourceId = resourceIds.get(`${placementName}:${deployment.profile}`) || 1;\n\n return buildManifestService(\n resourceId,\n svcName,\n service,\n compute,\n deployment.count,\n endpointSequenceNumbers,\n );\n }),\n });\n });\n return groups;\n },\n get groupSpecs() {\n groupSpecs ??= sortedGroupNames.map((name) => groupsMap.get(name)!.dgroup);\n return groupSpecs;\n },\n };\n\n return { ok: true, value: manifest };\n}\n\nfunction buildResources(\n id: number,\n compute: SDLCompute,\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): Resources {\n const res = compute.resources;\n const cpuAttributes = buildResourceAttributes(res.cpu.attributes);\n const gpuAttributes = res.gpu?.attributes ? transformGpuAttributes(res.gpu.attributes) : [];\n\n return Resources.fromPartial({\n id,\n cpu: CPU.fromPartial({\n units: { val: encodeResourceValue(parseCpuUnits(res.cpu)) },\n attributes: cpuAttributes,\n }),\n memory: Memory.fromPartial({\n quantity: { val: encodeResourceValue(parseMemoryBytes(res.memory)) },\n }),\n storage: castArray(res.storage).map((s) =>\n Storage.fromPartial({\n name: s.name || \"default\",\n quantity: { val: encodeResourceValue(parseStorageBytes(s.size)) },\n attributes: buildStorageAttributes(s.attributes),\n }),\n ),\n gpu: GPU.fromPartial({\n units: { val: encodeResourceValue(parseGpuUnits(res.gpu)) },\n attributes: gpuAttributes,\n }),\n endpoints: buildServiceEndpoints(service, endpointSequenceNumbers),\n });\n}\n\nfunction buildManifestService(\n resourceId: number,\n name: string,\n service: SDLService,\n compute: SDLCompute,\n count: number,\n endpointSequenceNumbers: Record<string, number>,\n): Service {\n const credentials = service.credentials\n ? ImageCredentials.fromPartial({\n host: service.credentials.host,\n email: service.credentials.email || \"\",\n username: service.credentials.username,\n password: service.credentials.password,\n })\n : undefined;\n\n const params = buildParams(service);\n\n return Service.fromPartial({\n name,\n image: service.image,\n command: service.command || [],\n args: service.args || [],\n env: service.env || [],\n resources: buildResources(resourceId, compute, service, endpointSequenceNumbers),\n count,\n expose: buildManifestExpose(service, endpointSequenceNumbers),\n params,\n credentials,\n });\n}\n\nfunction buildParams(service: SDLService): ServiceParams | undefined {\n if (!service.params) return undefined;\n\n const storage = service.params.storage || {};\n const storageNames = service.params.storage ? Object.keys(storage).sort() : [];\n const result = ServiceParams.fromPartial({\n storage: storageNames.map((name) => {\n const config = storage[name];\n return StorageParams.fromPartial({\n name,\n mount: config.mount || \"\",\n readOnly: config.readOnly || false,\n });\n }),\n });\n\n // Permissions are not in the protobuf type but need to be preserved\n if (service.params.permissions) {\n (result as unknown as Record<string, unknown>).permissions = service.params.permissions;\n }\n\n return result;\n}\n\nfunction buildManifestExpose(\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): ServiceExpose[] {\n return (service.expose ?? [])\n .flatMap((expose) =>\n (expose.to ?? []).map((to) =>\n ServiceExpose.fromPartial({\n port: expose.port,\n externalPort: expose.as,\n proto: parseServiceProto(expose.proto),\n service: to.service || \"\",\n global: to.global || false,\n hosts: expose.accept || [],\n httpOptions: buildHttpOptions(expose.http_options),\n ip: to.ip || \"\",\n endpointSequenceNumber: endpointSequenceNumbers[to.ip!],\n }),\n ),\n )\n .sort((a, b) => {\n if (a.service !== b.service) return a.service.localeCompare(b.service);\n if (a.port !== b.port) return a.port - b.port;\n if (a.proto !== b.proto) return a.proto.localeCompare(b.proto);\n if (a.global !== b.global) return a.global ? -1 : 1;\n return 0;\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgD;AAChD,iBAAoB;AACpB,iBAAoB;AACpB,oBAAuB;AACvB,uBAA0B;AAC1B,qBAAwB;AACxB,wBAAsC;AACtC,uBAA0B;AAC1B,0BAA6B;AAC7B,mBAAsB;AACtB,
|
|
4
|
+
"sourcesContent": ["import { PlacementRequirements, SignedBy } from \"../../generated/protos/akash/base/attributes/v1/attribute.ts\";\nimport { CPU } from \"../../generated/protos/akash/base/resources/v1beta4/cpu.ts\";\nimport { GPU } from \"../../generated/protos/akash/base/resources/v1beta4/gpu.ts\";\nimport { Memory } from \"../../generated/protos/akash/base/resources/v1beta4/memory.ts\";\nimport { Resources } from \"../../generated/protos/akash/base/resources/v1beta4/resources.ts\";\nimport { Storage } from \"../../generated/protos/akash/base/resources/v1beta4/storage.ts\";\nimport { DeploymentReclamation } from \"../../generated/protos/akash/deployment/v1/deployment.ts\";\nimport { GroupSpec } from \"../../generated/protos/akash/deployment/v1beta4/groupspec.ts\";\nimport { ResourceUnit } from \"../../generated/protos/akash/deployment/v1beta4/resourceunit.ts\";\nimport { Group } from \"../../generated/protos/akash/manifest/v2beta3/group.ts\";\nimport { ImageCredentials, Service, ServiceParams, StorageParams, TEEParams } from \"../../generated/protos/akash/manifest/v2beta3/service.ts\";\nimport { ServiceExpose } from \"../../generated/protos/akash/manifest/v2beta3/serviceexpose.ts\";\nimport type { ValidationError } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray } from \"../utils.ts\";\nimport type { SDLInput } from \"../validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"../validateSDL/validateSDL.ts\";\nimport {\n buildHttpOptions,\n buildResourceAttributes,\n buildServiceEndpoints,\n buildStorageAttributes,\n computeEndpointSequenceNumbers,\n encodeResourceValue,\n parseCpuUnits,\n parseGpuUnits,\n parseMemoryBytes,\n parseServiceProto,\n parseStorageBytes,\n type SDLCompute,\n type SDLService,\n transformGpuAttributes,\n} from \"./manifestUtils.ts\";\nimport { minWindowToDuration } from \"./reclamationDuration.ts\";\n\nexport interface GenerateManifestOkResult {\n groups: Group[];\n groupSpecs: GroupSpec[];\n reclamation?: DeploymentReclamation;\n}\n\nexport type Manifest = GenerateManifestOkResult[\"groups\"];\nexport type GenerateManifestResult =\n | { ok?: false; value: ValidationError[] }\n | { ok: true; value: GenerateManifestOkResult };\nexport function generateManifest(sdl: SDLInput): GenerateManifestResult {\n const errors = validateSDL(sdl);\n if (errors) return { ok: false, value: errors };\n\n const endpointSequenceNumbers = computeEndpointSequenceNumbers(sdl.services);\n const groupsMap = new Map<string, {\n dgroup: GroupSpec;\n boundComputes: Record<string, number>;\n }>();\n const resourceIds = new Map<string, number>();\n\n const deploymentsByPlacement = new Map<string, [string, { profile: string; count: number }][]>();\n for (const [svcName, placements] of Object.entries(sdl.deployment)) {\n for (const [placementName, deployment] of Object.entries(placements)) {\n let list = deploymentsByPlacement.get(placementName);\n if (!list) {\n list = [];\n deploymentsByPlacement.set(placementName, list);\n }\n list.push([svcName, deployment]);\n }\n }\n for (const list of deploymentsByPlacement.values()) {\n list.sort(([a], [b]) => a.localeCompare(b));\n }\n\n const services = Object.entries(sdl.services).sort(([a], [b]) => a.localeCompare(b));\n\n for (const [svcName, service] of services) {\n for (const [placementName, svcdepl] of Object.entries(sdl.deployment[svcName])) {\n const compute = sdl.profiles.compute[svcdepl.profile];\n const infra = sdl.profiles.placement[placementName];\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n denom: pricing.denom,\n amount: pricing.amount?.toString(),\n };\n\n let group = groupsMap.get(placementName);\n\n if (!group) {\n group = {\n dgroup: GroupSpec.fromPartial({\n name: placementName,\n resources: [],\n requirements: PlacementRequirements.fromPartial({\n attributes: buildResourceAttributes(infra.attributes),\n signedBy: SignedBy.fromPartial({\n allOf: infra.signedBy?.allOf,\n anyOf: infra.signedBy?.anyOf,\n }),\n }),\n }),\n boundComputes: {},\n };\n\n groupsMap.set(placementName, group);\n }\n\n const profileKey = `${placementName}:${svcdepl.profile}`;\n const location = group.boundComputes[svcdepl.profile];\n\n if (location === undefined) {\n const resId = group.dgroup.resources.length > 0\n ? group.dgroup.resources.length + 1\n : 1;\n\n resourceIds.set(profileKey, resId);\n\n const resources = buildResources(resId, compute, service, endpointSequenceNumbers);\n\n group.dgroup.resources.push(\n ResourceUnit.fromPartial({\n resource: resources,\n count: svcdepl.count,\n price,\n }),\n );\n\n group.boundComputes[svcdepl.profile] = group.dgroup.resources.length - 1;\n } else {\n if (!resourceIds.has(profileKey)) {\n resourceIds.set(profileKey, group.dgroup.resources[location].resource!.id);\n }\n\n group.dgroup.resources[location].count += svcdepl.count;\n group.dgroup.resources[location].resource!.endpoints.push(\n ...buildServiceEndpoints(service, endpointSequenceNumbers),\n );\n }\n }\n }\n\n for (const group of groupsMap.values()) {\n for (const resourceUnit of group.dgroup.resources) {\n resourceUnit.resource!.endpoints.sort(\n (a, b) => a.kind - b.kind || a.sequenceNumber - b.sequenceNumber,\n );\n }\n }\n\n const sortedGroupNames = [...groupsMap.keys()].sort();\n let groups: Group[] | undefined;\n let groupSpecs: GroupSpec[] | undefined;\n let reclamation: DeploymentReclamation | undefined;\n\n const manifest = {\n // reclamation is a `MsgCreateDeployment` field, not a manifest group, and is\n // not needed in every call \u2014 so it's lazy like `groups`/`groupSpecs`.\n // `validateSDL` (run above) already guaranteed `min_window` is valid, so\n // `minWindowToDuration` never throws here.\n get reclamation() {\n if (sdl.reclamation && !reclamation) {\n reclamation = DeploymentReclamation.fromPartial({\n minWindow: minWindowToDuration(sdl.reclamation.min_window),\n });\n }\n return reclamation;\n },\n get groups() {\n groups ??= sortedGroupNames.map((placementName) => {\n const deployments = deploymentsByPlacement.get(placementName)!;\n\n return Group.fromPartial({\n name: placementName,\n services: deployments.map(([svcName]) => {\n const service = sdl.services[svcName];\n const deployment = sdl.deployment[svcName][placementName];\n const compute = sdl.profiles.compute[deployment.profile];\n const resourceId = resourceIds.get(`${placementName}:${deployment.profile}`) || 1;\n\n return buildManifestService(\n resourceId,\n svcName,\n service,\n compute,\n deployment.count,\n endpointSequenceNumbers,\n );\n }),\n });\n });\n return groups;\n },\n get groupSpecs() {\n groupSpecs ??= sortedGroupNames.map((name) => groupsMap.get(name)!.dgroup);\n return groupSpecs;\n },\n };\n\n return { ok: true, value: manifest };\n}\n\nfunction buildResources(\n id: number,\n compute: SDLCompute,\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): Resources {\n const res = compute.resources;\n const cpuAttributes = buildResourceAttributes(res.cpu.attributes);\n const gpuAttributes = res.gpu?.attributes ? transformGpuAttributes(res.gpu.attributes) : [];\n\n return Resources.fromPartial({\n id,\n cpu: CPU.fromPartial({\n units: { val: encodeResourceValue(parseCpuUnits(res.cpu)) },\n attributes: cpuAttributes,\n }),\n memory: Memory.fromPartial({\n quantity: { val: encodeResourceValue(parseMemoryBytes(res.memory)) },\n }),\n storage: castArray(res.storage).map((s) =>\n Storage.fromPartial({\n name: s.name || \"default\",\n quantity: { val: encodeResourceValue(parseStorageBytes(s.size)) },\n attributes: buildStorageAttributes(s.attributes),\n }),\n ),\n gpu: GPU.fromPartial({\n units: { val: encodeResourceValue(parseGpuUnits(res.gpu)) },\n attributes: gpuAttributes,\n }),\n endpoints: buildServiceEndpoints(service, endpointSequenceNumbers),\n });\n}\n\nfunction buildManifestService(\n resourceId: number,\n name: string,\n service: SDLService,\n compute: SDLCompute,\n count: number,\n endpointSequenceNumbers: Record<string, number>,\n): Service {\n const credentials = service.credentials\n ? ImageCredentials.fromPartial({\n host: service.credentials.host,\n email: service.credentials.email || \"\",\n username: service.credentials.username,\n password: service.credentials.password,\n })\n : undefined;\n\n const params = buildParams(service);\n\n return Service.fromPartial({\n name,\n image: service.image,\n command: service.command || [],\n args: service.args || [],\n env: service.env || [],\n resources: buildResources(resourceId, compute, service, endpointSequenceNumbers),\n count,\n expose: buildManifestExpose(service, endpointSequenceNumbers),\n params,\n credentials,\n });\n}\n\nfunction buildParams(service: SDLService): ServiceParams | undefined {\n if (!service.params) return undefined;\n\n const storage = service.params.storage || {};\n const storageNames = service.params.storage ? Object.keys(storage).sort() : [];\n const result = ServiceParams.fromPartial({\n storage: storageNames.map((name) => {\n const config = storage[name];\n return StorageParams.fromPartial({\n name,\n mount: config.mount || \"\",\n readOnly: config.readOnly || false,\n });\n }),\n });\n\n // Permissions are not in the protobuf type but need to be preserved\n if (service.params.permissions) {\n (result as unknown as Record<string, unknown>).permissions = service.params.permissions;\n }\n\n // Project TEE onto the manifest, mirroring Go's groupBuilder\n // (params.TEE = {Type, Attestation: true}). `attestation` is hard-coded true\n // (not an input knob); the provider injects the attestation sidecar.\n if (service.params.tee) {\n result.tee = TEEParams.fromPartial({ type: service.params.tee, attestation: true });\n }\n\n return result;\n}\n\nfunction buildManifestExpose(\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): ServiceExpose[] {\n return (service.expose ?? [])\n .flatMap((expose) =>\n (expose.to ?? []).map((to) =>\n ServiceExpose.fromPartial({\n port: expose.port,\n externalPort: expose.as,\n proto: parseServiceProto(expose.proto),\n service: to.service || \"\",\n global: to.global || false,\n hosts: expose.accept || [],\n httpOptions: buildHttpOptions(expose.http_options),\n ip: to.ip || \"\",\n endpointSequenceNumber: endpointSequenceNumbers[to.ip!],\n }),\n ),\n )\n .sort((a, b) => {\n if (a.service !== b.service) return a.service.localeCompare(b.service);\n if (a.port !== b.port) return a.port - b.port;\n if (a.proto !== b.proto)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Q,OAAO;AAAA,EAC9E;AAKA,MAAI,QAAQ,OAAO,KAAK;AACtB,WAAO,MAAM,yBAAU,YAAY,EAAE,MAAM,QAAQ,OAAO,KAAK,aAAa,KAAK,CAAC;AAAA,EACpF;AAEA,SAAO;AACT;AAEA,SAAS,oBACP,SACA,yBACiB;AACjB,UAAQ,QAAQ,UAAU,CAAC,GACxB;AAAA,IAAQ,CAAC,YACP,OAAO,MAAM,CAAC,GAAG;AAAA,MAAI,CAAC,OACrB,mCAAc,YAAY;AAAA,QACxB,MAAM,OAAO;AAAA,QACb,cAAc,OAAO;AAAA,QACrB,WAAO,wCAAkB,OAAO,KAAK;AAAA,QACrC,SAAS,GAAG,WAAW;AAAA,QACvB,QAAQ,GAAG,UAAU;AAAA,QACrB,OAAO,OAAO,UAAU,CAAC;AAAA,QACzB,iBAAa,uCAAiB,OAAO,YAAY;AAAA,QACjD,IAAI,GAAG,MAAM;AAAA,QACb,wBAAwB,wBAAwB,GAAG,EAAG;AAAA,MACxD,CAAC;AAAA,IACH;AAAA,EACF,EACC,KAAK,CAAC,GAAG,MAAM;AACd,QAAI,EAAE,YAAY,EAAE,QAAS,QAAO,EAAE,QAAQ,cAAc,EAAE,OAAO;AACrE,QAAI,EAAE,SAAS,EAAE,KAAM,QAAO,EAAE,OAAO,EAAE;AACzC,QAAI,EAAE,UAAU,EAAE,MAAO,QAAO,EAAE,MAAM,cAAc,EAAE,KAAK;AAC7D,QAAI,EAAE,WAAW,EAAE,OAAQ,QAAO,EAAE,SAAS,KAAK;AAClD,WAAO;AAAA,EACT,CAAC;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(generateManifestVersion_exports);
|
|
|
35
35
|
var import_json_stable_stringify = __toESM(require("json-stable-stringify"), 1);
|
|
36
36
|
const decoder = new TextDecoder();
|
|
37
37
|
const encoder = new TextEncoder();
|
|
38
|
-
const NULLABLE_MANIFEST_KEYS = /* @__PURE__ */ new Set(["command", "args", "env", "hosts"]);
|
|
38
|
+
const NULLABLE_MANIFEST_KEYS = /* @__PURE__ */ new Set(["command", "args", "env", "hosts", "storage"]);
|
|
39
39
|
const OMITTED_MANIFEST_KEYS = /* @__PURE__ */ new Set(["kind", "attributes"]);
|
|
40
40
|
async function generateManifestVersion(manifest) {
|
|
41
41
|
const jsonStr = manifestToSortedJSON(manifest);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdl/manifest/generateManifestVersion.ts"],
|
|
4
|
-
"sourcesContent": ["import { default as stableStringify } from \"json-stable-stringify\";\n\nimport type { GenerateManifestOkResult, Manifest } from \"./generateManifest.ts\";\n\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\nconst NULLABLE_MANIFEST_KEYS = new Set([\"command\", \"args\", \"env\", \"hosts\"]);\nconst OMITTED_MANIFEST_KEYS = new Set([\"kind\", \"attributes\"]);\n\nexport async function generateManifestVersion(manifest: Manifest): Promise<Uint8Array> {\n const jsonStr = manifestToSortedJSON(manifest);\n const sortedBytes = encoder.encode(jsonStr);\n const sum = await crypto.subtle.digest(\"SHA-256\", sortedBytes);\n return new Uint8Array(sum);\n}\n\nexport function manifestToSortedJSON(manifest: Manifest | GenerateManifestOkResult[\"groupSpecs\"]): string {\n const json = stableStringify(manifest, { replacer: manifestReplacer }) || \"\";\n return escapeHtml(renameFields(json));\n}\n\nfunction manifestReplacer(this: unknown, key: string | number, value: unknown): unknown {\n if (value && value instanceof Uint8Array) {\n return decoder.decode(value);\n }\n\n if (typeof key !== \"string\") {\n return value;\n }\n\n // only top-level \"credentials\" field can be null, credentials in params should be omitted\n if (typeof this === \"object\" && this && Object.hasOwn(this, \"command\") && key === \"credentials\" && value == null) {\n return null;\n }\n\n if (NULLABLE_MANIFEST_KEYS.has(key) && ((Array.isArray(value) && value.length === 0) || value == null)) {\n return null;\n }\n\n if (OMITTED_MANIFEST_KEYS.has(key) && ((Array.isArray(value) && value.length === 0) || value === 0)) {\n return undefined;\n }\n\n return value;\n}\n\nconst MANIFEST_VERSION_FIELD_MAPPING: Record<string, string> = { quantity: \"size\", sequenceNumber: \"sequence_number\" };\nconst MANIFEST_VERSION_FIELD_REGEX = new RegExp(`\"(${Object.keys(MANIFEST_VERSION_FIELD_MAPPING).join(\"|\")})\":`, \"g\");\nfunction renameFields(jsonStr: string): string {\n MANIFEST_VERSION_FIELD_REGEX.lastIndex = 0; // reset regex state\n return jsonStr.replace(MANIFEST_VERSION_FIELD_REGEX, (_, field) => `\"${MANIFEST_VERSION_FIELD_MAPPING[field]}\":`);\n}\n\nconst htmlEscapes: Record<string, string> = {\n \"<\": \"\\\\u003c\",\n \">\": \"\\\\u003e\",\n \"&\": \"\\\\u0026\",\n};\n\nconst HTML_SPECIAL_CHARS_REGEX = new RegExp(`[${Object.keys(htmlEscapes).join(\"\")}]`, \"g\");\nfunction escapeHtml(raw: string): string {\n HTML_SPECIAL_CHARS_REGEX.lastIndex = 0; // reset regex state\n return raw.replace(HTML_SPECIAL_CHARS_REGEX, (ch) => htmlEscapes[ch]);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA2C;AAI3C,MAAM,UAAU,IAAI,YAAY;AAChC,MAAM,UAAU,IAAI,YAAY;
|
|
4
|
+
"sourcesContent": ["import { default as stableStringify } from \"json-stable-stringify\";\n\nimport type { GenerateManifestOkResult, Manifest } from \"./generateManifest.ts\";\n\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\n// Go marshals nil slices as `null`, so empty manifest arrays must serialize to\n// `null` to stay byte-compatible with the Go SDK's manifest. `storage` covers\n// `params.storage` when a service sets other params (e.g. `tee`) but no storage;\n// resource-level storage is schema-required and never empty, so it is unaffected.\nconst NULLABLE_MANIFEST_KEYS = new Set([\"command\", \"args\", \"env\", \"hosts\", \"storage\"]);\nconst OMITTED_MANIFEST_KEYS = new Set([\"kind\", \"attributes\"]);\n\nexport async function generateManifestVersion(manifest: Manifest): Promise<Uint8Array> {\n const jsonStr = manifestToSortedJSON(manifest);\n const sortedBytes = encoder.encode(jsonStr);\n const sum = await crypto.subtle.digest(\"SHA-256\", sortedBytes);\n return new Uint8Array(sum);\n}\n\nexport function manifestToSortedJSON(manifest: Manifest | GenerateManifestOkResult[\"groupSpecs\"]): string {\n const json = stableStringify(manifest, { replacer: manifestReplacer }) || \"\";\n return escapeHtml(renameFields(json));\n}\n\nfunction manifestReplacer(this: unknown, key: string | number, value: unknown): unknown {\n if (value && value instanceof Uint8Array) {\n return decoder.decode(value);\n }\n\n if (typeof key !== \"string\") {\n return value;\n }\n\n // only top-level \"credentials\" field can be null, credentials in params should be omitted\n if (typeof this === \"object\" && this && Object.hasOwn(this, \"command\") && key === \"credentials\" && value == null) {\n return null;\n }\n\n if (NULLABLE_MANIFEST_KEYS.has(key) && ((Array.isArray(value) && value.length === 0) || value == null)) {\n return null;\n }\n\n if (OMITTED_MANIFEST_KEYS.has(key) && ((Array.isArray(value) && value.length === 0) || value === 0)) {\n return undefined;\n }\n\n return value;\n}\n\nconst MANIFEST_VERSION_FIELD_MAPPING: Record<string, string> = { quantity: \"size\", sequenceNumber: \"sequence_number\" };\nconst MANIFEST_VERSION_FIELD_REGEX = new RegExp(`\"(${Object.keys(MANIFEST_VERSION_FIELD_MAPPING).join(\"|\")})\":`, \"g\");\nfunction renameFields(jsonStr: string): string {\n MANIFEST_VERSION_FIELD_REGEX.lastIndex = 0; // reset regex state\n return jsonStr.replace(MANIFEST_VERSION_FIELD_REGEX, (_, field) => `\"${MANIFEST_VERSION_FIELD_MAPPING[field]}\":`);\n}\n\nconst htmlEscapes: Record<string, string> = {\n \"<\": \"\\\\u003c\",\n \">\": \"\\\\u003e\",\n \"&\": \"\\\\u0026\",\n};\n\nconst HTML_SPECIAL_CHARS_REGEX = new RegExp(`[${Object.keys(htmlEscapes).join(\"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AM,QAAQ,KAAK,KAAK,MAAM,WAAW,KAAM,UAAU,IAAI;AACnG,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,MAAM,iCAAyD,EAAE,UAAU,QAAQ,gBAAgB,kBAAkB;AACrH,MAAM,+BAA+B,IAAI,OAAO,KAAK,OAAO,KAAK,8BAA8B,EAAE,KAAK,GAAG,CAAC,OAAO,GAAG;AACpH,SAAS,aAAa,SAAyB;AAC7C,+BAA6B,YAAY;AACzC,SAAO,QAAQ,QAAQ,8BAA8B,CAAC,GAAG,UAAU,IAAI,+BAA+B,KAAK,CAAC,IAAI;AAClH;AAEA,MAAM,cAAsC;AAAA,EAC1C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,2BAA2B,IAAI,OAAO,IAAI,OAAO,KAAK,WAAW,EAAE,KAAK,EAAE,CAAC,KAAK,GAAG;AACzF,SAAS,WAAW,KAAqB;AACvC,2BAAyB,YAAY;AACrC,SAAO,IAAI,QAAQ,0BAA0B,CAAC,OAAO,YAAY,EAAE,CAAC;AACtE;",
|
|
6
6
|
"names": ["stableStringify"]
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ module.exports = __toCommonJS(validateSDL_exports);
|
|
|
33
33
|
var import_jsonSchemaValidation = require("../../utils/jsonSchemaValidation.cjs");
|
|
34
34
|
var import_utils = require("../utils.cjs");
|
|
35
35
|
var import_validateSDLInput = require("./validateSDLInput.cjs");
|
|
36
|
-
var _endpointsUsed, _portsUsed, _sdl, _errors, _SDLValidator_instances, validateDeploymentWithRelations_fn, validateDeploymentRelations_fn, validateServiceStorages_fn, validateStorages_fn, validateGPU_fn, validateLeaseIP_fn, validateEndpoints_fn;
|
|
36
|
+
var _endpointsUsed, _portsUsed, _sdl, _errors, _SDLValidator_instances, validateDeploymentWithRelations_fn, validateDeploymentRelations_fn, validateServiceStorages_fn, validateStorages_fn, validateGPU_fn, validateTEE_fn, validateLeaseIP_fn, validateEndpoints_fn;
|
|
37
37
|
const ERROR_MESSAGES = {
|
|
38
38
|
"#/definitions/storageRamClassMustNotBePersistent"(error) {
|
|
39
39
|
return `"ram" storage${(0, import_jsonSchemaValidation.getErrorLocation)((0, import_jsonSchemaValidation.dirname)(error.instancePath))} cannot be persistent`;
|
|
@@ -101,6 +101,7 @@ validateDeploymentWithRelations_fn = function(serviceName) {
|
|
|
101
101
|
__privateMethod(this, _SDLValidator_instances, validateServiceStorages_fn).call(this, serviceName, deploymentName);
|
|
102
102
|
__privateMethod(this, _SDLValidator_instances, validateStorages_fn).call(this, serviceName, deploymentName);
|
|
103
103
|
__privateMethod(this, _SDLValidator_instances, validateGPU_fn).call(this, serviceName, deploymentName);
|
|
104
|
+
__privateMethod(this, _SDLValidator_instances, validateTEE_fn).call(this, serviceName, deploymentName);
|
|
104
105
|
});
|
|
105
106
|
};
|
|
106
107
|
validateDeploymentRelations_fn = function(serviceName, deploymentName) {
|
|
@@ -267,6 +268,28 @@ validateGPU_fn = function(serviceName, deploymentName) {
|
|
|
267
268
|
});
|
|
268
269
|
}
|
|
269
270
|
};
|
|
271
|
+
// Mirrors Go `validateTEEWithGPU` (go/sdl/tee.go): the `cpu-gpu` TEE type
|
|
272
|
+
// requires GPU resources on the resolved compute profile. `cpu` (and absent)
|
|
273
|
+
// need no GPU. Unsupported tee values are rejected structurally by the input
|
|
274
|
+
// schema (`tee` enum in validateSDLInput.ts) before this runs.
|
|
275
|
+
validateTEE_fn = function(serviceName, deploymentName) {
|
|
276
|
+
const tee = __privateGet(this, _sdl).services?.[serviceName]?.params?.tee;
|
|
277
|
+
if (tee !== "cpu-gpu") return;
|
|
278
|
+
const profile = __privateGet(this, _sdl).deployment[serviceName]?.[deploymentName]?.profile;
|
|
279
|
+
const gpu = __privateGet(this, _sdl).profiles?.compute?.[profile]?.resources.gpu;
|
|
280
|
+
const hasGpu = gpu?.units !== void 0 && gpu.units !== 0;
|
|
281
|
+
if (!hasGpu) {
|
|
282
|
+
__privateGet(this, _errors).push({
|
|
283
|
+
message: `Service "${serviceName}" tee type requires gpu resources.`,
|
|
284
|
+
instancePath: `/services/${serviceName}/params/tee`,
|
|
285
|
+
schemaPath: "#/properties/services/additionalProperties/properties/params/properties/tee",
|
|
286
|
+
keyword: "required",
|
|
287
|
+
params: {
|
|
288
|
+
missingProperty: "gpu"
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
270
293
|
validateLeaseIP_fn = function(serviceName) {
|
|
271
294
|
__privateGet(this, _sdl).services?.[serviceName]?.expose?.forEach((expose, exposeIndex) => {
|
|
272
295
|
const proto = expose.proto?.toUpperCase() || "TCP";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdl/validateSDL/validateSDL.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ErrorMessages, ValidationError, ValidationFunction } from \"../../utils/jsonSchemaValidation.ts\";\nimport { dirname, getErrorLocation, humanizeErrors } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray, stringToBoolean } from \"../utils.ts\";\nimport { schema as validationSDLSchema, type SDLInput, validate as validateSDLInput } from \"./validateSDLInput.ts\";\n\nexport { validationSDLSchema };\nexport type { SDLInput };\n\nconst ERROR_MESSAGES: ErrorMessages = {\n \"#/definitions/storageRamClassMustNotBePersistent\"(error) {\n return `\"ram\" storage${getErrorLocation(dirname(error.instancePath))} cannot be persistent`;\n },\n \"#/definitions/exposeToWithIpEnforcesGlobal\"() {\n return `If an IP is declared, the directive must be declared as global.`;\n },\n // Mirrors the shared schema's `min_window` pattern (`^[1-9][0-9]*(s|m|h)$`).\n // Go stays the lenient layer (`go/sdl/reclamation.go` accepts any `> 0`\n // `time.ParseDuration`), so this is a sanctioned schema-only-stricter rule.\n \"#/properties/reclamation/properties/min_window/pattern\"() {\n return `Reclamation min_window must be a whole number followed by s, m, or h (e.g. \"24h\", \"30m\").`;\n },\n};\n\nexport function validateSDL(sdl: SDLInput): undefined | ValidationError[] {\n validateSDLInput(sdl);\n const schemaErrors = humanizeErrors((validateSDLInput as ValidationFunction).errors, validationSDLSchema, ERROR_MESSAGES);\n if (schemaErrors.length) return schemaErrors;\n\n const validator = new SDLValidator(sdl);\n const errors = validator.validate();\n\n const allErrors = schemaErrors.concat(errors);\n return allErrors.length ? allErrors : undefined;\n}\n\nclass SDLValidator {\n readonly #endpointsUsed = new Set<string>();\n readonly #portsUsed = new Map<string, string>();\n readonly #sdl: SDLInput;\n readonly #errors: ValidationError[] = [];\n\n constructor(sdl: SDLInput) {\n this.#sdl = sdl;\n }\n\n validate() {\n if (this.#sdl.services) {\n Object.keys(this.#sdl.services).forEach((serviceName) => {\n this.#validateDeploymentWithRelations(serviceName);\n this.#validateLeaseIP(serviceName);\n });\n }\n\n this.#validateEndpoints();\n return this.#errors;\n }\n\n #validateDeploymentWithRelations(serviceName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n if (!deployment) {\n this.#errors.push({\n message: `Service \"${serviceName}\" is not defined at \"/deployment\" section.`,\n instancePath: `/deployment`,\n schemaPath: \"#/properties/deployment\",\n keyword: \"required\",\n params: {\n missingProperty: serviceName,\n },\n });\n return;\n }\n\n Object.keys(this.#sdl.deployment[serviceName]).forEach((deploymentName) => {\n this.#validateDeploymentRelations(serviceName, deploymentName);\n this.#validateServiceStorages(serviceName, deploymentName);\n this.#validateStorages(serviceName, deploymentName);\n this.#validateGPU(serviceName, deploymentName);\n });\n }\n\n #validateDeploymentRelations(serviceName: string, deploymentName: string) {\n const serviceDeployment = this.#sdl.deployment?.[serviceName]?.[deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment?.profile];\n const infra = this.#sdl.profiles?.placement?.[deploymentName];\n\n if (!infra) {\n this.#errors.push({\n message: `The placement \"${deploymentName}\" is not defined in the \"placement\" section.`,\n instancePath: `/profiles/placement`,\n schemaPath: \"#/properties/profiles/properties/placement\",\n keyword: \"required\",\n params: {\n missingProperty: deploymentName,\n },\n });\n }\n\n if (infra && !infra.pricing?.[serviceDeployment?.profile]) {\n this.#errors.push({\n message: `The pricing for the \"${serviceDeployment?.profile}\" profile is not defined in the \"${deploymentName}\" placement.`,\n instancePath: `/profiles/placement/${deploymentName}/pricing`,\n schemaPath: \"#/properties/profiles/properties/placement/additionalProperties/properties/pricing\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n\n if (!compute) {\n this.#errors.push({\n message: `The compute requirements for the \"${serviceDeployment?.profile}\" profile are not defined in the \"compute\" section.`,\n instancePath: `/profiles/compute`,\n schemaPath: \"#/properties/profiles/properties/compute\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n }\n\n #validateServiceStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const mounts: Record<string, string> = {};\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n if (!service?.params?.storage) {\n return;\n }\n\n Object.entries(service.params.storage).forEach(([storageName, storage]) => {\n if (!storage) {\n this.#errors.push({\n message: `Storage \"${storageName}\" is not configured.`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n const storageNameExists = storages.some(({ name }) => name === storageName);\n if (!storageNameExists) {\n this.#errors.push({\n message: `Service \"${serviceName}\" references non-existing compute volume \"${storageName}\".`,\n instancePath: `/profiles/compute/${serviceDeployment.profile}/resources/storage`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/storage\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n\n const mount = String(storage.mount);\n const volumeName = mounts[mount];\n\n if (volumeName && !storage.mount) {\n this.#errors.push({\n message: \"Multiple root ephemeral storages are not allowed.\",\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: volumeName,\n },\n });\n }\n if (volumeName && storage.mount) {\n this.#errors.push({\n message: `Mount \"${mount}\" already in use by volume \"${volumeName}\".`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}/mount`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: mount,\n },\n });\n }\n\n mounts[mount] = storageName;\n });\n }\n\n #validateStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n storages.forEach((storage) => {\n const persistent = stringToBoolean(storage.attributes?.persistent as string | boolean || false);\n\n if (persistent && !service?.params?.storage?.[storage.name || \"\"]?.mount) {\n this.#errors.push({\n message: `Persistent storage \"${storage.name || \"default\"}\" requires a mount path in /services/${serviceName}/params/storage/${storage.name || \"default\"}/mount.`,\n instancePath: `/services/${serviceName}/params/storage/${storage.name || \"default\"}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"required\",\n params: {\n missingProperty: \"mount\",\n },\n });\n }\n });\n }\n\n #validateGPU(serviceName: string, deploymentName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n const compute = this.#sdl.profiles?.compute?.[deployment[deploymentName]?.profile];\n const gpu = compute?.resources.gpu;\n if (!gpu) return;\n\n const hasUnits = gpu.units !== undefined && gpu.units !== 0;\n const hasAttributes = typeof gpu.attributes !== \"undefined\";\n const hasVendor = hasAttributes && typeof gpu.attributes?.vendor !== \"undefined\";\n\n const profile = deployment[deploymentName]?.profile;\n const gpuPath = `/profiles/compute/${profile}/resources/gpu`;\n\n if (!hasUnits && hasAttributes) {\n this.#errors.push({\n message: \"GPU must not have attributes if units is 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasAttributes) {\n this.#errors.push({\n message: \"GPU must have attributes if units is not 0.\",\n instancePath: gpuPath,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu\",\n keyword: \"required\",\n params: {\n missingProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasVendor) {\n this.#errors.push({\n message: \"GPU must specify a vendor if units is not 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes/properties/vendor\",\n keyword: \"required\",\n params: {\n missingProperty: \"vendor\",\n },\n });\n }\n }\n\n #validateLeaseIP(serviceName: string) {\n this.#sdl.services?.[serviceName]?.expose?.forEach((expose, exposeIndex) => {\n const proto = expose.proto?.toUpperCase() || \"TCP\";\n\n expose.to?.forEach((to, toIndex) => {\n if (to.ip?.length) {\n const toPath = `/services/${serviceName}/expose/${exposeIndex}/to/${toIndex}`;\n\n if (!to.global) {\n this.#errors.push({\n message: `If an IP is declared, the directive must be declared as global.`,\n instancePath: `${toPath}/global`,\n schemaPath: \"#/definitions/exposeToWithIpEnforcesGlobal/then/properties/global/const\",\n keyword: \"const\",\n params: {\n allowedValue: true,\n },\n });\n }\n if (!this.#sdl.endpoints?.[to.ip]) {\n this.#errors.push({\n message: `Unknown endpoint \"${to.ip}\" for service \"${serviceName}\". Add it to the \"endpoints\" section.`,\n instancePath: `/endpoints/${to.ip}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"required\",\n params: {\n missingProperty: to.ip,\n },\n });\n }\n\n this.#endpointsUsed.add(to.ip);\n\n const externalPort = expose.as ?? expose.port;\n const portKey = `${to.ip}-${externalPort}-${proto}`;\n const otherServiceName = this.#portsUsed.get(portKey);\n\n if (this.#portsUsed.has(portKey)) {\n this.#errors.push({\n message: `IP endpoint \"${to.ip}\" port ${externalPort} protocol ${proto} already in use by service \"${otherServiceName}\".`,\n instancePath: `${toPath}/ip`,\n schemaPath: \"#/properties/services/additionalProperties/properties/expose/items/properties/to/items\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: portKey,\n },\n });\n }\n this.#portsUsed.set(portKey, serviceName);\n }\n });\n });\n }\n\n #validateEndpoints() {\n if (!this.#sdl.endpoints) return;\n\n Object.keys(this.#sdl.endpoints).forEach((endpoint) => {\n if (!this.#endpointsUsed.has(endpoint)) {\n this.#errors.push({\n message: `Endpoint \"${endpoint}\" declared but never used.`,\n instancePath: `/endpoints/${endpoint}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: endpoint,\n },\n });\n }\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,qDAAAA;AAAA;AAAA;AACA,kCAA0D;AAC1D,mBAA2C;AAC3C,8BAA2F;AAH3F;AAQA,MAAM,iBAAgC;AAAA,EACpC,mDAAmD,OAAO;AACxD,WAAO,oBAAgB,kDAAiB,qCAAQ,MAAM,YAAY,CAAC,CAAC;AAAA,EACtE;AAAA,EACA,+CAA+C;AAC7C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAIA,2DAA2D;AACzD,WAAO;AAAA,EACT;AACF;AAEO,SAAS,YAAY,KAA8C;AACxE,8BAAAC,UAAiB,GAAG;AACpB,QAAM,mBAAe,4CAAgB,wBAAAA,SAAwC,QAAQ,wBAAAC,QAAqB,cAAc;AACxH,MAAI,aAAa,OAAQ,QAAO;AAEhC,QAAM,YAAY,IAAI,aAAa,GAAG;AACtC,QAAM,SAAS,UAAU,SAAS;AAElC,QAAM,YAAY,aAAa,OAAO,MAAM;AAC5C,SAAO,UAAU,SAAS,YAAY;AACxC;AAEA,MAAM,aAAa;AAAA,EAMjB,YAAY,KAAe;AAN7B;AACE,uBAAS,gBAAiB,oBAAI,IAAY;AAC1C,uBAAS,YAAa,oBAAI,IAAoB;AAC9C,uBAAS;AACT,uBAAS,SAA6B,CAAC;AAGrC,uBAAK,MAAO;AAAA,EACd;AAAA,EAEA,WAAW;AACT,QAAI,mBAAK,MAAK,UAAU;AACtB,aAAO,KAAK,mBAAK,MAAK,QAAQ,EAAE,QAAQ,CAAC,gBAAgB;AACvD,8BAAK,6DAAL,WAAsC;AACtC,8BAAK,6CAAL,WAAsB;AAAA,MACxB,CAAC;AAAA,IACH;AAEA,0BAAK,+CAAL;AACA,WAAO,mBAAK;AAAA,EACd;
|
|
4
|
+
"sourcesContent": ["import type { ErrorMessages, ValidationError, ValidationFunction } from \"../../utils/jsonSchemaValidation.ts\";\nimport { dirname, getErrorLocation, humanizeErrors } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray, stringToBoolean } from \"../utils.ts\";\nimport { schema as validationSDLSchema, type SDLInput, validate as validateSDLInput } from \"./validateSDLInput.ts\";\n\nexport { validationSDLSchema };\nexport type { SDLInput };\n\nconst ERROR_MESSAGES: ErrorMessages = {\n \"#/definitions/storageRamClassMustNotBePersistent\"(error) {\n return `\"ram\" storage${getErrorLocation(dirname(error.instancePath))} cannot be persistent`;\n },\n \"#/definitions/exposeToWithIpEnforcesGlobal\"() {\n return `If an IP is declared, the directive must be declared as global.`;\n },\n // Mirrors the shared schema's `min_window` pattern (`^[1-9][0-9]*(s|m|h)$`).\n // Go stays the lenient layer (`go/sdl/reclamation.go` accepts any `> 0`\n // `time.ParseDuration`), so this is a sanctioned schema-only-stricter rule.\n \"#/properties/reclamation/properties/min_window/pattern\"() {\n return `Reclamation min_window must be a whole number followed by s, m, or h (e.g. \"24h\", \"30m\").`;\n },\n};\n\nexport function validateSDL(sdl: SDLInput): undefined | ValidationError[] {\n validateSDLInput(sdl);\n const schemaErrors = humanizeErrors((validateSDLInput as ValidationFunction).errors, validationSDLSchema, ERROR_MESSAGES);\n if (schemaErrors.length) return schemaErrors;\n\n const validator = new SDLValidator(sdl);\n const errors = validator.validate();\n\n const allErrors = schemaErrors.concat(errors);\n return allErrors.length ? allErrors : undefined;\n}\n\nclass SDLValidator {\n readonly #endpointsUsed = new Set<string>();\n readonly #portsUsed = new Map<string, string>();\n readonly #sdl: SDLInput;\n readonly #errors: ValidationError[] = [];\n\n constructor(sdl: SDLInput) {\n this.#sdl = sdl;\n }\n\n validate() {\n if (this.#sdl.services) {\n Object.keys(this.#sdl.services).forEach((serviceName) => {\n this.#validateDeploymentWithRelations(serviceName);\n this.#validateLeaseIP(serviceName);\n });\n }\n\n this.#validateEndpoints();\n return this.#errors;\n }\n\n #validateDeploymentWithRelations(serviceName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n if (!deployment) {\n this.#errors.push({\n message: `Service \"${serviceName}\" is not defined at \"/deployment\" section.`,\n instancePath: `/deployment`,\n schemaPath: \"#/properties/deployment\",\n keyword: \"required\",\n params: {\n missingProperty: serviceName,\n },\n });\n return;\n }\n\n Object.keys(this.#sdl.deployment[serviceName]).forEach((deploymentName) => {\n this.#validateDeploymentRelations(serviceName, deploymentName);\n this.#validateServiceStorages(serviceName, deploymentName);\n this.#validateStorages(serviceName, deploymentName);\n this.#validateGPU(serviceName, deploymentName);\n this.#validateTEE(serviceName, deploymentName);\n });\n }\n\n #validateDeploymentRelations(serviceName: string, deploymentName: string) {\n const serviceDeployment = this.#sdl.deployment?.[serviceName]?.[deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment?.profile];\n const infra = this.#sdl.profiles?.placement?.[deploymentName];\n\n if (!infra) {\n this.#errors.push({\n message: `The placement \"${deploymentName}\" is not defined in the \"placement\" section.`,\n instancePath: `/profiles/placement`,\n schemaPath: \"#/properties/profiles/properties/placement\",\n keyword: \"required\",\n params: {\n missingProperty: deploymentName,\n },\n });\n }\n\n if (infra && !infra.pricing?.[serviceDeployment?.profile]) {\n this.#errors.push({\n message: `The pricing for the \"${serviceDeployment?.profile}\" profile is not defined in the \"${deploymentName}\" placement.`,\n instancePath: `/profiles/placement/${deploymentName}/pricing`,\n schemaPath: \"#/properties/profiles/properties/placement/additionalProperties/properties/pricing\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n\n if (!compute) {\n this.#errors.push({\n message: `The compute requirements for the \"${serviceDeployment?.profile}\" profile are not defined in the \"compute\" section.`,\n instancePath: `/profiles/compute`,\n schemaPath: \"#/properties/profiles/properties/compute\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n }\n\n #validateServiceStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const mounts: Record<string, string> = {};\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n if (!service?.params?.storage) {\n return;\n }\n\n Object.entries(service.params.storage).forEach(([storageName, storage]) => {\n if (!storage) {\n this.#errors.push({\n message: `Storage \"${storageName}\" is not configured.`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n const storageNameExists = storages.some(({ name }) => name === storageName);\n if (!storageNameExists) {\n this.#errors.push({\n message: `Service \"${serviceName}\" references non-existing compute volume \"${storageName}\".`,\n instancePath: `/profiles/compute/${serviceDeployment.profile}/resources/storage`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/storage\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n\n const mount = String(storage.mount);\n const volumeName = mounts[mount];\n\n if (volumeName && !storage.mount) {\n this.#errors.push({\n message: \"Multiple root ephemeral storages are not allowed.\",\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: volumeName,\n },\n });\n }\n if (volumeName && storage.mount) {\n this.#errors.push({\n message: `Mount \"${mount}\" already in use by volume \"${volumeName}\".`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}/mount`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: mount,\n },\n });\n }\n\n mounts[mount] = storageName;\n });\n }\n\n #validateStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n storages.forEach((storage) => {\n const persistent = stringToBoolean(storage.attributes?.persistent as string | boolean || false);\n\n if (persistent && !service?.params?.storage?.[storage.name || \"\"]?.mount) {\n this.#errors.push({\n message: `Persistent storage \"${storage.name || \"default\"}\" requires a mount path in /services/${serviceName}/params/storage/${storage.name || \"default\"}/mount.`,\n instancePath: `/services/${serviceName}/params/storage/${storage.name || \"default\"}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"required\",\n params: {\n missingProperty: \"mount\",\n },\n });\n }\n });\n }\n\n #validateGPU(serviceName: string, deploymentName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n const compute = this.#sdl.profiles?.compute?.[deployment[deploymentName]?.profile];\n const gpu = compute?.resources.gpu;\n if (!gpu) return;\n\n const hasUnits = gpu.units !== undefined && gpu.units !== 0;\n const hasAttributes = typeof gpu.attributes !== \"undefined\";\n const hasVendor = hasAttributes && typeof gpu.attributes?.vendor !== \"undefined\";\n\n const profile = deployment[deploymentName]?.profile;\n const gpuPath = `/profiles/compute/${profile}/resources/gpu`;\n\n if (!hasUnits && hasAttributes) {\n this.#errors.push({\n message: \"GPU must not have attributes if units is 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasAttributes) {\n this.#errors.push({\n message: \"GPU must have attributes if units is not 0.\",\n instancePath: gpuPath,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu\",\n keyword: \"required\",\n params: {\n missingProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasVendor) {\n this.#errors.push({\n message: \"GPU must specify a vendor if units is not 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes/properties/vendor\",\n keyword: \"required\",\n params: {\n missingProperty: \"vendor\",\n },\n });\n }\n }\n\n // Mirrors Go `validateTEEWithGPU` (go/sdl/tee.go): the `cpu-gpu` TEE type\n // requires GPU resources on the resolved compute profile. `cpu` (and absent)\n // need no GPU. Unsupported tee values are rejected structurally by the input\n // schema (`tee` enum in validateSDLInput.ts) before this runs.\n #validateTEE(serviceName: string, deploymentName: string) {\n const tee = this.#sdl.services?.[serviceName]?.params?.tee;\n if (tee !== \"cpu-gpu\") return;\n\n const profile = this.#sdl.deployment[serviceName]?.[deploymentName]?.profile;\n const gpu = this.#sdl.profiles?.compute?.[profile]?.resources.gpu;\n const hasGpu = gpu?.units !== undefined && gpu.units !== 0;\n\n if (!hasGpu) {\n this.#errors.push({\n message: `Service \"${serviceName}\" tee type requires gpu resources.`,\n instancePath: `/services/${serviceName}/params/tee`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/tee\",\n keyword: \"required\",\n params: {\n missingProperty: \"gpu\",\n },\n });\n }\n }\n\n #validateLeaseIP(serviceName: string) {\n this.#sdl.services?.[serviceName]?.expose?.forEach((expose, exposeIndex) => {\n const proto = expose.proto?.toUpperCase() || \"TCP\";\n\n expose.to?.forEach((to, toIndex) => {\n if (to.ip?.length) {\n const toPath = `/services/${serviceName}/expose/${exposeIndex}/to/${toIndex}`;\n\n if (!to.global) {\n this.#errors.push({\n message: `If an IP is declared, the directive must be declared as global.`,\n instancePath: `${toPath}/global`,\n schemaPath: \"#/definitions/exposeToWithIpEnforcesGlobal/then/properties/global/const\",\n keyword: \"const\",\n params: {\n allowedValue: true,\n },\n });\n }\n if (!this.#sdl.endpoints?.[to.ip]) {\n this.#errors.push({\n message: `Unknown endpoint \"${to.ip}\" for service \"${serviceName}\". Add it to the \"endpoints\" section.`,\n instancePath: `/endpoints/${to.ip}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"required\",\n params: {\n missingProperty: to.ip,\n },\n });\n }\n\n this.#endpointsUsed.add(to.ip);\n\n const externalPort = expose.as ?? expose.port;\n const portKey = `${to.ip}-${externalPort}-${proto}`;\n const otherServiceName = this.#portsUsed.get(portKey);\n\n if (this.#portsUsed.has(portKey)) {\n this.#errors.push({\n message: `IP endpoint \"${to.ip}\" port ${externalPort} protocol ${proto} already in use by service \"${otherServiceName}\".`,\n instancePath: `${toPath}/ip`,\n schemaPath: \"#/properties/services/additionalProperties/properties/expose/items/properties/to/items\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: portKey,\n },\n });\n }\n this.#portsUsed.set(portKey, serviceName);\n }\n });\n });\n }\n\n #validateEndpoints() {\n if (!this.#sdl.endpoints) return;\n\n Object.keys(this.#sdl.endpoints).forEach((endpoint) => {\n if (!this.#endpointsUsed.has(endpoint)) {\n this.#errors.push({\n message: `Endpoint \"${endpoint}\" declared but never used.`,\n instancePath: `/endpoints/${endpoint}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: endpoint,\n },\n });\n }\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;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