@warlock.js/auth 4.0.92 → 4.0.93

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/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{registerAuthCleanupCommand}from'./commands/auth-cleanup-command.js';export{registerJWTSecretGeneratorCommand}from'./commands/jwt-secret-generator-command.js';export{NO_EXPIRATION}from'./contracts/types.js';export{authMiddleware}from'./middleware/auth.middleware.js';export{AccessToken}from'./models/access-token/access-token.js';import'./models/access-token/migration.js';export{Auth}from'./models/auth.js';export{RefreshToken}from'./models/refresh-token/refresh-token.js';export{authEvents}from'./services/auth-events.js';export{authService}from'./services/auth.service.js';export{generateJWTSecret}from'./services/generate-jwt-secret.js';export{jwt}from'./services/jwt.js';export{AuthErrorCodes}from'./utils/auth-error-codes.js';export{parseExpirationToMs,toJwtExpiresIn}from'./utils/duration.js';//# sourceMappingURL=index.js.map
1
+ export{registerAuthCleanupCommand}from'./commands/auth-cleanup-command.js';export{registerJWTSecretGeneratorCommand}from'./commands/jwt-secret-generator-command.js';export{NO_EXPIRATION}from'./contracts/types.js';export{authMiddleware}from'./middleware/auth.middleware.js';export{authMigrations}from'./models/index.js';export{authEvents}from'./services/auth-events.js';export{authService}from'./services/auth.service.js';export{generateJWTSecret}from'./services/generate-jwt-secret.js';export{jwt}from'./services/jwt.js';export{AuthErrorCodes}from'./utils/auth-error-codes.js';export{parseExpirationToMs,toJwtExpiresIn}from'./utils/duration.js';export{AccessToken}from'./models/access-token/access-token.js';export{AccessTokenMigration}from'./models/access-token/migration.js';export{Auth}from'./models/auth.js';export{RefreshToken}from'./models/refresh-token/refresh-token.js';//# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
- declare const _default: any;
2
- export default _default;
1
+ export declare const AccessTokenMigration: any;
3
2
  //# sourceMappingURL=migration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/models/access-token/migration.ts"],"names":[],"mappings":";AAGA,wBASG"}
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/models/access-token/migration.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,KAyB/B,CAAC"}
@@ -1,10 +1,21 @@
1
- import {migrate}from'@warlock.js/cascade';import {AccessToken}from'./access-token.js';migrate(AccessToken, {
1
+ import {migrate}from'@warlock.js/cascade';import {AccessToken}from'./access-token.js';const AccessTokenMigration = migrate(AccessToken, {
2
2
  name: "accessToken",
3
3
  up() {
4
- this.string("accessToken").index();
5
- this.date("lastAccess");
4
+ // Create table
5
+ this.createTableIfNotExists();
6
+ // Primary key
7
+ this.id();
8
+ // Token field
9
+ this.string("token", 500).unique();
10
+ this.timestamp("lastAccess").nullable();
11
+ // Embedded user info (JSONB)
12
+ this.json("user");
13
+ // Status (for token revocation)
14
+ this.boolean("isActive").default(true);
15
+ // Timestamps
16
+ this.timestamps();
6
17
  },
7
18
  down() {
8
- this.dropIndex("token");
19
+ this.dropTableIfExists();
9
20
  },
10
- });//# sourceMappingURL=migration.js.map
21
+ });export{AccessTokenMigration};//# sourceMappingURL=migration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration.js","sources":["../../../src/models/access-token/migration.ts"],"sourcesContent":[null],"names":[],"mappings":"sFAGe,OAAO,CAAC,WAAW,EAAE;AAClC,IAAA,IAAI,EAAE,aAAa;IACnB,EAAE,GAAA;QACA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,CAAC;AACnC,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACzB;IACD,IAAI,GAAA;AACF,QAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAA,CAAC"}
1
+ {"version":3,"file":"migration.js","sources":["../../../src/models/access-token/migration.ts"],"sourcesContent":[null],"names":[],"mappings":"sFAGa,MAAA,oBAAoB,GAAG,OAAO,CAAC,WAAW,EAAE;AACvD,IAAA,IAAI,EAAE,aAAa;IACnB,EAAE,GAAA;;QAEA,IAAI,CAAC,sBAAsB,EAAE,CAAC;;QAG9B,IAAI,CAAC,EAAE,EAAE,CAAC;;QAGV,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;;AAGxC,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;QAGlB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;;QAGvC,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;IACD,IAAI,GAAA;QACF,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;AACF,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from "./access-token";
2
2
  export * from "./auth";
3
3
  export * from "./refresh-token";
4
+ export declare const authMigrations: any[];
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAEhC,eAAO,MAAM,cAAc,OAAgD,CAAC"}
@@ -0,0 +1 @@
1
+ import {AccessTokenMigration}from'./access-token/migration.js';import {RefreshTokenMigration}from'./refresh-token/migration.js';export{AccessToken}from'./access-token/access-token.js';import'@warlock.js/cascade';import'@mongez/events';import'@mongez/password';import'@mongez/reinforcements';import'@warlock.js/core';export{RefreshToken}from'./refresh-token/refresh-token.js';import'fast-jwt';import'@mongez/fs';import'@warlock.js/logger';const authMigrations = [AccessTokenMigration, RefreshTokenMigration];export{AccessTokenMigration,authMigrations};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/models/index.ts"],"sourcesContent":[null],"names":[],"mappings":"4bAOa,cAAc,GAAG,CAAC,oBAAoB,EAAE,qBAAqB"}
@@ -1,3 +1,2 @@
1
- declare const _default: any;
2
- export default _default;
1
+ export declare const RefreshTokenMigration: any;
3
2
  //# sourceMappingURL=migration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/models/refresh-token/migration.ts"],"names":[],"mappings":";AAGA,wBAcG"}
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/models/refresh-token/migration.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,KAyBhC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import {migrate}from'@warlock.js/cascade';import {RefreshToken}from'./refresh-token.js';const RefreshTokenMigration = migrate(RefreshToken, {
2
+ name: "refreshToken",
3
+ up() {
4
+ // Create table
5
+ this.createTableIfNotExists();
6
+ // Primary key
7
+ this.id();
8
+ // Token fields
9
+ this.string("token", 500).unique();
10
+ this.integer("userId").index();
11
+ this.string("userType", 50);
12
+ this.string("familyId", 100).index();
13
+ this.timestamp("expiresAt").index();
14
+ this.timestamp("lastUsedAt").nullable();
15
+ this.timestamp("revokedAt").nullable();
16
+ this.json("deviceInfo").nullable();
17
+ // Timestamps
18
+ this.timestamps();
19
+ },
20
+ down() {
21
+ this.dropTableIfExists();
22
+ },
23
+ });export{RefreshTokenMigration};//# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sources":["../../../src/models/refresh-token/migration.ts"],"sourcesContent":[null],"names":[],"mappings":"wFAGa,MAAA,qBAAqB,GAAG,OAAO,CAAC,YAAY,EAAE;AACzD,IAAA,IAAI,EAAE,cAAc;IACpB,EAAE,GAAA;;QAEA,IAAI,CAAC,sBAAsB,EAAE,CAAC;;QAG9B,IAAI,CAAC,EAAE,EAAE,CAAC;;QAGV,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;AAC/B,QAAA,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;;QAGnC,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;IACD,IAAI,GAAA;QACF,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;AACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warlock.js/auth",
3
- "version": "4.0.92",
3
+ "version": "4.0.93",
4
4
  "description": "Authentication system for Warlock.js applications",
5
5
  "main": "./esm/index.js",
6
6
  "dependencies": {
@@ -12,10 +12,10 @@
12
12
  "@mongez/events": "^2.1.0",
13
13
  "@mongez/fs": "^3.0.5",
14
14
  "@mongez/reinforcements": "^2.3.17",
15
- "@warlock.js/cascade": "4.0.92",
16
- "@warlock.js/core": "4.0.92",
17
- "@warlock.js/logger": "4.0.92",
18
- "@warlock.js/seal": "4.0.92"
15
+ "@warlock.js/cascade": "4.0.93",
16
+ "@warlock.js/core": "4.0.93",
17
+ "@warlock.js/logger": "4.0.93",
18
+ "@warlock.js/seal": "4.0.93"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -1,7 +0,0 @@
1
- import type { Model } from "@warlock.js/cascade";
2
- /**
3
- * Cast password on model save
4
- * If the password is not changed, keep it as is
5
- */
6
- export declare function castPassword(value: any, column: string, model: Model): any;
7
- //# sourceMappingURL=cast-password.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cast-password.d.ts","sourceRoot":"","sources":["../../../src/models/casts/cast-password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,OAIpE"}
@@ -1,2 +0,0 @@
1
- export * from "./cast-password";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/casts/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}