eddev 0.3.33 → 0.3.35-alpha-1

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.
@@ -17,6 +17,7 @@ export declare type GravityFormData = {
17
17
  fields: GravityFormsField[];
18
18
  title: string;
19
19
  description?: string;
20
+ revisionId: number;
20
21
  button: {
21
22
  text: string;
22
23
  };
@@ -185,7 +185,7 @@ function useGravityForm(opts) {
185
185
  }
186
186
  exports.useGravityForm = useGravityForm;
187
187
  function prepareValuesPayload(form, state, data) {
188
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
188
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
189
189
  var _loop_1 = function (field) {
190
190
  var value = state.values[field.id];
191
191
  var key = "input_" + field.id;
@@ -198,22 +198,22 @@ function prepareValuesPayload(form, state, data) {
198
198
  data.append("".concat(key, "_1"), value ? "1" : "");
199
199
  data.append("".concat(key, ".1"), value ? "1" : "");
200
200
  data.append("".concat(key, ".2"), (_b = (_a = field === null || field === void 0 ? void 0 : field.consentText) !== null && _a !== void 0 ? _a : field === null || field === void 0 ? void 0 : field.checkboxLabel) !== null && _b !== void 0 ? _b : "");
201
- data.append("".concat(key, ".3"), field.formId);
201
+ data.append("".concat(key, ".3"), String((_c = form.revisionId) !== null && _c !== void 0 ? _c : 1));
202
202
  }
203
203
  else if (field.type === "name") {
204
- data.append("".concat(key, "_2"), (_c = value === null || value === void 0 ? void 0 : value.prefix) !== null && _c !== void 0 ? _c : "");
205
- data.append("".concat(key, "_3"), (_d = value === null || value === void 0 ? void 0 : value.first) !== null && _d !== void 0 ? _d : "");
206
- data.append("".concat(key, "_4"), (_e = value === null || value === void 0 ? void 0 : value.middle) !== null && _e !== void 0 ? _e : "");
207
- data.append("".concat(key, "_6"), (_f = value === null || value === void 0 ? void 0 : value.last) !== null && _f !== void 0 ? _f : "");
208
- data.append("".concat(key, "_8"), (_g = value === null || value === void 0 ? void 0 : value.suffix) !== null && _g !== void 0 ? _g : "");
204
+ data.append("".concat(key, "_2"), (_d = value === null || value === void 0 ? void 0 : value.prefix) !== null && _d !== void 0 ? _d : "");
205
+ data.append("".concat(key, "_3"), (_e = value === null || value === void 0 ? void 0 : value.first) !== null && _e !== void 0 ? _e : "");
206
+ data.append("".concat(key, "_4"), (_f = value === null || value === void 0 ? void 0 : value.middle) !== null && _f !== void 0 ? _f : "");
207
+ data.append("".concat(key, "_6"), (_g = value === null || value === void 0 ? void 0 : value.last) !== null && _g !== void 0 ? _g : "");
208
+ data.append("".concat(key, "_8"), (_h = value === null || value === void 0 ? void 0 : value.suffix) !== null && _h !== void 0 ? _h : "");
209
209
  }
210
210
  else if (field.type === "address") {
211
- data.append("".concat(key, "_1"), (_h = value === null || value === void 0 ? void 0 : value.address1) !== null && _h !== void 0 ? _h : "");
212
- data.append("".concat(key, "_2"), (_j = value === null || value === void 0 ? void 0 : value.address2) !== null && _j !== void 0 ? _j : "");
213
- data.append("".concat(key, "_3"), (_k = value === null || value === void 0 ? void 0 : value.city) !== null && _k !== void 0 ? _k : "");
214
- data.append("".concat(key, "_4"), (_l = value === null || value === void 0 ? void 0 : value.state) !== null && _l !== void 0 ? _l : "");
215
- data.append("".concat(key, "_5"), (_m = value === null || value === void 0 ? void 0 : value.zip) !== null && _m !== void 0 ? _m : "");
216
- data.append("".concat(key, "_6"), (_o = value === null || value === void 0 ? void 0 : value.country) !== null && _o !== void 0 ? _o : "");
211
+ data.append("".concat(key, "_1"), (_j = value === null || value === void 0 ? void 0 : value.address1) !== null && _j !== void 0 ? _j : "");
212
+ data.append("".concat(key, "_2"), (_k = value === null || value === void 0 ? void 0 : value.address2) !== null && _k !== void 0 ? _k : "");
213
+ data.append("".concat(key, "_3"), (_l = value === null || value === void 0 ? void 0 : value.city) !== null && _l !== void 0 ? _l : "");
214
+ data.append("".concat(key, "_4"), (_m = value === null || value === void 0 ? void 0 : value.state) !== null && _m !== void 0 ? _m : "");
215
+ data.append("".concat(key, "_5"), (_o = value === null || value === void 0 ? void 0 : value.zip) !== null && _o !== void 0 ? _o : "");
216
+ data.append("".concat(key, "_6"), (_p = value === null || value === void 0 ? void 0 : value.country) !== null && _p !== void 0 ? _p : "");
217
217
  }
218
218
  else if (field.type === "captcha") {
219
219
  data.append("g-recaptcha-response", value);
@@ -238,8 +238,8 @@ function prepareValuesPayload(form, state, data) {
238
238
  }
239
239
  }
240
240
  };
241
- for (var _i = 0, _p = form.fields; _i < _p.length; _i++) {
242
- var field = _p[_i];
241
+ for (var _i = 0, _q = form.fields; _i < _q.length; _i++) {
242
+ var field = _q[_i];
243
243
  _loop_1(field);
244
244
  }
245
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.3.33",
3
+ "version": "0.3.35-alpha-1",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -10,6 +10,23 @@ module.exports = (() => {
10
10
  const REPO_NAME = getRepoName(cwd.replace(/\/\.serverless/, "")).repoName
11
11
 
12
12
  return withTM(["eddev"])({
13
+ async headers() {
14
+ return [
15
+ {
16
+ source: "/:path*",
17
+ headers: [
18
+ {
19
+ key: "x-frame-options",
20
+ value: "DENY",
21
+ },
22
+ {
23
+ key: "content-security-policy",
24
+ value: "frame-ancestors 'none'",
25
+ },
26
+ ],
27
+ },
28
+ ]
29
+ },
13
30
  rewrites() {
14
31
  return {
15
32
  afterFiles: [
@@ -47,7 +47,7 @@ export default async function (req: NextApiRequest, res: NextApiResponse) {
47
47
  )
48
48
 
49
49
  if (response.cacheFor) {
50
- res.setHeader("Cache-Control", `max-age=${response.cacheFor}, stale-while-revalidate=20`)
50
+ res.setHeader("Cache-Control", `public, s-maxage=${response.cacheFor}`)
51
51
  }
52
52
 
53
53
  res.status(200).json(response.payload)
@@ -1,11 +1,26 @@
1
1
  // @ts-ignore
2
2
  import { router, createContext } from "../../../apis/_rpc"
3
3
  import * as trpcNext from "@trpc/server/adapters/next"
4
+ import { ResponseMetaFn } from "@trpc/server/dist/declarations/src/http/internals/types"
4
5
  import type { NextApiRequest, NextApiResponse } from "next"
5
6
 
6
7
  const handler = trpcNext.createNextApiHandler({
7
- router: router,
8
+ router: router as any,
8
9
  createContext: createContext,
10
+ responseMeta({ ctx, paths, type, errors, data }) {
11
+ // checking that no procedures errored
12
+ const allOk = errors.length === 0
13
+ // checking we're doing a query request
14
+ const isQuery = type === "query"
15
+ if (allOk && isQuery) {
16
+ return {
17
+ headers: {
18
+ "cache-control": `public, s-maxage=${ctx?.cacheTime || 60}`,
19
+ },
20
+ }
21
+ }
22
+ return {}
23
+ },
9
24
  })
10
25
 
11
26
  export default function (req: NextApiRequest, res: NextApiResponse) {