@openfn/language-common 2.0.2 → 2.1.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.
package/dist/index.cjs CHANGED
@@ -252,6 +252,9 @@ async function readResponseBody(response, parseAs) {
252
252
  }
253
253
  }
254
254
 
255
+ // src/util/helpers.js
256
+ var import_node_crypto = require("crypto");
257
+
255
258
  // src/util/references.js
256
259
  var import_node_stream2 = require("stream");
257
260
  function expandReferences(state, ...args) {
package/dist/util.cjs CHANGED
@@ -28,8 +28,10 @@ __export(util_exports, {
28
28
  ERROR_ABSOLUTE_URL: () => ERROR_ABSOLUTE_URL,
29
29
  ERROR_URL_MISMATCH: () => ERROR_URL_MISMATCH,
30
30
  assertRelativeUrl: () => assertRelativeUrl,
31
+ decode: () => decode,
31
32
  del: () => del,
32
33
  enableMockClient: () => enableMockClient,
34
+ encode: () => encode,
33
35
  expandReferences: () => expandReferences,
34
36
  get: () => get,
35
37
  logResponse: () => logResponse,
@@ -39,7 +41,8 @@ __export(util_exports, {
39
41
  parseUrl: () => parseUrl,
40
42
  post: () => post,
41
43
  put: () => put,
42
- request: () => request
44
+ request: () => request,
45
+ uuid: () => uuid
43
46
  });
44
47
  module.exports = __toCommonJS(util_exports);
45
48
 
@@ -227,6 +230,12 @@ var post = (url, body, options) => request("POST", url, { body, ...options });
227
230
  var put = (url, body, options) => request("PUT", url, { body, ...options });
228
231
  var del = (url, body, options) => request("DELETE", url, { body, ...options });
229
232
 
233
+ // src/util/helpers.js
234
+ var import_node_crypto = require("crypto");
235
+ var encode = (data) => Buffer.from(data, "utf-8").toString("base64");
236
+ var decode = (base64Data) => Buffer.from(base64Data, "base64").toString("utf-8");
237
+ var uuid = () => (0, import_node_crypto.randomUUID)();
238
+
230
239
  // src/util/references.js
231
240
  var import_node_stream2 = require("stream");
232
241
  function expandReferences(state, ...args) {
@@ -307,8 +316,10 @@ var parse_date_default = (d, startDate) => {
307
316
  ERROR_ABSOLUTE_URL,
308
317
  ERROR_URL_MISMATCH,
309
318
  assertRelativeUrl,
319
+ decode,
310
320
  del,
311
321
  enableMockClient,
322
+ encode,
312
323
  expandReferences,
313
324
  get,
314
325
  logResponse,
@@ -318,5 +329,6 @@ var parse_date_default = (d, startDate) => {
318
329
  parseUrl,
319
330
  post,
320
331
  put,
321
- request
332
+ request,
333
+ uuid
322
334
  });
package/dist/util.js CHANGED
@@ -182,6 +182,12 @@ var post = (url, body, options) => request("POST", url, { body, ...options });
182
182
  var put = (url, body, options) => request("PUT", url, { body, ...options });
183
183
  var del = (url, body, options) => request("DELETE", url, { body, ...options });
184
184
 
185
+ // src/util/helpers.js
186
+ import { randomUUID } from "crypto";
187
+ var encode = (data) => Buffer.from(data, "utf-8").toString("base64");
188
+ var decode = (base64Data) => Buffer.from(base64Data, "base64").toString("utf-8");
189
+ var uuid = () => randomUUID();
190
+
185
191
  // src/util/references.js
186
192
  import { Readable as Readable2, Writable } from "stream";
187
193
  function expandReferences(state, ...args) {
@@ -261,8 +267,10 @@ export {
261
267
  ERROR_ABSOLUTE_URL,
262
268
  ERROR_URL_MISMATCH,
263
269
  assertRelativeUrl,
270
+ decode,
264
271
  del,
265
272
  enableMockClient,
273
+ encode,
266
274
  expandReferences,
267
275
  get,
268
276
  logResponse,
@@ -272,5 +280,6 @@ export {
272
280
  parseUrl,
273
281
  post,
274
282
  put,
275
- request
283
+ request,
284
+ uuid
276
285
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-common",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "Common Expressions for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "csvtojson": "^2.0.10",
40
40
  "date-fns": "^2.25.0",
41
41
  "http-status-codes": "^2.3.0",
42
- "jsonpath-plus": "^4.0.0",
42
+ "jsonpath-plus": "^10.0.0",
43
43
  "lodash": "^4.17.21",
44
44
  "undici": "^5.28.4"
45
45
  },
@@ -48,7 +48,6 @@
48
48
  "chai": "4.3.6",
49
49
  "deep-eql": "4.1.1",
50
50
  "esno": "^0.16.3",
51
- "mocha": "9.2.2",
52
51
  "nock": "13.2.9",
53
52
  "rimraf": "^3.0.2"
54
53
  },
@@ -0,0 +1,3 @@
1
+ export function encode(data: string): string;
2
+ export function decode(base64Data: string): string;
3
+ export function uuid(): string;
@@ -1,4 +1,5 @@
1
1
  export * from "./http";
2
+ export * from "./helpers";
2
3
  export * from "./references";
3
4
  export { parseDate };
4
5
  import parseDate from "./parse-date";