mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-03 05:07:10 +00:00
Ship OpenFleet contracts and the OpenWall draft proposal (#177)
* feat: add OpenFleet membership and CoinPay rental contracts * Propose OpenWall broadcasts and direct messaging contracts * release: prepare OpenFleet and OpenWall public contracts * fix: use tested npm for compatible CLI installs
This commit is contained in:
parent
a333726a1e
commit
45c7629953
35 changed files with 2021 additions and 12 deletions
|
|
@ -3,6 +3,7 @@ import * as addFormatsModule from "ajv-formats";
|
|||
import type { ErrorObject } from "ajv";
|
||||
import { parse } from "yaml";
|
||||
import { isSchemaKind, schemas, type SchemaKind } from "./schemas.js";
|
||||
import { validateOpenFleetReferences } from "./openfleet.js";
|
||||
|
||||
type CompiledSchema = { (data: unknown): boolean; errors?: ErrorObject[] | null };
|
||||
|
||||
|
|
@ -61,6 +62,10 @@ export function validate(kind: SchemaKind, data: unknown): ValidationResult {
|
|||
const ok = validateDocument(data);
|
||||
|
||||
if (ok) {
|
||||
if (kind === "openfleet") {
|
||||
const errors = validateOpenFleetReferences(data);
|
||||
if (errors.length) return { ok: false, kind, errors };
|
||||
}
|
||||
return { ok: true, kind, data };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue