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