@cedarjs/web 6.0.0-canary.2780 → 6.0.0-canary.2782

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 (149) hide show
  1. package/dist/bins/cedar.js +14 -0
  2. package/dist/bins/cfw.js +14 -0
  3. package/dist/bins/cross-env.js +8 -0
  4. package/dist/bins/msw.js +6 -0
  5. package/dist/bins/redwood.js +14 -0
  6. package/dist/bins/storybook.js +27 -0
  7. package/dist/bins/tsc.js +8 -0
  8. package/dist/bundled/apollo-upload-client.js +2727 -1
  9. package/package.json +41 -110
  10. package/dist/cjs/apollo/ApolloProviderWithFetchConfig.d.ts +0 -15
  11. package/dist/cjs/apollo/ApolloProviderWithFetchConfig.d.ts.map +0 -1
  12. package/dist/cjs/apollo/ApolloProviderWithFetchConfig.js +0 -170
  13. package/dist/cjs/apollo/CedarApolloProvider.d.ts +0 -14
  14. package/dist/cjs/apollo/CedarApolloProvider.d.ts.map +0 -1
  15. package/dist/cjs/apollo/CedarApolloProvider.js +0 -69
  16. package/dist/cjs/apollo/ErrorBoundary.d.ts +0 -13
  17. package/dist/cjs/apollo/ErrorBoundary.d.ts.map +0 -1
  18. package/dist/cjs/apollo/ErrorBoundary.js +0 -47
  19. package/dist/cjs/apollo/apolloLinkTypes.d.ts +0 -60
  20. package/dist/cjs/apollo/apolloLinkTypes.d.ts.map +0 -1
  21. package/dist/cjs/apollo/apolloLinkTypes.js +0 -16
  22. package/dist/cjs/apollo/fragmentRegistry.d.ts +0 -68
  23. package/dist/cjs/apollo/fragmentRegistry.d.ts.map +0 -1
  24. package/dist/cjs/apollo/fragmentRegistry.js +0 -108
  25. package/dist/cjs/apollo/index.d.ts +0 -56
  26. package/dist/cjs/apollo/index.d.ts.map +0 -1
  27. package/dist/cjs/apollo/index.js +0 -39
  28. package/dist/cjs/apollo/links.d.ts +0 -26
  29. package/dist/cjs/apollo/links.d.ts.map +0 -1
  30. package/dist/cjs/apollo/links.js +0 -122
  31. package/dist/cjs/apollo/sseLink.d.ts +0 -26
  32. package/dist/cjs/apollo/sseLink.d.ts.map +0 -1
  33. package/dist/cjs/apollo/sseLink.js +0 -117
  34. package/dist/cjs/apollo/suspense.d.ts +0 -69
  35. package/dist/cjs/apollo/suspense.d.ts.map +0 -1
  36. package/dist/cjs/apollo/suspense.js +0 -118
  37. package/dist/cjs/apollo/useCache.d.ts +0 -20
  38. package/dist/cjs/apollo/useCache.d.ts.map +0 -1
  39. package/dist/cjs/apollo/useCache.js +0 -49
  40. package/dist/cjs/bins/cedar.d.ts +0 -9
  41. package/dist/cjs/bins/cedar.d.ts.map +0 -1
  42. package/dist/cjs/bins/cedar.js +0 -36
  43. package/dist/cjs/bins/cfw.d.ts +0 -3
  44. package/dist/cjs/bins/cfw.d.ts.map +0 -1
  45. package/dist/cjs/bins/cfw.js +0 -36
  46. package/dist/cjs/bins/cross-env.d.ts +0 -3
  47. package/dist/cjs/bins/cross-env.d.ts.map +0 -1
  48. package/dist/cjs/bins/cross-env.js +0 -30
  49. package/dist/cjs/bins/msw.d.ts +0 -3
  50. package/dist/cjs/bins/msw.d.ts.map +0 -1
  51. package/dist/cjs/bins/msw.js +0 -28
  52. package/dist/cjs/bins/redwood.d.ts +0 -9
  53. package/dist/cjs/bins/redwood.d.ts.map +0 -1
  54. package/dist/cjs/bins/redwood.js +0 -36
  55. package/dist/cjs/bins/storybook.d.ts +0 -3
  56. package/dist/cjs/bins/storybook.d.ts.map +0 -1
  57. package/dist/cjs/bins/storybook.js +0 -49
  58. package/dist/cjs/bins/tsc.d.ts +0 -3
  59. package/dist/cjs/bins/tsc.d.ts.map +0 -1
  60. package/dist/cjs/bins/tsc.js +0 -30
  61. package/dist/cjs/bundled/apollo-upload-client.d.ts +0 -3
  62. package/dist/cjs/bundled/apollo-upload-client.d.ts.map +0 -1
  63. package/dist/cjs/bundled/apollo-upload-client.js +0 -2753
  64. package/dist/cjs/components/DevFatalErrorPage.d.ts +0 -21
  65. package/dist/cjs/components/DevFatalErrorPage.d.ts.map +0 -1
  66. package/dist/cjs/components/DevFatalErrorPage.js +0 -552
  67. package/dist/cjs/components/FatalErrorBoundary.d.ts +0 -24
  68. package/dist/cjs/components/FatalErrorBoundary.d.ts.map +0 -1
  69. package/dist/cjs/components/FatalErrorBoundary.js +0 -63
  70. package/dist/cjs/components/FetchConfigProvider.d.ts +0 -26
  71. package/dist/cjs/components/FetchConfigProvider.d.ts.map +0 -1
  72. package/dist/cjs/components/FetchConfigProvider.js +0 -80
  73. package/dist/cjs/components/MetaTags.d.ts +0 -52
  74. package/dist/cjs/components/MetaTags.d.ts.map +0 -1
  75. package/dist/cjs/components/MetaTags.js +0 -68
  76. package/dist/cjs/components/Metadata.d.ts +0 -9
  77. package/dist/cjs/components/Metadata.d.ts.map +0 -1
  78. package/dist/cjs/components/Metadata.js +0 -94
  79. package/dist/cjs/components/PortalHead.d.ts +0 -4
  80. package/dist/cjs/components/PortalHead.d.ts.map +0 -1
  81. package/dist/cjs/components/PortalHead.js +0 -59
  82. package/dist/cjs/components/RedwoodProvider.d.ts +0 -9
  83. package/dist/cjs/components/RedwoodProvider.d.ts.map +0 -1
  84. package/dist/cjs/components/RedwoodProvider.js +0 -57
  85. package/dist/cjs/components/ServerInject.d.ts +0 -26
  86. package/dist/cjs/components/ServerInject.d.ts.map +0 -1
  87. package/dist/cjs/components/ServerInject.js +0 -75
  88. package/dist/cjs/components/cell/CellCacheContext.d.ts +0 -20
  89. package/dist/cjs/components/cell/CellCacheContext.d.ts.map +0 -1
  90. package/dist/cjs/components/cell/CellCacheContext.js +0 -53
  91. package/dist/cjs/components/cell/CellErrorBoundary.d.ts +0 -26
  92. package/dist/cjs/components/cell/CellErrorBoundary.d.ts.map +0 -1
  93. package/dist/cjs/components/cell/CellErrorBoundary.js +0 -66
  94. package/dist/cjs/components/cell/cellTypes.d.ts +0 -166
  95. package/dist/cjs/components/cell/cellTypes.d.ts.map +0 -1
  96. package/dist/cjs/components/cell/cellTypes.js +0 -16
  97. package/dist/cjs/components/cell/createCell.d.ts +0 -4
  98. package/dist/cjs/components/cell/createCell.d.ts.map +0 -1
  99. package/dist/cjs/components/cell/createCell.js +0 -185
  100. package/dist/cjs/components/cell/createFragmentCell.d.ts +0 -19
  101. package/dist/cjs/components/cell/createFragmentCell.d.ts.map +0 -1
  102. package/dist/cjs/components/cell/createFragmentCell.js +0 -107
  103. package/dist/cjs/components/cell/createServerCell.d.ts +0 -15
  104. package/dist/cjs/components/cell/createServerCell.d.ts.map +0 -1
  105. package/dist/cjs/components/cell/createServerCell.js +0 -91
  106. package/dist/cjs/components/cell/createSuspendingCell.d.ts +0 -11
  107. package/dist/cjs/components/cell/createSuspendingCell.d.ts.map +0 -1
  108. package/dist/cjs/components/cell/createSuspendingCell.js +0 -158
  109. package/dist/cjs/components/cell/isCellEmpty.d.ts +0 -41
  110. package/dist/cjs/components/cell/isCellEmpty.d.ts.map +0 -1
  111. package/dist/cjs/components/cell/isCellEmpty.js +0 -35
  112. package/dist/cjs/components/htmlTags.d.ts +0 -52
  113. package/dist/cjs/components/htmlTags.d.ts.map +0 -1
  114. package/dist/cjs/components/htmlTags.js +0 -88
  115. package/dist/cjs/config.d.ts +0 -2
  116. package/dist/cjs/config.d.ts.map +0 -1
  117. package/dist/cjs/config.js +0 -6
  118. package/dist/cjs/global.web-auto-imports.d.ts +0 -14
  119. package/dist/cjs/global.web-auto-imports.d.ts.map +0 -1
  120. package/dist/cjs/global.web-auto-imports.js +0 -1
  121. package/dist/cjs/graphql.d.ts +0 -23
  122. package/dist/cjs/graphql.d.ts.map +0 -1
  123. package/dist/cjs/graphql.js +0 -36
  124. package/dist/cjs/index.d.ts +0 -22
  125. package/dist/cjs/index.d.ts.map +0 -1
  126. package/dist/cjs/index.js +0 -73
  127. package/dist/cjs/package.json +0 -1
  128. package/dist/cjs/routeHooks.types.d.ts +0 -12
  129. package/dist/cjs/routeHooks.types.d.ts.map +0 -1
  130. package/dist/cjs/routeHooks.types.js +0 -16
  131. package/dist/cjs/server/MiddlewareRequest.d.ts +0 -28
  132. package/dist/cjs/server/MiddlewareRequest.d.ts.map +0 -1
  133. package/dist/cjs/server/MiddlewareRequest.js +0 -71
  134. package/dist/cjs/server/MiddlewareResponse.d.ts +0 -44
  135. package/dist/cjs/server/MiddlewareResponse.d.ts.map +0 -1
  136. package/dist/cjs/server/MiddlewareResponse.js +0 -130
  137. package/dist/cjs/server/middleware.d.ts +0 -17
  138. package/dist/cjs/server/middleware.d.ts.map +0 -1
  139. package/dist/cjs/server/middleware.js +0 -24
  140. package/dist/cjs/server/request.d.ts +0 -2
  141. package/dist/cjs/server/request.d.ts.map +0 -1
  142. package/dist/cjs/server/request.js +0 -34
  143. package/dist/cjs/streamUtils/useDocumentReady.d.ts +0 -11
  144. package/dist/cjs/streamUtils/useDocumentReady.d.ts.map +0 -1
  145. package/dist/cjs/streamUtils/useDocumentReady.js +0 -41
  146. package/dist/cjs/toast/index.d.ts +0 -3
  147. package/dist/cjs/toast/index.d.ts.map +0 -1
  148. package/dist/cjs/toast/index.js +0 -41
  149. package/dist/package.json +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/web",
3
- "version": "6.0.0-canary.2780",
3
+ "version": "6.0.0-canary.2782",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,126 +10,57 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "import": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.js"
16
- },
17
- "require": {
18
- "types": "./dist/cjs/index.d.ts",
19
- "default": "./dist/cjs/index.js"
20
- }
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
21
15
  },
22
16
  "./serverInject": {
23
- "import": {
24
- "types": "./dist/components/ServerInject.d.ts",
25
- "default": "./dist/components/ServerInject.js"
26
- },
27
- "require": {
28
- "types": "./dist/cjs/components/ServerInject.d.ts",
29
- "default": "./dist/cjs/components/ServerInject.js"
30
- }
17
+ "types": "./dist/components/ServerInject.d.ts",
18
+ "default": "./dist/components/ServerInject.js"
31
19
  },
32
20
  "./request": {
33
- "import": {
34
- "types": "./dist/server/request.d.ts",
35
- "default": "./dist/server/request.js"
36
- },
37
- "require": {
38
- "types": "./dist/cjs/server/request.d.ts",
39
- "default": "./dist/cjs/server/request.js"
40
- }
21
+ "types": "./dist/server/request.d.ts",
22
+ "default": "./dist/server/request.js"
41
23
  },
42
24
  "./middleware": {
43
- "import": {
44
- "types": "./dist/server/middleware.d.ts",
45
- "default": "./dist/server/middleware.js"
46
- },
47
- "require": {
48
- "types": "./dist/cjs/server/middleware.d.ts",
49
- "default": "./dist/cjs/server/middleware.js"
50
- }
25
+ "types": "./dist/server/middleware.d.ts",
26
+ "default": "./dist/server/middleware.js"
51
27
  },
52
28
  "./dist/server/middleware": {
53
- "import": {
54
- "types": "./dist/server/middleware.d.ts",
55
- "default": "./dist/server/middleware.js"
56
- },
57
- "require": {
58
- "types": "./dist/cjs/server/middleware.d.ts",
59
- "default": "./dist/cjs/server/middleware.js"
60
- }
61
- },
62
- "./dist/components/*": {
63
- "require": "./dist/cjs/components/*.js",
64
- "import": "./dist/components/*.js"
65
- },
66
- "./htmlTags": {
67
- "require": "./dist/cjs/components/htmlTags.js",
68
- "import": "./dist/components/htmlTags.js"
69
- },
70
- "./Metadata": {
71
- "require": "./dist/cjs/components/Metadata.js",
72
- "import": "./dist/components/Metadata.js"
73
- },
74
- "./dist/apollo/suspense": {
75
- "require": "./dist/cjs/apollo/suspense.js",
76
- "import": "./dist/apollo/suspense.js"
77
- },
78
- "./dist/apollo/sseLink": {
79
- "require": "./dist/cjs/apollo/sseLink.js",
80
- "import": "./dist/apollo/sseLink.js"
81
- },
82
- "./dist/graphql.js": {
83
- "require": "./dist/cjs/graphql.js",
84
- "import": "./dist/graphql.js"
29
+ "types": "./dist/server/middleware.d.ts",
30
+ "default": "./dist/server/middleware.js"
85
31
  },
32
+ "./dist/components/*": "./dist/components/*.js",
33
+ "./htmlTags": "./dist/components/htmlTags.js",
34
+ "./Metadata": "./dist/components/Metadata.js",
35
+ "./dist/apollo/suspense": "./dist/apollo/suspense.js",
36
+ "./dist/apollo/sseLink": "./dist/apollo/sseLink.js",
37
+ "./dist/graphql.js": "./dist/graphql.js",
86
38
  "./toast": {
87
- "import": {
88
- "types": "./dist/toast/index.d.ts",
89
- "default": "./dist/toast/index.js"
90
- },
91
- "require": {
92
- "types": "./dist/cjs/toast/index.d.ts",
93
- "default": "./dist/cjs/toast/index.js"
94
- }
39
+ "types": "./dist/toast/index.d.ts",
40
+ "default": "./dist/toast/index.js"
95
41
  },
96
42
  "./apollo": {
97
- "import": {
98
- "types": "./dist/apollo/index.d.ts",
99
- "default": "./dist/apollo/index.js"
100
- },
101
- "require": {
102
- "types": "./dist/cjs/apollo/index.d.ts",
103
- "default": "./dist/cjs/apollo/index.js"
104
- }
43
+ "types": "./dist/apollo/index.d.ts",
44
+ "default": "./dist/apollo/index.js"
105
45
  },
106
46
  "./apollo/CedarApolloProvider": {
107
- "import": {
108
- "types": "./dist/apollo/CedarApolloProvider.d.ts",
109
- "default": "./dist/apollo/CedarApolloProvider.js"
110
- },
111
- "require": {
112
- "types": "./dist/cjs/apollo/CedarApolloProvider.d.ts",
113
- "default": "./dist/cjs/apollo/CedarApolloProvider.js"
114
- }
47
+ "types": "./dist/apollo/CedarApolloProvider.d.ts",
48
+ "default": "./dist/apollo/CedarApolloProvider.js"
115
49
  },
116
- "./forceEsmApollo": {
117
- "require": "./dist/apollo/index.js",
118
- "import": "./dist/apollo/index.js"
119
- }
50
+ "./forceEsmApollo": "./dist/apollo/index.js"
120
51
  },
121
52
  "main": "./dist/index.js",
122
53
  "types": "dist/index.d.ts",
123
54
  "bin": {
124
- "cedar": "./dist/cjs/bins/cedar.js",
125
- "cedarjs": "./dist/cjs/bins/cedar.js",
126
- "cfw": "./dist/cjs/bins/cfw.js",
127
- "cross-env": "./dist/cjs/bins/cross-env.js",
128
- "msw": "./dist/cjs/bins/msw.js",
129
- "redwood": "./dist/cjs/bins/redwood.js",
130
- "rw": "./dist/cjs/bins/redwood.js",
131
- "storybook": "./dist/cjs/bins/storybook.js",
132
- "tsc": "./dist/cjs/bins/tsc.js"
55
+ "cedar": "./dist/bins/cedar.js",
56
+ "cedarjs": "./dist/bins/cedar.js",
57
+ "cfw": "./dist/bins/cfw.js",
58
+ "cross-env": "./dist/bins/cross-env.js",
59
+ "msw": "./dist/bins/msw.js",
60
+ "redwood": "./dist/bins/redwood.js",
61
+ "rw": "./dist/bins/redwood.js",
62
+ "storybook": "./dist/bins/storybook.js",
63
+ "tsc": "./dist/bins/tsc.js"
133
64
  },
134
65
  "files": [
135
66
  "dist",
@@ -137,11 +68,11 @@
137
68
  "toast"
138
69
  ],
139
70
  "scripts": {
140
- "build": "node ./build.ts && yarn build:types",
71
+ "build": "node ./build.ts",
141
72
  "build:pack": "yarn pack -o cedarjs-web.tgz",
142
- "build:types": "tsc --build --verbose ./tsconfig.build.json ./tsconfig.cjs.json",
73
+ "build:types": "tsc --build --verbose ./tsconfig.build.json",
143
74
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
144
- "check:attw": "node ./attw.ts",
75
+ "check:attw": "yarn cedar-fwtools-attw",
145
76
  "check:package": "concurrently npm:check:attw yarn:publint",
146
77
  "prepublishOnly": "NODE_ENV=production yarn build",
147
78
  "test": "vitest run",
@@ -150,7 +81,7 @@
150
81
  },
151
82
  "dependencies": {
152
83
  "@apollo/client": "4.2.7",
153
- "@cedarjs/server-store": "6.0.0-canary.2780",
84
+ "@cedarjs/server-store": "6.0.0-canary.2782",
154
85
  "@dr.pogodin/react-helmet": "2.0.4",
155
86
  "@whatwg-node/fetch": "0.10.13",
156
87
  "apollo-upload-client": "19.0.0",
@@ -170,9 +101,9 @@
170
101
  "@babel/core": "^7.26.10",
171
102
  "@babel/plugin-transform-runtime": "7.29.7",
172
103
  "@babel/runtime": "7.29.7",
173
- "@cedarjs/auth": "6.0.0-canary.2780",
174
- "@cedarjs/framework-tools": "6.0.0-canary.2780",
175
- "@cedarjs/internal": "6.0.0-canary.2780",
104
+ "@cedarjs/auth": "6.0.0-canary.2782",
105
+ "@cedarjs/framework-tools": "6.0.0-canary.2782",
106
+ "@cedarjs/internal": "6.0.0-canary.2782",
176
107
  "@rollup/plugin-babel": "6.1.0",
177
108
  "@testing-library/dom": "10.4.1",
178
109
  "@testing-library/jest-dom": "6.9.1",
@@ -190,7 +121,7 @@
190
121
  "vitest": "4.1.10"
191
122
  },
192
123
  "peerDependencies": {
193
- "@cedarjs/auth": "6.0.0-canary.2780",
124
+ "@cedarjs/auth": "6.0.0-canary.2782",
194
125
  "react": "19.2.3",
195
126
  "react-dom": "19.2.3"
196
127
  },
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { ApolloCache, setLogVerbosity } from '@apollo/client';
3
- import type { UseAuth } from '@cedarjs/auth';
4
- import type { GraphQLClientConfigProp } from './apolloLinkTypes.js';
5
- interface Props {
6
- config: Omit<GraphQLClientConfigProp, 'cacheConfig' | 'cache'> & {
7
- cache: ApolloCache;
8
- };
9
- useAuth?: UseAuth;
10
- logLevel: ReturnType<typeof setLogVerbosity>;
11
- children: React.ReactNode;
12
- }
13
- export declare function ApolloProviderWithFetchConfig({ config, children, useAuth, logLevel, }: Props): React.JSX.Element;
14
- export {};
15
- //# sourceMappingURL=ApolloProviderWithFetchConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApolloProviderWithFetchConfig.d.ts","sourceRoot":"","sources":["../../../src/apollo/ApolloProviderWithFetchConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAgB,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAchF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAoC7B,UAAU,KAAK;IACb,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG;QAC/D,KAAK,EAAE,WAAW,CAAA;KACnB,CAAA;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,QAAQ,EACR,OAAmB,EACnB,QAAQ,GACT,EAAE,KAAK,qBAuKP"}
@@ -1,170 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var ApolloProviderWithFetchConfig_exports = {};
30
- __export(ApolloProviderWithFetchConfig_exports, {
31
- ApolloProviderWithFetchConfig: () => ApolloProviderWithFetchConfig
32
- });
33
- module.exports = __toCommonJS(ApolloProviderWithFetchConfig_exports);
34
- var import_react = __toESM(require("react"), 1);
35
- var import_client = require("@apollo/client");
36
- var import_context = require("@apollo/client/link/context");
37
- var import_persisted_queries = require("@apollo/client/link/persisted-queries");
38
- var import_react2 = require("@apollo/client/react");
39
- var import_utilities = require("@apollo/client/utilities");
40
- var import_printer = require("graphql/language/printer.js");
41
- var import_rxjs = require("rxjs");
42
- var import_auth = require("@cedarjs/auth");
43
- var import_apollo_upload_client = require("../bundled/apollo-upload-client.js");
44
- var import_FetchConfigProvider = require("../components/FetchConfigProvider.js");
45
- var import_ErrorBoundary = require("./ErrorBoundary.js");
46
- var SSELinkExports = __toESM(require("./sseLink.js"), 1);
47
- const { SSELink, isSubscription, isLiveQuery } = SSELinkExports;
48
- function ApolloProviderWithFetchConfig({
49
- config,
50
- children,
51
- useAuth = import_auth.useNoAuth,
52
- logLevel
53
- }) {
54
- (0, import_client.setLogVerbosity)(logLevel);
55
- const { getToken, type: authProviderType } = useAuth();
56
- const data = {
57
- mostRecentRequest: void 0,
58
- mostRecentResponse: void 0
59
- };
60
- const updateDataApolloLink = new import_client.ApolloLink((operation, forward) => {
61
- const { operationName, query, variables } = operation;
62
- data.mostRecentRequest = {};
63
- data.mostRecentRequest.operationName = operationName;
64
- data.mostRecentRequest.operationKind = query?.kind.toString();
65
- data.mostRecentRequest.variables = variables;
66
- data.mostRecentRequest.query = query && (0, import_printer.print)(operation.query);
67
- return forward(operation).pipe(
68
- (0, import_rxjs.map)((result) => {
69
- data.mostRecentResponse = result;
70
- return result;
71
- })
72
- );
73
- });
74
- const withToken = new import_context.SetContextLink(async () => {
75
- const token = await getToken();
76
- return { token };
77
- });
78
- const { headers, uri } = (0, import_FetchConfigProvider.useFetchConfig)();
79
- const authMiddleware = new import_client.ApolloLink((operation, forward) => {
80
- const { token } = operation.getContext();
81
- const authHeaders = token ? {
82
- "auth-provider": authProviderType,
83
- authorization: `Bearer ${token}`
84
- } : {};
85
- operation.setContext(() => ({
86
- headers: {
87
- ...operation.getContext().headers,
88
- ...headers,
89
- // Duped auth headers, because we may remove the `FetchConfigProvider` at a later date.
90
- ...authHeaders
91
- }
92
- }));
93
- return forward(operation);
94
- });
95
- const { httpLinkConfig, link: cedarApolloLink, ...rest } = config ?? {};
96
- const uploadLink = new import_apollo_upload_client.UploadHttpLink({
97
- uri,
98
- ...httpLinkConfig
99
- });
100
- const uploadOrSSELink = typeof SSELink !== "undefined" ? (0, import_client.split)(
101
- ({ query }) => {
102
- const definition = (0, import_utilities.getMainDefinition)(query);
103
- return isSubscription(definition) || isLiveQuery(definition);
104
- },
105
- new SSELink({
106
- url: uri,
107
- auth: { authProviderType, tokenFn: getToken },
108
- httpLinkConfig,
109
- headers
110
- }),
111
- uploadLink
112
- ) : uploadLink;
113
- const terminatingLink = (0, import_client.split)(
114
- ({ query }) => {
115
- const documentQuery = query;
116
- return documentQuery?.["__meta__"]?.["hash"] !== void 0;
117
- },
118
- new import_persisted_queries.PersistedQueryLink({
119
- generateHash: (document) => {
120
- const documentWithMeta = document;
121
- return documentWithMeta.__meta__?.hash ?? "";
122
- }
123
- }).concat(uploadOrSSELink),
124
- uploadOrSSELink
125
- );
126
- const cedarApolloLinks = [
127
- { name: "withToken", link: withToken },
128
- { name: "authMiddleware", link: authMiddleware },
129
- { name: "updateDataApolloLink", link: updateDataApolloLink },
130
- { name: "httpLink", link: terminatingLink }
131
- ];
132
- let link = cedarApolloLink;
133
- link ??= import_client.ApolloLink.from(cedarApolloLinks.map((l) => l.link));
134
- if (typeof link === "function") {
135
- link = link(cedarApolloLinks);
136
- }
137
- const client = new import_client.ApolloClient({
138
- // Default options for every Cell. Better to specify them here than in
139
- // `beforeQuery` where it's too easy to overwrite them.
140
- // See https://www.apollographql.com/docs/react/api/core/ApolloClient/#example-defaultoptions-object.
141
- defaultOptions: {
142
- watchQuery: {
143
- // The `fetchPolicy` we expect:
144
- //
145
- // > Apollo Client executes the full query against both the cache and
146
- // > your GraphQL server.
147
- // > The query automatically updates if the result of the server-side
148
- // > query modifies cached fields.
149
- //
150
- // See https://www.apollographql.com/docs/react/data/queries/#cache-and-network.
151
- fetchPolicy: "cache-and-network",
152
- // So that Cells rerender when refetching.
153
- // See https://www.apollographql.com/docs/react/data/queries/#inspecting-loading-states.
154
- notifyOnNetworkStatusChange: true
155
- }
156
- },
157
- link,
158
- ...rest
159
- });
160
- const extendErrorAndRethrow = (error, _errorInfo) => {
161
- error["mostRecentRequest"] = data.mostRecentRequest;
162
- error["mostRecentResponse"] = data.mostRecentResponse;
163
- throw error;
164
- };
165
- return /* @__PURE__ */ import_react.default.createElement(import_react2.ApolloProvider, { client }, /* @__PURE__ */ import_react.default.createElement(import_ErrorBoundary.ErrorBoundary, { onError: extendErrorAndRethrow }, children));
166
- }
167
- // Annotate the CommonJS export names for ESM import in node:
168
- 0 && (module.exports = {
169
- ApolloProviderWithFetchConfig
170
- });
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { DocumentNode, setLogVerbosity } from '@apollo/client';
3
- import type { UseAuth } from '@cedarjs/auth';
4
- import type { GraphQLClientConfigProp } from './apolloLinkTypes.js';
5
- export type { ApolloClientCacheConfig, CedarApolloLink, CedarApolloLinkFactory, CedarApolloLinkName, CedarApolloLinks, GraphQLClientConfigProp, } from './apolloLinkTypes.js';
6
- interface Props {
7
- graphQLClientConfig?: GraphQLClientConfigProp;
8
- fragments?: DocumentNode[];
9
- useAuth?: UseAuth;
10
- logLevel?: ReturnType<typeof setLogVerbosity>;
11
- children: React.ReactNode;
12
- }
13
- export declare function CedarApolloProvider({ graphQLClientConfig, fragments, useAuth, logLevel, children, }: Props): React.JSX.Element;
14
- //# sourceMappingURL=CedarApolloProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CedarApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/apollo/CedarApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAK5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAInE,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,sBAAsB,CAAA;AAE7B,UAAU,KAAK;IACb,mBAAmB,CAAC,EAAE,uBAAuB,CAAA;IAC7C,SAAS,CAAC,EAAE,YAAY,EAAE,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,mBAAmB,EACnB,SAAS,EACT,OAAmB,EACnB,QAAkB,EAClB,QAAQ,GACT,EAAE,KAAK,qBA4BP"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var CedarApolloProvider_exports = {};
30
- __export(CedarApolloProvider_exports, {
31
- CedarApolloProvider: () => CedarApolloProvider
32
- });
33
- module.exports = __toCommonJS(CedarApolloProvider_exports);
34
- var import_react = __toESM(require("react"), 1);
35
- var import_client = require("@apollo/client");
36
- var import_auth = require("@cedarjs/auth");
37
- var import_FetchConfigProvider = require("../components/FetchConfigProvider.js");
38
- var import_ApolloProviderWithFetchConfig = require("./ApolloProviderWithFetchConfig.js");
39
- var import_fragmentRegistry = require("./fragmentRegistry.js");
40
- function CedarApolloProvider({
41
- graphQLClientConfig,
42
- fragments,
43
- useAuth = import_auth.useNoAuth,
44
- logLevel = "debug",
45
- children
46
- }) {
47
- const { cacheConfig, ...config } = graphQLClientConfig ?? {};
48
- if (fragments) {
49
- import_fragmentRegistry.fragmentRegistry.register(...fragments);
50
- }
51
- const cache = new import_client.InMemoryCache({
52
- fragments: import_fragmentRegistry.fragmentRegistry,
53
- possibleTypes: cacheConfig?.possibleTypes,
54
- ...cacheConfig
55
- }).restore(globalThis?.__CEDAR__APOLLO_STATE ?? {});
56
- return /* @__PURE__ */ import_react.default.createElement(import_FetchConfigProvider.FetchConfigProvider, { useAuth }, /* @__PURE__ */ import_react.default.createElement(
57
- import_ApolloProviderWithFetchConfig.ApolloProviderWithFetchConfig,
58
- {
59
- config: { cache, ...config },
60
- useAuth,
61
- logLevel
62
- },
63
- children
64
- ));
65
- }
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- CedarApolloProvider
69
- });
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- type ComponentDidCatch = React.ComponentLifecycle<any, any>['componentDidCatch'];
3
- interface ErrorBoundaryProps {
4
- error?: unknown;
5
- onError: NonNullable<ComponentDidCatch>;
6
- children: React.ReactNode;
7
- }
8
- export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
9
- componentDidCatch(...args: Parameters<NonNullable<ComponentDidCatch>>): void;
10
- render(): React.ReactNode;
11
- }
12
- export {};
13
- //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/apollo/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,iBAAiB,GAAG,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAA;AAEhF,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAA;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC;IACpE,iBAAiB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAKrE,MAAM;CAGP"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var ErrorBoundary_exports = {};
30
- __export(ErrorBoundary_exports, {
31
- ErrorBoundary: () => ErrorBoundary
32
- });
33
- module.exports = __toCommonJS(ErrorBoundary_exports);
34
- var import_react = __toESM(require("react"), 1);
35
- class ErrorBoundary extends import_react.default.Component {
36
- componentDidCatch(...args) {
37
- this.setState({});
38
- this.props.onError(...args);
39
- }
40
- render() {
41
- return this.props.children;
42
- }
43
- }
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- ErrorBoundary
47
- });
@@ -1,60 +0,0 @@
1
- import type { ApolloCache, ApolloClient, ApolloLink, HttpLink, InMemoryCacheConfig } from '@apollo/client';
2
- export type ApolloClientCacheConfig = InMemoryCacheConfig;
3
- export type CedarApolloLinkName = 'withToken' | 'authMiddleware' | 'updateDataApolloLink' | 'httpLink';
4
- export type CedarApolloLink<Name extends CedarApolloLinkName, Link extends ApolloLink = ApolloLink> = {
5
- name: Name;
6
- link: Link;
7
- };
8
- export type CedarApolloLinks = [
9
- CedarApolloLink<'withToken'>,
10
- CedarApolloLink<'authMiddleware'>,
11
- CedarApolloLink<'updateDataApolloLink'>,
12
- CedarApolloLink<'httpLink', ApolloLink | HttpLink>
13
- ];
14
- export type CedarApolloLinkFactory = (links: CedarApolloLinks) => ApolloLink;
15
- export type GraphQLClientConfigProp = Omit<ApolloClient.Options, 'cache' | 'link'> & {
16
- cache?: ApolloCache;
17
- /**
18
- * Configuration for Apollo Client's `InMemoryCache`.
19
- * See https://www.apollographql.com/docs/react/caching/cache-configuration/.
20
- */
21
- cacheConfig?: ApolloClientCacheConfig;
22
- /**
23
- * Configuration for the terminating `HttpLink`.
24
- * See https://www.apollographql.com/docs/react/api/link/apollo-link-http/#httplink-constructor-options.
25
- *
26
- * For example, you can use this prop to set the credentials policy so that cookies can be sent to other domains:
27
- *
28
- * ```js
29
- * <CedarApolloProvider graphQLClientConfig={{
30
- * httpLinkConfig: { credentials: 'include' }
31
- * }}>
32
- * ```
33
- */
34
- httpLinkConfig?: HttpLink.Options;
35
- /**
36
- * Extend or overwrite `CedarApolloProvider`'s Apollo Link.
37
- *
38
- * To overwrite Cedar's Apollo Link, just provide your own `ApolloLink`.
39
- *
40
- * To extend Cedar's Apollo Link, provide a function—it'll get passed an array of Cedar's Apollo Links
41
- * which are objects with a name and link property:
42
- *
43
- * ```js
44
- * const link = (cedarApolloLinks) => {
45
- * const consoleLink = new ApolloLink((operation, forward) => {
46
- * console.log(operation.operationName)
47
- * return forward(operation)
48
- * })
49
- *
50
- * return ApolloLink.from([consoleLink, ...cedarApolloLinks.map(({ link }) => link)])
51
- * }
52
- * ```
53
- *
54
- * If you do this, there's a few things you should keep in mind:
55
- * - your function should return a single link (e.g., using `ApolloLink.from`; see https://www.apollographql.com/docs/react/api/link/introduction/#additive-composition)
56
- * - the `HttpLink` should come last (https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link)
57
- */
58
- link?: ApolloLink | CedarApolloLinkFactory;
59
- };
60
- //# sourceMappingURL=apolloLinkTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apolloLinkTypes.d.ts","sourceRoot":"","sources":["../../../src/apollo/apolloLinkTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAA;AAEzD,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,gBAAgB,GAChB,sBAAsB,GACtB,UAAU,CAAA;AAEd,MAAM,MAAM,eAAe,CACzB,IAAI,SAAS,mBAAmB,EAChC,IAAI,SAAS,UAAU,GAAG,UAAU,IAClC;IACF,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;CACX,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,CAAC,WAAW,CAAC;IAC5B,eAAe,CAAC,gBAAgB,CAAC;IACjC,eAAe,CAAC,sBAAsB,CAAC;IACvC,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC;CACnD,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,UAAU,CAAA;AAE5E,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,YAAY,CAAC,OAAO,EACpB,OAAO,GAAG,MAAM,CACjB,GAAG;IACF,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,uBAAuB,CAAA;IACrC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAA;IACjC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,sBAAsB,CAAA;CAC3C,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var apolloLinkTypes_exports = {};
16
- module.exports = __toCommonJS(apolloLinkTypes_exports);