@opengeni/db 0.2.0

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 (66) hide show
  1. package/dist/chunk-57MLICFR.js +121 -0
  2. package/dist/chunk-57MLICFR.js.map +1 -0
  3. package/dist/chunk-OGCE6O2X.js +52 -0
  4. package/dist/chunk-OGCE6O2X.js.map +1 -0
  5. package/dist/chunk-PSX56ZTL.js +1093 -0
  6. package/dist/chunk-PSX56ZTL.js.map +1 -0
  7. package/dist/chunk-PZ5AY32C.js +10 -0
  8. package/dist/chunk-PZ5AY32C.js.map +1 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.js +5165 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/migrate.d.ts +40 -0
  13. package/dist/migrate.js +10 -0
  14. package/dist/migrate.js.map +1 -0
  15. package/dist/provision-roles.d.ts +2063 -0
  16. package/dist/provision-roles.js +8 -0
  17. package/dist/provision-roles.js.map +1 -0
  18. package/dist/schema-CaeZQAJQ.d.ts +9705 -0
  19. package/dist/schema.d.ts +3 -0
  20. package/dist/schema.js +110 -0
  21. package/dist/schema.js.map +1 -0
  22. package/drizzle/0000_initial.sql +179 -0
  23. package/drizzle/0001_workspace_auth_billing.sql +590 -0
  24. package/drizzle/0002_packs_and_social.sql +99 -0
  25. package/drizzle/0003_capability_catalog.sql +73 -0
  26. package/drizzle/0004_workspace_environments.sql +65 -0
  27. package/drizzle/0005_session_goals.sql +45 -0
  28. package/drizzle/0006_workspace_packs.sql +31 -0
  29. package/drizzle/0007_session_history_items.sql +66 -0
  30. package/drizzle/0008_session_first_party_mcp_permissions.sql +5 -0
  31. package/drizzle/0009_goal_sessions_first_party_goals_manage.sql +34 -0
  32. package/drizzle/0010_session_parent_linkage.sql +30 -0
  33. package/drizzle/0011_context_compaction.sql +33 -0
  34. package/drizzle/0012_compaction_summary_fractional_position.sql +19 -0
  35. package/drizzle/0013_session_compact_requested.sql +16 -0
  36. package/drizzle/0014_repair_orphaned_function_call_results.sql +125 -0
  37. package/drizzle/0015_workspace_agent_instructions.sql +17 -0
  38. package/drizzle/0016_session_create_idempotency.sql +27 -0
  39. package/drizzle/0017_sandbox_leases.sql +313 -0
  40. package/drizzle/0018_sandbox_os.sql +89 -0
  41. package/drizzle/0019_session_stream_acknowledgments.sql +94 -0
  42. package/drizzle/0020_session_recordings.sql +88 -0
  43. package/drizzle/0021_sandbox_pty_sessions.sql +70 -0
  44. package/drizzle/0022_sandbox_lease_terminal_url.sql +32 -0
  45. package/drizzle/0023_session_title.sql +19 -0
  46. package/drizzle/0024_codex_subscription_credentials.sql +51 -0
  47. package/drizzle/0024_sandboxes_enrollments_metrics.sql +262 -0
  48. package/drizzle/0025_device_enrollment_requests.sql +142 -0
  49. package/drizzle/0026_device_enrollment_user_code_resolver.sql +47 -0
  50. package/drizzle/0027_session_working_dir.sql +24 -0
  51. package/drizzle/0028_codex_multi_account.sql +85 -0
  52. package/drizzle/0029_session_history_item_producer.sql +31 -0
  53. package/drizzle/0030_agent_run_state_frozen_codex.sql +35 -0
  54. package/drizzle/0031_codex_usage_cache.sql +21 -0
  55. package/drizzle/0032_codex_account_cooldown.sql +18 -0
  56. package/drizzle/0033_codex_connector_cache.sql +20 -0
  57. package/drizzle/0034_sandbox_lease_image.sql +21 -0
  58. package/drizzle/meta/_journal.json +167 -0
  59. package/package.json +66 -0
  60. package/src/codex-token-resolver.ts +247 -0
  61. package/src/environment-crypto.ts +51 -0
  62. package/src/event-payload-sanitizer.ts +89 -0
  63. package/src/index.ts +7776 -0
  64. package/src/migrate.ts +95 -0
  65. package/src/provision-roles.ts +198 -0
  66. package/src/schema.ts +1110 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Apply the OpenGeni SQL migration chain.
3
+ *
4
+ * STANDALONE (default, unchanged): `migrate()` / `migrate(databaseUrl)` runs the
5
+ * whole chain with NO search_path manipulation, so every unqualified
6
+ * table/index/policy lands in the server default schema (`public`). This is the
7
+ * byte-for-byte historical behavior — the migration test suite calls
8
+ * `migrate(DB_URL)` and is unaffected.
9
+ *
10
+ * EMBEDDED (Step I, §7.8 runtime/SDK half): pass a `schema` (or set
11
+ * `OPENGENI_DB_SCHEMA`). The migrate session then `CREATE SCHEMA IF NOT EXISTS`
12
+ * for both `<schema>` and `opengeni_private`, and sets
13
+ * `search_path = "<schema>", "opengeni_private", "public"`, so EVERY unqualified
14
+ * DDL statement lands in the dedicated schema with NO per-statement SQL rewrite
15
+ * (the SPIKE-1 F1 result). Two things make this work and stay idempotent:
16
+ * 1. The policy-existence guards in the migration SQL use `current_schema()`
17
+ * (not a hardcoded `'public'`) — so a re-run finds the policy it already
18
+ * created in `<schema>` and DROP/CREATEs idempotently instead of failing
19
+ * with "policy already exists". (This guard substitution is the migrate-
20
+ * time enabler for the runtime search_path approach; without it the SDK
21
+ * entry point silently fails on re-run — the Fork-6 hazard.)
22
+ * 2. `public` stays LAST on the path so `gen_random_uuid()` (pgcrypto) and the
23
+ * `vector` type — both installed into `public` by 0000 — still resolve. The
24
+ * `opengeni_private.*` helpers are always called with an absolute prefix.
25
+ *
26
+ * `OPENGENI_DB_SCHEMA` defaults UNSET → `public` → standalone, so the default
27
+ * binding never regresses.
28
+ */
29
+ declare function migrate(databaseUrl?: string, schema?: string | undefined): Promise<void>;
30
+ /**
31
+ * SDK entry point (Step I): run the migration chain over a host-supplied admin
32
+ * connection string against an explicit target schema. This is the embedded
33
+ * topology's named entry — a host calls `runMigrations(adminConnection,
34
+ * targetSchema)` from its own provisioning code instead of relying on env vars.
35
+ * `targetSchema` undefined → `public` → standalone behavior. Thin wrapper over
36
+ * `migrate` so there is one migration engine.
37
+ */
38
+ declare function runMigrations(adminConnection: string, targetSchema?: string): Promise<void>;
39
+
40
+ export { migrate, runMigrations };
@@ -0,0 +1,10 @@
1
+ import {
2
+ migrate,
3
+ runMigrations
4
+ } from "./chunk-OGCE6O2X.js";
5
+ import "./chunk-PZ5AY32C.js";
6
+ export {
7
+ migrate,
8
+ runMigrations
9
+ };
10
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}