assembly-kit 0.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 (272) hide show
  1. package/CLAUDE.md +205 -0
  2. package/LICENSE +21 -0
  3. package/README.md +516 -0
  4. package/dist/bridge-ui/index.d.mts +4 -0
  5. package/dist/bridge-ui/index.mjs +5 -0
  6. package/dist/bridge-ui/use-actions-menu.d.mts +16 -0
  7. package/dist/bridge-ui/use-actions-menu.mjs +33 -0
  8. package/dist/bridge-ui/use-actions-menu.mjs.map +1 -0
  9. package/dist/bridge-ui/use-primary-cta.d.mts +16 -0
  10. package/dist/bridge-ui/use-primary-cta.mjs +34 -0
  11. package/dist/bridge-ui/use-primary-cta.mjs.map +1 -0
  12. package/dist/bridge-ui/use-secondary-cta.d.mts +16 -0
  13. package/dist/bridge-ui/use-secondary-cta.mjs +34 -0
  14. package/dist/bridge-ui/use-secondary-cta.mjs.map +1 -0
  15. package/dist/client/index.d.mts +108 -0
  16. package/dist/client/index.mjs +168 -0
  17. package/dist/client/index.mjs.map +1 -0
  18. package/dist/client/options.d.mts +40 -0
  19. package/dist/constants/kit-mode.d.mts +15 -0
  20. package/dist/constants/kit-mode.mjs +15 -0
  21. package/dist/constants/kit-mode.mjs.map +1 -0
  22. package/dist/errors/base.d.mts +29 -0
  23. package/dist/errors/base.mjs +16 -0
  24. package/dist/errors/base.mjs.map +1 -0
  25. package/dist/errors/connection.d.mts +12 -0
  26. package/dist/errors/connection.mjs +16 -0
  27. package/dist/errors/connection.mjs.map +1 -0
  28. package/dist/errors/forbidden.d.mts +12 -0
  29. package/dist/errors/forbidden.mjs +16 -0
  30. package/dist/errors/forbidden.mjs.map +1 -0
  31. package/dist/errors/index.d.mts +13 -0
  32. package/dist/errors/index.mjs +13 -0
  33. package/dist/errors/invalid-token.d.mts +12 -0
  34. package/dist/errors/invalid-token.mjs +16 -0
  35. package/dist/errors/invalid-token.mjs.map +1 -0
  36. package/dist/errors/missing-api-key.d.mts +12 -0
  37. package/dist/errors/missing-api-key.mjs +16 -0
  38. package/dist/errors/missing-api-key.mjs.map +1 -0
  39. package/dist/errors/no-token.d.mts +12 -0
  40. package/dist/errors/no-token.mjs +16 -0
  41. package/dist/errors/no-token.mjs.map +1 -0
  42. package/dist/errors/not-found.d.mts +12 -0
  43. package/dist/errors/not-found.mjs +16 -0
  44. package/dist/errors/not-found.mjs.map +1 -0
  45. package/dist/errors/rate-limit.d.mts +17 -0
  46. package/dist/errors/rate-limit.mjs +18 -0
  47. package/dist/errors/rate-limit.mjs.map +1 -0
  48. package/dist/errors/response-parse.d.mts +19 -0
  49. package/dist/errors/response-parse.mjs +23 -0
  50. package/dist/errors/response-parse.mjs.map +1 -0
  51. package/dist/errors/server.d.mts +12 -0
  52. package/dist/errors/server.mjs +16 -0
  53. package/dist/errors/server.mjs.map +1 -0
  54. package/dist/errors/unauthorized.d.mts +12 -0
  55. package/dist/errors/unauthorized.mjs +16 -0
  56. package/dist/errors/unauthorized.mjs.map +1 -0
  57. package/dist/errors/validation.d.mts +12 -0
  58. package/dist/errors/validation.mjs +16 -0
  59. package/dist/errors/validation.mjs.map +1 -0
  60. package/dist/index.d.mts +49 -0
  61. package/dist/index.mjs +51 -0
  62. package/dist/lib/modules/app-connections/resource.d.mts +28 -0
  63. package/dist/lib/modules/app-connections/resource.mjs +33 -0
  64. package/dist/lib/modules/app-connections/resource.mjs.map +1 -0
  65. package/dist/lib/modules/app-connections/schema.d.mts +37 -0
  66. package/dist/lib/modules/app-connections/schema.mjs +30 -0
  67. package/dist/lib/modules/app-connections/schema.mjs.map +1 -0
  68. package/dist/lib/modules/app-installs/resource.d.mts +21 -0
  69. package/dist/lib/modules/app-installs/resource.mjs +31 -0
  70. package/dist/lib/modules/app-installs/resource.mjs.map +1 -0
  71. package/dist/lib/modules/app-installs/schema.d.mts +22 -0
  72. package/dist/lib/modules/app-installs/schema.mjs +23 -0
  73. package/dist/lib/modules/app-installs/schema.mjs.map +1 -0
  74. package/dist/lib/modules/clients/resource.d.mts +43 -0
  75. package/dist/lib/modules/clients/resource.mjs +62 -0
  76. package/dist/lib/modules/clients/resource.mjs.map +1 -0
  77. package/dist/lib/modules/clients/schema.d.mts +50 -0
  78. package/dist/lib/modules/clients/schema.mjs +52 -0
  79. package/dist/lib/modules/clients/schema.mjs.map +1 -0
  80. package/dist/lib/modules/companies/resource.d.mts +37 -0
  81. package/dist/lib/modules/companies/resource.mjs +60 -0
  82. package/dist/lib/modules/companies/resource.mjs.map +1 -0
  83. package/dist/lib/modules/companies/schema.d.mts +39 -0
  84. package/dist/lib/modules/companies/schema.mjs +34 -0
  85. package/dist/lib/modules/companies/schema.mjs.map +1 -0
  86. package/dist/lib/modules/contract-templates/resource.d.mts +27 -0
  87. package/dist/lib/modules/contract-templates/resource.mjs +40 -0
  88. package/dist/lib/modules/contract-templates/resource.mjs.map +1 -0
  89. package/dist/lib/modules/contract-templates/schema.d.mts +21 -0
  90. package/dist/lib/modules/contract-templates/schema.mjs +18 -0
  91. package/dist/lib/modules/contract-templates/schema.mjs.map +1 -0
  92. package/dist/lib/modules/contracts/resource.d.mts +29 -0
  93. package/dist/lib/modules/contracts/resource.mjs +40 -0
  94. package/dist/lib/modules/contracts/resource.mjs.map +1 -0
  95. package/dist/lib/modules/contracts/schema.d.mts +50 -0
  96. package/dist/lib/modules/contracts/schema.mjs +45 -0
  97. package/dist/lib/modules/contracts/schema.mjs.map +1 -0
  98. package/dist/lib/modules/custom-field-options/index.d.mts +1 -0
  99. package/dist/lib/modules/custom-field-options/index.mjs +2 -0
  100. package/dist/lib/modules/custom-field-options/resource.d.mts +22 -0
  101. package/dist/lib/modules/custom-field-options/resource.mjs +25 -0
  102. package/dist/lib/modules/custom-field-options/resource.mjs.map +1 -0
  103. package/dist/lib/modules/custom-field-options/schema.d.mts +18 -0
  104. package/dist/lib/modules/custom-field-options/schema.mjs +13 -0
  105. package/dist/lib/modules/custom-field-options/schema.mjs.map +1 -0
  106. package/dist/lib/modules/custom-fields/resource.d.mts +21 -0
  107. package/dist/lib/modules/custom-fields/resource.mjs +24 -0
  108. package/dist/lib/modules/custom-fields/resource.mjs.map +1 -0
  109. package/dist/lib/modules/custom-fields/schema.d.mts +43 -0
  110. package/dist/lib/modules/custom-fields/schema.mjs +44 -0
  111. package/dist/lib/modules/custom-fields/schema.mjs.map +1 -0
  112. package/dist/lib/modules/events/resource.d.mts +33 -0
  113. package/dist/lib/modules/events/resource.mjs +49 -0
  114. package/dist/lib/modules/events/resource.mjs.map +1 -0
  115. package/dist/lib/modules/events/schema.d.mts +52 -0
  116. package/dist/lib/modules/events/schema.mjs +49 -0
  117. package/dist/lib/modules/events/schema.mjs.map +1 -0
  118. package/dist/lib/modules/file-channels/resource.d.mts +26 -0
  119. package/dist/lib/modules/file-channels/resource.mjs +48 -0
  120. package/dist/lib/modules/file-channels/resource.mjs.map +1 -0
  121. package/dist/lib/modules/file-channels/schema.d.mts +33 -0
  122. package/dist/lib/modules/file-channels/schema.mjs +28 -0
  123. package/dist/lib/modules/file-channels/schema.mjs.map +1 -0
  124. package/dist/lib/modules/files/resource.d.mts +40 -0
  125. package/dist/lib/modules/files/resource.mjs +52 -0
  126. package/dist/lib/modules/files/resource.mjs.map +1 -0
  127. package/dist/lib/modules/files/schema.d.mts +27 -0
  128. package/dist/lib/modules/files/schema.mjs +27 -0
  129. package/dist/lib/modules/files/schema.mjs.map +1 -0
  130. package/dist/lib/modules/form-responses/resource.d.mts +24 -0
  131. package/dist/lib/modules/form-responses/resource.mjs +34 -0
  132. package/dist/lib/modules/form-responses/resource.mjs.map +1 -0
  133. package/dist/lib/modules/form-responses/schema.d.mts +29 -0
  134. package/dist/lib/modules/form-responses/schema.mjs +23 -0
  135. package/dist/lib/modules/form-responses/schema.mjs.map +1 -0
  136. package/dist/lib/modules/forms/resource.d.mts +24 -0
  137. package/dist/lib/modules/forms/resource.mjs +40 -0
  138. package/dist/lib/modules/forms/resource.mjs.map +1 -0
  139. package/dist/lib/modules/forms/schema.d.mts +22 -0
  140. package/dist/lib/modules/forms/schema.mjs +19 -0
  141. package/dist/lib/modules/forms/schema.mjs.map +1 -0
  142. package/dist/lib/modules/index.d.mts +28 -0
  143. package/dist/lib/modules/index.mjs +29 -0
  144. package/dist/lib/modules/internal-users/resource.d.mts +24 -0
  145. package/dist/lib/modules/internal-users/resource.mjs +37 -0
  146. package/dist/lib/modules/internal-users/resource.mjs.map +1 -0
  147. package/dist/lib/modules/internal-users/schema.d.mts +27 -0
  148. package/dist/lib/modules/internal-users/schema.mjs +24 -0
  149. package/dist/lib/modules/internal-users/schema.mjs.map +1 -0
  150. package/dist/lib/modules/invoice-templates/resource.d.mts +22 -0
  151. package/dist/lib/modules/invoice-templates/resource.mjs +32 -0
  152. package/dist/lib/modules/invoice-templates/resource.mjs.map +1 -0
  153. package/dist/lib/modules/invoice-templates/schema.d.mts +21 -0
  154. package/dist/lib/modules/invoice-templates/schema.mjs +18 -0
  155. package/dist/lib/modules/invoice-templates/schema.mjs.map +1 -0
  156. package/dist/lib/modules/invoices/resource.d.mts +30 -0
  157. package/dist/lib/modules/invoices/resource.mjs +48 -0
  158. package/dist/lib/modules/invoices/resource.mjs.map +1 -0
  159. package/dist/lib/modules/invoices/schema.d.mts +81 -0
  160. package/dist/lib/modules/invoices/schema.mjs +75 -0
  161. package/dist/lib/modules/invoices/schema.mjs.map +1 -0
  162. package/dist/lib/modules/message-channels/resource.d.mts +26 -0
  163. package/dist/lib/modules/message-channels/resource.mjs +48 -0
  164. package/dist/lib/modules/message-channels/resource.mjs.map +1 -0
  165. package/dist/lib/modules/message-channels/schema.d.mts +35 -0
  166. package/dist/lib/modules/message-channels/schema.mjs +30 -0
  167. package/dist/lib/modules/message-channels/schema.mjs.map +1 -0
  168. package/dist/lib/modules/messages/resource.d.mts +27 -0
  169. package/dist/lib/modules/messages/resource.mjs +40 -0
  170. package/dist/lib/modules/messages/resource.mjs.map +1 -0
  171. package/dist/lib/modules/messages/schema.d.mts +30 -0
  172. package/dist/lib/modules/messages/schema.mjs +26 -0
  173. package/dist/lib/modules/messages/schema.mjs.map +1 -0
  174. package/dist/lib/modules/notes/resource.d.mts +37 -0
  175. package/dist/lib/modules/notes/resource.mjs +60 -0
  176. package/dist/lib/modules/notes/resource.mjs.map +1 -0
  177. package/dist/lib/modules/notes/schema.d.mts +34 -0
  178. package/dist/lib/modules/notes/schema.mjs +27 -0
  179. package/dist/lib/modules/notes/schema.mjs.map +1 -0
  180. package/dist/lib/modules/notifications/resource.d.mts +27 -0
  181. package/dist/lib/modules/notifications/resource.mjs +52 -0
  182. package/dist/lib/modules/notifications/resource.mjs.map +1 -0
  183. package/dist/lib/modules/notifications/schema.d.mts +52 -0
  184. package/dist/lib/modules/notifications/schema.mjs +43 -0
  185. package/dist/lib/modules/notifications/schema.mjs.map +1 -0
  186. package/dist/lib/modules/payments/resource.d.mts +26 -0
  187. package/dist/lib/modules/payments/resource.mjs +32 -0
  188. package/dist/lib/modules/payments/resource.mjs.map +1 -0
  189. package/dist/lib/modules/payments/schema.d.mts +23 -0
  190. package/dist/lib/modules/payments/schema.mjs +20 -0
  191. package/dist/lib/modules/payments/schema.mjs.map +1 -0
  192. package/dist/lib/modules/prices/resource.d.mts +27 -0
  193. package/dist/lib/modules/prices/resource.mjs +40 -0
  194. package/dist/lib/modules/prices/resource.mjs.map +1 -0
  195. package/dist/lib/modules/prices/schema.d.mts +22 -0
  196. package/dist/lib/modules/prices/schema.mjs +19 -0
  197. package/dist/lib/modules/prices/schema.mjs.map +1 -0
  198. package/dist/lib/modules/products/resource.d.mts +24 -0
  199. package/dist/lib/modules/products/resource.mjs +40 -0
  200. package/dist/lib/modules/products/resource.mjs.map +1 -0
  201. package/dist/lib/modules/products/schema.d.mts +22 -0
  202. package/dist/lib/modules/products/schema.mjs +19 -0
  203. package/dist/lib/modules/products/schema.mjs.map +1 -0
  204. package/dist/lib/modules/subscription-templates/resource.d.mts +22 -0
  205. package/dist/lib/modules/subscription-templates/resource.mjs +32 -0
  206. package/dist/lib/modules/subscription-templates/resource.mjs.map +1 -0
  207. package/dist/lib/modules/subscription-templates/schema.d.mts +21 -0
  208. package/dist/lib/modules/subscription-templates/schema.mjs +18 -0
  209. package/dist/lib/modules/subscription-templates/schema.mjs.map +1 -0
  210. package/dist/lib/modules/subscriptions/resource.d.mts +32 -0
  211. package/dist/lib/modules/subscriptions/resource.mjs +56 -0
  212. package/dist/lib/modules/subscriptions/resource.mjs.map +1 -0
  213. package/dist/lib/modules/subscriptions/schema.d.mts +31 -0
  214. package/dist/lib/modules/subscriptions/schema.mjs +26 -0
  215. package/dist/lib/modules/subscriptions/schema.mjs.map +1 -0
  216. package/dist/lib/modules/task-templates/resource.d.mts +24 -0
  217. package/dist/lib/modules/task-templates/resource.mjs +40 -0
  218. package/dist/lib/modules/task-templates/resource.mjs.map +1 -0
  219. package/dist/lib/modules/task-templates/schema.d.mts +22 -0
  220. package/dist/lib/modules/task-templates/schema.mjs +19 -0
  221. package/dist/lib/modules/task-templates/schema.mjs.map +1 -0
  222. package/dist/lib/modules/tasks/resource.d.mts +38 -0
  223. package/dist/lib/modules/tasks/resource.mjs +60 -0
  224. package/dist/lib/modules/tasks/resource.mjs.map +1 -0
  225. package/dist/lib/modules/tasks/schema.d.mts +45 -0
  226. package/dist/lib/modules/tasks/schema.mjs +43 -0
  227. package/dist/lib/modules/tasks/schema.mjs.map +1 -0
  228. package/dist/lib/modules/workspace/resource.d.mts +19 -0
  229. package/dist/lib/modules/workspace/resource.mjs +23 -0
  230. package/dist/lib/modules/workspace/resource.mjs.map +1 -0
  231. package/dist/lib/modules/workspace/schema.d.mts +23 -0
  232. package/dist/lib/modules/workspace/schema.mjs +21 -0
  233. package/dist/lib/modules/workspace/schema.mjs.map +1 -0
  234. package/dist/lib/pagination/paginate.d.mts +8 -0
  235. package/dist/lib/pagination/paginate.mjs +24 -0
  236. package/dist/lib/pagination/paginate.mjs.map +1 -0
  237. package/dist/logger/index.d.mts +26 -0
  238. package/dist/logger/index.mjs +45 -0
  239. package/dist/logger/index.mjs.map +1 -0
  240. package/dist/schemas/index.d.mts +32 -0
  241. package/dist/schemas/index.mjs +34 -0
  242. package/dist/schemas/shared/hex-color.d.mts +8 -0
  243. package/dist/schemas/shared/hex-color.mjs +7 -0
  244. package/dist/schemas/shared/hex-color.mjs.map +1 -0
  245. package/dist/schemas/shared/index.d.mts +3 -0
  246. package/dist/schemas/shared/index.mjs +4 -0
  247. package/dist/schemas/shared/membership-type.d.mts +9 -0
  248. package/dist/schemas/shared/membership-type.mjs +11 -0
  249. package/dist/schemas/shared/membership-type.mjs.map +1 -0
  250. package/dist/schemas/shared/token.d.mts +22 -0
  251. package/dist/schemas/shared/token.mjs +21 -0
  252. package/dist/schemas/shared/token.mjs.map +1 -0
  253. package/dist/token/assembly-token.d.mts +96 -0
  254. package/dist/token/assembly-token.mjs +117 -0
  255. package/dist/token/assembly-token.mjs.map +1 -0
  256. package/dist/token/crypto.mjs +98 -0
  257. package/dist/token/crypto.mjs.map +1 -0
  258. package/dist/token/index.d.mts +3 -0
  259. package/dist/token/index.mjs +3 -0
  260. package/dist/token/parse.d.mts +24 -0
  261. package/dist/token/parse.mjs +62 -0
  262. package/dist/token/parse.mjs.map +1 -0
  263. package/dist/transport/build-search-params.mjs +16 -0
  264. package/dist/transport/build-search-params.mjs.map +1 -0
  265. package/dist/transport/http.d.mts +14 -0
  266. package/dist/transport/http.mjs +142 -0
  267. package/dist/transport/http.mjs.map +1 -0
  268. package/dist/transport/parse-response.mjs +17 -0
  269. package/dist/transport/parse-response.mjs.map +1 -0
  270. package/dist/version.mjs +7 -0
  271. package/dist/version.mjs.map +1 -0
  272. package/package.json +93 -0
@@ -0,0 +1,34 @@
1
+ import { AssemblyBridge } from "@assembly-js/app-bridge";
2
+ import { useEffect } from "react";
3
+ //#region src/bridge-ui/use-secondary-cta.ts
4
+ /**
5
+ * Registers a secondary CTA button in the Assembly dashboard header.
6
+ *
7
+ * Uses `AssemblyBridge.header.setSecondaryCta()` to set the button and
8
+ * automatically clears it on unmount or page unload.
9
+ *
10
+ * @param cta - Label, icon, and click handler for the secondary CTA.
11
+ * @param show - Whether the CTA is visible. Defaults to true.
12
+ */
13
+ const useSecondaryCta = (cta, show = true) => {
14
+ useEffect(() => {
15
+ if (show) AssemblyBridge.header.setSecondaryCta(cta);
16
+ else AssemblyBridge.header.setSecondaryCta(null);
17
+ return () => {
18
+ AssemblyBridge.header.setSecondaryCta(null);
19
+ };
20
+ }, [cta, show]);
21
+ useEffect(() => {
22
+ const handleUnload = () => {
23
+ AssemblyBridge.header.setSecondaryCta(null);
24
+ };
25
+ addEventListener("beforeunload", handleUnload);
26
+ return () => {
27
+ removeEventListener("beforeunload", handleUnload);
28
+ };
29
+ }, []);
30
+ };
31
+ //#endregion
32
+ export { useSecondaryCta };
33
+
34
+ //# sourceMappingURL=use-secondary-cta.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-secondary-cta.mjs","names":[],"sources":["../../src/bridge-ui/use-secondary-cta.ts"],"sourcesContent":["import { AssemblyBridge } from \"@assembly-js/app-bridge\";\nimport type { CtaConfig } from \"@assembly-js/app-bridge\";\nimport { useEffect } from \"react\";\n\n/**\n * Registers a secondary CTA button in the Assembly dashboard header.\n *\n * Uses `AssemblyBridge.header.setSecondaryCta()` to set the button and\n * automatically clears it on unmount or page unload.\n *\n * @param cta - Label, icon, and click handler for the secondary CTA.\n * @param show - Whether the CTA is visible. Defaults to true.\n */\nexport const useSecondaryCta = (cta: CtaConfig, show = true): void => {\n useEffect(() => {\n if (show) {\n AssemblyBridge.header.setSecondaryCta(cta);\n } else {\n AssemblyBridge.header.setSecondaryCta(null);\n }\n\n return () => {\n AssemblyBridge.header.setSecondaryCta(null);\n };\n }, [cta, show]);\n\n useEffect(() => {\n const handleUnload = (): void => {\n AssemblyBridge.header.setSecondaryCta(null);\n };\n\n addEventListener(\"beforeunload\", handleUnload);\n\n return () => {\n removeEventListener(\"beforeunload\", handleUnload);\n };\n }, []);\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,mBAAmB,KAAgB,OAAO,SAAe;AACpE,iBAAgB;AACd,MAAI,KACF,gBAAe,OAAO,gBAAgB,IAAI;MAE1C,gBAAe,OAAO,gBAAgB,KAAK;AAG7C,eAAa;AACX,kBAAe,OAAO,gBAAgB,KAAK;;IAE5C,CAAC,KAAK,KAAK,CAAC;AAEf,iBAAgB;EACd,MAAM,qBAA2B;AAC/B,kBAAe,OAAO,gBAAgB,KAAK;;AAG7C,mBAAiB,gBAAgB,aAAa;AAE9C,eAAa;AACX,uBAAoB,gBAAgB,aAAa;;IAElD,EAAE,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { AppConnectionsResource } from "../lib/modules/app-connections/resource.mjs";
2
+ import { AppInstallsResource } from "../lib/modules/app-installs/resource.mjs";
3
+ import { ClientsResource } from "../lib/modules/clients/resource.mjs";
4
+ import { CompaniesResource } from "../lib/modules/companies/resource.mjs";
5
+ import { ContractTemplatesResource } from "../lib/modules/contract-templates/resource.mjs";
6
+ import { ContractsResource } from "../lib/modules/contracts/resource.mjs";
7
+ import { CustomFieldOptionsResource } from "../lib/modules/custom-field-options/resource.mjs";
8
+ import { CustomFieldsResource } from "../lib/modules/custom-fields/resource.mjs";
9
+ import { EventsResource } from "../lib/modules/events/resource.mjs";
10
+ import { FileChannelsResource } from "../lib/modules/file-channels/resource.mjs";
11
+ import { FilesResource } from "../lib/modules/files/resource.mjs";
12
+ import { FormResponsesResource } from "../lib/modules/form-responses/resource.mjs";
13
+ import { FormsResource } from "../lib/modules/forms/resource.mjs";
14
+ import { InternalUsersResource } from "../lib/modules/internal-users/resource.mjs";
15
+ import { InvoiceTemplatesResource } from "../lib/modules/invoice-templates/resource.mjs";
16
+ import { InvoicesResource } from "../lib/modules/invoices/resource.mjs";
17
+ import { MessageChannelsResource } from "../lib/modules/message-channels/resource.mjs";
18
+ import { MessagesResource } from "../lib/modules/messages/resource.mjs";
19
+ import { NotesResource } from "../lib/modules/notes/resource.mjs";
20
+ import { NotificationsResource } from "../lib/modules/notifications/resource.mjs";
21
+ import { PaymentsResource } from "../lib/modules/payments/resource.mjs";
22
+ import { PricesResource } from "../lib/modules/prices/resource.mjs";
23
+ import { ProductsResource } from "../lib/modules/products/resource.mjs";
24
+ import { SubscriptionTemplatesResource } from "../lib/modules/subscription-templates/resource.mjs";
25
+ import { SubscriptionsResource } from "../lib/modules/subscriptions/resource.mjs";
26
+ import { TaskTemplatesResource } from "../lib/modules/task-templates/resource.mjs";
27
+ import { TasksResource } from "../lib/modules/tasks/resource.mjs";
28
+ import { WorkspaceResource } from "../lib/modules/workspace/resource.mjs";
29
+ import { AssemblyToken, ClientTokenPayload, InternalUserTokenPayload } from "../token/assembly-token.mjs";
30
+ import { AssemblyKitOptions } from "./options.mjs";
31
+
32
+ //#region src/client/index.d.ts
33
+ /**
34
+ * Create a new `AssemblyKit` instance. Each call produces an independent client
35
+ * with its own HTTP transport, rate limiter, and credentials — safe for
36
+ * multi-workspace and serverless usage.
37
+ *
38
+ * Pass an optional `TClientCustomFields` (and optional `TCompanyCustomFields`)
39
+ * generic to type the `customFields` shape returned from
40
+ * `kit.clients.*` and `kit.companies.*` endpoints.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * // Untyped customFields (default)
45
+ * const kit = createAssemblyKit({ apiKey, workspaceId });
46
+ *
47
+ * // Typed customFields — applies to both clients and companies
48
+ * const kit = createAssemblyKit<{ roles: string[] }>({ apiKey, workspaceId });
49
+ * const c = await kit.clients.retrieve("id"); // c.customFields: { roles: string[] } | null | undefined
50
+ *
51
+ * // Different shapes per resource
52
+ * const kit = createAssemblyKit<
53
+ * { roles: string[] },
54
+ * { industry: string }
55
+ * >({ apiKey, workspaceId });
56
+ * ```
57
+ */
58
+ declare function createAssemblyKit<TClientCustomFields extends Record<string, unknown> = Record<string, unknown>, TCompanyCustomFields extends Record<string, unknown> = TClientCustomFields>(options: AssemblyKitOptions): AssemblyKit<TClientCustomFields, TCompanyCustomFields>;
59
+ /**
60
+ * Assembly SDK client with typed resource namespaces and Zod response validation.
61
+ *
62
+ * Each instance has its own `ky`-based HTTP transport with independent
63
+ * rate limiting, retry, and auth headers. No shared singletons.
64
+ *
65
+ * Generic parameters:
66
+ * - `TClientCustomFields` — shape of `customFields` on Client responses
67
+ * - `TCompanyCustomFields` — shape of `customFields` on Company responses (defaults to `TClientCustomFields`)
68
+ */
69
+ declare class AssemblyKit<TClientCustomFields extends Record<string, unknown> = Record<string, unknown>, TCompanyCustomFields extends Record<string, unknown> = TClientCustomFields> {
70
+ /** The decrypted AssemblyToken instance, or undefined when no token was provided. */
71
+ readonly token: AssemblyToken | undefined;
72
+ readonly appConnections: AppConnectionsResource;
73
+ readonly appInstalls: AppInstallsResource;
74
+ readonly clients: ClientsResource<TClientCustomFields>;
75
+ readonly companies: CompaniesResource<TCompanyCustomFields>;
76
+ readonly contractTemplates: ContractTemplatesResource;
77
+ readonly contracts: ContractsResource;
78
+ readonly customFieldOptions: CustomFieldOptionsResource;
79
+ readonly customFields: CustomFieldsResource;
80
+ readonly events: EventsResource;
81
+ readonly fileChannels: FileChannelsResource;
82
+ readonly files: FilesResource;
83
+ readonly formResponses: FormResponsesResource;
84
+ readonly forms: FormsResource;
85
+ readonly internalUsers: InternalUsersResource;
86
+ readonly invoiceTemplates: InvoiceTemplatesResource;
87
+ readonly invoices: InvoicesResource;
88
+ readonly messageChannels: MessageChannelsResource;
89
+ readonly messages: MessagesResource;
90
+ readonly notes: NotesResource;
91
+ readonly notifications: NotificationsResource;
92
+ readonly payments: PaymentsResource;
93
+ readonly prices: PricesResource;
94
+ readonly products: ProductsResource;
95
+ readonly subscriptionTemplates: SubscriptionTemplatesResource;
96
+ readonly subscriptions: SubscriptionsResource;
97
+ readonly taskTemplates: TaskTemplatesResource;
98
+ readonly tasks: TasksResource;
99
+ readonly workspace: WorkspaceResource;
100
+ constructor(options: AssemblyKitOptions);
101
+ /** Assert that a token was provided and belongs to a client user. */
102
+ ensureIsClient(): ClientTokenPayload;
103
+ /** Assert that a token was provided and belongs to an internal user. */
104
+ ensureIsInternalUser(): InternalUserTokenPayload;
105
+ }
106
+ //#endregion
107
+ export { AssemblyKit, type AssemblyKitOptions, createAssemblyKit };
108
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,168 @@
1
+ import { AssemblyNoTokenError } from "../errors/no-token.mjs";
2
+ import { AppConnectionsResource } from "../lib/modules/app-connections/resource.mjs";
3
+ import { AppInstallsResource } from "../lib/modules/app-installs/resource.mjs";
4
+ import { ClientsResource } from "../lib/modules/clients/resource.mjs";
5
+ import { CompaniesResource } from "../lib/modules/companies/resource.mjs";
6
+ import { ContractTemplatesResource } from "../lib/modules/contract-templates/resource.mjs";
7
+ import { ContractsResource } from "../lib/modules/contracts/resource.mjs";
8
+ import { CustomFieldOptionsResource } from "../lib/modules/custom-field-options/resource.mjs";
9
+ import { CustomFieldsResource } from "../lib/modules/custom-fields/resource.mjs";
10
+ import { EventsResource } from "../lib/modules/events/resource.mjs";
11
+ import { FileChannelsResource } from "../lib/modules/file-channels/resource.mjs";
12
+ import { FilesResource } from "../lib/modules/files/resource.mjs";
13
+ import { FormResponsesResource } from "../lib/modules/form-responses/resource.mjs";
14
+ import { FormsResource } from "../lib/modules/forms/resource.mjs";
15
+ import { InternalUsersResource } from "../lib/modules/internal-users/resource.mjs";
16
+ import { InvoiceTemplatesResource } from "../lib/modules/invoice-templates/resource.mjs";
17
+ import { InvoicesResource } from "../lib/modules/invoices/resource.mjs";
18
+ import { MessageChannelsResource } from "../lib/modules/message-channels/resource.mjs";
19
+ import { MessagesResource } from "../lib/modules/messages/resource.mjs";
20
+ import { NotesResource } from "../lib/modules/notes/resource.mjs";
21
+ import { NotificationsResource } from "../lib/modules/notifications/resource.mjs";
22
+ import { PaymentsResource } from "../lib/modules/payments/resource.mjs";
23
+ import { PricesResource } from "../lib/modules/prices/resource.mjs";
24
+ import { ProductsResource } from "../lib/modules/products/resource.mjs";
25
+ import { SubscriptionTemplatesResource } from "../lib/modules/subscription-templates/resource.mjs";
26
+ import { SubscriptionsResource } from "../lib/modules/subscriptions/resource.mjs";
27
+ import { TaskTemplatesResource } from "../lib/modules/task-templates/resource.mjs";
28
+ import { TasksResource } from "../lib/modules/tasks/resource.mjs";
29
+ import { WorkspaceResource } from "../lib/modules/workspace/resource.mjs";
30
+ import { AssemblyToken } from "../token/assembly-token.mjs";
31
+ import { createTransport } from "../transport/http.mjs";
32
+ import { SDK_VERSION } from "../version.mjs";
33
+ import { KitMode } from "../constants/kit-mode.mjs";
34
+ //#region src/client/index.ts
35
+ /**
36
+ * Create a new `AssemblyKit` instance. Each call produces an independent client
37
+ * with its own HTTP transport, rate limiter, and credentials — safe for
38
+ * multi-workspace and serverless usage.
39
+ *
40
+ * Pass an optional `TClientCustomFields` (and optional `TCompanyCustomFields`)
41
+ * generic to type the `customFields` shape returned from
42
+ * `kit.clients.*` and `kit.companies.*` endpoints.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * // Untyped customFields (default)
47
+ * const kit = createAssemblyKit({ apiKey, workspaceId });
48
+ *
49
+ * // Typed customFields — applies to both clients and companies
50
+ * const kit = createAssemblyKit<{ roles: string[] }>({ apiKey, workspaceId });
51
+ * const c = await kit.clients.retrieve("id"); // c.customFields: { roles: string[] } | null | undefined
52
+ *
53
+ * // Different shapes per resource
54
+ * const kit = createAssemblyKit<
55
+ * { roles: string[] },
56
+ * { industry: string }
57
+ * >({ apiKey, workspaceId });
58
+ * ```
59
+ */
60
+ function createAssemblyKit(options) {
61
+ return new AssemblyKit(options);
62
+ }
63
+ /**
64
+ * Assembly SDK client with typed resource namespaces and Zod response validation.
65
+ *
66
+ * Each instance has its own `ky`-based HTTP transport with independent
67
+ * rate limiting, retry, and auth headers. No shared singletons.
68
+ *
69
+ * Generic parameters:
70
+ * - `TClientCustomFields` — shape of `customFields` on Client responses
71
+ * - `TCompanyCustomFields` — shape of `customFields` on Company responses (defaults to `TClientCustomFields`)
72
+ */
73
+ var AssemblyKit = class {
74
+ /** The decrypted AssemblyToken instance, or undefined when no token was provided. */
75
+ token;
76
+ appConnections;
77
+ appInstalls;
78
+ clients;
79
+ companies;
80
+ contractTemplates;
81
+ contracts;
82
+ customFieldOptions;
83
+ customFields;
84
+ events;
85
+ fileChannels;
86
+ files;
87
+ formResponses;
88
+ forms;
89
+ internalUsers;
90
+ invoiceTemplates;
91
+ invoices;
92
+ messageChannels;
93
+ messages;
94
+ notes;
95
+ notifications;
96
+ payments;
97
+ prices;
98
+ products;
99
+ subscriptionTemplates;
100
+ subscriptions;
101
+ taskTemplates;
102
+ tasks;
103
+ workspace;
104
+ constructor(options) {
105
+ if ((options.kitMode ?? KitMode.Local) === KitMode.Marketplace && !options.token && !options.workspaceId) throw new AssemblyNoTokenError({ message: "Marketplace mode requires either `token` or `workspaceId`." });
106
+ this.token = options.token ? new AssemblyToken({
107
+ token: options.token,
108
+ apiKey: options.apiKey
109
+ }) : void 0;
110
+ let compoundKey;
111
+ if (this.token) compoundKey = this.token.buildCompoundKey({ apiKey: options.apiKey });
112
+ else if (options.workspaceId) compoundKey = `${options.workspaceId}/${options.apiKey}`;
113
+ else compoundKey = options.apiKey;
114
+ const ctx = {
115
+ transport: createTransport({
116
+ baseUrl: options.baseUrl,
117
+ compoundKey,
118
+ fetch: options.fetch,
119
+ requestsPerSecond: options.requestsPerSecond,
120
+ retryCount: options.retryCount,
121
+ sdkVersion: SDK_VERSION
122
+ }),
123
+ validateResponses: options.validateResponses ?? true
124
+ };
125
+ this.appConnections = new AppConnectionsResource(ctx);
126
+ this.appInstalls = new AppInstallsResource(ctx);
127
+ this.clients = new ClientsResource(ctx);
128
+ this.companies = new CompaniesResource(ctx);
129
+ this.contractTemplates = new ContractTemplatesResource(ctx);
130
+ this.contracts = new ContractsResource(ctx);
131
+ this.customFieldOptions = new CustomFieldOptionsResource(ctx);
132
+ this.customFields = new CustomFieldsResource(ctx);
133
+ this.events = new EventsResource(ctx);
134
+ this.fileChannels = new FileChannelsResource(ctx);
135
+ this.files = new FilesResource(ctx);
136
+ this.formResponses = new FormResponsesResource(ctx);
137
+ this.forms = new FormsResource(ctx);
138
+ this.internalUsers = new InternalUsersResource(ctx);
139
+ this.invoiceTemplates = new InvoiceTemplatesResource(ctx);
140
+ this.invoices = new InvoicesResource(ctx);
141
+ this.messageChannels = new MessageChannelsResource(ctx);
142
+ this.messages = new MessagesResource(ctx);
143
+ this.notes = new NotesResource(ctx);
144
+ this.notifications = new NotificationsResource(ctx);
145
+ this.payments = new PaymentsResource(ctx);
146
+ this.prices = new PricesResource(ctx);
147
+ this.products = new ProductsResource(ctx);
148
+ this.subscriptionTemplates = new SubscriptionTemplatesResource(ctx);
149
+ this.subscriptions = new SubscriptionsResource(ctx);
150
+ this.taskTemplates = new TaskTemplatesResource(ctx);
151
+ this.tasks = new TasksResource(ctx);
152
+ this.workspace = new WorkspaceResource(ctx);
153
+ }
154
+ /** Assert that a token was provided and belongs to a client user. */
155
+ ensureIsClient() {
156
+ if (!this.token) throw new AssemblyNoTokenError();
157
+ return this.token.ensureIsClient();
158
+ }
159
+ /** Assert that a token was provided and belongs to an internal user. */
160
+ ensureIsInternalUser() {
161
+ if (!this.token) throw new AssemblyNoTokenError();
162
+ return this.token.ensureIsInternalUser();
163
+ }
164
+ };
165
+ //#endregion
166
+ export { AssemblyKit, createAssemblyKit };
167
+
168
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/client/index.ts"],"sourcesContent":["import { AssemblyNoTokenError } from \"src/errors/no-token\";\nimport { AppConnectionsResource } from \"src/lib/modules/app-connections/resource\";\nimport { AppInstallsResource } from \"src/lib/modules/app-installs/resource\";\nimport { ClientsResource } from \"src/lib/modules/clients/resource\";\nimport { CompaniesResource } from \"src/lib/modules/companies/resource\";\nimport { ContractTemplatesResource } from \"src/lib/modules/contract-templates/resource\";\nimport { ContractsResource } from \"src/lib/modules/contracts/resource\";\nimport { CustomFieldOptionsResource } from \"src/lib/modules/custom-field-options/resource\";\nimport { CustomFieldsResource } from \"src/lib/modules/custom-fields/resource\";\nimport { EventsResource } from \"src/lib/modules/events/resource\";\nimport { FileChannelsResource } from \"src/lib/modules/file-channels/resource\";\nimport { FilesResource } from \"src/lib/modules/files/resource\";\nimport { FormResponsesResource } from \"src/lib/modules/form-responses/resource\";\nimport { FormsResource } from \"src/lib/modules/forms/resource\";\nimport { InternalUsersResource } from \"src/lib/modules/internal-users/resource\";\nimport { InvoiceTemplatesResource } from \"src/lib/modules/invoice-templates/resource\";\nimport { InvoicesResource } from \"src/lib/modules/invoices/resource\";\nimport { MessageChannelsResource } from \"src/lib/modules/message-channels/resource\";\nimport { MessagesResource } from \"src/lib/modules/messages/resource\";\nimport { NotesResource } from \"src/lib/modules/notes/resource\";\nimport { NotificationsResource } from \"src/lib/modules/notifications/resource\";\nimport { PaymentsResource } from \"src/lib/modules/payments/resource\";\nimport { PricesResource } from \"src/lib/modules/prices/resource\";\nimport { ProductsResource } from \"src/lib/modules/products/resource\";\nimport { SubscriptionTemplatesResource } from \"src/lib/modules/subscription-templates/resource\";\nimport { SubscriptionsResource } from \"src/lib/modules/subscriptions/resource\";\nimport { TaskTemplatesResource } from \"src/lib/modules/task-templates/resource\";\nimport { TasksResource } from \"src/lib/modules/tasks/resource\";\nimport { WorkspaceResource } from \"src/lib/modules/workspace/resource\";\nimport {\n AssemblyToken,\n type ClientTokenPayload,\n type InternalUserTokenPayload,\n} from \"src/token/assembly-token\";\nimport { createTransport } from \"src/transport/http\";\nimport { SDK_VERSION } from \"src/version\";\n\nimport { KitMode } from \"src/constants/kit-mode\";\n\nimport type { AssemblyKitOptions } from \"./options\";\n\nexport type { AssemblyKitOptions } from \"./options\";\n\n/**\n * Create a new `AssemblyKit` instance. Each call produces an independent client\n * with its own HTTP transport, rate limiter, and credentials — safe for\n * multi-workspace and serverless usage.\n *\n * Pass an optional `TClientCustomFields` (and optional `TCompanyCustomFields`)\n * generic to type the `customFields` shape returned from\n * `kit.clients.*` and `kit.companies.*` endpoints.\n *\n * @example\n * ```ts\n * // Untyped customFields (default)\n * const kit = createAssemblyKit({ apiKey, workspaceId });\n *\n * // Typed customFields — applies to both clients and companies\n * const kit = createAssemblyKit<{ roles: string[] }>({ apiKey, workspaceId });\n * const c = await kit.clients.retrieve(\"id\"); // c.customFields: { roles: string[] } | null | undefined\n *\n * // Different shapes per resource\n * const kit = createAssemblyKit<\n * { roles: string[] },\n * { industry: string }\n * >({ apiKey, workspaceId });\n * ```\n */\nexport function createAssemblyKit<\n TClientCustomFields extends Record<string, unknown> = Record<string, unknown>,\n TCompanyCustomFields extends Record<string, unknown> = TClientCustomFields,\n>(options: AssemblyKitOptions): AssemblyKit<TClientCustomFields, TCompanyCustomFields> {\n return new AssemblyKit<TClientCustomFields, TCompanyCustomFields>(options);\n}\n\n/**\n * Assembly SDK client with typed resource namespaces and Zod response validation.\n *\n * Each instance has its own `ky`-based HTTP transport with independent\n * rate limiting, retry, and auth headers. No shared singletons.\n *\n * Generic parameters:\n * - `TClientCustomFields` — shape of `customFields` on Client responses\n * - `TCompanyCustomFields` — shape of `customFields` on Company responses (defaults to `TClientCustomFields`)\n */\nexport class AssemblyKit<\n TClientCustomFields extends Record<string, unknown> = Record<string, unknown>,\n TCompanyCustomFields extends Record<string, unknown> = TClientCustomFields,\n> {\n /** The decrypted AssemblyToken instance, or undefined when no token was provided. */\n readonly token: AssemblyToken | undefined;\n readonly appConnections: AppConnectionsResource;\n readonly appInstalls: AppInstallsResource;\n readonly clients: ClientsResource<TClientCustomFields>;\n readonly companies: CompaniesResource<TCompanyCustomFields>;\n readonly contractTemplates: ContractTemplatesResource;\n readonly contracts: ContractsResource;\n readonly customFieldOptions: CustomFieldOptionsResource;\n readonly customFields: CustomFieldsResource;\n readonly events: EventsResource;\n readonly fileChannels: FileChannelsResource;\n readonly files: FilesResource;\n readonly formResponses: FormResponsesResource;\n readonly forms: FormsResource;\n readonly internalUsers: InternalUsersResource;\n readonly invoiceTemplates: InvoiceTemplatesResource;\n readonly invoices: InvoicesResource;\n readonly messageChannels: MessageChannelsResource;\n readonly messages: MessagesResource;\n readonly notes: NotesResource;\n readonly notifications: NotificationsResource;\n readonly payments: PaymentsResource;\n readonly prices: PricesResource;\n readonly products: ProductsResource;\n readonly subscriptionTemplates: SubscriptionTemplatesResource;\n readonly subscriptions: SubscriptionsResource;\n readonly taskTemplates: TaskTemplatesResource;\n readonly tasks: TasksResource;\n readonly workspace: WorkspaceResource;\n\n constructor(options: AssemblyKitOptions) {\n const mode: KitMode = options.kitMode ?? KitMode.Local;\n\n if (mode === KitMode.Marketplace && !options.token && !options.workspaceId) {\n throw new AssemblyNoTokenError({\n message: \"Marketplace mode requires either `token` or `workspaceId`.\",\n });\n }\n\n this.token = options.token\n ? new AssemblyToken({ token: options.token, apiKey: options.apiKey })\n : undefined;\n\n let compoundKey: string;\n if (this.token) {\n compoundKey = this.token.buildCompoundKey({ apiKey: options.apiKey });\n } else if (options.workspaceId) {\n compoundKey = `${options.workspaceId}/${options.apiKey}`;\n } else {\n compoundKey = options.apiKey;\n }\n\n const transport = createTransport({\n baseUrl: options.baseUrl,\n compoundKey,\n fetch: options.fetch,\n requestsPerSecond: options.requestsPerSecond,\n retryCount: options.retryCount,\n sdkVersion: SDK_VERSION,\n });\n\n const validate: boolean = options.validateResponses ?? true;\n const ctx = { transport, validateResponses: validate };\n\n this.appConnections = new AppConnectionsResource(ctx);\n this.appInstalls = new AppInstallsResource(ctx);\n this.clients = new ClientsResource<TClientCustomFields>(ctx);\n this.companies = new CompaniesResource<TCompanyCustomFields>(ctx);\n this.contractTemplates = new ContractTemplatesResource(ctx);\n this.contracts = new ContractsResource(ctx);\n this.customFieldOptions = new CustomFieldOptionsResource(ctx);\n this.customFields = new CustomFieldsResource(ctx);\n this.events = new EventsResource(ctx);\n this.fileChannels = new FileChannelsResource(ctx);\n this.files = new FilesResource(ctx);\n this.formResponses = new FormResponsesResource(ctx);\n this.forms = new FormsResource(ctx);\n this.internalUsers = new InternalUsersResource(ctx);\n this.invoiceTemplates = new InvoiceTemplatesResource(ctx);\n this.invoices = new InvoicesResource(ctx);\n this.messageChannels = new MessageChannelsResource(ctx);\n this.messages = new MessagesResource(ctx);\n this.notes = new NotesResource(ctx);\n this.notifications = new NotificationsResource(ctx);\n this.payments = new PaymentsResource(ctx);\n this.prices = new PricesResource(ctx);\n this.products = new ProductsResource(ctx);\n this.subscriptionTemplates = new SubscriptionTemplatesResource(ctx);\n this.subscriptions = new SubscriptionsResource(ctx);\n this.taskTemplates = new TaskTemplatesResource(ctx);\n this.tasks = new TasksResource(ctx);\n this.workspace = new WorkspaceResource(ctx);\n }\n\n /** Assert that a token was provided and belongs to a client user. */\n ensureIsClient(): ClientTokenPayload {\n if (!this.token) throw new AssemblyNoTokenError();\n return this.token.ensureIsClient();\n }\n\n /** Assert that a token was provided and belongs to an internal user. */\n ensureIsInternalUser(): InternalUserTokenPayload {\n if (!this.token) throw new AssemblyNoTokenError();\n return this.token.ensureIsInternalUser();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,SAAgB,kBAGd,SAAqF;AACrF,QAAO,IAAI,YAAuD,QAAQ;;;;;;;;;;;;AAa5E,IAAa,cAAb,MAGE;;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA6B;AAGvC,OAFsB,QAAQ,WAAW,QAAQ,WAEpC,QAAQ,eAAe,CAAC,QAAQ,SAAS,CAAC,QAAQ,YAC7D,OAAM,IAAI,qBAAqB,EAC7B,SAAS,8DACV,CAAC;AAGJ,OAAK,QAAQ,QAAQ,QACjB,IAAI,cAAc;GAAE,OAAO,QAAQ;GAAO,QAAQ,QAAQ;GAAQ,CAAC,GACnE,KAAA;EAEJ,IAAI;AACJ,MAAI,KAAK,MACP,eAAc,KAAK,MAAM,iBAAiB,EAAE,QAAQ,QAAQ,QAAQ,CAAC;WAC5D,QAAQ,YACjB,eAAc,GAAG,QAAQ,YAAY,GAAG,QAAQ;MAEhD,eAAc,QAAQ;EAaxB,MAAM,MAAM;GAAE,WAVI,gBAAgB;IAChC,SAAS,QAAQ;IACjB;IACA,OAAO,QAAQ;IACf,mBAAmB,QAAQ;IAC3B,YAAY,QAAQ;IACpB,YAAY;IACb,CAGsB;GAAE,mBADC,QAAQ,qBAAqB;GACD;AAEtD,OAAK,iBAAiB,IAAI,uBAAuB,IAAI;AACrD,OAAK,cAAc,IAAI,oBAAoB,IAAI;AAC/C,OAAK,UAAU,IAAI,gBAAqC,IAAI;AAC5D,OAAK,YAAY,IAAI,kBAAwC,IAAI;AACjE,OAAK,oBAAoB,IAAI,0BAA0B,IAAI;AAC3D,OAAK,YAAY,IAAI,kBAAkB,IAAI;AAC3C,OAAK,qBAAqB,IAAI,2BAA2B,IAAI;AAC7D,OAAK,eAAe,IAAI,qBAAqB,IAAI;AACjD,OAAK,SAAS,IAAI,eAAe,IAAI;AACrC,OAAK,eAAe,IAAI,qBAAqB,IAAI;AACjD,OAAK,QAAQ,IAAI,cAAc,IAAI;AACnC,OAAK,gBAAgB,IAAI,sBAAsB,IAAI;AACnD,OAAK,QAAQ,IAAI,cAAc,IAAI;AACnC,OAAK,gBAAgB,IAAI,sBAAsB,IAAI;AACnD,OAAK,mBAAmB,IAAI,yBAAyB,IAAI;AACzD,OAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,OAAK,kBAAkB,IAAI,wBAAwB,IAAI;AACvD,OAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,OAAK,QAAQ,IAAI,cAAc,IAAI;AACnC,OAAK,gBAAgB,IAAI,sBAAsB,IAAI;AACnD,OAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,OAAK,SAAS,IAAI,eAAe,IAAI;AACrC,OAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,OAAK,wBAAwB,IAAI,8BAA8B,IAAI;AACnE,OAAK,gBAAgB,IAAI,sBAAsB,IAAI;AACnD,OAAK,gBAAgB,IAAI,sBAAsB,IAAI;AACnD,OAAK,QAAQ,IAAI,cAAc,IAAI;AACnC,OAAK,YAAY,IAAI,kBAAkB,IAAI;;;CAI7C,iBAAqC;AACnC,MAAI,CAAC,KAAK,MAAO,OAAM,IAAI,sBAAsB;AACjD,SAAO,KAAK,MAAM,gBAAgB;;;CAIpC,uBAAiD;AAC/C,MAAI,CAAC,KAAK,MAAO,OAAM,IAAI,sBAAsB;AACjD,SAAO,KAAK,MAAM,sBAAsB"}
@@ -0,0 +1,40 @@
1
+ import { KitMode } from "../constants/kit-mode.mjs";
2
+
3
+ //#region src/client/options.d.ts
4
+ /**
5
+ * Options for `createAssemblyKit()`.
6
+ *
7
+ * - `kitMode: "local"` (default) → only `apiKey` required. `workspaceId` and `token` are optional.
8
+ * - `kitMode: "marketplace"` → either `token` or `workspaceId` must be provided.
9
+ * - When `token` is provided, compound key is built from the decrypted token payload.
10
+ * - When only `workspaceId` is provided, compound key is `workspaceId/apiKey`.
11
+ * - When neither is provided (local mode), compound key is just `apiKey`.
12
+ */
13
+ interface AssemblyKitOptions {
14
+ /** Assembly API key. */
15
+ apiKey: string;
16
+ /** Encrypted token from Assembly. */
17
+ token?: string;
18
+ /** Workspace ID. Optional — used to build compound key when token is not provided. */
19
+ workspaceId?: string;
20
+ /**
21
+ * App mode.
22
+ * - `"local"` — only `apiKey` required. `workspaceId` and `token` optional.
23
+ * - `"marketplace"` — either `token` or `workspaceId` required.
24
+ * @default "local"
25
+ */
26
+ kitMode?: KitMode;
27
+ /** When true, API responses are validated through Zod schemas. @default true */
28
+ validateResponses?: boolean;
29
+ /** Base URL for all API requests. @default "https://api.assembly.com" */
30
+ baseUrl?: string;
31
+ /** Number of retry attempts for retryable errors. @default 2 */
32
+ retryCount?: number;
33
+ /** Maximum requests per second for the rate limiter. @default 20 */
34
+ requestsPerSecond?: number;
35
+ /** Injectable fetch function for testing. Defaults to global fetch. */
36
+ fetch?: typeof globalThis.fetch;
37
+ }
38
+ //#endregion
39
+ export { AssemblyKitOptions };
40
+ //# sourceMappingURL=options.d.mts.map
@@ -0,0 +1,15 @@
1
+ //#region src/constants/kit-mode.d.ts
2
+ /**
3
+ * App mode for `createAssemblyKit()`.
4
+ *
5
+ * - `"local"` — regular custom apps built for specific workspaces. `workspaceId` is required, `token` is optional.
6
+ * - `"marketplace"` — marketplace apps installable by any consumer. Either `token` or `workspaceId` is required.
7
+ */
8
+ declare const KitMode: {
9
+ readonly Local: "local";
10
+ readonly Marketplace: "marketplace";
11
+ };
12
+ type KitMode = (typeof KitMode)[keyof typeof KitMode];
13
+ //#endregion
14
+ export { KitMode };
15
+ //# sourceMappingURL=kit-mode.d.mts.map
@@ -0,0 +1,15 @@
1
+ //#region src/constants/kit-mode.ts
2
+ /**
3
+ * App mode for `createAssemblyKit()`.
4
+ *
5
+ * - `"local"` — regular custom apps built for specific workspaces. `workspaceId` is required, `token` is optional.
6
+ * - `"marketplace"` — marketplace apps installable by any consumer. Either `token` or `workspaceId` is required.
7
+ */
8
+ const KitMode = {
9
+ Local: "local",
10
+ Marketplace: "marketplace"
11
+ };
12
+ //#endregion
13
+ export { KitMode };
14
+
15
+ //# sourceMappingURL=kit-mode.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit-mode.mjs","names":[],"sources":["../../src/constants/kit-mode.ts"],"sourcesContent":["/**\n * App mode for `createAssemblyKit()`.\n *\n * - `\"local\"` — regular custom apps built for specific workspaces. `workspaceId` is required, `token` is optional.\n * - `\"marketplace\"` — marketplace apps installable by any consumer. Either `token` or `workspaceId` is required.\n */\nexport const KitMode = {\n Local: \"local\",\n Marketplace: \"marketplace\",\n} as const;\n\nexport type KitMode = (typeof KitMode)[keyof typeof KitMode];\n"],"mappings":";;;;;;;AAMA,MAAa,UAAU;CACrB,OAAO;CACP,aAAa;CACd"}
@@ -0,0 +1,29 @@
1
+ //#region src/errors/base.d.ts
2
+ interface AssemblyErrorOptions {
3
+ /**
4
+ * Override the default message for this error class.
5
+ * Each subclass provides a sensible default, so this is rarely needed.
6
+ */
7
+ message?: string;
8
+ /** The original error that caused this one, forwarded to native Error.cause. */
9
+ cause?: unknown;
10
+ /** Arbitrary extra context (e.g. raw response body) for debugging. */
11
+ details?: unknown;
12
+ }
13
+ interface AssemblyBaseErrorInit extends AssemblyErrorOptions {
14
+ message: string;
15
+ statusCode: number;
16
+ }
17
+ declare class AssemblyError extends Error {
18
+ readonly statusCode: number;
19
+ readonly details?: unknown;
20
+ constructor({
21
+ message,
22
+ statusCode,
23
+ cause,
24
+ details
25
+ }: AssemblyBaseErrorInit);
26
+ }
27
+ //#endregion
28
+ export { AssemblyError, AssemblyErrorOptions };
29
+ //# sourceMappingURL=base.d.mts.map
@@ -0,0 +1,16 @@
1
+ //#region src/errors/base.ts
2
+ var AssemblyError = class extends Error {
3
+ statusCode;
4
+ details;
5
+ constructor({ message, statusCode, cause, details }) {
6
+ super(message, { cause });
7
+ this.name = "AssemblyError";
8
+ this.statusCode = statusCode;
9
+ this.details = details;
10
+ Object.setPrototypeOf(this, new.target.prototype);
11
+ }
12
+ };
13
+ //#endregion
14
+ export { AssemblyError };
15
+
16
+ //# sourceMappingURL=base.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.mjs","names":[],"sources":["../../src/errors/base.ts"],"sourcesContent":["export interface AssemblyErrorOptions {\n /**\n * Override the default message for this error class.\n * Each subclass provides a sensible default, so this is rarely needed.\n */\n message?: string;\n /** The original error that caused this one, forwarded to native Error.cause. */\n cause?: unknown;\n /** Arbitrary extra context (e.g. raw response body) for debugging. */\n details?: unknown;\n}\n\ninterface AssemblyBaseErrorInit extends AssemblyErrorOptions {\n message: string;\n statusCode: number;\n}\n\nexport class AssemblyError extends Error {\n readonly statusCode: number;\n readonly details?: unknown;\n\n constructor({ message, statusCode, cause, details }: AssemblyBaseErrorInit) {\n super(message, { cause });\n this.name = \"AssemblyError\";\n this.statusCode = statusCode;\n this.details = details;\n // Maintains proper prototype chain in environments that transpile to ES5\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n"],"mappings":";AAiBA,IAAa,gBAAb,cAAmC,MAAM;CACvC;CACA;CAEA,YAAY,EAAE,SAAS,YAAY,OAAO,WAAkC;AAC1E,QAAM,SAAS,EAAE,OAAO,CAAC;AACzB,OAAK,OAAO;AACZ,OAAK,aAAa;AAClB,OAAK,UAAU;AAEf,SAAO,eAAe,MAAM,IAAI,OAAO,UAAU"}
@@ -0,0 +1,12 @@
1
+ import { AssemblyError, AssemblyErrorOptions } from "./base.mjs";
2
+
3
+ //#region src/errors/connection.d.ts
4
+ declare class AssemblyConnectionError extends AssemblyError {
5
+ constructor({
6
+ message,
7
+ ...rest
8
+ }?: AssemblyErrorOptions);
9
+ }
10
+ //#endregion
11
+ export { AssemblyConnectionError };
12
+ //# sourceMappingURL=connection.d.mts.map
@@ -0,0 +1,16 @@
1
+ import { AssemblyError } from "./base.mjs";
2
+ //#region src/errors/connection.ts
3
+ var AssemblyConnectionError = class extends AssemblyError {
4
+ constructor({ message, ...rest } = {}) {
5
+ super({
6
+ message: message ?? "A network error occurred while connecting to the Assembly API",
7
+ statusCode: 503,
8
+ ...rest
9
+ });
10
+ this.name = "AssemblyConnectionError";
11
+ }
12
+ };
13
+ //#endregion
14
+ export { AssemblyConnectionError };
15
+
16
+ //# sourceMappingURL=connection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.mjs","names":[],"sources":["../../src/errors/connection.ts"],"sourcesContent":["import type { AssemblyErrorOptions } from \"src/errors/base\";\nimport { AssemblyError } from \"src/errors/base\";\n\nexport class AssemblyConnectionError extends AssemblyError {\n constructor({ message, ...rest }: AssemblyErrorOptions = {}) {\n super({\n message: message ?? \"A network error occurred while connecting to the Assembly API\",\n statusCode: 503,\n ...rest,\n });\n this.name = \"AssemblyConnectionError\";\n }\n}\n"],"mappings":";;AAGA,IAAa,0BAAb,cAA6C,cAAc;CACzD,YAAY,EAAE,SAAS,GAAG,SAA+B,EAAE,EAAE;AAC3D,QAAM;GACJ,SAAS,WAAW;GACpB,YAAY;GACZ,GAAG;GACJ,CAAC;AACF,OAAK,OAAO"}
@@ -0,0 +1,12 @@
1
+ import { AssemblyError, AssemblyErrorOptions } from "./base.mjs";
2
+
3
+ //#region src/errors/forbidden.d.ts
4
+ declare class AssemblyForbiddenError extends AssemblyError {
5
+ constructor({
6
+ message,
7
+ ...rest
8
+ }?: AssemblyErrorOptions);
9
+ }
10
+ //#endregion
11
+ export { AssemblyForbiddenError };
12
+ //# sourceMappingURL=forbidden.d.mts.map
@@ -0,0 +1,16 @@
1
+ import { AssemblyError } from "./base.mjs";
2
+ //#region src/errors/forbidden.ts
3
+ var AssemblyForbiddenError = class extends AssemblyError {
4
+ constructor({ message, ...rest } = {}) {
5
+ super({
6
+ message: message ?? "Forbidden: the API key lacks permission to perform this action",
7
+ statusCode: 403,
8
+ ...rest
9
+ });
10
+ this.name = "AssemblyForbiddenError";
11
+ }
12
+ };
13
+ //#endregion
14
+ export { AssemblyForbiddenError };
15
+
16
+ //# sourceMappingURL=forbidden.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidden.mjs","names":[],"sources":["../../src/errors/forbidden.ts"],"sourcesContent":["import { AssemblyError } from \"src/errors/base\";\nimport type { AssemblyErrorOptions } from \"src/errors/base\";\n\nexport class AssemblyForbiddenError extends AssemblyError {\n constructor({ message, ...rest }: AssemblyErrorOptions = {}) {\n super({\n message: message ?? \"Forbidden: the API key lacks permission to perform this action\",\n statusCode: 403,\n ...rest,\n });\n this.name = \"AssemblyForbiddenError\";\n }\n}\n"],"mappings":";;AAGA,IAAa,yBAAb,cAA4C,cAAc;CACxD,YAAY,EAAE,SAAS,GAAG,SAA+B,EAAE,EAAE;AAC3D,QAAM;GACJ,SAAS,WAAW;GACpB,YAAY;GACZ,GAAG;GACJ,CAAC;AACF,OAAK,OAAO"}
@@ -0,0 +1,13 @@
1
+ import { AssemblyError, AssemblyErrorOptions } from "./base.mjs";
2
+ import { AssemblyConnectionError } from "./connection.mjs";
3
+ import { AssemblyForbiddenError } from "./forbidden.mjs";
4
+ import { AssemblyInvalidTokenError } from "./invalid-token.mjs";
5
+ import { AssemblyMissingApiKeyError } from "./missing-api-key.mjs";
6
+ import { AssemblyNoTokenError } from "./no-token.mjs";
7
+ import { AssemblyNotFoundError } from "./not-found.mjs";
8
+ import { AssemblyRateLimitError, AssemblyRateLimitErrorOptions } from "./rate-limit.mjs";
9
+ import { AssemblyResponseParseError, AssemblyResponseParseErrorOptions } from "./response-parse.mjs";
10
+ import { AssemblyServerError } from "./server.mjs";
11
+ import { AssemblyUnauthorizedError } from "./unauthorized.mjs";
12
+ import { AssemblyValidationError } from "./validation.mjs";
13
+ export { AssemblyConnectionError, AssemblyError, type AssemblyErrorOptions, AssemblyForbiddenError, AssemblyInvalidTokenError, AssemblyMissingApiKeyError, AssemblyNoTokenError, AssemblyNotFoundError, AssemblyRateLimitError, type AssemblyRateLimitErrorOptions, AssemblyResponseParseError, type AssemblyResponseParseErrorOptions, AssemblyServerError, AssemblyUnauthorizedError, AssemblyValidationError };
@@ -0,0 +1,13 @@
1
+ import { AssemblyError } from "./base.mjs";
2
+ import { AssemblyNoTokenError } from "./no-token.mjs";
3
+ import { AssemblyResponseParseError } from "./response-parse.mjs";
4
+ import { AssemblyInvalidTokenError } from "./invalid-token.mjs";
5
+ import { AssemblyUnauthorizedError } from "./unauthorized.mjs";
6
+ import { AssemblyConnectionError } from "./connection.mjs";
7
+ import { AssemblyForbiddenError } from "./forbidden.mjs";
8
+ import { AssemblyNotFoundError } from "./not-found.mjs";
9
+ import { AssemblyRateLimitError } from "./rate-limit.mjs";
10
+ import { AssemblyServerError } from "./server.mjs";
11
+ import { AssemblyValidationError } from "./validation.mjs";
12
+ import { AssemblyMissingApiKeyError } from "./missing-api-key.mjs";
13
+ export { AssemblyConnectionError, AssemblyError, AssemblyForbiddenError, AssemblyInvalidTokenError, AssemblyMissingApiKeyError, AssemblyNoTokenError, AssemblyNotFoundError, AssemblyRateLimitError, AssemblyResponseParseError, AssemblyServerError, AssemblyUnauthorizedError, AssemblyValidationError };
@@ -0,0 +1,12 @@
1
+ import { AssemblyError, AssemblyErrorOptions } from "./base.mjs";
2
+
3
+ //#region src/errors/invalid-token.d.ts
4
+ declare class AssemblyInvalidTokenError extends AssemblyError {
5
+ constructor({
6
+ message,
7
+ ...rest
8
+ }?: AssemblyErrorOptions);
9
+ }
10
+ //#endregion
11
+ export { AssemblyInvalidTokenError };
12
+ //# sourceMappingURL=invalid-token.d.mts.map
@@ -0,0 +1,16 @@
1
+ import { AssemblyError } from "./base.mjs";
2
+ //#region src/errors/invalid-token.ts
3
+ var AssemblyInvalidTokenError = class extends AssemblyError {
4
+ constructor({ message, ...rest } = {}) {
5
+ super({
6
+ message: message ?? "The provided token could not be decrypted or has an invalid payload",
7
+ statusCode: 401,
8
+ ...rest
9
+ });
10
+ this.name = "AssemblyInvalidTokenError";
11
+ }
12
+ };
13
+ //#endregion
14
+ export { AssemblyInvalidTokenError };
15
+
16
+ //# sourceMappingURL=invalid-token.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-token.mjs","names":[],"sources":["../../src/errors/invalid-token.ts"],"sourcesContent":["import { AssemblyError } from \"src/errors/base\";\nimport type { AssemblyErrorOptions } from \"src/errors/base\";\n\nexport class AssemblyInvalidTokenError extends AssemblyError {\n constructor({ message, ...rest }: AssemblyErrorOptions = {}) {\n super({\n message: message ?? \"The provided token could not be decrypted or has an invalid payload\",\n statusCode: 401,\n ...rest,\n });\n this.name = \"AssemblyInvalidTokenError\";\n }\n}\n"],"mappings":";;AAGA,IAAa,4BAAb,cAA+C,cAAc;CAC3D,YAAY,EAAE,SAAS,GAAG,SAA+B,EAAE,EAAE;AAC3D,QAAM;GACJ,SAAS,WAAW;GACpB,YAAY;GACZ,GAAG;GACJ,CAAC;AACF,OAAK,OAAO"}
@@ -0,0 +1,12 @@
1
+ import { AssemblyError, AssemblyErrorOptions } from "./base.mjs";
2
+
3
+ //#region src/errors/missing-api-key.d.ts
4
+ declare class AssemblyMissingApiKeyError extends AssemblyError {
5
+ constructor({
6
+ message,
7
+ ...rest
8
+ }?: AssemblyErrorOptions);
9
+ }
10
+ //#endregion
11
+ export { AssemblyMissingApiKeyError };
12
+ //# sourceMappingURL=missing-api-key.d.mts.map
@@ -0,0 +1,16 @@
1
+ import { AssemblyError } from "./base.mjs";
2
+ //#region src/errors/missing-api-key.ts
3
+ var AssemblyMissingApiKeyError = class extends AssemblyError {
4
+ constructor({ message, ...rest } = {}) {
5
+ super({
6
+ message: message ?? "Assembly API key is missing or empty",
7
+ statusCode: 400,
8
+ ...rest
9
+ });
10
+ this.name = "AssemblyMissingApiKeyError";
11
+ }
12
+ };
13
+ //#endregion
14
+ export { AssemblyMissingApiKeyError };
15
+
16
+ //# sourceMappingURL=missing-api-key.mjs.map