@nosana/types 2.12.0 → 2.13.0

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/README.md CHANGED
@@ -44,4 +44,15 @@ declare module '@nosana/types' {
44
44
  }
45
45
  ```
46
46
 
47
- For more info go to [learn.nosana.com](https://learn.nosana.com)
47
+ For more info go to [learn.nosana.com](https://learn.nosana.com)
48
+ ## Node API contract
49
+
50
+ `src/Schemas/nodeOpenApi.ts` is the OpenAPI 3.1 document for the HTTP API every node
51
+ serves for its jobs, and the single source of truth for it. `JobDefinition`, `FlowState`
52
+ and everything they reach are taken from the TypeScript types through typia at build
53
+ time, so the document cannot drift from them. `pnpm generate:node` (after `pnpm build`)
54
+ exports it to `openapi/node.openapi.json`, which ships with the package, and regenerates
55
+ `src/Schemas/node.ts`, exported as the `NodeApiSchema` namespace. `@nosana/api` builds
56
+ its node client from those types, and the node repository can type its route handlers
57
+ against the same ones and serve `nodeOpenApiDocument()` at `/openapi.json` to join the
58
+ gateway spec, its swagger and the MCP.
@@ -20,4 +20,7 @@ export declare const NOSANA_PROGRAM_ADDRESSES: Record<NosanaNetwork, {
20
20
  pools: string;
21
21
  merkleDistributor: string;
22
22
  }>;
23
+ /** A Solana address: base58 without the ambiguous characters, 32 to 44 characters long. */
24
+ export declare const SOLANA_ADDRESS_PATTERN = "^[1-9A-HJ-NP-Za-km-z]{32,44}$";
25
+ export declare function isSolanaAddress(value: string): boolean;
23
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Common/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAInD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,aAAa,EACb;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAuBO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Common/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAInD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,aAAa,EACb;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAuBO,CAAC;AAEX,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAItE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -39,4 +39,10 @@ export const NOSANA_PROGRAM_ADDRESSES = {
39
39
  merkleDistributor: 'merkp8F8f5EgYSYKadk3YiuQQdo3JPdnJWKviaaF425',
40
40
  },
41
41
  };
42
+ /** A Solana address: base58 without the ambiguous characters, 32 to 44 characters long. */
43
+ export const SOLANA_ADDRESS_PATTERN = '^[1-9A-HJ-NP-Za-km-z]{32,44}$';
44
+ const SOLANA_ADDRESS = new RegExp(SOLANA_ADDRESS_PATTERN);
45
+ export function isSolanaAddress(value) {
46
+ return SOLANA_ADDRESS.test(value);
47
+ }
42
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Common/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkC;IAC/D,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,6CAA6C;IACtE,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,6CAA6C;IACrE,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,6CAA6C;CAC/D,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GASjC;IACF,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,6CAA6C;QACtD,KAAK,EAAE,6CAA6C;QACpD,KAAK,EAAE,6CAA6C;QACpD,iBAAiB,EAAE,6CAA6C;KACjE;IACD,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,6CAA6C;QACtD,KAAK,EAAE,6CAA6C;QACpD,KAAK,EAAE,6CAA6C;QACpD,iBAAiB,EAAE,6CAA6C;KACjE;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,6CAA6C;QACtD,KAAK,EAAE,6CAA6C;QACpD,KAAK,EAAE,6CAA6C;QACpD,iBAAiB,EAAE,6CAA6C;KACjE;CACO,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Common/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkC;IAC/D,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,6CAA6C;IACtE,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,6CAA6C;IACrE,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,6CAA6C;CAC/D,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GASjC;IACF,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,6CAA6C;QACtD,KAAK,EAAE,6CAA6C;QACpD,KAAK,EAAE,6CAA6C;QACpD,iBAAiB,EAAE,6CAA6C;KACjE;IACD,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,6CAA6C;QACtD,KAAK,EAAE,6CAA6C;QACpD,KAAK,EAAE,6CAA6C;QACpD,iBAAiB,EAAE,6CAA6C;KACjE;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,IAAI,EAAE,6CAA6C;QACnD,OAAO,EAAE,6CAA6C;QACtD,KAAK,EAAE,6CAA6C;QACpD,KAAK,EAAE,6CAA6C;QACpD,iBAAiB,EAAE,6CAA6C;KACjE;CACO,CAAC;AAEX,2FAA2F;AAC3F,MAAM,CAAC,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AAEtE,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE1D,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
@@ -1,3 +1,6 @@
1
1
  export * from "./api.js";
2
2
  export * from "./job.js";
3
+ export { nodeOpenApiDocument, type NodeOpenApiDocument } from "./nodeOpenApi.js";
4
+ /** The node API, generated from `openapi/node.openapi.json`; namespaced so its `paths` cannot collide with the gateway's. */
5
+ export type * as NodeApiSchema from "./node.js";
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAChF,6HAA6H;AAC7H,YAAY,KAAK,aAAa,MAAM,WAAW,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export * from "./api.js";
2
2
  export * from "./job.js";
3
+ export { nodeOpenApiDocument } from "./nodeOpenApi.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAA4B,MAAM,kBAAkB,CAAA"}