@valbuild/server 0.62.1 → 0.62.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.
@@ -3664,6 +3664,14 @@ class ValServer {
3664
3664
  }
3665
3665
  };
3666
3666
  }
3667
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3668
+ return {
3669
+ status: 401,
3670
+ json: {
3671
+ message: "Unauthorized"
3672
+ }
3673
+ };
3674
+ }
3667
3675
  const authors = query.authors;
3668
3676
  const patches = await this.serverOps.findPatches({
3669
3677
  authors
@@ -3707,7 +3715,7 @@ class ValServer {
3707
3715
  }
3708
3716
  };
3709
3717
  }
3710
- if (this.options.mode === "http" && !("id" in auth)) {
3718
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3711
3719
  return {
3712
3720
  status: 401,
3713
3721
  json: {
@@ -3744,6 +3752,14 @@ class ValServer {
3744
3752
  }
3745
3753
  };
3746
3754
  }
3755
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3756
+ return {
3757
+ status: 401,
3758
+ json: {
3759
+ message: "Unauthorized"
3760
+ }
3761
+ };
3762
+ }
3747
3763
  const moduleErrors = await this.serverOps.getModuleErrors();
3748
3764
  if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
3749
3765
  console.error("Val: Module errors", moduleErrors);
@@ -3781,6 +3797,14 @@ class ValServer {
3781
3797
  }
3782
3798
  };
3783
3799
  }
3800
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3801
+ return {
3802
+ status: 401,
3803
+ json: {
3804
+ message: "Unauthorized"
3805
+ }
3806
+ };
3807
+ }
3784
3808
  // TODO: move
3785
3809
  const PutTreeBody = z.z.object({
3786
3810
  patchIds: z.z.array(z.z.string().refine(id => true // TODO:
@@ -3834,7 +3858,7 @@ class ValServer {
3834
3858
  if ((_bodyRes$data5 = bodyRes.data) !== null && _bodyRes$data5 !== void 0 && _bodyRes$data5.addPatch) {
3835
3859
  const newPatchModuleFilePath = bodyRes.data.addPatch.path;
3836
3860
  const newPatchOps = bodyRes.data.addPatch.patch;
3837
- const authorId = null; // TODO:
3861
+ const authorId = "id" in auth ? auth.id : null;
3838
3862
  const createPatchRes = await this.serverOps.createPatch(newPatchModuleFilePath, newPatchOps, authorId);
3839
3863
  if (createPatchRes.error) {
3840
3864
  return {
@@ -3664,6 +3664,14 @@ class ValServer {
3664
3664
  }
3665
3665
  };
3666
3666
  }
3667
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3668
+ return {
3669
+ status: 401,
3670
+ json: {
3671
+ message: "Unauthorized"
3672
+ }
3673
+ };
3674
+ }
3667
3675
  const authors = query.authors;
3668
3676
  const patches = await this.serverOps.findPatches({
3669
3677
  authors
@@ -3707,7 +3715,7 @@ class ValServer {
3707
3715
  }
3708
3716
  };
3709
3717
  }
3710
- if (this.options.mode === "http" && !("id" in auth)) {
3718
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3711
3719
  return {
3712
3720
  status: 401,
3713
3721
  json: {
@@ -3744,6 +3752,14 @@ class ValServer {
3744
3752
  }
3745
3753
  };
3746
3754
  }
3755
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3756
+ return {
3757
+ status: 401,
3758
+ json: {
3759
+ message: "Unauthorized"
3760
+ }
3761
+ };
3762
+ }
3747
3763
  const moduleErrors = await this.serverOps.getModuleErrors();
3748
3764
  if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
3749
3765
  console.error("Val: Module errors", moduleErrors);
@@ -3781,6 +3797,14 @@ class ValServer {
3781
3797
  }
3782
3798
  };
3783
3799
  }
3800
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3801
+ return {
3802
+ status: 401,
3803
+ json: {
3804
+ message: "Unauthorized"
3805
+ }
3806
+ };
3807
+ }
3784
3808
  // TODO: move
3785
3809
  const PutTreeBody = z.z.object({
3786
3810
  patchIds: z.z.array(z.z.string().refine(id => true // TODO:
@@ -3834,7 +3858,7 @@ class ValServer {
3834
3858
  if ((_bodyRes$data5 = bodyRes.data) !== null && _bodyRes$data5 !== void 0 && _bodyRes$data5.addPatch) {
3835
3859
  const newPatchModuleFilePath = bodyRes.data.addPatch.path;
3836
3860
  const newPatchOps = bodyRes.data.addPatch.patch;
3837
- const authorId = null; // TODO:
3861
+ const authorId = "id" in auth ? auth.id : null;
3838
3862
  const createPatchRes = await this.serverOps.createPatch(newPatchModuleFilePath, newPatchOps, authorId);
3839
3863
  if (createPatchRes.error) {
3840
3864
  return {
@@ -3634,6 +3634,14 @@ class ValServer {
3634
3634
  }
3635
3635
  };
3636
3636
  }
3637
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3638
+ return {
3639
+ status: 401,
3640
+ json: {
3641
+ message: "Unauthorized"
3642
+ }
3643
+ };
3644
+ }
3637
3645
  const authors = query.authors;
3638
3646
  const patches = await this.serverOps.findPatches({
3639
3647
  authors
@@ -3677,7 +3685,7 @@ class ValServer {
3677
3685
  }
3678
3686
  };
3679
3687
  }
3680
- if (this.options.mode === "http" && !("id" in auth)) {
3688
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3681
3689
  return {
3682
3690
  status: 401,
3683
3691
  json: {
@@ -3714,6 +3722,14 @@ class ValServer {
3714
3722
  }
3715
3723
  };
3716
3724
  }
3725
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3726
+ return {
3727
+ status: 401,
3728
+ json: {
3729
+ message: "Unauthorized"
3730
+ }
3731
+ };
3732
+ }
3717
3733
  const moduleErrors = await this.serverOps.getModuleErrors();
3718
3734
  if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
3719
3735
  console.error("Val: Module errors", moduleErrors);
@@ -3751,6 +3767,14 @@ class ValServer {
3751
3767
  }
3752
3768
  };
3753
3769
  }
3770
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3771
+ return {
3772
+ status: 401,
3773
+ json: {
3774
+ message: "Unauthorized"
3775
+ }
3776
+ };
3777
+ }
3754
3778
  // TODO: move
3755
3779
  const PutTreeBody = z.object({
3756
3780
  patchIds: z.array(z.string().refine(id => true // TODO:
@@ -3804,7 +3828,7 @@ class ValServer {
3804
3828
  if ((_bodyRes$data5 = bodyRes.data) !== null && _bodyRes$data5 !== void 0 && _bodyRes$data5.addPatch) {
3805
3829
  const newPatchModuleFilePath = bodyRes.data.addPatch.path;
3806
3830
  const newPatchOps = bodyRes.data.addPatch.patch;
3807
- const authorId = null; // TODO:
3831
+ const authorId = "id" in auth ? auth.id : null;
3808
3832
  const createPatchRes = await this.serverOps.createPatch(newPatchModuleFilePath, newPatchOps, authorId);
3809
3833
  if (createPatchRes.error) {
3810
3834
  return {
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.62.1",
15
+ "version": "0.62.2",
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "jest",
@@ -22,9 +22,9 @@
22
22
  "@types/jest": "^29.2.5"
23
23
  },
24
24
  "dependencies": {
25
- "@valbuild/core": "~0.62.1",
26
- "@valbuild/shared": "~0.62.1",
27
- "@valbuild/ui": "~0.62.1",
25
+ "@valbuild/core": "~0.62.2",
26
+ "@valbuild/shared": "~0.62.2",
27
+ "@valbuild/ui": "~0.62.2",
28
28
  "image-size": "^1.0.2",
29
29
  "minimatch": "^3.0.4",
30
30
  "quickjs-emscripten": "^0.21.1",