mp-front-cli 0.0.41 → 0.0.43

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.
@@ -1,8 +1,11 @@
1
1
  import { Observable } from "rxjs";
2
2
  import type { NextApiRequest, NextApiResponse } from "next";
3
3
  import { CustomEncrypter } from "../utils/custom-encrypter";
4
+ import type { NextAuthOptions } from "next-auth";
4
5
  export declare class ApiMiddleware<TRes, TData = {}> extends CustomEncrypter {
5
6
  private uuid;
7
+ private authOptions;
8
+ constructor(authOptions: NextAuthOptions);
6
9
  private returnData;
7
10
  private returnError;
8
11
  get(handle: (params: TData, uuid?: string) => Observable<TRes>): (req: NextApiRequest, res: NextApiResponse) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAA6B,MAAM,MAAM,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,qBAAa,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IAClE,OAAO,CAAC,IAAI,CAAa;IAEzB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,WAAW;IAKnB,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC,IAAI,CAAC,SAG/C,cAAc,OAAO,eAAe;CAoCpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAA6B,MAAM,MAAM,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,qBAAa,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IAClE,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,WAAW,CAAiB;gBAExB,WAAW,EAAE,eAAe;IAKxC,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,WAAW;IAKnB,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC,IAAI,CAAC,SAG/C,cAAc,OAAO,eAAe;CAoCpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-service-fe.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/api-request/fetch-service-fe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,UAAU,EAAS,MAAM,MAAM,CAAA;AAG3E,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,qBAAa,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IACnE,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,gBAAgB,CAAgB;IAExC,mBAAmB,CAAC,gBAAgB,EAAE,OAAO;gBAK3C,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAe,EACvB,OAAO,GAAE,WAAgB;IAW3B,OAAO,CAAC,YAAY;IAQpB,SAAS,CAAC,MAAM,GAAE,KAAmB,GAAG,UAAU,CAAC,IAAI,CAAC;CAiCzD"}
1
+ {"version":3,"file":"fetch-service-fe.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/api-request/fetch-service-fe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,UAAU,EAAS,MAAM,MAAM,CAAA;AAG3E,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,qBAAa,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IACnE,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,gBAAgB,CAAgB;IAExC,mBAAmB,CAAC,gBAAgB,EAAE,OAAO;gBAK3C,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAe,EACvB,OAAO,GAAE,WAAgB;IAW3B,OAAO,CAAC,YAAY;IAQpB,SAAS,CAAC,MAAM,GAAE,KAAmB,GAAG,UAAU,CAAC,IAAI,CAAC;CAqCzD"}
@@ -1,8 +1,6 @@
1
1
  import { CustomValidator } from "./custom-validator";
2
2
  export declare class CustomEncrypter extends CustomValidator {
3
3
  private signatureKey;
4
- constructor();
5
- private isJSON;
6
4
  private generateKey;
7
5
  protected encrypt<T>(payload: T): Promise<string>;
8
6
  protected decrypt<T>(encrypted: string): Promise<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"custom-encrypter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-encrypter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,qBAAa,eAAgB,SAAQ,eAAe;IAClD,OAAO,CAAC,YAAY,CAAqB;;IAOzC,OAAO,CAAC,MAAM;YASA,WAAW;cAgBT,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;cAgBrB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM;cAS5B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahD,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;CAIlC"}
1
+ {"version":3,"file":"custom-encrypter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-encrypter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,qBAAa,eAAgB,SAAQ,eAAe;IAClD,OAAO,CAAC,YAAY,CAAqB;YAE3B,WAAW;cAgBT,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;cAgBrB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM;cAU5B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahD,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;CAIlC"}
@@ -4,7 +4,6 @@ export declare class CustomHeader extends CustomEncrypter {
4
4
  private headers;
5
5
  constructor();
6
6
  addTokenBackend(headers: HeadersInit): Observable<HeadersInit>;
7
- private temporaryCognitoHeader;
8
7
  getHeaders(): Observable<HeadersInit>;
9
8
  }
10
9
  //# sourceMappingURL=custom-header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-header.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,qBAAa,YAAa,SAAQ,eAAe;IAC/C,OAAO,CAAC,OAAO,CAAa;;IAU5B,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAS9D,OAAO,CAAC,sBAAsB;IAgB9B,UAAU,IAAI,UAAU,CAAC,WAAW,CAAC;CAStC"}
1
+ {"version":3,"file":"custom-header.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,qBAAa,YAAa,SAAQ,eAAe;IAC/C,OAAO,CAAC,OAAO,CAAa;;IAU5B,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAS9D,UAAU,IAAI,UAAU,CAAC,WAAW,CAAC;CAMtC"}
@@ -1,7 +1,7 @@
1
- import type { NextApiRequest } from "next";
2
- import type { NextRequest } from "next/server";
1
+ import type { NextApiRequest, NextApiResponse } from "next";
3
2
  import { CustomEncoder } from "./custom-encoder";
3
+ import { type NextAuthOptions } from "next-auth";
4
4
  export declare class CustomValidator extends CustomEncoder {
5
- validateTokenFront(req: NextApiRequest | NextRequest): Promise<NextApiRequest | NextRequest>;
5
+ validateTokenFront(req: NextApiRequest, res: NextApiResponse, authOptions: NextAuthOptions): Promise<NextApiRequest>;
6
6
  }
7
7
  //# sourceMappingURL=custom-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-validator.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD,qBAAa,eAAgB,SAAQ,aAAa;IAC1C,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW;CAS3D"}
1
+ {"version":3,"file":"custom-validator.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,WAAW,CAAA;AAElE,qBAAa,eAAgB,SAAQ,aAAa;IAC1C,kBAAkB,CACtB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,eAAe;CAU/B"}
@@ -2,11 +2,8 @@ var nv = Object.defineProperty;
2
2
  var av = (e, t, r) => t in e ? nv(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var Bu = (e, t, r) => (av(e, typeof t != "symbol" ? t + "" : t, r), r);
4
4
  import { c as tr, a as iv } from "./custom-encoder-70a77460.js";
5
- import mf, { createHash as sv } from "crypto";
6
- import { C as ov } from "./custom-validator-8a042f7f.js";
7
- function fv(e) {
8
- throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
9
- }
5
+ import { c as sv, C as ov } from "./custom-validator-49426b3d.js";
6
+ import mf, { createHash as fv } from "crypto";
10
7
  var Zs = { exports: {} };
11
8
  /*!
12
9
  * @overview es6-promise - a tiny implementation of Promises/A+.
@@ -87,7 +84,7 @@ function d0() {
87
84
  }
88
85
  }
89
86
  var W = void 0;
90
- E ? W = x() : y ? W = T() : g ? W = F() : d === void 0 && typeof fv == "function" ? W = j() : W = R();
87
+ E ? W = x() : y ? W = T() : g ? W = F() : d === void 0 && typeof sv == "function" ? W = j() : W = R();
91
88
  function J(U, G) {
92
89
  var H = this, re = new this.constructor(_e);
93
90
  re[xe] === void 0 && cr(re);
@@ -20270,16 +20267,8 @@ var h0 = Eu, xi = {
20270
20267
  const Lk = /* @__PURE__ */ iv(xi);
20271
20268
  class Mk extends ov {
20272
20269
  constructor() {
20273
- super();
20270
+ super(...arguments);
20274
20271
  Bu(this, "signatureKey");
20275
- this.generateKey();
20276
- }
20277
- isJSON(r) {
20278
- try {
20279
- return JSON.parse(r ?? ""), !0;
20280
- } catch {
20281
- return !1;
20282
- }
20283
20272
  }
20284
20273
  async generateKey() {
20285
20274
  const r = process.env.SECRET_SIGNATURE;
@@ -20291,7 +20280,7 @@ class Mk extends ov {
20291
20280
  });
20292
20281
  }
20293
20282
  async encrypt(r) {
20294
- if (!this.signatureKey)
20283
+ if (await this.generateKey(), !this.signatureKey)
20295
20284
  throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");
20296
20285
  const n = JSON.stringify(r).normalize("NFD").replace(/[\u0300-\u036f]/g, "");
20297
20286
  return await xi.JWE.createEncrypt(
@@ -20300,7 +20289,7 @@ class Mk extends ov {
20300
20289
  ).update(n).final();
20301
20290
  }
20302
20291
  async decrypt(r) {
20303
- if (!this.signatureKey)
20292
+ if (await this.generateKey(), !this.signatureKey)
20304
20293
  throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");
20305
20294
  const { payload: n } = await xi.JWE.createDecrypt(this.signatureKey).decrypt(
20306
20295
  r
@@ -20317,7 +20306,7 @@ class Mk extends ov {
20317
20306
  }
20318
20307
  generateSHA(r) {
20319
20308
  const n = JSON.stringify(r);
20320
- return sv("sha256").update(n).digest("hex");
20309
+ return fv("sha256").update(n).digest("hex");
20321
20310
  }
20322
20311
  }
20323
20312
  export {