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