@mastra/factory 0.28.0-alpha.13 → 0.28.0-alpha.15
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.
- package/README.md +43 -28
- package/dist/boards/board-writes.d.ts +3 -3
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +24 -20
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/project-boards.d.ts +20 -0
- package/dist/boards/project-boards.d.ts.map +1 -1
- package/dist/boards/project-boards.js +35 -11
- package/dist/boards/project-boards.js.map +1 -1
- package/dist/boards/registry.d.ts.map +1 -1
- package/dist/boards/registry.js +0 -3
- package/dist/boards/registry.js.map +1 -1
- package/dist/environment/build-runner.d.ts +13 -2
- package/dist/environment/build-runner.d.ts.map +1 -1
- package/dist/environment/build-runner.js +42 -0
- package/dist/environment/build-runner.js.map +1 -1
- package/dist/environment/build-workflow.d.ts +6 -4
- package/dist/environment/build-workflow.d.ts.map +1 -1
- package/dist/environment/build-workflow.js +70 -66
- package/dist/environment/build-workflow.js.map +1 -1
- package/dist/environment/build.d.ts +19 -4
- package/dist/environment/build.d.ts.map +1 -1
- package/dist/environment/build.js +70 -14
- package/dist/environment/build.js.map +1 -1
- package/dist/factory.d.ts +5 -2
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +29 -24
- package/dist/factory.js.map +1 -1
- package/dist/integrations/github/sandbox-release.d.ts +12 -0
- package/dist/integrations/github/sandbox-release.d.ts.map +1 -1
- package/dist/integrations/github/sandbox-release.js +16 -1
- package/dist/integrations/github/sandbox-release.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +24 -12
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/jira/integration.d.ts.map +1 -1
- package/dist/integrations/platform/jira/integration.js +5 -1
- package/dist/integrations/platform/jira/integration.js.map +1 -1
- package/dist/routes/board-snapshot.d.ts +5 -0
- package/dist/routes/board-snapshot.d.ts.map +1 -1
- package/dist/routes/board-snapshot.js +12 -1
- package/dist/routes/board-snapshot.js.map +1 -1
- package/dist/routes/boards.d.ts +2 -3
- package/dist/routes/boards.d.ts.map +1 -1
- package/dist/routes/boards.js.map +1 -1
- package/dist/routes/contracts.d.ts +66 -0
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +41 -1
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +5 -0
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/sandbox-envs.d.ts +2 -0
- package/dist/routes/sandbox-envs.d.ts.map +1 -1
- package/dist/routes/sandbox-envs.js +3 -0
- package/dist/routes/sandbox-envs.js.map +1 -1
- package/dist/routes/source-control-settings.d.ts +2 -0
- package/dist/routes/source-control-settings.d.ts.map +1 -1
- package/dist/routes/source-control-settings.js +5 -0
- package/dist/routes/source-control-settings.js.map +1 -1
- package/dist/routes/surface.d.ts +2 -0
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +2 -1
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/work-item-activity.d.ts +11 -0
- package/dist/routes/work-item-activity.d.ts.map +1 -0
- package/dist/routes/work-item-activity.js +25 -0
- package/dist/routes/work-item-activity.js.map +1 -0
- package/dist/routes/work-item-starters.d.ts +29 -0
- package/dist/routes/work-item-starters.d.ts.map +1 -0
- package/dist/routes/work-item-starters.js +169 -0
- package/dist/routes/work-item-starters.js.map +1 -0
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +59 -1
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +49 -14
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/transition-service.d.ts +20 -2
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +40 -18
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/sandbox/context-sandboxes.d.ts +70 -0
- package/dist/sandbox/context-sandboxes.d.ts.map +1 -0
- package/dist/sandbox/context-sandboxes.js +120 -0
- package/dist/sandbox/context-sandboxes.js.map +1 -0
- package/dist/sandbox/session-retirement.d.ts +11 -4
- package/dist/sandbox/session-retirement.d.ts.map +1 -1
- package/dist/sandbox/session-retirement.js +39 -13
- package/dist/sandbox/session-retirement.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +25 -5
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +57 -20
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts +8 -2
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +21 -4
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +17 -4
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +24 -4
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/legacy-review.d.ts +19 -1
- package/dist/storage/domains/work-items/legacy-review.d.ts.map +1 -1
- package/dist/storage/domains/work-items/legacy-review.js +47 -2
- package/dist/storage/domains/work-items/legacy-review.js.map +1 -1
- package/dist/tools/annotations.d.ts.map +1 -1
- package/dist/tools/annotations.js +4 -0
- package/dist/tools/annotations.js.map +1 -1
- package/dist/tools/audit-events-tool.d.ts +29 -0
- package/dist/tools/audit-events-tool.d.ts.map +1 -0
- package/dist/tools/audit-events-tool.js +180 -0
- package/dist/tools/audit-events-tool.js.map +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/permissions.js +1 -0
- package/dist/tools/permissions.js.map +1 -1
- package/dist/tools/sessions-state-processor.js +1 -1
- package/dist/tools/sessions-state-processor.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","names":[],"sources":["../../../../src/integrations/platform/jira/integration.ts"],"sourcesContent":["import type { RequestContext } from '@mastra/core/request-context';\nimport type { ApiRoute } from '@mastra/core/server';\nimport type { MastraWorker } from '@mastra/core/worker';\n\nimport type { IntegrationConnection } from '../../../capabilities/connection.js';\nimport type {\n CreateIntakeCommentInput,\n CreatedIntakeComment,\n GetIntakeIssueInput,\n Intake,\n IntakeIssue,\n IntakeIssueDetail,\n IntakeItemPage,\n IntakeSource,\n ListIntakeIssuesInput,\n ListIntakeItemsInput,\n ResolveIntakeDispatchInput,\n ResolvedIntakeDispatch,\n UpdateIntakeIssueInput,\n} from '../../../capabilities/intake.js';\nimport type { RouteAuth } from '../../../routes/route.js';\nimport type { FactoryProjectsStorage } from '../../../storage/domains/projects/base.js';\nimport type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../../base.js';\nimport { IssueReconcileWorker } from '../../issue-reconcile-worker.js';\nimport { adfToText } from '../../jira/adf.js';\nimport type { JiraComment, JiraIssue, JiraTransition } from '../../jira/api.js';\nimport { JiraApiClient, JiraApiError } from '../../jira/api.js';\nimport type { JiraEventRules, JiraRuleOverrides } from '../../jira/default-rules.js';\nimport { resolveJiraRules } from '../../jira/default-rules.js';\nimport { buildIntakeJql, unfilteredJiraScopes } from '../../jira/intake-jql.js';\nimport type { JiraIntakeScope } from '../../jira/intake-jql.js';\nimport { attachJiraIssueReconciler } from '../../jira/issue-reconciler.js';\nimport { jiraReconciliationEnabled, jiraReconciliationInterval } from '../../jira/reconciliation-config.js';\nimport { attachJiraRules } from '../../jira/rules.js';\nimport { logPlatformInfo, PlatformApiClient, platformApiClientConfigFromEnv } from '../api-client.js';\nimport type { PlatformApiClientConfig } from '../api-client.js';\nimport { buildPlatformJiraAgentTools } from './agent-tools.js';\nimport { buildPlatformJiraRoutes } from './routes.js';\n\ninterface PlatformIntegrationConnection {\n id: string;\n integrationId: string;\n status: 'active' | 'needs_reauth';\n accountLabel: string | null;\n}\n\ninterface JiraConnectionContext {\n connection: PlatformIntegrationConnection;\n api: JiraApiClient;\n siteUrl: string;\n}\n\ninterface PlatformConnectionContextResponse {\n connection_config: Record<string, unknown> | null;\n metadata: Record<string, unknown> | null;\n}\n\ninterface JiraIssueReference {\n connectionId: string;\n issueId: string;\n projectId?: string;\n}\n\ninterface JiraPageCursor {\n group: number;\n jira?: string;\n}\n\nconst ISSUE_COMMENTS_MAX_PAGES = 20;\n\n/** Hard stop for project pagination so a misbehaving `isLast` can't loop forever. */\nconst PROJECT_SEARCH_MAX_PAGES = 50;\nconst ISSUE_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_]*-\\d+$/;\nconst PLATFORM_JIRA_PROVIDER_CONFIG_KEY = 'jira';\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nconst JIRA_CONNECTION_TOKEN_PREFIX = 'jira-connection:';\nconst JIRA_ISSUE_REF_PREFIX = 'jira-issue:';\nconst JIRA_SOURCE_PREFIX = 'jira-project:';\n\nconst STATE_TYPE_TO_CATEGORY: Record<'unstarted' | 'started' | 'completed', string> = {\n unstarted: 'new',\n started: 'indeterminate',\n completed: 'done',\n};\n\nfunction stateTypeFromCategory(key: string | undefined): string | null {\n switch (key) {\n case 'new':\n return 'unstarted';\n case 'indeterminate':\n return 'started';\n case 'done':\n return 'completed';\n default:\n return null;\n }\n}\n\nexport interface PlatformJiraIntegrationConfig {\n clientConfig?: PlatformApiClientConfig;\n /** Per-event replacements; omitted events retain defaults, null disables. */\n rules?: JiraRuleOverrides;\n}\n\nexport class PlatformJiraIntegration implements FactoryIntegration {\n readonly id = 'jira';\n readonly #clientConfig: PlatformApiClientConfig;\n readonly #platformClient: PlatformApiClient;\n readonly #endpointHost: string;\n readonly #cloudIdByConnectionId = new Map<string, string>();\n readonly #siteUrlByConnectionId = new Map<string, string>();\n #projects: FactoryProjectsStorage | undefined;\n #auth: RouteAuth | undefined;\n readonly #orgIdByResourceId = new Map<string, string | null>();\n\n readonly #rules: JiraEventRules;\n\n get rules(): JiraEventRules {\n return this.#rules;\n }\n\n constructor(config: PlatformJiraIntegrationConfig = {}) {\n this.#rules = resolveJiraRules(config.rules);\n this.#clientConfig = config.clientConfig ?? platformApiClientConfigFromEnv();\n this.#platformClient = new PlatformApiClient(this.#clientConfig);\n this.#endpointHost = new URL(this.#clientConfig.baseUrl).host;\n }\n\n initialize({ projects, auth }: { projects: FactoryProjectsStorage; auth: RouteAuth }): void {\n this.#projects = projects;\n this.#auth = auth;\n logPlatformInfo('Platform Jira integration initialized', { endpointHost: this.#endpointHost });\n }\n\n get projects(): FactoryProjectsStorage {\n if (!this.#projects)\n throw new Error('PlatformJiraIntegration is not initialized — the factory binds storage during prepare().');\n return this.#projects;\n }\n\n get authEnabled(): boolean {\n return this.#auth?.enabled() ?? false;\n }\n\n async resolveOrgId(resourceId: string): Promise<string | null> {\n const cached = this.#orgIdByResourceId.get(resourceId);\n if (cached !== undefined) return cached;\n if (!UUID_PATTERN.test(resourceId)) {\n this.#orgIdByResourceId.set(resourceId, null);\n return null;\n }\n try {\n await this.projects.ensureReady();\n const project = await this.projects.getById({ id: resourceId });\n const orgId = project?.orgId ?? null;\n this.#orgIdByResourceId.set(resourceId, orgId);\n return orgId;\n } catch {\n return null;\n }\n }\n\n clearCaches(): void {\n this.#orgIdByResourceId.clear();\n this.#cloudIdByConnectionId.clear();\n this.#siteUrlByConnectionId.clear();\n }\n\n async listConnections(): Promise<PlatformIntegrationConnection[]> {\n const providerKey = encodeURIComponent(PLATFORM_JIRA_PROVIDER_CONFIG_KEY);\n const result = await this.#platformClient.request<{ connections: PlatformIntegrationConnection[] }>(\n 'GET',\n `/v2/connections?providerKey=${providerKey}`,\n );\n return result.connections;\n }\n\n async hasActiveConnections(): Promise<boolean> {\n return (await this.#activeConnections()).length > 0;\n }\n\n readonly intake: Intake = {\n bindingLabelFilters: true,\n resolveIntakeDispatch: input => this.#resolveIntakeDispatch(input),\n listSources: () => this.#listSources(),\n listItems: input => this.#listItems(input),\n listIssues: input => this.#listIssues(input),\n getIssue: input => this.#getIssue(input),\n createComment: input => this.#createComment(input),\n updateIssue: input => this.#updateIssue(input),\n };\n\n async #resolveIntakeDispatch({ externalSource }: ResolveIntakeDispatchInput): Promise<ResolvedIntakeDispatch | null> {\n if (externalSource.type !== 'issue') return null;\n const reference = decodeIssueReference(externalSource.externalId);\n if (!reference) return null;\n return {\n connection: jiraConnection(reference.connectionId),\n ...(reference.projectId ? { sourceId: encodeSourceId(reference.connectionId, reference.projectId) } : {}),\n issueId: reference.issueId,\n };\n }\n\n async #listSources(): Promise<IntakeSource[]> {\n const sources: IntakeSource[] = [];\n for (const connection of await this.#activeConnections()) {\n const context = await this.#connectionContext(connection);\n let startAt = 0;\n for (let pageCount = 0; pageCount < PROJECT_SEARCH_MAX_PAGES; pageCount++) {\n const page = await context.api.listProjects({ startAt });\n for (const project of page.values) {\n sources.push({\n id: encodeSourceId(connection.id, project.id),\n name: project.name,\n type: 'project',\n metadata: {\n key: project.key,\n connectionId: connection.id,\n site: new URL(context.siteUrl).host,\n },\n });\n }\n if (page.isLast || page.values.length === 0) break;\n startAt += page.values.length;\n }\n }\n return sources;\n }\n\n async #listItems({ sourceIds, cursor }: ListIntakeItemsInput): Promise<IntakeItemPage> {\n if (sourceIds.length === 0) return { items: [], nextCursor: null };\n const page = await this.listActiveIssues(cursor, unfilteredJiraScopes(sourceIds));\n return {\n items: page.issues.map(issue => ({\n source: { type: 'issue', externalId: issue.externalId, url: issue.url },\n sourceId: issue.sourceId,\n title: `${issue.identifier}: ${issue.title}`,\n status: issue.state ?? undefined,\n labels: issue.labels,\n assignee: issue.assignee,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n metadata: {\n identifier: issue.identifier,\n issueRef: issue.externalId,\n state: issue.state,\n stateType: issue.stateType,\n priority: issue.priority,\n project: issue.source,\n site: issue.site,\n assignee: issue.assignee,\n assignees: issue.assignees ?? [],\n creator: issue.author,\n author: issue.author,\n labels: issue.labels,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n },\n })),\n nextCursor: page.nextCursor,\n };\n }\n\n async #listIssues(input: ListIntakeIssuesInput): Promise<{ issues: IntakeIssue[]; nextCursor: string | null }> {\n const page = await this.listActiveIssues(input.cursor, unfilteredJiraScopes(input.sourceIds ?? []), input.labels);\n return { issues: page.issues, nextCursor: page.nextCursor };\n }\n\n /**\n * One page of active issues across connections. Each scope's `projectId` is\n * an encoded Platform source id; sources are grouped per connection and each\n * group runs one JQL built from only that connection's projects.\n */\n async listActiveIssues(\n cursor?: string,\n scopes: JiraIntakeScope[] = [],\n labels?: string[],\n ): Promise<{\n issues: Array<IntakeIssue & { sourceId: string; externalId: string; site: string }>;\n nextCursor: string | null;\n }> {\n const grouped = groupSources(scopes);\n if (grouped.length === 0) return { issues: [], nextCursor: null };\n const decodedCursor = decodePageCursor(cursor);\n if (decodedCursor.group >= grouped.length) return { issues: [], nextCursor: null };\n\n for (let groupIndex = decodedCursor.group; groupIndex < grouped.length; groupIndex++) {\n const group = grouped[groupIndex]!;\n const context = await this.#connectionContextById(group.connectionId);\n const jql = buildIntakeJql(group.scopes, labels);\n if (jql === null) continue;\n const page = await context.api.searchIssues({\n jql,\n ...(groupIndex === decodedCursor.group && decodedCursor.jira ? { nextPageToken: decodedCursor.jira } : {}),\n });\n const nextCursor = page.nextPageToken\n ? encodePageCursor({ group: groupIndex, jira: page.nextPageToken })\n : groupIndex + 1 < grouped.length\n ? encodePageCursor({ group: groupIndex + 1 })\n : null;\n return {\n issues: page.issues.map(issue => {\n const projectId = issue.fields.project?.id ?? group.scopes[0]?.projectId ?? '';\n return {\n ...this.#toIntakeIssue(issue, context.siteUrl),\n sourceId: encodeSourceId(group.connectionId, projectId),\n externalId: encodeIssueReference({ connectionId: group.connectionId, issueId: issue.key, projectId }),\n site: new URL(context.siteUrl).host,\n };\n }),\n nextCursor,\n };\n }\n return { issues: [], nextCursor: null };\n }\n\n async #getIssue(input: GetIntakeIssueInput): Promise<IntakeIssueDetail | null> {\n const { context, issue } = (await this.#findIssue(input)) ?? {};\n if (!context || !issue) return null;\n const { comments, total } = await this.#listAllComments(context.api, issue.key);\n return {\n ...this.#toIntakeIssue(issue, context.siteUrl),\n commentCount: total,\n description: issue.fields.description ? adfToText(issue.fields.description) || null : null,\n comments: comments.map(comment => ({\n author: comment.author?.displayName ?? null,\n body: adfToText(comment.body),\n createdAt: comment.created,\n })),\n };\n }\n\n async #listAllComments(api: JiraApiClient, keyOrId: string): Promise<{ comments: JiraComment[]; total: number }> {\n const comments: JiraComment[] = [];\n let total = 0;\n for (let page = 0; page < ISSUE_COMMENTS_MAX_PAGES; page++) {\n const result = await api.listComments(keyOrId, { startAt: comments.length });\n comments.push(...result.comments);\n total = result.total;\n if (result.comments.length === 0 || comments.length >= total) break;\n }\n return { comments, total };\n }\n\n async #createComment(input: CreateIntakeCommentInput): Promise<CreatedIntakeComment | null> {\n const resolved = await this.#resolveRequest(input);\n let key = resolved.issueId;\n if (!ISSUE_KEY_PATTERN.test(key)) {\n try {\n key = (await resolved.context.api.getIssue(key)).key;\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) return null;\n throw error;\n }\n }\n let comment;\n try {\n comment = await resolved.context.api.createComment(key, input.body);\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) return null;\n throw error;\n }\n return {\n id: comment.id,\n url: `${resolved.context.siteUrl}/browse/${key}?focusedCommentId=${comment.id}`,\n };\n }\n\n async #updateIssue(input: UpdateIntakeIssueInput): Promise<IntakeIssue | null> {\n const resolved = await this.#resolveRequest(input);\n let issue: JiraIssue;\n try {\n issue = await resolved.context.api.getIssue(resolved.issueId);\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) return null;\n throw error;\n }\n if (currentStatusMatches(issue, input.state)) return this.#toIntakeIssue(issue, resolved.context.siteUrl);\n const transitions = await resolved.context.api.listTransitions(issue.key);\n const transition = resolveTransition(transitions, input.state);\n if (!transition) return null;\n await resolved.context.api.applyTransition(issue.key, transition.id);\n return this.#toIntakeIssue(await resolved.context.api.getIssue(issue.key), resolved.context.siteUrl);\n }\n\n async #resolveRequest(input: GetIntakeIssueInput): Promise<{ context: JiraConnectionContext; issueId: string }> {\n const issueReference = decodeIssueReference(input.issueId);\n const source = input.sourceId ? decodeSourceId(input.sourceId) : null;\n const connectionId =\n issueReference?.connectionId ?? source?.connectionId ?? connectionIdFromConnection(input.connection);\n const issueId = issueReference?.issueId ?? input.issueId;\n if (connectionId) return { context: await this.#connectionContextById(connectionId), issueId };\n const active = await this.#activeConnections();\n if (active.length !== 1) {\n throw new JiraApiError('Jira issue reference must identify a connection when multiple sites are connected.', 400);\n }\n return { context: await this.#connectionContext(active[0]!), issueId };\n }\n\n /**\n * Locate an issue for a read. A connection-scoped reference resolves\n * directly; a plain issue key (the agent tool's normal input) is looked up\n * across every active connection so multi-site organizations can still\n * fetch by key — the first site that knows the key wins, which is safe\n * because Jira project-key prefixes make cross-site collisions unlikely and\n * the tool is read-only.\n */\n async #findIssue(input: GetIntakeIssueInput): Promise<{ context: JiraConnectionContext; issue: JiraIssue } | null> {\n const issueReference = decodeIssueReference(input.issueId);\n const source = input.sourceId ? decodeSourceId(input.sourceId) : null;\n const connectionId =\n issueReference?.connectionId ?? source?.connectionId ?? connectionIdFromConnection(input.connection);\n const issueId = issueReference?.issueId ?? input.issueId;\n\n const candidates: JiraConnectionContext[] = [];\n if (connectionId) {\n candidates.push(await this.#connectionContextById(connectionId));\n } else {\n const active = await this.#activeConnections();\n if (active.length === 0) {\n throw new JiraApiError('Jira connection is unavailable or requires reauthentication.', 401);\n }\n for (const connection of active) candidates.push(await this.#connectionContext(connection));\n }\n\n let firstError: unknown;\n for (const context of candidates) {\n try {\n return { context, issue: await context.api.getIssue(issueId) };\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) continue;\n firstError ??= error;\n }\n }\n // Not found anywhere. If a site failed for a non-404 reason, surface that\n // failure instead of a silent \"not found\".\n if (firstError !== undefined) throw firstError;\n return null;\n }\n\n #toIntakeIssue(issue: JiraIssue, siteUrl: string): IntakeIssue {\n const { fields } = issue;\n return {\n id: issue.id,\n identifier: issue.key,\n title: fields.summary ?? issue.key,\n url: `${siteUrl}/browse/${issue.key}`,\n author: fields.reporter?.displayName ?? null,\n state: fields.status?.name ?? null,\n stateType: stateTypeFromCategory(fields.status?.statusCategory?.key),\n priority: fields.priority?.name ?? null,\n assignee: fields.assignee?.displayName ?? null,\n source: fields.project?.key ?? null,\n labels: fields.labels ?? [],\n commentCount: null,\n createdAt: fields.created ?? '',\n updatedAt: fields.updated ?? '',\n };\n }\n\n async #activeConnections(): Promise<PlatformIntegrationConnection[]> {\n return (await this.listConnections()).filter(connection => connection.status === 'active');\n }\n\n async #connectionContextById(connectionId: string): Promise<JiraConnectionContext> {\n const connection = (await this.#activeConnections()).find(candidate => candidate.id === connectionId);\n if (!connection) {\n throw new JiraApiError('Jira connection is unavailable or requires reauthentication.', 401);\n }\n return this.#connectionContext(connection);\n }\n\n async #cloudId(connectionId: string): Promise<string> {\n const cached = this.#cloudIdByConnectionId.get(connectionId);\n if (cached) return cached;\n\n const context = await this.#platformClient.request<PlatformConnectionContextResponse>(\n 'GET',\n `/v2/connections/${encodeURIComponent(connectionId)}/context`,\n );\n const cloudId = context.connection_config?.cloudId;\n if (typeof cloudId !== 'string' || !UUID_PATTERN.test(cloudId)) {\n throw new JiraApiError('Platform Jira connection context is missing a valid cloudId.', 502);\n }\n this.#cloudIdByConnectionId.set(connectionId, cloudId);\n return cloudId;\n }\n\n async #connectionContext(connection: PlatformIntegrationConnection): Promise<JiraConnectionContext> {\n const proxyBaseUrl = `${this.#clientConfig.baseUrl.replace(/\\/+$/, '')}/v2/connections/${encodeURIComponent(\n connection.id,\n )}/proxy`;\n const cloudId = await this.#cloudId(connection.id);\n const api = new JiraApiClient({\n baseUrl: `${proxyBaseUrl}/ex/jira/${encodeURIComponent(cloudId)}`,\n accessToken: this.#clientConfig.accessToken,\n ...(this.#clientConfig.projectId ? { projectId: this.#clientConfig.projectId } : {}),\n ...(this.#clientConfig.fetchImpl ? { fetchImpl: this.#clientConfig.fetchImpl } : {}),\n });\n let siteUrl = this.#siteUrlByConnectionId.get(connection.id);\n if (!siteUrl) {\n siteUrl = connection.accountLabel\n ? normalizeSiteUrl(connection.accountLabel)\n : normalizeSiteUrl((await api.getServerInfo()).baseUrl);\n this.#siteUrlByConnectionId.set(connection.id, siteUrl);\n }\n return { connection, api, siteUrl };\n }\n\n workers(ctx: IntegrationContext): MastraWorker[] {\n if (!jiraReconciliationEnabled()) return [];\n const reconcile = attachJiraIssueReconciler(this, ctx);\n if (!reconcile) return [];\n const intervalMs = jiraReconciliationInterval();\n return [\n new IssueReconcileWorker({\n integrationId: this.id,\n reconcile,\n ...(intervalMs ? { intervalMs } : {}),\n }),\n ];\n }\n\n routes(ctx: IntegrationContext): ApiRoute[] {\n return buildPlatformJiraRoutes({\n jira: this,\n auth: ctx.auth,\n intake: ctx.storage.intake,\n workItems: ctx.runtime?.workItems,\n appDbConfigured: Boolean(ctx.factoryStorage),\n ingestFactoryIssues: attachJiraRules(this, ctx),\n });\n }\n\n async agentTools(args: { requestContext: RequestContext }): Promise<IntegrationTools> {\n return buildPlatformJiraAgentTools({ requestContext: args.requestContext, jira: this });\n }\n\n diagnostics(): Record<string, unknown> {\n return { configured: true, mode: 'platform', endpointHost: this.#endpointHost };\n }\n}\n\nfunction jiraConnection(connectionId: string): IntegrationConnection {\n return { type: 'oauth', accessToken: `${JIRA_CONNECTION_TOKEN_PREFIX}${connectionId}` };\n}\n\nfunction connectionIdFromConnection(connection: IntegrationConnection): string | null {\n if (connection.type !== 'oauth' || !connection.accessToken.startsWith(JIRA_CONNECTION_TOKEN_PREFIX)) return null;\n return connection.accessToken.slice(JIRA_CONNECTION_TOKEN_PREFIX.length) || null;\n}\n\nexport function encodeSourceId(connectionId: string, projectId: string): string {\n return `${JIRA_SOURCE_PREFIX}${Buffer.from(JSON.stringify({ connectionId, projectId })).toString('base64url')}`;\n}\n\nexport function decodeSourceId(sourceId: string): { connectionId: string; projectId: string } | null {\n if (!sourceId.startsWith(JIRA_SOURCE_PREFIX)) return null;\n try {\n const parsed = JSON.parse(\n Buffer.from(sourceId.slice(JIRA_SOURCE_PREFIX.length), 'base64url').toString('utf8'),\n ) as Record<string, unknown>;\n return typeof parsed.connectionId === 'string' && typeof parsed.projectId === 'string'\n ? { connectionId: parsed.connectionId, projectId: parsed.projectId }\n : null;\n } catch {\n return null;\n }\n}\n\nexport function encodeIssueReference(reference: JiraIssueReference): string {\n return `${JIRA_ISSUE_REF_PREFIX}${Buffer.from(JSON.stringify(reference)).toString('base64url')}`;\n}\n\nexport function decodeIssueReference(value: string): JiraIssueReference | null {\n if (!value.startsWith(JIRA_ISSUE_REF_PREFIX)) return null;\n try {\n const parsed = JSON.parse(\n Buffer.from(value.slice(JIRA_ISSUE_REF_PREFIX.length), 'base64url').toString('utf8'),\n ) as Record<string, unknown>;\n if (typeof parsed.connectionId !== 'string' || typeof parsed.issueId !== 'string') return null;\n return {\n connectionId: parsed.connectionId,\n issueId: parsed.issueId,\n ...(typeof parsed.projectId === 'string' ? { projectId: parsed.projectId } : {}),\n };\n } catch {\n return null;\n }\n}\n\n/** A Platform source scope: `projectId` is the encoded source id, decoded per connection here. */\nfunction groupSources(scopes: JiraIntakeScope[]): Array<{ connectionId: string; scopes: JiraIntakeScope[] }> {\n const groups = new Map<string, Map<string, JiraIntakeScope>>();\n for (const scope of scopes) {\n const source = decodeSourceId(scope.projectId);\n if (!source) continue;\n const projects = groups.get(source.connectionId) ?? new Map<string, JiraIntakeScope>();\n if (!projects.has(source.projectId)) projects.set(source.projectId, { ...scope, projectId: source.projectId });\n groups.set(source.connectionId, projects);\n }\n return [...groups.entries()]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([connectionId, projects]) => ({\n connectionId,\n scopes: [...projects.values()].sort((left, right) => left.projectId.localeCompare(right.projectId)),\n }));\n}\n\nfunction encodePageCursor(cursor: JiraPageCursor): string {\n return Buffer.from(JSON.stringify(cursor)).toString('base64url');\n}\n\nfunction decodePageCursor(cursor: string | undefined): JiraPageCursor {\n if (!cursor) return { group: 0 };\n try {\n const parsed = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8')) as Record<string, unknown>;\n if (!Number.isInteger(parsed.group) || (parsed.group as number) < 0) throw new Error();\n return {\n group: parsed.group as number,\n ...(typeof parsed.jira === 'string' ? { jira: parsed.jira } : {}),\n };\n } catch {\n throw new JiraApiError('Jira pagination cursor is invalid.', 400);\n }\n}\n\nfunction normalizeSiteUrl(value: string): string {\n const candidate = /^https?:\\/\\//i.test(value) ? value : `https://${value}`;\n // `accountLabel` is free-form Platform data — an unparsable value must\n // surface as the classified 502 the routes already handle, not a raw\n // TypeError escaping the connection context.\n let url: URL;\n try {\n url = new URL(candidate);\n } catch {\n throw new JiraApiError('Jira site URL is invalid.', 502);\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') throw new JiraApiError('Jira site URL is invalid.', 502);\n return url.origin;\n}\n\nfunction currentStatusMatches(issue: JiraIssue, target: UpdateIntakeIssueInput['state']): boolean {\n const status = issue.fields.status;\n if (!status) return false;\n if (target.kind === 'byName') return status.name.toLowerCase() === target.name.toLowerCase();\n if (target.stateType === 'canceled') return status.statusCategory?.key === 'done' && /cancel/i.test(status.name);\n return status.statusCategory?.key === STATE_TYPE_TO_CATEGORY[target.stateType];\n}\n\nfunction resolveTransition(\n transitions: JiraTransition[],\n target: UpdateIntakeIssueInput['state'],\n): JiraTransition | null {\n if (target.kind === 'byName') {\n const wanted = target.name.toLowerCase();\n return transitions.find(transition => transition.to?.name.toLowerCase() === wanted) ?? null;\n }\n if (target.stateType === 'canceled') {\n return (\n transitions.find(\n transition => transition.to?.statusCategory?.key === 'done' && /cancel/i.test(transition.to.name),\n ) ?? null\n );\n }\n const category = STATE_TYPE_TO_CATEGORY[target.stateType];\n return transitions.find(transition => transition.to?.statusCategory?.key === category) ?? null;\n}\n"],"mappings":";;;;;;;;;;;;AAoEA,MAAM,2BAA2B;;AAGjC,MAAM,2BAA2B;AACjC,MAAM,oBAAoB;AAC1B,MAAM,oCAAoC;AAC1C,MAAM,eAAe;AACrB,MAAM,+BAA+B;AACrC,MAAM,wBAAwB;AAC9B,MAAM,qBAAqB;AAE3B,MAAM,yBAAgF;CACpF,WAAW;CACX,SAAS;CACT,WAAW;AACb;AAEA,SAAS,sBAAsB,KAAwC;CACrE,QAAQ,KAAR;EACE,KAAK,OACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAQA,IAAa,0BAAb,MAAmE;CACjE,KAAc;CACd;CACA;CACA;CACA,yCAAkC,IAAI,IAAoB;CAC1D,yCAAkC,IAAI,IAAoB;CAC1D;CACA;CACA,qCAA8B,IAAI,IAA2B;CAE7D;CAEA,IAAI,QAAwB;EAC1B,OAAO,KAAK;CACd;CAEA,YAAY,SAAwC,CAAC,GAAG;EACtD,KAAK,SAAS,iBAAiB,OAAO,KAAK;EAC3C,KAAK,gBAAgB,OAAO,gBAAgB,+BAA+B;EAC3E,KAAK,kBAAkB,IAAI,kBAAkB,KAAK,aAAa;EAC/D,KAAK,gBAAgB,IAAI,IAAI,KAAK,cAAc,OAAO,CAAC,CAAC;CAC3D;CAEA,WAAW,EAAE,UAAU,QAAqE;EAC1F,KAAK,YAAY;EACjB,KAAK,QAAQ;EACb,gBAAgB,yCAAyC,EAAE,cAAc,KAAK,cAAc,CAAC;CAC/F;CAEA,IAAI,WAAmC;EACrC,IAAI,CAAC,KAAK,WACR,MAAM,IAAI,MAAM,0FAA0F;EAC5G,OAAO,KAAK;CACd;CAEA,IAAI,cAAuB;EACzB,OAAO,KAAK,OAAO,QAAQ,KAAK;CAClC;CAEA,MAAM,aAAa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AACF;AAEA,SAAS,iBAAiB,OAAuB;CAC/C,MAAM,YAAY,gBAAgB,KAAK,KAAK,IAAI,QAAQ,WAAW;CAInE,IAAI;CACJ,IAAI;EACF,MAAM,IAAI,IAAI,SAAS;CACzB,QAAQ;EACN,MAAM,IAAI,aAAa,6BAA6B,GAAG;CACzD;CACA,IAAI,IAAI,aAAa,WAAW,IAAI,aAAa,UAAU,MAAM,IAAI,aAAa,6BAA6B,GAAG;CAClH,OAAO,IAAI;AACb;AAEA,SAAS,qBAAqB,OAAkB,QAAkD;CAChG,MAAM,SAAS,MAAM,OAAO;CAC5B,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,KAAK,YAAY,MAAM,OAAO,KAAK,YAAY;CAC3F,IAAI,OAAO,cAAc,YAAY,OAAO,OAAO,gBAAgB,QAAQ,UAAU,UAAU,KAAK,OAAO,IAAI;CAC/G,OAAO,OAAO,gBAAgB,QAAQ,uBAAuB,OAAO;AACtE;AAEA,SAAS,kBACP,aACA,QACuB;CACvB,IAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,SAAS,OAAO,KAAK,YAAY;EACvC,OAAO,YAAY,MAAK,eAAc,WAAW,IAAI,KAAK,YAAY,MAAM,MAAM,KAAK;CACzF;CACA,IAAI,OAAO,cAAc,YACvB,OACE,YAAY,MACV,eAAc,WAAW,IAAI,gBAAgB,QAAQ,UAAU,UAAU,KAAK,WAAW,GAAG,IAAI,CAClG,KAAK;CAGT,MAAM,WAAW,uBAAuB,OAAO;CAC/C,OAAO,YAAY,MAAK,eAAc,WAAW,IAAI,gBAAgB,QAAQ,QAAQ,KAAK;AAC5F"}
|
|
1
|
+
{"version":3,"file":"integration.js","names":[],"sources":["../../../../src/integrations/platform/jira/integration.ts"],"sourcesContent":["import type { RequestContext } from '@mastra/core/request-context';\nimport type { ApiRoute } from '@mastra/core/server';\nimport type { MastraWorker } from '@mastra/core/worker';\n\nimport type { IntegrationConnection } from '../../../capabilities/connection.js';\nimport type {\n CreateIntakeCommentInput,\n CreatedIntakeComment,\n GetIntakeIssueInput,\n Intake,\n IntakeIssue,\n IntakeIssueDetail,\n IntakeItemPage,\n IntakeSource,\n ListIntakeIssuesInput,\n ListIntakeItemsInput,\n ResolveIntakeDispatchInput,\n ResolvedIntakeDispatch,\n UpdateIntakeIssueInput,\n} from '../../../capabilities/intake.js';\nimport type { RouteAuth } from '../../../routes/route.js';\nimport type { FactoryProjectsStorage } from '../../../storage/domains/projects/base.js';\nimport type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../../base.js';\nimport { IssueReconcileWorker } from '../../issue-reconcile-worker.js';\nimport { adfToText } from '../../jira/adf.js';\nimport type { JiraComment, JiraIssue, JiraTransition } from '../../jira/api.js';\nimport { JiraApiClient, JiraApiError } from '../../jira/api.js';\nimport type { JiraEventRules, JiraRuleOverrides } from '../../jira/default-rules.js';\nimport { resolveJiraRules } from '../../jira/default-rules.js';\nimport { buildIntakeJql, unfilteredJiraScopes } from '../../jira/intake-jql.js';\nimport type { JiraIntakeScope } from '../../jira/intake-jql.js';\nimport { attachJiraIssueReconciler } from '../../jira/issue-reconciler.js';\nimport { jiraReconciliationEnabled, jiraReconciliationInterval } from '../../jira/reconciliation-config.js';\nimport { attachJiraRules } from '../../jira/rules.js';\nimport { logPlatformInfo, PlatformApiClient, platformApiClientConfigFromEnv } from '../api-client.js';\nimport type { PlatformApiClientConfig } from '../api-client.js';\nimport { buildPlatformJiraAgentTools } from './agent-tools.js';\nimport { buildPlatformJiraRoutes } from './routes.js';\n\ninterface PlatformIntegrationConnection {\n id: string;\n integrationId: string;\n status: 'active' | 'needs_reauth';\n accountLabel: string | null;\n}\n\ninterface JiraConnectionContext {\n connection: PlatformIntegrationConnection;\n api: JiraApiClient;\n siteUrl: string;\n}\n\ninterface PlatformConnectionContextResponse {\n connection_config: Record<string, unknown> | null;\n metadata: Record<string, unknown> | null;\n}\n\ninterface JiraIssueReference {\n connectionId: string;\n issueId: string;\n projectId?: string;\n}\n\ninterface JiraPageCursor {\n group: number;\n jira?: string;\n}\n\nconst ISSUE_COMMENTS_MAX_PAGES = 20;\n\n/** Hard stop for project pagination so a misbehaving `isLast` can't loop forever. */\nconst PROJECT_SEARCH_MAX_PAGES = 50;\nconst ISSUE_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_]*-\\d+$/;\nconst PLATFORM_JIRA_PROVIDER_CONFIG_KEY = 'jira';\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nconst JIRA_CONNECTION_TOKEN_PREFIX = 'jira-connection:';\nconst JIRA_ISSUE_REF_PREFIX = 'jira-issue:';\nconst JIRA_SOURCE_PREFIX = 'jira-project:';\n\nconst STATE_TYPE_TO_CATEGORY: Record<'unstarted' | 'started' | 'completed', string> = {\n unstarted: 'new',\n started: 'indeterminate',\n completed: 'done',\n};\n\nfunction stateTypeFromCategory(key: string | undefined): string | null {\n switch (key) {\n case 'new':\n return 'unstarted';\n case 'indeterminate':\n return 'started';\n case 'done':\n return 'completed';\n default:\n return null;\n }\n}\n\nexport interface PlatformJiraIntegrationConfig {\n clientConfig?: PlatformApiClientConfig;\n /** Per-event replacements; omitted events retain defaults, null disables. */\n rules?: JiraRuleOverrides;\n}\n\nexport class PlatformJiraIntegration implements FactoryIntegration {\n readonly id = 'jira';\n readonly #clientConfig: PlatformApiClientConfig;\n readonly #platformClient: PlatformApiClient;\n readonly #endpointHost: string;\n readonly #cloudIdByConnectionId = new Map<string, string>();\n readonly #siteUrlByConnectionId = new Map<string, string>();\n #projects: FactoryProjectsStorage | undefined;\n #auth: RouteAuth | undefined;\n readonly #orgIdByResourceId = new Map<string, string | null>();\n\n readonly #rules: JiraEventRules;\n\n get rules(): JiraEventRules {\n return this.#rules;\n }\n\n constructor(config: PlatformJiraIntegrationConfig = {}) {\n this.#rules = resolveJiraRules(config.rules);\n this.#clientConfig = config.clientConfig ?? platformApiClientConfigFromEnv();\n this.#platformClient = new PlatformApiClient(this.#clientConfig);\n this.#endpointHost = new URL(this.#clientConfig.baseUrl).host;\n }\n\n initialize({ projects, auth }: { projects: FactoryProjectsStorage; auth: RouteAuth }): void {\n this.#projects = projects;\n this.#auth = auth;\n logPlatformInfo('Platform Jira integration initialized', { endpointHost: this.#endpointHost });\n }\n\n get projects(): FactoryProjectsStorage {\n if (!this.#projects)\n throw new Error('PlatformJiraIntegration is not initialized — the factory binds storage during prepare().');\n return this.#projects;\n }\n\n get authEnabled(): boolean {\n return this.#auth?.enabled() ?? false;\n }\n\n async resolveOrgId(resourceId: string): Promise<string | null> {\n const cached = this.#orgIdByResourceId.get(resourceId);\n if (cached !== undefined) return cached;\n if (!UUID_PATTERN.test(resourceId)) {\n this.#orgIdByResourceId.set(resourceId, null);\n return null;\n }\n try {\n await this.projects.ensureReady();\n const project = await this.projects.getById({ id: resourceId });\n const orgId = project?.orgId ?? null;\n this.#orgIdByResourceId.set(resourceId, orgId);\n return orgId;\n } catch {\n return null;\n }\n }\n\n clearCaches(): void {\n this.#orgIdByResourceId.clear();\n this.#cloudIdByConnectionId.clear();\n this.#siteUrlByConnectionId.clear();\n }\n\n async listConnections(): Promise<PlatformIntegrationConnection[]> {\n const providerKey = encodeURIComponent(PLATFORM_JIRA_PROVIDER_CONFIG_KEY);\n const result = await this.#platformClient.request<{ connections: PlatformIntegrationConnection[] }>(\n 'GET',\n `/v2/connections?providerKey=${providerKey}`,\n );\n return result.connections;\n }\n\n async hasActiveConnections(): Promise<boolean> {\n return (await this.#activeConnections()).length > 0;\n }\n\n readonly intake: Intake = {\n bindingLabelFilters: true,\n resolveIntakeDispatch: input => this.#resolveIntakeDispatch(input),\n listSources: () => this.#listSources(),\n listItems: input => this.#listItems(input),\n listIssues: input => this.#listIssues(input),\n getIssue: input => this.#getIssue(input),\n createComment: input => this.#createComment(input),\n updateIssue: input => this.#updateIssue(input),\n };\n\n async #resolveIntakeDispatch({ externalSource }: ResolveIntakeDispatchInput): Promise<ResolvedIntakeDispatch | null> {\n if (externalSource.type !== 'issue') return null;\n const reference = decodeIssueReference(externalSource.externalId);\n if (!reference) return null;\n return {\n connection: jiraConnection(reference.connectionId),\n ...(reference.projectId ? { sourceId: encodeSourceId(reference.connectionId, reference.projectId) } : {}),\n issueId: reference.issueId,\n };\n }\n\n async #listSources(): Promise<IntakeSource[]> {\n const sources: IntakeSource[] = [];\n for (const connection of await this.#activeConnections()) {\n const context = await this.#connectionContext(connection);\n let startAt = 0;\n for (let pageCount = 0; pageCount < PROJECT_SEARCH_MAX_PAGES; pageCount++) {\n const page = await context.api.listProjects({ startAt });\n for (const project of page.values) {\n sources.push({\n id: encodeSourceId(connection.id, project.id),\n name: project.name,\n type: 'project',\n metadata: {\n key: project.key,\n connectionId: connection.id,\n site: new URL(context.siteUrl).host,\n },\n });\n }\n if (page.isLast || page.values.length === 0) break;\n startAt += page.values.length;\n }\n }\n return sources;\n }\n\n async #listItems({ sourceIds, cursor }: ListIntakeItemsInput): Promise<IntakeItemPage> {\n if (sourceIds.length === 0) return { items: [], nextCursor: null };\n const page = await this.listActiveIssues(cursor, unfilteredJiraScopes(sourceIds));\n return {\n items: page.issues.map(issue => ({\n source: { type: 'issue', externalId: issue.externalId, url: issue.url },\n sourceId: issue.sourceId,\n title: `${issue.identifier}: ${issue.title}`,\n status: issue.state ?? undefined,\n labels: issue.labels,\n assignee: issue.assignee,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n metadata: {\n identifier: issue.identifier,\n issueRef: issue.externalId,\n state: issue.state,\n stateType: issue.stateType,\n priority: issue.priority,\n project: issue.source,\n site: issue.site,\n assignee: issue.assignee,\n assignees: issue.assignees ?? [],\n creator: issue.author,\n author: issue.author,\n labels: issue.labels,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n },\n })),\n nextCursor: page.nextCursor,\n };\n }\n\n async #listIssues(input: ListIntakeIssuesInput): Promise<{ issues: IntakeIssue[]; nextCursor: string | null }> {\n const page = await this.listActiveIssues(input.cursor, unfilteredJiraScopes(input.sourceIds ?? []), input.labels);\n return { issues: page.issues, nextCursor: page.nextCursor };\n }\n\n /**\n * One page of active issues across connections. Each scope's `projectId` is\n * an encoded Platform source id; sources are grouped per connection and each\n * group runs one JQL built from only that connection's projects.\n */\n async listActiveIssues(\n cursor?: string,\n scopes: JiraIntakeScope[] = [],\n labels?: string[],\n ): Promise<{\n issues: Array<IntakeIssue & { sourceId: string; externalId: string; site: string }>;\n nextCursor: string | null;\n }> {\n const grouped = groupSources(scopes);\n if (grouped.length === 0) return { issues: [], nextCursor: null };\n const decodedCursor = decodePageCursor(cursor);\n if (decodedCursor.group >= grouped.length) return { issues: [], nextCursor: null };\n\n for (let groupIndex = decodedCursor.group; groupIndex < grouped.length; groupIndex++) {\n const group = grouped[groupIndex]!;\n const context = await this.#connectionContextById(group.connectionId);\n const jql = buildIntakeJql(group.scopes, labels);\n if (jql === null) continue;\n const page = await context.api.searchIssues({\n jql,\n ...(groupIndex === decodedCursor.group && decodedCursor.jira ? { nextPageToken: decodedCursor.jira } : {}),\n });\n const nextCursor = page.nextPageToken\n ? encodePageCursor({ group: groupIndex, jira: page.nextPageToken })\n : groupIndex + 1 < grouped.length\n ? encodePageCursor({ group: groupIndex + 1 })\n : null;\n return {\n issues: page.issues.map(issue => {\n const projectId = issue.fields.project?.id ?? group.scopes[0]?.projectId ?? '';\n return {\n ...this.#toIntakeIssue(issue, context.siteUrl),\n sourceId: encodeSourceId(group.connectionId, projectId),\n externalId: encodeIssueReference({ connectionId: group.connectionId, issueId: issue.key, projectId }),\n site: new URL(context.siteUrl).host,\n };\n }),\n nextCursor,\n };\n }\n return { issues: [], nextCursor: null };\n }\n\n async #getIssue(input: GetIntakeIssueInput): Promise<IntakeIssueDetail | null> {\n const { context, issue } = (await this.#findIssue(input)) ?? {};\n if (!context || !issue) return null;\n const { comments, total } = await this.#listAllComments(context.api, issue.key);\n return {\n ...this.#toIntakeIssue(issue, context.siteUrl),\n commentCount: total,\n description: issue.fields.description ? adfToText(issue.fields.description) || null : null,\n comments: comments.map(comment => ({\n author: comment.author?.displayName ?? null,\n body: adfToText(comment.body),\n createdAt: comment.created,\n })),\n };\n }\n\n async #listAllComments(api: JiraApiClient, keyOrId: string): Promise<{ comments: JiraComment[]; total: number }> {\n const comments: JiraComment[] = [];\n let total = 0;\n for (let page = 0; page < ISSUE_COMMENTS_MAX_PAGES; page++) {\n const result = await api.listComments(keyOrId, { startAt: comments.length });\n comments.push(...result.comments);\n total = result.total;\n if (result.comments.length === 0 || comments.length >= total) break;\n }\n return { comments, total };\n }\n\n async #createComment(input: CreateIntakeCommentInput): Promise<CreatedIntakeComment | null> {\n const resolved = await this.#resolveRequest(input);\n let key = resolved.issueId;\n if (!ISSUE_KEY_PATTERN.test(key)) {\n try {\n key = (await resolved.context.api.getIssue(key)).key;\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) return null;\n throw error;\n }\n }\n let comment;\n try {\n comment = await resolved.context.api.createComment(key, input.body);\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) return null;\n throw error;\n }\n return {\n id: comment.id,\n url: `${resolved.context.siteUrl}/browse/${key}?focusedCommentId=${comment.id}`,\n };\n }\n\n async #updateIssue(input: UpdateIntakeIssueInput): Promise<IntakeIssue | null> {\n const resolved = await this.#resolveRequest(input);\n let issue: JiraIssue;\n try {\n issue = await resolved.context.api.getIssue(resolved.issueId);\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) return null;\n throw error;\n }\n if (currentStatusMatches(issue, input.state)) return this.#toIntakeIssue(issue, resolved.context.siteUrl);\n const transitions = await resolved.context.api.listTransitions(issue.key);\n const transition = resolveTransition(transitions, input.state);\n if (!transition) return null;\n await resolved.context.api.applyTransition(issue.key, transition.id);\n return this.#toIntakeIssue(await resolved.context.api.getIssue(issue.key), resolved.context.siteUrl);\n }\n\n async #resolveRequest(input: GetIntakeIssueInput): Promise<{ context: JiraConnectionContext; issueId: string }> {\n const issueReference = decodeIssueReference(input.issueId);\n const source = input.sourceId ? decodeSourceId(input.sourceId) : null;\n const connectionId =\n issueReference?.connectionId ?? source?.connectionId ?? connectionIdFromConnection(input.connection);\n const issueId = issueReference?.issueId ?? input.issueId;\n if (connectionId) return { context: await this.#connectionContextById(connectionId), issueId };\n const active = await this.#activeConnections();\n if (active.length !== 1) {\n throw new JiraApiError('Jira issue reference must identify a connection when multiple sites are connected.', 400);\n }\n return { context: await this.#connectionContext(active[0]!), issueId };\n }\n\n /**\n * Locate an issue for a read. A connection-scoped reference resolves\n * directly; a plain issue key (the agent tool's normal input) is looked up\n * across every active connection so multi-site organizations can still\n * fetch by key — the first site that knows the key wins, which is safe\n * because Jira project-key prefixes make cross-site collisions unlikely and\n * the tool is read-only.\n */\n async #findIssue(input: GetIntakeIssueInput): Promise<{ context: JiraConnectionContext; issue: JiraIssue } | null> {\n const issueReference = decodeIssueReference(input.issueId);\n const source = input.sourceId ? decodeSourceId(input.sourceId) : null;\n // A reference that names a different connection or project than the source scope\n // cannot widen that scope.\n if (\n issueReference &&\n source &&\n (issueReference.connectionId !== source.connectionId ||\n (issueReference.projectId !== undefined && issueReference.projectId !== source.projectId))\n ) {\n return null;\n }\n const connectionId =\n issueReference?.connectionId ?? source?.connectionId ?? connectionIdFromConnection(input.connection);\n const issueId = issueReference?.issueId ?? input.issueId;\n const projectId = issueReference?.projectId ?? source?.projectId;\n\n const candidates: JiraConnectionContext[] = [];\n if (connectionId) {\n candidates.push(await this.#connectionContextById(connectionId));\n } else {\n const active = await this.#activeConnections();\n if (active.length === 0) {\n throw new JiraApiError('Jira connection is unavailable or requires reauthentication.', 401);\n }\n for (const connection of active) candidates.push(await this.#connectionContext(connection));\n }\n\n let firstError: unknown;\n for (const context of candidates) {\n try {\n const issue = await context.api.getIssue(issueId);\n // A reference scoped to a project only resolves issues that live in that project.\n if (projectId && issue.fields.project?.id !== projectId) return null;\n return { context, issue };\n } catch (error) {\n if (error instanceof JiraApiError && error.status === 404) continue;\n firstError ??= error;\n }\n }\n // Not found anywhere. If a site failed for a non-404 reason, surface that\n // failure instead of a silent \"not found\".\n if (firstError !== undefined) throw firstError;\n return null;\n }\n\n #toIntakeIssue(issue: JiraIssue, siteUrl: string): IntakeIssue {\n const { fields } = issue;\n return {\n id: issue.id,\n identifier: issue.key,\n title: fields.summary ?? issue.key,\n url: `${siteUrl}/browse/${issue.key}`,\n author: fields.reporter?.displayName ?? null,\n state: fields.status?.name ?? null,\n stateType: stateTypeFromCategory(fields.status?.statusCategory?.key),\n priority: fields.priority?.name ?? null,\n assignee: fields.assignee?.displayName ?? null,\n source: fields.project?.key ?? null,\n labels: fields.labels ?? [],\n commentCount: null,\n createdAt: fields.created ?? '',\n updatedAt: fields.updated ?? '',\n };\n }\n\n async #activeConnections(): Promise<PlatformIntegrationConnection[]> {\n return (await this.listConnections()).filter(connection => connection.status === 'active');\n }\n\n async #connectionContextById(connectionId: string): Promise<JiraConnectionContext> {\n const connection = (await this.#activeConnections()).find(candidate => candidate.id === connectionId);\n if (!connection) {\n throw new JiraApiError('Jira connection is unavailable or requires reauthentication.', 401);\n }\n return this.#connectionContext(connection);\n }\n\n async #cloudId(connectionId: string): Promise<string> {\n const cached = this.#cloudIdByConnectionId.get(connectionId);\n if (cached) return cached;\n\n const context = await this.#platformClient.request<PlatformConnectionContextResponse>(\n 'GET',\n `/v2/connections/${encodeURIComponent(connectionId)}/context`,\n );\n const cloudId = context.connection_config?.cloudId;\n if (typeof cloudId !== 'string' || !UUID_PATTERN.test(cloudId)) {\n throw new JiraApiError('Platform Jira connection context is missing a valid cloudId.', 502);\n }\n this.#cloudIdByConnectionId.set(connectionId, cloudId);\n return cloudId;\n }\n\n async #connectionContext(connection: PlatformIntegrationConnection): Promise<JiraConnectionContext> {\n const proxyBaseUrl = `${this.#clientConfig.baseUrl.replace(/\\/+$/, '')}/v2/connections/${encodeURIComponent(\n connection.id,\n )}/proxy`;\n const cloudId = await this.#cloudId(connection.id);\n const api = new JiraApiClient({\n baseUrl: `${proxyBaseUrl}/ex/jira/${encodeURIComponent(cloudId)}`,\n accessToken: this.#clientConfig.accessToken,\n ...(this.#clientConfig.projectId ? { projectId: this.#clientConfig.projectId } : {}),\n ...(this.#clientConfig.fetchImpl ? { fetchImpl: this.#clientConfig.fetchImpl } : {}),\n });\n let siteUrl = this.#siteUrlByConnectionId.get(connection.id);\n if (!siteUrl) {\n siteUrl = connection.accountLabel\n ? normalizeSiteUrl(connection.accountLabel)\n : normalizeSiteUrl((await api.getServerInfo()).baseUrl);\n this.#siteUrlByConnectionId.set(connection.id, siteUrl);\n }\n return { connection, api, siteUrl };\n }\n\n workers(ctx: IntegrationContext): MastraWorker[] {\n if (!jiraReconciliationEnabled()) return [];\n const reconcile = attachJiraIssueReconciler(this, ctx);\n if (!reconcile) return [];\n const intervalMs = jiraReconciliationInterval();\n return [\n new IssueReconcileWorker({\n integrationId: this.id,\n reconcile,\n ...(intervalMs ? { intervalMs } : {}),\n }),\n ];\n }\n\n routes(ctx: IntegrationContext): ApiRoute[] {\n return buildPlatformJiraRoutes({\n jira: this,\n auth: ctx.auth,\n intake: ctx.storage.intake,\n workItems: ctx.runtime?.workItems,\n appDbConfigured: Boolean(ctx.factoryStorage),\n ingestFactoryIssues: attachJiraRules(this, ctx),\n });\n }\n\n async agentTools(args: { requestContext: RequestContext }): Promise<IntegrationTools> {\n return buildPlatformJiraAgentTools({ requestContext: args.requestContext, jira: this });\n }\n\n diagnostics(): Record<string, unknown> {\n return { configured: true, mode: 'platform', endpointHost: this.#endpointHost };\n }\n}\n\nfunction jiraConnection(connectionId: string): IntegrationConnection {\n return { type: 'oauth', accessToken: `${JIRA_CONNECTION_TOKEN_PREFIX}${connectionId}` };\n}\n\nfunction connectionIdFromConnection(connection: IntegrationConnection): string | null {\n if (connection.type !== 'oauth' || !connection.accessToken.startsWith(JIRA_CONNECTION_TOKEN_PREFIX)) return null;\n return connection.accessToken.slice(JIRA_CONNECTION_TOKEN_PREFIX.length) || null;\n}\n\nexport function encodeSourceId(connectionId: string, projectId: string): string {\n return `${JIRA_SOURCE_PREFIX}${Buffer.from(JSON.stringify({ connectionId, projectId })).toString('base64url')}`;\n}\n\nexport function decodeSourceId(sourceId: string): { connectionId: string; projectId: string } | null {\n if (!sourceId.startsWith(JIRA_SOURCE_PREFIX)) return null;\n try {\n const parsed = JSON.parse(\n Buffer.from(sourceId.slice(JIRA_SOURCE_PREFIX.length), 'base64url').toString('utf8'),\n ) as Record<string, unknown>;\n return typeof parsed.connectionId === 'string' && typeof parsed.projectId === 'string'\n ? { connectionId: parsed.connectionId, projectId: parsed.projectId }\n : null;\n } catch {\n return null;\n }\n}\n\nexport function encodeIssueReference(reference: JiraIssueReference): string {\n return `${JIRA_ISSUE_REF_PREFIX}${Buffer.from(JSON.stringify(reference)).toString('base64url')}`;\n}\n\nexport function decodeIssueReference(value: string): JiraIssueReference | null {\n if (!value.startsWith(JIRA_ISSUE_REF_PREFIX)) return null;\n try {\n const parsed = JSON.parse(\n Buffer.from(value.slice(JIRA_ISSUE_REF_PREFIX.length), 'base64url').toString('utf8'),\n ) as Record<string, unknown>;\n if (typeof parsed.connectionId !== 'string' || typeof parsed.issueId !== 'string') return null;\n return {\n connectionId: parsed.connectionId,\n issueId: parsed.issueId,\n ...(typeof parsed.projectId === 'string' ? { projectId: parsed.projectId } : {}),\n };\n } catch {\n return null;\n }\n}\n\n/** A Platform source scope: `projectId` is the encoded source id, decoded per connection here. */\nfunction groupSources(scopes: JiraIntakeScope[]): Array<{ connectionId: string; scopes: JiraIntakeScope[] }> {\n const groups = new Map<string, Map<string, JiraIntakeScope>>();\n for (const scope of scopes) {\n const source = decodeSourceId(scope.projectId);\n if (!source) continue;\n const projects = groups.get(source.connectionId) ?? new Map<string, JiraIntakeScope>();\n if (!projects.has(source.projectId)) projects.set(source.projectId, { ...scope, projectId: source.projectId });\n groups.set(source.connectionId, projects);\n }\n return [...groups.entries()]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([connectionId, projects]) => ({\n connectionId,\n scopes: [...projects.values()].sort((left, right) => left.projectId.localeCompare(right.projectId)),\n }));\n}\n\nfunction encodePageCursor(cursor: JiraPageCursor): string {\n return Buffer.from(JSON.stringify(cursor)).toString('base64url');\n}\n\nfunction decodePageCursor(cursor: string | undefined): JiraPageCursor {\n if (!cursor) return { group: 0 };\n try {\n const parsed = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8')) as Record<string, unknown>;\n if (!Number.isInteger(parsed.group) || (parsed.group as number) < 0) throw new Error();\n return {\n group: parsed.group as number,\n ...(typeof parsed.jira === 'string' ? { jira: parsed.jira } : {}),\n };\n } catch {\n throw new JiraApiError('Jira pagination cursor is invalid.', 400);\n }\n}\n\nfunction normalizeSiteUrl(value: string): string {\n const candidate = /^https?:\\/\\//i.test(value) ? value : `https://${value}`;\n // `accountLabel` is free-form Platform data — an unparsable value must\n // surface as the classified 502 the routes already handle, not a raw\n // TypeError escaping the connection context.\n let url: URL;\n try {\n url = new URL(candidate);\n } catch {\n throw new JiraApiError('Jira site URL is invalid.', 502);\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') throw new JiraApiError('Jira site URL is invalid.', 502);\n return url.origin;\n}\n\nfunction currentStatusMatches(issue: JiraIssue, target: UpdateIntakeIssueInput['state']): boolean {\n const status = issue.fields.status;\n if (!status) return false;\n if (target.kind === 'byName') return status.name.toLowerCase() === target.name.toLowerCase();\n if (target.stateType === 'canceled') return status.statusCategory?.key === 'done' && /cancel/i.test(status.name);\n return status.statusCategory?.key === STATE_TYPE_TO_CATEGORY[target.stateType];\n}\n\nfunction resolveTransition(\n transitions: JiraTransition[],\n target: UpdateIntakeIssueInput['state'],\n): JiraTransition | null {\n if (target.kind === 'byName') {\n const wanted = target.name.toLowerCase();\n return transitions.find(transition => transition.to?.name.toLowerCase() === wanted) ?? null;\n }\n if (target.stateType === 'canceled') {\n return (\n transitions.find(\n transition => transition.to?.statusCategory?.key === 'done' && /cancel/i.test(transition.to.name),\n ) ?? null\n );\n }\n const category = STATE_TYPE_TO_CATEGORY[target.stateType];\n return transitions.find(transition => transition.to?.statusCategory?.key === category) ?? null;\n}\n"],"mappings":";;;;;;;;;;;;AAoEA,MAAM,2BAA2B;;AAGjC,MAAM,2BAA2B;AACjC,MAAM,oBAAoB;AAC1B,MAAM,oCAAoC;AAC1C,MAAM,eAAe;AACrB,MAAM,+BAA+B;AACrC,MAAM,wBAAwB;AAC9B,MAAM,qBAAqB;AAE3B,MAAM,yBAAgF;CACpF,WAAW;CACX,SAAS;CACT,WAAW;AACb;AAEA,SAAS,sBAAsB,KAAwC;CACrE,QAAQ,KAAR;EACE,KAAK,OACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAQA,IAAa,0BAAb,MAAmE;CACjE,KAAc;CACd;CACA;CACA;CACA,yCAAkC,IAAI,IAAoB;CAC1D,yCAAkC,IAAI,IAAoB;CAC1D;CACA;CACA,qCAA8B,IAAI,IAA2B;CAE7D;CAEA,IAAI,QAAwB;EAC1B,OAAO,KAAK;CACd;CAEA,YAAY,SAAwC,CAAC,GAAG;EACtD,KAAK,SAAS,iBAAiB,OAAO,KAAK;EAC3C,KAAK,gBAAgB,OAAO,gBAAgB,+BAA+B;EAC3E,KAAK,kBAAkB,IAAI,kBAAkB,KAAK,aAAa;EAC/D,KAAK,gBAAgB,IAAI,IAAI,KAAK,cAAc,OAAO,CAAC,CAAC;CAC3D;CAEA,WAAW,EAAE,UAAU,QAAqE;EAC1F,KAAK,YAAY;EACjB,KAAK,QAAQ;EACb,gBAAgB,yCAAyC,EAAE,cAAc,KAAK,cAAc,CAAC;CAC/F;CAEA,IAAI,WAAmC;EACrC,IAAI,CAAC,KAAK,WACR,MAAM,IAAI,MAAM,0FAA0F;EAC5G,OAAO,KAAK;CACd;CAEA,IAAI,cAAuB;EACzB,OAAO,KAAK,OAAO,QAAQ,KAAK;CAClC;CAEA,MAAM,aAAa,YAA4C;EAC7D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F"}
|
|
@@ -19,6 +19,11 @@ export declare function boardSnapshot(items: readonly Card[], toWire: (item: Car
|
|
|
19
19
|
export declare function scopedSnapshot(items: readonly Card[], toWire: (item: Card) => unknown, runningSessionIds: readonly string[], parkedSessionIds: readonly string[], total?: number): BoardSnapshot;
|
|
20
20
|
/** What moved on a board, for the one reader whose cursor it answers: nothing of it is kept. */
|
|
21
21
|
export declare function movedBody(body: unknown): Pick<BoardSnapshot, 'json' | 'gzipped'>;
|
|
22
|
+
/**
|
|
23
|
+
* A computed answer's wire body, named by a hash of itself: a reader that kept it revalidates
|
|
24
|
+
* instead of downloading it again.
|
|
25
|
+
*/
|
|
26
|
+
export declare function hashedBody(body: unknown): Pick<BoardSnapshot, 'etag' | 'json'>;
|
|
22
27
|
/** {@link boardCheck} of a cached list, computed once for every reader that sends its cursor. */
|
|
23
28
|
export declare function listCheck(items: readonly Card[]): string;
|
|
24
29
|
/** Whether an `If-None-Match` header names this ETag (weak comparison, as for GET). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-snapshot.d.ts","sourceRoot":"","sources":["../../src/routes/board-snapshot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAYlE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5B;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,EAC/B,iBAAiB,EAAE,SAAS,MAAM,EAAE,EACpC,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,MAAM,CAAC,EAAE,MAAM,GACd,aAAa,CAGf;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,IAAI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AE,SAAS,MAAM,EAAE,EACnC,KAAK,CAAC,EAAE,MAAM,GACb,aAAa,CAEf;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,CAGhF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,CAG9E;AAID,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAIxD;AAgCD,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAIlF"}
|
|
@@ -30,6 +30,17 @@ function movedBody(body) {
|
|
|
30
30
|
gzipped: () => gzip$1(json)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A computed answer's wire body, named by a hash of itself: a reader that kept it revalidates
|
|
35
|
+
* instead of downloading it again.
|
|
36
|
+
*/
|
|
37
|
+
function hashedBody(body) {
|
|
38
|
+
const json = JSON.stringify(body);
|
|
39
|
+
return {
|
|
40
|
+
etag: `W/"${sha1(json)}"`,
|
|
41
|
+
json
|
|
42
|
+
};
|
|
43
|
+
}
|
|
33
44
|
const checks = /* @__PURE__ */ new WeakMap();
|
|
34
45
|
/** {@link boardCheck} of a cached list, computed once for every reader that sends its cursor. */
|
|
35
46
|
function listCheck(items) {
|
|
@@ -72,6 +83,6 @@ function matchesEtag(ifNoneMatch, etag) {
|
|
|
72
83
|
const bare = (tag) => tag.trim().replace(/^W\//, "");
|
|
73
84
|
return ifNoneMatch.split(",").some((tag) => tag.trim() === "*" || bare(tag) === bare(etag));
|
|
74
85
|
}
|
|
75
|
-
export { boardSnapshot, listCheck, matchesEtag, movedBody, scopedSnapshot };
|
|
86
|
+
export { boardSnapshot, hashedBody, listCheck, matchesEtag, movedBody, scopedSnapshot };
|
|
76
87
|
|
|
77
88
|
//# sourceMappingURL=board-snapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-snapshot.js","names":["gzip","gzipCallback"],"sources":["../../src/routes/board-snapshot.ts"],"sourcesContent":["import { createHash, randomUUID } from 'node:crypto';\nimport { promisify } from 'node:util';\nimport { gzip as gzipCallback } from 'node:zlib';\n\nimport type { Card } from '../storage/domains/work-items/base.js';\nimport { boardCheck } from '../work-items/board-check.js';\n\nconst gzip = promisify(gzipCallback);\n\ninterface CardsJson {\n /** Names the cards in the ETag. */\n id: string;\n json: string;\n latest?: BoardSnapshot;\n}\n\nexport interface BoardSnapshot {\n etag: string;\n json: string;\n gzipped(): Promise<Buffer>;\n}\n\n// Keyed on the list a caller keeps per board version: `listShared` returns one frozen array until\n// a card changes, so a new version or an evicted list drops its entry with it.\nconst cardsJson = new WeakMap<readonly Card[], CardsJson>();\n\n/**\n * The listing's wire body for one board version and its run activity. Every tab\n * polling an unchanged board shares one serialization and one gzip, and its\n * ETag lets the browser revalidate instead of downloading the board again.\n */\nexport function boardSnapshot(\n items: readonly Card[],\n toWire: (item: Card) => unknown,\n runningSessionIds: readonly string[],\n parkedSessionIds: readonly string[],\n cursor?: string,\n): BoardSnapshot {\n // Random per cached list, so an ETag from before a restart never matches a different board.\n return snapshot(items, toWire, runningSessionIds, parkedSessionIds, () => randomUUID(), { cursor });\n}\n\n/**\n * The wire body for the cards a scoped listing picked. Its ETag names the cards by a hash of\n * their body, not by the board version: a write to a card outside the scope leaves it unchanged,\n * so the tab gets a 304. A caller that passes the same list again shares its serialization.\n * `total` is how many cards matched when `items` is only the first of them.\n */\nexport function scopedSnapshot(\n items: readonly Card[],\n toWire: (item: Card) => unknown,\n runningSessionIds: readonly string[],\n parkedSessionIds: readonly string[],\n total?: number,\n): BoardSnapshot {\n return snapshot(items, toWire, runningSessionIds, parkedSessionIds, sha1, { total });\n}\n\n/** What moved on a board, for the one reader whose cursor it answers: nothing of it is kept. */\nexport function movedBody(body: unknown): Pick<BoardSnapshot, 'json' | 'gzipped'> {\n const json = JSON.stringify(body);\n return { json, gzipped: () => gzip(json) };\n}\n\nconst checks = new WeakMap<readonly Card[], string>();\n\n/** {@link boardCheck} of a cached list, computed once for every reader that sends its cursor. */\nexport function listCheck(items: readonly Card[]): string {\n let check = checks.get(items);\n if (check === undefined) checks.set(items, (check = boardCheck(items)));\n return check;\n}\n\nfunction snapshot(\n items: readonly Card[],\n toWire: (item: Card) => unknown,\n runningSessionIds: readonly string[],\n parkedSessionIds: readonly string[],\n cardsId: (json: string) => string,\n more: { total?: number; cursor?: string },\n): BoardSnapshot {\n let cards = cardsJson.get(items);\n if (!cards) {\n const json = JSON.stringify(items.map(toWire));\n cards = { id: cardsId(json), json };\n cardsJson.set(items, cards);\n }\n // Everything the body holds beside the cards: a 304 must never hide a change to any of it.\n const rest = JSON.stringify({ runningSessionIds, parkedSessionIds, ...more });\n const etag = `W/\"${cards.id}.${sha1(rest)}\"`;\n if (cards.latest?.etag === etag) return cards.latest;\n\n const json = `{\"workItems\":${cards.json},${rest.slice(1)}`;\n let gzipped: Promise<Buffer> | undefined;\n // zlib runs on the libuv pool, off the event loop.\n cards.latest = { etag, json, gzipped: () => (gzipped ??= gzip(json)) };\n return cards.latest;\n}\n\nfunction sha1(text: string): string {\n return createHash('sha1').update(text).digest('base64url');\n}\n\n/** Whether an `If-None-Match` header names this ETag (weak comparison, as for GET). */\nexport function matchesEtag(ifNoneMatch: string | undefined, etag: string): boolean {\n if (!ifNoneMatch) return false;\n const bare = (tag: string) => tag.trim().replace(/^W\\//, '');\n return ifNoneMatch.split(',').some(tag => tag.trim() === '*' || bare(tag) === bare(etag));\n}\n"],"mappings":";;;;;AAOA,MAAMA,SAAO,UAAUC,IAAY;AAiBnC,MAAM,4BAAY,IAAI,QAAoC;;;;;;AAO1D,SAAgB,cACd,OACA,QACA,mBACA,kBACA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3D;;AAGA,SAAgB,YAAY,aAAiC,MAAuB;CAClF,IAAI,CAAC,aAAa,OAAO;CACzB,MAAM,QAAQ,QAAgB,IAAI,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAC3D,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,MAAK,QAAO,IAAI,KAAK,MAAM,OAAO,KAAK,GAAG,MAAM,KAAK,IAAI,CAAC;AAC1F"}
|
|
1
|
+
{"version":3,"file":"board-snapshot.js","names":["gzip","gzipCallback"],"sources":["../../src/routes/board-snapshot.ts"],"sourcesContent":["import { createHash, randomUUID } from 'node:crypto';\nimport { promisify } from 'node:util';\nimport { gzip as gzipCallback } from 'node:zlib';\n\nimport type { Card } from '../storage/domains/work-items/base.js';\nimport { boardCheck } from '../work-items/board-check.js';\n\nconst gzip = promisify(gzipCallback);\n\ninterface CardsJson {\n /** Names the cards in the ETag. */\n id: string;\n json: string;\n latest?: BoardSnapshot;\n}\n\nexport interface BoardSnapshot {\n etag: string;\n json: string;\n gzipped(): Promise<Buffer>;\n}\n\n// Keyed on the list a caller keeps per board version: `listShared` returns one frozen array until\n// a card changes, so a new version or an evicted list drops its entry with it.\nconst cardsJson = new WeakMap<readonly Card[], CardsJson>();\n\n/**\n * The listing's wire body for one board version and its run activity. Every tab\n * polling an unchanged board shares one serialization and one gzip, and its\n * ETag lets the browser revalidate instead of downloading the board again.\n */\nexport function boardSnapshot(\n items: readonly Card[],\n toWire: (item: Card) => unknown,\n runningSessionIds: readonly string[],\n parkedSessionIds: readonly string[],\n cursor?: string,\n): BoardSnapshot {\n // Random per cached list, so an ETag from before a restart never matches a different board.\n return snapshot(items, toWire, runningSessionIds, parkedSessionIds, () => randomUUID(), { cursor });\n}\n\n/**\n * The wire body for the cards a scoped listing picked. Its ETag names the cards by a hash of\n * their body, not by the board version: a write to a card outside the scope leaves it unchanged,\n * so the tab gets a 304. A caller that passes the same list again shares its serialization.\n * `total` is how many cards matched when `items` is only the first of them.\n */\nexport function scopedSnapshot(\n items: readonly Card[],\n toWire: (item: Card) => unknown,\n runningSessionIds: readonly string[],\n parkedSessionIds: readonly string[],\n total?: number,\n): BoardSnapshot {\n return snapshot(items, toWire, runningSessionIds, parkedSessionIds, sha1, { total });\n}\n\n/** What moved on a board, for the one reader whose cursor it answers: nothing of it is kept. */\nexport function movedBody(body: unknown): Pick<BoardSnapshot, 'json' | 'gzipped'> {\n const json = JSON.stringify(body);\n return { json, gzipped: () => gzip(json) };\n}\n\n/**\n * A computed answer's wire body, named by a hash of itself: a reader that kept it revalidates\n * instead of downloading it again.\n */\nexport function hashedBody(body: unknown): Pick<BoardSnapshot, 'etag' | 'json'> {\n const json = JSON.stringify(body);\n return { etag: `W/\"${sha1(json)}\"`, json };\n}\n\nconst checks = new WeakMap<readonly Card[], string>();\n\n/** {@link boardCheck} of a cached list, computed once for every reader that sends its cursor. */\nexport function listCheck(items: readonly Card[]): string {\n let check = checks.get(items);\n if (check === undefined) checks.set(items, (check = boardCheck(items)));\n return check;\n}\n\nfunction snapshot(\n items: readonly Card[],\n toWire: (item: Card) => unknown,\n runningSessionIds: readonly string[],\n parkedSessionIds: readonly string[],\n cardsId: (json: string) => string,\n more: { total?: number; cursor?: string },\n): BoardSnapshot {\n let cards = cardsJson.get(items);\n if (!cards) {\n const json = JSON.stringify(items.map(toWire));\n cards = { id: cardsId(json), json };\n cardsJson.set(items, cards);\n }\n // Everything the body holds beside the cards: a 304 must never hide a change to any of it.\n const rest = JSON.stringify({ runningSessionIds, parkedSessionIds, ...more });\n const etag = `W/\"${cards.id}.${sha1(rest)}\"`;\n if (cards.latest?.etag === etag) return cards.latest;\n\n const json = `{\"workItems\":${cards.json},${rest.slice(1)}`;\n let gzipped: Promise<Buffer> | undefined;\n // zlib runs on the libuv pool, off the event loop.\n cards.latest = { etag, json, gzipped: () => (gzipped ??= gzip(json)) };\n return cards.latest;\n}\n\nfunction sha1(text: string): string {\n return createHash('sha1').update(text).digest('base64url');\n}\n\n/** Whether an `If-None-Match` header names this ETag (weak comparison, as for GET). */\nexport function matchesEtag(ifNoneMatch: string | undefined, etag: string): boolean {\n if (!ifNoneMatch) return false;\n const bare = (tag: string) => tag.trim().replace(/^W\\//, '');\n return ifNoneMatch.split(',').some(tag => tag.trim() === '*' || bare(tag) === bare(etag));\n}\n"],"mappings":";;;;;AAOA,MAAMA,SAAO,UAAUC,IAAY;AAiBnC,MAAM,4BAAY,IAAI,QAAoC;;;;;;AAO1D,SAAgB,cACd,OACA,QACA,mBACA,kBACA,QACe;CAEf,OAAO,SAAS,OAAO,QAAQ,mBAAmB,wBAAwB,WAAW,GAAG,EAAE,OAAO,CAAC;AACpG;;;;;;;AAQA,SAAgB,eACd,OACA,QACA,mBACA,kBACA,OACe;CACf,OAAO,SAAS,OAAO,QAAQ,mBAAmB,kBAAkB,MAAM,EAAE,MAAM,CAAC;AACrF;;AAGA,SAAgB,UAAU,MAAwD;CAChF,MAAM,OAAO,KAAK,UAAU,IAAI;CAChC,OAAO;EAAE;EAAM,eAAeD,OAAK,IAAI;CAAE;AAC3C;;;;;AAMA,SAAgB,WAAW,MAAqD;CAC9E,MAAM,OAAO,KAAK,UAAU,IAAI;CAChC,OAAO;EAAE,MAAM,MAAM,KAAK,IAAI,EAAE;EAAI;CAAK;AAC3C;AAEA,MAAM,yBAAS,IAAI,QAAiC;;AAGpD,SAAgB,UAAU,OAAgC;CACxD,IAAI,QAAQ,OAAO,IAAI,KAAK;CAC5B,IAAI,UAAU,KAAA,GAAW,OAAO,IAAI,OAAQ,QAAQ,WAAW,KAAK,CAAE;CACtE,OAAO;AACT;AAEA,SAAS,SACP,OACA,QACA,mBACA,kBACA,SACA,MACe;CACf,IAAI,QAAQ,UAAU,IAAI,KAAK;CAC/B,IAAI,CAAC,OAAO;EACV,MAAM,OAAO,KAAK,UAAU,MAAM,IAAI,MAAM,CAAC;EAC7C,QAAQ;GAAE,IAAI,QAAQ,IAAI;GAAG;EAAK;EAClC,UAAU,IAAI,OAAO,KAAK;CAC5B;CAEA,MAAM,OAAO,KAAK,UAAU;EAAE;EAAmB;EAAkB,GAAG;CAAK,CAAC;CAC5E,MAAM,OAAO,MAAM,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;CAC1C,IAAI,MAAM,QAAQ,SAAS,MAAM,OAAO,MAAM;CAE9C,MAAM,OAAO,gBAAgB,MAAM,KAAK,GAAG,KAAK,MAAM,CAAC;CACvD,IAAI;CAEJ,MAAM,SAAS;EAAE;EAAM;EAAM,eAAgB,YAAYA,OAAK,IAAI;CAAG;CACrE,OAAO,MAAM;AACf;AAEA,SAAS,KAAK,MAAsB;CAClC,OAAO,WAAW,MAAM,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,WAAW;AAC3D;;AAGA,SAAgB,YAAY,aAAiC,MAAuB;CAClF,IAAI,CAAC,aAAa,OAAO;CACzB,MAAM,QAAQ,QAAgB,IAAI,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAC3D,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,MAAK,QAAO,IAAI,KAAK,MAAM,OAAO,KAAK,GAAG,MAAM,KAAK,IAAI,CAAC;AAC1F"}
|
package/dist/routes/boards.d.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* the built-in Work board and app boards in each project once, and they are edited under their own
|
|
6
6
|
* key; their code behaviour stays attached, so an edit it can't honour is refused
|
|
7
7
|
* (`code_behaviour`), and reset rewrites Factory's current definition at the next revision. They
|
|
8
|
-
* can't be created over, and Work can't be deleted. The
|
|
9
|
-
* writes themselves are `BoardWrites`.
|
|
8
|
+
* can't be created over, and Work can't be deleted. The writes themselves are `BoardWrites`.
|
|
10
9
|
*/
|
|
11
10
|
import type { ApiRoute } from '@mastra/core/server';
|
|
12
11
|
import type { ProjectBoardCache } from '../boards/project-boards.js';
|
|
@@ -20,7 +19,7 @@ export interface BoardRoutesDeps extends RouteDependencies {
|
|
|
20
19
|
audit: AuditEmitter;
|
|
21
20
|
projects: FactoryProjectsStorage;
|
|
22
21
|
/** Read to refuse edits that would strand cards. */
|
|
23
|
-
workItems: Pick<WorkItemsStorage, 'listShared'>;
|
|
22
|
+
workItems: Pick<WorkItemsStorage, 'listShared' | 'releaseReviewCards'>;
|
|
24
23
|
storage: StoredBoardsStorage;
|
|
25
24
|
/** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */
|
|
26
25
|
boards: Pick<ProjectBoardCache, 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'seedFor'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boards.d.ts","sourceRoot":"","sources":["../../src/routes/boards.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"boards.d.ts","sourceRoot":"","sources":["../../src/routes/boards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAS,KAAK,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,oDAAoD;IACpD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,oBAAoB,CAAC,CAAC;IACvE,OAAO,EAAE,mBAAmB,CAAC;IAC7B,oGAAoG;IACpG,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,SAAS,CAAC,CAAC;CACxG;AAYD,qBAAa,WAAY,SAAQ,KAAK,CAAC,eAAe,CAAC;;IAwGrD,MAAM,IAAI,QAAQ,EAAE,CAgEnB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boards.js","names":[],"sources":["../../src/routes/boards.ts"],"sourcesContent":["/**\n * Mastra `apiRoutes` for managing a project's stored boards.\n *\n * Reads need project membership; writes need an organization admin in tenant mode. Factory stores\n * the built-in Work board and app boards in each project once, and they are edited under their own\n * key; their code behaviour stays attached, so an edit it can't honour is refused\n * (`code_behaviour`), and reset rewrites Factory's current definition at the next revision. They\n * can't be created over, and Work can't be deleted. The retired Review board's key is reserved. The\n * writes themselves are `BoardWrites`.\n */\n\nimport type { ApiRoute } from '@mastra/core/server';\nimport { registerApiRoute } from '@mastra/core/server';\nimport type { Context } from 'hono';\n\nimport { BoardWriteError, BoardWrites, issueMessage } from '../boards/board-writes.js';\nimport type { BoardWriter } from '../boards/board-writes.js';\nimport type { ProjectBoardCache } from '../boards/project-boards.js';\nimport { codeBehaviourOf } from '../boards/stored-board.js';\nimport type { AuditEmitter } from '../storage/domains/audit/domain.js';\nimport type { StoredBoardScope, StoredBoardsStorage } from '../storage/domains/boards/base.js';\nimport type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { FACTORY_ROUTE_CONTRACTS } from './contracts.js';\nimport type { RouteDependencies } from './route.js';\nimport { loose, Route } from './route.js';\n\nexport interface BoardRoutesDeps extends RouteDependencies {\n audit: AuditEmitter;\n projects: FactoryProjectsStorage;\n /** Read to refuse edits that would strand cards. */\n workItems: Pick<WorkItemsStorage, 'listShared'>;\n storage: StoredBoardsStorage;\n /** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */\n boards: Pick<ProjectBoardCache, 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'seedFor'>;\n}\n\ntype Resolved = StoredBoardScope & { userId: string };\n\n/** A response the handler returns as is: a refusal or an error. */\nclass Refusal {\n constructor(\n readonly status: 400 | 401 | 403 | 404 | 409 | 422,\n readonly body: Record<string, unknown>,\n ) {}\n}\n\nexport class BoardRoutes extends Route<BoardRoutesDeps> {\n readonly #writes = new BoardWrites(this.deps);\n\n async #resolve(c: Context): Promise<Resolved> {\n const { auth, projects } = this.deps;\n await auth.ensureUser(c);\n const tenant = auth.tenant(c);\n if (!tenant) throw new Refusal(401, { error: 'unauthorized' });\n if (!tenant.orgId) {\n throw new Refusal(403, { error: 'organization_required', message: 'Boards belong to an organization.' });\n }\n const parsed = FACTORY_ROUTE_CONTRACTS.boardCatalog.pathSchema.safeParse({ id: c.req.param('id') });\n if (!parsed.success) throw new Refusal(404, { error: 'Project not found' });\n await projects.ensureReady();\n if (!(await projects.get({ orgId: tenant.orgId, id: parsed.data.id }))) {\n throw new Refusal(404, { error: 'Project not found' });\n }\n return { orgId: tenant.orgId, userId: tenant.userId, factoryProjectId: parsed.data.id };\n }\n\n async #requireAdmin(c: Context, scope: Resolved): Promise<void> {\n const { auth } = this.deps;\n if (auth.enabled() && !(await auth.isOrganizationAdmin(c, scope.orgId))) {\n throw new Refusal(403, {\n error: 'organization_admin_required',\n message: 'Organization administrator access is required to change boards.',\n });\n }\n }\n\n async #body(c: Context): Promise<unknown> {\n try {\n return await c.req.json();\n } catch {\n throw new Refusal(400, { error: 'invalid_request', message: 'Invalid JSON body.' });\n }\n }\n\n #boardKey(c: Context): string {\n const parsed = FACTORY_ROUTE_CONTRACTS.boardGet.pathSchema.safeParse({\n id: c.req.param('id'),\n boardKey: c.req.param('boardKey'),\n });\n if (!parsed.success) throw new Refusal(404, { error: 'board_not_found' });\n return parsed.data.boardKey;\n }\n\n async #respond(c: Context, scope: Resolved, key: string, status: 200 | 201 = 200) {\n const { auth } = this.deps;\n const canEdit = !auth.enabled() || (await auth.isOrganizationAdmin(c, scope.orgId));\n const project = await this.deps.boards.describe(scope);\n const details = project.details.get(key);\n const code = this.deps.boards.codeRegistry.get(key);\n const row = await this.deps.storage.get(scope, key);\n if (!row) return c.json({ error: 'board_not_found', message: `Board \"${key}\" does not exist.` }, 404);\n // A board that failed to load, or a stored row its code board hides, is a project problem.\n const rowProblems = project.problems.filter(\n problem =>\n problem.startsWith(`Board '${key}' could not be loaded:`) || problem.startsWith(`Stored board \"${key}\" `),\n );\n return c.json(\n {\n board: {\n key: row.key,\n name: row.name,\n description: row.description,\n phases: row.phases.map(({ position: _position, ...phase }) => phase),\n revision: row.revision,\n source: details?.source ?? 'stored',\n editable: true,\n codeBehaviour: code ? codeBehaviourOf(code) : null,\n problems: [...(details?.problems ?? []), ...rowProblems.filter(p => !details?.problems.includes(p))],\n },\n canEdit,\n },\n status,\n );\n }\n\n #route(\n contract: { path: string; method: 'GET' | 'POST' | 'PATCH' | 'DELETE' },\n handle: (c: Context) => Promise<Response>,\n ): ApiRoute {\n return registerApiRoute(contract.path, {\n method: contract.method,\n requiresAuth: false,\n handler: async c => {\n const context = loose(c);\n try {\n return await handle(context);\n } catch (error) {\n if (error instanceof Refusal) return context.json(error.body, error.status);\n if (error instanceof BoardWriteError) return context.json(error.body, error.status);\n throw error;\n }\n },\n });\n }\n\n /** The request's user, as the board's author and the audit event's actor. */\n #writer(c: Context, scope: Resolved): BoardWriter {\n return { id: scope.userId, audit: input => this.deps.audit.emit({ context: c, input }) };\n }\n\n routes(): ApiRoute[] {\n const contracts = FACTORY_ROUTE_CONTRACTS;\n const writes = this.#writes;\n return [\n this.#route(contracts.boardGet, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardCreate, async c => {\n const scope = await this.#resolve(c);\n await this.#requireAdmin(c, scope);\n const row = await writes.create(scope, await this.#body(c), this.#writer(c, scope));\n return this.#respond(c, scope, row.key, 201);\n }),\n\n this.#route(contracts.boardReplace, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'edit');\n const parsed = contracts.boardReplace.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_board', message: issueMessage(parsed.error.issues) });\n }\n const { expectedRevision, ...definition } = parsed.data;\n await writes.replace(scope, key, definition, { expectedRevision, writer: this.#writer(c, scope) });\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardDelete, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'delete');\n const parsed = contracts.boardDelete.querySchema.safeParse({\n expectedRevision: c.req.query('expectedRevision'),\n });\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.remove(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return c.body(null, 204);\n }),\n\n this.#route(contracts.boardReset, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n const parsed = contracts.boardReset.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.reset(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return this.#respond(c, scope, key);\n }),\n ];\n }\n}\n"],"mappings":";;;;;;;AAwCA,IAAM,UAAN,MAAc;CAED;CACA;CAFX,YACE,QACA,MACA;EAFS,KAAA,SAAA;EACA,KAAA,OAAA;CACR;AACL;AAEA,IAAa,cAAb,cAAiC,MAAuB;CACtD,UAAmB,IAAI,YAAY,KAAK,IAAI;CAE5C,MAAM,SAAS,GAA+B;EAC5C,MAAM,EAAE,MAAM,aAAa,KAAK;EAChC,MAAM,KAAK,WA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AAK;IAC/B,CAAC;IACD,OAAO,KAAK,SAAS,GAAG,OAAO,GAAG;GACpC,CAAC;EACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"boards.js","names":[],"sources":["../../src/routes/boards.ts"],"sourcesContent":["/**\n * Mastra `apiRoutes` for managing a project's stored boards.\n *\n * Reads need project membership; writes need an organization admin in tenant mode. Factory stores\n * the built-in Work board and app boards in each project once, and they are edited under their own\n * key; their code behaviour stays attached, so an edit it can't honour is refused\n * (`code_behaviour`), and reset rewrites Factory's current definition at the next revision. They\n * can't be created over, and Work can't be deleted. The writes themselves are `BoardWrites`.\n */\n\nimport type { ApiRoute } from '@mastra/core/server';\nimport { registerApiRoute } from '@mastra/core/server';\nimport type { Context } from 'hono';\n\nimport { BoardWriteError, BoardWrites, issueMessage } from '../boards/board-writes.js';\nimport type { BoardWriter } from '../boards/board-writes.js';\nimport type { ProjectBoardCache } from '../boards/project-boards.js';\nimport { codeBehaviourOf } from '../boards/stored-board.js';\nimport type { AuditEmitter } from '../storage/domains/audit/domain.js';\nimport type { StoredBoardScope, StoredBoardsStorage } from '../storage/domains/boards/base.js';\nimport type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { FACTORY_ROUTE_CONTRACTS } from './contracts.js';\nimport type { RouteDependencies } from './route.js';\nimport { loose, Route } from './route.js';\n\nexport interface BoardRoutesDeps extends RouteDependencies {\n audit: AuditEmitter;\n projects: FactoryProjectsStorage;\n /** Read to refuse edits that would strand cards. */\n workItems: Pick<WorkItemsStorage, 'listShared' | 'releaseReviewCards'>;\n storage: StoredBoardsStorage;\n /** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */\n boards: Pick<ProjectBoardCache, 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'seedFor'>;\n}\n\ntype Resolved = StoredBoardScope & { userId: string };\n\n/** A response the handler returns as is: a refusal or an error. */\nclass Refusal {\n constructor(\n readonly status: 400 | 401 | 403 | 404 | 409 | 422,\n readonly body: Record<string, unknown>,\n ) {}\n}\n\nexport class BoardRoutes extends Route<BoardRoutesDeps> {\n readonly #writes = new BoardWrites(this.deps);\n\n async #resolve(c: Context): Promise<Resolved> {\n const { auth, projects } = this.deps;\n await auth.ensureUser(c);\n const tenant = auth.tenant(c);\n if (!tenant) throw new Refusal(401, { error: 'unauthorized' });\n if (!tenant.orgId) {\n throw new Refusal(403, { error: 'organization_required', message: 'Boards belong to an organization.' });\n }\n const parsed = FACTORY_ROUTE_CONTRACTS.boardCatalog.pathSchema.safeParse({ id: c.req.param('id') });\n if (!parsed.success) throw new Refusal(404, { error: 'Project not found' });\n await projects.ensureReady();\n if (!(await projects.get({ orgId: tenant.orgId, id: parsed.data.id }))) {\n throw new Refusal(404, { error: 'Project not found' });\n }\n return { orgId: tenant.orgId, userId: tenant.userId, factoryProjectId: parsed.data.id };\n }\n\n async #requireAdmin(c: Context, scope: Resolved): Promise<void> {\n const { auth } = this.deps;\n if (auth.enabled() && !(await auth.isOrganizationAdmin(c, scope.orgId))) {\n throw new Refusal(403, {\n error: 'organization_admin_required',\n message: 'Organization administrator access is required to change boards.',\n });\n }\n }\n\n async #body(c: Context): Promise<unknown> {\n try {\n return await c.req.json();\n } catch {\n throw new Refusal(400, { error: 'invalid_request', message: 'Invalid JSON body.' });\n }\n }\n\n #boardKey(c: Context): string {\n const parsed = FACTORY_ROUTE_CONTRACTS.boardGet.pathSchema.safeParse({\n id: c.req.param('id'),\n boardKey: c.req.param('boardKey'),\n });\n if (!parsed.success) throw new Refusal(404, { error: 'board_not_found' });\n return parsed.data.boardKey;\n }\n\n async #respond(c: Context, scope: Resolved, key: string, status: 200 | 201 = 200) {\n const { auth } = this.deps;\n const canEdit = !auth.enabled() || (await auth.isOrganizationAdmin(c, scope.orgId));\n const project = await this.deps.boards.describe(scope);\n const details = project.details.get(key);\n const code = this.deps.boards.codeRegistry.get(key);\n const row = await this.deps.storage.get(scope, key);\n if (!row) return c.json({ error: 'board_not_found', message: `Board \"${key}\" does not exist.` }, 404);\n // A board that failed to load, or a stored row its code board hides, is a project problem.\n const rowProblems = project.problems.filter(\n problem =>\n problem.startsWith(`Board '${key}' could not be loaded:`) || problem.startsWith(`Stored board \"${key}\" `),\n );\n return c.json(\n {\n board: {\n key: row.key,\n name: row.name,\n description: row.description,\n phases: row.phases.map(({ position: _position, ...phase }) => phase),\n revision: row.revision,\n source: details?.source ?? 'stored',\n editable: true,\n codeBehaviour: code ? codeBehaviourOf(code) : null,\n problems: [...(details?.problems ?? []), ...rowProblems.filter(p => !details?.problems.includes(p))],\n },\n canEdit,\n },\n status,\n );\n }\n\n #route(\n contract: { path: string; method: 'GET' | 'POST' | 'PATCH' | 'DELETE' },\n handle: (c: Context) => Promise<Response>,\n ): ApiRoute {\n return registerApiRoute(contract.path, {\n method: contract.method,\n requiresAuth: false,\n handler: async c => {\n const context = loose(c);\n try {\n return await handle(context);\n } catch (error) {\n if (error instanceof Refusal) return context.json(error.body, error.status);\n if (error instanceof BoardWriteError) return context.json(error.body, error.status);\n throw error;\n }\n },\n });\n }\n\n /** The request's user, as the board's author and the audit event's actor. */\n #writer(c: Context, scope: Resolved): BoardWriter {\n return { id: scope.userId, audit: input => this.deps.audit.emit({ context: c, input }) };\n }\n\n routes(): ApiRoute[] {\n const contracts = FACTORY_ROUTE_CONTRACTS;\n const writes = this.#writes;\n return [\n this.#route(contracts.boardGet, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardCreate, async c => {\n const scope = await this.#resolve(c);\n await this.#requireAdmin(c, scope);\n const row = await writes.create(scope, await this.#body(c), this.#writer(c, scope));\n return this.#respond(c, scope, row.key, 201);\n }),\n\n this.#route(contracts.boardReplace, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'edit');\n const parsed = contracts.boardReplace.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_board', message: issueMessage(parsed.error.issues) });\n }\n const { expectedRevision, ...definition } = parsed.data;\n await writes.replace(scope, key, definition, { expectedRevision, writer: this.#writer(c, scope) });\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardDelete, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'delete');\n const parsed = contracts.boardDelete.querySchema.safeParse({\n expectedRevision: c.req.query('expectedRevision'),\n });\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.remove(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return c.body(null, 204);\n }),\n\n this.#route(contracts.boardReset, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n const parsed = contracts.boardReset.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.reset(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return this.#respond(c, scope, key);\n }),\n ];\n }\n}\n"],"mappings":";;;;;;;AAuCA,IAAM,UAAN,MAAc;CAED;CACA;CAFX,YACE,QACA,MACA;EAFS,KAAA,SAAA;EACA,KAAA,OAAA;CACR;AACL;AAEA,IAAa,cAAb,cAAiC,MAAuB;CACtD,UAAmB,IAAI,YAAY,KAAK,IAAI;CAE5C,MAAM,SAAS,GAA+B;EAC5C,MAAM,EAAE,MAAM,aAAa,KAAK;EAChC,MAAM,KAAK,WAAW,CAAC;EACvB,MAAM,SAAS,KAAK,OAAO,CAAC;EAC5B,IAAI,CAAC,QAAQ,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,eAAe,CAAC;EAC7D,IAAI,CAAC,OAAO,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{
|
|
|
341
341
|
teardownCommand: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<string | null, string>>, z.ZodNull]>>;
|
|
342
342
|
}, z.core.$strip>>>;
|
|
343
343
|
}, z.core.$strip>;
|
|
344
|
+
/** What the draft page's starter buttons count on the project's default board. */
|
|
345
|
+
export declare const workItemStartersResponseSchema: z.ZodObject<{
|
|
346
|
+
failed: z.ZodNumber;
|
|
347
|
+
changesRequested: z.ZodNumber;
|
|
348
|
+
review: z.ZodObject<{
|
|
349
|
+
count: z.ZodNumber;
|
|
350
|
+
oldestOpenedAt: z.ZodOptional<z.ZodString>;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
undecided: z.ZodNumber;
|
|
353
|
+
untriaged: z.ZodNumber;
|
|
354
|
+
unplannedBugs: z.ZodNumber;
|
|
355
|
+
sweep: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
area: z.ZodString;
|
|
357
|
+
count: z.ZodNumber;
|
|
358
|
+
}, z.core.$strip>>;
|
|
359
|
+
stale: z.ZodNumber;
|
|
360
|
+
}, z.core.$strip>;
|
|
361
|
+
export declare const workItemActivityQuerySchema: z.ZodObject<{
|
|
362
|
+
since: z.ZodPipe<z.ZodISODateTime, z.ZodTransform<number, string>>;
|
|
363
|
+
}, z.core.$strip>;
|
|
364
|
+
/** When the project's cards were created and completed since an instant, and how many cards it has in all. */
|
|
365
|
+
export declare const workItemActivityResponseSchema: z.ZodObject<{
|
|
366
|
+
total: z.ZodNumber;
|
|
367
|
+
createdAt: z.ZodArray<z.ZodString>;
|
|
368
|
+
doneAt: z.ZodArray<z.ZodString>;
|
|
369
|
+
}, z.core.$strip>;
|
|
344
370
|
export declare const createWorkItemBodySchema: z.ZodObject<{
|
|
345
371
|
title: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
346
372
|
description: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string | null, string>>>>;
|
|
@@ -1622,6 +1648,46 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
1622
1648
|
check: z.ZodOptional<z.ZodString>;
|
|
1623
1649
|
}, z.core.$strip>;
|
|
1624
1650
|
};
|
|
1651
|
+
readonly workItemStarters: {
|
|
1652
|
+
readonly method: 'GET';
|
|
1653
|
+
readonly path: '/web/factory/projects/:id/work-items/starters';
|
|
1654
|
+
readonly description: 'Count the cards behind each new-session starter on the default board';
|
|
1655
|
+
readonly pathSchema: z.ZodObject<{
|
|
1656
|
+
id: z.ZodString;
|
|
1657
|
+
}, z.core.$strip>;
|
|
1658
|
+
readonly responseSchema: z.ZodObject<{
|
|
1659
|
+
failed: z.ZodNumber;
|
|
1660
|
+
changesRequested: z.ZodNumber;
|
|
1661
|
+
review: z.ZodObject<{
|
|
1662
|
+
count: z.ZodNumber;
|
|
1663
|
+
oldestOpenedAt: z.ZodOptional<z.ZodString>;
|
|
1664
|
+
}, z.core.$strip>;
|
|
1665
|
+
undecided: z.ZodNumber;
|
|
1666
|
+
untriaged: z.ZodNumber;
|
|
1667
|
+
unplannedBugs: z.ZodNumber;
|
|
1668
|
+
sweep: z.ZodOptional<z.ZodObject<{
|
|
1669
|
+
area: z.ZodString;
|
|
1670
|
+
count: z.ZodNumber;
|
|
1671
|
+
}, z.core.$strip>>;
|
|
1672
|
+
stale: z.ZodNumber;
|
|
1673
|
+
}, z.core.$strip>;
|
|
1674
|
+
};
|
|
1675
|
+
readonly workItemActivity: {
|
|
1676
|
+
readonly method: 'GET';
|
|
1677
|
+
readonly path: '/web/factory/projects/:id/work-items/activity';
|
|
1678
|
+
readonly description: 'List when cards were created and completed since an instant';
|
|
1679
|
+
readonly pathSchema: z.ZodObject<{
|
|
1680
|
+
id: z.ZodString;
|
|
1681
|
+
}, z.core.$strip>;
|
|
1682
|
+
readonly querySchema: z.ZodObject<{
|
|
1683
|
+
since: z.ZodPipe<z.ZodISODateTime, z.ZodTransform<number, string>>;
|
|
1684
|
+
}, z.core.$strip>;
|
|
1685
|
+
readonly responseSchema: z.ZodObject<{
|
|
1686
|
+
total: z.ZodNumber;
|
|
1687
|
+
createdAt: z.ZodArray<z.ZodString>;
|
|
1688
|
+
doneAt: z.ZodArray<z.ZodString>;
|
|
1689
|
+
}, z.core.$strip>;
|
|
1690
|
+
};
|
|
1625
1691
|
readonly workItemCreate: {
|
|
1626
1692
|
readonly method: 'POST';
|
|
1627
1693
|
readonly path: '/web/factory/projects/:id/work-items';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/routes/contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,eAAe,EAA4B,CAAC,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CAAC,CAAC;AAE1G,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACvB,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,kFAAkF,CAAC;AA8B5G,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB;;iBAAsD,CAAC;AACxF,kGAAkG;AAClG,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAgF,CAAC;AACpH,eAAO,MAAM,sBAAsB;;iBAAiE,CAAC;AAgErG,eAAO,MAAM,sB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;;;iBACX,cAAc;;;;;;;iBAGd,MAAM,EAAE,MAAM;iBACd,IAAI,EAAE,sEAAsE;iBAC5E,WAAW,EAAE,0CAA0C;iBACvD,UAAU;;;;;;;;;;iBACV,cAAc;;;;;iBAGd,MAAM,EAAE,MAAM;iBACd,IAAI,EAAE,yEAAyE;iBAC/E,WAAW,EAAE,qCAAqC;iBAClD,UAAU;;;;;;;;;;iBACV,cAAc;;;;;iBAGd,MAAM,EAAE,MAAM;iBACd,IAAI,EAAE,yEAAyE;iBAC/E,WAAW,EAAE,+CAA+C;iBAC5D,UAAU;;;;;;;;;;iBACV,cAAc;;;;;iBAGd,MAAM,EAAE,KAAK;iBACb,IAAI,EAAE,qBAAqB;iBAC3B,WAAW,EAAE,qEAAqE;iBAClF,WAAW;;;iBACX,cAAc;;;;;;iBAGd,MAAM,EAAE,KAAK;iBACb,IAAI,EAAE,wCAAwC;iBAC9C,WAAW,EAAE,sDAAsD;iBACnE,UAAU;;;;iBACV,UAAU;;;iBACV,cAAc;;;;;iBAGd,MAAM,EAAE,QAAQ;iBAChB,IAAI,EAAE,wCAAwC;iBAC9C,WAAW,EAAE,kEAAkE;iBAC/E,UAAU;;;;iBACV,cAAc;;;;CAEuC,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
|
package/dist/routes/contracts.js
CHANGED
|
@@ -424,6 +424,31 @@ const workItemListQuerySchema = z.object({
|
|
|
424
424
|
...query,
|
|
425
425
|
since: void 0
|
|
426
426
|
} : query);
|
|
427
|
+
const countSchema = z.number().int().nonnegative();
|
|
428
|
+
/** What the draft page's starter buttons count on the project's default board. */
|
|
429
|
+
const workItemStartersResponseSchema = z.object({
|
|
430
|
+
failed: countSchema,
|
|
431
|
+
changesRequested: countSchema,
|
|
432
|
+
review: z.object({
|
|
433
|
+
count: countSchema,
|
|
434
|
+
oldestOpenedAt: z.string().optional()
|
|
435
|
+
}),
|
|
436
|
+
undecided: countSchema,
|
|
437
|
+
untriaged: countSchema,
|
|
438
|
+
unplannedBugs: countSchema,
|
|
439
|
+
sweep: z.object({
|
|
440
|
+
area: z.string(),
|
|
441
|
+
count: countSchema
|
|
442
|
+
}).optional(),
|
|
443
|
+
stale: countSchema
|
|
444
|
+
});
|
|
445
|
+
const workItemActivityQuerySchema = z.object({ since: z.iso.datetime({ offset: true }).transform((since) => Date.parse(since)) });
|
|
446
|
+
/** When the project's cards were created and completed since an instant, and how many cards it has in all. */
|
|
447
|
+
const workItemActivityResponseSchema = z.object({
|
|
448
|
+
total: countSchema,
|
|
449
|
+
createdAt: z.array(z.string()),
|
|
450
|
+
doneAt: z.array(z.string())
|
|
451
|
+
});
|
|
427
452
|
const sessionsSchema = z.record(z.string().min(1).max(64), sessionSchema);
|
|
428
453
|
const metadataSchema = z.union([z.record(z.string(), z.unknown()), z.null()]).refine((value) => {
|
|
429
454
|
try {
|
|
@@ -946,6 +971,21 @@ const FACTORY_ROUTE_CONTRACTS = {
|
|
|
946
971
|
check: z.string().optional()
|
|
947
972
|
})
|
|
948
973
|
},
|
|
974
|
+
workItemStarters: {
|
|
975
|
+
method: "GET",
|
|
976
|
+
path: "/web/factory/projects/:id/work-items/starters",
|
|
977
|
+
description: "Count the cards behind each new-session starter on the default board",
|
|
978
|
+
pathSchema: projectPathSchema,
|
|
979
|
+
responseSchema: workItemStartersResponseSchema
|
|
980
|
+
},
|
|
981
|
+
workItemActivity: {
|
|
982
|
+
method: "GET",
|
|
983
|
+
path: "/web/factory/projects/:id/work-items/activity",
|
|
984
|
+
description: "List when cards were created and completed since an instant",
|
|
985
|
+
pathSchema: projectPathSchema,
|
|
986
|
+
querySchema: workItemActivityQuerySchema,
|
|
987
|
+
responseSchema: workItemActivityResponseSchema
|
|
988
|
+
},
|
|
949
989
|
workItemCreate: {
|
|
950
990
|
method: "POST",
|
|
951
991
|
path: "/web/factory/projects/:id/work-items",
|
|
@@ -1105,6 +1145,6 @@ const FACTORY_ROUTE_CONTRACTS = {
|
|
|
1105
1145
|
responseSchema: skillResponseSchema
|
|
1106
1146
|
}
|
|
1107
1147
|
};
|
|
1108
|
-
export { FACTORY_ROUTE_CONTRACTS, MAX_SANDBOX_ENV_VALUE_LENGTH, MAX_SKILL_OVERRIDE_LENGTH, RESERVED_SANDBOX_ENV_NAMES, THINKING_LEVELS, UUID_PATTERN, attentionQuerySchema, automationRunStartBodySchema, boardDeleteQuerySchema, boardResetBodySchema, createProjectBodySchema, createWorkItemBodySchema, decisionQuerySchema, environmentBuildResponseSchema, environmentBuildSchema, environmentBuildStartResponseSchema, environmentBuildTriggersSchema, environmentBuildsResponseSchema, environmentLastBuildSchema, environmentSandboxSchema, intakeRouteInputSchema, intakeRoutePatchSchema, intakeRouteReorderBodySchema, metricsQuerySchema, projectEnvironmentResponseSchema, projectListRepositorySchema, replaceBoardBodySchema, sandboxEnvAppliesToSchema, sandboxEnvNameSchema, sandboxEnvSetBodySchema, sandboxEnvUpdateBodySchema, skillOverrideBodySchema, skillOverrideSaveRequestSchema, startWorkItemBodySchema, transitionBodySchema, updateProjectBodySchema, updateProjectEnvironmentBodySchema, updateWorkItemBodySchema };
|
|
1148
|
+
export { FACTORY_ROUTE_CONTRACTS, MAX_SANDBOX_ENV_VALUE_LENGTH, MAX_SKILL_OVERRIDE_LENGTH, RESERVED_SANDBOX_ENV_NAMES, THINKING_LEVELS, UUID_PATTERN, attentionQuerySchema, automationRunStartBodySchema, boardDeleteQuerySchema, boardResetBodySchema, createProjectBodySchema, createWorkItemBodySchema, decisionQuerySchema, environmentBuildResponseSchema, environmentBuildSchema, environmentBuildStartResponseSchema, environmentBuildTriggersSchema, environmentBuildsResponseSchema, environmentLastBuildSchema, environmentSandboxSchema, intakeRouteInputSchema, intakeRoutePatchSchema, intakeRouteReorderBodySchema, metricsQuerySchema, projectEnvironmentResponseSchema, projectListRepositorySchema, replaceBoardBodySchema, sandboxEnvAppliesToSchema, sandboxEnvNameSchema, sandboxEnvSetBodySchema, sandboxEnvUpdateBodySchema, skillOverrideBodySchema, skillOverrideSaveRequestSchema, startWorkItemBodySchema, transitionBodySchema, updateProjectBodySchema, updateProjectEnvironmentBodySchema, updateWorkItemBodySchema, workItemActivityQuerySchema, workItemActivityResponseSchema, workItemStartersResponseSchema };
|
|
1109
1149
|
|
|
1110
1150
|
//# sourceMappingURL=contracts.js.map
|