@makeswift/runtime 0.0.0-20221116205621 → 0.0.0-20221122160625

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.js CHANGED
@@ -1002,10 +1002,7 @@ class Document$1 extends NextDocument__default["default"] {
1002
1002
  });
1003
1003
  }
1004
1004
  }
1005
- const version = "0.0.0-20221116205621";
1006
- function isErrorWithMessage(error) {
1007
- return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
1008
- }
1005
+ const version = "0.0.0-20221122160625";
1009
1006
  function MakeswiftApiHandler(apiKey, { appOrigin = "https://app.makeswift.com", getFonts } = {}) {
1010
1007
  const cors = Cors__default["default"]({ origin: appOrigin });
1011
1008
  const previewModeProxy = httpProxy.createProxyServer();
@@ -1020,7 +1017,7 @@ function MakeswiftApiHandler(apiKey, { appOrigin = "https://app.makeswift.com",
1020
1017
  Received "${apiKey}" instead.`);
1021
1018
  }
1022
1019
  return async function makeswiftApiHandler(req, res) {
1023
- var _a, _b;
1020
+ var _a;
1024
1021
  await new Promise((resolve2, reject) => {
1025
1022
  cors(req, res, (err) => {
1026
1023
  if (err instanceof Error)
@@ -1046,28 +1043,8 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
1046
1043
  });
1047
1044
  }
1048
1045
  case "revalidate": {
1049
- if (req.query.secret !== apiKey) {
1050
- return res.status(401).json({ message: "Unauthorized" });
1051
- }
1052
- if (typeof req.query.path !== "string") {
1053
- return res.status(400).json({ message: "Bad Request" });
1054
- }
1055
- const revalidate = (_a = res.revalidate) != null ? _a : res.unstable_revalidate;
1056
- if (typeof revalidate !== "function") {
1057
- const message = `Cannot revalidate path "${req.query.path}" because \`revalidate\` function does not exist in API handler response. Please update to Next.js v12.2.0 or higher for support for on-demand revalidation.
1058
- Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-regeneration-stable`;
1059
- console.warn(message);
1060
- return res.json({ revalidated: false });
1061
- }
1062
- try {
1063
- await revalidate(req.query.path);
1064
- return res.json({ revalidated: true });
1065
- } catch (error) {
1066
- if (isErrorWithMessage(error)) {
1067
- return res.status(500).json({ message: error.message });
1068
- }
1069
- return res.status(500).json({ message: "Error Revalidating" });
1070
- }
1046
+ console.log({ revalidate: "was hit" });
1047
+ return;
1071
1048
  }
1072
1049
  case "proxy-preview-mode": {
1073
1050
  if (req.query.secret !== apiKey)
@@ -1099,7 +1076,7 @@ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-r
1099
1076
  }));
1100
1077
  }
1101
1078
  case "fonts": {
1102
- const fonts = (_b = await (getFonts == null ? void 0 : getFonts())) != null ? _b : [];
1079
+ const fonts = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1103
1080
  return res.json(fonts);
1104
1081
  }
1105
1082
  default: