@vived/sandbox 1.4.0 → 1.4.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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +36 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4043,12 +4043,18 @@ class yv extends is {
|
|
|
4043
4043
|
super(t, is.type), this.doUpload = (n) => {
|
|
4044
4044
|
const r = this.vivedAPI, i = this.requestJSON, s = this.basicFetch;
|
|
4045
4045
|
return !r || !i || !s ? Promise.reject() : new Promise((a, o) => {
|
|
4046
|
-
const c = r.getEndpointURL(`upload/large/DataVariants/${n.name}`);
|
|
4046
|
+
const c = r.getEndpointURL(`upload/large/DataVariants/${n.name}?function_version=2`);
|
|
4047
4047
|
i(c).then((u) => {
|
|
4048
|
-
const p = new URL(
|
|
4049
|
-
return s(
|
|
4048
|
+
const { url: p, contentType: h } = u, y = new URL(p);
|
|
4049
|
+
return s(y, {
|
|
4050
4050
|
method: "PUT",
|
|
4051
|
-
body: n
|
|
4051
|
+
body: n,
|
|
4052
|
+
// The SigV2 presigned PUT is signed with this exact Content-Type;
|
|
4053
|
+
// echoing v2's own value guarantees the signature matches and S3
|
|
4054
|
+
// stores the correct type instead of binary/octet-stream.
|
|
4055
|
+
headers: {
|
|
4056
|
+
"Content-Type": h
|
|
4057
|
+
}
|
|
4052
4058
|
});
|
|
4053
4059
|
}).then((u) => {
|
|
4054
4060
|
a();
|
|
@@ -4362,32 +4368,34 @@ class Dv extends aa {
|
|
|
4362
4368
|
super(t, aa.type), this.doPost = (n) => {
|
|
4363
4369
|
const r = this.fileUploader, i = this.getPlayerAuthToken, s = this.vivedAPI, a = this.jsonRequester;
|
|
4364
4370
|
return !r || !i || !s || !a ? Promise.reject() : new Promise((o, c) => {
|
|
4365
|
-
const { description: u, file: p, name: h, ownerID: y } = n;
|
|
4366
|
-
let
|
|
4367
|
-
const
|
|
4371
|
+
const { description: u, file: p, name: h, ownerID: y, ownerType: l } = n;
|
|
4372
|
+
let E;
|
|
4373
|
+
const b = p.name.split("."), S = b[b.length - 1], A = `${ur()}.${S}`, N = new File([p], A, {
|
|
4374
|
+
type: p.type,
|
|
4368
4375
|
lastModified: Date.now()
|
|
4369
4376
|
});
|
|
4370
|
-
r(
|
|
4371
|
-
const
|
|
4377
|
+
r(N).then((_) => i()).then((_) => {
|
|
4378
|
+
const R = s.getEndpointURL("assets"), I = {
|
|
4379
|
+
ownerId: y,
|
|
4380
|
+
name: h,
|
|
4381
|
+
description: u,
|
|
4382
|
+
filename: A,
|
|
4383
|
+
...l !== void 0 && { ownerType: l }
|
|
4384
|
+
}, v = {
|
|
4372
4385
|
method: "POST",
|
|
4373
|
-
body: JSON.stringify(
|
|
4374
|
-
ownerId: y,
|
|
4375
|
-
name: h,
|
|
4376
|
-
description: u,
|
|
4377
|
-
filename: S
|
|
4378
|
-
}),
|
|
4386
|
+
body: JSON.stringify(I),
|
|
4379
4387
|
headers: {
|
|
4380
|
-
Authorization: "Bearer " +
|
|
4388
|
+
Authorization: "Bearer " + _
|
|
4381
4389
|
}
|
|
4382
4390
|
};
|
|
4383
|
-
return a(
|
|
4384
|
-
}).then((
|
|
4385
|
-
|
|
4386
|
-
id:
|
|
4387
|
-
filename:
|
|
4391
|
+
return a(R, v);
|
|
4392
|
+
}).then((_) => {
|
|
4393
|
+
E = _.assetId, o({
|
|
4394
|
+
id: E,
|
|
4395
|
+
filename: A
|
|
4388
4396
|
});
|
|
4389
|
-
}).catch((
|
|
4390
|
-
c(
|
|
4397
|
+
}).catch((_) => {
|
|
4398
|
+
c(_);
|
|
4391
4399
|
});
|
|
4392
4400
|
});
|
|
4393
4401
|
}, this.appObjects.registerSingleton(this);
|
|
@@ -5390,7 +5398,11 @@ class TO extends _o {
|
|
|
5390
5398
|
description: c,
|
|
5391
5399
|
name: p,
|
|
5392
5400
|
file: u,
|
|
5393
|
-
ownerID: s.appID
|
|
5401
|
+
ownerID: s.appID,
|
|
5402
|
+
// App-owned create: the backend authorizes this via the `app` branch
|
|
5403
|
+
// only when the row carries ownerType "app" (it does not infer it).
|
|
5404
|
+
// See vivedlearning/vived-api-legacy#133.
|
|
5405
|
+
ownerType: "app"
|
|
5394
5406
|
}, y = (l = this.spinnerFactory) == null ? void 0 : l.make({
|
|
5395
5407
|
title: "New App Asset",
|
|
5396
5408
|
message: "Posting new app asset..."
|