@port-labs/jq-node-bindings 1.0.3 → 1.0.5

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/index.d.ts CHANGED
@@ -10,7 +10,8 @@ declare module '@port-labs/jq-node-bindings' {
10
10
 
11
11
  export function exec(json: object, input: string, options?: ExecOptions): object | Array<any> | string | number | boolean | null;
12
12
  export function execAsync(json: object, input: string, options?: ExecAsyncOptions): Promise<object | Array<any> | string | number | boolean | null>;
13
-
13
+ export function setCacheSize(cacheSize: number): void;
14
14
  export function renderRecursively(json: object, input: object | Array<any> | string | number | boolean | null, execOptions?: ExecOptions): object | Array<any> | string | number | boolean | null;
15
15
  export function renderRecursivelyAsync(json: object, input: object | Array<any> | string | number | boolean | null, execOptions?: ExecAsyncOptions): Promise<object | Array<any> | string | number | boolean | null>;
16
+
16
17
  }
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ const templateAsync = require('./templateAsync');
6
6
  module.exports = {
7
7
  exec: jq.exec,
8
8
  execAsync: jq.execAsync,
9
+ setCacheSize: jq.setCacheSize,
9
10
  renderRecursively: template.renderRecursively,
10
11
  renderRecursivelyAsync: templateAsync.renderRecursivelyAsync,
11
12
  JqExecError: jq.JqExecError,
package/lib/jq.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const nativeJq = require('bindings')('jq-node-bindings')
2
2
  nativeJq.setCacheSize(1000)
3
+
3
4
  const formatFilter = (filter, {enableEnv = false} = {}) => {
4
5
  // Escape single quotes only if they are opening or closing a string
5
6
  let formattedFilter = filter.replace(/(^|\s)'(?!\s|")|(?<!\s|")'(\s|$)/g, '$1"$2');
@@ -41,7 +42,7 @@ const execAsync = async (object, filter, {enableEnv = false, throwOnError = fals
41
42
  module.exports = {
42
43
  exec,
43
44
  execAsync,
45
+ setCacheSize: nativeJq.setCacheSize,
44
46
  JqExecError,
45
47
  JqExecCompileError,
46
- setCacheSize:nativeJq.setCacheSize
47
48
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@port-labs/jq-node-bindings",
3
- "version": "v1.0.3",
3
+ "version": "v1.0.5",
4
4
  "description": "Node.js bindings for JQ",
5
- "jq-node-bindings": "1.0.3",
5
+ "jq-node-bindings": "1.0.5",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {
8
8
  "configure": "node-gyp configure",
@@ -44,4 +44,4 @@
44
44
  "engines": {
45
45
  "node": ">=6.0.0"
46
46
  }
47
- }
47
+ }
package/src/binding.cc CHANGED
@@ -359,9 +359,6 @@ bool jv_object_to_napi(std::string key, napi_env env, jv actual, napi_value ret,
359
359
  return true;
360
360
  }
361
361
 
362
-
363
-
364
-
365
362
  napi_value ExecSync(napi_env env, napi_callback_info info) {
366
363
  size_t argc = 2;
367
364
  napi_value args[2];
@@ -417,6 +414,7 @@ napi_value ExecSync(napi_env env, napi_callback_info info) {
417
414
  }
418
415
 
419
416
  wrapper->lock();
417
+ jq_set_input_cb(wrapper->get_jq(), NULL, NULL);
420
418
 
421
419
  jq_start(wrapper->get_jq(), input, 0);
422
420
  jv result = jq_next(wrapper->get_jq(), global_timeout_sec);
@@ -491,6 +489,7 @@ void ExecuteAsync(napi_env env, void* data) {
491
489
  return;
492
490
  }
493
491
  wrapper->lock();
492
+ jq_set_input_cb(wrapper->get_jq(), NULL, NULL);
494
493
  jq_start(wrapper->get_jq(), input, 0);
495
494
  ASYNC_DEBUG_LOG(work, "jq execution started");
496
495