@riffdb/better-auth 0.2.0 → 0.2.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.
- package/DESIGN.md +90 -14
- package/README.md +157 -25
- package/dist/adapter.d.ts +7 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +385 -47
- package/dist/adapter.js.map +1 -1
- package/dist/generated/client.d.ts +267 -26
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +479 -69
- package/dist/generated/client.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin-dispatch.d.ts +37 -0
- package/dist/plugin-dispatch.d.ts.map +1 -0
- package/dist/plugin-dispatch.js +293 -0
- package/dist/plugin-dispatch.js.map +1 -0
- package/dist/profile-contract.d.ts +3 -0
- package/dist/profile-contract.d.ts.map +1 -1
- package/dist/profile-contract.js +8 -0
- package/dist/profile-contract.js.map +1 -1
- package/dist/profile-plan.js +1 -1
- package/dist/profile-plan.js.map +1 -1
- package/dist/profile.d.ts +2 -1
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +2 -1
- package/dist/profile.js.map +1 -1
- package/dist/profiles/custom-fields/profile.d.ts +3 -0
- package/dist/profiles/custom-fields/profile.d.ts.map +1 -0
- package/dist/profiles/custom-fields/profile.js +475 -0
- package/dist/profiles/custom-fields/profile.js.map +1 -0
- package/dist/profiles/custom-fields/src/generated/client.d.ts +2710 -0
- package/dist/profiles/custom-fields/src/generated/client.d.ts.map +1 -0
- package/dist/profiles/custom-fields/src/generated/client.js +2663 -0
- package/dist/profiles/custom-fields/src/generated/client.js.map +1 -0
- package/dist/profiles/runtime/profile.d.ts +3 -0
- package/dist/profiles/runtime/profile.d.ts.map +1 -0
- package/dist/profiles/runtime/profile.js +1065 -0
- package/dist/profiles/runtime/profile.js.map +1 -0
- package/dist/profiles/runtime/src/generated/client.d.ts +4274 -0
- package/dist/profiles/runtime/src/generated/client.d.ts.map +1 -0
- package/dist/profiles/runtime/src/generated/client.js +4607 -0
- package/dist/profiles/runtime/src/generated/client.js.map +1 -0
- package/dist/runtime-materialize.d.ts +10 -0
- package/dist/runtime-materialize.d.ts.map +1 -0
- package/dist/runtime-materialize.js +344 -0
- package/dist/runtime-materialize.js.map +1 -0
- package/dist/runtime-profile.d.ts +34 -0
- package/dist/runtime-profile.d.ts.map +1 -0
- package/dist/runtime-profile.js +203 -0
- package/dist/runtime-profile.js.map +1 -0
- package/generated/go/client.go +350 -96
- package/generated/mcp/tools.json +3338 -1768
- package/generated/python/client.py +603 -26
- package/generated/riffdb.application.exact.json +1 -1
- package/generated/riffdb.contract.bundle +0 -0
- package/generated/rust/client.rs +522 -26
- package/package.json +34 -13
- package/profiles/custom-fields/generated/go/client.go +2578 -0
- package/profiles/custom-fields/generated/mcp/tools.json +15998 -0
- package/profiles/custom-fields/generated/python/client.py +5141 -0
- package/profiles/custom-fields/generated/riffdb.application.exact.json +1 -0
- package/profiles/custom-fields/generated/riffdb.contract.bundle +0 -0
- package/profiles/custom-fields/generated/rust/client.rs +7980 -0
- package/profiles/custom-fields/profile.ts +474 -0
- package/profiles/custom-fields/riffdb/contract.riff +568 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_contains_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_contains_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/find_account_by_id.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/find_account_by_provider.riffq +26 -0
- package/profiles/custom-fields/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
- package/profiles/custom-fields/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
- package/profiles/custom-fields/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
- package/profiles/custom-fields/riffdb/queries/find_credential_account.riffq +25 -0
- package/profiles/custom-fields/riffdb/queries/find_expired_verification_ids.riffq +17 -0
- package/profiles/custom-fields/riffdb/queries/find_latest_verification.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_session_by_id.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_session_by_token.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
- package/profiles/custom-fields/riffdb/queries/find_user_by_email.riffq +16 -0
- package/profiles/custom-fields/riffdb/queries/find_user_by_id.riffq +15 -0
- package/profiles/custom-fields/riffdb/queries/find_verification_by_id.riffq +19 -0
- package/profiles/custom-fields/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
- package/profiles/custom-fields/riffdb/queries/profile_account_with_user_by_provider.riffq +31 -0
- package/profiles/custom-fields/riffdb/queries/profile_session_with_user_by_id.riffq +14 -0
- package/profiles/custom-fields/riffdb/queries/profile_session_with_user_by_token.riffq +14 -0
- package/profiles/custom-fields/riffdb/queries/profile_sessions_with_users_by_token_set.riffq +25 -0
- package/profiles/custom-fields/riffdb/queries/profile_user_with_accounts_by_email.riffq +19 -0
- package/profiles/custom-fields/riffdb/queries/profile_user_with_accounts_by_id.riffq +19 -0
- package/profiles/custom-fields/riffdb.application.json +217 -0
- package/profiles/custom-fields/riffdb.application.lock.json +1 -0
- package/profiles/custom-fields/riffdb.toml +3 -0
- package/profiles/custom-fields/src/generated/client.ts +3096 -0
- package/profiles/organization-security/materialization.json +3 -0
- package/profiles/organization-security/riffdb/contract.riff +12 -0
- package/profiles/organization-security/riffdb/queries/find_team_by_id.riffq +1 -1
- package/profiles/organization-security/riffdb/queries/find_team_member_by_id.riffq +1 -1
- package/profiles/organization-security/riffdb/queries/find_team_member_by_membership_key.riffq +16 -0
- package/profiles/organization-security/riffdb/queries/find_team_member_by_team_id.riffq +1 -1
- package/profiles/organization-security/riffdb.application.json +5 -0
- package/profiles/organization-security.profile.json +27 -1
- package/profiles/runtime/generated/go/client.go +4511 -0
- package/profiles/runtime/generated/mcp/tools.json +30004 -0
- package/profiles/runtime/generated/python/client.py +9337 -0
- package/profiles/runtime/generated/riffdb.application.exact.json +1 -0
- package/profiles/runtime/generated/riffdb.contract.bundle +0 -0
- package/profiles/runtime/generated/rust/client.rs +13297 -0
- package/profiles/runtime/profile.ts +1064 -0
- package/profiles/runtime/riffdb/contract.riff +1053 -0
- package/profiles/runtime/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_contains_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_contains_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/find_account_by_id.riffq +24 -0
- package/profiles/runtime/riffdb/queries/find_account_by_provider.riffq +26 -0
- package/profiles/runtime/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
- package/profiles/runtime/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
- package/profiles/runtime/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
- package/profiles/runtime/riffdb/queries/find_credential_account.riffq +25 -0
- package/profiles/runtime/riffdb/queries/find_expired_verification_ids.riffq +17 -0
- package/profiles/runtime/riffdb/queries/find_latest_verification.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_session_by_id.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_session_by_token.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
- package/profiles/runtime/riffdb/queries/find_user_by_email.riffq +16 -0
- package/profiles/runtime/riffdb/queries/find_user_by_id.riffq +15 -0
- package/profiles/runtime/riffdb/queries/find_verification_by_id.riffq +19 -0
- package/profiles/runtime/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
- package/profiles/runtime/riffdb/queries/profile_account_with_user_by_provider.riffq +31 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_email.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_id.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_email_status.riffq +19 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_id.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_status.riffq +18 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_id.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_created_at_asc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_created_at_desc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_role_asc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_role_desc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_user.riffq +28 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_user.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_organization_by_id.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_organization_by_slug.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_session_with_user_by_id.riffq +14 -0
- package/profiles/runtime/riffdb/queries/profile_session_with_user_by_token.riffq +14 -0
- package/profiles/runtime/riffdb/queries/profile_sessions_with_users_by_token_set.riffq +25 -0
- package/profiles/runtime/riffdb/queries/profile_two_factor_by_id.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_two_factor_by_user.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_user_with_accounts_by_email.riffq +19 -0
- package/profiles/runtime/riffdb/queries/profile_user_with_accounts_by_id.riffq +19 -0
- package/profiles/runtime/riffdb/queries/profile_users_by_id_set.riffq +8 -0
- package/profiles/runtime/riffdb.application.json +324 -0
- package/profiles/runtime/riffdb.application.lock.json +1 -0
- package/profiles/runtime/riffdb.toml +3 -0
- package/profiles/runtime/src/generated/client.ts +5186 -0
- package/riffdb/contract.riff +58 -0
- package/riffdb/queries/find_credential_account.riffq +25 -0
- package/riffdb.application.json +106 -26
- package/riffdb.application.lock.json +1 -1
- package/src/generated/client.ts +2746 -0
|
@@ -0,0 +1,3096 @@
|
|
|
1
|
+
// @generated by riffdb-query-module; do not edit.
|
|
2
|
+
export const QUERY_MODULE_HASH = "eec91a84b8d7f5372ce91cbc9bbead58a6a49f16f0acd5f8ef813a47070d0a21" as const;
|
|
3
|
+
export const CONTRACT_LINEAGE = "BetterAuthCustomFields" as const;
|
|
4
|
+
export const CONTRACT_VERSION = 1 as const;
|
|
5
|
+
export const CONTRACT_BUNDLE_HASH = "78db5a4be0e3f6edb09d1e743703e53171b7cacea589a9fac33d2e1fea33c374" as const;
|
|
6
|
+
export interface ContractDriverIdentity {
|
|
7
|
+
readonly contractLineage: typeof CONTRACT_LINEAGE;
|
|
8
|
+
readonly contractVersion: bigint;
|
|
9
|
+
readonly contractBundleHash: typeof CONTRACT_BUNDLE_HASH;
|
|
10
|
+
readonly role: string;
|
|
11
|
+
readonly database?: string;
|
|
12
|
+
readonly applicationManifestHash?: string;
|
|
13
|
+
readonly operationCatalogHash?: string;
|
|
14
|
+
readonly roleDefinitionHash?: string;
|
|
15
|
+
readonly remoteIdentityHash?: string;
|
|
16
|
+
}
|
|
17
|
+
export const CONTRACT_DRIVER_IDENTITY = {
|
|
18
|
+
contractLineage: CONTRACT_LINEAGE,
|
|
19
|
+
contractVersion: BigInt(CONTRACT_VERSION),
|
|
20
|
+
contractBundleHash: CONTRACT_BUNDLE_HASH,
|
|
21
|
+
} as const;
|
|
22
|
+
export function driverIdentity(role: string, database?: string): ContractDriverIdentity {
|
|
23
|
+
return database === undefined ? { ...CONTRACT_DRIVER_IDENTITY, role } : { ...CONTRACT_DRIVER_IDENTITY, role, database };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const APPLICATION_ERROR_REGISTRY = {
|
|
27
|
+
"RDB-APP-0001": ["application request is structurally invalid", "input", "correct_request", ["correct_input"]],
|
|
28
|
+
"RDB-INPUT-0101": ["application input is invalid", "input", "correct_request", ["correct_input"]],
|
|
29
|
+
"RDB-AUTH-0214": ["application operation is not authorized", "authorization", "obtain_permission", ["bind_application_role"]],
|
|
30
|
+
"RDB-CONTRACT-0101": ["application contract does not match", "contract", "refresh_contract", ["refresh_contract"]],
|
|
31
|
+
"RDB-QUERY-0101": ["RiffQL query is invalid", "query", "correct_request", ["correct_input"]],
|
|
32
|
+
"RDB-QUERY-0102": ["RiffQL query is unavailable", "query", "refresh_contract", ["pin_active_module"]],
|
|
33
|
+
"RDB-MODULE-0101": ["query module is unavailable", "module", "refresh_contract", ["pin_active_module"]],
|
|
34
|
+
"RDB-CURSOR-0101": ["query cursor is invalid or stale", "cursor", "correct_request", ["restart_from_first_page"]],
|
|
35
|
+
"RDB-RESOURCE-0101": ["application result exceeds the service limit", "resource", "correct_request", ["correct_input"]],
|
|
36
|
+
"RDB-STORAGE-0101": ["storage is temporarily unavailable", "storage", "retry", ["retry_later"]],
|
|
37
|
+
"RDB-UNCERTAIN-0101": ["command outcome is not yet known", "uncertainty", "resolve_with_same_idempotency_key", ["resolve_with_same_idempotency_key"]],
|
|
38
|
+
"RDB-APP-0002": ["application request was cancelled", "control", "none", []],
|
|
39
|
+
"RDB-APP-0003": ["application request deadline elapsed", "control", "retry", ["retry_later"]],
|
|
40
|
+
"RDB-INTERNAL-0001": ["an internal error occurred", "internal", "contact_operator", ["contact_operator_with_incident"]],
|
|
41
|
+
"RDB-COMMAND-0101": ["idempotency key was reused with different application input", "command", "correct_request", ["correct_input"]],
|
|
42
|
+
"RDB-COMMAND-0102": ["command execution failed", "command", "contact_operator", []],
|
|
43
|
+
"RDB-AUTH-0215": ["application capability is revoked", "authorization", "obtain_permission", ["bind_application_role"]],
|
|
44
|
+
"RDB-PROTOCOL-0101": ["the RiffDB peer returned an invalid application response", "protocol", "contact_operator", []],
|
|
45
|
+
"RDB-HISTORY-0101": ["observed history predates a database restore", "history", "correct_request", ["correct_input"]],
|
|
46
|
+
"RDB-HISTORY-0102": ["requested history has been pruned", "history", "correct_request", ["correct_input"]],
|
|
47
|
+
"RDB-CAPACITY-0101": ["service is over capacity", "capacity", "retry", ["retry_later"]],
|
|
48
|
+
"RDB-PROJECTION-0101": ["query projections cannot prove one common snapshot", "query", "retry", ["retry_later"]],
|
|
49
|
+
"RDB-PROJECTION-0102": ["the requested query snapshot has been retired", "query", "correct_request", ["restart_from_first_page"]],
|
|
50
|
+
"RDB-PROJECTION-0103": ["no query snapshot satisfies the requested freshness", "query", "retry", ["retry_later"]],
|
|
51
|
+
"RDB-PROJECTION-0104": ["nearest query requires a compiler-owned projected source", "query", "refresh_contract", ["pin_active_module"]],
|
|
52
|
+
"RDB-REP-0101": ["operation is unavailable in follower mode", "control", "correct_request", []],
|
|
53
|
+
"RDB-REP-0102": ["primary is durably fenced", "control", "contact_operator", []],
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
export type ApplicationErrorCode = keyof typeof APPLICATION_ERROR_REGISTRY;
|
|
57
|
+
export type ApplicationOperation = "DescribeContract" | "CheckQuery" | "ExplainQuery" | "ExecuteQuery" | "DeployQueryModule" | "GetQueryModule" | "ExecuteCommand" | "BatchCommand" | "InspectVectorState";
|
|
58
|
+
export type ApplicationErrorCategory = typeof APPLICATION_ERROR_REGISTRY[ApplicationErrorCode][1];
|
|
59
|
+
export type ApplicationRecoveryAction = typeof APPLICATION_ERROR_REGISTRY[ApplicationErrorCode][2];
|
|
60
|
+
export type ApplicationFixCode = typeof APPLICATION_ERROR_REGISTRY[ApplicationErrorCode][3][number];
|
|
61
|
+
|
|
62
|
+
export interface ApplicationErrorDetails {
|
|
63
|
+
readonly type: "application";
|
|
64
|
+
readonly code: ApplicationErrorCode;
|
|
65
|
+
readonly message: string;
|
|
66
|
+
readonly category: ApplicationErrorCategory;
|
|
67
|
+
readonly recoveryAction: ApplicationRecoveryAction;
|
|
68
|
+
readonly operation: ApplicationOperation;
|
|
69
|
+
readonly contractLineage?: string;
|
|
70
|
+
readonly contractVersion?: number;
|
|
71
|
+
readonly operationSymbol?: string;
|
|
72
|
+
readonly symbolPath: ReadonlyArray<string>;
|
|
73
|
+
readonly sourceSpan?: { readonly start: number; readonly end: number };
|
|
74
|
+
readonly fixes: ReadonlyArray<ApplicationFixCode>;
|
|
75
|
+
readonly traceId?: string;
|
|
76
|
+
readonly incidentId?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export class RiffDbApplicationError extends Error {
|
|
80
|
+
public override readonly name = "RiffDbApplicationError";
|
|
81
|
+
public constructor(public readonly details: ApplicationErrorDetails) {
|
|
82
|
+
super(`${details.code}: ${details.message} [${details.operation}]`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const APPLICATION_OPERATIONS: ReadonlySet<string> = new Set([
|
|
87
|
+
"DescribeContract", "CheckQuery", "ExplainQuery", "ExecuteQuery",
|
|
88
|
+
"DeployQueryModule", "GetQueryModule", "ExecuteCommand", "BatchCommand", "InspectVectorState",
|
|
89
|
+
]);
|
|
90
|
+
const SAFE_SYMBOL = /^[A-Za-z0-9_.-]{1,256}$/;
|
|
91
|
+
const UUID_V7 = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
92
|
+
|
|
93
|
+
export function decodeApplicationError(value: unknown): RiffDbApplicationError {
|
|
94
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("invalid RiffDB application error");
|
|
95
|
+
const input = value as Record<string, unknown>;
|
|
96
|
+
const code = input.code;
|
|
97
|
+
if (typeof code !== "string" || !(code in APPLICATION_ERROR_REGISTRY)) throw new Error("invalid RiffDB application error");
|
|
98
|
+
const rule = APPLICATION_ERROR_REGISTRY[code as ApplicationErrorCode];
|
|
99
|
+
if (input.type !== "application" || input.message !== rule[0] || input.category !== rule[1]
|
|
100
|
+
|| input.recoveryAction !== rule[2] || typeof input.operation !== "string"
|
|
101
|
+
|| !APPLICATION_OPERATIONS.has(input.operation)) throw new Error("invalid RiffDB application error");
|
|
102
|
+
if (!Array.isArray(input.fixes) || input.fixes.length !== rule[3].length
|
|
103
|
+
|| input.fixes.some((fix, index) => fix !== rule[3][index])) throw new Error("invalid RiffDB application error");
|
|
104
|
+
const symbolPath = input.symbolPath;
|
|
105
|
+
if (!Array.isArray(symbolPath) || symbolPath.length > 16
|
|
106
|
+
|| symbolPath.some((symbol) => typeof symbol !== "string" || !SAFE_SYMBOL.test(symbol))) throw new Error("invalid RiffDB application error");
|
|
107
|
+
for (const key of ["contractLineage", "operationSymbol"] as const) {
|
|
108
|
+
if (input[key] !== undefined && (typeof input[key] !== "string" || !SAFE_SYMBOL.test(input[key]))) throw new Error("invalid RiffDB application error");
|
|
109
|
+
}
|
|
110
|
+
if ((input.contractLineage === undefined) !== (input.contractVersion === undefined)
|
|
111
|
+
|| (input.contractVersion !== undefined && (!Number.isSafeInteger(input.contractVersion) || (input.contractVersion as number) < 1))) throw new Error("invalid RiffDB application error");
|
|
112
|
+
if (input.sourceSpan !== undefined) {
|
|
113
|
+
const span = input.sourceSpan as Record<string, unknown>;
|
|
114
|
+
if (typeof span !== "object" || span === null || !Number.isSafeInteger(span.start)
|
|
115
|
+
|| !Number.isSafeInteger(span.end) || (span.start as number) < 0
|
|
116
|
+
|| (span.start as number) > (span.end as number) || (span.end as number) > 262144) throw new Error("invalid RiffDB application error");
|
|
117
|
+
}
|
|
118
|
+
for (const key of ["traceId", "incidentId"] as const) {
|
|
119
|
+
if (input[key] !== undefined && (typeof input[key] !== "string" || !UUID_V7.test(input[key]))) throw new Error("invalid RiffDB application error");
|
|
120
|
+
}
|
|
121
|
+
return new RiffDbApplicationError({
|
|
122
|
+
type: "application", code: code as ApplicationErrorCode, message: rule[0],
|
|
123
|
+
category: rule[1], recoveryAction: rule[2], operation: input.operation as ApplicationOperation,
|
|
124
|
+
symbolPath: symbolPath as ReadonlyArray<string>,
|
|
125
|
+
fixes: rule[3],
|
|
126
|
+
...(input.contractLineage === undefined ? {} : { contractLineage: input.contractLineage as string }),
|
|
127
|
+
...(input.contractVersion === undefined ? {} : { contractVersion: input.contractVersion as number }),
|
|
128
|
+
...(input.operationSymbol === undefined ? {} : { operationSymbol: input.operationSymbol as string }),
|
|
129
|
+
...(input.sourceSpan === undefined ? {} : { sourceSpan: input.sourceSpan as { readonly start: number; readonly end: number } }),
|
|
130
|
+
...(input.traceId === undefined ? {} : { traceId: input.traceId as string }),
|
|
131
|
+
...(input.incidentId === undefined ? {} : { incidentId: input.incidentId as string }),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type ApplicationValueSchema =
|
|
136
|
+
| { readonly kind: "bool" | "i64" | "u64" | "string" | "uuid" | "enum" | "bytes" | "date" | "timestamp" | "cursor" }
|
|
137
|
+
| { readonly kind: "limit"; readonly maximum?: number }
|
|
138
|
+
| { readonly kind: "decimal"; readonly precision?: number; readonly scale?: number }
|
|
139
|
+
| { readonly kind: "money"; readonly precision?: number; readonly scale?: number; readonly currency?: string }
|
|
140
|
+
| { readonly kind: "optional"; readonly value: ApplicationValueSchema }
|
|
141
|
+
| { readonly kind: "list"; readonly value: ApplicationValueSchema; readonly minimum?: number; readonly maximum?: number; readonly aggregateCanonicalElementBytes?: number }
|
|
142
|
+
| { readonly kind: "record"; readonly fields: ReadonlyArray<{ readonly name: string; readonly schema: ApplicationValueSchema; readonly wireId?: number }> };
|
|
143
|
+
export interface DriverOperationIdentity { readonly name: string; readonly inputSchemaHash: string; }
|
|
144
|
+
export interface CompactApplicationValue { readonly type: string; readonly value?: unknown; }
|
|
145
|
+
export interface CompactNamedQueryResult { readonly outcome: string; readonly resultName: string; readonly entity: string; readonly fields: ReadonlyArray<string>; readonly rows: ReadonlyArray<ReadonlyArray<CompactApplicationValue>>; }
|
|
146
|
+
export interface NamedQueryRequest<P, R> { readonly driverOperation: DriverOperationIdentity; readonly contractLineage: typeof CONTRACT_LINEAGE; readonly contractVersion: typeof CONTRACT_VERSION; readonly contractBundleHash: typeof CONTRACT_BUNDLE_HASH; readonly moduleHash: typeof QUERY_MODULE_HASH; readonly queryName: string; readonly planHash: string; readonly parameters: P; readonly parameterSchema: ApplicationValueSchema; readonly resultSchemas: Readonly<Record<string, ApplicationValueSchema>>; readonly compactDecoder?: (value: CompactNamedQueryResult) => R; readonly decodeError: typeof decodeApplicationError; readonly resultType?: R; }
|
|
147
|
+
export interface QueryResponseIdentity { readonly contractLineage: string; readonly contractVersion: number; readonly contractBundleHash: string; readonly moduleHash: string; readonly queryName: string; readonly planHash: string; }
|
|
148
|
+
export function acceptsIdentity<P, R>(request: NamedQueryRequest<P, R>, identity: QueryResponseIdentity): boolean {
|
|
149
|
+
return identity.contractLineage === request.contractLineage
|
|
150
|
+
&& identity.contractVersion === request.contractVersion
|
|
151
|
+
&& identity.contractBundleHash === request.contractBundleHash
|
|
152
|
+
&& identity.moduleHash === request.moduleHash
|
|
153
|
+
&& identity.queryName === request.queryName
|
|
154
|
+
&& identity.planHash === request.planHash;
|
|
155
|
+
}
|
|
156
|
+
export interface CommandRequest<I, R> { readonly driverOperation: DriverOperationIdentity; readonly contractLineage: typeof CONTRACT_LINEAGE; readonly contractVersion: typeof CONTRACT_VERSION; readonly commandName: string; readonly planHash: string; readonly input: I; readonly idempotencyKey: string; readonly inputSchema: ApplicationValueSchema; readonly outcomeSchemas: Readonly<Record<string, ApplicationValueSchema>>; readonly decodeError: typeof decodeApplicationError; readonly outcomeType?: R; }
|
|
157
|
+
export interface TypedQueryResult<T> { readonly identity: QueryResponseIdentity; readonly value: T; readonly applicationHead: bigint; readonly nextCursor?: string; }
|
|
158
|
+
export interface WorkflowSuccessorRevision { readonly binding: string; readonly revision: bigint; }
|
|
159
|
+
export interface TypedCommandResult<T> { readonly outcome: T; readonly commitSequence?: bigint; readonly contractVersion: number; readonly planHash: string; readonly replayed: boolean; readonly outcomeUri?: string; readonly workflowRevisions?: ReadonlyArray<WorkflowSuccessorRevision>; }
|
|
160
|
+
export type QueryConsistency = "admissionHead";
|
|
161
|
+
export interface QueryOptions { readonly cursor?: string; readonly readAfterCommit?: bigint; readonly consistency?: QueryConsistency; }
|
|
162
|
+
export interface CommandBatchProgress { readonly completed: number; readonly total: number; readonly checkpoint: number; }
|
|
163
|
+
export const MAX_COMMAND_BATCH_CONCURRENCY = 384;
|
|
164
|
+
export const DEFAULT_COMMAND_ATTEMPT_BUDGET = 3;
|
|
165
|
+
export interface CommandBatchOptions { readonly concurrency: number; readonly checkpoint?: number; readonly onProgress?: (progress: CommandBatchProgress) => void; }
|
|
166
|
+
export interface CommandBatchItem<T> { readonly index: number; readonly result?: TypedCommandResult<T>; readonly error?: unknown; }
|
|
167
|
+
export interface CommandBatchResult<T> { readonly items: ReadonlyArray<CommandBatchItem<T>>; readonly checkpoint: number; }
|
|
168
|
+
export interface ApplicationTransport {
|
|
169
|
+
executeNamedQuery<P, R>(request: NamedQueryRequest<P, R>, options?: QueryOptions): Promise<TypedQueryResult<R>>;
|
|
170
|
+
executeCommand<I, R>(request: CommandRequest<I, R>, attemptBudget: number): Promise<TypedCommandResult<R>>;
|
|
171
|
+
executeCommandBatch?<I, R>(request: CommandRequest<I, R>, inputs: ReadonlyArray<I>, concurrency: number, checkpoint: number, attemptBudget: number): Promise<CommandBatchResult<R>>;
|
|
172
|
+
executeVectorInspection?<P, R>(request: VectorInspectionRequest<P, R>, options?: VectorInspectionOptions): Promise<TypedVectorInspectionResult<R>>;
|
|
173
|
+
}
|
|
174
|
+
export interface VectorInspectionRequest<P, R> { readonly driverOperation: DriverOperationIdentity; readonly contractLineage: typeof CONTRACT_LINEAGE; readonly contractVersion: typeof CONTRACT_VERSION; readonly contractBundleHash: typeof CONTRACT_BUNDLE_HASH; readonly entity: string; readonly field: string; readonly inspectionKind: "staleness" | "model_versions"; readonly partition: P; readonly partitionSchema: ApplicationValueSchema; readonly limit: number; readonly resultType?: R; }
|
|
175
|
+
export interface VectorInspectionOptions { readonly cursor?: string; }
|
|
176
|
+
export interface TypedVectorInspectionResult<T> { readonly value: T; readonly applicationHead?: bigint; readonly nextCursor?: string; }
|
|
177
|
+
export interface VectorStalenessItem { readonly entityKey: Uint8Array; readonly newestSourceWrite: bigint; readonly embeddingWrite: bigint | null; }
|
|
178
|
+
export type VectorStalenessResult = { readonly kind: "staleness_summary"; readonly totalEntities: bigint; readonly staleCount: bigint; readonly staleEntityCountThreshold: bigint; readonly sloBreached: boolean } | { readonly kind: "stale_entities"; readonly items: ReadonlyArray<VectorStalenessItem>; readonly observedFrontier: bigint | null };
|
|
179
|
+
export interface VectorModelVersionItem { readonly entityKey: Uint8Array; readonly model: string; readonly modelVersion: string; readonly embeddingWrite: bigint; }
|
|
180
|
+
export type VectorModelVersionResult = { readonly kind: "model_version_summary"; readonly currentCount: bigint; readonly outdatedCount: bigint } | { readonly kind: "outdated_model_entities"; readonly items: ReadonlyArray<VectorModelVersionItem>; readonly observedFrontier: bigint | null };
|
|
181
|
+
|
|
182
|
+
function compactPayload(value: CompactApplicationValue, expected: string): unknown {
|
|
183
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || value.type !== expected) throw new Error("invalid RiffDB compact value");
|
|
184
|
+
const keys = Object.keys(value);
|
|
185
|
+
if (expected === "null") { if (keys.length !== 1) throw new Error("invalid RiffDB compact value"); return null; }
|
|
186
|
+
if (keys.length !== 2 || !Object.hasOwn(value, "value")) throw new Error("invalid RiffDB compact value");
|
|
187
|
+
return value.value;
|
|
188
|
+
}
|
|
189
|
+
function compactString(value: CompactApplicationValue, expected: string, maximum: number): string {
|
|
190
|
+
const payload = compactPayload(value, expected);
|
|
191
|
+
if (typeof payload !== "string" || new TextEncoder().encode(payload).length > maximum) throw new Error("invalid RiffDB compact value");
|
|
192
|
+
return payload;
|
|
193
|
+
}
|
|
194
|
+
function compactInteger(value: CompactApplicationValue, expected: "i64" | "u64"): bigint {
|
|
195
|
+
const payload = compactPayload(value, expected);
|
|
196
|
+
if (typeof payload !== "string" || !/^-?(?:0|[1-9][0-9]*)$/.test(payload)) throw new Error("invalid RiffDB compact value");
|
|
197
|
+
const parsed = BigInt(payload);
|
|
198
|
+
if ((expected === "i64" && (parsed < -9223372036854775808n || parsed > 9223372036854775807n))
|
|
199
|
+
|| (expected === "u64" && (parsed < 0n || parsed > 18446744073709551615n))) throw new Error("invalid RiffDB compact value");
|
|
200
|
+
return parsed;
|
|
201
|
+
}
|
|
202
|
+
function compactTimestamp(value: CompactApplicationValue): { readonly seconds: bigint; readonly nanos: number } {
|
|
203
|
+
const payload = compactPayload(value, "timestamp");
|
|
204
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) throw new Error("invalid RiffDB compact value");
|
|
205
|
+
const record = payload as Record<string, unknown>;
|
|
206
|
+
if (Object.keys(record).length !== 2 || typeof record.seconds !== "string" || !/^-?(?:0|[1-9][0-9]*)$/.test(record.seconds)
|
|
207
|
+
|| !Number.isInteger(record.nanos) || (record.nanos as number) < 0 || (record.nanos as number) >= 1_000_000_000) throw new Error("invalid RiffDB compact value");
|
|
208
|
+
const seconds = BigInt(record.seconds);
|
|
209
|
+
if (seconds < -9223372036854775808n || seconds > 9223372036854775807n) throw new Error("invalid RiffDB compact value");
|
|
210
|
+
return { seconds, nanos: record.nanos as number };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export const ADMIN_USERS_ALL_EMAIL_ASC_QUERY_PLAN_HASH = "0d5b12685395e42e8de3b58bb525dbe2f9157267cd3254a93852dd75fef9b2ba" as const;
|
|
214
|
+
export interface AdminUsersAllEmailAscParams {
|
|
215
|
+
readonly organization_id: string;
|
|
216
|
+
readonly minimum_email: string;
|
|
217
|
+
readonly user_id?: string | null;
|
|
218
|
+
readonly limit?: number;
|
|
219
|
+
readonly offset?: bigint;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface AdminUsersAllEmailAscFound {
|
|
223
|
+
readonly outcome: "Found";
|
|
224
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
225
|
+
readonly total: { readonly value: bigint };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type AdminUsersAllEmailAscResult = AdminUsersAllEmailAscFound;
|
|
229
|
+
|
|
230
|
+
export function isAdminUsersAllEmailAscFound(value: AdminUsersAllEmailAscResult): value is AdminUsersAllEmailAscFound {
|
|
231
|
+
return value.outcome === "Found";
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function unwrapAdminUsersAllEmailAscFound(value: AdminUsersAllEmailAscResult | TypedQueryResult<AdminUsersAllEmailAscResult>): AdminUsersAllEmailAscFound {
|
|
235
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersAllEmailAscResult;
|
|
236
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersAllEmailAsc outcome "Found", got "${resolved.outcome}"`);
|
|
237
|
+
return resolved;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function adminUsersAllEmailAsc(parameters: AdminUsersAllEmailAscParams): NamedQueryRequest<AdminUsersAllEmailAscParams, AdminUsersAllEmailAscResult> {
|
|
241
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
242
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_all_email_asc", inputSchemaHash: "6f126f498c06a6648d15a6403e27e29890892d64f010ef3d89b3470124ebdd5f" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersAllEmailAsc", planHash: ADMIN_USERS_ALL_EMAIL_ASC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"minimum_email","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const ADMIN_USERS_CONTAINS_ASC_QUERY_PLAN_HASH = "150dff76943515597746d05865d4605467289e475d376afd7fcb6a32a34b45b7" as const;
|
|
246
|
+
export interface AdminUsersContainsAscParams {
|
|
247
|
+
readonly organization_id: string;
|
|
248
|
+
readonly needle: string;
|
|
249
|
+
readonly user_id?: string | null;
|
|
250
|
+
readonly limit?: number;
|
|
251
|
+
readonly offset?: bigint;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface AdminUsersContainsAscFound {
|
|
255
|
+
readonly outcome: "Found";
|
|
256
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
257
|
+
readonly total: { readonly value: bigint };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type AdminUsersContainsAscResult = AdminUsersContainsAscFound;
|
|
261
|
+
|
|
262
|
+
export function isAdminUsersContainsAscFound(value: AdminUsersContainsAscResult): value is AdminUsersContainsAscFound {
|
|
263
|
+
return value.outcome === "Found";
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function unwrapAdminUsersContainsAscFound(value: AdminUsersContainsAscResult | TypedQueryResult<AdminUsersContainsAscResult>): AdminUsersContainsAscFound {
|
|
267
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersContainsAscResult;
|
|
268
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersContainsAsc outcome "Found", got "${resolved.outcome}"`);
|
|
269
|
+
return resolved;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function adminUsersContainsAsc(parameters: AdminUsersContainsAscParams): NamedQueryRequest<AdminUsersContainsAscParams, AdminUsersContainsAscResult> {
|
|
273
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
274
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_contains_asc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersContainsAsc", planHash: ADMIN_USERS_CONTAINS_ASC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export const ADMIN_USERS_CONTAINS_DESC_QUERY_PLAN_HASH = "d6a8b309f821e178f50e3ce1fdac11c6167187badbe65f3d110ce2fbb2730a6a" as const;
|
|
278
|
+
export interface AdminUsersContainsDescParams {
|
|
279
|
+
readonly organization_id: string;
|
|
280
|
+
readonly needle: string;
|
|
281
|
+
readonly user_id?: string | null;
|
|
282
|
+
readonly limit?: number;
|
|
283
|
+
readonly offset?: bigint;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface AdminUsersContainsDescFound {
|
|
287
|
+
readonly outcome: "Found";
|
|
288
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
289
|
+
readonly total: { readonly value: bigint };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export type AdminUsersContainsDescResult = AdminUsersContainsDescFound;
|
|
293
|
+
|
|
294
|
+
export function isAdminUsersContainsDescFound(value: AdminUsersContainsDescResult): value is AdminUsersContainsDescFound {
|
|
295
|
+
return value.outcome === "Found";
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function unwrapAdminUsersContainsDescFound(value: AdminUsersContainsDescResult | TypedQueryResult<AdminUsersContainsDescResult>): AdminUsersContainsDescFound {
|
|
299
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersContainsDescResult;
|
|
300
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersContainsDesc outcome "Found", got "${resolved.outcome}"`);
|
|
301
|
+
return resolved;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function adminUsersContainsDesc(parameters: AdminUsersContainsDescParams): NamedQueryRequest<AdminUsersContainsDescParams, AdminUsersContainsDescResult> {
|
|
305
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
306
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_contains_desc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersContainsDesc", planHash: ADMIN_USERS_CONTAINS_DESC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export const ADMIN_USERS_EMAIL_CONTAINS_CREATED_DESC_QUERY_PLAN_HASH = "56699d8bbc9991cf37ef1ea450e33fc4c73c2c4ed1c4d4d403b8ca07a1f891d0" as const;
|
|
310
|
+
export interface AdminUsersEmailContainsCreatedDescParams {
|
|
311
|
+
readonly organization_id: string;
|
|
312
|
+
readonly needle: string;
|
|
313
|
+
readonly user_id?: string | null;
|
|
314
|
+
readonly limit?: number;
|
|
315
|
+
readonly offset?: bigint;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface AdminUsersEmailContainsCreatedDescFound {
|
|
319
|
+
readonly outcome: "Found";
|
|
320
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
321
|
+
readonly total: { readonly value: bigint };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export type AdminUsersEmailContainsCreatedDescResult = AdminUsersEmailContainsCreatedDescFound;
|
|
325
|
+
|
|
326
|
+
export function isAdminUsersEmailContainsCreatedDescFound(value: AdminUsersEmailContainsCreatedDescResult): value is AdminUsersEmailContainsCreatedDescFound {
|
|
327
|
+
return value.outcome === "Found";
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export function unwrapAdminUsersEmailContainsCreatedDescFound(value: AdminUsersEmailContainsCreatedDescResult | TypedQueryResult<AdminUsersEmailContainsCreatedDescResult>): AdminUsersEmailContainsCreatedDescFound {
|
|
331
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersEmailContainsCreatedDescResult;
|
|
332
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersEmailContainsCreatedDesc outcome "Found", got "${resolved.outcome}"`);
|
|
333
|
+
return resolved;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export function adminUsersEmailContainsCreatedDesc(parameters: AdminUsersEmailContainsCreatedDescParams): NamedQueryRequest<AdminUsersEmailContainsCreatedDescParams, AdminUsersEmailContainsCreatedDescResult> {
|
|
337
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
338
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_email_contains_created_desc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersEmailContainsCreatedDesc", planHash: ADMIN_USERS_EMAIL_CONTAINS_CREATED_DESC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export const ADMIN_USERS_EMAIL_CONTAINS_IMAGE_ASC_QUERY_PLAN_HASH = "54f861d04e1ca2b3cfde740a098c7577588223a2552c733fb6c9c27e570d32c8" as const;
|
|
342
|
+
export interface AdminUsersEmailContainsImageAscParams {
|
|
343
|
+
readonly organization_id: string;
|
|
344
|
+
readonly needle: string;
|
|
345
|
+
readonly user_id?: string | null;
|
|
346
|
+
readonly limit?: number;
|
|
347
|
+
readonly offset?: bigint;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface AdminUsersEmailContainsImageAscFound {
|
|
351
|
+
readonly outcome: "Found";
|
|
352
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
353
|
+
readonly total: { readonly value: bigint };
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export type AdminUsersEmailContainsImageAscResult = AdminUsersEmailContainsImageAscFound;
|
|
357
|
+
|
|
358
|
+
export function isAdminUsersEmailContainsImageAscFound(value: AdminUsersEmailContainsImageAscResult): value is AdminUsersEmailContainsImageAscFound {
|
|
359
|
+
return value.outcome === "Found";
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function unwrapAdminUsersEmailContainsImageAscFound(value: AdminUsersEmailContainsImageAscResult | TypedQueryResult<AdminUsersEmailContainsImageAscResult>): AdminUsersEmailContainsImageAscFound {
|
|
363
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersEmailContainsImageAscResult;
|
|
364
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersEmailContainsImageAsc outcome "Found", got "${resolved.outcome}"`);
|
|
365
|
+
return resolved;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export function adminUsersEmailContainsImageAsc(parameters: AdminUsersEmailContainsImageAscParams): NamedQueryRequest<AdminUsersEmailContainsImageAscParams, AdminUsersEmailContainsImageAscResult> {
|
|
369
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
370
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_email_contains_image_asc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersEmailContainsImageAsc", planHash: ADMIN_USERS_EMAIL_CONTAINS_IMAGE_ASC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export const ADMIN_USERS_ENDS_WITH_ASC_QUERY_PLAN_HASH = "a0261b356443918721db89ae6f6533b8a2046fbc8c7ad7273fcceffd18a20b82" as const;
|
|
374
|
+
export interface AdminUsersEndsWithAscParams {
|
|
375
|
+
readonly organization_id: string;
|
|
376
|
+
readonly needle: string;
|
|
377
|
+
readonly user_id?: string | null;
|
|
378
|
+
readonly limit?: number;
|
|
379
|
+
readonly offset?: bigint;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface AdminUsersEndsWithAscFound {
|
|
383
|
+
readonly outcome: "Found";
|
|
384
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
385
|
+
readonly total: { readonly value: bigint };
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export type AdminUsersEndsWithAscResult = AdminUsersEndsWithAscFound;
|
|
389
|
+
|
|
390
|
+
export function isAdminUsersEndsWithAscFound(value: AdminUsersEndsWithAscResult): value is AdminUsersEndsWithAscFound {
|
|
391
|
+
return value.outcome === "Found";
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export function unwrapAdminUsersEndsWithAscFound(value: AdminUsersEndsWithAscResult | TypedQueryResult<AdminUsersEndsWithAscResult>): AdminUsersEndsWithAscFound {
|
|
395
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersEndsWithAscResult;
|
|
396
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersEndsWithAsc outcome "Found", got "${resolved.outcome}"`);
|
|
397
|
+
return resolved;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export function adminUsersEndsWithAsc(parameters: AdminUsersEndsWithAscParams): NamedQueryRequest<AdminUsersEndsWithAscParams, AdminUsersEndsWithAscResult> {
|
|
401
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
402
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_ends_with_asc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersEndsWithAsc", planHash: ADMIN_USERS_ENDS_WITH_ASC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export const ADMIN_USERS_ENDS_WITH_DESC_QUERY_PLAN_HASH = "df4ffbf8934efe3a10cc98afb8cda7da0fb828b0a9e6981181340184b9be30d9" as const;
|
|
406
|
+
export interface AdminUsersEndsWithDescParams {
|
|
407
|
+
readonly organization_id: string;
|
|
408
|
+
readonly needle: string;
|
|
409
|
+
readonly user_id?: string | null;
|
|
410
|
+
readonly limit?: number;
|
|
411
|
+
readonly offset?: bigint;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface AdminUsersEndsWithDescFound {
|
|
415
|
+
readonly outcome: "Found";
|
|
416
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
417
|
+
readonly total: { readonly value: bigint };
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export type AdminUsersEndsWithDescResult = AdminUsersEndsWithDescFound;
|
|
421
|
+
|
|
422
|
+
export function isAdminUsersEndsWithDescFound(value: AdminUsersEndsWithDescResult): value is AdminUsersEndsWithDescFound {
|
|
423
|
+
return value.outcome === "Found";
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export function unwrapAdminUsersEndsWithDescFound(value: AdminUsersEndsWithDescResult | TypedQueryResult<AdminUsersEndsWithDescResult>): AdminUsersEndsWithDescFound {
|
|
427
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersEndsWithDescResult;
|
|
428
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersEndsWithDesc outcome "Found", got "${resolved.outcome}"`);
|
|
429
|
+
return resolved;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export function adminUsersEndsWithDesc(parameters: AdminUsersEndsWithDescParams): NamedQueryRequest<AdminUsersEndsWithDescParams, AdminUsersEndsWithDescResult> {
|
|
433
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
434
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_ends_with_desc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersEndsWithDesc", planHash: ADMIN_USERS_ENDS_WITH_DESC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export const ADMIN_USERS_STARTS_WITH_ASC_QUERY_PLAN_HASH = "dfaf7f619cde891bfc2254a1ad8523732904fc99cda955d76e1b3192d721c96e" as const;
|
|
438
|
+
export interface AdminUsersStartsWithAscParams {
|
|
439
|
+
readonly organization_id: string;
|
|
440
|
+
readonly needle: string;
|
|
441
|
+
readonly user_id?: string | null;
|
|
442
|
+
readonly limit?: number;
|
|
443
|
+
readonly offset?: bigint;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface AdminUsersStartsWithAscFound {
|
|
447
|
+
readonly outcome: "Found";
|
|
448
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
449
|
+
readonly total: { readonly value: bigint };
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export type AdminUsersStartsWithAscResult = AdminUsersStartsWithAscFound;
|
|
453
|
+
|
|
454
|
+
export function isAdminUsersStartsWithAscFound(value: AdminUsersStartsWithAscResult): value is AdminUsersStartsWithAscFound {
|
|
455
|
+
return value.outcome === "Found";
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export function unwrapAdminUsersStartsWithAscFound(value: AdminUsersStartsWithAscResult | TypedQueryResult<AdminUsersStartsWithAscResult>): AdminUsersStartsWithAscFound {
|
|
459
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersStartsWithAscResult;
|
|
460
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersStartsWithAsc outcome "Found", got "${resolved.outcome}"`);
|
|
461
|
+
return resolved;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function adminUsersStartsWithAsc(parameters: AdminUsersStartsWithAscParams): NamedQueryRequest<AdminUsersStartsWithAscParams, AdminUsersStartsWithAscResult> {
|
|
465
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
466
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_starts_with_asc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersStartsWithAsc", planHash: ADMIN_USERS_STARTS_WITH_ASC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export const ADMIN_USERS_STARTS_WITH_DESC_QUERY_PLAN_HASH = "263f8501ee5dc05a60506cbd91e7ddeebc665caaef4fcad8b3d4538f9745d29f" as const;
|
|
470
|
+
export interface AdminUsersStartsWithDescParams {
|
|
471
|
+
readonly organization_id: string;
|
|
472
|
+
readonly needle: string;
|
|
473
|
+
readonly user_id?: string | null;
|
|
474
|
+
readonly limit?: number;
|
|
475
|
+
readonly offset?: bigint;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface AdminUsersStartsWithDescFound {
|
|
479
|
+
readonly outcome: "Found";
|
|
480
|
+
readonly users: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
481
|
+
readonly total: { readonly value: bigint };
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export type AdminUsersStartsWithDescResult = AdminUsersStartsWithDescFound;
|
|
485
|
+
|
|
486
|
+
export function isAdminUsersStartsWithDescFound(value: AdminUsersStartsWithDescResult): value is AdminUsersStartsWithDescFound {
|
|
487
|
+
return value.outcome === "Found";
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export function unwrapAdminUsersStartsWithDescFound(value: AdminUsersStartsWithDescResult | TypedQueryResult<AdminUsersStartsWithDescResult>): AdminUsersStartsWithDescFound {
|
|
491
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as AdminUsersStartsWithDescResult;
|
|
492
|
+
if (resolved.outcome !== "Found") throw new Error(`expected AdminUsersStartsWithDesc outcome "Found", got "${resolved.outcome}"`);
|
|
493
|
+
return resolved;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export function adminUsersStartsWithDesc(parameters: AdminUsersStartsWithDescParams): NamedQueryRequest<AdminUsersStartsWithDescParams, AdminUsersStartsWithDescResult> {
|
|
497
|
+
if (parameters.limit !== undefined && (!Number.isSafeInteger(parameters.limit) || parameters.limit < 1 || parameters.limit > 100)) throw new RangeError("limit must be an integer from 1 through 100");
|
|
498
|
+
return { driverOperation: { name: "riffdb_better_auth_core_admin_users_starts_with_desc", inputSchemaHash: "9ffe6e4d932b3572aefb9d58255932828b4b85445b0312722b3c8be772bdd11b" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "AdminUsersStartsWithDesc", planHash: ADMIN_USERS_STARTS_WITH_DESC_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"needle","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"optional","value":{"kind":"uuid"}}},{"name":"limit","schema":{"kind":"limit","maximum":100}},{"name":"offset","schema":{"kind":"u64"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"total","schema":{"fields":[{"name":"value","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export const FIND_ACCOUNT_BY_ID_QUERY_PLAN_HASH = "5f4c19b342e9e5fb133ba311dcf43e5a45aab2a92ad4c0237df58788f8163fa1" as const;
|
|
502
|
+
export const FIND_ACCOUNT_BY_ID_SECRET_OUTPUTS = [
|
|
503
|
+
{ query: "FindAccountById", entity: "Account", field: "access_token" },
|
|
504
|
+
{ query: "FindAccountById", entity: "Account", field: "refresh_token" },
|
|
505
|
+
{ query: "FindAccountById", entity: "Account", field: "id_token" },
|
|
506
|
+
{ query: "FindAccountById", entity: "Account", field: "password" },
|
|
507
|
+
] as const;
|
|
508
|
+
export interface FindAccountByIdParams {
|
|
509
|
+
readonly organization_id: string;
|
|
510
|
+
readonly id: string;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export interface FindAccountByIdFound {
|
|
514
|
+
readonly outcome: "Found";
|
|
515
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export type FindAccountByIdResult = FindAccountByIdFound;
|
|
519
|
+
|
|
520
|
+
export function isFindAccountByIdFound(value: FindAccountByIdResult): value is FindAccountByIdFound {
|
|
521
|
+
return value.outcome === "Found";
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
export function unwrapFindAccountByIdFound(value: FindAccountByIdResult | TypedQueryResult<FindAccountByIdResult>): FindAccountByIdFound {
|
|
525
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindAccountByIdResult;
|
|
526
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindAccountById outcome "Found", got "${resolved.outcome}"`);
|
|
527
|
+
return resolved;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export function redactFindAccountByIdResult(value: FindAccountByIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_ACCOUNT_BY_ID_SECRET_OUTPUTS } {
|
|
531
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_ACCOUNT_BY_ID_SECRET_OUTPUTS };
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export function findAccountById(parameters: FindAccountByIdParams): NamedQueryRequest<FindAccountByIdParams, FindAccountByIdResult> {
|
|
535
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_account_by_id", inputSchemaHash: "a8efd0b9fe4e36f92ca57a7c5351df748b4c2adbd0e363e2a5ffb66ff4d23bdc" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindAccountById", planHash: FIND_ACCOUNT_BY_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"id","schema":{"kind":"uuid"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"accounts","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export const FIND_ACCOUNT_BY_PROVIDER_QUERY_PLAN_HASH = "4e2ff9c33d5520ebe850da58f3271e47beaaab4c9a092c325dc9a02b058421ab" as const;
|
|
539
|
+
export const FIND_ACCOUNT_BY_PROVIDER_SECRET_OUTPUTS = [
|
|
540
|
+
{ query: "FindAccountByProvider", entity: "Account", field: "access_token" },
|
|
541
|
+
{ query: "FindAccountByProvider", entity: "Account", field: "refresh_token" },
|
|
542
|
+
{ query: "FindAccountByProvider", entity: "Account", field: "id_token" },
|
|
543
|
+
{ query: "FindAccountByProvider", entity: "Account", field: "password" },
|
|
544
|
+
] as const;
|
|
545
|
+
export interface FindAccountByProviderParams {
|
|
546
|
+
readonly organization_id: string;
|
|
547
|
+
readonly account_id: string;
|
|
548
|
+
readonly provider_id: string;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export interface FindAccountByProviderFound {
|
|
552
|
+
readonly outcome: "Found";
|
|
553
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export type FindAccountByProviderResult = FindAccountByProviderFound;
|
|
557
|
+
|
|
558
|
+
export function isFindAccountByProviderFound(value: FindAccountByProviderResult): value is FindAccountByProviderFound {
|
|
559
|
+
return value.outcome === "Found";
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export function unwrapFindAccountByProviderFound(value: FindAccountByProviderResult | TypedQueryResult<FindAccountByProviderResult>): FindAccountByProviderFound {
|
|
563
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindAccountByProviderResult;
|
|
564
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindAccountByProvider outcome "Found", got "${resolved.outcome}"`);
|
|
565
|
+
return resolved;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export function redactFindAccountByProviderResult(value: FindAccountByProviderResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_ACCOUNT_BY_PROVIDER_SECRET_OUTPUTS } {
|
|
569
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_ACCOUNT_BY_PROVIDER_SECRET_OUTPUTS };
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export function findAccountByProvider(parameters: FindAccountByProviderParams): NamedQueryRequest<FindAccountByProviderParams, FindAccountByProviderResult> {
|
|
573
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_account_by_provider", inputSchemaHash: "7e48e77594d132efa4753eee93934c2ef61f6d82313edff8f7c84c7d8d4112f2" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindAccountByProvider", planHash: FIND_ACCOUNT_BY_PROVIDER_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"accounts","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export const FIND_ACCOUNTS_BY_USER_ID_QUERY_PLAN_HASH = "08aa6eeb45b87599fb8d223eff9f0cde744f16c1b2bcea0aa5fb230b9a7fd11a" as const;
|
|
577
|
+
export const FIND_ACCOUNTS_BY_USER_ID_SECRET_OUTPUTS = [
|
|
578
|
+
{ query: "FindAccountsByUserId", entity: "Account", field: "access_token" },
|
|
579
|
+
{ query: "FindAccountsByUserId", entity: "Account", field: "refresh_token" },
|
|
580
|
+
{ query: "FindAccountsByUserId", entity: "Account", field: "id_token" },
|
|
581
|
+
{ query: "FindAccountsByUserId", entity: "Account", field: "password" },
|
|
582
|
+
] as const;
|
|
583
|
+
export interface FindAccountsByUserIdParams {
|
|
584
|
+
readonly organization_id: string;
|
|
585
|
+
readonly user_id: string;
|
|
586
|
+
readonly after?: string | null;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export interface FindAccountsByUserIdFound {
|
|
590
|
+
readonly outcome: "Found";
|
|
591
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export type FindAccountsByUserIdResult = FindAccountsByUserIdFound;
|
|
595
|
+
|
|
596
|
+
export function isFindAccountsByUserIdFound(value: FindAccountsByUserIdResult): value is FindAccountsByUserIdFound {
|
|
597
|
+
return value.outcome === "Found";
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export function unwrapFindAccountsByUserIdFound(value: FindAccountsByUserIdResult | TypedQueryResult<FindAccountsByUserIdResult>): FindAccountsByUserIdFound {
|
|
601
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindAccountsByUserIdResult;
|
|
602
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindAccountsByUserId outcome "Found", got "${resolved.outcome}"`);
|
|
603
|
+
return resolved;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export function redactFindAccountsByUserIdResult(value: FindAccountsByUserIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_ACCOUNTS_BY_USER_ID_SECRET_OUTPUTS } {
|
|
607
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_ACCOUNTS_BY_USER_ID_SECRET_OUTPUTS };
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export function findAccountsByUserId(parameters: FindAccountsByUserIdParams): NamedQueryRequest<FindAccountsByUserIdParams, FindAccountsByUserIdResult> {
|
|
611
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_accounts_by_user_id", inputSchemaHash: "52291caa82b70870673211137e93f3ecda460cbe7b9fc465f0b9d7f30df05798" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindAccountsByUserId", planHash: FIND_ACCOUNTS_BY_USER_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"after","schema":{"kind":"optional","value":{"kind":"cursor"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"accounts","schema":{"kind":"list","maximum":100,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export const FIND_ACCOUNTS_BY_USER_PROVIDER_QUERY_PLAN_HASH = "c2347f53814225ee99b6372ac2aac1477789eeedad57c22bbac03d429d1ded7e" as const;
|
|
615
|
+
export const FIND_ACCOUNTS_BY_USER_PROVIDER_SECRET_OUTPUTS = [
|
|
616
|
+
{ query: "FindAccountsByUserProvider", entity: "Account", field: "access_token" },
|
|
617
|
+
{ query: "FindAccountsByUserProvider", entity: "Account", field: "refresh_token" },
|
|
618
|
+
{ query: "FindAccountsByUserProvider", entity: "Account", field: "id_token" },
|
|
619
|
+
{ query: "FindAccountsByUserProvider", entity: "Account", field: "password" },
|
|
620
|
+
] as const;
|
|
621
|
+
export interface FindAccountsByUserProviderParams {
|
|
622
|
+
readonly organization_id: string;
|
|
623
|
+
readonly user_id: string;
|
|
624
|
+
readonly provider_id: string;
|
|
625
|
+
readonly after?: string | null;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
export interface FindAccountsByUserProviderFound {
|
|
629
|
+
readonly outcome: "Found";
|
|
630
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export type FindAccountsByUserProviderResult = FindAccountsByUserProviderFound;
|
|
634
|
+
|
|
635
|
+
export function isFindAccountsByUserProviderFound(value: FindAccountsByUserProviderResult): value is FindAccountsByUserProviderFound {
|
|
636
|
+
return value.outcome === "Found";
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export function unwrapFindAccountsByUserProviderFound(value: FindAccountsByUserProviderResult | TypedQueryResult<FindAccountsByUserProviderResult>): FindAccountsByUserProviderFound {
|
|
640
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindAccountsByUserProviderResult;
|
|
641
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindAccountsByUserProvider outcome "Found", got "${resolved.outcome}"`);
|
|
642
|
+
return resolved;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export function redactFindAccountsByUserProviderResult(value: FindAccountsByUserProviderResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_ACCOUNTS_BY_USER_PROVIDER_SECRET_OUTPUTS } {
|
|
646
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_ACCOUNTS_BY_USER_PROVIDER_SECRET_OUTPUTS };
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export function findAccountsByUserProvider(parameters: FindAccountsByUserProviderParams): NamedQueryRequest<FindAccountsByUserProviderParams, FindAccountsByUserProviderResult> {
|
|
650
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_accounts_by_user_provider", inputSchemaHash: "f389d8fa7caa4fcb96e1004158f88ce43ae9bccac48b8bf74087eab48c022df7" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindAccountsByUserProvider", planHash: FIND_ACCOUNTS_BY_USER_PROVIDER_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"after","schema":{"kind":"optional","value":{"kind":"cursor"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"accounts","schema":{"kind":"list","maximum":8,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export const FIND_ACTIVE_SESSIONS_BY_USER_ID_QUERY_PLAN_HASH = "aa2b20ce2a15fda750edf852e82f3a1f656290b76e30db733330592eba706566" as const;
|
|
654
|
+
export const FIND_ACTIVE_SESSIONS_BY_USER_ID_SECRET_OUTPUTS = [
|
|
655
|
+
{ query: "FindActiveSessionsByUserId", entity: "Session", field: "token" },
|
|
656
|
+
] as const;
|
|
657
|
+
export interface FindActiveSessionsByUserIdParams {
|
|
658
|
+
readonly organization_id: string;
|
|
659
|
+
readonly user_id: string;
|
|
660
|
+
readonly expires_after: { readonly seconds: bigint; readonly nanos: number };
|
|
661
|
+
readonly after?: string | null;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export interface FindActiveSessionsByUserIdFound {
|
|
665
|
+
readonly outcome: "Found";
|
|
666
|
+
readonly sessions: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export type FindActiveSessionsByUserIdResult = FindActiveSessionsByUserIdFound;
|
|
670
|
+
|
|
671
|
+
export function isFindActiveSessionsByUserIdFound(value: FindActiveSessionsByUserIdResult): value is FindActiveSessionsByUserIdFound {
|
|
672
|
+
return value.outcome === "Found";
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
export function unwrapFindActiveSessionsByUserIdFound(value: FindActiveSessionsByUserIdResult | TypedQueryResult<FindActiveSessionsByUserIdResult>): FindActiveSessionsByUserIdFound {
|
|
676
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindActiveSessionsByUserIdResult;
|
|
677
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindActiveSessionsByUserId outcome "Found", got "${resolved.outcome}"`);
|
|
678
|
+
return resolved;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export function redactFindActiveSessionsByUserIdResult(value: FindActiveSessionsByUserIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_ACTIVE_SESSIONS_BY_USER_ID_SECRET_OUTPUTS } {
|
|
682
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_ACTIVE_SESSIONS_BY_USER_ID_SECRET_OUTPUTS };
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export function findActiveSessionsByUserId(parameters: FindActiveSessionsByUserIdParams): NamedQueryRequest<FindActiveSessionsByUserIdParams, FindActiveSessionsByUserIdResult> {
|
|
686
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_active_sessions_by_user_id", inputSchemaHash: "56f77f3deba14d9fd74810cf14012109ddc4ba2f58c27a400a180df31ee38feb" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindActiveSessionsByUserId", planHash: FIND_ACTIVE_SESSIONS_BY_USER_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"expires_after","schema":{"kind":"timestamp"}},{"name":"after","schema":{"kind":"optional","value":{"kind":"cursor"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"sessions","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export const FIND_CREDENTIAL_ACCOUNT_QUERY_PLAN_HASH = "f526e9bd2e7b8e054da0039fc5f2b3dce0c042fc362e19ce4003832644136a00" as const;
|
|
690
|
+
export const FIND_CREDENTIAL_ACCOUNT_SECRET_OUTPUTS = [
|
|
691
|
+
{ query: "FindCredentialAccount", entity: "Account", field: "access_token" },
|
|
692
|
+
{ query: "FindCredentialAccount", entity: "Account", field: "refresh_token" },
|
|
693
|
+
{ query: "FindCredentialAccount", entity: "Account", field: "id_token" },
|
|
694
|
+
{ query: "FindCredentialAccount", entity: "Account", field: "password" },
|
|
695
|
+
] as const;
|
|
696
|
+
export interface FindCredentialAccountParams {
|
|
697
|
+
readonly organization_id: string;
|
|
698
|
+
readonly user_id: string;
|
|
699
|
+
readonly account_id: string;
|
|
700
|
+
readonly provider_id: string;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export interface FindCredentialAccountFound {
|
|
704
|
+
readonly outcome: "Found";
|
|
705
|
+
readonly accounts: ReadonlyArray<{ readonly organization_id: string; readonly user_id: string; readonly id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly id_token: string | null; readonly password: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export type FindCredentialAccountResult = FindCredentialAccountFound;
|
|
709
|
+
|
|
710
|
+
export function isFindCredentialAccountFound(value: FindCredentialAccountResult): value is FindCredentialAccountFound {
|
|
711
|
+
return value.outcome === "Found";
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
export function unwrapFindCredentialAccountFound(value: FindCredentialAccountResult | TypedQueryResult<FindCredentialAccountResult>): FindCredentialAccountFound {
|
|
715
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindCredentialAccountResult;
|
|
716
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindCredentialAccount outcome "Found", got "${resolved.outcome}"`);
|
|
717
|
+
return resolved;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export function redactFindCredentialAccountResult(value: FindCredentialAccountResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_CREDENTIAL_ACCOUNT_SECRET_OUTPUTS } {
|
|
721
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_CREDENTIAL_ACCOUNT_SECRET_OUTPUTS };
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
export function findCredentialAccount(parameters: FindCredentialAccountParams): NamedQueryRequest<FindCredentialAccountParams, FindCredentialAccountResult> {
|
|
725
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_credential_account", inputSchemaHash: "108a21aa464170aff1274c8f9af12f9c84d899483e63eb62f4fc9bed6e4fc040" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindCredentialAccount", planHash: FIND_CREDENTIAL_ACCOUNT_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"accounts","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
export const FIND_EXPIRED_VERIFICATION_IDS_QUERY_PLAN_HASH = "03bc46fc682fec7be4fabdbf1f152a4546e6613df45df02f2dbaf6b08de56f01" as const;
|
|
729
|
+
export interface FindExpiredVerificationIdsParams {
|
|
730
|
+
readonly organization_id: string;
|
|
731
|
+
readonly expires_before: { readonly seconds: bigint; readonly nanos: number };
|
|
732
|
+
readonly after?: string | null;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export interface FindExpiredVerificationIdsFound {
|
|
736
|
+
readonly outcome: "Found";
|
|
737
|
+
readonly verifications: ReadonlyArray<{ readonly verification_id: string }>;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export type FindExpiredVerificationIdsResult = FindExpiredVerificationIdsFound;
|
|
741
|
+
|
|
742
|
+
export function isFindExpiredVerificationIdsFound(value: FindExpiredVerificationIdsResult): value is FindExpiredVerificationIdsFound {
|
|
743
|
+
return value.outcome === "Found";
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export function unwrapFindExpiredVerificationIdsFound(value: FindExpiredVerificationIdsResult | TypedQueryResult<FindExpiredVerificationIdsResult>): FindExpiredVerificationIdsFound {
|
|
747
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindExpiredVerificationIdsResult;
|
|
748
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindExpiredVerificationIds outcome "Found", got "${resolved.outcome}"`);
|
|
749
|
+
return resolved;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
export function findExpiredVerificationIds(parameters: FindExpiredVerificationIdsParams): NamedQueryRequest<FindExpiredVerificationIdsParams, FindExpiredVerificationIdsResult> {
|
|
753
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_expired_verification_ids", inputSchemaHash: "b2397d3409885ae750a1d8b4d53bc6905e59348dfc79f0b4d2934981ad4cb1b2" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindExpiredVerificationIds", planHash: FIND_EXPIRED_VERIFICATION_IDS_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"expires_before","schema":{"kind":"timestamp"}},{"name":"after","schema":{"kind":"optional","value":{"kind":"cursor"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"verifications","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"verification_id","schema":{"kind":"uuid"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export const FIND_LATEST_VERIFICATION_QUERY_PLAN_HASH = "9b30d93634e08ee6d56af39d05755f51d87ab3ffd3e0b76cc06c82d63a75ee6b" as const;
|
|
757
|
+
export const FIND_LATEST_VERIFICATION_SECRET_OUTPUTS = [
|
|
758
|
+
{ query: "FindLatestVerification", entity: "Verification", field: "value" },
|
|
759
|
+
] as const;
|
|
760
|
+
export interface FindLatestVerificationParams {
|
|
761
|
+
readonly organization_id: string;
|
|
762
|
+
readonly identifier: string;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface FindLatestVerificationFound {
|
|
766
|
+
readonly outcome: "Found";
|
|
767
|
+
readonly verifications: ReadonlyArray<{ readonly verification_id: string; readonly identifier: string; readonly value: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export type FindLatestVerificationResult = FindLatestVerificationFound;
|
|
771
|
+
|
|
772
|
+
export function isFindLatestVerificationFound(value: FindLatestVerificationResult): value is FindLatestVerificationFound {
|
|
773
|
+
return value.outcome === "Found";
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export function unwrapFindLatestVerificationFound(value: FindLatestVerificationResult | TypedQueryResult<FindLatestVerificationResult>): FindLatestVerificationFound {
|
|
777
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindLatestVerificationResult;
|
|
778
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindLatestVerification outcome "Found", got "${resolved.outcome}"`);
|
|
779
|
+
return resolved;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export function redactFindLatestVerificationResult(value: FindLatestVerificationResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_LATEST_VERIFICATION_SECRET_OUTPUTS } {
|
|
783
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_LATEST_VERIFICATION_SECRET_OUTPUTS };
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export function findLatestVerification(parameters: FindLatestVerificationParams): NamedQueryRequest<FindLatestVerificationParams, FindLatestVerificationResult> {
|
|
787
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_latest_verification", inputSchemaHash: "414c00deb31dd873e434c8006a8caa9d2b360457abe0f8269440d6c761dfdc94" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindLatestVerification", planHash: FIND_LATEST_VERIFICATION_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"identifier","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"verifications","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"verification_id","schema":{"kind":"uuid"}},{"name":"identifier","schema":{"kind":"string"}},{"name":"value","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
export const FIND_SESSION_BY_ID_QUERY_PLAN_HASH = "ba28c8fbaff96325f8e0f7eb2764cf56189f1ea3c4463dcf75eec5d7780c74a3" as const;
|
|
791
|
+
export const FIND_SESSION_BY_ID_SECRET_OUTPUTS = [
|
|
792
|
+
{ query: "FindSessionById", entity: "Session", field: "token" },
|
|
793
|
+
] as const;
|
|
794
|
+
export interface FindSessionByIdParams {
|
|
795
|
+
readonly organization_id: string;
|
|
796
|
+
readonly id: string;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export interface FindSessionByIdFound {
|
|
800
|
+
readonly outcome: "Found";
|
|
801
|
+
readonly sessions: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
export type FindSessionByIdResult = FindSessionByIdFound;
|
|
805
|
+
|
|
806
|
+
export function isFindSessionByIdFound(value: FindSessionByIdResult): value is FindSessionByIdFound {
|
|
807
|
+
return value.outcome === "Found";
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export function unwrapFindSessionByIdFound(value: FindSessionByIdResult | TypedQueryResult<FindSessionByIdResult>): FindSessionByIdFound {
|
|
811
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindSessionByIdResult;
|
|
812
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindSessionById outcome "Found", got "${resolved.outcome}"`);
|
|
813
|
+
return resolved;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export function redactFindSessionByIdResult(value: FindSessionByIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_SESSION_BY_ID_SECRET_OUTPUTS } {
|
|
817
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_SESSION_BY_ID_SECRET_OUTPUTS };
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
export function findSessionById(parameters: FindSessionByIdParams): NamedQueryRequest<FindSessionByIdParams, FindSessionByIdResult> {
|
|
821
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_session_by_id", inputSchemaHash: "a8efd0b9fe4e36f92ca57a7c5351df748b4c2adbd0e363e2a5ffb66ff4d23bdc" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindSessionById", planHash: FIND_SESSION_BY_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"id","schema":{"kind":"uuid"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"sessions","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export const FIND_SESSION_BY_TOKEN_QUERY_PLAN_HASH = "1ff3d0007220b55cc6acf4e1c6b83071159c96679600fe80f9829185ec7e4fe7" as const;
|
|
825
|
+
export const FIND_SESSION_BY_TOKEN_SECRET_OUTPUTS = [
|
|
826
|
+
{ query: "FindSessionByToken", entity: "Session", field: "token" },
|
|
827
|
+
] as const;
|
|
828
|
+
export interface FindSessionByTokenParams {
|
|
829
|
+
readonly organization_id: string;
|
|
830
|
+
readonly token: string;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export interface FindSessionByTokenFound {
|
|
834
|
+
readonly outcome: "Found";
|
|
835
|
+
readonly sessions: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export type FindSessionByTokenResult = FindSessionByTokenFound;
|
|
839
|
+
|
|
840
|
+
export function isFindSessionByTokenFound(value: FindSessionByTokenResult): value is FindSessionByTokenFound {
|
|
841
|
+
return value.outcome === "Found";
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
export function unwrapFindSessionByTokenFound(value: FindSessionByTokenResult | TypedQueryResult<FindSessionByTokenResult>): FindSessionByTokenFound {
|
|
845
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindSessionByTokenResult;
|
|
846
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindSessionByToken outcome "Found", got "${resolved.outcome}"`);
|
|
847
|
+
return resolved;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export function redactFindSessionByTokenResult(value: FindSessionByTokenResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_SESSION_BY_TOKEN_SECRET_OUTPUTS } {
|
|
851
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_SESSION_BY_TOKEN_SECRET_OUTPUTS };
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
export function findSessionByToken(parameters: FindSessionByTokenParams): NamedQueryRequest<FindSessionByTokenParams, FindSessionByTokenResult> {
|
|
855
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_session_by_token", inputSchemaHash: "0ff142e840e9d2d322c37be4688526fc1348f508cc4976856bd7e4d2570859e8" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindSessionByToken", planHash: FIND_SESSION_BY_TOKEN_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"sessions","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export const FIND_SESSIONS_BY_TOKEN_SET_QUERY_PLAN_HASH = "6558126e5e64f676c7add951e272a94e2b93c3763de2eb4be0fd23d7e0ba8e0d" as const;
|
|
859
|
+
export const FIND_SESSIONS_BY_TOKEN_SET_TOKENS_MAX_ITEMS = 32 as const;
|
|
860
|
+
export const FIND_SESSIONS_BY_TOKEN_SET_SECRET_OUTPUTS = [
|
|
861
|
+
{ query: "FindSessionsByTokenSet", entity: "Session", field: "token" },
|
|
862
|
+
] as const;
|
|
863
|
+
export interface FindSessionsByTokenSetParams {
|
|
864
|
+
readonly organization_id: string;
|
|
865
|
+
readonly tokens: ReadonlyArray<string>;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export interface FindSessionsByTokenSetFound {
|
|
869
|
+
readonly outcome: "Found";
|
|
870
|
+
readonly sessions: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
export type FindSessionsByTokenSetResult = FindSessionsByTokenSetFound;
|
|
874
|
+
|
|
875
|
+
export function isFindSessionsByTokenSetFound(value: FindSessionsByTokenSetResult): value is FindSessionsByTokenSetFound {
|
|
876
|
+
return value.outcome === "Found";
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export function unwrapFindSessionsByTokenSetFound(value: FindSessionsByTokenSetResult | TypedQueryResult<FindSessionsByTokenSetResult>): FindSessionsByTokenSetFound {
|
|
880
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindSessionsByTokenSetResult;
|
|
881
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindSessionsByTokenSet outcome "Found", got "${resolved.outcome}"`);
|
|
882
|
+
return resolved;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export function redactFindSessionsByTokenSetResult(value: FindSessionsByTokenSetResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_SESSIONS_BY_TOKEN_SET_SECRET_OUTPUTS } {
|
|
886
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_SESSIONS_BY_TOKEN_SET_SECRET_OUTPUTS };
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
export function findSessionsByTokenSet(parameters: FindSessionsByTokenSetParams): NamedQueryRequest<FindSessionsByTokenSetParams, FindSessionsByTokenSetResult> {
|
|
890
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_sessions_by_token_set", inputSchemaHash: "6e07645237cd913d73a45bd7f863e3ca8d9ae09fdfecdb7494246fa80dea3899" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindSessionsByTokenSet", planHash: FIND_SESSIONS_BY_TOKEN_SET_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"tokens","schema":{"kind":"list","value":{"kind":"string"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"sessions","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
export const FIND_SESSIONS_BY_USER_ID_QUERY_PLAN_HASH = "83a23f70bb1ec3f3cab97553aba531eb3d7a9011db5854bc6b6db78dbff0bae2" as const;
|
|
894
|
+
export const FIND_SESSIONS_BY_USER_ID_SECRET_OUTPUTS = [
|
|
895
|
+
{ query: "FindSessionsByUserId", entity: "Session", field: "token" },
|
|
896
|
+
] as const;
|
|
897
|
+
export interface FindSessionsByUserIdParams {
|
|
898
|
+
readonly organization_id: string;
|
|
899
|
+
readonly user_id: string;
|
|
900
|
+
readonly after?: string | null;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
export interface FindSessionsByUserIdFound {
|
|
904
|
+
readonly outcome: "Found";
|
|
905
|
+
readonly sessions: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
export type FindSessionsByUserIdResult = FindSessionsByUserIdFound;
|
|
909
|
+
|
|
910
|
+
export function isFindSessionsByUserIdFound(value: FindSessionsByUserIdResult): value is FindSessionsByUserIdFound {
|
|
911
|
+
return value.outcome === "Found";
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export function unwrapFindSessionsByUserIdFound(value: FindSessionsByUserIdResult | TypedQueryResult<FindSessionsByUserIdResult>): FindSessionsByUserIdFound {
|
|
915
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindSessionsByUserIdResult;
|
|
916
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindSessionsByUserId outcome "Found", got "${resolved.outcome}"`);
|
|
917
|
+
return resolved;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
export function redactFindSessionsByUserIdResult(value: FindSessionsByUserIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_SESSIONS_BY_USER_ID_SECRET_OUTPUTS } {
|
|
921
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_SESSIONS_BY_USER_ID_SECRET_OUTPUTS };
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
export function findSessionsByUserId(parameters: FindSessionsByUserIdParams): NamedQueryRequest<FindSessionsByUserIdParams, FindSessionsByUserIdResult> {
|
|
925
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_sessions_by_user_id", inputSchemaHash: "52291caa82b70870673211137e93f3ecda460cbe7b9fc465f0b9d7f30df05798" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindSessionsByUserId", planHash: FIND_SESSIONS_BY_USER_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"after","schema":{"kind":"optional","value":{"kind":"cursor"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"sessions","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export const FIND_USER_BY_EMAIL_QUERY_PLAN_HASH = "24762c2b0ffffcebb8a9d610401f5596d2a64d46cf5fb362971414b2377d894f" as const;
|
|
929
|
+
export interface FindUserByEmailParams {
|
|
930
|
+
readonly organization_id: string;
|
|
931
|
+
readonly email: string;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export interface FindUserByEmailFound {
|
|
935
|
+
readonly outcome: "Found";
|
|
936
|
+
readonly users: ReadonlyArray<{ readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export type FindUserByEmailResult = FindUserByEmailFound;
|
|
940
|
+
|
|
941
|
+
export function isFindUserByEmailFound(value: FindUserByEmailResult): value is FindUserByEmailFound {
|
|
942
|
+
return value.outcome === "Found";
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
export function unwrapFindUserByEmailFound(value: FindUserByEmailResult | TypedQueryResult<FindUserByEmailResult>): FindUserByEmailFound {
|
|
946
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindUserByEmailResult;
|
|
947
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindUserByEmail outcome "Found", got "${resolved.outcome}"`);
|
|
948
|
+
return resolved;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
function decodeFindUserByEmailCompact(value: CompactNamedQueryResult): FindUserByEmailResult {
|
|
952
|
+
if (value.outcome !== "Found" || value.resultName !== "users" || value.entity !== "User"
|
|
953
|
+
|| value.fields.length !== 10 || value.fields.some((field, index) => field !== ["created_at", "date_field", "email", "email_verified", "image", "locale", "name", "revision", "updated_at", "user_id"][index])
|
|
954
|
+
|| value.rows.length > 1) throw new Error("invalid RiffDB compact result");
|
|
955
|
+
return { outcome: "Found", users: value.rows.map((row) => {
|
|
956
|
+
if (row.length !== 10) throw new Error("invalid RiffDB compact result");
|
|
957
|
+
return {
|
|
958
|
+
created_at: compactTimestamp(row[0]!),
|
|
959
|
+
date_field: (row[1]!.type === "null" ? null : compactTimestamp(row[1]!)),
|
|
960
|
+
email: compactString(row[2]!, "string", 320),
|
|
961
|
+
email_verified: (() => { const value = compactPayload(row[3]!, "bool"); if (typeof value !== "boolean") throw new Error("invalid RiffDB compact value"); return value; })(),
|
|
962
|
+
image: (row[4]!.type === "null" ? null : compactString(row[4]!, "string", 2048)),
|
|
963
|
+
locale: (row[5]!.type === "null" ? null : compactString(row[5]!, "string", 2048)),
|
|
964
|
+
name: compactString(row[6]!, "string", 256),
|
|
965
|
+
revision: compactInteger(row[7]!, "u64"),
|
|
966
|
+
updated_at: compactTimestamp(row[8]!),
|
|
967
|
+
user_id: (() => { const value = compactString(row[9]!, "uuid", 36); if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(value)) throw new Error("invalid RiffDB compact value"); return value; })(),
|
|
968
|
+
};
|
|
969
|
+
}) };
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
export function findUserByEmail(parameters: FindUserByEmailParams): NamedQueryRequest<FindUserByEmailParams, FindUserByEmailResult> {
|
|
973
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_user_by_email", inputSchemaHash: "7d3b1da87ea1ee59893e110cd8f8a5eacb522a8fde24a7e8aa9b7c13340990b9" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindUserByEmail", planHash: FIND_USER_BY_EMAIL_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"email","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}}],"kind":"record"}}, compactDecoder: decodeFindUserByEmailCompact, decodeError: decodeApplicationError };
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export const FIND_USER_BY_ID_QUERY_PLAN_HASH = "4cf6ed386cc8486083a127c74d554670d1358187d2ef4e83d68fca40adfe77ae" as const;
|
|
977
|
+
export interface FindUserByIdParams {
|
|
978
|
+
readonly organization_id: string;
|
|
979
|
+
readonly id: string;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
export interface FindUserByIdFound {
|
|
983
|
+
readonly outcome: "Found";
|
|
984
|
+
readonly user: { readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null };
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
export interface FindUserByIdMissing {
|
|
988
|
+
readonly outcome: "Missing";
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
export type FindUserByIdResult = FindUserByIdFound | FindUserByIdMissing;
|
|
992
|
+
|
|
993
|
+
export function isFindUserByIdFound(value: FindUserByIdResult): value is FindUserByIdFound {
|
|
994
|
+
return value.outcome === "Found";
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
export function isFindUserByIdMissing(value: FindUserByIdResult): value is FindUserByIdMissing {
|
|
998
|
+
return value.outcome === "Missing";
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export function unwrapFindUserByIdFound(value: FindUserByIdResult | TypedQueryResult<FindUserByIdResult>): FindUserByIdFound {
|
|
1002
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindUserByIdResult;
|
|
1003
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindUserById outcome "Found", got "${resolved.outcome}"`);
|
|
1004
|
+
return resolved;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
export function findUserById(parameters: FindUserByIdParams): NamedQueryRequest<FindUserByIdParams, FindUserByIdResult> {
|
|
1008
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_user_by_id", inputSchemaHash: "a8efd0b9fe4e36f92ca57a7c5351df748b4c2adbd0e363e2a5ffb66ff4d23bdc" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindUserById", planHash: FIND_USER_BY_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"id","schema":{"kind":"uuid"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"user","schema":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}],"kind":"record"},"Missing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
export const FIND_VERIFICATION_BY_ID_QUERY_PLAN_HASH = "061068a3b56749be5ff6153ccca99f82689bfaf825a09621b611270d17c7c0dc" as const;
|
|
1012
|
+
export const FIND_VERIFICATION_BY_ID_SECRET_OUTPUTS = [
|
|
1013
|
+
{ query: "FindVerificationById", entity: "Verification", field: "value" },
|
|
1014
|
+
] as const;
|
|
1015
|
+
export interface FindVerificationByIdParams {
|
|
1016
|
+
readonly organization_id: string;
|
|
1017
|
+
readonly id: string;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
export interface FindVerificationByIdFound {
|
|
1021
|
+
readonly outcome: "Found";
|
|
1022
|
+
readonly verification: { readonly verification_id: string; readonly identifier: string; readonly value: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint };
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
export interface FindVerificationByIdMissing {
|
|
1026
|
+
readonly outcome: "Missing";
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
export type FindVerificationByIdResult = FindVerificationByIdFound | FindVerificationByIdMissing;
|
|
1030
|
+
|
|
1031
|
+
export function isFindVerificationByIdFound(value: FindVerificationByIdResult): value is FindVerificationByIdFound {
|
|
1032
|
+
return value.outcome === "Found";
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export function isFindVerificationByIdMissing(value: FindVerificationByIdResult): value is FindVerificationByIdMissing {
|
|
1036
|
+
return value.outcome === "Missing";
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
export function unwrapFindVerificationByIdFound(value: FindVerificationByIdResult | TypedQueryResult<FindVerificationByIdResult>): FindVerificationByIdFound {
|
|
1040
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindVerificationByIdResult;
|
|
1041
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindVerificationById outcome "Found", got "${resolved.outcome}"`);
|
|
1042
|
+
return resolved;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
export function redactFindVerificationByIdResult(value: FindVerificationByIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_VERIFICATION_BY_ID_SECRET_OUTPUTS } {
|
|
1046
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_VERIFICATION_BY_ID_SECRET_OUTPUTS };
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
export function findVerificationById(parameters: FindVerificationByIdParams): NamedQueryRequest<FindVerificationByIdParams, FindVerificationByIdResult> {
|
|
1050
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_verification_by_id", inputSchemaHash: "a8efd0b9fe4e36f92ca57a7c5351df748b4c2adbd0e363e2a5ffb66ff4d23bdc" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindVerificationById", planHash: FIND_VERIFICATION_BY_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"id","schema":{"kind":"uuid"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"verification","schema":{"fields":[{"name":"verification_id","schema":{"kind":"uuid"}},{"name":"identifier","schema":{"kind":"string"}},{"name":"value","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}],"kind":"record"},"Missing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
export const FIND_VERIFICATIONS_BY_IDENTIFIER_QUERY_PLAN_HASH = "ee1531d8c350b6b110af9f113d8abc9aaba558e0f705b5154a74d1fca8086445" as const;
|
|
1054
|
+
export const FIND_VERIFICATIONS_BY_IDENTIFIER_SECRET_OUTPUTS = [
|
|
1055
|
+
{ query: "FindVerificationsByIdentifier", entity: "Verification", field: "value" },
|
|
1056
|
+
] as const;
|
|
1057
|
+
export interface FindVerificationsByIdentifierParams {
|
|
1058
|
+
readonly organization_id: string;
|
|
1059
|
+
readonly identifier: string;
|
|
1060
|
+
readonly after?: string | null;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
export interface FindVerificationsByIdentifierFound {
|
|
1064
|
+
readonly outcome: "Found";
|
|
1065
|
+
readonly verifications: ReadonlyArray<{ readonly verification_id: string; readonly identifier: string; readonly value: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
export type FindVerificationsByIdentifierResult = FindVerificationsByIdentifierFound;
|
|
1069
|
+
|
|
1070
|
+
export function isFindVerificationsByIdentifierFound(value: FindVerificationsByIdentifierResult): value is FindVerificationsByIdentifierFound {
|
|
1071
|
+
return value.outcome === "Found";
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
export function unwrapFindVerificationsByIdentifierFound(value: FindVerificationsByIdentifierResult | TypedQueryResult<FindVerificationsByIdentifierResult>): FindVerificationsByIdentifierFound {
|
|
1075
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as FindVerificationsByIdentifierResult;
|
|
1076
|
+
if (resolved.outcome !== "Found") throw new Error(`expected FindVerificationsByIdentifier outcome "Found", got "${resolved.outcome}"`);
|
|
1077
|
+
return resolved;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
export function redactFindVerificationsByIdentifierResult(value: FindVerificationsByIdentifierResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof FIND_VERIFICATIONS_BY_IDENTIFIER_SECRET_OUTPUTS } {
|
|
1081
|
+
return { outcome: value.outcome, redactedSecretOutputs: FIND_VERIFICATIONS_BY_IDENTIFIER_SECRET_OUTPUTS };
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
export function findVerificationsByIdentifier(parameters: FindVerificationsByIdentifierParams): NamedQueryRequest<FindVerificationsByIdentifierParams, FindVerificationsByIdentifierResult> {
|
|
1085
|
+
return { driverOperation: { name: "riffdb_better_auth_core_find_verifications_by_identifier", inputSchemaHash: "f61c6a3fd1f9b7496a437e77f166f72e9c36d27d832811ac96f146fa2999cc37" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "FindVerificationsByIdentifier", planHash: FIND_VERIFICATIONS_BY_IDENTIFIER_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"identifier","schema":{"kind":"string"}},{"name":"after","schema":{"kind":"optional","value":{"kind":"cursor"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"verifications","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"verification_id","schema":{"kind":"uuid"}},{"name":"identifier","schema":{"kind":"string"}},{"name":"value","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
export const PROFILE_ACCOUNT_WITH_USER_BY_PROVIDER_QUERY_PLAN_HASH = "1aaa15d82bedbb0beb9084e2009715fcb167872fbc23d5429819746188fa7fd4" as const;
|
|
1089
|
+
export const PROFILE_ACCOUNT_WITH_USER_BY_PROVIDER_SECRET_OUTPUTS = [
|
|
1090
|
+
{ query: "ProfileAccountWithUserByProvider", entity: "Account", field: "access_token" },
|
|
1091
|
+
{ query: "ProfileAccountWithUserByProvider", entity: "Account", field: "refresh_token" },
|
|
1092
|
+
{ query: "ProfileAccountWithUserByProvider", entity: "Account", field: "id_token" },
|
|
1093
|
+
{ query: "ProfileAccountWithUserByProvider", entity: "Account", field: "password" },
|
|
1094
|
+
] as const;
|
|
1095
|
+
export interface ProfileAccountWithUserByProviderParams {
|
|
1096
|
+
readonly organization_id: string;
|
|
1097
|
+
readonly account_id: string;
|
|
1098
|
+
readonly provider_id: string;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
export interface ProfileAccountWithUserByProviderFound {
|
|
1102
|
+
readonly outcome: "Found";
|
|
1103
|
+
readonly users: ReadonlyArray<{ readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
1104
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export type ProfileAccountWithUserByProviderResult = ProfileAccountWithUserByProviderFound;
|
|
1108
|
+
|
|
1109
|
+
export function isProfileAccountWithUserByProviderFound(value: ProfileAccountWithUserByProviderResult): value is ProfileAccountWithUserByProviderFound {
|
|
1110
|
+
return value.outcome === "Found";
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
export function unwrapProfileAccountWithUserByProviderFound(value: ProfileAccountWithUserByProviderResult | TypedQueryResult<ProfileAccountWithUserByProviderResult>): ProfileAccountWithUserByProviderFound {
|
|
1114
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as ProfileAccountWithUserByProviderResult;
|
|
1115
|
+
if (resolved.outcome !== "Found") throw new Error(`expected ProfileAccountWithUserByProvider outcome "Found", got "${resolved.outcome}"`);
|
|
1116
|
+
return resolved;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export function redactProfileAccountWithUserByProviderResult(value: ProfileAccountWithUserByProviderResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof PROFILE_ACCOUNT_WITH_USER_BY_PROVIDER_SECRET_OUTPUTS } {
|
|
1120
|
+
return { outcome: value.outcome, redactedSecretOutputs: PROFILE_ACCOUNT_WITH_USER_BY_PROVIDER_SECRET_OUTPUTS };
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
export function profileAccountWithUserByProvider(parameters: ProfileAccountWithUserByProviderParams): NamedQueryRequest<ProfileAccountWithUserByProviderParams, ProfileAccountWithUserByProviderResult> {
|
|
1124
|
+
return { driverOperation: { name: "riffdb_better_auth_core_profile_account_with_user_by_provider", inputSchemaHash: "7e48e77594d132efa4753eee93934c2ef61f6d82313edff8f7c84c7d8d4112f2" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "ProfileAccountWithUserByProvider", planHash: PROFILE_ACCOUNT_WITH_USER_BY_PROVIDER_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"accounts","schema":{"kind":"list","maximum":1,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
export const PROFILE_SESSION_WITH_USER_BY_ID_QUERY_PLAN_HASH = "75b27ee6cdd604c50ae9c8f2a7353cb746908c06f98eb2cda4e51c22d3927173" as const;
|
|
1128
|
+
export const PROFILE_SESSION_WITH_USER_BY_ID_SECRET_OUTPUTS = [
|
|
1129
|
+
{ query: "ProfileSessionWithUserById", entity: "Session", field: "token" },
|
|
1130
|
+
] as const;
|
|
1131
|
+
export interface ProfileSessionWithUserByIdParams {
|
|
1132
|
+
readonly organization_id: string;
|
|
1133
|
+
readonly value: string;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
export interface ProfileSessionWithUserByIdFound {
|
|
1137
|
+
readonly outcome: "Found";
|
|
1138
|
+
readonly session: { readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint };
|
|
1139
|
+
readonly user: { readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null };
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
export interface ProfileSessionWithUserByIdMissing {
|
|
1143
|
+
readonly outcome: "Missing";
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
export interface ProfileSessionWithUserByIdIntegrityFailure {
|
|
1147
|
+
readonly outcome: "IntegrityFailure";
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
export type ProfileSessionWithUserByIdResult = ProfileSessionWithUserByIdFound | ProfileSessionWithUserByIdMissing | ProfileSessionWithUserByIdIntegrityFailure;
|
|
1151
|
+
|
|
1152
|
+
export function isProfileSessionWithUserByIdFound(value: ProfileSessionWithUserByIdResult): value is ProfileSessionWithUserByIdFound {
|
|
1153
|
+
return value.outcome === "Found";
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
export function isProfileSessionWithUserByIdMissing(value: ProfileSessionWithUserByIdResult): value is ProfileSessionWithUserByIdMissing {
|
|
1157
|
+
return value.outcome === "Missing";
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
export function isProfileSessionWithUserByIdIntegrityFailure(value: ProfileSessionWithUserByIdResult): value is ProfileSessionWithUserByIdIntegrityFailure {
|
|
1161
|
+
return value.outcome === "IntegrityFailure";
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
export function unwrapProfileSessionWithUserByIdFound(value: ProfileSessionWithUserByIdResult | TypedQueryResult<ProfileSessionWithUserByIdResult>): ProfileSessionWithUserByIdFound {
|
|
1165
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as ProfileSessionWithUserByIdResult;
|
|
1166
|
+
if (resolved.outcome !== "Found") throw new Error(`expected ProfileSessionWithUserById outcome "Found", got "${resolved.outcome}"`);
|
|
1167
|
+
return resolved;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
export function redactProfileSessionWithUserByIdResult(value: ProfileSessionWithUserByIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof PROFILE_SESSION_WITH_USER_BY_ID_SECRET_OUTPUTS } {
|
|
1171
|
+
return { outcome: value.outcome, redactedSecretOutputs: PROFILE_SESSION_WITH_USER_BY_ID_SECRET_OUTPUTS };
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
export function profileSessionWithUserById(parameters: ProfileSessionWithUserByIdParams): NamedQueryRequest<ProfileSessionWithUserByIdParams, ProfileSessionWithUserByIdResult> {
|
|
1175
|
+
return { driverOperation: { name: "riffdb_better_auth_core_profile_session_with_user_by_id", inputSchemaHash: "b36ab8632996b6bf3630a697bca331638b949de2e3f46abc2d612c0cb3d6afc9" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "ProfileSessionWithUserById", planHash: PROFILE_SESSION_WITH_USER_BY_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"value","schema":{"kind":"uuid"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"session","schema":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}},{"name":"user","schema":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}],"kind":"record"},"IntegrityFailure":{"fields":[],"kind":"record"},"Missing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
export const PROFILE_SESSION_WITH_USER_BY_TOKEN_QUERY_PLAN_HASH = "8613d0bbe90e6671f419604026f5ba58d4f0c688d322d7f223e511f7f8eddefc" as const;
|
|
1179
|
+
export const PROFILE_SESSION_WITH_USER_BY_TOKEN_SECRET_OUTPUTS = [
|
|
1180
|
+
{ query: "ProfileSessionWithUserByToken", entity: "Session", field: "token" },
|
|
1181
|
+
] as const;
|
|
1182
|
+
export interface ProfileSessionWithUserByTokenParams {
|
|
1183
|
+
readonly organization_id: string;
|
|
1184
|
+
readonly value: string;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
export interface ProfileSessionWithUserByTokenFound {
|
|
1188
|
+
readonly outcome: "Found";
|
|
1189
|
+
readonly session: { readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint };
|
|
1190
|
+
readonly user: { readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null };
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
export interface ProfileSessionWithUserByTokenMissing {
|
|
1194
|
+
readonly outcome: "Missing";
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
export interface ProfileSessionWithUserByTokenIntegrityFailure {
|
|
1198
|
+
readonly outcome: "IntegrityFailure";
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
export type ProfileSessionWithUserByTokenResult = ProfileSessionWithUserByTokenFound | ProfileSessionWithUserByTokenMissing | ProfileSessionWithUserByTokenIntegrityFailure;
|
|
1202
|
+
|
|
1203
|
+
export function isProfileSessionWithUserByTokenFound(value: ProfileSessionWithUserByTokenResult): value is ProfileSessionWithUserByTokenFound {
|
|
1204
|
+
return value.outcome === "Found";
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
export function isProfileSessionWithUserByTokenMissing(value: ProfileSessionWithUserByTokenResult): value is ProfileSessionWithUserByTokenMissing {
|
|
1208
|
+
return value.outcome === "Missing";
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
export function isProfileSessionWithUserByTokenIntegrityFailure(value: ProfileSessionWithUserByTokenResult): value is ProfileSessionWithUserByTokenIntegrityFailure {
|
|
1212
|
+
return value.outcome === "IntegrityFailure";
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export function unwrapProfileSessionWithUserByTokenFound(value: ProfileSessionWithUserByTokenResult | TypedQueryResult<ProfileSessionWithUserByTokenResult>): ProfileSessionWithUserByTokenFound {
|
|
1216
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as ProfileSessionWithUserByTokenResult;
|
|
1217
|
+
if (resolved.outcome !== "Found") throw new Error(`expected ProfileSessionWithUserByToken outcome "Found", got "${resolved.outcome}"`);
|
|
1218
|
+
return resolved;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
export function redactProfileSessionWithUserByTokenResult(value: ProfileSessionWithUserByTokenResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof PROFILE_SESSION_WITH_USER_BY_TOKEN_SECRET_OUTPUTS } {
|
|
1222
|
+
return { outcome: value.outcome, redactedSecretOutputs: PROFILE_SESSION_WITH_USER_BY_TOKEN_SECRET_OUTPUTS };
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
export function profileSessionWithUserByToken(parameters: ProfileSessionWithUserByTokenParams): NamedQueryRequest<ProfileSessionWithUserByTokenParams, ProfileSessionWithUserByTokenResult> {
|
|
1226
|
+
return { driverOperation: { name: "riffdb_better_auth_core_profile_session_with_user_by_token", inputSchemaHash: "b36ab8632996b6bf3630a697bca331638b949de2e3f46abc2d612c0cb3d6afc9" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "ProfileSessionWithUserByToken", planHash: PROFILE_SESSION_WITH_USER_BY_TOKEN_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"value","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"session","schema":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}},{"name":"user","schema":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}],"kind":"record"},"IntegrityFailure":{"fields":[],"kind":"record"},"Missing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
export const PROFILE_SESSIONS_WITH_USERS_BY_TOKEN_SET_QUERY_PLAN_HASH = "8be2d5032391444cc188e0475b21178508458289f7778eee98db480449e7b9a0" as const;
|
|
1230
|
+
export const PROFILE_SESSIONS_WITH_USERS_BY_TOKEN_SET_SECRET_OUTPUTS = [
|
|
1231
|
+
{ query: "ProfileSessionsWithUsersByTokenSet", entity: "Session", field: "token" },
|
|
1232
|
+
] as const;
|
|
1233
|
+
export interface ProfileSessionsWithUsersByTokenSetParams {
|
|
1234
|
+
readonly organization_id: string;
|
|
1235
|
+
readonly tokens: ReadonlyArray<string>;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
export interface ProfileSessionsWithUsersByTokenSetFound {
|
|
1239
|
+
readonly outcome: "Found";
|
|
1240
|
+
readonly users: ReadonlyArray<{ readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null }>;
|
|
1241
|
+
readonly sessions: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly token: string; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly ip_address: string | null; readonly user_agent: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
export type ProfileSessionsWithUsersByTokenSetResult = ProfileSessionsWithUsersByTokenSetFound;
|
|
1245
|
+
|
|
1246
|
+
export function isProfileSessionsWithUsersByTokenSetFound(value: ProfileSessionsWithUsersByTokenSetResult): value is ProfileSessionsWithUsersByTokenSetFound {
|
|
1247
|
+
return value.outcome === "Found";
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
export function unwrapProfileSessionsWithUsersByTokenSetFound(value: ProfileSessionsWithUsersByTokenSetResult | TypedQueryResult<ProfileSessionsWithUsersByTokenSetResult>): ProfileSessionsWithUsersByTokenSetFound {
|
|
1251
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as ProfileSessionsWithUsersByTokenSetResult;
|
|
1252
|
+
if (resolved.outcome !== "Found") throw new Error(`expected ProfileSessionsWithUsersByTokenSet outcome "Found", got "${resolved.outcome}"`);
|
|
1253
|
+
return resolved;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
export function redactProfileSessionsWithUsersByTokenSetResult(value: ProfileSessionsWithUsersByTokenSetResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof PROFILE_SESSIONS_WITH_USERS_BY_TOKEN_SET_SECRET_OUTPUTS } {
|
|
1257
|
+
return { outcome: value.outcome, redactedSecretOutputs: PROFILE_SESSIONS_WITH_USERS_BY_TOKEN_SET_SECRET_OUTPUTS };
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export function profileSessionsWithUsersByTokenSet(parameters: ProfileSessionsWithUsersByTokenSetParams): NamedQueryRequest<ProfileSessionsWithUsersByTokenSetParams, ProfileSessionsWithUsersByTokenSetResult> {
|
|
1261
|
+
return { driverOperation: { name: "riffdb_better_auth_core_profile_sessions_with_users_by_token_set", inputSchemaHash: "6e07645237cd913d73a45bd7f863e3ca8d9ae09fdfecdb7494246fa80dea3899" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "ProfileSessionsWithUsersByTokenSet", planHash: PROFILE_SESSIONS_WITH_USERS_BY_TOKEN_SET_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"tokens","schema":{"kind":"list","value":{"kind":"string"}}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"users","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}}},{"name":"sessions","schema":{"kind":"list","maximum":32,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
export const PROFILE_USER_WITH_ACCOUNTS_BY_EMAIL_QUERY_PLAN_HASH = "3cad29f13a66ea5688a7f403d330e090af32e118cb4c70683175987f1b7fea9f" as const;
|
|
1265
|
+
export const PROFILE_USER_WITH_ACCOUNTS_BY_EMAIL_SECRET_OUTPUTS = [
|
|
1266
|
+
{ query: "ProfileUserWithAccountsByEmail", entity: "Account", field: "access_token" },
|
|
1267
|
+
{ query: "ProfileUserWithAccountsByEmail", entity: "Account", field: "refresh_token" },
|
|
1268
|
+
{ query: "ProfileUserWithAccountsByEmail", entity: "Account", field: "id_token" },
|
|
1269
|
+
{ query: "ProfileUserWithAccountsByEmail", entity: "Account", field: "password" },
|
|
1270
|
+
] as const;
|
|
1271
|
+
export interface ProfileUserWithAccountsByEmailParams {
|
|
1272
|
+
readonly organization_id: string;
|
|
1273
|
+
readonly value: string;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
export interface ProfileUserWithAccountsByEmailFound {
|
|
1277
|
+
readonly outcome: "Found";
|
|
1278
|
+
readonly user: { readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null };
|
|
1279
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
export interface ProfileUserWithAccountsByEmailMissing {
|
|
1283
|
+
readonly outcome: "Missing";
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
export type ProfileUserWithAccountsByEmailResult = ProfileUserWithAccountsByEmailFound | ProfileUserWithAccountsByEmailMissing;
|
|
1287
|
+
|
|
1288
|
+
export function isProfileUserWithAccountsByEmailFound(value: ProfileUserWithAccountsByEmailResult): value is ProfileUserWithAccountsByEmailFound {
|
|
1289
|
+
return value.outcome === "Found";
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
export function isProfileUserWithAccountsByEmailMissing(value: ProfileUserWithAccountsByEmailResult): value is ProfileUserWithAccountsByEmailMissing {
|
|
1293
|
+
return value.outcome === "Missing";
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
export function unwrapProfileUserWithAccountsByEmailFound(value: ProfileUserWithAccountsByEmailResult | TypedQueryResult<ProfileUserWithAccountsByEmailResult>): ProfileUserWithAccountsByEmailFound {
|
|
1297
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as ProfileUserWithAccountsByEmailResult;
|
|
1298
|
+
if (resolved.outcome !== "Found") throw new Error(`expected ProfileUserWithAccountsByEmail outcome "Found", got "${resolved.outcome}"`);
|
|
1299
|
+
return resolved;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
export function redactProfileUserWithAccountsByEmailResult(value: ProfileUserWithAccountsByEmailResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof PROFILE_USER_WITH_ACCOUNTS_BY_EMAIL_SECRET_OUTPUTS } {
|
|
1303
|
+
return { outcome: value.outcome, redactedSecretOutputs: PROFILE_USER_WITH_ACCOUNTS_BY_EMAIL_SECRET_OUTPUTS };
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
export function profileUserWithAccountsByEmail(parameters: ProfileUserWithAccountsByEmailParams): NamedQueryRequest<ProfileUserWithAccountsByEmailParams, ProfileUserWithAccountsByEmailResult> {
|
|
1307
|
+
return { driverOperation: { name: "riffdb_better_auth_core_profile_user_with_accounts_by_email", inputSchemaHash: "b36ab8632996b6bf3630a697bca331638b949de2e3f46abc2d612c0cb3d6afc9" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "ProfileUserWithAccountsByEmail", planHash: PROFILE_USER_WITH_ACCOUNTS_BY_EMAIL_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"value","schema":{"kind":"string"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"user","schema":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}},{"name":"accounts","schema":{"kind":"list","maximum":33,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"},"Missing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
export const PROFILE_USER_WITH_ACCOUNTS_BY_ID_QUERY_PLAN_HASH = "3f956d2afae78effa75ba00d6ca557c8b1ebd98d971bf80daacefdfb4aa638d1" as const;
|
|
1311
|
+
export const PROFILE_USER_WITH_ACCOUNTS_BY_ID_SECRET_OUTPUTS = [
|
|
1312
|
+
{ query: "ProfileUserWithAccountsById", entity: "Account", field: "access_token" },
|
|
1313
|
+
{ query: "ProfileUserWithAccountsById", entity: "Account", field: "refresh_token" },
|
|
1314
|
+
{ query: "ProfileUserWithAccountsById", entity: "Account", field: "id_token" },
|
|
1315
|
+
{ query: "ProfileUserWithAccountsById", entity: "Account", field: "password" },
|
|
1316
|
+
] as const;
|
|
1317
|
+
export interface ProfileUserWithAccountsByIdParams {
|
|
1318
|
+
readonly organization_id: string;
|
|
1319
|
+
readonly value: string;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
export interface ProfileUserWithAccountsByIdFound {
|
|
1323
|
+
readonly outcome: "Found";
|
|
1324
|
+
readonly user: { readonly user_id: string; readonly name: string; readonly email: string; readonly email_verified: boolean; readonly image: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint; readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null; readonly locale: string | null };
|
|
1325
|
+
readonly accounts: ReadonlyArray<{ readonly id: string; readonly user_id: string; readonly account_id: string; readonly provider_id: string; readonly access_token: string | null; readonly refresh_token: string | null; readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null; readonly scope: string | null; readonly id_token: string | null; readonly password: string | null; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly revision: bigint }>;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
export interface ProfileUserWithAccountsByIdMissing {
|
|
1329
|
+
readonly outcome: "Missing";
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
export type ProfileUserWithAccountsByIdResult = ProfileUserWithAccountsByIdFound | ProfileUserWithAccountsByIdMissing;
|
|
1333
|
+
|
|
1334
|
+
export function isProfileUserWithAccountsByIdFound(value: ProfileUserWithAccountsByIdResult): value is ProfileUserWithAccountsByIdFound {
|
|
1335
|
+
return value.outcome === "Found";
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
export function isProfileUserWithAccountsByIdMissing(value: ProfileUserWithAccountsByIdResult): value is ProfileUserWithAccountsByIdMissing {
|
|
1339
|
+
return value.outcome === "Missing";
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
export function unwrapProfileUserWithAccountsByIdFound(value: ProfileUserWithAccountsByIdResult | TypedQueryResult<ProfileUserWithAccountsByIdResult>): ProfileUserWithAccountsByIdFound {
|
|
1343
|
+
const resolved = ("identity" in value && "applicationHead" in value && "value" in value ? value.value : value) as ProfileUserWithAccountsByIdResult;
|
|
1344
|
+
if (resolved.outcome !== "Found") throw new Error(`expected ProfileUserWithAccountsById outcome "Found", got "${resolved.outcome}"`);
|
|
1345
|
+
return resolved;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
export function redactProfileUserWithAccountsByIdResult(value: ProfileUserWithAccountsByIdResult): { readonly outcome: string; readonly redactedSecretOutputs: typeof PROFILE_USER_WITH_ACCOUNTS_BY_ID_SECRET_OUTPUTS } {
|
|
1349
|
+
return { outcome: value.outcome, redactedSecretOutputs: PROFILE_USER_WITH_ACCOUNTS_BY_ID_SECRET_OUTPUTS };
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
export function profileUserWithAccountsById(parameters: ProfileUserWithAccountsByIdParams): NamedQueryRequest<ProfileUserWithAccountsByIdParams, ProfileUserWithAccountsByIdResult> {
|
|
1353
|
+
return { driverOperation: { name: "riffdb_better_auth_core_profile_user_with_accounts_by_id", inputSchemaHash: "b36ab8632996b6bf3630a697bca331638b949de2e3f46abc2d612c0cb3d6afc9" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, contractBundleHash: CONTRACT_BUNDLE_HASH, moduleHash: QUERY_MODULE_HASH, queryName: "ProfileUserWithAccountsById", planHash: PROFILE_USER_WITH_ACCOUNTS_BY_ID_QUERY_PLAN_HASH, parameters, parameterSchema: {"fields":[{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"value","schema":{"kind":"uuid"}}],"kind":"record"}, resultSchemas: {"Found":{"fields":[{"name":"user","schema":{"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}}],"kind":"record"}},{"name":"accounts","schema":{"kind":"list","maximum":33,"value":{"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"account_id","schema":{"kind":"string"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"revision","schema":{"kind":"u64"}}],"kind":"record"}}}],"kind":"record"},"Missing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
export interface ConsumeVerificationInput {
|
|
1357
|
+
readonly request_id: string;
|
|
1358
|
+
readonly organization_id: string;
|
|
1359
|
+
readonly verification_id: string;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
export const CONSUME_VERIFICATION_SECRET_OUTPUTS = [
|
|
1363
|
+
{ outcome: "VerificationConsumed", field: "value", entity: "Verification", sourceField: "value" },
|
|
1364
|
+
] as const;
|
|
1365
|
+
|
|
1366
|
+
export type ConsumeVerificationOutcome = { readonly outcome: "VerificationConsumed"; readonly value: string; readonly revision: bigint; readonly created_at: { readonly seconds: bigint; readonly nanos: number }; readonly expires_at: { readonly seconds: bigint; readonly nanos: number }; readonly identifier: string; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly verification_id: string } | { readonly outcome: "VerificationConsumeMissing" };
|
|
1367
|
+
|
|
1368
|
+
export function isConsumeVerificationVerificationConsumed(value: ConsumeVerificationOutcome): value is Extract<ConsumeVerificationOutcome, { readonly outcome: "VerificationConsumed" }> {
|
|
1369
|
+
return value.outcome === "VerificationConsumed";
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
export function isConsumeVerificationVerificationConsumeMissing(value: ConsumeVerificationOutcome): value is Extract<ConsumeVerificationOutcome, { readonly outcome: "VerificationConsumeMissing" }> {
|
|
1373
|
+
return value.outcome === "VerificationConsumeMissing";
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
export function redactConsumeVerificationOutcome(value: ConsumeVerificationOutcome): { readonly outcome: string; readonly redactedSecretOutputs: typeof CONSUME_VERIFICATION_SECRET_OUTPUTS } {
|
|
1377
|
+
return { outcome: value.outcome, redactedSecretOutputs: CONSUME_VERIFICATION_SECRET_OUTPUTS };
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
export const CONSUME_VERIFICATION_PLAN_HASH = "19fa6c84843516bc8bf61b12b77c3a2a11ef187e35ee3e41b2beac55757e20eb" as const;
|
|
1381
|
+
export function consumeVerification(input: ConsumeVerificationInput): CommandRequest<ConsumeVerificationInput, ConsumeVerificationOutcome> {
|
|
1382
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1383
|
+
const resolvedInput: ConsumeVerificationInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1384
|
+
return { driverOperation: { name: "riffdb_better_auth_core_consume_verification", inputSchemaHash: "4e28ec5a411c2397de0d11fd9358879744a2b3f75c5855002b3cba62fb1d26c3" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "ConsumeVerification", planHash: CONSUME_VERIFICATION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"request_id","schema":{"kind":"uuid"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"verification_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"VerificationConsumeMissing":{"fields":[],"kind":"record"},"VerificationConsumed":{"fields":[{"name":"value","schema":{"kind":"string"},"wireId":1},{"name":"revision","schema":{"kind":"u64"},"wireId":2},{"name":"created_at","schema":{"kind":"timestamp"},"wireId":3},{"name":"expires_at","schema":{"kind":"timestamp"},"wireId":4},{"name":"identifier","schema":{"kind":"string"},"wireId":5},{"name":"updated_at","schema":{"kind":"timestamp"},"wireId":6},{"name":"verification_id","schema":{"kind":"uuid"},"wireId":7}],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
export interface ConsumeVerificationSetInput {
|
|
1388
|
+
readonly request_id: string;
|
|
1389
|
+
readonly organization_id: string;
|
|
1390
|
+
readonly verification_ids: ReadonlyArray<string>;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
export type ConsumeVerificationSetOutcome = { readonly outcome: "VerificationSetConsumed" } | { readonly outcome: "VerificationConsumeMissing" };
|
|
1394
|
+
|
|
1395
|
+
export function isConsumeVerificationSetVerificationSetConsumed(value: ConsumeVerificationSetOutcome): value is Extract<ConsumeVerificationSetOutcome, { readonly outcome: "VerificationSetConsumed" }> {
|
|
1396
|
+
return value.outcome === "VerificationSetConsumed";
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
export function isConsumeVerificationSetVerificationConsumeMissing(value: ConsumeVerificationSetOutcome): value is Extract<ConsumeVerificationSetOutcome, { readonly outcome: "VerificationConsumeMissing" }> {
|
|
1400
|
+
return value.outcome === "VerificationConsumeMissing";
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
export const CONSUME_VERIFICATION_SET_PLAN_HASH = "1545427bfaa7b1581797b5e83df8bae717e9f57ff91b8bec3749aeab3b2d2f75" as const;
|
|
1404
|
+
export function consumeVerificationSet(input: ConsumeVerificationSetInput): CommandRequest<ConsumeVerificationSetInput, ConsumeVerificationSetOutcome> {
|
|
1405
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1406
|
+
const resolvedInput: ConsumeVerificationSetInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1407
|
+
return { driverOperation: { name: "riffdb_better_auth_core_consume_verification_set", inputSchemaHash: "ce88d8052f760625503f8a732f9813446ef7cc042d726ee1826c05c437c0929c" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "ConsumeVerificationSet", planHash: CONSUME_VERIFICATION_SET_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"request_id","schema":{"kind":"uuid"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"verification_ids","schema":{"kind":"list","maximum":32,"minimum":1,"value":{"kind":"uuid"}}}],"kind":"record"}, outcomeSchemas: {"VerificationConsumeMissing":{"fields":[],"kind":"record"},"VerificationSetConsumed":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
export interface ConsumeVerificationSnapshotInput {
|
|
1411
|
+
readonly request_id: string;
|
|
1412
|
+
readonly organization_id: string;
|
|
1413
|
+
readonly verification_id: string;
|
|
1414
|
+
readonly expected_revision: bigint;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
export type ConsumeVerificationSnapshotOutcome = { readonly outcome: "VerificationConsumed" } | { readonly outcome: "VerificationConsumeStale" } | { readonly outcome: "VerificationConsumeMissing" };
|
|
1418
|
+
|
|
1419
|
+
export function isConsumeVerificationSnapshotVerificationConsumed(value: ConsumeVerificationSnapshotOutcome): value is Extract<ConsumeVerificationSnapshotOutcome, { readonly outcome: "VerificationConsumed" }> {
|
|
1420
|
+
return value.outcome === "VerificationConsumed";
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
export function isConsumeVerificationSnapshotVerificationConsumeStale(value: ConsumeVerificationSnapshotOutcome): value is Extract<ConsumeVerificationSnapshotOutcome, { readonly outcome: "VerificationConsumeStale" }> {
|
|
1424
|
+
return value.outcome === "VerificationConsumeStale";
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
export function isConsumeVerificationSnapshotVerificationConsumeMissing(value: ConsumeVerificationSnapshotOutcome): value is Extract<ConsumeVerificationSnapshotOutcome, { readonly outcome: "VerificationConsumeMissing" }> {
|
|
1428
|
+
return value.outcome === "VerificationConsumeMissing";
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
export const CONSUME_VERIFICATION_SNAPSHOT_PLAN_HASH = "4b5df61ae9e1dd93c8ca26035e178389ad241d166891d4eb29a9f89ac3829352" as const;
|
|
1432
|
+
export function consumeVerificationSnapshot(input: ConsumeVerificationSnapshotInput): CommandRequest<ConsumeVerificationSnapshotInput, ConsumeVerificationSnapshotOutcome> {
|
|
1433
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1434
|
+
const resolvedInput: ConsumeVerificationSnapshotInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1435
|
+
return { driverOperation: { name: "riffdb_better_auth_core_consume_verification_snapshot", inputSchemaHash: "d1ae264c5794d32e6619f9d52b77dd3a4cab39615dd48adb9a2a3b46ff92cd8c" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "ConsumeVerificationSnapshot", planHash: CONSUME_VERIFICATION_SNAPSHOT_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"request_id","schema":{"kind":"uuid"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"verification_id","schema":{"kind":"uuid"}},{"name":"expected_revision","schema":{"kind":"u64"}}],"kind":"record"}, outcomeSchemas: {"VerificationConsumeMissing":{"fields":[],"kind":"record"},"VerificationConsumeStale":{"fields":[],"kind":"record"},"VerificationConsumed":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
export interface CreateAccountInput {
|
|
1439
|
+
readonly id: string;
|
|
1440
|
+
readonly scope: string | null;
|
|
1441
|
+
readonly user_id: string;
|
|
1442
|
+
readonly id_token: string | null;
|
|
1443
|
+
readonly password: string | null;
|
|
1444
|
+
readonly account_id: string;
|
|
1445
|
+
readonly created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1446
|
+
readonly request_id: string;
|
|
1447
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1448
|
+
readonly provider_id: string;
|
|
1449
|
+
readonly access_token: string | null;
|
|
1450
|
+
readonly refresh_token: string | null;
|
|
1451
|
+
readonly organization_id: string;
|
|
1452
|
+
readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1453
|
+
readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
export type CreateAccountOutcome = { readonly outcome: "AccountCreated" } | { readonly outcome: "AccountUserMissing" } | { readonly outcome: "AccountAlreadyExists" };
|
|
1457
|
+
|
|
1458
|
+
export function isCreateAccountAccountCreated(value: CreateAccountOutcome): value is Extract<CreateAccountOutcome, { readonly outcome: "AccountCreated" }> {
|
|
1459
|
+
return value.outcome === "AccountCreated";
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
export function isCreateAccountAccountUserMissing(value: CreateAccountOutcome): value is Extract<CreateAccountOutcome, { readonly outcome: "AccountUserMissing" }> {
|
|
1463
|
+
return value.outcome === "AccountUserMissing";
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
export function isCreateAccountAccountAlreadyExists(value: CreateAccountOutcome): value is Extract<CreateAccountOutcome, { readonly outcome: "AccountAlreadyExists" }> {
|
|
1467
|
+
return value.outcome === "AccountAlreadyExists";
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
export const CREATE_ACCOUNT_PLAN_HASH = "7f36d8eda7a7e2d62c847ac079ced1329986dab9873d3e0a74711ce08ce55514" as const;
|
|
1471
|
+
export function createAccount(input: CreateAccountInput): CommandRequest<CreateAccountInput, CreateAccountOutcome> {
|
|
1472
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1473
|
+
const resolvedInput: CreateAccountInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1474
|
+
return { driverOperation: { name: "riffdb_better_auth_core_create_account", inputSchemaHash: "9f59abcc35f23822a34f3504905acaae3df3c62c0f60e6bcb65bd8768279c4f9" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "CreateAccount", planHash: CREATE_ACCOUNT_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"account_id","schema":{"kind":"string"}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}}],"kind":"record"}, outcomeSchemas: {"AccountAlreadyExists":{"fields":[],"kind":"record"},"AccountCreated":{"fields":[],"kind":"record"},"AccountUserMissing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
export interface CreateOAuthUserGraphInput {
|
|
1478
|
+
readonly scope: string | null;
|
|
1479
|
+
readonly user_id: string;
|
|
1480
|
+
readonly id_token: string | null;
|
|
1481
|
+
readonly password: string | null;
|
|
1482
|
+
readonly user_name: string;
|
|
1483
|
+
readonly account_id: string;
|
|
1484
|
+
readonly request_id: string;
|
|
1485
|
+
readonly user_email: string;
|
|
1486
|
+
readonly user_image: string | null;
|
|
1487
|
+
readonly provider_id: string;
|
|
1488
|
+
readonly user_locale: string | null;
|
|
1489
|
+
readonly access_token: string | null;
|
|
1490
|
+
readonly refresh_token: string | null;
|
|
1491
|
+
readonly organization_id: string;
|
|
1492
|
+
readonly user_created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1493
|
+
readonly user_date_field: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1494
|
+
readonly user_updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1495
|
+
readonly account_created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1496
|
+
readonly account_updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1497
|
+
readonly external_account_id: string;
|
|
1498
|
+
readonly user_email_verified: boolean;
|
|
1499
|
+
readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1500
|
+
readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
export type CreateOAuthUserGraphOutcome = { readonly outcome: "OAuthUserExists" } | { readonly outcome: "OAuthAccountExists" } | { readonly outcome: "OAuthUserGraphCreated" };
|
|
1504
|
+
|
|
1505
|
+
export function isCreateOAuthUserGraphOAuthUserExists(value: CreateOAuthUserGraphOutcome): value is Extract<CreateOAuthUserGraphOutcome, { readonly outcome: "OAuthUserExists" }> {
|
|
1506
|
+
return value.outcome === "OAuthUserExists";
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
export function isCreateOAuthUserGraphOAuthAccountExists(value: CreateOAuthUserGraphOutcome): value is Extract<CreateOAuthUserGraphOutcome, { readonly outcome: "OAuthAccountExists" }> {
|
|
1510
|
+
return value.outcome === "OAuthAccountExists";
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
export function isCreateOAuthUserGraphOAuthUserGraphCreated(value: CreateOAuthUserGraphOutcome): value is Extract<CreateOAuthUserGraphOutcome, { readonly outcome: "OAuthUserGraphCreated" }> {
|
|
1514
|
+
return value.outcome === "OAuthUserGraphCreated";
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
export const CREATE_O_AUTH_USER_GRAPH_PLAN_HASH = "b38cef15a18f63d11e491b17d3941048b8771e2fdca825c21821a187603077a4" as const;
|
|
1518
|
+
export function createOAuthUserGraph(input: CreateOAuthUserGraphInput): CommandRequest<CreateOAuthUserGraphInput, CreateOAuthUserGraphOutcome> {
|
|
1519
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1520
|
+
const resolvedInput: CreateOAuthUserGraphInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1521
|
+
return { driverOperation: { name: "riffdb_better_auth_core_create_o_auth_user_graph", inputSchemaHash: "1c3f9fac47e356c42ecf43565ab385d264c645e3b52e2ac68a9bc8ec8655cab7" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "CreateOAuthUserGraph", planHash: CREATE_O_AUTH_USER_GRAPH_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_name","schema":{"kind":"string"}},{"name":"account_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"user_email","schema":{"kind":"string"}},{"name":"user_image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"user_locale","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_created_at","schema":{"kind":"timestamp"}},{"name":"user_date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"user_updated_at","schema":{"kind":"timestamp"}},{"name":"account_created_at","schema":{"kind":"timestamp"}},{"name":"account_updated_at","schema":{"kind":"timestamp"}},{"name":"external_account_id","schema":{"kind":"string"}},{"name":"user_email_verified","schema":{"kind":"bool"}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}}],"kind":"record"}, outcomeSchemas: {"OAuthAccountExists":{"fields":[],"kind":"record"},"OAuthUserExists":{"fields":[],"kind":"record"},"OAuthUserGraphCreated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
export interface CreateSessionInput {
|
|
1525
|
+
readonly id: string;
|
|
1526
|
+
readonly token: string;
|
|
1527
|
+
readonly user_id: string;
|
|
1528
|
+
readonly created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1529
|
+
readonly expires_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1530
|
+
readonly ip_address: string | null;
|
|
1531
|
+
readonly request_id: string;
|
|
1532
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1533
|
+
readonly user_agent: string | null;
|
|
1534
|
+
readonly organization_id: string;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
export type CreateSessionOutcome = { readonly outcome: "SessionCreated" } | { readonly outcome: "SessionUserMissing" } | { readonly outcome: "SessionAlreadyExists" };
|
|
1538
|
+
|
|
1539
|
+
export function isCreateSessionSessionCreated(value: CreateSessionOutcome): value is Extract<CreateSessionOutcome, { readonly outcome: "SessionCreated" }> {
|
|
1540
|
+
return value.outcome === "SessionCreated";
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
export function isCreateSessionSessionUserMissing(value: CreateSessionOutcome): value is Extract<CreateSessionOutcome, { readonly outcome: "SessionUserMissing" }> {
|
|
1544
|
+
return value.outcome === "SessionUserMissing";
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
export function isCreateSessionSessionAlreadyExists(value: CreateSessionOutcome): value is Extract<CreateSessionOutcome, { readonly outcome: "SessionAlreadyExists" }> {
|
|
1548
|
+
return value.outcome === "SessionAlreadyExists";
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
export const CREATE_SESSION_PLAN_HASH = "6b1781167ff976b69b11ae5ccae5b1ad1233eda1679e5e42907f0dee0922c08a" as const;
|
|
1552
|
+
export function createSession(input: CreateSessionInput): CommandRequest<CreateSessionInput, CreateSessionOutcome> {
|
|
1553
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1554
|
+
const resolvedInput: CreateSessionInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1555
|
+
return { driverOperation: { name: "riffdb_better_auth_core_create_session", inputSchemaHash: "90f15b4cdb6f49df5e37b625173a07170d7975bbb4e8a8d1419071cd4f8a9312" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "CreateSession", planHash: CREATE_SESSION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"token","schema":{"kind":"string"}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"SessionAlreadyExists":{"fields":[],"kind":"record"},"SessionCreated":{"fields":[],"kind":"record"},"SessionUserMissing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
export interface CreateSignupGraphInput {
|
|
1559
|
+
readonly user_id: string;
|
|
1560
|
+
readonly user_name: string;
|
|
1561
|
+
readonly account_id: string;
|
|
1562
|
+
readonly request_id: string;
|
|
1563
|
+
readonly session_id: string;
|
|
1564
|
+
readonly user_email: string;
|
|
1565
|
+
readonly user_image: string | null;
|
|
1566
|
+
readonly provider_id: string;
|
|
1567
|
+
readonly user_locale: string | null;
|
|
1568
|
+
readonly session_token: string;
|
|
1569
|
+
readonly organization_id: string;
|
|
1570
|
+
readonly user_created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1571
|
+
readonly user_date_field: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1572
|
+
readonly user_updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1573
|
+
readonly account_password: string | null;
|
|
1574
|
+
readonly account_created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1575
|
+
readonly account_updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1576
|
+
readonly session_created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1577
|
+
readonly session_expires_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1578
|
+
readonly session_ip_address: string | null;
|
|
1579
|
+
readonly session_updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1580
|
+
readonly session_user_agent: string | null;
|
|
1581
|
+
readonly external_account_id: string;
|
|
1582
|
+
readonly user_email_verified: boolean;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
export type CreateSignupGraphOutcome = { readonly outcome: "SignupUserExists" } | { readonly outcome: "SignupGraphCreated" } | { readonly outcome: "SignupAccountExists" } | { readonly outcome: "SignupSessionExists" };
|
|
1586
|
+
|
|
1587
|
+
export function isCreateSignupGraphSignupUserExists(value: CreateSignupGraphOutcome): value is Extract<CreateSignupGraphOutcome, { readonly outcome: "SignupUserExists" }> {
|
|
1588
|
+
return value.outcome === "SignupUserExists";
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
export function isCreateSignupGraphSignupGraphCreated(value: CreateSignupGraphOutcome): value is Extract<CreateSignupGraphOutcome, { readonly outcome: "SignupGraphCreated" }> {
|
|
1592
|
+
return value.outcome === "SignupGraphCreated";
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
export function isCreateSignupGraphSignupAccountExists(value: CreateSignupGraphOutcome): value is Extract<CreateSignupGraphOutcome, { readonly outcome: "SignupAccountExists" }> {
|
|
1596
|
+
return value.outcome === "SignupAccountExists";
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
export function isCreateSignupGraphSignupSessionExists(value: CreateSignupGraphOutcome): value is Extract<CreateSignupGraphOutcome, { readonly outcome: "SignupSessionExists" }> {
|
|
1600
|
+
return value.outcome === "SignupSessionExists";
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
export const CREATE_SIGNUP_GRAPH_PLAN_HASH = "f3f2e0ffcc6f05e50f3caafc21b124cd08b79bbe6ce4498f3d8b3a8ba2aa7d67" as const;
|
|
1604
|
+
export function createSignupGraph(input: CreateSignupGraphInput): CommandRequest<CreateSignupGraphInput, CreateSignupGraphOutcome> {
|
|
1605
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1606
|
+
const resolvedInput: CreateSignupGraphInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1607
|
+
return { driverOperation: { name: "riffdb_better_auth_core_create_signup_graph", inputSchemaHash: "58a728840521574ea1ef22b5fa681b6578af003a7473a2bbeb53bc467eac61e0" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "CreateSignupGraph", planHash: CREATE_SIGNUP_GRAPH_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"user_name","schema":{"kind":"string"}},{"name":"account_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"session_id","schema":{"kind":"uuid"}},{"name":"user_email","schema":{"kind":"string"}},{"name":"user_image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"user_locale","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"session_token","schema":{"kind":"string"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"user_created_at","schema":{"kind":"timestamp"}},{"name":"user_date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"user_updated_at","schema":{"kind":"timestamp"}},{"name":"account_password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"account_created_at","schema":{"kind":"timestamp"}},{"name":"account_updated_at","schema":{"kind":"timestamp"}},{"name":"session_created_at","schema":{"kind":"timestamp"}},{"name":"session_expires_at","schema":{"kind":"timestamp"}},{"name":"session_ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"session_updated_at","schema":{"kind":"timestamp"}},{"name":"session_user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"external_account_id","schema":{"kind":"string"}},{"name":"user_email_verified","schema":{"kind":"bool"}}],"kind":"record"}, outcomeSchemas: {"SignupAccountExists":{"fields":[],"kind":"record"},"SignupGraphCreated":{"fields":[],"kind":"record"},"SignupSessionExists":{"fields":[],"kind":"record"},"SignupUserExists":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
export interface CreateUserInput {
|
|
1611
|
+
readonly id: string;
|
|
1612
|
+
readonly name: string;
|
|
1613
|
+
readonly email: string;
|
|
1614
|
+
readonly image: string | null;
|
|
1615
|
+
readonly locale: string | null;
|
|
1616
|
+
readonly created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1617
|
+
readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1618
|
+
readonly request_id: string;
|
|
1619
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1620
|
+
readonly email_verified: boolean;
|
|
1621
|
+
readonly organization_id: string;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
export type CreateUserOutcome = { readonly outcome: "UserCreated" } | { readonly outcome: "UserAlreadyExists" };
|
|
1625
|
+
|
|
1626
|
+
export function isCreateUserUserCreated(value: CreateUserOutcome): value is Extract<CreateUserOutcome, { readonly outcome: "UserCreated" }> {
|
|
1627
|
+
return value.outcome === "UserCreated";
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
export function isCreateUserUserAlreadyExists(value: CreateUserOutcome): value is Extract<CreateUserOutcome, { readonly outcome: "UserAlreadyExists" }> {
|
|
1631
|
+
return value.outcome === "UserAlreadyExists";
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
export const CREATE_USER_PLAN_HASH = "a03a8751aa63f4338978c1446bdf1cd9f9ebeb07d80858b2e01286a1d09503b5" as const;
|
|
1635
|
+
export function createUser(input: CreateUserInput): CommandRequest<CreateUserInput, CreateUserOutcome> {
|
|
1636
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1637
|
+
const resolvedInput: CreateUserInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1638
|
+
return { driverOperation: { name: "riffdb_better_auth_core_create_user", inputSchemaHash: "5eef6139856ea46c239c3e66aa346ee9c8547b07c24f7bd0c1710f88c5cbb0e4" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "CreateUser", planHash: CREATE_USER_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"UserAlreadyExists":{"fields":[],"kind":"record"},"UserCreated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
export interface CreateVerificationInput {
|
|
1642
|
+
readonly id: string;
|
|
1643
|
+
readonly value: string;
|
|
1644
|
+
readonly created_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1645
|
+
readonly expires_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1646
|
+
readonly identifier: string;
|
|
1647
|
+
readonly request_id: string;
|
|
1648
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1649
|
+
readonly organization_id: string;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
export type CreateVerificationOutcome = { readonly outcome: "VerificationCreated" } | { readonly outcome: "VerificationAlreadyExists" };
|
|
1653
|
+
|
|
1654
|
+
export function isCreateVerificationVerificationCreated(value: CreateVerificationOutcome): value is Extract<CreateVerificationOutcome, { readonly outcome: "VerificationCreated" }> {
|
|
1655
|
+
return value.outcome === "VerificationCreated";
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
export function isCreateVerificationVerificationAlreadyExists(value: CreateVerificationOutcome): value is Extract<CreateVerificationOutcome, { readonly outcome: "VerificationAlreadyExists" }> {
|
|
1659
|
+
return value.outcome === "VerificationAlreadyExists";
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
export const CREATE_VERIFICATION_PLAN_HASH = "fb8bc9c8dbacfb0319bb4e822b9cc3e0f0c83beb61d2840c7529b9362bac2ed3" as const;
|
|
1663
|
+
export function createVerification(input: CreateVerificationInput): CommandRequest<CreateVerificationInput, CreateVerificationOutcome> {
|
|
1664
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1665
|
+
const resolvedInput: CreateVerificationInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1666
|
+
return { driverOperation: { name: "riffdb_better_auth_core_create_verification", inputSchemaHash: "1df4414485ef2e463cee868bb97850b7a189a8c72c6090a650a1a1e0bd96baef" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "CreateVerification", planHash: CREATE_VERIFICATION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"id","schema":{"kind":"uuid"}},{"name":"value","schema":{"kind":"string"}},{"name":"created_at","schema":{"kind":"timestamp"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"identifier","schema":{"kind":"string"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"VerificationAlreadyExists":{"fields":[],"kind":"record"},"VerificationCreated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
export interface DeleteAccountInput {
|
|
1670
|
+
readonly user_id: string;
|
|
1671
|
+
readonly request_id: string;
|
|
1672
|
+
readonly account_ids: ReadonlyArray<string>;
|
|
1673
|
+
readonly organization_id: string;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
export type DeleteAccountOutcome = { readonly outcome: "AccountDeleted" } | { readonly outcome: "AccountMissing" };
|
|
1677
|
+
|
|
1678
|
+
export function isDeleteAccountAccountDeleted(value: DeleteAccountOutcome): value is Extract<DeleteAccountOutcome, { readonly outcome: "AccountDeleted" }> {
|
|
1679
|
+
return value.outcome === "AccountDeleted";
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
export function isDeleteAccountAccountMissing(value: DeleteAccountOutcome): value is Extract<DeleteAccountOutcome, { readonly outcome: "AccountMissing" }> {
|
|
1683
|
+
return value.outcome === "AccountMissing";
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
export const DELETE_ACCOUNT_PLAN_HASH = "1cb75e3e7a09d68b1fb2b9299fd6cb87703c9da1e0955756aef682d933b275d0" as const;
|
|
1687
|
+
export function deleteAccount(input: DeleteAccountInput): CommandRequest<DeleteAccountInput, DeleteAccountOutcome> {
|
|
1688
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1689
|
+
const resolvedInput: DeleteAccountInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1690
|
+
return { driverOperation: { name: "riffdb_better_auth_core_delete_account", inputSchemaHash: "8e512e4d77b1ced01a098641ce940e1440a4b63d4c3e2ddad9068a1faf9c2c11" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "DeleteAccount", planHash: DELETE_ACCOUNT_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"account_ids","schema":{"kind":"list","maximum":32,"minimum":1,"value":{"kind":"uuid"}}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"AccountDeleted":{"fields":[],"kind":"record"},"AccountMissing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
export interface DeleteSessionInput {
|
|
1694
|
+
readonly user_id: string;
|
|
1695
|
+
readonly request_id: string;
|
|
1696
|
+
readonly session_ids: ReadonlyArray<string>;
|
|
1697
|
+
readonly organization_id: string;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
export type DeleteSessionOutcome = { readonly outcome: "SessionDeleted" } | { readonly outcome: "SessionMissing" };
|
|
1701
|
+
|
|
1702
|
+
export function isDeleteSessionSessionDeleted(value: DeleteSessionOutcome): value is Extract<DeleteSessionOutcome, { readonly outcome: "SessionDeleted" }> {
|
|
1703
|
+
return value.outcome === "SessionDeleted";
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
export function isDeleteSessionSessionMissing(value: DeleteSessionOutcome): value is Extract<DeleteSessionOutcome, { readonly outcome: "SessionMissing" }> {
|
|
1707
|
+
return value.outcome === "SessionMissing";
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
export const DELETE_SESSION_PLAN_HASH = "e666aab82c5bfd211b9f134b37693cb976f8610f27db4949eded2820a6484612" as const;
|
|
1711
|
+
export function deleteSession(input: DeleteSessionInput): CommandRequest<DeleteSessionInput, DeleteSessionOutcome> {
|
|
1712
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1713
|
+
const resolvedInput: DeleteSessionInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1714
|
+
return { driverOperation: { name: "riffdb_better_auth_core_delete_session", inputSchemaHash: "6eeb9f3b452bb70a9b0e955dcb9e9a0115db479f3297a5d3c8b243a6e34974f7" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "DeleteSession", planHash: DELETE_SESSION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"session_ids","schema":{"kind":"list","maximum":32,"minimum":1,"value":{"kind":"uuid"}}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"SessionDeleted":{"fields":[],"kind":"record"},"SessionMissing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
export interface DeleteUserInput {
|
|
1718
|
+
readonly user_ids: ReadonlyArray<string>;
|
|
1719
|
+
readonly request_id: string;
|
|
1720
|
+
readonly organization_id: string;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
export type DeleteUserOutcome = { readonly outcome: "UserDeleted" } | { readonly outcome: "DeleteUserMissing" } | { readonly outcome: "DeleteUserCascadeLimitExceeded" };
|
|
1724
|
+
|
|
1725
|
+
export function isDeleteUserUserDeleted(value: DeleteUserOutcome): value is Extract<DeleteUserOutcome, { readonly outcome: "UserDeleted" }> {
|
|
1726
|
+
return value.outcome === "UserDeleted";
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
export function isDeleteUserDeleteUserMissing(value: DeleteUserOutcome): value is Extract<DeleteUserOutcome, { readonly outcome: "DeleteUserMissing" }> {
|
|
1730
|
+
return value.outcome === "DeleteUserMissing";
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
export function isDeleteUserDeleteUserCascadeLimitExceeded(value: DeleteUserOutcome): value is Extract<DeleteUserOutcome, { readonly outcome: "DeleteUserCascadeLimitExceeded" }> {
|
|
1734
|
+
return value.outcome === "DeleteUserCascadeLimitExceeded";
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
export const DELETE_USER_PLAN_HASH = "dd329f56ff3441a53c8e58080cee67813beeb5ca001fe1432e3e013eb9b8c3d1" as const;
|
|
1738
|
+
export function deleteUser(input: DeleteUserInput): CommandRequest<DeleteUserInput, DeleteUserOutcome> {
|
|
1739
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1740
|
+
const resolvedInput: DeleteUserInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1741
|
+
return { driverOperation: { name: "riffdb_better_auth_core_delete_user", inputSchemaHash: "c128e0333c57f08e3094e68459abbac53483952520e8381c0b79db903c36146d" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "DeleteUser", planHash: DELETE_USER_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_ids","schema":{"kind":"list","maximum":1,"minimum":1,"value":{"kind":"uuid"}}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"DeleteUserCascadeLimitExceeded":{"fields":[],"kind":"record"},"DeleteUserMissing":{"fields":[],"kind":"record"},"UserDeleted":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
export interface DeleteVerificationInput {
|
|
1745
|
+
readonly request_id: string;
|
|
1746
|
+
readonly organization_id: string;
|
|
1747
|
+
readonly verification_ids: ReadonlyArray<string>;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
export type DeleteVerificationOutcome = { readonly outcome: "VerificationDeleted" } | { readonly outcome: "VerificationMissing" };
|
|
1751
|
+
|
|
1752
|
+
export function isDeleteVerificationVerificationDeleted(value: DeleteVerificationOutcome): value is Extract<DeleteVerificationOutcome, { readonly outcome: "VerificationDeleted" }> {
|
|
1753
|
+
return value.outcome === "VerificationDeleted";
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
export function isDeleteVerificationVerificationMissing(value: DeleteVerificationOutcome): value is Extract<DeleteVerificationOutcome, { readonly outcome: "VerificationMissing" }> {
|
|
1757
|
+
return value.outcome === "VerificationMissing";
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
export const DELETE_VERIFICATION_PLAN_HASH = "10bbbfa72a6bbc023398edf8853d868e8a04a0b1646b39d6faabda3735178808" as const;
|
|
1761
|
+
export function deleteVerification(input: DeleteVerificationInput): CommandRequest<DeleteVerificationInput, DeleteVerificationOutcome> {
|
|
1762
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1763
|
+
const resolvedInput: DeleteVerificationInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1764
|
+
return { driverOperation: { name: "riffdb_better_auth_core_delete_verification", inputSchemaHash: "ce88d8052f760625503f8a732f9813446ef7cc042d726ee1826c05c437c0929c" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "DeleteVerification", planHash: DELETE_VERIFICATION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"request_id","schema":{"kind":"uuid"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"verification_ids","schema":{"kind":"list","maximum":32,"minimum":1,"value":{"kind":"uuid"}}}],"kind":"record"}, outcomeSchemas: {"VerificationDeleted":{"fields":[],"kind":"record"},"VerificationMissing":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
export interface ResetCredentialPasswordInput {
|
|
1768
|
+
readonly user_id: string;
|
|
1769
|
+
readonly password: string;
|
|
1770
|
+
readonly account_id: string;
|
|
1771
|
+
readonly request_id: string;
|
|
1772
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1773
|
+
readonly organization_id: string;
|
|
1774
|
+
readonly account_revision: bigint;
|
|
1775
|
+
readonly verification_ids: ReadonlyArray<string>;
|
|
1776
|
+
readonly external_account_id: string;
|
|
1777
|
+
readonly verification_revision: bigint;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
export type ResetCredentialPasswordOutcome = { readonly outcome: "PasswordAccountStale" } | { readonly outcome: "PasswordAccountMissing" } | { readonly outcome: "CredentialPasswordReset" } | { readonly outcome: "PasswordProviderMismatch" } | { readonly outcome: "VerificationConsumeStale" } | { readonly outcome: "VerificationConsumeMissing" };
|
|
1781
|
+
|
|
1782
|
+
export function isResetCredentialPasswordPasswordAccountStale(value: ResetCredentialPasswordOutcome): value is Extract<ResetCredentialPasswordOutcome, { readonly outcome: "PasswordAccountStale" }> {
|
|
1783
|
+
return value.outcome === "PasswordAccountStale";
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
export function isResetCredentialPasswordPasswordAccountMissing(value: ResetCredentialPasswordOutcome): value is Extract<ResetCredentialPasswordOutcome, { readonly outcome: "PasswordAccountMissing" }> {
|
|
1787
|
+
return value.outcome === "PasswordAccountMissing";
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
export function isResetCredentialPasswordCredentialPasswordReset(value: ResetCredentialPasswordOutcome): value is Extract<ResetCredentialPasswordOutcome, { readonly outcome: "CredentialPasswordReset" }> {
|
|
1791
|
+
return value.outcome === "CredentialPasswordReset";
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
export function isResetCredentialPasswordPasswordProviderMismatch(value: ResetCredentialPasswordOutcome): value is Extract<ResetCredentialPasswordOutcome, { readonly outcome: "PasswordProviderMismatch" }> {
|
|
1795
|
+
return value.outcome === "PasswordProviderMismatch";
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
export function isResetCredentialPasswordVerificationConsumeStale(value: ResetCredentialPasswordOutcome): value is Extract<ResetCredentialPasswordOutcome, { readonly outcome: "VerificationConsumeStale" }> {
|
|
1799
|
+
return value.outcome === "VerificationConsumeStale";
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
export function isResetCredentialPasswordVerificationConsumeMissing(value: ResetCredentialPasswordOutcome): value is Extract<ResetCredentialPasswordOutcome, { readonly outcome: "VerificationConsumeMissing" }> {
|
|
1803
|
+
return value.outcome === "VerificationConsumeMissing";
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
export const RESET_CREDENTIAL_PASSWORD_PLAN_HASH = "5e4d36f733ba1e44dcb94e4e0a4ea4e9870b58391ef0d82c29c21cd6b8ebbd3c" as const;
|
|
1807
|
+
export function resetCredentialPassword(input: ResetCredentialPasswordInput): CommandRequest<ResetCredentialPasswordInput, ResetCredentialPasswordOutcome> {
|
|
1808
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1809
|
+
const resolvedInput: ResetCredentialPasswordInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1810
|
+
return { driverOperation: { name: "riffdb_better_auth_core_reset_credential_password", inputSchemaHash: "b9959320d1fe50eba09aa488169566453c4ed9a58c27a338455e204b7f0c708d" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "ResetCredentialPassword", planHash: RESET_CREDENTIAL_PASSWORD_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"password","schema":{"kind":"string"}},{"name":"account_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"account_revision","schema":{"kind":"u64"}},{"name":"verification_ids","schema":{"kind":"list","maximum":1,"minimum":1,"value":{"kind":"uuid"}}},{"name":"external_account_id","schema":{"kind":"string"}},{"name":"verification_revision","schema":{"kind":"u64"}}],"kind":"record"}, outcomeSchemas: {"CredentialPasswordReset":{"fields":[],"kind":"record"},"PasswordAccountMissing":{"fields":[],"kind":"record"},"PasswordAccountStale":{"fields":[],"kind":"record"},"PasswordProviderMismatch":{"fields":[],"kind":"record"},"VerificationConsumeMissing":{"fields":[],"kind":"record"},"VerificationConsumeStale":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
export interface UpdateAccountInput {
|
|
1814
|
+
readonly scope: string | null;
|
|
1815
|
+
readonly user_id: string;
|
|
1816
|
+
readonly id_token: string | null;
|
|
1817
|
+
readonly password: string | null;
|
|
1818
|
+
readonly account_id: string;
|
|
1819
|
+
readonly request_id: string;
|
|
1820
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1821
|
+
readonly provider_id: string;
|
|
1822
|
+
readonly access_token: string | null;
|
|
1823
|
+
readonly refresh_token: string | null;
|
|
1824
|
+
readonly organization_id: string;
|
|
1825
|
+
readonly expected_revision: bigint;
|
|
1826
|
+
readonly external_account_id: string;
|
|
1827
|
+
readonly access_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1828
|
+
readonly refresh_token_expires_at: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
export type UpdateAccountOutcome = { readonly outcome: "AccountUpdated" } | { readonly outcome: "AccountUpdateStale" } | { readonly outcome: "AccountUpdateMissing" };
|
|
1832
|
+
|
|
1833
|
+
export function isUpdateAccountAccountUpdated(value: UpdateAccountOutcome): value is Extract<UpdateAccountOutcome, { readonly outcome: "AccountUpdated" }> {
|
|
1834
|
+
return value.outcome === "AccountUpdated";
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
export function isUpdateAccountAccountUpdateStale(value: UpdateAccountOutcome): value is Extract<UpdateAccountOutcome, { readonly outcome: "AccountUpdateStale" }> {
|
|
1838
|
+
return value.outcome === "AccountUpdateStale";
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
export function isUpdateAccountAccountUpdateMissing(value: UpdateAccountOutcome): value is Extract<UpdateAccountOutcome, { readonly outcome: "AccountUpdateMissing" }> {
|
|
1842
|
+
return value.outcome === "AccountUpdateMissing";
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
export const UPDATE_ACCOUNT_PLAN_HASH = "ab4c60ce1e1a05bb4c9bdb0d9aa72e39ba1553cc121f09cb6215e8ff1cac0c8b" as const;
|
|
1846
|
+
export function updateAccount(input: UpdateAccountInput): CommandRequest<UpdateAccountInput, UpdateAccountOutcome> {
|
|
1847
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1848
|
+
const resolvedInput: UpdateAccountInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1849
|
+
return { driverOperation: { name: "riffdb_better_auth_core_update_account", inputSchemaHash: "f623666040b60333eba3b4b46d5b1fe92158fcade5037f13b8ed0435e5c9471e" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "UpdateAccount", planHash: UPDATE_ACCOUNT_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"scope","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"id_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"account_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"provider_id","schema":{"kind":"string"}},{"name":"access_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"refresh_token","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"expected_revision","schema":{"kind":"u64"}},{"name":"external_account_id","schema":{"kind":"string"}},{"name":"access_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"refresh_token_expires_at","schema":{"kind":"optional","value":{"kind":"timestamp"}}}],"kind":"record"}, outcomeSchemas: {"AccountUpdateMissing":{"fields":[],"kind":"record"},"AccountUpdateStale":{"fields":[],"kind":"record"},"AccountUpdated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
export interface UpdateAccountPasswordsInput {
|
|
1853
|
+
readonly updates: ReadonlyArray<{ readonly user_id: string; readonly password: string | null; readonly account_id: string; readonly updated_at: { readonly seconds: bigint; readonly nanos: number }; readonly provider_id: string; readonly organization_id: string; readonly expected_revision: bigint }>;
|
|
1854
|
+
readonly user_id: string;
|
|
1855
|
+
readonly request_id: string;
|
|
1856
|
+
readonly organization_id: string;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
export type UpdateAccountPasswordsOutcome = { readonly outcome: "PasswordAccountStale" } | { readonly outcome: "PasswordAccountMissing" } | { readonly outcome: "AccountPasswordsUpdated" } | { readonly outcome: "PasswordProviderMismatch" };
|
|
1860
|
+
|
|
1861
|
+
export function isUpdateAccountPasswordsPasswordAccountStale(value: UpdateAccountPasswordsOutcome): value is Extract<UpdateAccountPasswordsOutcome, { readonly outcome: "PasswordAccountStale" }> {
|
|
1862
|
+
return value.outcome === "PasswordAccountStale";
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
export function isUpdateAccountPasswordsPasswordAccountMissing(value: UpdateAccountPasswordsOutcome): value is Extract<UpdateAccountPasswordsOutcome, { readonly outcome: "PasswordAccountMissing" }> {
|
|
1866
|
+
return value.outcome === "PasswordAccountMissing";
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
export function isUpdateAccountPasswordsAccountPasswordsUpdated(value: UpdateAccountPasswordsOutcome): value is Extract<UpdateAccountPasswordsOutcome, { readonly outcome: "AccountPasswordsUpdated" }> {
|
|
1870
|
+
return value.outcome === "AccountPasswordsUpdated";
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
export function isUpdateAccountPasswordsPasswordProviderMismatch(value: UpdateAccountPasswordsOutcome): value is Extract<UpdateAccountPasswordsOutcome, { readonly outcome: "PasswordProviderMismatch" }> {
|
|
1874
|
+
return value.outcome === "PasswordProviderMismatch";
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
export const UPDATE_ACCOUNT_PASSWORDS_PLAN_HASH = "16a4d018afc3eff4bcf7d3e2f7549a13c08cf70e22b1399f0e9773fab373ddf3" as const;
|
|
1878
|
+
export function updateAccountPasswords(input: UpdateAccountPasswordsInput): CommandRequest<UpdateAccountPasswordsInput, UpdateAccountPasswordsOutcome> {
|
|
1879
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1880
|
+
const resolvedInput: UpdateAccountPasswordsInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1881
|
+
return { driverOperation: { name: "riffdb_better_auth_core_update_account_passwords", inputSchemaHash: "f210cf13f349297bad0bd949bdfbb796e37ea4dfa24b99d6205942afdde0883c" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "UpdateAccountPasswords", planHash: UPDATE_ACCOUNT_PASSWORDS_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"updates","schema":{"kind":"list","maximum":8,"minimum":1,"value":{"fields":[{"name":"user_id","schema":{"kind":"uuid"},"wireId":1},{"name":"password","schema":{"kind":"optional","value":{"kind":"string"}},"wireId":2},{"name":"account_id","schema":{"kind":"uuid"},"wireId":3},{"name":"updated_at","schema":{"kind":"timestamp"},"wireId":4},{"name":"provider_id","schema":{"kind":"string"},"wireId":5},{"name":"organization_id","schema":{"kind":"uuid"},"wireId":6},{"name":"expected_revision","schema":{"kind":"u64"},"wireId":7}],"kind":"record"}}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"organization_id","schema":{"kind":"uuid"}}],"kind":"record"}, outcomeSchemas: {"AccountPasswordsUpdated":{"fields":[],"kind":"record"},"PasswordAccountMissing":{"fields":[],"kind":"record"},"PasswordAccountStale":{"fields":[],"kind":"record"},"PasswordProviderMismatch":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
export interface UpdateCredentialPasswordInput {
|
|
1885
|
+
readonly user_id: string;
|
|
1886
|
+
readonly password: string;
|
|
1887
|
+
readonly account_id: string;
|
|
1888
|
+
readonly request_id: string;
|
|
1889
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1890
|
+
readonly organization_id: string;
|
|
1891
|
+
readonly expected_revision: bigint;
|
|
1892
|
+
readonly external_account_id: string;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
export type UpdateCredentialPasswordOutcome = { readonly outcome: "PasswordAccountStale" } | { readonly outcome: "PasswordAccountMissing" } | { readonly outcome: "PasswordProviderMismatch" } | { readonly outcome: "CredentialPasswordUpdated" };
|
|
1896
|
+
|
|
1897
|
+
export function isUpdateCredentialPasswordPasswordAccountStale(value: UpdateCredentialPasswordOutcome): value is Extract<UpdateCredentialPasswordOutcome, { readonly outcome: "PasswordAccountStale" }> {
|
|
1898
|
+
return value.outcome === "PasswordAccountStale";
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
export function isUpdateCredentialPasswordPasswordAccountMissing(value: UpdateCredentialPasswordOutcome): value is Extract<UpdateCredentialPasswordOutcome, { readonly outcome: "PasswordAccountMissing" }> {
|
|
1902
|
+
return value.outcome === "PasswordAccountMissing";
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
export function isUpdateCredentialPasswordPasswordProviderMismatch(value: UpdateCredentialPasswordOutcome): value is Extract<UpdateCredentialPasswordOutcome, { readonly outcome: "PasswordProviderMismatch" }> {
|
|
1906
|
+
return value.outcome === "PasswordProviderMismatch";
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
export function isUpdateCredentialPasswordCredentialPasswordUpdated(value: UpdateCredentialPasswordOutcome): value is Extract<UpdateCredentialPasswordOutcome, { readonly outcome: "CredentialPasswordUpdated" }> {
|
|
1910
|
+
return value.outcome === "CredentialPasswordUpdated";
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
export const UPDATE_CREDENTIAL_PASSWORD_PLAN_HASH = "7784b4f6a0765b2de2486791a3b13253371c00ef809b498c37f0ec693c3ddefa" as const;
|
|
1914
|
+
export function updateCredentialPassword(input: UpdateCredentialPasswordInput): CommandRequest<UpdateCredentialPasswordInput, UpdateCredentialPasswordOutcome> {
|
|
1915
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1916
|
+
const resolvedInput: UpdateCredentialPasswordInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1917
|
+
return { driverOperation: { name: "riffdb_better_auth_core_update_credential_password", inputSchemaHash: "5d4589d948081b8f0d4472fa359bd34ca0c05895eac4e6a99f9015f8f45cc2e7" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "UpdateCredentialPassword", planHash: UPDATE_CREDENTIAL_PASSWORD_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"password","schema":{"kind":"string"}},{"name":"account_id","schema":{"kind":"uuid"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"expected_revision","schema":{"kind":"u64"}},{"name":"external_account_id","schema":{"kind":"string"}}],"kind":"record"}, outcomeSchemas: {"CredentialPasswordUpdated":{"fields":[],"kind":"record"},"PasswordAccountMissing":{"fields":[],"kind":"record"},"PasswordAccountStale":{"fields":[],"kind":"record"},"PasswordProviderMismatch":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
export interface UpdateSessionInput {
|
|
1921
|
+
readonly user_id: string;
|
|
1922
|
+
readonly expires_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1923
|
+
readonly ip_address: string | null;
|
|
1924
|
+
readonly request_id: string;
|
|
1925
|
+
readonly session_id: string;
|
|
1926
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1927
|
+
readonly user_agent: string | null;
|
|
1928
|
+
readonly organization_id: string;
|
|
1929
|
+
readonly expected_revision: bigint;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
export type UpdateSessionOutcome = { readonly outcome: "SessionUpdated" } | { readonly outcome: "SessionUpdateStale" } | { readonly outcome: "SessionUpdateMissing" };
|
|
1933
|
+
|
|
1934
|
+
export function isUpdateSessionSessionUpdated(value: UpdateSessionOutcome): value is Extract<UpdateSessionOutcome, { readonly outcome: "SessionUpdated" }> {
|
|
1935
|
+
return value.outcome === "SessionUpdated";
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
export function isUpdateSessionSessionUpdateStale(value: UpdateSessionOutcome): value is Extract<UpdateSessionOutcome, { readonly outcome: "SessionUpdateStale" }> {
|
|
1939
|
+
return value.outcome === "SessionUpdateStale";
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
export function isUpdateSessionSessionUpdateMissing(value: UpdateSessionOutcome): value is Extract<UpdateSessionOutcome, { readonly outcome: "SessionUpdateMissing" }> {
|
|
1943
|
+
return value.outcome === "SessionUpdateMissing";
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
export const UPDATE_SESSION_PLAN_HASH = "5647523809f40e2b96dfc5ec23243d4e93f918d2a618da9fd61ec2be7f69cc47" as const;
|
|
1947
|
+
export function updateSession(input: UpdateSessionInput): CommandRequest<UpdateSessionInput, UpdateSessionOutcome> {
|
|
1948
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1949
|
+
const resolvedInput: UpdateSessionInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1950
|
+
return { driverOperation: { name: "riffdb_better_auth_core_update_session", inputSchemaHash: "4dc035dba6c54788232952ebe5eb225c8f1e8e542ea3b20ef188f85fbfb1a1a1" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "UpdateSession", planHash: UPDATE_SESSION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"user_id","schema":{"kind":"uuid"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"ip_address","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"session_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"user_agent","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"expected_revision","schema":{"kind":"u64"}}],"kind":"record"}, outcomeSchemas: {"SessionUpdateMissing":{"fields":[],"kind":"record"},"SessionUpdateStale":{"fields":[],"kind":"record"},"SessionUpdated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
export interface UpdateUserInput {
|
|
1954
|
+
readonly name: string;
|
|
1955
|
+
readonly email: string;
|
|
1956
|
+
readonly image: string | null;
|
|
1957
|
+
readonly locale: string | null;
|
|
1958
|
+
readonly user_id: string;
|
|
1959
|
+
readonly date_field: { readonly seconds: bigint; readonly nanos: number } | null;
|
|
1960
|
+
readonly request_id: string;
|
|
1961
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1962
|
+
readonly email_verified: boolean;
|
|
1963
|
+
readonly organization_id: string;
|
|
1964
|
+
readonly expected_revision: bigint;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
export type UpdateUserOutcome = { readonly outcome: "UserUpdated" } | { readonly outcome: "UserUpdateStale" } | { readonly outcome: "UserUpdateMissing" };
|
|
1968
|
+
|
|
1969
|
+
export function isUpdateUserUserUpdated(value: UpdateUserOutcome): value is Extract<UpdateUserOutcome, { readonly outcome: "UserUpdated" }> {
|
|
1970
|
+
return value.outcome === "UserUpdated";
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
export function isUpdateUserUserUpdateStale(value: UpdateUserOutcome): value is Extract<UpdateUserOutcome, { readonly outcome: "UserUpdateStale" }> {
|
|
1974
|
+
return value.outcome === "UserUpdateStale";
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
export function isUpdateUserUserUpdateMissing(value: UpdateUserOutcome): value is Extract<UpdateUserOutcome, { readonly outcome: "UserUpdateMissing" }> {
|
|
1978
|
+
return value.outcome === "UserUpdateMissing";
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
export const UPDATE_USER_PLAN_HASH = "23fe689d0383112a3db43b7cca6e852608babd6042ea953db0f33fbcc7d4739b" as const;
|
|
1982
|
+
export function updateUser(input: UpdateUserInput): CommandRequest<UpdateUserInput, UpdateUserOutcome> {
|
|
1983
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
1984
|
+
const resolvedInput: UpdateUserInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
1985
|
+
return { driverOperation: { name: "riffdb_better_auth_core_update_user", inputSchemaHash: "2c760aa9861afd77f4abceee83a3a12425e38d964bbfd919f67a631a813cd82a" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "UpdateUser", planHash: UPDATE_USER_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"name","schema":{"kind":"string"}},{"name":"email","schema":{"kind":"string"}},{"name":"image","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"locale","schema":{"kind":"optional","value":{"kind":"string"}}},{"name":"user_id","schema":{"kind":"uuid"}},{"name":"date_field","schema":{"kind":"optional","value":{"kind":"timestamp"}}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"email_verified","schema":{"kind":"bool"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"expected_revision","schema":{"kind":"u64"}}],"kind":"record"}, outcomeSchemas: {"UserUpdateMissing":{"fields":[],"kind":"record"},"UserUpdateStale":{"fields":[],"kind":"record"},"UserUpdated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
export interface UpdateVerificationInput {
|
|
1989
|
+
readonly value: string;
|
|
1990
|
+
readonly expires_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1991
|
+
readonly request_id: string;
|
|
1992
|
+
readonly updated_at: { readonly seconds: bigint; readonly nanos: number };
|
|
1993
|
+
readonly organization_id: string;
|
|
1994
|
+
readonly verification_id: string;
|
|
1995
|
+
readonly expected_revision: bigint;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
export type UpdateVerificationOutcome = { readonly outcome: "VerificationUpdated" } | { readonly outcome: "VerificationUpdateStale" } | { readonly outcome: "VerificationUpdateMissing" };
|
|
1999
|
+
|
|
2000
|
+
export function isUpdateVerificationVerificationUpdated(value: UpdateVerificationOutcome): value is Extract<UpdateVerificationOutcome, { readonly outcome: "VerificationUpdated" }> {
|
|
2001
|
+
return value.outcome === "VerificationUpdated";
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
export function isUpdateVerificationVerificationUpdateStale(value: UpdateVerificationOutcome): value is Extract<UpdateVerificationOutcome, { readonly outcome: "VerificationUpdateStale" }> {
|
|
2005
|
+
return value.outcome === "VerificationUpdateStale";
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
export function isUpdateVerificationVerificationUpdateMissing(value: UpdateVerificationOutcome): value is Extract<UpdateVerificationOutcome, { readonly outcome: "VerificationUpdateMissing" }> {
|
|
2009
|
+
return value.outcome === "VerificationUpdateMissing";
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
export const UPDATE_VERIFICATION_PLAN_HASH = "96bcf79ae9819e3e1535a033c197b722e1b416a286c60395f11faf7f5f87a25b" as const;
|
|
2013
|
+
export function updateVerification(input: UpdateVerificationInput): CommandRequest<UpdateVerificationInput, UpdateVerificationOutcome> {
|
|
2014
|
+
const idempotencyKey = input.request_id && input.request_id.length > 0 ? input.request_id : globalThis.crypto.randomUUID();
|
|
2015
|
+
const resolvedInput: UpdateVerificationInput = input.request_id === idempotencyKey ? input : { ...input, request_id: idempotencyKey };
|
|
2016
|
+
return { driverOperation: { name: "riffdb_better_auth_core_update_verification", inputSchemaHash: "4377bfd8aba7795661e686fbc5903e8116b2f9eba24bce9fcdd63cd4bb53e8c5" }, contractLineage: CONTRACT_LINEAGE, contractVersion: CONTRACT_VERSION, commandName: "UpdateVerification", planHash: UPDATE_VERIFICATION_PLAN_HASH, input: resolvedInput, idempotencyKey, inputSchema: {"fields":[{"name":"value","schema":{"kind":"string"}},{"name":"expires_at","schema":{"kind":"timestamp"}},{"name":"request_id","schema":{"kind":"uuid"}},{"name":"updated_at","schema":{"kind":"timestamp"}},{"name":"organization_id","schema":{"kind":"uuid"}},{"name":"verification_id","schema":{"kind":"uuid"}},{"name":"expected_revision","schema":{"kind":"u64"}}],"kind":"record"}, outcomeSchemas: {"VerificationUpdateMissing":{"fields":[],"kind":"record"},"VerificationUpdateStale":{"fields":[],"kind":"record"},"VerificationUpdated":{"fields":[],"kind":"record"}}, decodeError: decodeApplicationError };
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
export class BetterAuthCustomFieldsClient {
|
|
2020
|
+
private lastCommitSeq: bigint | undefined;
|
|
2021
|
+
|
|
2022
|
+
public constructor(
|
|
2023
|
+
private readonly transport: ApplicationTransport,
|
|
2024
|
+
private readonly commandAttemptBudget: number = DEFAULT_COMMAND_ATTEMPT_BUDGET,
|
|
2025
|
+
defaultReadAfterCommit?: bigint,
|
|
2026
|
+
private readonly trackCausalWrites: boolean = true,
|
|
2027
|
+
) {
|
|
2028
|
+
if (!Number.isInteger(commandAttemptBudget) || commandAttemptBudget < 1) throw new Error("invalid command attempt budget");
|
|
2029
|
+
if (defaultReadAfterCommit !== undefined && defaultReadAfterCommit < 0n) throw new Error("invalid read-after-commit sequence");
|
|
2030
|
+
this.lastCommitSeq = defaultReadAfterCommit;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
public static fromTransport(transport: ApplicationTransport, commandAttemptBudget: number = DEFAULT_COMMAND_ATTEMPT_BUDGET): BetterAuthCustomFieldsClient {
|
|
2034
|
+
return new BetterAuthCustomFieldsClient(transport, commandAttemptBudget);
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
public static driverIdentity(role: string, database?: string): ContractDriverIdentity {
|
|
2038
|
+
return driverIdentity(role, database);
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
public static async connect(
|
|
2042
|
+
driver: { connect(config: { readonly socketPath: string; readonly identity: ContractDriverIdentity }): Promise<ApplicationTransport> } | ((config: { readonly socketPath: string; readonly identity: ContractDriverIdentity }) => Promise<ApplicationTransport>),
|
|
2043
|
+
options: { readonly socketPath: string; readonly role: string; readonly database?: string; readonly commandAttemptBudget?: number },
|
|
2044
|
+
): Promise<BetterAuthCustomFieldsClient> {
|
|
2045
|
+
const identity = driverIdentity(options.role, options.database);
|
|
2046
|
+
const transport = typeof driver === "function" ? await driver({ socketPath: options.socketPath, identity }) : await driver.connect({ socketPath: options.socketPath, identity });
|
|
2047
|
+
return new BetterAuthCustomFieldsClient(transport, options.commandAttemptBudget ?? DEFAULT_COMMAND_ATTEMPT_BUDGET);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
public static async connectFromEnv(
|
|
2051
|
+
driver: { connectFromEnv(options: { readonly socketPath?: string; readonly role?: string; readonly database?: string; readonly tenant?: string; readonly prefix?: string; readonly envPrefix?: string; readonly identity: typeof CONTRACT_DRIVER_IDENTITY }): Promise<ApplicationTransport> } | ((options: { readonly socketPath?: string; readonly role?: string; readonly database?: string; readonly tenant?: string; readonly prefix?: string; readonly envPrefix?: string; readonly identity: typeof CONTRACT_DRIVER_IDENTITY }) => Promise<ApplicationTransport>),
|
|
2052
|
+
options: { readonly socketPath?: string; readonly role?: string; readonly database?: string; readonly tenant?: string; readonly prefix?: string; readonly envPrefix?: string; readonly commandAttemptBudget?: number } = {},
|
|
2053
|
+
): Promise<BetterAuthCustomFieldsClient> {
|
|
2054
|
+
const { commandAttemptBudget, ...envOptions } = options;
|
|
2055
|
+
const connectInput = { ...envOptions, identity: CONTRACT_DRIVER_IDENTITY };
|
|
2056
|
+
const transport = typeof driver === "function" ? await driver(connectInput) : await driver.connectFromEnv(connectInput);
|
|
2057
|
+
return new BetterAuthCustomFieldsClient(transport, commandAttemptBudget ?? DEFAULT_COMMAND_ATTEMPT_BUDGET);
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
public withReadAfterCommit(commitSequence: bigint | undefined): BetterAuthCustomFieldsClient {
|
|
2061
|
+
return new BetterAuthCustomFieldsClient(this.transport, this.commandAttemptBudget, commitSequence, this.trackCausalWrites);
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
public causalSession(initialCommitSequence?: bigint): BetterAuthCustomFieldsClient {
|
|
2065
|
+
return new BetterAuthCustomFieldsClient(this.transport, this.commandAttemptBudget, initialCommitSequence ?? this.lastCommitSeq, true);
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
public get lastCommitSequence(): bigint | undefined {
|
|
2069
|
+
return this.lastCommitSeq;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
public async adminUsersAllEmailAsc(parameters: AdminUsersAllEmailAscParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersAllEmailAscResult>> {
|
|
2073
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2074
|
+
const request = adminUsersAllEmailAsc(parameters);
|
|
2075
|
+
const result = await this.transport.executeNamedQuery<AdminUsersAllEmailAscParams, AdminUsersAllEmailAscResult>(request, effectiveOptions);
|
|
2076
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2077
|
+
return result;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
public async adminUsersAllEmailAscAfterCommit(parameters: AdminUsersAllEmailAscParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersAllEmailAscResult>> {
|
|
2081
|
+
return this.adminUsersAllEmailAsc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
public async adminUsersContainsAsc(parameters: AdminUsersContainsAscParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersContainsAscResult>> {
|
|
2085
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2086
|
+
const request = adminUsersContainsAsc(parameters);
|
|
2087
|
+
const result = await this.transport.executeNamedQuery<AdminUsersContainsAscParams, AdminUsersContainsAscResult>(request, effectiveOptions);
|
|
2088
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2089
|
+
return result;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
public async adminUsersContainsAscAfterCommit(parameters: AdminUsersContainsAscParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersContainsAscResult>> {
|
|
2093
|
+
return this.adminUsersContainsAsc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
public async adminUsersContainsDesc(parameters: AdminUsersContainsDescParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersContainsDescResult>> {
|
|
2097
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2098
|
+
const request = adminUsersContainsDesc(parameters);
|
|
2099
|
+
const result = await this.transport.executeNamedQuery<AdminUsersContainsDescParams, AdminUsersContainsDescResult>(request, effectiveOptions);
|
|
2100
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2101
|
+
return result;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
public async adminUsersContainsDescAfterCommit(parameters: AdminUsersContainsDescParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersContainsDescResult>> {
|
|
2105
|
+
return this.adminUsersContainsDesc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
public async adminUsersEmailContainsCreatedDesc(parameters: AdminUsersEmailContainsCreatedDescParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEmailContainsCreatedDescResult>> {
|
|
2109
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2110
|
+
const request = adminUsersEmailContainsCreatedDesc(parameters);
|
|
2111
|
+
const result = await this.transport.executeNamedQuery<AdminUsersEmailContainsCreatedDescParams, AdminUsersEmailContainsCreatedDescResult>(request, effectiveOptions);
|
|
2112
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2113
|
+
return result;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
public async adminUsersEmailContainsCreatedDescAfterCommit(parameters: AdminUsersEmailContainsCreatedDescParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEmailContainsCreatedDescResult>> {
|
|
2117
|
+
return this.adminUsersEmailContainsCreatedDesc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
public async adminUsersEmailContainsImageAsc(parameters: AdminUsersEmailContainsImageAscParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEmailContainsImageAscResult>> {
|
|
2121
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2122
|
+
const request = adminUsersEmailContainsImageAsc(parameters);
|
|
2123
|
+
const result = await this.transport.executeNamedQuery<AdminUsersEmailContainsImageAscParams, AdminUsersEmailContainsImageAscResult>(request, effectiveOptions);
|
|
2124
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2125
|
+
return result;
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
public async adminUsersEmailContainsImageAscAfterCommit(parameters: AdminUsersEmailContainsImageAscParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEmailContainsImageAscResult>> {
|
|
2129
|
+
return this.adminUsersEmailContainsImageAsc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
public async adminUsersEndsWithAsc(parameters: AdminUsersEndsWithAscParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEndsWithAscResult>> {
|
|
2133
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2134
|
+
const request = adminUsersEndsWithAsc(parameters);
|
|
2135
|
+
const result = await this.transport.executeNamedQuery<AdminUsersEndsWithAscParams, AdminUsersEndsWithAscResult>(request, effectiveOptions);
|
|
2136
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2137
|
+
return result;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
public async adminUsersEndsWithAscAfterCommit(parameters: AdminUsersEndsWithAscParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEndsWithAscResult>> {
|
|
2141
|
+
return this.adminUsersEndsWithAsc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
public async adminUsersEndsWithDesc(parameters: AdminUsersEndsWithDescParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEndsWithDescResult>> {
|
|
2145
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2146
|
+
const request = adminUsersEndsWithDesc(parameters);
|
|
2147
|
+
const result = await this.transport.executeNamedQuery<AdminUsersEndsWithDescParams, AdminUsersEndsWithDescResult>(request, effectiveOptions);
|
|
2148
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2149
|
+
return result;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
public async adminUsersEndsWithDescAfterCommit(parameters: AdminUsersEndsWithDescParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersEndsWithDescResult>> {
|
|
2153
|
+
return this.adminUsersEndsWithDesc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
public async adminUsersStartsWithAsc(parameters: AdminUsersStartsWithAscParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersStartsWithAscResult>> {
|
|
2157
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2158
|
+
const request = adminUsersStartsWithAsc(parameters);
|
|
2159
|
+
const result = await this.transport.executeNamedQuery<AdminUsersStartsWithAscParams, AdminUsersStartsWithAscResult>(request, effectiveOptions);
|
|
2160
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2161
|
+
return result;
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
public async adminUsersStartsWithAscAfterCommit(parameters: AdminUsersStartsWithAscParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersStartsWithAscResult>> {
|
|
2165
|
+
return this.adminUsersStartsWithAsc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
public async adminUsersStartsWithDesc(parameters: AdminUsersStartsWithDescParams, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersStartsWithDescResult>> {
|
|
2169
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2170
|
+
const request = adminUsersStartsWithDesc(parameters);
|
|
2171
|
+
const result = await this.transport.executeNamedQuery<AdminUsersStartsWithDescParams, AdminUsersStartsWithDescResult>(request, effectiveOptions);
|
|
2172
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2173
|
+
return result;
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
public async adminUsersStartsWithDescAfterCommit(parameters: AdminUsersStartsWithDescParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<AdminUsersStartsWithDescResult>> {
|
|
2177
|
+
return this.adminUsersStartsWithDesc(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
public async findAccountById(parameters: FindAccountByIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountByIdResult>> {
|
|
2181
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2182
|
+
const request = findAccountById(parameters);
|
|
2183
|
+
const result = await this.transport.executeNamedQuery<FindAccountByIdParams, FindAccountByIdResult>(request, effectiveOptions);
|
|
2184
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2185
|
+
return result;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
public async findAccountByIdAfterCommit(parameters: FindAccountByIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountByIdResult>> {
|
|
2189
|
+
return this.findAccountById(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
public async findAccountByProvider(parameters: FindAccountByProviderParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountByProviderResult>> {
|
|
2193
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2194
|
+
const request = findAccountByProvider(parameters);
|
|
2195
|
+
const result = await this.transport.executeNamedQuery<FindAccountByProviderParams, FindAccountByProviderResult>(request, effectiveOptions);
|
|
2196
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2197
|
+
return result;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
public async findAccountByProviderAfterCommit(parameters: FindAccountByProviderParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountByProviderResult>> {
|
|
2201
|
+
return this.findAccountByProvider(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
public async findAccountsByUserId(parameters: FindAccountsByUserIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountsByUserIdResult>> {
|
|
2205
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2206
|
+
const { after: generatedCursor, ...routedParameters } = parameters;
|
|
2207
|
+
if (generatedCursor != null && options.cursor !== undefined) throw new Error("generated cursor conflicts with query options");
|
|
2208
|
+
const routedOptions: QueryOptions = generatedCursor == null ? effectiveOptions : { ...effectiveOptions, cursor: generatedCursor };
|
|
2209
|
+
const request = findAccountsByUserId(routedParameters as unknown as FindAccountsByUserIdParams);
|
|
2210
|
+
const result = await this.transport.executeNamedQuery<FindAccountsByUserIdParams, FindAccountsByUserIdResult>(request, routedOptions);
|
|
2211
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2212
|
+
return result;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
public async findAccountsByUserIdAfterCommit(parameters: FindAccountsByUserIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountsByUserIdResult>> {
|
|
2216
|
+
return this.findAccountsByUserId(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
public async *findAccountsByUserIdPages(parameters: FindAccountsByUserIdParams, maxPages: number = 64, options: QueryOptions = {}): AsyncGenerator<TypedQueryResult<FindAccountsByUserIdResult>, void, undefined> {
|
|
2220
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2221
|
+
let currentParameters = parameters;
|
|
2222
|
+
let currentOptions = options;
|
|
2223
|
+
for (let pageIndex = 0; pageIndex < maxPages; pageIndex += 1) {
|
|
2224
|
+
const page = await this.findAccountsByUserId(currentParameters, currentOptions);
|
|
2225
|
+
yield page;
|
|
2226
|
+
if (page.nextCursor === undefined) return;
|
|
2227
|
+
const { after: _ignoredCursor, ...restParameters } = currentParameters;
|
|
2228
|
+
currentParameters = restParameters as unknown as FindAccountsByUserIdParams;
|
|
2229
|
+
currentOptions = { ...currentOptions, cursor: page.nextCursor };
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
public async findAccountsByUserProvider(parameters: FindAccountsByUserProviderParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountsByUserProviderResult>> {
|
|
2234
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2235
|
+
const { after: generatedCursor, ...routedParameters } = parameters;
|
|
2236
|
+
if (generatedCursor != null && options.cursor !== undefined) throw new Error("generated cursor conflicts with query options");
|
|
2237
|
+
const routedOptions: QueryOptions = generatedCursor == null ? effectiveOptions : { ...effectiveOptions, cursor: generatedCursor };
|
|
2238
|
+
const request = findAccountsByUserProvider(routedParameters as unknown as FindAccountsByUserProviderParams);
|
|
2239
|
+
const result = await this.transport.executeNamedQuery<FindAccountsByUserProviderParams, FindAccountsByUserProviderResult>(request, routedOptions);
|
|
2240
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2241
|
+
return result;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
public async findAccountsByUserProviderAfterCommit(parameters: FindAccountsByUserProviderParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindAccountsByUserProviderResult>> {
|
|
2245
|
+
return this.findAccountsByUserProvider(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
public async *findAccountsByUserProviderPages(parameters: FindAccountsByUserProviderParams, maxPages: number = 64, options: QueryOptions = {}): AsyncGenerator<TypedQueryResult<FindAccountsByUserProviderResult>, void, undefined> {
|
|
2249
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2250
|
+
let currentParameters = parameters;
|
|
2251
|
+
let currentOptions = options;
|
|
2252
|
+
for (let pageIndex = 0; pageIndex < maxPages; pageIndex += 1) {
|
|
2253
|
+
const page = await this.findAccountsByUserProvider(currentParameters, currentOptions);
|
|
2254
|
+
yield page;
|
|
2255
|
+
if (page.nextCursor === undefined) return;
|
|
2256
|
+
const { after: _ignoredCursor, ...restParameters } = currentParameters;
|
|
2257
|
+
currentParameters = restParameters as unknown as FindAccountsByUserProviderParams;
|
|
2258
|
+
currentOptions = { ...currentOptions, cursor: page.nextCursor };
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
public async findActiveSessionsByUserId(parameters: FindActiveSessionsByUserIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindActiveSessionsByUserIdResult>> {
|
|
2263
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2264
|
+
const { after: generatedCursor, ...routedParameters } = parameters;
|
|
2265
|
+
if (generatedCursor != null && options.cursor !== undefined) throw new Error("generated cursor conflicts with query options");
|
|
2266
|
+
const routedOptions: QueryOptions = generatedCursor == null ? effectiveOptions : { ...effectiveOptions, cursor: generatedCursor };
|
|
2267
|
+
const request = findActiveSessionsByUserId(routedParameters as unknown as FindActiveSessionsByUserIdParams);
|
|
2268
|
+
const result = await this.transport.executeNamedQuery<FindActiveSessionsByUserIdParams, FindActiveSessionsByUserIdResult>(request, routedOptions);
|
|
2269
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2270
|
+
return result;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
public async findActiveSessionsByUserIdAfterCommit(parameters: FindActiveSessionsByUserIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindActiveSessionsByUserIdResult>> {
|
|
2274
|
+
return this.findActiveSessionsByUserId(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
public async *findActiveSessionsByUserIdPages(parameters: FindActiveSessionsByUserIdParams, maxPages: number = 64, options: QueryOptions = {}): AsyncGenerator<TypedQueryResult<FindActiveSessionsByUserIdResult>, void, undefined> {
|
|
2278
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2279
|
+
let currentParameters = parameters;
|
|
2280
|
+
let currentOptions = options;
|
|
2281
|
+
for (let pageIndex = 0; pageIndex < maxPages; pageIndex += 1) {
|
|
2282
|
+
const page = await this.findActiveSessionsByUserId(currentParameters, currentOptions);
|
|
2283
|
+
yield page;
|
|
2284
|
+
if (page.nextCursor === undefined) return;
|
|
2285
|
+
const { after: _ignoredCursor, ...restParameters } = currentParameters;
|
|
2286
|
+
currentParameters = restParameters as unknown as FindActiveSessionsByUserIdParams;
|
|
2287
|
+
currentOptions = { ...currentOptions, cursor: page.nextCursor };
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
public async findCredentialAccount(parameters: FindCredentialAccountParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindCredentialAccountResult>> {
|
|
2292
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2293
|
+
const request = findCredentialAccount(parameters);
|
|
2294
|
+
const result = await this.transport.executeNamedQuery<FindCredentialAccountParams, FindCredentialAccountResult>(request, effectiveOptions);
|
|
2295
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2296
|
+
return result;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
public async findCredentialAccountAfterCommit(parameters: FindCredentialAccountParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindCredentialAccountResult>> {
|
|
2300
|
+
return this.findCredentialAccount(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
public async findExpiredVerificationIds(parameters: FindExpiredVerificationIdsParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindExpiredVerificationIdsResult>> {
|
|
2304
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2305
|
+
const { after: generatedCursor, ...routedParameters } = parameters;
|
|
2306
|
+
if (generatedCursor != null && options.cursor !== undefined) throw new Error("generated cursor conflicts with query options");
|
|
2307
|
+
const routedOptions: QueryOptions = generatedCursor == null ? effectiveOptions : { ...effectiveOptions, cursor: generatedCursor };
|
|
2308
|
+
const request = findExpiredVerificationIds(routedParameters as unknown as FindExpiredVerificationIdsParams);
|
|
2309
|
+
const result = await this.transport.executeNamedQuery<FindExpiredVerificationIdsParams, FindExpiredVerificationIdsResult>(request, routedOptions);
|
|
2310
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2311
|
+
return result;
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
public async findExpiredVerificationIdsAfterCommit(parameters: FindExpiredVerificationIdsParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindExpiredVerificationIdsResult>> {
|
|
2315
|
+
return this.findExpiredVerificationIds(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
public async *findExpiredVerificationIdsPages(parameters: FindExpiredVerificationIdsParams, maxPages: number = 64, options: QueryOptions = {}): AsyncGenerator<TypedQueryResult<FindExpiredVerificationIdsResult>, void, undefined> {
|
|
2319
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2320
|
+
let currentParameters = parameters;
|
|
2321
|
+
let currentOptions = options;
|
|
2322
|
+
for (let pageIndex = 0; pageIndex < maxPages; pageIndex += 1) {
|
|
2323
|
+
const page = await this.findExpiredVerificationIds(currentParameters, currentOptions);
|
|
2324
|
+
yield page;
|
|
2325
|
+
if (page.nextCursor === undefined) return;
|
|
2326
|
+
const { after: _ignoredCursor, ...restParameters } = currentParameters;
|
|
2327
|
+
currentParameters = restParameters as unknown as FindExpiredVerificationIdsParams;
|
|
2328
|
+
currentOptions = { ...currentOptions, cursor: page.nextCursor };
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
public async findLatestVerification(parameters: FindLatestVerificationParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindLatestVerificationResult>> {
|
|
2333
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2334
|
+
const request = findLatestVerification(parameters);
|
|
2335
|
+
const result = await this.transport.executeNamedQuery<FindLatestVerificationParams, FindLatestVerificationResult>(request, effectiveOptions);
|
|
2336
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2337
|
+
return result;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
public async findLatestVerificationAfterCommit(parameters: FindLatestVerificationParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindLatestVerificationResult>> {
|
|
2341
|
+
return this.findLatestVerification(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
public async findSessionById(parameters: FindSessionByIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionByIdResult>> {
|
|
2345
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2346
|
+
const request = findSessionById(parameters);
|
|
2347
|
+
const result = await this.transport.executeNamedQuery<FindSessionByIdParams, FindSessionByIdResult>(request, effectiveOptions);
|
|
2348
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2349
|
+
return result;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
public async findSessionByIdAfterCommit(parameters: FindSessionByIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionByIdResult>> {
|
|
2353
|
+
return this.findSessionById(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
public async findSessionByToken(parameters: FindSessionByTokenParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionByTokenResult>> {
|
|
2357
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2358
|
+
const request = findSessionByToken(parameters);
|
|
2359
|
+
const result = await this.transport.executeNamedQuery<FindSessionByTokenParams, FindSessionByTokenResult>(request, effectiveOptions);
|
|
2360
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2361
|
+
return result;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
public async findSessionByTokenAfterCommit(parameters: FindSessionByTokenParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionByTokenResult>> {
|
|
2365
|
+
return this.findSessionByToken(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
public async findSessionsByTokenSet(parameters: FindSessionsByTokenSetParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionsByTokenSetResult>> {
|
|
2369
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2370
|
+
const request = findSessionsByTokenSet(parameters);
|
|
2371
|
+
const result = await this.transport.executeNamedQuery<FindSessionsByTokenSetParams, FindSessionsByTokenSetResult>(request, effectiveOptions);
|
|
2372
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2373
|
+
return result;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
public async findSessionsByTokenSetAfterCommit(parameters: FindSessionsByTokenSetParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionsByTokenSetResult>> {
|
|
2377
|
+
return this.findSessionsByTokenSet(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
public async findSessionsByTokenSetAll(parameters: FindSessionsByTokenSetParams, maxPages: number = 64, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionsByTokenSetFound>> {
|
|
2381
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2382
|
+
if (options.cursor !== undefined) throw new Error("findSessionsByTokenSetAll does not accept an initial cursor");
|
|
2383
|
+
const items = Array.from(new Set(parameters.tokens));
|
|
2384
|
+
if (items.length === 0) throw new RangeError("tokens must contain at least 1 item");
|
|
2385
|
+
const merged: Array<FindSessionsByTokenSetFound["sessions"][number]> = [];
|
|
2386
|
+
let latestIdentity: QueryResponseIdentity | undefined;
|
|
2387
|
+
let pinnedHead: bigint | undefined = options.readAfterCommit ?? this.lastCommitSeq;
|
|
2388
|
+
let highestHead = 0n;
|
|
2389
|
+
let pagesRemaining = maxPages;
|
|
2390
|
+
for (let offset = 0; offset < items.length; offset += FIND_SESSIONS_BY_TOKEN_SET_TOKENS_MAX_ITEMS) {
|
|
2391
|
+
const chunk = items.slice(offset, offset + FIND_SESSIONS_BY_TOKEN_SET_TOKENS_MAX_ITEMS);
|
|
2392
|
+
let chunkCursor: string | undefined = undefined;
|
|
2393
|
+
while (true) {
|
|
2394
|
+
if (pagesRemaining < 1) throw new RangeError("findSessionsByTokenSetAll exceeded maxPages (1..=1024)");
|
|
2395
|
+
pagesRemaining -= 1;
|
|
2396
|
+
const chunkOptions: QueryOptions = { ...options, ...(pinnedHead === undefined ? {} : { readAfterCommit: pinnedHead }), ...(chunkCursor === undefined ? {} : { cursor: chunkCursor }) };
|
|
2397
|
+
const page = await this.findSessionsByTokenSet({ ...parameters, tokens: chunk }, chunkOptions);
|
|
2398
|
+
const found = unwrapFindSessionsByTokenSetFound(page);
|
|
2399
|
+
merged.push(...found.sessions);
|
|
2400
|
+
latestIdentity = page.identity;
|
|
2401
|
+
if (page.applicationHead > highestHead) highestHead = page.applicationHead;
|
|
2402
|
+
if (pinnedHead === undefined || page.applicationHead > pinnedHead) pinnedHead = page.applicationHead;
|
|
2403
|
+
if (page.nextCursor === undefined) break;
|
|
2404
|
+
chunkCursor = page.nextCursor;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
return { identity: latestIdentity!, value: { outcome: "Found", sessions: merged }, applicationHead: highestHead };
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
public async findSessionsByUserId(parameters: FindSessionsByUserIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionsByUserIdResult>> {
|
|
2411
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2412
|
+
const { after: generatedCursor, ...routedParameters } = parameters;
|
|
2413
|
+
if (generatedCursor != null && options.cursor !== undefined) throw new Error("generated cursor conflicts with query options");
|
|
2414
|
+
const routedOptions: QueryOptions = generatedCursor == null ? effectiveOptions : { ...effectiveOptions, cursor: generatedCursor };
|
|
2415
|
+
const request = findSessionsByUserId(routedParameters as unknown as FindSessionsByUserIdParams);
|
|
2416
|
+
const result = await this.transport.executeNamedQuery<FindSessionsByUserIdParams, FindSessionsByUserIdResult>(request, routedOptions);
|
|
2417
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2418
|
+
return result;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
public async findSessionsByUserIdAfterCommit(parameters: FindSessionsByUserIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindSessionsByUserIdResult>> {
|
|
2422
|
+
return this.findSessionsByUserId(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
public async *findSessionsByUserIdPages(parameters: FindSessionsByUserIdParams, maxPages: number = 64, options: QueryOptions = {}): AsyncGenerator<TypedQueryResult<FindSessionsByUserIdResult>, void, undefined> {
|
|
2426
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2427
|
+
let currentParameters = parameters;
|
|
2428
|
+
let currentOptions = options;
|
|
2429
|
+
for (let pageIndex = 0; pageIndex < maxPages; pageIndex += 1) {
|
|
2430
|
+
const page = await this.findSessionsByUserId(currentParameters, currentOptions);
|
|
2431
|
+
yield page;
|
|
2432
|
+
if (page.nextCursor === undefined) return;
|
|
2433
|
+
const { after: _ignoredCursor, ...restParameters } = currentParameters;
|
|
2434
|
+
currentParameters = restParameters as unknown as FindSessionsByUserIdParams;
|
|
2435
|
+
currentOptions = { ...currentOptions, cursor: page.nextCursor };
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
public async findUserByEmail(parameters: FindUserByEmailParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindUserByEmailResult>> {
|
|
2440
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2441
|
+
const request = findUserByEmail(parameters);
|
|
2442
|
+
const result = await this.transport.executeNamedQuery<FindUserByEmailParams, FindUserByEmailResult>(request, effectiveOptions);
|
|
2443
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2444
|
+
return result;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
public async findUserByEmailAfterCommit(parameters: FindUserByEmailParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindUserByEmailResult>> {
|
|
2448
|
+
return this.findUserByEmail(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
public async findUserById(parameters: FindUserByIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindUserByIdResult>> {
|
|
2452
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2453
|
+
const request = findUserById(parameters);
|
|
2454
|
+
const result = await this.transport.executeNamedQuery<FindUserByIdParams, FindUserByIdResult>(request, effectiveOptions);
|
|
2455
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2456
|
+
return result;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
public async findUserByIdAfterCommit(parameters: FindUserByIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindUserByIdResult>> {
|
|
2460
|
+
return this.findUserById(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
public async findVerificationById(parameters: FindVerificationByIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindVerificationByIdResult>> {
|
|
2464
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2465
|
+
const request = findVerificationById(parameters);
|
|
2466
|
+
const result = await this.transport.executeNamedQuery<FindVerificationByIdParams, FindVerificationByIdResult>(request, effectiveOptions);
|
|
2467
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2468
|
+
return result;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
public async findVerificationByIdAfterCommit(parameters: FindVerificationByIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindVerificationByIdResult>> {
|
|
2472
|
+
return this.findVerificationById(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
public async findVerificationsByIdentifier(parameters: FindVerificationsByIdentifierParams, options: QueryOptions = {}): Promise<TypedQueryResult<FindVerificationsByIdentifierResult>> {
|
|
2476
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2477
|
+
const { after: generatedCursor, ...routedParameters } = parameters;
|
|
2478
|
+
if (generatedCursor != null && options.cursor !== undefined) throw new Error("generated cursor conflicts with query options");
|
|
2479
|
+
const routedOptions: QueryOptions = generatedCursor == null ? effectiveOptions : { ...effectiveOptions, cursor: generatedCursor };
|
|
2480
|
+
const request = findVerificationsByIdentifier(routedParameters as unknown as FindVerificationsByIdentifierParams);
|
|
2481
|
+
const result = await this.transport.executeNamedQuery<FindVerificationsByIdentifierParams, FindVerificationsByIdentifierResult>(request, routedOptions);
|
|
2482
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2483
|
+
return result;
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
public async findVerificationsByIdentifierAfterCommit(parameters: FindVerificationsByIdentifierParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<FindVerificationsByIdentifierResult>> {
|
|
2487
|
+
return this.findVerificationsByIdentifier(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
public async *findVerificationsByIdentifierPages(parameters: FindVerificationsByIdentifierParams, maxPages: number = 64, options: QueryOptions = {}): AsyncGenerator<TypedQueryResult<FindVerificationsByIdentifierResult>, void, undefined> {
|
|
2491
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1024) throw new RangeError("maxPages must be an integer from 1 through 1024");
|
|
2492
|
+
let currentParameters = parameters;
|
|
2493
|
+
let currentOptions = options;
|
|
2494
|
+
for (let pageIndex = 0; pageIndex < maxPages; pageIndex += 1) {
|
|
2495
|
+
const page = await this.findVerificationsByIdentifier(currentParameters, currentOptions);
|
|
2496
|
+
yield page;
|
|
2497
|
+
if (page.nextCursor === undefined) return;
|
|
2498
|
+
const { after: _ignoredCursor, ...restParameters } = currentParameters;
|
|
2499
|
+
currentParameters = restParameters as unknown as FindVerificationsByIdentifierParams;
|
|
2500
|
+
currentOptions = { ...currentOptions, cursor: page.nextCursor };
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
public async profileAccountWithUserByProvider(parameters: ProfileAccountWithUserByProviderParams, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileAccountWithUserByProviderResult>> {
|
|
2505
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2506
|
+
const request = profileAccountWithUserByProvider(parameters);
|
|
2507
|
+
const result = await this.transport.executeNamedQuery<ProfileAccountWithUserByProviderParams, ProfileAccountWithUserByProviderResult>(request, effectiveOptions);
|
|
2508
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2509
|
+
return result;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
public async profileAccountWithUserByProviderAfterCommit(parameters: ProfileAccountWithUserByProviderParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileAccountWithUserByProviderResult>> {
|
|
2513
|
+
return this.profileAccountWithUserByProvider(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
public async profileSessionWithUserById(parameters: ProfileSessionWithUserByIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileSessionWithUserByIdResult>> {
|
|
2517
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2518
|
+
const request = profileSessionWithUserById(parameters);
|
|
2519
|
+
const result = await this.transport.executeNamedQuery<ProfileSessionWithUserByIdParams, ProfileSessionWithUserByIdResult>(request, effectiveOptions);
|
|
2520
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2521
|
+
return result;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
public async profileSessionWithUserByIdAfterCommit(parameters: ProfileSessionWithUserByIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileSessionWithUserByIdResult>> {
|
|
2525
|
+
return this.profileSessionWithUserById(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
public async profileSessionWithUserByToken(parameters: ProfileSessionWithUserByTokenParams, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileSessionWithUserByTokenResult>> {
|
|
2529
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2530
|
+
const request = profileSessionWithUserByToken(parameters);
|
|
2531
|
+
const result = await this.transport.executeNamedQuery<ProfileSessionWithUserByTokenParams, ProfileSessionWithUserByTokenResult>(request, effectiveOptions);
|
|
2532
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2533
|
+
return result;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
public async profileSessionWithUserByTokenAfterCommit(parameters: ProfileSessionWithUserByTokenParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileSessionWithUserByTokenResult>> {
|
|
2537
|
+
return this.profileSessionWithUserByToken(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
public async profileSessionsWithUsersByTokenSet(parameters: ProfileSessionsWithUsersByTokenSetParams, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileSessionsWithUsersByTokenSetResult>> {
|
|
2541
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2542
|
+
const request = profileSessionsWithUsersByTokenSet(parameters);
|
|
2543
|
+
const result = await this.transport.executeNamedQuery<ProfileSessionsWithUsersByTokenSetParams, ProfileSessionsWithUsersByTokenSetResult>(request, effectiveOptions);
|
|
2544
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2545
|
+
return result;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
public async profileSessionsWithUsersByTokenSetAfterCommit(parameters: ProfileSessionsWithUsersByTokenSetParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileSessionsWithUsersByTokenSetResult>> {
|
|
2549
|
+
return this.profileSessionsWithUsersByTokenSet(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
public async profileUserWithAccountsByEmail(parameters: ProfileUserWithAccountsByEmailParams, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileUserWithAccountsByEmailResult>> {
|
|
2553
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2554
|
+
const request = profileUserWithAccountsByEmail(parameters);
|
|
2555
|
+
const result = await this.transport.executeNamedQuery<ProfileUserWithAccountsByEmailParams, ProfileUserWithAccountsByEmailResult>(request, effectiveOptions);
|
|
2556
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2557
|
+
return result;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
public async profileUserWithAccountsByEmailAfterCommit(parameters: ProfileUserWithAccountsByEmailParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileUserWithAccountsByEmailResult>> {
|
|
2561
|
+
return this.profileUserWithAccountsByEmail(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
public async profileUserWithAccountsById(parameters: ProfileUserWithAccountsByIdParams, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileUserWithAccountsByIdResult>> {
|
|
2565
|
+
const effectiveOptions: QueryOptions = this.lastCommitSeq !== undefined && options.readAfterCommit === undefined ? { ...options, readAfterCommit: this.lastCommitSeq } : options;
|
|
2566
|
+
const request = profileUserWithAccountsById(parameters);
|
|
2567
|
+
const result = await this.transport.executeNamedQuery<ProfileUserWithAccountsByIdParams, ProfileUserWithAccountsByIdResult>(request, effectiveOptions);
|
|
2568
|
+
if (!acceptsIdentity(request, result.identity)) throw new Error("RiffDB application identity mismatch");
|
|
2569
|
+
return result;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
public async profileUserWithAccountsByIdAfterCommit(parameters: ProfileUserWithAccountsByIdParams, commitSequence: bigint, options: QueryOptions = {}): Promise<TypedQueryResult<ProfileUserWithAccountsByIdResult>> {
|
|
2573
|
+
return this.profileUserWithAccountsById(parameters, { ...options, readAfterCommit: commitSequence });
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
public async consumeVerification(input: ConsumeVerificationInput): Promise<TypedCommandResult<ConsumeVerificationOutcome>> {
|
|
2577
|
+
const result = await this.transport.executeCommand<ConsumeVerificationInput, ConsumeVerificationOutcome>(consumeVerification(input), this.commandAttemptBudget);
|
|
2578
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CONSUME_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2579
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2580
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2581
|
+
}
|
|
2582
|
+
return result;
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
public async consumeVerificationBatch(inputs: ReadonlyArray<ConsumeVerificationInput>, options: CommandBatchOptions): Promise<CommandBatchResult<ConsumeVerificationOutcome>> {
|
|
2586
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2587
|
+
const start = options.checkpoint ?? 0;
|
|
2588
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2589
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2590
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => consumeVerification(input).input); const result = await this.transport.executeCommandBatch(consumeVerification(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CONSUME_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2591
|
+
const items: CommandBatchItem<ConsumeVerificationOutcome>[] = [];
|
|
2592
|
+
let next = start;
|
|
2593
|
+
let completed = start;
|
|
2594
|
+
let checkpoint = start;
|
|
2595
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2596
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.consumeVerification(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2597
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2598
|
+
items.sort((left, right) => left.index - right.index);
|
|
2599
|
+
return { items, checkpoint };
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
public async consumeVerificationSet(input: ConsumeVerificationSetInput): Promise<TypedCommandResult<ConsumeVerificationSetOutcome>> {
|
|
2603
|
+
const result = await this.transport.executeCommand<ConsumeVerificationSetInput, ConsumeVerificationSetOutcome>(consumeVerificationSet(input), this.commandAttemptBudget);
|
|
2604
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CONSUME_VERIFICATION_SET_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2605
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2606
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2607
|
+
}
|
|
2608
|
+
return result;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
public async consumeVerificationSetBatch(inputs: ReadonlyArray<ConsumeVerificationSetInput>, options: CommandBatchOptions): Promise<CommandBatchResult<ConsumeVerificationSetOutcome>> {
|
|
2612
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2613
|
+
const start = options.checkpoint ?? 0;
|
|
2614
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2615
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2616
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => consumeVerificationSet(input).input); const result = await this.transport.executeCommandBatch(consumeVerificationSet(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CONSUME_VERIFICATION_SET_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2617
|
+
const items: CommandBatchItem<ConsumeVerificationSetOutcome>[] = [];
|
|
2618
|
+
let next = start;
|
|
2619
|
+
let completed = start;
|
|
2620
|
+
let checkpoint = start;
|
|
2621
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2622
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.consumeVerificationSet(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2623
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2624
|
+
items.sort((left, right) => left.index - right.index);
|
|
2625
|
+
return { items, checkpoint };
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
public async consumeVerificationSnapshot(input: ConsumeVerificationSnapshotInput): Promise<TypedCommandResult<ConsumeVerificationSnapshotOutcome>> {
|
|
2629
|
+
const result = await this.transport.executeCommand<ConsumeVerificationSnapshotInput, ConsumeVerificationSnapshotOutcome>(consumeVerificationSnapshot(input), this.commandAttemptBudget);
|
|
2630
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CONSUME_VERIFICATION_SNAPSHOT_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2631
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2632
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2633
|
+
}
|
|
2634
|
+
return result;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
public async consumeVerificationSnapshotBatch(inputs: ReadonlyArray<ConsumeVerificationSnapshotInput>, options: CommandBatchOptions): Promise<CommandBatchResult<ConsumeVerificationSnapshotOutcome>> {
|
|
2638
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2639
|
+
const start = options.checkpoint ?? 0;
|
|
2640
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2641
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2642
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => consumeVerificationSnapshot(input).input); const result = await this.transport.executeCommandBatch(consumeVerificationSnapshot(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CONSUME_VERIFICATION_SNAPSHOT_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2643
|
+
const items: CommandBatchItem<ConsumeVerificationSnapshotOutcome>[] = [];
|
|
2644
|
+
let next = start;
|
|
2645
|
+
let completed = start;
|
|
2646
|
+
let checkpoint = start;
|
|
2647
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2648
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.consumeVerificationSnapshot(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2649
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2650
|
+
items.sort((left, right) => left.index - right.index);
|
|
2651
|
+
return { items, checkpoint };
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
public async createAccount(input: CreateAccountInput): Promise<TypedCommandResult<CreateAccountOutcome>> {
|
|
2655
|
+
const result = await this.transport.executeCommand<CreateAccountInput, CreateAccountOutcome>(createAccount(input), this.commandAttemptBudget);
|
|
2656
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CREATE_ACCOUNT_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2657
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2658
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2659
|
+
}
|
|
2660
|
+
return result;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
public async createAccountBatch(inputs: ReadonlyArray<CreateAccountInput>, options: CommandBatchOptions): Promise<CommandBatchResult<CreateAccountOutcome>> {
|
|
2664
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2665
|
+
const start = options.checkpoint ?? 0;
|
|
2666
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2667
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2668
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => createAccount(input).input); const result = await this.transport.executeCommandBatch(createAccount(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CREATE_ACCOUNT_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2669
|
+
const items: CommandBatchItem<CreateAccountOutcome>[] = [];
|
|
2670
|
+
let next = start;
|
|
2671
|
+
let completed = start;
|
|
2672
|
+
let checkpoint = start;
|
|
2673
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2674
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.createAccount(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2675
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2676
|
+
items.sort((left, right) => left.index - right.index);
|
|
2677
|
+
return { items, checkpoint };
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
public async createOAuthUserGraph(input: CreateOAuthUserGraphInput): Promise<TypedCommandResult<CreateOAuthUserGraphOutcome>> {
|
|
2681
|
+
const result = await this.transport.executeCommand<CreateOAuthUserGraphInput, CreateOAuthUserGraphOutcome>(createOAuthUserGraph(input), this.commandAttemptBudget);
|
|
2682
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CREATE_O_AUTH_USER_GRAPH_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2683
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2684
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2685
|
+
}
|
|
2686
|
+
return result;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
public async createOAuthUserGraphBatch(inputs: ReadonlyArray<CreateOAuthUserGraphInput>, options: CommandBatchOptions): Promise<CommandBatchResult<CreateOAuthUserGraphOutcome>> {
|
|
2690
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2691
|
+
const start = options.checkpoint ?? 0;
|
|
2692
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2693
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2694
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => createOAuthUserGraph(input).input); const result = await this.transport.executeCommandBatch(createOAuthUserGraph(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CREATE_O_AUTH_USER_GRAPH_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2695
|
+
const items: CommandBatchItem<CreateOAuthUserGraphOutcome>[] = [];
|
|
2696
|
+
let next = start;
|
|
2697
|
+
let completed = start;
|
|
2698
|
+
let checkpoint = start;
|
|
2699
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2700
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.createOAuthUserGraph(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2701
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2702
|
+
items.sort((left, right) => left.index - right.index);
|
|
2703
|
+
return { items, checkpoint };
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
public async createSession(input: CreateSessionInput): Promise<TypedCommandResult<CreateSessionOutcome>> {
|
|
2707
|
+
const result = await this.transport.executeCommand<CreateSessionInput, CreateSessionOutcome>(createSession(input), this.commandAttemptBudget);
|
|
2708
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CREATE_SESSION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2709
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2710
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2711
|
+
}
|
|
2712
|
+
return result;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
public async createSessionBatch(inputs: ReadonlyArray<CreateSessionInput>, options: CommandBatchOptions): Promise<CommandBatchResult<CreateSessionOutcome>> {
|
|
2716
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2717
|
+
const start = options.checkpoint ?? 0;
|
|
2718
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2719
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2720
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => createSession(input).input); const result = await this.transport.executeCommandBatch(createSession(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CREATE_SESSION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2721
|
+
const items: CommandBatchItem<CreateSessionOutcome>[] = [];
|
|
2722
|
+
let next = start;
|
|
2723
|
+
let completed = start;
|
|
2724
|
+
let checkpoint = start;
|
|
2725
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2726
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.createSession(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2727
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2728
|
+
items.sort((left, right) => left.index - right.index);
|
|
2729
|
+
return { items, checkpoint };
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
public async createSignupGraph(input: CreateSignupGraphInput): Promise<TypedCommandResult<CreateSignupGraphOutcome>> {
|
|
2733
|
+
const result = await this.transport.executeCommand<CreateSignupGraphInput, CreateSignupGraphOutcome>(createSignupGraph(input), this.commandAttemptBudget);
|
|
2734
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CREATE_SIGNUP_GRAPH_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2735
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2736
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2737
|
+
}
|
|
2738
|
+
return result;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
public async createSignupGraphBatch(inputs: ReadonlyArray<CreateSignupGraphInput>, options: CommandBatchOptions): Promise<CommandBatchResult<CreateSignupGraphOutcome>> {
|
|
2742
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2743
|
+
const start = options.checkpoint ?? 0;
|
|
2744
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2745
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2746
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => createSignupGraph(input).input); const result = await this.transport.executeCommandBatch(createSignupGraph(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CREATE_SIGNUP_GRAPH_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2747
|
+
const items: CommandBatchItem<CreateSignupGraphOutcome>[] = [];
|
|
2748
|
+
let next = start;
|
|
2749
|
+
let completed = start;
|
|
2750
|
+
let checkpoint = start;
|
|
2751
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2752
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.createSignupGraph(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2753
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2754
|
+
items.sort((left, right) => left.index - right.index);
|
|
2755
|
+
return { items, checkpoint };
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2758
|
+
public async createUser(input: CreateUserInput): Promise<TypedCommandResult<CreateUserOutcome>> {
|
|
2759
|
+
const result = await this.transport.executeCommand<CreateUserInput, CreateUserOutcome>(createUser(input), this.commandAttemptBudget);
|
|
2760
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CREATE_USER_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2761
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2762
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2763
|
+
}
|
|
2764
|
+
return result;
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
public async createUserBatch(inputs: ReadonlyArray<CreateUserInput>, options: CommandBatchOptions): Promise<CommandBatchResult<CreateUserOutcome>> {
|
|
2768
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2769
|
+
const start = options.checkpoint ?? 0;
|
|
2770
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2771
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2772
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => createUser(input).input); const result = await this.transport.executeCommandBatch(createUser(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CREATE_USER_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2773
|
+
const items: CommandBatchItem<CreateUserOutcome>[] = [];
|
|
2774
|
+
let next = start;
|
|
2775
|
+
let completed = start;
|
|
2776
|
+
let checkpoint = start;
|
|
2777
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2778
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.createUser(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2779
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2780
|
+
items.sort((left, right) => left.index - right.index);
|
|
2781
|
+
return { items, checkpoint };
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
public async createVerification(input: CreateVerificationInput): Promise<TypedCommandResult<CreateVerificationOutcome>> {
|
|
2785
|
+
const result = await this.transport.executeCommand<CreateVerificationInput, CreateVerificationOutcome>(createVerification(input), this.commandAttemptBudget);
|
|
2786
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== CREATE_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2787
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2788
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2789
|
+
}
|
|
2790
|
+
return result;
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
public async createVerificationBatch(inputs: ReadonlyArray<CreateVerificationInput>, options: CommandBatchOptions): Promise<CommandBatchResult<CreateVerificationOutcome>> {
|
|
2794
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2795
|
+
const start = options.checkpoint ?? 0;
|
|
2796
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2797
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2798
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => createVerification(input).input); const result = await this.transport.executeCommandBatch(createVerification(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== CREATE_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2799
|
+
const items: CommandBatchItem<CreateVerificationOutcome>[] = [];
|
|
2800
|
+
let next = start;
|
|
2801
|
+
let completed = start;
|
|
2802
|
+
let checkpoint = start;
|
|
2803
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2804
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.createVerification(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2805
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2806
|
+
items.sort((left, right) => left.index - right.index);
|
|
2807
|
+
return { items, checkpoint };
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
public async deleteAccount(input: DeleteAccountInput): Promise<TypedCommandResult<DeleteAccountOutcome>> {
|
|
2811
|
+
const result = await this.transport.executeCommand<DeleteAccountInput, DeleteAccountOutcome>(deleteAccount(input), this.commandAttemptBudget);
|
|
2812
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== DELETE_ACCOUNT_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2813
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2814
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2815
|
+
}
|
|
2816
|
+
return result;
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
public async deleteAccountBatch(inputs: ReadonlyArray<DeleteAccountInput>, options: CommandBatchOptions): Promise<CommandBatchResult<DeleteAccountOutcome>> {
|
|
2820
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2821
|
+
const start = options.checkpoint ?? 0;
|
|
2822
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2823
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2824
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => deleteAccount(input).input); const result = await this.transport.executeCommandBatch(deleteAccount(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== DELETE_ACCOUNT_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2825
|
+
const items: CommandBatchItem<DeleteAccountOutcome>[] = [];
|
|
2826
|
+
let next = start;
|
|
2827
|
+
let completed = start;
|
|
2828
|
+
let checkpoint = start;
|
|
2829
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2830
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.deleteAccount(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2831
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2832
|
+
items.sort((left, right) => left.index - right.index);
|
|
2833
|
+
return { items, checkpoint };
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
public async deleteSession(input: DeleteSessionInput): Promise<TypedCommandResult<DeleteSessionOutcome>> {
|
|
2837
|
+
const result = await this.transport.executeCommand<DeleteSessionInput, DeleteSessionOutcome>(deleteSession(input), this.commandAttemptBudget);
|
|
2838
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== DELETE_SESSION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2839
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2840
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2841
|
+
}
|
|
2842
|
+
return result;
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
public async deleteSessionBatch(inputs: ReadonlyArray<DeleteSessionInput>, options: CommandBatchOptions): Promise<CommandBatchResult<DeleteSessionOutcome>> {
|
|
2846
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2847
|
+
const start = options.checkpoint ?? 0;
|
|
2848
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2849
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2850
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => deleteSession(input).input); const result = await this.transport.executeCommandBatch(deleteSession(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== DELETE_SESSION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2851
|
+
const items: CommandBatchItem<DeleteSessionOutcome>[] = [];
|
|
2852
|
+
let next = start;
|
|
2853
|
+
let completed = start;
|
|
2854
|
+
let checkpoint = start;
|
|
2855
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2856
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.deleteSession(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2857
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2858
|
+
items.sort((left, right) => left.index - right.index);
|
|
2859
|
+
return { items, checkpoint };
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
public async deleteUser(input: DeleteUserInput): Promise<TypedCommandResult<DeleteUserOutcome>> {
|
|
2863
|
+
const result = await this.transport.executeCommand<DeleteUserInput, DeleteUserOutcome>(deleteUser(input), this.commandAttemptBudget);
|
|
2864
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== DELETE_USER_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2865
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2866
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2867
|
+
}
|
|
2868
|
+
return result;
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
public async deleteUserBatch(inputs: ReadonlyArray<DeleteUserInput>, options: CommandBatchOptions): Promise<CommandBatchResult<DeleteUserOutcome>> {
|
|
2872
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2873
|
+
const start = options.checkpoint ?? 0;
|
|
2874
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2875
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2876
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => deleteUser(input).input); const result = await this.transport.executeCommandBatch(deleteUser(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== DELETE_USER_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2877
|
+
const items: CommandBatchItem<DeleteUserOutcome>[] = [];
|
|
2878
|
+
let next = start;
|
|
2879
|
+
let completed = start;
|
|
2880
|
+
let checkpoint = start;
|
|
2881
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2882
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.deleteUser(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2883
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2884
|
+
items.sort((left, right) => left.index - right.index);
|
|
2885
|
+
return { items, checkpoint };
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
public async deleteVerification(input: DeleteVerificationInput): Promise<TypedCommandResult<DeleteVerificationOutcome>> {
|
|
2889
|
+
const result = await this.transport.executeCommand<DeleteVerificationInput, DeleteVerificationOutcome>(deleteVerification(input), this.commandAttemptBudget);
|
|
2890
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== DELETE_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2891
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2892
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2893
|
+
}
|
|
2894
|
+
return result;
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
public async deleteVerificationBatch(inputs: ReadonlyArray<DeleteVerificationInput>, options: CommandBatchOptions): Promise<CommandBatchResult<DeleteVerificationOutcome>> {
|
|
2898
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2899
|
+
const start = options.checkpoint ?? 0;
|
|
2900
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2901
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2902
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => deleteVerification(input).input); const result = await this.transport.executeCommandBatch(deleteVerification(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== DELETE_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2903
|
+
const items: CommandBatchItem<DeleteVerificationOutcome>[] = [];
|
|
2904
|
+
let next = start;
|
|
2905
|
+
let completed = start;
|
|
2906
|
+
let checkpoint = start;
|
|
2907
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2908
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.deleteVerification(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2909
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2910
|
+
items.sort((left, right) => left.index - right.index);
|
|
2911
|
+
return { items, checkpoint };
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
public async resetCredentialPassword(input: ResetCredentialPasswordInput): Promise<TypedCommandResult<ResetCredentialPasswordOutcome>> {
|
|
2915
|
+
const result = await this.transport.executeCommand<ResetCredentialPasswordInput, ResetCredentialPasswordOutcome>(resetCredentialPassword(input), this.commandAttemptBudget);
|
|
2916
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== RESET_CREDENTIAL_PASSWORD_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2917
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2918
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2919
|
+
}
|
|
2920
|
+
return result;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
public async resetCredentialPasswordBatch(inputs: ReadonlyArray<ResetCredentialPasswordInput>, options: CommandBatchOptions): Promise<CommandBatchResult<ResetCredentialPasswordOutcome>> {
|
|
2924
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2925
|
+
const start = options.checkpoint ?? 0;
|
|
2926
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2927
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2928
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => resetCredentialPassword(input).input); const result = await this.transport.executeCommandBatch(resetCredentialPassword(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== RESET_CREDENTIAL_PASSWORD_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2929
|
+
const items: CommandBatchItem<ResetCredentialPasswordOutcome>[] = [];
|
|
2930
|
+
let next = start;
|
|
2931
|
+
let completed = start;
|
|
2932
|
+
let checkpoint = start;
|
|
2933
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2934
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.resetCredentialPassword(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2935
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2936
|
+
items.sort((left, right) => left.index - right.index);
|
|
2937
|
+
return { items, checkpoint };
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
public async updateAccount(input: UpdateAccountInput): Promise<TypedCommandResult<UpdateAccountOutcome>> {
|
|
2941
|
+
const result = await this.transport.executeCommand<UpdateAccountInput, UpdateAccountOutcome>(updateAccount(input), this.commandAttemptBudget);
|
|
2942
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== UPDATE_ACCOUNT_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2943
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2944
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2945
|
+
}
|
|
2946
|
+
return result;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
public async updateAccountBatch(inputs: ReadonlyArray<UpdateAccountInput>, options: CommandBatchOptions): Promise<CommandBatchResult<UpdateAccountOutcome>> {
|
|
2950
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2951
|
+
const start = options.checkpoint ?? 0;
|
|
2952
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2953
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2954
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => updateAccount(input).input); const result = await this.transport.executeCommandBatch(updateAccount(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== UPDATE_ACCOUNT_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2955
|
+
const items: CommandBatchItem<UpdateAccountOutcome>[] = [];
|
|
2956
|
+
let next = start;
|
|
2957
|
+
let completed = start;
|
|
2958
|
+
let checkpoint = start;
|
|
2959
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2960
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.updateAccount(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2961
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2962
|
+
items.sort((left, right) => left.index - right.index);
|
|
2963
|
+
return { items, checkpoint };
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
public async updateAccountPasswords(input: UpdateAccountPasswordsInput): Promise<TypedCommandResult<UpdateAccountPasswordsOutcome>> {
|
|
2967
|
+
const result = await this.transport.executeCommand<UpdateAccountPasswordsInput, UpdateAccountPasswordsOutcome>(updateAccountPasswords(input), this.commandAttemptBudget);
|
|
2968
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== UPDATE_ACCOUNT_PASSWORDS_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2969
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2970
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2971
|
+
}
|
|
2972
|
+
return result;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
public async updateAccountPasswordsBatch(inputs: ReadonlyArray<UpdateAccountPasswordsInput>, options: CommandBatchOptions): Promise<CommandBatchResult<UpdateAccountPasswordsOutcome>> {
|
|
2976
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
2977
|
+
const start = options.checkpoint ?? 0;
|
|
2978
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
2979
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
2980
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => updateAccountPasswords(input).input); const result = await this.transport.executeCommandBatch(updateAccountPasswords(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== UPDATE_ACCOUNT_PASSWORDS_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
2981
|
+
const items: CommandBatchItem<UpdateAccountPasswordsOutcome>[] = [];
|
|
2982
|
+
let next = start;
|
|
2983
|
+
let completed = start;
|
|
2984
|
+
let checkpoint = start;
|
|
2985
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
2986
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.updateAccountPasswords(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
2987
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
2988
|
+
items.sort((left, right) => left.index - right.index);
|
|
2989
|
+
return { items, checkpoint };
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
public async updateCredentialPassword(input: UpdateCredentialPasswordInput): Promise<TypedCommandResult<UpdateCredentialPasswordOutcome>> {
|
|
2993
|
+
const result = await this.transport.executeCommand<UpdateCredentialPasswordInput, UpdateCredentialPasswordOutcome>(updateCredentialPassword(input), this.commandAttemptBudget);
|
|
2994
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== UPDATE_CREDENTIAL_PASSWORD_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
2995
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
2996
|
+
this.lastCommitSeq = result.commitSequence;
|
|
2997
|
+
}
|
|
2998
|
+
return result;
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
public async updateCredentialPasswordBatch(inputs: ReadonlyArray<UpdateCredentialPasswordInput>, options: CommandBatchOptions): Promise<CommandBatchResult<UpdateCredentialPasswordOutcome>> {
|
|
3002
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
3003
|
+
const start = options.checkpoint ?? 0;
|
|
3004
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
3005
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
3006
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => updateCredentialPassword(input).input); const result = await this.transport.executeCommandBatch(updateCredentialPassword(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== UPDATE_CREDENTIAL_PASSWORD_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
3007
|
+
const items: CommandBatchItem<UpdateCredentialPasswordOutcome>[] = [];
|
|
3008
|
+
let next = start;
|
|
3009
|
+
let completed = start;
|
|
3010
|
+
let checkpoint = start;
|
|
3011
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
3012
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.updateCredentialPassword(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
3013
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
3014
|
+
items.sort((left, right) => left.index - right.index);
|
|
3015
|
+
return { items, checkpoint };
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
public async updateSession(input: UpdateSessionInput): Promise<TypedCommandResult<UpdateSessionOutcome>> {
|
|
3019
|
+
const result = await this.transport.executeCommand<UpdateSessionInput, UpdateSessionOutcome>(updateSession(input), this.commandAttemptBudget);
|
|
3020
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== UPDATE_SESSION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
3021
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
3022
|
+
this.lastCommitSeq = result.commitSequence;
|
|
3023
|
+
}
|
|
3024
|
+
return result;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
public async updateSessionBatch(inputs: ReadonlyArray<UpdateSessionInput>, options: CommandBatchOptions): Promise<CommandBatchResult<UpdateSessionOutcome>> {
|
|
3028
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
3029
|
+
const start = options.checkpoint ?? 0;
|
|
3030
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
3031
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
3032
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => updateSession(input).input); const result = await this.transport.executeCommandBatch(updateSession(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== UPDATE_SESSION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
3033
|
+
const items: CommandBatchItem<UpdateSessionOutcome>[] = [];
|
|
3034
|
+
let next = start;
|
|
3035
|
+
let completed = start;
|
|
3036
|
+
let checkpoint = start;
|
|
3037
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
3038
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.updateSession(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
3039
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
3040
|
+
items.sort((left, right) => left.index - right.index);
|
|
3041
|
+
return { items, checkpoint };
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
public async updateUser(input: UpdateUserInput): Promise<TypedCommandResult<UpdateUserOutcome>> {
|
|
3045
|
+
const result = await this.transport.executeCommand<UpdateUserInput, UpdateUserOutcome>(updateUser(input), this.commandAttemptBudget);
|
|
3046
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== UPDATE_USER_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
3047
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
3048
|
+
this.lastCommitSeq = result.commitSequence;
|
|
3049
|
+
}
|
|
3050
|
+
return result;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
public async updateUserBatch(inputs: ReadonlyArray<UpdateUserInput>, options: CommandBatchOptions): Promise<CommandBatchResult<UpdateUserOutcome>> {
|
|
3054
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
3055
|
+
const start = options.checkpoint ?? 0;
|
|
3056
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
3057
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
3058
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => updateUser(input).input); const result = await this.transport.executeCommandBatch(updateUser(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== UPDATE_USER_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
3059
|
+
const items: CommandBatchItem<UpdateUserOutcome>[] = [];
|
|
3060
|
+
let next = start;
|
|
3061
|
+
let completed = start;
|
|
3062
|
+
let checkpoint = start;
|
|
3063
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
3064
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.updateUser(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
3065
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
3066
|
+
items.sort((left, right) => left.index - right.index);
|
|
3067
|
+
return { items, checkpoint };
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
public async updateVerification(input: UpdateVerificationInput): Promise<TypedCommandResult<UpdateVerificationOutcome>> {
|
|
3071
|
+
const result = await this.transport.executeCommand<UpdateVerificationInput, UpdateVerificationOutcome>(updateVerification(input), this.commandAttemptBudget);
|
|
3072
|
+
if (result.contractVersion !== CONTRACT_VERSION || result.planHash !== UPDATE_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch");
|
|
3073
|
+
if (this.trackCausalWrites && result.commitSequence !== undefined && result.commitSequence > 0n && (this.lastCommitSeq === undefined || result.commitSequence > this.lastCommitSeq)) {
|
|
3074
|
+
this.lastCommitSeq = result.commitSequence;
|
|
3075
|
+
}
|
|
3076
|
+
return result;
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
public async updateVerificationBatch(inputs: ReadonlyArray<UpdateVerificationInput>, options: CommandBatchOptions): Promise<CommandBatchResult<UpdateVerificationOutcome>> {
|
|
3080
|
+
if (!Number.isInteger(options.concurrency) || options.concurrency < 1 || options.concurrency > MAX_COMMAND_BATCH_CONCURRENCY || inputs.length < 1 || inputs.length > 4096) throw new Error("invalid command batch bounds");
|
|
3081
|
+
const start = options.checkpoint ?? 0;
|
|
3082
|
+
if (!Number.isInteger(start) || start < 0 || start > inputs.length) throw new Error("invalid command batch checkpoint");
|
|
3083
|
+
if (start === inputs.length) return { items: [], checkpoint: start };
|
|
3084
|
+
if (this.transport.executeCommandBatch !== undefined) { const normalizedInputs = inputs.map((input) => updateVerification(input).input); const result = await this.transport.executeCommandBatch(updateVerification(normalizedInputs[start]!), normalizedInputs, options.concurrency, start, this.commandAttemptBudget); const items = result.items.map((item) => { if (item.result === undefined) return item; if (item.result.contractVersion !== CONTRACT_VERSION || item.result.planHash !== UPDATE_VERIFICATION_PLAN_HASH) throw new Error("RiffDB application identity mismatch"); if (this.trackCausalWrites && item.result.commitSequence !== undefined && item.result.commitSequence > 0n && (this.lastCommitSeq === undefined || item.result.commitSequence > this.lastCommitSeq)) { this.lastCommitSeq = item.result.commitSequence; } return item; }); options.onProgress?.({ completed: result.checkpoint, total: inputs.length, checkpoint: result.checkpoint }); return { items, checkpoint: result.checkpoint }; }
|
|
3085
|
+
const items: CommandBatchItem<UpdateVerificationOutcome>[] = [];
|
|
3086
|
+
let next = start;
|
|
3087
|
+
let completed = start;
|
|
3088
|
+
let checkpoint = start;
|
|
3089
|
+
const completedAfterCheckpoint = new Set<number>();
|
|
3090
|
+
const worker = async (): Promise<void> => { while (true) { const index = next++; if (index >= inputs.length) return; try { items.push({ index, result: await this.updateVerification(inputs[index]!) }); } catch (error) { items.push({ index, error }); } completed += 1; completedAfterCheckpoint.add(index); while (completedAfterCheckpoint.delete(checkpoint)) checkpoint += 1; options.onProgress?.({ completed, total: inputs.length, checkpoint }); } };
|
|
3091
|
+
await Promise.all(Array.from({ length: Math.min(options.concurrency, inputs.length - start) }, worker));
|
|
3092
|
+
items.sort((left, right) => left.index - right.index);
|
|
3093
|
+
return { items, checkpoint };
|
|
3094
|
+
}
|
|
3095
|
+
|
|
3096
|
+
}
|