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