@doswiftly/storefront-operations 22.5.0 → 22.6.0
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/AGENTS.md +1 -1
- package/CHANGELOG.md +47 -0
- package/codegen.d.ts +47 -0
- package/llms-full.txt +1 -1
- package/operations.json +1 -1
- package/package.json +6 -2
- package/schema.graphql +2 -2
package/AGENTS.md
CHANGED
|
@@ -27,7 +27,7 @@ consumer's `codegen.ts` references this package's `.graphql` files as
|
|
|
27
27
|
live in the consumer's repo.
|
|
28
28
|
|
|
29
29
|
<!-- AUTOGEN:STATS:BEGIN — auto-regenerated, do not edit by hand -->
|
|
30
|
-
- **Schema version**: 22.
|
|
30
|
+
- **Schema version**: 22.6.0
|
|
31
31
|
- **Queries**: 52
|
|
32
32
|
- **Mutations**: 44
|
|
33
33
|
- **Fragments**: 105
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 22.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b1e622d: Add a zero-config Next.js image loader. Re-export `createImageLoader()` from the new
|
|
8
|
+
`@doswiftly/storefront-sdk/next` entry in your `images.loaderFile` and every `<Image>`
|
|
9
|
+
is routed through the image CDN: product images get a real responsive `srcset` (a width
|
|
10
|
+
per entry, so you can drop `transform: { maxWidth }`) and local `public/` images are
|
|
11
|
+
resized and format-negotiated (AVIF/WebP) instead of shipped at full size. Build assets,
|
|
12
|
+
external / protocol-relative URLs and `data:` URIs pass through untouched, and
|
|
13
|
+
`<Image quality>` is a no-op (quality is applied server-side; the format is auto-negotiated). The pure
|
|
14
|
+
`buildImageLoaderUrl` helper is also exported from the package root for non-`<Image>` use.
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// lib/image-loader.ts
|
|
20
|
+
import { createImageLoader } from "@doswiftly/storefront-sdk/next";
|
|
21
|
+
export default createImageLoader();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// next.config.ts — bound the generated widths for fewer transforms / better cache hits
|
|
26
|
+
export default {
|
|
27
|
+
images: {
|
|
28
|
+
loader: "custom",
|
|
29
|
+
loaderFile: "./lib/image-loader.ts",
|
|
30
|
+
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
|
31
|
+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Migration:
|
|
37
|
+
- New install — nothing to do; existing `<Image>` usage keeps working.
|
|
38
|
+
- Optional — drop `transform: { maxWidth }` from product-image queries; the loader now sets the width per `srcset` entry.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 91c3b25: Ship TypeScript types for the codegen recipe (`@doswiftly/storefront-operations/codegen`). A `codegen.ts` that imports `createCodegenConfig` now type-checks under `strict` mode, so `next build` no longer fails with a missing-declaration (implicit `any`) error on the recipe import.
|
|
43
|
+
|
|
44
|
+
## 22.5.1
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- 6ca2a5f: Corrected the GraphQL schema descriptions for the `CartStatus` enum and the `Cart.status` field so they match the cart's actual behaviour: an `ABANDONED` cart is revived in place by any deliberate buyer edit (it is not locked), editing an `EXPIRED` cart returns `CART_NOT_FOUND`, and only `CONVERTED` / completed carts return `ALREADY_COMPLETED`. Documentation only — no type or API changes.
|
|
49
|
+
|
|
3
50
|
## 22.5.0
|
|
4
51
|
|
|
5
52
|
### Minor Changes
|
package/codegen.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link createCodegenConfig}.
|
|
5
|
+
*/
|
|
6
|
+
export interface CreateCodegenConfigOptions {
|
|
7
|
+
/** Glob(s) pointing at the files where you write your GraphQL operations (`gql(...)`). */
|
|
8
|
+
documents: string | string[];
|
|
9
|
+
/** Output directory for the generated code. Defaults to `./src/gql/`. */
|
|
10
|
+
outDir?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the generated operation tag. Defaults to `gql`. Override (e.g.
|
|
13
|
+
* `'graphql'`) when your project already imports a `gql` from another GraphQL
|
|
14
|
+
* client (Apollo, urql, graphql-request) to avoid a name clash.
|
|
15
|
+
*/
|
|
16
|
+
gqlTagName?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Build a `graphql-codegen` configuration (client preset + persisted documents)
|
|
21
|
+
* pointed at this package's schema. Generated operation ids use the Storefront
|
|
22
|
+
* API's trusted-document format (`sha256:<hex>`), so the published manifest is
|
|
23
|
+
* accepted verbatim and the runtime `documentId` resolves server-side, which is
|
|
24
|
+
* what lets public reads be served from cache at the edge.
|
|
25
|
+
*
|
|
26
|
+
* `export default` the result from your codegen file.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // codegen.ts
|
|
30
|
+
* import { createCodegenConfig } from '@doswiftly/storefront-operations/codegen';
|
|
31
|
+
* export default createCodegenConfig({ documents: 'src/**\/*.{ts,tsx}' });
|
|
32
|
+
*/
|
|
33
|
+
export declare function createCodegenConfig(options: CreateCodegenConfigOptions): CodegenConfig;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Compute a persisted-document id for a printed GraphQL document, in the exact
|
|
37
|
+
* format the Storefront API stores and validates: `sha256:` followed by the
|
|
38
|
+
* lowercase hex SHA-256 of the document body. Useful to assert a generated
|
|
39
|
+
* manifest matches what the API expects.
|
|
40
|
+
*
|
|
41
|
+
* @param documentBody - the printed GraphQL document (operation + its fragments).
|
|
42
|
+
* @returns `sha256:` followed by 64 hex characters.
|
|
43
|
+
*/
|
|
44
|
+
export declare function trustedDocumentHash(documentBody: string): string;
|
|
45
|
+
|
|
46
|
+
/** Absolute path to the GraphQL schema file shipped in this package. */
|
|
47
|
+
export declare const SCHEMA_PATH: string;
|
package/llms-full.txt
CHANGED
package/operations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doswiftly/storefront-operations",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.6.0",
|
|
4
4
|
"description": "GraphQL operations for DoSwiftly Storefront - SSOT from backend",
|
|
5
5
|
"homepage": "https://doswiftly.pl",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"./mutations.graphql": "./mutations.graphql",
|
|
14
14
|
"./fragments.graphql": "./fragments.graphql",
|
|
15
15
|
"./operations.json": "./operations.json",
|
|
16
|
-
"./codegen":
|
|
16
|
+
"./codegen": {
|
|
17
|
+
"types": "./codegen.d.ts",
|
|
18
|
+
"default": "./codegen.js"
|
|
19
|
+
},
|
|
17
20
|
"./*.graphql": "./*.graphql"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
@@ -35,6 +38,7 @@
|
|
|
35
38
|
"fragments.graphql",
|
|
36
39
|
"operations.json",
|
|
37
40
|
"codegen.js",
|
|
41
|
+
"codegen.d.ts",
|
|
38
42
|
"README.md",
|
|
39
43
|
"AGENTS.md",
|
|
40
44
|
"llms-full.txt",
|
package/schema.graphql
CHANGED
|
@@ -1013,7 +1013,7 @@ type Cart implements Node {
|
|
|
1013
1013
|
shippingAddress: MailingAddress
|
|
1014
1014
|
|
|
1015
1015
|
"""
|
|
1016
|
-
Lifecycle status — `ACTIVE`
|
|
1016
|
+
Lifecycle status — `ACTIVE` / `RECOVERED` are editable; `ABANDONED` is a recovery flag a deliberate buyer action revives in place; `CONVERTED` / `EXPIRED` are terminal. Check this on SSR before rendering the checkout form: a `CONVERTED` cart should redirect (typically to the order confirmation when `completedOrder` is populated) instead of presenting a form whose first mutation fails with `CartErrorCode.ALREADY_COMPLETED`.
|
|
1017
1017
|
"""
|
|
1018
1018
|
status: CartStatus!
|
|
1019
1019
|
|
|
@@ -1831,7 +1831,7 @@ type CartShippingMethod {
|
|
|
1831
1831
|
}
|
|
1832
1832
|
|
|
1833
1833
|
"""
|
|
1834
|
-
Cart lifecycle status. `ACTIVE`
|
|
1834
|
+
Cart lifecycle status. `ACTIVE` and `RECOVERED` are editable carts. `ABANDONED` flags a cart the buyer left inactive (used for recovery campaigns) — it is not locked: a deliberate buyer action revives it in place to `RECOVERED` and the mutation proceeds. `RECOVERED` is a previously-abandoned cart the buyer came back to (via a recovery link or by acting on it again). `CONVERTED` carries an associated `completedOrder`; query that to redirect the buyer to their order confirmation, since editing a converted cart returns `CartErrorCode.ALREADY_COMPLETED`. `EXPIRED` is past its lifetime with no order; editing it returns `CartErrorCode.CART_NOT_FOUND` — create a fresh cart.
|
|
1835
1835
|
"""
|
|
1836
1836
|
enum CartStatus {
|
|
1837
1837
|
ABANDONED
|