assembly-kit 0.0.4 → 0.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 (102) hide show
  1. package/CLAUDE.md +33 -30
  2. package/README.md +37 -30
  3. package/dist/client/index.d.mts +6 -0
  4. package/dist/client/index.mjs +9 -0
  5. package/dist/client/index.mjs.map +1 -1
  6. package/dist/index.d.mts +14 -11
  7. package/dist/index.mjs +14 -11
  8. package/dist/lib/modules/app-installs/resource.d.mts +13 -1
  9. package/dist/lib/modules/app-installs/resource.mjs +25 -1
  10. package/dist/lib/modules/app-installs/resource.mjs.map +1 -1
  11. package/dist/lib/modules/app-installs/schema.d.mts +47 -1
  12. package/dist/lib/modules/app-installs/schema.mjs +37 -1
  13. package/dist/lib/modules/app-installs/schema.mjs.map +1 -1
  14. package/dist/lib/modules/clients/resource.d.mts +3 -1
  15. package/dist/lib/modules/clients/resource.mjs +9 -1
  16. package/dist/lib/modules/clients/resource.mjs.map +1 -1
  17. package/dist/lib/modules/clients/schema.d.mts +11 -3
  18. package/dist/lib/modules/clients/schema.mjs +12 -4
  19. package/dist/lib/modules/clients/schema.mjs.map +1 -1
  20. package/dist/lib/modules/companies/resource.d.mts +7 -1
  21. package/dist/lib/modules/companies/resource.mjs +10 -1
  22. package/dist/lib/modules/companies/resource.mjs.map +1 -1
  23. package/dist/lib/modules/companies/schema.d.mts +18 -1
  24. package/dist/lib/modules/companies/schema.mjs +13 -1
  25. package/dist/lib/modules/companies/schema.mjs.map +1 -1
  26. package/dist/lib/modules/custom-fields/resource.d.mts +3 -1
  27. package/dist/lib/modules/custom-fields/resource.mjs +9 -1
  28. package/dist/lib/modules/custom-fields/resource.mjs.map +1 -1
  29. package/dist/lib/modules/custom-fields/schema.d.mts +19 -1
  30. package/dist/lib/modules/custom-fields/schema.mjs +9 -1
  31. package/dist/lib/modules/custom-fields/schema.mjs.map +1 -1
  32. package/dist/lib/modules/files/resource.d.mts +15 -1
  33. package/dist/lib/modules/files/resource.mjs +29 -1
  34. package/dist/lib/modules/files/resource.mjs.map +1 -1
  35. package/dist/lib/modules/files/schema.d.mts +15 -1
  36. package/dist/lib/modules/files/schema.mjs +8 -1
  37. package/dist/lib/modules/files/schema.mjs.map +1 -1
  38. package/dist/lib/modules/forms/resource.d.mts +15 -1
  39. package/dist/lib/modules/forms/resource.mjs +25 -0
  40. package/dist/lib/modules/forms/resource.mjs.map +1 -1
  41. package/dist/lib/modules/forms/schema.d.mts +35 -1
  42. package/dist/lib/modules/forms/schema.mjs +40 -1
  43. package/dist/lib/modules/forms/schema.mjs.map +1 -1
  44. package/dist/lib/modules/index.d.mts +13 -10
  45. package/dist/lib/modules/index.mjs +3 -0
  46. package/dist/lib/modules/internal-users/resource.d.mts +8 -1
  47. package/dist/lib/modules/internal-users/resource.mjs +17 -1
  48. package/dist/lib/modules/internal-users/resource.mjs.map +1 -1
  49. package/dist/lib/modules/internal-users/schema.d.mts +22 -1
  50. package/dist/lib/modules/internal-users/schema.mjs +22 -1
  51. package/dist/lib/modules/internal-users/schema.mjs.map +1 -1
  52. package/dist/lib/modules/invoices/schema.d.mts +1 -1
  53. package/dist/lib/modules/invoices/schema.mjs +1 -0
  54. package/dist/lib/modules/invoices/schema.mjs.map +1 -1
  55. package/dist/lib/modules/me/resource.d.mts +19 -0
  56. package/dist/lib/modules/me/resource.mjs +23 -0
  57. package/dist/lib/modules/me/resource.mjs.map +1 -0
  58. package/dist/lib/modules/me/schema.d.mts +15 -0
  59. package/dist/lib/modules/me/schema.mjs +13 -0
  60. package/dist/lib/modules/me/schema.mjs.map +1 -0
  61. package/dist/lib/modules/message-channels/resource.d.mts +5 -1
  62. package/dist/lib/modules/message-channels/resource.mjs +9 -1
  63. package/dist/lib/modules/message-channels/resource.mjs.map +1 -1
  64. package/dist/lib/modules/message-channels/schema.d.mts +10 -1
  65. package/dist/lib/modules/message-channels/schema.mjs +7 -1
  66. package/dist/lib/modules/message-channels/schema.mjs.map +1 -1
  67. package/dist/lib/modules/notifications/resource.d.mts +2 -0
  68. package/dist/lib/modules/notifications/resource.mjs +8 -0
  69. package/dist/lib/modules/notifications/resource.mjs.map +1 -1
  70. package/dist/lib/modules/prices/resource.d.mts +3 -1
  71. package/dist/lib/modules/prices/resource.mjs +8 -0
  72. package/dist/lib/modules/prices/resource.mjs.map +1 -1
  73. package/dist/lib/modules/prices/schema.d.mts +14 -1
  74. package/dist/lib/modules/prices/schema.mjs +19 -1
  75. package/dist/lib/modules/prices/schema.mjs.map +1 -1
  76. package/dist/lib/modules/products/resource.d.mts +3 -1
  77. package/dist/lib/modules/products/resource.mjs +8 -0
  78. package/dist/lib/modules/products/resource.mjs.map +1 -1
  79. package/dist/lib/modules/products/schema.d.mts +7 -1
  80. package/dist/lib/modules/products/schema.mjs +6 -1
  81. package/dist/lib/modules/products/schema.mjs.map +1 -1
  82. package/dist/lib/modules/refunds/resource.d.mts +27 -0
  83. package/dist/lib/modules/refunds/resource.mjs +40 -0
  84. package/dist/lib/modules/refunds/resource.mjs.map +1 -0
  85. package/dist/lib/modules/refunds/schema.d.mts +35 -0
  86. package/dist/lib/modules/refunds/schema.mjs +32 -0
  87. package/dist/lib/modules/refunds/schema.mjs.map +1 -0
  88. package/dist/lib/modules/task-comments/resource.d.mts +29 -0
  89. package/dist/lib/modules/task-comments/resource.mjs +44 -0
  90. package/dist/lib/modules/task-comments/resource.mjs.map +1 -0
  91. package/dist/lib/modules/task-comments/schema.d.mts +24 -0
  92. package/dist/lib/modules/task-comments/schema.mjs +21 -0
  93. package/dist/lib/modules/task-comments/schema.mjs.map +1 -0
  94. package/dist/lib/modules/tasks/schema.d.mts +1 -1
  95. package/dist/lib/modules/tasks/schema.mjs +1 -1
  96. package/dist/lib/modules/tasks/schema.mjs.map +1 -1
  97. package/dist/schemas/index.d.mts +14 -11
  98. package/dist/schemas/index.mjs +14 -11
  99. package/dist/transport/http.d.mts +2 -0
  100. package/dist/transport/http.mjs +1 -0
  101. package/dist/transport/http.mjs.map +1 -1
  102. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import { buildSearchParams } from "../../../transport/build-search-params.mjs";
2
2
  import { parseResponse } from "../../../transport/parse-response.mjs";
3
3
  import { paginate } from "../../pagination/paginate.mjs";
4
- import { AssemblyFileResponseSchema, AssemblyFilesResponseSchema } from "./schema.mjs";
4
+ import { AssemblyFileResponseSchema, AssemblyFilesResponseSchema, FileDownloadUrlResponseSchema, FilePermissionsResponseSchema } from "./schema.mjs";
5
5
  //#region src/lib/modules/files/resource.ts
6
6
  var FilesResource = class {
7
7
  #transport;
@@ -34,6 +34,34 @@ var FilesResource = class {
34
34
  validate: this.#validate
35
35
  });
36
36
  }
37
+ /** Retrieve a short-lived presigned download URL for a file's contents. */
38
+ async retrieveDownloadUrl(id) {
39
+ return parseResponse({
40
+ schema: FileDownloadUrlResponseSchema,
41
+ data: await this.#transport.get(`v1/files/${id}/download-url`),
42
+ validate: this.#validate
43
+ });
44
+ }
45
+ /** Download a file's raw contents. */
46
+ async download(id) {
47
+ return this.#transport.getRaw(`v1/files/${id}/download`);
48
+ }
49
+ /** Update the client access level on a folder. */
50
+ async updateFolderPermissions(args) {
51
+ return parseResponse({
52
+ schema: FilePermissionsResponseSchema,
53
+ data: await this.#transport.put(`v1/files/${args.id}/permissions/`, { clientPermissions: args.clientPermissions }),
54
+ validate: this.#validate
55
+ });
56
+ }
57
+ /** Update the client access level on a file channel's root folder. */
58
+ async updateRootFolderPermissions(args) {
59
+ return parseResponse({
60
+ schema: FilePermissionsResponseSchema,
61
+ data: await this.#transport.put("v1/files/root/permissions", args),
62
+ validate: this.#validate
63
+ });
64
+ }
37
65
  /** Delete a file by ID. */
38
66
  async delete(id) {
39
67
  await this.#transport.delete(`v1/files/${id}`);
@@ -1 +1 @@
1
- {"version":3,"file":"resource.mjs","names":["#transport","#validate"],"sources":["../../../../src/lib/modules/files/resource.ts"],"sourcesContent":["import { paginate } from \"src/lib/pagination\";\nimport type { ListArgs } from \"src/lib/pagination\";\nimport { buildSearchParams } from \"src/transport/build-search-params\";\nimport type { Transport } from \"src/transport/http\";\nimport { parseResponse } from \"src/transport/parse-response\";\n\nimport { AssemblyFileResponseSchema, AssemblyFilesResponseSchema } from \"./schema\";\nimport type { AssemblyFile, AssemblyFilesResponse } from \"./schema\";\n\nexport interface ListFilesArgs extends ListArgs {\n channelId: string;\n path?: string;\n}\n\nexport class FilesResource {\n readonly #transport: Transport;\n readonly #validate: boolean;\n\n constructor({\n transport,\n validateResponses,\n }: {\n transport: Transport;\n validateResponses: boolean;\n }) {\n this.#transport = transport;\n this.#validate = validateResponses;\n }\n\n /** Create a file, folder, or link. */\n async create(args: {\n fileType: string;\n body: {\n channelId: string;\n clientPermissions?: \"read_write\" | \"read_only\";\n linkUrl?: string;\n path: string;\n };\n }): Promise<AssemblyFile> {\n const raw: unknown = await this.#transport.post(`v1/files/${args.fileType}`, args.body);\n return parseResponse({\n schema: AssemblyFileResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** List files in a channel. */\n async list(args: ListFilesArgs): Promise<AssemblyFilesResponse> {\n const raw: unknown = await this.#transport.get(\"v1/files\", {\n searchParams: buildSearchParams(args),\n });\n return parseResponse({\n schema: AssemblyFilesResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Retrieve a single file by ID. */\n async retrieve(id: string): Promise<AssemblyFile> {\n const raw: unknown = await this.#transport.get(`v1/files/${id}`);\n return parseResponse({\n schema: AssemblyFileResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Delete a file by ID. */\n async delete(id: string): Promise<void> {\n await this.#transport.delete(`v1/files/${id}`);\n }\n\n /** Iterate over all files in a channel, automatically paginating. Default limit per page: 500. */\n async listAll(args: Omit<ListFilesArgs, \"nextToken\">): Promise<AssemblyFile[]> {\n return paginate((listArgs) => this.list({ ...args, ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n}\n"],"mappings":";;;;;AAcA,IAAa,gBAAb,MAA2B;CACzB;CACA;CAEA,YAAY,EACV,WACA,qBAIC;AACD,QAAA,YAAkB;AAClB,QAAA,WAAiB;;;CAInB,MAAM,OAAO,MAQa;AAExB,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,KAAK,YAAY,KAAK,YAAY,KAAK,KAAK;GAIrF,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,KAAK,MAAqD;AAI9D,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MALmB,MAAA,UAAgB,IAAI,YAAY,EACzD,cAAc,kBAAkB,KAAK,EACtC,CAAC;GAIA,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,SAAS,IAAmC;AAEhD,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,YAAY,KAAK;GAI9D,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,OAAO,IAA2B;AACtC,QAAM,MAAA,UAAgB,OAAO,YAAY,KAAK;;;CAIhD,MAAM,QAAQ,MAAiE;AAC7E,SAAO,UAAU,aAAa,KAAK,KAAK;GAAE,GAAG;GAAM,GAAG;GAAU,CAAC,EAAE,EACjE,OAAO,KAAK,SAAS,KACtB,CAAC"}
1
+ {"version":3,"file":"resource.mjs","names":["#transport","#validate"],"sources":["../../../../src/lib/modules/files/resource.ts"],"sourcesContent":["import { paginate } from \"src/lib/pagination\";\nimport type { ListArgs } from \"src/lib/pagination\";\nimport { buildSearchParams } from \"src/transport/build-search-params\";\nimport type { Transport } from \"src/transport/http\";\nimport { parseResponse } from \"src/transport/parse-response\";\n\nimport {\n AssemblyFileResponseSchema,\n AssemblyFilesResponseSchema,\n FileDownloadUrlResponseSchema,\n FilePermissionsResponseSchema,\n} from \"./schema\";\nimport type {\n AssemblyFile,\n AssemblyFilesResponse,\n ClientPermissions,\n FileDownloadUrlResponse,\n FilePermissionsResponse,\n} from \"./schema\";\n\nexport interface ListFilesArgs extends ListArgs {\n channelId: string;\n path?: string;\n}\n\nexport class FilesResource {\n readonly #transport: Transport;\n readonly #validate: boolean;\n\n constructor({\n transport,\n validateResponses,\n }: {\n transport: Transport;\n validateResponses: boolean;\n }) {\n this.#transport = transport;\n this.#validate = validateResponses;\n }\n\n /** Create a file, folder, or link. */\n async create(args: {\n fileType: string;\n body: {\n channelId: string;\n clientPermissions?: \"read_write\" | \"read_only\";\n linkUrl?: string;\n path: string;\n };\n }): Promise<AssemblyFile> {\n const raw: unknown = await this.#transport.post(`v1/files/${args.fileType}`, args.body);\n return parseResponse({\n schema: AssemblyFileResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** List files in a channel. */\n async list(args: ListFilesArgs): Promise<AssemblyFilesResponse> {\n const raw: unknown = await this.#transport.get(\"v1/files\", {\n searchParams: buildSearchParams(args),\n });\n return parseResponse({\n schema: AssemblyFilesResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Retrieve a single file by ID. */\n async retrieve(id: string): Promise<AssemblyFile> {\n const raw: unknown = await this.#transport.get(`v1/files/${id}`);\n return parseResponse({\n schema: AssemblyFileResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Retrieve a short-lived presigned download URL for a file's contents. */\n async retrieveDownloadUrl(id: string): Promise<FileDownloadUrlResponse> {\n const raw: unknown = await this.#transport.get(`v1/files/${id}/download-url`);\n return parseResponse({\n schema: FileDownloadUrlResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Download a file's raw contents. */\n async download(id: string): Promise<ArrayBuffer> {\n return this.#transport.getRaw(`v1/files/${id}/download`);\n }\n\n /** Update the client access level on a folder. */\n async updateFolderPermissions(args: {\n id: string;\n clientPermissions: ClientPermissions;\n }): Promise<FilePermissionsResponse> {\n const raw: unknown = await this.#transport.put(`v1/files/${args.id}/permissions/`, {\n clientPermissions: args.clientPermissions,\n });\n return parseResponse({\n schema: FilePermissionsResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Update the client access level on a file channel's root folder. */\n async updateRootFolderPermissions(args: {\n channelId: string;\n clientPermissions: ClientPermissions;\n }): Promise<FilePermissionsResponse> {\n const raw: unknown = await this.#transport.put(\"v1/files/root/permissions\", args);\n return parseResponse({\n schema: FilePermissionsResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Delete a file by ID. */\n async delete(id: string): Promise<void> {\n await this.#transport.delete(`v1/files/${id}`);\n }\n\n /** Iterate over all files in a channel, automatically paginating. Default limit per page: 500. */\n async listAll(args: Omit<ListFilesArgs, \"nextToken\">): Promise<AssemblyFile[]> {\n return paginate((listArgs) => this.list({ ...args, ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n}\n"],"mappings":";;;;;AAyBA,IAAa,gBAAb,MAA2B;CACzB;CACA;CAEA,YAAY,EACV,WACA,qBAIC;AACD,QAAA,YAAkB;AAClB,QAAA,WAAiB;;;CAInB,MAAM,OAAO,MAQa;AAExB,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,KAAK,YAAY,KAAK,YAAY,KAAK,KAAK;GAIrF,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,KAAK,MAAqD;AAI9D,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MALmB,MAAA,UAAgB,IAAI,YAAY,EACzD,cAAc,kBAAkB,KAAK,EACtC,CAAC;GAIA,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,SAAS,IAAmC;AAEhD,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,YAAY,KAAK;GAI9D,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,oBAAoB,IAA8C;AAEtE,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,YAAY,GAAG,eAAe;GAI3E,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,SAAS,IAAkC;AAC/C,SAAO,MAAA,UAAgB,OAAO,YAAY,GAAG,WAAW;;;CAI1D,MAAM,wBAAwB,MAGO;AAInC,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MALmB,MAAA,UAAgB,IAAI,YAAY,KAAK,GAAG,gBAAgB,EACjF,mBAAmB,KAAK,mBACzB,CAAC;GAIA,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,4BAA4B,MAGG;AAEnC,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,6BAA6B,KAAK;GAI/E,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,OAAO,IAA2B;AACtC,QAAM,MAAA,UAAgB,OAAO,YAAY,KAAK;;;CAIhD,MAAM,QAAQ,MAAiE;AAC7E,SAAO,UAAU,aAAa,KAAK,KAAK;GAAE,GAAG;GAAM,GAAG;GAAU,CAAC,EAAE,EACjE,OAAO,KAAK,SAAS,KACtB,CAAC"}
@@ -22,6 +22,20 @@ interface AssemblyFilesResponse {
22
22
  nextToken?: string;
23
23
  }
24
24
  declare const AssemblyFilesResponseSchema: z.ZodType<AssemblyFilesResponse>;
25
+ type ClientPermissions = "read_only" | "read_write";
26
+ /**
27
+ * The OpenAPI spec declares this enum as the single string "read_only read_write";
28
+ * the two documented values are modelled separately here.
29
+ */
30
+ declare const ClientPermissionsSchema: z.ZodType<ClientPermissions>;
31
+ interface FilePermissionsResponse {
32
+ success?: boolean;
33
+ }
34
+ declare const FilePermissionsResponseSchema: z.ZodType<FilePermissionsResponse>;
35
+ interface FileDownloadUrlResponse {
36
+ downloadUrl: string;
37
+ }
38
+ declare const FileDownloadUrlResponseSchema: z.ZodType<FileDownloadUrlResponse>;
25
39
  //#endregion
26
- export { AssemblyFile, AssemblyFileResponse, AssemblyFileResponseSchema, AssemblyFileSchema, AssemblyFilesResponse, AssemblyFilesResponseSchema, FileType, FileTypeSchema };
40
+ export { AssemblyFile, AssemblyFileResponse, AssemblyFileResponseSchema, AssemblyFileSchema, AssemblyFilesResponse, AssemblyFilesResponseSchema, ClientPermissions, ClientPermissionsSchema, FileDownloadUrlResponse, FileDownloadUrlResponseSchema, FilePermissionsResponse, FilePermissionsResponseSchema, FileType, FileTypeSchema };
27
41
  //# sourceMappingURL=schema.d.mts.map
@@ -21,7 +21,14 @@ const AssemblyFilesResponseSchema = z.object({
21
21
  data: z.array(AssemblyFileSchema).nullable(),
22
22
  nextToken: z.string().optional()
23
23
  });
24
+ /**
25
+ * The OpenAPI spec declares this enum as the single string "read_only read_write";
26
+ * the two documented values are modelled separately here.
27
+ */
28
+ const ClientPermissionsSchema = z.enum(["read_only", "read_write"]);
29
+ const FilePermissionsResponseSchema = z.object({ success: z.boolean().optional() });
30
+ const FileDownloadUrlResponseSchema = z.object({ downloadUrl: z.string() });
24
31
  //#endregion
25
- export { AssemblyFileResponseSchema, AssemblyFileSchema, AssemblyFilesResponseSchema, FileTypeSchema };
32
+ export { AssemblyFileResponseSchema, AssemblyFileSchema, AssemblyFilesResponseSchema, ClientPermissionsSchema, FileDownloadUrlResponseSchema, FilePermissionsResponseSchema, FileTypeSchema };
26
33
 
27
34
  //# sourceMappingURL=schema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/lib/modules/files/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Base types\n// ---------------------------------------------------------------------------\n\nexport type FileType = \"file\" | \"folder\" | \"link\";\n\nexport const FileTypeSchema: z.ZodType<FileType> = z.enum([\"file\", \"folder\", \"link\"]);\n\nexport interface AssemblyFile {\n channelId?: string;\n createdAt: string;\n fileType?: FileType;\n id: string;\n name?: string;\n object: \"file\";\n path?: string;\n updatedAt?: string;\n url?: string;\n}\n\nexport const AssemblyFileSchema: z.ZodType<AssemblyFile> = z.object({\n channelId: z.string().optional(),\n createdAt: z.iso.datetime(),\n fileType: FileTypeSchema.optional(),\n id: z.string(),\n name: z.string().optional(),\n object: z.literal(\"file\"),\n path: z.string().optional(),\n updatedAt: z.iso.datetime().optional(),\n url: z.string().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Response types\n// ---------------------------------------------------------------------------\n\nexport const AssemblyFileResponseSchema: z.ZodType<AssemblyFile> = AssemblyFileSchema;\nexport type AssemblyFileResponse = AssemblyFile;\n\nexport interface AssemblyFilesResponse {\n data: AssemblyFile[] | null;\n nextToken?: string;\n}\n\nexport const AssemblyFilesResponseSchema: z.ZodType<AssemblyFilesResponse> = z.object({\n data: z.array(AssemblyFileSchema).nullable(),\n nextToken: z.string().optional(),\n});\n"],"mappings":";;AAQA,MAAa,iBAAsC,EAAE,KAAK;CAAC;CAAQ;CAAU;CAAO,CAAC;AAcrF,MAAa,qBAA8C,EAAE,OAAO;CAClE,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,WAAW,EAAE,IAAI,UAAU;CAC3B,UAAU,eAAe,UAAU;CACnC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,QAAQ,OAAO;CACzB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,WAAW,EAAE,IAAI,UAAU,CAAC,UAAU;CACtC,KAAK,EAAE,QAAQ,CAAC,UAAU;CAC3B,CAAC;AAMF,MAAa,6BAAsD;AAQnE,MAAa,8BAAgE,EAAE,OAAO;CACpF,MAAM,EAAE,MAAM,mBAAmB,CAAC,UAAU;CAC5C,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC"}
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/lib/modules/files/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Base types\n// ---------------------------------------------------------------------------\n\nexport type FileType = \"file\" | \"folder\" | \"link\";\n\nexport const FileTypeSchema: z.ZodType<FileType> = z.enum([\"file\", \"folder\", \"link\"]);\n\nexport interface AssemblyFile {\n channelId?: string;\n createdAt: string;\n fileType?: FileType;\n id: string;\n name?: string;\n object: \"file\";\n path?: string;\n updatedAt?: string;\n url?: string;\n}\n\nexport const AssemblyFileSchema: z.ZodType<AssemblyFile> = z.object({\n channelId: z.string().optional(),\n createdAt: z.iso.datetime(),\n fileType: FileTypeSchema.optional(),\n id: z.string(),\n name: z.string().optional(),\n object: z.literal(\"file\"),\n path: z.string().optional(),\n updatedAt: z.iso.datetime().optional(),\n url: z.string().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Response types\n// ---------------------------------------------------------------------------\n\nexport const AssemblyFileResponseSchema: z.ZodType<AssemblyFile> = AssemblyFileSchema;\nexport type AssemblyFileResponse = AssemblyFile;\n\nexport interface AssemblyFilesResponse {\n data: AssemblyFile[] | null;\n nextToken?: string;\n}\n\nexport const AssemblyFilesResponseSchema: z.ZodType<AssemblyFilesResponse> = z.object({\n data: z.array(AssemblyFileSchema).nullable(),\n nextToken: z.string().optional(),\n});\n\n// ─── Permissions ──────────────────────────────────────────────────────────────\n\nexport type ClientPermissions = \"read_only\" | \"read_write\";\n\n/**\n * The OpenAPI spec declares this enum as the single string \"read_only read_write\";\n * the two documented values are modelled separately here.\n */\nexport const ClientPermissionsSchema: z.ZodType<ClientPermissions> = z.enum([\n \"read_only\",\n \"read_write\",\n]);\n\nexport interface FilePermissionsResponse {\n success?: boolean;\n}\n\nexport const FilePermissionsResponseSchema: z.ZodType<FilePermissionsResponse> = z.object({\n success: z.boolean().optional(),\n});\n\n// ─── Download ─────────────────────────────────────────────────────────────────\n\nexport interface FileDownloadUrlResponse {\n downloadUrl: string;\n}\n\nexport const FileDownloadUrlResponseSchema: z.ZodType<FileDownloadUrlResponse> = z.object({\n downloadUrl: z.string(),\n});\n"],"mappings":";;AAQA,MAAa,iBAAsC,EAAE,KAAK;CAAC;CAAQ;CAAU;CAAO,CAAC;AAcrF,MAAa,qBAA8C,EAAE,OAAO;CAClE,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,WAAW,EAAE,IAAI,UAAU;CAC3B,UAAU,eAAe,UAAU;CACnC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,QAAQ,OAAO;CACzB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,WAAW,EAAE,IAAI,UAAU,CAAC,UAAU;CACtC,KAAK,EAAE,QAAQ,CAAC,UAAU;CAC3B,CAAC;AAMF,MAAa,6BAAsD;AAQnE,MAAa,8BAAgE,EAAE,OAAO;CACpF,MAAM,EAAE,MAAM,mBAAmB,CAAC,UAAU;CAC5C,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC;;;;;AAUF,MAAa,0BAAwD,EAAE,KAAK,CAC1E,aACA,aACD,CAAC;AAMF,MAAa,gCAAoE,EAAE,OAAO,EACxF,SAAS,EAAE,SAAS,CAAC,UAAU,EAChC,CAAC;AAQF,MAAa,gCAAoE,EAAE,OAAO,EACxF,aAAa,EAAE,QAAQ,EACxB,CAAC"}
@@ -1,8 +1,12 @@
1
1
  import { Transport } from "../../../transport/http.mjs";
2
2
  import { ListArgs } from "../../pagination/paginate.mjs";
3
- import { Form, FormsDataResponse } from "./schema.mjs";
3
+ import { FormResponse, FormResponsesResponse } from "../form-responses/schema.mjs";
4
+ import { Form, FormCreateRequest, FormsDataResponse } from "./schema.mjs";
4
5
 
5
6
  //#region src/lib/modules/forms/resource.d.ts
7
+ interface ListFormSubmissionsArgs extends ListArgs {
8
+ status?: "completed" | "pending";
9
+ }
6
10
  declare class FormsResource {
7
11
  #private;
8
12
  constructor({
@@ -12,10 +16,20 @@ declare class FormsResource {
12
16
  transport: Transport;
13
17
  validateResponses: boolean;
14
18
  });
19
+ /** Create a form with its questions. */
20
+ create(body: FormCreateRequest): Promise<Form>;
15
21
  /** List forms. */
16
22
  list(args?: ListArgs): Promise<FormsDataResponse>;
17
23
  /** Retrieve a single form by ID. */
18
24
  retrieve(id: string): Promise<Form>;
25
+ /** List a form's submissions (form responses). */
26
+ listSubmissions(args: ListFormSubmissionsArgs & {
27
+ id: string;
28
+ }): Promise<FormResponsesResponse>;
29
+ /** Iterate over all of a form's submissions, automatically paginating. Default limit per page: 500. */
30
+ listAllSubmissions(args: Omit<ListFormSubmissionsArgs, "nextToken"> & {
31
+ id: string;
32
+ }): Promise<FormResponse[]>;
19
33
  /** Iterate over all forms, automatically paginating. Default limit per page: 500. */
20
34
  listAll(args?: Omit<ListArgs, "nextToken">): Promise<Form[]>;
21
35
  }
@@ -1,6 +1,7 @@
1
1
  import { buildSearchParams } from "../../../transport/build-search-params.mjs";
2
2
  import { parseResponse } from "../../../transport/parse-response.mjs";
3
3
  import { paginate } from "../../pagination/paginate.mjs";
4
+ import { FormResponsesResponseSchema } from "../form-responses/schema.mjs";
4
5
  import { FormDataResponseSchema, FormsDataResponseSchema } from "./schema.mjs";
5
6
  //#region src/lib/modules/forms/resource.ts
6
7
  var FormsResource = class {
@@ -10,6 +11,14 @@ var FormsResource = class {
10
11
  this.#transport = transport;
11
12
  this.#validate = validateResponses;
12
13
  }
14
+ /** Create a form with its questions. */
15
+ async create(body) {
16
+ return parseResponse({
17
+ schema: FormDataResponseSchema,
18
+ data: await this.#transport.post("v1/forms", body),
19
+ validate: this.#validate
20
+ });
21
+ }
13
22
  /** List forms. */
14
23
  async list(args = {}) {
15
24
  return parseResponse({
@@ -26,6 +35,22 @@ var FormsResource = class {
26
35
  validate: this.#validate
27
36
  });
28
37
  }
38
+ /** List a form's submissions (form responses). */
39
+ async listSubmissions(args) {
40
+ const { id, ...filters } = args;
41
+ return parseResponse({
42
+ schema: FormResponsesResponseSchema,
43
+ data: await this.#transport.get(`v1/forms/${id}/form-responses`, { searchParams: buildSearchParams(filters) }),
44
+ validate: this.#validate
45
+ });
46
+ }
47
+ /** Iterate over all of a form's submissions, automatically paginating. Default limit per page: 500. */
48
+ async listAllSubmissions(args) {
49
+ return paginate((listArgs) => this.listSubmissions({
50
+ ...args,
51
+ ...listArgs
52
+ }), { limit: args.limit ?? 500 });
53
+ }
29
54
  /** Iterate over all forms, automatically paginating. Default limit per page: 500. */
30
55
  async listAll(args = {}) {
31
56
  return paginate((listArgs) => this.list({
@@ -1 +1 @@
1
- {"version":3,"file":"resource.mjs","names":["#transport","#validate"],"sources":["../../../../src/lib/modules/forms/resource.ts"],"sourcesContent":["import { paginate } from \"src/lib/pagination\";\nimport type { ListArgs } from \"src/lib/pagination\";\nimport { buildSearchParams } from \"src/transport/build-search-params\";\nimport type { Transport } from \"src/transport/http\";\nimport { parseResponse } from \"src/transport/parse-response\";\n\nimport { FormDataResponseSchema, FormsDataResponseSchema } from \"./schema\";\nimport type { Form, FormsDataResponse } from \"./schema\";\n\nexport class FormsResource {\n readonly #transport: Transport;\n readonly #validate: boolean;\n\n constructor({\n transport,\n validateResponses,\n }: {\n transport: Transport;\n validateResponses: boolean;\n }) {\n this.#transport = transport;\n this.#validate = validateResponses;\n }\n\n /** List forms. */\n async list(args: ListArgs = {}): Promise<FormsDataResponse> {\n const raw: unknown = await this.#transport.get(\"v1/forms\", {\n searchParams: buildSearchParams(args),\n });\n return parseResponse({ schema: FormsDataResponseSchema, data: raw, validate: this.#validate });\n }\n\n /** Retrieve a single form by ID. */\n async retrieve(id: string): Promise<Form> {\n const raw: unknown = await this.#transport.get(`v1/forms/${id}`);\n return parseResponse({ schema: FormDataResponseSchema, data: raw, validate: this.#validate });\n }\n\n /** Iterate over all forms, automatically paginating. Default limit per page: 500. */\n async listAll(args: Omit<ListArgs, \"nextToken\"> = {}): Promise<Form[]> {\n return paginate((listArgs) => this.list({ ...args, ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n}\n"],"mappings":";;;;;AASA,IAAa,gBAAb,MAA2B;CACzB;CACA;CAEA,YAAY,EACV,WACA,qBAIC;AACD,QAAA,YAAkB;AAClB,QAAA,WAAiB;;;CAInB,MAAM,KAAK,OAAiB,EAAE,EAA8B;AAI1D,SAAO,cAAc;GAAE,QAAQ;GAAyB,MAAM,MAHnC,MAAA,UAAgB,IAAI,YAAY,EACzD,cAAc,kBAAkB,KAAK,EACtC,CAAC;GACiE,UAAU,MAAA;GAAgB,CAAC;;;CAIhG,MAAM,SAAS,IAA2B;AAExC,SAAO,cAAc;GAAE,QAAQ;GAAwB,MAAM,MADlC,MAAA,UAAgB,IAAI,YAAY,KAAK;GACE,UAAU,MAAA;GAAgB,CAAC;;;CAI/F,MAAM,QAAQ,OAAoC,EAAE,EAAmB;AACrE,SAAO,UAAU,aAAa,KAAK,KAAK;GAAE,GAAG;GAAM,GAAG;GAAU,CAAC,EAAE,EACjE,OAAO,KAAK,SAAS,KACtB,CAAC"}
1
+ {"version":3,"file":"resource.mjs","names":["#transport","#validate"],"sources":["../../../../src/lib/modules/forms/resource.ts"],"sourcesContent":["import { paginate } from \"src/lib/pagination\";\nimport type { ListArgs } from \"src/lib/pagination\";\nimport { buildSearchParams } from \"src/transport/build-search-params\";\nimport type { Transport } from \"src/transport/http\";\nimport { parseResponse } from \"src/transport/parse-response\";\n\nimport { FormResponsesResponseSchema } from \"../form-responses/schema\";\nimport type { FormResponse, FormResponsesResponse } from \"../form-responses/schema\";\n\nimport { FormDataResponseSchema, FormsDataResponseSchema } from \"./schema\";\nimport type { Form, FormCreateRequest, FormsDataResponse } from \"./schema\";\n\nexport interface ListFormSubmissionsArgs extends ListArgs {\n status?: \"completed\" | \"pending\";\n}\n\nexport class FormsResource {\n readonly #transport: Transport;\n readonly #validate: boolean;\n\n constructor({\n transport,\n validateResponses,\n }: {\n transport: Transport;\n validateResponses: boolean;\n }) {\n this.#transport = transport;\n this.#validate = validateResponses;\n }\n\n /** Create a form with its questions. */\n async create(body: FormCreateRequest): Promise<Form> {\n const raw: unknown = await this.#transport.post(\"v1/forms\", body);\n return parseResponse({ schema: FormDataResponseSchema, data: raw, validate: this.#validate });\n }\n\n /** List forms. */\n async list(args: ListArgs = {}): Promise<FormsDataResponse> {\n const raw: unknown = await this.#transport.get(\"v1/forms\", {\n searchParams: buildSearchParams(args),\n });\n return parseResponse({ schema: FormsDataResponseSchema, data: raw, validate: this.#validate });\n }\n\n /** Retrieve a single form by ID. */\n async retrieve(id: string): Promise<Form> {\n const raw: unknown = await this.#transport.get(`v1/forms/${id}`);\n return parseResponse({ schema: FormDataResponseSchema, data: raw, validate: this.#validate });\n }\n\n /** List a form's submissions (form responses). */\n async listSubmissions(\n args: ListFormSubmissionsArgs & { id: string },\n ): Promise<FormResponsesResponse> {\n const { id, ...filters } = args;\n const raw: unknown = await this.#transport.get(`v1/forms/${id}/form-responses`, {\n searchParams: buildSearchParams(filters),\n });\n return parseResponse({\n schema: FormResponsesResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Iterate over all of a form's submissions, automatically paginating. Default limit per page: 500. */\n async listAllSubmissions(\n args: Omit<ListFormSubmissionsArgs, \"nextToken\"> & { id: string },\n ): Promise<FormResponse[]> {\n return paginate((listArgs) => this.listSubmissions({ ...args, ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n\n /** Iterate over all forms, automatically paginating. Default limit per page: 500. */\n async listAll(args: Omit<ListArgs, \"nextToken\"> = {}): Promise<Form[]> {\n return paginate((listArgs) => this.list({ ...args, ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n}\n"],"mappings":";;;;;;AAgBA,IAAa,gBAAb,MAA2B;CACzB;CACA;CAEA,YAAY,EACV,WACA,qBAIC;AACD,QAAA,YAAkB;AAClB,QAAA,WAAiB;;;CAInB,MAAM,OAAO,MAAwC;AAEnD,SAAO,cAAc;GAAE,QAAQ;GAAwB,MAAM,MADlC,MAAA,UAAgB,KAAK,YAAY,KAAK;GACC,UAAU,MAAA;GAAgB,CAAC;;;CAI/F,MAAM,KAAK,OAAiB,EAAE,EAA8B;AAI1D,SAAO,cAAc;GAAE,QAAQ;GAAyB,MAAM,MAHnC,MAAA,UAAgB,IAAI,YAAY,EACzD,cAAc,kBAAkB,KAAK,EACtC,CAAC;GACiE,UAAU,MAAA;GAAgB,CAAC;;;CAIhG,MAAM,SAAS,IAA2B;AAExC,SAAO,cAAc;GAAE,QAAQ;GAAwB,MAAM,MADlC,MAAA,UAAgB,IAAI,YAAY,KAAK;GACE,UAAU,MAAA;GAAgB,CAAC;;;CAI/F,MAAM,gBACJ,MACgC;EAChC,MAAM,EAAE,IAAI,GAAG,YAAY;AAI3B,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MALmB,MAAA,UAAgB,IAAI,YAAY,GAAG,kBAAkB,EAC9E,cAAc,kBAAkB,QAAQ,EACzC,CAAC;GAIA,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,mBACJ,MACyB;AACzB,SAAO,UAAU,aAAa,KAAK,gBAAgB;GAAE,GAAG;GAAM,GAAG;GAAU,CAAC,EAAE,EAC5E,OAAO,KAAK,SAAS,KACtB,CAAC;;;CAIJ,MAAM,QAAQ,OAAoC,EAAE,EAAmB;AACrE,SAAO,UAAU,aAAa,KAAK,KAAK;GAAE,GAAG;GAAM,GAAG;GAAU,CAAC,EAAE,EACjE,OAAO,KAAK,SAAS,KACtB,CAAC"}
@@ -1,8 +1,37 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  //#region src/lib/modules/forms/schema.d.ts
4
+ type FormFieldType = "date" | "dropdown" | "email" | "fileUpload" | "longAnswer" | "multiSelect" | "phoneNumber" | "shortAnswer" | "singleSelect" | "title";
5
+ declare const FormFieldTypeSchema: z.ZodType<FormFieldType>;
6
+ type FormVisibility = "allClients" | "requestedClients";
7
+ declare const FormVisibilitySchema: z.ZodType<FormVisibility>;
8
+ interface FormField {
9
+ formFieldId?: string;
10
+ hasOtherOption?: boolean;
11
+ isRequired?: boolean;
12
+ multipleChoiceOptions?: string[];
13
+ title?: string;
14
+ type?: FormFieldType;
15
+ }
16
+ declare const FormFieldSchema: z.ZodType<FormField>;
17
+ interface FormFields {
18
+ allowMultipleSubmissions?: boolean;
19
+ formFieldIds?: string[];
20
+ formFields?: FormField[];
21
+ name?: string;
22
+ visibility?: FormVisibility;
23
+ }
24
+ declare const FormFieldsSchema: z.ZodType<FormFields>;
25
+ interface FormAdditionalFields {
26
+ formResponseRequests?: number;
27
+ formResponseSubmissions?: number;
28
+ latestSubmissionDate?: string;
29
+ }
30
+ declare const FormAdditionalFieldsSchema: z.ZodType<FormAdditionalFields>;
4
31
  interface Form {
32
+ additionalFields?: FormAdditionalFields;
5
33
  createdAt: string;
34
+ fields?: FormFields;
6
35
  id: string;
7
36
  latestSubmissionDate?: string | null;
8
37
  name?: string;
@@ -17,6 +46,11 @@ interface FormsDataResponse {
17
46
  nextToken?: string;
18
47
  }
19
48
  declare const FormsDataResponseSchema: z.ZodType<FormsDataResponse>;
49
+ interface FormCreateRequest {
50
+ additionalFields: FormAdditionalFields;
51
+ fields: FormFields;
52
+ }
53
+ declare const FormCreateRequestSchema: z.ZodType<FormCreateRequest>;
20
54
  //#endregion
21
- export { Form, FormDataResponse, FormDataResponseSchema, FormSchema, FormsDataResponse, FormsDataResponseSchema };
55
+ export { Form, FormAdditionalFields, FormAdditionalFieldsSchema, FormCreateRequest, FormCreateRequestSchema, FormDataResponse, FormDataResponseSchema, FormField, FormFieldSchema, FormFieldType, FormFieldTypeSchema, FormFields, FormFieldsSchema, FormSchema, FormVisibility, FormVisibilitySchema, FormsDataResponse, FormsDataResponseSchema };
22
56
  //# sourceMappingURL=schema.d.mts.map
@@ -1,7 +1,42 @@
1
1
  import { z } from "zod";
2
2
  //#region src/lib/modules/forms/schema.ts
3
+ const FormFieldTypeSchema = z.enum([
4
+ "shortAnswer",
5
+ "longAnswer",
6
+ "singleSelect",
7
+ "multiSelect",
8
+ "title",
9
+ "fileUpload",
10
+ "phoneNumber",
11
+ "email",
12
+ "date",
13
+ "dropdown"
14
+ ]);
15
+ const FormVisibilitySchema = z.enum(["requestedClients", "allClients"]);
16
+ const FormFieldSchema = z.object({
17
+ formFieldId: z.string().optional(),
18
+ hasOtherOption: z.boolean().optional(),
19
+ isRequired: z.boolean().optional(),
20
+ multipleChoiceOptions: z.array(z.string()).optional(),
21
+ title: z.string().optional(),
22
+ type: FormFieldTypeSchema.optional()
23
+ });
24
+ const FormFieldsSchema = z.object({
25
+ allowMultipleSubmissions: z.boolean().optional(),
26
+ formFieldIds: z.array(z.string()).optional(),
27
+ formFields: z.array(FormFieldSchema).optional(),
28
+ name: z.string().optional(),
29
+ visibility: FormVisibilitySchema.optional()
30
+ });
31
+ const FormAdditionalFieldsSchema = z.object({
32
+ formResponseRequests: z.number().optional(),
33
+ formResponseSubmissions: z.number().optional(),
34
+ latestSubmissionDate: z.string().optional()
35
+ });
3
36
  const FormSchema = z.object({
37
+ additionalFields: FormAdditionalFieldsSchema.optional(),
4
38
  createdAt: z.iso.datetime(),
39
+ fields: FormFieldsSchema.optional(),
5
40
  id: z.string(),
6
41
  latestSubmissionDate: z.string().nullable().optional(),
7
42
  name: z.string().optional(),
@@ -13,7 +48,11 @@ const FormsDataResponseSchema = z.object({
13
48
  data: z.array(FormSchema).nullable(),
14
49
  nextToken: z.string().optional()
15
50
  });
51
+ const FormCreateRequestSchema = z.object({
52
+ additionalFields: FormAdditionalFieldsSchema,
53
+ fields: FormFieldsSchema
54
+ });
16
55
  //#endregion
17
- export { FormDataResponseSchema, FormSchema, FormsDataResponseSchema };
56
+ export { FormAdditionalFieldsSchema, FormCreateRequestSchema, FormDataResponseSchema, FormFieldSchema, FormFieldTypeSchema, FormFieldsSchema, FormSchema, FormVisibilitySchema, FormsDataResponseSchema };
18
57
 
19
58
  //# sourceMappingURL=schema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/lib/modules/forms/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Base types\n// ---------------------------------------------------------------------------\n\nexport interface Form {\n createdAt: string;\n id: string;\n latestSubmissionDate?: string | null;\n name?: string;\n object: \"form\";\n updatedAt?: string;\n}\n\nexport const FormSchema: z.ZodType<Form> = z.object({\n createdAt: z.iso.datetime(),\n id: z.string(),\n latestSubmissionDate: z.string().nullable().optional(),\n name: z.string().optional(),\n object: z.literal(\"form\"),\n updatedAt: z.iso.datetime().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Response types\n// ---------------------------------------------------------------------------\n\nexport const FormDataResponseSchema: z.ZodType<Form> = FormSchema;\nexport type FormDataResponse = Form;\n\nexport interface FormsDataResponse {\n data: Form[] | null;\n nextToken?: string;\n}\n\nexport const FormsDataResponseSchema: z.ZodType<FormsDataResponse> = z.object({\n data: z.array(FormSchema).nullable(),\n nextToken: z.string().optional(),\n});\n"],"mappings":";;AAeA,MAAa,aAA8B,EAAE,OAAO;CAClD,WAAW,EAAE,IAAI,UAAU;CAC3B,IAAI,EAAE,QAAQ;CACd,sBAAsB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACtD,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,QAAQ,OAAO;CACzB,WAAW,EAAE,IAAI,UAAU,CAAC,UAAU;CACvC,CAAC;AAMF,MAAa,yBAA0C;AAQvD,MAAa,0BAAwD,EAAE,OAAO;CAC5E,MAAM,EAAE,MAAM,WAAW,CAAC,UAAU;CACpC,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC"}
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/lib/modules/forms/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Base types\n// ---------------------------------------------------------------------------\n\nexport type FormFieldType =\n | \"date\"\n | \"dropdown\"\n | \"email\"\n | \"fileUpload\"\n | \"longAnswer\"\n | \"multiSelect\"\n | \"phoneNumber\"\n | \"shortAnswer\"\n | \"singleSelect\"\n | \"title\";\n\nexport const FormFieldTypeSchema: z.ZodType<FormFieldType> = z.enum([\n \"shortAnswer\",\n \"longAnswer\",\n \"singleSelect\",\n \"multiSelect\",\n \"title\",\n \"fileUpload\",\n \"phoneNumber\",\n \"email\",\n \"date\",\n \"dropdown\",\n]);\n\nexport type FormVisibility = \"allClients\" | \"requestedClients\";\n\nexport const FormVisibilitySchema: z.ZodType<FormVisibility> = z.enum([\n \"requestedClients\",\n \"allClients\",\n]);\n\nexport interface FormField {\n formFieldId?: string;\n hasOtherOption?: boolean;\n isRequired?: boolean;\n multipleChoiceOptions?: string[];\n title?: string;\n type?: FormFieldType;\n}\n\nexport const FormFieldSchema: z.ZodType<FormField> = z.object({\n formFieldId: z.string().optional(),\n hasOtherOption: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n multipleChoiceOptions: z.array(z.string()).optional(),\n title: z.string().optional(),\n type: FormFieldTypeSchema.optional(),\n});\n\nexport interface FormFields {\n allowMultipleSubmissions?: boolean;\n formFieldIds?: string[];\n formFields?: FormField[];\n name?: string;\n visibility?: FormVisibility;\n}\n\nexport const FormFieldsSchema: z.ZodType<FormFields> = z.object({\n allowMultipleSubmissions: z.boolean().optional(),\n formFieldIds: z.array(z.string()).optional(),\n formFields: z.array(FormFieldSchema).optional(),\n name: z.string().optional(),\n visibility: FormVisibilitySchema.optional(),\n});\n\nexport interface FormAdditionalFields {\n formResponseRequests?: number;\n formResponseSubmissions?: number;\n latestSubmissionDate?: string;\n}\n\nexport const FormAdditionalFieldsSchema: z.ZodType<FormAdditionalFields> = z.object({\n formResponseRequests: z.number().optional(),\n formResponseSubmissions: z.number().optional(),\n latestSubmissionDate: z.string().optional(),\n});\n\nexport interface Form {\n additionalFields?: FormAdditionalFields;\n createdAt: string;\n fields?: FormFields;\n id: string;\n latestSubmissionDate?: string | null;\n name?: string;\n object: \"form\";\n updatedAt?: string;\n}\n\nexport const FormSchema: z.ZodType<Form> = z.object({\n additionalFields: FormAdditionalFieldsSchema.optional(),\n createdAt: z.iso.datetime(),\n fields: FormFieldsSchema.optional(),\n id: z.string(),\n latestSubmissionDate: z.string().nullable().optional(),\n name: z.string().optional(),\n object: z.literal(\"form\"),\n updatedAt: z.iso.datetime().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Response types\n// ---------------------------------------------------------------------------\n\nexport const FormDataResponseSchema: z.ZodType<Form> = FormSchema;\nexport type FormDataResponse = Form;\n\nexport interface FormsDataResponse {\n data: Form[] | null;\n nextToken?: string;\n}\n\nexport const FormsDataResponseSchema: z.ZodType<FormsDataResponse> = z.object({\n data: z.array(FormSchema).nullable(),\n nextToken: z.string().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Request types\n// ---------------------------------------------------------------------------\n\nexport interface FormCreateRequest {\n additionalFields: FormAdditionalFields;\n fields: FormFields;\n}\n\nexport const FormCreateRequestSchema: z.ZodType<FormCreateRequest> = z.object({\n additionalFields: FormAdditionalFieldsSchema,\n fields: FormFieldsSchema,\n});\n"],"mappings":";;AAkBA,MAAa,sBAAgD,EAAE,KAAK;CAClE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAIF,MAAa,uBAAkD,EAAE,KAAK,CACpE,oBACA,aACD,CAAC;AAWF,MAAa,kBAAwC,EAAE,OAAO;CAC5D,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,gBAAgB,EAAE,SAAS,CAAC,UAAU;CACtC,YAAY,EAAE,SAAS,CAAC,UAAU;CAClC,uBAAuB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACrD,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,MAAM,oBAAoB,UAAU;CACrC,CAAC;AAUF,MAAa,mBAA0C,EAAE,OAAO;CAC9D,0BAA0B,EAAE,SAAS,CAAC,UAAU;CAChD,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC5C,YAAY,EAAE,MAAM,gBAAgB,CAAC,UAAU;CAC/C,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,YAAY,qBAAqB,UAAU;CAC5C,CAAC;AAQF,MAAa,6BAA8D,EAAE,OAAO;CAClF,sBAAsB,EAAE,QAAQ,CAAC,UAAU;CAC3C,yBAAyB,EAAE,QAAQ,CAAC,UAAU;CAC9C,sBAAsB,EAAE,QAAQ,CAAC,UAAU;CAC5C,CAAC;AAaF,MAAa,aAA8B,EAAE,OAAO;CAClD,kBAAkB,2BAA2B,UAAU;CACvD,WAAW,EAAE,IAAI,UAAU;CAC3B,QAAQ,iBAAiB,UAAU;CACnC,IAAI,EAAE,QAAQ;CACd,sBAAsB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACtD,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,QAAQ,OAAO;CACzB,WAAW,EAAE,IAAI,UAAU,CAAC,UAAU;CACvC,CAAC;AAMF,MAAa,yBAA0C;AAQvD,MAAa,0BAAwD,EAAE,OAAO;CAC5E,MAAM,EAAE,MAAM,WAAW,CAAC,UAAU;CACpC,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC;AAWF,MAAa,0BAAwD,EAAE,OAAO;CAC5E,kBAAkB;CAClB,QAAQ;CACT,CAAC"}
@@ -1,28 +1,31 @@
1
1
  import { AppConnection, AppConnectionCreateRequest, AppConnectionCreateRequestSchema, AppConnectionResponse, AppConnectionResponseSchema, AppConnectionSchema, AppConnectionType, AppConnectionTypeSchema, AppConnectionsResponse, AppConnectionsResponseSchema } from "./app-connections/schema.mjs";
2
- import { AppInstall, AppInstallResponse, AppInstallResponseSchema, AppInstallSchema, AppInstallType, AppInstallTypeSchema, AppInstallsResponse, AppInstallsResponseSchema } from "./app-installs/schema.mjs";
3
- import { Client, ClientCreateRequest, ClientCreateRequestSchema, ClientResponse, ClientResponseSchema, ClientSchema, ClientUpdateRequest, ClientUpdateRequestSchema, ClientsResponse, ClientsResponseSchema } from "./clients/schema.mjs";
4
- import { CompaniesResponse, CompaniesResponseSchema, Company, CompanyCreateRequest, CompanyCreateRequestSchema, CompanyResponse, CompanyResponseSchema, CompanySchema, CompanyUpdateRequest, CompanyUpdateRequestSchema } from "./companies/schema.mjs";
2
+ import { AppInstall, AppInstallResponse, AppInstallResponseSchema, AppInstallSchema, AppInstallType, AppInstallTypeSchema, AppInstallsResponse, AppInstallsResponseSchema, AppNotificationActionLabel, AppNotificationActionLabelSchema, AppNotificationSetting, AppNotificationSettingSchema, AppNotificationSettingsCreateRequest, AppNotificationSettingsCreateRequestSchema, AppNotificationSettingsResponse, AppNotificationSettingsResponseSchema, AppNotificationSettingsUpdateRequest, AppNotificationSettingsUpdateRequestSchema, NotificationSurface, NotificationSurfaceSchema } from "./app-installs/schema.mjs";
3
+ import { Client, ClientCreateRequest, ClientCreateRequestSchema, ClientResponse, ClientResponseSchema, ClientSchema, ClientUpdateRequest, ClientUpdateRequestSchema, ClientWithAppVisibility, ClientWithAppVisibilitySchema, ClientsResponse, ClientsResponseSchema } from "./clients/schema.mjs";
4
+ import { CompaniesResponse, CompaniesResponseSchema, Company, CompanyAddClientError, CompanyAddClientsRequest, CompanyAddClientsRequestSchema, CompanyAddClientsResponse, CompanyAddClientsResponseSchema, CompanyCreateRequest, CompanyCreateRequestSchema, CompanyResponse, CompanyResponseSchema, CompanySchema, CompanyUpdateRequest, CompanyUpdateRequestSchema } from "./companies/schema.mjs";
5
5
  import { ContractTemplate, ContractTemplateResponse, ContractTemplateResponseSchema, ContractTemplateSchema, ContractTemplatesResponse, ContractTemplatesResponseSchema } from "./contract-templates/schema.mjs";
6
6
  import { Contract, ContractField, ContractFieldInputType, ContractFieldInputTypeSchema, ContractFieldSchema, ContractResponse, ContractResponseSchema, ContractSchema, ContractSendRequest, ContractSendRequestSchema, ContractStatus, ContractStatusSchema, ContractsResponse, ContractsResponseSchema } from "./contracts/schema.mjs";
7
7
  import { CustomFieldOption, CustomFieldOptionSchema, ListCustomFieldOptionResponse, ListCustomFieldOptionResponseSchema } from "./custom-field-options/schema.mjs";
8
- import { AddressValue, AddressValueSchema, CustomField, CustomFieldEntityType, CustomFieldEntityTypeSchema, CustomFieldSchema, CustomFieldType, CustomFieldTypeSchema, CustomFieldValue, CustomFieldValueSchema, ListCustomFieldResponse, ListCustomFieldResponseSchema } from "./custom-fields/schema.mjs";
8
+ import { AddressValue, AddressValueSchema, CustomField, CustomFieldCreateInput, CustomFieldCreateInputSchema, CustomFieldEntityType, CustomFieldEntityTypeSchema, CustomFieldSchema, CustomFieldType, CustomFieldTypeSchema, CustomFieldValue, CustomFieldValueSchema, CustomFieldsCreateRequest, CustomFieldsCreateRequestSchema, CustomFieldsCreateResponse, CustomFieldsCreateResponseSchema, ListCustomFieldResponse, ListCustomFieldResponseSchema } from "./custom-fields/schema.mjs";
9
9
  import { AuditLogEvent, AuditLogEventResponse, AuditLogEventResponseSchema, AuditLogEventSchema, AuditLogEventsResponse, AuditLogEventsResponseSchema, ClientUserEventCreateRequest, EventActorType, EventActorTypeSchema, EventCreateRequest, EventCreateRequestSchema, EventSource, EventSourceSchema, InternalUserEventCreateRequest } from "./events/schema.mjs";
10
10
  import { FileChannel, FileChannelCreateRequest, FileChannelCreateRequestSchema, FileChannelResponse, FileChannelResponseSchema, FileChannelSchema, FileChannelsResponse, FileChannelsResponseSchema } from "./file-channels/schema.mjs";
11
- import { AssemblyFile, AssemblyFileResponse, AssemblyFileResponseSchema, AssemblyFileSchema, AssemblyFilesResponse, AssemblyFilesResponseSchema, FileType, FileTypeSchema } from "./files/schema.mjs";
11
+ import { AssemblyFile, AssemblyFileResponse, AssemblyFileResponseSchema, AssemblyFileSchema, AssemblyFilesResponse, AssemblyFilesResponseSchema, ClientPermissions, ClientPermissionsSchema, FileDownloadUrlResponse, FileDownloadUrlResponseSchema, FilePermissionsResponse, FilePermissionsResponseSchema, FileType, FileTypeSchema } from "./files/schema.mjs";
12
12
  import { FormResponse, FormResponseCreateRequest, FormResponseCreateRequestSchema, FormResponseItemResponse, FormResponseItemResponseSchema, FormResponseSchema, FormResponsesResponse, FormResponsesResponseSchema } from "./form-responses/schema.mjs";
13
- import { Form, FormDataResponse, FormDataResponseSchema, FormSchema, FormsDataResponse, FormsDataResponseSchema } from "./forms/schema.mjs";
14
- import { InternalUser, InternalUserResponse, InternalUserResponseSchema, InternalUserSchema, InternalUsersResponse, InternalUsersResponseSchema } from "./internal-users/schema.mjs";
13
+ import { Form, FormAdditionalFields, FormAdditionalFieldsSchema, FormCreateRequest, FormCreateRequestSchema, FormDataResponse, FormDataResponseSchema, FormField, FormFieldSchema, FormFieldType, FormFieldTypeSchema, FormFields, FormFieldsSchema, FormSchema, FormVisibility, FormVisibilitySchema, FormsDataResponse, FormsDataResponseSchema } from "./forms/schema.mjs";
14
+ import { InternalUser, InternalUserEmailSetting, InternalUserEmailSettingSchema, InternalUserNotificationSettings, InternalUserNotificationSettingsSchema, InternalUserResponse, InternalUserResponseSchema, InternalUserSchema, InternalUserUpdateRequest, InternalUserUpdateRequestSchema, InternalUsersResponse, InternalUsersResponseSchema, NotificationCategorySetting, NotificationCategorySettingSchema } from "./internal-users/schema.mjs";
15
15
  import { InvoiceTemplate, InvoiceTemplateResponse, InvoiceTemplateResponseSchema, InvoiceTemplateSchema, InvoiceTemplatesResponse, InvoiceTemplatesResponseSchema } from "./invoice-templates/schema.mjs";
16
16
  import { Invoice, InvoiceCreateRequest, InvoiceCreateRequestSchema, InvoiceLineItem, InvoiceLineItemRequest, InvoiceLineItemRequestSchema, InvoiceLineItemSchema, InvoicePaymentMethodPreferenceRequest, InvoicePaymentMethodPreferenceRequestSchema, InvoiceResponse, InvoiceResponseSchema, InvoiceSchema, InvoiceStatus, InvoiceStatusSchema, InvoicesResponse, InvoicesResponseSchema, PaymentMethodPreference, PaymentMethodPreferenceSchema, PaymentMethodType, PaymentMethodTypeSchema } from "./invoices/schema.mjs";
17
- import { MessageChannel, MessageChannelCreateRequest, MessageChannelCreateRequestSchema, MessageChannelResponse, MessageChannelResponseSchema, MessageChannelSchema, MessageChannelsResponse, MessageChannelsResponseSchema } from "./message-channels/schema.mjs";
17
+ import { CurrentUser, CurrentUserResponse, CurrentUserResponseSchema, CurrentUserSchema } from "./me/schema.mjs";
18
+ import { MessageChannel, MessageChannelCreateRequest, MessageChannelCreateRequestSchema, MessageChannelResponse, MessageChannelResponseSchema, MessageChannelSchema, MessageChannelsResponse, MessageChannelsResponseSchema, UnreadMessageChannelsResponse, UnreadMessageChannelsResponseSchema } from "./message-channels/schema.mjs";
18
19
  import { Message, MessageResponse, MessageResponseSchema, MessageSchema, MessagesResponse, MessagesResponseSchema, SendMessageRequest, SendMessageRequestSchema } from "./messages/schema.mjs";
19
20
  import { Note, NoteCreateRequest, NoteCreateRequestSchema, NoteResponse, NoteResponseSchema, NoteSchema, NoteUpdateRequest, NoteUpdateRequestSchema, NotesResponse, NotesResponseSchema } from "./notes/schema.mjs";
20
21
  import { EmailDeliveryTarget, EmailDeliveryTargetSchema, InProductDeliveryTarget, InProductDeliveryTargetSchema, Notification, NotificationCreateRequest, NotificationCreateRequestSchema, NotificationDeliveryTargets, NotificationDeliveryTargetsSchema, NotificationResponse, NotificationResponseSchema, NotificationSchema, NotificationsResponse, NotificationsResponseSchema } from "./notifications/schema.mjs";
21
22
  import { Payment, PaymentResponse, PaymentResponseSchema, PaymentSchema, PaymentsResponse, PaymentsResponseSchema } from "./payments/schema.mjs";
22
- import { Price, PriceResponse, PriceResponseSchema, PriceSchema, PricesResponse, PricesResponseSchema } from "./prices/schema.mjs";
23
- import { Product, ProductResponse, ProductResponseSchema, ProductSchema, ProductsResponse, ProductsResponseSchema } from "./products/schema.mjs";
23
+ import { BillingPeriod, BillingPeriodSchema, Price, PriceCreateRequest, PriceCreateRequestSchema, PriceResponse, PriceResponseSchema, PriceSchema, PriceType, PriceTypeSchema, PricesResponse, PricesResponseSchema } from "./prices/schema.mjs";
24
+ import { Product, ProductCreateRequest, ProductCreateRequestSchema, ProductResponse, ProductResponseSchema, ProductSchema, ProductsResponse, ProductsResponseSchema } from "./products/schema.mjs";
25
+ import { Refund, RefundCreateRequest, RefundCreateRequestSchema, RefundResponse, RefundResponseSchema, RefundSchema, RefundStatus, RefundStatusSchema, RefundsResponse, RefundsResponseSchema } from "./refunds/schema.mjs";
24
26
  import { SubscriptionTemplate, SubscriptionTemplateResponse, SubscriptionTemplateResponseSchema, SubscriptionTemplateSchema, SubscriptionTemplatesResponse, SubscriptionTemplatesResponseSchema } from "./subscription-templates/schema.mjs";
25
27
  import { Subscription, SubscriptionCreateRequest, SubscriptionCreateRequestSchema, SubscriptionResponse, SubscriptionResponseSchema, SubscriptionSchema, SubscriptionsResponse, SubscriptionsResponseSchema } from "./subscriptions/schema.mjs";
28
+ import { TaskComment, TaskCommentResponse, TaskCommentResponseSchema, TaskCommentSchema, TaskCommentsResponse, TaskCommentsResponseSchema } from "./task-comments/schema.mjs";
26
29
  import { TaskTemplate, TaskTemplateResponse, TaskTemplateResponseSchema, TaskTemplateSchema, TaskTemplatesResponse, TaskTemplatesResponseSchema } from "./task-templates/schema.mjs";
27
30
  import { Task, TaskCreateRequest, TaskCreateRequestSchema, TaskResponse, TaskResponseSchema, TaskSchema, TaskStatus, TaskStatusSchema, TaskUpdateRequest, TaskUpdateRequestSchema, TasksResponse, TasksResponseSchema } from "./tasks/schema.mjs";
28
31
  import { Workspace, WorkspaceResponse, WorkspaceResponseSchema, WorkspaceSchema } from "./workspace/schema.mjs";
@@ -14,6 +14,7 @@ import "./forms/schema.mjs";
14
14
  import "./internal-users/schema.mjs";
15
15
  import "./invoice-templates/schema.mjs";
16
16
  import "./invoices/schema.mjs";
17
+ import "./me/schema.mjs";
17
18
  import "./message-channels/schema.mjs";
18
19
  import "./messages/schema.mjs";
19
20
  import "./notes/schema.mjs";
@@ -21,8 +22,10 @@ import "./notifications/schema.mjs";
21
22
  import "./payments/schema.mjs";
22
23
  import "./prices/schema.mjs";
23
24
  import "./products/schema.mjs";
25
+ import "./refunds/schema.mjs";
24
26
  import "./subscription-templates/schema.mjs";
25
27
  import "./subscriptions/schema.mjs";
28
+ import "./task-comments/schema.mjs";
26
29
  import "./task-templates/schema.mjs";
27
30
  import "./tasks/schema.mjs";
28
31
  import "./workspace/schema.mjs";
@@ -1,6 +1,6 @@
1
1
  import { Transport } from "../../../transport/http.mjs";
2
2
  import { ListArgs } from "../../pagination/paginate.mjs";
3
- import { InternalUser, InternalUsersResponse } from "./schema.mjs";
3
+ import { InternalUser, InternalUserNotificationSettings, InternalUserUpdateRequest, InternalUsersResponse } from "./schema.mjs";
4
4
 
5
5
  //#region src/lib/modules/internal-users/resource.d.ts
6
6
  declare class InternalUsersResource {
@@ -16,6 +16,13 @@ declare class InternalUsersResource {
16
16
  list(args?: ListArgs): Promise<InternalUsersResponse>;
17
17
  /** Retrieve a single internal user by ID. */
18
18
  retrieve(id: string): Promise<InternalUser>;
19
+ /** Update an internal user's client-access scope. */
20
+ update(args: {
21
+ id: string;
22
+ body: InternalUserUpdateRequest;
23
+ }): Promise<InternalUser>;
24
+ /** Retrieve an internal user's notification preferences. */
25
+ retrieveNotificationSettings(id: string): Promise<InternalUserNotificationSettings>;
19
26
  /** Iterate over all internal users, automatically paginating. Default limit per page: 500. */
20
27
  listAll(args?: Omit<ListArgs, "nextToken">): Promise<InternalUser[]>;
21
28
  }
@@ -1,7 +1,7 @@
1
1
  import { buildSearchParams } from "../../../transport/build-search-params.mjs";
2
2
  import { parseResponse } from "../../../transport/parse-response.mjs";
3
3
  import { paginate } from "../../pagination/paginate.mjs";
4
- import { InternalUserResponseSchema, InternalUsersResponseSchema } from "./schema.mjs";
4
+ import { InternalUserNotificationSettingsSchema, InternalUserResponseSchema, InternalUsersResponseSchema } from "./schema.mjs";
5
5
  //#region src/lib/modules/internal-users/resource.ts
6
6
  var InternalUsersResource = class {
7
7
  #transport;
@@ -26,6 +26,22 @@ var InternalUsersResource = class {
26
26
  validate: this.#validate
27
27
  });
28
28
  }
29
+ /** Update an internal user's client-access scope. */
30
+ async update(args) {
31
+ return parseResponse({
32
+ schema: InternalUserResponseSchema,
33
+ data: await this.#transport.patch(`v1/internal-users/${args.id}`, args.body),
34
+ validate: this.#validate
35
+ });
36
+ }
37
+ /** Retrieve an internal user's notification preferences. */
38
+ async retrieveNotificationSettings(id) {
39
+ return parseResponse({
40
+ schema: InternalUserNotificationSettingsSchema,
41
+ data: await this.#transport.get(`v1/internal-users/${id}/notification-settings`),
42
+ validate: this.#validate
43
+ });
44
+ }
29
45
  /** Iterate over all internal users, automatically paginating. Default limit per page: 500. */
30
46
  async listAll(args = {}) {
31
47
  return paginate((listArgs) => this.list({ ...listArgs }), { limit: args.limit ?? 500 });
@@ -1 +1 @@
1
- {"version":3,"file":"resource.mjs","names":["#transport","#validate"],"sources":["../../../../src/lib/modules/internal-users/resource.ts"],"sourcesContent":["import { paginate } from \"src/lib/pagination\";\nimport type { ListArgs } from \"src/lib/pagination\";\nimport { buildSearchParams } from \"src/transport/build-search-params\";\nimport type { Transport } from \"src/transport/http\";\nimport { parseResponse } from \"src/transport/parse-response\";\n\nimport { InternalUserResponseSchema, InternalUsersResponseSchema } from \"./schema\";\nimport type { InternalUser, InternalUsersResponse } from \"./schema\";\n\nexport class InternalUsersResource {\n readonly #transport: Transport;\n readonly #validate: boolean;\n\n constructor({\n transport,\n validateResponses,\n }: {\n transport: Transport;\n validateResponses: boolean;\n }) {\n this.#transport = transport;\n this.#validate = validateResponses;\n }\n\n /** List internal users. */\n async list(args: ListArgs = {}): Promise<InternalUsersResponse> {\n const raw: unknown = await this.#transport.get(\"v1/internal-users\", {\n searchParams: buildSearchParams(args),\n });\n return parseResponse({\n schema: InternalUsersResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Retrieve a single internal user by ID. */\n async retrieve(id: string): Promise<InternalUser> {\n const raw: unknown = await this.#transport.get(`v1/internal-users/${id}`);\n return parseResponse({\n schema: InternalUserResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Iterate over all internal users, automatically paginating. Default limit per page: 500. */\n async listAll(args: Omit<ListArgs, \"nextToken\"> = {}): Promise<InternalUser[]> {\n return paginate((listArgs) => this.list({ ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n}\n"],"mappings":";;;;;AASA,IAAa,wBAAb,MAAmC;CACjC;CACA;CAEA,YAAY,EACV,WACA,qBAIC;AACD,QAAA,YAAkB;AAClB,QAAA,WAAiB;;;CAInB,MAAM,KAAK,OAAiB,EAAE,EAAkC;AAI9D,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MALmB,MAAA,UAAgB,IAAI,qBAAqB,EAClE,cAAc,kBAAkB,KAAK,EACtC,CAAC;GAIA,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,SAAS,IAAmC;AAEhD,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,qBAAqB,KAAK;GAIvE,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,QAAQ,OAAoC,EAAE,EAA2B;AAC7E,SAAO,UAAU,aAAa,KAAK,KAAK,EAAE,GAAG,UAAU,CAAC,EAAE,EACxD,OAAO,KAAK,SAAS,KACtB,CAAC"}
1
+ {"version":3,"file":"resource.mjs","names":["#transport","#validate"],"sources":["../../../../src/lib/modules/internal-users/resource.ts"],"sourcesContent":["import { paginate } from \"src/lib/pagination\";\nimport type { ListArgs } from \"src/lib/pagination\";\nimport { buildSearchParams } from \"src/transport/build-search-params\";\nimport type { Transport } from \"src/transport/http\";\nimport { parseResponse } from \"src/transport/parse-response\";\n\nimport {\n InternalUserNotificationSettingsSchema,\n InternalUserResponseSchema,\n InternalUsersResponseSchema,\n} from \"./schema\";\nimport type {\n InternalUser,\n InternalUserNotificationSettings,\n InternalUserUpdateRequest,\n InternalUsersResponse,\n} from \"./schema\";\n\nexport class InternalUsersResource {\n readonly #transport: Transport;\n readonly #validate: boolean;\n\n constructor({\n transport,\n validateResponses,\n }: {\n transport: Transport;\n validateResponses: boolean;\n }) {\n this.#transport = transport;\n this.#validate = validateResponses;\n }\n\n /** List internal users. */\n async list(args: ListArgs = {}): Promise<InternalUsersResponse> {\n const raw: unknown = await this.#transport.get(\"v1/internal-users\", {\n searchParams: buildSearchParams(args),\n });\n return parseResponse({\n schema: InternalUsersResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Retrieve a single internal user by ID. */\n async retrieve(id: string): Promise<InternalUser> {\n const raw: unknown = await this.#transport.get(`v1/internal-users/${id}`);\n return parseResponse({\n schema: InternalUserResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Update an internal user's client-access scope. */\n async update(args: { id: string; body: InternalUserUpdateRequest }): Promise<InternalUser> {\n const raw: unknown = await this.#transport.patch(`v1/internal-users/${args.id}`, args.body);\n return parseResponse({\n schema: InternalUserResponseSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Retrieve an internal user's notification preferences. */\n async retrieveNotificationSettings(id: string): Promise<InternalUserNotificationSettings> {\n const raw: unknown = await this.#transport.get(`v1/internal-users/${id}/notification-settings`);\n return parseResponse({\n schema: InternalUserNotificationSettingsSchema,\n data: raw,\n validate: this.#validate,\n });\n }\n\n /** Iterate over all internal users, automatically paginating. Default limit per page: 500. */\n async listAll(args: Omit<ListArgs, \"nextToken\"> = {}): Promise<InternalUser[]> {\n return paginate((listArgs) => this.list({ ...listArgs }), {\n limit: args.limit ?? 500,\n });\n }\n}\n"],"mappings":";;;;;AAkBA,IAAa,wBAAb,MAAmC;CACjC;CACA;CAEA,YAAY,EACV,WACA,qBAIC;AACD,QAAA,YAAkB;AAClB,QAAA,WAAiB;;;CAInB,MAAM,KAAK,OAAiB,EAAE,EAAkC;AAI9D,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MALmB,MAAA,UAAgB,IAAI,qBAAqB,EAClE,cAAc,kBAAkB,KAAK,EACtC,CAAC;GAIA,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,SAAS,IAAmC;AAEhD,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,qBAAqB,KAAK;GAIvE,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,OAAO,MAA8E;AAEzF,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,MAAM,qBAAqB,KAAK,MAAM,KAAK,KAAK;GAIzF,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,6BAA6B,IAAuD;AAExF,SAAO,cAAc;GACnB,QAAQ;GACR,MAAM,MAHmB,MAAA,UAAgB,IAAI,qBAAqB,GAAG,wBAAwB;GAI7F,UAAU,MAAA;GACX,CAAC;;;CAIJ,MAAM,QAAQ,OAAoC,EAAE,EAA2B;AAC7E,SAAO,UAAU,aAAa,KAAK,KAAK,EAAE,GAAG,UAAU,CAAC,EAAE,EACxD,OAAO,KAAK,SAAS,KACtB,CAAC"}
@@ -22,6 +22,27 @@ interface InternalUsersResponse {
22
22
  nextToken?: string;
23
23
  }
24
24
  declare const InternalUsersResponseSchema: z.ZodType<InternalUsersResponse>;
25
+ interface InternalUserUpdateRequest {
26
+ companyAccessList?: string[];
27
+ isClientAccessLimited?: boolean;
28
+ }
29
+ declare const InternalUserUpdateRequestSchema: z.ZodType<InternalUserUpdateRequest>;
30
+ type InternalUserEmailSetting = "always" | "no_emails" | "not_active";
31
+ declare const InternalUserEmailSettingSchema: z.ZodType<InternalUserEmailSetting>;
32
+ interface NotificationCategorySetting {
33
+ appId?: string;
34
+ disableEmail?: boolean;
35
+ disableInProduct?: boolean;
36
+ notificationSettingId?: string;
37
+ }
38
+ declare const NotificationCategorySettingSchema: z.ZodType<NotificationCategorySetting>;
39
+ interface InternalUserNotificationSettings {
40
+ disableInProduct?: boolean;
41
+ emailSettings?: InternalUserEmailSetting;
42
+ notifyAbout?: Record<string, NotificationCategorySetting>;
43
+ object?: string;
44
+ }
45
+ declare const InternalUserNotificationSettingsSchema: z.ZodType<InternalUserNotificationSettings>;
25
46
  //#endregion
26
- export { InternalUser, InternalUserResponse, InternalUserResponseSchema, InternalUserSchema, InternalUsersResponse, InternalUsersResponseSchema };
47
+ export { InternalUser, InternalUserEmailSetting, InternalUserEmailSettingSchema, InternalUserNotificationSettings, InternalUserNotificationSettingsSchema, InternalUserResponse, InternalUserResponseSchema, InternalUserSchema, InternalUserUpdateRequest, InternalUserUpdateRequestSchema, InternalUsersResponse, InternalUsersResponseSchema, NotificationCategorySetting, NotificationCategorySettingSchema };
27
48
  //# sourceMappingURL=schema.d.mts.map
@@ -18,7 +18,28 @@ const InternalUsersResponseSchema = z.object({
18
18
  data: z.array(InternalUserSchema),
19
19
  nextToken: z.string().optional()
20
20
  });
21
+ const InternalUserUpdateRequestSchema = z.object({
22
+ companyAccessList: z.array(z.string()).optional(),
23
+ isClientAccessLimited: z.boolean().optional()
24
+ });
25
+ const InternalUserEmailSettingSchema = z.enum([
26
+ "always",
27
+ "not_active",
28
+ "no_emails"
29
+ ]);
30
+ const NotificationCategorySettingSchema = z.object({
31
+ appId: z.string().optional(),
32
+ disableEmail: z.boolean().optional(),
33
+ disableInProduct: z.boolean().optional(),
34
+ notificationSettingId: z.string().optional()
35
+ });
36
+ const InternalUserNotificationSettingsSchema = z.object({
37
+ disableInProduct: z.boolean().optional(),
38
+ emailSettings: InternalUserEmailSettingSchema.optional(),
39
+ notifyAbout: z.record(z.string(), NotificationCategorySettingSchema).optional(),
40
+ object: z.string().optional()
41
+ });
21
42
  //#endregion
22
- export { InternalUserResponseSchema, InternalUserSchema, InternalUsersResponseSchema };
43
+ export { InternalUserEmailSettingSchema, InternalUserNotificationSettingsSchema, InternalUserResponseSchema, InternalUserSchema, InternalUserUpdateRequestSchema, InternalUsersResponseSchema, NotificationCategorySettingSchema };
23
44
 
24
45
  //# sourceMappingURL=schema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/lib/modules/internal-users/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ─── Base ─────────────────────────────────────────────────────────────────────\n\nexport interface InternalUser {\n avatarImageUrl?: string;\n companyAccessList: string[] | null;\n createdAt?: string;\n email: string;\n fallbackColor?: string | null;\n familyName: string;\n givenName: string;\n id: string;\n isClientAccessLimited: boolean;\n object: \"internalUser\";\n role?: string;\n}\n\nexport const InternalUserSchema: z.ZodType<InternalUser> = z.object({\n avatarImageUrl: z.string().optional(),\n companyAccessList: z.array(z.string()).nullable(),\n createdAt: z.iso.datetime().optional(),\n // Deleted internal users can still be queried but have an empty email\n email: z.union([z.email(), z.literal(\"\")]),\n fallbackColor: z.string().nullish(),\n familyName: z.string(),\n givenName: z.string(),\n id: z.string(),\n isClientAccessLimited: z.boolean().default(false),\n object: z.literal(\"internalUser\"),\n role: z.string().optional(),\n});\n\n// ─── Response ─────────────────────────────────────────────────────────────────\n\nexport const InternalUserResponseSchema: z.ZodType<InternalUser> = InternalUserSchema;\nexport type InternalUserResponse = InternalUser;\n\nexport interface InternalUsersResponse {\n data: InternalUser[];\n nextToken?: string;\n}\n\nexport const InternalUsersResponseSchema: z.ZodType<InternalUsersResponse> = z.object({\n data: z.array(InternalUserSchema),\n nextToken: z.string().optional(),\n});\n"],"mappings":";;AAkBA,MAAa,qBAA8C,EAAE,OAAO;CAClE,gBAAgB,EAAE,QAAQ,CAAC,UAAU;CACrC,mBAAmB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACjD,WAAW,EAAE,IAAI,UAAU,CAAC,UAAU;CAEtC,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC;CAC1C,eAAe,EAAE,QAAQ,CAAC,SAAS;CACnC,YAAY,EAAE,QAAQ;CACtB,WAAW,EAAE,QAAQ;CACrB,IAAI,EAAE,QAAQ;CACd,uBAAuB,EAAE,SAAS,CAAC,QAAQ,MAAM;CACjD,QAAQ,EAAE,QAAQ,eAAe;CACjC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC5B,CAAC;AAIF,MAAa,6BAAsD;AAQnE,MAAa,8BAAgE,EAAE,OAAO;CACpF,MAAM,EAAE,MAAM,mBAAmB;CACjC,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC"}
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/lib/modules/internal-users/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ─── Base ─────────────────────────────────────────────────────────────────────\n\nexport interface InternalUser {\n avatarImageUrl?: string;\n companyAccessList: string[] | null;\n createdAt?: string;\n email: string;\n fallbackColor?: string | null;\n familyName: string;\n givenName: string;\n id: string;\n isClientAccessLimited: boolean;\n object: \"internalUser\";\n role?: string;\n}\n\nexport const InternalUserSchema: z.ZodType<InternalUser> = z.object({\n avatarImageUrl: z.string().optional(),\n companyAccessList: z.array(z.string()).nullable(),\n createdAt: z.iso.datetime().optional(),\n // Deleted internal users can still be queried but have an empty email\n email: z.union([z.email(), z.literal(\"\")]),\n fallbackColor: z.string().nullish(),\n familyName: z.string(),\n givenName: z.string(),\n id: z.string(),\n isClientAccessLimited: z.boolean().default(false),\n object: z.literal(\"internalUser\"),\n role: z.string().optional(),\n});\n\n// ─── Response ─────────────────────────────────────────────────────────────────\n\nexport const InternalUserResponseSchema: z.ZodType<InternalUser> = InternalUserSchema;\nexport type InternalUserResponse = InternalUser;\n\nexport interface InternalUsersResponse {\n data: InternalUser[];\n nextToken?: string;\n}\n\nexport const InternalUsersResponseSchema: z.ZodType<InternalUsersResponse> = z.object({\n data: z.array(InternalUserSchema),\n nextToken: z.string().optional(),\n});\n\n// ─── Requests ─────────────────────────────────────────────────────────────────\n\nexport interface InternalUserUpdateRequest {\n companyAccessList?: string[];\n isClientAccessLimited?: boolean;\n}\n\nexport const InternalUserUpdateRequestSchema: z.ZodType<InternalUserUpdateRequest> = z.object({\n companyAccessList: z.array(z.string()).optional(),\n isClientAccessLimited: z.boolean().optional(),\n});\n\n// ─── Notification settings ────────────────────────────────────────────────────\n\nexport type InternalUserEmailSetting = \"always\" | \"no_emails\" | \"not_active\";\n\nexport const InternalUserEmailSettingSchema: z.ZodType<InternalUserEmailSetting> = z.enum([\n \"always\",\n \"not_active\",\n \"no_emails\",\n]);\n\nexport interface NotificationCategorySetting {\n appId?: string;\n disableEmail?: boolean;\n disableInProduct?: boolean;\n notificationSettingId?: string;\n}\n\nexport const NotificationCategorySettingSchema: z.ZodType<NotificationCategorySetting> = z.object({\n appId: z.string().optional(),\n disableEmail: z.boolean().optional(),\n disableInProduct: z.boolean().optional(),\n notificationSettingId: z.string().optional(),\n});\n\nexport interface InternalUserNotificationSettings {\n disableInProduct?: boolean;\n emailSettings?: InternalUserEmailSetting;\n notifyAbout?: Record<string, NotificationCategorySetting>;\n object?: string;\n}\n\nexport const InternalUserNotificationSettingsSchema: z.ZodType<InternalUserNotificationSettings> =\n z.object({\n disableInProduct: z.boolean().optional(),\n emailSettings: InternalUserEmailSettingSchema.optional(),\n notifyAbout: z.record(z.string(), NotificationCategorySettingSchema).optional(),\n object: z.string().optional(),\n });\n"],"mappings":";;AAkBA,MAAa,qBAA8C,EAAE,OAAO;CAClE,gBAAgB,EAAE,QAAQ,CAAC,UAAU;CACrC,mBAAmB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACjD,WAAW,EAAE,IAAI,UAAU,CAAC,UAAU;CAEtC,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC;CAC1C,eAAe,EAAE,QAAQ,CAAC,SAAS;CACnC,YAAY,EAAE,QAAQ;CACtB,WAAW,EAAE,QAAQ;CACrB,IAAI,EAAE,QAAQ;CACd,uBAAuB,EAAE,SAAS,CAAC,QAAQ,MAAM;CACjD,QAAQ,EAAE,QAAQ,eAAe;CACjC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC5B,CAAC;AAIF,MAAa,6BAAsD;AAQnE,MAAa,8BAAgE,EAAE,OAAO;CACpF,MAAM,EAAE,MAAM,mBAAmB;CACjC,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC;AASF,MAAa,kCAAwE,EAAE,OAAO;CAC5F,mBAAmB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACjD,uBAAuB,EAAE,SAAS,CAAC,UAAU;CAC9C,CAAC;AAMF,MAAa,iCAAsE,EAAE,KAAK;CACxF;CACA;CACA;CACD,CAAC;AASF,MAAa,oCAA4E,EAAE,OAAO;CAChG,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,cAAc,EAAE,SAAS,CAAC,UAAU;CACpC,kBAAkB,EAAE,SAAS,CAAC,UAAU;CACxC,uBAAuB,EAAE,QAAQ,CAAC,UAAU;CAC7C,CAAC;AASF,MAAa,yCACX,EAAE,OAAO;CACP,kBAAkB,EAAE,SAAS,CAAC,UAAU;CACxC,eAAe,+BAA+B,UAAU;CACxD,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,kCAAkC,CAAC,UAAU;CAC/E,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC9B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  //#region src/lib/modules/invoices/schema.d.ts
4
- type InvoiceStatus = "draft" | "open" | "paid" | "void";
4
+ type InvoiceStatus = "draft" | "open" | "paid" | "processing" | "void";
5
5
  declare const InvoiceStatusSchema: z.ZodType<InvoiceStatus>;
6
6
  interface InvoiceLineItem {
7
7
  amount?: number;
@@ -4,6 +4,7 @@ const InvoiceStatusSchema = z.enum([
4
4
  "draft",
5
5
  "open",
6
6
  "paid",
7
+ "processing",
7
8
  "void"
8
9
  ]);
9
10
  const InvoiceLineItemSchema = z.object({