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

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.
Files changed (88) hide show
  1. package/README.md +42 -4
  2. package/dist/cjs/index.shared.cjs +1 -0
  3. package/dist/cjs/index.shared.cjs.map +2 -2
  4. package/dist/cjs/sdl/SDL/SDL.cjs +5 -3
  5. package/dist/cjs/sdl/SDL/SDL.cjs.map +2 -2
  6. package/dist/cjs/sdl/SDL/SdlValidationError.cjs.map +2 -2
  7. package/dist/cjs/sdl/index.cjs +6 -1
  8. package/dist/cjs/sdl/index.cjs.map +2 -2
  9. package/dist/cjs/sdl/manifest/generateManifest.cjs +241 -0
  10. package/dist/cjs/sdl/manifest/generateManifest.cjs.map +7 -0
  11. package/dist/cjs/sdl/manifest/generateManifestVersion.cjs +84 -0
  12. package/dist/cjs/sdl/manifest/generateManifestVersion.cjs.map +7 -0
  13. package/dist/cjs/sdl/manifest/manifestUtils.cjs +138 -0
  14. package/dist/cjs/sdl/manifest/manifestUtils.cjs.map +7 -0
  15. package/dist/cjs/sdl/types.cjs.map +1 -1
  16. package/dist/cjs/sdl/{SDL/utils.cjs.map → utils.cjs.map} +1 -1
  17. package/dist/cjs/sdl/{SDL/validateSDL → validateSDL}/validateSDL.cjs +20 -13
  18. package/dist/cjs/sdl/validateSDL/validateSDL.cjs.map +7 -0
  19. package/dist/cjs/sdl/{SDL/validateSDL → validateSDL}/validateSDLInput.cjs +84 -25
  20. package/dist/cjs/sdl/validateSDL/validateSDLInput.cjs.map +7 -0
  21. package/dist/cjs/utils/yaml.cjs +44 -0
  22. package/dist/cjs/utils/yaml.cjs.map +7 -0
  23. package/dist/esm/chunk-2XL6OX6E.js +1 -0
  24. package/dist/esm/chunk-2XL6OX6E.js.map +7 -0
  25. package/dist/esm/{chunk-K3L3J5XB.js → chunk-4D3QNKFB.js} +3 -3
  26. package/dist/esm/{chunk-DUCGLLTN.js → chunk-5DCYIWCG.js} +100 -100
  27. package/dist/esm/{chunk-DUCGLLTN.js.map → chunk-5DCYIWCG.js.map} +4 -4
  28. package/dist/esm/{chunk-BGBAJIKV.js → chunk-5YECXI3P.js} +2 -2
  29. package/dist/esm/{chunk-MEXNRJE4.js → chunk-BYQF33C6.js} +2 -2
  30. package/dist/esm/{chunk-R5DUC7IU.js → chunk-C7UQYVYH.js} +2 -2
  31. package/dist/esm/{chunk-726NIMPF.js → chunk-JISXXX24.js} +2 -2
  32. package/dist/esm/{chunk-XPLMSDXV.js → chunk-QSKWS3TI.js} +553 -78
  33. package/dist/esm/chunk-QSKWS3TI.js.map +7 -0
  34. package/dist/esm/{chunk-EYW7M3KV.js → chunk-SA4SEZ6F.js} +2 -2
  35. package/dist/esm/{chunk-ST2QQ72E.js → chunk-VRE72ZD5.js} +2 -2
  36. package/dist/esm/{chunk-A5CS5ZKQ.js → chunk-XFCN5LRY.js} +2 -2
  37. package/dist/esm/chunk-Z5KZUB7X.js +364 -0
  38. package/dist/esm/chunk-Z5KZUB7X.js.map +7 -0
  39. package/dist/esm/generated/protos/index.akash.v1.js +6 -6
  40. package/dist/esm/generated/protos/index.akash.v1beta4.js +14 -349
  41. package/dist/esm/generated/protos/index.akash.v1beta4.js.map +4 -4
  42. package/dist/esm/generated/protos/index.akash.v1beta5.js +5 -5
  43. package/dist/esm/generated/protos/index.provider.akash.v1.js +3 -3
  44. package/dist/esm/generated/protos/index.provider.akash.v2beta3.js +3 -2
  45. package/dist/esm/index.js +30 -4
  46. package/dist/esm/index.js.map +1 -1
  47. package/dist/esm/index.web.js +29 -3
  48. package/dist/esm/index.web.js.map +1 -1
  49. package/dist/esm/{query_akash-XTPHUGJZ.js → query_akash-4CTLBKZR.js} +4 -4
  50. package/dist/esm/{query_akash-IXSQT2VJ.js → query_akash-DJ7LTLRE.js} +5 -5
  51. package/dist/esm/{service_akash-YMJ4ZYYX.js → service_akash-AZFAYT7H.js} +4 -4
  52. package/dist/esm/{service_akash-2EBLHFIP.js → service_akash-VMU3LNBA.js} +4 -4
  53. package/dist/esm/{service_akash-AYYJKBHS.js → service_akash-WRGOVR7I.js} +4 -4
  54. package/dist/sdl-schema.yaml +12 -1
  55. package/dist/tsconfig.build.tsbuildinfo +1 -1
  56. package/dist/types/index.shared.d.ts +1 -0
  57. package/dist/types/sdl/SDL/SDL.d.ts +2 -0
  58. package/dist/types/sdl/SDL/SdlValidationError.d.ts +3 -0
  59. package/dist/types/sdl/index.d.ts +5 -2
  60. package/dist/types/sdl/manifest/generateManifest.d.ts +18 -0
  61. package/dist/types/sdl/manifest/generateManifestVersion.d.ts +3 -0
  62. package/dist/types/sdl/manifest/manifestUtils.d.ts +27 -0
  63. package/dist/types/sdl/types.d.ts +60 -0
  64. package/dist/types/sdl/{SDL/validateSDL → validateSDL}/validateSDL.d.ts +2 -2
  65. package/dist/types/sdl/{SDL/validateSDL → validateSDL}/validateSDLInput.d.ts +16 -0
  66. package/dist/types/utils/yaml.d.ts +38 -0
  67. package/package.json +1 -1
  68. package/dist/cjs/sdl/SDL/validateSDL/validateSDL.cjs.map +0 -7
  69. package/dist/cjs/sdl/SDL/validateSDL/validateSDLInput.cjs.map +0 -7
  70. package/dist/cjs/test.cjs +0 -192
  71. package/dist/cjs/test.cjs.map +0 -7
  72. package/dist/esm/chunk-XPLMSDXV.js.map +0 -7
  73. package/dist/types/test.d.ts +0 -1
  74. /package/dist/cjs/sdl/{SDL/utils.cjs → utils.cjs} +0 -0
  75. /package/dist/esm/{chunk-K3L3J5XB.js.map → chunk-4D3QNKFB.js.map} +0 -0
  76. /package/dist/esm/{chunk-BGBAJIKV.js.map → chunk-5YECXI3P.js.map} +0 -0
  77. /package/dist/esm/{chunk-MEXNRJE4.js.map → chunk-BYQF33C6.js.map} +0 -0
  78. /package/dist/esm/{chunk-R5DUC7IU.js.map → chunk-C7UQYVYH.js.map} +0 -0
  79. /package/dist/esm/{chunk-726NIMPF.js.map → chunk-JISXXX24.js.map} +0 -0
  80. /package/dist/esm/{chunk-EYW7M3KV.js.map → chunk-SA4SEZ6F.js.map} +0 -0
  81. /package/dist/esm/{chunk-ST2QQ72E.js.map → chunk-VRE72ZD5.js.map} +0 -0
  82. /package/dist/esm/{chunk-A5CS5ZKQ.js.map → chunk-XFCN5LRY.js.map} +0 -0
  83. /package/dist/esm/{query_akash-XTPHUGJZ.js.map → query_akash-4CTLBKZR.js.map} +0 -0
  84. /package/dist/esm/{query_akash-IXSQT2VJ.js.map → query_akash-DJ7LTLRE.js.map} +0 -0
  85. /package/dist/esm/{service_akash-YMJ4ZYYX.js.map → service_akash-AZFAYT7H.js.map} +0 -0
  86. /package/dist/esm/{service_akash-2EBLHFIP.js.map → service_akash-VMU3LNBA.js.map} +0 -0
  87. /package/dist/esm/{service_akash-AYYJKBHS.js.map → service_akash-WRGOVR7I.js.map} +0 -0
  88. /package/dist/types/sdl/{SDL/utils.d.ts → utils.d.ts} +0 -0
@@ -1,6 +1,31 @@
1
+ import {
2
+ Group,
3
+ ImageCredentials,
4
+ Service,
5
+ ServiceExpose,
6
+ ServiceExposeHTTPOptions,
7
+ ServiceParams,
8
+ StorageParams
9
+ } from "./chunk-VRE72ZD5.js";
1
10
  import {
2
11
  TxRaw
3
12
  } from "./chunk-XIHNXIBW.js";
13
+ import {
14
+ GroupSpec,
15
+ ResourceUnit
16
+ } from "./chunk-5YECXI3P.js";
17
+ import {
18
+ CPU,
19
+ Endpoint,
20
+ GPU,
21
+ Memory,
22
+ Resources,
23
+ Storage
24
+ } from "./chunk-5DCYIWCG.js";
25
+ import {
26
+ PlacementRequirements,
27
+ SignedBy
28
+ } from "./chunk-JGBH2EPB.js";
4
29
  import {
5
30
  __privateAdd,
6
31
  __privateGet,
@@ -20,31 +45,7 @@ var USDC_IBC_DENOMS = {
20
45
  };
21
46
  var AKT_DENOM = "uakt";
22
47
 
23
- // src/sdl/SDL/SdlValidationError.ts
24
- var SdlValidationError = class _SdlValidationError extends Error {
25
- /**
26
- * Asserts a condition and throws an `SdlValidationError` if the condition is false.
27
- * @param condition - The condition to assert.
28
- * @param message - The error message to throw if the assertion fails.
29
- * @example
30
- * SdlValidationError.assert(someCondition, "Condition failed");
31
- */
32
- static assert(condition, message) {
33
- if (!condition) {
34
- throw new _SdlValidationError(message);
35
- }
36
- }
37
- /**
38
- * Creates an instance of `SdlValidationError`.
39
- * @param message - The error message.
40
- */
41
- constructor(message) {
42
- super(message);
43
- this.name = "SdlValidationError";
44
- }
45
- };
46
-
47
- // src/sdl/SDL/validateSDL/validateSDLInput.ts
48
+ // src/sdl/validateSDL/validateSDLInput.ts
48
49
  var __getOwnPropNames = Object.getOwnPropertyNames;
49
50
  var __commonJS = (cb, mod) => function __require() {
50
51
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -74,13 +75,13 @@ var require_ucs2length = __commonJS({
74
75
  }
75
76
  });
76
77
  var validate = validate11;
77
- 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" };
78
+ 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|uact|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" };
78
79
  var schema20 = { "description": "HTTP error codes for proxy retry logic", "enum": ["error", "timeout", "500", "502", "503", "504", "403", "404", "429", "off"], "type": "string" };
79
80
  var pattern2 = new RegExp("^[a-z]+[-_0-9a-z]+$", "u");
80
81
  var pattern4 = new RegExp("^0+(\\.0+)?m?$", "u");
81
82
  var pattern5 = new RegExp("^[0-9]+(\\.[0-9]+)?[a-zA-Z]*$", "u");
82
83
  var pattern6 = new RegExp("^[0-9]+(\\.[0-9]+)?$", "u");
83
- var pattern7 = new RegExp("^(uakt|ibc/.*)$", "u");
84
+ var pattern7 = new RegExp("^(uakt|uact|ibc/.*)$", "u");
84
85
  var pattern8 = new RegExp("^/", "u");
85
86
  function validate12(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
86
87
  let vErrors = null;
@@ -1431,7 +1432,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
1431
1432
  let data36 = data34.denom;
1432
1433
  if (typeof data36 === "string") {
1433
1434
  if (!pattern7.test(data36)) {
1434
- const err83 = { instancePath: instancePath + "/profiles/placement/" + key17.replace(/~/g, "~0").replace(/\//g, "~1") + "/pricing/" + key19.replace(/~/g, "~0").replace(/\//g, "~1") + "/denom", schemaPath: "#/definitions/priceCoin/properties/denom/pattern", keyword: "pattern", params: { pattern: "^(uakt|ibc/.*)$" }, message: 'must match pattern "^(uakt|ibc/.*)$"' };
1435
+ const err83 = { instancePath: instancePath + "/profiles/placement/" + key17.replace(/~/g, "~0").replace(/\//g, "~1") + "/pricing/" + key19.replace(/~/g, "~0").replace(/\//g, "~1") + "/denom", schemaPath: "#/definitions/priceCoin/properties/denom/pattern", keyword: "pattern", params: { pattern: "^(uakt|uact|ibc/.*)$" }, message: 'must match pattern "^(uakt|uact|ibc/.*)$"' };
1435
1436
  if (vErrors === null) {
1436
1437
  vErrors = [err83];
1437
1438
  } else {
@@ -2738,7 +2739,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
2738
2739
  let data84 = data43.params;
2739
2740
  if (data84 && typeof data84 == "object" && !Array.isArray(data84)) {
2740
2741
  for (const key29 in data84) {
2741
- if (!(key29 === "storage")) {
2742
+ if (!(key29 === "storage" || key29 === "permissions")) {
2742
2743
  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" };
2743
2744
  if (vErrors === null) {
2744
2745
  vErrors = [err185];
@@ -2827,63 +2828,122 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
2827
2828
  errors++;
2828
2829
  }
2829
2830
  }
2831
+ if (data84.permissions !== void 0) {
2832
+ let data89 = data84.permissions;
2833
+ if (data89 && typeof data89 == "object" && !Array.isArray(data89)) {
2834
+ for (const key32 in data89) {
2835
+ if (!(key32 === "read")) {
2836
+ 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" };
2837
+ if (vErrors === null) {
2838
+ vErrors = [err193];
2839
+ } else {
2840
+ vErrors.push(err193);
2841
+ }
2842
+ errors++;
2843
+ }
2844
+ }
2845
+ if (data89.read !== void 0) {
2846
+ let data90 = data89.read;
2847
+ if (Array.isArray(data90)) {
2848
+ const len16 = data90.length;
2849
+ for (let i16 = 0; i16 < len16; i16++) {
2850
+ let data91 = data90[i16];
2851
+ if (typeof data91 !== "string") {
2852
+ 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" };
2853
+ if (vErrors === null) {
2854
+ vErrors = [err194];
2855
+ } else {
2856
+ vErrors.push(err194);
2857
+ }
2858
+ errors++;
2859
+ }
2860
+ if (!(data91 === "deployment" || data91 === "logs")) {
2861
+ 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" };
2862
+ if (vErrors === null) {
2863
+ vErrors = [err195];
2864
+ } else {
2865
+ vErrors.push(err195);
2866
+ }
2867
+ errors++;
2868
+ }
2869
+ }
2870
+ } else {
2871
+ 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" };
2872
+ if (vErrors === null) {
2873
+ vErrors = [err196];
2874
+ } else {
2875
+ vErrors.push(err196);
2876
+ }
2877
+ errors++;
2878
+ }
2879
+ }
2880
+ } else {
2881
+ 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" };
2882
+ if (vErrors === null) {
2883
+ vErrors = [err197];
2884
+ } else {
2885
+ vErrors.push(err197);
2886
+ }
2887
+ errors++;
2888
+ }
2889
+ }
2830
2890
  } else {
2831
- 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" };
2891
+ 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" };
2832
2892
  if (vErrors === null) {
2833
- vErrors = [err193];
2893
+ vErrors = [err198];
2834
2894
  } else {
2835
- vErrors.push(err193);
2895
+ vErrors.push(err198);
2836
2896
  }
2837
2897
  errors++;
2838
2898
  }
2839
2899
  }
2840
2900
  } else {
2841
- 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" };
2901
+ 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" };
2842
2902
  if (vErrors === null) {
2843
- vErrors = [err194];
2903
+ vErrors = [err199];
2844
2904
  } else {
2845
- vErrors.push(err194);
2905
+ vErrors.push(err199);
2846
2906
  }
2847
2907
  errors++;
2848
2908
  }
2849
2909
  }
2850
2910
  } else {
2851
- const err195 = { instancePath: instancePath + "/services", schemaPath: "#/properties/services/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2911
+ const err200 = { instancePath: instancePath + "/services", schemaPath: "#/properties/services/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2852
2912
  if (vErrors === null) {
2853
- vErrors = [err195];
2913
+ vErrors = [err200];
2854
2914
  } else {
2855
- vErrors.push(err195);
2915
+ vErrors.push(err200);
2856
2916
  }
2857
2917
  errors++;
2858
2918
  }
2859
2919
  }
2860
2920
  if (data.version !== void 0) {
2861
- let data89 = data.version;
2862
- if (typeof data89 !== "string") {
2863
- const err196 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2921
+ let data92 = data.version;
2922
+ if (typeof data92 !== "string") {
2923
+ const err201 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2864
2924
  if (vErrors === null) {
2865
- vErrors = [err196];
2925
+ vErrors = [err201];
2866
2926
  } else {
2867
- vErrors.push(err196);
2927
+ vErrors.push(err201);
2868
2928
  }
2869
2929
  errors++;
2870
2930
  }
2871
- if (!(data89 === "2.0" || data89 === "2.1")) {
2872
- 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" };
2931
+ if (!(data92 === "2.0" || data92 === "2.1")) {
2932
+ 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" };
2873
2933
  if (vErrors === null) {
2874
- vErrors = [err197];
2934
+ vErrors = [err202];
2875
2935
  } else {
2876
- vErrors.push(err197);
2936
+ vErrors.push(err202);
2877
2937
  }
2878
2938
  errors++;
2879
2939
  }
2880
2940
  }
2881
2941
  } else {
2882
- const err198 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2942
+ const err203 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2883
2943
  if (vErrors === null) {
2884
- vErrors = [err198];
2944
+ vErrors = [err203];
2885
2945
  } else {
2886
- vErrors.push(err198);
2946
+ vErrors.push(err203);
2887
2947
  }
2888
2948
  errors++;
2889
2949
  }
@@ -2990,7 +3050,7 @@ function getErrorLocation(path) {
2990
3050
  return path ? ` at "${path}"` : "";
2991
3051
  }
2992
3052
 
2993
- // src/sdl/SDL/utils.ts
3053
+ // src/sdl/utils.ts
2994
3054
  function castArray(value) {
2995
3055
  if (value === void 0 || value === null) return [];
2996
3056
  return Array.isArray(value) ? value : [value];
@@ -3010,7 +3070,7 @@ function stringToBoolean(str) {
3010
3070
  }
3011
3071
  }
3012
3072
 
3013
- // src/sdl/SDL/validateSDL/validateSDL.ts
3073
+ // src/sdl/validateSDL/validateSDL.ts
3014
3074
  var ERROR_MESSAGES = {
3015
3075
  "#/definitions/storageAttributesValidation"(error) {
3016
3076
  return `"ram" storage${getErrorLocation(dirname(error.instancePath))} cannot be persistent`;
@@ -3028,7 +3088,7 @@ function validateSDL(sdl, networkId) {
3028
3088
  const allErrors = schemaErrors.concat(errors);
3029
3089
  return allErrors.length ? allErrors : void 0;
3030
3090
  }
3031
- var _endpointsUsed, _portsUsed, _sdl, _errors, _SDLValidator_instances, validateDenom_fn, validateDeploymentWithRelations_fn, validateDeploymentRelations_fn, validateServiceStorages_fn, validateStorages_fn, validateGPU_fn, validateLeaseIP_fn, validateEndpoints_fn;
3091
+ var _endpointsUsed, _portsUsed, _sdl, _errors, _SDLValidator_instances, validateDenom_fn, findInvalidUsdcDenom_fn, validateDeploymentWithRelations_fn, validateDeploymentRelations_fn, validateServiceStorages_fn, validateStorages_fn, validateGPU_fn, validateLeaseIP_fn, validateEndpoints_fn;
3032
3092
  var SDLValidator = class {
3033
3093
  constructor(sdl) {
3034
3094
  __privateAdd(this, _SDLValidator_instances);
@@ -3058,26 +3118,33 @@ _SDLValidator_instances = new WeakSet();
3058
3118
  validateDenom_fn = function(networkId) {
3059
3119
  if (!__privateGet(this, _sdl).profiles?.placement) return;
3060
3120
  const usdcDenom = USDC_IBC_DENOMS[networkId];
3061
- const denoms = Object.entries(__privateGet(this, _sdl).profiles.placement).map(([placementName, placement]) => {
3062
- if (!placement.pricing) return [];
3063
- return Object.entries(placement.pricing).map(([profile, pricing]) => ({
3064
- path: `/profiles/placement/${placementName}/pricing/${profile}/denom`,
3065
- denom: pricing.denom
3066
- }));
3067
- }).flat();
3068
- const invalidDenom = denoms.find(({ denom }) => denom !== AKT_DENOM && denom !== usdcDenom);
3121
+ const invalidDenom = __privateMethod(this, _SDLValidator_instances, findInvalidUsdcDenom_fn).call(this, usdcDenom);
3069
3122
  if (invalidDenom) {
3070
3123
  __privateGet(this, _errors).push({
3071
- message: `Invalid denom: "${invalidDenom.denom}" at path "${invalidDenom.path}". Only "uakt" and "${usdcDenom}" are supported.`,
3124
+ message: `Invalid format: "denom" at "${invalidDenom.path}" does not match pattern "^(uakt|uact|${usdcDenom})$"`,
3072
3125
  instancePath: invalidDenom.path,
3073
3126
  schemaPath: "#/definitions/priceCoin/properties/denom",
3074
3127
  keyword: "pattern",
3075
3128
  params: {
3076
- pattern: "^(uakt|ibc/.*)$"
3129
+ pattern: "^(uakt|uact|ibc/.*)$"
3077
3130
  }
3078
3131
  });
3079
3132
  }
3080
3133
  };
3134
+ findInvalidUsdcDenom_fn = function(usdcDenom) {
3135
+ for (const [placementName, placement] of Object.entries(__privateGet(this, _sdl).profiles.placement)) {
3136
+ if (!placement.pricing) continue;
3137
+ for (const [profile, pricing] of Object.entries(placement.pricing)) {
3138
+ if (pricing.denom.startsWith("ibc/") && pricing.denom !== usdcDenom) {
3139
+ return {
3140
+ path: `/profiles/placement/${placementName}/pricing/${profile}/denom`,
3141
+ denom: pricing.denom
3142
+ };
3143
+ }
3144
+ }
3145
+ }
3146
+ return null;
3147
+ };
3081
3148
  validateDeploymentWithRelations_fn = function(serviceName) {
3082
3149
  const deployment = __privateGet(this, _sdl).deployment[serviceName];
3083
3150
  if (!deployment) {
@@ -3328,6 +3395,30 @@ validateEndpoints_fn = function() {
3328
3395
  });
3329
3396
  };
3330
3397
 
3398
+ // src/sdl/SDL/SdlValidationError.ts
3399
+ var SdlValidationError = class _SdlValidationError extends Error {
3400
+ /**
3401
+ * Asserts a condition and throws an `SdlValidationError` if the condition is false.
3402
+ * @param condition - The condition to assert.
3403
+ * @param message - The error message to throw if the assertion fails.
3404
+ * @example
3405
+ * SdlValidationError.assert(someCondition, "Condition failed");
3406
+ */
3407
+ static assert(condition, message) {
3408
+ if (!condition) {
3409
+ throw new _SdlValidationError(message);
3410
+ }
3411
+ }
3412
+ /**
3413
+ * Creates an instance of `SdlValidationError`.
3414
+ * @param message - The error message.
3415
+ */
3416
+ constructor(message) {
3417
+ super(message);
3418
+ this.name = "SdlValidationError";
3419
+ }
3420
+ };
3421
+
3331
3422
  // src/sdl/SDL/SDL.ts
3332
3423
  import YAML from "js-yaml";
3333
3424
  import { default as stableStringify } from "json-stable-stringify";
@@ -3410,8 +3501,8 @@ var _SDL = class _SDL {
3410
3501
  * const sdl = SDL.fromString(yaml);
3411
3502
  * ```
3412
3503
  */
3413
- static fromString(yaml, version = "beta3", networkId = MAINNET_ID) {
3414
- const data = YAML.load(yaml);
3504
+ static fromString(yaml2, version = "beta3", networkId = MAINNET_ID) {
3505
+ const data = YAML.load(yaml2);
3415
3506
  return new _SDL(data, version, networkId);
3416
3507
  }
3417
3508
  services() {
@@ -3452,8 +3543,8 @@ var _SDL = class _SDL {
3452
3543
  return value;
3453
3544
  }
3454
3545
  const strVal = value.toString();
3455
- const encoder = new TextEncoder();
3456
- return asString ? strVal : encoder.encode(strVal);
3546
+ const encoder3 = new TextEncoder();
3547
+ return asString ? strVal : encoder3.encode(strVal);
3457
3548
  }
3458
3549
  serviceResourceCpu(resource) {
3459
3550
  const units = isString(resource.units) ? convertCpuResourceString(resource.units) : resource.units * 1e3;
@@ -3681,7 +3772,8 @@ var _SDL = class _SDL {
3681
3772
  mount: params.storage[name].mount,
3682
3773
  readOnly: params.storage[name].readOnly || false
3683
3774
  };
3684
- })
3775
+ }),
3776
+ ...params?.permissions ? { Permissions: params.permissions } : {}
3685
3777
  };
3686
3778
  }
3687
3779
  v3ManifestServiceParams(params) {
@@ -3696,7 +3788,8 @@ var _SDL = class _SDL {
3696
3788
  mount: params.storage[name]?.mount,
3697
3789
  readOnly: params.storage[name]?.readOnly || false
3698
3790
  };
3699
- })
3791
+ }),
3792
+ ...params?.permissions ? { permissions: params.permissions } : {}
3700
3793
  };
3701
3794
  }
3702
3795
  v2ManifestService(placement, name, asString) {
@@ -4039,6 +4132,384 @@ escapeHtml_fn = function(raw) {
4039
4132
  };
4040
4133
  var SDL = _SDL;
4041
4134
 
4135
+ // src/sdl/manifest/manifestUtils.ts
4136
+ var encoder = new TextEncoder();
4137
+ function encodeResourceValue(value) {
4138
+ return encoder.encode(value.toString());
4139
+ }
4140
+ function computeEndpointSequenceNumbers(services) {
4141
+ const endpointNames = [];
4142
+ for (const service of Object.values(services)) {
4143
+ if (!service.expose) continue;
4144
+ for (const expose of service.expose) {
4145
+ if (!expose.to) continue;
4146
+ for (const to of expose.to) {
4147
+ if (to.global && to.ip && to.ip.length > 0) {
4148
+ endpointNames.push(to.ip);
4149
+ }
4150
+ }
4151
+ }
4152
+ }
4153
+ return endpointNames.sort().reduce((result, name, seqNumber) => {
4154
+ result[name] = seqNumber + 1;
4155
+ return result;
4156
+ }, {});
4157
+ }
4158
+ function isIngress(proto, global, externalPort, port) {
4159
+ const effectivePort = externalPort === 0 ? port : externalPort;
4160
+ return global && proto === "TCP" && effectivePort === 80;
4161
+ }
4162
+ function transformGpuAttributes(attributes) {
4163
+ const vendor = attributes.vendor;
4164
+ if (!vendor) return [];
4165
+ return Object.entries(vendor).flatMap(
4166
+ ([vendorName, models]) => models ? models.map((model) => {
4167
+ let key = `vendor/${vendorName}/model/${model.model}`;
4168
+ if (model.ram) key += `/ram/${model.ram}`;
4169
+ if (model.interface) key += `/interface/${model.interface}`;
4170
+ return { key, value: "true" };
4171
+ }) : [{ key: `vendor/${vendorName}/model/*`, value: "true" }]
4172
+ );
4173
+ }
4174
+ function buildHttpOptions(httpOptions) {
4175
+ return ServiceExposeHTTPOptions.fromPartial({
4176
+ maxBodySize: httpOptions?.max_body_size ?? 1048576,
4177
+ readTimeout: httpOptions?.read_timeout ?? 6e4,
4178
+ sendTimeout: httpOptions?.send_timeout ?? 6e4,
4179
+ nextTries: httpOptions?.next_tries ?? 3,
4180
+ nextTimeout: httpOptions?.next_timeout ?? 0,
4181
+ nextCases: httpOptions?.next_cases ?? ["error", "timeout"]
4182
+ });
4183
+ }
4184
+ function buildStorageAttributes(attributes) {
4185
+ if (!attributes) return [];
4186
+ const pairs = Object.entries(attributes).map(([key, value]) => ({
4187
+ key,
4188
+ value: String(value)
4189
+ }));
4190
+ if (attributes.class === "ram" && !("persistent" in attributes)) {
4191
+ pairs.push({ key: "persistent", value: "false" });
4192
+ }
4193
+ pairs.sort((a, b) => a.key.localeCompare(b.key));
4194
+ return pairs;
4195
+ }
4196
+ function parseServiceProto(proto) {
4197
+ return proto?.toUpperCase() || "TCP";
4198
+ }
4199
+ function buildServiceEndpoints(service, endpointSequenceNumbers) {
4200
+ return (service.expose ?? []).flatMap(
4201
+ (expose) => (expose.to ?? []).filter((to) => to.global).flatMap((to) => {
4202
+ const externalPort = expose.as || 0;
4203
+ const proto = parseServiceProto(expose.proto);
4204
+ const kind = isIngress(proto, !!to.global, externalPort, expose.port) ? 0 /* SHARED_HTTP */ : 1 /* RANDOM_PORT */;
4205
+ const defaultEp = Endpoint.fromPartial({
4206
+ kind,
4207
+ sequenceNumber: 0
4208
+ });
4209
+ const leasedEp = to.ip && to.ip.length > 0 ? Endpoint.fromPartial({
4210
+ kind: 2 /* LEASED_IP */,
4211
+ sequenceNumber: endpointSequenceNumbers[to.ip]
4212
+ }) : void 0;
4213
+ return leasedEp ? [defaultEp, leasedEp] : [defaultEp];
4214
+ })
4215
+ );
4216
+ }
4217
+ function parseCpuUnits(cpu) {
4218
+ return typeof cpu.units === "string" ? convertCpuResourceString(cpu.units) : cpu.units * 1e3;
4219
+ }
4220
+ function parseMemoryBytes(memory) {
4221
+ return convertResourceString(memory.size);
4222
+ }
4223
+ function parseStorageBytes(size) {
4224
+ return convertResourceString(size);
4225
+ }
4226
+ function parseGpuUnits(gpu) {
4227
+ const value = gpu?.units;
4228
+ if (value === void 0 || value === null) return 0;
4229
+ return typeof value === "string" ? parseInt(value, 10) : value;
4230
+ }
4231
+ function buildResourceAttributes(attributes) {
4232
+ if (!attributes) return void 0;
4233
+ return Object.entries(attributes).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => ({ key, value: String(value) }));
4234
+ }
4235
+
4236
+ // src/sdl/manifest/generateManifest.ts
4237
+ function generateManifest(sdl, networkId = MAINNET_ID) {
4238
+ const errors = validateSDL(sdl, networkId);
4239
+ if (errors) return { ok: false, value: errors };
4240
+ const endpointSequenceNumbers = computeEndpointSequenceNumbers(sdl.services);
4241
+ const groupsMap = /* @__PURE__ */ new Map();
4242
+ const resourceIds = /* @__PURE__ */ new Map();
4243
+ const deploymentsByPlacement = /* @__PURE__ */ new Map();
4244
+ for (const [svcName, placements] of Object.entries(sdl.deployment)) {
4245
+ for (const [placementName, deployment] of Object.entries(placements)) {
4246
+ let list = deploymentsByPlacement.get(placementName);
4247
+ if (!list) {
4248
+ list = [];
4249
+ deploymentsByPlacement.set(placementName, list);
4250
+ }
4251
+ list.push([svcName, deployment]);
4252
+ }
4253
+ }
4254
+ for (const list of deploymentsByPlacement.values()) {
4255
+ list.sort(([a], [b]) => a.localeCompare(b));
4256
+ }
4257
+ const services = Object.entries(sdl.services).sort(([a], [b]) => a.localeCompare(b));
4258
+ for (const [svcName, service] of services) {
4259
+ for (const [placementName, svcdepl] of Object.entries(sdl.deployment[svcName])) {
4260
+ const compute = sdl.profiles.compute[svcdepl.profile];
4261
+ const infra = sdl.profiles.placement[placementName];
4262
+ const pricing = infra.pricing[svcdepl.profile];
4263
+ const price = {
4264
+ denom: pricing.denom,
4265
+ amount: pricing.amount?.toString()
4266
+ };
4267
+ let group = groupsMap.get(placementName);
4268
+ if (!group) {
4269
+ group = {
4270
+ dgroup: GroupSpec.fromPartial({
4271
+ name: placementName,
4272
+ resources: [],
4273
+ requirements: PlacementRequirements.fromPartial({
4274
+ attributes: buildResourceAttributes(infra.attributes) ?? [],
4275
+ signedBy: SignedBy.fromPartial({
4276
+ allOf: infra.signedBy?.allOf,
4277
+ anyOf: infra.signedBy?.anyOf
4278
+ })
4279
+ })
4280
+ }),
4281
+ boundComputes: {}
4282
+ };
4283
+ groupsMap.set(placementName, group);
4284
+ }
4285
+ const profileKey = `${placementName}:${svcdepl.profile}`;
4286
+ const location = group.boundComputes[svcdepl.profile];
4287
+ if (location === void 0) {
4288
+ const resId = group.dgroup.resources.length > 0 ? group.dgroup.resources.length + 1 : 1;
4289
+ resourceIds.set(profileKey, resId);
4290
+ const resources = buildResources(resId, compute, service, endpointSequenceNumbers);
4291
+ group.dgroup.resources.push(
4292
+ ResourceUnit.fromPartial({
4293
+ resource: resources,
4294
+ count: svcdepl.count,
4295
+ price
4296
+ })
4297
+ );
4298
+ group.boundComputes[svcdepl.profile] = group.dgroup.resources.length - 1;
4299
+ } else {
4300
+ if (!resourceIds.has(profileKey)) {
4301
+ resourceIds.set(profileKey, group.dgroup.resources[location].resource.id);
4302
+ }
4303
+ group.dgroup.resources[location].count += svcdepl.count;
4304
+ group.dgroup.resources[location].resource.endpoints.push(
4305
+ ...buildServiceEndpoints(service, endpointSequenceNumbers)
4306
+ );
4307
+ }
4308
+ }
4309
+ }
4310
+ for (const group of groupsMap.values()) {
4311
+ for (const resourceUnit of group.dgroup.resources) {
4312
+ resourceUnit.resource.endpoints.sort(
4313
+ (a, b) => a.kind - b.kind || a.sequenceNumber - b.sequenceNumber
4314
+ );
4315
+ }
4316
+ }
4317
+ const sortedGroupNames = [...groupsMap.keys()].sort();
4318
+ let groups;
4319
+ let groupSpecs;
4320
+ const manifest = {
4321
+ get groups() {
4322
+ groups ?? (groups = sortedGroupNames.map((placementName) => {
4323
+ const deployments = deploymentsByPlacement.get(placementName);
4324
+ return Group.fromPartial({
4325
+ name: placementName,
4326
+ services: deployments.map(([svcName]) => {
4327
+ const service = sdl.services[svcName];
4328
+ const deployment = sdl.deployment[svcName][placementName];
4329
+ const compute = sdl.profiles.compute[deployment.profile];
4330
+ const resourceId = resourceIds.get(`${placementName}:${deployment.profile}`) || 1;
4331
+ return buildManifestService(
4332
+ resourceId,
4333
+ svcName,
4334
+ service,
4335
+ compute,
4336
+ deployment.count,
4337
+ endpointSequenceNumbers
4338
+ );
4339
+ })
4340
+ });
4341
+ }));
4342
+ return groups;
4343
+ },
4344
+ get groupSpecs() {
4345
+ groupSpecs ?? (groupSpecs = sortedGroupNames.map((name) => groupsMap.get(name).dgroup));
4346
+ return groupSpecs;
4347
+ }
4348
+ };
4349
+ return { ok: true, value: manifest };
4350
+ }
4351
+ function buildResources(id, compute, service, endpointSequenceNumbers) {
4352
+ const res = compute.resources;
4353
+ const cpuAttributes = buildResourceAttributes(res.cpu.attributes);
4354
+ const gpuAttributes = res.gpu?.attributes ? transformGpuAttributes(res.gpu.attributes) : [];
4355
+ return Resources.fromPartial({
4356
+ id,
4357
+ cpu: CPU.fromPartial({
4358
+ units: { val: encodeResourceValue(parseCpuUnits(res.cpu)) },
4359
+ attributes: cpuAttributes
4360
+ }),
4361
+ memory: Memory.fromPartial({
4362
+ quantity: { val: encodeResourceValue(parseMemoryBytes(res.memory)) }
4363
+ }),
4364
+ storage: castArray(res.storage).map(
4365
+ (s) => Storage.fromPartial({
4366
+ name: s.name || "default",
4367
+ quantity: { val: encodeResourceValue(parseStorageBytes(s.size)) },
4368
+ attributes: buildStorageAttributes(s.attributes)
4369
+ })
4370
+ ),
4371
+ gpu: GPU.fromPartial({
4372
+ units: { val: encodeResourceValue(parseGpuUnits(res.gpu)) },
4373
+ attributes: gpuAttributes
4374
+ }),
4375
+ endpoints: buildServiceEndpoints(service, endpointSequenceNumbers)
4376
+ });
4377
+ }
4378
+ function buildManifestService(resourceId, name, service, compute, count, endpointSequenceNumbers) {
4379
+ const credentials = service.credentials ? ImageCredentials.fromPartial({
4380
+ host: service.credentials.host,
4381
+ email: service.credentials.email || "",
4382
+ username: service.credentials.username,
4383
+ password: service.credentials.password
4384
+ }) : void 0;
4385
+ const params = buildParams(service);
4386
+ return Service.fromPartial({
4387
+ name,
4388
+ image: service.image,
4389
+ command: service.command || [],
4390
+ args: service.args || [],
4391
+ env: service.env || [],
4392
+ resources: buildResources(resourceId, compute, service, endpointSequenceNumbers),
4393
+ count,
4394
+ expose: buildManifestExpose(service, endpointSequenceNumbers),
4395
+ params,
4396
+ credentials
4397
+ });
4398
+ }
4399
+ function buildParams(service) {
4400
+ if (!service.params) return void 0;
4401
+ const storageEntries = Object.entries(service.params.storage ?? {});
4402
+ const result = ServiceParams.fromPartial({
4403
+ storage: storageEntries.map(
4404
+ ([name, config]) => StorageParams.fromPartial({
4405
+ name,
4406
+ mount: config.mount || "",
4407
+ readOnly: config.readOnly || false
4408
+ })
4409
+ )
4410
+ });
4411
+ if (service.params.permissions) {
4412
+ result.permissions = service.params.permissions;
4413
+ }
4414
+ return result;
4415
+ }
4416
+ function buildManifestExpose(service, endpointSequenceNumbers) {
4417
+ return (service.expose ?? []).flatMap(
4418
+ (expose) => (expose.to ?? []).map(
4419
+ (to) => ServiceExpose.fromPartial({
4420
+ port: expose.port,
4421
+ externalPort: expose.as,
4422
+ proto: parseServiceProto(expose.proto),
4423
+ service: to.service || "",
4424
+ global: to.global || false,
4425
+ hosts: expose.accept || [],
4426
+ httpOptions: buildHttpOptions(expose.http_options),
4427
+ ip: to.ip || "",
4428
+ endpointSequenceNumber: endpointSequenceNumbers[to.ip]
4429
+ })
4430
+ )
4431
+ ).sort((a, b) => {
4432
+ if (a.service !== b.service) return a.service.localeCompare(b.service);
4433
+ if (a.port !== b.port) return a.port - b.port;
4434
+ if (a.proto !== b.proto) return a.proto.localeCompare(b.proto);
4435
+ if (a.global !== b.global) return a.global ? -1 : 1;
4436
+ return 0;
4437
+ });
4438
+ }
4439
+
4440
+ // src/sdl/manifest/generateManifestVersion.ts
4441
+ import { default as stableStringify2 } from "json-stable-stringify";
4442
+ var decoder = new TextDecoder();
4443
+ var encoder2 = new TextEncoder();
4444
+ var NULLABLE_MANIFEST_KEYS = /* @__PURE__ */ new Set(["command", "args", "env", "hosts"]);
4445
+ var OMITTED_MANIFEST_KEYS = /* @__PURE__ */ new Set(["kind", "attributes"]);
4446
+ async function generateManifestVersion(manifest) {
4447
+ const jsonStr = manifestToSortedJSON(manifest);
4448
+ const sortedBytes = encoder2.encode(jsonStr);
4449
+ const sum = await crypto.subtle.digest("SHA-256", sortedBytes);
4450
+ return new Uint8Array(sum);
4451
+ }
4452
+ function manifestToSortedJSON(manifest) {
4453
+ const json = stableStringify2(manifest, { replacer: manifestReplacer }) || "";
4454
+ return escapeHtml(renameFields(json));
4455
+ }
4456
+ function manifestReplacer(key, value) {
4457
+ if (value && value instanceof Uint8Array) {
4458
+ return decoder.decode(value);
4459
+ }
4460
+ if (typeof key !== "string") {
4461
+ return value;
4462
+ }
4463
+ if (typeof this === "object" && this && Object.hasOwn(this, "command") && key === "credentials" && value == null) {
4464
+ return null;
4465
+ }
4466
+ if (NULLABLE_MANIFEST_KEYS.has(key) && (Array.isArray(value) && value.length === 0 || value == null)) {
4467
+ return null;
4468
+ }
4469
+ if (OMITTED_MANIFEST_KEYS.has(key) && (Array.isArray(value) && value.length === 0 || value === 0)) {
4470
+ return void 0;
4471
+ }
4472
+ return value;
4473
+ }
4474
+ var MANIFEST_VERSION_FIELD_MAPPING = { quantity: "size", sequenceNumber: "sequence_number" };
4475
+ var MANIFEST_VERSION_FIELD_REGEX = new RegExp(`"(${Object.keys(MANIFEST_VERSION_FIELD_MAPPING).join("|")})":`, "g");
4476
+ function renameFields(jsonStr) {
4477
+ MANIFEST_VERSION_FIELD_REGEX.lastIndex = 0;
4478
+ return jsonStr.replace(MANIFEST_VERSION_FIELD_REGEX, (_, field) => `"${MANIFEST_VERSION_FIELD_MAPPING[field]}":`);
4479
+ }
4480
+ var htmlEscapes = {
4481
+ "<": "\\u003c",
4482
+ ">": "\\u003e",
4483
+ "&": "\\u0026"
4484
+ };
4485
+ var HTML_SPECIAL_CHARS_REGEX = new RegExp(`[${Object.keys(htmlEscapes).join("")}]`, "g");
4486
+ function escapeHtml(raw) {
4487
+ HTML_SPECIAL_CHARS_REGEX.lastIndex = 0;
4488
+ return raw.replace(HTML_SPECIAL_CHARS_REGEX, (ch) => htmlEscapes[ch]);
4489
+ }
4490
+
4491
+ // src/utils/yaml.ts
4492
+ import { load } from "js-yaml";
4493
+ function yaml(chunks, ...args) {
4494
+ const str = chunks.reduce((acc, chunk, i) => {
4495
+ const value = args[i];
4496
+ const intermediateResult = acc + chunk;
4497
+ if (value === void 0) return intermediateResult;
4498
+ return intermediateResult + JSON.stringify(value);
4499
+ }, "");
4500
+ return load(str);
4501
+ }
4502
+ yaml.template = function yamlTemplate(template, vars) {
4503
+ const finalYaml = template.replace(/\$\{(\w+)\}/g, (_, varName) => {
4504
+ const value = vars?.[varName];
4505
+ if (value === void 0) {
4506
+ throw new ReferenceError(`Variable "${varName}" is not provided to yaml template`);
4507
+ }
4508
+ return JSON.stringify(value);
4509
+ });
4510
+ return load(finalYaml);
4511
+ };
4512
+
4042
4513
  // src/sdk/transport/TransportError.ts
4043
4514
  import { Code, ConnectError } from "@connectrpc/connect";
4044
4515
  var TransportErrorCode = /* @__PURE__ */ ((TransportErrorCode2) => {
@@ -5866,7 +6337,7 @@ var JwtValidator = class {
5866
6337
  };
5867
6338
 
5868
6339
  // src/sdk/provider/auth/jwt/jwt-token.ts
5869
- import { default as stableStringify2 } from "json-stable-stringify";
6340
+ import { default as stableStringify3 } from "json-stable-stringify";
5870
6341
 
5871
6342
  // src/sdk/provider/auth/jwt/wallet-utils.ts
5872
6343
  function createOfflineDataSigner(wallet) {
@@ -5941,8 +6412,8 @@ var JwtTokenManager = class {
5941
6412
  if (!validationResult.isValid) {
5942
6413
  throw new Error(`Invalid payload: ${validationResult.errors?.join(", ")}`);
5943
6414
  }
5944
- const header = base64UrlEncode(stableStringify2({ alg: this.signer.algorithm || "ES256KADR36", typ: "JWT" }));
5945
- const stringPayload = base64UrlEncode(stableStringify2(inputPayload));
6415
+ const header = base64UrlEncode(stableStringify3({ alg: this.signer.algorithm || "ES256KADR36", typ: "JWT" }));
6416
+ const stringPayload = base64UrlEncode(stableStringify3(inputPayload));
5946
6417
  const { signature } = await this.signer.signArbitrary(options.iss, `${header}.${stringPayload}`);
5947
6418
  const token = `${header}.${stringPayload}.${toBase64Url(signature)}`;
5948
6419
  return token;
@@ -8102,14 +8573,14 @@ var serviceLoader2 = createServiceLoader([
8102
8573
  () => import("./service_akash-KPU6LPVP.js").then((m) => m.Msg),
8103
8574
  () => import("./query_akash-LWCKZPHL.js").then((m) => m.Query),
8104
8575
  () => import("./service_akash-5O4BYIF2.js").then((m) => m.Msg),
8105
- () => import("./query_akash-XTPHUGJZ.js").then((m) => m.Query),
8106
- () => import("./service_akash-YMJ4ZYYX.js").then((m) => m.Msg),
8576
+ () => import("./query_akash-4CTLBKZR.js").then((m) => m.Query),
8577
+ () => import("./service_akash-AZFAYT7H.js").then((m) => m.Msg),
8107
8578
  () => import("./query_akash-GYTMDAAY.js").then((m) => m.Query),
8108
8579
  () => import("./query_akash-KKNAAUKF.js").then((m) => m.Query),
8109
8580
  () => import("./query_akash-4OVOGRBT.js").then((m) => m.Query),
8110
8581
  () => import("./service_akash-KKV7TGYK.js").then((m) => m.Msg),
8111
- () => import("./query_akash-IXSQT2VJ.js").then((m) => m.Query),
8112
- () => import("./service_akash-AYYJKBHS.js").then((m) => m.Msg),
8582
+ () => import("./query_akash-DJ7LTLRE.js").then((m) => m.Query),
8583
+ () => import("./service_akash-WRGOVR7I.js").then((m) => m.Msg),
8113
8584
  () => import("./query_akash-RGYTHUNZ.js").then((m) => m.Query),
8114
8585
  () => import("./service_akash-RQDCQLQH.js").then((m) => m.Msg),
8115
8586
  () => import("./query_akash-ERHU5RE6.js").then((m) => m.Query),
@@ -8820,10 +9291,14 @@ export {
8820
9291
  TESTNET_ID,
8821
9292
  USDC_IBC_DENOMS,
8822
9293
  AKT_DENOM,
8823
- SdlValidationError,
8824
9294
  schema,
8825
9295
  validateSDL,
9296
+ SdlValidationError,
8826
9297
  SDL,
9298
+ generateManifest,
9299
+ generateManifestVersion,
9300
+ manifestToSortedJSON,
9301
+ yaml,
8827
9302
  TransportErrorCode,
8828
9303
  TransportError,
8829
9304
  TxError,
@@ -8847,4 +9322,4 @@ export {
8847
9322
  isRetryEnabled,
8848
9323
  createTxTransport
8849
9324
  };
8850
- //# sourceMappingURL=chunk-XPLMSDXV.js.map
9325
+ //# sourceMappingURL=chunk-QSKWS3TI.js.map