@valbuild/next 0.40.0 → 0.42.0

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.
@@ -16,7 +16,7 @@ var ValNextProvider = function ValNextProvider(props) {
16
16
  startTransition = _useTransition2[1];
17
17
  return /*#__PURE__*/jsxRuntime.jsx(internal.ValProvider, {
18
18
  onSubmit: function onSubmit(refreshRequired) {
19
- if (refreshRequired) {
19
+ if (refreshRequired && !props.disableRefresh) {
20
20
  startTransition(function () {
21
21
  router.refresh();
22
22
  });
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValNextProvider-7750e412.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValNextProvider-7750e412.cjs.dev.js");
7
+ }
@@ -16,7 +16,7 @@ var ValNextProvider = function ValNextProvider(props) {
16
16
  startTransition = _useTransition2[1];
17
17
  return /*#__PURE__*/jsxRuntime.jsx(internal.ValProvider, {
18
18
  onSubmit: function onSubmit(refreshRequired) {
19
- if (refreshRequired) {
19
+ if (refreshRequired && !props.disableRefresh) {
20
20
  startTransition(function () {
21
21
  router.refresh();
22
22
  });
@@ -12,7 +12,7 @@ var ValNextProvider = function ValNextProvider(props) {
12
12
  startTransition = _useTransition2[1];
13
13
  return /*#__PURE__*/jsx(ValProvider, {
14
14
  onSubmit: function onSubmit(refreshRequired) {
15
- if (refreshRequired) {
15
+ if (refreshRequired && !props.disableRefresh) {
16
16
  startTransition(function () {
17
17
  router.refresh();
18
18
  });
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ValProvider: (props: {
3
3
  children: import("react").ReactNode | import("react").ReactNode[];
4
+ config: import("@valbuild/core").ValConfig;
5
+ disableRefresh?: boolean | undefined;
4
6
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,7 @@
1
- import { ValConfig, type InitVal } from "@valbuild/core";
2
- export declare const initVal: (config?: ValConfig) => InitVal;
1
+ import { type ValConfig, type InitVal, type ValConstructor } from "@valbuild/core";
2
+ import { ValEncodedString } from "@valbuild/react/stega";
3
+ export declare const initVal: (config?: ValConfig) => InitVal & {
4
+ val: ValConstructor & {
5
+ raw: (encodedString: ValEncodedString) => string;
6
+ };
7
+ };
@@ -5,7 +5,9 @@ declare const initValNextAppRouter: (config: ValConfig, nextConfig: ValServerNex
5
5
  type ValServerNextConfig = {
6
6
  draftMode: typeof draftMode;
7
7
  };
8
- export declare function initValServer(config: ValConfig, nextConfig: ValServerNextConfig): {
8
+ export declare function initValServer(config: ValConfig & {
9
+ disableCache?: boolean;
10
+ }, nextConfig: ValServerNextConfig): {
9
11
  valNextAppRouter: ReturnType<typeof initValNextAppRouter>;
10
12
  };
11
13
  export {};
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@valbuild/core');
6
6
  var internal = require('@valbuild/react/internal');
7
- var ValNextProvider = require('./ValNextProvider-ae031b12.cjs.dev.js');
7
+ var ValNextProvider = require('./ValNextProvider-49d2bec1.cjs.dev.js');
8
8
  var stega = require('@valbuild/react/stega');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -92,7 +92,11 @@ var initVal = function initVal(config) {
92
92
  });
93
93
  return {
94
94
  s: s,
95
- val: val,
95
+ val: _objectSpread2(_objectSpread2({}, val), {}, {
96
+ raw: function raw(encodedString) {
97
+ return stega.stegaClean(encodedString);
98
+ }
99
+ }),
96
100
  config: currentConfig
97
101
  };
98
102
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@valbuild/core');
6
6
  var internal = require('@valbuild/react/internal');
7
- var ValNextProvider = require('./ValNextProvider-fe84f6a9.cjs.prod.js');
7
+ var ValNextProvider = require('./ValNextProvider-7750e412.cjs.prod.js');
8
8
  var stega = require('@valbuild/react/stega');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -92,7 +92,11 @@ var initVal = function initVal(config) {
92
92
  });
93
93
  return {
94
94
  s: s,
95
- val: val,
95
+ val: _objectSpread2(_objectSpread2({}, val), {}, {
96
+ raw: function raw(encodedString) {
97
+ return stega.stegaClean(encodedString);
98
+ }
99
+ }),
96
100
  config: currentConfig
97
101
  };
98
102
  };
@@ -3,8 +3,8 @@ import * as core from '@valbuild/core';
3
3
  export { core as expr };
4
4
  export { FILE_REF_PROP, GenericSelector, Schema, VAL_EXTENSION, derefPatch } from '@valbuild/core';
5
5
  export { ValRichText } from '@valbuild/react/internal';
6
- import { ValNextProvider } from './ValNextProvider-3676dacc.esm.js';
7
- import { autoTagJSX } from '@valbuild/react/stega';
6
+ import { ValNextProvider } from './ValNextProvider-c5c9fcb0.esm.js';
7
+ import { stegaClean, autoTagJSX } from '@valbuild/react/stega';
8
8
 
9
9
  var ValProvider = ValNextProvider;
10
10
 
@@ -71,7 +71,11 @@ var initVal = function initVal(config) {
71
71
  });
72
72
  return {
73
73
  s: s,
74
- val: val,
74
+ val: _objectSpread2(_objectSpread2({}, val), {}, {
75
+ raw: function raw(encodedString) {
76
+ return stegaClean(encodedString);
77
+ }
78
+ }),
75
79
  config: currentConfig
76
80
  };
77
81
  };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "next",
9
9
  "react"
10
10
  ],
11
- "version": "0.40.0",
11
+ "version": "0.42.0",
12
12
  "scripts": {
13
13
  "typecheck": "tsc --noEmit",
14
14
  "test": "jest"
@@ -45,9 +45,9 @@
45
45
  "exports": true
46
46
  },
47
47
  "dependencies": {
48
- "@valbuild/core": "~0.40.0",
49
- "@valbuild/react": "~0.40.0",
50
- "@valbuild/server": "~0.40.0",
48
+ "@valbuild/core": "~0.42.0",
49
+ "@valbuild/react": "~0.42.0",
50
+ "@valbuild/server": "~0.42.0",
51
51
  "client-only": "^0.0.1",
52
52
  "server-only": "^0.0.1"
53
53
  },
@@ -90,8 +90,12 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, isEn
90
90
  }
91
91
  });
92
92
  } else {
93
- console.error("Val: could not fetch modules", res.error);
94
- throw Error(JSON.stringify(res.error, null, 2));
93
+ if (res.error.statusCode === 401) {
94
+ console.warn("Val: authentication error: ", res.error.message);
95
+ } else {
96
+ console.error("Val: could not fetch modules", res.error);
97
+ throw Error(JSON.stringify(res.error, null, 2));
98
+ }
95
99
  }
96
100
  })["catch"](function (err) {
97
101
  console.error("Val: failed while fetching modules", err);
@@ -90,8 +90,12 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, isEn
90
90
  }
91
91
  });
92
92
  } else {
93
- console.error("Val: could not fetch modules", res.error);
94
- throw Error(JSON.stringify(res.error, null, 2));
93
+ if (res.error.statusCode === 401) {
94
+ console.warn("Val: authentication error: ", res.error.message);
95
+ } else {
96
+ console.error("Val: could not fetch modules", res.error);
97
+ throw Error(JSON.stringify(res.error, null, 2));
98
+ }
95
99
  }
96
100
  })["catch"](function (err) {
97
101
  console.error("Val: failed while fetching modules", err);
@@ -86,8 +86,12 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, isEn
86
86
  }
87
87
  });
88
88
  } else {
89
- console.error("Val: could not fetch modules", res.error);
90
- throw Error(JSON.stringify(res.error, null, 2));
89
+ if (res.error.statusCode === 401) {
90
+ console.warn("Val: authentication error: ", res.error.message);
91
+ } else {
92
+ console.error("Val: could not fetch modules", res.error);
93
+ throw Error(JSON.stringify(res.error, null, 2));
94
+ }
91
95
  }
92
96
  })["catch"](function (err) {
93
97
  console.error("Val: failed while fetching modules", err);
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValNextProvider-fe84f6a9.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValNextProvider-fe84f6a9.cjs.dev.js");
7
- }