@smarter.sh/api 0.0.0-stage → 1.0.1

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 (251) hide show
  1. package/LICENSE.txt +671 -0
  2. package/README.md +193 -2
  3. package/dist/client.d.ts +146 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +178 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/core/config.d.ts +148 -0
  8. package/dist/core/config.d.ts.map +1 -0
  9. package/dist/core/config.js +212 -0
  10. package/dist/core/config.js.map +1 -0
  11. package/dist/core/errors.d.ts +189 -0
  12. package/dist/core/errors.d.ts.map +1 -0
  13. package/dist/core/errors.js +187 -0
  14. package/dist/core/errors.js.map +1 -0
  15. package/dist/core/http.d.ts +207 -0
  16. package/dist/core/http.d.ts.map +1 -0
  17. package/dist/core/http.js +456 -0
  18. package/dist/core/http.js.map +1 -0
  19. package/dist/core/log.d.ts +62 -0
  20. package/dist/core/log.d.ts.map +1 -0
  21. package/dist/core/log.js +68 -0
  22. package/dist/core/log.js.map +1 -0
  23. package/dist/core/sse.d.ts +38 -0
  24. package/dist/core/sse.d.ts.map +1 -0
  25. package/dist/core/sse.js +79 -0
  26. package/dist/core/sse.js.map +1 -0
  27. package/dist/core/typing.d.ts +21 -0
  28. package/dist/core/typing.d.ts.map +1 -0
  29. package/dist/core/typing.js +13 -0
  30. package/dist/core/typing.js.map +1 -0
  31. package/dist/index.d.ts +51 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +51 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/models/account.d.ts +112 -0
  36. package/dist/models/account.d.ts.map +1 -0
  37. package/dist/models/account.js +55 -0
  38. package/dist/models/account.js.map +1 -0
  39. package/dist/models/base.d.ts +99 -0
  40. package/dist/models/base.d.ts.map +1 -0
  41. package/dist/models/base.js +111 -0
  42. package/dist/models/base.js.map +1 -0
  43. package/dist/models/chat.d.ts +2243 -0
  44. package/dist/models/chat.d.ts.map +1 -0
  45. package/dist/models/chat.js +451 -0
  46. package/dist/models/chat.js.map +1 -0
  47. package/dist/models/guardrail.d.ts +109 -0
  48. package/dist/models/guardrail.d.ts.map +1 -0
  49. package/dist/models/guardrail.js +68 -0
  50. package/dist/models/guardrail.js.map +1 -0
  51. package/dist/models/journal.d.ts +159 -0
  52. package/dist/models/journal.d.ts.map +1 -0
  53. package/dist/models/journal.js +115 -0
  54. package/dist/models/journal.js.map +1 -0
  55. package/dist/models/llmclient.d.ts +183 -0
  56. package/dist/models/llmclient.d.ts.map +1 -0
  57. package/dist/models/llmclient.js +105 -0
  58. package/dist/models/llmclient.js.map +1 -0
  59. package/dist/models/llmhost.d.ts +121 -0
  60. package/dist/models/llmhost.d.ts.map +1 -0
  61. package/dist/models/llmhost.js +79 -0
  62. package/dist/models/llmhost.js.map +1 -0
  63. package/dist/models/manifest.d.ts +211 -0
  64. package/dist/models/manifest.d.ts.map +1 -0
  65. package/dist/models/manifest.js +290 -0
  66. package/dist/models/manifest.js.map +1 -0
  67. package/dist/models/mcpclient.d.ts +99 -0
  68. package/dist/models/mcpclient.d.ts.map +1 -0
  69. package/dist/models/mcpclient.js +65 -0
  70. package/dist/models/mcpclient.js.map +1 -0
  71. package/dist/models/misc.d.ts +232 -0
  72. package/dist/models/misc.d.ts.map +1 -0
  73. package/dist/models/misc.js +110 -0
  74. package/dist/models/misc.js.map +1 -0
  75. package/dist/models/platform.d.ts +88 -0
  76. package/dist/models/platform.d.ts.map +1 -0
  77. package/dist/models/platform.js +35 -0
  78. package/dist/models/platform.js.map +1 -0
  79. package/dist/models/plugin.d.ts +36 -0
  80. package/dist/models/plugin.d.ts.map +1 -0
  81. package/dist/models/plugin.js +16 -0
  82. package/dist/models/plugin.js.map +1 -0
  83. package/dist/models/react.d.ts +104 -0
  84. package/dist/models/react.d.ts.map +1 -0
  85. package/dist/models/react.js +136 -0
  86. package/dist/models/react.js.map +1 -0
  87. package/dist/models/sam/account.d.ts +155 -0
  88. package/dist/models/sam/account.d.ts.map +1 -0
  89. package/dist/models/sam/account.js +7 -0
  90. package/dist/models/sam/account.js.map +1 -0
  91. package/dist/models/sam/apiconnection.d.ts +147 -0
  92. package/dist/models/sam/apiconnection.d.ts.map +1 -0
  93. package/dist/models/sam/apiconnection.js +7 -0
  94. package/dist/models/sam/apiconnection.js.map +1 -0
  95. package/dist/models/sam/apiplugin.d.ts +278 -0
  96. package/dist/models/sam/apiplugin.d.ts.map +1 -0
  97. package/dist/models/sam/apiplugin.js +7 -0
  98. package/dist/models/sam/apiplugin.js.map +1 -0
  99. package/dist/models/sam/budget.d.ts +219 -0
  100. package/dist/models/sam/budget.d.ts.map +1 -0
  101. package/dist/models/sam/budget.js +7 -0
  102. package/dist/models/sam/budget.js.map +1 -0
  103. package/dist/models/sam/customdomain.d.ts +139 -0
  104. package/dist/models/sam/customdomain.d.ts.map +1 -0
  105. package/dist/models/sam/customdomain.js +7 -0
  106. package/dist/models/sam/customdomain.js.map +1 -0
  107. package/dist/models/sam/guardrail.d.ts +222 -0
  108. package/dist/models/sam/guardrail.d.ts.map +1 -0
  109. package/dist/models/sam/guardrail.js +7 -0
  110. package/dist/models/sam/guardrail.js.map +1 -0
  111. package/dist/models/sam/imagesearchplugin.d.ts +235 -0
  112. package/dist/models/sam/imagesearchplugin.d.ts.map +1 -0
  113. package/dist/models/sam/imagesearchplugin.js +7 -0
  114. package/dist/models/sam/imagesearchplugin.js.map +1 -0
  115. package/dist/models/sam/index.d.ts +104 -0
  116. package/dist/models/sam/index.d.ts.map +1 -0
  117. package/dist/models/sam/index.js +50 -0
  118. package/dist/models/sam/index.js.map +1 -0
  119. package/dist/models/sam/llmclient.d.ts +490 -0
  120. package/dist/models/sam/llmclient.d.ts.map +1 -0
  121. package/dist/models/sam/llmclient.js +7 -0
  122. package/dist/models/sam/llmclient.js.map +1 -0
  123. package/dist/models/sam/llmhost.d.ts +429 -0
  124. package/dist/models/sam/llmhost.d.ts.map +1 -0
  125. package/dist/models/sam/llmhost.js +7 -0
  126. package/dist/models/sam/llmhost.js.map +1 -0
  127. package/dist/models/sam/llmhostcompute.d.ts +221 -0
  128. package/dist/models/sam/llmhostcompute.d.ts.map +1 -0
  129. package/dist/models/sam/llmhostcompute.js +7 -0
  130. package/dist/models/sam/llmhostcompute.js.map +1 -0
  131. package/dist/models/sam/mcpclient.d.ts +195 -0
  132. package/dist/models/sam/mcpclient.d.ts.map +1 -0
  133. package/dist/models/sam/mcpclient.js +7 -0
  134. package/dist/models/sam/mcpclient.js.map +1 -0
  135. package/dist/models/sam/orchestrator.d.ts +163 -0
  136. package/dist/models/sam/orchestrator.d.ts.map +1 -0
  137. package/dist/models/sam/orchestrator.js +7 -0
  138. package/dist/models/sam/orchestrator.js.map +1 -0
  139. package/dist/models/sam/plugin.d.ts +163 -0
  140. package/dist/models/sam/plugin.d.ts.map +1 -0
  141. package/dist/models/sam/plugin.js +7 -0
  142. package/dist/models/sam/plugin.js.map +1 -0
  143. package/dist/models/sam/prompt.d.ts +116 -0
  144. package/dist/models/sam/prompt.d.ts.map +1 -0
  145. package/dist/models/sam/prompt.js +7 -0
  146. package/dist/models/sam/prompt.js.map +1 -0
  147. package/dist/models/sam/provider.d.ts +195 -0
  148. package/dist/models/sam/provider.d.ts.map +1 -0
  149. package/dist/models/sam/provider.js +7 -0
  150. package/dist/models/sam/provider.js.map +1 -0
  151. package/dist/models/sam/proxy.d.ts +163 -0
  152. package/dist/models/sam/proxy.d.ts.map +1 -0
  153. package/dist/models/sam/proxy.js +7 -0
  154. package/dist/models/sam/proxy.js.map +1 -0
  155. package/dist/models/sam/schemas.d.ts +8 -0
  156. package/dist/models/sam/schemas.d.ts.map +1 -0
  157. package/dist/models/sam/schemas.js +6059 -0
  158. package/dist/models/sam/schemas.js.map +1 -0
  159. package/dist/models/sam/secret.d.ts +123 -0
  160. package/dist/models/sam/secret.d.ts.map +1 -0
  161. package/dist/models/sam/secret.js +7 -0
  162. package/dist/models/sam/secret.js.map +1 -0
  163. package/dist/models/sam/skillplugin.d.ts +181 -0
  164. package/dist/models/sam/skillplugin.d.ts.map +1 -0
  165. package/dist/models/sam/skillplugin.js +7 -0
  166. package/dist/models/sam/skillplugin.js.map +1 -0
  167. package/dist/models/sam/smarterauthtoken.d.ts +115 -0
  168. package/dist/models/sam/smarterauthtoken.d.ts.map +1 -0
  169. package/dist/models/sam/smarterauthtoken.js +7 -0
  170. package/dist/models/sam/smarterauthtoken.js.map +1 -0
  171. package/dist/models/sam/sqlconnection.d.ts +187 -0
  172. package/dist/models/sam/sqlconnection.d.ts.map +1 -0
  173. package/dist/models/sam/sqlconnection.js +7 -0
  174. package/dist/models/sam/sqlconnection.js.map +1 -0
  175. package/dist/models/sam/sqlplugin.d.ts +232 -0
  176. package/dist/models/sam/sqlplugin.d.ts.map +1 -0
  177. package/dist/models/sam/sqlplugin.js +7 -0
  178. package/dist/models/sam/sqlplugin.js.map +1 -0
  179. package/dist/models/sam/user.d.ts +135 -0
  180. package/dist/models/sam/user.d.ts.map +1 -0
  181. package/dist/models/sam/user.js +7 -0
  182. package/dist/models/sam/user.js.map +1 -0
  183. package/dist/models/sam/vectorsearch.d.ts +150 -0
  184. package/dist/models/sam/vectorsearch.d.ts.map +1 -0
  185. package/dist/models/sam/vectorsearch.js +7 -0
  186. package/dist/models/sam/vectorsearch.js.map +1 -0
  187. package/dist/models/sam/vectorstore.d.ts +291 -0
  188. package/dist/models/sam/vectorstore.d.ts.map +1 -0
  189. package/dist/models/sam/vectorstore.js +7 -0
  190. package/dist/models/sam/vectorstore.js.map +1 -0
  191. package/dist/models/sam/websearchplugin.d.ts +229 -0
  192. package/dist/models/sam/websearchplugin.d.ts.map +1 -0
  193. package/dist/models/sam/websearchplugin.js +7 -0
  194. package/dist/models/sam/websearchplugin.js.map +1 -0
  195. package/dist/models/vectorstore.d.ts +165 -0
  196. package/dist/models/vectorstore.d.ts.map +1 -0
  197. package/dist/models/vectorstore.js +90 -0
  198. package/dist/models/vectorstore.js.map +1 -0
  199. package/dist/resources/accounts.d.ts +107 -0
  200. package/dist/resources/accounts.d.ts.map +1 -0
  201. package/dist/resources/accounts.js +84 -0
  202. package/dist/resources/accounts.js.map +1 -0
  203. package/dist/resources/base.d.ts +127 -0
  204. package/dist/resources/base.d.ts.map +1 -0
  205. package/dist/resources/base.js +139 -0
  206. package/dist/resources/base.js.map +1 -0
  207. package/dist/resources/catalog.d.ts +209 -0
  208. package/dist/resources/catalog.d.ts.map +1 -0
  209. package/dist/resources/catalog.js +124 -0
  210. package/dist/resources/catalog.js.map +1 -0
  211. package/dist/resources/guardrails.d.ts +82 -0
  212. package/dist/resources/guardrails.d.ts.map +1 -0
  213. package/dist/resources/guardrails.js +46 -0
  214. package/dist/resources/guardrails.js.map +1 -0
  215. package/dist/resources/history.d.ts +97 -0
  216. package/dist/resources/history.d.ts.map +1 -0
  217. package/dist/resources/history.js +109 -0
  218. package/dist/resources/history.js.map +1 -0
  219. package/dist/resources/llmclients.d.ts +348 -0
  220. package/dist/resources/llmclients.d.ts.map +1 -0
  221. package/dist/resources/llmclients.js +367 -0
  222. package/dist/resources/llmclients.js.map +1 -0
  223. package/dist/resources/llmhosts.d.ts +146 -0
  224. package/dist/resources/llmhosts.d.ts.map +1 -0
  225. package/dist/resources/llmhosts.js +128 -0
  226. package/dist/resources/llmhosts.js.map +1 -0
  227. package/dist/resources/manifests.d.ts +153 -0
  228. package/dist/resources/manifests.d.ts.map +1 -0
  229. package/dist/resources/manifests.js +203 -0
  230. package/dist/resources/manifests.js.map +1 -0
  231. package/dist/resources/mcpclients.d.ts +90 -0
  232. package/dist/resources/mcpclients.d.ts.map +1 -0
  233. package/dist/resources/mcpclients.js +57 -0
  234. package/dist/resources/mcpclients.js.map +1 -0
  235. package/dist/resources/providers.d.ts +33 -0
  236. package/dist/resources/providers.d.ts.map +1 -0
  237. package/dist/resources/providers.js +39 -0
  238. package/dist/resources/providers.js.map +1 -0
  239. package/dist/resources/proxies.d.ts +61 -0
  240. package/dist/resources/proxies.d.ts.map +1 -0
  241. package/dist/resources/proxies.js +57 -0
  242. package/dist/resources/proxies.js.map +1 -0
  243. package/dist/resources/vectorstores.d.ts +194 -0
  244. package/dist/resources/vectorstores.d.ts.map +1 -0
  245. package/dist/resources/vectorstores.js +200 -0
  246. package/dist/resources/vectorstores.js.map +1 -0
  247. package/dist/version.d.ts +3 -0
  248. package/dist/version.d.ts.map +1 -0
  249. package/dist/version.js +5 -0
  250. package/dist/version.js.map +1 -0
  251. package/package.json +81 -4
@@ -0,0 +1,79 @@
1
+ /**
2
+ * A parser of Server-Sent Events.
3
+ *
4
+ * The Smarter prompt api streams a prompt's progress as Server-Sent Events when the request's
5
+ * `Accept` header includes `text/event-stream`: `progress` events while it runs, then one `result`
6
+ * event with the same JSON as a non-streaming response.
7
+ */
8
+ /** The content type of a Server-Sent Events stream. */
9
+ export const EVENT_STREAM_CONTENT_TYPE = "text/event-stream";
10
+ /**
11
+ * Split a stream of bytes into lines, without their line endings (`\n`, `\r\n` or `\r`).
12
+ *
13
+ * @param stream - The stream, e.g. a response's body.
14
+ * @returns The lines, in order.
15
+ */
16
+ export async function* iterLines(stream) {
17
+ const decoder = new TextDecoder();
18
+ let buffer = "";
19
+ for await (const chunk of stream) {
20
+ buffer += decoder.decode(chunk, { stream: true });
21
+ let match;
22
+ while ((match = /\r\n|\r|\n/.exec(buffer)) !== null) {
23
+ // a \r at the end of the buffer may be the first half of a \r\n
24
+ if (match[0] === "\r" && match.index === buffer.length - 1)
25
+ break;
26
+ yield buffer.slice(0, match.index);
27
+ buffer = buffer.slice(match.index + match[0].length);
28
+ }
29
+ }
30
+ buffer += decoder.decode();
31
+ for (const line of buffer.split(/\r\n|\r|\n/)) {
32
+ if (line !== "")
33
+ yield line;
34
+ }
35
+ }
36
+ /**
37
+ * Parse a stream's lines into events, as the HTML Living Standard specifies.
38
+ *
39
+ * A blank line ends an event. Comments (lines that start with `:`), and blocks that set only
40
+ * `retry`, yield nothing.
41
+ *
42
+ * @param lines - The stream's lines, without their line endings.
43
+ * @returns The events, in order.
44
+ */
45
+ export async function* iterSse(lines) {
46
+ let event = null;
47
+ let data = [];
48
+ let id = null;
49
+ let retry = null;
50
+ for await (const line of lines) {
51
+ if (line === "") {
52
+ if (data.length > 0 || event !== null)
53
+ yield { event, data: data.join("\n"), id, retry };
54
+ event = null;
55
+ data = [];
56
+ id = null;
57
+ retry = null;
58
+ continue;
59
+ }
60
+ if (line.startsWith(":"))
61
+ continue;
62
+ const colon = line.indexOf(":");
63
+ const field = colon === -1 ? line : line.slice(0, colon);
64
+ let value = colon === -1 ? "" : line.slice(colon + 1);
65
+ if (value.startsWith(" "))
66
+ value = value.slice(1);
67
+ if (field === "event")
68
+ event = value;
69
+ else if (field === "data")
70
+ data.push(value);
71
+ else if (field === "id")
72
+ id = value;
73
+ else if (field === "retry" && /^\d+$/.test(value))
74
+ retry = Number(value);
75
+ }
76
+ if (data.length > 0 || event !== null)
77
+ yield { event, data: data.join("\n"), id, retry };
78
+ }
79
+ //# sourceMappingURL=sse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/core/sse.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAc7D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,CAAC,MAAiC;IAChE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACjC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,IAAI,KAA6B,CAAC;QAClC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK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D,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACtD,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClD,IAAI,KAAK,KAAK,OAAO;YAAE,KAAK,GAAG,KAAK,CAAC;aAChC,IAAI,KAAK,KAAK,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACvC,IAAI,KAAK,KAAK,IAAI;YAAE,EAAE,GAAG,KAAK,CAAC;aAC/B,IAAI,KAAK,KAAK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI;QAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Type aliases of the Smarter SDK.
3
+ *
4
+ * These mirror `smarter.core.typing` in the Python SDK, and `smarter.lib.typing` in the Smarter
5
+ * platform. This module imports only `zod`, so that any module of the SDK can import it without an
6
+ * import cycle. Each alias that describes JSON is also a Zod schema of the same name.
7
+ */
8
+ import { z } from "zod";
9
+ /** A value that is arbitrary JSON: a string, number, boolean, null, or an array or object of them. */
10
+ export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
11
+ /** The Zod schema of {@link JsonValue}. */
12
+ export declare const JsonValue: z.ZodType<JsonValue>;
13
+ /** A JSON object whose shape is not fixed, e.g. a manifest's `spec`, whose fields depend on its kind. */
14
+ export interface JsonObject {
15
+ [key: string]: JsonValue;
16
+ }
17
+ /** The Zod schema of {@link JsonObject}. */
18
+ export declare const JsonObject: z.ZodType<JsonObject>;
19
+ /** A resource's id: its integer primary key, or its hashed id, e.g. `rMTAwMDAwNQx`. */
20
+ export type SmarterId = number | string;
21
+ //# sourceMappingURL=typing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../../src/core/typing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sGAAsG;AACtG,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC;AAEpF,2CAA2C;AAC3C,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAY,CAAC;AAExD,yGAAyG;AACzG,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,4CAA4C;AAC5C,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAmC,CAAC;AAEjF,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Type aliases of the Smarter SDK.
3
+ *
4
+ * These mirror `smarter.core.typing` in the Python SDK, and `smarter.lib.typing` in the Smarter
5
+ * platform. This module imports only `zod`, so that any module of the SDK can import it without an
6
+ * import cycle. Each alias that describes JSON is also a Zod schema of the same name.
7
+ */
8
+ import { z } from "zod";
9
+ /** The Zod schema of {@link JsonValue}. */
10
+ export const JsonValue = z.json();
11
+ /** The Zod schema of {@link JsonObject}. */
12
+ export const JsonObject = z.record(z.string(), JsonValue);
13
+ //# sourceMappingURL=typing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.js","sourceRoot":"","sources":["../../src/core/typing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,2CAA2C;AAC3C,MAAM,CAAC,MAAM,SAAS,GAAyB,CAAC,CAAC,IAAI,EAAE,CAAC;AAOxD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,UAAU,GAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The Smarter Node.js SDK: the official Node.js client of the Smarter platform's api.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { Smarter } from "@smarter.sh/api";
7
+ *
8
+ * const client = new Smarter();
9
+ * console.log((await client.llmClients.prompt(5, "Hello")).text);
10
+ * ```
11
+ *
12
+ * See https://docs.smarter.sh/en/latest/smarter-framework/smarter-nodejs.html
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ export { Smarter, type SmarterOptions } from "./client.ts";
17
+ export { VERSION } from "./version.ts";
18
+ export { API_PATH, DEFAULT_ENVIRONMENT, DEFAULT_MAX_RETRIES, DEFAULT_ROOT_DOMAIN, DEFAULT_TIMEOUT, ENVIRONMENTS, LOCAL_URL, apiBaseUrl, environmentUrl, resolveClientConfig, type ClientConfig, type SmarterEnvironment, } from "./core/config.ts";
19
+ export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ResourceNotFoundError, SmarterConfigurationError, SmarterError, SmarterPromptError, SmarterValueError, UnprocessableEntityError, type FailedRequest, } from "./core/errors.ts";
20
+ export { SmarterHttpClient, type Fetch, type QueryParamValue, type RequestOptions } from "./core/http.ts";
21
+ export { maskSecret, type SmarterLogger, type SmarterLogLevel } from "./core/log.ts";
22
+ export { iterSse, type ServerSentEvent } from "./core/sse.ts";
23
+ export { JsonObject, JsonValue, type SmarterId } from "./core/typing.ts";
24
+ export * from "./models/account.ts";
25
+ export * from "./models/base.ts";
26
+ export * from "./models/chat.ts";
27
+ export * from "./models/guardrail.ts";
28
+ export * from "./models/journal.ts";
29
+ export * from "./models/llmclient.ts";
30
+ export * from "./models/llmhost.ts";
31
+ export * from "./models/manifest.ts";
32
+ export * from "./models/mcpclient.ts";
33
+ export * from "./models/misc.ts";
34
+ export * from "./models/platform.ts";
35
+ export * from "./models/plugin.ts";
36
+ export * from "./models/react.ts";
37
+ export * from "./models/sam/index.ts";
38
+ export * from "./models/vectorstore.ts";
39
+ export { AccountContacts, Accounts, UserProfiles, Users } from "./resources/accounts.ts";
40
+ export { SmarterAPIResource, SmarterKindResource, resourceId } from "./resources/base.ts";
41
+ export { Orchestrators, PLUGIN_KINDS, Plugins, Secrets, Vectorsearches } from "./resources/catalog.ts";
42
+ export { Guardrails, type GuardrailStage } from "./resources/guardrails.ts";
43
+ export { Journal, PromptHistory, type JournalListOptions } from "./resources/history.ts";
44
+ export { ChatSession, ChatStream, LLMClients, type ConfigOptions, PromptStream, requestMessages, toMessages, type MessageInput, type PromptInput, type PromptOptions, } from "./resources/llmclients.ts";
45
+ export { LLMHosts } from "./resources/llmhosts.ts";
46
+ export { CLI_PATH, Manifests, kindSegment, type ManifestGetOptions } from "./resources/manifests.ts";
47
+ export { MCPClients } from "./resources/mcpclients.ts";
48
+ export { Providers } from "./resources/providers.ts";
49
+ export { Proxies, type ProxyRequestOptions } from "./resources/proxies.ts";
50
+ export { Vectorstores, type UploadInput, type VectorstoreSearchOptions, type VectorstoreSearchType, } from "./resources/vectorstores.ts";
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,0BAA0B,EAC1B,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CA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Y,EACZ,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,GAC3B,MAAM,6BAA6B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The Smarter Node.js SDK: the official Node.js client of the Smarter platform's api.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { Smarter } from "@smarter.sh/api";
7
+ *
8
+ * const client = new Smarter();
9
+ * console.log((await client.llmClients.prompt(5, "Hello")).text);
10
+ * ```
11
+ *
12
+ * See https://docs.smarter.sh/en/latest/smarter-framework/smarter-nodejs.html
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ export { Smarter } from "./client.js";
17
+ export { VERSION } from "./version.js";
18
+ export { API_PATH, DEFAULT_ENVIRONMENT, DEFAULT_MAX_RETRIES, DEFAULT_ROOT_DOMAIN, DEFAULT_TIMEOUT, ENVIRONMENTS, LOCAL_URL, apiBaseUrl, environmentUrl, resolveClientConfig, } from "./core/config.js";
19
+ export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ResourceNotFoundError, SmarterConfigurationError, SmarterError, SmarterPromptError, SmarterValueError, UnprocessableEntityError, } from "./core/errors.js";
20
+ export { SmarterHttpClient } from "./core/http.js";
21
+ export { maskSecret } from "./core/log.js";
22
+ export { iterSse } from "./core/sse.js";
23
+ export { JsonObject, JsonValue } from "./core/typing.js";
24
+ export * from "./models/account.js";
25
+ export * from "./models/base.js";
26
+ export * from "./models/chat.js";
27
+ export * from "./models/guardrail.js";
28
+ export * from "./models/journal.js";
29
+ export * from "./models/llmclient.js";
30
+ export * from "./models/llmhost.js";
31
+ export * from "./models/manifest.js";
32
+ export * from "./models/mcpclient.js";
33
+ export * from "./models/misc.js";
34
+ export * from "./models/platform.js";
35
+ export * from "./models/plugin.js";
36
+ export * from "./models/react.js";
37
+ export * from "./models/sam/index.js";
38
+ export * from "./models/vectorstore.js";
39
+ export { AccountContacts, Accounts, UserProfiles, Users } from "./resources/accounts.js";
40
+ export { SmarterAPIResource, SmarterKindResource, resourceId } from "./resources/base.js";
41
+ export { Orchestrators, PLUGIN_KINDS, Plugins, Secrets, Vectorsearches } from "./resources/catalog.js";
42
+ export { Guardrails } from "./resources/guardrails.js";
43
+ export { Journal, PromptHistory } from "./resources/history.js";
44
+ export { ChatSession, ChatStream, LLMClients, PromptStream, requestMessages, toMessages, } from "./resources/llmclients.js";
45
+ export { LLMHosts } from "./resources/llmhosts.js";
46
+ export { CLI_PATH, Manifests, kindSegment } from "./resources/manifests.js";
47
+ export { MCPClients } from "./resources/mcpclients.js";
48
+ export { Providers } from "./resources/providers.js";
49
+ export { Proxies } from "./resources/proxies.js";
50
+ export { Vectorstores, } from "./resources/vectorstores.js";
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAuB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EACV,cAAc,EACd,mBAAmB,GAGpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,0BAA0B,EAC1B,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,GAEzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAyD,MAAM,gBAAg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B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,OAAO,EAA4B,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EACL,YAAY,GAIb,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,112 @@
1
+ /** Models of accounts, users, user profiles and account contacts, as `/api/v1/accounts/` returns them. */
2
+ import { z } from "zod";
3
+ /** A Smarter account: the tenant that owns users and resources. */
4
+ export declare const Account: z.ZodObject<{
5
+ id: z.ZodNumber;
6
+ hashedId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
11
+ annotations: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>, unknown>>>;
12
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ userProfile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
15
+ user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
16
+ username: z.ZodString;
17
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ }, z.core.$loose>>>;
19
+ account: z.ZodOptional<z.ZodNullable<z.ZodObject<{
20
+ accountNumber: z.ZodString;
21
+ }, z.core.$loose>>>;
22
+ }, z.core.$loose>>>;
23
+ canDelete: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
24
+ manifestUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ detailUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ ready: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
27
+ accountNumber: z.ZodString;
28
+ isDefaultAccount: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
29
+ companyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ phoneNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ address1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ address2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ isActive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
41
+ }, z.core.$loose>;
42
+ export type Account = z.infer<typeof Account>;
43
+ /** A user of the platform. */
44
+ export declare const User: z.ZodObject<{
45
+ id: z.ZodNumber;
46
+ username: z.ZodString;
47
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ isStaff: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
51
+ isSuperuser: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
52
+ }, z.core.$loose>;
53
+ export type User = z.infer<typeof User>;
54
+ /** A user's membership of an account, which owns the resources that the user creates in it. */
55
+ export declare const UserProfile: z.ZodObject<{
56
+ id: z.ZodNumber;
57
+ hashedId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ name: z.ZodString;
59
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
62
+ annotations: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>, unknown>>>;
63
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ userProfile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
66
+ user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
67
+ username: z.ZodString;
68
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ }, z.core.$loose>>>;
70
+ account: z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
+ accountNumber: z.ZodString;
72
+ }, z.core.$loose>>>;
73
+ }, z.core.$loose>>>;
74
+ canDelete: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
75
+ manifestUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ detailUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ ready: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
78
+ user: z.ZodObject<{
79
+ id: z.ZodNumber;
80
+ username: z.ZodString;
81
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ isStaff: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
85
+ isSuperuser: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
86
+ }, z.core.$loose>;
87
+ account: z.ZodObject<{
88
+ accountNumber: z.ZodString;
89
+ }, z.core.$loose>;
90
+ profileImage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ profileImageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ isTest: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
93
+ }, z.core.$loose>;
94
+ export type UserProfile = z.infer<typeof UserProfile>;
95
+ /** A contact of an account, who receives its notices. */
96
+ export declare const AccountContact: z.ZodObject<{
97
+ id: z.ZodNumber;
98
+ account: z.ZodOptional<z.ZodNullable<z.ZodObject<{
99
+ accountNumber: z.ZodString;
100
+ }, z.core.$loose>>>;
101
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
+ isPrimary: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
108
+ isTest: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
109
+ welcomed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
110
+ }, z.core.$loose>;
111
+ export type AccountContact = z.infer<typeof AccountContact>;
112
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/models/account.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,mEAAmE;AACnE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAelB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,8BAA8B;AAC9B,eAAO,MAAM,IAAI;;;;;;;;iBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,+FAA+F;AAC/F,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,yDAAyD;AACzD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;iBAYzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ /** Models of accounts, users, user profiles and account contacts, as `/api/v1/accounts/` returns them. */
2
+ import { z } from "zod";
3
+ import { SmarterAccountRef, SmarterResource } from "./base.js";
4
+ /** A Smarter account: the tenant that owns users and resources. */
5
+ export const Account = SmarterResource.extend({
6
+ accountNumber: z.string(),
7
+ isDefaultAccount: z.boolean().nullish(),
8
+ companyName: z.string().nullish(),
9
+ phoneNumber: z.string().nullish(),
10
+ address1: z.string().nullish(),
11
+ address2: z.string().nullish(),
12
+ city: z.string().nullish(),
13
+ state: z.string().nullish(),
14
+ postalCode: z.string().nullish(),
15
+ country: z.string().nullish(),
16
+ language: z.string().nullish(),
17
+ timezone: z.string().nullish(),
18
+ currency: z.string().nullish(),
19
+ isActive: z.boolean().nullish(),
20
+ });
21
+ /** A user of the platform. */
22
+ export const User = z.looseObject({
23
+ id: z.number().int(),
24
+ username: z.string(),
25
+ firstName: z.string().nullish(),
26
+ lastName: z.string().nullish(),
27
+ email: z.string().nullish(),
28
+ isStaff: z.boolean().nullish(),
29
+ isSuperuser: z.boolean().nullish(),
30
+ });
31
+ /** A user's membership of an account, which owns the resources that the user creates in it. */
32
+ export const UserProfile = SmarterResource.extend({
33
+ user: User,
34
+ account: SmarterAccountRef,
35
+ /** The url of the image that the user uploaded, which takes precedence over `profileImageUrl`. */
36
+ profileImage: z.string().nullish(),
37
+ /** The url of the image that the oauth provider supplied. */
38
+ profileImageUrl: z.string().nullish(),
39
+ isTest: z.boolean().nullish(),
40
+ });
41
+ /** A contact of an account, who receives its notices. */
42
+ export const AccountContact = z.looseObject({
43
+ id: z.number().int(),
44
+ account: SmarterAccountRef.nullish(),
45
+ createdAt: z.string().nullish(),
46
+ updatedAt: z.string().nullish(),
47
+ firstName: z.string().nullish(),
48
+ lastName: z.string().nullish(),
49
+ email: z.string().nullish(),
50
+ phone: z.string().nullish(),
51
+ isPrimary: z.boolean().nullish(),
52
+ isTest: z.boolean().nullish(),
53
+ welcomed: z.boolean().nullish(),
54
+ });
55
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/models/account.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE/D,mEAAmE;AACnE,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE;IACvC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,C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S,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE;IAChC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE;CAChC,CAAC,CAAC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The base schemas of the SDK's response models.
3
+ *
4
+ * Every object schema is a `z.looseObject`, which keeps fields that it doesn't declare. The Smarter
5
+ * platform adds fields to its responses in minor releases, and an SDK that rejected them would break
6
+ * whenever the platform is upgraded (ADR-004). A parsed object's fields are the api's own names
7
+ * (ADR-021).
8
+ */
9
+ import { z } from "zod";
10
+ /**
11
+ * Annotations in the shape that the platform uses since Smarter 0.38: a map of keys to strings.
12
+ *
13
+ * Accepts the map, and the list of one-key maps that older manifests and platforms use, e.g.
14
+ * `[{"acme.com/crm-account-id": "A-10042"}]`, as the platform's apply does. A key that appears more
15
+ * than once keeps its last value. Scalar values become the string that YAML would have written:
16
+ * `true` is `"true"`, `42` is `"42"`, a date is ISO 8601 and `null` is `""`. Lists and objects are
17
+ * left as they are, so that the {@link Annotations} schema rejects them: the platform rejects them
18
+ * too, and structured data belongs in a JSON string. Keys are not checked here; the platform checks
19
+ * them when it applies a manifest.
20
+ *
21
+ * @param value - The annotations, as a map, a list of one-key maps, `null` or `undefined`.
22
+ * @returns A map, or the value itself if it is neither a map nor a list of maps, for the schema to accept (`null`) or reject.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * normalizeAnnotations([{ "acme.com/active": true }]); // { "acme.com/active": "true" }
27
+ * ```
28
+ */
29
+ export declare function normalizeAnnotations(value: unknown): unknown;
30
+ /**
31
+ * A resource's annotations, as in Kubernetes: a map of keys to string values, or `null`.
32
+ *
33
+ * A key is an optional DNS-subdomain prefix that names its owner, then a slash and a name of one or
34
+ * more slash-separated segments, e.g. `acme.com/crm-account-id`. The prefix `smarter.sh` and its
35
+ * subdomains are reserved for the platform. The legacy list of one-key maps is converted to the map
36
+ * (see {@link normalizeAnnotations}), so that manifests written for older platforms still parse.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const guardrail = await client.guardrails.retrieve(17);
41
+ * guardrail.annotations?.["acme.com/crm-account-id"];
42
+ * ```
43
+ */
44
+ export declare const Annotations: z.ZodPreprocess<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>, unknown>;
45
+ export type Annotations = z.infer<typeof Annotations>;
46
+ /** The user of a resource's owner. */
47
+ export declare const SmarterUserRef: z.ZodObject<{
48
+ username: z.ZodString;
49
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$loose>;
51
+ export type SmarterUserRef = z.infer<typeof SmarterUserRef>;
52
+ /** The account of a resource's owner. */
53
+ export declare const SmarterAccountRef: z.ZodObject<{
54
+ accountNumber: z.ZodString;
55
+ }, z.core.$loose>;
56
+ export type SmarterAccountRef = z.infer<typeof SmarterAccountRef>;
57
+ /** The owner of a resource: its user profile, as the user and the account. */
58
+ export declare const SmarterOwner: z.ZodObject<{
59
+ user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
60
+ username: z.ZodString;
61
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ }, z.core.$loose>>>;
63
+ account: z.ZodOptional<z.ZodNullable<z.ZodObject<{
64
+ accountNumber: z.ZodString;
65
+ }, z.core.$loose>>>;
66
+ }, z.core.$loose>;
67
+ export type SmarterOwner = z.infer<typeof SmarterOwner>;
68
+ /**
69
+ * The fields that every Smarter resource shares, as the REST api returns them.
70
+ *
71
+ * The api's resources are Django rows with the same metadata as a manifest's `metadata`: a name,
72
+ * description, version, tags and annotations. Each resource's schema adds its own fields.
73
+ */
74
+ export declare const SmarterResource: z.ZodObject<{
75
+ id: z.ZodNumber;
76
+ hashedId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ name: z.ZodString;
78
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
81
+ annotations: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>, unknown>>>;
82
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ userProfile: z.ZodOptional<z.ZodNullable<z.ZodObject<{
85
+ user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
86
+ username: z.ZodString;
87
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ }, z.core.$loose>>>;
89
+ account: z.ZodOptional<z.ZodNullable<z.ZodObject<{
90
+ accountNumber: z.ZodString;
91
+ }, z.core.$loose>>>;
92
+ }, z.core.$loose>>>;
93
+ canDelete: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
94
+ manifestUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
95
+ detailUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
96
+ ready: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
97
+ }, z.core.$loose>;
98
+ export type SmarterResource = z.infer<typeof SmarterResource>;
99
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/models/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAe5D;AASD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,gFAAkF,CAAC;AAC3G,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,sCAAsC;AACtC,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,yCAAyC;AACzC,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,YAAY;;;;;;;;iBAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;iBAiB1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * The base schemas of the SDK's response models.
3
+ *
4
+ * Every object schema is a `z.looseObject`, which keeps fields that it doesn't declare. The Smarter
5
+ * platform adds fields to its responses in minor releases, and an SDK that rejected them would break
6
+ * whenever the platform is upgraded (ADR-004). A parsed object's fields are the api's own names
7
+ * (ADR-021).
8
+ */
9
+ import { z } from "zod";
10
+ /**
11
+ * Annotations in the shape that the platform uses since Smarter 0.38: a map of keys to strings.
12
+ *
13
+ * Accepts the map, and the list of one-key maps that older manifests and platforms use, e.g.
14
+ * `[{"acme.com/crm-account-id": "A-10042"}]`, as the platform's apply does. A key that appears more
15
+ * than once keeps its last value. Scalar values become the string that YAML would have written:
16
+ * `true` is `"true"`, `42` is `"42"`, a date is ISO 8601 and `null` is `""`. Lists and objects are
17
+ * left as they are, so that the {@link Annotations} schema rejects them: the platform rejects them
18
+ * too, and structured data belongs in a JSON string. Keys are not checked here; the platform checks
19
+ * them when it applies a manifest.
20
+ *
21
+ * @param value - The annotations, as a map, a list of one-key maps, `null` or `undefined`.
22
+ * @returns A map, or the value itself if it is neither a map nor a list of maps, for the schema to accept (`null`) or reject.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * normalizeAnnotations([{ "acme.com/active": true }]); // { "acme.com/active": "true" }
27
+ * ```
28
+ */
29
+ export function normalizeAnnotations(value) {
30
+ if (value === null || value === undefined || typeof value !== "object")
31
+ return value;
32
+ const pairs = [];
33
+ if (Array.isArray(value)) {
34
+ const items = value;
35
+ for (const item of items) {
36
+ if (typeof item !== "object" || item === null || Array.isArray(item))
37
+ return value;
38
+ pairs.push(...Object.entries(item));
39
+ }
40
+ }
41
+ else {
42
+ pairs.push(...Object.entries(value));
43
+ }
44
+ const result = {};
45
+ for (const [key, item] of pairs)
46
+ result[key] = annotationValue(item);
47
+ return result;
48
+ }
49
+ function annotationValue(value) {
50
+ if (value === null || value === undefined)
51
+ return "";
52
+ if (typeof value === "boolean" || typeof value === "number" || typeof value === "bigint")
53
+ return String(value);
54
+ if (value instanceof Date)
55
+ return value.toISOString();
56
+ return value;
57
+ }
58
+ /**
59
+ * A resource's annotations, as in Kubernetes: a map of keys to string values, or `null`.
60
+ *
61
+ * A key is an optional DNS-subdomain prefix that names its owner, then a slash and a name of one or
62
+ * more slash-separated segments, e.g. `acme.com/crm-account-id`. The prefix `smarter.sh` and its
63
+ * subdomains are reserved for the platform. The legacy list of one-key maps is converted to the map
64
+ * (see {@link normalizeAnnotations}), so that manifests written for older platforms still parse.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const guardrail = await client.guardrails.retrieve(17);
69
+ * guardrail.annotations?.["acme.com/crm-account-id"];
70
+ * ```
71
+ */
72
+ export const Annotations = z.preprocess(normalizeAnnotations, z.record(z.string(), z.string()).nullable());
73
+ /** The user of a resource's owner. */
74
+ export const SmarterUserRef = z.looseObject({
75
+ username: z.string(),
76
+ email: z.string().nullish(),
77
+ });
78
+ /** The account of a resource's owner. */
79
+ export const SmarterAccountRef = z.looseObject({
80
+ accountNumber: z.string(),
81
+ });
82
+ /** The owner of a resource: its user profile, as the user and the account. */
83
+ export const SmarterOwner = z.looseObject({
84
+ user: SmarterUserRef.nullish(),
85
+ account: SmarterAccountRef.nullish(),
86
+ });
87
+ /**
88
+ * The fields that every Smarter resource shares, as the REST api returns them.
89
+ *
90
+ * The api's resources are Django rows with the same metadata as a manifest's `metadata`: a name,
91
+ * description, version, tags and annotations. Each resource's schema adds its own fields.
92
+ */
93
+ export const SmarterResource = z.looseObject({
94
+ id: z.number().int(),
95
+ hashedId: z.string().nullish(),
96
+ name: z.string(),
97
+ description: z.string().nullish(),
98
+ version: z.string().nullish(),
99
+ tags: z.array(z.string()).default([]),
100
+ /** The resource's annotations: a map of keys to string values, e.g. `{"acme.com/crm-account-id": "A-10042"}`. */
101
+ annotations: Annotations.nullish(),
102
+ createdAt: z.string().nullish(),
103
+ updatedAt: z.string().nullish(),
104
+ userProfile: SmarterOwner.nullish(),
105
+ canDelete: z.boolean().nullish(),
106
+ manifestUrl: z.string().nullish(),
107
+ /** The url of the resource's detail in the web console: its manifest, the resources that it uses, and those that use it. */
108
+ detailUrl: z.string().nullish(),
109
+ ready: z.boolean().nullish(),
110
+ });
111
+ //# sourceMappingURL=base.js.map