@dataplan/json 0.0.1-0.10

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/CHANGELOG.md ADDED
@@ -0,0 +1,87 @@
1
+ # @dataplan/json
2
+
3
+ ## 0.0.1-0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - grafast@0.0.1-0.10
9
+
10
+ ## 0.0.1-0.9
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ [[`11d6be65e`](https://github.com/benjie/postgraphile-private/commit/11d6be65e0da489f8ab3e3a8b8db145f8b2147ad)]:
16
+ - grafast@0.0.1-0.9
17
+
18
+ ## 0.0.1-0.8
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ [[`208166269`](https://github.com/benjie/postgraphile-private/commit/208166269177d6e278b056e1c77d26a2d8f59f49)]:
24
+ - grafast@0.0.1-0.8
25
+
26
+ ## 0.0.1-0.7
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies []:
31
+ - grafast@0.0.1-0.7
32
+
33
+ ## 0.0.1-0.6
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [[`9b296ba54`](undefined)]:
38
+ - grafast@0.0.1-0.6
39
+
40
+ ## 0.0.1-0.5
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [[`cd37fd02a`](undefined)]:
45
+ - grafast@0.0.1-0.5
46
+
47
+ ## 0.0.1-0.4
48
+
49
+ ### Patch Changes
50
+
51
+ - [`768f32681`](undefined) - Fix peerDependencies ranges
52
+
53
+ - Updated dependencies [[`768f32681`](undefined)]:
54
+ - grafast@0.0.1-0.4
55
+
56
+ ## 0.0.1-0.3
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies [[`d11c1911c`](undefined)]:
61
+ - grafast@0.0.1-0.3
62
+
63
+ ## 0.0.1-0.2
64
+
65
+ ### Patch Changes
66
+
67
+ - Updated dependencies [[`25037fc15`](undefined)]:
68
+ - grafast@0.0.1-0.2
69
+
70
+ ## 0.0.1-0.1
71
+
72
+ ### Patch Changes
73
+
74
+ - Updated dependencies [[`55f15cf35`](undefined)]:
75
+ - grafast@0.0.1-0.1
76
+
77
+ ## 0.0.1-0.0
78
+
79
+ ### Patch Changes
80
+
81
+ - [#125](https://github.com/benjie/postgraphile-private/pull/125)
82
+ [`91f2256b3`](https://github.com/benjie/postgraphile-private/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)
83
+ Thanks [@benjie](https://github.com/benjie)! - Initial changesets release
84
+
85
+ - Updated dependencies
86
+ [[`91f2256b3`](https://github.com/benjie/postgraphile-private/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)]:
87
+ - grafast@0.0.1-0.0
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @dataplan/json
2
+
3
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/benjie?color=ff69b4&label=github%20sponsors)](https://github.com/sponsors/benjie)
4
+ [![Patreon sponsor button](https://img.shields.io/badge/sponsor-via%20Patreon-orange.svg)](https://patreon.com/benjie)
5
+ [![Discord chat room](https://img.shields.io/discord/489127045289476126.svg)](http://discord.gg/graphile)
6
+ [![Follow](https://img.shields.io/badge/twitter-@GrafastHQ-blueviolet.svg)](https://twitter.com/GrafastHQ)
7
+
8
+ **A collection of Gra*fast* step classes for encoding/decoding JSON**
9
+
10
+ Docs: https://grafast.org/grafast/step-library/dataplan-json/
11
+
12
+ <!-- SPONSORS_BEGIN -->
13
+
14
+ ## Crowd-funded open-source software
15
+
16
+ To help us develop this software sustainably under the MIT license, we ask all
17
+ individuals and businesses that use it to help support its ongoing maintenance
18
+ and development via sponsorship.
19
+
20
+ ### [Click here to find out more about sponsors and sponsorship.](https://www.graphile.org/sponsor/)
21
+
22
+ And please give some love to our featured sponsors 🤩:
23
+
24
+ <table><tr>
25
+ <td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge" /><br />Surge</a> *</td>
26
+ <td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
27
+ <td align="center"><a href="https://qwick.com/"><img src="https://graphile.org/images/sponsors/qwick.png" width="90" height="90" alt="Qwick" /><br />Qwick</a> *</td>
28
+ <td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
29
+ </tr><tr>
30
+ <td align="center"><a href="http://chads.website"><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
31
+ <td align="center"><a href="https://www.fanatics.com/"><img src="https://graphile.org/images/sponsors/fanatics.png" width="90" height="90" alt="Fanatics" /><br />Fanatics</a> *</td>
32
+ <td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
33
+ <td align="center"><a href="https://www.enzuzo.com/"><img src="https://graphile.org/images/sponsors/enzuzo.png" width="90" height="90" alt="Enzuzo" /><br />Enzuzo</a> *</td>
34
+ </tr><tr>
35
+ <td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
36
+ </tr></table>
37
+
38
+ <em>\* Sponsors the entire Graphile suite</em>
39
+
40
+ <!-- SPONSORS_END -->
41
+
42
+ [grafast]: https://grafast.org
@@ -0,0 +1,2 @@
1
+ export { jsonParse, JSONParseStep, JSONValue } from "./steps/jsonParse.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JSONParseStep = exports.jsonParse = void 0;
4
+ var jsonParse_js_1 = require("./steps/jsonParse.js");
5
+ Object.defineProperty(exports, "jsonParse", { enumerable: true, get: function () { return jsonParse_js_1.jsonParse; } });
6
+ Object.defineProperty(exports, "JSONParseStep", { enumerable: true, get: function () { return jsonParse_js_1.JSONParseStep; } });
@@ -0,0 +1,21 @@
1
+ import type { AccessStep, GrafastResultsList, GrafastValuesList } from "grafast";
2
+ import { ExecutableStep } from "grafast";
3
+ export type JSONValue = string | number | boolean | null | {
4
+ [key: string]: JSONValue;
5
+ } | Array<JSONValue>;
6
+ export declare class JSONParseStep<TJSON extends JSONValue> extends ExecutableStep<TJSON> {
7
+ static $$export: {
8
+ moduleName: string;
9
+ exportName: string;
10
+ };
11
+ isSyncAndSafe: boolean;
12
+ constructor($stringPlan: ExecutableStep<string | null>);
13
+ toStringMeta(): string;
14
+ get<TKey extends keyof TJSON>(key: TKey): AccessStep<TJSON extends {
15
+ [key: string]: unknown;
16
+ } ? TJSON[TKey] : never>;
17
+ at<TIndex extends keyof TJSON & number>(index: TIndex): AccessStep<TJSON[TIndex]>;
18
+ execute(values: [GrafastValuesList<string>]): GrafastResultsList<TJSON>;
19
+ }
20
+ export declare function jsonParse<TJSON extends JSONValue>($string: ExecutableStep<string | null>): JSONParseStep<TJSON>;
21
+ //# sourceMappingURL=jsonParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonParse.d.ts","sourceRoot":"","sources":["../../src/steps/jsonParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAU,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5B,KAAK,CAAC,SAAS,CAAC,CAAC;AAMrB,qBAAa,aAAa,CACxB,KAAK,SAAS,SAAS,CACvB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC7B,MAAM,CAAC,QAAQ;;;MAGb;IAGF,aAAa,UAAS;gBAEV,WAAW,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;IAKtD,YAAY,IAAI,MAAM;IAItB,GAAG,CAAC,IAAI,SAAS,MAAM,KAAK,EAC1B,GAAG,EAAE,IAAI,GACR,UAAU,CACX,KAAK,SAAS;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAC/D;IAID,EAAE,CAAC,MAAM,SAAS,MAAM,KAAK,GAAG,MAAM,EACpC,KAAK,EAAE,MAAM,GACZ,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAI5B,OAAO,CAAC,MAAM,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC;CAqBxE;AAMD,wBAAgB,SAAS,CAAC,KAAK,SAAS,SAAS,EAC/C,OAAO,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,GACrC,aAAa,CAAC,KAAK,CAAC,CAEtB"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonParse = exports.JSONParseStep = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const grafast_1 = require("grafast");
7
+ class JSONParseStep extends grafast_1.ExecutableStep {
8
+ static $$export = {
9
+ moduleName: "@dataplan/json",
10
+ exportName: "JSONParseStep",
11
+ };
12
+ isSyncAndSafe = false;
13
+ constructor($stringPlan) {
14
+ super();
15
+ this.addDependency($stringPlan);
16
+ }
17
+ toStringMeta() {
18
+ return chalk_1.default.bold.yellow(String(this.dependencies[0].id));
19
+ }
20
+ get(key) {
21
+ return (0, grafast_1.access)(this, [key]);
22
+ }
23
+ at(index) {
24
+ return (0, grafast_1.access)(this, [index]);
25
+ }
26
+ execute(values) {
27
+ return values[0].map((v) => {
28
+ if (typeof v === "string") {
29
+ try {
30
+ return JSON.parse(v);
31
+ }
32
+ catch (e) {
33
+ return Promise.reject(e);
34
+ }
35
+ }
36
+ else if (v == null) {
37
+ return null;
38
+ }
39
+ else {
40
+ return Promise.reject(new Error(`JSONParseStep: expected string to parse, but received ${Array.isArray(v) ? "array" : typeof v}`));
41
+ }
42
+ });
43
+ }
44
+ }
45
+ exports.JSONParseStep = JSONParseStep;
46
+ function jsonParse($string) {
47
+ return new JSONParseStep($string);
48
+ }
49
+ exports.jsonParse = jsonParse;
50
+ Object.defineProperty(jsonParse, "$$export", {
51
+ value: {
52
+ moduleName: "@dataplan/json",
53
+ exportName: "jsonParse",
54
+ },
55
+ });
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@dataplan/json",
3
+ "version": "0.0.1-0.10",
4
+ "description": "JSON step classes for Grafast",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "prepack": "tsc -b"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/graphile/heart.git"
13
+ },
14
+ "keywords": [
15
+ "graphile",
16
+ "graphql",
17
+ "grafast",
18
+ "json",
19
+ "dataplan",
20
+ "graphite"
21
+ ],
22
+ "author": "Benjie Gillam <code@benjiegillam.com>",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/graphile/heart/issues"
26
+ },
27
+ "homepage": "https://github.com/graphile/heart/tree/main/grafast/dataplan-json",
28
+ "dependencies": {
29
+ "chalk": "^4.1.2",
30
+ "tslib": "^2.4.0"
31
+ },
32
+ "engines": {
33
+ "node": ">=14.17"
34
+ },
35
+ "peerDependencies": {
36
+ "grafast": "^0.0.1-0.10",
37
+ "graphql": "^16.1.0-experimental-stream-defer.6"
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "devDependencies": {
43
+ "@types/jest": "^27.5.1",
44
+ "jest": "^28.1.0",
45
+ "jest-serializer-simple": "^5.0.0-0.1",
46
+ "typescript": "^5.0.0-beta"
47
+ }
48
+ }