@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, textDecoder, 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));
@@ -453,6 +455,9 @@ var tracer = { startActiveSpan(name, fn) {
453
455
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
454
456
 
455
457
  // node_modules/drizzle-orm/sql/sql.js
458
+ var FakePrimitiveParam = class {
459
+ static [entityKind] = "FakePrimitiveParam";
460
+ };
456
461
  function isSQLWrapper(value) {
457
462
  return value !== null && value !== undefined && typeof value.getSQL === "function";
458
463
  }
@@ -4130,6 +4135,16 @@ var UniqueConstraintBuilder = class {
4130
4135
  return new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);
4131
4136
  }
4132
4137
  };
4138
+ var UniqueOnConstraintBuilder = class {
4139
+ static [entityKind] = "PgUniqueOnConstraintBuilder";
4140
+ name;
4141
+ constructor(name2) {
4142
+ this.name = name2;
4143
+ }
4144
+ on(...columns) {
4145
+ return new UniqueConstraintBuilder(columns, this.name);
4146
+ }
4147
+ };
4133
4148
  var UniqueConstraint = class {
4134
4149
  static [entityKind] = "PgUniqueConstraint";
4135
4150
  columns;
@@ -9405,6 +9420,17 @@ var ColumnAliasProxyHandler2 = class {
9405
9420
  return target[prop];
9406
9421
  }
9407
9422
  };
9423
+ var RelationTableAliasProxyHandler2 = class {
9424
+ static [entityKind] = "RelationTableAliasProxyHandler";
9425
+ constructor(alias2) {
9426
+ this.alias = alias2;
9427
+ }
9428
+ get(target, prop) {
9429
+ if (prop === "sourceTable")
9430
+ return aliasedTable2(target.sourceTable, this.alias);
9431
+ return target[prop];
9432
+ }
9433
+ };
9408
9434
  function aliasedTable2(table, tableAlias) {
9409
9435
  return new Proxy(table, new TableAliasProxyHandler2(tableAlias, false, false));
9410
9436
  }
@@ -9888,6 +9914,13 @@ params: ${params}`);
9888
9914
  this.cause = cause;
9889
9915
  }
9890
9916
  };
9917
+ var TransactionRollbackError2 = class extends DrizzleError2 {
9918
+ static [entityKind] = "TransactionRollbackError";
9919
+ constructor() {
9920
+ super({ message: "Rollback" });
9921
+ this.name = "TransactionRollbackError";
9922
+ }
9923
+ };
9891
9924
  // node_modules/drizzle-orm/relations.js
9892
9925
  var Relation2 = class {
9893
9926
  static [entityKind] = "RelationV2";
@@ -9936,6 +9969,53 @@ var One2 = class extends Relation2 {
9936
9969
  this.optional = config?.optional ?? true;
9937
9970
  }
9938
9971
  };
9972
+ var Many2 = class extends Relation2 {
9973
+ static [entityKind] = "ManyV2";
9974
+ relationType = "many";
9975
+ constructor(tables, targetTable, targetTableName, config) {
9976
+ super(targetTable, targetTableName);
9977
+ this.config = config;
9978
+ this.alias = config?.alias;
9979
+ this.where = config?.where;
9980
+ if (config?.from)
9981
+ this.sourceColumns = (Array.isArray(config.from) ? config.from : [config.from]).map((it2) => {
9982
+ this.throughTable ??= it2._.through ? tables[it2._.through._.tableName] : undefined;
9983
+ this.sourceColumnTableNames.push(it2._.tableName);
9984
+ return it2._.column;
9985
+ });
9986
+ if (config?.to)
9987
+ this.targetColumns = (Array.isArray(config.to) ? config.to : [config.to]).map((it2) => {
9988
+ this.throughTable ??= it2._.through ? tables[it2._.through._.tableName] : undefined;
9989
+ this.targetColumnTableNames.push(it2._.tableName);
9990
+ return it2._.column;
9991
+ });
9992
+ if (this.throughTable)
9993
+ this.through = {
9994
+ source: (Array.isArray(config?.from) ? config.from : (config?.from) ? [config.from] : []).map((c) => c._.through),
9995
+ target: (Array.isArray(config?.to) ? config.to : (config?.to) ? [config.to] : []).map((c) => c._.through)
9996
+ };
9997
+ }
9998
+ };
9999
+ var AggregatedField2 = class {
10000
+ static [entityKind] = "AggregatedField";
10001
+ table;
10002
+ onTable(table) {
10003
+ this.table = table;
10004
+ return this;
10005
+ }
10006
+ };
10007
+ var Count2 = class extends AggregatedField2 {
10008
+ static [entityKind] = "AggregatedFieldCount";
10009
+ query;
10010
+ getSQL() {
10011
+ if (!this.query) {
10012
+ if (!this.table)
10013
+ throw new Error("Table must be set before building aggregate field");
10014
+ this.query = sql`select count(*) as ${sql.identifier("r")} from ${getTableAsAliasSQL2(this.table)}`.mapWith(Number);
10015
+ }
10016
+ return this.query;
10017
+ }
10018
+ };
9939
10019
  var operators2 = {
9940
10020
  and,
9941
10021
  between,
@@ -10256,6 +10336,66 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
10256
10336
  ${compiled}
10257
10337
  }` });
10258
10338
  }
10339
+ var RelationsBuilderTable2 = class {
10340
+ static [entityKind] = "RelationsBuilderTable";
10341
+ _;
10342
+ constructor(table, name2) {
10343
+ this._ = {
10344
+ name: name2,
10345
+ table
10346
+ };
10347
+ }
10348
+ };
10349
+ var RelationsBuilderColumn2 = class {
10350
+ static [entityKind] = "RelationsBuilderColumn";
10351
+ _;
10352
+ constructor(column, tableName, key) {
10353
+ this._ = {
10354
+ tableName,
10355
+ column,
10356
+ key
10357
+ };
10358
+ }
10359
+ through(column) {
10360
+ return new RelationsBuilderJunctionColumn2(this._.column, this._.tableName, this._.key, column);
10361
+ }
10362
+ };
10363
+ var RelationsBuilderJunctionColumn2 = class {
10364
+ static [entityKind] = "RelationsBuilderColumn";
10365
+ _;
10366
+ constructor(column, tableName, key, through) {
10367
+ this._ = {
10368
+ tableName,
10369
+ column,
10370
+ through,
10371
+ key
10372
+ };
10373
+ }
10374
+ };
10375
+ var RelationsHelperStatic2 = class {
10376
+ static [entityKind] = "RelationsHelperStatic";
10377
+ _;
10378
+ constructor(tables) {
10379
+ this._ = { tables };
10380
+ const one = {};
10381
+ const many = {};
10382
+ for (const [tableName, table] of Object.entries(tables)) {
10383
+ one[tableName] = (config) => {
10384
+ return new One2(tables, table, tableName, config);
10385
+ };
10386
+ many[tableName] = (config) => {
10387
+ return new Many2(tables, table, tableName, config);
10388
+ };
10389
+ }
10390
+ this.one = one;
10391
+ this.many = many;
10392
+ }
10393
+ one;
10394
+ many;
10395
+ aggs = { count() {
10396
+ return new Count2;
10397
+ } };
10398
+ };
10259
10399
  function fieldSelectionToSQL2(table, target) {
10260
10400
  const field = table[TableColumns][target];
10261
10401
  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)}`;
@@ -11714,6 +11854,29 @@ var PgAsyncSession2 = class extends PgSession2 {
11714
11854
  });
11715
11855
  }
11716
11856
  };
11857
+ var PgAsyncTransaction2 = class extends PgAsyncDatabase2 {
11858
+ static [entityKind] = "PgAsyncTransaction";
11859
+ constructor(dialect, session, relations, nestedIndex = 0, parseRqbJson) {
11860
+ super(dialect, session, relations, parseRqbJson);
11861
+ this.nestedIndex = nestedIndex;
11862
+ }
11863
+ rollback() {
11864
+ throw new TransactionRollbackError2;
11865
+ }
11866
+ getTransactionConfigSQL(config) {
11867
+ const chunks = [];
11868
+ if (config.isolationLevel)
11869
+ chunks.push(`isolation level ${config.isolationLevel}`);
11870
+ if (config.accessMode)
11871
+ chunks.push(config.accessMode);
11872
+ if (typeof config.deferrable === "boolean")
11873
+ chunks.push(config.deferrable ? "deferrable" : "not deferrable");
11874
+ return sql.raw(chunks.join(" "));
11875
+ }
11876
+ setTransaction(config) {
11877
+ return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
11878
+ }
11879
+ };
11717
11880
 
11718
11881
  // node_modules/drizzle-orm/neon-http/session.js
11719
11882
  var NeonHttpSession = class extends PgAsyncSession2 {
@@ -11887,15 +12050,15 @@ var createPostgresVaultStore = (db) => ({
11887
12050
  }
11888
12051
  });
11889
12052
  export {
11890
- vaultEntriesTable,
11891
- rotateVaultKey,
11892
- createVersionedSecretCipher,
11893
- createVault,
11894
- createSecretCipher,
11895
- createPostgresVaultStore,
12053
+ createInMemoryVaultStore,
11896
12054
  createNeonVaultStore,
11897
- createInMemoryVaultStore
12055
+ createPostgresVaultStore,
12056
+ createSecretCipher,
12057
+ createVault,
12058
+ createVersionedSecretCipher,
12059
+ rotateVaultKey,
12060
+ vaultEntriesTable
11898
12061
  };
11899
12062
 
11900
- //# debugId=A59F5C5C4E886DF264756E2164756E21
12063
+ //# debugId=D8BF29DF60A0D94B64756E2164756E21
11901
12064
  //# sourceMappingURL=index.js.map