@valbuild/server 0.68.0 → 0.68.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.
@@ -3073,6 +3073,12 @@ class ValOpsFS extends ValOps {
|
|
3073
3073
|
return fp.result.ok(Object.fromEntries(Object.entries(patches.patches).map(([patchId, value]) => [patchId, this.getParentPatchIdFromParentRef(value.parentRef)])));
|
3074
3074
|
}
|
3075
3075
|
|
3076
|
+
// #region profiles
|
3077
|
+
async getProfiles() {
|
3078
|
+
// We do not have profiles in FS mode
|
3079
|
+
return [];
|
3080
|
+
}
|
3081
|
+
|
3076
3082
|
// #region fs file path helpers
|
3077
3083
|
getPatchesDir() {
|
3078
3084
|
return fsPath__namespace["default"].join(this.rootDir, ValOpsFS.VAL_DIR, "patches");
|
@@ -3264,6 +3270,15 @@ const CommitResponse = zod.z.object({
|
|
3264
3270
|
commit: CommitSha,
|
3265
3271
|
branch: zod.z.string()
|
3266
3272
|
});
|
3273
|
+
const ProfilesResponse = zod.z.object({
|
3274
|
+
profiles: zod.z.array(zod.z.object({
|
3275
|
+
profileId: zod.z.string(),
|
3276
|
+
fullName: zod.z.string(),
|
3277
|
+
avatar: zod.z.object({
|
3278
|
+
url: zod.z.string()
|
3279
|
+
}).nullable()
|
3280
|
+
}))
|
3281
|
+
});
|
3267
3282
|
class ValOpsHttp extends ValOps {
|
3268
3283
|
constructor(hostUrl, project, commitSha,
|
3269
3284
|
// TODO: CommitSha
|
@@ -3416,8 +3431,8 @@ class ValOpsHttp extends ValOps {
|
|
3416
3431
|
for (let i = 0; i < patchIds.length; i += chunkSize) {
|
3417
3432
|
patchIdChunks.push(patchIds.slice(i, i + chunkSize));
|
3418
3433
|
}
|
3419
|
-
|
3420
|
-
|
3434
|
+
const allPatches = [];
|
3435
|
+
const allErrors = [];
|
3421
3436
|
if (patchIds === undefined || patchIds.length === 0) {
|
3422
3437
|
return this.fetchPatchesInternal({
|
3423
3438
|
patchIds: patchIds,
|
@@ -3435,12 +3450,9 @@ class ValOpsHttp extends ValOps {
|
|
3435
3450
|
if ("error" in res) {
|
3436
3451
|
return res;
|
3437
3452
|
}
|
3438
|
-
allPatches
|
3439
|
-
...allPatches,
|
3440
|
-
...res.patches
|
3441
|
-
};
|
3453
|
+
allPatches.push(...res.patches);
|
3442
3454
|
if (res.errors) {
|
3443
|
-
allErrors
|
3455
|
+
allErrors.push(...res.errors);
|
3444
3456
|
}
|
3445
3457
|
}
|
3446
3458
|
return {
|
@@ -3842,6 +3854,30 @@ class ValOpsHttp extends ValOps {
|
|
3842
3854
|
};
|
3843
3855
|
}
|
3844
3856
|
}
|
3857
|
+
|
3858
|
+
// #region profiles
|
3859
|
+
async getProfiles() {
|
3860
|
+
var _res$headers$get3;
|
3861
|
+
const res = await fetch(`${this.hostUrl}/v1/${this.project}/profiles`, {
|
3862
|
+
headers: {
|
3863
|
+
...this.authHeaders,
|
3864
|
+
"Content-Type": "application/json"
|
3865
|
+
}
|
3866
|
+
});
|
3867
|
+
if (res.ok) {
|
3868
|
+
const parsed = ProfilesResponse.safeParse(await res.json());
|
3869
|
+
if (parsed.error) {
|
3870
|
+
console.error("Could not parse profiles response", parsed.error);
|
3871
|
+
throw Error(`Could not get profiles from remote server: wrong format. You might need to upgrade Val.`);
|
3872
|
+
}
|
3873
|
+
return parsed.data.profiles;
|
3874
|
+
}
|
3875
|
+
if ((_res$headers$get3 = res.headers.get("Content-Type")) !== null && _res$headers$get3 !== void 0 && _res$headers$get3.includes("application/json")) {
|
3876
|
+
const json = await res.json();
|
3877
|
+
throw Error(`Could not get profiles (status: ${res.status}): ${"message" in json ? json.message : "Unknown error"}`);
|
3878
|
+
}
|
3879
|
+
throw Error(`Could not get profiles. Got status: ${res.status}`);
|
3880
|
+
}
|
3845
3881
|
}
|
3846
3882
|
|
3847
3883
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
@@ -4704,6 +4740,28 @@ const ValServer = (valModules, options, callbacks) => {
|
|
4704
4740
|
return res;
|
4705
4741
|
}
|
4706
4742
|
},
|
4743
|
+
"/profiles": {
|
4744
|
+
GET: async req => {
|
4745
|
+
// const cookies = req.cookies;
|
4746
|
+
// const auth = getAuth(cookies);
|
4747
|
+
// if (auth.error) {
|
4748
|
+
// return {
|
4749
|
+
// status: 401,
|
4750
|
+
// json: {
|
4751
|
+
// message: auth.error,
|
4752
|
+
// },
|
4753
|
+
// };
|
4754
|
+
// }
|
4755
|
+
|
4756
|
+
const profiles = await serverOps.getProfiles();
|
4757
|
+
return {
|
4758
|
+
status: 200,
|
4759
|
+
json: {
|
4760
|
+
profiles
|
4761
|
+
}
|
4762
|
+
};
|
4763
|
+
}
|
4764
|
+
},
|
4707
4765
|
"/save": {
|
4708
4766
|
POST: async req => {
|
4709
4767
|
const cookies = req.cookies;
|
@@ -3073,6 +3073,12 @@ class ValOpsFS extends ValOps {
|
|
3073
3073
|
return fp.result.ok(Object.fromEntries(Object.entries(patches.patches).map(([patchId, value]) => [patchId, this.getParentPatchIdFromParentRef(value.parentRef)])));
|
3074
3074
|
}
|
3075
3075
|
|
3076
|
+
// #region profiles
|
3077
|
+
async getProfiles() {
|
3078
|
+
// We do not have profiles in FS mode
|
3079
|
+
return [];
|
3080
|
+
}
|
3081
|
+
|
3076
3082
|
// #region fs file path helpers
|
3077
3083
|
getPatchesDir() {
|
3078
3084
|
return fsPath__namespace["default"].join(this.rootDir, ValOpsFS.VAL_DIR, "patches");
|
@@ -3264,6 +3270,15 @@ const CommitResponse = zod.z.object({
|
|
3264
3270
|
commit: CommitSha,
|
3265
3271
|
branch: zod.z.string()
|
3266
3272
|
});
|
3273
|
+
const ProfilesResponse = zod.z.object({
|
3274
|
+
profiles: zod.z.array(zod.z.object({
|
3275
|
+
profileId: zod.z.string(),
|
3276
|
+
fullName: zod.z.string(),
|
3277
|
+
avatar: zod.z.object({
|
3278
|
+
url: zod.z.string()
|
3279
|
+
}).nullable()
|
3280
|
+
}))
|
3281
|
+
});
|
3267
3282
|
class ValOpsHttp extends ValOps {
|
3268
3283
|
constructor(hostUrl, project, commitSha,
|
3269
3284
|
// TODO: CommitSha
|
@@ -3416,8 +3431,8 @@ class ValOpsHttp extends ValOps {
|
|
3416
3431
|
for (let i = 0; i < patchIds.length; i += chunkSize) {
|
3417
3432
|
patchIdChunks.push(patchIds.slice(i, i + chunkSize));
|
3418
3433
|
}
|
3419
|
-
|
3420
|
-
|
3434
|
+
const allPatches = [];
|
3435
|
+
const allErrors = [];
|
3421
3436
|
if (patchIds === undefined || patchIds.length === 0) {
|
3422
3437
|
return this.fetchPatchesInternal({
|
3423
3438
|
patchIds: patchIds,
|
@@ -3435,12 +3450,9 @@ class ValOpsHttp extends ValOps {
|
|
3435
3450
|
if ("error" in res) {
|
3436
3451
|
return res;
|
3437
3452
|
}
|
3438
|
-
allPatches
|
3439
|
-
...allPatches,
|
3440
|
-
...res.patches
|
3441
|
-
};
|
3453
|
+
allPatches.push(...res.patches);
|
3442
3454
|
if (res.errors) {
|
3443
|
-
allErrors
|
3455
|
+
allErrors.push(...res.errors);
|
3444
3456
|
}
|
3445
3457
|
}
|
3446
3458
|
return {
|
@@ -3842,6 +3854,30 @@ class ValOpsHttp extends ValOps {
|
|
3842
3854
|
};
|
3843
3855
|
}
|
3844
3856
|
}
|
3857
|
+
|
3858
|
+
// #region profiles
|
3859
|
+
async getProfiles() {
|
3860
|
+
var _res$headers$get3;
|
3861
|
+
const res = await fetch(`${this.hostUrl}/v1/${this.project}/profiles`, {
|
3862
|
+
headers: {
|
3863
|
+
...this.authHeaders,
|
3864
|
+
"Content-Type": "application/json"
|
3865
|
+
}
|
3866
|
+
});
|
3867
|
+
if (res.ok) {
|
3868
|
+
const parsed = ProfilesResponse.safeParse(await res.json());
|
3869
|
+
if (parsed.error) {
|
3870
|
+
console.error("Could not parse profiles response", parsed.error);
|
3871
|
+
throw Error(`Could not get profiles from remote server: wrong format. You might need to upgrade Val.`);
|
3872
|
+
}
|
3873
|
+
return parsed.data.profiles;
|
3874
|
+
}
|
3875
|
+
if ((_res$headers$get3 = res.headers.get("Content-Type")) !== null && _res$headers$get3 !== void 0 && _res$headers$get3.includes("application/json")) {
|
3876
|
+
const json = await res.json();
|
3877
|
+
throw Error(`Could not get profiles (status: ${res.status}): ${"message" in json ? json.message : "Unknown error"}`);
|
3878
|
+
}
|
3879
|
+
throw Error(`Could not get profiles. Got status: ${res.status}`);
|
3880
|
+
}
|
3845
3881
|
}
|
3846
3882
|
|
3847
3883
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
@@ -4704,6 +4740,28 @@ const ValServer = (valModules, options, callbacks) => {
|
|
4704
4740
|
return res;
|
4705
4741
|
}
|
4706
4742
|
},
|
4743
|
+
"/profiles": {
|
4744
|
+
GET: async req => {
|
4745
|
+
// const cookies = req.cookies;
|
4746
|
+
// const auth = getAuth(cookies);
|
4747
|
+
// if (auth.error) {
|
4748
|
+
// return {
|
4749
|
+
// status: 401,
|
4750
|
+
// json: {
|
4751
|
+
// message: auth.error,
|
4752
|
+
// },
|
4753
|
+
// };
|
4754
|
+
// }
|
4755
|
+
|
4756
|
+
const profiles = await serverOps.getProfiles();
|
4757
|
+
return {
|
4758
|
+
status: 200,
|
4759
|
+
json: {
|
4760
|
+
profiles
|
4761
|
+
}
|
4762
|
+
};
|
4763
|
+
}
|
4764
|
+
},
|
4707
4765
|
"/save": {
|
4708
4766
|
POST: async req => {
|
4709
4767
|
const cookies = req.cookies;
|
@@ -3044,6 +3044,12 @@ class ValOpsFS extends ValOps {
|
|
3044
3044
|
return result.ok(Object.fromEntries(Object.entries(patches.patches).map(([patchId, value]) => [patchId, this.getParentPatchIdFromParentRef(value.parentRef)])));
|
3045
3045
|
}
|
3046
3046
|
|
3047
|
+
// #region profiles
|
3048
|
+
async getProfiles() {
|
3049
|
+
// We do not have profiles in FS mode
|
3050
|
+
return [];
|
3051
|
+
}
|
3052
|
+
|
3047
3053
|
// #region fs file path helpers
|
3048
3054
|
getPatchesDir() {
|
3049
3055
|
return fsPath__default.join(this.rootDir, ValOpsFS.VAL_DIR, "patches");
|
@@ -3235,6 +3241,15 @@ const CommitResponse = z.object({
|
|
3235
3241
|
commit: CommitSha,
|
3236
3242
|
branch: z.string()
|
3237
3243
|
});
|
3244
|
+
const ProfilesResponse = z.object({
|
3245
|
+
profiles: z.array(z.object({
|
3246
|
+
profileId: z.string(),
|
3247
|
+
fullName: z.string(),
|
3248
|
+
avatar: z.object({
|
3249
|
+
url: z.string()
|
3250
|
+
}).nullable()
|
3251
|
+
}))
|
3252
|
+
});
|
3238
3253
|
class ValOpsHttp extends ValOps {
|
3239
3254
|
constructor(hostUrl, project, commitSha,
|
3240
3255
|
// TODO: CommitSha
|
@@ -3387,8 +3402,8 @@ class ValOpsHttp extends ValOps {
|
|
3387
3402
|
for (let i = 0; i < patchIds.length; i += chunkSize) {
|
3388
3403
|
patchIdChunks.push(patchIds.slice(i, i + chunkSize));
|
3389
3404
|
}
|
3390
|
-
|
3391
|
-
|
3405
|
+
const allPatches = [];
|
3406
|
+
const allErrors = [];
|
3392
3407
|
if (patchIds === undefined || patchIds.length === 0) {
|
3393
3408
|
return this.fetchPatchesInternal({
|
3394
3409
|
patchIds: patchIds,
|
@@ -3406,12 +3421,9 @@ class ValOpsHttp extends ValOps {
|
|
3406
3421
|
if ("error" in res) {
|
3407
3422
|
return res;
|
3408
3423
|
}
|
3409
|
-
allPatches
|
3410
|
-
...allPatches,
|
3411
|
-
...res.patches
|
3412
|
-
};
|
3424
|
+
allPatches.push(...res.patches);
|
3413
3425
|
if (res.errors) {
|
3414
|
-
allErrors
|
3426
|
+
allErrors.push(...res.errors);
|
3415
3427
|
}
|
3416
3428
|
}
|
3417
3429
|
return {
|
@@ -3813,6 +3825,30 @@ class ValOpsHttp extends ValOps {
|
|
3813
3825
|
};
|
3814
3826
|
}
|
3815
3827
|
}
|
3828
|
+
|
3829
|
+
// #region profiles
|
3830
|
+
async getProfiles() {
|
3831
|
+
var _res$headers$get3;
|
3832
|
+
const res = await fetch(`${this.hostUrl}/v1/${this.project}/profiles`, {
|
3833
|
+
headers: {
|
3834
|
+
...this.authHeaders,
|
3835
|
+
"Content-Type": "application/json"
|
3836
|
+
}
|
3837
|
+
});
|
3838
|
+
if (res.ok) {
|
3839
|
+
const parsed = ProfilesResponse.safeParse(await res.json());
|
3840
|
+
if (parsed.error) {
|
3841
|
+
console.error("Could not parse profiles response", parsed.error);
|
3842
|
+
throw Error(`Could not get profiles from remote server: wrong format. You might need to upgrade Val.`);
|
3843
|
+
}
|
3844
|
+
return parsed.data.profiles;
|
3845
|
+
}
|
3846
|
+
if ((_res$headers$get3 = res.headers.get("Content-Type")) !== null && _res$headers$get3 !== void 0 && _res$headers$get3.includes("application/json")) {
|
3847
|
+
const json = await res.json();
|
3848
|
+
throw Error(`Could not get profiles (status: ${res.status}): ${"message" in json ? json.message : "Unknown error"}`);
|
3849
|
+
}
|
3850
|
+
throw Error(`Could not get profiles. Got status: ${res.status}`);
|
3851
|
+
}
|
3816
3852
|
}
|
3817
3853
|
|
3818
3854
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
@@ -4675,6 +4711,28 @@ const ValServer = (valModules, options, callbacks) => {
|
|
4675
4711
|
return res;
|
4676
4712
|
}
|
4677
4713
|
},
|
4714
|
+
"/profiles": {
|
4715
|
+
GET: async req => {
|
4716
|
+
// const cookies = req.cookies;
|
4717
|
+
// const auth = getAuth(cookies);
|
4718
|
+
// if (auth.error) {
|
4719
|
+
// return {
|
4720
|
+
// status: 401,
|
4721
|
+
// json: {
|
4722
|
+
// message: auth.error,
|
4723
|
+
// },
|
4724
|
+
// };
|
4725
|
+
// }
|
4726
|
+
|
4727
|
+
const profiles = await serverOps.getProfiles();
|
4728
|
+
return {
|
4729
|
+
status: 200,
|
4730
|
+
json: {
|
4731
|
+
profiles
|
4732
|
+
}
|
4733
|
+
};
|
4734
|
+
}
|
4735
|
+
},
|
4678
4736
|
"/save": {
|
4679
4737
|
POST: async req => {
|
4680
4738
|
const cookies = req.cookies;
|
package/package.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
"./package.json": "./package.json"
|
13
13
|
},
|
14
14
|
"types": "dist/valbuild-server.cjs.d.ts",
|
15
|
-
"version": "0.68.
|
15
|
+
"version": "0.68.2",
|
16
16
|
"scripts": {
|
17
17
|
"typecheck": "tsc --noEmit",
|
18
18
|
"test": "jest",
|
@@ -24,8 +24,8 @@
|
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
26
|
"@valbuild/core": "~0.68.0",
|
27
|
-
"@valbuild/shared": "~0.68.
|
28
|
-
"@valbuild/ui": "~0.68.
|
27
|
+
"@valbuild/shared": "~0.68.1",
|
28
|
+
"@valbuild/ui": "~0.68.2",
|
29
29
|
"chokidar": "^4.0.1",
|
30
30
|
"image-size": "^1.0.2",
|
31
31
|
"minimatch": "^3.0.4",
|