@playcademy/sandbox 0.6.1-beta.5 → 0.6.1-beta.7
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/cli.js +2705 -202
- package/dist/constants.js +1 -1
- package/dist/server.js +2704 -201
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -310,7 +310,7 @@ var init_timeback2 = __esm(() => {
|
|
|
310
310
|
});
|
|
311
311
|
|
|
312
312
|
// ../constants/src/cloudflare.ts
|
|
313
|
-
var WORKER_NAMING, MAX_WORKER_NAME_LENGTH = 63, SECRETS_PREFIX = "secrets_", CLOUDFLARE_COMPATIBILITY_DATE = "2025-10-11";
|
|
313
|
+
var WORKER_NAMING, MAX_WORKER_NAME_LENGTH = 63, SECRETS_PREFIX = "secrets_", CLOUDFLARE_COMPATIBILITY_DATE = "2025-10-11", D1_TIME_TRAVEL_RETENTION_DAYS = 30;
|
|
314
314
|
var init_cloudflare = __esm(() => {
|
|
315
315
|
WORKER_NAMING = {
|
|
316
316
|
STAGING_PREFIX: "staging-",
|
|
@@ -1083,7 +1083,7 @@ var package_default;
|
|
|
1083
1083
|
var init_package = __esm(() => {
|
|
1084
1084
|
package_default = {
|
|
1085
1085
|
name: "@playcademy/sandbox",
|
|
1086
|
-
version: "0.6.1-beta.
|
|
1086
|
+
version: "0.6.1-beta.7",
|
|
1087
1087
|
description: "Local development server for Playcademy game development",
|
|
1088
1088
|
type: "module",
|
|
1089
1089
|
exports: {
|
|
@@ -1152,6 +1152,16 @@ var init_package = __esm(() => {
|
|
|
1152
1152
|
});
|
|
1153
1153
|
|
|
1154
1154
|
// ../api-core/src/errors/domain.error.ts
|
|
1155
|
+
function deployErrorCode(error) {
|
|
1156
|
+
if (!(error instanceof DomainError)) {
|
|
1157
|
+
return null;
|
|
1158
|
+
}
|
|
1159
|
+
const details = error.details;
|
|
1160
|
+
if (typeof details !== "object" || details === null || !("code" in details)) {
|
|
1161
|
+
return null;
|
|
1162
|
+
}
|
|
1163
|
+
return typeof details.code === "string" ? details.code : null;
|
|
1164
|
+
}
|
|
1155
1165
|
var DomainError, BadRequestError, UnauthorizedError, AccessDeniedError, NotFoundError, ConflictError, AlreadyExistsError, ValidationError, RateLimitError, InternalError, ServiceUnavailableError, TimeoutError;
|
|
1156
1166
|
var init_domain_error = __esm(() => {
|
|
1157
1167
|
DomainError = class DomainError extends Error {
|
|
@@ -1234,6 +1244,158 @@ var init_domain_error = __esm(() => {
|
|
|
1234
1244
|
};
|
|
1235
1245
|
});
|
|
1236
1246
|
|
|
1247
|
+
// ../types/src/game.ts
|
|
1248
|
+
var DEPLOY_ERROR_CODES, REFUSAL_CODES, DEPLOY_REFUSAL_CODES, DELETED_ACCOUNT_LABEL = "(deleted account)";
|
|
1249
|
+
var init_game2 = __esm(() => {
|
|
1250
|
+
DEPLOY_ERROR_CODES = {
|
|
1251
|
+
deployIdPayloadMismatch: "deploy-id-payload-mismatch",
|
|
1252
|
+
stateConflict: "deployment-state-conflict",
|
|
1253
|
+
stateDrift: "deployment-state-drift",
|
|
1254
|
+
destructiveSchema: "destructive-schema-changes",
|
|
1255
|
+
upgradeRequired: "deploy-upgrade-required",
|
|
1256
|
+
checksumMismatch: "migration-checksum-mismatch",
|
|
1257
|
+
journalDivergence: "migration-journal-divergence",
|
|
1258
|
+
outOfOrder: "migration-out-of-order",
|
|
1259
|
+
migrationFailed: "migration-failed",
|
|
1260
|
+
strategyMismatch: "strategy-mismatch",
|
|
1261
|
+
pushFailed: "push-failed",
|
|
1262
|
+
pruneUnmanagedSecrets: "secrets-prune-unmanaged",
|
|
1263
|
+
baselineLedgerNotEmpty: "baseline-ledger-not-empty",
|
|
1264
|
+
baselineDatabaseEmpty: "baseline-database-empty",
|
|
1265
|
+
baselineAlreadyAdopted: "baseline-already-adopted",
|
|
1266
|
+
baselineClaimRejected: "baseline-claim-rejected",
|
|
1267
|
+
restoreUnsupported: "restore-unsupported",
|
|
1268
|
+
restoreIncomplete: "restore-incomplete",
|
|
1269
|
+
restoreBlockedByDeploy: "restore-blocked-by-deploy",
|
|
1270
|
+
restoreExpired: "restore-expired"
|
|
1271
|
+
};
|
|
1272
|
+
REFUSAL_CODES = [
|
|
1273
|
+
DEPLOY_ERROR_CODES.deployIdPayloadMismatch,
|
|
1274
|
+
DEPLOY_ERROR_CODES.stateConflict,
|
|
1275
|
+
DEPLOY_ERROR_CODES.stateDrift,
|
|
1276
|
+
DEPLOY_ERROR_CODES.destructiveSchema,
|
|
1277
|
+
DEPLOY_ERROR_CODES.upgradeRequired,
|
|
1278
|
+
DEPLOY_ERROR_CODES.checksumMismatch,
|
|
1279
|
+
DEPLOY_ERROR_CODES.journalDivergence,
|
|
1280
|
+
DEPLOY_ERROR_CODES.outOfOrder,
|
|
1281
|
+
DEPLOY_ERROR_CODES.strategyMismatch,
|
|
1282
|
+
DEPLOY_ERROR_CODES.pruneUnmanagedSecrets,
|
|
1283
|
+
DEPLOY_ERROR_CODES.baselineLedgerNotEmpty,
|
|
1284
|
+
DEPLOY_ERROR_CODES.baselineDatabaseEmpty,
|
|
1285
|
+
DEPLOY_ERROR_CODES.baselineAlreadyAdopted,
|
|
1286
|
+
DEPLOY_ERROR_CODES.baselineClaimRejected
|
|
1287
|
+
];
|
|
1288
|
+
DEPLOY_REFUSAL_CODES = new Set(REFUSAL_CODES);
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
// ../api-core/src/errors/deploy.error.ts
|
|
1292
|
+
var DeployIdConflictError, DeploymentStateConflictError, DeploymentStateDriftError, LegacySchemaUpgradeRequiredError, DestructiveSchemaError, MigrationChecksumMismatchError, MigrationJournalDivergenceError, MigrationOrderError, SecretsPruneUnmanagedError, BaselineLedgerNotEmptyError, BaselineDatabaseEmptyError, BaselineAlreadyAdoptedError, BaselineClaimRejectedError, MigrationExecutionError, PushExecutionError;
|
|
1293
|
+
var init_deploy_error = __esm(() => {
|
|
1294
|
+
init_game2();
|
|
1295
|
+
init_domain_error();
|
|
1296
|
+
DeployIdConflictError = class DeployIdConflictError extends ConflictError {
|
|
1297
|
+
constructor(deployId, existingJobId) {
|
|
1298
|
+
super(`Deploy '${deployId}' was already created with a different payload — ` + "generate a fresh deployId for a new deploy", { code: DEPLOY_ERROR_CODES.deployIdPayloadMismatch, deployId, existingJobId });
|
|
1299
|
+
this.name = "DeployIdConflictError";
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
DeploymentStateConflictError = class DeploymentStateConflictError extends ConflictError {
|
|
1303
|
+
constructor(payload) {
|
|
1304
|
+
super("Deployment state conflict: the schema baseline changed since this deploy was " + "prepared — refetch the deployment state, re-diff, and retry", { code: DEPLOY_ERROR_CODES.stateConflict, ...payload });
|
|
1305
|
+
this.name = "DeploymentStateConflictError";
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
DeploymentStateDriftError = class DeploymentStateDriftError extends ConflictError {
|
|
1309
|
+
constructor(payload) {
|
|
1310
|
+
super("Deployment state drift: the live database schema does not match the recorded " + "fingerprint (out-of-band change or partial prior apply) — repair the " + "database state before deploying", { code: DEPLOY_ERROR_CODES.stateDrift, ...payload });
|
|
1311
|
+
this.name = "DeploymentStateDriftError";
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
LegacySchemaUpgradeRequiredError = class LegacySchemaUpgradeRequiredError extends ValidationError {
|
|
1315
|
+
constructor() {
|
|
1316
|
+
super("This game's database state is server-managed; the legacy schema payload is no " + "longer accepted — update the Playcademy CLI and redeploy", { code: DEPLOY_ERROR_CODES.upgradeRequired });
|
|
1317
|
+
this.name = "LegacySchemaUpgradeRequiredError";
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
DestructiveSchemaError = class DestructiveSchemaError extends ValidationError {
|
|
1321
|
+
constructor(statements) {
|
|
1322
|
+
super(`Push contains ${statements.length} destructive statement(s) that can drop data — ` + "review them and re-run with --accept-data-loss to proceed", { code: DEPLOY_ERROR_CODES.destructiveSchema, statements });
|
|
1323
|
+
this.name = "DestructiveSchemaError";
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
MigrationChecksumMismatchError = class MigrationChecksumMismatchError extends ConflictError {
|
|
1327
|
+
constructor(mismatches) {
|
|
1328
|
+
const tags = mismatches.map((mismatch) => mismatch.tag).join(", ");
|
|
1329
|
+
super(`Applied migration(s) ${tags} no longer match their recorded checksums.`, {
|
|
1330
|
+
code: DEPLOY_ERROR_CODES.checksumMismatch,
|
|
1331
|
+
mismatches
|
|
1332
|
+
});
|
|
1333
|
+
this.name = "MigrationChecksumMismatchError";
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
MigrationJournalDivergenceError = class MigrationJournalDivergenceError extends ConflictError {
|
|
1337
|
+
constructor(tags) {
|
|
1338
|
+
super(`The database ledger records applied migration(s) missing from the deploy's ` + `journal: ${tags.join(", ")}. Restore the missing migration files (or resolve ` + "the ledger) before deploying", { code: DEPLOY_ERROR_CODES.journalDivergence, tags });
|
|
1339
|
+
this.name = "MigrationJournalDivergenceError";
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
MigrationOrderError = class MigrationOrderError extends ValidationError {
|
|
1343
|
+
constructor(tags) {
|
|
1344
|
+
super(`Out-of-order migration(s): ${tags.join(", ")} are ordered before migrations that ` + "already applied. This usually means a branch merged with older-numbered " + "migrations — regenerate them after the applied ones and redeploy", { code: DEPLOY_ERROR_CODES.outOfOrder, tags });
|
|
1345
|
+
this.name = "MigrationOrderError";
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
SecretsPruneUnmanagedError = class SecretsPruneUnmanagedError extends ValidationError {
|
|
1349
|
+
constructor(keys) {
|
|
1350
|
+
super(`Cannot prune secret(s) not managed by the platform: ${keys.join(", ")}. ` + "Only keys the platform previously pushed can be pruned", { code: DEPLOY_ERROR_CODES.pruneUnmanagedSecrets, keys });
|
|
1351
|
+
this.name = "SecretsPruneUnmanagedError";
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
BaselineLedgerNotEmptyError = class BaselineLedgerNotEmptyError extends ConflictError {
|
|
1355
|
+
constructor(tags) {
|
|
1356
|
+
super(`Cannot baseline: the migration ledger already records ${tags.length} applied ` + "migration(s) — this database is already server-managed. Just deploy", { code: DEPLOY_ERROR_CODES.baselineLedgerNotEmpty, tags });
|
|
1357
|
+
this.name = "BaselineLedgerNotEmptyError";
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
BaselineDatabaseEmptyError = class BaselineDatabaseEmptyError extends ValidationError {
|
|
1361
|
+
constructor() {
|
|
1362
|
+
super("Cannot baseline an empty database — there is no applied history to claim. " + "An empty database needs no baseline: deploy directly and the full " + "journal (or schema) applies fresh.", { code: DEPLOY_ERROR_CODES.baselineDatabaseEmpty });
|
|
1363
|
+
this.name = "BaselineDatabaseEmptyError";
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
BaselineAlreadyAdoptedError = class BaselineAlreadyAdoptedError extends ConflictError {
|
|
1367
|
+
constructor(baselineSource) {
|
|
1368
|
+
super("Cannot baseline: deployment state already records a schema baseline" + `${baselineSource ? ` (source: ${baselineSource})` : ""} — ` + "use realign/resolve to repair drift instead", { code: DEPLOY_ERROR_CODES.baselineAlreadyAdopted, baselineSource });
|
|
1369
|
+
this.name = "BaselineAlreadyAdoptedError";
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
BaselineClaimRejectedError = class BaselineClaimRejectedError extends ConflictError {
|
|
1373
|
+
constructor(details) {
|
|
1374
|
+
const [first] = details.contradictions;
|
|
1375
|
+
super(first ? `Cannot baseline: the claim contradicts the live database — ${first.tag} ${first.detail ?? ""}` : "Cannot baseline: the claim includes migrations that cannot be verified against the live database — " + "pass --allow-unverified to record them anyway", { code: DEPLOY_ERROR_CODES.baselineClaimRejected, ...details });
|
|
1376
|
+
this.name = "BaselineClaimRejectedError";
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
MigrationExecutionError = class MigrationExecutionError extends ValidationError {
|
|
1380
|
+
tag;
|
|
1381
|
+
offset;
|
|
1382
|
+
constructor(input) {
|
|
1383
|
+
super(`Migration '${input.tag}' failed and rolled back: ${input.d1Message}. ` + "Fix the migration SQL and redeploy — the deploy resumes from this migration", { code: DEPLOY_ERROR_CODES.migrationFailed, ...input });
|
|
1384
|
+
this.name = "MigrationExecutionError";
|
|
1385
|
+
this.tag = input.tag;
|
|
1386
|
+
this.offset = input.offset;
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
PushExecutionError = class PushExecutionError extends ValidationError {
|
|
1390
|
+
offset;
|
|
1391
|
+
constructor(input) {
|
|
1392
|
+
super(`Push schema changes failed and rolled back: ${input.d1Message}. ` + "Fix the schema and redeploy — nothing was applied", { code: DEPLOY_ERROR_CODES.pushFailed, ...input });
|
|
1393
|
+
this.name = "PushExecutionError";
|
|
1394
|
+
this.offset = input.offset;
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1237
1399
|
// ../api-core/src/errors/api.error.ts
|
|
1238
1400
|
var STATUS_MAP, ApiError;
|
|
1239
1401
|
var init_api_error = __esm(() => {
|
|
@@ -1333,6 +1495,7 @@ var init_api_error = __esm(() => {
|
|
|
1333
1495
|
// ../api-core/src/errors/index.ts
|
|
1334
1496
|
var init_errors = __esm(() => {
|
|
1335
1497
|
init_domain_error();
|
|
1498
|
+
init_deploy_error();
|
|
1336
1499
|
init_api_error();
|
|
1337
1500
|
});
|
|
1338
1501
|
|
|
@@ -5687,7 +5850,16 @@ var init_schema = __esm(() => {
|
|
|
5687
5850
|
ltiTestMode: exports_external.boolean().default(false),
|
|
5688
5851
|
platformServiceJwt: platformServiceJwtConfigSchema.optional(),
|
|
5689
5852
|
uploadBucket: exports_external.string().optional(),
|
|
5690
|
-
queueIngressSecret: exports_external.string().optional()
|
|
5853
|
+
queueIngressSecret: exports_external.string().optional(),
|
|
5854
|
+
secretsManifestPepper: exports_external.string().optional()
|
|
5855
|
+
}).superRefine((config2, ctx) => {
|
|
5856
|
+
if (config2.isLocal && !config2.baseUrl) {
|
|
5857
|
+
ctx.addIssue({
|
|
5858
|
+
code: exports_external.ZodIssueCode.custom,
|
|
5859
|
+
path: ["baseUrl"],
|
|
5860
|
+
message: "baseUrl is required when isLocal is true"
|
|
5861
|
+
});
|
|
5862
|
+
}
|
|
5691
5863
|
});
|
|
5692
5864
|
});
|
|
5693
5865
|
|
|
@@ -11208,7 +11380,7 @@ var init_table4 = __esm(() => {
|
|
|
11208
11380
|
});
|
|
11209
11381
|
|
|
11210
11382
|
// ../data/src/domains/game/table.ts
|
|
11211
|
-
var gamePlatformEnum, gameTypeEnum, gameVisibilityEnum, games, gameMemberRoleEnum, gameMembers, gameMembersRelations, gameDashboardUserRoleEnum, gameDashboardUsers, gameDashboardUsersRelations, deploymentProviderEnum, deploymentTargetEnum, deployJobStatusEnum, gameDeployments, gameDeployJobs, customHostnameStatusEnum, customHostnameSslStatusEnum, customHostnameEnvironmentEnum, gameCustomHostnames;
|
|
11383
|
+
var gamePlatformEnum, gameTypeEnum, gameVisibilityEnum, games, gameMemberRoleEnum, gameMembers, gameMembersRelations, gameDashboardUserRoleEnum, gameDashboardUsers, gameDashboardUsersRelations, deploymentProviderEnum, deploymentTargetEnum, deployJobStatusEnum, gameDeployments, gameDeployJobs, gameDeployEvents, gameDeploymentState, customHostnameStatusEnum, customHostnameSslStatusEnum, customHostnameEnvironmentEnum, gameCustomHostnames;
|
|
11212
11384
|
var init_table5 = __esm(() => {
|
|
11213
11385
|
init_drizzle_orm();
|
|
11214
11386
|
init_pg_core();
|
|
@@ -11297,15 +11469,20 @@ var init_table5 = __esm(() => {
|
|
|
11297
11469
|
target: deploymentTargetEnum("target").notNull().default("game"),
|
|
11298
11470
|
url: text("url").notNull(),
|
|
11299
11471
|
codeHash: text("code_hash"),
|
|
11472
|
+
schemaHash: text("schema_hash"),
|
|
11473
|
+
schemaFingerprint: text("schema_fingerprint"),
|
|
11474
|
+
timeTravelBookmark: text("time_travel_bookmark"),
|
|
11475
|
+
bookmarkCapturedAt: timestamp("bookmark_captured_at", { withTimezone: true }),
|
|
11300
11476
|
isActive: boolean("is_active").notNull().default(false),
|
|
11301
11477
|
resources: jsonb("resources").$type(),
|
|
11302
11478
|
deployedAt: timestamp("deployed_at", { withTimezone: true }).notNull().defaultNow()
|
|
11303
|
-
});
|
|
11479
|
+
}, (table3) => [index("game_deployments_game_target_idx").on(table3.gameId, table3.target)]);
|
|
11304
11480
|
gameDeployJobs = pgTable("game_deploy_jobs", {
|
|
11305
11481
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
11306
11482
|
gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
|
|
11307
|
-
userId: text("user_id").
|
|
11483
|
+
userId: text("user_id").references(() => users.id, { onDelete: "set null" }),
|
|
11308
11484
|
status: deployJobStatusEnum("status").notNull().default("pending"),
|
|
11485
|
+
deployId: text("deploy_id"),
|
|
11309
11486
|
request: jsonb("request").$type().notNull(),
|
|
11310
11487
|
events: jsonb("events").$type().notNull().default([]),
|
|
11311
11488
|
error: text("error"),
|
|
@@ -11319,6 +11496,27 @@ var init_table5 = __esm(() => {
|
|
|
11319
11496
|
createdAt: timestamp("created_at", { mode: "date", withTimezone: true }).notNull().defaultNow(),
|
|
11320
11497
|
startedAt: timestamp("started_at", { mode: "date", withTimezone: true }),
|
|
11321
11498
|
completedAt: timestamp("completed_at", { mode: "date", withTimezone: true })
|
|
11499
|
+
}, (table3) => [uniqueIndex("game_deploy_jobs_game_deploy_id_idx").on(table3.gameId, table3.deployId)]);
|
|
11500
|
+
gameDeployEvents = pgTable("game_deploy_events", {
|
|
11501
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
11502
|
+
gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
|
|
11503
|
+
userId: text("user_id").references(() => users.id, { onDelete: "set null" }),
|
|
11504
|
+
kind: text("kind").$type().notNull(),
|
|
11505
|
+
payload: jsonb("payload").$type().notNull(),
|
|
11506
|
+
createdAt: timestamp("created_at", { mode: "date", withTimezone: true }).notNull().defaultNow()
|
|
11507
|
+
}, (table3) => [index("game_deploy_events_game_idx").on(table3.gameId, table3.createdAt)]);
|
|
11508
|
+
gameDeploymentState = pgTable("game_deployment_state", {
|
|
11509
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
11510
|
+
gameId: uuid("game_id").notNull().unique().references(() => games.id, { onDelete: "cascade" }),
|
|
11511
|
+
schemaHash: text("schema_hash"),
|
|
11512
|
+
schemaSnapshot: jsonb("schema_snapshot"),
|
|
11513
|
+
schemaFingerprint: text("schema_fingerprint"),
|
|
11514
|
+
secretsManifest: jsonb("secrets_manifest").$type(),
|
|
11515
|
+
integrationsHash: text("integrations_hash"),
|
|
11516
|
+
buildHash: text("build_hash"),
|
|
11517
|
+
compatibilityDate: text("compatibility_date"),
|
|
11518
|
+
baselineSource: text("baseline_source").$type(),
|
|
11519
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
11322
11520
|
});
|
|
11323
11521
|
customHostnameStatusEnum = pgEnum("custom_hostname_status", [
|
|
11324
11522
|
"pending",
|
|
@@ -11481,7 +11679,9 @@ __export(exports_tables_index, {
|
|
|
11481
11679
|
gameMembers: () => gameMembers,
|
|
11482
11680
|
gameMemberRoleEnum: () => gameMemberRoleEnum,
|
|
11483
11681
|
gameDeployments: () => gameDeployments,
|
|
11682
|
+
gameDeploymentState: () => gameDeploymentState,
|
|
11484
11683
|
gameDeployJobs: () => gameDeployJobs,
|
|
11684
|
+
gameDeployEvents: () => gameDeployEvents,
|
|
11485
11685
|
gameDashboardUsersRelations: () => gameDashboardUsersRelations,
|
|
11486
11686
|
gameDashboardUsers: () => gameDashboardUsers,
|
|
11487
11687
|
gameDashboardUserRoleEnum: () => gameDashboardUserRoleEnum,
|
|
@@ -22496,7 +22696,112 @@ var init_zip = __esm(() => {
|
|
|
22496
22696
|
import_jszip = __toESM(require_lib3(), 1);
|
|
22497
22697
|
});
|
|
22498
22698
|
|
|
22699
|
+
// ../utils/src/stages.ts
|
|
22700
|
+
function isPreviewStage(stage) {
|
|
22701
|
+
return PREVIEW_STAGE_PATTERN.test(stage);
|
|
22702
|
+
}
|
|
22703
|
+
var PREVIEW_STAGE_PATTERN;
|
|
22704
|
+
var init_stages = __esm(() => {
|
|
22705
|
+
PREVIEW_STAGE_PATTERN = /^pr-\d+$/;
|
|
22706
|
+
});
|
|
22707
|
+
|
|
22708
|
+
// ../api-core/src/utils/deployment.util.ts
|
|
22709
|
+
function deployJobInstant() {
|
|
22710
|
+
return sql`COALESCE(${gameDeployJobs.completedAt}, ${gameDeployJobs.createdAt})`;
|
|
22711
|
+
}
|
|
22712
|
+
async function findLastSuccessfulDeploy(db2, gameId) {
|
|
22713
|
+
const job = await db2.query.gameDeployJobs.findFirst({
|
|
22714
|
+
where: and(eq(gameDeployJobs.gameId, gameId), eq(gameDeployJobs.status, "succeeded")),
|
|
22715
|
+
orderBy: desc(deployJobInstant()),
|
|
22716
|
+
columns: { userId: true, createdAt: true, completedAt: true }
|
|
22717
|
+
});
|
|
22718
|
+
if (!job) {
|
|
22719
|
+
return null;
|
|
22720
|
+
}
|
|
22721
|
+
return { userId: job.userId, at: job.completedAt ?? job.createdAt };
|
|
22722
|
+
}
|
|
22723
|
+
async function findLastSuccessfulDeployWithEmail(db2, gameId) {
|
|
22724
|
+
const lastDeploy = await findLastSuccessfulDeploy(db2, gameId);
|
|
22725
|
+
if (!lastDeploy) {
|
|
22726
|
+
return null;
|
|
22727
|
+
}
|
|
22728
|
+
const deployer = lastDeploy.userId ? await db2.query.users.findFirst({
|
|
22729
|
+
where: eq(users.id, lastDeploy.userId),
|
|
22730
|
+
columns: { email: true }
|
|
22731
|
+
}) : null;
|
|
22732
|
+
return { ...lastDeploy, email: deployer?.email ?? null };
|
|
22733
|
+
}
|
|
22734
|
+
function getGameDeploymentId(gameSlug, sstStage) {
|
|
22735
|
+
if (sstStage === "production") {
|
|
22736
|
+
return gameSlug;
|
|
22737
|
+
}
|
|
22738
|
+
if (sstStage === "dev" || isPreviewStage(sstStage)) {
|
|
22739
|
+
return `${WORKER_NAMING.STAGING_PREFIX}${gameSlug}`;
|
|
22740
|
+
}
|
|
22741
|
+
return `${WORKER_NAMING.LOCAL_PREFIX}${sstStage}-${gameSlug}`;
|
|
22742
|
+
}
|
|
22743
|
+
function getDashboardDeploymentId(gameSlug, sstStage) {
|
|
22744
|
+
return `${getGameDeploymentId(gameSlug, sstStage)}${DASHBOARD_WORKER_SUFFIX}`;
|
|
22745
|
+
}
|
|
22746
|
+
function getGameWorkerApiKeyName(slug) {
|
|
22747
|
+
return `${GAME_WORKER_KEY_PREFIX}${slug}`.substring(0, 32);
|
|
22748
|
+
}
|
|
22749
|
+
function getDashboardWorkerApiKeyName(slug) {
|
|
22750
|
+
return `${DASHBOARD_WORKER_KEY_PREFIX}${slug}`;
|
|
22751
|
+
}
|
|
22752
|
+
function toBindingName(queueKey) {
|
|
22753
|
+
return `${queueKey.replace(/-/g, "_").toUpperCase()}_QUEUE`;
|
|
22754
|
+
}
|
|
22755
|
+
function isSchemaAdopted(state) {
|
|
22756
|
+
if (!state) {
|
|
22757
|
+
return false;
|
|
22758
|
+
}
|
|
22759
|
+
return state.schemaHash !== null || state.schemaFingerprint !== null || state.schemaSnapshot !== null;
|
|
22760
|
+
}
|
|
22761
|
+
function isPushAdopted(state) {
|
|
22762
|
+
return Boolean(state?.schemaHash);
|
|
22763
|
+
}
|
|
22764
|
+
function isMigrateManaged(state) {
|
|
22765
|
+
return Boolean(state?.schemaFingerprint) && !state?.schemaHash;
|
|
22766
|
+
}
|
|
22767
|
+
function generateDeploymentHash(code) {
|
|
22768
|
+
return sha256Hex(code);
|
|
22769
|
+
}
|
|
22770
|
+
function computeDeployPayloadFingerprint(payload) {
|
|
22771
|
+
return sha256Hex(canonicalJson(payload));
|
|
22772
|
+
}
|
|
22773
|
+
function canonicalJson(value) {
|
|
22774
|
+
if (value === null || typeof value !== "object") {
|
|
22775
|
+
return JSON.stringify(value) ?? "null";
|
|
22776
|
+
}
|
|
22777
|
+
if (Array.isArray(value)) {
|
|
22778
|
+
return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
|
|
22779
|
+
}
|
|
22780
|
+
const entries = Object.entries(value).filter(([, entryValue]) => entryValue !== undefined).toSorted(([a], [b]) => compareKeys(a, b)).map(([key, entryValue]) => `${JSON.stringify(key)}:${canonicalJson(entryValue)}`);
|
|
22781
|
+
return `{${entries.join(",")}}`;
|
|
22782
|
+
}
|
|
22783
|
+
function compareKeys(a, b) {
|
|
22784
|
+
if (a < b) {
|
|
22785
|
+
return -1;
|
|
22786
|
+
}
|
|
22787
|
+
if (a > b) {
|
|
22788
|
+
return 1;
|
|
22789
|
+
}
|
|
22790
|
+
return 0;
|
|
22791
|
+
}
|
|
22792
|
+
var GAME_WORKER_KEY_PREFIX = "game-worker-", DASHBOARD_WORKER_KEY_PREFIX = "dash-worker-";
|
|
22793
|
+
var init_deployment_util = __esm(() => {
|
|
22794
|
+
init_drizzle_orm();
|
|
22795
|
+
init_src();
|
|
22796
|
+
init_tables_index();
|
|
22797
|
+
init_stages();
|
|
22798
|
+
});
|
|
22799
|
+
|
|
22499
22800
|
// ../api-core/src/services/deploy-job.service.ts
|
|
22801
|
+
function isEventDetails(value) {
|
|
22802
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22803
|
+
}
|
|
22804
|
+
|
|
22500
22805
|
class DeployJobService {
|
|
22501
22806
|
deps;
|
|
22502
22807
|
constructor(deps) {
|
|
@@ -22509,6 +22814,9 @@ class DeployJobService {
|
|
|
22509
22814
|
if (leaseLost) {
|
|
22510
22815
|
return "lease_lost";
|
|
22511
22816
|
}
|
|
22817
|
+
if (DEPLOY_REFUSAL_CODES.has(deployErrorCode(error) ?? "")) {
|
|
22818
|
+
return "refused";
|
|
22819
|
+
}
|
|
22512
22820
|
if (error instanceof DomainError) {
|
|
22513
22821
|
return "domain_error";
|
|
22514
22822
|
}
|
|
@@ -22588,13 +22896,28 @@ class DeployJobService {
|
|
|
22588
22896
|
const bucketName = this.getUploadBucket();
|
|
22589
22897
|
this.deps.storage.deleteObject(bucketName, codeUploadToken).catch(catchAttrs("deploy_job.temp_cleanup"));
|
|
22590
22898
|
}
|
|
22591
|
-
sanitizeRequestForPersistence(request) {
|
|
22592
|
-
const sanitized = {
|
|
22899
|
+
async sanitizeRequestForPersistence(request) {
|
|
22900
|
+
const sanitized = {
|
|
22901
|
+
...request
|
|
22902
|
+
};
|
|
22593
22903
|
delete sanitized._headers;
|
|
22594
22904
|
delete sanitized.code;
|
|
22595
22905
|
delete sanitized.codeUploadToken;
|
|
22906
|
+
const codeFingerprint = await this.computeCodeFingerprint(request);
|
|
22907
|
+
if (codeFingerprint) {
|
|
22908
|
+
sanitized.codeFingerprint = codeFingerprint;
|
|
22909
|
+
}
|
|
22596
22910
|
return sanitized;
|
|
22597
22911
|
}
|
|
22912
|
+
async computeCodeFingerprint(request) {
|
|
22913
|
+
if (request.codeUploadToken) {
|
|
22914
|
+
return `upload:${request.codeUploadToken}`;
|
|
22915
|
+
}
|
|
22916
|
+
if (request.code) {
|
|
22917
|
+
return `sha256:${await generateDeploymentHash(request.code)}`;
|
|
22918
|
+
}
|
|
22919
|
+
return;
|
|
22920
|
+
}
|
|
22598
22921
|
getLeaseExpiry() {
|
|
22599
22922
|
return new Date(Date.now() + DEPLOY_JOB_LEASE_MS);
|
|
22600
22923
|
}
|
|
@@ -22627,8 +22950,36 @@ class DeployJobService {
|
|
|
22627
22950
|
heartbeatAt: null
|
|
22628
22951
|
}).where(and(eq(gameDeployJobs.id, jobId), eq(gameDeployJobs.leaseId, leaseId)));
|
|
22629
22952
|
}
|
|
22953
|
+
async findByDeployId(gameId, deployId) {
|
|
22954
|
+
const job = await this.deps.db.query.gameDeployJobs.findFirst({
|
|
22955
|
+
where: and(eq(gameDeployJobs.gameId, gameId), eq(gameDeployJobs.deployId, deployId))
|
|
22956
|
+
});
|
|
22957
|
+
return job ?? null;
|
|
22958
|
+
}
|
|
22959
|
+
async resolveIdempotentReplay(existing, request) {
|
|
22960
|
+
const [incoming, stored] = await Promise.all([
|
|
22961
|
+
this.sanitizeRequestForPersistence(request).then(computeDeployPayloadFingerprint),
|
|
22962
|
+
computeDeployPayloadFingerprint(existing.request)
|
|
22963
|
+
]);
|
|
22964
|
+
if (incoming !== stored) {
|
|
22965
|
+
setAttribute("app.deploy_job.idempotency", "payload_mismatch");
|
|
22966
|
+
throw new DeployIdConflictError(request.deployId, existing.id);
|
|
22967
|
+
}
|
|
22968
|
+
setAttributes({
|
|
22969
|
+
"app.deploy_job.idempotency": "replayed",
|
|
22970
|
+
"app.deploy_job.id": existing.id,
|
|
22971
|
+
"app.deploy_job.status": existing.status
|
|
22972
|
+
});
|
|
22973
|
+
return this.toResponse(existing);
|
|
22974
|
+
}
|
|
22630
22975
|
async create(slug, request, user) {
|
|
22631
22976
|
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
22977
|
+
if (request.deployId) {
|
|
22978
|
+
const existing = await this.findByDeployId(game2.id, request.deployId);
|
|
22979
|
+
if (existing) {
|
|
22980
|
+
return this.resolveIdempotentReplay(existing, request);
|
|
22981
|
+
}
|
|
22982
|
+
}
|
|
22632
22983
|
const jobId = crypto.randomUUID();
|
|
22633
22984
|
let codeSource = "none";
|
|
22634
22985
|
if (request.code) {
|
|
@@ -22644,7 +22995,7 @@ class DeployJobService {
|
|
|
22644
22995
|
request.code = await this.loadUploadedCode(request.codeUploadToken, game2.id);
|
|
22645
22996
|
}
|
|
22646
22997
|
setAttribute("app.deploy_job.code_bundle_size", request.code?.length ?? 0);
|
|
22647
|
-
const sanitizedRequest = this.sanitizeRequestForPersistence(request);
|
|
22998
|
+
const sanitizedRequest = await this.sanitizeRequestForPersistence(request);
|
|
22648
22999
|
if (request.code) {
|
|
22649
23000
|
await this.storeCodeBundle(jobId, request.code);
|
|
22650
23001
|
}
|
|
@@ -22654,6 +23005,7 @@ class DeployJobService {
|
|
|
22654
23005
|
id: jobId,
|
|
22655
23006
|
gameId: game2.id,
|
|
22656
23007
|
userId: user.id,
|
|
23008
|
+
deployId: request.deployId ?? null,
|
|
22657
23009
|
request: sanitizedRequest,
|
|
22658
23010
|
events: [
|
|
22659
23011
|
{
|
|
@@ -22665,6 +23017,12 @@ class DeployJobService {
|
|
|
22665
23017
|
}).returning();
|
|
22666
23018
|
} catch (error) {
|
|
22667
23019
|
await this.deleteCodeBundle(jobId);
|
|
23020
|
+
if (request.deployId) {
|
|
23021
|
+
const winner = await this.findByDeployId(game2.id, request.deployId);
|
|
23022
|
+
if (winner) {
|
|
23023
|
+
return this.resolveIdempotentReplay(winner, request);
|
|
23024
|
+
}
|
|
23025
|
+
}
|
|
22668
23026
|
throw error;
|
|
22669
23027
|
}
|
|
22670
23028
|
if (!job) {
|
|
@@ -22779,7 +23137,11 @@ class DeployJobService {
|
|
|
22779
23137
|
"app.deploy_job.error_status": errorClassification?.errorStatus
|
|
22780
23138
|
});
|
|
22781
23139
|
if (!effectiveLeaseLost) {
|
|
22782
|
-
|
|
23140
|
+
const structuredDetails = error instanceof DomainError && isEventDetails(error.details) ? error.details : undefined;
|
|
23141
|
+
await this.addStatusEvent(jobId, "Deployment failed", {
|
|
23142
|
+
error: message,
|
|
23143
|
+
...structuredDetails
|
|
23144
|
+
});
|
|
22783
23145
|
const failed = await this.markFailed(jobId, leaseId, message, errorClassification);
|
|
22784
23146
|
if (!failed) {
|
|
22785
23147
|
await this.clearLease(jobId, leaseId);
|
|
@@ -22792,18 +23154,21 @@ class DeployJobService {
|
|
|
22792
23154
|
displayName: game2.displayName,
|
|
22793
23155
|
error: message,
|
|
22794
23156
|
target,
|
|
22795
|
-
developer: { id: user.id, email: user.email }
|
|
23157
|
+
developer: { id: user.id, email: user.email },
|
|
23158
|
+
errorCode: deployErrorCode(error)
|
|
22796
23159
|
});
|
|
22797
23160
|
}
|
|
22798
23161
|
await this.deleteCodeBundle(jobId);
|
|
22799
23162
|
}
|
|
22800
23163
|
async loadJobActors(job, jobId, leaseId, onMissing) {
|
|
22801
|
-
const game2 = await
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
23164
|
+
const [game2, user] = await Promise.all([
|
|
23165
|
+
this.deps.db.query.games.findFirst({
|
|
23166
|
+
where: eq(games.id, job.gameId)
|
|
23167
|
+
}),
|
|
23168
|
+
job.userId ? this.deps.db.query.users.findFirst({
|
|
23169
|
+
where: eq(users.id, job.userId)
|
|
23170
|
+
}) : undefined
|
|
23171
|
+
]);
|
|
22807
23172
|
if (!game2 || !user) {
|
|
22808
23173
|
const message = !game2 ? "Deploy job game no longer exists" : "Deploy job user no longer exists";
|
|
22809
23174
|
onMissing();
|
|
@@ -22889,7 +23254,8 @@ class DeployJobService {
|
|
|
22889
23254
|
for await (const step of this.deps.runDeploy(game2.slug, request, user, uploadDeps, extractZipToDirectory)) {
|
|
22890
23255
|
assertLease();
|
|
22891
23256
|
if (step.type === "status" && "message" in step.data && typeof step.data.message === "string") {
|
|
22892
|
-
|
|
23257
|
+
const details = "details" in step.data && isEventDetails(step.data.details) ? step.data.details : undefined;
|
|
23258
|
+
await this.addStatusEvent(jobId, step.data.message, details);
|
|
22893
23259
|
}
|
|
22894
23260
|
}
|
|
22895
23261
|
assertLease();
|
|
@@ -22947,8 +23313,10 @@ var init_deploy_job_service = __esm(() => {
|
|
|
22947
23313
|
init_helpers_index();
|
|
22948
23314
|
init_tables_index();
|
|
22949
23315
|
init_spans();
|
|
23316
|
+
init_game2();
|
|
22950
23317
|
init_zip();
|
|
22951
23318
|
init_errors();
|
|
23319
|
+
init_deployment_util();
|
|
22952
23320
|
STATUS_MAP2 = {
|
|
22953
23321
|
BAD_REQUEST: 400,
|
|
22954
23322
|
UNAUTHORIZED: 401,
|
|
@@ -22970,8 +23338,153 @@ var init_deploy_job_service = __esm(() => {
|
|
|
22970
23338
|
DEPLOY_JOB_LEASE_MS = 2 * 60 * 1000;
|
|
22971
23339
|
DEPLOY_JOB_HEARTBEAT_MS = 30 * 1000;
|
|
22972
23340
|
});
|
|
23341
|
+
// ../cloudflare/src/utils/schema.ts
|
|
23342
|
+
function normalizeSqlForChecksum(sql4) {
|
|
23343
|
+
const unified = sql4.replace(/\r\n/g, `
|
|
23344
|
+
`).replace(/\r/g, `
|
|
23345
|
+
`);
|
|
23346
|
+
const stripped = stripSqlComments(unified);
|
|
23347
|
+
return stripped.split(`
|
|
23348
|
+
`).map((line3) => line3.replace(/\s+$/, "")).filter((line3) => line3 !== "").join(`
|
|
23349
|
+
`);
|
|
23350
|
+
}
|
|
23351
|
+
function stripSqlComments(sql4) {
|
|
23352
|
+
let output = "";
|
|
23353
|
+
let i2 = 0;
|
|
23354
|
+
while (i2 < sql4.length) {
|
|
23355
|
+
const char3 = sql4[i2];
|
|
23356
|
+
const next = sql4[i2 + 1];
|
|
23357
|
+
if (char3 === "-" && next === "-") {
|
|
23358
|
+
i2 = skipLineComment(sql4, i2);
|
|
23359
|
+
} else if (char3 === "/" && next === "*") {
|
|
23360
|
+
output += " ";
|
|
23361
|
+
i2 = skipBlockComment(sql4, i2);
|
|
23362
|
+
} else if (char3 === "'" || char3 === '"' || char3 === "`") {
|
|
23363
|
+
const quoted = copyQuoted(sql4, i2, char3);
|
|
23364
|
+
output += quoted.text;
|
|
23365
|
+
i2 = quoted.end;
|
|
23366
|
+
} else if (char3 === "[") {
|
|
23367
|
+
const bracketed = copyBracketed(sql4, i2);
|
|
23368
|
+
output += bracketed.text;
|
|
23369
|
+
i2 = bracketed.end;
|
|
23370
|
+
} else {
|
|
23371
|
+
output += char3;
|
|
23372
|
+
i2++;
|
|
23373
|
+
}
|
|
23374
|
+
}
|
|
23375
|
+
return output;
|
|
23376
|
+
}
|
|
23377
|
+
function skipLineComment(sql4, start2) {
|
|
23378
|
+
let i2 = start2 + 2;
|
|
23379
|
+
while (i2 < sql4.length && sql4[i2] !== `
|
|
23380
|
+
`) {
|
|
23381
|
+
i2++;
|
|
23382
|
+
}
|
|
23383
|
+
return i2;
|
|
23384
|
+
}
|
|
23385
|
+
function skipBlockComment(sql4, start2) {
|
|
23386
|
+
let i2 = start2 + 2;
|
|
23387
|
+
while (i2 < sql4.length && !(sql4[i2] === "*" && sql4[i2 + 1] === "/")) {
|
|
23388
|
+
i2++;
|
|
23389
|
+
}
|
|
23390
|
+
return i2 + 2;
|
|
23391
|
+
}
|
|
23392
|
+
function copyQuoted(sql4, start2, quote) {
|
|
23393
|
+
let text3 = quote;
|
|
23394
|
+
let i2 = start2 + 1;
|
|
23395
|
+
while (i2 < sql4.length) {
|
|
23396
|
+
text3 += sql4[i2];
|
|
23397
|
+
if (sql4[i2] !== quote) {
|
|
23398
|
+
i2++;
|
|
23399
|
+
} else if (sql4[i2 + 1] === quote) {
|
|
23400
|
+
text3 += quote;
|
|
23401
|
+
i2 += 2;
|
|
23402
|
+
} else {
|
|
23403
|
+
i2++;
|
|
23404
|
+
break;
|
|
23405
|
+
}
|
|
23406
|
+
}
|
|
23407
|
+
return { text: text3, end: i2 };
|
|
23408
|
+
}
|
|
23409
|
+
function copyBracketed(sql4, start2) {
|
|
23410
|
+
let text3 = "[";
|
|
23411
|
+
let i2 = start2 + 1;
|
|
23412
|
+
while (i2 < sql4.length) {
|
|
23413
|
+
text3 += sql4[i2];
|
|
23414
|
+
i2++;
|
|
23415
|
+
if (sql4[i2 - 1] === "]") {
|
|
23416
|
+
break;
|
|
23417
|
+
}
|
|
23418
|
+
}
|
|
23419
|
+
return { text: text3, end: i2 };
|
|
23420
|
+
}
|
|
23421
|
+
function findOversizedStatement(statements) {
|
|
23422
|
+
for (const [index2, statement] of statements.entries()) {
|
|
23423
|
+
const byteLength = Buffer.byteLength(statement, "utf8");
|
|
23424
|
+
if (byteLength > D1_MAX_STATEMENT_BYTES) {
|
|
23425
|
+
return { index: index2, byteLength };
|
|
23426
|
+
}
|
|
23427
|
+
}
|
|
23428
|
+
return null;
|
|
23429
|
+
}
|
|
23430
|
+
var MIGRATION_LEDGER_TABLE = "_playcademy_migrations", MIGRATION_CHECKSUM_ALGO = "sha256-v1", D1_MAX_STATEMENT_BYTES;
|
|
23431
|
+
var init_schema3 = __esm(() => {
|
|
23432
|
+
D1_MAX_STATEMENT_BYTES = 100 * 1024;
|
|
23433
|
+
});
|
|
23434
|
+
|
|
22973
23435
|
// ../cloudflare/src/core/namespaces/d1.ts
|
|
22974
|
-
|
|
23436
|
+
function parseD1ErrorOffset(message) {
|
|
23437
|
+
const match = message.match(/at offset (\d+)/);
|
|
23438
|
+
return match ? Number(match[1]) : null;
|
|
23439
|
+
}
|
|
23440
|
+
var MIGRATION_LEDGER_DDL, D1StatementTooLargeError, D1BatchError, D1MigrationError;
|
|
23441
|
+
var init_d1 = __esm(() => {
|
|
23442
|
+
init_schema3();
|
|
23443
|
+
MIGRATION_LEDGER_DDL = `CREATE TABLE IF NOT EXISTS ${MIGRATION_LEDGER_TABLE} (
|
|
23444
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
23445
|
+
tag TEXT NOT NULL UNIQUE,
|
|
23446
|
+
checksum TEXT NOT NULL,
|
|
23447
|
+
checksum_algo TEXT NOT NULL DEFAULT 'sha256-v1',
|
|
23448
|
+
deploy_id TEXT NOT NULL,
|
|
23449
|
+
applied_by TEXT,
|
|
23450
|
+
applied_at TEXT NOT NULL,
|
|
23451
|
+
source TEXT NOT NULL DEFAULT 'deploy',
|
|
23452
|
+
statements_total INTEGER
|
|
23453
|
+
)`;
|
|
23454
|
+
D1StatementTooLargeError = class D1StatementTooLargeError extends Error {
|
|
23455
|
+
name = "D1StatementTooLargeError";
|
|
23456
|
+
statementIndex;
|
|
23457
|
+
byteLength;
|
|
23458
|
+
constructor(tag, statementIndex, byteLength) {
|
|
23459
|
+
super(`Migration '${tag}' statement ${statementIndex} is ${byteLength} bytes — ` + `over D1's ${D1_MAX_STATEMENT_BYTES / 1024} KB per-statement limit. ` + "Split the statement or reduce its size.");
|
|
23460
|
+
this.statementIndex = statementIndex;
|
|
23461
|
+
this.byteLength = byteLength;
|
|
23462
|
+
}
|
|
23463
|
+
};
|
|
23464
|
+
D1BatchError = class D1BatchError extends Error {
|
|
23465
|
+
name = "D1BatchError";
|
|
23466
|
+
d1Message;
|
|
23467
|
+
offset;
|
|
23468
|
+
constructor(d1Message, cause) {
|
|
23469
|
+
super(`Failed to execute batch: ${d1Message}`, { cause });
|
|
23470
|
+
this.d1Message = d1Message;
|
|
23471
|
+
this.offset = parseD1ErrorOffset(d1Message);
|
|
23472
|
+
}
|
|
23473
|
+
};
|
|
23474
|
+
D1MigrationError = class D1MigrationError extends Error {
|
|
23475
|
+
name = "D1MigrationError";
|
|
23476
|
+
tag;
|
|
23477
|
+
d1Message;
|
|
23478
|
+
offset;
|
|
23479
|
+
constructor(tag, d1Message, cause) {
|
|
23480
|
+
super(`Migration '${tag}' failed and rolled back: ${d1Message}`, { cause });
|
|
23481
|
+
this.tag = tag;
|
|
23482
|
+
this.d1Message = d1Message;
|
|
23483
|
+
this.offset = parseD1ErrorOffset(d1Message);
|
|
23484
|
+
}
|
|
23485
|
+
};
|
|
23486
|
+
});
|
|
23487
|
+
|
|
22975
23488
|
// ../cloudflare/src/core/namespaces/kv.ts
|
|
22976
23489
|
var init_kv = () => {};
|
|
22977
23490
|
|
|
@@ -22988,6 +23501,160 @@ var init_assets = __esm(() => {
|
|
|
22988
23501
|
init_mime();
|
|
22989
23502
|
});
|
|
22990
23503
|
|
|
23504
|
+
// ../cloudflare/src/utils/journal.ts
|
|
23505
|
+
function findOutOfOrderTags(orderedTags, applied) {
|
|
23506
|
+
let lastAppliedIndex = -1;
|
|
23507
|
+
orderedTags.forEach((tag, index2) => {
|
|
23508
|
+
if (applied.has(tag)) {
|
|
23509
|
+
lastAppliedIndex = index2;
|
|
23510
|
+
}
|
|
23511
|
+
});
|
|
23512
|
+
return orderedTags.filter((tag, index2) => index2 < lastAppliedIndex && !applied.has(tag));
|
|
23513
|
+
}
|
|
23514
|
+
|
|
23515
|
+
// ../cloudflare/src/utils/sql.ts
|
|
23516
|
+
function detectDestructiveStatements(statements) {
|
|
23517
|
+
return statements.filter((statement) => {
|
|
23518
|
+
const scannable = blankStringLiterals(normalizeSqlForChecksum(statement));
|
|
23519
|
+
return DESTRUCTIVE_SQL_PATTERNS.some((pattern) => pattern.test(scannable));
|
|
23520
|
+
});
|
|
23521
|
+
}
|
|
23522
|
+
function splitSqlStatements(sql4) {
|
|
23523
|
+
const statements = [];
|
|
23524
|
+
let current = "";
|
|
23525
|
+
let i2 = 0;
|
|
23526
|
+
while (i2 < sql4.length) {
|
|
23527
|
+
const char3 = sql4[i2];
|
|
23528
|
+
const next = sql4[i2 + 1];
|
|
23529
|
+
if (char3 === ";") {
|
|
23530
|
+
statements.push(current);
|
|
23531
|
+
current = "";
|
|
23532
|
+
i2++;
|
|
23533
|
+
} else if (char3 === "-" && next === "-") {
|
|
23534
|
+
const end = scanLineCommentEnd(sql4, i2);
|
|
23535
|
+
current += sql4.slice(i2, end);
|
|
23536
|
+
i2 = end;
|
|
23537
|
+
} else if (char3 === "/" && next === "*") {
|
|
23538
|
+
const end = scanBlockCommentEnd(sql4, i2);
|
|
23539
|
+
current += sql4.slice(i2, end);
|
|
23540
|
+
i2 = end;
|
|
23541
|
+
} else if (char3 === "'" || char3 === '"' || char3 === "`") {
|
|
23542
|
+
const end = scanQuoteEnd(sql4, i2, char3);
|
|
23543
|
+
current += sql4.slice(i2, end);
|
|
23544
|
+
i2 = end;
|
|
23545
|
+
} else if (char3 === "[") {
|
|
23546
|
+
const end = scanBracketEnd(sql4, i2);
|
|
23547
|
+
current += sql4.slice(i2, end);
|
|
23548
|
+
i2 = end;
|
|
23549
|
+
} else {
|
|
23550
|
+
current += char3;
|
|
23551
|
+
i2++;
|
|
23552
|
+
}
|
|
23553
|
+
}
|
|
23554
|
+
statements.push(current);
|
|
23555
|
+
return statements.map((statement) => statement.trim()).filter((statement) => normalizeSqlForChecksum(statement).trim() !== "");
|
|
23556
|
+
}
|
|
23557
|
+
function blankStringLiterals(sql4) {
|
|
23558
|
+
let output = "";
|
|
23559
|
+
let i2 = 0;
|
|
23560
|
+
while (i2 < sql4.length) {
|
|
23561
|
+
const char3 = sql4[i2];
|
|
23562
|
+
if (char3 === "'") {
|
|
23563
|
+
output += "''";
|
|
23564
|
+
i2 = scanQuoteEnd(sql4, i2, char3);
|
|
23565
|
+
} else if (char3 === '"' || char3 === "`") {
|
|
23566
|
+
const end = scanQuoteEnd(sql4, i2, char3);
|
|
23567
|
+
output += sql4.slice(i2, end);
|
|
23568
|
+
i2 = end;
|
|
23569
|
+
} else if (char3 === "[") {
|
|
23570
|
+
const end = scanBracketEnd(sql4, i2);
|
|
23571
|
+
output += sql4.slice(i2, end);
|
|
23572
|
+
i2 = end;
|
|
23573
|
+
} else {
|
|
23574
|
+
output += char3;
|
|
23575
|
+
i2++;
|
|
23576
|
+
}
|
|
23577
|
+
}
|
|
23578
|
+
return output;
|
|
23579
|
+
}
|
|
23580
|
+
function scanLineCommentEnd(sql4, start2) {
|
|
23581
|
+
let i2 = start2 + 2;
|
|
23582
|
+
while (i2 < sql4.length && sql4[i2] !== `
|
|
23583
|
+
`) {
|
|
23584
|
+
i2++;
|
|
23585
|
+
}
|
|
23586
|
+
return i2;
|
|
23587
|
+
}
|
|
23588
|
+
function scanBlockCommentEnd(sql4, start2) {
|
|
23589
|
+
let i2 = start2 + 2;
|
|
23590
|
+
while (i2 < sql4.length && !(sql4[i2] === "*" && sql4[i2 + 1] === "/")) {
|
|
23591
|
+
i2++;
|
|
23592
|
+
}
|
|
23593
|
+
return Math.min(i2 + 2, sql4.length);
|
|
23594
|
+
}
|
|
23595
|
+
function scanQuoteEnd(sql4, start2, quote) {
|
|
23596
|
+
let i2 = start2 + 1;
|
|
23597
|
+
while (i2 < sql4.length) {
|
|
23598
|
+
if (sql4[i2] !== quote) {
|
|
23599
|
+
i2++;
|
|
23600
|
+
} else if (sql4[i2 + 1] === quote) {
|
|
23601
|
+
i2 += 2;
|
|
23602
|
+
} else {
|
|
23603
|
+
return i2 + 1;
|
|
23604
|
+
}
|
|
23605
|
+
}
|
|
23606
|
+
return i2;
|
|
23607
|
+
}
|
|
23608
|
+
function scanBracketEnd(sql4, start2) {
|
|
23609
|
+
let i2 = start2 + 1;
|
|
23610
|
+
while (i2 < sql4.length) {
|
|
23611
|
+
if (sql4[i2] === "]") {
|
|
23612
|
+
return i2 + 1;
|
|
23613
|
+
}
|
|
23614
|
+
i2++;
|
|
23615
|
+
}
|
|
23616
|
+
return i2;
|
|
23617
|
+
}
|
|
23618
|
+
function isAlreadyExistsSqlError(message) {
|
|
23619
|
+
return /already exists|duplicate column/i.test(message);
|
|
23620
|
+
}
|
|
23621
|
+
function readIdentifier(groups) {
|
|
23622
|
+
return groups.find((group) => group !== undefined) ?? "";
|
|
23623
|
+
}
|
|
23624
|
+
function extractCreatedObjects(statements) {
|
|
23625
|
+
const tables = [];
|
|
23626
|
+
const columns2 = [];
|
|
23627
|
+
for (const statement of statements) {
|
|
23628
|
+
const scannable = blankStringLiterals(normalizeSqlForChecksum(statement));
|
|
23629
|
+
for (const match of scannable.matchAll(CREATE_TABLE_RE)) {
|
|
23630
|
+
const name2 = readIdentifier(match.slice(1, 5));
|
|
23631
|
+
if (name2 && !name2.startsWith("__new_")) {
|
|
23632
|
+
tables.push(name2);
|
|
23633
|
+
}
|
|
23634
|
+
}
|
|
23635
|
+
for (const match of scannable.matchAll(ADD_COLUMN_RE)) {
|
|
23636
|
+
const table8 = readIdentifier(match.slice(1, 5));
|
|
23637
|
+
const column2 = readIdentifier(match.slice(5, 9));
|
|
23638
|
+
if (table8 && column2 && !table8.startsWith("__new_")) {
|
|
23639
|
+
columns2.push({ table: table8, column: column2 });
|
|
23640
|
+
}
|
|
23641
|
+
}
|
|
23642
|
+
}
|
|
23643
|
+
return { tables, columns: columns2 };
|
|
23644
|
+
}
|
|
23645
|
+
var DESTRUCTIVE_SQL_PATTERNS, IDENTIFIER_SOURCE, CREATE_TABLE_RE, ADD_COLUMN_RE;
|
|
23646
|
+
var init_sql3 = __esm(() => {
|
|
23647
|
+
init_schema3();
|
|
23648
|
+
DESTRUCTIVE_SQL_PATTERNS = [
|
|
23649
|
+
/\bDROP\s+TABLE\b/i,
|
|
23650
|
+
/\bALTER\s+TABLE\b[\s\S]*\bDROP\b/i,
|
|
23651
|
+
/\bCREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["'`[]?__new_/i
|
|
23652
|
+
];
|
|
23653
|
+
IDENTIFIER_SOURCE = String.raw`(?:"([^"]+)"|\`([^\`]+)\`|\[([^\]]+)\]|([A-Za-z_][\w$]*))`;
|
|
23654
|
+
CREATE_TABLE_RE = new RegExp(String.raw`\bCREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?${IDENTIFIER_SOURCE}`, "gi");
|
|
23655
|
+
ADD_COLUMN_RE = new RegExp(String.raw`\bALTER\s+TABLE\s+${IDENTIFIER_SOURCE}\s+ADD\s+(?:COLUMN\s+)?${IDENTIFIER_SOURCE}`, "gi");
|
|
23656
|
+
});
|
|
23657
|
+
|
|
22991
23658
|
// ../../node_modules/.bun/@fastify+busboy@3.2.0/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
|
|
22992
23659
|
var require_sbmh = __commonJS((exports, module2) => {
|
|
22993
23660
|
var { EventEmitter } = __require("node:events");
|
|
@@ -24917,6 +25584,8 @@ var init_multipart = __esm(() => {
|
|
|
24917
25584
|
var init_utils5 = __esm(() => {
|
|
24918
25585
|
init_hostname();
|
|
24919
25586
|
init_assets();
|
|
25587
|
+
init_schema3();
|
|
25588
|
+
init_sql3();
|
|
24920
25589
|
init_multipart();
|
|
24921
25590
|
});
|
|
24922
25591
|
|
|
@@ -25071,6 +25740,14 @@ var init_core = __esm(() => {
|
|
|
25071
25740
|
init_client();
|
|
25072
25741
|
});
|
|
25073
25742
|
|
|
25743
|
+
// ../cloudflare/src/index.ts
|
|
25744
|
+
var init_src4 = __esm(() => {
|
|
25745
|
+
init_core();
|
|
25746
|
+
init_namespaces();
|
|
25747
|
+
init_utils5();
|
|
25748
|
+
init_utils5();
|
|
25749
|
+
});
|
|
25750
|
+
|
|
25074
25751
|
// ../cloudflare/src/playcademy/constants.ts
|
|
25075
25752
|
var CUSTOM_DOMAINS_KV_NAME = "cademy-custom-domains", QUEUE_NAME_PREFIX = "playcademy", GAME_WORKER_DOMAIN_PRODUCTION, GAME_WORKER_DOMAIN_STAGING;
|
|
25076
25753
|
var init_constants2 = __esm(() => {
|
|
@@ -27519,68 +28196,390 @@ var init_playcademy = __esm(() => {
|
|
|
27519
28196
|
});
|
|
27520
28197
|
|
|
27521
28198
|
// ../utils/src/tunnel.ts
|
|
27522
|
-
|
|
27523
|
-
|
|
28199
|
+
function servicePort(service) {
|
|
28200
|
+
if (!service) {
|
|
28201
|
+
return null;
|
|
28202
|
+
}
|
|
27524
28203
|
try {
|
|
27525
|
-
|
|
28204
|
+
const url = new URL(service);
|
|
28205
|
+
return url.port || (url.protocol === "https:" ? "443" : "80");
|
|
27526
28206
|
} catch {
|
|
27527
|
-
|
|
28207
|
+
return null;
|
|
27528
28208
|
}
|
|
27529
|
-
|
|
27530
|
-
|
|
28209
|
+
}
|
|
28210
|
+
async function readTunnelIngress(port) {
|
|
28211
|
+
try {
|
|
28212
|
+
const response = await fetch(`http://127.0.0.1:${port}/config`, {
|
|
28213
|
+
signal: AbortSignal.timeout(1000)
|
|
28214
|
+
});
|
|
28215
|
+
if (!response.ok) {
|
|
28216
|
+
return null;
|
|
28217
|
+
}
|
|
28218
|
+
const data = await response.json();
|
|
28219
|
+
return data.config?.ingress ?? [];
|
|
28220
|
+
} catch {
|
|
28221
|
+
return null;
|
|
28222
|
+
}
|
|
28223
|
+
}
|
|
28224
|
+
function matchingHostname(rules, expectedPort) {
|
|
28225
|
+
for (const rule of rules ?? []) {
|
|
28226
|
+
if (rule.hostname && servicePort(rule.service) === expectedPort) {
|
|
28227
|
+
return rule.hostname;
|
|
28228
|
+
}
|
|
28229
|
+
}
|
|
28230
|
+
return null;
|
|
28231
|
+
}
|
|
28232
|
+
async function getTunnelUrl(platformBaseUrl) {
|
|
28233
|
+
const expectedPort = servicePort(platformBaseUrl);
|
|
28234
|
+
if (!expectedPort) {
|
|
28235
|
+
throw new Error(`Cannot resolve a tunnel for unparseable platform URL '${platformBaseUrl}'`);
|
|
28236
|
+
}
|
|
28237
|
+
const cachedPort = matchedPorts.get(expectedPort);
|
|
28238
|
+
if (cachedPort !== undefined) {
|
|
28239
|
+
const hostname = matchingHostname(await readTunnelIngress(cachedPort), expectedPort);
|
|
28240
|
+
if (hostname) {
|
|
28241
|
+
return `https://${hostname}`;
|
|
28242
|
+
}
|
|
28243
|
+
matchedPorts.delete(expectedPort);
|
|
28244
|
+
}
|
|
28245
|
+
const ports = Array.from({ length: TUNNEL_METRICS_PORT_RANGE }, (_, offset) => TUNNEL_METRICS_PORT + offset);
|
|
28246
|
+
const results = await Promise.all(ports.map(async (port) => ({ port, rules: await readTunnelIngress(port) })));
|
|
28247
|
+
for (const { port, rules } of results) {
|
|
28248
|
+
const hostname = matchingHostname(rules, expectedPort);
|
|
28249
|
+
if (hostname) {
|
|
28250
|
+
matchedPorts.set(expectedPort, port);
|
|
28251
|
+
return `https://${hostname}`;
|
|
28252
|
+
}
|
|
27531
28253
|
}
|
|
27532
|
-
const
|
|
27533
|
-
|
|
27534
|
-
|
|
27535
|
-
throw new Error("Tunnel is running but no hostname found in ingress config");
|
|
28254
|
+
const foreign = results.flatMap(({ rules }) => (rules ?? []).filter((rule) => rule.hostname).map((rule) => `${rule.hostname} -> ${rule.service}`));
|
|
28255
|
+
if (foreign.length > 0) {
|
|
28256
|
+
throw new Error(`A local tunnel is running, but none route to the platform at ${platformBaseUrl} (found: ${foreign.join(", ")}). ${TUNNEL_START_HINT}`);
|
|
27536
28257
|
}
|
|
27537
|
-
|
|
28258
|
+
throw new Error(`Local tunnel is not running. ${TUNNEL_START_HINT}`);
|
|
27538
28259
|
}
|
|
27539
|
-
var TUNNEL_METRICS_PORT = 20241,
|
|
28260
|
+
var TUNNEL_METRICS_PORT = 20241, TUNNEL_METRICS_PORT_RANGE = 10, TUNNEL_START_HINT = "Start this platform's tunnel with `bun dev` or `bun run tunnel`.", matchedPorts;
|
|
27540
28261
|
var init_tunnel = __esm(() => {
|
|
27541
|
-
|
|
27542
|
-
});
|
|
27543
|
-
|
|
27544
|
-
// ../
|
|
27545
|
-
function
|
|
27546
|
-
|
|
28262
|
+
matchedPorts = new Map;
|
|
28263
|
+
});
|
|
28264
|
+
|
|
28265
|
+
// ../api-core/src/utils/baseline-validation.util.ts
|
|
28266
|
+
function assertBaselineClaimValid(args2) {
|
|
28267
|
+
const validation = validateBaselineClaim(args2);
|
|
28268
|
+
const blocked = validation.contradictions.length > 0 || validation.unverified.length > 0 && !args2.allowUnverified;
|
|
28269
|
+
if (blocked) {
|
|
28270
|
+
addEvent("deployment_state.baseline_claim_rejected", {
|
|
28271
|
+
"app.game.id": args2.gameId,
|
|
28272
|
+
"app.deployment_state.baseline_claim_source": args2.source,
|
|
28273
|
+
"app.deployment_state.baseline_contradictions": validation.contradictions.length,
|
|
28274
|
+
"app.deployment_state.baseline_unverified": validation.unverified.length,
|
|
28275
|
+
"app.deployment_state.baseline_suggested_tag": validation.suggestedTag ?? "none"
|
|
28276
|
+
});
|
|
28277
|
+
throw new BaselineClaimRejectedError({
|
|
28278
|
+
contradictions: validation.contradictions,
|
|
28279
|
+
unverified: validation.unverified,
|
|
28280
|
+
suggestedTag: validation.suggestedTag,
|
|
28281
|
+
claimedTag: args2.claimedTag
|
|
28282
|
+
});
|
|
28283
|
+
}
|
|
28284
|
+
if (validation.unverified.length > 0) {
|
|
28285
|
+
addEvent("deployment_state.baseline_unverified_overridden", {
|
|
28286
|
+
"app.game.id": args2.gameId,
|
|
28287
|
+
"app.user.id": args2.userId,
|
|
28288
|
+
"app.deployment_state.baseline_overridden_tags": validation.unverified.map((entry) => entry.tag).join(",")
|
|
28289
|
+
});
|
|
28290
|
+
}
|
|
28291
|
+
}
|
|
28292
|
+
function validateBaselineClaim(args2) {
|
|
28293
|
+
const { claimedTag, evidence, tables, indexes: indexes2, views, lastDeployAt } = args2;
|
|
28294
|
+
const claimedIndex = evidence.findIndex((entry) => entry.tag === claimedTag);
|
|
28295
|
+
const verdicts = [];
|
|
28296
|
+
const unverified = [];
|
|
28297
|
+
evidence.forEach((entry, index2) => {
|
|
28298
|
+
if (claimedIndex === -1 || index2 > claimedIndex) {
|
|
28299
|
+
verdicts.push(judgeBeyond(entry, tables, indexes2, views));
|
|
28300
|
+
return;
|
|
28301
|
+
}
|
|
28302
|
+
const judged = judgeClaimed(entry, tables, lastDeployAt);
|
|
28303
|
+
verdicts.push(judged.verdict);
|
|
28304
|
+
if (judged.unverifiable) {
|
|
28305
|
+
unverified.push(judged.verdict);
|
|
28306
|
+
}
|
|
28307
|
+
});
|
|
28308
|
+
return {
|
|
28309
|
+
verdicts,
|
|
28310
|
+
contradictions: verdicts.filter((verdict) => verdict.verdict === "contradicted"),
|
|
28311
|
+
unverified,
|
|
28312
|
+
suggestedTag: suggestTag(evidence, tables)
|
|
28313
|
+
};
|
|
27547
28314
|
}
|
|
27548
|
-
|
|
27549
|
-
|
|
27550
|
-
|
|
28315
|
+
function judgeClaimed(entry, tables, lastDeployAt) {
|
|
28316
|
+
if (!hasSignal(entry)) {
|
|
28317
|
+
const generated = new Date(entry.generatedAt);
|
|
28318
|
+
if (lastDeployAt && generated > lastDeployAt) {
|
|
28319
|
+
return {
|
|
28320
|
+
verdict: {
|
|
28321
|
+
tag: entry.tag,
|
|
28322
|
+
verdict: "no-signal",
|
|
28323
|
+
detail: `no schema footprint to verify, and it was generated after the last deploy (${lastDeployAt.toISOString()})`
|
|
28324
|
+
},
|
|
28325
|
+
unverifiable: true
|
|
28326
|
+
};
|
|
28327
|
+
}
|
|
28328
|
+
return { verdict: { tag: entry.tag, verdict: "no-signal" }, unverifiable: false };
|
|
28329
|
+
}
|
|
28330
|
+
for (const table8 of entry.createsTables) {
|
|
28331
|
+
const columns2 = tables.get(table8.name);
|
|
28332
|
+
if (!columns2) {
|
|
28333
|
+
return {
|
|
28334
|
+
verdict: {
|
|
28335
|
+
tag: entry.tag,
|
|
28336
|
+
verdict: "contradicted",
|
|
28337
|
+
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
28338
|
+
},
|
|
28339
|
+
unverifiable: false
|
|
28340
|
+
};
|
|
28341
|
+
}
|
|
28342
|
+
const missing = table8.columns.filter((column2) => !columns2.includes(column2));
|
|
28343
|
+
if (missing.length > 0) {
|
|
28344
|
+
return {
|
|
28345
|
+
verdict: {
|
|
28346
|
+
tag: entry.tag,
|
|
28347
|
+
verdict: "contradicted",
|
|
28348
|
+
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
28349
|
+
},
|
|
28350
|
+
unverifiable: false
|
|
28351
|
+
};
|
|
28352
|
+
}
|
|
28353
|
+
}
|
|
28354
|
+
for (const added of entry.addsColumns) {
|
|
28355
|
+
const columns2 = tables.get(added.table);
|
|
28356
|
+
if (columns2 && !columns2.includes(added.column)) {
|
|
28357
|
+
return {
|
|
28358
|
+
verdict: {
|
|
28359
|
+
tag: entry.tag,
|
|
28360
|
+
verdict: "contradicted",
|
|
28361
|
+
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
28362
|
+
},
|
|
28363
|
+
unverifiable: false
|
|
28364
|
+
};
|
|
28365
|
+
}
|
|
28366
|
+
}
|
|
28367
|
+
return { verdict: { tag: entry.tag, verdict: "verified" }, unverifiable: false };
|
|
28368
|
+
}
|
|
28369
|
+
function judgeBeyond(entry, tables, indexes2, views) {
|
|
28370
|
+
for (const table8 of entry.createsTables) {
|
|
28371
|
+
if (tables.has(table8.name)) {
|
|
28372
|
+
return {
|
|
28373
|
+
tag: entry.tag,
|
|
28374
|
+
verdict: "contradicted",
|
|
28375
|
+
detail: `is beyond the claim, but the table it creates (\`${table8.name}\`) already exists in the live database — the claim looks too old`
|
|
28376
|
+
};
|
|
28377
|
+
}
|
|
28378
|
+
}
|
|
28379
|
+
for (const added of entry.addsColumns) {
|
|
28380
|
+
const columns2 = tables.get(added.table);
|
|
28381
|
+
if (columns2?.includes(added.column)) {
|
|
28382
|
+
return {
|
|
28383
|
+
tag: entry.tag,
|
|
28384
|
+
verdict: "contradicted",
|
|
28385
|
+
detail: `is beyond the claim, but the column it adds (\`${added.table}.${added.column}\`) already exists — the claim looks too old`
|
|
28386
|
+
};
|
|
28387
|
+
}
|
|
28388
|
+
}
|
|
28389
|
+
for (const index2 of entry.createsIndexes) {
|
|
28390
|
+
if (indexes2.has(index2)) {
|
|
28391
|
+
return {
|
|
28392
|
+
tag: entry.tag,
|
|
28393
|
+
verdict: "contradicted",
|
|
28394
|
+
detail: `is beyond the claim, but the index it creates (\`${index2}\`) already exists — the claim looks too old`
|
|
28395
|
+
};
|
|
28396
|
+
}
|
|
28397
|
+
}
|
|
28398
|
+
for (const view2 of entry.createsViews) {
|
|
28399
|
+
if (views.has(view2)) {
|
|
28400
|
+
return {
|
|
28401
|
+
tag: entry.tag,
|
|
28402
|
+
verdict: "contradicted",
|
|
28403
|
+
detail: `is beyond the claim, but the view it creates (\`${view2}\`) already exists — the claim looks too old`
|
|
28404
|
+
};
|
|
28405
|
+
}
|
|
28406
|
+
}
|
|
28407
|
+
return { tag: entry.tag, verdict: "verified" };
|
|
28408
|
+
}
|
|
28409
|
+
function suggestTag(evidence, tables) {
|
|
28410
|
+
let presentPrefix = 0;
|
|
28411
|
+
while (presentPrefix < evidence.length && evidence[presentPrefix].createsTables.every((table8) => tables.has(table8.name))) {
|
|
28412
|
+
presentPrefix++;
|
|
28413
|
+
}
|
|
28414
|
+
let absentFrom = evidence.length;
|
|
28415
|
+
while (absentFrom > 0 && evidence[absentFrom - 1].createsTables.every((table8) => !tables.has(table8.name))) {
|
|
28416
|
+
absentFrom--;
|
|
28417
|
+
}
|
|
28418
|
+
const candidate = presentPrefix - 1;
|
|
28419
|
+
return candidate >= 0 && candidate >= absentFrom - 1 ? evidence[candidate].tag : null;
|
|
28420
|
+
}
|
|
28421
|
+
function hasSignal(entry) {
|
|
28422
|
+
return entry.createsTables.length > 0 || entry.addsColumns.length > 0 || entry.createsIndexes.length > 0 || entry.createsViews.length > 0;
|
|
28423
|
+
}
|
|
28424
|
+
var init_baseline_validation_util = __esm(() => {
|
|
28425
|
+
init_spans();
|
|
28426
|
+
init_errors();
|
|
27551
28427
|
});
|
|
27552
28428
|
|
|
27553
|
-
// ../api-core/src/utils/
|
|
27554
|
-
function
|
|
27555
|
-
|
|
27556
|
-
|
|
28429
|
+
// ../api-core/src/utils/baseline.util.ts
|
|
28430
|
+
function sliceJournalToTag(journal, lastAppliedMigrationTag) {
|
|
28431
|
+
const index2 = journal.findIndex((entry) => entry.tag === lastAppliedMigrationTag);
|
|
28432
|
+
return index2 === -1 ? null : journal.slice(0, index2 + 1);
|
|
28433
|
+
}
|
|
28434
|
+
function evaluateBaselineGuardrails(input) {
|
|
28435
|
+
if (input.ledgerTags.length > 0) {
|
|
28436
|
+
return "ledger-not-empty";
|
|
27557
28437
|
}
|
|
27558
|
-
if (
|
|
27559
|
-
return
|
|
28438
|
+
if (input.liveTables.length === 0) {
|
|
28439
|
+
return "database-empty";
|
|
27560
28440
|
}
|
|
27561
|
-
return
|
|
28441
|
+
return "ok";
|
|
27562
28442
|
}
|
|
27563
|
-
|
|
27564
|
-
|
|
28443
|
+
|
|
28444
|
+
// ../api-core/src/utils/migration.util.ts
|
|
28445
|
+
function planMigrations(journal, ledger) {
|
|
28446
|
+
const ledgerByTag = new Map(ledger.map((row) => [row.tag, row]));
|
|
28447
|
+
const journalTags = new Set(journal.map((entry) => entry.tag));
|
|
28448
|
+
const pendingTags = [];
|
|
28449
|
+
const checksumMismatches = [];
|
|
28450
|
+
for (const entry of journal) {
|
|
28451
|
+
const applied = ledgerByTag.get(entry.tag);
|
|
28452
|
+
if (!applied) {
|
|
28453
|
+
pendingTags.push(entry.tag);
|
|
28454
|
+
} else {
|
|
28455
|
+
const comparable = applied.checksumAlgo === MIGRATION_CHECKSUM_ALGO;
|
|
28456
|
+
if (comparable && applied.checksum !== entry.checksum) {
|
|
28457
|
+
checksumMismatches.push({
|
|
28458
|
+
tag: entry.tag,
|
|
28459
|
+
ledgerChecksum: applied.checksum,
|
|
28460
|
+
journalChecksum: entry.checksum
|
|
28461
|
+
});
|
|
28462
|
+
}
|
|
28463
|
+
}
|
|
28464
|
+
}
|
|
28465
|
+
const outOfOrderTags = findOutOfOrderTags(journal.map((entry) => entry.tag), new Set(ledgerByTag.keys()));
|
|
28466
|
+
const missingFromJournalTags = ledger.filter((row) => !journalTags.has(row.tag)).map((row) => row.tag);
|
|
28467
|
+
return { pendingTags, checksumMismatches, outOfOrderTags, missingFromJournalTags };
|
|
27565
28468
|
}
|
|
27566
|
-
function
|
|
27567
|
-
|
|
28469
|
+
function assessMigrationAlreadyApplied(statements, liveTables) {
|
|
28470
|
+
const created = extractCreatedObjects(statements);
|
|
28471
|
+
const present = [];
|
|
28472
|
+
const missing = [];
|
|
28473
|
+
for (const table8 of created.tables) {
|
|
28474
|
+
(liveTables.has(table8) ? present : missing).push(`table ${table8}`);
|
|
28475
|
+
}
|
|
28476
|
+
for (const added of created.columns) {
|
|
28477
|
+
const live = Boolean(liveTables.get(added.table)?.includes(added.column));
|
|
28478
|
+
(live ? present : missing).push(`column ${added.table}.${added.column}`);
|
|
28479
|
+
}
|
|
28480
|
+
if (present.length === 0) {
|
|
28481
|
+
return { verdict: "no-signal", present, missing };
|
|
28482
|
+
}
|
|
28483
|
+
return {
|
|
28484
|
+
verdict: missing.length === 0 ? "all-present" : "partial",
|
|
28485
|
+
present,
|
|
28486
|
+
missing
|
|
28487
|
+
};
|
|
27568
28488
|
}
|
|
27569
|
-
function
|
|
27570
|
-
|
|
28489
|
+
function parseMigrationFailure(events) {
|
|
28490
|
+
if (!events) {
|
|
28491
|
+
return null;
|
|
28492
|
+
}
|
|
28493
|
+
for (let i2 = events.length - 1;i2 >= 0; i2--) {
|
|
28494
|
+
const event = events[i2];
|
|
28495
|
+
const failure = event ? parseFailureEvent(event) : null;
|
|
28496
|
+
if (failure) {
|
|
28497
|
+
return failure;
|
|
28498
|
+
}
|
|
28499
|
+
}
|
|
28500
|
+
return null;
|
|
27571
28501
|
}
|
|
27572
|
-
function
|
|
27573
|
-
|
|
28502
|
+
function parseFailureEvent(event) {
|
|
28503
|
+
const details = event.details;
|
|
28504
|
+
if (!details) {
|
|
28505
|
+
return null;
|
|
28506
|
+
}
|
|
28507
|
+
const { code, tag, statementIndex, error, d1Message } = details;
|
|
28508
|
+
if (code !== DEPLOY_ERROR_CODES.migrationFailed || typeof tag !== "string") {
|
|
28509
|
+
return null;
|
|
28510
|
+
}
|
|
28511
|
+
return {
|
|
28512
|
+
tag,
|
|
28513
|
+
error: failureMessage(error, d1Message),
|
|
28514
|
+
statementIndex: typeof statementIndex === "number" ? statementIndex : null,
|
|
28515
|
+
at: event.createdAt
|
|
28516
|
+
};
|
|
27574
28517
|
}
|
|
27575
|
-
function
|
|
27576
|
-
|
|
28518
|
+
function failureMessage(error, d1Message) {
|
|
28519
|
+
if (typeof error === "string") {
|
|
28520
|
+
return error;
|
|
28521
|
+
}
|
|
28522
|
+
if (typeof d1Message === "string") {
|
|
28523
|
+
return d1Message;
|
|
28524
|
+
}
|
|
28525
|
+
return "Migration failed";
|
|
27577
28526
|
}
|
|
27578
|
-
var
|
|
27579
|
-
|
|
27580
|
-
|
|
27581
|
-
init_stages();
|
|
28527
|
+
var init_migration_util = __esm(() => {
|
|
28528
|
+
init_src4();
|
|
28529
|
+
init_errors();
|
|
27582
28530
|
});
|
|
27583
28531
|
|
|
28532
|
+
// ../api-core/src/utils/secrets-manifest.util.ts
|
|
28533
|
+
async function deriveSecretsManifestPepper(platformSecret) {
|
|
28534
|
+
const encoder = new TextEncoder;
|
|
28535
|
+
const keyMaterial = await crypto.subtle.importKey("raw", encoder.encode(platformSecret), "HKDF", false, ["deriveBits"]);
|
|
28536
|
+
const bits = await crypto.subtle.deriveBits({
|
|
28537
|
+
name: "HKDF",
|
|
28538
|
+
hash: "SHA-256",
|
|
28539
|
+
salt: new Uint8Array(32),
|
|
28540
|
+
info: encoder.encode(SECRETS_MANIFEST_HKDF_INFO)
|
|
28541
|
+
}, keyMaterial, 256);
|
|
28542
|
+
return new Uint8Array(bits);
|
|
28543
|
+
}
|
|
28544
|
+
async function computeSecretDigest(pepper, input) {
|
|
28545
|
+
const key = await crypto.subtle.importKey("raw", new Uint8Array(pepper), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
28546
|
+
const message = JSON.stringify([input.gameId, input.key, input.value]);
|
|
28547
|
+
const signature = await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(message));
|
|
28548
|
+
return [...new Uint8Array(signature)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
28549
|
+
}
|
|
28550
|
+
function computeSecretsDiff(input) {
|
|
28551
|
+
const { localDigests, manifest, remoteKeys } = input;
|
|
28552
|
+
const added = [];
|
|
28553
|
+
const changed = [];
|
|
28554
|
+
const unchanged = [];
|
|
28555
|
+
for (const [key, digest] of Object.entries(localDigests)) {
|
|
28556
|
+
const recorded = manifest[key];
|
|
28557
|
+
if (recorded === undefined) {
|
|
28558
|
+
added.push(key);
|
|
28559
|
+
} else if (recorded === digest) {
|
|
28560
|
+
unchanged.push(key);
|
|
28561
|
+
} else {
|
|
28562
|
+
changed.push(key);
|
|
28563
|
+
}
|
|
28564
|
+
}
|
|
28565
|
+
const localKeys = new Set(Object.keys(localDigests));
|
|
28566
|
+
const managedKeys = new Set(Object.keys(manifest));
|
|
28567
|
+
const remoteOnlyManaged = [...managedKeys].filter((key) => !localKeys.has(key));
|
|
28568
|
+
const remoteOnlyUnmanaged = remoteKeys.filter((key) => !managedKeys.has(key) && !localKeys.has(key));
|
|
28569
|
+
return {
|
|
28570
|
+
added: added.toSorted(),
|
|
28571
|
+
changed: changed.toSorted(),
|
|
28572
|
+
unchanged: unchanged.toSorted(),
|
|
28573
|
+
remoteOnlyManaged: remoteOnlyManaged.toSorted(),
|
|
28574
|
+
remoteOnlyUnmanaged: remoteOnlyUnmanaged.toSorted()
|
|
28575
|
+
};
|
|
28576
|
+
}
|
|
28577
|
+
function findUnmanagedPruneKeys(pruneSecrets, manifest) {
|
|
28578
|
+
const managed = new Set(Object.keys(manifest ?? {}));
|
|
28579
|
+
return pruneSecrets.filter((key) => !managed.has(key));
|
|
28580
|
+
}
|
|
28581
|
+
var SECRETS_MANIFEST_HKDF_INFO = "playcademy:secrets-manifest:v1";
|
|
28582
|
+
|
|
27584
28583
|
// ../api-core/src/utils/worker-keys.util.ts
|
|
27585
28584
|
async function sweepDashboardWorkerKeys(deleteApiKeysByName, slug) {
|
|
27586
28585
|
try {
|
|
@@ -27598,6 +28597,9 @@ var init_worker_keys_util = __esm(() => {
|
|
|
27598
28597
|
});
|
|
27599
28598
|
|
|
27600
28599
|
// ../api-core/src/services/deploy.service.ts
|
|
28600
|
+
function hasBinding(binding) {
|
|
28601
|
+
return binding === true || Array.isArray(binding) && binding.length > 0;
|
|
28602
|
+
}
|
|
27601
28603
|
function readDashboardTheme(config2) {
|
|
27602
28604
|
const theme = config2?.dashboard?.theme;
|
|
27603
28605
|
return {
|
|
@@ -27665,7 +28667,7 @@ class DeployService {
|
|
|
27665
28667
|
data: { message: hasBackend ? "Deploying backend code" : "Deploying to platform" }
|
|
27666
28668
|
};
|
|
27667
28669
|
const keepAssets = hasBackend && !hasFrontend;
|
|
27668
|
-
const deploymentOptions = this.mapGameBindingsToOptions(deploymentId, request.bindings
|
|
28670
|
+
const deploymentOptions = this.mapGameBindingsToOptions(deploymentId, request.bindings);
|
|
27669
28671
|
const bindings = deploymentOptions?.bindings;
|
|
27670
28672
|
setAttributes({
|
|
27671
28673
|
"app.deploy.has_d1": Boolean(bindings?.d1?.length),
|
|
@@ -27674,13 +28676,49 @@ class DeployService {
|
|
|
27674
28676
|
"app.deploy.queue_count": bindings?.queues?.length ?? 0,
|
|
27675
28677
|
"app.deploy.dead_letter_queue_count": DeployService.countDeadLetterQueues(bindings)
|
|
27676
28678
|
});
|
|
27677
|
-
const activeDeployment = await
|
|
27678
|
-
|
|
27679
|
-
|
|
27680
|
-
|
|
27681
|
-
|
|
28679
|
+
const [activeDeployment, deploymentState] = await Promise.all([
|
|
28680
|
+
db2.query.gameDeployments.findFirst({
|
|
28681
|
+
where: activeDeploymentWhere(game2.id, "game"),
|
|
28682
|
+
columns: { resources: true }
|
|
28683
|
+
}),
|
|
28684
|
+
db2.query.gameDeploymentState.findFirst({
|
|
28685
|
+
where: eq(gameDeploymentState.gameId, game2.id)
|
|
28686
|
+
})
|
|
28687
|
+
]);
|
|
28688
|
+
if (request.pruneSecrets?.length) {
|
|
28689
|
+
const unmanaged = findUnmanagedPruneKeys(request.pruneSecrets, deploymentState?.secretsManifest);
|
|
28690
|
+
if (unmanaged.length > 0) {
|
|
28691
|
+
throw new SecretsPruneUnmanagedError(unmanaged);
|
|
28692
|
+
}
|
|
28693
|
+
}
|
|
28694
|
+
let state = deploymentState;
|
|
28695
|
+
if (request.baseline) {
|
|
28696
|
+
if (isSchemaAdopted(state)) {
|
|
28697
|
+
addEvent("deploy.baseline_skipped", {
|
|
28698
|
+
"app.deploy.baseline_source": state?.baselineSource ?? "unknown"
|
|
28699
|
+
});
|
|
28700
|
+
} else {
|
|
28701
|
+
state = yield* this.adoptClientBaseline({
|
|
28702
|
+
game: game2,
|
|
28703
|
+
request,
|
|
28704
|
+
user,
|
|
28705
|
+
deploymentId,
|
|
28706
|
+
baseline: request.baseline,
|
|
28707
|
+
existingResources: activeDeployment?.resources ?? undefined
|
|
28708
|
+
});
|
|
28709
|
+
}
|
|
28710
|
+
}
|
|
28711
|
+
if (deploymentOptions?.bindings?.d1?.length && !isSchemaAdopted(state)) {
|
|
27682
28712
|
await this.cleanupOrphanD1Databases(cf, deploymentOptions.bindings.d1, slug, game2.id);
|
|
27683
28713
|
}
|
|
28714
|
+
const databaseOutcome = yield* this.executeDatabaseStep({
|
|
28715
|
+
game: game2,
|
|
28716
|
+
request,
|
|
28717
|
+
user,
|
|
28718
|
+
deploymentId,
|
|
28719
|
+
state,
|
|
28720
|
+
existingResources: activeDeployment?.resources ?? undefined
|
|
28721
|
+
});
|
|
27684
28722
|
const result = await this.deployToCloudflare({
|
|
27685
28723
|
deploymentId,
|
|
27686
28724
|
code: request.code,
|
|
@@ -27688,6 +28726,7 @@ class DeployService {
|
|
|
27688
28726
|
tempDir,
|
|
27689
28727
|
options: {
|
|
27690
28728
|
...deploymentOptions,
|
|
28729
|
+
...databaseOutcome.legacySchema && { schema: databaseOutcome.legacySchema },
|
|
27691
28730
|
compatibilityDate: request.compatibilityDate ?? CLOUDFLARE_COMPATIBILITY_DATE,
|
|
27692
28731
|
compatibilityFlags: request.compatibilityFlags,
|
|
27693
28732
|
existingResources: activeDeployment?.resources ?? undefined,
|
|
@@ -27703,8 +28742,12 @@ class DeployService {
|
|
|
27703
28742
|
result,
|
|
27704
28743
|
request,
|
|
27705
28744
|
user,
|
|
27706
|
-
flags: flags2
|
|
28745
|
+
flags: flags2,
|
|
28746
|
+
database: databaseOutcome
|
|
27707
28747
|
});
|
|
28748
|
+
if (request.pruneSecrets?.length) {
|
|
28749
|
+
yield* this.pruneManagedSecretsStep(game2.id, result.deploymentId, request.pruneSecrets);
|
|
28750
|
+
}
|
|
27708
28751
|
yield { type: "complete", data: updatedGame };
|
|
27709
28752
|
}
|
|
27710
28753
|
async* deployDashboard(context2) {
|
|
@@ -27831,7 +28874,10 @@ class DeployService {
|
|
|
27831
28874
|
"app.deploy.code_size": request.code?.length ?? 0,
|
|
27832
28875
|
"app.deploy.compatibility_date": request.compatibilityDate ?? CLOUDFLARE_COMPATIBILITY_DATE,
|
|
27833
28876
|
"app.deploy.compatibility_flag_count": request.compatibilityFlags?.length ?? 0,
|
|
27834
|
-
"app.deploy.has_schema": Boolean(request.schema)
|
|
28877
|
+
"app.deploy.has_schema": Boolean(request.schema),
|
|
28878
|
+
"app.deploy.has_database_payload": Boolean(request.database),
|
|
28879
|
+
"app.deploy.has_baseline": Boolean(request.baseline),
|
|
28880
|
+
"app.deploy.prune_secret_count": request.pruneSecrets?.length ?? 0
|
|
27835
28881
|
});
|
|
27836
28882
|
if (!hasBackend && !hasFrontend && !hasMetadata) {
|
|
27837
28883
|
throw new ValidationError("Must provide at least one of: uploadToken (frontend), code (backend), or metadata");
|
|
@@ -27868,18 +28914,18 @@ class DeployService {
|
|
|
27868
28914
|
}
|
|
27869
28915
|
return "metadata_only";
|
|
27870
28916
|
}
|
|
27871
|
-
mapGameBindingsToOptions(deploymentId, bindings
|
|
27872
|
-
if (!bindings
|
|
28917
|
+
mapGameBindingsToOptions(deploymentId, bindings) {
|
|
28918
|
+
if (!bindings) {
|
|
27873
28919
|
return;
|
|
27874
28920
|
}
|
|
27875
28921
|
const workerBindings = {};
|
|
27876
|
-
if (bindings
|
|
28922
|
+
if (hasBinding(bindings.database)) {
|
|
27877
28923
|
workerBindings.d1 = [deploymentId];
|
|
27878
28924
|
}
|
|
27879
|
-
if (bindings
|
|
28925
|
+
if (hasBinding(bindings.keyValue)) {
|
|
27880
28926
|
workerBindings.kv = [deploymentId];
|
|
27881
28927
|
}
|
|
27882
|
-
if (bindings
|
|
28928
|
+
if (hasBinding(bindings.bucket)) {
|
|
27883
28929
|
workerBindings.r2 = [deploymentId];
|
|
27884
28930
|
}
|
|
27885
28931
|
if (bindings?.queues) {
|
|
@@ -27908,10 +28954,7 @@ class DeployService {
|
|
|
27908
28954
|
});
|
|
27909
28955
|
}
|
|
27910
28956
|
const hasBindings = workerBindings.d1?.length || workerBindings.kv?.length || workerBindings.r2?.length || workerBindings.queues?.length;
|
|
27911
|
-
return {
|
|
27912
|
-
...hasBindings && { bindings: workerBindings },
|
|
27913
|
-
...schema2 && { schema: schema2 }
|
|
27914
|
-
};
|
|
28957
|
+
return hasBindings ? { bindings: workerBindings } : undefined;
|
|
27915
28958
|
}
|
|
27916
28959
|
static countDeadLetterQueues(bindings) {
|
|
27917
28960
|
return bindings?.queues?.filter((queue) => Boolean(queue.deadLetterQueue)).length ?? 0;
|
|
@@ -27935,6 +28978,473 @@ class DeployService {
|
|
|
27935
28978
|
}
|
|
27936
28979
|
}
|
|
27937
28980
|
}
|
|
28981
|
+
async* executeDatabaseStep(context2) {
|
|
28982
|
+
const { game: game2, request, user, deploymentId, state } = context2;
|
|
28983
|
+
if (request.schema) {
|
|
28984
|
+
if (isSchemaAdopted(state)) {
|
|
28985
|
+
throw new LegacySchemaUpgradeRequiredError;
|
|
28986
|
+
}
|
|
28987
|
+
const legacyDbId = context2.existingResources?.d1?.find((db2) => db2.name === deploymentId)?.id;
|
|
28988
|
+
if (legacyDbId) {
|
|
28989
|
+
const ledger = await this.getCloudflare().d1.readMigrationLedger(legacyDbId);
|
|
28990
|
+
if (ledger.length > 0) {
|
|
28991
|
+
throw new LegacySchemaUpgradeRequiredError;
|
|
28992
|
+
}
|
|
28993
|
+
}
|
|
28994
|
+
setAttribute("app.deploy.db_mode", "legacy");
|
|
28995
|
+
return { ...NO_DATABASE_WORK, legacySchema: request.schema };
|
|
28996
|
+
}
|
|
28997
|
+
const database = request.database;
|
|
28998
|
+
if (!database) {
|
|
28999
|
+
return NO_DATABASE_WORK;
|
|
29000
|
+
}
|
|
29001
|
+
if (!hasBinding(request.bindings?.database)) {
|
|
29002
|
+
throw new ValidationError("The database payload requires a database binding");
|
|
29003
|
+
}
|
|
29004
|
+
if (!request.deployId) {
|
|
29005
|
+
throw new ValidationError("deployId is required when a database payload is present");
|
|
29006
|
+
}
|
|
29007
|
+
setAttribute("app.deploy.db_mode", database.mode);
|
|
29008
|
+
const cf = this.getCloudflare();
|
|
29009
|
+
const persistedId = context2.existingResources?.d1?.find((db2) => db2.name === deploymentId)?.id;
|
|
29010
|
+
const databaseId = persistedId ?? await cf.d1.create(deploymentId);
|
|
29011
|
+
if (database.mode === "migrate") {
|
|
29012
|
+
return yield* this.runMigrateMode({
|
|
29013
|
+
game: game2,
|
|
29014
|
+
user,
|
|
29015
|
+
deployId: request.deployId,
|
|
29016
|
+
databaseId,
|
|
29017
|
+
migrations: database.migrations,
|
|
29018
|
+
state
|
|
29019
|
+
});
|
|
29020
|
+
}
|
|
29021
|
+
return yield* this.runPushMode({ game: game2, databaseId, payload: database, state });
|
|
29022
|
+
}
|
|
29023
|
+
async* runMigrateMode(args2) {
|
|
29024
|
+
const { game: game2, user, deployId, databaseId, migrations, state } = args2;
|
|
29025
|
+
const cf = this.getCloudflare();
|
|
29026
|
+
yield { type: "status", data: { message: "Preparing database migrations" } };
|
|
29027
|
+
await this.assertNoSchemaDrift(databaseId, state);
|
|
29028
|
+
await cf.d1.ensureMigrationLedger(databaseId);
|
|
29029
|
+
const ledger = await cf.d1.readMigrationLedger(databaseId);
|
|
29030
|
+
const plan = planMigrations(migrations.map((migration) => ({ tag: migration.tag, checksum: migration.checksum })), ledger.map((row) => ({
|
|
29031
|
+
tag: row.tag,
|
|
29032
|
+
checksum: row.checksum,
|
|
29033
|
+
checksumAlgo: row.checksum_algo
|
|
29034
|
+
})));
|
|
29035
|
+
setAttributes({
|
|
29036
|
+
"app.deploy.migrations_total": migrations.length,
|
|
29037
|
+
"app.deploy.migrations_applied_before": ledger.length,
|
|
29038
|
+
"app.deploy.migrations_pending": plan.pendingTags.length
|
|
29039
|
+
});
|
|
29040
|
+
if (plan.checksumMismatches.length > 0) {
|
|
29041
|
+
throw new MigrationChecksumMismatchError(plan.checksumMismatches);
|
|
29042
|
+
}
|
|
29043
|
+
if (plan.missingFromJournalTags.length > 0) {
|
|
29044
|
+
throw new MigrationJournalDivergenceError(plan.missingFromJournalTags);
|
|
29045
|
+
}
|
|
29046
|
+
if (plan.outOfOrderTags.length > 0) {
|
|
29047
|
+
throw new MigrationOrderError(plan.outOfOrderTags);
|
|
29048
|
+
}
|
|
29049
|
+
if (plan.pendingTags.length === 0) {
|
|
29050
|
+
yield { type: "status", data: { message: "Database schema is up to date" } };
|
|
29051
|
+
if (ledger.length > 0 && !state?.schemaFingerprint) {
|
|
29052
|
+
const fingerprint2 = await cf.d1.fingerprintSchema(databaseId);
|
|
29053
|
+
await this.persistDeploymentState(game2.id, {
|
|
29054
|
+
schemaFingerprint: fingerprint2.fingerprint
|
|
29055
|
+
});
|
|
29056
|
+
return {
|
|
29057
|
+
...NO_DATABASE_WORK,
|
|
29058
|
+
schemaFingerprint: fingerprint2.fingerprint
|
|
29059
|
+
};
|
|
29060
|
+
}
|
|
29061
|
+
return {
|
|
29062
|
+
...NO_DATABASE_WORK,
|
|
29063
|
+
schemaFingerprint: state?.schemaFingerprint ?? null
|
|
29064
|
+
};
|
|
29065
|
+
}
|
|
29066
|
+
const capture = yield* this.captureBookmarkStep(databaseId);
|
|
29067
|
+
const migrationsByTag = new Map(migrations.map((migration) => [migration.tag, migration]));
|
|
29068
|
+
let appliedCount = 0;
|
|
29069
|
+
for (const tag of plan.pendingTags) {
|
|
29070
|
+
const migration = migrationsByTag.get(tag);
|
|
29071
|
+
const count = migration.statements.length;
|
|
29072
|
+
yield {
|
|
29073
|
+
type: "status",
|
|
29074
|
+
data: { message: `Applying ${tag} (${count} statement${count === 1 ? "" : "s"})` }
|
|
29075
|
+
};
|
|
29076
|
+
const startedAt = Date.now();
|
|
29077
|
+
try {
|
|
29078
|
+
await withSpan("deploy.apply_migration", () => cf.d1.applyMigration(databaseId, {
|
|
29079
|
+
tag,
|
|
29080
|
+
statements: migration.statements,
|
|
29081
|
+
checksum: migration.checksum,
|
|
29082
|
+
deployId,
|
|
29083
|
+
appliedBy: user.id
|
|
29084
|
+
}));
|
|
29085
|
+
} catch (error) {
|
|
29086
|
+
if (appliedCount > 0) {
|
|
29087
|
+
await this.recordAppliedPrefixFingerprint(game2.id, databaseId);
|
|
29088
|
+
}
|
|
29089
|
+
throw await this.toMigrationStepError(databaseId, error, migration);
|
|
29090
|
+
}
|
|
29091
|
+
appliedCount++;
|
|
29092
|
+
const seconds = ((Date.now() - startedAt) / 1000).toFixed(1);
|
|
29093
|
+
yield { type: "status", data: { message: `Applied ${tag} (${seconds}s)` } };
|
|
29094
|
+
}
|
|
29095
|
+
setAttribute("app.deploy.migrations_applied", plan.pendingTags.length);
|
|
29096
|
+
const fingerprint = await cf.d1.fingerprintSchema(databaseId);
|
|
29097
|
+
await this.persistDeploymentState(game2.id, {
|
|
29098
|
+
schemaFingerprint: fingerprint.fingerprint,
|
|
29099
|
+
schemaHash: null,
|
|
29100
|
+
schemaSnapshot: null
|
|
29101
|
+
});
|
|
29102
|
+
return {
|
|
29103
|
+
schemaHash: null,
|
|
29104
|
+
schemaFingerprint: fingerprint.fingerprint,
|
|
29105
|
+
timeTravelBookmark: capture?.bookmark ?? null,
|
|
29106
|
+
bookmarkCapturedAt: capture?.capturedAt ?? null
|
|
29107
|
+
};
|
|
29108
|
+
}
|
|
29109
|
+
async* runPushMode(args2) {
|
|
29110
|
+
const { game: game2, databaseId, payload, state } = args2;
|
|
29111
|
+
const cf = this.getCloudflare();
|
|
29112
|
+
yield { type: "status", data: { message: "Verifying database schema state" } };
|
|
29113
|
+
if (typeof payload.baselineHash !== "string" && payload.baselineHash !== null) {
|
|
29114
|
+
throw new ValidationError("Push deploys require baselineHash (null on first deploy)");
|
|
29115
|
+
}
|
|
29116
|
+
if (isMigrateManaged(state)) {
|
|
29117
|
+
const ledger = await cf.d1.readMigrationLedger(databaseId);
|
|
29118
|
+
throw new ValidationError(`This database is migrate-managed (${ledger.length} applied ` + "migration(s)) and does not accept push-mode SQL.", { code: DEPLOY_ERROR_CODES.strategyMismatch });
|
|
29119
|
+
}
|
|
29120
|
+
const storedHash = state?.schemaHash ?? null;
|
|
29121
|
+
if (payload.baselineHash !== storedHash) {
|
|
29122
|
+
throw await this.buildStateConflictError(game2.id, payload.baselineHash);
|
|
29123
|
+
}
|
|
29124
|
+
const statements = splitSqlStatements(payload.sql);
|
|
29125
|
+
const oversized = findOversizedStatement(statements);
|
|
29126
|
+
if (oversized) {
|
|
29127
|
+
throw new ValidationError(`Push statement ${oversized.index} is ${oversized.byteLength} bytes — over ` + `D1's ${D1_MAX_STATEMENT_BYTES / 1024} KB per-statement limit. Split the ` + "statement or reduce its size.", {
|
|
29128
|
+
code: DEPLOY_ERROR_CODES.pushFailed,
|
|
29129
|
+
statementIndex: oversized.index,
|
|
29130
|
+
offset: null
|
|
29131
|
+
});
|
|
29132
|
+
}
|
|
29133
|
+
const destructive = detectDestructiveStatements(statements);
|
|
29134
|
+
setAttributes({
|
|
29135
|
+
"app.deploy.push_statement_count": statements.length,
|
|
29136
|
+
"app.deploy.push_destructive_count": destructive.length,
|
|
29137
|
+
"app.deploy.push_accept_data_loss": Boolean(payload.acceptDataLoss)
|
|
29138
|
+
});
|
|
29139
|
+
if (destructive.length > 0 && !payload.acceptDataLoss) {
|
|
29140
|
+
throw new DestructiveSchemaError(destructive);
|
|
29141
|
+
}
|
|
29142
|
+
await this.assertNoSchemaDrift(databaseId, state);
|
|
29143
|
+
const reserved = await this.persistPushDeploymentState(game2.id, payload.baselineHash, {
|
|
29144
|
+
schemaFingerprint: PUSH_RESERVATION_FINGERPRINT,
|
|
29145
|
+
schemaHash: payload.nextHash,
|
|
29146
|
+
schemaSnapshot: payload.nextSnapshot
|
|
29147
|
+
});
|
|
29148
|
+
if (!reserved) {
|
|
29149
|
+
throw await this.buildStateConflictError(game2.id, payload.baselineHash);
|
|
29150
|
+
}
|
|
29151
|
+
let capture = null;
|
|
29152
|
+
if (statements.length > 0) {
|
|
29153
|
+
capture = yield* this.captureBookmarkStep(databaseId);
|
|
29154
|
+
yield {
|
|
29155
|
+
type: "status",
|
|
29156
|
+
data: {
|
|
29157
|
+
message: `Applying database schema changes (${statements.length} statements)`
|
|
29158
|
+
}
|
|
29159
|
+
};
|
|
29160
|
+
try {
|
|
29161
|
+
await cf.d1.batch(databaseId, [
|
|
29162
|
+
{ sql: "PRAGMA defer_foreign_keys = on" },
|
|
29163
|
+
...statements.map((statement) => ({ sql: statement })),
|
|
29164
|
+
{ sql: "PRAGMA defer_foreign_keys = off" }
|
|
29165
|
+
]);
|
|
29166
|
+
} catch (error) {
|
|
29167
|
+
await this.persistPushDeploymentState(game2.id, payload.nextHash, {
|
|
29168
|
+
schemaFingerprint: state?.schemaFingerprint ?? null,
|
|
29169
|
+
schemaHash: state?.schemaHash ?? null,
|
|
29170
|
+
schemaSnapshot: state?.schemaSnapshot ?? null
|
|
29171
|
+
});
|
|
29172
|
+
throw this.toPushStepError(error);
|
|
29173
|
+
}
|
|
29174
|
+
}
|
|
29175
|
+
const fingerprint = await cf.d1.fingerprintSchema(databaseId);
|
|
29176
|
+
await this.persistDeploymentState(game2.id, {
|
|
29177
|
+
schemaFingerprint: fingerprint.fingerprint
|
|
29178
|
+
});
|
|
29179
|
+
return {
|
|
29180
|
+
schemaHash: payload.nextHash,
|
|
29181
|
+
schemaFingerprint: fingerprint.fingerprint,
|
|
29182
|
+
timeTravelBookmark: capture?.bookmark ?? null,
|
|
29183
|
+
bookmarkCapturedAt: capture?.capturedAt ?? null
|
|
29184
|
+
};
|
|
29185
|
+
}
|
|
29186
|
+
async* captureBookmarkStep(databaseId) {
|
|
29187
|
+
const cf = this.getCloudflare();
|
|
29188
|
+
const bookmark = await cf.d1.captureBookmark(databaseId);
|
|
29189
|
+
const capturedAt = new Date;
|
|
29190
|
+
setAttribute("app.deploy.db_bookmark_captured", bookmark.captured);
|
|
29191
|
+
if (!bookmark.captured) {
|
|
29192
|
+
yield {
|
|
29193
|
+
type: "status",
|
|
29194
|
+
data: { message: `Time Travel bookmark unavailable (${bookmark.error})` }
|
|
29195
|
+
};
|
|
29196
|
+
return null;
|
|
29197
|
+
}
|
|
29198
|
+
yield {
|
|
29199
|
+
type: "status",
|
|
29200
|
+
data: {
|
|
29201
|
+
message: "Captured Time Travel bookmark",
|
|
29202
|
+
details: { bookmark: bookmark.bookmark }
|
|
29203
|
+
}
|
|
29204
|
+
};
|
|
29205
|
+
return { bookmark: bookmark.bookmark, capturedAt };
|
|
29206
|
+
}
|
|
29207
|
+
async toMigrationStepError(databaseId, error, migration) {
|
|
29208
|
+
if (error instanceof D1StatementTooLargeError) {
|
|
29209
|
+
return new ValidationError(error.message, {
|
|
29210
|
+
code: DEPLOY_ERROR_CODES.migrationFailed,
|
|
29211
|
+
tag: migration.tag,
|
|
29212
|
+
statementIndex: error.statementIndex,
|
|
29213
|
+
offset: null,
|
|
29214
|
+
d1Message: error.message
|
|
29215
|
+
});
|
|
29216
|
+
}
|
|
29217
|
+
if (error instanceof D1MigrationError) {
|
|
29218
|
+
addEvent("deploy.migration_failed", {
|
|
29219
|
+
"app.d1.migration_tag": migration.tag,
|
|
29220
|
+
"app.error.message": error.d1Message,
|
|
29221
|
+
...error.offset !== null && { "app.d1.error_offset": error.offset }
|
|
29222
|
+
});
|
|
29223
|
+
const alreadyApplied = isAlreadyExistsSqlError(error.d1Message) ? await this.assessAlreadyApplied(databaseId, migration.statements) : null;
|
|
29224
|
+
return new MigrationExecutionError({
|
|
29225
|
+
tag: migration.tag,
|
|
29226
|
+
d1Message: error.d1Message,
|
|
29227
|
+
offset: error.offset,
|
|
29228
|
+
...alreadyApplied ? { alreadyApplied } : {}
|
|
29229
|
+
});
|
|
29230
|
+
}
|
|
29231
|
+
return error;
|
|
29232
|
+
}
|
|
29233
|
+
async assessAlreadyApplied(databaseId, statements) {
|
|
29234
|
+
try {
|
|
29235
|
+
const cf = this.getCloudflare();
|
|
29236
|
+
const live = await cf.d1.fingerprintSchema(databaseId);
|
|
29237
|
+
const tables = await cf.d1.readTableColumns(databaseId, live.tables);
|
|
29238
|
+
const assessment = assessMigrationAlreadyApplied(statements, tables);
|
|
29239
|
+
addEvent("deploy.already_applied_assessment", {
|
|
29240
|
+
"app.deploy.already_applied_verdict": assessment.verdict,
|
|
29241
|
+
"app.deploy.already_applied_present": assessment.present.length,
|
|
29242
|
+
"app.deploy.already_applied_missing": assessment.missing.length
|
|
29243
|
+
});
|
|
29244
|
+
return assessment.verdict === "no-signal" ? null : assessment;
|
|
29245
|
+
} catch (assessError) {
|
|
29246
|
+
addEvent("deploy.already_applied_check_failed", {
|
|
29247
|
+
"app.error.message": errorMessage(assessError)
|
|
29248
|
+
});
|
|
29249
|
+
return null;
|
|
29250
|
+
}
|
|
29251
|
+
}
|
|
29252
|
+
toPushStepError(error) {
|
|
29253
|
+
if (error instanceof D1BatchError) {
|
|
29254
|
+
addEvent("deploy.push_failed", {
|
|
29255
|
+
"app.error.message": error.d1Message,
|
|
29256
|
+
...error.offset !== null && { "app.d1.error_offset": error.offset }
|
|
29257
|
+
});
|
|
29258
|
+
return new PushExecutionError({ d1Message: error.d1Message, offset: error.offset });
|
|
29259
|
+
}
|
|
29260
|
+
return error;
|
|
29261
|
+
}
|
|
29262
|
+
async assertNoSchemaDrift(databaseId, state) {
|
|
29263
|
+
if (!state?.schemaFingerprint) {
|
|
29264
|
+
return;
|
|
29265
|
+
}
|
|
29266
|
+
const live = await this.getCloudflare().d1.fingerprintSchema(databaseId);
|
|
29267
|
+
if (live.fingerprint !== state.schemaFingerprint) {
|
|
29268
|
+
addEvent("deploy.state_drift", {
|
|
29269
|
+
"app.deploy.expected_fingerprint": state.schemaFingerprint,
|
|
29270
|
+
"app.deploy.actual_fingerprint": live.fingerprint
|
|
29271
|
+
});
|
|
29272
|
+
throw new DeploymentStateDriftError({
|
|
29273
|
+
expectedFingerprint: state.schemaFingerprint,
|
|
29274
|
+
actualFingerprint: live.fingerprint
|
|
29275
|
+
});
|
|
29276
|
+
}
|
|
29277
|
+
}
|
|
29278
|
+
async buildStateConflictError(gameId, claimedHash) {
|
|
29279
|
+
const [row, lastDeploy] = await Promise.all([
|
|
29280
|
+
this.deps.db.query.gameDeploymentState.findFirst({
|
|
29281
|
+
where: eq(gameDeploymentState.gameId, gameId),
|
|
29282
|
+
columns: { schemaHash: true }
|
|
29283
|
+
}),
|
|
29284
|
+
findLastSuccessfulDeployWithEmail(this.deps.db, gameId)
|
|
29285
|
+
]);
|
|
29286
|
+
const currentHash = row?.schemaHash ?? null;
|
|
29287
|
+
addEvent("deploy.state_conflict", {
|
|
29288
|
+
"app.deploy.baseline_hash": claimedHash ?? "null",
|
|
29289
|
+
"app.deploy.current_hash": currentHash ?? "null"
|
|
29290
|
+
});
|
|
29291
|
+
return new DeploymentStateConflictError({
|
|
29292
|
+
currentHash,
|
|
29293
|
+
lastDeployAt: lastDeploy?.at.toISOString() ?? null,
|
|
29294
|
+
lastDeployBy: lastDeploy?.email ?? lastDeploy?.userId ?? null
|
|
29295
|
+
});
|
|
29296
|
+
}
|
|
29297
|
+
async recordAppliedPrefixFingerprint(gameId, databaseId) {
|
|
29298
|
+
try {
|
|
29299
|
+
const fingerprint = await this.getCloudflare().d1.fingerprintSchema(databaseId);
|
|
29300
|
+
await this.persistDeploymentState(gameId, {
|
|
29301
|
+
schemaFingerprint: fingerprint.fingerprint
|
|
29302
|
+
});
|
|
29303
|
+
} catch (error) {
|
|
29304
|
+
addEvent("deploy.fingerprint_persist_failed", {
|
|
29305
|
+
"exception.type": errorType(error),
|
|
29306
|
+
"app.error.message": errorMessage(error)
|
|
29307
|
+
});
|
|
29308
|
+
}
|
|
29309
|
+
}
|
|
29310
|
+
async persistDeploymentState(gameId, patch) {
|
|
29311
|
+
const set = {
|
|
29312
|
+
...patch,
|
|
29313
|
+
updatedAt: new Date
|
|
29314
|
+
};
|
|
29315
|
+
await this.deps.db.insert(gameDeploymentState).values({ gameId, baselineSource: "deploy", ...set }).onConflictDoUpdate({ target: gameDeploymentState.gameId, set });
|
|
29316
|
+
}
|
|
29317
|
+
async persistArtifactHashes(gameId, patch) {
|
|
29318
|
+
const set = {
|
|
29319
|
+
...patch.buildHash !== undefined && { buildHash: patch.buildHash },
|
|
29320
|
+
...patch.integrationsHash !== undefined && {
|
|
29321
|
+
integrationsHash: patch.integrationsHash
|
|
29322
|
+
}
|
|
29323
|
+
};
|
|
29324
|
+
if (Object.keys(set).length === 0) {
|
|
29325
|
+
return;
|
|
29326
|
+
}
|
|
29327
|
+
await this.deps.db.insert(gameDeploymentState).values({ gameId, ...set, updatedAt: new Date }).onConflictDoUpdate({
|
|
29328
|
+
target: gameDeploymentState.gameId,
|
|
29329
|
+
set: { ...set, updatedAt: new Date }
|
|
29330
|
+
});
|
|
29331
|
+
}
|
|
29332
|
+
async persistPushDeploymentState(gameId, baselineHash, patch) {
|
|
29333
|
+
const set = { ...patch, updatedAt: new Date };
|
|
29334
|
+
if (baselineHash === null) {
|
|
29335
|
+
const claimed2 = await this.deps.db.insert(gameDeploymentState).values({ gameId, baselineSource: "deploy", ...set }).onConflictDoUpdate({
|
|
29336
|
+
target: gameDeploymentState.gameId,
|
|
29337
|
+
set,
|
|
29338
|
+
setWhere: isNull(gameDeploymentState.schemaHash)
|
|
29339
|
+
}).returning({ gameId: gameDeploymentState.gameId });
|
|
29340
|
+
return claimed2.length > 0;
|
|
29341
|
+
}
|
|
29342
|
+
const claimed = await this.deps.db.update(gameDeploymentState).set(set).where(and(eq(gameDeploymentState.gameId, gameId), eq(gameDeploymentState.schemaHash, baselineHash))).returning({ gameId: gameDeploymentState.gameId });
|
|
29343
|
+
return claimed.length > 0;
|
|
29344
|
+
}
|
|
29345
|
+
async* adoptClientBaseline(context2) {
|
|
29346
|
+
const { game: game2, request, user, deploymentId, baseline } = context2;
|
|
29347
|
+
const cf = this.getCloudflare();
|
|
29348
|
+
const persistedId = context2.existingResources?.d1?.find((db2) => db2.name === deploymentId)?.id;
|
|
29349
|
+
const databaseId = persistedId ?? (hasBinding(request.bindings?.database) ? await cf.d1.create(deploymentId) : null);
|
|
29350
|
+
if (baseline.lastAppliedMigrationTag && !databaseId) {
|
|
29351
|
+
throw new ValidationError("Baseline claims applied migrations, but the deploy has no database binding");
|
|
29352
|
+
}
|
|
29353
|
+
const live = databaseId ? await cf.d1.fingerprintSchema(databaseId) : null;
|
|
29354
|
+
let recordedRows = 0;
|
|
29355
|
+
if (databaseId && baseline.lastAppliedMigrationTag) {
|
|
29356
|
+
if (live.tables.length === 0) {
|
|
29357
|
+
throw new BaselineDatabaseEmptyError;
|
|
29358
|
+
}
|
|
29359
|
+
const slice = sliceJournalToTag(baseline.journal ?? [], baseline.lastAppliedMigrationTag);
|
|
29360
|
+
if (!slice) {
|
|
29361
|
+
throw new ValidationError(`Baseline lastAppliedMigrationTag '${baseline.lastAppliedMigrationTag}' ` + "is not in the submitted journal");
|
|
29362
|
+
}
|
|
29363
|
+
if (baseline.evidence?.length) {
|
|
29364
|
+
const [tables, lastDeploy] = await Promise.all([
|
|
29365
|
+
cf.d1.readTableColumns(databaseId, live.tables),
|
|
29366
|
+
findLastSuccessfulDeploy(this.deps.db, game2.id)
|
|
29367
|
+
]);
|
|
29368
|
+
assertBaselineClaimValid({
|
|
29369
|
+
claimedTag: baseline.lastAppliedMigrationTag,
|
|
29370
|
+
evidence: baseline.evidence,
|
|
29371
|
+
tables,
|
|
29372
|
+
indexes: new Set(live.indexes),
|
|
29373
|
+
views: new Set(live.views),
|
|
29374
|
+
lastDeployAt: lastDeploy?.at ?? null,
|
|
29375
|
+
allowUnverified: false,
|
|
29376
|
+
source: "seed",
|
|
29377
|
+
gameId: game2.id,
|
|
29378
|
+
userId: user.id
|
|
29379
|
+
});
|
|
29380
|
+
}
|
|
29381
|
+
await cf.d1.ensureMigrationLedger(databaseId);
|
|
29382
|
+
const ledger = await cf.d1.readMigrationLedger(databaseId);
|
|
29383
|
+
const plan = planMigrations(slice, ledger.map((row) => ({
|
|
29384
|
+
tag: row.tag,
|
|
29385
|
+
checksum: row.checksum,
|
|
29386
|
+
checksumAlgo: row.checksum_algo
|
|
29387
|
+
})));
|
|
29388
|
+
if (plan.checksumMismatches.length > 0) {
|
|
29389
|
+
throw new MigrationChecksumMismatchError(plan.checksumMismatches);
|
|
29390
|
+
}
|
|
29391
|
+
if (plan.missingFromJournalTags.length > 0) {
|
|
29392
|
+
throw new MigrationJournalDivergenceError(plan.missingFromJournalTags);
|
|
29393
|
+
}
|
|
29394
|
+
if (plan.outOfOrderTags.length > 0) {
|
|
29395
|
+
throw new MigrationOrderError(plan.outOfOrderTags);
|
|
29396
|
+
}
|
|
29397
|
+
const checksumByTag = new Map(slice.map((entry) => [entry.tag, entry.checksum]));
|
|
29398
|
+
const rows = plan.pendingTags.map((tag) => ({
|
|
29399
|
+
tag,
|
|
29400
|
+
checksum: checksumByTag.get(tag)
|
|
29401
|
+
}));
|
|
29402
|
+
if (rows.length > 0) {
|
|
29403
|
+
await cf.d1.recordLedgerRows(databaseId, {
|
|
29404
|
+
rows,
|
|
29405
|
+
deployId: `baseline:${request.deployId ?? crypto.randomUUID()}`,
|
|
29406
|
+
appliedBy: user.id,
|
|
29407
|
+
source: "baseline"
|
|
29408
|
+
});
|
|
29409
|
+
}
|
|
29410
|
+
recordedRows = rows.length;
|
|
29411
|
+
}
|
|
29412
|
+
const fingerprint = live?.fingerprint ?? null;
|
|
29413
|
+
const set = {
|
|
29414
|
+
...baseline.schemaHash !== undefined && { schemaHash: baseline.schemaHash },
|
|
29415
|
+
...baseline.schemaSnapshot !== undefined && {
|
|
29416
|
+
schemaSnapshot: baseline.schemaSnapshot
|
|
29417
|
+
},
|
|
29418
|
+
...baseline.integrationsHash !== undefined && {
|
|
29419
|
+
integrationsHash: baseline.integrationsHash
|
|
29420
|
+
},
|
|
29421
|
+
...baseline.buildHash !== undefined && { buildHash: baseline.buildHash },
|
|
29422
|
+
...fingerprint !== null && { schemaFingerprint: fingerprint },
|
|
29423
|
+
baselineSource: "client-baseline",
|
|
29424
|
+
updatedAt: new Date
|
|
29425
|
+
};
|
|
29426
|
+
await this.deps.db.insert(gameDeploymentState).values({ gameId: game2.id, ...set }).onConflictDoUpdate({ target: gameDeploymentState.gameId, set });
|
|
29427
|
+
setAttributes({
|
|
29428
|
+
"app.deploy.baseline_adopted": true,
|
|
29429
|
+
"app.deploy.baseline_ledger_rows": recordedRows,
|
|
29430
|
+
"app.deploy.baseline_has_snapshot": baseline.schemaSnapshot !== undefined
|
|
29431
|
+
});
|
|
29432
|
+
yield {
|
|
29433
|
+
type: "status",
|
|
29434
|
+
data: {
|
|
29435
|
+
message: "Adopted deployment state from client baseline",
|
|
29436
|
+
details: {
|
|
29437
|
+
ledgerRows: recordedRows,
|
|
29438
|
+
...baseline.lastAppliedMigrationTag && {
|
|
29439
|
+
lastAppliedMigrationTag: baseline.lastAppliedMigrationTag
|
|
29440
|
+
}
|
|
29441
|
+
}
|
|
29442
|
+
}
|
|
29443
|
+
};
|
|
29444
|
+
return this.deps.db.query.gameDeploymentState.findFirst({
|
|
29445
|
+
where: eq(gameDeploymentState.gameId, game2.id)
|
|
29446
|
+
});
|
|
29447
|
+
}
|
|
27938
29448
|
async applyGameMetadata(gameId, request, hasFrontend, hasMetadata, deploymentUrl) {
|
|
27939
29449
|
const updates = { updatedAt: new Date };
|
|
27940
29450
|
if (hasFrontend) {
|
|
@@ -27960,7 +29470,8 @@ class DeployService {
|
|
|
27960
29470
|
result,
|
|
27961
29471
|
request,
|
|
27962
29472
|
user,
|
|
27963
|
-
flags: flags2
|
|
29473
|
+
flags: flags2,
|
|
29474
|
+
database
|
|
27964
29475
|
}) {
|
|
27965
29476
|
const { hasBackend, hasFrontend, hasMetadata } = flags2;
|
|
27966
29477
|
const db2 = this.deps.db;
|
|
@@ -27970,9 +29481,17 @@ class DeployService {
|
|
|
27970
29481
|
deploymentId: result.deploymentId,
|
|
27971
29482
|
url: result.url,
|
|
27972
29483
|
codeHash,
|
|
29484
|
+
schemaHash: database.schemaHash,
|
|
29485
|
+
schemaFingerprint: database.schemaFingerprint,
|
|
29486
|
+
timeTravelBookmark: database.timeTravelBookmark,
|
|
29487
|
+
bookmarkCapturedAt: database.bookmarkCapturedAt,
|
|
27973
29488
|
resources: result.resources,
|
|
27974
29489
|
target: "game"
|
|
27975
29490
|
});
|
|
29491
|
+
await this.persistArtifactHashes(game2.id, {
|
|
29492
|
+
buildHash: hasFrontend ? request.buildHash : undefined,
|
|
29493
|
+
integrationsHash: request.integrationsHash
|
|
29494
|
+
});
|
|
27976
29495
|
if (hasBackend) {
|
|
27977
29496
|
await withSpan("deploy.configure_worker_secrets", async () => {
|
|
27978
29497
|
await this.ensureWorkerApiKeyOnWorker(user, DeployService.gameWorkerKeySpec(slug), result.deploymentId);
|
|
@@ -28109,6 +29628,29 @@ class DeployService {
|
|
|
28109
29628
|
const cf = this.getCloudflare();
|
|
28110
29629
|
await cf.setSecrets(deploymentId, { QUEUE_INGRESS_SECRET: secret });
|
|
28111
29630
|
}
|
|
29631
|
+
async* pruneManagedSecretsStep(gameId, deploymentId, pruneSecrets) {
|
|
29632
|
+
const cf = this.getCloudflare();
|
|
29633
|
+
const keys = [...new Set(pruneSecrets)];
|
|
29634
|
+
yield {
|
|
29635
|
+
type: "status",
|
|
29636
|
+
data: {
|
|
29637
|
+
message: `Pruning ${keys.length} managed secret(s)`,
|
|
29638
|
+
details: { keys }
|
|
29639
|
+
}
|
|
29640
|
+
};
|
|
29641
|
+
await withSpan("deploy.prune_secrets", async () => {
|
|
29642
|
+
const existing = await cf.listSecrets(deploymentId);
|
|
29643
|
+
for (const key of keys) {
|
|
29644
|
+
const prefixedKey = `${SECRETS_PREFIX}${key}`;
|
|
29645
|
+
if (existing.includes(prefixedKey)) {
|
|
29646
|
+
await cf.deleteSecret(deploymentId, prefixedKey);
|
|
29647
|
+
}
|
|
29648
|
+
}
|
|
29649
|
+
const pruned = keys.reduce((expr, key) => sql`${expr} - ${key}::text`, sql`coalesce(${gameDeploymentState.secretsManifest}, '{}'::jsonb)`);
|
|
29650
|
+
await this.deps.db.update(gameDeploymentState).set({ secretsManifest: pruned, updatedAt: new Date }).where(eq(gameDeploymentState.gameId, gameId));
|
|
29651
|
+
});
|
|
29652
|
+
setAttribute("app.deploy.pruned_secret_count", keys.length);
|
|
29653
|
+
}
|
|
28112
29654
|
async ensureDashboardSessionSecret(deploymentId, existingSecrets, hasPriorDeployment) {
|
|
28113
29655
|
if (existingSecrets === null && hasPriorDeployment) {
|
|
28114
29656
|
setAttribute("app.deploy.session_secret_outcome", "check_failed_kept");
|
|
@@ -28182,13 +29724,13 @@ class DeployService {
|
|
|
28182
29724
|
return this.deps.config.baseUrl;
|
|
28183
29725
|
}
|
|
28184
29726
|
try {
|
|
28185
|
-
return await getTunnelUrl();
|
|
28186
|
-
} catch {
|
|
29727
|
+
return await getTunnelUrl(this.deps.config.baseUrl);
|
|
29728
|
+
} catch (error) {
|
|
28187
29729
|
setAttributes({
|
|
28188
29730
|
"app.deploy.tunnel_available": false,
|
|
28189
29731
|
"app.deploy.failure_kind": "local_tunnel_unavailable"
|
|
28190
29732
|
});
|
|
28191
|
-
throw new ValidationError(
|
|
29733
|
+
throw new ValidationError(errorMessage(error));
|
|
28192
29734
|
}
|
|
28193
29735
|
}
|
|
28194
29736
|
async deployToCloudflare(args2) {
|
|
@@ -28213,6 +29755,10 @@ class DeployService {
|
|
|
28213
29755
|
target: record.target,
|
|
28214
29756
|
url: record.url,
|
|
28215
29757
|
codeHash: record.codeHash,
|
|
29758
|
+
schemaHash: record.schemaHash ?? null,
|
|
29759
|
+
schemaFingerprint: record.schemaFingerprint ?? null,
|
|
29760
|
+
timeTravelBookmark: record.timeTravelBookmark ?? null,
|
|
29761
|
+
bookmarkCapturedAt: record.bookmarkCapturedAt ?? null,
|
|
28216
29762
|
resources: record.resources,
|
|
28217
29763
|
isActive: true
|
|
28218
29764
|
});
|
|
@@ -28222,8 +29768,10 @@ class DeployService {
|
|
|
28222
29768
|
await this.deps.alerts.notifyDeploymentFailure(failure).catch(catchAttrs("alerts.delivery", { "app.alerts.type": "deployment_failure" }));
|
|
28223
29769
|
}
|
|
28224
29770
|
}
|
|
29771
|
+
var PUSH_RESERVATION_FINGERPRINT = "reserved:push-in-flight", NO_DATABASE_WORK;
|
|
28225
29772
|
var init_deploy_service = __esm(() => {
|
|
28226
29773
|
init_drizzle_orm();
|
|
29774
|
+
init_src4();
|
|
28227
29775
|
init_playcademy();
|
|
28228
29776
|
init_src();
|
|
28229
29777
|
init_helpers_index();
|
|
@@ -28231,9 +29779,17 @@ var init_deploy_service = __esm(() => {
|
|
|
28231
29779
|
init_spans();
|
|
28232
29780
|
init_tunnel();
|
|
28233
29781
|
init_errors();
|
|
29782
|
+
init_baseline_validation_util();
|
|
28234
29783
|
init_dashboard_util();
|
|
28235
29784
|
init_deployment_util();
|
|
29785
|
+
init_migration_util();
|
|
28236
29786
|
init_worker_keys_util();
|
|
29787
|
+
NO_DATABASE_WORK = {
|
|
29788
|
+
schemaHash: null,
|
|
29789
|
+
schemaFingerprint: null,
|
|
29790
|
+
timeTravelBookmark: null,
|
|
29791
|
+
bookmarkCapturedAt: null
|
|
29792
|
+
};
|
|
28237
29793
|
});
|
|
28238
29794
|
|
|
28239
29795
|
// ../api-core/src/services/developer.service.ts
|
|
@@ -29687,7 +31243,7 @@ function createGameServices(deps) {
|
|
|
29687
31243
|
}
|
|
29688
31244
|
};
|
|
29689
31245
|
}
|
|
29690
|
-
var
|
|
31246
|
+
var init_game3 = __esm(() => {
|
|
29691
31247
|
init_dashboard_service();
|
|
29692
31248
|
init_deploy_job_service();
|
|
29693
31249
|
init_deploy_service();
|
|
@@ -29886,16 +31442,37 @@ class AlertsService {
|
|
|
29886
31442
|
await this.sendAlert(discord, embed.build());
|
|
29887
31443
|
}
|
|
29888
31444
|
async notifyDeploymentFailure(failure) {
|
|
29889
|
-
const
|
|
31445
|
+
const refused = DEPLOY_REFUSAL_CODES.has(failure.errorCode ?? "");
|
|
31446
|
+
const discord = this.recordAlert(refused ? "deployment_blocked" : "deployment_failure");
|
|
29890
31447
|
if (!discord) {
|
|
29891
31448
|
return;
|
|
29892
31449
|
}
|
|
29893
|
-
const [
|
|
29894
|
-
const
|
|
31450
|
+
const [noun, subject] = failure.target === "dashboard" ? ["Dashboard Deployment", "Dashboard deployment"] : ["Deployment", "Deployment"];
|
|
31451
|
+
const title = refused ? `\uD83D\uDEA7 ${noun} Blocked` : `❌ ${noun} Failed`;
|
|
31452
|
+
const verb = refused ? "was blocked" : "failed";
|
|
31453
|
+
const embed = new DiscordEmbedBuilder().setTitle(title).setDescription(`${subject} ${verb} for **${failure.displayName || failure.slug}** (**${this.getEnvironment()}**).`).setColor(refused ? DiscordColors.YELLOW : DiscordColors.RED).addField("Slug", failure.slug, true);
|
|
29895
31454
|
if (failure.developer) {
|
|
29896
31455
|
embed.addField("Developer", failure.developer.email || failure.developer.id, true);
|
|
29897
31456
|
}
|
|
29898
|
-
embed.addField("Error", failure.error, false)
|
|
31457
|
+
embed.addField(refused ? "Reason" : "Error", failure.error, false);
|
|
31458
|
+
if (refused) {
|
|
31459
|
+
embed.addField("Next step", "The developer received repair guidance in their terminal", false);
|
|
31460
|
+
}
|
|
31461
|
+
embed.setFooter("Playcademy Developer Platform").setTimestamp();
|
|
31462
|
+
await this.sendAlert(discord, embed.build());
|
|
31463
|
+
}
|
|
31464
|
+
async notifyDeployBlocked(blocked) {
|
|
31465
|
+
const discord = this.recordAlert("deployment_blocked");
|
|
31466
|
+
if (!discord) {
|
|
31467
|
+
return;
|
|
31468
|
+
}
|
|
31469
|
+
const embed = new DiscordEmbedBuilder().setTitle("\uD83D\uDEA7 Deployment Blocked").setDescription(`Deployment was blocked for **${blocked.displayName || blocked.slug}** (**${this.getEnvironment()}**).`).setColor(DiscordColors.YELLOW).addField("Slug", blocked.slug, true);
|
|
31470
|
+
if (blocked.developer) {
|
|
31471
|
+
embed.addField("Developer", blocked.developer.email || blocked.developer.id, true);
|
|
31472
|
+
}
|
|
31473
|
+
embed.addField("Reason", blocked.reason, false);
|
|
31474
|
+
embed.addField("Next step", "The developer received repair guidance in their terminal", false);
|
|
31475
|
+
embed.setFooter("Playcademy Developer Platform").setTimestamp();
|
|
29899
31476
|
await this.sendAlert(discord, embed.build());
|
|
29900
31477
|
}
|
|
29901
31478
|
async notifyGameDeletion(game2) {
|
|
@@ -29956,6 +31533,7 @@ var DISCORD_FIELD_LIMIT = 1024;
|
|
|
29956
31533
|
var init_alerts_service = __esm(() => {
|
|
29957
31534
|
init_discord();
|
|
29958
31535
|
init_spans();
|
|
31536
|
+
init_game2();
|
|
29959
31537
|
});
|
|
29960
31538
|
|
|
29961
31539
|
// ../api-core/src/services/kv-backup.service.ts
|
|
@@ -30388,6 +31966,15 @@ class DatabaseService {
|
|
|
30388
31966
|
constructor(deps) {
|
|
30389
31967
|
this.deps = deps;
|
|
30390
31968
|
}
|
|
31969
|
+
static remapD1Resource(resources, d1ResourceName, databaseId) {
|
|
31970
|
+
return {
|
|
31971
|
+
resources: {
|
|
31972
|
+
...resources,
|
|
31973
|
+
d1: resources.d1?.map((dbResource) => dbResource.name === d1ResourceName ? { ...dbResource, id: databaseId } : dbResource)
|
|
31974
|
+
},
|
|
31975
|
+
timeTravelBookmark: null
|
|
31976
|
+
};
|
|
31977
|
+
}
|
|
30391
31978
|
getD1() {
|
|
30392
31979
|
const d1 = this.deps.cloudflare?.d1;
|
|
30393
31980
|
if (!d1) {
|
|
@@ -30406,11 +31993,7 @@ class DatabaseService {
|
|
|
30406
31993
|
try {
|
|
30407
31994
|
await this.deps.cloudflare.updateD1Binding(dashboardDeployment.deploymentId, databaseId);
|
|
30408
31995
|
if (dashboardDeployment.resources?.d1?.length) {
|
|
30409
|
-
|
|
30410
|
-
...dashboardDeployment.resources,
|
|
30411
|
-
d1: dashboardDeployment.resources.d1.map((dbResource) => dbResource.name === d1ResourceName ? { ...dbResource, id: databaseId } : dbResource)
|
|
30412
|
-
};
|
|
30413
|
-
await this.deps.db.update(gameDeployments).set({ resources: updatedResources }).where(eq(gameDeployments.id, dashboardDeployment.id));
|
|
31996
|
+
await this.deps.db.update(gameDeployments).set(DatabaseService.remapD1Resource(dashboardDeployment.resources, d1ResourceName, databaseId)).where(eq(gameDeployments.id, dashboardDeployment.id));
|
|
30414
31997
|
}
|
|
30415
31998
|
setAttribute("app.database.dashboard_binding", "updated");
|
|
30416
31999
|
} catch (error) {
|
|
@@ -30421,20 +32004,36 @@ class DatabaseService {
|
|
|
30421
32004
|
});
|
|
30422
32005
|
}
|
|
30423
32006
|
}
|
|
30424
|
-
async reset(slug, user,
|
|
32007
|
+
async reset(slug, user, request = {}) {
|
|
32008
|
+
const { schema: schema2, database } = request;
|
|
30425
32009
|
setAttributes({
|
|
30426
32010
|
"app.database.operation": "reset",
|
|
32011
|
+
"app.database.mode": database?.mode ?? (schema2 ? "legacy" : "none"),
|
|
30427
32012
|
"app.database.schema_size": schema2?.sql.length,
|
|
30428
32013
|
"app.database.schema_version": schema2?.hash
|
|
30429
32014
|
});
|
|
30430
32015
|
const d1 = this.getD1();
|
|
30431
32016
|
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32017
|
+
const state = await this.deps.db.query.gameDeploymentState.findFirst({
|
|
32018
|
+
where: eq(gameDeploymentState.gameId, game2.id)
|
|
32019
|
+
});
|
|
32020
|
+
if (isSchemaAdopted(state) && !database) {
|
|
32021
|
+
if (schema2) {
|
|
32022
|
+
throw new LegacySchemaUpgradeRequiredError;
|
|
32023
|
+
}
|
|
32024
|
+
throw new ValidationError("This game's database state is server-managed: resetting it requires " + "the mode-aware rebuild payload so the recorded state matches the " + "new database. Run the reset through the Playcademy CLI.");
|
|
32025
|
+
}
|
|
30432
32026
|
const deploymentId = getGameDeploymentId(slug, this.deps.config.sstStage);
|
|
32027
|
+
let resetDatabaseId = null;
|
|
30433
32028
|
try {
|
|
30434
32029
|
const databaseId = await d1.reset(deploymentId);
|
|
32030
|
+
resetDatabaseId = databaseId;
|
|
30435
32031
|
setAttribute("app.database.id", databaseId);
|
|
30436
32032
|
let schemaPushed = false;
|
|
30437
|
-
if (
|
|
32033
|
+
if (database) {
|
|
32034
|
+
await this.rebuildDatabase(databaseId, database, game2.id, user);
|
|
32035
|
+
schemaPushed = true;
|
|
32036
|
+
} else if (schema2?.sql) {
|
|
30438
32037
|
await d1.executeSchema(databaseId, schema2);
|
|
30439
32038
|
schemaPushed = true;
|
|
30440
32039
|
}
|
|
@@ -30450,11 +32049,7 @@ class DatabaseService {
|
|
|
30450
32049
|
});
|
|
30451
32050
|
setAttribute("app.database.active_deployment_found", Boolean(activeDeployment));
|
|
30452
32051
|
if (activeDeployment?.resources?.d1?.length) {
|
|
30453
|
-
|
|
30454
|
-
...activeDeployment.resources,
|
|
30455
|
-
d1: activeDeployment.resources.d1.map((dbResource) => dbResource.name === deploymentId ? { ...dbResource, id: databaseId } : dbResource)
|
|
30456
|
-
};
|
|
30457
|
-
await this.deps.db.update(gameDeployments).set({ resources: updatedResources }).where(eq(gameDeployments.id, activeDeployment.id));
|
|
32052
|
+
await this.deps.db.update(gameDeployments).set(DatabaseService.remapD1Resource(activeDeployment.resources, deploymentId, databaseId)).where(eq(gameDeployments.id, activeDeployment.id));
|
|
30458
32053
|
}
|
|
30459
32054
|
await this.syncDashboardD1Binding(game2.id, deploymentId, databaseId);
|
|
30460
32055
|
setAttributes({
|
|
@@ -30468,18 +32063,81 @@ class DatabaseService {
|
|
|
30468
32063
|
schemaPushed
|
|
30469
32064
|
};
|
|
30470
32065
|
} catch (error) {
|
|
32066
|
+
if (database && resetDatabaseId) {
|
|
32067
|
+
await this.recordLiveFingerprint(game2.id, resetDatabaseId);
|
|
32068
|
+
}
|
|
30471
32069
|
this.deps.alerts.notifyDatabaseResetFailure({
|
|
30472
32070
|
slug,
|
|
30473
32071
|
displayName: game2.displayName,
|
|
30474
32072
|
error: errorMessage(error),
|
|
30475
32073
|
developer: { id: user.id, email: user.email }
|
|
30476
32074
|
}).catch(catchAttrs("alerts.delivery", { "app.alerts.type": "database_reset" }));
|
|
32075
|
+
if (error instanceof DomainError) {
|
|
32076
|
+
throw error;
|
|
32077
|
+
}
|
|
30477
32078
|
throw new ValidationError(`Database reset failed: ${errorMessage(error)}`);
|
|
30478
32079
|
}
|
|
30479
32080
|
}
|
|
32081
|
+
async rebuildDatabase(databaseId, payload, gameId, user) {
|
|
32082
|
+
const d1 = this.getD1();
|
|
32083
|
+
if (payload.mode === "migrate") {
|
|
32084
|
+
const deployId = `reset:${crypto.randomUUID()}`;
|
|
32085
|
+
await d1.ensureMigrationLedger(databaseId);
|
|
32086
|
+
for (const migration of payload.migrations) {
|
|
32087
|
+
await d1.applyMigration(databaseId, {
|
|
32088
|
+
tag: migration.tag,
|
|
32089
|
+
statements: migration.statements,
|
|
32090
|
+
checksum: migration.checksum,
|
|
32091
|
+
deployId,
|
|
32092
|
+
appliedBy: user.id
|
|
32093
|
+
});
|
|
32094
|
+
}
|
|
32095
|
+
setAttribute("app.database.migrations_replayed", payload.migrations.length);
|
|
32096
|
+
const fingerprint2 = await d1.fingerprintSchema(databaseId);
|
|
32097
|
+
await this.persistDeploymentState(gameId, {
|
|
32098
|
+
schemaFingerprint: fingerprint2.fingerprint,
|
|
32099
|
+
schemaHash: null,
|
|
32100
|
+
schemaSnapshot: null
|
|
32101
|
+
});
|
|
32102
|
+
return;
|
|
32103
|
+
}
|
|
32104
|
+
const statements = splitSqlStatements(payload.sql);
|
|
32105
|
+
if (statements.length > 0) {
|
|
32106
|
+
await d1.batch(databaseId, [
|
|
32107
|
+
{ sql: "PRAGMA defer_foreign_keys = on" },
|
|
32108
|
+
...statements.map((statement) => ({ sql: statement })),
|
|
32109
|
+
{ sql: "PRAGMA defer_foreign_keys = off" }
|
|
32110
|
+
]);
|
|
32111
|
+
}
|
|
32112
|
+
setAttribute("app.database.push_statement_count", statements.length);
|
|
32113
|
+
const fingerprint = await d1.fingerprintSchema(databaseId);
|
|
32114
|
+
await this.persistDeploymentState(gameId, {
|
|
32115
|
+
schemaFingerprint: fingerprint.fingerprint,
|
|
32116
|
+
schemaHash: payload.nextHash,
|
|
32117
|
+
schemaSnapshot: payload.nextSnapshot
|
|
32118
|
+
});
|
|
32119
|
+
}
|
|
32120
|
+
async persistDeploymentState(gameId, patch) {
|
|
32121
|
+
const set = { ...patch, updatedAt: new Date };
|
|
32122
|
+
await this.deps.db.insert(gameDeploymentState).values({ gameId, baselineSource: "deploy", ...set }).onConflictDoUpdate({ target: gameDeploymentState.gameId, set });
|
|
32123
|
+
}
|
|
32124
|
+
async recordLiveFingerprint(gameId, databaseId) {
|
|
32125
|
+
try {
|
|
32126
|
+
const fingerprint = await this.getD1().fingerprintSchema(databaseId);
|
|
32127
|
+
await this.persistDeploymentState(gameId, {
|
|
32128
|
+
schemaFingerprint: fingerprint.fingerprint
|
|
32129
|
+
});
|
|
32130
|
+
} catch (error) {
|
|
32131
|
+
addEvent("database.fingerprint_persist_failed", {
|
|
32132
|
+
"exception.type": errorType(error),
|
|
32133
|
+
"app.error.message": errorMessage(error)
|
|
32134
|
+
});
|
|
32135
|
+
}
|
|
32136
|
+
}
|
|
30480
32137
|
}
|
|
30481
32138
|
var init_database_service = __esm(() => {
|
|
30482
32139
|
init_drizzle_orm();
|
|
32140
|
+
init_src4();
|
|
30483
32141
|
init_helpers_index();
|
|
30484
32142
|
init_tables_index();
|
|
30485
32143
|
init_spans();
|
|
@@ -30487,6 +32145,527 @@ var init_database_service = __esm(() => {
|
|
|
30487
32145
|
init_deployment_util();
|
|
30488
32146
|
});
|
|
30489
32147
|
|
|
32148
|
+
// ../api-core/src/utils/secrets.util.ts
|
|
32149
|
+
async function listUserSecretKeys(cloudflare2, deploymentId) {
|
|
32150
|
+
try {
|
|
32151
|
+
const allKeys = await cloudflare2.listSecrets(deploymentId);
|
|
32152
|
+
return allKeys.filter((key) => key.startsWith(SECRETS_PREFIX)).map((key) => key.slice(SECRETS_PREFIX.length));
|
|
32153
|
+
} catch (error) {
|
|
32154
|
+
const message = errorMessage(error);
|
|
32155
|
+
if (message.includes("not found") || message.includes("10007")) {
|
|
32156
|
+
return null;
|
|
32157
|
+
}
|
|
32158
|
+
throw error;
|
|
32159
|
+
}
|
|
32160
|
+
}
|
|
32161
|
+
var init_secrets_util = __esm(() => {
|
|
32162
|
+
init_src();
|
|
32163
|
+
});
|
|
32164
|
+
|
|
32165
|
+
// ../api-core/src/services/deployment-state.service.ts
|
|
32166
|
+
function historyEventEntry(event) {
|
|
32167
|
+
const base = { at: event.createdAt.toISOString(), by: event.email ?? DELETED_ACCOUNT_LABEL };
|
|
32168
|
+
if (event.kind === "restore" && "restoredTo" in event.payload) {
|
|
32169
|
+
return [{ kind: "restore", ...base, restoredTo: event.payload.restoredTo }];
|
|
32170
|
+
}
|
|
32171
|
+
if (event.kind === "blocked" && "code" in event.payload) {
|
|
32172
|
+
return [
|
|
32173
|
+
{ kind: "blocked", ...base, code: event.payload.code, reason: event.payload.reason }
|
|
32174
|
+
];
|
|
32175
|
+
}
|
|
32176
|
+
return [];
|
|
32177
|
+
}
|
|
32178
|
+
function databaseIdFromResources(resources, deploymentId) {
|
|
32179
|
+
const database = resources?.d1?.find((db2) => db2.name === deploymentId) ?? resources?.d1?.[0];
|
|
32180
|
+
return database?.id ?? null;
|
|
32181
|
+
}
|
|
32182
|
+
function restorePointCapturedAt(row) {
|
|
32183
|
+
return row.bookmarkCapturedAt ?? row.deployedAt;
|
|
32184
|
+
}
|
|
32185
|
+
|
|
32186
|
+
class DeploymentStateService {
|
|
32187
|
+
deps;
|
|
32188
|
+
constructor(deps) {
|
|
32189
|
+
this.deps = deps;
|
|
32190
|
+
}
|
|
32191
|
+
async partitionSecretKeys(slug, manifest) {
|
|
32192
|
+
const managedKeys = Object.keys(manifest ?? {});
|
|
32193
|
+
if (!this.deps.cloudflare) {
|
|
32194
|
+
addEvent("deployment_state.secret_keys_unavailable", {
|
|
32195
|
+
"app.error.message": "Cloudflare provider not configured"
|
|
32196
|
+
});
|
|
32197
|
+
return { managedKeys, unmanagedKeys: null };
|
|
32198
|
+
}
|
|
32199
|
+
const deploymentId = getGameDeploymentId(slug, this.deps.config.sstStage);
|
|
32200
|
+
const remoteKeys = await listUserSecretKeys(this.deps.cloudflare, deploymentId);
|
|
32201
|
+
if (remoteKeys === null) {
|
|
32202
|
+
return { managedKeys, unmanagedKeys: [] };
|
|
32203
|
+
}
|
|
32204
|
+
const managed = new Set(managedKeys);
|
|
32205
|
+
return {
|
|
32206
|
+
managedKeys,
|
|
32207
|
+
unmanagedKeys: remoteKeys.filter((key) => !managed.has(key))
|
|
32208
|
+
};
|
|
32209
|
+
}
|
|
32210
|
+
async readAppliedMigrations(slug, resources) {
|
|
32211
|
+
if (!this.deps.cloudflare || !resources?.d1?.length) {
|
|
32212
|
+
return null;
|
|
32213
|
+
}
|
|
32214
|
+
const deploymentId = getGameDeploymentId(slug, this.deps.config.sstStage);
|
|
32215
|
+
const databaseId = databaseIdFromResources(resources, deploymentId);
|
|
32216
|
+
if (!databaseId) {
|
|
32217
|
+
return null;
|
|
32218
|
+
}
|
|
32219
|
+
const ledger = await this.deps.cloudflare.d1.readMigrationLedger(databaseId);
|
|
32220
|
+
setAttributes({ "app.deployment_state.applied_migrations": ledger.length });
|
|
32221
|
+
return ledger.map((row) => ({
|
|
32222
|
+
tag: row.tag,
|
|
32223
|
+
checksum: row.checksum,
|
|
32224
|
+
checksumAlgo: row.checksum_algo
|
|
32225
|
+
}));
|
|
32226
|
+
}
|
|
32227
|
+
async get(slug, user, options = {}) {
|
|
32228
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32229
|
+
const [state, gameDeployment, dashboardDeployment, lastSucceededJob, lastFailedJob] = await Promise.all([
|
|
32230
|
+
this.deps.db.query.gameDeploymentState.findFirst({
|
|
32231
|
+
where: eq(gameDeploymentState.gameId, game2.id)
|
|
32232
|
+
}),
|
|
32233
|
+
this.deps.db.query.gameDeployments.findFirst({
|
|
32234
|
+
where: activeDeploymentWhere(game2.id, "game"),
|
|
32235
|
+
columns: { codeHash: true, url: true, deployedAt: true, resources: true }
|
|
32236
|
+
}),
|
|
32237
|
+
this.deps.db.query.gameDeployments.findFirst({
|
|
32238
|
+
where: activeDeploymentWhere(game2.id, "dashboard"),
|
|
32239
|
+
columns: { url: true, deployedAt: true }
|
|
32240
|
+
}),
|
|
32241
|
+
findLastSuccessfulDeployWithEmail(this.deps.db, game2.id),
|
|
32242
|
+
this.deps.db.query.gameDeployJobs.findFirst({
|
|
32243
|
+
where: and(eq(gameDeployJobs.gameId, game2.id), eq(gameDeployJobs.status, "failed")),
|
|
32244
|
+
orderBy: desc(deployJobInstant()),
|
|
32245
|
+
columns: { events: true }
|
|
32246
|
+
})
|
|
32247
|
+
]);
|
|
32248
|
+
const [secrets, appliedMigrations] = await Promise.all([
|
|
32249
|
+
this.partitionSecretKeys(slug, state?.secretsManifest ?? null),
|
|
32250
|
+
this.readAppliedMigrations(slug, gameDeployment?.resources ?? null)
|
|
32251
|
+
]);
|
|
32252
|
+
setAttributes({
|
|
32253
|
+
"app.deployment_state.seeded": Boolean(state),
|
|
32254
|
+
"app.deployment_state.game_deployed": Boolean(gameDeployment),
|
|
32255
|
+
"app.deployment_state.dashboard_deployed": Boolean(dashboardDeployment)
|
|
32256
|
+
});
|
|
32257
|
+
return {
|
|
32258
|
+
gameId: game2.id,
|
|
32259
|
+
seeded: Boolean(state),
|
|
32260
|
+
game: gameDeployment ? {
|
|
32261
|
+
codeHash: gameDeployment.codeHash,
|
|
32262
|
+
buildHash: state?.buildHash ?? null,
|
|
32263
|
+
url: gameDeployment.url,
|
|
32264
|
+
deployedAt: gameDeployment.deployedAt.toISOString()
|
|
32265
|
+
} : null,
|
|
32266
|
+
dashboard: dashboardDeployment ? {
|
|
32267
|
+
url: dashboardDeployment.url,
|
|
32268
|
+
deployedAt: dashboardDeployment.deployedAt.toISOString()
|
|
32269
|
+
} : null,
|
|
32270
|
+
database: {
|
|
32271
|
+
appliedMigrations,
|
|
32272
|
+
lastFailure: parseMigrationFailure(lastFailedJob?.events ?? null),
|
|
32273
|
+
schemaHash: state?.schemaHash ?? null,
|
|
32274
|
+
schemaFingerprint: state?.schemaFingerprint ?? null,
|
|
32275
|
+
...options.includeSchemaSnapshot && {
|
|
32276
|
+
schemaSnapshot: state?.schemaSnapshot ?? null
|
|
32277
|
+
}
|
|
32278
|
+
},
|
|
32279
|
+
secrets,
|
|
32280
|
+
integrationsHash: state?.integrationsHash ?? null,
|
|
32281
|
+
compatibilityDate: state?.compatibilityDate ?? null,
|
|
32282
|
+
lastDeploy: lastSucceededJob ? {
|
|
32283
|
+
at: lastSucceededJob.at.toISOString(),
|
|
32284
|
+
by: lastSucceededJob.email ?? DELETED_ACCOUNT_LABEL
|
|
32285
|
+
} : null
|
|
32286
|
+
};
|
|
32287
|
+
}
|
|
32288
|
+
requireCloudflare() {
|
|
32289
|
+
if (!this.deps.cloudflare) {
|
|
32290
|
+
throw new ValidationError("Deployment-state operations are not available in this environment");
|
|
32291
|
+
}
|
|
32292
|
+
return this.deps.cloudflare;
|
|
32293
|
+
}
|
|
32294
|
+
async resolveDatabaseId(slug, gameId) {
|
|
32295
|
+
const databaseId = await this.findDatabaseId(slug, gameId);
|
|
32296
|
+
if (!databaseId) {
|
|
32297
|
+
throw new ValidationError("Game has no deployed database — deploy with a database binding first");
|
|
32298
|
+
}
|
|
32299
|
+
return databaseId;
|
|
32300
|
+
}
|
|
32301
|
+
findSchemaHashState(gameId) {
|
|
32302
|
+
return this.deps.db.query.gameDeploymentState.findFirst({
|
|
32303
|
+
where: eq(gameDeploymentState.gameId, gameId),
|
|
32304
|
+
columns: { schemaHash: true }
|
|
32305
|
+
});
|
|
32306
|
+
}
|
|
32307
|
+
async findDatabaseId(slug, gameId) {
|
|
32308
|
+
const deployment = await this.deps.db.query.gameDeployments.findFirst({
|
|
32309
|
+
where: activeDeploymentWhere(gameId, "game"),
|
|
32310
|
+
columns: { resources: true }
|
|
32311
|
+
});
|
|
32312
|
+
return databaseIdFromResources(deployment?.resources, getGameDeploymentId(slug, this.deps.config.sstStage));
|
|
32313
|
+
}
|
|
32314
|
+
async baseline(slug, input, user) {
|
|
32315
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32316
|
+
const cf = this.requireCloudflare();
|
|
32317
|
+
const state = await this.deps.db.query.gameDeploymentState.findFirst({
|
|
32318
|
+
where: eq(gameDeploymentState.gameId, game2.id)
|
|
32319
|
+
});
|
|
32320
|
+
const schemaAdopted = isSchemaAdopted(state);
|
|
32321
|
+
const migrateOnlyClaim = Boolean(input.lastAppliedMigrationTag) && input.schemaHash === undefined && input.schemaSnapshot === undefined;
|
|
32322
|
+
if (schemaAdopted && !migrateOnlyClaim) {
|
|
32323
|
+
throw new BaselineAlreadyAdoptedError(state?.baselineSource ?? null);
|
|
32324
|
+
}
|
|
32325
|
+
const databaseId = await this.resolveDatabaseId(slug, game2.id);
|
|
32326
|
+
const [ledger, live] = await Promise.all([
|
|
32327
|
+
cf.d1.readMigrationLedger(databaseId),
|
|
32328
|
+
cf.d1.fingerprintSchema(databaseId)
|
|
32329
|
+
]);
|
|
32330
|
+
const verdict = evaluateBaselineGuardrails({
|
|
32331
|
+
ledgerTags: ledger.map((row) => row.tag),
|
|
32332
|
+
liveTables: live.tables
|
|
32333
|
+
});
|
|
32334
|
+
if (verdict === "ledger-not-empty") {
|
|
32335
|
+
throw new BaselineLedgerNotEmptyError(ledger.map((row) => row.tag));
|
|
32336
|
+
}
|
|
32337
|
+
if (verdict === "database-empty") {
|
|
32338
|
+
throw new BaselineDatabaseEmptyError;
|
|
32339
|
+
}
|
|
32340
|
+
if (schemaAdopted && state?.schemaFingerprint && live.fingerprint !== state.schemaFingerprint) {
|
|
32341
|
+
throw new DeploymentStateDriftError({
|
|
32342
|
+
expectedFingerprint: state.schemaFingerprint,
|
|
32343
|
+
actualFingerprint: live.fingerprint
|
|
32344
|
+
});
|
|
32345
|
+
}
|
|
32346
|
+
if (input.lastAppliedMigrationTag && input.evidence?.length) {
|
|
32347
|
+
const [tables, lastDeploy] = await Promise.all([
|
|
32348
|
+
cf.d1.readTableColumns(databaseId, live.tables),
|
|
32349
|
+
findLastSuccessfulDeploy(this.deps.db, game2.id)
|
|
32350
|
+
]);
|
|
32351
|
+
assertBaselineClaimValid({
|
|
32352
|
+
claimedTag: input.lastAppliedMigrationTag,
|
|
32353
|
+
evidence: input.evidence,
|
|
32354
|
+
tables,
|
|
32355
|
+
indexes: new Set(live.indexes),
|
|
32356
|
+
views: new Set(live.views),
|
|
32357
|
+
lastDeployAt: lastDeploy?.at ?? null,
|
|
32358
|
+
allowUnverified: Boolean(input.allowUnverified),
|
|
32359
|
+
source: "manual",
|
|
32360
|
+
gameId: game2.id,
|
|
32361
|
+
userId: user.id
|
|
32362
|
+
});
|
|
32363
|
+
}
|
|
32364
|
+
let recordedTags = [];
|
|
32365
|
+
if (input.lastAppliedMigrationTag) {
|
|
32366
|
+
const slice = sliceJournalToTag(input.journal ?? [], input.lastAppliedMigrationTag);
|
|
32367
|
+
if (!slice) {
|
|
32368
|
+
throw new ValidationError(`lastAppliedMigrationTag '${input.lastAppliedMigrationTag}' is not in the ` + "submitted journal");
|
|
32369
|
+
}
|
|
32370
|
+
await cf.d1.ensureMigrationLedger(databaseId);
|
|
32371
|
+
await cf.d1.recordLedgerRows(databaseId, {
|
|
32372
|
+
rows: slice,
|
|
32373
|
+
deployId: `baseline:${crypto.randomUUID()}`,
|
|
32374
|
+
appliedBy: user.id,
|
|
32375
|
+
source: "baseline"
|
|
32376
|
+
});
|
|
32377
|
+
recordedTags = slice.map((entry) => entry.tag);
|
|
32378
|
+
}
|
|
32379
|
+
const graduating = migrateOnlyClaim && isPushAdopted(state);
|
|
32380
|
+
const set = {
|
|
32381
|
+
...graduating ? { schemaHash: null, schemaSnapshot: null } : {
|
|
32382
|
+
...input.schemaHash !== undefined && { schemaHash: input.schemaHash },
|
|
32383
|
+
...input.schemaSnapshot !== undefined && {
|
|
32384
|
+
schemaSnapshot: input.schemaSnapshot
|
|
32385
|
+
}
|
|
32386
|
+
},
|
|
32387
|
+
schemaFingerprint: live.fingerprint,
|
|
32388
|
+
baselineSource: "manual-baseline",
|
|
32389
|
+
updatedAt: new Date
|
|
32390
|
+
};
|
|
32391
|
+
await this.persistDeploymentState(game2.id, set);
|
|
32392
|
+
addEvent("deployment_state.baseline_recorded", {
|
|
32393
|
+
"app.game.id": game2.id,
|
|
32394
|
+
"app.deployment_state.baseline_source": "manual-baseline",
|
|
32395
|
+
"app.deployment_state.baseline_ledger_rows": recordedTags.length,
|
|
32396
|
+
"app.deployment_state.baseline_has_snapshot": input.schemaSnapshot !== undefined,
|
|
32397
|
+
"app.deployment_state.baseline_graduated_from_push": graduating
|
|
32398
|
+
});
|
|
32399
|
+
return this.get(slug, user);
|
|
32400
|
+
}
|
|
32401
|
+
async realignMigration(slug, tag, checksum, user) {
|
|
32402
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32403
|
+
const cf = this.requireCloudflare();
|
|
32404
|
+
const databaseId = await this.resolveDatabaseId(slug, game2.id);
|
|
32405
|
+
const ledger = await cf.d1.readMigrationLedger(databaseId);
|
|
32406
|
+
if (!ledger.some((row) => row.tag === tag)) {
|
|
32407
|
+
throw new NotFoundError("Applied migration", tag);
|
|
32408
|
+
}
|
|
32409
|
+
const updated = await cf.d1.updateLedgerChecksum(databaseId, { tag, checksum });
|
|
32410
|
+
if (!updated) {
|
|
32411
|
+
throw new NotFoundError("Applied migration", tag);
|
|
32412
|
+
}
|
|
32413
|
+
addEvent("deployment_state.migration_realigned", {
|
|
32414
|
+
"app.game.id": game2.id,
|
|
32415
|
+
"app.d1.migration_tag": tag,
|
|
32416
|
+
"app.user.id": user.id
|
|
32417
|
+
});
|
|
32418
|
+
return { tag, checksum, checksumAlgo: MIGRATION_CHECKSUM_ALGO };
|
|
32419
|
+
}
|
|
32420
|
+
async persistDeploymentState(gameId, set) {
|
|
32421
|
+
await this.deps.db.insert(gameDeploymentState).values({ gameId, ...set }).onConflictDoUpdate({ target: gameDeploymentState.gameId, set });
|
|
32422
|
+
}
|
|
32423
|
+
async updateDeploymentState(gameId, set) {
|
|
32424
|
+
const updated = await this.deps.db.update(gameDeploymentState).set(set).where(eq(gameDeploymentState.gameId, gameId)).returning({ gameId: gameDeploymentState.gameId });
|
|
32425
|
+
return updated.length > 0;
|
|
32426
|
+
}
|
|
32427
|
+
async resolveMigration(slug, tag, input, user) {
|
|
32428
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32429
|
+
const cf = this.requireCloudflare();
|
|
32430
|
+
const databaseId = await this.resolveDatabaseId(slug, game2.id);
|
|
32431
|
+
const [ledger, live] = await Promise.all([
|
|
32432
|
+
cf.d1.readMigrationLedger(databaseId),
|
|
32433
|
+
cf.d1.fingerprintSchema(databaseId)
|
|
32434
|
+
]);
|
|
32435
|
+
const exists2 = ledger.some((row) => row.tag === tag);
|
|
32436
|
+
if (input.resolution === "applied") {
|
|
32437
|
+
if (!input.checksum) {
|
|
32438
|
+
throw new ValidationError("Resolving a migration as 'applied' requires its checksum");
|
|
32439
|
+
}
|
|
32440
|
+
if (exists2) {
|
|
32441
|
+
throw new AlreadyExistsError(`Migration '${tag}' is already recorded as applied`);
|
|
32442
|
+
}
|
|
32443
|
+
await cf.d1.ensureMigrationLedger(databaseId);
|
|
32444
|
+
await cf.d1.recordLedgerRows(databaseId, {
|
|
32445
|
+
rows: [{ tag, checksum: input.checksum }],
|
|
32446
|
+
deployId: `resolve:${crypto.randomUUID()}`,
|
|
32447
|
+
appliedBy: user.id,
|
|
32448
|
+
source: "resolve"
|
|
32449
|
+
});
|
|
32450
|
+
} else {
|
|
32451
|
+
if (!exists2) {
|
|
32452
|
+
throw new NotFoundError("Migration ledger row", tag);
|
|
32453
|
+
}
|
|
32454
|
+
await cf.d1.deleteLedgerRow(databaseId, tag);
|
|
32455
|
+
}
|
|
32456
|
+
const fingerprintRecorded = await this.updateDeploymentState(game2.id, {
|
|
32457
|
+
schemaFingerprint: live.fingerprint,
|
|
32458
|
+
updatedAt: new Date
|
|
32459
|
+
});
|
|
32460
|
+
addEvent("deployment_state.migration_resolved", {
|
|
32461
|
+
"app.game.id": game2.id,
|
|
32462
|
+
"app.d1.migration_tag": tag,
|
|
32463
|
+
"app.deployment_state.resolution": input.resolution,
|
|
32464
|
+
"app.deployment_state.fingerprint_rerecorded": fingerprintRecorded,
|
|
32465
|
+
"app.user.id": user.id
|
|
32466
|
+
});
|
|
32467
|
+
return {
|
|
32468
|
+
tag,
|
|
32469
|
+
resolution: input.resolution,
|
|
32470
|
+
schemaFingerprint: live.fingerprint,
|
|
32471
|
+
fingerprintRecorded
|
|
32472
|
+
};
|
|
32473
|
+
}
|
|
32474
|
+
async history(slug, user, options = {}) {
|
|
32475
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32476
|
+
const limit = options.limit ?? 20;
|
|
32477
|
+
const [jobs, events] = await Promise.all([
|
|
32478
|
+
this.deps.db.select({
|
|
32479
|
+
status: gameDeployJobs.status,
|
|
32480
|
+
createdAt: gameDeployJobs.createdAt,
|
|
32481
|
+
completedAt: gameDeployJobs.completedAt,
|
|
32482
|
+
deployId: gameDeployJobs.deployId,
|
|
32483
|
+
error: gameDeployJobs.error,
|
|
32484
|
+
email: users.email
|
|
32485
|
+
}).from(gameDeployJobs).leftJoin(users, eq(gameDeployJobs.userId, users.id)).where(eq(gameDeployJobs.gameId, game2.id)).orderBy(desc(deployJobInstant())).limit(limit),
|
|
32486
|
+
this.deps.db.select({
|
|
32487
|
+
kind: gameDeployEvents.kind,
|
|
32488
|
+
payload: gameDeployEvents.payload,
|
|
32489
|
+
createdAt: gameDeployEvents.createdAt,
|
|
32490
|
+
email: users.email
|
|
32491
|
+
}).from(gameDeployEvents).leftJoin(users, eq(gameDeployEvents.userId, users.id)).where(eq(gameDeployEvents.gameId, game2.id)).orderBy(desc(gameDeployEvents.createdAt)).limit(limit)
|
|
32492
|
+
]);
|
|
32493
|
+
setAttributes({
|
|
32494
|
+
"app.deployment_state.history_jobs": jobs.length,
|
|
32495
|
+
"app.deployment_state.history_events": events.length
|
|
32496
|
+
});
|
|
32497
|
+
const deploys = jobs.map((job) => ({
|
|
32498
|
+
kind: "deploy",
|
|
32499
|
+
status: job.status,
|
|
32500
|
+
at: (job.completedAt ?? job.createdAt).toISOString(),
|
|
32501
|
+
completedAt: job.completedAt?.toISOString() ?? null,
|
|
32502
|
+
by: job.email ?? DELETED_ACCOUNT_LABEL,
|
|
32503
|
+
deployId: job.deployId,
|
|
32504
|
+
error: job.error
|
|
32505
|
+
}));
|
|
32506
|
+
const merged = [...deploys, ...events.flatMap(historyEventEntry)].toSorted((a, b) => a.at < b.at ? 1 : -1).slice(0, limit);
|
|
32507
|
+
return { deploys: merged };
|
|
32508
|
+
}
|
|
32509
|
+
async restorePoints(slug, user) {
|
|
32510
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32511
|
+
const retentionCutoff = new Date(Date.now() - D1_TIME_TRAVEL_RETENTION_DAYS * 24 * 60 * 60 * 1000);
|
|
32512
|
+
const [currentDatabaseId, rows, state] = await Promise.all([
|
|
32513
|
+
this.findDatabaseId(slug, game2.id),
|
|
32514
|
+
this.deps.db.query.gameDeployments.findMany({
|
|
32515
|
+
where: and(eq(gameDeployments.gameId, game2.id), eq(gameDeployments.target, "game"), isNotNull(gameDeployments.timeTravelBookmark), gte(gameDeployments.deployedAt, retentionCutoff)),
|
|
32516
|
+
orderBy: desc(gameDeployments.deployedAt),
|
|
32517
|
+
limit: 100,
|
|
32518
|
+
columns: {
|
|
32519
|
+
id: true,
|
|
32520
|
+
deployedAt: true,
|
|
32521
|
+
bookmarkCapturedAt: true,
|
|
32522
|
+
isActive: true,
|
|
32523
|
+
resources: true
|
|
32524
|
+
}
|
|
32525
|
+
}),
|
|
32526
|
+
this.findSchemaHashState(game2.id)
|
|
32527
|
+
]);
|
|
32528
|
+
if (isPushAdopted(state)) {
|
|
32529
|
+
return { restorePoints: [], restoreUnsupported: true };
|
|
32530
|
+
}
|
|
32531
|
+
if (!currentDatabaseId) {
|
|
32532
|
+
return { restorePoints: [], restoreUnsupported: false };
|
|
32533
|
+
}
|
|
32534
|
+
const deploymentId = getGameDeploymentId(slug, this.deps.config.sstStage);
|
|
32535
|
+
const restorable = rows.filter((row) => databaseIdFromResources(row.resources, deploymentId) === currentDatabaseId && restorePointCapturedAt(row) >= retentionCutoff).slice(0, 20);
|
|
32536
|
+
setAttributes({ "app.deployment_state.restore_points": restorable.length });
|
|
32537
|
+
return {
|
|
32538
|
+
restorePoints: restorable.map((row) => ({
|
|
32539
|
+
id: row.id,
|
|
32540
|
+
capturedAt: restorePointCapturedAt(row).toISOString(),
|
|
32541
|
+
active: row.isActive
|
|
32542
|
+
})),
|
|
32543
|
+
restoreUnsupported: false
|
|
32544
|
+
};
|
|
32545
|
+
}
|
|
32546
|
+
async restoreToBookmark(slug, input, user) {
|
|
32547
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32548
|
+
const cf = this.requireCloudflare();
|
|
32549
|
+
const [row, state, currentDatabaseId, runningJob] = await Promise.all([
|
|
32550
|
+
this.deps.db.query.gameDeployments.findFirst({
|
|
32551
|
+
where: and(eq(gameDeployments.id, input.restorePointId), eq(gameDeployments.gameId, game2.id), eq(gameDeployments.target, "game")),
|
|
32552
|
+
columns: {
|
|
32553
|
+
id: true,
|
|
32554
|
+
timeTravelBookmark: true,
|
|
32555
|
+
deployedAt: true,
|
|
32556
|
+
bookmarkCapturedAt: true,
|
|
32557
|
+
resources: true
|
|
32558
|
+
}
|
|
32559
|
+
}),
|
|
32560
|
+
this.findSchemaHashState(game2.id),
|
|
32561
|
+
this.findDatabaseId(slug, game2.id),
|
|
32562
|
+
this.deps.db.query.gameDeployJobs.findFirst({
|
|
32563
|
+
where: and(eq(gameDeployJobs.gameId, game2.id), or(eq(gameDeployJobs.status, "pending"), and(eq(gameDeployJobs.status, "running"), gt(gameDeployJobs.leaseExpiresAt, new Date)))),
|
|
32564
|
+
columns: { id: true }
|
|
32565
|
+
})
|
|
32566
|
+
]);
|
|
32567
|
+
if (!row?.timeTravelBookmark) {
|
|
32568
|
+
throw new NotFoundError("Bookmark", input.restorePointId);
|
|
32569
|
+
}
|
|
32570
|
+
if (isPushAdopted(state)) {
|
|
32571
|
+
throw new ValidationError("Restore is not supported for push-mode projects: rewinding the " + "database would leave future push deploys diffing against the " + "wrong schema.", { code: DEPLOY_ERROR_CODES.restoreUnsupported });
|
|
32572
|
+
}
|
|
32573
|
+
if (!currentDatabaseId) {
|
|
32574
|
+
throw new ValidationError("Game has no deployed database — deploy with a database binding first");
|
|
32575
|
+
}
|
|
32576
|
+
const databaseId = currentDatabaseId;
|
|
32577
|
+
const deploymentId = getGameDeploymentId(slug, this.deps.config.sstStage);
|
|
32578
|
+
if (databaseIdFromResources(row.resources, deploymentId) !== databaseId) {
|
|
32579
|
+
throw new ValidationError("This bookmark was captured on a previous database (a reset replaced " + "it since) and can no longer be restored");
|
|
32580
|
+
}
|
|
32581
|
+
const retentionCutoff = new Date(Date.now() - D1_TIME_TRAVEL_RETENTION_DAYS * 24 * 60 * 60 * 1000);
|
|
32582
|
+
if (restorePointCapturedAt(row) < retentionCutoff) {
|
|
32583
|
+
throw new ValidationError(`This bookmark is older than Time Travel's ${D1_TIME_TRAVEL_RETENTION_DAYS}-day ` + "retention window and can no longer be restored.", { code: DEPLOY_ERROR_CODES.restoreExpired });
|
|
32584
|
+
}
|
|
32585
|
+
if (runningJob) {
|
|
32586
|
+
throw new ValidationError("A deploy is currently running for this game. Wait for it to finish, " + "then restore.", { code: DEPLOY_ERROR_CODES.restoreBlockedByDeploy });
|
|
32587
|
+
}
|
|
32588
|
+
const restored = await cf.d1.restoreBookmark(databaseId, row.timeTravelBookmark);
|
|
32589
|
+
const restoredTo = restorePointCapturedAt(row).toISOString();
|
|
32590
|
+
let live;
|
|
32591
|
+
let fingerprintRecorded;
|
|
32592
|
+
try {
|
|
32593
|
+
live = await cf.d1.fingerprintSchema(databaseId);
|
|
32594
|
+
fingerprintRecorded = await this.updateDeploymentState(game2.id, {
|
|
32595
|
+
schemaFingerprint: live.fingerprint,
|
|
32596
|
+
updatedAt: new Date
|
|
32597
|
+
});
|
|
32598
|
+
await this.deps.db.insert(gameDeployEvents).values({
|
|
32599
|
+
gameId: game2.id,
|
|
32600
|
+
userId: user.id,
|
|
32601
|
+
kind: "restore",
|
|
32602
|
+
payload: { restoredTo, previousBookmark: restored.previousBookmark }
|
|
32603
|
+
});
|
|
32604
|
+
} catch (error) {
|
|
32605
|
+
throw new ValidationError("The database WAS restored, but re-recording its schema " + `fingerprint failed (${errorMessage(error)}). Run the same ` + "restore again to complete it.", { code: DEPLOY_ERROR_CODES.restoreIncomplete });
|
|
32606
|
+
}
|
|
32607
|
+
addEvent("deployment_state.bookmark_restored", {
|
|
32608
|
+
"app.game.id": game2.id,
|
|
32609
|
+
"app.deployment_state.restore_point": row.id,
|
|
32610
|
+
"app.deployment_state.fingerprint_rerecorded": fingerprintRecorded,
|
|
32611
|
+
"app.user.id": user.id
|
|
32612
|
+
});
|
|
32613
|
+
return {
|
|
32614
|
+
restorePointId: row.id,
|
|
32615
|
+
restoredTo,
|
|
32616
|
+
schemaFingerprint: live.fingerprint,
|
|
32617
|
+
fingerprintRecorded,
|
|
32618
|
+
previousBookmark: restored.previousBookmark
|
|
32619
|
+
};
|
|
32620
|
+
}
|
|
32621
|
+
async reportDeployBlocked(slug, user, report) {
|
|
32622
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
32623
|
+
const recent = await this.deps.db.query.gameDeployEvents.findMany({
|
|
32624
|
+
where: and(eq(gameDeployEvents.gameId, game2.id), eq(gameDeployEvents.kind, "blocked"), gt(gameDeployEvents.createdAt, new Date(Date.now() - BLOCKED_ALERT_DEDUP_MS))),
|
|
32625
|
+
orderBy: desc(gameDeployEvents.createdAt),
|
|
32626
|
+
limit: 10,
|
|
32627
|
+
columns: { payload: true }
|
|
32628
|
+
});
|
|
32629
|
+
const duplicate = recent.some((event) => ("code" in event.payload) && event.payload.code === report.code);
|
|
32630
|
+
await this.deps.db.insert(gameDeployEvents).values({
|
|
32631
|
+
gameId: game2.id,
|
|
32632
|
+
userId: user.id,
|
|
32633
|
+
kind: "blocked",
|
|
32634
|
+
payload: { code: report.code, reason: report.reason }
|
|
32635
|
+
});
|
|
32636
|
+
addEvent("deployment_state.deploy_blocked", {
|
|
32637
|
+
"app.game.id": game2.id,
|
|
32638
|
+
"app.deploy.blocked_code": report.code,
|
|
32639
|
+
"app.user.id": user.id,
|
|
32640
|
+
"app.alerts.deduped": duplicate
|
|
32641
|
+
});
|
|
32642
|
+
if (!duplicate) {
|
|
32643
|
+
await this.deps.alerts.notifyDeployBlocked({
|
|
32644
|
+
slug,
|
|
32645
|
+
displayName: game2.displayName,
|
|
32646
|
+
reason: report.reason,
|
|
32647
|
+
developer: { id: user.id, email: user.email ?? null }
|
|
32648
|
+
});
|
|
32649
|
+
}
|
|
32650
|
+
}
|
|
32651
|
+
}
|
|
32652
|
+
var BLOCKED_ALERT_DEDUP_MS;
|
|
32653
|
+
var init_deployment_state_service = __esm(() => {
|
|
32654
|
+
init_drizzle_orm();
|
|
32655
|
+
init_src4();
|
|
32656
|
+
init_src();
|
|
32657
|
+
init_helpers_index();
|
|
32658
|
+
init_tables_index();
|
|
32659
|
+
init_spans();
|
|
32660
|
+
init_game2();
|
|
32661
|
+
init_errors();
|
|
32662
|
+
init_baseline_validation_util();
|
|
32663
|
+
init_deployment_util();
|
|
32664
|
+
init_migration_util();
|
|
32665
|
+
init_secrets_util();
|
|
32666
|
+
BLOCKED_ALERT_DEDUP_MS = 10 * 60 * 1000;
|
|
32667
|
+
});
|
|
32668
|
+
|
|
30490
32669
|
// ../api-core/src/services/domain.service.ts
|
|
30491
32670
|
class DomainService {
|
|
30492
32671
|
deps;
|
|
@@ -30853,6 +33032,7 @@ var init_kv_service = __esm(() => {
|
|
|
30853
33032
|
// ../api-core/src/services/secrets.service.ts
|
|
30854
33033
|
class SecretsService {
|
|
30855
33034
|
deps;
|
|
33035
|
+
pepperPromise = null;
|
|
30856
33036
|
constructor(deps) {
|
|
30857
33037
|
this.deps = deps;
|
|
30858
33038
|
}
|
|
@@ -30865,36 +33045,69 @@ class SecretsService {
|
|
|
30865
33045
|
getGameDeploymentId(slug) {
|
|
30866
33046
|
return getGameDeploymentId(slug, this.deps.config.sstStage);
|
|
30867
33047
|
}
|
|
30868
|
-
|
|
30869
|
-
|
|
30870
|
-
|
|
30871
|
-
|
|
30872
|
-
|
|
30873
|
-
|
|
30874
|
-
|
|
30875
|
-
|
|
30876
|
-
|
|
30877
|
-
|
|
30878
|
-
|
|
30879
|
-
|
|
30880
|
-
|
|
30881
|
-
}
|
|
30882
|
-
|
|
30883
|
-
|
|
33048
|
+
getPepper() {
|
|
33049
|
+
const pepperSecret = this.deps.config.secretsManifestPepper;
|
|
33050
|
+
if (!pepperSecret) {
|
|
33051
|
+
throw new ValidationError("Secrets manifest is not configured (missing manifest pepper secret)");
|
|
33052
|
+
}
|
|
33053
|
+
this.pepperPromise ??= deriveSecretsManifestPepper(pepperSecret);
|
|
33054
|
+
return this.pepperPromise;
|
|
33055
|
+
}
|
|
33056
|
+
async computeManifestEntries(gameId, secrets) {
|
|
33057
|
+
const pepper = await this.getPepper();
|
|
33058
|
+
const entries = {};
|
|
33059
|
+
for (const [key, value] of Object.entries(secrets)) {
|
|
33060
|
+
entries[key] = await computeSecretDigest(pepper, { gameId, key, value });
|
|
33061
|
+
}
|
|
33062
|
+
return entries;
|
|
33063
|
+
}
|
|
33064
|
+
async readManifest(gameId) {
|
|
33065
|
+
const state = await this.deps.db.query.gameDeploymentState.findFirst({
|
|
33066
|
+
where: eq(gameDeploymentState.gameId, gameId),
|
|
33067
|
+
columns: { secretsManifest: true }
|
|
33068
|
+
});
|
|
33069
|
+
return state?.secretsManifest ?? {};
|
|
33070
|
+
}
|
|
33071
|
+
async upsertManifestEntries(gameId, entries) {
|
|
33072
|
+
const merged = sql`coalesce(${gameDeploymentState.secretsManifest}, '{}'::jsonb) || ${JSON.stringify(entries)}::jsonb`;
|
|
33073
|
+
await this.deps.db.insert(gameDeploymentState).values({ gameId, secretsManifest: entries, updatedAt: new Date }).onConflictDoUpdate({
|
|
33074
|
+
target: gameDeploymentState.gameId,
|
|
33075
|
+
set: { secretsManifest: merged, updatedAt: new Date }
|
|
33076
|
+
});
|
|
33077
|
+
}
|
|
33078
|
+
async removeManifestKey(gameId, key) {
|
|
33079
|
+
await this.deps.db.update(gameDeploymentState).set({
|
|
33080
|
+
secretsManifest: sql`coalesce(${gameDeploymentState.secretsManifest}, '{}'::jsonb) - ${key}::text`,
|
|
33081
|
+
updatedAt: new Date
|
|
33082
|
+
}).where(eq(gameDeploymentState.gameId, gameId));
|
|
33083
|
+
}
|
|
33084
|
+
assertNoReservedKeys(keys, operation) {
|
|
33085
|
+
for (const key of keys) {
|
|
33086
|
+
if (INTERNAL_SECRET_KEYS.includes(key)) {
|
|
30884
33087
|
setAttributes({
|
|
30885
|
-
"app.secrets.operation":
|
|
30886
|
-
"app.secrets.
|
|
30887
|
-
"app.secrets.game_deployed": false
|
|
33088
|
+
"app.secrets.operation": operation,
|
|
33089
|
+
"app.secrets.reserved_key_rejected": true
|
|
30888
33090
|
});
|
|
30889
|
-
|
|
33091
|
+
throw new ValidationError(operation === "set" ? `Cannot set reserved secret "${key}"` : `Reserved secret "${key}" cannot be managed — remove it locally`);
|
|
30890
33092
|
}
|
|
30891
|
-
throw error;
|
|
30892
33093
|
}
|
|
30893
33094
|
}
|
|
30894
|
-
async
|
|
33095
|
+
async listKeys(slug, user) {
|
|
30895
33096
|
await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
30896
33097
|
const cf = this.getCloudflare();
|
|
30897
33098
|
const deploymentId = this.getGameDeploymentId(slug);
|
|
33099
|
+
const userKeys = await listUserSecretKeys(cf, deploymentId);
|
|
33100
|
+
setAttributes({
|
|
33101
|
+
"app.secrets.operation": "list",
|
|
33102
|
+
"app.secrets.count": userKeys?.length ?? 0,
|
|
33103
|
+
"app.secrets.game_deployed": userKeys !== null
|
|
33104
|
+
});
|
|
33105
|
+
return userKeys ?? [];
|
|
33106
|
+
}
|
|
33107
|
+
async setSecrets(slug, newSecrets, user) {
|
|
33108
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
33109
|
+
const cf = this.getCloudflare();
|
|
33110
|
+
const deploymentId = this.getGameDeploymentId(slug);
|
|
30898
33111
|
const secretKeys = Object.keys(newSecrets);
|
|
30899
33112
|
if (secretKeys.length === 0) {
|
|
30900
33113
|
throw new ValidationError("At least one secret must be provided");
|
|
@@ -30903,14 +33116,9 @@ class SecretsService {
|
|
|
30903
33116
|
if (typeof value !== "string") {
|
|
30904
33117
|
throw new ValidationError(`Secret value for "${key}" must be a string`);
|
|
30905
33118
|
}
|
|
30906
|
-
if (INTERNAL_SECRET_KEYS.includes(key)) {
|
|
30907
|
-
setAttributes({
|
|
30908
|
-
"app.secrets.operation": "set",
|
|
30909
|
-
"app.secrets.reserved_key_rejected": true
|
|
30910
|
-
});
|
|
30911
|
-
throw new ValidationError(`Cannot set reserved secret "${key}"`);
|
|
30912
|
-
}
|
|
30913
33119
|
}
|
|
33120
|
+
this.assertNoReservedKeys(secretKeys, "set");
|
|
33121
|
+
const manifestEntries = await this.computeManifestEntries(game2.id, newSecrets);
|
|
30914
33122
|
try {
|
|
30915
33123
|
const prefixedSecrets = {};
|
|
30916
33124
|
for (const [key, value] of Object.entries(newSecrets)) {
|
|
@@ -30923,8 +33131,6 @@ class SecretsService {
|
|
|
30923
33131
|
"app.secrets.game_deployed": true,
|
|
30924
33132
|
"app.secrets.reserved_key_rejected": false
|
|
30925
33133
|
});
|
|
30926
|
-
const allKeys = await cf.listSecrets(deploymentId);
|
|
30927
|
-
return allKeys.filter((k) => k.startsWith(SECRETS_PREFIX)).map((k) => k.slice(SECRETS_PREFIX.length));
|
|
30928
33134
|
} catch (error) {
|
|
30929
33135
|
const message = errorMessage(error);
|
|
30930
33136
|
if (message.includes("not found") || message.includes("10007")) {
|
|
@@ -30936,6 +33142,9 @@ class SecretsService {
|
|
|
30936
33142
|
}
|
|
30937
33143
|
throw error;
|
|
30938
33144
|
}
|
|
33145
|
+
await this.upsertManifestEntries(game2.id, manifestEntries);
|
|
33146
|
+
const allKeys = await cf.listSecrets(deploymentId);
|
|
33147
|
+
return allKeys.filter((k) => k.startsWith(SECRETS_PREFIX)).map((k) => k.slice(SECRETS_PREFIX.length));
|
|
30939
33148
|
}
|
|
30940
33149
|
async deleteSecret(slug, key, user) {
|
|
30941
33150
|
if (INTERNAL_SECRET_KEYS.includes(key)) {
|
|
@@ -30945,19 +33154,25 @@ class SecretsService {
|
|
|
30945
33154
|
});
|
|
30946
33155
|
throw new ValidationError(`Cannot delete reserved secret "${key}"`);
|
|
30947
33156
|
}
|
|
30948
|
-
await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
33157
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
30949
33158
|
const cf = this.getCloudflare();
|
|
30950
33159
|
const deploymentId = this.getGameDeploymentId(slug);
|
|
33160
|
+
const manifest = await this.readManifest(game2.id);
|
|
33161
|
+
const managed = key in manifest;
|
|
30951
33162
|
try {
|
|
30952
33163
|
const prefixedKey = `${SECRETS_PREFIX}${key}`;
|
|
30953
33164
|
const existingKeys = await cf.listSecrets(deploymentId);
|
|
30954
|
-
|
|
33165
|
+
const onWorker = existingKeys.includes(prefixedKey);
|
|
33166
|
+
if (!onWorker && !managed) {
|
|
30955
33167
|
throw new NotFoundError("Secret", key);
|
|
30956
33168
|
}
|
|
30957
|
-
|
|
33169
|
+
if (onWorker) {
|
|
33170
|
+
await cf.deleteSecret(deploymentId, prefixedKey);
|
|
33171
|
+
}
|
|
30958
33172
|
setAttributes({
|
|
30959
33173
|
"app.secrets.operation": "delete",
|
|
30960
33174
|
"app.secrets.game_deployed": true,
|
|
33175
|
+
"app.secrets.managed": managed,
|
|
30961
33176
|
"app.secrets.reserved_key_rejected": false
|
|
30962
33177
|
});
|
|
30963
33178
|
} catch (error) {
|
|
@@ -30974,14 +33189,45 @@ class SecretsService {
|
|
|
30974
33189
|
}
|
|
30975
33190
|
throw error;
|
|
30976
33191
|
}
|
|
33192
|
+
if (managed) {
|
|
33193
|
+
await this.removeManifestKey(game2.id, key);
|
|
33194
|
+
}
|
|
33195
|
+
}
|
|
33196
|
+
async diff(slug, localSecrets, user) {
|
|
33197
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
33198
|
+
const deploymentId = this.getGameDeploymentId(slug);
|
|
33199
|
+
this.assertNoReservedKeys(Object.keys(localSecrets), "diff");
|
|
33200
|
+
const [manifest, remoteKeys, localDigests] = await Promise.all([
|
|
33201
|
+
this.readManifest(game2.id),
|
|
33202
|
+
this.deps.cloudflare ? listUserSecretKeys(this.deps.cloudflare, deploymentId) : null,
|
|
33203
|
+
this.computeManifestEntries(game2.id, localSecrets)
|
|
33204
|
+
]);
|
|
33205
|
+
const verdicts = computeSecretsDiff({
|
|
33206
|
+
localDigests,
|
|
33207
|
+
manifest,
|
|
33208
|
+
remoteKeys: remoteKeys ?? []
|
|
33209
|
+
});
|
|
33210
|
+
setAttributes({
|
|
33211
|
+
"app.secrets.operation": "diff",
|
|
33212
|
+
"app.secrets.game_deployed": remoteKeys !== null,
|
|
33213
|
+
"app.secrets.diff_added": verdicts.added.length,
|
|
33214
|
+
"app.secrets.diff_changed": verdicts.changed.length,
|
|
33215
|
+
"app.secrets.diff_unchanged": verdicts.unchanged.length,
|
|
33216
|
+
"app.secrets.diff_remote_only_managed": verdicts.remoteOnlyManaged.length,
|
|
33217
|
+
"app.secrets.diff_remote_only_unmanaged": verdicts.remoteOnlyUnmanaged.length
|
|
33218
|
+
});
|
|
33219
|
+
return verdicts;
|
|
30977
33220
|
}
|
|
30978
33221
|
}
|
|
30979
33222
|
var INTERNAL_SECRET_KEYS;
|
|
30980
33223
|
var init_secrets_service = __esm(() => {
|
|
33224
|
+
init_drizzle_orm();
|
|
30981
33225
|
init_src();
|
|
33226
|
+
init_tables_index();
|
|
30982
33227
|
init_spans();
|
|
30983
33228
|
init_errors();
|
|
30984
33229
|
init_deployment_util();
|
|
33230
|
+
init_secrets_util();
|
|
30985
33231
|
INTERNAL_SECRET_KEYS = ["PLAYCADEMY_API_KEY", "GAME_ID", "PLAYCADEMY_BASE_URL"];
|
|
30986
33232
|
});
|
|
30987
33233
|
// ../edge-play/src/game/setup.ts
|
|
@@ -31519,7 +33765,10 @@ var init_emoji = __esm(() => {
|
|
|
31519
33765
|
});
|
|
31520
33766
|
|
|
31521
33767
|
// ../data/src/domains/game/schemas.ts
|
|
31522
|
-
|
|
33768
|
+
function requestsBinding(binding) {
|
|
33769
|
+
return binding === true || Array.isArray(binding) && binding.length > 0;
|
|
33770
|
+
}
|
|
33771
|
+
var HttpUrlSchema, GameEmojiSchema, GameMetadataRecordSchema, InsertGameSchema, UpdateGameSchema, InsertGameDeploymentSchema, InsertGameDeployJobSchema, InsertGameDeploymentStateSchema, UpsertGameMetadataSchema, PatchGameMetadataSchema, AddGameMemberSchema, UpdateGameMemberRoleSchema, AddGameDashboardUserSchema, VerifyGameDashboardLoginSchema, AcceptGameDashboardInviteSchema, AcceptGameDashboardResetSchema, ALLOWED_UPLOAD_EXTENSIONS, InitiateUploadSchema, AddCustomHostnameSchema, SetSecretsRequestSchema, SecretsDiffRequestSchema, SeedRequestSchema, SchemaInfoSchema, VerifyTokenSchema, KVSeedRequestSchema, DeployMigrationSchema, DeployDatabaseSchema, DatabaseResetDatabaseSchema, DatabaseResetRequestSchema, BaselineEvidenceSchema, DeployBaselineSchema, DeploymentStateBaselineSchema, MigrationRealignSchema, MigrationResolveSchema, DatabaseRestoreSchema, DeployBlockedReportSchema, DeployRequestSchema;
|
|
31523
33772
|
var init_schemas2 = __esm(() => {
|
|
31524
33773
|
init_drizzle_zod();
|
|
31525
33774
|
init_esm();
|
|
@@ -31598,6 +33847,9 @@ var init_schemas2 = __esm(() => {
|
|
|
31598
33847
|
InsertGameDeployJobSchema = createInsertSchema(gameDeployJobs, {
|
|
31599
33848
|
status: exports_external.enum(deployJobStatusEnum.enumValues)
|
|
31600
33849
|
});
|
|
33850
|
+
InsertGameDeploymentStateSchema = createInsertSchema(gameDeploymentState, {
|
|
33851
|
+
secretsManifest: exports_external.record(exports_external.string(), exports_external.string()).nullable().optional()
|
|
33852
|
+
});
|
|
31601
33853
|
UpsertGameMetadataSchema = exports_external.object({
|
|
31602
33854
|
displayName: exports_external.string().min(1),
|
|
31603
33855
|
platform: exports_external.enum(gamePlatformEnum.enumValues),
|
|
@@ -31655,6 +33907,9 @@ var init_schemas2 = __esm(() => {
|
|
|
31655
33907
|
hostname: exports_external.string().min(1).max(255)
|
|
31656
33908
|
});
|
|
31657
33909
|
SetSecretsRequestSchema = exports_external.record(exports_external.string().min(1), exports_external.string());
|
|
33910
|
+
SecretsDiffRequestSchema = exports_external.object({
|
|
33911
|
+
secrets: exports_external.record(exports_external.string().min(1), exports_external.string())
|
|
33912
|
+
});
|
|
31658
33913
|
SeedRequestSchema = exports_external.object({
|
|
31659
33914
|
code: exports_external.string().min(1, "Seed code is required"),
|
|
31660
33915
|
secrets: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
@@ -31663,9 +33918,6 @@ var init_schemas2 = __esm(() => {
|
|
|
31663
33918
|
sql: exports_external.string(),
|
|
31664
33919
|
hash: exports_external.string()
|
|
31665
33920
|
});
|
|
31666
|
-
DatabaseResetRequestSchema = exports_external.object({
|
|
31667
|
-
schema: SchemaInfoSchema.optional()
|
|
31668
|
-
});
|
|
31669
33921
|
VerifyTokenSchema = exports_external.object({
|
|
31670
33922
|
token: exports_external.string().min(1, "Token is required")
|
|
31671
33923
|
});
|
|
@@ -31677,8 +33929,119 @@ var init_schemas2 = __esm(() => {
|
|
|
31677
33929
|
metadata: exports_external.record(exports_external.unknown()).optional()
|
|
31678
33930
|
}))
|
|
31679
33931
|
});
|
|
33932
|
+
DeployMigrationSchema = exports_external.object({
|
|
33933
|
+
tag: exports_external.string().min(1),
|
|
33934
|
+
statements: exports_external.array(exports_external.string().min(1)).min(1),
|
|
33935
|
+
checksum: exports_external.string().min(1)
|
|
33936
|
+
});
|
|
33937
|
+
DeployDatabaseSchema = exports_external.discriminatedUnion("mode", [
|
|
33938
|
+
exports_external.object({
|
|
33939
|
+
mode: exports_external.literal("push"),
|
|
33940
|
+
sql: exports_external.string(),
|
|
33941
|
+
baselineHash: exports_external.string().nullable(),
|
|
33942
|
+
nextSnapshot: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
33943
|
+
nextHash: exports_external.string().min(1),
|
|
33944
|
+
acceptDataLoss: exports_external.boolean().optional()
|
|
33945
|
+
}),
|
|
33946
|
+
exports_external.object({
|
|
33947
|
+
mode: exports_external.literal("migrate"),
|
|
33948
|
+
migrations: exports_external.array(DeployMigrationSchema)
|
|
33949
|
+
})
|
|
33950
|
+
]);
|
|
33951
|
+
DatabaseResetDatabaseSchema = exports_external.discriminatedUnion("mode", [
|
|
33952
|
+
exports_external.object({
|
|
33953
|
+
mode: exports_external.literal("push"),
|
|
33954
|
+
sql: exports_external.string(),
|
|
33955
|
+
nextSnapshot: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
33956
|
+
nextHash: exports_external.string().min(1)
|
|
33957
|
+
}),
|
|
33958
|
+
exports_external.object({
|
|
33959
|
+
mode: exports_external.literal("migrate"),
|
|
33960
|
+
migrations: exports_external.array(DeployMigrationSchema)
|
|
33961
|
+
})
|
|
33962
|
+
]);
|
|
33963
|
+
DatabaseResetRequestSchema = exports_external.object({
|
|
33964
|
+
schema: SchemaInfoSchema.optional(),
|
|
33965
|
+
database: DatabaseResetDatabaseSchema.optional()
|
|
33966
|
+
}).refine((data) => !(data.schema && data.database), {
|
|
33967
|
+
message: "Send either the database payload or the legacy schema field, not both",
|
|
33968
|
+
path: ["database"]
|
|
33969
|
+
});
|
|
33970
|
+
BaselineEvidenceSchema = exports_external.array(exports_external.object({
|
|
33971
|
+
tag: exports_external.string().min(1),
|
|
33972
|
+
generatedAt: exports_external.string().min(1),
|
|
33973
|
+
createsTables: exports_external.array(exports_external.object({
|
|
33974
|
+
name: exports_external.string().min(1),
|
|
33975
|
+
columns: exports_external.array(exports_external.string())
|
|
33976
|
+
})),
|
|
33977
|
+
addsColumns: exports_external.array(exports_external.object({
|
|
33978
|
+
table: exports_external.string().min(1),
|
|
33979
|
+
column: exports_external.string().min(1)
|
|
33980
|
+
})),
|
|
33981
|
+
createsIndexes: exports_external.array(exports_external.string()),
|
|
33982
|
+
createsViews: exports_external.array(exports_external.string())
|
|
33983
|
+
})).optional();
|
|
33984
|
+
DeployBaselineSchema = exports_external.object({
|
|
33985
|
+
lastAppliedMigrationTag: exports_external.string().min(1).optional(),
|
|
33986
|
+
journal: exports_external.array(exports_external.object({
|
|
33987
|
+
tag: exports_external.string().min(1),
|
|
33988
|
+
checksum: exports_external.string().min(1)
|
|
33989
|
+
})).optional(),
|
|
33990
|
+
evidence: BaselineEvidenceSchema,
|
|
33991
|
+
schemaSnapshot: exports_external.unknown().optional(),
|
|
33992
|
+
schemaHash: exports_external.string().min(1).optional(),
|
|
33993
|
+
integrationsHash: exports_external.string().min(1).optional(),
|
|
33994
|
+
buildHash: exports_external.string().min(1).optional()
|
|
33995
|
+
}).refine((data) => !data.lastAppliedMigrationTag === !data.journal, {
|
|
33996
|
+
message: "lastAppliedMigrationTag and journal must be provided together",
|
|
33997
|
+
path: ["journal"]
|
|
33998
|
+
}).refine((data) => data.schemaSnapshot === undefined === !data.schemaHash, {
|
|
33999
|
+
message: "schemaSnapshot and schemaHash must be provided together",
|
|
34000
|
+
path: ["schemaHash"]
|
|
34001
|
+
}).refine((data) => Boolean(data.lastAppliedMigrationTag || data.schemaHash || data.integrationsHash || data.buildHash), {
|
|
34002
|
+
message: "A baseline must claim something — migration history, a schema snapshot, or artifact hashes",
|
|
34003
|
+
path: ["lastAppliedMigrationTag"]
|
|
34004
|
+
});
|
|
34005
|
+
DeploymentStateBaselineSchema = exports_external.object({
|
|
34006
|
+
lastAppliedMigrationTag: exports_external.string().min(1).optional(),
|
|
34007
|
+
journal: exports_external.array(exports_external.object({
|
|
34008
|
+
tag: exports_external.string().min(1),
|
|
34009
|
+
checksum: exports_external.string().min(1)
|
|
34010
|
+
})).optional(),
|
|
34011
|
+
schemaSnapshot: exports_external.unknown().optional(),
|
|
34012
|
+
schemaHash: exports_external.string().min(1).optional(),
|
|
34013
|
+
evidence: BaselineEvidenceSchema,
|
|
34014
|
+
allowUnverified: exports_external.boolean().optional()
|
|
34015
|
+
}).refine((data) => !data.lastAppliedMigrationTag === !data.journal, {
|
|
34016
|
+
message: "lastAppliedMigrationTag and journal must be provided together",
|
|
34017
|
+
path: ["journal"]
|
|
34018
|
+
}).refine((data) => data.schemaSnapshot === undefined === !data.schemaHash, {
|
|
34019
|
+
message: "schemaSnapshot and schemaHash must be provided together",
|
|
34020
|
+
path: ["schemaHash"]
|
|
34021
|
+
}).refine((data) => Boolean(data.lastAppliedMigrationTag) || Boolean(data.schemaHash), {
|
|
34022
|
+
message: "A baseline needs a migration claim, a schema snapshot, or both",
|
|
34023
|
+
path: ["lastAppliedMigrationTag"]
|
|
34024
|
+
});
|
|
34025
|
+
MigrationRealignSchema = exports_external.object({
|
|
34026
|
+
checksum: exports_external.string().min(1)
|
|
34027
|
+
});
|
|
34028
|
+
MigrationResolveSchema = exports_external.object({
|
|
34029
|
+
resolution: exports_external.enum(["applied", "rolled-back"]),
|
|
34030
|
+
checksum: exports_external.string().min(1).optional()
|
|
34031
|
+
}).refine((data) => data.resolution !== "applied" || Boolean(data.checksum), {
|
|
34032
|
+
message: "Resolving a migration as 'applied' requires its checksum",
|
|
34033
|
+
path: ["checksum"]
|
|
34034
|
+
});
|
|
34035
|
+
DatabaseRestoreSchema = exports_external.object({
|
|
34036
|
+
restorePointId: exports_external.string().uuid()
|
|
34037
|
+
});
|
|
34038
|
+
DeployBlockedReportSchema = exports_external.object({
|
|
34039
|
+
code: exports_external.string().regex(/^blocked:[a-z-]+$/).max(64),
|
|
34040
|
+
reason: exports_external.string().min(1).max(2000)
|
|
34041
|
+
});
|
|
31680
34042
|
DeployRequestSchema = exports_external.object({
|
|
31681
34043
|
target: exports_external.enum(deploymentTargetEnum.enumValues).optional().default("game"),
|
|
34044
|
+
deployId: exports_external.string().min(1).optional(),
|
|
31682
34045
|
uploadToken: exports_external.string().optional(),
|
|
31683
34046
|
code: exports_external.string().optional(),
|
|
31684
34047
|
codeUploadToken: exports_external.string().optional(),
|
|
@@ -31705,6 +34068,11 @@ var init_schemas2 = __esm(() => {
|
|
|
31705
34068
|
sql: exports_external.string(),
|
|
31706
34069
|
hash: exports_external.string()
|
|
31707
34070
|
}).optional(),
|
|
34071
|
+
database: DeployDatabaseSchema.optional(),
|
|
34072
|
+
baseline: DeployBaselineSchema.optional(),
|
|
34073
|
+
buildHash: exports_external.string().min(1).optional(),
|
|
34074
|
+
integrationsHash: exports_external.string().min(1).optional(),
|
|
34075
|
+
pruneSecrets: exports_external.array(exports_external.string().min(1)).optional(),
|
|
31708
34076
|
metadata: exports_external.object({
|
|
31709
34077
|
displayName: exports_external.string().optional(),
|
|
31710
34078
|
description: exports_external.string().optional(),
|
|
@@ -31714,9 +34082,24 @@ var init_schemas2 = __esm(() => {
|
|
|
31714
34082
|
}).refine((data) => !(data.code && data.codeUploadToken), {
|
|
31715
34083
|
message: "Specify either code or codeUploadToken, not both",
|
|
31716
34084
|
path: ["codeUploadToken"]
|
|
31717
|
-
}).refine((data) => !(data.target === "dashboard" && (data.schema || data.bindings)), {
|
|
31718
|
-
message: "Dashboard deployments cannot include schema or bindings — they attach to the game deployment’s existing resources",
|
|
34085
|
+
}).refine((data) => !(data.target === "dashboard" && (data.schema || data.bindings || data.database)), {
|
|
34086
|
+
message: "Dashboard deployments cannot include schema, database, or bindings — they attach to the game deployment’s existing resources",
|
|
31719
34087
|
path: ["target"]
|
|
34088
|
+
}).refine((data) => !(data.target === "dashboard" && (data.baseline || data.pruneSecrets)), {
|
|
34089
|
+
message: "Dashboard deployments cannot adopt a baseline or prune secrets",
|
|
34090
|
+
path: ["target"]
|
|
34091
|
+
}).refine((data) => !(data.database && !data.deployId), {
|
|
34092
|
+
message: "deployId is required when a database payload is present",
|
|
34093
|
+
path: ["deployId"]
|
|
34094
|
+
}).refine((data) => !(data.database && data.schema), {
|
|
34095
|
+
message: "Send either the database payload or the legacy schema field, not both",
|
|
34096
|
+
path: ["database"]
|
|
34097
|
+
}).refine((data) => !(data.baseline && data.schema), {
|
|
34098
|
+
message: "The legacy schema field cannot ride a baseline-adopting deploy",
|
|
34099
|
+
path: ["baseline"]
|
|
34100
|
+
}).refine((data) => !(data.database && !requestsBinding(data.bindings?.database)), {
|
|
34101
|
+
message: "The database payload requires a database binding",
|
|
34102
|
+
path: ["database"]
|
|
31720
34103
|
});
|
|
31721
34104
|
});
|
|
31722
34105
|
|
|
@@ -75454,7 +77837,7 @@ var init_pure = __esm(() => {
|
|
|
75454
77837
|
});
|
|
75455
77838
|
|
|
75456
77839
|
// ../utils/src/index.ts
|
|
75457
|
-
var
|
|
77840
|
+
var init_src5 = __esm(() => {
|
|
75458
77841
|
init_pure();
|
|
75459
77842
|
});
|
|
75460
77843
|
|
|
@@ -77411,7 +79794,7 @@ var init_dist5 = __esm(async () => {
|
|
|
77411
79794
|
init_spans();
|
|
77412
79795
|
init_src();
|
|
77413
79796
|
init_spans();
|
|
77414
|
-
|
|
79797
|
+
init_src5();
|
|
77415
79798
|
init_src();
|
|
77416
79799
|
init_spans();
|
|
77417
79800
|
init_spans();
|
|
@@ -77990,7 +80373,7 @@ function selectTimebackMetricDiscrepancyQueueItems(candidates, options) {
|
|
|
77990
80373
|
}
|
|
77991
80374
|
var DATE_INPUT_RE;
|
|
77992
80375
|
var init_timeback_discrepancy_queue_util = __esm(() => {
|
|
77993
|
-
|
|
80376
|
+
init_src5();
|
|
77994
80377
|
init_timeback_util();
|
|
77995
80378
|
DATE_INPUT_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
77996
80379
|
});
|
|
@@ -80509,7 +82892,7 @@ var init_timeback_admin_service = __esm(async () => {
|
|
|
80509
82892
|
init_constants3();
|
|
80510
82893
|
init_types2();
|
|
80511
82894
|
init_utils6();
|
|
80512
|
-
|
|
82895
|
+
init_src5();
|
|
80513
82896
|
init_timeback3();
|
|
80514
82897
|
init_errors();
|
|
80515
82898
|
init_timeback_admin_metrics_util();
|
|
@@ -82965,8 +85348,15 @@ function createPlatformServices(deps) {
|
|
|
82965
85348
|
validateDeveloperAccess
|
|
82966
85349
|
});
|
|
82967
85350
|
const kv = new KVService({ db: db2, cloudflare: cloudflare2, validateDeveloperAccessBySlug });
|
|
82968
|
-
const secrets = new SecretsService({ config: config4, cloudflare: cloudflare2, validateDeveloperAccessBySlug });
|
|
85351
|
+
const secrets = new SecretsService({ db: db2, config: config4, cloudflare: cloudflare2, validateDeveloperAccessBySlug });
|
|
82969
85352
|
const domain3 = new DomainService({ db: db2, cloudflare: cloudflare2, corsKvs, validateDeveloperAccessBySlug });
|
|
85353
|
+
const deploymentState = new DeploymentStateService({
|
|
85354
|
+
db: db2,
|
|
85355
|
+
config: config4,
|
|
85356
|
+
cloudflare: cloudflare2,
|
|
85357
|
+
alerts,
|
|
85358
|
+
validateDeveloperAccessBySlug
|
|
85359
|
+
});
|
|
82970
85360
|
const database = new DatabaseService({
|
|
82971
85361
|
db: db2,
|
|
82972
85362
|
config: config4,
|
|
@@ -83005,6 +85395,7 @@ function createPlatformServices(deps) {
|
|
|
83005
85395
|
kv,
|
|
83006
85396
|
secrets,
|
|
83007
85397
|
domain: domain3,
|
|
85398
|
+
deploymentState,
|
|
83008
85399
|
database,
|
|
83009
85400
|
seed,
|
|
83010
85401
|
timeback: timeback2,
|
|
@@ -83015,6 +85406,7 @@ function createPlatformServices(deps) {
|
|
|
83015
85406
|
var init_platform2 = __esm(async () => {
|
|
83016
85407
|
init_bucket_service();
|
|
83017
85408
|
init_database_service();
|
|
85409
|
+
init_deployment_state_service();
|
|
83018
85410
|
init_domain_service();
|
|
83019
85411
|
init_kv_service();
|
|
83020
85412
|
init_secrets_service();
|
|
@@ -83747,7 +86139,7 @@ function createServices(ctx) {
|
|
|
83747
86139
|
};
|
|
83748
86140
|
}
|
|
83749
86141
|
var init_factory = __esm(async () => {
|
|
83750
|
-
|
|
86142
|
+
init_game3();
|
|
83751
86143
|
init_infra2();
|
|
83752
86144
|
init_player();
|
|
83753
86145
|
init_standalone();
|
|
@@ -84054,6 +86446,7 @@ function buildConfig(options) {
|
|
|
84054
86446
|
gameDomain: "localhost",
|
|
84055
86447
|
uploadBucket: "sandbox-uploads",
|
|
84056
86448
|
ltiTestMode: true,
|
|
86449
|
+
secretsManifestPepper: "sandbox-secrets-manifest-pepper",
|
|
84057
86450
|
...options.config
|
|
84058
86451
|
});
|
|
84059
86452
|
}
|
|
@@ -100995,7 +103388,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
|
|
|
100995
103388
|
__defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
|
|
100996
103389
|
}
|
|
100997
103390
|
return to;
|
|
100998
|
-
}, __toESM5 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value), ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles2, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default, init_ansi_styles, env, flagForceColor, supportsColor, supports_color_default, init_supports_color, init_utilities, stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles22, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default, init_source, require_old, require_fs, require_path, require_balanced_match, require_brace_expansion, require_minimatch, require_inherits_browser2, require_inherits2, require_common3, require_sync, require_wrappy, require_once, require_inflight, require_glob, require_readline, require_src3, require_utils4, require_lodash, require_hanji, originUUID, snapshotVersion, mapValues, mapKeys, mapEntries, customMapEntries, init_global2, util3, objectUtil2, ZodParsedType2, getParsedType4, init_util4, ZodIssueCode4, ZodError5, init_ZodError2, errorMap2, en_default4, init_en4, overrideErrorMap2, init_errors9, makeIssue2, ParseStatus2, INVALID3, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, init_parseUtil2, init_typeAliases2, errorUtil2, init_errorUtil2, ParseInputLazyPath2, handleResult2, ZodType4, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString4, ZodNumber4, ZodBigInt4, ZodBoolean4, ZodDate4, ZodSymbol4, ZodUndefined4, ZodNull4, ZodAny4, ZodUnknown4, ZodNever4, ZodVoid4, ZodArray4, ZodObject4, ZodUnion4, getDiscriminator2, ZodDiscriminatedUnion4, ZodIntersection4, ZodTuple4, ZodRecord4, ZodMap4, ZodSet4, ZodFunction3, ZodLazy4, ZodLiteral4, ZodEnum4, ZodNativeEnum2, ZodPromise4, ZodEffects2, ZodOptional4, ZodNullable4, ZodDefault4, ZodCatch4, ZodNaN4, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly4, late2, ZodFirstPartyTypeKind3, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, coerce2, init_types5, init_external4, init_v32, init_esm2, enumSchema, enumSchemaV1, indexColumn, index2, fk, sequenceSchema, roleSchema, sequenceSquashed, column2, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, table8, schemaHash, kitInternals, gelSchemaExternal, gelSchemaInternal, tableSquashed, gelSchemaSquashed, gelSchema, dryGel, init_gelSchema, index22, fk2, column22, tableV3, compositePK2, uniqueConstraint2, checkConstraint2, tableV4, table22, viewMeta, view22, kitInternals2, dialect2, schemaHash2, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema2, tableSquashedV4, tableSquashed2, viewSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql, init_mysqlSchema, indexV2, columnV2, tableV2, enumSchemaV12, enumSchema2, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn2, index3, indexV4, indexV5, indexV6, fk3, sequenceSchema2, roleSchema2, sequenceSquashed2, columnV7, column3, checkConstraint3, columnSquashed2, tableV32, compositePK3, uniqueConstraint3, policy2, policySquashed2, viewWithOption2, matViewWithOption2, mergedViewWithOption2, view3, tableV42, tableV5, tableV6, tableV7, table32, schemaHash3, kitInternals3, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed3, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg, init_pgSchema, index4, column4, compositePK4, uniqueConstraint4, table42, viewMeta2, kitInternals4, dialect22, schemaHash4, schemaInternal2, schema22, tableSquashed4, schemaSquashed2, SingleStoreSquasher, squashSingleStoreScheme, singlestoreSchema, singlestoreSchemaSquashed, backwardCompatibleSingleStoreSchema, drySingleStore, init_singlestoreSchema, index5, fk4, compositePK5, column5, tableV33, uniqueConstraint5, checkConstraint4, table52, view4, dialect3, schemaHash5, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals5, latestVersion, schemaInternal3, schemaV32, schemaV42, schemaV52, schema3, tableSquashed5, schemaSquashed3, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema, init_sqliteSchema, copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, init_utils7, import_hanji, warning, error88, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner2, ProgressView, init_views, glob, init_serializer, fillPgSnapshot, init_migrationPreparator, require_heap, require_heap2, require_difflib, require_difflib2, require_util2, require_styles, require_has_flag2, require_supports_colors, require_trap, require_zalgo, require_america, require_zebra, require_rainbow, require_random, require_colors, require_safe, require_colorize, require_lib4, import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn, init_jsonDiffer, parseType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgCreateIndPolicyConvertor, PgDropIndPolicyConvertor, PgRenameIndPolicyConvertor, PgAlterIndPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SingleStoreCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, SingleStoreAlterTableAddUniqueConstraintConvertor, SingleStoreAlterTableDropUniqueConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SingleStoreDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, SingleStoreRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SingleStoreAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SingleStoreAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SingleStoreAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, SingleStoreAlterTableAlterColumnAlterrGeneratedConvertor, SingleStoreAlterTableAddPk, SingleStoreAlterTableDropPk, SingleStoreModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSingleStoreIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SingleStoreDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, SingleStoreRecreateTableConvertor, convertors, init_sqlgenerator, _moveDataStatements, getOldTableName, getNewTableName, logSuggestionsAndReturn, init_sqlitePushUtils, preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSingleStoreCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareRenameIndPolicyJsons, prepareCreatePolicyJsons, prepareCreateIndPolicyJsons, prepareDropPolicyJsons, prepareDropIndPolicyJsons, prepareAlterPolicyJson, prepareAlterIndPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView, init_jsonStatements, prepareLibSQLRecreateTable, prepareSQLiteRecreateTable, libSQLCombineStatements, sqliteCombineStatements, prepareSingleStoreRecreateTable, singleStoreCombineStatements, init_statementCombiner, snapshotsDiffer_exports, makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, columnSchema, alteredColumnSchema, enumSchema3, changedEnumSchema, tableScheme, alteredTableScheme, alteredViewCommon, alteredPgViewSchema, alteredMySqlViewSchema, diffResultScheme, diffResultSchemeMysql, diffResultSchemeSingleStore, diffResultSchemeSQLite, schemaChangeFor, nameChangeFor, nameSchemaChangeFor, columnChangeFor, applyPgSnapshotsDiff, applyMysqlSnapshotsDiff, applySingleStoreSnapshotsDiff, applySqliteSnapshotsDiff, applyLibSQLSnapshotsDiff, init_snapshotsDiffer, init_words, dialects, dialect4, commonSquashedSchema, commonSchema, init_schemaValidator, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTypes, casingType, sqliteDriver, postgresDriver, driver2, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, init_common2, withStyle, init_outputs, import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, init_migrate, posixClasses, braceEscape, regexpEscape, rangesToString, parseClass, init_brace_expressions, escape, init_escape, unescape, init_unescape, import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep2, GLOBSTAR, plTypes, qmark, star, twoStarDot, twoStarNoDot, charSet, reSpecials, addPatternStartSet, filter, ext, defaults, braceExpand, MAX_PATTERN_LENGTH, assertValidPattern, makeRe, match2, globUnescape, globMagic, regExpEscape, Minimatch, init_mjs, entityKind2, hasOwnEntityKind2, init_entity2, _a3, Column2, init_column2, _a22, ColumnBuilder2, init_column_builder2, TableName2, init_table_utils2, _a32, ForeignKeyBuilder2, _a4, ForeignKey2, init_foreign_keys2, init_tracing_utils2, _a5, UniqueConstraintBuilder, _a6, UniqueOnConstraintBuilder, _a7, UniqueConstraint, init_unique_constraint2, init_array2, _a8, _b, PgColumnBuilder2, _a9, _b2, PgColumn2, _a10, _b3, ExtraConfigColumn2, _a11, IndexedColumn2, _a12, _b4, PgArrayBuilder2, _a13, _b5, _PgArray, PgArray2, init_common22, _a14, _b6, PgEnumObjectColumnBuilder2, _a15, _b7, PgEnumObjectColumn2, isPgEnumSym2, _a16, _b8, PgEnumColumnBuilder2, _a17, _b9, PgEnumColumn2, init_enum2, _a18, Subquery2, _a19, _b10, WithSubquery2, init_subquery2, version4, init_version2, otel2, rawTracer2, tracer2, init_tracing2, ViewBaseConfig2, init_view_common3, Schema2, Columns2, ExtraConfigColumns2, OriginalName2, BaseName2, IsAlias2, ExtraConfigBuilder2, IsDrizzleTable2, _a20, _b11, _c, _d, _e3, _f, _g, _h, _i, _j, Table2, init_table8, _a21, FakePrimitiveParam, _a222, StringChunk2, _a23, _SQL, SQL2, _a24, Name2, noopDecoder2, noopEncoder2, noopMapper2, _a25, Param2, _a26, Placeholder2, IsDrizzleView2, _a27, _b12, _c2, View3, init_sql3, _a28, ColumnAliasProxyHandler2, _a29, TableAliasProxyHandler2, _a30, RelationTableAliasProxyHandler, init_alias3, _a31, _b13, DrizzleError2, DrizzleQueryError, _a322, _b14, TransactionRollbackError2, init_errors22, _a33, ConsoleLogWriter2, _a34, DefaultLogger2, _a35, NoopLogger2, init_logger3, init_operations, _a36, _b15, QueryPromise2, init_query_promise2, textDecoder, init_utils22, _a37, _b16, PgIntColumnBaseBuilder2, init_int_common2, _a38, _b17, PgBigInt53Builder2, _a39, _b18, PgBigInt532, _a40, _b19, PgBigInt64Builder2, _a41, _b20, PgBigInt642, init_bigint2, _a42, _b21, PgBigSerial53Builder2, _a43, _b22, PgBigSerial532, _a44, _b23, PgBigSerial64Builder2, _a45, _b24, PgBigSerial642, init_bigserial2, _a46, _b25, PgBooleanBuilder2, _a47, _b26, PgBoolean2, init_boolean2, _a48, _b27, PgCharBuilder2, _a49, _b28, PgChar2, init_char2, _a50, _b29, PgCidrBuilder2, _a51, _b30, PgCidr2, init_cidr2, _a52, _b31, PgCustomColumnBuilder2, _a53, _b32, PgCustomColumn2, init_custom2, _a54, _b33, PgDateColumnBaseBuilder2, init_date_common2, _a55, _b34, PgDateBuilder2, _a56, _b35, PgDate2, _a57, _b36, PgDateStringBuilder2, _a58, _b37, PgDateString2, init_date2, _a59, _b38, PgDoublePrecisionBuilder2, _a60, _b39, PgDoublePrecision2, init_double_precision2, _a61, _b40, PgInetBuilder2, _a62, _b41, PgInet2, init_inet2, _a63, _b42, PgIntegerBuilder2, _a64, _b43, PgInteger2, init_integer2, _a65, _b44, PgIntervalBuilder2, _a66, _b45, PgInterval2, init_interval2, _a67, _b46, PgJsonBuilder2, _a68, _b47, PgJson2, init_json2, _a69, _b48, PgJsonbBuilder2, _a70, _b49, PgJsonb2, init_jsonb2, _a71, _b50, PgLineBuilder2, _a72, _b51, PgLineTuple2, _a73, _b52, PgLineABCBuilder2, _a74, _b53, PgLineABC2, init_line2, _a75, _b54, PgMacaddrBuilder2, _a76, _b55, PgMacaddr2, init_macaddr2, _a77, _b56, PgMacaddr8Builder2, _a78, _b57, PgMacaddr82, init_macaddr82, _a79, _b58, PgNumericBuilder2, _a80, _b59, PgNumeric2, _a81, _b60, PgNumericNumberBuilder2, _a82, _b61, PgNumericNumber2, _a83, _b62, PgNumericBigIntBuilder2, _a84, _b63, PgNumericBigInt2, init_numeric2, _a85, _b64, PgPointTupleBuilder2, _a86, _b65, PgPointTuple2, _a87, _b66, PgPointObjectBuilder2, _a88, _b67, PgPointObject2, init_point2, init_utils32, _a89, _b68, PgGeometryBuilder2, _a90, _b69, PgGeometry2, _a91, _b70, PgGeometryObjectBuilder2, _a92, _b71, PgGeometryObject2, init_geometry2, _a93, _b72, PgRealBuilder2, _a94, _b73, PgReal2, init_real2, _a95, _b74, PgSerialBuilder2, _a96, _b75, PgSerial2, init_serial2, _a97, _b76, PgSmallIntBuilder2, _a98, _b77, PgSmallInt2, init_smallint2, _a99, _b78, PgSmallSerialBuilder2, _a100, _b79, PgSmallSerial2, init_smallserial2, _a101, _b80, PgTextBuilder2, _a102, _b81, PgText2, init_text2, _a103, _b82, PgTimeBuilder2, _a104, _b83, PgTime2, init_time2, _a105, _b84, PgTimestampBuilder2, _a106, _b85, PgTimestamp2, _a107, _b86, PgTimestampStringBuilder2, _a108, _b87, PgTimestampString2, init_timestamp2, _a109, _b88, PgUUIDBuilder2, _a110, _b89, PgUUID2, init_uuid3, _a111, _b90, PgVarcharBuilder2, _a112, _b91, PgVarchar2, init_varchar2, _a113, _b92, PgBinaryVectorBuilder2, _a114, _b93, PgBinaryVector2, init_bit2, _a115, _b94, PgHalfVectorBuilder2, _a116, _b95, PgHalfVector2, init_halfvec2, _a117, _b96, PgSparseVectorBuilder2, _a118, _b97, PgSparseVector2, init_sparsevec2, _a119, _b98, PgVectorBuilder2, _a120, _b99, PgVector2, init_vector3, init_all2, InlineForeignKeys2, EnableRLS2, _a121, _b100, _c3, _d2, _e22, _f2, PgTable2, pgTable2, init_table22, _a122, PrimaryKeyBuilder2, _a123, PrimaryKey2, init_primary_keys2, eq2, ne4, gt3, gte2, lt4, lte2, init_conditions2, init_select3, init_expressions2, _a124, Relation2, _a125, Relations2, _a126, _b101, _One, One2, _a127, _b102, _Many, Many2, init_relations2, init_aggregate2, init_vector22, init_functions2, init_sql22, dist_exports, init_dist9, init_alias22, _a128, CheckBuilder, _a129, Check, init_checks6, init_columns2, _a130, _SelectionProxyHandler, SelectionProxyHandler2, init_selection_proxy2, _a131, IndexBuilderOn2, _a132, IndexBuilder2, _a133, Index2, init_indexes2, _a134, PgPolicy, init_policies2, PgViewConfig2, init_view_common22, _a135, CasingCache2, init_casing2, _a136, _b103, PgViewBase2, init_view_base2, _a137, PgDialect2, init_dialect2, _a138, TypedQueryBuilder2, init_query_builder3, _a139, PgSelectBuilder2, _a140, _b104, PgSelectQueryBuilderBase2, _a141, _b105, PgSelectBase2, getPgSetOperators2, union22, unionAll2, intersect2, intersectAll2, except2, exceptAll2, init_select22, _a142, QueryBuilder2, init_query_builder22, _a143, DefaultViewBuilderCore, _a144, _b106, ViewBuilder, _a145, _b107, ManualViewBuilder, _a146, MaterializedViewBuilderCore, _a147, _b108, MaterializedViewBuilder, _a148, _b109, ManualMaterializedViewBuilder, _a149, _b110, _c4, PgView2, PgMaterializedViewConfig2, _a150, _b111, _c5, PgMaterializedView, init_view2, init_utils42, _a151, _b112, PgDeleteBase2, init_delete2, _a152, PgInsertBuilder2, _a153, _b113, PgInsertBase2, init_insert2, _a154, _b114, PgRefreshMaterializedView2, init_refresh_materialized_view2, init_select_types, _a155, PgUpdateBuilder2, _a156, _b115, PgUpdateBase2, init_update2, init_query_builders2, _a157, _b116, _c6, _PgCountBuilder, PgCountBuilder2, init_count2, _a158, RelationalQueryBuilder2, _a159, _b117, PgRelationalQuery2, init_query2, _a160, _b118, PgRaw2, init_raw2, _a161, PgDatabase2, init_db2, _a162, PgRole, init_roles2, _a163, PgSequence, init_sequence2, _a164, PgSchema5, init_schema3, _a165, Cache, _a166, _b119, NoopCache, init_cache, _a167, PgPreparedQuery2, _a168, PgSession2, _a169, _b120, PgTransaction2, init_session3, init_subquery22, init_utils52, init_pg_core2, vectorOps, init_vector32, sqlToStr, init_utils62, indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery, init_pgSerializer, import_hanji4, Select, init_selector_ui, init_alias32, _a170, CheckBuilder2, _a171, Check2, init_checks22, _a172, ForeignKeyBuilder22, _a173, ForeignKey22, init_foreign_keys22, _a174, UniqueConstraintBuilder2, _a175, UniqueOnConstraintBuilder2, _a176, UniqueConstraint2, init_unique_constraint22, _a177, _b121, SQLiteColumnBuilder, _a178, _b122, SQLiteColumn, init_common3, _a179, _b123, SQLiteBigIntBuilder, _a180, _b124, SQLiteBigInt, _a181, _b125, SQLiteBlobJsonBuilder, _a182, _b126, SQLiteBlobJson, _a183, _b127, SQLiteBlobBufferBuilder, _a184, _b128, SQLiteBlobBuffer, init_blob, _a185, _b129, SQLiteCustomColumnBuilder, _a186, _b130, SQLiteCustomColumn, init_custom22, _a187, _b131, SQLiteBaseIntegerBuilder, _a188, _b132, SQLiteBaseInteger, _a189, _b133, SQLiteIntegerBuilder, _a190, _b134, SQLiteInteger, _a191, _b135, SQLiteTimestampBuilder, _a192, _b136, SQLiteTimestamp, _a193, _b137, SQLiteBooleanBuilder, _a194, _b138, SQLiteBoolean, init_integer22, _a195, _b139, SQLiteNumericBuilder, _a196, _b140, SQLiteNumeric, _a197, _b141, SQLiteNumericNumberBuilder, _a198, _b142, SQLiteNumericNumber, _a199, _b143, SQLiteNumericBigIntBuilder, _a200, _b144, SQLiteNumericBigInt, init_numeric22, _a201, _b145, SQLiteRealBuilder, _a202, _b146, SQLiteReal, init_real22, _a203, _b147, SQLiteTextBuilder, _a204, _b148, SQLiteText, _a205, _b149, SQLiteTextJsonBuilder, _a206, _b150, SQLiteTextJson, init_text22, init_columns22, init_all22, InlineForeignKeys22, _a207, _b151, _c7, _d3, _e32, SQLiteTable, sqliteTable, init_table32, _a208, IndexBuilderOn22, _a209, IndexBuilder22, _a210, Index4, init_indexes22, _a211, PrimaryKeyBuilder22, _a212, PrimaryKey22, init_primary_keys22, init_utils72, _a213, _b152, SQLiteDeleteBase, init_delete22, _a214, _b153, SQLiteViewBase, init_view_base22, _a215, SQLiteDialect, _a216, _b154, SQLiteSyncDialect, _a217, _b155, SQLiteAsyncDialect, init_dialect22, _a218, SQLiteSelectBuilder, _a219, _b156, SQLiteSelectQueryBuilderBase, _a220, _b157, SQLiteSelectBase, getSQLiteSetOperators, union32, unionAll22, intersect22, except22, init_select32, _a221, QueryBuilder22, init_query_builder32, _a2222, SQLiteInsertBuilder, _a223, _b158, SQLiteInsertBase, init_insert22, init_select_types2, _a224, SQLiteUpdateBuilder, _a225, _b159, SQLiteUpdateBase, init_update22, init_query_builders22, _a226, _b160, _c8, _SQLiteCountBuilder, SQLiteCountBuilder, init_count22, _a227, RelationalQueryBuilder22, _a228, _b161, SQLiteRelationalQuery, _a229, _b162, SQLiteSyncRelationalQuery, init_query22, _a230, _b163, SQLiteRaw, init_raw22, _a231, BaseSQLiteDatabase, init_db22, _a232, _b164, ExecuteResultSync, _a233, SQLitePreparedQuery, _a234, SQLiteSession, _a235, _b165, SQLiteTransaction, init_session22, init_subquery3, _a236, ViewBuilderCore, _a237, _b166, ViewBuilder2, _a238, _b167, ManualViewBuilder2, _a239, _b168, SQLiteView2, init_view22, init_sqlite_core, generateSqliteSnapshot, fromDatabase2, init_sqliteSerializer, getTablesFilterByExtensions, init_getTablesFilterByExtensions, init_alias4, _a240, CheckBuilder3, _a241, Check3, init_checks32, _a242, ForeignKeyBuilder3, _a243, ForeignKey3, init_foreign_keys3, _a244, UniqueConstraintBuilder3, _a245, UniqueOnConstraintBuilder3, _a246, UniqueConstraint3, init_unique_constraint3, _a247, _b169, MySqlColumnBuilder, _a248, _b170, MySqlColumn, _a249, _b171, MySqlColumnBuilderWithAutoIncrement, _a250, _b172, MySqlColumnWithAutoIncrement, init_common4, _a251, _b173, MySqlBigInt53Builder, _a252, _b174, MySqlBigInt53, _a253, _b175, MySqlBigInt64Builder, _a254, _b176, MySqlBigInt64, init_bigint22, _a255, _b177, MySqlBinaryBuilder, _a256, _b178, MySqlBinary, init_binary, _a257, _b179, MySqlBooleanBuilder, _a258, _b180, MySqlBoolean, init_boolean22, _a259, _b181, MySqlCharBuilder, _a260, _b182, MySqlChar, init_char22, _a261, _b183, MySqlCustomColumnBuilder, _a262, _b184, MySqlCustomColumn, init_custom3, _a263, _b185, MySqlDateBuilder, _a264, _b186, MySqlDate, _a265, _b187, MySqlDateStringBuilder, _a266, _b188, MySqlDateString, init_date22, _a267, _b189, MySqlDateTimeBuilder, _a268, _b190, MySqlDateTime, _a269, _b191, MySqlDateTimeStringBuilder, _a270, _b192, MySqlDateTimeString, init_datetime, _a271, _b193, MySqlDecimalBuilder, _a272, _b194, MySqlDecimal, _a273, _b195, MySqlDecimalNumberBuilder, _a274, _b196, MySqlDecimalNumber, _a275, _b197, MySqlDecimalBigIntBuilder, _a276, _b198, MySqlDecimalBigInt, init_decimal, _a277, _b199, MySqlDoubleBuilder, _a278, _b200, MySqlDouble, init_double, _a279, _b201, MySqlEnumColumnBuilder, _a280, _b202, MySqlEnumColumn, _a281, _b203, MySqlEnumObjectColumnBuilder, _a282, _b204, MySqlEnumObjectColumn, init_enum22, _a283, _b205, MySqlFloatBuilder, _a284, _b206, MySqlFloat, init_float, _a285, _b207, MySqlIntBuilder, _a286, _b208, MySqlInt, init_int, _a287, _b209, MySqlJsonBuilder, _a288, _b210, MySqlJson, init_json22, _a289, _b211, MySqlMediumIntBuilder, _a290, _b212, MySqlMediumInt, init_mediumint, _a291, _b213, MySqlRealBuilder, _a292, _b214, MySqlReal, init_real3, _a293, _b215, MySqlSerialBuilder, _a294, _b216, MySqlSerial, init_serial22, _a295, _b217, MySqlSmallIntBuilder, _a296, _b218, MySqlSmallInt, init_smallint22, _a297, _b219, MySqlTextBuilder, _a298, _b220, MySqlText, init_text3, _a299, _b221, MySqlTimeBuilder, _a300, _b222, MySqlTime, init_time22, _a301, _b223, MySqlDateColumnBaseBuilder, _a302, _b224, MySqlDateBaseColumn, init_date_common22, _a303, _b225, MySqlTimestampBuilder, _a304, _b226, MySqlTimestamp, _a305, _b227, MySqlTimestampStringBuilder, _a306, _b228, MySqlTimestampString, init_timestamp22, _a307, _b229, MySqlTinyIntBuilder, _a308, _b230, MySqlTinyInt, init_tinyint, _a309, _b231, MySqlVarBinaryBuilder, _a310, _b232, MySqlVarBinary, init_varbinary, _a311, _b233, MySqlVarCharBuilder, _a312, _b234, MySqlVarChar, init_varchar22, _a313, _b235, MySqlYearBuilder, _a314, _b236, MySqlYear, init_year, init_columns3, _a315, _b237, _c9, _MySqlCountBuilder, MySqlCountBuilder, init_count3, _a316, IndexBuilderOn3, _a317, IndexBuilder3, _a318, Index5, init_indexes3, init_all3, InlineForeignKeys3, _a319, _b238, _c10, _d4, _e4, MySqlTable, mysqlTable, init_table42, _a320, PrimaryKeyBuilder3, _a321, PrimaryKey3, init_primary_keys3, MySqlViewConfig, init_view_common32, init_utils8, _a3222, _b239, MySqlDeleteBase, init_delete3, _a323, _b240, MySqlViewBase, init_view_base3, _a324, MySqlDialect, init_dialect3, _a325, MySqlSelectBuilder, _a326, _b241, MySqlSelectQueryBuilderBase, _a327, _b242, MySqlSelectBase, getMySqlSetOperators, union4, unionAll3, intersect3, intersectAll22, except3, exceptAll22, init_select4, _a328, QueryBuilder3, init_query_builder4, _a329, MySqlInsertBuilder, _a330, _b243, MySqlInsertBase, init_insert3, init_select_types3, _a331, MySqlUpdateBuilder, _a332, _b244, MySqlUpdateBase, init_update3, init_query_builders3, _a333, RelationalQueryBuilder3, _a334, _b245, MySqlRelationalQuery, init_query3, _a335, MySqlDatabase, init_db3, _a336, ViewBuilderCore2, _a337, _b246, ViewBuilder3, _a338, _b247, ManualViewBuilder3, _a339, _b248, _c11, MySqlView2, init_view3, _a340, MySqlSchema5, init_schema22, _a341, MySqlPreparedQuery, _a342, MySqlSession, _a343, _b249, MySqlTransaction, init_session32, init_subquery4, init_mysql_core, handleEnumType, generateMySqlSnapshot, fromDatabase3, init_mysqlSerializer, cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck, init_cli, gelCredentials, init_gel, libSQLCredentials, init_libsql, mysqlCredentials, init_mysql, postgresCredentials, init_postgres, singlestoreCredentials, init_singlestore, sqliteCredentials, init_sqlite, credentials, studioCliParams, studioConfig, init_studio, es5_exports, _3, es5_default, init_es5, import_hanji7, assertES5, safeRegister, migrateConfig, init_utils9, prepareFromExports, init_pgImports, init_alias5, _a344, UniqueConstraintBuilder4, _a345, UniqueOnConstraintBuilder4, _a346, UniqueConstraint4, init_unique_constraint4, _a347, _b250, SingleStoreColumnBuilder, _a348, _b251, SingleStoreColumn, _a349, _b252, SingleStoreColumnBuilderWithAutoIncrement, _a350, _b253, SingleStoreColumnWithAutoIncrement, init_common5, _a351, _b254, SingleStoreBigInt53Builder, _a352, _b255, SingleStoreBigInt53, _a353, _b256, SingleStoreBigInt64Builder, _a354, _b257, SingleStoreBigInt64, init_bigint3, _a355, _b258, SingleStoreBinaryBuilder, _a356, _b259, SingleStoreBinary, init_binary2, _a357, _b260, SingleStoreBooleanBuilder, _a358, _b261, SingleStoreBoolean, init_boolean3, _a359, _b262, SingleStoreCharBuilder, _a360, _b263, SingleStoreChar, init_char3, _a361, _b264, SingleStoreCustomColumnBuilder, _a362, _b265, SingleStoreCustomColumn, init_custom4, _a363, _b266, SingleStoreDateBuilder, _a364, _b267, SingleStoreDate, _a365, _b268, SingleStoreDateStringBuilder, _a366, _b269, SingleStoreDateString, init_date3, _a367, _b270, SingleStoreDateTimeBuilder, _a368, _b271, SingleStoreDateTime, _a369, _b272, SingleStoreDateTimeStringBuilder, _a370, _b273, SingleStoreDateTimeString, init_datetime2, _a371, _b274, SingleStoreDecimalBuilder, _a372, _b275, SingleStoreDecimal, _a373, _b276, SingleStoreDecimalNumberBuilder, _a374, _b277, SingleStoreDecimalNumber, _a375, _b278, SingleStoreDecimalBigIntBuilder, _a376, _b279, SingleStoreDecimalBigInt, init_decimal2, _a377, _b280, SingleStoreDoubleBuilder, _a378, _b281, SingleStoreDouble, init_double2, _a379, _b282, SingleStoreEnumColumnBuilder, _a380, _b283, SingleStoreEnumColumn, init_enum3, _a381, _b284, SingleStoreFloatBuilder, _a382, _b285, SingleStoreFloat, init_float2, _a383, _b286, SingleStoreIntBuilder, _a384, _b287, SingleStoreInt, init_int2, _a385, _b288, SingleStoreJsonBuilder, _a386, _b289, SingleStoreJson, init_json3, _a387, _b290, SingleStoreMediumIntBuilder, _a388, _b291, SingleStoreMediumInt, init_mediumint2, _a389, _b292, SingleStoreRealBuilder, _a390, _b293, SingleStoreReal, init_real4, _a391, _b294, SingleStoreSerialBuilder, _a392, _b295, SingleStoreSerial, init_serial3, _a393, _b296, SingleStoreSmallIntBuilder, _a394, _b297, SingleStoreSmallInt, init_smallint3, _a395, _b298, SingleStoreTextBuilder, _a396, _b299, SingleStoreText, init_text4, _a397, _b300, SingleStoreTimeBuilder, _a398, _b301, SingleStoreTime, init_time3, _a399, _b302, SingleStoreDateColumnBaseBuilder, _a400, _b303, SingleStoreDateBaseColumn, init_date_common3, _a401, _b304, SingleStoreTimestampBuilder, _a402, _b305, SingleStoreTimestamp, _a403, _b306, SingleStoreTimestampStringBuilder, _a404, _b307, SingleStoreTimestampString, init_timestamp3, _a405, _b308, SingleStoreTinyIntBuilder, _a406, _b309, SingleStoreTinyInt, init_tinyint2, _a407, _b310, SingleStoreVarBinaryBuilder, _a408, _b311, SingleStoreVarBinary, init_varbinary2, _a409, _b312, SingleStoreVarCharBuilder, _a410, _b313, SingleStoreVarChar, init_varchar3, _a411, _b314, SingleStoreVectorBuilder, _a412, _b315, SingleStoreVector, init_vector4, _a413, _b316, SingleStoreYearBuilder, _a414, _b317, SingleStoreYear, init_year2, init_columns4, _a415, _b318, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder, init_count4, _a416, IndexBuilderOn4, _a417, IndexBuilder4, _a418, Index6, init_indexes4, init_all4, _a419, _b319, _c13, _d5, SingleStoreTable, init_table52, _a420, PrimaryKeyBuilder4, _a421, PrimaryKey4, init_primary_keys4, init_utils10, _a422, _b320, SingleStoreDeleteBase, init_delete4, _a423, SingleStoreInsertBuilder, _a424, _b321, SingleStoreInsertBase, init_insert4, _a425, SingleStoreDialect, init_dialect4, _a426, SingleStoreSelectBuilder, _a427, _b322, SingleStoreSelectQueryBuilderBase, _a428, _b323, SingleStoreSelectBase, getSingleStoreSetOperators, union5, unionAll4, intersect4, except4, minus, init_select5, _a429, QueryBuilder4, init_query_builder5, init_select_types4, _a430, SingleStoreUpdateBuilder, _a431, _b324, SingleStoreUpdateBase, init_update4, init_query_builders4, _a432, SingleStoreDatabase, init_db4, _a433, SingleStoreSchema5, init_schema32, _a434, SingleStorePreparedQuery, _a435, SingleStoreSession, _a436, _b325, SingleStoreTransaction, init_session4, init_subquery5, init_singlestore_core, dialect5, generateSingleStoreSnapshot, fromDatabase4, init_singlestoreSerializer, sqliteImports_exports, prepareFromExports2, prepareFromSqliteImports, init_sqliteImports, mysqlImports_exports, prepareFromExports3, prepareFromMySqlImports, init_mysqlImports, mysqlPushUtils_exports, import_hanji8, filterStatements, logSuggestionsAndReturn2, init_mysqlPushUtils, mysqlIntrospect_exports, import_hanji9, mysqlPushIntrospect, init_mysqlIntrospect, singlestoreImports_exports, prepareFromExports4, prepareFromSingleStoreImports, init_singlestoreImports, singlestorePushUtils_exports, import_hanji10, filterStatements2, logSuggestionsAndReturn3, init_singlestorePushUtils, singlestoreIntrospect_exports, import_hanji11, singlestorePushIntrospect, init_singlestoreIntrospect, import_hanji3, pgPushIntrospect = async (db2, filters, schemaFilters, entities, tsSchema) => {
|
|
103391
|
+
}, __toESM5 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value), ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles2, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default, init_ansi_styles, env, flagForceColor, supportsColor, supports_color_default, init_supports_color, init_utilities, stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles22, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default, init_source, require_old, require_fs, require_path, require_balanced_match, require_brace_expansion, require_minimatch, require_inherits_browser2, require_inherits2, require_common3, require_sync, require_wrappy, require_once, require_inflight, require_glob, require_readline, require_src3, require_utils4, require_lodash, require_hanji, originUUID, snapshotVersion, mapValues, mapKeys, mapEntries, customMapEntries, init_global2, util3, objectUtil2, ZodParsedType2, getParsedType4, init_util4, ZodIssueCode4, ZodError5, init_ZodError2, errorMap2, en_default4, init_en4, overrideErrorMap2, init_errors9, makeIssue2, ParseStatus2, INVALID3, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, init_parseUtil2, init_typeAliases2, errorUtil2, init_errorUtil2, ParseInputLazyPath2, handleResult2, ZodType4, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString4, ZodNumber4, ZodBigInt4, ZodBoolean4, ZodDate4, ZodSymbol4, ZodUndefined4, ZodNull4, ZodAny4, ZodUnknown4, ZodNever4, ZodVoid4, ZodArray4, ZodObject4, ZodUnion4, getDiscriminator2, ZodDiscriminatedUnion4, ZodIntersection4, ZodTuple4, ZodRecord4, ZodMap4, ZodSet4, ZodFunction3, ZodLazy4, ZodLiteral4, ZodEnum4, ZodNativeEnum2, ZodPromise4, ZodEffects2, ZodOptional4, ZodNullable4, ZodDefault4, ZodCatch4, ZodNaN4, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly4, late2, ZodFirstPartyTypeKind3, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, coerce2, init_types5, init_external4, init_v32, init_esm2, enumSchema, enumSchemaV1, indexColumn, index2, fk, sequenceSchema, roleSchema, sequenceSquashed, column2, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, table8, schemaHash, kitInternals, gelSchemaExternal, gelSchemaInternal, tableSquashed, gelSchemaSquashed, gelSchema, dryGel, init_gelSchema, index22, fk2, column22, tableV3, compositePK2, uniqueConstraint2, checkConstraint2, tableV4, table22, viewMeta, view22, kitInternals2, dialect2, schemaHash2, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema2, tableSquashedV4, tableSquashed2, viewSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql, init_mysqlSchema, indexV2, columnV2, tableV2, enumSchemaV12, enumSchema2, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn2, index3, indexV4, indexV5, indexV6, fk3, sequenceSchema2, roleSchema2, sequenceSquashed2, columnV7, column3, checkConstraint3, columnSquashed2, tableV32, compositePK3, uniqueConstraint3, policy2, policySquashed2, viewWithOption2, matViewWithOption2, mergedViewWithOption2, view3, tableV42, tableV5, tableV6, tableV7, table32, schemaHash3, kitInternals3, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed3, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg, init_pgSchema, index4, column4, compositePK4, uniqueConstraint4, table42, viewMeta2, kitInternals4, dialect22, schemaHash4, schemaInternal2, schema22, tableSquashed4, schemaSquashed2, SingleStoreSquasher, squashSingleStoreScheme, singlestoreSchema, singlestoreSchemaSquashed, backwardCompatibleSingleStoreSchema, drySingleStore, init_singlestoreSchema, index5, fk4, compositePK5, column5, tableV33, uniqueConstraint5, checkConstraint4, table52, view4, dialect3, schemaHash5, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals5, latestVersion, schemaInternal3, schemaV32, schemaV42, schemaV52, schema3, tableSquashed5, schemaSquashed3, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema, init_sqliteSchema, copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, init_utils7, import_hanji, warning, error88, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner2, ProgressView, init_views, glob, init_serializer, fillPgSnapshot, init_migrationPreparator, require_heap, require_heap2, require_difflib, require_difflib2, require_util2, require_styles, require_has_flag2, require_supports_colors, require_trap, require_zalgo, require_america, require_zebra, require_rainbow, require_random, require_colors, require_safe, require_colorize, require_lib4, import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn, init_jsonDiffer, parseType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgCreateIndPolicyConvertor, PgDropIndPolicyConvertor, PgRenameIndPolicyConvertor, PgAlterIndPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SingleStoreCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, SingleStoreAlterTableAddUniqueConstraintConvertor, SingleStoreAlterTableDropUniqueConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SingleStoreDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, SingleStoreRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SingleStoreAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SingleStoreAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SingleStoreAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, SingleStoreAlterTableAlterColumnAlterrGeneratedConvertor, SingleStoreAlterTableAddPk, SingleStoreAlterTableDropPk, SingleStoreModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSingleStoreIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SingleStoreDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, SingleStoreRecreateTableConvertor, convertors, init_sqlgenerator, _moveDataStatements, getOldTableName, getNewTableName, logSuggestionsAndReturn, init_sqlitePushUtils, preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSingleStoreCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareRenameIndPolicyJsons, prepareCreatePolicyJsons, prepareCreateIndPolicyJsons, prepareDropPolicyJsons, prepareDropIndPolicyJsons, prepareAlterPolicyJson, prepareAlterIndPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView, init_jsonStatements, prepareLibSQLRecreateTable, prepareSQLiteRecreateTable, libSQLCombineStatements, sqliteCombineStatements, prepareSingleStoreRecreateTable, singleStoreCombineStatements, init_statementCombiner, snapshotsDiffer_exports, makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, columnSchema, alteredColumnSchema, enumSchema3, changedEnumSchema, tableScheme, alteredTableScheme, alteredViewCommon, alteredPgViewSchema, alteredMySqlViewSchema, diffResultScheme, diffResultSchemeMysql, diffResultSchemeSingleStore, diffResultSchemeSQLite, schemaChangeFor, nameChangeFor, nameSchemaChangeFor, columnChangeFor, applyPgSnapshotsDiff, applyMysqlSnapshotsDiff, applySingleStoreSnapshotsDiff, applySqliteSnapshotsDiff, applyLibSQLSnapshotsDiff, init_snapshotsDiffer, init_words, dialects, dialect4, commonSquashedSchema, commonSchema, init_schemaValidator, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTypes, casingType, sqliteDriver, postgresDriver, driver2, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, init_common2, withStyle, init_outputs, import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, init_migrate, posixClasses, braceEscape, regexpEscape, rangesToString, parseClass, init_brace_expressions, escape, init_escape, unescape, init_unescape, import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep2, GLOBSTAR, plTypes, qmark, star, twoStarDot, twoStarNoDot, charSet, reSpecials, addPatternStartSet, filter, ext, defaults, braceExpand, MAX_PATTERN_LENGTH, assertValidPattern, makeRe, match2, globUnescape, globMagic, regExpEscape, Minimatch, init_mjs, entityKind2, hasOwnEntityKind2, init_entity2, _a3, Column2, init_column2, _a22, ColumnBuilder2, init_column_builder2, TableName2, init_table_utils2, _a32, ForeignKeyBuilder2, _a4, ForeignKey2, init_foreign_keys2, init_tracing_utils2, _a5, UniqueConstraintBuilder, _a6, UniqueOnConstraintBuilder, _a7, UniqueConstraint, init_unique_constraint2, init_array2, _a8, _b, PgColumnBuilder2, _a9, _b2, PgColumn2, _a10, _b3, ExtraConfigColumn2, _a11, IndexedColumn2, _a12, _b4, PgArrayBuilder2, _a13, _b5, _PgArray, PgArray2, init_common22, _a14, _b6, PgEnumObjectColumnBuilder2, _a15, _b7, PgEnumObjectColumn2, isPgEnumSym2, _a16, _b8, PgEnumColumnBuilder2, _a17, _b9, PgEnumColumn2, init_enum2, _a18, Subquery2, _a19, _b10, WithSubquery2, init_subquery2, version4, init_version2, otel2, rawTracer2, tracer2, init_tracing2, ViewBaseConfig2, init_view_common3, Schema2, Columns2, ExtraConfigColumns2, OriginalName2, BaseName2, IsAlias2, ExtraConfigBuilder2, IsDrizzleTable2, _a20, _b11, _c, _d, _e3, _f, _g, _h, _i, _j, Table2, init_table8, _a21, FakePrimitiveParam, _a222, StringChunk2, _a23, _SQL, SQL2, _a24, Name2, noopDecoder2, noopEncoder2, noopMapper2, _a25, Param2, _a26, Placeholder2, IsDrizzleView2, _a27, _b12, _c2, View3, init_sql4, _a28, ColumnAliasProxyHandler2, _a29, TableAliasProxyHandler2, _a30, RelationTableAliasProxyHandler, init_alias3, _a31, _b13, DrizzleError2, DrizzleQueryError, _a322, _b14, TransactionRollbackError2, init_errors22, _a33, ConsoleLogWriter2, _a34, DefaultLogger2, _a35, NoopLogger2, init_logger3, init_operations, _a36, _b15, QueryPromise2, init_query_promise2, textDecoder, init_utils22, _a37, _b16, PgIntColumnBaseBuilder2, init_int_common2, _a38, _b17, PgBigInt53Builder2, _a39, _b18, PgBigInt532, _a40, _b19, PgBigInt64Builder2, _a41, _b20, PgBigInt642, init_bigint2, _a42, _b21, PgBigSerial53Builder2, _a43, _b22, PgBigSerial532, _a44, _b23, PgBigSerial64Builder2, _a45, _b24, PgBigSerial642, init_bigserial2, _a46, _b25, PgBooleanBuilder2, _a47, _b26, PgBoolean2, init_boolean2, _a48, _b27, PgCharBuilder2, _a49, _b28, PgChar2, init_char2, _a50, _b29, PgCidrBuilder2, _a51, _b30, PgCidr2, init_cidr2, _a52, _b31, PgCustomColumnBuilder2, _a53, _b32, PgCustomColumn2, init_custom2, _a54, _b33, PgDateColumnBaseBuilder2, init_date_common2, _a55, _b34, PgDateBuilder2, _a56, _b35, PgDate2, _a57, _b36, PgDateStringBuilder2, _a58, _b37, PgDateString2, init_date2, _a59, _b38, PgDoublePrecisionBuilder2, _a60, _b39, PgDoublePrecision2, init_double_precision2, _a61, _b40, PgInetBuilder2, _a62, _b41, PgInet2, init_inet2, _a63, _b42, PgIntegerBuilder2, _a64, _b43, PgInteger2, init_integer2, _a65, _b44, PgIntervalBuilder2, _a66, _b45, PgInterval2, init_interval2, _a67, _b46, PgJsonBuilder2, _a68, _b47, PgJson2, init_json2, _a69, _b48, PgJsonbBuilder2, _a70, _b49, PgJsonb2, init_jsonb2, _a71, _b50, PgLineBuilder2, _a72, _b51, PgLineTuple2, _a73, _b52, PgLineABCBuilder2, _a74, _b53, PgLineABC2, init_line2, _a75, _b54, PgMacaddrBuilder2, _a76, _b55, PgMacaddr2, init_macaddr2, _a77, _b56, PgMacaddr8Builder2, _a78, _b57, PgMacaddr82, init_macaddr82, _a79, _b58, PgNumericBuilder2, _a80, _b59, PgNumeric2, _a81, _b60, PgNumericNumberBuilder2, _a82, _b61, PgNumericNumber2, _a83, _b62, PgNumericBigIntBuilder2, _a84, _b63, PgNumericBigInt2, init_numeric2, _a85, _b64, PgPointTupleBuilder2, _a86, _b65, PgPointTuple2, _a87, _b66, PgPointObjectBuilder2, _a88, _b67, PgPointObject2, init_point2, init_utils32, _a89, _b68, PgGeometryBuilder2, _a90, _b69, PgGeometry2, _a91, _b70, PgGeometryObjectBuilder2, _a92, _b71, PgGeometryObject2, init_geometry2, _a93, _b72, PgRealBuilder2, _a94, _b73, PgReal2, init_real2, _a95, _b74, PgSerialBuilder2, _a96, _b75, PgSerial2, init_serial2, _a97, _b76, PgSmallIntBuilder2, _a98, _b77, PgSmallInt2, init_smallint2, _a99, _b78, PgSmallSerialBuilder2, _a100, _b79, PgSmallSerial2, init_smallserial2, _a101, _b80, PgTextBuilder2, _a102, _b81, PgText2, init_text2, _a103, _b82, PgTimeBuilder2, _a104, _b83, PgTime2, init_time2, _a105, _b84, PgTimestampBuilder2, _a106, _b85, PgTimestamp2, _a107, _b86, PgTimestampStringBuilder2, _a108, _b87, PgTimestampString2, init_timestamp2, _a109, _b88, PgUUIDBuilder2, _a110, _b89, PgUUID2, init_uuid3, _a111, _b90, PgVarcharBuilder2, _a112, _b91, PgVarchar2, init_varchar2, _a113, _b92, PgBinaryVectorBuilder2, _a114, _b93, PgBinaryVector2, init_bit2, _a115, _b94, PgHalfVectorBuilder2, _a116, _b95, PgHalfVector2, init_halfvec2, _a117, _b96, PgSparseVectorBuilder2, _a118, _b97, PgSparseVector2, init_sparsevec2, _a119, _b98, PgVectorBuilder2, _a120, _b99, PgVector2, init_vector3, init_all2, InlineForeignKeys2, EnableRLS2, _a121, _b100, _c3, _d2, _e22, _f2, PgTable2, pgTable2, init_table22, _a122, PrimaryKeyBuilder2, _a123, PrimaryKey2, init_primary_keys2, eq2, ne4, gt3, gte2, lt4, lte2, init_conditions2, init_select3, init_expressions2, _a124, Relation2, _a125, Relations2, _a126, _b101, _One, One2, _a127, _b102, _Many, Many2, init_relations2, init_aggregate2, init_vector22, init_functions2, init_sql22, dist_exports, init_dist9, init_alias22, _a128, CheckBuilder, _a129, Check, init_checks6, init_columns2, _a130, _SelectionProxyHandler, SelectionProxyHandler2, init_selection_proxy2, _a131, IndexBuilderOn2, _a132, IndexBuilder2, _a133, Index2, init_indexes2, _a134, PgPolicy, init_policies2, PgViewConfig2, init_view_common22, _a135, CasingCache2, init_casing2, _a136, _b103, PgViewBase2, init_view_base2, _a137, PgDialect2, init_dialect2, _a138, TypedQueryBuilder2, init_query_builder3, _a139, PgSelectBuilder2, _a140, _b104, PgSelectQueryBuilderBase2, _a141, _b105, PgSelectBase2, getPgSetOperators2, union22, unionAll2, intersect2, intersectAll2, except2, exceptAll2, init_select22, _a142, QueryBuilder2, init_query_builder22, _a143, DefaultViewBuilderCore, _a144, _b106, ViewBuilder, _a145, _b107, ManualViewBuilder, _a146, MaterializedViewBuilderCore, _a147, _b108, MaterializedViewBuilder, _a148, _b109, ManualMaterializedViewBuilder, _a149, _b110, _c4, PgView2, PgMaterializedViewConfig2, _a150, _b111, _c5, PgMaterializedView, init_view2, init_utils42, _a151, _b112, PgDeleteBase2, init_delete2, _a152, PgInsertBuilder2, _a153, _b113, PgInsertBase2, init_insert2, _a154, _b114, PgRefreshMaterializedView2, init_refresh_materialized_view2, init_select_types, _a155, PgUpdateBuilder2, _a156, _b115, PgUpdateBase2, init_update2, init_query_builders2, _a157, _b116, _c6, _PgCountBuilder, PgCountBuilder2, init_count2, _a158, RelationalQueryBuilder2, _a159, _b117, PgRelationalQuery2, init_query2, _a160, _b118, PgRaw2, init_raw2, _a161, PgDatabase2, init_db2, _a162, PgRole, init_roles2, _a163, PgSequence, init_sequence2, _a164, PgSchema5, init_schema4, _a165, Cache, _a166, _b119, NoopCache, init_cache, _a167, PgPreparedQuery2, _a168, PgSession2, _a169, _b120, PgTransaction2, init_session3, init_subquery22, init_utils52, init_pg_core2, vectorOps, init_vector32, sqlToStr, init_utils62, indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery, init_pgSerializer, import_hanji4, Select, init_selector_ui, init_alias32, _a170, CheckBuilder2, _a171, Check2, init_checks22, _a172, ForeignKeyBuilder22, _a173, ForeignKey22, init_foreign_keys22, _a174, UniqueConstraintBuilder2, _a175, UniqueOnConstraintBuilder2, _a176, UniqueConstraint2, init_unique_constraint22, _a177, _b121, SQLiteColumnBuilder, _a178, _b122, SQLiteColumn, init_common3, _a179, _b123, SQLiteBigIntBuilder, _a180, _b124, SQLiteBigInt, _a181, _b125, SQLiteBlobJsonBuilder, _a182, _b126, SQLiteBlobJson, _a183, _b127, SQLiteBlobBufferBuilder, _a184, _b128, SQLiteBlobBuffer, init_blob, _a185, _b129, SQLiteCustomColumnBuilder, _a186, _b130, SQLiteCustomColumn, init_custom22, _a187, _b131, SQLiteBaseIntegerBuilder, _a188, _b132, SQLiteBaseInteger, _a189, _b133, SQLiteIntegerBuilder, _a190, _b134, SQLiteInteger, _a191, _b135, SQLiteTimestampBuilder, _a192, _b136, SQLiteTimestamp, _a193, _b137, SQLiteBooleanBuilder, _a194, _b138, SQLiteBoolean, init_integer22, _a195, _b139, SQLiteNumericBuilder, _a196, _b140, SQLiteNumeric, _a197, _b141, SQLiteNumericNumberBuilder, _a198, _b142, SQLiteNumericNumber, _a199, _b143, SQLiteNumericBigIntBuilder, _a200, _b144, SQLiteNumericBigInt, init_numeric22, _a201, _b145, SQLiteRealBuilder, _a202, _b146, SQLiteReal, init_real22, _a203, _b147, SQLiteTextBuilder, _a204, _b148, SQLiteText, _a205, _b149, SQLiteTextJsonBuilder, _a206, _b150, SQLiteTextJson, init_text22, init_columns22, init_all22, InlineForeignKeys22, _a207, _b151, _c7, _d3, _e32, SQLiteTable, sqliteTable, init_table32, _a208, IndexBuilderOn22, _a209, IndexBuilder22, _a210, Index4, init_indexes22, _a211, PrimaryKeyBuilder22, _a212, PrimaryKey22, init_primary_keys22, init_utils72, _a213, _b152, SQLiteDeleteBase, init_delete22, _a214, _b153, SQLiteViewBase, init_view_base22, _a215, SQLiteDialect, _a216, _b154, SQLiteSyncDialect, _a217, _b155, SQLiteAsyncDialect, init_dialect22, _a218, SQLiteSelectBuilder, _a219, _b156, SQLiteSelectQueryBuilderBase, _a220, _b157, SQLiteSelectBase, getSQLiteSetOperators, union32, unionAll22, intersect22, except22, init_select32, _a221, QueryBuilder22, init_query_builder32, _a2222, SQLiteInsertBuilder, _a223, _b158, SQLiteInsertBase, init_insert22, init_select_types2, _a224, SQLiteUpdateBuilder, _a225, _b159, SQLiteUpdateBase, init_update22, init_query_builders22, _a226, _b160, _c8, _SQLiteCountBuilder, SQLiteCountBuilder, init_count22, _a227, RelationalQueryBuilder22, _a228, _b161, SQLiteRelationalQuery, _a229, _b162, SQLiteSyncRelationalQuery, init_query22, _a230, _b163, SQLiteRaw, init_raw22, _a231, BaseSQLiteDatabase, init_db22, _a232, _b164, ExecuteResultSync, _a233, SQLitePreparedQuery, _a234, SQLiteSession, _a235, _b165, SQLiteTransaction, init_session22, init_subquery3, _a236, ViewBuilderCore, _a237, _b166, ViewBuilder2, _a238, _b167, ManualViewBuilder2, _a239, _b168, SQLiteView2, init_view22, init_sqlite_core, generateSqliteSnapshot, fromDatabase2, init_sqliteSerializer, getTablesFilterByExtensions, init_getTablesFilterByExtensions, init_alias4, _a240, CheckBuilder3, _a241, Check3, init_checks32, _a242, ForeignKeyBuilder3, _a243, ForeignKey3, init_foreign_keys3, _a244, UniqueConstraintBuilder3, _a245, UniqueOnConstraintBuilder3, _a246, UniqueConstraint3, init_unique_constraint3, _a247, _b169, MySqlColumnBuilder, _a248, _b170, MySqlColumn, _a249, _b171, MySqlColumnBuilderWithAutoIncrement, _a250, _b172, MySqlColumnWithAutoIncrement, init_common4, _a251, _b173, MySqlBigInt53Builder, _a252, _b174, MySqlBigInt53, _a253, _b175, MySqlBigInt64Builder, _a254, _b176, MySqlBigInt64, init_bigint22, _a255, _b177, MySqlBinaryBuilder, _a256, _b178, MySqlBinary, init_binary, _a257, _b179, MySqlBooleanBuilder, _a258, _b180, MySqlBoolean, init_boolean22, _a259, _b181, MySqlCharBuilder, _a260, _b182, MySqlChar, init_char22, _a261, _b183, MySqlCustomColumnBuilder, _a262, _b184, MySqlCustomColumn, init_custom3, _a263, _b185, MySqlDateBuilder, _a264, _b186, MySqlDate, _a265, _b187, MySqlDateStringBuilder, _a266, _b188, MySqlDateString, init_date22, _a267, _b189, MySqlDateTimeBuilder, _a268, _b190, MySqlDateTime, _a269, _b191, MySqlDateTimeStringBuilder, _a270, _b192, MySqlDateTimeString, init_datetime, _a271, _b193, MySqlDecimalBuilder, _a272, _b194, MySqlDecimal, _a273, _b195, MySqlDecimalNumberBuilder, _a274, _b196, MySqlDecimalNumber, _a275, _b197, MySqlDecimalBigIntBuilder, _a276, _b198, MySqlDecimalBigInt, init_decimal, _a277, _b199, MySqlDoubleBuilder, _a278, _b200, MySqlDouble, init_double, _a279, _b201, MySqlEnumColumnBuilder, _a280, _b202, MySqlEnumColumn, _a281, _b203, MySqlEnumObjectColumnBuilder, _a282, _b204, MySqlEnumObjectColumn, init_enum22, _a283, _b205, MySqlFloatBuilder, _a284, _b206, MySqlFloat, init_float, _a285, _b207, MySqlIntBuilder, _a286, _b208, MySqlInt, init_int, _a287, _b209, MySqlJsonBuilder, _a288, _b210, MySqlJson, init_json22, _a289, _b211, MySqlMediumIntBuilder, _a290, _b212, MySqlMediumInt, init_mediumint, _a291, _b213, MySqlRealBuilder, _a292, _b214, MySqlReal, init_real3, _a293, _b215, MySqlSerialBuilder, _a294, _b216, MySqlSerial, init_serial22, _a295, _b217, MySqlSmallIntBuilder, _a296, _b218, MySqlSmallInt, init_smallint22, _a297, _b219, MySqlTextBuilder, _a298, _b220, MySqlText, init_text3, _a299, _b221, MySqlTimeBuilder, _a300, _b222, MySqlTime, init_time22, _a301, _b223, MySqlDateColumnBaseBuilder, _a302, _b224, MySqlDateBaseColumn, init_date_common22, _a303, _b225, MySqlTimestampBuilder, _a304, _b226, MySqlTimestamp, _a305, _b227, MySqlTimestampStringBuilder, _a306, _b228, MySqlTimestampString, init_timestamp22, _a307, _b229, MySqlTinyIntBuilder, _a308, _b230, MySqlTinyInt, init_tinyint, _a309, _b231, MySqlVarBinaryBuilder, _a310, _b232, MySqlVarBinary, init_varbinary, _a311, _b233, MySqlVarCharBuilder, _a312, _b234, MySqlVarChar, init_varchar22, _a313, _b235, MySqlYearBuilder, _a314, _b236, MySqlYear, init_year, init_columns3, _a315, _b237, _c9, _MySqlCountBuilder, MySqlCountBuilder, init_count3, _a316, IndexBuilderOn3, _a317, IndexBuilder3, _a318, Index5, init_indexes3, init_all3, InlineForeignKeys3, _a319, _b238, _c10, _d4, _e4, MySqlTable, mysqlTable, init_table42, _a320, PrimaryKeyBuilder3, _a321, PrimaryKey3, init_primary_keys3, MySqlViewConfig, init_view_common32, init_utils8, _a3222, _b239, MySqlDeleteBase, init_delete3, _a323, _b240, MySqlViewBase, init_view_base3, _a324, MySqlDialect, init_dialect3, _a325, MySqlSelectBuilder, _a326, _b241, MySqlSelectQueryBuilderBase, _a327, _b242, MySqlSelectBase, getMySqlSetOperators, union4, unionAll3, intersect3, intersectAll22, except3, exceptAll22, init_select4, _a328, QueryBuilder3, init_query_builder4, _a329, MySqlInsertBuilder, _a330, _b243, MySqlInsertBase, init_insert3, init_select_types3, _a331, MySqlUpdateBuilder, _a332, _b244, MySqlUpdateBase, init_update3, init_query_builders3, _a333, RelationalQueryBuilder3, _a334, _b245, MySqlRelationalQuery, init_query3, _a335, MySqlDatabase, init_db3, _a336, ViewBuilderCore2, _a337, _b246, ViewBuilder3, _a338, _b247, ManualViewBuilder3, _a339, _b248, _c11, MySqlView2, init_view3, _a340, MySqlSchema5, init_schema22, _a341, MySqlPreparedQuery, _a342, MySqlSession, _a343, _b249, MySqlTransaction, init_session32, init_subquery4, init_mysql_core, handleEnumType, generateMySqlSnapshot, fromDatabase3, init_mysqlSerializer, cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck, init_cli, gelCredentials, init_gel, libSQLCredentials, init_libsql, mysqlCredentials, init_mysql, postgresCredentials, init_postgres, singlestoreCredentials, init_singlestore, sqliteCredentials, init_sqlite, credentials, studioCliParams, studioConfig, init_studio, es5_exports, _3, es5_default, init_es5, import_hanji7, assertES5, safeRegister, migrateConfig, init_utils9, prepareFromExports, init_pgImports, init_alias5, _a344, UniqueConstraintBuilder4, _a345, UniqueOnConstraintBuilder4, _a346, UniqueConstraint4, init_unique_constraint4, _a347, _b250, SingleStoreColumnBuilder, _a348, _b251, SingleStoreColumn, _a349, _b252, SingleStoreColumnBuilderWithAutoIncrement, _a350, _b253, SingleStoreColumnWithAutoIncrement, init_common5, _a351, _b254, SingleStoreBigInt53Builder, _a352, _b255, SingleStoreBigInt53, _a353, _b256, SingleStoreBigInt64Builder, _a354, _b257, SingleStoreBigInt64, init_bigint3, _a355, _b258, SingleStoreBinaryBuilder, _a356, _b259, SingleStoreBinary, init_binary2, _a357, _b260, SingleStoreBooleanBuilder, _a358, _b261, SingleStoreBoolean, init_boolean3, _a359, _b262, SingleStoreCharBuilder, _a360, _b263, SingleStoreChar, init_char3, _a361, _b264, SingleStoreCustomColumnBuilder, _a362, _b265, SingleStoreCustomColumn, init_custom4, _a363, _b266, SingleStoreDateBuilder, _a364, _b267, SingleStoreDate, _a365, _b268, SingleStoreDateStringBuilder, _a366, _b269, SingleStoreDateString, init_date3, _a367, _b270, SingleStoreDateTimeBuilder, _a368, _b271, SingleStoreDateTime, _a369, _b272, SingleStoreDateTimeStringBuilder, _a370, _b273, SingleStoreDateTimeString, init_datetime2, _a371, _b274, SingleStoreDecimalBuilder, _a372, _b275, SingleStoreDecimal, _a373, _b276, SingleStoreDecimalNumberBuilder, _a374, _b277, SingleStoreDecimalNumber, _a375, _b278, SingleStoreDecimalBigIntBuilder, _a376, _b279, SingleStoreDecimalBigInt, init_decimal2, _a377, _b280, SingleStoreDoubleBuilder, _a378, _b281, SingleStoreDouble, init_double2, _a379, _b282, SingleStoreEnumColumnBuilder, _a380, _b283, SingleStoreEnumColumn, init_enum3, _a381, _b284, SingleStoreFloatBuilder, _a382, _b285, SingleStoreFloat, init_float2, _a383, _b286, SingleStoreIntBuilder, _a384, _b287, SingleStoreInt, init_int2, _a385, _b288, SingleStoreJsonBuilder, _a386, _b289, SingleStoreJson, init_json3, _a387, _b290, SingleStoreMediumIntBuilder, _a388, _b291, SingleStoreMediumInt, init_mediumint2, _a389, _b292, SingleStoreRealBuilder, _a390, _b293, SingleStoreReal, init_real4, _a391, _b294, SingleStoreSerialBuilder, _a392, _b295, SingleStoreSerial, init_serial3, _a393, _b296, SingleStoreSmallIntBuilder, _a394, _b297, SingleStoreSmallInt, init_smallint3, _a395, _b298, SingleStoreTextBuilder, _a396, _b299, SingleStoreText, init_text4, _a397, _b300, SingleStoreTimeBuilder, _a398, _b301, SingleStoreTime, init_time3, _a399, _b302, SingleStoreDateColumnBaseBuilder, _a400, _b303, SingleStoreDateBaseColumn, init_date_common3, _a401, _b304, SingleStoreTimestampBuilder, _a402, _b305, SingleStoreTimestamp, _a403, _b306, SingleStoreTimestampStringBuilder, _a404, _b307, SingleStoreTimestampString, init_timestamp3, _a405, _b308, SingleStoreTinyIntBuilder, _a406, _b309, SingleStoreTinyInt, init_tinyint2, _a407, _b310, SingleStoreVarBinaryBuilder, _a408, _b311, SingleStoreVarBinary, init_varbinary2, _a409, _b312, SingleStoreVarCharBuilder, _a410, _b313, SingleStoreVarChar, init_varchar3, _a411, _b314, SingleStoreVectorBuilder, _a412, _b315, SingleStoreVector, init_vector4, _a413, _b316, SingleStoreYearBuilder, _a414, _b317, SingleStoreYear, init_year2, init_columns4, _a415, _b318, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder, init_count4, _a416, IndexBuilderOn4, _a417, IndexBuilder4, _a418, Index6, init_indexes4, init_all4, _a419, _b319, _c13, _d5, SingleStoreTable, init_table52, _a420, PrimaryKeyBuilder4, _a421, PrimaryKey4, init_primary_keys4, init_utils10, _a422, _b320, SingleStoreDeleteBase, init_delete4, _a423, SingleStoreInsertBuilder, _a424, _b321, SingleStoreInsertBase, init_insert4, _a425, SingleStoreDialect, init_dialect4, _a426, SingleStoreSelectBuilder, _a427, _b322, SingleStoreSelectQueryBuilderBase, _a428, _b323, SingleStoreSelectBase, getSingleStoreSetOperators, union5, unionAll4, intersect4, except4, minus, init_select5, _a429, QueryBuilder4, init_query_builder5, init_select_types4, _a430, SingleStoreUpdateBuilder, _a431, _b324, SingleStoreUpdateBase, init_update4, init_query_builders4, _a432, SingleStoreDatabase, init_db4, _a433, SingleStoreSchema5, init_schema32, _a434, SingleStorePreparedQuery, _a435, SingleStoreSession, _a436, _b325, SingleStoreTransaction, init_session4, init_subquery5, init_singlestore_core, dialect5, generateSingleStoreSnapshot, fromDatabase4, init_singlestoreSerializer, sqliteImports_exports, prepareFromExports2, prepareFromSqliteImports, init_sqliteImports, mysqlImports_exports, prepareFromExports3, prepareFromMySqlImports, init_mysqlImports, mysqlPushUtils_exports, import_hanji8, filterStatements, logSuggestionsAndReturn2, init_mysqlPushUtils, mysqlIntrospect_exports, import_hanji9, mysqlPushIntrospect, init_mysqlIntrospect, singlestoreImports_exports, prepareFromExports4, prepareFromSingleStoreImports, init_singlestoreImports, singlestorePushUtils_exports, import_hanji10, filterStatements2, logSuggestionsAndReturn3, init_singlestorePushUtils, singlestoreIntrospect_exports, import_hanji11, singlestorePushIntrospect, init_singlestoreIntrospect, import_hanji3, pgPushIntrospect = async (db2, filters, schemaFilters, entities, tsSchema) => {
|
|
100999
103392
|
const matchers = filters.map((it3) => {
|
|
101000
103393
|
return new Minimatch(it3);
|
|
101001
103394
|
});
|
|
@@ -121421,7 +123814,7 @@ globstar while`, file3, fr, pattern, pr2, swallowee);
|
|
|
121421
123814
|
});
|
|
121422
123815
|
}
|
|
121423
123816
|
});
|
|
121424
|
-
|
|
123817
|
+
init_sql4 = __esm2({
|
|
121425
123818
|
"../drizzle-orm/dist/sql/sql.js"() {
|
|
121426
123819
|
init_entity2();
|
|
121427
123820
|
init_enum2();
|
|
@@ -121774,7 +124167,7 @@ globstar while`, file3, fr, pattern, pr2, swallowee);
|
|
|
121774
124167
|
"../drizzle-orm/dist/alias.js"() {
|
|
121775
124168
|
init_column2();
|
|
121776
124169
|
init_entity2();
|
|
121777
|
-
|
|
124170
|
+
init_sql4();
|
|
121778
124171
|
init_table8();
|
|
121779
124172
|
init_view_common3();
|
|
121780
124173
|
_a28 = entityKind2;
|
|
@@ -121948,7 +124341,7 @@ params: ${params}`);
|
|
|
121948
124341
|
"../drizzle-orm/dist/utils.js"() {
|
|
121949
124342
|
init_column2();
|
|
121950
124343
|
init_entity2();
|
|
121951
|
-
|
|
124344
|
+
init_sql4();
|
|
121952
124345
|
init_subquery2();
|
|
121953
124346
|
init_table8();
|
|
121954
124347
|
init_view_common3();
|
|
@@ -122207,7 +124600,7 @@ params: ${params}`);
|
|
|
122207
124600
|
init_date_common2 = __esm2({
|
|
122208
124601
|
"../drizzle-orm/dist/pg-core/columns/date.common.js"() {
|
|
122209
124602
|
init_entity2();
|
|
122210
|
-
|
|
124603
|
+
init_sql4();
|
|
122211
124604
|
init_common22();
|
|
122212
124605
|
PgDateColumnBaseBuilder2 = class extends (_b33 = PgColumnBuilder2, _a54 = entityKind2, _b33) {
|
|
122213
124606
|
defaultNow() {
|
|
@@ -122992,7 +125385,7 @@ params: ${params}`);
|
|
|
122992
125385
|
init_uuid3 = __esm2({
|
|
122993
125386
|
"../drizzle-orm/dist/pg-core/columns/uuid.js"() {
|
|
122994
125387
|
init_entity2();
|
|
122995
|
-
|
|
125388
|
+
init_sql4();
|
|
122996
125389
|
init_common22();
|
|
122997
125390
|
PgUUIDBuilder2 = class extends (_b88 = PgColumnBuilder2, _a109 = entityKind2, _b88) {
|
|
122998
125391
|
constructor(name22) {
|
|
@@ -123263,7 +125656,7 @@ params: ${params}`);
|
|
|
123263
125656
|
init_column2();
|
|
123264
125657
|
init_entity2();
|
|
123265
125658
|
init_table8();
|
|
123266
|
-
|
|
125659
|
+
init_sql4();
|
|
123267
125660
|
eq2 = (left, right) => {
|
|
123268
125661
|
return sql4`${left} = ${bindIfParam2(right, left)}`;
|
|
123269
125662
|
};
|
|
@@ -123286,7 +125679,7 @@ params: ${params}`);
|
|
|
123286
125679
|
});
|
|
123287
125680
|
init_select3 = __esm2({
|
|
123288
125681
|
"../drizzle-orm/dist/sql/expressions/select.js"() {
|
|
123289
|
-
|
|
125682
|
+
init_sql4();
|
|
123290
125683
|
}
|
|
123291
125684
|
});
|
|
123292
125685
|
init_expressions2 = __esm2({
|
|
@@ -123302,7 +125695,7 @@ params: ${params}`);
|
|
|
123302
125695
|
init_entity2();
|
|
123303
125696
|
init_primary_keys2();
|
|
123304
125697
|
init_expressions2();
|
|
123305
|
-
|
|
125698
|
+
init_sql4();
|
|
123306
125699
|
_a124 = entityKind2;
|
|
123307
125700
|
Relation2 = class {
|
|
123308
125701
|
constructor(sourceTable, referencedTable, relationName) {
|
|
@@ -123356,12 +125749,12 @@ params: ${params}`);
|
|
|
123356
125749
|
"../drizzle-orm/dist/sql/functions/aggregate.js"() {
|
|
123357
125750
|
init_column2();
|
|
123358
125751
|
init_entity2();
|
|
123359
|
-
|
|
125752
|
+
init_sql4();
|
|
123360
125753
|
}
|
|
123361
125754
|
});
|
|
123362
125755
|
init_vector22 = __esm2({
|
|
123363
125756
|
"../drizzle-orm/dist/sql/functions/vector.js"() {
|
|
123364
|
-
|
|
125757
|
+
init_sql4();
|
|
123365
125758
|
}
|
|
123366
125759
|
});
|
|
123367
125760
|
init_functions2 = __esm2({
|
|
@@ -123374,7 +125767,7 @@ params: ${params}`);
|
|
|
123374
125767
|
"../drizzle-orm/dist/sql/index.js"() {
|
|
123375
125768
|
init_expressions2();
|
|
123376
125769
|
init_functions2();
|
|
123377
|
-
|
|
125770
|
+
init_sql4();
|
|
123378
125771
|
}
|
|
123379
125772
|
});
|
|
123380
125773
|
dist_exports = {};
|
|
@@ -123591,7 +125984,7 @@ params: ${params}`);
|
|
|
123591
125984
|
init_alias3();
|
|
123592
125985
|
init_column2();
|
|
123593
125986
|
init_entity2();
|
|
123594
|
-
|
|
125987
|
+
init_sql4();
|
|
123595
125988
|
init_subquery2();
|
|
123596
125989
|
init_view_common3();
|
|
123597
125990
|
_a130 = entityKind2;
|
|
@@ -123650,7 +126043,7 @@ params: ${params}`);
|
|
|
123650
126043
|
});
|
|
123651
126044
|
init_indexes2 = __esm2({
|
|
123652
126045
|
"../drizzle-orm/dist/pg-core/indexes.js"() {
|
|
123653
|
-
|
|
126046
|
+
init_sql4();
|
|
123654
126047
|
init_entity2();
|
|
123655
126048
|
init_columns2();
|
|
123656
126049
|
_a131 = entityKind2;
|
|
@@ -123813,7 +126206,7 @@ params: ${params}`);
|
|
|
123813
126206
|
init_view_base2 = __esm2({
|
|
123814
126207
|
"../drizzle-orm/dist/pg-core/view-base.js"() {
|
|
123815
126208
|
init_entity2();
|
|
123816
|
-
|
|
126209
|
+
init_sql4();
|
|
123817
126210
|
PgViewBase2 = class extends (_b103 = View3, _a136 = entityKind2, _b103) {
|
|
123818
126211
|
};
|
|
123819
126212
|
__publicField(PgViewBase2, _a136, "PgViewBase");
|
|
@@ -123830,7 +126223,7 @@ params: ${params}`);
|
|
|
123830
126223
|
init_table22();
|
|
123831
126224
|
init_relations2();
|
|
123832
126225
|
init_sql22();
|
|
123833
|
-
|
|
126226
|
+
init_sql4();
|
|
123834
126227
|
init_subquery2();
|
|
123835
126228
|
init_table8();
|
|
123836
126229
|
init_utils22();
|
|
@@ -124414,7 +126807,7 @@ params: ${params}`);
|
|
|
124414
126807
|
init_query_builder3();
|
|
124415
126808
|
init_query_promise2();
|
|
124416
126809
|
init_selection_proxy2();
|
|
124417
|
-
|
|
126810
|
+
init_sql4();
|
|
124418
126811
|
init_subquery2();
|
|
124419
126812
|
init_table8();
|
|
124420
126813
|
init_tracing2();
|
|
@@ -125035,7 +127428,7 @@ params: ${params}`);
|
|
|
125035
127428
|
"../drizzle-orm/dist/pg-core/utils.js"() {
|
|
125036
127429
|
init_entity2();
|
|
125037
127430
|
init_table22();
|
|
125038
|
-
|
|
127431
|
+
init_sql4();
|
|
125039
127432
|
init_subquery2();
|
|
125040
127433
|
init_table8();
|
|
125041
127434
|
init_view_common3();
|
|
@@ -125123,7 +127516,7 @@ params: ${params}`);
|
|
|
125123
127516
|
init_entity2();
|
|
125124
127517
|
init_query_promise2();
|
|
125125
127518
|
init_selection_proxy2();
|
|
125126
|
-
|
|
127519
|
+
init_sql4();
|
|
125127
127520
|
init_table8();
|
|
125128
127521
|
init_tracing2();
|
|
125129
127522
|
init_utils22();
|
|
@@ -125317,7 +127710,7 @@ params: ${params}`);
|
|
|
125317
127710
|
init_table22();
|
|
125318
127711
|
init_query_promise2();
|
|
125319
127712
|
init_selection_proxy2();
|
|
125320
|
-
|
|
127713
|
+
init_sql4();
|
|
125321
127714
|
init_subquery2();
|
|
125322
127715
|
init_table8();
|
|
125323
127716
|
init_utils22();
|
|
@@ -125491,7 +127884,7 @@ params: ${params}`);
|
|
|
125491
127884
|
init_count2 = __esm2({
|
|
125492
127885
|
"../drizzle-orm/dist/pg-core/query-builders/count.js"() {
|
|
125493
127886
|
init_entity2();
|
|
125494
|
-
|
|
127887
|
+
init_sql4();
|
|
125495
127888
|
_PgCountBuilder = class _PgCountBuilder2 extends (_c6 = SQL2, _b116 = entityKind2, _a157 = Symbol.toStringTag, _c6) {
|
|
125496
127889
|
constructor(params) {
|
|
125497
127890
|
super(_PgCountBuilder2.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
@@ -125659,7 +128052,7 @@ params: ${params}`);
|
|
|
125659
128052
|
init_entity2();
|
|
125660
128053
|
init_query_builders2();
|
|
125661
128054
|
init_selection_proxy2();
|
|
125662
|
-
|
|
128055
|
+
init_sql4();
|
|
125663
128056
|
init_subquery2();
|
|
125664
128057
|
init_count2();
|
|
125665
128058
|
init_query2();
|
|
@@ -125831,10 +128224,10 @@ params: ${params}`);
|
|
|
125831
128224
|
__publicField(PgSequence, _a163, "PgSequence");
|
|
125832
128225
|
}
|
|
125833
128226
|
});
|
|
125834
|
-
|
|
128227
|
+
init_schema4 = __esm2({
|
|
125835
128228
|
"../drizzle-orm/dist/pg-core/schema.js"() {
|
|
125836
128229
|
init_entity2();
|
|
125837
|
-
|
|
128230
|
+
init_sql4();
|
|
125838
128231
|
init_enum2();
|
|
125839
128232
|
init_sequence2();
|
|
125840
128233
|
init_table22();
|
|
@@ -126050,7 +128443,7 @@ params: ${params}`);
|
|
|
126050
128443
|
init_primary_keys2();
|
|
126051
128444
|
init_query_builders2();
|
|
126052
128445
|
init_roles2();
|
|
126053
|
-
|
|
128446
|
+
init_schema4();
|
|
126054
128447
|
init_sequence2();
|
|
126055
128448
|
init_session3();
|
|
126056
128449
|
init_subquery22();
|
|
@@ -127858,7 +130251,7 @@ ORDER BY
|
|
|
127858
130251
|
init_integer22 = __esm2({
|
|
127859
130252
|
"../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
|
|
127860
130253
|
init_entity2();
|
|
127861
|
-
|
|
130254
|
+
init_sql4();
|
|
127862
130255
|
init_utils22();
|
|
127863
130256
|
init_common3();
|
|
127864
130257
|
SQLiteBaseIntegerBuilder = class extends (_b131 = SQLiteColumnBuilder, _a187 = entityKind2, _b131) {
|
|
@@ -128221,7 +130614,7 @@ ORDER BY
|
|
|
128221
130614
|
init_utils72 = __esm2({
|
|
128222
130615
|
"../drizzle-orm/dist/sqlite-core/utils.js"() {
|
|
128223
130616
|
init_entity2();
|
|
128224
|
-
|
|
130617
|
+
init_sql4();
|
|
128225
130618
|
init_subquery2();
|
|
128226
130619
|
init_table8();
|
|
128227
130620
|
init_view_common3();
|
|
@@ -128315,7 +130708,7 @@ ORDER BY
|
|
|
128315
130708
|
init_view_base22 = __esm2({
|
|
128316
130709
|
"../drizzle-orm/dist/sqlite-core/view-base.js"() {
|
|
128317
130710
|
init_entity2();
|
|
128318
|
-
|
|
130711
|
+
init_sql4();
|
|
128319
130712
|
SQLiteViewBase = class extends (_b153 = View3, _a214 = entityKind2, _b153) {
|
|
128320
130713
|
};
|
|
128321
130714
|
__publicField(SQLiteViewBase, _a214, "SQLiteViewBase");
|
|
@@ -128330,7 +130723,7 @@ ORDER BY
|
|
|
128330
130723
|
init_errors22();
|
|
128331
130724
|
init_relations2();
|
|
128332
130725
|
init_sql22();
|
|
128333
|
-
|
|
130726
|
+
init_sql4();
|
|
128334
130727
|
init_columns22();
|
|
128335
130728
|
init_table32();
|
|
128336
130729
|
init_subquery2();
|
|
@@ -128910,7 +131303,7 @@ ORDER BY
|
|
|
128910
131303
|
init_query_builder3();
|
|
128911
131304
|
init_query_promise2();
|
|
128912
131305
|
init_selection_proxy2();
|
|
128913
|
-
|
|
131306
|
+
init_sql4();
|
|
128914
131307
|
init_subquery2();
|
|
128915
131308
|
init_table8();
|
|
128916
131309
|
init_utils22();
|
|
@@ -129273,7 +131666,7 @@ ORDER BY
|
|
|
129273
131666
|
"../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
|
|
129274
131667
|
init_entity2();
|
|
129275
131668
|
init_query_promise2();
|
|
129276
|
-
|
|
131669
|
+
init_sql4();
|
|
129277
131670
|
init_table32();
|
|
129278
131671
|
init_table8();
|
|
129279
131672
|
init_utils22();
|
|
@@ -129520,7 +131913,7 @@ ORDER BY
|
|
|
129520
131913
|
init_count22 = __esm2({
|
|
129521
131914
|
"../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
|
|
129522
131915
|
init_entity2();
|
|
129523
|
-
|
|
131916
|
+
init_sql4();
|
|
129524
131917
|
_SQLiteCountBuilder = class _SQLiteCountBuilder2 extends (_c8 = SQL2, _b160 = entityKind2, _a226 = Symbol.toStringTag, _c8) {
|
|
129525
131918
|
constructor(params) {
|
|
129526
131919
|
super(_SQLiteCountBuilder2.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
@@ -129689,7 +132082,7 @@ ORDER BY
|
|
|
129689
132082
|
"../drizzle-orm/dist/sqlite-core/db.js"() {
|
|
129690
132083
|
init_entity2();
|
|
129691
132084
|
init_selection_proxy2();
|
|
129692
|
-
|
|
132085
|
+
init_sql4();
|
|
129693
132086
|
init_query_builders22();
|
|
129694
132087
|
init_subquery2();
|
|
129695
132088
|
init_count22();
|
|
@@ -131660,7 +134053,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
131660
134053
|
init_date_common22 = __esm2({
|
|
131661
134054
|
"../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
|
|
131662
134055
|
init_entity2();
|
|
131663
|
-
|
|
134056
|
+
init_sql4();
|
|
131664
134057
|
init_common4();
|
|
131665
134058
|
MySqlDateColumnBaseBuilder = class extends (_b223 = MySqlColumnBuilder, _a301 = entityKind2, _b223) {
|
|
131666
134059
|
defaultNow() {
|
|
@@ -131886,7 +134279,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
131886
134279
|
init_count3 = __esm2({
|
|
131887
134280
|
"../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
|
|
131888
134281
|
init_entity2();
|
|
131889
|
-
|
|
134282
|
+
init_sql4();
|
|
131890
134283
|
_MySqlCountBuilder = class _MySqlCountBuilder2 extends (_c9 = SQL2, _b237 = entityKind2, _a315 = Symbol.toStringTag, _c9) {
|
|
131891
134284
|
constructor(params) {
|
|
131892
134285
|
super(_MySqlCountBuilder2.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
@@ -132148,7 +134541,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
132148
134541
|
init_view_base3 = __esm2({
|
|
132149
134542
|
"../drizzle-orm/dist/mysql-core/view-base.js"() {
|
|
132150
134543
|
init_entity2();
|
|
132151
|
-
|
|
134544
|
+
init_sql4();
|
|
132152
134545
|
MySqlViewBase = class extends (_b240 = View3, _a323 = entityKind2, _b240) {
|
|
132153
134546
|
};
|
|
132154
134547
|
__publicField(MySqlViewBase, _a323, "MySqlViewBase");
|
|
@@ -132163,7 +134556,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
132163
134556
|
init_errors22();
|
|
132164
134557
|
init_relations2();
|
|
132165
134558
|
init_expressions2();
|
|
132166
|
-
|
|
134559
|
+
init_sql4();
|
|
132167
134560
|
init_subquery2();
|
|
132168
134561
|
init_table8();
|
|
132169
134562
|
init_utils22();
|
|
@@ -132929,7 +135322,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
132929
135322
|
init_query_builder3();
|
|
132930
135323
|
init_query_promise2();
|
|
132931
135324
|
init_selection_proxy2();
|
|
132932
|
-
|
|
135325
|
+
init_sql4();
|
|
132933
135326
|
init_subquery2();
|
|
132934
135327
|
init_table8();
|
|
132935
135328
|
init_utils22();
|
|
@@ -133330,7 +135723,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
133330
135723
|
"../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
|
|
133331
135724
|
init_entity2();
|
|
133332
135725
|
init_query_promise2();
|
|
133333
|
-
|
|
135726
|
+
init_sql4();
|
|
133334
135727
|
init_table8();
|
|
133335
135728
|
init_utils22();
|
|
133336
135729
|
init_utils8();
|
|
@@ -133610,7 +136003,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
133610
136003
|
"../drizzle-orm/dist/mysql-core/db.js"() {
|
|
133611
136004
|
init_entity2();
|
|
133612
136005
|
init_selection_proxy2();
|
|
133613
|
-
|
|
136006
|
+
init_sql4();
|
|
133614
136007
|
init_subquery2();
|
|
133615
136008
|
init_count3();
|
|
133616
136009
|
init_query_builders3();
|
|
@@ -133839,7 +136232,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
|
|
|
133839
136232
|
init_cache();
|
|
133840
136233
|
init_entity2();
|
|
133841
136234
|
init_errors22();
|
|
133842
|
-
|
|
136235
|
+
init_sql4();
|
|
133843
136236
|
init_db3();
|
|
133844
136237
|
_a341 = entityKind2;
|
|
133845
136238
|
MySqlPreparedQuery = class {
|
|
@@ -135862,7 +138255,7 @@ AND
|
|
|
135862
138255
|
init_date_common3 = __esm2({
|
|
135863
138256
|
"../drizzle-orm/dist/singlestore-core/columns/date.common.js"() {
|
|
135864
138257
|
init_entity2();
|
|
135865
|
-
|
|
138258
|
+
init_sql4();
|
|
135866
138259
|
init_common5();
|
|
135867
138260
|
SingleStoreDateColumnBaseBuilder = class extends (_b302 = SingleStoreColumnBuilder, _a399 = entityKind2, _b302) {
|
|
135868
138261
|
defaultNow() {
|
|
@@ -135887,7 +138280,7 @@ AND
|
|
|
135887
138280
|
init_timestamp3 = __esm2({
|
|
135888
138281
|
"../drizzle-orm/dist/singlestore-core/columns/timestamp.js"() {
|
|
135889
138282
|
init_entity2();
|
|
135890
|
-
|
|
138283
|
+
init_sql4();
|
|
135891
138284
|
init_utils22();
|
|
135892
138285
|
init_date_common3();
|
|
135893
138286
|
SingleStoreTimestampBuilder = class extends (_b304 = SingleStoreDateColumnBaseBuilder, _a401 = entityKind2, _b304) {
|
|
@@ -136122,7 +138515,7 @@ AND
|
|
|
136122
138515
|
init_count4 = __esm2({
|
|
136123
138516
|
"../drizzle-orm/dist/singlestore-core/query-builders/count.js"() {
|
|
136124
138517
|
init_entity2();
|
|
136125
|
-
|
|
138518
|
+
init_sql4();
|
|
136126
138519
|
_SingleStoreCountBuilder = class _SingleStoreCountBuilder2 extends (_c12 = SQL2, _b318 = entityKind2, _a415 = Symbol.toStringTag, _c12) {
|
|
136127
138520
|
constructor(params) {
|
|
136128
138521
|
super(_SingleStoreCountBuilder2.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
@@ -136292,7 +138685,7 @@ AND
|
|
|
136292
138685
|
init_utils10 = __esm2({
|
|
136293
138686
|
"../drizzle-orm/dist/singlestore-core/utils.js"() {
|
|
136294
138687
|
init_entity2();
|
|
136295
|
-
|
|
138688
|
+
init_sql4();
|
|
136296
138689
|
init_subquery2();
|
|
136297
138690
|
init_table8();
|
|
136298
138691
|
init_indexes4();
|
|
@@ -136370,7 +138763,7 @@ AND
|
|
|
136370
138763
|
"../drizzle-orm/dist/singlestore-core/query-builders/insert.js"() {
|
|
136371
138764
|
init_entity2();
|
|
136372
138765
|
init_query_promise2();
|
|
136373
|
-
|
|
138766
|
+
init_sql4();
|
|
136374
138767
|
init_table8();
|
|
136375
138768
|
init_utils22();
|
|
136376
138769
|
init_utils10();
|
|
@@ -136467,7 +138860,7 @@ AND
|
|
|
136467
138860
|
init_errors22();
|
|
136468
138861
|
init_relations2();
|
|
136469
138862
|
init_expressions2();
|
|
136470
|
-
|
|
138863
|
+
init_sql4();
|
|
136471
138864
|
init_subquery2();
|
|
136472
138865
|
init_table8();
|
|
136473
138866
|
init_utils22();
|
|
@@ -136998,7 +139391,7 @@ AND
|
|
|
136998
139391
|
init_query_builder3();
|
|
136999
139392
|
init_query_promise2();
|
|
137000
139393
|
init_selection_proxy2();
|
|
137001
|
-
|
|
139394
|
+
init_sql4();
|
|
137002
139395
|
init_subquery2();
|
|
137003
139396
|
init_table8();
|
|
137004
139397
|
init_utils22();
|
|
@@ -137456,7 +139849,7 @@ AND
|
|
|
137456
139849
|
"../drizzle-orm/dist/singlestore-core/db.js"() {
|
|
137457
139850
|
init_entity2();
|
|
137458
139851
|
init_selection_proxy2();
|
|
137459
|
-
|
|
139852
|
+
init_sql4();
|
|
137460
139853
|
init_subquery2();
|
|
137461
139854
|
init_count4();
|
|
137462
139855
|
init_query_builders4();
|
|
@@ -137570,7 +139963,7 @@ AND
|
|
|
137570
139963
|
init_cache();
|
|
137571
139964
|
init_entity2();
|
|
137572
139965
|
init_errors22();
|
|
137573
|
-
|
|
139966
|
+
init_sql4();
|
|
137574
139967
|
init_db4();
|
|
137575
139968
|
_a434 = entityKind2;
|
|
137576
139969
|
SingleStorePreparedQuery = class {
|
|
@@ -139845,7 +142238,7 @@ function requireUserId(userId) {
|
|
|
139845
142238
|
return userId;
|
|
139846
142239
|
}
|
|
139847
142240
|
var init_params_util = __esm(() => {
|
|
139848
|
-
|
|
142241
|
+
init_src5();
|
|
139849
142242
|
init_errors();
|
|
139850
142243
|
});
|
|
139851
142244
|
|
|
@@ -139898,6 +142291,7 @@ var init_utils11 = __esm(() => {
|
|
|
139898
142291
|
init_lti_util();
|
|
139899
142292
|
init_lti_provisioning();
|
|
139900
142293
|
init_params_util();
|
|
142294
|
+
init_secrets_util();
|
|
139901
142295
|
init_timeback_util();
|
|
139902
142296
|
init_validation_util();
|
|
139903
142297
|
});
|
|
@@ -140085,7 +142479,7 @@ var init_database_controller = __esm(() => {
|
|
|
140085
142479
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
140086
142480
|
}
|
|
140087
142481
|
}
|
|
140088
|
-
return ctx.services.database.reset(slug2, ctx.user, body2
|
|
142482
|
+
return ctx.services.database.reset(slug2, ctx.user, body2);
|
|
140089
142483
|
});
|
|
140090
142484
|
database = defineControllerNames("database", {
|
|
140091
142485
|
reset
|
|
@@ -140138,6 +142532,85 @@ var init_deploy_controller = __esm(() => {
|
|
|
140138
142532
|
});
|
|
140139
142533
|
});
|
|
140140
142534
|
|
|
142535
|
+
// ../api-core/src/controllers/deployment-state.controller.ts
|
|
142536
|
+
var get, baseline, realignMigration, resolveMigration, history, restorePoints, restore, reportBlocked, deploymentState;
|
|
142537
|
+
var init_deployment_state_controller = __esm(() => {
|
|
142538
|
+
init_schemas_index();
|
|
142539
|
+
init_errors();
|
|
142540
|
+
init_utils11();
|
|
142541
|
+
get = requireDeveloper(async (ctx) => {
|
|
142542
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142543
|
+
const include = ctx.url.searchParams.getAll("include").flatMap((value) => value.split(",")).filter(Boolean);
|
|
142544
|
+
const unsupported = include.filter((value) => value !== "schemaSnapshot");
|
|
142545
|
+
if (unsupported.length > 0) {
|
|
142546
|
+
throw ApiError.badRequest(`Unsupported include value(s): ${unsupported.join(", ")}`);
|
|
142547
|
+
}
|
|
142548
|
+
return ctx.services.deploymentState.get(slug2, ctx.user, {
|
|
142549
|
+
includeSchemaSnapshot: include.includes("schemaSnapshot")
|
|
142550
|
+
});
|
|
142551
|
+
});
|
|
142552
|
+
baseline = requireDeveloper(async (ctx) => {
|
|
142553
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142554
|
+
const body2 = await parseRequestBody(ctx.request, DeploymentStateBaselineSchema);
|
|
142555
|
+
return ctx.services.deploymentState.baseline(slug2, body2, ctx.user);
|
|
142556
|
+
});
|
|
142557
|
+
realignMigration = requireDeveloper(async (ctx) => {
|
|
142558
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142559
|
+
const tag = ctx.params.tag;
|
|
142560
|
+
if (!tag) {
|
|
142561
|
+
throw ApiError.badRequest("Missing migration tag");
|
|
142562
|
+
}
|
|
142563
|
+
const body2 = await parseRequestBody(ctx.request, MigrationRealignSchema);
|
|
142564
|
+
return ctx.services.deploymentState.realignMigration(slug2, tag, body2.checksum, ctx.user);
|
|
142565
|
+
});
|
|
142566
|
+
resolveMigration = requireDeveloper(async (ctx) => {
|
|
142567
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142568
|
+
const tag = ctx.params.tag;
|
|
142569
|
+
if (!tag) {
|
|
142570
|
+
throw ApiError.badRequest("Missing migration tag");
|
|
142571
|
+
}
|
|
142572
|
+
const body2 = await parseRequestBody(ctx.request, MigrationResolveSchema);
|
|
142573
|
+
return ctx.services.deploymentState.resolveMigration(slug2, tag, body2, ctx.user);
|
|
142574
|
+
});
|
|
142575
|
+
history = requireDeveloper(async (ctx) => {
|
|
142576
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142577
|
+
const limitParam = ctx.url.searchParams.get("limit");
|
|
142578
|
+
let limit;
|
|
142579
|
+
if (limitParam !== null) {
|
|
142580
|
+
limit = Number(limitParam);
|
|
142581
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
142582
|
+
throw ApiError.badRequest("limit must be an integer between 1 and 100");
|
|
142583
|
+
}
|
|
142584
|
+
}
|
|
142585
|
+
return ctx.services.deploymentState.history(slug2, ctx.user, { limit });
|
|
142586
|
+
});
|
|
142587
|
+
restorePoints = requireDeveloper(async (ctx) => {
|
|
142588
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142589
|
+
return ctx.services.deploymentState.restorePoints(slug2, ctx.user);
|
|
142590
|
+
});
|
|
142591
|
+
restore = requireDeveloper(async (ctx) => {
|
|
142592
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142593
|
+
const body2 = await parseRequestBody(ctx.request, DatabaseRestoreSchema);
|
|
142594
|
+
return ctx.services.deploymentState.restoreToBookmark(slug2, body2, ctx.user);
|
|
142595
|
+
});
|
|
142596
|
+
reportBlocked = requireDeveloper(async (ctx) => {
|
|
142597
|
+
const slug2 = requireSlug(ctx.params.slug);
|
|
142598
|
+
const body2 = await parseRequestBody(ctx.request, DeployBlockedReportSchema);
|
|
142599
|
+
await ctx.services.deploymentState.reportDeployBlocked(slug2, ctx.user, body2);
|
|
142600
|
+
return { recorded: true };
|
|
142601
|
+
});
|
|
142602
|
+
deploymentState = defineControllerNames("deploymentState", {
|
|
142603
|
+
get,
|
|
142604
|
+
baseline,
|
|
142605
|
+
realignMigration,
|
|
142606
|
+
resolveMigration,
|
|
142607
|
+
history,
|
|
142608
|
+
restorePoints,
|
|
142609
|
+
restore,
|
|
142610
|
+
reportBlocked
|
|
142611
|
+
});
|
|
142612
|
+
});
|
|
142613
|
+
|
|
140141
142614
|
// ../api-core/src/controllers/developer.controller.ts
|
|
140142
142615
|
var apply, getStatus, developer;
|
|
140143
142616
|
var init_developer_controller = __esm(() => {
|
|
@@ -140604,7 +143077,7 @@ var init_lti_controller = __esm(() => {
|
|
|
140604
143077
|
});
|
|
140605
143078
|
|
|
140606
143079
|
// ../api-core/src/controllers/secrets.controller.ts
|
|
140607
|
-
var listKeys2, setSecrets, deleteSecret, secrets;
|
|
143080
|
+
var listKeys2, setSecrets, deleteSecret, diff, secrets;
|
|
140608
143081
|
var init_secrets_controller = __esm(() => {
|
|
140609
143082
|
init_esm();
|
|
140610
143083
|
init_schemas_index();
|
|
@@ -140650,10 +143123,19 @@ var init_secrets_controller = __esm(() => {
|
|
|
140650
143123
|
await ctx.services.secrets.deleteSecret(slug2, key, ctx.user);
|
|
140651
143124
|
return { success: true };
|
|
140652
143125
|
});
|
|
143126
|
+
diff = requireDeveloper(async (ctx) => {
|
|
143127
|
+
const slug2 = ctx.params.slug;
|
|
143128
|
+
if (!slug2) {
|
|
143129
|
+
throw ApiError.badRequest("Missing game slug");
|
|
143130
|
+
}
|
|
143131
|
+
const body2 = await parseRequestBody(ctx.request, SecretsDiffRequestSchema);
|
|
143132
|
+
return ctx.services.secrets.diff(slug2, body2.secrets, ctx.user);
|
|
143133
|
+
});
|
|
140653
143134
|
secrets = defineControllerNames("secrets", {
|
|
140654
143135
|
listKeys: listKeys2,
|
|
140655
143136
|
setSecrets,
|
|
140656
|
-
deleteSecret
|
|
143137
|
+
deleteSecret,
|
|
143138
|
+
diff
|
|
140657
143139
|
});
|
|
140658
143140
|
});
|
|
140659
143141
|
|
|
@@ -140713,7 +143195,7 @@ var init_session_controller = __esm(() => {
|
|
|
140713
143195
|
let baseUrl;
|
|
140714
143196
|
if (ctx.config.isLocal) {
|
|
140715
143197
|
try {
|
|
140716
|
-
baseUrl = await getTunnelUrl();
|
|
143198
|
+
baseUrl = await getTunnelUrl(ctx.config.baseUrl);
|
|
140717
143199
|
} catch {}
|
|
140718
143200
|
}
|
|
140719
143201
|
return { token, exp, baseUrl };
|
|
@@ -140728,7 +143210,7 @@ var populateStudent, getUser, getUserEnrollments, getUserById, setupIntegration,
|
|
|
140728
143210
|
var init_timeback_controller = __esm(() => {
|
|
140729
143211
|
init_esm();
|
|
140730
143212
|
init_schemas_index();
|
|
140731
|
-
|
|
143213
|
+
init_src5();
|
|
140732
143214
|
init_timeback3();
|
|
140733
143215
|
init_errors();
|
|
140734
143216
|
init_utils11();
|
|
@@ -141495,6 +143977,7 @@ var init_controllers = __esm(() => {
|
|
|
141495
143977
|
init_dashboard_controller();
|
|
141496
143978
|
init_database_controller();
|
|
141497
143979
|
init_deploy_controller();
|
|
143980
|
+
init_deployment_state_controller();
|
|
141498
143981
|
init_developer_controller();
|
|
141499
143982
|
init_domain_controller();
|
|
141500
143983
|
init_game_member_controller();
|
|
@@ -142029,6 +144512,23 @@ var init_deploy = __esm(async () => {
|
|
|
142029
144512
|
});
|
|
142030
144513
|
});
|
|
142031
144514
|
|
|
144515
|
+
// src/routes/platform/games/deployment-state.ts
|
|
144516
|
+
var gameDeploymentStateRouter;
|
|
144517
|
+
var init_deployment_state = __esm(async () => {
|
|
144518
|
+
init_dist7();
|
|
144519
|
+
init_controllers();
|
|
144520
|
+
await init_api3();
|
|
144521
|
+
gameDeploymentStateRouter = new Hono2;
|
|
144522
|
+
gameDeploymentStateRouter.get("/:slug/deployment-state", handle2(deploymentState.get));
|
|
144523
|
+
gameDeploymentStateRouter.post("/:slug/deployment-state/baseline", handle2(deploymentState.baseline));
|
|
144524
|
+
gameDeploymentStateRouter.post("/:slug/deployment-state/migrations/:tag/realign", handle2(deploymentState.realignMigration));
|
|
144525
|
+
gameDeploymentStateRouter.post("/:slug/deployment-state/migrations/:tag/resolve", handle2(deploymentState.resolveMigration));
|
|
144526
|
+
gameDeploymentStateRouter.get("/:slug/deployments", handle2(deploymentState.history));
|
|
144527
|
+
gameDeploymentStateRouter.post("/:slug/deployments/blocked", handle2(deploymentState.reportBlocked));
|
|
144528
|
+
gameDeploymentStateRouter.get("/:slug/database/restore-points", handle2(deploymentState.restorePoints));
|
|
144529
|
+
gameDeploymentStateRouter.post("/:slug/database/restore", handle2(deploymentState.restore));
|
|
144530
|
+
});
|
|
144531
|
+
|
|
142032
144532
|
// src/routes/platform/games/domains.ts
|
|
142033
144533
|
var gameDomainsRouter;
|
|
142034
144534
|
var init_domains2 = __esm(async () => {
|
|
@@ -142074,6 +144574,7 @@ var init_secrets = __esm(async () => {
|
|
|
142074
144574
|
gameSecretsRouter = new Hono2;
|
|
142075
144575
|
gameSecretsRouter.get("/:slug/secrets", handle2(secrets.listKeys));
|
|
142076
144576
|
gameSecretsRouter.post("/:slug/secrets", handle2(secrets.setSecrets));
|
|
144577
|
+
gameSecretsRouter.post("/:slug/secrets/diff", handle2(secrets.diff));
|
|
142077
144578
|
gameSecretsRouter.delete("/:slug/secrets/:key", handle2(secrets.deleteSecret));
|
|
142078
144579
|
});
|
|
142079
144580
|
|
|
@@ -142276,6 +144777,7 @@ var init_games2 = __esm(async () => {
|
|
|
142276
144777
|
await __promiseAll([
|
|
142277
144778
|
init_crud(),
|
|
142278
144779
|
init_deploy(),
|
|
144780
|
+
init_deployment_state(),
|
|
142279
144781
|
init_domains2(),
|
|
142280
144782
|
init_logs(),
|
|
142281
144783
|
init_scores(),
|
|
@@ -142290,6 +144792,7 @@ var init_games2 = __esm(async () => {
|
|
|
142290
144792
|
gamesRouter.route("/", gameVerifyRouter);
|
|
142291
144793
|
gamesRouter.route("/", gameUploadsRouter);
|
|
142292
144794
|
gamesRouter.route("/", gameDeployRouter);
|
|
144795
|
+
gamesRouter.route("/", gameDeploymentStateRouter);
|
|
142293
144796
|
gamesRouter.route("/", gameDomainsRouter);
|
|
142294
144797
|
gamesRouter.route("/", gameLogsRouter);
|
|
142295
144798
|
gamesRouter.route("/", gameScoresRouter);
|