@yielded/auth 0.1.0-beta.4 → 0.1.0-beta.5

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.
Files changed (63) hide show
  1. package/dist/DrizzleD1.d.mts +49 -0
  2. package/dist/DrizzleLibsql.d.mts +59 -10
  3. package/dist/DrizzleMysql2.d.mts +53 -4
  4. package/dist/DrizzlePglite.d.mts +53 -4
  5. package/dist/DrizzlePostgres.d.mts +51 -2
  6. package/dist/DrizzleSqliteBun.d.mts +53 -4
  7. package/dist/DrizzleSqliteDo.d.mts +59 -10
  8. package/dist/DrizzleSqliteNode.d.mts +53 -4
  9. package/dist/DrizzleSqliteWasm.d.mts +51 -2
  10. package/dist/GitHub.d.mts +2 -1
  11. package/dist/GitHub.mjs +2 -1
  12. package/dist/OpenIdClient.d.mts +2 -1
  13. package/dist/OpenIdClient.mjs +2 -1
  14. package/dist/drizzle/d1-oauth.d.mts +2 -2
  15. package/dist/drizzle/oauth-connected-state.d.mts +1 -1
  16. package/dist/drizzle/oauth-registration.d.mts +1 -1
  17. package/dist/drizzle/oauth-registration.mjs +3 -2
  18. package/dist/drizzle/oauth-registration.mjs.map +1 -1
  19. package/dist/oauth/OAuthConnectedRevocations.d.mts +10 -0
  20. package/dist/oauth/OAuthRegistrationIntents.d.mts +9 -0
  21. package/dist/oauth/accountsModels.d.mts +5 -0
  22. package/dist/oauth/connected.d.mts +22 -0
  23. package/dist/oauth/connectedModels.d.mts +115 -0
  24. package/dist/oauth/definition.d.mts +111 -3
  25. package/dist/oauth/github/identity.mjs +11 -9
  26. package/dist/oauth/github/identity.mjs.map +1 -1
  27. package/dist/oauth/github/profile.d.mts +61 -0
  28. package/dist/oauth/github/profile.mjs +72 -0
  29. package/dist/oauth/github/profile.mjs.map +1 -0
  30. package/dist/oauth/openid-client/connected/protocol.mjs +3 -0
  31. package/dist/oauth/openid-client/connected/protocol.mjs.map +1 -1
  32. package/dist/oauth/openid-client/profile.d.mts +39 -0
  33. package/dist/oauth/openid-client/profile.mjs +58 -0
  34. package/dist/oauth/openid-client/profile.mjs.map +1 -0
  35. package/dist/oauth/openid-client/protocol.mjs +3 -0
  36. package/dist/oauth/openid-client/protocol.mjs.map +1 -1
  37. package/dist/oauth/registrationModels.d.mts +22 -0
  38. package/dist/oauth/registrationModels.mjs +4 -1
  39. package/dist/oauth/registrationModels.mjs.map +1 -1
  40. package/dist/oauth/registrationSecrets.mjs +1 -0
  41. package/dist/oauth/registrationSecrets.mjs.map +1 -1
  42. package/dist/oauth/signInModels.d.mts +18 -0
  43. package/dist/oauth/signInModels.mjs +11 -1
  44. package/dist/oauth/signInModels.mjs.map +1 -1
  45. package/dist/oauth/signInModule.d.mts +43 -4
  46. package/dist/oauth/signInModule.mjs +1 -1
  47. package/dist/oauth/signInModule.mjs.map +1 -1
  48. package/dist/oauth/signInSnapshot.mjs +1 -1
  49. package/dist/oauth/signInSnapshot.mjs.map +1 -1
  50. package/package.json +1 -1
  51. package/src/GitHub.ts +1 -0
  52. package/src/OpenIdClient.ts +2 -0
  53. package/src/drizzle/oauth-registration.ts +4 -0
  54. package/src/oauth/github/identity.ts +11 -7
  55. package/src/oauth/github/profile.ts +64 -0
  56. package/src/oauth/openid-client/connected/protocol.ts +4 -0
  57. package/src/oauth/openid-client/profile.ts +68 -0
  58. package/src/oauth/openid-client/protocol.ts +4 -0
  59. package/src/oauth/registrationModels.ts +4 -0
  60. package/src/oauth/registrationSecrets.ts +1 -0
  61. package/src/oauth/signInModels.ts +18 -0
  62. package/src/oauth/signInModule.ts +4 -0
  63. package/src/oauth/signInSnapshot.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-registration.mjs","names":[],"sources":["../../src/drizzle/oauth-registration.ts"],"sourcesContent":["/* oxlint-disable no-explicit-any -- private owner kernel preserves Registration at the exported constructor. */\nimport { eq, sql } from \"drizzle-orm\";\nimport { Effect, Schema } from \"effect\";\n\nimport {\n OAuthRegistrationAccess,\n OAuthRegistrationDecision,\n OAuthRegistrationFingerprint,\n OAuthRegistrationInspection,\n OAuthRegistrationIntent,\n} from \"../oauth/registrationModels\";\nimport {\n OAuthCredentialSnapshot,\n OAuthSignInTransactionContext,\n type OAuthExternalIdentity,\n} from \"../oauth/signInModels\";\nimport { snapshotOAuthSync } from \"../oauth/signInSnapshot\";\nimport type { SecurityRevision } from \"../sessions/models\";\nimport type { DrizzleMappingError, SubjectIdCodec } from \"./model\";\nimport { discoverOwned, exactClaim, resolveOwned, terminalFlow } from \"./oauth-flow\";\nimport type { OAuthRegistrationBase } from \"./oauth-model\";\nimport { both, col, equal, matchesNativeRow, CurrentOAuthTransaction } from \"./oauth-owner\";\nimport { invariant, oauthIdentityKey, sameIdentity, storage } from \"./oauth-state\";\n\nexport const intentStorage = storage(OAuthRegistrationIntent);\nconst decisionStorage = storage(OAuthRegistrationDecision);\nconst contextStorage = storage(OAuthSignInTransactionContext);\n\nconst reservationStorage = storage(\n Schema.Struct({\n moduleId: Schema.String,\n reference: Schema.String,\n commandId: Schema.String,\n fingerprint: Schema.String,\n provisioningIdentity: Schema.String,\n }),\n);\n\nexport const readTuple = (ownership: any, identity: typeof OAuthExternalIdentity.Type) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const t = ownership.tuple,\n key = oauthIdentityKey(identity);\n\n const where = { [t.identityKey]: key };\n const observed = yield* owner.read(t.table, equal(t.table, where), { limit: 1 });\n\n if (observed.rows.length === 0) {\n const values = {\n ...t.encodeInsert({ identityKey: key, identity }),\n ...where,\n [t.provider]: identity.provider,\n [t.issuer]: identity.issuer,\n [t.externalSubject]: identity.subject,\n [t.state]: \"Unowned\",\n [t.version]: owner.marker,\n [t.subjectId]: null,\n [t.reservation]: null,\n };\n\n const inserted = yield* owner.insert(t.table, values, where, true);\n\n observed.rows = inserted.rows;\n }\n const row = observed.rows[0]!;\n\n invariant(\n row[t.provider] === identity.provider &&\n row[t.issuer] === identity.issuer &&\n row[t.externalSubject] === identity.subject &&\n [\"Unowned\", \"Reserved\", \"Owned\"].includes(row[t.state]),\n );\n invariant(\n row[t.state] === \"Owned\"\n ? row[t.subjectId] !== null\n : row[t.subjectId] === null &&\n (row[t.state] === \"Reserved\"\n ? typeof row[t.reservation] === \"string\"\n : row[t.reservation] === null),\n );\n if (ownership.mode === \"separate\") {\n const o = ownership.external;\n\n const external = yield* owner.read(o.table, equal(o.table, { [o.identityKey]: key }), {\n limit: 1,\n });\n\n if (row[t.state] === \"Owned\") {\n const linked = external.rows[0];\n\n invariant(\n linked !== undefined &&\n linked[o.provider] === identity.provider &&\n linked[o.issuer] === identity.issuer &&\n linked[o.externalSubject] === identity.subject &&\n matchesNativeRow(o.table, linked, { [o.subjectId]: row[t.subjectId] }),\n );\n const owned = sql`exists(select 1 from ${o.table} where ${both(equal(o.table, { [o.identityKey]: key }), o.ownedCondition)})`;\n\n invariant(yield* owner.check(owned));\n owner.postconditions.push(owned);\n } else invariant(external.rows.length === 0);\n }\n\n return { observed, row, key };\n }),\n );\n\nexport const acquireTuple = (\n ownership: any,\n identity: typeof OAuthExternalIdentity.Type,\n key: string,\n subjectId: unknown,\n) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const t = ownership.tuple;\n\n yield* owner.update(\n t.table,\n { [t.identityKey]: key },\n {\n [t.state]: \"Owned\",\n [t.subjectId]: subjectId,\n [t.reservation]: null,\n [t.version]: owner.marker,\n },\n );\n if (ownership.mode === \"separate\") {\n const o = ownership.external;\n\n const values = {\n ...o.encodeInsert({ identity, identityKey: key, subjectId }),\n [o.identityKey]: key,\n [o.provider]: identity.provider,\n [o.issuer]: identity.issuer,\n [o.externalSubject]: identity.subject,\n [o.subjectId]: subjectId,\n };\n\n yield* owner.insert(o.table, values, { [o.identityKey]: key });\n }\n }),\n );\n\nexport const settleRegistrationIntent = (mapping: any, input: any) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const identity = input.identity.identity,\n context = input.claim.flow.context;\n\n invariant(identity.provider === context.provider && identity.issuer === context.issuer);\n const found = yield* discoverOwned(mapping.signIn, identity);\n const tuple = found.owned ? undefined : yield* readTuple(mapping.ownership, identity);\n const exact = yield* exactClaim(mapping.signIn, input.claim, \"sign-in\");\n\n if (exact === undefined) return { _tag: \"Rejected\" } as const;\n const credential = resolveOwned(mapping.signIn, context.moduleId, identity, found);\n\n if (credential !== undefined) {\n yield* terminalFlow(mapping.signIn, input.claim.flow, \"Verified\");\n\n return { _tag: \"Verified\", credential } as const;\n }\n let decision: any = { _tag: \"Rejected\" };\n\n if (\n !found.owned &&\n tuple?.row[mapping.ownership.tuple.state] === \"Unowned\" &&\n input.intent !== undefined\n ) {\n const intent = snapshotOAuthSync(OAuthRegistrationIntent, input.intent);\n const c = intent.context;\n\n invariant(\n sameIdentity(intent.identity, identity) &&\n intent.claimId === input.claim.claimId &&\n intent.claimedAtMillis === input.claim.claimedAtMillis &&\n contextStorage.encode(c) === contextStorage.encode(context),\n );\n\n const allowed =\n intent.issuedAtMillis >= intent.claimedAtMillis &&\n intent.verifiedAtMillis <= intent.issuedAtMillis &&\n intent.issuedAtMillis <= exact.now &&\n exact.now < intent.expiresAtMillis &&\n intent.expiresAtMillis <= c.requestBindingExpiresAtMillis &&\n intent.retentionUntilMillis >= intent.expiresAtMillis &&\n (yield* owner.check(mapping.eligibility.condition({ intent })));\n\n if (allowed) {\n const i = mapping.intent,\n encode = mapping.signIn.clock.encodeInstant;\n\n const key = { [i.moduleId]: c.moduleId, [i.reference]: intent.reference };\n\n const values = {\n ...i.encodeInsert(snapshotOAuthSync(OAuthRegistrationIntent, intent)),\n ...key,\n [i.flowId]: c.flowId,\n [i.claimId]: intent.claimId,\n [i.identityKey]: tuple.key,\n [i.version]: owner.marker,\n [i.state]: \"Unbound\",\n [i.snapshot]: intentStorage.encode(intent),\n [i.commandId]: null,\n [i.fingerprint]: null,\n [i.pendingReference]: null,\n [i.expiresAt]: encode(intent.expiresAtMillis),\n [i.retentionUntil]: encode(intent.retentionUntilMillis),\n };\n\n yield* owner.insert(i.table, values, key);\n owner.postconditions.push(\n mapping.eligibility.condition({ intent }),\n sql`${mapping.signIn.clock.engineNowMillis} >= ${intent.issuedAtMillis} and\n ${mapping.signIn.clock.engineNowMillis} < ${intent.expiresAtMillis}`,\n );\n decision = { _tag: \"RegistrationIssued\", intent };\n }\n }\n yield* terminalFlow(mapping.signIn, input.claim.flow, decision._tag);\n\n return decision;\n }),\n );\n\nexport const inspectIntent = (\n mapping: any,\n original: typeof OAuthRegistrationAccess.Type,\n discovery = false,\n) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const access = snapshotOAuthSync(OAuthRegistrationAccess, original),\n i = mapping.intent;\n\n const observed = yield* owner.read(\n i.table,\n equal(i.table, {\n [i.moduleId]: access.moduleId,\n [i.reference]: access.reference,\n }),\n { limit: 1, ...(discovery ? { lock: false, observe: false } : {}) },\n );\n\n const row = observed.rows[0];\n\n if (row === undefined) return undefined;\n\n const intent = intentStorage.decode(row[i.snapshot]),\n c = intent.context,\n now = yield* owner.now(mapping.clock);\n\n invariant(\n row[i.moduleId] === c.moduleId &&\n row[i.reference] === intent.reference &&\n row[i.flowId] === c.flowId &&\n row[i.claimId] === intent.claimId &&\n row[i.identityKey] === oauthIdentityKey(intent.identity) &&\n mapping.clock.decodeInstant(row[i.expiresAt]) === intent.expiresAtMillis &&\n mapping.clock.decodeInstant(row[i.retentionUntil]) === intent.retentionUntilMillis,\n );\n if (\n access.moduleId !== c.moduleId ||\n access.reference !== intent.reference ||\n access.flowId !== c.flowId ||\n access.requestBindingVerifier !== c.requestBindingVerifier ||\n access.requestBindingExpiresAtMillis !== c.requestBindingExpiresAtMillis ||\n access.credentialDigest !== intent.credentialDigest ||\n now < intent.issuedAtMillis ||\n now >= intent.expiresAtMillis\n )\n return undefined;\n let application: any;\n\n if (row[i.state] === \"Unbound\") {\n invariant(\n row[i.commandId] === null &&\n row[i.fingerprint] === null &&\n row[i.pendingReference] === null,\n );\n application = { _tag: \"Unbound\" };\n } else {\n application = {\n _tag: row[i.state],\n commandId: row[i.commandId],\n fingerprint: row[i.fingerprint],\n ...(row[i.state] === \"ProvisioningPending\" ? { reference: row[i.pendingReference] } : {}),\n };\n }\n const inspection = snapshotOAuthSync(OAuthRegistrationInspection, { intent, application });\n\n owner.postconditions.push(sql`${mapping.clock.engineNowMillis} >= ${intent.issuedAtMillis} and\n ${mapping.clock.engineNowMillis} < ${intent.expiresAtMillis}`);\n\n return { observed, row, inspection };\n }),\n );\n\nexport interface RegistrationResources {\n readonly provisioningIdentity: string;\n readonly pendingReference?: string;\n readonly subjectId?: unknown;\n readonly credentialId?: string;\n readonly revision?: string;\n}\n\n/** Public mapping callbacks are closed Effects; erasing native row shapes must\n * not erase their error or requirements channels. */\nexport type RegistrationCallbacks<Registration> = Pick<\n OAuthRegistrationBase<Registration, any, any, any, any, unknown>,\n \"snapshot\" | \"snapshotSync\" | \"inspect\" | \"inspectSync\"\n>;\n\nexport const registrationResources = (mapping: any) =>\n Effect.gen(function* () {\n const provisioningIdentity = yield* mapping.allocateProvisioningIdentity as Effect.Effect<\n string,\n DrizzleMappingError\n >;\n\n invariant(\n typeof provisioningIdentity === \"string\" &&\n provisioningIdentity.length > 0 &&\n provisioningIdentity.length <= 256,\n );\n if (mapping.mode === \"pending\") {\n const pendingReference = yield* mapping.allocatePendingReference as Effect.Effect<\n string,\n DrizzleMappingError\n >;\n\n invariant(\n typeof pendingReference === \"string\" &&\n pendingReference.length > 0 &&\n pendingReference.length <= 256,\n );\n\n return { provisioningIdentity, pendingReference } as RegistrationResources;\n }\n\n const subjectId = yield* mapping.allocateSubjectId as Effect.Effect<\n unknown,\n DrizzleMappingError\n >;\n\n const publicId = yield* (mapping.subjectId as SubjectIdCodec<unknown>).toSubject(subjectId);\n\n invariant(\n mapping.subjectId.equals(\n subjectId,\n yield* (mapping.subjectId as SubjectIdCodec<unknown>).toNative(publicId),\n ),\n );\n\n const credentialId = snapshotOAuthSync(\n OAuthCredentialSnapshot.fields.credentialId,\n yield* mapping.allocateCredentialId as Effect.Effect<string, DrizzleMappingError>,\n );\n\n const revision = snapshotOAuthSync(\n OAuthCredentialSnapshot.fields.credentialRevision,\n yield* mapping.allocateRevision as Effect.Effect<SecurityRevision, DrizzleMappingError>,\n );\n\n return { provisioningIdentity, subjectId, credentialId, revision } as RegistrationResources;\n });\n\nexport const registrationData = <Registration>(\n mapping: any,\n input: {\n readonly intent: OAuthRegistrationIntent;\n readonly registration: Registration;\n readonly fingerprint: string;\n },\n bound: boolean,\n) =>\n Effect.gen(function* () {\n const snapshot = bound\n ? (invariant(mapping.snapshotSync !== undefined), mapping.snapshotSync(input.registration))\n : yield* (mapping as RegistrationCallbacks<Registration>).snapshot(input.registration);\n\n const encoded = mapping.application.encode(snapshot);\n\n invariant(typeof encoded === \"string\" && new TextEncoder().encode(encoded).length <= 1048576);\n const detached = mapping.application.decode(encoded);\n\n invariant(mapping.application.encode(detached) === encoded);\n\n const checked = bound\n ? (invariant(mapping.inspectSync !== undefined),\n mapping.inspectSync({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, input.intent),\n registration: mapping.application.decode(encoded),\n }))\n : yield* (mapping as RegistrationCallbacks<Registration>).inspect({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, input.intent),\n registration: mapping.application.decode(encoded),\n });\n\n const fingerprint = snapshotOAuthSync(OAuthRegistrationFingerprint, checked.fingerprint);\n\n invariant(typeof checked.eligible === \"boolean\");\n\n return {\n encoded,\n registration: detached as Registration,\n fingerprint,\n eligible: checked.eligible && fingerprint === input.fingerprint,\n };\n });\n\nexport const register = (\n mapping: any,\n input: any,\n data: { readonly encoded: string; readonly fingerprint: string; readonly eligible: boolean },\n resources: RegistrationResources,\n) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const intent = snapshotOAuthSync(OAuthRegistrationIntent, input.intent),\n c = intent.context;\n\n const discovered = yield* inspectIntent(mapping, input.access, true);\n\n if (\n discovered === undefined ||\n intentStorage.encode(discovered.inspection.intent) !== intentStorage.encode(intent)\n )\n return { _tag: \"Rejected\" } as const;\n const nativeSubjectId = resources.subjectId;\n\n const policyInput = () => ({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, intent),\n registration: mapping.application.decode(data.encoded),\n ...(mapping.mode === \"atomic\" ? { nativeSubjectId } : {}),\n });\n\n invariant((mapping.eligibility.guards?.length ?? 0) <= 32);\n for (const guard of mapping.eligibility.guards ?? []) {\n const locked = yield* owner.read(guard.table, guard.condition(policyInput()), {\n orderBy: col(guard.table, guard.orderBy),\n admissionOnly: true,\n });\n\n invariant(locked.rows.length > 0);\n }\n const tuple = yield* readTuple(mapping.ownership, intent.identity);\n const inspected = yield* inspectIntent(mapping, input.access);\n\n if (\n inspected === undefined ||\n intentStorage.encode(inspected.inspection.intent) !== intentStorage.encode(intent)\n )\n return { _tag: \"Rejected\" } as const;\n\n const r = mapping.command,\n i = mapping.intent,\n t = mapping.ownership.tuple;\n\n const commandKey = { [r.moduleId]: c.moduleId, [r.commandId]: input.commandId };\n const command = yield* owner.read(r.table, equal(r.table, commandKey), { limit: 1 });\n const previous = command.rows[0];\n\n if (previous !== undefined) {\n if (\n previous[r.reference] !== intent.reference ||\n previous[r.identityKey] !== tuple.key ||\n previous[r.fingerprint] !== data.fingerprint ||\n previous[r.intentSnapshot] !== intentStorage.encode(intent) ||\n previous[r.applicationSnapshot] !== data.encoded\n )\n return { _tag: \"Conflict\" } as const;\n invariant(\n mapping.application.encode(\n mapping.application.decode(previous[r.applicationSnapshot]),\n ) === data.encoded,\n );\n const old = decisionStorage.decode(previous[r.decision]);\n\n invariant(inspected.inspection.application._tag === old._tag);\n\n return old._tag === \"Registered\" || old._tag === \"ProvisioningPending\"\n ? { ...old, replayed: true }\n : old;\n }\n if (inspected.inspection.application._tag !== \"Unbound\" || tuple.row[t.state] !== \"Unowned\")\n return { _tag: \"Conflict\" } as const;\n if (data.fingerprint !== input.fingerprint) return { _tag: \"Rejected\" } as const;\n\n const admitted =\n data.eligible && (yield* owner.check(mapping.eligibility.admission(policyInput())));\n\n let decision: typeof OAuthRegistrationDecision.Type;\n\n if (!admitted) decision = { _tag: \"Rejected\" };\n else if (mapping.mode === \"pending\") {\n invariant(resources.pendingReference !== undefined);\n\n const reservation = reservationStorage.encode({\n moduleId: c.moduleId,\n reference: intent.reference,\n commandId: input.commandId,\n fingerprint: data.fingerprint,\n provisioningIdentity: resources.provisioningIdentity,\n });\n\n yield* owner.update(\n t.table,\n { [t.identityKey]: tuple.key },\n {\n [t.state]: \"Reserved\",\n [t.version]: owner.marker,\n [t.reservation]: reservation,\n },\n );\n decision = {\n _tag: \"ProvisioningPending\",\n reference: resources.pendingReference,\n replayed: false,\n };\n } else {\n invariant(resources.credentialId !== undefined && resources.revision !== undefined);\n\n const s = mapping.subject,\n cr = mapping.credential,\n a = mapping.authority;\n\n const subjectValues = {\n ...mapping.encodeSubjectInsert(policyInput(), {\n subjectId: nativeSubjectId,\n securityRevision: resources.revision,\n }),\n [s.id]: nativeSubjectId,\n [s.securityRevision]: resources.revision,\n };\n\n yield* owner.insert(s.table, subjectValues, { [s.id]: nativeSubjectId });\n\n const credentialValues = {\n ...cr.encodeInsert({\n moduleId: c.moduleId,\n subjectId: nativeSubjectId,\n identityKey: tuple.key,\n credentialId: resources.credentialId,\n credentialRevision: resources.revision,\n }),\n [cr.moduleId]: c.moduleId,\n [cr.subjectId]: nativeSubjectId,\n [cr.identityKey]: tuple.key,\n [cr.credentialId]: resources.credentialId,\n [cr.credentialRevision]: resources.revision,\n };\n\n invariant(\n cr.isActiveStatus(credentialValues[cr.status]) &&\n s.isActiveStatus(subjectValues[s.status]),\n );\n yield* owner.insert(cr.table, credentialValues, {\n [cr.credentialId]: resources.credentialId,\n });\n\n const authorityValues = {\n ...a.encodeInsert({\n subjectId: nativeSubjectId,\n credentialId: resources.credentialId,\n revision: resources.revision,\n }),\n [a.subjectId]: nativeSubjectId,\n [a.credentialId]: resources.credentialId,\n [a.revision]: resources.revision,\n };\n\n invariant(a.isActiveStatus(authorityValues[a.status]));\n yield* owner.insert(a.table, authorityValues, {\n [a.subjectId]: nativeSubjectId,\n [a.credentialId]: resources.credentialId,\n });\n yield* acquireTuple(mapping.ownership, intent.identity, tuple.key, nativeSubjectId);\n owner.postconditions.push(\n sql`exists(select 1 from ${s.table} where ${both(\n eq(col(s.table, s.id), nativeSubjectId),\n s.activeCondition,\n )})`,\n sql`exists(select 1 from ${cr.table} where ${both(eq(col(cr.table, cr.credentialId), resources.credentialId), cr.activeCondition)})`,\n sql`exists(select 1 from ${a.table} where ${both(\n eq(col(a.table, a.credentialId), resources.credentialId),\n eq(col(a.table, a.subjectId), nativeSubjectId),\n a.activeCondition,\n )})`,\n );\n decision = { _tag: \"Registered\", replayed: false };\n }\n const now = yield* owner.now(mapping.clock);\n\n invariant(Number.isSafeInteger(mapping.retentionMillis) && mapping.retentionMillis >= 120000);\n\n const values = {\n ...r.encodeInsert({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, intent),\n commandId: input.commandId,\n fingerprint: data.fingerprint,\n registration: mapping.application.decode(data.encoded),\n provisioningIdentity: resources.provisioningIdentity,\n }),\n ...commandKey,\n [r.reference]: intent.reference,\n [r.identityKey]: tuple.key,\n [r.fingerprint]: data.fingerprint,\n [r.intentSnapshot]: intentStorage.encode(intent),\n [r.applicationSnapshot]: data.encoded,\n [r.provisioningIdentity]: resources.provisioningIdentity,\n [r.decision]: decisionStorage.encode(decision),\n [r.retentionUntil]: mapping.clock.encodeInstant(\n Math.max(intent.retentionUntilMillis, now + mapping.retentionMillis),\n ),\n };\n\n const inserted = yield* owner.insert(r.table, values, commandKey);\n\n command.rows = inserted.rows;\n yield* owner.update(\n i.table,\n { [i.moduleId]: c.moduleId, [i.reference]: intent.reference },\n {\n [i.state]: decision._tag,\n [i.commandId]: input.commandId,\n [i.fingerprint]: data.fingerprint,\n [i.version]: owner.marker,\n [i.pendingReference]: decision._tag === \"ProvisioningPending\" ? decision.reference : null,\n },\n );\n if (admitted) owner.postconditions.push(mapping.eligibility.postcondition(policyInput()));\n\n return decision;\n }),\n );\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,gBAAgB,QAAQ,uBAAuB;AAC5D,MAAM,kBAAkB,QAAQ,yBAAyB;AACzD,MAAM,iBAAiB,QAAQ,6BAA6B;AAE5D,MAAM,qBAAqB,QACzB,OAAO,OAAO;CACZ,UAAU,OAAO;CACjB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,aAAa,OAAO;CACpB,sBAAsB,OAAO;AAC/B,CAAC,CACH;AAEA,MAAa,aAAa,WAAgB,aACxC,OAAO,QAAQ,0BAA0B,UACvC,OAAO,IAAI,aAAa;CACtB,MAAM,IAAI,UAAU,OAClB,MAAM,iBAAiB,QAAQ;CAEjC,MAAM,QAAQ,GAAG,EAAE,cAAc,IAAI;CACrC,MAAM,WAAW,OAAO,MAAM,KAAK,EAAE,OAAO,MAAM,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO,EAAE,CAAC;CAE/E,IAAI,SAAS,KAAK,WAAW,GAAG;EAC9B,MAAM,SAAS;GACb,GAAG,EAAE,aAAa;IAAE,aAAa;IAAK;GAAS,CAAC;GAChD,GAAG;IACF,EAAE,WAAW,SAAS;IACtB,EAAE,SAAS,SAAS;IACpB,EAAE,kBAAkB,SAAS;IAC7B,EAAE,QAAQ;IACV,EAAE,UAAU,MAAM;IAClB,EAAE,YAAY;IACd,EAAE,cAAc;EACnB;EAIA,SAAS,QAAO,OAFQ,MAAM,OAAO,EAAE,OAAO,QAAQ,OAAO,IAAI,EAAA,CAExC;CAC3B;CACA,MAAM,MAAM,SAAS,KAAK;CAE1B,UACE,IAAI,EAAE,cAAc,SAAS,YAC3B,IAAI,EAAE,YAAY,SAAS,UAC3B,IAAI,EAAE,qBAAqB,SAAS,WACpC;EAAC;EAAW;EAAY;CAAO,CAAC,CAAC,SAAS,IAAI,EAA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IAAI,QAAQ,KAAK;CAE1C,UAAU,OAAO,cAAc,QAAQ,eAAe,KAAK,QAAQ,mBAAmB,IAAM;CAE5F,MAAM,SAAS;EACb,GAAG,EAAE,aAAa;GAChB,QAAQ,kBAAkB,yBAAyB,MAAM;GACzD,WAAW,MAAM;GACjB,aAAa,KAAK;GAClB,cAAc,QAAQ,YAAY,OAAO,KAAK,OAAO;GACrD,sBAAsB,UAAU;EAClC,CAAC;EACD,GAAG;GACF,EAAE,YAAY,OAAO;GACrB,EAAE,cAAc,MAAM;GACtB,EAAE,cAAc,KAAK;GACrB,EAAE,iBAAiB,cAAc,OAAO,MAAM;GAC9C,EAAE,sBAAsB,KAAK;GAC7B,EAAE,uBAAuB,UAAU;GACnC,EAAE,WAAW,gBAAgB,OAAO,QAAQ;GAC5C,EAAE,iBAAiB,QAAQ,MAAM,cAChC,KAAK,IAAI,OAAO,sBAAsB,MAAM,QAAQ,eAAe,CACrE;CACF;CAIA,QAAQ,QAAO,OAFS,MAAM,OAAO,EAAE,OAAO,QAAQ,UAAU,EAAA,CAExC;CACxB,OAAO,MAAM,OACX,EAAE,OACF;GAAG,EAAE,WAAW,EAAE;GAAW,EAAE,YAAY,OAAO;CAAU,GAC5D;GACG,EAAE,QAAQ,SAAS;GACnB,EAAE,YAAY,MAAM;GACpB,EAAE,cAAc,KAAK;GACrB,EAAE,UAAU,MAAM;GAClB,EAAE,mBAAmB,SAAS,SAAS,wBAAwB,SAAS,YAAY;CACvF,CACF;CACA,IAAI,UAAU,MAAM,eAAe,KAAK,QAAQ,YAAY,cAAc,YAAY,CAAC,CAAC;CAExF,OAAO;AACT,CAAC,CACH"}
1
+ {"version":3,"file":"oauth-registration.mjs","names":[],"sources":["../../src/drizzle/oauth-registration.ts"],"sourcesContent":["/* oxlint-disable no-explicit-any -- private owner kernel preserves Registration at the exported constructor. */\nimport { eq, sql } from \"drizzle-orm\";\nimport { Effect, Schema } from \"effect\";\n\nimport {\n OAuthRegistrationAccess,\n OAuthRegistrationDecision,\n OAuthRegistrationFingerprint,\n OAuthRegistrationInspection,\n OAuthRegistrationIntent,\n} from \"../oauth/registrationModels\";\nimport {\n OAuthCredentialSnapshot,\n OAuthDisplayProfile,\n OAuthSignInTransactionContext,\n type OAuthExternalIdentity,\n} from \"../oauth/signInModels\";\nimport { snapshotOAuthSync } from \"../oauth/signInSnapshot\";\nimport type { SecurityRevision } from \"../sessions/models\";\nimport type { DrizzleMappingError, SubjectIdCodec } from \"./model\";\nimport { discoverOwned, exactClaim, resolveOwned, terminalFlow } from \"./oauth-flow\";\nimport type { OAuthRegistrationBase } from \"./oauth-model\";\nimport { both, col, equal, matchesNativeRow, CurrentOAuthTransaction } from \"./oauth-owner\";\nimport { invariant, oauthIdentityKey, sameIdentity, storage } from \"./oauth-state\";\n\nexport const intentStorage = storage(OAuthRegistrationIntent);\nconst decisionStorage = storage(OAuthRegistrationDecision);\nconst contextStorage = storage(OAuthSignInTransactionContext);\nconst profileStorage = storage(Schema.NullOr(OAuthDisplayProfile));\n\nconst reservationStorage = storage(\n Schema.Struct({\n moduleId: Schema.String,\n reference: Schema.String,\n commandId: Schema.String,\n fingerprint: Schema.String,\n provisioningIdentity: Schema.String,\n }),\n);\n\nexport const readTuple = (ownership: any, identity: typeof OAuthExternalIdentity.Type) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const t = ownership.tuple,\n key = oauthIdentityKey(identity);\n\n const where = { [t.identityKey]: key };\n const observed = yield* owner.read(t.table, equal(t.table, where), { limit: 1 });\n\n if (observed.rows.length === 0) {\n const values = {\n ...t.encodeInsert({ identityKey: key, identity }),\n ...where,\n [t.provider]: identity.provider,\n [t.issuer]: identity.issuer,\n [t.externalSubject]: identity.subject,\n [t.state]: \"Unowned\",\n [t.version]: owner.marker,\n [t.subjectId]: null,\n [t.reservation]: null,\n };\n\n const inserted = yield* owner.insert(t.table, values, where, true);\n\n observed.rows = inserted.rows;\n }\n const row = observed.rows[0]!;\n\n invariant(\n row[t.provider] === identity.provider &&\n row[t.issuer] === identity.issuer &&\n row[t.externalSubject] === identity.subject &&\n [\"Unowned\", \"Reserved\", \"Owned\"].includes(row[t.state]),\n );\n invariant(\n row[t.state] === \"Owned\"\n ? row[t.subjectId] !== null\n : row[t.subjectId] === null &&\n (row[t.state] === \"Reserved\"\n ? typeof row[t.reservation] === \"string\"\n : row[t.reservation] === null),\n );\n if (ownership.mode === \"separate\") {\n const o = ownership.external;\n\n const external = yield* owner.read(o.table, equal(o.table, { [o.identityKey]: key }), {\n limit: 1,\n });\n\n if (row[t.state] === \"Owned\") {\n const linked = external.rows[0];\n\n invariant(\n linked !== undefined &&\n linked[o.provider] === identity.provider &&\n linked[o.issuer] === identity.issuer &&\n linked[o.externalSubject] === identity.subject &&\n matchesNativeRow(o.table, linked, { [o.subjectId]: row[t.subjectId] }),\n );\n const owned = sql`exists(select 1 from ${o.table} where ${both(equal(o.table, { [o.identityKey]: key }), o.ownedCondition)})`;\n\n invariant(yield* owner.check(owned));\n owner.postconditions.push(owned);\n } else invariant(external.rows.length === 0);\n }\n\n return { observed, row, key };\n }),\n );\n\nexport const acquireTuple = (\n ownership: any,\n identity: typeof OAuthExternalIdentity.Type,\n key: string,\n subjectId: unknown,\n) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const t = ownership.tuple;\n\n yield* owner.update(\n t.table,\n { [t.identityKey]: key },\n {\n [t.state]: \"Owned\",\n [t.subjectId]: subjectId,\n [t.reservation]: null,\n [t.version]: owner.marker,\n },\n );\n if (ownership.mode === \"separate\") {\n const o = ownership.external;\n\n const values = {\n ...o.encodeInsert({ identity, identityKey: key, subjectId }),\n [o.identityKey]: key,\n [o.provider]: identity.provider,\n [o.issuer]: identity.issuer,\n [o.externalSubject]: identity.subject,\n [o.subjectId]: subjectId,\n };\n\n yield* owner.insert(o.table, values, { [o.identityKey]: key });\n }\n }),\n );\n\nexport const settleRegistrationIntent = (mapping: any, input: any) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const identity = input.identity.identity,\n context = input.claim.flow.context;\n\n invariant(identity.provider === context.provider && identity.issuer === context.issuer);\n const found = yield* discoverOwned(mapping.signIn, identity);\n const tuple = found.owned ? undefined : yield* readTuple(mapping.ownership, identity);\n const exact = yield* exactClaim(mapping.signIn, input.claim, \"sign-in\");\n\n if (exact === undefined) return { _tag: \"Rejected\" } as const;\n const credential = resolveOwned(mapping.signIn, context.moduleId, identity, found);\n\n if (credential !== undefined) {\n yield* terminalFlow(mapping.signIn, input.claim.flow, \"Verified\");\n\n return { _tag: \"Verified\", credential } as const;\n }\n let decision: any = { _tag: \"Rejected\" };\n\n if (\n !found.owned &&\n tuple?.row[mapping.ownership.tuple.state] === \"Unowned\" &&\n input.intent !== undefined\n ) {\n const intent = snapshotOAuthSync(OAuthRegistrationIntent, input.intent);\n const c = intent.context;\n\n invariant(\n sameIdentity(intent.identity, identity) &&\n profileStorage.encode(intent.profile ?? null) ===\n profileStorage.encode(input.identity.profile ?? null) &&\n intent.claimId === input.claim.claimId &&\n intent.claimedAtMillis === input.claim.claimedAtMillis &&\n contextStorage.encode(c) === contextStorage.encode(context),\n );\n\n const allowed =\n intent.issuedAtMillis >= intent.claimedAtMillis &&\n intent.verifiedAtMillis <= intent.issuedAtMillis &&\n intent.issuedAtMillis <= exact.now &&\n exact.now < intent.expiresAtMillis &&\n intent.expiresAtMillis <= c.requestBindingExpiresAtMillis &&\n intent.retentionUntilMillis >= intent.expiresAtMillis &&\n (yield* owner.check(mapping.eligibility.condition({ intent })));\n\n if (allowed) {\n const i = mapping.intent,\n encode = mapping.signIn.clock.encodeInstant;\n\n const key = { [i.moduleId]: c.moduleId, [i.reference]: intent.reference };\n\n const values = {\n ...i.encodeInsert(snapshotOAuthSync(OAuthRegistrationIntent, intent)),\n ...key,\n [i.flowId]: c.flowId,\n [i.claimId]: intent.claimId,\n [i.identityKey]: tuple.key,\n [i.version]: owner.marker,\n [i.state]: \"Unbound\",\n [i.snapshot]: intentStorage.encode(intent),\n [i.commandId]: null,\n [i.fingerprint]: null,\n [i.pendingReference]: null,\n [i.expiresAt]: encode(intent.expiresAtMillis),\n [i.retentionUntil]: encode(intent.retentionUntilMillis),\n };\n\n yield* owner.insert(i.table, values, key);\n owner.postconditions.push(\n mapping.eligibility.condition({ intent }),\n sql`${mapping.signIn.clock.engineNowMillis} >= ${intent.issuedAtMillis} and\n ${mapping.signIn.clock.engineNowMillis} < ${intent.expiresAtMillis}`,\n );\n decision = { _tag: \"RegistrationIssued\", intent };\n }\n }\n yield* terminalFlow(mapping.signIn, input.claim.flow, decision._tag);\n\n return decision;\n }),\n );\n\nexport const inspectIntent = (\n mapping: any,\n original: typeof OAuthRegistrationAccess.Type,\n discovery = false,\n) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const access = snapshotOAuthSync(OAuthRegistrationAccess, original),\n i = mapping.intent;\n\n const observed = yield* owner.read(\n i.table,\n equal(i.table, {\n [i.moduleId]: access.moduleId,\n [i.reference]: access.reference,\n }),\n { limit: 1, ...(discovery ? { lock: false, observe: false } : {}) },\n );\n\n const row = observed.rows[0];\n\n if (row === undefined) return undefined;\n\n const intent = intentStorage.decode(row[i.snapshot]),\n c = intent.context,\n now = yield* owner.now(mapping.clock);\n\n invariant(\n row[i.moduleId] === c.moduleId &&\n row[i.reference] === intent.reference &&\n row[i.flowId] === c.flowId &&\n row[i.claimId] === intent.claimId &&\n row[i.identityKey] === oauthIdentityKey(intent.identity) &&\n mapping.clock.decodeInstant(row[i.expiresAt]) === intent.expiresAtMillis &&\n mapping.clock.decodeInstant(row[i.retentionUntil]) === intent.retentionUntilMillis,\n );\n if (\n access.moduleId !== c.moduleId ||\n access.reference !== intent.reference ||\n access.flowId !== c.flowId ||\n access.requestBindingVerifier !== c.requestBindingVerifier ||\n access.requestBindingExpiresAtMillis !== c.requestBindingExpiresAtMillis ||\n access.credentialDigest !== intent.credentialDigest ||\n now < intent.issuedAtMillis ||\n now >= intent.expiresAtMillis\n )\n return undefined;\n let application: any;\n\n if (row[i.state] === \"Unbound\") {\n invariant(\n row[i.commandId] === null &&\n row[i.fingerprint] === null &&\n row[i.pendingReference] === null,\n );\n application = { _tag: \"Unbound\" };\n } else {\n application = {\n _tag: row[i.state],\n commandId: row[i.commandId],\n fingerprint: row[i.fingerprint],\n ...(row[i.state] === \"ProvisioningPending\" ? { reference: row[i.pendingReference] } : {}),\n };\n }\n const inspection = snapshotOAuthSync(OAuthRegistrationInspection, { intent, application });\n\n owner.postconditions.push(sql`${mapping.clock.engineNowMillis} >= ${intent.issuedAtMillis} and\n ${mapping.clock.engineNowMillis} < ${intent.expiresAtMillis}`);\n\n return { observed, row, inspection };\n }),\n );\n\nexport interface RegistrationResources {\n readonly provisioningIdentity: string;\n readonly pendingReference?: string;\n readonly subjectId?: unknown;\n readonly credentialId?: string;\n readonly revision?: string;\n}\n\n/** Public mapping callbacks are closed Effects; erasing native row shapes must\n * not erase their error or requirements channels. */\nexport type RegistrationCallbacks<Registration> = Pick<\n OAuthRegistrationBase<Registration, any, any, any, any, unknown>,\n \"snapshot\" | \"snapshotSync\" | \"inspect\" | \"inspectSync\"\n>;\n\nexport const registrationResources = (mapping: any) =>\n Effect.gen(function* () {\n const provisioningIdentity = yield* mapping.allocateProvisioningIdentity as Effect.Effect<\n string,\n DrizzleMappingError\n >;\n\n invariant(\n typeof provisioningIdentity === \"string\" &&\n provisioningIdentity.length > 0 &&\n provisioningIdentity.length <= 256,\n );\n if (mapping.mode === \"pending\") {\n const pendingReference = yield* mapping.allocatePendingReference as Effect.Effect<\n string,\n DrizzleMappingError\n >;\n\n invariant(\n typeof pendingReference === \"string\" &&\n pendingReference.length > 0 &&\n pendingReference.length <= 256,\n );\n\n return { provisioningIdentity, pendingReference } as RegistrationResources;\n }\n\n const subjectId = yield* mapping.allocateSubjectId as Effect.Effect<\n unknown,\n DrizzleMappingError\n >;\n\n const publicId = yield* (mapping.subjectId as SubjectIdCodec<unknown>).toSubject(subjectId);\n\n invariant(\n mapping.subjectId.equals(\n subjectId,\n yield* (mapping.subjectId as SubjectIdCodec<unknown>).toNative(publicId),\n ),\n );\n\n const credentialId = snapshotOAuthSync(\n OAuthCredentialSnapshot.fields.credentialId,\n yield* mapping.allocateCredentialId as Effect.Effect<string, DrizzleMappingError>,\n );\n\n const revision = snapshotOAuthSync(\n OAuthCredentialSnapshot.fields.credentialRevision,\n yield* mapping.allocateRevision as Effect.Effect<SecurityRevision, DrizzleMappingError>,\n );\n\n return { provisioningIdentity, subjectId, credentialId, revision } as RegistrationResources;\n });\n\nexport const registrationData = <Registration>(\n mapping: any,\n input: {\n readonly intent: OAuthRegistrationIntent;\n readonly registration: Registration;\n readonly fingerprint: string;\n },\n bound: boolean,\n) =>\n Effect.gen(function* () {\n const snapshot = bound\n ? (invariant(mapping.snapshotSync !== undefined), mapping.snapshotSync(input.registration))\n : yield* (mapping as RegistrationCallbacks<Registration>).snapshot(input.registration);\n\n const encoded = mapping.application.encode(snapshot);\n\n invariant(typeof encoded === \"string\" && new TextEncoder().encode(encoded).length <= 1048576);\n const detached = mapping.application.decode(encoded);\n\n invariant(mapping.application.encode(detached) === encoded);\n\n const checked = bound\n ? (invariant(mapping.inspectSync !== undefined),\n mapping.inspectSync({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, input.intent),\n registration: mapping.application.decode(encoded),\n }))\n : yield* (mapping as RegistrationCallbacks<Registration>).inspect({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, input.intent),\n registration: mapping.application.decode(encoded),\n });\n\n const fingerprint = snapshotOAuthSync(OAuthRegistrationFingerprint, checked.fingerprint);\n\n invariant(typeof checked.eligible === \"boolean\");\n\n return {\n encoded,\n registration: detached as Registration,\n fingerprint,\n eligible: checked.eligible && fingerprint === input.fingerprint,\n };\n });\n\nexport const register = (\n mapping: any,\n input: any,\n data: { readonly encoded: string; readonly fingerprint: string; readonly eligible: boolean },\n resources: RegistrationResources,\n) =>\n Effect.flatMap(CurrentOAuthTransaction, (owner) =>\n Effect.gen(function* () {\n const intent = snapshotOAuthSync(OAuthRegistrationIntent, input.intent),\n c = intent.context;\n\n const discovered = yield* inspectIntent(mapping, input.access, true);\n\n if (\n discovered === undefined ||\n intentStorage.encode(discovered.inspection.intent) !== intentStorage.encode(intent)\n )\n return { _tag: \"Rejected\" } as const;\n const nativeSubjectId = resources.subjectId;\n\n const policyInput = () => ({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, intent),\n registration: mapping.application.decode(data.encoded),\n ...(mapping.mode === \"atomic\" ? { nativeSubjectId } : {}),\n });\n\n invariant((mapping.eligibility.guards?.length ?? 0) <= 32);\n for (const guard of mapping.eligibility.guards ?? []) {\n const locked = yield* owner.read(guard.table, guard.condition(policyInput()), {\n orderBy: col(guard.table, guard.orderBy),\n admissionOnly: true,\n });\n\n invariant(locked.rows.length > 0);\n }\n const tuple = yield* readTuple(mapping.ownership, intent.identity);\n const inspected = yield* inspectIntent(mapping, input.access);\n\n if (\n inspected === undefined ||\n intentStorage.encode(inspected.inspection.intent) !== intentStorage.encode(intent)\n )\n return { _tag: \"Rejected\" } as const;\n\n const r = mapping.command,\n i = mapping.intent,\n t = mapping.ownership.tuple;\n\n const commandKey = { [r.moduleId]: c.moduleId, [r.commandId]: input.commandId };\n const command = yield* owner.read(r.table, equal(r.table, commandKey), { limit: 1 });\n const previous = command.rows[0];\n\n if (previous !== undefined) {\n if (\n previous[r.reference] !== intent.reference ||\n previous[r.identityKey] !== tuple.key ||\n previous[r.fingerprint] !== data.fingerprint ||\n previous[r.intentSnapshot] !== intentStorage.encode(intent) ||\n previous[r.applicationSnapshot] !== data.encoded\n )\n return { _tag: \"Conflict\" } as const;\n invariant(\n mapping.application.encode(\n mapping.application.decode(previous[r.applicationSnapshot]),\n ) === data.encoded,\n );\n const old = decisionStorage.decode(previous[r.decision]);\n\n invariant(inspected.inspection.application._tag === old._tag);\n\n return old._tag === \"Registered\" || old._tag === \"ProvisioningPending\"\n ? { ...old, replayed: true }\n : old;\n }\n if (inspected.inspection.application._tag !== \"Unbound\" || tuple.row[t.state] !== \"Unowned\")\n return { _tag: \"Conflict\" } as const;\n if (data.fingerprint !== input.fingerprint) return { _tag: \"Rejected\" } as const;\n\n const admitted =\n data.eligible && (yield* owner.check(mapping.eligibility.admission(policyInput())));\n\n let decision: typeof OAuthRegistrationDecision.Type;\n\n if (!admitted) decision = { _tag: \"Rejected\" };\n else if (mapping.mode === \"pending\") {\n invariant(resources.pendingReference !== undefined);\n\n const reservation = reservationStorage.encode({\n moduleId: c.moduleId,\n reference: intent.reference,\n commandId: input.commandId,\n fingerprint: data.fingerprint,\n provisioningIdentity: resources.provisioningIdentity,\n });\n\n yield* owner.update(\n t.table,\n { [t.identityKey]: tuple.key },\n {\n [t.state]: \"Reserved\",\n [t.version]: owner.marker,\n [t.reservation]: reservation,\n },\n );\n decision = {\n _tag: \"ProvisioningPending\",\n reference: resources.pendingReference,\n replayed: false,\n };\n } else {\n invariant(resources.credentialId !== undefined && resources.revision !== undefined);\n\n const s = mapping.subject,\n cr = mapping.credential,\n a = mapping.authority;\n\n const subjectValues = {\n ...mapping.encodeSubjectInsert(policyInput(), {\n subjectId: nativeSubjectId,\n securityRevision: resources.revision,\n }),\n [s.id]: nativeSubjectId,\n [s.securityRevision]: resources.revision,\n };\n\n yield* owner.insert(s.table, subjectValues, { [s.id]: nativeSubjectId });\n\n const credentialValues = {\n ...cr.encodeInsert({\n moduleId: c.moduleId,\n subjectId: nativeSubjectId,\n identityKey: tuple.key,\n credentialId: resources.credentialId,\n credentialRevision: resources.revision,\n }),\n [cr.moduleId]: c.moduleId,\n [cr.subjectId]: nativeSubjectId,\n [cr.identityKey]: tuple.key,\n [cr.credentialId]: resources.credentialId,\n [cr.credentialRevision]: resources.revision,\n };\n\n invariant(\n cr.isActiveStatus(credentialValues[cr.status]) &&\n s.isActiveStatus(subjectValues[s.status]),\n );\n yield* owner.insert(cr.table, credentialValues, {\n [cr.credentialId]: resources.credentialId,\n });\n\n const authorityValues = {\n ...a.encodeInsert({\n subjectId: nativeSubjectId,\n credentialId: resources.credentialId,\n revision: resources.revision,\n }),\n [a.subjectId]: nativeSubjectId,\n [a.credentialId]: resources.credentialId,\n [a.revision]: resources.revision,\n };\n\n invariant(a.isActiveStatus(authorityValues[a.status]));\n yield* owner.insert(a.table, authorityValues, {\n [a.subjectId]: nativeSubjectId,\n [a.credentialId]: resources.credentialId,\n });\n yield* acquireTuple(mapping.ownership, intent.identity, tuple.key, nativeSubjectId);\n owner.postconditions.push(\n sql`exists(select 1 from ${s.table} where ${both(\n eq(col(s.table, s.id), nativeSubjectId),\n s.activeCondition,\n )})`,\n sql`exists(select 1 from ${cr.table} where ${both(eq(col(cr.table, cr.credentialId), resources.credentialId), cr.activeCondition)})`,\n sql`exists(select 1 from ${a.table} where ${both(\n eq(col(a.table, a.credentialId), resources.credentialId),\n eq(col(a.table, a.subjectId), nativeSubjectId),\n a.activeCondition,\n )})`,\n );\n decision = { _tag: \"Registered\", replayed: false };\n }\n const now = yield* owner.now(mapping.clock);\n\n invariant(Number.isSafeInteger(mapping.retentionMillis) && mapping.retentionMillis >= 120000);\n\n const values = {\n ...r.encodeInsert({\n intent: snapshotOAuthSync(OAuthRegistrationIntent, intent),\n commandId: input.commandId,\n fingerprint: data.fingerprint,\n registration: mapping.application.decode(data.encoded),\n provisioningIdentity: resources.provisioningIdentity,\n }),\n ...commandKey,\n [r.reference]: intent.reference,\n [r.identityKey]: tuple.key,\n [r.fingerprint]: data.fingerprint,\n [r.intentSnapshot]: intentStorage.encode(intent),\n [r.applicationSnapshot]: data.encoded,\n [r.provisioningIdentity]: resources.provisioningIdentity,\n [r.decision]: decisionStorage.encode(decision),\n [r.retentionUntil]: mapping.clock.encodeInstant(\n Math.max(intent.retentionUntilMillis, now + mapping.retentionMillis),\n ),\n };\n\n const inserted = yield* owner.insert(r.table, values, commandKey);\n\n command.rows = inserted.rows;\n yield* owner.update(\n i.table,\n { [i.moduleId]: c.moduleId, [i.reference]: intent.reference },\n {\n [i.state]: decision._tag,\n [i.commandId]: input.commandId,\n [i.fingerprint]: data.fingerprint,\n [i.version]: owner.marker,\n [i.pendingReference]: decision._tag === \"ProvisioningPending\" ? decision.reference : null,\n },\n );\n if (admitted) owner.postconditions.push(mapping.eligibility.postcondition(policyInput()));\n\n return decision;\n }),\n );\n"],"mappings":";;;;;;;;;;AAyBA,MAAa,gBAAgB,QAAQ,uBAAuB;AAC5D,MAAM,kBAAkB,QAAQ,yBAAyB;AACzD,MAAM,iBAAiB,QAAQ,6BAA6B;AAC5D,MAAM,iBAAiB,QAAQ,OAAO,OAAO,mBAAmB,CAAC;AAEjE,MAAM,qBAAqB,QACzB,OAAO,OAAO;CACZ,UAAU,OAAO;CACjB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,aAAa,OAAO;CACpB,sBAAsB,OAAO;AAC/B,CAAC,CACH;AAEA,MAAa,aAAa,WAAgB,aACxC,OAAO,QAAQ,0BAA0B,UACvC,OAAO,IAAI,aAAa;CACtB,MAAM,IAAI,UAAU,OAClB,MAAM,iBAAiB,QAAQ;CAEjC,MAAM,QAAQ,GAAG,EAAE,cAAc,IAAI;CACrC,MAAM,WAAW,OAAO,MAAM,KAAK,EAAE,OAAO,MAAM,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO,EAAE,CAAC;CAE/E,IAAI,SAAS,KAAK,WAAW,GAAG;EAC9B,MAAM,SAAS;GACb,GAAG,EAAE,aAAa;IAAE,aAAa;IAAK;GAAS,CAAC;GAChD,GAAG;IACF,EAAE,WAAW,SAAS;IACtB,EAAE,SAAS,SAAS;IACpB,EAAE,kBAAkB,SAAS;IAC7B,EAAE,QAAQ;IACV,EAAE,UAAU,MAAM;IAClB,EAAE,YAAY;IACd,EAAE,cAAc;EACnB;EAIA,SAAS,QAAO,OAFQ,MAAM,OAAO,EAAE,OAAO,QAAQ,OAAO,IAAI,EAAA,CAExC;CAC3B;CACA,MAAM,MAAM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AC,CAAC;CAExF,OAAO;AACT,CAAC,CACH"}
@@ -57,6 +57,11 @@ declare const OAuthConnectedRevocationClaim: Schema.Struct<{
57
57
  readonly profile: Schema.optionalKey<Schema.Struct<{
58
58
  readonly displayName: Schema.optionalKey<Schema.String>;
59
59
  readonly handle: Schema.optionalKey<Schema.String>;
60
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
61
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
62
+ readonly email: Schema.optionalKey<Schema.String>;
63
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
64
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
60
65
  }>>;
61
66
  }>;
62
67
  }>;
@@ -127,6 +132,11 @@ declare const OAuthConnectedRevocationDecision: Schema.Union<readonly [Schema.Ta
127
132
  readonly profile: Schema.optionalKey<Schema.Struct<{
128
133
  readonly displayName: Schema.optionalKey<Schema.String>;
129
134
  readonly handle: Schema.optionalKey<Schema.String>;
135
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
136
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
137
+ readonly email: Schema.optionalKey<Schema.String>;
138
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
139
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
130
140
  }>>;
131
141
  }>;
132
142
  }>;
@@ -56,6 +56,15 @@ declare const OAuthRegistrationSettlement: Schema.Union<readonly [Schema.Union<r
56
56
  readonly issuer: Schema.brand<Schema.String, "effect-auth/OAuthIssuer">;
57
57
  readonly subject: Schema.NonEmptyString;
58
58
  }>;
59
+ readonly profile: Schema.optionalKey<Schema.Struct<{
60
+ readonly displayName: Schema.optionalKey<Schema.String>;
61
+ readonly handle: Schema.optionalKey<Schema.String>;
62
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
63
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
64
+ readonly email: Schema.optionalKey<Schema.String>;
65
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
66
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
67
+ }>>;
59
68
  readonly verifiedAtMillis: Schema.Int;
60
69
  readonly credentialDigest: Schema.brand<Schema.NonEmptyString, "effect-auth/TokenDigest">;
61
70
  readonly issuedAtMillis: Schema.Int;
@@ -391,6 +391,11 @@ declare const OAuthLinkOutcome: Schema.Union<readonly [Schema.TaggedStruct<"Veri
391
391
  readonly profile: Schema.optionalKey<Schema.Struct<{
392
392
  readonly displayName: Schema.optionalKey<Schema.String>;
393
393
  readonly handle: Schema.optionalKey<Schema.String>;
394
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
395
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
396
+ readonly email: Schema.optionalKey<Schema.String>;
397
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
398
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
394
399
  }>>;
395
400
  }>;
396
401
  }>, Schema.TaggedStruct<"Cancelled", {}>, Schema.TaggedStruct<"Rejected", {}>, Schema.TaggedStruct<"Ambiguous", {}>]>;
@@ -228,6 +228,11 @@ declare const makeOAuthConnected: <const Id extends string>(moduleId: Id, config
228
228
  readonly profile: Schema.optionalKey<Schema.Struct<{
229
229
  readonly displayName: Schema.optionalKey<Schema.String>;
230
230
  readonly handle: Schema.optionalKey<Schema.String>;
231
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
232
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
233
+ readonly email: Schema.optionalKey<Schema.String>;
234
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
235
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
231
236
  }>>;
232
237
  readonly remoteRevocation: Schema.Literals<readonly ["Pending", "Confirmed", "Unsupported", "Unknown"]>;
233
238
  }>>;
@@ -250,6 +255,11 @@ declare const makeOAuthConnected: <const Id extends string>(moduleId: Id, config
250
255
  readonly profile: Schema.optionalKey<Schema.Struct<{
251
256
  readonly displayName: Schema.optionalKey<Schema.String>;
252
257
  readonly handle: Schema.optionalKey<Schema.String>;
258
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
259
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
260
+ readonly email: Schema.optionalKey<Schema.String>;
261
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
262
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
253
263
  }>>;
254
264
  readonly remoteRevocation: Schema.Literals<readonly ["Pending", "Confirmed", "Unsupported", "Unknown"]>;
255
265
  }>>;
@@ -360,6 +370,13 @@ declare const makeOAuthConnected: <const Id extends string>(moduleId: Id, config
360
370
  readonly profile?: {
361
371
  readonly displayName?: string | undefined;
362
372
  readonly handle?: string | undefined;
373
+ readonly avatarUrl?: string | undefined;
374
+ readonly profileUrl?: string | undefined;
375
+ readonly email?: string | undefined;
376
+ readonly emailVerified?: boolean | undefined;
377
+ readonly providerData?: {
378
+ readonly [x: string]: Schema.Json;
379
+ } | undefined;
363
380
  } | undefined;
364
381
  readonly remoteRevocation: "Confirmed" | "Pending" | "Unknown" | "Unsupported";
365
382
  }[];
@@ -431,6 +448,11 @@ declare const makeOAuthConnected: <const Id extends string>(moduleId: Id, config
431
448
  readonly profile: Schema.optionalKey<Schema.Struct<{
432
449
  readonly displayName: Schema.optionalKey<Schema.String>;
433
450
  readonly handle: Schema.optionalKey<Schema.String>;
451
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
452
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
453
+ readonly email: Schema.optionalKey<Schema.String>;
454
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
455
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
434
456
  }>>;
435
457
  readonly remoteRevocation: Schema.Literals<readonly ["Pending", "Confirmed", "Unsupported", "Unknown"]>;
436
458
  }>>;
@@ -544,6 +544,11 @@ declare const OAuthConnectedGrantResponse: Schema.Struct<{
544
544
  readonly profile: Schema.optionalKey<Schema.Struct<{
545
545
  readonly displayName: Schema.optionalKey<Schema.String>;
546
546
  readonly handle: Schema.optionalKey<Schema.String>;
547
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
548
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
549
+ readonly email: Schema.optionalKey<Schema.String>;
550
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
551
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
547
552
  }>>;
548
553
  readonly scopes: Schema.$Array<Schema.String>;
549
554
  readonly resources: Schema.$Array<Schema.NonEmptyString>;
@@ -572,6 +577,11 @@ declare const OAuthConnectedTokenMetadata: Schema.Struct<{
572
577
  readonly profile: Schema.optionalKey<Schema.Struct<{
573
578
  readonly displayName: Schema.optionalKey<Schema.String>;
574
579
  readonly handle: Schema.optionalKey<Schema.String>;
580
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
581
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
582
+ readonly email: Schema.optionalKey<Schema.String>;
583
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
584
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
575
585
  }>>;
576
586
  }>;
577
587
  declare const OAuthConnectedTokenContext: Schema.Struct<{
@@ -622,6 +632,11 @@ declare const OAuthConnectedTokenContext: Schema.Struct<{
622
632
  readonly profile: Schema.optionalKey<Schema.Struct<{
623
633
  readonly displayName: Schema.optionalKey<Schema.String>;
624
634
  readonly handle: Schema.optionalKey<Schema.String>;
635
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
636
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
637
+ readonly email: Schema.optionalKey<Schema.String>;
638
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
639
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
625
640
  }>>;
626
641
  }>;
627
642
  }>;
@@ -677,6 +692,11 @@ declare const OAuthConnectedRevocationContext: Schema.Struct<{
677
692
  readonly profile: Schema.optionalKey<Schema.Struct<{
678
693
  readonly displayName: Schema.optionalKey<Schema.String>;
679
694
  readonly handle: Schema.optionalKey<Schema.String>;
695
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
696
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
697
+ readonly email: Schema.optionalKey<Schema.String>;
698
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
699
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
680
700
  }>>;
681
701
  }>;
682
702
  }>;
@@ -730,6 +750,11 @@ declare const OAuthConnectedProtectionContext: Schema.Union<readonly [Schema.Str
730
750
  readonly profile: Schema.optionalKey<Schema.Struct<{
731
751
  readonly displayName: Schema.optionalKey<Schema.String>;
732
752
  readonly handle: Schema.optionalKey<Schema.String>;
753
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
754
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
755
+ readonly email: Schema.optionalKey<Schema.String>;
756
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
757
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
733
758
  }>>;
734
759
  }>;
735
760
  }>, Schema.Struct<{
@@ -783,6 +808,11 @@ declare const OAuthConnectedProtectionContext: Schema.Union<readonly [Schema.Str
783
808
  readonly profile: Schema.optionalKey<Schema.Struct<{
784
809
  readonly displayName: Schema.optionalKey<Schema.String>;
785
810
  readonly handle: Schema.optionalKey<Schema.String>;
811
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
812
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
813
+ readonly email: Schema.optionalKey<Schema.String>;
814
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
815
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
786
816
  }>>;
787
817
  }>;
788
818
  }>;
@@ -844,6 +874,11 @@ declare const OAuthConnectedStoredGrant: Schema.Struct<{
844
874
  readonly profile: Schema.optionalKey<Schema.Struct<{
845
875
  readonly displayName: Schema.optionalKey<Schema.String>;
846
876
  readonly handle: Schema.optionalKey<Schema.String>;
877
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
878
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
879
+ readonly email: Schema.optionalKey<Schema.String>;
880
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
881
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
847
882
  }>>;
848
883
  }>;
849
884
  }>;
@@ -904,6 +939,11 @@ declare const OAuthConnectedDisconnectGrant: Schema.Struct<{
904
939
  readonly profile: Schema.optionalKey<Schema.Struct<{
905
940
  readonly displayName: Schema.optionalKey<Schema.String>;
906
941
  readonly handle: Schema.optionalKey<Schema.String>;
942
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
943
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
944
+ readonly email: Schema.optionalKey<Schema.String>;
945
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
946
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
907
947
  }>>;
908
948
  }>;
909
949
  }>;
@@ -967,6 +1007,11 @@ declare const OAuthConnectedRevocationJob: Schema.Struct<{
967
1007
  readonly profile: Schema.optionalKey<Schema.Struct<{
968
1008
  readonly displayName: Schema.optionalKey<Schema.String>;
969
1009
  readonly handle: Schema.optionalKey<Schema.String>;
1010
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1011
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1012
+ readonly email: Schema.optionalKey<Schema.String>;
1013
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1014
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
970
1015
  }>>;
971
1016
  }>;
972
1017
  }>;
@@ -1029,6 +1074,11 @@ declare const OAuthConnectedRefreshClaim: Schema.Struct<{
1029
1074
  readonly profile: Schema.optionalKey<Schema.Struct<{
1030
1075
  readonly displayName: Schema.optionalKey<Schema.String>;
1031
1076
  readonly handle: Schema.optionalKey<Schema.String>;
1077
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1078
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1079
+ readonly email: Schema.optionalKey<Schema.String>;
1080
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1081
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1032
1082
  }>>;
1033
1083
  }>;
1034
1084
  }>;
@@ -1057,6 +1107,11 @@ declare const OAuthConnectedSummary: Schema.Struct<{
1057
1107
  readonly profile: Schema.optionalKey<Schema.Struct<{
1058
1108
  readonly displayName: Schema.optionalKey<Schema.String>;
1059
1109
  readonly handle: Schema.optionalKey<Schema.String>;
1110
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1111
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1112
+ readonly email: Schema.optionalKey<Schema.String>;
1113
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1114
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1060
1115
  }>>;
1061
1116
  readonly remoteRevocation: Schema.Literals<readonly ["Pending", "Confirmed", "Unsupported", "Unknown"]>;
1062
1117
  }>;
@@ -1073,6 +1128,11 @@ declare const OAuthConnectedListResult: Schema.Struct<{
1073
1128
  readonly profile: Schema.optionalKey<Schema.Struct<{
1074
1129
  readonly displayName: Schema.optionalKey<Schema.String>;
1075
1130
  readonly handle: Schema.optionalKey<Schema.String>;
1131
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1132
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1133
+ readonly email: Schema.optionalKey<Schema.String>;
1134
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1135
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1076
1136
  }>>;
1077
1137
  readonly remoteRevocation: Schema.Literals<readonly ["Pending", "Confirmed", "Unsupported", "Unknown"]>;
1078
1138
  }>>;
@@ -1351,6 +1411,11 @@ declare const OAuthConnectedOutcome: Schema.Union<readonly [Schema.TaggedStruct<
1351
1411
  readonly profile: Schema.optionalKey<Schema.Struct<{
1352
1412
  readonly displayName: Schema.optionalKey<Schema.String>;
1353
1413
  readonly handle: Schema.optionalKey<Schema.String>;
1414
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1415
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1416
+ readonly email: Schema.optionalKey<Schema.String>;
1417
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1418
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1354
1419
  }>>;
1355
1420
  }>;
1356
1421
  }>;
@@ -1413,6 +1478,11 @@ declare const OAuthConnectedOutcome: Schema.Union<readonly [Schema.TaggedStruct<
1413
1478
  readonly profile: Schema.optionalKey<Schema.Struct<{
1414
1479
  readonly displayName: Schema.optionalKey<Schema.String>;
1415
1480
  readonly handle: Schema.optionalKey<Schema.String>;
1481
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1482
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1483
+ readonly email: Schema.optionalKey<Schema.String>;
1484
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1485
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1416
1486
  }>>;
1417
1487
  }>;
1418
1488
  }>;
@@ -1474,6 +1544,11 @@ declare const OAuthConnectedOutcome: Schema.Union<readonly [Schema.TaggedStruct<
1474
1544
  readonly profile: Schema.optionalKey<Schema.Struct<{
1475
1545
  readonly displayName: Schema.optionalKey<Schema.String>;
1476
1546
  readonly handle: Schema.optionalKey<Schema.String>;
1547
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1548
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1549
+ readonly email: Schema.optionalKey<Schema.String>;
1550
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1551
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1477
1552
  }>>;
1478
1553
  }>;
1479
1554
  }>;
@@ -1536,6 +1611,11 @@ declare const OAuthConnectedOutcome: Schema.Union<readonly [Schema.TaggedStruct<
1536
1611
  readonly profile: Schema.optionalKey<Schema.Struct<{
1537
1612
  readonly displayName: Schema.optionalKey<Schema.String>;
1538
1613
  readonly handle: Schema.optionalKey<Schema.String>;
1614
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1615
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1616
+ readonly email: Schema.optionalKey<Schema.String>;
1617
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1618
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1539
1619
  }>>;
1540
1620
  }>;
1541
1621
  }>;
@@ -1599,6 +1679,11 @@ declare const OAuthConnectedSettlementDecision: Schema.Union<readonly [Schema.Ta
1599
1679
  readonly profile: Schema.optionalKey<Schema.Struct<{
1600
1680
  readonly displayName: Schema.optionalKey<Schema.String>;
1601
1681
  readonly handle: Schema.optionalKey<Schema.String>;
1682
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1683
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1684
+ readonly email: Schema.optionalKey<Schema.String>;
1685
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1686
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1602
1687
  }>>;
1603
1688
  }>;
1604
1689
  }>;
@@ -1660,6 +1745,11 @@ declare const OAuthConnectedDisconnectInspection: Schema.Union<readonly [Schema.
1660
1745
  readonly profile: Schema.optionalKey<Schema.Struct<{
1661
1746
  readonly displayName: Schema.optionalKey<Schema.String>;
1662
1747
  readonly handle: Schema.optionalKey<Schema.String>;
1748
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1749
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1750
+ readonly email: Schema.optionalKey<Schema.String>;
1751
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1752
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1663
1753
  }>>;
1664
1754
  }>;
1665
1755
  }>;
@@ -1742,6 +1832,11 @@ declare const OAuthConnectedAccessInspection: Schema.Union<readonly [Schema.Tagg
1742
1832
  readonly profile: Schema.optionalKey<Schema.Struct<{
1743
1833
  readonly displayName: Schema.optionalKey<Schema.String>;
1744
1834
  readonly handle: Schema.optionalKey<Schema.String>;
1835
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1836
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1837
+ readonly email: Schema.optionalKey<Schema.String>;
1838
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1839
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1745
1840
  }>>;
1746
1841
  }>;
1747
1842
  }>;
@@ -1804,6 +1899,11 @@ declare const OAuthConnectedRefreshDecision: Schema.Union<readonly [Schema.Tagge
1804
1899
  readonly profile: Schema.optionalKey<Schema.Struct<{
1805
1900
  readonly displayName: Schema.optionalKey<Schema.String>;
1806
1901
  readonly handle: Schema.optionalKey<Schema.String>;
1902
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1903
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1904
+ readonly email: Schema.optionalKey<Schema.String>;
1905
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1906
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1807
1907
  }>>;
1808
1908
  }>;
1809
1909
  }>;
@@ -1870,6 +1970,11 @@ declare const OAuthConnectedRefreshOutcome: Schema.Union<readonly [Schema.Tagged
1870
1970
  readonly profile: Schema.optionalKey<Schema.Struct<{
1871
1971
  readonly displayName: Schema.optionalKey<Schema.String>;
1872
1972
  readonly handle: Schema.optionalKey<Schema.String>;
1973
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
1974
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
1975
+ readonly email: Schema.optionalKey<Schema.String>;
1976
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
1977
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1873
1978
  }>>;
1874
1979
  }>;
1875
1980
  }>;
@@ -1932,6 +2037,11 @@ declare const OAuthConnectedRefreshOutcome: Schema.Union<readonly [Schema.Tagged
1932
2037
  readonly profile: Schema.optionalKey<Schema.Struct<{
1933
2038
  readonly displayName: Schema.optionalKey<Schema.String>;
1934
2039
  readonly handle: Schema.optionalKey<Schema.String>;
2040
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
2041
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
2042
+ readonly email: Schema.optionalKey<Schema.String>;
2043
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
2044
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1935
2045
  }>>;
1936
2046
  }>;
1937
2047
  }>;
@@ -1995,6 +2105,11 @@ declare const OAuthConnectedRefreshSettlement: Schema.Union<readonly [Schema.Tag
1995
2105
  readonly profile: Schema.optionalKey<Schema.Struct<{
1996
2106
  readonly displayName: Schema.optionalKey<Schema.String>;
1997
2107
  readonly handle: Schema.optionalKey<Schema.String>;
2108
+ readonly avatarUrl: Schema.optionalKey<Schema.String>;
2109
+ readonly profileUrl: Schema.optionalKey<Schema.String>;
2110
+ readonly email: Schema.optionalKey<Schema.String>;
2111
+ readonly emailVerified: Schema.optionalKey<Schema.Boolean>;
2112
+ readonly providerData: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1998
2113
  }>>;
1999
2114
  }>;
2000
2115
  }>;