@bitvea/feedback-toolbar 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 (176) hide show
  1. package/README.md +262 -0
  2. package/dist/FeedbackPanel.d.ts +117 -0
  3. package/dist/FeedbackPanel.d.ts.map +1 -0
  4. package/dist/FeedbackPanel.js +622 -0
  5. package/dist/FeedbackPanel.js.map +1 -0
  6. package/dist/FeedbackToolbar.d.ts +54 -0
  7. package/dist/FeedbackToolbar.d.ts.map +1 -0
  8. package/dist/FeedbackToolbar.js +1149 -0
  9. package/dist/FeedbackToolbar.js.map +1 -0
  10. package/dist/InboxSheet.d.ts +80 -0
  11. package/dist/InboxSheet.d.ts.map +1 -0
  12. package/dist/InboxSheet.js +580 -0
  13. package/dist/InboxSheet.js.map +1 -0
  14. package/dist/PinLayer.d.ts +59 -0
  15. package/dist/PinLayer.d.ts.map +1 -0
  16. package/dist/PinLayer.js +1702 -0
  17. package/dist/PinLayer.js.map +1 -0
  18. package/dist/RichText.d.ts +6 -0
  19. package/dist/RichText.d.ts.map +1 -0
  20. package/dist/RichText.js +135 -0
  21. package/dist/RichText.js.map +1 -0
  22. package/dist/browser/entry.d.ts +3 -0
  23. package/dist/browser/entry.d.ts.map +1 -0
  24. package/dist/browser/entry.js +13 -0
  25. package/dist/browser/entry.js.map +1 -0
  26. package/dist/browser/mount.d.ts +37 -0
  27. package/dist/browser/mount.d.ts.map +1 -0
  28. package/dist/browser/mount.js +150 -0
  29. package/dist/browser/mount.js.map +1 -0
  30. package/dist/browser/toolbar.js +38 -0
  31. package/dist/browser/toolbar.js.map +7 -0
  32. package/dist/capture.d.ts +58 -0
  33. package/dist/capture.d.ts.map +1 -0
  34. package/dist/capture.js +98 -0
  35. package/dist/capture.js.map +1 -0
  36. package/dist/cli/bin.d.ts +3 -0
  37. package/dist/cli/bin.d.ts.map +1 -0
  38. package/dist/cli/bin.js +196 -0
  39. package/dist/cli/bin.js.map +1 -0
  40. package/dist/cli/fs.d.ts +16 -0
  41. package/dist/cli/fs.d.ts.map +1 -0
  42. package/dist/cli/fs.js +33 -0
  43. package/dist/cli/fs.js.map +1 -0
  44. package/dist/cli/init.d.ts +75 -0
  45. package/dist/cli/init.d.ts.map +1 -0
  46. package/dist/cli/init.js +266 -0
  47. package/dist/cli/init.js.map +1 -0
  48. package/dist/cli/register.d.ts +55 -0
  49. package/dist/cli/register.d.ts.map +1 -0
  50. package/dist/cli/register.js +84 -0
  51. package/dist/cli/register.js.map +1 -0
  52. package/dist/cli/registration.d.ts +37 -0
  53. package/dist/cli/registration.d.ts.map +1 -0
  54. package/dist/cli/registration.js +69 -0
  55. package/dist/cli/registration.js.map +1 -0
  56. package/dist/cli/strategies.d.ts +98 -0
  57. package/dist/cli/strategies.d.ts.map +1 -0
  58. package/dist/cli/strategies.js +198 -0
  59. package/dist/cli/strategies.js.map +1 -0
  60. package/dist/client.d.ts +59 -0
  61. package/dist/client.d.ts.map +1 -0
  62. package/dist/client.js +113 -0
  63. package/dist/client.js.map +1 -0
  64. package/dist/config.d.ts +92 -0
  65. package/dist/config.d.ts.map +1 -0
  66. package/dist/config.js +65 -0
  67. package/dist/config.js.map +1 -0
  68. package/dist/deepLink.d.ts +86 -0
  69. package/dist/deepLink.d.ts.map +1 -0
  70. package/dist/deepLink.js +185 -0
  71. package/dist/deepLink.js.map +1 -0
  72. package/dist/fontFace.d.ts +70 -0
  73. package/dist/fontFace.d.ts.map +1 -0
  74. package/dist/fontFace.js +88 -0
  75. package/dist/fontFace.js.map +1 -0
  76. package/dist/gating.d.ts +32 -0
  77. package/dist/gating.d.ts.map +1 -0
  78. package/dist/gating.js +49 -0
  79. package/dist/gating.js.map +1 -0
  80. package/dist/icons.d.ts +68 -0
  81. package/dist/icons.d.ts.map +1 -0
  82. package/dist/icons.js +97 -0
  83. package/dist/icons.js.map +1 -0
  84. package/dist/index.d.ts +14 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +68 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/markdown.d.ts +59 -0
  89. package/dist/markdown.d.ts.map +1 -0
  90. package/dist/markdown.js +130 -0
  91. package/dist/markdown.js.map +1 -0
  92. package/dist/motion.d.ts +178 -0
  93. package/dist/motion.d.ts.map +1 -0
  94. package/dist/motion.js +302 -0
  95. package/dist/motion.js.map +1 -0
  96. package/dist/preferences.d.ts +71 -0
  97. package/dist/preferences.d.ts.map +1 -0
  98. package/dist/preferences.js +195 -0
  99. package/dist/preferences.js.map +1 -0
  100. package/dist/rasterise.d.ts +45 -0
  101. package/dist/rasterise.d.ts.map +1 -0
  102. package/dist/rasterise.js +490 -0
  103. package/dist/rasterise.js.map +1 -0
  104. package/dist/selector.d.ts +19 -0
  105. package/dist/selector.d.ts.map +1 -0
  106. package/dist/selector.js +142 -0
  107. package/dist/selector.js.map +1 -0
  108. package/dist/session.d.ts +19 -0
  109. package/dist/session.d.ts.map +1 -0
  110. package/dist/session.js +36 -0
  111. package/dist/session.js.map +1 -0
  112. package/dist/shortcut.d.ts +88 -0
  113. package/dist/shortcut.d.ts.map +1 -0
  114. package/dist/shortcut.js +149 -0
  115. package/dist/shortcut.js.map +1 -0
  116. package/dist/tokens.d.ts +709 -0
  117. package/dist/tokens.d.ts.map +1 -0
  118. package/dist/tokens.js +749 -0
  119. package/dist/tokens.js.map +1 -0
  120. package/dist/vendor/types/account.d.ts +26 -0
  121. package/dist/vendor/types/account.d.ts.map +1 -0
  122. package/dist/vendor/types/account.js +23 -0
  123. package/dist/vendor/types/account.js.map +1 -0
  124. package/dist/vendor/types/apiKey.d.ts +38 -0
  125. package/dist/vendor/types/apiKey.d.ts.map +1 -0
  126. package/dist/vendor/types/apiKey.js +36 -0
  127. package/dist/vendor/types/apiKey.js.map +1 -0
  128. package/dist/vendor/types/auth.d.ts +10 -0
  129. package/dist/vendor/types/auth.d.ts.map +1 -0
  130. package/dist/vendor/types/auth.js +15 -0
  131. package/dist/vendor/types/auth.js.map +1 -0
  132. package/dist/vendor/types/entity.d.ts +74 -0
  133. package/dist/vendor/types/entity.d.ts.map +1 -0
  134. package/dist/vendor/types/entity.js +111 -0
  135. package/dist/vendor/types/entity.js.map +1 -0
  136. package/dist/vendor/types/feedback.d.ts +285 -0
  137. package/dist/vendor/types/feedback.d.ts.map +1 -0
  138. package/dist/vendor/types/feedback.js +286 -0
  139. package/dist/vendor/types/feedback.js.map +1 -0
  140. package/dist/vendor/types/index.d.ts +14 -0
  141. package/dist/vendor/types/index.d.ts.map +1 -0
  142. package/dist/vendor/types/index.js +16 -0
  143. package/dist/vendor/types/index.js.map +1 -0
  144. package/dist/vendor/types/invite.d.ts +42 -0
  145. package/dist/vendor/types/invite.d.ts.map +1 -0
  146. package/dist/vendor/types/invite.js +30 -0
  147. package/dist/vendor/types/invite.js.map +1 -0
  148. package/dist/vendor/types/mcpToken.d.ts +38 -0
  149. package/dist/vendor/types/mcpToken.d.ts.map +1 -0
  150. package/dist/vendor/types/mcpToken.js +39 -0
  151. package/dist/vendor/types/mcpToken.js.map +1 -0
  152. package/dist/vendor/types/organization.d.ts +13 -0
  153. package/dist/vendor/types/organization.d.ts.map +1 -0
  154. package/dist/vendor/types/organization.js +12 -0
  155. package/dist/vendor/types/organization.js.map +1 -0
  156. package/dist/vendor/types/project.d.ts +73 -0
  157. package/dist/vendor/types/project.d.ts.map +1 -0
  158. package/dist/vendor/types/project.js +117 -0
  159. package/dist/vendor/types/project.js.map +1 -0
  160. package/dist/vendor/types/role.d.ts +12 -0
  161. package/dist/vendor/types/role.d.ts.map +1 -0
  162. package/dist/vendor/types/role.js +20 -0
  163. package/dist/vendor/types/role.js.map +1 -0
  164. package/dist/vendor/types/roleDefinition.d.ts +61 -0
  165. package/dist/vendor/types/roleDefinition.d.ts.map +1 -0
  166. package/dist/vendor/types/roleDefinition.js +45 -0
  167. package/dist/vendor/types/roleDefinition.js.map +1 -0
  168. package/dist/vendor/types/team.d.ts +25 -0
  169. package/dist/vendor/types/team.d.ts.map +1 -0
  170. package/dist/vendor/types/team.js +17 -0
  171. package/dist/vendor/types/team.js.map +1 -0
  172. package/dist/vendor/types/util.d.ts +39 -0
  173. package/dist/vendor/types/util.d.ts.map +1 -0
  174. package/dist/vendor/types/util.js +31 -0
  175. package/dist/vendor/types/util.js.map +1 -0
  176. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invite.d.ts","sourceRoot":"","sources":["../../../../types/src/invite.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;EAK7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,kBAAkB;;;;;;;iBAG7B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;iBAOvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,6DAA6D;AAC7D,eAAO,MAAM,eAAe,KAAK,CAAC"}
@@ -0,0 +1,30 @@
1
+ // Team invitation schemas. Create input validates the form submission; the
2
+ // Invite row itself is created server-side with a random token and
3
+ // expiresAt = now + 14 days. The public invite shape is returned by
4
+ // `/v1/team` so the UI can list pending invites.
5
+ import { z } from "zod";
6
+ import { roleSchema } from "./role.js";
7
+ export const inviteStatusSchema = z.enum([
8
+ "PENDING",
9
+ "ACCEPTED",
10
+ "REVOKED",
11
+ "EXPIRED",
12
+ ]);
13
+ export const inviteCreateSchema = z.object({
14
+ email: z.string().email(),
15
+ role: roleSchema,
16
+ });
17
+ export const inviteSchema = z.object({
18
+ id: z.string(),
19
+ email: z.string().email(),
20
+ role: roleSchema,
21
+ status: inviteStatusSchema,
22
+ expiresAt: z.coerce.date(),
23
+ createdAt: z.coerce.date(),
24
+ });
25
+ export const acceptInviteSchema = z.object({
26
+ token: z.string().min(1),
27
+ });
28
+ /** Invite TTL in days. 14 is generous but not indefinite. */
29
+ export const INVITE_TTL_DAYS = 14;
30
+ //# sourceMappingURL=invite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invite.js","sourceRoot":"","sources":["../../../../types/src/invite.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,mEAAmE;AACnE,oEAAoE;AACpE,iDAAiD;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,SAAS;IACT,UAAU;IACV,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,IAAI,EAAE,UAAU;CACjB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACzB,CAAC,CAAC;AAGH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ /** Every issued MCP token starts with this, so one is recognisable on sight. */
3
+ export declare const MCP_TOKEN_PREFIX = "bvm_";
4
+ /** Characters of the secret kept in the clear, for telling tokens apart. */
5
+ export declare const MCP_TOKEN_DISPLAY_PREFIX_LENGTH = 12;
6
+ export declare const mcpTokenCreateSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export type McpTokenCreateInput = z.infer<typeof mcpTokenCreateSchema>;
10
+ /** A token as the dashboard lists it. Never carries the secret. */
11
+ export declare const mcpTokenSchema: z.ZodObject<{
12
+ id: z.ZodString;
13
+ name: z.ZodString;
14
+ prefix: z.ZodString;
15
+ createdAt: z.ZodString;
16
+ lastUsedAt: z.ZodNullable<z.ZodString>;
17
+ revokedAt: z.ZodNullable<z.ZodString>;
18
+ }, z.core.$strip>;
19
+ export type McpTokenDTO = z.infer<typeof mcpTokenSchema>;
20
+ /**
21
+ * The response to minting a token: the row, plus the secret exactly once.
22
+ *
23
+ * Only the hash is stored, so this is the only moment the plaintext exists
24
+ * anywhere we control. The UI has to say so.
25
+ */
26
+ export declare const mcpTokenCreatedSchema: z.ZodObject<{
27
+ token: z.ZodObject<{
28
+ id: z.ZodString;
29
+ name: z.ZodString;
30
+ prefix: z.ZodString;
31
+ createdAt: z.ZodString;
32
+ lastUsedAt: z.ZodNullable<z.ZodString>;
33
+ revokedAt: z.ZodNullable<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ secret: z.ZodString;
36
+ }, z.core.$strip>;
37
+ export type McpTokenCreatedDTO = z.infer<typeof mcpTokenCreatedSchema>;
38
+ //# sourceMappingURL=mcpToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpToken.d.ts","sourceRoot":"","sources":["../../../../types/src/mcpToken.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAEvC,4EAA4E;AAC5E,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,eAAO,MAAM,oBAAoB;;iBAG/B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE,mEAAmE;AACnE,eAAO,MAAM,cAAc;;;;;;;iBAOzB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAGhC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ // Personal access tokens for the MCP server.
2
+ //
3
+ // A deliberately separate credential from the deploy key in `./apiKey`. The two
4
+ // look alike on the wire - both are bearer secrets shown once - and that is
5
+ // exactly why they must not be the same model. A deploy key is copied into
6
+ // every CI environment and can only upsert an empty project; an MCP token reads
7
+ // every piece of feedback its owner can reach and writes replies in their name.
8
+ // One model with a scope column would put the read-write credential one
9
+ // misconfiguration away from every build. Two models, two prefixes, two
10
+ // verifiers, and neither is accepted where the other belongs.
11
+ import { z } from "zod";
12
+ /** Every issued MCP token starts with this, so one is recognisable on sight. */
13
+ export const MCP_TOKEN_PREFIX = "bvm_";
14
+ /** Characters of the secret kept in the clear, for telling tokens apart. */
15
+ export const MCP_TOKEN_DISPLAY_PREFIX_LENGTH = 12;
16
+ export const mcpTokenCreateSchema = z.object({
17
+ // Named by a human so the list is readable a year later: whose agent this is.
18
+ name: z.string().trim().min(1, "Name is required").max(80),
19
+ });
20
+ /** A token as the dashboard lists it. Never carries the secret. */
21
+ export const mcpTokenSchema = z.object({
22
+ id: z.string(),
23
+ name: z.string(),
24
+ prefix: z.string(),
25
+ createdAt: z.string(),
26
+ lastUsedAt: z.string().nullable(),
27
+ revokedAt: z.string().nullable(),
28
+ });
29
+ /**
30
+ * The response to minting a token: the row, plus the secret exactly once.
31
+ *
32
+ * Only the hash is stored, so this is the only moment the plaintext exists
33
+ * anywhere we control. The UI has to say so.
34
+ */
35
+ export const mcpTokenCreatedSchema = z.object({
36
+ token: mcpTokenSchema,
37
+ secret: z.string(),
38
+ });
39
+ //# sourceMappingURL=mcpToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpToken.js","sourceRoot":"","sources":["../../../../types/src/mcpToken.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,2EAA2E;AAC3E,gFAAgF;AAChF,gFAAgF;AAChF,wEAAwE;AACxE,wEAAwE;AACxE,8DAA8D;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,8EAA8E;IAC9E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;CAC3D,CAAC,CAAC;AAGH,mEAAmE;AACnE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,cAAc;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ export declare const organizationSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ slug: z.ZodString;
6
+ createdAt: z.ZodCoercedDate<unknown>;
7
+ }, z.core.$strip>;
8
+ export type Organization = z.infer<typeof organizationSchema>;
9
+ export declare const updateOrganizationSchema: z.ZodObject<{
10
+ name: z.ZodString;
11
+ }, z.core.$strip>;
12
+ export type UpdateOrganizationInput = z.infer<typeof updateOrganizationSchema>;
13
+ //# sourceMappingURL=organization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../../types/src/organization.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;iBAK7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,wBAAwB;;iBAEnC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ // Organization (tenant) schemas.
2
+ import { z } from "zod";
3
+ export const organizationSchema = z.object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ slug: z.string(),
7
+ createdAt: z.coerce.date(),
8
+ });
9
+ export const updateOrganizationSchema = z.object({
10
+ name: z.string().trim().min(1).max(120),
11
+ });
12
+ //# sourceMappingURL=organization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../../types/src/organization.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Reduce a deployment URL to the identity two installs of the same deployment
4
+ * must agree on: scheme, lowercased host, and a non-default port. Path, query,
5
+ * fragment, credentials and the trailing slash are all dropped, because
6
+ * `https://app.example.com/dashboard?x=1` and `https://app.example.com` are the
7
+ * same deployment and must not become two projects.
8
+ *
9
+ * Returns null when the input is not a syntactically valid http(s) URL, which
10
+ * the route turns into a rejection rather than a nonsense project.
11
+ */
12
+ export declare function normalizeProjectUrl(raw: string): string | null;
13
+ /**
14
+ * What a toolbar install reports about itself on a project's first deploy.
15
+ * The git fields are the values Vercel populates from the repo's own remote;
16
+ * `packageName` is the fallback for a local or non-Vercel build, where neither
17
+ * is set.
18
+ */
19
+ export declare const projectRegisterSchema: z.ZodObject<{
20
+ url: z.ZodString;
21
+ repoOwner: z.ZodOptional<z.ZodString>;
22
+ repoSlug: z.ZodOptional<z.ZodString>;
23
+ packageName: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ export type ProjectRegisterInput = z.infer<typeof projectRegisterSchema>;
26
+ export declare const projectSchema: z.ZodObject<{
27
+ id: z.ZodString;
28
+ name: z.ZodString;
29
+ slug: z.ZodString;
30
+ url: z.ZodNullable<z.ZodString>;
31
+ repoOwner: z.ZodNullable<z.ZodString>;
32
+ repoSlug: z.ZodNullable<z.ZodString>;
33
+ createdAt: z.ZodString;
34
+ memberCount: z.ZodNumber;
35
+ }, z.core.$strip>;
36
+ export type ProjectDTO = z.infer<typeof projectSchema>;
37
+ export declare const projectUpdateSchema: z.ZodObject<{
38
+ name: z.ZodString;
39
+ }, z.core.$strip>;
40
+ export type ProjectUpdateInput = z.infer<typeof projectUpdateSchema>;
41
+ /**
42
+ * Name a project from what the installer could tell us, best source first:
43
+ * the git remote Vercel exposes, then the installing app's package name, then
44
+ * the host itself so a project is never nameless.
45
+ */
46
+ export declare function deriveProjectName(input: {
47
+ repoOwner?: string | undefined;
48
+ repoSlug?: string | undefined;
49
+ packageName?: string | undefined;
50
+ normalizedUrl: string;
51
+ }): string;
52
+ /** What the toolbar posts to ask for a sign-in link. */
53
+ export declare const toolbarSignInSchema: z.ZodObject<{
54
+ email: z.ZodString;
55
+ callbackUrl: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>;
57
+ export type ToolbarSignInInput = z.infer<typeof toolbarSignInSchema>;
58
+ /**
59
+ * The four answers to "can this visitor act on this project", each mapping to
60
+ * a different screen in the toolbar:
61
+ * signed_out - ask for a magic link
62
+ * no_project - this deployment has not registered yet, so wait for a build
63
+ * no_access - signed in, but not invited here: ask an admin
64
+ * ready - start writing
65
+ */
66
+ export declare const toolbarSessionStateSchema: z.ZodEnum<{
67
+ signed_out: "signed_out";
68
+ no_project: "no_project";
69
+ no_access: "no_access";
70
+ ready: "ready";
71
+ }>;
72
+ export type ToolbarSessionState = z.infer<typeof toolbarSessionStateSchema>;
73
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../types/src/project.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,aAAa;;;;;;;;;iBAoCxB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEvD,eAAO,MAAM,mBAAmB;;iBAE9B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAST;AAED,wDAAwD;AACxD,eAAO,MAAM,mBAAmB;;;iBAI9B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;;;EAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,117 @@
1
+ // Project (Organization) schemas for the deploy-time auto-registration
2
+ // endpoint and the admin screens that manage what it created.
3
+ import { z } from "zod";
4
+ /**
5
+ * Reduce a deployment URL to the identity two installs of the same deployment
6
+ * must agree on: scheme, lowercased host, and a non-default port. Path, query,
7
+ * fragment, credentials and the trailing slash are all dropped, because
8
+ * `https://app.example.com/dashboard?x=1` and `https://app.example.com` are the
9
+ * same deployment and must not become two projects.
10
+ *
11
+ * Returns null when the input is not a syntactically valid http(s) URL, which
12
+ * the route turns into a rejection rather than a nonsense project.
13
+ */
14
+ export function normalizeProjectUrl(raw) {
15
+ let parsed;
16
+ try {
17
+ parsed = new URL(raw.trim());
18
+ }
19
+ catch {
20
+ return null;
21
+ }
22
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:")
23
+ return null;
24
+ if (parsed.hostname.length === 0)
25
+ return null;
26
+ const port = parsed.port.length > 0 ? `:${parsed.port}` : "";
27
+ return `${parsed.protocol}//${parsed.hostname.toLowerCase()}${port}`;
28
+ }
29
+ /**
30
+ * What a toolbar install reports about itself on a project's first deploy.
31
+ * The git fields are the values Vercel populates from the repo's own remote;
32
+ * `packageName` is the fallback for a local or non-Vercel build, where neither
33
+ * is set.
34
+ */
35
+ export const projectRegisterSchema = z.object({
36
+ url: z.string().trim().min(1, "A project URL is required."),
37
+ repoOwner: z.string().trim().max(200).optional(),
38
+ repoSlug: z.string().trim().max(200).optional(),
39
+ packageName: z.string().trim().max(200).optional(),
40
+ });
41
+ export const projectSchema = z.object({
42
+ id: z.string(),
43
+ name: z.string(),
44
+ slug: z.string(),
45
+ url: z.string().nullable(),
46
+ /**
47
+ * The GitHub repository behind the deployment, as the installer's build
48
+ * environment reported it. Both nullable and INDEPENDENTLY so: a hand-made
49
+ * project has neither, and a link needs both, so every consumer checks the
50
+ * pair rather than assuming one implies the other.
51
+ *
52
+ * There is no provider field. Every install this product has is GitHub, and
53
+ * a GitLab one would want a different URL shape rather than a different
54
+ * host - a change to make when there is one to test against, not a column to
55
+ * guess at now.
56
+ */
57
+ repoOwner: z.string().nullable(),
58
+ repoSlug: z.string().nullable(),
59
+ createdAt: z.string(),
60
+ /**
61
+ * How many people hold a Membership in this project.
62
+ *
63
+ * REQUIRED, not `.optional()`, and that is the whole decision. Zero is a real
64
+ * answer here - an unadopted project genuinely has nobody on it, which is the
65
+ * fact the "waiting to be adopted" section exists to report - so an optional
66
+ * field would make "nobody is on this project" indistinguishable from "this
67
+ * response did not count". The projects list renders those two differently
68
+ * (a literal `0 reviewers` versus a rail cell that is dropped entirely), so
69
+ * the contract has to be able to tell them apart, and requiring the field is
70
+ * what forces every door that answers with a project to select the count
71
+ * rather than quietly omit it.
72
+ *
73
+ * `.int().nonnegative()` because it is a row count, same as
74
+ * `roleDefinitionSchema.memberCount`.
75
+ */
76
+ memberCount: z.number().int().nonnegative(),
77
+ });
78
+ export const projectUpdateSchema = z.object({
79
+ name: z.string().trim().min(1, "A name is required.").max(120),
80
+ });
81
+ /**
82
+ * Name a project from what the installer could tell us, best source first:
83
+ * the git remote Vercel exposes, then the installing app's package name, then
84
+ * the host itself so a project is never nameless.
85
+ */
86
+ export function deriveProjectName(input) {
87
+ const { repoOwner, repoSlug, packageName, normalizedUrl } = input;
88
+ if (repoSlug && repoSlug.length > 0) {
89
+ return repoOwner && repoOwner.length > 0
90
+ ? `${repoOwner}/${repoSlug}`
91
+ : repoSlug;
92
+ }
93
+ if (packageName && packageName.length > 0)
94
+ return packageName;
95
+ return new URL(normalizedUrl).hostname;
96
+ }
97
+ /** What the toolbar posts to ask for a sign-in link. */
98
+ export const toolbarSignInSchema = z.object({
99
+ email: z.string().email("Enter a valid email address."),
100
+ /** Where the emailed link should land. Defaults to the dashboard. */
101
+ callbackUrl: z.string().trim().max(2000).optional(),
102
+ });
103
+ /**
104
+ * The four answers to "can this visitor act on this project", each mapping to
105
+ * a different screen in the toolbar:
106
+ * signed_out - ask for a magic link
107
+ * no_project - this deployment has not registered yet, so wait for a build
108
+ * no_access - signed in, but not invited here: ask an admin
109
+ * ready - start writing
110
+ */
111
+ export const toolbarSessionStateSchema = z.enum([
112
+ "signed_out",
113
+ "no_project",
114
+ "no_access",
115
+ "ready",
116
+ ]);
117
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../types/src/project.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ export declare const roleSchema: z.ZodEnum<{
3
+ OWNER: "OWNER";
4
+ ADMIN: "ADMIN";
5
+ MEMBER: "MEMBER";
6
+ }>;
7
+ export type Role = z.infer<typeof roleSchema>;
8
+ /** Ordered for UI display — owner first, member last. */
9
+ export declare const ROLE_ORDER: readonly Role[];
10
+ export declare const ROLE_LABELS: Record<Role, string>;
11
+ export declare const ROLE_DESCRIPTIONS: Record<Role, string>;
12
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../../types/src/role.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;EAAuC,CAAC;AAC/D,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,yDAAyD;AACzD,eAAO,MAAM,UAAU,EAAE,SAAS,IAAI,EAAiC,CAAC;AAExE,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAI5C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAIlD,CAAC"}
@@ -0,0 +1,20 @@
1
+ // Team roles within an organization, gated by a fixed permission matrix
2
+ // (see `@bitvea/auth/permissions`).
3
+ //
4
+ // Source of truth; the Prisma `Role` enum is kept in agreement by the drift
5
+ // guard in `packages/api/src/__tests__/enum-drift-guard.test.ts`.
6
+ import { z } from "zod";
7
+ export const roleSchema = z.enum(["OWNER", "ADMIN", "MEMBER"]);
8
+ /** Ordered for UI display — owner first, member last. */
9
+ export const ROLE_ORDER = ["OWNER", "ADMIN", "MEMBER"];
10
+ export const ROLE_LABELS = {
11
+ OWNER: "Owner",
12
+ ADMIN: "Admin",
13
+ MEMBER: "Member",
14
+ };
15
+ export const ROLE_DESCRIPTIONS = {
16
+ OWNER: "Full access - manage the organization, members, and all resources.",
17
+ ADMIN: "Manage members and resources, but not delete the organization.",
18
+ MEMBER: "Standard access. Cannot manage members.",
19
+ };
20
+ //# sourceMappingURL=role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.js","sourceRoot":"","sources":["../../../../types/src/role.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,oCAAoC;AACpC,EAAE;AACF,4EAA4E;AAC5E,kEAAkE;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAG/D,yDAAyD;AACzD,MAAM,CAAC,MAAM,UAAU,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAyB;IACrD,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,gEAAgE;IACvE,MAAM,EAAE,yCAAyC;CAClD,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ /** Create a custom role with an initial permission set. */
3
+ export declare const roleDefinitionCreateSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
6
+ entity: z.ZodEnum<{
7
+ feedback: "feedback";
8
+ pin: "pin";
9
+ member: "member";
10
+ setting: "setting";
11
+ }>;
12
+ canRead: z.ZodBoolean;
13
+ canWrite: z.ZodBoolean;
14
+ }, z.core.$strip>>>>;
15
+ }, z.core.$strip>;
16
+ export type RoleDefinitionCreateInput = z.infer<typeof roleDefinitionCreateSchema>;
17
+ /** Update a custom role's name and/or its full permission set. */
18
+ export declare const roleDefinitionUpdateSchema: z.ZodObject<{
19
+ name: z.ZodOptional<z.ZodString>;
20
+ permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
21
+ entity: z.ZodEnum<{
22
+ feedback: "feedback";
23
+ pin: "pin";
24
+ member: "member";
25
+ setting: "setting";
26
+ }>;
27
+ canRead: z.ZodBoolean;
28
+ canWrite: z.ZodBoolean;
29
+ }, z.core.$strip>>>;
30
+ }, z.core.$strip>;
31
+ export type RoleDefinitionUpdateInput = z.infer<typeof roleDefinitionUpdateSchema>;
32
+ /** Assign (or clear, with null) a custom role on a member. */
33
+ export declare const assignRoleDefinitionSchema: z.ZodObject<{
34
+ roleDefinitionId: z.ZodNullable<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ export type AssignRoleDefinitionInput = z.infer<typeof assignRoleDefinitionSchema>;
37
+ /** Wire shape returned by the roles list/detail endpoints. */
38
+ export declare const roleDefinitionSchema: z.ZodObject<{
39
+ id: z.ZodString;
40
+ name: z.ZodString;
41
+ slug: z.ZodString;
42
+ isSystem: z.ZodBoolean;
43
+ systemRole: z.ZodNullable<z.ZodEnum<{
44
+ OWNER: "OWNER";
45
+ ADMIN: "ADMIN";
46
+ MEMBER: "MEMBER";
47
+ }>>;
48
+ permissions: z.ZodArray<z.ZodObject<{
49
+ entity: z.ZodEnum<{
50
+ feedback: "feedback";
51
+ pin: "pin";
52
+ member: "member";
53
+ setting: "setting";
54
+ }>;
55
+ canRead: z.ZodBoolean;
56
+ canWrite: z.ZodBoolean;
57
+ }, z.core.$strip>>;
58
+ memberCount: z.ZodNumber;
59
+ }, z.core.$strip>;
60
+ export type RoleDefinitionDTO = z.infer<typeof roleDefinitionSchema>;
61
+ //# sourceMappingURL=roleDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roleDefinition.d.ts","sourceRoot":"","sources":["../../../../types/src/roleDefinition.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;iBAIrC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,0BAA0B,CAClC,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;iBAQpC,CAAC;AACJ,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,0BAA0B,CAClC,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B;;iBAErC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,0BAA0B,CAClC,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;iBAS/B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ // DTOs for the role-management API (`/api/v1/roles`).
2
+ //
3
+ // A RoleDefinition is a named bundle of per-entity read/write permissions scoped
4
+ // to one organization. Three are seeded per org as `isSystem` mirrors of the
5
+ // OWNER/ADMIN/MEMBER enum roles (their permissions are read-only in the UI);
6
+ // owners can create additional custom roles and assign them to members to refine
7
+ // entity access beyond the system defaults.
8
+ import { z } from "zod";
9
+ import { entityPermissionSchema } from "./entity.js";
10
+ import { roleSchema } from "./role.js";
11
+ /** Role name: human label. Slug is derived server-side. */
12
+ const roleNameSchema = z
13
+ .string()
14
+ .trim()
15
+ .min(2, "Name must be at least 2 characters.")
16
+ .max(50, "Name must be at most 50 characters.");
17
+ /** Create a custom role with an initial permission set. */
18
+ export const roleDefinitionCreateSchema = z.object({
19
+ name: roleNameSchema,
20
+ // Permissions are optional on create — omitted ⇒ no access until edited.
21
+ permissions: z.array(entityPermissionSchema).optional().default([]),
22
+ });
23
+ /** Update a custom role's name and/or its full permission set. */
24
+ export const roleDefinitionUpdateSchema = z
25
+ .object({
26
+ name: roleNameSchema.optional(),
27
+ permissions: z.array(entityPermissionSchema).optional(),
28
+ })
29
+ .refine((v) => v.name !== undefined || v.permissions !== undefined, "Provide a name or permissions to update.");
30
+ /** Assign (or clear, with null) a custom role on a member. */
31
+ export const assignRoleDefinitionSchema = z.object({
32
+ roleDefinitionId: z.string().min(1).nullable(),
33
+ });
34
+ /** Wire shape returned by the roles list/detail endpoints. */
35
+ export const roleDefinitionSchema = z.object({
36
+ id: z.string(),
37
+ name: z.string(),
38
+ slug: z.string(),
39
+ isSystem: z.boolean(),
40
+ // For system roles, which enum role this mirrors; null for custom roles.
41
+ systemRole: roleSchema.nullable(),
42
+ permissions: z.array(entityPermissionSchema),
43
+ memberCount: z.number().int().nonnegative(),
44
+ });
45
+ //# sourceMappingURL=roleDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roleDefinition.js","sourceRoot":"","sources":["../../../../types/src/roleDefinition.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAC7E,6EAA6E;AAC7E,iFAAiF;AACjF,4CAA4C;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,2DAA2D;AAC3D,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,EAAE,qCAAqC,CAAC;KAC7C,GAAG,CAAC,EAAE,EAAE,qCAAqC,CAAC,CAAC;AAElD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,cAAc;IACpB,yEAAyE;IACzE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACpE,CAAC,CAAC;AAKH,kEAAkE;AAClE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,CAAC;IACN,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;CACxD,CAAC;KACD,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS,EAC1D,0CAA0C,CAC3C,CAAC;AAKJ,8DAA8D;AAC9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAKH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,yEAAyE;IACzE,UAAU,EAAE,UAAU,CAAC,QAAQ,EAAE;IACjC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC5C,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ /** A member of the active organization, returned by `/v1/team`. */
3
+ export declare const memberSchema: z.ZodObject<{
4
+ membershipId: z.ZodString;
5
+ userId: z.ZodString;
6
+ email: z.ZodString;
7
+ name: z.ZodString;
8
+ image: z.ZodNullable<z.ZodString>;
9
+ role: z.ZodEnum<{
10
+ OWNER: "OWNER";
11
+ ADMIN: "ADMIN";
12
+ MEMBER: "MEMBER";
13
+ }>;
14
+ createdAt: z.ZodCoercedDate<unknown>;
15
+ }, z.core.$strip>;
16
+ export type Member = z.infer<typeof memberSchema>;
17
+ export declare const updateMemberRoleSchema: z.ZodObject<{
18
+ role: z.ZodEnum<{
19
+ OWNER: "OWNER";
20
+ ADMIN: "ADMIN";
21
+ MEMBER: "MEMBER";
22
+ }>;
23
+ }, z.core.$strip>;
24
+ export type UpdateMemberRoleInput = z.infer<typeof updateMemberRoleSchema>;
25
+ //# sourceMappingURL=team.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../../../types/src/team.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,mEAAmE;AACnE,eAAO,MAAM,YAAY;;;;;;;;;;;;iBAQvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,sBAAsB;;;;;;iBAEjC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ // Team membership schemas — the members of an organization.
2
+ import { z } from "zod";
3
+ import { roleSchema } from "./role.js";
4
+ /** A member of the active organization, returned by `/v1/team`. */
5
+ export const memberSchema = z.object({
6
+ membershipId: z.string(),
7
+ userId: z.string(),
8
+ email: z.string().email(),
9
+ name: z.string(),
10
+ image: z.string().nullable(),
11
+ role: roleSchema,
12
+ createdAt: z.coerce.date(),
13
+ });
14
+ export const updateMemberRoleSchema = z.object({
15
+ role: roleSchema,
16
+ });
17
+ //# sourceMappingURL=team.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.js","sourceRoot":"","sources":["../../../../types/src/team.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,IAAI,EAAE,UAAU;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,UAAU;CACjB,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Read a text field out of a `FormData`.
4
+ *
5
+ * `FormData.get` is typed `string | File | null`, so `String(fd.get("name"))`
6
+ * on a field the browser filled with a file yields the literal
7
+ * `"[object Object]"` and that string goes on to be validated and stored. A
8
+ * file where text was expected is a malformed submission, so it reads as
9
+ * absent rather than as nonsense.
10
+ */
11
+ export declare function formText(form: FormData, field: string): string;
12
+ /** Discriminated result for Server Actions. */
13
+ export type ActionResult<T = void> = {
14
+ ok: true;
15
+ data?: T;
16
+ } | {
17
+ ok: false;
18
+ error: string;
19
+ fieldErrors?: Record<string, string>;
20
+ };
21
+ /** Standard error wire shape returned by the API (`{ error: code }`). */
22
+ export declare const apiErrorSchema: z.ZodObject<{
23
+ error: z.ZodString;
24
+ }, z.core.$strip>;
25
+ export type ApiError = z.infer<typeof apiErrorSchema>;
26
+ /** Reusable cursor/offset pagination query. */
27
+ export declare const paginationQuerySchema: z.ZodObject<{
28
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
29
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
30
+ }, z.core.$strip>;
31
+ export type PaginationQuery = z.infer<typeof paginationQuerySchema>;
32
+ /** Generic paginated envelope. */
33
+ export declare const paginated: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
34
+ items: z.ZodArray<T>;
35
+ page: z.ZodNumber;
36
+ pageSize: z.ZodNumber;
37
+ total: z.ZodNumber;
38
+ }, z.core.$strip>;
39
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../types/src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,+CAA+C;AAC/C,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,IAAI,IAC7B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAA;CAAE,GACtB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEvE,yEAAyE;AACzE,eAAO,MAAM,cAAc;;iBAEzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,kCAAkC;AAClC,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;;;;iBAMrD,CAAC"}