@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.
- package/dist/chunk-57MLICFR.js +121 -0
- package/dist/chunk-57MLICFR.js.map +1 -0
- package/dist/chunk-OGCE6O2X.js +52 -0
- package/dist/chunk-OGCE6O2X.js.map +1 -0
- package/dist/chunk-PSX56ZTL.js +1093 -0
- package/dist/chunk-PSX56ZTL.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5165 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +40 -0
- package/dist/migrate.js +10 -0
- package/dist/migrate.js.map +1 -0
- package/dist/provision-roles.d.ts +2063 -0
- package/dist/provision-roles.js +8 -0
- package/dist/provision-roles.js.map +1 -0
- package/dist/schema-CaeZQAJQ.d.ts +9705 -0
- package/dist/schema.d.ts +3 -0
- package/dist/schema.js +110 -0
- package/dist/schema.js.map +1 -0
- package/drizzle/0000_initial.sql +179 -0
- package/drizzle/0001_workspace_auth_billing.sql +590 -0
- package/drizzle/0002_packs_and_social.sql +99 -0
- package/drizzle/0003_capability_catalog.sql +73 -0
- package/drizzle/0004_workspace_environments.sql +65 -0
- package/drizzle/0005_session_goals.sql +45 -0
- package/drizzle/0006_workspace_packs.sql +31 -0
- package/drizzle/0007_session_history_items.sql +66 -0
- package/drizzle/0008_session_first_party_mcp_permissions.sql +5 -0
- package/drizzle/0009_goal_sessions_first_party_goals_manage.sql +34 -0
- package/drizzle/0010_session_parent_linkage.sql +30 -0
- package/drizzle/0011_context_compaction.sql +33 -0
- package/drizzle/0012_compaction_summary_fractional_position.sql +19 -0
- package/drizzle/0013_session_compact_requested.sql +16 -0
- package/drizzle/0014_repair_orphaned_function_call_results.sql +125 -0
- package/drizzle/0015_workspace_agent_instructions.sql +17 -0
- package/drizzle/0016_session_create_idempotency.sql +27 -0
- package/drizzle/0017_sandbox_leases.sql +313 -0
- package/drizzle/0018_sandbox_os.sql +89 -0
- package/drizzle/0019_session_stream_acknowledgments.sql +94 -0
- package/drizzle/0020_session_recordings.sql +88 -0
- package/drizzle/0021_sandbox_pty_sessions.sql +70 -0
- package/drizzle/0022_sandbox_lease_terminal_url.sql +32 -0
- package/drizzle/0023_session_title.sql +19 -0
- package/drizzle/0024_codex_subscription_credentials.sql +51 -0
- package/drizzle/0024_sandboxes_enrollments_metrics.sql +262 -0
- package/drizzle/0025_device_enrollment_requests.sql +142 -0
- package/drizzle/0026_device_enrollment_user_code_resolver.sql +47 -0
- package/drizzle/0027_session_working_dir.sql +24 -0
- package/drizzle/0028_codex_multi_account.sql +85 -0
- package/drizzle/0029_session_history_item_producer.sql +31 -0
- package/drizzle/0030_agent_run_state_frozen_codex.sql +35 -0
- package/drizzle/0031_codex_usage_cache.sql +21 -0
- package/drizzle/0032_codex_account_cooldown.sql +18 -0
- package/drizzle/0033_codex_connector_cache.sql +20 -0
- package/drizzle/0034_sandbox_lease_image.sql +21 -0
- package/drizzle/meta/_journal.json +167 -0
- package/package.json +66 -0
- package/src/codex-token-resolver.ts +247 -0
- package/src/environment-crypto.ts +51 -0
- package/src/event-payload-sanitizer.ts +89 -0
- package/src/index.ts +7776 -0
- package/src/migrate.ts +95 -0
- package/src/provision-roles.ts +198 -0
- 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 };
|
package/dist/migrate.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|