@wildo-ai/saas-technical-doc 1.1.2 → 1.1.4
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/dist/esm/build/csp-emit.d.ts.map +1 -1
- package/dist/esm/build/load-materialized-frontend-providers.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-administration-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-administration-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-authentication-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.d.ts +25 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.js +28 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-domain-documentation.d.ts +133 -0
- package/dist/esm/companion/application-documentation/application-domain-documentation.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/application-domain-documentation.js +243 -0
- package/dist/esm/companion/application-documentation/application-domain-documentation.js.map +1 -0
- package/dist/esm/companion/application-documentation/application-integration-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-integration-documentation.js +23 -0
- package/dist/esm/companion/application-documentation/application-integration-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts +30 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.js +38 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts +61 -1
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js +255 -218
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts +2 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js.map +1 -1
- package/dist/esm/companion/content/application-consumer-documentation-content-loader.d.ts.map +1 -1
- package/dist/esm/companion/index.d.ts +2 -1
- package/dist/esm/companion/index.d.ts.map +1 -1
- package/dist/esm/companion/index.js +2 -1
- package/dist/esm/companion/index.js.map +1 -1
- package/dist/esm/companion/manual-controller-route-projection.d.ts +112 -0
- package/dist/esm/companion/manual-controller-route-projection.d.ts.map +1 -0
- package/dist/esm/companion/manual-controller-route-projection.js +249 -0
- package/dist/esm/companion/manual-controller-route-projection.js.map +1 -0
- package/dist/esm/companion/openapi-generator.d.ts +16 -0
- package/dist/esm/companion/openapi-generator.d.ts.map +1 -1
- package/dist/esm/companion/openapi-generator.js +493 -26
- package/dist/esm/companion/openapi-generator.js.map +1 -1
- package/dist/esm/companion/operation-projection.schemas.d.ts +44 -0
- package/dist/esm/companion/operation-projection.schemas.d.ts.map +1 -1
- package/dist/esm/companion/operation-projection.schemas.js +37 -0
- package/dist/esm/companion/operation-projection.schemas.js.map +1 -1
- package/dist/esm/companion/publish-result.types.d.ts +37 -4
- package/dist/esm/companion/publish-result.types.d.ts.map +1 -1
- package/dist/esm/companion/publish-result.types.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts +7 -1
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js +34 -18
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js +8 -1
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-render-model.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-render-model.js +30 -13
- package/dist/esm/companion/rendering/technical-documentation-render-model.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts +10 -0
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js +10 -15
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js.map +1 -1
- package/dist/esm/companion/technical-documentation-asset-path.d.ts.map +1 -1
- package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts +27 -1
- package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts.map +1 -1
- package/dist/esm/companion/technical-documentation-capture-execution-port.js.map +1 -1
- package/dist/esm/companion/technical-documentation-diagram-definitions.d.ts +33 -0
- package/dist/esm/companion/technical-documentation-diagram-definitions.d.ts.map +1 -0
- package/dist/esm/companion/technical-documentation-diagram-definitions.js +54 -0
- package/dist/esm/companion/technical-documentation-diagram-definitions.js.map +1 -0
- package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts +10 -18
- package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts.map +1 -1
- package/dist/esm/companion/technical-documentation-diagram-materializer.js +9 -39
- package/dist/esm/companion/technical-documentation-diagram-materializer.js.map +1 -1
- package/dist/esm/companion/technical-documentation-placeholder-materializer.d.ts.map +1 -1
- package/dist/esm/companion/zod-to-openapi.d.ts.map +1 -1
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/config/define-tech-doc-config.d.ts.map +1 -1
- package/dist/esm/config/index.d.ts.map +1 -1
- package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts +8 -4
- package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts.map +1 -1
- package/dist/esm/config/wildo-tech-doc-config.schemas.js +8 -4
- package/dist/esm/config/wildo-tech-doc-config.schemas.js.map +1 -1
- package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts +42 -64
- package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts.map +1 -1
- package/dist/esm/content/application-consumer-documentation-content.techdoc.js +164 -925
- package/dist/esm/content/application-consumer-documentation-content.techdoc.js.map +1 -1
- package/dist/esm/content.exports.d.ts.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/openapi/api-reference-link-index.d.ts.map +1 -1
- package/dist/esm/openapi/index.d.ts.map +1 -1
- package/dist/esm/openapi/openapi-generation-output.schemas.d.ts.map +1 -1
- package/dist/esm/openapi-reference-model.exports.d.ts.map +1 -1
- package/dist/esm/runtime/AuthExchangePage.d.ts.map +1 -1
- package/dist/esm/runtime/DocsAuthContext.d.ts +16 -1
- package/dist/esm/runtime/DocsAuthContext.d.ts.map +1 -1
- package/dist/esm/runtime/DocsAuthContext.js +18 -2
- package/dist/esm/runtime/DocsAuthContext.js.map +1 -1
- package/dist/esm/runtime/decode-jwt-claims.d.ts.map +1 -1
- package/dist/esm/runtime/docs-auth-client.d.ts.map +1 -1
- package/dist/esm/runtime/docs-auth-session.schemas.d.ts.map +1 -1
- package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts +35 -13
- package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts.map +1 -1
- package/dist/esm/runtime/frontend-provider-registry.techdoc.js +28 -19
- package/dist/esm/runtime/frontend-provider-registry.techdoc.js.map +1 -1
- package/dist/esm/runtime/index.d.ts +1 -0
- package/dist/esm/runtime/index.d.ts.map +1 -1
- package/dist/esm/runtime/index.js +1 -0
- package/dist/esm/runtime/index.js.map +1 -1
- package/dist/esm/runtime/openapi-reference-conservation.d.ts.map +1 -1
- package/dist/esm/runtime/use-docs-auth-session.d.ts.map +1 -1
- package/dist/esm/runtime/use-docs-frontend-provider-registry.d.ts.map +1 -1
- package/dist/esm/runtime/use-docs-provider-sdks.d.ts +21 -0
- package/dist/esm/runtime/use-docs-provider-sdks.d.ts.map +1 -0
- package/dist/esm/runtime/use-docs-provider-sdks.js +49 -0
- package/dist/esm/runtime/use-docs-provider-sdks.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts +0 -9
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts.map +0 -1
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js +0 -111
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-generator.js","sourceRoot":"","sources":["../../../../src/companion/openapi-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAEvG,OAAO,EACL,cAAc,GAGf,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACL,4BAA4B,EAC5B,0CAA0C,EAC1C,qCAAqC,EACrC,8BAA8B,GAI/B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAE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C,wCAAwC;KACxD,CAAC;IAEF,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QACzE,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,oCAAoC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEvD,OAAO;QACL,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @wildo-package @wildo-ai/saas-technical-doc/companion (generator)\n *\n * Pure-function OpenAPI 3.1 generator (saas-technical-doc.md Step 3).\n *\n * Pipeline:\n *\n * `OpenApiGenerationInput`\n * ──filterApiCallOperations──► (assert URL-bearing variants)\n * ──groupOperationsByConsumerApiSection──► (use source-resolved section)\n * ──buildOpenApiDocument──► (per-section OpenAPI 3.1 doc as a JS object)\n * ──assembleOpenApiGenerationOutput──►(top-level `OpenApiGenerationOutput`)\n *\n * Key design points:\n *\n * K-1: This module is `OpenApiGenerationInput` → `OpenApiGenerationOutput`\n * and contains no I/O, no global state, and no DI. It is consumed by\n * the companion controller (which owns the introspection hop +\n * filesystem write — see Step 4) and by unit tests in isolation.\n *\n * K-2: Sections that contain ZERO operations after filtering are\n * OMITTED from the output's `sections[]` array (per the\n * `OpenApiGenerationOutputSchema` JSDoc). The companion UI\n * surfaces this as an absent section — the empty section is\n * intentional, not a generator bug.\n *\n * K-3: The generator uses Zod-parsed input (validated up-front via\n * `OpenApiGenerationInputSchema`) so every downstream helper can\n * assume well-formed projections. Callers MUST call\n * `generateOpenApiDocuments(input)` (which parses) and NOT the\n * sub-helpers directly with unparsed data.\n *\n * K-4: The semantic output carries one document object. YAML/JSON\n * serialization is renderer-owned so divergent format payloads cannot\n * cross this contract.\n *\n * @wildo-boundary\n * Imports only the portable OpenAPI output contract, the local operation\n * projection contract, the lightweight public runtime constants and\n * specification-prose cleanup. No serializer, React or saas-models root\n * barrel enters this semantic generator.\n */\n\nimport { WildoHeaderKeys } from '@wildo-ai/saas-models/public-runtime';\nimport { COLLECTION_QUERY_PARAMETERS, Resources_PaginationRequestSchema } from '@wildo-ai/saas-models';\n\nimport {\n OpenApiSection,\n type OpenApiGenerationOutput,\n type OpenApiSectionOutput,\n} from '../openapi/openapi-generation-output.schemas';\n\nimport {\n OpenApiGenerationInputSchema,\n OPENAPI_RESOURCE_IDENTITY_CONTRACT_VERSION,\n OperationProjectionAuthenticationMode,\n OperationProjectionVariantType,\n type ResourceTag,\n type OpenApiGenerationInput,\n type OperationProjection,\n} from './operation-projection.schemas';\n\nimport { stripImplementationNoise } from './spec-to-operation-doc';\n\n/**\n * Retains every projected URL-bearing operation.\n *\n * - Variant outside `API_CALL` / `API_CALL_WITH_CALLBACK` (K-5):\n * defense-in-depth re-check on top of the projector's filter.\n * If a non-API variant ever leaks through, drop it silently here\n * rather than throwing — the projector is the single source of\n * truth for \"should this op even be in the projection at all,\" but\n * we don't want a future projector regression to corrupt the\n * generated doc with non-HTTP operations.\n *\n * `isApiKeyAccessDisabled` controls the operation's accepted authentication\n * schemes. It does not make an HTTP operation disappear from its API contract.\n *\n * Returns a NEW array — does not mutate the input.\n */\nexport function filterApiCallOperations(\n operations: ReadonlyArray<OperationProjection>,\n): ReadonlyArray<OperationProjection> {\n return operations.filter((op) => {\n if (\n op.variantType !== OperationProjectionVariantType.API_CALL &&\n op.variantType !== OperationProjectionVariantType.API_CALL_WITH_CALLBACK\n ) {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Groups operations by the explicit consumer-facing section resolved by the\n * source projector. This layer deliberately does not reinterpret role strings\n * or internal resource scopes: doing so would create a second authority for\n * which product reference owns an operation.\n *\n * Returns a frozen `Record` keyed by `OpenApiSection`. Sections with\n * zero operations are returned as empty arrays (NOT omitted) so the\n * caller's filtering logic in `assembleOpenApiGenerationOutput` is the\n * single place that decides \"drop empty sections from the output.\"\n */\nexport function groupOperationsByConsumerApiSection(\n operations: ReadonlyArray<OperationProjection>,\n): Readonly<Record<OpenApiSection, ReadonlyArray<OperationProjection>>> {\n const apiReferenceOperations: OperationProjection[] = [];\n const applicationAdministrationOperations: OperationProjection[] = [];\n for (const op of operations) {\n switch (op.consumerApiSection) {\n case OpenApiSection.API_REFERENCE:\n apiReferenceOperations.push(op);\n break;\n case OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE:\n applicationAdministrationOperations.push(op);\n break;\n default: {\n const exhaustiveSection: never = op.consumerApiSection;\n throw new Error(`OpenAPI generator: unsupported consumer API section ${String(exhaustiveSection)}`);\n }\n }\n }\n return Object.freeze({\n [OpenApiSection.API_REFERENCE]: Object.freeze(apiReferenceOperations),\n [OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE]: Object.freeze(applicationAdministrationOperations),\n });\n}\n\n/**\n * Stable, deterministic ordering for operations within an OpenAPI\n * doc. Sorted by `(resourceIdentifier, path, httpVerb)` so the\n * generated YAML diffs cleanly across runs even if the projector\n * yields operations in a different order (e.g. iteration order\n * depending on the resource registry walk).\n */\nfunction sortOperationsForDeterministicOutput(\n operations: ReadonlyArray<OperationProjection>,\n): ReadonlyArray<OperationProjection> {\n return [...operations].sort((a, b) => {\n if (a.resourceIdentifier !== b.resourceIdentifier) {\n return a.resourceIdentifier.localeCompare(b.resourceIdentifier);\n }\n if (a.path !== b.path) {\n return a.path.localeCompare(b.path);\n }\n return a.httpVerb.localeCompare(b.httpVerb);\n });\n}\n\n/**\n * Maps an `OperationProjection` to its developer-facing OpenAPI `operationId`.\n *\n * VERB-FIRST camelCase — the convention the best public API references and the\n * OpenAPI/SDK-generator ecosystem converge on (`createUser`, `listOrganizations`,\n * `rotateApiKey`; see Speakeasy + Redocly operationId guidance). The\n * `operationId` becomes the generated client method name; combined with the\n * resource TAG, tag-grouping generators yield `sdk.organizations.create()` and\n * flat generators yield `createOrganization()`.\n *\n * Composition: `<verb><ResourceNoun><Qualifiers>`, lower-camelCased.\n *\n * - **verb** — the standard CRUD identifiers (the LOWERCASE\n * `CoreResourceOperation` values the projector actually emits) map to\n * idiomatic verbs (`create→create`, `read→get`, `list→list`,\n * `update→update`, `delete→delete`, `search→search` — see {@link CRUD_VERBS});\n * any other identifier becomes its own verb phrase via `pascal`, whether a\n * custom op (`exportAuditLogs`→`exportAuditLogs`, `EXPORT_AUDIT_LOGS`→\n * `exportAuditLogs`) or a framework collection op the map omits\n * (`count`→`count`, `create_many`→`createMany`).\n * - **ResourceNoun** — `resourceIdentifier` PascalCased with camelCase word\n * boundaries PRESERVED (`organizationApiKeys`→`OrganizationApiKeys`); the\n * prior implementation lowercased segment interiors and produced\n * `Organizationapikeys`.\n * - **Redundancy** — a custom verb phrase that already contains the resource\n * noun drops the repeat (`exportAuditLogs`, not `exportAuditLogsAuditLogs`).\n * - **Qualifiers** — the `operationKey` segments AFTER the base identifier:\n * the semantic `Via<Relationship>` disambiguator for relationship-nested\n * paths, the `summary`/`context` data-mode, and `BULK`. Each is PascalCased\n * and appended in order.\n *\n * Unique within the document and stable across runs (the multi-path\n * disambiguator is the relationship name, not a positional index).\n */\n/**\n * Split a string on separators AND camelCase boundaries (lowercase/digit →\n * uppercase) so multi-word camelCase identifiers keep their word boundaries.\n */\nfunction splitWords(input: string): string[] {\n return input.split(/[^a-zA-Z0-9]+|(?<=[a-z0-9])(?=[A-Z])/u).filter((segment) => segment.length > 0);\n}\n\n/**\n * Industry-standard initialisms whose casing carries meaning in public API\n * vocabulary. This is presentation-only: stable resource and operation\n * identities remain unchanged in tags, operation ids and `x-wildo` metadata.\n */\nconst API_REFERENCE_DISPLAY_INITIALISM_BY_TOKEN: Readonly<Record<string, string>> = Object.freeze({\n a2a: 'A2A',\n api: 'API',\n dlq: 'DLQ',\n idp: 'IdP',\n ip: 'IP',\n jwt: 'JWT',\n m2m: 'M2M',\n mcp: 'MCP',\n oauth: 'OAuth',\n oidc: 'OIDC',\n pdf: 'PDF',\n saml: 'SAML',\n scim: 'SCIM',\n siem: 'SIEM',\n sso: 'SSO',\n url: 'URL',\n});\n\nfunction apiReferenceDisplayWord(word: string, capitalizeOrdinaryWord: boolean): string {\n const initialism = API_REFERENCE_DISPLAY_INITIALISM_BY_TOKEN[word.toLowerCase()];\n if (initialism !== undefined) return initialism;\n const lowercaseWord = word.toLowerCase();\n return capitalizeOrdinaryWord\n ? `${lowercaseWord.charAt(0).toUpperCase()}${lowercaseWord.slice(1)}`\n : lowercaseWord;\n}\n\n/**\n * PascalCase a string. Lowercases the interior ONLY for all-uppercase words\n * (SCREAMING_SNAKE op identifiers like `EXPORT`, `EXCHANGE` → `Export`,\n * `Exchange`); camelCase words (`Api`, `organization`) keep their interior so\n * word boundaries survive (`organizationApiKeys` → `OrganizationApiKeys`).\n * Shared by `buildOperationId` and the `components/schemas` namer\n * (`componentSchemaName`) so operation ids and model names stay consistent.\n */\nfunction pascal(input: string): string {\n return splitWords(input)\n .map((word) => {\n const rest = /^[A-Z0-9]+$/u.test(word) ? word.slice(1).toLowerCase() : word.slice(1);\n return word.charAt(0).toUpperCase() + rest;\n })\n .join('');\n}\n\n/**\n * Idiomatic verb-first `operationId` verbs for the standard CRUD identifiers.\n *\n * Keyed on the LOWERCASE `@wildo-ai/saas-models` `CoreResourceOperation` VALUES\n * (`'read'`, `'create'`, `'list'`, …) — NOT the SCREAMING_SNAKE enum MEMBER names.\n * The projector sets `baseOperationIdentifier` to\n * `String(operation.operationIdentifier)`, which for a core operation IS the\n * lowercase enum value, so the lookup key MUST be lowercase.\n *\n * (History: this map was originally keyed on `'READ'` / `'CREATE'` / … — the\n * enum member names — so no lookup ever matched at runtime and every base fell\n * through to the custom-verb `pascal` path. It went unnoticed because\n * `pascal(value)` lower-cased equals the intended verb for `create` / `list` /\n * `update` / `delete` / `search` — the whole map was a no-op EXCEPT `read`,\n * which produced `readX` instead of the intended `getX`.)\n *\n * Mirrored as string literals for the same boundary reason as the other\n * framework constants in this file — the generator must NOT import\n * `@wildo-ai/saas-models` (see the module `@wildo-boundary` note). Keep in sync\n * with `CoreResourceOperation`.\n *\n * `read → get` is the sole non-identity mapping; the other five are listed for\n * self-documentation and drift-resistance (they equal `pascal(value)`). Every\n * OTHER identifier — custom ops AND the framework's own `count` / `create_many` /\n * `update_many` / `delete_many` — becomes its own verb phrase via `pascal`\n * (`create_many → createMany…`, `export_audit_logs → exportAuditLogs…`).\n */\nconst CRUD_VERBS: Record<string, string> = {\n create: 'create',\n read: 'get',\n list: 'list',\n update: 'update',\n delete: 'delete',\n search: 'search',\n};\n\n/**\n * Human, sentence-case verb labels for the default operation TITLE (`summary`).\n *\n * Keyed on the same lowercase `CoreResourceOperation` values as {@link CRUD_VERBS}\n * (see that constant for the boundary + casing rationale). NB the TITLE verb for\n * a read is the plain `'Read'` (e.g. \"Read application auth policy\"), distinct\n * from the `operationId` verb `get` — the two surfaces intentionally diverge.\n * Identifiers absent here fall through to a humanised phrase of the identifier\n * itself in `buildDefaultSummary`.\n */\nconst VERB_LABEL: Record<string, string> = {\n create: 'Create',\n read: 'Read',\n list: 'List',\n update: 'Update',\n delete: 'Delete',\n search: 'Search',\n};\n\nfunction buildOperationId(op: OperationProjection): string {\n const base = op.baseOperationIdentifier;\n const isCustom = CRUD_VERBS[base] === undefined;\n const verbPascal = isCustom ? pascal(base) : pascal(CRUD_VERBS[base]!);\n const resourcePascal = pascal(op.resourceIdentifier);\n\n // A custom verb phrase that already names the resource (e.g. EXPORT_AUDIT_LOGS\n // on `auditLogs`) drops the repeated noun.\n const corePascal = isCustom && verbPascal.includes(resourcePascal)\n ? verbPascal\n : `${verbPascal}${resourcePascal}`;\n\n // Qualifiers = `operationKey` with the leading base identifier removed (the\n // base can itself contain `_`, so we strip by length, not by splitting).\n const qualifierTail = op.operationKey.startsWith(base)\n ? op.operationKey.slice(base.length)\n : '';\n const qualifiersPascal = qualifierTail.split('_').filter(Boolean).map(pascal).join('');\n\n const combined = `${corePascal}${qualifiersPascal}`;\n return combined.charAt(0).toLowerCase() + combined.slice(1);\n}\n\n/**\n * Default summary fallback. Used when the projector did not provide\n * an explicit `summary` so the docs site never renders a blank title.\n */\n/**\n * The operation TITLE (OpenAPI `summary` — page title, nav label, breadcrumb).\n *\n * A SHORT, human, derived action label — NOT the authored `purpose` prose\n * (that is impl-aware intent text and now lives in the `description`; see\n * `buildOperationDocFromSpec`). Mirrors the verb-first `operationId` but rendered\n * as a readable sentence-case phrase:\n *\n * read + applicationAuthPolicy → \"Read application auth policy\"\n * list + organizationApiKeys (summary variant) → \"List organization api keys (summary)\"\n * create + appAnnouncements via posted-by-users → \"Create app announcements via posted by users\"\n * export_audit_logs + auditLogs → \"Export audit logs\"\n *\n * The qualifier suffixes (`Via<…>`, `summary`/`context` data-mode, `BULK`) are\n * humanised so the multiple endpoints of one resource read distinctly in the\n * sidebar instead of colliding on the same title.\n */\nfunction buildDefaultSummary(op: OperationProjection): string {\n const words = (input: string): string[] =>\n input.split(/[^a-zA-Z0-9]+|(?<=[a-z0-9])(?=[A-Z])/u).filter((segment) => segment.length > 0);\n const sentence = (input: string): string => words(input).map((word) => apiReferenceDisplayWord(word, false)).join(' ');\n\n const base = op.baseOperationIdentifier;\n const verbPhrase = VERB_LABEL[base] ?? sentence(base);\n const resourcePhrase = sentence(op.resourceIdentifier);\n const actionWords = words(verbPhrase).map((word) => word.toLowerCase());\n const resourceWords = words(resourcePhrase).map((word) => word.toLowerCase());\n const actionAlreadyNamesResource = resourceWords.length > 0\n && actionWords.length >= resourceWords.length\n && resourceWords.every((word, index) => actionWords.at(index - resourceWords.length) === word);\n let title = actionAlreadyNamesResource\n ? `${verbPhrase.charAt(0).toUpperCase()}${verbPhrase.slice(1)}`\n : `${verbPhrase.charAt(0).toUpperCase()}${verbPhrase.slice(1)} ${resourcePhrase}`.trim();\n\n const qualifierTail = op.operationKey.startsWith(base) ? op.operationKey.slice(base.length) : '';\n for (const qualifier of qualifierTail.split('_').filter(Boolean)) {\n if (qualifier.startsWith('Via')) {\n title += ` via ${sentence(qualifier.slice(3))}`;\n } else if (qualifier === 'BULK') {\n title += ' (bulk)';\n } else if (qualifier.toLowerCase() === 'summary' || qualifier.toLowerCase() === 'context') {\n title += ` (${qualifier.toLowerCase()})`;\n } else {\n title += ` ${sentence(qualifier)}`;\n }\n }\n return title;\n}\n\n/**\n * Extracts `{paramName}` placeholders from an OpenAPI-style template\n * path. Used to derive `parameters[]: in: path` entries automatically\n * — the projector does not need to redeclare them.\n *\n * Returns an empty array for paths with no placeholders.\n */\nfunction extractPathParameters(path: string): ReadonlyArray<string> {\n const matches = path.matchAll(/\\{([^}]+)\\}/gu);\n return Array.from(matches, (match) => match[1]);\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isQueryParameterVerb(httpVerb: OperationProjection['httpVerb']): boolean {\n return (\n httpVerb === 'get'\n || httpVerb === 'delete'\n );\n}\n\n/**\n * Converts a top-level object JSON Schema fragment into OpenAPI query\n * parameters for query-style verbs (GET / DELETE). Request examples are carried\n * onto the individual OpenAPI Parameter Objects: these methods have no JSON\n * body, so dropping an authored example here would make a valid source example\n * invisible to both an OpenAPI viewer and the Wildo renderer.\n *\n * Why fail-loud on non-object schemas:\n *\n * The projection explicitly allows `requestBodySchema` to represent\n * query input for GET / DELETE operations. If a projector bug emits a\n * scalar / array / malformed schema here, silently reusing it as an\n * OpenAPI `requestBody` would recreate the exact mis-documentation bug\n * this helper exists to close. Throwing keeps the spec honest and pins\n * the regression to the generator boundary.\n */\nfunction buildQueryParametersFromRequestSchema(op: OperationProjection): ReadonlyArray<Record<string, unknown>> {\n const schema = op.requestBodySchema;\n if (schema === null) {\n return [];\n }\n if (!isPlainObject(schema) || schema.type !== 'object') {\n throw new Error(\n `OpenAPI generator: ${op.httpVerb.toUpperCase()} ${op.path} for `\n + `${op.resourceIdentifier}.${op.operationKey} carries a non-object request schema. `\n + `GET/DELETE request schemas must be object-shaped so the generator can emit query parameters.`,\n );\n }\n\n const properties = schema.properties;\n if (properties === undefined) {\n return [];\n }\n if (!isPlainObject(properties)) {\n throw new Error(\n `OpenAPI generator: ${op.httpVerb.toUpperCase()} ${op.path} for `\n + `${op.resourceIdentifier}.${op.operationKey} has an object request schema with malformed `\n + '`properties`. Expected a plain object so query parameters can be emitted deterministically.',\n );\n }\n\n const requiredFields = Array.isArray(schema.required)\n ? new Set(schema.required.filter((value): value is string => typeof value === 'string'))\n : new Set<string>();\n\n // Collection-axis dedupe: on a paginated collection operation (`op.pagination`\n // present) the framework-generated SEARCH request DTO carries NESTED\n // `pagination` / `sorting` / `filters` object properties. The canonical wire\n // shape is FLAT (what the frontend HTTP client sends, what the backend\n // controller reads first — the nested forms are fallbacks): the `page` /\n // `limit` / `sort` trio, a free-text `q`, and one parameter per filter field\n // (scalars flat, date ranges as `deepObject`). Exploding the `filters` object\n // verbatim would emit a nested object with no `style: deepObject` metadata, so\n // SDK generators would serialise it wrong. Drop the nested axes here — the flat\n // trio is emitted by `buildPaginationQueryParameters`, and the flat `q` +\n // per-field filters by `buildCollectionFilterQueryParameters`, both on the same\n // operation. The flat trio names are excluded too so a DTO can never collide with\n // them. Ops WITHOUT the pagination contract keep every DTO property untouched.\n const paginationAxisProperties = op.pagination !== undefined\n ? new Set(['pagination', 'sorting', 'filters', COLLECTION_QUERY_PARAMETERS.page, COLLECTION_QUERY_PARAMETERS.limit, COLLECTION_QUERY_PARAMETERS.sort])\n : new Set<string>();\n\n return Object.entries(properties)\n .filter(([name]) => !paginationAxisProperties.has(name))\n .map(([name, propertySchema]) => {\n const parameter: Record<string, unknown> = {\n name,\n in: 'query',\n required: requiredFields.has(name),\n schema: isPlainObject(propertySchema) ? propertySchema : {},\n };\n if (isPlainObject(propertySchema) && typeof propertySchema.description === 'string') {\n parameter['description'] = propertySchema.description;\n }\n const examples = buildParameterExamples(op, name);\n if (examples !== undefined) {\n parameter['examples'] = examples;\n }\n return parameter;\n });\n}\n\n/**\n * Projects source-authored request values onto one OpenAPI parameter. Path and\n * query parameters share the same Parameter Object example contract; retaining\n * the source title lets a consumer correlate a concrete id/filter with the\n * business case it was authored for. Response-only examples never participate.\n */\nfunction buildParameterExamples(op: OperationProjection, parameterName: string): Record<string, unknown> | undefined {\n const examples: Record<string, unknown> = {};\n for (const example of op.examples ?? []) {\n if (!isPlainObject(example.request) || !Object.prototype.hasOwnProperty.call(example.request, parameterName)) {\n continue;\n }\n examples[example.title] = { value: example.request[parameterName] };\n }\n return Object.keys(examples).length > 0 ? examples : undefined;\n}\n\n/**\n * Adds matching source-authored values to a generated Parameter Object. This\n * is shared by path parameters, direct DTO-property query parameters and the\n * framework-generated flat collection axes (`q`, filters, pagination).\n */\nfunction attachParameterExamples(\n op: OperationProjection,\n parameter: Record<string, unknown>,\n): Record<string, unknown> {\n const name = parameter['name'];\n if (typeof name !== 'string') {\n return parameter;\n }\n const examples = buildParameterExamples(op, name);\n return examples === undefined ? parameter : { ...parameter, examples };\n}\n\n/**\n * Flattens a paginated collection operation's nested `filters` request-DTO object\n * into the FLAT, wire-truthful query parameters the framework actually accepts —\n * the filtering counterpart of the `page` / `limit` / `sort` pagination-trio\n * reshape (`buildPaginationQueryParameters`).\n *\n * The framework's SEARCH request DTO (`createResourceSearchQueryRequestSchema`)\n * always carries a top-level `filters` OBJECT: the free-text `searchRequest`, the\n * `createdAt` / `updatedAt` date-range filters, plus one property per authored\n * filter field. That nested object is NOT the wire shape — the frontend HTTP\n * client sends each filter FLAT (`?status=…`) and free-text as `?q=…`, and the\n * backend controller (`extractCollectionFilters` + `normalizeCollectionQueryRequestData`)\n * reads the flat forms first. This helper re-surfaces the FLAT-serialisable\n * `filters` properties as their own query parameters:\n *\n * - `searchRequest` → the canonical flat `q` string (what the frontend sends and\n * the backend reads before `searchQuery` before the nested `filters.searchRequest`).\n * - any SCALAR property (string / number / boolean / enum) → a plain flat query\n * parameter (`?status=active`), carrying the property's schema (and description).\n * - an OBJECT-valued property (a date range `{ startDate?, endDate? }`) →\n * `style: deepObject, explode: true`, so SDK generators serialise it as\n * `field[startDate]=…&field[endDate]=…` (bracket notation). The backend runs\n * Express 5's default `simple` query parser (which leaves bracketed keys flat),\n * so the controller reconstructs the nested object from those keys —\n * `reconstructBracketedRangeFilters` in the collection-query controller,\n * declaration-gated to actual range fields. Emitting the `deepObject` metadata\n * is the second half of the fix the pagination reshape called out: a nested\n * object in a GET query string needs `style: deepObject`, which the naive DTO\n * explosion never emitted. (A global `extended` query parser was deliberately\n * NOT used — it changes `req.query` shape for every controller and breaks the\n * flat-scalar `req.query.X as string` assumption across auth / SCIM / chart.)\n * - a filter field whose name is ALSO a path parameter of this endpoint → SKIPPED\n * (URL-supplied; see the per-operation note below).\n *\n * Gated on `op.pagination !== undefined` (collection ops only — the same signal\n * the collection-axis dedupe uses), a query verb, and a `filters` object property,\n * so a non-collection GET carrying an unrelated `filters` property keeps its naive\n * explosion untouched. All filter parameters are OPTIONAL. Returns `[]` when the\n * op is not a paginated collection op or declares no `filters` object.\n */\nfunction buildCollectionFilterQueryParameters(op: OperationProjection): ReadonlyArray<Record<string, unknown>> {\n if (op.pagination === undefined || !isQueryParameterVerb(op.httpVerb)) {\n return [];\n }\n const schema = op.requestBodySchema;\n if (!isPlainObject(schema) || !isPlainObject(schema.properties)) {\n return [];\n }\n const filtersSchema = (schema.properties as Record<string, unknown>)['filters'];\n if (!isPlainObject(filtersSchema) || !isPlainObject(filtersSchema.properties)) {\n return [];\n }\n const filterProperties = filtersSchema.properties as Record<string, unknown>;\n\n // A filter field that is ALSO a path parameter of THIS endpoint (a parent-scope\n // FK reached via a nested path, e.g. `todoId` on `/…/todos/{todoId}/tasks`) is\n // already supplied by the URL. Emitting it AGAIN as a query parameter is\n // redundant, produces two same-named parameters SDK generators mishandle, and —\n // because the backend merges `{ ...req.params, ...req.query }` — would let the\n // query value silently override the path scope (a tenant-scope footgun). Skip\n // it: the path parameter is authoritative. The skip is PER-OPERATION (keyed on\n // this path's params), so the same filter field is still emitted on a sibling\n // path that does NOT bind the FK, where filtering by it is meaningful.\n const pathParameterNames = new Set(extractPathParameters(op.path));\n\n const parameters: Array<Record<string, unknown>> = [];\n\n // Free-text search → the canonical flat `q` (the frontend sends `?q=`, and the\n // backend reads `q` first). The `filters.searchRequest` DTO property is the\n // nested fallback name, so it is surfaced under the wire name, not verbatim.\n if ('searchRequest' in filterProperties) {\n parameters.push(attachParameterExamples(op, {\n name: COLLECTION_QUERY_PARAMETERS.search,\n in: 'query',\n required: false,\n schema: { type: 'string' },\n description:\n 'Free-text search query, matched against the operation\\'s configured searchable '\n + 'fields. Sent flat as `?q=…` (the wire form the backend reads first).',\n }));\n }\n\n for (const [name, propertySchema] of Object.entries(filterProperties)) {\n if (name === 'searchRequest' || pathParameterNames.has(name)) {\n continue; // `searchRequest` surfaced as `q` above; path-param FKs are URL-supplied\n }\n const isObjectValued = isPlainObject(propertySchema)\n && (propertySchema.type === 'object' || 'properties' in propertySchema);\n const parameter: Record<string, unknown> = { name, in: 'query', required: false };\n // Object-valued filters (date ranges) are irreducibly nested; emit deepObject\n // so SDKs serialise `name[<field>]=…`. The backend's collection-query controller\n // reconstructs the nested object from those bracketed keys (the global query\n // parser stays `simple`); see `reconstructBracketedRangeFilters`.\n if (isObjectValued) {\n parameter['style'] = 'deepObject';\n parameter['explode'] = true;\n }\n parameter['schema'] = isPlainObject(propertySchema) ? propertySchema : {};\n if (isPlainObject(propertySchema) && typeof propertySchema.description === 'string') {\n parameter['description'] = propertySchema.description;\n } else if (isObjectValued) {\n // No authored description on the range object — synthesise a truthful hint\n // that names the deepObject bracket form for each sub-field it carries.\n const subKeys = isPlainObject(propertySchema) && isPlainObject(propertySchema.properties)\n ? Object.keys(propertySchema.properties as Record<string, unknown>)\n : [];\n const bracketHint = subKeys.length > 0\n ? subKeys.map((subKey) => `\\`${name}[${subKey}]=…\\``).join(' & ')\n : `\\`${name}[<field>]=…\\``;\n parameter['description'] =\n `Object-valued filter — serialise each sub-field with deepObject bracket notation (${bracketHint}).`;\n }\n parameters.push(attachParameterExamples(op, parameter));\n }\n\n return parameters;\n}\n\n/**\n * Framework-universal pagination defaults, mirrored from the backend\n * repository adapters (`_doList` in both the MongoDB and PostgreSQL resource\n * repositories, `@wildo-ai/saas-backend-lib`): an omitted `page` reads as\n * page 1, an omitted `limit` reads as 20 items per page. Duplicated as\n * literals for the same boundary reason as the enums above (the generator\n * must not import `@wildo-ai/saas-backend-lib`); keep in sync with the\n * repository defaults.\n */\n// Defaults are read off the shared pagination request schema, never restated.\nconst PAGINATION_DEFAULT_PAGE: number = Resources_PaginationRequestSchema.shape.page.parse(undefined);\nconst PAGINATION_DEFAULT_LIMIT: number = Resources_PaginationRequestSchema.shape.limit.parse(undefined);\n\n/**\n * Emits the flat `page` / `limit` / `sort` query parameters for a paginated\n * collection operation (`op.pagination` present — LIST / SEARCH-like; see the\n * projection schema JSDoc). These parameters are FRAMEWORK knowledge: the\n * backend accepts them on every HTTP LIST/SEARCH dispatch but no request DTO\n * declares them, so without this emission the spec documents paginated\n * endpoints with no way to page them (and the `info.description` conventions\n * block would promise parameters the operations never declare).\n *\n * Shapes follow the runtime contract exactly:\n *\n * - `page` — 1-based positive integer, server default 1.\n * - `limit` — positive integer, server default 20, capped at the\n * per-operation `maxLimit` the projector resolved.\n * - `sort` — comma-separated `field:asc` / `field:desc` pairs, highest\n * priority first. With a non-empty `sortableFields` allow-list the backend\n * silently ignores unrecognised fields and defaults to the first allowed\n * field descending; with no allow-list any field applies and the default\n * is `createdAt:desc`. The description states whichever branch is true\n * for this operation, so the docs never promise sorting the backend\n * would drop.\n */\nfunction buildPaginationQueryParameters(op: OperationProjection): ReadonlyArray<Record<string, unknown>> {\n const pagination = op.pagination;\n if (pagination === undefined) {\n return [];\n }\n const sortableFields = pagination.sortableFields;\n const sortDescription = sortableFields.length > 0\n ? 'Sort order: comma-separated `field:asc` / `field:desc` pairs, highest priority first '\n + `(e.g. \\`${sortableFields[0]}:desc\\`). Sortable fields: `\n + `${sortableFields.map((field) => `\\`${field}\\``).join(', ')}. `\n + `Unrecognised fields are ignored. Defaults to \\`${sortableFields[0]}:desc\\`.`\n : 'Sort order: comma-separated `field:asc` / `field:desc` pairs, highest priority first '\n + '(e.g. `createdAt:desc`). Defaults to `createdAt:desc` (newest first).';\n return [\n {\n name: COLLECTION_QUERY_PARAMETERS.page,\n in: 'query',\n required: false,\n schema: { type: 'integer', minimum: 1, default: PAGINATION_DEFAULT_PAGE },\n description: '1-based page number of the collection slice.',\n },\n {\n name: COLLECTION_QUERY_PARAMETERS.limit,\n in: 'query',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: pagination.maxLimit, default: PAGINATION_DEFAULT_LIMIT },\n description: `Maximum number of items per page (up to ${pagination.maxLimit}).`,\n },\n {\n name: COLLECTION_QUERY_PARAMETERS.sort,\n in: 'query',\n required: false,\n schema: { type: 'string' },\n description: sortDescription,\n },\n ].map((parameter) => attachParameterExamples(op, parameter));\n}\n\n/**\n * HTTP header carrying a complete API key. Read from the lightweight public\n * runtime entrypoint so the generator shares the backend's canonical header\n * vocabulary without importing the saas-models root barrel.\n */\nconst API_KEY_AUTHORIZATION_HEADER_NAME = WildoHeaderKeys.AUTHORIZATION;\n\n/** HTTP header carrying an anonymous-session token. */\nconst ANONYMOUS_SESSION_HEADER_NAME = WildoHeaderKeys.ANONYMOUS_SESSION_TOKEN;\n\n/**\n * Framework-universal OpenAPI `components.securitySchemes`. Every Wildo API\n * authenticates the same ways, so the generator emits these UNCONDITIONALLY —\n * framework knowledge, not app config. Per-operation `security` references them\n * by name (see `buildOperationSecurity`).\n *\n * - `bearerAuth` — JWT access token in `Authorization: Bearer <jwt>`.\n * - `apiKeyAuth` — org-/app-scoped API key (`sk_org_…` / `sk_app_…`) in `Authorization` without a bearer scheme.\n * - `anonymousSessionAuth` — anonymous-session token in `x-anonymous-session-token`\n * (the pre-authentication surface; `APP_ANONYMOUS` operations).\n */\nconst SECURITY_SCHEMES: Record<string, Record<string, unknown>> = {\n bearerAuth: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description:\n 'JWT access token issued by the authentication service. Send as `Authorization: Bearer <token>`.',\n },\n apiKeyAuth: {\n type: 'apiKey',\n in: 'header',\n name: API_KEY_AUTHORIZATION_HEADER_NAME,\n description:\n 'Organization- or application-scoped API key (`sk_org_…` / `sk_app_…`), sent as the complete value of the `Authorization` header without a `Bearer` scheme.',\n },\n anonymousSessionAuth: {\n type: 'apiKey',\n in: 'header',\n name: ANONYMOUS_SESSION_HEADER_NAME,\n description:\n 'Anonymous-session token for pre-authentication (anonymous user) access, sent in the `x-anonymous-session-token` header.',\n },\n};\n\n/**\n * Per-operation OpenAPI `security`, derived ENTIRELY from the source-resolved\n * access document (NOT `primaryScope`, which is the scope/audience axis).\n *\n * - `roles` contains `APP_PUBLIC` → `[]` — explicitly PUBLIC (OpenAPI reads an\n * empty `security` array as \"no authentication required\"). Public access\n * wins over any other listed role, so the docs/\"Try it\" don't demand a token\n * for sign-up, public reads, etc.\n * - otherwise the requirements are OR-ed (any one satisfies the request):\n * • `anonymousSessionAuth` when `roles` contains `APP_ANONYMOUS`.\n * • `bearerAuth` (+ `apiKeyAuth`, unless `isApiKeyAccessDisabled`) when the\n * op has ANY non-`APP_ANONYMOUS` role, OR no role at all (an open endpoint\n * for any authenticated user — \"app users can list users\").\n *\n * So `[APP_ANONYMOUS]` → anonymous-session only; `[APP_ANONYMOUS, APP_USER]` →\n * anonymous-session OR bearer/api-key; `[APP_USER]` / `[]` / `[ORG_OWNER]` →\n * bearer/api-key. `isApiKeyAccessDisabled` removes only the API-key alternative;\n * the HTTP operation remains documented.\n */\nfunction buildOperationSecurity(op: OperationProjection): Array<Record<string, string[]>> {\n if (op.access.authenticationMode === OperationProjectionAuthenticationMode.PUBLIC) return [];\n const requirements: Array<Record<string, string[]>> = [];\n if (\n op.access.authenticationMode === OperationProjectionAuthenticationMode.ANONYMOUS_SESSION\n || op.access.authenticationMode === OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED\n ) {\n requirements.push({ anonymousSessionAuth: [] });\n }\n if (\n op.access.authenticationMode === OperationProjectionAuthenticationMode.AUTHENTICATED\n || op.access.authenticationMode === OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED\n ) {\n requirements.push({ bearerAuth: [] });\n if (!op.isApiKeyAccessDisabled) {\n requirements.push({ apiKeyAuth: [] });\n }\n }\n return requirements;\n}\n\n/**\n * Builds the OpenAPI 3.1 `paths.<path>.<method>` entry for a single\n * operation. Returns a plain JS object suitable for direct YAML\n * serialisation — no YAML primitives leak past the YAML emitter call.\n */\nfunction buildOperationObject(\n op: OperationProjection,\n operationId: string,\n errorResponseSchema: unknown,\n): Record<string, unknown> {\n const operationObject: Record<string, unknown> = {\n operationId,\n summary: op.summary ?? buildDefaultSummary(op),\n tags: [op.resourceIdentifier],\n // Strict framework metadata for consumers that need to join a rendered\n // operation back to its resolved source identity. Standard OpenAPI fields\n // stay standard; this carries only Wildo-specific semantics.\n 'x-wildo': {\n ...op.identity,\n section: op.consumerApiSection,\n roles: [...op.roles],\n access: op.access,\n },\n };\n if (op.description !== undefined) {\n operationObject['description'] = op.description;\n }\n\n // Auth (Tier-1 framework knowledge). The source projector resolves access\n // semantics once; this generator only transports that fact into standard\n // OpenAPI `security` and the companion `x-wildo` extension.\n const security = buildOperationSecurity(op);\n operationObject['security'] = security;\n if (op.access.authenticationMode !== OperationProjectionAuthenticationMode.PUBLIC && op.access.roleRequirements.length > 0) {\n operationObject['x-required-roles'] = op.access.roleRequirements.map((requirement) => requirement.role);\n }\n\n const parameters: Array<Record<string, unknown>> = [];\n const pathParams = extractPathParameters(op.path);\n if (pathParams.length > 0) {\n parameters.push(...pathParams.map((paramName) => attachParameterExamples(op, {\n name: paramName,\n in: 'path',\n required: true,\n schema: { type: 'string' },\n })));\n }\n\n if (op.stepUpAuthentication !== undefined) {\n parameters.push({\n name: op.stepUpAuthentication.headerName,\n in: 'header',\n required: true,\n schema: { type: 'string' },\n description:\n `Single-use re-authentication token obtained from POST ${op.stepUpAuthentication.tokenEndpointPath}. `\n + 'Required for this sensitive operation and consumed when the request is authorized.',\n });\n }\n\n if (op.acceptsIfMatch) {\n parameters.push({\n name: WildoHeaderKeys.IF_MATCH,\n in: 'header',\n required: false,\n schema: {\n type: 'string',\n pattern: '^(?:[0-9]+|\"[0-9]+\"|W/\"[0-9]+\")$',\n },\n examples: {\n 'Current resource version': { value: '7' },\n },\n description:\n 'Optional optimistic-locking version from `_version` in the latest resource response. '\n + 'Send it as a bare integer (`7`), quoted entity tag (`\"7\"`) or weak entity tag (`W/\"7\"`). '\n + 'When supplied, the mutation is applied only if that version is still current.',\n });\n }\n\n if (isQueryParameterVerb(op.httpVerb)) {\n parameters.push(...buildQueryParametersFromRequestSchema(op));\n // Paginated collection ops carry a nested `filters` bag in their request DTO;\n // it was dropped from the naive explosion above and is re-surfaced here as the\n // flat `q` + one parameter per filter field (scalars flat, date ranges as\n // deepObject — the backend controller reconstructs the nested range object).\n parameters.push(...buildCollectionFilterQueryParameters(op));\n } else if (op.requestBodySchema !== null) {\n const requestJsonMedia: Record<string, unknown> = { schema: op.requestBodySchema };\n const requestExamples = buildRequestExamples(op);\n if (requestExamples !== undefined) {\n requestJsonMedia['examples'] = requestExamples;\n }\n operationObject['requestBody'] = {\n required: true,\n content: {\n 'application/json': requestJsonMedia,\n },\n };\n }\n // Paginated collection ops (LIST / SEARCH-like) accept the framework's flat\n // `page` / `limit` / `sort` query parameters regardless of what their request\n // DTO declares. Appended LAST so operation-specific parameters (`q`, filter\n // fields) read first and the boilerplate trio sits together at the end.\n parameters.push(...buildPaginationQueryParameters(op));\n if (parameters.length > 0) {\n operationObject['parameters'] = parameters;\n }\n\n // Inject engine metadata (`_version` / `_field_meta`) that the response\n // serializer reattaches onto every materialized resource document but which no\n // resource schema declares. Computed once and shared by the `responses` object\n // and the async callback payload (both describe the same operation result) so\n // structurally identical schemas still content-dedup into one component when\n // hoisted.\n const augmentedResponseBodySchema = augmentResponseSchemaWithEngineMetadata(op.responseBodySchema);\n\n operationObject['responses'] = buildResponsesObject(op, augmentedResponseBodySchema, errorResponseSchema);\n\n if (op.variantType === OperationProjectionVariantType.API_CALL_WITH_CALLBACK) {\n // The Zod superRefine on OperationProjectionSchema guarantees\n // callbackPath is defined here — but the runtime check below is\n // defense-in-depth in case a future caller bypasses Zod parsing\n // and feeds the helper a raw projection (which the public API\n // forbids but the helper itself remains pure-function).\n if (op.callbackPath !== undefined) {\n operationObject['callbacks'] = {\n completion: {\n [`{$request.body#/callbackUrl}${op.callbackPath}`]: {\n post: {\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: augmentedResponseBodySchema ?? {},\n },\n },\n },\n responses: {\n '204': { description: 'Callback acknowledged' },\n },\n },\n },\n },\n };\n }\n }\n\n if (op.idempotent !== undefined) {\n operationObject['x-idempotent'] = op.idempotent;\n }\n if (op.rateLimitNote !== undefined) {\n const rateLimitLine = `**Rate limiting:** ${op.rateLimitNote}`;\n operationObject['description'] = typeof operationObject['description'] === 'string'\n ? `${operationObject['description']}\\n\\n${rateLimitLine}`\n : rateLimitLine;\n }\n\n return operationObject;\n}\n\n/**\n * Client-facing engine-metadata properties that the response serializer\n * REATTACHES onto every materialized resource document AFTER the response DTO\n * parse strips them (`operation-response-serializer.backend.utils` +\n * `services-registry-handler.transformOutput`, both in `@wildo-ai/saas-backend-lib`).\n * They are engine metadata, NOT declared fields of any resource schema — so\n * `operation.responseDto` (and thus the projected `responseBodySchema`) omits\n * them and the generated OpenAPI would under-document the real wire response.\n * We emit them as OPTIONAL, non-required properties so the spec matches what\n * clients actually receive; well-behaved clients already ignore unknown\n * `_`-prefixed fields, this just makes the contract explicit.\n *\n * - `_version` — optimistic-locking counter (a non-negative integer; the\n * stored `_version_db_doc` surfaced to clients, starts at 1 and increments on\n * every write, but can read as `0`). The frontend echoes it back as the\n * `If-Match` request header on inline updates to detect concurrent edits.\n * - `_field_meta` — per-field CRDT causality map used for conflict-free merges\n * of concurrent edits. Opaque to API clients; safe to ignore.\n *\n * Cloned per-injection (spread) so no two schemas share a mutable node.\n */\nconst ENGINE_METADATA_PROPERTY_SCHEMAS: Readonly<Record<string, Record<string, unknown>>> = {\n _version: {\n type: 'integer',\n description:\n 'Engine metadata (not a resource field): optimistic-locking version counter. '\n + 'Echo it back as the `If-Match` request header on updates to guard against concurrent edits.',\n },\n _field_meta: {\n type: 'object',\n additionalProperties: true,\n description:\n 'Engine metadata (not a resource field): per-field CRDT causality map used for '\n + 'conflict-free merges of concurrent edits. Opaque to clients — safe to ignore.',\n },\n};\n\n/**\n * The structural signature of a MATERIALIZED resource document in a response\n * schema is the `_id` property. The serializer attaches `_version` /\n * `_field_meta` to exactly those objects (repository documents carry the stored\n * `_version_db_doc`, surfaced as `_version`); envelopes (`{ count }`, delete /\n * purge acks), computed-state projections (feature entitlements, lifecycle\n * state), and `context`-mode wrappers have no `_id` and carry no engine\n * metadata. Gating on `_id` keeps the spec truthful in BOTH directions — no\n * under-documentation of real documents, no over-documentation of envelopes.\n * Mutates `objectSchema.properties` in place (the caller owns a fresh clone).\n */\nfunction injectEngineMetadataIntoResourceDocumentSchema(objectSchema: Record<string, unknown>): void {\n const properties = objectSchema['properties'];\n if (!isPlainObject(properties) || !('_id' in properties)) {\n return;\n }\n for (const [name, schema] of Object.entries(ENGINE_METADATA_PROPERTY_SCHEMAS)) {\n // Never clobber an authored field of the same name (defensive — no resource\n // declares `_version` / `_field_meta`, but the guard keeps injection\n // idempotent). NOT added to `required`: engine metadata is optional.\n if (!(name in properties)) {\n properties[name] = { ...schema };\n }\n }\n}\n\n/**\n * Walk the composite wrappers (`oneOf` / `anyOf` / `allOf`) a polymorphic /\n * discriminated-union response produces (`z.toJSONSchema` emits `oneOf` for a\n * `ZodDiscriminatedUnion`) down to the concrete object branches, injecting\n * engine metadata into each branch that is a resource document. A non-composite\n * object is injected directly.\n */\nfunction injectEngineMetadataIntoEntitySchemas(schema: unknown): void {\n if (!isPlainObject(schema)) {\n return;\n }\n let isComposite = false;\n for (const compositeKey of ['oneOf', 'anyOf', 'allOf'] as const) {\n const branches = schema[compositeKey];\n if (Array.isArray(branches)) {\n isComposite = true;\n for (const branch of branches) {\n injectEngineMetadataIntoEntitySchemas(branch);\n }\n }\n }\n if (!isComposite) {\n injectEngineMetadataIntoResourceDocumentSchema(schema);\n }\n}\n\n/**\n * Return a CLONE of an operation's response body schema with the engine-metadata\n * properties injected at the SAME structural positions the response serializer\n * attaches them (`operation-response-serializer.backend.utils`):\n *\n * 1. paginated `{ data: [ … ], pagination }` → each `data[]` item\n * 2. flat array `[ … ]` → each item\n * 3. single object → the object itself\n *\n * (each unwrapped through `oneOf`/`anyOf`/`allOf` for polymorphic resources).\n * The original schema is NEVER mutated — the callback path and any structurally\n * identical schema on another operation must stay pristine so content-dedup\n * (`stableStringify`) still collapses them onto one component. Non-object\n * schemas (`null` / scalar) pass through unchanged.\n */\nfunction augmentResponseSchemaWithEngineMetadata(responseBodySchema: unknown): unknown {\n if (!isPlainObject(responseBodySchema)) {\n return responseBodySchema;\n }\n const clone = structuredClone(responseBodySchema) as Record<string, unknown>;\n const properties = clone['properties'];\n const dataSchema = isPlainObject(properties) ? properties['data'] : undefined;\n if (isPlainObject(dataSchema) && (dataSchema['type'] === 'array' || 'items' in dataSchema)) {\n // Paginated `{ data: [ … ] }` wrapper — mirror the serializer's `body.data[i]`\n // attach position. (A `context`-mode wrapper's `data[]` item is itself a\n // `{ data: [ … ] }` sub-collection with no `_id`, so it is correctly skipped.)\n injectEngineMetadataIntoEntitySchemas(dataSchema['items']);\n } else if (clone['type'] === 'array' || 'items' in clone) {\n injectEngineMetadataIntoEntitySchemas(clone['items']);\n } else {\n injectEngineMetadataIntoEntitySchemas(clone);\n }\n return clone;\n}\n\n/**\n * Builds the OpenAPI `responses` object for an operation: authored success\n * statuses + error scenarios (Tier 3), plus the framework-wide authentication\n * failure derived from the source-resolved access mode. It falls back to the\n * default single `200`/`204` when no success status is authored. Response\n * `examples` are attached to the status they declare via `forStatus`. Multiple\n * error scenarios on the same code merge their `when` prose into one entry's\n * description.\n *\n * `responseBodySchema` is the operation's response body schema ALREADY augmented\n * with engine metadata (see `augmentResponseSchemaWithEngineMetadata`); the\n * caller computes it once so the `responses` object and the async callback\n * payload share the same node.\n */\nfunction buildResponsesObject(\n op: OperationProjection,\n responseBodySchema: unknown,\n errorResponseSchema: unknown,\n): Record<string, unknown> {\n const responseExamplesByStatus = new Map<string, Record<string, unknown>>();\n for (const example of op.examples ?? []) {\n if (example.response === undefined || example.forStatus === undefined) {\n continue;\n }\n const bucket = responseExamplesByStatus.get(example.forStatus) ?? {};\n bucket[example.title] = { value: example.response };\n responseExamplesByStatus.set(example.forStatus, bucket);\n }\n\n const buildSuccessContent = (code: string): Record<string, unknown> | undefined => {\n if (responseBodySchema === null || code === '204') {\n return undefined;\n }\n const jsonMedia: Record<string, unknown> = { schema: responseBodySchema };\n const examples = responseExamplesByStatus.get(code);\n if (examples !== undefined) {\n jsonMedia['examples'] = examples;\n }\n return { 'application/json': jsonMedia };\n };\n\n const responses: Record<string, unknown> = {};\n const successStatuses = op.responseStatuses ?? [];\n if (successStatuses.length > 0) {\n for (const status of successStatuses) {\n const entry: Record<string, unknown> = { description: status.meaning };\n const content = buildSuccessContent(status.code);\n if (content !== undefined) {\n entry['content'] = content;\n }\n responses[status.code] = entry;\n }\n } else if (responseBodySchema !== null) {\n const entry: Record<string, unknown> = { description: 'Success' };\n const content = buildSuccessContent('200');\n if (content !== undefined) {\n entry['content'] = content;\n }\n responses['200'] = entry;\n } else {\n responses['204'] = { description: 'No Content' };\n }\n\n for (const error of op.errorScenarios ?? []) {\n const description = error.errorCode !== undefined\n ? `${error.when} (error code: \\`${error.errorCode}\\`)`\n : error.when;\n const errorJsonMedia: Record<string, unknown> = { schema: errorResponseSchema };\n const examples = responseExamplesByStatus.get(error.code);\n if (examples !== undefined) {\n errorJsonMedia['examples'] = examples;\n }\n const errorContent = { 'application/json': errorJsonMedia };\n const existing = responses[error.code];\n if (isPlainObject(existing) && typeof existing['description'] === 'string') {\n existing['description'] = `${existing['description']}\\n\\n${description}`;\n existing['content'] = errorContent;\n } else {\n responses[error.code] = {\n description,\n content: errorContent,\n };\n }\n }\n\n if (op.acceptsIfMatch) {\n const mergeFrameworkError = (code: string, description: string): void => {\n const existing = responses[code];\n if (isPlainObject(existing) && typeof existing['description'] === 'string') {\n existing['description'] = `${existing['description']}\\n\\n${description}`;\n existing['content'] = { 'application/json': { schema: errorResponseSchema } };\n return;\n }\n responses[code] = {\n description,\n content: { 'application/json': { schema: errorResponseSchema } },\n };\n };\n mergeFrameworkError(\n '400',\n 'The optional `If-Match` header is present but does not contain a non-negative integer resource version.',\n );\n mergeFrameworkError(\n '409',\n 'The `If-Match` version no longer matches the current resource version, so the mutation was not applied.',\n );\n }\n\n // Every framework RATE_LIMIT error with a retry delay is serialized by\n // `ErrorHandlerBackendService` with an HTTP `Retry-After` header. A source-\n // authored 429 is therefore sufficient to project this protocol contract;\n // individual resource specifications must not duplicate framework header\n // vocabulary. The current runtime emits integer delay-seconds, not an HTTP\n // date, so the Header Object deliberately exposes that narrower shape.\n const rateLimitResponse = responses['429'];\n if (isPlainObject(rateLimitResponse)) {\n rateLimitResponse['headers'] = {\n 'Retry-After': {\n description: 'Delay in seconds before the client should retry the request.',\n schema: { type: 'integer', minimum: 0 },\n },\n };\n }\n\n // Authentication happens before the resource operation. The projection's\n // access mode is the sole truth for which credentials may satisfy it, so the\n // renderer and each resource specification do not need to re-state the same\n // 401 contract. A resource-owned 401 is more specific (for example a\n // step-up flow) and deliberately takes precedence.\n if (op.access.authenticationMode !== OperationProjectionAuthenticationMode.PUBLIC && responses['401'] === undefined) {\n const description = (() => {\n switch (op.access.authenticationMode) {\n case OperationProjectionAuthenticationMode.ANONYMOUS_SESSION:\n return 'The anonymous-session token is missing, malformed, expired, or invalid.';\n case OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED:\n return 'No valid anonymous-session token, bearer token, or API key was supplied.';\n case OperationProjectionAuthenticationMode.AUTHENTICATED:\n return 'No valid bearer token or API key was supplied.';\n default: {\n const exhaustiveAuthenticationMode: never = op.access.authenticationMode;\n throw new Error(`OpenAPI generator: unsupported authentication mode ${String(exhaustiveAuthenticationMode)}`);\n }\n }\n })();\n responses['401'] = {\n description,\n content: { 'application/json': { schema: errorResponseSchema } },\n };\n }\n\n return responses;\n}\n\n/**\n * Builds the OpenAPI request-body `examples` map from authored examples that\n * carry a `request` payload. Returns undefined when there are none.\n */\nfunction buildRequestExamples(op: OperationProjection): Record<string, unknown> | undefined {\n const examples: Record<string, unknown> = {};\n const pathParameterNames = new Set(extractPathParameters(op.path));\n for (const example of op.examples ?? []) {\n if (example.request === undefined) {\n continue;\n }\n // Source examples use one object so the same authored scenario can feed path\n // parameters and the JSON body. OpenAPI represents those as separate locations:\n // keep path values on Parameter Objects (via `buildParameterExamples`) and remove\n // them from the body example. Otherwise a primary-scope id such as\n // `organizationId` appears twice even when the request DTO correctly owns only\n // `justification` and `requestedDurationMinutes`.\n const value = isPlainObject(example.request)\n ? Object.fromEntries(Object.entries(example.request).filter(([name]) => !pathParameterNames.has(name)))\n : example.request;\n examples[example.title] = { value };\n }\n return Object.keys(examples).length > 0 ? examples : undefined;\n}\n\n/**\n * Is this JSON-Schema fragment worth hoisting into `components/schemas`? Only\n * structured bodies (objects / arrays / composed schemas) earn a named\n * component + `$ref`; bare scalars (`{ type: 'string' }`) and empty `{}` stay\n * inline (a `$ref` to a one-line scalar would be pure overhead). Already-`$ref`\n * fragments are left alone.\n */\nfunction isHoistableSchema(value: unknown): value is Record<string, unknown> {\n if (!isPlainObject(value) || '$ref' in value) {\n return false;\n }\n return (\n value['type'] === 'object'\n || value['type'] === 'array'\n || 'properties' in value\n || 'items' in value\n || 'allOf' in value\n || 'anyOf' in value\n || 'oneOf' in value\n );\n}\n\n/**\n * Deterministic, key-sorted stringification used to detect structurally\n * IDENTICAL schemas regardless of key order, so the same shape authored on\n * different operations (or the same operation reached at multiple paths — the\n * `Via<…>` variants) collapses onto ONE component.\n */\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (isPlainObject(value)) {\n return `{${Object.keys(value)\n .sort()\n .map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value) ?? 'null';\n}\n\n/**\n * Component name for an operation's request/response body. Mirrors the\n * verb-first operationId namer (shares `pascal`): `<Resource><BaseVerb><Quals><Role>`,\n * e.g. `TodosListResponse`, `TodosCreateRequest`, `TodosListSummaryResponse`,\n * `TodosChangeStatusBulkRequest`. Schema-affecting qualifiers (`summary` /\n * `context` data-mode, `BULK`) ARE included; the multi-path `Via<…>`\n * disambiguator is STRIPPED because it never changes the body shape — so the\n * many URL variants of one operation share a single model.\n */\nfunction componentSchemaName(op: OperationProjection, role: 'Request' | 'Response'): string {\n const qualifierTail = op.operationKey.startsWith(op.baseOperationIdentifier)\n ? op.operationKey.slice(op.baseOperationIdentifier.length)\n : '';\n const schemaQualifiers = qualifierTail\n .split('_')\n .filter((q) => q.length > 0 && !q.startsWith('Via'))\n .map(pascal)\n .join('');\n return `${pascal(op.resourceIdentifier)}${pascal(op.baseOperationIdentifier)}${schemaQualifiers}${role}`;\n}\n\n/**\n * Per-section registry that hoists inline body schemas into `components/schemas`\n * and hands back `$ref`s. Schemas deduplicate only when BOTH their semantic\n * component identity and their structure match. Structurally identical request\n * bodies from different operations remain distinct components: an empty\n * `ApiKeysDeactivateRequest` must never resolve to an unrelated\n * `AccountErasureRequestsCreateRequest`, because component names are public\n * documentation identities and typed guide-link targets, not storage slots.\n *\n * The same semantic identity reached through multiple equivalent routes still\n * shares one component. A desired name already taken by a different schema gets\n * a numeric suffix (`2`, `3`, …). The injected Tier-2 field docs travel with the\n * schema, so the documented model lands in the component.\n */\ninterface SchemaRegistry {\n ref(schema: unknown, desiredName: string): unknown;\n schemas(): Record<string, unknown>;\n}\nfunction createSchemaRegistry(): SchemaRegistry {\n const nameBySemanticIdentityAndContent = new Map<string, string>();\n const contentByName = new Map<string, string>();\n const schemas: Record<string, unknown> = {};\n return {\n ref(schema, desiredName) {\n if (!isHoistableSchema(schema)) {\n return schema;\n }\n const canonical = stableStringify(schema);\n const semanticIdentityAndContent = `${desiredName}\\u0000${canonical}`;\n const existingName = nameBySemanticIdentityAndContent.get(semanticIdentityAndContent);\n if (existingName !== undefined) {\n return { $ref: `#/components/schemas/${existingName}` };\n }\n let name = desiredName;\n let suffix = 2;\n while (contentByName.has(name) && contentByName.get(name) !== canonical) {\n name = `${desiredName}${suffix}`;\n suffix += 1;\n }\n nameBySemanticIdentityAndContent.set(semanticIdentityAndContent, name);\n contentByName.set(name, canonical);\n schemas[name] = schema;\n return { $ref: `#/components/schemas/${name}` };\n },\n schemas() {\n return schemas;\n },\n };\n}\n\n/**\n * Replace an operation object's inline request/response BODY schemas with\n * `$ref`s into `components/schemas` (via `registry`). Walks only the\n * `application/json` body slots — `requestBody` and each `responses[*]` with\n * content; query `parameters` (GET/DELETE) and the rare `callbacks` block stay\n * inline. All success statuses share one response schema object, so they\n * resolve to the same `$ref`. Mutates `operationObject` in place.\n */\nfunction hoistOperationSchemas(\n operationObject: Record<string, unknown>,\n op: OperationProjection,\n registry: SchemaRegistry,\n): void {\n const requestBody = operationObject['requestBody'];\n if (isPlainObject(requestBody) && isPlainObject(requestBody['content'])) {\n const media = (requestBody['content'] as Record<string, unknown>)['application/json'];\n if (isPlainObject(media) && isHoistableSchema(media['schema'])) {\n media['schema'] = registry.ref(media['schema'], componentSchemaName(op, 'Request'));\n }\n }\n\n const responses = operationObject['responses'];\n if (isPlainObject(responses)) {\n for (const entry of Object.values(responses)) {\n if (!isPlainObject(entry) || !isPlainObject(entry['content'])) {\n continue;\n }\n const media = (entry['content'] as Record<string, unknown>)['application/json'];\n if (isPlainObject(media) && isHoistableSchema(media['schema'])) {\n media['schema'] = registry.ref(media['schema'], componentSchemaName(op, 'Response'));\n }\n }\n }\n}\n\n/**\n * Framework-universal API conventions, emitted as the trailing section of every\n * `info.description`. These describe behaviour that is TRUE OF EVERY Wildo API\n * (engine-generic application behavior, not Wildo author guidance or app\n * configuration), so the reusable generator authors them once here. Grounded\n * in the actual generated spec: the three security schemes (see\n * `SECURITY_SCHEMES`), the `{ data, pagination }` list envelope, the\n * `x-idempotent` extension, and standard HTTP error codes. Rate-limit response\n * headers are deliberately NOT claimed — they are not emitted in the spec.\n */\nconst API_CONVENTIONS_MARKDOWN = [\n '## API conventions',\n '',\n '### Authentication',\n '',\n 'Each operation lists the credentials it accepts under **Security**:',\n '',\n '- **Bearer token** — a JWT access token sent as `Authorization: Bearer <token>`.',\n '- **API key** — an organization- or application-scoped key (`sk_org_…` / `sk_app_…`) sent as the complete value of the `Authorization` header without a `Bearer` scheme.',\n '- **Anonymous session** — an anonymous-session token sent in `x-anonymous-session-token`, for pre-authentication operations.',\n '',\n 'Operations with no security requirement are public.',\n '',\n '### Base URL',\n '',\n 'Pick a base URL from the **Servers** dropdown and prepend it to each operation path (paths already include the `/api/v1` mount).',\n '',\n '### Pagination',\n '',\n 'List and search operations return `{ \"data\": [ … ], \"pagination\": { \"page\", \"limit\", \"total\", \"totalPages\" } }`. Use the `page` and `limit` query parameters to page through results, and `sort` (comma-separated `field:asc` / `field:desc` pairs, highest priority first) to order them. Each operation documents its per-page maximum and sortable fields on the parameters themselves.',\n '',\n '### Filtering',\n '',\n 'Search operations accept a free-text `q` query parameter and one query parameter per configured filter field (for example `?status=active`). Range filters (dates) are object-valued: pass them with `deepObject` bracket notation — `createdAt[startDate]=<ISO>&createdAt[endDate]=<ISO>`. Each operation documents its available filter fields on the parameters themselves.',\n '',\n '### Idempotency',\n '',\n 'Operations flagged **idempotent** (the `x-idempotent` extension) are safe to retry — repeating the request has the same effect as making it once.',\n '',\n '### Errors',\n '',\n 'Errors use standard HTTP status codes. Each operation documents the specific failures it can return (for example `400`, `403`, `404`, `409`) and the condition that triggers each.',\n].join('\\n');\n\n/**\n * Compose the OpenAPI `info.description` (the API reference landing page): the\n * app's authored `apiOverview` (when present) followed by the framework-universal\n * `API_CONVENTIONS_MARKDOWN`. The conventions are ALWAYS emitted, so the landing\n * page is never blank — the overview is pure enrichment on top.\n */\nfunction buildInfoDescription(input: OpenApiGenerationInput): string {\n const overview = input.apiOverview?.trim();\n return overview && overview.length > 0\n ? `${overview}\\n\\n${API_CONVENTIONS_MARKDOWN}`\n : API_CONVENTIONS_MARKDOWN;\n}\n\n/**\n * Produces the display label for an OpenAPI resource tag without changing the\n * stable tag identity used by generated clients and operation metadata.\n *\n * The identity remains the resource identifier (`organizationApiKeys`), while\n * the native Docusaurus reference can present a human-scannable resource\n * heading (`Organization Api Keys`). Applications can later supply richer\n * product terminology without making that editorial concern part of the wire\n * contract.\n */\nfunction buildResourceTagDisplayName(resourceIdentifier: string): string {\n return splitWords(resourceIdentifier)\n .map((word) => apiReferenceDisplayWord(word, true))\n .join(' ');\n}\n\n/**\n * Builds the full OpenAPI 3.1 document object for a single section.\n * Returns a plain JS object — the YAML emitter is a separate concern.\n *\n * `paths` are nested by template path; multiple HTTP verbs on the\n * same path are merged into a single path-item object as the OpenAPI\n * spec requires. Body schemas are hoisted into `components/schemas`\n * (content-deduped, `$ref`-linked) by a per-section `SchemaRegistry`.\n */\nfunction buildOpenApiDocument(\n section: OpenApiSection,\n operations: ReadonlyArray<OperationProjection>,\n input: OpenApiGenerationInput,\n): Record<string, unknown> {\n const sortedOps = sortOperationsForDeterministicOutput(operations);\n\n const titleBase = input.publicMarketingTitle ?? input.appDisplayName;\n // `organization` / `application` are internal scope partitions. The API\n // reference must name the consumer job instead: organization-scoped tenant\n // operations are the normal API, whereas application-scoped operations are\n // the privileged administration surface.\n const sectionLabel = section === OpenApiSection.API_REFERENCE\n ? 'API reference'\n : 'Application administration API reference';\n\n const paths: Record<string, Record<string, unknown>> = {};\n const ownershipByPathAndVerb = new Map<string, string>();\n const tagSet = new Set<string>();\n // operationId must be unique within the document. The verb-first builder is\n // unique by construction for almost every operation, but a few resources with\n // deeply self-nested URL families (e.g. `applications` via app-metadata /\n // app-versions) reduce to the same semantic `Via<…>` and would otherwise\n // collide. Disambiguate genuine collisions with a stable numeric suffix: the\n // first occurrence (in deterministic sort order) keeps the clean name, later\n // ones get `2`, `3`, … — applied here rather than in the projector because\n // uniqueness is a per-document (per-section) property.\n const operationIdUseCount = new Map<string, number>();\n const schemaRegistry = createSchemaRegistry();\n // The schema comes from the same model the backend error handler serializes.\n // Register before per-operation hoisting so every non-success response shares\n // the stable, named component instead of producing resource-local copies.\n const errorResponseSchema = schemaRegistry.ref(input.errorResponseSchema, 'ErrorResponse');\n for (const op of sortedOps) {\n if (paths[op.path] === undefined) {\n paths[op.path] = {};\n }\n const collisionKey = `${op.path}::${op.httpVerb}`;\n const existingOwner = ownershipByPathAndVerb.get(collisionKey);\n if (existingOwner !== undefined) {\n throw new Error(\n `OpenAPI generator: duplicate ${op.httpVerb.toUpperCase()} ${op.path} in `\n + `${section}. Existing operation ${existingOwner} collides with `\n + `${op.resourceIdentifier}.${op.operationKey}. Each OpenAPI path+verb pair must be unique.`,\n );\n }\n const baseOperationId = buildOperationId(op);\n const priorUses = operationIdUseCount.get(baseOperationId) ?? 0;\n operationIdUseCount.set(baseOperationId, priorUses + 1);\n const operationId = priorUses === 0 ? baseOperationId : `${baseOperationId}${priorUses + 1}`;\n const operationObject = buildOperationObject(op, operationId, errorResponseSchema);\n hoistOperationSchemas(operationObject, op, schemaRegistry);\n paths[op.path][op.httpVerb] = operationObject;\n ownershipByPathAndVerb.set(collisionKey, `${op.resourceIdentifier}.${op.operationKey}`);\n tagSet.add(op.resourceIdentifier);\n }\n\n // Tier-2: per-resource tag descriptions (resource business purpose). The\n // tag set is derived from the section's operations above; descriptions are\n // looked up by tag name from the input's resourceTags (order-independent).\n // Cleaned of implementation-only noise here (this is the surface the projector\n // does NOT route through `buildOperationDocFromSpec`), so the resource group\n // blurbs read identically to the per-operation prose. Tags whose description\n // cleans to empty are dropped (treated as having no description).\n const resourceTagsByName = new Map<string, ResourceTag>();\n for (const tag of input.resourceTags ?? []) {\n if (resourceTagsByName.has(tag.name)) {\n throw new Error(`OpenAPI generator: duplicate resource tag descriptor for '${tag.name}'.`);\n }\n resourceTagsByName.set(tag.name, tag);\n }\n\n return {\n openapi: '3.1.0',\n info: {\n title: `${titleBase} ${sectionLabel}`,\n description: buildInfoDescription(input),\n version: input.supportedApiVersion,\n },\n // `servers` only when the app enriched `apiServers` (deployment URLs are\n // app/environment knowledge — see WildoTechnicalDocConfig.apiServers).\n // Omitted → back-compatible with the pre-servers output.\n ...(input.servers && input.servers.length > 0 ? { servers: input.servers } : {}),\n tags: Array.from(tagSet)\n .sort((a, b) => a.localeCompare(b))\n .map((tagName) => {\n const descriptor = resourceTagsByName.get(tagName);\n const description = descriptor?.description === undefined\n ? undefined\n : stripImplementationNoise(descriptor.description);\n const resourceMetadata = {\n contractVersion: OPENAPI_RESOURCE_IDENTITY_CONTRACT_VERSION,\n resourceRef: `technical-documentation:resource/${tagName}`,\n ...(descriptor?.lifecycleRole === undefined ? {} : { lifecycleRole: stripImplementationNoise(descriptor.lifecycleRole) }),\n ...(descriptor?.relationships === undefined ? {} : { relationships: descriptor.relationships }),\n ...(descriptor?.category === undefined ? {} : { category: descriptor.category }),\n };\n const tag = {\n name: tagName,\n 'x-displayName': buildResourceTagDisplayName(tagName),\n 'x-wildo': resourceMetadata,\n };\n return description !== undefined && description.length > 0 ? { ...tag, description } : tag;\n }),\n paths,\n // `components.schemas` = hoisted, content-deduped request/response body\n // models (named `<Resource><Verb><Quals>Request|Response`); `securitySchemes`\n // = framework-universal auth, referenced by each op's `security`.\n components: {\n ...(Object.keys(schemaRegistry.schemas()).length > 0\n ? { schemas: schemaRegistry.schemas() }\n : {}),\n securitySchemes: SECURITY_SCHEMES,\n },\n };\n}\n\n/**\n * Counts the unique `resourceIdentifier` values among a set of\n * operations. Used to populate `OpenApiSectionOutput.resourceCount`.\n */\nfunction countDistinctResources(operations: ReadonlyArray<OperationProjection>): number {\n const resources = new Set<string>();\n for (const op of operations) {\n resources.add(op.resourceIdentifier);\n }\n return resources.size;\n}\n\n/**\n * Builds a single section's output entry. Returns `null` when the\n * section is empty so the caller can omit it from `sections[]` per\n * K-2.\n */\nfunction buildSectionOutput(\n section: OpenApiSection,\n operations: ReadonlyArray<OperationProjection>,\n input: OpenApiGenerationInput,\n): OpenApiSectionOutput | null {\n if (operations.length === 0) {\n return null;\n }\n const document = buildOpenApiDocument(section, operations, input);\n return {\n section,\n operationCount: operations.length,\n resourceCount: countDistinctResources(operations),\n document,\n };\n}\n\n/**\n * Refuses a generator change that drops, duplicates or rewrites a resolved HTTP\n * operation between the source projection and the final OpenAPI documents.\n *\n * This is intentionally performed against the emitted `x-wildo` identity,\n * rather than operationId or path iteration order. Those are presentation and\n * OpenAPI container details respectively; the source tuple is the contract.\n */\nfunction assertGeneratedOperationConservation(\n operations: ReadonlyArray<OperationProjection>,\n sections: ReadonlyArray<OpenApiSectionOutput>,\n): void {\n const identityKey = (identity: Record<string, unknown>): string => JSON.stringify([\n identity['contractVersion'],\n identity['resourceRef'],\n identity['operationFamilyRef'],\n identity['operationVariantRef'],\n identity['variantType'],\n identity['httpVerb'],\n identity['path'],\n identity['section'],\n ]);\n const expected = new Set<string>();\n for (const operation of operations) {\n const key = identityKey({ ...operation.identity, section: operation.consumerApiSection });\n if (expected.has(key)) throw new Error(`OpenAPI generator: duplicate source operation identity ${key}`);\n expected.add(key);\n }\n\n const actual = new Set<string>();\n for (const section of sections) {\n const paths = section.document['paths'];\n if (!isPlainObject(paths)) throw new Error(`OpenAPI generator: ${section.section} document has no paths object`);\n for (const pathItem of Object.values(paths)) {\n if (!isPlainObject(pathItem)) continue;\n for (const operationObject of Object.values(pathItem)) {\n if (!isPlainObject(operationObject)) continue;\n const metadata = operationObject['x-wildo'];\n if (metadata === undefined) continue;\n if (!isPlainObject(metadata)) throw new Error('OpenAPI generator: x-wildo operation metadata must be an object');\n const key = identityKey(metadata);\n if (actual.has(key)) throw new Error(`OpenAPI generator: duplicate emitted operation identity ${key}`);\n actual.add(key);\n }\n }\n }\n if (actual.size !== expected.size || [...expected].some((key) => !actual.has(key))) {\n throw new Error('OpenAPI generator: resolved HTTP operation conservation failed between source projection and OpenAPI output');\n }\n}\n\n/**\n * Public entry point — single function the companion controller\n * calls.\n *\n * Steps:\n * 1. Parse the input (defense-in-depth — the controller validates\n * against `OpenApiGenerationInputSchema` already, but we re-parse\n * here so direct callers can't bypass validation).\n * 2. Assert URL-bearing variants without treating authentication-mode flags\n * as eligibility filters.\n * 3. Group by the explicit source-resolved consumer section.\n * 4. Build one semantic OpenAPI document per non-empty section.\n * 5. Drop empty sections (K-2).\n *\n * @param rawInput The unparsed input — typically the deserialised\n * wire payload from the introspection subprocess hop.\n * @returns The `OpenApiGenerationOutput` ready to be returned by the\n * companion controller.\n */\nexport function generateOpenApiDocuments(rawInput: unknown): OpenApiGenerationOutput {\n const input = OpenApiGenerationInputSchema.parse(rawInput);\n\n const apiOps = filterApiCallOperations(input.operations);\n const split = groupOperationsByConsumerApiSection(apiOps);\n\n const sectionOrder: ReadonlyArray<OpenApiSection> = [\n OpenApiSection.API_REFERENCE,\n OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE,\n ];\n\n const sections: OpenApiSectionOutput[] = [];\n for (const section of sectionOrder) {\n const sectionOutput = buildSectionOutput(section, split[section], input);\n if (sectionOutput !== null) {\n sections.push(sectionOutput);\n }\n }\n\n assertGeneratedOperationConservation(apiOps, sections);\n\n return {\n generatedAt: new Date().toISOString(),\n sections,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"openapi-generator.js","sourceRoot":"","sources":["../../../src/companion/openapi-generator.ts"],"names":[],"mappings":"AAAA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AAC,aAAa;QAC5B,cAAc,CAAC,wCAAwC;KACxD,CAAC;IAEF,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QACzE,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,oCAAoC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEvD,OAAO;QACL,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @wildo-package @wildo-ai/saas-technical-doc/companion (generator)\n *\n * Pure-function OpenAPI 3.1 generator (saas-technical-doc.md Step 3).\n *\n * Pipeline:\n *\n * `OpenApiGenerationInput`\n * ──filterApiCallOperations──► (assert URL-bearing variants)\n * ──groupOperationsByConsumerApiSection──► (use source-resolved section)\n * ──buildOpenApiDocument──► (per-section OpenAPI 3.1 doc as a JS object)\n * ──assembleOpenApiGenerationOutput──►(top-level `OpenApiGenerationOutput`)\n *\n * Key design points:\n *\n * K-1: This module is `OpenApiGenerationInput` → `OpenApiGenerationOutput`\n * and contains no I/O, no global state, and no DI. It is consumed by\n * the companion controller (which owns the introspection hop +\n * filesystem write — see Step 4) and by unit tests in isolation.\n *\n * K-2: Sections that contain ZERO operations after filtering are\n * OMITTED from the output's `sections[]` array (per the\n * `OpenApiGenerationOutputSchema` JSDoc). The companion UI\n * surfaces this as an absent section — the empty section is\n * intentional, not a generator bug.\n *\n * K-3: The generator uses Zod-parsed input (validated up-front via\n * `OpenApiGenerationInputSchema`) so every downstream helper can\n * assume well-formed projections. Callers MUST call\n * `generateOpenApiDocuments(input)` (which parses) and NOT the\n * sub-helpers directly with unparsed data.\n *\n * K-4: The semantic output carries one document object. YAML/JSON\n * serialization is renderer-owned so divergent format payloads cannot\n * cross this contract.\n *\n * @wildo-boundary\n * Imports only the portable OpenAPI output contract, the local operation\n * projection contract, the lightweight public runtime constants and\n * specification-prose cleanup. No serializer, React or saas-models root\n * barrel enters this semantic generator.\n */\n\nimport { WildoHeaderKeys } from '@wildo-ai/saas-models/public-runtime';\nimport {\n COLLECTION_QUERY_PARAMETERS,\n ERROR_DEFINITIONS,\n ErrorHandling_Strategy,\n ErrorSeverity,\n ErrorType,\n M2M_WEBHOOK_DELIVERY_CONTRACT,\n Resources_PaginationRequestSchema,\n} from '@wildo-ai/saas-models';\n\nimport {\n OpenApiSection,\n type OpenApiGenerationOutput,\n type OpenApiSectionOutput,\n} from '../openapi/openapi-generation-output.schemas';\n\nimport {\n OpenApiGenerationInputSchema,\n OPENAPI_RESOURCE_IDENTITY_CONTRACT_VERSION,\n OperationProjectionAuthenticationMode,\n OperationProjectionVariantType,\n type ResourceTag,\n type OpenApiGenerationInput,\n type OperationProjection,\n} from './operation-projection.schemas';\n\nimport { stripImplementationNoise } from './spec-to-operation-doc';\n\n/**\n * Retains every projected URL-bearing operation.\n *\n * - Variant outside `API_CALL` / `API_CALL_WITH_CALLBACK` (K-5):\n * defense-in-depth re-check on top of the projector's filter.\n * If a non-API variant ever leaks through, drop it silently here\n * rather than throwing — the projector is the single source of\n * truth for \"should this op even be in the projection at all,\" but\n * we don't want a future projector regression to corrupt the\n * generated doc with non-HTTP operations.\n *\n * `isApiKeyAccessDisabled` controls the operation's accepted authentication\n * schemes. It does not make an HTTP operation disappear from its API contract.\n *\n * Returns a NEW array — does not mutate the input.\n */\nexport function filterApiCallOperations(\n operations: ReadonlyArray<OperationProjection>,\n): ReadonlyArray<OperationProjection> {\n return operations.filter((op) => {\n if (\n op.variantType !== OperationProjectionVariantType.API_CALL &&\n op.variantType !== OperationProjectionVariantType.API_CALL_WITH_CALLBACK\n ) {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Groups operations by the explicit consumer-facing section resolved by the\n * source projector. This layer deliberately does not reinterpret role strings\n * or internal resource scopes: doing so would create a second authority for\n * which product reference owns an operation.\n *\n * Returns a frozen `Record` keyed by `OpenApiSection`. Sections with\n * zero operations are returned as empty arrays (NOT omitted) so the\n * caller's filtering logic in `assembleOpenApiGenerationOutput` is the\n * single place that decides \"drop empty sections from the output.\"\n */\nexport function groupOperationsByConsumerApiSection(\n operations: ReadonlyArray<OperationProjection>,\n): Readonly<Record<OpenApiSection, ReadonlyArray<OperationProjection>>> {\n const apiReferenceOperations: OperationProjection[] = [];\n const applicationAdministrationOperations: OperationProjection[] = [];\n for (const op of operations) {\n switch (op.consumerApiSection) {\n case OpenApiSection.API_REFERENCE:\n apiReferenceOperations.push(op);\n break;\n case OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE:\n applicationAdministrationOperations.push(op);\n break;\n default: {\n const exhaustiveSection: never = op.consumerApiSection;\n throw new Error(`OpenAPI generator: unsupported consumer API section ${String(exhaustiveSection)}`);\n }\n }\n }\n return Object.freeze({\n [OpenApiSection.API_REFERENCE]: Object.freeze(apiReferenceOperations),\n [OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE]: Object.freeze(applicationAdministrationOperations),\n });\n}\n\n/**\n * Stable, deterministic ordering for operations within an OpenAPI\n * doc. Sorted by `(resourceIdentifier, path, httpVerb)` so the\n * generated YAML diffs cleanly across runs even if the projector\n * yields operations in a different order (e.g. iteration order\n * depending on the resource registry walk).\n */\nfunction sortOperationsForDeterministicOutput(\n operations: ReadonlyArray<OperationProjection>,\n): ReadonlyArray<OperationProjection> {\n return [...operations].sort((a, b) => {\n if (a.resourceIdentifier !== b.resourceIdentifier) {\n return a.resourceIdentifier.localeCompare(b.resourceIdentifier);\n }\n if (a.path !== b.path) {\n return a.path.localeCompare(b.path);\n }\n return a.httpVerb.localeCompare(b.httpVerb);\n });\n}\n\n/**\n * Maps an `OperationProjection` to its developer-facing OpenAPI `operationId`.\n *\n * VERB-FIRST camelCase — the convention the best public API references and the\n * OpenAPI/SDK-generator ecosystem converge on (`createUser`, `listOrganizations`,\n * `rotateApiKey`; see Speakeasy + Redocly operationId guidance). The\n * `operationId` becomes the generated client method name; combined with the\n * resource TAG, tag-grouping generators yield `sdk.organizations.create()` and\n * flat generators yield `createOrganization()`.\n *\n * Composition: `<verb><ResourceNoun><Qualifiers>`, lower-camelCased.\n *\n * - **verb** — the standard CRUD identifiers (the LOWERCASE\n * `CoreResourceOperation` values the projector actually emits) map to\n * idiomatic verbs (`create→create`, `read→get`, `list→list`,\n * `update→update`, `delete→delete`, `search→search` — see {@link CRUD_VERBS});\n * any other identifier becomes its own verb phrase via `pascal`, whether a\n * custom op (`exportAuditLogs`→`exportAuditLogs`, `EXPORT_AUDIT_LOGS`→\n * `exportAuditLogs`) or a framework collection op the map omits\n * (`count`→`count`, `create_many`→`createMany`).\n * - **ResourceNoun** — `resourceIdentifier` PascalCased with camelCase word\n * boundaries PRESERVED (`organizationApiKeys`→`OrganizationApiKeys`); the\n * prior implementation lowercased segment interiors and produced\n * `Organizationapikeys`.\n * - **Redundancy** — a custom verb phrase that already contains the resource\n * noun drops the repeat (`exportAuditLogs`, not `exportAuditLogsAuditLogs`).\n * - **Qualifiers** — the `operationKey` segments AFTER the base identifier:\n * the semantic `Via<Relationship>` disambiguator for relationship-nested\n * paths, the `summary`/`context` data-mode, and `BULK`. Each is PascalCased\n * and appended in order.\n *\n * Unique within the document and stable across runs (the multi-path\n * disambiguator is the relationship name, not a positional index).\n */\n/**\n * Split a string on separators AND camelCase boundaries (lowercase/digit →\n * uppercase) so multi-word camelCase identifiers keep their word boundaries.\n */\nfunction splitWords(input: string): string[] {\n return input.split(/[^a-zA-Z0-9]+|(?<=[a-z0-9])(?=[A-Z])/u).filter((segment) => segment.length > 0);\n}\n\n/**\n * Industry-standard initialisms whose casing carries meaning in public API\n * vocabulary. This is presentation-only: stable resource and operation\n * identities remain unchanged in tags, operation ids and `x-wildo` metadata.\n */\nconst API_REFERENCE_DISPLAY_INITIALISM_BY_TOKEN: Readonly<Record<string, string>> = Object.freeze({\n a2a: 'A2A',\n api: 'API',\n dlq: 'DLQ',\n idp: 'IdP',\n ip: 'IP',\n jwt: 'JWT',\n m2m: 'M2M',\n mcp: 'MCP',\n oauth: 'OAuth',\n oidc: 'OIDC',\n pdf: 'PDF',\n saml: 'SAML',\n scim: 'SCIM',\n siem: 'SIEM',\n sso: 'SSO',\n url: 'URL',\n});\n\nfunction apiReferenceDisplayWord(word: string, capitalizeOrdinaryWord: boolean): string {\n const initialism = API_REFERENCE_DISPLAY_INITIALISM_BY_TOKEN[word.toLowerCase()];\n if (initialism !== undefined) return initialism;\n const lowercaseWord = word.toLowerCase();\n return capitalizeOrdinaryWord\n ? `${lowercaseWord.charAt(0).toUpperCase()}${lowercaseWord.slice(1)}`\n : lowercaseWord;\n}\n\n/**\n * PascalCase a string. Lowercases the interior ONLY for all-uppercase words\n * (SCREAMING_SNAKE op identifiers like `EXPORT`, `EXCHANGE` → `Export`,\n * `Exchange`); camelCase words (`Api`, `organization`) keep their interior so\n * word boundaries survive (`organizationApiKeys` → `OrganizationApiKeys`).\n * Shared by `buildOperationId` and the `components/schemas` namer\n * (`componentSchemaName`) so operation ids and model names stay consistent.\n */\nfunction pascal(input: string): string {\n return splitWords(input)\n .map((word) => {\n const rest = /^[A-Z0-9]+$/u.test(word) ? word.slice(1).toLowerCase() : word.slice(1);\n return word.charAt(0).toUpperCase() + rest;\n })\n .join('');\n}\n\n/**\n * Idiomatic verb-first `operationId` verbs for the standard CRUD identifiers.\n *\n * Keyed on the LOWERCASE `@wildo-ai/saas-models` `CoreResourceOperation` VALUES\n * (`'read'`, `'create'`, `'list'`, …) — NOT the SCREAMING_SNAKE enum MEMBER names.\n * The projector sets `baseOperationIdentifier` to\n * `String(operation.operationIdentifier)`, which for a core operation IS the\n * lowercase enum value, so the lookup key MUST be lowercase.\n *\n * (History: this map was originally keyed on `'READ'` / `'CREATE'` / … — the\n * enum member names — so no lookup ever matched at runtime and every base fell\n * through to the custom-verb `pascal` path. It went unnoticed because\n * `pascal(value)` lower-cased equals the intended verb for `create` / `list` /\n * `update` / `delete` / `search` — the whole map was a no-op EXCEPT `read`,\n * which produced `readX` instead of the intended `getX`.)\n *\n * Mirrored as string literals for the same boundary reason as the other\n * framework constants in this file — the generator must NOT import\n * `@wildo-ai/saas-models` (see the module `@wildo-boundary` note). Keep in sync\n * with `CoreResourceOperation`.\n *\n * `read → get` is the sole non-identity mapping; the other five are listed for\n * self-documentation and drift-resistance (they equal `pascal(value)`). Every\n * OTHER identifier — custom ops AND the framework's own `count` / `create_many` /\n * `update_many` / `delete_many` — becomes its own verb phrase via `pascal`\n * (`create_many → createMany…`, `export_audit_logs → exportAuditLogs…`).\n */\nconst CRUD_VERBS: Record<string, string> = {\n create: 'create',\n read: 'get',\n list: 'list',\n update: 'update',\n delete: 'delete',\n search: 'search',\n};\n\n/**\n * Human, sentence-case verb labels for the default operation TITLE (`summary`).\n *\n * Keyed on the same lowercase `CoreResourceOperation` values as {@link CRUD_VERBS}\n * (see that constant for the boundary + casing rationale). NB the TITLE verb for\n * a read is the plain `'Read'` (e.g. \"Read application auth policy\"), distinct\n * from the `operationId` verb `get` — the two surfaces intentionally diverge.\n * Identifiers absent here fall through to a humanised phrase of the identifier\n * itself in `buildDefaultSummary`.\n */\nconst VERB_LABEL: Record<string, string> = {\n create: 'Create',\n read: 'Read',\n list: 'List',\n update: 'Update',\n delete: 'Delete',\n search: 'Search',\n};\n\nfunction buildOperationId(op: OperationProjection): string {\n const base = op.baseOperationIdentifier;\n const isCustom = CRUD_VERBS[base] === undefined;\n const verbPascal = isCustom ? pascal(base) : pascal(CRUD_VERBS[base]!);\n const resourcePascal = pascal(op.resourceIdentifier);\n\n // A custom verb phrase that already names the resource (e.g. EXPORT_AUDIT_LOGS\n // on `auditLogs`) drops the repeated noun.\n const corePascal = isCustom && verbPascal.includes(resourcePascal)\n ? verbPascal\n : `${verbPascal}${resourcePascal}`;\n\n // Qualifiers = `operationKey` with the leading base identifier removed (the\n // base can itself contain `_`, so we strip by length, not by splitting).\n const qualifierTail = op.operationKey.startsWith(base)\n ? op.operationKey.slice(base.length)\n : '';\n const qualifiersPascal = qualifierTail.split('_').filter(Boolean).map(pascal).join('');\n\n const combined = `${corePascal}${qualifiersPascal}`;\n return combined.charAt(0).toLowerCase() + combined.slice(1);\n}\n\n/**\n * Default summary fallback. Used when the projector did not provide\n * an explicit `summary` so the docs site never renders a blank title.\n */\n/**\n * The operation TITLE (OpenAPI `summary` — page title, nav label, breadcrumb).\n *\n * A SHORT, human, derived action label — NOT the authored `purpose` prose\n * (that is impl-aware intent text and now lives in the `description`; see\n * `buildOperationDocFromSpec`). Mirrors the verb-first `operationId` but rendered\n * as a readable sentence-case phrase:\n *\n * read + applicationAuthPolicy → \"Read application auth policy\"\n * list + organizationApiKeys (summary variant) → \"List organization api keys (summary)\"\n * create + appAnnouncements via posted-by-users → \"Create app announcements via posted by users\"\n * export_audit_logs + auditLogs → \"Export audit logs\"\n *\n * The qualifier suffixes (`Via<…>`, `summary`/`context` data-mode, `BULK`) are\n * humanised so the multiple endpoints of one resource read distinctly in the\n * sidebar instead of colliding on the same title.\n */\nfunction buildDefaultSummary(op: OperationProjection): string {\n const words = (input: string): string[] =>\n input.split(/[^a-zA-Z0-9]+|(?<=[a-z0-9])(?=[A-Z])/u).filter((segment) => segment.length > 0);\n const sentence = (input: string): string => words(input).map((word) => apiReferenceDisplayWord(word, false)).join(' ');\n\n const base = op.baseOperationIdentifier;\n const verbPhrase = VERB_LABEL[base] ?? sentence(base);\n const resourcePhrase = sentence(op.resourceIdentifier);\n const actionWords = words(verbPhrase).map((word) => word.toLowerCase());\n const resourceWords = words(resourcePhrase).map((word) => word.toLowerCase());\n const actionAlreadyNamesResource = resourceWords.length > 0\n && actionWords.length >= resourceWords.length\n && resourceWords.every((word, index) => actionWords.at(index - resourceWords.length) === word);\n let title = actionAlreadyNamesResource\n ? `${verbPhrase.charAt(0).toUpperCase()}${verbPhrase.slice(1)}`\n : `${verbPhrase.charAt(0).toUpperCase()}${verbPhrase.slice(1)} ${resourcePhrase}`.trim();\n\n const qualifierTail = op.operationKey.startsWith(base) ? op.operationKey.slice(base.length) : '';\n for (const qualifier of qualifierTail.split('_').filter(Boolean)) {\n if (qualifier.startsWith('Via')) {\n title += ` via ${sentence(qualifier.slice(3))}`;\n } else if (qualifier === 'BULK') {\n title += ' (bulk)';\n } else if (qualifier.toLowerCase() === 'summary' || qualifier.toLowerCase() === 'context') {\n title += ` (${qualifier.toLowerCase()})`;\n } else {\n title += ` ${sentence(qualifier)}`;\n }\n }\n return title;\n}\n\n/**\n * Extracts `{paramName}` placeholders from an OpenAPI-style template\n * path. Used to derive `parameters[]: in: path` entries automatically\n * — the projector does not need to redeclare them.\n *\n * Returns an empty array for paths with no placeholders.\n */\nfunction extractPathParameters(path: string): ReadonlyArray<string> {\n const matches = path.matchAll(/\\{([^}]+)\\}/gu);\n return Array.from(matches, (match) => match[1]);\n}\n\n/**\n * What a path placeholder identifies, read off the path rather than guessed from its name.\n *\n * Measured on Wonder CRM: 0 of 911 path parameters carried a description while query parameters\n * were 85% covered and headers 100% — so a reader looking at `/organizations/{organizationId}/deal/\n * {dealId}` was told what every filter meant and nothing about the two values they must supply.\n *\n * The segment BEFORE a placeholder names the collection it addresses, which is the fact that makes\n * this derivable rather than invented. The last placeholder addresses the operation's own resource;\n * the earlier ones are the scope it lives in, and saying so is what tells a caller which id goes\n * where. The collection name is quoted verbatim, never humanized: it is the identifier the API\n * itself uses, so a reader can match it against the path, the tag and the payload.\n */\nfunction describePathParameter(path: string, parameterName: string, resourceIdentifier: string): string {\n const segments = path.split('/').filter((segment) => segment.length > 0);\n const placeholderIndex = segments.indexOf(`{${parameterName}}`);\n const owningCollection = placeholderIndex > 0 ? segments[placeholderIndex - 1] : undefined;\n if (owningCollection === undefined || owningCollection.startsWith('{')) {\n return `Identifier supplied in the request path as \\`${parameterName}\\`.`;\n }\n return owningCollection === resourceIdentifier\n ? `Identifier of the \\`${owningCollection}\\` this operation addresses.`\n : `Identifier of the \\`${owningCollection}\\` the addressed record belongs to.`;\n}\n\n/**\n * Splits an operation's qualifier tail into the two kinds that look alike and mean opposite things.\n *\n * `Via<Parent>` qualifiers are ROUTING: the same operation reached through a different parent, so\n * `GET /organizations/{organizationId}/organization-members/{id}` and\n * `GET /users/{userId}/organization-members/{id}` are one operation at two addresses. Every other\n * qualifier — `summary`, `context`, `BULK` — is a genuinely different operation with a different\n * response.\n *\n * Conflating them is what makes the reference look four times its real size. Measured on Wonder\n * CRM: 546 operations at 439 paths, of which 486 are another path's operation repeated —\n * `organizationMembers` publishes its whole surface three times.\n */\nfunction splitOperationQualifiers(op: OperationProjection): { readonly via: readonly string[]; readonly shape: readonly string[] } {\n const tail = op.operationKey.startsWith(op.baseOperationIdentifier)\n ? op.operationKey.slice(op.baseOperationIdentifier.length)\n : '';\n const segments = tail.split('_').filter(Boolean);\n return {\n via: segments.filter((segment) => segment.startsWith('Via')),\n shape: segments.filter((segment) => !segment.startsWith('Via')),\n };\n}\n\n/** The identity an alias shares with the one canonical route of the same operation. */\nfunction canonicalRouteKey(op: OperationProjection): string {\n const { shape } = splitOperationQualifiers(op);\n return [op.resourceIdentifier, op.baseOperationIdentifier, shape.join('_'), op.httpVerb].join('\\u0000');\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isQueryParameterVerb(httpVerb: OperationProjection['httpVerb']): boolean {\n return (\n httpVerb === 'get'\n || httpVerb === 'delete'\n );\n}\n\n/**\n * Converts a top-level object JSON Schema fragment into OpenAPI query\n * parameters for query-style verbs (GET / DELETE). Request examples are carried\n * onto the individual OpenAPI Parameter Objects: these methods have no JSON\n * body, so dropping an authored example here would make a valid source example\n * invisible to both an OpenAPI viewer and the Wildo renderer.\n *\n * Why fail-loud on non-object schemas:\n *\n * The projection explicitly allows `requestBodySchema` to represent\n * query input for GET / DELETE operations. If a projector bug emits a\n * scalar / array / malformed schema here, silently reusing it as an\n * OpenAPI `requestBody` would recreate the exact mis-documentation bug\n * this helper exists to close. Throwing keeps the spec honest and pins\n * the regression to the generator boundary.\n */\nfunction buildQueryParametersFromRequestSchema(op: OperationProjection): ReadonlyArray<Record<string, unknown>> {\n const schema = op.requestBodySchema;\n if (schema === null) {\n return [];\n }\n if (!isPlainObject(schema) || schema.type !== 'object') {\n throw new Error(\n `OpenAPI generator: ${op.httpVerb.toUpperCase()} ${op.path} for `\n + `${op.resourceIdentifier}.${op.operationKey} carries a non-object request schema. `\n + `GET/DELETE request schemas must be object-shaped so the generator can emit query parameters.`,\n );\n }\n\n const properties = schema.properties;\n if (properties === undefined) {\n return [];\n }\n if (!isPlainObject(properties)) {\n throw new Error(\n `OpenAPI generator: ${op.httpVerb.toUpperCase()} ${op.path} for `\n + `${op.resourceIdentifier}.${op.operationKey} has an object request schema with malformed `\n + '`properties`. Expected a plain object so query parameters can be emitted deterministically.',\n );\n }\n\n const requiredFields = Array.isArray(schema.required)\n ? new Set(schema.required.filter((value): value is string => typeof value === 'string'))\n : new Set<string>();\n\n // Collection-axis dedupe: on a paginated collection operation (`op.pagination`\n // present) the framework-generated SEARCH request DTO carries NESTED\n // `pagination` / `sorting` / `filters` object properties. The canonical wire\n // shape is FLAT (what the frontend HTTP client sends, what the backend\n // controller reads first — the nested forms are fallbacks): the `page` /\n // `limit` / `sort` trio, a free-text `q`, and one parameter per filter field\n // (scalars flat, date ranges as `deepObject`). Exploding the `filters` object\n // verbatim would emit a nested object with no `style: deepObject` metadata, so\n // SDK generators would serialise it wrong. Drop the nested axes here — the flat\n // trio is emitted by `buildPaginationQueryParameters`, and the flat `q` +\n // per-field filters by `buildCollectionFilterQueryParameters`, both on the same\n // operation. The flat trio names are excluded too so a DTO can never collide with\n // them. Ops WITHOUT the pagination contract keep every DTO property untouched.\n const paginationAxisProperties = op.pagination !== undefined\n ? new Set(['pagination', 'sorting', 'filters', COLLECTION_QUERY_PARAMETERS.page, COLLECTION_QUERY_PARAMETERS.limit, COLLECTION_QUERY_PARAMETERS.sort])\n : new Set<string>();\n\n return Object.entries(properties)\n .filter(([name]) => !paginationAxisProperties.has(name))\n .map(([name, propertySchema]) => {\n const parameter: Record<string, unknown> = {\n name,\n in: 'query',\n required: requiredFields.has(name),\n schema: isPlainObject(propertySchema) ? propertySchema : {},\n };\n if (isPlainObject(propertySchema) && typeof propertySchema.description === 'string') {\n parameter['description'] = propertySchema.description;\n }\n const examples = buildParameterExamples(op, name);\n if (examples !== undefined) {\n parameter['examples'] = examples;\n }\n return parameter;\n });\n}\n\n/**\n * Projects source-authored request values onto one OpenAPI parameter. Path and\n * query parameters share the same Parameter Object example contract; retaining\n * the source title lets a consumer correlate a concrete id/filter with the\n * business case it was authored for. Response-only examples never participate.\n */\nfunction buildParameterExamples(op: OperationProjection, parameterName: string): Record<string, unknown> | undefined {\n const examples: Record<string, unknown> = {};\n for (const example of op.examples ?? []) {\n if (!isPlainObject(example.request) || !Object.prototype.hasOwnProperty.call(example.request, parameterName)) {\n continue;\n }\n examples[example.title] = { value: example.request[parameterName] };\n }\n return Object.keys(examples).length > 0 ? examples : undefined;\n}\n\n/**\n * Adds matching source-authored values to a generated Parameter Object. This\n * is shared by path parameters, direct DTO-property query parameters and the\n * framework-generated flat collection axes (`q`, filters, pagination).\n */\nfunction attachParameterExamples(\n op: OperationProjection,\n parameter: Record<string, unknown>,\n): Record<string, unknown> {\n const name = parameter['name'];\n if (typeof name !== 'string') {\n return parameter;\n }\n const examples = buildParameterExamples(op, name);\n return examples === undefined ? parameter : { ...parameter, examples };\n}\n\n/**\n * Flattens a paginated collection operation's nested `filters` request-DTO object\n * into the FLAT, wire-truthful query parameters the framework actually accepts —\n * the filtering counterpart of the `page` / `limit` / `sort` pagination-trio\n * reshape (`buildPaginationQueryParameters`).\n *\n * The framework's SEARCH request DTO (`createResourceSearchQueryRequestSchema`)\n * always carries a top-level `filters` OBJECT: the free-text `searchRequest`, the\n * `createdAt` / `updatedAt` date-range filters, plus one property per authored\n * filter field. That nested object is NOT the wire shape — the frontend HTTP\n * client sends each filter FLAT (`?status=…`) and free-text as `?q=…`, and the\n * backend controller (`extractCollectionFilters` + `normalizeCollectionQueryRequestData`)\n * reads the flat forms first. This helper re-surfaces the FLAT-serialisable\n * `filters` properties as their own query parameters:\n *\n * - `searchRequest` → the canonical flat `q` string (what the frontend sends and\n * the backend reads before `searchQuery` before the nested `filters.searchRequest`).\n * - any SCALAR property (string / number / boolean / enum) → a plain flat query\n * parameter (`?status=active`), carrying the property's schema (and description).\n * - an OBJECT-valued property (a date range `{ startDate?, endDate? }`) →\n * `style: deepObject, explode: true`, so SDK generators serialise it as\n * `field[startDate]=…&field[endDate]=…` (bracket notation). The backend runs\n * Express 5's default `simple` query parser (which leaves bracketed keys flat),\n * so the controller reconstructs the nested object from those keys —\n * `reconstructBracketedRangeFilters` in the collection-query controller,\n * declaration-gated to actual range fields. Emitting the `deepObject` metadata\n * is the second half of the fix the pagination reshape called out: a nested\n * object in a GET query string needs `style: deepObject`, which the naive DTO\n * explosion never emitted. (A global `extended` query parser was deliberately\n * NOT used — it changes `req.query` shape for every controller and breaks the\n * flat-scalar `req.query.X as string` assumption across auth / SCIM / chart.)\n * - a filter field whose name is ALSO a path parameter of this endpoint → SKIPPED\n * (URL-supplied; see the per-operation note below).\n *\n * Gated on `op.pagination !== undefined` (collection ops only — the same signal\n * the collection-axis dedupe uses), a query verb, and a `filters` object property,\n * so a non-collection GET carrying an unrelated `filters` property keeps its naive\n * explosion untouched. All filter parameters are OPTIONAL. Returns `[]` when the\n * op is not a paginated collection op or declares no `filters` object.\n */\nfunction buildCollectionFilterQueryParameters(op: OperationProjection): ReadonlyArray<Record<string, unknown>> {\n if (op.pagination === undefined || !isQueryParameterVerb(op.httpVerb)) {\n return [];\n }\n const schema = op.requestBodySchema;\n if (!isPlainObject(schema) || !isPlainObject(schema.properties)) {\n return [];\n }\n const filtersSchema = (schema.properties as Record<string, unknown>)['filters'];\n if (!isPlainObject(filtersSchema) || !isPlainObject(filtersSchema.properties)) {\n return [];\n }\n const filterProperties = filtersSchema.properties as Record<string, unknown>;\n\n // A filter field that is ALSO a path parameter of THIS endpoint (a parent-scope\n // FK reached via a nested path, e.g. `todoId` on `/…/todos/{todoId}/tasks`) is\n // already supplied by the URL. Emitting it AGAIN as a query parameter is\n // redundant, produces two same-named parameters SDK generators mishandle, and —\n // because the backend merges `{ ...req.params, ...req.query }` — would let the\n // query value silently override the path scope (a tenant-scope footgun). Skip\n // it: the path parameter is authoritative. The skip is PER-OPERATION (keyed on\n // this path's params), so the same filter field is still emitted on a sibling\n // path that does NOT bind the FK, where filtering by it is meaningful.\n const pathParameterNames = new Set(extractPathParameters(op.path));\n\n const parameters: Array<Record<string, unknown>> = [];\n\n // Free-text search → the canonical flat `q` (the frontend sends `?q=`, and the\n // backend reads `q` first). The `filters.searchRequest` DTO property is the\n // nested fallback name, so it is surfaced under the wire name, not verbatim.\n if ('searchRequest' in filterProperties) {\n parameters.push(attachParameterExamples(op, {\n name: COLLECTION_QUERY_PARAMETERS.search,\n in: 'query',\n required: false,\n schema: { type: 'string' },\n description:\n 'Free-text search query, matched against the operation\\'s configured searchable '\n + 'fields. Sent flat as `?q=…` (the wire form the backend reads first).',\n }));\n }\n\n for (const [name, propertySchema] of Object.entries(filterProperties)) {\n if (name === 'searchRequest' || pathParameterNames.has(name)) {\n continue; // `searchRequest` surfaced as `q` above; path-param FKs are URL-supplied\n }\n const isObjectValued = isPlainObject(propertySchema)\n && (propertySchema.type === 'object' || 'properties' in propertySchema);\n const parameter: Record<string, unknown> = { name, in: 'query', required: false };\n // Object-valued filters (date ranges) are irreducibly nested; emit deepObject\n // so SDKs serialise `name[<field>]=…`. The backend's collection-query controller\n // reconstructs the nested object from those bracketed keys (the global query\n // parser stays `simple`); see `reconstructBracketedRangeFilters`.\n if (isObjectValued) {\n parameter['style'] = 'deepObject';\n parameter['explode'] = true;\n }\n parameter['schema'] = isPlainObject(propertySchema) ? propertySchema : {};\n if (isPlainObject(propertySchema) && typeof propertySchema.description === 'string') {\n parameter['description'] = propertySchema.description;\n } else if (isObjectValued) {\n // No authored description on the range object — synthesise a truthful hint\n // that names the deepObject bracket form for each sub-field it carries.\n const subKeys = isPlainObject(propertySchema) && isPlainObject(propertySchema.properties)\n ? Object.keys(propertySchema.properties as Record<string, unknown>)\n : [];\n const bracketHint = subKeys.length > 0\n ? subKeys.map((subKey) => `\\`${name}[${subKey}]=…\\``).join(' & ')\n : `\\`${name}[<field>]=…\\``;\n parameter['description'] =\n `Object-valued filter — serialise each sub-field with deepObject bracket notation (${bracketHint}).`;\n }\n parameters.push(attachParameterExamples(op, parameter));\n }\n\n return parameters;\n}\n\n/**\n * Framework-universal pagination defaults, mirrored from the backend\n * repository adapters (`_doList` in both the MongoDB and PostgreSQL resource\n * repositories, `@wildo-ai/saas-backend-lib`): an omitted `page` reads as\n * page 1, an omitted `limit` reads as 20 items per page. Duplicated as\n * literals for the same boundary reason as the enums above (the generator\n * must not import `@wildo-ai/saas-backend-lib`); keep in sync with the\n * repository defaults.\n */\n// Defaults are read off the shared pagination request schema, never restated.\nconst PAGINATION_DEFAULT_PAGE: number = Resources_PaginationRequestSchema.shape.page.parse(undefined);\nconst PAGINATION_DEFAULT_LIMIT: number = Resources_PaginationRequestSchema.shape.limit.parse(undefined);\n\n/**\n * Emits the flat `page` / `limit` / `sort` query parameters for a paginated\n * collection operation (`op.pagination` present — LIST / SEARCH-like; see the\n * projection schema JSDoc). These parameters are FRAMEWORK knowledge: the\n * backend accepts them on every HTTP LIST/SEARCH dispatch but no request DTO\n * declares them, so without this emission the spec documents paginated\n * endpoints with no way to page them (and the `info.description` conventions\n * block would promise parameters the operations never declare).\n *\n * Shapes follow the runtime contract exactly:\n *\n * - `page` — 1-based positive integer, server default 1.\n * - `limit` — positive integer, server default 20, capped at the\n * per-operation `maxLimit` the projector resolved.\n * - `sort` — comma-separated `field:asc` / `field:desc` pairs, highest\n * priority first. With a non-empty `sortableFields` allow-list the backend\n * silently ignores unrecognised fields and defaults to the first allowed\n * field descending; with no allow-list any field applies and the default\n * is `createdAt:desc`. The description states whichever branch is true\n * for this operation, so the docs never promise sorting the backend\n * would drop.\n */\nfunction buildPaginationQueryParameters(op: OperationProjection): ReadonlyArray<Record<string, unknown>> {\n const pagination = op.pagination;\n if (pagination === undefined) {\n return [];\n }\n const sortableFields = pagination.sortableFields;\n const sortDescription = sortableFields.length > 0\n ? 'Sort order: comma-separated `field:asc` / `field:desc` pairs, highest priority first '\n + `(e.g. \\`${sortableFields[0]}:desc\\`). Sortable fields: `\n + `${sortableFields.map((field) => `\\`${field}\\``).join(', ')}. `\n + `Unrecognised fields are ignored. Defaults to \\`${sortableFields[0]}:desc\\`.`\n : 'Sort order: comma-separated `field:asc` / `field:desc` pairs, highest priority first '\n + '(e.g. `createdAt:desc`). Defaults to `createdAt:desc` (newest first).';\n return [\n {\n name: COLLECTION_QUERY_PARAMETERS.page,\n in: 'query',\n required: false,\n schema: { type: 'integer', minimum: 1, default: PAGINATION_DEFAULT_PAGE },\n description: '1-based page number of the collection slice.',\n },\n {\n name: COLLECTION_QUERY_PARAMETERS.limit,\n in: 'query',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: pagination.maxLimit, default: PAGINATION_DEFAULT_LIMIT },\n description: `Maximum number of items per page (up to ${pagination.maxLimit}).`,\n },\n {\n name: COLLECTION_QUERY_PARAMETERS.sort,\n in: 'query',\n required: false,\n schema: { type: 'string' },\n description: sortDescription,\n },\n ].map((parameter) => attachParameterExamples(op, parameter));\n}\n\n/**\n * HTTP header carrying a complete API key. Read from the lightweight public\n * runtime entrypoint so the generator shares the backend's canonical header\n * vocabulary without importing the saas-models root barrel.\n */\nconst API_KEY_AUTHORIZATION_HEADER_NAME = WildoHeaderKeys.AUTHORIZATION;\n\n/** HTTP header carrying an anonymous-session token. */\nconst ANONYMOUS_SESSION_HEADER_NAME = WildoHeaderKeys.ANONYMOUS_SESSION_TOKEN;\n\n/**\n * Framework-universal OpenAPI `components.securitySchemes`. Every Wildo API\n * authenticates the same ways, so the generator emits these UNCONDITIONALLY —\n * framework knowledge, not app config. Per-operation `security` references them\n * by name (see `buildOperationSecurity`).\n *\n * - `bearerAuth` — JWT access token in `Authorization: Bearer <jwt>`.\n * - `apiKeyAuth` — org-/app-scoped API key (`sk_org_…` / `sk_app_…`) in `Authorization` without a bearer scheme.\n * - `anonymousSessionAuth` — anonymous-session token in `x-anonymous-session-token`\n * (the pre-authentication surface; `APP_ANONYMOUS` operations).\n */\nconst SECURITY_SCHEMES: Record<string, Record<string, unknown>> = {\n bearerAuth: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description:\n 'JWT access token issued by the authentication service. Send as `Authorization: Bearer <token>`.',\n },\n apiKeyAuth: {\n type: 'apiKey',\n in: 'header',\n name: API_KEY_AUTHORIZATION_HEADER_NAME,\n description:\n 'Organization- or application-scoped API key (`sk_org_…` / `sk_app_…`), sent as the complete value of the `Authorization` header without a `Bearer` scheme.',\n },\n anonymousSessionAuth: {\n type: 'apiKey',\n in: 'header',\n name: ANONYMOUS_SESSION_HEADER_NAME,\n description:\n 'Anonymous-session token for pre-authentication (anonymous user) access, sent in the `x-anonymous-session-token` header.',\n },\n};\n\n/**\n * Per-operation OpenAPI `security`, derived ENTIRELY from the source-resolved\n * access document (NOT `primaryScope`, which is the scope/audience axis).\n *\n * - `roles` contains `APP_PUBLIC` → `[]` — explicitly PUBLIC (OpenAPI reads an\n * empty `security` array as \"no authentication required\"). Public access\n * wins over any other listed role, so the docs/\"Try it\" don't demand a token\n * for sign-up, public reads, etc.\n * - otherwise the requirements are OR-ed (any one satisfies the request):\n * • `anonymousSessionAuth` when `roles` contains `APP_ANONYMOUS`.\n * • `bearerAuth` (+ `apiKeyAuth`, unless `isApiKeyAccessDisabled`) when the\n * op has ANY non-`APP_ANONYMOUS` role, OR no role at all (an open endpoint\n * for any authenticated user — \"app users can list users\").\n *\n * So `[APP_ANONYMOUS]` → anonymous-session only; `[APP_ANONYMOUS, APP_USER]` →\n * anonymous-session OR bearer/api-key; `[APP_USER]` / `[]` / `[ORG_OWNER]` →\n * bearer/api-key. `isApiKeyAccessDisabled` removes only the API-key alternative;\n * the HTTP operation remains documented.\n */\nfunction buildOperationSecurity(op: OperationProjection): Array<Record<string, string[]>> {\n if (op.access.authenticationMode === OperationProjectionAuthenticationMode.PUBLIC) return [];\n const requirements: Array<Record<string, string[]>> = [];\n if (\n op.access.authenticationMode === OperationProjectionAuthenticationMode.ANONYMOUS_SESSION\n || op.access.authenticationMode === OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED\n ) {\n requirements.push({ anonymousSessionAuth: [] });\n }\n if (\n op.access.authenticationMode === OperationProjectionAuthenticationMode.AUTHENTICATED\n || op.access.authenticationMode === OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED\n ) {\n requirements.push({ bearerAuth: [] });\n if (!op.isApiKeyAccessDisabled) {\n requirements.push({ apiKeyAuth: [] });\n }\n }\n return requirements;\n}\n\n/**\n * Builds the OpenAPI 3.1 `paths.<path>.<method>` entry for a single\n * operation. Returns a plain JS object suitable for direct YAML\n * serialisation — no YAML primitives leak past the YAML emitter call.\n */\nfunction buildOperationObject(\n op: OperationProjection,\n operationId: string,\n errorResponseSchema: unknown,\n): Record<string, unknown> {\n const operationObject: Record<string, unknown> = {\n operationId,\n summary: op.summary ?? buildDefaultSummary(op),\n tags: [op.resourceIdentifier],\n // Strict framework metadata for consumers that need to join a rendered\n // operation back to its resolved source identity. Standard OpenAPI fields\n // stay standard; this carries only Wildo-specific semantics.\n 'x-wildo': {\n ...op.identity,\n section: op.consumerApiSection,\n roles: [...op.roles],\n access: op.access,\n },\n };\n if (op.description !== undefined) {\n operationObject['description'] = op.description;\n }\n\n // Auth (Tier-1 framework knowledge). The source projector resolves access\n // semantics once; this generator only transports that fact into standard\n // OpenAPI `security` and the companion `x-wildo` extension.\n /*\n * Say that this call notifies, where the reader is standing.\n *\n * A developer looking at `changeStatus` needs to know it does more than change a record: every\n * endpoint configured on that channel receives a delivery. The mechanics — retries, signature,\n * how to verify — are the webhook contract's and are described once at the document's `webhooks`\n * block, not restated on each of the operations that fire one.\n */\n const notifications = op.m2mNotifications ?? [];\n if (notifications.length > 0) {\n const channels = [...new Set(notifications.map((notification) => notification.channel))].sort();\n const note = `A successful call also delivers an outbound webhook on ${channels.length === 1 ? 'the ' : ''}`\n + `${channels.map((channel) => `\\`${channel}\\``).join(' and ')} channel${channels.length === 1 ? '' : 's'}`\n + ', to every endpoint an organization has configured and enabled there. See this document\\'s `webhooks` for the delivery contract.';\n const existing = typeof operationObject['description'] === 'string' ? operationObject['description'] : '';\n operationObject['description'] = existing.length > 0 ? `${existing}\\n\\n${note}` : note;\n const wildo = operationObject['x-wildo'];\n if (isPlainObject(wildo)) wildo['m2mNotifications'] = notifications.map((notification) => ({ ...notification }));\n }\n\n const security = buildOperationSecurity(op);\n operationObject['security'] = security;\n if (op.access.authenticationMode !== OperationProjectionAuthenticationMode.PUBLIC && op.access.roleRequirements.length > 0) {\n operationObject['x-required-roles'] = op.access.roleRequirements.map((requirement) => requirement.role);\n }\n\n const parameters: Array<Record<string, unknown>> = [];\n const pathParams = extractPathParameters(op.path);\n if (pathParams.length > 0) {\n parameters.push(...pathParams.map((paramName) => attachParameterExamples(op, {\n name: paramName,\n in: 'path',\n required: true,\n schema: { type: 'string' },\n description: describePathParameter(op.path, paramName, op.resourceIdentifier),\n })));\n }\n\n if (op.stepUpAuthentication !== undefined) {\n parameters.push({\n name: op.stepUpAuthentication.headerName,\n in: 'header',\n required: true,\n schema: { type: 'string' },\n description:\n `Single-use re-authentication token obtained from POST ${op.stepUpAuthentication.tokenEndpointPath}. `\n + 'Required for this sensitive operation and consumed when the request is authorized.',\n });\n }\n\n if (op.acceptsIfMatch) {\n parameters.push({\n name: WildoHeaderKeys.IF_MATCH,\n in: 'header',\n required: false,\n schema: {\n type: 'string',\n pattern: '^(?:[0-9]+|\"[0-9]+\"|W/\"[0-9]+\")$',\n },\n examples: {\n 'Current resource version': { value: '7' },\n },\n description:\n 'Optional optimistic-locking version from `_version` in the latest resource response. '\n + 'Send it as a bare integer (`7`), quoted entity tag (`\"7\"`) or weak entity tag (`W/\"7\"`). '\n + 'When supplied, the mutation is applied only if that version is still current.',\n });\n }\n\n if (isQueryParameterVerb(op.httpVerb)) {\n parameters.push(...buildQueryParametersFromRequestSchema(op));\n // Paginated collection ops carry a nested `filters` bag in their request DTO;\n // it was dropped from the naive explosion above and is re-surfaced here as the\n // flat `q` + one parameter per filter field (scalars flat, date ranges as\n // deepObject — the backend controller reconstructs the nested range object).\n parameters.push(...buildCollectionFilterQueryParameters(op));\n } else if (op.requestBodySchema !== null) {\n const requestJsonMedia: Record<string, unknown> = { schema: op.requestBodySchema };\n const requestExamples = buildRequestExamples(op);\n if (requestExamples !== undefined) {\n requestJsonMedia['examples'] = requestExamples;\n }\n operationObject['requestBody'] = {\n required: true,\n content: {\n 'application/json': requestJsonMedia,\n },\n };\n }\n // Paginated collection ops (LIST / SEARCH-like) accept the framework's flat\n // `page` / `limit` / `sort` query parameters regardless of what their request\n // DTO declares. Appended LAST so operation-specific parameters (`q`, filter\n // fields) read first and the boilerplate trio sits together at the end.\n parameters.push(...buildPaginationQueryParameters(op));\n if (parameters.length > 0) {\n operationObject['parameters'] = parameters;\n }\n\n // Inject engine metadata (`_version` / `_field_meta`) that the response\n // serializer reattaches onto every materialized resource document but which no\n // resource schema declares. Computed once and shared by the `responses` object\n // and the async callback payload (both describe the same operation result) so\n // structurally identical schemas still content-dedup into one component when\n // hoisted.\n const augmentedResponseBodySchema = augmentResponseSchemaWithEngineMetadata(op.responseBodySchema);\n\n operationObject['responses'] = buildResponsesObject(op, augmentedResponseBodySchema, errorResponseSchema);\n\n if (op.variantType === OperationProjectionVariantType.API_CALL_WITH_CALLBACK) {\n // The Zod superRefine on OperationProjectionSchema guarantees\n // callbackPath is defined here — but the runtime check below is\n // defense-in-depth in case a future caller bypasses Zod parsing\n // and feeds the helper a raw projection (which the public API\n // forbids but the helper itself remains pure-function).\n if (op.callbackPath !== undefined) {\n operationObject['callbacks'] = {\n completion: {\n [`{$request.body#/callbackUrl}${op.callbackPath}`]: {\n post: {\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: augmentedResponseBodySchema ?? {},\n },\n },\n },\n responses: {\n '204': { description: 'Callback acknowledged' },\n },\n },\n },\n },\n };\n }\n }\n\n if (op.idempotent !== undefined) {\n operationObject['x-idempotent'] = op.idempotent;\n }\n if (op.rateLimitNote !== undefined) {\n const rateLimitLine = `**Rate limiting:** ${op.rateLimitNote}`;\n operationObject['description'] = typeof operationObject['description'] === 'string'\n ? `${operationObject['description']}\\n\\n${rateLimitLine}`\n : rateLimitLine;\n }\n\n return operationObject;\n}\n\n/**\n * Client-facing engine-metadata properties that the response serializer\n * REATTACHES onto every materialized resource document AFTER the response DTO\n * parse strips them (`operation-response-serializer.backend.utils` +\n * `services-registry-handler.transformOutput`, both in `@wildo-ai/saas-backend-lib`).\n * They are engine metadata, NOT declared fields of any resource schema — so\n * `operation.responseDto` (and thus the projected `responseBodySchema`) omits\n * them and the generated OpenAPI would under-document the real wire response.\n * We emit them as OPTIONAL, non-required properties so the spec matches what\n * clients actually receive; well-behaved clients already ignore unknown\n * `_`-prefixed fields, this just makes the contract explicit.\n *\n * - `_version` — optimistic-locking counter (a non-negative integer; the\n * stored `_version_db_doc` surfaced to clients, starts at 1 and increments on\n * every write, but can read as `0`). The frontend echoes it back as the\n * `If-Match` request header on inline updates to detect concurrent edits.\n * - `_field_meta` — per-field CRDT causality map used for conflict-free merges\n * of concurrent edits. Opaque to API clients; safe to ignore.\n *\n * Cloned per-injection (spread) so no two schemas share a mutable node.\n */\nconst ENGINE_METADATA_PROPERTY_SCHEMAS: Readonly<Record<string, Record<string, unknown>>> = {\n _version: {\n type: 'integer',\n description:\n 'Engine metadata (not a resource field): optimistic-locking version counter. '\n + 'Echo it back as the `If-Match` request header on updates to guard against concurrent edits.',\n },\n _field_meta: {\n type: 'object',\n additionalProperties: true,\n description:\n 'Engine metadata (not a resource field): per-field CRDT causality map used for '\n + 'conflict-free merges of concurrent edits. Opaque to clients — safe to ignore.',\n },\n};\n\n/**\n * Descriptions for the properties EVERY resource carries and NO resource authors.\n *\n * `_version` and `_field_meta` above are injected by the generator, so they were described where\n * they are created. These are different: they are real fields on the document, present on every\n * resource, and therefore owned by no single resource specification — which is exactly why they\n * were the most undescribed properties in the whole reference. Measured on Wonder CRM:\n *\n * data 123 · pagination 123 · retentionStatus 104 · impersonalizedAt 104 · _id 90 ·\n * createdAt 65 · updatedAt 64 · organizationId 48\n *\n * — 721 of the 1,091 undescribed top-level properties, from eight names that mean the same thing\n * everywhere. Asking every resource to describe them would be hundreds of copies of one sentence.\n *\n * An AUTHORED description always wins: this fills a gap, it never overrides a specification. That\n * matters for names an application could legitimately reuse — a resource of its own with a field\n * called `data` describes it, and this map stays out of the way.\n */\nconst FRAMEWORK_OWNED_PROPERTY_DESCRIPTIONS: Readonly<Record<string, string>> = Object.freeze({\n _id: 'The record’s identifier. Stable for the life of the record and the value every path parameter and reference uses.',\n createdAt: 'When the record was created, set by the application and never accepted from a client.',\n updatedAt: 'When the record last changed, set by the application on every write.',\n organizationId: 'The organization this record belongs to. It scopes every read and write: a caller only ever addresses records in an organization they are a member of.',\n // retention-authority: N/A — an API consumer's ENGLISH description of what the two values mean,\n // rendered into the OpenAPI document. There is no emitter to consume here: the audience is a\n // person reading a schema, and the sentence has to say `active` and `retained` in words for the\n // document to be worth anything. It decides nothing and is read by no code.\n retentionStatus: 'Whether the record is still `active` or has been `retained` — kept for a legal or accounting obligation after the person it concerned was erased. A retained record has had its personal detail removed.',\n impersonalizedAt: 'When personal detail was stripped from this record, if it ever was. Absent on a record that has not been through erasure.',\n data: 'The page of records this response carries.',\n pagination: 'Where this page sits in the full result set — the page number, the page size, and the totals needed to ask for the next one.',\n});\n\n/**\n * The structural signature of a MATERIALIZED resource document in a response\n * schema is the `_id` property. The serializer attaches `_version` /\n * `_field_meta` to exactly those objects (repository documents carry the stored\n * `_version_db_doc`, surfaced as `_version`); envelopes (`{ count }`, delete /\n * purge acks), computed-state projections (feature entitlements, lifecycle\n * state), and `context`-mode wrappers have no `_id` and carry no engine\n * metadata. Gating on `_id` keeps the spec truthful in BOTH directions — no\n * under-documentation of real documents, no over-documentation of envelopes.\n * Mutates `objectSchema.properties` in place (the caller owns a fresh clone).\n */\nfunction injectEngineMetadataIntoResourceDocumentSchema(objectSchema: Record<string, unknown>): void {\n const properties = objectSchema['properties'];\n if (!isPlainObject(properties) || !('_id' in properties)) {\n return;\n }\n for (const [name, schema] of Object.entries(ENGINE_METADATA_PROPERTY_SCHEMAS)) {\n // Never clobber an authored field of the same name (defensive — no resource\n // declares `_version` / `_field_meta`, but the guard keeps injection\n // idempotent). NOT added to `required`: engine metadata is optional.\n if (!(name in properties)) {\n properties[name] = { ...schema };\n }\n }\n}\n\n/**\n * Walk the composite wrappers (`oneOf` / `anyOf` / `allOf`) a polymorphic /\n * discriminated-union response produces (`z.toJSONSchema` emits `oneOf` for a\n * `ZodDiscriminatedUnion`) down to the concrete object branches, injecting\n * engine metadata into each branch that is a resource document. A non-composite\n * object is injected directly.\n */\nfunction injectEngineMetadataIntoEntitySchemas(schema: unknown): void {\n if (!isPlainObject(schema)) {\n return;\n }\n let isComposite = false;\n for (const compositeKey of ['oneOf', 'anyOf', 'allOf'] as const) {\n const branches = schema[compositeKey];\n if (Array.isArray(branches)) {\n isComposite = true;\n for (const branch of branches) {\n injectEngineMetadataIntoEntitySchemas(branch);\n }\n }\n }\n if (!isComposite) {\n injectEngineMetadataIntoResourceDocumentSchema(schema);\n }\n}\n\n/**\n * Return a CLONE of an operation's response body schema with the engine-metadata\n * properties injected at the SAME structural positions the response serializer\n * attaches them (`operation-response-serializer.backend.utils`):\n *\n * 1. paginated `{ data: [ … ], pagination }` → each `data[]` item\n * 2. flat array `[ … ]` → each item\n * 3. single object → the object itself\n *\n * (each unwrapped through `oneOf`/`anyOf`/`allOf` for polymorphic resources).\n * The original schema is NEVER mutated — the callback path and any structurally\n * identical schema on another operation must stay pristine so content-dedup\n * (`stableStringify`) still collapses them onto one component. Non-object\n * schemas (`null` / scalar) pass through unchanged.\n */\n/**\n * Fills a description on the properties every resource carries and none authors.\n *\n * Recursive, because these appear at every depth: `data` and `pagination` wrap the envelope,\n * `_id` and `createdAt` sit on the document inside it, and a `context`-mode response nests another\n * collection again. Never overrides an authored description — a specification that describes its\n * own field wins, which is what keeps this safe for a name an application might reuse.\n */\nfunction fillFrameworkOwnedPropertyDescriptions(node: unknown): void {\n if (Array.isArray(node)) {\n for (const entry of node) fillFrameworkOwnedPropertyDescriptions(entry);\n return;\n }\n if (!isPlainObject(node)) return;\n const properties = node['properties'];\n if (isPlainObject(properties)) {\n for (const [name, property] of Object.entries(properties)) {\n if (!isPlainObject(property)) continue;\n const framework = FRAMEWORK_OWNED_PROPERTY_DESCRIPTIONS[name];\n if (framework !== undefined && property['description'] === undefined) {\n property['description'] = framework;\n }\n fillFrameworkOwnedPropertyDescriptions(property);\n }\n }\n for (const key of ['items', 'allOf', 'oneOf', 'anyOf', 'additionalProperties']) {\n if (key in node) fillFrameworkOwnedPropertyDescriptions(node[key]);\n }\n}\n\nfunction augmentResponseSchemaWithEngineMetadata(responseBodySchema: unknown): unknown {\n if (!isPlainObject(responseBodySchema)) {\n return responseBodySchema;\n }\n const clone = structuredClone(responseBodySchema) as Record<string, unknown>;\n // Safe to mutate: `clone` is this function's own deep copy, and the caller's schema is the\n // operation projection's — a generator that edited it would be editing the data it was handed.\n fillFrameworkOwnedPropertyDescriptions(clone);\n const properties = clone['properties'];\n const dataSchema = isPlainObject(properties) ? properties['data'] : undefined;\n if (isPlainObject(dataSchema) && (dataSchema['type'] === 'array' || 'items' in dataSchema)) {\n // Paginated `{ data: [ … ] }` wrapper — mirror the serializer's `body.data[i]`\n // attach position. (A `context`-mode wrapper's `data[]` item is itself a\n // `{ data: [ … ] }` sub-collection with no `_id`, so it is correctly skipped.)\n injectEngineMetadataIntoEntitySchemas(dataSchema['items']);\n } else if (clone['type'] === 'array' || 'items' in clone) {\n injectEngineMetadataIntoEntitySchemas(clone['items']);\n } else {\n injectEngineMetadataIntoEntitySchemas(clone);\n }\n return clone;\n}\n\n/**\n * Builds the OpenAPI `responses` object for an operation: authored success\n * statuses + error scenarios (Tier 3), plus the framework-wide authentication\n * failure derived from the source-resolved access mode. It falls back to the\n * default single `200`/`204` when no success status is authored. Response\n * `examples` are attached to the status they declare via `forStatus`. Multiple\n * error scenarios on the same code merge their `when` prose into one entry's\n * description.\n *\n * `responseBodySchema` is the operation's response body schema ALREADY augmented\n * with engine metadata (see `augmentResponseSchemaWithEngineMetadata`); the\n * caller computes it once so the `responses` object and the async callback\n * payload share the same node.\n */\nfunction buildResponsesObject(\n op: OperationProjection,\n responseBodySchema: unknown,\n errorResponseSchema: unknown,\n): Record<string, unknown> {\n const responseExamplesByStatus = new Map<string, Record<string, unknown>>();\n for (const example of op.examples ?? []) {\n if (example.response === undefined || example.forStatus === undefined) {\n continue;\n }\n const bucket = responseExamplesByStatus.get(example.forStatus) ?? {};\n bucket[example.title] = { value: example.response };\n responseExamplesByStatus.set(example.forStatus, bucket);\n }\n\n const buildSuccessContent = (code: string): Record<string, unknown> | undefined => {\n if (responseBodySchema === null || code === '204') {\n return undefined;\n }\n const jsonMedia: Record<string, unknown> = { schema: responseBodySchema };\n const examples = responseExamplesByStatus.get(code);\n if (examples !== undefined) {\n jsonMedia['examples'] = examples;\n }\n return { 'application/json': jsonMedia };\n };\n\n const responses: Record<string, unknown> = {};\n const successStatuses = op.responseStatuses ?? [];\n if (successStatuses.length > 0) {\n for (const status of successStatuses) {\n const entry: Record<string, unknown> = { description: status.meaning };\n const content = buildSuccessContent(status.code);\n if (content !== undefined) {\n entry['content'] = content;\n }\n responses[status.code] = entry;\n }\n } else if (responseBodySchema !== null) {\n const entry: Record<string, unknown> = { description: 'Success' };\n const content = buildSuccessContent('200');\n if (content !== undefined) {\n entry['content'] = content;\n }\n responses['200'] = entry;\n } else {\n responses['204'] = { description: 'No Content' };\n }\n\n for (const error of op.errorScenarios ?? []) {\n const description = error.errorCode !== undefined\n ? `${error.when} (error code: \\`${error.errorCode}\\`)`\n : error.when;\n const errorJsonMedia: Record<string, unknown> = { schema: errorResponseSchema };\n const examples = responseExamplesByStatus.get(error.code);\n if (examples !== undefined) {\n errorJsonMedia['examples'] = examples;\n }\n const errorContent = { 'application/json': errorJsonMedia };\n const existing = responses[error.code];\n if (isPlainObject(existing) && typeof existing['description'] === 'string') {\n existing['description'] = `${existing['description']}\\n\\n${description}`;\n existing['content'] = errorContent;\n } else {\n responses[error.code] = {\n description,\n content: errorContent,\n };\n }\n }\n\n if (op.acceptsIfMatch) {\n const mergeFrameworkError = (code: string, description: string): void => {\n const existing = responses[code];\n if (isPlainObject(existing) && typeof existing['description'] === 'string') {\n existing['description'] = `${existing['description']}\\n\\n${description}`;\n existing['content'] = { 'application/json': { schema: errorResponseSchema } };\n return;\n }\n responses[code] = {\n description,\n content: { 'application/json': { schema: errorResponseSchema } },\n };\n };\n mergeFrameworkError(\n '400',\n 'The optional `If-Match` header is present but does not contain a non-negative integer resource version.',\n );\n mergeFrameworkError(\n '409',\n 'The `If-Match` version no longer matches the current resource version, so the mutation was not applied.',\n );\n }\n\n // Every framework RATE_LIMIT error with a retry delay is serialized by\n // `ErrorHandlerBackendService` with an HTTP `Retry-After` header. A source-\n // authored 429 is therefore sufficient to project this protocol contract;\n // individual resource specifications must not duplicate framework header\n // vocabulary. The current runtime emits integer delay-seconds, not an HTTP\n // date, so the Header Object deliberately exposes that narrower shape.\n const rateLimitResponse = responses['429'];\n if (isPlainObject(rateLimitResponse)) {\n rateLimitResponse['headers'] = {\n 'Retry-After': {\n description: 'Delay in seconds before the client should retry the request.',\n schema: { type: 'integer', minimum: 0 },\n },\n };\n }\n\n // Authentication happens before the resource operation. The projection's\n // access mode is the sole truth for which credentials may satisfy it, so the\n // renderer and each resource specification do not need to re-state the same\n // 401 contract. A resource-owned 401 is more specific (for example a\n // step-up flow) and deliberately takes precedence.\n if (op.access.authenticationMode !== OperationProjectionAuthenticationMode.PUBLIC && responses['401'] === undefined) {\n // Referenced, not inlined: the wording is the generator's and identical for every operation\n // with the same access mode, so `unauthorizedDescription` states it once and the component\n // carries it. Repeating the content block on 546 operations said nothing a reader could use.\n responses['401'] = { $ref: `#/components/responses/${unauthorizedResponseName(op.access.authenticationMode)}` };\n }\n\n /*\n * Every operation can fail inside the application, and not one said so. Added last and only when\n * absent, so an authored 500 — which can say something specific about THIS operation — wins.\n */\n if (responses['500'] === undefined) {\n responses['500'] = { $ref: `#/components/responses/${INTERNAL_ERROR_RESPONSE_NAME}` };\n }\n\n return responses;\n}\n\n/**\n * The error responses the GENERATOR owns, named once in `components.responses`.\n *\n * Only the ones whose wording is the generator's own are shared. An authored response carries a\n * description written for that one operation — \"No release record exists for the supplied id in the\n * caller's scope\" — and that sentence is the most useful prose in the document; folding it into a\n * shared component would replace it with something generic, so authored responses stay inline.\n *\n * The 401 wording is derived from the operation's ACCESS MODE, which is why there are three: the\n * credential a caller is missing differs, and saying \"no valid bearer token\" to an anonymous-session\n * endpoint would be wrong.\n */\nconst GENERATOR_OWNED_ERROR_RESPONSE_NAMES: Readonly<Record<OperationProjectionAuthenticationMode, string>> = Object.freeze({\n [OperationProjectionAuthenticationMode.ANONYMOUS_SESSION]: 'UnauthorizedAnonymousSession',\n [OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED]: 'UnauthorizedAnonymousOrAuthenticated',\n [OperationProjectionAuthenticationMode.AUTHENTICATED]: 'Unauthorized',\n [OperationProjectionAuthenticationMode.PUBLIC]: 'Unauthorized',\n});\n\nconst INTERNAL_ERROR_RESPONSE_NAME = 'InternalServerError';\n\nfunction unauthorizedResponseName(mode: OperationProjectionAuthenticationMode): string {\n return GENERATOR_OWNED_ERROR_RESPONSE_NAMES[mode];\n}\n\n/** The one place each 401 wording is written; the components below are built from it. */\nfunction unauthorizedDescription(mode: OperationProjectionAuthenticationMode): string {\n switch (mode) {\n case OperationProjectionAuthenticationMode.ANONYMOUS_SESSION:\n return 'The anonymous-session token is missing, malformed, expired, or invalid.';\n case OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED:\n return 'No valid anonymous-session token, bearer token, or API key was supplied.';\n case OperationProjectionAuthenticationMode.AUTHENTICATED:\n case OperationProjectionAuthenticationMode.PUBLIC:\n return 'No valid bearer token or API key was supplied.';\n default: {\n const exhaustiveAuthenticationMode: never = mode;\n throw new Error(`OpenAPI generator: unsupported authentication mode ${String(exhaustiveAuthenticationMode)}`);\n }\n }\n}\n\n/**\n * The `components.responses` block, built from the same wording the operations reference.\n *\n * Emitted only for the names an operation actually used, so a document never carries a component\n * nothing points at — the reason `PUBLIC` shares the authenticated name rather than earning an\n * entry of its own: a public operation never gets a synthesised 401.\n */\nfunction buildErrorResponseComponents(usedNames: ReadonlySet<string>, errorResponseSchema: unknown): Record<string, unknown> {\n const content = { 'application/json': { schema: errorResponseSchema } };\n const all: Record<string, unknown> = { [INTERNAL_ERROR_RESPONSE_NAME]: { description: internalServerErrorDescription(), content } };\n for (const mode of [\n OperationProjectionAuthenticationMode.ANONYMOUS_SESSION,\n OperationProjectionAuthenticationMode.ANONYMOUS_OR_AUTHENTICATED,\n OperationProjectionAuthenticationMode.AUTHENTICATED,\n ]) {\n all[unauthorizedResponseName(mode)] = { description: unauthorizedDescription(mode), content };\n }\n return Object.fromEntries(Object.entries(all).filter(([name]) => usedNames.has(name)));\n}\n\n/**\n * Every operation can fail with the framework's error envelope, and until now not one of the 546\n * published operations said so — measured on Wonder CRM, `500` appeared zero times.\n *\n * Synthesised rather than authored, for the same reason the 401 is: it is true of every operation\n * by construction, so making each specification restate it would be 546 copies of one fact with 546\n * chances to drift. An authored 500 takes precedence, exactly as an authored 401 does.\n */\nfunction internalServerErrorDescription(): string {\n return 'The request failed inside the application. The body is the standard error envelope and carries a `correlationId` to quote when reporting it; the request was not necessarily rejected, so do not assume it had no effect until you have checked.';\n}\n\n/**\n * The document's `webhooks` block — what a RECEIVER is sent, described where OpenAPI 3.1 puts it.\n *\n * Until now the reference described only what a client CALLS. An integrator writing the other half\n * — the endpoint this application posts to — had no machine-readable contract at all, and every\n * operation that fires a delivery said nothing about it.\n *\n * Two facts make these entries honest rather than plausible:\n *\n * · THE BODY IS THE RESOURCE DOCUMENT ITSELF, not an envelope around it. The delivery worker\n * posts the stored payload verbatim, and a backend test exists specifically to fail if anyone\n * wraps it — because the body's bytes must hash to the signature's `bodyHash` claim. So the\n * schema referenced here is the resource's own read response, and when that component cannot\n * be resolved the entry carries prose instead of a shape it cannot prove.\n * · THE DELIVERY CONTRACT IS ONE OBJECT. Retries, timeout, signature algorithm and claim names\n * come from `M2M_WEBHOOK_DELIVERY_CONTRACT`, the same source the delivery worker derives its\n * tunables from, so the published contract cannot drift from what is actually sent.\n */\nfunction buildWebhooksObject(\n operations: readonly OperationProjection[],\n canonicalReadResponseRefByResource: ReadonlyMap<string, string>,\n): Record<string, unknown> {\n const webhooks: Record<string, unknown> = {};\n for (const op of operations) {\n for (const notification of op.m2mNotifications ?? []) {\n const key = `${op.resourceIdentifier}.${op.baseOperationIdentifier}`;\n if (webhooks[key] !== undefined) continue;\n const bodyRef = canonicalReadResponseRefByResource.get(op.resourceIdentifier);\n const contract = M2M_WEBHOOK_DELIVERY_CONTRACT;\n webhooks[key] = {\n post: {\n summary: `${op.resourceIdentifier} ${op.baseOperationIdentifier}`,\n description: [\n `Sent to every endpoint configured and enabled on the \\`${notification.channel}\\` channel when \\`${op.resourceIdentifier}.${op.baseOperationIdentifier}\\` succeeds.`,\n '',\n `The body is the record itself, exactly as the API returns it — there is no envelope around it, and the bytes you receive are the bytes the signature was computed over.`,\n '',\n `Verify before trusting it: the \\`${contract.signatureHeader}\\` header carries a ${contract.signatureAlgorithm} JWT whose \\`${contract.signatureClaims.bodyHash}\\` claim is the ${contract.bodyHashAlgorithm} digest of the raw body. Its \\`${contract.signatureClaims.deliveryId}\\` claim is the delivery id and is identical across every retry, so use it to deduplicate.`,\n '',\n `Answer 2xx to acknowledge. Anything else is retried up to ${contract.maxAttempts} attempts with a fixed backoff, and each attempt is abandoned after ${Math.round(contract.requestTimeoutMs / 1000)} seconds.`,\n ].join('\\n'),\n 'x-wildo': {\n resourceIdentifier: op.resourceIdentifier,\n operationIdentifier: op.baseOperationIdentifier,\n eventChannel: notification.channel,\n notificationIdentifier: notification.identifier,\n },\n requestBody: {\n required: true,\n content: {\n 'application/json': bodyRef === undefined\n // No read response to point at — say what the body is rather than assert a shape.\n ? { schema: { type: 'object', description: `The \\`${op.resourceIdentifier}\\` record as the API returns it.` } }\n : { schema: { $ref: bodyRef } },\n },\n },\n responses: {\n '2XX': { description: 'The delivery was accepted. Any 2xx ends the delivery; the body is ignored.' },\n },\n },\n };\n }\n }\n return webhooks;\n}\n\n/**\n * Builds the OpenAPI request-body `examples` map from authored examples that\n * carry a `request` payload. Returns undefined when there are none.\n */\nfunction buildRequestExamples(op: OperationProjection): Record<string, unknown> | undefined {\n const examples: Record<string, unknown> = {};\n const pathParameterNames = new Set(extractPathParameters(op.path));\n for (const example of op.examples ?? []) {\n if (example.request === undefined) {\n continue;\n }\n // Source examples use one object so the same authored scenario can feed path\n // parameters and the JSON body. OpenAPI represents those as separate locations:\n // keep path values on Parameter Objects (via `buildParameterExamples`) and remove\n // them from the body example. Otherwise a primary-scope id such as\n // `organizationId` appears twice even when the request DTO correctly owns only\n // `justification` and `requestedDurationMinutes`.\n const value = isPlainObject(example.request)\n ? Object.fromEntries(Object.entries(example.request).filter(([name]) => !pathParameterNames.has(name)))\n : example.request;\n examples[example.title] = { value };\n }\n return Object.keys(examples).length > 0 ? examples : undefined;\n}\n\n/**\n * Is this JSON-Schema fragment worth hoisting into `components/schemas`? Only\n * structured bodies (objects / arrays / composed schemas) earn a named\n * component + `$ref`; bare scalars (`{ type: 'string' }`) and empty `{}` stay\n * inline (a `$ref` to a one-line scalar would be pure overhead). Already-`$ref`\n * fragments are left alone.\n */\nfunction isHoistableSchema(value: unknown): value is Record<string, unknown> {\n if (!isPlainObject(value) || '$ref' in value) {\n return false;\n }\n return (\n value['type'] === 'object'\n || value['type'] === 'array'\n || 'properties' in value\n || 'items' in value\n || 'allOf' in value\n || 'anyOf' in value\n || 'oneOf' in value\n );\n}\n\n/**\n * Deterministic, key-sorted stringification used to detect structurally\n * IDENTICAL schemas regardless of key order, so the same shape authored on\n * different operations (or the same operation reached at multiple paths — the\n * `Via<…>` variants) collapses onto ONE component.\n */\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (isPlainObject(value)) {\n return `{${Object.keys(value)\n .sort()\n .map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value) ?? 'null';\n}\n\n/**\n * Which half of an operation a generated component schema models.\n *\n * A closed two-member vocabulary, named rather than inlined because the two members are not\n * symmetric and the difference is worth stating once: a REQUEST schema is what a caller must\n * SEND and is therefore the contract they are held to, while a RESPONSE schema is what the\n * application PROMISES to return. Both the schema NAME and its description are derived from\n * this value, so the member is the single input that decides how an integrator reads the card.\n *\n * The member VALUES are the PascalCase suffixes appended to a schema name (`TodosCreateRequest`),\n * so they are wire-visible in the published OpenAPI document and not free to rename.\n */\nexport enum OpenApiComponentSchemaRole {\n REQUEST = 'Request',\n RESPONSE = 'Response',\n}\n\n/**\n * Component name for an operation's request/response body. Mirrors the\n * verb-first operationId namer (shares `pascal`): `<Resource><BaseVerb><Quals><Role>`,\n * e.g. `TodosListResponse`, `TodosCreateRequest`, `TodosListSummaryResponse`,\n * `TodosChangeStatusBulkRequest`. Schema-affecting qualifiers (`summary` /\n * `context` data-mode, `BULK`) ARE included; the multi-path `Via<…>`\n * disambiguator is STRIPPED because it never changes the body shape — so the\n * many URL variants of one operation share a single model.\n */\nfunction componentSchemaName(op: OperationProjection, role: OpenApiComponentSchemaRole): string {\n const qualifierTail = op.operationKey.startsWith(op.baseOperationIdentifier)\n ? op.operationKey.slice(op.baseOperationIdentifier.length)\n : '';\n const schemaQualifiers = qualifierTail\n .split('_')\n .filter((q) => q.length > 0 && !q.startsWith('Via'))\n .map(pascal)\n .join('');\n return `${pascal(op.resourceIdentifier)}${pascal(op.baseOperationIdentifier)}${schemaQualifiers}${role}`;\n}\n\n/**\n * Per-section registry that hoists inline body schemas into `components/schemas`\n * and hands back `$ref`s. Schemas deduplicate only when BOTH their semantic\n * component identity and their structure match. Structurally identical request\n * bodies from different operations remain distinct components: an empty\n * `ApiKeysDeactivateRequest` must never resolve to an unrelated\n * `AccountErasureRequestsCreateRequest`, because component names are public\n * documentation identities and typed guide-link targets, not storage slots.\n *\n * The same semantic identity reached through multiple equivalent routes still\n * shares one component. A desired name already taken by a different schema gets\n * a numeric suffix (`2`, `3`, …). The injected Tier-2 field docs travel with the\n * schema, so the documented model lands in the component.\n */\ninterface SchemaRegistry {\n ref(schema: unknown, desiredName: string, description?: string): unknown;\n schemas(): Record<string, unknown>;\n}\n/**\n * Describe the two closed vocabularies inside the framework's own error envelope, from the\n * definitions the runtime already carries.\n *\n * `error.type` is the field an integrator branches on, and it arrived as twenty bare tokens with no\n * explanation — the ONLY enum in the document that no authoring could reach, because the sweep that\n * describes enum values reads a field specification and this schema belongs to no resource. The\n * words are not written here: `ERROR_DEFINITIONS` is a `Record<ErrorType, …>` the error builder\n * itself consults, so the sentence, the HTTP status and whether the framework's own strategy is to\n * retry all come from the same source that decides them at runtime.\n *\n * Matching is by EXACT VALUE SET, and that is only sound because it is scoped to this one\n * generator-owned schema. Across the document at large it would not be: `['active', 'expired',\n * 'inactive']` occurs on an OAuth client and on an API key with different meanings, so propagating\n * one description to the other by value set would put \"Client may mint tokens\" on an API key.\n *\n * `severity` gets one sentence rather than six invented ones: it drives the framework's own logging\n * and alerting, and a client has nothing to do with it.\n *\n * Returns a described COPY. The caller's schema belongs to the projection input and a pin asserts\n * the generator leaves its input untouched.\n */\nfunction describeFrameworkErrorEnvelopeEnums(schema: unknown): unknown {\n if (!isPlainObject(schema)) return schema;\n const errorTypeValues = new Set<string>(Object.values(ErrorType));\n const severityValues = new Set<string>(Object.values(ErrorSeverity));\n const errorTypeMeanings: Record<string, string> = {};\n for (const value of Object.values(ErrorType)) {\n const definition = ERROR_DEFINITIONS[value];\n const retries = definition.errorHandlingStrategy === ErrorHandling_Strategy.RETRY;\n errorTypeMeanings[value] = `${definition.description} (HTTP ${String(definition.statusCode)})`\n + `${retries ? ' — retrying is expected to help.' : '.'}`;\n }\n const described = structuredClone(schema) as Record<string, unknown>;\n const visit = (node: unknown): void => {\n if (Array.isArray(node)) {\n for (const entry of node) visit(entry);\n return;\n }\n if (!isPlainObject(node)) return;\n const values = node['enum'];\n if (Array.isArray(values) && node['description'] === undefined) {\n const present = new Set(values.map((value) => String(value)));\n if (present.size === errorTypeValues.size && [...present].every((value) => errorTypeValues.has(value))) {\n node['description'] = `Which kind of failure this was. Branch on this rather than on wording.\\n\\nValues:\\n`\n + Object.entries(errorTypeMeanings).map(([value, meaning]) => `- \\`${value}\\`: ${meaning}`).join('\\n');\n node['x-enum-descriptions'] = errorTypeMeanings;\n } else if (present.size === severityValues.size && [...present].every((value) => severityValues.has(value))) {\n node['description'] = 'How seriously the application itself treats this failure — it drives logging and alerting '\n + 'on the server. A client has nothing to decide from it; branch on `type` and `code`.';\n }\n }\n for (const entry of Object.values(node)) visit(entry);\n };\n visit(described);\n return described;\n}\n\nfunction createSchemaRegistry(): SchemaRegistry {\n const nameBySemanticIdentityAndContent = new Map<string, string>();\n const contentByName = new Map<string, string>();\n const schemas: Record<string, unknown> = {};\n return {\n ref(schema, desiredName, description) {\n if (!isHoistableSchema(schema)) {\n return schema;\n }\n /*\n * Canonicalised BEFORE the description is attached, deliberately. Deduplication is by\n * name-and-content, so folding the description into the identity would split one component\n * into several whenever two operations produced the same shape — the opposite of what a\n * description is for. A component name maps to exactly one desired name, hence to one\n * operation's resource, so the description attached here describes the schema that is stored.\n */\n const canonical = stableStringify(schema);\n const semanticIdentityAndContent = `${desiredName}\\u0000${canonical}`;\n const existingName = nameBySemanticIdentityAndContent.get(semanticIdentityAndContent);\n if (existingName !== undefined) {\n return { $ref: `#/components/schemas/${existingName}` };\n }\n let name = desiredName;\n let suffix = 2;\n while (contentByName.has(name) && contentByName.get(name) !== canonical) {\n name = `${desiredName}${suffix}`;\n suffix += 1;\n }\n nameBySemanticIdentityAndContent.set(semanticIdentityAndContent, name);\n contentByName.set(name, canonical);\n /*\n * COPIED, never mutated. The caller's schema object belongs to the operation projection, and\n * a pin asserts the generator leaves its input untouched — writing the description onto it\n * would have made this generator edit the data it was handed, which is the one thing that\n * test exists to prevent. A shallow copy suffices: only a top-level key is added, and an\n * authored description already on the schema outranks the derived one.\n */\n const stored = description !== undefined && isPlainObject(schema) && schema['description'] === undefined\n ? { ...schema, description }\n : schema;\n schemas[name] = stored;\n return { $ref: `#/components/schemas/${name}` };\n },\n schemas() {\n return schemas;\n },\n };\n}\n\n/**\n * Replace an operation object's inline request/response BODY schemas with\n * `$ref`s into `components/schemas` (via `registry`). Walks only the\n * `application/json` body slots — `requestBody` and each `responses[*]` with\n * content; query `parameters` (GET/DELETE) and the rare `callbacks` block stay\n * inline. All success statuses share one response schema object, so they\n * resolve to the same `$ref`. Mutates `operationObject` in place.\n */\n/**\n * What a component schema IS, taken from the operation that hoisted it.\n *\n * Measured on Wonder CRM: 0 of 474 component schemas carried a description, so the schema list read\n * as 474 names — `DealReadResponse`, `DealReadContextResponse`, `DealReadSummaryResponse` — with\n * nothing to tell them apart or say what a deal is.\n *\n * Derived from the OPERATION rather than from the schema's name. 473 of the 474 names do start with\n * their resource's tag, so a prefix match would have worked and would have been a guess: the\n * hoisting operation is the authoritative link, and it costs nothing to use it. The resource's own\n * purpose is appended when its specification authored one, because a reader who reached a schema\n * card may never have seen the tag.\n */\nfunction describeComponentSchema(\n op: OperationProjection,\n role: OpenApiComponentSchemaRole,\n resourcePurpose: string | undefined,\n): string {\n const what = `${role === OpenApiComponentSchemaRole.REQUEST ? 'Request body' : 'Response body'} for \\`${op.resourceIdentifier}.${op.baseOperationIdentifier}\\`.`;\n return resourcePurpose === undefined ? what : `${what} ${resourcePurpose}`;\n}\n\nfunction hoistOperationSchemas(\n operationObject: Record<string, unknown>,\n op: OperationProjection,\n registry: SchemaRegistry,\n resourcePurpose: string | undefined,\n): void {\n const requestBody = operationObject['requestBody'];\n if (isPlainObject(requestBody) && isPlainObject(requestBody['content'])) {\n const media = (requestBody['content'] as Record<string, unknown>)['application/json'];\n if (isPlainObject(media) && isHoistableSchema(media['schema'])) {\n media['schema'] = registry.ref(media['schema'], componentSchemaName(op, OpenApiComponentSchemaRole.REQUEST), describeComponentSchema(op, OpenApiComponentSchemaRole.REQUEST, resourcePurpose));\n }\n }\n\n const responses = operationObject['responses'];\n if (isPlainObject(responses)) {\n for (const entry of Object.values(responses)) {\n if (!isPlainObject(entry) || !isPlainObject(entry['content'])) {\n continue;\n }\n const media = (entry['content'] as Record<string, unknown>)['application/json'];\n if (isPlainObject(media) && isHoistableSchema(media['schema'])) {\n media['schema'] = registry.ref(media['schema'], componentSchemaName(op, OpenApiComponentSchemaRole.RESPONSE), describeComponentSchema(op, OpenApiComponentSchemaRole.RESPONSE, resourcePurpose));\n }\n }\n }\n}\n\n/**\n * Framework-universal API conventions, emitted as the trailing section of every\n * `info.description`. These describe behaviour that is TRUE OF EVERY Wildo API\n * (engine-generic application behavior, not Wildo author guidance or app\n * configuration), so the reusable generator authors them once here. Grounded\n * in the actual generated spec: the three security schemes (see\n * `SECURITY_SCHEMES`), the `{ data, pagination }` list envelope, the\n * `x-idempotent` extension, and standard HTTP error codes. Rate-limit response\n * headers are deliberately NOT claimed — they are not emitted in the spec.\n */\nconst API_CONVENTIONS_MARKDOWN = [\n '## API conventions',\n '',\n '### Authentication',\n '',\n 'Each operation lists the credentials it accepts under **Security**:',\n '',\n '- **Bearer token** — a JWT access token sent as `Authorization: Bearer <token>`.',\n '- **API key** — an organization- or application-scoped key (`sk_org_…` / `sk_app_…`) sent as the complete value of the `Authorization` header without a `Bearer` scheme.',\n '- **Anonymous session** — an anonymous-session token sent in `x-anonymous-session-token`, for pre-authentication operations.',\n '',\n 'Operations with no security requirement are public.',\n '',\n '### Base URL',\n '',\n 'Pick a base URL from the **Servers** dropdown and prepend it to each operation path (paths already include the `/api/v1` mount).',\n '',\n '### Pagination',\n '',\n 'List and search operations return `{ \"data\": [ … ], \"pagination\": { \"page\", \"limit\", \"total\", \"totalPages\" } }`. Use the `page` and `limit` query parameters to page through results, and `sort` (comma-separated `field:asc` / `field:desc` pairs, highest priority first) to order them. Each operation documents its per-page maximum and sortable fields on the parameters themselves.',\n '',\n '### Filtering',\n '',\n 'Search operations accept a free-text `q` query parameter and one query parameter per configured filter field (for example `?status=active`). Range filters (dates) are object-valued: pass them with `deepObject` bracket notation — `createdAt[startDate]=<ISO>&createdAt[endDate]=<ISO>`. Each operation documents its available filter fields on the parameters themselves.',\n '',\n '### Idempotency',\n '',\n 'Operations flagged **idempotent** (the `x-idempotent` extension) are safe to retry — repeating the request has the same effect as making it once.',\n '',\n '### Errors',\n '',\n 'Errors use standard HTTP status codes. Each operation documents the specific failures it can return (for example `400`, `403`, `404`, `409`) and the condition that triggers each.',\n].join('\\n');\n\n/**\n * Compose the OpenAPI `info.description` (the API reference landing page): the\n * app's authored `apiOverview` (when present) followed by the framework-universal\n * `API_CONVENTIONS_MARKDOWN`. The conventions are ALWAYS emitted, so the landing\n * page is never blank — the overview is pure enrichment on top.\n */\nfunction buildInfoDescription(input: OpenApiGenerationInput): string {\n const overview = input.apiOverview?.trim();\n return overview && overview.length > 0\n ? `${overview}\\n\\n${API_CONVENTIONS_MARKDOWN}`\n : API_CONVENTIONS_MARKDOWN;\n}\n\n/**\n * Produces the display label for an OpenAPI resource tag without changing the\n * stable tag identity used by generated clients and operation metadata.\n *\n * The identity remains the resource identifier (`organizationApiKeys`), while\n * the native Docusaurus reference can present a human-scannable resource\n * heading (`Organization Api Keys`). Applications can later supply richer\n * product terminology without making that editorial concern part of the wire\n * contract.\n */\nfunction buildResourceTagDisplayName(resourceIdentifier: string): string {\n return splitWords(resourceIdentifier)\n .map((word) => apiReferenceDisplayWord(word, true))\n .join(' ');\n}\n\n/**\n * Builds the full OpenAPI 3.1 document object for a single section.\n * Returns a plain JS object — the YAML emitter is a separate concern.\n *\n * `paths` are nested by template path; multiple HTTP verbs on the\n * same path are merged into a single path-item object as the OpenAPI\n * spec requires. Body schemas are hoisted into `components/schemas`\n * (content-deduped, `$ref`-linked) by a per-section `SchemaRegistry`.\n */\nfunction buildOpenApiDocument(\n section: OpenApiSection,\n operations: ReadonlyArray<OperationProjection>,\n input: OpenApiGenerationInput,\n): Record<string, unknown> {\n const sortedOps = sortOperationsForDeterministicOutput(operations);\n\n const titleBase = input.publicMarketingTitle ?? input.appDisplayName;\n // `organization` / `application` are internal scope partitions. The API\n // reference must name the consumer job instead: organization-scoped tenant\n // operations are the normal API, whereas application-scoped operations are\n // the privileged administration surface.\n const sectionLabel = section === OpenApiSection.API_REFERENCE\n ? 'API reference'\n : 'Application administration API reference';\n\n /*\n * Resource purposes, indexed before the operation loop so a hoisted schema can carry what its\n * resource IS. The tag descriptions below read the same map; building it once keeps the schema\n * card and the tag card quoting one string rather than two copies that can drift.\n */\n const purposeByResourceIdentifier = new Map<string, string>();\n for (const tag of input.resourceTags ?? []) {\n if (tag.description !== undefined && !purposeByResourceIdentifier.has(tag.name)) {\n purposeByResourceIdentifier.set(tag.name, tag.description);\n }\n }\n /*\n * The canonical route of every operation that has one, indexed before any operation object is\n * built. A route with no `Via` qualifier is the operation's own address; the `Via` ones are the\n * same operation reached through a parent.\n *\n * Indexed rather than inferred per operation, because \"shortest path wins\" would be a guess and\n * this is a fact the operation key already carries. An operation reachable ONLY through a parent\n * has no canonical entry, and is deliberately left unmarked: calling it an alias of nothing would\n * tell a reader to go somewhere that does not exist.\n */\n const canonicalPathByRoute = new Map<string, string>();\n for (const op of sortedOps) {\n if (splitOperationQualifiers(op).via.length > 0) continue;\n const key = canonicalRouteKey(op);\n if (!canonicalPathByRoute.has(key)) canonicalPathByRoute.set(key, op.path);\n }\n /** Exactly the shared error responses some operation referenced, so none is emitted unused. */\n const usedErrorResponseNames = new Set<string>();\n /**\n * Each resource's canonical read-response component, for the `webhooks` block to point at.\n *\n * The read operation's response IS the record a delivery carries, so this is a resolved\n * reference rather than a guess — and a resource with no read operation simply gets prose.\n */\n const canonicalReadResponseRefByResource = new Map<string, string>();\n const paths: Record<string, Record<string, unknown>> = {};\n const ownershipByPathAndVerb = new Map<string, string>();\n const tagSet = new Set<string>();\n // operationId must be unique within the document. The verb-first builder is\n // unique by construction for almost every operation, but a few resources with\n // deeply self-nested URL families (e.g. `applications` via app-metadata /\n // app-versions) reduce to the same semantic `Via<…>` and would otherwise\n // collide. Disambiguate genuine collisions with a stable numeric suffix: the\n // first occurrence (in deterministic sort order) keeps the clean name, later\n // ones get `2`, `3`, … — applied here rather than in the projector because\n // uniqueness is a per-document (per-section) property.\n const operationIdUseCount = new Map<string, number>();\n const schemaRegistry = createSchemaRegistry();\n // The schema comes from the same model the backend error handler serializes.\n // Register before per-operation hoisting so every non-success response shares\n // the stable, named component instead of producing resource-local copies.\n const errorResponseSchema = schemaRegistry.ref(\n describeFrameworkErrorEnvelopeEnums(input.errorResponseSchema),\n 'ErrorResponse',\n // The one schema the GENERATOR owns rather than projects, so it was the one schema with no\n // description while all 473 others had one: the sweep that described component schemas words\n // them from the operation and the resource, and this belongs to neither.\n 'The body returned whenever a request does not succeed. `error.type` says which kind of failure it '\n + 'was and `error.code`, when present, is the stable identifier to branch on in code — branch on '\n + 'those rather than on wording. `error.customMessage` is the text meant for a person, and '\n + '`error.customMessageReference` is its translation key; `error.message` is the technical '\n + 'explanation. `error.context` is present only on validation, conflict and rate-limit failures.',\n );\n for (const op of sortedOps) {\n if (paths[op.path] === undefined) {\n paths[op.path] = {};\n }\n const collisionKey = `${op.path}::${op.httpVerb}`;\n const existingOwner = ownershipByPathAndVerb.get(collisionKey);\n if (existingOwner !== undefined) {\n throw new Error(\n `OpenAPI generator: duplicate ${op.httpVerb.toUpperCase()} ${op.path} in `\n + `${section}. Existing operation ${existingOwner} collides with `\n + `${op.resourceIdentifier}.${op.operationKey}. Each OpenAPI path+verb pair must be unique.`,\n );\n }\n const baseOperationId = buildOperationId(op);\n const priorUses = operationIdUseCount.get(baseOperationId) ?? 0;\n operationIdUseCount.set(baseOperationId, priorUses + 1);\n const operationId = priorUses === 0 ? baseOperationId : `${baseOperationId}${priorUses + 1}`;\n const operationObject = buildOperationObject(op, operationId, errorResponseSchema);\n for (const response of Object.values((operationObject['responses'] ?? {}) as Record<string, unknown>)) {\n const ref = isPlainObject(response) ? response['$ref'] : undefined;\n if (typeof ref === 'string' && ref.startsWith('#/components/responses/')) {\n usedErrorResponseNames.add(ref.slice('#/components/responses/'.length));\n }\n }\n /*\n * Mark an alias route AS one, and point at the operation's own address.\n *\n * OpenAPI has no concept of \"the same operation at another path\", so a reader meeting\n * `organizationMembers` for the first time sees its whole surface three times with no way to\n * tell that two of them are conveniences. The description says so in words a reader acts on,\n * and `x-wildo.aliasOfPath` gives a renderer something to group or fold on.\n *\n * NOT `deprecated`: an alias is a supported route and a client calling it is doing nothing\n * wrong. Saying \"prefer\" would be an instruction nobody asked this generator to give.\n */\n const canonicalPath = splitOperationQualifiers(op).via.length === 0\n ? undefined\n : canonicalPathByRoute.get(canonicalRouteKey(op));\n if (canonicalPath !== undefined && canonicalPath !== op.path) {\n const wildo = operationObject['x-wildo'];\n if (isPlainObject(wildo)) wildo['aliasOfPath'] = canonicalPath;\n const existing = typeof operationObject['description'] === 'string' ? operationObject['description'] : '';\n const note = `The same operation is published at \\`${op.httpVerb.toUpperCase()} ${canonicalPath}\\`. This route reaches it through its parent, which is a convenience rather than a different operation — either address does the same thing.`;\n operationObject['description'] = existing.length > 0 ? `${existing}\\n\\n${note}` : note;\n }\n hoistOperationSchemas(operationObject, op, schemaRegistry, purposeByResourceIdentifier.get(op.resourceIdentifier));\n if (op.baseOperationIdentifier === 'read' && splitOperationQualifiers(op).via.length === 0 && !canonicalReadResponseRefByResource.has(op.resourceIdentifier)) {\n const okSchema = ((operationObject['responses'] as Record<string, any> | undefined)?.['200']?.content?.['application/json']?.schema) as { $ref?: string } | undefined;\n if (typeof okSchema?.$ref === 'string') canonicalReadResponseRefByResource.set(op.resourceIdentifier, okSchema.$ref);\n }\n paths[op.path][op.httpVerb] = operationObject;\n ownershipByPathAndVerb.set(collisionKey, `${op.resourceIdentifier}.${op.operationKey}`);\n tagSet.add(op.resourceIdentifier);\n }\n\n // Tier-2: per-resource tag descriptions (resource business purpose). The\n // tag set is derived from the section's operations above; descriptions are\n // looked up by tag name from the input's resourceTags (order-independent).\n // Cleaned of implementation-only noise here (this is the surface the projector\n // does NOT route through `buildOperationDocFromSpec`), so the resource group\n // blurbs read identically to the per-operation prose. Tags whose description\n // cleans to empty are dropped (treated as having no description).\n const resourceTagsByName = new Map<string, ResourceTag>();\n for (const tag of input.resourceTags ?? []) {\n if (resourceTagsByName.has(tag.name)) {\n throw new Error(`OpenAPI generator: duplicate resource tag descriptor for '${tag.name}'.`);\n }\n resourceTagsByName.set(tag.name, tag);\n }\n\n const webhooks = buildWebhooksObject(sortedOps, canonicalReadResponseRefByResource);\n\n return {\n openapi: '3.1.0',\n info: {\n title: `${titleBase} ${sectionLabel}`,\n description: buildInfoDescription(input),\n version: input.supportedApiVersion,\n },\n // `servers` only when the app enriched `apiServers` (deployment URLs are\n // app/environment knowledge — see WildoTechnicalDocConfig.apiServers).\n // Omitted → back-compatible with the pre-servers output.\n ...(input.servers && input.servers.length > 0 ? { servers: input.servers } : {}),\n tags: Array.from(tagSet)\n .sort((a, b) => a.localeCompare(b))\n .map((tagName) => {\n const descriptor = resourceTagsByName.get(tagName);\n const description = descriptor?.description === undefined\n ? undefined\n : stripImplementationNoise(descriptor.description);\n const resourceMetadata = {\n contractVersion: OPENAPI_RESOURCE_IDENTITY_CONTRACT_VERSION,\n resourceRef: `technical-documentation:resource/${tagName}`,\n ...(descriptor?.lifecycleRole === undefined ? {} : { lifecycleRole: stripImplementationNoise(descriptor.lifecycleRole) }),\n ...(descriptor?.relationships === undefined ? {} : { relationships: descriptor.relationships }),\n ...(descriptor?.category === undefined ? {} : { category: descriptor.category }),\n };\n const tag = {\n name: tagName,\n 'x-displayName': buildResourceTagDisplayName(tagName),\n 'x-wildo': resourceMetadata,\n };\n return description !== undefined && description.length > 0 ? { ...tag, description } : tag;\n }),\n paths,\n // `webhooks` (OpenAPI 3.1) = what this application SENDS. The reference described only what a\n // client calls; an integrator writing the receiving endpoint had no machine-readable contract.\n ...(Object.keys(webhooks).length > 0 ? { webhooks } : {}),\n // `components.schemas` = hoisted, content-deduped request/response body\n // models (named `<Resource><Verb><Quals>Request|Response`); `securitySchemes`\n // = framework-universal auth, referenced by each op's `security`.\n components: {\n ...(Object.keys(schemaRegistry.schemas()).length > 0\n ? { schemas: schemaRegistry.schemas() }\n : {}),\n // `responses` = the error responses the GENERATOR words (the access-mode 401s and the\n // universal 500). An authored response stays inline on its operation, because its\n // description is written for that one operation and is the document's most useful prose.\n ...(usedErrorResponseNames.size > 0\n ? { responses: buildErrorResponseComponents(usedErrorResponseNames, errorResponseSchema) }\n : {}),\n securitySchemes: SECURITY_SCHEMES,\n },\n };\n}\n\n/**\n * Counts the unique `resourceIdentifier` values among a set of\n * operations. Used to populate `OpenApiSectionOutput.resourceCount`.\n */\nfunction countDistinctResources(operations: ReadonlyArray<OperationProjection>): number {\n const resources = new Set<string>();\n for (const op of operations) {\n resources.add(op.resourceIdentifier);\n }\n return resources.size;\n}\n\n/**\n * Builds a single section's output entry. Returns `null` when the\n * section is empty so the caller can omit it from `sections[]` per\n * K-2.\n */\nfunction buildSectionOutput(\n section: OpenApiSection,\n operations: ReadonlyArray<OperationProjection>,\n input: OpenApiGenerationInput,\n): OpenApiSectionOutput | null {\n if (operations.length === 0) {\n return null;\n }\n const document = buildOpenApiDocument(section, operations, input);\n return {\n section,\n operationCount: operations.length,\n resourceCount: countDistinctResources(operations),\n document,\n };\n}\n\n/**\n * Refuses a generator change that drops, duplicates or rewrites a resolved HTTP\n * operation between the source projection and the final OpenAPI documents.\n *\n * This is intentionally performed against the emitted `x-wildo` identity,\n * rather than operationId or path iteration order. Those are presentation and\n * OpenAPI container details respectively; the source tuple is the contract.\n */\nfunction assertGeneratedOperationConservation(\n operations: ReadonlyArray<OperationProjection>,\n sections: ReadonlyArray<OpenApiSectionOutput>,\n): void {\n const identityKey = (identity: Record<string, unknown>): string => JSON.stringify([\n identity['contractVersion'],\n identity['resourceRef'],\n identity['operationFamilyRef'],\n identity['operationVariantRef'],\n identity['variantType'],\n identity['httpVerb'],\n identity['path'],\n identity['section'],\n ]);\n const expected = new Set<string>();\n for (const operation of operations) {\n const key = identityKey({ ...operation.identity, section: operation.consumerApiSection });\n if (expected.has(key)) throw new Error(`OpenAPI generator: duplicate source operation identity ${key}`);\n expected.add(key);\n }\n\n const actual = new Set<string>();\n for (const section of sections) {\n const paths = section.document['paths'];\n if (!isPlainObject(paths)) throw new Error(`OpenAPI generator: ${section.section} document has no paths object`);\n for (const pathItem of Object.values(paths)) {\n if (!isPlainObject(pathItem)) continue;\n for (const operationObject of Object.values(pathItem)) {\n if (!isPlainObject(operationObject)) continue;\n const metadata = operationObject['x-wildo'];\n if (metadata === undefined) continue;\n if (!isPlainObject(metadata)) throw new Error('OpenAPI generator: x-wildo operation metadata must be an object');\n const key = identityKey(metadata);\n if (actual.has(key)) throw new Error(`OpenAPI generator: duplicate emitted operation identity ${key}`);\n actual.add(key);\n }\n }\n }\n if (actual.size !== expected.size || [...expected].some((key) => !actual.has(key))) {\n throw new Error('OpenAPI generator: resolved HTTP operation conservation failed between source projection and OpenAPI output');\n }\n}\n\n/**\n * Public entry point — single function the companion controller\n * calls.\n *\n * Steps:\n * 1. Parse the input (defense-in-depth — the controller validates\n * against `OpenApiGenerationInputSchema` already, but we re-parse\n * here so direct callers can't bypass validation).\n * 2. Assert URL-bearing variants without treating authentication-mode flags\n * as eligibility filters.\n * 3. Group by the explicit source-resolved consumer section.\n * 4. Build one semantic OpenAPI document per non-empty section.\n * 5. Drop empty sections (K-2).\n *\n * @param rawInput The unparsed input — typically the deserialised\n * wire payload from the introspection subprocess hop.\n * @returns The `OpenApiGenerationOutput` ready to be returned by the\n * companion controller.\n */\nexport function generateOpenApiDocuments(rawInput: unknown): OpenApiGenerationOutput {\n const input = OpenApiGenerationInputSchema.parse(rawInput);\n\n const apiOps = filterApiCallOperations(input.operations);\n const split = groupOperationsByConsumerApiSection(apiOps);\n\n const sectionOrder: ReadonlyArray<OpenApiSection> = [\n OpenApiSection.API_REFERENCE,\n OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE,\n ];\n\n const sections: OpenApiSectionOutput[] = [];\n for (const section of sectionOrder) {\n const sectionOutput = buildSectionOutput(section, split[section], input);\n if (sectionOutput !== null) {\n sections.push(sectionOutput);\n }\n }\n\n assertGeneratedOperationConservation(apiOps, sections);\n\n return {\n generatedAt: new Date().toISOString(),\n sections,\n };\n}\n"]}
|