@intlayer/backend-contract 0.0.0-stage → 9.7.0

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 (252) hide show
  1. package/dist/cjs/ai.cjs +267 -0
  2. package/dist/cjs/ai.cjs.map +1 -0
  3. package/dist/cjs/analytics.cjs +175 -0
  4. package/dist/cjs/analytics.cjs.map +1 -0
  5. package/dist/cjs/asset.cjs +88 -0
  6. package/dist/cjs/asset.cjs.map +1 -0
  7. package/dist/cjs/blogComment.cjs +98 -0
  8. package/dist/cjs/blogComment.cjs.map +1 -0
  9. package/dist/cjs/cliSessionToken.cjs +40 -0
  10. package/dist/cjs/cliSessionToken.cjs.map +1 -0
  11. package/dist/cjs/common.cjs +42 -0
  12. package/dist/cjs/common.cjs.map +1 -0
  13. package/dist/cjs/defineRoute.cjs +26 -0
  14. package/dist/cjs/defineRoute.cjs.map +1 -0
  15. package/dist/cjs/demo.cjs +22 -0
  16. package/dist/cjs/demo.cjs.map +1 -0
  17. package/dist/cjs/dictionary.cjs +168 -0
  18. package/dist/cjs/dictionary.cjs.map +1 -0
  19. package/dist/cjs/environment.cjs +91 -0
  20. package/dist/cjs/environment.cjs.map +1 -0
  21. package/dist/cjs/eventListener.cjs +19 -0
  22. package/dist/cjs/eventListener.cjs.map +1 -0
  23. package/dist/cjs/gitProviders.cjs +361 -0
  24. package/dist/cjs/gitProviders.cjs.map +1 -0
  25. package/dist/cjs/newsletter.cjs +50 -0
  26. package/dist/cjs/newsletter.cjs.map +1 -0
  27. package/dist/cjs/oAuth2.cjs +62 -0
  28. package/dist/cjs/oAuth2.cjs.map +1 -0
  29. package/dist/cjs/organization.cjs +226 -0
  30. package/dist/cjs/organization.cjs.map +1 -0
  31. package/dist/cjs/project.cjs +401 -0
  32. package/dist/cjs/project.cjs.map +1 -0
  33. package/dist/cjs/public.cjs +60 -0
  34. package/dist/cjs/public.cjs.map +1 -0
  35. package/dist/cjs/responseData.cjs +33 -0
  36. package/dist/cjs/responseData.cjs.map +1 -0
  37. package/dist/cjs/reviewer.cjs +401 -0
  38. package/dist/cjs/reviewer.cjs.map +1 -0
  39. package/dist/cjs/scan.cjs +235 -0
  40. package/dist/cjs/scan.cjs.map +1 -0
  41. package/dist/cjs/search.cjs +40 -0
  42. package/dist/cjs/search.cjs.map +1 -0
  43. package/dist/cjs/session.cjs +56 -0
  44. package/dist/cjs/session.cjs.map +1 -0
  45. package/dist/cjs/showcaseProject.cjs +185 -0
  46. package/dist/cjs/showcaseProject.cjs.map +1 -0
  47. package/dist/cjs/stripe.cjs +388 -0
  48. package/dist/cjs/stripe.cjs.map +1 -0
  49. package/dist/cjs/tag.cjs +83 -0
  50. package/dist/cjs/tag.cjs.map +1 -0
  51. package/dist/cjs/translation.cjs +54 -0
  52. package/dist/cjs/translation.cjs.map +1 -0
  53. package/dist/cjs/user.cjs +153 -0
  54. package/dist/cjs/user.cjs.map +1 -0
  55. package/dist/esm/ai.mjs +261 -0
  56. package/dist/esm/ai.mjs.map +1 -0
  57. package/dist/esm/analytics.mjs +168 -0
  58. package/dist/esm/analytics.mjs.map +1 -0
  59. package/dist/esm/asset.mjs +86 -0
  60. package/dist/esm/asset.mjs.map +1 -0
  61. package/dist/esm/blogComment.mjs +94 -0
  62. package/dist/esm/blogComment.mjs.map +1 -0
  63. package/dist/esm/cliSessionToken.mjs +39 -0
  64. package/dist/esm/cliSessionToken.mjs.map +1 -0
  65. package/dist/esm/common.mjs +35 -0
  66. package/dist/esm/common.mjs.map +1 -0
  67. package/dist/esm/defineRoute.mjs +23 -0
  68. package/dist/esm/defineRoute.mjs.map +1 -0
  69. package/dist/esm/demo.mjs +21 -0
  70. package/dist/esm/demo.mjs.map +1 -0
  71. package/dist/esm/dictionary.mjs +163 -0
  72. package/dist/esm/dictionary.mjs.map +1 -0
  73. package/dist/esm/environment.mjs +90 -0
  74. package/dist/esm/environment.mjs.map +1 -0
  75. package/dist/esm/eventListener.mjs +18 -0
  76. package/dist/esm/eventListener.mjs.map +1 -0
  77. package/dist/esm/gitProviders.mjs +352 -0
  78. package/dist/esm/gitProviders.mjs.map +1 -0
  79. package/dist/esm/newsletter.mjs +49 -0
  80. package/dist/esm/newsletter.mjs.map +1 -0
  81. package/dist/esm/oAuth2.mjs +60 -0
  82. package/dist/esm/oAuth2.mjs.map +1 -0
  83. package/dist/esm/organization.mjs +219 -0
  84. package/dist/esm/organization.mjs.map +1 -0
  85. package/dist/esm/project.mjs +387 -0
  86. package/dist/esm/project.mjs.map +1 -0
  87. package/dist/esm/public.mjs +58 -0
  88. package/dist/esm/public.mjs.map +1 -0
  89. package/dist/esm/responseData.mjs +30 -0
  90. package/dist/esm/responseData.mjs.map +1 -0
  91. package/dist/esm/reviewer.mjs +390 -0
  92. package/dist/esm/reviewer.mjs.map +1 -0
  93. package/dist/esm/scan.mjs +225 -0
  94. package/dist/esm/scan.mjs.map +1 -0
  95. package/dist/esm/search.mjs +38 -0
  96. package/dist/esm/search.mjs.map +1 -0
  97. package/dist/esm/session.mjs +53 -0
  98. package/dist/esm/session.mjs.map +1 -0
  99. package/dist/esm/showcaseProject.mjs +182 -0
  100. package/dist/esm/showcaseProject.mjs.map +1 -0
  101. package/dist/esm/stripe.mjs +379 -0
  102. package/dist/esm/stripe.mjs.map +1 -0
  103. package/dist/esm/tag.mjs +81 -0
  104. package/dist/esm/tag.mjs.map +1 -0
  105. package/dist/esm/translation.mjs +53 -0
  106. package/dist/esm/translation.mjs.map +1 -0
  107. package/dist/esm/user.mjs +149 -0
  108. package/dist/esm/user.mjs.map +1 -0
  109. package/dist/types/@intlayer/config/dist/types/defaultValues/dictionary.d.ts +1 -0
  110. package/dist/types/@intlayer/config/dist/types/defaultValues/index.d.ts +3 -0
  111. package/dist/types/@intlayer/config/dist/types/defaultValues/internationalization.d.ts +2 -0
  112. package/dist/types/@intlayer/config/dist/types/defaultValues/routing.d.ts +1 -0
  113. package/dist/types/@intlayer/core/dist/types/dictionaryManipulator/plainDynamicLoader.d.ts +2 -0
  114. package/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +2 -0
  115. package/dist/types/@intlayer/core/dist/types/formatters/compact.d.ts +1 -0
  116. package/dist/types/@intlayer/core/dist/types/formatters/currency.d.ts +1 -0
  117. package/dist/types/@intlayer/core/dist/types/formatters/date.d.ts +1 -0
  118. package/dist/types/@intlayer/core/dist/types/formatters/index.d.ts +9 -0
  119. package/dist/types/@intlayer/core/dist/types/formatters/list.d.ts +1 -0
  120. package/dist/types/@intlayer/core/dist/types/formatters/number.d.ts +1 -0
  121. package/dist/types/@intlayer/core/dist/types/formatters/percentage.d.ts +1 -0
  122. package/dist/types/@intlayer/core/dist/types/formatters/relativeTime.d.ts +1 -0
  123. package/dist/types/@intlayer/core/dist/types/formatters/units.d.ts +1 -0
  124. package/dist/types/@intlayer/core/dist/types/interpreter/dictionaryTransformCache.d.ts +4 -0
  125. package/dist/types/@intlayer/core/dist/types/interpreter/getCondition.d.ts +2 -0
  126. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/deepTransform.d.ts +1 -0
  127. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/getContent.d.ts +3 -0
  128. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/index.d.ts +3 -0
  129. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/plugins.d.ts +7 -0
  130. package/dist/types/@intlayer/core/dist/types/interpreter/getDictionary.d.ts +4 -0
  131. package/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +6 -0
  132. package/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +2 -0
  133. package/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +2 -0
  134. package/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +2 -0
  135. package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayer.d.ts +4 -0
  136. package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayerAsync.d.ts +4 -0
  137. package/dist/types/@intlayer/core/dist/types/interpreter/getNesting.d.ts +6 -0
  138. package/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +3 -0
  139. package/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +2 -0
  140. package/dist/types/@intlayer/core/dist/types/interpreter/getTranslation.d.ts +1 -0
  141. package/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +19 -0
  142. package/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +2 -0
  143. package/dist/types/@intlayer/core/dist/types/interpreter/resolveInterpreterLocale.d.ts +1 -0
  144. package/dist/types/@intlayer/core/dist/types/localization/comparePaths.d.ts +1 -0
  145. package/dist/types/@intlayer/core/dist/types/localization/domainUtils.d.ts +2 -0
  146. package/dist/types/@intlayer/core/dist/types/localization/generateSitemap.d.ts +2 -0
  147. package/dist/types/@intlayer/core/dist/types/localization/getBrowserLocale.d.ts +1 -0
  148. package/dist/types/@intlayer/core/dist/types/localization/getCanonicalPath.d.ts +2 -0
  149. package/dist/types/@intlayer/core/dist/types/localization/getHTMLTextDir.d.ts +1 -0
  150. package/dist/types/@intlayer/core/dist/types/localization/getLocale.d.ts +1 -0
  151. package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromPath.d.ts +2 -0
  152. package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromRequest.d.ts +1 -0
  153. package/dist/types/@intlayer/core/dist/types/localization/getLocaleLang.d.ts +1 -0
  154. package/dist/types/@intlayer/core/dist/types/localization/getLocaleName.d.ts +1 -0
  155. package/dist/types/@intlayer/core/dist/types/localization/getLocalizedPath.d.ts +2 -0
  156. package/dist/types/@intlayer/core/dist/types/localization/getLocalizedUrl.d.ts +2 -0
  157. package/dist/types/@intlayer/core/dist/types/localization/getMultilingualUrls.d.ts +2 -0
  158. package/dist/types/@intlayer/core/dist/types/localization/getPathWithoutLocale.d.ts +1 -0
  159. package/dist/types/@intlayer/core/dist/types/localization/getPrefix.d.ts +2 -0
  160. package/dist/types/@intlayer/core/dist/types/localization/index.d.ts +23 -0
  161. package/dist/types/@intlayer/core/dist/types/localization/localeDetector.d.ts +2 -0
  162. package/dist/types/@intlayer/core/dist/types/localization/localeMapper.d.ts +1 -0
  163. package/dist/types/@intlayer/core/dist/types/localization/localeResolver.d.ts +1 -0
  164. package/dist/types/@intlayer/core/dist/types/localization/resolveBrowserLocale.d.ts +2 -0
  165. package/dist/types/@intlayer/core/dist/types/localization/rewriteMatch.d.ts +1 -0
  166. package/dist/types/@intlayer/core/dist/types/localization/rewriteUtils.d.ts +2 -0
  167. package/dist/types/@intlayer/core/dist/types/localization/validatePrefix.d.ts +2 -0
  168. package/dist/types/@intlayer/core/dist/types/markdown/index.d.ts +2 -0
  169. package/dist/types/@intlayer/core/dist/types/transpiler/condition/condition.d.ts +1 -0
  170. package/dist/types/@intlayer/core/dist/types/transpiler/condition/index.d.ts +1 -0
  171. package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/enumeration.d.ts +1 -0
  172. package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/index.d.ts +1 -0
  173. package/dist/types/@intlayer/core/dist/types/transpiler/file/file.d.ts +1 -0
  174. package/dist/types/@intlayer/core/dist/types/transpiler/file/index.d.ts +1 -0
  175. package/dist/types/@intlayer/core/dist/types/transpiler/gender/gender.d.ts +1 -0
  176. package/dist/types/@intlayer/core/dist/types/transpiler/gender/index.d.ts +1 -0
  177. package/dist/types/@intlayer/core/dist/types/transpiler/html/html.d.ts +1 -0
  178. package/dist/types/@intlayer/core/dist/types/transpiler/html/index.d.ts +1 -0
  179. package/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +22 -0
  180. package/dist/types/@intlayer/core/dist/types/transpiler/insertion/index.d.ts +1 -0
  181. package/dist/types/@intlayer/core/dist/types/transpiler/insertion/insertion.d.ts +1 -0
  182. package/dist/types/@intlayer/core/dist/types/transpiler/markdown/index.d.ts +1 -0
  183. package/dist/types/@intlayer/core/dist/types/transpiler/markdown/markdown.d.ts +1 -0
  184. package/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +1 -0
  185. package/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +4 -0
  186. package/dist/types/@intlayer/core/dist/types/transpiler/plural/index.d.ts +1 -0
  187. package/dist/types/@intlayer/core/dist/types/transpiler/plural/plural.d.ts +1 -0
  188. package/dist/types/@intlayer/core/dist/types/transpiler/select/index.d.ts +1 -0
  189. package/dist/types/@intlayer/core/dist/types/transpiler/select/select.d.ts +1 -0
  190. package/dist/types/@intlayer/core/dist/types/transpiler/translation/index.d.ts +1 -0
  191. package/dist/types/@intlayer/core/dist/types/transpiler/translation/translation.d.ts +2 -0
  192. package/dist/types/@intlayer/core/dist/types/utils/index.d.ts +3 -0
  193. package/dist/types/@intlayer/core/dist/types/utils/intl.d.ts +1 -0
  194. package/dist/types/@intlayer/core/dist/types/utils/isSameKeyPath.d.ts +1 -0
  195. package/dist/types/@intlayer/core/dist/types/utils/localeStorage.d.ts +2 -0
  196. package/dist/types/ai.d.ts +549 -0
  197. package/dist/types/ai.d.ts.map +1 -0
  198. package/dist/types/analytics.d.ts +378 -0
  199. package/dist/types/analytics.d.ts.map +1 -0
  200. package/dist/types/asset.d.ts +207 -0
  201. package/dist/types/asset.d.ts.map +1 -0
  202. package/dist/types/blogComment.d.ts +241 -0
  203. package/dist/types/blogComment.d.ts.map +1 -0
  204. package/dist/types/cliSessionToken.d.ts +264 -0
  205. package/dist/types/cliSessionToken.d.ts.map +1 -0
  206. package/dist/types/common.d.ts +32 -0
  207. package/dist/types/common.d.ts.map +1 -0
  208. package/dist/types/defineRoute.d.ts +57 -0
  209. package/dist/types/defineRoute.d.ts.map +1 -0
  210. package/dist/types/demo.d.ts +21 -0
  211. package/dist/types/demo.d.ts.map +1 -0
  212. package/dist/types/dictionary.d.ts +360 -0
  213. package/dist/types/dictionary.d.ts.map +1 -0
  214. package/dist/types/environment.d.ts +285 -0
  215. package/dist/types/environment.d.ts.map +1 -0
  216. package/dist/types/eventListener.d.ts +17 -0
  217. package/dist/types/eventListener.d.ts.map +1 -0
  218. package/dist/types/gitProviders.d.ts +807 -0
  219. package/dist/types/gitProviders.d.ts.map +1 -0
  220. package/dist/types/intlayer/dist/types/index.d.ts +13 -0
  221. package/dist/types/newsletter.d.ts +165 -0
  222. package/dist/types/newsletter.d.ts.map +1 -0
  223. package/dist/types/oAuth2.d.ts +482 -0
  224. package/dist/types/oAuth2.d.ts.map +1 -0
  225. package/dist/types/organization.d.ts +1069 -0
  226. package/dist/types/organization.d.ts.map +1 -0
  227. package/dist/types/project.d.ts +1735 -0
  228. package/dist/types/project.d.ts.map +1 -0
  229. package/dist/types/public.d.ts +109 -0
  230. package/dist/types/public.d.ts.map +1 -0
  231. package/dist/types/responseData.d.ts +68 -0
  232. package/dist/types/responseData.d.ts.map +1 -0
  233. package/dist/types/reviewer.d.ts +1239 -0
  234. package/dist/types/reviewer.d.ts.map +1 -0
  235. package/dist/types/scan.d.ts +625 -0
  236. package/dist/types/scan.d.ts.map +1 -0
  237. package/dist/types/search.d.ts +55 -0
  238. package/dist/types/search.d.ts.map +1 -0
  239. package/dist/types/session.d.ts +286 -0
  240. package/dist/types/session.d.ts.map +1 -0
  241. package/dist/types/showcaseProject.d.ts +550 -0
  242. package/dist/types/showcaseProject.d.ts.map +1 -0
  243. package/dist/types/stripe.d.ts +1219 -0
  244. package/dist/types/stripe.d.ts.map +1 -0
  245. package/dist/types/tag.d.ts +193 -0
  246. package/dist/types/tag.d.ts.map +1 -0
  247. package/dist/types/translation.d.ts +162 -0
  248. package/dist/types/translation.d.ts.map +1 -0
  249. package/dist/types/user.d.ts +447 -0
  250. package/dist/types/user.d.ts.map +1 -0
  251. package/package.json +300 -4
  252. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.cjs","names":["typedStringSchema","z","typedValueSchema","dateTimeSchema","objectIdSchema","defineRouteGroup","defineRoute","paginationQueryShape","repeatableQueryValueSchema","paginatedResponseSchema","responseDataSchema"],"sources":["../../src/project.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { AiConfig, URLType } from '@intlayer/types/config';\nimport { z } from 'zod/mini';\nimport {\n dateTimeSchema,\n objectIdSchema,\n paginationQueryShape,\n repeatableQueryValueSchema,\n typedStringSchema,\n typedValueSchema,\n} from './common';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBody,\n type RouteBodyInput,\n type RouteParams,\n type RouteQuerystring,\n} from './defineRoute';\nimport {\n type PaginatedResponse,\n paginatedResponseSchema,\n type ResponseData,\n responseDataSchema,\n} from './responseData';\n\n/** Locale code (ex: `en`, `fr-CA`). */\nexport const localeSchema = typedStringSchema<Locale>();\n\n/** Project AI settings: the Intlayer AI config plus the masked key state. */\nexport type ProjectConfigAI = Partial<AiConfig> & {\n /** Masked API key (`sk-proj-****abcd`), never the real one. */\n apiKey?: string;\n apiKeyConfigured?: boolean;\n};\n\n/**\n * Project-level overrides of the Intlayer configuration. Loose objects: the\n * CLI pushes whole config sections, unknown keys must reach the service.\n */\nexport const projectConfigurationSchema = z.looseObject({\n internationalization: z.optional(\n z.looseObject({\n locales: z.optional(z.array(localeSchema)),\n defaultLocale: z.optional(localeSchema),\n })\n ),\n editor: z.optional(\n z.looseObject({\n applicationURL: z.optional(typedStringSchema<URLType>()),\n cmsURL: z.optional(typedStringSchema<URLType>()),\n })\n ),\n ai: z.optional(typedValueSchema<ProjectConfigAI>()),\n});\n\n/** Generic build webhook (Vercel, Netlify, custom). */\nexport const webhookSchema = z.looseObject({\n id: z.optional(z.string()),\n name: z.string(),\n url: z.string(),\n enabled: z.optional(z.boolean()),\n /** Optional signature secret. */\n secret: z.optional(z.string()),\n});\n\n/** Build triggers: git provider pipeline + generic webhooks. */\nexport const projectCISchema = z.object({\n autoTriggerBuilds: z.optional(z.boolean()),\n /** Commit CMS edits of `hybrid` dictionaries back to their source file. */\n autoCommitDictionaries: z.optional(z.boolean()),\n webhooks: z.optional(z.array(webhookSchema)),\n});\n\n/** Git provider of a connected repository. */\nexport const repositoryProviderSchema = z.enum([\n 'github',\n 'gitlab',\n 'bitbucket',\n 'codeberg',\n 'gitee',\n]);\n\nconst baseRepositoryShape = {\n owner: z.string(),\n repository: z.string(),\n branch: z.string(),\n url: z.string(),\n configFilePath: z.string(),\n};\n\n/**\n * Git repository connected to a project. The repo-scoped token never leaves\n * the server.\n */\nexport const repositoryConnectionSchema = z.discriminatedUnion('provider', [\n z.looseObject({\n provider: z.literal('github'),\n ...baseRepositoryShape,\n installationId: z.optional(z.number()),\n }),\n z.looseObject({\n provider: z.literal('gitlab'),\n ...baseRepositoryShape,\n projectId: z.optional(z.number()),\n /** Custom GitLab instance URL (ex: https://gitlab.company.com). */\n instanceUrl: z.optional(z.string()),\n }),\n z.looseObject({\n provider: z.literal('bitbucket'),\n ...baseRepositoryShape,\n workspace: z.string(),\n }),\n z.looseObject({ provider: z.literal('codeberg'), ...baseRepositoryShape }),\n z.looseObject({ provider: z.literal('gitee'), ...baseRepositoryShape }),\n]);\n\n/** null = unrestricted, [] = no access, array = allowed ids (null = production). */\nconst allowedEnvironmentIdsSchema = z.nullable(z.array(z.nullable(z.string())));\n/** null = unrestricted, [] = no access, array = allowed locales. */\nconst allowedLocalesSchema = z.nullable(z.array(localeSchema));\n\n/** Project environment (production is injected when none is the default). */\nexport const environmentSchema = z.looseObject({\n id: z.string(),\n name: z.string(),\n isDefault: z.boolean(),\n configuration: z.optional(projectConfigurationSchema),\n createdAt: z.optional(dateTimeSchema),\n updatedAt: z.optional(dateTimeSchema),\n});\n\n/** Granular per-member access, overlaid on the member's role. */\nexport const projectMemberGranularAccessSchema = z.object({\n userId: z.string(),\n allowedEnvironmentIds: allowedEnvironmentIdsSchema,\n allowedLocales: allowedLocalesSchema,\n});\n\n/** Access key (OAuth2 client credentials). Live bearer tokens are never sent. */\nexport const accessKeySchema = z.looseObject({\n id: z.string(),\n name: z.string(),\n clientId: z.string(),\n /** Shown to project members (dashboard copy, CLI login). */\n clientSecret: z.string(),\n grants: z.array(z.string()),\n userId: z.string(),\n expiresAt: z.optional(z.nullable(dateTimeSchema)),\n allowedEnvironmentIds: z.optional(allowedEnvironmentIdsSchema),\n allowedLocales: z.optional(allowedLocalesSchema),\n createdAt: dateTimeSchema,\n updatedAt: dateTimeSchema,\n});\n\n/** Project as returned by the API. */\nexport const projectSchema = z.looseObject({\n id: z.string(),\n organizationId: z.string(),\n name: z.string(),\n membersIds: z.array(z.string()),\n adminsIds: z.array(z.string()),\n viewersIds: z.optional(z.array(z.string())),\n memberAccess: z.optional(z.array(projectMemberGranularAccessSchema)),\n creatorId: z.string(),\n configuration: z.optional(projectConfigurationSchema),\n repository: z.optional(z.nullable(repositoryConnectionSchema)),\n webhooks: z.optional(projectCISchema),\n autoFill: z.optional(z.boolean()),\n /** Screenshot of the application URL, generated automatically. */\n imageUrl: z.optional(z.string()),\n environments: z.optional(z.array(environmentSchema)),\n oAuth2Access: z.array(accessKeySchema),\n createdAt: dateTimeSchema,\n updatedAt: dateTimeSchema,\n});\n\n/** Translation health of one locale of a project. */\nexport const localeInsightSchema = z.object({\n locale: localeSchema,\n isDefault: z.boolean(),\n translatedKeys: z.number(),\n totalKeys: z.number(),\n missingKeys: z.number(),\n /** Ratio in the `[0, 1]` range. */\n completionRate: z.number(),\n});\n\n/** Project-wide localization insights shown on the dashboard overview. */\nexport const projectInsightsSchema = z.object({\n projectId: z.string(),\n /** Unix epoch (ms) at which the snapshot was computed. */\n generatedAt: z.number(),\n defaultLocale: z.nullable(localeSchema),\n localeCount: z.number(),\n dictionaryCount: z.number(),\n keyCount: z.number(),\n translationUnitCount: z.number(),\n translatedUnitCount: z.number(),\n overallCompletionRate: z.number(),\n fullyTranslatedLocaleCount: z.number(),\n dictionariesWithMissingTranslations: z.number(),\n missingTranslationCount: z.number(),\n localeInsights: z.array(localeInsightSchema),\n recentlyUpdated: z.array(\n z.object({ key: z.string(), updatedAt: z.number() })\n ),\n lastUpdatedAt: z.nullable(z.number()),\n memberCount: z.number(),\n adminCount: z.number(),\n environmentCount: z.number(),\n autoFill: z.boolean(),\n aiConfigured: z.boolean(),\n repositoryProvider: z.nullable(repositoryProviderSchema),\n applicationURL: z.nullable(z.string()),\n});\n\n/** CI configuration file status of the connected repository. */\nexport const ciStatusSchema = z.object({\n exists: z.boolean(),\n content: z.string(),\n path: z.string(),\n fileUrl: z.optional(z.string()),\n allowAutoPush: z.boolean(),\n});\n\nconst projectIdParamsSchema = z.object({ projectId: objectIdSchema });\nconst clientIdBodySchema = z.object({ clientId: z.string() });\n\nconst ciTargetResultSchema = z.object({\n target: z.string(),\n success: z.boolean(),\n message: z.optional(z.string()),\n});\n\n/** REST contract of the `/api/project` routes. */\nexport const projectContract = defineRouteGroup({\n prefix: '/api/project',\n tag: 'Project',\n routes: {\n getProjects: defineRoute({\n method: 'GET',\n path: '/',\n summary: 'List the projects visible to the session',\n schemas: {\n querystring: z.looseObject({\n ...paginationQueryShape,\n ids: z.optional(repeatableQueryValueSchema),\n name: z.optional(z.string()),\n search: z.optional(z.string()),\n organizationId: z.optional(z.string()),\n membersIds: z.optional(repeatableQueryValueSchema),\n sortBy: z.optional(z.string()),\n sortOrder: z.optional(z.string()),\n /** Admin only: list projects of every organization. */\n fetchAll: z.optional(z.enum(['true', 'false'])),\n }),\n response: { 200: paginatedResponseSchema(projectSchema) },\n },\n }),\n getProjectInsights: defineRoute({\n method: 'GET',\n path: '/insights',\n summary: 'Localization insights of the selected project',\n schemas: {\n response: { 200: responseDataSchema(projectInsightsSchema) },\n },\n }),\n addProject: defineRoute({\n method: 'POST',\n path: '/',\n summary: 'Create a project in the selected organization',\n schemas: {\n body: z.looseObject({ name: z.string().check(z.minLength(1)) }),\n response: { 200: responseDataSchema(projectSchema) },\n },\n }),\n updateProject: defineRoute({\n method: 'PUT',\n path: '/',\n summary: 'Update the selected project',\n schemas: {\n /**\n * Allow-list: membership and ownership fields (`adminsIds`,\n * `membersIds`, `viewersIds`, `creatorId`, `memberAccess`,\n * `environments`) are stripped, they only change through their\n * dedicated endpoints and the invariants those enforce.\n */\n body: z.object({\n name: z.optional(z.string().check(z.minLength(1))),\n configuration: z.optional(projectConfigurationSchema),\n autoFill: z.optional(z.boolean()),\n webhooks: z.optional(projectCISchema),\n /** `null` disconnects the repository. */\n repository: z.optional(z.nullable(repositoryConnectionSchema)),\n }),\n response: { 200: responseDataSchema(projectSchema) },\n },\n }),\n updateProjectMembers: defineRoute({\n method: 'PUT',\n path: '/members',\n summary: 'Replace the members of the selected project',\n schemas: {\n body: z.object({\n membersIds: z.optional(\n z.array(\n z.object({\n userId: objectIdSchema,\n isAdmin: z.optional(z.boolean()),\n })\n )\n ),\n }),\n response: { 200: responseDataSchema(projectSchema) },\n },\n }),\n pushProjectConfiguration: defineRoute({\n method: 'PUT',\n path: '/configuration',\n summary: 'Push the local Intlayer configuration to the project',\n schemas: {\n body: projectConfigurationSchema,\n response: { 200: responseDataSchema(projectConfigurationSchema) },\n },\n }),\n deleteProject: defineRoute({\n method: 'DELETE',\n path: '/',\n summary: 'Delete the selected project',\n schemas: {\n response: { 200: responseDataSchema(projectSchema) },\n },\n }),\n selectProject: defineRoute({\n method: 'PUT',\n path: '/:projectId',\n summary: 'Select a project for the current session',\n schemas: {\n params: projectIdParamsSchema,\n response: { 200: responseDataSchema(projectSchema) },\n },\n }),\n unselectProject: defineRoute({\n method: 'POST',\n path: '/logout',\n summary: 'Unselect the project of the current session',\n schemas: {\n response: { 200: responseDataSchema(z.null()) },\n },\n }),\n addNewAccessKey: defineRoute({\n method: 'POST',\n path: '/access_key',\n summary: 'Create an access key for the selected project',\n schemas: {\n body: z.object({\n name: z.string().check(z.minLength(1)),\n grants: z.array(z.string()),\n /** ISO date-time, parsed to a `Date`; omitted for a key that never expires. */\n expiresAt: z.optional(\n z.pipe(\n z.iso.datetime(),\n z.transform((value) => new Date(value))\n )\n ),\n allowedEnvironmentIds: z.optional(allowedEnvironmentIdsSchema),\n allowedLocales: z.optional(allowedLocalesSchema),\n }),\n response: { 200: responseDataSchema(accessKeySchema) },\n },\n }),\n refreshAccessKey: defineRoute({\n method: 'PATCH',\n path: '/access_key',\n summary: 'Regenerate the secret of an access key',\n schemas: {\n body: clientIdBodySchema,\n response: { 200: responseDataSchema(accessKeySchema) },\n },\n }),\n deleteAccessKey: defineRoute({\n method: 'DELETE',\n path: '/access_key',\n summary: 'Delete an access key',\n schemas: {\n body: clientIdBodySchema,\n response: { 200: responseDataSchema(z.null()) },\n },\n }),\n triggerBuild: defineRoute({\n method: 'POST',\n path: '/build',\n summary: 'Trigger the CI pipelines and webhooks of the project',\n schemas: {\n response: {\n 200: responseDataSchema(\n z.object({ results: z.array(ciTargetResultSchema) })\n ),\n },\n },\n }),\n triggerWebhook: defineRoute({\n method: 'POST',\n path: '/webhook',\n summary: 'Trigger a single project webhook',\n schemas: {\n body: z.object({ webhookIndex: z.int().check(z.gte(0)) }),\n response: { 200: responseDataSchema(ciTargetResultSchema) },\n },\n }),\n getCIConfiguration: defineRoute({\n method: 'GET',\n path: '/ci',\n summary: 'CI configuration status of the connected repository',\n schemas: {\n response: { 200: responseDataSchema(ciStatusSchema) },\n },\n }),\n pushCIConfiguration: defineRoute({\n method: 'POST',\n path: '/ci',\n summary: 'Commit the CI configuration file to the repository',\n schemas: {\n response: {\n 200: responseDataSchema(z.object({ success: z.boolean() })),\n },\n },\n }),\n deleteProjectByIdAdmin: defineRoute({\n method: 'DELETE',\n path: '/:projectId/admin',\n summary: 'Admin only: delete any project',\n schemas: {\n params: projectIdParamsSchema,\n response: { 200: responseDataSchema(projectSchema) },\n },\n }),\n updateMemberAccess: defineRoute({\n method: 'PUT',\n path: '/member/:userId/access',\n summary: 'Restrict the environments and locales of a project member',\n schemas: {\n params: z.object({ userId: objectIdSchema }),\n body: z.object({\n allowedEnvironmentIds: allowedEnvironmentIdsSchema,\n allowedLocales: allowedLocalesSchema,\n }),\n response: {\n 200: responseDataSchema(projectMemberGranularAccessSchema),\n },\n },\n }),\n },\n});\n\n/** Route definitions of the `/api/project` group, by name. */\nexport type ProjectRoutes = (typeof projectContract)['routes'];\n\n// Entity types\nexport type ProjectConfiguration = z.output<typeof projectConfigurationSchema>;\nexport type Webhook = z.output<typeof webhookSchema>;\nexport type ProjectConfigCI = z.output<typeof projectCISchema>;\nexport type RepositoryProvider = z.output<typeof repositoryProviderSchema>;\nexport type RepositoryConnection = z.output<typeof repositoryConnectionSchema>;\nexport type EnvironmentAPI = z.output<typeof environmentSchema>;\nexport type ProjectMemberGranularAccessAPI = z.output<\n typeof projectMemberGranularAccessSchema\n>;\nexport type OAuth2AccessAPI = z.output<typeof accessKeySchema>;\nexport type ProjectAPI = z.output<typeof projectSchema>;\nexport type ProjectInsights = z.output<typeof projectInsightsSchema>;\nexport type CIStatus = z.output<typeof ciStatusSchema>;\n\n// Request / response types\nexport type GetProjectsParams = RouteQuerystring<ProjectRoutes['getProjects']>;\nexport type GetProjectsResult = PaginatedResponse<ProjectAPI>;\nexport type GetProjectInsightsResult = ResponseData<ProjectInsights>;\nexport type AddProjectBody = RouteBodyInput<ProjectRoutes['addProject']>;\nexport type AddProjectResult = ResponseData<ProjectAPI>;\nexport type UpdateProjectBody = RouteBodyInput<ProjectRoutes['updateProject']>;\nexport type UpdateProjectResult = ResponseData<ProjectAPI>;\nexport type UpdateProjectMembersBody = RouteBodyInput<\n ProjectRoutes['updateProjectMembers']\n>;\nexport type UpdateProjectMembersResult = ResponseData<ProjectAPI>;\nexport type PushProjectConfigurationBody = RouteBodyInput<\n ProjectRoutes['pushProjectConfiguration']\n>;\nexport type PushProjectConfigurationResult = ResponseData<ProjectConfiguration>;\nexport type DeleteProjectResult = ResponseData<ProjectAPI>;\nexport type SelectProjectParam = RouteParams<ProjectRoutes['selectProject']>;\nexport type SelectProjectResult = ResponseData<ProjectAPI>;\nexport type UnselectProjectResult = ResponseData<null>;\n/** `expiresAt` also accepts a `Date`: JSON serializes it to an ISO string. */\nexport type AddNewAccessKeyBody = Omit<\n RouteBodyInput<ProjectRoutes['addNewAccessKey']>,\n 'expiresAt'\n> & { expiresAt?: Date | string };\nexport type AddNewAccessKeyResponse = ResponseData<OAuth2AccessAPI>;\nexport type RefreshAccessKeyBody = RouteBody<ProjectRoutes['refreshAccessKey']>;\nexport type RefreshAccessKeyResponse = ResponseData<OAuth2AccessAPI>;\nexport type DeleteAccessKeyBody = RouteBody<ProjectRoutes['deleteAccessKey']>;\nexport type DeleteAccessKeyResponse = ResponseData<null>;\nexport type TriggerBuildResult = ResponseData<{\n results: z.output<typeof ciTargetResultSchema>[];\n}>;\nexport type TriggerWebhookBody = RouteBody<ProjectRoutes['triggerWebhook']>;\nexport type TriggerWebhookResult = ResponseData<\n z.output<typeof ciTargetResultSchema>\n>;\nexport type GetCIConfigurationResult = ResponseData<CIStatus>;\nexport type PushCIConfigurationResult = ResponseData<{ success: boolean }>;\nexport type DeleteProjectByIdAdminResult = ResponseData<ProjectAPI>;\nexport type UpdateMemberAccessParams = RouteParams<\n ProjectRoutes['updateMemberAccess']\n>;\nexport type UpdateMemberAccessBody = RouteBodyInput<\n ProjectRoutes['updateMemberAccess']\n>;\nexport type UpdateMemberAccessResult =\n ResponseData<ProjectMemberGranularAccessAPI>;\n"],"mappings":";;;;;;;;AA2BA,MAAa,eAAeA,iCAA0B;;;;;AAatD,MAAa,6BAA6BC,WAAE,YAAY;CACtD,sBAAsBA,WAAE,SACtBA,WAAE,YAAY;EACZ,SAASA,WAAE,SAASA,WAAE,MAAM,YAAY,CAAC;EACzC,eAAeA,WAAE,SAAS,YAAY;CACxC,CAAC,CACH;CACA,QAAQA,WAAE,SACRA,WAAE,YAAY;EACZ,gBAAgBA,WAAE,SAASD,iCAA2B,CAAC;EACvD,QAAQC,WAAE,SAASD,iCAA2B,CAAC;CACjD,CAAC,CACH;CACA,IAAIC,WAAE,SAASC,gCAAkC,CAAC;AACpD,CAAC;;AAGD,MAAa,gBAAgBD,WAAE,YAAY;CACzC,IAAIA,WAAE,SAASA,WAAE,OAAO,CAAC;CACzB,MAAMA,WAAE,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,WAAE,IAAI,CAAC,CAAC,MAAMA,WAAE,IAAI,CAAC,CAAC,EAAE,CAAC;IACxD,UAAU,EAAE,KAAKS,wCAAmB,oBAAoB,EAAE;GAC5D;EACF,CAAC;EACD,oBAAoBJ,gCAAY;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EAAE,KAAKI,wCAAmB,cAAc,EAAE,EACtD;EACF,CAAC;EACD,qBAAqBJ,gCAAY;GAC/B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EACR,KAAKI,wCAAmBT,WAAE,OAAO,EAAE,SAASA,WAAE,QAAQ,EAAE,CAAC,CAAC,EAC5D,EACF;EACF,CAAC;EACD,wBAAwBK,gCAAY;GAClC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,UAAU,EAAE,KAAKI,wCAAmB,aAAa,EAAE;GACrD;EACF,CAAC;EACD,oBAAoBJ,gCAAY;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQL,WAAE,OAAO,EAAE,QAAQG,8BAAe,CAAC;IAC3C,MAAMH,WAAE,OAAO;KACb,uBAAuB;KACvB,gBAAgB;IAClB,CAAC;IACD,UAAU,EACR,KAAKS,wCAAmB,iCAAiC,EAC3D;GACF;EACF,CAAC;CACH;AACF,CAAC"}
@@ -0,0 +1,60 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_defineRoute = require('./defineRoute.cjs');
3
+ const require_responseData = require('./responseData.cjs');
4
+ const require_dictionary = require('./dictionary.cjs');
5
+ let zod_mini = require("zod/mini");
6
+
7
+ //#region src/public.ts
8
+ /** Capabilities a public browser token may carry (deliberately narrow). */
9
+ const publicBrowserScopeSchema = zod_mini.z.enum(["analytics:ingest", "dictionary:read"]);
10
+ const publicBrowserTokenSchema = zod_mini.z.object({
11
+ /** `null` when the key is unknown or the origin is not allowed. */
12
+ token: zod_mini.z.nullable(zod_mini.z.string()),
13
+ /** Capabilities granted; empty when no token was issued. */
14
+ scopes: zod_mini.z.array(publicBrowserScopeSchema),
15
+ /** Token lifetime in seconds; `0` when no token was issued. */
16
+ expiresIn: zod_mini.z.number()
17
+ });
18
+ /**
19
+ * REST contract of the credential-free routes a browser SDK reaches on its
20
+ * own (rate limited per IP).
21
+ */
22
+ const publicContract = require_defineRoute.defineRouteGroup({
23
+ prefix: "/api/public",
24
+ tag: "Public",
25
+ routes: {
26
+ createPublicBrowserToken: require_defineRoute.defineRoute({
27
+ method: "POST",
28
+ path: "/token",
29
+ summary: "Exchange a project public key for a scoped browser token",
30
+ schemas: {
31
+ body: zod_mini.z.optional(zod_mini.z.object({
32
+ /** The project's public key (`editor.clientId`). */
33
+ clientId: zod_mini.z.optional(zod_mini.z.string()) })),
34
+ response: { 200: require_responseData.responseDataSchema(publicBrowserTokenSchema) }
35
+ }
36
+ }),
37
+ getPublicDictionaryKeys: require_defineRoute.defineRoute({
38
+ method: "GET",
39
+ path: "/dictionaries/keys",
40
+ summary: "Keys of the published dictionaries (browser token)",
41
+ schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(zod_mini.z.string())) } }
42
+ }),
43
+ getPublicDictionaries: require_defineRoute.defineRoute({
44
+ method: "GET",
45
+ path: "/dictionaries",
46
+ summary: "Published dictionaries (browser token)",
47
+ schemas: {
48
+ querystring: zod_mini.z.object({
49
+ /** Comma-separated dictionary keys to fetch. */
50
+ keys: zod_mini.z.optional(zod_mini.z.string()) }),
51
+ response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(require_dictionary.dictionarySchema)) }
52
+ }
53
+ })
54
+ }
55
+ });
56
+
57
+ //#endregion
58
+ exports.publicBrowserScopeSchema = publicBrowserScopeSchema;
59
+ exports.publicContract = publicContract;
60
+ //# sourceMappingURL=public.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.cjs","names":["z","defineRouteGroup","defineRoute","responseDataSchema","dictionarySchema"],"sources":["../../src/public.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n} from './defineRoute';\nimport { type DictionaryAPI, dictionarySchema } from './dictionary';\nimport { type ResponseData, responseDataSchema } from './responseData';\n\n/** Capabilities a public browser token may carry (deliberately narrow). */\nexport const publicBrowserScopeSchema = z.enum([\n /** Submit analytics events for the project (append-only). */\n 'analytics:ingest',\n /** Read the project's published dictionary content (already public). */\n 'dictionary:read',\n]);\n\nconst publicBrowserTokenSchema = z.object({\n /** `null` when the key is unknown or the origin is not allowed. */\n token: z.nullable(z.string()),\n /** Capabilities granted; empty when no token was issued. */\n scopes: z.array(publicBrowserScopeSchema),\n /** Token lifetime in seconds; `0` when no token was issued. */\n expiresIn: z.number(),\n});\n\n/**\n * REST contract of the credential-free routes a browser SDK reaches on its\n * own (rate limited per IP).\n */\nexport const publicContract = defineRouteGroup({\n prefix: '/api/public',\n tag: 'Public',\n routes: {\n createPublicBrowserToken: defineRoute({\n method: 'POST',\n path: '/token',\n summary: 'Exchange a project public key for a scoped browser token',\n schemas: {\n body: z.optional(\n z.object({\n /** The project's public key (`editor.clientId`). */\n clientId: z.optional(z.string()),\n })\n ),\n response: { 200: responseDataSchema(publicBrowserTokenSchema) },\n },\n }),\n getPublicDictionaryKeys: defineRoute({\n method: 'GET',\n path: '/dictionaries/keys',\n summary: 'Keys of the published dictionaries (browser token)',\n schemas: {\n response: { 200: responseDataSchema(z.array(z.string())) },\n },\n }),\n getPublicDictionaries: defineRoute({\n method: 'GET',\n path: '/dictionaries',\n summary: 'Published dictionaries (browser token)',\n schemas: {\n querystring: z.object({\n /** Comma-separated dictionary keys to fetch. */\n keys: z.optional(z.string()),\n }),\n response: { 200: responseDataSchema(z.array(dictionarySchema)) },\n },\n }),\n },\n});\n\n/** Route definitions of the public group, by name. */\nexport type PublicRoutes = (typeof publicContract)['routes'];\n\nexport type PublicBrowserScope = z.output<typeof publicBrowserScopeSchema>;\nexport type CreatePublicBrowserTokenBody = NonNullable<\n RouteBodyInput<PublicRoutes['createPublicBrowserToken']>\n>;\nexport type CreatePublicBrowserTokenResult = ResponseData<\n z.output<typeof publicBrowserTokenSchema>\n>;\nexport type GetPublicDictionariesQuery = { keys?: string };\nexport type GetPublicDictionariesResult = ResponseData<DictionaryAPI[]>;\nexport type GetPublicDictionaryKeysResult = ResponseData<string[]>;\n"],"mappings":";;;;;;;;AAUA,MAAa,2BAA2BA,WAAE,KAAK,CAE7C,oBAEA,iBACF,CAAC;AAED,MAAM,2BAA2BA,WAAE,OAAO;;CAExC,OAAOA,WAAE,SAASA,WAAE,OAAO,CAAC;;CAE5B,QAAQA,WAAE,MAAM,wBAAwB;;CAExC,WAAWA,WAAE,OAAO;AACtB,CAAC;;;;;AAMD,MAAa,iBAAiBC,qCAAiB;CAC7C,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,0BAA0BC,gCAAY;GACpC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMF,WAAE,SACNA,WAAE,OAAO;;AAEP,UAAUA,WAAE,SAASA,WAAE,OAAO,CAAC,EACjC,CAAC,CACH;IACA,UAAU,EAAE,KAAKG,wCAAmB,wBAAwB,EAAE;GAChE;EACF,CAAC;EACD,yBAAyBD,gCAAY;GACnC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EAAE,KAAKC,wCAAmBH,WAAE,MAAMA,WAAE,OAAO,CAAC,CAAC,EAAE,EAC3D;EACF,CAAC;EACD,uBAAuBE,gCAAY;GACjC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,aAAaF,WAAE,OAAO;;AAEpB,MAAMA,WAAE,SAASA,WAAE,OAAO,CAAC,EAC7B,CAAC;IACD,UAAU,EAAE,KAAKG,wCAAmBH,WAAE,MAAMI,mCAAgB,CAAC,EAAE;GACjE;EACF,CAAC;CACH;AACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let zod_mini = require("zod/mini");
3
+
4
+ //#region src/responseData.ts
5
+ /** Error payload attached to failed responses. */
6
+ const errorDataSchema = zod_mini.z.looseObject({
7
+ code: zod_mini.z.string(),
8
+ title: zod_mini.z.string(),
9
+ message: zod_mini.z.string()
10
+ });
11
+ /** Wraps a data schema in the backend `ResponseData<T>` envelope. */
12
+ const responseDataSchema = (data) => zod_mini.z.object({
13
+ success: zod_mini.z.boolean(),
14
+ status: zod_mini.z.number(),
15
+ message: zod_mini.z.optional(zod_mini.z.string()),
16
+ description: zod_mini.z.optional(zod_mini.z.string()),
17
+ data: zod_mini.z.nullable(data),
18
+ error: zod_mini.z.optional(zod_mini.z.union([errorDataSchema, zod_mini.z.array(errorDataSchema)]))
19
+ });
20
+ /** Wraps an item schema in the backend `PaginatedResponse<T>` envelope. */
21
+ const paginatedResponseSchema = (item) => zod_mini.z.object({
22
+ ...responseDataSchema(zod_mini.z.array(item)).shape,
23
+ page: zod_mini.z.nullable(zod_mini.z.number()),
24
+ page_size: zod_mini.z.nullable(zod_mini.z.number()),
25
+ total_pages: zod_mini.z.nullable(zod_mini.z.number()),
26
+ total_items: zod_mini.z.nullable(zod_mini.z.number())
27
+ });
28
+
29
+ //#endregion
30
+ exports.errorDataSchema = errorDataSchema;
31
+ exports.paginatedResponseSchema = paginatedResponseSchema;
32
+ exports.responseDataSchema = responseDataSchema;
33
+ //# sourceMappingURL=responseData.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responseData.cjs","names":["z"],"sources":["../../src/responseData.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport type { $ZodType } from 'zod/v4/core';\n\n/** Error payload attached to failed responses. */\nexport const errorDataSchema = z.looseObject({\n code: z.string(),\n title: z.string(),\n message: z.string(),\n});\n\n/** Wraps a data schema in the backend `ResponseData<T>` envelope. */\nexport const responseDataSchema = <DataSchema extends $ZodType>(\n data: DataSchema\n) =>\n z.object({\n success: z.boolean(),\n status: z.number(),\n message: z.optional(z.string()),\n description: z.optional(z.string()),\n data: z.nullable(data),\n error: z.optional(z.union([errorDataSchema, z.array(errorDataSchema)])),\n });\n\n/** Wraps an item schema in the backend `PaginatedResponse<T>` envelope. */\nexport const paginatedResponseSchema = <ItemSchema extends $ZodType>(\n item: ItemSchema\n) =>\n z.object({\n ...responseDataSchema(z.array(item)).shape,\n page: z.nullable(z.number()),\n page_size: z.nullable(z.number()),\n total_pages: z.nullable(z.number()),\n total_items: z.nullable(z.number()),\n });\n\n/** Error payload attached to failed responses. */\nexport type ErrorData = z.output<typeof errorDataSchema>;\n\n/** Envelope of every backend response. */\nexport type ResponseData<Data = null> = {\n message?: string;\n description?: string;\n success: boolean;\n status: number;\n data: Data | null;\n error?: ErrorData | ErrorData[];\n};\n\n/** Envelope of paginated list responses. */\nexport type PaginatedResponse<Item = undefined> = Omit<\n ResponseData<Item>,\n 'data'\n> & {\n data: Item[] | null;\n page: number | null;\n page_size: number | null;\n total_pages: number | null;\n total_items: number | null;\n};\n"],"mappings":";;;;;AAIA,MAAa,kBAAkBA,WAAE,YAAY;CAC3C,MAAMA,WAAE,OAAO;CACf,OAAOA,WAAE,OAAO;CAChB,SAASA,WAAE,OAAO;AACpB,CAAC;;AAGD,MAAa,sBACX,SAEAA,WAAE,OAAO;CACP,SAASA,WAAE,QAAQ;CACnB,QAAQA,WAAE,OAAO;CACjB,SAASA,WAAE,SAASA,WAAE,OAAO,CAAC;CAC9B,aAAaA,WAAE,SAASA,WAAE,OAAO,CAAC;CAClC,MAAMA,WAAE,SAAS,IAAI;CACrB,OAAOA,WAAE,SAASA,WAAE,MAAM,CAAC,iBAAiBA,WAAE,MAAM,eAAe,CAAC,CAAC,CAAC;AACxE,CAAC;;AAGH,MAAa,2BACX,SAEAA,WAAE,OAAO;CACP,GAAG,mBAAmBA,WAAE,MAAM,IAAI,CAAC,CAAC,CAAC;CACrC,MAAMA,WAAE,SAASA,WAAE,OAAO,CAAC;CAC3B,WAAWA,WAAE,SAASA,WAAE,OAAO,CAAC;CAChC,aAAaA,WAAE,SAASA,WAAE,OAAO,CAAC;CAClC,aAAaA,WAAE,SAASA,WAAE,OAAO,CAAC;AACpC,CAAC"}
@@ -0,0 +1,401 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_common = require('./common.cjs');
3
+ const require_defineRoute = require('./defineRoute.cjs');
4
+ const require_responseData = require('./responseData.cjs');
5
+ let zod_mini = require("zod/mini");
6
+
7
+ //#region src/reviewer.ts
8
+ /** Number sent in a query string (parsed by the handler). */
9
+ const numericQueryValueSchema = zod_mini.z.union([zod_mini.z.string(), zod_mini.z.number()]);
10
+ const reviewerStatusSchema = zod_mini.z.enum([
11
+ "pending",
12
+ "active",
13
+ "suspended"
14
+ ]);
15
+ const reviewerCategorySchema = zod_mini.z.enum([
16
+ "copywriter",
17
+ "translator",
18
+ "proofreader",
19
+ "technical_writer",
20
+ "marketing",
21
+ "seo"
22
+ ]);
23
+ /** Reviewer categories, usable as values. */
24
+ const REVIEWER_CATEGORIES = reviewerCategorySchema.options;
25
+ const missionStatusSchema = zod_mini.z.enum([
26
+ "pending",
27
+ "accepted",
28
+ "in_progress",
29
+ "reviewer_review",
30
+ "client_review",
31
+ "completed",
32
+ "canceled"
33
+ ]);
34
+ const languagePairSchema = zod_mini.z.object({
35
+ from: zod_mini.z.string(),
36
+ to: zod_mini.z.string()
37
+ });
38
+ const socialLinksSchema = zod_mini.z.object({
39
+ github: zod_mini.z.optional(zod_mini.z.string()),
40
+ linkedin: zod_mini.z.optional(zod_mini.z.string()),
41
+ portfolio: zod_mini.z.optional(zod_mini.z.string())
42
+ });
43
+ /** Public reviewer profile (marketplace). */
44
+ const reviewerProfileSchema = zod_mini.z.looseObject({
45
+ id: zod_mini.z.string(),
46
+ userId: zod_mini.z.string(),
47
+ /** Public name and avatar of the linked user. */
48
+ name: zod_mini.z.optional(zod_mini.z.string()),
49
+ avatar: zod_mini.z.optional(zod_mini.z.string()),
50
+ bio: zod_mini.z.optional(zod_mini.z.string()),
51
+ mainPicture: zod_mini.z.optional(zod_mini.z.string()),
52
+ coverPicture: zod_mini.z.optional(zod_mini.z.string()),
53
+ languagePairs: zod_mini.z.array(languagePairSchema),
54
+ categories: zod_mini.z.array(reviewerCategorySchema),
55
+ /** In cents (5000 = $50/hour). */
56
+ pricePerHour: zod_mini.z.number(),
57
+ status: reviewerStatusSchema,
58
+ totalMissions: zod_mini.z.number(),
59
+ /** 0 to 5. */
60
+ averageRating: zod_mini.z.number(),
61
+ reviewCount: zod_mini.z.number(),
62
+ socialLinks: zod_mini.z.optional(socialLinksSchema),
63
+ isHidden: zod_mini.z.optional(zod_mini.z.boolean()),
64
+ createdAt: require_common.dateTimeSchema,
65
+ updatedAt: require_common.dateTimeSchema
66
+ });
67
+ /** Booked review/translation work. */
68
+ const translationMissionSchema = zod_mini.z.looseObject({
69
+ id: zod_mini.z.string(),
70
+ reviewerId: zod_mini.z.string(),
71
+ clientUserId: zod_mini.z.string(),
72
+ projectId: zod_mini.z.optional(zod_mini.z.string()),
73
+ dictionaryIds: zod_mini.z.array(zod_mini.z.string()),
74
+ sourceLocale: zod_mini.z.optional(zod_mini.z.string()),
75
+ targetLocales: zod_mini.z.array(zod_mini.z.string()),
76
+ wordCount: zod_mini.z.number(),
77
+ estimatedHours: zod_mini.z.number(),
78
+ /** Snapshot of the reviewer price at booking time, in cents. */
79
+ pricePerHour: zod_mini.z.number(),
80
+ /** In cents. */
81
+ totalPrice: zod_mini.z.number(),
82
+ currency: zod_mini.z.string(),
83
+ status: missionStatusSchema,
84
+ notes: zod_mini.z.optional(zod_mini.z.string()),
85
+ aiPreGeneratedAt: zod_mini.z.optional(require_common.dateTimeSchema),
86
+ completedAt: zod_mini.z.optional(require_common.dateTimeSchema),
87
+ canceledAt: zod_mini.z.optional(require_common.dateTimeSchema),
88
+ createdAt: require_common.dateTimeSchema,
89
+ updatedAt: require_common.dateTimeSchema
90
+ });
91
+ const reviewerReviewSchema = zod_mini.z.looseObject({
92
+ id: zod_mini.z.string(),
93
+ missionId: zod_mini.z.string(),
94
+ reviewerId: zod_mini.z.string(),
95
+ /** 1 to 5. */
96
+ rating: zod_mini.z.number(),
97
+ comment: zod_mini.z.optional(zod_mini.z.string()),
98
+ createdAt: require_common.dateTimeSchema,
99
+ updatedAt: require_common.dateTimeSchema
100
+ });
101
+ const reviewerMessageSchema = zod_mini.z.looseObject({
102
+ id: zod_mini.z.string(),
103
+ missionId: zod_mini.z.string(),
104
+ senderId: zod_mini.z.string(),
105
+ content: zod_mini.z.string(),
106
+ readAt: zod_mini.z.optional(require_common.dateTimeSchema),
107
+ createdAt: require_common.dateTimeSchema,
108
+ updatedAt: require_common.dateTimeSchema
109
+ });
110
+ const missionEstimateSchema = zod_mini.z.object({
111
+ wordCount: zod_mini.z.number(),
112
+ estimatedHours: zod_mini.z.number(),
113
+ /** In cents. */
114
+ totalPrice: zod_mini.z.number(),
115
+ currency: zod_mini.z.string()
116
+ });
117
+ const priceDistributionSchema = zod_mini.z.object({
118
+ buckets: zod_mini.z.array(zod_mini.z.object({
119
+ min: zod_mini.z.number(),
120
+ max: zod_mini.z.number(),
121
+ count: zod_mini.z.number()
122
+ })),
123
+ globalMin: zod_mini.z.number(),
124
+ globalMax: zod_mini.z.number()
125
+ });
126
+ const marketplaceFiltersShape = {
127
+ fromLocale: zod_mini.z.optional(zod_mini.z.string()),
128
+ toLocale: zod_mini.z.optional(zod_mini.z.string()),
129
+ minRating: zod_mini.z.optional(numericQueryValueSchema),
130
+ categories: zod_mini.z.optional(require_common.repeatableQueryValueSchema)
131
+ };
132
+ const reviewerProfileBodyShape = {
133
+ bio: zod_mini.z.optional(zod_mini.z.string()),
134
+ languagePairs: zod_mini.z.array(languagePairSchema),
135
+ categories: zod_mini.z.optional(zod_mini.z.array(reviewerCategorySchema)),
136
+ /** In cents. */
137
+ pricePerHour: zod_mini.z.number(),
138
+ socialLinks: zod_mini.z.optional(socialLinksSchema)
139
+ };
140
+ const reviewerIdParamsSchema = zod_mini.z.object({ reviewerId: require_common.objectIdSchema });
141
+ const missionIdParamsSchema = zod_mini.z.object({ missionId: require_common.objectIdSchema });
142
+ const profileResponseSchema = require_responseData.responseDataSchema(reviewerProfileSchema);
143
+ const missionResponseSchema = require_responseData.responseDataSchema(translationMissionSchema);
144
+ const paginatedQuerySchema = zod_mini.z.object(require_common.paginationQueryShape);
145
+ /** REST contract of the `/api/reviewer` routes (translator marketplace). */
146
+ const reviewerContract = require_defineRoute.defineRouteGroup({
147
+ prefix: "/api/reviewer",
148
+ tag: "Reviewer",
149
+ routes: {
150
+ getMarketplace: require_defineRoute.defineRoute({
151
+ method: "GET",
152
+ path: "/marketplace",
153
+ summary: "Search the reviewer marketplace",
154
+ schemas: {
155
+ querystring: zod_mini.z.object({
156
+ ...require_common.paginationQueryShape,
157
+ ...marketplaceFiltersShape,
158
+ maxPricePerHour: zod_mini.z.optional(numericQueryValueSchema),
159
+ minPricePerHour: zod_mini.z.optional(numericQueryValueSchema)
160
+ }),
161
+ response: { 200: require_responseData.paginatedResponseSchema(reviewerProfileSchema) }
162
+ }
163
+ }),
164
+ getPriceDistribution: require_defineRoute.defineRoute({
165
+ method: "GET",
166
+ path: "/marketplace/price-distribution",
167
+ summary: "Price histogram of the marketplace (filter slider)",
168
+ schemas: {
169
+ querystring: zod_mini.z.object(marketplaceFiltersShape),
170
+ response: { 200: require_responseData.responseDataSchema(priceDistributionSchema) }
171
+ }
172
+ }),
173
+ getMyReviewerProfile: require_defineRoute.defineRoute({
174
+ method: "GET",
175
+ path: "/me",
176
+ summary: "Reviewer profile of the signed-in user",
177
+ schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.nullable(reviewerProfileSchema)) } }
178
+ }),
179
+ getReviewerReviews: require_defineRoute.defineRoute({
180
+ method: "GET",
181
+ path: "/:reviewerId/reviews",
182
+ summary: "Reviews left on a reviewer",
183
+ schemas: {
184
+ params: reviewerIdParamsSchema,
185
+ querystring: paginatedQuerySchema,
186
+ response: { 200: require_responseData.paginatedResponseSchema(reviewerReviewSchema) }
187
+ }
188
+ }),
189
+ getReviewerById: require_defineRoute.defineRoute({
190
+ method: "GET",
191
+ path: "/:reviewerId",
192
+ summary: "Public profile of a reviewer",
193
+ schemas: {
194
+ params: reviewerIdParamsSchema,
195
+ response: { 200: profileResponseSchema }
196
+ }
197
+ }),
198
+ registerAsReviewer: require_defineRoute.defineRoute({
199
+ method: "POST",
200
+ path: "/register",
201
+ summary: "Create the reviewer profile of the signed-in user",
202
+ schemas: {
203
+ body: zod_mini.z.object(reviewerProfileBodyShape),
204
+ response: { 200: profileResponseSchema }
205
+ }
206
+ }),
207
+ updateReviewerProfile: require_defineRoute.defineRoute({
208
+ method: "PUT",
209
+ path: "/",
210
+ summary: "Update the reviewer profile of the signed-in user",
211
+ schemas: {
212
+ body: zod_mini.z.object({
213
+ ...zod_mini.z.partial(zod_mini.z.object(reviewerProfileBodyShape)).shape,
214
+ isHidden: zod_mini.z.optional(zod_mini.z.boolean())
215
+ }),
216
+ response: { 200: profileResponseSchema }
217
+ }
218
+ }),
219
+ deleteReviewerProfile: require_defineRoute.defineRoute({
220
+ method: "DELETE",
221
+ path: "/",
222
+ summary: "Delete the reviewer profile of the signed-in user",
223
+ schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.null()) } }
224
+ }),
225
+ uploadMainPicture: require_defineRoute.defineRoute({
226
+ method: "POST",
227
+ path: "/me/picture/main",
228
+ summary: "Upload the main picture (raw `image/*` body)",
229
+ schemas: { response: { 200: profileResponseSchema } }
230
+ }),
231
+ uploadCoverPicture: require_defineRoute.defineRoute({
232
+ method: "POST",
233
+ path: "/me/picture/cover",
234
+ summary: "Upload the cover picture (raw `image/*` body)",
235
+ schemas: { response: { 200: profileResponseSchema } }
236
+ }),
237
+ estimateMission: require_defineRoute.defineRoute({
238
+ method: "POST",
239
+ path: "/mission/estimate",
240
+ summary: "Estimate the price of a mission",
241
+ schemas: {
242
+ body: zod_mini.z.object({
243
+ dictionaryIds: zod_mini.z.array(zod_mini.z.string()),
244
+ sourceLocale: zod_mini.z.optional(zod_mini.z.string()),
245
+ /** In cents. */
246
+ pricePerHour: zod_mini.z.number()
247
+ }),
248
+ response: { 200: require_responseData.responseDataSchema(missionEstimateSchema) }
249
+ }
250
+ }),
251
+ createMission: require_defineRoute.defineRoute({
252
+ method: "POST",
253
+ path: "/mission",
254
+ summary: "Book a reviewer",
255
+ schemas: {
256
+ body: zod_mini.z.object({
257
+ reviewerId: require_common.objectIdSchema,
258
+ dictionaryIds: zod_mini.z.optional(zod_mini.z.array(zod_mini.z.string())),
259
+ /** Optional: non-translation missions (ex: SEO review) have no locales. */
260
+ sourceLocale: zod_mini.z.optional(zod_mini.z.string()),
261
+ targetLocales: zod_mini.z.optional(zod_mini.z.array(zod_mini.z.string())),
262
+ projectId: zod_mini.z.optional(zod_mini.z.string()),
263
+ notes: zod_mini.z.optional(zod_mini.z.string())
264
+ }),
265
+ response: { 200: missionResponseSchema }
266
+ }
267
+ }),
268
+ getMyMissions: require_defineRoute.defineRoute({
269
+ method: "GET",
270
+ path: "/mission",
271
+ summary: "Missions of the signed-in user (as client or reviewer)",
272
+ schemas: {
273
+ querystring: zod_mini.z.object({
274
+ ...require_common.paginationQueryShape,
275
+ role: zod_mini.z.optional(zod_mini.z.enum(["client", "reviewer"]))
276
+ }),
277
+ response: { 200: require_responseData.paginatedResponseSchema(translationMissionSchema) }
278
+ }
279
+ }),
280
+ getMissionById: require_defineRoute.defineRoute({
281
+ method: "GET",
282
+ path: "/mission/:missionId",
283
+ summary: "Get a mission (client or reviewer only)",
284
+ schemas: {
285
+ params: missionIdParamsSchema,
286
+ response: { 200: missionResponseSchema }
287
+ }
288
+ }),
289
+ updateMissionStatus: require_defineRoute.defineRoute({
290
+ method: "PUT",
291
+ path: "/mission/:missionId/status",
292
+ summary: "Move a mission through its workflow",
293
+ schemas: {
294
+ params: missionIdParamsSchema,
295
+ body: zod_mini.z.object({ status: missionStatusSchema }),
296
+ response: { 200: missionResponseSchema }
297
+ }
298
+ }),
299
+ submitReview: require_defineRoute.defineRoute({
300
+ method: "POST",
301
+ path: "/mission/:missionId/review",
302
+ summary: "Rate the reviewer of a completed mission",
303
+ schemas: {
304
+ params: missionIdParamsSchema,
305
+ body: zod_mini.z.object({
306
+ rating: zod_mini.z.number().check(zod_mini.z.gte(1), zod_mini.z.lte(5)),
307
+ comment: zod_mini.z.optional(zod_mini.z.string())
308
+ }),
309
+ response: { 200: require_responseData.responseDataSchema(reviewerReviewSchema) }
310
+ }
311
+ }),
312
+ getChatHistory: require_defineRoute.defineRoute({
313
+ method: "GET",
314
+ path: "/mission/:missionId/chat/history",
315
+ summary: "Messages of a mission chat",
316
+ schemas: {
317
+ params: missionIdParamsSchema,
318
+ response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(reviewerMessageSchema)) }
319
+ }
320
+ }),
321
+ sendMessage: require_defineRoute.defineRoute({
322
+ method: "POST",
323
+ path: "/mission/:missionId/chat",
324
+ summary: "Send a message in a mission chat",
325
+ schemas: {
326
+ params: missionIdParamsSchema,
327
+ body: zod_mini.z.object({ content: zod_mini.z.string().check(zod_mini.z.minLength(1)) }),
328
+ response: { 200: require_responseData.responseDataSchema(reviewerMessageSchema) }
329
+ }
330
+ }),
331
+ chatSSE: require_defineRoute.defineRoute({
332
+ method: "GET",
333
+ path: "/mission/:missionId/chat/stream",
334
+ summary: "Mission chat (server-sent events stream)",
335
+ schemas: { params: missionIdParamsSchema }
336
+ }),
337
+ createPaymentIntent: require_defineRoute.defineRoute({
338
+ method: "POST",
339
+ path: "/mission/:missionId/payment/intent",
340
+ summary: "Payment intent of a mission (not available yet)",
341
+ schemas: { params: missionIdParamsSchema }
342
+ }),
343
+ confirmPayment: require_defineRoute.defineRoute({
344
+ method: "POST",
345
+ path: "/mission/:missionId/payment/confirm",
346
+ summary: "Confirm the payment of a mission (not available yet)",
347
+ schemas: { params: missionIdParamsSchema }
348
+ }),
349
+ requestPayout: require_defineRoute.defineRoute({
350
+ method: "POST",
351
+ path: "/payout",
352
+ summary: "Request a payout (not available yet)",
353
+ schemas: {}
354
+ }),
355
+ contactReviewer: require_defineRoute.defineRoute({
356
+ method: "POST",
357
+ path: "/:reviewerId/contact",
358
+ summary: "Send a message to a reviewer before booking",
359
+ schemas: {
360
+ params: reviewerIdParamsSchema,
361
+ body: zod_mini.z.object({ message: zod_mini.z.string().check(zod_mini.z.minLength(1)) }),
362
+ response: { 200: require_responseData.responseDataSchema(zod_mini.z.unknown()) }
363
+ }
364
+ }),
365
+ getAdminReviewers: require_defineRoute.defineRoute({
366
+ method: "GET",
367
+ path: "/admin/reviewers",
368
+ summary: "Admin only: list reviewer profiles by status",
369
+ schemas: {
370
+ querystring: zod_mini.z.object({
371
+ ...require_common.paginationQueryShape,
372
+ status: zod_mini.z.optional(zod_mini.z.string())
373
+ }),
374
+ response: { 200: require_responseData.paginatedResponseSchema(reviewerProfileSchema) }
375
+ }
376
+ }),
377
+ validateReviewerProfile: require_defineRoute.defineRoute({
378
+ method: "PUT",
379
+ path: "/:reviewerId/validate",
380
+ summary: "Admin only: activate a reviewer profile",
381
+ schemas: {
382
+ params: reviewerIdParamsSchema,
383
+ response: { 200: profileResponseSchema }
384
+ }
385
+ })
386
+ }
387
+ });
388
+
389
+ //#endregion
390
+ exports.REVIEWER_CATEGORIES = REVIEWER_CATEGORIES;
391
+ exports.missionEstimateSchema = missionEstimateSchema;
392
+ exports.missionStatusSchema = missionStatusSchema;
393
+ exports.priceDistributionSchema = priceDistributionSchema;
394
+ exports.reviewerCategorySchema = reviewerCategorySchema;
395
+ exports.reviewerContract = reviewerContract;
396
+ exports.reviewerMessageSchema = reviewerMessageSchema;
397
+ exports.reviewerProfileSchema = reviewerProfileSchema;
398
+ exports.reviewerReviewSchema = reviewerReviewSchema;
399
+ exports.reviewerStatusSchema = reviewerStatusSchema;
400
+ exports.translationMissionSchema = translationMissionSchema;
401
+ //# sourceMappingURL=reviewer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewer.cjs","names":["z","dateTimeSchema","repeatableQueryValueSchema","objectIdSchema","responseDataSchema","paginationQueryShape","defineRouteGroup","defineRoute","paginatedResponseSchema"],"sources":["../../src/reviewer.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport {\n dateTimeSchema,\n objectIdSchema,\n paginationQueryShape,\n repeatableQueryValueSchema,\n} from './common';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n type RouteQuerystring,\n} from './defineRoute';\nimport {\n type PaginatedResponse,\n paginatedResponseSchema,\n type ResponseData,\n responseDataSchema,\n} from './responseData';\n\n/** Number sent in a query string (parsed by the handler). */\nconst numericQueryValueSchema = z.union([z.string(), z.number()]);\n\nexport const reviewerStatusSchema = z.enum(['pending', 'active', 'suspended']);\n\nexport const reviewerCategorySchema = z.enum([\n 'copywriter',\n 'translator',\n 'proofreader',\n 'technical_writer',\n 'marketing',\n 'seo',\n]);\n\n/** Reviewer categories, usable as values. */\nexport const REVIEWER_CATEGORIES = reviewerCategorySchema.options;\n\nexport const missionStatusSchema = z.enum([\n 'pending',\n 'accepted',\n 'in_progress',\n 'reviewer_review',\n 'client_review',\n 'completed',\n 'canceled',\n]);\n\nconst languagePairSchema = z.object({ from: z.string(), to: z.string() });\n\nconst socialLinksSchema = z.object({\n github: z.optional(z.string()),\n linkedin: z.optional(z.string()),\n portfolio: z.optional(z.string()),\n});\n\n/** Public reviewer profile (marketplace). */\nexport const reviewerProfileSchema = z.looseObject({\n id: z.string(),\n userId: z.string(),\n /** Public name and avatar of the linked user. */\n name: z.optional(z.string()),\n avatar: z.optional(z.string()),\n bio: z.optional(z.string()),\n mainPicture: z.optional(z.string()),\n coverPicture: z.optional(z.string()),\n languagePairs: z.array(languagePairSchema),\n categories: z.array(reviewerCategorySchema),\n /** In cents (5000 = $50/hour). */\n pricePerHour: z.number(),\n status: reviewerStatusSchema,\n totalMissions: z.number(),\n /** 0 to 5. */\n averageRating: z.number(),\n reviewCount: z.number(),\n socialLinks: z.optional(socialLinksSchema),\n isHidden: z.optional(z.boolean()),\n createdAt: dateTimeSchema,\n updatedAt: dateTimeSchema,\n});\n\n/** Booked review/translation work. */\nexport const translationMissionSchema = z.looseObject({\n id: z.string(),\n reviewerId: z.string(),\n clientUserId: z.string(),\n projectId: z.optional(z.string()),\n dictionaryIds: z.array(z.string()),\n sourceLocale: z.optional(z.string()),\n targetLocales: z.array(z.string()),\n wordCount: z.number(),\n estimatedHours: z.number(),\n /** Snapshot of the reviewer price at booking time, in cents. */\n pricePerHour: z.number(),\n /** In cents. */\n totalPrice: z.number(),\n currency: z.string(),\n status: missionStatusSchema,\n notes: z.optional(z.string()),\n aiPreGeneratedAt: z.optional(dateTimeSchema),\n completedAt: z.optional(dateTimeSchema),\n canceledAt: z.optional(dateTimeSchema),\n createdAt: dateTimeSchema,\n updatedAt: dateTimeSchema,\n});\n\nexport const reviewerReviewSchema = z.looseObject({\n id: z.string(),\n missionId: z.string(),\n reviewerId: z.string(),\n /** 1 to 5. */\n rating: z.number(),\n comment: z.optional(z.string()),\n createdAt: dateTimeSchema,\n updatedAt: dateTimeSchema,\n});\n\nexport const reviewerMessageSchema = z.looseObject({\n id: z.string(),\n missionId: z.string(),\n senderId: z.string(),\n content: z.string(),\n readAt: z.optional(dateTimeSchema),\n createdAt: dateTimeSchema,\n updatedAt: dateTimeSchema,\n});\n\nexport const missionEstimateSchema = z.object({\n wordCount: z.number(),\n estimatedHours: z.number(),\n /** In cents. */\n totalPrice: z.number(),\n currency: z.string(),\n});\n\nexport const priceDistributionSchema = z.object({\n buckets: z.array(\n z.object({ min: z.number(), max: z.number(), count: z.number() })\n ),\n globalMin: z.number(),\n globalMax: z.number(),\n});\n\nconst marketplaceFiltersShape = {\n fromLocale: z.optional(z.string()),\n toLocale: z.optional(z.string()),\n minRating: z.optional(numericQueryValueSchema),\n categories: z.optional(repeatableQueryValueSchema),\n};\n\nconst reviewerProfileBodyShape = {\n bio: z.optional(z.string()),\n languagePairs: z.array(languagePairSchema),\n categories: z.optional(z.array(reviewerCategorySchema)),\n /** In cents. */\n pricePerHour: z.number(),\n socialLinks: z.optional(socialLinksSchema),\n};\n\nconst reviewerIdParamsSchema = z.object({ reviewerId: objectIdSchema });\nconst missionIdParamsSchema = z.object({ missionId: objectIdSchema });\nconst profileResponseSchema = responseDataSchema(reviewerProfileSchema);\nconst missionResponseSchema = responseDataSchema(translationMissionSchema);\nconst paginatedQuerySchema = z.object(paginationQueryShape);\n\n/** REST contract of the `/api/reviewer` routes (translator marketplace). */\nexport const reviewerContract = defineRouteGroup({\n prefix: '/api/reviewer',\n tag: 'Reviewer',\n routes: {\n getMarketplace: defineRoute({\n method: 'GET',\n path: '/marketplace',\n summary: 'Search the reviewer marketplace',\n schemas: {\n querystring: z.object({\n ...paginationQueryShape,\n ...marketplaceFiltersShape,\n maxPricePerHour: z.optional(numericQueryValueSchema),\n minPricePerHour: z.optional(numericQueryValueSchema),\n }),\n response: { 200: paginatedResponseSchema(reviewerProfileSchema) },\n },\n }),\n getPriceDistribution: defineRoute({\n method: 'GET',\n path: '/marketplace/price-distribution',\n summary: 'Price histogram of the marketplace (filter slider)',\n schemas: {\n querystring: z.object(marketplaceFiltersShape),\n response: { 200: responseDataSchema(priceDistributionSchema) },\n },\n }),\n getMyReviewerProfile: defineRoute({\n method: 'GET',\n path: '/me',\n summary: 'Reviewer profile of the signed-in user',\n schemas: {\n response: {\n 200: responseDataSchema(z.nullable(reviewerProfileSchema)),\n },\n },\n }),\n getReviewerReviews: defineRoute({\n method: 'GET',\n path: '/:reviewerId/reviews',\n summary: 'Reviews left on a reviewer',\n schemas: {\n params: reviewerIdParamsSchema,\n querystring: paginatedQuerySchema,\n response: { 200: paginatedResponseSchema(reviewerReviewSchema) },\n },\n }),\n getReviewerById: defineRoute({\n method: 'GET',\n path: '/:reviewerId',\n summary: 'Public profile of a reviewer',\n schemas: {\n params: reviewerIdParamsSchema,\n response: { 200: profileResponseSchema },\n },\n }),\n registerAsReviewer: defineRoute({\n method: 'POST',\n path: '/register',\n summary: 'Create the reviewer profile of the signed-in user',\n schemas: {\n body: z.object(reviewerProfileBodyShape),\n response: { 200: profileResponseSchema },\n },\n }),\n updateReviewerProfile: defineRoute({\n method: 'PUT',\n path: '/',\n summary: 'Update the reviewer profile of the signed-in user',\n schemas: {\n body: z.object({\n ...z.partial(z.object(reviewerProfileBodyShape)).shape,\n isHidden: z.optional(z.boolean()),\n }),\n response: { 200: profileResponseSchema },\n },\n }),\n deleteReviewerProfile: defineRoute({\n method: 'DELETE',\n path: '/',\n summary: 'Delete the reviewer profile of the signed-in user',\n schemas: {\n response: { 200: responseDataSchema(z.null()) },\n },\n }),\n uploadMainPicture: defineRoute({\n method: 'POST',\n path: '/me/picture/main',\n summary: 'Upload the main picture (raw `image/*` body)',\n schemas: { response: { 200: profileResponseSchema } },\n }),\n uploadCoverPicture: defineRoute({\n method: 'POST',\n path: '/me/picture/cover',\n summary: 'Upload the cover picture (raw `image/*` body)',\n schemas: { response: { 200: profileResponseSchema } },\n }),\n estimateMission: defineRoute({\n method: 'POST',\n path: '/mission/estimate',\n summary: 'Estimate the price of a mission',\n schemas: {\n body: z.object({\n dictionaryIds: z.array(z.string()),\n sourceLocale: z.optional(z.string()),\n /** In cents. */\n pricePerHour: z.number(),\n }),\n response: { 200: responseDataSchema(missionEstimateSchema) },\n },\n }),\n createMission: defineRoute({\n method: 'POST',\n path: '/mission',\n summary: 'Book a reviewer',\n schemas: {\n body: z.object({\n reviewerId: objectIdSchema,\n dictionaryIds: z.optional(z.array(z.string())),\n /** Optional: non-translation missions (ex: SEO review) have no locales. */\n sourceLocale: z.optional(z.string()),\n targetLocales: z.optional(z.array(z.string())),\n projectId: z.optional(z.string()),\n notes: z.optional(z.string()),\n }),\n response: { 200: missionResponseSchema },\n },\n }),\n getMyMissions: defineRoute({\n method: 'GET',\n path: '/mission',\n summary: 'Missions of the signed-in user (as client or reviewer)',\n schemas: {\n querystring: z.object({\n ...paginationQueryShape,\n role: z.optional(z.enum(['client', 'reviewer'])),\n }),\n response: { 200: paginatedResponseSchema(translationMissionSchema) },\n },\n }),\n getMissionById: defineRoute({\n method: 'GET',\n path: '/mission/:missionId',\n summary: 'Get a mission (client or reviewer only)',\n schemas: {\n params: missionIdParamsSchema,\n response: { 200: missionResponseSchema },\n },\n }),\n updateMissionStatus: defineRoute({\n method: 'PUT',\n path: '/mission/:missionId/status',\n summary: 'Move a mission through its workflow',\n schemas: {\n params: missionIdParamsSchema,\n body: z.object({ status: missionStatusSchema }),\n response: { 200: missionResponseSchema },\n },\n }),\n submitReview: defineRoute({\n method: 'POST',\n path: '/mission/:missionId/review',\n summary: 'Rate the reviewer of a completed mission',\n schemas: {\n params: missionIdParamsSchema,\n body: z.object({\n rating: z.number().check(z.gte(1), z.lte(5)),\n comment: z.optional(z.string()),\n }),\n response: { 200: responseDataSchema(reviewerReviewSchema) },\n },\n }),\n getChatHistory: defineRoute({\n method: 'GET',\n path: '/mission/:missionId/chat/history',\n summary: 'Messages of a mission chat',\n schemas: {\n params: missionIdParamsSchema,\n response: {\n 200: responseDataSchema(z.array(reviewerMessageSchema)),\n },\n },\n }),\n sendMessage: defineRoute({\n method: 'POST',\n path: '/mission/:missionId/chat',\n summary: 'Send a message in a mission chat',\n schemas: {\n params: missionIdParamsSchema,\n body: z.object({ content: z.string().check(z.minLength(1)) }),\n response: { 200: responseDataSchema(reviewerMessageSchema) },\n },\n }),\n chatSSE: defineRoute({\n method: 'GET',\n path: '/mission/:missionId/chat/stream',\n summary: 'Mission chat (server-sent events stream)',\n schemas: { params: missionIdParamsSchema },\n }),\n createPaymentIntent: defineRoute({\n method: 'POST',\n path: '/mission/:missionId/payment/intent',\n summary: 'Payment intent of a mission (not available yet)',\n schemas: { params: missionIdParamsSchema },\n }),\n confirmPayment: defineRoute({\n method: 'POST',\n path: '/mission/:missionId/payment/confirm',\n summary: 'Confirm the payment of a mission (not available yet)',\n schemas: { params: missionIdParamsSchema },\n }),\n requestPayout: defineRoute({\n method: 'POST',\n path: '/payout',\n summary: 'Request a payout (not available yet)',\n schemas: {},\n }),\n contactReviewer: defineRoute({\n method: 'POST',\n path: '/:reviewerId/contact',\n summary: 'Send a message to a reviewer before booking',\n schemas: {\n params: reviewerIdParamsSchema,\n body: z.object({ message: z.string().check(z.minLength(1)) }),\n response: { 200: responseDataSchema(z.unknown()) },\n },\n }),\n getAdminReviewers: defineRoute({\n method: 'GET',\n path: '/admin/reviewers',\n summary: 'Admin only: list reviewer profiles by status',\n schemas: {\n querystring: z.object({\n ...paginationQueryShape,\n status: z.optional(z.string()),\n }),\n response: { 200: paginatedResponseSchema(reviewerProfileSchema) },\n },\n }),\n validateReviewerProfile: defineRoute({\n method: 'PUT',\n path: '/:reviewerId/validate',\n summary: 'Admin only: activate a reviewer profile',\n schemas: {\n params: reviewerIdParamsSchema,\n response: { 200: profileResponseSchema },\n },\n }),\n },\n});\n\n/** Route definitions of the `/api/reviewer` group, by name. */\nexport type ReviewerRoutes = (typeof reviewerContract)['routes'];\n\nexport type ReviewerStatus = z.output<typeof reviewerStatusSchema>;\nexport type ReviewerCategory = z.output<typeof reviewerCategorySchema>;\nexport type MissionStatus = z.output<typeof missionStatusSchema>;\nexport type ReviewerProfileAPI = z.output<typeof reviewerProfileSchema>;\nexport type TranslationMissionAPI = z.output<typeof translationMissionSchema>;\nexport type ReviewerReviewAPI = z.output<typeof reviewerReviewSchema>;\nexport type ReviewerMessageAPI = z.output<typeof reviewerMessageSchema>;\nexport type MissionEstimate = z.output<typeof missionEstimateSchema>;\nexport type PriceDistributionData = z.output<typeof priceDistributionSchema>;\nexport type PriceDistributionBucket = PriceDistributionData['buckets'][number];\n\ntype MarketplaceNumericFilter =\n | 'page'\n | 'pageSize'\n | 'minRating'\n | 'minPricePerHour'\n | 'maxPricePerHour';\n\n/** Marketplace query as built by clients (numbers are serialized). */\nexport type GetMarketplaceQuery = Omit<\n RouteQuerystring<ReviewerRoutes['getMarketplace']>,\n MarketplaceNumericFilter\n> & { [Filter in MarketplaceNumericFilter]?: number };\nexport type RegisterReviewerBody = RouteBodyInput<\n ReviewerRoutes['registerAsReviewer']\n>;\nexport type UpdateReviewerBody = RouteBodyInput<\n ReviewerRoutes['updateReviewerProfile']\n>;\nexport type UploadReviewerPictureResult = ResponseData<ReviewerProfileAPI>;\nexport type SubmitReviewBody = RouteBodyInput<ReviewerRoutes['submitReview']>;\nexport type EstimateMissionBody = RouteBodyInput<\n ReviewerRoutes['estimateMission']\n>;\nexport type CreateMissionBody = RouteBodyInput<ReviewerRoutes['createMission']>;\nexport type UpdateMissionStatusBody = RouteBodyInput<\n ReviewerRoutes['updateMissionStatus']\n>;\nexport type SendMessageBody = RouteBodyInput<ReviewerRoutes['sendMessage']>;\nexport type ContactReviewerBody = RouteBodyInput<\n ReviewerRoutes['contactReviewer']\n>;\nexport type GetMarketplaceResult = PaginatedResponse<ReviewerProfileAPI>;\n"],"mappings":";;;;;;;;AAqBA,MAAM,0BAA0BA,WAAE,MAAM,CAACA,WAAE,OAAO,GAAGA,WAAE,OAAO,CAAC,CAAC;AAEhE,MAAa,uBAAuBA,WAAE,KAAK;CAAC;CAAW;CAAU;AAAW,CAAC;AAE7E,MAAa,yBAAyBA,WAAE,KAAK;CAC3C;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,MAAa,sBAAsB,uBAAuB;AAE1D,MAAa,sBAAsBA,WAAE,KAAK;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,qBAAqBA,WAAE,OAAO;CAAE,MAAMA,WAAE,OAAO;CAAG,IAAIA,WAAE,OAAO;AAAE,CAAC;AAExE,MAAM,oBAAoBA,WAAE,OAAO;CACjC,QAAQA,WAAE,SAASA,WAAE,OAAO,CAAC;CAC7B,UAAUA,WAAE,SAASA,WAAE,OAAO,CAAC;CAC/B,WAAWA,WAAE,SAASA,WAAE,OAAO,CAAC;AAClC,CAAC;;AAGD,MAAa,wBAAwBA,WAAE,YAAY;C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