@absolutejs/auth 0.75.6 → 0.75.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.
@@ -19,12 +19,14 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
22
+ if (mod && typeof mod === "object" || typeof mod === "function") {
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ }
28
30
  if (canCache)
29
31
  cache.set(mod, to);
30
32
  return to;
@@ -58,20 +60,20 @@ var init_constants = __esm(() => {
58
60
  // src/crypto.ts
59
61
  var exports_crypto = {};
60
62
  __export(exports_crypto, {
61
- verifyTotp: () => verifyTotp,
62
- verifyPassword: () => verifyPassword,
63
- hashToken: () => hashToken,
64
- hashPassword: () => hashPassword,
65
- generateTotpSecret: () => generateTotpSecret,
66
- generateTotp: () => generateTotp,
67
- generateSecureToken: () => generateSecureToken,
68
- generateEncryptionKey: () => generateEncryptionKey,
69
- encryptSecret: () => encryptSecret,
70
- decryptSecret: () => decryptSecret,
71
- createTotpKeyUri: () => createTotpKeyUri,
72
- constantTimeEqual: () => constantTimeEqual,
63
+ base32Decode: () => base32Decode,
73
64
  base32Encode: () => base32Encode,
74
- base32Decode: () => base32Decode
65
+ constantTimeEqual: () => constantTimeEqual,
66
+ createTotpKeyUri: () => createTotpKeyUri,
67
+ decryptSecret: () => decryptSecret,
68
+ encryptSecret: () => encryptSecret,
69
+ generateEncryptionKey: () => generateEncryptionKey,
70
+ generateSecureToken: () => generateSecureToken,
71
+ generateTotp: () => generateTotp,
72
+ generateTotpSecret: () => generateTotpSecret,
73
+ hashPassword: () => hashPassword,
74
+ hashToken: () => hashToken,
75
+ verifyPassword: () => verifyPassword,
76
+ verifyTotp: () => verifyTotp
75
77
  });
76
78
  var DEFAULT_TOKEN_BYTES = 32, AES_KEY_BYTES = 32, AES_IV_BYTES = 12, HOTP_COUNTER_BYTES = 8, TOTP_SECRET_BYTES = 20, TOTP_DIGITS = 6, TOTP_PERIOD_SECONDS = 30, DEFAULT_TOTP_WINDOW = 1, DECIMAL_RADIX = 10, LAST_NIBBLE_MASK = 15, SIGN_BIT_MASK = 2147483647, BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", BASE32_GROUP_BITS = 5, BASE32_MASK = 31, BYTE_BITS = 8, textEncoder, textDecoder3, base64UrlEncode = (bytes) => Buffer.from(bytes).toString("base64url"), base64UrlDecode = (encoded) => new Uint8Array(Buffer.from(encoded, "base64url")), sha256 = async (input) => {
77
79
  const digest = await crypto.subtle.digest("SHA-256", textEncoder.encode(input));
@@ -585,6 +587,9 @@ var tracer = { startActiveSpan(name, fn) {
585
587
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
586
588
 
587
589
  // node_modules/drizzle-orm/sql/sql.js
590
+ var FakePrimitiveParam = class {
591
+ static [entityKind] = "FakePrimitiveParam";
592
+ };
588
593
  function isSQLWrapper(value) {
589
594
  return value !== null && value !== undefined && typeof value.getSQL === "function";
590
595
  }
@@ -4262,6 +4267,16 @@ var UniqueConstraintBuilder = class {
4262
4267
  return new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);
4263
4268
  }
4264
4269
  };
4270
+ var UniqueOnConstraintBuilder = class {
4271
+ static [entityKind] = "PgUniqueOnConstraintBuilder";
4272
+ name;
4273
+ constructor(name2) {
4274
+ this.name = name2;
4275
+ }
4276
+ on(...columns) {
4277
+ return new UniqueConstraintBuilder(columns, this.name);
4278
+ }
4279
+ };
4265
4280
  var UniqueConstraint = class {
4266
4281
  static [entityKind] = "PgUniqueConstraint";
4267
4282
  columns;
@@ -9537,6 +9552,17 @@ var ColumnAliasProxyHandler2 = class {
9537
9552
  return target[prop];
9538
9553
  }
9539
9554
  };
9555
+ var RelationTableAliasProxyHandler2 = class {
9556
+ static [entityKind] = "RelationTableAliasProxyHandler";
9557
+ constructor(alias2) {
9558
+ this.alias = alias2;
9559
+ }
9560
+ get(target, prop) {
9561
+ if (prop === "sourceTable")
9562
+ return aliasedTable2(target.sourceTable, this.alias);
9563
+ return target[prop];
9564
+ }
9565
+ };
9540
9566
  function aliasedTable2(table, tableAlias) {
9541
9567
  return new Proxy(table, new TableAliasProxyHandler2(tableAlias, false, false));
9542
9568
  }
@@ -10020,6 +10046,13 @@ params: ${params}`);
10020
10046
  this.cause = cause;
10021
10047
  }
10022
10048
  };
10049
+ var TransactionRollbackError2 = class extends DrizzleError2 {
10050
+ static [entityKind] = "TransactionRollbackError";
10051
+ constructor() {
10052
+ super({ message: "Rollback" });
10053
+ this.name = "TransactionRollbackError";
10054
+ }
10055
+ };
10023
10056
  // node_modules/drizzle-orm/relations.js
10024
10057
  var Relation2 = class {
10025
10058
  static [entityKind] = "RelationV2";
@@ -10068,6 +10101,53 @@ var One2 = class extends Relation2 {
10068
10101
  this.optional = config?.optional ?? true;
10069
10102
  }
10070
10103
  };
10104
+ var Many2 = class extends Relation2 {
10105
+ static [entityKind] = "ManyV2";
10106
+ relationType = "many";
10107
+ constructor(tables, targetTable, targetTableName, config) {
10108
+ super(targetTable, targetTableName);
10109
+ this.config = config;
10110
+ this.alias = config?.alias;
10111
+ this.where = config?.where;
10112
+ if (config?.from)
10113
+ this.sourceColumns = (Array.isArray(config.from) ? config.from : [config.from]).map((it2) => {
10114
+ this.throughTable ??= it2._.through ? tables[it2._.through._.tableName] : undefined;
10115
+ this.sourceColumnTableNames.push(it2._.tableName);
10116
+ return it2._.column;
10117
+ });
10118
+ if (config?.to)
10119
+ this.targetColumns = (Array.isArray(config.to) ? config.to : [config.to]).map((it2) => {
10120
+ this.throughTable ??= it2._.through ? tables[it2._.through._.tableName] : undefined;
10121
+ this.targetColumnTableNames.push(it2._.tableName);
10122
+ return it2._.column;
10123
+ });
10124
+ if (this.throughTable)
10125
+ this.through = {
10126
+ source: (Array.isArray(config?.from) ? config.from : (config?.from) ? [config.from] : []).map((c) => c._.through),
10127
+ target: (Array.isArray(config?.to) ? config.to : (config?.to) ? [config.to] : []).map((c) => c._.through)
10128
+ };
10129
+ }
10130
+ };
10131
+ var AggregatedField2 = class {
10132
+ static [entityKind] = "AggregatedField";
10133
+ table;
10134
+ onTable(table) {
10135
+ this.table = table;
10136
+ return this;
10137
+ }
10138
+ };
10139
+ var Count2 = class extends AggregatedField2 {
10140
+ static [entityKind] = "AggregatedFieldCount";
10141
+ query;
10142
+ getSQL() {
10143
+ if (!this.query) {
10144
+ if (!this.table)
10145
+ throw new Error("Table must be set before building aggregate field");
10146
+ this.query = sql`select count(*) as ${sql.identifier("r")} from ${getTableAsAliasSQL2(this.table)}`.mapWith(Number);
10147
+ }
10148
+ return this.query;
10149
+ }
10150
+ };
10071
10151
  var operators2 = {
10072
10152
  and,
10073
10153
  between,
@@ -10388,6 +10468,66 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
10388
10468
  ${compiled}
10389
10469
  }` });
10390
10470
  }
10471
+ var RelationsBuilderTable2 = class {
10472
+ static [entityKind] = "RelationsBuilderTable";
10473
+ _;
10474
+ constructor(table, name2) {
10475
+ this._ = {
10476
+ name: name2,
10477
+ table
10478
+ };
10479
+ }
10480
+ };
10481
+ var RelationsBuilderColumn2 = class {
10482
+ static [entityKind] = "RelationsBuilderColumn";
10483
+ _;
10484
+ constructor(column, tableName, key) {
10485
+ this._ = {
10486
+ tableName,
10487
+ column,
10488
+ key
10489
+ };
10490
+ }
10491
+ through(column) {
10492
+ return new RelationsBuilderJunctionColumn2(this._.column, this._.tableName, this._.key, column);
10493
+ }
10494
+ };
10495
+ var RelationsBuilderJunctionColumn2 = class {
10496
+ static [entityKind] = "RelationsBuilderColumn";
10497
+ _;
10498
+ constructor(column, tableName, key, through) {
10499
+ this._ = {
10500
+ tableName,
10501
+ column,
10502
+ through,
10503
+ key
10504
+ };
10505
+ }
10506
+ };
10507
+ var RelationsHelperStatic2 = class {
10508
+ static [entityKind] = "RelationsHelperStatic";
10509
+ _;
10510
+ constructor(tables) {
10511
+ this._ = { tables };
10512
+ const one = {};
10513
+ const many = {};
10514
+ for (const [tableName, table] of Object.entries(tables)) {
10515
+ one[tableName] = (config) => {
10516
+ return new One2(tables, table, tableName, config);
10517
+ };
10518
+ many[tableName] = (config) => {
10519
+ return new Many2(tables, table, tableName, config);
10520
+ };
10521
+ }
10522
+ this.one = one;
10523
+ this.many = many;
10524
+ }
10525
+ one;
10526
+ many;
10527
+ aggs = { count() {
10528
+ return new Count2;
10529
+ } };
10530
+ };
10391
10531
  function fieldSelectionToSQL2(table, target) {
10392
10532
  const field = table[TableColumns][target];
10393
10533
  return field ? is(field, Column) ? field : is(field, SQL.Aliased) ? sql`${table}.${sql.identifier(field.fieldAlias)}` : sql`${table}.${sql.identifier(target)}` : sql`${table}.${sql.identifier(target)}`;
@@ -11846,6 +11986,29 @@ var PgAsyncSession2 = class extends PgSession2 {
11846
11986
  });
11847
11987
  }
11848
11988
  };
11989
+ var PgAsyncTransaction2 = class extends PgAsyncDatabase2 {
11990
+ static [entityKind] = "PgAsyncTransaction";
11991
+ constructor(dialect, session, relations, nestedIndex = 0, parseRqbJson) {
11992
+ super(dialect, session, relations, parseRqbJson);
11993
+ this.nestedIndex = nestedIndex;
11994
+ }
11995
+ rollback() {
11996
+ throw new TransactionRollbackError2;
11997
+ }
11998
+ getTransactionConfigSQL(config) {
11999
+ const chunks = [];
12000
+ if (config.isolationLevel)
12001
+ chunks.push(`isolation level ${config.isolationLevel}`);
12002
+ if (config.accessMode)
12003
+ chunks.push(config.accessMode);
12004
+ if (typeof config.deferrable === "boolean")
12005
+ chunks.push(config.deferrable ? "deferrable" : "not deferrable");
12006
+ return sql.raw(chunks.join(" "));
12007
+ }
12008
+ setTransaction(config) {
12009
+ return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
12010
+ }
12011
+ };
11849
12012
 
11850
12013
  // node_modules/drizzle-orm/neon-http/session.js
11851
12014
  var NeonHttpSession = class extends PgAsyncSession2 {
@@ -12429,7 +12592,7 @@ var createPostgresOidcRefreshTokenStore = (db) => ({
12429
12592
  dpop_jkt: sql`CASE WHEN ${active} THEN ${replacement.dpopJkt ?? null} ELSE ${oauthRefreshTokensTable.dpop_jkt} END`,
12430
12593
  expires_at_ms: sql`CASE WHEN ${active} THEN ${replacement.expiresAt} ELSE ${oauthRefreshTokensTable.expires_at_ms} END`,
12431
12594
  revoked_at_ms: sql`CASE WHEN ${consumed} THEN ${Date.now()} ELSE ${oauthRefreshTokensTable.revoked_at_ms} END`,
12432
- scopes: sql`CASE WHEN ${active} THEN ${replacement.scopes} ELSE ${oauthRefreshTokensTable.scopes} END`,
12595
+ scopes: sql`CASE WHEN ${active} THEN ${sql.param(replacement.scopes, oauthRefreshTokensTable.scopes)} ELSE ${oauthRefreshTokensTable.scopes} END`,
12433
12596
  token_hash: sql`CASE WHEN ${active} THEN ${replacement.tokenHash} ELSE ${oauthRefreshTokensTable.token_hash} END`,
12434
12597
  user_id: sql`CASE WHEN ${active} THEN ${replacement.userId} ELSE ${oauthRefreshTokensTable.user_id} END`
12435
12598
  }).where(or(active, consumed)).returning({
@@ -12914,38 +13077,38 @@ var issueSocketTicket = async ({
12914
13077
  return { expiresInMs: ttlMs, ticket };
12915
13078
  };
12916
13079
  export {
12917
- verifyJwtWithKeys,
12918
- verifyJwt,
12919
- verifyDpopProof,
12920
- verifyDpopNonce,
12921
- toPublicJwk,
12922
- signingVerificationKeys,
12923
- signJwt,
12924
- revokeOAuthClientCredentials,
12925
- mintDpopNonce,
12926
- jwkThumbprint,
12927
- issueSocketTicket,
12928
- generateSigningKey,
12929
- extractDpopNonceClaim,
12930
- createPostgresSocketTicketStore,
12931
- createPostgresOidcRefreshTokenStore,
12932
- createPostgresOAuthClientStore,
12933
- createPostgresInitialAccessTokenStore,
12934
- createPostgresDeviceAuthorizationStore,
12935
- createPostgresClientRegistrationTokenStore,
12936
- createPostgresClientAssertionJtiStore,
12937
- createPostgresAuthorizationCodeStore,
12938
- createNeonSocketTicketStore,
12939
- createNeonOidcRefreshTokenStore,
12940
- createNeonOAuthClientStore,
12941
- createNeonInitialAccessTokenStore,
12942
- createNeonDeviceAuthorizationStore,
12943
- createNeonClientRegistrationTokenStore,
12944
- createNeonClientAssertionJtiStore,
12945
- createNeonAuthorizationCodeStore,
13080
+ consumeSocketTicket,
12946
13081
  createInMemorySocketTicketStore,
12947
- consumeSocketTicket
13082
+ createNeonAuthorizationCodeStore,
13083
+ createNeonClientAssertionJtiStore,
13084
+ createNeonClientRegistrationTokenStore,
13085
+ createNeonDeviceAuthorizationStore,
13086
+ createNeonInitialAccessTokenStore,
13087
+ createNeonOAuthClientStore,
13088
+ createNeonOidcRefreshTokenStore,
13089
+ createNeonSocketTicketStore,
13090
+ createPostgresAuthorizationCodeStore,
13091
+ createPostgresClientAssertionJtiStore,
13092
+ createPostgresClientRegistrationTokenStore,
13093
+ createPostgresDeviceAuthorizationStore,
13094
+ createPostgresInitialAccessTokenStore,
13095
+ createPostgresOAuthClientStore,
13096
+ createPostgresOidcRefreshTokenStore,
13097
+ createPostgresSocketTicketStore,
13098
+ extractDpopNonceClaim,
13099
+ generateSigningKey,
13100
+ issueSocketTicket,
13101
+ jwkThumbprint,
13102
+ mintDpopNonce,
13103
+ revokeOAuthClientCredentials,
13104
+ signJwt,
13105
+ signingVerificationKeys,
13106
+ toPublicJwk,
13107
+ verifyDpopNonce,
13108
+ verifyDpopProof,
13109
+ verifyJwt,
13110
+ verifyJwtWithKeys
12948
13111
  };
12949
13112
 
12950
- //# debugId=9E34D0D4B7BFB31E64756E2164756E21
13113
+ //# debugId=D26504894CF68A9864756E2164756E21
12951
13114
  //# sourceMappingURL=index.js.map