@playcademy/sandbox 0.3.8 → 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 +797 -1699
- package/dist/infrastructure/api/providers/index.d.ts +0 -1
- package/dist/server.js +797 -1699
- package/package.json +1 -1
- package/dist/infrastructure/api/providers/secrets.provider.d.ts +0 -19
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.
|
|
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", "
|
|
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
|
|
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
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
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.
|
|
13494
|
+
return this.createApiKey(user, slug2, keyName);
|
|
13516
13495
|
}
|
|
13517
|
-
async
|
|
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
|
-
|
|
13523
|
-
}
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -14980,1090 +14965,68 @@ var init_level_service = __esm(() => {
|
|
|
14980
14965
|
logger15 = log.scope("LevelService");
|
|
14981
14966
|
});
|
|
14982
14967
|
|
|
14983
|
-
//
|
|
14984
|
-
|
|
14985
|
-
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
FailedAssertionError = class FailedAssertionError extends JwtBaseError {
|
|
14989
|
-
constructor(msg, actual, expected) {
|
|
14990
|
-
super(msg);
|
|
14991
|
-
this.failedAssertion = {
|
|
14992
|
-
actual,
|
|
14993
|
-
expected
|
|
14994
|
-
};
|
|
14995
|
-
}
|
|
14996
|
-
};
|
|
14997
|
-
JwtParseError = class JwtParseError extends JwtBaseError {
|
|
14998
|
-
constructor(msg, error) {
|
|
14999
|
-
const message = error != null ? `${msg}: ${error}` : msg;
|
|
15000
|
-
super(message);
|
|
15001
|
-
}
|
|
15002
|
-
};
|
|
15003
|
-
ParameterValidationError = class ParameterValidationError extends JwtBaseError {
|
|
15004
|
-
};
|
|
15005
|
-
JwtInvalidSignatureError = class JwtInvalidSignatureError extends JwtBaseError {
|
|
15006
|
-
};
|
|
15007
|
-
JwtInvalidSignatureAlgorithmError = class JwtInvalidSignatureAlgorithmError extends FailedAssertionError {
|
|
15008
|
-
};
|
|
15009
|
-
JwtInvalidClaimError = class JwtInvalidClaimError extends FailedAssertionError {
|
|
15010
|
-
withRawJwt({ header, payload }) {
|
|
15011
|
-
this.rawJwt = {
|
|
15012
|
-
header,
|
|
15013
|
-
payload
|
|
15014
|
-
};
|
|
15015
|
-
return this;
|
|
15016
|
-
}
|
|
15017
|
-
};
|
|
15018
|
-
JwtInvalidIssuerError = class JwtInvalidIssuerError extends JwtInvalidClaimError {
|
|
15019
|
-
};
|
|
15020
|
-
JwtInvalidAudienceError = class JwtInvalidAudienceError extends JwtInvalidClaimError {
|
|
15021
|
-
};
|
|
15022
|
-
JwtInvalidScopeError = class JwtInvalidScopeError extends JwtInvalidClaimError {
|
|
15023
|
-
};
|
|
15024
|
-
JwtExpiredError = class JwtExpiredError extends JwtInvalidClaimError {
|
|
15025
|
-
};
|
|
15026
|
-
JwtNotBeforeError = class JwtNotBeforeError extends JwtInvalidClaimError {
|
|
15027
|
-
};
|
|
15028
|
-
CognitoJwtInvalidGroupError = class CognitoJwtInvalidGroupError extends JwtInvalidClaimError {
|
|
15029
|
-
};
|
|
15030
|
-
CognitoJwtInvalidTokenUseError = class CognitoJwtInvalidTokenUseError extends JwtInvalidClaimError {
|
|
15031
|
-
};
|
|
15032
|
-
CognitoJwtInvalidClientIdError = class CognitoJwtInvalidClientIdError extends JwtInvalidClaimError {
|
|
15033
|
-
};
|
|
15034
|
-
JwksValidationError = class JwksValidationError extends JwtBaseError {
|
|
15035
|
-
};
|
|
15036
|
-
JwkValidationError = class JwkValidationError extends JwtBaseError {
|
|
15037
|
-
};
|
|
15038
|
-
JwtWithoutValidKidError = class JwtWithoutValidKidError extends JwtBaseError {
|
|
15039
|
-
};
|
|
15040
|
-
KidNotFoundInJwksError = class KidNotFoundInJwksError extends JwtBaseError {
|
|
15041
|
-
};
|
|
15042
|
-
WaitPeriodNotYetEndedJwkError = class WaitPeriodNotYetEndedJwkError extends JwtBaseError {
|
|
15043
|
-
};
|
|
15044
|
-
JwksNotAvailableInCacheError = class JwksNotAvailableInCacheError extends JwtBaseError {
|
|
15045
|
-
};
|
|
15046
|
-
JwkInvalidUseError = class JwkInvalidUseError extends FailedAssertionError {
|
|
15047
|
-
};
|
|
15048
|
-
JwkInvalidKtyError = class JwkInvalidKtyError extends FailedAssertionError {
|
|
15049
|
-
};
|
|
15050
|
-
FetchError = class FetchError extends JwtBaseError {
|
|
15051
|
-
constructor(uri, msg) {
|
|
15052
|
-
super(`Failed to fetch ${uri}: ${msg}`);
|
|
15053
|
-
}
|
|
15054
|
-
};
|
|
15055
|
-
NonRetryableFetchError = class NonRetryableFetchError extends FetchError {
|
|
15056
|
-
};
|
|
15057
|
-
});
|
|
15058
|
-
|
|
15059
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/https-node.js
|
|
15060
|
-
import { request } from "https";
|
|
15061
|
-
import { pipeline } from "stream";
|
|
15062
|
-
async function fetch2(uri, requestOptions, data) {
|
|
15063
|
-
let responseTimeout;
|
|
15064
|
-
return new Promise((resolve, reject) => {
|
|
15065
|
-
const req = request(uri, {
|
|
15066
|
-
method: "GET",
|
|
15067
|
-
...requestOptions
|
|
15068
|
-
}, (response) => {
|
|
15069
|
-
if (response.statusCode !== 200) {
|
|
15070
|
-
done(new NonRetryableFetchError(uri, `Status code is ${response.statusCode}, expected 200`));
|
|
15071
|
-
return;
|
|
15072
|
-
}
|
|
15073
|
-
pipeline(response, async (responseBody) => {
|
|
15074
|
-
const chunks = [];
|
|
15075
|
-
for await (const chunk of responseBody) {
|
|
15076
|
-
chunks.push(chunk);
|
|
15077
|
-
}
|
|
15078
|
-
return Buffer.concat(chunks);
|
|
15079
|
-
}, done);
|
|
15080
|
-
});
|
|
15081
|
-
if (requestOptions?.responseTimeout) {
|
|
15082
|
-
responseTimeout = setTimeout(() => done(new FetchError(uri, `Response time-out (after ${requestOptions.responseTimeout} ms.)`)), requestOptions.responseTimeout);
|
|
15083
|
-
responseTimeout.unref();
|
|
15084
|
-
}
|
|
15085
|
-
function done(err2, data2) {
|
|
15086
|
-
if (responseTimeout)
|
|
15087
|
-
clearTimeout(responseTimeout);
|
|
15088
|
-
if (err2 == null) {
|
|
15089
|
-
resolve(data2);
|
|
15090
|
-
return;
|
|
15091
|
-
}
|
|
15092
|
-
req.socket?.emit("agentRemove");
|
|
15093
|
-
if (!(err2 instanceof FetchError)) {
|
|
15094
|
-
err2 = new FetchError(uri, err2.message);
|
|
15095
|
-
}
|
|
15096
|
-
req.destroy();
|
|
15097
|
-
reject(err2);
|
|
15098
|
-
}
|
|
15099
|
-
req.on("error", done);
|
|
15100
|
-
req.end(data);
|
|
15101
|
-
});
|
|
15102
|
-
}
|
|
15103
|
-
var init_https_node = __esm(() => {
|
|
15104
|
-
init_error();
|
|
15105
|
-
});
|
|
15106
|
-
|
|
15107
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/node-web-compat-node.js
|
|
15108
|
-
import { createPublicKey, createVerify, verify } from "crypto";
|
|
15109
|
-
var JwtSignatureAlgorithmHashNames, nodeWebCompat;
|
|
15110
|
-
var init_node_web_compat_node = __esm(() => {
|
|
15111
|
-
init_https_node();
|
|
15112
|
-
(function(JwtSignatureAlgorithmHashNames2) {
|
|
15113
|
-
JwtSignatureAlgorithmHashNames2["RS256"] = "RSA-SHA256";
|
|
15114
|
-
JwtSignatureAlgorithmHashNames2["RS384"] = "RSA-SHA384";
|
|
15115
|
-
JwtSignatureAlgorithmHashNames2["RS512"] = "RSA-SHA512";
|
|
15116
|
-
JwtSignatureAlgorithmHashNames2["ES256"] = "RSA-SHA256";
|
|
15117
|
-
JwtSignatureAlgorithmHashNames2["ES384"] = "RSA-SHA384";
|
|
15118
|
-
JwtSignatureAlgorithmHashNames2["ES512"] = "RSA-SHA512";
|
|
15119
|
-
})(JwtSignatureAlgorithmHashNames || (JwtSignatureAlgorithmHashNames = {}));
|
|
15120
|
-
nodeWebCompat = {
|
|
15121
|
-
fetch: fetch2,
|
|
15122
|
-
transformJwkToKeyObjectSync: (jwk) => createPublicKey({
|
|
15123
|
-
key: jwk,
|
|
15124
|
-
format: "jwk"
|
|
15125
|
-
}),
|
|
15126
|
-
transformJwkToKeyObjectAsync: async (jwk) => createPublicKey({
|
|
15127
|
-
key: jwk,
|
|
15128
|
-
format: "jwk"
|
|
15129
|
-
}),
|
|
15130
|
-
parseB64UrlString: (b64) => Buffer.from(b64, "base64").toString("utf8"),
|
|
15131
|
-
verifySignatureSync: ({ alg, keyObject, jwsSigningInput, signature }) => alg !== "EdDSA" ? createVerify(JwtSignatureAlgorithmHashNames[alg]).update(jwsSigningInput).verify({
|
|
15132
|
-
key: keyObject,
|
|
15133
|
-
dsaEncoding: "ieee-p1363"
|
|
15134
|
-
}, signature, "base64") : verify(null, Buffer.from(jwsSigningInput), keyObject, Buffer.from(signature, "base64")),
|
|
15135
|
-
verifySignatureAsync: async (args2) => nodeWebCompat.verifySignatureSync(args2),
|
|
15136
|
-
defaultFetchTimeouts: {
|
|
15137
|
-
socketIdle: 1500,
|
|
15138
|
-
response: 3000
|
|
15139
|
-
},
|
|
15140
|
-
setTimeoutUnref: (...args2) => setTimeout(...args2).unref(),
|
|
15141
|
-
transformPemToJwk: async (pem) => {
|
|
15142
|
-
return createPublicKey({
|
|
15143
|
-
key: Buffer.from(pem),
|
|
15144
|
-
format: "pem"
|
|
15145
|
-
}).export({
|
|
15146
|
-
format: "jwk"
|
|
15147
|
-
});
|
|
15148
|
-
}
|
|
15149
|
-
};
|
|
15150
|
-
});
|
|
15151
|
-
|
|
15152
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/https.js
|
|
15153
|
-
class SimpleFetcher {
|
|
15154
|
-
constructor(props) {
|
|
15155
|
-
this.defaultRequestOptions = {
|
|
15156
|
-
timeout: nodeWebCompat.defaultFetchTimeouts.socketIdle,
|
|
15157
|
-
responseTimeout: nodeWebCompat.defaultFetchTimeouts.response,
|
|
15158
|
-
...props?.defaultRequestOptions
|
|
15159
|
-
};
|
|
15160
|
-
}
|
|
15161
|
-
async fetch(uri, requestOptions, data) {
|
|
15162
|
-
requestOptions = { ...this.defaultRequestOptions, ...requestOptions };
|
|
15163
|
-
try {
|
|
15164
|
-
return await fetch3(uri, requestOptions, data);
|
|
15165
|
-
} catch (err2) {
|
|
15166
|
-
if (err2 instanceof NonRetryableFetchError) {
|
|
15167
|
-
throw err2;
|
|
15168
|
-
}
|
|
15169
|
-
return fetch3(uri, requestOptions, data);
|
|
15170
|
-
}
|
|
15171
|
-
}
|
|
15172
|
-
}
|
|
15173
|
-
var fetch3;
|
|
15174
|
-
var init_https = __esm(() => {
|
|
15175
|
-
init_error();
|
|
15176
|
-
init_node_web_compat_node();
|
|
15177
|
-
fetch3 = nodeWebCompat.fetch.bind(undefined);
|
|
15178
|
-
});
|
|
15179
|
-
|
|
15180
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/safe-json-parse.js
|
|
15181
|
-
function isJsonObject(j) {
|
|
15182
|
-
return typeof j === "object" && !Array.isArray(j) && j !== null;
|
|
15183
|
-
}
|
|
15184
|
-
function safeJsonParse(s) {
|
|
15185
|
-
return JSON.parse(s, (_, value) => {
|
|
15186
|
-
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
15187
|
-
delete value.__proto__;
|
|
15188
|
-
delete value.constructor;
|
|
15189
|
-
}
|
|
15190
|
-
return value;
|
|
15191
|
-
});
|
|
15192
|
-
}
|
|
15193
|
-
|
|
15194
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/assert.js
|
|
15195
|
-
function assertStringEquals(name3, actual, expected, errorConstructor = FailedAssertionError) {
|
|
15196
|
-
if (!actual) {
|
|
15197
|
-
throw new errorConstructor(`Missing ${name3}. Expected: ${expected}`, actual, expected);
|
|
15198
|
-
}
|
|
15199
|
-
if (typeof actual !== "string") {
|
|
15200
|
-
throw new errorConstructor(`${name3} is not of type string`, actual, expected);
|
|
15201
|
-
}
|
|
15202
|
-
if (expected !== actual) {
|
|
15203
|
-
throw new errorConstructor(`${name3} not allowed: ${actual}. Expected: ${expected}`, actual, expected);
|
|
15204
|
-
}
|
|
15205
|
-
}
|
|
15206
|
-
function assertStringArrayContainsString(name3, actual, expected, errorConstructor = FailedAssertionError) {
|
|
15207
|
-
if (!actual) {
|
|
15208
|
-
throw new errorConstructor(`Missing ${name3}. ${expectationMessage(expected)}`, actual, expected);
|
|
15209
|
-
}
|
|
15210
|
-
if (typeof actual !== "string") {
|
|
15211
|
-
throw new errorConstructor(`${name3} is not of type string`, actual, expected);
|
|
15212
|
-
}
|
|
15213
|
-
return assertStringArraysOverlap(name3, actual, expected, errorConstructor);
|
|
15214
|
-
}
|
|
15215
|
-
function assertStringArraysOverlap(name3, actual, expected, errorConstructor = FailedAssertionError) {
|
|
15216
|
-
if (!actual) {
|
|
15217
|
-
throw new errorConstructor(`Missing ${name3}. ${expectationMessage(expected)}`, actual, expected);
|
|
15218
|
-
}
|
|
15219
|
-
const expectedAsSet = new Set(Array.isArray(expected) ? expected : [expected]);
|
|
15220
|
-
if (typeof actual === "string") {
|
|
15221
|
-
actual = [actual];
|
|
15222
|
-
}
|
|
15223
|
-
if (!Array.isArray(actual)) {
|
|
15224
|
-
throw new errorConstructor(`${name3} is not an array`, actual, expected);
|
|
15225
|
-
}
|
|
15226
|
-
const overlaps = actual.some((actualItem) => {
|
|
15227
|
-
if (typeof actualItem !== "string") {
|
|
15228
|
-
throw new errorConstructor(`${name3} includes elements that are not of type string`, actual, expected);
|
|
15229
|
-
}
|
|
15230
|
-
return expectedAsSet.has(actualItem);
|
|
15231
|
-
});
|
|
15232
|
-
if (!overlaps) {
|
|
15233
|
-
throw new errorConstructor(`${name3} not allowed: ${actual.join(", ")}. ${expectationMessage(expected)}`, actual, expected);
|
|
15234
|
-
}
|
|
15235
|
-
}
|
|
15236
|
-
function expectationMessage(expected) {
|
|
15237
|
-
if (Array.isArray(expected)) {
|
|
15238
|
-
if (expected.length > 1) {
|
|
15239
|
-
return `Expected one of: ${expected.join(", ")}`;
|
|
15240
|
-
}
|
|
15241
|
-
return `Expected: ${expected[0]}`;
|
|
15242
|
-
}
|
|
15243
|
-
return `Expected: ${expected}`;
|
|
15244
|
-
}
|
|
15245
|
-
function assertIsNotPromise(actual, errorFactory) {
|
|
15246
|
-
if (actual && typeof actual.then === "function") {
|
|
15247
|
-
throw errorFactory();
|
|
15248
|
-
}
|
|
15249
|
-
}
|
|
15250
|
-
var init_assert = __esm(() => {
|
|
15251
|
-
init_error();
|
|
15252
|
-
});
|
|
15253
|
-
|
|
15254
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/jwk.js
|
|
15255
|
-
function findJwkInJwks(jwks, kid) {
|
|
15256
|
-
return jwks.keys.find((jwk) => jwk.kid != null && jwk.kid === kid);
|
|
15257
|
-
}
|
|
15258
|
-
function assertIsJwks(jwks) {
|
|
15259
|
-
if (!jwks) {
|
|
15260
|
-
throw new JwksValidationError("JWKS empty");
|
|
15261
|
-
}
|
|
15262
|
-
if (!isJsonObject(jwks)) {
|
|
15263
|
-
throw new JwksValidationError("JWKS should be an object");
|
|
15264
|
-
}
|
|
15265
|
-
if (!Object.keys(jwks).includes("keys")) {
|
|
15266
|
-
throw new JwksValidationError("JWKS does not include keys");
|
|
15267
|
-
}
|
|
15268
|
-
if (!Array.isArray(jwks.keys)) {
|
|
15269
|
-
throw new JwksValidationError("JWKS keys should be an array");
|
|
15270
|
-
}
|
|
15271
|
-
for (const jwk of jwks.keys) {
|
|
15272
|
-
assertIsJwk(jwk);
|
|
15273
|
-
}
|
|
15274
|
-
}
|
|
15275
|
-
function assertIsSignatureJwk(jwk) {
|
|
15276
|
-
assertStringArrayContainsString("JWK kty", jwk.kty, ["EC", "RSA", "OKP"], JwkInvalidKtyError);
|
|
15277
|
-
if (jwk.kty === "EC") {
|
|
15278
|
-
assertIsEsSignatureJwk(jwk);
|
|
15279
|
-
} else if (jwk.kty === "RSA") {
|
|
15280
|
-
assertIsRsaSignatureJwk(jwk);
|
|
15281
|
-
} else if (jwk.kty === "OKP") {
|
|
15282
|
-
assertIsEdDSASignatureJwk(jwk);
|
|
15283
|
-
}
|
|
15284
|
-
}
|
|
15285
|
-
function assertIsEdDSASignatureJwk(jwk) {
|
|
15286
|
-
if (jwk.use) {
|
|
15287
|
-
assertStringEquals("JWK use", jwk.use, "sig", JwkInvalidUseError);
|
|
15288
|
-
}
|
|
15289
|
-
assertStringEquals("JWK kty", jwk.kty, "OKP", JwkInvalidKtyError);
|
|
15290
|
-
if (!jwk.crv)
|
|
15291
|
-
throw new JwkValidationError("Missing Curve (crv)");
|
|
15292
|
-
if (!jwk.x)
|
|
15293
|
-
throw new JwkValidationError("Missing X Coordinate (x)");
|
|
15294
|
-
}
|
|
15295
|
-
function assertIsEsSignatureJwk(jwk) {
|
|
15296
|
-
if (jwk.use) {
|
|
15297
|
-
assertStringEquals("JWK use", jwk.use, "sig", JwkInvalidUseError);
|
|
15298
|
-
}
|
|
15299
|
-
assertStringEquals("JWK kty", jwk.kty, "EC", JwkInvalidKtyError);
|
|
15300
|
-
if (!jwk.crv)
|
|
15301
|
-
throw new JwkValidationError("Missing Curve (crv)");
|
|
15302
|
-
if (!jwk.x)
|
|
15303
|
-
throw new JwkValidationError("Missing X Coordinate (x)");
|
|
15304
|
-
if (!jwk.y)
|
|
15305
|
-
throw new JwkValidationError("Missing Y Coordinate (y)");
|
|
15306
|
-
}
|
|
15307
|
-
function assertIsRsaSignatureJwk(jwk) {
|
|
15308
|
-
if (jwk.use) {
|
|
15309
|
-
assertStringEquals("JWK use", jwk.use, "sig", JwkInvalidUseError);
|
|
15310
|
-
}
|
|
15311
|
-
assertStringEquals("JWK kty", jwk.kty, "RSA", JwkInvalidKtyError);
|
|
15312
|
-
if (!jwk.n)
|
|
15313
|
-
throw new JwkValidationError("Missing modulus (n)");
|
|
15314
|
-
if (!jwk.e)
|
|
15315
|
-
throw new JwkValidationError("Missing exponent (e)");
|
|
15316
|
-
}
|
|
15317
|
-
function assertIsJwk(jwk) {
|
|
15318
|
-
if (!jwk) {
|
|
15319
|
-
throw new JwkValidationError("JWK empty");
|
|
15320
|
-
}
|
|
15321
|
-
if (!isJsonObject(jwk)) {
|
|
15322
|
-
throw new JwkValidationError("JWK should be an object");
|
|
15323
|
-
}
|
|
15324
|
-
for (const field of mandatoryJwkFieldNames) {
|
|
15325
|
-
if (typeof jwk[field] !== "string") {
|
|
15326
|
-
throw new JwkValidationError(`JWK ${field} should be a string`);
|
|
15327
|
-
}
|
|
15328
|
-
}
|
|
15329
|
-
for (const field of optionalJwkFieldNames) {
|
|
15330
|
-
if (field in jwk && typeof jwk[field] !== "string") {
|
|
15331
|
-
throw new JwkValidationError(`JWK ${field} should be a string`);
|
|
15332
|
-
}
|
|
15333
|
-
}
|
|
15334
|
-
}
|
|
15335
|
-
function isJwks(jwks) {
|
|
15336
|
-
try {
|
|
15337
|
-
assertIsJwks(jwks);
|
|
15338
|
-
return true;
|
|
15339
|
-
} catch {
|
|
15340
|
-
return false;
|
|
15341
|
-
}
|
|
15342
|
-
}
|
|
15343
|
-
function isJwk(jwk) {
|
|
15344
|
-
try {
|
|
15345
|
-
assertIsJwk(jwk);
|
|
15346
|
-
return true;
|
|
15347
|
-
} catch {
|
|
15348
|
-
return false;
|
|
15349
|
-
}
|
|
15350
|
-
}
|
|
15351
|
-
|
|
15352
|
-
class SimplePenaltyBox {
|
|
15353
|
-
constructor(props) {
|
|
15354
|
-
this.waitingUris = new Map;
|
|
15355
|
-
this.waitSeconds = props?.waitSeconds ?? 10;
|
|
15356
|
-
}
|
|
15357
|
-
async wait(jwksUri) {
|
|
15358
|
-
if (this.waitingUris.has(jwksUri)) {
|
|
15359
|
-
throw new WaitPeriodNotYetEndedJwkError("Not allowed to fetch JWKS yet, still waiting for back off period to end");
|
|
15360
|
-
}
|
|
15361
|
-
}
|
|
15362
|
-
release(jwksUri) {
|
|
15363
|
-
const i2 = this.waitingUris.get(jwksUri);
|
|
15364
|
-
if (i2) {
|
|
15365
|
-
clearTimeout(i2);
|
|
15366
|
-
this.waitingUris.delete(jwksUri);
|
|
15367
|
-
}
|
|
15368
|
-
}
|
|
15369
|
-
registerFailedAttempt(jwksUri) {
|
|
15370
|
-
const i2 = nodeWebCompat.setTimeoutUnref(() => {
|
|
15371
|
-
this.waitingUris.delete(jwksUri);
|
|
15372
|
-
}, this.waitSeconds * 1000);
|
|
15373
|
-
this.waitingUris.set(jwksUri, i2);
|
|
15374
|
-
}
|
|
15375
|
-
registerSuccessfulAttempt(jwksUri) {
|
|
15376
|
-
this.release(jwksUri);
|
|
15377
|
-
}
|
|
15378
|
-
}
|
|
15379
|
-
|
|
15380
|
-
class SimpleJwksCache {
|
|
15381
|
-
constructor(props) {
|
|
15382
|
-
this.jwksCache = new Map;
|
|
15383
|
-
this.fetchingJwks = new Map;
|
|
15384
|
-
this.penaltyBox = props?.penaltyBox ?? new SimplePenaltyBox;
|
|
15385
|
-
this.fetcher = props?.fetcher ?? new SimpleFetcher;
|
|
15386
|
-
this.jwksParser = props?.jwksParser ?? parseJwks;
|
|
15387
|
-
}
|
|
15388
|
-
addJwks(jwksUri, jwks) {
|
|
15389
|
-
this.jwksCache.set(jwksUri, jwks);
|
|
15390
|
-
}
|
|
15391
|
-
async getJwks(jwksUri) {
|
|
15392
|
-
const existingFetch = this.fetchingJwks.get(jwksUri);
|
|
15393
|
-
if (existingFetch) {
|
|
15394
|
-
return existingFetch;
|
|
15395
|
-
}
|
|
15396
|
-
const jwksPromise = this.fetcher.fetch(jwksUri).then(this.jwksParser);
|
|
15397
|
-
this.fetchingJwks.set(jwksUri, jwksPromise);
|
|
15398
|
-
let jwks;
|
|
15399
|
-
try {
|
|
15400
|
-
jwks = await jwksPromise;
|
|
15401
|
-
} finally {
|
|
15402
|
-
this.fetchingJwks.delete(jwksUri);
|
|
15403
|
-
}
|
|
15404
|
-
this.jwksCache.set(jwksUri, jwks);
|
|
15405
|
-
return jwks;
|
|
15406
|
-
}
|
|
15407
|
-
getCachedJwk(jwksUri, decomposedJwt) {
|
|
15408
|
-
if (typeof decomposedJwt.header.kid !== "string") {
|
|
15409
|
-
throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");
|
|
15410
|
-
}
|
|
15411
|
-
if (!this.jwksCache.has(jwksUri)) {
|
|
15412
|
-
throw new JwksNotAvailableInCacheError(`JWKS for uri ${jwksUri} not yet available in cache`);
|
|
15413
|
-
}
|
|
15414
|
-
const jwk = findJwkInJwks(this.jwksCache.get(jwksUri), decomposedJwt.header.kid);
|
|
15415
|
-
if (!jwk) {
|
|
15416
|
-
throw new KidNotFoundInJwksError(`JWK for kid ${decomposedJwt.header.kid} not found in the JWKS`);
|
|
15417
|
-
}
|
|
15418
|
-
return jwk;
|
|
15419
|
-
}
|
|
15420
|
-
async getJwk(jwksUri, decomposedJwt) {
|
|
15421
|
-
if (typeof decomposedJwt.header.kid !== "string") {
|
|
15422
|
-
throw new JwtWithoutValidKidError("JWT header does not have valid kid claim");
|
|
15423
|
-
}
|
|
15424
|
-
const cachedJwks = this.jwksCache.get(jwksUri);
|
|
15425
|
-
if (cachedJwks) {
|
|
15426
|
-
const cachedJwk = findJwkInJwks(cachedJwks, decomposedJwt.header.kid);
|
|
15427
|
-
if (cachedJwk) {
|
|
15428
|
-
return cachedJwk;
|
|
15429
|
-
}
|
|
15430
|
-
}
|
|
15431
|
-
await this.penaltyBox.wait(jwksUri, decomposedJwt.header.kid);
|
|
15432
|
-
const jwks = await this.getJwks(jwksUri);
|
|
15433
|
-
const jwk = findJwkInJwks(jwks, decomposedJwt.header.kid);
|
|
15434
|
-
if (!jwk) {
|
|
15435
|
-
this.penaltyBox.registerFailedAttempt(jwksUri, decomposedJwt.header.kid);
|
|
15436
|
-
throw new KidNotFoundInJwksError(`JWK for kid "${decomposedJwt.header.kid}" not found in the JWKS`);
|
|
15437
|
-
} else {
|
|
15438
|
-
this.penaltyBox.registerSuccessfulAttempt(jwksUri, decomposedJwt.header.kid);
|
|
15439
|
-
}
|
|
15440
|
-
return jwk;
|
|
15441
|
-
}
|
|
15442
|
-
}
|
|
15443
|
-
var optionalJwkFieldNames, mandatoryJwkFieldNames, parseJwks = function(jwksBin) {
|
|
15444
|
-
let jwks;
|
|
15445
|
-
try {
|
|
15446
|
-
const jwksText = new TextDecoder("utf8", {
|
|
15447
|
-
fatal: true,
|
|
15448
|
-
ignoreBOM: true
|
|
15449
|
-
}).decode(jwksBin);
|
|
15450
|
-
jwks = safeJsonParse(jwksText);
|
|
15451
|
-
} catch (err2) {
|
|
15452
|
-
throw new JwksValidationError(`JWKS could not be parsed as JSON: ${err2}`);
|
|
15453
|
-
}
|
|
15454
|
-
assertIsJwks(jwks);
|
|
15455
|
-
return jwks;
|
|
15456
|
-
};
|
|
15457
|
-
var init_jwk = __esm(() => {
|
|
15458
|
-
init_https();
|
|
15459
|
-
init_error();
|
|
15460
|
-
init_node_web_compat_node();
|
|
15461
|
-
init_assert();
|
|
15462
|
-
optionalJwkFieldNames = [
|
|
15463
|
-
"use",
|
|
15464
|
-
"alg",
|
|
15465
|
-
"kid",
|
|
15466
|
-
"n",
|
|
15467
|
-
"e",
|
|
15468
|
-
"x",
|
|
15469
|
-
"y",
|
|
15470
|
-
"crv"
|
|
15471
|
-
];
|
|
15472
|
-
mandatoryJwkFieldNames = [
|
|
15473
|
-
"kty"
|
|
15474
|
-
];
|
|
15475
|
-
});
|
|
15476
|
-
|
|
15477
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/jwt.js
|
|
15478
|
-
function assertJwtHeader(header) {
|
|
15479
|
-
if (!isJsonObject(header)) {
|
|
15480
|
-
throw new JwtParseError("JWT header is not an object");
|
|
15481
|
-
}
|
|
15482
|
-
if (header.alg !== undefined && typeof header.alg !== "string") {
|
|
15483
|
-
throw new JwtParseError("JWT header alg claim is not a string");
|
|
15484
|
-
}
|
|
15485
|
-
if (header.kid !== undefined && typeof header.kid !== "string") {
|
|
15486
|
-
throw new JwtParseError("JWT header kid claim is not a string");
|
|
15487
|
-
}
|
|
15488
|
-
}
|
|
15489
|
-
function assertJwtPayload(payload) {
|
|
15490
|
-
if (!isJsonObject(payload)) {
|
|
15491
|
-
throw new JwtParseError("JWT payload is not an object");
|
|
15492
|
-
}
|
|
15493
|
-
if (payload.exp !== undefined && !Number.isFinite(payload.exp)) {
|
|
15494
|
-
throw new JwtParseError("JWT payload exp claim is not a number");
|
|
15495
|
-
}
|
|
15496
|
-
if (payload.iss !== undefined && typeof payload.iss !== "string") {
|
|
15497
|
-
throw new JwtParseError("JWT payload iss claim is not a string");
|
|
15498
|
-
}
|
|
15499
|
-
if (payload.sub !== undefined && typeof payload.sub !== "string") {
|
|
15500
|
-
throw new JwtParseError("JWT payload sub claim is not a string");
|
|
15501
|
-
}
|
|
15502
|
-
if (payload.aud !== undefined && typeof payload.aud !== "string" && (!Array.isArray(payload.aud) || payload.aud.some((aud) => typeof aud !== "string"))) {
|
|
15503
|
-
throw new JwtParseError("JWT payload aud claim is not a string or array of strings");
|
|
15504
|
-
}
|
|
15505
|
-
if (payload.nbf !== undefined && !Number.isFinite(payload.nbf)) {
|
|
15506
|
-
throw new JwtParseError("JWT payload nbf claim is not a number");
|
|
15507
|
-
}
|
|
15508
|
-
if (payload.iat !== undefined && !Number.isFinite(payload.iat)) {
|
|
15509
|
-
throw new JwtParseError("JWT payload iat claim is not a number");
|
|
15510
|
-
}
|
|
15511
|
-
if (payload.scope !== undefined && typeof payload.scope !== "string") {
|
|
15512
|
-
throw new JwtParseError("JWT payload scope claim is not a string");
|
|
15513
|
-
}
|
|
15514
|
-
if (payload.jti !== undefined && typeof payload.jti !== "string") {
|
|
15515
|
-
throw new JwtParseError("JWT payload jti claim is not a string");
|
|
15516
|
-
}
|
|
15517
|
-
}
|
|
15518
|
-
function decomposeUnverifiedJwt(jwt) {
|
|
15519
|
-
if (!jwt) {
|
|
15520
|
-
throw new JwtParseError("Empty JWT");
|
|
15521
|
-
}
|
|
15522
|
-
if (typeof jwt !== "string") {
|
|
15523
|
-
throw new JwtParseError("JWT is not a string");
|
|
15524
|
-
}
|
|
15525
|
-
if (!JWT_REGEX.test(jwt)) {
|
|
15526
|
-
throw new JwtParseError("JWT string does not consist of exactly 3 parts (header, payload, signature)");
|
|
15527
|
-
}
|
|
15528
|
-
const [headerB64, payloadB64, signatureB64] = jwt.split(".");
|
|
15529
|
-
const [headerString, payloadString] = [headerB64, payloadB64].map(nodeWebCompat.parseB64UrlString);
|
|
15530
|
-
let header;
|
|
15531
|
-
try {
|
|
15532
|
-
header = safeJsonParse(headerString);
|
|
15533
|
-
} catch (err2) {
|
|
15534
|
-
throw new JwtParseError("Invalid JWT. Header is not a valid JSON object", err2);
|
|
15535
|
-
}
|
|
15536
|
-
assertJwtHeader(header);
|
|
15537
|
-
let payload;
|
|
15538
|
-
try {
|
|
15539
|
-
payload = safeJsonParse(payloadString);
|
|
15540
|
-
} catch (err2) {
|
|
15541
|
-
throw new JwtParseError("Invalid JWT. Payload is not a valid JSON object", err2);
|
|
15542
|
-
}
|
|
15543
|
-
assertJwtPayload(payload);
|
|
15544
|
-
return {
|
|
15545
|
-
header,
|
|
15546
|
-
headerB64,
|
|
15547
|
-
payload,
|
|
15548
|
-
payloadB64,
|
|
15549
|
-
signatureB64
|
|
15550
|
-
};
|
|
15551
|
-
}
|
|
15552
|
-
function validateJwtFields(payload, options) {
|
|
15553
|
-
if (payload.exp !== undefined) {
|
|
15554
|
-
if (payload.exp + (options.graceSeconds ?? 0) < Date.now() / 1000) {
|
|
15555
|
-
throw new JwtExpiredError(`Token expired at ${new Date(payload.exp * 1000).toISOString()}`, payload.exp);
|
|
15556
|
-
}
|
|
15557
|
-
}
|
|
15558
|
-
if (payload.nbf !== undefined) {
|
|
15559
|
-
if (payload.nbf - (options.graceSeconds ?? 0) > Date.now() / 1000) {
|
|
15560
|
-
throw new JwtNotBeforeError(`Token can't be used before ${new Date(payload.nbf * 1000).toISOString()}`, payload.nbf);
|
|
15561
|
-
}
|
|
15562
|
-
}
|
|
15563
|
-
if (options.issuer !== null) {
|
|
15564
|
-
if (options.issuer === undefined) {
|
|
15565
|
-
throw new ParameterValidationError("issuer must be provided or set to null explicitly");
|
|
15566
|
-
}
|
|
15567
|
-
assertStringArrayContainsString("Issuer", payload.iss, options.issuer, JwtInvalidIssuerError);
|
|
15568
|
-
}
|
|
15569
|
-
if (options.audience !== null) {
|
|
15570
|
-
if (options.audience === undefined) {
|
|
15571
|
-
throw new ParameterValidationError("audience must be provided or set to null explicitly");
|
|
15572
|
-
}
|
|
15573
|
-
assertStringArraysOverlap("Audience", payload.aud, options.audience, JwtInvalidAudienceError);
|
|
15574
|
-
}
|
|
15575
|
-
if (options.scope != null) {
|
|
15576
|
-
assertStringArraysOverlap("Scope", payload.scope?.split(" "), options.scope, JwtInvalidScopeError);
|
|
15577
|
-
}
|
|
15578
|
-
}
|
|
15579
|
-
var JWT_REGEX;
|
|
15580
|
-
var init_jwt = __esm(() => {
|
|
15581
|
-
init_assert();
|
|
15582
|
-
init_error();
|
|
15583
|
-
init_node_web_compat_node();
|
|
15584
|
-
JWT_REGEX = /^[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}\.[A-Za-z0-9_-]+={0,2}$/;
|
|
15585
|
-
});
|
|
15586
|
-
|
|
15587
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/jwt-verifier.js
|
|
15588
|
-
function validateJwtHeaderAndJwk(header, jwk) {
|
|
15589
|
-
assertIsSignatureJwk(jwk);
|
|
15590
|
-
if (jwk.alg) {
|
|
15591
|
-
assertStringEquals("JWT signature algorithm", header.alg, jwk.alg, JwtInvalidSignatureAlgorithmError);
|
|
15592
|
-
}
|
|
15593
|
-
assertStringArrayContainsString("JWT signature algorithm", header.alg, supportedSignatureAlgorithms, JwtInvalidSignatureAlgorithmError);
|
|
15594
|
-
}
|
|
15595
|
-
async function verifyDecomposedJwt(decomposedJwt, jwksUri, options, jwkFetcher, transformJwkToKeyObjectFn) {
|
|
15596
|
-
const { header, headerB64, payload, payloadB64, signatureB64 } = decomposedJwt;
|
|
15597
|
-
const jwk = await jwkFetcher(jwksUri, decomposedJwt);
|
|
15598
|
-
validateJwtHeaderAndJwk(decomposedJwt.header, jwk);
|
|
15599
|
-
const keyObject = await transformJwkToKeyObjectFn(jwk, header.alg, payload.iss);
|
|
15600
|
-
const valid = await nodeWebCompat.verifySignatureAsync({
|
|
15601
|
-
jwsSigningInput: `${headerB64}.${payloadB64}`,
|
|
15602
|
-
signature: signatureB64,
|
|
15603
|
-
alg: header.alg,
|
|
15604
|
-
keyObject
|
|
15605
|
-
});
|
|
15606
|
-
if (!valid) {
|
|
15607
|
-
throw new JwtInvalidSignatureError("Invalid signature");
|
|
15608
|
-
}
|
|
15609
|
-
try {
|
|
15610
|
-
validateJwtFields(payload, options);
|
|
15611
|
-
if (options.customJwtCheck) {
|
|
15612
|
-
await options.customJwtCheck({ header, payload, jwk });
|
|
15613
|
-
}
|
|
15614
|
-
} catch (err2) {
|
|
15615
|
-
if (options.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
|
|
15616
|
-
throw err2.withRawJwt(decomposedJwt);
|
|
15617
|
-
}
|
|
15618
|
-
throw err2;
|
|
15619
|
-
}
|
|
15620
|
-
return payload;
|
|
15621
|
-
}
|
|
15622
|
-
function verifyDecomposedJwtSync(decomposedJwt, jwkOrJwks, options, transformJwkToKeyObjectFn) {
|
|
15623
|
-
const { header, headerB64, payload, payloadB64, signatureB64 } = decomposedJwt;
|
|
15624
|
-
let jwk;
|
|
15625
|
-
if (isJwk(jwkOrJwks)) {
|
|
15626
|
-
jwk = jwkOrJwks;
|
|
15627
|
-
} else if (isJwks(jwkOrJwks)) {
|
|
15628
|
-
const locatedJwk = header.kid ? findJwkInJwks(jwkOrJwks, header.kid) : undefined;
|
|
15629
|
-
if (!locatedJwk) {
|
|
15630
|
-
throw new KidNotFoundInJwksError(`JWK for kid ${header.kid} not found in the JWKS`);
|
|
15631
|
-
}
|
|
15632
|
-
jwk = locatedJwk;
|
|
15633
|
-
} else {
|
|
15634
|
-
throw new ParameterValidationError([
|
|
15635
|
-
`Expected a valid JWK or JWKS (parsed as JavaScript object), but received: ${jwkOrJwks}.`,
|
|
15636
|
-
"If you're passing a JWKS URI, use the async verify() method instead, it will download and parse the JWKS for you"
|
|
15637
|
-
].join());
|
|
15638
|
-
}
|
|
15639
|
-
validateJwtHeaderAndJwk(decomposedJwt.header, jwk);
|
|
15640
|
-
const keyObject = transformJwkToKeyObjectFn(jwk, header.alg, payload.iss);
|
|
15641
|
-
const valid = nodeWebCompat.verifySignatureSync({
|
|
15642
|
-
jwsSigningInput: `${headerB64}.${payloadB64}`,
|
|
15643
|
-
signature: signatureB64,
|
|
15644
|
-
alg: header.alg,
|
|
15645
|
-
keyObject
|
|
15646
|
-
});
|
|
15647
|
-
if (!valid) {
|
|
15648
|
-
throw new JwtInvalidSignatureError("Invalid signature");
|
|
15649
|
-
}
|
|
15650
|
-
try {
|
|
15651
|
-
validateJwtFields(payload, options);
|
|
15652
|
-
if (options.customJwtCheck) {
|
|
15653
|
-
const res = options.customJwtCheck({ header, payload, jwk });
|
|
15654
|
-
assertIsNotPromise(res, () => new ParameterValidationError("Custom JWT checks must be synchronous but a promise was returned"));
|
|
15655
|
-
}
|
|
15656
|
-
} catch (err2) {
|
|
15657
|
-
if (options.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
|
|
15658
|
-
throw err2.withRawJwt(decomposedJwt);
|
|
15659
|
-
}
|
|
15660
|
-
throw err2;
|
|
14968
|
+
// ../api-core/src/services/logs.service.ts
|
|
14969
|
+
class LogsService {
|
|
14970
|
+
ctx;
|
|
14971
|
+
constructor(ctx) {
|
|
14972
|
+
this.ctx = ctx;
|
|
15661
14973
|
}
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
this.issuersConfig = new Map;
|
|
15669
|
-
this.publicKeyCache = new KeyObjectCache;
|
|
15670
|
-
if (Array.isArray(verifyProperties)) {
|
|
15671
|
-
if (!verifyProperties.length) {
|
|
15672
|
-
throw new ParameterValidationError("Provide at least one issuer configuration");
|
|
15673
|
-
}
|
|
15674
|
-
verifyProperties.forEach((prop, index2) => {
|
|
15675
|
-
if (this.issuersConfig.has(prop.issuer)) {
|
|
15676
|
-
throw new ParameterValidationError(`issuer ${prop.issuer} supplied multiple times`);
|
|
15677
|
-
} else if (prop.issuer === null && verifyProperties.length >= 2) {
|
|
15678
|
-
throw new ParameterValidationError(`issuer cannot be null when multiple issuers are supplied (at issuer: ${index2})`);
|
|
15679
|
-
}
|
|
15680
|
-
this.issuersConfig.set(prop.issuer, this.withJwksUri(prop));
|
|
14974
|
+
async generateToken(user, slug2, environment) {
|
|
14975
|
+
const db2 = this.ctx.db;
|
|
14976
|
+
if (user.role === "admin") {
|
|
14977
|
+
const game = await db2.query.games.findFirst({
|
|
14978
|
+
where: eq(games.slug, slug2),
|
|
14979
|
+
columns: { id: true }
|
|
15681
14980
|
});
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
}
|
|
15685
|
-
}
|
|
15686
|
-
getIssuerConfig(issuer) {
|
|
15687
|
-
if (this.issuersConfig.size === 1) {
|
|
15688
|
-
issuer = this.issuersConfig.keys().next().value;
|
|
15689
|
-
}
|
|
15690
|
-
if (issuer === undefined) {
|
|
15691
|
-
throw new ParameterValidationError("issuer must be provided");
|
|
15692
|
-
}
|
|
15693
|
-
const config2 = this.issuersConfig.get(issuer);
|
|
15694
|
-
if (!config2) {
|
|
15695
|
-
throw new ParameterValidationError(`issuer not configured: ${issuer}`);
|
|
15696
|
-
}
|
|
15697
|
-
return config2;
|
|
15698
|
-
}
|
|
15699
|
-
cacheJwks(...[jwks, issuer]) {
|
|
15700
|
-
const issuerConfig = this.getIssuerConfig(issuer);
|
|
15701
|
-
this.jwksCache.addJwks(issuerConfig.jwksUri, jwks);
|
|
15702
|
-
this.publicKeyCache.clearCache(issuerConfig.issuer);
|
|
15703
|
-
}
|
|
15704
|
-
async hydrate() {
|
|
15705
|
-
const jwksFetches = Array.from(this.issuersConfig.values()).map(({ jwksUri }) => this.jwksCache.getJwks(jwksUri));
|
|
15706
|
-
await Promise.all(jwksFetches);
|
|
15707
|
-
}
|
|
15708
|
-
verifySync(...[jwt, properties]) {
|
|
15709
|
-
const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
|
|
15710
|
-
return this.verifyDecomposedJwtSync(decomposedJwt, jwksUri, verifyProperties);
|
|
15711
|
-
}
|
|
15712
|
-
verifyDecomposedJwtSync(decomposedJwt, jwksUri, verifyProperties) {
|
|
15713
|
-
const jwk = this.jwksCache.getCachedJwk(jwksUri, decomposedJwt);
|
|
15714
|
-
return verifyDecomposedJwtSync(decomposedJwt, jwk, verifyProperties, this.publicKeyCache.transformJwkToKeyObjectSync.bind(this.publicKeyCache));
|
|
15715
|
-
}
|
|
15716
|
-
async verify(...[jwt, properties]) {
|
|
15717
|
-
const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
|
|
15718
|
-
return this.verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties);
|
|
15719
|
-
}
|
|
15720
|
-
verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties) {
|
|
15721
|
-
return verifyDecomposedJwt(decomposedJwt, jwksUri, verifyProperties, this.jwksCache.getJwk.bind(this.jwksCache), this.publicKeyCache.transformJwkToKeyObjectAsync.bind(this.publicKeyCache));
|
|
15722
|
-
}
|
|
15723
|
-
getVerifyParameters(jwt, verifyProperties) {
|
|
15724
|
-
const decomposedJwt = decomposeUnverifiedJwt(jwt);
|
|
15725
|
-
const issuerConfig = this.getIssuerConfig(decomposedJwt.payload.iss);
|
|
15726
|
-
return {
|
|
15727
|
-
decomposedJwt,
|
|
15728
|
-
jwksUri: issuerConfig.jwksUri,
|
|
15729
|
-
verifyProperties: {
|
|
15730
|
-
...issuerConfig,
|
|
15731
|
-
...verifyProperties
|
|
14981
|
+
if (!game) {
|
|
14982
|
+
throw new NotFoundError("Game", slug2);
|
|
15732
14983
|
}
|
|
15733
|
-
|
|
15734
|
-
}
|
|
15735
|
-
withJwksUri(config2) {
|
|
15736
|
-
if (config2.jwksUri) {
|
|
15737
|
-
return config2;
|
|
15738
|
-
}
|
|
15739
|
-
const issuer = config2.issuer;
|
|
15740
|
-
if (!issuer) {
|
|
15741
|
-
throw new ParameterValidationError("jwksUri must be provided for issuer null");
|
|
15742
|
-
}
|
|
15743
|
-
const issuerUri = new URL(issuer).pathname.replace(/\/$/, "");
|
|
15744
|
-
return {
|
|
15745
|
-
jwksUri: new URL(`${issuerUri}/.well-known/jwks.json`, issuer).href,
|
|
15746
|
-
...config2
|
|
15747
|
-
};
|
|
15748
|
-
}
|
|
15749
|
-
}
|
|
15750
|
-
|
|
15751
|
-
class KeyObjectCache {
|
|
15752
|
-
constructor(transformJwkToKeyObjectSyncFn = nodeWebCompat.transformJwkToKeyObjectSync, transformJwkToKeyObjectAsyncFn = nodeWebCompat.transformJwkToKeyObjectAsync) {
|
|
15753
|
-
this.transformJwkToKeyObjectSyncFn = transformJwkToKeyObjectSyncFn;
|
|
15754
|
-
this.transformJwkToKeyObjectAsyncFn = transformJwkToKeyObjectAsyncFn;
|
|
15755
|
-
this.publicKeys = new Map;
|
|
15756
|
-
}
|
|
15757
|
-
transformJwkToKeyObjectSync(jwk, jwtHeaderAlg, issuer) {
|
|
15758
|
-
const alg = jwk.alg ?? jwtHeaderAlg;
|
|
15759
|
-
if (!issuer || !jwk.kid || !alg) {
|
|
15760
|
-
return this.transformJwkToKeyObjectSyncFn(jwk, alg, issuer);
|
|
15761
|
-
}
|
|
15762
|
-
const fromCache = this.publicKeys.get(issuer)?.get(jwk.kid)?.get(alg);
|
|
15763
|
-
if (fromCache)
|
|
15764
|
-
return fromCache;
|
|
15765
|
-
const publicKey = this.transformJwkToKeyObjectSyncFn(jwk, alg, issuer);
|
|
15766
|
-
this.putKeyObjectInCache(issuer, jwk.kid, alg, publicKey);
|
|
15767
|
-
return publicKey;
|
|
15768
|
-
}
|
|
15769
|
-
async transformJwkToKeyObjectAsync(jwk, jwtHeaderAlg, issuer) {
|
|
15770
|
-
const alg = jwk.alg ?? jwtHeaderAlg;
|
|
15771
|
-
if (!issuer || !jwk.kid || !alg) {
|
|
15772
|
-
return this.transformJwkToKeyObjectAsyncFn(jwk, alg, issuer);
|
|
15773
|
-
}
|
|
15774
|
-
const fromCache = this.publicKeys.get(issuer)?.get(jwk.kid)?.get(alg);
|
|
15775
|
-
if (fromCache)
|
|
15776
|
-
return fromCache;
|
|
15777
|
-
const publicKey = await this.transformJwkToKeyObjectAsyncFn(jwk, alg, issuer);
|
|
15778
|
-
this.putKeyObjectInCache(issuer, jwk.kid, alg, publicKey);
|
|
15779
|
-
return publicKey;
|
|
15780
|
-
}
|
|
15781
|
-
putKeyObjectInCache(issuer, kid, alg, publicKey) {
|
|
15782
|
-
const cachedIssuer = this.publicKeys.get(issuer);
|
|
15783
|
-
const cachedIssuerKid = cachedIssuer?.get(kid);
|
|
15784
|
-
if (cachedIssuerKid) {
|
|
15785
|
-
cachedIssuerKid.set(alg, publicKey);
|
|
15786
|
-
} else if (cachedIssuer) {
|
|
15787
|
-
cachedIssuer.set(kid, new Map([[alg, publicKey]]));
|
|
14984
|
+
logger16.info("Admin accessing game logs", { adminId: user.id, slug: slug2, environment });
|
|
15788
14985
|
} else {
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
this.publicKeys.delete(issuer);
|
|
15794
|
-
}
|
|
15795
|
-
}
|
|
15796
|
-
var supportedSignatureAlgorithms, JwtVerifier;
|
|
15797
|
-
var init_jwt_verifier = __esm(() => {
|
|
15798
|
-
init_jwk();
|
|
15799
|
-
init_assert();
|
|
15800
|
-
init_jwt();
|
|
15801
|
-
init_error();
|
|
15802
|
-
init_node_web_compat_node();
|
|
15803
|
-
supportedSignatureAlgorithms = [
|
|
15804
|
-
"RS256",
|
|
15805
|
-
"RS384",
|
|
15806
|
-
"RS512",
|
|
15807
|
-
"ES256",
|
|
15808
|
-
"ES384",
|
|
15809
|
-
"ES512",
|
|
15810
|
-
"EdDSA"
|
|
15811
|
-
];
|
|
15812
|
-
JwtVerifier = class JwtVerifier extends JwtVerifierBase {
|
|
15813
|
-
static create(verifyProperties, additionalProperties) {
|
|
15814
|
-
return new this(verifyProperties, additionalProperties?.jwksCache);
|
|
15815
|
-
}
|
|
15816
|
-
};
|
|
15817
|
-
});
|
|
15818
|
-
|
|
15819
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/cognito-verifier.js
|
|
15820
|
-
function validateCognitoJwtFields(payload, options) {
|
|
15821
|
-
if (options.groups != null) {
|
|
15822
|
-
assertStringArraysOverlap("Cognito group", payload["cognito:groups"], options.groups, CognitoJwtInvalidGroupError);
|
|
15823
|
-
}
|
|
15824
|
-
assertStringArrayContainsString("Token use", payload.token_use, ["id", "access"], CognitoJwtInvalidTokenUseError);
|
|
15825
|
-
if (options.tokenUse !== null) {
|
|
15826
|
-
if (options.tokenUse === undefined) {
|
|
15827
|
-
throw new ParameterValidationError("tokenUse must be provided or set to null explicitly");
|
|
15828
|
-
}
|
|
15829
|
-
assertStringEquals("Token use", payload.token_use, options.tokenUse, CognitoJwtInvalidTokenUseError);
|
|
15830
|
-
}
|
|
15831
|
-
if (options.clientId !== null) {
|
|
15832
|
-
if (options.clientId === undefined) {
|
|
15833
|
-
throw new ParameterValidationError("clientId must be provided or set to null explicitly");
|
|
15834
|
-
}
|
|
15835
|
-
if (payload.token_use === "id") {
|
|
15836
|
-
assertStringArrayContainsString('Client ID ("audience")', payload.aud, options.clientId, CognitoJwtInvalidClientIdError);
|
|
15837
|
-
} else {
|
|
15838
|
-
assertStringArrayContainsString("Client ID", payload.client_id, options.clientId, CognitoJwtInvalidClientIdError);
|
|
15839
|
-
}
|
|
15840
|
-
}
|
|
15841
|
-
}
|
|
15842
|
-
var CognitoJwtVerifier;
|
|
15843
|
-
var init_cognito_verifier = __esm(() => {
|
|
15844
|
-
init_error();
|
|
15845
|
-
init_jwt_verifier();
|
|
15846
|
-
init_assert();
|
|
15847
|
-
CognitoJwtVerifier = class CognitoJwtVerifier extends JwtVerifierBase {
|
|
15848
|
-
constructor(props, jwksCache) {
|
|
15849
|
-
const issuerConfig = Array.isArray(props) ? props.map((p) => ({
|
|
15850
|
-
...p,
|
|
15851
|
-
...CognitoJwtVerifier.parseUserPoolId(p.userPoolId),
|
|
15852
|
-
audience: null
|
|
15853
|
-
})) : {
|
|
15854
|
-
...props,
|
|
15855
|
-
...CognitoJwtVerifier.parseUserPoolId(props.userPoolId),
|
|
15856
|
-
audience: null
|
|
15857
|
-
};
|
|
15858
|
-
super(issuerConfig, jwksCache);
|
|
15859
|
-
}
|
|
15860
|
-
static parseUserPoolId(userPoolId) {
|
|
15861
|
-
const match = userPoolId.match(this.USER_POOL_ID_REGEX);
|
|
15862
|
-
if (!match) {
|
|
15863
|
-
throw new ParameterValidationError(`Invalid Cognito User Pool ID: ${userPoolId}`);
|
|
15864
|
-
}
|
|
15865
|
-
const region = match.groups.region;
|
|
15866
|
-
const issuer = `https://cognito-idp.${region}.amazonaws.com/${userPoolId}`;
|
|
15867
|
-
return {
|
|
15868
|
-
issuer,
|
|
15869
|
-
jwksUri: `${issuer}/.well-known/jwks.json`
|
|
15870
|
-
};
|
|
15871
|
-
}
|
|
15872
|
-
static create(verifyProperties, additionalProperties) {
|
|
15873
|
-
return new this(verifyProperties, additionalProperties?.jwksCache);
|
|
15874
|
-
}
|
|
15875
|
-
verifySync(...[jwt, properties]) {
|
|
15876
|
-
const { decomposedJwt, jwksUri, verifyProperties } = this.getVerifyParameters(jwt, properties);
|
|
15877
|
-
this.verifyDecomposedJwtSync(decomposedJwt, jwksUri, verifyProperties);
|
|
15878
|
-
try {
|
|
15879
|
-
validateCognitoJwtFields(decomposedJwt.payload, verifyProperties);
|
|
15880
|
-
} catch (err2) {
|
|
15881
|
-
if (verifyProperties.includeRawJwtInErrors && err2 instanceof JwtInvalidClaimError) {
|
|
15882
|
-
throw err2.withRawJwt(decomposedJwt);
|
|
15883
|
-
}
|
|
15884
|
-
throw err2;
|
|
14986
|
+
const isApprovedDev = user.developerStatus === "approved";
|
|
14987
|
+
if (!isApprovedDev) {
|
|
14988
|
+
logger16.warn("Unapproved developer attempted log access", { userId: user.id, slug: slug2 });
|
|
14989
|
+
throw new AccessDeniedError("Must be an approved developer");
|
|
15885
14990
|
}
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
}
|
|
15897
|
-
throw err2;
|
|
15898
|
-
}
|
|
15899
|
-
return decomposedJwt.payload;
|
|
15900
|
-
}
|
|
15901
|
-
cacheJwks(...[jwks, userPoolId]) {
|
|
15902
|
-
let issuer;
|
|
15903
|
-
if (userPoolId !== undefined) {
|
|
15904
|
-
issuer = CognitoJwtVerifier.parseUserPoolId(userPoolId).issuer;
|
|
15905
|
-
} else if (Array.from(this.issuersConfig).length > 1) {
|
|
15906
|
-
throw new ParameterValidationError("userPoolId must be provided");
|
|
14991
|
+
const game = await db2.query.games.findFirst({
|
|
14992
|
+
where: and(eq(games.slug, slug2), eq(games.developerId, user.id)),
|
|
14993
|
+
columns: { id: true }
|
|
14994
|
+
});
|
|
14995
|
+
if (!game) {
|
|
14996
|
+
logger16.warn("Developer attempted access to unowned game logs", {
|
|
14997
|
+
userId: user.id,
|
|
14998
|
+
slug: slug2
|
|
14999
|
+
});
|
|
15000
|
+
throw new NotFoundError("Game", slug2);
|
|
15907
15001
|
}
|
|
15908
|
-
const issuerConfig = this.getIssuerConfig(issuer);
|
|
15909
|
-
super.cacheJwks(jwks, issuerConfig.issuer);
|
|
15910
15002
|
}
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
}
|
|
15920
|
-
|
|
15921
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/alb-verifier.js
|
|
15922
|
-
var init_alb_verifier = __esm(() => {
|
|
15923
|
-
init_alb_cache();
|
|
15924
|
-
init_assert();
|
|
15925
|
-
init_error();
|
|
15926
|
-
init_jwt_verifier();
|
|
15927
|
-
});
|
|
15928
|
-
|
|
15929
|
-
// ../../node_modules/aws-jwt-verify/dist/esm/index.js
|
|
15930
|
-
var init_esm2 = __esm(() => {
|
|
15931
|
-
init_jwt_verifier();
|
|
15932
|
-
init_cognito_verifier();
|
|
15933
|
-
init_alb_verifier();
|
|
15934
|
-
init_jwt_verifier();
|
|
15935
|
-
});
|
|
15936
|
-
|
|
15937
|
-
// ../api-core/src/utils/lti.util.ts
|
|
15938
|
-
function generateUsername(email) {
|
|
15939
|
-
const baseUsername = (email.split("@")[0] || "user").toLowerCase();
|
|
15940
|
-
const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
|
|
15941
|
-
const randomSuffix = Math.random().toString(36).substring(2, 7);
|
|
15942
|
-
return `${cleanUsername}_${randomSuffix}`;
|
|
15943
|
-
}
|
|
15944
|
-
function extractRedirectPath(targetUri, currentHost) {
|
|
15945
|
-
try {
|
|
15946
|
-
const targetUrl = new URL(targetUri);
|
|
15947
|
-
if (targetUrl.hostname === currentHost) {
|
|
15948
|
-
return targetUrl.pathname + targetUrl.search;
|
|
15949
|
-
}
|
|
15950
|
-
} catch {}
|
|
15951
|
-
return "/";
|
|
15952
|
-
}
|
|
15953
|
-
function getLtiRoles(claims) {
|
|
15954
|
-
return claims["https://purl.imsglobal.org/spec/lti/claim/roles"] || [];
|
|
15955
|
-
}
|
|
15956
|
-
function hasLtiRole(claims, role) {
|
|
15957
|
-
return getLtiRoles(claims).some((r) => r.includes(role));
|
|
15958
|
-
}
|
|
15959
|
-
function validateLtiClaims(claims) {
|
|
15960
|
-
const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
|
|
15961
|
-
const version2 = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
|
|
15962
|
-
if (messageType !== "LtiResourceLinkRequest") {
|
|
15963
|
-
return `Invalid LTI message type: ${messageType}`;
|
|
15964
|
-
}
|
|
15965
|
-
if (version2 !== "1.3.0") {
|
|
15966
|
-
return `Unsupported LTI version: ${version2}`;
|
|
15003
|
+
const isProduction3 = environment === "production";
|
|
15004
|
+
const workerId = getDeploymentId(slug2, isProduction3);
|
|
15005
|
+
const token = await this.ctx.providers.auth.mintLogStreamToken(user.id, workerId);
|
|
15006
|
+
logger16.debug("Generated log stream token", {
|
|
15007
|
+
userId: user.id,
|
|
15008
|
+
slug: slug2,
|
|
15009
|
+
workerId
|
|
15010
|
+
});
|
|
15011
|
+
return { token, workerId };
|
|
15967
15012
|
}
|
|
15968
|
-
return null;
|
|
15969
15013
|
}
|
|
15970
|
-
var
|
|
15971
|
-
var
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
};
|
|
15014
|
+
var logger16;
|
|
15015
|
+
var init_logs_service = __esm(() => {
|
|
15016
|
+
init_drizzle_orm();
|
|
15017
|
+
init_tables_index();
|
|
15018
|
+
init_src2();
|
|
15019
|
+
init_errors();
|
|
15020
|
+
init_deployment_util();
|
|
15021
|
+
logger16 = log.scope("LogsService");
|
|
15979
15022
|
});
|
|
15980
15023
|
|
|
15981
15024
|
// ../api-core/src/services/lti.service.ts
|
|
15982
|
-
import * as crypto4 from "node:crypto";
|
|
15983
|
-
|
|
15984
15025
|
class LtiService {
|
|
15985
15026
|
ctx;
|
|
15986
|
-
verifier = null;
|
|
15987
15027
|
constructor(ctx) {
|
|
15988
15028
|
this.ctx = ctx;
|
|
15989
15029
|
}
|
|
15990
|
-
getConfig() {
|
|
15991
|
-
if (!this.ctx.config.lti) {
|
|
15992
|
-
logger16.error("LTI configuration not available");
|
|
15993
|
-
throw new ValidationError("LTI is not configured");
|
|
15994
|
-
}
|
|
15995
|
-
return this.ctx.config.lti;
|
|
15996
|
-
}
|
|
15997
|
-
getVerifier() {
|
|
15998
|
-
if (!this.verifier) {
|
|
15999
|
-
const lti = this.getConfig();
|
|
16000
|
-
this.verifier = JwtVerifier.create({
|
|
16001
|
-
issuer: lti.issuer,
|
|
16002
|
-
audience: lti.audience,
|
|
16003
|
-
jwksUri: lti.jwksUrl
|
|
16004
|
-
});
|
|
16005
|
-
}
|
|
16006
|
-
return this.verifier;
|
|
16007
|
-
}
|
|
16008
|
-
async verifyToken(idToken) {
|
|
16009
|
-
if (this.ctx.config.ltiTestMode) {
|
|
16010
|
-
if (!idToken.startsWith("mock:")) {
|
|
16011
|
-
throw new ValidationError("Invalid LTI token");
|
|
16012
|
-
}
|
|
16013
|
-
try {
|
|
16014
|
-
const jsonStr = Buffer.from(idToken.slice(5), "base64").toString();
|
|
16015
|
-
return JSON.parse(jsonStr);
|
|
16016
|
-
} catch {
|
|
16017
|
-
throw new ValidationError("Invalid LTI token format");
|
|
16018
|
-
}
|
|
16019
|
-
}
|
|
16020
|
-
try {
|
|
16021
|
-
const verifier = this.getVerifier();
|
|
16022
|
-
const claims = await verifier.verify(idToken);
|
|
16023
|
-
logger16.info("Verified token", {
|
|
16024
|
-
sub: claims.sub,
|
|
16025
|
-
email: claims.email,
|
|
16026
|
-
roles: claims["https://purl.imsglobal.org/spec/lti/claim/roles"]
|
|
16027
|
-
});
|
|
16028
|
-
return claims;
|
|
16029
|
-
} catch (error) {
|
|
16030
|
-
logger16.error("Token verification failed", {
|
|
16031
|
-
error: error instanceof Error ? error.message : String(error)
|
|
16032
|
-
});
|
|
16033
|
-
throw new ValidationError("Invalid LTI token");
|
|
16034
|
-
}
|
|
16035
|
-
}
|
|
16036
|
-
async processLaunch(idToken, currentHost) {
|
|
16037
|
-
const claims = await this.verifyToken(idToken);
|
|
16038
|
-
const validationError = validateLtiClaims(claims);
|
|
16039
|
-
if (validationError) {
|
|
16040
|
-
logger16.warn("LTI claims validation failed", {
|
|
16041
|
-
error: validationError,
|
|
16042
|
-
sub: claims.sub
|
|
16043
|
-
});
|
|
16044
|
-
throw new ValidationError(validationError);
|
|
16045
|
-
}
|
|
16046
|
-
const user = await this.provisionUser(claims);
|
|
16047
|
-
logger16.info("Processed launch roles", {
|
|
16048
|
-
userId: user.id,
|
|
16049
|
-
isLearner: LtiRoleChecks.isLearner(claims),
|
|
16050
|
-
isInstructor: LtiRoleChecks.isInstructor(claims),
|
|
16051
|
-
isAdministrator: LtiRoleChecks.isAdministrator(claims),
|
|
16052
|
-
allRoles: claims["https://purl.imsglobal.org/spec/lti/claim/roles"]
|
|
16053
|
-
});
|
|
16054
|
-
const sessionToken = await this.createSession(user.id);
|
|
16055
|
-
const targetUri = claims["https://purl.imsglobal.org/spec/lti/claim/target_link_uri"];
|
|
16056
|
-
const redirectPath = extractRedirectPath(targetUri, currentHost);
|
|
16057
|
-
logger16.info("Launch processed", { userId: user.id, redirectPath });
|
|
16058
|
-
const userInfo = {
|
|
16059
|
-
sub: user.id,
|
|
16060
|
-
email: user.email,
|
|
16061
|
-
name: user.name,
|
|
16062
|
-
email_verified: user.emailVerified,
|
|
16063
|
-
timeback_id: user.timebackId ?? undefined
|
|
16064
|
-
};
|
|
16065
|
-
return { user: userInfo, redirectPath, sessionToken };
|
|
16066
|
-
}
|
|
16067
15030
|
async getStatus(user) {
|
|
16068
15031
|
const db2 = this.ctx.db;
|
|
16069
15032
|
const [ltiAccount, oauthAccount, userRecord] = await Promise.all([
|
|
@@ -16087,134 +15050,11 @@ class LtiService {
|
|
|
16087
15050
|
userId: user.id
|
|
16088
15051
|
};
|
|
16089
15052
|
}
|
|
16090
|
-
async createSession(userId) {
|
|
16091
|
-
const db2 = this.ctx.db;
|
|
16092
|
-
const sessionToken = crypto4.randomUUID();
|
|
16093
|
-
const expiresAt = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000);
|
|
16094
|
-
const [session2] = await db2.insert(sessions).values({
|
|
16095
|
-
id: crypto4.randomUUID(),
|
|
16096
|
-
userId,
|
|
16097
|
-
token: sessionToken,
|
|
16098
|
-
expiresAt,
|
|
16099
|
-
createdAt: new Date,
|
|
16100
|
-
updatedAt: new Date
|
|
16101
|
-
}).returning({ id: sessions.id });
|
|
16102
|
-
if (!session2) {
|
|
16103
|
-
logger16.error("Session insert returned no rows", { userId });
|
|
16104
|
-
throw new InternalError("Failed to create session");
|
|
16105
|
-
}
|
|
16106
|
-
logger16.info("Created session", {
|
|
16107
|
-
userId,
|
|
16108
|
-
providerId: AUTH_PROVIDER_IDS.TIMEBACK_LTI
|
|
16109
|
-
});
|
|
16110
|
-
return sessionToken;
|
|
16111
|
-
}
|
|
16112
|
-
async provisionUser(claims) {
|
|
16113
|
-
const db2 = this.ctx.db;
|
|
16114
|
-
const email = claims.email;
|
|
16115
|
-
const ltiTimebackId = claims.sub;
|
|
16116
|
-
const providerId = AUTH_PROVIDER_IDS.TIMEBACK_LTI;
|
|
16117
|
-
if (!email) {
|
|
16118
|
-
throw new ValidationError("Email is required in LTI claims");
|
|
16119
|
-
}
|
|
16120
|
-
const existingAccount = await db2.query.accounts.findFirst({
|
|
16121
|
-
where: and(eq(accounts.accountId, ltiTimebackId), eq(accounts.providerId, providerId))
|
|
16122
|
-
});
|
|
16123
|
-
if (existingAccount) {
|
|
16124
|
-
const user = await db2.query.users.findFirst({
|
|
16125
|
-
where: eq(users.id, existingAccount.userId)
|
|
16126
|
-
});
|
|
16127
|
-
if (user) {
|
|
16128
|
-
logger16.info("Found user by account", {
|
|
16129
|
-
userId: user.id,
|
|
16130
|
-
ltiTimebackId
|
|
16131
|
-
});
|
|
16132
|
-
return user;
|
|
16133
|
-
}
|
|
16134
|
-
}
|
|
16135
|
-
const existingUser = await db2.query.users.findFirst({
|
|
16136
|
-
where: eq(users.email, email)
|
|
16137
|
-
});
|
|
16138
|
-
if (existingUser) {
|
|
16139
|
-
await db2.transaction(async (tx) => {
|
|
16140
|
-
const existingLtiAccount = await tx.query.accounts.findFirst({
|
|
16141
|
-
where: and(eq(accounts.userId, existingUser.id), eq(accounts.providerId, providerId))
|
|
16142
|
-
});
|
|
16143
|
-
if (!existingLtiAccount) {
|
|
16144
|
-
const [account] = await tx.insert(accounts).values({
|
|
16145
|
-
id: crypto4.randomUUID(),
|
|
16146
|
-
userId: existingUser.id,
|
|
16147
|
-
accountId: ltiTimebackId,
|
|
16148
|
-
providerId,
|
|
16149
|
-
accessToken: null,
|
|
16150
|
-
refreshToken: null,
|
|
16151
|
-
accessTokenExpiresAt: null,
|
|
16152
|
-
refreshTokenExpiresAt: null,
|
|
16153
|
-
createdAt: new Date,
|
|
16154
|
-
updatedAt: new Date
|
|
16155
|
-
}).returning({ id: accounts.id });
|
|
16156
|
-
if (!account) {
|
|
16157
|
-
logger16.error("LTI account link insert returned no rows", {
|
|
16158
|
-
userId: existingUser.id,
|
|
16159
|
-
ltiTimebackId
|
|
16160
|
-
});
|
|
16161
|
-
throw new InternalError("Failed to link LTI account");
|
|
16162
|
-
}
|
|
16163
|
-
logger16.info("Linked existing user", {
|
|
16164
|
-
userId: existingUser.id,
|
|
16165
|
-
ltiTimebackId
|
|
16166
|
-
});
|
|
16167
|
-
}
|
|
16168
|
-
});
|
|
16169
|
-
return existingUser;
|
|
16170
|
-
}
|
|
16171
|
-
const newUserId = crypto4.randomUUID();
|
|
16172
|
-
const createdUser = await db2.transaction(async (tx) => {
|
|
16173
|
-
const [insertedUser] = await tx.insert(users).values({
|
|
16174
|
-
id: newUserId,
|
|
16175
|
-
email,
|
|
16176
|
-
emailVerified: true,
|
|
16177
|
-
timebackId: ltiTimebackId,
|
|
16178
|
-
username: generateUsername(email),
|
|
16179
|
-
name: claims.name || claims.given_name || email.split("@")[0] || "Timeback User",
|
|
16180
|
-
createdAt: new Date,
|
|
16181
|
-
updatedAt: new Date
|
|
16182
|
-
}).returning();
|
|
16183
|
-
if (!insertedUser) {
|
|
16184
|
-
logger16.error("LTI user insert returned no rows", { email, ltiTimebackId });
|
|
16185
|
-
throw new InternalError("Failed to create user");
|
|
16186
|
-
}
|
|
16187
|
-
await tx.insert(accounts).values({
|
|
16188
|
-
id: crypto4.randomUUID(),
|
|
16189
|
-
userId: newUserId,
|
|
16190
|
-
accountId: ltiTimebackId,
|
|
16191
|
-
providerId,
|
|
16192
|
-
accessToken: null,
|
|
16193
|
-
refreshToken: null,
|
|
16194
|
-
accessTokenExpiresAt: null,
|
|
16195
|
-
refreshTokenExpiresAt: null,
|
|
16196
|
-
createdAt: new Date,
|
|
16197
|
-
updatedAt: new Date
|
|
16198
|
-
});
|
|
16199
|
-
logger16.info("Provisioned user", {
|
|
16200
|
-
userId: insertedUser.id,
|
|
16201
|
-
ltiTimebackId
|
|
16202
|
-
});
|
|
16203
|
-
return insertedUser;
|
|
16204
|
-
});
|
|
16205
|
-
return createdUser;
|
|
16206
|
-
}
|
|
16207
15053
|
}
|
|
16208
|
-
var logger16;
|
|
16209
15054
|
var init_lti_service = __esm(() => {
|
|
16210
|
-
init_esm2();
|
|
16211
15055
|
init_drizzle_orm();
|
|
16212
15056
|
init_src();
|
|
16213
15057
|
init_tables_index();
|
|
16214
|
-
init_src2();
|
|
16215
|
-
init_errors();
|
|
16216
|
-
init_lti_util();
|
|
16217
|
-
logger16 = log.scope("LtiService");
|
|
16218
15058
|
});
|
|
16219
15059
|
|
|
16220
15060
|
// ../api-core/src/services/map.service.ts
|
|
@@ -16712,56 +15552,88 @@ class SecretsService {
|
|
|
16712
15552
|
constructor(ctx) {
|
|
16713
15553
|
this.ctx = ctx;
|
|
16714
15554
|
}
|
|
16715
|
-
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
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);
|
|
16721
15564
|
}
|
|
16722
|
-
async
|
|
15565
|
+
async listKeys(slug2, user) {
|
|
16723
15566
|
const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
|
|
16724
|
-
const
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
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 [];
|
|
16732
15582
|
}
|
|
15583
|
+
throw error;
|
|
16733
15584
|
}
|
|
16734
|
-
logger20.debug("Retrieved secret values", { gameId: game.id, slug: slug2 });
|
|
16735
|
-
return filtered;
|
|
16736
15585
|
}
|
|
16737
15586
|
async setSecrets(slug2, newSecrets, user) {
|
|
16738
15587
|
const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
|
|
15588
|
+
const cf = this.getCloudflare();
|
|
15589
|
+
const deploymentId = this.getDeploymentId(slug2);
|
|
16739
15590
|
const secretKeys = Object.keys(newSecrets);
|
|
16740
15591
|
if (secretKeys.length === 0) {
|
|
15592
|
+
logger20.warn("No secrets provided", { userId: user.id, slug: slug2 });
|
|
16741
15593
|
throw new ValidationError("At least one secret must be provided");
|
|
16742
15594
|
}
|
|
16743
15595
|
for (const [key, value] of Object.entries(newSecrets)) {
|
|
16744
15596
|
if (typeof value !== "string") {
|
|
15597
|
+
logger20.warn("Secret value must be a string", { userId: user.id, slug: slug2, key });
|
|
16745
15598
|
throw new ValidationError(`Secret value for "${key}" must be a string`);
|
|
16746
15599
|
}
|
|
16747
15600
|
if (INTERNAL_SECRET_KEYS.includes(key)) {
|
|
16748
|
-
logger20.warn("Attempted to set reserved secret", {
|
|
16749
|
-
|
|
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", {
|
|
16750
15623
|
gameId: game.id,
|
|
16751
|
-
|
|
15624
|
+
slug: slug2,
|
|
15625
|
+
deploymentId
|
|
16752
15626
|
});
|
|
16753
|
-
throw new ValidationError(
|
|
15627
|
+
throw new ValidationError("Game must be deployed before setting secrets. Run `playcademy deploy` first.");
|
|
16754
15628
|
}
|
|
15629
|
+
logger20.error("Failed to set secrets", {
|
|
15630
|
+
gameId: game.id,
|
|
15631
|
+
slug: slug2,
|
|
15632
|
+
deploymentId,
|
|
15633
|
+
error: message
|
|
15634
|
+
});
|
|
15635
|
+
throw error;
|
|
16755
15636
|
}
|
|
16756
|
-
const existingSecrets = await this.ctx.providers.secrets.readSecrets(game.id) || {};
|
|
16757
|
-
const updatedSecrets = { ...existingSecrets, ...newSecrets };
|
|
16758
|
-
await this.ctx.providers.secrets.writeSecrets(game.id, updatedSecrets);
|
|
16759
|
-
logger20.info("Set secrets", {
|
|
16760
|
-
gameId: game.id,
|
|
16761
|
-
slug: slug2,
|
|
16762
|
-
addedKeys: secretKeys
|
|
16763
|
-
});
|
|
16764
|
-
return Object.keys(updatedSecrets).filter((k) => !INTERNAL_SECRET_KEYS.includes(k));
|
|
16765
15637
|
}
|
|
16766
15638
|
async deleteSecret(slug2, key, user) {
|
|
16767
15639
|
if (INTERNAL_SECRET_KEYS.includes(key)) {
|
|
@@ -16773,25 +15645,53 @@ class SecretsService {
|
|
|
16773
15645
|
throw new ValidationError(`Cannot delete reserved secret "${key}"`);
|
|
16774
15646
|
}
|
|
16775
15647
|
const game = await this.ctx.services.game.validateDeveloperAccessBySlug(user, slug2);
|
|
16776
|
-
const
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16781
|
-
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
await
|
|
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;
|
|
16785
15684
|
}
|
|
16786
|
-
logger20.info("Deleted secret", { gameId: game.id, slug: slug2, key });
|
|
16787
15685
|
}
|
|
16788
15686
|
}
|
|
16789
|
-
var logger20, INTERNAL_SECRET_KEYS;
|
|
15687
|
+
var logger20, SECRETS_PREFIX = "secrets_", INTERNAL_SECRET_KEYS;
|
|
16790
15688
|
var init_secrets_service = __esm(() => {
|
|
16791
15689
|
init_src2();
|
|
15690
|
+
init_config2();
|
|
16792
15691
|
init_errors();
|
|
15692
|
+
init_deployment_util();
|
|
16793
15693
|
logger20 = log.scope("SecretsService");
|
|
16794
|
-
INTERNAL_SECRET_KEYS = ["PLAYCADEMY_API_KEY"];
|
|
15694
|
+
INTERNAL_SECRET_KEYS = ["PLAYCADEMY_API_KEY", "GAME_ID", "PLAYCADEMY_BASE_URL"];
|
|
16795
15695
|
});
|
|
16796
15696
|
|
|
16797
15697
|
// ../api-core/src/services/seed.service.ts
|
|
@@ -18175,11 +17075,11 @@ class TimebackService {
|
|
|
18175
17075
|
return [];
|
|
18176
17076
|
}
|
|
18177
17077
|
}
|
|
18178
|
-
async setupIntegration(gameId,
|
|
17078
|
+
async setupIntegration(gameId, request, user) {
|
|
18179
17079
|
const client = this.requireClient();
|
|
18180
17080
|
const db2 = this.ctx.db;
|
|
18181
17081
|
await this.ctx.services.game.validateDeveloperAccess(user, gameId);
|
|
18182
|
-
const { courses, baseConfig, verbose } =
|
|
17082
|
+
const { courses, baseConfig, verbose } = request;
|
|
18183
17083
|
const existing = await db2.query.gameTimebackIntegrations.findMany({
|
|
18184
17084
|
where: eq(gameTimebackIntegrations.gameId, gameId)
|
|
18185
17085
|
});
|
|
@@ -18424,8 +17324,8 @@ class UploadService {
|
|
|
18424
17324
|
constructor(ctx) {
|
|
18425
17325
|
this.ctx = ctx;
|
|
18426
17326
|
}
|
|
18427
|
-
async initiate(
|
|
18428
|
-
const { fileName, gameId } =
|
|
17327
|
+
async initiate(request, user) {
|
|
17328
|
+
const { fileName, gameId } = request;
|
|
18429
17329
|
const bucketName = this.ctx.config.uploadBucket;
|
|
18430
17330
|
if (!bucketName) {
|
|
18431
17331
|
logger27.error("Upload bucket not configured in environment");
|
|
@@ -18675,6 +17575,7 @@ function createServices(ctx) {
|
|
|
18675
17575
|
item: new ItemService(ctx),
|
|
18676
17576
|
leaderboard: new LeaderboardService(ctx),
|
|
18677
17577
|
level: new LevelService(ctx),
|
|
17578
|
+
logs: new LogsService(ctx),
|
|
18678
17579
|
lti: new LtiService(ctx),
|
|
18679
17580
|
map: new MapService(ctx),
|
|
18680
17581
|
notification: new NotificationService(ctx),
|
|
@@ -18706,6 +17607,7 @@ var init_services = __esm(() => {
|
|
|
18706
17607
|
init_item_service();
|
|
18707
17608
|
init_leaderboard_service();
|
|
18708
17609
|
init_level_service();
|
|
17610
|
+
init_logs_service();
|
|
18709
17611
|
init_lti_service();
|
|
18710
17612
|
init_map_service();
|
|
18711
17613
|
init_notification_service();
|
|
@@ -18802,6 +17704,38 @@ function createSandboxAuthProvider() {
|
|
|
18802
17704
|
const header = btoa(JSON.stringify({ alg: "none", typ: "sandbox" }));
|
|
18803
17705
|
const payloadStr = btoa(JSON.stringify(payload));
|
|
18804
17706
|
return `${header}.${payloadStr}.sandbox`;
|
|
17707
|
+
},
|
|
17708
|
+
async mintLogStreamToken(userId, workerId) {
|
|
17709
|
+
const jti = crypto.randomUUID();
|
|
17710
|
+
const payload = {
|
|
17711
|
+
sub: userId,
|
|
17712
|
+
game: workerId,
|
|
17713
|
+
jti,
|
|
17714
|
+
exp: Date.now() + 60 * 1000
|
|
17715
|
+
};
|
|
17716
|
+
const header = btoa(JSON.stringify({ alg: "none", typ: "sandbox" }));
|
|
17717
|
+
const payloadStr = btoa(JSON.stringify(payload));
|
|
17718
|
+
return `${header}.${payloadStr}.sandbox`;
|
|
17719
|
+
},
|
|
17720
|
+
async validateLogStreamToken(token) {
|
|
17721
|
+
try {
|
|
17722
|
+
const parts2 = token.split(".");
|
|
17723
|
+
if (parts2.length !== 3)
|
|
17724
|
+
return null;
|
|
17725
|
+
if (parts2[2] === "sandbox") {
|
|
17726
|
+
const payload = JSON.parse(atob(parts2[1]));
|
|
17727
|
+
if (payload.jti && payload.sub && payload.game) {
|
|
17728
|
+
if (payload.exp && payload.exp < Date.now()) {
|
|
17729
|
+
log.debug("[SandboxAuthProvider] Log stream token expired");
|
|
17730
|
+
return null;
|
|
17731
|
+
}
|
|
17732
|
+
return { jti: payload.jti, sub: payload.sub, game: payload.game };
|
|
17733
|
+
}
|
|
17734
|
+
}
|
|
17735
|
+
return null;
|
|
17736
|
+
} catch {
|
|
17737
|
+
return null;
|
|
17738
|
+
}
|
|
18805
17739
|
}
|
|
18806
17740
|
};
|
|
18807
17741
|
}
|
|
@@ -18857,35 +17791,6 @@ var init_cache_provider = __esm(() => {
|
|
|
18857
17791
|
gameOrigins = [];
|
|
18858
17792
|
});
|
|
18859
17793
|
|
|
18860
|
-
// src/infrastructure/api/providers/secrets.provider.ts
|
|
18861
|
-
function createSandboxSecretsProvider() {
|
|
18862
|
-
return {
|
|
18863
|
-
async readSecrets(gameId) {
|
|
18864
|
-
const secrets = secretsStorage.get(gameId);
|
|
18865
|
-
return secrets ?? null;
|
|
18866
|
-
},
|
|
18867
|
-
async writeSecrets(gameId, secrets) {
|
|
18868
|
-
secretsStorage.set(gameId, { ...secrets });
|
|
18869
|
-
log.debug("[SandboxSecretsProvider] Stored secrets", {
|
|
18870
|
-
gameId,
|
|
18871
|
-
keyCount: Object.keys(secrets).length
|
|
18872
|
-
});
|
|
18873
|
-
},
|
|
18874
|
-
async deleteSecrets(gameId) {
|
|
18875
|
-
secretsStorage.delete(gameId);
|
|
18876
|
-
log.debug("[SandboxSecretsProvider] Deleted secrets", { gameId });
|
|
18877
|
-
}
|
|
18878
|
-
};
|
|
18879
|
-
}
|
|
18880
|
-
function clearSandboxSecrets() {
|
|
18881
|
-
secretsStorage.clear();
|
|
18882
|
-
}
|
|
18883
|
-
var secretsStorage;
|
|
18884
|
-
var init_secrets_provider = __esm(() => {
|
|
18885
|
-
init_src2();
|
|
18886
|
-
secretsStorage = new Map;
|
|
18887
|
-
});
|
|
18888
|
-
|
|
18889
17794
|
// src/infrastructure/api/providers/storage.provider.ts
|
|
18890
17795
|
function getBucket(bucketName) {
|
|
18891
17796
|
let bucket = storage.get(bucketName);
|
|
@@ -18960,7 +17865,6 @@ var init_storage_provider = __esm(() => {
|
|
|
18960
17865
|
var init_providers = __esm(() => {
|
|
18961
17866
|
init_auth_provider();
|
|
18962
17867
|
init_cache_provider();
|
|
18963
|
-
init_secrets_provider();
|
|
18964
17868
|
init_storage_provider();
|
|
18965
17869
|
});
|
|
18966
17870
|
|
|
@@ -18979,7 +17883,6 @@ function buildProviders() {
|
|
|
18979
17883
|
return {
|
|
18980
17884
|
auth: createSandboxAuthProvider(),
|
|
18981
17885
|
storage: createSandboxStorageProvider(),
|
|
18982
|
-
secrets: createSandboxSecretsProvider(),
|
|
18983
17886
|
cache: createSandboxCacheProvider()
|
|
18984
17887
|
};
|
|
18985
17888
|
}
|
|
@@ -19120,8 +18023,8 @@ var init_constants3 = __esm(() => {
|
|
|
19120
18023
|
});
|
|
19121
18024
|
|
|
19122
18025
|
// ../../node_modules/hono/dist/utils/body.js
|
|
19123
|
-
async function parseFormData(
|
|
19124
|
-
const formData = await
|
|
18026
|
+
async function parseFormData(request, options) {
|
|
18027
|
+
const formData = await request.formData();
|
|
19125
18028
|
if (formData) {
|
|
19126
18029
|
return convertFormDataToBodyData(formData, options);
|
|
19127
18030
|
}
|
|
@@ -19148,12 +18051,12 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
19148
18051
|
}
|
|
19149
18052
|
return form;
|
|
19150
18053
|
}
|
|
19151
|
-
var parseBody = async (
|
|
18054
|
+
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
19152
18055
|
const { all = false, dot = false } = options;
|
|
19153
|
-
const headers =
|
|
18056
|
+
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
19154
18057
|
const contentType = headers.get("Content-Type");
|
|
19155
18058
|
if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) {
|
|
19156
|
-
return parseFormData(
|
|
18059
|
+
return parseFormData(request, { all, dot });
|
|
19157
18060
|
}
|
|
19158
18061
|
return {};
|
|
19159
18062
|
}, handleParsingAllValues = (form, key, value) => {
|
|
@@ -19247,8 +18150,8 @@ var splitPath = (path) => {
|
|
|
19247
18150
|
}
|
|
19248
18151
|
});
|
|
19249
18152
|
}
|
|
19250
|
-
}, tryDecodeURI = (str) => tryDecode(str, decodeURI), getPath = (
|
|
19251
|
-
const url =
|
|
18153
|
+
}, tryDecodeURI = (str) => tryDecode(str, decodeURI), getPath = (request) => {
|
|
18154
|
+
const url = request.url;
|
|
19252
18155
|
const start2 = url.indexOf("/", url.indexOf(":") + 4);
|
|
19253
18156
|
let i2 = start2;
|
|
19254
18157
|
for (;i2 < url.length; i2++) {
|
|
@@ -19262,8 +18165,8 @@ var splitPath = (path) => {
|
|
|
19262
18165
|
}
|
|
19263
18166
|
}
|
|
19264
18167
|
return url.slice(start2, i2);
|
|
19265
|
-
}, getPathNoStrict = (
|
|
19266
|
-
const result = getPath(
|
|
18168
|
+
}, getPathNoStrict = (request) => {
|
|
18169
|
+
const result = getPath(request);
|
|
19267
18170
|
return result.length > 1 && result.at(-1) === "/" ? result.slice(0, -1) : result;
|
|
19268
18171
|
}, mergePath = (base, sub, ...rest) => {
|
|
19269
18172
|
if (rest.length) {
|
|
@@ -19389,8 +18292,8 @@ var init_request = __esm(() => {
|
|
|
19389
18292
|
routeIndex = 0;
|
|
19390
18293
|
path;
|
|
19391
18294
|
bodyCache = {};
|
|
19392
|
-
constructor(
|
|
19393
|
-
this.raw =
|
|
18295
|
+
constructor(request, path = "/", matchResult = [[]]) {
|
|
18296
|
+
this.raw = request;
|
|
19394
18297
|
this.path = path;
|
|
19395
18298
|
this.#matchResult = matchResult;
|
|
19396
18299
|
this.#validatedData = {};
|
|
@@ -19826,7 +18729,7 @@ var notFoundHandler = (c) => {
|
|
|
19826
18729
|
} else {
|
|
19827
18730
|
optionHandler = options.optionHandler;
|
|
19828
18731
|
if (options.replaceRequest === false) {
|
|
19829
|
-
replaceRequest = (
|
|
18732
|
+
replaceRequest = (request) => request;
|
|
19830
18733
|
} else {
|
|
19831
18734
|
replaceRequest = options.replaceRequest;
|
|
19832
18735
|
}
|
|
@@ -19845,10 +18748,10 @@ var notFoundHandler = (c) => {
|
|
|
19845
18748
|
replaceRequest ||= (() => {
|
|
19846
18749
|
const mergedPath = mergePath(this._basePath, path);
|
|
19847
18750
|
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
19848
|
-
return (
|
|
19849
|
-
const url = new URL(
|
|
18751
|
+
return (request) => {
|
|
18752
|
+
const url = new URL(request.url);
|
|
19850
18753
|
url.pathname = url.pathname.slice(pathPrefixLength) || "/";
|
|
19851
|
-
return new Request(url,
|
|
18754
|
+
return new Request(url, request);
|
|
19852
18755
|
};
|
|
19853
18756
|
})();
|
|
19854
18757
|
const handler = async (c, next) => {
|
|
@@ -19874,13 +18777,13 @@ var notFoundHandler = (c) => {
|
|
|
19874
18777
|
}
|
|
19875
18778
|
throw err2;
|
|
19876
18779
|
}
|
|
19877
|
-
#dispatch(
|
|
18780
|
+
#dispatch(request, executionCtx, env, method) {
|
|
19878
18781
|
if (method === "HEAD") {
|
|
19879
|
-
return (async () => new Response(null, await this.#dispatch(
|
|
18782
|
+
return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
|
|
19880
18783
|
}
|
|
19881
|
-
const path = this.getPath(
|
|
18784
|
+
const path = this.getPath(request, { env });
|
|
19882
18785
|
const matchResult = this.router.match(method, path);
|
|
19883
|
-
const c = new Context(
|
|
18786
|
+
const c = new Context(request, {
|
|
19884
18787
|
path,
|
|
19885
18788
|
matchResult,
|
|
19886
18789
|
env,
|
|
@@ -19911,8 +18814,8 @@ var notFoundHandler = (c) => {
|
|
|
19911
18814
|
}
|
|
19912
18815
|
})();
|
|
19913
18816
|
}
|
|
19914
|
-
fetch = (
|
|
19915
|
-
return this.#dispatch(
|
|
18817
|
+
fetch = (request, ...rest) => {
|
|
18818
|
+
return this.#dispatch(request, rest[1], rest[0], request.method);
|
|
19916
18819
|
};
|
|
19917
18820
|
request = (input, requestInit, Env, executionCtx) => {
|
|
19918
18821
|
if (input instanceof Request) {
|
|
@@ -28355,24 +27258,24 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28355
27258
|
throw new Error("The service is no longer running" + closeData.reason);
|
|
28356
27259
|
streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
|
|
28357
27260
|
};
|
|
28358
|
-
let handleRequest = async (id,
|
|
27261
|
+
let handleRequest = async (id, request) => {
|
|
28359
27262
|
try {
|
|
28360
|
-
if (
|
|
27263
|
+
if (request.command === "ping") {
|
|
28361
27264
|
sendResponse(id, {});
|
|
28362
27265
|
return;
|
|
28363
27266
|
}
|
|
28364
|
-
if (typeof
|
|
28365
|
-
const requestCallbacks = requestCallbacksByKey[
|
|
27267
|
+
if (typeof request.key === "number") {
|
|
27268
|
+
const requestCallbacks = requestCallbacksByKey[request.key];
|
|
28366
27269
|
if (!requestCallbacks) {
|
|
28367
27270
|
return;
|
|
28368
27271
|
}
|
|
28369
|
-
const callback = requestCallbacks[
|
|
27272
|
+
const callback = requestCallbacks[request.command];
|
|
28370
27273
|
if (callback) {
|
|
28371
|
-
await callback(id,
|
|
27274
|
+
await callback(id, request);
|
|
28372
27275
|
return;
|
|
28373
27276
|
}
|
|
28374
27277
|
}
|
|
28375
|
-
throw new Error(`Invalid command: ` +
|
|
27278
|
+
throw new Error(`Invalid command: ` + request.command);
|
|
28376
27279
|
} catch (e) {
|
|
28377
27280
|
const errors3 = [extractErrorMessageV8(e, streamIn, null, undefined, "")];
|
|
28378
27281
|
try {
|
|
@@ -28441,15 +27344,15 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28441
27344
|
flags: flags2,
|
|
28442
27345
|
mangleCache
|
|
28443
27346
|
} = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
|
|
28444
|
-
let
|
|
27347
|
+
let request = {
|
|
28445
27348
|
command: "transform",
|
|
28446
27349
|
flags: flags2,
|
|
28447
27350
|
inputFS: inputPath !== null,
|
|
28448
27351
|
input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
|
|
28449
27352
|
};
|
|
28450
27353
|
if (mangleCache)
|
|
28451
|
-
|
|
28452
|
-
sendRequest(refs,
|
|
27354
|
+
request.mangleCache = mangleCache;
|
|
27355
|
+
sendRequest(refs, request, (error, response) => {
|
|
28453
27356
|
if (error)
|
|
28454
27357
|
return callback(new Error(error), null);
|
|
28455
27358
|
let errors3 = replaceDetailsInMessages(response.errors, details);
|
|
@@ -28527,16 +27430,16 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28527
27430
|
throw new Error(`Missing "kind" in ${callName}() call`);
|
|
28528
27431
|
if (kind !== "error" && kind !== "warning")
|
|
28529
27432
|
throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
28530
|
-
let
|
|
27433
|
+
let request = {
|
|
28531
27434
|
command: "format-msgs",
|
|
28532
27435
|
messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
|
|
28533
27436
|
isWarning: kind === "warning"
|
|
28534
27437
|
};
|
|
28535
27438
|
if (color !== undefined)
|
|
28536
|
-
|
|
27439
|
+
request.color = color;
|
|
28537
27440
|
if (terminalWidth !== undefined)
|
|
28538
|
-
|
|
28539
|
-
sendRequest(refs,
|
|
27441
|
+
request.terminalWidth = terminalWidth;
|
|
27442
|
+
sendRequest(refs, request, (error, response) => {
|
|
28540
27443
|
if (error)
|
|
28541
27444
|
return callback(new Error(error), null);
|
|
28542
27445
|
callback(null, response.messages);
|
|
@@ -28549,15 +27452,15 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28549
27452
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
28550
27453
|
let verbose = getFlag(options, keys, "verbose", mustBeBoolean);
|
|
28551
27454
|
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
28552
|
-
let
|
|
27455
|
+
let request = {
|
|
28553
27456
|
command: "analyze-metafile",
|
|
28554
27457
|
metafile
|
|
28555
27458
|
};
|
|
28556
27459
|
if (color !== undefined)
|
|
28557
|
-
|
|
27460
|
+
request.color = color;
|
|
28558
27461
|
if (verbose !== undefined)
|
|
28559
|
-
|
|
28560
|
-
sendRequest(refs,
|
|
27462
|
+
request.verbose = verbose;
|
|
27463
|
+
sendRequest(refs, request, (error, response) => {
|
|
28561
27464
|
if (error)
|
|
28562
27465
|
return callback(new Error(error), null);
|
|
28563
27466
|
callback(null, response.result);
|
|
@@ -28630,7 +27533,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28630
27533
|
} = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
|
|
28631
27534
|
if (write && !streamIn.hasFS)
|
|
28632
27535
|
throw new Error(`The "write" option is unavailable in this environment`);
|
|
28633
|
-
const
|
|
27536
|
+
const request = {
|
|
28634
27537
|
command: "build",
|
|
28635
27538
|
key: buildKey,
|
|
28636
27539
|
entries,
|
|
@@ -28643,9 +27546,9 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28643
27546
|
context: isContext
|
|
28644
27547
|
};
|
|
28645
27548
|
if (requestPlugins)
|
|
28646
|
-
|
|
27549
|
+
request.plugins = requestPlugins;
|
|
28647
27550
|
if (mangleCache)
|
|
28648
|
-
|
|
27551
|
+
request.mangleCache = mangleCache;
|
|
28649
27552
|
const buildResponseToResult = (response, callback2) => {
|
|
28650
27553
|
const result = {
|
|
28651
27554
|
errors: replaceDetailsInMessages(response.errors, details),
|
|
@@ -28675,8 +27578,8 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28675
27578
|
let latestResultPromise;
|
|
28676
27579
|
let provideLatestResult;
|
|
28677
27580
|
if (isContext)
|
|
28678
|
-
requestCallbacks["on-end"] = (id,
|
|
28679
|
-
buildResponseToResult(
|
|
27581
|
+
requestCallbacks["on-end"] = (id, request2) => new Promise((resolve2) => {
|
|
27582
|
+
buildResponseToResult(request2, (err2, result, onEndErrors, onEndWarnings) => {
|
|
28680
27583
|
const response = {
|
|
28681
27584
|
errors: onEndErrors,
|
|
28682
27585
|
warnings: onEndWarnings
|
|
@@ -28689,7 +27592,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28689
27592
|
resolve2();
|
|
28690
27593
|
});
|
|
28691
27594
|
});
|
|
28692
|
-
sendRequest(refs,
|
|
27595
|
+
sendRequest(refs, request, (error, response) => {
|
|
28693
27596
|
if (error)
|
|
28694
27597
|
return callback(new Error(error), null);
|
|
28695
27598
|
if (!isContext) {
|
|
@@ -28712,11 +27615,11 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28712
27615
|
settlePromise = () => err2 ? reject(err2) : resolve2(result2);
|
|
28713
27616
|
};
|
|
28714
27617
|
const triggerAnotherBuild = () => {
|
|
28715
|
-
const
|
|
27618
|
+
const request2 = {
|
|
28716
27619
|
command: "rebuild",
|
|
28717
27620
|
key: buildKey
|
|
28718
27621
|
};
|
|
28719
|
-
sendRequest(refs,
|
|
27622
|
+
sendRequest(refs, request2, (error2, response2) => {
|
|
28720
27623
|
if (error2) {
|
|
28721
27624
|
reject(new Error(error2));
|
|
28722
27625
|
} else if (settlePromise) {
|
|
@@ -28736,13 +27639,13 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28736
27639
|
const keys = {};
|
|
28737
27640
|
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
28738
27641
|
checkForInvalidFlags(options2, keys, `in watch() call`);
|
|
28739
|
-
const
|
|
27642
|
+
const request2 = {
|
|
28740
27643
|
command: "watch",
|
|
28741
27644
|
key: buildKey
|
|
28742
27645
|
};
|
|
28743
27646
|
if (delay)
|
|
28744
|
-
|
|
28745
|
-
sendRequest(refs,
|
|
27647
|
+
request2.delay = delay;
|
|
27648
|
+
sendRequest(refs, request2, (error2) => {
|
|
28746
27649
|
if (error2)
|
|
28747
27650
|
reject(new Error(error2));
|
|
28748
27651
|
else
|
|
@@ -28762,33 +27665,33 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28762
27665
|
const cors2 = getFlag(options2, keys, "cors", mustBeObject);
|
|
28763
27666
|
const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction);
|
|
28764
27667
|
checkForInvalidFlags(options2, keys, `in serve() call`);
|
|
28765
|
-
const
|
|
27668
|
+
const request2 = {
|
|
28766
27669
|
command: "serve",
|
|
28767
27670
|
key: buildKey,
|
|
28768
27671
|
onRequest: !!onRequest
|
|
28769
27672
|
};
|
|
28770
27673
|
if (port !== undefined)
|
|
28771
|
-
|
|
27674
|
+
request2.port = port;
|
|
28772
27675
|
if (host !== undefined)
|
|
28773
|
-
|
|
27676
|
+
request2.host = host;
|
|
28774
27677
|
if (servedir !== undefined)
|
|
28775
|
-
|
|
27678
|
+
request2.servedir = servedir;
|
|
28776
27679
|
if (keyfile !== undefined)
|
|
28777
|
-
|
|
27680
|
+
request2.keyfile = keyfile;
|
|
28778
27681
|
if (certfile !== undefined)
|
|
28779
|
-
|
|
27682
|
+
request2.certfile = certfile;
|
|
28780
27683
|
if (fallback !== undefined)
|
|
28781
|
-
|
|
27684
|
+
request2.fallback = fallback;
|
|
28782
27685
|
if (cors2) {
|
|
28783
27686
|
const corsKeys = {};
|
|
28784
27687
|
const origin = getFlag(cors2, corsKeys, "origin", mustBeStringOrArrayOfStrings);
|
|
28785
27688
|
checkForInvalidFlags(cors2, corsKeys, `on "cors" object`);
|
|
28786
27689
|
if (Array.isArray(origin))
|
|
28787
|
-
|
|
27690
|
+
request2.corsOrigin = origin;
|
|
28788
27691
|
else if (origin !== undefined)
|
|
28789
|
-
|
|
27692
|
+
request2.corsOrigin = [origin];
|
|
28790
27693
|
}
|
|
28791
|
-
sendRequest(refs,
|
|
27694
|
+
sendRequest(refs, request2, (error2, response2) => {
|
|
28792
27695
|
if (error2)
|
|
28793
27696
|
return reject(new Error(error2));
|
|
28794
27697
|
if (onRequest) {
|
|
@@ -28803,11 +27706,11 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28803
27706
|
cancel: () => new Promise((resolve2) => {
|
|
28804
27707
|
if (didDispose)
|
|
28805
27708
|
return resolve2();
|
|
28806
|
-
const
|
|
27709
|
+
const request2 = {
|
|
28807
27710
|
command: "cancel",
|
|
28808
27711
|
key: buildKey
|
|
28809
27712
|
};
|
|
28810
|
-
sendRequest(refs,
|
|
27713
|
+
sendRequest(refs, request2, () => {
|
|
28811
27714
|
resolve2();
|
|
28812
27715
|
});
|
|
28813
27716
|
}),
|
|
@@ -28815,11 +27718,11 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28815
27718
|
if (didDispose)
|
|
28816
27719
|
return resolve2();
|
|
28817
27720
|
didDispose = true;
|
|
28818
|
-
const
|
|
27721
|
+
const request2 = {
|
|
28819
27722
|
command: "dispose",
|
|
28820
27723
|
key: buildKey
|
|
28821
27724
|
};
|
|
28822
|
-
sendRequest(refs,
|
|
27725
|
+
sendRequest(refs, request2, () => {
|
|
28823
27726
|
resolve2();
|
|
28824
27727
|
scheduleOnDisposeCallbacks();
|
|
28825
27728
|
refs.unref();
|
|
@@ -28877,29 +27780,29 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28877
27780
|
let importAttributes = getFlag(options, keys2, "with", mustBeObject);
|
|
28878
27781
|
checkForInvalidFlags(options, keys2, "in resolve() call");
|
|
28879
27782
|
return new Promise((resolve22, reject) => {
|
|
28880
|
-
const
|
|
27783
|
+
const request = {
|
|
28881
27784
|
command: "resolve",
|
|
28882
27785
|
path: path3,
|
|
28883
27786
|
key: buildKey,
|
|
28884
27787
|
pluginName: name3
|
|
28885
27788
|
};
|
|
28886
27789
|
if (pluginName != null)
|
|
28887
|
-
|
|
27790
|
+
request.pluginName = pluginName;
|
|
28888
27791
|
if (importer != null)
|
|
28889
|
-
|
|
27792
|
+
request.importer = importer;
|
|
28890
27793
|
if (namespace != null)
|
|
28891
|
-
|
|
27794
|
+
request.namespace = namespace;
|
|
28892
27795
|
if (resolveDir != null)
|
|
28893
|
-
|
|
27796
|
+
request.resolveDir = resolveDir;
|
|
28894
27797
|
if (kind != null)
|
|
28895
|
-
|
|
27798
|
+
request.kind = kind;
|
|
28896
27799
|
else
|
|
28897
27800
|
throw new Error(`Must specify "kind" when calling "resolve"`);
|
|
28898
27801
|
if (pluginData != null)
|
|
28899
|
-
|
|
27802
|
+
request.pluginData = details.store(pluginData);
|
|
28900
27803
|
if (importAttributes != null)
|
|
28901
|
-
|
|
28902
|
-
sendRequest(refs,
|
|
27804
|
+
request.with = sanitizeStringMap(importAttributes, "with");
|
|
27805
|
+
sendRequest(refs, request, (error, response) => {
|
|
28903
27806
|
if (error !== null)
|
|
28904
27807
|
reject(new Error(error));
|
|
28905
27808
|
else
|
|
@@ -28969,7 +27872,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28969
27872
|
return { ok: false, error: e, pluginName: name3 };
|
|
28970
27873
|
}
|
|
28971
27874
|
}
|
|
28972
|
-
requestCallbacks["on-start"] = async (id,
|
|
27875
|
+
requestCallbacks["on-start"] = async (id, request) => {
|
|
28973
27876
|
details.clear();
|
|
28974
27877
|
let response = { errors: [], warnings: [] };
|
|
28975
27878
|
await Promise.all(onStartCallbacks.map(async ({ name: name3, callback, note }) => {
|
|
@@ -28993,19 +27896,19 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
28993
27896
|
}));
|
|
28994
27897
|
sendResponse(id, response);
|
|
28995
27898
|
};
|
|
28996
|
-
requestCallbacks["on-resolve"] = async (id,
|
|
27899
|
+
requestCallbacks["on-resolve"] = async (id, request) => {
|
|
28997
27900
|
let response = {}, name3 = "", callback, note;
|
|
28998
|
-
for (let id2 of
|
|
27901
|
+
for (let id2 of request.ids) {
|
|
28999
27902
|
try {
|
|
29000
27903
|
({ name: name3, callback, note } = onResolveCallbacks[id2]);
|
|
29001
27904
|
let result = await callback({
|
|
29002
|
-
path:
|
|
29003
|
-
importer:
|
|
29004
|
-
namespace:
|
|
29005
|
-
resolveDir:
|
|
29006
|
-
kind:
|
|
29007
|
-
pluginData: details.load(
|
|
29008
|
-
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
|
|
29009
27912
|
});
|
|
29010
27913
|
if (result != null) {
|
|
29011
27914
|
if (typeof result !== "object")
|
|
@@ -29055,17 +27958,17 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
29055
27958
|
}
|
|
29056
27959
|
sendResponse(id, response);
|
|
29057
27960
|
};
|
|
29058
|
-
requestCallbacks["on-load"] = async (id,
|
|
27961
|
+
requestCallbacks["on-load"] = async (id, request) => {
|
|
29059
27962
|
let response = {}, name3 = "", callback, note;
|
|
29060
|
-
for (let id2 of
|
|
27963
|
+
for (let id2 of request.ids) {
|
|
29061
27964
|
try {
|
|
29062
27965
|
({ name: name3, callback, note } = onLoadCallbacks[id2]);
|
|
29063
27966
|
let result = await callback({
|
|
29064
|
-
path:
|
|
29065
|
-
namespace:
|
|
29066
|
-
suffix:
|
|
29067
|
-
pluginData: details.load(
|
|
29068
|
-
with:
|
|
27967
|
+
path: request.path,
|
|
27968
|
+
namespace: request.namespace,
|
|
27969
|
+
suffix: request.suffix,
|
|
27970
|
+
pluginData: details.load(request.pluginData),
|
|
27971
|
+
with: request.with
|
|
29069
27972
|
});
|
|
29070
27973
|
if (result != null) {
|
|
29071
27974
|
if (typeof result !== "object")
|
|
@@ -29590,7 +28493,7 @@ for your current platform.`);
|
|
|
29590
28493
|
return { binPath, isWASM };
|
|
29591
28494
|
}
|
|
29592
28495
|
var child_process = __require("child_process");
|
|
29593
|
-
var
|
|
28496
|
+
var crypto4 = __require("crypto");
|
|
29594
28497
|
var path2 = __require("path");
|
|
29595
28498
|
var fs22 = __require("fs");
|
|
29596
28499
|
var os2 = __require("os");
|
|
@@ -29904,7 +28807,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
29904
28807
|
afterClose(null);
|
|
29905
28808
|
};
|
|
29906
28809
|
var randomFileName = () => {
|
|
29907
|
-
return path2.join(os2.tmpdir(), `esbuild-${
|
|
28810
|
+
return path2.join(os2.tmpdir(), `esbuild-${crypto4.randomBytes(32).toString("hex")}`);
|
|
29908
28811
|
};
|
|
29909
28812
|
var workerThreadService = null;
|
|
29910
28813
|
var startWorkerThreadService = (worker_threads2) => {
|
|
@@ -32507,8 +31410,8 @@ var require_node2 = __commonJS((exports) => {
|
|
|
32507
31410
|
}
|
|
32508
31411
|
} catch (err2) {}
|
|
32509
31412
|
var bufferFrom = require_buffer_from();
|
|
32510
|
-
function dynamicRequire(mod,
|
|
32511
|
-
return mod.require(
|
|
31413
|
+
function dynamicRequire(mod, request) {
|
|
31414
|
+
return mod.require(request);
|
|
32512
31415
|
}
|
|
32513
31416
|
var errorFormatterInstalled = false;
|
|
32514
31417
|
var uncaughtShimInstalled = false;
|
|
@@ -35312,10 +34215,10 @@ If you have no idea what this means or what Pirates is, let me explain: Pirates
|
|
|
35312
34215
|
var Module2 = __require("module");
|
|
35313
34216
|
var originalResolveFilename = Module2._resolveFilename;
|
|
35314
34217
|
var coreModules = getCoreModules(Module2.builtinModules);
|
|
35315
|
-
Module2._resolveFilename = function(
|
|
35316
|
-
var isCoreModule = coreModules.hasOwnProperty(
|
|
34218
|
+
Module2._resolveFilename = function(request, _parent) {
|
|
34219
|
+
var isCoreModule = coreModules.hasOwnProperty(request);
|
|
35317
34220
|
if (!isCoreModule) {
|
|
35318
|
-
var found = matchPath(
|
|
34221
|
+
var found = matchPath(request);
|
|
35319
34222
|
if (found) {
|
|
35320
34223
|
var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true);
|
|
35321
34224
|
return originalResolveFilename.apply(this, modifiedArguments);
|
|
@@ -35482,10 +34385,10 @@ If you have no idea what this means or what Pirates is, let me explain: Pirates
|
|
|
35482
34385
|
const matchPath = (0, import_tsconfig_paths.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
|
|
35483
34386
|
const Module2 = __require("module");
|
|
35484
34387
|
const originalResolveFilename = Module2._resolveFilename;
|
|
35485
|
-
Module2._resolveFilename = function(
|
|
35486
|
-
const isCoreModule = _module2.builtinModules.includes(
|
|
34388
|
+
Module2._resolveFilename = function(request, _parent) {
|
|
34389
|
+
const isCoreModule = _module2.builtinModules.includes(request);
|
|
35487
34390
|
if (!isCoreModule) {
|
|
35488
|
-
const found = matchPath(
|
|
34391
|
+
const found = matchPath(request);
|
|
35489
34392
|
if (found) {
|
|
35490
34393
|
const modifiedArguments = [found, ...[].slice.call(arguments, 1)];
|
|
35491
34394
|
return originalResolveFilename.apply(this, modifiedArguments);
|
|
@@ -35633,7 +34536,7 @@ __export(exports_api, {
|
|
|
35633
34536
|
import process2 from "process";
|
|
35634
34537
|
import os from "os";
|
|
35635
34538
|
import tty from "tty";
|
|
35636
|
-
import { randomUUID
|
|
34539
|
+
import { randomUUID } from "crypto";
|
|
35637
34540
|
function assembleStyles() {
|
|
35638
34541
|
const codes = /* @__PURE__ */ new Map;
|
|
35639
34542
|
for (const [groupName, group] of Object.entries(styles2)) {
|
|
@@ -38308,7 +37211,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
|
|
|
38308
37211
|
__defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
|
|
38309
37212
|
}
|
|
38310
37213
|
return to;
|
|
38311
|
-
}, __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) => {
|
|
38312
37215
|
const matchers = filters.map((it2) => {
|
|
38313
37216
|
return new Minimatch(it2);
|
|
38314
37217
|
});
|
|
@@ -38565,7 +37468,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
|
|
|
38565
37468
|
return { schema: schema5 };
|
|
38566
37469
|
}, generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
|
|
38567
37470
|
const prepared = prepareFromExports(imports);
|
|
38568
|
-
const id =
|
|
37471
|
+
const id = randomUUID();
|
|
38569
37472
|
const snapshot = generatePgSnapshot(prepared.tables, prepared.enums, prepared.schemas, prepared.sequences, prepared.roles, prepared.policies, prepared.views, prepared.matViews, casing2, schemaFilters);
|
|
38570
37473
|
return fillPgSnapshot({
|
|
38571
37474
|
serialized: snapshot,
|
|
@@ -38611,7 +37514,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
|
|
|
38611
37514
|
}, generateSQLiteDrizzleJson = async (imports, prevId, casing2) => {
|
|
38612
37515
|
const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
|
|
38613
37516
|
const prepared = prepareFromExports5(imports);
|
|
38614
|
-
const id =
|
|
37517
|
+
const id = randomUUID();
|
|
38615
37518
|
const snapshot = generateSqliteSnapshot(prepared.tables, prepared.views, casing2);
|
|
38616
37519
|
return {
|
|
38617
37520
|
...snapshot,
|
|
@@ -38659,7 +37562,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
|
|
|
38659
37562
|
}, generateMySQLDrizzleJson = async (imports, prevId, casing2) => {
|
|
38660
37563
|
const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
|
|
38661
37564
|
const prepared = prepareFromExports5(imports);
|
|
38662
|
-
const id =
|
|
37565
|
+
const id = randomUUID();
|
|
38663
37566
|
const snapshot = generateMySqlSnapshot(prepared.tables, prepared.views, casing2);
|
|
38664
37567
|
return {
|
|
38665
37568
|
...snapshot,
|
|
@@ -38706,7 +37609,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
|
|
|
38706
37609
|
}, generateSingleStoreDrizzleJson = async (imports, prevId, casing2) => {
|
|
38707
37610
|
const { prepareFromExports: prepareFromExports5 } = await Promise.resolve().then(() => (init_singlestoreImports(), singlestoreImports_exports));
|
|
38708
37611
|
const prepared = prepareFromExports5(imports);
|
|
38709
|
-
const id =
|
|
37612
|
+
const id = randomUUID();
|
|
38710
37613
|
const snapshot = generateSingleStoreSnapshot(prepared.tables, casing2);
|
|
38711
37614
|
return {
|
|
38712
37615
|
...snapshot,
|
|
@@ -45493,7 +44396,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
45493
44396
|
init_external2();
|
|
45494
44397
|
}
|
|
45495
44398
|
});
|
|
45496
|
-
|
|
44399
|
+
init_esm2 = __esm3({
|
|
45497
44400
|
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/index.js"() {
|
|
45498
44401
|
init_v32();
|
|
45499
44402
|
init_v32();
|
|
@@ -45502,7 +44405,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
45502
44405
|
init_gelSchema = __esm3({
|
|
45503
44406
|
"src/serializer/gelSchema.ts"() {
|
|
45504
44407
|
init_global2();
|
|
45505
|
-
|
|
44408
|
+
init_esm2();
|
|
45506
44409
|
enumSchema = objectType2({
|
|
45507
44410
|
name: stringType2(),
|
|
45508
44411
|
schema: stringType2(),
|
|
@@ -45756,7 +44659,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
45756
44659
|
});
|
|
45757
44660
|
init_mysqlSchema = __esm3({
|
|
45758
44661
|
"src/serializer/mysqlSchema.ts"() {
|
|
45759
|
-
|
|
44662
|
+
init_esm2();
|
|
45760
44663
|
init_global2();
|
|
45761
44664
|
index22 = objectType2({
|
|
45762
44665
|
name: stringType2(),
|
|
@@ -46062,7 +44965,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
46062
44965
|
init_pgSchema = __esm3({
|
|
46063
44966
|
"src/serializer/pgSchema.ts"() {
|
|
46064
44967
|
init_global2();
|
|
46065
|
-
|
|
44968
|
+
init_esm2();
|
|
46066
44969
|
indexV2 = objectType2({
|
|
46067
44970
|
name: stringType2(),
|
|
46068
44971
|
columns: recordType2(stringType2(), objectType2({
|
|
@@ -46783,7 +45686,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
46783
45686
|
});
|
|
46784
45687
|
init_singlestoreSchema = __esm3({
|
|
46785
45688
|
"src/serializer/singlestoreSchema.ts"() {
|
|
46786
|
-
|
|
45689
|
+
init_esm2();
|
|
46787
45690
|
init_global2();
|
|
46788
45691
|
index4 = objectType2({
|
|
46789
45692
|
name: stringType2(),
|
|
@@ -46942,7 +45845,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
|
|
|
46942
45845
|
});
|
|
46943
45846
|
init_sqliteSchema = __esm3({
|
|
46944
45847
|
"src/serializer/sqliteSchema.ts"() {
|
|
46945
|
-
|
|
45848
|
+
init_esm2();
|
|
46946
45849
|
init_global2();
|
|
46947
45850
|
index5 = objectType2({
|
|
46948
45851
|
name: stringType2(),
|
|
@@ -54620,7 +53523,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
|
54620
53523
|
});
|
|
54621
53524
|
init_snapshotsDiffer = __esm3({
|
|
54622
53525
|
"src/snapshotsDiffer.ts"() {
|
|
54623
|
-
|
|
53526
|
+
init_esm2();
|
|
54624
53527
|
init_jsonDiffer();
|
|
54625
53528
|
init_sqlgenerator();
|
|
54626
53529
|
init_jsonStatements();
|
|
@@ -56731,7 +55634,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
|
56731
55634
|
});
|
|
56732
55635
|
init_schemaValidator = __esm3({
|
|
56733
55636
|
"src/schemaValidator.ts"() {
|
|
56734
|
-
|
|
55637
|
+
init_esm2();
|
|
56735
55638
|
init_mysqlSchema();
|
|
56736
55639
|
init_pgSchema();
|
|
56737
55640
|
init_singlestoreSchema();
|
|
@@ -56749,7 +55652,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
|
|
|
56749
55652
|
});
|
|
56750
55653
|
init_common2 = __esm3({
|
|
56751
55654
|
"src/cli/validations/common.ts"() {
|
|
56752
|
-
|
|
55655
|
+
init_esm2();
|
|
56753
55656
|
init_schemaValidator();
|
|
56754
55657
|
init_outputs();
|
|
56755
55658
|
sqliteDriversLiterals = [
|
|
@@ -71951,7 +70854,7 @@ AND
|
|
|
71951
70854
|
});
|
|
71952
70855
|
init_cli = __esm3({
|
|
71953
70856
|
"src/cli/validations/cli.ts"() {
|
|
71954
|
-
|
|
70857
|
+
init_esm2();
|
|
71955
70858
|
init_schemaValidator();
|
|
71956
70859
|
init_common2();
|
|
71957
70860
|
cliConfigGenerate = objectType2({
|
|
@@ -72012,7 +70915,7 @@ AND
|
|
|
72012
70915
|
});
|
|
72013
70916
|
init_gel = __esm3({
|
|
72014
70917
|
"src/cli/validations/gel.ts"() {
|
|
72015
|
-
|
|
70918
|
+
init_esm2();
|
|
72016
70919
|
init_views();
|
|
72017
70920
|
init_common2();
|
|
72018
70921
|
gelCredentials = unionType2([
|
|
@@ -72056,7 +70959,7 @@ AND
|
|
|
72056
70959
|
});
|
|
72057
70960
|
init_libsql = __esm3({
|
|
72058
70961
|
"src/cli/validations/libsql.ts"() {
|
|
72059
|
-
|
|
70962
|
+
init_esm2();
|
|
72060
70963
|
init_views();
|
|
72061
70964
|
init_common2();
|
|
72062
70965
|
libSQLCredentials = objectType2({
|
|
@@ -72067,7 +70970,7 @@ AND
|
|
|
72067
70970
|
});
|
|
72068
70971
|
init_mysql = __esm3({
|
|
72069
70972
|
"src/cli/validations/mysql.ts"() {
|
|
72070
|
-
|
|
70973
|
+
init_esm2();
|
|
72071
70974
|
init_views();
|
|
72072
70975
|
init_common2();
|
|
72073
70976
|
init_outputs();
|
|
@@ -72100,7 +71003,7 @@ AND
|
|
|
72100
71003
|
});
|
|
72101
71004
|
init_postgres = __esm3({
|
|
72102
71005
|
"src/cli/validations/postgres.ts"() {
|
|
72103
|
-
|
|
71006
|
+
init_esm2();
|
|
72104
71007
|
init_views();
|
|
72105
71008
|
init_common2();
|
|
72106
71009
|
postgresCredentials = unionType2([
|
|
@@ -72145,7 +71048,7 @@ AND
|
|
|
72145
71048
|
});
|
|
72146
71049
|
init_singlestore = __esm3({
|
|
72147
71050
|
"src/cli/validations/singlestore.ts"() {
|
|
72148
|
-
|
|
71051
|
+
init_esm2();
|
|
72149
71052
|
init_views();
|
|
72150
71053
|
init_common2();
|
|
72151
71054
|
init_outputs();
|
|
@@ -72179,7 +71082,7 @@ AND
|
|
|
72179
71082
|
init_sqlite = __esm3({
|
|
72180
71083
|
"src/cli/validations/sqlite.ts"() {
|
|
72181
71084
|
init_global2();
|
|
72182
|
-
|
|
71085
|
+
init_esm2();
|
|
72183
71086
|
init_views();
|
|
72184
71087
|
init_common2();
|
|
72185
71088
|
sqliteCredentials = unionType2([
|
|
@@ -72206,7 +71109,7 @@ AND
|
|
|
72206
71109
|
});
|
|
72207
71110
|
init_studio = __esm3({
|
|
72208
71111
|
"src/cli/validations/studio.ts"() {
|
|
72209
|
-
|
|
71112
|
+
init_esm2();
|
|
72210
71113
|
init_schemaValidator();
|
|
72211
71114
|
init_common2();
|
|
72212
71115
|
init_mysql();
|
|
@@ -72238,7 +71141,7 @@ AND
|
|
|
72238
71141
|
init_utils9 = __esm3({
|
|
72239
71142
|
"src/cli/commands/utils.ts"() {
|
|
72240
71143
|
import_hanji7 = __toESM2(require_hanji());
|
|
72241
|
-
|
|
71144
|
+
init_esm2();
|
|
72242
71145
|
init_getTablesFilterByExtensions();
|
|
72243
71146
|
init_global2();
|
|
72244
71147
|
init_schemaValidator();
|
|
@@ -77693,6 +76596,142 @@ var init_auth_util = __esm(() => {
|
|
|
77693
76596
|
init_types9();
|
|
77694
76597
|
});
|
|
77695
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
|
+
|
|
77696
76735
|
// ../api-core/src/utils/validation.util.ts
|
|
77697
76736
|
function formatZodError(error2) {
|
|
77698
76737
|
const flat = error2.flatten();
|
|
@@ -77717,26 +76756,27 @@ var init_utils11 = __esm(() => {
|
|
|
77717
76756
|
init_deployment_util();
|
|
77718
76757
|
init_leaderboard_util();
|
|
77719
76758
|
init_lti_util();
|
|
76759
|
+
init_lti_provisioning();
|
|
77720
76760
|
init_scope_util();
|
|
77721
76761
|
init_timeback_util();
|
|
77722
76762
|
});
|
|
77723
76763
|
|
|
77724
76764
|
// ../api-core/src/controllers/achievement.controller.ts
|
|
77725
|
-
var
|
|
76765
|
+
var logger33, listCurrent, listHistory, postProgress, achievements3;
|
|
77726
76766
|
var init_achievement_controller = __esm(() => {
|
|
77727
76767
|
init_esm();
|
|
77728
76768
|
init_schemas_index();
|
|
77729
76769
|
init_src2();
|
|
77730
76770
|
init_errors();
|
|
77731
76771
|
init_utils11();
|
|
77732
|
-
|
|
76772
|
+
logger33 = log.scope("AchievementController");
|
|
77733
76773
|
listCurrent = requireAuth(async (ctx) => {
|
|
77734
|
-
|
|
76774
|
+
logger33.debug("Listing current achievements", { userId: ctx.user.id, gameId: ctx.gameId });
|
|
77735
76775
|
return ctx.services.achievement.listCurrent(ctx.user, ctx.gameId);
|
|
77736
76776
|
});
|
|
77737
76777
|
listHistory = requireAuth(async (ctx) => {
|
|
77738
76778
|
const limit = Math.max(1, Math.min(100, Number(ctx.url.searchParams.get("limit")) || 20));
|
|
77739
|
-
|
|
76779
|
+
logger33.debug("Listing achievement history", { userId: ctx.user.id, limit });
|
|
77740
76780
|
return ctx.services.achievement.listHistory(ctx.user, limit);
|
|
77741
76781
|
});
|
|
77742
76782
|
postProgress = requireAuth(async (ctx) => {
|
|
@@ -77747,12 +76787,12 @@ var init_achievement_controller = __esm(() => {
|
|
|
77747
76787
|
} catch (error2) {
|
|
77748
76788
|
if (error2 instanceof exports_external.ZodError) {
|
|
77749
76789
|
const details = formatZodError(error2);
|
|
77750
|
-
|
|
76790
|
+
logger33.warn("Submit achievement progress validation failed", { details });
|
|
77751
76791
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
77752
76792
|
}
|
|
77753
76793
|
throw ApiError.badRequest("Invalid JSON body");
|
|
77754
76794
|
}
|
|
77755
|
-
|
|
76795
|
+
logger33.debug("Submitting progress", {
|
|
77756
76796
|
userId: ctx.user.id,
|
|
77757
76797
|
achievementId: body2.achievementId
|
|
77758
76798
|
});
|
|
@@ -77766,14 +76806,14 @@ var init_achievement_controller = __esm(() => {
|
|
|
77766
76806
|
});
|
|
77767
76807
|
|
|
77768
76808
|
// ../api-core/src/controllers/admin.controller.ts
|
|
77769
|
-
var
|
|
76809
|
+
var logger34, getAllowedOrigins;
|
|
77770
76810
|
var init_admin_controller = __esm(() => {
|
|
77771
76811
|
init_src2();
|
|
77772
76812
|
init_utils11();
|
|
77773
|
-
|
|
76813
|
+
logger34 = log.scope("AdminController");
|
|
77774
76814
|
getAllowedOrigins = requireAdmin(async (ctx) => {
|
|
77775
76815
|
const shouldRefresh = ctx.url.searchParams.get("refresh") === "true";
|
|
77776
|
-
|
|
76816
|
+
logger34.debug("Getting allowed origins", { userId: ctx.user.id, refresh: shouldRefresh });
|
|
77777
76817
|
if (shouldRefresh) {
|
|
77778
76818
|
await ctx.providers.cache.refreshGameOrigins();
|
|
77779
76819
|
}
|
|
@@ -77788,14 +76828,14 @@ var init_admin_controller = __esm(() => {
|
|
|
77788
76828
|
});
|
|
77789
76829
|
|
|
77790
76830
|
// ../api-core/src/controllers/bucket.controller.ts
|
|
77791
|
-
var
|
|
76831
|
+
var logger35, listFiles, getFile, putFile, deleteFile, initiateUpload;
|
|
77792
76832
|
var init_bucket_controller = __esm(() => {
|
|
77793
76833
|
init_esm();
|
|
77794
76834
|
init_schemas_index();
|
|
77795
76835
|
init_src2();
|
|
77796
76836
|
init_errors();
|
|
77797
76837
|
init_utils11();
|
|
77798
|
-
|
|
76838
|
+
logger35 = log.scope("BucketController");
|
|
77799
76839
|
listFiles = requireDeveloper(async (ctx) => {
|
|
77800
76840
|
const slug2 = ctx.params.slug;
|
|
77801
76841
|
if (!slug2) {
|
|
@@ -77803,7 +76843,7 @@ var init_bucket_controller = __esm(() => {
|
|
|
77803
76843
|
}
|
|
77804
76844
|
const url = ctx.url;
|
|
77805
76845
|
const prefix2 = url.searchParams.get("prefix") || undefined;
|
|
77806
|
-
|
|
76846
|
+
logger35.debug("Listing files", { userId: ctx.user.id, slug: slug2, prefix: prefix2 });
|
|
77807
76847
|
const files = await ctx.services.bucket.listFiles(slug2, ctx.user, prefix2);
|
|
77808
76848
|
return { files };
|
|
77809
76849
|
});
|
|
@@ -77813,7 +76853,7 @@ var init_bucket_controller = __esm(() => {
|
|
|
77813
76853
|
if (!slug2 || !key) {
|
|
77814
76854
|
throw ApiError.badRequest("Missing game slug or file key");
|
|
77815
76855
|
}
|
|
77816
|
-
|
|
76856
|
+
logger35.debug("Getting file", { userId: ctx.user.id, slug: slug2, key });
|
|
77817
76857
|
const object = await ctx.services.bucket.getFile(slug2, key, ctx.user);
|
|
77818
76858
|
return new Response(Buffer.from(object.body), {
|
|
77819
76859
|
status: 200,
|
|
@@ -77832,7 +76872,7 @@ var init_bucket_controller = __esm(() => {
|
|
|
77832
76872
|
const arrayBuffer = await ctx.request.arrayBuffer();
|
|
77833
76873
|
const body2 = new Uint8Array(arrayBuffer);
|
|
77834
76874
|
const contentType = ctx.request.headers.get("content-type") || undefined;
|
|
77835
|
-
|
|
76875
|
+
logger35.debug("Uploading file", {
|
|
77836
76876
|
userId: ctx.user.id,
|
|
77837
76877
|
slug: slug2,
|
|
77838
76878
|
key,
|
|
@@ -77848,7 +76888,7 @@ var init_bucket_controller = __esm(() => {
|
|
|
77848
76888
|
if (!slug2 || !key) {
|
|
77849
76889
|
throw ApiError.badRequest("Missing game slug or file key");
|
|
77850
76890
|
}
|
|
77851
|
-
|
|
76891
|
+
logger35.debug("Deleting file", { userId: ctx.user.id, slug: slug2, key });
|
|
77852
76892
|
await ctx.services.bucket.deleteFile(slug2, key, ctx.user);
|
|
77853
76893
|
return { success: true, key };
|
|
77854
76894
|
});
|
|
@@ -77860,12 +76900,12 @@ var init_bucket_controller = __esm(() => {
|
|
|
77860
76900
|
} catch (error2) {
|
|
77861
76901
|
if (error2 instanceof exports_external.ZodError) {
|
|
77862
76902
|
const details = formatZodError(error2);
|
|
77863
|
-
|
|
76903
|
+
logger35.warn("Initiate upload validation failed", { details });
|
|
77864
76904
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
77865
76905
|
}
|
|
77866
76906
|
throw ApiError.badRequest("Invalid JSON body");
|
|
77867
76907
|
}
|
|
77868
|
-
|
|
76908
|
+
logger35.debug("Initiating multipart upload", {
|
|
77869
76909
|
userId: ctx.user.id,
|
|
77870
76910
|
gameId: body2.gameId,
|
|
77871
76911
|
fileName: body2.fileName
|
|
@@ -77882,19 +76922,19 @@ async function listComponents(ctx) {
|
|
|
77882
76922
|
if (!isNaN(parsed) && isFinite(parsed)) {
|
|
77883
76923
|
level = Math.floor(Math.max(0, parsed));
|
|
77884
76924
|
}
|
|
77885
|
-
|
|
76925
|
+
logger36.debug("Listing components", { level });
|
|
77886
76926
|
return ctx.services.character.listAvailableComponents(level);
|
|
77887
76927
|
}
|
|
77888
|
-
var
|
|
76928
|
+
var logger36, get, getByUserId, create, update2, equipAccessory, removeAccessory, character2;
|
|
77889
76929
|
var init_character_controller = __esm(() => {
|
|
77890
76930
|
init_esm();
|
|
77891
76931
|
init_schemas_index();
|
|
77892
76932
|
init_src2();
|
|
77893
76933
|
init_errors();
|
|
77894
76934
|
init_utils11();
|
|
77895
|
-
|
|
76935
|
+
logger36 = log.scope("CharacterController");
|
|
77896
76936
|
get = requireAuth(async (ctx) => {
|
|
77897
|
-
|
|
76937
|
+
logger36.debug("Getting character", { userId: ctx.user.id });
|
|
77898
76938
|
return ctx.services.character.getByUser(ctx.user);
|
|
77899
76939
|
});
|
|
77900
76940
|
getByUserId = requireAuth(async (ctx) => {
|
|
@@ -77902,7 +76942,7 @@ var init_character_controller = __esm(() => {
|
|
|
77902
76942
|
if (!userId) {
|
|
77903
76943
|
throw ApiError.badRequest("User ID is required in the URL path");
|
|
77904
76944
|
}
|
|
77905
|
-
|
|
76945
|
+
logger36.debug("Getting character by user ID", { requestedUserId: userId });
|
|
77906
76946
|
return ctx.services.character.getByUserId(userId);
|
|
77907
76947
|
});
|
|
77908
76948
|
create = requireAuth(async (ctx) => {
|
|
@@ -77913,12 +76953,12 @@ var init_character_controller = __esm(() => {
|
|
|
77913
76953
|
} catch (error2) {
|
|
77914
76954
|
if (error2 instanceof exports_external.ZodError) {
|
|
77915
76955
|
const details = formatZodError(error2);
|
|
77916
|
-
|
|
76956
|
+
logger36.warn("Create character validation failed", { details });
|
|
77917
76957
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
77918
76958
|
}
|
|
77919
76959
|
throw ApiError.badRequest("Invalid JSON body");
|
|
77920
76960
|
}
|
|
77921
|
-
|
|
76961
|
+
logger36.debug("Creating character", {
|
|
77922
76962
|
userId: ctx.user.id,
|
|
77923
76963
|
bodyComponentId: body2.bodyComponentId,
|
|
77924
76964
|
hairstyleComponentId: body2.hairstyleComponentId
|
|
@@ -77933,12 +76973,12 @@ var init_character_controller = __esm(() => {
|
|
|
77933
76973
|
} catch (error2) {
|
|
77934
76974
|
if (error2 instanceof exports_external.ZodError) {
|
|
77935
76975
|
const details = formatZodError(error2);
|
|
77936
|
-
|
|
76976
|
+
logger36.warn("Update character validation failed", { details });
|
|
77937
76977
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
77938
76978
|
}
|
|
77939
76979
|
throw ApiError.badRequest("Invalid JSON body");
|
|
77940
76980
|
}
|
|
77941
|
-
|
|
76981
|
+
logger36.debug("Updating character", {
|
|
77942
76982
|
userId: ctx.user.id,
|
|
77943
76983
|
bodyComponentId: body2.bodyComponentId,
|
|
77944
76984
|
hairstyleComponentId: body2.hairstyleComponentId,
|
|
@@ -77954,12 +76994,12 @@ var init_character_controller = __esm(() => {
|
|
|
77954
76994
|
} catch (error2) {
|
|
77955
76995
|
if (error2 instanceof exports_external.ZodError) {
|
|
77956
76996
|
const details = formatZodError(error2);
|
|
77957
|
-
|
|
76997
|
+
logger36.warn("Equip accessory validation failed", { details });
|
|
77958
76998
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
77959
76999
|
}
|
|
77960
77000
|
throw ApiError.badRequest("Invalid JSON body");
|
|
77961
77001
|
}
|
|
77962
|
-
|
|
77002
|
+
logger36.debug("Equipping accessory", {
|
|
77963
77003
|
userId: ctx.user.id,
|
|
77964
77004
|
slot: body2.slot,
|
|
77965
77005
|
accessoryComponentId: body2.accessoryComponentId
|
|
@@ -77971,7 +77011,7 @@ var init_character_controller = __esm(() => {
|
|
|
77971
77011
|
if (!slot) {
|
|
77972
77012
|
throw ApiError.badRequest("Slot is required in the URL path");
|
|
77973
77013
|
}
|
|
77974
|
-
|
|
77014
|
+
logger36.debug("Removing accessory", { userId: ctx.user.id, slot });
|
|
77975
77015
|
await ctx.services.character.removeAccessory(slot, ctx.user);
|
|
77976
77016
|
return { success: true };
|
|
77977
77017
|
});
|
|
@@ -77987,7 +77027,7 @@ var init_character_controller = __esm(() => {
|
|
|
77987
77027
|
});
|
|
77988
77028
|
|
|
77989
77029
|
// ../api-core/src/controllers/currency.controller.ts
|
|
77990
|
-
var
|
|
77030
|
+
var logger37, list, getById, create2, update3, remove, currencyController;
|
|
77991
77031
|
var init_currency_controller = __esm(() => {
|
|
77992
77032
|
init_esm();
|
|
77993
77033
|
init_schemas_index();
|
|
@@ -77995,9 +77035,9 @@ var init_currency_controller = __esm(() => {
|
|
|
77995
77035
|
init_src4();
|
|
77996
77036
|
init_errors();
|
|
77997
77037
|
init_utils11();
|
|
77998
|
-
|
|
77038
|
+
logger37 = log.scope("CurrencyController");
|
|
77999
77039
|
list = requireAuth(async (ctx) => {
|
|
78000
|
-
|
|
77040
|
+
logger37.debug("Listing currencies", { userId: ctx.user.id });
|
|
78001
77041
|
return ctx.services.currency.list();
|
|
78002
77042
|
});
|
|
78003
77043
|
getById = requireAuth(async (ctx) => {
|
|
@@ -78008,7 +77048,7 @@ var init_currency_controller = __esm(() => {
|
|
|
78008
77048
|
if (!isValidUUID(currencyId)) {
|
|
78009
77049
|
throw ApiError.unprocessableEntity("currencyId must be a valid UUID format");
|
|
78010
77050
|
}
|
|
78011
|
-
|
|
77051
|
+
logger37.debug("Getting currency", { userId: ctx.user.id, currencyId });
|
|
78012
77052
|
return ctx.services.currency.getById(currencyId);
|
|
78013
77053
|
});
|
|
78014
77054
|
create2 = requireAdmin(async (ctx) => {
|
|
@@ -78019,12 +77059,12 @@ var init_currency_controller = __esm(() => {
|
|
|
78019
77059
|
} catch (error2) {
|
|
78020
77060
|
if (error2 instanceof exports_external.ZodError) {
|
|
78021
77061
|
const details = formatZodError(error2);
|
|
78022
|
-
|
|
77062
|
+
logger37.warn("Create currency validation failed", { details });
|
|
78023
77063
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
78024
77064
|
}
|
|
78025
77065
|
throw ApiError.badRequest("Invalid JSON body");
|
|
78026
77066
|
}
|
|
78027
|
-
|
|
77067
|
+
logger37.debug("Creating currency", {
|
|
78028
77068
|
userId: ctx.user.id,
|
|
78029
77069
|
symbol: body2.symbol,
|
|
78030
77070
|
itemId: body2.itemId,
|
|
@@ -78047,12 +77087,12 @@ var init_currency_controller = __esm(() => {
|
|
|
78047
77087
|
} catch (error2) {
|
|
78048
77088
|
if (error2 instanceof exports_external.ZodError) {
|
|
78049
77089
|
const details = formatZodError(error2);
|
|
78050
|
-
|
|
77090
|
+
logger37.warn("Update currency validation failed", { details });
|
|
78051
77091
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
78052
77092
|
}
|
|
78053
77093
|
throw ApiError.badRequest("Invalid JSON body");
|
|
78054
77094
|
}
|
|
78055
|
-
|
|
77095
|
+
logger37.debug("Updating currency", {
|
|
78056
77096
|
userId: ctx.user.id,
|
|
78057
77097
|
currencyId,
|
|
78058
77098
|
symbol: body2.symbol,
|
|
@@ -78069,7 +77109,7 @@ var init_currency_controller = __esm(() => {
|
|
|
78069
77109
|
if (!isValidUUID(currencyId)) {
|
|
78070
77110
|
throw ApiError.unprocessableEntity("currencyId must be a valid UUID format");
|
|
78071
77111
|
}
|
|
78072
|
-
|
|
77112
|
+
logger37.debug("Deleting currency", { userId: ctx.user.id, currencyId });
|
|
78073
77113
|
await ctx.services.currency.delete(currencyId);
|
|
78074
77114
|
});
|
|
78075
77115
|
currencyController = {
|
|
@@ -78082,14 +77122,14 @@ var init_currency_controller = __esm(() => {
|
|
|
78082
77122
|
});
|
|
78083
77123
|
|
|
78084
77124
|
// ../api-core/src/controllers/database.controller.ts
|
|
78085
|
-
var
|
|
77125
|
+
var logger38, reset;
|
|
78086
77126
|
var init_database_controller = __esm(() => {
|
|
78087
77127
|
init_esm();
|
|
78088
77128
|
init_schemas_index();
|
|
78089
77129
|
init_src2();
|
|
78090
77130
|
init_errors();
|
|
78091
77131
|
init_utils11();
|
|
78092
|
-
|
|
77132
|
+
logger38 = log.scope("DatabaseController");
|
|
78093
77133
|
reset = requireDeveloper(async (ctx) => {
|
|
78094
77134
|
const slug2 = ctx.params.slug;
|
|
78095
77135
|
if (!slug2) {
|
|
@@ -78102,11 +77142,11 @@ var init_database_controller = __esm(() => {
|
|
|
78102
77142
|
} catch (error2) {
|
|
78103
77143
|
if (error2 instanceof exports_external.ZodError) {
|
|
78104
77144
|
const details = formatZodError(error2);
|
|
78105
|
-
|
|
77145
|
+
logger38.warn("Database reset validation failed", { details });
|
|
78106
77146
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
78107
77147
|
}
|
|
78108
77148
|
}
|
|
78109
|
-
|
|
77149
|
+
logger38.debug("Resetting database", {
|
|
78110
77150
|
userId: ctx.user.id,
|
|
78111
77151
|
slug: slug2,
|
|
78112
77152
|
hasSchema: !!body2.schema
|
|
@@ -87202,28 +86242,28 @@ var init_zip = __esm(() => {
|
|
|
87202
86242
|
});
|
|
87203
86243
|
|
|
87204
86244
|
// ../api-core/src/controllers/deploy.controller.ts
|
|
87205
|
-
var
|
|
86245
|
+
var logger39;
|
|
87206
86246
|
var init_deploy_controller = __esm(() => {
|
|
87207
86247
|
init_schemas_index();
|
|
87208
86248
|
init_src2();
|
|
87209
86249
|
init_zip();
|
|
87210
86250
|
init_errors();
|
|
87211
86251
|
init_utils11();
|
|
87212
|
-
|
|
86252
|
+
logger39 = log.scope("DeployController");
|
|
87213
86253
|
});
|
|
87214
86254
|
|
|
87215
86255
|
// ../api-core/src/controllers/developer.controller.ts
|
|
87216
|
-
var
|
|
86256
|
+
var logger40, apply, getStatus, developer;
|
|
87217
86257
|
var init_developer_controller = __esm(() => {
|
|
87218
86258
|
init_src2();
|
|
87219
86259
|
init_utils11();
|
|
87220
|
-
|
|
86260
|
+
logger40 = log.scope("DeveloperController");
|
|
87221
86261
|
apply = requireAuth(async (ctx) => {
|
|
87222
|
-
|
|
86262
|
+
logger40.debug("Applying for developer status", { userId: ctx.user.id });
|
|
87223
86263
|
await ctx.services.developer.apply(ctx.user);
|
|
87224
86264
|
});
|
|
87225
86265
|
getStatus = requireAuth(async (ctx) => {
|
|
87226
|
-
|
|
86266
|
+
logger40.debug("Getting developer status", { userId: ctx.user.id });
|
|
87227
86267
|
const status = await ctx.services.developer.getStatus(ctx.user.id);
|
|
87228
86268
|
return { status };
|
|
87229
86269
|
});
|
|
@@ -87234,7 +86274,7 @@ var init_developer_controller = __esm(() => {
|
|
|
87234
86274
|
});
|
|
87235
86275
|
|
|
87236
86276
|
// ../api-core/src/controllers/domain.controller.ts
|
|
87237
|
-
var
|
|
86277
|
+
var logger41, add, list2, getStatus2, remove2, domains2;
|
|
87238
86278
|
var init_domain_controller = __esm(() => {
|
|
87239
86279
|
init_esm();
|
|
87240
86280
|
init_schemas_index();
|
|
@@ -87242,7 +86282,7 @@ var init_domain_controller = __esm(() => {
|
|
|
87242
86282
|
init_config2();
|
|
87243
86283
|
init_errors();
|
|
87244
86284
|
init_utils11();
|
|
87245
|
-
|
|
86285
|
+
logger41 = log.scope("DomainController");
|
|
87246
86286
|
add = requireDeveloper(async (ctx) => {
|
|
87247
86287
|
const slug2 = ctx.params.slug;
|
|
87248
86288
|
if (!slug2) {
|
|
@@ -87255,12 +86295,12 @@ var init_domain_controller = __esm(() => {
|
|
|
87255
86295
|
} catch (error2) {
|
|
87256
86296
|
if (error2 instanceof exports_external.ZodError) {
|
|
87257
86297
|
const details = formatZodError(error2);
|
|
87258
|
-
|
|
86298
|
+
logger41.warn("Add domain validation failed", { details });
|
|
87259
86299
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87260
86300
|
}
|
|
87261
86301
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87262
86302
|
}
|
|
87263
|
-
|
|
86303
|
+
logger41.debug("Adding domain", { userId: ctx.user.id, slug: slug2, hostname: body2.hostname });
|
|
87264
86304
|
return ctx.services.domain.add(slug2, body2.hostname, body2.environment, ctx.user);
|
|
87265
86305
|
});
|
|
87266
86306
|
list2 = requireDeveloper(async (ctx) => {
|
|
@@ -87269,7 +86309,7 @@ var init_domain_controller = __esm(() => {
|
|
|
87269
86309
|
throw ApiError.badRequest("Missing game slug");
|
|
87270
86310
|
}
|
|
87271
86311
|
const environment = getPlatformEnvironment(ctx.config);
|
|
87272
|
-
|
|
86312
|
+
logger41.debug("Listing domains", { userId: ctx.user.id, slug: slug2, environment });
|
|
87273
86313
|
const domains2 = await ctx.services.domain.list(slug2, environment, ctx.user);
|
|
87274
86314
|
return { domains: domains2 };
|
|
87275
86315
|
});
|
|
@@ -87284,7 +86324,7 @@ var init_domain_controller = __esm(() => {
|
|
|
87284
86324
|
}
|
|
87285
86325
|
const refresh = ctx.url.searchParams.get("refresh") === "true";
|
|
87286
86326
|
const environment = getPlatformEnvironment(ctx.config);
|
|
87287
|
-
|
|
86327
|
+
logger41.debug("Getting domain status", { userId: ctx.user.id, slug: slug2, hostname, refresh });
|
|
87288
86328
|
return ctx.services.domain.getStatus(slug2, hostname, environment, ctx.user, refresh);
|
|
87289
86329
|
});
|
|
87290
86330
|
remove2 = requireDeveloper(async (ctx) => {
|
|
@@ -87297,7 +86337,7 @@ var init_domain_controller = __esm(() => {
|
|
|
87297
86337
|
throw ApiError.badRequest("Missing hostname");
|
|
87298
86338
|
}
|
|
87299
86339
|
const environment = ctx.config.stage === "production" ? "production" : "staging";
|
|
87300
|
-
|
|
86340
|
+
logger41.debug("Removing domain", { userId: ctx.user.id, slug: slug2, hostname, environment });
|
|
87301
86341
|
await ctx.services.domain.delete(slug2, hostname, environment, ctx.user);
|
|
87302
86342
|
});
|
|
87303
86343
|
domains2 = {
|
|
@@ -87309,7 +86349,7 @@ var init_domain_controller = __esm(() => {
|
|
|
87309
86349
|
});
|
|
87310
86350
|
|
|
87311
86351
|
// ../api-core/src/controllers/game.controller.ts
|
|
87312
|
-
var
|
|
86352
|
+
var logger42, list3, getById2, getBySlug, upsertBySlug, remove3, games2;
|
|
87313
86353
|
var init_game_controller = __esm(() => {
|
|
87314
86354
|
init_esm();
|
|
87315
86355
|
init_schemas_index();
|
|
@@ -87317,9 +86357,9 @@ var init_game_controller = __esm(() => {
|
|
|
87317
86357
|
init_src4();
|
|
87318
86358
|
init_errors();
|
|
87319
86359
|
init_utils11();
|
|
87320
|
-
|
|
86360
|
+
logger42 = log.scope("GameController");
|
|
87321
86361
|
list3 = requireAuth(async (ctx) => {
|
|
87322
|
-
|
|
86362
|
+
logger42.debug("Listing games", { userId: ctx.user.id });
|
|
87323
86363
|
return ctx.services.game.list();
|
|
87324
86364
|
});
|
|
87325
86365
|
getById2 = requireAuth(async (ctx) => {
|
|
@@ -87330,7 +86370,7 @@ var init_game_controller = __esm(() => {
|
|
|
87330
86370
|
if (!isValidUUID(gameId)) {
|
|
87331
86371
|
throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
|
|
87332
86372
|
}
|
|
87333
|
-
|
|
86373
|
+
logger42.debug("Getting game by ID", { userId: ctx.user.id, gameId });
|
|
87334
86374
|
return ctx.services.game.getById(gameId);
|
|
87335
86375
|
});
|
|
87336
86376
|
getBySlug = requireAuth(async (ctx) => {
|
|
@@ -87338,7 +86378,7 @@ var init_game_controller = __esm(() => {
|
|
|
87338
86378
|
if (!slug2) {
|
|
87339
86379
|
throw ApiError.badRequest("Missing game slug");
|
|
87340
86380
|
}
|
|
87341
|
-
|
|
86381
|
+
logger42.debug("Getting game by slug", { userId: ctx.user.id, slug: slug2 });
|
|
87342
86382
|
return ctx.services.game.getBySlug(slug2);
|
|
87343
86383
|
});
|
|
87344
86384
|
upsertBySlug = requireAuth(async (ctx) => {
|
|
@@ -87353,12 +86393,12 @@ var init_game_controller = __esm(() => {
|
|
|
87353
86393
|
} catch (error2) {
|
|
87354
86394
|
if (error2 instanceof exports_external.ZodError) {
|
|
87355
86395
|
const details = formatZodError(error2);
|
|
87356
|
-
|
|
86396
|
+
logger42.warn("Upsert game validation failed", { details });
|
|
87357
86397
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87358
86398
|
}
|
|
87359
86399
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87360
86400
|
}
|
|
87361
|
-
|
|
86401
|
+
logger42.debug("Upserting game", { userId: ctx.user.id, slug: slug2, displayName: body2.displayName });
|
|
87362
86402
|
return ctx.services.game.upsertBySlug(slug2, body2, ctx.user);
|
|
87363
86403
|
});
|
|
87364
86404
|
remove3 = requireAuth(async (ctx) => {
|
|
@@ -87369,7 +86409,7 @@ var init_game_controller = __esm(() => {
|
|
|
87369
86409
|
if (!isValidUUID(gameId)) {
|
|
87370
86410
|
throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
|
|
87371
86411
|
}
|
|
87372
|
-
|
|
86412
|
+
logger42.debug("Deleting game", { userId: ctx.user.id, gameId });
|
|
87373
86413
|
await ctx.services.game.delete(gameId, ctx.user);
|
|
87374
86414
|
});
|
|
87375
86415
|
games2 = {
|
|
@@ -87382,16 +86422,16 @@ var init_game_controller = __esm(() => {
|
|
|
87382
86422
|
});
|
|
87383
86423
|
|
|
87384
86424
|
// ../api-core/src/controllers/inventory.controller.ts
|
|
87385
|
-
var
|
|
86425
|
+
var logger43, list4, addItem, removeItem, inventory;
|
|
87386
86426
|
var init_inventory_controller = __esm(() => {
|
|
87387
86427
|
init_esm();
|
|
87388
86428
|
init_schemas_index();
|
|
87389
86429
|
init_src2();
|
|
87390
86430
|
init_errors();
|
|
87391
86431
|
init_utils11();
|
|
87392
|
-
|
|
86432
|
+
logger43 = log.scope("InventoryController");
|
|
87393
86433
|
list4 = requireAuth(async (ctx) => {
|
|
87394
|
-
|
|
86434
|
+
logger43.debug("Listing inventory", { userId: ctx.user.id });
|
|
87395
86435
|
return ctx.services.inventory.list(ctx.user);
|
|
87396
86436
|
});
|
|
87397
86437
|
addItem = requireAuth(async (ctx) => {
|
|
@@ -87402,12 +86442,12 @@ var init_inventory_controller = __esm(() => {
|
|
|
87402
86442
|
} catch (error2) {
|
|
87403
86443
|
if (error2 instanceof exports_external.ZodError) {
|
|
87404
86444
|
const details = formatZodError(error2);
|
|
87405
|
-
|
|
86445
|
+
logger43.warn("Add inventory item validation failed", { details });
|
|
87406
86446
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
87407
86447
|
}
|
|
87408
86448
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87409
86449
|
}
|
|
87410
|
-
|
|
86450
|
+
logger43.debug("Adding item", {
|
|
87411
86451
|
userId: ctx.user.id,
|
|
87412
86452
|
itemId: body2.itemId,
|
|
87413
86453
|
qty: body2.qty
|
|
@@ -87422,12 +86462,12 @@ var init_inventory_controller = __esm(() => {
|
|
|
87422
86462
|
} catch (error2) {
|
|
87423
86463
|
if (error2 instanceof exports_external.ZodError) {
|
|
87424
86464
|
const details = formatZodError(error2);
|
|
87425
|
-
|
|
86465
|
+
logger43.warn("Remove inventory item validation failed", { details });
|
|
87426
86466
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
87427
86467
|
}
|
|
87428
86468
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87429
86469
|
}
|
|
87430
|
-
|
|
86470
|
+
logger43.debug("Removing item", {
|
|
87431
86471
|
userId: ctx.user.id,
|
|
87432
86472
|
itemId: body2.itemId,
|
|
87433
86473
|
qty: body2.qty
|
|
@@ -87442,7 +86482,7 @@ var init_inventory_controller = __esm(() => {
|
|
|
87442
86482
|
});
|
|
87443
86483
|
|
|
87444
86484
|
// ../api-core/src/controllers/item.controller.ts
|
|
87445
|
-
var
|
|
86485
|
+
var logger44, list5, getById3, resolve2, create3, update4, remove4, listByGame, createForGame, updateForGame, deleteForGame, items2;
|
|
87446
86486
|
var init_item_controller = __esm(() => {
|
|
87447
86487
|
init_esm();
|
|
87448
86488
|
init_schemas_index();
|
|
@@ -87450,10 +86490,10 @@ var init_item_controller = __esm(() => {
|
|
|
87450
86490
|
init_src4();
|
|
87451
86491
|
init_errors();
|
|
87452
86492
|
init_utils11();
|
|
87453
|
-
|
|
86493
|
+
logger44 = log.scope("ItemController");
|
|
87454
86494
|
list5 = requireAuth(async (ctx) => {
|
|
87455
86495
|
const gameId = ctx.url.searchParams.get("gameId") || undefined;
|
|
87456
|
-
|
|
86496
|
+
logger44.debug("Listing items", { userId: ctx.user.id, gameId });
|
|
87457
86497
|
return ctx.services.item.list(gameId);
|
|
87458
86498
|
});
|
|
87459
86499
|
getById3 = requireAuth(async (ctx) => {
|
|
@@ -87464,7 +86504,7 @@ var init_item_controller = __esm(() => {
|
|
|
87464
86504
|
if (!isValidUUID(itemId)) {
|
|
87465
86505
|
throw ApiError.unprocessableEntity("itemId must be a valid UUID format");
|
|
87466
86506
|
}
|
|
87467
|
-
|
|
86507
|
+
logger44.debug("Getting item", { userId: ctx.user.id, itemId });
|
|
87468
86508
|
return ctx.services.item.getById(itemId);
|
|
87469
86509
|
});
|
|
87470
86510
|
resolve2 = requireAuth(async (ctx) => {
|
|
@@ -87476,7 +86516,7 @@ var init_item_controller = __esm(() => {
|
|
|
87476
86516
|
if (gameId && !isValidUUID(gameId)) {
|
|
87477
86517
|
throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
|
|
87478
86518
|
}
|
|
87479
|
-
|
|
86519
|
+
logger44.debug("Resolving item", { userId: ctx.user.id, slug: slug2, gameId });
|
|
87480
86520
|
return ctx.services.item.resolveBySlug(slug2, gameId);
|
|
87481
86521
|
});
|
|
87482
86522
|
create3 = requireRole(["admin"], async (ctx) => {
|
|
@@ -87487,12 +86527,12 @@ var init_item_controller = __esm(() => {
|
|
|
87487
86527
|
} catch (error2) {
|
|
87488
86528
|
if (error2 instanceof exports_external.ZodError) {
|
|
87489
86529
|
const details = formatZodError(error2);
|
|
87490
|
-
|
|
86530
|
+
logger44.warn("Create item validation failed", { details });
|
|
87491
86531
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87492
86532
|
}
|
|
87493
86533
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87494
86534
|
}
|
|
87495
|
-
|
|
86535
|
+
logger44.debug("Creating item", {
|
|
87496
86536
|
userId: ctx.user.id,
|
|
87497
86537
|
slug: body2.slug,
|
|
87498
86538
|
displayName: body2.displayName
|
|
@@ -87514,7 +86554,7 @@ var init_item_controller = __esm(() => {
|
|
|
87514
86554
|
} catch (error2) {
|
|
87515
86555
|
if (error2 instanceof exports_external.ZodError) {
|
|
87516
86556
|
const details = formatZodError(error2);
|
|
87517
|
-
|
|
86557
|
+
logger44.warn("Update item validation failed", { details });
|
|
87518
86558
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87519
86559
|
}
|
|
87520
86560
|
throw ApiError.badRequest("Invalid JSON body");
|
|
@@ -87522,7 +86562,7 @@ var init_item_controller = __esm(() => {
|
|
|
87522
86562
|
if (Object.keys(body2).length === 0) {
|
|
87523
86563
|
throw ApiError.badRequest("No update data provided");
|
|
87524
86564
|
}
|
|
87525
|
-
|
|
86565
|
+
logger44.debug("Updating item", {
|
|
87526
86566
|
userId: ctx.user.id,
|
|
87527
86567
|
itemId,
|
|
87528
86568
|
slug: body2.slug,
|
|
@@ -87539,7 +86579,7 @@ var init_item_controller = __esm(() => {
|
|
|
87539
86579
|
if (!isValidUUID(itemId)) {
|
|
87540
86580
|
throw ApiError.unprocessableEntity("itemId must be a valid UUID format");
|
|
87541
86581
|
}
|
|
87542
|
-
|
|
86582
|
+
logger44.debug("Deleting item", { userId: ctx.user.id, itemId });
|
|
87543
86583
|
await ctx.services.item.delete(itemId);
|
|
87544
86584
|
});
|
|
87545
86585
|
listByGame = requireAuth(async (ctx) => {
|
|
@@ -87550,7 +86590,7 @@ var init_item_controller = __esm(() => {
|
|
|
87550
86590
|
if (!isValidUUID(gameId)) {
|
|
87551
86591
|
throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
|
|
87552
86592
|
}
|
|
87553
|
-
|
|
86593
|
+
logger44.debug("Listing game items", { userId: ctx.user.id, gameId });
|
|
87554
86594
|
return ctx.services.item.listByGame(gameId);
|
|
87555
86595
|
});
|
|
87556
86596
|
createForGame = requireAuth(async (ctx) => {
|
|
@@ -87568,12 +86608,12 @@ var init_item_controller = __esm(() => {
|
|
|
87568
86608
|
} catch (error2) {
|
|
87569
86609
|
if (error2 instanceof exports_external.ZodError) {
|
|
87570
86610
|
const details = formatZodError(error2);
|
|
87571
|
-
|
|
86611
|
+
logger44.warn("Create game item validation failed", { details });
|
|
87572
86612
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87573
86613
|
}
|
|
87574
86614
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87575
86615
|
}
|
|
87576
|
-
|
|
86616
|
+
logger44.debug("Creating game item", {
|
|
87577
86617
|
userId: ctx.user.id,
|
|
87578
86618
|
gameId,
|
|
87579
86619
|
slug: body2.slug,
|
|
@@ -87600,7 +86640,7 @@ var init_item_controller = __esm(() => {
|
|
|
87600
86640
|
} catch (error2) {
|
|
87601
86641
|
if (error2 instanceof exports_external.ZodError) {
|
|
87602
86642
|
const details = formatZodError(error2);
|
|
87603
|
-
|
|
86643
|
+
logger44.warn("Update game item validation failed", { details });
|
|
87604
86644
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87605
86645
|
}
|
|
87606
86646
|
throw ApiError.badRequest("Invalid JSON body");
|
|
@@ -87608,7 +86648,7 @@ var init_item_controller = __esm(() => {
|
|
|
87608
86648
|
if (Object.keys(body2).length === 0) {
|
|
87609
86649
|
throw ApiError.badRequest("No update data provided");
|
|
87610
86650
|
}
|
|
87611
|
-
|
|
86651
|
+
logger44.debug("Updating game item", {
|
|
87612
86652
|
userId: ctx.user.id,
|
|
87613
86653
|
gameId,
|
|
87614
86654
|
itemId,
|
|
@@ -87630,7 +86670,7 @@ var init_item_controller = __esm(() => {
|
|
|
87630
86670
|
if (!isValidUUID(itemId)) {
|
|
87631
86671
|
throw ApiError.unprocessableEntity("itemId must be a valid UUID format");
|
|
87632
86672
|
}
|
|
87633
|
-
|
|
86673
|
+
logger44.debug("Deleting game item", { userId: ctx.user.id, gameId, itemId });
|
|
87634
86674
|
await ctx.services.item.deleteForGame(gameId, itemId, ctx.user);
|
|
87635
86675
|
});
|
|
87636
86676
|
items2 = {
|
|
@@ -87648,7 +86688,7 @@ var init_item_controller = __esm(() => {
|
|
|
87648
86688
|
});
|
|
87649
86689
|
|
|
87650
86690
|
// ../api-core/src/controllers/leaderboard.controller.ts
|
|
87651
|
-
var
|
|
86691
|
+
var logger45, submitScore, getGlobalLeaderboard, getLeaderboard, getUserRank, getUserAllScores, getUserScores, leaderboard;
|
|
87652
86692
|
var init_leaderboard_controller = __esm(() => {
|
|
87653
86693
|
init_esm();
|
|
87654
86694
|
init_schemas_index();
|
|
@@ -87656,7 +86696,7 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87656
86696
|
init_src4();
|
|
87657
86697
|
init_errors();
|
|
87658
86698
|
init_utils11();
|
|
87659
|
-
|
|
86699
|
+
logger45 = log.scope("LeaderboardController");
|
|
87660
86700
|
submitScore = requireAuth(async (ctx) => {
|
|
87661
86701
|
const gameId = ctx.params.gameId;
|
|
87662
86702
|
if (!gameId) {
|
|
@@ -87669,12 +86709,12 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87669
86709
|
} catch (error2) {
|
|
87670
86710
|
if (error2 instanceof exports_external.ZodError) {
|
|
87671
86711
|
const details = formatZodError(error2);
|
|
87672
|
-
|
|
86712
|
+
logger45.warn("Submit score validation failed", { details });
|
|
87673
86713
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87674
86714
|
}
|
|
87675
86715
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87676
86716
|
}
|
|
87677
|
-
|
|
86717
|
+
logger45.debug("Submitting score", {
|
|
87678
86718
|
userId: ctx.user.id,
|
|
87679
86719
|
gameId,
|
|
87680
86720
|
score: body2.score
|
|
@@ -87697,12 +86737,12 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87697
86737
|
} catch (error2) {
|
|
87698
86738
|
if (error2 instanceof exports_external.ZodError) {
|
|
87699
86739
|
const details = formatZodError(error2);
|
|
87700
|
-
|
|
86740
|
+
logger45.warn("Get global leaderboard query validation failed", { details });
|
|
87701
86741
|
throw ApiError.badRequest("Invalid query parameters", details);
|
|
87702
86742
|
}
|
|
87703
86743
|
throw ApiError.badRequest("Invalid query parameters");
|
|
87704
86744
|
}
|
|
87705
|
-
|
|
86745
|
+
logger45.debug("Getting global leaderboard", {
|
|
87706
86746
|
userId: ctx.user.id,
|
|
87707
86747
|
gameId,
|
|
87708
86748
|
...query
|
|
@@ -87725,12 +86765,12 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87725
86765
|
} catch (error2) {
|
|
87726
86766
|
if (error2 instanceof exports_external.ZodError) {
|
|
87727
86767
|
const details = formatZodError(error2);
|
|
87728
|
-
|
|
86768
|
+
logger45.warn("Get leaderboard query validation failed", { details });
|
|
87729
86769
|
throw ApiError.badRequest("Invalid query parameters", details);
|
|
87730
86770
|
}
|
|
87731
86771
|
throw ApiError.badRequest("Invalid query parameters");
|
|
87732
86772
|
}
|
|
87733
|
-
|
|
86773
|
+
logger45.debug("Getting leaderboard", {
|
|
87734
86774
|
userId: ctx.user.id,
|
|
87735
86775
|
gameId,
|
|
87736
86776
|
...query
|
|
@@ -87745,7 +86785,7 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87745
86785
|
if (!isValidUUID(userId)) {
|
|
87746
86786
|
throw ApiError.unprocessableEntity("userId must be a valid UUID format");
|
|
87747
86787
|
}
|
|
87748
|
-
|
|
86788
|
+
logger45.debug("Getting user rank", {
|
|
87749
86789
|
requesterId: ctx.user.id,
|
|
87750
86790
|
gameId,
|
|
87751
86791
|
targetUserId: userId
|
|
@@ -87763,7 +86803,7 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87763
86803
|
const url = ctx.url;
|
|
87764
86804
|
const limit = Math.min(Number(url.searchParams.get("limit") || "50"), 100);
|
|
87765
86805
|
const gameId = url.searchParams.get("gameId") || undefined;
|
|
87766
|
-
|
|
86806
|
+
logger45.debug("Getting user all scores", {
|
|
87767
86807
|
requesterId: ctx.user.id,
|
|
87768
86808
|
targetUserId: userId,
|
|
87769
86809
|
gameId,
|
|
@@ -87781,7 +86821,7 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87781
86821
|
}
|
|
87782
86822
|
const url = ctx.url;
|
|
87783
86823
|
const limit = Math.min(Number(url.searchParams.get("limit") || "10"), 100);
|
|
87784
|
-
|
|
86824
|
+
logger45.debug("Getting user scores", {
|
|
87785
86825
|
requesterId: ctx.user.id,
|
|
87786
86826
|
gameId,
|
|
87787
86827
|
targetUserId: userId,
|
|
@@ -87801,7 +86841,7 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
87801
86841
|
|
|
87802
86842
|
// ../api-core/src/controllers/level.controller.ts
|
|
87803
86843
|
async function listConfigs(ctx) {
|
|
87804
|
-
|
|
86844
|
+
logger46.debug("Listing level configs");
|
|
87805
86845
|
return ctx.services.level.listConfigs();
|
|
87806
86846
|
}
|
|
87807
86847
|
async function getConfig(ctx) {
|
|
@@ -87813,21 +86853,21 @@ async function getConfig(ctx) {
|
|
|
87813
86853
|
if (isNaN(level) || level < 1) {
|
|
87814
86854
|
throw ApiError.badRequest("Level must be a positive integer");
|
|
87815
86855
|
}
|
|
87816
|
-
|
|
86856
|
+
logger46.debug("Getting level config", { level });
|
|
87817
86857
|
return ctx.services.level.getConfig(level);
|
|
87818
86858
|
}
|
|
87819
|
-
var
|
|
86859
|
+
var logger46, getByUser, getProgress, levels;
|
|
87820
86860
|
var init_level_controller = __esm(() => {
|
|
87821
86861
|
init_src2();
|
|
87822
86862
|
init_errors();
|
|
87823
86863
|
init_utils11();
|
|
87824
|
-
|
|
86864
|
+
logger46 = log.scope("LevelController");
|
|
87825
86865
|
getByUser = requireAuth(async (ctx) => {
|
|
87826
|
-
|
|
86866
|
+
logger46.debug("Getting user level", { userId: ctx.user.id });
|
|
87827
86867
|
return ctx.services.level.getByUser(ctx.user);
|
|
87828
86868
|
});
|
|
87829
86869
|
getProgress = requireAuth(async (ctx) => {
|
|
87830
|
-
|
|
86870
|
+
logger46.debug("Getting level progress", { userId: ctx.user.id });
|
|
87831
86871
|
return ctx.services.level.getProgress(ctx.user);
|
|
87832
86872
|
});
|
|
87833
86873
|
levels = {
|
|
@@ -87838,35 +86878,59 @@ var init_level_controller = __esm(() => {
|
|
|
87838
86878
|
};
|
|
87839
86879
|
});
|
|
87840
86880
|
|
|
86881
|
+
// ../api-core/src/controllers/logs.controller.ts
|
|
86882
|
+
var logger47, generateToken, logs;
|
|
86883
|
+
var init_logs_controller = __esm(() => {
|
|
86884
|
+
init_src2();
|
|
86885
|
+
init_errors();
|
|
86886
|
+
init_utils11();
|
|
86887
|
+
logger47 = log.scope("LogsController");
|
|
86888
|
+
generateToken = requireDeveloper(async (ctx) => {
|
|
86889
|
+
const slug2 = ctx.params.slug;
|
|
86890
|
+
if (!slug2) {
|
|
86891
|
+
throw ApiError.badRequest("Missing game slug");
|
|
86892
|
+
}
|
|
86893
|
+
let body2;
|
|
86894
|
+
try {
|
|
86895
|
+
const json4 = await ctx.request.json();
|
|
86896
|
+
if (json4.environment !== "staging" && json4.environment !== "production") {
|
|
86897
|
+
throw ApiError.badRequest('Invalid environment. Must be "staging" or "production".');
|
|
86898
|
+
}
|
|
86899
|
+
body2 = json4;
|
|
86900
|
+
} catch (error2) {
|
|
86901
|
+
if (error2 instanceof ApiError)
|
|
86902
|
+
throw error2;
|
|
86903
|
+
throw ApiError.badRequest("Invalid JSON body");
|
|
86904
|
+
}
|
|
86905
|
+
logger47.debug("Generating log stream token", {
|
|
86906
|
+
userId: ctx.user.id,
|
|
86907
|
+
slug: slug2,
|
|
86908
|
+
environment: body2.environment
|
|
86909
|
+
});
|
|
86910
|
+
return ctx.services.logs.generateToken(ctx.user, slug2, body2.environment);
|
|
86911
|
+
});
|
|
86912
|
+
logs = {
|
|
86913
|
+
generateToken
|
|
86914
|
+
};
|
|
86915
|
+
});
|
|
86916
|
+
|
|
87841
86917
|
// ../api-core/src/controllers/lti.controller.ts
|
|
87842
|
-
|
|
87843
|
-
const formData = await ctx.request.formData();
|
|
87844
|
-
const idToken = formData.get("id_token");
|
|
87845
|
-
if (!idToken || typeof idToken !== "string") {
|
|
87846
|
-
throw ApiError.badRequest("Missing or invalid id_token");
|
|
87847
|
-
}
|
|
87848
|
-
const currentHost = ctx.url.hostname;
|
|
87849
|
-
logger46.debug("Processing launch", { host: currentHost });
|
|
87850
|
-
return ctx.services.lti.processLaunch(idToken, currentHost);
|
|
87851
|
-
}
|
|
87852
|
-
var logger46, getStatus3, lti;
|
|
86918
|
+
var logger48, getStatus3, lti;
|
|
87853
86919
|
var init_lti_controller = __esm(() => {
|
|
87854
86920
|
init_src2();
|
|
87855
|
-
init_errors();
|
|
87856
86921
|
init_utils11();
|
|
87857
|
-
|
|
86922
|
+
logger48 = log.scope("LtiController");
|
|
87858
86923
|
getStatus3 = requireAuth(async (ctx) => {
|
|
87859
|
-
|
|
86924
|
+
logger48.debug("Getting status", { userId: ctx.user.id });
|
|
87860
86925
|
return ctx.services.lti.getStatus(ctx.user);
|
|
87861
86926
|
});
|
|
87862
86927
|
lti = {
|
|
87863
|
-
launch,
|
|
87864
86928
|
getStatus: getStatus3
|
|
87865
86929
|
};
|
|
87866
86930
|
});
|
|
87867
86931
|
|
|
87868
86932
|
// ../api-core/src/controllers/map.controller.ts
|
|
87869
|
-
var
|
|
86933
|
+
var logger49, getByIdentifier, getElements, getObjects, createObject, deleteObject, maps2;
|
|
87870
86934
|
var init_map_controller = __esm(() => {
|
|
87871
86935
|
init_esm();
|
|
87872
86936
|
init_schemas_index();
|
|
@@ -87874,13 +86938,13 @@ var init_map_controller = __esm(() => {
|
|
|
87874
86938
|
init_src4();
|
|
87875
86939
|
init_errors();
|
|
87876
86940
|
init_utils11();
|
|
87877
|
-
|
|
86941
|
+
logger49 = log.scope("MapController");
|
|
87878
86942
|
getByIdentifier = requireAuth(async (ctx) => {
|
|
87879
86943
|
const identifier = ctx.params.identifier;
|
|
87880
86944
|
if (!identifier) {
|
|
87881
86945
|
throw ApiError.badRequest("Missing map identifier");
|
|
87882
86946
|
}
|
|
87883
|
-
|
|
86947
|
+
logger49.debug("Getting map", { userId: ctx.user.id, identifier });
|
|
87884
86948
|
return ctx.services.map.getByIdentifier(identifier);
|
|
87885
86949
|
});
|
|
87886
86950
|
getElements = requireAuth(async (ctx) => {
|
|
@@ -87891,7 +86955,7 @@ var init_map_controller = __esm(() => {
|
|
|
87891
86955
|
if (!isValidUUID(mapId)) {
|
|
87892
86956
|
throw ApiError.unprocessableEntity("mapId must be a valid UUID format");
|
|
87893
86957
|
}
|
|
87894
|
-
|
|
86958
|
+
logger49.debug("Getting map elements", { userId: ctx.user.id, mapId });
|
|
87895
86959
|
return ctx.services.map.getElements(mapId);
|
|
87896
86960
|
});
|
|
87897
86961
|
getObjects = requireAuth(async (ctx) => {
|
|
@@ -87902,7 +86966,7 @@ var init_map_controller = __esm(() => {
|
|
|
87902
86966
|
if (!isValidUUID(mapId)) {
|
|
87903
86967
|
throw ApiError.unprocessableEntity("mapId must be a valid UUID format");
|
|
87904
86968
|
}
|
|
87905
|
-
|
|
86969
|
+
logger49.debug("Getting map objects", { userId: ctx.user.id, mapId });
|
|
87906
86970
|
return ctx.services.map.getObjects(mapId, ctx.user.id);
|
|
87907
86971
|
});
|
|
87908
86972
|
createObject = requireAuth(async (ctx) => {
|
|
@@ -87924,12 +86988,12 @@ var init_map_controller = __esm(() => {
|
|
|
87924
86988
|
} catch (error2) {
|
|
87925
86989
|
if (error2 instanceof exports_external.ZodError) {
|
|
87926
86990
|
const details = formatZodError(error2);
|
|
87927
|
-
|
|
86991
|
+
logger49.warn("Create map object validation failed", { details });
|
|
87928
86992
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
87929
86993
|
}
|
|
87930
86994
|
throw ApiError.badRequest("Invalid JSON body");
|
|
87931
86995
|
}
|
|
87932
|
-
|
|
86996
|
+
logger49.debug("Creating map object", {
|
|
87933
86997
|
userId: ctx.user.id,
|
|
87934
86998
|
mapId,
|
|
87935
86999
|
itemId: body2.itemId,
|
|
@@ -87953,7 +87017,7 @@ var init_map_controller = __esm(() => {
|
|
|
87953
87017
|
if (!isValidUUID(objectId)) {
|
|
87954
87018
|
throw ApiError.unprocessableEntity("objectId must be a valid UUID format");
|
|
87955
87019
|
}
|
|
87956
|
-
|
|
87020
|
+
logger49.debug("Deleting map object", { userId: ctx.user.id, mapId, objectId });
|
|
87957
87021
|
await ctx.services.map.deleteObject(mapId, objectId, ctx.user);
|
|
87958
87022
|
});
|
|
87959
87023
|
maps2 = {
|
|
@@ -87966,14 +87030,14 @@ var init_map_controller = __esm(() => {
|
|
|
87966
87030
|
});
|
|
87967
87031
|
|
|
87968
87032
|
// ../api-core/src/controllers/notification.controller.ts
|
|
87969
|
-
var
|
|
87033
|
+
var logger50, list6, updateStatus, getStats, create4, deliver, notifications2;
|
|
87970
87034
|
var init_notification_controller = __esm(() => {
|
|
87971
87035
|
init_esm();
|
|
87972
87036
|
init_schemas_index();
|
|
87973
87037
|
init_src2();
|
|
87974
87038
|
init_errors();
|
|
87975
87039
|
init_utils11();
|
|
87976
|
-
|
|
87040
|
+
logger50 = log.scope("NotificationController");
|
|
87977
87041
|
list6 = requireAuth(async (ctx) => {
|
|
87978
87042
|
const query = {
|
|
87979
87043
|
status: ctx.url.searchParams.get("status") || undefined,
|
|
@@ -87984,10 +87048,10 @@ var init_notification_controller = __esm(() => {
|
|
|
87984
87048
|
const result = NotificationListQuerySchema.omit({ userId: true }).safeParse(query);
|
|
87985
87049
|
if (!result.success) {
|
|
87986
87050
|
const details = formatZodError(result.error);
|
|
87987
|
-
|
|
87051
|
+
logger50.warn("List notifications query validation failed", { details });
|
|
87988
87052
|
throw ApiError.badRequest("Invalid query parameters", details);
|
|
87989
87053
|
}
|
|
87990
|
-
|
|
87054
|
+
logger50.debug("Listing notifications", { userId: ctx.user.id, ...result.data });
|
|
87991
87055
|
return ctx.services.notification.list(ctx.user, result.data);
|
|
87992
87056
|
});
|
|
87993
87057
|
updateStatus = requireAuth(async (ctx) => {
|
|
@@ -88002,12 +87066,12 @@ var init_notification_controller = __esm(() => {
|
|
|
88002
87066
|
} catch (error2) {
|
|
88003
87067
|
if (error2 instanceof exports_external.ZodError) {
|
|
88004
87068
|
const details = formatZodError(error2);
|
|
88005
|
-
|
|
87069
|
+
logger50.warn("Update notification status validation failed", { details });
|
|
88006
87070
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
88007
87071
|
}
|
|
88008
87072
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88009
87073
|
}
|
|
88010
|
-
|
|
87074
|
+
logger50.debug("Updating status", {
|
|
88011
87075
|
userId: ctx.user.id,
|
|
88012
87076
|
notificationId,
|
|
88013
87077
|
status: body2.status
|
|
@@ -88017,7 +87081,7 @@ var init_notification_controller = __esm(() => {
|
|
|
88017
87081
|
getStats = requireAuth(async (ctx) => {
|
|
88018
87082
|
const startDate = ctx.url.searchParams.get("startDate");
|
|
88019
87083
|
const endDate = ctx.url.searchParams.get("endDate");
|
|
88020
|
-
|
|
87084
|
+
logger50.debug("Getting stats", { userId: ctx.user.id, startDate, endDate });
|
|
88021
87085
|
return ctx.services.notification.getStats(ctx.user, {
|
|
88022
87086
|
startDate: startDate ? new Date(startDate) : undefined,
|
|
88023
87087
|
endDate: endDate ? new Date(endDate) : undefined
|
|
@@ -88031,12 +87095,12 @@ var init_notification_controller = __esm(() => {
|
|
|
88031
87095
|
} catch (error2) {
|
|
88032
87096
|
if (error2 instanceof exports_external.ZodError) {
|
|
88033
87097
|
const details = formatZodError(error2);
|
|
88034
|
-
|
|
87098
|
+
logger50.warn("Create notification validation failed", { details });
|
|
88035
87099
|
throw ApiError.unprocessableEntity("Invalid request body", details);
|
|
88036
87100
|
}
|
|
88037
87101
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88038
87102
|
}
|
|
88039
|
-
|
|
87103
|
+
logger50.debug("Creating notification", {
|
|
88040
87104
|
userId: ctx.user.id,
|
|
88041
87105
|
targetUserId: body2.userId,
|
|
88042
87106
|
type: body2.type
|
|
@@ -88054,12 +87118,12 @@ var init_notification_controller = __esm(() => {
|
|
|
88054
87118
|
});
|
|
88055
87119
|
});
|
|
88056
87120
|
deliver = requireAuth(async (ctx) => {
|
|
88057
|
-
|
|
87121
|
+
logger50.debug("Delivering notifications", { userId: ctx.user.id });
|
|
88058
87122
|
try {
|
|
88059
87123
|
await ctx.services.notification.deliverPending(ctx.user.id);
|
|
88060
87124
|
return { success: true };
|
|
88061
87125
|
} catch (error2) {
|
|
88062
|
-
|
|
87126
|
+
logger50.error("Failed to deliver notifications", { error: error2 });
|
|
88063
87127
|
throw ApiError.internal("Failed to deliver notifications");
|
|
88064
87128
|
}
|
|
88065
87129
|
});
|
|
@@ -88073,51 +87137,42 @@ var init_notification_controller = __esm(() => {
|
|
|
88073
87137
|
});
|
|
88074
87138
|
|
|
88075
87139
|
// ../api-core/src/controllers/realtime.controller.ts
|
|
88076
|
-
var
|
|
87140
|
+
var logger51, generateToken2, realtime;
|
|
88077
87141
|
var init_realtime_controller = __esm(() => {
|
|
88078
87142
|
init_src2();
|
|
88079
87143
|
init_utils11();
|
|
88080
|
-
|
|
88081
|
-
|
|
87144
|
+
logger51 = log.scope("RealtimeController");
|
|
87145
|
+
generateToken2 = requireAuth(async (ctx) => {
|
|
88082
87146
|
const gameIdOrSlug = ctx.params.gameId;
|
|
88083
|
-
|
|
87147
|
+
logger51.debug("Generating token", {
|
|
88084
87148
|
userId: ctx.user.id,
|
|
88085
87149
|
gameId: gameIdOrSlug || "global"
|
|
88086
87150
|
});
|
|
88087
87151
|
return ctx.services.realtime.generateToken(ctx.user, gameIdOrSlug);
|
|
88088
87152
|
});
|
|
88089
87153
|
realtime = {
|
|
88090
|
-
generateToken
|
|
87154
|
+
generateToken: generateToken2
|
|
88091
87155
|
};
|
|
88092
87156
|
});
|
|
88093
87157
|
|
|
88094
87158
|
// ../api-core/src/controllers/secrets.controller.ts
|
|
88095
|
-
var
|
|
87159
|
+
var logger52, listKeys, setSecrets, deleteSecret, secrets;
|
|
88096
87160
|
var init_secrets_controller = __esm(() => {
|
|
88097
87161
|
init_esm();
|
|
88098
87162
|
init_schemas_index();
|
|
88099
87163
|
init_src2();
|
|
88100
87164
|
init_errors();
|
|
88101
87165
|
init_utils11();
|
|
88102
|
-
|
|
87166
|
+
logger52 = log.scope("SecretsController");
|
|
88103
87167
|
listKeys = requireDeveloper(async (ctx) => {
|
|
88104
87168
|
const slug2 = ctx.params.slug;
|
|
88105
87169
|
if (!slug2) {
|
|
88106
87170
|
throw ApiError.badRequest("Missing game slug");
|
|
88107
87171
|
}
|
|
88108
|
-
|
|
87172
|
+
logger52.debug("Listing secret keys", { userId: ctx.user.id, slug: slug2 });
|
|
88109
87173
|
const keys = await ctx.services.secrets.listKeys(slug2, ctx.user);
|
|
88110
87174
|
return { keys };
|
|
88111
87175
|
});
|
|
88112
|
-
getValues = requireDeveloper(async (ctx) => {
|
|
88113
|
-
const slug2 = ctx.params.slug;
|
|
88114
|
-
if (!slug2) {
|
|
88115
|
-
throw ApiError.badRequest("Missing game slug");
|
|
88116
|
-
}
|
|
88117
|
-
logger50.debug("Getting secret values", { userId: ctx.user.id, slug: slug2 });
|
|
88118
|
-
const secrets = await ctx.services.secrets.getValues(slug2, ctx.user);
|
|
88119
|
-
return { secrets };
|
|
88120
|
-
});
|
|
88121
87176
|
setSecrets = requireDeveloper(async (ctx) => {
|
|
88122
87177
|
const slug2 = ctx.params.slug;
|
|
88123
87178
|
if (!slug2) {
|
|
@@ -88130,12 +87185,12 @@ var init_secrets_controller = __esm(() => {
|
|
|
88130
87185
|
} catch (error2) {
|
|
88131
87186
|
if (error2 instanceof exports_external.ZodError) {
|
|
88132
87187
|
const details = formatZodError(error2);
|
|
88133
|
-
|
|
87188
|
+
logger52.warn("Set secrets validation failed", { details });
|
|
88134
87189
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88135
87190
|
}
|
|
88136
87191
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88137
87192
|
}
|
|
88138
|
-
|
|
87193
|
+
logger52.debug("Setting secrets", {
|
|
88139
87194
|
userId: ctx.user.id,
|
|
88140
87195
|
slug: slug2,
|
|
88141
87196
|
keyCount: Object.keys(body2).length
|
|
@@ -88152,27 +87207,26 @@ var init_secrets_controller = __esm(() => {
|
|
|
88152
87207
|
if (!key) {
|
|
88153
87208
|
throw ApiError.badRequest("Missing secret key");
|
|
88154
87209
|
}
|
|
88155
|
-
|
|
87210
|
+
logger52.debug("Deleting secret", { userId: ctx.user.id, slug: slug2, key });
|
|
88156
87211
|
await ctx.services.secrets.deleteSecret(slug2, key, ctx.user);
|
|
88157
87212
|
return { success: true };
|
|
88158
87213
|
});
|
|
88159
87214
|
secrets = {
|
|
88160
87215
|
listKeys,
|
|
88161
|
-
getValues,
|
|
88162
87216
|
setSecrets,
|
|
88163
87217
|
deleteSecret
|
|
88164
87218
|
};
|
|
88165
87219
|
});
|
|
88166
87220
|
|
|
88167
87221
|
// ../api-core/src/controllers/seed.controller.ts
|
|
88168
|
-
var
|
|
87222
|
+
var logger53, seed;
|
|
88169
87223
|
var init_seed_controller = __esm(() => {
|
|
88170
87224
|
init_esm();
|
|
88171
87225
|
init_schemas_index();
|
|
88172
87226
|
init_src2();
|
|
88173
87227
|
init_errors();
|
|
88174
87228
|
init_utils11();
|
|
88175
|
-
|
|
87229
|
+
logger53 = log.scope("SeedController");
|
|
88176
87230
|
seed = requireDeveloper(async (ctx) => {
|
|
88177
87231
|
const slug2 = ctx.params.slug;
|
|
88178
87232
|
if (!slug2) {
|
|
@@ -88185,29 +87239,29 @@ var init_seed_controller = __esm(() => {
|
|
|
88185
87239
|
} catch (error2) {
|
|
88186
87240
|
if (error2 instanceof exports_external.ZodError) {
|
|
88187
87241
|
const details = formatZodError(error2);
|
|
88188
|
-
|
|
87242
|
+
logger53.warn("Seed database validation failed", { details });
|
|
88189
87243
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88190
87244
|
}
|
|
88191
87245
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88192
87246
|
}
|
|
88193
|
-
|
|
87247
|
+
logger53.debug("Seeding database", { userId: ctx.user.id, slug: slug2, codeLength: body2.code.length });
|
|
88194
87248
|
return ctx.services.seed.seed(slug2, body2.code, ctx.user);
|
|
88195
87249
|
});
|
|
88196
87250
|
});
|
|
88197
87251
|
|
|
88198
87252
|
// ../api-core/src/controllers/session.controller.ts
|
|
88199
|
-
var
|
|
87253
|
+
var logger54, start2, end, mintToken, sessions2;
|
|
88200
87254
|
var init_session_controller = __esm(() => {
|
|
88201
87255
|
init_src2();
|
|
88202
87256
|
init_errors();
|
|
88203
87257
|
init_utils11();
|
|
88204
|
-
|
|
87258
|
+
logger54 = log.scope("SessionController");
|
|
88205
87259
|
start2 = requireAuth(async (ctx) => {
|
|
88206
87260
|
const gameIdOrSlug = ctx.params.gameId;
|
|
88207
87261
|
if (!gameIdOrSlug) {
|
|
88208
87262
|
throw ApiError.badRequest("Missing game ID or slug");
|
|
88209
87263
|
}
|
|
88210
|
-
|
|
87264
|
+
logger54.debug("Starting session", { userId: ctx.user.id, gameIdOrSlug });
|
|
88211
87265
|
return ctx.services.session.start(gameIdOrSlug, ctx.user.id);
|
|
88212
87266
|
});
|
|
88213
87267
|
end = requireAuth(async (ctx) => {
|
|
@@ -88219,7 +87273,7 @@ var init_session_controller = __esm(() => {
|
|
|
88219
87273
|
if (!sessionId) {
|
|
88220
87274
|
throw ApiError.badRequest("Missing session ID");
|
|
88221
87275
|
}
|
|
88222
|
-
|
|
87276
|
+
logger54.debug("Ending session", { userId: ctx.user.id, gameIdOrSlug, sessionId });
|
|
88223
87277
|
return ctx.services.session.end(gameIdOrSlug, sessionId, ctx.user.id);
|
|
88224
87278
|
});
|
|
88225
87279
|
mintToken = requireAuth(async (ctx) => {
|
|
@@ -88227,7 +87281,7 @@ var init_session_controller = __esm(() => {
|
|
|
88227
87281
|
if (!gameIdOrSlug) {
|
|
88228
87282
|
throw ApiError.badRequest("Missing game ID or slug");
|
|
88229
87283
|
}
|
|
88230
|
-
|
|
87284
|
+
logger54.debug("Minting token", { userId: ctx.user.id, gameIdOrSlug });
|
|
88231
87285
|
return ctx.services.session.mintToken(gameIdOrSlug, ctx.user.id);
|
|
88232
87286
|
});
|
|
88233
87287
|
sessions2 = {
|
|
@@ -88238,13 +87292,13 @@ var init_session_controller = __esm(() => {
|
|
|
88238
87292
|
});
|
|
88239
87293
|
|
|
88240
87294
|
// ../api-core/src/controllers/shop.controller.ts
|
|
88241
|
-
var
|
|
87295
|
+
var logger55, getShopView, shop;
|
|
88242
87296
|
var init_shop_controller = __esm(() => {
|
|
88243
87297
|
init_src2();
|
|
88244
87298
|
init_utils11();
|
|
88245
|
-
|
|
87299
|
+
logger55 = log.scope("ShopController");
|
|
88246
87300
|
getShopView = requireAuth(async (ctx) => {
|
|
88247
|
-
|
|
87301
|
+
logger55.debug("Getting shop view", { userId: ctx.user.id });
|
|
88248
87302
|
return ctx.services.shop.getShopView(ctx.user);
|
|
88249
87303
|
});
|
|
88250
87304
|
shop = {
|
|
@@ -88253,7 +87307,7 @@ var init_shop_controller = __esm(() => {
|
|
|
88253
87307
|
});
|
|
88254
87308
|
|
|
88255
87309
|
// ../api-core/src/controllers/shop-listing.controller.ts
|
|
88256
|
-
var
|
|
87310
|
+
var logger56, list7, getById4, create5, update5, remove5, listByGame2, getByGameItem, createForGameItem, updateForGameItem, deleteForGameItem, shopListings2;
|
|
88257
87311
|
var init_shop_listing_controller = __esm(() => {
|
|
88258
87312
|
init_esm();
|
|
88259
87313
|
init_schemas_index();
|
|
@@ -88261,9 +87315,9 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88261
87315
|
init_src4();
|
|
88262
87316
|
init_errors();
|
|
88263
87317
|
init_utils11();
|
|
88264
|
-
|
|
87318
|
+
logger56 = log.scope("ShopListingController");
|
|
88265
87319
|
list7 = requireAdmin(async (ctx) => {
|
|
88266
|
-
|
|
87320
|
+
logger56.debug("Listing shop listings", { userId: ctx.user.id });
|
|
88267
87321
|
return ctx.services.shopListing.list();
|
|
88268
87322
|
});
|
|
88269
87323
|
getById4 = requireAdmin(async (ctx) => {
|
|
@@ -88274,7 +87328,7 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88274
87328
|
if (!isValidUUID(listingId)) {
|
|
88275
87329
|
throw ApiError.unprocessableEntity("listingId must be a valid UUID format");
|
|
88276
87330
|
}
|
|
88277
|
-
|
|
87331
|
+
logger56.debug("Getting listing", { userId: ctx.user.id, listingId });
|
|
88278
87332
|
return ctx.services.shopListing.getById(listingId);
|
|
88279
87333
|
});
|
|
88280
87334
|
create5 = requireAdmin(async (ctx) => {
|
|
@@ -88285,12 +87339,12 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88285
87339
|
} catch (error2) {
|
|
88286
87340
|
if (error2 instanceof exports_external.ZodError) {
|
|
88287
87341
|
const details = formatZodError(error2);
|
|
88288
|
-
|
|
87342
|
+
logger56.warn("Create shop listing validation failed", { details });
|
|
88289
87343
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88290
87344
|
}
|
|
88291
87345
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88292
87346
|
}
|
|
88293
|
-
|
|
87347
|
+
logger56.debug("Creating listing", {
|
|
88294
87348
|
userId: ctx.user.id,
|
|
88295
87349
|
itemId: body2.itemId,
|
|
88296
87350
|
currencyId: body2.currencyId,
|
|
@@ -88313,12 +87367,12 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88313
87367
|
} catch (error2) {
|
|
88314
87368
|
if (error2 instanceof exports_external.ZodError) {
|
|
88315
87369
|
const details = formatZodError(error2);
|
|
88316
|
-
|
|
87370
|
+
logger56.warn("Update shop listing validation failed", { details });
|
|
88317
87371
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88318
87372
|
}
|
|
88319
87373
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88320
87374
|
}
|
|
88321
|
-
|
|
87375
|
+
logger56.debug("Updating listing", {
|
|
88322
87376
|
userId: ctx.user.id,
|
|
88323
87377
|
listingId,
|
|
88324
87378
|
price: body2.price,
|
|
@@ -88335,7 +87389,7 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88335
87389
|
if (!isValidUUID(listingId)) {
|
|
88336
87390
|
throw ApiError.unprocessableEntity("listingId must be a valid UUID format");
|
|
88337
87391
|
}
|
|
88338
|
-
|
|
87392
|
+
logger56.debug("Deleting listing", { userId: ctx.user.id, listingId });
|
|
88339
87393
|
await ctx.services.shopListing.delete(listingId);
|
|
88340
87394
|
});
|
|
88341
87395
|
listByGame2 = requireAuth(async (ctx) => {
|
|
@@ -88346,7 +87400,7 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88346
87400
|
if (!isValidUUID(gameId)) {
|
|
88347
87401
|
throw ApiError.unprocessableEntity("gameId must be a valid UUID format");
|
|
88348
87402
|
}
|
|
88349
|
-
|
|
87403
|
+
logger56.debug("Listing game listings", { userId: ctx.user.id, gameId });
|
|
88350
87404
|
return ctx.services.shopListing.listByGame(gameId, ctx.user);
|
|
88351
87405
|
});
|
|
88352
87406
|
getByGameItem = requireAuth(async (ctx) => {
|
|
@@ -88361,7 +87415,7 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88361
87415
|
if (!isValidUUID(itemId)) {
|
|
88362
87416
|
throw ApiError.unprocessableEntity("itemId must be a valid UUID format");
|
|
88363
87417
|
}
|
|
88364
|
-
|
|
87418
|
+
logger56.debug("Getting game item listing", { userId: ctx.user.id, gameId, itemId });
|
|
88365
87419
|
return ctx.services.shopListing.getByGameItem(gameId, itemId, ctx.user);
|
|
88366
87420
|
});
|
|
88367
87421
|
createForGameItem = requireAuth(async (ctx) => {
|
|
@@ -88383,12 +87437,12 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88383
87437
|
} catch (error2) {
|
|
88384
87438
|
if (error2 instanceof exports_external.ZodError) {
|
|
88385
87439
|
const details = formatZodError(error2);
|
|
88386
|
-
|
|
87440
|
+
logger56.warn("Create game item listing validation failed", { details });
|
|
88387
87441
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88388
87442
|
}
|
|
88389
87443
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88390
87444
|
}
|
|
88391
|
-
|
|
87445
|
+
logger56.debug("Creating game item listing", {
|
|
88392
87446
|
userId: ctx.user.id,
|
|
88393
87447
|
gameId,
|
|
88394
87448
|
itemId,
|
|
@@ -88416,12 +87470,12 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88416
87470
|
} catch (error2) {
|
|
88417
87471
|
if (error2 instanceof exports_external.ZodError) {
|
|
88418
87472
|
const details = formatZodError(error2);
|
|
88419
|
-
|
|
87473
|
+
logger56.warn("Update game item listing validation failed", { details });
|
|
88420
87474
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88421
87475
|
}
|
|
88422
87476
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88423
87477
|
}
|
|
88424
|
-
|
|
87478
|
+
logger56.debug("Updating game item listing", {
|
|
88425
87479
|
userId: ctx.user.id,
|
|
88426
87480
|
gameId,
|
|
88427
87481
|
itemId,
|
|
@@ -88443,7 +87497,7 @@ var init_shop_listing_controller = __esm(() => {
|
|
|
88443
87497
|
if (!isValidUUID(itemId)) {
|
|
88444
87498
|
throw ApiError.unprocessableEntity("itemId must be a valid UUID format");
|
|
88445
87499
|
}
|
|
88446
|
-
|
|
87500
|
+
logger56.debug("Deleting game item listing", {
|
|
88447
87501
|
userId: ctx.user.id,
|
|
88448
87502
|
gameId,
|
|
88449
87503
|
itemId
|
|
@@ -88470,21 +87524,21 @@ async function getBySlug2(ctx) {
|
|
|
88470
87524
|
if (!slug2) {
|
|
88471
87525
|
throw ApiError.badRequest("Template slug is required");
|
|
88472
87526
|
}
|
|
88473
|
-
|
|
87527
|
+
logger57.debug("Getting sprite by slug", { slug: slug2 });
|
|
88474
87528
|
return ctx.services.sprite.getBySlug(slug2);
|
|
88475
87529
|
}
|
|
88476
|
-
var
|
|
87530
|
+
var logger57, sprites;
|
|
88477
87531
|
var init_sprite_controller = __esm(() => {
|
|
88478
87532
|
init_src2();
|
|
88479
87533
|
init_errors();
|
|
88480
|
-
|
|
87534
|
+
logger57 = log.scope("SpriteController");
|
|
88481
87535
|
sprites = {
|
|
88482
87536
|
getBySlug: getBySlug2
|
|
88483
87537
|
};
|
|
88484
87538
|
});
|
|
88485
87539
|
|
|
88486
87540
|
// ../api-core/src/controllers/timeback.controller.ts
|
|
88487
|
-
var
|
|
87541
|
+
var logger58, getTodayXp, getTotalXp, updateTodayXp, getXpHistory, populateStudent, getUser, getUserById, setupIntegration, getIntegrations, verifyIntegration, getConfig2, deleteIntegrations, endActivity, timeback2;
|
|
88488
87542
|
var init_timeback_controller = __esm(() => {
|
|
88489
87543
|
init_esm();
|
|
88490
87544
|
init_schemas_index();
|
|
@@ -88492,15 +87546,15 @@ var init_timeback_controller = __esm(() => {
|
|
|
88492
87546
|
init_src4();
|
|
88493
87547
|
init_errors();
|
|
88494
87548
|
init_utils11();
|
|
88495
|
-
|
|
87549
|
+
logger58 = log.scope("TimebackController");
|
|
88496
87550
|
getTodayXp = requireAuth(async (ctx) => {
|
|
88497
87551
|
const date4 = ctx.url.searchParams.get("date") || undefined;
|
|
88498
87552
|
const tz = ctx.url.searchParams.get("tz") || undefined;
|
|
88499
|
-
|
|
87553
|
+
logger58.debug("Getting today XP", { userId: ctx.user.id, date: date4, tz });
|
|
88500
87554
|
return ctx.services.timeback.getTodayXp(ctx.user.id, date4, tz);
|
|
88501
87555
|
});
|
|
88502
87556
|
getTotalXp = requireAuth(async (ctx) => {
|
|
88503
|
-
|
|
87557
|
+
logger58.debug("Getting total XP", { userId: ctx.user.id });
|
|
88504
87558
|
return ctx.services.timeback.getTotalXp(ctx.user.id);
|
|
88505
87559
|
});
|
|
88506
87560
|
updateTodayXp = requireAuth(async (ctx) => {
|
|
@@ -88511,18 +87565,18 @@ var init_timeback_controller = __esm(() => {
|
|
|
88511
87565
|
} catch (error2) {
|
|
88512
87566
|
if (error2 instanceof exports_external.ZodError) {
|
|
88513
87567
|
const details = formatZodError(error2);
|
|
88514
|
-
|
|
87568
|
+
logger58.warn("Update today XP validation failed", { details });
|
|
88515
87569
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88516
87570
|
}
|
|
88517
87571
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88518
87572
|
}
|
|
88519
|
-
|
|
87573
|
+
logger58.debug("Updating today XP", { userId: ctx.user.id, xp: body2.xp });
|
|
88520
87574
|
return ctx.services.timeback.updateTodayXp(ctx.user.id, body2);
|
|
88521
87575
|
});
|
|
88522
87576
|
getXpHistory = requireAuth(async (ctx) => {
|
|
88523
87577
|
const startDate = ctx.url.searchParams.get("startDate") || undefined;
|
|
88524
87578
|
const endDate = ctx.url.searchParams.get("endDate") || undefined;
|
|
88525
|
-
|
|
87579
|
+
logger58.debug("Getting XP history", { userId: ctx.user.id, startDate, endDate });
|
|
88526
87580
|
return ctx.services.timeback.getXpHistory(ctx.user.id, startDate, endDate);
|
|
88527
87581
|
});
|
|
88528
87582
|
populateStudent = requireAuth(async (ctx) => {
|
|
@@ -88533,18 +87587,18 @@ var init_timeback_controller = __esm(() => {
|
|
|
88533
87587
|
} catch (error2) {
|
|
88534
87588
|
if (error2 instanceof exports_external.ZodError) {
|
|
88535
87589
|
const details = formatZodError(error2);
|
|
88536
|
-
|
|
87590
|
+
logger58.warn("Populate student validation failed", { details });
|
|
88537
87591
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88538
87592
|
}
|
|
88539
87593
|
}
|
|
88540
|
-
|
|
87594
|
+
logger58.debug("Populating student", {
|
|
88541
87595
|
userId: ctx.user.id,
|
|
88542
87596
|
hasProvidedNames: !!providedNames
|
|
88543
87597
|
});
|
|
88544
87598
|
return ctx.services.timeback.populateStudent(ctx.user, providedNames);
|
|
88545
87599
|
});
|
|
88546
87600
|
getUser = requireAuth(async (ctx) => {
|
|
88547
|
-
|
|
87601
|
+
logger58.debug("Getting user", { userId: ctx.user.id, gameId: ctx.gameId });
|
|
88548
87602
|
return ctx.services.timeback.getUserData(ctx.user.id, ctx.gameId);
|
|
88549
87603
|
});
|
|
88550
87604
|
getUserById = requireAuth(async (ctx) => {
|
|
@@ -88552,7 +87606,7 @@ var init_timeback_controller = __esm(() => {
|
|
|
88552
87606
|
if (!timebackId) {
|
|
88553
87607
|
throw ApiError.badRequest("Missing timebackId parameter");
|
|
88554
87608
|
}
|
|
88555
|
-
|
|
87609
|
+
logger58.debug("Getting user by ID", { requesterId: ctx.user.id, timebackId });
|
|
88556
87610
|
return ctx.services.timeback.getUserDataByTimebackId(timebackId);
|
|
88557
87611
|
});
|
|
88558
87612
|
setupIntegration = requireDeveloper(async (ctx) => {
|
|
@@ -88563,12 +87617,12 @@ var init_timeback_controller = __esm(() => {
|
|
|
88563
87617
|
} catch (error2) {
|
|
88564
87618
|
if (error2 instanceof exports_external.ZodError) {
|
|
88565
87619
|
const details = formatZodError(error2);
|
|
88566
|
-
|
|
87620
|
+
logger58.warn("Setup integration validation failed", { details });
|
|
88567
87621
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88568
87622
|
}
|
|
88569
87623
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88570
87624
|
}
|
|
88571
|
-
|
|
87625
|
+
logger58.debug("Setting up integration", {
|
|
88572
87626
|
userId: ctx.user.id,
|
|
88573
87627
|
gameId: body2.gameId
|
|
88574
87628
|
});
|
|
@@ -88580,7 +87634,7 @@ var init_timeback_controller = __esm(() => {
|
|
|
88580
87634
|
throw ApiError.badRequest("Missing gameId");
|
|
88581
87635
|
if (!isValidUUID(gameId))
|
|
88582
87636
|
throw ApiError.unprocessableEntity("Invalid gameId format");
|
|
88583
|
-
|
|
87637
|
+
logger58.debug("Getting integrations", { userId: ctx.user.id, gameId });
|
|
88584
87638
|
return ctx.services.timeback.getIntegrations(gameId, ctx.user);
|
|
88585
87639
|
});
|
|
88586
87640
|
verifyIntegration = requireDeveloper(async (ctx) => {
|
|
@@ -88589,7 +87643,7 @@ var init_timeback_controller = __esm(() => {
|
|
|
88589
87643
|
throw ApiError.badRequest("Missing gameId");
|
|
88590
87644
|
if (!isValidUUID(gameId))
|
|
88591
87645
|
throw ApiError.unprocessableEntity("Invalid gameId format");
|
|
88592
|
-
|
|
87646
|
+
logger58.debug("Verifying integration", { userId: ctx.user.id, gameId });
|
|
88593
87647
|
return ctx.services.timeback.verifyIntegration(gameId, ctx.user);
|
|
88594
87648
|
});
|
|
88595
87649
|
getConfig2 = requireDeveloper(async (ctx) => {
|
|
@@ -88598,7 +87652,7 @@ var init_timeback_controller = __esm(() => {
|
|
|
88598
87652
|
throw ApiError.badRequest("Missing gameId");
|
|
88599
87653
|
if (!isValidUUID(gameId))
|
|
88600
87654
|
throw ApiError.unprocessableEntity("Invalid gameId format");
|
|
88601
|
-
|
|
87655
|
+
logger58.debug("Getting config", { userId: ctx.user.id, gameId });
|
|
88602
87656
|
return ctx.services.timeback.getConfig(gameId, ctx.user);
|
|
88603
87657
|
});
|
|
88604
87658
|
deleteIntegrations = requireDeveloper(async (ctx) => {
|
|
@@ -88607,7 +87661,7 @@ var init_timeback_controller = __esm(() => {
|
|
|
88607
87661
|
throw ApiError.badRequest("Missing gameId");
|
|
88608
87662
|
if (!isValidUUID(gameId))
|
|
88609
87663
|
throw ApiError.unprocessableEntity("Invalid gameId format");
|
|
88610
|
-
|
|
87664
|
+
logger58.debug("Deleting integrations", { userId: ctx.user.id, gameId });
|
|
88611
87665
|
await ctx.services.timeback.deleteIntegrations(gameId, ctx.user);
|
|
88612
87666
|
});
|
|
88613
87667
|
endActivity = requireDeveloper(async (ctx) => {
|
|
@@ -88618,13 +87672,13 @@ var init_timeback_controller = __esm(() => {
|
|
|
88618
87672
|
} catch (error2) {
|
|
88619
87673
|
if (error2 instanceof exports_external.ZodError) {
|
|
88620
87674
|
const details = formatZodError(error2);
|
|
88621
|
-
|
|
87675
|
+
logger58.warn("End activity validation failed", { details });
|
|
88622
87676
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88623
87677
|
}
|
|
88624
87678
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88625
87679
|
}
|
|
88626
87680
|
const { gameId, studentId, activityData, scoreData, timingData, xpEarned, masteredUnits } = body2;
|
|
88627
|
-
|
|
87681
|
+
logger58.debug("Ending activity", { userId: ctx.user.id, gameId });
|
|
88628
87682
|
return ctx.services.timeback.endActivity(gameId, studentId, activityData, scoreData, timingData, xpEarned, masteredUnits, ctx.user);
|
|
88629
87683
|
});
|
|
88630
87684
|
timeback2 = {
|
|
@@ -88645,14 +87699,14 @@ var init_timeback_controller = __esm(() => {
|
|
|
88645
87699
|
});
|
|
88646
87700
|
|
|
88647
87701
|
// ../api-core/src/controllers/upload.controller.ts
|
|
88648
|
-
var
|
|
87702
|
+
var logger59, initiate;
|
|
88649
87703
|
var init_upload_controller = __esm(() => {
|
|
88650
87704
|
init_esm();
|
|
88651
87705
|
init_schemas_index();
|
|
88652
87706
|
init_src2();
|
|
88653
87707
|
init_errors();
|
|
88654
87708
|
init_utils11();
|
|
88655
|
-
|
|
87709
|
+
logger59 = log.scope("UploadController");
|
|
88656
87710
|
initiate = requireDeveloper(async (ctx) => {
|
|
88657
87711
|
let body2;
|
|
88658
87712
|
try {
|
|
@@ -88661,24 +87715,24 @@ var init_upload_controller = __esm(() => {
|
|
|
88661
87715
|
} catch (error2) {
|
|
88662
87716
|
if (error2 instanceof exports_external.ZodError) {
|
|
88663
87717
|
const details = formatZodError(error2);
|
|
88664
|
-
|
|
87718
|
+
logger59.warn("Initiate upload validation failed", { details });
|
|
88665
87719
|
throw ApiError.unprocessableEntity("Validation failed", details);
|
|
88666
87720
|
}
|
|
88667
87721
|
throw ApiError.badRequest("Invalid JSON body");
|
|
88668
87722
|
}
|
|
88669
|
-
|
|
87723
|
+
logger59.debug("Initiating upload", { userId: ctx.user.id, gameId: body2.gameId });
|
|
88670
87724
|
return ctx.services.upload.initiate(body2, ctx.user);
|
|
88671
87725
|
});
|
|
88672
87726
|
});
|
|
88673
87727
|
|
|
88674
87728
|
// ../api-core/src/controllers/user.controller.ts
|
|
88675
|
-
var
|
|
87729
|
+
var logger60, getMe, users2;
|
|
88676
87730
|
var init_user_controller = __esm(() => {
|
|
88677
87731
|
init_src2();
|
|
88678
87732
|
init_utils11();
|
|
88679
|
-
|
|
87733
|
+
logger60 = log.scope("UserController");
|
|
88680
87734
|
getMe = requireAuth(async (ctx) => {
|
|
88681
|
-
|
|
87735
|
+
logger60.debug("Getting current user", { userId: ctx.user.id, gameId: ctx.gameId });
|
|
88682
87736
|
return ctx.services.user.getMe(ctx.user, ctx.gameId);
|
|
88683
87737
|
});
|
|
88684
87738
|
users2 = {
|
|
@@ -88687,13 +87741,13 @@ var init_user_controller = __esm(() => {
|
|
|
88687
87741
|
});
|
|
88688
87742
|
|
|
88689
87743
|
// ../api-core/src/controllers/verify.controller.ts
|
|
88690
|
-
var
|
|
87744
|
+
var logger61;
|
|
88691
87745
|
var init_verify_controller = __esm(() => {
|
|
88692
87746
|
init_schemas_index();
|
|
88693
87747
|
init_src2();
|
|
88694
87748
|
init_errors();
|
|
88695
87749
|
init_utils11();
|
|
88696
|
-
|
|
87750
|
+
logger61 = log.scope("VerifyController");
|
|
88697
87751
|
});
|
|
88698
87752
|
|
|
88699
87753
|
// ../api-core/src/controllers/index.ts
|
|
@@ -88712,6 +87766,7 @@ var init_controllers = __esm(() => {
|
|
|
88712
87766
|
init_item_controller();
|
|
88713
87767
|
init_leaderboard_controller();
|
|
88714
87768
|
init_level_controller();
|
|
87769
|
+
init_logs_controller();
|
|
88715
87770
|
init_lti_controller();
|
|
88716
87771
|
init_map_controller();
|
|
88717
87772
|
init_notification_controller();
|
|
@@ -89228,6 +88283,16 @@ var init_items = __esm(() => {
|
|
|
89228
88283
|
gameItemsRouter.delete("/:gameId/items/:itemId", handle2(items2.deleteForGame, { status: 204 }));
|
|
89229
88284
|
});
|
|
89230
88285
|
|
|
88286
|
+
// src/routes/platform/games/logs.ts
|
|
88287
|
+
var gameLogsRouter;
|
|
88288
|
+
var init_logs = __esm(() => {
|
|
88289
|
+
init_dist3();
|
|
88290
|
+
init_controllers();
|
|
88291
|
+
init_api();
|
|
88292
|
+
gameLogsRouter = new Hono2;
|
|
88293
|
+
gameLogsRouter.post("/:slug/logs/token", handle2(logs.generateToken));
|
|
88294
|
+
});
|
|
88295
|
+
|
|
89231
88296
|
// src/routes/platform/games/scores.ts
|
|
89232
88297
|
var gameScoresRouter;
|
|
89233
88298
|
var init_scores = __esm(() => {
|
|
@@ -89247,7 +88312,6 @@ var init_secrets = __esm(() => {
|
|
|
89247
88312
|
init_api();
|
|
89248
88313
|
gameSecretsRouter = new Hono2;
|
|
89249
88314
|
gameSecretsRouter.get("/:slug/secrets", handle2(secrets.listKeys));
|
|
89250
|
-
gameSecretsRouter.get("/:slug/secrets/values", handle2(secrets.getValues));
|
|
89251
88315
|
gameSecretsRouter.post("/:slug/secrets", handle2(secrets.setSecrets));
|
|
89252
88316
|
gameSecretsRouter.delete("/:slug/secrets/:key", handle2(secrets.deleteSecret));
|
|
89253
88317
|
});
|
|
@@ -89543,6 +88607,7 @@ var init_games2 = __esm(() => {
|
|
|
89543
88607
|
init_deploy();
|
|
89544
88608
|
init_domains3();
|
|
89545
88609
|
init_items();
|
|
88610
|
+
init_logs();
|
|
89546
88611
|
init_scores();
|
|
89547
88612
|
init_secrets();
|
|
89548
88613
|
init_seed2();
|
|
@@ -89558,6 +88623,7 @@ var init_games2 = __esm(() => {
|
|
|
89558
88623
|
gamesRouter.route("/", gameDeployRouter);
|
|
89559
88624
|
gamesRouter.route("/", gameDomainsRouter);
|
|
89560
88625
|
gamesRouter.route("/", gameItemsRouter);
|
|
88626
|
+
gamesRouter.route("/", gameLogsRouter);
|
|
89561
88627
|
gamesRouter.route("/", gameShopRouter);
|
|
89562
88628
|
gamesRouter.route("/", gameScoresRouter);
|
|
89563
88629
|
gamesRouter.route("/", gameSecretsRouter);
|
|
@@ -89782,51 +88848,85 @@ var init_timeback6 = __esm(() => {
|
|
|
89782
88848
|
});
|
|
89783
88849
|
|
|
89784
88850
|
// src/routes/integrations/lti.ts
|
|
89785
|
-
|
|
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;
|
|
89786
88863
|
var init_lti = __esm(() => {
|
|
89787
88864
|
init_drizzle_orm();
|
|
89788
88865
|
init_dist3();
|
|
89789
88866
|
init_controllers();
|
|
89790
|
-
|
|
88867
|
+
init_utils11();
|
|
89791
88868
|
init_tables_index();
|
|
88869
|
+
init_src2();
|
|
89792
88870
|
init_constants();
|
|
89793
88871
|
init_api();
|
|
89794
|
-
|
|
88872
|
+
logger62 = log.scope("SandboxLti");
|
|
89795
88873
|
ltiRouter = new Hono2;
|
|
89796
|
-
ltiRouter.
|
|
89797
|
-
|
|
89798
|
-
return c2.json({
|
|
89799
|
-
error: "method_not_allowed",
|
|
89800
|
-
message: "LTI launches must use POST method"
|
|
89801
|
-
}, 405);
|
|
89802
|
-
}
|
|
89803
|
-
const sandboxCtx = getSandboxContext();
|
|
89804
|
-
const ctx = {
|
|
89805
|
-
db: sandboxCtx.db,
|
|
89806
|
-
config: sandboxCtx.config,
|
|
89807
|
-
providers: sandboxCtx.providers,
|
|
89808
|
-
services: sandboxCtx.services,
|
|
89809
|
-
user: undefined,
|
|
89810
|
-
params: {},
|
|
89811
|
-
url: new URL(c2.req.url),
|
|
89812
|
-
request: c2.req.raw
|
|
89813
|
-
};
|
|
88874
|
+
ltiRouter.post("/launch", async (c2) => {
|
|
88875
|
+
const db2 = c2.get("db");
|
|
89814
88876
|
try {
|
|
89815
|
-
const
|
|
89816
|
-
|
|
89817
|
-
|
|
89818
|
-
} catch (error2) {
|
|
89819
|
-
if (error2 instanceof ApiError) {
|
|
88877
|
+
const formData = await c2.req.formData();
|
|
88878
|
+
const idToken = formData.get("id_token");
|
|
88879
|
+
if (!idToken || typeof idToken !== "string") {
|
|
89820
88880
|
return c2.json({
|
|
89821
|
-
error: "
|
|
89822
|
-
message:
|
|
89823
|
-
|
|
89824
|
-
details: error2.details
|
|
89825
|
-
}, error2.status);
|
|
88881
|
+
error: "missing_token",
|
|
88882
|
+
message: "Missing or invalid id_token in request"
|
|
88883
|
+
}, 400);
|
|
89826
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 });
|
|
89827
88927
|
return c2.json({
|
|
89828
88928
|
error: "unexpected_error",
|
|
89829
|
-
message: "An unexpected error occurred during LTI launch
|
|
88929
|
+
message: "An unexpected error occurred during LTI launch"
|
|
89830
88930
|
}, 500);
|
|
89831
88931
|
}
|
|
89832
88932
|
});
|
|
@@ -89956,7 +89056,6 @@ async function startServer(port, project, options = {}) {
|
|
|
89956
89056
|
resetSandboxContext();
|
|
89957
89057
|
resetHandlers();
|
|
89958
89058
|
clearSandboxCache();
|
|
89959
|
-
clearSandboxSecrets();
|
|
89960
89059
|
clearSandboxStorage();
|
|
89961
89060
|
const db2 = await setupServerDatabase(processedOptions, project);
|
|
89962
89061
|
createSandboxContext({ db: db2, port });
|
|
@@ -89983,7 +89082,6 @@ async function startServer(port, project, options = {}) {
|
|
|
89983
89082
|
resetSandboxContext();
|
|
89984
89083
|
resetHandlers();
|
|
89985
89084
|
clearSandboxCache();
|
|
89986
|
-
clearSandboxSecrets();
|
|
89987
89085
|
clearSandboxStorage();
|
|
89988
89086
|
}
|
|
89989
89087
|
};
|