@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,229 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import { ALL_APPS } from "../../apps/apps-config";
3
+ import * as schemaFields from "../../schema-fields";
4
+ import { yupArray, yupObject, yupString } from "../../schema-fields";
5
+
6
+ const teamPermissionSchema = yupObject({
7
+ id: yupString().defined(),
8
+ }).defined();
9
+
10
+ const oauthProviderReadSchema = yupObject({
11
+ provider_config_id: schemaFields.yupString().defined(),
12
+ id: schemaFields.oauthIdSchema.defined(),
13
+ type: schemaFields.oauthTypeSchema.defined(),
14
+ client_id: schemaFields.yupDefinedAndNonEmptyWhen(
15
+ schemaFields.oauthClientIdSchema,
16
+ { type: 'standard' },
17
+ ),
18
+ client_secret: schemaFields.yupDefinedAndNonEmptyWhen(
19
+ schemaFields.oauthClientSecretSchema,
20
+ { type: 'standard' },
21
+ ),
22
+
23
+ // extra params
24
+ facebook_config_id: schemaFields.oauthFacebookConfigIdSchema.optional(),
25
+ microsoft_tenant_id: schemaFields.oauthMicrosoftTenantIdSchema.optional(),
26
+ apple_bundle_ids: schemaFields.oauthAppleBundleIdsSchema.optional(),
27
+ });
28
+
29
+ const oauthProviderWriteSchema = oauthProviderReadSchema.omit(['provider_config_id']);
30
+
31
+ const enabledOAuthProviderSchema = yupObject({
32
+ id: schemaFields.oauthIdSchema.defined(),
33
+ });
34
+
35
+ const onboardingConfigChoiceValues = ["create-new", "link-existing"] as const;
36
+ const onboardingSignInMethodValues = ["credential", "magicLink", "passkey", "google", "github", "microsoft"] as const;
37
+ const onboardingPaymentsCountryValues = ["US", "OTHER"] as const;
38
+
39
+ const projectOnboardingStateSchema = yupObject({
40
+ selected_config_choice: yupString().oneOf(onboardingConfigChoiceValues).defined(),
41
+ selected_apps: yupArray(yupString().oneOf(Object.keys(ALL_APPS)).defined()).defined(),
42
+ selected_sign_in_methods: yupArray(yupString().oneOf(onboardingSignInMethodValues).defined()).defined(),
43
+ selected_email_theme_id: schemaFields.emailThemeSchema.nullable().defined(),
44
+ selected_payments_country: yupString().oneOf(onboardingPaymentsCountryValues).defined(),
45
+ });
46
+
47
+ export const emailConfigSchema = yupObject({
48
+ type: schemaFields.emailTypeSchema.defined(),
49
+ host: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailHostSchema, {
50
+ type: 'standard',
51
+ }),
52
+ port: schemaFields.yupDefinedWhen(schemaFields.emailPortSchema, {
53
+ type: 'standard',
54
+ }),
55
+ username: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailUsernameSchema, {
56
+ type: 'standard',
57
+ }),
58
+ password: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailPasswordSchema, {
59
+ type: 'standard',
60
+ }),
61
+ sender_name: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailSenderNameSchema, {
62
+ type: 'standard',
63
+ }),
64
+ sender_email: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailSenderEmailSchema, {
65
+ type: 'standard',
66
+ }),
67
+ });
68
+
69
+ export const emailConfigWithoutPasswordSchema = emailConfigSchema.pick(['type', 'host', 'port', 'username', 'sender_name', 'sender_email']);
70
+
71
+ const domainSchema = yupObject({
72
+ domain: schemaFields.urlSchema.defined()
73
+ .matches(/^https?:\/\//, 'URL must start with http:// or https://')
74
+ .meta({ openapiField: { description: 'URL. Must start with http:// or https://', exampleValue: 'https://example.com' } }),
75
+ handler_path: schemaFields.handlerPathSchema.defined(),
76
+ });
77
+
78
+ export const projectsCrudAdminReadSchema = yupObject({
79
+ id: schemaFields.projectIdSchema.defined(),
80
+ display_name: schemaFields.projectDisplayNameSchema.defined(),
81
+ description: schemaFields.projectDescriptionSchema.nonNullable().defined(),
82
+ logo_url: schemaFields.projectLogoUrlSchema.nullable().optional(),
83
+ logo_full_url: schemaFields.projectLogoFullUrlSchema.nullable().optional(),
84
+ logo_dark_mode_url: schemaFields.projectLogoDarkModeUrlSchema.nullable().optional(),
85
+ logo_full_dark_mode_url: schemaFields.projectLogoFullDarkModeUrlSchema.nullable().optional(),
86
+ created_at_millis: schemaFields.projectCreatedAtMillisSchema.defined(),
87
+ is_production_mode: schemaFields.projectIsProductionModeSchema.defined(),
88
+ is_development_environment: schemaFields.yupBoolean().defined(),
89
+ owner_team_id: schemaFields.yupString().nullable().defined(),
90
+ onboarding_status: schemaFields.projectOnboardingStatusSchema.defined(),
91
+ onboarding_state: projectOnboardingStateSchema.nullable().optional(),
92
+ /** @deprecated */
93
+ config: yupObject({
94
+ allow_localhost: schemaFields.projectAllowLocalhostSchema.defined(),
95
+ sign_up_enabled: schemaFields.projectSignUpEnabledSchema.defined(),
96
+ credential_enabled: schemaFields.projectCredentialEnabledSchema.defined(),
97
+ magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.defined(),
98
+ passkey_enabled: schemaFields.projectPasskeyEnabledSchema.defined(),
99
+ // TODO: remove this
100
+ client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.defined(),
101
+ client_user_deletion_enabled: schemaFields.projectClientUserDeletionEnabledSchema.defined(),
102
+ allow_user_api_keys: schemaFields.yupBoolean().defined(),
103
+ allow_team_api_keys: schemaFields.yupBoolean().defined(),
104
+ oauth_providers: yupArray(oauthProviderReadSchema.defined()).defined(),
105
+ enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.defined()).defined().meta({ openapiField: { hidden: true } }),
106
+ domains: yupArray(domainSchema.defined()).defined(),
107
+ email_config: emailConfigSchema.defined(),
108
+ email_theme: schemaFields.emailThemeSchema.defined(),
109
+ create_team_on_sign_up: schemaFields.projectCreateTeamOnSignUpSchema.defined(),
110
+ team_creator_default_permissions: yupArray(teamPermissionSchema.defined()).defined(),
111
+ team_member_default_permissions: yupArray(teamPermissionSchema.defined()).defined(),
112
+ user_default_permissions: yupArray(teamPermissionSchema.defined()).defined(),
113
+ oauth_account_merge_strategy: schemaFields.oauthAccountMergeStrategySchema.defined(),
114
+ }).defined().meta({ openapiField: { hidden: true } }),
115
+ }).defined();
116
+
117
+ export const projectsCrudClientReadSchema = yupObject({
118
+ id: schemaFields.projectIdSchema.defined(),
119
+ display_name: schemaFields.projectDisplayNameSchema.defined(),
120
+ config: yupObject({
121
+ sign_up_enabled: schemaFields.projectSignUpEnabledSchema.defined(),
122
+ credential_enabled: schemaFields.projectCredentialEnabledSchema.defined(),
123
+ magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.defined(),
124
+ passkey_enabled: schemaFields.projectPasskeyEnabledSchema.defined(),
125
+ client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.defined(),
126
+ client_user_deletion_enabled: schemaFields.projectClientUserDeletionEnabledSchema.defined(),
127
+ allow_localhost: schemaFields.projectAllowLocalhostSchema.defined(),
128
+ allow_user_api_keys: schemaFields.yupBoolean().defined(),
129
+ allow_team_api_keys: schemaFields.yupBoolean().defined(),
130
+ enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.defined()).defined().meta({ openapiField: { hidden: true } }),
131
+ domains: yupArray(domainSchema.defined()).defined(),
132
+ }).defined().meta({ openapiField: { hidden: true } }),
133
+ }).defined();
134
+
135
+
136
+ export const projectsCrudAdminUpdateSchema = yupObject({
137
+ display_name: schemaFields.projectDisplayNameSchema.optional(),
138
+ description: schemaFields.projectDescriptionSchema.optional(),
139
+ logo_url: schemaFields.projectLogoUrlSchema.nullable().optional(),
140
+ logo_full_url: schemaFields.projectLogoFullUrlSchema.nullable().optional(),
141
+ logo_dark_mode_url: schemaFields.projectLogoDarkModeUrlSchema.nullable().optional(),
142
+ logo_full_dark_mode_url: schemaFields.projectLogoFullDarkModeUrlSchema.nullable().optional(),
143
+ is_production_mode: schemaFields.projectIsProductionModeSchema.optional(),
144
+ onboarding_status: schemaFields.projectOnboardingStatusSchema.optional(),
145
+ onboarding_state: projectOnboardingStateSchema.nullable().optional(),
146
+ /** @deprecated */
147
+ config: yupObject({
148
+ sign_up_enabled: schemaFields.projectSignUpEnabledSchema.optional(),
149
+ credential_enabled: schemaFields.projectCredentialEnabledSchema.optional(),
150
+ magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.optional(),
151
+ passkey_enabled: schemaFields.projectPasskeyEnabledSchema.optional(),
152
+ client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.optional(),
153
+ client_user_deletion_enabled: schemaFields.projectClientUserDeletionEnabledSchema.optional(),
154
+ allow_localhost: schemaFields.projectAllowLocalhostSchema.optional(),
155
+ allow_user_api_keys: schemaFields.yupBoolean().optional(),
156
+ allow_team_api_keys: schemaFields.yupBoolean().optional(),
157
+ email_config: emailConfigSchema.optional().default(undefined),
158
+ email_theme: schemaFields.emailThemeSchema.optional(),
159
+ domains: yupArray(domainSchema.defined()).optional().default(undefined),
160
+ oauth_providers: yupArray(oauthProviderWriteSchema.defined()).optional().default(undefined),
161
+ create_team_on_sign_up: schemaFields.projectCreateTeamOnSignUpSchema.optional(),
162
+ team_creator_default_permissions: yupArray(teamPermissionSchema.defined()).optional(),
163
+ team_member_default_permissions: yupArray(teamPermissionSchema.defined()).optional(),
164
+ user_default_permissions: yupArray(teamPermissionSchema.defined()).optional(),
165
+ oauth_account_merge_strategy: schemaFields.oauthAccountMergeStrategySchema.optional(),
166
+ require_email_verification: schemaFields.yupBoolean().optional(),
167
+ }).optional().default(undefined),
168
+ }).defined();
169
+
170
+ export const projectsCrudAdminCreateSchema = projectsCrudAdminUpdateSchema.concat(yupObject({
171
+ display_name: schemaFields.projectDisplayNameSchema.defined(),
172
+ is_development_environment: schemaFields.yupBoolean().optional(),
173
+ owner_team_id: schemaFields.yupString().uuid().defined(),
174
+ }).defined());
175
+
176
+ export const projectsCrudAdminDeleteSchema = schemaFields.yupMixed();
177
+
178
+ export const clientProjectsCrud = createCrud({
179
+ clientReadSchema: projectsCrudClientReadSchema,
180
+ docs: {
181
+ clientRead: {
182
+ summary: 'Get the current project',
183
+ description: 'Get the current project information including display name, OAuth providers and authentication methods. Useful for displaying the available login options to the user.',
184
+ tags: ['Projects'],
185
+ },
186
+ },
187
+ });
188
+ export type ClientProjectsCrud = CrudTypeOf<typeof clientProjectsCrud>;
189
+
190
+ export const projectsCrud = createCrud({
191
+ adminReadSchema: projectsCrudAdminReadSchema,
192
+ adminUpdateSchema: projectsCrudAdminUpdateSchema,
193
+ adminDeleteSchema: projectsCrudAdminDeleteSchema,
194
+ docs: {
195
+ adminRead: {
196
+ summary: 'Get the current project',
197
+ description: 'Get the current project information and configuration including display name, OAuth providers, email configuration, etc.',
198
+ tags: ['Projects'],
199
+ hidden: true,
200
+ },
201
+ adminUpdate: {
202
+ summary: 'Update the current project',
203
+ description: 'Update the current project information and configuration including display name, OAuth providers, email configuration, etc.',
204
+ tags: ['Projects'],
205
+ hidden: true,
206
+ },
207
+ adminDelete: {
208
+ summary: 'Delete the current project',
209
+ description: 'Delete the current project and all associated data (including users, teams, API keys, project configs, etc.). Be careful, this action is irreversible.',
210
+ tags: ['Projects'],
211
+ hidden: true,
212
+ },
213
+ },
214
+ });
215
+ export type ProjectsCrud = CrudTypeOf<typeof projectsCrud>;
216
+
217
+ export const adminUserProjectsCrud = createCrud({
218
+ clientReadSchema: projectsCrudAdminReadSchema,
219
+ clientCreateSchema: projectsCrudAdminCreateSchema,
220
+ docs: {
221
+ clientList: {
222
+ hidden: true,
223
+ },
224
+ clientCreate: {
225
+ hidden: true,
226
+ },
227
+ },
228
+ });
229
+ export type AdminUserProjectsCrud = CrudTypeOf<typeof adminUserProjectsCrud>;
@@ -0,0 +1,85 @@
1
+ export type AdminListSessionReplaysOptions = {
2
+ limit?: number,
3
+ cursor?: string,
4
+ user_ids?: string[],
5
+ team_ids?: string[],
6
+ duration_ms_min?: number,
7
+ duration_ms_max?: number,
8
+ last_event_at_from_millis?: number,
9
+ last_event_at_to_millis?: number,
10
+ click_count_min?: number,
11
+ };
12
+
13
+ export type AdminListSessionReplaysResponse = {
14
+ items: Array<{
15
+ id: string,
16
+ project_user: {
17
+ id: string,
18
+ display_name: string | null,
19
+ primary_email: string | null,
20
+ },
21
+ started_at_millis: number,
22
+ last_event_at_millis: number,
23
+ chunk_count: number,
24
+ event_count: number,
25
+ }>,
26
+ pagination: {
27
+ next_cursor: string | null,
28
+ },
29
+ };
30
+
31
+ export type AdminGetSessionReplayResponse = {
32
+ id: string,
33
+ project_user: {
34
+ id: string,
35
+ display_name: string | null,
36
+ primary_email: string | null,
37
+ },
38
+ started_at_millis: number,
39
+ last_event_at_millis: number,
40
+ chunk_count: number,
41
+ event_count: number,
42
+ };
43
+
44
+ export type AdminListSessionReplayChunksOptions = {
45
+ limit?: number,
46
+ cursor?: string,
47
+ };
48
+
49
+ export type AdminListSessionReplayChunksResponse = {
50
+ items: Array<{
51
+ id: string,
52
+ batch_id: string,
53
+ session_replay_segment_id: string | null,
54
+ browser_session_id: string | null,
55
+ event_count: number,
56
+ byte_length: number,
57
+ first_event_at_millis: number,
58
+ last_event_at_millis: number,
59
+ created_at_millis: number,
60
+ }>,
61
+ pagination: {
62
+ next_cursor: string | null,
63
+ },
64
+ };
65
+
66
+ export type AdminGetSessionReplayChunkEventsResponse = {
67
+ events: unknown[],
68
+ };
69
+
70
+ export type AdminGetSessionReplayAllEventsResponse = {
71
+ chunks: Array<{
72
+ id: string,
73
+ batch_id: string,
74
+ session_replay_segment_id: string | null,
75
+ event_count: number,
76
+ byte_length: number,
77
+ first_event_at_millis: number,
78
+ last_event_at_millis: number,
79
+ created_at_millis: number,
80
+ }>,
81
+ chunk_events: Array<{
82
+ chunk_id: string,
83
+ events: unknown[],
84
+ }>,
85
+ };
@@ -0,0 +1,66 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import { yupBoolean, yupMixed, yupNumber, yupObject, yupString } from "../../schema-fields";
3
+ import { geoInfoSchema } from "../../utils/geo";
4
+
5
+
6
+ // Create
7
+ export const sessionsCrudServerCreateSchema = yupObject({
8
+ user_id: yupString().uuid().defined(),
9
+ expires_in_millis: yupNumber().max(1000 * 60 * 60 * 24 * 367).default(1000 * 60 * 60 * 24 * 365),
10
+ is_impersonation: yupBoolean().default(false),
11
+ }).defined();
12
+
13
+
14
+ export const sessionsCreateOutputSchema = yupObject({
15
+ refresh_token: yupString().defined(),
16
+ access_token: yupString().defined(),
17
+ }).defined();
18
+
19
+
20
+ export const sessionsCrudReadSchema = yupObject({
21
+ id: yupString().defined(),
22
+ user_id: yupString().uuid().defined(),
23
+ created_at: yupNumber().defined(),
24
+ is_impersonation: yupBoolean().defined(),
25
+ last_used_at: yupNumber().optional(),
26
+ is_current_session: yupBoolean(),
27
+ // TODO move this to a shared type
28
+ // TODO: what about if not trusted?
29
+ last_used_at_end_user_ip_info: geoInfoSchema.optional(),
30
+ }).defined();
31
+
32
+
33
+ // Delete
34
+ export const sessionsCrudDeleteSchema = yupMixed();
35
+
36
+
37
+ export const sessionsCrud = createCrud({
38
+ // serverCreateSchema: sessionsCrudServerCreateSchema,
39
+ serverReadSchema: sessionsCrudReadSchema,
40
+ serverDeleteSchema: sessionsCrudDeleteSchema,
41
+ clientReadSchema: sessionsCrudReadSchema,
42
+ clientDeleteSchema: sessionsCrudDeleteSchema,
43
+ docs: {
44
+ serverList: {
45
+ summary: "List sessions",
46
+ description: "List all sessions for the current user.",
47
+ tags: ["Sessions"],
48
+ },
49
+ serverDelete: {
50
+ summary: "Delete session",
51
+ description: "Delete a session by ID.",
52
+ tags: ["Sessions"],
53
+ },
54
+ clientList: {
55
+ summary: "List sessions",
56
+ description: "List all sessions for the current user.",
57
+ tags: ["Sessions"],
58
+ },
59
+ clientDelete: {
60
+ summary: "Delete session",
61
+ description: "Delete a session by ID.",
62
+ tags: ["Sessions"],
63
+ },
64
+ },
65
+ });
66
+ export type SessionsCrud = CrudTypeOf<typeof sessionsCrud>;
@@ -0,0 +1,12 @@
1
+ export type SignUpRuleAction = {
2
+ type: 'allow' | 'reject' | 'restrict' | 'log',
3
+ message?: string,
4
+ };
5
+
6
+ export type SignUpRule = {
7
+ enabled: boolean,
8
+ displayName: string | undefined,
9
+ priority: number,
10
+ condition: string | undefined,
11
+ action: SignUpRuleAction,
12
+ };
@@ -0,0 +1,20 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import { yupObject, yupString } from "../../schema-fields";
3
+
4
+ export const svixTokenAdminReadSchema = yupObject({
5
+ token: yupString().defined(),
6
+ url: yupString().optional(),
7
+ }).defined();
8
+
9
+ export const svixTokenAdminCreateSchema = yupObject({}).defined();
10
+
11
+ export const svixTokenCrud = createCrud({
12
+ adminReadSchema: svixTokenAdminReadSchema,
13
+ adminCreateSchema: svixTokenAdminCreateSchema,
14
+ docs: {
15
+ adminCreate: {
16
+ hidden: true,
17
+ },
18
+ }
19
+ });
20
+ export type SvixTokenCrud = CrudTypeOf<typeof svixTokenCrud>;
@@ -0,0 +1,22 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import * as schemaFields from "../../schema-fields";
3
+ import { yupObject } from "../../schema-fields";
4
+
5
+
6
+ export const teamInvitationDetailsClientReadSchema = yupObject({
7
+ team_id: schemaFields.teamIdSchema.defined(),
8
+ team_display_name: schemaFields.teamDisplayNameSchema.defined(),
9
+ }).defined();
10
+
11
+ export const teamInvitationDetailsCrud = createCrud({
12
+ clientReadSchema: teamInvitationDetailsClientReadSchema,
13
+ docs: {
14
+ clientRead: {
15
+ summary: "Get the team details with invitation code",
16
+ description: "",
17
+ tags: ["Teams"],
18
+ },
19
+ },
20
+ });
21
+
22
+ export type TeamInvitationDetailsCrud = CrudTypeOf<typeof teamInvitationDetailsCrud>;
@@ -0,0 +1,35 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import * as schemaFields from "../../schema-fields";
3
+ import { yupObject } from "../../schema-fields";
4
+
5
+ export const teamInvitationDetailsClientReadSchema = yupObject({
6
+ id: schemaFields.yupString().uuid().defined(),
7
+ team_id: schemaFields.teamIdSchema.defined(),
8
+ team_display_name: schemaFields.yupString().defined(),
9
+ expires_at_millis: schemaFields.yupNumber().defined(),
10
+ recipient_email: schemaFields.emailSchema.defined(),
11
+ }).defined();
12
+
13
+ export const teamInvitationCrud = createCrud({
14
+ clientReadSchema: teamInvitationDetailsClientReadSchema,
15
+ clientDeleteSchema: schemaFields.yupMixed(),
16
+ docs: {
17
+ clientRead: {
18
+ summary: "Get the team details with invitation code",
19
+ description: "",
20
+ tags: ["Teams"],
21
+ },
22
+ clientList: {
23
+ summary: "List team invitations",
24
+ description: "",
25
+ tags: ["Teams"],
26
+ },
27
+ clientDelete: {
28
+ summary: "Delete a team invitation",
29
+ description: "",
30
+ tags: ["Teams"],
31
+ },
32
+ },
33
+ });
34
+
35
+ export type TeamInvitationCrud = CrudTypeOf<typeof teamInvitationCrud>;
@@ -0,0 +1,61 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import * as schemaFields from "../../schema-fields";
3
+ import { yupObject } from "../../schema-fields";
4
+ import { usersCrudServerReadSchema } from "./users";
5
+
6
+
7
+ export const teamMemberProfilesCrudClientReadSchema = yupObject({
8
+ team_id: schemaFields.teamIdSchema.defined(),
9
+ user_id: schemaFields.userIdSchema.defined(),
10
+ display_name: schemaFields.teamMemberDisplayNameSchema.nullable().defined(),
11
+ profile_image_url: schemaFields.teamMemberProfileImageUrlSchema.nullable().defined(),
12
+ }).defined();
13
+
14
+ export const teamMemberProfilesCrudServerReadSchema = teamMemberProfilesCrudClientReadSchema.concat(yupObject({
15
+ user: usersCrudServerReadSchema.defined(),
16
+ })).defined();
17
+
18
+ export const teamMemberProfilesCrudClientUpdateSchema = yupObject({
19
+ display_name: schemaFields.teamMemberDisplayNameSchema.optional(),
20
+ profile_image_url: schemaFields.teamMemberProfileImageUrlSchema.nullable().optional(),
21
+ }).defined();
22
+
23
+ export const teamMemberProfilesCrud = createCrud({
24
+ clientReadSchema: teamMemberProfilesCrudClientReadSchema,
25
+ serverReadSchema: teamMemberProfilesCrudServerReadSchema,
26
+ clientUpdateSchema: teamMemberProfilesCrudClientUpdateSchema,
27
+ docs: {
28
+ clientList: {
29
+ summary: "List team members profiles",
30
+ description: "List team members profiles. You always need to specify a `team_id` that your are a member of on the client. You can always filter for your own profile by setting `me` as the `user_id` in the path parameters. If you want list all the profiles in a team, you need to have the `$read_members` permission in that team.",
31
+ tags: ["Teams"],
32
+ },
33
+ serverList: {
34
+ summary: "List team members profiles",
35
+ description: "List team members profiles and filter by team ID and user ID",
36
+ tags: ["Teams"],
37
+ },
38
+ clientRead: {
39
+ summary: "Get a team member profile",
40
+ description: "Get a team member profile. you can always get your own profile by setting `me` as the `user_id` in the path parameters on the client. If you want to get someone else's profile in a team, you need to have the `$read_members` permission in that team.",
41
+ tags: ["Teams"],
42
+ },
43
+ serverRead: {
44
+ summary: "Get a team member profile",
45
+ description: "Get a team member profile by user ID",
46
+ tags: ["Teams"],
47
+ },
48
+ clientUpdate: {
49
+ summary: "Update your team member profile",
50
+ description: "Update your own team member profile. `user_id` must be `me` in the path parameters on the client.",
51
+ tags: ["Teams"],
52
+ },
53
+ serverUpdate: {
54
+ summary: "Update a team member profile",
55
+ description: "Update a team member profile by user ID",
56
+ tags: ["Teams"],
57
+ },
58
+ },
59
+ });
60
+
61
+ export type TeamMemberProfilesCrud = CrudTypeOf<typeof teamMemberProfilesCrud>;
@@ -0,0 +1,56 @@
1
+ import { CrudTypeOf, createCrud } from "../../crud";
2
+ import { yupMixed, yupObject, yupString } from "../../schema-fields";
3
+ import { WebhookEvent } from "../webhooks";
4
+
5
+ export const teamMembershipsCrudClientReadSchema = yupObject({
6
+ team_id: yupString().defined(),
7
+ user_id: yupString().defined(),
8
+ }).defined();
9
+ export const teamMembershipsCrudServerCreateSchema = yupObject({}).defined();
10
+ export const teamMembershipsCrudClientDeleteSchema = yupMixed();
11
+
12
+ export const teamMembershipsCrud = createCrud({
13
+ // Client
14
+ clientReadSchema: teamMembershipsCrudClientReadSchema,
15
+ clientDeleteSchema: teamMembershipsCrudClientDeleteSchema,
16
+ // Server
17
+ serverCreateSchema: teamMembershipsCrudServerCreateSchema,
18
+ docs: {
19
+ serverCreate: {
20
+ summary: "Add a user to a team",
21
+ description: "",
22
+ tags: ["Teams"],
23
+ },
24
+ clientDelete: {
25
+ summary: "Remove a user from a team",
26
+ description: "All the users are allowed to remove themselves from a team (`user_id=me`). Only the users who have the `$remove_members` permission are allowed to remove other users from a team. `team_id` is must an ID of a team that the user is a member of.",
27
+ tags: ["Teams"],
28
+ },
29
+ serverDelete: {
30
+ summary: "Remove a user from a team",
31
+ description: "",
32
+ tags: ["Teams"],
33
+ },
34
+ },
35
+ });
36
+ export type TeamMembershipsCrud = CrudTypeOf<typeof teamMembershipsCrud>;
37
+
38
+ export const teamMembershipCreatedWebhookEvent = {
39
+ type: "team_membership.created",
40
+ schema: teamMembershipsCrud.server.readSchema,
41
+ metadata: {
42
+ summary: "Team Membership Created",
43
+ description: "This event is triggered when a user is added to a team.",
44
+ tags: ["Teams"],
45
+ },
46
+ } satisfies WebhookEvent<typeof teamMembershipsCrud.server.readSchema>;
47
+
48
+ export const teamMembershipDeletedWebhookEvent = {
49
+ type: "team_membership.deleted",
50
+ schema: teamMembershipsCrud.server.readSchema,
51
+ metadata: {
52
+ summary: "Team Membership Deleted",
53
+ description: "This event is triggered when a user is removed from a team.",
54
+ tags: ["Teams"],
55
+ },
56
+ } satisfies WebhookEvent<typeof teamMembershipsCrud.server.readSchema>;