@cyberskill/shared 1.50.0 → 1.52.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 (147) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +100 -129
  2. package/dist/_tsup-dts-rollup.d.ts +100 -129
  3. package/dist/cli.cjs +1 -2146
  4. package/dist/cli.d.cts +1 -2
  5. package/dist/cli.d.ts +1 -2
  6. package/dist/cli.js +1 -2066
  7. package/dist/configs/commitlint/base.cjs +1 -64
  8. package/dist/configs/commitlint/base.js +1 -7
  9. package/dist/configs/eslint/base.cjs +1 -121
  10. package/dist/configs/eslint/base.js +1 -52
  11. package/dist/configs/eslint/nestjs.cjs +1 -155
  12. package/dist/configs/eslint/nestjs.js +1 -85
  13. package/dist/configs/eslint/nextjs.cjs +1 -155
  14. package/dist/configs/eslint/nextjs.js +1 -85
  15. package/dist/configs/eslint/nodejs.cjs +1 -156
  16. package/dist/configs/eslint/nodejs.js +1 -86
  17. package/dist/configs/eslint/vite-react.cjs +1 -159
  18. package/dist/configs/eslint/vite-react.js +1 -89
  19. package/dist/configs/graphql/graphql-codegen.cjs +1 -125
  20. package/dist/configs/graphql/graphql-codegen.js +1 -64
  21. package/dist/configs/graphql/index.cjs +1 -126
  22. package/dist/configs/graphql/index.js +1 -64
  23. package/dist/configs/i18n/react/i18next.cjs +1 -80
  24. package/dist/configs/i18n/react/i18next.js +1 -7
  25. package/dist/configs/i18n/react/index.cjs +1 -81
  26. package/dist/configs/i18n/react/index.js +1 -7
  27. package/dist/configs/index.cjs +1 -232
  28. package/dist/configs/index.js +1 -166
  29. package/dist/configs/lint-staged/base.cjs +1 -64
  30. package/dist/configs/lint-staged/base.js +1 -7
  31. package/dist/configs/vitest/react/e2e.cjs +1 -128
  32. package/dist/configs/vitest/react/e2e.js +1 -59
  33. package/dist/configs/vitest/react/unit.cjs +1 -305
  34. package/dist/configs/vitest/react/unit.js +1 -228
  35. package/dist/configs/vitest/react/unit.setup.cjs +1 -60
  36. package/dist/configs/vitest/react/unit.setup.js +1 -8
  37. package/dist/constants/index.cjs +1 -677
  38. package/dist/constants/index.d.cts +8 -3
  39. package/dist/constants/index.d.ts +8 -3
  40. package/dist/constants/index.js +1 -468
  41. package/dist/constants/path.cjs +1 -422
  42. package/dist/constants/path.d.cts +8 -3
  43. package/dist/constants/path.d.ts +8 -3
  44. package/dist/constants/path.js +1 -217
  45. package/dist/constants/response-status.cjs +1 -313
  46. package/dist/constants/response-status.js +1 -252
  47. package/dist/index.cjs +1 -4559
  48. package/dist/index.d.cts +13 -8
  49. package/dist/index.d.ts +13 -8
  50. package/dist/index.js +1 -4142
  51. package/dist/nodejs/index.cjs +1 -2138
  52. package/dist/nodejs/index.js +1 -2054
  53. package/dist/nodejs/mongo.cjs +1 -2137
  54. package/dist/nodejs/mongo.js +1 -2054
  55. package/dist/react/apollo-client.cjs +1 -177
  56. package/dist/react/apollo-client.js +1 -116
  57. package/dist/react/index.cjs +1 -990
  58. package/dist/react/index.js +1 -876
  59. package/dist/react/loading.cjs +1 -301
  60. package/dist/react/loading.js +1 -216
  61. package/dist/react/next-intl.cjs +1 -744
  62. package/dist/react/next-intl.js +1 -655
  63. package/dist/react/storage.cjs +1 -631
  64. package/dist/react/storage.js +1 -558
  65. package/dist/typescript/api-response.cjs +1 -48
  66. package/dist/typescript/apollo.cjs +1 -48
  67. package/dist/typescript/command.cjs +1 -68
  68. package/dist/typescript/command.d.cts +3 -0
  69. package/dist/typescript/command.d.ts +3 -0
  70. package/dist/typescript/command.js +1 -7
  71. package/dist/typescript/config.cjs +1 -48
  72. package/dist/typescript/fs.cjs +1 -48
  73. package/dist/typescript/graphql-codegen.cjs +1 -48
  74. package/dist/typescript/index.cjs +1 -175
  75. package/dist/typescript/index.d.cts +3 -0
  76. package/dist/typescript/index.d.ts +3 -0
  77. package/dist/typescript/index.js +1 -151
  78. package/dist/typescript/loading.cjs +1 -48
  79. package/dist/typescript/log.cjs +1 -48
  80. package/dist/typescript/mongo.cjs +1 -164
  81. package/dist/typescript/mongo.js +1 -145
  82. package/dist/typescript/next-intl.cjs +1 -48
  83. package/dist/typescript/react.cjs +1 -48
  84. package/dist/typescript/serializer.cjs +1 -48
  85. package/dist/typescript/string.cjs +1 -48
  86. package/dist/utils/command.cjs +1 -1387
  87. package/dist/utils/command.d.cts +2 -2
  88. package/dist/utils/command.d.ts +2 -2
  89. package/dist/utils/command.js +1 -1287
  90. package/dist/utils/common.cjs +1 -300
  91. package/dist/utils/common.js +1 -219
  92. package/dist/utils/config.cjs +1 -146
  93. package/dist/utils/config.js +1 -89
  94. package/dist/utils/fs.cjs +1 -132
  95. package/dist/utils/fs.js +1 -47
  96. package/dist/utils/index-nodejs.cjs +1 -1752
  97. package/dist/utils/index-nodejs.d.cts +2 -5
  98. package/dist/utils/index-nodejs.d.ts +2 -5
  99. package/dist/utils/index-nodejs.js +1 -1581
  100. package/dist/utils/index.cjs +1 -727
  101. package/dist/utils/index.js +1 -625
  102. package/dist/utils/log.cjs +1 -330
  103. package/dist/utils/log.js +1 -269
  104. package/dist/utils/package.cjs +1 -941
  105. package/dist/utils/package.js +1 -857
  106. package/dist/utils/path.cjs +1 -291
  107. package/dist/utils/path.d.cts +0 -3
  108. package/dist/utils/path.d.ts +0 -3
  109. package/dist/utils/path.js +1 -191
  110. package/dist/utils/serializer.cjs +1 -91
  111. package/dist/utils/serializer.js +1 -30
  112. package/dist/utils/storage-client.cjs +1 -349
  113. package/dist/utils/storage-client.js +1 -276
  114. package/dist/utils/storage-server.cjs +1 -636
  115. package/dist/utils/storage-server.js +1 -550
  116. package/dist/utils/string.cjs +1 -152
  117. package/dist/utils/string.js +1 -75
  118. package/dist/utils/validate.cjs +1 -90
  119. package/dist/utils/validate.js +1 -33
  120. package/package.json +15 -13
  121. /package/{src/public → public}/favicon/android-icon-144x144.png +0 -0
  122. /package/{src/public → public}/favicon/android-icon-192x192.png +0 -0
  123. /package/{src/public → public}/favicon/android-icon-36x36.png +0 -0
  124. /package/{src/public → public}/favicon/android-icon-48x48.png +0 -0
  125. /package/{src/public → public}/favicon/android-icon-72x72.png +0 -0
  126. /package/{src/public → public}/favicon/android-icon-96x96.png +0 -0
  127. /package/{src/public → public}/favicon/apple-icon-114x114.png +0 -0
  128. /package/{src/public → public}/favicon/apple-icon-120x120.png +0 -0
  129. /package/{src/public → public}/favicon/apple-icon-144x144.png +0 -0
  130. /package/{src/public → public}/favicon/apple-icon-152x152.png +0 -0
  131. /package/{src/public → public}/favicon/apple-icon-180x180.png +0 -0
  132. /package/{src/public → public}/favicon/apple-icon-57x57.png +0 -0
  133. /package/{src/public → public}/favicon/apple-icon-60x60.png +0 -0
  134. /package/{src/public → public}/favicon/apple-icon-72x72.png +0 -0
  135. /package/{src/public → public}/favicon/apple-icon-76x76.png +0 -0
  136. /package/{src/public → public}/favicon/apple-icon-precomposed.png +0 -0
  137. /package/{src/public → public}/favicon/apple-icon.png +0 -0
  138. /package/{src/public → public}/favicon/browserconfig.xml +0 -0
  139. /package/{src/public → public}/favicon/favicon-16x16.png +0 -0
  140. /package/{src/public → public}/favicon/favicon-32x32.png +0 -0
  141. /package/{src/public → public}/favicon/favicon-96x96.png +0 -0
  142. /package/{src/public → public}/favicon/favicon.ico +0 -0
  143. /package/{src/public → public}/favicon/manifest.json +0 -0
  144. /package/{src/public → public}/favicon/ms-icon-144x144.png +0 -0
  145. /package/{src/public → public}/favicon/ms-icon-150x150.png +0 -0
  146. /package/{src/public → public}/favicon/ms-icon-310x310.png +0 -0
  147. /package/{src/public → public}/favicon/ms-icon-70x70.png +0 -0
@@ -1,177 +1 @@
1
- "use strict";
2
- function _define_property(obj, key, value) {
3
- if (key in obj) {
4
- Object.defineProperty(obj, key, {
5
- value: value,
6
- enumerable: true,
7
- configurable: true,
8
- writable: true
9
- });
10
- } else {
11
- obj[key] = value;
12
- }
13
- return obj;
14
- }
15
- function _instanceof(left, right) {
16
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
17
- return !!right[Symbol.hasInstance](left);
18
- } else {
19
- return left instanceof right;
20
- }
21
- }
22
- function _object_spread(target) {
23
- for(var i = 1; i < arguments.length; i++){
24
- var source = arguments[i] != null ? arguments[i] : {};
25
- var ownKeys = Object.keys(source);
26
- if (typeof Object.getOwnPropertySymbols === "function") {
27
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
28
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
29
- }));
30
- }
31
- ownKeys.forEach(function(key) {
32
- _define_property(target, key, source[key]);
33
- });
34
- }
35
- return target;
36
- }
37
- function _type_of(obj) {
38
- "@swc/helpers - typeof";
39
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
40
- }
41
- var __defProp = Object.defineProperty;
42
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
43
- var __getOwnPropNames = Object.getOwnPropertyNames;
44
- var __hasOwnProp = Object.prototype.hasOwnProperty;
45
- var __export = function(target, all) {
46
- for(var name in all)__defProp(target, name, {
47
- get: all[name],
48
- enumerable: true
49
- });
50
- };
51
- var __copyProps = function(to, from, except, desc) {
52
- if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
53
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
54
- try {
55
- var _loop = function() {
56
- var key = _step.value;
57
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
58
- get: function() {
59
- return from[key];
60
- },
61
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
62
- });
63
- };
64
- for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
65
- } catch (err) {
66
- _didIteratorError = true;
67
- _iteratorError = err;
68
- } finally{
69
- try {
70
- if (!_iteratorNormalCompletion && _iterator.return != null) {
71
- _iterator.return();
72
- }
73
- } finally{
74
- if (_didIteratorError) {
75
- throw _iteratorError;
76
- }
77
- }
78
- }
79
- }
80
- return to;
81
- };
82
- var __toCommonJS = function(mod) {
83
- return __copyProps(__defProp({}, "__esModule", {
84
- value: true
85
- }), mod);
86
- };
87
- // src/react/apollo-client.tsx
88
- var apollo_client_exports = {};
89
- __export(apollo_client_exports, {
90
- ApolloProvider: function() {
91
- return ApolloProvider;
92
- }
93
- });
94
- module.exports = __toCommonJS(apollo_client_exports);
95
- var import_client = require("@apollo/client");
96
- var import_error = require("@apollo/client/link/error");
97
- var import_subscriptions = require("@apollo/client/link/subscriptions");
98
- var import_utilities = require("@apollo/client/utilities");
99
- var import_graphql_ws = require("graphql-ws");
100
- var import_jsx_runtime = require("react/jsx-runtime");
101
- function createLinks(options) {
102
- var errorLink = (0, import_error.onError)(function(param) {
103
- var graphQLErrors = param.graphQLErrors, networkError = param.networkError;
104
- graphQLErrors === null || graphQLErrors === void 0 ? void 0 : graphQLErrors.forEach(function(param) {
105
- var message = param.message, locations = param.locations, path = param.path;
106
- return console.error("[GraphQL error]: Message: ".concat(message, ", Location: ").concat(locations, ", Path: ").concat(path));
107
- });
108
- if (networkError) {
109
- console.error("[Network error]: ".concat(networkError));
110
- }
111
- });
112
- var httpLink = new import_client.HttpLink({
113
- uri: options === null || options === void 0 ? void 0 : options.uri,
114
- credentials: "include"
115
- });
116
- var wsLink = (options === null || options === void 0 ? void 0 : options.wsUrl) ? new import_subscriptions.GraphQLWsLink((0, import_graphql_ws.createClient)({
117
- url: options.wsUrl
118
- })) : null;
119
- var splitLink = wsLink ? (0, import_client.split)(function(param) {
120
- var query = param.query;
121
- var mainDefinition = (0, import_utilities.getMainDefinition)(query);
122
- if (mainDefinition.kind === "OperationDefinition") {
123
- var operation = mainDefinition.operation;
124
- return operation === "subscription";
125
- }
126
- return false;
127
- }, wsLink, httpLink) : httpLink;
128
- var cleanTypeName = new import_client.ApolloLink(function(operation, forward) {
129
- if (operation.variables) {
130
- operation.variables = JSON.parse(JSON.stringify(operation.variables), function(key, value) {
131
- return key === "__typename" ? void 0 : value;
132
- });
133
- }
134
- return forward(operation);
135
- });
136
- return {
137
- errorLink: errorLink,
138
- httpLink: httpLink,
139
- wsLink: wsLink,
140
- splitLink: splitLink,
141
- cleanTypeName: cleanTypeName
142
- };
143
- }
144
- function ApolloProvider(param) {
145
- var isNextJS = param.isNextJS, options = param.options, children = param.children, CustomClient = param.client, CustomProvider = param.provider, CustomCache = param.cache;
146
- var Client = CustomClient !== null && CustomClient !== void 0 ? CustomClient : import_client.ApolloClient;
147
- if (typeof Client !== "function") {
148
- throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");
149
- }
150
- var Provider = CustomProvider || import_client.ApolloProvider;
151
- var Cache = CustomCache || import_client.InMemoryCache;
152
- var _createLinks = createLinks(options), cleanTypeName = _createLinks.cleanTypeName, errorLink = _createLinks.errorLink, splitLink = _createLinks.splitLink;
153
- var client = new Client(_object_spread({
154
- cache: _instanceof(Cache, import_client.InMemoryCache) ? Cache : new import_client.InMemoryCache(),
155
- link: import_client.ApolloLink.from([
156
- cleanTypeName,
157
- errorLink,
158
- splitLink
159
- ].filter(Boolean))
160
- }, options));
161
- if (isNextJS) {
162
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, {
163
- makeClient: function() {
164
- return client;
165
- },
166
- children: children
167
- });
168
- }
169
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, {
170
- client: client,
171
- children: children
172
- });
173
- }
174
- // Annotate the CommonJS export names for ESM import in node:
175
- 0 && (module.exports = {
176
- ApolloProvider: ApolloProvider
177
- });
1
+ "use strict";function e(e,r,n){if(r in e){Object.defineProperty(e,r,{value:n,enumerable:true,configurable:true,writable:true})}else{e[r]=n}return e}function r(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function n(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var o=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}o.forEach(function(n){e(r,n,t[n])})}return r}function t(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var u=function(e,r){for(var n in r)o(e,n,{get:r[n],enumerable:!0})},c=function(e,r,n,u){var c=true,f=false,s=undefined;if(r&&(typeof r==="undefined"?"undefined":t(r))=="object"||typeof r=="function")try{var p=function(){var t=y.value;!a.call(e,t)&&t!==n&&o(e,t,{get:function(){return r[t]},enumerable:!(u=i(r,t))||u.enumerable})};for(var v=l(r)[Symbol.iterator](),y;!(c=(y=v.next()).done);c=true)p()}catch(e){f=true;s=e}finally{try{if(!c&&v.return!=null){v.return()}}finally{if(f){throw s}}}return e};var f=function(e){return c(o({},"__esModule",{value:!0}),e)};var s={};u(s,{ApolloProvider:function(){return w}});module.exports=f(s);var p=require("@apollo/client"),v=require("@apollo/client/link/error"),y=require("@apollo/client/link/subscriptions"),d=require("@apollo/client/utilities"),b=require("graphql-ws"),m=require("react/jsx-runtime");function h(e){var r=(0,v.onError)(function(e){var r=e.graphQLErrors,n=e.networkError;r===null||r===void 0?void 0:r.forEach(function(e){var r=e.message,n=e.locations,t=e.path;return console.error("[GraphQL error]: Message: ".concat(r,", Location: ").concat(n,", Path: ").concat(t))}),n&&console.error("[Network error]: ".concat(n))}),n=new p.HttpLink({uri:e===null||e===void 0?void 0:e.uri,credentials:"include"}),t=(e===null||e===void 0?void 0:e.wsUrl)?new y.GraphQLWsLink((0,b.createClient)({url:e.wsUrl})):null,o=t?(0,p.split)(function(e){var r=e.query;var n=(0,d.getMainDefinition)(r);if(n.kind==="OperationDefinition"){var t=n.operation;return t==="subscription"}return!1},t,n):n,i=new p.ApolloLink(function(e,r){return e.variables&&(e.variables=JSON.parse(JSON.stringify(e.variables),function(e,r){return e==="__typename"?void 0:r})),r(e)});return{errorLink:r,httpLink:n,wsLink:t,splitLink:o,cleanTypeName:i}}function w(e){var t=e.isNextJS,o=e.options,i=e.children,l=e.client,a=e.provider,u=e.cache;var c=l!==null&&l!==void 0?l:p.ApolloClient;if(typeof c!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var f=a||p.ApolloProvider,s=u||p.InMemoryCache,v=h(o),y=v.cleanTypeName,d=v.errorLink,b=v.splitLink,w=new c(n({cache:r(s,p.InMemoryCache)?s:new p.InMemoryCache,link:p.ApolloLink.from([y,d,b].filter(Boolean))},o));return t?(0,m.jsx)(f,{makeClient:function(){return w},children:i}):(0,m.jsx)(f,{client:w,children:i})}0&&(module.exports={ApolloProvider:ApolloProvider});
@@ -1,116 +1 @@
1
- // src/react/apollo-client.tsx
2
- function _define_property(obj, key, value) {
3
- if (key in obj) {
4
- Object.defineProperty(obj, key, {
5
- value: value,
6
- enumerable: true,
7
- configurable: true,
8
- writable: true
9
- });
10
- } else {
11
- obj[key] = value;
12
- }
13
- return obj;
14
- }
15
- function _instanceof(left, right) {
16
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
17
- return !!right[Symbol.hasInstance](left);
18
- } else {
19
- return left instanceof right;
20
- }
21
- }
22
- function _object_spread(target) {
23
- for(var i = 1; i < arguments.length; i++){
24
- var source = arguments[i] != null ? arguments[i] : {};
25
- var ownKeys = Object.keys(source);
26
- if (typeof Object.getOwnPropertySymbols === "function") {
27
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
28
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
29
- }));
30
- }
31
- ownKeys.forEach(function(key) {
32
- _define_property(target, key, source[key]);
33
- });
34
- }
35
- return target;
36
- }
37
- import { ApolloClient, ApolloLink, ApolloProvider as ApolloProviderDefault, HttpLink, InMemoryCache, split } from "@apollo/client";
38
- import { onError } from "@apollo/client/link/error";
39
- import { GraphQLWsLink } from "@apollo/client/link/subscriptions";
40
- import { getMainDefinition } from "@apollo/client/utilities";
41
- import { createClient as createGraphqlWebSocketClient } from "graphql-ws";
42
- import { jsx } from "react/jsx-runtime";
43
- function createLinks(options) {
44
- var errorLink = onError(function(param) {
45
- var graphQLErrors = param.graphQLErrors, networkError = param.networkError;
46
- graphQLErrors === null || graphQLErrors === void 0 ? void 0 : graphQLErrors.forEach(function(param) {
47
- var message = param.message, locations = param.locations, path = param.path;
48
- return console.error("[GraphQL error]: Message: ".concat(message, ", Location: ").concat(locations, ", Path: ").concat(path));
49
- });
50
- if (networkError) {
51
- console.error("[Network error]: ".concat(networkError));
52
- }
53
- });
54
- var httpLink = new HttpLink({
55
- uri: options === null || options === void 0 ? void 0 : options.uri,
56
- credentials: "include"
57
- });
58
- var wsLink = (options === null || options === void 0 ? void 0 : options.wsUrl) ? new GraphQLWsLink(createGraphqlWebSocketClient({
59
- url: options.wsUrl
60
- })) : null;
61
- var splitLink = wsLink ? split(function(param) {
62
- var query = param.query;
63
- var mainDefinition = getMainDefinition(query);
64
- if (mainDefinition.kind === "OperationDefinition") {
65
- var operation = mainDefinition.operation;
66
- return operation === "subscription";
67
- }
68
- return false;
69
- }, wsLink, httpLink) : httpLink;
70
- var cleanTypeName = new ApolloLink(function(operation, forward) {
71
- if (operation.variables) {
72
- operation.variables = JSON.parse(JSON.stringify(operation.variables), function(key, value) {
73
- return key === "__typename" ? void 0 : value;
74
- });
75
- }
76
- return forward(operation);
77
- });
78
- return {
79
- errorLink: errorLink,
80
- httpLink: httpLink,
81
- wsLink: wsLink,
82
- splitLink: splitLink,
83
- cleanTypeName: cleanTypeName
84
- };
85
- }
86
- function ApolloProvider(param) {
87
- var isNextJS = param.isNextJS, options = param.options, children = param.children, CustomClient = param.client, CustomProvider = param.provider, CustomCache = param.cache;
88
- var Client = CustomClient !== null && CustomClient !== void 0 ? CustomClient : ApolloClient;
89
- if (typeof Client !== "function") {
90
- throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");
91
- }
92
- var Provider = CustomProvider || ApolloProviderDefault;
93
- var Cache = CustomCache || InMemoryCache;
94
- var _createLinks = createLinks(options), cleanTypeName = _createLinks.cleanTypeName, errorLink = _createLinks.errorLink, splitLink = _createLinks.splitLink;
95
- var client = new Client(_object_spread({
96
- cache: _instanceof(Cache, InMemoryCache) ? Cache : new InMemoryCache(),
97
- link: ApolloLink.from([
98
- cleanTypeName,
99
- errorLink,
100
- splitLink
101
- ].filter(Boolean))
102
- }, options));
103
- if (isNextJS) {
104
- return /* @__PURE__ */ jsx(Provider, {
105
- makeClient: function() {
106
- return client;
107
- },
108
- children: children
109
- });
110
- }
111
- return /* @__PURE__ */ jsx(Provider, {
112
- client: client,
113
- children: children
114
- });
115
- }
116
- export { ApolloProvider };
1
+ function r(r,n,e){if(n in r){Object.defineProperty(r,n,{value:e,enumerable:true,configurable:true,writable:true})}else{r[n]=e}return r}function n(r,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](r)}else{return r instanceof n}}function e(n){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};var i=Object.keys(o);if(typeof Object.getOwnPropertySymbols==="function"){i=i.concat(Object.getOwnPropertySymbols(o).filter(function(r){return Object.getOwnPropertyDescriptor(o,r).enumerable}))}i.forEach(function(e){r(n,e,o[e])})}return n}import{ApolloClient as o,ApolloLink as i,ApolloProvider as t,HttpLink as l,InMemoryCache as a,split as c}from"@apollo/client";import{onError as s}from"@apollo/client/link/error";import{GraphQLWsLink as u}from"@apollo/client/link/subscriptions";import{getMainDefinition as p}from"@apollo/client/utilities";import{createClient as f}from"graphql-ws";import{jsx as v}from"react/jsx-runtime";function m(r){var n=s(function(r){var n=r.graphQLErrors,e=r.networkError;n===null||n===void 0?void 0:n.forEach(function(r){var n=r.message,e=r.locations,o=r.path;return console.error("[GraphQL error]: Message: ".concat(n,", Location: ").concat(e,", Path: ").concat(o))}),e&&console.error("[Network error]: ".concat(e))}),e=new l({uri:r===null||r===void 0?void 0:r.uri,credentials:"include"}),o=(r===null||r===void 0?void 0:r.wsUrl)?new u(f({url:r.wsUrl})):null,t=o?c(function(r){var n=r.query;var e=p(n);if(e.kind==="OperationDefinition"){var o=e.operation;return o==="subscription"}return!1},o,e):e,a=new i(function(r,n){return r.variables&&(r.variables=JSON.parse(JSON.stringify(r.variables),function(r,n){return r==="__typename"?void 0:n})),n(r)});return{errorLink:n,httpLink:e,wsLink:o,splitLink:t,cleanTypeName:a}}function d(r){var l=r.isNextJS,c=r.options,s=r.children,u=r.client,p=r.provider,f=r.cache;var d=u!==null&&u!==void 0?u:o;if(typeof d!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var y=p||t,b=f||a,h=m(c),k=h.cleanTypeName,w=h.errorLink,L=h.splitLink,g=new d(e({cache:n(b,a)?b:new a,link:i.from([k,w,L].filter(Boolean))},c));return l?v(y,{makeClient:function(){return g},children:s}):v(y,{client:g,children:s})}export{d as ApolloProvider};