@cyberskill/shared 1.47.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.cts +410 -30
- package/dist/_tsup-dts-rollup.d.ts +410 -30
- package/dist/cli.cjs +2136 -1
- package/dist/cli.d.cts +2 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +2056 -1
- package/dist/configs/commitlint/base.cjs +64 -1
- package/dist/configs/commitlint/base.js +7 -1
- package/dist/configs/eslint/base.cjs +121 -1
- package/dist/configs/eslint/base.js +52 -1
- package/dist/configs/eslint/nestjs.cjs +155 -1
- package/dist/configs/eslint/nestjs.js +85 -1
- package/dist/configs/eslint/nextjs.cjs +155 -1
- package/dist/configs/eslint/nextjs.js +85 -1
- package/dist/configs/eslint/nodejs.cjs +156 -1
- package/dist/configs/eslint/nodejs.js +86 -1
- package/dist/configs/eslint/vite-react.cjs +159 -1
- package/dist/configs/eslint/vite-react.js +89 -1
- package/dist/configs/graphql/graphql-codegen.cjs +125 -1
- package/dist/configs/graphql/graphql-codegen.js +64 -1
- package/dist/configs/graphql/index.cjs +126 -1
- package/dist/configs/graphql/index.js +64 -1
- package/dist/configs/i18n/react/i18next.cjs +80 -1
- package/dist/configs/i18n/react/i18next.js +7 -1
- package/dist/configs/i18n/react/index.cjs +81 -1
- package/dist/configs/i18n/react/index.js +7 -1
- package/dist/configs/index.cjs +232 -1
- package/dist/configs/index.js +166 -1
- package/dist/configs/lint-staged/base.cjs +64 -1
- package/dist/configs/lint-staged/base.js +7 -1
- package/dist/configs/vitest/react/e2e.cjs +128 -1
- package/dist/configs/vitest/react/e2e.js +59 -1
- package/dist/configs/vitest/react/unit.cjs +305 -1
- package/dist/configs/vitest/react/unit.js +228 -1
- package/dist/configs/vitest/react/unit.setup.cjs +60 -1
- package/dist/configs/vitest/react/unit.setup.js +8 -1
- package/dist/constants/index.cjs +678 -1
- package/dist/constants/index.d.cts +31 -1
- package/dist/constants/index.d.ts +31 -1
- package/dist/constants/index.js +469 -1
- package/dist/constants/path.cjs +423 -1
- package/dist/constants/path.d.cts +31 -1
- package/dist/constants/path.d.ts +31 -1
- package/dist/constants/path.js +218 -1
- package/dist/constants/response-status.cjs +313 -1
- package/dist/constants/response-status.js +252 -1
- package/dist/index.cjs +4546 -1
- package/dist/index.d.cts +51 -7
- package/dist/index.d.ts +51 -7
- package/dist/index.js +4133 -1
- package/dist/nodejs/index.cjs +2138 -1
- package/dist/nodejs/index.js +2054 -1
- package/dist/nodejs/mongo.cjs +2137 -1
- package/dist/nodejs/mongo.js +2054 -1
- package/dist/react/apollo-client.cjs +177 -1
- package/dist/react/apollo-client.js +116 -1
- package/dist/react/index.cjs +990 -1
- package/dist/react/index.js +876 -1
- package/dist/react/loading.cjs +301 -1
- package/dist/react/loading.js +216 -1
- package/dist/react/next-intl.cjs +744 -1
- package/dist/react/next-intl.js +655 -1
- package/dist/react/storage.cjs +631 -1
- package/dist/react/storage.js +558 -1
- package/dist/typescript/api-response.cjs +48 -1
- package/dist/typescript/apollo.cjs +48 -1
- package/dist/typescript/command.cjs +68 -1
- package/dist/typescript/command.d.cts +4 -0
- package/dist/typescript/command.d.ts +4 -0
- package/dist/typescript/command.js +7 -1
- package/dist/typescript/config.cjs +48 -1
- package/dist/typescript/fs.cjs +48 -0
- package/dist/typescript/fs.d.cts +1 -0
- package/dist/typescript/fs.d.ts +1 -0
- package/dist/typescript/fs.js +0 -0
- package/dist/typescript/graphql-codegen.cjs +48 -1
- package/dist/typescript/index.cjs +175 -1
- package/dist/typescript/index.d.cts +5 -0
- package/dist/typescript/index.d.ts +5 -0
- package/dist/typescript/index.js +151 -1
- package/dist/typescript/loading.cjs +48 -1
- package/dist/typescript/log.cjs +48 -1
- package/dist/typescript/mongo.cjs +164 -1
- package/dist/typescript/mongo.js +145 -1
- package/dist/typescript/next-intl.cjs +48 -1
- package/dist/typescript/react.cjs +48 -1
- package/dist/typescript/serializer.cjs +48 -1
- package/dist/typescript/string.cjs +48 -1
- package/dist/utils/command.cjs +1387 -1
- package/dist/utils/command.d.cts +2 -0
- package/dist/utils/command.d.ts +2 -0
- package/dist/utils/command.js +1287 -1
- package/dist/utils/common.cjs +300 -1
- package/dist/utils/common.js +219 -1
- package/dist/utils/config.cjs +146 -1
- package/dist/utils/config.js +89 -1
- package/dist/utils/fs.cjs +118 -1
- package/dist/utils/fs.d.cts +4 -1
- package/dist/utils/fs.d.ts +4 -1
- package/dist/utils/fs.js +37 -1
- package/dist/utils/index-nodejs.cjs +1738 -1
- package/dist/utils/index-nodejs.d.cts +15 -6
- package/dist/utils/index-nodejs.d.ts +15 -6
- package/dist/utils/index-nodejs.js +1571 -1
- package/dist/utils/index.cjs +727 -1
- package/dist/utils/index.js +625 -1
- package/dist/utils/log.cjs +330 -1
- package/dist/utils/log.js +269 -1
- package/dist/utils/package.cjs +941 -0
- package/dist/utils/package.d.cts +3 -0
- package/dist/utils/package.d.ts +3 -0
- package/dist/utils/package.js +857 -0
- package/dist/utils/path.cjs +291 -0
- package/dist/utils/path.d.cts +6 -0
- package/dist/utils/path.d.ts +6 -0
- package/dist/utils/path.js +191 -0
- package/dist/utils/serializer.cjs +91 -1
- package/dist/utils/serializer.js +30 -1
- package/dist/utils/storage-client.cjs +349 -1
- package/dist/utils/storage-client.js +276 -1
- package/dist/utils/storage-server.cjs +636 -1
- package/dist/utils/storage-server.d.cts +1 -1
- package/dist/utils/storage-server.d.ts +1 -1
- package/dist/utils/storage-server.js +550 -1
- package/dist/utils/string.cjs +152 -1
- package/dist/utils/string.js +75 -1
- package/dist/utils/validate.cjs +90 -1
- package/dist/utils/validate.js +33 -1
- package/package.json +11 -11
- package/dist/utils/npm-package.cjs +0 -1
- package/dist/utils/npm-package.d.cts +0 -5
- package/dist/utils/npm-package.d.ts +0 -5
- package/dist/utils/npm-package.js +0 -1
|
@@ -1 +1,177 @@
|
|
|
1
|
-
"use strict";
|
|
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 +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 };
|