fontdue-js 3.0.5 → 3.1.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/__generated__/FeatureTesterCard_fontStyle.graphql.d.ts +23 -0
  3. package/dist/__generated__/FeatureTesterCard_fontStyle.graphql.js +62 -0
  4. package/dist/__generated__/FeatureTesterStandaloneQuery.graphql.d.ts +25 -0
  5. package/dist/__generated__/FeatureTesterStandaloneQuery.graphql.js +240 -0
  6. package/dist/__generated__/FeatureTestersIdQuery.graphql.d.ts +21 -0
  7. package/dist/__generated__/FeatureTestersIdQuery.graphql.js +344 -0
  8. package/dist/__generated__/FeatureTestersSlugQuery.graphql.d.ts +25 -0
  9. package/dist/__generated__/FeatureTestersSlugQuery.graphql.js +364 -0
  10. package/dist/__generated__/FeatureTesters_collection.graphql.d.ts +39 -0
  11. package/dist/__generated__/FeatureTesters_collection.graphql.js +145 -0
  12. package/dist/__generated__/NodePasswordFormAccessNodeMutation.graphql.d.ts +2 -1
  13. package/dist/__generated__/NodePasswordFormAccessNodeMutation.graphql.js +10 -4
  14. package/dist/__generated__/NodePasswordFormElementIDQuery.graphql.d.ts +21 -0
  15. package/dist/__generated__/NodePasswordFormElementIDQuery.graphql.js +86 -0
  16. package/dist/__generated__/NodePasswordFormElementSlugQuery.graphql.d.ts +25 -0
  17. package/dist/__generated__/NodePasswordFormElementSlugQuery.graphql.js +108 -0
  18. package/dist/__generated__/TypeTestersIDQuery.graphql.d.ts +1 -1
  19. package/dist/__generated__/TypeTestersIDQuery.graphql.js +9 -3
  20. package/dist/__generated__/TypeTestersRefetchQuery.graphql.d.ts +1 -1
  21. package/dist/__generated__/TypeTestersRefetchQuery.graphql.js +10 -4
  22. package/dist/__generated__/TypeTestersSlugQuery.graphql.d.ts +1 -1
  23. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +9 -3
  24. package/dist/__generated__/TypeTesters_collection.graphql.d.ts +2 -1
  25. package/dist/__generated__/TypeTesters_collection.graphql.js +8 -2
  26. package/dist/__tests__/createFontdueFetch.test.js +128 -4
  27. package/dist/__tests__/highlight.test.js +141 -0
  28. package/dist/__tests__/middleware.test.js +132 -0
  29. package/dist/components/FeatureTester/FeatureTesterCard.d.ts +30 -0
  30. package/dist/components/FeatureTester/FeatureTesterCard.js +167 -0
  31. package/dist/components/FeatureTester/FeatureTesterElement.d.ts +19 -0
  32. package/dist/components/FeatureTester/FeatureTesterElement.js +42 -0
  33. package/dist/components/FeatureTester/FeatureTesters.d.ts +43 -0
  34. package/dist/components/FeatureTester/FeatureTesters.js +156 -0
  35. package/dist/components/FeatureTester/FeatureTesters.server.d.ts +9 -0
  36. package/dist/components/FeatureTester/FeatureTesters.server.js +40 -0
  37. package/dist/components/FeatureTester/FeatureTestersElement.d.ts +10 -0
  38. package/dist/components/FeatureTester/FeatureTestersElement.js +27 -0
  39. package/dist/components/FeatureTester/highlight.d.ts +19 -0
  40. package/dist/components/FeatureTester/highlight.js +71 -0
  41. package/dist/components/FeatureTester/index.d.ts +26 -0
  42. package/dist/components/FeatureTester/index.js +66 -0
  43. package/dist/components/FeatureTester/index.server.d.ts +7 -0
  44. package/dist/components/FeatureTester/index.server.js +30 -0
  45. package/dist/components/NodePasswordForm/NodePasswordFormElement.d.ts +3 -0
  46. package/dist/components/NodePasswordForm/NodePasswordFormElement.js +65 -0
  47. package/dist/components/NodePasswordForm/index.d.ts +16 -1
  48. package/dist/components/NodePasswordForm/index.js +30 -59
  49. package/dist/components/Root/index.js +2 -1
  50. package/dist/components/TypeTesters/index.js +5 -1
  51. package/dist/fontdue.css +145 -0
  52. package/dist/hooks/useFeatureTesterAutofit.d.ts +17 -0
  53. package/dist/hooks/useFeatureTesterAutofit.js +106 -0
  54. package/dist/next/index.d.ts +2 -0
  55. package/dist/next/index.js +16 -1
  56. package/dist/next/registerSingleTenantResolver.js +13 -1
  57. package/dist/next/tenant.d.ts +1 -0
  58. package/dist/next/tenant.js +27 -2
  59. package/dist/nodeAccess.d.ts +18 -0
  60. package/dist/nodeAccess.js +84 -0
  61. package/dist/preview/server.d.ts +1 -20
  62. package/dist/preview/server.js +16 -85
  63. package/dist/relay/environment.js +8 -2
  64. package/dist/relay/serverConfig.d.ts +3 -0
  65. package/dist/relay/serverConfig.js +22 -1
  66. package/dist/server/index.d.ts +8 -0
  67. package/dist/server/index.js +90 -7
  68. package/dist/server/middleware.d.ts +37 -0
  69. package/dist/server/middleware.js +144 -0
  70. package/package.json +8 -2
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @generated SignedSource<<b5b872a45d8e38f1905efd817d33f729>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ const node = function () {
12
+ var v0 = [{
13
+ "defaultValue": null,
14
+ "kind": "LocalArgument",
15
+ "name": "collectionId"
16
+ }],
17
+ v1 = [{
18
+ "kind": "Variable",
19
+ "name": "id",
20
+ "variableName": "collectionId"
21
+ }],
22
+ v2 = {
23
+ "alias": null,
24
+ "args": null,
25
+ "kind": "ScalarField",
26
+ "name": "id",
27
+ "storageKey": null
28
+ };
29
+ return {
30
+ "fragment": {
31
+ "argumentDefinitions": v0 /*: any*/,
32
+ "kind": "Fragment",
33
+ "metadata": null,
34
+ "name": "NodePasswordFormElementIDQuery",
35
+ "selections": [{
36
+ "kind": "CatchField",
37
+ "field": {
38
+ "alias": "collection",
39
+ "args": v1 /*: any*/,
40
+ "concreteType": null,
41
+ "kind": "LinkedField",
42
+ "name": "node",
43
+ "plural": false,
44
+ "selections": [v2 /*: any*/],
45
+ "storageKey": null
46
+ },
47
+ "to": "RESULT",
48
+ "path": "collection"
49
+ }],
50
+ "type": "RootQueryType",
51
+ "abstractKey": null
52
+ },
53
+ "kind": "Request",
54
+ "operation": {
55
+ "argumentDefinitions": v0 /*: any*/,
56
+ "kind": "Operation",
57
+ "name": "NodePasswordFormElementIDQuery",
58
+ "selections": [{
59
+ "alias": "collection",
60
+ "args": v1 /*: any*/,
61
+ "concreteType": null,
62
+ "kind": "LinkedField",
63
+ "name": "node",
64
+ "plural": false,
65
+ "selections": [{
66
+ "alias": null,
67
+ "args": null,
68
+ "kind": "ScalarField",
69
+ "name": "__typename",
70
+ "storageKey": null
71
+ }, v2 /*: any*/],
72
+ "storageKey": null
73
+ }]
74
+ },
75
+ "params": {
76
+ "cacheID": "c41065c50841d1bdce6230e2b450a07e",
77
+ "id": null,
78
+ "metadata": {},
79
+ "name": "NodePasswordFormElementIDQuery",
80
+ "operationKind": "query",
81
+ "text": "query NodePasswordFormElementIDQuery(\n $collectionId: ID!\n) {\n collection: node(id: $collectionId) {\n __typename\n id\n }\n}\n"
82
+ }
83
+ };
84
+ }();
85
+ node.hash = "213a61ae079e4f57b7b197b0d2f5256a";
86
+ export default node;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @generated SignedSource<<ced3630de7c010a0f139c2788e5d6a86>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+ import { ConcreteRequest } from 'relay-runtime';
7
+ import { Result } from "relay-runtime";
8
+ export type NodePasswordFormElementSlugQuery$variables = {
9
+ collectionSlug: string;
10
+ };
11
+ export type NodePasswordFormElementSlugQuery$data = {
12
+ readonly viewer: {
13
+ readonly slug: {
14
+ readonly collection: Result<{
15
+ readonly id: string;
16
+ } | null, ReadonlyArray<unknown>>;
17
+ } | null;
18
+ };
19
+ };
20
+ export type NodePasswordFormElementSlugQuery = {
21
+ response: NodePasswordFormElementSlugQuery$data;
22
+ variables: NodePasswordFormElementSlugQuery$variables;
23
+ };
24
+ declare const node: ConcreteRequest;
25
+ export default node;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @generated SignedSource<<ced3630de7c010a0f139c2788e5d6a86>>
3
+ * @lightSyntaxTransform
4
+ * @nogrep
5
+ */
6
+
7
+ /* tslint:disable */
8
+ /* eslint-disable */
9
+ // @ts-nocheck
10
+
11
+ const node = function () {
12
+ var v0 = [{
13
+ "defaultValue": null,
14
+ "kind": "LocalArgument",
15
+ "name": "collectionSlug"
16
+ }],
17
+ v1 = [{
18
+ "kind": "Variable",
19
+ "name": "name",
20
+ "variableName": "collectionSlug"
21
+ }],
22
+ v2 = {
23
+ "alias": null,
24
+ "args": null,
25
+ "kind": "ScalarField",
26
+ "name": "id",
27
+ "storageKey": null
28
+ },
29
+ v3 = {
30
+ "alias": "collection",
31
+ "args": null,
32
+ "concreteType": "FontCollection",
33
+ "kind": "LinkedField",
34
+ "name": "fontCollection",
35
+ "plural": false,
36
+ "selections": [v2 /*: any*/],
37
+ "storageKey": null
38
+ };
39
+ return {
40
+ "fragment": {
41
+ "argumentDefinitions": v0 /*: any*/,
42
+ "kind": "Fragment",
43
+ "metadata": null,
44
+ "name": "NodePasswordFormElementSlugQuery",
45
+ "selections": [{
46
+ "alias": null,
47
+ "args": null,
48
+ "concreteType": "Viewer",
49
+ "kind": "LinkedField",
50
+ "name": "viewer",
51
+ "plural": false,
52
+ "selections": [{
53
+ "alias": null,
54
+ "args": v1 /*: any*/,
55
+ "concreteType": "Slug",
56
+ "kind": "LinkedField",
57
+ "name": "slug",
58
+ "plural": false,
59
+ "selections": [{
60
+ "kind": "CatchField",
61
+ "field": v3 /*: any*/,
62
+ "to": "RESULT",
63
+ "path": "viewer.slug.collection"
64
+ }],
65
+ "storageKey": null
66
+ }],
67
+ "storageKey": null
68
+ }],
69
+ "type": "RootQueryType",
70
+ "abstractKey": null
71
+ },
72
+ "kind": "Request",
73
+ "operation": {
74
+ "argumentDefinitions": v0 /*: any*/,
75
+ "kind": "Operation",
76
+ "name": "NodePasswordFormElementSlugQuery",
77
+ "selections": [{
78
+ "alias": null,
79
+ "args": null,
80
+ "concreteType": "Viewer",
81
+ "kind": "LinkedField",
82
+ "name": "viewer",
83
+ "plural": false,
84
+ "selections": [{
85
+ "alias": null,
86
+ "args": v1 /*: any*/,
87
+ "concreteType": "Slug",
88
+ "kind": "LinkedField",
89
+ "name": "slug",
90
+ "plural": false,
91
+ "selections": [v3 /*: any*/, v2 /*: any*/],
92
+ "storageKey": null
93
+ }, v2 /*: any*/],
94
+ "storageKey": null
95
+ }]
96
+ },
97
+ "params": {
98
+ "cacheID": "a2d0f6a8f2a084cccbb21e430138963f",
99
+ "id": null,
100
+ "metadata": {},
101
+ "name": "NodePasswordFormElementSlugQuery",
102
+ "operationKind": "query",
103
+ "text": "query NodePasswordFormElementSlugQuery(\n $collectionSlug: String!\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n id\n }\n id\n }\n id\n }\n}\n"
104
+ }
105
+ };
106
+ }();
107
+ node.hash = "200a33ca6a1f9e4e7e95b7100bbdd261";
108
+ export default node;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<815340c80adbf3bc8af6c59ba197d147>>
2
+ * @generated SignedSource<<88dc34765b9026741617ac2fa4e2f1f2>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<815340c80adbf3bc8af6c59ba197d147>>
2
+ * @generated SignedSource<<88dc34765b9026741617ac2fa4e2f1f2>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -259,6 +259,12 @@ const node = function () {
259
259
  "kind": "ScalarField",
260
260
  "name": "direction",
261
261
  "storageKey": null
262
+ }, {
263
+ "alias": null,
264
+ "args": null,
265
+ "kind": "ScalarField",
266
+ "name": "alignment",
267
+ "storageKey": null
262
268
  }, {
263
269
  "alias": null,
264
270
  "args": null,
@@ -535,12 +541,12 @@ const node = function () {
535
541
  }]
536
542
  },
537
543
  "params": {
538
- "cacheID": "f6b0d425b91df861af9f486526b12d4c",
544
+ "cacheID": "02ec4cd5a630f5057090c61c7083876f",
539
545
  "id": null,
540
546
  "metadata": {},
541
547
  "name": "TypeTestersIDQuery",
542
548
  "operationKind": "query",
543
- "text": "query TypeTestersIDQuery(\n $collectionId: ID!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n collection: node(id: $collectionId) {\n __typename\n ...TypeTesters_collection_4Goyz5\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_3BtHDv on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_3BtHDv\n id\n priceWithLicenseOptions: price(licenseOptions: [], orderVariables: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_3BtHDv on FontCollection {\n ...PriceBarSection_node_3BtHDv\n parent {\n ...PriceBarSection_node_3BtHDv\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_3BtHDv on Sku {\n id\n price(licenseOptions: [], orderVariables: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_3BtHDv on Sku {\n id\n ...SKUPrice_sku_3BtHDv\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_3BtHDv on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_3BtHDv\n ...SKUPrice_sku_3BtHDv\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_4Goyz5 on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n fontStyle {\n ...TypeTester_fontStyle_3BtHDv\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_3BtHDv\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_3BtHDv\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
549
+ "text": "query TypeTestersIDQuery(\n $collectionId: ID!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n collection: node(id: $collectionId) {\n __typename\n ...TypeTesters_collection_4Goyz5\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_3BtHDv on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_3BtHDv\n id\n priceWithLicenseOptions: price(licenseOptions: [], orderVariables: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_3BtHDv on FontCollection {\n ...PriceBarSection_node_3BtHDv\n parent {\n ...PriceBarSection_node_3BtHDv\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_3BtHDv on Sku {\n id\n price(licenseOptions: [], orderVariables: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_3BtHDv on Sku {\n id\n ...SKUPrice_sku_3BtHDv\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_3BtHDv on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_3BtHDv\n ...SKUPrice_sku_3BtHDv\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_4Goyz5 on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_3BtHDv\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_3BtHDv\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_3BtHDv\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
544
550
  }
545
551
  };
546
552
  }();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<f83e94ff9d88fd3beed82d281882eeab>>
2
+ * @generated SignedSource<<62f548d9e0d84264ff2209638fedead7>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<f83e94ff9d88fd3beed82d281882eeab>>
2
+ * @generated SignedSource<<62f548d9e0d84264ff2209638fedead7>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -270,6 +270,12 @@ const node = function () {
270
270
  "kind": "ScalarField",
271
271
  "name": "direction",
272
272
  "storageKey": null
273
+ }, {
274
+ "alias": null,
275
+ "args": null,
276
+ "kind": "ScalarField",
277
+ "name": "alignment",
278
+ "storageKey": null
273
279
  }, {
274
280
  "alias": null,
275
281
  "args": null,
@@ -546,14 +552,14 @@ const node = function () {
546
552
  }]
547
553
  },
548
554
  "params": {
549
- "cacheID": "004aa7704a62b6138f2a2fde0326aa98",
555
+ "cacheID": "59e028e888bc3fea5f795b8b4844c543",
550
556
  "id": null,
551
557
  "metadata": {},
552
558
  "name": "TypeTestersRefetchQuery",
553
559
  "operationKind": "query",
554
- "text": "query TypeTestersRefetchQuery(\n $excludeTags: [String!] = null\n $licenseOptions: [LicenseOptionsSpec] = []\n $orderVariables: [OrderVariableSelectionInput!] = []\n $tags: [String!] = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TypeTesters_collection_32it0Z\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_4sncub on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_4sncub\n id\n priceWithLicenseOptions: price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_4sncub on FontCollection {\n ...PriceBarSection_node_4sncub\n parent {\n ...PriceBarSection_node_4sncub\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_4sncub on Sku {\n id\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_4sncub on Sku {\n id\n ...SKUPrice_sku_4sncub\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_4sncub on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_4sncub\n ...SKUPrice_sku_4sncub\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_32it0Z on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n fontStyle {\n ...TypeTester_fontStyle_4sncub\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_4sncub\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_4sncub\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
560
+ "text": "query TypeTestersRefetchQuery(\n $excludeTags: [String!] = null\n $licenseOptions: [LicenseOptionsSpec] = []\n $orderVariables: [OrderVariableSelectionInput!] = []\n $tags: [String!] = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TypeTesters_collection_32it0Z\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_4sncub on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_4sncub\n id\n priceWithLicenseOptions: price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: $licenseOptions) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_4sncub on FontCollection {\n ...PriceBarSection_node_4sncub\n parent {\n ...PriceBarSection_node_4sncub\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_4sncub on Sku {\n id\n price(licenseOptions: $licenseOptions, orderVariables: $orderVariables) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_4sncub on Sku {\n id\n ...SKUPrice_sku_4sncub\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_4sncub on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_4sncub\n ...SKUPrice_sku_4sncub\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_32it0Z on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_4sncub\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_4sncub\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_4sncub\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
555
561
  }
556
562
  };
557
563
  }();
558
- node.hash = "0f8422550dd500368594bfedc5f58bf4";
564
+ node.hash = "b247a9b03142716823d36ec52dd965ff";
559
565
  export default node;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<a94d6158d79c64567c40e76f81d7008d>>
2
+ * @generated SignedSource<<5fedd7461fe752fd8dd8746cf2a872c9>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<a94d6158d79c64567c40e76f81d7008d>>
2
+ * @generated SignedSource<<5fedd7461fe752fd8dd8746cf2a872c9>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -283,6 +283,12 @@ const node = function () {
283
283
  "kind": "ScalarField",
284
284
  "name": "direction",
285
285
  "storageKey": null
286
+ }, {
287
+ "alias": null,
288
+ "args": null,
289
+ "kind": "ScalarField",
290
+ "name": "alignment",
291
+ "storageKey": null
286
292
  }, {
287
293
  "alias": null,
288
294
  "args": null,
@@ -560,12 +566,12 @@ const node = function () {
560
566
  }]
561
567
  },
562
568
  "params": {
563
- "cacheID": "1e8ea8e801f6c97ced8499dc87a6afad",
569
+ "cacheID": "eb0a798a6667c9083085bd38105fb643",
564
570
  "id": null,
565
571
  "metadata": {},
566
572
  "name": "TypeTestersSlugQuery",
567
573
  "operationKind": "query",
568
- "text": "query TypeTestersSlugQuery(\n $collectionSlug: String!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n ...TypeTesters_collection_4Goyz5\n id\n }\n id\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_3BtHDv on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_3BtHDv\n id\n priceWithLicenseOptions: price(licenseOptions: [], orderVariables: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_3BtHDv on FontCollection {\n ...PriceBarSection_node_3BtHDv\n parent {\n ...PriceBarSection_node_3BtHDv\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_3BtHDv on Sku {\n id\n price(licenseOptions: [], orderVariables: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_3BtHDv on Sku {\n id\n ...SKUPrice_sku_3BtHDv\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_3BtHDv on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_3BtHDv\n ...SKUPrice_sku_3BtHDv\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_4Goyz5 on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n fontStyle {\n ...TypeTester_fontStyle_3BtHDv\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_3BtHDv\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_3BtHDv\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
574
+ "text": "query TypeTestersSlugQuery(\n $collectionSlug: String!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n ...TypeTesters_collection_4Goyz5\n id\n }\n id\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n ...useFontStyle_fontStyle\n}\n\nfragment PriceBarSection_node_3BtHDv on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_3BtHDv\n id\n priceWithLicenseOptions: price(licenseOptions: [], orderVariables: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node_3BtHDv on FontCollection {\n ...PriceBarSection_node_3BtHDv\n parent {\n ...PriceBarSection_node_3BtHDv\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_3BtHDv on Sku {\n id\n price(licenseOptions: [], orderVariables: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_3BtHDv on Sku {\n id\n ...SKUPrice_sku_3BtHDv\n}\n\nfragment TypeTesterFeaturesButton_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterToolbar_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesterStyleSelectData_fontStyle on FontStyle {\n id\n name\n supportedLanguages\n cssWeight\n cssStyle\n cssStretch\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n family {\n id\n name\n }\n}\n\nfragment TypeTesterToolbar_fontStyle on FontStyle {\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterFeaturesButton_fontStyle\n}\n\nfragment TypeTesterVariableAxes_fontStyle on FontStyle {\n variableAxes {\n axis\n name\n minValue\n maxValue\n }\n}\n\nfragment TypeTester_fontStyle_3BtHDv on FontStyle {\n id\n ...TypeTesterFeatures_fontStyle\n ...TypeTesterStyleSelectData_fontStyle\n ...FontStyle_fontStyle\n ...TypeTesterVariableAxes_fontStyle\n ...TypeTesterToolbar_fontStyle\n sku {\n ...SelectButton_sku_3BtHDv\n ...SKUPrice_sku_3BtHDv\n id\n basePrice: price {\n amount\n }\n }\n}\n\nfragment TypeTesters_collection_4Goyz5 on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n letterSpacing\n autofit\n direction\n alignment\n fontStyle {\n ...TypeTester_fontStyle_3BtHDv\n id\n family {\n id\n }\n }\n variableSettings {\n axis\n value\n }\n featureSettings {\n feature\n value\n }\n tags\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n typeTesterAxes\n id\n ...PriceBar_node_3BtHDv\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node_3BtHDv\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment useFontStyle_fontStyle on FontStyle {\n cssFamily\n name\n webfontSources {\n url\n format\n tech\n }\n verticalMetrics {\n unitsPerEm\n ascender\n descender\n lineGap\n avgCharWidth\n }\n}\n"
569
575
  }
570
576
  };
571
577
  }();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<75efdd64f4cf6c5d2378da307264aa2c>>
2
+ * @generated SignedSource<<db8e340a34a78571fc6801ac096bd540>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -19,6 +19,7 @@ export type TypeTesters_collection$data = {
19
19
  readonly typeTesters: {
20
20
  readonly edges: ReadonlyArray<{
21
21
  readonly node: {
22
+ readonly alignment: string | null;
22
23
  readonly autofit: boolean | null;
23
24
  readonly content: string | null;
24
25
  readonly direction: string | null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<75efdd64f4cf6c5d2378da307264aa2c>>
2
+ * @generated SignedSource<<db8e340a34a78571fc6801ac096bd540>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -139,6 +139,12 @@ const node = function () {
139
139
  "kind": "ScalarField",
140
140
  "name": "direction",
141
141
  "storageKey": null
142
+ }, {
143
+ "alias": null,
144
+ "args": null,
145
+ "kind": "ScalarField",
146
+ "name": "alignment",
147
+ "storageKey": null
142
148
  }, {
143
149
  "alias": null,
144
150
  "args": null,
@@ -246,5 +252,5 @@ const node = function () {
246
252
  "abstractKey": null
247
253
  };
248
254
  }();
249
- node.hash = "0f8422550dd500368594bfedc5f58bf4";
255
+ node.hash = "b247a9b03142716823d36ec52dd965ff";
250
256
  export default node;
@@ -1,15 +1,20 @@
1
1
  import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
2
- import { createFontdueFetch, FontdueNotFoundError } from '../server/index.js';
3
- import { registerAmbientConfigResolver } from '../relay/serverConfig.js';
2
+ import { createFontdueFetch, FontdueNotFoundError, FontduePasswordProtectedError } from '../server/index.js';
3
+ import { registerAmbientConfigResolver, registerNodeAccessRecovery } from '../relay/serverConfig.js';
4
+ import * as serverConfig from '../relay/serverConfig.js';
5
+ import { NODE_ACCESS_HEADER } from '../nodeAccess.js';
4
6
  beforeEach(() => {
5
7
  vi.unstubAllEnvs();
6
8
  vi.unstubAllGlobals();
7
9
  });
8
10
 
9
11
  // Several tests inject a per-render config through the ambient resolver seam
10
- // (the same seam runWithPreview and the Next slot use). Always clear it.
12
+ // (the same seam runWithPreview and the Next slot use) or register a node-access
13
+ // recovery. The store (resolver + recovery) is anchored on globalThis, so wipe
14
+ // it — and restore any spies — so registrations can't leak between tests.
11
15
  afterEach(() => {
12
- registerAmbientConfigResolver(() => undefined);
16
+ vi.restoreAllMocks();
17
+ delete globalThis.__fontdueServerConfigStore__;
13
18
  });
14
19
  function withConfig(config) {
15
20
  registerAmbientConfigResolver(() => config);
@@ -273,4 +278,123 @@ describe('createFontdueFetch', () => {
273
278
  expect(init.headers['fontdue-preview']).toBe('true');
274
279
  });
275
280
  });
281
+
282
+ // A password-protected collection comes back as a `password_protected` error.
283
+ // In a server render the Next adapter registers a recovery that reads the
284
+ // visitor's node-access cookie; createFontdueFetch folds the token into the
285
+ // per-render config (so the page fetch AND the embedded RSC components' own
286
+ // Suspense preloads resolve) and retries. No recovery / no token → the error
287
+ // propagates so the page can render the password form.
288
+ describe('node-access recovery (password-protected → Next adapter)', () => {
289
+ const locked = () => ({
290
+ status: 200,
291
+ json: async () => ({
292
+ errors: [{
293
+ message: 'locked',
294
+ code: 'password_protected'
295
+ }]
296
+ })
297
+ });
298
+ it('folds the unlock token into the per-render config and retries', async () => {
299
+ var _foldedConfig$headers;
300
+ vi.stubEnv('NODE_ENV', 'production');
301
+ // Stand-in for the Next adapter's cookie read.
302
+ registerNodeAccessRecovery(() => ({
303
+ [NODE_ACCESS_HEADER]: 'na-tok'
304
+ }));
305
+ // The per-render slot the embeds read (set by __prepareFontdueRender).
306
+ withConfig({
307
+ url: 'https://tenant.fontdue.com',
308
+ cacheTags: ['graphql:tenant.fontdue.com']
309
+ });
310
+ // The embeds (createNetworkFetch) read the slot, so the recovered token
311
+ // must be folded there — this is the assertion that proves they resolve.
312
+ const folded = vi.spyOn(serverConfig, 'setFontdueServerConfig');
313
+ let call = 0;
314
+ const fetchMock = mockFetch(() => {
315
+ call += 1;
316
+ return call === 1 ? locked() : {
317
+ status: 200,
318
+ json: async () => ({
319
+ data: {
320
+ ok: true
321
+ }
322
+ })
323
+ };
324
+ });
325
+ const data = await createFontdueFetch()('Font', 'query Font { ok }');
326
+ expect(data).toEqual({
327
+ ok: true
328
+ });
329
+ expect(fetchMock).toHaveBeenCalledTimes(2);
330
+ expect(folded).toHaveBeenCalledTimes(1);
331
+ const foldedConfig = folded.mock.calls[0][0];
332
+ expect((_foldedConfig$headers = foldedConfig.headers) === null || _foldedConfig$headers === void 0 ? void 0 : _foldedConfig$headers[NODE_ACCESS_HEADER]).toBe('na-tok');
333
+ // Dropped so the per-visitor unlocked render is never cached.
334
+ expect(foldedConfig.cacheTags).toBeUndefined();
335
+ });
336
+ it('rethrows FontduePasswordProtectedError when the visitor has no token', async () => {
337
+ registerNodeAccessRecovery(() => ({}));
338
+ mockFetch(locked);
339
+ await expect(createFontdueFetch({
340
+ url: 'https://acme.fontdue.com'
341
+ })('Font', 'query Font { ok }')).rejects.toBeInstanceOf(FontduePasswordProtectedError);
342
+ });
343
+ it('rethrows FontduePasswordProtectedError when no recovery is registered (non-Next)', async () => {
344
+ mockFetch(locked);
345
+ await expect(createFontdueFetch({
346
+ url: 'https://acme.fontdue.com'
347
+ })('Font', 'query Font { ok }')).rejects.toBeInstanceOf(FontduePasswordProtectedError);
348
+ });
349
+ it('detects password_protected even when it is not the first error', async () => {
350
+ const multiLocked = () => ({
351
+ status: 200,
352
+ json: async () => ({
353
+ errors: [{
354
+ message: 'other field failed',
355
+ code: 'something_else'
356
+ }, {
357
+ message: 'locked',
358
+ code: 'password_protected'
359
+ }]
360
+ })
361
+ });
362
+ registerNodeAccessRecovery(() => ({}));
363
+ mockFetch(multiLocked);
364
+ await expect(createFontdueFetch({
365
+ url: 'https://acme.fontdue.com'
366
+ })('Font', 'query Font { ok }')).rejects.toBeInstanceOf(FontduePasswordProtectedError);
367
+ });
368
+ it('does not force-cache the retried unlocked render even when the fetcher was given explicit cacheTags', async () => {
369
+ vi.stubEnv('NODE_ENV', 'production');
370
+ registerNodeAccessRecovery(() => ({
371
+ [NODE_ACCESS_HEADER]: 'na-tok'
372
+ }));
373
+ let call = 0;
374
+ const fetchMock = mockFetch(() => {
375
+ call += 1;
376
+ return call === 1 ? locked() : {
377
+ status: 200,
378
+ json: async () => ({
379
+ data: {
380
+ ok: true
381
+ }
382
+ })
383
+ };
384
+ });
385
+
386
+ // The explicit option would otherwise win over the config's dropped tags.
387
+ const data = await createFontdueFetch({
388
+ url: 'https://tenant.fontdue.com',
389
+ cacheTags: ['graphql:tenant.fontdue.com']
390
+ })('Font', 'query Font { ok }');
391
+ expect(data).toEqual({
392
+ ok: true
393
+ });
394
+ expect(fetchMock).toHaveBeenCalledTimes(2);
395
+ const retryInit = fetchMock.mock.calls[1][1];
396
+ expect(retryInit.cache).not.toBe('force-cache');
397
+ expect(retryInit.next).toBeUndefined();
398
+ });
399
+ });
276
400
  });