@chanzor/nest-leaf 0.0.1 → 0.0.2

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/index.js CHANGED
@@ -1,69 +1,69 @@
1
1
  import { ForbiddenException as i } from "@nestjs/common";
2
- function f(t) {
3
- let n;
4
- return t.length > 0 && (n = (e, r) => {
2
+ function d(r) {
3
+ let t;
4
+ return r.length > 0 && (t = (e, n) => {
5
5
  if (e === void 0) {
6
- r(null, !0);
6
+ n(null, !0);
7
7
  return;
8
8
  }
9
9
  if (typeof e != "string")
10
10
  throw new i("Not allowed by CORS");
11
- for (const o of t) {
11
+ for (const o of r) {
12
12
  if (o.includes("*") && new RegExp(`^${o.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`).test(e)) {
13
- r(null, !0);
13
+ n(null, !0);
14
14
  return;
15
15
  }
16
16
  if (o === e) {
17
- r(null, !0);
17
+ n(null, !0);
18
18
  return;
19
19
  }
20
20
  }
21
21
  throw new i("Not allowed by CORS");
22
- }), { origin: n, methods: ["GET"], credentials: !0, allowedHeaders: ["Content-Type", "x-access-token"] };
22
+ }), { origin: t, methods: ["GET"], credentials: !0, allowedHeaders: ["Content-Type", "x-access-token"] };
23
23
  }
24
- function d(t) {
25
- switch (t) {
24
+ function f(r) {
25
+ switch (r) {
26
26
  case "dev":
27
27
  return !1;
28
28
  case "prod":
29
29
  return !0;
30
30
  }
31
31
  }
32
- function c(t, n) {
33
- const e = t.get(n);
32
+ function c(r, t) {
33
+ const e = r.get(t);
34
34
  if (typeof e != "string") return;
35
- const r = e.trim();
36
- if (r.length)
37
- return r;
35
+ const n = e.trim();
36
+ if (n.length)
37
+ return n;
38
38
  }
39
- function l(t, n) {
40
- const e = t.get(n);
39
+ function l(r, t) {
40
+ const e = r.get(t);
41
41
  if (typeof e == "string")
42
- return e.split(",").map((r) => r.trim());
42
+ return e.split(",").map((n) => n.trim());
43
43
  }
44
- function p(t, n) {
45
- switch (t.get(n)) {
44
+ function p(r, t) {
45
+ switch (r.get(t)) {
46
46
  case "dev":
47
47
  return "dev";
48
48
  case "prod":
49
49
  return "prod";
50
50
  default:
51
- throw new Error(`${n} is not defined`);
51
+ throw new Error(`${t} is invalid, must be 'dev' or 'prod'`);
52
52
  }
53
53
  }
54
- function a(t, n) {
55
- const e = t.get(n);
54
+ function a(r, t) {
55
+ const e = r.get(t);
56
56
  if (typeof e == "number") return e;
57
57
  if (typeof e == "string") {
58
- const r = parseInt(e);
59
- if (!isNaN(r))
60
- return r;
58
+ const n = parseInt(e);
59
+ if (!isNaN(n))
60
+ return n;
61
61
  }
62
- throw new Error(`${n} is not defined`);
62
+ throw new Error(`${t} is invalid, must be a number integer`);
63
63
  }
64
64
  export {
65
- f as buildConfigCorsOption,
66
- d as isConfigProd,
65
+ d as buildConfigCorsOption,
66
+ f as isConfigProd,
67
67
  c as optionalEnvAccessToken,
68
68
  l as optionalEnvAllowedCrossOrigin,
69
69
  p as requireEnvMode,
@@ -1 +1 @@
1
- (function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@nestjs/common")):typeof define=="function"&&define.amd?define(["exports","@nestjs/common"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n["@chanzor/nest-leaf"]={},n.NestjsCommon))})(this,function(n,i){"use strict";function d(o){let t;return o.length>0&&(t=(e,r)=>{if(e===void 0){r(null,!0);return}if(typeof e!="string")throw new i.ForbiddenException("Not allowed by CORS");for(const s of o){if(s.includes("*")&&new RegExp(`^${s.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(e)){r(null,!0);return}if(s===e){r(null,!0);return}}throw new i.ForbiddenException("Not allowed by CORS")}),{origin:t,methods:["GET"],credentials:!0,allowedHeaders:["Content-Type","x-access-token"]}}function f(o){switch(o){case"dev":return!1;case"prod":return!0}}function u(o,t){const e=o.get(t);if(typeof e!="string")return;const r=e.trim();if(r.length)return r}function c(o,t){const e=o.get(t);if(typeof e=="string")return e.split(",").map(r=>r.trim())}function l(o,t){switch(o.get(t)){case"dev":return"dev";case"prod":return"prod";default:throw new Error(`${t} is not defined`)}}function p(o,t){const e=o.get(t);if(typeof e=="number")return e;if(typeof e=="string"){const r=parseInt(e);if(!isNaN(r))return r}throw new Error(`${t} is not defined`)}n.buildConfigCorsOption=d,n.isConfigProd=f,n.optionalEnvAccessToken=u,n.optionalEnvAllowedCrossOrigin=c,n.requireEnvMode=l,n.requireEnvPort=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@nestjs/common")):typeof define=="function"&&define.amd?define(["exports","@nestjs/common"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n["@chanzor/nest-leaf"]={},n.NestjsCommon))})(this,function(n,i){"use strict";function u(o){let t;return o.length>0&&(t=(e,r)=>{if(e===void 0){r(null,!0);return}if(typeof e!="string")throw new i.ForbiddenException("Not allowed by CORS");for(const s of o){if(s.includes("*")&&new RegExp(`^${s.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(e)){r(null,!0);return}if(s===e){r(null,!0);return}}throw new i.ForbiddenException("Not allowed by CORS")}),{origin:t,methods:["GET"],credentials:!0,allowedHeaders:["Content-Type","x-access-token"]}}function d(o){switch(o){case"dev":return!1;case"prod":return!0}}function f(o,t){const e=o.get(t);if(typeof e!="string")return;const r=e.trim();if(r.length)return r}function c(o,t){const e=o.get(t);if(typeof e=="string")return e.split(",").map(r=>r.trim())}function l(o,t){switch(o.get(t)){case"dev":return"dev";case"prod":return"prod";default:throw new Error(`${t} is invalid, must be 'dev' or 'prod'`)}}function p(o,t){const e=o.get(t);if(typeof e=="number")return e;if(typeof e=="string"){const r=parseInt(e);if(!isNaN(r))return r}throw new Error(`${t} is invalid, must be a number integer`)}n.buildConfigCorsOption=u,n.isConfigProd=d,n.optionalEnvAccessToken=f,n.optionalEnvAllowedCrossOrigin=c,n.requireEnvMode=l,n.requireEnvPort=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chanzor/nest-leaf",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite build --watch",