@playcademy/vite-plugin 0.3.4-beta.4 → 1.0.1-beta.1
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/index.js +47 -8
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -23746,7 +23746,7 @@ import path from "node:path";
|
|
|
23746
23746
|
// package.json
|
|
23747
23747
|
var package_default = {
|
|
23748
23748
|
name: "@playcademy/vite-plugin",
|
|
23749
|
-
version: "0.
|
|
23749
|
+
version: "1.0.1-beta.1",
|
|
23750
23750
|
type: "module",
|
|
23751
23751
|
exports: {
|
|
23752
23752
|
".": {
|
|
@@ -23779,7 +23779,7 @@ var package_default = {
|
|
|
23779
23779
|
"@types/bun": "1.3.5"
|
|
23780
23780
|
},
|
|
23781
23781
|
peerDependencies: {
|
|
23782
|
-
"@playcademy/sdk": ">=0.
|
|
23782
|
+
"@playcademy/sdk": ">=0.12.0",
|
|
23783
23783
|
typescript: "^5",
|
|
23784
23784
|
vite: "^5 || ^6"
|
|
23785
23785
|
}
|
|
@@ -25194,7 +25194,7 @@ var package_default2;
|
|
|
25194
25194
|
var init_package = __esm(() => {
|
|
25195
25195
|
package_default2 = {
|
|
25196
25196
|
name: "@playcademy/sandbox",
|
|
25197
|
-
version: "0.
|
|
25197
|
+
version: "0.5.1-beta.1",
|
|
25198
25198
|
description: "Local development server for Playcademy game development",
|
|
25199
25199
|
type: "module",
|
|
25200
25200
|
exports: {
|
|
@@ -52860,8 +52860,8 @@ class BucketService {
|
|
|
52860
52860
|
const extensionIndex = fileName.lastIndexOf(".");
|
|
52861
52861
|
return extensionIndex > 0 ? fileName.slice(extensionIndex + 1).toLowerCase() : "(none)";
|
|
52862
52862
|
}
|
|
52863
|
-
getBucketName(slug
|
|
52864
|
-
return
|
|
52863
|
+
getBucketName(slug) {
|
|
52864
|
+
return getDeploymentId(slug, this.deps.sstStage);
|
|
52865
52865
|
}
|
|
52866
52866
|
async listFiles(slug, user, prefix) {
|
|
52867
52867
|
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
@@ -52907,6 +52907,19 @@ class BucketService {
|
|
|
52907
52907
|
});
|
|
52908
52908
|
return { key, size: body2.length };
|
|
52909
52909
|
}
|
|
52910
|
+
async initiateUpload(slug, key, contentType, user) {
|
|
52911
|
+
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
52912
|
+
const bucketName = this.getBucketName(game2.slug);
|
|
52913
|
+
const presignedUrl = await this.deps.storage.generatePresignedPutUrl(bucketName, key, contentType, 3600);
|
|
52914
|
+
setAttributes({
|
|
52915
|
+
"app.bucket.operation": "initiate_upload",
|
|
52916
|
+
"app.bucket.key_prefix": BucketService.getKeyPrefix(key),
|
|
52917
|
+
"app.bucket.file_extension": BucketService.getFileExtension(key),
|
|
52918
|
+
"app.bucket.content_type": contentType,
|
|
52919
|
+
"app.bucket.upload_kind": "presigned"
|
|
52920
|
+
});
|
|
52921
|
+
return { presignedUrl, key };
|
|
52922
|
+
}
|
|
52910
52923
|
async deleteFile(slug, key, user) {
|
|
52911
52924
|
const game2 = await this.deps.validateDeveloperAccessBySlug(user, slug);
|
|
52912
52925
|
const bucketName = this.getBucketName(game2.slug);
|
|
@@ -52919,9 +52932,9 @@ class BucketService {
|
|
|
52919
52932
|
}
|
|
52920
52933
|
}
|
|
52921
52934
|
var init_bucket_service = __esm(() => {
|
|
52922
|
-
init_src();
|
|
52923
52935
|
init_spans();
|
|
52924
52936
|
init_errors();
|
|
52937
|
+
init_deployment_util();
|
|
52925
52938
|
});
|
|
52926
52939
|
|
|
52927
52940
|
class DatabaseService {
|
|
@@ -63171,6 +63184,7 @@ function createPlatformServices(deps) {
|
|
|
63171
63184
|
validateGameManagementAccess
|
|
63172
63185
|
} = deps;
|
|
63173
63186
|
const bucket = new BucketService({
|
|
63187
|
+
sstStage: config2.sstStage,
|
|
63174
63188
|
storage: r2Storage,
|
|
63175
63189
|
validateDeveloperAccessBySlug
|
|
63176
63190
|
});
|
|
@@ -122303,7 +122317,7 @@ function requireDeveloper(handler) {
|
|
|
122303
122317
|
throw ApiError.unauthorized("Valid session or bearer token required");
|
|
122304
122318
|
}
|
|
122305
122319
|
const isAdmin = ctx.user.role === "admin";
|
|
122306
|
-
const isApprovedDev = ctx.user.developerStatus === "approved";
|
|
122320
|
+
const isApprovedDev = ctx.user.role === "developer" && ctx.user.developerStatus === "approved";
|
|
122307
122321
|
if (!isAdmin && !isApprovedDev) {
|
|
122308
122322
|
throw ApiError.forbidden("Must be an approved developer");
|
|
122309
122323
|
}
|
|
@@ -122536,6 +122550,7 @@ var listFiles;
|
|
|
122536
122550
|
var getFile;
|
|
122537
122551
|
var putFile;
|
|
122538
122552
|
var deleteFile;
|
|
122553
|
+
var initiateUpload;
|
|
122539
122554
|
var bucket;
|
|
122540
122555
|
var init_bucket_controller = __esm(() => {
|
|
122541
122556
|
init_errors();
|
|
@@ -122586,11 +122601,35 @@ var init_bucket_controller = __esm(() => {
|
|
|
122586
122601
|
await ctx.services.bucket.deleteFile(slug2, key, ctx.user);
|
|
122587
122602
|
return { success: true, key };
|
|
122588
122603
|
});
|
|
122604
|
+
initiateUpload = requireDeveloper(async (ctx) => {
|
|
122605
|
+
const slug2 = ctx.params.slug;
|
|
122606
|
+
if (!slug2) {
|
|
122607
|
+
throw ApiError.badRequest("Missing game slug");
|
|
122608
|
+
}
|
|
122609
|
+
let body2;
|
|
122610
|
+
try {
|
|
122611
|
+
const json4 = await ctx.request.json();
|
|
122612
|
+
if (!json4.key || typeof json4.key !== "string") {
|
|
122613
|
+
throw ApiError.badRequest('Missing or invalid "key"');
|
|
122614
|
+
}
|
|
122615
|
+
if (!json4.contentType || typeof json4.contentType !== "string") {
|
|
122616
|
+
throw ApiError.badRequest('Missing or invalid "contentType"');
|
|
122617
|
+
}
|
|
122618
|
+
body2 = { key: json4.key, contentType: json4.contentType };
|
|
122619
|
+
} catch (error2) {
|
|
122620
|
+
if (error2 instanceof ApiError) {
|
|
122621
|
+
throw error2;
|
|
122622
|
+
}
|
|
122623
|
+
throw ApiError.badRequest("Invalid JSON body");
|
|
122624
|
+
}
|
|
122625
|
+
return ctx.services.bucket.initiateUpload(slug2, body2.key, body2.contentType, ctx.user);
|
|
122626
|
+
});
|
|
122589
122627
|
bucket = defineControllerNames("bucket", {
|
|
122590
122628
|
listFiles,
|
|
122591
122629
|
getFile,
|
|
122592
122630
|
putFile,
|
|
122593
|
-
deleteFile
|
|
122631
|
+
deleteFile,
|
|
122632
|
+
initiateUpload
|
|
122594
122633
|
});
|
|
122595
122634
|
});
|
|
122596
122635
|
var reset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"archiver": "^7.0.1",
|
|
21
21
|
"picocolors": "^1.1.1",
|
|
22
|
-
"playcademy": "0.
|
|
22
|
+
"playcademy": "0.24.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@electric-sql/pglite": "^0.3.16",
|
|
26
26
|
"@inquirer/prompts": "^7.8.6",
|
|
27
27
|
"@playcademy/constants": "0.0.1",
|
|
28
|
-
"@playcademy/sandbox": "0.
|
|
29
|
-
"@playcademy/sdk": "0.
|
|
28
|
+
"@playcademy/sandbox": "0.5.0",
|
|
29
|
+
"@playcademy/sdk": "0.12.0",
|
|
30
30
|
"@playcademy/types": "0.0.1",
|
|
31
31
|
"@playcademy/utils": "0.0.1",
|
|
32
32
|
"@types/archiver": "^6.0.3",
|
|
33
33
|
"@types/bun": "1.3.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@playcademy/sdk": ">=0.
|
|
36
|
+
"@playcademy/sdk": ">=0.12.0",
|
|
37
37
|
"typescript": "^5",
|
|
38
38
|
"vite": "^5 || ^6"
|
|
39
39
|
}
|