@valbuild/server 0.62.1 → 0.62.3

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.
@@ -1847,7 +1847,8 @@ class ValOps {
1847
1847
  }
1848
1848
  if (errors.length === 0) {
1849
1849
  var _this$options;
1850
- let sourceFileText = tsSourceFile.getText(tsSourceFile);
1850
+ // https://github.com/microsoft/TypeScript/issues/36174
1851
+ let sourceFileText = unescape(tsSourceFile.getText(tsSourceFile).replace(/\\u/g, "%u"));
1851
1852
  if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.formatter) {
1852
1853
  try {
1853
1854
  sourceFileText = this.options.formatter(sourceFileText, path);
@@ -3664,6 +3665,14 @@ class ValServer {
3664
3665
  }
3665
3666
  };
3666
3667
  }
3668
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3669
+ return {
3670
+ status: 401,
3671
+ json: {
3672
+ message: "Unauthorized"
3673
+ }
3674
+ };
3675
+ }
3667
3676
  const authors = query.authors;
3668
3677
  const patches = await this.serverOps.findPatches({
3669
3678
  authors
@@ -3707,7 +3716,7 @@ class ValServer {
3707
3716
  }
3708
3717
  };
3709
3718
  }
3710
- if (this.options.mode === "http" && !("id" in auth)) {
3719
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3711
3720
  return {
3712
3721
  status: 401,
3713
3722
  json: {
@@ -3744,6 +3753,14 @@ class ValServer {
3744
3753
  }
3745
3754
  };
3746
3755
  }
3756
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3757
+ return {
3758
+ status: 401,
3759
+ json: {
3760
+ message: "Unauthorized"
3761
+ }
3762
+ };
3763
+ }
3747
3764
  const moduleErrors = await this.serverOps.getModuleErrors();
3748
3765
  if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
3749
3766
  console.error("Val: Module errors", moduleErrors);
@@ -3781,6 +3798,14 @@ class ValServer {
3781
3798
  }
3782
3799
  };
3783
3800
  }
3801
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3802
+ return {
3803
+ status: 401,
3804
+ json: {
3805
+ message: "Unauthorized"
3806
+ }
3807
+ };
3808
+ }
3784
3809
  // TODO: move
3785
3810
  const PutTreeBody = z.z.object({
3786
3811
  patchIds: z.z.array(z.z.string().refine(id => true // TODO:
@@ -3834,7 +3859,7 @@ class ValServer {
3834
3859
  if ((_bodyRes$data5 = bodyRes.data) !== null && _bodyRes$data5 !== void 0 && _bodyRes$data5.addPatch) {
3835
3860
  const newPatchModuleFilePath = bodyRes.data.addPatch.path;
3836
3861
  const newPatchOps = bodyRes.data.addPatch.patch;
3837
- const authorId = null; // TODO:
3862
+ const authorId = "id" in auth ? auth.id : null;
3838
3863
  const createPatchRes = await this.serverOps.createPatch(newPatchModuleFilePath, newPatchOps, authorId);
3839
3864
  if (createPatchRes.error) {
3840
3865
  return {
@@ -1847,7 +1847,8 @@ class ValOps {
1847
1847
  }
1848
1848
  if (errors.length === 0) {
1849
1849
  var _this$options;
1850
- let sourceFileText = tsSourceFile.getText(tsSourceFile);
1850
+ // https://github.com/microsoft/TypeScript/issues/36174
1851
+ let sourceFileText = unescape(tsSourceFile.getText(tsSourceFile).replace(/\\u/g, "%u"));
1851
1852
  if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.formatter) {
1852
1853
  try {
1853
1854
  sourceFileText = this.options.formatter(sourceFileText, path);
@@ -3664,6 +3665,14 @@ class ValServer {
3664
3665
  }
3665
3666
  };
3666
3667
  }
3668
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3669
+ return {
3670
+ status: 401,
3671
+ json: {
3672
+ message: "Unauthorized"
3673
+ }
3674
+ };
3675
+ }
3667
3676
  const authors = query.authors;
3668
3677
  const patches = await this.serverOps.findPatches({
3669
3678
  authors
@@ -3707,7 +3716,7 @@ class ValServer {
3707
3716
  }
3708
3717
  };
3709
3718
  }
3710
- if (this.options.mode === "http" && !("id" in auth)) {
3719
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3711
3720
  return {
3712
3721
  status: 401,
3713
3722
  json: {
@@ -3744,6 +3753,14 @@ class ValServer {
3744
3753
  }
3745
3754
  };
3746
3755
  }
3756
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3757
+ return {
3758
+ status: 401,
3759
+ json: {
3760
+ message: "Unauthorized"
3761
+ }
3762
+ };
3763
+ }
3747
3764
  const moduleErrors = await this.serverOps.getModuleErrors();
3748
3765
  if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
3749
3766
  console.error("Val: Module errors", moduleErrors);
@@ -3781,6 +3798,14 @@ class ValServer {
3781
3798
  }
3782
3799
  };
3783
3800
  }
3801
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3802
+ return {
3803
+ status: 401,
3804
+ json: {
3805
+ message: "Unauthorized"
3806
+ }
3807
+ };
3808
+ }
3784
3809
  // TODO: move
3785
3810
  const PutTreeBody = z.z.object({
3786
3811
  patchIds: z.z.array(z.z.string().refine(id => true // TODO:
@@ -3834,7 +3859,7 @@ class ValServer {
3834
3859
  if ((_bodyRes$data5 = bodyRes.data) !== null && _bodyRes$data5 !== void 0 && _bodyRes$data5.addPatch) {
3835
3860
  const newPatchModuleFilePath = bodyRes.data.addPatch.path;
3836
3861
  const newPatchOps = bodyRes.data.addPatch.patch;
3837
- const authorId = null; // TODO:
3862
+ const authorId = "id" in auth ? auth.id : null;
3838
3863
  const createPatchRes = await this.serverOps.createPatch(newPatchModuleFilePath, newPatchOps, authorId);
3839
3864
  if (createPatchRes.error) {
3840
3865
  return {
@@ -1817,7 +1817,8 @@ class ValOps {
1817
1817
  }
1818
1818
  if (errors.length === 0) {
1819
1819
  var _this$options;
1820
- let sourceFileText = tsSourceFile.getText(tsSourceFile);
1820
+ // https://github.com/microsoft/TypeScript/issues/36174
1821
+ let sourceFileText = unescape(tsSourceFile.getText(tsSourceFile).replace(/\\u/g, "%u"));
1821
1822
  if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.formatter) {
1822
1823
  try {
1823
1824
  sourceFileText = this.options.formatter(sourceFileText, path);
@@ -3634,6 +3635,14 @@ class ValServer {
3634
3635
  }
3635
3636
  };
3636
3637
  }
3638
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3639
+ return {
3640
+ status: 401,
3641
+ json: {
3642
+ message: "Unauthorized"
3643
+ }
3644
+ };
3645
+ }
3637
3646
  const authors = query.authors;
3638
3647
  const patches = await this.serverOps.findPatches({
3639
3648
  authors
@@ -3677,7 +3686,7 @@ class ValServer {
3677
3686
  }
3678
3687
  };
3679
3688
  }
3680
- if (this.options.mode === "http" && !("id" in auth)) {
3689
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3681
3690
  return {
3682
3691
  status: 401,
3683
3692
  json: {
@@ -3714,6 +3723,14 @@ class ValServer {
3714
3723
  }
3715
3724
  };
3716
3725
  }
3726
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3727
+ return {
3728
+ status: 401,
3729
+ json: {
3730
+ message: "Unauthorized"
3731
+ }
3732
+ };
3733
+ }
3717
3734
  const moduleErrors = await this.serverOps.getModuleErrors();
3718
3735
  if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
3719
3736
  console.error("Val: Module errors", moduleErrors);
@@ -3751,6 +3768,14 @@ class ValServer {
3751
3768
  }
3752
3769
  };
3753
3770
  }
3771
+ if (this.serverOps instanceof ValOpsHttp && !("id" in auth)) {
3772
+ return {
3773
+ status: 401,
3774
+ json: {
3775
+ message: "Unauthorized"
3776
+ }
3777
+ };
3778
+ }
3754
3779
  // TODO: move
3755
3780
  const PutTreeBody = z.object({
3756
3781
  patchIds: z.array(z.string().refine(id => true // TODO:
@@ -3804,7 +3829,7 @@ class ValServer {
3804
3829
  if ((_bodyRes$data5 = bodyRes.data) !== null && _bodyRes$data5 !== void 0 && _bodyRes$data5.addPatch) {
3805
3830
  const newPatchModuleFilePath = bodyRes.data.addPatch.path;
3806
3831
  const newPatchOps = bodyRes.data.addPatch.patch;
3807
- const authorId = null; // TODO:
3832
+ const authorId = "id" in auth ? auth.id : null;
3808
3833
  const createPatchRes = await this.serverOps.createPatch(newPatchModuleFilePath, newPatchOps, authorId);
3809
3834
  if (createPatchRes.error) {
3810
3835
  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.3",
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.3",
26
+ "@valbuild/shared": "~0.62.3",
27
+ "@valbuild/ui": "~0.62.3",
28
28
  "image-size": "^1.0.2",
29
29
  "minimatch": "^3.0.4",
30
30
  "quickjs-emscripten": "^0.21.1",