@adonisjs/auth 10.0.0-next.5 → 10.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.
@@ -1,4 +1,4 @@
1
- import { n as E_UNAUTHORIZED_ACCESS } from "./errors-Ns_FO2np.js";
1
+ import { n as E_UNAUTHORIZED_ACCESS } from "./errors-sGy-K8pd.js";
2
2
  import { t as debug_default } from "./debug-Ckko95-M.js";
3
3
  import { RuntimeException } from "@adonisjs/core/exceptions";
4
4
  import { HttpContextFactory } from "@adonisjs/core/factories/http";
@@ -1,13 +1,13 @@
1
1
  import "node:module";
2
2
  import { Exception } from "@adonisjs/core/exceptions";
3
3
  var __defProp = Object.defineProperty;
4
- var __exportAll = (all, symbols) => {
4
+ var __exportAll = (all, no_symbols) => {
5
5
  let target = {};
6
6
  for (var name in all) __defProp(target, name, {
7
7
  get: all[name],
8
8
  enumerable: true
9
9
  });
10
- if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
11
  return target;
12
12
  };
13
13
  var errors_exports = /* @__PURE__ */ __exportAll({
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { r as errors_exports } from "./errors-Ns_FO2np.js";
2
- import { t as symbols_exports } from "./symbols-BwcLqNln.js";
1
+ import { r as errors_exports } from "./errors-sGy-K8pd.js";
2
+ import { t as symbols_exports } from "./symbols-BQLDWwuQ.js";
3
3
  import "./debug-Ckko95-M.js";
4
- import { n as AuthenticatorClient, r as Authenticator, t as AuthManager } from "./auth_manager-CJvMGOzX.js";
4
+ import { n as AuthenticatorClient, r as Authenticator, t as AuthManager } from "./auth_manager-hJTiBA2V.js";
5
5
  import { presetAuth } from "@adonisjs/presets/auth";
6
6
  import { configProvider } from "@adonisjs/core";
7
7
  async function configure(command) {
@@ -1,5 +1,5 @@
1
- import { n as E_UNAUTHORIZED_ACCESS } from "../../errors-Ns_FO2np.js";
2
- import "../../symbols-BwcLqNln.js";
1
+ import { n as E_UNAUTHORIZED_ACCESS } from "../../errors-sGy-K8pd.js";
2
+ import "../../symbols-BQLDWwuQ.js";
3
3
  import { RuntimeException } from "@adonisjs/core/exceptions";
4
4
  import { inspect } from "node:util";
5
5
  import { createHash } from "node:crypto";
@@ -299,7 +299,7 @@ var CRC32 = class {
299
299
  var AccessToken = class {
300
300
  static decode(prefix, value) {
301
301
  if (typeof value !== "string" || !value.startsWith(`${prefix}`)) return null;
302
- const token = value.replace(/* @__PURE__ */ new RegExp(`^${prefix}`), "");
302
+ const token = value.replace(new RegExp(`^${prefix}`), "");
303
303
  if (!token) return null;
304
304
  const [identifier, ...tokenValue] = token.split(".");
305
305
  if (!identifier || tokenValue.length === 0) return null;
@@ -557,6 +557,13 @@ var DbAccessTokensProvider = class DbAccessTokensProvider {
557
557
  type: this.type
558
558
  }).del().exec();
559
559
  }
560
+ async deleteAll(user) {
561
+ this.#ensureIsPersisted(user);
562
+ return await (await this.getDb()).query().from(this.table).where({
563
+ tokenable_id: user.$primaryKeyValue,
564
+ type: this.type
565
+ }).del().exec();
566
+ }
560
567
  async all(user) {
561
568
  this.#ensureIsPersisted(user);
562
569
  return (await (await this.getDb()).query().from(this.table).where({
@@ -136,6 +136,16 @@ export declare class DbAccessTokensProvider<TokenableModel extends LucidModel> i
136
136
  * console.log('Deleted tokens:', deletedCount)
137
137
  */
138
138
  delete(user: InstanceType<TokenableModel>, identifier: string | number | BigInt): Promise<number>;
139
+ /**
140
+ * Delete all tokens for a given user
141
+ *
142
+ * @param user - The user instance to delete tokens for
143
+ *
144
+ * @example
145
+ * const deletedCount = await provider.deleteAll(user)
146
+ * console.log('Deleted tokens:', deletedCount)
147
+ */
148
+ deleteAll(user: InstanceType<TokenableModel>): Promise<number>;
139
149
  /**
140
150
  * Returns all the tokens for a given user
141
151
  *
@@ -1,5 +1,5 @@
1
- import { n as E_UNAUTHORIZED_ACCESS } from "../../errors-Ns_FO2np.js";
2
- import "../../symbols-BwcLqNln.js";
1
+ import { n as E_UNAUTHORIZED_ACCESS } from "../../errors-sGy-K8pd.js";
2
+ import "../../symbols-BQLDWwuQ.js";
3
3
  import { RuntimeException } from "@adonisjs/core/exceptions";
4
4
  import { base64 } from "@adonisjs/core/helpers";
5
5
  import auth from "basic-auth";
@@ -1,5 +1,5 @@
1
- import { n as E_UNAUTHORIZED_ACCESS } from "../../errors-Ns_FO2np.js";
2
- import "../../symbols-BwcLqNln.js";
1
+ import { n as E_UNAUTHORIZED_ACCESS } from "../../errors-sGy-K8pd.js";
2
+ import "../../symbols-BQLDWwuQ.js";
3
3
  import { RuntimeException } from "@adonisjs/core/exceptions";
4
4
  import { inspect } from "node:util";
5
5
  import { createHash } from "node:crypto";
@@ -1,6 +1,6 @@
1
- import "../errors-Ns_FO2np.js";
1
+ import "../errors-sGy-K8pd.js";
2
2
  import "../debug-Ckko95-M.js";
3
- import { t as AuthManager } from "../auth_manager-CJvMGOzX.js";
3
+ import { t as AuthManager } from "../auth_manager-hJTiBA2V.js";
4
4
  import { RuntimeException } from "@adonisjs/core/exceptions";
5
5
  import { configProvider } from "@adonisjs/core";
6
6
  var AuthProvider = class {
@@ -1,4 +1,4 @@
1
- import { t as E_INVALID_CREDENTIALS } from "../../errors-Ns_FO2np.js";
1
+ import { t as E_INVALID_CREDENTIALS } from "../../errors-sGy-K8pd.js";
2
2
  import { RuntimeException } from "@adonisjs/core/exceptions";
3
3
  import { beforeSave } from "@adonisjs/lucid/orm";
4
4
  function __decorate(decorators, target, key, desc) {
@@ -1,4 +1,4 @@
1
- import { i as __exportAll } from "./errors-Ns_FO2np.js";
1
+ import { i as __exportAll } from "./errors-sGy-K8pd.js";
2
2
  var symbols_exports = /* @__PURE__ */ __exportAll({
3
3
  GUARD_KNOWN_EVENTS: () => GUARD_KNOWN_EVENTS,
4
4
  PROVIDER_REAL_USER: () => PROVIDER_REAL_USER
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/auth",
3
3
  "description": "Official authentication provider for Adonis framework",
4
- "version": "10.0.0-next.5",
4
+ "version": "10.0.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "scripts": {
33
33
  "pretest": "npm run lint",
34
- "test": "npm run test:mysql && npm run test:pg && npm run test:mssql && c8 npm run test:sqlite",
34
+ "test": "npm run test:mysql && npm run test:pg && npm run test:mssql && npm run test:sqlite",
35
35
  "test:sqlite": "npm run quick:test",
36
36
  "test:mysql": "cross-env DB=mysql npm run quick:test",
37
37
  "test:mssql": "cross-env DB=mssql npm run quick:test",
@@ -51,64 +51,64 @@
51
51
  "quick:test": "cross-env NODE_DEBUG=\"adonisjs:auth:*\" node --enable-source-maps --import=@poppinss/ts-exec ./bin/test.js"
52
52
  },
53
53
  "devDependencies": {
54
- "@adonisjs/assembler": "^8.0.0-next.30",
55
- "@adonisjs/core": "^7.0.0-next.25",
56
- "@adonisjs/eslint-config": "^3.0.0-next.9",
57
- "@adonisjs/i18n": "^3.0.0-next.2",
58
- "@adonisjs/lucid": "^22.0.0-next.7",
54
+ "@adonisjs/assembler": "^8.0.0",
55
+ "@adonisjs/core": "^7.0.0",
56
+ "@adonisjs/eslint-config": "^3.0.0",
57
+ "@adonisjs/i18n": "^3.0.0",
58
+ "@adonisjs/lucid": "^22.0.0",
59
59
  "@adonisjs/prettier-config": "^1.4.5",
60
- "@adonisjs/session": "^8.0.0-next.2",
61
- "@adonisjs/tsconfig": "^2.0.0-next.3",
60
+ "@adonisjs/session": "^8.0.0",
61
+ "@adonisjs/tsconfig": "^2.0.0",
62
62
  "@japa/api-client": "^3.2.1",
63
63
  "@japa/assert": "^4.2.0",
64
64
  "@japa/browser-client": "^2.3.0",
65
65
  "@japa/expect-type": "^2.0.4",
66
66
  "@japa/file-system": "^3.0.0",
67
- "@japa/plugin-adonisjs": "^5.1.0-next.0",
67
+ "@japa/plugin-adonisjs": "^5.1.0",
68
68
  "@japa/runner": "^5.3.0",
69
69
  "@japa/snapshot": "^2.0.10",
70
- "@poppinss/ts-exec": "^1.4.2",
71
- "@release-it/conventional-changelog": "^10.0.4",
70
+ "@poppinss/ts-exec": "^1.4.4",
71
+ "@release-it/conventional-changelog": "^10.0.5",
72
72
  "@types/basic-auth": "^1.1.8",
73
73
  "@types/luxon": "^3.7.1",
74
- "@types/node": "^25.0.10",
74
+ "@types/node": "^25.3.0",
75
75
  "@types/set-cookie-parser": "^2.4.10",
76
76
  "@types/sinon": "^21.0.0",
77
77
  "better-sqlite3": "^12.6.2",
78
- "c8": "^10.1.3",
78
+ "c8": "^11.0.0",
79
79
  "convert-hrtime": "^5.0.0",
80
80
  "copyfiles": "^2.4.1",
81
81
  "cross-env": "^10.1.0",
82
82
  "del-cli": "^7.0.0",
83
- "dotenv": "^17.2.3",
84
- "eslint": "^9.39.2",
83
+ "dotenv": "^17.3.1",
84
+ "eslint": "^10.0.2",
85
85
  "luxon": "^3.7.2",
86
- "mysql2": "^3.16.1",
87
- "nock": "^14.0.10",
88
- "pg": "^8.17.2",
89
- "playwright": "^1.57.0",
86
+ "mysql2": "^3.18.0",
87
+ "nock": "^14.0.11",
88
+ "pg": "^8.18.0",
89
+ "playwright": "^1.58.2",
90
90
  "prettier": "^3.8.1",
91
91
  "release-it": "^19.2.4",
92
92
  "set-cookie-parser": "^3.0.1",
93
93
  "sinon": "^21.0.1",
94
- "tedious": "^19.2.0",
94
+ "tedious": "^19.2.1",
95
95
  "timekeeper": "^2.3.1",
96
- "tsdown": "^0.19.0",
96
+ "tsdown": "^0.20.3",
97
97
  "typescript": "^5.9.3"
98
98
  },
99
99
  "dependencies": {
100
- "@adonisjs/presets": "^3.0.0-next.1",
100
+ "@adonisjs/presets": "^3.0.0",
101
101
  "basic-auth": "^2.0.1"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adonisjs/assembler": "^8.0.0-next.26",
105
- "@adonisjs/core": "^7.0.0-next.16",
106
- "@adonisjs/i18n": "^3.0.0-next.2",
107
- "@adonisjs/lucid": "^22.0.0-next.1",
108
- "@adonisjs/session": "^8.0.0-next.1",
104
+ "@adonisjs/assembler": "^8.0.0-next.26 || ^8.0.0",
105
+ "@adonisjs/core": "^7.0.0-next.16 || ^7.0.0",
106
+ "@adonisjs/i18n": "^3.0.0-next.2 || ^3.0.0",
107
+ "@adonisjs/lucid": "^22.0.0-next.1 || ^22.0.0",
108
+ "@adonisjs/session": "^8.0.0-next.1 || ^8.0.0",
109
109
  "@japa/api-client": "^3.1.1",
110
110
  "@japa/browser-client": "^2.2.0",
111
- "@japa/plugin-adonisjs": "^5.1.0-next.0"
111
+ "@japa/plugin-adonisjs": "^5.1.0-next.0 || ^5.1.0"
112
112
  },
113
113
  "peerDependenciesMeta": {
114
114
  "@adonisjs/assembler": {