@akashnetwork/chain-sdk 1.0.0-alpha.23 → 1.0.0-alpha.24
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/sdl/SDL/SDL.cjs +11 -11
- package/dist/cjs/sdl/SDL/SDL.cjs.map +2 -2
- package/dist/cjs/sdl/types.cjs.map +1 -1
- package/dist/esm/{chunk-QSKWS3TI.js → chunk-RIIYZIXM.js} +12 -12
- package/dist/esm/chunk-RIIYZIXM.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.web.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/sdl/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/chunk-QSKWS3TI.js.map +0 -7
package/dist/cjs/sdl/SDL/SDL.cjs
CHANGED
|
@@ -361,20 +361,20 @@ const _SDL = class _SDL {
|
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
363
|
v3ManifestServiceParams(params) {
|
|
364
|
-
if (params === void 0) {
|
|
364
|
+
if (params === void 0 || Object.keys(params).length === 0) {
|
|
365
365
|
return null;
|
|
366
366
|
}
|
|
367
|
-
|
|
368
|
-
storage: Object.keys(params
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
readOnly: params.storage[name]?.readOnly || false
|
|
374
|
-
};
|
|
375
|
-
}),
|
|
376
|
-
...params?.permissions ? { permissions: params.permissions } : {}
|
|
367
|
+
const res = {
|
|
368
|
+
storage: params.storage && Object.keys(params.storage).length > 0 ? Object.keys(params.storage).map((name) => ({
|
|
369
|
+
name,
|
|
370
|
+
mount: params.storage[name]?.mount,
|
|
371
|
+
readOnly: params.storage[name]?.readOnly || false
|
|
372
|
+
})) : null
|
|
377
373
|
};
|
|
374
|
+
if (params.permissions) {
|
|
375
|
+
res.permissions = params.permissions;
|
|
376
|
+
}
|
|
377
|
+
return res;
|
|
378
378
|
}
|
|
379
379
|
v2ManifestService(placement, name, asString) {
|
|
380
380
|
const service = this.data.services[name];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdl/SDL/SDL.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport YAML from \"js-yaml\";\nimport { default as stableStringify } from \"json-stable-stringify\";\n\nimport { MAINNET_ID } from \"../../network/config.ts\";\nimport type { NetworkId } from \"../../network/types.ts\";\nimport { convertCpuResourceString, convertResourceString } from \"../sizes.ts\";\nimport type {\n v2ComputeResources,\n v2Expose,\n v2ExposeTo,\n v2HTTPOptions,\n v2Manifest,\n v2ManifestService,\n v2ManifestServiceParams,\n v2ProfileCompute,\n v2ResourceCPU,\n v2ResourceMemory,\n v2ResourceStorage,\n v2ResourceStorageArray,\n v2Sdl,\n v2Service,\n v2ServiceExpose,\n v2ServiceExposeHttpOptions,\n v2ServiceParams,\n v2StorageAttributes,\n v3ComputeResources,\n v3DeploymentGroup,\n v3GPUAttributes,\n v3Manifest,\n v3ManifestService,\n v3ManifestServiceParams,\n v3ProfileCompute,\n v3ResourceGPU,\n v3Sdl,\n v3ServiceExpose,\n v3ServiceExposeHttpOptions } from \"../types.ts\";\nimport type { SDLInput } from \"../validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"../validateSDL/validateSDL.ts\";\nimport { SdlValidationError } from \"./SdlValidationError.ts\";\n\nconst Endpoint_SHARED_HTTP = 0;\nconst Endpoint_RANDOM_PORT = 1;\nconst Endpoint_LEASED_IP = 2;\n\nfunction isArray<T>(obj: any): obj is Array<T> {\n return Array.isArray(obj);\n}\n\nfunction isString(str: any): str is string {\n return typeof str === \"string\";\n}\n\ntype NetworkVersion = \"beta2\" | \"beta3\";\n\n/**\n * SDL (Stack Definition Language) parser and validator\n * Handles parsing and validation of Akash deployment manifests\n *\n * @deprecated Use `generateManifest` instead.\n *\n * @example\n * ```ts\n * import { SDL } from './SDL';\n *\n * const yaml = `\n * version: \"2.0\"\n * services:\n * web:\n * image: nginx\n * expose:\n * - port: 80\n * as: 80\n * to:\n * - global: true\n * `;\n *\n * // Parse SDL from YAML string\n * const sdl = SDL.fromString(yaml);\n *\n * // Get deployment manifest\n * const manifest = sdl.manifest();\n *\n * // Get deployment groups\n * const groups = sdl.groups();\n * ```\n */\nexport class SDL {\n /**\n * Creates an SDL instance from a YAML string.\n *\n * @param {string} yaml - The YAML string containing the SDL definition.\n * @param {NetworkVersion} [version=\"beta3\"] - The SDL version (beta2 or beta3).\n * @param {NetworkId} [networkId=MAINNET_ID] - The network ID to validate against.\n * @returns {SDL} An instance of the SDL class.\n *\n * @example\n * ```ts\n * const yaml = `\n * version: \"2.0\"\n * services:\n * web:\n * image: nginx\n * expose:\n * - port: 80\n * as: 80\n * to:\n * - global: true\n * `;\n * const sdl = SDL.fromString(yaml);\n * ```\n */\n static fromString(yaml: string, version: NetworkVersion = \"beta3\", networkId: NetworkId = MAINNET_ID): SDL {\n const data = YAML.load(yaml) as v3Sdl;\n return new SDL(data, version, networkId);\n }\n\n constructor(\n public readonly data: v2Sdl,\n public readonly version: NetworkVersion = \"beta2\",\n networkId: NetworkId = MAINNET_ID,\n ) {\n const errors = validateSDL(data as unknown as SDLInput, networkId);\n if (errors) throw new SdlValidationError(errors[0].message);\n }\n\n services() {\n if (this.data) {\n return this.data.services;\n }\n\n return {};\n }\n\n deployments() {\n if (this.data) {\n return this.data.deployment;\n }\n\n return {};\n }\n\n profiles() {\n if (this.data) {\n return this.data.profiles;\n }\n\n return {};\n }\n\n placements() {\n const { placement } = this.data.profiles;\n\n return placement || {};\n }\n\n serviceNames() {\n const names = this.data ? Object.keys(this.data.services) : [];\n\n // TODO: sort these\n return names;\n }\n\n deploymentsByPlacement(placement: string) {\n const deployments = this.data ? this.data.deployment : [];\n\n return Object.entries(deployments as object).filter(({ 1: deployment }) => Object.prototype.hasOwnProperty.call(deployment, placement));\n }\n\n resourceUnit(val: string, asString: boolean) {\n return asString ? { val: `${convertResourceString(val)}` } : { val: convertResourceString(val) };\n }\n\n resourceValue(value: { toString: () => string } | null, asString: boolean) {\n if (value === null) {\n return value;\n }\n\n const strVal = value.toString();\n const encoder = new TextEncoder();\n\n return asString ? strVal : encoder.encode(strVal);\n }\n\n serviceResourceCpu(resource: v2ResourceCPU) {\n const units = isString(resource.units) ? convertCpuResourceString(resource.units) : resource.units * 1000;\n\n return resource.attributes\n ? {\n units: { val: `${units}` },\n attributes: this.serviceResourceAttributes(resource.attributes),\n }\n : {\n units: { val: `${units}` },\n };\n }\n\n serviceResourceMemory(resource: v2ResourceMemory, asString: boolean) {\n const key = asString ? \"quantity\" : \"size\";\n\n return resource.attributes\n ? {\n [key]: this.resourceUnit(resource.size, asString),\n attributes: this.serviceResourceAttributes(resource.attributes),\n }\n : {\n [key]: this.resourceUnit(resource.size, asString),\n };\n }\n\n serviceResourceStorage(resource: v2ResourceStorageArray | v2ResourceStorage, asString: boolean) {\n const key = asString ? \"quantity\" : \"size\";\n const storage = isArray(resource) ? resource : [resource];\n\n return storage.map((storage) =>\n storage.attributes\n ? {\n name: storage.name || \"default\",\n [key]: this.resourceUnit(storage.size, asString),\n attributes: this.serviceResourceStorageAttributes(storage.attributes),\n }\n : {\n name: storage.name || \"default\",\n [key]: this.resourceUnit(storage.size, asString),\n },\n );\n }\n\n serviceResourceAttributes(attributes?: Record<string, any>) {\n return (\n attributes\n && Object.keys(attributes)\n .sort()\n .map((key) => ({ key, value: attributes[key].toString() }))\n );\n }\n\n serviceResourceStorageAttributes(attributes?: v2StorageAttributes) {\n if (!attributes) return undefined;\n\n const pairs = Object.keys(attributes).map((key) => ({ key, value: attributes[key].toString() }));\n\n if (attributes.class === \"ram\" && !(\"persistent\" in attributes)) {\n pairs.push({ key: \"persistent\", value: \"false\" });\n }\n\n pairs.sort((a, b) => a.key.localeCompare(b.key));\n\n return pairs;\n }\n\n serviceResourceGpu(resource: v3ResourceGPU | undefined, asString: boolean) {\n const value = resource?.units || 0;\n const numVal = isString(value) ? Buffer.from(value, \"ascii\") : value;\n const strVal = !isString(value) ? value.toString() : value;\n\n return resource?.attributes\n ? {\n units: asString ? { val: strVal } : { val: numVal },\n attributes: this.transformGpuAttributes(resource?.attributes),\n }\n : {\n units: asString ? { val: strVal } : { val: numVal },\n };\n }\n\n v2ServiceResourceEndpoints(service: v2Service) {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n const endpoints = service.expose.flatMap((expose) =>\n expose.to\n ? expose.to\n .filter((to) => to.global && to.ip?.length > 0)\n .map((to) => ({\n kind: Endpoint_LEASED_IP,\n sequence_number: endpointSequenceNumbers[to.ip] || 0,\n }))\n : [],\n );\n\n return endpoints.length > 0 ? endpoints : null;\n }\n\n v3ServiceResourceEndpoints(service: v2Service) {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n const endpoints = service.expose.flatMap((expose) =>\n expose.to\n ? expose.to\n .filter((to) => to.global)\n .flatMap((to) => {\n const exposeSpec = {\n port: expose.port,\n externalPort: expose.as || 0,\n proto: this.parseServiceProto(expose.proto),\n global: !!to.global,\n };\n\n const kind = this.exposeShouldBeIngress(exposeSpec) ? Endpoint_SHARED_HTTP : Endpoint_RANDOM_PORT;\n\n const defaultEp = kind !== 0 ? { kind: kind, sequence_number: 0 } : { sequence_number: 0 };\n\n const leasedEp\n = to.ip?.length > 0\n ? {\n kind: Endpoint_LEASED_IP,\n sequence_number: endpointSequenceNumbers[to.ip] || 0,\n }\n : undefined;\n\n return leasedEp ? [defaultEp, leasedEp] : [defaultEp];\n })\n : [],\n );\n\n return endpoints;\n }\n\n serviceResourcesBeta2(profile: v2ProfileCompute, service: v2Service, asString: boolean = false) {\n return {\n cpu: this.serviceResourceCpu(profile.resources.cpu),\n memory: this.serviceResourceMemory(profile.resources.memory, asString),\n storage: this.serviceResourceStorage(profile.resources.storage, asString),\n endpoints: this.v2ServiceResourceEndpoints(service),\n };\n }\n\n serviceResourcesBeta3(id: number, profile: v3ProfileCompute, service: v2Service, asString: boolean = false) {\n return {\n id: id,\n cpu: this.serviceResourceCpu(profile.resources.cpu),\n memory: this.serviceResourceMemory(profile.resources.memory, asString),\n storage: this.serviceResourceStorage(profile.resources.storage, asString),\n gpu: this.serviceResourceGpu(profile.resources.gpu, asString),\n endpoints: this.v3ServiceResourceEndpoints(service),\n };\n }\n\n /**\n * Parses the service protocol.\n *\n * @param proto - The protocol string (e.g., \"TCP\", \"UDP\").\n * @returns The parsed protocol.\n * @throws Will throw an error if the protocol is unsupported.\n *\n * @example\n * ```ts\n * const protocol = SDL.parseServiceProto(\"TCP\");\n * // protocol is \"TCP\"\n * ```\n */\n parseServiceProto(proto?: string): string {\n const raw = proto?.toUpperCase() || \"TCP\";\n if (raw === \"TCP\" || raw === \"UDP\") return raw;\n\n throw new SdlValidationError(`Unsupported service protocol: \"${proto}\". Supported protocols are \"TCP\" and \"UDP\".`);\n }\n\n manifestExposeService(to: v2ExposeTo) {\n return to.service || \"\";\n }\n\n manifestExposeGlobal(to: v2ExposeTo) {\n return to.global || false;\n }\n\n manifestExposeHosts(expose: v2Expose) {\n return expose.accept || null;\n }\n\n v2HttpOptions(http_options: v2HTTPOptions | undefined) {\n const defaults = {\n MaxBodySize: 1048576,\n ReadTimeout: 60000,\n SendTimeout: 60000,\n NextTries: 3,\n NextTimeout: 0,\n NextCases: [\"error\", \"timeout\"],\n };\n\n if (!http_options) {\n return { ...defaults };\n }\n\n return {\n MaxBodySize: http_options.max_body_size || defaults.MaxBodySize,\n ReadTimeout: http_options.read_timeout || defaults.ReadTimeout,\n SendTimeout: http_options.send_timeout || defaults.SendTimeout,\n NextTries: http_options.next_tries || defaults.NextTries,\n NextTimeout: http_options.next_timeout || defaults.NextTimeout,\n NextCases: http_options.next_cases || defaults.NextCases,\n };\n }\n\n v3HttpOptions(http_options: v2HTTPOptions | undefined) {\n const defaults = {\n maxBodySize: 1048576,\n readTimeout: 60000,\n sendTimeout: 60000,\n nextTries: 3,\n nextTimeout: 0,\n nextCases: [\"error\", \"timeout\"],\n };\n\n if (!http_options) {\n return { ...defaults };\n }\n\n return {\n maxBodySize: http_options.max_body_size || defaults.maxBodySize,\n readTimeout: http_options.read_timeout || defaults.readTimeout,\n sendTimeout: http_options.send_timeout || defaults.sendTimeout,\n nextTries: http_options.next_tries || defaults.nextTries,\n nextTimeout: http_options.next_timeout || defaults.nextTimeout,\n nextCases: http_options.next_cases || defaults.nextCases,\n };\n }\n\n v2ManifestExposeHttpOptions(expose: v2Expose): v2ServiceExposeHttpOptions {\n return this.v2HttpOptions(expose.http_options);\n }\n\n v3ManifestExposeHttpOptions(expose: v2Expose): v3ServiceExposeHttpOptions {\n return this.v3HttpOptions(expose.http_options);\n }\n\n v2ManifestExpose(service: v2Service): v2ServiceExpose[] {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n return service.expose.flatMap((expose) =>\n expose.to\n ? expose.to.map((to) => ({\n Port: expose.port,\n ExternalPort: expose.as || 0,\n Proto: this.parseServiceProto(expose.proto),\n Service: this.manifestExposeService(to),\n Global: this.manifestExposeGlobal(to),\n Hosts: this.manifestExposeHosts(expose),\n HTTPOptions: this.v2ManifestExposeHttpOptions(expose),\n IP: to.ip || \"\",\n EndpointSequenceNumber: endpointSequenceNumbers[to.ip] || 0,\n }))\n : [],\n );\n }\n\n v3ManifestExpose(service: v2Service): v3ServiceExpose[] {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n return service.expose\n .flatMap((expose) =>\n expose.to\n ? expose.to.map((to) => ({\n port: expose.port,\n externalPort: expose.as || 0,\n proto: this.parseServiceProto(expose.proto),\n service: this.manifestExposeService(to),\n global: this.manifestExposeGlobal(to),\n hosts: this.manifestExposeHosts(expose),\n httpOptions: this.v3ManifestExposeHttpOptions(expose),\n ip: to.ip || \"\",\n endpointSequenceNumber: endpointSequenceNumbers[to.ip] || 0,\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\n return 0;\n });\n }\n\n v2ManifestServiceParams(params: v2ServiceParams): v2ManifestServiceParams | undefined {\n return {\n Storage: Object.keys(params?.storage ?? {}).map((name) => {\n if (!params?.storage) throw new Error(\"Storage is undefined\");\n return {\n name: name,\n mount: params.storage[name].mount,\n readOnly: params.storage[name].readOnly || false,\n };\n }),\n ...(params?.permissions ? { Permissions: params.permissions } : {}),\n };\n }\n\n v3ManifestServiceParams(params: v2ServiceParams | undefined): v3ManifestServiceParams | null {\n if (params === undefined) {\n return null;\n }\n\n return {\n storage: Object.keys(params?.storage ?? {}).map((name) => {\n if (!params?.storage) throw new Error(\"Storage is undefined\");\n return {\n name: name,\n mount: params.storage[name]?.mount,\n readOnly: params.storage[name]?.readOnly || false,\n };\n }),\n ...(params?.permissions ? { permissions: params.permissions } : {}),\n };\n }\n\n v2ManifestService(placement: string, name: string, asString: boolean): v2ManifestService {\n const service = this.data.services[name];\n const deployment = this.data.deployment[name];\n const profile = this.data.profiles.compute[deployment[placement].profile];\n\n const manifestService: v2ManifestService = {\n Name: name,\n Image: service.image,\n Command: service.command || null,\n Args: service.args || null,\n Env: service.env || null,\n Resources: this.serviceResourcesBeta2(profile, service, asString),\n Count: deployment[placement].count,\n Expose: this.v2ManifestExpose(service),\n };\n\n if (service.params) {\n manifestService.params = this.v2ManifestServiceParams(service.params);\n }\n\n return manifestService;\n }\n\n v3ManifestService(id: number, placement: string, name: string, asString: boolean): v3ManifestService {\n const service = this.data.services[name];\n const deployment = this.data.deployment[name];\n const profile = this.data.profiles.compute[deployment[placement].profile];\n const credentials = service.credentials || null;\n\n if (credentials && !credentials.email) {\n credentials.email = \"\";\n }\n\n const manifestService: v3ManifestService = {\n name: name,\n image: service.image,\n command: service.command || null,\n args: service.args || null,\n env: service.env || null,\n resources: this.serviceResourcesBeta3(id, profile as v3ProfileCompute, service, asString),\n count: deployment[placement].count,\n expose: this.v3ManifestExpose(service),\n params: this.v3ManifestServiceParams(service.params),\n credentials,\n };\n\n if (!manifestService.params) {\n delete manifestService.params;\n }\n\n return manifestService;\n }\n\n v2Manifest(asString: boolean = false): v2Manifest {\n return Object.keys(this.placements()).map((name) => ({\n Name: name,\n Services: this.deploymentsByPlacement(name).map(([service]) => this.v2ManifestService(name, service, asString)),\n }));\n }\n\n v3Manifest(asString: boolean = false): v3Manifest {\n const groups = this.v3Groups();\n const serviceId = (pIdx: number, sIdx: number) => groups[pIdx].resources[sIdx].resource.id;\n\n return Object.keys(this.placements()).map((name, pIdx) => ({\n name: name,\n services: this.deploymentsByPlacement(name)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([service], idx) => this.v3ManifestService(serviceId(pIdx, idx), name, service, asString)),\n }));\n }\n\n manifest(asString: boolean = false): v2Manifest | v3Manifest {\n return this.version === \"beta2\" ? this.v2Manifest(asString) : this.v3Manifest(asString);\n }\n\n /**\n * Computes the endpoint sequence numbers for the given SDL.\n *\n * @param sdl - The SDL data.\n * @returns An object mapping IPs to their sequence numbers.\n *\n * @example\n * ```ts\n * const sequenceNumbers = sdl.computeEndpointSequenceNumbers(sdlData);\n * // sequenceNumbers might be { \"192.168.1.1\": 1, \"192.168.1.2\": 2 }\n * ```\n */\n computeEndpointSequenceNumbers(sdl: v2Sdl) {\n return Object.fromEntries(\n Object.values(sdl.services).flatMap((service) =>\n service.expose.flatMap((expose) =>\n expose.to\n ? expose.to\n .filter((to) => to.global && to.ip?.length > 0)\n .map((to) => to.ip)\n .sort()\n .map((ip, index) => [ip, index + 1])\n : [],\n ),\n ),\n );\n }\n\n resourceUnitCpu(computeResources: v2ComputeResources, asString: boolean) {\n const attributes = computeResources.cpu.attributes;\n const cpu = isString(computeResources.cpu.units) ? convertCpuResourceString(computeResources.cpu.units) : computeResources.cpu.units * 1000;\n\n return {\n units: { val: this.resourceValue(cpu, asString) },\n attributes:\n attributes\n && Object.entries(attributes)\n .sort(([k0], [k1]) => k0.localeCompare(k1))\n .map(([key, value]) => ({\n key: key,\n value: value.toString(),\n })),\n };\n }\n\n resourceUnitMemory(computeResources: v2ComputeResources, asString: boolean) {\n const attributes = computeResources.memory.attributes;\n\n return {\n quantity: {\n val: this.resourceValue(convertResourceString(computeResources.memory.size), asString),\n },\n attributes:\n attributes\n && Object.entries(attributes)\n .sort(([k0], [k1]) => k0.localeCompare(k1))\n .map(([key, value]) => ({\n key: key,\n value: value.toString(),\n })),\n };\n }\n\n resourceUnitStorage(computeResources: v2ComputeResources, asString: boolean) {\n const storages = isArray(computeResources.storage) ? computeResources.storage : [computeResources.storage];\n\n return storages.map((storage) => ({\n name: storage.name || \"default\",\n quantity: {\n val: this.resourceValue(convertResourceString(storage.size), asString),\n },\n attributes: this.serviceResourceStorageAttributes(storage.attributes),\n }));\n }\n\n transformGpuAttributes(attributes: v3GPUAttributes): Array<{ key: string; value: string }> {\n return Object.entries(attributes.vendor).flatMap(([vendor, models]) =>\n models\n ? models.map((model) => {\n let key = `vendor/${vendor}/model/${model.model}`;\n\n if (model.ram) {\n key += `/ram/${model.ram}`;\n }\n\n if (model.interface) {\n key += `/interface/${model.interface}`;\n }\n\n return {\n key: key,\n value: \"true\",\n };\n })\n : [\n {\n key: `vendor/${vendor}/model/*`,\n value: \"true\",\n },\n ],\n );\n }\n\n resourceUnitGpu(computeResources: v3ComputeResources, asString: boolean) {\n const attributes = computeResources.gpu?.attributes;\n const units = computeResources.gpu?.units || \"0\";\n const gpu = isString(units) ? parseInt(units) : units;\n\n return {\n units: { val: this.resourceValue(gpu, asString) },\n attributes: attributes && this.transformGpuAttributes(attributes),\n };\n }\n\n groupResourceUnits(resource: v2ComputeResources | undefined, asString: boolean) {\n if (!resource) return {};\n\n const units = {\n endpoints: null,\n } as any;\n\n if (resource.cpu) {\n units.cpu = this.resourceUnitCpu(resource, asString);\n }\n\n if (resource.memory) {\n units.memory = this.resourceUnitMemory(resource, asString);\n }\n\n if (resource.storage) {\n units.storage = this.resourceUnitStorage(resource, asString);\n }\n\n if (this.version === \"beta3\") {\n units.gpu = this.resourceUnitGpu(resource as v3ComputeResources, asString);\n }\n\n return units;\n }\n\n exposeShouldBeIngress(expose: { proto: string; global: boolean; externalPort: number; port: number }) {\n const externalPort = expose.externalPort === 0 ? expose.port : expose.externalPort;\n\n return expose.global && expose.proto === \"TCP\" && externalPort === 80;\n }\n\n groups() {\n return this.version === \"beta2\" ? this.v2Groups() : this.v3Groups();\n }\n\n v3Groups() {\n const groups = new Map<\n string,\n {\n dgroup: v3DeploymentGroup;\n boundComputes: Record<string, Record<string, number>>;\n }\n >();\n const services = Object.entries(this.data.services).sort(([a], [b]) => a.localeCompare(b));\n\n for (const [svcName, service] of services) {\n for (const [placementName, svcdepl] of Object.entries(this.data.deployment[svcName])) {\n // objects below have been ensured to exist\n const compute = this.data.profiles.compute[svcdepl.profile];\n const infra = this.data.profiles.placement[placementName];\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n ...pricing,\n amount: pricing.amount?.toString(),\n };\n\n let group = groups.get(placementName);\n\n if (!group) {\n const attributes = (infra.attributes\n ? Object.entries(infra.attributes).map(([key, value]) => ({\n key,\n value,\n }))\n : []) as unknown as Array<{ key: string; value: string }>;\n\n attributes.sort((a, b) => a.key.localeCompare(b.key));\n\n group = {\n dgroup: {\n name: placementName,\n resources: [],\n requirements: {\n attributes: attributes,\n signedBy: {\n allOf: infra.signedBy?.allOf || [],\n anyOf: infra.signedBy?.anyOf || [],\n },\n },\n },\n boundComputes: {},\n };\n\n groups.set(placementName, group);\n }\n\n if (!group.boundComputes[placementName]) {\n group.boundComputes[placementName] = {};\n }\n\n // const resources = this.serviceResourcesBeta3(0, compute as v3ProfileCompute, service, false);\n const location = group.boundComputes[placementName][svcdepl.profile];\n\n if (!location) {\n const res = this.groupResourceUnits(compute.resources, false);\n res.endpoints = this.v3ServiceResourceEndpoints(service);\n\n const resID = group.dgroup.resources.length > 0 ? group.dgroup.resources.length + 1 : 1;\n res.id = resID;\n // resources.id = res.id;\n\n group.dgroup.resources.push({\n resource: res,\n price: price,\n count: svcdepl.count,\n } as any);\n\n group.boundComputes[placementName][svcdepl.profile] = group.dgroup.resources.length - 1;\n } else {\n const endpoints = this.v3ServiceResourceEndpoints(service);\n // resources.id = group.dgroup.resources[location].id;\n\n group.dgroup.resources[location].count += svcdepl.count;\n group.dgroup.resources[location].endpoints += endpoints as any;\n group.dgroup.resources[location].endpoints.sort();\n }\n }\n }\n\n // keep ordering stable\n const names: string[] = [...groups.keys()].sort();\n return names.map((name) => groups.get(name)).map((group) => (group ? (group.dgroup as typeof group.dgroup) : {})) as Array<v3DeploymentGroup>;\n }\n\n v2Groups() {\n const yamlJson = this.data;\n const ipEndpointNames = this.computeEndpointSequenceNumbers(yamlJson);\n\n const groups = {} as any;\n\n Object.keys(yamlJson.services).forEach((svcName) => {\n const svc = yamlJson.services[svcName];\n const depl = yamlJson.deployment[svcName];\n\n Object.keys(depl).forEach((placementName) => {\n const svcdepl = depl[placementName];\n const compute = yamlJson.profiles.compute[svcdepl.profile];\n const infra = yamlJson.profiles.placement[placementName];\n\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n ...pricing,\n amount: pricing.amount.toString(),\n };\n\n let group = groups[placementName];\n\n if (!group) {\n group = {\n name: placementName,\n requirements: {\n attributes: infra.attributes\n ? Object.entries(infra.attributes).map(([key, value]) => ({\n key,\n value,\n }))\n : [],\n signedBy: {\n allOf: infra.signedBy?.allOf || [],\n anyOf: infra.signedBy?.anyOf || [],\n },\n },\n resources: [],\n };\n\n if (group.requirements.attributes) {\n group.requirements.attributes = group.requirements.attributes.sort((a: any, b: any) => a.key < b.key);\n }\n\n groups[group.name] = group;\n }\n\n const resources = {\n resources: this.groupResourceUnits(compute.resources, false), // Changed resources => unit\n price: price,\n count: svcdepl.count,\n };\n\n const endpoints = [] as any[];\n svc?.expose?.forEach((expose) => {\n expose?.to\n ?.filter((to) => to.global)\n .forEach((to) => {\n const exposeSpec = {\n port: expose.port,\n externalPort: expose.as || 0,\n proto: this.parseServiceProto(expose.proto),\n global: !!to.global,\n };\n\n if (to.ip?.length > 0) {\n const seqNo = ipEndpointNames[to.ip];\n endpoints.push({\n kind: Endpoint_LEASED_IP,\n sequence_number: seqNo,\n });\n }\n\n const kind = this.exposeShouldBeIngress(exposeSpec) ? Endpoint_SHARED_HTTP : Endpoint_RANDOM_PORT;\n\n endpoints.push({ kind: kind, sequence_number: 0 });\n });\n });\n\n resources.resources.endpoints = endpoints;\n group.resources.push(resources);\n });\n });\n\n return Object.keys(groups)\n .sort((a, b) => (a < b ? 1 : 0))\n .map((name) => groups[name]);\n }\n\n /**\n * Escapes HTML characters in a string.\n *\n * @param raw - The raw string to escape.\n * @returns The escaped string.\n *\n * @example\n * ```ts\n * const escaped = sdl.escapeHtml(\"<div>Hello</div>\");\n * // escaped is \"\\\\u003cdiv\\\\u003eHello\\\\u003c/div\\\\u003e\"\n * ```\n */\n #escapeHtml(raw: string) {\n return raw.replace(/</g, \"\\\\u003c\").replace(/>/g, \"\\\\u003e\").replace(/&/g, \"\\\\u0026\");\n }\n\n manifestSortedJSON() {\n const manifest = this.manifest(true);\n let jsonStr = JSON.stringify(manifest);\n\n if (jsonStr) {\n jsonStr = jsonStr.replaceAll(\"\\\"quantity\\\":{\\\"val\", \"\\\"size\\\":{\\\"val\");\n }\n\n return this.#escapeHtml(stableStringify(JSON.parse(jsonStr)) || \"\");\n }\n\n async manifestVersion() {\n const jsonStr = this.manifestSortedJSON();\n const enc = new TextEncoder();\n const sortedBytes = enc.encode(jsonStr);\n const sum = await crypto.subtle.digest(\"SHA-256\", sortedBytes);\n\n return new Uint8Array(sum);\n }\n\n manifestSorted() {\n const sorted = this.manifestSortedJSON();\n return JSON.parse(sorted);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAiB;AACjB,m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cAAc,IAAI,OAAO,OAAO;AACtC,UAAM,MAAM,MAAM,OAAO,OAAO,OAAO,WAAW,WAAW;AAE7D,WAAO,IAAI,WAAW,GAAG;AAAA,EAC3B;AAAA,EAEA,iBAAiB;AACf,UAAM,SAAS,KAAK,mBAAmB;AACvC,WAAO,KAAK,MAAM,MAAM;AAAA,EAC1B;AACF;AA71BO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAi0BL,gBAAW,SAAC,KAAa;AACvB,SAAO,IAAI,QAAQ,MAAM,SAAS,EAAE,QAAQ,MAAM,SAAS,EAAE,QAAQ,MAAM,SAAS;AACtF;AAn0BK,IAAM,MAAN;",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport YAML from \"js-yaml\";\nimport { default as stableStringify } from \"json-stable-stringify\";\n\nimport { MAINNET_ID } from \"../../network/config.ts\";\nimport type { NetworkId } from \"../../network/types.ts\";\nimport { convertCpuResourceString, convertResourceString } from \"../sizes.ts\";\nimport type {\n v2ComputeResources,\n v2Expose,\n v2ExposeTo,\n v2HTTPOptions,\n v2Manifest,\n v2ManifestService,\n v2ManifestServiceParams,\n v2ProfileCompute,\n v2ResourceCPU,\n v2ResourceMemory,\n v2ResourceStorage,\n v2ResourceStorageArray,\n v2Sdl,\n v2Service,\n v2ServiceExpose,\n v2ServiceExposeHttpOptions,\n v2ServiceParams,\n v2StorageAttributes,\n v3ComputeResources,\n v3DeploymentGroup,\n v3GPUAttributes,\n v3Manifest,\n v3ManifestService,\n v3ManifestServiceParams,\n v3ProfileCompute,\n v3ResourceGPU,\n v3Sdl,\n v3ServiceExpose,\n v3ServiceExposeHttpOptions } from \"../types.ts\";\nimport type { SDLInput } from \"../validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"../validateSDL/validateSDL.ts\";\nimport { SdlValidationError } from \"./SdlValidationError.ts\";\n\nconst Endpoint_SHARED_HTTP = 0;\nconst Endpoint_RANDOM_PORT = 1;\nconst Endpoint_LEASED_IP = 2;\n\nfunction isArray<T>(obj: any): obj is Array<T> {\n return Array.isArray(obj);\n}\n\nfunction isString(str: any): str is string {\n return typeof str === \"string\";\n}\n\ntype NetworkVersion = \"beta2\" | \"beta3\";\n\n/**\n * SDL (Stack Definition Language) parser and validator\n * Handles parsing and validation of Akash deployment manifests\n *\n * @deprecated Use `generateManifest` instead.\n *\n * @example\n * ```ts\n * import { SDL } from './SDL';\n *\n * const yaml = `\n * version: \"2.0\"\n * services:\n * web:\n * image: nginx\n * expose:\n * - port: 80\n * as: 80\n * to:\n * - global: true\n * `;\n *\n * // Parse SDL from YAML string\n * const sdl = SDL.fromString(yaml);\n *\n * // Get deployment manifest\n * const manifest = sdl.manifest();\n *\n * // Get deployment groups\n * const groups = sdl.groups();\n * ```\n */\nexport class SDL {\n /**\n * Creates an SDL instance from a YAML string.\n *\n * @param {string} yaml - The YAML string containing the SDL definition.\n * @param {NetworkVersion} [version=\"beta3\"] - The SDL version (beta2 or beta3).\n * @param {NetworkId} [networkId=MAINNET_ID] - The network ID to validate against.\n * @returns {SDL} An instance of the SDL class.\n *\n * @example\n * ```ts\n * const yaml = `\n * version: \"2.0\"\n * services:\n * web:\n * image: nginx\n * expose:\n * - port: 80\n * as: 80\n * to:\n * - global: true\n * `;\n * const sdl = SDL.fromString(yaml);\n * ```\n */\n static fromString(yaml: string, version: NetworkVersion = \"beta3\", networkId: NetworkId = MAINNET_ID): SDL {\n const data = YAML.load(yaml) as v3Sdl;\n return new SDL(data, version, networkId);\n }\n\n constructor(\n public readonly data: v2Sdl,\n public readonly version: NetworkVersion = \"beta2\",\n networkId: NetworkId = MAINNET_ID,\n ) {\n const errors = validateSDL(data as unknown as SDLInput, networkId);\n if (errors) throw new SdlValidationError(errors[0].message);\n }\n\n services() {\n if (this.data) {\n return this.data.services;\n }\n\n return {};\n }\n\n deployments() {\n if (this.data) {\n return this.data.deployment;\n }\n\n return {};\n }\n\n profiles() {\n if (this.data) {\n return this.data.profiles;\n }\n\n return {};\n }\n\n placements() {\n const { placement } = this.data.profiles;\n\n return placement || {};\n }\n\n serviceNames() {\n const names = this.data ? Object.keys(this.data.services) : [];\n\n // TODO: sort these\n return names;\n }\n\n deploymentsByPlacement(placement: string) {\n const deployments = this.data ? this.data.deployment : [];\n\n return Object.entries(deployments as object).filter(({ 1: deployment }) => Object.prototype.hasOwnProperty.call(deployment, placement));\n }\n\n resourceUnit(val: string, asString: boolean) {\n return asString ? { val: `${convertResourceString(val)}` } : { val: convertResourceString(val) };\n }\n\n resourceValue(value: { toString: () => string } | null, asString: boolean) {\n if (value === null) {\n return value;\n }\n\n const strVal = value.toString();\n const encoder = new TextEncoder();\n\n return asString ? strVal : encoder.encode(strVal);\n }\n\n serviceResourceCpu(resource: v2ResourceCPU) {\n const units = isString(resource.units) ? convertCpuResourceString(resource.units) : resource.units * 1000;\n\n return resource.attributes\n ? {\n units: { val: `${units}` },\n attributes: this.serviceResourceAttributes(resource.attributes),\n }\n : {\n units: { val: `${units}` },\n };\n }\n\n serviceResourceMemory(resource: v2ResourceMemory, asString: boolean) {\n const key = asString ? \"quantity\" : \"size\";\n\n return resource.attributes\n ? {\n [key]: this.resourceUnit(resource.size, asString),\n attributes: this.serviceResourceAttributes(resource.attributes),\n }\n : {\n [key]: this.resourceUnit(resource.size, asString),\n };\n }\n\n serviceResourceStorage(resource: v2ResourceStorageArray | v2ResourceStorage, asString: boolean) {\n const key = asString ? \"quantity\" : \"size\";\n const storage = isArray(resource) ? resource : [resource];\n\n return storage.map((storage) =>\n storage.attributes\n ? {\n name: storage.name || \"default\",\n [key]: this.resourceUnit(storage.size, asString),\n attributes: this.serviceResourceStorageAttributes(storage.attributes),\n }\n : {\n name: storage.name || \"default\",\n [key]: this.resourceUnit(storage.size, asString),\n },\n );\n }\n\n serviceResourceAttributes(attributes?: Record<string, any>) {\n return (\n attributes\n && Object.keys(attributes)\n .sort()\n .map((key) => ({ key, value: attributes[key].toString() }))\n );\n }\n\n serviceResourceStorageAttributes(attributes?: v2StorageAttributes) {\n if (!attributes) return undefined;\n\n const pairs = Object.keys(attributes).map((key) => ({ key, value: attributes[key].toString() }));\n\n if (attributes.class === \"ram\" && !(\"persistent\" in attributes)) {\n pairs.push({ key: \"persistent\", value: \"false\" });\n }\n\n pairs.sort((a, b) => a.key.localeCompare(b.key));\n\n return pairs;\n }\n\n serviceResourceGpu(resource: v3ResourceGPU | undefined, asString: boolean) {\n const value = resource?.units || 0;\n const numVal = isString(value) ? Buffer.from(value, \"ascii\") : value;\n const strVal = !isString(value) ? value.toString() : value;\n\n return resource?.attributes\n ? {\n units: asString ? { val: strVal } : { val: numVal },\n attributes: this.transformGpuAttributes(resource?.attributes),\n }\n : {\n units: asString ? { val: strVal } : { val: numVal },\n };\n }\n\n v2ServiceResourceEndpoints(service: v2Service) {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n const endpoints = service.expose.flatMap((expose) =>\n expose.to\n ? expose.to\n .filter((to) => to.global && to.ip?.length > 0)\n .map((to) => ({\n kind: Endpoint_LEASED_IP,\n sequence_number: endpointSequenceNumbers[to.ip] || 0,\n }))\n : [],\n );\n\n return endpoints.length > 0 ? endpoints : null;\n }\n\n v3ServiceResourceEndpoints(service: v2Service) {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n const endpoints = service.expose.flatMap((expose) =>\n expose.to\n ? expose.to\n .filter((to) => to.global)\n .flatMap((to) => {\n const exposeSpec = {\n port: expose.port,\n externalPort: expose.as || 0,\n proto: this.parseServiceProto(expose.proto),\n global: !!to.global,\n };\n\n const kind = this.exposeShouldBeIngress(exposeSpec) ? Endpoint_SHARED_HTTP : Endpoint_RANDOM_PORT;\n\n const defaultEp = kind !== 0 ? { kind: kind, sequence_number: 0 } : { sequence_number: 0 };\n\n const leasedEp\n = to.ip?.length > 0\n ? {\n kind: Endpoint_LEASED_IP,\n sequence_number: endpointSequenceNumbers[to.ip] || 0,\n }\n : undefined;\n\n return leasedEp ? [defaultEp, leasedEp] : [defaultEp];\n })\n : [],\n );\n\n return endpoints;\n }\n\n serviceResourcesBeta2(profile: v2ProfileCompute, service: v2Service, asString: boolean = false) {\n return {\n cpu: this.serviceResourceCpu(profile.resources.cpu),\n memory: this.serviceResourceMemory(profile.resources.memory, asString),\n storage: this.serviceResourceStorage(profile.resources.storage, asString),\n endpoints: this.v2ServiceResourceEndpoints(service),\n };\n }\n\n serviceResourcesBeta3(id: number, profile: v3ProfileCompute, service: v2Service, asString: boolean = false) {\n return {\n id: id,\n cpu: this.serviceResourceCpu(profile.resources.cpu),\n memory: this.serviceResourceMemory(profile.resources.memory, asString),\n storage: this.serviceResourceStorage(profile.resources.storage, asString),\n gpu: this.serviceResourceGpu(profile.resources.gpu, asString),\n endpoints: this.v3ServiceResourceEndpoints(service),\n };\n }\n\n /**\n * Parses the service protocol.\n *\n * @param proto - The protocol string (e.g., \"TCP\", \"UDP\").\n * @returns The parsed protocol.\n * @throws Will throw an error if the protocol is unsupported.\n *\n * @example\n * ```ts\n * const protocol = SDL.parseServiceProto(\"TCP\");\n * // protocol is \"TCP\"\n * ```\n */\n parseServiceProto(proto?: string): string {\n const raw = proto?.toUpperCase() || \"TCP\";\n if (raw === \"TCP\" || raw === \"UDP\") return raw;\n\n throw new SdlValidationError(`Unsupported service protocol: \"${proto}\". Supported protocols are \"TCP\" and \"UDP\".`);\n }\n\n manifestExposeService(to: v2ExposeTo) {\n return to.service || \"\";\n }\n\n manifestExposeGlobal(to: v2ExposeTo) {\n return to.global || false;\n }\n\n manifestExposeHosts(expose: v2Expose) {\n return expose.accept || null;\n }\n\n v2HttpOptions(http_options: v2HTTPOptions | undefined) {\n const defaults = {\n MaxBodySize: 1048576,\n ReadTimeout: 60000,\n SendTimeout: 60000,\n NextTries: 3,\n NextTimeout: 0,\n NextCases: [\"error\", \"timeout\"],\n };\n\n if (!http_options) {\n return { ...defaults };\n }\n\n return {\n MaxBodySize: http_options.max_body_size || defaults.MaxBodySize,\n ReadTimeout: http_options.read_timeout || defaults.ReadTimeout,\n SendTimeout: http_options.send_timeout || defaults.SendTimeout,\n NextTries: http_options.next_tries || defaults.NextTries,\n NextTimeout: http_options.next_timeout || defaults.NextTimeout,\n NextCases: http_options.next_cases || defaults.NextCases,\n };\n }\n\n v3HttpOptions(http_options: v2HTTPOptions | undefined) {\n const defaults = {\n maxBodySize: 1048576,\n readTimeout: 60000,\n sendTimeout: 60000,\n nextTries: 3,\n nextTimeout: 0,\n nextCases: [\"error\", \"timeout\"],\n };\n\n if (!http_options) {\n return { ...defaults };\n }\n\n return {\n maxBodySize: http_options.max_body_size || defaults.maxBodySize,\n readTimeout: http_options.read_timeout || defaults.readTimeout,\n sendTimeout: http_options.send_timeout || defaults.sendTimeout,\n nextTries: http_options.next_tries || defaults.nextTries,\n nextTimeout: http_options.next_timeout || defaults.nextTimeout,\n nextCases: http_options.next_cases || defaults.nextCases,\n };\n }\n\n v2ManifestExposeHttpOptions(expose: v2Expose): v2ServiceExposeHttpOptions {\n return this.v2HttpOptions(expose.http_options);\n }\n\n v3ManifestExposeHttpOptions(expose: v2Expose): v3ServiceExposeHttpOptions {\n return this.v3HttpOptions(expose.http_options);\n }\n\n v2ManifestExpose(service: v2Service): v2ServiceExpose[] {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n return service.expose.flatMap((expose) =>\n expose.to\n ? expose.to.map((to) => ({\n Port: expose.port,\n ExternalPort: expose.as || 0,\n Proto: this.parseServiceProto(expose.proto),\n Service: this.manifestExposeService(to),\n Global: this.manifestExposeGlobal(to),\n Hosts: this.manifestExposeHosts(expose),\n HTTPOptions: this.v2ManifestExposeHttpOptions(expose),\n IP: to.ip || \"\",\n EndpointSequenceNumber: endpointSequenceNumbers[to.ip] || 0,\n }))\n : [],\n );\n }\n\n v3ManifestExpose(service: v2Service): v3ServiceExpose[] {\n const endpointSequenceNumbers = this.computeEndpointSequenceNumbers(this.data);\n return service.expose\n .flatMap((expose) =>\n expose.to\n ? expose.to.map((to) => ({\n port: expose.port,\n externalPort: expose.as || 0,\n proto: this.parseServiceProto(expose.proto),\n service: this.manifestExposeService(to),\n global: this.manifestExposeGlobal(to),\n hosts: this.manifestExposeHosts(expose),\n httpOptions: this.v3ManifestExposeHttpOptions(expose),\n ip: to.ip || \"\",\n endpointSequenceNumber: endpointSequenceNumbers[to.ip] || 0,\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\n return 0;\n });\n }\n\n v2ManifestServiceParams(params: v2ServiceParams): v2ManifestServiceParams | undefined {\n return {\n Storage: Object.keys(params?.storage ?? {}).map((name) => {\n if (!params?.storage) throw new Error(\"Storage is undefined\");\n return {\n name: name,\n mount: params.storage[name].mount,\n readOnly: params.storage[name].readOnly || false,\n };\n }),\n ...(params?.permissions ? { Permissions: params.permissions } : {}),\n };\n }\n\n v3ManifestServiceParams(params: v2ServiceParams | undefined): v3ManifestServiceParams | null {\n if (params === undefined || Object.keys(params).length === 0) {\n return null;\n }\n\n const res: v3ManifestServiceParams = {\n storage:\n params.storage && Object.keys(params.storage).length > 0\n ? Object.keys(params.storage).map((name) => ({\n name: name,\n mount: params.storage![name]?.mount,\n readOnly: params.storage![name]?.readOnly || false,\n }))\n : null,\n };\n\n if (params.permissions) {\n res.permissions = params.permissions;\n }\n\n return res;\n }\n\n v2ManifestService(placement: string, name: string, asString: boolean): v2ManifestService {\n const service = this.data.services[name];\n const deployment = this.data.deployment[name];\n const profile = this.data.profiles.compute[deployment[placement].profile];\n\n const manifestService: v2ManifestService = {\n Name: name,\n Image: service.image,\n Command: service.command || null,\n Args: service.args || null,\n Env: service.env || null,\n Resources: this.serviceResourcesBeta2(profile, service, asString),\n Count: deployment[placement].count,\n Expose: this.v2ManifestExpose(service),\n };\n\n if (service.params) {\n manifestService.params = this.v2ManifestServiceParams(service.params);\n }\n\n return manifestService;\n }\n\n v3ManifestService(id: number, placement: string, name: string, asString: boolean): v3ManifestService {\n const service = this.data.services[name];\n const deployment = this.data.deployment[name];\n const profile = this.data.profiles.compute[deployment[placement].profile];\n const credentials = service.credentials || null;\n\n if (credentials && !credentials.email) {\n credentials.email = \"\";\n }\n\n const manifestService: v3ManifestService = {\n name: name,\n image: service.image,\n command: service.command || null,\n args: service.args || null,\n env: service.env || null,\n resources: this.serviceResourcesBeta3(id, profile as v3ProfileCompute, service, asString),\n count: deployment[placement].count,\n expose: this.v3ManifestExpose(service),\n params: this.v3ManifestServiceParams(service.params),\n credentials,\n };\n\n if (!manifestService.params) {\n delete manifestService.params;\n }\n\n return manifestService;\n }\n\n v2Manifest(asString: boolean = false): v2Manifest {\n return Object.keys(this.placements()).map((name) => ({\n Name: name,\n Services: this.deploymentsByPlacement(name).map(([service]) => this.v2ManifestService(name, service, asString)),\n }));\n }\n\n v3Manifest(asString: boolean = false): v3Manifest {\n const groups = this.v3Groups();\n const serviceId = (pIdx: number, sIdx: number) => groups[pIdx].resources[sIdx].resource.id;\n\n return Object.keys(this.placements()).map((name, pIdx) => ({\n name: name,\n services: this.deploymentsByPlacement(name)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([service], idx) => this.v3ManifestService(serviceId(pIdx, idx), name, service, asString)),\n }));\n }\n\n manifest(asString: boolean = false): v2Manifest | v3Manifest {\n return this.version === \"beta2\" ? this.v2Manifest(asString) : this.v3Manifest(asString);\n }\n\n /**\n * Computes the endpoint sequence numbers for the given SDL.\n *\n * @param sdl - The SDL data.\n * @returns An object mapping IPs to their sequence numbers.\n *\n * @example\n * ```ts\n * const sequenceNumbers = sdl.computeEndpointSequenceNumbers(sdlData);\n * // sequenceNumbers might be { \"192.168.1.1\": 1, \"192.168.1.2\": 2 }\n * ```\n */\n computeEndpointSequenceNumbers(sdl: v2Sdl) {\n return Object.fromEntries(\n Object.values(sdl.services).flatMap((service) =>\n service.expose.flatMap((expose) =>\n expose.to\n ? expose.to\n .filter((to) => to.global && to.ip?.length > 0)\n .map((to) => to.ip)\n .sort()\n .map((ip, index) => [ip, index + 1])\n : [],\n ),\n ),\n );\n }\n\n resourceUnitCpu(computeResources: v2ComputeResources, asString: boolean) {\n const attributes = computeResources.cpu.attributes;\n const cpu = isString(computeResources.cpu.units) ? convertCpuResourceString(computeResources.cpu.units) : computeResources.cpu.units * 1000;\n\n return {\n units: { val: this.resourceValue(cpu, asString) },\n attributes:\n attributes\n && Object.entries(attributes)\n .sort(([k0], [k1]) => k0.localeCompare(k1))\n .map(([key, value]) => ({\n key: key,\n value: value.toString(),\n })),\n };\n }\n\n resourceUnitMemory(computeResources: v2ComputeResources, asString: boolean) {\n const attributes = computeResources.memory.attributes;\n\n return {\n quantity: {\n val: this.resourceValue(convertResourceString(computeResources.memory.size), asString),\n },\n attributes:\n attributes\n && Object.entries(attributes)\n .sort(([k0], [k1]) => k0.localeCompare(k1))\n .map(([key, value]) => ({\n key: key,\n value: value.toString(),\n })),\n };\n }\n\n resourceUnitStorage(computeResources: v2ComputeResources, asString: boolean) {\n const storages = isArray(computeResources.storage) ? computeResources.storage : [computeResources.storage];\n\n return storages.map((storage) => ({\n name: storage.name || \"default\",\n quantity: {\n val: this.resourceValue(convertResourceString(storage.size), asString),\n },\n attributes: this.serviceResourceStorageAttributes(storage.attributes),\n }));\n }\n\n transformGpuAttributes(attributes: v3GPUAttributes): Array<{ key: string; value: string }> {\n return Object.entries(attributes.vendor).flatMap(([vendor, models]) =>\n models\n ? models.map((model) => {\n let key = `vendor/${vendor}/model/${model.model}`;\n\n if (model.ram) {\n key += `/ram/${model.ram}`;\n }\n\n if (model.interface) {\n key += `/interface/${model.interface}`;\n }\n\n return {\n key: key,\n value: \"true\",\n };\n })\n : [\n {\n key: `vendor/${vendor}/model/*`,\n value: \"true\",\n },\n ],\n );\n }\n\n resourceUnitGpu(computeResources: v3ComputeResources, asString: boolean) {\n const attributes = computeResources.gpu?.attributes;\n const units = computeResources.gpu?.units || \"0\";\n const gpu = isString(units) ? parseInt(units) : units;\n\n return {\n units: { val: this.resourceValue(gpu, asString) },\n attributes: attributes && this.transformGpuAttributes(attributes),\n };\n }\n\n groupResourceUnits(resource: v2ComputeResources | undefined, asString: boolean) {\n if (!resource) return {};\n\n const units = {\n endpoints: null,\n } as any;\n\n if (resource.cpu) {\n units.cpu = this.resourceUnitCpu(resource, asString);\n }\n\n if (resource.memory) {\n units.memory = this.resourceUnitMemory(resource, asString);\n }\n\n if (resource.storage) {\n units.storage = this.resourceUnitStorage(resource, asString);\n }\n\n if (this.version === \"beta3\") {\n units.gpu = this.resourceUnitGpu(resource as v3ComputeResources, asString);\n }\n\n return units;\n }\n\n exposeShouldBeIngress(expose: { proto: string; global: boolean; externalPort: number; port: number }) {\n const externalPort = expose.externalPort === 0 ? expose.port : expose.externalPort;\n\n return expose.global && expose.proto === \"TCP\" && externalPort === 80;\n }\n\n groups() {\n return this.version === \"beta2\" ? this.v2Groups() : this.v3Groups();\n }\n\n v3Groups() {\n const groups = new Map<\n string,\n {\n dgroup: v3DeploymentGroup;\n boundComputes: Record<string, Record<string, number>>;\n }\n >();\n const services = Object.entries(this.data.services).sort(([a], [b]) => a.localeCompare(b));\n\n for (const [svcName, service] of services) {\n for (const [placementName, svcdepl] of Object.entries(this.data.deployment[svcName])) {\n // objects below have been ensured to exist\n const compute = this.data.profiles.compute[svcdepl.profile];\n const infra = this.data.profiles.placement[placementName];\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n ...pricing,\n amount: pricing.amount?.toString(),\n };\n\n let group = groups.get(placementName);\n\n if (!group) {\n const attributes = (infra.attributes\n ? Object.entries(infra.attributes).map(([key, value]) => ({\n key,\n value,\n }))\n : []) as unknown as Array<{ key: string; value: string }>;\n\n attributes.sort((a, b) => a.key.localeCompare(b.key));\n\n group = {\n dgroup: {\n name: placementName,\n resources: [],\n requirements: {\n attributes: attributes,\n signedBy: {\n allOf: infra.signedBy?.allOf || [],\n anyOf: infra.signedBy?.anyOf || [],\n },\n },\n },\n boundComputes: {},\n };\n\n groups.set(placementName, group);\n }\n\n if (!group.boundComputes[placementName]) {\n group.boundComputes[placementName] = {};\n }\n\n // const resources = this.serviceResourcesBeta3(0, compute as v3ProfileCompute, service, false);\n const location = group.boundComputes[placementName][svcdepl.profile];\n\n if (!location) {\n const res = this.groupResourceUnits(compute.resources, false);\n res.endpoints = this.v3ServiceResourceEndpoints(service);\n\n const resID = group.dgroup.resources.length > 0 ? group.dgroup.resources.length + 1 : 1;\n res.id = resID;\n // resources.id = res.id;\n\n group.dgroup.resources.push({\n resource: res,\n price: price,\n count: svcdepl.count,\n } as any);\n\n group.boundComputes[placementName][svcdepl.profile] = group.dgroup.resources.length - 1;\n } else {\n const endpoints = this.v3ServiceResourceEndpoints(service);\n // resources.id = group.dgroup.resources[location].id;\n\n group.dgroup.resources[location].count += svcdepl.count;\n group.dgroup.resources[location].endpoints += endpoints as any;\n group.dgroup.resources[location].endpoints.sort();\n }\n }\n }\n\n // keep ordering stable\n const names: string[] = [...groups.keys()].sort();\n return names.map((name) => groups.get(name)).map((group) => (group ? (group.dgroup as typeof group.dgroup) : {})) as Array<v3DeploymentGroup>;\n }\n\n v2Groups() {\n const yamlJson = this.data;\n const ipEndpointNames = this.computeEndpointSequenceNumbers(yamlJson);\n\n const groups = {} as any;\n\n Object.keys(yamlJson.services).forEach((svcName) => {\n const svc = yamlJson.services[svcName];\n const depl = yamlJson.deployment[svcName];\n\n Object.keys(depl).forEach((placementName) => {\n const svcdepl = depl[placementName];\n const compute = yamlJson.profiles.compute[svcdepl.profile];\n const infra = yamlJson.profiles.placement[placementName];\n\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n ...pricing,\n amount: pricing.amount.toString(),\n };\n\n let group = groups[placementName];\n\n if (!group) {\n group = {\n name: placementName,\n requirements: {\n attributes: infra.attributes\n ? Object.entries(infra.attributes).map(([key, value]) => ({\n key,\n value,\n }))\n : [],\n signedBy: {\n allOf: infra.signedBy?.allOf || [],\n anyOf: infra.signedBy?.anyOf || [],\n },\n },\n resources: [],\n };\n\n if (group.requirements.attributes) {\n group.requirements.attributes = group.requirements.attributes.sort((a: any, b: any) => a.key < b.key);\n }\n\n groups[group.name] = group;\n }\n\n const resources = {\n resources: this.groupResourceUnits(compute.resources, false), // Changed resources => unit\n price: price,\n count: svcdepl.count,\n };\n\n const endpoints = [] as any[];\n svc?.expose?.forEach((expose) => {\n expose?.to\n ?.filter((to) => to.global)\n .forEach((to) => {\n const exposeSpec = {\n port: expose.port,\n externalPort: expose.as || 0,\n proto: this.parseServiceProto(expose.proto),\n global: !!to.global,\n };\n\n if (to.ip?.length > 0) {\n const seqNo = ipEndpointNames[to.ip];\n endpoints.push({\n kind: Endpoint_LEASED_IP,\n sequence_number: seqNo,\n });\n }\n\n const kind = this.exposeShouldBeIngress(exposeSpec) ? Endpoint_SHARED_HTTP : Endpoint_RANDOM_PORT;\n\n endpoints.push({ kind: kind, sequence_number: 0 });\n });\n });\n\n resources.resources.endpoints = endpoints;\n group.resources.push(resources);\n });\n });\n\n return Object.keys(groups)\n .sort((a, b) => (a < b ? 1 : 0))\n .map((name) => groups[name]);\n }\n\n /**\n * Escapes HTML characters in a string.\n *\n * @param raw - The raw string to escape.\n * @returns The escaped string.\n *\n * @example\n * ```ts\n * const escaped = sdl.escapeHtml(\"<div>Hello</div>\");\n * // escaped is \"\\\\u003cdiv\\\\u003eHello\\\\u003c/div\\\\u003e\"\n * ```\n */\n #escapeHtml(raw: string) {\n return raw.replace(/</g, \"\\\\u003c\").replace(/>/g, \"\\\\u003e\").replace(/&/g, \"\\\\u0026\");\n }\n\n manifestSortedJSON() {\n const manifest = this.manifest(true);\n let jsonStr = JSON.stringify(manifest);\n\n if (jsonStr) {\n jsonStr = jsonStr.replaceAll(\"\\\"quantity\\\":{\\\"val\", \"\\\"size\\\":{\\\"val\");\n }\n\n return this.#escapeHtml(stableStringify(JSON.parse(jsonStr)) || \"\");\n }\n\n async manifestVersion() {\n const jsonStr = this.manifestSortedJSON();\n const enc = new TextEncoder();\n const sortedBytes = enc.encode(jsonStr);\n const sum = await crypto.subtle.digest(\"SHA-256\", sortedBytes);\n\n return new Uint8Array(sum);\n }\n\n manifestSorted() {\n const sorted = this.manifestSortedJSON();\n return JSON.parse(sorted);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAiB;AACjB,mCAA2C;AAE3C,oBAA2B;AAE3B,mBAAgE;AAgChE,yBAA4B;AAC5B,gCAAmC;AAvCnC;AAyCA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAE3B,SAAS,QAAW,KAA2B;AAC7C,SAAO,MAAM,QAAQ,GAAG;AAC1B;AAEA,SAAS,SAAS,KAAyB;AACzC,SAAO,OAAO,QAAQ;AACxB;AAoCO,MAAM,OAAN,MAAM,KAAI;AAAA,EA8Bf,YACkB,MACA,UAA0B,SAC1C,YAAuB,0BACvB;AAHgB;AACA;AAhCb;AAmCH,UAAM,aAAS,gCAAY,MAA6B,SAAS;AACjE,QAAI,OAAQ,OAAM,IAAI,6CAAmB,OAAO,CAAC,EAAE,OAAO;AAAA,EAC5D;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,EAZA,OAAO,WAAW,MAAc,UAA0B,SAAS,YAAuB,0BAAiB;AACzG,UAAM,OAAO,eAAAA,QAAK,KAAK,IAAI;AAC3B,WAAO,IAAI,KAAI,MAAM,SAAS,SAAS;AAAA,EACzC;AAAA,EAWA,WAAW;AACT,QAAI,KAAK,MAAM;AACb,aAAO,KAAK,KAAK;AAAA,IACnB;AAEA,WAAO,CAAC;AAAA,EACV;AAAA,EAEA,cAA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nB,UAAM,WAAW,KAAK,SAAS,IAAI;AACnC,QAAI,UAAU,KAAK,UAAU,QAAQ;AAErC,QAAI,SAAS;AACX,gBAAU,QAAQ,WAAW,oBAAuB,cAAiB;AAAA,IACvE;AAEA,WAAO,sBAAK,+BAAL,eAAiB,6BAAAC,SAAgB,KAAK,MAAM,OAAO,CAAC,KAAK;AAAA,EAClE;AAAA,EAEA,MAAM,kBAAkB;AACtB,UAAM,UAAU,KAAK,mBAAmB;AACxC,UAAM,MAAM,IAAI,YAAY;AAC5B,UAAM,cAAc,IAAI,OAAO,OAAO;AACtC,UAAM,MAAM,MAAM,OAAO,OAAO,OAAO,WAAW,WAAW;AAE7D,WAAO,IAAI,WAAW,GAAG;AAAA,EAC3B;AAAA,EAEA,iBAAiB;AACf,UAAM,SAAS,KAAK,mBAAmB;AACvC,WAAO,KAAK,MAAM,MAAM;AAAA,EAC1B;AACF;AAl2BO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAs0BL,gBAAW,SAAC,KAAa;AACvB,SAAO,IAAI,QAAQ,MAAM,SAAS,EAAE,QAAQ,MAAM,SAAS,EAAE,QAAQ,MAAM,SAAS;AACtF;AAx0BK,IAAM,MAAN;",
|
|
6
6
|
"names": ["YAML", "storage", "stableStringify"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/sdl/types.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @deprecated will be removed in favor of `Manifest` type\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type v2Manifest = v2Group[];\n\n/** @deprecated Use `Manifest` type instead. */\nexport type v3Manifest = v3Group[];\n\n/** @deprecated Use `Manifest` type instead. */\nexport type v3Group = {\n name: string;\n services: v3ManifestService[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2Group = {\n Name: string;\n Services: v2ManifestService[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ManifestService = {\n Name: string;\n Image: string;\n Command: string[] | null;\n Args: string[] | null;\n Env: string[] | null;\n Resources: ResourceUnits;\n Count: number;\n Expose: v2ServiceExpose[];\n params?: v2ManifestServiceParams;\n};\n\n/** @deprecated Use `Manifest` type instead. */\nexport type v3ManifestService = {\n name: string;\n image: string;\n command: string[] | null;\n args: string[] | null;\n env: string[] | null;\n resources: ResourceUnits;\n count: number;\n expose: v3ServiceExpose[];\n params?: v3ManifestServiceParams | null;\n credentials: v2ServiceImageCredentials | null;\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ServiceExposeHttpOptions = {\n MaxBodySize: number;\n ReadTimeout: number;\n SendTimeout: number;\n NextTries: number;\n NextTimeout: number;\n NextCases: string[];\n};\n\n/** @deprecated Use `Manifest[number]['services'][number]['expose'][number]['httpOptions']` type instead. */\nexport type v3ServiceExposeHttpOptions = {\n maxBodySize: number;\n readTimeout: number;\n sendTimeout: number;\n nextTries: number;\n nextTimeout: number;\n nextCases: string[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type ResourceUnits = Record<string, any>;\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ServiceExpose = {\n Port: number;\n ExternalPort: number;\n Proto: string;\n Service: any;\n Global: boolean;\n Hosts: any;\n HTTPOptions: v2ServiceExposeHttpOptions;\n IP: string;\n EndpointSequenceNumber: number;\n};\n\n/** @deprecated Use `Manifest[number]['services'][number]['expose'][number]` type instead. */\nexport type v3ServiceExpose = {\n port: number;\n externalPort: number;\n proto: string;\n service: any;\n global: boolean;\n hosts: any;\n httpOptions: v3ServiceExposeHttpOptions;\n ip: string;\n endpointSequenceNumber: number;\n};\n\ntype v2ServicePermissionsScope = \"deployment\" | \"logs\";\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ServicePermissions = {\n read?: v2ServicePermissionsScope[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ManifestServiceParams = {\n Storage: v2ServiceStorageParams[];\n Permissions?: v2ServicePermissions;\n};\n\n/** @deprecated Use `Manifest[number]['services'][number]['params']` type instead. */\nexport type v3ManifestServiceParams = {\n storage: v2ServiceStorageParams[];\n permissions?: v2ServicePermissions;\n};\n\n/** @deprecated will be removed in favor of `Manifest` type */\nexport type v2Sdl = {\n services: Record<string, v2Service>;\n profiles: v2Profiles;\n deployment: Record<string, v2Deployment>;\n endpoints: Record<string, v2Endpoint>;\n};\n\n/** @deprecated Use `SDLInput` type instead. */\nexport type v3Sdl = {\n services: Record<string, v2Service>;\n profiles: v3Profiles;\n deployment: Record<string, v2Deployment>;\n endpoints: Record<string, v2Endpoint>;\n};\n\n/** @deprecated will be removed. */\nexport type v2Endpoint = {\n kind: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ExposeTo = {\n service?: string;\n global?: boolean;\n http_options: v2HTTPOptions;\n ip: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2HTTPOptions = {\n max_body_size: number;\n read_timeout: number;\n send_timeout: number;\n next_tries: number;\n next_timeout: number;\n next_cases: string[];\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Accept = {\n items?: string[];\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Expose = {\n port: number;\n as: number;\n proto?: string;\n to?: v2ExposeTo[];\n accept: v2Accept;\n http_options: v2HTTPOptions;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Dependency = {\n service: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceStorageParams = {\n name: string;\n mount: string;\n readOnly: boolean;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceParams = {\n storage?: Record<string, v2ServiceStorageParams>;\n permissions?: v2ServicePermissions;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceImageCredentials = {\n host: string;\n email?: string;\n username: string;\n password: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Service = {\n image: string;\n command: string[] | null;\n args: string[] | null;\n env: string[] | null;\n expose: v2Expose[];\n dependencies?: v2Dependency[];\n params?: v2ServiceParams;\n credentials?: v2ServiceImageCredentials;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceDeployment = {\n profile: string;\n count: number;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Deployment = Record<string, v2ServiceDeployment>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2CPUAttributes = Record<string, any>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceCPU = {\n units: number | string;\n attributes?: v2CPUAttributes;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceMemory = {\n size: string;\n attributes?: Record<string, any>;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3GPUAttributes = {\n vendor: {\n [vendor: string]: Array<{ model: string; ram?: string; interface?: string }>;\n };\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3ResourceGPU = {\n units: number | string;\n attributes?: v3GPUAttributes;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2StorageAttributes = Record<string, any>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceStorage = {\n name: string;\n size: string;\n attributes: v2StorageAttributes;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceStorageArray = v2ResourceStorage[];\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ComputeResources = {\n cpu: v2ResourceCPU;\n memory: v2ResourceMemory;\n storage: v2ResourceStorageArray | v2ResourceStorage;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3ComputeResources = {\n cpu: v2ResourceCPU;\n memory: v2ResourceMemory;\n storage: v2ResourceStorageArray | v2ResourceStorage;\n gpu: v3ResourceGPU;\n id: number;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ProfileCompute = {\n resources: v2ComputeResources;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3ProfileCompute = {\n resources: v3ComputeResources;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2PlacementAttributes = Attributes;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Coin = {\n denom: string;\n value: number;\n amount: number;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2PlacementPricing = Record<string, v2Coin>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type SignedBy = {\n allOf: string[];\n anyOf: string[];\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ProfilePlacement = {\n attributes: v2PlacementAttributes;\n signedBy: SignedBy;\n pricing: v2PlacementPricing;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Profiles = {\n compute: Record<string, v2ProfileCompute>;\n placement: Record<string, v2ProfilePlacement>;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3Profiles = {\n compute: Record<string, v3ProfileCompute>;\n placement: Record<string, v2ProfilePlacement>;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type Attribute = {\n key: string;\n value: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3DeploymentGroup = {\n name: string;\n resources: Array<{\n resource: v3ComputeResources;\n price: number;\n count: number;\n endpoints: Array<{ kind: number; sequence_number: number }>;\n }>;\n requirements: {\n attributes: Array<Attribute>;\n signedBy: {\n allOf: string[];\n anyOf: string[];\n };\n };\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type Attributes = Attribute[];\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * @deprecated will be removed in favor of `Manifest` type\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type v2Manifest = v2Group[];\n\n/** @deprecated Use `Manifest` type instead. */\nexport type v3Manifest = v3Group[];\n\n/** @deprecated Use `Manifest` type instead. */\nexport type v3Group = {\n name: string;\n services: v3ManifestService[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2Group = {\n Name: string;\n Services: v2ManifestService[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ManifestService = {\n Name: string;\n Image: string;\n Command: string[] | null;\n Args: string[] | null;\n Env: string[] | null;\n Resources: ResourceUnits;\n Count: number;\n Expose: v2ServiceExpose[];\n params?: v2ManifestServiceParams;\n};\n\n/** @deprecated Use `Manifest` type instead. */\nexport type v3ManifestService = {\n name: string;\n image: string;\n command: string[] | null;\n args: string[] | null;\n env: string[] | null;\n resources: ResourceUnits;\n count: number;\n expose: v3ServiceExpose[];\n params?: v3ManifestServiceParams | null;\n credentials: v2ServiceImageCredentials | null;\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ServiceExposeHttpOptions = {\n MaxBodySize: number;\n ReadTimeout: number;\n SendTimeout: number;\n NextTries: number;\n NextTimeout: number;\n NextCases: string[];\n};\n\n/** @deprecated Use `Manifest[number]['services'][number]['expose'][number]['httpOptions']` type instead. */\nexport type v3ServiceExposeHttpOptions = {\n maxBodySize: number;\n readTimeout: number;\n sendTimeout: number;\n nextTries: number;\n nextTimeout: number;\n nextCases: string[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type ResourceUnits = Record<string, any>;\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ServiceExpose = {\n Port: number;\n ExternalPort: number;\n Proto: string;\n Service: any;\n Global: boolean;\n Hosts: any;\n HTTPOptions: v2ServiceExposeHttpOptions;\n IP: string;\n EndpointSequenceNumber: number;\n};\n\n/** @deprecated Use `Manifest[number]['services'][number]['expose'][number]` type instead. */\nexport type v3ServiceExpose = {\n port: number;\n externalPort: number;\n proto: string;\n service: any;\n global: boolean;\n hosts: any;\n httpOptions: v3ServiceExposeHttpOptions;\n ip: string;\n endpointSequenceNumber: number;\n};\n\ntype v2ServicePermissionsScope = \"deployment\" | \"logs\";\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ServicePermissions = {\n read?: v2ServicePermissionsScope[];\n};\n\n/** @deprecated will be removed in favor of `Manifest` type. */\nexport type v2ManifestServiceParams = {\n Storage: v2ServiceStorageParams[];\n Permissions?: v2ServicePermissions;\n};\n\n/** @deprecated Use `Manifest[number]['services'][number]['params']` type instead. */\nexport type v3ManifestServiceParams = {\n storage: v2ServiceStorageParams[] | null;\n permissions?: v2ServicePermissions;\n};\n\n/** @deprecated will be removed in favor of `Manifest` type */\nexport type v2Sdl = {\n services: Record<string, v2Service>;\n profiles: v2Profiles;\n deployment: Record<string, v2Deployment>;\n endpoints: Record<string, v2Endpoint>;\n};\n\n/** @deprecated Use `SDLInput` type instead. */\nexport type v3Sdl = {\n services: Record<string, v2Service>;\n profiles: v3Profiles;\n deployment: Record<string, v2Deployment>;\n endpoints: Record<string, v2Endpoint>;\n};\n\n/** @deprecated will be removed. */\nexport type v2Endpoint = {\n kind: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ExposeTo = {\n service?: string;\n global?: boolean;\n http_options: v2HTTPOptions;\n ip: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2HTTPOptions = {\n max_body_size: number;\n read_timeout: number;\n send_timeout: number;\n next_tries: number;\n next_timeout: number;\n next_cases: string[];\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Accept = {\n items?: string[];\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Expose = {\n port: number;\n as: number;\n proto?: string;\n to?: v2ExposeTo[];\n accept: v2Accept;\n http_options: v2HTTPOptions;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Dependency = {\n service: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceStorageParams = {\n name: string;\n mount: string;\n readOnly: boolean;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceParams = {\n storage?: Record<string, v2ServiceStorageParams>;\n permissions?: v2ServicePermissions;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceImageCredentials = {\n host: string;\n email?: string;\n username: string;\n password: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Service = {\n image: string;\n command: string[] | null;\n args: string[] | null;\n env: string[] | null;\n expose: v2Expose[];\n dependencies?: v2Dependency[];\n params?: v2ServiceParams;\n credentials?: v2ServiceImageCredentials;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ServiceDeployment = {\n profile: string;\n count: number;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Deployment = Record<string, v2ServiceDeployment>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2CPUAttributes = Record<string, any>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceCPU = {\n units: number | string;\n attributes?: v2CPUAttributes;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceMemory = {\n size: string;\n attributes?: Record<string, any>;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3GPUAttributes = {\n vendor: {\n [vendor: string]: Array<{ model: string; ram?: string; interface?: string }>;\n };\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3ResourceGPU = {\n units: number | string;\n attributes?: v3GPUAttributes;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2StorageAttributes = Record<string, any>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceStorage = {\n name: string;\n size: string;\n attributes: v2StorageAttributes;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ResourceStorageArray = v2ResourceStorage[];\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ComputeResources = {\n cpu: v2ResourceCPU;\n memory: v2ResourceMemory;\n storage: v2ResourceStorageArray | v2ResourceStorage;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3ComputeResources = {\n cpu: v2ResourceCPU;\n memory: v2ResourceMemory;\n storage: v2ResourceStorageArray | v2ResourceStorage;\n gpu: v3ResourceGPU;\n id: number;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ProfileCompute = {\n resources: v2ComputeResources;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3ProfileCompute = {\n resources: v3ComputeResources;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2PlacementAttributes = Attributes;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Coin = {\n denom: string;\n value: number;\n amount: number;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2PlacementPricing = Record<string, v2Coin>;\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type SignedBy = {\n allOf: string[];\n anyOf: string[];\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2ProfilePlacement = {\n attributes: v2PlacementAttributes;\n signedBy: SignedBy;\n pricing: v2PlacementPricing;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v2Profiles = {\n compute: Record<string, v2ProfileCompute>;\n placement: Record<string, v2ProfilePlacement>;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3Profiles = {\n compute: Record<string, v3ProfileCompute>;\n placement: Record<string, v2ProfilePlacement>;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type Attribute = {\n key: string;\n value: string;\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type v3DeploymentGroup = {\n name: string;\n resources: Array<{\n resource: v3ComputeResources;\n price: number;\n count: number;\n endpoints: Array<{ kind: number; sequence_number: number }>;\n }>;\n requirements: {\n attributes: Array<Attribute>;\n signedBy: {\n allOf: string[];\n anyOf: string[];\n };\n };\n};\n\n/** @deprecated will be removed in favor of `SDLInput` and `Manifest` types. */\nexport type Attributes = Attribute[];\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3777,20 +3777,20 @@ var _SDL = class _SDL {
|
|
|
3777
3777
|
};
|
|
3778
3778
|
}
|
|
3779
3779
|
v3ManifestServiceParams(params) {
|
|
3780
|
-
if (params === void 0) {
|
|
3780
|
+
if (params === void 0 || Object.keys(params).length === 0) {
|
|
3781
3781
|
return null;
|
|
3782
3782
|
}
|
|
3783
|
-
|
|
3784
|
-
storage: Object.keys(params
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
readOnly: params.storage[name]?.readOnly || false
|
|
3790
|
-
};
|
|
3791
|
-
}),
|
|
3792
|
-
...params?.permissions ? { permissions: params.permissions } : {}
|
|
3783
|
+
const res = {
|
|
3784
|
+
storage: params.storage && Object.keys(params.storage).length > 0 ? Object.keys(params.storage).map((name) => ({
|
|
3785
|
+
name,
|
|
3786
|
+
mount: params.storage[name]?.mount,
|
|
3787
|
+
readOnly: params.storage[name]?.readOnly || false
|
|
3788
|
+
})) : null
|
|
3793
3789
|
};
|
|
3790
|
+
if (params.permissions) {
|
|
3791
|
+
res.permissions = params.permissions;
|
|
3792
|
+
}
|
|
3793
|
+
return res;
|
|
3794
3794
|
}
|
|
3795
3795
|
v2ManifestService(placement, name, asString) {
|
|
3796
3796
|
const service = this.data.services[name];
|
|
@@ -9322,4 +9322,4 @@ export {
|
|
|
9322
9322
|
isRetryEnabled,
|
|
9323
9323
|
createTxTransport
|
|
9324
9324
|
};
|
|
9325
|
-
//# sourceMappingURL=chunk-
|
|
9325
|
+
//# sourceMappingURL=chunk-RIIYZIXM.js.map
|