@prismicio/types-internal 0.2.0 → 0.2.2
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/customtypes/CustomType.d.ts +2 -2
- package/lib/customtypes/CustomType.js +38 -56
- package/lib/customtypes/Format.js +2 -5
- package/lib/customtypes/Section.d.ts +1 -1
- package/lib/customtypes/Section.js +9 -32
- package/lib/customtypes/index.js +4 -30
- package/lib/customtypes/widgets/Group.js +9 -33
- package/lib/customtypes/widgets/UID.js +7 -31
- package/lib/customtypes/widgets/Widget.d.ts +1 -1
- package/lib/customtypes/widgets/Widget.js +14 -40
- package/lib/customtypes/widgets/WidgetTypes.js +1 -3
- package/lib/customtypes/widgets/index.js +7 -35
- package/lib/customtypes/widgets/nestable/BooleanField.js +6 -30
- package/lib/customtypes/widgets/nestable/Color.js +7 -31
- package/lib/customtypes/widgets/nestable/Date.js +7 -31
- package/lib/customtypes/widgets/nestable/Embed.js +7 -31
- package/lib/customtypes/widgets/nestable/GeoPoint.js +7 -31
- package/lib/customtypes/widgets/nestable/Image.js +10 -34
- package/lib/customtypes/widgets/nestable/IntegrationField.js +7 -31
- package/lib/customtypes/widgets/nestable/Link.js +13 -35
- package/lib/customtypes/widgets/nestable/NestableWidget.js +32 -56
- package/lib/customtypes/widgets/nestable/Number.js +11 -35
- package/lib/customtypes/widgets/nestable/Range.js +11 -35
- package/lib/customtypes/widgets/nestable/RichText.js +16 -36
- package/lib/customtypes/widgets/nestable/Select.js +8 -32
- package/lib/customtypes/widgets/nestable/Separator.js +6 -30
- package/lib/customtypes/widgets/nestable/Text.js +7 -31
- package/lib/customtypes/widgets/nestable/Timestamp.js +7 -31
- package/lib/customtypes/widgets/nestable/index.js +15 -36
- package/lib/customtypes/widgets/shared/ImageConstraint.js +9 -30
- package/lib/customtypes/widgets/shared/index.js +1 -8
- package/lib/customtypes/widgets/slices/CompositeSlice.js +10 -34
- package/lib/customtypes/widgets/slices/LegacySlice.js +6 -30
- package/lib/customtypes/widgets/slices/SharedSlice.js +9 -33
- package/lib/customtypes/widgets/slices/SharedSliceRef.js +4 -28
- package/lib/customtypes/widgets/slices/Slice.d.ts +4 -4
- package/lib/customtypes/widgets/slices/Slice.js +1 -2
- package/lib/customtypes/widgets/slices/Slices.js +27 -54
- package/lib/customtypes/widgets/slices/SlicesTypes.js +1 -3
- package/lib/customtypes/widgets/slices/index.js +7 -37
- package/lib/documents/DocumentData.js +4 -25
- package/lib/documents/index.js +2 -28
- package/lib/documents/widgets/EmptyContent.js +3 -6
- package/lib/documents/widgets/GroupContent.js +10 -32
- package/lib/documents/widgets/SimpleWidgetContent.d.ts +2 -2
- package/lib/documents/widgets/SimpleWidgetContent.js +27 -53
- package/lib/documents/widgets/StaticWidgetContent.js +8 -29
- package/lib/documents/widgets/UIDContent.js +4 -26
- package/lib/documents/widgets/index.js +22 -51
- package/lib/documents/widgets/nestable/BooleanContent.js +6 -28
- package/lib/documents/widgets/nestable/EmbedContent.d.ts +4 -4
- package/lib/documents/widgets/nestable/EmbedContent.js +20 -42
- package/lib/documents/widgets/nestable/FieldContent.js +8 -28
- package/lib/documents/widgets/nestable/GeoPointContent.js +5 -27
- package/lib/documents/widgets/nestable/ImageContent.d.ts +14 -14
- package/lib/documents/widgets/nestable/ImageContent.js +12 -34
- package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +6 -28
- package/lib/documents/widgets/nestable/Link/DocumentLink.js +7 -30
- package/lib/documents/widgets/nestable/Link/ExternalLink.d.ts +4 -4
- package/lib/documents/widgets/nestable/Link/ExternalLink.js +10 -33
- package/lib/documents/widgets/nestable/Link/FileLink.js +10 -33
- package/lib/documents/widgets/nestable/Link/ImageLink.js +9 -32
- package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +2 -2
- package/lib/documents/widgets/nestable/Link/LinkContent.js +9 -31
- package/lib/documents/widgets/nestable/Link/index.d.ts +8 -8
- package/lib/documents/widgets/nestable/Link/index.js +24 -51
- package/lib/documents/widgets/nestable/SeparatorContent.js +2 -5
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +8 -8
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +33 -60
- package/lib/documents/widgets/nestable/StructuredTextContent/index.js +7 -29
- package/lib/documents/widgets/nestable/index.d.ts +2 -2
- package/lib/documents/widgets/nestable/index.js +28 -63
- package/lib/documents/widgets/slices/CompositeSliceContent.d.ts +1 -1
- package/lib/documents/widgets/slices/CompositeSliceContent.js +9 -31
- package/lib/documents/widgets/slices/SharedSliceContent.d.ts +1 -1
- package/lib/documents/widgets/slices/SharedSliceContent.js +12 -34
- package/lib/documents/widgets/slices/SimpleSliceContent.js +2 -8
- package/lib/documents/widgets/slices/SliceWidgetContent.d.ts +1 -1
- package/lib/documents/widgets/slices/SliceWidgetContent.js +8 -33
- package/lib/documents/widgets/slices/SlicesContent.js +13 -35
- package/lib/documents/widgets/slices/index.js +5 -17
- package/lib/index.js +3 -25
- package/lib/validators/DateFromString.js +4 -25
- package/lib/validators/DateFromStringOrNumber.js +4 -25
- package/lib/validators/DateFromTsMs.js +4 -25
- package/lib/validators/IntFromNumber.js +4 -25
- package/lib/validators/IntFromPixels.js +7 -29
- package/lib/validators/NonEmptyString.js +3 -24
- package/lib/validators/NonEmptyStringOrNull.js +7 -12
- package/lib/validators/NumberOrNull.js +3 -24
- package/lib/validators/StringFromBoolean.js +4 -25
- package/lib/validators/StringFromNumber.js +4 -25
- package/lib/validators/StringOrNull.js +3 -24
- package/lib/validators/function.js +17 -47
- package/lib/validators/index.js +12 -48
- package/package.json +1 -1
- package/lib/documents/widgets/Widget.d.ts +0 -0
- package/lib/documents/widgets/Widget.js +0 -1
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.BooleanContentType = void 0;
|
|
23
|
-
const Either_1 = require("fp-ts/Either");
|
|
24
|
-
const t = __importStar(require("io-ts"));
|
|
25
|
-
exports.BooleanContentType = "BooleanContent";
|
|
26
|
-
const BooleanContent = new t.Type("BooleanContent", (u) => u?.__TYPE__ === exports.BooleanContentType, (u, c) => Either_1.Chain.chain(t.boolean.validate(u, c), (u) => {
|
|
27
|
-
return t.success({ value: u, __TYPE__: exports.BooleanContentType });
|
|
1
|
+
import { Chain } from "fp-ts/Either";
|
|
2
|
+
import * as t from "io-ts";
|
|
3
|
+
export const BooleanContentType = "BooleanContent";
|
|
4
|
+
const BooleanContent = new t.Type("BooleanContent", (u) => u?.__TYPE__ === BooleanContentType, (u, c) => Chain.chain(t.boolean.validate(u, c), (u) => {
|
|
5
|
+
return t.success({ value: u, __TYPE__: BooleanContentType });
|
|
28
6
|
}), (booleanContent) => t.boolean.encode(booleanContent.value));
|
|
29
|
-
|
|
7
|
+
export default BooleanContent;
|
|
@@ -8,13 +8,13 @@ declare const EmbedContentC: t.Type<{
|
|
|
8
8
|
embed_url: string;
|
|
9
9
|
type: string;
|
|
10
10
|
} & {
|
|
11
|
-
version?: string | number | null
|
|
11
|
+
version?: string | number | null;
|
|
12
12
|
title?: string | null | undefined;
|
|
13
13
|
author_name?: string | null | undefined;
|
|
14
14
|
author_url?: string | null | undefined;
|
|
15
15
|
provider_name?: string | null | undefined;
|
|
16
16
|
provider_url?: string | null | undefined;
|
|
17
|
-
cache_age?: string | number | null
|
|
17
|
+
cache_age?: string | number | null;
|
|
18
18
|
thumbnail_url?: string | null | undefined;
|
|
19
19
|
thumbnail_width?: number | null | undefined;
|
|
20
20
|
thumbnail_height?: number | null | undefined;
|
|
@@ -23,13 +23,13 @@ declare const EmbedContentC: t.Type<{
|
|
|
23
23
|
embed_url: string;
|
|
24
24
|
type: string;
|
|
25
25
|
} & {
|
|
26
|
-
version?: string | number | null
|
|
26
|
+
version?: string | number | null;
|
|
27
27
|
title?: string | null | undefined;
|
|
28
28
|
author_name?: string | null | undefined;
|
|
29
29
|
author_url?: string | null | undefined;
|
|
30
30
|
provider_name?: string | null | undefined;
|
|
31
31
|
provider_url?: string | null | undefined;
|
|
32
|
-
cache_age?: string | number | null
|
|
32
|
+
cache_age?: string | number | null;
|
|
33
33
|
thumbnail_url?: string | null | undefined;
|
|
34
34
|
thumbnail_width?: number | null | undefined;
|
|
35
35
|
thumbnail_height?: number | null | undefined;
|
|
@@ -1,54 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.EmbedContentType = void 0;
|
|
23
|
-
const fp_ts_1 = require("fp-ts");
|
|
24
|
-
const function_1 = require("fp-ts/function");
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const validators_1 = require("../../../validators");
|
|
27
|
-
const function_2 = require("../../../validators/function");
|
|
28
|
-
exports.EmbedContentType = "EmbedContent";
|
|
29
|
-
const EmbedContent = new t.Type("EmbedContent", (u) => u.__TYPE__ === exports.EmbedContentType, (u) => {
|
|
30
|
-
return (0, function_1.pipe)(EmbedContentC.decode(u), fp_ts_1.either.map((s) => ({
|
|
1
|
+
import { either } from "fp-ts";
|
|
2
|
+
import { pipe } from "fp-ts/function";
|
|
3
|
+
import * as t from "io-ts";
|
|
4
|
+
import { NumberOrNull, StringOrNull } from "../../../validators";
|
|
5
|
+
import { addType } from "../../../validators/function";
|
|
6
|
+
export const EmbedContentType = "EmbedContent";
|
|
7
|
+
const EmbedContent = new t.Type("EmbedContent", (u) => u.__TYPE__ === EmbedContentType, (u) => {
|
|
8
|
+
return pipe(EmbedContentC.decode(u), either.map((s) => ({
|
|
31
9
|
...EmbedContentC.encode(s),
|
|
32
10
|
all: u,
|
|
33
11
|
})));
|
|
34
12
|
}, (ec) => EmbedContentC.encode(ec));
|
|
35
|
-
const EmbedContentC =
|
|
13
|
+
const EmbedContentC = addType(t.exact(t.intersection([
|
|
36
14
|
t.type({
|
|
37
15
|
embed_url: t.string,
|
|
38
16
|
type: t.string,
|
|
39
17
|
}),
|
|
40
18
|
t.partial({
|
|
41
19
|
version: t.union([t.string, t.number, t.null]),
|
|
42
|
-
title:
|
|
43
|
-
author_name:
|
|
44
|
-
author_url:
|
|
45
|
-
provider_name:
|
|
46
|
-
provider_url:
|
|
20
|
+
title: StringOrNull,
|
|
21
|
+
author_name: StringOrNull,
|
|
22
|
+
author_url: StringOrNull,
|
|
23
|
+
provider_name: StringOrNull,
|
|
24
|
+
provider_url: StringOrNull,
|
|
47
25
|
cache_age: t.union([t.string, t.number, t.null]),
|
|
48
|
-
thumbnail_url:
|
|
49
|
-
thumbnail_width:
|
|
50
|
-
thumbnail_height:
|
|
51
|
-
html:
|
|
26
|
+
thumbnail_url: StringOrNull,
|
|
27
|
+
thumbnail_width: NumberOrNull,
|
|
28
|
+
thumbnail_height: NumberOrNull,
|
|
29
|
+
html: StringOrNull,
|
|
52
30
|
}),
|
|
53
|
-
])),
|
|
54
|
-
|
|
31
|
+
])), EmbedContentType);
|
|
32
|
+
export default EmbedContent;
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.FieldContentType = void 0;
|
|
23
|
-
const function_1 = require("fp-ts/function");
|
|
24
|
-
const O = __importStar(require("fp-ts/Option"));
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
exports.FieldContentType = "FieldContent";
|
|
1
|
+
import { pipe } from "fp-ts/function";
|
|
2
|
+
import * as O from "fp-ts/Option";
|
|
3
|
+
import * as t from "io-ts";
|
|
4
|
+
export const FieldContentType = "FieldContent";
|
|
27
5
|
//we do that instead of idiomatic .trim()
|
|
28
6
|
//because we need to have the exact same behaviour than scala/java .trim()
|
|
29
7
|
//in other world only trim space and not non-breaking space or tab
|
|
30
8
|
function trimScalaStyle(s) {
|
|
31
9
|
let startAt = 0;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
32
11
|
while (startAt < s.length && s[startAt] <= " ") {
|
|
33
12
|
startAt++;
|
|
34
13
|
}
|
|
35
14
|
let endAt = s.length;
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
36
16
|
while (startAt < endAt && s[endAt - 1] <= " ") {
|
|
37
17
|
endAt--;
|
|
38
18
|
}
|
|
@@ -41,7 +21,7 @@ function trimScalaStyle(s) {
|
|
|
41
21
|
const FieldContent = {
|
|
42
22
|
types: ["Text", "Date", "Timestamp", "Color", "Number", "Range", "Select"],
|
|
43
23
|
forType: (type, value) => {
|
|
44
|
-
return
|
|
24
|
+
return pipe(O.fromEither(t.string.decode(value)), O.map((r) => {
|
|
45
25
|
return {
|
|
46
26
|
value: trimScalaStyle(r),
|
|
47
27
|
type,
|
|
@@ -50,4 +30,4 @@ const FieldContent = {
|
|
|
50
30
|
}));
|
|
51
31
|
},
|
|
52
32
|
};
|
|
53
|
-
|
|
33
|
+
export default FieldContent;
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.GeoPointContent = exports.GeoPointContentType = void 0;
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const function_1 = require("../../../validators/function");
|
|
25
|
-
exports.GeoPointContentType = "GeoPointContent";
|
|
26
|
-
exports.GeoPointContent = (0, function_1.addType)(t.strict({
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { addType } from "../../../validators/function";
|
|
3
|
+
export const GeoPointContentType = "GeoPointContent";
|
|
4
|
+
export const GeoPointContent = addType(t.strict({
|
|
27
5
|
position: t.strict({
|
|
28
6
|
lat: t.number,
|
|
29
7
|
lng: t.number,
|
|
30
8
|
}),
|
|
31
|
-
}),
|
|
9
|
+
}), GeoPointContentType);
|
|
@@ -42,9 +42,9 @@ export declare const ImageContent: t.Type<{
|
|
|
42
42
|
background: string;
|
|
43
43
|
};
|
|
44
44
|
} & {
|
|
45
|
-
url?: string
|
|
46
|
-
credits?: string | null
|
|
47
|
-
alt?: string | null
|
|
45
|
+
url?: string;
|
|
46
|
+
credits?: string | null;
|
|
47
|
+
alt?: string | null;
|
|
48
48
|
provider?: string | null | undefined;
|
|
49
49
|
} & {
|
|
50
50
|
thumbnails?: {
|
|
@@ -66,12 +66,12 @@ export declare const ImageContent: t.Type<{
|
|
|
66
66
|
background: string;
|
|
67
67
|
};
|
|
68
68
|
} & {
|
|
69
|
-
url?: string
|
|
70
|
-
credits?: string | null
|
|
71
|
-
alt?: string | null
|
|
69
|
+
url?: string;
|
|
70
|
+
credits?: string | null;
|
|
71
|
+
alt?: string | null;
|
|
72
72
|
provider?: string | null | undefined;
|
|
73
73
|
};
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
}, {
|
|
76
76
|
origin: {
|
|
77
77
|
id: string;
|
|
@@ -90,9 +90,9 @@ export declare const ImageContent: t.Type<{
|
|
|
90
90
|
background: string;
|
|
91
91
|
};
|
|
92
92
|
} & {
|
|
93
|
-
url?: string
|
|
94
|
-
credits?: string | null
|
|
95
|
-
alt?: string | null
|
|
93
|
+
url?: string;
|
|
94
|
+
credits?: string | null;
|
|
95
|
+
alt?: string | null;
|
|
96
96
|
provider?: string | null | undefined;
|
|
97
97
|
} & {
|
|
98
98
|
thumbnails?: {
|
|
@@ -114,12 +114,12 @@ export declare const ImageContent: t.Type<{
|
|
|
114
114
|
background: string;
|
|
115
115
|
};
|
|
116
116
|
} & {
|
|
117
|
-
url?: string
|
|
118
|
-
credits?: string | null
|
|
119
|
-
alt?: string | null
|
|
117
|
+
url?: string;
|
|
118
|
+
credits?: string | null;
|
|
119
|
+
alt?: string | null;
|
|
120
120
|
provider?: string | null | undefined;
|
|
121
121
|
};
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
} & {
|
|
124
124
|
__TYPE__: "ImageContent";
|
|
125
125
|
}, unknown>;
|
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.ImageContent = exports.ImageContentType = exports.ImageContentView = void 0;
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const validators_1 = require("../../../validators");
|
|
25
|
-
const function_1 = require("../../../validators/function");
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { NonEmptyStringOrNull, StringOrNull } from "../../../validators";
|
|
3
|
+
import { addType } from "../../../validators/function";
|
|
26
4
|
const Origin = t.exact(t.type({
|
|
27
5
|
id: t.string,
|
|
28
6
|
url: t.string,
|
|
29
7
|
width: t.number,
|
|
30
8
|
height: t.number,
|
|
31
9
|
}));
|
|
32
|
-
|
|
10
|
+
export const ImageContentView = t.exact(t.intersection([
|
|
33
11
|
t.type({
|
|
34
12
|
origin: Origin,
|
|
35
13
|
width: t.number,
|
|
@@ -45,15 +23,15 @@ exports.ImageContentView = t.exact(t.intersection([
|
|
|
45
23
|
}),
|
|
46
24
|
t.partial({
|
|
47
25
|
url: t.string,
|
|
48
|
-
credits:
|
|
49
|
-
alt:
|
|
50
|
-
provider:
|
|
26
|
+
credits: NonEmptyStringOrNull,
|
|
27
|
+
alt: NonEmptyStringOrNull,
|
|
28
|
+
provider: StringOrNull,
|
|
51
29
|
}),
|
|
52
30
|
]));
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
export const ImageContentType = "ImageContent";
|
|
32
|
+
export const ImageContent = addType(t.intersection([
|
|
33
|
+
ImageContentView,
|
|
56
34
|
t.partial({
|
|
57
|
-
thumbnails: t.record(t.string,
|
|
35
|
+
thumbnails: t.record(t.string, ImageContentView),
|
|
58
36
|
}),
|
|
59
|
-
]),
|
|
37
|
+
]), ImageContentType);
|
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.IntegrationFieldsContentType = void 0;
|
|
23
|
-
const Either_1 = require("fp-ts/Either");
|
|
24
|
-
const t = __importStar(require("io-ts"));
|
|
25
|
-
exports.IntegrationFieldsContentType = "IntegrationFieldsContent";
|
|
26
|
-
const IntegrationFieldsContent = new t.Type("IntegrationFieldsContent", (u) => u?.__TYPE__ === exports.IntegrationFieldsContentType, (u, c) => Either_1.Chain.chain(t.string.validate(u, c), (u) => {
|
|
1
|
+
import { Chain } from "fp-ts/Either";
|
|
2
|
+
import * as t from "io-ts";
|
|
3
|
+
export const IntegrationFieldsContentType = "IntegrationFieldsContent";
|
|
4
|
+
const IntegrationFieldsContent = new t.Type("IntegrationFieldsContent", (u) => u?.__TYPE__ === IntegrationFieldsContentType, (u, c) => Chain.chain(t.string.validate(u, c), (u) => {
|
|
27
5
|
return t.success({
|
|
28
6
|
value: u,
|
|
29
|
-
__TYPE__:
|
|
7
|
+
__TYPE__: IntegrationFieldsContentType,
|
|
30
8
|
});
|
|
31
9
|
}), () => {
|
|
32
10
|
throw new Error("Not implemented - Not used - Not relevant");
|
|
33
11
|
});
|
|
34
|
-
|
|
12
|
+
export default IntegrationFieldsContent;
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.isDocumentLink = exports.DocumentLink = exports.DocumentLinkType = void 0;
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const validators_1 = require("../../../../validators");
|
|
25
|
-
const function_1 = require("../../../../validators/function");
|
|
26
|
-
exports.DocumentLinkType = "DocumentLink";
|
|
27
|
-
exports.DocumentLink = (0, function_1.addType)(t.strict({ id: validators_1.NonEmptyString }), exports.DocumentLinkType);
|
|
28
|
-
function isDocumentLink(u) {
|
|
29
|
-
return u.__TYPE__ === exports.DocumentLinkType;
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { NonEmptyString } from "../../../../validators";
|
|
3
|
+
import { addType } from "../../../../validators/function";
|
|
4
|
+
export const DocumentLinkType = "DocumentLink";
|
|
5
|
+
export const DocumentLink = addType(t.strict({ id: NonEmptyString }), DocumentLinkType);
|
|
6
|
+
export function isDocumentLink(u) {
|
|
7
|
+
return u.__TYPE__ === DocumentLinkType;
|
|
30
8
|
}
|
|
31
|
-
exports.isDocumentLink = isDocumentLink;
|
|
@@ -3,18 +3,18 @@ export declare const ExternalLinkType = "ExternalLink";
|
|
|
3
3
|
export declare const ExternalLink: t.Type<{
|
|
4
4
|
url: string;
|
|
5
5
|
} & {
|
|
6
|
-
kind?: "web"
|
|
6
|
+
kind?: "web";
|
|
7
7
|
target?: string | null | undefined;
|
|
8
8
|
preview?: {
|
|
9
|
-
title?: string
|
|
9
|
+
title?: string;
|
|
10
10
|
} | null | undefined;
|
|
11
11
|
}, {
|
|
12
12
|
url: string;
|
|
13
13
|
} & {
|
|
14
|
-
kind?: "web"
|
|
14
|
+
kind?: "web";
|
|
15
15
|
target?: string | null | undefined;
|
|
16
16
|
preview?: {
|
|
17
|
-
title?: string
|
|
17
|
+
title?: string;
|
|
18
18
|
} | null | undefined;
|
|
19
19
|
} & {
|
|
20
20
|
__TYPE__: "ExternalLink";
|
|
@@ -1,42 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.isExternalLink = exports.ExternalLink = exports.ExternalLinkType = void 0;
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const validators_1 = require("../../../../validators");
|
|
25
|
-
const function_1 = require("../../../../validators/function");
|
|
26
|
-
exports.ExternalLinkType = "ExternalLink";
|
|
27
|
-
exports.ExternalLink = (0, function_1.addType)(t.exact(t.intersection([
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringOrNull } from "../../../../validators";
|
|
3
|
+
import { addType, nullable } from "../../../../validators/function";
|
|
4
|
+
export const ExternalLinkType = "ExternalLink";
|
|
5
|
+
export const ExternalLink = addType(t.exact(t.intersection([
|
|
28
6
|
t.type({
|
|
29
7
|
url: t.string,
|
|
30
8
|
}),
|
|
31
9
|
t.partial({
|
|
32
10
|
kind: t.literal("web"),
|
|
33
|
-
target:
|
|
34
|
-
preview:
|
|
11
|
+
target: StringOrNull,
|
|
12
|
+
preview: nullable(t.partial({
|
|
35
13
|
title: t.string,
|
|
36
14
|
})),
|
|
37
15
|
}),
|
|
38
|
-
])),
|
|
39
|
-
function isExternalLink(u) {
|
|
40
|
-
return u.__TYPE__ ===
|
|
16
|
+
])), ExternalLinkType);
|
|
17
|
+
export function isExternalLink(u) {
|
|
18
|
+
return u.__TYPE__ === ExternalLinkType;
|
|
41
19
|
}
|
|
42
|
-
exports.isExternalLink = isExternalLink;
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.isFileLink = exports.FileLink = exports.FileLinkType = void 0;
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const mapOutput_1 = require("io-ts-types/lib/mapOutput");
|
|
25
|
-
const function_1 = require("../../../../validators/function");
|
|
26
|
-
exports.FileLinkType = "FileLink";
|
|
27
|
-
exports.FileLink = (0, mapOutput_1.mapOutput)(t.exact(t.intersection([
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { mapOutput } from "io-ts-types/lib/mapOutput";
|
|
3
|
+
import { nullable } from "../../../../validators/function";
|
|
4
|
+
export const FileLinkType = "FileLink";
|
|
5
|
+
export const FileLink = mapOutput(t.exact(t.intersection([
|
|
28
6
|
t.type({
|
|
29
7
|
id: t.string,
|
|
30
8
|
url: t.string,
|
|
@@ -32,11 +10,10 @@ exports.FileLink = (0, mapOutput_1.mapOutput)(t.exact(t.intersection([
|
|
|
32
10
|
kind: t.string,
|
|
33
11
|
}),
|
|
34
12
|
t.partial({
|
|
35
|
-
date:
|
|
36
|
-
size:
|
|
13
|
+
date: nullable(t.string),
|
|
14
|
+
size: nullable(t.string),
|
|
37
15
|
}),
|
|
38
|
-
])), (o) => ({ ...o, size: o.size || "0", __TYPE__:
|
|
39
|
-
function isFileLink(u) {
|
|
40
|
-
return u.__TYPE__ ===
|
|
16
|
+
])), (o) => ({ ...o, size: o.size || "0", __TYPE__: FileLinkType }));
|
|
17
|
+
export function isFileLink(u) {
|
|
18
|
+
return u.__TYPE__ === FileLinkType;
|
|
41
19
|
}
|
|
42
|
-
exports.isFileLink = isFileLink;
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.isImageLink = exports.ImageLink = exports.ImageLinkType = void 0;
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const validators_1 = require("../../../../validators");
|
|
25
|
-
const function_1 = require("../../../../validators/function");
|
|
26
|
-
exports.ImageLinkType = "ImageLink";
|
|
27
|
-
exports.ImageLink = (0, function_1.addType)(t.exact(t.intersection([
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringOrNull } from "../../../../validators";
|
|
3
|
+
import { addType } from "../../../../validators/function";
|
|
4
|
+
export const ImageLinkType = "ImageLink";
|
|
5
|
+
export const ImageLink = addType(t.exact(t.intersection([
|
|
28
6
|
t.type({
|
|
29
7
|
id: t.string,
|
|
30
8
|
url: t.string,
|
|
@@ -35,10 +13,9 @@ exports.ImageLink = (0, function_1.addType)(t.exact(t.intersection([
|
|
|
35
13
|
kind: t.string,
|
|
36
14
|
}),
|
|
37
15
|
t.partial({
|
|
38
|
-
date:
|
|
16
|
+
date: StringOrNull,
|
|
39
17
|
}),
|
|
40
|
-
])),
|
|
41
|
-
function isImageLink(u) {
|
|
42
|
-
return u.__TYPE__ ===
|
|
18
|
+
])), ImageLinkType);
|
|
19
|
+
export function isImageLink(u) {
|
|
20
|
+
return u.__TYPE__ === ImageLinkType;
|
|
43
21
|
}
|
|
44
|
-
exports.isImageLink = isImageLink;
|
|
@@ -10,10 +10,10 @@ export declare const LinkContent: t.Type<LinkContent, {
|
|
|
10
10
|
} | ({
|
|
11
11
|
url: string;
|
|
12
12
|
} & {
|
|
13
|
-
kind?: "web"
|
|
13
|
+
kind?: "web";
|
|
14
14
|
target?: string | null | undefined;
|
|
15
15
|
preview?: {
|
|
16
|
-
title?: string
|
|
16
|
+
title?: string;
|
|
17
17
|
} | null | undefined;
|
|
18
18
|
}) | ({
|
|
19
19
|
id: string;
|