Build: Upgrade @hey-api/openapi-ts to 0.97#22735
Conversation
Default to a 500 fallback status when no upstream Response is provided to #createResponse, preventing a RangeError from the Response constructor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… 0.97 - Bumps @hey-api/openapi-ts to ^0.97.0 in the extension template. - Simplifies the generate-openapi.js plugin config: spread @hey-api defaults and only override @hey-api/sdk with responseStyle: 'fields' so call sites keep the { data, error } destructuring shape. Removes the redundant @hey-api/client-fetch redeclaration that triggered duplicate-plugin warnings. - Drops the hey-api.ts runtime config file in favour of wiring the generated client through UMB_AUTH_CONTEXT.configureClient() from the entrypoint, so extensions inherit the same auth callback and default response interceptors (401 retry, error notifications) as the core backoffice. - Regenerates the pre-bundled SDK against the template's canonical Umbraco.Extension scaffold so it matches what `npm run generate-client` produces on first run; default hey-api output is flat function exports. - Updates dashboard.element.ts call sites to match the new SDK shape and renames the user model usage to Iuser to follow the new schema. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @iOvergaard's task in 6m 19s —— View job PR ReviewTarget: Upgrades
Important
Suggestions
Approved with Suggestions for improvementGood to go — the upgrade is clean, the interceptor fix is correct, and the template auth wiring is a genuine improvement. The public export of |
…-generated So GitHub diffs collapse the regenerated *.gen.ts files in PRs, matching what we already do for the backoffice client and Login app SDKs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR upgrades @hey-api/openapi-ts (0.85 → 0.97) across the backoffice client, the Login app, and the UmbracoExtension template, regenerating the generated TypeScript SDK/runtime output to match the new generator behavior. It also includes a small runtime fix in the backoffice API interceptor and a minor UX improvement in the installer user form.
Changes:
- Bump
@hey-api/openapi-tsto^0.97.0and regenerate SDK/runtime output for the backoffice client, Login app, and extension template. - Update the extension template to configure the generated client via
UMB_AUTH_CONTEXT.configureClient()and remove the old runtime config file. - Fix
UmbApiInterceptorController.#createResponseto safely synthesizeResponseobjects when no upstreamResponseexists; addautocompleteattributes to installer user inputs.
Reviewed changes
Copilot reviewed 57 out of 60 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/UmbracoExtension/Client/src/hey-api.ts | Removes the old template runtime config hook for the generated client. |
| templates/UmbracoExtension/Client/src/entrypoints/entrypoint.ts | Wires generated client into UMB_AUTH_CONTEXT during extension initialization. |
| templates/UmbracoExtension/Client/src/dashboards/dashboard.element.ts | Updates example dashboard to new generated SDK function exports and renamed user type. |
| templates/UmbracoExtension/Client/src/api/types.gen.ts | Regenerated template API types for hey-api 0.97 output format. |
| templates/UmbracoExtension/Client/src/api/sdk.gen.ts | Regenerated template SDK (now function exports instead of a service class). |
| templates/UmbracoExtension/Client/src/api/index.ts | Updates template API barrel exports to explicit exports. |
| templates/UmbracoExtension/Client/src/api/core/utils.gen.ts | Regenerated core helper utilities formatting/behavior changes. |
| templates/UmbracoExtension/Client/src/api/core/types.gen.ts | Regenerated core types (notably SSE typing and formatting updates). |
| templates/UmbracoExtension/Client/src/api/core/serverSentEvents.gen.ts | Regenerated SSE implementation; adds line-ending normalization and refactors formatting. |
| templates/UmbracoExtension/Client/src/api/core/queryKeySerializer.gen.ts | Regenerated deterministic query-key serialization helpers. |
| templates/UmbracoExtension/Client/src/api/core/pathSerializer.gen.ts | Regenerated parameter serialization helpers formatting changes. |
| templates/UmbracoExtension/Client/src/api/core/params.gen.ts | Regenerated params builder; expands field mapping capabilities. |
| templates/UmbracoExtension/Client/src/api/core/bodySerializer.gen.ts | Regenerated serializers; tightens BodySerializer typing and adds per-parameter query options. |
| templates/UmbracoExtension/Client/src/api/core/auth.gen.ts | Regenerated auth helpers (minor formatting refactor). |
| templates/UmbracoExtension/Client/src/api/client/utils.gen.ts | Regenerated fetch-client utilities; adds per-parameter query serializer overrides and interceptor typing tweaks. |
| templates/UmbracoExtension/Client/src/api/client/types.gen.ts | Regenerated client types; updates RequestResult/ResolvedRequestOptions typing. |
| templates/UmbracoExtension/Client/src/api/client/index.ts | Removes legacy parser export in template client barrel. |
| templates/UmbracoExtension/Client/src/api/client/client.gen.ts | Regenerated fetch client runtime implementation for hey-api 0.97. |
| templates/UmbracoExtension/Client/src/api/client.gen.ts | Regenerated template client factory/default client instance. |
| templates/UmbracoExtension/Client/scripts/generate-openapi.js | Simplifies plugin config and overrides only responseStyle: 'fields'; filters out default sdk plugin to override config. |
| templates/UmbracoExtension/Client/package.json | Bumps @hey-api/openapi-ts devDependency version. |
| src/Umbraco.Web.UI.Login/src/api/types.gen.ts | Regenerated login API types; makes several request bodies required and adjusts ProblemDetails typing. |
| src/Umbraco.Web.UI.Login/src/api/sdk.gen.ts | Regenerated login SDK functions and Options type signature. |
| src/Umbraco.Web.UI.Login/src/api/index.ts | Switches login API barrel to explicit exports. |
| src/Umbraco.Web.UI.Login/src/api/core/utils.gen.ts | Regenerated login core utilities formatting tweaks. |
| src/Umbraco.Web.UI.Login/src/api/core/types.gen.ts | Regenerated login core types formatting tweaks. |
| src/Umbraco.Web.UI.Login/src/api/core/serverSentEvents.gen.ts | Regenerated login SSE implementation (same changes as template/client). |
| src/Umbraco.Web.UI.Login/src/api/core/queryKeySerializer.gen.ts | Regenerated login query-key serializer formatting tweaks. |
| src/Umbraco.Web.UI.Login/src/api/core/pathSerializer.gen.ts | Regenerated login path serializer formatting tweaks. |
| src/Umbraco.Web.UI.Login/src/api/core/params.gen.ts | Regenerated login params builder enhancements. |
| src/Umbraco.Web.UI.Login/src/api/core/bodySerializer.gen.ts | Regenerated login body/query serializers enhancements. |
| src/Umbraco.Web.UI.Login/src/api/core/auth.gen.ts | Regenerated login auth helper formatting tweaks. |
| src/Umbraco.Web.UI.Login/src/api/client/utils.gen.ts | Regenerated login client utils with query-parameter overrides and interceptor typing updates. |
| src/Umbraco.Web.UI.Login/src/api/client/types.gen.ts | Regenerated login client types (ResolvedRequestOptions, RequestResult updates). |
| src/Umbraco.Web.UI.Login/src/api/client/index.ts | Removes legacy parser export from login client barrel. |
| src/Umbraco.Web.UI.Login/src/api/client/client.gen.ts | Regenerated login fetch-client runtime implementation for hey-api 0.97. |
| src/Umbraco.Web.UI.Login/package.json | Bumps @hey-api/openapi-ts devDependency version. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/validation/document-validation.server.data-source.ts | Updates document validation call site to new generated SDK structure for that operation. |
| src/Umbraco.Web.UI.Client/src/packages/core/resources/api-interceptor.controller.ts | Fixes synthesized Response creation to use a sane fallback status when no upstream Response exists. |
| src/Umbraco.Web.UI.Client/src/packages/core/package.json | Bumps @hey-api/openapi-ts devDependency version. |
| src/Umbraco.Web.UI.Client/src/packages/core/openapi-ts.config.js | Updates SDK plugin config to new operations.strategy/byTags + class container configuration. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/index.ts | Regenerated backend-api barrel from wildcard exports to explicit exports. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/utils.gen.ts | Regenerated backoffice backend-api core utilities formatting tweaks. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/types.gen.ts | Regenerated backoffice backend-api core types formatting tweaks. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/serverSentEvents.gen.ts | Regenerated backoffice backend-api SSE implementation. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/queryKeySerializer.gen.ts | Regenerated backoffice backend-api query-key serializer formatting tweaks. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/pathSerializer.gen.ts | Regenerated backoffice backend-api path serializer formatting tweaks. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/params.gen.ts | Regenerated backoffice backend-api params builder enhancements. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/bodySerializer.gen.ts | Regenerated backoffice backend-api body/query serializers enhancements. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/core/auth.gen.ts | Regenerated backoffice backend-api auth helper formatting tweaks. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/client/utils.gen.ts | Regenerated backoffice backend-api client utils with query overrides and interceptor typing updates. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/client/types.gen.ts | Regenerated backoffice backend-api client types (ResolvedRequestOptions, RequestResult updates). |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/client/index.ts | Removes legacy parser export from backend-api client barrel. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/client/client.gen.ts | Regenerated backoffice backend-api fetch-client runtime implementation for hey-api 0.97. |
| src/Umbraco.Web.UI.Client/src/packages/core/backend-api/client.gen.ts | Regenerated backoffice backend-api default client creation formatting. |
| src/Umbraco.Web.UI.Client/src/apps/installer/user/installer-user.element.ts | Adds autocomplete hints for name/email/password fields in installer UI. |
| src/Umbraco.Web.UI.Client/package-lock.json | Updates lockfile to the new hey-api dependency tree (includes new Node engine requirements from hey-api packages). |
Files not reviewed (2)
- src/Umbraco.Web.UI.Client/package-lock.json: Language not supported
- src/Umbraco.Web.UI.Login/package-lock.json: Language not supported
- Restores the regenerated SDK's hard-coded baseUrl to https://localhost:44339/ so the SiteDomain template token in the .template.config still substitutes it at scaffold time. The 5443 port leaked in from the local host I used to regenerate; that domain is replaced by the user's chosen SiteDomain on scaffold. - Stops marking onInit as `async`. The UmbEntryPointOnInit signature returns void; making the hook async is harmless under TS's bivariant void-return assignability but is misleading. Kicks the context resolution + client configuration off via .then() and logs a warning when UMB_AUTH_CONTEXT is not present (instead of silently optional-chaining). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous tweak was based on Copilot's claim that UmbEntryPointOnInit returns void. The signature does declare void, but the entry-point initializer in app-entry-point-extension-initializer.ts and backoffice-entry-point-extension-initializer.ts both `await moduleInstance.onInit(...)`, so an async onInit is awaited end-to-end. Reverting to async ensures configureClient runs to completion before any element in the extension can hit the API client. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Upgrades
@hey-api/openapi-tsfrom 0.85 → 0.97 across the backoffice client, the standalone Login app, and theUmbracoExtensionproject template, regenerating all SDK output against the new generator.Umbraco.Web.UI.Client/src/packages/core): bumped to^0.97.0and regenerated. The new generator'sbyTagsstrategy with a class container preserves the existing{Tag}Service.{operation}()call shape we already use across the codebase.Umbraco.Web.UI.Login): bumped to^0.97.0and regenerated.templates/UmbracoExtension/Client): bumped to^0.97.0, simplified the plugin config to override onlyresponseStyle: 'fields'(everything else is hey-api defaults), regenerated the pre-bundled SDK against the canonicalUmbraco.Extensionscaffold, and switched the entrypoint to wire the generated client throughUMB_AUTH_CONTEXT.configureClient()so extensions inherit the same auth callback and default response interceptors (401 retry, error notifications) as the core backoffice. The standalonehey-api.tsruntime config file is no longer needed and has been removed.dashboard.element.tsupdated to the new function-export call shape and the renamedIuserschema type.api-interceptor.controller.ts):#createResponsepreviously fell back tostatus: 0when no upstreamResponsewas provided, which throwsRangeErrorfrom theResponseconstructor. Reordered the signature to#createResponse(body, originalResponse?, fallbackStatus = 500)so synthesized responses get a sensible status. Existing call sites (which all pass anoriginalResponse) are unchanged.Test plan
npm run buildandnpm run lintsucceed insrc/Umbraco.Web.UI.Clientnpm run buildsucceeds insrc/Umbraco.Web.UI.LoginDocumentService.putUmbracoManagementApiV1['1DocumentByIdValidate1'][1](document-validation.server.data-source.ts) without runtime errorsdotnet new umbraco-extension --include-example true, runnpm install+npm run generate-client, verify the regenerated SDK is byte-identical to the template's pre-bundled output (apart from the user-supplied name substitutions)whoAmI,whatsTheTimeMrWolf,whatsMyName) work end-to-end against a running hostFollow-ups uncovered while regenerating
Not part of this PR but flagging for the team:
error CS9137: The 'interceptors' feature is not enabledfrom the .NET 10 OpenAPI source generator. Adding<InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>to the host csproj fixes it — probably belongs in the CMS targets so every scaffolded host gets it for free.**/*.csCompile glob picks up the extension's sources and produces duplicate-type warnings. Worth either documenting the recommended layout or excluding the extension dir explicitly.🤖 Generated with Claude Code