@absolutejs/auth 0.56.14 → 0.56.16

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.
@@ -10,4 +10,4 @@ export { agentHasScopes, resolveAgentPrincipal } from './principal';
10
10
  export { agentAuthChallenge, agentAuthContextPlugin } from './context';
11
11
  export { agentAuthPlugin } from './routes';
12
12
  export { createInMemoryAgentDelegationStore, createInMemoryAgentIdentityRegistrationStore, createInMemoryAgentRegistrationStore } from './inMemoryStores';
13
- export { agentDelegationsTable, agentIdentityRegistrationsTable, agentRegistrationsTable, createNeonAgentDelegationStore, createNeonAgentIdentityRegistrationStore, createNeonAgentRegistrationStore, createPostgresAgentDelegationStore, createPostgresAgentIdentityRegistrationStore, createPostgresAgentRegistrationStore } from './postgresStores';
13
+ export { agentDelegationsTable, agentIdentityRegistrationsTable, agentRegistrationsTable, createNeonAgentDelegationStore, createNeonAgentIdentityRegistrationStore, createNeonAgentRegistrationStore, createDrizzleAgentDelegationStore, createPostgresAgentDelegationStore, createPostgresAgentIdentityRegistrationStore, createPostgresAgentRegistrationStore } from './postgresStores';
@@ -13449,6 +13449,7 @@ var portableJsonb = customType({
13449
13449
  fromDriver: (value) => typeof value === "string" ? JSON.parse(value) : value,
13450
13450
  toDriver: (value) => JSON.stringify(value)
13451
13451
  });
13452
+ var encodedJsonb = (value) => sql`${JSON.stringify(value)}::text::jsonb`;
13452
13453
  var agentDelegationsTable = pgTable("auth_agent_delegations", {
13453
13454
  agent_id: varchar("agent_id", { length: ID_LENGTH }).notNull(),
13454
13455
  authorization_details: portableJsonb("authorization_details").$type(),
@@ -13550,7 +13551,7 @@ var toIdentityRegistration = (row) => ({
13550
13551
  });
13551
13552
  var identityRegistrationValues = (registration) => ({
13552
13553
  agent_id: registration.agentId,
13553
- claim_attempt: registration.claimAttempt ?? null,
13554
+ claim_attempt: registration.claimAttempt === undefined ? null : encodedJsonb(registration.claimAttempt),
13554
13555
  claim_attempt_token_hash: registration.claimAttempt?.tokenHash ?? null,
13555
13556
  claim_expires_at_ms: registration.claimExpiresAt,
13556
13557
  claim_token_hash: registration.claimTokenHash,
@@ -13568,10 +13569,10 @@ var identityRegistrationValues = (registration) => ({
13568
13569
  user_id: registration.userId ?? null,
13569
13570
  version: registration.version
13570
13571
  });
13571
- var createNeonAgentDelegationStore = (databaseUrl) => createPostgresAgentDelegationStore(createNeonDatabase(databaseUrl));
13572
+ var createNeonAgentDelegationStore = (databaseUrl) => createDrizzleAgentDelegationStore(createNeonDatabase(databaseUrl));
13572
13573
  var createNeonAgentIdentityRegistrationStore = (databaseUrl) => createPostgresAgentIdentityRegistrationStore(createNeonDatabase(databaseUrl));
13573
13574
  var createNeonAgentRegistrationStore = (databaseUrl) => createPostgresAgentRegistrationStore(createNeonDatabase(databaseUrl));
13574
- var createPostgresAgentDelegationStore = (db) => ({
13575
+ var createDrizzleAgentDelegationStore = (db) => ({
13575
13576
  findActiveDelegation: async ({
13576
13577
  agentId,
13577
13578
  now = Date.now(),
@@ -13594,12 +13595,12 @@ var createPostgresAgentDelegationStore = (db) => ({
13594
13595
  saveDelegation: async (delegation) => {
13595
13596
  const values = {
13596
13597
  agent_id: delegation.agentId,
13597
- authorization_details: delegation.authorizationDetails ?? null,
13598
+ authorization_details: delegation.authorizationDetails === undefined ? null : encodedJsonb(delegation.authorizationDetails),
13598
13599
  created_at_ms: delegation.createdAt,
13599
13600
  delegation_id: delegation.delegationId,
13600
13601
  expires_at_ms: delegation.expiresAt ?? null,
13601
13602
  organization_id: delegation.organizationId ?? null,
13602
- scopes: delegation.scopes,
13603
+ scopes: encodedJsonb(delegation.scopes),
13603
13604
  status: delegation.status,
13604
13605
  updated_at_ms: delegation.updatedAt,
13605
13606
  user_id: delegation.userId
@@ -13610,6 +13611,7 @@ var createPostgresAgentDelegationStore = (db) => ({
13610
13611
  });
13611
13612
  }
13612
13613
  });
13614
+ var createPostgresAgentDelegationStore = createDrizzleAgentDelegationStore;
13613
13615
  var createPostgresAgentIdentityRegistrationStore = (db) => ({
13614
13616
  create: async (registration) => {
13615
13617
  const rows = await db.insert(agentIdentityRegistrationsTable).values(identityRegistrationValues(registration)).onConflictDoNothing().returning({ id: agentIdentityRegistrationsTable.registration_id });
@@ -13661,10 +13663,10 @@ var createPostgresAgentRegistrationStore = (db) => ({
13661
13663
  saveRegistration: async (registration) => {
13662
13664
  const values = {
13663
13665
  agent_id: registration.agentId,
13664
- allowed_scopes: registration.allowedScopes,
13666
+ allowed_scopes: encodedJsonb(registration.allowedScopes),
13665
13667
  client_id: registration.clientId ?? null,
13666
13668
  created_at_ms: registration.createdAt,
13667
- metadata: registration.metadata ?? null,
13669
+ metadata: registration.metadata === undefined ? null : encodedJsonb(registration.metadata),
13668
13670
  name: registration.name,
13669
13671
  status: registration.status,
13670
13672
  updated_at_ms: registration.updatedAt
@@ -13697,6 +13699,7 @@ export {
13697
13699
  createInMemoryAgentIdentityRegistrationStore,
13698
13700
  createInMemoryAgentIdentityAssertionJtiStore,
13699
13701
  createInMemoryAgentDelegationStore,
13702
+ createDrizzleAgentDelegationStore,
13700
13703
  createClientIdMetadataResolver,
13701
13704
  createAgentRegistrationCredentialVerifier,
13702
13705
  createAgentRegistrationClient,
@@ -13722,5 +13725,5 @@ export {
13722
13725
  AGENT_CLAIM_GRANT_TYPE
13723
13726
  };
13724
13727
 
13725
- //# debugId=DE3C9B11A35558B764756E2164756E21
13728
+ //# debugId=E730925598B6D00864756E2164756E21
13726
13729
  //# sourceMappingURL=index.js.map