@lcem/declarative-type
Advanced tools
Comparing version 0.6.13 to 0.6.15
@@ -6,4 +6,89 @@ # Change Log | ||
## [0.6.13](https://github.com/salesforce/low-code-experience-model/compare/v0.6.12...v0.6.13) (2021-06-12) | ||
## [0.6.15](https://github.com/salesforce/low-code-experience-model/compare/v0.6.13...v0.6.15) (2021-06-23) | ||
**Note:** Version bump only for package @lcem/declarative-type | ||
# [0.6.0](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.6...v0.6.0) (2021-03-29) | ||
**Note:** Version bump only for package declarative-type-validator | ||
## [0.5.6](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.5...v0.5.6) (2021-03-25) | ||
**Note:** Version bump only for package declarative-type-validator | ||
## [0.5.5](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.4...v0.5.5) (2021-03-25) | ||
### Features | ||
- expose generated minLength of string validator @W-8790101 ([#38](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/38)) ([bcdc549](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/bcdc5495c3a2b4cd1e18876d39c337fcde69f12c)) | ||
### Reverts | ||
- Revert "fix: upgrade ajv 7 @W-8850686 (#34)" (#37) ([022d01a](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/022d01ac299d7048eb5ed970b4c4006c08e32585)), closes [#34](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/34) [#37](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/37) | ||
- Revert "feat: expose generated minLength for string schema @W-8790101 (#35)" (#36) ([08c98d2](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/08c98d24292be3fb153ba7104d9848f724db85c4)), closes [#35](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/35) [#36](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/36) | ||
## [0.5.4](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.3...v0.5.4) (2021-03-25) | ||
### Features | ||
- expose generated minLength for string schema @W-8790101 ([#35](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/35)) ([70b2823](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/70b2823b4ae8ef060116ea336cc89cf9367fdd94)) | ||
## [0.5.3](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.2...v0.5.3) (2021-02-17) | ||
### Bug Fixes | ||
- upgrade ajv 7 @W-8850686 ([#34](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/34)) ([47ac079](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/47ac0790b54cf919c1d30abde42649f4be508562)) | ||
## [0.5.2](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.1...v0.5.2) (2021-01-29) | ||
**Note:** Version bump only for package declarative-type-validator | ||
## [0.5.1](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.5.0...v0.5.1) (2020-12-08) | ||
### Features | ||
- expose leaf schema @W-8438227 ([#32](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/32)) ([c1f2b55](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/c1f2b55221b4c0549e2e53f5722d5e0fb206b8ad)) | ||
# [0.5.0](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.12...v0.5.0) (2020-11-23) | ||
**Note:** Version bump only for package declarative-type-validator | ||
## [0.4.12](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.11...v0.4.12) (2020-11-17) | ||
### Bug Fixes | ||
- default error message overrides the one in the schema @W-8276993 ([#28](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/28)) ([1ca768e](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/1ca768e1d2306e04ff8b9f2df0a028233382ba4e)) | ||
## [0.4.11](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.10...v0.4.11) (2020-10-14) | ||
### Bug Fixes | ||
- support for property defaults @W-7964015 ([#27](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/27)) ([6b96bc8](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/6b96bc81c683627d7e34da054a9fc50afdaf112e)) | ||
## [0.4.10](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.9...v0.4.10) (2020-10-13) | ||
### Features | ||
- improvements of scoped schema @W-7964133 ([#26](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/26)) ([e585987](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/e585987a6e41e9ee52353a15997dc79c35450452)) | ||
## [0.4.9](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.8...v0.4.9) (2020-09-24) | ||
### Features | ||
- ajv keyword and format extensions @W-7960054 ([#25](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/25)) ([f063548](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/f063548b2f0a87bf875a770d5d06fd9b9177a96a)) | ||
## [0.4.8](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.7...v0.4.8) (2020-09-15) | ||
### Features | ||
- **validation:** scoped schema validators @W-7964112 ([#23](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/23)) ([aafc618](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/aafc618969a634e18f28fd2cd00a6b92aeff5502)) | ||
## [0.4.7](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/compare/v0.4.6...v0.4.7) (2020-07-24) | ||
### Bug Fixes | ||
- **validator:** fully handle the async ajv @W-7845348 ([#20](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/issues/20)) ([1459cc5](https://git.soma.salesforce.com/BuilderFramework/canonical-ui-metadata/commits/1459cc5837d263b0d74f9db43da811f554e60663)) |
@@ -1,9 +0,176 @@ | ||
export declare type JsonValue = any; | ||
export declare function getDefaultValue(schema: JsonSchema, resolver?: DeclarativeTypeReferenceResolver): Promise<JsonValue | undefined>; | ||
export declare type DeclarativeTypeId = string; | ||
export declare type JsonSchema = any; | ||
export interface DeclarativeTypeReferenceResolver { | ||
resolve(id: DeclarativeTypeId): Promise<JsonSchema | undefined>; | ||
import Ajv from 'ajv'; | ||
import { JSONType } from 'ajv'; | ||
export type JSONSchemaMetaSchema = Schema | boolean; | ||
export interface Schema { | ||
$id?: string; | ||
$schema?: string; | ||
$ref?: string; | ||
title?: string; | ||
description?: string; | ||
default?: any; | ||
examples?: any[]; | ||
multipleOf?: number; | ||
maximum?: number; | ||
exclusiveMaximum?: number; | ||
minimum?: number; | ||
exclusiveMinimum?: number; | ||
maxLength?: number; | ||
minLength?: number; | ||
pattern?: string; | ||
additionalItems?: JSONSchemaMetaSchema; | ||
items?: JSONSchemaMetaSchema | JSONSchemaMetaSchema[]; | ||
maxItems?: number; | ||
minItems?: number; | ||
uniqueItems?: boolean; | ||
contains?: JSONSchemaMetaSchema; | ||
maxProperties?: number; | ||
minProperties?: number; | ||
required?: string[]; | ||
additionalProperties?: JSONSchemaMetaSchema; | ||
definitions?: { | ||
[k: string]: JSONSchemaMetaSchema; | ||
}; | ||
properties?: { | ||
[k: string]: JSONSchemaMetaSchema; | ||
}; | ||
patternProperties?: { | ||
[k: string]: JSONSchemaMetaSchema; | ||
}; | ||
dependencies?: { | ||
[k: string]: JSONSchemaMetaSchema | string[]; | ||
}; | ||
propertyNames?: JSONSchemaMetaSchema; | ||
const?: any; | ||
enum?: [any, ...any[]]; | ||
type?: | ||
| ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string') | ||
| ('array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string')[]; | ||
format?: string; | ||
allOf?: JSONSchemaMetaSchema[]; | ||
anyOf?: JSONSchemaMetaSchema[]; | ||
oneOf?: JSONSchemaMetaSchema[]; | ||
not?: JSONSchemaMetaSchema; | ||
[k: string]: any; | ||
} | ||
export interface Json { | ||
[x: string]: string | number | boolean | Date | Json | JsonArray | null; | ||
} | ||
export interface JsonArray extends Array<string | number | boolean | Date | Json | JsonArray> {} | ||
export type AllDataTypes = Json | string | number | boolean | null | undefined; | ||
export type JsonValue = | ||
| null | ||
| undefined | ||
| string | ||
| boolean | ||
| number | ||
| JsonValue[] | ||
| { [key: string]: JsonValue }; | ||
export type JsonSchema = boolean | Record<string, JsonValue>; | ||
export interface DataProvider { | ||
type: string; | ||
properties: Record<string, JsonValue>; | ||
} | ||
export interface Region { | ||
name?: string; | ||
components: Component[]; | ||
} | ||
export interface Component { | ||
definition: string; | ||
label?: string; | ||
description?: string; | ||
name?: string; | ||
schema?: Schema; | ||
properties?: Record<string, JsonValue>; | ||
dataProviders?: Record<string, DataProvider>; | ||
regions?: Record<string, Region>; | ||
components?: Component[]; | ||
} | ||
export type View = Component; | ||
export interface Renderers { | ||
[key: string]: View; | ||
} | ||
export interface DeclarativeType { | ||
view?: View; | ||
schema: Json; | ||
renderers?: Renderers; | ||
} | ||
export interface DeclarativeTypeMap { | ||
[index: string]: DeclarativeType; | ||
} | ||
export declare function getDefaultValue(schema: JsonSchema, resolver?: ReferenceResolver): Promise<JsonValue | undefined>; | ||
export interface ReferenceResolver { | ||
resolve(id: string): Promise<JsonSchema>; | ||
} | ||
export interface Keyword { | ||
name: string; | ||
scope: string; | ||
setCustomErrorMessage(errorMessage: string | undefined): void; | ||
setDefaultErrorMessage(errorMessage: string | undefined): void; | ||
} | ||
export declare type ValidationError = Error & { | ||
keyword: string; | ||
instancePath: string; | ||
schemaPath: string; | ||
params: any; | ||
}; | ||
export interface ValidationResult { | ||
isValid: boolean; | ||
errors?: Partial<ValidationError>[]; | ||
} | ||
/** | ||
* Validates a declarative type JSON obj or JSON string | ||
* @param declarativeType object to validate | ||
* @param schema Schema to validate against | ||
* @param ajv | ||
*/ | ||
export declare function validate(declarativeType: JsonValue, schema: Json, ajv?: Ajv): Promise<ValidationResult>; | ||
export interface Validator { | ||
validate(value?: AllDataTypes, referenceMap?: DeclarativeTypeMap): Promise<ValidationResult>; | ||
getKeywords(keyword: string): Keyword[]; | ||
setExtensions(keywordExtensions?: ValidatorKeywordExtension[], formatExtensions?: ValidatorFormatExtension[]): void; | ||
} | ||
export interface ValidatorKeywordExtension { | ||
name: string; | ||
validate(schema: Json, data: AllDataTypes, keyword: string): Promise<ValidationResult>; | ||
type?: JSONType | JSONType[]; | ||
} | ||
export interface ValidatorFormatExtension { | ||
name: string; | ||
validate(data: string, format: string): Promise<boolean>; | ||
type?: 'string' | undefined; | ||
} | ||
export declare function walk(schema: JsonSchema, pointer: string, referenceResolver?: ReferenceResolver): Promise<{ | ||
schema: JsonSchema; | ||
dataPath: string; | ||
keywords: Keyword[]; | ||
}>; | ||
export interface ValidatorResult { | ||
name?: string; | ||
type?: string; | ||
title?: string; | ||
min?: number; | ||
max?: number; | ||
isRequired?: boolean; | ||
description?: string; | ||
defaultValue?: AllDataTypes; | ||
validator: Validator; | ||
schema: JsonSchema; | ||
leafSchema: JsonSchema; | ||
isExternal?: boolean; | ||
} | ||
export declare function getValidator(schema: JsonSchema, scope: string, initValue?: JsonValue, referenceMap?: DeclarativeTypeMap): Promise<ValidatorResult | null>; | ||
export declare function getMin(schema?: JsonSchema): number | undefined; | ||
export declare function getMax(schema?: JsonSchema): number | undefined; | ||
export declare function getTitle(schema?: JsonSchema): string | undefined; | ||
export declare function getDescription(schema?: JsonSchema): string | undefined; | ||
export declare function getType(schema?: JsonSchema): string | string[] | undefined; | ||
export declare function getRef(schema?: JsonSchema): string | undefined; | ||
export declare function getStringValidator(name: string, isRequired?: boolean, min?: number, max?: number): { | ||
validator: Validator; | ||
minLength: number | undefined; | ||
}; | ||
export declare function getIntegerValidator(name: string, isRequired?: boolean, min?: number, max?: number): Validator; | ||
export declare function getBooleanValidator(name: string, isRequired?: boolean): Validator; | ||
export {}; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.6.13", | ||
"version": "0.6.15", | ||
"type": "module", | ||
@@ -30,4 +30,13 @@ "main": "dist/index.js", | ||
"@rollup/plugin-json": "^4.0.2", | ||
"@rollup/plugin-node-resolve": "^7.1.1" | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"@types/ajv-errors": "^2.0.1", | ||
"fs-extra": "^10.0.0" | ||
}, | ||
"dependencies": { | ||
"@lcem/meta-schemas": "0.6.15", | ||
"ajv": "^8.6.0", | ||
"ajv-errors": "^3.0.0", | ||
"ajv-formats": "^2.1.0", | ||
"immutable-json-patch": "^1.1.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
340336
8751
5
5
1
+ Added@lcem/meta-schemas@0.6.15
+ Addedajv@^8.6.0
+ Addedajv-errors@^3.0.0
+ Addedajv-formats@^2.1.0
+ Addedimmutable-json-patch@^1.1.1
+ Added@lcem/meta-schemas@0.6.15(transitive)
+ Addedajv@8.17.1(transitive)
+ Addedajv-errors@3.0.0(transitive)
+ Addedajv-formats@2.1.1(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-uri@3.0.5(transitive)
+ Addedimmutable-json-patch@1.1.2(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)