@cyberskill/shared 2.28.0 → 3.0.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 (91) hide show
  1. package/dist/config/config.util.cjs +1 -1
  2. package/dist/config/config.util.js +24 -33
  3. package/dist/config/eslint/index.cjs +1 -1
  4. package/dist/config/eslint/index.d.ts +4 -0
  5. package/dist/config/eslint/index.js +4 -12
  6. package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -1
  7. package/dist/config/graphql-codegen/graphql-codegen.util.js +28 -33
  8. package/dist/config/storybook/storybook.preview.cjs +1 -1
  9. package/dist/config/storybook/storybook.preview.js +10 -13
  10. package/dist/config/vitest/vitest.e2e.cjs +1 -1
  11. package/dist/config/vitest/vitest.e2e.js +1 -1
  12. package/dist/config/vitest/vitest.unit.cjs +1 -1
  13. package/dist/config/vitest/vitest.unit.js +19 -8
  14. package/dist/constant/common.cjs +1 -1
  15. package/dist/constant/common.js +1 -1
  16. package/dist/node/apollo-server/apollo-server.util.cjs +1 -1
  17. package/dist/node/apollo-server/apollo-server.util.js +21 -48
  18. package/dist/node/cli/index.cjs +2 -2
  19. package/dist/node/cli/index.js +109 -165
  20. package/dist/node/command/command.util.cjs +2 -2
  21. package/dist/node/command/command.util.js +135 -170
  22. package/dist/node/express/express.util.cjs +1 -1
  23. package/dist/node/express/express.util.js +39 -72
  24. package/dist/node/fs/fs.util.cjs +3 -3
  25. package/dist/node/fs/fs.util.js +45 -60
  26. package/dist/node/log/log.util.cjs +1 -1
  27. package/dist/node/log/log.util.js +29 -30
  28. package/dist/node/mongo/mongo.controller.cjs +1 -1
  29. package/dist/node/mongo/mongo.controller.js +531 -629
  30. package/dist/node/mongo/mongo.util.cjs +2 -2
  31. package/dist/node/mongo/mongo.util.js +280 -321
  32. package/dist/node/package/package.util.cjs +1 -1
  33. package/dist/node/package/package.util.js +197 -226
  34. package/dist/node/path/index.cjs +1 -1
  35. package/dist/node/path/index.js +26 -25
  36. package/dist/node/path/path.constant.cjs +1 -1
  37. package/dist/node/path/path.constant.d.ts +2 -0
  38. package/dist/node/path/path.constant.js +130 -150
  39. package/dist/node/storage/storage.util.cjs +1 -1
  40. package/dist/node/storage/storage.util.js +110 -158
  41. package/dist/node/upload/upload.util.cjs +1 -1
  42. package/dist/node/upload/upload.util.js +119 -150
  43. package/dist/node/ws/ts.util.cjs +1 -1
  44. package/dist/node/ws/ts.util.js +31 -54
  45. package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
  46. package/dist/react/apollo-client/apollo-client.component.js +4 -4
  47. package/dist/react/apollo-client/apollo-client.util.cjs +1 -1
  48. package/dist/react/apollo-client/apollo-client.util.js +51 -58
  49. package/dist/react/apollo-client/links/upload.cjs +1 -1
  50. package/dist/react/apollo-client/links/upload.js +71 -74
  51. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -1
  52. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +11 -18
  53. package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
  54. package/dist/react/apollo-error/apollo-error.component.js +61 -23
  55. package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -1
  56. package/dist/react/apollo-error/apollo-error.module.scss.js +6 -6
  57. package/dist/react/apollo-error/apollo-error.test.unit.d.ts +1 -0
  58. package/dist/react/apollo-error/apollo-error.util.cjs +1 -1
  59. package/dist/react/apollo-error/apollo-error.util.js +6 -6
  60. package/dist/react/loading/loading.component.cjs +2 -2
  61. package/dist/react/loading/loading.component.js +30 -46
  62. package/dist/react/log/log.util.cjs +1 -1
  63. package/dist/react/log/log.util.js +4 -4
  64. package/dist/react/next-intl/next-intl.hoc.cjs +1 -1
  65. package/dist/react/next-intl/next-intl.hoc.js +13 -22
  66. package/dist/react/next-intl/next-intl.provider.cjs +1 -1
  67. package/dist/react/next-intl/next-intl.provider.js +7 -7
  68. package/dist/react/storage/storage.hook.cjs +1 -1
  69. package/dist/react/storage/storage.hook.js +43 -59
  70. package/dist/react/storage/storage.util.cjs +1 -1
  71. package/dist/react/storage/storage.util.js +28 -53
  72. package/dist/react/userback/userback.component.cjs +1 -1
  73. package/dist/react/userback/userback.component.js +18 -42
  74. package/dist/style.css +1 -1
  75. package/dist/util/common/common.util.cjs +1 -1
  76. package/dist/util/common/common.util.d.ts +2 -0
  77. package/dist/util/common/common.util.js +29 -37
  78. package/dist/util/index.cjs +1 -1
  79. package/dist/util/index.js +10 -9
  80. package/dist/util/object/object.util.cjs +1 -1
  81. package/dist/util/object/object.util.js +72 -76
  82. package/dist/util/string/index.cjs +1 -1
  83. package/dist/util/string/index.js +4 -3
  84. package/dist/util/string/string.util.cjs +1 -1
  85. package/dist/util/string/string.util.d.ts +12 -0
  86. package/dist/util/string/string.util.js +63 -44
  87. package/package.json +25 -16
  88. package/public/tsconfig.base.json +7 -3
  89. package/README.md +0 -470
  90. /package/dist/node_modules/.pnpm/{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 → vitest@4.0.18_@types_node@25.3.3_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
  91. /package/dist/node_modules/.pnpm/{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 → vitest@4.0.18_@types_node@25.3.3_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,188 +1,153 @@
1
- import { exec as A } from "node:child_process";
2
- import p from "node:process";
3
- import * as K from "node:util";
4
- import { storage as y } from "../storage/storage.util.js";
5
- import { getPackage as B } from "../package/package.util.js";
6
- import { CYBERSKILL_PACKAGE_NAME as M, PNPM_EXEC_CLI as T, TSX_CLI as O, CYBERSKILL_CLI_PATH as R, CYBERSKILL_CLI as b } from "../path/path.constant.js";
1
+ import { exec as x } from "node:child_process";
2
+ import u from "node:process";
3
+ import * as P from "node:util";
4
+ import { storage as g } from "../storage/storage.util.js";
5
+ import { getPackage as $ } from "../package/package.util.js";
6
+ import { CYBERSKILL_PACKAGE_NAME as I, PNPM_EXEC_CLI as w, TSX_CLI as S, CYBERSKILL_CLI_PATH as T, CYBERSKILL_CLI as _ } from "../path/path.constant.js";
7
7
  import { E_IssueType as f } from "../log/log.type.js";
8
- import { log as h, catchError as E } from "../log/log.util.js";
9
- import { getEnv as N } from "../../config/env/env.util.js";
10
- var a = (r, t, e) => new Promise((s, i) => {
11
- var o = (u) => {
12
- try {
13
- n(e.next(u));
14
- } catch (c) {
15
- i(c);
16
- }
17
- }, l = (u) => {
18
- try {
19
- n(e.throw(u));
20
- } catch (c) {
21
- i(c);
22
- }
23
- }, n = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(o, l);
24
- n((e = e.apply(r, t)).next());
25
- });
26
- const G = K.promisify(A);
27
- function v() {
28
- return a(this, null, function* () {
29
- const r = yield B();
30
- return r.success ? r.result.name : Date.now().toString();
31
- });
8
+ import { log as l, catchError as p } from "../log/log.util.js";
9
+ import { getEnv as C } from "../../config/env/env.util.js";
10
+ const k = P.promisify(x);
11
+ async function E() {
12
+ const r = await $();
13
+ return r.success ? r.result.name : Date.now().toString();
32
14
  }
33
- function j(r) {
34
- return a(this, null, function* () {
35
- if (r.length === 0)
36
- return;
37
- const t = yield v();
38
- try {
39
- const s = [...yield W(), ...r];
40
- yield y.set(t, s), setTimeout(() => a(null, null, function* () {
41
- const i = yield y.getLogLink(t);
42
- i && h.info(`📂 Open the error list manually: ${i}`);
43
- }), 0);
44
- } catch (e) {
45
- E(e);
46
- }
47
- });
48
- }
49
- function W() {
50
- return a(this, null, function* () {
51
- try {
52
- const r = yield v(), t = yield y.get(r);
53
- return t != null ? t : [];
54
- } catch (r) {
55
- return E(r, {
56
- returnValue: []
57
- });
58
- }
59
- });
15
+ async function d(r) {
16
+ if (r.length === 0)
17
+ return;
18
+ const t = await E();
19
+ try {
20
+ const o = [...await B(), ...r];
21
+ await g.set(t, o), setTimeout(async () => {
22
+ const s = await g.getLogLink(t);
23
+ s && l.info(`📂 Open the error list manually: ${s}`);
24
+ }, 0);
25
+ } catch (e) {
26
+ p(e);
27
+ }
60
28
  }
61
- function rr() {
62
- return a(this, null, function* () {
63
- try {
64
- const r = yield v();
65
- yield y.remove(r);
66
- } catch (r) {
67
- E(r);
68
- }
69
- });
29
+ async function B() {
30
+ try {
31
+ const r = await E();
32
+ return await g.get(r) ?? [];
33
+ } catch (r) {
34
+ return p(r, {
35
+ returnValue: []
36
+ });
37
+ }
70
38
  }
71
- function U(r) {
72
- return a(this, null, function* () {
73
- const t = [], e = [];
74
- let s = "";
75
- const i = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/, o = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/, l = /^✖\s+(.*?)\s+\[(.*?)\]$/;
76
- r.split(`
77
- `).forEach((n) => {
78
- var u, c, _, $, C, w, L, P, x, I, S;
79
- if (n.startsWith("/"))
80
- s = n.trim();
81
- else {
82
- const m = i.exec(n) || [], d = o.exec(n) || [], g = l.exec(n) || [];
83
- m.length && s ? t.push({
84
- file: s,
85
- position: `${m[1]}:${m[2]}`,
86
- type: m[3] === f.Error ? f.Error : f.Warning,
87
- message: (c = (u = m == null ? void 0 : m[4]) == null ? void 0 : u.trim()) != null ? c : "",
88
- rule: ($ = (_ = m == null ? void 0 : m[5]) == null ? void 0 : _.trim()) != null ? $ : ""
89
- }) : d.length ? t.push({
90
- file: (C = d == null ? void 0 : d[1]) != null ? C : "",
91
- position: `${d[2]}:${d[3]}`,
92
- type: d[4] === f.Error ? f.Error : f.Warning,
93
- message: (L = (w = d == null ? void 0 : d[5]) == null ? void 0 : w.trim()) != null ? L : ""
94
- }) : g.length ? t.push({
95
- file: "commitlint",
96
- type: f.Error,
97
- message: (x = (P = g == null ? void 0 : g[1]) == null ? void 0 : P.trim()) != null ? x : "",
98
- rule: (S = (I = g == null ? void 0 : g[2]) == null ? void 0 : I.trim()) != null ? S : ""
99
- }) : e.push(n.trim());
100
- }
101
- }), t.length && (yield j(t)), N().DEBUG && e.length && (h.warn("Unmatched lines:"), e.forEach((n) => h.info(` ${n}`)));
102
- });
39
+ async function b() {
40
+ try {
41
+ const r = await E();
42
+ await g.remove(r);
43
+ } catch (r) {
44
+ p(r);
45
+ }
103
46
  }
104
- function D(r) {
105
- return a(this, null, function* () {
106
- try {
107
- const t = JSON.parse(r), e = [];
108
- t.forEach(({ filePath: s, messages: i }) => {
109
- i.forEach(({ severity: o, line: l, column: n, ruleId: u, message: c }) => {
110
- e.push({
111
- type: o === 2 ? f.Error : f.Warning,
112
- file: s,
113
- position: `${l}:${n}`,
114
- rule: u,
115
- message: c
116
- });
117
- });
118
- }), e.length && (yield j(e));
119
- } catch (t) {
120
- yield U(r);
47
+ async function N(r) {
48
+ const t = [], e = [];
49
+ let o = "";
50
+ const s = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/, n = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/, c = /^✖\s+(.*?)\s+\[(.*?)\]$/;
51
+ r.split(`
52
+ `).forEach((a) => {
53
+ if (a.startsWith("/"))
54
+ o = a.trim();
55
+ else {
56
+ const i = s.exec(a) || [], m = n.exec(a) || [], h = c.exec(a) || [];
57
+ i.length && o ? t.push({
58
+ file: o,
59
+ position: `${i[1]}:${i[2]}`,
60
+ type: i[3] === f.Error ? f.Error : f.Warning,
61
+ message: i?.[4]?.trim() ?? "",
62
+ rule: i?.[5]?.trim() ?? ""
63
+ }) : m.length ? t.push({
64
+ file: m?.[1] ?? "",
65
+ position: `${m[2]}:${m[3]}`,
66
+ type: m[4] === f.Error ? f.Error : f.Warning,
67
+ message: m?.[5]?.trim() ?? ""
68
+ }) : h.length ? t.push({
69
+ file: "commitlint",
70
+ type: f.Error,
71
+ message: h?.[1]?.trim() ?? "",
72
+ rule: h?.[2]?.trim() ?? ""
73
+ }) : e.push(a.trim());
121
74
  }
122
- });
75
+ }), t.length && await d(t), C().DEBUG && e.length && (l.warn("Unmatched lines:"), e.forEach((a) => l.info(` ${a}`)));
123
76
  }
124
- function Y(r) {
125
- return a(this, arguments, function* (t, e = D, s = {}) {
126
- const i = new AbortController();
127
- p.on("SIGINT", () => {
128
- h.warn("Process interrupted. Terminating..."), i.abort(), p.exit();
129
- });
130
- try {
131
- if (typeof t == "string") {
132
- const { stdout: o, stderr: l } = yield G(t, {
133
- maxBuffer: 104857600,
134
- signal: i.signal,
135
- timeout: s.timeout
77
+ async function L(r) {
78
+ try {
79
+ const t = JSON.parse(r), e = [];
80
+ t.forEach(({ filePath: o, messages: s }) => {
81
+ s.forEach(({ severity: n, line: c, column: a, ruleId: i, message: m }) => {
82
+ e.push({
83
+ type: n === 2 ? f.Error : f.Warning,
84
+ file: o,
85
+ position: `${c}:${a}`,
86
+ rule: i,
87
+ message: m
136
88
  });
137
- yield Promise.all([o, l].map((n) => n && e(n)));
138
- }
139
- } catch (o) {
140
- const { stdout: l, stderr: n, message: u } = o;
141
- yield Promise.all([l, n].map((c) => c && e(c))), !n && !l && h.error(`Command failed: ${u}`);
142
- }
89
+ });
90
+ }), e.length && await d(e);
91
+ } catch {
92
+ await N(r);
93
+ }
94
+ }
95
+ async function v(r, t = L, e = {}) {
96
+ const o = new AbortController();
97
+ u.on("SIGINT", () => {
98
+ l.warn("Process interrupted. Terminating..."), o.abort(), u.exit();
143
99
  });
100
+ try {
101
+ if (typeof r == "string") {
102
+ const { stdout: s, stderr: n } = await k(r, {
103
+ maxBuffer: 104857600,
104
+ signal: o.signal,
105
+ timeout: e.timeout
106
+ });
107
+ await Promise.all([s, n].map((c) => c && t(c)));
108
+ }
109
+ } catch (s) {
110
+ const { stdout: n, stderr: c, message: a } = s;
111
+ await Promise.all([n, c].map((i) => i && t(i))), !c && !n && l.error(`Command failed: ${a}`);
112
+ }
144
113
  }
145
- function tr(r) {
114
+ function U(r) {
146
115
  return { raw: !0, cmd: r };
147
116
  }
148
- function k(r, t) {
149
- return t != null && t.isCurrentProject ? `${T} ${O} ${R} ${r}` : `${T} ${b} ${r}`;
117
+ function y(r, t) {
118
+ return t?.isCurrentProject ? `${w} ${S} ${T} ${r}` : `${w} ${_} ${r}`;
150
119
  }
151
- function X(r, t) {
152
- return typeof r == "function" ? k(r(t), t) : typeof r == "object" && (r == null ? void 0 : r.raw) === !0 ? r.cmd : typeof r == "string" ? k(r, t) : r;
120
+ function D(r, t) {
121
+ return typeof r == "function" ? y(r(t), t) : typeof r == "object" && r?.raw === !0 ? r.cmd : typeof r == "string" ? y(r, t) : r;
153
122
  }
154
- function er(r) {
155
- return a(this, null, function* () {
156
- const t = yield B({ name: M });
157
- if (t.success) {
158
- const e = { isCurrentProject: t.result.isCurrentProject }, s = typeof r == "function" ? r(e) : r;
159
- return Object.fromEntries(
160
- Object.entries(s).map(([i, o]) => [i, X(o, e)])
161
- );
162
- }
163
- });
123
+ async function Y(r) {
124
+ const t = await $({ name: I });
125
+ if (t.success) {
126
+ const e = { isCurrentProject: t.result.isCurrentProject }, o = typeof r == "function" ? r(e) : r;
127
+ return Object.fromEntries(
128
+ Object.entries(o).map(([s, n]) => [s, D(n, e)])
129
+ );
130
+ }
164
131
  }
165
- function nr(r, t) {
166
- return a(this, arguments, function* (e, s, i = {}) {
167
- let o;
168
- try {
169
- const l = Date.now();
170
- h.start(`${e}`), N().DEBUG ? h.info(`→ ${s}`) : o = setInterval(() => {
171
- const n = Math.floor((Date.now() - l) / 1e3);
172
- n > 0 && p.stdout.write(`\r ${e}... ${n}s`);
173
- }, 100), yield Y(s, D, i), o && (clearInterval(o), p.stdout.write("\r\x1B[K")), h.success(`${e} done.`);
174
- } catch (l) {
175
- if (o && (clearInterval(o), p.stdout.write("\r\x1B[K")), i.throwOnError)
176
- throw l;
177
- E(l);
178
- }
179
- });
132
+ async function X(r, t, e = {}) {
133
+ let o;
134
+ try {
135
+ const s = Date.now();
136
+ l.start(`${r}`), C().DEBUG ? l.info(`→ ${t}`) : o = setInterval(() => {
137
+ const n = Math.floor((Date.now() - s) / 1e3);
138
+ n > 0 && u.stdout.write(`\r⏳ ${r}... ${n}s`);
139
+ }, 100), await v(t, L, e), o && (clearInterval(o), u.stdout.write("\r\x1B[K")), l.success(`${r} done.`);
140
+ } catch (s) {
141
+ if (o && (clearInterval(o), u.stdout.write("\r\x1B[K")), e.throwOnError)
142
+ throw s;
143
+ p(s);
144
+ }
180
145
  }
181
146
  export {
182
- rr as clearAllErrorLists,
183
- X as formatCommand,
184
- W as getStoredErrorLists,
185
- tr as rawCommand,
186
- er as resolveCommands,
187
- nr as runCommand
147
+ b as clearAllErrorLists,
148
+ D as formatCommand,
149
+ B as getStoredErrorLists,
150
+ U as rawCommand,
151
+ Y as resolveCommands,
152
+ X as runCommand
188
153
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("@nestjs/core"),m=require("compression"),h=require("cookie-parser"),w=require("cors"),c=require("express"),q=require("express-session"),x=require("express-useragent"),b=require("graphql-upload/graphqlUploadExpress.mjs"),g=require("helmet");var S=Object.defineProperty,u=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,d=(e,r,t)=>r in e?S(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,E=(e,r)=>{for(var t in r||(r={}))v.call(r,t)&&d(e,t,r[t]);if(u)for(var t of u(r))p.call(r,t)&&d(e,t,r[t]);return e},C=(e,r)=>{var t={};for(var s in e)v.call(e,s)&&r.indexOf(s)<0&&(t[s]=e[s]);if(e!=null&&u)for(var s of u(e))r.indexOf(s)<0&&p.call(e,s)&&(t[s]=e[s]);return t},N=(e,r,t)=>new Promise((s,a)=>{var n=i=>{try{o(t.next(i))}catch(f){a(f)}},l=i=>{try{o(t.throw(i))}catch(f){a(f)}},o=i=>i.done?s(i.value):Promise.resolve(i.value).then(n,l);o((t=t.apply(e,r)).next())});function y(e){var r=e,{isDev:t,whiteList:s}=r,a=C(r,["isDev","whiteList"]);return E({origin:(n,l)=>{t||!n||s!=null&&s.includes(n!=null?n:"")?l(null,!0):l(new Error("Not allowed by CORS"),!1)},credentials:!0},a)}function j(e){return w(y(e))}function A(e){return q(e)}function _(e,r=!1){e.set("trust proxy",1),e.use(g({crossOriginEmbedderPolicy:r?!1:void 0,contentSecurityPolicy:r?!1:void 0})),e.use(h()),e.use(c.urlencoded({extended:!0})),e.use(m()),e.use(x.express())}function O(e,r){r&&(Array.isArray(r)?r:[r]).forEach(s=>{e.use(`/${s}`,c.static(s))})}function I(e){const r=c();return _(r,e==null?void 0:e.isDev),O(r,e==null?void 0:e.static),r.use(b()),r}function D(e){return N(this,null,function*(){const r=yield P.NestFactory.create(e.module);return _(r.getHttpAdapter().getInstance(),e.isDev),O(r.getHttpAdapter().getInstance(),e.static),e.filters&&r.useGlobalFilters(...e.filters),e.pipes&&r.useGlobalPipes(...e.pipes),r})}exports.express=c;exports.createCors=j;exports.createCorsOptions=y;exports.createExpress=I;exports.createNest=D;exports.createSession=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@nestjs/core"),l=require("compression"),f=require("cookie-parser"),d=require("cors"),s=require("express"),p=require("express-session"),y=require("express-useragent"),q=require("graphql-upload/graphqlUploadExpress.mjs"),g=require("helmet");function c({isDev:e,whiteList:r,...i}){return{origin:(t,u)=>{e||!t||r?.includes(t??"")?u(null,!0):u(new Error("Not allowed by CORS"),!1)},credentials:!0,...i}}function x(e){return d(c(e))}function S(e){return p(e)}function n(e,r=!1){e.set("trust proxy",1),e.use(g({crossOriginEmbedderPolicy:r?!1:void 0,contentSecurityPolicy:r?!1:void 0})),e.use(f()),e.use(s.urlencoded({extended:!0})),e.use(l()),e.use(y.express())}function a(e,r){r&&(Array.isArray(r)?r:[r]).forEach(t=>{e.use(`/${t}`,s.static(t))})}function E(e){const r=s();return n(r,e?.isDev),a(r,e?.static),r.use(q()),r}async function b(e){const r=await o.NestFactory.create(e.module);return n(r.getHttpAdapter().getInstance(),e.isDev),a(r.getHttpAdapter().getInstance(),e.static),e.filters&&r.useGlobalFilters(...e.filters),e.pipes&&r.useGlobalPipes(...e.pipes),r}exports.express=s;exports.createCors=x;exports.createCorsOptions=c;exports.createExpress=E;exports.createNest=b;exports.createSession=S;
@@ -1,87 +1,54 @@
1
- import { NestFactory as _ } from "@nestjs/core";
2
- import O from "compression";
3
- import P from "cookie-parser";
4
- import h from "cors";
5
- import c from "express";
6
- import { default as J } from "express";
7
- import w from "express-session";
8
- import { express as x } from "express-useragent";
9
- import b from "graphql-upload/graphqlUploadExpress.mjs";
10
- import E from "helmet";
11
- var g = Object.defineProperty, o = Object.getOwnPropertySymbols, p = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable, m = (e, r, t) => r in e ? g(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, S = (e, r) => {
12
- for (var t in r || (r = {}))
13
- p.call(r, t) && m(e, t, r[t]);
14
- if (o)
15
- for (var t of o(r))
16
- d.call(r, t) && m(e, t, r[t]);
17
- return e;
18
- }, A = (e, r) => {
19
- var t = {};
20
- for (var s in e)
21
- p.call(e, s) && r.indexOf(s) < 0 && (t[s] = e[s]);
22
- if (e != null && o)
23
- for (var s of o(e))
24
- r.indexOf(s) < 0 && d.call(e, s) && (t[s] = e[s]);
25
- return t;
26
- }, I = (e, r, t) => new Promise((s, n) => {
27
- var a = (i) => {
28
- try {
29
- f(t.next(i));
30
- } catch (u) {
31
- n(u);
32
- }
33
- }, l = (i) => {
34
- try {
35
- f(t.throw(i));
36
- } catch (u) {
37
- n(u);
38
- }
39
- }, f = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(a, l);
40
- f((t = t.apply(e, r)).next());
41
- });
42
- function N(e) {
43
- var r = e, { isDev: t, whiteList: s } = r, n = A(r, ["isDev", "whiteList"]);
44
- return S({
45
- origin: (a, l) => {
46
- t || !a || s != null && s.includes(a != null ? a : "") ? l(null, !0) : l(new Error("Not allowed by CORS"), !1);
1
+ import { NestFactory as u } from "@nestjs/core";
2
+ import a from "compression";
3
+ import f from "cookie-parser";
4
+ import m from "cors";
5
+ import s from "express";
6
+ import { default as $ } from "express";
7
+ import l from "express-session";
8
+ import { express as p } from "express-useragent";
9
+ import d from "graphql-upload/graphqlUploadExpress.mjs";
10
+ import x from "helmet";
11
+ function y({ isDev: e, whiteList: r, ...o }) {
12
+ return {
13
+ origin: (t, i) => {
14
+ e || !t || r?.includes(t ?? "") ? i(null, !0) : i(new Error("Not allowed by CORS"), !1);
47
15
  },
48
- credentials: !0
49
- }, n);
16
+ credentials: !0,
17
+ ...o
18
+ };
50
19
  }
51
- function M(e) {
52
- return h(N(e));
20
+ function C(e) {
21
+ return m(y(e));
53
22
  }
54
- function U(e) {
55
- return w(e);
23
+ function N(e) {
24
+ return l(e);
56
25
  }
57
- function v(e, r = !1) {
26
+ function c(e, r = !1) {
58
27
  e.set("trust proxy", 1), e.use(
59
- E({
28
+ x({
60
29
  crossOriginEmbedderPolicy: r ? !1 : void 0,
61
30
  contentSecurityPolicy: r ? !1 : void 0
62
31
  })
63
- ), e.use(P()), e.use(c.urlencoded({ extended: !0 })), e.use(O()), e.use(x());
32
+ ), e.use(f()), e.use(s.urlencoded({ extended: !0 })), e.use(a()), e.use(p());
64
33
  }
65
- function y(e, r) {
66
- r && (Array.isArray(r) ? r : [r]).forEach((s) => {
67
- e.use(`/${s}`, c.static(s));
34
+ function n(e, r) {
35
+ r && (Array.isArray(r) ? r : [r]).forEach((t) => {
36
+ e.use(`/${t}`, s.static(t));
68
37
  });
69
38
  }
70
- function V(e) {
71
- const r = c();
72
- return v(r, e == null ? void 0 : e.isDev), y(r, e == null ? void 0 : e.static), r.use(b()), r;
39
+ function O(e) {
40
+ const r = s();
41
+ return c(r, e?.isDev), n(r, e?.static), r.use(d()), r;
73
42
  }
74
- function z(e) {
75
- return I(this, null, function* () {
76
- const r = yield _.create(e.module);
77
- return v(r.getHttpAdapter().getInstance(), e.isDev), y(r.getHttpAdapter().getInstance(), e.static), e.filters && r.useGlobalFilters(...e.filters), e.pipes && r.useGlobalPipes(...e.pipes), r;
78
- });
43
+ async function G(e) {
44
+ const r = await u.create(e.module);
45
+ return c(r.getHttpAdapter().getInstance(), e.isDev), n(r.getHttpAdapter().getInstance(), e.static), e.filters && r.useGlobalFilters(...e.filters), e.pipes && r.useGlobalPipes(...e.pipes), r;
79
46
  }
80
47
  export {
81
- M as createCors,
82
- N as createCorsOptions,
83
- V as createExpress,
84
- z as createNest,
85
- U as createSession,
86
- J as express
48
+ C as createCors,
49
+ y as createCorsOptions,
50
+ O as createExpress,
51
+ G as createNest,
52
+ N as createSession,
53
+ $ as express
87
54
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("fs-extra"),m=require("node:path");var _=Object.defineProperty,c=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,l=(n,e,r)=>e in n?_(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,O=(n,e)=>{for(var r in e||(e={}))f.call(e,r)&&l(n,r,e[r]);if(c)for(var r of c(e))S.call(e,r)&&l(n,r,e[r]);return n},g=(n,e)=>{var r={};for(var t in n)f.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&c)for(var t of c(n))e.indexOf(t)<0&&S.call(n,t)&&(r[t]=n[t]);return r};const E=i,{lstatSync:w,readdirSync:x,mkdirSync:F,readFileSync:s,unlinkSync:b,statSync:u,createWriteStream:j}=i,h=i.readJsonSync;function d(n,e,r){i.writeFileSync(n,e,r!=null?r:"utf-8")}function p(n,e,r){i.appendFileSync(n,e,r!=null?r:"utf-8")}function y(...n){return n.every(e=>i.pathExistsSync(e))}function J(...n){n.forEach(e=>{y(e)&&i.removeSync(e)})}function P(n,e,r={}){const t=r,{extensions:a}=t,v=g(t,["extensions"]);i.copySync(n,e,O({filter:o=>u(o).isDirectory()||!a||a.length===0?!0:a.includes(m.extname(o))},v))}function k(n,e){const r=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("fs-extra"),d=require("node:path"),l=c,{lstatSync:f,readdirSync:p,mkdirSync:m,readFileSync:S,unlinkSync:F,statSync:o,createWriteStream:E}=c,x=c.readJsonSync;function s(n,e,t){c.writeFileSync(n,e,t??"utf-8")}function a(n,e,t){c.appendFileSync(n,e,t??"utf-8")}function i(...n){return n.every(e=>c.pathExistsSync(e))}function g(...n){n.forEach(e=>{i(e)&&c.removeSync(e)})}function v(n,e,t={}){const{extensions:r,...u}=t;c.copySync(n,e,{filter:y=>o(y).isDirectory()||!r||r.length===0?!0:r.includes(d.extname(y)),...u})}function k(n,e){const t=`
2
2
  ${e}
3
- `;y(n)?s(n,"utf-8").split(`
4
- `).includes(e)||p(n,r):d(n,r)}exports.addGitIgnoreEntry=k;exports.appendFileSync=p;exports.copySync=P;exports.createWriteStream=j;exports.fs=E;exports.lstatSync=w;exports.mkdirSync=F;exports.pathExistsSync=y;exports.readFileSync=s;exports.readJsonSync=h;exports.readdirSync=x;exports.removeSync=J;exports.statSync=u;exports.unlinkSync=b;exports.writeFileSync=d;
3
+ `;i(n)?S(n,"utf-8").split(`
4
+ `).includes(e)||a(n,t):s(n,t)}exports.addGitIgnoreEntry=k;exports.appendFileSync=a;exports.copySync=v;exports.createWriteStream=E;exports.fs=l;exports.lstatSync=f;exports.mkdirSync=m;exports.pathExistsSync=i;exports.readFileSync=S;exports.readJsonSync=x;exports.readdirSync=p;exports.removeSync=g;exports.statSync=o;exports.unlinkSync=F;exports.writeFileSync=s;
@@ -1,71 +1,56 @@
1
- import i from "fs-extra";
2
- import p from "node:path";
3
- var S = Object.defineProperty, c = Object.getOwnPropertySymbols, l = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable, a = (n, r, e) => r in n ? S(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e, d = (n, r) => {
4
- for (var e in r || (r = {}))
5
- l.call(r, e) && a(n, e, r[e]);
6
- if (c)
7
- for (var e of c(r))
8
- y.call(r, e) && a(n, e, r[e]);
9
- return n;
10
- }, m = (n, r) => {
11
- var e = {};
12
- for (var t in n)
13
- l.call(n, t) && r.indexOf(t) < 0 && (e[t] = n[t]);
14
- if (n != null && c)
15
- for (var t of c(n))
16
- r.indexOf(t) < 0 && y.call(n, t) && (e[t] = n[t]);
17
- return e;
18
- };
19
- const g = i, {
20
- lstatSync: F,
21
- readdirSync: b,
22
- mkdirSync: j,
23
- readFileSync: _,
24
- unlinkSync: h,
25
- statSync: v,
26
- createWriteStream: J
27
- } = i, P = i.readJsonSync;
28
- function O(n, r, e) {
29
- i.writeFileSync(n, r, e != null ? e : "utf-8");
1
+ import c from "fs-extra";
2
+ import y from "node:path";
3
+ const l = c, {
4
+ lstatSync: m,
5
+ readdirSync: x,
6
+ mkdirSync: E,
7
+ readFileSync: f,
8
+ unlinkSync: F,
9
+ statSync: S,
10
+ createWriteStream: v
11
+ } = c, g = c.readJsonSync;
12
+ function u(n, t, e) {
13
+ c.writeFileSync(n, t, e ?? "utf-8");
30
14
  }
31
- function x(n, r, e) {
32
- i.appendFileSync(n, r, e != null ? e : "utf-8");
15
+ function p(n, t, e) {
16
+ c.appendFileSync(n, t, e ?? "utf-8");
33
17
  }
34
- function s(...n) {
35
- return n.every((r) => i.pathExistsSync(r));
18
+ function o(...n) {
19
+ return n.every((t) => c.pathExistsSync(t));
36
20
  }
37
- function C(...n) {
38
- n.forEach((r) => {
39
- s(r) && i.removeSync(r);
21
+ function k(...n) {
22
+ n.forEach((t) => {
23
+ o(t) && c.removeSync(t);
40
24
  });
41
25
  }
42
- function D(n, r, e = {}) {
43
- const t = e, { extensions: o } = t, u = m(t, ["extensions"]);
44
- i.copySync(n, r, d({
45
- filter: (f) => v(f).isDirectory() || !o || o.length === 0 ? !0 : o.includes(p.extname(f))
46
- }, u));
26
+ function w(n, t, e = {}) {
27
+ const { extensions: i, ...s } = e;
28
+ c.copySync(n, t, {
29
+ filter: (r) => S(r).isDirectory() || !i || i.length === 0 ? !0 : i.includes(y.extname(r)),
30
+ ...s
31
+ });
47
32
  }
48
- function G(n, r) {
33
+ function J(n, t) {
49
34
  const e = `
50
- ${r}
35
+ ${t}
51
36
  `;
52
- s(n) ? _(n, "utf-8").split(`
53
- `).includes(r) || x(n, e) : O(n, e);
37
+ o(n) ? f(n, "utf-8").split(`
38
+ `).includes(t) || p(n, e) : u(n, e);
54
39
  }
55
40
  export {
56
- G as addGitIgnoreEntry,
57
- x as appendFileSync,
58
- D as copySync,
59
- J as createWriteStream,
60
- g as fs,
61
- F as lstatSync,
62
- j as mkdirSync,
63
- s as pathExistsSync,
64
- _ as readFileSync,
65
- P as readJsonSync,
66
- b as readdirSync,
67
- C as removeSync,
68
- v as statSync,
69
- h as unlinkSync,
70
- O as writeFileSync
41
+ J as addGitIgnoreEntry,
42
+ p as appendFileSync,
43
+ w as copySync,
44
+ v as createWriteStream,
45
+ l as fs,
46
+ m as lstatSync,
47
+ E as mkdirSync,
48
+ o as pathExistsSync,
49
+ f as readFileSync,
50
+ g as readJsonSync,
51
+ x as readdirSync,
52
+ k as removeSync,
53
+ S as statSync,
54
+ F as unlinkSync,
55
+ u as writeFileSync
71
56
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("chalk"),e=require("consola"),h=require("graphql"),S=require("../../config/env/env.util.cjs"),g=require("../../constant/response-status.cjs"),R=S.getEnv();function d({message:o,status:r=g.RESPONSE_STATUS.INTERNAL_SERVER_ERROR,type:t="graphql"}){var l;const n=(l=o!=null?o:r.MESSAGE)!=null?l:"Internal server error";throw t==="graphql"?new h.GraphQLError(n,{extensions:{code:r.CODE}}):new Error(n)}R.DEBUG||(e.level=4);function s(o){const r=c[o];return typeof r=="function"?r:c.green}const i={silent:e.silent,level:e.level,fatal:e.fatal,error:e.error,warn:e.warn,log:e.log,info:e.info,success:e.success,ready:e.ready,start:e.start,box:e.box,debug:e.debug,trace:e.trace,verbose:e.verbose,printBoxedLog(o,r,t="red"){if(!(r!=null&&r.length)){e.box(c.green(o));return}r.forEach(({file:l,position:n,rule:a,message:u})=>{const E=n?`:${n}`:"",f=`${l}${E}`;e.log(`${c.gray("File:")} ${c.blue(f)}`),a&&e.log(` ${s(t)("Rule:")} ${a}`),e.log(` ${s(t)("Message:")} ${u}`)}),e.box(s(t)(`${o} : ${r.length}`)),e.log(c.gray("─".repeat(40)))}};function b(o,r){const{shouldLog:t=!0,returnValue:l,callback:n}=r!=null?r:{},a=o instanceof Error?o:new Error(typeof o=="string"?o:"Unknown error");return t&&i.error(a.message),n&&typeof n=="function"&&n(a),l||{success:!1,message:a.message,code:g.RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE}}exports.catchError=b;exports.log=i;exports.throwError=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("chalk"),e=require("consola"),h=require("graphql"),S=require("../../config/env/env.util.cjs"),g=require("../../constant/response-status.cjs"),R=S.getEnv();function b({message:r,status:o=g.RESPONSE_STATUS.INTERNAL_SERVER_ERROR,type:n="graphql"}){const t=r??o.MESSAGE??"Internal server error";throw n==="graphql"?new h.GraphQLError(t,{extensions:{code:o.CODE}}):new Error(t)}R.DEBUG||(e.level=4);function c(r){const o=l[r];return typeof o=="function"?o:l.green}const i={silent:e.silent,level:e.level,fatal:e.fatal,error:e.error,warn:e.warn,log:e.log,info:e.info,success:e.success,ready:e.ready,start:e.start,box:e.box,debug:e.debug,trace:e.trace,verbose:e.verbose,printBoxedLog(r,o,n="red"){if(!o?.length){e.box(l.green(r));return}o.forEach(({file:t,position:s,rule:a,message:E})=>{const f=s?`:${s}`:"",u=`${t}${f}`;e.log(`${l.gray("File:")} ${l.blue(u)}`),a&&e.log(` ${c(n)("Rule:")} ${a}`),e.log(` ${c(n)("Message:")} ${E}`)}),e.box(c(n)(`${r} : ${o.length}`)),e.log(l.gray("─".repeat(40)))}};function d(r,o){const{shouldLog:n=!0,returnValue:t,callback:s}=o??{},a=r instanceof Error?r:new Error(typeof r=="string"?r:"Unknown error");return n&&i.error(a.message),s&&typeof s=="function"&&s(a),t||{success:!1,message:a.message,code:g.RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE}}exports.catchError=d;exports.log=i;exports.throwError=b;