@prismicio/types-internal 2.2.1-alpha.0 → 2.2.1
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/lib/common/UUID.d.ts +1 -2
- package/package.json +1 -1
- package/src/common/UUID.ts +1 -1
- package/lib/import/converters/Document.d.ts +0 -4
- package/lib/import/converters/Document.js +0 -21
- package/lib/import/converters/fields/Group.d.ts +0 -4
- package/lib/import/converters/fields/Group.js +0 -14
- package/lib/import/converters/fields/RepeatableZone.d.ts +0 -317
- package/lib/import/converters/fields/RepeatableZone.js +0 -15
- package/lib/import/converters/fields/RepeatableZoneItem.d.ts +0 -11
- package/lib/import/converters/fields/RepeatableZoneItem.js +0 -19
- package/lib/import/converters/fields/Slices/SharedSlice.d.ts +0 -4
- package/lib/import/converters/fields/Slices/SharedSlice.js +0 -19
- package/lib/import/converters/fields/Slices/SharedSliceContent.d.ts +0 -10
- package/lib/import/converters/fields/Slices/SharedSliceContent.js +0 -23
- package/lib/import/converters/fields/Slices/Slices.d.ts +0 -4
- package/lib/import/converters/fields/Slices/Slices.js +0 -16
- package/lib/import/converters/fields/Slices/index.d.ts +0 -1
- package/lib/import/converters/fields/Slices/index.js +0 -4
- package/lib/import/converters/fields/UID.d.ts +0 -3
- package/lib/import/converters/fields/UID.js +0 -10
- package/lib/import/converters/fields/index.d.ts +0 -4
- package/lib/import/converters/fields/index.js +0 -7
- package/lib/import/converters/fields/nestable/Boolean.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Boolean.js +0 -12
- package/lib/import/converters/fields/nestable/Color.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Color.js +0 -13
- package/lib/import/converters/fields/nestable/Date.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Date.js +0 -15
- package/lib/import/converters/fields/nestable/Embed.d.ts +0 -4
- package/lib/import/converters/fields/nestable/Embed.js +0 -32
- package/lib/import/converters/fields/nestable/GeoPoint.d.ts +0 -3
- package/lib/import/converters/fields/nestable/GeoPoint.js +0 -15
- package/lib/import/converters/fields/nestable/Image.d.ts +0 -28
- package/lib/import/converters/fields/nestable/Image.js +0 -67
- package/lib/import/converters/fields/nestable/Link.d.ts +0 -4
- package/lib/import/converters/fields/nestable/Link.js +0 -70
- package/lib/import/converters/fields/nestable/Nestable.d.ts +0 -5
- package/lib/import/converters/fields/nestable/Nestable.js +0 -35
- package/lib/import/converters/fields/nestable/Number.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Number.js +0 -13
- package/lib/import/converters/fields/nestable/RichText/embedBlock.d.ts +0 -4
- package/lib/import/converters/fields/nestable/RichText/embedBlock.js +0 -14
- package/lib/import/converters/fields/nestable/RichText/imageBlock.d.ts +0 -4
- package/lib/import/converters/fields/nestable/RichText/imageBlock.js +0 -12
- package/lib/import/converters/fields/nestable/RichText/index.d.ts +0 -4
- package/lib/import/converters/fields/nestable/RichText/index.js +0 -22
- package/lib/import/converters/fields/nestable/RichText/textBlock.d.ts +0 -4
- package/lib/import/converters/fields/nestable/RichText/textBlock.js +0 -54
- package/lib/import/converters/fields/nestable/Select.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Select.js +0 -13
- package/lib/import/converters/fields/nestable/Text.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Text.js +0 -13
- package/lib/import/converters/fields/nestable/Timestamp.d.ts +0 -3
- package/lib/import/converters/fields/nestable/Timestamp.js +0 -13
- package/lib/import/converters/fields/nestable/index.d.ts +0 -13
- package/lib/import/converters/fields/nestable/index.js +0 -16
- package/lib/import/converters/index.d.ts +0 -2
- package/lib/import/converters/index.js +0 -5
- package/lib/import/index.d.ts +0 -2
- package/lib/import/index.js +0 -5
- package/lib/import/validators/Document.d.ts +0 -6
- package/lib/import/validators/Document.js +0 -64
- package/lib/import/validators/fields/ImportContent.d.ts +0 -5
- package/lib/import/validators/fields/ImportContent.js +0 -21
- package/lib/import/validators/fields/ImportField.d.ts +0 -141
- package/lib/import/validators/fields/ImportField.js +0 -33
- package/lib/import/validators/fields/ImportGroup.d.ts +0 -345
- package/lib/import/validators/fields/ImportGroup.js +0 -27
- package/lib/import/validators/fields/ImportSlices/ImportSlices.d.ts +0 -8
- package/lib/import/validators/fields/ImportSlices/ImportSlices.js +0 -30
- package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.d.ts +0 -16
- package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.js +0 -61
- package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.d.ts +0 -4
- package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.js +0 -7
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.d.ts +0 -2
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.js +0 -15
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.d.ts +0 -9
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.js +0 -39
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.d.ts +0 -11
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.js +0 -24
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.d.ts +0 -11
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.js +0 -24
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.d.ts +0 -4
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.js +0 -7
- package/lib/import/validators/fields/ImportSlices/SharedSlice/index.d.ts +0 -3
- package/lib/import/validators/fields/ImportSlices/SharedSlice/index.js +0 -6
- package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.d.ts +0 -342
- package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.js +0 -11
- package/lib/import/validators/fields/ImportSlices/index.d.ts +0 -1
- package/lib/import/validators/fields/ImportSlices/index.js +0 -4
- package/lib/import/validators/fields/ImportSlices/utils.d.ts +0 -4
- package/lib/import/validators/fields/ImportSlices/utils.js +0 -35
- package/lib/import/validators/fields/RepeatableZone.d.ts +0 -11
- package/lib/import/validators/fields/RepeatableZone.js +0 -14
- package/lib/import/validators/fields/RepeatableZoneItem.d.ts +0 -11
- package/lib/import/validators/fields/RepeatableZoneItem.js +0 -39
- package/lib/import/validators/fields/UID.d.ts +0 -6
- package/lib/import/validators/fields/UID.js +0 -15
- package/lib/import/validators/fields/index.d.ts +0 -4
- package/lib/import/validators/fields/index.js +0 -7
- package/lib/import/validators/fields/nestable/Boolean.d.ts +0 -6
- package/lib/import/validators/fields/nestable/Boolean.js +0 -6
- package/lib/import/validators/fields/nestable/Color.d.ts +0 -6
- package/lib/import/validators/fields/nestable/Color.js +0 -15
- package/lib/import/validators/fields/nestable/Date.d.ts +0 -6
- package/lib/import/validators/fields/nestable/Date.js +0 -19
- package/lib/import/validators/fields/nestable/Embed.d.ts +0 -13
- package/lib/import/validators/fields/nestable/Embed.js +0 -31
- package/lib/import/validators/fields/nestable/GeoPoint.d.ts +0 -13
- package/lib/import/validators/fields/nestable/GeoPoint.js +0 -13
- package/lib/import/validators/fields/nestable/Image/default.d.ts +0 -22
- package/lib/import/validators/fields/nestable/Image/default.js +0 -19
- package/lib/import/validators/fields/nestable/Image/index.d.ts +0 -26
- package/lib/import/validators/fields/nestable/Image/index.js +0 -32
- package/lib/import/validators/fields/nestable/Image/merge.d.ts +0 -23
- package/lib/import/validators/fields/nestable/Image/merge.js +0 -44
- package/lib/import/validators/fields/nestable/Image/model.d.ts +0 -18
- package/lib/import/validators/fields/nestable/Image/model.js +0 -2
- package/lib/import/validators/fields/nestable/Image/validators.d.ts +0 -132
- package/lib/import/validators/fields/nestable/Image/validators.js +0 -43
- package/lib/import/validators/fields/nestable/ImportRichText/ImportBlock.d.ts +0 -6
- package/lib/import/validators/fields/nestable/ImportRichText/ImportBlock.js +0 -25
- package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.d.ts +0 -24
- package/lib/import/validators/fields/nestable/ImportRichText/ImportRichText.js +0 -32
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.d.ts +0 -6
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.js +0 -18
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.d.ts +0 -10
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.js +0 -11
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.d.ts +0 -22
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.js +0 -13
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.d.ts +0 -78
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.js +0 -43
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/Span.d.ts +0 -79
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/Span.js +0 -27
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/index.d.ts +0 -4
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/index.js +0 -7
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.d.ts +0 -24
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.js +0 -18
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.d.ts +0 -12
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.js +0 -16
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.d.ts +0 -5
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.js +0 -10
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.d.ts +0 -15
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.js +0 -20
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/index.d.ts +0 -2
- package/lib/import/validators/fields/nestable/ImportRichText/blocks/spans/index.js +0 -5
- package/lib/import/validators/fields/nestable/ImportRichText/index.d.ts +0 -2
- package/lib/import/validators/fields/nestable/ImportRichText/index.js +0 -7
- package/lib/import/validators/fields/nestable/Link.d.ts +0 -53
- package/lib/import/validators/fields/nestable/Link.js +0 -35
- package/lib/import/validators/fields/nestable/Nestable.d.ts +0 -192
- package/lib/import/validators/fields/nestable/Nestable.js +0 -71
- package/lib/import/validators/fields/nestable/Number.d.ts +0 -17
- package/lib/import/validators/fields/nestable/Number.js +0 -17
- package/lib/import/validators/fields/nestable/Select.d.ts +0 -16
- package/lib/import/validators/fields/nestable/Select.js +0 -19
- package/lib/import/validators/fields/nestable/Text.d.ts +0 -6
- package/lib/import/validators/fields/nestable/Text.js +0 -6
- package/lib/import/validators/fields/nestable/Timestamp.d.ts +0 -7
- package/lib/import/validators/fields/nestable/Timestamp.js +0 -19
- package/lib/import/validators/fields/nestable/index.d.ts +0 -14
- package/lib/import/validators/fields/nestable/index.js +0 -19
- package/lib/import/validators/index.d.ts +0 -2
- package/lib/import/validators/index.js +0 -5
- package/src/import/converters/Document.ts +0 -38
- package/src/import/converters/fields/Group.ts +0 -18
- package/src/import/converters/fields/RepeatableZone.ts +0 -19
- package/src/import/converters/fields/RepeatableZoneItem.ts +0 -32
- package/src/import/converters/fields/Slices/SharedSlice.ts +0 -24
- package/src/import/converters/fields/Slices/SharedSliceContent.ts +0 -27
- package/src/import/converters/fields/Slices/Slices.ts +0 -20
- package/src/import/converters/fields/Slices/index.ts +0 -1
- package/src/import/converters/fields/UID.ts +0 -9
- package/src/import/converters/fields/index.ts +0 -4
- package/src/import/converters/fields/nestable/Boolean.ts +0 -13
- package/src/import/converters/fields/nestable/Color.ts +0 -14
- package/src/import/converters/fields/nestable/Date.ts +0 -17
- package/src/import/converters/fields/nestable/Embed.ts +0 -37
- package/src/import/converters/fields/nestable/GeoPoint.ts +0 -16
- package/src/import/converters/fields/nestable/Image.ts +0 -91
- package/src/import/converters/fields/nestable/Link.ts +0 -77
- package/src/import/converters/fields/nestable/Nestable.ts +0 -55
- package/src/import/converters/fields/nestable/Number.ts +0 -14
- package/src/import/converters/fields/nestable/RichText/embedBlock.ts +0 -17
- package/src/import/converters/fields/nestable/RichText/imageBlock.ts +0 -17
- package/src/import/converters/fields/nestable/RichText/index.ts +0 -23
- package/src/import/converters/fields/nestable/RichText/textBlock.ts +0 -62
- package/src/import/converters/fields/nestable/Select.ts +0 -14
- package/src/import/converters/fields/nestable/Text.ts +0 -14
- package/src/import/converters/fields/nestable/Timestamp.ts +0 -14
- package/src/import/converters/fields/nestable/index.ts +0 -13
- package/src/import/converters/index.ts +0 -2
- package/src/import/index.ts +0 -2
- package/src/import/validators/Document.ts +0 -103
- package/src/import/validators/fields/ImportContent.ts +0 -30
- package/src/import/validators/fields/ImportField.ts +0 -36
- package/src/import/validators/fields/ImportGroup.ts +0 -45
- package/src/import/validators/fields/ImportSlices/ImportSlices.ts +0 -56
- package/src/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.ts +0 -104
- package/src/import/validators/fields/ImportSlices/SharedSlice/errors.ts +0 -6
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.ts +0 -20
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.ts +0 -65
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.ts +0 -45
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.ts +0 -45
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/index.ts +0 -4
- package/src/import/validators/fields/ImportSlices/SharedSlice/index.ts +0 -3
- package/src/import/validators/fields/ImportSlices/SharedSlice/utils.ts +0 -21
- package/src/import/validators/fields/ImportSlices/index.ts +0 -1
- package/src/import/validators/fields/ImportSlices/utils.ts +0 -43
- package/src/import/validators/fields/RepeatableZone.ts +0 -21
- package/src/import/validators/fields/RepeatableZoneItem.ts +0 -64
- package/src/import/validators/fields/UID.ts +0 -27
- package/src/import/validators/fields/index.ts +0 -4
- package/src/import/validators/fields/nestable/Boolean.ts +0 -7
- package/src/import/validators/fields/nestable/Color.ts +0 -28
- package/src/import/validators/fields/nestable/Date.ts +0 -34
- package/src/import/validators/fields/nestable/Embed.ts +0 -41
- package/src/import/validators/fields/nestable/GeoPoint.ts +0 -21
- package/src/import/validators/fields/nestable/Image/default.ts +0 -22
- package/src/import/validators/fields/nestable/Image/index.ts +0 -66
- package/src/import/validators/fields/nestable/Image/merge.ts +0 -64
- package/src/import/validators/fields/nestable/Image/model.ts +0 -18
- package/src/import/validators/fields/nestable/Image/validators.ts +0 -70
- package/src/import/validators/fields/nestable/ImportRichText/ImportBlock.ts +0 -39
- package/src/import/validators/fields/nestable/ImportRichText/ImportRichText.ts +0 -54
- package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportBlockType.ts +0 -44
- package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportEmbedBlock.ts +0 -13
- package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportImageBlock.ts +0 -17
- package/src/import/validators/fields/nestable/ImportRichText/blocks/ImportTextBlock.ts +0 -56
- package/src/import/validators/fields/nestable/ImportRichText/blocks/Span.ts +0 -48
- package/src/import/validators/fields/nestable/ImportRichText/blocks/index.ts +0 -4
- package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/HyperlinkSpan.ts +0 -24
- package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/LabelSpan.ts +0 -19
- package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/SpanLocation.ts +0 -8
- package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/TextSpan.ts +0 -24
- package/src/import/validators/fields/nestable/ImportRichText/blocks/spans/index.ts +0 -2
- package/src/import/validators/fields/nestable/ImportRichText/index.ts +0 -2
- package/src/import/validators/fields/nestable/Link.ts +0 -59
- package/src/import/validators/fields/nestable/Nestable.ts +0 -88
- package/src/import/validators/fields/nestable/Number.ts +0 -38
- package/src/import/validators/fields/nestable/Select.ts +0 -38
- package/src/import/validators/fields/nestable/Text.ts +0 -7
- package/src/import/validators/fields/nestable/Timestamp.ts +0 -39
- package/src/import/validators/fields/nestable/index.ts +0 -14
- package/src/import/validators/index.ts +0 -2
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportUID = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const validators_1 = require("../../../validators");
|
|
7
|
-
const ImportContent_1 = require("./ImportContent");
|
|
8
|
-
const regex = /^[a-z0-9-_.]+$/;
|
|
9
|
-
const uidValue = validators_1.String.pipe(new t.Type("ImportUIDField", (u) => validators_1.String.is(u), (n, c) => {
|
|
10
|
-
if (regex.test(n)) {
|
|
11
|
-
return t.success(n);
|
|
12
|
-
}
|
|
13
|
-
return t.failure(n, c, "UID can only contain alphanumeric characters, dashes, underscores, and dots");
|
|
14
|
-
}, t.identity));
|
|
15
|
-
exports.ImportUID = (0, ImportContent_1.ImportContent)("UID", uidValue);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./nestable"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./RepeatableZone"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./RepeatableZoneItem"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./UID"), exports);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportBoolean = void 0;
|
|
4
|
-
const validators_1 = require("../../../../validators");
|
|
5
|
-
const ImportContent_1 = require("../ImportContent");
|
|
6
|
-
exports.ImportBoolean = (0, ImportContent_1.ImportContent)("Boolean", (0, validators_1.NullOrElse)(validators_1.Boolean));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportColor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const HexaColorCode_1 = require("../../../../common/HexaColorCode");
|
|
7
|
-
const validators_1 = require("../../../../validators");
|
|
8
|
-
const ImportContent_1 = require("../ImportContent");
|
|
9
|
-
const colorValue = new t.Type("ImportColorValue", (u) => validators_1.String.is(u) && HexaColorCode_1.HexaColor.is(u), (s, c) => {
|
|
10
|
-
if (!HexaColorCode_1.HexaColor.is(s)) {
|
|
11
|
-
return t.failure(s, c, "The color value must be an hexadecimal color code");
|
|
12
|
-
}
|
|
13
|
-
return t.success(s);
|
|
14
|
-
}, t.identity);
|
|
15
|
-
exports.ImportColor = (0, ImportContent_1.ImportContent)("Color", (0, validators_1.NullOrElse)(validators_1.String.pipe(colorValue)));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportDate = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const Either_1 = require("fp-ts/Either");
|
|
6
|
-
const function_1 = require("fp-ts/function");
|
|
7
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
8
|
-
const validators_1 = require("../../../../validators");
|
|
9
|
-
const ImportContent_1 = require("../ImportContent");
|
|
10
|
-
const DATE_INPUT_REGEX = /^(\d{1,4})-(\d{1,2})-(\d{1,2})$/;
|
|
11
|
-
const dateValue = new t.Type("ImportNumberValue", (u) => u instanceof Date, (u, c) => (0, function_1.pipe)(validators_1.String.validate(u, c), (0, Either_1.chain)((s) => {
|
|
12
|
-
const date = new Date(s);
|
|
13
|
-
const isInvalidDate = isNaN(date.getTime());
|
|
14
|
-
if (isInvalidDate || !DATE_INPUT_REGEX.test(s)) {
|
|
15
|
-
return t.failure(u, c, "The value must be a Date in the format YYYY-MM-DD");
|
|
16
|
-
}
|
|
17
|
-
return t.success(date);
|
|
18
|
-
})), t.identity);
|
|
19
|
-
exports.ImportDate = (0, ImportContent_1.ImportContent)("Date", (0, validators_1.NullOrElse)(dateValue));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as t from "io-ts";
|
|
2
|
-
export declare const ImportEmbedValue: t.ExactC<t.TypeC<{
|
|
3
|
-
embed_url: t.Type<string, string, unknown>;
|
|
4
|
-
}>>;
|
|
5
|
-
export declare const ImportEmbed: t.Type<{
|
|
6
|
-
type: "Embed";
|
|
7
|
-
value: {
|
|
8
|
-
embed_url: string;
|
|
9
|
-
} | null;
|
|
10
|
-
}, {
|
|
11
|
-
embed_url: string;
|
|
12
|
-
} | undefined, unknown>;
|
|
13
|
-
export declare type ImportEmbed = t.TypeOf<typeof ImportEmbed>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportEmbed = exports.ImportEmbedValue = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const validators_1 = require("../../../../validators");
|
|
7
|
-
const ImportContent_1 = require("../ImportContent");
|
|
8
|
-
function isValidHttpUrl(param) {
|
|
9
|
-
try {
|
|
10
|
-
if (typeof param !== "string") {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
const url = new URL(param);
|
|
14
|
-
return ["http:", "https:"].includes(url.protocol);
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const EmbedUrl = new t.Type("EmbedUrl", (u) => isValidHttpUrl(u), (u, c) => {
|
|
21
|
-
if (isValidHttpUrl(u)) {
|
|
22
|
-
return t.success(u);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return t.failure(u, c, "The value must be a valid http/https url");
|
|
26
|
-
}
|
|
27
|
-
}, t.identity);
|
|
28
|
-
exports.ImportEmbedValue = t.strict({
|
|
29
|
-
embed_url: EmbedUrl,
|
|
30
|
-
});
|
|
31
|
-
exports.ImportEmbed = (0, ImportContent_1.ImportContent)("Embed", (0, validators_1.EmptyObjectOrElse)(exports.ImportEmbedValue));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { TypeOf } from "io-ts";
|
|
2
|
-
import * as t from "io-ts";
|
|
3
|
-
export declare const ImportGeoPoint: t.Type<{
|
|
4
|
-
type: "GeoPoint";
|
|
5
|
-
value: {
|
|
6
|
-
latitude: number;
|
|
7
|
-
longitude: number;
|
|
8
|
-
} | null;
|
|
9
|
-
}, {
|
|
10
|
-
latitude: number;
|
|
11
|
-
longitude: number;
|
|
12
|
-
} | undefined, unknown>;
|
|
13
|
-
export declare type ImportGeoPoint = TypeOf<typeof ImportGeoPoint>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportGeoPoint = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const validators_1 = require("../../../../validators");
|
|
7
|
-
const function_1 = require("../../../../validators/function");
|
|
8
|
-
const ImportContent_1 = require("../ImportContent");
|
|
9
|
-
const GeoPoint = (0, function_1.withCustomError)(t.strict({
|
|
10
|
-
latitude: (0, validators_1.NumberRange)(-90, 90, "latitude"),
|
|
11
|
-
longitude: (0, validators_1.NumberRange)(-180, 180, "longitude"),
|
|
12
|
-
}), () => "GeoPoint must be an object with the properties `latitude` and `longitude` between the given ranges");
|
|
13
|
-
exports.ImportGeoPoint = (0, ImportContent_1.ImportContent)("GeoPoint", (0, validators_1.EmptyObjectOrElse)(GeoPoint));
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as t from "io-ts";
|
|
2
|
-
export declare const defaultImportImage: (field?: ({
|
|
3
|
-
type: "Image";
|
|
4
|
-
} & {
|
|
5
|
-
fieldset?: string | null | undefined;
|
|
6
|
-
config?: {
|
|
7
|
-
label?: string | null | undefined;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
constraint?: {
|
|
10
|
-
width?: number | null;
|
|
11
|
-
height?: number | null;
|
|
12
|
-
};
|
|
13
|
-
thumbnails?: readonly ({
|
|
14
|
-
name: string;
|
|
15
|
-
} & {
|
|
16
|
-
width?: number | null;
|
|
17
|
-
height?: number | null;
|
|
18
|
-
})[];
|
|
19
|
-
};
|
|
20
|
-
}) | undefined) => t.Type<Record<never, never>, {
|
|
21
|
-
[key: string]: unknown;
|
|
22
|
-
}, unknown>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultImportImage = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const validators_1 = require("../../../../../validators");
|
|
7
|
-
const defaultImportImage = (field) => {
|
|
8
|
-
var _a;
|
|
9
|
-
// If there is not thumbnails we expect an empty object
|
|
10
|
-
if (!((_a = field === null || field === void 0 ? void 0 : field.config) === null || _a === void 0 ? void 0 : _a.thumbnails) || !field.config.thumbnails.length)
|
|
11
|
-
return validators_1.EmptyObject;
|
|
12
|
-
// If there are thumbnails, we can expect an object with thumbnails as empty objects,
|
|
13
|
-
// however we don't accept any other properties for the empty state
|
|
14
|
-
return t.strict(field.config.thumbnails.reduce((acc, thumbnail) => ({
|
|
15
|
-
...acc,
|
|
16
|
-
[thumbnail.name]: validators_1.EmptyObject,
|
|
17
|
-
}), {}));
|
|
18
|
-
};
|
|
19
|
-
exports.defaultImportImage = defaultImportImage;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as t from "io-ts";
|
|
2
|
-
import type { ImageFieldWithThumbnails } from "./model";
|
|
3
|
-
export declare const ImportImage: (field?: ({
|
|
4
|
-
type: "Image";
|
|
5
|
-
} & {
|
|
6
|
-
fieldset?: string | null | undefined;
|
|
7
|
-
config?: {
|
|
8
|
-
label?: string | null | undefined;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
constraint?: {
|
|
11
|
-
width?: number | null;
|
|
12
|
-
height?: number | null;
|
|
13
|
-
};
|
|
14
|
-
thumbnails?: readonly ({
|
|
15
|
-
name: string;
|
|
16
|
-
} & {
|
|
17
|
-
width?: number | null;
|
|
18
|
-
height?: number | null;
|
|
19
|
-
})[];
|
|
20
|
-
};
|
|
21
|
-
}) | undefined) => t.Type<{
|
|
22
|
-
type: "Image";
|
|
23
|
-
value: ImageFieldWithThumbnails | null;
|
|
24
|
-
}, ImageFieldWithThumbnails | undefined, unknown>;
|
|
25
|
-
export declare type ImportImage = t.TypeOf<ReturnType<typeof ImportImage>>;
|
|
26
|
-
export * from "./model";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportImage = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const Either_1 = require("fp-ts/Either");
|
|
6
|
-
const function_1 = require("fp-ts/function");
|
|
7
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
8
|
-
const validators_1 = require("../../../../../validators");
|
|
9
|
-
const function_2 = require("../../../../../validators/function");
|
|
10
|
-
const ImportContent_1 = require("../../ImportContent");
|
|
11
|
-
const default_1 = require("./default");
|
|
12
|
-
const merge_1 = require("./merge");
|
|
13
|
-
const validators_2 = require("./validators");
|
|
14
|
-
/* For code clarity, the output of this validator will be simplified
|
|
15
|
-
*
|
|
16
|
-
* Input -> type ImageAPIV2 = ImportImageView & ImportThumbnails
|
|
17
|
-
* Output -> type ImageWithThumbnails 👇
|
|
18
|
-
*/
|
|
19
|
-
const ImageFieldCodec = (field) => {
|
|
20
|
-
const ImageCodec = (0, validators_2.ImportImageWithThumbnails)(field);
|
|
21
|
-
return new t.Type("ImageField", (u) => ImageCodec.is(u), (u, ctx) => (0, function_1.pipe)(ImageCodec.validate(u, ctx), (0, Either_1.map)((imageApiV2) => {
|
|
22
|
-
var _a;
|
|
23
|
-
const { id, dimensions, edit, copyright, alt, ...thumbnails } = imageApiV2;
|
|
24
|
-
return {
|
|
25
|
-
...(0, merge_1.mergeImageViewWithCtConstraints)(imageApiV2, imageApiV2, (_a = field === null || field === void 0 ? void 0 : field.config) === null || _a === void 0 ? void 0 : _a.constraint),
|
|
26
|
-
thumbnails: (0, merge_1.mergeThumbnailsWithCtConstraints)(thumbnails, imageApiV2, field),
|
|
27
|
-
};
|
|
28
|
-
})), t.identity);
|
|
29
|
-
};
|
|
30
|
-
const ImportImage = (field) => (0, ImportContent_1.ImportContent)("Image", (0, function_2.withCustomError)((0, validators_1.DefaultOrElse)((0, default_1.defaultImportImage)(field))(ImageFieldCodec(field)), () => "An image field must be an object"));
|
|
31
|
-
exports.ImportImage = ImportImage;
|
|
32
|
-
(0, tslib_1.__exportStar)(require("./model"), exports);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type ImageConstraint from "../../../../../customtypes/widgets/shared/ImageConstraint";
|
|
2
|
-
import type { ImageField } from "./model";
|
|
3
|
-
import type { ImportImageView, ImportThumbnails } from "./validators";
|
|
4
|
-
export declare const mergeImageViewWithCtConstraints: (image: ImportImageView | undefined, defaultImage: ImportImageView, constraints: ImageConstraint | undefined) => ImageField;
|
|
5
|
-
export declare const mergeThumbnailsWithCtConstraints: (thumbnails: ImportThumbnails, defaultImage: ImportImageView, field?: ({
|
|
6
|
-
type: "Image";
|
|
7
|
-
} & {
|
|
8
|
-
fieldset?: string | null | undefined;
|
|
9
|
-
config?: {
|
|
10
|
-
label?: string | null | undefined;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
constraint?: {
|
|
13
|
-
width?: number | null;
|
|
14
|
-
height?: number | null;
|
|
15
|
-
};
|
|
16
|
-
thumbnails?: readonly ({
|
|
17
|
-
name: string;
|
|
18
|
-
} & {
|
|
19
|
-
width?: number | null;
|
|
20
|
-
height?: number | null;
|
|
21
|
-
})[];
|
|
22
|
-
};
|
|
23
|
-
}) | undefined) => {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeThumbnailsWithCtConstraints = exports.mergeImageViewWithCtConstraints = void 0;
|
|
4
|
-
/* This function merges user input with custom type constraints.
|
|
5
|
-
* If a thumbnails' data are missing (`image`) then the default is used (`defaultImage`)
|
|
6
|
-
*/
|
|
7
|
-
const mergeImageViewWithCtConstraints = (image, defaultImage, constraints) => {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
9
|
-
const background = (_a = image === null || image === void 0 ? void 0 : image.edit) === null || _a === void 0 ? void 0 : _a.background;
|
|
10
|
-
const width = (_d = (_b = constraints === null || constraints === void 0 ? void 0 : constraints.width) !== null && _b !== void 0 ? _b : (_c = image === null || image === void 0 ? void 0 : image.dimensions) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : (_e = defaultImage === null || defaultImage === void 0 ? void 0 : defaultImage.dimensions) === null || _e === void 0 ? void 0 : _e.width;
|
|
11
|
-
const height = (_h = (_f = constraints === null || constraints === void 0 ? void 0 : constraints.height) !== null && _f !== void 0 ? _f : (_g = image === null || image === void 0 ? void 0 : image.dimensions) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : (_j = defaultImage === null || defaultImage === void 0 ? void 0 : defaultImage.dimensions) === null || _j === void 0 ? void 0 : _j.height;
|
|
12
|
-
const alt = image === null || image === void 0 ? void 0 : image.alt;
|
|
13
|
-
const copyright = image === null || image === void 0 ? void 0 : image.copyright;
|
|
14
|
-
return {
|
|
15
|
-
id: (_k = image === null || image === void 0 ? void 0 : image.id) !== null && _k !== void 0 ? _k : defaultImage === null || defaultImage === void 0 ? void 0 : defaultImage.id,
|
|
16
|
-
edit: {
|
|
17
|
-
x: (_m = (_l = image === null || image === void 0 ? void 0 : image.edit) === null || _l === void 0 ? void 0 : _l.x) !== null && _m !== void 0 ? _m : 0,
|
|
18
|
-
y: (_p = (_o = image === null || image === void 0 ? void 0 : image.edit) === null || _o === void 0 ? void 0 : _o.y) !== null && _p !== void 0 ? _p : 0,
|
|
19
|
-
zoom: (_r = (_q = image === null || image === void 0 ? void 0 : image.edit) === null || _q === void 0 ? void 0 : _q.zoom) !== null && _r !== void 0 ? _r : 1,
|
|
20
|
-
...(background !== undefined ? { background } : {}),
|
|
21
|
-
},
|
|
22
|
-
dimensions: {
|
|
23
|
-
...(width !== undefined ? { width } : {}),
|
|
24
|
-
...(height !== undefined ? { height } : {}),
|
|
25
|
-
},
|
|
26
|
-
...(alt !== undefined ? { alt } : {}),
|
|
27
|
-
...(copyright !== undefined ? { copyright } : {}),
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
exports.mergeImageViewWithCtConstraints = mergeImageViewWithCtConstraints;
|
|
31
|
-
/* This function handles each thumbnail defined in the custom type.
|
|
32
|
-
*
|
|
33
|
-
* For each of them it merges the user input with custom type constraints.
|
|
34
|
-
*
|
|
35
|
-
* If a thumbnail is missing, the data from the default image is used.
|
|
36
|
-
*/
|
|
37
|
-
const mergeThumbnailsWithCtConstraints = (thumbnails, defaultImage, field) => {
|
|
38
|
-
var _a, _b, _c;
|
|
39
|
-
return (_c = (_b = (_a = field === null || field === void 0 ? void 0 : field.config) === null || _a === void 0 ? void 0 : _a.thumbnails) === null || _b === void 0 ? void 0 : _b.reduce((acc, thumbnail) => ({
|
|
40
|
-
...acc,
|
|
41
|
-
[thumbnail.name]: (0, exports.mergeImageViewWithCtConstraints)(thumbnails[thumbnail.name], defaultImage, thumbnail),
|
|
42
|
-
}), {})) !== null && _c !== void 0 ? _c : {};
|
|
43
|
-
};
|
|
44
|
-
exports.mergeThumbnailsWithCtConstraints = mergeThumbnailsWithCtConstraints;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare type ImageField = {
|
|
2
|
-
id: string;
|
|
3
|
-
edit: {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
zoom: number;
|
|
7
|
-
background?: string;
|
|
8
|
-
};
|
|
9
|
-
dimensions: {
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
};
|
|
13
|
-
copyright?: string | null;
|
|
14
|
-
alt?: string | null;
|
|
15
|
-
};
|
|
16
|
-
export declare type ImageFieldWithThumbnails = ImageField & {
|
|
17
|
-
thumbnails: Record<string, ImageField>;
|
|
18
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as t from "io-ts";
|
|
2
|
-
import type { Thumbnail } from "../../../../../customtypes";
|
|
3
|
-
export declare const ImportImageViewShape: t.IntersectionC<[t.TypeC<{
|
|
4
|
-
id: t.StringC;
|
|
5
|
-
}>, t.PartialC<{
|
|
6
|
-
dimensions: t.PartialC<{
|
|
7
|
-
width: t.NumberC;
|
|
8
|
-
height: t.NumberC;
|
|
9
|
-
}>;
|
|
10
|
-
edit: t.PartialC<{
|
|
11
|
-
x: t.NumberC;
|
|
12
|
-
y: t.NumberC;
|
|
13
|
-
zoom: t.NumberC;
|
|
14
|
-
background: t.StringC;
|
|
15
|
-
}>;
|
|
16
|
-
copyright: t.UnionC<[t.StringC, t.NullC]>;
|
|
17
|
-
alt: t.UnionC<[t.StringC, t.NullC]>;
|
|
18
|
-
}>]>;
|
|
19
|
-
export declare const ImportImageView: t.IntersectionC<[t.TypeC<{
|
|
20
|
-
id: t.StringC;
|
|
21
|
-
}>, t.PartialC<{
|
|
22
|
-
dimensions: t.PartialC<{
|
|
23
|
-
width: t.NumberC;
|
|
24
|
-
height: t.NumberC;
|
|
25
|
-
}>;
|
|
26
|
-
edit: t.PartialC<{
|
|
27
|
-
x: t.NumberC;
|
|
28
|
-
y: t.NumberC;
|
|
29
|
-
zoom: t.NumberC;
|
|
30
|
-
background: t.StringC;
|
|
31
|
-
}>;
|
|
32
|
-
copyright: t.UnionC<[t.StringC, t.NullC]>;
|
|
33
|
-
alt: t.UnionC<[t.StringC, t.NullC]>;
|
|
34
|
-
}>]>;
|
|
35
|
-
export declare type ImportImageView = t.TypeOf<typeof ImportImageView>;
|
|
36
|
-
declare const ImportThumbnails: (thumbnails: readonly Thumbnail[]) => t.Type<Record<string, {
|
|
37
|
-
id: string;
|
|
38
|
-
} & {
|
|
39
|
-
dimensions?: {
|
|
40
|
-
width?: number;
|
|
41
|
-
height?: number;
|
|
42
|
-
};
|
|
43
|
-
edit?: {
|
|
44
|
-
x?: number;
|
|
45
|
-
y?: number;
|
|
46
|
-
zoom?: number;
|
|
47
|
-
background?: string;
|
|
48
|
-
};
|
|
49
|
-
copyright?: string | null;
|
|
50
|
-
alt?: string | null;
|
|
51
|
-
}>, Record<string, {
|
|
52
|
-
id: string;
|
|
53
|
-
} & {
|
|
54
|
-
dimensions?: {
|
|
55
|
-
width?: number;
|
|
56
|
-
height?: number;
|
|
57
|
-
};
|
|
58
|
-
edit?: {
|
|
59
|
-
x?: number;
|
|
60
|
-
y?: number;
|
|
61
|
-
zoom?: number;
|
|
62
|
-
background?: string;
|
|
63
|
-
};
|
|
64
|
-
copyright?: string | null;
|
|
65
|
-
alt?: string | null;
|
|
66
|
-
}>, unknown>;
|
|
67
|
-
export declare type ImportThumbnails = t.TypeOf<ReturnType<typeof ImportThumbnails>>;
|
|
68
|
-
export declare const ImportImageWithThumbnails: (def?: ({
|
|
69
|
-
type: "Image";
|
|
70
|
-
} & {
|
|
71
|
-
fieldset?: string | null | undefined;
|
|
72
|
-
config?: {
|
|
73
|
-
label?: string | null | undefined;
|
|
74
|
-
placeholder?: string;
|
|
75
|
-
constraint?: {
|
|
76
|
-
width?: number | null;
|
|
77
|
-
height?: number | null;
|
|
78
|
-
};
|
|
79
|
-
thumbnails?: readonly ({
|
|
80
|
-
name: string;
|
|
81
|
-
} & {
|
|
82
|
-
width?: number | null;
|
|
83
|
-
height?: number | null;
|
|
84
|
-
})[];
|
|
85
|
-
};
|
|
86
|
-
}) | undefined) => t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
87
|
-
id: t.StringC;
|
|
88
|
-
}>, t.PartialC<{
|
|
89
|
-
dimensions: t.PartialC<{
|
|
90
|
-
width: t.NumberC;
|
|
91
|
-
height: t.NumberC;
|
|
92
|
-
}>;
|
|
93
|
-
edit: t.PartialC<{
|
|
94
|
-
x: t.NumberC;
|
|
95
|
-
y: t.NumberC;
|
|
96
|
-
zoom: t.NumberC;
|
|
97
|
-
background: t.StringC;
|
|
98
|
-
}>;
|
|
99
|
-
copyright: t.UnionC<[t.StringC, t.NullC]>;
|
|
100
|
-
alt: t.UnionC<[t.StringC, t.NullC]>;
|
|
101
|
-
}>]>, t.Type<Record<string, {
|
|
102
|
-
id: string;
|
|
103
|
-
} & {
|
|
104
|
-
dimensions?: {
|
|
105
|
-
width?: number;
|
|
106
|
-
height?: number;
|
|
107
|
-
};
|
|
108
|
-
edit?: {
|
|
109
|
-
x?: number;
|
|
110
|
-
y?: number;
|
|
111
|
-
zoom?: number;
|
|
112
|
-
background?: string;
|
|
113
|
-
};
|
|
114
|
-
copyright?: string | null;
|
|
115
|
-
alt?: string | null;
|
|
116
|
-
}>, Record<string, {
|
|
117
|
-
id: string;
|
|
118
|
-
} & {
|
|
119
|
-
dimensions?: {
|
|
120
|
-
width?: number;
|
|
121
|
-
height?: number;
|
|
122
|
-
};
|
|
123
|
-
edit?: {
|
|
124
|
-
x?: number;
|
|
125
|
-
y?: number;
|
|
126
|
-
zoom?: number;
|
|
127
|
-
background?: string;
|
|
128
|
-
};
|
|
129
|
-
copyright?: string | null;
|
|
130
|
-
alt?: string | null;
|
|
131
|
-
}>, unknown>]>;
|
|
132
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportImageWithThumbnails = exports.ImportImageView = exports.ImportImageViewShape = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const BasicTypes_1 = require("../../../../../validators/BasicTypes");
|
|
7
|
-
const function_1 = require("../../../../../validators/function");
|
|
8
|
-
exports.ImportImageViewShape = t.intersection([
|
|
9
|
-
t.type({
|
|
10
|
-
// Image Id
|
|
11
|
-
id: BasicTypes_1.String,
|
|
12
|
-
}),
|
|
13
|
-
t.partial({
|
|
14
|
-
// Dimensions here will be used if they are not defined in the custom type
|
|
15
|
-
dimensions: (0, function_1.withCustomError)(t.partial({
|
|
16
|
-
width: BasicTypes_1.Number,
|
|
17
|
-
height: BasicTypes_1.Number,
|
|
18
|
-
}), () => "The value must be an object"),
|
|
19
|
-
// Crop information
|
|
20
|
-
edit: (0, function_1.withCustomError)(t.partial({
|
|
21
|
-
x: BasicTypes_1.Number,
|
|
22
|
-
y: BasicTypes_1.Number,
|
|
23
|
-
zoom: BasicTypes_1.Number,
|
|
24
|
-
background: BasicTypes_1.String,
|
|
25
|
-
}), () => "The value must be an object"),
|
|
26
|
-
// Copyrights and alt are set in the Asset by default but they can be overrided
|
|
27
|
-
copyright: BasicTypes_1.StringOrNull,
|
|
28
|
-
alt: BasicTypes_1.StringOrNull,
|
|
29
|
-
}),
|
|
30
|
-
]);
|
|
31
|
-
exports.ImportImageView = (0, function_1.withCustomError)(exports.ImportImageViewShape, () => "The value must be an object");
|
|
32
|
-
const ImportThumbnails = (thumbnails) => t.partial(thumbnails.reduce((acc, thumbnail) => ({
|
|
33
|
-
...acc,
|
|
34
|
-
[thumbnail.name]: exports.ImportImageView,
|
|
35
|
-
}), {}));
|
|
36
|
-
const ImportImageWithThumbnails = (def) => {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
return (0, function_1.withCustomError)(t.intersection([
|
|
39
|
-
exports.ImportImageViewShape,
|
|
40
|
-
ImportThumbnails((_b = (_a = def === null || def === void 0 ? void 0 : def.config) === null || _a === void 0 ? void 0 : _a.thumbnails) !== null && _b !== void 0 ? _b : []),
|
|
41
|
-
]), () => "The value must be an object");
|
|
42
|
-
};
|
|
43
|
-
exports.ImportImageWithThumbnails = ImportImageWithThumbnails;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as t from "io-ts";
|
|
2
|
-
import { ImportBlockType, ImportEmbedBlock, ImportImageBlock, ImportTextBlock } from "./blocks";
|
|
3
|
-
export declare type ImportBlock = ImportTextBlock | ImportImageBlock | ImportEmbedBlock;
|
|
4
|
-
export declare const ImportBlock: (allowedBlockTypes: string[]) => t.Type<ImportBlock, {
|
|
5
|
-
type: ImportBlockType;
|
|
6
|
-
}, unknown>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportBlock = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
-
const function_1 = require("../../../../../validators/function");
|
|
7
|
-
const blocks_1 = require("./blocks");
|
|
8
|
-
const ImportBlock = (allowedBlockTypes) => (0, function_1.withCustomError)(t
|
|
9
|
-
.type({
|
|
10
|
-
type: (0, blocks_1.ImportBlockType)(allowedBlockTypes),
|
|
11
|
-
})
|
|
12
|
-
.pipe(new t.Type("ImportBlock", (u) => t
|
|
13
|
-
.union([blocks_1.ImportTextBlock, blocks_1.ImportImageBlock, blocks_1.ImportEmbedBlock])
|
|
14
|
-
.is(u), (u, c) => {
|
|
15
|
-
if (u.type === "image") {
|
|
16
|
-
return blocks_1.ImportImageBlock.validate(u, c);
|
|
17
|
-
}
|
|
18
|
-
else if (u.type === "embed") {
|
|
19
|
-
return blocks_1.ImportEmbedBlock.validate(u, c);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return blocks_1.ImportTextBlock.validate(u, c);
|
|
23
|
-
}
|
|
24
|
-
}, t.identity)), () => "Rich text block must be an object");
|
|
25
|
-
exports.ImportBlock = ImportBlock;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as t from "io-ts";
|
|
2
|
-
import { ImportBlock } from "./ImportBlock";
|
|
3
|
-
export declare const ImportRichText: (customType?: ({
|
|
4
|
-
type: "StructuredText";
|
|
5
|
-
} & {
|
|
6
|
-
fieldset?: string | null | undefined;
|
|
7
|
-
config?: {
|
|
8
|
-
label?: string | null | undefined;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
useAsTitle?: boolean;
|
|
11
|
-
single?: string;
|
|
12
|
-
multi?: string;
|
|
13
|
-
imageConstraint?: {
|
|
14
|
-
width?: number | null;
|
|
15
|
-
height?: number | null;
|
|
16
|
-
};
|
|
17
|
-
labels?: readonly string[];
|
|
18
|
-
allowTargetBlank?: boolean;
|
|
19
|
-
};
|
|
20
|
-
}) | undefined) => t.Type<{
|
|
21
|
-
type: "StructuredText";
|
|
22
|
-
value: ImportBlock[] | null;
|
|
23
|
-
}, ImportBlock[] | undefined, unknown>;
|
|
24
|
-
export declare type ImportRichText = t.TypeOf<ReturnType<typeof ImportRichText>>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportRichText = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
|
|
6
|
-
const function_1 = require("fp-ts/function");
|
|
7
|
-
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
8
|
-
const validators_1 = require("../../../../../validators");
|
|
9
|
-
const function_2 = require("../../../../../validators/function");
|
|
10
|
-
const ImportContent_1 = require("../../ImportContent");
|
|
11
|
-
const ImportBlock_1 = require("./ImportBlock");
|
|
12
|
-
const ImportRichText = (customType) => {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
14
|
-
const single = (_b = (_a = customType === null || customType === void 0 ? void 0 : customType.config) === null || _a === void 0 ? void 0 : _a.single) === null || _b === void 0 ? void 0 : _b.split(",");
|
|
15
|
-
const multi = (_d = (_c = customType === null || customType === void 0 ? void 0 : customType.config) === null || _c === void 0 ? void 0 : _c.multi) === null || _d === void 0 ? void 0 : _d.split(",");
|
|
16
|
-
const allowedBlockTypes = multi || single;
|
|
17
|
-
const isSingleBlockAllowed = multi === undefined && single !== undefined;
|
|
18
|
-
const BlockCodec = (0, ImportBlock_1.ImportBlock)(allowedBlockTypes !== null && allowedBlockTypes !== void 0 ? allowedBlockTypes : []);
|
|
19
|
-
const RichTextArrayCodec = (0, function_2.withCustomError)(t.array(BlockCodec), () => "Rich text field must be an array");
|
|
20
|
-
return (0, ImportContent_1.ImportContent)("StructuredText", (0, validators_1.EmptyArrayOrElse)(new t.ArrayType(RichTextArrayCodec.name, (u) => RichTextArrayCodec.is(u), (u, c) => {
|
|
21
|
-
if (allowedBlockTypes === undefined) {
|
|
22
|
-
throw new Error("Invalid custom type for the rich text field: the model is missing a 'single' or 'multi' field defining a list of allowed block types");
|
|
23
|
-
}
|
|
24
|
-
return (0, function_1.pipe)(RichTextArrayCodec.validate(u, c), E.chain((blocks) => {
|
|
25
|
-
if (isSingleBlockAllowed && blocks.length > 1) {
|
|
26
|
-
return t.failure(blocks, c, "This field only allows one block");
|
|
27
|
-
}
|
|
28
|
-
return t.success(blocks);
|
|
29
|
-
}));
|
|
30
|
-
}, t.identity, BlockCodec)));
|
|
31
|
-
};
|
|
32
|
-
exports.ImportRichText = ImportRichText;
|