@openfn/language-collections 0.6.0 → 0.6.2
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 +4 -3
- package/dist/index.js +4 -3
- package/package.json +1 -1
- package/types/mock.d.ts +2 -0
package/dist/index.cjs
CHANGED
|
@@ -271,6 +271,7 @@ function createServer(url = "https://app.openfn.org") {
|
|
|
271
271
|
mockPool.intercept({ method: "delete", path: /collections\/./ }).reply(remove2).persist();
|
|
272
272
|
return {
|
|
273
273
|
api,
|
|
274
|
+
agent,
|
|
274
275
|
request: ({ method, path, data, ...rest }) => {
|
|
275
276
|
const opts = {
|
|
276
277
|
method,
|
|
@@ -378,11 +379,11 @@ function set(name, keyGen, values) {
|
|
|
378
379
|
name,
|
|
379
380
|
values
|
|
380
381
|
);
|
|
381
|
-
const dataArray = Array.isArray(resolvedValues) ? resolvedValues : [resolvedValues];
|
|
382
382
|
let kvPairs;
|
|
383
|
-
if (typeof keyGen === "string" && Array.isArray(
|
|
384
|
-
kvPairs = [{ key: keyGen, value: JSON.stringify(
|
|
383
|
+
if (typeof keyGen === "string" && Array.isArray(resolvedValues)) {
|
|
384
|
+
kvPairs = [{ key: keyGen, value: JSON.stringify(resolvedValues) }];
|
|
385
385
|
} else {
|
|
386
|
+
const dataArray = Array.isArray(resolvedValues) ? resolvedValues : [resolvedValues];
|
|
386
387
|
const keyGenFn = typeof keyGen === "string" ? () => keyGen : keyGen;
|
|
387
388
|
kvPairs = dataArray.map((value, index) => ({
|
|
388
389
|
key: keyGenFn(value, index),
|
package/dist/index.js
CHANGED
|
@@ -246,6 +246,7 @@ function createServer(url = "https://app.openfn.org") {
|
|
|
246
246
|
mockPool.intercept({ method: "delete", path: /collections\/./ }).reply(remove2).persist();
|
|
247
247
|
return {
|
|
248
248
|
api,
|
|
249
|
+
agent,
|
|
249
250
|
request: ({ method, path, data, ...rest }) => {
|
|
250
251
|
const opts = {
|
|
251
252
|
method,
|
|
@@ -353,11 +354,11 @@ function set(name, keyGen, values) {
|
|
|
353
354
|
name,
|
|
354
355
|
values
|
|
355
356
|
);
|
|
356
|
-
const dataArray = Array.isArray(resolvedValues) ? resolvedValues : [resolvedValues];
|
|
357
357
|
let kvPairs;
|
|
358
|
-
if (typeof keyGen === "string" && Array.isArray(
|
|
359
|
-
kvPairs = [{ key: keyGen, value: JSON.stringify(
|
|
358
|
+
if (typeof keyGen === "string" && Array.isArray(resolvedValues)) {
|
|
359
|
+
kvPairs = [{ key: keyGen, value: JSON.stringify(resolvedValues) }];
|
|
360
360
|
} else {
|
|
361
|
+
const dataArray = Array.isArray(resolvedValues) ? resolvedValues : [resolvedValues];
|
|
361
362
|
const keyGenFn = typeof keyGen === "string" ? () => keyGen : keyGen;
|
|
362
363
|
kvPairs = dataArray.map((value, index) => ({
|
|
363
364
|
key: keyGenFn(value, index),
|
package/package.json
CHANGED
package/types/mock.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export function API(): {
|
|
|
17
17
|
};
|
|
18
18
|
export function createServer(url?: string): {
|
|
19
19
|
api: any;
|
|
20
|
+
agent: MockAgent<MockAgent.Options>;
|
|
20
21
|
request: ({ method, path, data, ...rest }: {
|
|
21
22
|
[x: string]: any;
|
|
22
23
|
method: any;
|
|
@@ -24,3 +25,4 @@ export function createServer(url?: string): {
|
|
|
24
25
|
data: any;
|
|
25
26
|
}) => Promise<import("undici/types/dispatcher").default.ResponseData>;
|
|
26
27
|
};
|
|
28
|
+
import { MockAgent } from "undici/types";
|