@playcademy/sandbox 0.3.9 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1224,7 +1224,7 @@ var package_default;
1224
1224
  var init_package = __esm(() => {
1225
1225
  package_default = {
1226
1226
  name: "@playcademy/sandbox",
1227
- version: "0.3.9",
1227
+ version: "0.3.10",
1228
1228
  description: "Local development server for Playcademy game development",
1229
1229
  type: "module",
1230
1230
  exports: {
@@ -5720,7 +5720,7 @@ function isProduction2(config2) {
5720
5720
  var stageSchema, ltiConfigSchema, realtimeConfigSchema, apiConfigSchema;
5721
5721
  var init_schema = __esm(() => {
5722
5722
  init_esm();
5723
- stageSchema = exports_external.enum(["production", "staging", "local"]);
5723
+ stageSchema = exports_external.enum(["production", "dev", "local"]);
5724
5724
  ltiConfigSchema = exports_external.object({
5725
5725
  audience: exports_external.string(),
5726
5726
  jwksUrl: exports_external.string().url(),
@@ -13458,7 +13458,7 @@ class DeployService {
13458
13458
  }
13459
13459
  return cf;
13460
13460
  }
13461
- async createAndPersistApiKey(user, slug2, game, keyName) {
13461
+ async createApiKey(user, slug2, keyName) {
13462
13462
  const { id, key: apiKey } = await this.ctx.providers.auth.createApiKey({
13463
13463
  userId: user.id,
13464
13464
  name: keyName,
@@ -13467,16 +13467,6 @@ class DeployService {
13467
13467
  games: [`read:${slug2}`, `write:${slug2}`]
13468
13468
  }
13469
13469
  });
13470
- try {
13471
- const existingSecrets = await this.ctx.providers.secrets.readSecrets(game.id) || {};
13472
- await this.ctx.providers.secrets.writeSecrets(game.id, {
13473
- ...existingSecrets,
13474
- PLAYCADEMY_API_KEY: apiKey
13475
- });
13476
- logger8.debug("Persisted API key to secrets", { gameId: game.id });
13477
- } catch (error) {
13478
- logger8.warn("Failed to persist API key to secrets", { error });
13479
- }
13480
13470
  logger8.info("Created new game-scoped API key", {
13481
13471
  userId: user.id,
13482
13472
  slug: slug2,
@@ -13484,48 +13474,47 @@ class DeployService {
13484
13474
  });
13485
13475
  return apiKey;
13486
13476
  }
13487
- async retrieveApiKeyFromSecrets(gameId) {
13488
- try {
13489
- const secrets = await this.ctx.providers.secrets.readSecrets(gameId);
13490
- if (secrets?.PLAYCADEMY_API_KEY) {
13491
- logger8.debug("Retrieved API key from secrets");
13492
- return secrets.PLAYCADEMY_API_KEY;
13493
- }
13494
- return null;
13495
- } catch (error) {
13496
- logger8.warn("Failed to retrieve secrets", { error });
13497
- return null;
13498
- }
13499
- }
13500
- async regenerateAndPersistApiKey(user, slug2, game, existingKeyId, keyName) {
13501
- logger8.info("Regenerating API key (migration)", {
13502
- userId: user.id,
13503
- slug: slug2,
13504
- oldKeyId: existingKeyId
13505
- });
13506
- try {
13507
- await this.ctx.providers.auth.deleteApiKey(existingKeyId);
13508
- logger8.debug("Revoked old API key", { keyId: existingKeyId });
13509
- } catch (error) {
13510
- logger8.warn("Failed to revoke old API key", {
13511
- keyId: existingKeyId,
13512
- error
13477
+ async regenerateApiKey(user, slug2, existingKeyId, keyName) {
13478
+ if (existingKeyId) {
13479
+ logger8.info("Regenerating API key", {
13480
+ userId: user.id,
13481
+ slug: slug2,
13482
+ oldKeyId: existingKeyId
13513
13483
  });
13484
+ try {
13485
+ await this.ctx.providers.auth.deleteApiKey(existingKeyId);
13486
+ logger8.debug("Revoked old API key", { keyId: existingKeyId });
13487
+ } catch (error) {
13488
+ logger8.warn("Failed to revoke old API key", {
13489
+ keyId: existingKeyId,
13490
+ error
13491
+ });
13492
+ }
13514
13493
  }
13515
- return this.createAndPersistApiKey(user, slug2, game, keyName);
13494
+ return this.createApiKey(user, slug2, keyName);
13516
13495
  }
13517
- async resolveApiKeyForDeployment(user, slug2, game, headers) {
13496
+ async ensureApiKeyOnWorker(user, slug2, deploymentId, headers) {
13497
+ const cf = this.getCloudflare();
13518
13498
  const keyName = getGameWorkerApiKeyName(slug2);
13519
13499
  const existingKeys = await this.ctx.providers.auth.listApiKeys(headers);
13520
13500
  const existingKey = existingKeys.find((k) => k.name === keyName);
13501
+ let apiKey;
13521
13502
  if (!existingKey) {
13522
- return this.createAndPersistApiKey(user, slug2, game, keyName);
13523
- }
13524
- const apiKey = await this.retrieveApiKeyFromSecrets(game.id);
13525
- if (apiKey) {
13526
- return apiKey;
13503
+ apiKey = await this.createApiKey(user, slug2, keyName);
13504
+ } else {
13505
+ try {
13506
+ const workerSecrets = await cf.listSecrets(deploymentId);
13507
+ if (workerSecrets.includes("PLAYCADEMY_API_KEY")) {
13508
+ logger8.debug("API key already on worker", { slug: slug2, deploymentId });
13509
+ return;
13510
+ }
13511
+ } catch (error) {
13512
+ logger8.warn("Could not check worker secrets, will regenerate key", { error });
13513
+ }
13514
+ apiKey = await this.regenerateApiKey(user, slug2, existingKey.id, keyName);
13527
13515
  }
13528
- return this.regenerateAndPersistApiKey(user, slug2, game, existingKey.id, keyName);
13516
+ await cf.setSecrets(deploymentId, { PLAYCADEMY_API_KEY: apiKey });
13517
+ logger8.info("Set API key on worker", { slug: slug2, deploymentId });
13529
13518
  }
13530
13519
  async* deploy(slug2, request, user, uploadDeps, extractZip) {
13531
13520
  const cf = this.getCloudflare();
@@ -13573,9 +13562,7 @@ class DeployService {
13573
13562
  }
13574
13563
  const env = {
13575
13564
  GAME_ID: game.id,
13576
- PLAYCADEMY_BASE_URL: playcademyBaseUrl,
13577
- ...request._gameApiKey && { PLAYCADEMY_API_KEY: request._gameApiKey },
13578
- ...request.secrets && { secrets: request.secrets }
13565
+ PLAYCADEMY_BASE_URL: playcademyBaseUrl
13579
13566
  };
13580
13567
  const deployMsg = hasBackend ? "Deploying backend code" : "Deploying to platform";
13581
13568
  yield { type: "status", data: { message: deployMsg } };
@@ -13598,6 +13585,10 @@ class DeployService {
13598
13585
  }
13599
13586
  const codeHash = hasBackend ? await generateDeploymentHash(request.code) : null;
13600
13587
  await this.saveDeployment(game.id, result.deploymentId, result.url, codeHash, result.resources);
13588
+ if (hasBackend && request._headers) {
13589
+ yield { type: "status", data: { message: "Configuring worker secrets" } };
13590
+ await this.ensureApiKeyOnWorker(user, slug2, result.deploymentId, request._headers);
13591
+ }
13601
13592
  yield { type: "status", data: { message: "Finalizing deployment" } };
13602
13593
  if (hasMetadata || hasFrontend) {
13603
13594
  const updates = { updatedAt: new Date };
@@ -14081,12 +14072,6 @@ class GameService {
14081
14072
  } catch (keyError) {
14082
14073
  logger11.warn("Failed to cleanup API key", { gameId, error: keyError });
14083
14074
  }
14084
- try {
14085
- await this.ctx.providers.secrets.deleteSecrets(gameId);
14086
- logger11.info("Cleaned up secrets for deleted game", { gameId });
14087
- } catch (secretsError) {
14088
- logger11.warn("Failed to cleanup secrets", { gameId, error: secretsError });
14089
- }
14090
14075
  }
14091
14076
  return {
14092
14077
  slug: gameToDelete.slug,
@@ -15036,1090 +15021,12 @@ var init_logs_service = __esm(() => {
15036
15021
  logger16 = log.scope("LogsService");
15037
15022
  });
15038
15023
 
15039
- // ../../node_modules/aws-jwt-verify/dist/esm/error.js
15040
- var JwtBaseError, FailedAssertionError, JwtParseError, ParameterValidationError, JwtInvalidSignatureError, JwtInvalidSignatureAlgorithmError, JwtInvalidClaimError, JwtInvalidIssuerError, JwtInvalidAudienceError, JwtInvalidScopeError, JwtExpiredError, JwtNotBeforeError, CognitoJwtInvalidGroupError, CognitoJwtInvalidTokenUseError, CognitoJwtInvalidClientIdError, JwksValidationError, JwkValidationError, JwtWithoutValidKidError, KidNotFoundInJwksError, WaitPeriodNotYetEndedJwkError, JwksNotAvailableInCacheError, JwkInvalidUseError, JwkInvalidKtyError, FetchError, NonRetryableFetchError;
15041
- var init_error = __esm(() => {
15042
- JwtBaseError = class JwtBaseError extends Error {
15043
- };
15044
- FailedAssertionError = class FailedAssertionError extends JwtBaseError {
15045
- constructor(msg, actual, expected) {
15046
- super(msg);
15047
- this.failedAssertion = {
15048
- actual,
15049
- expected
15050
- };
15051
- }
15052
- };
15053
- JwtParseError = class JwtParseError extends JwtBaseError {
15054
- constructor(msg, error) {
15055
- const message = error != null ? `${msg}: ${error}` : msg;
15056
- super(message);
15057
- }
15058
- };
15059
- ParameterValidationError = class ParameterValidationError extends JwtBaseError {
15060
- };
15061
- JwtInvalidSignatureError = class JwtInvalidSignatureError extends JwtBaseError {
15062
- };
15063
- JwtInvalidSignatureAlgorithmError = class JwtInvalidSignatureAlgorithmError extends FailedAssertionError {
15064
- };
15065
- JwtInvalidClaimError = class JwtInvalidClaimError extends FailedAssertionError {
15066
- withRawJwt({ header, payload }) {
15067
- this.rawJwt = {
15068
- header,
15069
- payload
15070
- };
15071
- return this;
15072
- }
15073
- };
15074
- JwtInvalidIssuerError = class JwtInvalidIssuerError extends JwtInvalidClaimError {
15075
- };
15076
- JwtInvalidAudienceError = class JwtInvalidAudienceError extends JwtInvalidClaimError {
15077
- };
15078
- JwtInvalidScopeError = class JwtInvalidScopeError extends JwtInvalidClaimError {
15079
- };
15080
- JwtExpiredError = class JwtExpiredError extends JwtInvalidClaimError {
15081
- };
15082
- JwtNotBeforeError = class JwtNotBeforeError extends JwtInvalidClaimError {
15083
- };
15084
- CognitoJwtInvalidGroupError = class CognitoJwtInvalidGroupError extends JwtInvalidClaimError {
15085
- };
15086
- CognitoJwtInvalidTokenUseError = class CognitoJwtInvalidTokenUseError extends JwtInvalidClaimError {
15087
- };
15088
- CognitoJwtInvalidClientIdError = class CognitoJwtInvalidClientIdError extends JwtInvalidClaimError {
15089
- };
15090
- JwksValidationError = class JwksValidationError extends JwtBaseError {
15091
- };
15092
- JwkValidationError = class JwkValidationError extends JwtBaseError {
15093
- };
15094
- JwtWithoutValidKidError = class JwtWithoutValidKidError extends JwtBaseError {
15095
- };
15096
- KidNotFoundInJwksError = class KidNotFoundInJwksError extends JwtBaseError {
15097
- };
15098
- WaitPeriodNotYetEndedJwkError = class WaitPeriodNotYetEndedJwkError extends JwtBaseError {
15099
- };
15100
- JwksNotAvailableInCacheError = class JwksNotAvailableInCacheError extends JwtBaseError {
15101
- };
15102
- JwkInvalidUseError = class JwkInvalidUseError extends FailedAssertionError {
15103
- };
15104
- JwkInvalidKtyError = class JwkInvalidKtyError extends FailedAssertionError {
15105
- };
15106
- FetchError = class FetchError extends JwtBaseError {
15107
- constructor(uri, msg) {
15108
- super(`Failed to fetch ${uri}: ${msg}`);
15109
- }
15110
- };
15111
- NonRetryableFetchError = class NonRetryableFetchError extends FetchError {
15112
- };
15113
- });
15114
-
15115
- // ../../node_modules/aws-jwt-verify/dist/esm/https-node.js
15116
- import { request } from "https";
15117
- import { pipeline } from "stream";
15118
- async function fetch2(uri, requestOptions, data) {
15119
- let responseTimeout;
15120
- return new Promise((resolve, reject) => {
15121
- const req = request(uri, {
15122
- method: "GET",
15123
- ...requestOptions
15124
- }, (response) => {
15125
- if (response.statusCode !== 200) {
15126
- done(new NonRetryableFetchError(uri, `Status code is ${response.statusCode}, expected 200`));
15127
- return;
15128
- }
15129
- pipeline(response, async (responseBody) => {
15130
- const chunks = [];
15131
- for await (const chunk of responseBody) {
15132
- chunks.push(chunk);
15133
- }
15134
- return Buffer.concat(chunks);
15135
- }, done);
15136
- });
15137
- if (requestOptions?.responseTimeout) {
15138
- responseTimeout = setTimeout(() => done(new FetchError(uri, `Response time-out (after ${requestOptions.responseTimeout} ms.)`)), requestOptions.responseTimeout);
15139
- responseTimeout.unref();
15140
- }
15141
- function done(err2, data2) {
15142
- if (responseTimeout)
15143
- clearTimeout(responseTimeout);
15144
- if (err2 == null) {
15145
- resolve(data2);
15146
- return;
15147
- }
15148
- req.socket?.emit("agentRemove");
15149
- if (!(err2 instanceof FetchError)) {
15150
- err2 = new FetchError(uri, err2.message);
15151
- }
15152
- req.destroy();
15153
- reject(err2);
15154
- }
15155
- req.on("error", done);
15156
- req.end(data);
15157
- });
15158
- }
15159
- var init_https_node = __esm(() => {
15160
- init_error();
15161
- });
15162
-
15163
- // ../../node_modules/aws-jwt-verify/dist/esm/node-web-compat-node.js
15164
- import { createPublicKey, createVerify, verify } from "crypto";
15165
- var JwtSignatureAlgorithmHashNames, nodeWebCompat;
15166
- var init_node_web_compat_node = __esm(() => {
15167
- init_https_node();
15168
- (function(JwtSignatureAlgorithmHashNames2) {
15169
- JwtSignatureAlgorithmHashNames2["RS256"] = "RSA-SHA256";
15170
- JwtSignatureAlgorithmHashNames2["RS384"] = "RSA-SHA384";
15171
- JwtSignatureAlgorithmHashNames2["RS512"] = "RSA-SHA512";
15172
- JwtSignatureAlgorithmHashNames2["ES256"] = "RSA-SHA256";
15173
- JwtSignatureAlgorithmHashNames2["ES384"] = "RSA-SHA384";
15174
- JwtSignatureAlgorithmHashNames2["ES512"] = "RSA-SHA512";
15175
- })(JwtSignatureAlgorithmHashNames || (JwtSignatureAlgorithmHashNames = {}));
15176
- nodeWebCompat = {
15177
- fetch: fetch2,
15178
- transformJwkToKeyObjectSync: (jwk) => createPublicKey({
15179
- key: jwk,
15180
- format: "jwk"
15181
- }),
15182
- transformJwkToKeyObjectAsync: async (jwk) => createPublicKey({
15183
- key: jwk,
15184
- format: "jwk"
15185
- }),
15186
- parseB64UrlString: (b64) => Buffer.from(b64, "base64").toString("utf8"),
15187
- verifySignatureSync: ({ alg, keyObject, jwsSigningInput, signature }) => alg !== "EdDSA" ? createVerify(JwtSignatureAlgorithmHashNames[alg]).update(jwsSigningInput).verify({
15188
- key: keyObject,
15189
- dsaEncoding: "ieee-p1363"
15190
- }, signature, "base64") : verify(null, Buffer.from(jwsSigningInput), keyObject, Buffer.from(signature, "base64")),
15191
- verifySignatureAsync: async (args2) => nodeWebCompat.verifySignatureSync(args2),
15192
- defaultFetchTimeouts: {
15193
- socketIdle: 1500,
15194
- response: 3000
15195
- },
15196
- setTimeoutUnref: (...args2) => setTimeout(...args2).unref(),
15197
- transformPemToJwk: async (pem) => {
15198
- return createPublicKey({
15199
- key: Buffer.from(pem),
15200
- format: "pem"
15201
- }).export({
15202
- format: "jwk"
15203
- });
15204
- }
15205
- };
15206
- });
15207
-
15208
- // ../../node_modules/aws-jwt-verify/dist/esm/https.js
15209
- class SimpleFetcher {
15210
- constructor(props) {
15211
- this.defaultRequestOptions = {
15212
- timeout: nodeWebCompat.defaultFetchTimeouts.socketIdle,
15213
- responseTimeout: nodeWebCompat.defaultFetchTimeouts.response,
15214
- ...props?.defaultRequestOptions
15215
- };
15216
- }
15217
- async fetch(uri, requestOptions, data) {
15218
- requestOptions = { ...this.defaultRequestOptions, ...requestOptions };
15219
- try {
15220
- return await fetch3(uri, requestOptions, data);
15221
- } catch (err2) {
15222
- if (err2 instanceof NonRetryableFetchError) {
15223
- throw err2;
15224
- }
15225
- return fetch3(uri, requestOptions, data);
15226
- }
15227
- }
15228
- }
15229
- var fetch3;
15230
- var init_https = __esm(() => {
15231
- init_error();
15232
- init_node_web_compat_node();
15233
- fetch3 = nodeWebCompat.fetch.bind(undefined);
15234
- });
15235
-
15236
- // ../../node_modules/aws-jwt-verify/dist/esm/safe-json-parse.js
15237
- function isJsonObject(j) {
15238
- return typeof j === "object" && !Array.isArray(j) && j !== null;
15239
- }
15240
- function safeJsonParse(s) {
15241
- return JSON.parse(s, (_, value) => {
15242
- if (typeof value === "object" && !Array.isArray(value) && value !== null) {
15243
- delete value.__proto__;
15244
- delete value.constructor;
15245
- }
15246
- return value;
15247
- });
15248
- }
15249
-
15250
- // ../../node_modules/aws-jwt-verify/dist/esm/assert.js
15251
- function assertStringEquals(name3, actual, expected, errorConstructor = FailedAssertionError) {
15252
- if (!actual) {
15253
- throw new errorConstructor(`Missing ${name3}. Expected: ${expected}`, actual, expected);
15254
- }
15255
- if (typeof actual !== "string") {
15256
- throw new errorConstructor(`${name3} is not of type string`, actual, expected);
15257
- }
15258
- if (expected !== actual) {
15259
- throw new errorConstructor(`${name3} not allowed: ${actual}. Expected: ${expected}`, actual, expected);
15260
- }
15261
- }
15262
- function assertStringArrayContainsString(name3, actual, expected, errorConstructor = FailedAssertionError) {
15263
- if (!actual) {
15264
- throw new errorConstructor(`Missing ${name3}. ${expectationMessage(expected)}`, actual, expected);
15265
- }
15266
- if (typeof actual !== "string") {
15267
- throw new errorConstructor(`${name3} is not of type string`, actual, expected);
15268
- }
15269
- return assertStringArraysOverlap(name3, actual, expected, errorConstructor);
15270
- }
15271
- function assertStringArraysOverlap(name3, actual, expected, errorConstructor = FailedAssertionError) {
15272
- if (!actual) {
15273
- throw new errorConstructor(`Missing ${name3}. ${expectationMessage(expected)}`, actual, expected);
15274
- }
15275
- const expectedAsSet = new Set(Array.isArray(expected) ? expected : [expected]);
15276
- if (typeof actual === "string") {
15277
- actual = [actual];
15278
- }
15279
- if (!Array.isArray(actual)) {
15280
- throw new errorConstructor(`${name3} is not an array`, actual, expected);
15281
- }
15282
- const overlaps = actual.some((actualItem) => {
15283
- if (typeof actualItem !== "string") {
15284
- throw new errorConstructor(`${name3} includes elements that are not of type string`, actual, expected);
15285
- }
15286
- return expectedAsSet.has(actualItem);
15287
- });
15288
- if (!overlaps) {
15289
- throw new errorConstructor(`${name3} not allowed: ${actual.join(", ")}. ${expectationMessage(expected)}`, actual, expected);
15290
- }
15291
- }
15292
- function expectationMessage(expected) {
15293
- if (Array.isArray(expected)) {
15294
- if (expected.length > 1) {
15295
- return `Expected one of: ${expected.join(", ")}`;
15296
- }
15297
- return `Expected: ${expected[0]}`;
15298
- }
15299
- return `Expected: ${expected}`;
15300
- }
15301
- function assertIsNotPromise(actual, errorFactory) {
15302
- if (actual && typeof actual.then === "function") {
15303
- throw errorFactory();
15304
- }
15305
- }
15306
- var init_assert = __esm(() => {
15307
- init_error();
15308
- });
15309
-
15310
- // ../../node_modules/aws-jwt-verify/dist/esm/jwk.js
15311
- function findJwkInJwks(jwks, kid) {
15312
- return jwks.keys.find((jwk) => jwk.kid != null && jwk.kid === kid);
15313
- }
15314
- function assertIsJwks(jwks) {
15315
- if (!jwks) {
15316
- throw new JwksValidationError("JWKS empty");
15317
- }
15318
- if (!isJsonObject(jwks)) {
15319
- throw new JwksValidationError("JWKS should be an object");
15320
- }
15321
- if (!Object.keys(jwks).includes("keys")) {
15322
- throw new JwksValidationError("JWKS does not include keys");
15323
- }
15324
- if (!Array.isArray(jwks.keys)) {
15325
- throw new JwksValidationError("JWKS keys should be an array");
15326
- }
15327
- for (const jwk of jwks.keys) {
15328
- assertIsJwk(jwk);
15329
- }
15330
- }
15331
- function assertIsSignatureJwk(jwk) {
15332
- assertStringArrayContainsString("JWK kty", jwk.kty, ["EC", "RSA", "OKP"], JwkInvalidKtyError);
15333
- if (jwk.kty === "EC") {
15334
- assertIsEsSignatureJwk(jwk);
15335
- } else if (jwk.kty === "RSA") {
15336
- assertIsRsaSignatureJwk(jwk);
15337
- } else if (jwk.kty === "OKP") {
15338
- assertIsEdDSASignatureJwk(jwk);
15339
- }
15340
- }
15341
- function assertIsEdDSASignatureJwk(jwk) {
15342
- if (jwk.use) {
15343
- assertStringEquals("JWK use", jwk.use, "sig", JwkInvalidUseError);
15344
- }
15345
- assertStringEquals("JWK kty", jwk.kty, "OKP", JwkInvalidKtyError);
15346
- if (!jwk.crv)
15347
- throw new JwkValidationError("Missing Curve (crv)");
15348
- if (!jwk.x)
15349
- throw new JwkValidationError("Missing X Coordinate (x)");
15350
- }
15351
- function assertIsEsSignatureJwk(jwk) {
15352
- if (jwk.use) {
15353
- assertStringEquals("JWK use", jwk.use, "sig", JwkInvalidUseError);
15354
- }
15355
- assertStringEquals("JWK kty", jwk.kty, "EC", JwkInvalidKtyError);
15356
- if (!jwk.crv)
15357
- throw new JwkValidationError("Missing Curve (crv)");
15358
- if (!jwk.x)
15359
- throw new JwkValidationError("Missing X Coordinate (x)");
15360
- if (!jwk.y)
15361
- throw new JwkValidationError("Missing Y Coordinate (y)");
15362
- }
15363
- function assertIsRsaSignatureJwk(jwk) {
15364
- if (jwk.use) {
15365
- assertStringEquals("JWK use", jwk.use, "sig", JwkInvalidUseError);
15366
- }
15367
- assertStringEquals("JWK kty", jwk.kty, "RSA", JwkInvalidKtyError);
15368
- if (!jwk.n)
15369
- throw new JwkValidationError("Missing modulus (n)");
15370
- if (!jwk.e)
15371
- throw new JwkValidationError("Missing exponent (e)");
15372
- }
15373
- function assertIsJwk(jwk) {
15374
- if (!jwk) {
15375
- throw new JwkValidationError("JWK empty");
15376
- }
15377
- if (!isJsonObject(jwk)) {
15378
- throw new JwkValidationError("JWK should be an object");
15379
- }
15380
- for (const field of mandatoryJwkFieldNames) {
15381
- if (typeof jwk[field] !== "string") {
15382
- throw new JwkValidationError(`JWK ${field} should be a string`);
15383
- }
15384
- }
15385
- for (const field of optionalJwkFieldNames) {
15386
- if (field in jwk && typeof jwk[field] !== "string") {
15387
- throw new JwkValidationError(`JWK ${field} should be a string`);
15388
- }
15389
- }
15390
- }
15391
- function isJwks(jwks) {
15392
- try {
15393
- assertIsJwks(jwks);
15394
- return true;
15395
- } catch {
15396
- return false;
15397
- }
15398
- }
15399
- function isJwk(jwk) {
15400
- try {
15401
- assertIsJwk(jwk);
15402
- return true;
15403
- } catch {
15404
- return false;
15405
- }
15406
- }
15407
-
15408
- class SimplePenaltyBox {
15409
- constructor(props) {
15410
- this.waitingUris = new Map;
15411
- this.waitSeconds = props?.waitSeconds ?? 10;
15412
- }
15413
- async wait(jwksUri) {
15414
- if (this.waitingUris.has(jwksUri)) {
15415
- throw new WaitPeriodNotYetEndedJwkError("Not allowed to fetch JWKS yet, still waiting for back off period to end");
15416
- }
15417
- }
15418
- release(jwksUri) {
15419
- const i2 = this.waitingUris.get(jwksUri);
15420
- if (i2) {
15421
- clearTimeout(i2);
15422
- this.waitingUris.delete(jwksUri);
15423
- }
15424
- }
15425
- registerFailedAttempt(jwksUri) {
15426
- const i2 = nodeWebCompat.setTimeoutUnref(() => {
15427
- this.waitingUris.delete(jwksUri);
15428
- }, this.waitSeconds * 1000);
15429
- this.waitingUris.set(jwksUri, i2);
15430
- }
15431
- registerSuccessfulAttempt(jwksUri) {
15432
- this.release(jwksUri);
15433
- }
15434
- }
15435
-
15436
- class SimpleJwksCache {
15437
- constructor(props) {
15438
- this.jwksCache = new Map;
15439
- this.fetchingJwks = new Map;
15440
- this.penaltyBox = props?.penaltyBox ?? new SimplePenaltyBox;
15441
- this.fetcher = props?.fetcher ?? new SimpleFetcher;
15442
- this.jwksParser = props?.jwksParser ?? parseJwks;
15443
- }
15444
- addJwks(jwksUri, jwks) {
15445
- this.jwksCache.set(jwksUri, jwks);
15446
- }
15447
- async getJwks(jwksUri) {
15448
- const existingFetch = this.fetchingJwks.get(jwksUri);
15449
- if (existingFetch) {
15450
- return existingFetch;
15451
- }
15452
- const jwksPromise = this.fetcher.fetch(jwksUri).then(this.jwksParser);
15453
- this.fetchingJwks.set(jwksUri, jwksPromise);
15454
- let jwks;
15455
- try {
15456
- jwks = await jwksPromise;
15457
- } finally {
15458
- this.fetchingJwks.delete(jwksUri);
15459
- }
15460
- this.jwksCache.set(jwksUri, jwks);
15461
- return jwks;
15462
- }
15463
- getCachedJwk(jwksUri, decomposedJwt) {
15464
- if (typeof decomposedJwt.header.kid !== "string") {
15465
- throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");
15466
- }
15467
- if (!this.jwksCache.has(jwksUri)) {
15468
- throw new JwksNotAvailableInCacheError(`JWKS for uri ${jwksUri} not yet available in cache`);
15469
- }
15470
- const jwk = findJwkInJwks(this.jwksCache.get(jwksUri), decomposedJwt.header.kid);
15471
- if (!jwk) {
15472
- throw new KidNotFoundInJwksError(`JWK for kid ${decomposedJwt.header.kid} not found in the JWKS`);
15473
- }
15474
- return jwk;
15475
- }
15476
- async getJwk(jwksUri, decomposedJwt) {
15477
- if (typeof decomposedJwt.header.kid !== "string") {
15478
- throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");
15479
- }
15480
- const cachedJwks = this.jwksCache.get(jwksUri);
15481
- if (cachedJwks) {
15482
- const cachedJwk = findJwkInJwks(cachedJwks, decomposedJwt.header.kid);
15483
- if (cachedJwk) {
15484
- return cachedJwk;
15485
- }
15486
- }
15487
- await this.penaltyBox.wait(jwksUri, decomposedJwt.header.kid);
15488
- const jwks = await this.getJwks(jwksUri);
15489
- const jwk = findJwkInJwks(jwks, decomposedJwt.header.kid);
15490
- if (!jwk) {
15491
- this.penaltyBox.registerFailedAttempt(jwksUri, decomposedJwt.header.kid);
15492
- throw new KidNotFoundInJwksError(`JWK for kid "${decomposedJwt.header.kid}" not found in the JWKS`);
15493
- } else {
15494
- this.penaltyBox.registerSuccessfulAttempt(jwksUri, decomposedJwt.header.kid);
15495
- }
15496
- return jwk;
15497
- }
15498
- }
15499
- var optionalJwkFieldNames, mandatoryJwkFieldNames, parseJwks = function(jwksBin) {
15500
- let jwks;
15501
- try {
15502
- const jwksText = new TextDecoder("utf8", {
15503
- fatal: true,
15504
- ignoreBOM: true
15505
- }).decode(jwksBin);
15506
- jwks = safeJsonParse(jwksText);
15507
- } catch (err2) {
15508
- throw new JwksValidationError(`JWKS could not be parsed as JSON: ${err2}`);
15509
- }
15510
- assertIsJwks(jwks);
15511
- return jwks;
15512
- };
15513
- var init_jwk = __esm(() => {
15514
- init_https();
15515
- init_error();
15516
- init_node_web_compat_node();
15517
- init_assert();
15518
- optionalJwkFieldNames = [
15519
- "use",
15520
- "alg",
15521
- "kid",
15522
- "n",
15523
- "e",
15524
- "x",
15525
- "y",
15526
- "crv"
15527
- ];
15528
- mandatoryJwkFieldNames = [
15529
- "kty"
15530
- ];
15531
- });
15532
-
15533
- // ../../node_modules/aws-jwt-verify/dist/esm/jwt.js
15534
- function assertJwtHeader(header) {
15535
- if (!isJsonObject(header)) {
15536
- throw new JwtParseError("JWT header is not an object");
15537
- }
15538
- if (header.alg !== undefined && typeof header.alg !== "string") {
15539
- throw new JwtParseError("JWT header alg claim is not a string");
15540
- }
15541
- if (header.kid !== undefined && typeof header.kid !== "string") {
15542
- throw new JwtParseError("JWT header kid claim is not a string");
15543
- }
15544
- }
15545
- function assertJwtPayload(payload) {
15546
- if (!isJsonObject(payload)) {
15547
- throw new JwtParseError("JWT payload is not an object");
15548
- }
15549
- if (payload.exp !== undefined && !Number.isFinite(payload.exp)) {
15550
- throw new JwtParseError("JWT payload exp claim is not a number");
15551
- }
15552
- if (payload.iss !== undefined && typeof payload.iss !== "string") {
15553
- throw new JwtParseError("JWT payload iss claim is not a string");
15554
- }
15555
- if (payload.sub !== undefined && typeof payload.sub !== "string") {
15556
- throw new JwtParseError("JWT payload sub claim is not a string");
15557
- }
15558
- if (payload.aud !== undefined && typeof payload.aud !== "string" && (!Array.isArray(payload.aud) || payload.aud.some((aud) => typeof aud !== "string"))) {
15559
- throw new JwtParseError("JWT payload aud claim is not a string or array of strings");
15560
- }
15561
- if (payload.nbf !== undefined && !Number.isFinite(payload.nbf)) {
15562
- throw new JwtParseError("JWT payload nbf claim is not a number");
15563
- }
15564
- if (payload.iat !== undefined && !Number.isFinite(payload.iat)) {
15565
- throw new JwtParseError("JWT payload iat claim is not a number");
15566
- }
15567
- if (payload.scope !== undefined && typeof payload.scope !== "string") {
15568
- throw new JwtParseError("JWT payload scope claim is not a string");
15569
- }
15570
- if (payload.jti !== undefined && typeof payload.jti !== "string") {
15571
- throw new JwtParseError("JWT payload jti claim is not a string");
15572
- }
15573
- }
15574
- function decomposeUnverifiedJwt(jwt) {
15575
- if (!jwt) {
15576
- throw new JwtParseError("Empty JWT");
15577
- }
15578
- if (typeof jwt !== "string") {
15579
- throw new JwtParseError("JWT is not a string");
15580
- }
15581
- if (!JWT_REGEX.test(jwt)) {
15582
- throw new JwtParseError("JWT string does not consist of exactly 3 parts (header, payload, signature)");
15583
- }
15584
- const [headerB64, payloadB64, signatureB64] = jwt.split(".");
15585
- const [headerString, payloadString] = [headerB64, payloadB64].map(nodeWebCompat.parseB64UrlString);
15586
- let header;
15587
- try {
15588
- header = safeJsonParse(headerString);
15589
- } catch (err2) {
15590
- throw new JwtParseError("Invalid JWT. Header is not a valid JSON object", err2);
15591
- }
15592
- assertJwtHeader(header);
15593
- let payload;
15594
- try {
15595
- payload = safeJsonParse(payloadString);
15596
- } catch (err2) {
15597
- throw new JwtParseError("Invalid JWT. Payload is not a valid JSON object", err2);
15598
- }
15599
- assertJwtPayload(payload);
15600
- return {
15601
- header,
15602
- headerB64,
15603
- payload,
15604
- payloadB64,
15605
- signatureB64
15606
- };
15607
- }
15608
- function validateJwtFields(payload, options) {
15609
- if (payload.exp !== undefined) {
15610
- if (payload.exp + (options.graceSeconds ?? 0) < Date.now() / 1000) {
15611
- throw new JwtExpiredError(`Token expired at ${new Date(payload.exp * 1000).toISOString()}`, payload.exp);
15612
- }
15613
- }
15614
- if (payload.nbf !== undefined) {
15615
- if (payload.nbf - (options.graceSeconds ?? 0) > Date.now() / 1000) {
15616
- throw new JwtNotBeforeError(`Token can't be used before ${new Date(payload.nbf * 1000).toISOString()}`, payload.nbf);
15617
- }
15618
- }
15619
- if (options.issuer !== null) {
15620
- if (options.issuer === undefined) {
15621
- throw new ParameterValidationError("issuer must be provided or set to null explicitly");
15622
- }
15623
- assertStringArrayContainsString("Issuer", payload.iss, options.issuer, JwtInvalidIssuerError);
15624
- }
15625
- if (options.audience !== null) {
15626
- if (options.audience === undefined) {
15627
- throw new ParameterValidationError("audience must be provided or set to null explicitly");
15628
- }
15629
- assertStringArraysOverlap("Audience", payload.aud, options.audience, JwtInvalidAudienceError);
15630
- }
15631
- if (options.scope != null) {
15632
- assertStringArraysOverlap("Scope", payload.scope?.split(" "), options.scope, JwtInvalidScopeError);
15633
- }
15634
- }
15635
- var JWT_REGEX;
15636
- var init_jwt = __esm(() => {
15637
- init_assert();
15638
- init_error();
15639
- init_node_web_compat_node();
15640
- JWT_REGEX = /^[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}$/;
15641
- });
15642
-
15643
- // ../../node_modules/aws-jwt-verify/dist/esm/jwt-verifier.js
15644
- function validateJwtHeaderAndJwk(header, jwk) {
15645
- assertIsSignatureJwk(jwk);
15646
- if (jwk.alg) {
15647
- assertStringEquals("JWT signature algorithm", header.alg, jwk.alg, JwtInvalidSignatureAlgorithmError);
15648
- }
15649
- assertStringArrayContainsString("JWT signature algorithm", header.alg, supportedSignatureAlgorithms, JwtInvalidSignatureAlgorithmError);
15650
- }
15651
- async function verifyDecomposedJwt(decomposedJwt, jwksUri, options, jwkFetcher, transformJwkToKeyObjectFn) {
15652
- const { header, headerB64, payload, payloadB64, signatureB64 } = decomposedJwt;
15653
- const jwk = await jwkFetcher(jwksUri, decomposedJwt);
15654
- validateJwtHeaderAndJwk(decomposedJwt.header, jwk);
15655
- const keyObject = await transformJwkToKeyObjectFn(jwk, header.alg, payload.iss);
15656
- const valid = await nodeWebCompat.verifySignatureAsync({
15657
- jwsSigningInput: `${headerB64}.${payloadB64}`,
15658
- signature: signatureB64,
15659
- alg: header.alg,
15660
- keyObject
15661
- });
15662
- if (!valid) {
15663
- throw new JwtInvalidSignatureError("Invalid signature");
15664
- }
15665
- try {
15666
- validateJwtFields(payload, options);
15667
- if (options.customJwtCheck) {
15668
- await options.customJwtCheck({ header, payload, jwk });
15669
- }
15670
- } catch (err2) {
15671
- if (options.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
15672
- throw err2.withRawJwt(decomposedJwt);
15673
- }
15674
- throw err2;
15675
- }
15676
- return payload;
15677
- }
15678
- function verifyDecomposedJwtSync(decomposedJwt, jwkOrJwks, options, transformJwkToKeyObjectFn) {
15679
- const { header, headerB64, payload, payloadB64, signatureB64 } = decomposedJwt;
15680
- let jwk;
15681
- if (isJwk(jwkOrJwks)) {
15682
- jwk = jwkOrJwks;
15683
- } else if (isJwks(jwkOrJwks)) {
15684
- const locatedJwk = header.kid ? findJwkInJwks(jwkOrJwks, header.kid) : undefined;
15685
- if (!locatedJwk) {
15686
- throw new KidNotFoundInJwksError(`JWK for kid ${header.kid} not found in the JWKS`);
15687
- }
15688
- jwk = locatedJwk;
15689
- } else {
15690
- throw new ParameterValidationError([
15691
- `Expected a valid JWK or JWKS (parsed as JavaScript object), but received: ${jwkOrJwks}.`,
15692
- "If you're passing a JWKS URI, use the async verify() method instead, it will download and parse the JWKS for you"
15693
- ].join());
15694
- }
15695
- validateJwtHeaderAndJwk(decomposedJwt.header, jwk);
15696
- const keyObject = transformJwkToKeyObjectFn(jwk, header.alg, payload.iss);
15697
- const valid = nodeWebCompat.verifySignatureSync({
15698
- jwsSigningInput: `${headerB64}.${payloadB64}`,
15699
- signature: signatureB64,
15700
- alg: header.alg,
15701
- keyObject
15702
- });
15703
- if (!valid) {
15704
- throw new JwtInvalidSignatureError("Invalid signature");
15705
- }
15706
- try {
15707
- validateJwtFields(payload, options);
15708
- if (options.customJwtCheck) {
15709
- const res = options.customJwtCheck({ header, payload, jwk });
15710
- assertIsNotPromise(res, () => new ParameterValidationError("Custom JWT checks must be synchronous but a promise was returned"));
15711
- }
15712
- } catch (err2) {
15713
- if (options.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
15714
- throw err2.withRawJwt(decomposedJwt);
15715
- }
15716
- throw err2;
15717
- }
15718
- return payload;
15719
- }
15720
-
15721
- class JwtVerifierBase {
15722
- constructor(verifyProperties, jwksCache = new SimpleJwksCache) {
15723
- this.jwksCache = jwksCache;
15724
- this.issuersConfig = new Map;
15725
- this.publicKeyCache = new KeyObjectCache;
15726
- if (Array.isArray(verifyProperties)) {
15727
- if (!verifyProperties.length) {
15728
- throw new ParameterValidationError("Provide at least one issuer configuration");
15729
- }
15730
- verifyProperties.forEach((prop, index2) => {
15731
- if (this.issuersConfig.has(prop.issuer)) {
15732
- throw new ParameterValidationError(`issuer ${prop.issuer} supplied multiple times`);
15733
- } else if (prop.issuer === null && verifyProperties.length >= 2) {
15734
- throw new ParameterValidationError(`issuer cannot be null when multiple issuers are supplied (at issuer: ${index2})`);
15735
- }
15736
- this.issuersConfig.set(prop.issuer, this.withJwksUri(prop));
15737
- });
15738
- } else {
15739
- this.issuersConfig.set(verifyProperties.issuer, this.withJwksUri(verifyProperties));
15740
- }
15741
- }
15742
- getIssuerConfig(issuer) {
15743
- if (this.issuersConfig.size === 1) {
15744
- issuer = this.issuersConfig.keys().next().value;
15745
- }
15746
- if (issuer === undefined) {
15747
- throw new ParameterValidationError("issuer must be provided");
15748
- }
15749
- const config2 = this.issuersConfig.get(issuer);
15750
- if (!config2) {
15751
- throw new ParameterValidationError(`issuer not configured: ${issuer}`);
15752
- }
15753
- return config2;
15754
- }
15755
- cacheJwks(...[jwks, issuer]) {
15756
- const issuerConfig = this.getIssuerConfig(issuer);
15757
- this.jwksCache.addJwks(issuerConfig.jwksUri, jwks);
15758
- this.publicKeyCache.clearCache(issuerConfig.issuer);
15759
- }
15760
- async hydrate() {
15761
- const jwksFetches = Array.from(this.issuersConfig.values()).map(({ jwksUri }) => this.jwksCache.getJwks(jwksUri));
15762
- await Promise.all(jwksFetches);
15763
- }
15764
- verifySync(...[jwt, properties]) {
15765
- const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
15766
- return this.verifyDecomposedJwtSync(decomposedJwt, jwksUri, verifyProperties);
15767
- }
15768
- verifyDecomposedJwtSync(decomposedJwt, jwksUri, verifyProperties) {
15769
- const jwk = this.jwksCache.getCachedJwk(jwksUri, decomposedJwt);
15770
- return verifyDecomposedJwtSync(decomposedJwt, jwk, verifyProperties, this.publicKeyCache.transformJwkToKeyObjectSync.bind(this.publicKeyCache));
15771
- }
15772
- async verify(...[jwt, properties]) {
15773
- const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
15774
- return this.verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties);
15775
- }
15776
- verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties) {
15777
- return verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties, this.jwksCache.getJwk.bind(this.jwksCache), this.publicKeyCache.transformJwkToKeyObjectAsync.bind(this.publicKeyCache));
15778
- }
15779
- getVerifyParameters(jwt, verifyProperties) {
15780
- const decomposedJwt = decomposeUnverifiedJwt(jwt);
15781
- const issuerConfig = this.getIssuerConfig(decomposedJwt.payload.iss);
15782
- return {
15783
- decomposedJwt,
15784
- jwksUri: issuerConfig.jwksUri,
15785
- verifyProperties: {
15786
- ...issuerConfig,
15787
- ...verifyProperties
15788
- }
15789
- };
15790
- }
15791
- withJwksUri(config2) {
15792
- if (config2.jwksUri) {
15793
- return config2;
15794
- }
15795
- const issuer = config2.issuer;
15796
- if (!issuer) {
15797
- throw new ParameterValidationError("jwksUri must be provided for issuer null");
15798
- }
15799
- const issuerUri = new URL(issuer).pathname.replace(/\/$/, "");
15800
- return {
15801
- jwksUri: new URL(`${issuerUri}/.well-known/jwks.json`, issuer).href,
15802
- ...config2
15803
- };
15804
- }
15805
- }
15806
-
15807
- class KeyObjectCache {
15808
- constructor(transformJwkToKeyObjectSyncFn = nodeWebCompat.transformJwkToKeyObjectSync, transformJwkToKeyObjectAsyncFn = nodeWebCompat.transformJwkToKeyObjectAsync) {
15809
- this.transformJwkToKeyObjectSyncFn = transformJwkToKeyObjectSyncFn;
15810
- this.transformJwkToKeyObjectAsyncFn = transformJwkToKeyObjectAsyncFn;
15811
- this.publicKeys = new Map;
15812
- }
15813
- transformJwkToKeyObjectSync(jwk, jwtHeaderAlg, issuer) {
15814
- const alg = jwk.alg ?? jwtHeaderAlg;
15815
- if (!issuer || !jwk.kid || !alg) {
15816
- return this.transformJwkToKeyObjectSyncFn(jwk, alg, issuer);
15817
- }
15818
- const fromCache = this.publicKeys.get(issuer)?.get(jwk.kid)?.get(alg);
15819
- if (fromCache)
15820
- return fromCache;
15821
- const publicKey = this.transformJwkToKeyObjectSyncFn(jwk, alg, issuer);
15822
- this.putKeyObjectInCache(issuer, jwk.kid, alg, publicKey);
15823
- return publicKey;
15824
- }
15825
- async transformJwkToKeyObjectAsync(jwk, jwtHeaderAlg, issuer) {
15826
- const alg = jwk.alg ?? jwtHeaderAlg;
15827
- if (!issuer || !jwk.kid || !alg) {
15828
- return this.transformJwkToKeyObjectAsyncFn(jwk, alg, issuer);
15829
- }
15830
- const fromCache = this.publicKeys.get(issuer)?.get(jwk.kid)?.get(alg);
15831
- if (fromCache)
15832
- return fromCache;
15833
- const publicKey = await this.transformJwkToKeyObjectAsyncFn(jwk, alg, issuer);
15834
- this.putKeyObjectInCache(issuer, jwk.kid, alg, publicKey);
15835
- return publicKey;
15836
- }
15837
- putKeyObjectInCache(issuer, kid, alg, publicKey) {
15838
- const cachedIssuer = this.publicKeys.get(issuer);
15839
- const cachedIssuerKid = cachedIssuer?.get(kid);
15840
- if (cachedIssuerKid) {
15841
- cachedIssuerKid.set(alg, publicKey);
15842
- } else if (cachedIssuer) {
15843
- cachedIssuer.set(kid, new Map([[alg, publicKey]]));
15844
- } else {
15845
- this.publicKeys.set(issuer, new Map([[kid, new Map([[alg, publicKey]])]]));
15846
- }
15847
- }
15848
- clearCache(issuer) {
15849
- this.publicKeys.delete(issuer);
15850
- }
15851
- }
15852
- var supportedSignatureAlgorithms, JwtVerifier;
15853
- var init_jwt_verifier = __esm(() => {
15854
- init_jwk();
15855
- init_assert();
15856
- init_jwt();
15857
- init_error();
15858
- init_node_web_compat_node();
15859
- supportedSignatureAlgorithms = [
15860
- "RS256",
15861
- "RS384",
15862
- "RS512",
15863
- "ES256",
15864
- "ES384",
15865
- "ES512",
15866
- "EdDSA"
15867
- ];
15868
- JwtVerifier = class JwtVerifier extends JwtVerifierBase {
15869
- static create(verifyProperties, additionalProperties) {
15870
- return new this(verifyProperties, additionalProperties?.jwksCache);
15871
- }
15872
- };
15873
- });
15874
-
15875
- // ../../node_modules/aws-jwt-verify/dist/esm/cognito-verifier.js
15876
- function validateCognitoJwtFields(payload, options) {
15877
- if (options.groups != null) {
15878
- assertStringArraysOverlap("Cognito group", payload["cognito:groups"], options.groups, CognitoJwtInvalidGroupError);
15879
- }
15880
- assertStringArrayContainsString("Token use", payload.token_use, ["id", "access"], CognitoJwtInvalidTokenUseError);
15881
- if (options.tokenUse !== null) {
15882
- if (options.tokenUse === undefined) {
15883
- throw new ParameterValidationError("tokenUse must be provided or set to null explicitly");
15884
- }
15885
- assertStringEquals("Token use", payload.token_use, options.tokenUse, CognitoJwtInvalidTokenUseError);
15886
- }
15887
- if (options.clientId !== null) {
15888
- if (options.clientId === undefined) {
15889
- throw new ParameterValidationError("clientId must be provided or set to null explicitly");
15890
- }
15891
- if (payload.token_use === "id") {
15892
- assertStringArrayContainsString('Client ID ("audience")', payload.aud, options.clientId, CognitoJwtInvalidClientIdError);
15893
- } else {
15894
- assertStringArrayContainsString("Client ID", payload.client_id, options.clientId, CognitoJwtInvalidClientIdError);
15895
- }
15896
- }
15897
- }
15898
- var CognitoJwtVerifier;
15899
- var init_cognito_verifier = __esm(() => {
15900
- init_error();
15901
- init_jwt_verifier();
15902
- init_assert();
15903
- CognitoJwtVerifier = class CognitoJwtVerifier extends JwtVerifierBase {
15904
- constructor(props, jwksCache) {
15905
- const issuerConfig = Array.isArray(props) ? props.map((p) => ({
15906
- ...p,
15907
- ...CognitoJwtVerifier.parseUserPoolId(p.userPoolId),
15908
- audience: null
15909
- })) : {
15910
- ...props,
15911
- ...CognitoJwtVerifier.parseUserPoolId(props.userPoolId),
15912
- audience: null
15913
- };
15914
- super(issuerConfig, jwksCache);
15915
- }
15916
- static parseUserPoolId(userPoolId) {
15917
- const match = userPoolId.match(this.USER_POOL_ID_REGEX);
15918
- if (!match) {
15919
- throw new ParameterValidationError(`Invalid Cognito User Pool ID: ${userPoolId}`);
15920
- }
15921
- const region = match.groups.region;
15922
- const issuer = `https://cognito-idp.${region}.amazonaws.com/${userPoolId}`;
15923
- return {
15924
- issuer,
15925
- jwksUri: `${issuer}/.well-known/jwks.json`
15926
- };
15927
- }
15928
- static create(verifyProperties, additionalProperties) {
15929
- return new this(verifyProperties, additionalProperties?.jwksCache);
15930
- }
15931
- verifySync(...[jwt, properties]) {
15932
- const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
15933
- this.verifyDecomposedJwtSync(decomposedJwt, jwksUri, verifyProperties);
15934
- try {
15935
- validateCognitoJwtFields(decomposedJwt.payload, verifyProperties);
15936
- } catch (err2) {
15937
- if (verifyProperties.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
15938
- throw err2.withRawJwt(decomposedJwt);
15939
- }
15940
- throw err2;
15941
- }
15942
- return decomposedJwt.payload;
15943
- }
15944
- async verify(...[jwt, properties]) {
15945
- const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
15946
- await this.verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties);
15947
- try {
15948
- validateCognitoJwtFields(decomposedJwt.payload, verifyProperties);
15949
- } catch (err2) {
15950
- if (verifyProperties.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
15951
- throw err2.withRawJwt(decomposedJwt);
15952
- }
15953
- throw err2;
15954
- }
15955
- return decomposedJwt.payload;
15956
- }
15957
- cacheJwks(...[jwks, userPoolId]) {
15958
- let issuer;
15959
- if (userPoolId !== undefined) {
15960
- issuer = CognitoJwtVerifier.parseUserPoolId(userPoolId).issuer;
15961
- } else if (Array.from(this.issuersConfig).length > 1) {
15962
- throw new ParameterValidationError("userPoolId must be provided");
15963
- }
15964
- const issuerConfig = this.getIssuerConfig(issuer);
15965
- super.cacheJwks(jwks, issuerConfig.issuer);
15966
- }
15967
- };
15968
- CognitoJwtVerifier.USER_POOL_ID_REGEX = /^(?<region>[a-z]{2}-(gov-)?[a-z]+-\d)_[a-zA-Z0-9]+$/;
15969
- });
15970
- // ../../node_modules/aws-jwt-verify/dist/esm/alb-cache.js
15971
- var init_alb_cache = __esm(() => {
15972
- init_error();
15973
- init_https();
15974
- init_node_web_compat_node();
15975
- });
15976
-
15977
- // ../../node_modules/aws-jwt-verify/dist/esm/alb-verifier.js
15978
- var init_alb_verifier = __esm(() => {
15979
- init_alb_cache();
15980
- init_assert();
15981
- init_error();
15982
- init_jwt_verifier();
15983
- });
15984
-
15985
- // ../../node_modules/aws-jwt-verify/dist/esm/index.js
15986
- var init_esm2 = __esm(() => {
15987
- init_jwt_verifier();
15988
- init_cognito_verifier();
15989
- init_alb_verifier();
15990
- init_jwt_verifier();
15991
- });
15992
-
15993
- // ../api-core/src/utils/lti.util.ts
15994
- function generateUsername(email) {
15995
- const baseUsername = (email.split("@")[0] || "user").toLowerCase();
15996
- const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
15997
- const randomSuffix = Math.random().toString(36).substring(2, 7);
15998
- return `${cleanUsername}_${randomSuffix}`;
15999
- }
16000
- function extractRedirectPath(targetUri, currentHost) {
16001
- try {
16002
- const targetUrl = new URL(targetUri);
16003
- if (targetUrl.hostname === currentHost) {
16004
- return targetUrl.pathname + targetUrl.search;
16005
- }
16006
- } catch {}
16007
- return "/";
16008
- }
16009
- function getLtiRoles(claims) {
16010
- return claims["https://purl.imsglobal.org/spec/lti/claim/roles"] || [];
16011
- }
16012
- function hasLtiRole(claims, role) {
16013
- return getLtiRoles(claims).some((r) => r.includes(role));
16014
- }
16015
- function validateLtiClaims(claims) {
16016
- const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
16017
- const version2 = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
16018
- if (messageType !== "LtiResourceLinkRequest") {
16019
- return `Invalid LTI message type: ${messageType}`;
16020
- }
16021
- if (version2 !== "1.3.0") {
16022
- return `Unsupported LTI version: ${version2}`;
16023
- }
16024
- return null;
16025
- }
16026
- var LtiRoleChecks;
16027
- var init_lti_util = __esm(() => {
16028
- LtiRoleChecks = {
16029
- isLearner: (claims) => hasLtiRole(claims, "Learner"),
16030
- isInstructor: (claims) => hasLtiRole(claims, "Instructor"),
16031
- isAdministrator: (claims) => hasLtiRole(claims, "Administrator"),
16032
- isContentDeveloper: (claims) => hasLtiRole(claims, "ContentDeveloper"),
16033
- isMentor: (claims) => hasLtiRole(claims, "Mentor")
16034
- };
16035
- });
16036
-
16037
15024
  // ../api-core/src/services/lti.service.ts
16038
- import * as crypto4 from "node:crypto";
16039
-
16040
15025
  class LtiService {
16041
15026
  ctx;
16042
- verifier = null;
16043
15027
  constructor(ctx) {
16044
15028
  this.ctx = ctx;
16045
15029
  }
16046
- getConfig() {
16047
- if (!this.ctx.config.lti) {
16048
- logger17.error("LTI configuration not available");
16049
- throw new ValidationError("LTI is not configured");
16050
- }
16051
- return this.ctx.config.lti;
16052
- }
16053
- getVerifier() {
16054
- if (!this.verifier) {
16055
- const lti = this.getConfig();
16056
- this.verifier = JwtVerifier.create({
16057
- issuer: lti.issuer,
16058
- audience: lti.audience,
16059
- jwksUri: lti.jwksUrl
16060
- });
16061
- }
16062
- return this.verifier;
16063
- }
16064
- async verifyToken(idToken) {
16065
- if (this.ctx.config.ltiTestMode) {
16066
- if (!idToken.startsWith("mock:")) {
16067
- throw new ValidationError("Invalid LTI token");
16068
- }
16069
- try {
16070
- const jsonStr = Buffer.from(idToken.slice(5), "base64").toString();
16071
- return JSON.parse(jsonStr);
16072
- } catch {
16073
- throw new ValidationError("Invalid LTI token format");
16074
- }
16075
- }
16076
- try {
16077
- const verifier = this.getVerifier();
16078
- const claims = await verifier.verify(idToken);
16079
- logger17.info("Verified token", {
16080
- sub: claims.sub,
16081
- email: claims.email,
16082
- roles: claims["https://purl.imsglobal.org/spec/lti/claim/roles"]
16083
- });
16084
- return claims;
16085
- } catch (error) {
16086
- logger17.error("Token verification failed", {
16087
- error: error instanceof Error ? error.message : String(error)
16088
- });
16089
- throw new ValidationError("Invalid LTI token");
16090
- }
16091
- }
16092
- async processLaunch(idToken, currentHost) {
16093
- const claims = await this.verifyToken(idToken);
16094
- const validationError = validateLtiClaims(claims);
16095
- if (validationError) {
16096
- logger17.warn("LTI claims validation failed", {
16097
- error: validationError,
16098
- sub: claims.sub
16099
- });
16100
- throw new ValidationError(validationError);
16101
- }
16102
- const user = await this.provisionUser(claims);
16103
- logger17.info("Processed launch roles", {
16104
- userId: user.id,
16105
- isLearner: LtiRoleChecks.isLearner(claims),
16106
- isInstructor: LtiRoleChecks.isInstructor(claims),
16107
- isAdministrator: LtiRoleChecks.isAdministrator(claims),
16108
- allRoles: claims["https://purl.imsglobal.org/spec/lti/claim/roles"]
16109
- });
16110
- const sessionToken = await this.createSession(user.id);
16111
- const targetUri = claims["https://purl.imsglobal.org/spec/lti/claim/target_link_uri"];
16112
- const redirectPath = extractRedirectPath(targetUri, currentHost);
16113
- logger17.info("Launch processed", { userId: user.id, redirectPath });
16114
- const userInfo = {
16115
- sub: user.id,
16116
- email: user.email,
16117
- name: user.name,
16118
- email_verified: user.emailVerified,
16119
- timeback_id: user.timebackId ?? undefined
16120
- };
16121
- return { user: userInfo, redirectPath, sessionToken };
16122
- }
16123
15030
  async getStatus(user) {
16124
15031
  const db2 = this.ctx.db;
16125
15032
  const [ltiAccount, oauthAccount, userRecord] = await Promise.all([
@@ -16143,134 +15050,11 @@ class LtiService {
16143
15050
  userId: user.id
16144
15051
  };
16145
15052
  }
16146
- async createSession(userId) {
16147
- const db2 = this.ctx.db;
16148
- const sessionToken = crypto4.randomUUID();
16149
- const expiresAt = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000);
16150
- const [session2] = await db2.insert(sessions).values({
16151
- id: crypto4.randomUUID(),
16152
- userId,
16153
- token: sessionToken,
16154
- expiresAt,
16155
- createdAt: new Date,
16156
- updatedAt: new Date
16157
- }).returning({ id: sessions.id });
16158
- if (!session2) {
16159
- logger17.error("Session insert returned no rows", { userId });
16160
- throw new InternalError("Failed to create session");
16161
- }
16162
- logger17.info("Created session", {
16163
- userId,
16164
- providerId: AUTH_PROVIDER_IDS.TIMEBACK_LTI
16165
- });
16166
- return sessionToken;
16167
- }
16168
- async provisionUser(claims) {
16169
- const db2 = this.ctx.db;
16170
- const email = claims.email;
16171
- const ltiTimebackId = claims.sub;
16172
- const providerId = AUTH_PROVIDER_IDS.TIMEBACK_LTI;
16173
- if (!email) {
16174
- throw new ValidationError("Email is required in LTI claims");
16175
- }
16176
- const existingAccount = await db2.query.accounts.findFirst({
16177
- where: and(eq(accounts.accountId, ltiTimebackId), eq(accounts.providerId, providerId))
16178
- });
16179
- if (existingAccount) {
16180
- const user = await db2.query.users.findFirst({
16181
- where: eq(users.id, existingAccount.userId)
16182
- });
16183
- if (user) {
16184
- logger17.info("Found user by account", {
16185
- userId: user.id,
16186
- ltiTimebackId
16187
- });
16188
- return user;
16189
- }
16190
- }
16191
- const existingUser = await db2.query.users.findFirst({
16192
- where: eq(users.email, email)
16193
- });
16194
- if (existingUser) {
16195
- await db2.transaction(async (tx) => {
16196
- const existingLtiAccount = await tx.query.accounts.findFirst({
16197
- where: and(eq(accounts.userId, existingUser.id), eq(accounts.providerId, providerId))
16198
- });
16199
- if (!existingLtiAccount) {
16200
- const [account] = await tx.insert(accounts).values({
16201
- id: crypto4.randomUUID(),
16202
- userId: existingUser.id,
16203
- accountId: ltiTimebackId,
16204
- providerId,
16205
- accessToken: null,
16206
- refreshToken: null,
16207
- accessTokenExpiresAt: null,
16208
- refreshTokenExpiresAt: null,
16209
- createdAt: new Date,
16210
- updatedAt: new Date
16211
- }).returning({ id: accounts.id });
16212
- if (!account) {
16213
- logger17.error("LTI account link insert returned no rows", {
16214
- userId: existingUser.id,
16215
- ltiTimebackId
16216
- });
16217
- throw new InternalError("Failed to link LTI account");
16218
- }
16219
- logger17.info("Linked existing user", {
16220
- userId: existingUser.id,
16221
- ltiTimebackId
16222
- });
16223
- }
16224
- });
16225
- return existingUser;
16226
- }
16227
- const newUserId = crypto4.randomUUID();
16228
- const createdUser = await db2.transaction(async (tx) => {
16229
- const [insertedUser] = await tx.insert(users).values({
16230
- id: newUserId,
16231
- email,
16232
- emailVerified: true,
16233
- timebackId: ltiTimebackId,
16234
- username: generateUsername(email),
16235
- name: claims.name || claims.given_name || email.split("@")[0] || "Timeback User",
16236
- createdAt: new Date,
16237
- updatedAt: new Date
16238
- }).returning();
16239
- if (!insertedUser) {
16240
- logger17.error("LTI user insert returned no rows", { email, ltiTimebackId });
16241
- throw new InternalError("Failed to create user");
16242
- }
16243
- await tx.insert(accounts).values({
16244
- id: crypto4.randomUUID(),
16245
- userId: newUserId,
16246
- accountId: ltiTimebackId,
16247
- providerId,
16248
- accessToken: null,
16249
- refreshToken: null,
16250
- accessTokenExpiresAt: null,
16251
- refreshTokenExpiresAt: null,
16252
- createdAt: new Date,
16253
- updatedAt: new Date
16254
- });
16255
- logger17.info("Provisioned user", {
16256
- userId: insertedUser.id,
16257
- ltiTimebackId
16258
- });
16259
- return insertedUser;
16260
- });
16261
- return createdUser;
16262
- }
16263
15053
  }
16264
- var logger17;
16265
15054
  var init_lti_service = __esm(() => {
16266
- init_esm2();
16267
15055
  init_drizzle_orm();
16268
15056
  init_src();
16269
15057
  init_tables_index();
16270
- init_src2();
16271
- init_errors();
16272
- init_lti_util();
16273
- logger17 = log.scope("LtiService");
16274
15058
  });
16275
15059
 
16276
15060
  // ../api-core/src/services/map.service.ts
@@ -16287,7 +15071,7 @@ class MapService {
16287
15071
  if (!mapDetails) {
16288
15072
  throw new NotFoundError("Map", identifier);
16289
15073
  }
16290
- logger18.debug("Retrieved map", { identifier });
15074
+ logger17.debug("Retrieved map", { identifier });
16291
15075
  return mapDetails;
16292
15076
  }
16293
15077
  async getElements(mapId) {
@@ -16303,7 +15087,7 @@ class MapService {
16303
15087
  }
16304
15088
  }
16305
15089
  });
16306
- logger18.debug("Retrieved elements", { mapId, count: elements.length });
15090
+ logger17.debug("Retrieved elements", { mapId, count: elements.length });
16307
15091
  return elements;
16308
15092
  }
16309
15093
  async getObjects(mapId, userId) {
@@ -16324,7 +15108,7 @@ class MapService {
16324
15108
  }
16325
15109
  }
16326
15110
  });
16327
- logger18.debug("Retrieved objects", { mapId, userId, count: objects.length });
15111
+ logger17.debug("Retrieved objects", { mapId, userId, count: objects.length });
16328
15112
  return objects.map((object) => this.formatMapObjectWithItem(object));
16329
15113
  }
16330
15114
  async createObject(mapId, data, user) {
@@ -16351,7 +15135,7 @@ class MapService {
16351
15135
  throw new NotFoundError("Item", data.itemId);
16352
15136
  }
16353
15137
  if (!item.isPlaceable) {
16354
- logger18.warn("Attempted to place non-placeable item", {
15138
+ logger17.warn("Attempted to place non-placeable item", {
16355
15139
  userId: user.id,
16356
15140
  itemId: data.itemId,
16357
15141
  mapId
@@ -16365,7 +15149,7 @@ class MapService {
16365
15149
  };
16366
15150
  const [createdObject] = await db2.insert(mapObjects).values(objectData).returning();
16367
15151
  if (!createdObject) {
16368
- logger18.error("Map object insert returned no rows", {
15152
+ logger17.error("Map object insert returned no rows", {
16369
15153
  userId: user.id,
16370
15154
  mapId,
16371
15155
  itemId: data.itemId
@@ -16389,12 +15173,12 @@ class MapService {
16389
15173
  }
16390
15174
  });
16391
15175
  if (!objectWithItem) {
16392
- logger18.error("Map object query after insert returned no rows", {
15176
+ logger17.error("Map object query after insert returned no rows", {
16393
15177
  objectId: createdObject.id
16394
15178
  });
16395
15179
  throw new InternalError("Failed to retrieve created object");
16396
15180
  }
16397
- logger18.info("Created object", {
15181
+ logger17.info("Created object", {
16398
15182
  userId: user.id,
16399
15183
  mapId,
16400
15184
  objectId: createdObject.id,
@@ -16418,7 +15202,7 @@ class MapService {
16418
15202
  if (result.length === 0) {
16419
15203
  throw new NotFoundError("MapObject", objectId);
16420
15204
  }
16421
- logger18.info("Deleted object", {
15205
+ logger17.info("Deleted object", {
16422
15206
  userId: user.id,
16423
15207
  mapId,
16424
15208
  objectId
@@ -16447,13 +15231,13 @@ class MapService {
16447
15231
  };
16448
15232
  }
16449
15233
  }
16450
- var logger18;
15234
+ var logger17;
16451
15235
  var init_map_service = __esm(() => {
16452
15236
  init_drizzle_orm();
16453
15237
  init_tables_index();
16454
15238
  init_src2();
16455
15239
  init_errors();
16456
- logger18 = log.scope("MapService");
15240
+ logger17 = log.scope("MapService");
16457
15241
  });
16458
15242
 
16459
15243
  // ../realtime/src/server/domain/events.ts
@@ -16474,13 +15258,13 @@ async function publishToUser(baseUrl, secret, userId, type, payload) {
16474
15258
  });
16475
15259
  if (!res.ok) {
16476
15260
  const text3 = await res.text().catch(() => "");
16477
- logger19.warn("Failed to publish to user", {
15261
+ logger18.warn("Failed to publish to user", {
16478
15262
  status: res.status,
16479
15263
  body: text3
16480
15264
  });
16481
15265
  }
16482
15266
  } catch (error) {
16483
- logger19.error("Publish to user error", { error });
15267
+ logger18.error("Publish to user error", { error });
16484
15268
  }
16485
15269
  }
16486
15270
 
@@ -16500,7 +15284,7 @@ class NotificationService {
16500
15284
  if (type)
16501
15285
  conditions2.push(eq(notifications.type, type));
16502
15286
  const results = await this.ctx.db.select().from(notifications).where(and(...conditions2)).orderBy(desc(notifications.createdAt)).limit(limit).offset(offset);
16503
- logger19.debug("Listed notifications", { userId: user.id, count: results.length });
15287
+ logger18.debug("Listed notifications", { userId: user.id, count: results.length });
16504
15288
  return results;
16505
15289
  }
16506
15290
  async updateStatus(notificationId, status, method) {
@@ -16518,7 +15302,7 @@ class NotificationService {
16518
15302
  if (!updated) {
16519
15303
  throw new NotFoundError("Notification", notificationId);
16520
15304
  }
16521
- logger19.debug("Updated status", { notificationId, status });
15305
+ logger18.debug("Updated status", { notificationId, status });
16522
15306
  return updated;
16523
15307
  }
16524
15308
  async getStats(user, options) {
@@ -16542,7 +15326,7 @@ class NotificationService {
16542
15326
  const clicked = statsMap.clicked || 0;
16543
15327
  const dismissed = statsMap.dismissed || 0;
16544
15328
  const expired = statsMap.expired || 0;
16545
- logger19.debug("Retrieved stats", { userId: user.id, total });
15329
+ logger18.debug("Retrieved stats", { userId: user.id, total });
16546
15330
  return {
16547
15331
  total,
16548
15332
  delivered,
@@ -16588,7 +15372,7 @@ class NotificationService {
16588
15372
  metadata: metadata2
16589
15373
  });
16590
15374
  }
16591
- logger19.debug("Created notification", {
15375
+ logger18.debug("Created notification", {
16592
15376
  userId,
16593
15377
  type,
16594
15378
  id: notificationId,
@@ -16596,14 +15380,14 @@ class NotificationService {
16596
15380
  });
16597
15381
  return notificationId;
16598
15382
  } catch (error) {
16599
- logger19.error("Failed to create notification", { userId, type, error });
15383
+ logger18.error("Failed to create notification", { userId, type, error });
16600
15384
  return null;
16601
15385
  }
16602
15386
  }
16603
15387
  async publish(userId, notificationId, type, title, message, options) {
16604
15388
  const realtimeConfig = this.ctx.config.realtime;
16605
15389
  if (!realtimeConfig) {
16606
- logger19.warn("No realtime config for publish");
15390
+ logger18.warn("No realtime config for publish");
16607
15391
  return;
16608
15392
  }
16609
15393
  const { relayUrl, publishSecret } = realtimeConfig;
@@ -16645,13 +15429,13 @@ class NotificationService {
16645
15429
  metadata: data.metadata || {}
16646
15430
  }).returning();
16647
15431
  if (!notification) {
16648
- logger19.error("Notification insert returned no rows", {
15432
+ logger18.error("Notification insert returned no rows", {
16649
15433
  userId: data.userId,
16650
15434
  type: data.type
16651
15435
  });
16652
15436
  throw new InternalError("Failed to create notification");
16653
15437
  }
16654
- logger19.info("Inserted notification", {
15438
+ logger18.info("Inserted notification", {
16655
15439
  notificationId: notification.id,
16656
15440
  userId: notification.userId,
16657
15441
  type: notification.type
@@ -16661,7 +15445,7 @@ class NotificationService {
16661
15445
  async deliverPending(userId) {
16662
15446
  const realtimeConfig = this.ctx.config.realtime;
16663
15447
  if (!realtimeConfig) {
16664
- logger19.warn("No realtime config for delivery");
15448
+ logger18.warn("No realtime config for delivery");
16665
15449
  return;
16666
15450
  }
16667
15451
  const { relayUrl, publishSecret } = realtimeConfig;
@@ -16688,13 +15472,13 @@ class NotificationService {
16688
15472
  metadata: notification.metadata,
16689
15473
  clickUrl: notification.clickUrl
16690
15474
  });
16691
- logger19.info("Delivered notification", {
15475
+ logger18.info("Delivered notification", {
16692
15476
  notificationId: notification.id,
16693
15477
  userId,
16694
15478
  type: notification.type
16695
15479
  });
16696
15480
  } catch (error) {
16697
- logger19.warn("Failed to deliver", {
15481
+ logger18.warn("Failed to deliver", {
16698
15482
  notificationId: notification.id,
16699
15483
  error
16700
15484
  });
@@ -16702,7 +15486,7 @@ class NotificationService {
16702
15486
  }
16703
15487
  }
16704
15488
  }
16705
- var logger19;
15489
+ var logger18;
16706
15490
  var init_notification_service = __esm(() => {
16707
15491
  init_drizzle_orm();
16708
15492
  init_src();
@@ -16711,7 +15495,7 @@ var init_notification_service = __esm(() => {
16711
15495
  init_events();
16712
15496
  init_notification();
16713
15497
  init_errors();
16714
- logger19 = log.scope("NotificationService");
15498
+ logger18 = log.scope("NotificationService");
16715
15499
  });
16716
15500
 
16717
15501
  // ../api-core/src/services/realtime.service.ts
@@ -16746,20 +15530,20 @@ class RealtimeService {
16746
15530
  }
16747
15531
  const displayName = user.username || (user.name ? user.name.split(" ")[0] : undefined) || undefined;
16748
15532
  const token = await this.ctx.providers.auth.mintRealtimeToken(user.id, resolvedGameId, displayName, user.role);
16749
- logger20.info("Generated token", {
15533
+ logger19.info("Generated token", {
16750
15534
  userId: user.id,
16751
15535
  gameId: resolvedGameId || "global"
16752
15536
  });
16753
15537
  return { token };
16754
15538
  }
16755
15539
  }
16756
- var logger20;
15540
+ var logger19;
16757
15541
  var init_realtime_service = __esm(() => {
16758
15542
  init_drizzle_orm();
16759
15543
  init_tables_index();
16760
15544
  init_src2();
16761
15545
  init_errors();
16762
- logger20 = log.scope("RealtimeService");
15546
+ logger19 = log.scope("RealtimeService");
16763
15547
  });
16764
15548
 
16765
15549
  // ../api-core/src/services/secrets.service.ts
@@ -16768,60 +15552,92 @@ class SecretsService {
16768
15552
  constructor(ctx) {
16769
15553
  this.ctx = ctx;
16770
15554
  }
16771
- async listKeys(slug2, user) {
16772
- const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
16773
- const secrets = await this.ctx.providers.secrets.readSecrets(game.id);
16774
- const keys = secrets ? Object.keys(secrets).filter((k) => !INTERNAL_SECRET_KEYS.includes(k)) : [];
16775
- logger21.debug("Listed secret keys", { gameId: game.id, slug: slug2, keyCount: keys.length });
16776
- return keys;
15555
+ getCloudflare() {
15556
+ if (!this.ctx.cloudflare) {
15557
+ throw new ValidationError("Secrets management requires Cloudflare provider");
15558
+ }
15559
+ return this.ctx.cloudflare;
15560
+ }
15561
+ getDeploymentId(slug2) {
15562
+ const isProd = isProduction2(this.ctx.config);
15563
+ return getDeploymentId(slug2, isProd);
16777
15564
  }
16778
- async getValues(slug2, user) {
15565
+ async listKeys(slug2, user) {
16779
15566
  const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
16780
- const secrets = await this.ctx.providers.secrets.readSecrets(game.id);
16781
- if (!secrets) {
16782
- return {};
16783
- }
16784
- const filtered = {};
16785
- for (const [key, value] of Object.entries(secrets)) {
16786
- if (!INTERNAL_SECRET_KEYS.includes(key)) {
16787
- filtered[key] = value;
15567
+ const cf = this.getCloudflare();
15568
+ const deploymentId = this.getDeploymentId(slug2);
15569
+ try {
15570
+ const allKeys = await cf.listSecrets(deploymentId);
15571
+ const keys = allKeys.filter((k) => k.startsWith(SECRETS_PREFIX)).map((k) => k.slice(SECRETS_PREFIX.length));
15572
+ logger20.debug("Listed secret keys", { gameId: game.id, slug: slug2, keyCount: keys.length });
15573
+ return keys;
15574
+ } catch (error) {
15575
+ const message = error instanceof Error ? error.message : String(error);
15576
+ if (message.includes("not found") || message.includes("10007")) {
15577
+ logger20.debug("Worker not found, returning empty secrets list", {
15578
+ gameId: game.id,
15579
+ slug: slug2
15580
+ });
15581
+ return [];
16788
15582
  }
15583
+ throw error;
16789
15584
  }
16790
- logger21.debug("Retrieved secret values", { gameId: game.id, slug: slug2 });
16791
- return filtered;
16792
15585
  }
16793
15586
  async setSecrets(slug2, newSecrets, user) {
16794
15587
  const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
15588
+ const cf = this.getCloudflare();
15589
+ const deploymentId = this.getDeploymentId(slug2);
16795
15590
  const secretKeys = Object.keys(newSecrets);
16796
15591
  if (secretKeys.length === 0) {
15592
+ logger20.warn("No secrets provided", { userId: user.id, slug: slug2 });
16797
15593
  throw new ValidationError("At least one secret must be provided");
16798
15594
  }
16799
15595
  for (const [key, value] of Object.entries(newSecrets)) {
16800
15596
  if (typeof value !== "string") {
15597
+ logger20.warn("Secret value must be a string", { userId: user.id, slug: slug2, key });
16801
15598
  throw new ValidationError(`Secret value for "${key}" must be a string`);
16802
15599
  }
16803
15600
  if (INTERNAL_SECRET_KEYS.includes(key)) {
16804
- logger21.warn("Attempted to set reserved secret", {
16805
- userId: user.id,
15601
+ logger20.warn("Attempted to set reserved secret", { userId: user.id, slug: slug2, key });
15602
+ throw new ValidationError(`Cannot set reserved secret "${key}"`);
15603
+ }
15604
+ }
15605
+ try {
15606
+ const prefixedSecrets = {};
15607
+ for (const [key, value] of Object.entries(newSecrets)) {
15608
+ prefixedSecrets[`${SECRETS_PREFIX}${key}`] = value;
15609
+ }
15610
+ await cf.setSecrets(deploymentId, prefixedSecrets);
15611
+ logger20.info("Set secrets", {
15612
+ gameId: game.id,
15613
+ slug: slug2,
15614
+ deploymentId,
15615
+ keys: secretKeys
15616
+ });
15617
+ const allKeys = await cf.listSecrets(deploymentId);
15618
+ return allKeys.filter((k) => k.startsWith(SECRETS_PREFIX)).map((k) => k.slice(SECRETS_PREFIX.length));
15619
+ } catch (error) {
15620
+ const message = error instanceof Error ? error.message : String(error);
15621
+ if (message.includes("not found") || message.includes("10007")) {
15622
+ logger20.warn("Cannot set secrets - game not deployed", {
16806
15623
  gameId: game.id,
16807
- key
15624
+ slug: slug2,
15625
+ deploymentId
16808
15626
  });
16809
- throw new ValidationError(`Cannot set reserved secret "${key}"`);
15627
+ throw new ValidationError("Game must be deployed before setting secrets. Run `playcademy deploy` first.");
16810
15628
  }
15629
+ logger20.error("Failed to set secrets", {
15630
+ gameId: game.id,
15631
+ slug: slug2,
15632
+ deploymentId,
15633
+ error: message
15634
+ });
15635
+ throw error;
16811
15636
  }
16812
- const existingSecrets = await this.ctx.providers.secrets.readSecrets(game.id) || {};
16813
- const updatedSecrets = { ...existingSecrets, ...newSecrets };
16814
- await this.ctx.providers.secrets.writeSecrets(game.id, updatedSecrets);
16815
- logger21.info("Set secrets", {
16816
- gameId: game.id,
16817
- slug: slug2,
16818
- addedKeys: secretKeys
16819
- });
16820
- return Object.keys(updatedSecrets).filter((k) => !INTERNAL_SECRET_KEYS.includes(k));
16821
15637
  }
16822
15638
  async deleteSecret(slug2, key, user) {
16823
15639
  if (INTERNAL_SECRET_KEYS.includes(key)) {
16824
- logger21.warn("Attempted to delete reserved secret", {
15640
+ logger20.warn("Attempted to delete reserved secret", {
16825
15641
  userId: user.id,
16826
15642
  slug: slug2,
16827
15643
  key
@@ -16829,25 +15645,53 @@ class SecretsService {
16829
15645
  throw new ValidationError(`Cannot delete reserved secret "${key}"`);
16830
15646
  }
16831
15647
  const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
16832
- const secrets = await this.ctx.providers.secrets.readSecrets(game.id);
16833
- if (!secrets || !(key in secrets)) {
16834
- throw new NotFoundError("Secret", key);
16835
- }
16836
- delete secrets[key];
16837
- if (Object.keys(secrets).length > 0) {
16838
- await this.ctx.providers.secrets.writeSecrets(game.id, secrets);
16839
- } else {
16840
- await this.ctx.providers.secrets.deleteSecrets(game.id);
15648
+ const cf = this.getCloudflare();
15649
+ const deploymentId = this.getDeploymentId(slug2);
15650
+ try {
15651
+ const prefixedKey = `${SECRETS_PREFIX}${key}`;
15652
+ const existingKeys = await cf.listSecrets(deploymentId);
15653
+ if (!existingKeys.includes(prefixedKey)) {
15654
+ throw new NotFoundError("Secret", key);
15655
+ }
15656
+ await cf.deleteSecret(deploymentId, prefixedKey);
15657
+ logger20.info("Deleted secret", {
15658
+ gameId: game.id,
15659
+ slug: slug2,
15660
+ deploymentId,
15661
+ key
15662
+ });
15663
+ } catch (error) {
15664
+ if (error instanceof NotFoundError) {
15665
+ throw error;
15666
+ }
15667
+ const message = error instanceof Error ? error.message : String(error);
15668
+ if (message.includes("not found") || message.includes("10007")) {
15669
+ logger20.warn("Cannot delete secret - game not deployed", {
15670
+ gameId: game.id,
15671
+ slug: slug2,
15672
+ deploymentId
15673
+ });
15674
+ throw new ValidationError("Game must be deployed before managing secrets. Run `playcademy deploy` first.");
15675
+ }
15676
+ logger20.error("Failed to delete secret", {
15677
+ gameId: game.id,
15678
+ slug: slug2,
15679
+ deploymentId,
15680
+ key,
15681
+ error: message
15682
+ });
15683
+ throw error;
16841
15684
  }
16842
- logger21.info("Deleted secret", { gameId: game.id, slug: slug2, key });
16843
15685
  }
16844
15686
  }
16845
- var logger21, INTERNAL_SECRET_KEYS;
15687
+ var logger20, SECRETS_PREFIX = "secrets_", INTERNAL_SECRET_KEYS;
16846
15688
  var init_secrets_service = __esm(() => {
16847
15689
  init_src2();
15690
+ init_config2();
16848
15691
  init_errors();
16849
- logger21 = log.scope("SecretsService");
16850
- INTERNAL_SECRET_KEYS = ["PLAYCADEMY_API_KEY"];
15692
+ init_deployment_util();
15693
+ logger20 = log.scope("SecretsService");
15694
+ INTERNAL_SECRET_KEYS = ["PLAYCADEMY_API_KEY", "GAME_ID", "PLAYCADEMY_BASE_URL"];
16851
15695
  });
16852
15696
 
16853
15697
  // ../api-core/src/services/seed.service.ts
@@ -16859,7 +15703,7 @@ class SeedService {
16859
15703
  getCloudflare() {
16860
15704
  const cf = this.ctx.cloudflare;
16861
15705
  if (!cf) {
16862
- logger22.error("Cloudflare provider not available for seeding");
15706
+ logger21.error("Cloudflare provider not available for seeding");
16863
15707
  throw new ValidationError("Cloudflare provider not configured");
16864
15708
  }
16865
15709
  return cf;
@@ -16871,7 +15715,7 @@ class SeedService {
16871
15715
  const deploymentId = getDeploymentId(slug2, isProd);
16872
15716
  const uniqueSuffix = Date.now().toString(36);
16873
15717
  const seedDeploymentId = `seed-${deploymentId}-${uniqueSuffix}`;
16874
- logger22.debug("Seeding database", {
15718
+ logger21.debug("Seeding database", {
16875
15719
  userId: user.id,
16876
15720
  gameId: game.id,
16877
15721
  slug: slug2,
@@ -16880,7 +15724,7 @@ class SeedService {
16880
15724
  });
16881
15725
  try {
16882
15726
  const workerResponse = await this.deployAndExecuteSeedWorker(cf, seedDeploymentId, game.id, deploymentId, code);
16883
- logger22.info("Seed completed", {
15727
+ logger21.info("Seed completed", {
16884
15728
  gameId: game.id,
16885
15729
  slug: slug2,
16886
15730
  deploymentId,
@@ -16896,7 +15740,7 @@ class SeedService {
16896
15740
  };
16897
15741
  } catch (error) {
16898
15742
  const errorMessage = error instanceof Error ? error.message : String(error);
16899
- logger22.error("Seed failed", {
15743
+ logger21.error("Seed failed", {
16900
15744
  slug: slug2,
16901
15745
  error: errorMessage
16902
15746
  });
@@ -16906,7 +15750,7 @@ class SeedService {
16906
15750
  error: errorMessage,
16907
15751
  developer: { id: user.id, email: user.email }
16908
15752
  }).catch((err2) => {
16909
- logger22.warn("Failed to send failure alert", { error: err2 });
15753
+ logger21.warn("Failed to send failure alert", { error: err2 });
16910
15754
  });
16911
15755
  if (error instanceof Error) {
16912
15756
  if (error.message.includes("timed out") || error.message.includes("AbortError")) {
@@ -16960,7 +15804,7 @@ class SeedService {
16960
15804
  bindings: { d1: [deploymentId], r2: [], kv: [] },
16961
15805
  keepAssets: false
16962
15806
  });
16963
- logger22.info("Worker deployed", { seedDeploymentId, url: result.url });
15807
+ logger21.info("Worker deployed", { seedDeploymentId, url: result.url });
16964
15808
  return await this.executeSeedWorker(result.url, seedDeploymentId);
16965
15809
  } finally {
16966
15810
  await this.cleanupSeedWorker(cf, seedDeploymentId);
@@ -16976,7 +15820,7 @@ class SeedService {
16976
15820
  await new Promise((resolve) => setTimeout(resolve, INITIAL_DELAY));
16977
15821
  for (let attempt = 0;attempt < MAX_RETRIES; attempt++) {
16978
15822
  if (attempt > 0) {
16979
- logger22.debug("Retrying seed execution", {
15823
+ logger21.debug("Retrying seed execution", {
16980
15824
  attempt: attempt + 1,
16981
15825
  maxRetries: MAX_RETRIES,
16982
15826
  nextRetryIn: `${RETRY_INTERVAL / 1000}s`
@@ -16996,14 +15840,14 @@ class SeedService {
16996
15840
  const isRetryable = response.status === 404 || response.status >= 500;
16997
15841
  if (isRetryable && attempt < MAX_RETRIES - 1) {
16998
15842
  lastError = new Error(`Worker returned ${response.status}`);
16999
- logger22.debug("Worker not ready, will retry", {
15843
+ logger21.debug("Worker not ready, will retry", {
17000
15844
  status: response.status,
17001
15845
  attempt: attempt + 1,
17002
15846
  errorBody: errorBody?.substring(0, 500)
17003
15847
  });
17004
15848
  continue;
17005
15849
  }
17006
- logger22.error("Worker returned error", {
15850
+ logger21.error("Worker returned error", {
17007
15851
  status: response.status,
17008
15852
  statusText: response.statusText,
17009
15853
  errorBody
@@ -17013,7 +15857,7 @@ class SeedService {
17013
15857
  const data = await response.json();
17014
15858
  if (!data.success) {
17015
15859
  const error = data.error || "Seed execution failed";
17016
- logger22.error("Seed execution failed", {
15860
+ logger21.error("Seed execution failed", {
17017
15861
  error,
17018
15862
  stack: data.stack,
17019
15863
  details: data.details,
@@ -17034,7 +15878,7 @@ class SeedService {
17034
15878
  };
17035
15879
  throw new InternalError(detailedMessage, errorDetails);
17036
15880
  }
17037
- logger22.info("Seed executed successfully", {
15881
+ logger21.info("Seed executed successfully", {
17038
15882
  seedDeploymentId,
17039
15883
  duration: data.duration,
17040
15884
  logCount: data.logs?.length ?? 0
@@ -17044,7 +15888,7 @@ class SeedService {
17044
15888
  clearTimeout(timeout);
17045
15889
  if (error instanceof Error && error.name === "AbortError") {
17046
15890
  lastError = new Error("Seed execution timed out");
17047
- logger22.debug("Seed execution timed out, will retry", {
15891
+ logger21.debug("Seed execution timed out, will retry", {
17048
15892
  attempt: attempt + 1
17049
15893
  });
17050
15894
  if (attempt < MAX_RETRIES - 1)
@@ -17055,7 +15899,7 @@ class SeedService {
17055
15899
  }
17056
15900
  lastError = error instanceof Error ? error : new Error(String(error));
17057
15901
  if (attempt < MAX_RETRIES - 1) {
17058
- logger22.debug("Network error, will retry", {
15902
+ logger21.debug("Network error, will retry", {
17059
15903
  error: lastError.message,
17060
15904
  attempt: attempt + 1
17061
15905
  });
@@ -17068,19 +15912,19 @@ class SeedService {
17068
15912
  async cleanupSeedWorker(cf, seedDeploymentId) {
17069
15913
  try {
17070
15914
  await cf.delete(seedDeploymentId);
17071
- logger22.info("Worker deleted", { seedDeploymentId });
15915
+ logger21.info("Worker deleted", { seedDeploymentId });
17072
15916
  } catch (error) {
17073
- logger22.warn("Failed to cleanup worker", { seedDeploymentId, error });
15917
+ logger21.warn("Failed to cleanup worker", { seedDeploymentId, error });
17074
15918
  }
17075
15919
  }
17076
15920
  }
17077
- var logger22;
15921
+ var logger21;
17078
15922
  var init_seed_service = __esm(() => {
17079
15923
  init_src2();
17080
15924
  init_config2();
17081
15925
  init_errors();
17082
15926
  init_deployment_util();
17083
- logger22 = log.scope("SeedService");
15927
+ logger21 = log.scope("SeedService");
17084
15928
  });
17085
15929
 
17086
15930
  // ../api-core/src/services/session.service.ts
@@ -17115,10 +15959,10 @@ class SessionService {
17115
15959
  };
17116
15960
  const [newSession] = await db2.insert(gameSessions).values(sessionToInsert).returning({ sessionId: gameSessions.id });
17117
15961
  if (!newSession?.sessionId) {
17118
- logger23.error("Game session insert returned no rows", { userId, gameId });
15962
+ logger22.error("Game session insert returned no rows", { userId, gameId });
17119
15963
  throw new InternalError("Failed to create game session");
17120
15964
  }
17121
- logger23.info("Started new session", {
15965
+ logger22.info("Started new session", {
17122
15966
  sessionId: newSession.sessionId,
17123
15967
  gameId,
17124
15968
  userId
@@ -17139,23 +15983,23 @@ class SessionService {
17139
15983
  return { success: true, message: "Session already ended" };
17140
15984
  }
17141
15985
  await db2.update(gameSessions).set({ endedAt: new Date }).where(eq(gameSessions.id, sessionId));
17142
- logger23.info("Ended session", { sessionId, gameId, userId });
15986
+ logger22.info("Ended session", { sessionId, gameId, userId });
17143
15987
  return { success: true };
17144
15988
  }
17145
15989
  async mintToken(gameIdOrSlug, userId) {
17146
15990
  const gameId = await this.resolveGameId(gameIdOrSlug);
17147
15991
  const result = await this.ctx.providers.auth.mintGameToken(gameId, userId);
17148
- logger23.debug("Minted game token", { gameId, userId });
15992
+ logger22.debug("Minted game token", { gameId, userId });
17149
15993
  return result;
17150
15994
  }
17151
15995
  }
17152
- var logger23;
15996
+ var logger22;
17153
15997
  var init_session_service = __esm(() => {
17154
15998
  init_drizzle_orm();
17155
15999
  init_tables_index();
17156
16000
  init_src2();
17157
16001
  init_errors();
17158
- logger23 = log.scope("SessionService");
16002
+ logger22 = log.scope("SessionService");
17159
16003
  });
17160
16004
 
17161
16005
  // ../api-core/src/services/shop-listing.service.ts
@@ -17167,7 +16011,7 @@ class ShopListingService {
17167
16011
  async list() {
17168
16012
  const db2 = this.ctx.db;
17169
16013
  const allListings = await db2.query.shopListings.findMany();
17170
- logger24.debug("Listed shop listings", { count: allListings.length });
16014
+ logger23.debug("Listed shop listings", { count: allListings.length });
17171
16015
  return allListings;
17172
16016
  }
17173
16017
  async getById(listingId) {
@@ -17178,7 +16022,7 @@ class ShopListingService {
17178
16022
  if (!listing) {
17179
16023
  throw new NotFoundError("ShopListing", listingId);
17180
16024
  }
17181
- logger24.debug("Retrieved listing", { listingId });
16025
+ logger23.debug("Retrieved listing", { listingId });
17182
16026
  return listing;
17183
16027
  }
17184
16028
  async create(data) {
@@ -17189,13 +16033,13 @@ class ShopListingService {
17189
16033
  price: data.price
17190
16034
  }).returning();
17191
16035
  if (!newListing) {
17192
- logger24.error("Shop listing insert returned no rows", {
16036
+ logger23.error("Shop listing insert returned no rows", {
17193
16037
  itemId: data.itemId,
17194
16038
  currencyId: data.currencyId
17195
16039
  });
17196
16040
  throw new InternalError("Failed to create shop listing");
17197
16041
  }
17198
- logger24.info("Created listing", {
16042
+ logger23.info("Created listing", {
17199
16043
  listingId: newListing.id,
17200
16044
  itemId: newListing.itemId,
17201
16045
  currencyId: newListing.currencyId,
@@ -17238,7 +16082,7 @@ class ShopListingService {
17238
16082
  if (!updatedListing) {
17239
16083
  throw new NotFoundError("ShopListing", listingId);
17240
16084
  }
17241
- logger24.info("Updated listing", {
16085
+ logger23.info("Updated listing", {
17242
16086
  listingId: updatedListing.id,
17243
16087
  updatedFields: Object.keys(updateData)
17244
16088
  });
@@ -17268,7 +16112,7 @@ class ShopListingService {
17268
16112
  if (result.length === 0) {
17269
16113
  throw new NotFoundError("ShopListing", listingId);
17270
16114
  }
17271
- logger24.info("Deleted listing", { listingId });
16115
+ logger23.info("Deleted listing", { listingId });
17272
16116
  }
17273
16117
  async listByGame(gameId, user) {
17274
16118
  await this.ctx.services.game.validateOwnership(user, gameId);
@@ -17286,7 +16130,7 @@ class ShopListingService {
17286
16130
  item: true
17287
16131
  }
17288
16132
  });
17289
- logger24.debug("Listed game listings", {
16133
+ logger23.debug("Listed game listings", {
17290
16134
  gameId,
17291
16135
  count: listings.length
17292
16136
  });
@@ -17316,14 +16160,14 @@ class ShopListingService {
17316
16160
  currencyId: currency.id
17317
16161
  }).returning();
17318
16162
  if (!newListing) {
17319
- logger24.error("Game item listing insert returned no rows", {
16163
+ logger23.error("Game item listing insert returned no rows", {
17320
16164
  gameId,
17321
16165
  itemId,
17322
16166
  currencyId: currency.id
17323
16167
  });
17324
16168
  throw new InternalError("Failed to create shop listing");
17325
16169
  }
17326
- logger24.info("Created game item listing", {
16170
+ logger23.info("Created game item listing", {
17327
16171
  listingId: newListing.id,
17328
16172
  gameId,
17329
16173
  itemId,
@@ -17364,7 +16208,7 @@ class ShopListingService {
17364
16208
  if (!updatedListing) {
17365
16209
  throw new NotFoundError("ShopListing", `for item ${itemId}`);
17366
16210
  }
17367
- logger24.info("Updated game item listing", {
16211
+ logger23.info("Updated game item listing", {
17368
16212
  listingId: updatedListing.id,
17369
16213
  gameId,
17370
16214
  itemId,
@@ -17389,7 +16233,7 @@ class ShopListingService {
17389
16233
  if (result.length === 0) {
17390
16234
  throw new NotFoundError("ShopListing", `for item ${itemId}`);
17391
16235
  }
17392
- logger24.info("Deleted game item listing", {
16236
+ logger23.info("Deleted game item listing", {
17393
16237
  listingId: result[0].id,
17394
16238
  gameId,
17395
16239
  itemId
@@ -17406,13 +16250,13 @@ class ShopListingService {
17406
16250
  }
17407
16251
  }
17408
16252
  }
17409
- var logger24;
16253
+ var logger23;
17410
16254
  var init_shop_listing_service = __esm(() => {
17411
16255
  init_drizzle_orm();
17412
16256
  init_tables_index();
17413
16257
  init_src2();
17414
16258
  init_errors();
17415
- logger24 = log.scope("ShopListingService");
16259
+ logger23 = log.scope("ShopListingService");
17416
16260
  });
17417
16261
 
17418
16262
  // ../api-core/src/services/shop.service.ts
@@ -17458,7 +16302,7 @@ class ShopService {
17458
16302
  const shopItems = [];
17459
16303
  for (const listing of listingsWithRelations) {
17460
16304
  if (!listing.item || !listing.currency) {
17461
- logger25.warn("Listing missing item or currency, skipping", {
16305
+ logger24.warn("Listing missing item or currency, skipping", {
17462
16306
  listingId: listing.id
17463
16307
  });
17464
16308
  continue;
@@ -17475,7 +16319,7 @@ class ShopService {
17475
16319
  sellBackPercentage: listing.sellBackPercentage
17476
16320
  });
17477
16321
  }
17478
- logger25.debug("Retrieved shop view", {
16322
+ logger24.debug("Retrieved shop view", {
17479
16323
  userId: user.id,
17480
16324
  itemCount: shopItems.length,
17481
16325
  currencyCount: shopCurrencies.length
@@ -17486,12 +16330,12 @@ class ShopService {
17486
16330
  };
17487
16331
  }
17488
16332
  }
17489
- var logger25;
16333
+ var logger24;
17490
16334
  var init_shop_service = __esm(() => {
17491
16335
  init_drizzle_orm();
17492
16336
  init_tables_index();
17493
16337
  init_src2();
17494
- logger25 = log.scope("ShopService");
16338
+ logger24 = log.scope("ShopService");
17495
16339
  });
17496
16340
 
17497
16341
  // ../api-core/src/services/sprite.service.ts
@@ -17508,17 +16352,17 @@ class SpriteService {
17508
16352
  if (!template) {
17509
16353
  throw new NotFoundError("SpriteTemplate", slug2);
17510
16354
  }
17511
- logger26.debug("Retrieved sprite", { slug: slug2 });
16355
+ logger25.debug("Retrieved sprite", { slug: slug2 });
17512
16356
  return template;
17513
16357
  }
17514
16358
  }
17515
- var logger26;
16359
+ var logger25;
17516
16360
  var init_sprite_service = __esm(() => {
17517
16361
  init_drizzle_orm();
17518
16362
  init_tables_index();
17519
16363
  init_src2();
17520
16364
  init_errors();
17521
- logger26 = log.scope("SpriteService");
16365
+ logger25 = log.scope("SpriteService");
17522
16366
  });
17523
16367
 
17524
16368
  // ../timeback/dist/types.js
@@ -17961,7 +16805,7 @@ class TimebackService {
17961
16805
  }
17962
16806
  requireClient() {
17963
16807
  if (!this.ctx.timeback) {
17964
- logger27.error("Timeback client not available in context");
16808
+ logger26.error("Timeback client not available in context");
17965
16809
  throw new ValidationError("Timeback integration not available in this environment");
17966
16810
  }
17967
16811
  return this.ctx.timeback;
@@ -18014,7 +16858,7 @@ class TimebackService {
18014
16858
  set: { xp: sql`excluded.xp`, updatedAt: new Date }
18015
16859
  }).returning({ xp: timebackDailyXp.xp, date: timebackDailyXp.date });
18016
16860
  if (!result) {
18017
- logger27.error("Daily XP upsert returned no rows", { userId, date: targetDate });
16861
+ logger26.error("Daily XP upsert returned no rows", { userId, date: targetDate });
18018
16862
  throw new InternalError("Failed to update daily XP record");
18019
16863
  }
18020
16864
  return { xp: result.xp, date: result.date.toISOString() };
@@ -18045,7 +16889,7 @@ class TimebackService {
18045
16889
  columns: { id: true, timebackId: true }
18046
16890
  });
18047
16891
  if (dbUser?.timebackId) {
18048
- logger27.info("Student already onboarded", { userId: user.id });
16892
+ logger26.info("Student already onboarded", { userId: user.id });
18049
16893
  return { status: "already_populated" };
18050
16894
  }
18051
16895
  let timebackId;
@@ -18054,7 +16898,7 @@ class TimebackService {
18054
16898
  const existingUser = await client.oneroster.users.findByEmail(user.email);
18055
16899
  timebackId = existingUser.sourcedId;
18056
16900
  name3 = `${existingUser.givenName} ${existingUser.familyName}`;
18057
- logger27.info("Found existing student in OneRoster", {
16901
+ logger26.info("Found existing student in OneRoster", {
18058
16902
  userId: user.id,
18059
16903
  timebackId
18060
16904
  });
@@ -18083,7 +16927,7 @@ class TimebackService {
18083
16927
  }
18084
16928
  timebackId = response.sourcedIdPairs.allocatedSourcedId;
18085
16929
  name3 = `${providedNames.firstName} ${providedNames.lastName}`;
18086
- logger27.info("Created student in OneRoster", { userId: user.id, timebackId });
16930
+ logger26.info("Created student in OneRoster", { userId: user.id, timebackId });
18087
16931
  }
18088
16932
  const assessments = await this.fetchAssessments(timebackId);
18089
16933
  await db2.transaction(async (tx) => {
@@ -18117,7 +16961,7 @@ class TimebackService {
18117
16961
  }
18118
16962
  const [updated] = await tx.update(users).set({ timebackId, name: name3 }).where(eq(users.id, user.id)).returning({ id: users.id });
18119
16963
  if (!updated) {
18120
- logger27.error("User Timeback ID update returned no rows", {
16964
+ logger26.error("User Timeback ID update returned no rows", {
18121
16965
  userId: user.id,
18122
16966
  timebackId
18123
16967
  });
@@ -18140,13 +16984,13 @@ class TimebackService {
18140
16984
  break;
18141
16985
  offset += limit;
18142
16986
  }
18143
- logger27.debug("Fetched assessments", {
16987
+ logger26.debug("Fetched assessments", {
18144
16988
  studentSourcedId,
18145
16989
  totalCount: allAssessments.length
18146
16990
  });
18147
16991
  return allAssessments;
18148
16992
  } catch (error) {
18149
- logger27.warn("Failed to fetch assessments", { studentSourcedId, error });
16993
+ logger26.warn("Failed to fetch assessments", { studentSourcedId, error });
18150
16994
  return [];
18151
16995
  }
18152
16996
  }
@@ -18231,11 +17075,11 @@ class TimebackService {
18231
17075
  return [];
18232
17076
  }
18233
17077
  }
18234
- async setupIntegration(gameId, request2, user) {
17078
+ async setupIntegration(gameId, request, user) {
18235
17079
  const client = this.requireClient();
18236
17080
  const db2 = this.ctx.db;
18237
17081
  await this.ctx.services.game.validateDeveloperAccess(user, gameId);
18238
- const { courses, baseConfig, verbose } = request2;
17082
+ const { courses, baseConfig, verbose } = request;
18239
17083
  const existing = await db2.query.gameTimebackIntegrations.findMany({
18240
17084
  where: eq(gameTimebackIntegrations.gameId, gameId)
18241
17085
  });
@@ -18253,7 +17097,7 @@ class TimebackService {
18253
17097
  masterableUnits: derivedMasterableUnits
18254
17098
  } = courseConfig;
18255
17099
  if (!isTimebackSubject(subjectInput)) {
18256
- logger27.warn("Invalid Timeback subject in course config", {
17100
+ logger26.warn("Invalid Timeback subject in course config", {
18257
17101
  subject: subjectInput,
18258
17102
  courseCode,
18259
17103
  title
@@ -18261,7 +17105,7 @@ class TimebackService {
18261
17105
  throw new ValidationError(`Invalid subject "${subjectInput}"`);
18262
17106
  }
18263
17107
  if (!isTimebackGrade(grade)) {
18264
- logger27.warn("Invalid Timeback grade in course config", {
17108
+ logger26.warn("Invalid Timeback grade in course config", {
18265
17109
  grade,
18266
17110
  courseCode,
18267
17111
  title
@@ -18273,7 +17117,7 @@ class TimebackService {
18273
17117
  const totalXp = derivedTotalXp ?? courseMetadata?.metrics?.totalXp;
18274
17118
  const masterableUnits = derivedMasterableUnits ?? (isPlaycademyResourceMetadata(courseMetadata?.playcademy) ? courseMetadata?.playcademy?.mastery?.masterableUnits : undefined);
18275
17119
  if (typeof totalXp !== "number") {
18276
- logger27.warn("Course missing totalXp in Timeback config", {
17120
+ logger26.warn("Course missing totalXp in Timeback config", {
18277
17121
  courseCode,
18278
17122
  title
18279
17123
  });
@@ -18444,7 +17288,7 @@ class TimebackService {
18444
17288
  courseName: activityData.courseName,
18445
17289
  studentEmail: activityData.studentEmail
18446
17290
  });
18447
- logger27.info("Recorded activity completion", {
17291
+ logger26.info("Recorded activity completion", {
18448
17292
  gameId,
18449
17293
  courseId: integration.courseId,
18450
17294
  studentId,
@@ -18461,7 +17305,7 @@ class TimebackService {
18461
17305
  };
18462
17306
  }
18463
17307
  }
18464
- var logger27;
17308
+ var logger26;
18465
17309
  var init_timeback_service = __esm(() => {
18466
17310
  init_drizzle_orm();
18467
17311
  init_src();
@@ -18471,7 +17315,7 @@ var init_timeback_service = __esm(() => {
18471
17315
  init_src4();
18472
17316
  init_errors();
18473
17317
  init_timeback_util();
18474
- logger27 = log.scope("TimebackService");
17318
+ logger26 = log.scope("TimebackService");
18475
17319
  });
18476
17320
 
18477
17321
  // ../api-core/src/services/upload.service.ts
@@ -18480,19 +17324,19 @@ class UploadService {
18480
17324
  constructor(ctx) {
18481
17325
  this.ctx = ctx;
18482
17326
  }
18483
- async initiate(request2, user) {
18484
- const { fileName, gameId } = request2;
17327
+ async initiate(request, user) {
17328
+ const { fileName, gameId } = request;
18485
17329
  const bucketName = this.ctx.config.uploadBucket;
18486
17330
  if (!bucketName) {
18487
- logger28.error("Upload bucket not configured in environment");
17331
+ logger27.error("Upload bucket not configured in environment");
18488
17332
  throw new ValidationError("Upload bucket not configured");
18489
17333
  }
18490
17334
  await this.ctx.services.game.validateDeveloperAccess(user, gameId);
18491
17335
  const version2 = ulid();
18492
17336
  const tempS3Key = `uploads-temp/${gameId}/${version2}/${fileName}`;
18493
- logger28.debug("Initiating upload", { userId: user.id, gameId, fileName, version: version2 });
17337
+ logger27.debug("Initiating upload", { userId: user.id, gameId, fileName, version: version2 });
18494
17338
  const presignedUrl = await this.ctx.providers.storage.generatePresignedPutUrl(bucketName, tempS3Key, "application/zip");
18495
- logger28.info("Presigned URL generated", {
17339
+ logger27.info("Presigned URL generated", {
18496
17340
  userId: user.id,
18497
17341
  gameId,
18498
17342
  version: version2
@@ -18505,12 +17349,12 @@ class UploadService {
18505
17349
  };
18506
17350
  }
18507
17351
  }
18508
- var logger28;
17352
+ var logger27;
18509
17353
  var init_upload_service = __esm(() => {
18510
17354
  init_node();
18511
17355
  init_src2();
18512
17356
  init_errors();
18513
- logger28 = log.scope("UploadService");
17357
+ logger27 = log.scope("UploadService");
18514
17358
  });
18515
17359
 
18516
17360
  // ../api-core/src/services/user.service.ts
@@ -18525,12 +17369,12 @@ class UserService {
18525
17369
  where: eq(users.id, user.id)
18526
17370
  });
18527
17371
  if (!userData) {
18528
- logger29.error("User not found", { userId: user.id });
17372
+ logger28.error("User not found", { userId: user.id });
18529
17373
  throw new NotFoundError("User", user.id);
18530
17374
  }
18531
17375
  const timeback2 = userData.timebackId ? await this.fetchTimebackData(userData.timebackId, gameId) : undefined;
18532
17376
  if (gameId) {
18533
- logger29.debug("Fetched user profile (game context)", { userId: user.id, gameId });
17377
+ logger28.debug("Fetched user profile (game context)", { userId: user.id, gameId });
18534
17378
  return {
18535
17379
  id: userData.id,
18536
17380
  name: userData.name,
@@ -18543,7 +17387,7 @@ class UserService {
18543
17387
  const timebackAccount = await db2.query.accounts.findFirst({
18544
17388
  where: and(eq(accounts.userId, user.id), eq(accounts.providerId, "timeback"))
18545
17389
  });
18546
- logger29.debug("Fetched user profile (platform context)", { userId: user.id });
17390
+ logger28.debug("Fetched user profile (platform context)", { userId: user.id });
18547
17391
  return {
18548
17392
  id: userData.id,
18549
17393
  name: userData.name,
@@ -18567,7 +17411,7 @@ class UserService {
18567
17411
  ]);
18568
17412
  const enrollments = gameId ? this.filterEnrollmentsByGame(allEnrollments, gameId) : allEnrollments;
18569
17413
  const organizations = gameId ? this.filterOrganizationsByEnrollments(allOrganizations, enrollments) : allOrganizations;
18570
- logger29.debug("Fetched Timeback data", {
17414
+ logger28.debug("Fetched Timeback data", {
18571
17415
  timebackId,
18572
17416
  role,
18573
17417
  enrollmentCount: enrollments.length,
@@ -18576,9 +17420,9 @@ class UserService {
18576
17420
  return { id: timebackId, role, enrollments, organizations };
18577
17421
  }
18578
17422
  async fetchStudentProfile(timebackId) {
18579
- logger29.debug("Fetching student profile", { timebackId });
17423
+ logger28.debug("Fetching student profile", { timebackId });
18580
17424
  if (!this.ctx.timeback) {
18581
- logger29.warn("Timeback client not available");
17425
+ logger28.warn("Timeback client not available");
18582
17426
  return { role: "student", organizations: [] };
18583
17427
  }
18584
17428
  try {
@@ -18606,14 +17450,14 @@ class UserService {
18606
17450
  }
18607
17451
  return { role, organizations: Array.from(orgMap.values()) };
18608
17452
  } catch (error) {
18609
- logger29.warn("Failed to fetch student profile", { error, timebackId });
17453
+ logger28.warn("Failed to fetch student profile", { error, timebackId });
18610
17454
  return { role: "student", organizations: [] };
18611
17455
  }
18612
17456
  }
18613
17457
  async fetchEnrollments(timebackId) {
18614
- logger29.debug("Fetching enrollments", { timebackId });
17458
+ logger28.debug("Fetching enrollments", { timebackId });
18615
17459
  if (!this.ctx.timeback) {
18616
- logger29.warn("Timeback client not available");
17460
+ logger28.warn("Timeback client not available");
18617
17461
  return [];
18618
17462
  }
18619
17463
  try {
@@ -18633,7 +17477,7 @@ class UserService {
18633
17477
  orgId: courseToSchool.get(i2.courseId)
18634
17478
  }));
18635
17479
  } catch (error) {
18636
- logger29.warn("Failed to fetch enrollments", { error, timebackId });
17480
+ logger28.warn("Failed to fetch enrollments", { error, timebackId });
18637
17481
  return [];
18638
17482
  }
18639
17483
  }
@@ -18647,13 +17491,13 @@ class UserService {
18647
17491
  return organizations.filter((o) => enrollmentOrgIds.has(o.id));
18648
17492
  }
18649
17493
  }
18650
- var logger29;
17494
+ var logger28;
18651
17495
  var init_user_service = __esm(() => {
18652
17496
  init_drizzle_orm();
18653
17497
  init_tables_index();
18654
17498
  init_src2();
18655
17499
  init_errors();
18656
- logger29 = log.scope("UserService");
17500
+ logger28 = log.scope("UserService");
18657
17501
  });
18658
17502
 
18659
17503
  // ../api-core/src/services/verify.service.ts
@@ -18663,16 +17507,16 @@ class VerifyService {
18663
17507
  this.ctx = ctx;
18664
17508
  }
18665
17509
  async verifyGameToken(token) {
18666
- logger30.debug("Verifying game token");
17510
+ logger29.debug("Verifying game token");
18667
17511
  const payload = await this.ctx.providers.auth.validateGameToken(token);
18668
17512
  if (!payload) {
18669
- logger30.warn("Invalid or expired game token presented");
17513
+ logger29.warn("Invalid or expired game token presented");
18670
17514
  throw new ValidationError("Invalid or expired token");
18671
17515
  }
18672
17516
  const gameId = payload.sub;
18673
17517
  const userId = payload.uid;
18674
17518
  if (typeof gameId !== "string" || typeof userId !== "string") {
18675
- logger30.warn("Game token missing required claims", {
17519
+ logger29.warn("Game token missing required claims", {
18676
17520
  hasGameId: typeof gameId === "string",
18677
17521
  hasUserId: typeof userId === "string"
18678
17522
  });
@@ -18683,7 +17527,7 @@ class VerifyService {
18683
17527
  where: eq(users.id, userId)
18684
17528
  });
18685
17529
  if (!userData) {
18686
- logger30.error("User not found for valid token", {
17530
+ logger29.error("User not found for valid token", {
18687
17531
  userId
18688
17532
  });
18689
17533
  throw new NotFoundError("User", userId);
@@ -18697,7 +17541,7 @@ class VerifyService {
18697
17541
  family_name: undefined,
18698
17542
  timeback_id: userData.timebackId || undefined
18699
17543
  };
18700
- logger30.info("Token verified", { gameId, userId });
17544
+ logger29.info("Token verified", { gameId, userId });
18701
17545
  return {
18702
17546
  claims: payload,
18703
17547
  gameId,
@@ -18705,13 +17549,13 @@ class VerifyService {
18705
17549
  };
18706
17550
  }
18707
17551
  }
18708
- var logger30;
17552
+ var logger29;
18709
17553
  var init_verify_service = __esm(() => {
18710
17554
  init_drizzle_orm();
18711
17555
  init_tables_index();
18712
17556
  init_src2();
18713
17557
  init_errors();
18714
- logger30 = log.scope("VerifyService");
17558
+ logger29 = log.scope("VerifyService");
18715
17559
  });
18716
17560
 
18717
17561
  // ../api-core/src/services/index.ts
@@ -18947,35 +17791,6 @@ var init_cache_provider = __esm(() => {
18947
17791
  gameOrigins = [];
18948
17792
  });
18949
17793
 
18950
- // src/infrastructure/api/providers/secrets.provider.ts
18951
- function createSandboxSecretsProvider() {
18952
- return {
18953
- async readSecrets(gameId) {
18954
- const secrets = secretsStorage.get(gameId);
18955
- return secrets ?? null;
18956
- },
18957
- async writeSecrets(gameId, secrets) {
18958
- secretsStorage.set(gameId, { ...secrets });
18959
- log.debug("[SandboxSecretsProvider] Stored secrets", {
18960
- gameId,
18961
- keyCount: Object.keys(secrets).length
18962
- });
18963
- },
18964
- async deleteSecrets(gameId) {
18965
- secretsStorage.delete(gameId);
18966
- log.debug("[SandboxSecretsProvider] Deleted secrets", { gameId });
18967
- }
18968
- };
18969
- }
18970
- function clearSandboxSecrets() {
18971
- secretsStorage.clear();
18972
- }
18973
- var secretsStorage;
18974
- var init_secrets_provider = __esm(() => {
18975
- init_src2();
18976
- secretsStorage = new Map;
18977
- });
18978
-
18979
17794
  // src/infrastructure/api/providers/storage.provider.ts
18980
17795
  function getBucket(bucketName) {
18981
17796
  let bucket = storage.get(bucketName);
@@ -19050,7 +17865,6 @@ var init_storage_provider = __esm(() => {
19050
17865
  var init_providers = __esm(() => {
19051
17866
  init_auth_provider();
19052
17867
  init_cache_provider();
19053
- init_secrets_provider();
19054
17868
  init_storage_provider();
19055
17869
  });
19056
17870
 
@@ -19069,7 +17883,6 @@ function buildProviders() {
19069
17883
  return {
19070
17884
  auth: createSandboxAuthProvider(),
19071
17885
  storage: createSandboxStorageProvider(),
19072
- secrets: createSandboxSecretsProvider(),
19073
17886
  cache: createSandboxCacheProvider()
19074
17887
  };
19075
17888
  }
@@ -19210,8 +18023,8 @@ var init_constants3 = __esm(() => {
19210
18023
  });
19211
18024
 
19212
18025
  // ../../node_modules/hono/dist/utils/body.js
19213
- async function parseFormData(request2, options) {
19214
- const formData = await request2.formData();
18026
+ async function parseFormData(request, options) {
18027
+ const formData = await request.formData();
19215
18028
  if (formData) {
19216
18029
  return convertFormDataToBodyData(formData, options);
19217
18030
  }
@@ -19238,12 +18051,12 @@ function convertFormDataToBodyData(formData, options) {
19238
18051
  }
19239
18052
  return form;
19240
18053
  }
19241
- var parseBody = async (request2, options = /* @__PURE__ */ Object.create(null)) => {
18054
+ var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
19242
18055
  const { all = false, dot = false } = options;
19243
- const headers = request2 instanceof HonoRequest ? request2.raw.headers : request2.headers;
18056
+ const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
19244
18057
  const contentType = headers.get("Content-Type");
19245
18058
  if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) {
19246
- return parseFormData(request2, { all, dot });
18059
+ return parseFormData(request, { all, dot });
19247
18060
  }
19248
18061
  return {};
19249
18062
  }, handleParsingAllValues = (form, key, value) => {
@@ -19337,8 +18150,8 @@ var splitPath = (path) => {
19337
18150
  }
19338
18151
  });
19339
18152
  }
19340
- }, tryDecodeURI = (str) => tryDecode(str, decodeURI), getPath = (request2) => {
19341
- const url = request2.url;
18153
+ }, tryDecodeURI = (str) => tryDecode(str, decodeURI), getPath = (request) => {
18154
+ const url = request.url;
19342
18155
  const start2 = url.indexOf("/", url.indexOf(":") + 4);
19343
18156
  let i2 = start2;
19344
18157
  for (;i2 < url.length; i2++) {
@@ -19352,8 +18165,8 @@ var splitPath = (path) => {
19352
18165
  }
19353
18166
  }
19354
18167
  return url.slice(start2, i2);
19355
- }, getPathNoStrict = (request2) => {
19356
- const result = getPath(request2);
18168
+ }, getPathNoStrict = (request) => {
18169
+ const result = getPath(request);
19357
18170
  return result.length > 1 && result.at(-1) === "/" ? result.slice(0, -1) : result;
19358
18171
  }, mergePath = (base, sub, ...rest) => {
19359
18172
  if (rest.length) {
@@ -19479,8 +18292,8 @@ var init_request = __esm(() => {
19479
18292
  routeIndex = 0;
19480
18293
  path;
19481
18294
  bodyCache = {};
19482
- constructor(request2, path = "/", matchResult = [[]]) {
19483
- this.raw = request2;
18295
+ constructor(request, path = "/", matchResult = [[]]) {
18296
+ this.raw = request;
19484
18297
  this.path = path;
19485
18298
  this.#matchResult = matchResult;
19486
18299
  this.#validatedData = {};
@@ -19916,7 +18729,7 @@ var notFoundHandler = (c) => {
19916
18729
  } else {
19917
18730
  optionHandler = options.optionHandler;
19918
18731
  if (options.replaceRequest === false) {
19919
- replaceRequest = (request2) => request2;
18732
+ replaceRequest = (request) => request;
19920
18733
  } else {
19921
18734
  replaceRequest = options.replaceRequest;
19922
18735
  }
@@ -19935,10 +18748,10 @@ var notFoundHandler = (c) => {
19935
18748
  replaceRequest ||= (() => {
19936
18749
  const mergedPath = mergePath(this._basePath, path);
19937
18750
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
19938
- return (request2) => {
19939
- const url = new URL(request2.url);
18751
+ return (request) => {
18752
+ const url = new URL(request.url);
19940
18753
  url.pathname = url.pathname.slice(pathPrefixLength) || "/";
19941
- return new Request(url, request2);
18754
+ return new Request(url, request);
19942
18755
  };
19943
18756
  })();
19944
18757
  const handler = async (c, next) => {
@@ -19964,13 +18777,13 @@ var notFoundHandler = (c) => {
19964
18777
  }
19965
18778
  throw err2;
19966
18779
  }
19967
- #dispatch(request2, executionCtx, env, method) {
18780
+ #dispatch(request, executionCtx, env, method) {
19968
18781
  if (method === "HEAD") {
19969
- return (async () => new Response(null, await this.#dispatch(request2, executionCtx, env, "GET")))();
18782
+ return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
19970
18783
  }
19971
- const path = this.getPath(request2, { env });
18784
+ const path = this.getPath(request, { env });
19972
18785
  const matchResult = this.router.match(method, path);
19973
- const c = new Context(request2, {
18786
+ const c = new Context(request, {
19974
18787
  path,
19975
18788
  matchResult,
19976
18789
  env,
@@ -20001,8 +18814,8 @@ var notFoundHandler = (c) => {
20001
18814
  }
20002
18815
  })();
20003
18816
  }
20004
- fetch = (request2, ...rest) => {
20005
- return this.#dispatch(request2, rest[1], rest[0], request2.method);
18817
+ fetch = (request, ...rest) => {
18818
+ return this.#dispatch(request, rest[1], rest[0], request.method);
20006
18819
  };
20007
18820
  request = (input, requestInit, Env, executionCtx) => {
20008
18821
  if (input instanceof Request) {
@@ -20874,7 +19687,7 @@ var humanize = (times) => {
20874
19687
  }
20875
19688
  }
20876
19689
  return `${status}`;
20877
- }, logger31 = (fn = console.log) => {
19690
+ }, logger30 = (fn = console.log) => {
20878
19691
  return async function logger2(c, next) {
20879
19692
  const { method, url } = c.req;
20880
19693
  const path = url.slice(url.indexOf("/", 8));
@@ -21051,7 +19864,7 @@ function createApp(db2, options) {
21051
19864
  const app = new Hono2;
21052
19865
  app.use("*", cors({ origin: "*", credentials: true }));
21053
19866
  if (options.verbose && !options.quiet) {
21054
- app.use("*", logger31());
19867
+ app.use("*", logger30());
21055
19868
  }
21056
19869
  app.use("/api/*", async (c, next) => {
21057
19870
  c.set("db", db2);
@@ -27524,12 +26337,12 @@ var init_session2 = __esm(() => {
27524
26337
  init_utils();
27525
26338
  init_dist4();
27526
26339
  PglitePreparedQuery = class PglitePreparedQuery extends PgPreparedQuery {
27527
- constructor(client, queryString, params, logger32, fields, name3, _isResponseInArrayMode, customResultMapper) {
26340
+ constructor(client, queryString, params, logger31, fields, name3, _isResponseInArrayMode, customResultMapper) {
27528
26341
  super({ sql: queryString, params });
27529
26342
  this.client = client;
27530
26343
  this.queryString = queryString;
27531
26344
  this.params = params;
27532
- this.logger = logger32;
26345
+ this.logger = logger31;
27533
26346
  this.fields = fields;
27534
26347
  this._isResponseInArrayMode = _isResponseInArrayMode;
27535
26348
  this.customResultMapper = customResultMapper;
@@ -27633,11 +26446,11 @@ var init_session2 = __esm(() => {
27633
26446
  // ../../node_modules/drizzle-orm/pglite/driver.js
27634
26447
  function construct(client, config2 = {}) {
27635
26448
  const dialect2 = new PgDialect({ casing: config2.casing });
27636
- let logger32;
26449
+ let logger31;
27637
26450
  if (config2.logger === true) {
27638
- logger32 = new DefaultLogger;
26451
+ logger31 = new DefaultLogger;
27639
26452
  } else if (config2.logger !== false) {
27640
- logger32 = config2.logger;
26453
+ logger31 = config2.logger;
27641
26454
  }
27642
26455
  let schema2;
27643
26456
  if (config2.schema) {
@@ -27648,7 +26461,7 @@ function construct(client, config2 = {}) {
27648
26461
  tableNamesMap: tablesConfig.tableNamesMap
27649
26462
  };
27650
26463
  }
27651
- const driver = new PgliteDriver(client, dialect2, { logger: logger32 });
26464
+ const driver = new PgliteDriver(client, dialect2, { logger: logger31 });
27652
26465
  const session2 = driver.createSession(schema2);
27653
26466
  const db2 = new PgliteDatabase(dialect2, session2, schema2);
27654
26467
  db2.$client = client;
@@ -28445,24 +27258,24 @@ is not a problem with esbuild. You need to fix your environment instead.
28445
27258
  throw new Error("The service is no longer running" + closeData.reason);
28446
27259
  streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
28447
27260
  };
28448
- let handleRequest = async (id, request2) => {
27261
+ let handleRequest = async (id, request) => {
28449
27262
  try {
28450
- if (request2.command === "ping") {
27263
+ if (request.command === "ping") {
28451
27264
  sendResponse(id, {});
28452
27265
  return;
28453
27266
  }
28454
- if (typeof request2.key === "number") {
28455
- const requestCallbacks = requestCallbacksByKey[request2.key];
27267
+ if (typeof request.key === "number") {
27268
+ const requestCallbacks = requestCallbacksByKey[request.key];
28456
27269
  if (!requestCallbacks) {
28457
27270
  return;
28458
27271
  }
28459
- const callback = requestCallbacks[request2.command];
27272
+ const callback = requestCallbacks[request.command];
28460
27273
  if (callback) {
28461
- await callback(id, request2);
27274
+ await callback(id, request);
28462
27275
  return;
28463
27276
  }
28464
27277
  }
28465
- throw new Error(`Invalid command: ` + request2.command);
27278
+ throw new Error(`Invalid command: ` + request.command);
28466
27279
  } catch (e) {
28467
27280
  const errors3 = [extractErrorMessageV8(e, streamIn, null, undefined, "")];
28468
27281
  try {
@@ -28531,15 +27344,15 @@ is not a problem with esbuild. You need to fix your environment instead.
28531
27344
  flags: flags2,
28532
27345
  mangleCache
28533
27346
  } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
28534
- let request2 = {
27347
+ let request = {
28535
27348
  command: "transform",
28536
27349
  flags: flags2,
28537
27350
  inputFS: inputPath !== null,
28538
27351
  input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
28539
27352
  };
28540
27353
  if (mangleCache)
28541
- request2.mangleCache = mangleCache;
28542
- sendRequest(refs, request2, (error, response) => {
27354
+ request.mangleCache = mangleCache;
27355
+ sendRequest(refs, request, (error, response) => {
28543
27356
  if (error)
28544
27357
  return callback(new Error(error), null);
28545
27358
  let errors3 = replaceDetailsInMessages(response.errors, details);
@@ -28617,16 +27430,16 @@ is not a problem with esbuild. You need to fix your environment instead.
28617
27430
  throw new Error(`Missing "kind" in ${callName}() call`);
28618
27431
  if (kind !== "error" && kind !== "warning")
28619
27432
  throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
28620
- let request2 = {
27433
+ let request = {
28621
27434
  command: "format-msgs",
28622
27435
  messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
28623
27436
  isWarning: kind === "warning"
28624
27437
  };
28625
27438
  if (color !== undefined)
28626
- request2.color = color;
27439
+ request.color = color;
28627
27440
  if (terminalWidth !== undefined)
28628
- request2.terminalWidth = terminalWidth;
28629
- sendRequest(refs, request2, (error, response) => {
27441
+ request.terminalWidth = terminalWidth;
27442
+ sendRequest(refs, request, (error, response) => {
28630
27443
  if (error)
28631
27444
  return callback(new Error(error), null);
28632
27445
  callback(null, response.messages);
@@ -28639,15 +27452,15 @@ is not a problem with esbuild. You need to fix your environment instead.
28639
27452
  let color = getFlag(options, keys, "color", mustBeBoolean);
28640
27453
  let verbose = getFlag(options, keys, "verbose", mustBeBoolean);
28641
27454
  checkForInvalidFlags(options, keys, `in ${callName}() call`);
28642
- let request2 = {
27455
+ let request = {
28643
27456
  command: "analyze-metafile",
28644
27457
  metafile
28645
27458
  };
28646
27459
  if (color !== undefined)
28647
- request2.color = color;
27460
+ request.color = color;
28648
27461
  if (verbose !== undefined)
28649
- request2.verbose = verbose;
28650
- sendRequest(refs, request2, (error, response) => {
27462
+ request.verbose = verbose;
27463
+ sendRequest(refs, request, (error, response) => {
28651
27464
  if (error)
28652
27465
  return callback(new Error(error), null);
28653
27466
  callback(null, response.result);
@@ -28720,7 +27533,7 @@ is not a problem with esbuild. You need to fix your environment instead.
28720
27533
  } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
28721
27534
  if (write && !streamIn.hasFS)
28722
27535
  throw new Error(`The "write" option is unavailable in this environment`);
28723
- const request2 = {
27536
+ const request = {
28724
27537
  command: "build",
28725
27538
  key: buildKey,
28726
27539
  entries,
@@ -28733,9 +27546,9 @@ is not a problem with esbuild. You need to fix your environment instead.
28733
27546
  context: isContext
28734
27547
  };
28735
27548
  if (requestPlugins)
28736
- request2.plugins = requestPlugins;
27549
+ request.plugins = requestPlugins;
28737
27550
  if (mangleCache)
28738
- request2.mangleCache = mangleCache;
27551
+ request.mangleCache = mangleCache;
28739
27552
  const buildResponseToResult = (response, callback2) => {
28740
27553
  const result = {
28741
27554
  errors: replaceDetailsInMessages(response.errors, details),
@@ -28765,8 +27578,8 @@ is not a problem with esbuild. You need to fix your environment instead.
28765
27578
  let latestResultPromise;
28766
27579
  let provideLatestResult;
28767
27580
  if (isContext)
28768
- requestCallbacks["on-end"] = (id, request22) => new Promise((resolve2) => {
28769
- buildResponseToResult(request22, (err2, result, onEndErrors, onEndWarnings) => {
27581
+ requestCallbacks["on-end"] = (id, request2) => new Promise((resolve2) => {
27582
+ buildResponseToResult(request2, (err2, result, onEndErrors, onEndWarnings) => {
28770
27583
  const response = {
28771
27584
  errors: onEndErrors,
28772
27585
  warnings: onEndWarnings
@@ -28779,7 +27592,7 @@ is not a problem with esbuild. You need to fix your environment instead.
28779
27592
  resolve2();
28780
27593
  });
28781
27594
  });
28782
- sendRequest(refs, request2, (error, response) => {
27595
+ sendRequest(refs, request, (error, response) => {
28783
27596
  if (error)
28784
27597
  return callback(new Error(error), null);
28785
27598
  if (!isContext) {
@@ -28802,11 +27615,11 @@ is not a problem with esbuild. You need to fix your environment instead.
28802
27615
  settlePromise = () => err2 ? reject(err2) : resolve2(result2);
28803
27616
  };
28804
27617
  const triggerAnotherBuild = () => {
28805
- const request22 = {
27618
+ const request2 = {
28806
27619
  command: "rebuild",
28807
27620
  key: buildKey
28808
27621
  };
28809
- sendRequest(refs, request22, (error2, response2) => {
27622
+ sendRequest(refs, request2, (error2, response2) => {
28810
27623
  if (error2) {
28811
27624
  reject(new Error(error2));
28812
27625
  } else if (settlePromise) {
@@ -28826,13 +27639,13 @@ is not a problem with esbuild. You need to fix your environment instead.
28826
27639
  const keys = {};
28827
27640
  const delay = getFlag(options2, keys, "delay", mustBeInteger);
28828
27641
  checkForInvalidFlags(options2, keys, `in watch() call`);
28829
- const request22 = {
27642
+ const request2 = {
28830
27643
  command: "watch",
28831
27644
  key: buildKey
28832
27645
  };
28833
27646
  if (delay)
28834
- request22.delay = delay;
28835
- sendRequest(refs, request22, (error2) => {
27647
+ request2.delay = delay;
27648
+ sendRequest(refs, request2, (error2) => {
28836
27649
  if (error2)
28837
27650
  reject(new Error(error2));
28838
27651
  else
@@ -28852,33 +27665,33 @@ is not a problem with esbuild. You need to fix your environment instead.
28852
27665
  const cors2 = getFlag(options2, keys, "cors", mustBeObject);
28853
27666
  const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction);
28854
27667
  checkForInvalidFlags(options2, keys, `in serve() call`);
28855
- const request22 = {
27668
+ const request2 = {
28856
27669
  command: "serve",
28857
27670
  key: buildKey,
28858
27671
  onRequest: !!onRequest
28859
27672
  };
28860
27673
  if (port !== undefined)
28861
- request22.port = port;
27674
+ request2.port = port;
28862
27675
  if (host !== undefined)
28863
- request22.host = host;
27676
+ request2.host = host;
28864
27677
  if (servedir !== undefined)
28865
- request22.servedir = servedir;
27678
+ request2.servedir = servedir;
28866
27679
  if (keyfile !== undefined)
28867
- request22.keyfile = keyfile;
27680
+ request2.keyfile = keyfile;
28868
27681
  if (certfile !== undefined)
28869
- request22.certfile = certfile;
27682
+ request2.certfile = certfile;
28870
27683
  if (fallback !== undefined)
28871
- request22.fallback = fallback;
27684
+ request2.fallback = fallback;
28872
27685
  if (cors2) {
28873
27686
  const corsKeys = {};
28874
27687
  const origin = getFlag(cors2, corsKeys, "origin", mustBeStringOrArrayOfStrings);
28875
27688
  checkForInvalidFlags(cors2, corsKeys, `on "cors" object`);
28876
27689
  if (Array.isArray(origin))
28877
- request22.corsOrigin = origin;
27690
+ request2.corsOrigin = origin;
28878
27691
  else if (origin !== undefined)
28879
- request22.corsOrigin = [origin];
27692
+ request2.corsOrigin = [origin];
28880
27693
  }
28881
- sendRequest(refs, request22, (error2, response2) => {
27694
+ sendRequest(refs, request2, (error2, response2) => {
28882
27695
  if (error2)
28883
27696
  return reject(new Error(error2));
28884
27697
  if (onRequest) {
@@ -28893,11 +27706,11 @@ is not a problem with esbuild. You need to fix your environment instead.
28893
27706
  cancel: () => new Promise((resolve2) => {
28894
27707
  if (didDispose)
28895
27708
  return resolve2();
28896
- const request22 = {
27709
+ const request2 = {
28897
27710
  command: "cancel",
28898
27711
  key: buildKey
28899
27712
  };
28900
- sendRequest(refs, request22, () => {
27713
+ sendRequest(refs, request2, () => {
28901
27714
  resolve2();
28902
27715
  });
28903
27716
  }),
@@ -28905,11 +27718,11 @@ is not a problem with esbuild. You need to fix your environment instead.
28905
27718
  if (didDispose)
28906
27719
  return resolve2();
28907
27720
  didDispose = true;
28908
- const request22 = {
27721
+ const request2 = {
28909
27722
  command: "dispose",
28910
27723
  key: buildKey
28911
27724
  };
28912
- sendRequest(refs, request22, () => {
27725
+ sendRequest(refs, request2, () => {
28913
27726
  resolve2();
28914
27727
  scheduleOnDisposeCallbacks();
28915
27728
  refs.unref();
@@ -28967,29 +27780,29 @@ is not a problem with esbuild. You need to fix your environment instead.
28967
27780
  let importAttributes = getFlag(options, keys2, "with", mustBeObject);
28968
27781
  checkForInvalidFlags(options, keys2, "in resolve() call");
28969
27782
  return new Promise((resolve22, reject) => {
28970
- const request2 = {
27783
+ const request = {
28971
27784
  command: "resolve",
28972
27785
  path: path3,
28973
27786
  key: buildKey,
28974
27787
  pluginName: name3
28975
27788
  };
28976
27789
  if (pluginName != null)
28977
- request2.pluginName = pluginName;
27790
+ request.pluginName = pluginName;
28978
27791
  if (importer != null)
28979
- request2.importer = importer;
27792
+ request.importer = importer;
28980
27793
  if (namespace != null)
28981
- request2.namespace = namespace;
27794
+ request.namespace = namespace;
28982
27795
  if (resolveDir != null)
28983
- request2.resolveDir = resolveDir;
27796
+ request.resolveDir = resolveDir;
28984
27797
  if (kind != null)
28985
- request2.kind = kind;
27798
+ request.kind = kind;
28986
27799
  else
28987
27800
  throw new Error(`Must specify "kind" when calling "resolve"`);
28988
27801
  if (pluginData != null)
28989
- request2.pluginData = details.store(pluginData);
27802
+ request.pluginData = details.store(pluginData);
28990
27803
  if (importAttributes != null)
28991
- request2.with = sanitizeStringMap(importAttributes, "with");
28992
- sendRequest(refs, request2, (error, response) => {
27804
+ request.with = sanitizeStringMap(importAttributes, "with");
27805
+ sendRequest(refs, request, (error, response) => {
28993
27806
  if (error !== null)
28994
27807
  reject(new Error(error));
28995
27808
  else
@@ -29059,7 +27872,7 @@ is not a problem with esbuild. You need to fix your environment instead.
29059
27872
  return { ok: false, error: e, pluginName: name3 };
29060
27873
  }
29061
27874
  }
29062
- requestCallbacks["on-start"] = async (id, request2) => {
27875
+ requestCallbacks["on-start"] = async (id, request) => {
29063
27876
  details.clear();
29064
27877
  let response = { errors: [], warnings: [] };
29065
27878
  await Promise.all(onStartCallbacks.map(async ({ name: name3, callback, note }) => {
@@ -29083,19 +27896,19 @@ is not a problem with esbuild. You need to fix your environment instead.
29083
27896
  }));
29084
27897
  sendResponse(id, response);
29085
27898
  };
29086
- requestCallbacks["on-resolve"] = async (id, request2) => {
27899
+ requestCallbacks["on-resolve"] = async (id, request) => {
29087
27900
  let response = {}, name3 = "", callback, note;
29088
- for (let id2 of request2.ids) {
27901
+ for (let id2 of request.ids) {
29089
27902
  try {
29090
27903
  ({ name: name3, callback, note } = onResolveCallbacks[id2]);
29091
27904
  let result = await callback({
29092
- path: request2.path,
29093
- importer: request2.importer,
29094
- namespace: request2.namespace,
29095
- resolveDir: request2.resolveDir,
29096
- kind: request2.kind,
29097
- pluginData: details.load(request2.pluginData),
29098
- with: request2.with
27905
+ path: request.path,
27906
+ importer: request.importer,
27907
+ namespace: request.namespace,
27908
+ resolveDir: request.resolveDir,
27909
+ kind: request.kind,
27910
+ pluginData: details.load(request.pluginData),
27911
+ with: request.with
29099
27912
  });
29100
27913
  if (result != null) {
29101
27914
  if (typeof result !== "object")
@@ -29145,17 +27958,17 @@ is not a problem with esbuild. You need to fix your environment instead.
29145
27958
  }
29146
27959
  sendResponse(id, response);
29147
27960
  };
29148
- requestCallbacks["on-load"] = async (id, request2) => {
27961
+ requestCallbacks["on-load"] = async (id, request) => {
29149
27962
  let response = {}, name3 = "", callback, note;
29150
- for (let id2 of request2.ids) {
27963
+ for (let id2 of request.ids) {
29151
27964
  try {
29152
27965
  ({ name: name3, callback, note } = onLoadCallbacks[id2]);
29153
27966
  let result = await callback({
29154
- path: request2.path,
29155
- namespace: request2.namespace,
29156
- suffix: request2.suffix,
29157
- pluginData: details.load(request2.pluginData),
29158
- with: request2.with
27967
+ path: request.path,
27968
+ namespace: request.namespace,
27969
+ suffix: request.suffix,
27970
+ pluginData: details.load(request.pluginData),
27971
+ with: request.with
29159
27972
  });
29160
27973
  if (result != null) {
29161
27974
  if (typeof result !== "object")
@@ -29680,7 +28493,7 @@ for your current platform.`);
29680
28493
  return { binPath, isWASM };
29681
28494
  }
29682
28495
  var child_process = __require("child_process");
29683
- var crypto5 = __require("crypto");
28496
+ var crypto4 = __require("crypto");
29684
28497
  var path2 = __require("path");
29685
28498
  var fs22 = __require("fs");
29686
28499
  var os2 = __require("os");
@@ -29994,7 +28807,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
29994
28807
  afterClose(null);
29995
28808
  };
29996
28809
  var randomFileName = () => {
29997
- return path2.join(os2.tmpdir(), `esbuild-${crypto5.randomBytes(32).toString("hex")}`);
28810
+ return path2.join(os2.tmpdir(), `esbuild-${crypto4.randomBytes(32).toString("hex")}`);
29998
28811
  };
29999
28812
  var workerThreadService = null;
30000
28813
  var startWorkerThreadService = (worker_threads2) => {
@@ -32597,8 +31410,8 @@ var require_node2 = __commonJS((exports) => {
32597
31410
  }
32598
31411
  } catch (err2) {}
32599
31412
  var bufferFrom = require_buffer_from();
32600
- function dynamicRequire(mod, request2) {
32601
- return mod.require(request2);
31413
+ function dynamicRequire(mod, request) {
31414
+ return mod.require(request);
32602
31415
  }
32603
31416
  var errorFormatterInstalled = false;
32604
31417
  var uncaughtShimInstalled = false;
@@ -35402,10 +34215,10 @@ If you have no idea what this means or what Pirates is, let me explain: Pirates
35402
34215
  var Module2 = __require("module");
35403
34216
  var originalResolveFilename = Module2._resolveFilename;
35404
34217
  var coreModules = getCoreModules(Module2.builtinModules);
35405
- Module2._resolveFilename = function(request2, _parent) {
35406
- var isCoreModule = coreModules.hasOwnProperty(request2);
34218
+ Module2._resolveFilename = function(request, _parent) {
34219
+ var isCoreModule = coreModules.hasOwnProperty(request);
35407
34220
  if (!isCoreModule) {
35408
- var found = matchPath(request2);
34221
+ var found = matchPath(request);
35409
34222
  if (found) {
35410
34223
  var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true);
35411
34224
  return originalResolveFilename.apply(this, modifiedArguments);
@@ -35572,10 +34385,10 @@ If you have no idea what this means or what Pirates is, let me explain: Pirates
35572
34385
  const matchPath = (0, import_tsconfig_paths.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
35573
34386
  const Module2 = __require("module");
35574
34387
  const originalResolveFilename = Module2._resolveFilename;
35575
- Module2._resolveFilename = function(request2, _parent) {
35576
- const isCoreModule = _module2.builtinModules.includes(request2);
34388
+ Module2._resolveFilename = function(request, _parent) {
34389
+ const isCoreModule = _module2.builtinModules.includes(request);
35577
34390
  if (!isCoreModule) {
35578
- const found = matchPath(request2);
34391
+ const found = matchPath(request);
35579
34392
  if (found) {
35580
34393
  const modifiedArguments = [found, ...[].slice.call(arguments, 1)];
35581
34394
  return originalResolveFilename.apply(this, modifiedArguments);
@@ -35723,7 +34536,7 @@ __export(exports_api, {
35723
34536
  import process2 from "process";
35724
34537
  import os from "os";
35725
34538
  import tty from "tty";
35726
- import { randomUUID as randomUUID2 } from "crypto";
34539
+ import { randomUUID } from "crypto";
35727
34540
  function assembleStyles() {
35728
34541
  const codes = /* @__PURE__ */ new Map;
35729
34542
  for (const [groupName, group] of Object.entries(styles2)) {
@@ -38398,7 +37211,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
38398
37211
  __defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
38399
37212
  }
38400
37213
  return to;
38401
- }, __toESM2 = (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_browser, require_inherits, require_common2, require_sync, require_wrappy, require_once, require_inflight, require_glob, require_readline, require_src2, require_utils, require_lodash, require_hanji, originUUID, snapshotVersion, mapValues, mapKeys, mapEntries, customMapEntries, init_global2, util3, objectUtil2, ZodParsedType2, getParsedType2, init_util2, ZodIssueCode2, ZodError3, init_ZodError2, errorMap2, en_default2, init_en2, overrideErrorMap2, init_errors4, makeIssue2, ParseStatus2, INVALID2, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, init_parseUtil2, init_typeAliases2, errorUtil2, init_errorUtil2, ParseInputLazyPath2, handleResult2, ZodType2, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly2, late2, ZodFirstPartyTypeKind2, 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_types8, init_external2, init_v32, init_esm3, enumSchema, enumSchemaV1, indexColumn, index2, fk, sequenceSchema, roleSchema, sequenceSquashed, column2, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, table15, 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_utils5, import_hanji, warning, error, 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_util, 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_lib, 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, sep, 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, _a, Column2, init_column2, _a2, ColumnBuilder2, init_column_builder2, TableName2, init_table_utils2, _a3, 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, version2, init_version2, otel2, rawTracer2, tracer2, init_tracing2, ViewBaseConfig2, init_view_common3, Schema2, Columns2, ExtraConfigColumns2, OriginalName2, BaseName2, IsAlias2, ExtraConfigBuilder2, IsDrizzleTable2, _a20, _b11, _c, _d, _e2, _f, _g, _h, _i, _j, Table2, init_table15, _a21, FakePrimitiveParam, _a22, StringChunk2, _a23, _SQL, SQL2, _a24, Name2, noopDecoder2, noopEncoder2, noopMapper2, _a25, Param2, _a26, Placeholder2, IsDrizzleView2, _a27, _b12, _c2, View3, init_sql3, _a28, ColumnAliasProxyHandler2, _a29, TableAliasProxyHandler2, _a30, RelationTableAliasProxyHandler, init_alias3, _a31, _b13, DrizzleError2, DrizzleQueryError, _a32, _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, ne3, gt3, gte2, lt3, 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_dist5, init_alias22, _a128, CheckBuilder, _a129, Check, init_checks2, 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, union2, unionAll2, intersect2, intersectAll2, except2, exceptAll2, init_select22, _a142, QueryBuilder2, init_query_builder22, _a143, DefaultViewBuilderCore, _a144, _b106, ViewBuilder, _a145, _b107, ManualViewBuilder, _a146, MaterializedViewBuilderCore, _a147, _b108, MaterializedViewBuilder, _a148, _b109, ManualMaterializedViewBuilder, _a149, _b110, _c4, PgView2, PgMaterializedViewConfig2, _a150, _b111, _c5, PgMaterializedView, init_view2, init_utils42, _a151, _b112, PgDeleteBase2, init_delete2, _a152, PgInsertBuilder2, _a153, _b113, PgInsertBase2, init_insert2, _a154, _b114, PgRefreshMaterializedView2, init_refresh_materialized_view2, init_select_types, _a155, PgUpdateBuilder2, _a156, _b115, PgUpdateBase2, init_update2, init_query_builders2, _a157, _b116, _c6, _PgCountBuilder, PgCountBuilder2, init_count2, _a158, RelationalQueryBuilder2, _a159, _b117, PgRelationalQuery2, init_query2, _a160, _b118, PgRaw2, init_raw2, _a161, PgDatabase2, init_db2, _a162, PgRole, init_roles2, _a163, PgSequence, init_sequence2, _a164, PgSchema5, init_schema3, _a165, Cache, _a166, _b119, NoopCache, init_cache, _a167, PgPreparedQuery2, _a168, PgSession2, _a169, _b120, PgTransaction2, init_session3, init_subquery22, init_utils52, init_pg_core2, vectorOps, init_vector32, sqlToStr, init_utils6, indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery, init_pgSerializer, import_hanji4, Select, init_selector_ui, init_alias32, _a170, CheckBuilder2, _a171, Check2, init_checks22, _a172, ForeignKeyBuilder22, _a173, ForeignKey22, init_foreign_keys22, _a174, UniqueConstraintBuilder2, _a175, UniqueOnConstraintBuilder2, _a176, UniqueConstraint2, init_unique_constraint22, _a177, _b121, SQLiteColumnBuilder, _a178, _b122, SQLiteColumn, init_common3, _a179, _b123, SQLiteBigIntBuilder, _a180, _b124, SQLiteBigInt, _a181, _b125, SQLiteBlobJsonBuilder, _a182, _b126, SQLiteBlobJson, _a183, _b127, SQLiteBlobBufferBuilder, _a184, _b128, SQLiteBlobBuffer, init_blob, _a185, _b129, SQLiteCustomColumnBuilder, _a186, _b130, SQLiteCustomColumn, init_custom22, _a187, _b131, SQLiteBaseIntegerBuilder, _a188, _b132, SQLiteBaseInteger, _a189, _b133, SQLiteIntegerBuilder, _a190, _b134, SQLiteInteger, _a191, _b135, SQLiteTimestampBuilder, _a192, _b136, SQLiteTimestamp, _a193, _b137, SQLiteBooleanBuilder, _a194, _b138, SQLiteBoolean, init_integer22, _a195, _b139, SQLiteNumericBuilder, _a196, _b140, SQLiteNumeric, _a197, _b141, SQLiteNumericNumberBuilder, _a198, _b142, SQLiteNumericNumber, _a199, _b143, SQLiteNumericBigIntBuilder, _a200, _b144, SQLiteNumericBigInt, init_numeric22, _a201, _b145, SQLiteRealBuilder, _a202, _b146, SQLiteReal, init_real22, _a203, _b147, SQLiteTextBuilder, _a204, _b148, SQLiteText, _a205, _b149, SQLiteTextJsonBuilder, _a206, _b150, SQLiteTextJson, init_text22, init_columns22, init_all22, InlineForeignKeys22, _a207, _b151, _c7, _d3, _e3, SQLiteTable, sqliteTable, init_table32, _a208, IndexBuilderOn22, _a209, IndexBuilder22, _a210, Index4, init_indexes22, _a211, PrimaryKeyBuilder22, _a212, PrimaryKey22, init_primary_keys22, init_utils7, _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, union3, unionAll22, intersect22, except22, init_select32, _a221, QueryBuilder22, init_query_builder32, _a222, 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_checks3, _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, _a322, _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) => {
37214
+ }, __toESM2 = (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_browser, require_inherits, require_common2, require_sync, require_wrappy, require_once, require_inflight, require_glob, require_readline, require_src2, require_utils, require_lodash, require_hanji, originUUID, snapshotVersion, mapValues, mapKeys, mapEntries, customMapEntries, init_global2, util3, objectUtil2, ZodParsedType2, getParsedType2, init_util2, ZodIssueCode2, ZodError3, init_ZodError2, errorMap2, en_default2, init_en2, overrideErrorMap2, init_errors4, makeIssue2, ParseStatus2, INVALID2, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, init_parseUtil2, init_typeAliases2, errorUtil2, init_errorUtil2, ParseInputLazyPath2, handleResult2, ZodType2, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly2, late2, ZodFirstPartyTypeKind2, 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_types8, init_external2, init_v32, init_esm2, enumSchema, enumSchemaV1, indexColumn, index2, fk, sequenceSchema, roleSchema, sequenceSquashed, column2, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, table15, 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_utils5, import_hanji, warning, error, 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_util, 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_lib, 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, sep, 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, _a, Column2, init_column2, _a2, ColumnBuilder2, init_column_builder2, TableName2, init_table_utils2, _a3, 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, version2, init_version2, otel2, rawTracer2, tracer2, init_tracing2, ViewBaseConfig2, init_view_common3, Schema2, Columns2, ExtraConfigColumns2, OriginalName2, BaseName2, IsAlias2, ExtraConfigBuilder2, IsDrizzleTable2, _a20, _b11, _c, _d, _e2, _f, _g, _h, _i, _j, Table2, init_table15, _a21, FakePrimitiveParam, _a22, StringChunk2, _a23, _SQL, SQL2, _a24, Name2, noopDecoder2, noopEncoder2, noopMapper2, _a25, Param2, _a26, Placeholder2, IsDrizzleView2, _a27, _b12, _c2, View3, init_sql3, _a28, ColumnAliasProxyHandler2, _a29, TableAliasProxyHandler2, _a30, RelationTableAliasProxyHandler, init_alias3, _a31, _b13, DrizzleError2, DrizzleQueryError, _a32, _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, ne3, gt3, gte2, lt3, 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_dist5, init_alias22, _a128, CheckBuilder, _a129, Check, init_checks2, 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, union2, unionAll2, intersect2, intersectAll2, except2, exceptAll2, init_select22, _a142, QueryBuilder2, init_query_builder22, _a143, DefaultViewBuilderCore, _a144, _b106, ViewBuilder, _a145, _b107, ManualViewBuilder, _a146, MaterializedViewBuilderCore, _a147, _b108, MaterializedViewBuilder, _a148, _b109, ManualMaterializedViewBuilder, _a149, _b110, _c4, PgView2, PgMaterializedViewConfig2, _a150, _b111, _c5, PgMaterializedView, init_view2, init_utils42, _a151, _b112, PgDeleteBase2, init_delete2, _a152, PgInsertBuilder2, _a153, _b113, PgInsertBase2, init_insert2, _a154, _b114, PgRefreshMaterializedView2, init_refresh_materialized_view2, init_select_types, _a155, PgUpdateBuilder2, _a156, _b115, PgUpdateBase2, init_update2, init_query_builders2, _a157, _b116, _c6, _PgCountBuilder, PgCountBuilder2, init_count2, _a158, RelationalQueryBuilder2, _a159, _b117, PgRelationalQuery2, init_query2, _a160, _b118, PgRaw2, init_raw2, _a161, PgDatabase2, init_db2, _a162, PgRole, init_roles2, _a163, PgSequence, init_sequence2, _a164, PgSchema5, init_schema3, _a165, Cache, _a166, _b119, NoopCache, init_cache, _a167, PgPreparedQuery2, _a168, PgSession2, _a169, _b120, PgTransaction2, init_session3, init_subquery22, init_utils52, init_pg_core2, vectorOps, init_vector32, sqlToStr, init_utils6, indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery, init_pgSerializer, import_hanji4, Select, init_selector_ui, init_alias32, _a170, CheckBuilder2, _a171, Check2, init_checks22, _a172, ForeignKeyBuilder22, _a173, ForeignKey22, init_foreign_keys22, _a174, UniqueConstraintBuilder2, _a175, UniqueOnConstraintBuilder2, _a176, UniqueConstraint2, init_unique_constraint22, _a177, _b121, SQLiteColumnBuilder, _a178, _b122, SQLiteColumn, init_common3, _a179, _b123, SQLiteBigIntBuilder, _a180, _b124, SQLiteBigInt, _a181, _b125, SQLiteBlobJsonBuilder, _a182, _b126, SQLiteBlobJson, _a183, _b127, SQLiteBlobBufferBuilder, _a184, _b128, SQLiteBlobBuffer, init_blob, _a185, _b129, SQLiteCustomColumnBuilder, _a186, _b130, SQLiteCustomColumn, init_custom22, _a187, _b131, SQLiteBaseIntegerBuilder, _a188, _b132, SQLiteBaseInteger, _a189, _b133, SQLiteIntegerBuilder, _a190, _b134, SQLiteInteger, _a191, _b135, SQLiteTimestampBuilder, _a192, _b136, SQLiteTimestamp, _a193, _b137, SQLiteBooleanBuilder, _a194, _b138, SQLiteBoolean, init_integer22, _a195, _b139, SQLiteNumericBuilder, _a196, _b140, SQLiteNumeric, _a197, _b141, SQLiteNumericNumberBuilder, _a198, _b142, SQLiteNumericNumber, _a199, _b143, SQLiteNumericBigIntBuilder, _a200, _b144, SQLiteNumericBigInt, init_numeric22, _a201, _b145, SQLiteRealBuilder, _a202, _b146, SQLiteReal, init_real22, _a203, _b147, SQLiteTextBuilder, _a204, _b148, SQLiteText, _a205, _b149, SQLiteTextJsonBuilder, _a206, _b150, SQLiteTextJson, init_text22, init_columns22, init_all22, InlineForeignKeys22, _a207, _b151, _c7, _d3, _e3, SQLiteTable, sqliteTable, init_table32, _a208, IndexBuilderOn22, _a209, IndexBuilder22, _a210, Index4, init_indexes22, _a211, PrimaryKeyBuilder22, _a212, PrimaryKey22, init_primary_keys22, init_utils7, _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, union3, unionAll22, intersect22, except22, init_select32, _a221, QueryBuilder22, init_query_builder32, _a222, 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_checks3, _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, _a322, _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) => {
38402
37215
  const matchers = filters.map((it2) => {
38403
37216
  return new Minimatch(it2);
38404
37217
  });
@@ -38655,7 +37468,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
38655
37468
  return { schema: schema5 };
38656
37469
  }, generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
38657
37470
  const prepared = prepareFromExports(imports);
38658
- const id = randomUUID2();
37471
+ const id = randomUUID();
38659
37472
  const snapshot = generatePgSnapshot(prepared.tables, prepared.enums, prepared.schemas, prepared.sequences, prepared.roles, prepared.policies, prepared.views, prepared.matViews, casing2, schemaFilters);
38660
37473
  return fillPgSnapshot({
38661
37474
  serialized: snapshot,
@@ -38701,7 +37514,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
38701
37514
  }, generateSQLiteDrizzleJson = async (imports, prevId, casing2) => {
38702
37515
  const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
38703
37516
  const prepared = prepareFromExports5(imports);
38704
- const id = randomUUID2();
37517
+ const id = randomUUID();
38705
37518
  const snapshot = generateSqliteSnapshot(prepared.tables, prepared.views, casing2);
38706
37519
  return {
38707
37520
  ...snapshot,
@@ -38749,7 +37562,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
38749
37562
  }, generateMySQLDrizzleJson = async (imports, prevId, casing2) => {
38750
37563
  const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
38751
37564
  const prepared = prepareFromExports5(imports);
38752
- const id = randomUUID2();
37565
+ const id = randomUUID();
38753
37566
  const snapshot = generateMySqlSnapshot(prepared.tables, prepared.views, casing2);
38754
37567
  return {
38755
37568
  ...snapshot,
@@ -38796,7 +37609,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
38796
37609
  }, generateSingleStoreDrizzleJson = async (imports, prevId, casing2) => {
38797
37610
  const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_singlestoreImports(), singlestoreImports_exports));
38798
37611
  const prepared = prepareFromExports5(imports);
38799
- const id = randomUUID2();
37612
+ const id = randomUUID();
38800
37613
  const snapshot = generateSingleStoreSnapshot(prepared.tables, casing2);
38801
37614
  return {
38802
37615
  ...snapshot,
@@ -45583,7 +44396,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
45583
44396
  init_external2();
45584
44397
  }
45585
44398
  });
45586
- init_esm3 = __esm3({
44399
+ init_esm2 = __esm3({
45587
44400
  "../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/index.js"() {
45588
44401
  init_v32();
45589
44402
  init_v32();
@@ -45592,7 +44405,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
45592
44405
  init_gelSchema = __esm3({
45593
44406
  "src/serializer/gelSchema.ts"() {
45594
44407
  init_global2();
45595
- init_esm3();
44408
+ init_esm2();
45596
44409
  enumSchema = objectType2({
45597
44410
  name: stringType2(),
45598
44411
  schema: stringType2(),
@@ -45846,7 +44659,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
45846
44659
  });
45847
44660
  init_mysqlSchema = __esm3({
45848
44661
  "src/serializer/mysqlSchema.ts"() {
45849
- init_esm3();
44662
+ init_esm2();
45850
44663
  init_global2();
45851
44664
  index22 = objectType2({
45852
44665
  name: stringType2(),
@@ -46152,7 +44965,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
46152
44965
  init_pgSchema = __esm3({
46153
44966
  "src/serializer/pgSchema.ts"() {
46154
44967
  init_global2();
46155
- init_esm3();
44968
+ init_esm2();
46156
44969
  indexV2 = objectType2({
46157
44970
  name: stringType2(),
46158
44971
  columns: recordType2(stringType2(), objectType2({
@@ -46873,7 +45686,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
46873
45686
  });
46874
45687
  init_singlestoreSchema = __esm3({
46875
45688
  "src/serializer/singlestoreSchema.ts"() {
46876
- init_esm3();
45689
+ init_esm2();
46877
45690
  init_global2();
46878
45691
  index4 = objectType2({
46879
45692
  name: stringType2(),
@@ -47032,7 +45845,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
47032
45845
  });
47033
45846
  init_sqliteSchema = __esm3({
47034
45847
  "src/serializer/sqliteSchema.ts"() {
47035
- init_esm3();
45848
+ init_esm2();
47036
45849
  init_global2();
47037
45850
  index5 = objectType2({
47038
45851
  name: stringType2(),
@@ -54710,7 +53523,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
54710
53523
  });
54711
53524
  init_snapshotsDiffer = __esm3({
54712
53525
  "src/snapshotsDiffer.ts"() {
54713
- init_esm3();
53526
+ init_esm2();
54714
53527
  init_jsonDiffer();
54715
53528
  init_sqlgenerator();
54716
53529
  init_jsonStatements();
@@ -56821,7 +55634,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
56821
55634
  });
56822
55635
  init_schemaValidator = __esm3({
56823
55636
  "src/schemaValidator.ts"() {
56824
- init_esm3();
55637
+ init_esm2();
56825
55638
  init_mysqlSchema();
56826
55639
  init_pgSchema();
56827
55640
  init_singlestoreSchema();
@@ -56839,7 +55652,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
56839
55652
  });
56840
55653
  init_common2 = __esm3({
56841
55654
  "src/cli/validations/common.ts"() {
56842
- init_esm3();
55655
+ init_esm2();
56843
55656
  init_schemaValidator();
56844
55657
  init_outputs();
56845
55658
  sqliteDriversLiterals = [
@@ -72041,7 +70854,7 @@ AND
72041
70854
  });
72042
70855
  init_cli = __esm3({
72043
70856
  "src/cli/validations/cli.ts"() {
72044
- init_esm3();
70857
+ init_esm2();
72045
70858
  init_schemaValidator();
72046
70859
  init_common2();
72047
70860
  cliConfigGenerate = objectType2({
@@ -72102,7 +70915,7 @@ AND
72102
70915
  });
72103
70916
  init_gel = __esm3({
72104
70917
  "src/cli/validations/gel.ts"() {
72105
- init_esm3();
70918
+ init_esm2();
72106
70919
  init_views();
72107
70920
  init_common2();
72108
70921
  gelCredentials = unionType2([
@@ -72146,7 +70959,7 @@ AND
72146
70959
  });
72147
70960
  init_libsql = __esm3({
72148
70961
  "src/cli/validations/libsql.ts"() {
72149
- init_esm3();
70962
+ init_esm2();
72150
70963
  init_views();
72151
70964
  init_common2();
72152
70965
  libSQLCredentials = objectType2({
@@ -72157,7 +70970,7 @@ AND
72157
70970
  });
72158
70971
  init_mysql = __esm3({
72159
70972
  "src/cli/validations/mysql.ts"() {
72160
- init_esm3();
70973
+ init_esm2();
72161
70974
  init_views();
72162
70975
  init_common2();
72163
70976
  init_outputs();
@@ -72190,7 +71003,7 @@ AND
72190
71003
  });
72191
71004
  init_postgres = __esm3({
72192
71005
  "src/cli/validations/postgres.ts"() {
72193
- init_esm3();
71006
+ init_esm2();
72194
71007
  init_views();
72195
71008
  init_common2();
72196
71009
  postgresCredentials = unionType2([
@@ -72235,7 +71048,7 @@ AND
72235
71048
  });
72236
71049
  init_singlestore = __esm3({
72237
71050
  "src/cli/validations/singlestore.ts"() {
72238
- init_esm3();
71051
+ init_esm2();
72239
71052
  init_views();
72240
71053
  init_common2();
72241
71054
  init_outputs();
@@ -72269,7 +71082,7 @@ AND
72269
71082
  init_sqlite = __esm3({
72270
71083
  "src/cli/validations/sqlite.ts"() {
72271
71084
  init_global2();
72272
- init_esm3();
71085
+ init_esm2();
72273
71086
  init_views();
72274
71087
  init_common2();
72275
71088
  sqliteCredentials = unionType2([
@@ -72296,7 +71109,7 @@ AND
72296
71109
  });
72297
71110
  init_studio = __esm3({
72298
71111
  "src/cli/validations/studio.ts"() {
72299
- init_esm3();
71112
+ init_esm2();
72300
71113
  init_schemaValidator();
72301
71114
  init_common2();
72302
71115
  init_mysql();
@@ -72328,7 +71141,7 @@ AND
72328
71141
  init_utils9 = __esm3({
72329
71142
  "src/cli/commands/utils.ts"() {
72330
71143
  import_hanji7 = __toESM2(require_hanji());
72331
- init_esm3();
71144
+ init_esm2();
72332
71145
  init_getTablesFilterByExtensions();
72333
71146
  init_global2();
72334
71147
  init_schemaValidator();
@@ -76229,8 +75042,8 @@ var init_currencies = __esm(() => {
76229
75042
  });
76230
75043
 
76231
75044
  // src/lib/logging/adapter.ts
76232
- function setLogger(logger32) {
76233
- customLogger = logger32;
75045
+ function setLogger(logger31) {
75046
+ customLogger = logger31;
76234
75047
  }
76235
75048
  function getLogger() {
76236
75049
  if (customLogger) {
@@ -76242,10 +75055,10 @@ function getLogger() {
76242
75055
  error: (msg) => console.error(msg)
76243
75056
  };
76244
75057
  }
76245
- var customLogger, logger32;
75058
+ var customLogger, logger31;
76246
75059
  var init_adapter = __esm(() => {
76247
75060
  init_config();
76248
- logger32 = {
75061
+ logger31 = {
76249
75062
  info: (msg) => {
76250
75063
  if (customLogger || !config.embedded) {
76251
75064
  getLogger().info(msg);
@@ -76332,7 +75145,7 @@ async function seedCoreGames(db2) {
76332
75145
  try {
76333
75146
  await db2.insert(games).values(gameData).onConflictDoNothing();
76334
75147
  } catch (error2) {
76335
- logger32.error(`Error seeding core game '${gameData.slug}': ${error2}`);
75148
+ logger31.error(`Error seeding core game '${gameData.slug}': ${error2}`);
76336
75149
  }
76337
75150
  }
76338
75151
  }
@@ -76373,7 +75186,7 @@ async function seedCurrentProjectGame(db2, project) {
76373
75186
  }
76374
75187
  return newGame;
76375
75188
  } catch (error2) {
76376
- logger32.error(`❌ Error seeding project game: ${error2}`);
75189
+ logger31.error(`❌ Error seeding project game: ${error2}`);
76377
75190
  throw error2;
76378
75191
  }
76379
75192
  }
@@ -77783,6 +76596,142 @@ var init_auth_util = __esm(() => {
77783
76596
  init_types9();
77784
76597
  });
77785
76598
 
76599
+ // ../api-core/src/utils/lti.util.ts
76600
+ function generateUsername(email) {
76601
+ const baseUsername = (email.split("@")[0] || "user").toLowerCase();
76602
+ const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
76603
+ const randomSuffix = Math.random().toString(36).substring(2, 7);
76604
+ return `${cleanUsername}_${randomSuffix}`;
76605
+ }
76606
+ function extractRedirectPath(targetUri, currentHost) {
76607
+ try {
76608
+ const targetUrl = new URL(targetUri);
76609
+ if (targetUrl.hostname === currentHost) {
76610
+ return targetUrl.pathname + targetUrl.search;
76611
+ }
76612
+ } catch {}
76613
+ return "/";
76614
+ }
76615
+ function validateLtiClaims(claims) {
76616
+ const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
76617
+ const version4 = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
76618
+ if (messageType !== "LtiResourceLinkRequest") {
76619
+ return `Invalid LTI message type: ${messageType}`;
76620
+ }
76621
+ if (version4 !== "1.3.0") {
76622
+ return `Unsupported LTI version: ${version4}`;
76623
+ }
76624
+ return null;
76625
+ }
76626
+ var init_lti_util = () => {};
76627
+
76628
+ // ../api-core/src/utils/lti-provisioning.ts
76629
+ import * as crypto4 from "node:crypto";
76630
+ async function provisionLtiUser(db2, claims) {
76631
+ const database2 = db2;
76632
+ const email = claims.email;
76633
+ const ltiTimebackId = claims.sub;
76634
+ const providerId = AUTH_PROVIDER_IDS.TIMEBACK_LTI;
76635
+ if (!email) {
76636
+ throw new ValidationError("Email is required in LTI claims");
76637
+ }
76638
+ const existingAccount = await database2.query.accounts.findFirst({
76639
+ where: and(eq(accounts.accountId, ltiTimebackId), eq(accounts.providerId, providerId))
76640
+ });
76641
+ if (existingAccount) {
76642
+ const user = await database2.query.users.findFirst({
76643
+ where: eq(users.id, existingAccount.userId)
76644
+ });
76645
+ if (user) {
76646
+ logger32.info("Found user by LTI account", {
76647
+ userId: user.id,
76648
+ ltiTimebackId
76649
+ });
76650
+ return user;
76651
+ }
76652
+ }
76653
+ const existingUser = await database2.query.users.findFirst({
76654
+ where: eq(users.email, email)
76655
+ });
76656
+ if (existingUser) {
76657
+ await database2.transaction(async (tx) => {
76658
+ const existingLtiAccount = await tx.query.accounts.findFirst({
76659
+ where: and(eq(accounts.userId, existingUser.id), eq(accounts.providerId, providerId))
76660
+ });
76661
+ if (!existingLtiAccount) {
76662
+ const [account] = await tx.insert(accounts).values({
76663
+ id: crypto4.randomUUID(),
76664
+ userId: existingUser.id,
76665
+ accountId: ltiTimebackId,
76666
+ providerId,
76667
+ accessToken: null,
76668
+ refreshToken: null,
76669
+ accessTokenExpiresAt: null,
76670
+ refreshTokenExpiresAt: null,
76671
+ createdAt: new Date,
76672
+ updatedAt: new Date
76673
+ }).returning({ id: accounts.id });
76674
+ if (!account) {
76675
+ logger32.error("LTI account link insert returned no rows", {
76676
+ userId: existingUser.id,
76677
+ ltiTimebackId
76678
+ });
76679
+ throw new InternalError("Failed to link LTI account");
76680
+ }
76681
+ logger32.info("Linked LTI account to existing user", {
76682
+ userId: existingUser.id,
76683
+ ltiTimebackId
76684
+ });
76685
+ }
76686
+ });
76687
+ return existingUser;
76688
+ }
76689
+ const newUserId = crypto4.randomUUID();
76690
+ const createdUser = await database2.transaction(async (tx) => {
76691
+ const [insertedUser] = await tx.insert(users).values({
76692
+ id: newUserId,
76693
+ email,
76694
+ emailVerified: true,
76695
+ username: generateUsername(email),
76696
+ name: claims.name || claims.given_name || email.split("@")[0] || "Timeback User",
76697
+ createdAt: new Date,
76698
+ updatedAt: new Date
76699
+ }).returning();
76700
+ if (!insertedUser) {
76701
+ logger32.error("LTI user insert returned no rows", { email, ltiTimebackId });
76702
+ throw new InternalError("Failed to create user");
76703
+ }
76704
+ await tx.insert(accounts).values({
76705
+ id: crypto4.randomUUID(),
76706
+ userId: newUserId,
76707
+ accountId: ltiTimebackId,
76708
+ providerId,
76709
+ accessToken: null,
76710
+ refreshToken: null,
76711
+ accessTokenExpiresAt: null,
76712
+ refreshTokenExpiresAt: null,
76713
+ createdAt: new Date,
76714
+ updatedAt: new Date
76715
+ });
76716
+ logger32.info("Provisioned new user from LTI", {
76717
+ userId: insertedUser.id,
76718
+ ltiTimebackId
76719
+ });
76720
+ return insertedUser;
76721
+ });
76722
+ return createdUser;
76723
+ }
76724
+ var logger32;
76725
+ var init_lti_provisioning = __esm(() => {
76726
+ init_drizzle_orm();
76727
+ init_src();
76728
+ init_tables_index();
76729
+ init_src2();
76730
+ init_errors();
76731
+ init_lti_util();
76732
+ logger32 = log.scope("LtiProvisioning");
76733
+ });
76734
+
77786
76735
  // ../api-core/src/utils/validation.util.ts
77787
76736
  function formatZodError(error2) {
77788
76737
  const flat = error2.flatten();
@@ -77807,6 +76756,7 @@ var init_utils11 = __esm(() => {
77807
76756
  init_deployment_util();
77808
76757
  init_leaderboard_util();
77809
76758
  init_lti_util();
76759
+ init_lti_provisioning();
77810
76760
  init_scope_util();
77811
76761
  init_timeback_util();
77812
76762
  });
@@ -87965,20 +86915,9 @@ var init_logs_controller = __esm(() => {
87965
86915
  });
87966
86916
 
87967
86917
  // ../api-core/src/controllers/lti.controller.ts
87968
- async function launch(ctx) {
87969
- const formData = await ctx.request.formData();
87970
- const idToken = formData.get("id_token");
87971
- if (!idToken || typeof idToken !== "string") {
87972
- throw ApiError.badRequest("Missing or invalid id_token");
87973
- }
87974
- const currentHost = ctx.url.hostname;
87975
- logger48.debug("Processing launch", { host: currentHost });
87976
- return ctx.services.lti.processLaunch(idToken, currentHost);
87977
- }
87978
86918
  var logger48, getStatus3, lti;
87979
86919
  var init_lti_controller = __esm(() => {
87980
86920
  init_src2();
87981
- init_errors();
87982
86921
  init_utils11();
87983
86922
  logger48 = log.scope("LtiController");
87984
86923
  getStatus3 = requireAuth(async (ctx) => {
@@ -87986,7 +86925,6 @@ var init_lti_controller = __esm(() => {
87986
86925
  return ctx.services.lti.getStatus(ctx.user);
87987
86926
  });
87988
86927
  lti = {
87989
- launch,
87990
86928
  getStatus: getStatus3
87991
86929
  };
87992
86930
  });
@@ -88218,7 +87156,7 @@ var init_realtime_controller = __esm(() => {
88218
87156
  });
88219
87157
 
88220
87158
  // ../api-core/src/controllers/secrets.controller.ts
88221
- var logger52, listKeys, getValues, setSecrets, deleteSecret, secrets;
87159
+ var logger52, listKeys, setSecrets, deleteSecret, secrets;
88222
87160
  var init_secrets_controller = __esm(() => {
88223
87161
  init_esm();
88224
87162
  init_schemas_index();
@@ -88235,15 +87173,6 @@ var init_secrets_controller = __esm(() => {
88235
87173
  const keys = await ctx.services.secrets.listKeys(slug2, ctx.user);
88236
87174
  return { keys };
88237
87175
  });
88238
- getValues = requireDeveloper(async (ctx) => {
88239
- const slug2 = ctx.params.slug;
88240
- if (!slug2) {
88241
- throw ApiError.badRequest("Missing game slug");
88242
- }
88243
- logger52.debug("Getting secret values", { userId: ctx.user.id, slug: slug2 });
88244
- const secrets = await ctx.services.secrets.getValues(slug2, ctx.user);
88245
- return { secrets };
88246
- });
88247
87176
  setSecrets = requireDeveloper(async (ctx) => {
88248
87177
  const slug2 = ctx.params.slug;
88249
87178
  if (!slug2) {
@@ -88284,7 +87213,6 @@ var init_secrets_controller = __esm(() => {
88284
87213
  });
88285
87214
  secrets = {
88286
87215
  listKeys,
88287
- getValues,
88288
87216
  setSecrets,
88289
87217
  deleteSecret
88290
87218
  };
@@ -89384,7 +88312,6 @@ var init_secrets = __esm(() => {
89384
88312
  init_api();
89385
88313
  gameSecretsRouter = new Hono2;
89386
88314
  gameSecretsRouter.get("/:slug/secrets", handle2(secrets.listKeys));
89387
- gameSecretsRouter.get("/:slug/secrets/values", handle2(secrets.getValues));
89388
88315
  gameSecretsRouter.post("/:slug/secrets", handle2(secrets.setSecrets));
89389
88316
  gameSecretsRouter.delete("/:slug/secrets/:key", handle2(secrets.deleteSecret));
89390
88317
  });
@@ -89921,51 +88848,85 @@ var init_timeback6 = __esm(() => {
89921
88848
  });
89922
88849
 
89923
88850
  // src/routes/integrations/lti.ts
89924
- var ltiRouter;
88851
+ function verifyMockToken(idToken) {
88852
+ if (!idToken.startsWith("mock:")) {
88853
+ throw new Error("Invalid LTI token - must be mock token in sandbox");
88854
+ }
88855
+ try {
88856
+ const jsonStr = Buffer.from(idToken.slice(5), "base64").toString();
88857
+ return JSON.parse(jsonStr);
88858
+ } catch {
88859
+ throw new Error("Invalid LTI token format");
88860
+ }
88861
+ }
88862
+ var logger62, ltiRouter;
89925
88863
  var init_lti = __esm(() => {
89926
88864
  init_drizzle_orm();
89927
88865
  init_dist3();
89928
88866
  init_controllers();
89929
- init_errors();
88867
+ init_utils11();
89930
88868
  init_tables_index();
88869
+ init_src2();
89931
88870
  init_constants();
89932
88871
  init_api();
89933
- init_context();
88872
+ logger62 = log.scope("SandboxLti");
89934
88873
  ltiRouter = new Hono2;
89935
- ltiRouter.all("/launch", async (c2) => {
89936
- if (c2.req.method !== "POST") {
89937
- return c2.json({
89938
- error: "method_not_allowed",
89939
- message: "LTI launches must use POST method"
89940
- }, 405);
89941
- }
89942
- const sandboxCtx = getSandboxContext();
89943
- const ctx = {
89944
- db: sandboxCtx.db,
89945
- config: sandboxCtx.config,
89946
- providers: sandboxCtx.providers,
89947
- services: sandboxCtx.services,
89948
- user: undefined,
89949
- params: {},
89950
- url: new URL(c2.req.url),
89951
- request: c2.req.raw
89952
- };
88874
+ ltiRouter.post("/launch", async (c2) => {
88875
+ const db2 = c2.get("db");
89953
88876
  try {
89954
- const result = await lti.launch(ctx);
89955
- c2.header("Set-Cookie", `better-auth.session=${result.sessionToken}; Path=/; HttpOnly; SameSite=Lax; Max-Age=${30 * 24 * 60 * 60}`);
89956
- return c2.redirect(result.redirectPath);
89957
- } catch (error2) {
89958
- if (error2 instanceof ApiError) {
88877
+ const formData = await c2.req.formData();
88878
+ const idToken = formData.get("id_token");
88879
+ if (!idToken || typeof idToken !== "string") {
89959
88880
  return c2.json({
89960
- error: "lti_launch_failed",
89961
- message: error2.message,
89962
- code: error2.code,
89963
- details: error2.details
89964
- }, error2.status);
88881
+ error: "missing_token",
88882
+ message: "Missing or invalid id_token in request"
88883
+ }, 400);
89965
88884
  }
88885
+ let claims;
88886
+ try {
88887
+ claims = verifyMockToken(idToken);
88888
+ } catch (error2) {
88889
+ const errorMessage = error2 instanceof Error ? error2.message : String(error2);
88890
+ logger62.error("LTI token verification failed", { error: errorMessage });
88891
+ return c2.json({
88892
+ error: "invalid_token",
88893
+ message: errorMessage
88894
+ }, 401);
88895
+ }
88896
+ const validationError = validateLtiClaims(claims);
88897
+ if (validationError) {
88898
+ logger62.warn("LTI claims validation failed", {
88899
+ error: validationError,
88900
+ sub: claims.sub
88901
+ });
88902
+ return c2.json({
88903
+ error: "invalid_claims",
88904
+ message: validationError
88905
+ }, 400);
88906
+ }
88907
+ const user = await provisionLtiUser(db2, claims);
88908
+ const sessionToken = crypto.randomUUID();
88909
+ const expiresAt = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000);
88910
+ await db2.insert(sessions).values({
88911
+ id: crypto.randomUUID(),
88912
+ userId: user.id,
88913
+ token: sessionToken,
88914
+ expiresAt,
88915
+ createdAt: new Date,
88916
+ updatedAt: new Date
88917
+ });
88918
+ logger62.info("LTI launch successful", { userId: user.id });
88919
+ const targetUri = claims["https://purl.imsglobal.org/spec/lti/claim/target_link_uri"];
88920
+ const currentHost = new URL(c2.req.url).hostname;
88921
+ const redirectPath = extractRedirectPath(targetUri, currentHost);
88922
+ c2.header("Set-Cookie", `sandbox-session=${sessionToken}; Path=/; HttpOnly; SameSite=Lax; Max-Age=${30 * 24 * 60 * 60}`);
88923
+ return c2.redirect(redirectPath);
88924
+ } catch (error2) {
88925
+ const errorMessage = error2 instanceof Error ? error2.message : String(error2);
88926
+ logger62.error("Unexpected error during LTI launch", { error: errorMessage });
89966
88927
  return c2.json({
89967
88928
  error: "unexpected_error",
89968
- message: "An unexpected error occurred during LTI launch. Please try again or contact support."
88929
+ message: "An unexpected error occurred during LTI launch"
89969
88930
  }, 500);
89970
88931
  }
89971
88932
  });
@@ -90095,7 +89056,6 @@ async function startServer(port, project, options = {}) {
90095
89056
  resetSandboxContext();
90096
89057
  resetHandlers();
90097
89058
  clearSandboxCache();
90098
- clearSandboxSecrets();
90099
89059
  clearSandboxStorage();
90100
89060
  const db2 = await setupServerDatabase(processedOptions, project);
90101
89061
  createSandboxContext({ db: db2, port });
@@ -90122,7 +89082,6 @@ async function startServer(port, project, options = {}) {
90122
89082
  resetSandboxContext();
90123
89083
  resetHandlers();
90124
89084
  clearSandboxCache();
90125
- clearSandboxSecrets();
90126
89085
  clearSandboxStorage();
90127
89086
  }
90128
89087
  };