@xyo-network/schema-name-validator
Advanced tools
Comparing version
@@ -1,10 +0,4 @@ | ||
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
// src/SchemaNameValidator.ts | ||
import { domainExists } from "@xyo-network/dns"; | ||
var SchemaNameValidator = class { | ||
static { | ||
__name(this, "SchemaNameValidator"); | ||
} | ||
schema; | ||
@@ -17,6 +11,6 @@ _parts; | ||
/** | ||
* Checks whether the schema is all lowercase | ||
* | ||
* @returns boolean | ||
*/ | ||
* Checks whether the schema is all lowercase | ||
* | ||
* @returns boolean | ||
*/ | ||
get isLowercase() { | ||
@@ -26,6 +20,6 @@ return this.schema === this.schema?.toLowerCase(); | ||
/** | ||
* Levels in the schema | ||
* | ||
* @returns number | ||
*/ | ||
* Levels in the schema | ||
* | ||
* @returns number | ||
*/ | ||
get levels() { | ||
@@ -35,6 +29,6 @@ return this.parts?.length; | ||
/** | ||
* The schema converted into a string array split on '.' | ||
* | ||
* @returns string[] | ||
*/ | ||
* The schema converted into a string array split on '.' | ||
* | ||
* @returns string[] | ||
*/ | ||
get parts() { | ||
@@ -45,8 +39,8 @@ this._parts = this._parts ?? this.schema?.split("."); | ||
/** | ||
* The rootDomain is the first two levels of the schema, in reverse order | ||
* This can be used to determine who 'owns' that schema, based on domain | ||
* registration | ||
* | ||
* @returns string | ||
*/ | ||
* The rootDomain is the first two levels of the schema, in reverse order | ||
* This can be used to determine who 'owns' that schema, based on domain | ||
* registration | ||
* | ||
* @returns string | ||
*/ | ||
get rootDomain() { | ||
@@ -57,5 +51,5 @@ this._rootDomain = this._rootDomain ?? this.domainLevel(1); | ||
/** | ||
* Run all static validations | ||
* @returns Error[] | ||
*/ | ||
* Run all static validations | ||
* @returns Error[] | ||
*/ | ||
all() { | ||
@@ -69,6 +63,6 @@ const errors = []; | ||
/** | ||
* Run all the validations | ||
* @param checkExistence - boolean | ||
* @returns Error[] | ||
*/ | ||
* Run all the validations | ||
* @param checkExistence - boolean | ||
* @returns Error[] | ||
*/ | ||
async allDynamic() { | ||
@@ -81,7 +75,7 @@ const errors = []; | ||
/** | ||
* Determines how many levels of the schema's reverse domain | ||
* pass DNS resolution | ||
* | ||
* @returns number (0 if none exist) | ||
*/ | ||
* Determines how many levels of the schema's reverse domain | ||
* pass DNS resolution | ||
* | ||
* @returns number (0 if none exist) | ||
*/ | ||
async domainExistenceDepth() { | ||
@@ -99,6 +93,6 @@ const levels = this.levels ?? 0; | ||
/** | ||
* Checks if the root domain validates via DNS resolution | ||
* | ||
* @returns boolean | ||
*/ | ||
* Checks if the root domain validates via DNS resolution | ||
* | ||
* @returns boolean | ||
*/ | ||
async rootDomainExists() { | ||
@@ -108,8 +102,8 @@ return await domainExists(this.rootDomain); | ||
/** | ||
* | ||
* Get a domain for the schema at a certain level | ||
* | ||
* @param level - Zero based level to check | ||
* @returns string | ||
*/ | ||
* | ||
* Get a domain for the schema at a certain level | ||
* | ||
* @param level - Zero based level to check | ||
* @returns string | ||
*/ | ||
domainLevel(level) { | ||
@@ -116,0 +110,0 @@ return this.parts?.slice(0, level + 1).reverse().join("."); |
@@ -1,10 +0,4 @@ | ||
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
// src/SchemaNameValidator.ts | ||
import { domainExists } from "@xyo-network/dns"; | ||
var SchemaNameValidator = class { | ||
static { | ||
__name(this, "SchemaNameValidator"); | ||
} | ||
schema; | ||
@@ -17,6 +11,6 @@ _parts; | ||
/** | ||
* Checks whether the schema is all lowercase | ||
* | ||
* @returns boolean | ||
*/ | ||
* Checks whether the schema is all lowercase | ||
* | ||
* @returns boolean | ||
*/ | ||
get isLowercase() { | ||
@@ -26,6 +20,6 @@ return this.schema === this.schema?.toLowerCase(); | ||
/** | ||
* Levels in the schema | ||
* | ||
* @returns number | ||
*/ | ||
* Levels in the schema | ||
* | ||
* @returns number | ||
*/ | ||
get levels() { | ||
@@ -35,6 +29,6 @@ return this.parts?.length; | ||
/** | ||
* The schema converted into a string array split on '.' | ||
* | ||
* @returns string[] | ||
*/ | ||
* The schema converted into a string array split on '.' | ||
* | ||
* @returns string[] | ||
*/ | ||
get parts() { | ||
@@ -45,8 +39,8 @@ this._parts = this._parts ?? this.schema?.split("."); | ||
/** | ||
* The rootDomain is the first two levels of the schema, in reverse order | ||
* This can be used to determine who 'owns' that schema, based on domain | ||
* registration | ||
* | ||
* @returns string | ||
*/ | ||
* The rootDomain is the first two levels of the schema, in reverse order | ||
* This can be used to determine who 'owns' that schema, based on domain | ||
* registration | ||
* | ||
* @returns string | ||
*/ | ||
get rootDomain() { | ||
@@ -57,5 +51,5 @@ this._rootDomain = this._rootDomain ?? this.domainLevel(1); | ||
/** | ||
* Run all static validations | ||
* @returns Error[] | ||
*/ | ||
* Run all static validations | ||
* @returns Error[] | ||
*/ | ||
all() { | ||
@@ -69,6 +63,6 @@ const errors = []; | ||
/** | ||
* Run all the validations | ||
* @param checkExistence - boolean | ||
* @returns Error[] | ||
*/ | ||
* Run all the validations | ||
* @param checkExistence - boolean | ||
* @returns Error[] | ||
*/ | ||
async allDynamic() { | ||
@@ -81,7 +75,7 @@ const errors = []; | ||
/** | ||
* Determines how many levels of the schema's reverse domain | ||
* pass DNS resolution | ||
* | ||
* @returns number (0 if none exist) | ||
*/ | ||
* Determines how many levels of the schema's reverse domain | ||
* pass DNS resolution | ||
* | ||
* @returns number (0 if none exist) | ||
*/ | ||
async domainExistenceDepth() { | ||
@@ -99,6 +93,6 @@ const levels = this.levels ?? 0; | ||
/** | ||
* Checks if the root domain validates via DNS resolution | ||
* | ||
* @returns boolean | ||
*/ | ||
* Checks if the root domain validates via DNS resolution | ||
* | ||
* @returns boolean | ||
*/ | ||
async rootDomainExists() { | ||
@@ -108,8 +102,8 @@ return await domainExists(this.rootDomain); | ||
/** | ||
* | ||
* Get a domain for the schema at a certain level | ||
* | ||
* @param level - Zero based level to check | ||
* @returns string | ||
*/ | ||
* | ||
* Get a domain for the schema at a certain level | ||
* | ||
* @param level - Zero based level to check | ||
* @returns string | ||
*/ | ||
domainLevel(level) { | ||
@@ -116,0 +110,0 @@ return this.parts?.slice(0, level + 1).reverse().join("."); |
@@ -1,7 +0,4 @@ | ||
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
// src/SchemaNameValidator.ts | ||
import { domainExists } from "@xyo-network/dns"; | ||
var _SchemaNameValidator = class _SchemaNameValidator { | ||
var SchemaNameValidator = class { | ||
schema; | ||
@@ -14,6 +11,6 @@ _parts; | ||
/** | ||
* Checks whether the schema is all lowercase | ||
* | ||
* @returns boolean | ||
*/ | ||
* Checks whether the schema is all lowercase | ||
* | ||
* @returns boolean | ||
*/ | ||
get isLowercase() { | ||
@@ -24,6 +21,6 @@ var _a; | ||
/** | ||
* Levels in the schema | ||
* | ||
* @returns number | ||
*/ | ||
* Levels in the schema | ||
* | ||
* @returns number | ||
*/ | ||
get levels() { | ||
@@ -34,6 +31,6 @@ var _a; | ||
/** | ||
* The schema converted into a string array split on '.' | ||
* | ||
* @returns string[] | ||
*/ | ||
* The schema converted into a string array split on '.' | ||
* | ||
* @returns string[] | ||
*/ | ||
get parts() { | ||
@@ -45,8 +42,8 @@ var _a; | ||
/** | ||
* The rootDomain is the first two levels of the schema, in reverse order | ||
* This can be used to determine who 'owns' that schema, based on domain | ||
* registration | ||
* | ||
* @returns string | ||
*/ | ||
* The rootDomain is the first two levels of the schema, in reverse order | ||
* This can be used to determine who 'owns' that schema, based on domain | ||
* registration | ||
* | ||
* @returns string | ||
*/ | ||
get rootDomain() { | ||
@@ -57,5 +54,5 @@ this._rootDomain = this._rootDomain ?? this.domainLevel(1); | ||
/** | ||
* Run all static validations | ||
* @returns Error[] | ||
*/ | ||
* Run all static validations | ||
* @returns Error[] | ||
*/ | ||
all() { | ||
@@ -70,6 +67,6 @@ var _a; | ||
/** | ||
* Run all the validations | ||
* @param checkExistence - boolean | ||
* @returns Error[] | ||
*/ | ||
* Run all the validations | ||
* @param checkExistence - boolean | ||
* @returns Error[] | ||
*/ | ||
async allDynamic() { | ||
@@ -83,7 +80,7 @@ var _a; | ||
/** | ||
* Determines how many levels of the schema's reverse domain | ||
* pass DNS resolution | ||
* | ||
* @returns number (0 if none exist) | ||
*/ | ||
* Determines how many levels of the schema's reverse domain | ||
* pass DNS resolution | ||
* | ||
* @returns number (0 if none exist) | ||
*/ | ||
async domainExistenceDepth() { | ||
@@ -101,6 +98,6 @@ const levels = this.levels ?? 0; | ||
/** | ||
* Checks if the root domain validates via DNS resolution | ||
* | ||
* @returns boolean | ||
*/ | ||
* Checks if the root domain validates via DNS resolution | ||
* | ||
* @returns boolean | ||
*/ | ||
async rootDomainExists() { | ||
@@ -110,8 +107,8 @@ return await domainExists(this.rootDomain); | ||
/** | ||
* | ||
* Get a domain for the schema at a certain level | ||
* | ||
* @param level - Zero based level to check | ||
* @returns string | ||
*/ | ||
* | ||
* Get a domain for the schema at a certain level | ||
* | ||
* @param level - Zero based level to check | ||
* @returns string | ||
*/ | ||
domainLevel(level) { | ||
@@ -122,4 +119,2 @@ var _a; | ||
}; | ||
__name(_SchemaNameValidator, "SchemaNameValidator"); | ||
var SchemaNameValidator = _SchemaNameValidator; | ||
export { | ||
@@ -126,0 +121,0 @@ SchemaNameValidator |
@@ -13,7 +13,7 @@ { | ||
"dependencies": { | ||
"@xyo-network/dns": "^2.110.10" | ||
"@xyo-network/dns": "^2.110.11" | ||
}, | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^3.12.4", | ||
"@xylabs/tsconfig": "^3.12.4", | ||
"@xylabs/ts-scripts-yarn3": "^3.13.3", | ||
"@xylabs/tsconfig": "^3.13.3", | ||
"typescript": "^5.5.4" | ||
@@ -60,4 +60,4 @@ }, | ||
"sideEffects": false, | ||
"version": "2.110.10", | ||
"version": "2.110.11", | ||
"type": "module" | ||
} |
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
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
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
70661
-1.69%876
-2.77%Updated