@propulsionworks/cfn-resource-schemas 0.1.32 → 0.1.33

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/exports/main.ts CHANGED
@@ -1,69 +1,2 @@
1
- import { createReadStream } from "node:fs";
2
- import { type TransformCallback, Transform } from "node:stream";
3
- import { StringDecoder } from "node:string_decoder";
4
- import { createGunzip } from "node:zlib";
5
- import { Bundles } from "../lib/paths.ts";
6
- import type {
7
- ResourceSupplemental,
8
- ResourceTypeSchemaWithMeta,
9
- } from "./types.ts";
10
-
11
- /**
12
- * Stream transform to convert the input into a stream of JSON objects.
13
- */
14
- class FromNdJsonTransform extends Transform {
15
- readonly #decoder = new StringDecoder();
16
- #last = "";
17
-
18
- public constructor() {
19
- super({
20
- readableObjectMode: true,
21
- });
22
- }
23
-
24
- public override _transform(
25
- chunk: string | Buffer,
26
- encoding: BufferEncoding,
27
- callback: TransformCallback
28
- ): void {
29
- const current = this.#last + this.#decoder.write(chunk);
30
- const lines = current.split(`\n`);
31
- this.#last = lines.pop() ?? "";
32
-
33
- for (const line of lines) {
34
- this.push(JSON.parse(line));
35
- }
36
- callback();
37
- }
38
-
39
- public override _flush(callback: TransformCallback): void {
40
- const current = this.#last + this.#decoder.end();
41
- callback(undefined, current ? JSON.parse(current) : undefined);
42
- }
43
- }
44
-
45
- /**
46
- * Load the AWS schemas from the bundle.
47
- */
48
- export function loadSchemas(): AsyncIterable<
49
- ResourceTypeSchemaWithMeta,
50
- void,
51
- void
52
- > {
53
- return createReadStream(Bundles.schemas)
54
- .pipe(createGunzip())
55
- .pipe(new FromNdJsonTransform());
56
- }
57
-
58
- /**
59
- * Load the AWS schemas from the bundle.
60
- */
61
- export function loadSupplemental(): AsyncIterable<
62
- ResourceSupplemental,
63
- void,
64
- void
65
- > {
66
- return createReadStream(Bundles.supplemental)
67
- .pipe(createGunzip())
68
- .pipe(new FromNdJsonTransform());
69
- }
1
+ export * from "../lib/data.ts";
2
+ export * from "./types.ts";
package/lib/data.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { createReadStream } from "node:fs";
2
+ import { pipeline } from "node:stream";
3
+ import { createGunzip } from "node:zlib";
4
+ import type {
5
+ ResourceSupplemental,
6
+ ResourceTypeSchemaWithMeta,
7
+ } from "../exports/types.ts";
8
+ import { Bundles } from "./paths.ts";
9
+ import { FromNdJsonTransform } from "./stream.ts";
10
+
11
+ /**
12
+ * Load the AWS schemas from the bundle.
13
+ */
14
+ export function loadSchemas(): AsyncIterable<
15
+ ResourceTypeSchemaWithMeta,
16
+ void,
17
+ void
18
+ > {
19
+ return pipeline(
20
+ createReadStream(Bundles.schemas),
21
+ createGunzip(),
22
+ new FromNdJsonTransform(),
23
+ () => {}
24
+ );
25
+ }
26
+
27
+ /**
28
+ * Load the AWS schemas from the bundle.
29
+ */
30
+ export function loadSupplemental(): AsyncIterable<
31
+ ResourceSupplemental,
32
+ void,
33
+ void
34
+ > {
35
+ return pipeline(
36
+ createReadStream(Bundles.supplemental),
37
+ createGunzip(),
38
+ new FromNdJsonTransform(),
39
+ () => {}
40
+ );
41
+ }
package/lib/stream.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { type TransformCallback, Transform } from "node:stream";
2
+ import { StringDecoder } from "node:string_decoder";
3
+
4
+ /**
5
+ * Stream transform to convert the input into a stream of JSON objects.
6
+ */
7
+ export class FromNdJsonTransform extends Transform {
8
+ readonly #decoder = new StringDecoder();
9
+ #last = "";
10
+
11
+ public constructor() {
12
+ super({
13
+ readableObjectMode: true,
14
+ });
15
+ }
16
+
17
+ public override _transform(
18
+ chunk: string | Buffer,
19
+ encoding: BufferEncoding,
20
+ callback: TransformCallback
21
+ ): void {
22
+ const current = this.#last + this.#decoder.write(chunk);
23
+ const lines = current.split(`\n`);
24
+ this.#last = lines.pop() ?? "";
25
+
26
+ for (const line of lines) {
27
+ this.push(JSON.parse(line));
28
+ }
29
+ callback();
30
+ }
31
+
32
+ public override _flush(callback: TransformCallback): void {
33
+ const current = this.#last + this.#decoder.end();
34
+ callback(undefined, current ? JSON.parse(current) : undefined);
35
+ }
36
+ }
@@ -1,10 +1,3 @@
1
- import type { ResourceSupplemental, ResourceTypeSchemaWithMeta } from "./types.ts";
2
- /**
3
- * Load the AWS schemas from the bundle.
4
- */
5
- export declare function loadSchemas(): AsyncIterable<ResourceTypeSchemaWithMeta, void, void>;
6
- /**
7
- * Load the AWS schemas from the bundle.
8
- */
9
- export declare function loadSupplemental(): AsyncIterable<ResourceSupplemental, void, void>;
1
+ export * from "../lib/data.ts";
2
+ export * from "./types.ts";
10
3
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../exports/main.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAoCpB;;GAEG;AACH,wBAAgB,WAAW,IAAI,aAAa,CAC1C,0BAA0B,EAC1B,IAAI,EACJ,IAAI,CACL,CAIA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAC/C,oBAAoB,EACpB,IAAI,EACJ,IAAI,CACL,CAIA"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../exports/main.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
@@ -1,47 +1,3 @@
1
- import { createReadStream } from "node:fs";
2
- import { Transform } from "node:stream";
3
- import { StringDecoder } from "node:string_decoder";
4
- import { createGunzip } from "node:zlib";
5
- import { Bundles } from "../lib/paths.js";
6
- /**
7
- * Stream transform to convert the input into a stream of JSON objects.
8
- */
9
- class FromNdJsonTransform extends Transform {
10
- #decoder = new StringDecoder();
11
- #last = "";
12
- constructor() {
13
- super({
14
- readableObjectMode: true,
15
- });
16
- }
17
- _transform(chunk, encoding, callback) {
18
- const current = this.#last + this.#decoder.write(chunk);
19
- const lines = current.split(`\n`);
20
- this.#last = lines.pop() ?? "";
21
- for (const line of lines) {
22
- this.push(JSON.parse(line));
23
- }
24
- callback();
25
- }
26
- _flush(callback) {
27
- const current = this.#last + this.#decoder.end();
28
- callback(undefined, current ? JSON.parse(current) : undefined);
29
- }
30
- }
31
- /**
32
- * Load the AWS schemas from the bundle.
33
- */
34
- export function loadSchemas() {
35
- return createReadStream(Bundles.schemas)
36
- .pipe(createGunzip())
37
- .pipe(new FromNdJsonTransform());
38
- }
39
- /**
40
- * Load the AWS schemas from the bundle.
41
- */
42
- export function loadSupplemental() {
43
- return createReadStream(Bundles.supplemental)
44
- .pipe(createGunzip())
45
- .pipe(new FromNdJsonTransform());
46
- }
1
+ export * from "../lib/data.js";
2
+ export * from "./types.js";
47
3
  //# sourceMappingURL=main.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../exports/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAA0B,SAAS,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAM1C;;GAEG;AACH,MAAM,mBAAoB,SAAQ,SAAS;IAChC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;IACxC,KAAK,GAAG,EAAE,CAAC;IAEX;QACE,KAAK,CAAC;YACJ,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;IACL,CAAC;IAEe,UAAU,CACxB,KAAsB,EACtB,QAAwB,EACxB,QAA2B;QAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9B,CAAC;QACD,QAAQ,EAAE,CAAC;IACb,CAAC;IAEe,MAAM,CAAC,QAA2B;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QACjD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IAKzB,OAAO,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC;SACrC,IAAI,CAAC,YAAY,EAAE,CAAC;SACpB,IAAI,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAK9B,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,CAAC;SAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;SACpB,IAAI,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../exports/main.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ResourceSupplemental, ResourceTypeSchemaWithMeta } from "../exports/types.ts";
2
+ /**
3
+ * Load the AWS schemas from the bundle.
4
+ */
5
+ export declare function loadSchemas(): AsyncIterable<ResourceTypeSchemaWithMeta, void, void>;
6
+ /**
7
+ * Load the AWS schemas from the bundle.
8
+ */
9
+ export declare function loadSupplemental(): AsyncIterable<ResourceSupplemental, void, void>;
10
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../lib/data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAI7B;;GAEG;AACH,wBAAgB,WAAW,IAAI,aAAa,CAC1C,0BAA0B,EAC1B,IAAI,EACJ,IAAI,CACL,CAOA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAC/C,oBAAoB,EACpB,IAAI,EACJ,IAAI,CACL,CAOA"}
@@ -0,0 +1,18 @@
1
+ import { createReadStream } from "node:fs";
2
+ import { pipeline } from "node:stream";
3
+ import { createGunzip } from "node:zlib";
4
+ import { Bundles } from "./paths.js";
5
+ import { FromNdJsonTransform } from "./stream.js";
6
+ /**
7
+ * Load the AWS schemas from the bundle.
8
+ */
9
+ export function loadSchemas() {
10
+ return pipeline(createReadStream(Bundles.schemas), createGunzip(), new FromNdJsonTransform(), () => { });
11
+ }
12
+ /**
13
+ * Load the AWS schemas from the bundle.
14
+ */
15
+ export function loadSupplemental() {
16
+ return pipeline(createReadStream(Bundles.supplemental), createGunzip(), new FromNdJsonTransform(), () => { });
17
+ }
18
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../lib/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,WAAW;IAKzB,OAAO,QAAQ,CACb,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,EACjC,YAAY,EAAE,EACd,IAAI,mBAAmB,EAAE,EACzB,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAK9B,OAAO,QAAQ,CACb,gBAAgB,CAAC,OAAO,CAAC,YAAY,CAAC,EACtC,YAAY,EAAE,EACd,IAAI,mBAAmB,EAAE,EACzB,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type TransformCallback, Transform } from "node:stream";
2
+ /**
3
+ * Stream transform to convert the input into a stream of JSON objects.
4
+ */
5
+ export declare class FromNdJsonTransform extends Transform {
6
+ #private;
7
+ constructor();
8
+ _transform(chunk: string | Buffer, encoding: BufferEncoding, callback: TransformCallback): void;
9
+ _flush(callback: TransformCallback): void;
10
+ }
11
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../lib/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGhE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;;;IAUhC,UAAU,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,iBAAiB,GAC1B,IAAI;IAWS,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;CAI1D"}
@@ -0,0 +1,28 @@
1
+ import { Transform } from "node:stream";
2
+ import { StringDecoder } from "node:string_decoder";
3
+ /**
4
+ * Stream transform to convert the input into a stream of JSON objects.
5
+ */
6
+ export class FromNdJsonTransform extends Transform {
7
+ #decoder = new StringDecoder();
8
+ #last = "";
9
+ constructor() {
10
+ super({
11
+ readableObjectMode: true,
12
+ });
13
+ }
14
+ _transform(chunk, encoding, callback) {
15
+ const current = this.#last + this.#decoder.write(chunk);
16
+ const lines = current.split(`\n`);
17
+ this.#last = lines.pop() ?? "";
18
+ for (const line of lines) {
19
+ this.push(JSON.parse(line));
20
+ }
21
+ callback();
22
+ }
23
+ _flush(callback) {
24
+ const current = this.#last + this.#decoder.end();
25
+ callback(undefined, current ? JSON.parse(current) : undefined);
26
+ }
27
+ }
28
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../lib/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,SAAS,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IACvC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;IACxC,KAAK,GAAG,EAAE,CAAC;IAEX;QACE,KAAK,CAAC;YACJ,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;IACL,CAAC;IAEe,UAAU,CACxB,KAAsB,EACtB,QAAwB,EACxB,QAA2B;QAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9B,CAAC;QACD,QAAQ,EAAE,CAAC;IACb,CAAC;IAEe,MAAM,CAAC,QAA2B;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QACjD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propulsionworks/cfn-resource-schemas",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "type": "module",
5
5
  "description": "Versioned mirror of AWS CloudFormation Resource Schemas (unofficial)",
6
6
  "author": {
@@ -20,8 +20,8 @@
20
20
  "types": "./out/exports/main.d.ts"
21
21
  },
22
22
  "./types": {
23
- "default": "./out/lib/types.js",
24
- "types": "./out/lib/types.d.ts"
23
+ "default": "./out/exports/types.js",
24
+ "types": "./out/exports/types.d.ts"
25
25
  }
26
26
  },
27
27
  "imports": {
@@ -41,13 +41,13 @@
41
41
  "build": "npm run clean && npm run compile",
42
42
  "bundle": "node --experimental-strip-types ./build-scripts/bundle.ts",
43
43
  "check": "tsc -p tsconfig.json",
44
- "ci-build": "node --enable-source-maps --experimental-strip-types ./build-scripts/ci.ts",
45
- "clean": "rimraf out/ *.tsbuildinfo",
44
+ "ci-build": "node --experimental-strip-types ./build-scripts/ci.ts",
45
+ "clean": "rimraf -g out/ '*.tsbuildinfo'",
46
46
  "compile": "tsc -p tsconfig.lib.json",
47
47
  "download": "node --experimental-strip-types ./build-scripts/download.ts",
48
48
  "lint": "eslint",
49
49
  "supplemental": "node --experimental-strip-types ./build-scripts/supplemental.ts",
50
- "test": "node --enable-source-maps --experimental-strip-types ./build-scripts/test.ts"
50
+ "test": "node --experimental-strip-types ./build-scripts/test.ts"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@aws-cdk/aws-service-spec": "^0.1.67",
package/schemas.ndjson.gz CHANGED
Binary file
Binary file