@hexclave/shared 1.0.2 → 1.0.5

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 (353) hide show
  1. package/dist/ai/unified-prompts/reminders.js +4 -3
  2. package/dist/ai/unified-prompts/reminders.js.map +1 -1
  3. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts +3 -1
  4. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
  5. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +217 -30
  6. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
  7. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.d.ts.map +1 -1
  8. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.js +1 -0
  9. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.js.map +1 -1
  10. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts +18 -6
  11. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js +23 -8
  12. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js.map +1 -1
  13. package/dist/ai/unified-prompts/skill-site-prompt-parts/openapi-specs.js +1 -1
  14. package/dist/ai/unified-prompts/skill-site-prompt-parts/openapi-specs.js.map +1 -1
  15. package/dist/config/schema.d.ts +63 -63
  16. package/dist/config/schema.d.ts.map +1 -1
  17. package/dist/config/schema.js +5 -5
  18. package/dist/config/schema.js.map +1 -1
  19. package/dist/config-authoring.d.ts +4 -4
  20. package/dist/config-authoring.d.ts.map +1 -1
  21. package/dist/config-authoring.js +2 -2
  22. package/dist/config-authoring.js.map +1 -1
  23. package/dist/config-rendering.d.ts +4 -4
  24. package/dist/config-rendering.d.ts.map +1 -1
  25. package/dist/config-rendering.js +19 -18
  26. package/dist/config-rendering.js.map +1 -1
  27. package/dist/esm/ai/unified-prompts/reminders.js +4 -3
  28. package/dist/esm/ai/unified-prompts/reminders.js.map +1 -1
  29. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts +3 -1
  30. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
  31. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +216 -31
  32. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
  33. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.d.ts.map +1 -1
  34. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.js +1 -0
  35. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.js.map +1 -1
  36. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts +18 -6
  37. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js +23 -8
  38. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js.map +1 -1
  39. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/openapi-specs.js +1 -1
  40. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/openapi-specs.js.map +1 -1
  41. package/dist/esm/config/schema.d.ts +63 -63
  42. package/dist/esm/config/schema.d.ts.map +1 -1
  43. package/dist/esm/config/schema.js +5 -5
  44. package/dist/esm/config/schema.js.map +1 -1
  45. package/dist/esm/config-authoring.d.ts +4 -4
  46. package/dist/esm/config-authoring.d.ts.map +1 -1
  47. package/dist/esm/config-authoring.js +2 -2
  48. package/dist/esm/config-authoring.js.map +1 -1
  49. package/dist/esm/config-rendering.d.ts +4 -4
  50. package/dist/esm/config-rendering.d.ts.map +1 -1
  51. package/dist/esm/config-rendering.js +15 -14
  52. package/dist/esm/config-rendering.js.map +1 -1
  53. package/dist/esm/helpers/vault/client-side.d.ts.map +1 -1
  54. package/dist/esm/helpers/vault/client-side.js.map +1 -1
  55. package/dist/esm/helpers/vault/server-side.d.ts.map +1 -1
  56. package/dist/esm/helpers/vault/server-side.js.map +1 -1
  57. package/dist/esm/hexclave-config-file.d.ts +15 -0
  58. package/dist/esm/hexclave-config-file.d.ts.map +1 -0
  59. package/dist/esm/{stack-config-file.js → hexclave-config-file.js} +7 -7
  60. package/dist/esm/hexclave-config-file.js.map +1 -0
  61. package/dist/esm/hooks/use-async-callback.js +1 -1
  62. package/dist/esm/hooks/use-async-external-store.js +1 -1
  63. package/dist/esm/hooks/use-strict-memo.js +1 -1
  64. package/dist/esm/interface/admin-metrics.d.ts +8 -8
  65. package/dist/esm/interface/admin-metrics.js.map +1 -1
  66. package/dist/esm/interface/client-interface.js +2 -2
  67. package/dist/esm/interface/client-interface.js.map +1 -1
  68. package/dist/esm/interface/conversations.d.ts +32 -32
  69. package/dist/esm/interface/crud/current-user.d.ts +9 -9
  70. package/dist/esm/interface/crud/email-outbox.d.ts +200 -200
  71. package/dist/esm/interface/crud/products.d.ts +13 -13
  72. package/dist/esm/interface/crud/products.d.ts.map +1 -1
  73. package/dist/esm/interface/crud/project-api-keys.d.ts +4 -4
  74. package/dist/esm/interface/crud/project-permissions.js +5 -5
  75. package/dist/esm/interface/crud/project-permissions.js.map +1 -1
  76. package/dist/esm/interface/crud/projects.d.ts +36 -36
  77. package/dist/esm/interface/crud/team-member-profiles.d.ts +18 -18
  78. package/dist/esm/interface/crud/team-permissions.js +5 -5
  79. package/dist/esm/interface/crud/team-permissions.js.map +1 -1
  80. package/dist/esm/interface/crud/transactions.d.ts +6 -6
  81. package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
  82. package/dist/esm/interface/crud/users.d.ts +12 -12
  83. package/dist/esm/interface/page-component-versions.js +107 -107
  84. package/dist/esm/interface/page-component-versions.js.map +1 -1
  85. package/dist/esm/interface/webhooks.d.ts +2 -2
  86. package/dist/esm/known-errors.d.ts +2 -2
  87. package/dist/esm/known-errors.js +4 -4
  88. package/dist/esm/known-errors.js.map +1 -1
  89. package/dist/esm/schema-fields.d.ts +17 -7
  90. package/dist/esm/schema-fields.d.ts.map +1 -1
  91. package/dist/esm/schema-fields.js +26 -16
  92. package/dist/esm/schema-fields.js.map +1 -1
  93. package/dist/esm/sessions.d.ts +7 -7
  94. package/dist/esm/utils/crypto.d.ts.map +1 -1
  95. package/dist/esm/utils/crypto.js.map +1 -1
  96. package/dist/esm/utils/currency-constants.d.ts +6 -0
  97. package/dist/esm/utils/currency-constants.d.ts.map +1 -1
  98. package/dist/esm/utils/currency-constants.js.map +1 -1
  99. package/dist/esm/utils/dev-env-state-path.d.ts +3 -3
  100. package/dist/esm/utils/dev-env-state-path.d.ts.map +1 -1
  101. package/dist/esm/utils/dev-env-state-path.js +4 -4
  102. package/dist/esm/utils/dev-env-state-path.js.map +1 -1
  103. package/dist/esm/utils/errors.js +2 -2
  104. package/dist/esm/utils/errors.js.map +1 -1
  105. package/dist/esm/utils/esbuild.d.ts.map +1 -1
  106. package/dist/esm/utils/esbuild.js +0 -1
  107. package/dist/esm/utils/esbuild.js.map +1 -1
  108. package/dist/esm/utils/featurebase.d.ts +3 -3
  109. package/dist/esm/utils/featurebase.d.ts.map +1 -1
  110. package/dist/esm/utils/featurebase.js +15 -15
  111. package/dist/esm/utils/featurebase.js.map +1 -1
  112. package/dist/esm/utils/fs.js +6 -6
  113. package/dist/esm/utils/fs.js.map +1 -1
  114. package/dist/esm/utils/globals.d.ts.map +1 -1
  115. package/dist/esm/utils/globals.js +10 -10
  116. package/dist/esm/utils/globals.js.map +1 -1
  117. package/dist/esm/utils/jwt.d.ts.map +1 -1
  118. package/dist/esm/utils/jwt.js +3 -3
  119. package/dist/esm/utils/jwt.js.map +1 -1
  120. package/dist/esm/utils/redirect-urls.d.ts +3 -3
  121. package/dist/esm/utils/redirect-urls.d.ts.map +1 -1
  122. package/dist/esm/utils/redirect-urls.js +5 -5
  123. package/dist/esm/utils/redirect-urls.js.map +1 -1
  124. package/dist/esm/utils/urls.js.map +1 -1
  125. package/dist/helpers/vault/client-side.d.ts.map +1 -1
  126. package/dist/helpers/vault/client-side.js.map +1 -1
  127. package/dist/helpers/vault/server-side.d.ts.map +1 -1
  128. package/dist/helpers/vault/server-side.js.map +1 -1
  129. package/dist/hexclave-config-file.d.ts +15 -0
  130. package/dist/hexclave-config-file.d.ts.map +1 -0
  131. package/dist/{stack-config-file.js → hexclave-config-file.js} +8 -8
  132. package/dist/hexclave-config-file.js.map +1 -0
  133. package/dist/hooks/use-async-callback.js +1 -1
  134. package/dist/hooks/use-async-external-store.js +1 -1
  135. package/dist/hooks/use-strict-memo.js +1 -1
  136. package/dist/interface/admin-metrics.d.ts +8 -8
  137. package/dist/interface/admin-metrics.js.map +1 -1
  138. package/dist/interface/client-interface.js +2 -2
  139. package/dist/interface/client-interface.js.map +1 -1
  140. package/dist/interface/conversations.d.ts +32 -32
  141. package/dist/interface/crud/current-user.d.ts +9 -9
  142. package/dist/interface/crud/email-outbox.d.ts +200 -200
  143. package/dist/interface/crud/products.d.ts +13 -13
  144. package/dist/interface/crud/products.d.ts.map +1 -1
  145. package/dist/interface/crud/project-api-keys.d.ts +4 -4
  146. package/dist/interface/crud/project-permissions.js +5 -5
  147. package/dist/interface/crud/project-permissions.js.map +1 -1
  148. package/dist/interface/crud/projects.d.ts +36 -36
  149. package/dist/interface/crud/team-member-profiles.d.ts +18 -18
  150. package/dist/interface/crud/team-permissions.js +5 -5
  151. package/dist/interface/crud/team-permissions.js.map +1 -1
  152. package/dist/interface/crud/transactions.d.ts +6 -6
  153. package/dist/interface/crud/transactions.d.ts.map +1 -1
  154. package/dist/interface/crud/users.d.ts +12 -12
  155. package/dist/interface/page-component-versions.js +107 -107
  156. package/dist/interface/page-component-versions.js.map +1 -1
  157. package/dist/interface/webhooks.d.ts +2 -2
  158. package/dist/known-errors.d.ts +2 -2
  159. package/dist/known-errors.js +4 -4
  160. package/dist/known-errors.js.map +1 -1
  161. package/dist/schema-fields.d.ts +17 -7
  162. package/dist/schema-fields.d.ts.map +1 -1
  163. package/dist/schema-fields.js +26 -16
  164. package/dist/schema-fields.js.map +1 -1
  165. package/dist/sessions.d.ts +7 -7
  166. package/dist/utils/crypto.d.ts.map +1 -1
  167. package/dist/utils/crypto.js.map +1 -1
  168. package/dist/utils/currency-constants.d.ts +6 -0
  169. package/dist/utils/currency-constants.d.ts.map +1 -1
  170. package/dist/utils/currency-constants.js.map +1 -1
  171. package/dist/utils/dev-env-state-path.d.ts +3 -3
  172. package/dist/utils/dev-env-state-path.d.ts.map +1 -1
  173. package/dist/utils/dev-env-state-path.js +5 -5
  174. package/dist/utils/dev-env-state-path.js.map +1 -1
  175. package/dist/utils/errors.js +2 -2
  176. package/dist/utils/errors.js.map +1 -1
  177. package/dist/utils/esbuild.d.ts.map +1 -1
  178. package/dist/utils/esbuild.js +0 -1
  179. package/dist/utils/esbuild.js.map +1 -1
  180. package/dist/utils/featurebase.d.ts +3 -3
  181. package/dist/utils/featurebase.d.ts.map +1 -1
  182. package/dist/utils/featurebase.js +15 -15
  183. package/dist/utils/featurebase.js.map +1 -1
  184. package/dist/utils/fs.js.map +1 -1
  185. package/dist/utils/globals.d.ts.map +1 -1
  186. package/dist/utils/globals.js +10 -10
  187. package/dist/utils/globals.js.map +1 -1
  188. package/dist/utils/jwt.d.ts.map +1 -1
  189. package/dist/utils/jwt.js +3 -3
  190. package/dist/utils/jwt.js.map +1 -1
  191. package/dist/utils/redirect-urls.d.ts +3 -3
  192. package/dist/utils/redirect-urls.d.ts.map +1 -1
  193. package/dist/utils/redirect-urls.js +5 -5
  194. package/dist/utils/redirect-urls.js.map +1 -1
  195. package/dist/utils/urls.js.map +1 -1
  196. package/package.json +2 -1
  197. package/src/ai/image-limits.ts +62 -0
  198. package/src/ai/llms/llms.ts +36 -0
  199. package/src/ai/unified-prompts/reminders.ts +27 -0
  200. package/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts +1047 -0
  201. package/src/ai/unified-prompts/skill-site-prompt-parts/brain.ts +5 -0
  202. package/src/ai/unified-prompts/skill-site-prompt-parts/cli-help.ts +5 -0
  203. package/src/ai/unified-prompts/skill-site-prompt-parts/config-docs.ts +5 -0
  204. package/src/ai/unified-prompts/skill-site-prompt-parts/custom-components-instructions.ts +5 -0
  205. package/src/ai/unified-prompts/skill-site-prompt-parts/dashboard-instructions.ts +5 -0
  206. package/src/ai/unified-prompts/skill-site-prompt-parts/docs-index.ts +80 -0
  207. package/src/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.ts +322 -0
  208. package/src/ai/unified-prompts/skill-site-prompt-parts/openapi-specs.ts +5 -0
  209. package/src/ai/unified-prompts/skill-site-prompt-parts/sdk-interface-source.ts +5 -0
  210. package/src/ai/unified-prompts/skill-site-prompt.ts +72 -0
  211. package/src/apps/apps-config.ts +177 -0
  212. package/src/apps/apps-ui.tsx +112 -0
  213. package/src/config/README.md +154 -0
  214. package/src/config/db-sync-mappings.ts +2293 -0
  215. package/src/config/format.ts +388 -0
  216. package/src/config/migrate-catalogs-to-product-lines.ts +475 -0
  217. package/src/config/schema-fuzzer.test.ts +377 -0
  218. package/src/config/schema.ts +1507 -0
  219. package/src/config-authoring.test.ts +52 -0
  220. package/src/config-authoring.ts +37 -0
  221. package/src/config-rendering.ts +142 -0
  222. package/src/crud.tsx +275 -0
  223. package/src/global.d.ts +1 -0
  224. package/src/helpers/emails.ts +250 -0
  225. package/src/helpers/init-prompt.ts +39 -0
  226. package/src/helpers/password.ts +16 -0
  227. package/src/helpers/production-mode.ts +58 -0
  228. package/src/helpers/support-sla.test.ts +124 -0
  229. package/src/helpers/support-sla.ts +93 -0
  230. package/src/helpers/vault/client-side.ts +92 -0
  231. package/src/helpers/vault/server-side.ts +153 -0
  232. package/src/hexclave-config-file.ts +120 -0
  233. package/src/hooks/use-async-callback.tsx +43 -0
  234. package/src/hooks/use-async-external-store.tsx +24 -0
  235. package/src/hooks/use-hash.tsx +14 -0
  236. package/src/hooks/use-hover.tsx +88 -0
  237. package/src/hooks/use-strict-memo.tsx +157 -0
  238. package/src/index.ts +17 -0
  239. package/src/interface/admin-interface.ts +1043 -0
  240. package/src/interface/admin-metrics.ts +214 -0
  241. package/src/interface/client-interface.test.ts +765 -0
  242. package/src/interface/client-interface.ts +2586 -0
  243. package/src/interface/conversations.ts +109 -0
  244. package/src/interface/crud/analytics.ts +11 -0
  245. package/src/interface/crud/connected-accounts.ts +52 -0
  246. package/src/interface/crud/contact-channels.ts +74 -0
  247. package/src/interface/crud/current-user.ts +72 -0
  248. package/src/interface/crud/email-outbox.ts +263 -0
  249. package/src/interface/crud/email-templates.ts +50 -0
  250. package/src/interface/crud/emails.ts +22 -0
  251. package/src/interface/crud/internal-api-keys.ts +69 -0
  252. package/src/interface/crud/invoices.ts +36 -0
  253. package/src/interface/crud/items.ts +24 -0
  254. package/src/interface/crud/notification-preferences.ts +33 -0
  255. package/src/interface/crud/oauth-providers.ts +91 -0
  256. package/src/interface/crud/products.ts +42 -0
  257. package/src/interface/crud/project-api-keys.ts +100 -0
  258. package/src/interface/crud/project-permissions.ts +118 -0
  259. package/src/interface/crud/projects.ts +229 -0
  260. package/src/interface/crud/session-replays.ts +85 -0
  261. package/src/interface/crud/sessions.ts +66 -0
  262. package/src/interface/crud/sign-up-rules.ts +12 -0
  263. package/src/interface/crud/svix-token.ts +20 -0
  264. package/src/interface/crud/team-invitation-details.ts +22 -0
  265. package/src/interface/crud/team-invitation.ts +35 -0
  266. package/src/interface/crud/team-member-profiles.ts +61 -0
  267. package/src/interface/crud/team-memberships.ts +56 -0
  268. package/src/interface/crud/team-permissions.ts +119 -0
  269. package/src/interface/crud/teams.ts +142 -0
  270. package/src/interface/crud/transactions.ts +131 -0
  271. package/src/interface/crud/users.ts +185 -0
  272. package/src/interface/handler-urls.ts +74 -0
  273. package/src/interface/page-component-versions.ts +1702 -0
  274. package/src/interface/server-interface.ts +1146 -0
  275. package/src/interface/webhooks.ts +28 -0
  276. package/src/known-errors.tsx +2031 -0
  277. package/src/local-emulator.ts +5 -0
  278. package/src/payments/payment-methods.ts +167 -0
  279. package/src/payments/stripe-limits.ts +18 -0
  280. package/src/plans.ts +107 -0
  281. package/src/schema-fields.ts +944 -0
  282. package/src/sessions.ts +310 -0
  283. package/src/utils/api-keys.tsx +122 -0
  284. package/src/utils/arrays.tsx +248 -0
  285. package/src/utils/auth-methods.ts +8 -0
  286. package/src/utils/base64.tsx +24 -0
  287. package/src/utils/booleans.tsx +34 -0
  288. package/src/utils/browser-compat.tsx +17 -0
  289. package/src/utils/bytes.tsx +280 -0
  290. package/src/utils/caches.tsx +280 -0
  291. package/src/utils/cel-fields.ts +92 -0
  292. package/src/utils/cloud-hosts.tsx +92 -0
  293. package/src/utils/compile-time.tsx +11 -0
  294. package/src/utils/country-codes.ts +39 -0
  295. package/src/utils/crypto.tsx +174 -0
  296. package/src/utils/currencies.tsx +53 -0
  297. package/src/utils/currency-constants.tsx +51 -0
  298. package/src/utils/dates.tsx +246 -0
  299. package/src/utils/dev-env-state-path.ts +14 -0
  300. package/src/utils/dom.tsx +7 -0
  301. package/src/utils/env.tsx +117 -0
  302. package/src/utils/errors.tsx +284 -0
  303. package/src/utils/esbuild.tsx +235 -0
  304. package/src/utils/featurebase.tsx +247 -0
  305. package/src/utils/fs.tsx +33 -0
  306. package/src/utils/functions.tsx +22 -0
  307. package/src/utils/geo.tsx +16 -0
  308. package/src/utils/globals.tsx +48 -0
  309. package/src/utils/hashes.tsx +52 -0
  310. package/src/utils/html.tsx +60 -0
  311. package/src/utils/http.tsx +91 -0
  312. package/src/utils/ips.tsx +47 -0
  313. package/src/utils/json.tsx +200 -0
  314. package/src/utils/jsx-editable-transpiler.test.ts +156 -0
  315. package/src/utils/jsx-editable-transpiler.tsx +401 -0
  316. package/src/utils/jwt.tsx +170 -0
  317. package/src/utils/locks.tsx +71 -0
  318. package/src/utils/maps.tsx +407 -0
  319. package/src/utils/math.tsx +18 -0
  320. package/src/utils/monkey-patch.tsx +29 -0
  321. package/src/utils/node-http.tsx +47 -0
  322. package/src/utils/numbers.tsx +82 -0
  323. package/src/utils/oauth.tsx +9 -0
  324. package/src/utils/objects.tsx +581 -0
  325. package/src/utils/paginated-lists.test.ts +1039 -0
  326. package/src/utils/paginated-lists.tsx +479 -0
  327. package/src/utils/passkey.tsx +1 -0
  328. package/src/utils/promises.tsx +540 -0
  329. package/src/utils/proxies.tsx +212 -0
  330. package/src/utils/react.tsx +308 -0
  331. package/src/utils/redirect-urls.tsx +299 -0
  332. package/src/utils/regex.tsx +10 -0
  333. package/src/utils/results.tsx +411 -0
  334. package/src/utils/sentry.tsx +20 -0
  335. package/src/utils/stores.tsx +238 -0
  336. package/src/utils/strings.nicify.test.ts +253 -0
  337. package/src/utils/strings.tsx +723 -0
  338. package/src/utils/telemetry.tsx +37 -0
  339. package/src/utils/turnstile-browser.ts +106 -0
  340. package/src/utils/turnstile-flow.test.ts +101 -0
  341. package/src/utils/turnstile-flow.ts +266 -0
  342. package/src/utils/turnstile.ts +34 -0
  343. package/src/utils/typed-arrays.tsx +17 -0
  344. package/src/utils/types.tsx +208 -0
  345. package/src/utils/unicode.tsx +24 -0
  346. package/src/utils/urls.tsx +411 -0
  347. package/src/utils/uuids.tsx +47 -0
  348. package/dist/esm/stack-config-file.d.ts +0 -15
  349. package/dist/esm/stack-config-file.d.ts.map +0 -1
  350. package/dist/esm/stack-config-file.js.map +0 -1
  351. package/dist/stack-config-file.d.ts +0 -15
  352. package/dist/stack-config-file.d.ts.map +0 -1
  353. package/dist/stack-config-file.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import { yupBoolean, yupMixed, yupNumber, yupObject, yupString } from "../../schema-fields";
3
+
4
+ const baseInternalApiKeysReadSchema = yupObject({
5
+ id: yupString().defined(),
6
+ description: yupString().defined(),
7
+ expires_at_millis: yupNumber().defined(),
8
+ manually_revoked_at_millis: yupNumber().optional(),
9
+ created_at_millis: yupNumber().defined(),
10
+ });
11
+
12
+ // Used for the result of the create endpoint
13
+ export const internalApiKeysCreateInputSchema = yupObject({
14
+ description: yupString().defined(),
15
+ expires_at_millis: yupNumber().defined(),
16
+ has_publishable_client_key: yupBoolean().defined(),
17
+ has_secret_server_key: yupBoolean().defined(),
18
+ has_super_secret_admin_key: yupBoolean().defined(),
19
+ });
20
+
21
+ export const internalApiKeysCreateOutputSchema = baseInternalApiKeysReadSchema.concat(yupObject({
22
+ publishable_client_key: yupString().optional(),
23
+ secret_server_key: yupString().optional(),
24
+ super_secret_admin_key: yupString().optional(),
25
+ }).defined());
26
+
27
+ // Used for list, read and update endpoints after the initial creation
28
+ export const internalApiKeysCrudAdminObfuscatedReadSchema = baseInternalApiKeysReadSchema.concat(yupObject({
29
+ publishable_client_key: yupObject({
30
+ last_four: yupString().defined(),
31
+ }).optional(),
32
+ secret_server_key: yupObject({
33
+ last_four: yupString().defined(),
34
+ }).optional(),
35
+ super_secret_admin_key: yupObject({
36
+ last_four: yupString().defined(),
37
+ }).optional(),
38
+ }));
39
+
40
+ export const internalApiKeysCrudAdminUpdateSchema = yupObject({
41
+ description: yupString().optional(),
42
+ revoked: yupBoolean().oneOf([true]).optional(),
43
+ }).defined();
44
+
45
+ export const internalApiKeysCrudAdminDeleteSchema = yupMixed();
46
+
47
+ export const internalApiKeysCrud = createCrud({
48
+ adminReadSchema: internalApiKeysCrudAdminObfuscatedReadSchema,
49
+ adminUpdateSchema: internalApiKeysCrudAdminUpdateSchema,
50
+ adminDeleteSchema: internalApiKeysCrudAdminDeleteSchema,
51
+ docs: {
52
+ adminList: {
53
+ hidden: true,
54
+ },
55
+ adminRead: {
56
+ hidden: true,
57
+ },
58
+ adminCreate: {
59
+ hidden: true,
60
+ },
61
+ adminUpdate: {
62
+ hidden: true,
63
+ },
64
+ adminDelete: {
65
+ hidden: true,
66
+ },
67
+ },
68
+ });
69
+ export type InternalApiKeysCrud = CrudTypeOf<typeof internalApiKeysCrud>;
@@ -0,0 +1,36 @@
1
+ import type * as yup from "yup";
2
+ import { yupArray, yupBoolean, yupNumber, yupObject, yupString } from "../../schema-fields";
3
+
4
+ const invoiceStatusSchema = yupString().oneOf([
5
+ "draft",
6
+ "open",
7
+ "paid",
8
+ "uncollectible",
9
+ "void",
10
+ ]).nullable().defined();
11
+
12
+ export const customerInvoiceReadSchema = yupObject({
13
+ created_at_millis: yupNumber().defined(),
14
+ status: invoiceStatusSchema,
15
+ amount_total: yupNumber().integer().defined(),
16
+ hosted_invoice_url: yupString().nullable().defined(),
17
+ }).defined();
18
+
19
+ export type CustomerInvoiceRead = yup.InferType<typeof customerInvoiceReadSchema>;
20
+
21
+ export const customerInvoicesListResponseSchema = yupObject({
22
+ items: yupArray(customerInvoiceReadSchema).defined(),
23
+ is_paginated: yupBoolean().oneOf([true]).defined(),
24
+ pagination: yupObject({
25
+ next_cursor: yupString().nullable().defined(),
26
+ }).defined(),
27
+ }).defined();
28
+
29
+ export type CustomerInvoicesListResponse = yup.InferType<typeof customerInvoicesListResponseSchema>;
30
+
31
+ export type ListCustomerInvoicesOptions = {
32
+ customer_type: "user" | "team",
33
+ customer_id: string,
34
+ cursor?: string,
35
+ limit?: number,
36
+ };
@@ -0,0 +1,24 @@
1
+ import { createCrud, CrudTypeOf } from "../../crud";
2
+ import { yupBoolean, yupNumber, yupObject, yupString } from "../../schema-fields";
3
+
4
+
5
+ const itemReadSchema = yupObject({
6
+ id: yupString().defined(),
7
+ display_name: yupString().defined(),
8
+ quantity: yupNumber().defined(),
9
+ }).defined();
10
+
11
+ const itemUpdateSchema = yupObject({
12
+ delta: yupNumber().defined(),
13
+ expires_at: yupString().optional(),
14
+ description: yupString().optional(),
15
+ allow_negative: yupBoolean().optional(),
16
+ }).defined();
17
+
18
+
19
+ export const itemCrud = createCrud({
20
+ clientReadSchema: itemReadSchema,
21
+ serverUpdateSchema: itemUpdateSchema,
22
+ });
23
+
24
+ export type ItemCrud = CrudTypeOf<typeof itemCrud>;
@@ -0,0 +1,33 @@
1
+ import { createCrud, CrudTypeOf } from "../../crud";
2
+ import { yupBoolean, yupObject, yupString } from "../../schema-fields";
3
+
4
+
5
+ const notificationPreferenceReadSchema = yupObject({
6
+ notification_category_id: yupString().defined(),
7
+ notification_category_name: yupString().defined(),
8
+ enabled: yupBoolean().defined(),
9
+ can_disable: yupBoolean().defined(),
10
+ }).defined();
11
+
12
+ const notificationPreferenceUpdateSchema = yupObject({
13
+ enabled: yupBoolean().defined(),
14
+ }).defined();
15
+
16
+ export const notificationPreferenceCrud = createCrud({
17
+ clientReadSchema: notificationPreferenceReadSchema,
18
+ clientUpdateSchema: notificationPreferenceUpdateSchema,
19
+ docs: {
20
+ clientList: {
21
+ summary: "List notification preferences",
22
+ description: "Get all notification preferences for a user, showing which notification categories are enabled or disabled.",
23
+ tags: ["Emails"],
24
+ },
25
+ clientUpdate: {
26
+ summary: "Update notification preference",
27
+ description: "Enable or disable a specific notification category for a user.",
28
+ tags: ["Emails"],
29
+ },
30
+ },
31
+ });
32
+
33
+ export type NotificationPreferenceCrud = CrudTypeOf<typeof notificationPreferenceCrud>;
@@ -0,0 +1,91 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import {
3
+ oauthProviderAccountIdSchema,
4
+ oauthProviderAllowConnectedAccountsSchema,
5
+ oauthProviderAllowSignInSchema,
6
+ oauthProviderEmailSchema,
7
+ oauthProviderIdSchema,
8
+ oauthProviderProviderConfigIdSchema,
9
+ oauthProviderTypeSchema,
10
+ userIdOrMeSchema,
11
+ yupMixed,
12
+ yupObject,
13
+ yupString
14
+ } from "../../schema-fields";
15
+
16
+ export const oauthProviderClientReadSchema = yupObject({
17
+ user_id: userIdOrMeSchema.defined(),
18
+ id: oauthProviderIdSchema.defined(),
19
+ email: oauthProviderEmailSchema.optional(),
20
+ provider_config_id: oauthProviderProviderConfigIdSchema.defined(),
21
+ type: oauthProviderTypeSchema.defined(),
22
+ allow_sign_in: oauthProviderAllowSignInSchema.defined(),
23
+ allow_connected_accounts: oauthProviderAllowConnectedAccountsSchema.defined(),
24
+ }).defined();
25
+
26
+ export const oauthProviderServerReadSchema = oauthProviderClientReadSchema.concat(yupObject({
27
+ account_id: oauthProviderAccountIdSchema.defined(),
28
+ }));
29
+
30
+ export const oauthProviderCrudClientUpdateSchema = yupObject({
31
+ allow_sign_in: oauthProviderAllowSignInSchema.optional(),
32
+ allow_connected_accounts: oauthProviderAllowConnectedAccountsSchema.optional(),
33
+ }).defined();
34
+
35
+ export const oauthProviderCrudServerUpdateSchema = oauthProviderCrudClientUpdateSchema.concat(yupObject({
36
+ email: oauthProviderEmailSchema.optional(),
37
+ account_id: oauthProviderAccountIdSchema.optional(),
38
+ }));
39
+
40
+ export const oauthProviderCrudServerCreateSchema = yupObject({
41
+ user_id: userIdOrMeSchema.defined(),
42
+ provider_config_id: yupString().defined(),
43
+ email: oauthProviderEmailSchema.optional(),
44
+ allow_sign_in: oauthProviderAllowSignInSchema.defined(),
45
+ allow_connected_accounts: oauthProviderAllowConnectedAccountsSchema.defined(),
46
+ account_id: oauthProviderAccountIdSchema.defined(),
47
+ }).defined();
48
+
49
+ export const oauthProviderCrudClientDeleteSchema = yupMixed();
50
+
51
+ export const oauthProviderCrud = createCrud({
52
+ clientReadSchema: oauthProviderClientReadSchema,
53
+ clientUpdateSchema: oauthProviderCrudClientUpdateSchema,
54
+ clientDeleteSchema: oauthProviderCrudClientDeleteSchema,
55
+ serverReadSchema: oauthProviderServerReadSchema,
56
+ serverUpdateSchema: oauthProviderCrudServerUpdateSchema,
57
+ serverCreateSchema: oauthProviderCrudServerCreateSchema,
58
+ docs: {
59
+ clientRead: {
60
+ summary: "Get an OAuth provider",
61
+ description: "Retrieves a specific OAuth provider by the user ID and the OAuth provider ID.",
62
+ tags: ["Oauth"],
63
+ },
64
+ serverCreate: {
65
+ summary: "Create an OAuth provider",
66
+ description: "Add a new OAuth provider for a user.",
67
+ tags: ["Oauth"],
68
+ },
69
+ serverUpdate: {
70
+ summary: "Update an OAuth provider",
71
+ description: "Updates an existing OAuth provider. Only the values provided will be updated.",
72
+ tags: ["Oauth"],
73
+ },
74
+ clientUpdate: {
75
+ summary: "Update an OAuth provider",
76
+ description: "Updates an existing OAuth provider for a user.",
77
+ tags: ["Oauth"],
78
+ },
79
+ clientDelete: {
80
+ summary: "Delete an OAuth provider",
81
+ description: "Removes an OAuth provider for a given user.",
82
+ tags: ["Oauth"],
83
+ },
84
+ clientList: {
85
+ summary: "List OAuth providers",
86
+ description: "Retrieves a list of all OAuth providers for a user.",
87
+ tags: ["Oauth"],
88
+ },
89
+ }
90
+ });
91
+ export type OAuthProviderCrud = CrudTypeOf<typeof oauthProviderCrud>;
@@ -0,0 +1,42 @@
1
+ import type * as yup from "yup";
2
+ import { inlineProductSchema, yupArray, yupBoolean, yupNumber, yupObject, yupString } from "../../schema-fields";
3
+
4
+ const customerProductSwitchOptionSchema = yupObject({
5
+ product_id: yupString().defined(),
6
+ product: inlineProductSchema.defined(),
7
+ }).defined();
8
+
9
+ export const customerProductReadSchema = yupObject({
10
+ id: yupString().nullable().defined(),
11
+ quantity: yupNumber().defined(),
12
+ product: inlineProductSchema.defined(),
13
+ /** @deprecated Product ownership is independent of purchase type. Will be removed in a future version. */
14
+ type: yupString().oneOf(["one_time", "subscription"]).optional(),
15
+ /** @deprecated Subscription management will move to a dedicated endpoint. Will be removed in a future version. */
16
+ subscription: yupObject({
17
+ subscription_id: yupString().nullable().defined(),
18
+ current_period_end: yupString().nullable().defined(),
19
+ cancel_at_period_end: yupBoolean().defined(),
20
+ is_cancelable: yupBoolean().defined(),
21
+ }).nullable().optional(),
22
+ switch_options: yupArray(customerProductSwitchOptionSchema).optional(),
23
+ }).defined();
24
+
25
+ export type CustomerProductRead = yup.InferType<typeof customerProductReadSchema>;
26
+
27
+ export const customerProductsListResponseSchema = yupObject({
28
+ items: yupArray(customerProductReadSchema).defined(),
29
+ is_paginated: yupBoolean().oneOf([true]).defined(),
30
+ pagination: yupObject({
31
+ next_cursor: yupString().nullable().defined(),
32
+ }).defined(),
33
+ }).defined();
34
+
35
+ export type CustomerProductsListResponse = yup.InferType<typeof customerProductsListResponseSchema>;
36
+
37
+ export type ListCustomerProductsOptions = {
38
+ customer_type: "user" | "team" | "custom",
39
+ customer_id: string,
40
+ cursor?: string,
41
+ limit?: number,
42
+ };
@@ -0,0 +1,100 @@
1
+ import * as yup from "yup";
2
+ import { CrudTypeOf, createCrud } from "../../crud";
3
+ import { userIdOrMeSchema, yupBoolean, yupNumber, yupObject, yupString } from "../../schema-fields";
4
+ import { typedFromEntries } from "../../utils/objects";
5
+
6
+ function createApiKeyCrud<T extends string, IdFieldName extends string, IdSchema extends yup.Schema<any>>(type: T, idFieldName: IdFieldName, idSchema: IdSchema) {
7
+ const projectApiKeysReadSchema = yupObject({
8
+ id: yupString().defined(),
9
+ description: yupString().defined(),
10
+ expires_at_millis: yupNumber().optional(),
11
+ manually_revoked_at_millis: yupNumber().optional(),
12
+ created_at_millis: yupNumber().defined(),
13
+ is_public: yupBoolean().defined(),
14
+ value: yupObject({
15
+ last_four: yupString().defined(),
16
+ }).defined(),
17
+ type: yupString().oneOf([type]).defined(),
18
+ ...typedFromEntries([[idFieldName, idSchema]]),
19
+ });
20
+
21
+ const projectApiKeysUpdateSchema = yupObject({
22
+ description: yupString().optional(),
23
+ revoked: yupBoolean().oneOf([true]).optional(),
24
+ }).defined();
25
+
26
+ const projectApiKeysCrud = createCrud({
27
+ clientReadSchema: projectApiKeysReadSchema,
28
+ clientUpdateSchema: projectApiKeysUpdateSchema,
29
+ docs: {
30
+ clientCreate: {
31
+ description: `Create a new ${type} API key`,
32
+ displayName: `Create ${type} API key`,
33
+ tags: ["API Keys"],
34
+ summary: `Create ${type} API key`,
35
+ },
36
+ clientList: {
37
+ description: `List all ${type} API keys for the project with their metadata and status`,
38
+ displayName: `List ${type} API keys`,
39
+ summary: `List ${type} API keys`,
40
+ tags: ["API Keys"],
41
+ },
42
+ clientRead: {
43
+ description: `Get details of a specific ${type} API key`,
44
+ displayName: `Get ${type} API key`,
45
+ summary: `Get ${type} API key details`,
46
+ tags: ["API Keys"],
47
+ },
48
+ clientUpdate: {
49
+ description: `Update an ${type} API key`,
50
+ displayName: `Update ${type} API key`,
51
+ summary: `Update ${type} API key`,
52
+ tags: ["API Keys"],
53
+ },
54
+ serverDelete: {
55
+ description: `Delete an ${type} API key`,
56
+ displayName: `Delete ${type} API key`,
57
+ summary: `Delete ${type} API key`,
58
+ tags: ["API Keys"],
59
+ },
60
+ },
61
+ });
62
+
63
+ // Used for the result of the create endpoint
64
+ const projectApiKeysCreateInputSchema = yupObject({
65
+ description: yupString().defined(),
66
+ expires_at_millis: yupNumber().nullable().defined(),
67
+ is_public: yupBoolean().optional(),
68
+ /*
69
+ prefix: yupString().optional().nonEmpty().test("prefix", "Prefix must contain only alphanumeric characters and underscores", (value) => {
70
+ if (!value) return true;
71
+ return /^[a-zA-Z0-9_]+$/.test(value);
72
+ }),
73
+ */
74
+ ...typedFromEntries([[idFieldName, idSchema]]),
75
+ });
76
+ const projectApiKeysCreateOutputSchema = projectApiKeysReadSchema.omit(["value"]).concat(yupObject({
77
+ value: yupString().defined(),
78
+ }));
79
+
80
+ return {
81
+ crud: projectApiKeysCrud,
82
+ createInputSchema: projectApiKeysCreateInputSchema,
83
+ createOutputSchema: projectApiKeysCreateOutputSchema,
84
+ };
85
+ }
86
+
87
+
88
+ export const {
89
+ crud: userApiKeysCrud,
90
+ createInputSchema: userApiKeysCreateInputSchema,
91
+ createOutputSchema: userApiKeysCreateOutputSchema,
92
+ } = createApiKeyCrud("user", "user_id", userIdOrMeSchema.defined());
93
+ export type UserApiKeysCrud = CrudTypeOf<typeof userApiKeysCrud>;
94
+
95
+ export const {
96
+ crud: teamApiKeysCrud,
97
+ createInputSchema: teamApiKeysCreateInputSchema,
98
+ createOutputSchema: teamApiKeysCreateOutputSchema,
99
+ } = createApiKeyCrud("team", "team_id", yupString().defined());
100
+ export type TeamApiKeysCrud = CrudTypeOf<typeof teamApiKeysCrud>;
@@ -0,0 +1,118 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import * as schemaFields from "../../schema-fields";
3
+ import { yupMixed, yupObject } from "../../schema-fields";
4
+ import { WebhookEvent } from "../webhooks";
5
+
6
+ // =============== Project permissions =================
7
+
8
+ export const projectPermissionsCrudClientReadSchema = yupObject({
9
+ id: schemaFields.permissionDefinitionIdSchema.defined(),
10
+ user_id: schemaFields.userIdSchema.defined(),
11
+ }).defined();
12
+
13
+ export const projectPermissionsCrudServerCreateSchema = yupObject({
14
+ }).defined();
15
+
16
+ export const projectPermissionsCrudServerDeleteSchema = yupMixed();
17
+
18
+ export const projectPermissionsCrud = createCrud({
19
+ clientReadSchema: projectPermissionsCrudClientReadSchema,
20
+ serverCreateSchema: projectPermissionsCrudServerCreateSchema,
21
+ serverDeleteSchema: projectPermissionsCrudServerDeleteSchema,
22
+ docs: {
23
+ clientList: {
24
+ summary: "List project permissions",
25
+ description: "List global permissions of the current user. `user_id=me` must be set for client requests. `(user_id, permission_id)` together uniquely identify a permission.",
26
+ tags: ["Permissions"],
27
+ },
28
+ serverList: {
29
+ summary: "List project permissions",
30
+ description: "Query and filter the permission with `user_id` and `permission_id`. `(user_id, permission_id)` together uniquely identify a permission.",
31
+ tags: ["Permissions"],
32
+ },
33
+ serverCreate: {
34
+ summary: "Grant a global permission to a user",
35
+ description: "Grant a global permission to a user (the permission must be created first on the Hexclave dashboard)",
36
+ tags: ["Permissions"],
37
+ },
38
+ serverDelete: {
39
+ summary: "Revoke a global permission from a user",
40
+ description: "Revoke a global permission from a user",
41
+ tags: ["Permissions"],
42
+ },
43
+ },
44
+ });
45
+ export type ProjectPermissionsCrud = CrudTypeOf<typeof projectPermissionsCrud>;
46
+
47
+ export const projectPermissionCreatedWebhookEvent = {
48
+ type: "project_permission.created",
49
+ schema: projectPermissionsCrud.server.readSchema,
50
+ metadata: {
51
+ summary: "Project Permission Created",
52
+ description: "This event is triggered when a project permission is created.",
53
+ tags: ["Users"],
54
+ },
55
+ } satisfies WebhookEvent<typeof projectPermissionsCrud.server.readSchema>;
56
+
57
+ export const projectPermissionDeletedWebhookEvent = {
58
+ type: "project_permission.deleted",
59
+ schema: projectPermissionsCrud.server.readSchema,
60
+ metadata: {
61
+ summary: "Project Permission Deleted",
62
+ description: "This event is triggered when a project permission is deleted.",
63
+ tags: ["Users"],
64
+ },
65
+ } satisfies WebhookEvent<typeof projectPermissionsCrud.server.readSchema>;
66
+
67
+ // =============== Project permission definitions =================
68
+
69
+ export const projectPermissionDefinitionsCrudAdminReadSchema = yupObject({
70
+ id: schemaFields.permissionDefinitionIdSchema.defined(),
71
+ description: schemaFields.teamPermissionDescriptionSchema.optional(),
72
+ contained_permission_ids: schemaFields.containedPermissionIdsSchema.defined(),
73
+ }).defined();
74
+
75
+ export const projectPermissionDefinitionsCrudAdminCreateSchema = yupObject({
76
+ id: schemaFields.customPermissionDefinitionIdSchema.defined(),
77
+ description: schemaFields.teamPermissionDescriptionSchema.optional(),
78
+ contained_permission_ids: schemaFields.containedPermissionIdsSchema.optional(),
79
+ }).defined();
80
+
81
+ export const projectPermissionDefinitionsCrudAdminUpdateSchema = yupObject({
82
+ id: schemaFields.customPermissionDefinitionIdSchema.optional(),
83
+ description: schemaFields.teamPermissionDescriptionSchema.optional(),
84
+ contained_permission_ids: schemaFields.containedPermissionIdsSchema.optional(),
85
+ }).defined();
86
+
87
+ export const projectPermissionDefinitionsCrudAdminDeleteSchema = yupMixed();
88
+
89
+ export const projectPermissionDefinitionsCrud = createCrud({
90
+ adminReadSchema: projectPermissionDefinitionsCrudAdminReadSchema,
91
+ adminCreateSchema: projectPermissionDefinitionsCrudAdminCreateSchema,
92
+ adminUpdateSchema: projectPermissionDefinitionsCrudAdminUpdateSchema,
93
+ adminDeleteSchema: projectPermissionDefinitionsCrudAdminDeleteSchema,
94
+ docs: {
95
+ adminList: {
96
+ summary: "List project permission definitions",
97
+ description: "Query and filter project permission definitions (the equivalent of listing permissions on the Hexclave dashboard)",
98
+ tags: ["Permissions"],
99
+ },
100
+ adminCreate: {
101
+ summary: "Create a new project permission definition",
102
+ description: "Create a new project permission definition (the equivalent of creating a new permission on the Hexclave dashboard)",
103
+ tags: ["Permissions"],
104
+ },
105
+ adminUpdate: {
106
+ summary: "Update a project permission definition",
107
+ description: "Update a project permission definition (the equivalent of updating a permission on the Hexclave dashboard)",
108
+ tags: ["Permissions"],
109
+ },
110
+ adminDelete: {
111
+ summary: "Delete a project permission definition",
112
+ description: "Delete a project permission definition (the equivalent of deleting a permission on the Hexclave dashboard)",
113
+ tags: ["Permissions"],
114
+ },
115
+ },
116
+ });
117
+
118
+ export type ProjectPermissionDefinitionsCrud = CrudTypeOf<typeof projectPermissionDefinitionsCrud>;