@absolutejs/auth 0.76.0 → 0.76.1

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));
@@ -2100,6 +2102,9 @@ var tracer = { startActiveSpan(name, fn) {
2100
2102
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
2101
2103
 
2102
2104
  // node_modules/drizzle-orm/sql/sql.js
2105
+ var FakePrimitiveParam = class {
2106
+ static [entityKind] = "FakePrimitiveParam";
2107
+ };
2103
2108
  function isSQLWrapper(value) {
2104
2109
  return value !== null && value !== undefined && typeof value.getSQL === "function";
2105
2110
  }
@@ -5777,6 +5782,16 @@ var UniqueConstraintBuilder = class {
5777
5782
  return new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);
5778
5783
  }
5779
5784
  };
5785
+ var UniqueOnConstraintBuilder = class {
5786
+ static [entityKind] = "PgUniqueOnConstraintBuilder";
5787
+ name;
5788
+ constructor(name2) {
5789
+ this.name = name2;
5790
+ }
5791
+ on(...columns) {
5792
+ return new UniqueConstraintBuilder(columns, this.name);
5793
+ }
5794
+ };
5780
5795
  var UniqueConstraint = class {
5781
5796
  static [entityKind] = "PgUniqueConstraint";
5782
5797
  columns;
@@ -11052,6 +11067,17 @@ var ColumnAliasProxyHandler2 = class {
11052
11067
  return target[prop];
11053
11068
  }
11054
11069
  };
11070
+ var RelationTableAliasProxyHandler2 = class {
11071
+ static [entityKind] = "RelationTableAliasProxyHandler";
11072
+ constructor(alias2) {
11073
+ this.alias = alias2;
11074
+ }
11075
+ get(target, prop) {
11076
+ if (prop === "sourceTable")
11077
+ return aliasedTable2(target.sourceTable, this.alias);
11078
+ return target[prop];
11079
+ }
11080
+ };
11055
11081
  function aliasedTable2(table, tableAlias) {
11056
11082
  return new Proxy(table, new TableAliasProxyHandler2(tableAlias, false, false));
11057
11083
  }
@@ -11535,6 +11561,13 @@ params: ${params}`);
11535
11561
  this.cause = cause;
11536
11562
  }
11537
11563
  };
11564
+ var TransactionRollbackError2 = class extends DrizzleError2 {
11565
+ static [entityKind] = "TransactionRollbackError";
11566
+ constructor() {
11567
+ super({ message: "Rollback" });
11568
+ this.name = "TransactionRollbackError";
11569
+ }
11570
+ };
11538
11571
  // node_modules/drizzle-orm/relations.js
11539
11572
  var Relation2 = class {
11540
11573
  static [entityKind] = "RelationV2";
@@ -11583,6 +11616,53 @@ var One2 = class extends Relation2 {
11583
11616
  this.optional = config?.optional ?? true;
11584
11617
  }
11585
11618
  };
11619
+ var Many2 = class extends Relation2 {
11620
+ static [entityKind] = "ManyV2";
11621
+ relationType = "many";
11622
+ constructor(tables, targetTable, targetTableName, config) {
11623
+ super(targetTable, targetTableName);
11624
+ this.config = config;
11625
+ this.alias = config?.alias;
11626
+ this.where = config?.where;
11627
+ if (config?.from)
11628
+ this.sourceColumns = (Array.isArray(config.from) ? config.from : [config.from]).map((it2) => {
11629
+ this.throughTable ??= it2._.through ? tables[it2._.through._.tableName] : undefined;
11630
+ this.sourceColumnTableNames.push(it2._.tableName);
11631
+ return it2._.column;
11632
+ });
11633
+ if (config?.to)
11634
+ this.targetColumns = (Array.isArray(config.to) ? config.to : [config.to]).map((it2) => {
11635
+ this.throughTable ??= it2._.through ? tables[it2._.through._.tableName] : undefined;
11636
+ this.targetColumnTableNames.push(it2._.tableName);
11637
+ return it2._.column;
11638
+ });
11639
+ if (this.throughTable)
11640
+ this.through = {
11641
+ source: (Array.isArray(config?.from) ? config.from : (config?.from) ? [config.from] : []).map((c) => c._.through),
11642
+ target: (Array.isArray(config?.to) ? config.to : (config?.to) ? [config.to] : []).map((c) => c._.through)
11643
+ };
11644
+ }
11645
+ };
11646
+ var AggregatedField2 = class {
11647
+ static [entityKind] = "AggregatedField";
11648
+ table;
11649
+ onTable(table) {
11650
+ this.table = table;
11651
+ return this;
11652
+ }
11653
+ };
11654
+ var Count2 = class extends AggregatedField2 {
11655
+ static [entityKind] = "AggregatedFieldCount";
11656
+ query;
11657
+ getSQL() {
11658
+ if (!this.query) {
11659
+ if (!this.table)
11660
+ throw new Error("Table must be set before building aggregate field");
11661
+ this.query = sql`select count(*) as ${sql.identifier("r")} from ${getTableAsAliasSQL2(this.table)}`.mapWith(Number);
11662
+ }
11663
+ return this.query;
11664
+ }
11665
+ };
11586
11666
  var operators2 = {
11587
11667
  and,
11588
11668
  between,
@@ -11903,6 +11983,66 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
11903
11983
  ${compiled}
11904
11984
  }` });
11905
11985
  }
11986
+ var RelationsBuilderTable2 = class {
11987
+ static [entityKind] = "RelationsBuilderTable";
11988
+ _;
11989
+ constructor(table, name2) {
11990
+ this._ = {
11991
+ name: name2,
11992
+ table
11993
+ };
11994
+ }
11995
+ };
11996
+ var RelationsBuilderColumn2 = class {
11997
+ static [entityKind] = "RelationsBuilderColumn";
11998
+ _;
11999
+ constructor(column, tableName, key) {
12000
+ this._ = {
12001
+ tableName,
12002
+ column,
12003
+ key
12004
+ };
12005
+ }
12006
+ through(column) {
12007
+ return new RelationsBuilderJunctionColumn2(this._.column, this._.tableName, this._.key, column);
12008
+ }
12009
+ };
12010
+ var RelationsBuilderJunctionColumn2 = class {
12011
+ static [entityKind] = "RelationsBuilderColumn";
12012
+ _;
12013
+ constructor(column, tableName, key, through) {
12014
+ this._ = {
12015
+ tableName,
12016
+ column,
12017
+ through,
12018
+ key
12019
+ };
12020
+ }
12021
+ };
12022
+ var RelationsHelperStatic2 = class {
12023
+ static [entityKind] = "RelationsHelperStatic";
12024
+ _;
12025
+ constructor(tables) {
12026
+ this._ = { tables };
12027
+ const one = {};
12028
+ const many = {};
12029
+ for (const [tableName, table] of Object.entries(tables)) {
12030
+ one[tableName] = (config) => {
12031
+ return new One2(tables, table, tableName, config);
12032
+ };
12033
+ many[tableName] = (config) => {
12034
+ return new Many2(tables, table, tableName, config);
12035
+ };
12036
+ }
12037
+ this.one = one;
12038
+ this.many = many;
12039
+ }
12040
+ one;
12041
+ many;
12042
+ aggs = { count() {
12043
+ return new Count2;
12044
+ } };
12045
+ };
11906
12046
  function fieldSelectionToSQL2(table, target) {
11907
12047
  const field = table[TableColumns][target];
11908
12048
  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)}`;
@@ -13361,6 +13501,29 @@ var PgAsyncSession2 = class extends PgSession2 {
13361
13501
  });
13362
13502
  }
13363
13503
  };
13504
+ var PgAsyncTransaction2 = class extends PgAsyncDatabase2 {
13505
+ static [entityKind] = "PgAsyncTransaction";
13506
+ constructor(dialect, session, relations, nestedIndex = 0, parseRqbJson) {
13507
+ super(dialect, session, relations, parseRqbJson);
13508
+ this.nestedIndex = nestedIndex;
13509
+ }
13510
+ rollback() {
13511
+ throw new TransactionRollbackError2;
13512
+ }
13513
+ getTransactionConfigSQL(config) {
13514
+ const chunks = [];
13515
+ if (config.isolationLevel)
13516
+ chunks.push(`isolation level ${config.isolationLevel}`);
13517
+ if (config.accessMode)
13518
+ chunks.push(config.accessMode);
13519
+ if (typeof config.deferrable === "boolean")
13520
+ chunks.push(config.deferrable ? "deferrable" : "not deferrable");
13521
+ return sql.raw(chunks.join(" "));
13522
+ }
13523
+ setTransaction(config) {
13524
+ return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
13525
+ }
13526
+ };
13364
13527
 
13365
13528
  // node_modules/drizzle-orm/neon-http/session.js
13366
13529
  var NeonHttpSession = class extends PgAsyncSession2 {
@@ -13746,58 +13909,58 @@ var createPostgresAgentRegistrationStoreFor = (db, table) => ({
13746
13909
  var createBunSqlDrizzleAgentRegistrationStore = (db) => createPostgresAgentRegistrationStoreFor(db, agentRegistrationsBunSqlTable);
13747
13910
  var createPostgresAgentRegistrationStore = (db) => createPostgresAgentRegistrationStoreFor(db, agentRegistrationsTable);
13748
13911
  export {
13749
- validateClientIdMetadataDocument,
13750
- startAgentRegistration,
13751
- revokeAgentIdentityRegistration,
13752
- resolveAgentPrincipal,
13753
- issueAgentServiceAssertion,
13754
- issueAgentIdentityAssertion,
13755
- handleAgentTokenGrant,
13756
- generateAgentRegistrationGuide,
13757
- generateAgentOAuthGuide,
13758
- discoverAgentRegistration,
13759
- createPostgresAgentRegistrationStore,
13760
- createPostgresAgentIdentityRegistrationStore,
13761
- createPostgresAgentDelegationStore,
13762
- createOidcAgentCredentialVerifier,
13763
- createNeonAgentRegistrationStore,
13764
- createNeonAgentIdentityRegistrationStore,
13765
- createNeonAgentDelegationStore,
13766
- createInMemoryAgentRegistrationStore,
13767
- createInMemoryAgentIdentityRegistrationStore,
13768
- createInMemoryAgentIdentityAssertionJtiStore,
13769
- createInMemoryAgentDelegationStore,
13770
- createDrizzleAgentDelegationStore,
13771
- createClientIdMetadataResolver,
13772
- createBunSqlDrizzleAgentRegistrationStore,
13773
- createBunSqlDrizzleAgentIdentityRegistrationStore,
13774
- createBunSqlDrizzleAgentDelegationStore,
13775
- createAgentRegistrationCredentialVerifier,
13776
- createAgentRegistrationClient,
13777
- createAgentIdentityAssertionVerifier,
13778
- completeAgentClaim,
13779
- clientIdMetadataToOAuthClient,
13780
- beginAgentClaim,
13781
- agentRegistrationsTable,
13782
- agentRegistrationsBunSqlTable,
13783
- agentRegistrationEndpoints,
13784
- agentRegistrationDiscoveryMetadata,
13785
- agentProtectedResourceMetadata,
13786
- agentOAuthGuideUrl,
13787
- agentOAuthGuideRoute,
13788
- agentIdentityRegistrationsTable,
13789
- agentIdentityRegistrationsBunSqlTable,
13790
- agentHasScopes,
13791
- agentDelegationsTable,
13792
- agentDelegationsBunSqlTable,
13793
- agentAuthPlugin,
13794
- agentAuthContextPlugin,
13795
- agentAuthChallenge,
13796
- DEFAULT_AGENT_RESOURCE_METADATA_ROUTE,
13797
- AGENT_IDENTITY_ASSERTION_TYPE,
13912
+ AGENT_CLAIM_GRANT_TYPE,
13798
13913
  AGENT_IDENTITY_ASSERTION_GRANT_TYPE,
13799
- AGENT_CLAIM_GRANT_TYPE
13914
+ AGENT_IDENTITY_ASSERTION_TYPE,
13915
+ DEFAULT_AGENT_RESOURCE_METADATA_ROUTE,
13916
+ agentAuthChallenge,
13917
+ agentAuthContextPlugin,
13918
+ agentAuthPlugin,
13919
+ agentDelegationsBunSqlTable,
13920
+ agentDelegationsTable,
13921
+ agentHasScopes,
13922
+ agentIdentityRegistrationsBunSqlTable,
13923
+ agentIdentityRegistrationsTable,
13924
+ agentOAuthGuideRoute,
13925
+ agentOAuthGuideUrl,
13926
+ agentProtectedResourceMetadata,
13927
+ agentRegistrationDiscoveryMetadata,
13928
+ agentRegistrationEndpoints,
13929
+ agentRegistrationsBunSqlTable,
13930
+ agentRegistrationsTable,
13931
+ beginAgentClaim,
13932
+ clientIdMetadataToOAuthClient,
13933
+ completeAgentClaim,
13934
+ createAgentIdentityAssertionVerifier,
13935
+ createAgentRegistrationClient,
13936
+ createAgentRegistrationCredentialVerifier,
13937
+ createBunSqlDrizzleAgentDelegationStore,
13938
+ createBunSqlDrizzleAgentIdentityRegistrationStore,
13939
+ createBunSqlDrizzleAgentRegistrationStore,
13940
+ createClientIdMetadataResolver,
13941
+ createDrizzleAgentDelegationStore,
13942
+ createInMemoryAgentDelegationStore,
13943
+ createInMemoryAgentIdentityAssertionJtiStore,
13944
+ createInMemoryAgentIdentityRegistrationStore,
13945
+ createInMemoryAgentRegistrationStore,
13946
+ createNeonAgentDelegationStore,
13947
+ createNeonAgentIdentityRegistrationStore,
13948
+ createNeonAgentRegistrationStore,
13949
+ createOidcAgentCredentialVerifier,
13950
+ createPostgresAgentDelegationStore,
13951
+ createPostgresAgentIdentityRegistrationStore,
13952
+ createPostgresAgentRegistrationStore,
13953
+ discoverAgentRegistration,
13954
+ generateAgentOAuthGuide,
13955
+ generateAgentRegistrationGuide,
13956
+ handleAgentTokenGrant,
13957
+ issueAgentIdentityAssertion,
13958
+ issueAgentServiceAssertion,
13959
+ resolveAgentPrincipal,
13960
+ revokeAgentIdentityRegistration,
13961
+ startAgentRegistration,
13962
+ validateClientIdMetadataDocument
13800
13963
  };
13801
13964
 
13802
- //# debugId=16DE04B83F43B7D264756E2164756E21
13965
+ //# debugId=5BB349EDA1CA8A4564756E2164756E21
13803
13966
  //# sourceMappingURL=index.js.map