Skip to content

chore: update generated files from PR #11571#49

Open
loyaltylion-bot wants to merge 2 commits into
mainfrom
codegen/pr-11571
Open

chore: update generated files from PR #11571#49
loyaltylion-bot wants to merge 2 commits into
mainfrom
codegen/pr-11571

Conversation

@loyaltylion-bot

Copy link
Copy Markdown
Collaborator

Auto-generated by the CI pipeline.

Source: https://github.com/loyaltylion/hogwarts/pull/11571

These files were regenerated from changes to the API contracts. Review and merge alongside the main PR.

Generated files:

  • src/types/api.ts
  • src/types/schemas.ts

@loyaltylion-minerva loyaltylion-minerva Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated type updates are mostly coherent: the new loyalty-pass rule is threaded through both configuration and customer-available rule unions, and the custom voucher reward shape is reflected in configuration, available rewards, claimed rewards, and redeem responses. The main elegance gap is that the branch widens the typed OpenAPI surface but does not widen the package's ergonomic client surface to match, so consumers using createHeadlessApiClient cannot actually exercise the new customer session-token/enrollment flows without dropping beneath the public helper.

I could not read .claude/skills/core-elegance-review/SKILL.md because it is not present in this checkout, so I applied the requested static full-diff pass and second pass directly.

Comment thread src/types/api.ts
Comment on lines 50 to +91
@@ -63,6 +79,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/headless/2025-06/{site_id}/customers/{merchant_id}/enroll": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post: operations["customers.enroll"];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new customer operations are present in the generated paths, but createHeadlessApiClient().customers still only exposes getCustomer, initializeSession, setBirthday, and subscribeToEmailMarketing. That leaves the package's primary client API unable to call enroll or createSessionToken even though the types now advertise them. Since the existing customer endpoints are mirrored in src/client.ts, this should add matching helper methods as part of the same API update.

Comment thread src/types/api.ts
Comment on lines +9007 to +9008
/** @description When `true`, the response will include a `session_token`: a short-lived token scoped to this customer, which can be handed to a browser or app to call supported headless API endpoints directly on behalf of the customer */
include_session_token?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new include_session_token query option is not reachable through createHeadlessApiClient().customers.initializeSession: that helper accepts only cart, session, and customer, and it never sends params.query. As written, callers using the high-level client can see session_token?: SessionTokenStruct in the response type but have no way to request it through the intended helper path.

@loyaltylion-minerva loyaltylion-minerva Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous feedback about the high-level client surface remains unresolved, so I left those threads open and did not repeat them below. The new scope additions mostly fit the session-token model, but they add one new contract mismatch around the documented insufficient_scope error shape.

Comment thread src/types/schemas.ts
Comment on lines +5435 to +5443
* @description The scopes this session token holds, which bound the endpoints it can call. Requests to an endpoint requiring a scope the token does not hold fail with a 403 `insufficient_scope` error code
* @example [
* "read",
* "profile",
* "redeem",
* "rules"
* ]
*/
scopes: ("read" | "profile" | "redeem" | "rules")[];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now documents insufficient_scope as a 403 error code, but the generated operation types still model every 403 response as { error: { message: string; details?: ... } } with no code field. That leaves callers unable to type-narrow the exact error the token contract tells them to handle. The scope change should also update the relevant 403 response schema(s) to include code: "insufficient_scope" wherever session tokens can hit scope-gated endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant