@sixb/pg 0.0.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.
Files changed (152) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/agents/agent-storage.d.ts +20 -0
  4. package/dist/agents/agent-storage.d.ts.map +1 -0
  5. package/dist/agents/index.d.ts +6 -0
  6. package/dist/agents/index.d.ts.map +1 -0
  7. package/dist/agents/messages.d.ts +13 -0
  8. package/dist/agents/messages.d.ts.map +1 -0
  9. package/dist/agents/rows.d.ts +77 -0
  10. package/dist/agents/rows.d.ts.map +1 -0
  11. package/dist/agents/runs.d.ts +25 -0
  12. package/dist/agents/runs.d.ts.map +1 -0
  13. package/dist/agents/threads.d.ts +13 -0
  14. package/dist/agents/threads.d.ts.map +1 -0
  15. package/dist/auth-storage/access-tokens.d.ts +33 -0
  16. package/dist/auth-storage/access-tokens.d.ts.map +1 -0
  17. package/dist/auth-storage/auth-storage.d.ts +41 -0
  18. package/dist/auth-storage/auth-storage.d.ts.map +1 -0
  19. package/dist/auth-storage/group-memberships.d.ts +21 -0
  20. package/dist/auth-storage/group-memberships.d.ts.map +1 -0
  21. package/dist/auth-storage/identities.d.ts +17 -0
  22. package/dist/auth-storage/identities.d.ts.map +1 -0
  23. package/dist/auth-storage/index.d.ts +3 -0
  24. package/dist/auth-storage/index.d.ts.map +1 -0
  25. package/dist/auth-storage/invitations.d.ts +29 -0
  26. package/dist/auth-storage/invitations.d.ts.map +1 -0
  27. package/dist/auth-storage/magic-links.d.ts +28 -0
  28. package/dist/auth-storage/magic-links.d.ts.map +1 -0
  29. package/dist/auth-storage/oidc-attempts.d.ts +18 -0
  30. package/dist/auth-storage/oidc-attempts.d.ts.map +1 -0
  31. package/dist/auth-storage/rows.d.ts +138 -0
  32. package/dist/auth-storage/rows.d.ts.map +1 -0
  33. package/dist/auth-storage/service-account-group-memberships.d.ts +17 -0
  34. package/dist/auth-storage/service-account-group-memberships.d.ts.map +1 -0
  35. package/dist/auth-storage/service-accounts.d.ts +14 -0
  36. package/dist/auth-storage/service-accounts.d.ts.map +1 -0
  37. package/dist/auth-storage/sessions.d.ts +55 -0
  38. package/dist/auth-storage/sessions.d.ts.map +1 -0
  39. package/dist/auth-storage/shared.d.ts +159 -0
  40. package/dist/auth-storage/shared.d.ts.map +1 -0
  41. package/dist/auth-storage/users.d.ts +19 -0
  42. package/dist/auth-storage/users.d.ts.map +1 -0
  43. package/dist/index.d.ts +127 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +11957 -0
  46. package/dist/index.js.map +55 -0
  47. package/dist/latest-run-query.d.ts +24 -0
  48. package/dist/latest-run-query.d.ts.map +1 -0
  49. package/dist/migrations.d.ts +20 -0
  50. package/dist/migrations.d.ts.map +1 -0
  51. package/dist/ontology-storage/commits.d.ts +11 -0
  52. package/dist/ontology-storage/commits.d.ts.map +1 -0
  53. package/dist/ontology-storage/index.d.ts +22 -0
  54. package/dist/ontology-storage/index.d.ts.map +1 -0
  55. package/dist/ontology-storage/materialization-session.d.ts +63 -0
  56. package/dist/ontology-storage/materialization-session.d.ts.map +1 -0
  57. package/dist/ontology-storage/materialization-state.d.ts +69 -0
  58. package/dist/ontology-storage/materialization-state.d.ts.map +1 -0
  59. package/dist/ontology-storage/materialization-writer.d.ts +15 -0
  60. package/dist/ontology-storage/materialization-writer.d.ts.map +1 -0
  61. package/dist/ontology-storage/materializations.d.ts +33 -0
  62. package/dist/ontology-storage/materializations.d.ts.map +1 -0
  63. package/dist/ontology-storage/outbox.d.ts +12 -0
  64. package/dist/ontology-storage/outbox.d.ts.map +1 -0
  65. package/dist/ontology-storage/shared.d.ts +95 -0
  66. package/dist/ontology-storage/shared.d.ts.map +1 -0
  67. package/dist/ontology-storage/sources.d.ts +25 -0
  68. package/dist/ontology-storage/sources.d.ts.map +1 -0
  69. package/dist/pg-action-run-storage.d.ts +21 -0
  70. package/dist/pg-action-run-storage.d.ts.map +1 -0
  71. package/dist/pg-client.d.ts +58 -0
  72. package/dist/pg-client.d.ts.map +1 -0
  73. package/dist/pg-object-query-compiler.d.ts +55 -0
  74. package/dist/pg-object-query-compiler.d.ts.map +1 -0
  75. package/dist/pg-object-storage.d.ts +90 -0
  76. package/dist/pg-object-storage.d.ts.map +1 -0
  77. package/dist/pg-pipeline-run-storage.d.ts +18 -0
  78. package/dist/pg-pipeline-run-storage.d.ts.map +1 -0
  79. package/dist/pg-projection-run-storage.d.ts +19 -0
  80. package/dist/pg-projection-run-storage.d.ts.map +1 -0
  81. package/dist/pg-rules-storage.d.ts +25 -0
  82. package/dist/pg-rules-storage.d.ts.map +1 -0
  83. package/dist/pg-sync-run-storage.d.ts +15 -0
  84. package/dist/pg-sync-run-storage.d.ts.map +1 -0
  85. package/dist/pg-timeseries-storage.d.ts +32 -0
  86. package/dist/pg-timeseries-storage.d.ts.map +1 -0
  87. package/dist/pg-webhook-delivery-storage.d.ts +17 -0
  88. package/dist/pg-webhook-delivery-storage.d.ts.map +1 -0
  89. package/dist/pg-webhook-run-storage.d.ts +14 -0
  90. package/dist/pg-webhook-run-storage.d.ts.map +1 -0
  91. package/dist/pg-workflow-intervention-storage.d.ts +16 -0
  92. package/dist/pg-workflow-intervention-storage.d.ts.map +1 -0
  93. package/dist/pg-workflow-run-storage.d.ts +49 -0
  94. package/dist/pg-workflow-run-storage.d.ts.map +1 -0
  95. package/dist/run-list-query.d.ts +30 -0
  96. package/dist/run-list-query.d.ts.map +1 -0
  97. package/dist/storage-errors.d.ts +16 -0
  98. package/dist/storage-errors.d.ts.map +1 -0
  99. package/dist/transactions.d.ts +10 -0
  100. package/dist/transactions.d.ts.map +1 -0
  101. package/dist/tsconfig.json +5 -0
  102. package/package.json +60 -0
  103. package/src/agents/agent-storage.ts +26 -0
  104. package/src/agents/index.ts +5 -0
  105. package/src/agents/messages.ts +144 -0
  106. package/src/agents/rows.ts +227 -0
  107. package/src/agents/runs.ts +330 -0
  108. package/src/agents/threads.ts +116 -0
  109. package/src/auth-storage/access-tokens.ts +254 -0
  110. package/src/auth-storage/auth-storage.ts +798 -0
  111. package/src/auth-storage/group-memberships.ts +47 -0
  112. package/src/auth-storage/identities.ts +85 -0
  113. package/src/auth-storage/index.ts +2 -0
  114. package/src/auth-storage/invitations.ts +280 -0
  115. package/src/auth-storage/magic-links.ts +140 -0
  116. package/src/auth-storage/oidc-attempts.ts +93 -0
  117. package/src/auth-storage/rows.ts +352 -0
  118. package/src/auth-storage/service-account-group-memberships.ts +150 -0
  119. package/src/auth-storage/service-accounts.ts +154 -0
  120. package/src/auth-storage/sessions.ts +193 -0
  121. package/src/auth-storage/shared.ts +799 -0
  122. package/src/auth-storage/users.ts +196 -0
  123. package/src/index.ts +367 -0
  124. package/src/latest-run-query.ts +42 -0
  125. package/src/migrations/001-initial-schema.sql +1195 -0
  126. package/src/migrations.ts +280 -0
  127. package/src/ontology-storage/commits.ts +115 -0
  128. package/src/ontology-storage/index.ts +35 -0
  129. package/src/ontology-storage/materialization-session.ts +426 -0
  130. package/src/ontology-storage/materialization-state.ts +1109 -0
  131. package/src/ontology-storage/materialization-writer.ts +509 -0
  132. package/src/ontology-storage/materializations.ts +939 -0
  133. package/src/ontology-storage/outbox.ts +216 -0
  134. package/src/ontology-storage/shared.ts +293 -0
  135. package/src/ontology-storage/sources.ts +658 -0
  136. package/src/pg-action-run-storage.ts +657 -0
  137. package/src/pg-client.ts +124 -0
  138. package/src/pg-object-query-compiler.ts +1545 -0
  139. package/src/pg-object-storage.ts +638 -0
  140. package/src/pg-pipeline-run-storage.ts +457 -0
  141. package/src/pg-projection-run-storage.ts +526 -0
  142. package/src/pg-rules-storage.ts +308 -0
  143. package/src/pg-sync-run-storage.ts +263 -0
  144. package/src/pg-timeseries-storage.ts +180 -0
  145. package/src/pg-webhook-delivery-storage.ts +180 -0
  146. package/src/pg-webhook-run-storage.ts +185 -0
  147. package/src/pg-workflow-intervention-storage.ts +339 -0
  148. package/src/pg-workflow-run-storage.ts +1065 -0
  149. package/src/run-list-query.ts +108 -0
  150. package/src/sql.d.ts +4 -0
  151. package/src/storage-errors.ts +72 -0
  152. package/src/transactions.ts +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sixb contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @sixb/pg
2
+
3
+ PostgreSQL storage provider for Sixb.
4
+
5
+ One shared connection pool (porsager `postgres`) backs every Sixb store: objects, ontology commits,
6
+ auth, agents, timeseries, and the run history for actions, syncs, pipelines, projections, workflows,
7
+ and webhooks. This is the provider to use for anything you intend to operate.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ bun add @sixb/pg
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { PostgresStorage } from "@sixb/pg"
19
+ import { createSixb } from "@sixb/core"
20
+
21
+ const storage = new PostgresStorage({
22
+ connectionString: process.env.DATABASE_URL,
23
+ })
24
+
25
+ export const sixb = createSixb({ storage, broker })
26
+ ```
27
+
28
+ All Sixb tables live in one schema, `sixb` by default. Set `schemaName` to share a database with
29
+ other applications; it is pinned through `search_path` on every pooled connection.
30
+
31
+ ## Migrations
32
+
33
+ `PostgresStorage` exposes core's `StorageMigrator` contract. The CLI runs it at startup and
34
+ `sixb db migrate` runs it on demand — you do not write migrations, they ship inside this package.
35
+
36
+ Before 1.0 the schema is a single migration whose checksum is verified at boot. A schema change
37
+ **replaces** that migration instead of adding another, so moving between 0.x versions can require
38
+ recreating the database. `dropSchema()` exists for exactly that, and for test teardown — it deletes
39
+ every Sixb table and the schema itself.
40
+
41
+ ## Pooling and timeouts
42
+
43
+ | Option | Default | Why you would set it |
44
+ | --- | --- | --- |
45
+ | `max` | `10` | Pool size. Size it per role, not per project — an API replica and a worker each get their own pool. |
46
+ | `statementTimeoutMillis` | unset | A single stalled query can otherwise pin its connection until the process restarts. Keep it generous or unset for workers that run long bulk writes. |
47
+ | `idleInTransactionSessionTimeoutMillis` | unset | Aborts transactions left open and idle, releasing the connection. |
48
+ | `idleTimeoutMillis` | `30000` | Returns idle connections to the server. |
49
+ | `connectTimeoutMillis` | `10000` | Fail fast when the database is unreachable. |
50
+ | `shutdownTimeoutMillis` | `5000` | `close()` stops accepting queries and waits this long for in-flight work, so a restart drains instead of severing live writes. |
51
+
52
+ Call `close()` on shutdown.
53
+
54
+ ### Behind a connection pooler
55
+
56
+ `prepare` defaults to `true`, which is correct for a direct connection. In PgBouncer transaction
57
+ mode, server-side prepared statements need PgBouncer >= 1.21 with `max_prepared_statements > 0`; set
58
+ `prepare: false` for an older PgBouncer, or when that setting is `0`.
59
+
60
+ ## Transactions
61
+
62
+ ```ts
63
+ await storage.transaction(
64
+ async (tx) => {
65
+ // Use `tx`, never the root storage — the root throws inside a transaction callback.
66
+ },
67
+ { isolation: "serializable" }
68
+ )
69
+ ```
70
+
71
+ Nested transactions are rejected. A serialization conflict or deadlock surfaces as a
72
+ `StorageTransactionError` with `code: "serialization_failure"`, which is the signal that the
73
+ operation is safe to retry.
@@ -0,0 +1,20 @@
1
+ import type { AgentStorage } from "@sixb/core/storage";
2
+ import type { PgStoreClient } from "../transactions";
3
+ import { PgAgentMessageStore } from "./messages";
4
+ import { PgAgentRunStore } from "./runs";
5
+ import { PgAgentThreadStore } from "./threads";
6
+ export interface PgAgentStorageOptions {
7
+ readonly sql: PgStoreClient;
8
+ }
9
+ /**
10
+ * PostgreSQL-backed agent persistence: thread / run / message sub-stores sharing one connection.
11
+ * Cross-table writes (reserve + finish touch the thread anchor, append bumps thread stats) run
12
+ * inside `runPgTransaction` with `SELECT ... FOR UPDATE` row locks for single-flight safety.
13
+ */
14
+ export declare class PgAgentStorage implements AgentStorage {
15
+ readonly threads: PgAgentThreadStore;
16
+ readonly runs: PgAgentRunStore;
17
+ readonly messages: PgAgentMessageStore;
18
+ constructor(options: PgAgentStorageOptions);
19
+ }
20
+ //# sourceMappingURL=agent-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-storage.d.ts","sourceRoot":"","sources":["../../src/agents/agent-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;CAC5B;AAED;;;;GAIG;AACH,qBAAa,cAAe,YAAW,YAAY;IACjD,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;gBAE1B,OAAO,EAAE,qBAAqB;CAK3C"}
@@ -0,0 +1,6 @@
1
+ export type { PgAgentStorageOptions } from "./agent-storage";
2
+ export { PgAgentStorage } from "./agent-storage";
3
+ export { PgAgentMessageStore } from "./messages";
4
+ export { PgAgentRunStore } from "./runs";
5
+ export { PgAgentThreadStore } from "./threads";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { type AgentMessageRecord, type AgentMessageStore, type AppendAgentMessageInput, type ListAgentMessagesInput, type ListAgentMessagesResult } from "@sixb/core/storage";
2
+ import { type PgStoreClient } from "../transactions";
3
+ export declare class PgAgentMessageStore implements AgentMessageStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ append(input: AppendAgentMessageInput): Promise<AgentMessageRecord>;
7
+ getById(params: {
8
+ projectId: string;
9
+ id: string;
10
+ }): Promise<AgentMessageRecord | null>;
11
+ list(input: ListAgentMessagesInput): Promise<ListAgentMessagesResult>;
12
+ }
13
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/agents/messages.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,iBAAiB,CAAA;AAGtE,qBAAa,mBAAoB,YAAW,iBAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyFnE,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAQtF,IAAI,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CA6B5E"}
@@ -0,0 +1,77 @@
1
+ import { type AgentMessagePart, type Principal } from "@sixb/core";
2
+ import { type AgentMessageRecord, type AgentRunDiagnostic, type AgentRunRecord, type AgentThreadRecord } from "@sixb/core/storage";
3
+ import type { SQLClient, SqlParameter } from "../pg-client";
4
+ export interface AgentThreadRow {
5
+ project_id: string;
6
+ id: string;
7
+ agent_id: string;
8
+ owner_principal_type: Principal["type"];
9
+ owner_principal_id: string;
10
+ title: string | null;
11
+ status: AgentThreadRecord["status"];
12
+ active_run_id: string | null;
13
+ last_message_at: Date | string | null;
14
+ message_count: number | string;
15
+ created_at: Date | string;
16
+ updated_at: Date | string;
17
+ }
18
+ export interface AgentRunRow {
19
+ project_id: string;
20
+ id: string;
21
+ thread_id: string;
22
+ agent_id: string;
23
+ trigger_message_id: string;
24
+ requested_by_principal_type: Principal["type"] | null;
25
+ requested_by_principal_id: string | null;
26
+ execution_principal_type: "serviceAccount" | null;
27
+ execution_principal_id: string | null;
28
+ status: AgentRunRecord["status"];
29
+ model_id: string | null;
30
+ finish_reason: string | null;
31
+ usage_input_tokens: number | string | null;
32
+ usage_output_tokens: number | string | null;
33
+ usage_total_tokens: number | string | null;
34
+ usage_reasoning_tokens: number | string | null;
35
+ usage_cached_input_tokens: number | string | null;
36
+ error: string | null;
37
+ diagnostics: AgentRunDiagnostic[] | string | null;
38
+ attempt: number | string;
39
+ execution_token: string | null;
40
+ execution_queue_lease_expires_at: Date | string | null;
41
+ created_at: Date | string;
42
+ started_at: Date | string | null;
43
+ completed_at: Date | string | null;
44
+ }
45
+ export interface AgentMessageRow {
46
+ project_id: string;
47
+ id: string;
48
+ thread_id: string;
49
+ run_id: string | null;
50
+ role: AgentMessageRecord["role"];
51
+ author_principal_type: Principal["type"] | null;
52
+ author_principal_id: string | null;
53
+ seq: number | string;
54
+ parts: AgentMessagePart[] | string;
55
+ metadata: unknown;
56
+ content_version: number | string;
57
+ created_at: Date | string;
58
+ completed_at: Date | string | null;
59
+ }
60
+ export declare function rowToThreadRecord(row: AgentThreadRow): AgentThreadRecord;
61
+ export declare function rowToRunRecord(row: AgentRunRow): AgentRunRecord;
62
+ export declare function rowToMessageRecord(row: AgentMessageRow): AgentMessageRecord;
63
+ export declare function queryAgentList<TRow>(input: {
64
+ readonly sql: SQLClient;
65
+ readonly table: "agent_threads" | "agent_messages";
66
+ readonly whereClauses: readonly string[];
67
+ readonly params: readonly SqlParameter[];
68
+ readonly nextIndex: number;
69
+ readonly orderBy: string;
70
+ readonly limit?: number;
71
+ readonly offset?: number;
72
+ }): Promise<{
73
+ readonly rows: readonly TRow[];
74
+ readonly total: number;
75
+ readonly hasMore: boolean;
76
+ }>;
77
+ //# sourceMappingURL=rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/agents/rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAoB,MAAM,YAAY,CAAA;AACpF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,YA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AgC/D;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,GAAG,kBAAkB,CAkB3E;AAkDD,wBAAsB,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE;IAChD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAAA;IAClD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,GAAG,OAAO,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAwBjG"}
@@ -0,0 +1,25 @@
1
+ import { type AgentRunRecord, type AgentRunStore, type ConfirmAgentRunExecutionOwnershipInput, type CreateAgentRunInput, type FinishAgentRunInput, type FinishQueuedAgentRunInput, type ListAgentRunsInput, type ListAgentRunsResult, type ReclaimAgentRunInput, type StartAgentRunInput } from "@sixb/core/storage";
2
+ import { type PgStoreClient } from "../transactions";
3
+ export declare class PgAgentRunStore implements AgentRunStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ create(input: CreateAgentRunInput): Promise<AgentRunRecord>;
7
+ start(input: StartAgentRunInput): Promise<AgentRunRecord>;
8
+ finishQueued(input: FinishQueuedAgentRunInput): Promise<AgentRunRecord>;
9
+ reclaim(input: ReclaimAgentRunInput): Promise<AgentRunRecord>;
10
+ confirmExecutionOwnership(input: ConfirmAgentRunExecutionOwnershipInput): Promise<AgentRunRecord>;
11
+ finish(input: FinishAgentRunInput): Promise<AgentRunRecord>;
12
+ getById(params: {
13
+ projectId: string;
14
+ id: string;
15
+ }): Promise<AgentRunRecord | null>;
16
+ getByIds(params: {
17
+ projectId: string;
18
+ ids: readonly string[];
19
+ }): Promise<readonly AgentRunRecord[]>;
20
+ list(input: ListAgentRunsInput): Promise<ListAgentRunsResult>;
21
+ private lockRunning;
22
+ private lockStatus;
23
+ private releaseThread;
24
+ }
25
+ //# sourceMappingURL=runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/agents/runs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,sCAAsC,EAC3C,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAA;AAI3B,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,iBAAiB,CAAA;AAKtE,qBAAa,eAAgB,YAAW,aAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAuE3D,KAAK,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAsBzD,YAAY,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC;IAevE,OAAO,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAiB7D,yBAAyB,CAC7B,KAAK,EAAE,sCAAsC,GAC5C,OAAO,CAAC,cAAc,CAAC;IAuBpB,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAwC3D,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAQlF,QAAQ,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,MAAM,CAAA;QACjB,GAAG,EAAE,SAAS,MAAM,EAAE,CAAA;KACvB,GAAG,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC;IAwBhC,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAyCnE,OAAO,CAAC,WAAW;YAIL,UAAU;YA6BV,aAAa;CAM5B"}
@@ -0,0 +1,13 @@
1
+ import { type AgentThreadRecord, type AgentThreadStore, type CreateAgentThreadInput, type ListAgentThreadsInput, type ListAgentThreadsResult } from "@sixb/core/storage";
2
+ import type { PgStoreClient } from "../transactions";
3
+ export declare class PgAgentThreadStore implements AgentThreadStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ create(input: CreateAgentThreadInput): Promise<AgentThreadRecord>;
7
+ getById(params: {
8
+ projectId: string;
9
+ id: string;
10
+ }): Promise<AgentThreadRecord | null>;
11
+ list(input: ListAgentThreadsInput): Promise<ListAgentThreadsResult>;
12
+ }
13
+ //# sourceMappingURL=threads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/agents/threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGpD,qBAAa,kBAAmB,YAAW,gBAAgB;IAC7C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA2CjE,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAQrF,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAgD1E"}
@@ -0,0 +1,33 @@
1
+ import type { AccessTokenRecord, AuthAccessTokenStore, CreateAuthAccessTokenInput, ListAuthAccessTokensInput, ListAuthAccessTokensResult } from "@sixb/core/storage";
2
+ import type { PgStoreClient } from "../transactions";
3
+ export declare class PgAuthAccessTokenStore implements AuthAccessTokenStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ create(input: CreateAuthAccessTokenInput): Promise<AccessTokenRecord>;
7
+ getById(params: {
8
+ readonly projectId: string;
9
+ readonly id: string;
10
+ }): Promise<AccessTokenRecord | null>;
11
+ list(input: ListAuthAccessTokensInput): Promise<ListAuthAccessTokensResult>;
12
+ findValidByTokenHash(params: {
13
+ readonly projectId: string;
14
+ readonly id: string;
15
+ readonly kind: AccessTokenRecord["kind"];
16
+ readonly tokenHash: string;
17
+ readonly now: Date;
18
+ }): Promise<AccessTokenRecord | null>;
19
+ revoke(params: {
20
+ readonly projectId: string;
21
+ readonly id: string;
22
+ readonly revokedAt: Date;
23
+ }): Promise<AccessTokenRecord>;
24
+ touch(params: {
25
+ readonly projectId: string;
26
+ readonly id: string;
27
+ readonly lastUsedAt: Date;
28
+ readonly userAgent?: string;
29
+ readonly ipAddress?: string;
30
+ }): Promise<AccessTokenRecord>;
31
+ private assertSubjectExists;
32
+ }
33
+ //# sourceMappingURL=access-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-tokens.d.ts","sourceRoot":"","sources":["../../src/auth-storage/access-tokens.ts"],"names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AE,MAAM,CAAA;QACnB,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAA;QACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAC5B,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAmBhB,mBAAmB;CA+BlC"}
@@ -0,0 +1,41 @@
1
+ import type { AuthStorage, CompleteMagicLinkSignInInput, CompleteOidcSignInInput, CompleteSignInResult, SuspendUserAndRevokeSessionsInput, UserRecord } from "@sixb/core/storage";
2
+ import { type PgStoreClient } from "../transactions";
3
+ import { PgAuthAccessTokenStore } from "./access-tokens";
4
+ import { PgAuthGroupMembershipStore } from "./group-memberships";
5
+ import { PgAuthUserIdentityStore } from "./identities";
6
+ import { PgAuthInvitationStore } from "./invitations";
7
+ import { PgAuthMagicLinkStore } from "./magic-links";
8
+ import { PgAuthOidcAuthorizationAttemptStore } from "./oidc-attempts";
9
+ import { PgAuthServiceAccountGroupMembershipStore } from "./service-account-group-memberships";
10
+ import { PgAuthServiceAccountStore } from "./service-accounts";
11
+ import { PgAuthSessionStore } from "./sessions";
12
+ import { PgAuthUserStore } from "./users";
13
+ export interface PgAuthStorageOptions {
14
+ readonly sql: PgStoreClient;
15
+ }
16
+ export declare class PgAuthStorage implements AuthStorage {
17
+ private readonly sql;
18
+ readonly users: PgAuthUserStore;
19
+ readonly identities: PgAuthUserIdentityStore;
20
+ readonly serviceAccounts: PgAuthServiceAccountStore;
21
+ readonly serviceAccountGroupMemberships: PgAuthServiceAccountGroupMembershipStore;
22
+ readonly sessions: PgAuthSessionStore;
23
+ readonly accessTokens: PgAuthAccessTokenStore;
24
+ readonly invitations: PgAuthInvitationStore;
25
+ readonly groupMemberships: PgAuthGroupMembershipStore;
26
+ readonly magicLinks: PgAuthMagicLinkStore;
27
+ readonly oidcAuthorizationAttempts: PgAuthOidcAuthorizationAttemptStore;
28
+ constructor(options: PgAuthStorageOptions);
29
+ completeMagicLinkSignIn(input: CompleteMagicLinkSignInInput): Promise<CompleteSignInResult>;
30
+ completeOidcSignIn(input: CompleteOidcSignInInput): Promise<CompleteSignInResult>;
31
+ suspendUserAndRevokeSessions(input: SuspendUserAndRevokeSessionsInput): Promise<UserRecord>;
32
+ private assertMagicLinkUsable;
33
+ private assertOidcAttemptUsable;
34
+ private insertUser;
35
+ private acceptInvitationAndApplyGroups;
36
+ private applyManualGroups;
37
+ private createSignInSession;
38
+ private consumeOidcAttempt;
39
+ private upsertIdentity;
40
+ }
41
+ //# sourceMappingURL=auth-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-storage.d.ts","sourceRoot":"","sources":["../../src/auth-storage/auth-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,4BAA4B,EAC5B,uBAAuB,EACvB,oBAAoB,EAIpB,iCAAiC,EAEjC,UAAU,EACX,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAA;AAQrE,OAAO,EAAE,wCAAwC,EAAE,MAAM,qCAAqC,CAAA;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAqB/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMzC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;CAC5B;AAED,qBAAa,aAAc,YAAW,WAAW;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IAEnC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAA;IAC5C,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAAA;IACnD,QAAQ,CAAC,8BAA8B,EAAE,wCAAwC,CAAA;IACjF,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAA;IACrC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAA;IAC7C,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,0BAA0B,CAAA;IACrD,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAA;IACzC,QAAQ,CAAC,yBAAyB,EAAE,mCAAmC,CAAA;gBAE3D,OAAO,EAAE,oBAAoB;IAcnC,uBAAuB,CAC3B,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAyL1B,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAqNjF,4BAA4B,CAChC,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,UAAU,CAAC;IAsCtB,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,uBAAuB;YAiBjB,UAAU;YA6CV,8BAA8B;YA+C9B,iBAAiB;YA2BjB,mBAAmB;YA6BnB,kBAAkB;YAclB,cAAc;CAwC7B"}
@@ -0,0 +1,21 @@
1
+ import type { AuthGroupMembershipStore, GroupMembershipRecord, UpsertAuthGroupMembershipInput } from "@sixb/core/storage";
2
+ import type { PgStoreClient } from "../transactions";
3
+ export declare class PgAuthGroupMembershipStore implements AuthGroupMembershipStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ upsert(input: UpsertAuthGroupMembershipInput): Promise<GroupMembershipRecord>;
7
+ remove(params: {
8
+ readonly projectId: string;
9
+ readonly userId: string;
10
+ readonly groupId: string;
11
+ }): Promise<GroupMembershipRecord | null>;
12
+ listForUser(params: {
13
+ readonly projectId: string;
14
+ readonly userId: string;
15
+ }): Promise<readonly GroupMembershipRecord[]>;
16
+ listForGroup(params: {
17
+ readonly projectId: string;
18
+ readonly groupId: string;
19
+ }): Promise<readonly GroupMembershipRecord[]>;
20
+ }
21
+ //# sourceMappingURL=group-memberships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-memberships.d.ts","sourceRoot":"","sources":["../../src/auth-storage/group-memberships.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAKpD,qBAAa,0BAA2B,YAAW,wBAAwB;IAC7D,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI7E,MAAM,CAAC,MAAM,EAAE;QACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KACzB,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAInC,WAAW,CAAC,MAAM,EAAE;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KACxB,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC;IAIvC,YAAY,CAAC,MAAM,EAAE;QACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KACzB,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC;CAW9C"}
@@ -0,0 +1,17 @@
1
+ import type { AuthUserIdentityStore, UpsertAuthUserIdentityInput, UserIdentityRecord } from "@sixb/core/storage";
2
+ import type { PgStoreClient } from "../transactions";
3
+ export declare class PgAuthUserIdentityStore implements AuthUserIdentityStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ upsert(input: UpsertAuthUserIdentityInput): Promise<UserIdentityRecord>;
7
+ getBySubject(params: {
8
+ readonly projectId: string;
9
+ readonly strategyId: string;
10
+ readonly subject: string;
11
+ }): Promise<UserIdentityRecord | null>;
12
+ listForUser(params: {
13
+ readonly projectId: string;
14
+ readonly userId: string;
15
+ }): Promise<readonly UserIdentityRecord[]>;
16
+ }
17
+ //# sourceMappingURL=identities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identities.d.ts","sourceRoot":"","sources":["../../src/auth-storage/identities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAKpD,qBAAa,uBAAwB,YAAW,qBAAqB;IACvD,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgDvE,YAAY,CAAC,MAAM,EAAE;QACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KACzB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAKhC,WAAW,CAAC,MAAM,EAAE;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KACxB,GAAG,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC;CAW3C"}
@@ -0,0 +1,3 @@
1
+ export type { PgAuthStorageOptions } from "./auth-storage";
2
+ export { PgAuthStorage } from "./auth-storage";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth-storage/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import type { AuthInvitationStore, CreateOrUpdateAuthInvitationInput, InvitationRecord, ListAuthInvitationsInput, ListAuthInvitationsResult } from "@sixb/core/storage";
2
+ import { type PgStoreClient } from "../transactions";
3
+ export declare class PgAuthInvitationStore implements AuthInvitationStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ createOrUpdateActive(input: CreateOrUpdateAuthInvitationInput): Promise<InvitationRecord>;
7
+ getById(params: {
8
+ readonly projectId: string;
9
+ readonly id: string;
10
+ }): Promise<InvitationRecord | null>;
11
+ getActiveByEmail(params: {
12
+ readonly projectId: string;
13
+ readonly email: string;
14
+ readonly now: Date;
15
+ }): Promise<InvitationRecord | null>;
16
+ list(input: ListAuthInvitationsInput): Promise<ListAuthInvitationsResult>;
17
+ accept(params: {
18
+ readonly projectId: string;
19
+ readonly id: string;
20
+ readonly acceptedAt: Date;
21
+ }): Promise<InvitationRecord>;
22
+ revoke(params: {
23
+ readonly projectId: string;
24
+ readonly id: string;
25
+ readonly revokedAt: Date;
26
+ }): Promise<InvitationRecord>;
27
+ private validateCreator;
28
+ }
29
+ //# sourceMappingURL=invitations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/auth-storage/invitations.ts"],"names":[],"mappings":"AAAA,OAAO,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0,0 +1,28 @@
1
+ import type { AuthMagicLinkStore, CreateAuthMagicLinkInput, MagicLinkRecord } from "@sixb/core/storage";
2
+ import { type PgStoreClient } from "../transactions";
3
+ export declare class PgAuthMagicLinkStore implements AuthMagicLinkStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ create(input: CreateAuthMagicLinkInput): Promise<MagicLinkRecord>;
7
+ getById(params: {
8
+ readonly projectId: string;
9
+ readonly id: string;
10
+ }): Promise<MagicLinkRecord | null>;
11
+ getActiveByEmail(params: {
12
+ readonly projectId: string;
13
+ readonly email: string;
14
+ readonly now: Date;
15
+ }): Promise<MagicLinkRecord | null>;
16
+ consume(params: {
17
+ readonly projectId: string;
18
+ readonly id: string;
19
+ readonly tokenHash: string;
20
+ readonly consumedAt: Date;
21
+ }): Promise<MagicLinkRecord>;
22
+ revokeActiveForEmail(params: {
23
+ readonly projectId: string;
24
+ readonly email: string;
25
+ readonly revokedAt: Date;
26
+ }): Promise<readonly MagicLinkRecord[]>;
27
+ }
28
+ //# sourceMappingURL=magic-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magic-links.d.ts","sourceRoot":"","sources":["../../src/auth-storage/magic-links.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EAChB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,iBAAiB,CAAA;AAaxB,qBAAa,oBAAqB,YAAW,kBAAkB;IACjD,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;IA6DjE,OAAO,CAAC,MAAM,EAAE;QACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KACpB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAI7B,gBAAgB,CAAC,MAAM,EAAE;QAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;KACnB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAgB7B,OAAO,CAAC,MAAM,EAAE;QACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAA;KAC1B,GAAG,OAAO,CAAC,eAAe,CAAC;IAItB,oBAAoB,CAAC,MAAM,EAAE;QACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAA;KACzB,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;CAUxC"}
@@ -0,0 +1,18 @@
1
+ import type { AuthOidcAuthorizationAttemptStore, CreateOidcAuthorizationAttemptInput, OidcAuthorizationAttemptRecord } from "@sixb/core/storage";
2
+ import { type PgStoreClient } from "../transactions";
3
+ export declare class PgAuthOidcAuthorizationAttemptStore implements AuthOidcAuthorizationAttemptStore {
4
+ private readonly sql;
5
+ constructor(sql: PgStoreClient);
6
+ create(input: CreateOidcAuthorizationAttemptInput): Promise<OidcAuthorizationAttemptRecord>;
7
+ getById(params: {
8
+ readonly projectId: string;
9
+ readonly id: string;
10
+ }): Promise<OidcAuthorizationAttemptRecord | null>;
11
+ consume(params: {
12
+ readonly projectId: string;
13
+ readonly id: string;
14
+ readonly stateHash: string;
15
+ readonly consumedAt: Date;
16
+ }): Promise<OidcAuthorizationAttemptRecord>;
17
+ }
18
+ //# sourceMappingURL=oidc-attempts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oidc-attempts.d.ts","sourceRoot":"","sources":["../../src/auth-storage/oidc-attempts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iCAAiC,EACjC,mCAAmC,EACnC,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,iBAAiB,CAAA;AAWtE,qBAAa,mCAAoC,YAAW,iCAAiC;IAC/E,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CACV,KAAK,EAAE,mCAAmC,GACzC,OAAO,CAAC,8BAA8B,CAAC;IAsDpC,OAAO,CAAC,MAAM,EAAE;QACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KACpB,GAAG,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC;IAI5C,OAAO,CAAC,MAAM,EAAE;QACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAA;KAC1B,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAG5C"}