UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

33 lines (32 loc) • 1.67 kB
import __decorateMetadata from "../../../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.mjs"; import __decorate from "../../../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.mjs"; import { isJsonObject } from "../../../../types.mjs"; import { IsString, ValidateBy, buildMessage, isString } from "class-validator"; //#region src/modules/dids/domain/service/DidDocumentService.ts var DidDocumentService = class { constructor(options) { if (options) { this.id = options.id; this.serviceEndpoint = options.serviceEndpoint; this.type = options.type; } } }; __decorate([IsString(), __decorateMetadata("design:type", String)], DidDocumentService.prototype, "id", void 0); __decorate([IsStringOrJsonObjectSingleOrArray(), __decorateMetadata("design:type", Object)], DidDocumentService.prototype, "serviceEndpoint", void 0); __decorate([IsString(), __decorateMetadata("design:type", String)], DidDocumentService.prototype, "type", void 0); /** * Checks if a given value is a string, a json object, or an array of strings and json objects */ function IsStringOrJsonObjectSingleOrArray(validationOptions) { return ValidateBy({ name: "isStringOrJsonObjectSingleOrArray", validator: { validate: (value) => isString(value) || isJsonObject(value) || Array.isArray(value) && value.every((v) => isString(v) || isJsonObject(v)), defaultMessage: buildMessage((eachPrefix) => `${eachPrefix}$property must be a string, JSON object, or an array consisting of strings and JSON objects`, validationOptions) } }, validationOptions); } //#endregion export { DidDocumentService }; //# sourceMappingURL=DidDocumentService.mjs.map