@akashnetwork/chain-sdk 1.0.0-alpha.21 → 1.0.0-alpha.22

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.
@@ -356,7 +356,8 @@ const _SDL = class _SDL {
356
356
  mount: params.storage[name].mount,
357
357
  readOnly: params.storage[name].readOnly || false
358
358
  };
359
- })
359
+ }),
360
+ ...params?.permissions ? { Permissions: params.permissions } : {}
360
361
  };
361
362
  }
362
363
  v3ManifestServiceParams(params) {
@@ -371,7 +372,8 @@ const _SDL = class _SDL {
371
372
  mount: params.storage[name]?.mount,
372
373
  readOnly: params.storage[name]?.readOnly || false
373
374
  };
374
- })
375
+ }),
376
+ ...params?.permissions ? { permissions: params.permissions } : {}
375
377
  };
376
378
  }
377
379
  v2ManifestService(placement, name, asString) {
@@ -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 { SdlValidationError } from \"./SdlValidationError.ts\";\nimport type { SDLInput } from \"./validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"./validateSDL/validateSDL.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 * @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 };\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 };\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;AA+BhE,gCAAmC;AAEnC,yBAA4B;AAvC5B;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;AAkCO,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,EAE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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;AA31BO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+zBL,gBAAW,SAAC,KAAa;AACvB,SAAO,IAAI,QAAQ,MAAM,SAAS,EAAE,QAAQ,MAAM,SAAS,EAAE,QAAQ,MAAM,SAAS;AACtF;AAj0BK,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 { SdlValidationError } from \"./SdlValidationError.ts\";\nimport type { SDLInput } from \"./validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"./validateSDL/validateSDL.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 * @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,mCAA2C;AAE3C,oBAA2B;AAE3B,mBAAgE;AA+BhE,gCAAmC;AAEnC,yBAA4B;AAvC5B;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;AAkCO,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;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O,IAAI,IAAI,IAAI,CAAE,EAC9B,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC;AAAA,EAC/B;AAAA,EAkBA,qBAAqB;AACnB,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;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;",
6
6
  "names": ["YAML", "storage", "stableStringify"]
7
7
  }
@@ -53,7 +53,7 @@ var require_ucs2length = __commonJS({
53
53
  });
54
54
  var validate = validate11;
55
55
  var stdin_default = validate11;
56
- var schema12 = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "description": "Schema for Akash Stack Definition Language (SDL) YAML input files.\n\nNote: This schema validates structure only. Semantic validations (cross-references,\nunused endpoints, profile references, etc.) are performed at runtime by the Go parser.\nSee README.md for details.\n", "definitions": { "stringArrayOrNull": { "description": "String array or null value (used for command args and env vars)", "oneOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }] }, "portNumber": { "description": "Valid TCP/UDP port number (1-65535)", "type": "integer", "minimum": 1, "maximum": 65535 }, "httpErrorCode": { "description": "HTTP error codes for proxy retry logic", "enum": ["error", "timeout", "500", "502", "503", "504", "403", "404", "429", "off"], "type": "string" }, "priceCoin": { "description": "Price definition with amount and denomination", "additionalProperties": false, "properties": { "amount": { "oneOf": [{ "type": "string", "pattern": "^[0-9]+(\\.[0-9]+)?$", "description": "Positive number as string" }, { "type": "number", "minimum": 0, "description": "Positive number" }] }, "denom": { "pattern": "^(uakt|ibc/.*)$", "type": "string" } }, "required": ["denom", "amount"], "type": "object" }, "storageAttributesValidation": { "description": "Storage attributes validation:\n1. RAM class must not be persistent\n2. Non-RAM classes (beta1, beta2, beta3, default) require persistent=true\n", "additionalProperties": false, "properties": { "class": { "type": "string" }, "persistent": { "oneOf": [{ "type": "boolean" }, { "type": "string" }] } }, "not": { "properties": { "class": { "const": "ram" }, "persistent": { "oneOf": [{ "const": true }, { "const": "true" }] } }, "required": ["class", "persistent"] }, "type": "object" }, "storageVolume": { "description": "Storage volume definition with size and optional attributes", "additionalProperties": false, "properties": { "attributes": { "$ref": "#/definitions/storageAttributesValidation" }, "name": { "type": "string" }, "size": { "type": "string" } }, "required": ["size"], "type": "object" }, "absolutePath": { "description": "Absolute filesystem path starting with /", "type": "string", "minLength": 1, "pattern": "^/" }, "exposeToWithIpEnforcesGlobal": { "description": "Expose to with IP enforces global", "if": { "properties": { "ip": { "type": "string", "minLength": 1 } }, "required": ["ip"] }, "then": { "properties": { "global": { "const": true } }, "required": ["global"] } } }, "properties": { "deployment": { "additionalProperties": { "additionalProperties": { "additionalProperties": false, "properties": { "count": { "minimum": 1, "type": "integer" }, "profile": { "type": "string" } }, "required": ["profile", "count"], "type": "object" }, "type": "object" }, "type": "object" }, "endpoints": { "additionalProperties": false, "patternProperties": { "^[a-z]+[-_0-9a-z]+$": { "additionalProperties": false, "properties": { "kind": { "enum": ["ip"], "type": "string" } }, "required": ["kind"], "type": "object" } }, "type": "object" }, "include": { "description": "Optional list of files to include", "items": { "type": "string" }, "type": "array" }, "profiles": { "additionalProperties": false, "properties": { "compute": { "additionalProperties": { "additionalProperties": false, "properties": { "resources": { "additionalProperties": false, "properties": { "cpu": { "additionalProperties": false, "properties": { "attributes": { "type": "object" }, "units": { "oneOf": [{ "type": "string", "pattern": "^[0-9]+(\\.[0-9]+)?[a-zA-Z]*$", "not": { "pattern": "^0+(\\.0+)?m?$" } }, { "type": "number", "exclusiveMinimum": 0 }] } }, "required": ["units"], "type": "object" }, "gpu": { "description": "GPU resource specification.\n- units defaults to 0 if omitted\n- Bidirectional validation: units > 0 requires attributes, and attributes require units > 0\n", "additionalProperties": false, "properties": { "attributes": { "additionalProperties": false, "properties": { "vendor": { "additionalProperties": false, "minProperties": 1, "properties": { "nvidia": { "oneOf": [{ "type": "array", "items": { "additionalProperties": false, "properties": { "interface": { "enum": ["pcie", "sxm"], "type": "string" }, "model": { "type": "string" }, "ram": { "type": "string" } }, "type": "object" } }, { "type": "null" }] } }, "type": "object" } }, "type": "object" }, "units": { "oneOf": [{ "type": "string" }, { "type": "number" }] } }, "required": ["units"], "type": "object" }, "memory": { "additionalProperties": false, "properties": { "size": { "type": "string" } }, "required": ["size"], "type": "object" }, "storage": { "oneOf": [{ "$ref": "#/definitions/storageVolume" }, { "items": { "$ref": "#/definitions/storageVolume" }, "type": "array" }] } }, "required": ["cpu", "memory", "storage"], "type": "object" } }, "required": ["resources"], "type": "object" }, "type": "object" }, "placement": { "additionalProperties": { "additionalProperties": false, "properties": { "attributes": { "type": "object" }, "pricing": { "additionalProperties": { "$ref": "#/definitions/priceCoin" }, "type": "object" }, "signedBy": { "additionalProperties": false, "properties": { "allOf": { "items": { "type": "string" }, "type": "array" }, "anyOf": { "items": { "type": "string" }, "type": "array" } }, "type": "object" } }, "required": ["pricing"], "type": "object" }, "type": "object" } }, "required": ["compute", "placement"], "type": "object" }, "services": { "additionalProperties": { "properties": { "args": { "$ref": "#/definitions/stringArrayOrNull" }, "command": { "$ref": "#/definitions/stringArrayOrNull" }, "credentials": { "additionalProperties": false, "properties": { "email": { "type": "string", "minLength": 5 }, "host": { "type": "string", "minLength": 1 }, "password": { "type": "string", "minLength": 6 }, "username": { "type": "string", "minLength": 1 } }, "required": ["host", "username", "password"], "type": "object" }, "dependencies": { "items": { "additionalProperties": false, "properties": { "service": { "type": "string" } }, "type": "object" }, "type": "array" }, "env": { "$ref": "#/definitions/stringArrayOrNull" }, "expose": { "items": { "additionalProperties": false, "properties": { "accept": { "items": { "type": "string" }, "type": "array" }, "as": { "$ref": "#/definitions/portNumber" }, "http_options": { "additionalProperties": false, "properties": { "max_body_size": { "type": "integer", "minimum": 0, "maximum": 104857600, "description": "Maximum body size in bytes (max 100 MB)" }, "next_cases": { "oneOf": [{ "type": "array", "items": { "$ref": "#/definitions/httpErrorCode" }, "contains": { "const": "off" }, "maxItems": 1, "minItems": 1 }, { "type": "array", "items": { "$ref": "#/definitions/httpErrorCode" }, "not": { "contains": { "const": "off" } } }] }, "next_timeout": { "type": "integer", "minimum": 0 }, "next_tries": { "type": "integer", "minimum": 0 }, "read_timeout": { "type": "integer", "minimum": 0, "maximum": 6e4, "description": "Read timeout in milliseconds (max 60 seconds)" }, "send_timeout": { "type": "integer", "minimum": 0, "maximum": 6e4, "description": "Send timeout in milliseconds (max 60 seconds)" } }, "type": "object" }, "port": { "$ref": "#/definitions/portNumber" }, "proto": { "enum": ["TCP", "UDP", "tcp", "udp"], "type": "string" }, "to": { "items": { "additionalProperties": false, "properties": { "global": { "type": "boolean" }, "ip": { "minLength": 1, "type": "string" }, "service": { "type": "string" } }, "allOf": [{ "$ref": "#/definitions/exposeToWithIpEnforcesGlobal" }], "type": "object" }, "type": "array" } }, "required": ["port"], "type": "object" }, "type": "array" }, "image": { "type": "string", "minLength": 1 }, "params": { "additionalProperties": false, "properties": { "storage": { "additionalProperties": { "additionalProperties": false, "properties": { "mount": { "$ref": "#/definitions/absolutePath" }, "readOnly": { "type": "boolean" } }, "type": "object" }, "type": "object" } }, "type": "object" } }, "required": ["image"], "type": "object", "additionalProperties": false }, "type": "object" }, "version": { "description": "SDL version", "enum": ["2.0", "2.1"], "type": "string" } }, "required": ["version", "services", "profiles", "deployment"], "title": "Akash SDL Input Schema", "type": "object" };
56
+ var schema12 = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "description": "Schema for Akash Stack Definition Language (SDL) YAML input files.\n\nNote: This schema validates structure only. Semantic validations (cross-references,\nunused endpoints, profile references, etc.) are performed at runtime by the Go parser.\nSee README.md for details.\n", "definitions": { "stringArrayOrNull": { "description": "String array or null value (used for command args and env vars)", "oneOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }] }, "portNumber": { "description": "Valid TCP/UDP port number (1-65535)", "type": "integer", "minimum": 1, "maximum": 65535 }, "httpErrorCode": { "description": "HTTP error codes for proxy retry logic", "enum": ["error", "timeout", "500", "502", "503", "504", "403", "404", "429", "off"], "type": "string" }, "priceCoin": { "description": "Price definition with amount and denomination", "additionalProperties": false, "properties": { "amount": { "oneOf": [{ "type": "string", "pattern": "^[0-9]+(\\.[0-9]+)?$", "description": "Positive number as string" }, { "type": "number", "minimum": 0, "description": "Positive number" }] }, "denom": { "pattern": "^(uakt|ibc/.*)$", "type": "string" } }, "required": ["denom", "amount"], "type": "object" }, "storageAttributesValidation": { "description": "Storage attributes validation:\n1. RAM class must not be persistent\n2. Non-RAM classes (beta1, beta2, beta3, default) require persistent=true\n", "additionalProperties": false, "properties": { "class": { "type": "string" }, "persistent": { "oneOf": [{ "type": "boolean" }, { "type": "string" }] } }, "not": { "properties": { "class": { "const": "ram" }, "persistent": { "oneOf": [{ "const": true }, { "const": "true" }] } }, "required": ["class", "persistent"] }, "type": "object" }, "storageVolume": { "description": "Storage volume definition with size and optional attributes", "additionalProperties": false, "properties": { "attributes": { "$ref": "#/definitions/storageAttributesValidation" }, "name": { "type": "string" }, "size": { "type": "string" } }, "required": ["size"], "type": "object" }, "absolutePath": { "description": "Absolute filesystem path starting with /", "type": "string", "minLength": 1, "pattern": "^/" }, "exposeToWithIpEnforcesGlobal": { "description": "Expose to with IP enforces global", "if": { "properties": { "ip": { "type": "string", "minLength": 1 } }, "required": ["ip"] }, "then": { "properties": { "global": { "const": true } }, "required": ["global"] } } }, "properties": { "deployment": { "additionalProperties": { "additionalProperties": { "additionalProperties": false, "properties": { "count": { "minimum": 1, "type": "integer" }, "profile": { "type": "string" } }, "required": ["profile", "count"], "type": "object" }, "type": "object" }, "type": "object" }, "endpoints": { "additionalProperties": false, "patternProperties": { "^[a-z]+[-_0-9a-z]+$": { "additionalProperties": false, "properties": { "kind": { "enum": ["ip"], "type": "string" } }, "required": ["kind"], "type": "object" } }, "type": "object" }, "include": { "description": "Optional list of files to include", "items": { "type": "string" }, "type": "array" }, "profiles": { "additionalProperties": false, "properties": { "compute": { "additionalProperties": { "additionalProperties": false, "properties": { "resources": { "additionalProperties": false, "properties": { "cpu": { "additionalProperties": false, "properties": { "attributes": { "type": "object" }, "units": { "oneOf": [{ "type": "string", "pattern": "^[0-9]+(\\.[0-9]+)?[a-zA-Z]*$", "not": { "pattern": "^0+(\\.0+)?m?$" } }, { "type": "number", "exclusiveMinimum": 0 }] } }, "required": ["units"], "type": "object" }, "gpu": { "description": "GPU resource specification.\n- units defaults to 0 if omitted\n- Bidirectional validation: units > 0 requires attributes, and attributes require units > 0\n", "additionalProperties": false, "properties": { "attributes": { "additionalProperties": false, "properties": { "vendor": { "additionalProperties": false, "minProperties": 1, "properties": { "nvidia": { "oneOf": [{ "type": "array", "items": { "additionalProperties": false, "properties": { "interface": { "enum": ["pcie", "sxm"], "type": "string" }, "model": { "type": "string" }, "ram": { "type": "string" } }, "type": "object" } }, { "type": "null" }] } }, "type": "object" } }, "type": "object" }, "units": { "oneOf": [{ "type": "string" }, { "type": "number" }] } }, "required": ["units"], "type": "object" }, "memory": { "additionalProperties": false, "properties": { "size": { "type": "string" } }, "required": ["size"], "type": "object" }, "storage": { "oneOf": [{ "$ref": "#/definitions/storageVolume" }, { "items": { "$ref": "#/definitions/storageVolume" }, "type": "array" }] } }, "required": ["cpu", "memory", "storage"], "type": "object" } }, "required": ["resources"], "type": "object" }, "type": "object" }, "placement": { "additionalProperties": { "additionalProperties": false, "properties": { "attributes": { "type": "object" }, "pricing": { "additionalProperties": { "$ref": "#/definitions/priceCoin" }, "type": "object" }, "signedBy": { "additionalProperties": false, "properties": { "allOf": { "items": { "type": "string" }, "type": "array" }, "anyOf": { "items": { "type": "string" }, "type": "array" } }, "type": "object" } }, "required": ["pricing"], "type": "object" }, "type": "object" } }, "required": ["compute", "placement"], "type": "object" }, "services": { "additionalProperties": { "properties": { "args": { "$ref": "#/definitions/stringArrayOrNull" }, "command": { "$ref": "#/definitions/stringArrayOrNull" }, "credentials": { "additionalProperties": false, "properties": { "email": { "type": "string", "minLength": 5 }, "host": { "type": "string", "minLength": 1 }, "password": { "type": "string", "minLength": 6 }, "username": { "type": "string", "minLength": 1 } }, "required": ["host", "username", "password"], "type": "object" }, "dependencies": { "items": { "additionalProperties": false, "properties": { "service": { "type": "string" } }, "type": "object" }, "type": "array" }, "env": { "$ref": "#/definitions/stringArrayOrNull" }, "expose": { "items": { "additionalProperties": false, "properties": { "accept": { "items": { "type": "string" }, "type": "array" }, "as": { "$ref": "#/definitions/portNumber" }, "http_options": { "additionalProperties": false, "properties": { "max_body_size": { "type": "integer", "minimum": 0, "maximum": 104857600, "description": "Maximum body size in bytes (max 100 MB)" }, "next_cases": { "oneOf": [{ "type": "array", "items": { "$ref": "#/definitions/httpErrorCode" }, "contains": { "const": "off" }, "maxItems": 1, "minItems": 1 }, { "type": "array", "items": { "$ref": "#/definitions/httpErrorCode" }, "not": { "contains": { "const": "off" } } }] }, "next_timeout": { "type": "integer", "minimum": 0 }, "next_tries": { "type": "integer", "minimum": 0 }, "read_timeout": { "type": "integer", "minimum": 0, "maximum": 6e4, "description": "Read timeout in milliseconds (max 60 seconds)" }, "send_timeout": { "type": "integer", "minimum": 0, "maximum": 6e4, "description": "Send timeout in milliseconds (max 60 seconds)" } }, "type": "object" }, "port": { "$ref": "#/definitions/portNumber" }, "proto": { "enum": ["TCP", "UDP", "tcp", "udp"], "type": "string" }, "to": { "items": { "additionalProperties": false, "properties": { "global": { "type": "boolean" }, "ip": { "minLength": 1, "type": "string" }, "service": { "type": "string" } }, "allOf": [{ "$ref": "#/definitions/exposeToWithIpEnforcesGlobal" }], "type": "object" }, "type": "array" } }, "required": ["port"], "type": "object" }, "type": "array" }, "image": { "type": "string", "minLength": 1 }, "params": { "additionalProperties": false, "properties": { "storage": { "additionalProperties": { "additionalProperties": false, "properties": { "mount": { "$ref": "#/definitions/absolutePath" }, "readOnly": { "type": "boolean" } }, "type": "object" }, "type": "object" }, "permissions": { "additionalProperties": false, "properties": { "read": { "items": { "type": "string", "enum": ["deployment", "logs"] }, "type": "array" } }, "type": "object" } }, "type": "object" } }, "required": ["image"], "type": "object", "additionalProperties": false }, "type": "object" }, "version": { "description": "SDL version", "enum": ["2.0", "2.1"], "type": "string" } }, "required": ["version", "services", "profiles", "deployment"], "title": "Akash SDL Input Schema", "type": "object" };
57
57
  var schema20 = { "description": "HTTP error codes for proxy retry logic", "enum": ["error", "timeout", "500", "502", "503", "504", "403", "404", "429", "off"], "type": "string" };
58
58
  var pattern2 = new RegExp("^[a-z]+[-_0-9a-z]+$", "u");
59
59
  var pattern4 = new RegExp("^0+(\\.0+)?m?$", "u");
@@ -2717,7 +2717,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
2717
2717
  let data84 = data43.params;
2718
2718
  if (data84 && typeof data84 == "object" && !Array.isArray(data84)) {
2719
2719
  for (const key29 in data84) {
2720
- if (!(key29 === "storage")) {
2720
+ if (!(key29 === "storage" || key29 === "permissions")) {
2721
2721
  const err185 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params", schemaPath: "#/properties/services/additionalProperties/properties/params/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key29 }, message: "must NOT have additional properties" };
2722
2722
  if (vErrors === null) {
2723
2723
  vErrors = [err185];
@@ -2806,63 +2806,122 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
2806
2806
  errors++;
2807
2807
  }
2808
2808
  }
2809
+ if (data84.permissions !== void 0) {
2810
+ let data89 = data84.permissions;
2811
+ if (data89 && typeof data89 == "object" && !Array.isArray(data89)) {
2812
+ for (const key32 in data89) {
2813
+ if (!(key32 === "read")) {
2814
+ const err193 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params/permissions", schemaPath: "#/properties/services/additionalProperties/properties/params/properties/permissions/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key32 }, message: "must NOT have additional properties" };
2815
+ if (vErrors === null) {
2816
+ vErrors = [err193];
2817
+ } else {
2818
+ vErrors.push(err193);
2819
+ }
2820
+ errors++;
2821
+ }
2822
+ }
2823
+ if (data89.read !== void 0) {
2824
+ let data90 = data89.read;
2825
+ if (Array.isArray(data90)) {
2826
+ const len16 = data90.length;
2827
+ for (let i16 = 0; i16 < len16; i16++) {
2828
+ let data91 = data90[i16];
2829
+ if (typeof data91 !== "string") {
2830
+ const err194 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params/permissions/read/" + i16, schemaPath: "#/properties/services/additionalProperties/properties/params/properties/permissions/properties/read/items/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2831
+ if (vErrors === null) {
2832
+ vErrors = [err194];
2833
+ } else {
2834
+ vErrors.push(err194);
2835
+ }
2836
+ errors++;
2837
+ }
2838
+ if (!(data91 === "deployment" || data91 === "logs")) {
2839
+ const err195 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params/permissions/read/" + i16, schemaPath: "#/properties/services/additionalProperties/properties/params/properties/permissions/properties/read/items/enum", keyword: "enum", params: { allowedValues: schema12.properties.services.additionalProperties.properties.params.properties.permissions.properties.read.items.enum }, message: "must be equal to one of the allowed values" };
2840
+ if (vErrors === null) {
2841
+ vErrors = [err195];
2842
+ } else {
2843
+ vErrors.push(err195);
2844
+ }
2845
+ errors++;
2846
+ }
2847
+ }
2848
+ } else {
2849
+ const err196 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params/permissions/read", schemaPath: "#/properties/services/additionalProperties/properties/params/properties/permissions/properties/read/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2850
+ if (vErrors === null) {
2851
+ vErrors = [err196];
2852
+ } else {
2853
+ vErrors.push(err196);
2854
+ }
2855
+ errors++;
2856
+ }
2857
+ }
2858
+ } else {
2859
+ const err197 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params/permissions", schemaPath: "#/properties/services/additionalProperties/properties/params/properties/permissions/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2860
+ if (vErrors === null) {
2861
+ vErrors = [err197];
2862
+ } else {
2863
+ vErrors.push(err197);
2864
+ }
2865
+ errors++;
2866
+ }
2867
+ }
2809
2868
  } else {
2810
- const err193 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params", schemaPath: "#/properties/services/additionalProperties/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2869
+ const err198 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1") + "/params", schemaPath: "#/properties/services/additionalProperties/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2811
2870
  if (vErrors === null) {
2812
- vErrors = [err193];
2871
+ vErrors = [err198];
2813
2872
  } else {
2814
- vErrors.push(err193);
2873
+ vErrors.push(err198);
2815
2874
  }
2816
2875
  errors++;
2817
2876
  }
2818
2877
  }
2819
2878
  } else {
2820
- const err194 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/services/additionalProperties/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2879
+ const err199 = { instancePath: instancePath + "/services/" + key22.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/services/additionalProperties/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2821
2880
  if (vErrors === null) {
2822
- vErrors = [err194];
2881
+ vErrors = [err199];
2823
2882
  } else {
2824
- vErrors.push(err194);
2883
+ vErrors.push(err199);
2825
2884
  }
2826
2885
  errors++;
2827
2886
  }
2828
2887
  }
2829
2888
  } else {
2830
- const err195 = { instancePath: instancePath + "/services", schemaPath: "#/properties/services/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2889
+ const err200 = { instancePath: instancePath + "/services", schemaPath: "#/properties/services/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2831
2890
  if (vErrors === null) {
2832
- vErrors = [err195];
2891
+ vErrors = [err200];
2833
2892
  } else {
2834
- vErrors.push(err195);
2893
+ vErrors.push(err200);
2835
2894
  }
2836
2895
  errors++;
2837
2896
  }
2838
2897
  }
2839
2898
  if (data.version !== void 0) {
2840
- let data89 = data.version;
2841
- if (typeof data89 !== "string") {
2842
- const err196 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2899
+ let data92 = data.version;
2900
+ if (typeof data92 !== "string") {
2901
+ const err201 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2843
2902
  if (vErrors === null) {
2844
- vErrors = [err196];
2903
+ vErrors = [err201];
2845
2904
  } else {
2846
- vErrors.push(err196);
2905
+ vErrors.push(err201);
2847
2906
  }
2848
2907
  errors++;
2849
2908
  }
2850
- if (!(data89 === "2.0" || data89 === "2.1")) {
2851
- const err197 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/enum", keyword: "enum", params: { allowedValues: schema12.properties.version.enum }, message: "must be equal to one of the allowed values" };
2909
+ if (!(data92 === "2.0" || data92 === "2.1")) {
2910
+ const err202 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/enum", keyword: "enum", params: { allowedValues: schema12.properties.version.enum }, message: "must be equal to one of the allowed values" };
2852
2911
  if (vErrors === null) {
2853
- vErrors = [err197];
2912
+ vErrors = [err202];
2854
2913
  } else {
2855
- vErrors.push(err197);
2914
+ vErrors.push(err202);
2856
2915
  }
2857
2916
  errors++;
2858
2917
  }
2859
2918
  }
2860
2919
  } else {
2861
- const err198 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2920
+ const err203 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2862
2921
  if (vErrors === null) {
2863
- vErrors = [err198];
2922
+ vErrors = [err203];
2864
2923
  } else {
2865
- vErrors.push(err198);
2924
+ vErrors.push(err203);
2866
2925
  }
2867
2926
  errors++;
2868
2927
  }