@intlayer/backend-contract 9.7.2 → 9.7.3

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.
@@ -1 +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,WA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CAAY;GACxB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EACR,KAAKI,wCACHT,WAAE,OAAO,EAAE,SAASA,WAAE,MAAM,oBAAoB,EAAE,CAAC,CACrD,EACF,EACF;EACF,CAAC;EACD,gBAAgBK,gCAAY;GAC1B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAML,WAAE,OAAO,EAAE,cAAcA,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"}
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 * `false` runs AI calls on the plan credits instead of the own key.\n * Missing means enabled.\n */\n isOwnAPIKeyEnabled?: 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;;;;;AAkBtD,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,CAA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F,CAAC;EACD,gBAAgBK,gCAAY;GAC1B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAML,WAAE,OAAO,EAAE,cAAcA,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"project.mjs","names":[],"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,eAAe,kBAA0B;;;;;AAatD,MAAa,6BAA6B,EAAE,YAAY;CACtD,sBAAsB,EAAE,SACtB,EAAE,YAAY;EACZ,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;EACzC,eAAe,EAAE,SAAS,YAAY;CACxC,CAAC,CACH;CACA,QAAQ,EAAE,SACR,EAAE,YAAY;EACZ,gBAAgB,EAAE,SAAS,kBAA2B,CAAC;EACvD,QAAQ,EAAE,SAAS,kBAA2B,CAAC;CACjD,CAAC,CACH;CACA,IAAI,EAAE,SAAS,iBAAkC,CAAC;AACpD,CAAC;;AAGD,MAAa,gBAAgB,EAAE,YAAY;CACzC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,MAAM,EAAE,OAAO;CACf,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;;CAE/B,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;AAC/B,CAAC;;AAGD,MAAa,kBAAkB,EAAE,OAAO;CACtC,mBAAmB,EAAE,SAAS,EAAE,QAAQ,CAAC;;CAEzC,wBAAwB,EAAE,SAA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MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,UAAU,EAAE,KAAK,mBAAmB,aAAa,EAAE;GACrD;EACF,CAAC;EACD,oBAAoB,YAAY;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ,EAAE,OAAO,EAAE,QAAQ,eAAe,CAAC;IAC3C,MAAM,EAAE,OAAO;KACb,uBAAuB;KACvB,gBAAgB;IAClB,CAAC;IACD,UAAU,EACR,KAAK,mBAAmB,iCAAiC,EAC3D;GACF;EACF,CAAC;CACH;AACF,CAAC"}
1
+ {"version":3,"file":"project.mjs","names":[],"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 * `false` runs AI calls on the plan credits instead of the own key.\n * Missing means enabled.\n */\n isOwnAPIKeyEnabled?: 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,eAAe,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;GACT,SAAS,EACP,UAAU,EACR,KAAK,mBACH,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,EAAE,CAAC,CACrD,EACF,EACF;EACF,CAAC;EACD,gBAAgB,YAAY;GAC1B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;IACxD,UAAU,EAAE,KAAK,mBAAmB,oBAAoB,EAAE;GAC5D;EACF,CAAC;EACD,oBAAoB,YAAY;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EAAE,KAAK,mBAAmB,cAAc,EAAE,EACtD;EACF,CAAC;EACD,qBAAqB,YAAY;GAC/B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EACR,KAAK,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAC5D,EACF;EACF,CAAC;EACD,wBAAwB,YAAY;GAClC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,UAAU,EAAE,KAAK,mBAAmB,aAAa,EAAE;GACrD;EACF,CAAC;EACD,oBAAoB,YAAY;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ,EAAE,OAAO,EAAE,QAAQ,eAAe,CAAC;IAC3C,MAAM,EAAE,OAAO;KACb,uBAAuB;KACvB,gBAAgB;IAClB,CAAC;IACD,UAAU,EACR,KAAK,mBAAmB,iCAAiC,EAC3D;GACF;EACF,CAAC;CACH;AACF,CAAC"}
@@ -10,6 +10,11 @@ export type ProjectConfigAI = Partial<AiConfig> & {
10
10
  /** Masked API key (`sk-proj-****abcd`), never the real one. */
11
11
  apiKey?: string;
12
12
  apiKeyConfigured?: boolean;
13
+ /**
14
+ * `false` runs AI calls on the plan credits instead of the own key.
15
+ * Missing means enabled.
16
+ */
17
+ isOwnAPIKeyEnabled?: boolean;
13
18
  };
14
19
  /**
15
20
  * Project-level overrides of the Intlayer configuration. Loose objects: the
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","names":["_$__defineRoute0.RouteDefinition"],"sources":["../../src/project.ts"],"mappings":";;;;;;qBA2Ba,cAAY,EAAA,cAAA,QAAA;;YAGb,kBAAkB,QAAQ;;EAEpC;EACA;;;;;;qBAOW,4BAA0B,EAAA;;;;;;;;;;GAcrC,EAAA,KAAA;;qBAGW,eAAa,EAAA;;;;;;GAOxB,EAAA,KAAA;;qBAGW,iBAAe,EAAA;;;;;;;;;;GAK1B,EAAA,KAAA;;qBAGW,0BAAwB,EAAA;;;;;;;;;;;qBAoBxB,4BAA0B,EAAA,2BAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoBrC,EAAA,KAAA;;qBAQW,mBAAiB,EAAA;;;;;;;;;;;;;;;;;GAO5B,EAAA,KAAA;;qBAGW,mCAAiC,EAAA;;;;GAI5C,EAAA,KAAA;;qBAGW,iBAAe,EAAA;;;;;;;;;;;;GAa1B,EAAA,KAAA;;qBAGW,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmBxB,EAAA,KAAA;;qBAGW,qBAAmB,EAAA;;;;;;;GAQ9B,EAAA,KAAA;;qBAGW,uBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BhC,EAAA,KAAA;;qBAGW,gBAAc,EAAA;;;;;;GAMzB,EAAA,KAAA;cAKI,sBAAoB,EAAA;;;;GAIxB,EAAA,KAAA;;qBAGW,iB;W,aAqBUA;;;;;;;;;;;;;;;;;MAAH,KAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAE,cAAc;YACvC,UAAU,EAAE,cAAc;YAC1B,kBAAkB,EAAE,cAAc;YAClC,qBAAqB,EAAE,cAAc;YACrC,uBAAuB,EAAE,cAAc;YACvC,iBAAiB,EAAE,cAAc;YACjC,iCAAiC,EAAE,cACtC;YAEG,kBAAkB,EAAE,cAAc;YAClC,aAAa,EAAE,cAAc;YAC7B,kBAAkB,EAAE,cAAc;YAClC,WAAW,EAAE,cAAc;YAG3B,oBAAoB,iBAAiB;YACrC,oBAAoB,kBAAkB;YACtC,2BAA2B,aAAa;YACxC,iBAAiB,eAAe;YAChC,mBAAmB,aAAa;YAChC,oBAAoB,eAAe;YACnC,sBAAsB,aAAa;YACnC,2BAA2B,eACrC;YAEU,6BAA6B,aAAa;YAC1C,+BAA+B,eACzC;YAEU,iCAAiC,aAAa;YAC9C,sBAAsB,aAAa;YACnC,qBAAqB,YAAY;YACjC,sBAAsB,aAAa;YACnC,wBAAwB;;YAExB,sBAAsB,KAChC,eAAe;EAEX,YAAY;;YACN,0BAA0B,aAAa;YACvC,uBAAuB,UAAU;YACjC,2BAA2B,aAAa;YACxC,sBAAsB,UAAU;YAChC,0BAA0B;YAC1B,qBAAqB;EAC/B,SAAS,EAAE,cAAc;;YAEf,qBAAqB,UAAU;YAC/B,uBAAuB,aACjC,EAAE,cAAc;YAEN,2BAA2B,aAAa;YACxC,4BAA4B;EAAe;;YAC3C,+BAA+B,aAAa;YAC5C,2BAA2B,YACrC;YAEU,yBAAyB,eACnC;YAEU,2BACV,aAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/backend-contract",
3
- "version": "9.7.2",
3
+ "version": "9.7.3",
4
4
  "private": false,
5
5
  "description": "Shared REST contract (routes + zod schemas) between the Intlayer backend, its typed client and the OpenAPI documentation.",
6
6
  "keywords": [
@@ -280,7 +280,7 @@
280
280
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
281
281
  },
282
282
  "dependencies": {
283
- "@intlayer/types": "9.7.2",
283
+ "@intlayer/types": "9.7.3",
284
284
  "zod": "4.6.7"
285
285
  },
286
286
  "devDependencies": {