@awboost/cfn-resource-schemas
Advanced tools
Comparing version 0.1.0 to 0.2.0
import { request } from "https"; | ||
import { Readable } from "stream"; | ||
import { createGunzip, createInflate } from "zlib"; | ||
@@ -3,0 +4,0 @@ export async function readUrl(url) { |
import Ajv from "ajv"; | ||
import { JSONSchema7 } from "json-schema"; | ||
import { ResourceTypeSchema } from "./types.js"; | ||
import type { JSONSchema7 } from "json-schema"; | ||
import type { ResourceTypeSchema } from "./types.js"; | ||
/** | ||
@@ -5,0 +5,0 @@ * JSON Schemas to validate the Resource Schema. |
@@ -1,2 +0,2 @@ | ||
import { JSONSchema7 } from "json-schema"; | ||
import type { JSONSchema7 } from "json-schema"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Description of a CloudFormation resource. |
{ | ||
"name": "@awboost/cfn-resource-schemas", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"publishConfig": { | ||
@@ -20,4 +20,4 @@ "access": "public" | ||
".": { | ||
"types": "./lib/fetchResourceSchemas.d.ts", | ||
"default": "./lib/fetchResourceSchemas.js" | ||
"types": "./lib/schemas.d.ts", | ||
"default": "./lib/schemas.js" | ||
}, | ||
@@ -28,2 +28,6 @@ "./meta": { | ||
}, | ||
"./nodes": { | ||
"types": "./lib/nodes.d.ts", | ||
"default": "./lib/nodes.js" | ||
}, | ||
"./types": { | ||
@@ -45,3 +49,7 @@ "types": "./lib/types.d.ts", | ||
"compile": "tsc", | ||
"lint": "eslint src/ --ext=ts" | ||
"lint": "eslint src/ --ext=ts", | ||
"postpublish": "npm run tag-version && git push --follow-tags", | ||
"postversion": "npm --prefix=../.. run sync-versions && git commit -am ${npm_package_name}@${npm_package_version}", | ||
"preversion": "git diff-index --quiet HEAD -- || ! echo 'Uncommitted changes present'", | ||
"tag-version": "git tag -a ${npm_package_name}@${npm_package_version} -m ${npm_package_name}@v${npm_package_version}" | ||
}, | ||
@@ -52,14 +60,6 @@ "dependencies": { | ||
"ajv-formats": "^2.1.1", | ||
"json-canonicalize": "^1.0.6", | ||
"json-pointer": "^0.6.2", | ||
"jszip": "^3.10.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.18.9", | ||
"@typescript-eslint/eslint-plugin": "^6.10.0", | ||
"@typescript-eslint/parser": "^6.10.0", | ||
"eslint": "^8.53.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"prettier": "^3.0.3", | ||
"typescript": "^5.2.2" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # @awboost/cfn-resource-schemas | ||
// fetchResourceSchemas returns an async generator | ||
for await (const schema of fetchResourceSchemas()) { | ||
for await (const schema of downloadAwsResourceSchemas()) { | ||
// do something with the schema | ||
@@ -15,3 +15,3 @@ } | ||
## Function `fetchResourceSchemas` | ||
## Function `downloadAwsResourceSchemas` | ||
@@ -21,10 +21,12 @@ Get the latest schemas. | ||
```typescript | ||
import { fetchResourceSchemas } from "@awboost/cfn-resource-schemas"; | ||
import { downloadAwsResourceSchemas } from "@awboost/cfn-resource-schemas"; | ||
``` | ||
```typescript | ||
export async function* fetchResourceSchemas( | ||
export async function* downloadAwsResourceSchemas({ | ||
skipValidate = false, | ||
url = "https://schema.cloudformation.us-east-1.amazonaws.com/CloudformationSchema.zip", | ||
validate = true, | ||
): AsyncGenerator<ResourceTypeSchema>; | ||
}: DownloadAwsResourceSchemasOptions): AsyncGenerator< | ||
ResourceTypeSchema & { $id: string } | ||
>; | ||
``` | ||
@@ -39,1 +41,14 @@ | ||
``` | ||
## Parsed representation | ||
This package also provides a set of node classes to represent schemas, similar to an AST. There are available from the `"@awboost/cfn-resource-schemas/nodes"` module path. | ||
```typescript | ||
import { SchemaFileNode } from "@awboost/cfn-resource-schemas/nodes"; | ||
import { readFile } from "node:fs/promises"; | ||
const path = "path-to-schema.json"; | ||
const schema = JSON.parse(await readFile(path, "utf-8")); | ||
const schemaFile = new SchemaFileNode(schema, path); | ||
``` |
@@ -1,2 +0,2 @@ | ||
import { IncomingHttpHeaders } from "http"; | ||
import type { IncomingHttpHeaders } from "http"; | ||
import { request } from "https"; | ||
@@ -3,0 +3,0 @@ import { Readable } from "stream"; |
import Ajv from "ajv"; | ||
import addFormats from "ajv-formats"; | ||
import { JSONSchema7 } from "json-schema"; | ||
import { ResourceTypeSchema } from "./types.js"; | ||
import type { JSONSchema7 } from "json-schema"; | ||
import type { ResourceTypeSchema } from "./types.js"; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { JSONSchema7 } from "json-schema"; | ||
import type { JSONSchema7 } from "json-schema"; | ||
@@ -3,0 +3,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260329
0
28
5564
51
6
+ Addedjson-canonicalize@^1.0.6
+ Addedjson-pointer@^0.6.2
+ Addedforeach@2.0.6(transitive)
+ Addedjson-canonicalize@1.0.6(transitive)
+ Addedjson-pointer@0.6.2(transitive)