@graffy/testing 0.15.17 → 0.15.18

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.cjs CHANGED
@@ -82,7 +82,23 @@ function inspect() {
82
82
  function pretty(query) {
83
83
  return JSON.stringify(query, null, 4).replace(/\[(\s*)([\s\S]*?)\},*/g, (_, space, inner) => "[" + space + inner.replace(/\n\s+/g, " ") + "},").replace(/[^\u0020-\u007e,\u000a]/g, (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4));
84
84
  }
85
+ const put = (obj) => {
86
+ Object.defineProperty(obj, "$put", { value: true });
87
+ return obj;
88
+ };
89
+ const ref = ($ref, obj = {}) => {
90
+ Object.defineProperty(obj, "$ref", { value: $ref });
91
+ return obj;
92
+ };
93
+ const keyref = ($key, $ref, obj = {}) => {
94
+ obj.$key = $key;
95
+ ref($ref, obj);
96
+ return obj;
97
+ };
85
98
  exports.format = format;
86
99
  exports.inspect = inspect;
100
+ exports.keyref = keyref;
87
101
  exports.mockBackend = mockBackend;
88
102
  exports.pretty = pretty;
103
+ exports.put = put;
104
+ exports.ref = ref;
package/index.mjs CHANGED
@@ -79,4 +79,17 @@ function inspect() {
79
79
  function pretty(query) {
80
80
  return JSON.stringify(query, null, 4).replace(/\[(\s*)([\s\S]*?)\},*/g, (_, space, inner) => "[" + space + inner.replace(/\n\s+/g, " ") + "},").replace(/[^\u0020-\u007e,\u000a]/g, (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4));
81
81
  }
82
- export { format, inspect, mockBackend, pretty };
82
+ const put = (obj) => {
83
+ Object.defineProperty(obj, "$put", { value: true });
84
+ return obj;
85
+ };
86
+ const ref = ($ref, obj = {}) => {
87
+ Object.defineProperty(obj, "$ref", { value: $ref });
88
+ return obj;
89
+ };
90
+ const keyref = ($key, $ref, obj = {}) => {
91
+ obj.$key = $key;
92
+ ref($ref, obj);
93
+ return obj;
94
+ };
95
+ export { format, inspect, keyref, mockBackend, pretty, put, ref };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/testing",
3
3
  "description": "Testing and debugging utilities for Graffy.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.15.17",
5
+ "version": "0.15.18",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -16,6 +16,6 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "@graffy/common": "0.15.17"
19
+ "@graffy/common": "0.15.18"
20
20
  }
21
21
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export { default as mockBackend } from "./mockBackend.js";
2
2
  export { default as pretty } from "./pretty.js";
3
+ export function put(obj: any): any;
4
+ export function ref($ref: any, obj?: {}): {};
5
+ export function keyref($key: any, $ref: any, obj?: {}): {};
3
6
  export { default as format, inspect } from "./format.js";