@cyberskill/shared 2.26.0 → 2.28.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/README.md +1 -1
- package/dist/config/config.util.cjs +1 -1
- package/dist/config/config.util.js +14 -19
- package/dist/config/eslint/index.cjs +1 -1
- package/dist/config/eslint/index.d.ts +2 -0
- package/dist/config/eslint/index.js +1 -1
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +1 -1
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +1 -1
- package/dist/node/cli/index.cjs +2 -5
- package/dist/node/cli/index.js +108 -103
- package/dist/node/command/command.util.js +1 -1
- package/dist/node/fs/fs.util.cjs +4 -1
- package/dist/node/fs/fs.util.d.ts +8 -0
- package/dist/node/fs/fs.util.js +58 -50
- package/dist/node/fs/index.cjs +1 -1
- package/dist/node/fs/index.js +13 -12
- package/dist/node/mongo/mongo.type.js +3 -3
- package/dist/node/mongo/mongo.util.cjs +2 -5
- package/dist/node/mongo/mongo.util.js +206 -211
- package/dist/node/path/index.cjs +1 -1
- package/dist/node/path/index.js +53 -51
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.d.ts +3 -0
- package/dist/node/path/path.constant.js +63 -60
- package/dist/node/storage/storage.util.cjs +1 -1
- package/dist/node/storage/storage.util.js +1 -1
- package/dist/node/upload/upload.util.js +3 -3
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.component.d.ts +1 -1
- package/dist/react/apollo-client/apollo-client.component.js +4 -3
- package/dist/react/apollo-client/apollo-client.context.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.context.d.ts +1 -1
- package/dist/react/apollo-client/apollo-client.context.js +9 -8
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.util.js +3 -3
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +9 -8
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.component.d.ts +1 -1
- package/dist/react/apollo-error/apollo-error.component.js +2 -1
- package/dist/react/apollo-error/apollo-error.provider.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.provider.d.ts +1 -1
- package/dist/react/apollo-error/apollo-error.provider.js +4 -3
- package/dist/react/loading/loading.component.cjs +2 -2
- package/dist/react/loading/loading.component.d.ts +1 -1
- package/dist/react/loading/loading.component.js +7 -6
- package/dist/react/loading/loading.provider.cjs +1 -1
- package/dist/react/loading/loading.provider.d.ts +1 -1
- package/dist/react/loading/loading.provider.js +8 -7
- package/dist/react/next-intl/next-intl.hoc.cjs +1 -1
- package/dist/react/next-intl/next-intl.hoc.d.ts +2 -1
- package/dist/react/next-intl/next-intl.hoc.js +12 -12
- package/dist/react/next-intl/next-intl.provider.cjs +1 -1
- package/dist/react/next-intl/next-intl.provider.d.ts +1 -1
- package/dist/react/next-intl/next-intl.provider.js +5 -4
- package/dist/util/common/common.util.cjs +1 -1
- package/dist/util/common/common.util.d.ts +9 -0
- package/dist/util/common/common.util.js +33 -29
- package/dist/util/common/index.cjs +1 -1
- package/dist/util/common/index.js +6 -5
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +23 -22
- package/dist/util/object/object.util.cjs +1 -1
- package/dist/util/object/object.util.js +40 -36
- package/package.json +45 -44
- package/dist/node/mongo/mongo.util.d.ts +0 -1040
- /package/dist/node_modules/.pnpm/{vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ApolloNextAppProvider as l } from "@apollo/client-integration-nextjs";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { useMemo as p } from "react";
|
|
4
|
+
import { getClient as i } from "./apollo-client-nextjs.util.js";
|
|
5
|
+
import { ApolloErrorProvider as n } from "../apollo-error/apollo-error.provider.js";
|
|
5
6
|
import { ApolloErrorComponent as a } from "../apollo-error/apollo-error.component.js";
|
|
6
7
|
import { Toaster as c } from "react-hot-toast";
|
|
7
|
-
function
|
|
8
|
-
const m =
|
|
9
|
-
() => () =>
|
|
8
|
+
function g({ options: r, children: t, onError: o }) {
|
|
9
|
+
const m = p(
|
|
10
|
+
() => () => i(r || {}),
|
|
10
11
|
[r]
|
|
11
12
|
);
|
|
12
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
13
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(n, { onError: o }, /* @__PURE__ */ e.createElement(l, { makeClient: m }, t), !o && /* @__PURE__ */ e.createElement(a, null)), /* @__PURE__ */ e.createElement(c, { position: "top-right" }));
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
g as ApolloProvider
|
|
16
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),a=require("../../util/validate/validate.util.cjs"),i=require("./apollo-error.context.cjs"),o=require("./apollo-error.module.scss.cjs");function c(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,l.get?l:{enumerable:!0,get:()=>r[n]})}}return e.default=r,Object.freeze(e)}const t=c(s);function u(){const r=s.use(i.ApolloErrorContext),e=r==null?void 0:r.error;if(!e)return null;const n="locations"in e||"path"in e||"extensions"in e,l="message"in e?e.message:"Unknown error occurred";return t.createElement("div",{className:o.default["modal-backdrop"]},t.createElement("div",{className:o.default["modal-content"]},t.createElement("button",{type:"button",className:o.default["btn-close"],onClick:r.hideError},"✕"),t.createElement("div",{className:o.default["error-title"]},t.createElement("button",{type:"button",className:o.default["btn-retry"],onClick:()=>window.location.reload()},"Reload")," ",!a.validate.isEmpty(e)&&l),t.createElement("div",{className:o.default["error-details"]},n&&"locations"in e&&e.locations&&t.createElement("pre",{className:"locations"},t.createElement("strong",null,"Locations:")," ",JSON.stringify(e.locations,null,4)),n&&"path"in e&&e.path&&t.createElement("pre",{className:"path"},t.createElement("strong",null,"Path:")," ",JSON.stringify(e.path,null,4)),n&&"extensions"in e&&e.extensions&&t.createElement("pre",{className:"extensions"},t.createElement("strong",null,"Extensions:")," ",JSON.stringify(e.extensions,null,4)),!n&&t.createElement("pre",{className:"error-details"},t.createElement("strong",null,"Error Details:")," ",a.validate.isEmpty(e)?l:JSON.stringify(e,null,4)))))}exports.ApolloErrorComponent=u;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { use as a } from "react";
|
|
2
3
|
import { validate as s } from "../../util/validate/validate.util.js";
|
|
3
4
|
import { ApolloErrorContext as i } from "./apollo-error.context.js";
|
|
4
5
|
import n from "./apollo-error.module.scss.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),i=require("./apollo-error.context.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),i=require("./apollo-error.context.cjs"),u=require("./apollo-error.util.cjs");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const f=b(l);function p({children:r,onError:e}){const[t,o]=l.useState(null),a=l.useCallback(n=>{if(e){e(n);return}o(n)},[e]);l.useEffect(()=>(u.setGlobalApolloErrorCallback(a,!!e),()=>{u.clearGlobalApolloErrorCallback()}),[a,e]);const c=l.useCallback(()=>o(null),[]),s=l.useMemo(()=>({error:e?null:t,showError:a,hideError:c}),[t,a,c,e]);return f.createElement(i.ApolloErrorContext,{value:s},r)}exports.ApolloErrorProvider=p;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { I_ApolloErrorProviderProps } from './apollo-error.type.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Provider component that manages Apollo error state and provides error context.
|
|
5
5
|
* This component sets up error handling for Apollo Client operations and provides
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { useState as m, useCallback as c, useEffect as f, useMemo as i } from "react";
|
|
2
3
|
import { ApolloErrorContext as p } from "./apollo-error.context.js";
|
|
3
4
|
import { setGlobalApolloErrorCallback as b, clearGlobalApolloErrorCallback as A } from "./apollo-error.util.js";
|
|
4
5
|
function k({ children: u, onError: l }) {
|
|
@@ -12,12 +13,12 @@ function k({ children: u, onError: l }) {
|
|
|
12
13
|
f(() => (b(e, !!l), () => {
|
|
13
14
|
A();
|
|
14
15
|
}), [e, l]);
|
|
15
|
-
const t = c(() => o(null), []),
|
|
16
|
+
const t = c(() => o(null), []), s = i(() => ({
|
|
16
17
|
error: l ? null : r,
|
|
17
18
|
showError: e,
|
|
18
19
|
hideError: t
|
|
19
20
|
}), [r, e, t, l]);
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ n.createElement(p, { value: s }, u);
|
|
21
22
|
}
|
|
22
23
|
export {
|
|
23
24
|
k as ApolloErrorProvider
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("clsx"),c=require("react"),n=require("./loading.module.scss.cjs");function _(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const l=_(c);var y=Object.defineProperty,i=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,f=(e,r,t)=>r in e?y(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,b=(e,r)=>{for(var t in r||(r={}))m.call(r,t)&&f(e,t,r[t]);if(i)for(var t of i(r))v.call(r,t)&&f(e,t,r[t]);return e},E=(e,r)=>{var t={};for(var a in e)m.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&i)for(var a of i(e))r.indexOf(a)<0&&v.call(e,a)&&(t[a]=e[a]);return t};function O(){if(document.getElementById("noscroll-style"))return;const e=document.createElement("style");e.id="noscroll-style",e.innerHTML=`
|
|
2
2
|
.noscroll {
|
|
3
3
|
overflow: hidden !important;
|
|
4
4
|
height: 100vh !important;
|
|
5
5
|
}
|
|
6
|
-
`,document.head.appendChild(e)}function h(e){var r=e,{full:t=!1,className:a="",message:o="Loading"}=r,
|
|
6
|
+
`,document.head.appendChild(e)}function h(e){var r=e,{full:t=!1,className:a="",message:o="Loading"}=r,g=E(r,["full","className","message"]);c.useEffect(()=>{if(t){document.body.classList.add("noscroll");const d=p=>p.preventDefault();return document.addEventListener("contextmenu",d),()=>{document.body.classList.remove("noscroll"),document.removeEventListener("contextmenu",d)}}},[t]),c.useEffect(()=>{O()},[]);function s(){return l.createElement("div",b({role:"status","aria-live":"polite","aria-label":o,className:n.default.container},g),l.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),l.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),l.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),l.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),o&&l.createElement("div",{className:n.default.message},o))}return t?l.createElement("div",{className:u(n.default.full,a)},s()):l.createElement("div",{className:u(n.default.block,a)},s())}exports.Loading=h;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { I_LoadingProps } from './loading.type.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Loading component that displays animated loading indicators.
|
|
5
5
|
* This component provides a customizable loading interface with animated rings
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import c from "clsx";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { useEffect as d } from "react";
|
|
3
4
|
import l from "./loading.module.scss.js";
|
|
4
5
|
var _ = Object.defineProperty, i = Object.getOwnPropertySymbols, u = Object.prototype.hasOwnProperty, v = Object.prototype.propertyIsEnumerable, f = (e, r, t) => r in e ? _(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, y = (e, r) => {
|
|
5
6
|
for (var t in r || (r = {}))
|
|
@@ -33,9 +34,9 @@ function L(e) {
|
|
|
33
34
|
d(() => {
|
|
34
35
|
if (t) {
|
|
35
36
|
document.body.classList.add("noscroll");
|
|
36
|
-
const
|
|
37
|
-
return document.addEventListener("contextmenu",
|
|
38
|
-
document.body.classList.remove("noscroll"), document.removeEventListener("contextmenu",
|
|
37
|
+
const m = (g) => g.preventDefault();
|
|
38
|
+
return document.addEventListener("contextmenu", m), () => {
|
|
39
|
+
document.body.classList.remove("noscroll"), document.removeEventListener("contextmenu", m);
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
}, [t]), d(() => {
|
|
@@ -57,7 +58,7 @@ function L(e) {
|
|
|
57
58
|
o && /* @__PURE__ */ n.createElement("div", { className: l.message }, o)
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
|
-
return t ? /* @__PURE__ */ n.createElement("div", { className:
|
|
61
|
+
return t ? /* @__PURE__ */ n.createElement("div", { className: c(l.full, a) }, s()) : /* @__PURE__ */ n.createElement("div", { className: c(l.block, a) }, s());
|
|
61
62
|
}
|
|
62
63
|
export {
|
|
63
64
|
L as Loading
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),d=require("./loading.component.cjs"),g=require("./loading.context.cjs");function f(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=f(a);function b({children:e}){const[t,o]=a.useState(!1),[n,r]=a.useState(!1),l=a.useCallback((u=!1)=>{o(!0),r(u)},[]),i=a.useCallback(()=>{o(!1),r(!1)},[]),c=a.useMemo(()=>({isLoading:t,isGlobalLoading:n,showLoading:l,hideLoading:i}),[t,n,l,i]);return s.createElement(g.LoadingContext,{value:c},t?s.createElement(d.Loading,{full:n}):e)}exports.LoadingProvider=b;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { I_Children } from '../../typescript/index.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Provider component that manages loading state and provides loading context.
|
|
5
5
|
* This component sets up loading state management for the application and provides
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { useState as l, useCallback as r, useMemo as m } from "react";
|
|
3
|
+
import { Loading as g } from "./loading.component.js";
|
|
3
4
|
import { LoadingContext as u } from "./loading.context.js";
|
|
4
5
|
function x({ children: c }) {
|
|
5
|
-
const [
|
|
6
|
+
const [o, t] = l(!1), [e, a] = l(!1), n = r((f = !1) => {
|
|
6
7
|
t(!0), a(f);
|
|
7
8
|
}, []), s = r(() => {
|
|
8
9
|
t(!1), a(!1);
|
|
9
|
-
}, []), d =
|
|
10
|
-
() => ({ isLoading:
|
|
11
|
-
[
|
|
10
|
+
}, []), d = m(
|
|
11
|
+
() => ({ isLoading: o, isGlobalLoading: e, showLoading: n, hideLoading: s }),
|
|
12
|
+
[o, e, n, s]
|
|
12
13
|
);
|
|
13
|
-
return /* @__PURE__ */ i.createElement(u, { value: d },
|
|
14
|
+
return /* @__PURE__ */ i.createElement(u, { value: d }, o ? /* @__PURE__ */ i.createElement(g, { full: e }) : c);
|
|
14
15
|
}
|
|
15
16
|
export {
|
|
16
17
|
x as LoadingProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("next-intl"),v=require("react"),p=require("./next-intl.constant.cjs"),O=require("./next-intl.hook.cjs"),y=require("../log/log.util.cjs");function I(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,l.get?l:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const i=I(v);var N=Object.defineProperty,s=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,c=(n,e,t)=>e in n?N(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,w=(n,e)=>{for(var t in e||(e={}))P.call(e,t)&&c(n,t,e[t]);if(s)for(var t of s(e))b.call(e,t)&&c(n,t,e[t]);return n};function x(n){const e=t=>{var l,o;const{currentLanguage:r}=O.useNextIntl(),{messages:u,languages:f}=t,a="en",g=u[(r==null?void 0:r.value)||a],_=(o=(l=f.find(d=>d.value===(r==null?void 0:r.value)))==null?void 0:l.timezone)!=null?o:p.NEXT_INTL_DEFAULT_LANGUAGE.timezone;return u?i.createElement(m.NextIntlClientProvider,{locale:(r==null?void 0:r.value)||a,messages:g||null,timeZone:_},i.createElement(n,w({},t))):(y.log.warn(`Missing messages for language: ${(r==null?void 0:r.value)||a}`),null)};return e.displayName=`withNextIntl(${n.displayName||n.name||"Component"})`,e}exports.withNextIntl=x;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ComponentType
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
import { I_Children } from '../../typescript/index.js';
|
|
3
3
|
import { I_NextIntlLanguage, T_NextIntlMessageList } from './next-intl.type.js';
|
|
4
|
+
import * as React from 'react';
|
|
4
5
|
/**
|
|
5
6
|
* Higher-Order Component (HOC) that wraps components with Next.js internationalization support.
|
|
6
7
|
* This HOC provides internationalization capabilities to React components by wrapping them
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { NextIntlClientProvider as g } from "next-intl";
|
|
2
|
-
import
|
|
2
|
+
import * as s from "react";
|
|
3
3
|
import { NEXT_INTL_DEFAULT_LANGUAGE as _ } from "./next-intl.constant.js";
|
|
4
4
|
import { useNextIntl as d } from "./next-intl.hook.js";
|
|
5
5
|
import { log as N } from "../log/log.util.js";
|
|
6
|
-
var P = Object.defineProperty,
|
|
6
|
+
var P = Object.defineProperty, u = Object.getOwnPropertySymbols, w = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable, m = (t, e, r) => e in t ? P(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, I = (t, e) => {
|
|
7
7
|
for (var r in e || (e = {}))
|
|
8
8
|
w.call(e, r) && m(t, r, e[r]);
|
|
9
|
-
if (
|
|
10
|
-
for (var r of
|
|
9
|
+
if (u)
|
|
10
|
+
for (var r of u(e))
|
|
11
11
|
y.call(e, r) && m(t, r, e[r]);
|
|
12
12
|
return t;
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function L(t) {
|
|
15
15
|
const e = (r) => {
|
|
16
|
-
var
|
|
17
|
-
const { currentLanguage: n } = d(), { messages: i, languages: f } = r,
|
|
18
|
-
return i ? /* @__PURE__ */
|
|
16
|
+
var l, o;
|
|
17
|
+
const { currentLanguage: n } = d(), { messages: i, languages: f } = r, a = "en", c = i[(n == null ? void 0 : n.value) || a], p = (o = (l = f.find((v) => v.value === (n == null ? void 0 : n.value))) == null ? void 0 : l.timezone) != null ? o : _.timezone;
|
|
18
|
+
return i ? /* @__PURE__ */ s.createElement(
|
|
19
19
|
g,
|
|
20
20
|
{
|
|
21
|
-
locale: (n == null ? void 0 : n.value) ||
|
|
21
|
+
locale: (n == null ? void 0 : n.value) || a,
|
|
22
22
|
messages: c || null,
|
|
23
23
|
timeZone: p
|
|
24
24
|
},
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
) : (N.warn(`Missing messages for language: ${(n == null ? void 0 : n.value) ||
|
|
25
|
+
/* @__PURE__ */ s.createElement(t, I({}, r))
|
|
26
|
+
) : (N.warn(`Missing messages for language: ${(n == null ? void 0 : n.value) || a}`), null);
|
|
27
27
|
};
|
|
28
28
|
return e.displayName = `withNextIntl(${t.displayName || t.name || "Component"})`, e;
|
|
29
29
|
}
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
L as withNextIntl
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),l=require("./next-intl.constant.cjs"),i=require("./next-intl.context.cjs"),s=require("./next-intl.hoc.cjs"),g=require("../storage/storage.hook.cjs");function f(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=f(a);function p({children:e}){return o.createElement(o.Fragment,null,e)}const m=s.withNextIntl(p);function x({children:e,languages:t,messages:n}){const{value:r,set:u}=g.useStorage("lang",t[0]),c=a.useMemo(()=>({languages:t,currentLanguage:r!=null?r:l.NEXT_INTL_DEFAULT_LANGUAGE,setCurrentLanguage:u}),[t,u,r]);return o.createElement(i.NextIntlContext,{value:c},o.createElement(m,{languages:t,messages:n},e))}exports.NextIntlProvider=x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { I_NextIntlProviderProps } from './next-intl.type.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Provider component that manages Next.js internationalization state and provides i18n context.
|
|
5
5
|
* This component sets up a complete internationalization system for Next.js applications,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
2
3
|
import { NEXT_INTL_DEFAULT_LANGUAGE as c } from "./next-intl.constant.js";
|
|
3
4
|
import { NextIntlContext as l } from "./next-intl.context.js";
|
|
4
5
|
import { withNextIntl as p } from "./next-intl.hoc.js";
|
|
@@ -10,13 +11,13 @@ const L = p(f);
|
|
|
10
11
|
function I({
|
|
11
12
|
children: r,
|
|
12
13
|
languages: e,
|
|
13
|
-
messages:
|
|
14
|
+
messages: m
|
|
14
15
|
}) {
|
|
15
|
-
const { value: n, set: o } = i("lang", e[0]),
|
|
16
|
+
const { value: n, set: o } = i("lang", e[0]), a = u(
|
|
16
17
|
() => ({ languages: e, currentLanguage: n != null ? n : c, setCurrentLanguage: o }),
|
|
17
18
|
[e, o, n]
|
|
18
19
|
);
|
|
19
|
-
return /* @__PURE__ */ t.createElement(l, { value:
|
|
20
|
+
return /* @__PURE__ */ t.createElement(l, { value: a }, /* @__PURE__ */ t.createElement(L, { languages: e, messages: m }, r));
|
|
20
21
|
}
|
|
21
22
|
export {
|
|
22
23
|
I as NextIntlProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../typescript/common.type.cjs");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../typescript/common.type.cjs");var O=Object.defineProperty,a=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,i=(e,n,r)=>n in e?O(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,p=(e,n)=>{for(var r in n||(n={}))f.call(n,r)&&i(e,r,n[r]);if(a)for(var r of a(n))l.call(n,r)&&i(e,r,n[r]);return e};const s={a:["à","á","ạ","ả","ã","â","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["è","é","ẹ","ẻ","ẽ","ê","ề","ế","ệ","ể","ễ"],i:["ì","í","ị","ỉ","ĩ"],o:["ò","ó","ọ","ỏ","õ","ô","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["ù","ú","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","ý","ỵ","ỷ","ỹ"],d:["đ"]},v=Object.entries(s).reduce((e,[n,r])=>(e[n.toUpperCase()]=r.map(o=>o.toUpperCase()),e),{}),g=p(p({},s),v),u=new Map,m=new Set;Object.entries(g).forEach(([e,n])=>{const r=`(${[e,...n].join("|")})`;[e,...n].forEach(o=>{u.set(o,r),m.add(o)})});const D=Array.from(m).join(""),N=new RegExp(`[${D}]`,"g");function _(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(e){return e=_(e),e=e.normalize("NFD"),e.replace(N,n=>u.get(n)||n)}function M(e){return e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"")}function d(e,n){if(!n)return Array.from(new Set(e));const r=new Set,o=[];for(const c of e){const E=n(c);r.has(E)||(r.add(E),o.push(c))}return o}function S(e){const{NODE_ENV:n=t.E_Environment.DEVELOPMENT,NODE_ENV_MODE:r=t.E_Environment.DEVELOPMENT}=e,o=n===t.E_Environment.DEVELOPMENT&&r===t.E_Environment.DEVELOPMENT,c=n===t.E_Environment.PRODUCTION&&r===t.E_Environment.STAGING,E=n===t.E_Environment.PRODUCTION&&r===t.E_Environment.PRODUCTION;if(n===t.E_Environment.PRODUCTION&&r===t.E_Environment.DEVELOPMENT)throw new Error("NODE_ENV_MODE must be set to staging or production in production environment");return{IS_DEV:o,IS_STAG:c,IS_PROD:E}}exports.escapeRegExp=_;exports.mapEnvironment=S;exports.regexSearchMapper=P;exports.removeAccent=M;exports.uniqueArray=d;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { I_EnvFlags, I_NodeEnvInput } from './common.type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Escapes special characters in a string for use in a regular expression.
|
|
4
|
+
* This function escapes characters that have special meaning in regex (e.g., ., *, +, ?, etc.)
|
|
5
|
+
* so they are treated as literal characters.
|
|
6
|
+
*
|
|
7
|
+
* @param str - The string to escape.
|
|
8
|
+
* @returns The escaped string safe for use in a RegExp.
|
|
9
|
+
*/
|
|
10
|
+
export declare function escapeRegExp(str: string): string;
|
|
2
11
|
/**
|
|
3
12
|
* Convert a string to a regex pattern that matches the string and its accented variations.
|
|
4
13
|
* This function normalizes the input string and creates a regex pattern that can match
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { E_Environment as t } from "../../typescript/common.type.js";
|
|
2
|
-
var f = Object.defineProperty, p = Object.getOwnPropertySymbols, m = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable, i = (
|
|
3
|
-
for (var n in
|
|
4
|
-
m.call(
|
|
2
|
+
var f = Object.defineProperty, p = Object.getOwnPropertySymbols, m = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable, i = (e, r, n) => r in e ? f(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n, E = (e, r) => {
|
|
3
|
+
for (var n in r || (r = {}))
|
|
4
|
+
m.call(r, n) && i(e, n, r[n]);
|
|
5
5
|
if (p)
|
|
6
|
-
for (var n of p(
|
|
7
|
-
_.call(
|
|
8
|
-
return
|
|
6
|
+
for (var n of p(r))
|
|
7
|
+
_.call(r, n) && i(e, n, r[n]);
|
|
8
|
+
return e;
|
|
9
9
|
};
|
|
10
|
-
const
|
|
10
|
+
const s = {
|
|
11
11
|
a: ["à", "á", "ạ", "ả", "ã", "â", "ầ", "ấ", "ậ", "ẩ", "ẫ", "ă", "ằ", "ắ", "ặ", "ẳ", "ẵ"],
|
|
12
12
|
e: ["è", "é", "ẹ", "ẻ", "ẽ", "ê", "ề", "ế", "ệ", "ể", "ễ"],
|
|
13
13
|
i: ["ì", "í", "ị", "ỉ", "ĩ"],
|
|
@@ -15,42 +15,46 @@ const E = {
|
|
|
15
15
|
u: ["ù", "ú", "ụ", "ủ", "ũ", "ư", "ừ", "ứ", "ự", "ử", "ữ"],
|
|
16
16
|
y: ["ỳ", "ý", "ỵ", "ỷ", "ỹ"],
|
|
17
17
|
d: ["đ"]
|
|
18
|
-
},
|
|
19
|
-
(
|
|
18
|
+
}, l = Object.entries(s).reduce(
|
|
19
|
+
(e, [r, n]) => (e[r.toUpperCase()] = n.map((o) => o.toUpperCase()), e),
|
|
20
20
|
{}
|
|
21
|
-
),
|
|
22
|
-
Object.entries(
|
|
23
|
-
const n = `(${[
|
|
24
|
-
[
|
|
21
|
+
), D = E(E({}, s), l), u = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
|
|
22
|
+
Object.entries(D).forEach(([e, r]) => {
|
|
23
|
+
const n = `(${[e, ...r].join("|")})`;
|
|
24
|
+
[e, ...r].forEach((o) => {
|
|
25
25
|
u.set(o, n), O.add(o);
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
return
|
|
28
|
+
const N = Array.from(O).join(""), P = new RegExp(`[${N}]`, "g");
|
|
29
|
+
function g(e) {
|
|
30
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function d(e) {
|
|
33
|
+
return e = g(e), e = e.normalize("NFD"), e.replace(P, (r) => u.get(r) || r);
|
|
34
34
|
}
|
|
35
|
-
function w(
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
function w(e) {
|
|
36
|
+
return e.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "");
|
|
37
|
+
}
|
|
38
|
+
function S(e, r) {
|
|
39
|
+
if (!r)
|
|
40
|
+
return Array.from(new Set(e));
|
|
38
41
|
const n = /* @__PURE__ */ new Set(), o = [];
|
|
39
|
-
for (const c of
|
|
40
|
-
const a =
|
|
42
|
+
for (const c of e) {
|
|
43
|
+
const a = r(c);
|
|
41
44
|
n.has(a) || (n.add(a), o.push(c));
|
|
42
45
|
}
|
|
43
46
|
return o;
|
|
44
47
|
}
|
|
45
|
-
function
|
|
46
|
-
const { NODE_ENV:
|
|
47
|
-
if (
|
|
48
|
+
function T(e) {
|
|
49
|
+
const { NODE_ENV: r = t.DEVELOPMENT, NODE_ENV_MODE: n = t.DEVELOPMENT } = e, o = r === t.DEVELOPMENT && n === t.DEVELOPMENT, c = r === t.PRODUCTION && n === t.STAGING, a = r === t.PRODUCTION && n === t.PRODUCTION;
|
|
50
|
+
if (r === t.PRODUCTION && n === t.DEVELOPMENT)
|
|
48
51
|
throw new Error("NODE_ENV_MODE must be set to staging or production in production environment");
|
|
49
52
|
return { IS_DEV: o, IS_STAG: c, IS_PROD: a };
|
|
50
53
|
}
|
|
51
54
|
export {
|
|
52
|
-
|
|
55
|
+
g as escapeRegExp,
|
|
56
|
+
T as mapEnvironment,
|
|
53
57
|
d as regexSearchMapper,
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
w as removeAccent,
|
|
59
|
+
S as uniqueArray
|
|
56
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./common.util.cjs");exports.mapEnvironment=e.mapEnvironment;exports.regexSearchMapper=e.regexSearchMapper;exports.removeAccent=e.removeAccent;exports.uniqueArray=e.uniqueArray;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./common.util.cjs");exports.escapeRegExp=e.escapeRegExp;exports.mapEnvironment=e.mapEnvironment;exports.regexSearchMapper=e.regexSearchMapper;exports.removeAccent=e.removeAccent;exports.uniqueArray=e.uniqueArray;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { mapEnvironment as
|
|
1
|
+
import { escapeRegExp as p, mapEnvironment as a, regexSearchMapper as n, removeAccent as c, uniqueArray as m } from "./common.util.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
a as
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
p as escapeRegExp,
|
|
4
|
+
a as mapEnvironment,
|
|
5
|
+
n as regexSearchMapper,
|
|
6
|
+
c as removeAccent,
|
|
7
|
+
m as uniqueArray
|
|
7
8
|
};
|
package/dist/util/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./object/object.util.cjs"),r=require("./common/common.util.cjs"),t=require("./string/string.util.cjs"),a=require("./serializer/serializer.util.cjs"),i=require("./validate/validate.util.cjs");exports.deepClone=e.deepClone;exports.deepMerge=e.deepMerge;exports.getNestedValue=e.getNestedValue;exports.isJSON=e.isJSON;exports.normalizeMongoFilter=e.normalizeMongoFilter;exports.setNestedValue=e.setNestedValue;exports.escapeRegExp=r.escapeRegExp;exports.mapEnvironment=r.mapEnvironment;exports.regexSearchMapper=r.regexSearchMapper;exports.removeAccent=r.removeAccent;exports.uniqueArray=r.uniqueArray;exports.generateRandomPassword=t.generateRandomPassword;exports.generateShortId=t.generateShortId;exports.generateSlug=t.generateSlug;exports.getFileName=t.getFileName;exports.substringBetween=t.substringBetween;exports.serializer=a.serializer;exports.validate=i.validate;
|
package/dist/util/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { validate as
|
|
1
|
+
import { deepClone as t, deepMerge as o, getNestedValue as a, isJSON as n, normalizeMongoFilter as p, setNestedValue as g } from "./object/object.util.js";
|
|
2
|
+
import { escapeRegExp as i, mapEnvironment as s, regexSearchMapper as l, removeAccent as d, uniqueArray as x } from "./common/common.util.js";
|
|
3
|
+
import { generateRandomPassword as f, generateShortId as c, generateSlug as N, getFileName as S, substringBetween as v } from "./string/string.util.js";
|
|
4
|
+
import { serializer as h } from "./serializer/serializer.util.js";
|
|
5
|
+
import { validate as z } from "./validate/validate.util.js";
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
c as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
s as
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
t as deepClone,
|
|
8
|
+
o as deepMerge,
|
|
9
|
+
i as escapeRegExp,
|
|
10
|
+
f as generateRandomPassword,
|
|
11
|
+
c as generateShortId,
|
|
12
|
+
N as generateSlug,
|
|
13
|
+
S as getFileName,
|
|
14
|
+
a as getNestedValue,
|
|
15
|
+
n as isJSON,
|
|
16
|
+
s as mapEnvironment,
|
|
17
|
+
p as normalizeMongoFilter,
|
|
18
|
+
l as regexSearchMapper,
|
|
19
|
+
d as removeAccent,
|
|
20
|
+
h as serializer,
|
|
21
|
+
g as setNestedValue,
|
|
22
|
+
v as substringBetween,
|
|
23
|
+
x as uniqueArray,
|
|
24
|
+
z as validate
|
|
24
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var m=Object.defineProperty,A=Object.defineProperties,v=Object.getOwnPropertyDescriptors,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var m=Object.defineProperty,A=Object.defineProperties,v=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,y=(e,r,n)=>r in e?m(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,p=(e,r)=>{for(var n in r||(r={}))w.call(r,n)&&y(e,n,r[n]);if(f)for(var n of f(r))h.call(r,n)&&y(e,n,r[n]);return e},O=(e,r)=>A(e,v(r));function P(e){try{return JSON.parse(e),!0}catch(r){return!1}}function _(e,r){let n=e;const o=r.length;for(let t=0;t<o;t++){const s=r[t];if(s!==void 0&&n&&typeof n=="object"&&s in n)n=n[s];else return}return n}function g(e,r,n,o){if(o>=r.length)return e;const t=r[o];if(o===r.length-1)return O(p({},e),{[t]:n});const s=e[t];return O(p({},e),{[t]:g(typeof s=="object"&&s!==null?s:{},r,n,o+1)})}function b(e,r,n){return r.length===0?e:g(e,r,n,0)}function u(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(o=>u(o));if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return e;const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=u(e[o]));return n}function d(...e){if(e.length===0)return{};const r=e.filter(t=>t!=null);if(r.length===0)return{};if(r.length===1)return r[0];if(r.every(Array.isArray))return[].concat(...r);if(r.every(t=>typeof t=="object"&&t!==null&&!Array.isArray(t))){const t={};for(const s of r){const l=s;for(const a in l)if(Object.prototype.hasOwnProperty.call(l,a)){const i=l[a];if(Object.prototype.hasOwnProperty.call(t,a)){const c=t[a];typeof i=="object"&&i!==null&&typeof c=="object"&&c!==null?Array.isArray(i)&&Array.isArray(c)?t[a]=c.concat(i):!Array.isArray(i)&&!Array.isArray(c)?t[a]=d(c,i):t[a]=i:t[a]=i}else t[a]=i}}return t}if(r.every(t=>typeof t!="object"||t===null))throw new Error("deepMerge: Cannot merge primitive values. All arguments must be objects or arrays.");const n=r.some(Array.isArray),o=r.some(t=>typeof t=="object"&&t!==null&&!Array.isArray(t));throw n&&o?new Error("deepMerge: Cannot mix arrays and objects. All arguments must be either arrays or objects."):new Error("deepMerge: Invalid arguments provided. All arguments must be objects or arrays of the same type.")}function j(e){if(!e||typeof e!="object")return e;const r={};function n(o,t){for(const s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;const l=o[s],a=t?`${t}.${s}`:s;if(l&&typeof l=="object"&&!Array.isArray(l)){let i=!1;for(const c in l)if(Object.prototype.hasOwnProperty.call(l,c)&&c.startsWith("$")){i=!0;break}i?r[a]=l:n(l,a)}else r[a]=l}}return n(e,""),r}exports.deepClone=u;exports.deepMerge=d;exports.getNestedValue=_;exports.isJSON=P;exports.normalizeMongoFilter=j;exports.setNestedValue=b;
|