@akashnetwork/chain-sdk 1.0.0-alpha.33 → 1.0.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/generated/protos/akash/provider/v1/status.cjs +19 -2
- package/dist/cjs/generated/protos/akash/provider/v1/status.cjs.map +2 -2
- package/dist/cjs/sdk/provider/auth/jwt/validateJwtPayload.cjs +5 -5
- package/dist/cjs/sdk/provider/auth/jwt/validateJwtPayload.cjs.map +2 -2
- package/dist/cjs/sdk/transport/grpc-gateway/createGrpcGatewayTransport.cjs +1 -1
- package/dist/cjs/sdk/transport/grpc-gateway/createGrpcGatewayTransport.cjs.map +2 -2
- package/dist/cjs/sdl/manifest/generateManifest.cjs +15 -0
- package/dist/cjs/sdl/manifest/generateManifest.cjs.map +2 -2
- package/dist/cjs/sdl/manifest/reclamationDuration.cjs +34 -0
- package/dist/cjs/sdl/manifest/reclamationDuration.cjs.map +7 -0
- package/dist/cjs/sdl/validateSDL/validateSDL.cjs +6 -0
- package/dist/cjs/sdl/validateSDL/validateSDL.cjs.map +2 -2
- package/dist/cjs/sdl/validateSDL/validateSDLInput.cjs +4 -3
- package/dist/cjs/sdl/validateSDL/validateSDLInput.cjs.map +2 -2
- package/dist/esm/{chunk-W25EJ3NI.js → chunk-MLIW7FIZ.js} +22 -3
- package/dist/esm/chunk-MLIW7FIZ.js.map +7 -0
- package/dist/esm/{chunk-J7CMFG4J.js → chunk-WBBS4OZV.js} +46 -9
- package/dist/esm/chunk-WBBS4OZV.js.map +7 -0
- package/dist/esm/generated/protos/index.provider.akash.v1.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.web.js +2 -2
- package/dist/esm/index.web.js.map +2 -2
- package/dist/esm/{service_akash-5RIOE2CY.js → service_akash-LXXUUD6O.js} +3 -2
- package/dist/esm/{service_akash-5RIOE2CY.js.map → service_akash-LXXUUD6O.js.map} +1 -1
- package/dist/sdl-schema.yaml +3 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/generated/protos/akash/provider/v1/status.d.ts +2 -0
- package/dist/types/sdk/provider/auth/jwt/validateJwtPayload.d.ts +3 -3
- package/dist/types/sdl/manifest/generateManifest.d.ts +2 -0
- package/dist/types/sdl/manifest/reclamationDuration.d.ts +11 -0
- package/dist/types/sdl/validateSDL/validateSDLInput.d.ts +2 -2
- package/package.json +1 -1
- package/dist/esm/chunk-J7CMFG4J.js.map +0 -7
- package/dist/esm/chunk-W25EJ3NI.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdl/manifest/generateManifest.ts"],
|
|
4
|
-
"sourcesContent": ["import { PlacementRequirements, SignedBy } from \"../../generated/protos/akash/base/attributes/v1/attribute.ts\";\nimport { CPU } from \"../../generated/protos/akash/base/resources/v1beta4/cpu.ts\";\nimport { GPU } from \"../../generated/protos/akash/base/resources/v1beta4/gpu.ts\";\nimport { Memory } from \"../../generated/protos/akash/base/resources/v1beta4/memory.ts\";\nimport { Resources } from \"../../generated/protos/akash/base/resources/v1beta4/resources.ts\";\nimport { Storage } from \"../../generated/protos/akash/base/resources/v1beta4/storage.ts\";\nimport { GroupSpec } from \"../../generated/protos/akash/deployment/v1beta4/groupspec.ts\";\nimport { ResourceUnit } from \"../../generated/protos/akash/deployment/v1beta4/resourceunit.ts\";\nimport { Group } from \"../../generated/protos/akash/manifest/v2beta3/group.ts\";\nimport { ImageCredentials, Service, ServiceParams, StorageParams } from \"../../generated/protos/akash/manifest/v2beta3/service.ts\";\nimport { ServiceExpose } from \"../../generated/protos/akash/manifest/v2beta3/serviceexpose.ts\";\nimport type { ValidationError } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray } from \"../utils.ts\";\nimport type { SDLInput } from \"../validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"../validateSDL/validateSDL.ts\";\nimport {\n buildHttpOptions,\n buildResourceAttributes,\n buildServiceEndpoints,\n buildStorageAttributes,\n computeEndpointSequenceNumbers,\n encodeResourceValue,\n parseCpuUnits,\n parseGpuUnits,\n parseMemoryBytes,\n parseServiceProto,\n parseStorageBytes,\n type SDLCompute,\n type SDLService,\n transformGpuAttributes,\n} from \"./manifestUtils.ts\";\n\nexport interface GenerateManifestOkResult {\n groups: Group[];\n groupSpecs: GroupSpec[];\n}\n\nexport type Manifest = GenerateManifestOkResult[\"groups\"];\nexport type GenerateManifestResult =\n | { ok?: false; value: ValidationError[] }\n | { ok: true; value: GenerateManifestOkResult };\nexport function generateManifest(sdl: SDLInput): GenerateManifestResult {\n const errors = validateSDL(sdl);\n if (errors) return { ok: false, value: errors };\n\n const endpointSequenceNumbers = computeEndpointSequenceNumbers(sdl.services);\n const groupsMap = new Map<string, {\n dgroup: GroupSpec;\n boundComputes: Record<string, number>;\n }>();\n const resourceIds = new Map<string, number>();\n\n const deploymentsByPlacement = new Map<string, [string, { profile: string; count: number }][]>();\n for (const [svcName, placements] of Object.entries(sdl.deployment)) {\n for (const [placementName, deployment] of Object.entries(placements)) {\n let list = deploymentsByPlacement.get(placementName);\n if (!list) {\n list = [];\n deploymentsByPlacement.set(placementName, list);\n }\n list.push([svcName, deployment]);\n }\n }\n for (const list of deploymentsByPlacement.values()) {\n list.sort(([a], [b]) => a.localeCompare(b));\n }\n\n const services = Object.entries(sdl.services).sort(([a], [b]) => a.localeCompare(b));\n\n for (const [svcName, service] of services) {\n for (const [placementName, svcdepl] of Object.entries(sdl.deployment[svcName])) {\n const compute = sdl.profiles.compute[svcdepl.profile];\n const infra = sdl.profiles.placement[placementName];\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n denom: pricing.denom,\n amount: pricing.amount?.toString(),\n };\n\n let group = groupsMap.get(placementName);\n\n if (!group) {\n group = {\n dgroup: GroupSpec.fromPartial({\n name: placementName,\n resources: [],\n requirements: PlacementRequirements.fromPartial({\n attributes: buildResourceAttributes(infra.attributes),\n signedBy: SignedBy.fromPartial({\n allOf: infra.signedBy?.allOf,\n anyOf: infra.signedBy?.anyOf,\n }),\n }),\n }),\n boundComputes: {},\n };\n\n groupsMap.set(placementName, group);\n }\n\n const profileKey = `${placementName}:${svcdepl.profile}`;\n const location = group.boundComputes[svcdepl.profile];\n\n if (location === undefined) {\n const resId = group.dgroup.resources.length > 0\n ? group.dgroup.resources.length + 1\n : 1;\n\n resourceIds.set(profileKey, resId);\n\n const resources = buildResources(resId, compute, service, endpointSequenceNumbers);\n\n group.dgroup.resources.push(\n ResourceUnit.fromPartial({\n resource: resources,\n count: svcdepl.count,\n price,\n }),\n );\n\n group.boundComputes[svcdepl.profile] = group.dgroup.resources.length - 1;\n } else {\n if (!resourceIds.has(profileKey)) {\n resourceIds.set(profileKey, group.dgroup.resources[location].resource!.id);\n }\n\n group.dgroup.resources[location].count += svcdepl.count;\n group.dgroup.resources[location].resource!.endpoints.push(\n ...buildServiceEndpoints(service, endpointSequenceNumbers),\n );\n }\n }\n }\n\n for (const group of groupsMap.values()) {\n for (const resourceUnit of group.dgroup.resources) {\n resourceUnit.resource!.endpoints.sort(\n (a, b) => a.kind - b.kind || a.sequenceNumber - b.sequenceNumber,\n );\n }\n }\n\n const sortedGroupNames = [...groupsMap.keys()].sort();\n let groups: Group[] | undefined;\n let groupSpecs: GroupSpec[] | undefined;\n\n const manifest = {\n get groups() {\n groups ??= sortedGroupNames.map((placementName) => {\n const deployments = deploymentsByPlacement.get(placementName)!;\n\n return Group.fromPartial({\n name: placementName,\n services: deployments.map(([svcName]) => {\n const service = sdl.services[svcName];\n const deployment = sdl.deployment[svcName][placementName];\n const compute = sdl.profiles.compute[deployment.profile];\n const resourceId = resourceIds.get(`${placementName}:${deployment.profile}`) || 1;\n\n return buildManifestService(\n resourceId,\n svcName,\n service,\n compute,\n deployment.count,\n endpointSequenceNumbers,\n );\n }),\n });\n });\n return groups;\n },\n get groupSpecs() {\n groupSpecs ??= sortedGroupNames.map((name) => groupsMap.get(name)!.dgroup);\n return groupSpecs;\n },\n };\n\n return { ok: true, value: manifest };\n}\n\nfunction buildResources(\n id: number,\n compute: SDLCompute,\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): Resources {\n const res = compute.resources;\n const cpuAttributes = buildResourceAttributes(res.cpu.attributes);\n const gpuAttributes = res.gpu?.attributes ? transformGpuAttributes(res.gpu.attributes) : [];\n\n return Resources.fromPartial({\n id,\n cpu: CPU.fromPartial({\n units: { val: encodeResourceValue(parseCpuUnits(res.cpu)) },\n attributes: cpuAttributes,\n }),\n memory: Memory.fromPartial({\n quantity: { val: encodeResourceValue(parseMemoryBytes(res.memory)) },\n }),\n storage: castArray(res.storage).map((s) =>\n Storage.fromPartial({\n name: s.name || \"default\",\n quantity: { val: encodeResourceValue(parseStorageBytes(s.size)) },\n attributes: buildStorageAttributes(s.attributes),\n }),\n ),\n gpu: GPU.fromPartial({\n units: { val: encodeResourceValue(parseGpuUnits(res.gpu)) },\n attributes: gpuAttributes,\n }),\n endpoints: buildServiceEndpoints(service, endpointSequenceNumbers),\n });\n}\n\nfunction buildManifestService(\n resourceId: number,\n name: string,\n service: SDLService,\n compute: SDLCompute,\n count: number,\n endpointSequenceNumbers: Record<string, number>,\n): Service {\n const credentials = service.credentials\n ? ImageCredentials.fromPartial({\n host: service.credentials.host,\n email: service.credentials.email || \"\",\n username: service.credentials.username,\n password: service.credentials.password,\n })\n : undefined;\n\n const params = buildParams(service);\n\n return Service.fromPartial({\n name,\n image: service.image,\n command: service.command || [],\n args: service.args || [],\n env: service.env || [],\n resources: buildResources(resourceId, compute, service, endpointSequenceNumbers),\n count,\n expose: buildManifestExpose(service, endpointSequenceNumbers),\n params,\n credentials,\n });\n}\n\nfunction buildParams(service: SDLService): ServiceParams | undefined {\n if (!service.params) return undefined;\n\n const storage = service.params.storage || {};\n const storageNames = service.params.storage ? Object.keys(storage).sort() : [];\n const result = ServiceParams.fromPartial({\n storage: storageNames.map((name) => {\n const config = storage[name];\n return StorageParams.fromPartial({\n name,\n mount: config.mount || \"\",\n readOnly: config.readOnly || false,\n });\n }),\n });\n\n // Permissions are not in the protobuf type but need to be preserved\n if (service.params.permissions) {\n (result as unknown as Record<string, unknown>).permissions = service.params.permissions;\n }\n\n return result;\n}\n\nfunction buildManifestExpose(\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): ServiceExpose[] {\n return (service.expose ?? [])\n .flatMap((expose) =>\n (expose.to ?? []).map((to) =>\n ServiceExpose.fromPartial({\n port: expose.port,\n externalPort: expose.as,\n proto: parseServiceProto(expose.proto),\n service: to.service || \"\",\n global: to.global || false,\n hosts: expose.accept || [],\n httpOptions: buildHttpOptions(expose.http_options),\n ip: to.ip || \"\",\n endpointSequenceNumber: endpointSequenceNumbers[to.ip!],\n }),\n ),\n )\n .sort((a, b) => {\n if (a.service !== b.service) return a.service.localeCompare(b.service);\n if (a.port !== b.port) return a.port - b.port;\n if (a.proto !== b.proto) return a.proto.localeCompare(b.proto);\n if (a.global !== b.global) return a.global ? -1 : 1;\n return 0;\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgD;AAChD,iBAAoB;AACpB,iBAAoB;AACpB,oBAAuB;AACvB,uBAA0B;AAC1B,qBAAwB;AACxB,uBAA0B;AAC1B,0BAA6B;AAC7B,mBAAsB;AACtB,qBAAwE;AACxE,2BAA8B;AAE9B,mBAA0B;AAE1B,yBAA4B;AAC5B,2BAeO;
|
|
4
|
+
"sourcesContent": ["import { PlacementRequirements, SignedBy } from \"../../generated/protos/akash/base/attributes/v1/attribute.ts\";\nimport { CPU } from \"../../generated/protos/akash/base/resources/v1beta4/cpu.ts\";\nimport { GPU } from \"../../generated/protos/akash/base/resources/v1beta4/gpu.ts\";\nimport { Memory } from \"../../generated/protos/akash/base/resources/v1beta4/memory.ts\";\nimport { Resources } from \"../../generated/protos/akash/base/resources/v1beta4/resources.ts\";\nimport { Storage } from \"../../generated/protos/akash/base/resources/v1beta4/storage.ts\";\nimport { DeploymentReclamation } from \"../../generated/protos/akash/deployment/v1/deployment.ts\";\nimport { GroupSpec } from \"../../generated/protos/akash/deployment/v1beta4/groupspec.ts\";\nimport { ResourceUnit } from \"../../generated/protos/akash/deployment/v1beta4/resourceunit.ts\";\nimport { Group } from \"../../generated/protos/akash/manifest/v2beta3/group.ts\";\nimport { ImageCredentials, Service, ServiceParams, StorageParams } from \"../../generated/protos/akash/manifest/v2beta3/service.ts\";\nimport { ServiceExpose } from \"../../generated/protos/akash/manifest/v2beta3/serviceexpose.ts\";\nimport type { ValidationError } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray } from \"../utils.ts\";\nimport type { SDLInput } from \"../validateSDL/validateSDL.ts\";\nimport { validateSDL } from \"../validateSDL/validateSDL.ts\";\nimport {\n buildHttpOptions,\n buildResourceAttributes,\n buildServiceEndpoints,\n buildStorageAttributes,\n computeEndpointSequenceNumbers,\n encodeResourceValue,\n parseCpuUnits,\n parseGpuUnits,\n parseMemoryBytes,\n parseServiceProto,\n parseStorageBytes,\n type SDLCompute,\n type SDLService,\n transformGpuAttributes,\n} from \"./manifestUtils.ts\";\nimport { minWindowToDuration } from \"./reclamationDuration.ts\";\n\nexport interface GenerateManifestOkResult {\n groups: Group[];\n groupSpecs: GroupSpec[];\n reclamation?: DeploymentReclamation;\n}\n\nexport type Manifest = GenerateManifestOkResult[\"groups\"];\nexport type GenerateManifestResult =\n | { ok?: false; value: ValidationError[] }\n | { ok: true; value: GenerateManifestOkResult };\nexport function generateManifest(sdl: SDLInput): GenerateManifestResult {\n const errors = validateSDL(sdl);\n if (errors) return { ok: false, value: errors };\n\n const endpointSequenceNumbers = computeEndpointSequenceNumbers(sdl.services);\n const groupsMap = new Map<string, {\n dgroup: GroupSpec;\n boundComputes: Record<string, number>;\n }>();\n const resourceIds = new Map<string, number>();\n\n const deploymentsByPlacement = new Map<string, [string, { profile: string; count: number }][]>();\n for (const [svcName, placements] of Object.entries(sdl.deployment)) {\n for (const [placementName, deployment] of Object.entries(placements)) {\n let list = deploymentsByPlacement.get(placementName);\n if (!list) {\n list = [];\n deploymentsByPlacement.set(placementName, list);\n }\n list.push([svcName, deployment]);\n }\n }\n for (const list of deploymentsByPlacement.values()) {\n list.sort(([a], [b]) => a.localeCompare(b));\n }\n\n const services = Object.entries(sdl.services).sort(([a], [b]) => a.localeCompare(b));\n\n for (const [svcName, service] of services) {\n for (const [placementName, svcdepl] of Object.entries(sdl.deployment[svcName])) {\n const compute = sdl.profiles.compute[svcdepl.profile];\n const infra = sdl.profiles.placement[placementName];\n const pricing = infra.pricing[svcdepl.profile];\n const price = {\n denom: pricing.denom,\n amount: pricing.amount?.toString(),\n };\n\n let group = groupsMap.get(placementName);\n\n if (!group) {\n group = {\n dgroup: GroupSpec.fromPartial({\n name: placementName,\n resources: [],\n requirements: PlacementRequirements.fromPartial({\n attributes: buildResourceAttributes(infra.attributes),\n signedBy: SignedBy.fromPartial({\n allOf: infra.signedBy?.allOf,\n anyOf: infra.signedBy?.anyOf,\n }),\n }),\n }),\n boundComputes: {},\n };\n\n groupsMap.set(placementName, group);\n }\n\n const profileKey = `${placementName}:${svcdepl.profile}`;\n const location = group.boundComputes[svcdepl.profile];\n\n if (location === undefined) {\n const resId = group.dgroup.resources.length > 0\n ? group.dgroup.resources.length + 1\n : 1;\n\n resourceIds.set(profileKey, resId);\n\n const resources = buildResources(resId, compute, service, endpointSequenceNumbers);\n\n group.dgroup.resources.push(\n ResourceUnit.fromPartial({\n resource: resources,\n count: svcdepl.count,\n price,\n }),\n );\n\n group.boundComputes[svcdepl.profile] = group.dgroup.resources.length - 1;\n } else {\n if (!resourceIds.has(profileKey)) {\n resourceIds.set(profileKey, group.dgroup.resources[location].resource!.id);\n }\n\n group.dgroup.resources[location].count += svcdepl.count;\n group.dgroup.resources[location].resource!.endpoints.push(\n ...buildServiceEndpoints(service, endpointSequenceNumbers),\n );\n }\n }\n }\n\n for (const group of groupsMap.values()) {\n for (const resourceUnit of group.dgroup.resources) {\n resourceUnit.resource!.endpoints.sort(\n (a, b) => a.kind - b.kind || a.sequenceNumber - b.sequenceNumber,\n );\n }\n }\n\n const sortedGroupNames = [...groupsMap.keys()].sort();\n let groups: Group[] | undefined;\n let groupSpecs: GroupSpec[] | undefined;\n let reclamation: DeploymentReclamation | undefined;\n\n const manifest = {\n // reclamation is a `MsgCreateDeployment` field, not a manifest group, and is\n // not needed in every call \u2014 so it's lazy like `groups`/`groupSpecs`.\n // `validateSDL` (run above) already guaranteed `min_window` is valid, so\n // `minWindowToDuration` never throws here.\n get reclamation() {\n if (sdl.reclamation && !reclamation) {\n reclamation = DeploymentReclamation.fromPartial({\n minWindow: minWindowToDuration(sdl.reclamation.min_window),\n });\n }\n return reclamation;\n },\n get groups() {\n groups ??= sortedGroupNames.map((placementName) => {\n const deployments = deploymentsByPlacement.get(placementName)!;\n\n return Group.fromPartial({\n name: placementName,\n services: deployments.map(([svcName]) => {\n const service = sdl.services[svcName];\n const deployment = sdl.deployment[svcName][placementName];\n const compute = sdl.profiles.compute[deployment.profile];\n const resourceId = resourceIds.get(`${placementName}:${deployment.profile}`) || 1;\n\n return buildManifestService(\n resourceId,\n svcName,\n service,\n compute,\n deployment.count,\n endpointSequenceNumbers,\n );\n }),\n });\n });\n return groups;\n },\n get groupSpecs() {\n groupSpecs ??= sortedGroupNames.map((name) => groupsMap.get(name)!.dgroup);\n return groupSpecs;\n },\n };\n\n return { ok: true, value: manifest };\n}\n\nfunction buildResources(\n id: number,\n compute: SDLCompute,\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): Resources {\n const res = compute.resources;\n const cpuAttributes = buildResourceAttributes(res.cpu.attributes);\n const gpuAttributes = res.gpu?.attributes ? transformGpuAttributes(res.gpu.attributes) : [];\n\n return Resources.fromPartial({\n id,\n cpu: CPU.fromPartial({\n units: { val: encodeResourceValue(parseCpuUnits(res.cpu)) },\n attributes: cpuAttributes,\n }),\n memory: Memory.fromPartial({\n quantity: { val: encodeResourceValue(parseMemoryBytes(res.memory)) },\n }),\n storage: castArray(res.storage).map((s) =>\n Storage.fromPartial({\n name: s.name || \"default\",\n quantity: { val: encodeResourceValue(parseStorageBytes(s.size)) },\n attributes: buildStorageAttributes(s.attributes),\n }),\n ),\n gpu: GPU.fromPartial({\n units: { val: encodeResourceValue(parseGpuUnits(res.gpu)) },\n attributes: gpuAttributes,\n }),\n endpoints: buildServiceEndpoints(service, endpointSequenceNumbers),\n });\n}\n\nfunction buildManifestService(\n resourceId: number,\n name: string,\n service: SDLService,\n compute: SDLCompute,\n count: number,\n endpointSequenceNumbers: Record<string, number>,\n): Service {\n const credentials = service.credentials\n ? ImageCredentials.fromPartial({\n host: service.credentials.host,\n email: service.credentials.email || \"\",\n username: service.credentials.username,\n password: service.credentials.password,\n })\n : undefined;\n\n const params = buildParams(service);\n\n return Service.fromPartial({\n name,\n image: service.image,\n command: service.command || [],\n args: service.args || [],\n env: service.env || [],\n resources: buildResources(resourceId, compute, service, endpointSequenceNumbers),\n count,\n expose: buildManifestExpose(service, endpointSequenceNumbers),\n params,\n credentials,\n });\n}\n\nfunction buildParams(service: SDLService): ServiceParams | undefined {\n if (!service.params) return undefined;\n\n const storage = service.params.storage || {};\n const storageNames = service.params.storage ? Object.keys(storage).sort() : [];\n const result = ServiceParams.fromPartial({\n storage: storageNames.map((name) => {\n const config = storage[name];\n return StorageParams.fromPartial({\n name,\n mount: config.mount || \"\",\n readOnly: config.readOnly || false,\n });\n }),\n });\n\n // Permissions are not in the protobuf type but need to be preserved\n if (service.params.permissions) {\n (result as unknown as Record<string, unknown>).permissions = service.params.permissions;\n }\n\n return result;\n}\n\nfunction buildManifestExpose(\n service: SDLService,\n endpointSequenceNumbers: Record<string, number>,\n): ServiceExpose[] {\n return (service.expose ?? [])\n .flatMap((expose) =>\n (expose.to ?? []).map((to) =>\n ServiceExpose.fromPartial({\n port: expose.port,\n externalPort: expose.as,\n proto: parseServiceProto(expose.proto),\n service: to.service || \"\",\n global: to.global || false,\n hosts: expose.accept || [],\n httpOptions: buildHttpOptions(expose.http_options),\n ip: to.ip || \"\",\n endpointSequenceNumber: endpointSequenceNumbers[to.ip!],\n }),\n ),\n )\n .sort((a, b) => {\n if (a.service !== b.service) return a.service.localeCompare(b.service);\n if (a.port !== b.port) return a.port - b.port;\n if (a.proto !== b.proto) return a.proto.localeCompare(b.proto);\n if (a.global !== b.global) return a.global ? -1 : 1;\n return 0;\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgD;AAChD,iBAAoB;AACpB,iBAAoB;AACpB,oBAAuB;AACvB,uBAA0B;AAC1B,qBAAwB;AACxB,wBAAsC;AACtC,uBAA0B;AAC1B,0BAA6B;AAC7B,mBAAsB;AACtB,qBAAwE;AACxE,2BAA8B;AAE9B,mBAA0B;AAE1B,yBAA4B;AAC5B,2BAeO;AACP,iCAAoC;AAY7B,SAAS,iBAAiB,KAAuC;AACtE,QAAM,aAAS,gCAAY,GAAG;AAC9B,MAAI,OAAQ,QAAO,EAAE,IAAI,OAAO,OAAO,OAAO;AAE9C,QAAM,8BAA0B,qDAA+B,IAAI,QAAQ;AAC3E,QAAM,YAAY,oBAAI,IAGnB;AACH,QAAM,cAAc,oBAAI,IAAoB;AAE5C,QAAM,yBAAyB,oBAAI,IAA4D;AAC/F,aAAW,CAAC,SAAS,UAAU,KAAK,OAAO,QAAQ,IAAI,UAAU,GAAG;AAClE,eAAW,CAAC,eAAe,UAAU,KAAK,OAAO,QAAQ,UAAU,GAAG;AACpE,UAAI,OAAO,uBAAuB,IAAI,aAAa;AACnD,UAAI,CAAC,MAAM;AACT,eAAO,CAAC;AACR,+BAAuB,IAAI,eAAe,IAAI;AAAA,MAChD;AACA,WAAK,KAAK,CAAC,SAAS,UAAU,CAAC;AAAA,IACjC;AAAA,EACF;AACA,aAAW,QAAQ,uBAAuB,OAAO,GAAG;AAClD,SAAK,KAAK,CAAC,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
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var reclamationDuration_exports = {};
|
|
20
|
+
__export(reclamationDuration_exports, {
|
|
21
|
+
minWindowToDuration: () => minWindowToDuration
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(reclamationDuration_exports);
|
|
24
|
+
var import_duration = require("../../generated/protos/google/protobuf/duration.cjs");
|
|
25
|
+
const UNIT_SECONDS = { s: 1n, m: 60n, h: 3600n };
|
|
26
|
+
function minWindowToDuration(value) {
|
|
27
|
+
const unitSeconds = UNIT_SECONDS[value.at(-1) ?? ""];
|
|
28
|
+
const amount = Number(value.slice(0, -1));
|
|
29
|
+
if (unitSeconds === void 0 || !Number.isInteger(amount) || amount <= 0) {
|
|
30
|
+
throw new Error(`invalid reclamation min_window "${value}"`);
|
|
31
|
+
}
|
|
32
|
+
return import_duration.Duration.fromPartial({ seconds: (BigInt(amount) * unitSeconds).toString(), nanos: 0 });
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=reclamationDuration.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/sdl/manifest/reclamationDuration.ts"],
|
|
4
|
+
"sourcesContent": ["import { Duration } from \"../../generated/protos/google/protobuf/duration.ts\";\n\nconst UNIT_SECONDS: Record<string, bigint> = { s: 1n, m: 60n, h: 3600n };\n\n/**\n * Converts a reclamation `min_window` into a proto `Duration`. The SDL schema\n * pattern (`^[1-9][0-9]*(s|m|h)$`) has already guaranteed the format (and `> 0`)\n * before this runs, so on the request hot path we split off the trailing unit\n * and parse the amount directly instead of re-running a regex. The cheap\n * unit/integer/positivity guards stay only to reject obviously-invalid direct\n * calls. Whole-unit windows are an exact second count, so `nanos` is always 0\n * and the BigInt product never loses precision.\n */\nexport function minWindowToDuration(value: string): Duration {\n const unitSeconds = UNIT_SECONDS[value.at(-1) ?? \"\"];\n const amount = Number(value.slice(0, -1));\n if (unitSeconds === undefined || !Number.isInteger(amount) || amount <= 0) {\n throw new Error(`invalid reclamation min_window \"${value}\"`);\n }\n return Duration.fromPartial({ seconds: (BigInt(amount) * unitSeconds).toString(), nanos: 0 });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AAEzB,MAAM,eAAuC,EAAE,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM;AAWhE,SAAS,oBAAoB,OAAyB;AAC3D,QAAM,cAAc,aAAa,MAAM,GAAG,EAAE,KAAK,EAAE;AACnD,QAAM,SAAS,OAAO,MAAM,MAAM,GAAG,EAAE,CAAC;AACxC,MAAI,gBAAgB,UAAa,CAAC,OAAO,UAAU,MAAM,KAAK,UAAU,GAAG;AACzE,UAAM,IAAI,MAAM,mCAAmC,KAAK,GAAG;AAAA,EAC7D;AACA,SAAO,yBAAS,YAAY,EAAE,UAAU,OAAO,MAAM,IAAI,aAAa,SAAS,GAAG,OAAO,EAAE,CAAC;AAC9F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -40,6 +40,12 @@ const ERROR_MESSAGES = {
|
|
|
40
40
|
},
|
|
41
41
|
"#/definitions/exposeToWithIpEnforcesGlobal"() {
|
|
42
42
|
return `If an IP is declared, the directive must be declared as global.`;
|
|
43
|
+
},
|
|
44
|
+
// Mirrors the shared schema's `min_window` pattern (`^[1-9][0-9]*(s|m|h)$`).
|
|
45
|
+
// Go stays the lenient layer (`go/sdl/reclamation.go` accepts any `> 0`
|
|
46
|
+
// `time.ParseDuration`), so this is a sanctioned schema-only-stricter rule.
|
|
47
|
+
"#/properties/reclamation/properties/min_window/pattern"() {
|
|
48
|
+
return `Reclamation min_window must be a whole number followed by s, m, or h (e.g. "24h", "30m").`;
|
|
43
49
|
}
|
|
44
50
|
};
|
|
45
51
|
function validateSDL(sdl) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/sdl/validateSDL/validateSDL.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ErrorMessages, ValidationError, ValidationFunction } from \"../../utils/jsonSchemaValidation.ts\";\nimport { dirname, getErrorLocation, humanizeErrors } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray, stringToBoolean } from \"../utils.ts\";\nimport { schema as validationSDLSchema, type SDLInput, validate as validateSDLInput } from \"./validateSDLInput.ts\";\n\nexport { validationSDLSchema };\nexport type { SDLInput };\n\nconst ERROR_MESSAGES: ErrorMessages = {\n \"#/definitions/storageRamClassMustNotBePersistent\"(error) {\n return `\"ram\" storage${getErrorLocation(dirname(error.instancePath))} cannot be persistent`;\n },\n \"#/definitions/exposeToWithIpEnforcesGlobal\"() {\n return `If an IP is declared, the directive must be declared as global.`;\n },\n};\n\nexport function validateSDL(sdl: SDLInput): undefined | ValidationError[] {\n validateSDLInput(sdl);\n const schemaErrors = humanizeErrors((validateSDLInput as ValidationFunction).errors, validationSDLSchema, ERROR_MESSAGES);\n if (schemaErrors.length) return schemaErrors;\n\n const validator = new SDLValidator(sdl);\n const errors = validator.validate();\n\n const allErrors = schemaErrors.concat(errors);\n return allErrors.length ? allErrors : undefined;\n}\n\nclass SDLValidator {\n readonly #endpointsUsed = new Set<string>();\n readonly #portsUsed = new Map<string, string>();\n readonly #sdl: SDLInput;\n readonly #errors: ValidationError[] = [];\n\n constructor(sdl: SDLInput) {\n this.#sdl = sdl;\n }\n\n validate() {\n if (this.#sdl.services) {\n Object.keys(this.#sdl.services).forEach((serviceName) => {\n this.#validateDeploymentWithRelations(serviceName);\n this.#validateLeaseIP(serviceName);\n });\n }\n\n this.#validateEndpoints();\n return this.#errors;\n }\n\n #validateDeploymentWithRelations(serviceName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n if (!deployment) {\n this.#errors.push({\n message: `Service \"${serviceName}\" is not defined at \"/deployment\" section.`,\n instancePath: `/deployment`,\n schemaPath: \"#/properties/deployment\",\n keyword: \"required\",\n params: {\n missingProperty: serviceName,\n },\n });\n return;\n }\n\n Object.keys(this.#sdl.deployment[serviceName]).forEach((deploymentName) => {\n this.#validateDeploymentRelations(serviceName, deploymentName);\n this.#validateServiceStorages(serviceName, deploymentName);\n this.#validateStorages(serviceName, deploymentName);\n this.#validateGPU(serviceName, deploymentName);\n });\n }\n\n #validateDeploymentRelations(serviceName: string, deploymentName: string) {\n const serviceDeployment = this.#sdl.deployment?.[serviceName]?.[deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment?.profile];\n const infra = this.#sdl.profiles?.placement?.[deploymentName];\n\n if (!infra) {\n this.#errors.push({\n message: `The placement \"${deploymentName}\" is not defined in the \"placement\" section.`,\n instancePath: `/profiles/placement`,\n schemaPath: \"#/properties/profiles/properties/placement\",\n keyword: \"required\",\n params: {\n missingProperty: deploymentName,\n },\n });\n }\n\n if (infra && !infra.pricing?.[serviceDeployment?.profile]) {\n this.#errors.push({\n message: `The pricing for the \"${serviceDeployment?.profile}\" profile is not defined in the \"${deploymentName}\" placement.`,\n instancePath: `/profiles/placement/${deploymentName}/pricing`,\n schemaPath: \"#/properties/profiles/properties/placement/additionalProperties/properties/pricing\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n\n if (!compute) {\n this.#errors.push({\n message: `The compute requirements for the \"${serviceDeployment?.profile}\" profile are not defined in the \"compute\" section.`,\n instancePath: `/profiles/compute`,\n schemaPath: \"#/properties/profiles/properties/compute\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n }\n\n #validateServiceStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const mounts: Record<string, string> = {};\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n if (!service?.params?.storage) {\n return;\n }\n\n Object.entries(service.params.storage).forEach(([storageName, storage]) => {\n if (!storage) {\n this.#errors.push({\n message: `Storage \"${storageName}\" is not configured.`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n const storageNameExists = storages.some(({ name }) => name === storageName);\n if (!storageNameExists) {\n this.#errors.push({\n message: `Service \"${serviceName}\" references non-existing compute volume \"${storageName}\".`,\n instancePath: `/profiles/compute/${serviceDeployment.profile}/resources/storage`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/storage\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n\n const mount = String(storage.mount);\n const volumeName = mounts[mount];\n\n if (volumeName && !storage.mount) {\n this.#errors.push({\n message: \"Multiple root ephemeral storages are not allowed.\",\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: volumeName,\n },\n });\n }\n if (volumeName && storage.mount) {\n this.#errors.push({\n message: `Mount \"${mount}\" already in use by volume \"${volumeName}\".`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}/mount`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: mount,\n },\n });\n }\n\n mounts[mount] = storageName;\n });\n }\n\n #validateStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n storages.forEach((storage) => {\n const persistent = stringToBoolean(storage.attributes?.persistent as string | boolean || false);\n\n if (persistent && !service?.params?.storage?.[storage.name || \"\"]?.mount) {\n this.#errors.push({\n message: `Persistent storage \"${storage.name || \"default\"}\" requires a mount path in /services/${serviceName}/params/storage/${storage.name || \"default\"}/mount.`,\n instancePath: `/services/${serviceName}/params/storage/${storage.name || \"default\"}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"required\",\n params: {\n missingProperty: \"mount\",\n },\n });\n }\n });\n }\n\n #validateGPU(serviceName: string, deploymentName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n const compute = this.#sdl.profiles?.compute?.[deployment[deploymentName]?.profile];\n const gpu = compute?.resources.gpu;\n if (!gpu) return;\n\n const hasUnits = gpu.units !== undefined && gpu.units !== 0;\n const hasAttributes = typeof gpu.attributes !== \"undefined\";\n const hasVendor = hasAttributes && typeof gpu.attributes?.vendor !== \"undefined\";\n\n const profile = deployment[deploymentName]?.profile;\n const gpuPath = `/profiles/compute/${profile}/resources/gpu`;\n\n if (!hasUnits && hasAttributes) {\n this.#errors.push({\n message: \"GPU must not have attributes if units is 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasAttributes) {\n this.#errors.push({\n message: \"GPU must have attributes if units is not 0.\",\n instancePath: gpuPath,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu\",\n keyword: \"required\",\n params: {\n missingProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasVendor) {\n this.#errors.push({\n message: \"GPU must specify a vendor if units is not 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes/properties/vendor\",\n keyword: \"required\",\n params: {\n missingProperty: \"vendor\",\n },\n });\n }\n }\n\n #validateLeaseIP(serviceName: string) {\n this.#sdl.services?.[serviceName]?.expose?.forEach((expose, exposeIndex) => {\n const proto = expose.proto?.toUpperCase() || \"TCP\";\n\n expose.to?.forEach((to, toIndex) => {\n if (to.ip?.length) {\n const toPath = `/services/${serviceName}/expose/${exposeIndex}/to/${toIndex}`;\n\n if (!to.global) {\n this.#errors.push({\n message: `If an IP is declared, the directive must be declared as global.`,\n instancePath: `${toPath}/global`,\n schemaPath: \"#/definitions/exposeToWithIpEnforcesGlobal/then/properties/global/const\",\n keyword: \"const\",\n params: {\n allowedValue: true,\n },\n });\n }\n if (!this.#sdl.endpoints?.[to.ip]) {\n this.#errors.push({\n message: `Unknown endpoint \"${to.ip}\" for service \"${serviceName}\". Add it to the \"endpoints\" section.`,\n instancePath: `/endpoints/${to.ip}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"required\",\n params: {\n missingProperty: to.ip,\n },\n });\n }\n\n this.#endpointsUsed.add(to.ip);\n\n const externalPort = expose.as ?? expose.port;\n const portKey = `${to.ip}-${externalPort}-${proto}`;\n const otherServiceName = this.#portsUsed.get(portKey);\n\n if (this.#portsUsed.has(portKey)) {\n this.#errors.push({\n message: `IP endpoint \"${to.ip}\" port ${externalPort} protocol ${proto} already in use by service \"${otherServiceName}\".`,\n instancePath: `${toPath}/ip`,\n schemaPath: \"#/properties/services/additionalProperties/properties/expose/items/properties/to/items\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: portKey,\n },\n });\n }\n this.#portsUsed.set(portKey, serviceName);\n }\n });\n });\n }\n\n #validateEndpoints() {\n if (!this.#sdl.endpoints) return;\n\n Object.keys(this.#sdl.endpoints).forEach((endpoint) => {\n if (!this.#endpointsUsed.has(endpoint)) {\n this.#errors.push({\n message: `Endpoint \"${endpoint}\" declared but never used.`,\n instancePath: `/endpoints/${endpoint}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: endpoint,\n },\n });\n }\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,qDAAAA;AAAA;AAAA;AACA,kCAA0D;AAC1D,mBAA2C;AAC3C,8BAA2F;AAH3F;AAQA,MAAM,iBAAgC;AAAA,EACpC,mDAAmD,OAAO;AACxD,WAAO,oBAAgB,kDAAiB,qCAAQ,MAAM,YAAY,CAAC,CAAC;AAAA,EACtE;AAAA,EACA,+CAA+C;AAC7C,WAAO;AAAA,EACT;AACF;AAEO,SAAS,YAAY,KAA8C;AACxE,8BAAAC,UAAiB,GAAG;AACpB,QAAM,mBAAe,4CAAgB,wBAAAA,SAAwC,QAAQ,wBAAAC,QAAqB,cAAc;AACxH,MAAI,aAAa,OAAQ,QAAO;AAEhC,QAAM,YAAY,IAAI,aAAa,GAAG;AACtC,QAAM,SAAS,UAAU,SAAS;AAElC,QAAM,YAAY,aAAa,OAAO,MAAM;AAC5C,SAAO,UAAU,SAAS,YAAY;AACxC;AAEA,MAAM,aAAa;AAAA,EAMjB,YAAY,KAAe;AAN7B;AACE,uBAAS,gBAAiB,oBAAI,IAAY;AAC1C,uBAAS,YAAa,oBAAI,IAAoB;AAC9C,uBAAS;AACT,uBAAS,SAA6B,CAAC;AAGrC,uBAAK,MAAO;AAAA,EACd;AAAA,EAEA,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U,YAAY,aAAa,KAAK,+BAA+B,gBAAgB;AAAA,YACrH,cAAc,GAAG,MAAM;AAAA,YACvB,YAAY;AAAA,YACZ,SAAS;AAAA,YACT,QAAQ;AAAA,cACN,WAAW;AAAA,YACb;AAAA,UACF,CAAC;AAAA,QACH;AACA,2BAAK,YAAW,IAAI,SAAS,WAAW;AAAA,MAC1C;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AAEA,uBAAkB,WAAG;AACnB,MAAI,CAAC,mBAAK,MAAK,UAAW;AAE1B,SAAO,KAAK,mBAAK,MAAK,SAAS,EAAE,QAAQ,CAAC,aAAa;AACrD,QAAI,CAAC,mBAAK,gBAAe,IAAI,QAAQ,GAAG;AACtC,yBAAK,SAAQ,KAAK;AAAA,QAChB,SAAS,aAAa,QAAQ;AAAA,QAC9B,cAAc,cAAc,QAAQ;AAAA,QACpC,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,oBAAoB;AAAA,QACtB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
|
|
4
|
+
"sourcesContent": ["import type { ErrorMessages, ValidationError, ValidationFunction } from \"../../utils/jsonSchemaValidation.ts\";\nimport { dirname, getErrorLocation, humanizeErrors } from \"../../utils/jsonSchemaValidation.ts\";\nimport { castArray, stringToBoolean } from \"../utils.ts\";\nimport { schema as validationSDLSchema, type SDLInput, validate as validateSDLInput } from \"./validateSDLInput.ts\";\n\nexport { validationSDLSchema };\nexport type { SDLInput };\n\nconst ERROR_MESSAGES: ErrorMessages = {\n \"#/definitions/storageRamClassMustNotBePersistent\"(error) {\n return `\"ram\" storage${getErrorLocation(dirname(error.instancePath))} cannot be persistent`;\n },\n \"#/definitions/exposeToWithIpEnforcesGlobal\"() {\n return `If an IP is declared, the directive must be declared as global.`;\n },\n // Mirrors the shared schema's `min_window` pattern (`^[1-9][0-9]*(s|m|h)$`).\n // Go stays the lenient layer (`go/sdl/reclamation.go` accepts any `> 0`\n // `time.ParseDuration`), so this is a sanctioned schema-only-stricter rule.\n \"#/properties/reclamation/properties/min_window/pattern\"() {\n return `Reclamation min_window must be a whole number followed by s, m, or h (e.g. \"24h\", \"30m\").`;\n },\n};\n\nexport function validateSDL(sdl: SDLInput): undefined | ValidationError[] {\n validateSDLInput(sdl);\n const schemaErrors = humanizeErrors((validateSDLInput as ValidationFunction).errors, validationSDLSchema, ERROR_MESSAGES);\n if (schemaErrors.length) return schemaErrors;\n\n const validator = new SDLValidator(sdl);\n const errors = validator.validate();\n\n const allErrors = schemaErrors.concat(errors);\n return allErrors.length ? allErrors : undefined;\n}\n\nclass SDLValidator {\n readonly #endpointsUsed = new Set<string>();\n readonly #portsUsed = new Map<string, string>();\n readonly #sdl: SDLInput;\n readonly #errors: ValidationError[] = [];\n\n constructor(sdl: SDLInput) {\n this.#sdl = sdl;\n }\n\n validate() {\n if (this.#sdl.services) {\n Object.keys(this.#sdl.services).forEach((serviceName) => {\n this.#validateDeploymentWithRelations(serviceName);\n this.#validateLeaseIP(serviceName);\n });\n }\n\n this.#validateEndpoints();\n return this.#errors;\n }\n\n #validateDeploymentWithRelations(serviceName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n if (!deployment) {\n this.#errors.push({\n message: `Service \"${serviceName}\" is not defined at \"/deployment\" section.`,\n instancePath: `/deployment`,\n schemaPath: \"#/properties/deployment\",\n keyword: \"required\",\n params: {\n missingProperty: serviceName,\n },\n });\n return;\n }\n\n Object.keys(this.#sdl.deployment[serviceName]).forEach((deploymentName) => {\n this.#validateDeploymentRelations(serviceName, deploymentName);\n this.#validateServiceStorages(serviceName, deploymentName);\n this.#validateStorages(serviceName, deploymentName);\n this.#validateGPU(serviceName, deploymentName);\n });\n }\n\n #validateDeploymentRelations(serviceName: string, deploymentName: string) {\n const serviceDeployment = this.#sdl.deployment?.[serviceName]?.[deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment?.profile];\n const infra = this.#sdl.profiles?.placement?.[deploymentName];\n\n if (!infra) {\n this.#errors.push({\n message: `The placement \"${deploymentName}\" is not defined in the \"placement\" section.`,\n instancePath: `/profiles/placement`,\n schemaPath: \"#/properties/profiles/properties/placement\",\n keyword: \"required\",\n params: {\n missingProperty: deploymentName,\n },\n });\n }\n\n if (infra && !infra.pricing?.[serviceDeployment?.profile]) {\n this.#errors.push({\n message: `The pricing for the \"${serviceDeployment?.profile}\" profile is not defined in the \"${deploymentName}\" placement.`,\n instancePath: `/profiles/placement/${deploymentName}/pricing`,\n schemaPath: \"#/properties/profiles/properties/placement/additionalProperties/properties/pricing\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n\n if (!compute) {\n this.#errors.push({\n message: `The compute requirements for the \"${serviceDeployment?.profile}\" profile are not defined in the \"compute\" section.`,\n instancePath: `/profiles/compute`,\n schemaPath: \"#/properties/profiles/properties/compute\",\n keyword: \"required\",\n params: {\n missingProperty: serviceDeployment?.profile,\n },\n });\n }\n }\n\n #validateServiceStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const mounts: Record<string, string> = {};\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n if (!service?.params?.storage) {\n return;\n }\n\n Object.entries(service.params.storage).forEach(([storageName, storage]) => {\n if (!storage) {\n this.#errors.push({\n message: `Storage \"${storageName}\" is not configured.`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n const storageNameExists = storages.some(({ name }) => name === storageName);\n if (!storageNameExists) {\n this.#errors.push({\n message: `Service \"${serviceName}\" references non-existing compute volume \"${storageName}\".`,\n instancePath: `/profiles/compute/${serviceDeployment.profile}/resources/storage`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/storage\",\n keyword: \"required\",\n params: {\n missingProperty: storageName,\n },\n });\n return;\n }\n\n const mount = String(storage.mount);\n const volumeName = mounts[mount];\n\n if (volumeName && !storage.mount) {\n this.#errors.push({\n message: \"Multiple root ephemeral storages are not allowed.\",\n instancePath: `/services/${serviceName}/params/storage/${storageName}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: volumeName,\n },\n });\n }\n if (volumeName && storage.mount) {\n this.#errors.push({\n message: `Mount \"${mount}\" already in use by volume \"${volumeName}\".`,\n instancePath: `/services/${serviceName}/params/storage/${storageName}/mount`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: mount,\n },\n });\n }\n\n mounts[mount] = storageName;\n });\n }\n\n #validateStorages(serviceName: string, deploymentName: string) {\n const service = this.#sdl.services?.[serviceName];\n const serviceDeployment = this.#sdl.deployment[serviceName][deploymentName];\n const compute = this.#sdl.profiles?.compute?.[serviceDeployment.profile];\n const storages = castArray(compute?.resources.storage);\n\n storages.forEach((storage) => {\n const persistent = stringToBoolean(storage.attributes?.persistent as string | boolean || false);\n\n if (persistent && !service?.params?.storage?.[storage.name || \"\"]?.mount) {\n this.#errors.push({\n message: `Persistent storage \"${storage.name || \"default\"}\" requires a mount path in /services/${serviceName}/params/storage/${storage.name || \"default\"}/mount.`,\n instancePath: `/services/${serviceName}/params/storage/${storage.name || \"default\"}`,\n schemaPath: \"#/properties/services/additionalProperties/properties/params/properties/storage/additionalProperties/properties/mount\",\n keyword: \"required\",\n params: {\n missingProperty: \"mount\",\n },\n });\n }\n });\n }\n\n #validateGPU(serviceName: string, deploymentName: string) {\n const deployment = this.#sdl.deployment[serviceName];\n const compute = this.#sdl.profiles?.compute?.[deployment[deploymentName]?.profile];\n const gpu = compute?.resources.gpu;\n if (!gpu) return;\n\n const hasUnits = gpu.units !== undefined && gpu.units !== 0;\n const hasAttributes = typeof gpu.attributes !== \"undefined\";\n const hasVendor = hasAttributes && typeof gpu.attributes?.vendor !== \"undefined\";\n\n const profile = deployment[deploymentName]?.profile;\n const gpuPath = `/profiles/compute/${profile}/resources/gpu`;\n\n if (!hasUnits && hasAttributes) {\n this.#errors.push({\n message: \"GPU must not have attributes if units is 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasAttributes) {\n this.#errors.push({\n message: \"GPU must have attributes if units is not 0.\",\n instancePath: gpuPath,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu\",\n keyword: \"required\",\n params: {\n missingProperty: \"attributes\",\n },\n });\n }\n if (hasUnits && !hasVendor) {\n this.#errors.push({\n message: \"GPU must specify a vendor if units is not 0.\",\n instancePath: `${gpuPath}/attributes`,\n schemaPath: \"#/properties/profiles/properties/compute/additionalProperties/properties/resources/properties/gpu/properties/attributes/properties/vendor\",\n keyword: \"required\",\n params: {\n missingProperty: \"vendor\",\n },\n });\n }\n }\n\n #validateLeaseIP(serviceName: string) {\n this.#sdl.services?.[serviceName]?.expose?.forEach((expose, exposeIndex) => {\n const proto = expose.proto?.toUpperCase() || \"TCP\";\n\n expose.to?.forEach((to, toIndex) => {\n if (to.ip?.length) {\n const toPath = `/services/${serviceName}/expose/${exposeIndex}/to/${toIndex}`;\n\n if (!to.global) {\n this.#errors.push({\n message: `If an IP is declared, the directive must be declared as global.`,\n instancePath: `${toPath}/global`,\n schemaPath: \"#/definitions/exposeToWithIpEnforcesGlobal/then/properties/global/const\",\n keyword: \"const\",\n params: {\n allowedValue: true,\n },\n });\n }\n if (!this.#sdl.endpoints?.[to.ip]) {\n this.#errors.push({\n message: `Unknown endpoint \"${to.ip}\" for service \"${serviceName}\". Add it to the \"endpoints\" section.`,\n instancePath: `/endpoints/${to.ip}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"required\",\n params: {\n missingProperty: to.ip,\n },\n });\n }\n\n this.#endpointsUsed.add(to.ip);\n\n const externalPort = expose.as ?? expose.port;\n const portKey = `${to.ip}-${externalPort}-${proto}`;\n const otherServiceName = this.#portsUsed.get(portKey);\n\n if (this.#portsUsed.has(portKey)) {\n this.#errors.push({\n message: `IP endpoint \"${to.ip}\" port ${externalPort} protocol ${proto} already in use by service \"${otherServiceName}\".`,\n instancePath: `${toPath}/ip`,\n schemaPath: \"#/properties/services/additionalProperties/properties/expose/items/properties/to/items\",\n keyword: \"uniqueItems\",\n params: {\n duplicate: portKey,\n },\n });\n }\n this.#portsUsed.set(portKey, serviceName);\n }\n });\n });\n }\n\n #validateEndpoints() {\n if (!this.#sdl.endpoints) return;\n\n Object.keys(this.#sdl.endpoints).forEach((endpoint) => {\n if (!this.#endpointsUsed.has(endpoint)) {\n this.#errors.push({\n message: `Endpoint \"${endpoint}\" declared but never used.`,\n instancePath: `/endpoints/${endpoint}`,\n schemaPath: \"#/properties/endpoints\",\n keyword: \"additionalProperties\",\n params: {\n additionalProperty: endpoint,\n },\n });\n }\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,qDAAAA;AAAA;AAAA;AACA,kCAA0D;AAC1D,mBAA2C;AAC3C,8BAA2F;AAH3F;AAQA,MAAM,iBAAgC;AAAA,EACpC,mDAAmD,OAAO;AACxD,WAAO,oBAAgB,kDAAiB,qCAAQ,MAAM,YAAY,CAAC,CAAC;AAAA,EACtE;AAAA,EACA,+CAA+C;AAC7C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAIA,2DAA2D;AACzD,WAAO;AAAA,EACT;AACF;AAEO,SAAS,YAAY,KAA8C;AACxE,8BAAAC,UAAiB,GAAG;AACpB,QAAM,mBAAe,4CAAgB,wBAAAA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AA,YACjC,YAAY;AAAA,YACZ,SAAS;AAAA,YACT,QAAQ;AAAA,cACN,iBAAiB,GAAG;AAAA,YACtB;AAAA,UACF,CAAC;AAAA,QACH;AAEA,2BAAK,gBAAe,IAAI,GAAG,EAAE;AAE7B,cAAM,eAAe,OAAO,MAAM,OAAO;AACzC,cAAM,UAAU,GAAG,GAAG,EAAE,IAAI,YAAY,IAAI,KAAK;AACjD,cAAM,mBAAmB,mBAAK,YAAW,IAAI,OAAO;AAEpD,YAAI,mBAAK,YAAW,IAAI,OAAO,GAAG;AAChC,6BAAK,SAAQ,KAAK;AAAA,YAChB,SAAS,gBAAgB,GAAG,EAAE,UAAU,YAAY,aAAa,KAAK,+BAA+B,gBAAgB;AAAA,YACrH,cAAc,GAAG,MAAM;AAAA,YACvB,YAAY;AAAA,YACZ,SAAS;AAAA,YACT,QAAQ;AAAA,cACN,WAAW;AAAA,YACb;AAAA,UACF,CAAC;AAAA,QACH;AACA,2BAAK,YAAW,IAAI,SAAS,WAAW;AAAA,MAC1C;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AAEA,uBAAkB,WAAG;AACnB,MAAI,CAAC,mBAAK,MAAK,UAAW;AAE1B,SAAO,KAAK,mBAAK,MAAK,SAAS,EAAE,QAAQ,CAAC,aAAa;AACrD,QAAI,CAAC,mBAAK,gBAAe,IAAI,QAAQ,GAAG;AACtC,yBAAK,SAAQ,KAAK;AAAA,QAChB,SAAS,aAAa,QAAQ;AAAA,QAC9B,cAAc,cAAc,QAAQ;AAAA,QACpC,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,oBAAoB;AAAA,QACtB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": ["validationSDLSchema", "validateSDLInput", "validationSDLSchema"]
|
|
7
7
|
}
|
|
@@ -53,7 +53,7 @@ var require_ucs2length = __commonJS({
|
|
|
53
53
|
});
|
|
54
54
|
var validate = validate27;
|
|
55
55
|
var stdin_default = validate27;
|
|
56
|
-
var schema28 = { "$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": { "enum": ["uakt", "uact"], "type": "string" } }, "required": ["denom", "amount"], "type": "object" }, "storageRamClassMustNotBePersistent": { "description": "RAM storage class must not have persistent=true", "not": { "properties": { "class": { "const": "ram" }, "persistent": { "oneOf": [{ "const": true }, { "const": "true" }] } }, "required": ["class", "persistent"] } }, "storageNonRamClassRequiresPersistent": { "description": "Non-RAM storage classes (beta1, beta2, beta3, default) require persistent=true", "if": { "properties": { "class": { "enum": ["beta1", "beta2", "beta3", "default"] } }, "required": ["class"] }, "then": { "properties": { "persistent": { "oneOf": [{ "const": true }, { "const": "true" }] } }, "required": ["persistent"] } }, "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" }] } }, "allOf": [{ "$ref": "#/definitions/storageRamClassMustNotBePersistent" }, { "$ref": "#/definitions/storageNonRamClassRequiresPersistent" }], "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": "^/" }, "gpuUnitsGt0RequiresAttributes": { "description": "GPU units > 0 requires attributes to be present", "if": { "properties": { "units": { "oneOf": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "string", "not": { "pattern": "^0+(\\.0+)?$" } }] } }, "required": ["units"] }, "then": { "required": ["attributes"] } }, "gpuAttributesRequireUnitsGt0": { "description": "GPU attributes present requires units > 0", "if": { "required": ["attributes"] }, "then": { "properties": { "units": { "oneOf": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "string", "not": { "pattern": "^0+(\\.0+)?$" } }] } }, "required": ["units"] } }, "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" }] } }, "allOf": [{ "$ref": "#/definitions/gpuUnitsGt0RequiresAttributes" }, { "$ref": "#/definitions/gpuAttributesRequireUnitsGt0" }], "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": { "oneOf": [{ "type": "array", "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": "null" }] }, "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", "events"] }, "type": "array" } }, "type": "object" } }, "type": "object" } }, "required": ["image"], "type": "object", "additionalProperties": false }, "type": "object" }, "reclamation": { "description": "Deployment-level reclamation requirements (optional). When set, providers must offer a reclamation window meeting or exceeding the specified minimum to bid on this deployment.", "additionalProperties": false, "properties": { "min_window": { "type": "string", "description": 'Minimum reclamation window duration the tenant requires. Go duration format (e.g. "1h", "24h", "720h").', "minLength": 1 } }, "required": ["min_window"], "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 schema28 = { "$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": { "enum": ["uakt", "uact"], "type": "string" } }, "required": ["denom", "amount"], "type": "object" }, "storageRamClassMustNotBePersistent": { "description": "RAM storage class must not have persistent=true", "not": { "properties": { "class": { "const": "ram" }, "persistent": { "oneOf": [{ "const": true }, { "const": "true" }] } }, "required": ["class", "persistent"] } }, "storageNonRamClassRequiresPersistent": { "description": "Non-RAM storage classes (beta1, beta2, beta3, default) require persistent=true", "if": { "properties": { "class": { "enum": ["beta1", "beta2", "beta3", "default"] } }, "required": ["class"] }, "then": { "properties": { "persistent": { "oneOf": [{ "const": true }, { "const": "true" }] } }, "required": ["persistent"] } }, "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" }] } }, "allOf": [{ "$ref": "#/definitions/storageRamClassMustNotBePersistent" }, { "$ref": "#/definitions/storageNonRamClassRequiresPersistent" }], "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": "^/" }, "gpuUnitsGt0RequiresAttributes": { "description": "GPU units > 0 requires attributes to be present", "if": { "properties": { "units": { "oneOf": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "string", "not": { "pattern": "^0+(\\.0+)?$" } }] } }, "required": ["units"] }, "then": { "required": ["attributes"] } }, "gpuAttributesRequireUnitsGt0": { "description": "GPU attributes present requires units > 0", "if": { "required": ["attributes"] }, "then": { "properties": { "units": { "oneOf": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "string", "not": { "pattern": "^0+(\\.0+)?$" } }] } }, "required": ["units"] } }, "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" }] } }, "allOf": [{ "$ref": "#/definitions/gpuUnitsGt0RequiresAttributes" }, { "$ref": "#/definitions/gpuAttributesRequireUnitsGt0" }], "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": { "oneOf": [{ "type": "array", "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": "null" }] }, "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", "events"] }, "type": "array" } }, "type": "object" } }, "type": "object" } }, "required": ["image"], "type": "object", "additionalProperties": false }, "type": "object" }, "reclamation": { "description": "Deployment-level reclamation requirements (optional). When set, providers must offer a reclamation window meeting or exceeding the specified minimum to bid on this deployment.", "additionalProperties": false, "properties": { "min_window": { "type": "string", "pattern": "^[1-9][0-9]*(s|m|h)$", "description": 'Minimum reclamation window the tenant requires, as a whole number followed by a unit (s, m, or h). E.g. "1h", "24h", "720h".' } }, "required": ["min_window"], "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 schema35 = { "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": { "enum": ["uakt", "uact"], "type": "string" } }, "required": ["denom", "amount"], "type": "object" };
|
|
58
58
|
var schema40 = { "description": "HTTP error codes for proxy retry logic", "enum": ["error", "timeout", "500", "502", "503", "504", "403", "404", "429", "off"], "type": "string" };
|
|
59
59
|
var pattern4 = new RegExp("^[a-z]+[-_0-9a-z]+$", "u");
|
|
@@ -62,6 +62,7 @@ var pattern7 = new RegExp("^[0-9]+(\\.[0-9]+)?[a-zA-Z]*$", "u");
|
|
|
62
62
|
var pattern8 = new RegExp("^0+(\\.0+)?$", "u");
|
|
63
63
|
var pattern10 = new RegExp("^[0-9]+(\\.[0-9]+)?$", "u");
|
|
64
64
|
var pattern11 = new RegExp("^/", "u");
|
|
65
|
+
var pattern12 = new RegExp("^[1-9][0-9]*(s|m|h)$", "u");
|
|
65
66
|
function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
66
67
|
let vErrors = null;
|
|
67
68
|
let errors = 0;
|
|
@@ -3410,8 +3411,8 @@ function validate27(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3410
3411
|
if (data94.min_window !== void 0) {
|
|
3411
3412
|
let data95 = data94.min_window;
|
|
3412
3413
|
if (typeof data95 === "string") {
|
|
3413
|
-
if (
|
|
3414
|
-
const err222 = { instancePath: instancePath + "/reclamation/min_window", schemaPath: "#/properties/reclamation/properties/min_window/
|
|
3414
|
+
if (!pattern12.test(data95)) {
|
|
3415
|
+
const err222 = { instancePath: instancePath + "/reclamation/min_window", schemaPath: "#/properties/reclamation/properties/min_window/pattern", keyword: "pattern", params: { pattern: "^[1-9][0-9]*(s|m|h)$" }, message: 'must match pattern "^[1-9][0-9]*(s|m|h)$"' };
|
|
3415
3416
|
if (vErrors === null) {
|
|
3416
3417
|
vErrors = [err222];
|
|
3417
3418
|
} else {
|