wabe 0.5.6 → 0.5.7

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
@@ -27,16 +27,6 @@ var __export = (target, all) => {
27
27
  };
28
28
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
29
29
 
30
- // ../../node_modules/@node-rs/argon2-linux-x64-musl/argon2.linux-x64-musl.node
31
- var require_argon2_linux_x64_musl = __commonJS((exports, module) => {
32
- module.exports = __require("./argon2.linux-x64-musl-aaw3xv61.node");
33
- });
34
-
35
- // ../../node_modules/@node-rs/argon2-linux-x64-gnu/argon2.linux-x64-gnu.node
36
- var require_argon2_linux_x64_gnu = __commonJS((exports, module) => {
37
- module.exports = __require("./argon2.linux-x64-gnu-mv01cvnq.node");
38
- });
39
-
40
30
  // ../../node_modules/graphql/version.js
41
31
  var require_version = __commonJS((exports) => {
42
32
  Object.defineProperty(exports, "__esModule", {
@@ -33568,8 +33558,8 @@ var require_lib4 = __commonJS((exports) => {
33568
33558
  return this.searchParams;
33569
33559
  }
33570
33560
  [Symbol.for("nodejs.util.inspect.custom")]() {
33571
- const { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash } = this;
33572
- return { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash };
33561
+ const { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash: hash2 } = this;
33562
+ return { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash: hash2 };
33573
33563
  }
33574
33564
  }
33575
33565
  exports.ConnectionString = ConnectionString;
@@ -55423,7 +55413,7 @@ var require_urlparser = __commonJS((exports, module) => {
55423
55413
  }
55424
55414
  var protocol = this.protocol || "";
55425
55415
  var pathname = this.pathname || "";
55426
- var hash = this.hash || "";
55416
+ var hash2 = this.hash || "";
55427
55417
  var search = this.search || "";
55428
55418
  var query = "";
55429
55419
  var hostname = this.hostname || "";
@@ -55457,11 +55447,11 @@ var require_urlparser = __commonJS((exports, module) => {
55457
55447
  }
55458
55448
  if (search && search.charCodeAt(0) !== 63)
55459
55449
  search = "?" + search;
55460
- if (hash && hash.charCodeAt(0) !== 35)
55461
- hash = "#" + hash;
55450
+ if (hash2 && hash2.charCodeAt(0) !== 35)
55451
+ hash2 = "#" + hash2;
55462
55452
  pathname = escapePathName(pathname);
55463
55453
  search = escapeSearch(search);
55464
- return scheme + (host === false ? "" : host) + pathname + search + hash;
55454
+ return scheme + (host === false ? "" : host) + pathname + search + hash2;
55465
55455
  };
55466
55456
  Url.prototype.resolveObject = function Url$resolveObject(relative) {
55467
55457
  if (typeof relative === "string")
@@ -56784,340 +56774,8 @@ class HookObject {
56784
56774
  }
56785
56775
  }
56786
56776
 
56787
- // ../../node_modules/@node-rs/argon2/index.js
56788
- var { readFileSync } = __require("fs");
56789
- var nativeBinding = null;
56790
- var loadErrors = [];
56791
- var isMusl = () => {
56792
- let musl = false;
56793
- if (process.platform === "linux") {
56794
- musl = isMuslFromFilesystem();
56795
- if (musl === null) {
56796
- musl = isMuslFromReport();
56797
- }
56798
- if (musl === null) {
56799
- musl = isMuslFromChildProcess();
56800
- }
56801
- }
56802
- return musl;
56803
- };
56804
- var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
56805
- var isMuslFromFilesystem = () => {
56806
- try {
56807
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
56808
- } catch {
56809
- return null;
56810
- }
56811
- };
56812
- var isMuslFromReport = () => {
56813
- const report = typeof process.report.getReport === "function" ? process.report.getReport() : null;
56814
- if (!report) {
56815
- return null;
56816
- }
56817
- if (report.header && report.header.glibcVersionRuntime) {
56818
- return false;
56819
- }
56820
- if (Array.isArray(report.sharedObjects)) {
56821
- if (report.sharedObjects.some(isFileMusl)) {
56822
- return true;
56823
- }
56824
- }
56825
- return false;
56826
- };
56827
- var isMuslFromChildProcess = () => {
56828
- try {
56829
- return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
56830
- } catch (e) {
56831
- return false;
56832
- }
56833
- };
56834
- function requireNative() {
56835
- if (process.platform === "android") {
56836
- if (process.arch === "arm64") {
56837
- try {
56838
- return (()=>{throw new Error(`Cannot require module "./argon2.android-arm64.node"`);})();
56839
- } catch (e) {
56840
- loadErrors.push(e);
56841
- }
56842
- try {
56843
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-android-arm64"`);})();
56844
- } catch (e) {
56845
- loadErrors.push(e);
56846
- }
56847
- } else if (process.arch === "arm") {
56848
- try {
56849
- return (()=>{throw new Error(`Cannot require module "./argon2.android-arm-eabi.node"`);})();
56850
- } catch (e) {
56851
- loadErrors.push(e);
56852
- }
56853
- try {
56854
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-android-arm-eabi"`);})();
56855
- } catch (e) {
56856
- loadErrors.push(e);
56857
- }
56858
- } else {
56859
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
56860
- }
56861
- } else if (process.platform === "win32") {
56862
- if (process.arch === "x64") {
56863
- try {
56864
- return (()=>{throw new Error(`Cannot require module "./argon2.win32-x64-msvc.node"`);})();
56865
- } catch (e) {
56866
- loadErrors.push(e);
56867
- }
56868
- try {
56869
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-win32-x64-msvc"`);})();
56870
- } catch (e) {
56871
- loadErrors.push(e);
56872
- }
56873
- } else if (process.arch === "ia32") {
56874
- try {
56875
- return (()=>{throw new Error(`Cannot require module "./argon2.win32-ia32-msvc.node"`);})();
56876
- } catch (e) {
56877
- loadErrors.push(e);
56878
- }
56879
- try {
56880
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-win32-ia32-msvc"`);})();
56881
- } catch (e) {
56882
- loadErrors.push(e);
56883
- }
56884
- } else if (process.arch === "arm64") {
56885
- try {
56886
- return (()=>{throw new Error(`Cannot require module "./argon2.win32-arm64-msvc.node"`);})();
56887
- } catch (e) {
56888
- loadErrors.push(e);
56889
- }
56890
- try {
56891
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-win32-arm64-msvc"`);})();
56892
- } catch (e) {
56893
- loadErrors.push(e);
56894
- }
56895
- } else {
56896
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
56897
- }
56898
- } else if (process.platform === "darwin") {
56899
- try {
56900
- return (()=>{throw new Error(`Cannot require module "./argon2.darwin-universal.node"`);})();
56901
- } catch (e) {
56902
- loadErrors.push(e);
56903
- }
56904
- try {
56905
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-darwin-universal"`);})();
56906
- } catch (e) {
56907
- loadErrors.push(e);
56908
- }
56909
- if (process.arch === "x64") {
56910
- try {
56911
- return (()=>{throw new Error(`Cannot require module "./argon2.darwin-x64.node"`);})();
56912
- } catch (e) {
56913
- loadErrors.push(e);
56914
- }
56915
- try {
56916
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-darwin-x64"`);})();
56917
- } catch (e) {
56918
- loadErrors.push(e);
56919
- }
56920
- } else if (process.arch === "arm64") {
56921
- try {
56922
- return (()=>{throw new Error(`Cannot require module "./argon2.darwin-arm64.node"`);})();
56923
- } catch (e) {
56924
- loadErrors.push(e);
56925
- }
56926
- try {
56927
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-darwin-arm64"`);})();
56928
- } catch (e) {
56929
- loadErrors.push(e);
56930
- }
56931
- } else {
56932
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
56933
- }
56934
- } else if (process.platform === "freebsd") {
56935
- if (process.arch === "x64") {
56936
- try {
56937
- return (()=>{throw new Error(`Cannot require module "./argon2.freebsd-x64.node"`);})();
56938
- } catch (e) {
56939
- loadErrors.push(e);
56940
- }
56941
- try {
56942
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-freebsd-x64"`);})();
56943
- } catch (e) {
56944
- loadErrors.push(e);
56945
- }
56946
- } else if (process.arch === "arm64") {
56947
- try {
56948
- return (()=>{throw new Error(`Cannot require module "./argon2.freebsd-arm64.node"`);})();
56949
- } catch (e) {
56950
- loadErrors.push(e);
56951
- }
56952
- try {
56953
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-freebsd-arm64"`);})();
56954
- } catch (e) {
56955
- loadErrors.push(e);
56956
- }
56957
- } else {
56958
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
56959
- }
56960
- } else if (process.platform === "linux") {
56961
- if (process.arch === "x64") {
56962
- if (isMusl()) {
56963
- try {
56964
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-x64-musl.node"`);})();
56965
- } catch (e) {
56966
- loadErrors.push(e);
56967
- }
56968
- try {
56969
- return require_argon2_linux_x64_musl();
56970
- } catch (e) {
56971
- loadErrors.push(e);
56972
- }
56973
- } else {
56974
- try {
56975
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-x64-gnu.node"`);})();
56976
- } catch (e) {
56977
- loadErrors.push(e);
56978
- }
56979
- try {
56980
- return require_argon2_linux_x64_gnu();
56981
- } catch (e) {
56982
- loadErrors.push(e);
56983
- }
56984
- }
56985
- } else if (process.arch === "arm64") {
56986
- if (isMusl()) {
56987
- try {
56988
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-arm64-musl.node"`);})();
56989
- } catch (e) {
56990
- loadErrors.push(e);
56991
- }
56992
- try {
56993
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-arm64-musl"`);})();
56994
- } catch (e) {
56995
- loadErrors.push(e);
56996
- }
56997
- } else {
56998
- try {
56999
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-arm64-gnu.node"`);})();
57000
- } catch (e) {
57001
- loadErrors.push(e);
57002
- }
57003
- try {
57004
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-arm64-gnu"`);})();
57005
- } catch (e) {
57006
- loadErrors.push(e);
57007
- }
57008
- }
57009
- } else if (process.arch === "arm") {
57010
- if (isMusl()) {
57011
- try {
57012
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-arm-musleabihf.node"`);})();
57013
- } catch (e) {
57014
- loadErrors.push(e);
57015
- }
57016
- try {
57017
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-arm-musleabihf"`);})();
57018
- } catch (e) {
57019
- loadErrors.push(e);
57020
- }
57021
- } else {
57022
- try {
57023
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-arm-gnueabihf.node"`);})();
57024
- } catch (e) {
57025
- loadErrors.push(e);
57026
- }
57027
- try {
57028
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-arm-gnueabihf"`);})();
57029
- } catch (e) {
57030
- loadErrors.push(e);
57031
- }
57032
- }
57033
- } else if (process.arch === "riscv64") {
57034
- if (isMusl()) {
57035
- try {
57036
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-riscv64-musl.node"`);})();
57037
- } catch (e) {
57038
- loadErrors.push(e);
57039
- }
57040
- try {
57041
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-riscv64-musl"`);})();
57042
- } catch (e) {
57043
- loadErrors.push(e);
57044
- }
57045
- } else {
57046
- try {
57047
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-riscv64-gnu.node"`);})();
57048
- } catch (e) {
57049
- loadErrors.push(e);
57050
- }
57051
- try {
57052
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-riscv64-gnu"`);})();
57053
- } catch (e) {
57054
- loadErrors.push(e);
57055
- }
57056
- }
57057
- } else if (process.arch === "ppc64") {
57058
- try {
57059
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-ppc64-gnu.node"`);})();
57060
- } catch (e) {
57061
- loadErrors.push(e);
57062
- }
57063
- try {
57064
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-ppc64-gnu"`);})();
57065
- } catch (e) {
57066
- loadErrors.push(e);
57067
- }
57068
- } else if (process.arch === "s390x") {
57069
- try {
57070
- return (()=>{throw new Error(`Cannot require module "./argon2.linux-s390x-gnu.node"`);})();
57071
- } catch (e) {
57072
- loadErrors.push(e);
57073
- }
57074
- try {
57075
- return (()=>{throw new Error(`Cannot require module "@node-rs/argon2-linux-s390x-gnu"`);})();
57076
- } catch (e) {
57077
- loadErrors.push(e);
57078
- }
57079
- } else {
57080
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
57081
- }
57082
- } else {
57083
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
57084
- }
57085
- }
57086
- nativeBinding = requireNative();
57087
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
57088
- try {
57089
- nativeBinding = (()=>{throw new Error(`Cannot require module "./argon2.wasi.cjs"`);})();
57090
- } catch (err) {
57091
- if (process.env.NAPI_RS_FORCE_WASI) {
57092
- loadErrors.push(err);
57093
- }
57094
- }
57095
- if (!nativeBinding) {
57096
- try {
57097
- nativeBinding = (()=>{throw new Error(`Cannot require module "@node-rs/argon2-wasm32-wasi"`);})();
57098
- } catch (err) {
57099
- if (process.env.NAPI_RS_FORCE_WASI) {
57100
- loadErrors.push(err);
57101
- }
57102
- }
57103
- }
57104
- }
57105
- if (!nativeBinding) {
57106
- if (loadErrors.length > 0) {
57107
- throw new Error("Failed to load native binding", { cause: loadErrors });
57108
- }
57109
- throw new Error(`Failed to load native binding`);
57110
- }
57111
- var $Algorithm = nativeBinding.Algorithm;
57112
- var $hash = nativeBinding.hash;
57113
- var $hashRaw = nativeBinding.hashRaw;
57114
- var $hashRawSync = nativeBinding.hashRawSync;
57115
- var $hashSync = nativeBinding.hashSync;
57116
- var $verify = nativeBinding.verify;
57117
- var $verifySync = nativeBinding.verifySync;
57118
- var $Version = nativeBinding.Version;
57119
-
57120
56777
  // src/authentication/utils.ts
56778
+ import { Algorithm, hash } from "@node-rs/argon2";
57121
56779
  var getAuthenticationMethod = (listOfMethods, context) => {
57122
56780
  const customAuthenticationConfig = context.wabe.config?.authentication?.customAuthenticationMethods;
57123
56781
  if (!customAuthenticationConfig)
@@ -57131,8 +56789,8 @@ var getAuthenticationMethod = (listOfMethods, context) => {
57131
56789
  throw new Error("No available custom authentication methods found");
57132
56790
  return validAuthenticationMethod;
57133
56791
  };
57134
- var hashPassword = (password) => $hash(password, {
57135
- algorithm: $Algorithm.Argon2id
56792
+ var hashPassword = (password) => hash(password, {
56793
+ algorithm: Algorithm.Argon2id
57136
56794
  });
57137
56795
 
57138
56796
  // src/hooks/authentication.ts
@@ -62232,6 +61890,7 @@ var generateCodegen = async ({
62232
61890
  };
62233
61891
 
62234
61892
  // src/authentication/providers/EmailPassword.ts
61893
+ import { Algorithm as Algorithm2, verify } from "@node-rs/argon2";
62235
61894
  class EmailPassword {
62236
61895
  async onSignIn({
62237
61896
  input,
@@ -62259,8 +61918,8 @@ class EmailPassword {
62259
61918
  const userDatabasePassword = user.authentication?.emailPassword?.password;
62260
61919
  if (!userDatabasePassword)
62261
61920
  throw new Error("Invalid authentication credentials");
62262
- const isPasswordEquals = await $verify(userDatabasePassword, input.password, {
62263
- algorithm: $Algorithm.Argon2id
61921
+ const isPasswordEquals = await verify(userDatabasePassword, input.password, {
61922
+ algorithm: Algorithm2.Argon2id
62264
61923
  });
62265
61924
  if (!isPasswordEquals || input.email !== user.authentication?.emailPassword?.email)
62266
61925
  throw new Error("Invalid authentication credentials");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wabe",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Your backend in minutes not days",
5
5
  "homepage": "https://wabe.dev",
6
6
  "author": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "main": "dist/index.js",
22
22
  "scripts": {
23
- "build": "bun generate:codegen && bun build $(pwd)/src/index.ts --outdir dist/ --target=node && bun generate:types",
23
+ "build": "bun generate:codegen && bun build $(pwd)/src/index.ts --outdir dist/ --target=node --external=@node-rs/argon2 && bun generate:types",
24
24
  "generate:types": "dts-bundle-generator -o dist/index.d.ts src/index.ts --no-check --external-imports=wobe",
25
25
  "check": "tsc --project $(pwd)/tsconfig.json",
26
26
  "lint": "biome lint . --no-errors-on-unmatched --config-path=../../",