@friggframework/core 2.0.0--canary.690.d043f23.0 → 2.0.0--canary.690.30e6451.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.
@@ -305,7 +305,8 @@ const SCHEMAS = {
305
305
  { type: 'array', items: { type: 'string' } },
306
306
  ],
307
307
  },
308
- description: 'Array values are sent comma-separated',
308
+ description:
309
+ 'Array values are sent comma-separated (`ids: ["1","2"]` → `ids=1,2`), except under a key ending in `[]`, which is sent once per value (`"fields[]": ["a","b"]` → `fields%5B%5D=a&fields%5B%5D=b`; an empty array sends nothing).',
309
310
  },
310
311
  headers: {
311
312
  type: 'object',
@@ -53,6 +53,13 @@ const REMOVED_RESPONSE_HEADERS = [
53
53
  const invalid = (message, details) =>
54
54
  new ProxyRequestError('INVALID_PROXY_REQUEST', message, details);
55
55
 
56
+ /**
57
+ * A query key ending in `[]` is sent as one `key=value` pair per array
58
+ * element; the requester applies the same rule (see
59
+ * `_rawRequest` in requester.js).
60
+ */
61
+ const isRepeatedQueryKey = (key) => key.endsWith('[]');
62
+
56
63
  const isPlainObject = (value) =>
57
64
  value !== null && typeof value === 'object' && !Array.isArray(value);
58
65
 
@@ -99,8 +106,13 @@ function validateProxyRequest(request, { maxRequestBytes }) {
99
106
  field: `query.${key}`,
100
107
  });
101
108
  }
102
- // The requester sends one value per key; arrays go comma-separated.
103
- query[key] = list ? value.join(',') : value;
109
+ // A key ending in `[]` (`fields[]`) is sent once per value, as
110
+ // Airtable and Fathom expect; every other array goes comma-separated.
111
+ if (list) {
112
+ query[key] = isRepeatedQueryKey(key) ? [...value] : value.join(',');
113
+ } else {
114
+ query[key] = value;
115
+ }
104
116
  }
105
117
  }
106
118
 
@@ -219,9 +219,14 @@ class Requester extends Delegate {
219
219
  if (options.query) {
220
220
  let queryBuild = '?';
221
221
  for (const key in options.query) {
222
- queryBuild += `${encodeURIComponent(key)}=${encodeURIComponent(
223
- options.query[key]
224
- )}&`;
222
+ const value = options.query[key];
223
+ // `fields[]: ['a', 'b']` -> `fields%5B%5D=a&fields%5B%5D=b`.
224
+ // Any other array keeps String(value), i.e. comma-joined.
225
+ const values =
226
+ Array.isArray(value) && key.endsWith('[]') ? value : [value];
227
+ for (const v of values) {
228
+ queryBuild += `${encodeURIComponent(key)}=${encodeURIComponent(v)}&`;
229
+ }
225
230
  }
226
231
  encodedUrl += queryBuild.slice(0, -1);
227
232
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.690.d043f23.0",
4
+ "version": "2.0.0--canary.690.30e6451.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -48,9 +48,9 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@friggframework/eslint-config": "2.0.0--canary.690.d043f23.0",
52
- "@friggframework/prettier-config": "2.0.0--canary.690.d043f23.0",
53
- "@friggframework/test": "2.0.0--canary.690.d043f23.0",
51
+ "@friggframework/eslint-config": "2.0.0--canary.690.30e6451.0",
52
+ "@friggframework/prettier-config": "2.0.0--canary.690.30e6451.0",
53
+ "@friggframework/test": "2.0.0--canary.690.30e6451.0",
54
54
  "@prisma/client": "^6.19.3",
55
55
  "@types/lodash": "4.17.15",
56
56
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "access": "public"
92
92
  },
93
- "gitHead": "d043f234d5a629b6280d399daf0bae6465498ed3"
93
+ "gitHead": "30e6451722f62b8b0f0bb1764d5d1cb0a5f47151"
94
94
  }