@valbuild/core 0.143.0 → 0.144.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/CHANGELOG.md +34 -0
- package/dist/declarations/src/index.d.ts +8 -3
- package/dist/declarations/src/initSchema.d.ts +84 -25
- package/dist/declarations/src/initVal.d.ts +2 -2
- package/dist/declarations/src/mimeType/font.d.ts +2 -2
- package/dist/declarations/src/render.d.ts +1 -1
- package/dist/declarations/src/schema/file.d.ts +4 -4
- package/dist/declarations/src/schema/filedir.d.ts +83 -0
- package/dist/declarations/src/schema/font.d.ts +4 -4
- package/dist/declarations/src/schema/fontdir.d.ts +63 -0
- package/dist/declarations/src/schema/hasRemoteFileSchema.d.ts +3 -3
- package/dist/declarations/src/schema/image.d.ts +4 -4
- package/dist/declarations/src/schema/{imageset.d.ts → imagedir.d.ts} +63 -29
- package/dist/declarations/src/schema/record.d.ts +17 -6
- package/dist/declarations/src/schema/video.d.ts +7 -7
- package/dist/declarations/src/schema/{videoset.d.ts → videodir.d.ts} +55 -27
- package/dist/declarations/src/source/media.d.ts +26 -3
- package/dist/{index-46c72f01.cjs.prod.js → index-2d194c90.cjs.prod.js} +336 -91
- package/dist/{index-aac8c69c.cjs.dev.js → index-8b22b2c1.cjs.dev.js} +336 -91
- package/dist/{index-02a1ba06.esm.js → index-aa16dd90.esm.js} +336 -91
- package/dist/valbuild-core.cjs.dev.js +1 -1
- package/dist/valbuild-core.cjs.prod.js +1 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
- package/dist/declarations/src/schema/fileset.d.ts +0 -57
- package/dist/declarations/src/schema/fontset.d.ts +0 -40
|
@@ -2844,7 +2844,7 @@ var _excluded = ["poster", "captions"];
|
|
|
2844
2844
|
* What a video FIELD authors, on top of the file it names: the description,
|
|
2845
2845
|
* the crop, the poster, the trim and the caption tracks.
|
|
2846
2846
|
*
|
|
2847
|
-
* This is the whole value of a field picked from an `s.
|
|
2847
|
+
* This is the whole value of a field picked from an `s.videodir()`
|
|
2848
2848
|
* (`s.video(videosetVal)`) — the mime type, size and length live in the set,
|
|
2849
2849
|
* keyed by `path`, and repeating them here is how two copies of one fact get
|
|
2850
2850
|
* to disagree. The poster, captions and times stay with the FIELD: one video
|
|
@@ -2856,7 +2856,7 @@ var _excluded = ["poster", "captions"];
|
|
|
2856
2856
|
/**
|
|
2857
2857
|
* What one page chooses about a video — as opposed to what is true of the
|
|
2858
2858
|
* file. A field (`s.video()`) carries these for itself; the entry of a set
|
|
2859
|
-
* (`s.
|
|
2859
|
+
* (`s.videodir()`) carries them as DEFAULTS, which every field picked from the
|
|
2860
2860
|
* set starts from and may override key by key. See {@link fillFromGallery}.
|
|
2861
2861
|
*/
|
|
2862
2862
|
|
|
@@ -2998,6 +2998,42 @@ function isMediaSchema(schema) {
|
|
|
2998
2998
|
return _typeof(schema) === "object" && schema !== null && "type" in schema && (schema.type === "image" || schema.type === "file" || schema.type === "video");
|
|
2999
2999
|
}
|
|
3000
3000
|
|
|
3001
|
+
/**
|
|
3002
|
+
* The key of a gallery (an `s.imagedir()`, `s.filedir()` or `s.videodir()`)
|
|
3003
|
+
* that a field's `path` names, or `null` when it names none.
|
|
3004
|
+
*
|
|
3005
|
+
* Usually the path IS the key. It is not for an image uploaded THROUGH an
|
|
3006
|
+
* `s.image(remoteGallery)` field in the Studio, which stores the remote ref in
|
|
3007
|
+
* the field and keys the entry by the local path inside it — so a path that is
|
|
3008
|
+
* not a key falls back to that embedded path. Exact first, because a gallery
|
|
3009
|
+
* can hold both shapes for one file, and the field then names the entry that
|
|
3010
|
+
* IS its path.
|
|
3011
|
+
*
|
|
3012
|
+
* One implementation of the question, asked by everything that has to agree on
|
|
3013
|
+
* the answer: reading a field (`galleryEntryOf`), validating it (`ImageSchema`
|
|
3014
|
+
* and `FileSchema` ask whether the gallery has it), the Studio's reference
|
|
3015
|
+
* scans and renames, and `val validate --fix` when it renames a key and has to
|
|
3016
|
+
* find the fields that hold it.
|
|
3017
|
+
*
|
|
3018
|
+
* The embedded path is tried with its leading slash (how a key is written) and
|
|
3019
|
+
* without (how `splitRemoteRef` returns it).
|
|
3020
|
+
*/
|
|
3021
|
+
function galleryKeyOf(path, isKey) {
|
|
3022
|
+
if (isKey(path)) {
|
|
3023
|
+
return path;
|
|
3024
|
+
}
|
|
3025
|
+
var split = splitRemoteRef(path);
|
|
3026
|
+
if (split.status === "success") {
|
|
3027
|
+
for (var _i = 0, _arr = ["/".concat(split.filePath), split.filePath]; _i < _arr.length; _i++) {
|
|
3028
|
+
var embedded = _arr[_i];
|
|
3029
|
+
if (isKey(embedded)) {
|
|
3030
|
+
return embedded;
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
return null;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3001
3037
|
/**
|
|
3002
3038
|
* What a gallery entry holds as a DEFAULT for the fields picked from it, in
|
|
3003
3039
|
* the groups a field overrides together.
|
|
@@ -3017,7 +3053,9 @@ var GALLERY_FILE_FACTS = ["width", "height", "mimeType", "duration"];
|
|
|
3017
3053
|
* gallery-backed or the gallery has no such entry.
|
|
3018
3054
|
*
|
|
3019
3055
|
* The double lookup is load-bearing: a remote gallery keys its entries by the
|
|
3020
|
-
* remote URL while the file itself stays on disk under its local path
|
|
3056
|
+
* remote URL while the file itself stays on disk under its local path, and an
|
|
3057
|
+
* upload through the field does it the other way round (see
|
|
3058
|
+
* {@link galleryKeyOf}).
|
|
3021
3059
|
*/
|
|
3022
3060
|
function galleryEntryOf(src, schema, getModuleSource) {
|
|
3023
3061
|
if (!isMediaSchema(schema) || !schema.referencedModule) {
|
|
@@ -3027,13 +3065,9 @@ function galleryEntryOf(src, schema, getModuleSource) {
|
|
|
3027
3065
|
if (!isPlainObject(moduleSource)) {
|
|
3028
3066
|
return null;
|
|
3029
3067
|
}
|
|
3030
|
-
var key = src.path
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
if (splitRemoteRefRes.status === "success" && splitRemoteRefRes.filePath in moduleSource) {
|
|
3034
|
-
key = splitRemoteRefRes.filePath;
|
|
3035
|
-
}
|
|
3036
|
-
}
|
|
3068
|
+
var key = galleryKeyOf(src.path, function (candidate) {
|
|
3069
|
+
return candidate in moduleSource;
|
|
3070
|
+
});
|
|
3037
3071
|
if (key === null) {
|
|
3038
3072
|
return null;
|
|
3039
3073
|
}
|
|
@@ -3894,10 +3928,10 @@ function mimeTypeMatchesAccept(mimeType, accept) {
|
|
|
3894
3928
|
* asks the BYTES ({@link sniffFontMimeType}) rather than trusting the picker.
|
|
3895
3929
|
*/
|
|
3896
3930
|
|
|
3897
|
-
/** The formats `s.
|
|
3931
|
+
/** The formats `s.fontdir()` accepts unless told otherwise, best first. */
|
|
3898
3932
|
var FONT_MIME_TYPES = ["font/woff2", "font/woff", "font/ttf", "font/otf"];
|
|
3899
3933
|
|
|
3900
|
-
/** `s.
|
|
3934
|
+
/** `s.fontdir()`'s `accept` when none is given. */
|
|
3901
3935
|
var DEFAULT_FONT_ACCEPT = FONT_MIME_TYPES.join(",");
|
|
3902
3936
|
|
|
3903
3937
|
/**
|
|
@@ -4136,24 +4170,31 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4136
4170
|
value: src
|
|
4137
4171
|
}]));
|
|
4138
4172
|
}
|
|
4173
|
+
// A field picked from a gallery holds the gallery's KEY, and whether that
|
|
4174
|
+
// key is a local path or a remote ref is the gallery's to decide — and its
|
|
4175
|
+
// to fix: uploading an entry renames its key, and the fields that hold it
|
|
4176
|
+
// with it. So such a field only asks whether the gallery has it, below.
|
|
4177
|
+
// Asking here as well reported every image picked from a `.remote()`
|
|
4178
|
+
// gallery as one to download, because the field itself is never remote.
|
|
4179
|
+
var galleryEntries = this.galleryEntries();
|
|
4139
4180
|
// Remote-ness is a property of the path, not of a marker on the value:
|
|
4140
4181
|
// anything outside /public is remote.
|
|
4141
4182
|
var isRemotePath = isRemoteMediaPath(src.path);
|
|
4142
|
-
if (this.isRemote && !isRemotePath) {
|
|
4183
|
+
if (!galleryEntries && this.isRemote && !isRemotePath) {
|
|
4143
4184
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
4144
4185
|
message: "Expected a remote image, but got a local image.",
|
|
4145
4186
|
value: src,
|
|
4146
4187
|
fixes: ["image:upload-remote"]
|
|
4147
4188
|
}]));
|
|
4148
4189
|
}
|
|
4149
|
-
if (this.isRemote && isRemotePath) {
|
|
4190
|
+
if (!galleryEntries && this.isRemote && isRemotePath) {
|
|
4150
4191
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
4151
4192
|
message: "Remote image was not checked.",
|
|
4152
4193
|
value: src,
|
|
4153
4194
|
fixes: ["image:check-remote"]
|
|
4154
4195
|
}]));
|
|
4155
4196
|
}
|
|
4156
|
-
if (!this.isRemote && isRemotePath) {
|
|
4197
|
+
if (!galleryEntries && !this.isRemote && isRemotePath) {
|
|
4157
4198
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
4158
4199
|
message: "Expected local image, but found remote.",
|
|
4159
4200
|
value: src,
|
|
@@ -4168,7 +4209,6 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4168
4209
|
}]));
|
|
4169
4210
|
}
|
|
4170
4211
|
}
|
|
4171
|
-
var galleryEntries = this.galleryEntries();
|
|
4172
4212
|
if (galleryEntries) {
|
|
4173
4213
|
// The dimensions and mime type of a gallery image are stored once, in the
|
|
4174
4214
|
// gallery. Repeating them on the field is how the two get to disagree.
|
|
@@ -4181,7 +4221,11 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4181
4221
|
value: src
|
|
4182
4222
|
}]));
|
|
4183
4223
|
}
|
|
4184
|
-
|
|
4224
|
+
// The same match reading the field makes (`fillFromGallery`): the key,
|
|
4225
|
+
// or the local path inside a ref an upload through the field stored.
|
|
4226
|
+
if (galleryKeyOf(src.path, function (key) {
|
|
4227
|
+
return key in galleryEntries;
|
|
4228
|
+
}) === null) {
|
|
4185
4229
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
4186
4230
|
message: "The gallery does not have an image at '".concat(src.path, "'."),
|
|
4187
4231
|
value: src
|
|
@@ -5798,7 +5842,7 @@ function missingDeclaredKeys(declared, present) {
|
|
|
5798
5842
|
/**
|
|
5799
5843
|
* The checks of what one page chose about a video — its times, focal point,
|
|
5800
5844
|
* poster and captions — shared by the two places those choices are made: a
|
|
5801
|
-
* field (`s.video()`) and the entry of a set (`s.
|
|
5845
|
+
* field (`s.video()`) and the entry of a set (`s.videodir()`), which holds the
|
|
5802
5846
|
* same choices as the defaults every field picked from it starts from.
|
|
5803
5847
|
*/
|
|
5804
5848
|
|
|
@@ -5976,7 +6020,25 @@ function isObject(value) {
|
|
|
5976
6020
|
return _typeof(value) === "object" && value !== null && !Array.isArray(value);
|
|
5977
6021
|
}
|
|
5978
6022
|
|
|
5979
|
-
/** What a media collection (`s.
|
|
6023
|
+
/** What a media collection (`s.imagedir`, `s.filedir`, `s.videodir`) holds. */
|
|
6024
|
+
|
|
6025
|
+
/**
|
|
6026
|
+
* Where a media collection keeps its files: the first argument of
|
|
6027
|
+
* `s.imagedir()`, `s.filedir()`, `s.fontdir()` and `s.videodir()`.
|
|
6028
|
+
*
|
|
6029
|
+
* Required, and deliberately so: it decides where every uploaded file in the
|
|
6030
|
+
* collection lands. It used to default to "/public/val", which meant a
|
|
6031
|
+
* collection that had simply not said where it wanted its files silently
|
|
6032
|
+
* shared a directory with every other one. It is the first argument rather
|
|
6033
|
+
* than an option because it is the one thing every collection has to say.
|
|
6034
|
+
*/
|
|
6035
|
+
|
|
6036
|
+
/** The factory that builds a media collection of each type, for messages. */
|
|
6037
|
+
var mediaDirFactory = {
|
|
6038
|
+
images: "imagedir",
|
|
6039
|
+
files: "filedir",
|
|
6040
|
+
videos: "videodir"
|
|
6041
|
+
};
|
|
5980
6042
|
|
|
5981
6043
|
/**
|
|
5982
6044
|
* The fix code a media collection of `type` reports for `check`.
|
|
@@ -6011,7 +6073,7 @@ function assertRenderable(router, mediaOptions, render) {
|
|
|
6011
6073
|
throw new Error("`.render(...)` is not supported on `s.router(...)`: a router's entries are pages, which have their own UI.");
|
|
6012
6074
|
}
|
|
6013
6075
|
if (mediaOptions) {
|
|
6014
|
-
throw new Error("`.render(...)` is not supported on `s.".concat(mediaOptions.type
|
|
6076
|
+
throw new Error("`.render(...)` is not supported on `s.".concat(mediaDirFactory[mediaOptions.type], "(...)`: media galleries have their own UI."));
|
|
6015
6077
|
}
|
|
6016
6078
|
}
|
|
6017
6079
|
|
|
@@ -6728,7 +6790,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6728
6790
|
* Allow the files in this gallery to be stored on Val's remote content host
|
|
6729
6791
|
* instead of in your repository.
|
|
6730
6792
|
*
|
|
6731
|
-
* For `s.
|
|
6793
|
+
* For `s.imagedir()` and `s.filedir()`, which are records of media. Remote is off
|
|
6732
6794
|
* until this is called.
|
|
6733
6795
|
*
|
|
6734
6796
|
* Each entry is then keyed by its URL on the content host rather than by a
|
|
@@ -6737,7 +6799,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6737
6799
|
* upload it and rewrite the key.
|
|
6738
6800
|
*
|
|
6739
6801
|
* @example
|
|
6740
|
-
* const schema = s.
|
|
6802
|
+
* const schema = s.imagedir("/public/val/images").remote();
|
|
6741
6803
|
* export default c.define("/content/images.val.ts", schema, {
|
|
6742
6804
|
* "https://remote.val.build/file/p/my-project/b/01/v/1.0.0/h/8f2a1c/f/3b9d70/p/public/val/images/hero.webp":
|
|
6743
6805
|
* {
|
|
@@ -6763,7 +6825,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6763
6825
|
* which lets the runtime, the Studio and validation work one entry at a time
|
|
6764
6826
|
* so a record/router can scale to many thousands of entries.
|
|
6765
6827
|
*
|
|
6766
|
-
* Not supported on image/file galleries (`s.
|
|
6828
|
+
* Not supported on image/file galleries (`s.imagedir()` / `s.filedir()`).
|
|
6767
6829
|
*
|
|
6768
6830
|
* Only supported on a module's ROOT record/router — a `.jsonValues()` record
|
|
6769
6831
|
* nested inside an object/array/record is rejected at startup with a module
|
|
@@ -6788,7 +6850,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6788
6850
|
key: "jsonValues",
|
|
6789
6851
|
value: function jsonValues() {
|
|
6790
6852
|
if (this.mediaOptions) {
|
|
6791
|
-
throw new Error(".jsonValues() cannot be used with image/file galleries (s.
|
|
6853
|
+
throw new Error(".jsonValues() cannot be used with image/file galleries (s.imagedir()/s.filedir())");
|
|
6792
6854
|
}
|
|
6793
6855
|
if (this.customValidateFunctions.length > 0) {
|
|
6794
6856
|
// `.jsonValues()` changes the source shape to JsonSource entries, so a
|
|
@@ -6817,7 +6879,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6817
6879
|
* bucket — instead of in the module.
|
|
6818
6880
|
*
|
|
6819
6881
|
* Available on every record-derived schema, which is `s.record()`,
|
|
6820
|
-
* `s.router()`, `s.
|
|
6882
|
+
* `s.router()`, `s.imagedir()` and `s.filedir()` alike: a router is a
|
|
6821
6883
|
* `RecordSchema` with a `ValRouter`, a gallery one with media options, so all
|
|
6822
6884
|
* four get external storage from this one method.
|
|
6823
6885
|
*
|
|
@@ -7147,7 +7209,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7147
7209
|
* draws each entry's own editor in place, labelled by its key, instead of a
|
|
7148
7210
|
* preview row that navigates to it. It reaches the direct entries only.
|
|
7149
7211
|
*
|
|
7150
|
-
* Not for `s.router(...)`, `s.
|
|
7212
|
+
* Not for `s.router(...)`, `s.imagedir(...)` or `s.filedir(...)`: pages and
|
|
7151
7213
|
* media have UIs of their own, so this throws on them.
|
|
7152
7214
|
*
|
|
7153
7215
|
* Static configuration, not a callback — see `render.ts`.
|
|
@@ -10920,31 +10982,37 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10920
10982
|
value: src
|
|
10921
10983
|
}]));
|
|
10922
10984
|
}
|
|
10985
|
+
// A field picked from a gallery holds the gallery's KEY, and whether that
|
|
10986
|
+
// key is a local path or a remote ref is the gallery's to decide — and its
|
|
10987
|
+
// to fix: uploading an entry renames its key, and the fields that hold it
|
|
10988
|
+
// with it. So such a field only asks whether the gallery has it, below.
|
|
10989
|
+
// Asking here as well reported every file picked from a `.remote()`
|
|
10990
|
+
// gallery as one to download, because the field itself is never remote.
|
|
10991
|
+
var galleryEntries = this.galleryEntries();
|
|
10923
10992
|
// Remote-ness is a property of the path, not of a marker on the value:
|
|
10924
10993
|
// anything outside /public is remote.
|
|
10925
10994
|
var isRemotePath = isRemoteMediaPath(src.path);
|
|
10926
|
-
if (this.isRemote && !isRemotePath) {
|
|
10995
|
+
if (!galleryEntries && this.isRemote && !isRemotePath) {
|
|
10927
10996
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10928
10997
|
message: "Expected a remote file, but got a local file.",
|
|
10929
10998
|
value: src,
|
|
10930
10999
|
fixes: ["file:upload-remote"]
|
|
10931
11000
|
}]));
|
|
10932
11001
|
}
|
|
10933
|
-
if (this.isRemote && isRemotePath) {
|
|
11002
|
+
if (!galleryEntries && this.isRemote && isRemotePath) {
|
|
10934
11003
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10935
11004
|
message: "Remote file was not checked.",
|
|
10936
11005
|
value: src,
|
|
10937
11006
|
fixes: ["file:check-remote"]
|
|
10938
11007
|
}]));
|
|
10939
11008
|
}
|
|
10940
|
-
if (!this.isRemote && isRemotePath) {
|
|
11009
|
+
if (!galleryEntries && !this.isRemote && isRemotePath) {
|
|
10941
11010
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10942
11011
|
message: "Expected local file, but found remote.",
|
|
10943
11012
|
value: src,
|
|
10944
11013
|
fixes: ["file:download-remote"]
|
|
10945
11014
|
}]));
|
|
10946
11015
|
}
|
|
10947
|
-
var galleryEntries = this.galleryEntries();
|
|
10948
11016
|
if (galleryEntries) {
|
|
10949
11017
|
if (src.mimeType !== undefined) {
|
|
10950
11018
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
@@ -10952,7 +11020,11 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10952
11020
|
value: src
|
|
10953
11021
|
}]));
|
|
10954
11022
|
}
|
|
10955
|
-
|
|
11023
|
+
// The same match reading the field makes (`fillFromGallery`): the key,
|
|
11024
|
+
// or the local path inside a ref an upload through the field stored.
|
|
11025
|
+
if (galleryKeyOf(src.path, function (key) {
|
|
11026
|
+
return key in galleryEntries;
|
|
11027
|
+
}) === null) {
|
|
10956
11028
|
return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
|
|
10957
11029
|
message: "The gallery does not have a file at '".concat(src.path, "'."),
|
|
10958
11030
|
value: src
|
|
@@ -11188,7 +11260,7 @@ function fileOf(remote, options) {
|
|
|
11188
11260
|
}
|
|
11189
11261
|
|
|
11190
11262
|
/**
|
|
11191
|
-
* A font picked from an `s.
|
|
11263
|
+
* A font picked from an `s.fontdir()`.
|
|
11192
11264
|
*
|
|
11193
11265
|
* The same field `s.file(fontsVal)` is — it stores `{ path }` and serializes
|
|
11194
11266
|
* identically — with one thing more: it refuses a set that is not a font set,
|
|
@@ -11215,7 +11287,7 @@ function assertFontset(fontsetModule) {
|
|
|
11215
11287
|
return isFontMimeType(type.trim());
|
|
11216
11288
|
});
|
|
11217
11289
|
if (!isFontset) {
|
|
11218
|
-
throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.
|
|
11290
|
+
throw new Error("s.font(".concat(modulePath !== null && modulePath !== void 0 ? modulePath : "?", "): the module must be an s.fontdir(). Use s.file() to pick from a set of other files."));
|
|
11219
11291
|
}
|
|
11220
11292
|
}
|
|
11221
11293
|
|
|
@@ -11754,7 +11826,7 @@ function stripQuery(path) {
|
|
|
11754
11826
|
}
|
|
11755
11827
|
|
|
11756
11828
|
/**
|
|
11757
|
-
* A video picked from a set (`s.
|
|
11829
|
+
* A video picked from a set (`s.videodir()`). What is true of the file —
|
|
11758
11830
|
* its type, size and length — lives in the set; the field carries what one
|
|
11759
11831
|
* page chose about it.
|
|
11760
11832
|
*/
|
|
@@ -11789,7 +11861,7 @@ function videoOf(options, galleryOptions) {
|
|
|
11789
11861
|
var setSchema = (_options$GetSchema = options[GetSchema]) === null || _options$GetSchema === void 0 ? void 0 : _options$GetSchema["executeSerialize"]();
|
|
11790
11862
|
if ((setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) !== "record" || setSchema.mediaType !== "videos") {
|
|
11791
11863
|
var _setSchema$mediaType, _setSchema$type;
|
|
11792
|
-
throw new Error("s.video(".concat(modulePath, "): the module must be an s.
|
|
11864
|
+
throw new Error("s.video(".concat(modulePath, "): the module must be an s.videodir(). Got ").concat((setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) === "record" ? "a record of ".concat((_setSchema$mediaType = setSchema.mediaType) !== null && _setSchema$mediaType !== void 0 ? _setSchema$mediaType : "values") : (_setSchema$type = setSchema === null || setSchema === void 0 ? void 0 : setSchema.type) !== null && _setSchema$type !== void 0 ? _setSchema$type : "no schema", "."));
|
|
11793
11865
|
}
|
|
11794
11866
|
return new VideoSchema((galleryOptions === null || galleryOptions === void 0 ? void 0 : galleryOptions.stream) !== undefined ? {
|
|
11795
11867
|
stream: galleryOptions.stream
|
|
@@ -11804,23 +11876,37 @@ function isVideosetModule(value) {
|
|
|
11804
11876
|
}
|
|
11805
11877
|
|
|
11806
11878
|
/**
|
|
11807
|
-
* Options for s.
|
|
11879
|
+
* Options for `s.filedir(dir, options)`: everything but the directory, which
|
|
11880
|
+
* is the first argument.
|
|
11881
|
+
*/
|
|
11882
|
+
|
|
11883
|
+
/**
|
|
11884
|
+
* Options for the deprecated `s.fileset(options)`, which took the directory
|
|
11885
|
+
* as `dir`.
|
|
11886
|
+
*
|
|
11887
|
+
* @deprecated Use `s.filedir(dir, options)` and `FiledirOptions`.
|
|
11808
11888
|
*/
|
|
11809
11889
|
|
|
11810
11890
|
/**
|
|
11811
11891
|
* Metadata for a file entry in the files record
|
|
11812
11892
|
*/
|
|
11813
11893
|
|
|
11894
|
+
/** @deprecated Use `FiledirEntryMetadata`. */
|
|
11895
|
+
|
|
11896
|
+
/** @deprecated Use `SerializedFiledirSchema`. */
|
|
11897
|
+
|
|
11814
11898
|
/**
|
|
11815
|
-
* Define a
|
|
11899
|
+
* Define a directory of files: a whole module that holds many files, keyed by
|
|
11900
|
+
* their file path, that fields pick from with `s.file(filesVal)`.
|
|
11816
11901
|
*
|
|
11817
|
-
*
|
|
11902
|
+
* The directory is the first argument and is required — it decides where
|
|
11903
|
+
* uploads land. Remote is off by default: call `.remote()` on the result to
|
|
11904
|
+
* allow remote files.
|
|
11818
11905
|
*
|
|
11819
11906
|
* @example
|
|
11820
11907
|
* ```typescript
|
|
11821
|
-
* const schema = s.
|
|
11908
|
+
* const schema = s.filedir("/public/val/documents", {
|
|
11822
11909
|
* accept: "application/pdf",
|
|
11823
|
-
* dir: "/public/val/documents",
|
|
11824
11910
|
* });
|
|
11825
11911
|
* export default c.define("/content/documents.val.ts", schema, {
|
|
11826
11912
|
* "/public/val/documents/report.pdf": {
|
|
@@ -11829,8 +11915,7 @@ function isVideosetModule(value) {
|
|
|
11829
11915
|
* });
|
|
11830
11916
|
* ```
|
|
11831
11917
|
*/
|
|
11832
|
-
var
|
|
11833
|
-
var dir = options.dir;
|
|
11918
|
+
var filedir = function filedir(dir, options) {
|
|
11834
11919
|
var itemSchema = new ObjectSchema({
|
|
11835
11920
|
mimeType: new StringSchema({}, false)
|
|
11836
11921
|
}, false);
|
|
@@ -11843,23 +11928,49 @@ var fileset = function fileset(options) {
|
|
|
11843
11928
|
};
|
|
11844
11929
|
|
|
11845
11930
|
/**
|
|
11846
|
-
*
|
|
11931
|
+
* Define a collection of files.
|
|
11932
|
+
*
|
|
11933
|
+
* @deprecated Use `s.filedir(dir, options)`: the directory moved out of the
|
|
11934
|
+
* options and into the first argument, and nothing else changed.
|
|
11935
|
+
*
|
|
11936
|
+
* @example
|
|
11937
|
+
* ```typescript
|
|
11938
|
+
* // was: s.fileset({ dir: "/public/val/documents", accept: "application/pdf" })
|
|
11939
|
+
* const schema = s.filedir("/public/val/documents", {
|
|
11940
|
+
* accept: "application/pdf",
|
|
11941
|
+
* });
|
|
11942
|
+
* ```
|
|
11847
11943
|
*/
|
|
11944
|
+
var fileset = function fileset(options) {
|
|
11945
|
+
return filedir(options.dir, options);
|
|
11946
|
+
};
|
|
11848
11947
|
|
|
11849
11948
|
/**
|
|
11850
|
-
*
|
|
11949
|
+
* Options for `s.fontdir(dir, options)`: everything but the directory, which
|
|
11950
|
+
* is the first argument.
|
|
11951
|
+
*/
|
|
11952
|
+
|
|
11953
|
+
/**
|
|
11954
|
+
* Options for the deprecated `s.fontset(options)`, which took the directory
|
|
11955
|
+
* as `dir`.
|
|
11956
|
+
*
|
|
11957
|
+
* @deprecated Use `s.fontdir(dir, options)` and `FontdirOptions`.
|
|
11958
|
+
*/
|
|
11959
|
+
|
|
11960
|
+
/**
|
|
11961
|
+
* Define a directory of fonts.
|
|
11851
11962
|
*
|
|
11852
|
-
* A
|
|
11963
|
+
* A fontdir IS a filedir — the same source, the same `s.font(fontsVal)` field
|
|
11853
11964
|
* to pick from it, the same checks and fixes — with `accept` defaulting to the
|
|
11854
11965
|
* web font formats. What a font gets that any other file does not is decided
|
|
11855
|
-
* by its mime type rather than by the
|
|
11856
|
-
* knows is a font, wherever it is shown.
|
|
11966
|
+
* by its mime type rather than by the directory: the Studio previews any file
|
|
11967
|
+
* it knows is a font, wherever it is shown.
|
|
11857
11968
|
*
|
|
11858
11969
|
* Remote is off by default: call `.remote()` on the result to allow remote files.
|
|
11859
11970
|
*
|
|
11860
11971
|
* @example
|
|
11861
11972
|
* ```typescript
|
|
11862
|
-
* const schema = s.
|
|
11973
|
+
* const schema = s.fontdir("/public/val/fonts");
|
|
11863
11974
|
* export default c.define("/content/fonts.val.ts", schema, {
|
|
11864
11975
|
* "/public/val/fonts/inter_a1b2c.woff2": {
|
|
11865
11976
|
* mimeType: "font/woff2",
|
|
@@ -11867,25 +11978,40 @@ var fileset = function fileset(options) {
|
|
|
11867
11978
|
* });
|
|
11868
11979
|
* ```
|
|
11869
11980
|
*/
|
|
11870
|
-
var
|
|
11981
|
+
var fontdir = function fontdir(dir, options) {
|
|
11871
11982
|
var _options$accept;
|
|
11872
|
-
var accept = (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
|
|
11983
|
+
var accept = (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_FONT_ACCEPT;
|
|
11873
11984
|
var notFonts = accept.split(",").map(function (type) {
|
|
11874
11985
|
return type.trim();
|
|
11875
11986
|
}).filter(function (type) {
|
|
11876
11987
|
return !isFontMimeType(type);
|
|
11877
11988
|
});
|
|
11878
11989
|
if (notFonts.length > 0) {
|
|
11879
|
-
// A
|
|
11990
|
+
// A fontdir that took a PDF would be a filedir under a name that says
|
|
11880
11991
|
// otherwise, and the Studio would draw a specimen of nothing.
|
|
11881
|
-
throw new Error("s.
|
|
11992
|
+
throw new Error("s.fontdir(): 'accept' may only name font types (font/woff2, font/woff, font/ttf, font/otf or font/*). Got: ".concat(notFonts.join(", "), ". Use s.filedir() for other files."));
|
|
11882
11993
|
}
|
|
11883
|
-
return
|
|
11884
|
-
dir: options.dir,
|
|
11994
|
+
return filedir(dir, {
|
|
11885
11995
|
accept: accept
|
|
11886
11996
|
});
|
|
11887
11997
|
};
|
|
11888
11998
|
|
|
11999
|
+
/**
|
|
12000
|
+
* Define a collection of fonts.
|
|
12001
|
+
*
|
|
12002
|
+
* @deprecated Use `s.fontdir(dir, options)`: the directory moved out of the
|
|
12003
|
+
* options and into the first argument, and nothing else changed.
|
|
12004
|
+
*
|
|
12005
|
+
* @example
|
|
12006
|
+
* ```typescript
|
|
12007
|
+
* // was: s.fontset({ dir: "/public/val/fonts" })
|
|
12008
|
+
* const schema = s.fontdir("/public/val/fonts");
|
|
12009
|
+
* ```
|
|
12010
|
+
*/
|
|
12011
|
+
var fontset = function fontset(options) {
|
|
12012
|
+
return fontdir(options.dir, options);
|
|
12013
|
+
};
|
|
12014
|
+
|
|
11889
12015
|
var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
11890
12016
|
function DateSchema(options) {
|
|
11891
12017
|
var _this;
|
|
@@ -12752,39 +12878,58 @@ function router(router, keyOrItem, maybeItem) {
|
|
|
12752
12878
|
/** Every `alt` value any `AltSchema` can produce. */
|
|
12753
12879
|
|
|
12754
12880
|
/**
|
|
12755
|
-
* Options for s.
|
|
12881
|
+
* Options for `s.imagedir(dir, options)`: everything but the directory, which
|
|
12882
|
+
* is the first argument.
|
|
12883
|
+
*/
|
|
12884
|
+
|
|
12885
|
+
/**
|
|
12886
|
+
* Options for the deprecated `s.imageset(options)`, which took the directory
|
|
12887
|
+
* as `dir`.
|
|
12888
|
+
*
|
|
12889
|
+
* @deprecated Use `s.imagedir(dir, options)` and `ImagedirOptions`.
|
|
12756
12890
|
*/
|
|
12757
12891
|
|
|
12758
12892
|
/**
|
|
12759
12893
|
* `alt` is optional only when it is the default schema.
|
|
12760
12894
|
*
|
|
12761
12895
|
* Naming a different `Alt` and then leaving `alt` out would make the fallback
|
|
12762
|
-
* in `
|
|
12896
|
+
* in `imagedir()` a lie — `Alt` would say `s.string()` while the value was a
|
|
12763
12897
|
* nullable one. Requiring it in that case is what makes the fallback sound:
|
|
12764
12898
|
* the branch that uses it is reachable only when `Alt` IS the default.
|
|
12765
12899
|
*/
|
|
12766
12900
|
|
|
12901
|
+
/**
|
|
12902
|
+
* The options argument of `s.imagedir()`: optional only when `alt` is, for
|
|
12903
|
+
* the reason `ImagedirAltOption` gives — leaving the whole object out leaves
|
|
12904
|
+
* `alt` out with it.
|
|
12905
|
+
*/
|
|
12906
|
+
|
|
12767
12907
|
/**
|
|
12768
12908
|
* Metadata for an image entry in the images record.
|
|
12769
12909
|
*
|
|
12770
12910
|
* `alt` follows the schema's `alt` option, so it defaults to `string | null`
|
|
12771
12911
|
* and becomes `string` under `s.string()` or `Record<string, string>` under
|
|
12772
|
-
* `s.record(s.string())`. Write `
|
|
12912
|
+
* `s.record(s.string())`. Write `ImagedirEntryMetadata<AltSource>` where a
|
|
12773
12913
|
* gallery of any alt shape is acceptable.
|
|
12774
12914
|
*/
|
|
12775
12915
|
|
|
12916
|
+
/** @deprecated Use `ImagedirEntryMetadata`. */
|
|
12917
|
+
|
|
12918
|
+
/** @deprecated Use `SerializedImagedirSchema`. */
|
|
12919
|
+
|
|
12776
12920
|
/**
|
|
12777
|
-
* Define a
|
|
12921
|
+
* Define a directory of images: a whole module that holds many images, keyed
|
|
12922
|
+
* by their file path, that fields pick from with `s.image(galleryVal)`.
|
|
12778
12923
|
*
|
|
12779
|
-
*
|
|
12780
|
-
* to be inferred. The rest defaults: any
|
|
12781
|
-
*
|
|
12924
|
+
* The directory is the first argument and is required — it decides where
|
|
12925
|
+
* uploads land, so it is not something to be inferred. The rest defaults: any
|
|
12926
|
+
* image type (`"image/*"`), nullable alt text, remote disabled. Call
|
|
12927
|
+
* `.remote()` on the result to allow remote images.
|
|
12782
12928
|
*
|
|
12783
12929
|
* @example
|
|
12784
12930
|
* ```typescript
|
|
12785
|
-
* const schema = s.
|
|
12931
|
+
* const schema = s.imagedir("/public/val/images", {
|
|
12786
12932
|
* accept: "image/webp",
|
|
12787
|
-
* dir: "/public/val/images",
|
|
12788
12933
|
* alt: s.string().minLength(4),
|
|
12789
12934
|
* });
|
|
12790
12935
|
* export default c.define("/content/images.val.ts", schema, {
|
|
@@ -12797,19 +12942,26 @@ function router(router, keyOrItem, maybeItem) {
|
|
|
12797
12942
|
* });
|
|
12798
12943
|
* ```
|
|
12799
12944
|
*/
|
|
12800
|
-
var
|
|
12945
|
+
var imagedir = function imagedir(dir) {
|
|
12946
|
+
for (var _len = arguments.length, _ref = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
12947
|
+
_ref[_key - 1] = arguments[_key];
|
|
12948
|
+
}
|
|
12949
|
+
var options = _ref[0];
|
|
12950
|
+
return imagedirOf(dir, options);
|
|
12951
|
+
};
|
|
12952
|
+
function imagedirOf(dir, options) {
|
|
12801
12953
|
var _options$alt, _options$accept;
|
|
12802
|
-
|
|
12803
|
-
// `options.alt` is `Alt | undefined`, and the fallback is exactly the schema
|
|
12954
|
+
// `options?.alt` is `Alt | undefined`, and the fallback is exactly the schema
|
|
12804
12955
|
// `Alt` defaults to when `alt` is omitted. TypeScript will not narrow a type
|
|
12805
12956
|
// parameter from the absence of a value, so it cannot see that the two agree,
|
|
12806
12957
|
// and the fallback is asserted here.
|
|
12807
12958
|
//
|
|
12808
|
-
// Sound, not merely convenient: `
|
|
12809
|
-
// unless `Alt` is the default,
|
|
12959
|
+
// Sound, not merely convenient: `ImagedirAltOption` makes `alt` REQUIRED
|
|
12960
|
+
// unless `Alt` is the default, and `ImagedirOptionsArg` makes the options
|
|
12961
|
+
// object required with it, so this branch is unreachable for any other
|
|
12810
12962
|
// `Alt`. The one assertion in this file, and it replaces the wider one that
|
|
12811
12963
|
// used to sit on the ObjectSchema below.
|
|
12812
|
-
var altSchema = (_options$alt = options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
|
|
12964
|
+
var altSchema = (_options$alt = options === null || options === void 0 ? void 0 : options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
|
|
12813
12965
|
var itemSchema = new ObjectSchema({
|
|
12814
12966
|
width: new NumberSchema(undefined, false),
|
|
12815
12967
|
height: new NumberSchema(undefined, false),
|
|
@@ -12818,19 +12970,57 @@ var imageset = function imageset(options) {
|
|
|
12818
12970
|
}, false);
|
|
12819
12971
|
return new RecordSchema(itemSchema, false, [], null, null, {
|
|
12820
12972
|
type: "images",
|
|
12821
|
-
accept: (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : "image/*",
|
|
12973
|
+
accept: (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : "image/*",
|
|
12822
12974
|
dir: dir,
|
|
12823
12975
|
remote: false,
|
|
12824
12976
|
altSchema: altSchema,
|
|
12825
|
-
encode: options.encode
|
|
12977
|
+
encode: options === null || options === void 0 ? void 0 : options.encode
|
|
12826
12978
|
});
|
|
12979
|
+
}
|
|
12980
|
+
|
|
12981
|
+
/**
|
|
12982
|
+
* `s.imagedir()` with `.remote()` applied: what `s.imagedir` is under
|
|
12983
|
+
* `files: { remote: true }`.
|
|
12984
|
+
*/
|
|
12985
|
+
var remoteImagedir = function remoteImagedir(dir) {
|
|
12986
|
+
for (var _len2 = arguments.length, _ref2 = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
12987
|
+
_ref2[_key2 - 1] = arguments[_key2];
|
|
12988
|
+
}
|
|
12989
|
+
var options = _ref2[0];
|
|
12990
|
+
return imagedirOf(dir, options).remote();
|
|
12827
12991
|
};
|
|
12828
12992
|
|
|
12829
12993
|
/**
|
|
12830
|
-
*
|
|
12994
|
+
* Define a collection of images.
|
|
12995
|
+
*
|
|
12996
|
+
* @deprecated Use `s.imagedir(dir, options)`: the directory moved out of the
|
|
12997
|
+
* options and into the first argument, and nothing else changed.
|
|
12998
|
+
*
|
|
12999
|
+
* @example
|
|
13000
|
+
* ```typescript
|
|
13001
|
+
* // was: s.imageset({ dir: "/public/val/images", accept: "image/webp" })
|
|
13002
|
+
* const schema = s.imagedir("/public/val/images", { accept: "image/webp" });
|
|
13003
|
+
* ```
|
|
12831
13004
|
*/
|
|
13005
|
+
var imageset = function imageset(options) {
|
|
13006
|
+
return imagedirOf(options.dir, options);
|
|
13007
|
+
};
|
|
12832
13008
|
|
|
12833
|
-
/**
|
|
13009
|
+
/**
|
|
13010
|
+
* Options for `s.videodir(dir, options)`: everything but the directory, which
|
|
13011
|
+
* is the first argument.
|
|
13012
|
+
*/
|
|
13013
|
+
|
|
13014
|
+
/**
|
|
13015
|
+
* Options for the deprecated `s.videoset(options)`, which took the directory
|
|
13016
|
+
* as `dir`.
|
|
13017
|
+
*
|
|
13018
|
+
* @deprecated Use `s.videodir(dir, options)` and `VideodirOptions`.
|
|
13019
|
+
*/
|
|
13020
|
+
|
|
13021
|
+
/** See `ImagedirAltOption`: `alt` is optional only when it is the default. */
|
|
13022
|
+
|
|
13023
|
+
/** See `ImagedirOptionsArg`: the options are optional only when `alt` is. */
|
|
12834
13024
|
|
|
12835
13025
|
/**
|
|
12836
13026
|
* One video of a set, keyed by its file path (an HLS stream by its master
|
|
@@ -12848,19 +13038,22 @@ var imageset = function imageset(options) {
|
|
|
12848
13038
|
* still for the gallery, because two stills of one video would disagree.
|
|
12849
13039
|
*/
|
|
12850
13040
|
|
|
13041
|
+
/** @deprecated Use `VideodirEntryMetadata`. */
|
|
13042
|
+
|
|
13043
|
+
/** @deprecated Use `SerializedVideodirSchema`. */
|
|
13044
|
+
|
|
12851
13045
|
/**
|
|
12852
|
-
* Define a
|
|
13046
|
+
* Define a directory of videos — the video twin of `s.imagedir()`.
|
|
12853
13047
|
*
|
|
12854
13048
|
* A field picks from it with `s.video(videosVal)`. An entry may hold the
|
|
12855
13049
|
* description, poster, start and end, focal point and captions as defaults,
|
|
12856
13050
|
* and a field overrides any of them by setting its own. Uploading in such a
|
|
12857
|
-
* field adds to the
|
|
12858
|
-
*
|
|
13051
|
+
* field adds to the directory. Call `.remote()` on the result to store the
|
|
13052
|
+
* videos on Val Remote.
|
|
12859
13053
|
*
|
|
12860
13054
|
* @example
|
|
12861
13055
|
* ```typescript
|
|
12862
|
-
* const schema = s.
|
|
12863
|
-
* dir: "/public/val/videos",
|
|
13056
|
+
* const schema = s.videodir("/public/val/videos", {
|
|
12864
13057
|
* stream: { type: "hls" },
|
|
12865
13058
|
* });
|
|
12866
13059
|
* export default c.define("/content/videos.val.ts", schema, {
|
|
@@ -12875,11 +13068,46 @@ var imageset = function imageset(options) {
|
|
|
12875
13068
|
* });
|
|
12876
13069
|
* ```
|
|
12877
13070
|
*/
|
|
13071
|
+
var videodir = function videodir(dir) {
|
|
13072
|
+
for (var _len = arguments.length, _ref = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
13073
|
+
_ref[_key - 1] = arguments[_key];
|
|
13074
|
+
}
|
|
13075
|
+
var options = _ref[0];
|
|
13076
|
+
return videodirOf(dir, options);
|
|
13077
|
+
};
|
|
13078
|
+
|
|
13079
|
+
/**
|
|
13080
|
+
* `s.videodir()` with `.remote()` applied: what `s.videodir` is under
|
|
13081
|
+
* `files: { remote: true }`.
|
|
13082
|
+
*/
|
|
13083
|
+
var remoteVideodir = function remoteVideodir(dir) {
|
|
13084
|
+
for (var _len2 = arguments.length, _ref2 = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
13085
|
+
_ref2[_key2 - 1] = arguments[_key2];
|
|
13086
|
+
}
|
|
13087
|
+
var options = _ref2[0];
|
|
13088
|
+
return videodirOf(dir, options).remote();
|
|
13089
|
+
};
|
|
13090
|
+
|
|
13091
|
+
/**
|
|
13092
|
+
* Define a collection of videos.
|
|
13093
|
+
*
|
|
13094
|
+
* @deprecated Use `s.videodir(dir, options)`: the directory moved out of the
|
|
13095
|
+
* options and into the first argument, and nothing else changed.
|
|
13096
|
+
*
|
|
13097
|
+
* @example
|
|
13098
|
+
* ```typescript
|
|
13099
|
+
* // was: s.videoset({ dir: "/public/val/videos", stream: { type: "hls" } })
|
|
13100
|
+
* const schema = s.videodir("/public/val/videos", { stream: { type: "hls" } });
|
|
13101
|
+
* ```
|
|
13102
|
+
*/
|
|
12878
13103
|
var videoset = function videoset(options) {
|
|
13104
|
+
return videodirOf(options.dir, options);
|
|
13105
|
+
};
|
|
13106
|
+
function videodirOf(dir, options) {
|
|
12879
13107
|
var _options$alt, _options$accept;
|
|
12880
|
-
// The same assertion as in `
|
|
12881
|
-
// `
|
|
12882
|
-
var altSchema = (_options$alt = options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
|
|
13108
|
+
// The same assertion as in `imagedir()`, and sound for the same reason:
|
|
13109
|
+
// `VideodirAltOption` makes `alt` required unless `Alt` is the default.
|
|
13110
|
+
var altSchema = (_options$alt = options === null || options === void 0 ? void 0 : options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
|
|
12883
13111
|
var itemSchema = new ObjectSchema({
|
|
12884
13112
|
mimeType: new StringSchema({}, false),
|
|
12885
13113
|
width: new NumberSchema(undefined, false),
|
|
@@ -12889,13 +13117,13 @@ var videoset = function videoset(options) {
|
|
|
12889
13117
|
}, false);
|
|
12890
13118
|
return new RecordSchema(itemSchema, false, [], null, null, {
|
|
12891
13119
|
type: "videos",
|
|
12892
|
-
accept: (_options$accept = options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_VIDEO_ACCEPT,
|
|
12893
|
-
dir:
|
|
13120
|
+
accept: (_options$accept = options === null || options === void 0 ? void 0 : options.accept) !== null && _options$accept !== void 0 ? _options$accept : DEFAULT_VIDEO_ACCEPT,
|
|
13121
|
+
dir: dir,
|
|
12894
13122
|
remote: false,
|
|
12895
13123
|
altSchema: altSchema,
|
|
12896
|
-
stream: options.stream
|
|
13124
|
+
stream: options === null || options === void 0 ? void 0 : options.stream
|
|
12897
13125
|
});
|
|
12898
|
-
}
|
|
13126
|
+
}
|
|
12899
13127
|
|
|
12900
13128
|
/**
|
|
12901
13129
|
* The video schema a set's entry is hashed against, for a remote ref.
|
|
@@ -12934,6 +13162,14 @@ function initSchema(options) {
|
|
|
12934
13162
|
font: remoteFont,
|
|
12935
13163
|
video: remoteVideo,
|
|
12936
13164
|
richtext: remoteRichtext,
|
|
13165
|
+
imagedir: remoteImagedir,
|
|
13166
|
+
filedir: function (dir, options) {
|
|
13167
|
+
return filedir(dir, options).remote();
|
|
13168
|
+
},
|
|
13169
|
+
fontdir: function (dir, options) {
|
|
13170
|
+
return fontdir(dir, options).remote();
|
|
13171
|
+
},
|
|
13172
|
+
videodir: remoteVideodir,
|
|
12937
13173
|
imageset: function (options) {
|
|
12938
13174
|
return imageset(options).remote();
|
|
12939
13175
|
},
|
|
@@ -12952,6 +13188,10 @@ function initSchema(options) {
|
|
|
12952
13188
|
font: font,
|
|
12953
13189
|
video: video,
|
|
12954
13190
|
richtext: richtext,
|
|
13191
|
+
imagedir: imagedir,
|
|
13192
|
+
filedir: filedir,
|
|
13193
|
+
fontdir: fontdir,
|
|
13194
|
+
videodir: videodir,
|
|
12955
13195
|
imageset: imageset,
|
|
12956
13196
|
fileset: fileset,
|
|
12957
13197
|
fontset: fontset,
|
|
@@ -12977,6 +13217,8 @@ function initSchema(options) {
|
|
|
12977
13217
|
file: media.file,
|
|
12978
13218
|
font: media.font,
|
|
12979
13219
|
video: media.video,
|
|
13220
|
+
filedir: media.filedir,
|
|
13221
|
+
fontdir: media.fontdir,
|
|
12980
13222
|
fileset: media.fileset,
|
|
12981
13223
|
fontset: media.fontset,
|
|
12982
13224
|
date: date,
|
|
@@ -12986,6 +13228,8 @@ function initSchema(options) {
|
|
|
12986
13228
|
locale: locale,
|
|
12987
13229
|
route: route,
|
|
12988
13230
|
router: router,
|
|
13231
|
+
imagedir: media.imagedir,
|
|
13232
|
+
videodir: media.videodir,
|
|
12989
13233
|
imageset: media.imageset,
|
|
12990
13234
|
videoset: media.videoset,
|
|
12991
13235
|
settings: settings
|
|
@@ -14082,7 +14326,7 @@ function _extractValModules() {
|
|
|
14082
14326
|
* The one answer to that question. There used to be two — `hasRemoteFileSchema`
|
|
14083
14327
|
* in the server, gating whether `/save` demands remote credentials, and
|
|
14084
14328
|
* `findRequiredRemoteFiles` in the Studio, gating the `/remote/settings` fetch —
|
|
14085
|
-
* and they disagreed about `s.
|
|
14329
|
+
* and they disagreed about `s.imagedir(dir, { ... }).remote()`: the Studio's version
|
|
14086
14330
|
* counted a remote media record, the server's did not, because a media
|
|
14087
14331
|
* collection serializes as a `record` of metadata rather than as an image
|
|
14088
14332
|
* schema.
|
|
@@ -14122,7 +14366,7 @@ function hasRemoteFileSchema(schema) {
|
|
|
14122
14366
|
return hasRemoteFileSchema(schema.item);
|
|
14123
14367
|
} else if (schema.type === "record") {
|
|
14124
14368
|
/**
|
|
14125
|
-
* A media collection — `s.
|
|
14369
|
+
* A media collection — `s.imagedir()` / `s.filedir()` — is the case both of the
|
|
14126
14370
|
* old functions were written around, and the one they disagreed on.
|
|
14127
14371
|
*
|
|
14128
14372
|
* It has no file or image schema inside it to find: `item` is an object of
|
|
@@ -14182,8 +14426,8 @@ function hasRemoteFileSchema(schema) {
|
|
|
14182
14426
|
*
|
|
14183
14427
|
* It is a walk over the SERIALIZED schema for the reasons given above, and for
|
|
14184
14428
|
* one more that is specific to this question: the two cases most likely to be
|
|
14185
|
-
* missed are invisible to a value type. A media collection (`s.
|
|
14186
|
-
* `s.
|
|
14429
|
+
* missed are invisible to a value type. A media collection (`s.imagedir()` /
|
|
14430
|
+
* `s.filedir()`) serializes as a record of metadata with no image schema inside
|
|
14187
14431
|
* it, and a richtext inline image lives in a constructor argument. A check
|
|
14188
14432
|
* written against the item TYPE would silently pass both — and the gallery case
|
|
14189
14433
|
* already has a data-loss incident attached to it (see above).
|
|
@@ -15064,7 +15308,7 @@ function deserializeSchemaImpl(serialized) {
|
|
|
15064
15308
|
* `s.array(s.object({ tags: s.array(s.string()) })).render({ as: "inline" })`
|
|
15065
15309
|
* the objects are inline and `tags` keeps its own default.
|
|
15066
15310
|
*
|
|
15067
|
-
* Not available on `s.router(...)`, `s.
|
|
15311
|
+
* Not available on `s.router(...)`, `s.imagedir(...)` or `s.filedir(...)`:
|
|
15068
15312
|
* pages and media have UIs of their own, and `RecordSchema.render` throws there.
|
|
15069
15313
|
*
|
|
15070
15314
|
* On `s.keyOf(...)` the same value means something else: the selected entry's
|
|
@@ -15657,7 +15901,7 @@ function isPageRouter(routerId) {
|
|
|
15657
15901
|
|
|
15658
15902
|
var corePackageJson = {
|
|
15659
15903
|
name: "@valbuild/core",
|
|
15660
|
-
version: "0.
|
|
15904
|
+
version: "0.144.0",
|
|
15661
15905
|
"private": false,
|
|
15662
15906
|
description: "Val - supercharged hard-coded content",
|
|
15663
15907
|
repository: {
|
|
@@ -15763,6 +16007,7 @@ var Internal = {
|
|
|
15763
16007
|
fillFromGallery: fillFromGallery,
|
|
15764
16008
|
galleriesOf: galleriesOf,
|
|
15765
16009
|
galleryEntryOf: galleryEntryOf,
|
|
16010
|
+
galleryKeyOf: galleryKeyOf,
|
|
15766
16011
|
GALLERY_DEFAULT_GROUPS: GALLERY_DEFAULT_GROUPS,
|
|
15767
16012
|
isHlsVideo: isHlsVideo,
|
|
15768
16013
|
HLS_MIME_TYPE: HLS_MIME_TYPE
|