@playcademy/sandbox 0.7.1-beta.23 → 0.7.1-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.js +520 -485
  2. package/dist/server.js +520 -485
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1123,7 +1123,7 @@ var package_default;
1123
1123
  var init_package = __esm(() => {
1124
1124
  package_default = {
1125
1125
  name: "@playcademy/sandbox",
1126
- version: "0.7.1-beta.23",
1126
+ version: "0.7.1-beta.24",
1127
1127
  description: "Local development server for Playcademy game development",
1128
1128
  type: "module",
1129
1129
  exports: {
@@ -38472,71 +38472,6 @@ var init_infra2 = __esm(() => {
38472
38472
  init_kv_backup_service();
38473
38473
  });
38474
38474
 
38475
- // ../data/src/locks.ts
38476
- function createInMemoryDatabaseLock() {
38477
- const tails = new Map;
38478
- return async (db2, key, operation) => {
38479
- const previous = tails.get(key) ?? Promise.resolve();
38480
- let release;
38481
- const gate = new Promise((resolve) => {
38482
- release = resolve;
38483
- });
38484
- const tail = previous.then(() => gate);
38485
- tails.set(key, tail);
38486
- await previous;
38487
- try {
38488
- return await operation(db2);
38489
- } finally {
38490
- release();
38491
- if (tails.get(key) === tail) {
38492
- tails.delete(key);
38493
- }
38494
- }
38495
- };
38496
- }
38497
- var LockContentionError;
38498
- var init_locks = __esm(() => {
38499
- init_src6();
38500
- LockContentionError = class LockContentionError extends Error {
38501
- constructor(key) {
38502
- super(`Lock is already held: ${key}`);
38503
- this.name = "LockContentionError";
38504
- }
38505
- };
38506
- });
38507
-
38508
- // ../api-core/src/utils/assessment-runtime-lock.util.ts
38509
- function assessmentRuntimeStartLockKey(input) {
38510
- return JSON.stringify([
38511
- ASSESSMENT_RUNTIME_LOCK_NAMESPACE,
38512
- "start",
38513
- input.studentId,
38514
- input.activityId,
38515
- input.purpose,
38516
- input.courseId
38517
- ]);
38518
- }
38519
- function assessmentRuntimeAttemptLockKey(attemptId) {
38520
- return JSON.stringify([ASSESSMENT_RUNTIME_LOCK_NAMESPACE, "attempt", attemptId]);
38521
- }
38522
- function createAssessmentRuntimeLock(lock) {
38523
- return async (db2, key, operation) => {
38524
- try {
38525
- return await lock(db2, key, operation);
38526
- } catch (error) {
38527
- if (error instanceof LockContentionError) {
38528
- throw new ServiceUnavailableError("Another assessment operation is in progress. Try again shortly.", { retryable: true });
38529
- }
38530
- throw error;
38531
- }
38532
- };
38533
- }
38534
- var ASSESSMENT_RUNTIME_LOCK_NAMESPACE = "playcademy-assessment-runtime-v1";
38535
- var init_assessment_runtime_lock_util = __esm(() => {
38536
- init_locks();
38537
- init_errors2();
38538
- });
38539
-
38540
38475
  // ../api-core/src/services/bucket.service.ts
38541
38476
  function hasPagingOptions(options) {
38542
38477
  return options.cursor !== undefined || options.limit !== undefined || options.delimiter !== undefined;
@@ -92019,6 +91954,110 @@ var init_timeback_admin_service = __esm(async () => {
92019
91954
  ]);
92020
91955
  });
92021
91956
 
91957
+ // ../data/src/locks.ts
91958
+ function createInMemoryDatabaseLock() {
91959
+ const tails = new Map;
91960
+ return async (db2, key, operation) => {
91961
+ const previous = tails.get(key) ?? Promise.resolve();
91962
+ let release;
91963
+ const gate = new Promise((resolve) => {
91964
+ release = resolve;
91965
+ });
91966
+ const tail = previous.then(() => gate);
91967
+ tails.set(key, tail);
91968
+ await previous;
91969
+ try {
91970
+ return await operation(db2);
91971
+ } finally {
91972
+ release();
91973
+ if (tails.get(key) === tail) {
91974
+ tails.delete(key);
91975
+ }
91976
+ }
91977
+ };
91978
+ }
91979
+ var LockContentionError;
91980
+ var init_locks = __esm(() => {
91981
+ LockContentionError = class LockContentionError extends Error {
91982
+ constructor(key) {
91983
+ super(`Lock is already held: ${key}`);
91984
+ this.name = "LockContentionError";
91985
+ }
91986
+ };
91987
+ });
91988
+
91989
+ // ../api-core/src/utils/assessment-runtime-lock.util.ts
91990
+ function normalizeKeys(keys) {
91991
+ return [...new Set(keys)].toSorted();
91992
+ }
91993
+ function errorCode(error88) {
91994
+ if (typeof error88 !== "object" || error88 === null || !("code" in error88)) {
91995
+ return;
91996
+ }
91997
+ return typeof error88.code === "string" ? error88.code : undefined;
91998
+ }
91999
+ function translateAssessmentRuntimeLockError(error88) {
92000
+ if (error88 instanceof LockContentionError) {
92001
+ throw new ServiceUnavailableError("Another assessment operation is in progress. Try again shortly.", { retryable: true });
92002
+ }
92003
+ if (error88 instanceof AssessmentRuntimeLockTimeoutError) {
92004
+ throw new ServiceUnavailableError("The assessment operation took too long. Try again shortly.", { retryable: true, reason: "LOCK_TIMEOUT" });
92005
+ }
92006
+ const code = errorCode(error88);
92007
+ if (code && POSTGRES_TIMEOUT_ERROR_CODES.has(code)) {
92008
+ throw new ServiceUnavailableError("The assessment operation took too long. Try again shortly.", { retryable: true, reason: "LOCK_TIMEOUT" });
92009
+ }
92010
+ if (code && POSTGRES_CONNECTION_ERROR_CODES.has(code)) {
92011
+ throw new ServiceUnavailableError("The assessment lock connection was interrupted. Try again shortly.", { retryable: true, reason: "LOCK_CONNECTION_LOST" });
92012
+ }
92013
+ throw error88;
92014
+ }
92015
+ function createInMemoryAssessmentRuntimeLock() {
92016
+ const lock = createInMemoryDatabaseLock();
92017
+ return async (db2, keys, operation) => {
92018
+ const ordered = normalizeKeys(keys);
92019
+ function acquire(index2, operationDb) {
92020
+ const key = ordered[index2];
92021
+ return key ? lock(operationDb, key, (nested) => acquire(index2 + 1, nested)) : operation(operationDb);
92022
+ }
92023
+ try {
92024
+ return await acquire(0, db2);
92025
+ } catch (error88) {
92026
+ return translateAssessmentRuntimeLockError(error88);
92027
+ }
92028
+ };
92029
+ }
92030
+ function assessmentRuntimeStartLockKey(input) {
92031
+ return JSON.stringify([
92032
+ ASSESSMENT_RUNTIME_LOCK_NAMESPACE,
92033
+ "start",
92034
+ input.studentId,
92035
+ input.activityId,
92036
+ input.purpose,
92037
+ input.courseId
92038
+ ]);
92039
+ }
92040
+ function assessmentRuntimeAttemptLockKey(attemptId) {
92041
+ return JSON.stringify([ASSESSMENT_RUNTIME_LOCK_NAMESPACE, "attempt", attemptId]);
92042
+ }
92043
+ var ASSESSMENT_RUNTIME_LOCK_NAMESPACE = "playcademy-assessment-runtime-v1", POSTGRES_TIMEOUT_ERROR_CODES, POSTGRES_CONNECTION_ERROR_CODES, AssessmentRuntimeLockTimeoutError;
92044
+ var init_assessment_runtime_lock_util = __esm(() => {
92045
+ init_locks();
92046
+ init_errors2();
92047
+ POSTGRES_TIMEOUT_ERROR_CODES = new Set(["25P03", "57014"]);
92048
+ POSTGRES_CONNECTION_ERROR_CODES = new Set([
92049
+ "CONNECTION_CLOSED",
92050
+ "CONNECTION_DESTROYED",
92051
+ "CONNECTION_ENDED"
92052
+ ]);
92053
+ AssessmentRuntimeLockTimeoutError = class AssessmentRuntimeLockTimeoutError extends Error {
92054
+ constructor(timeoutMs) {
92055
+ super(`Assessment operation exceeded its ${timeoutMs}ms lock deadline`);
92056
+ this.name = "AssessmentRuntimeLockTimeoutError";
92057
+ }
92058
+ };
92059
+ });
92060
+
92022
92061
  // ../api-core/src/utils/timeback-assessment-rules.util.ts
92023
92062
  function validateAssessmentStatusTransition(current, next) {
92024
92063
  if (current === next) {
@@ -92848,8 +92887,8 @@ class TimebackAssessmentRuntimeService {
92848
92887
  activityId: input.activityId,
92849
92888
  purpose: input.purpose,
92850
92889
  courseId: row.courseId
92851
- })).toSorted();
92852
- return this.withStartLocks(lockKeys, async (db2) => {
92890
+ }));
92891
+ return this.deps.assessmentRuntimeLock(this.deps.db, lockKeys, async (db2) => {
92853
92892
  const context2 = await this.selectIntegration(candidates, studentId, input);
92854
92893
  const attemptScope = {
92855
92894
  studentId,
@@ -92866,7 +92905,7 @@ class TimebackAssessmentRuntimeService {
92866
92905
  const attempts = listing.attempts;
92867
92906
  const initialResolution = await this.resumeAvailableAttempt(tests, attempts, requestFingerprint, pendingSupersessions, (resumeDecision) => this.resumeSnapshot(resumeDecision, attempts, context2.integration));
92868
92907
  if (initialResolution.kind === "resumed") {
92869
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
92908
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
92870
92909
  return initialResolution.snapshot;
92871
92910
  }
92872
92911
  let decision = this.requireDecision(initialResolution.decision, input.purpose);
@@ -92875,7 +92914,7 @@ class TimebackAssessmentRuntimeService {
92875
92914
  const refreshed = refreshedListing.attempts;
92876
92915
  const refreshedResolution = await this.resumeAvailableAttempt(tests, refreshed, requestFingerprint, pendingSupersessions, (resumeDecision) => this.resumeSnapshot(resumeDecision, refreshed, context2.integration));
92877
92916
  if (refreshedResolution.kind === "resumed") {
92878
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
92917
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
92879
92918
  return refreshedResolution.snapshot;
92880
92919
  }
92881
92920
  decision = this.requireDecision(refreshedResolution.decision, input.purpose);
@@ -92936,7 +92975,7 @@ class TimebackAssessmentRuntimeService {
92936
92975
  grade: context2.integration.grade
92937
92976
  })
92938
92977
  });
92939
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
92978
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
92940
92979
  return this.snapshot(result, metadata2, assessment, context2.integration);
92941
92980
  });
92942
92981
  }
@@ -92953,8 +92992,8 @@ class TimebackAssessmentRuntimeService {
92953
92992
  activityId: input.activityId,
92954
92993
  purpose: input.purpose,
92955
92994
  courseId: row.courseId
92956
- })).toSorted();
92957
- return this.withStartLocks(lockKeys, async (db2) => {
92995
+ }));
92996
+ return this.deps.assessmentRuntimeLock(this.deps.db, lockKeys, async (db2) => {
92958
92997
  const context2 = await this.selectIntegration(candidates, studentId, input);
92959
92998
  const attemptScope = {
92960
92999
  studentId,
@@ -92970,7 +93009,7 @@ class TimebackAssessmentRuntimeService {
92970
93009
  ]);
92971
93010
  const initialResolution = await this.resumeAvailableAttempt(tests, listing.attempts, requestFingerprint, pendingSupersessions, (resumeDecision) => this.resumeDiagnosticSnapshot(resumeDecision, listing.attempts, context2.integration, db2));
92972
93011
  if (initialResolution.kind === "resumed") {
92973
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
93012
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
92974
93013
  return initialResolution.snapshot;
92975
93014
  }
92976
93015
  let decision = this.requireDecision(initialResolution.decision, input.purpose);
@@ -92981,7 +93020,7 @@ class TimebackAssessmentRuntimeService {
92981
93020
  const refreshed = refreshedListing.attempts;
92982
93021
  const refreshedResolution = await this.resumeAvailableAttempt(tests, refreshed, requestFingerprint, pendingSupersessions, (resumeDecision) => this.resumeDiagnosticSnapshot(resumeDecision, refreshed, context2.integration, db2));
92983
93022
  if (refreshedResolution.kind === "resumed") {
92984
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
93023
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
92985
93024
  return refreshedResolution.snapshot;
92986
93025
  }
92987
93026
  decision = this.requireDecision(refreshedResolution.decision, input.purpose);
@@ -93053,7 +93092,7 @@ class TimebackAssessmentRuntimeService {
93053
93092
  grade: context2.integration.grade
93054
93093
  })
93055
93094
  });
93056
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
93095
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
93057
93096
  return this.diagnosticSnapshot(result, metadata2, assessment, context2.integration, routing.state);
93058
93097
  });
93059
93098
  }
@@ -93072,8 +93111,8 @@ class TimebackAssessmentRuntimeService {
93072
93111
  activityId: input.activityId,
93073
93112
  purpose: input.purpose,
93074
93113
  courseId: row.courseId
93075
- })).toSorted();
93076
- return this.withStartLocks(lockKeys, async (db2) => {
93114
+ }));
93115
+ return this.deps.assessmentRuntimeLock(this.deps.db, lockKeys, async (db2) => {
93077
93116
  const context2 = await this.selectIntegration(candidates, studentId, input);
93078
93117
  const attemptScope = {
93079
93118
  studentId,
@@ -93090,7 +93129,7 @@ class TimebackAssessmentRuntimeService {
93090
93129
  const attempts = listing.attempts;
93091
93130
  const initialResolution = await this.resumeAvailableAttempt(tests, attempts, requestFingerprint, pendingSupersessions, (resumeDecision) => this.resumeReviewSnapshot(resumeDecision, attempts, listing.reviewChildren, context2));
93092
93131
  if (initialResolution.kind === "resumed") {
93093
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
93132
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
93094
93133
  return initialResolution.snapshot;
93095
93134
  }
93096
93135
  let decision = initialResolution.decision;
@@ -93109,7 +93148,7 @@ class TimebackAssessmentRuntimeService {
93109
93148
  const refreshed = refreshedListing.attempts;
93110
93149
  const refreshedResolution = await this.resumeAvailableAttempt(tests, refreshed, requestFingerprint, pendingSupersessions, (resumeDecision) => this.resumeReviewSnapshot(resumeDecision, refreshed, refreshedListing.reviewChildren, context2));
93111
93150
  if (refreshedResolution.kind === "resumed") {
93112
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
93151
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
93113
93152
  return refreshedResolution.snapshot;
93114
93153
  }
93115
93154
  const refreshedDecision = refreshedResolution.decision;
@@ -93203,7 +93242,7 @@ class TimebackAssessmentRuntimeService {
93203
93242
  existingChildResults: refreshedListing.reviewChildren,
93204
93243
  lookupMissingResults: false
93205
93244
  });
93206
- await this.persistPendingSupersessionsBestEffort(pendingSupersessions);
93245
+ await this.persistPendingSupersessionsBestEffort(db2, pendingSupersessions);
93207
93246
  this.recordReviewPreparationPhase("provisioning", provisioningStartedAt);
93208
93247
  this.recordReviewPreparationPhase("total", preparationStartedAt, {
93209
93248
  candidateCount: catalog.bank.items.length,
@@ -93291,7 +93330,7 @@ class TimebackAssessmentRuntimeService {
93291
93330
  "app.error.message": errorMessage(error88)
93292
93331
  });
93293
93332
  }
93294
- return this.deps.assessmentRuntimeLock(this.deps.db, assessmentRuntimeAttemptLockKey(params.attemptId), async (db2) => {
93333
+ return this.deps.assessmentRuntimeLock(this.deps.db, [assessmentRuntimeAttemptLockKey(params.attemptId)], async (db2) => {
93295
93334
  const attempt = await this.authorizeAttempt(params, {
93296
93335
  db: db2,
93297
93336
  developerAccessValidated: true
@@ -93339,7 +93378,7 @@ class TimebackAssessmentRuntimeService {
93339
93378
  let preview = await this.prepareItemSubmission(params, input);
93340
93379
  let preparationAttempts = 1;
93341
93380
  while (true) {
93342
- const committed = await this.deps.assessmentRuntimeLock(this.deps.db, assessmentRuntimeAttemptLockKey(params.attemptId), async (db2) => {
93381
+ const committed = await this.deps.assessmentRuntimeLock(this.deps.db, [assessmentRuntimeAttemptLockKey(params.attemptId)], async (db2) => {
93343
93382
  const attempt = await this.authorizeAttempt(params, {
93344
93383
  db: db2,
93345
93384
  developerAccessValidated: true
@@ -93435,7 +93474,7 @@ class TimebackAssessmentRuntimeService {
93435
93474
  let preview = await this.prepareDiagnosticItemSubmission(params, input);
93436
93475
  let preparationAttempts = 1;
93437
93476
  while (true) {
93438
- const committed = await this.deps.assessmentRuntimeLock(this.deps.db, assessmentRuntimeAttemptLockKey(params.attemptId), async (db2) => {
93477
+ const committed = await this.deps.assessmentRuntimeLock(this.deps.db, [assessmentRuntimeAttemptLockKey(params.attemptId)], async (db2) => {
93439
93478
  const attempt = await this.authorizeAttempt(params, {
93440
93479
  db: db2,
93441
93480
  developerAccessValidated: true
@@ -93769,7 +93808,7 @@ class TimebackAssessmentRuntimeService {
93769
93808
  }) {
93770
93809
  await this.deps.validateDeveloperAccess(params.user, params.gameId);
93771
93810
  const preview = await this.prepareSubmission(params, input);
93772
- const submission = await this.deps.assessmentRuntimeLock(this.deps.db, assessmentRuntimeAttemptLockKey(params.attemptId), async (db2) => {
93811
+ const submission = await this.deps.assessmentRuntimeLock(this.deps.db, [assessmentRuntimeAttemptLockKey(params.attemptId)], async (db2) => {
93773
93812
  const attempt = await this.authorizeAttempt(params, {
93774
93813
  db: db2,
93775
93814
  developerAccessValidated: true
@@ -94092,10 +94131,6 @@ class TimebackAssessmentRuntimeService {
94092
94131
  enrollment: enrollmentByCourse.get(selection.selected.courseId)
94093
94132
  };
94094
94133
  }
94095
- async withStartLocks(keys, operation) {
94096
- const acquire = (index2, db2) => index2 === keys.length ? operation(db2) : this.deps.assessmentRuntimeLock(db2, keys[index2], (nested) => acquire(index2 + 1, nested));
94097
- return acquire(0, this.deps.db);
94098
- }
94099
94134
  async liveTests(integrationId, purpose, db2 = this.deps.db, requestedStandard, requestedDiagnosticKey) {
94100
94135
  const matchesMasteryStandard = requestedStandard ? masteryStandardMatcher(requestedStandard) : undefined;
94101
94136
  const rows = await db2.query.gameTimebackAssessmentTests.findMany({
@@ -94269,9 +94304,9 @@ class TimebackAssessmentRuntimeService {
94269
94304
  return null;
94270
94305
  }
94271
94306
  }
94272
- async persistPendingSupersessions(attemptIds) {
94307
+ async persistPendingSupersessions(db2, attemptIds) {
94273
94308
  for (const attemptId of [...attemptIds].toSorted()) {
94274
- await this.deps.assessmentRuntimeLock(this.deps.db, assessmentRuntimeAttemptLockKey(attemptId), async () => {
94309
+ await this.deps.assessmentRuntimeLock(db2, [assessmentRuntimeAttemptLockKey(attemptId)], async () => {
94275
94310
  let result;
94276
94311
  try {
94277
94312
  result = await this.requireClient().api.oneroster.assessmentResults.get(attemptId);
@@ -94293,12 +94328,12 @@ class TimebackAssessmentRuntimeService {
94293
94328
  });
94294
94329
  }
94295
94330
  }
94296
- async persistPendingSupersessionsBestEffort(attemptIds) {
94331
+ async persistPendingSupersessionsBestEffort(db2, attemptIds) {
94297
94332
  if (attemptIds.size === 0) {
94298
94333
  return;
94299
94334
  }
94300
94335
  try {
94301
- await this.persistPendingSupersessions(attemptIds);
94336
+ await this.persistPendingSupersessions(db2, attemptIds);
94302
94337
  } catch (error88) {
94303
94338
  addEvent("assessment.attempt_supersession_persist_failed", {
94304
94339
  "app.assessment.attempt_ids": [...attemptIds].toSorted().join(","),
@@ -94924,7 +94959,7 @@ class TimebackAssessmentRuntimeService {
94924
94959
  async crossAttemptLockBarrier(attemptId) {
94925
94960
  for (let attempt = 1;attempt <= TimebackAssessmentRuntimeService.PROJECTION_BARRIER_MAX_ATTEMPTS; attempt += 1) {
94926
94961
  try {
94927
- await this.deps.assessmentRuntimeLock(this.deps.db, assessmentRuntimeAttemptLockKey(attemptId), async () => {
94962
+ await this.deps.assessmentRuntimeLock(this.deps.db, [assessmentRuntimeAttemptLockKey(attemptId)], async () => {
94928
94963
  return;
94929
94964
  });
94930
94965
  return;
@@ -99440,7 +99475,7 @@ var init_upload_service = __esm(() => {
99440
99475
  function createPlatformServices(deps) {
99441
99476
  const {
99442
99477
  db: db2,
99443
- databaseLock,
99478
+ assessmentRuntimeLock,
99444
99479
  config: config5,
99445
99480
  cloudflare: cloudflare2,
99446
99481
  corsKvs,
@@ -99509,7 +99544,7 @@ function createPlatformServices(deps) {
99509
99544
  db: db2,
99510
99545
  timeback: timebackClient,
99511
99546
  validateDeveloperAccess,
99512
- assessmentRuntimeLock: createAssessmentRuntimeLock(databaseLock)
99547
+ assessmentRuntimeLock
99513
99548
  });
99514
99549
  return {
99515
99550
  bucket,
@@ -99527,7 +99562,6 @@ function createPlatformServices(deps) {
99527
99562
  };
99528
99563
  }
99529
99564
  var init_platform2 = __esm(async () => {
99530
- init_assessment_runtime_lock_util();
99531
99565
  init_bucket_service();
99532
99566
  init_database_service();
99533
99567
  init_deployment_state_service();
@@ -100222,7 +100256,7 @@ var init_standalone = __esm(() => {
100222
100256
 
100223
100257
  // ../api-core/src/services/factory/index.ts
100224
100258
  function createServices(ctx) {
100225
- const { db: db2, databaseLock, config: config5, providers, cloudflare: cloudflare2, timeback: timeback2, discord, corsKvs } = ctx;
100259
+ const { db: db2, assessmentRuntimeLock, config: config5, providers, cloudflare: cloudflare2, timeback: timeback2, discord, corsKvs } = ctx;
100226
100260
  const { auth: auth2, storage, r2Storage, cache } = providers;
100227
100261
  const infra2 = createInfraServices({
100228
100262
  db: db2,
@@ -100244,7 +100278,7 @@ function createServices(ctx) {
100244
100278
  });
100245
100279
  const platform2 = createPlatformServices({
100246
100280
  db: db2,
100247
- databaseLock,
100281
+ assessmentRuntimeLock,
100248
100282
  config: config5,
100249
100283
  cloudflare: cloudflare2,
100250
100284
  corsKvs,
@@ -100272,6 +100306,342 @@ var init_factory = __esm(async () => {
100272
100306
  await init_platform2();
100273
100307
  });
100274
100308
 
100309
+ // ../api-core/src/types/context.type.ts
100310
+ function isAuthenticated(ctx) {
100311
+ return ctx.user != null;
100312
+ }
100313
+
100314
+ // ../api-core/src/types/index.ts
100315
+ var init_types5 = () => {};
100316
+
100317
+ // ../api-core/src/utils/auth.util.ts
100318
+ function hasGameManagementAccess(user) {
100319
+ return user.role === "admin" || user.role === "teacher" || user.role === "developer" && user.developerStatus === "approved";
100320
+ }
100321
+ function isDashboardWorkerKey(key) {
100322
+ return Boolean(key?.permissions?.[DASHBOARD_PERMISSION_NAMESPACE]);
100323
+ }
100324
+ function workerKeyGrantsGameRead(key, slug2) {
100325
+ if (!isDashboardWorkerKey(key) && !isGameWorkerKey(key)) {
100326
+ return false;
100327
+ }
100328
+ const games2 = key?.permissions?.games;
100329
+ return Boolean(games2?.includes(`read:${slug2}`) || games2?.includes(`write:${slug2}`));
100330
+ }
100331
+ function isGameWorkerKey(key) {
100332
+ return Boolean(key?.name?.startsWith(GAME_WORKER_KEY_PREFIX));
100333
+ }
100334
+ function deniedWorkerKeyRequest(key, method, pathname) {
100335
+ if (isDashboardWorkerKey(key) && !isAllowedDashboardWorkerRequest(method, pathname, key.permissions)) {
100336
+ return DASHBOARD_WORKER_KEY_RESTRICTED;
100337
+ }
100338
+ return null;
100339
+ }
100340
+ function rejectDashboardWorkerKey(ctx) {
100341
+ if (isDashboardWorkerKey(ctx.apiKey)) {
100342
+ throw ApiError.forbidden(DASHBOARD_WORKER_KEY_RESTRICTED);
100343
+ }
100344
+ }
100345
+ function assertAuthenticatedRequest(ctx) {
100346
+ if (!isAuthenticated(ctx)) {
100347
+ throw ApiError.unauthorized("Valid session or bearer token required");
100348
+ }
100349
+ if (ctx.apiKey) {
100350
+ const denied = deniedWorkerKeyRequest(ctx.apiKey, ctx.request.method, ctx.url.pathname);
100351
+ if (denied) {
100352
+ throw ApiError.forbidden(denied);
100353
+ }
100354
+ }
100355
+ }
100356
+ function requireAuth(handler) {
100357
+ return async (ctx) => {
100358
+ assertAuthenticatedRequest(ctx);
100359
+ return handler(ctx);
100360
+ };
100361
+ }
100362
+ function requireNonAnonymous(handler) {
100363
+ return async (ctx) => {
100364
+ assertAuthenticatedRequest(ctx);
100365
+ if (ctx.user.isAnonymous) {
100366
+ throw ApiError.forbidden("This operation is not available for demo/anonymous users");
100367
+ }
100368
+ return handler(ctx);
100369
+ };
100370
+ }
100371
+ function requireAnonymous(handler) {
100372
+ return async (ctx) => {
100373
+ assertAuthenticatedRequest(ctx);
100374
+ if (!ctx.user.isAnonymous) {
100375
+ throw ApiError.forbidden("This operation is only available for demo/anonymous users");
100376
+ }
100377
+ return handler(ctx);
100378
+ };
100379
+ }
100380
+ function requireDeveloper(handler) {
100381
+ return async (ctx) => {
100382
+ assertAuthenticatedRequest(ctx);
100383
+ rejectDashboardWorkerKey(ctx);
100384
+ const isAdmin = ctx.user.role === "admin";
100385
+ const isApprovedDev = ctx.user.role === "developer" && ctx.user.developerStatus === "approved";
100386
+ if (!isAdmin && !isApprovedDev) {
100387
+ throw ApiError.forbidden("Must be an approved developer");
100388
+ }
100389
+ return handler(ctx);
100390
+ };
100391
+ }
100392
+ function requireHumanDeveloper(handler) {
100393
+ return requireDeveloper(async (ctx) => {
100394
+ if (isDashboardWorkerKey(ctx.apiKey) || isGameWorkerKey(ctx.apiKey)) {
100395
+ throw ApiError.forbidden(WORKER_KEY_HUMAN_ONLY);
100396
+ }
100397
+ return handler(ctx);
100398
+ });
100399
+ }
100400
+ function requireGameManagementAccess(handler) {
100401
+ return async (ctx) => {
100402
+ assertAuthenticatedRequest(ctx);
100403
+ rejectDashboardWorkerKey(ctx);
100404
+ if (!hasGameManagementAccess(ctx.user)) {
100405
+ throw ApiError.forbidden("Game management access required");
100406
+ }
100407
+ return handler(ctx);
100408
+ };
100409
+ }
100410
+ var WORKER_KEY_HUMAN_ONLY = "This operation requires your own credential — platform worker keys are refused";
100411
+ var init_auth_util = __esm(() => {
100412
+ init_errors2();
100413
+ init_types5();
100414
+ init_dashboard_util();
100415
+ init_deployment_util();
100416
+ });
100417
+
100418
+ // ../api-core/src/utils/controller.util.ts
100419
+ function defineControllerNames(namespace, handlers) {
100420
+ for (const [key, handler] of Object.entries(handlers)) {
100421
+ Object.defineProperty(handler, "name", {
100422
+ value: `${namespace}.${key}`,
100423
+ configurable: true
100424
+ });
100425
+ }
100426
+ return handlers;
100427
+ }
100428
+
100429
+ // ../api-core/src/utils/lti.util.ts
100430
+ function generateUsername(email5) {
100431
+ const baseUsername = (email5.split("@")[0] || "user").toLowerCase();
100432
+ const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
100433
+ const randomSuffix = Math.random().toString(36).substring(2, 7);
100434
+ return `${cleanUsername}_${randomSuffix}`;
100435
+ }
100436
+ function extractRedirectPath(targetUri, currentHost) {
100437
+ try {
100438
+ const targetUrl = new URL(targetUri);
100439
+ if (targetUrl.hostname === currentHost) {
100440
+ return targetUrl.pathname + targetUrl.search;
100441
+ }
100442
+ } catch {}
100443
+ return "/";
100444
+ }
100445
+ function validateLtiClaims(claims) {
100446
+ const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
100447
+ const version4 = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
100448
+ if (messageType !== "LtiResourceLinkRequest") {
100449
+ return `Invalid LTI message type: ${messageType}`;
100450
+ }
100451
+ if (version4 !== "1.3.0") {
100452
+ return `Unsupported LTI version: ${version4}`;
100453
+ }
100454
+ return null;
100455
+ }
100456
+ var init_lti_util = () => {};
100457
+
100458
+ // ../api-core/src/utils/lti-provisioning.ts
100459
+ import * as crypto4 from "node:crypto";
100460
+ async function provisionLtiUser(db2, claims) {
100461
+ const database = db2;
100462
+ const email5 = claims.email;
100463
+ const ltiTimebackId = claims.sub;
100464
+ const providerId = AUTH_PROVIDER_IDS.TIMEBACK_LTI;
100465
+ if (!email5) {
100466
+ throw new ValidationError("Email is required in LTI claims");
100467
+ }
100468
+ const existingAccount = await database.query.accounts.findFirst({
100469
+ where: and(eq(accounts.accountId, ltiTimebackId), eq(accounts.providerId, providerId))
100470
+ });
100471
+ if (existingAccount) {
100472
+ const user = await database.query.users.findFirst({
100473
+ where: eq(users.id, existingAccount.userId)
100474
+ });
100475
+ if (user) {
100476
+ setAttribute("app.lti.provision", "existing_account");
100477
+ return user;
100478
+ }
100479
+ }
100480
+ const existingUser = await database.query.users.findFirst({
100481
+ where: eq(users.email, email5)
100482
+ });
100483
+ if (existingUser) {
100484
+ await database.transaction(async (tx) => {
100485
+ const existingLtiAccount = await tx.query.accounts.findFirst({
100486
+ where: and(eq(accounts.userId, existingUser.id), eq(accounts.providerId, providerId))
100487
+ });
100488
+ if (!existingLtiAccount) {
100489
+ const [account] = await tx.insert(accounts).values({
100490
+ id: crypto4.randomUUID(),
100491
+ userId: existingUser.id,
100492
+ accountId: ltiTimebackId,
100493
+ providerId,
100494
+ accessToken: null,
100495
+ refreshToken: null,
100496
+ accessTokenExpiresAt: null,
100497
+ refreshTokenExpiresAt: null,
100498
+ createdAt: new Date,
100499
+ updatedAt: new Date
100500
+ }).returning({ id: accounts.id });
100501
+ if (!account) {
100502
+ throw new InternalError("Failed to link LTI account");
100503
+ }
100504
+ }
100505
+ });
100506
+ setAttribute("app.lti.provision", "linked_account");
100507
+ return existingUser;
100508
+ }
100509
+ const newUserId = crypto4.randomUUID();
100510
+ const createdUser = await database.transaction(async (tx) => {
100511
+ const [insertedUser] = await tx.insert(users).values({
100512
+ id: newUserId,
100513
+ email: email5,
100514
+ emailVerified: true,
100515
+ username: generateUsername(email5),
100516
+ name: claims.name || claims.given_name || email5.split("@")[0] || "Timeback User",
100517
+ createdAt: new Date,
100518
+ updatedAt: new Date
100519
+ }).returning();
100520
+ if (!insertedUser) {
100521
+ throw new InternalError("Failed to create user");
100522
+ }
100523
+ await tx.insert(accounts).values({
100524
+ id: crypto4.randomUUID(),
100525
+ userId: newUserId,
100526
+ accountId: ltiTimebackId,
100527
+ providerId,
100528
+ accessToken: null,
100529
+ refreshToken: null,
100530
+ accessTokenExpiresAt: null,
100531
+ refreshTokenExpiresAt: null,
100532
+ createdAt: new Date,
100533
+ updatedAt: new Date
100534
+ });
100535
+ setAttribute("app.lti.provision", "created_user");
100536
+ return insertedUser;
100537
+ });
100538
+ return createdUser;
100539
+ }
100540
+ var init_lti_provisioning = __esm(() => {
100541
+ init_drizzle_orm();
100542
+ init_src();
100543
+ init_tables_index();
100544
+ init_spans();
100545
+ init_errors2();
100546
+ init_lti_util();
100547
+ });
100548
+
100549
+ // ../api-core/src/utils/params.util.ts
100550
+ function requireGameId(gameId) {
100551
+ if (!gameId) {
100552
+ throw ApiError.badRequest("Missing game ID");
100553
+ }
100554
+ if (!isValidUUID(gameId)) {
100555
+ throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
100556
+ }
100557
+ return gameId;
100558
+ }
100559
+ function requireSlug(slug2) {
100560
+ if (!slug2) {
100561
+ throw ApiError.badRequest("Missing game slug");
100562
+ }
100563
+ return slug2;
100564
+ }
100565
+ function requireUserId(userId) {
100566
+ if (!userId) {
100567
+ throw ApiError.badRequest("Missing user ID");
100568
+ }
100569
+ if (!isValidUUID(userId)) {
100570
+ throw ApiError.unprocessableEntity("userId must be a valid UUID format");
100571
+ }
100572
+ return userId;
100573
+ }
100574
+ function parseLimitParam(url4, max) {
100575
+ const raw = url4.searchParams.get("limit");
100576
+ if (raw === null) {
100577
+ return;
100578
+ }
100579
+ const limit = Number(raw);
100580
+ if (!Number.isInteger(limit) || limit < 1 || limit > max) {
100581
+ throw ApiError.badRequest(`limit must be an integer between 1 and ${max}`);
100582
+ }
100583
+ return limit;
100584
+ }
100585
+ var init_params_util = __esm(() => {
100586
+ init_src9();
100587
+ init_errors2();
100588
+ });
100589
+
100590
+ // ../api-core/src/utils/validation.util.ts
100591
+ function formatZodError(error88) {
100592
+ const flat = error88.flatten();
100593
+ const result = {};
100594
+ if (Object.keys(flat.fieldErrors).length > 0) {
100595
+ result.fields = {};
100596
+ for (const [field, messages] of Object.entries(flat.fieldErrors)) {
100597
+ if (messages && messages.length > 0) {
100598
+ result.fields[field] = messages[0];
100599
+ }
100600
+ }
100601
+ }
100602
+ if (flat.formErrors.length > 0) {
100603
+ result.errors = flat.formErrors;
100604
+ }
100605
+ return result;
100606
+ }
100607
+ function recordValidationFailure(details) {
100608
+ setAttribute("app.request.outcome", "validation_failed");
100609
+ addEvent("request.validation_failed", {
100610
+ "app.validation.error": JSON.stringify(details)
100611
+ });
100612
+ }
100613
+ async function parseRequestBody(request, schema2) {
100614
+ try {
100615
+ return schema2.parse(await request.json());
100616
+ } catch (error88) {
100617
+ if (error88 instanceof exports_external.ZodError) {
100618
+ const details = formatZodError(error88);
100619
+ recordValidationFailure(details);
100620
+ throw ApiError.unprocessableEntity("Validation failed", details);
100621
+ }
100622
+ throw ApiError.invalidJsonBody();
100623
+ }
100624
+ }
100625
+ var init_validation_util = __esm(() => {
100626
+ init_esm();
100627
+ init_spans();
100628
+ init_errors2();
100629
+ });
100630
+ // ../api-core/src/utils/index.ts
100631
+ var init_utils7 = __esm(() => {
100632
+ init_auth_util();
100633
+ init_assessment_runtime_lock_util();
100634
+ init_dashboard_util();
100635
+ init_deployment_util();
100636
+ init_leaderboard_util();
100637
+ init_lti_util();
100638
+ init_lti_provisioning();
100639
+ init_params_util();
100640
+ init_secrets_util();
100641
+ init_timeback_util();
100642
+ init_validation_util();
100643
+ });
100644
+
100275
100645
  // src/infrastructure/api/clients/timeback.ts
100276
100646
  function buildTimebackClient() {
100277
100647
  if (!hasTimebackCredentials()) {
@@ -100659,7 +101029,7 @@ function createSandboxContext(options) {
100659
101029
  const services = {};
100660
101030
  const ctx = {
100661
101031
  db: options.db,
100662
- databaseLock: createInMemoryDatabaseLock(),
101032
+ assessmentRuntimeLock: createInMemoryAssessmentRuntimeLock(),
100663
101033
  config: config5,
100664
101034
  providers,
100665
101035
  services,
@@ -100687,7 +101057,7 @@ function resetSandboxContext() {
100687
101057
  var cachedServiceContext = null, cachedDb = null;
100688
101058
  var init_context = __esm(async () => {
100689
101059
  init_config2();
100690
- init_locks();
101060
+ init_utils7();
100691
101061
  init_src6();
100692
101062
  init_providers();
100693
101063
  await __promiseAll([
@@ -114901,7 +115271,7 @@ __export(exports_api, {
114901
115271
  import process22 from "process";
114902
115272
  import os2 from "os";
114903
115273
  import tty from "tty";
114904
- import { randomUUID } from "crypto";
115274
+ import { randomUUID as randomUUID2 } from "crypto";
114905
115275
  function assembleStyles() {
114906
115276
  const codes = /* @__PURE__ */ new Map;
114907
115277
  for (const [groupName, group] of Object.entries(styles2)) {
@@ -117576,7 +117946,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
117576
117946
  __defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
117577
117947
  }
117578
117948
  return to;
117579
- }, __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_util5, 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, sep3, 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_sql5, _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, CheckBuilder2, _a129, Check2, 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, CheckBuilder22, _a171, Check22, 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) => {
117949
+ }, __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_util5, 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_types6, 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_utils8, 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, sep3, 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_sql5, _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, CheckBuilder2, _a129, Check2, 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, CheckBuilder22, _a171, Check22, 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_utils82, _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) => {
117580
117950
  const matchers = filters.map((it3) => {
117581
117951
  return new Minimatch(it3);
117582
117952
  });
@@ -117833,7 +118203,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
117833
118203
  return { schema: schema5 };
117834
118204
  }, generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
117835
118205
  const prepared = prepareFromExports(imports);
117836
- const id = randomUUID();
118206
+ const id = randomUUID2();
117837
118207
  const snapshot = generatePgSnapshot(prepared.tables, prepared.enums, prepared.schemas, prepared.sequences, prepared.roles, prepared.policies, prepared.views, prepared.matViews, casing2, schemaFilters);
117838
118208
  return fillPgSnapshot({
117839
118209
  serialized: snapshot,
@@ -117879,7 +118249,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
117879
118249
  }, generateSQLiteDrizzleJson = async (imports, prevId, casing2) => {
117880
118250
  const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
117881
118251
  const prepared = prepareFromExports5(imports);
117882
- const id = randomUUID();
118252
+ const id = randomUUID2();
117883
118253
  const snapshot = generateSqliteSnapshot(prepared.tables, prepared.views, casing2);
117884
118254
  return {
117885
118255
  ...snapshot,
@@ -117927,7 +118297,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
117927
118297
  }, generateMySQLDrizzleJson = async (imports, prevId, casing2) => {
117928
118298
  const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
117929
118299
  const prepared = prepareFromExports5(imports);
117930
- const id = randomUUID();
118300
+ const id = randomUUID2();
117931
118301
  const snapshot = generateMySqlSnapshot(prepared.tables, prepared.views, casing2);
117932
118302
  return {
117933
118303
  ...snapshot,
@@ -117974,7 +118344,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
117974
118344
  }, generateSingleStoreDrizzleJson = async (imports, prevId, casing2) => {
117975
118345
  const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_singlestoreImports(), singlestoreImports_exports));
117976
118346
  const prepared = prepareFromExports5(imports);
117977
- const id = randomUUID();
118347
+ const id = randomUUID2();
117978
118348
  const snapshot = generateSingleStoreSnapshot(prepared.tables, casing2);
117979
118349
  return {
117980
118350
  ...snapshot,
@@ -121586,7 +121956,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
121586
121956
  })(errorUtil2 || (errorUtil2 = {}));
121587
121957
  }
121588
121958
  });
121589
- init_types5 = __esm2({
121959
+ init_types6 = __esm2({
121590
121960
  "../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js"() {
121591
121961
  init_ZodError2();
121592
121962
  init_errors9();
@@ -124751,7 +125121,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
124751
125121
  init_parseUtil2();
124752
125122
  init_typeAliases2();
124753
125123
  init_util5();
124754
- init_types5();
125124
+ init_types6();
124755
125125
  init_ZodError2();
124756
125126
  }
124757
125127
  });
@@ -126484,7 +126854,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
126484
126854
  backwardCompatibleSqliteSchema = unionType2([sqliteSchemaV5, schema3]);
126485
126855
  }
126486
126856
  });
126487
- init_utils7 = __esm2({
126857
+ init_utils8 = __esm2({
126488
126858
  "src/utils.ts"() {
126489
126859
  init_views();
126490
126860
  init_global2();
@@ -126536,7 +126906,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
126536
126906
  "src/cli/views.ts"() {
126537
126907
  init_source();
126538
126908
  import_hanji = __toESM5(require_hanji());
126539
- init_utils7();
126909
+ init_utils8();
126540
126910
  warning = (msg) => {
126541
126911
  (0, import_hanji.render)(`[${source_default.yellow("Warning")}] ${msg}`);
126542
126912
  };
@@ -129244,7 +129614,7 @@ Is ${source_default.bold.blue(this.base.name)} schema created or renamed from an
129244
129614
  init_pgSchema();
129245
129615
  init_singlestoreSchema();
129246
129616
  init_sqliteSchema();
129247
- init_utils7();
129617
+ init_utils8();
129248
129618
  parseType = (schemaPrefix, type) => {
129249
129619
  const pgNativeTypes = [
129250
129620
  "uuid",
@@ -131740,7 +132110,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
131740
132110
  init_source();
131741
132111
  init_sqliteSchema();
131742
132112
  init_sqlgenerator();
131743
- init_utils7();
132113
+ init_utils8();
131744
132114
  _moveDataStatements = (tableName, json42, dataLoss = false) => {
131745
132115
  const statements = [];
131746
132116
  const newTableName = `__new_${tableName}`;
@@ -133898,7 +134268,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
133898
134268
  init_singlestoreSchema();
133899
134269
  init_sqliteSchema();
133900
134270
  init_statementCombiner();
133901
- init_utils7();
134271
+ init_utils8();
133902
134272
  makeChanged = (schema5) => {
133903
134273
  return objectType2({
133904
134274
  type: enumType2(["changed"]),
@@ -136123,7 +136493,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
136123
136493
  init_pgSchema();
136124
136494
  init_sqliteSchema();
136125
136495
  init_snapshotsDiffer();
136126
- init_utils7();
136496
+ init_utils8();
136127
136497
  init_words();
136128
136498
  init_outputs();
136129
136499
  init_views();
@@ -142683,7 +143053,7 @@ params: ${params}`);
142683
143053
  init_pg_core2();
142684
143054
  init_vector32();
142685
143055
  init_outputs();
142686
- init_utils7();
143056
+ init_utils8();
142687
143057
  init_utils62();
142688
143058
  indexName = (tableName, columns2) => {
142689
143059
  return `${tableName}_${columns2.join("_")}_index`;
@@ -146692,7 +147062,7 @@ ORDER BY
146692
147062
  init_dist9();
146693
147063
  init_sqlite_core();
146694
147064
  init_outputs();
146695
- init_utils7();
147065
+ init_utils8();
146696
147066
  init_utils62();
146697
147067
  generateSqliteSnapshot = (tables, views, casing2) => {
146698
147068
  const dialect6 = new SQLiteSyncDialect({ casing: casing2 });
@@ -148645,7 +149015,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
148645
149015
  MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
148646
149016
  }
148647
149017
  });
148648
- init_utils8 = __esm2({
149018
+ init_utils82 = __esm2({
148649
149019
  "../drizzle-orm/dist/mysql-core/utils.js"() {
148650
149020
  init_entity2();
148651
149021
  init_dist9();
@@ -148667,7 +149037,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
148667
149037
  init_query_promise2();
148668
149038
  init_selection_proxy2();
148669
149039
  init_table8();
148670
- init_utils8();
149040
+ init_utils82();
148671
149041
  MySqlDeleteBase = class extends (_b239 = QueryPromise2, _a3222 = entityKind2, _b239) {
148672
149042
  constructor(table62, session3, dialect6, withList) {
148673
149043
  super();
@@ -149515,7 +149885,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
149515
149885
  init_table8();
149516
149886
  init_utils22();
149517
149887
  init_view_common3();
149518
- init_utils8();
149888
+ init_utils82();
149519
149889
  init_view_base3();
149520
149890
  _a325 = entityKind2;
149521
149891
  MySqlSelectBuilder = class {
@@ -149914,7 +150284,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
149914
150284
  init_sql5();
149915
150285
  init_table8();
149916
150286
  init_utils22();
149917
- init_utils8();
150287
+ init_utils82();
149918
150288
  init_query_builder4();
149919
150289
  _a329 = entityKind2;
149920
150290
  MySqlInsertBuilder = class {
@@ -150018,7 +150388,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
150018
150388
  init_selection_proxy2();
150019
150389
  init_table8();
150020
150390
  init_utils22();
150021
- init_utils8();
150391
+ init_utils82();
150022
150392
  _a331 = entityKind2;
150023
150393
  MySqlUpdateBuilder = class {
150024
150394
  constructor(table62, session3, dialect6, withList) {
@@ -150554,7 +150924,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
150554
150924
  init_subquery4();
150555
150925
  init_table42();
150556
150926
  init_unique_constraint3();
150557
- init_utils8();
150927
+ init_utils82();
150558
150928
  init_view_common32();
150559
150929
  init_view3();
150560
150930
  }
@@ -150565,7 +150935,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
150565
150935
  init_dist9();
150566
150936
  init_mysql_core();
150567
150937
  init_outputs();
150568
- init_utils7();
150938
+ init_utils8();
150569
150939
  init_utils62();
150570
150940
  handleEnumType = (type) => {
150571
150941
  let str = type.split("(")[1];
@@ -154999,7 +155369,7 @@ The unique index ${source_default.underline.blue(name22)} on the ${source_defaul
154999
155369
  import_hanji10 = __toESM5(require_hanji());
155000
155370
  init_sqlgenerator();
155001
155371
  init_singlestoreSchema();
155002
- init_utils7();
155372
+ init_utils8();
155003
155373
  init_selector_ui();
155004
155374
  init_outputs();
155005
155375
  filterStatements2 = (statements, currentSchema, prevSchema) => {
@@ -155262,7 +155632,7 @@ The unique index ${source_default.underline.blue(name22)} on the ${source_defaul
155262
155632
  init_sqlgenerator();
155263
155633
  init_selector_ui();
155264
155634
  init_pgSchema();
155265
- init_utils7();
155635
+ init_utils8();
155266
155636
  import_hanji6 = __toESM5(require_hanji());
155267
155637
  init_mjs();
155268
155638
  init_global2();
@@ -156150,346 +156520,11 @@ var init_manifest = __esm(async () => {
156150
156520
  });
156151
156521
  });
156152
156522
 
156153
- // ../api-core/src/types/context.type.ts
156154
- function isAuthenticated(ctx) {
156155
- return ctx.user != null;
156156
- }
156157
-
156158
- // ../api-core/src/types/index.ts
156159
- var init_types6 = () => {};
156160
-
156161
- // ../api-core/src/utils/auth.util.ts
156162
- function hasGameManagementAccess(user) {
156163
- return user.role === "admin" || user.role === "teacher" || user.role === "developer" && user.developerStatus === "approved";
156164
- }
156165
- function isDashboardWorkerKey(key) {
156166
- return Boolean(key?.permissions?.[DASHBOARD_PERMISSION_NAMESPACE]);
156167
- }
156168
- function workerKeyGrantsGameRead(key, slug2) {
156169
- if (!isDashboardWorkerKey(key) && !isGameWorkerKey(key)) {
156170
- return false;
156171
- }
156172
- const games2 = key?.permissions?.games;
156173
- return Boolean(games2?.includes(`read:${slug2}`) || games2?.includes(`write:${slug2}`));
156174
- }
156175
- function isGameWorkerKey(key) {
156176
- return Boolean(key?.name?.startsWith(GAME_WORKER_KEY_PREFIX));
156177
- }
156178
- function deniedWorkerKeyRequest(key, method, pathname) {
156179
- if (isDashboardWorkerKey(key) && !isAllowedDashboardWorkerRequest(method, pathname, key.permissions)) {
156180
- return DASHBOARD_WORKER_KEY_RESTRICTED;
156181
- }
156182
- return null;
156183
- }
156184
- function rejectDashboardWorkerKey(ctx) {
156185
- if (isDashboardWorkerKey(ctx.apiKey)) {
156186
- throw ApiError.forbidden(DASHBOARD_WORKER_KEY_RESTRICTED);
156187
- }
156188
- }
156189
- function assertAuthenticatedRequest(ctx) {
156190
- if (!isAuthenticated(ctx)) {
156191
- throw ApiError.unauthorized("Valid session or bearer token required");
156192
- }
156193
- if (ctx.apiKey) {
156194
- const denied = deniedWorkerKeyRequest(ctx.apiKey, ctx.request.method, ctx.url.pathname);
156195
- if (denied) {
156196
- throw ApiError.forbidden(denied);
156197
- }
156198
- }
156199
- }
156200
- function requireAuth(handler) {
156201
- return async (ctx) => {
156202
- assertAuthenticatedRequest(ctx);
156203
- return handler(ctx);
156204
- };
156205
- }
156206
- function requireNonAnonymous(handler) {
156207
- return async (ctx) => {
156208
- assertAuthenticatedRequest(ctx);
156209
- if (ctx.user.isAnonymous) {
156210
- throw ApiError.forbidden("This operation is not available for demo/anonymous users");
156211
- }
156212
- return handler(ctx);
156213
- };
156214
- }
156215
- function requireAnonymous(handler) {
156216
- return async (ctx) => {
156217
- assertAuthenticatedRequest(ctx);
156218
- if (!ctx.user.isAnonymous) {
156219
- throw ApiError.forbidden("This operation is only available for demo/anonymous users");
156220
- }
156221
- return handler(ctx);
156222
- };
156223
- }
156224
- function requireDeveloper(handler) {
156225
- return async (ctx) => {
156226
- assertAuthenticatedRequest(ctx);
156227
- rejectDashboardWorkerKey(ctx);
156228
- const isAdmin = ctx.user.role === "admin";
156229
- const isApprovedDev = ctx.user.role === "developer" && ctx.user.developerStatus === "approved";
156230
- if (!isAdmin && !isApprovedDev) {
156231
- throw ApiError.forbidden("Must be an approved developer");
156232
- }
156233
- return handler(ctx);
156234
- };
156235
- }
156236
- function requireHumanDeveloper(handler) {
156237
- return requireDeveloper(async (ctx) => {
156238
- if (isDashboardWorkerKey(ctx.apiKey) || isGameWorkerKey(ctx.apiKey)) {
156239
- throw ApiError.forbidden(WORKER_KEY_HUMAN_ONLY);
156240
- }
156241
- return handler(ctx);
156242
- });
156243
- }
156244
- function requireGameManagementAccess(handler) {
156245
- return async (ctx) => {
156246
- assertAuthenticatedRequest(ctx);
156247
- rejectDashboardWorkerKey(ctx);
156248
- if (!hasGameManagementAccess(ctx.user)) {
156249
- throw ApiError.forbidden("Game management access required");
156250
- }
156251
- return handler(ctx);
156252
- };
156253
- }
156254
- var WORKER_KEY_HUMAN_ONLY = "This operation requires your own credential — platform worker keys are refused";
156255
- var init_auth_util = __esm(() => {
156256
- init_errors2();
156257
- init_types6();
156258
- init_dashboard_util();
156259
- init_deployment_util();
156260
- });
156261
-
156262
- // ../api-core/src/utils/controller.util.ts
156263
- function defineControllerNames(namespace, handlers) {
156264
- for (const [key, handler] of Object.entries(handlers)) {
156265
- Object.defineProperty(handler, "name", {
156266
- value: `${namespace}.${key}`,
156267
- configurable: true
156268
- });
156269
- }
156270
- return handlers;
156271
- }
156272
-
156273
- // ../api-core/src/utils/lti.util.ts
156274
- function generateUsername(email5) {
156275
- const baseUsername = (email5.split("@")[0] || "user").toLowerCase();
156276
- const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
156277
- const randomSuffix = Math.random().toString(36).substring(2, 7);
156278
- return `${cleanUsername}_${randomSuffix}`;
156279
- }
156280
- function extractRedirectPath(targetUri, currentHost) {
156281
- try {
156282
- const targetUrl = new URL(targetUri);
156283
- if (targetUrl.hostname === currentHost) {
156284
- return targetUrl.pathname + targetUrl.search;
156285
- }
156286
- } catch {}
156287
- return "/";
156288
- }
156289
- function validateLtiClaims(claims) {
156290
- const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
156291
- const version6 = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
156292
- if (messageType !== "LtiResourceLinkRequest") {
156293
- return `Invalid LTI message type: ${messageType}`;
156294
- }
156295
- if (version6 !== "1.3.0") {
156296
- return `Unsupported LTI version: ${version6}`;
156297
- }
156298
- return null;
156299
- }
156300
- var init_lti_util = () => {};
156301
-
156302
- // ../api-core/src/utils/lti-provisioning.ts
156303
- import * as crypto4 from "node:crypto";
156304
- async function provisionLtiUser(db2, claims) {
156305
- const database = db2;
156306
- const email5 = claims.email;
156307
- const ltiTimebackId = claims.sub;
156308
- const providerId = AUTH_PROVIDER_IDS.TIMEBACK_LTI;
156309
- if (!email5) {
156310
- throw new ValidationError("Email is required in LTI claims");
156311
- }
156312
- const existingAccount = await database.query.accounts.findFirst({
156313
- where: and(eq(accounts.accountId, ltiTimebackId), eq(accounts.providerId, providerId))
156314
- });
156315
- if (existingAccount) {
156316
- const user = await database.query.users.findFirst({
156317
- where: eq(users.id, existingAccount.userId)
156318
- });
156319
- if (user) {
156320
- setAttribute("app.lti.provision", "existing_account");
156321
- return user;
156322
- }
156323
- }
156324
- const existingUser = await database.query.users.findFirst({
156325
- where: eq(users.email, email5)
156326
- });
156327
- if (existingUser) {
156328
- await database.transaction(async (tx) => {
156329
- const existingLtiAccount = await tx.query.accounts.findFirst({
156330
- where: and(eq(accounts.userId, existingUser.id), eq(accounts.providerId, providerId))
156331
- });
156332
- if (!existingLtiAccount) {
156333
- const [account] = await tx.insert(accounts).values({
156334
- id: crypto4.randomUUID(),
156335
- userId: existingUser.id,
156336
- accountId: ltiTimebackId,
156337
- providerId,
156338
- accessToken: null,
156339
- refreshToken: null,
156340
- accessTokenExpiresAt: null,
156341
- refreshTokenExpiresAt: null,
156342
- createdAt: new Date,
156343
- updatedAt: new Date
156344
- }).returning({ id: accounts.id });
156345
- if (!account) {
156346
- throw new InternalError("Failed to link LTI account");
156347
- }
156348
- }
156349
- });
156350
- setAttribute("app.lti.provision", "linked_account");
156351
- return existingUser;
156352
- }
156353
- const newUserId = crypto4.randomUUID();
156354
- const createdUser = await database.transaction(async (tx) => {
156355
- const [insertedUser] = await tx.insert(users).values({
156356
- id: newUserId,
156357
- email: email5,
156358
- emailVerified: true,
156359
- username: generateUsername(email5),
156360
- name: claims.name || claims.given_name || email5.split("@")[0] || "Timeback User",
156361
- createdAt: new Date,
156362
- updatedAt: new Date
156363
- }).returning();
156364
- if (!insertedUser) {
156365
- throw new InternalError("Failed to create user");
156366
- }
156367
- await tx.insert(accounts).values({
156368
- id: crypto4.randomUUID(),
156369
- userId: newUserId,
156370
- accountId: ltiTimebackId,
156371
- providerId,
156372
- accessToken: null,
156373
- refreshToken: null,
156374
- accessTokenExpiresAt: null,
156375
- refreshTokenExpiresAt: null,
156376
- createdAt: new Date,
156377
- updatedAt: new Date
156378
- });
156379
- setAttribute("app.lti.provision", "created_user");
156380
- return insertedUser;
156381
- });
156382
- return createdUser;
156383
- }
156384
- var init_lti_provisioning = __esm(() => {
156385
- init_drizzle_orm();
156386
- init_src();
156387
- init_tables_index();
156388
- init_spans();
156389
- init_errors2();
156390
- init_lti_util();
156391
- });
156392
-
156393
- // ../api-core/src/utils/params.util.ts
156394
- function requireGameId(gameId) {
156395
- if (!gameId) {
156396
- throw ApiError.badRequest("Missing game ID");
156397
- }
156398
- if (!isValidUUID(gameId)) {
156399
- throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
156400
- }
156401
- return gameId;
156402
- }
156403
- function requireSlug(slug2) {
156404
- if (!slug2) {
156405
- throw ApiError.badRequest("Missing game slug");
156406
- }
156407
- return slug2;
156408
- }
156409
- function requireUserId(userId) {
156410
- if (!userId) {
156411
- throw ApiError.badRequest("Missing user ID");
156412
- }
156413
- if (!isValidUUID(userId)) {
156414
- throw ApiError.unprocessableEntity("userId must be a valid UUID format");
156415
- }
156416
- return userId;
156417
- }
156418
- function parseLimitParam(url4, max2) {
156419
- const raw2 = url4.searchParams.get("limit");
156420
- if (raw2 === null) {
156421
- return;
156422
- }
156423
- const limit = Number(raw2);
156424
- if (!Number.isInteger(limit) || limit < 1 || limit > max2) {
156425
- throw ApiError.badRequest(`limit must be an integer between 1 and ${max2}`);
156426
- }
156427
- return limit;
156428
- }
156429
- var init_params_util = __esm(() => {
156430
- init_src9();
156431
- init_errors2();
156432
- });
156433
-
156434
- // ../api-core/src/utils/validation.util.ts
156435
- function formatZodError(error89) {
156436
- const flat = error89.flatten();
156437
- const result = {};
156438
- if (Object.keys(flat.fieldErrors).length > 0) {
156439
- result.fields = {};
156440
- for (const [field, messages] of Object.entries(flat.fieldErrors)) {
156441
- if (messages && messages.length > 0) {
156442
- result.fields[field] = messages[0];
156443
- }
156444
- }
156445
- }
156446
- if (flat.formErrors.length > 0) {
156447
- result.errors = flat.formErrors;
156448
- }
156449
- return result;
156450
- }
156451
- function recordValidationFailure(details) {
156452
- setAttribute("app.request.outcome", "validation_failed");
156453
- addEvent("request.validation_failed", {
156454
- "app.validation.error": JSON.stringify(details)
156455
- });
156456
- }
156457
- async function parseRequestBody(request, schema4) {
156458
- try {
156459
- return schema4.parse(await request.json());
156460
- } catch (error89) {
156461
- if (error89 instanceof exports_external.ZodError) {
156462
- const details = formatZodError(error89);
156463
- recordValidationFailure(details);
156464
- throw ApiError.unprocessableEntity("Validation failed", details);
156465
- }
156466
- throw ApiError.invalidJsonBody();
156467
- }
156468
- }
156469
- var init_validation_util = __esm(() => {
156470
- init_esm();
156471
- init_spans();
156472
- init_errors2();
156473
- });
156474
- // ../api-core/src/utils/index.ts
156475
- var init_utils11 = __esm(() => {
156476
- init_auth_util();
156477
- init_dashboard_util();
156478
- init_deployment_util();
156479
- init_leaderboard_util();
156480
- init_lti_util();
156481
- init_lti_provisioning();
156482
- init_params_util();
156483
- init_secrets_util();
156484
- init_timeback_util();
156485
- init_validation_util();
156486
- });
156487
-
156488
156523
  // ../api-core/src/controllers/bucket.controller.ts
156489
156524
  var listFiles, getFile, putFile, deleteFile, initiateUpload, bucket;
156490
156525
  var init_bucket_controller = __esm(() => {
156491
156526
  init_errors2();
156492
- init_utils11();
156527
+ init_utils7();
156493
156528
  listFiles = requireDeveloper(async (ctx) => {
156494
156529
  const slug2 = ctx.params.slug;
156495
156530
  if (!slug2) {
@@ -156581,7 +156616,7 @@ var listUsers, addUser, issueRecoveryLink, removeUser, remove, verifyLogin, acce
156581
156616
  var init_dashboard_controller = __esm(() => {
156582
156617
  init_schemas_index();
156583
156618
  init_errors2();
156584
- init_utils11();
156619
+ init_utils7();
156585
156620
  listUsers = requireHumanDeveloper(async (ctx) => {
156586
156621
  const slug2 = requireSlug(ctx.params.slug);
156587
156622
  const users2 = await ctx.services.dashboard.listUsers(slug2, ctx.user);
@@ -156653,7 +156688,7 @@ var init_database_controller = __esm(() => {
156653
156688
  init_esm();
156654
156689
  init_schemas_index();
156655
156690
  init_errors2();
156656
- init_utils11();
156691
+ init_utils7();
156657
156692
  reset = requireDeveloper(async (ctx) => {
156658
156693
  const slug2 = ctx.params.slug;
156659
156694
  if (!slug2) {
@@ -156716,7 +156751,7 @@ var init_deploy_controller = __esm(() => {
156716
156751
  init_esm();
156717
156752
  init_schemas_index();
156718
156753
  init_errors2();
156719
- init_utils11();
156754
+ init_utils7();
156720
156755
  deploy = defineControllerNames("deploy", {
156721
156756
  createJob: requireDeveloper(createJob),
156722
156757
  getJob: requireDeveloper(getJob)
@@ -156728,7 +156763,7 @@ var get, baseline, realignMigration, resolveMigration, history, restorePoints, r
156728
156763
  var init_deployment_state_controller = __esm(() => {
156729
156764
  init_schemas_index();
156730
156765
  init_errors2();
156731
- init_utils11();
156766
+ init_utils7();
156732
156767
  get = requireDeveloper(async (ctx) => {
156733
156768
  const slug2 = requireSlug(ctx.params.slug);
156734
156769
  const include = ctx.url.searchParams.getAll("include").flatMap((value) => value.split(",")).filter(Boolean);
@@ -156798,7 +156833,7 @@ var init_deployment_state_controller = __esm(() => {
156798
156833
  // ../api-core/src/controllers/developer.controller.ts
156799
156834
  var apply, getStatus, developer;
156800
156835
  var init_developer_controller = __esm(() => {
156801
- init_utils11();
156836
+ init_utils7();
156802
156837
  apply = requireNonAnonymous(async (ctx) => {
156803
156838
  await ctx.services.developer.apply(ctx.user);
156804
156839
  });
@@ -156819,7 +156854,7 @@ var init_domain_controller = __esm(() => {
156819
156854
  init_schemas_index();
156820
156855
  init_config2();
156821
156856
  init_errors2();
156822
- init_utils11();
156857
+ init_utils7();
156823
156858
  add = requireDeveloper(async (ctx) => {
156824
156859
  const slug2 = ctx.params.slug;
156825
156860
  if (!slug2) {
@@ -156893,7 +156928,7 @@ var listMembers, addMember, updateMemberRole, removeMember, searchUsersForMember
156893
156928
  var init_game_member_controller = __esm(() => {
156894
156929
  init_schemas_index();
156895
156930
  init_errors2();
156896
- init_utils11();
156931
+ init_utils7();
156897
156932
  listMembers = requireNonAnonymous(async (ctx) => {
156898
156933
  const gameId = requireGameId(ctx.params.gameId);
156899
156934
  return ctx.services.gameMember.list(gameId, ctx.user);
@@ -156934,7 +156969,7 @@ var init_game_controller = __esm(() => {
156934
156969
  init_esm();
156935
156970
  init_schemas_index();
156936
156971
  init_errors2();
156937
- init_utils11();
156972
+ init_utils7();
156938
156973
  init_auth_util();
156939
156974
  list2 = requireNonAnonymous(async (ctx) => ctx.services.game.list(ctx.user));
156940
156975
  listAccessible = requireNonAnonymous(async (ctx) => ctx.services.game.listAccessible(ctx.user));
@@ -157005,7 +157040,7 @@ var init_kv_controller = __esm(() => {
157005
157040
  init_esm();
157006
157041
  init_schemas_index();
157007
157042
  init_errors2();
157008
- init_utils11();
157043
+ init_utils7();
157009
157044
  listKeys = requireDeveloper(async (ctx) => {
157010
157045
  const slug2 = ctx.params.slug;
157011
157046
  if (!slug2) {
@@ -157109,7 +157144,7 @@ var init_leaderboard_controller = __esm(() => {
157109
157144
  init_esm();
157110
157145
  init_schemas_index();
157111
157146
  init_errors2();
157112
- init_utils11();
157147
+ init_utils7();
157113
157148
  submitScore = requireAuth(async (ctx) => {
157114
157149
  const gameId = ctx.params.gameId;
157115
157150
  if (!gameId) {
@@ -157218,7 +157253,7 @@ var init_leaderboard_controller = __esm(() => {
157218
157253
  var generateToken, logs;
157219
157254
  var init_logs_controller = __esm(() => {
157220
157255
  init_errors2();
157221
- init_utils11();
157256
+ init_utils7();
157222
157257
  generateToken = requireDeveloper(async (ctx) => {
157223
157258
  const slug2 = ctx.params.slug;
157224
157259
  if (!slug2) {
@@ -157253,7 +157288,7 @@ var init_logs_controller = __esm(() => {
157253
157288
  // ../api-core/src/controllers/lti.controller.ts
157254
157289
  var getStatus3, lti;
157255
157290
  var init_lti_controller = __esm(() => {
157256
- init_utils11();
157291
+ init_utils7();
157257
157292
  getStatus3 = requireNonAnonymous(async (ctx) => ctx.services.lti.getStatus(ctx.user));
157258
157293
  lti = defineControllerNames("lti", {
157259
157294
  getStatus: getStatus3
@@ -157266,7 +157301,7 @@ var init_secrets_controller = __esm(() => {
157266
157301
  init_esm();
157267
157302
  init_schemas_index();
157268
157303
  init_errors2();
157269
- init_utils11();
157304
+ init_utils7();
157270
157305
  listKeys2 = requireDeveloper(async (ctx) => {
157271
157306
  const slug2 = ctx.params.slug;
157272
157307
  if (!slug2) {
@@ -157329,7 +157364,7 @@ var init_seed_controller = __esm(() => {
157329
157364
  init_esm();
157330
157365
  init_schemas_index();
157331
157366
  init_errors2();
157332
- init_utils11();
157367
+ init_utils7();
157333
157368
  seed2 = requireDeveloper(async (ctx) => {
157334
157369
  const slug2 = ctx.params.slug;
157335
157370
  if (!slug2) {
@@ -157361,7 +157396,7 @@ var init_session_controller = __esm(() => {
157361
157396
  init_spans();
157362
157397
  init_tunnel();
157363
157398
  init_errors2();
157364
- init_utils11();
157399
+ init_utils7();
157365
157400
  MintTokenBody = exports_external.object({
157366
157401
  reason: exports_external.enum(["initial", "refresh_scheduled", "refresh_stale"]).optional()
157367
157402
  });
@@ -157419,7 +157454,7 @@ var init_timeback_controller = __esm(() => {
157419
157454
  init_src9();
157420
157455
  init_timeback3();
157421
157456
  init_errors2();
157422
- init_utils11();
157457
+ init_utils7();
157423
157458
  populateStudent = requireNonAnonymous(async (ctx) => {
157424
157459
  let providedNames;
157425
157460
  try {
@@ -158254,7 +158289,7 @@ var init_upload_controller = __esm(() => {
158254
158289
  init_esm();
158255
158290
  init_schemas_index();
158256
158291
  init_errors2();
158257
- init_utils11();
158292
+ init_utils7();
158258
158293
  initiate = requireDeveloper(async (ctx) => {
158259
158294
  let body2;
158260
158295
  try {
@@ -158280,7 +158315,7 @@ var getMe, getDemoProfile, updateDemoProfile, users2;
158280
158315
  var init_user_controller = __esm(() => {
158281
158316
  init_src();
158282
158317
  init_schemas_index();
158283
- init_utils11();
158318
+ init_utils7();
158284
158319
  getMe = requireNonAnonymous(async (ctx) => ctx.services.user.getMe(ctx.user, ctx.gameId, ctx.request.headers.get(PLAYCADEMY_BROWSER_TIME_ZONE_HEADER)));
158285
158320
  getDemoProfile = requireAnonymous(async (ctx) => ctx.services.user.getDemoProfile(ctx.user.id));
158286
158321
  updateDemoProfile = requireAnonymous(async (ctx) => {
@@ -158315,7 +158350,7 @@ var init_verify_controller = __esm(() => {
158315
158350
  init_esm();
158316
158351
  init_schemas_index();
158317
158352
  init_errors2();
158318
- init_utils11();
158353
+ init_utils7();
158319
158354
  verify = defineControllerNames("verify", {
158320
158355
  verifyToken
158321
158356
  });
@@ -158504,7 +158539,7 @@ async function buildMockUserResponse(db2, user, gameId, observedTimeZone) {
158504
158539
  var LEARNING_TIME_ZONE_REFRESH_INTERVAL_MS2;
158505
158540
  var init_timeback7 = __esm(() => {
158506
158541
  init_drizzle_orm();
158507
- init_utils11();
158542
+ init_utils7();
158508
158543
  init_src();
158509
158544
  init_tables_index();
158510
158545
  init_src6();
@@ -158934,7 +158969,7 @@ var init_seed2 = __esm(async () => {
158934
158969
  init_dist7();
158935
158970
  init_esm();
158936
158971
  init_errors2();
158937
- init_utils11();
158972
+ init_utils7();
158938
158973
  init_schemas_index();
158939
158974
  await init_api3();
158940
158975
  gameSeedRouter = new Hono2;
@@ -159174,7 +159209,7 @@ var init_timeback8 = __esm(async () => {
159174
159209
  init_dist7();
159175
159210
  init_controllers();
159176
159211
  init_errors2();
159177
- init_utils11();
159212
+ init_utils7();
159178
159213
  init_src();
159179
159214
  init_schemas_index();
159180
159215
  init_timeback3();
@@ -159414,7 +159449,7 @@ var init_lti = __esm(async () => {
159414
159449
  init_drizzle_orm();
159415
159450
  init_dist7();
159416
159451
  init_controllers();
159417
- init_utils11();
159452
+ init_utils7();
159418
159453
  init_tables_index();
159419
159454
  init_src6();
159420
159455
  init_constants();