@kravc/schema 2.7.1 → 2.7.3

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.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/src/index.d.ts +24 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kravc/schema",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "description": "Advanced JSON schema manipulation and validation library.",
5
5
  "keywords": [
6
6
  "JSON",
@@ -13,6 +13,7 @@
13
13
  "Verifiable Credential"
14
14
  ],
15
15
  "main": "src/index.js",
16
+ "types": "src/index.d.ts",
16
17
  "repository": {
17
18
  "type": "git",
18
19
  "url": "http://github.com/alexkravets/schema.git"
package/src/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ declare type SchemaAttribute = object;
2
+ export declare type SchemaAttributes = Record<string, SchemaAttribute>;
3
+ declare type Enum = { enum: string[] };
4
+ declare type Source = Enum | SchemaAttributes;
5
+
6
+ export declare class Schema {
7
+ constructor(
8
+ source: Source,
9
+ id: string,
10
+ url?: string
11
+ )
12
+
13
+ static get id(): string;
14
+
15
+ only(propertyNames: string[], id?: string): Schema;
16
+ wrap(propertyName: string, options?: Record<string, any>, id?: string): Schema;
17
+ extend(properties: Record<string, any>, id?: string): Schema;
18
+ }
19
+
20
+ export declare class Validator {
21
+ constructor(
22
+ schemas: Schema[]
23
+ )
24
+ }