@fusebase/fusebase-gate-sdk 2.2.2-sdk.26 → 2.2.2-sdk.28

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.
@@ -11,7 +11,7 @@ export declare class IsolatedStoresApi {
11
11
  constructor(client: Client);
12
12
  /**
13
13
  * Apply SQL migrations
14
- * Applies pending postgres migrations from an ordered migration bundle into the selected stage database. For prod, gate creates a checkpoint automatically before applying pending migrations. Applied history must match the bundle prefix exactly; drifted stages are rejected. Never change name, checksum, or sql for migrations already in the journal — ship fixes as new higher versions (see MCP prompt isolatedSqlMigrationDiscipline). MCP clients often cap tool_call JSON body size (on the order of a few thousand characters); the request includes full SQL text for every bundle version cumulatively, so large bundles may fail or truncate in chat-only MCP. Keep canonical SQL plus a manifest for apply from SDK, CLI, or any non-MCP caller without a tight body-size limit.
14
+ * Workflow: call `getIsolatedStoreSqlMigrationStatus` with the **same** bundle, confirm `canApply` and expected `pendingCount`, then apply. Applies pending postgres migrations from an ordered bundle into the selected stage database. For prod, gate creates a checkpoint automatically before applying pending migrations. Applied history must match the bundle prefix exactly; drift returns HTTP 409 with `data.issues` (version/name/checksum, journal vs bundle). Optional `dryRun: true` performs the same prefix + optimistic-lock checks as apply but does not run SQL or write the journal (returns `dryRun: true` and the computed status). Optional `expectedLastAppliedVersion` / `expectedLastAppliedChecksum` reject with HTTP 409 before migrations run when the journal tail changed since the client's last status snapshot. Never change name, checksum, or sql for migrations already in the journal — ship fixes as new higher versions (see MCP prompt isolatedSqlMigrationDiscipline). MCP clients often cap tool_call JSON body size (on the order of a few thousand characters); the request includes full SQL text for every bundle version cumulatively, so large bundles may fail or truncate in chat-only MCP. Keep canonical SQL plus a manifest for apply from SDK, CLI, or any non-MCP caller without a tight body-size limit.
15
15
  */
16
16
  applyIsolatedStoreSqlMigrations(params: {
17
17
  path: {
@@ -216,7 +216,7 @@ export declare class IsolatedStoresApi {
216
216
  }): Promise<IsolatedStoreNoSqlStatsResponseContract>;
217
217
  /**
218
218
  * Get SQL migration status
219
- * Compares an ordered SQL migration bundle with the migration journal stored inside the selected postgres stage database. Returns applied migrations, pending migrations, and drift issues when the applied history no longer matches the bundle prefix. Load MCP prompt isolatedSqlMigrationDiscipline (required with isolatedSql/isolated groups) before interpreting drift — do not edit applied migration metadata or the journal to force a match.
219
+ * Compares an ordered SQL migration bundle with the migration journal stored inside the selected postgres stage database. Returns applied migrations, pending migrations, drift issues when the applied history no longer matches the bundle prefix, and `canApply` / `structuredIssues` for automation. Prefer calling this immediately before `applyIsolatedStoreSqlMigrations` with the same bundle. Optional request fields `expectedLastAppliedVersion` / `expectedLastAppliedChecksum` (same semantics as apply) reject with HTTP 409 when the live journal tail disagrees — useful as a cheap preflight without sending `dryRun` on apply. Load MCP prompt isolatedSqlMigrationDiscipline (required with isolatedSql/isolated groups) before interpreting drift — do not edit applied migration metadata or the journal to force a match.
220
220
  */
221
221
  getIsolatedStoreSqlMigrationStatus(params: {
222
222
  path: {
@@ -13,7 +13,7 @@ class IsolatedStoresApi {
13
13
  }
14
14
  /**
15
15
  * Apply SQL migrations
16
- * Applies pending postgres migrations from an ordered migration bundle into the selected stage database. For prod, gate creates a checkpoint automatically before applying pending migrations. Applied history must match the bundle prefix exactly; drifted stages are rejected. Never change name, checksum, or sql for migrations already in the journal — ship fixes as new higher versions (see MCP prompt isolatedSqlMigrationDiscipline). MCP clients often cap tool_call JSON body size (on the order of a few thousand characters); the request includes full SQL text for every bundle version cumulatively, so large bundles may fail or truncate in chat-only MCP. Keep canonical SQL plus a manifest for apply from SDK, CLI, or any non-MCP caller without a tight body-size limit.
16
+ * Workflow: call `getIsolatedStoreSqlMigrationStatus` with the **same** bundle, confirm `canApply` and expected `pendingCount`, then apply. Applies pending postgres migrations from an ordered bundle into the selected stage database. For prod, gate creates a checkpoint automatically before applying pending migrations. Applied history must match the bundle prefix exactly; drift returns HTTP 409 with `data.issues` (version/name/checksum, journal vs bundle). Optional `dryRun: true` performs the same prefix + optimistic-lock checks as apply but does not run SQL or write the journal (returns `dryRun: true` and the computed status). Optional `expectedLastAppliedVersion` / `expectedLastAppliedChecksum` reject with HTTP 409 before migrations run when the journal tail changed since the client's last status snapshot. Never change name, checksum, or sql for migrations already in the journal — ship fixes as new higher versions (see MCP prompt isolatedSqlMigrationDiscipline). MCP clients often cap tool_call JSON body size (on the order of a few thousand characters); the request includes full SQL text for every bundle version cumulatively, so large bundles may fail or truncate in chat-only MCP. Keep canonical SQL plus a manifest for apply from SDK, CLI, or any non-MCP caller without a tight body-size limit.
17
17
  */
18
18
  async applyIsolatedStoreSqlMigrations(params) {
19
19
  return this.client.request({
@@ -247,7 +247,7 @@ class IsolatedStoresApi {
247
247
  }
248
248
  /**
249
249
  * Get SQL migration status
250
- * Compares an ordered SQL migration bundle with the migration journal stored inside the selected postgres stage database. Returns applied migrations, pending migrations, and drift issues when the applied history no longer matches the bundle prefix. Load MCP prompt isolatedSqlMigrationDiscipline (required with isolatedSql/isolated groups) before interpreting drift — do not edit applied migration metadata or the journal to force a match.
250
+ * Compares an ordered SQL migration bundle with the migration journal stored inside the selected postgres stage database. Returns applied migrations, pending migrations, drift issues when the applied history no longer matches the bundle prefix, and `canApply` / `structuredIssues` for automation. Prefer calling this immediately before `applyIsolatedStoreSqlMigrations` with the same bundle. Optional request fields `expectedLastAppliedVersion` / `expectedLastAppliedChecksum` (same semantics as apply) reject with HTTP 409 when the live journal tail disagrees — useful as a cheap preflight without sending `dryRun` on apply. Load MCP prompt isolatedSqlMigrationDiscipline (required with isolatedSql/isolated groups) before interpreting drift — do not edit applied migration metadata or the journal to force a match.
251
251
  */
252
252
  async getIsolatedStoreSqlMigrationStatus(params) {
253
253
  return this.client.request({
@@ -133,6 +133,37 @@ export interface IsolatedStoreSqlAppliedMigrationContract {
133
133
  appliedAt: string;
134
134
  appliedBy: string;
135
135
  }
136
+ export type IsolatedStoreSqlMigrationIssueCodeContract = "isolated_sql_journal_longer_than_bundle" | "isolated_sql_version_mismatch" | "isolated_sql_name_mismatch" | "isolated_sql_checksum_mismatch" | "isolated_sql_journal_head_mismatch";
137
+ export type IsolatedStoreSqlMigrationIssueFieldContract = "history_length" | "version" | "name" | "checksum" | "journal_head";
138
+ /** Machine-readable drift detail; omits raw SQL (only safe fingerprints). */
139
+ export interface IsolatedStoreSqlMigrationIssueContract {
140
+ code: IsolatedStoreSqlMigrationIssueCodeContract;
141
+ message: string;
142
+ /** Bundle migration version at the comparison index when relevant. */
143
+ version?: number | null;
144
+ field?: IsolatedStoreSqlMigrationIssueFieldContract;
145
+ /** Value from the migration journal (applied history). */
146
+ expected?: string | number | null;
147
+ /** Value from the submitted bundle. */
148
+ actual?: string | number | null;
149
+ journal?: {
150
+ version: number;
151
+ name: string;
152
+ checksum: string;
153
+ } | null;
154
+ bundle?: {
155
+ version: number;
156
+ name: string;
157
+ checksum: string;
158
+ } | null;
159
+ /** SHA-256 of the bundle entry SQL UTF-8 bytes (diagnostic; not raw SQL). */
160
+ bundleSqlContentSha256?: string | null;
161
+ /** Set when `expectedLastApplied*` optimistic locks fail (apply/status preflight). */
162
+ expectedLastAppliedVersion?: number | null;
163
+ actualLastAppliedVersion?: number | null;
164
+ expectedLastAppliedChecksum?: string | null;
165
+ actualLastAppliedChecksum?: string | null;
166
+ }
136
167
  export interface IsolatedStoreSqlMigrationStatusContract {
137
168
  databaseName: string;
138
169
  schemaName: string;
@@ -142,23 +173,56 @@ export interface IsolatedStoreSqlMigrationStatusContract {
142
173
  appliedCount: number;
143
174
  pendingCount: number;
144
175
  isDrifted: boolean;
176
+ /** True when the bundle prefix matches the journal and pending migrations may run. */
177
+ canApply: boolean;
145
178
  issues: string[];
179
+ structuredIssues: IsolatedStoreSqlMigrationIssueContract[];
146
180
  appliedMigrations: IsolatedStoreSqlAppliedMigrationContract[];
147
181
  pendingMigrations: IsolatedStoreSqlMigrationBundleEntryContract[];
148
182
  }
149
183
  export interface GetIsolatedStoreSqlMigrationStatusRequestContract {
150
184
  schemaName?: IsolatedStoreSqlSchemaNameInQueryOptional;
151
185
  bundle: IsolatedStoreSqlMigrationBundleContract;
186
+ /** Same optimistic-lock semantics as `applyIsolatedStoreSqlMigrations`; HTTP 409 when the journal tail disagrees. */
187
+ expectedLastAppliedVersion?: number | null;
188
+ expectedLastAppliedChecksum?: string | null;
152
189
  }
153
190
  export interface ApplyIsolatedStoreSqlMigrationsRequestContract {
154
191
  schemaName?: IsolatedStoreSqlSchemaNameInQueryOptional;
155
192
  bundle: IsolatedStoreSqlMigrationBundleContract;
193
+ /**
194
+ * When true, runs the same journal/bundle prefix checks as apply (including optional
195
+ * expected-head validation) but does not execute SQL or write the journal.
196
+ */
197
+ dryRun?: boolean | null;
198
+ /**
199
+ * Optimistic lock: last applied migration version on the server must match.
200
+ * Omit to skip. Use `null` to require an empty journal (no rows applied).
201
+ */
202
+ expectedLastAppliedVersion?: number | null;
203
+ /**
204
+ * Optimistic lock: checksum of the last applied journal row must match.
205
+ * Omit to skip. Use `null` only together with an empty journal expectation.
206
+ */
207
+ expectedLastAppliedChecksum?: string | null;
156
208
  }
157
209
  export interface ApplyIsolatedStoreSqlMigrationsResponseContract {
158
210
  appliedCount: number;
159
211
  appliedVersions: number[];
160
212
  checkpointRevision?: IsolatedStoreRevisionContract | null;
161
213
  status: IsolatedStoreSqlMigrationStatusContract;
214
+ /** Present and true when the request used `dryRun` and no migrations were executed. */
215
+ dryRun?: boolean | null;
216
+ }
217
+ /** Documented shape of JSON error responses for migration state conflicts (HTTP 409). */
218
+ export interface IsolatedStoreSqlMigrationConflictErrorBodyContract {
219
+ success: false;
220
+ message: string;
221
+ data: {
222
+ code: string;
223
+ errorCode: string;
224
+ issues?: IsolatedStoreSqlMigrationIssueContract[];
225
+ };
162
226
  }
163
227
  export interface IsolatedStoreSqlListTablesResponseContract {
164
228
  tables: IsolatedStoreSqlTableContract[];
@@ -455,6 +519,20 @@ export declare const IsolatedStoreScopeTypeContract: {
455
519
  readonly ParentRow: "parent_row";
456
520
  readonly ParentTable: "parent_table";
457
521
  };
522
+ export declare const IsolatedStoreSqlMigrationIssueCodeContract: {
523
+ readonly IsolatedSqlJournalLongerThanBundle: "isolated_sql_journal_longer_than_bundle";
524
+ readonly IsolatedSqlVersionMismatch: "isolated_sql_version_mismatch";
525
+ readonly IsolatedSqlNameMismatch: "isolated_sql_name_mismatch";
526
+ readonly IsolatedSqlChecksumMismatch: "isolated_sql_checksum_mismatch";
527
+ readonly IsolatedSqlJournalHeadMismatch: "isolated_sql_journal_head_mismatch";
528
+ };
529
+ export declare const IsolatedStoreSqlMigrationIssueFieldContract: {
530
+ readonly HistoryLength: "history_length";
531
+ readonly Version: "version";
532
+ readonly Name: "name";
533
+ readonly Checksum: "checksum";
534
+ readonly JournalHead: "journal_head";
535
+ };
458
536
  export declare const IsolatedStoreSqlFilterOperatorContract: {
459
537
  readonly Eq: "eq";
460
538
  readonly Ne: "ne";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IsolatedStoreNoSqlImportModeContract = exports.IsolatedStoreNoSqlSortDirectionContract = exports.IsolatedStoreNoSqlFilterOperatorContract = exports.IsolatedStoreSqlImportFormatContract = exports.IsolatedStoreSqlSortDirectionContract = exports.IsolatedStoreSqlFilterOperatorContract = exports.IsolatedStoreScopeTypeContract = exports.IsolatedStoreRevisionKindContract = exports.IsolatedStoreStageStatusContract = exports.IsolatedStoreStatusContract = exports.IsolatedStoreEngineContract = exports.IsolatedStoreTypeContract = void 0;
3
+ exports.IsolatedStoreNoSqlImportModeContract = exports.IsolatedStoreNoSqlSortDirectionContract = exports.IsolatedStoreNoSqlFilterOperatorContract = exports.IsolatedStoreSqlImportFormatContract = exports.IsolatedStoreSqlSortDirectionContract = exports.IsolatedStoreSqlFilterOperatorContract = exports.IsolatedStoreSqlMigrationIssueFieldContract = exports.IsolatedStoreSqlMigrationIssueCodeContract = exports.IsolatedStoreScopeTypeContract = exports.IsolatedStoreRevisionKindContract = exports.IsolatedStoreStageStatusContract = exports.IsolatedStoreStatusContract = exports.IsolatedStoreEngineContract = exports.IsolatedStoreTypeContract = void 0;
4
4
  exports.IsolatedStoreTypeContract = {
5
5
  Sql: "sql",
6
6
  Nosql: "nosql"
@@ -34,6 +34,20 @@ exports.IsolatedStoreScopeTypeContract = {
34
34
  ParentRow: "parent_row",
35
35
  ParentTable: "parent_table"
36
36
  };
37
+ exports.IsolatedStoreSqlMigrationIssueCodeContract = {
38
+ IsolatedSqlJournalLongerThanBundle: "isolated_sql_journal_longer_than_bundle",
39
+ IsolatedSqlVersionMismatch: "isolated_sql_version_mismatch",
40
+ IsolatedSqlNameMismatch: "isolated_sql_name_mismatch",
41
+ IsolatedSqlChecksumMismatch: "isolated_sql_checksum_mismatch",
42
+ IsolatedSqlJournalHeadMismatch: "isolated_sql_journal_head_mismatch"
43
+ };
44
+ exports.IsolatedStoreSqlMigrationIssueFieldContract = {
45
+ HistoryLength: "history_length",
46
+ Version: "version",
47
+ Name: "name",
48
+ Checksum: "checksum",
49
+ JournalHead: "journal_head"
50
+ };
37
51
  exports.IsolatedStoreSqlFilterOperatorContract = {
38
52
  Eq: "eq",
39
53
  Ne: "ne",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusebase/fusebase-gate-sdk",
3
- "version": "2.2.2-sdk.26",
3
+ "version": "2.2.2-sdk.28",
4
4
  "description": "TypeScript SDK for Fusebase Gate APIs - Generated from contract introspection",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,9 @@
1
+ # Release Notes 2.2.2-sdk.28
2
+
3
+ - Current ref: `HEAD`
4
+ - Previous tag: `v2.2.2-sdk.28`
5
+ - Generated at: 2026-04-05T05:10:27.150Z
6
+
7
+ ## Included Drafts
8
+
9
+ - None
@@ -1,8 +1,8 @@
1
- # Release Notes 2.2.2-sdk.26
1
+ # Release Notes 2.2.2-sdk.28
2
2
 
3
3
  - Current ref: `HEAD`
4
- - Previous tag: `v2.2.2-sdk.26`
5
- - Generated at: 2026-04-05T04:29:27.130Z
4
+ - Previous tag: `v2.2.2-sdk.28`
5
+ - Generated at: 2026-04-05T05:10:27.150Z
6
6
 
7
7
  ## Included Drafts
8
8
 
@@ -1,9 +0,0 @@
1
- # Release Notes 2.2.2-sdk.26
2
-
3
- - Current ref: `HEAD`
4
- - Previous tag: `v2.2.2-sdk.26`
5
- - Generated at: 2026-04-05T04:29:27.130Z
6
-
7
- ## Included Drafts
8
-
9
- - None