@e22m4u/js-repository 0.1.3 → 0.1.4
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/README.md +32 -33
- package/assets/mermaid-diagram.png +0 -0
- package/assets/mermaid-diagram.txt +29 -0
- package/docs/assets/main.js +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Adapter.html +14 -14
- package/docs/classes/AdapterLoader.html +2 -2
- package/docs/classes/AdapterRegistry.html +2 -2
- package/docs/classes/BelongsToResolver.html +3 -3
- package/docs/classes/DatasourceDefinitionValidator.html +2 -2
- package/docs/classes/DefinitionRegistry.html +7 -7
- package/docs/classes/FieldsClauseTool.html +4 -4
- package/docs/classes/HasManyResolver.html +4 -4
- package/docs/classes/HasOneResolver.html +4 -4
- package/docs/classes/IncludeClauseTool.html +6 -6
- package/docs/classes/InvalidArgumentError.html +1 -1
- package/docs/classes/InvalidOperatorValueError.html +2 -2
- package/docs/classes/ModelDataSanitizer.html +2 -2
- package/docs/classes/ModelDataValidator.html +3 -5
- package/docs/classes/ModelDefinitionUtils.html +17 -17
- package/docs/classes/ModelDefinitionValidator.html +2 -2
- package/docs/classes/NotImplementedError.html +1 -1
- package/docs/classes/OperatorClauseTool.html +14 -14
- package/docs/classes/OrderClauseTool.html +4 -4
- package/docs/classes/PrimaryKeysDefinitionValidator.html +2 -2
- package/docs/classes/PropertiesDefinitionValidator.html +2 -2
- package/docs/classes/PropertyValidatorRegistry.html +20 -0
- package/docs/classes/ReferencesManyResolver.html +2 -2
- package/docs/classes/RelationsDefinitionValidator.html +2 -2
- package/docs/classes/Repository.html +17 -17
- package/docs/classes/RepositoryRegistry.html +3 -3
- package/docs/classes/Schema.html +4 -4
- package/docs/classes/SliceClauseTool.html +4 -4
- package/docs/classes/WhereClauseTool.html +3 -3
- package/docs/enums/DataType.html +2 -2
- package/docs/enums/DecoratorTargetType.html +2 -2
- package/docs/enums/RelationType.html +2 -2
- package/docs/functions/capitalize.html +1 -1
- package/docs/functions/cloneDeep.html +1 -1
- package/docs/functions/excludeObjectKeys.html +1 -1
- package/docs/functions/getCtorName.html +1 -1
- package/docs/functions/getDecoratorTargetType.html +1 -1
- package/docs/functions/getValueByPath.html +1 -1
- package/docs/functions/isCtor.html +1 -1
- package/docs/functions/isPureObject.html +1 -1
- package/docs/functions/selectObjectKeys.html +1 -1
- package/docs/functions/singularize.html +1 -1
- package/docs/functions/stringToRegexp.html +1 -1
- package/docs/index.html +16 -4
- package/docs/interfaces/AndClause.html +2 -2
- package/docs/interfaces/Constructor.html +2 -2
- package/docs/interfaces/OrClause.html +2 -2
- package/docs/modules.html +4 -0
- package/docs/types/AnyObject.html +1 -1
- package/docs/types/BelongsToDefinition.html +1 -1
- package/docs/types/DEFAULT_PRIMARY_KEY_PROPERTY_NAME.html +1 -1
- package/docs/types/DatasourceDefinition.html +1 -1
- package/docs/types/FieldsClause.html +1 -1
- package/docs/types/FilterClause.html +1 -1
- package/docs/types/Flatten.html +1 -1
- package/docs/types/FullPropertyDefinition.html +2 -2
- package/docs/types/HasManyDefinition.html +1 -1
- package/docs/types/HasOneDefinition.html +1 -1
- package/docs/types/Identity.html +1 -1
- package/docs/types/IncludeClause.html +1 -1
- package/docs/types/ItemFilterClause.html +1 -1
- package/docs/types/ModelData.html +1 -1
- package/docs/types/ModelDefinition.html +1 -1
- package/docs/types/ModelId.html +1 -1
- package/docs/types/NestedIncludeClause.html +1 -1
- package/docs/types/NormalizedFieldsClause.html +1 -1
- package/docs/types/NormalizedIncludeClause.html +1 -1
- package/docs/types/OperatorClause.html +1 -1
- package/docs/types/OptionalUnlessRequiredId.html +1 -1
- package/docs/types/OrderClause.html +1 -1
- package/docs/types/PartialBy.html +1 -1
- package/docs/types/PartialWithoutId.html +1 -1
- package/docs/types/PolyBelongsToDefinition.html +1 -1
- package/docs/types/PolyHasManyDefinitionWithTargetKeys.html +1 -1
- package/docs/types/PolyHasManyDefinitionWithTargetRelationName.html +1 -1
- package/docs/types/PolyHasOneDefinitionWithTargetKeys.html +1 -1
- package/docs/types/PolyHasOneDefinitionWithTargetRelationName.html +1 -1
- package/docs/types/PropertiesClause.html +1 -1
- package/docs/types/PropertyDefinition.html +1 -1
- package/docs/types/PropertyDefinitionMap.html +1 -1
- package/docs/types/PropertyValidateOptions.html +2 -0
- package/docs/types/PropertyValidator.html +2 -0
- package/docs/types/PropertyValidatorContext.html +2 -0
- package/docs/types/ReferencesManyDefinition.html +1 -1
- package/docs/types/RelationDefinition.html +1 -1
- package/docs/types/RelationDefinitionMap.html +1 -1
- package/docs/types/WhereClause.html +1 -1
- package/docs/types/WithoutId.html +1 -1
- package/package.json +2 -2
- package/src/definition/model/model-data-validator.js +1 -6
- package/src/definition/model/model-data-validator.spec.js +101 -69
- package/src/definition/model/properties/property-validator/builtin/index.d.ts +2 -0
- package/src/definition/model/properties/property-validator/builtin/index.js +2 -0
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.d.ts +6 -0
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.js +28 -0
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js +65 -0
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.d.ts +6 -0
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.js +28 -0
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.spec.js +65 -0
- package/src/definition/model/properties/property-validator/property-validator-registry.js +6 -1
- package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +1 -1
- package/src/schema.d.ts +0 -9
- package/src/schema.js +0 -13
- package/src/schema.spec.ts +0 -29
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WithoutId | @e22m4u/js-repository</title><meta name="description" content="Documentation for @e22m4u/js-repository"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@e22m4u/js-repository</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@e22m4u/js-repository</a></li><li><a href="WithoutId.html">WithoutId</a></li></ul><h1>Type alias WithoutId<IdName, Data></h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Without<wbr/>Id</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="WithoutId.html#IdName">IdName</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="WithoutId.html#Data">Data</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">:</span> <a href="Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="WithoutId.html#Data">Data</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="WithoutId.html#IdName">IdName</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Removes id field.</p>
|
|
2
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><h4><a id="IdName" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">IdName</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span></h4></li><li><h4><a id="Data" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Data</span><span class="tsd-signature-keyword"> extends </span><a href="ModelData.html" class="tsd-signature-type tsd-kind-type-alias">ModelData</a></h4></li></ul></section><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/e22m4u/js-repository/blob/d25cd6b/src/repository/repository.d.ts#L164">src/repository/repository.d.ts:164</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-1"></use></svg><span>@e22m4u/js-repository</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li><a href="../enums/DataType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg>DataType</a></li><li><a href="../enums/DecoratorTargetType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg>DecoratorTargetType</a></li><li><a href="../enums/RelationType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg>RelationType</a></li><li><a href="../classes/Adapter.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>Adapter</a></li><li><a href="../classes/AdapterLoader.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>AdapterLoader</a></li><li><a href="../classes/AdapterRegistry.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>AdapterRegistry</a></li><li><a href="../classes/BelongsToResolver.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>BelongsToResolver</a></li><li><a href="../classes/DatasourceDefinitionValidator.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>DatasourceDefinitionValidator</a></li><li><a href="../classes/DefinitionRegistry.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>DefinitionRegistry</a></li><li><a href="../classes/FieldsClauseTool.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>FieldsClauseTool</a></li><li><a href="../classes/HasManyResolver.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>HasManyResolver</a></li><li><a href="../classes/HasOneResolver.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>HasOneResolver</a></li><li><a href="../classes/IncludeClauseTool.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>IncludeClauseTool</a></li><li><a href="../classes/InvalidArgumentError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>InvalidArgumentError</a></li><li><a href="../classes/InvalidOperatorValueError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>InvalidOperatorValueError</a></li><li><a href="../classes/ModelDataSanitizer.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDataSanitizer</a></li><li><a href="../classes/ModelDataValidator.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDataValidator</a></li><li><a href="../classes/ModelDefinitionUtils.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDefinitionUtils</a></li><li><a href="../classes/ModelDefinitionValidator.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDefinitionValidator</a></li><li><a href="../classes/NotImplementedError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>NotImplementedError</a></li><li><a href="../classes/OperatorClauseTool.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>OperatorClauseTool</a></li><li>Loading...</li></ul></nav></div></div></div><div class="tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><svg style="display: none"><g id="icon-1"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-2"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g><g id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill="var(--color-text)"></path></g><g id="icon-16"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)"></path></g><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g><g id="icon-512"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-1024"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-2048"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4096"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-8192"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-16384"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-32768"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-65536"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-131072"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-262144"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-524288"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z" fill="var(--color-text)"></path></g><g id="icon-chevronDown"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></g><g id="icon-chevronSmall"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-text)"></path></g><g id="icon-menu"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></g><g id="icon-search"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></g><g id="icon-anchor"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></g></svg></body></html>
|
|
2
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><h4><a id="IdName" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">IdName</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span></h4></li><li><h4><a id="Data" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Data</span><span class="tsd-signature-keyword"> extends </span><a href="ModelData.html" class="tsd-signature-type tsd-kind-type-alias">ModelData</a></h4></li></ul></section><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in src/repository/repository.d.ts:164</li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-1"></use></svg><span>@e22m4u/js-repository</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li><a href="../enums/DataType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg>DataType</a></li><li><a href="../enums/DecoratorTargetType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg>DecoratorTargetType</a></li><li><a href="../enums/RelationType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg>RelationType</a></li><li><a href="../classes/Adapter.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>Adapter</a></li><li><a href="../classes/AdapterLoader.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>AdapterLoader</a></li><li><a href="../classes/AdapterRegistry.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>AdapterRegistry</a></li><li><a href="../classes/BelongsToResolver.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>BelongsToResolver</a></li><li><a href="../classes/DatasourceDefinitionValidator.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>DatasourceDefinitionValidator</a></li><li><a href="../classes/DefinitionRegistry.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>DefinitionRegistry</a></li><li><a href="../classes/FieldsClauseTool.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>FieldsClauseTool</a></li><li><a href="../classes/HasManyResolver.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>HasManyResolver</a></li><li><a href="../classes/HasOneResolver.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>HasOneResolver</a></li><li><a href="../classes/IncludeClauseTool.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>IncludeClauseTool</a></li><li><a href="../classes/InvalidArgumentError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>InvalidArgumentError</a></li><li><a href="../classes/InvalidOperatorValueError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>InvalidOperatorValueError</a></li><li><a href="../classes/ModelDataSanitizer.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDataSanitizer</a></li><li><a href="../classes/ModelDataValidator.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDataValidator</a></li><li><a href="../classes/ModelDefinitionUtils.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDefinitionUtils</a></li><li><a href="../classes/ModelDefinitionValidator.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>ModelDefinitionValidator</a></li><li><a href="../classes/NotImplementedError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>NotImplementedError</a></li><li><a href="../classes/OperatorClauseTool.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>OperatorClauseTool</a></li><li>Loading...</li></ul></nav></div></div></div><div class="tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><svg style="display: none"><g id="icon-1"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-2"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g><g id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill="var(--color-text)"></path></g><g id="icon-16"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)"></path></g><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g><g id="icon-512"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-1024"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-2048"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4096"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-8192"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-16384"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-32768"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-65536"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-131072"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-262144"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-524288"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z" fill="var(--color-text)"></path></g><g id="icon-chevronDown"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></g><g id="icon-chevronSmall"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-text)"></path></g><g id="icon-menu"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></g><g id="icon-search"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></g><g id="icon-anchor"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></g></svg></body></html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e22m4u/js-repository",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Модуль для работы с базами данных для Node.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@commitlint/cli": "^18.6.1",
|
|
40
|
-
"@commitlint/config-conventional": "^18.6.
|
|
40
|
+
"@commitlint/config-conventional": "^18.6.2",
|
|
41
41
|
"@types/chai": "^4.3.11",
|
|
42
42
|
"@types/chai-as-promised": "^7.1.8",
|
|
43
43
|
"@types/mocha": "^10.0.6",
|
|
@@ -167,12 +167,7 @@ export class ModelDataValidator extends Service {
|
|
|
167
167
|
* @param {*} propValue
|
|
168
168
|
* @returns {Promise<void>}
|
|
169
169
|
*/
|
|
170
|
-
async _validateByPropertyValidators(
|
|
171
|
-
modelName,
|
|
172
|
-
propName,
|
|
173
|
-
propDef,
|
|
174
|
-
propValue,
|
|
175
|
-
) {
|
|
170
|
+
async _validateByPropertyValidators(modelName, propName, propDef, propValue) {
|
|
176
171
|
if (typeof propDef === 'string' || propDef.validate == null) return;
|
|
177
172
|
const options = propDef.validate;
|
|
178
173
|
const propertyValidatorRegistry = this.getService(
|
|
@@ -1958,8 +1958,10 @@ describe('ModelDataValidator', function () {
|
|
|
1958
1958
|
describe('the option "validate" with the string value', function () {
|
|
1959
1959
|
it('do not validate null and undefined values', async function () {
|
|
1960
1960
|
const S = new Schema();
|
|
1961
|
-
S.getService(PropertyValidatorRegistry)
|
|
1962
|
-
|
|
1961
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
1962
|
+
'validator',
|
|
1963
|
+
() => false,
|
|
1964
|
+
);
|
|
1963
1965
|
S.defineModel({
|
|
1964
1966
|
name: 'model',
|
|
1965
1967
|
properties: {
|
|
@@ -1986,10 +1988,12 @@ describe('ModelDataValidator', function () {
|
|
|
1986
1988
|
it('throws an error from the validator', async function () {
|
|
1987
1989
|
const validator = function () {
|
|
1988
1990
|
throw Error('My error');
|
|
1989
|
-
}
|
|
1991
|
+
};
|
|
1990
1992
|
const S = new Schema();
|
|
1991
|
-
S.getService(PropertyValidatorRegistry)
|
|
1992
|
-
|
|
1993
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
1994
|
+
'validator',
|
|
1995
|
+
validator,
|
|
1996
|
+
);
|
|
1993
1997
|
S.defineModel({
|
|
1994
1998
|
name: 'model',
|
|
1995
1999
|
properties: {
|
|
@@ -2007,8 +2011,10 @@ describe('ModelDataValidator', function () {
|
|
|
2007
2011
|
|
|
2008
2012
|
it('allows the given value if the validator returns true', async function () {
|
|
2009
2013
|
const S = new Schema();
|
|
2010
|
-
S.getService(PropertyValidatorRegistry)
|
|
2011
|
-
|
|
2014
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2015
|
+
'validator',
|
|
2016
|
+
() => true,
|
|
2017
|
+
);
|
|
2012
2018
|
S.defineModel({
|
|
2013
2019
|
name: 'model',
|
|
2014
2020
|
properties: {
|
|
@@ -2025,8 +2031,10 @@ describe('ModelDataValidator', function () {
|
|
|
2025
2031
|
|
|
2026
2032
|
it('allows the given value if the validator returns a promise of true', async function () {
|
|
2027
2033
|
const S = new Schema();
|
|
2028
|
-
S.getService(PropertyValidatorRegistry)
|
|
2029
|
-
|
|
2034
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2035
|
+
'validator',
|
|
2036
|
+
() => Promise.resolve(true),
|
|
2037
|
+
);
|
|
2030
2038
|
S.defineModel({
|
|
2031
2039
|
name: 'model',
|
|
2032
2040
|
properties: {
|
|
@@ -2042,10 +2050,12 @@ describe('ModelDataValidator', function () {
|
|
|
2042
2050
|
});
|
|
2043
2051
|
|
|
2044
2052
|
it('throws an error for non-true result from the validator', async function () {
|
|
2045
|
-
const testFn = async
|
|
2053
|
+
const testFn = async v => {
|
|
2046
2054
|
const S = new Schema();
|
|
2047
|
-
S.getService(PropertyValidatorRegistry)
|
|
2048
|
-
|
|
2055
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2056
|
+
'validator',
|
|
2057
|
+
() => v,
|
|
2058
|
+
);
|
|
2049
2059
|
S.defineModel({
|
|
2050
2060
|
name: 'model',
|
|
2051
2061
|
properties: {
|
|
@@ -2055,13 +2065,14 @@ describe('ModelDataValidator', function () {
|
|
|
2055
2065
|
},
|
|
2056
2066
|
},
|
|
2057
2067
|
});
|
|
2058
|
-
const promise = S.getService(ModelDataValidator)
|
|
2059
|
-
|
|
2068
|
+
const promise = S.getService(ModelDataValidator).validate('model', {
|
|
2069
|
+
foo: 'test',
|
|
2070
|
+
});
|
|
2060
2071
|
return expect(promise).to.be.rejectedWith(
|
|
2061
2072
|
'The property "foo" of the model "model" has an invalid value "test" ' +
|
|
2062
|
-
|
|
2073
|
+
'that caught by the validator "validator".',
|
|
2063
2074
|
);
|
|
2064
|
-
}
|
|
2075
|
+
};
|
|
2065
2076
|
await testFn('str');
|
|
2066
2077
|
await testFn('');
|
|
2067
2078
|
await testFn(10);
|
|
@@ -2092,9 +2103,11 @@ describe('ModelDataValidator', function () {
|
|
|
2092
2103
|
});
|
|
2093
2104
|
validated = true;
|
|
2094
2105
|
return true;
|
|
2095
|
-
}
|
|
2096
|
-
S.getService(PropertyValidatorRegistry)
|
|
2097
|
-
|
|
2106
|
+
};
|
|
2107
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2108
|
+
'validator',
|
|
2109
|
+
validator,
|
|
2110
|
+
);
|
|
2098
2111
|
S.defineModel({
|
|
2099
2112
|
name: 'model',
|
|
2100
2113
|
properties: {
|
|
@@ -2115,10 +2128,12 @@ describe('ModelDataValidator', function () {
|
|
|
2115
2128
|
const validator = function () {
|
|
2116
2129
|
invoked++;
|
|
2117
2130
|
return true;
|
|
2118
|
-
}
|
|
2131
|
+
};
|
|
2119
2132
|
const S = new Schema();
|
|
2120
|
-
S.getService(PropertyValidatorRegistry)
|
|
2121
|
-
|
|
2133
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2134
|
+
'validator',
|
|
2135
|
+
validator,
|
|
2136
|
+
);
|
|
2122
2137
|
S.defineModel({
|
|
2123
2138
|
name: 'model',
|
|
2124
2139
|
properties: {
|
|
@@ -2140,10 +2155,12 @@ describe('ModelDataValidator', function () {
|
|
|
2140
2155
|
return new Promise((resolve, reject) => {
|
|
2141
2156
|
setTimeout(() => reject(error), 5);
|
|
2142
2157
|
});
|
|
2143
|
-
}
|
|
2158
|
+
};
|
|
2144
2159
|
const S = new Schema();
|
|
2145
|
-
S.getService(PropertyValidatorRegistry)
|
|
2146
|
-
|
|
2160
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2161
|
+
'validator',
|
|
2162
|
+
validator,
|
|
2163
|
+
);
|
|
2147
2164
|
S.defineModel({
|
|
2148
2165
|
name: 'model',
|
|
2149
2166
|
properties: {
|
|
@@ -2179,8 +2196,10 @@ describe('ModelDataValidator', function () {
|
|
|
2179
2196
|
|
|
2180
2197
|
it('do not validate null and undefined values', async function () {
|
|
2181
2198
|
const S = new Schema();
|
|
2182
|
-
S.getService(PropertyValidatorRegistry)
|
|
2183
|
-
|
|
2199
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2200
|
+
'validator',
|
|
2201
|
+
() => false,
|
|
2202
|
+
);
|
|
2184
2203
|
S.defineModel({
|
|
2185
2204
|
name: 'model',
|
|
2186
2205
|
properties: {
|
|
@@ -2207,10 +2226,12 @@ describe('ModelDataValidator', function () {
|
|
|
2207
2226
|
it('throws an error from the validator', async function () {
|
|
2208
2227
|
const validator = function () {
|
|
2209
2228
|
throw Error('My error');
|
|
2210
|
-
}
|
|
2229
|
+
};
|
|
2211
2230
|
const S = new Schema();
|
|
2212
|
-
S.getService(PropertyValidatorRegistry)
|
|
2213
|
-
|
|
2231
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2232
|
+
'validator',
|
|
2233
|
+
validator,
|
|
2234
|
+
);
|
|
2214
2235
|
S.defineModel({
|
|
2215
2236
|
name: 'model',
|
|
2216
2237
|
properties: {
|
|
@@ -2284,9 +2305,9 @@ describe('ModelDataValidator', function () {
|
|
|
2284
2305
|
});
|
|
2285
2306
|
return expect(promise).to.be.rejectedWith(
|
|
2286
2307
|
'The property "foo" of the model "model" has an invalid value "test" ' +
|
|
2287
|
-
|
|
2308
|
+
'that caught by the validator "validator2".',
|
|
2288
2309
|
);
|
|
2289
|
-
}
|
|
2310
|
+
};
|
|
2290
2311
|
await testFn('str');
|
|
2291
2312
|
await testFn('');
|
|
2292
2313
|
await testFn(10);
|
|
@@ -2317,9 +2338,11 @@ describe('ModelDataValidator', function () {
|
|
|
2317
2338
|
});
|
|
2318
2339
|
validated = true;
|
|
2319
2340
|
return true;
|
|
2320
|
-
}
|
|
2321
|
-
S.getService(PropertyValidatorRegistry)
|
|
2322
|
-
|
|
2341
|
+
};
|
|
2342
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2343
|
+
'validator',
|
|
2344
|
+
validator,
|
|
2345
|
+
);
|
|
2323
2346
|
S.defineModel({
|
|
2324
2347
|
name: 'model',
|
|
2325
2348
|
properties: {
|
|
@@ -2340,11 +2363,11 @@ describe('ModelDataValidator', function () {
|
|
|
2340
2363
|
const validator1 = function () {
|
|
2341
2364
|
invocation.push('validator1');
|
|
2342
2365
|
return true;
|
|
2343
|
-
}
|
|
2366
|
+
};
|
|
2344
2367
|
const validator2 = function () {
|
|
2345
2368
|
invocation.push('validator2');
|
|
2346
2369
|
return true;
|
|
2347
|
-
}
|
|
2370
|
+
};
|
|
2348
2371
|
const S = new Schema();
|
|
2349
2372
|
S.getService(PropertyValidatorRegistry)
|
|
2350
2373
|
.addValidator('validator1', validator1)
|
|
@@ -2367,12 +2390,14 @@ describe('ModelDataValidator', function () {
|
|
|
2367
2390
|
it('waits rejection from one of async validators', async function () {
|
|
2368
2391
|
const error1 = new Error('Occurs after 15 ms');
|
|
2369
2392
|
const error2 = new Error('Occurs after 5 ms');
|
|
2370
|
-
const validator1 = () =>
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2393
|
+
const validator1 = () =>
|
|
2394
|
+
new Promise((res, rej) => {
|
|
2395
|
+
setTimeout(() => rej(error1), 15);
|
|
2396
|
+
});
|
|
2397
|
+
const validator2 = () =>
|
|
2398
|
+
new Promise((res, rej) => {
|
|
2399
|
+
setTimeout(() => rej(error2), 5);
|
|
2400
|
+
});
|
|
2376
2401
|
const S = new Schema();
|
|
2377
2402
|
S.getService(PropertyValidatorRegistry)
|
|
2378
2403
|
.addValidator('validator1', validator1)
|
|
@@ -2382,10 +2407,7 @@ describe('ModelDataValidator', function () {
|
|
|
2382
2407
|
properties: {
|
|
2383
2408
|
foo: {
|
|
2384
2409
|
type: DataType.ANY,
|
|
2385
|
-
validate: [
|
|
2386
|
-
'validator1',
|
|
2387
|
-
'validator2',
|
|
2388
|
-
],
|
|
2410
|
+
validate: ['validator1', 'validator2'],
|
|
2389
2411
|
},
|
|
2390
2412
|
},
|
|
2391
2413
|
});
|
|
@@ -2415,8 +2437,10 @@ describe('ModelDataValidator', function () {
|
|
|
2415
2437
|
|
|
2416
2438
|
it('do not validate null and undefined values', async function () {
|
|
2417
2439
|
const S = new Schema();
|
|
2418
|
-
S.getService(PropertyValidatorRegistry)
|
|
2419
|
-
|
|
2440
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2441
|
+
'validator',
|
|
2442
|
+
() => false,
|
|
2443
|
+
);
|
|
2420
2444
|
S.defineModel({
|
|
2421
2445
|
name: 'model',
|
|
2422
2446
|
properties: {
|
|
@@ -2449,10 +2473,12 @@ describe('ModelDataValidator', function () {
|
|
|
2449
2473
|
it('throws an error from the validator', async function () {
|
|
2450
2474
|
const validator = function () {
|
|
2451
2475
|
throw Error('My error');
|
|
2452
|
-
}
|
|
2476
|
+
};
|
|
2453
2477
|
const S = new Schema();
|
|
2454
|
-
S.getService(PropertyValidatorRegistry)
|
|
2455
|
-
|
|
2478
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2479
|
+
'validator',
|
|
2480
|
+
validator,
|
|
2481
|
+
);
|
|
2456
2482
|
S.defineModel({
|
|
2457
2483
|
name: 'model',
|
|
2458
2484
|
properties: {
|
|
@@ -2537,9 +2563,9 @@ describe('ModelDataValidator', function () {
|
|
|
2537
2563
|
});
|
|
2538
2564
|
return expect(promise).to.be.rejectedWith(
|
|
2539
2565
|
'The property "foo" of the model "model" has an invalid value "test" ' +
|
|
2540
|
-
|
|
2566
|
+
'that caught by the validator "validator2".',
|
|
2541
2567
|
);
|
|
2542
|
-
}
|
|
2568
|
+
};
|
|
2543
2569
|
await testFn('str');
|
|
2544
2570
|
await testFn('');
|
|
2545
2571
|
await testFn(10);
|
|
@@ -2578,9 +2604,11 @@ describe('ModelDataValidator', function () {
|
|
|
2578
2604
|
});
|
|
2579
2605
|
validated = true;
|
|
2580
2606
|
return true;
|
|
2581
|
-
}
|
|
2582
|
-
S.getService(PropertyValidatorRegistry)
|
|
2583
|
-
|
|
2607
|
+
};
|
|
2608
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2609
|
+
'validator',
|
|
2610
|
+
validator,
|
|
2611
|
+
);
|
|
2584
2612
|
S.defineModel({
|
|
2585
2613
|
name: 'model',
|
|
2586
2614
|
properties: {
|
|
@@ -2606,11 +2634,11 @@ describe('ModelDataValidator', function () {
|
|
|
2606
2634
|
const validator1 = function () {
|
|
2607
2635
|
invocation.push('validator1');
|
|
2608
2636
|
return true;
|
|
2609
|
-
}
|
|
2637
|
+
};
|
|
2610
2638
|
const validator2 = function () {
|
|
2611
2639
|
invocation.push('validator2');
|
|
2612
2640
|
return true;
|
|
2613
|
-
}
|
|
2641
|
+
};
|
|
2614
2642
|
const S = new Schema();
|
|
2615
2643
|
S.getService(PropertyValidatorRegistry)
|
|
2616
2644
|
.addValidator('validator1', validator1)
|
|
@@ -2638,10 +2666,12 @@ describe('ModelDataValidator', function () {
|
|
|
2638
2666
|
const validator = function () {
|
|
2639
2667
|
validated = true;
|
|
2640
2668
|
return true;
|
|
2641
|
-
}
|
|
2669
|
+
};
|
|
2642
2670
|
const S = new Schema();
|
|
2643
|
-
S.getService(PropertyValidatorRegistry)
|
|
2644
|
-
|
|
2671
|
+
S.getService(PropertyValidatorRegistry).addValidator(
|
|
2672
|
+
'validator',
|
|
2673
|
+
validator,
|
|
2674
|
+
);
|
|
2645
2675
|
S.defineModel({
|
|
2646
2676
|
name: 'model',
|
|
2647
2677
|
properties: {
|
|
@@ -2662,12 +2692,14 @@ describe('ModelDataValidator', function () {
|
|
|
2662
2692
|
it('waits rejection from one of async validators', async function () {
|
|
2663
2693
|
const error1 = new Error('Occurs after 15 ms');
|
|
2664
2694
|
const error2 = new Error('Occurs after 5 ms');
|
|
2665
|
-
const validator1 = () =>
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2695
|
+
const validator1 = () =>
|
|
2696
|
+
new Promise((res, rej) => {
|
|
2697
|
+
setTimeout(() => rej(error1), 15);
|
|
2698
|
+
});
|
|
2699
|
+
const validator2 = () =>
|
|
2700
|
+
new Promise((res, rej) => {
|
|
2701
|
+
setTimeout(() => rej(error2), 5);
|
|
2702
|
+
});
|
|
2671
2703
|
const S = new Schema();
|
|
2672
2704
|
S.getService(PropertyValidatorRegistry)
|
|
2673
2705
|
.addValidator('validator1', validator1)
|
|
@@ -2680,7 +2712,7 @@ describe('ModelDataValidator', function () {
|
|
|
2680
2712
|
validate: {
|
|
2681
2713
|
validator1: true,
|
|
2682
2714
|
validator2: true,
|
|
2683
|
-
}
|
|
2715
|
+
},
|
|
2684
2716
|
},
|
|
2685
2717
|
},
|
|
2686
2718
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {InvalidArgumentError} from '../../../../../errors/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Max length validator.
|
|
5
|
+
*
|
|
6
|
+
* @param {*} value
|
|
7
|
+
* @param {number|boolean} options
|
|
8
|
+
* @param {object} context
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export function maxLengthValidator(value, options, context) {
|
|
12
|
+
if (options === false) return true;
|
|
13
|
+
if (typeof options !== 'number')
|
|
14
|
+
throw new InvalidArgumentError(
|
|
15
|
+
'The validator %v requires the "options" argument ' +
|
|
16
|
+
'as a Number, but %v given.',
|
|
17
|
+
context.validatorName,
|
|
18
|
+
options,
|
|
19
|
+
);
|
|
20
|
+
if (typeof value === 'string' || Array.isArray(value))
|
|
21
|
+
return value.length <= options;
|
|
22
|
+
throw new InvalidArgumentError(
|
|
23
|
+
'The property validator %v requires a String ' +
|
|
24
|
+
'or an Array value, but %v given.',
|
|
25
|
+
context.validatorName,
|
|
26
|
+
value,
|
|
27
|
+
);
|
|
28
|
+
}
|
package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {format} from '@e22m4u/js-format';
|
|
3
|
+
import {maxLengthValidator} from './max-length-validator.js';
|
|
4
|
+
|
|
5
|
+
describe('maxLengthValidator', function () {
|
|
6
|
+
it('returns true by the false value in options', function () {
|
|
7
|
+
const res = maxLengthValidator(undefined, false, {});
|
|
8
|
+
expect(res).to.be.true;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('requires the "options" argument to be a number', function () {
|
|
12
|
+
const throwable = v => () =>
|
|
13
|
+
maxLengthValidator('test', v, {
|
|
14
|
+
validatorName: 'myValidator',
|
|
15
|
+
});
|
|
16
|
+
const error = v =>
|
|
17
|
+
format(
|
|
18
|
+
'The validator "myValidator" requires the "options" argument ' +
|
|
19
|
+
'as a Number, but %s given.',
|
|
20
|
+
v,
|
|
21
|
+
);
|
|
22
|
+
expect(throwable('str')).to.throw(error('"str"'));
|
|
23
|
+
expect(throwable('')).to.throw(error('""'));
|
|
24
|
+
expect(throwable(true)).to.throw(error('true'));
|
|
25
|
+
expect(throwable(undefined)).to.throw(error('undefined'));
|
|
26
|
+
expect(throwable(null)).to.throw(error('null'));
|
|
27
|
+
expect(throwable({})).to.throw(error('Object'));
|
|
28
|
+
expect(throwable([])).to.throw(error('Array'));
|
|
29
|
+
expect(throwable(() => undefined)).to.throw(error('Function'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('a string value', function () {
|
|
33
|
+
it('returns false if the value length is greater than the max length option', function () {
|
|
34
|
+
const res = maxLengthValidator('1234', 3, {});
|
|
35
|
+
expect(res).to.be.false;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('returns true if the value length is equal to the max length option', function () {
|
|
39
|
+
const res = maxLengthValidator('123', 3, {});
|
|
40
|
+
expect(res).to.be.true;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('returns true if the value length is lower than the max length option', function () {
|
|
44
|
+
const res = maxLengthValidator('12', 3, {});
|
|
45
|
+
expect(res).to.be.true;
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('an array value', function () {
|
|
50
|
+
it('returns false if the value length is greater than the max length option', function () {
|
|
51
|
+
const res = maxLengthValidator([1, 2, 3, 4], 3, {});
|
|
52
|
+
expect(res).to.be.false;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('returns true if the value length is equal to the max length option', function () {
|
|
56
|
+
const res = maxLengthValidator([1, 2, 3], 3, {});
|
|
57
|
+
expect(res).to.be.true;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('returns true if the value length is lower than the max length option', function () {
|
|
61
|
+
const res = maxLengthValidator([1, 2], 3, {});
|
|
62
|
+
expect(res).to.be.true;
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|