@doswiftly/storefront-operations 22.5.1 → 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 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.5.1
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,46 @@
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
+
3
44
  ## 22.5.1
4
45
 
5
46
  ### Patch 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
@@ -1,6 +1,6 @@
1
1
  # DoSwiftly Storefront Operations — Full Reference
2
2
 
3
- > Schema version: **22.5.1**
3
+ > Schema version: **22.6.0**
4
4
  > 52 queries · 44 mutations · 105 fragments
5
5
 
6
6
  Auto-generated from `.graphql` source files. Do not edit by hand — this file is
package/operations.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": "22.5.1",
2
+ "schemaVersion": "22.6.0",
3
3
  "queries": [
4
4
  {
5
5
  "name": "Shop",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doswiftly/storefront-operations",
3
- "version": "22.5.1",
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": "./codegen.js",
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",