@mica-js/document 0.4.0 → 0.5.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.
- package/dist/fused/index.d.ts +4 -2
- package/dist/fused/index.js +20 -1
- package/dist/fused/index.js.map +1 -1
- package/package.json +1 -1
package/dist/fused/index.d.ts
CHANGED
|
@@ -79,8 +79,10 @@ export declare interface DevicePropertyDescriptor {
|
|
|
79
79
|
readonly alpha?: boolean;
|
|
80
80
|
/** `enum`: non-empty option list. */
|
|
81
81
|
readonly options?: readonly PropertyOption[];
|
|
82
|
-
/** `image` / `binary` / `firmware`: host-side payload limit in bytes. */
|
|
82
|
+
/** `image` / `binary` / `disk` / `firmware`: host-side payload limit in bytes. */
|
|
83
83
|
readonly maxBytes?: number;
|
|
84
|
+
/** `disk`: access to the session image, defaulting to read-only. */
|
|
85
|
+
readonly access?: 'read-only' | 'read-write';
|
|
84
86
|
/** `image`: host-side pixel limit. */
|
|
85
87
|
readonly maxPixels?: number;
|
|
86
88
|
/** `binary`: file extension filter, each entry matching `\.[A-Za-z0-9]+`. */
|
|
@@ -98,7 +100,7 @@ export declare interface DevicePropertyDescriptor {
|
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/** Predefined property value kinds of a device property description (RFC 0009 / RFC 0020). */
|
|
101
|
-
export declare type DevicePropertyType = 'string' | 'integer' | 'number' | 'boolean' | 'color' | 'enum' | 'image' | 'binary' | 'firmware' | 'program';
|
|
103
|
+
export declare type DevicePropertyType = 'string' | 'integer' | 'number' | 'boolean' | 'color' | 'enum' | 'image' | 'binary' | 'disk' | 'firmware' | 'program';
|
|
102
104
|
|
|
103
105
|
/** Selects available releases and opens exact locks (RFC 0020). */
|
|
104
106
|
export declare interface DeviceRegistry {
|
package/dist/fused/index.js
CHANGED
|
@@ -709,6 +709,7 @@ var PROPERTY_TYPES = [
|
|
|
709
709
|
"enum",
|
|
710
710
|
"image",
|
|
711
711
|
"binary",
|
|
712
|
+
"disk",
|
|
712
713
|
"firmware",
|
|
713
714
|
"program"
|
|
714
715
|
];
|
|
@@ -750,6 +751,11 @@ var TYPE_FIELDS = {
|
|
|
750
751
|
"maxBytes",
|
|
751
752
|
"extensions"
|
|
752
753
|
],
|
|
754
|
+
disk: [
|
|
755
|
+
...COMMON_FIELDS,
|
|
756
|
+
"maxBytes",
|
|
757
|
+
"access"
|
|
758
|
+
],
|
|
753
759
|
firmware: [
|
|
754
760
|
...COMMON_FIELDS,
|
|
755
761
|
"maxBytes",
|
|
@@ -851,10 +857,22 @@ function readPropertyDescriptor(value, path, diagnostics) {
|
|
|
851
857
|
}
|
|
852
858
|
case "image":
|
|
853
859
|
case "binary":
|
|
860
|
+
case "disk":
|
|
854
861
|
case "firmware": {
|
|
855
862
|
const maxBytes = readCount(value, "maxBytes", path, diagnostics);
|
|
856
863
|
if (maxBytes === "invalid") failed = true;
|
|
857
|
-
else if (
|
|
864
|
+
else if (type === "disk" && maxBytes === 0) {
|
|
865
|
+
report(diagnostics, "package/invalid-manifest", "maxBytes must be positive.", [...path, "maxBytes"]);
|
|
866
|
+
failed = true;
|
|
867
|
+
} else if (maxBytes !== void 0) draft.maxBytes = maxBytes;
|
|
868
|
+
if (type === "disk" && hasOwn(value, "access")) {
|
|
869
|
+
const access = value["access"];
|
|
870
|
+
if (access === "read-only" || access === "read-write") draft.access = access;
|
|
871
|
+
else {
|
|
872
|
+
report(diagnostics, "package/invalid-manifest", "Invalid disk access mode.", [...path, "access"]);
|
|
873
|
+
failed = true;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
858
876
|
if (type === "image") {
|
|
859
877
|
const maxPixels = readCount(value, "maxPixels", path, diagnostics);
|
|
860
878
|
if (maxPixels === "invalid") failed = true;
|
|
@@ -1175,6 +1193,7 @@ function checkDefault(value, descriptor, path, diagnostics) {
|
|
|
1175
1193
|
const allowed = (descriptor.options ?? []).map((option) => option.value);
|
|
1176
1194
|
return typeof value === "string" && allowed.includes(value) ? { value } : fail(`Default must be one of ${allowed.map((entry) => JSON.stringify(entry)).join(", ")}.`);
|
|
1177
1195
|
}
|
|
1196
|
+
case "disk": return fail("A disk default must be null. Bind an asset on the instance.");
|
|
1178
1197
|
case "image":
|
|
1179
1198
|
case "binary": {
|
|
1180
1199
|
const reference = checkPackageReference(value, path, diagnostics);
|