@mica-js/document 0.1.0 → 0.3.0

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.
@@ -1,5 +1,6 @@
1
1
  import { c as isAssetReference, i as assetPathError, n as throwIfErrors, o as base64Error, r as ASSET_MODES, s as isAssetMode, t as SchematicError } from "../errors-7cnIjhnV.js";
2
- import { a as readArrayField, c as readObjectField, d as readStringField, f as report, h as parseInput, i as isRecord, l as readPoint, m as isUuidV4, n as forbidUnknownFields, o as readIntegerField, p as toPointer, r as hasErrors, s as readNumberField, t as checkDuplicateIds, u as readProperties } from "../validate-Cz-ZbbEr.js";
2
+ import { a as readArrayField, c as readObjectField, d as readStringField, f as report, i as isRecord, l as readPoint, m as parseInput, n as forbidUnknownFields, o as readIntegerField, p as toPointer, r as hasErrors, s as readNumberField, t as checkDuplicateIds, u as readProperties } from "../validate-Co8aIzz6.js";
3
+ import { t as isUuidV4 } from "../uuid-DegOw3iI.js";
3
4
  //#region src/format/types.ts
4
5
  /**
5
6
  * Schema version of the `.sch` contract (see x-botlab/mica-js#6).
@@ -2269,6 +2270,18 @@ var editor = (v, p, d) => {
2269
2270
  max: number,
2270
2271
  step: positive
2271
2272
  });
2273
+ if (isRecord(v) && v.kind === "file") {
2274
+ fields.extensions = (value, path, diagnostics) => {
2275
+ strings(value, path, diagnostics);
2276
+ if (Array.isArray(value)) value.forEach((extension, index) => {
2277
+ if (typeof extension === "string" && !/^\.[A-Za-z0-9]+(?:[.-][A-Za-z0-9]+)*$/.test(extension)) fail(`${path}/${index}`, diagnostics, "Expected a dotted filename extension.");
2278
+ });
2279
+ };
2280
+ fields.maxSize = (value, path, diagnostics) => {
2281
+ positive(value, path, diagnostics);
2282
+ if (typeof value === "number" && !Number.isInteger(value)) fail(path, diagnostics, "Expected an integer byte count.");
2283
+ };
2284
+ }
2272
2285
  if (isRecord(v) && v.kind === "select") fields.labels = map(text);
2273
2286
  object(fields, ["kind"])(v, p, d);
2274
2287
  };
@@ -2407,6 +2420,8 @@ var checkMetadata = object({
2407
2420
  description: nonempty,
2408
2421
  license: nonempty,
2409
2422
  tags: strings,
2423
+ templates: strings,
2424
+ recommends: object({ widgets: strings }),
2410
2425
  designatorPrefix: (v, p, d) => {
2411
2426
  if (typeof v !== "string" || !/^\S+$/.test(v)) fail(p, d, "Expected a nonempty prefix without whitespace.");
2412
2427
  },