@playcademy/sandbox 0.5.0 → 0.5.1-beta.2
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 +45 -3
- package/dist/server.js +45 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1078,7 +1078,7 @@ var package_default;
|
|
|
1078
1078
|
var init_package = __esm(() => {
|
|
1079
1079
|
package_default = {
|
|
1080
1080
|
name: "@playcademy/sandbox",
|
|
1081
|
-
version: "0.5.
|
|
1081
|
+
version: "0.5.1-beta.2",
|
|
1082
1082
|
description: "Local development server for Playcademy game development",
|
|
1083
1083
|
type: "module",
|
|
1084
1084
|
exports: {
|
|
@@ -24508,6 +24508,10 @@ var init_utils5 = __esm(() => {
|
|
|
24508
24508
|
var init_r2 = __esm(() => {
|
|
24509
24509
|
init_utils5();
|
|
24510
24510
|
});
|
|
24511
|
+
|
|
24512
|
+
// ../cloudflare/src/core/namespaces/queues.ts
|
|
24513
|
+
var init_queues = () => {};
|
|
24514
|
+
|
|
24511
24515
|
// ../../node_modules/.bun/dedent@1.7.0+093c0fa00f5dcb32/node_modules/dedent/dist/dedent.mjs
|
|
24512
24516
|
function ownKeys(object, enumerableOnly) {
|
|
24513
24517
|
var keys = Object.keys(object);
|
|
@@ -24638,6 +24642,7 @@ var init_namespaces = __esm(() => {
|
|
|
24638
24642
|
init_d1();
|
|
24639
24643
|
init_kv();
|
|
24640
24644
|
init_r2();
|
|
24645
|
+
init_queues();
|
|
24641
24646
|
init_workers();
|
|
24642
24647
|
});
|
|
24643
24648
|
|
|
@@ -29090,6 +29095,19 @@ class BucketService {
|
|
|
29090
29095
|
});
|
|
29091
29096
|
return { key, size: body2.length };
|
|
29092
29097
|
}
|
|
29098
|
+
async initiateUpload(slug, key, contentType, user) {
|
|
29099
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
29100
|
+
const bucketName = this.getBucketName(game2.slug);
|
|
29101
|
+
const presignedUrl = await this.deps.storage.generatePresignedPutUrl(bucketName, key, contentType, 3600);
|
|
29102
|
+
setAttributes({
|
|
29103
|
+
"app.bucket.operation": "initiate_upload",
|
|
29104
|
+
"app.bucket.key_prefix": BucketService.getKeyPrefix(key),
|
|
29105
|
+
"app.bucket.file_extension": BucketService.getFileExtension(key),
|
|
29106
|
+
"app.bucket.content_type": contentType,
|
|
29107
|
+
"app.bucket.upload_kind": "presigned"
|
|
29108
|
+
});
|
|
29109
|
+
return { presignedUrl, key };
|
|
29110
|
+
}
|
|
29093
29111
|
async deleteFile(slug, key, user) {
|
|
29094
29112
|
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
29095
29113
|
const bucketName = this.getBucketName(game2.slug);
|
|
@@ -95982,7 +96000,7 @@ var init_admin_controller = __esm(() => {
|
|
|
95982
96000
|
});
|
|
95983
96001
|
|
|
95984
96002
|
// ../api-core/src/controllers/bucket.controller.ts
|
|
95985
|
-
var listFiles, getFile, putFile, deleteFile, bucket;
|
|
96003
|
+
var listFiles, getFile, putFile, deleteFile, initiateUpload, bucket;
|
|
95986
96004
|
var init_bucket_controller = __esm(() => {
|
|
95987
96005
|
init_errors();
|
|
95988
96006
|
init_utils11();
|
|
@@ -96032,11 +96050,35 @@ var init_bucket_controller = __esm(() => {
|
|
|
96032
96050
|
await ctx.services.bucket.deleteFile(slug2, key, ctx.user);
|
|
96033
96051
|
return { success: true, key };
|
|
96034
96052
|
});
|
|
96053
|
+
initiateUpload = requireDeveloper(async (ctx) => {
|
|
96054
|
+
const slug2 = ctx.params.slug;
|
|
96055
|
+
if (!slug2) {
|
|
96056
|
+
throw ApiError.badRequest("Missing game slug");
|
|
96057
|
+
}
|
|
96058
|
+
let body2;
|
|
96059
|
+
try {
|
|
96060
|
+
const json4 = await ctx.request.json();
|
|
96061
|
+
if (!json4.key || typeof json4.key !== "string") {
|
|
96062
|
+
throw ApiError.badRequest('Missing or invalid "key"');
|
|
96063
|
+
}
|
|
96064
|
+
if (!json4.contentType || typeof json4.contentType !== "string") {
|
|
96065
|
+
throw ApiError.badRequest('Missing or invalid "contentType"');
|
|
96066
|
+
}
|
|
96067
|
+
body2 = { key: json4.key, contentType: json4.contentType };
|
|
96068
|
+
} catch (error2) {
|
|
96069
|
+
if (error2 instanceof ApiError) {
|
|
96070
|
+
throw error2;
|
|
96071
|
+
}
|
|
96072
|
+
throw ApiError.badRequest("Invalid JSON body");
|
|
96073
|
+
}
|
|
96074
|
+
return ctx.services.bucket.initiateUpload(slug2, body2.key, body2.contentType, ctx.user);
|
|
96075
|
+
});
|
|
96035
96076
|
bucket = defineControllerNames("bucket", {
|
|
96036
96077
|
listFiles,
|
|
96037
96078
|
getFile,
|
|
96038
96079
|
putFile,
|
|
96039
|
-
deleteFile
|
|
96080
|
+
deleteFile,
|
|
96081
|
+
initiateUpload
|
|
96040
96082
|
});
|
|
96041
96083
|
});
|
|
96042
96084
|
|
package/dist/server.js
CHANGED
|
@@ -1077,7 +1077,7 @@ var package_default;
|
|
|
1077
1077
|
var init_package = __esm(() => {
|
|
1078
1078
|
package_default = {
|
|
1079
1079
|
name: "@playcademy/sandbox",
|
|
1080
|
-
version: "0.5.
|
|
1080
|
+
version: "0.5.1-beta.2",
|
|
1081
1081
|
description: "Local development server for Playcademy game development",
|
|
1082
1082
|
type: "module",
|
|
1083
1083
|
exports: {
|
|
@@ -24507,6 +24507,10 @@ var init_utils5 = __esm(() => {
|
|
|
24507
24507
|
var init_r2 = __esm(() => {
|
|
24508
24508
|
init_utils5();
|
|
24509
24509
|
});
|
|
24510
|
+
|
|
24511
|
+
// ../cloudflare/src/core/namespaces/queues.ts
|
|
24512
|
+
var init_queues = () => {};
|
|
24513
|
+
|
|
24510
24514
|
// ../../node_modules/.bun/dedent@1.7.0+093c0fa00f5dcb32/node_modules/dedent/dist/dedent.mjs
|
|
24511
24515
|
function ownKeys(object, enumerableOnly) {
|
|
24512
24516
|
var keys = Object.keys(object);
|
|
@@ -24637,6 +24641,7 @@ var init_namespaces = __esm(() => {
|
|
|
24637
24641
|
init_d1();
|
|
24638
24642
|
init_kv();
|
|
24639
24643
|
init_r2();
|
|
24644
|
+
init_queues();
|
|
24640
24645
|
init_workers();
|
|
24641
24646
|
});
|
|
24642
24647
|
|
|
@@ -29089,6 +29094,19 @@ class BucketService {
|
|
|
29089
29094
|
});
|
|
29090
29095
|
return { key, size: body2.length };
|
|
29091
29096
|
}
|
|
29097
|
+
async initiateUpload(slug, key, contentType, user) {
|
|
29098
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
29099
|
+
const bucketName = this.getBucketName(game2.slug);
|
|
29100
|
+
const presignedUrl = await this.deps.storage.generatePresignedPutUrl(bucketName, key, contentType, 3600);
|
|
29101
|
+
setAttributes({
|
|
29102
|
+
"app.bucket.operation": "initiate_upload",
|
|
29103
|
+
"app.bucket.key_prefix": BucketService.getKeyPrefix(key),
|
|
29104
|
+
"app.bucket.file_extension": BucketService.getFileExtension(key),
|
|
29105
|
+
"app.bucket.content_type": contentType,
|
|
29106
|
+
"app.bucket.upload_kind": "presigned"
|
|
29107
|
+
});
|
|
29108
|
+
return { presignedUrl, key };
|
|
29109
|
+
}
|
|
29092
29110
|
async deleteFile(slug, key, user) {
|
|
29093
29111
|
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
29094
29112
|
const bucketName = this.getBucketName(game2.slug);
|
|
@@ -95981,7 +95999,7 @@ var init_admin_controller = __esm(() => {
|
|
|
95981
95999
|
});
|
|
95982
96000
|
|
|
95983
96001
|
// ../api-core/src/controllers/bucket.controller.ts
|
|
95984
|
-
var listFiles, getFile, putFile, deleteFile, bucket;
|
|
96002
|
+
var listFiles, getFile, putFile, deleteFile, initiateUpload, bucket;
|
|
95985
96003
|
var init_bucket_controller = __esm(() => {
|
|
95986
96004
|
init_errors();
|
|
95987
96005
|
init_utils11();
|
|
@@ -96031,11 +96049,35 @@ var init_bucket_controller = __esm(() => {
|
|
|
96031
96049
|
await ctx.services.bucket.deleteFile(slug2, key, ctx.user);
|
|
96032
96050
|
return { success: true, key };
|
|
96033
96051
|
});
|
|
96052
|
+
initiateUpload = requireDeveloper(async (ctx) => {
|
|
96053
|
+
const slug2 = ctx.params.slug;
|
|
96054
|
+
if (!slug2) {
|
|
96055
|
+
throw ApiError.badRequest("Missing game slug");
|
|
96056
|
+
}
|
|
96057
|
+
let body2;
|
|
96058
|
+
try {
|
|
96059
|
+
const json4 = await ctx.request.json();
|
|
96060
|
+
if (!json4.key || typeof json4.key !== "string") {
|
|
96061
|
+
throw ApiError.badRequest('Missing or invalid "key"');
|
|
96062
|
+
}
|
|
96063
|
+
if (!json4.contentType || typeof json4.contentType !== "string") {
|
|
96064
|
+
throw ApiError.badRequest('Missing or invalid "contentType"');
|
|
96065
|
+
}
|
|
96066
|
+
body2 = { key: json4.key, contentType: json4.contentType };
|
|
96067
|
+
} catch (error2) {
|
|
96068
|
+
if (error2 instanceof ApiError) {
|
|
96069
|
+
throw error2;
|
|
96070
|
+
}
|
|
96071
|
+
throw ApiError.badRequest("Invalid JSON body");
|
|
96072
|
+
}
|
|
96073
|
+
return ctx.services.bucket.initiateUpload(slug2, body2.key, body2.contentType, ctx.user);
|
|
96074
|
+
});
|
|
96034
96075
|
bucket = defineControllerNames("bucket", {
|
|
96035
96076
|
listFiles,
|
|
96036
96077
|
getFile,
|
|
96037
96078
|
putFile,
|
|
96038
|
-
deleteFile
|
|
96079
|
+
deleteFile,
|
|
96080
|
+
initiateUpload
|
|
96039
96081
|
});
|
|
96040
96082
|
});
|
|
96041
96083
|
|