@valbuild/core 0.63.1 → 0.63.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/ValApi.d.ts +6 -1
- package/dist/declarations/src/index.d.ts +24 -7
- package/dist/declarations/src/initSchema.d.ts +3 -0
- package/dist/declarations/src/schema/date.d.ts +38 -0
- package/dist/declarations/src/schema/index.d.ts +2 -1
- package/dist/declarations/src/val/index.d.ts +1 -1
- package/dist/{index-00decfd4.cjs.prod.js → index-041f75bd.cjs.prod.js} +170 -11
- package/dist/{index-796c5d0d.cjs.dev.js → index-c67ed8f9.cjs.dev.js} +170 -11
- package/dist/{index-370592bb.esm.js → index-fccba617.esm.js} +170 -12
- package/dist/valbuild-core.cjs.dev.js +2 -1
- package/dist/valbuild-core.cjs.prod.js +2 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/expr/dist/valbuild-core-expr.cjs.dev.js +1 -1
- package/expr/dist/valbuild-core-expr.cjs.prod.js +1 -1
- package/expr/dist/valbuild-core-expr.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
@@ -13,7 +13,12 @@ export declare class ValApi {
|
|
13
13
|
getDisableUrl(redirectTo: string): string;
|
14
14
|
getLoginUrl(redirectTo: string): string;
|
15
15
|
getEnableUrl(redirectTo: string): string;
|
16
|
-
getPatches(
|
16
|
+
getPatches(filters?: {
|
17
|
+
patchIds?: string[];
|
18
|
+
authors?: string[];
|
19
|
+
moduleFilePaths?: string[];
|
20
|
+
omitPatches?: boolean;
|
21
|
+
}): Promise<result.Result<ApiGetPatchResponse, FetchError>>;
|
17
22
|
deletePatches(ids: string[], headers?: Record<string, string>): Promise<result.Result<Json, FetchError>>;
|
18
23
|
getEditUrl(): string;
|
19
24
|
getSession(): Promise<result.Result<{
|
@@ -29,7 +29,7 @@ import { convertFileSource } from "./schema/file.js";
|
|
29
29
|
import { createValPathOfItem } from "./selector/SelectorProxy.js";
|
30
30
|
import { getVal } from "./future/fetchVal.js";
|
31
31
|
import type { Json } from "./Json.js";
|
32
|
-
import { Operation } from "./patch/index.js";
|
32
|
+
import { Operation, Patch } from "./patch/index.js";
|
33
33
|
import { initSchema } from "./initSchema.js";
|
34
34
|
import { SerializedSchema } from "./schema/index.js";
|
35
35
|
export { type SerializedArraySchema, ArraySchema } from "./schema/array.js";
|
@@ -40,6 +40,7 @@ export { type SerializedNumberSchema, NumberSchema } from "./schema/number.js";
|
|
40
40
|
export { type SerializedBooleanSchema, BooleanSchema } from "./schema/boolean.js";
|
41
41
|
export { type SerializedImageSchema, ImageSchema } from "./schema/image.js";
|
42
42
|
export { type SerializedFileSchema, FileSchema } from "./schema/file.js";
|
43
|
+
export { type SerializedDateSchema, DateSchema } from "./schema/date.js";
|
43
44
|
export { type SerializedRichTextSchema, RichTextSchema, } from "./schema/richtext.js";
|
44
45
|
export { type SerializedUnionSchema, UnionSchema } from "./schema/union.js";
|
45
46
|
export { type SerializedLiteralSchema, LiteralSchema } from "./schema/literal.js";
|
@@ -62,6 +63,7 @@ export type ApiTreeResponse = {
|
|
62
63
|
stack?: string;
|
63
64
|
type?: undefined;
|
64
65
|
})[];
|
66
|
+
newPatchId?: PatchId;
|
65
67
|
modules: Record<ModuleFilePath, {
|
66
68
|
source: Json;
|
67
69
|
patches?: {
|
@@ -74,12 +76,27 @@ export type ApiTreeResponse = {
|
|
74
76
|
validationErrors?: Record<SourcePath, ValidationError[]>;
|
75
77
|
}>;
|
76
78
|
};
|
77
|
-
export type ApiGetPatchResponse =
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
export type ApiGetPatchResponse = {
|
80
|
+
patches: Record<PatchId, {
|
81
|
+
path: ModuleFilePath;
|
82
|
+
patch?: Patch;
|
83
|
+
createdAt: string;
|
84
|
+
authorId: string | null;
|
85
|
+
appliedAt: {
|
86
|
+
baseSha: string;
|
87
|
+
git?: {
|
88
|
+
commitSha: string;
|
89
|
+
};
|
90
|
+
timestamp: string;
|
91
|
+
} | null;
|
92
|
+
}>;
|
93
|
+
error?: {
|
94
|
+
message: string;
|
95
|
+
};
|
96
|
+
errors?: Record<PatchId, {
|
97
|
+
message: string;
|
98
|
+
}>;
|
99
|
+
};
|
83
100
|
export type ApiDeletePatchResponse = PatchId[];
|
84
101
|
export type ApiPostPatchResponse = Record<ModuleFilePath, {
|
85
102
|
patch_id: PatchId;
|
@@ -10,6 +10,7 @@ import { literal } from "./schema/literal.js";
|
|
10
10
|
import { keyOf } from "./schema/keyOf.js";
|
11
11
|
import { record } from "./schema/record.js";
|
12
12
|
import { file } from "./schema/file.js";
|
13
|
+
import { date } from "./schema/date.js";
|
13
14
|
export type InitSchema = {
|
14
15
|
readonly string: typeof string;
|
15
16
|
readonly boolean: typeof boolean;
|
@@ -23,6 +24,7 @@ export type InitSchema = {
|
|
23
24
|
readonly keyOf: typeof keyOf;
|
24
25
|
readonly record: typeof record;
|
25
26
|
readonly file: typeof file;
|
27
|
+
readonly date: typeof date;
|
26
28
|
};
|
27
29
|
export declare function initSchema(): {
|
28
30
|
string: <T extends string>(options?: Record<string, never> | undefined) => import("./schema/string.js").StringSchema<T>;
|
@@ -80,4 +82,5 @@ export declare function initSchema(): {
|
|
80
82
|
keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject | import("./source/index.js").SourceArray, undefined> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./schema/index.js").Schema<Src extends import("./selector/index.js").GenericSelector<infer S_2 extends import("./source/index.js").Source, undefined> ? S_2 extends readonly import("./source/index.js").Source[] ? number : S_2 extends import("./source/index.js").SourceObject ? string extends keyof S_2 ? import("./schema/string.js").RawString : keyof S_2 : S_2 extends Record<string, import("./source/index.js").Source> ? import("./schema/string.js").RawString : never : never>;
|
81
83
|
record: <S_3 extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S_3) => import("./schema/index.js").Schema<Record<string, import("./schema/index.js").SelectorOfSchema<S_3>>>;
|
82
84
|
file: (options?: import("./schema/file.js").FileOptions | undefined) => import("./schema/index.js").Schema<import("./index.js").FileSource<import("./schema/file.js").FileMetadata>>;
|
85
|
+
date: <T_3 extends string>(options?: Record<string, never> | undefined) => import("./schema/date.js").DateSchema<T_3>;
|
83
86
|
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { Schema, SerializedSchema } from "./index.js";
|
2
|
+
import { SourcePath } from "../val/index.js";
|
3
|
+
import { ValidationErrors } from "./validation/ValidationError.js";
|
4
|
+
type DateOptions = {
|
5
|
+
/**
|
6
|
+
* Validate that the date is this date or after (inclusive).
|
7
|
+
*
|
8
|
+
* @example
|
9
|
+
* 2021-01-01
|
10
|
+
*/
|
11
|
+
from?: string;
|
12
|
+
/**
|
13
|
+
* Validate that the date is this date or before (inclusive).
|
14
|
+
*
|
15
|
+
* @example
|
16
|
+
* 2021-01-01
|
17
|
+
*/
|
18
|
+
to?: string;
|
19
|
+
};
|
20
|
+
export type SerializedDateSchema = {
|
21
|
+
type: "date";
|
22
|
+
options?: DateOptions;
|
23
|
+
opt: boolean;
|
24
|
+
};
|
25
|
+
export declare class DateSchema<Src extends string | null> extends Schema<Src> {
|
26
|
+
readonly options?: DateOptions | undefined;
|
27
|
+
readonly opt: boolean;
|
28
|
+
private readonly isRaw;
|
29
|
+
constructor(options?: DateOptions | undefined, opt?: boolean, isRaw?: boolean);
|
30
|
+
validate(path: SourcePath, src: Src): ValidationErrors;
|
31
|
+
assert(src: Src): boolean;
|
32
|
+
from(from: string): DateSchema<Src>;
|
33
|
+
to(to: string): DateSchema<Src>;
|
34
|
+
nullable(): DateSchema<Src | null>;
|
35
|
+
serialize(): SerializedSchema;
|
36
|
+
}
|
37
|
+
export declare const date: <T extends string>(options?: Record<string, never>) => DateSchema<T>;
|
38
|
+
export {};
|
@@ -12,8 +12,9 @@ import { SerializedRecordSchema } from "./record.js";
|
|
12
12
|
import { SerializedRichTextSchema } from "./richtext.js";
|
13
13
|
import { SerializedStringSchema } from "./string.js";
|
14
14
|
import { SerializedUnionSchema } from "./union.js";
|
15
|
+
import { SerializedDateSchema } from "./date.js";
|
15
16
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
16
|
-
export type SerializedSchema = SerializedStringSchema | SerializedLiteralSchema | SerializedBooleanSchema | SerializedNumberSchema | SerializedObjectSchema | SerializedArraySchema | SerializedUnionSchema | SerializedRichTextSchema | SerializedRecordSchema | SerializedKeyOfSchema | SerializedFileSchema | SerializedImageSchema;
|
17
|
+
export type SerializedSchema = SerializedStringSchema | SerializedLiteralSchema | SerializedBooleanSchema | SerializedNumberSchema | SerializedObjectSchema | SerializedArraySchema | SerializedUnionSchema | SerializedRichTextSchema | SerializedRecordSchema | SerializedKeyOfSchema | SerializedFileSchema | SerializedDateSchema | SerializedImageSchema;
|
17
18
|
export declare abstract class Schema<Src extends SelectorSource> {
|
18
19
|
abstract validate(path: SourcePath, src: Src): ValidationErrors;
|
19
20
|
abstract assert(src: Src): boolean;
|
@@ -27,7 +27,7 @@ declare const brand: unique symbol;
|
|
27
27
|
* The path of the source value.
|
28
28
|
*
|
29
29
|
* @example
|
30
|
-
* '/app/blogs.0.text' // the text property of the first element of the /app/blogs module
|
30
|
+
* '/app/blogs.val.ts?p=0.text' // the text property of the first element of the /app/blogs module
|
31
31
|
*/
|
32
32
|
export type SourcePath = string & {
|
33
33
|
[brand]: "SourcePath";
|
@@ -541,7 +541,7 @@ function isVal(val) {
|
|
541
541
|
* The path of the source value.
|
542
542
|
*
|
543
543
|
* @example
|
544
|
-
* '/app/blogs.0.text' // the text property of the first element of the /app/blogs module
|
544
|
+
* '/app/blogs.val.ts?p=0.text' // the text property of the first element of the /app/blogs module
|
545
545
|
*/
|
546
546
|
|
547
547
|
/**
|
@@ -2587,6 +2587,113 @@ var keyOf = function keyOf(valModule) {
|
|
2587
2587
|
return new KeyOfSchema(valModule === null || valModule === void 0 || (_valModule$GetSchema = valModule[GetSchema$1]) === null || _valModule$GetSchema === void 0 ? void 0 : _valModule$GetSchema.serialize(), getValPath(valModule));
|
2588
2588
|
};
|
2589
2589
|
|
2590
|
+
var DateSchema = /*#__PURE__*/function (_Schema) {
|
2591
|
+
_inherits(DateSchema, _Schema);
|
2592
|
+
function DateSchema(options) {
|
2593
|
+
var _this;
|
2594
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2595
|
+
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
2596
|
+
_classCallCheck(this, DateSchema);
|
2597
|
+
_this = _callSuper(this, DateSchema);
|
2598
|
+
_this.options = options;
|
2599
|
+
_this.opt = opt;
|
2600
|
+
_this.isRaw = isRaw;
|
2601
|
+
return _this;
|
2602
|
+
}
|
2603
|
+
_createClass(DateSchema, [{
|
2604
|
+
key: "validate",
|
2605
|
+
value: function validate(path, src) {
|
2606
|
+
var _this$options, _this$options2, _this$options3, _this$options4;
|
2607
|
+
if (this.opt && (src === null || src === undefined)) {
|
2608
|
+
return false;
|
2609
|
+
}
|
2610
|
+
if (typeof src !== "string") {
|
2611
|
+
return _defineProperty({}, path, [{
|
2612
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
2613
|
+
value: src
|
2614
|
+
}]);
|
2615
|
+
}
|
2616
|
+
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.from && (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.to) {
|
2617
|
+
if (this.options.from > this.options.to) {
|
2618
|
+
return _defineProperty({}, path, [{
|
2619
|
+
message: "From date ".concat(this.options.from, " is after to date ").concat(this.options.to),
|
2620
|
+
value: src,
|
2621
|
+
fatal: true
|
2622
|
+
}]);
|
2623
|
+
}
|
2624
|
+
if (src < this.options.from || src > this.options.to) {
|
2625
|
+
return _defineProperty({}, path, [{
|
2626
|
+
message: "Date is not between ".concat(this.options.from, " and ").concat(this.options.to),
|
2627
|
+
value: src
|
2628
|
+
}]);
|
2629
|
+
}
|
2630
|
+
} else if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.from) {
|
2631
|
+
if (src < this.options.from) {
|
2632
|
+
return _defineProperty({}, path, [{
|
2633
|
+
message: "Date is before the minimum date ".concat(this.options.from),
|
2634
|
+
value: src
|
2635
|
+
}]);
|
2636
|
+
}
|
2637
|
+
} else if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.to) {
|
2638
|
+
if (src > this.options.to) {
|
2639
|
+
return _defineProperty({}, path, [{
|
2640
|
+
message: "Date is after the maximum date ".concat(this.options.to),
|
2641
|
+
value: src
|
2642
|
+
}]);
|
2643
|
+
}
|
2644
|
+
}
|
2645
|
+
// const errors = [];
|
2646
|
+
|
2647
|
+
// if (errors.length > 0) {
|
2648
|
+
// return {
|
2649
|
+
// [path]: errors,
|
2650
|
+
// } as ValidationErrors;
|
2651
|
+
// }
|
2652
|
+
return false;
|
2653
|
+
}
|
2654
|
+
}, {
|
2655
|
+
key: "assert",
|
2656
|
+
value: function assert(src) {
|
2657
|
+
if (this.opt && (src === null || src === undefined)) {
|
2658
|
+
return true;
|
2659
|
+
}
|
2660
|
+
return typeof src === "string";
|
2661
|
+
}
|
2662
|
+
}, {
|
2663
|
+
key: "from",
|
2664
|
+
value: function from(_from) {
|
2665
|
+
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
2666
|
+
from: _from
|
2667
|
+
}), this.opt, this.isRaw);
|
2668
|
+
}
|
2669
|
+
}, {
|
2670
|
+
key: "to",
|
2671
|
+
value: function to(_to) {
|
2672
|
+
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
2673
|
+
to: _to
|
2674
|
+
}), this.opt, this.isRaw);
|
2675
|
+
}
|
2676
|
+
}, {
|
2677
|
+
key: "nullable",
|
2678
|
+
value: function nullable() {
|
2679
|
+
return new DateSchema(this.options, true, this.isRaw);
|
2680
|
+
}
|
2681
|
+
}, {
|
2682
|
+
key: "serialize",
|
2683
|
+
value: function serialize() {
|
2684
|
+
return {
|
2685
|
+
type: "date",
|
2686
|
+
opt: this.opt,
|
2687
|
+
options: this.options
|
2688
|
+
};
|
2689
|
+
}
|
2690
|
+
}]);
|
2691
|
+
return DateSchema;
|
2692
|
+
}(Schema);
|
2693
|
+
var date = function date(options) {
|
2694
|
+
return new DateSchema(options);
|
2695
|
+
};
|
2696
|
+
|
2590
2697
|
// import type { F } from "ts-toolbelt";
|
2591
2698
|
// import { i18n, I18n } from "./schema/future/i18n";
|
2592
2699
|
// import { oneOf } from "./schema/future/oneOf";
|
@@ -2609,7 +2716,8 @@ function initSchema() {
|
|
2609
2716
|
literal: literal,
|
2610
2717
|
keyOf: keyOf,
|
2611
2718
|
record: record,
|
2612
|
-
file: file
|
2719
|
+
file: file,
|
2720
|
+
date: date
|
2613
2721
|
// i18n: i18n(locales),
|
2614
2722
|
};
|
2615
2723
|
}
|
@@ -3563,6 +3671,8 @@ function deserializeSchema(serialized) {
|
|
3563
3671
|
return new FileSchema(serialized.options, serialized.opt);
|
3564
3672
|
case "image":
|
3565
3673
|
return new ImageSchema(serialized.options, serialized.opt);
|
3674
|
+
case "date":
|
3675
|
+
return new DateSchema(serialized.options);
|
3566
3676
|
default:
|
3567
3677
|
{
|
3568
3678
|
var exhaustiveCheck = serialized;
|
@@ -3933,24 +4043,71 @@ var ValApi = /*#__PURE__*/function () {
|
|
3933
4043
|
}, {
|
3934
4044
|
key: "getPatches",
|
3935
4045
|
value: function () {
|
3936
|
-
var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
4046
|
+
var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filters) {
|
4047
|
+
var params, _iterator, _step, patchId, _iterator2, _step2, author, _iterator3, _step3, moduleFilePath, searchParams;
|
3937
4048
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
3938
4049
|
while (1) switch (_context.prev = _context.next) {
|
3939
4050
|
case 0:
|
3940
|
-
|
4051
|
+
params = [];
|
4052
|
+
if (filters) {
|
4053
|
+
if (filters.patchIds) {
|
4054
|
+
_iterator = result._createForOfIteratorHelper(filters.patchIds);
|
4055
|
+
try {
|
4056
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
4057
|
+
patchId = _step.value;
|
4058
|
+
params.push(["patch_id", patchId]);
|
4059
|
+
}
|
4060
|
+
} catch (err) {
|
4061
|
+
_iterator.e(err);
|
4062
|
+
} finally {
|
4063
|
+
_iterator.f();
|
4064
|
+
}
|
4065
|
+
}
|
4066
|
+
if (filters.authors) {
|
4067
|
+
_iterator2 = result._createForOfIteratorHelper(filters.authors);
|
4068
|
+
try {
|
4069
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
4070
|
+
author = _step2.value;
|
4071
|
+
params.push(["author", author]);
|
4072
|
+
}
|
4073
|
+
} catch (err) {
|
4074
|
+
_iterator2.e(err);
|
4075
|
+
} finally {
|
4076
|
+
_iterator2.f();
|
4077
|
+
}
|
4078
|
+
}
|
4079
|
+
if (filters.moduleFilePaths) {
|
4080
|
+
_iterator3 = result._createForOfIteratorHelper(filters.moduleFilePaths);
|
4081
|
+
try {
|
4082
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
4083
|
+
moduleFilePath = _step3.value;
|
4084
|
+
params.push(["module_file_path", moduleFilePath]);
|
4085
|
+
}
|
4086
|
+
} catch (err) {
|
4087
|
+
_iterator3.e(err);
|
4088
|
+
} finally {
|
4089
|
+
_iterator3.f();
|
4090
|
+
}
|
4091
|
+
}
|
4092
|
+
if (filters.omitPatches) {
|
4093
|
+
params.push(["omit_patches", "true"]);
|
4094
|
+
}
|
4095
|
+
}
|
4096
|
+
searchParams = new URLSearchParams(params);
|
4097
|
+
return _context.abrupt("return", fetch("".concat(this.host, "/patches/~").concat(searchParams.size > 0 ? "?".concat(searchParams.toString()) : ""), {
|
3941
4098
|
headers: {
|
3942
4099
|
"Content-Type": "application/json"
|
3943
4100
|
}
|
3944
4101
|
}).then(function (res) {
|
3945
4102
|
return parse(res);
|
3946
4103
|
})["catch"](createError));
|
3947
|
-
case
|
4104
|
+
case 4:
|
3948
4105
|
case "end":
|
3949
4106
|
return _context.stop();
|
3950
4107
|
}
|
3951
4108
|
}, _callee, this);
|
3952
4109
|
}));
|
3953
|
-
function getPatches() {
|
4110
|
+
function getPatches(_x) {
|
3954
4111
|
return _getPatches.apply(this, arguments);
|
3955
4112
|
}
|
3956
4113
|
return getPatches;
|
@@ -3981,7 +4138,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
3981
4138
|
}
|
3982
4139
|
}, _callee2, this);
|
3983
4140
|
}));
|
3984
|
-
function deletePatches(
|
4141
|
+
function deletePatches(_x2, _x3) {
|
3985
4142
|
return _deletePatches.apply(this, arguments);
|
3986
4143
|
}
|
3987
4144
|
return deletePatches;
|
@@ -3989,7 +4146,8 @@ var ValApi = /*#__PURE__*/function () {
|
|
3989
4146
|
}, {
|
3990
4147
|
key: "getEditUrl",
|
3991
4148
|
value: function getEditUrl() {
|
3992
|
-
|
4149
|
+
// TODO: make route configurable
|
4150
|
+
return "/val/~";
|
3993
4151
|
}
|
3994
4152
|
}, {
|
3995
4153
|
key: "getSession",
|
@@ -4079,7 +4237,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
4079
4237
|
}
|
4080
4238
|
}, _callee3);
|
4081
4239
|
}));
|
4082
|
-
return function (
|
4240
|
+
return function (_x4) {
|
4083
4241
|
return _ref4.apply(this, arguments);
|
4084
4242
|
};
|
4085
4243
|
}())["catch"](createError);
|
@@ -4109,7 +4267,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
4109
4267
|
}
|
4110
4268
|
}, _callee4);
|
4111
4269
|
}));
|
4112
|
-
return function (
|
4270
|
+
return function (_x5) {
|
4113
4271
|
return _ref6.apply(this, arguments);
|
4114
4272
|
};
|
4115
4273
|
}())["catch"](createError);
|
@@ -4139,7 +4297,7 @@ function formatError(status, json, statusText) {
|
|
4139
4297
|
}
|
4140
4298
|
|
4141
4299
|
// TODO: validate
|
4142
|
-
function parse(
|
4300
|
+
function parse(_x6) {
|
4143
4301
|
return _parse.apply(this, arguments);
|
4144
4302
|
}
|
4145
4303
|
function _parse() {
|
@@ -4255,6 +4413,7 @@ function tryJsonParse(str) {
|
|
4255
4413
|
exports.ArraySchema = ArraySchema;
|
4256
4414
|
exports.BooleanSchema = BooleanSchema;
|
4257
4415
|
exports.Call = Call;
|
4416
|
+
exports.DateSchema = DateSchema;
|
4258
4417
|
exports.Expr = Expr;
|
4259
4418
|
exports.FATAL_ERROR_TYPES = FATAL_ERROR_TYPES;
|
4260
4419
|
exports.FILE_REF_PROP = FILE_REF_PROP;
|
@@ -541,7 +541,7 @@ function isVal(val) {
|
|
541
541
|
* The path of the source value.
|
542
542
|
*
|
543
543
|
* @example
|
544
|
-
* '/app/blogs.0.text' // the text property of the first element of the /app/blogs module
|
544
|
+
* '/app/blogs.val.ts?p=0.text' // the text property of the first element of the /app/blogs module
|
545
545
|
*/
|
546
546
|
|
547
547
|
/**
|
@@ -2587,6 +2587,113 @@ var keyOf = function keyOf(valModule) {
|
|
2587
2587
|
return new KeyOfSchema(valModule === null || valModule === void 0 || (_valModule$GetSchema = valModule[GetSchema$1]) === null || _valModule$GetSchema === void 0 ? void 0 : _valModule$GetSchema.serialize(), getValPath(valModule));
|
2588
2588
|
};
|
2589
2589
|
|
2590
|
+
var DateSchema = /*#__PURE__*/function (_Schema) {
|
2591
|
+
_inherits(DateSchema, _Schema);
|
2592
|
+
function DateSchema(options) {
|
2593
|
+
var _this;
|
2594
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2595
|
+
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
2596
|
+
_classCallCheck(this, DateSchema);
|
2597
|
+
_this = _callSuper(this, DateSchema);
|
2598
|
+
_this.options = options;
|
2599
|
+
_this.opt = opt;
|
2600
|
+
_this.isRaw = isRaw;
|
2601
|
+
return _this;
|
2602
|
+
}
|
2603
|
+
_createClass(DateSchema, [{
|
2604
|
+
key: "validate",
|
2605
|
+
value: function validate(path, src) {
|
2606
|
+
var _this$options, _this$options2, _this$options3, _this$options4;
|
2607
|
+
if (this.opt && (src === null || src === undefined)) {
|
2608
|
+
return false;
|
2609
|
+
}
|
2610
|
+
if (typeof src !== "string") {
|
2611
|
+
return _defineProperty({}, path, [{
|
2612
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
2613
|
+
value: src
|
2614
|
+
}]);
|
2615
|
+
}
|
2616
|
+
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.from && (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.to) {
|
2617
|
+
if (this.options.from > this.options.to) {
|
2618
|
+
return _defineProperty({}, path, [{
|
2619
|
+
message: "From date ".concat(this.options.from, " is after to date ").concat(this.options.to),
|
2620
|
+
value: src,
|
2621
|
+
fatal: true
|
2622
|
+
}]);
|
2623
|
+
}
|
2624
|
+
if (src < this.options.from || src > this.options.to) {
|
2625
|
+
return _defineProperty({}, path, [{
|
2626
|
+
message: "Date is not between ".concat(this.options.from, " and ").concat(this.options.to),
|
2627
|
+
value: src
|
2628
|
+
}]);
|
2629
|
+
}
|
2630
|
+
} else if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.from) {
|
2631
|
+
if (src < this.options.from) {
|
2632
|
+
return _defineProperty({}, path, [{
|
2633
|
+
message: "Date is before the minimum date ".concat(this.options.from),
|
2634
|
+
value: src
|
2635
|
+
}]);
|
2636
|
+
}
|
2637
|
+
} else if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.to) {
|
2638
|
+
if (src > this.options.to) {
|
2639
|
+
return _defineProperty({}, path, [{
|
2640
|
+
message: "Date is after the maximum date ".concat(this.options.to),
|
2641
|
+
value: src
|
2642
|
+
}]);
|
2643
|
+
}
|
2644
|
+
}
|
2645
|
+
// const errors = [];
|
2646
|
+
|
2647
|
+
// if (errors.length > 0) {
|
2648
|
+
// return {
|
2649
|
+
// [path]: errors,
|
2650
|
+
// } as ValidationErrors;
|
2651
|
+
// }
|
2652
|
+
return false;
|
2653
|
+
}
|
2654
|
+
}, {
|
2655
|
+
key: "assert",
|
2656
|
+
value: function assert(src) {
|
2657
|
+
if (this.opt && (src === null || src === undefined)) {
|
2658
|
+
return true;
|
2659
|
+
}
|
2660
|
+
return typeof src === "string";
|
2661
|
+
}
|
2662
|
+
}, {
|
2663
|
+
key: "from",
|
2664
|
+
value: function from(_from) {
|
2665
|
+
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
2666
|
+
from: _from
|
2667
|
+
}), this.opt, this.isRaw);
|
2668
|
+
}
|
2669
|
+
}, {
|
2670
|
+
key: "to",
|
2671
|
+
value: function to(_to) {
|
2672
|
+
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
2673
|
+
to: _to
|
2674
|
+
}), this.opt, this.isRaw);
|
2675
|
+
}
|
2676
|
+
}, {
|
2677
|
+
key: "nullable",
|
2678
|
+
value: function nullable() {
|
2679
|
+
return new DateSchema(this.options, true, this.isRaw);
|
2680
|
+
}
|
2681
|
+
}, {
|
2682
|
+
key: "serialize",
|
2683
|
+
value: function serialize() {
|
2684
|
+
return {
|
2685
|
+
type: "date",
|
2686
|
+
opt: this.opt,
|
2687
|
+
options: this.options
|
2688
|
+
};
|
2689
|
+
}
|
2690
|
+
}]);
|
2691
|
+
return DateSchema;
|
2692
|
+
}(Schema);
|
2693
|
+
var date = function date(options) {
|
2694
|
+
return new DateSchema(options);
|
2695
|
+
};
|
2696
|
+
|
2590
2697
|
// import type { F } from "ts-toolbelt";
|
2591
2698
|
// import { i18n, I18n } from "./schema/future/i18n";
|
2592
2699
|
// import { oneOf } from "./schema/future/oneOf";
|
@@ -2609,7 +2716,8 @@ function initSchema() {
|
|
2609
2716
|
literal: literal,
|
2610
2717
|
keyOf: keyOf,
|
2611
2718
|
record: record,
|
2612
|
-
file: file
|
2719
|
+
file: file,
|
2720
|
+
date: date
|
2613
2721
|
// i18n: i18n(locales),
|
2614
2722
|
};
|
2615
2723
|
}
|
@@ -3563,6 +3671,8 @@ function deserializeSchema(serialized) {
|
|
3563
3671
|
return new FileSchema(serialized.options, serialized.opt);
|
3564
3672
|
case "image":
|
3565
3673
|
return new ImageSchema(serialized.options, serialized.opt);
|
3674
|
+
case "date":
|
3675
|
+
return new DateSchema(serialized.options);
|
3566
3676
|
default:
|
3567
3677
|
{
|
3568
3678
|
var exhaustiveCheck = serialized;
|
@@ -3933,24 +4043,71 @@ var ValApi = /*#__PURE__*/function () {
|
|
3933
4043
|
}, {
|
3934
4044
|
key: "getPatches",
|
3935
4045
|
value: function () {
|
3936
|
-
var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
4046
|
+
var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filters) {
|
4047
|
+
var params, _iterator, _step, patchId, _iterator2, _step2, author, _iterator3, _step3, moduleFilePath, searchParams;
|
3937
4048
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
3938
4049
|
while (1) switch (_context.prev = _context.next) {
|
3939
4050
|
case 0:
|
3940
|
-
|
4051
|
+
params = [];
|
4052
|
+
if (filters) {
|
4053
|
+
if (filters.patchIds) {
|
4054
|
+
_iterator = result._createForOfIteratorHelper(filters.patchIds);
|
4055
|
+
try {
|
4056
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
4057
|
+
patchId = _step.value;
|
4058
|
+
params.push(["patch_id", patchId]);
|
4059
|
+
}
|
4060
|
+
} catch (err) {
|
4061
|
+
_iterator.e(err);
|
4062
|
+
} finally {
|
4063
|
+
_iterator.f();
|
4064
|
+
}
|
4065
|
+
}
|
4066
|
+
if (filters.authors) {
|
4067
|
+
_iterator2 = result._createForOfIteratorHelper(filters.authors);
|
4068
|
+
try {
|
4069
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
4070
|
+
author = _step2.value;
|
4071
|
+
params.push(["author", author]);
|
4072
|
+
}
|
4073
|
+
} catch (err) {
|
4074
|
+
_iterator2.e(err);
|
4075
|
+
} finally {
|
4076
|
+
_iterator2.f();
|
4077
|
+
}
|
4078
|
+
}
|
4079
|
+
if (filters.moduleFilePaths) {
|
4080
|
+
_iterator3 = result._createForOfIteratorHelper(filters.moduleFilePaths);
|
4081
|
+
try {
|
4082
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
4083
|
+
moduleFilePath = _step3.value;
|
4084
|
+
params.push(["module_file_path", moduleFilePath]);
|
4085
|
+
}
|
4086
|
+
} catch (err) {
|
4087
|
+
_iterator3.e(err);
|
4088
|
+
} finally {
|
4089
|
+
_iterator3.f();
|
4090
|
+
}
|
4091
|
+
}
|
4092
|
+
if (filters.omitPatches) {
|
4093
|
+
params.push(["omit_patches", "true"]);
|
4094
|
+
}
|
4095
|
+
}
|
4096
|
+
searchParams = new URLSearchParams(params);
|
4097
|
+
return _context.abrupt("return", fetch("".concat(this.host, "/patches/~").concat(searchParams.size > 0 ? "?".concat(searchParams.toString()) : ""), {
|
3941
4098
|
headers: {
|
3942
4099
|
"Content-Type": "application/json"
|
3943
4100
|
}
|
3944
4101
|
}).then(function (res) {
|
3945
4102
|
return parse(res);
|
3946
4103
|
})["catch"](createError));
|
3947
|
-
case
|
4104
|
+
case 4:
|
3948
4105
|
case "end":
|
3949
4106
|
return _context.stop();
|
3950
4107
|
}
|
3951
4108
|
}, _callee, this);
|
3952
4109
|
}));
|
3953
|
-
function getPatches() {
|
4110
|
+
function getPatches(_x) {
|
3954
4111
|
return _getPatches.apply(this, arguments);
|
3955
4112
|
}
|
3956
4113
|
return getPatches;
|
@@ -3981,7 +4138,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
3981
4138
|
}
|
3982
4139
|
}, _callee2, this);
|
3983
4140
|
}));
|
3984
|
-
function deletePatches(
|
4141
|
+
function deletePatches(_x2, _x3) {
|
3985
4142
|
return _deletePatches.apply(this, arguments);
|
3986
4143
|
}
|
3987
4144
|
return deletePatches;
|
@@ -3989,7 +4146,8 @@ var ValApi = /*#__PURE__*/function () {
|
|
3989
4146
|
}, {
|
3990
4147
|
key: "getEditUrl",
|
3991
4148
|
value: function getEditUrl() {
|
3992
|
-
|
4149
|
+
// TODO: make route configurable
|
4150
|
+
return "/val/~";
|
3993
4151
|
}
|
3994
4152
|
}, {
|
3995
4153
|
key: "getSession",
|
@@ -4079,7 +4237,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
4079
4237
|
}
|
4080
4238
|
}, _callee3);
|
4081
4239
|
}));
|
4082
|
-
return function (
|
4240
|
+
return function (_x4) {
|
4083
4241
|
return _ref4.apply(this, arguments);
|
4084
4242
|
};
|
4085
4243
|
}())["catch"](createError);
|
@@ -4109,7 +4267,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
4109
4267
|
}
|
4110
4268
|
}, _callee4);
|
4111
4269
|
}));
|
4112
|
-
return function (
|
4270
|
+
return function (_x5) {
|
4113
4271
|
return _ref6.apply(this, arguments);
|
4114
4272
|
};
|
4115
4273
|
}())["catch"](createError);
|
@@ -4139,7 +4297,7 @@ function formatError(status, json, statusText) {
|
|
4139
4297
|
}
|
4140
4298
|
|
4141
4299
|
// TODO: validate
|
4142
|
-
function parse(
|
4300
|
+
function parse(_x6) {
|
4143
4301
|
return _parse.apply(this, arguments);
|
4144
4302
|
}
|
4145
4303
|
function _parse() {
|
@@ -4255,6 +4413,7 @@ function tryJsonParse(str) {
|
|
4255
4413
|
exports.ArraySchema = ArraySchema;
|
4256
4414
|
exports.BooleanSchema = BooleanSchema;
|
4257
4415
|
exports.Call = Call;
|
4416
|
+
exports.DateSchema = DateSchema;
|
4258
4417
|
exports.Expr = Expr;
|
4259
4418
|
exports.FATAL_ERROR_TYPES = FATAL_ERROR_TYPES;
|
4260
4419
|
exports.FILE_REF_PROP = FILE_REF_PROP;
|
@@ -519,7 +519,7 @@ function isVal(val) {
|
|
519
519
|
* The path of the source value.
|
520
520
|
*
|
521
521
|
* @example
|
522
|
-
* '/app/blogs.0.text' // the text property of the first element of the /app/blogs module
|
522
|
+
* '/app/blogs.val.ts?p=0.text' // the text property of the first element of the /app/blogs module
|
523
523
|
*/
|
524
524
|
|
525
525
|
/**
|
@@ -2565,6 +2565,113 @@ var keyOf = function keyOf(valModule) {
|
|
2565
2565
|
return new KeyOfSchema(valModule === null || valModule === void 0 || (_valModule$GetSchema = valModule[GetSchema$1]) === null || _valModule$GetSchema === void 0 ? void 0 : _valModule$GetSchema.serialize(), getValPath(valModule));
|
2566
2566
|
};
|
2567
2567
|
|
2568
|
+
var DateSchema = /*#__PURE__*/function (_Schema) {
|
2569
|
+
_inherits(DateSchema, _Schema);
|
2570
|
+
function DateSchema(options) {
|
2571
|
+
var _this;
|
2572
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2573
|
+
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
2574
|
+
_classCallCheck(this, DateSchema);
|
2575
|
+
_this = _callSuper(this, DateSchema);
|
2576
|
+
_this.options = options;
|
2577
|
+
_this.opt = opt;
|
2578
|
+
_this.isRaw = isRaw;
|
2579
|
+
return _this;
|
2580
|
+
}
|
2581
|
+
_createClass(DateSchema, [{
|
2582
|
+
key: "validate",
|
2583
|
+
value: function validate(path, src) {
|
2584
|
+
var _this$options, _this$options2, _this$options3, _this$options4;
|
2585
|
+
if (this.opt && (src === null || src === undefined)) {
|
2586
|
+
return false;
|
2587
|
+
}
|
2588
|
+
if (typeof src !== "string") {
|
2589
|
+
return _defineProperty({}, path, [{
|
2590
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
2591
|
+
value: src
|
2592
|
+
}]);
|
2593
|
+
}
|
2594
|
+
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.from && (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.to) {
|
2595
|
+
if (this.options.from > this.options.to) {
|
2596
|
+
return _defineProperty({}, path, [{
|
2597
|
+
message: "From date ".concat(this.options.from, " is after to date ").concat(this.options.to),
|
2598
|
+
value: src,
|
2599
|
+
fatal: true
|
2600
|
+
}]);
|
2601
|
+
}
|
2602
|
+
if (src < this.options.from || src > this.options.to) {
|
2603
|
+
return _defineProperty({}, path, [{
|
2604
|
+
message: "Date is not between ".concat(this.options.from, " and ").concat(this.options.to),
|
2605
|
+
value: src
|
2606
|
+
}]);
|
2607
|
+
}
|
2608
|
+
} else if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.from) {
|
2609
|
+
if (src < this.options.from) {
|
2610
|
+
return _defineProperty({}, path, [{
|
2611
|
+
message: "Date is before the minimum date ".concat(this.options.from),
|
2612
|
+
value: src
|
2613
|
+
}]);
|
2614
|
+
}
|
2615
|
+
} else if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.to) {
|
2616
|
+
if (src > this.options.to) {
|
2617
|
+
return _defineProperty({}, path, [{
|
2618
|
+
message: "Date is after the maximum date ".concat(this.options.to),
|
2619
|
+
value: src
|
2620
|
+
}]);
|
2621
|
+
}
|
2622
|
+
}
|
2623
|
+
// const errors = [];
|
2624
|
+
|
2625
|
+
// if (errors.length > 0) {
|
2626
|
+
// return {
|
2627
|
+
// [path]: errors,
|
2628
|
+
// } as ValidationErrors;
|
2629
|
+
// }
|
2630
|
+
return false;
|
2631
|
+
}
|
2632
|
+
}, {
|
2633
|
+
key: "assert",
|
2634
|
+
value: function assert(src) {
|
2635
|
+
if (this.opt && (src === null || src === undefined)) {
|
2636
|
+
return true;
|
2637
|
+
}
|
2638
|
+
return typeof src === "string";
|
2639
|
+
}
|
2640
|
+
}, {
|
2641
|
+
key: "from",
|
2642
|
+
value: function from(_from) {
|
2643
|
+
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
2644
|
+
from: _from
|
2645
|
+
}), this.opt, this.isRaw);
|
2646
|
+
}
|
2647
|
+
}, {
|
2648
|
+
key: "to",
|
2649
|
+
value: function to(_to) {
|
2650
|
+
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
2651
|
+
to: _to
|
2652
|
+
}), this.opt, this.isRaw);
|
2653
|
+
}
|
2654
|
+
}, {
|
2655
|
+
key: "nullable",
|
2656
|
+
value: function nullable() {
|
2657
|
+
return new DateSchema(this.options, true, this.isRaw);
|
2658
|
+
}
|
2659
|
+
}, {
|
2660
|
+
key: "serialize",
|
2661
|
+
value: function serialize() {
|
2662
|
+
return {
|
2663
|
+
type: "date",
|
2664
|
+
opt: this.opt,
|
2665
|
+
options: this.options
|
2666
|
+
};
|
2667
|
+
}
|
2668
|
+
}]);
|
2669
|
+
return DateSchema;
|
2670
|
+
}(Schema);
|
2671
|
+
var date = function date(options) {
|
2672
|
+
return new DateSchema(options);
|
2673
|
+
};
|
2674
|
+
|
2568
2675
|
// import type { F } from "ts-toolbelt";
|
2569
2676
|
// import { i18n, I18n } from "./schema/future/i18n";
|
2570
2677
|
// import { oneOf } from "./schema/future/oneOf";
|
@@ -2587,7 +2694,8 @@ function initSchema() {
|
|
2587
2694
|
literal: literal,
|
2588
2695
|
keyOf: keyOf,
|
2589
2696
|
record: record,
|
2590
|
-
file: file
|
2697
|
+
file: file,
|
2698
|
+
date: date
|
2591
2699
|
// i18n: i18n(locales),
|
2592
2700
|
};
|
2593
2701
|
}
|
@@ -3541,6 +3649,8 @@ function deserializeSchema(serialized) {
|
|
3541
3649
|
return new FileSchema(serialized.options, serialized.opt);
|
3542
3650
|
case "image":
|
3543
3651
|
return new ImageSchema(serialized.options, serialized.opt);
|
3652
|
+
case "date":
|
3653
|
+
return new DateSchema(serialized.options);
|
3544
3654
|
default:
|
3545
3655
|
{
|
3546
3656
|
var exhaustiveCheck = serialized;
|
@@ -3911,24 +4021,71 @@ var ValApi = /*#__PURE__*/function () {
|
|
3911
4021
|
}, {
|
3912
4022
|
key: "getPatches",
|
3913
4023
|
value: function () {
|
3914
|
-
var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
4024
|
+
var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filters) {
|
4025
|
+
var params, _iterator, _step, patchId, _iterator2, _step2, author, _iterator3, _step3, moduleFilePath, searchParams;
|
3915
4026
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
3916
4027
|
while (1) switch (_context.prev = _context.next) {
|
3917
4028
|
case 0:
|
3918
|
-
|
4029
|
+
params = [];
|
4030
|
+
if (filters) {
|
4031
|
+
if (filters.patchIds) {
|
4032
|
+
_iterator = _createForOfIteratorHelper(filters.patchIds);
|
4033
|
+
try {
|
4034
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
4035
|
+
patchId = _step.value;
|
4036
|
+
params.push(["patch_id", patchId]);
|
4037
|
+
}
|
4038
|
+
} catch (err) {
|
4039
|
+
_iterator.e(err);
|
4040
|
+
} finally {
|
4041
|
+
_iterator.f();
|
4042
|
+
}
|
4043
|
+
}
|
4044
|
+
if (filters.authors) {
|
4045
|
+
_iterator2 = _createForOfIteratorHelper(filters.authors);
|
4046
|
+
try {
|
4047
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
4048
|
+
author = _step2.value;
|
4049
|
+
params.push(["author", author]);
|
4050
|
+
}
|
4051
|
+
} catch (err) {
|
4052
|
+
_iterator2.e(err);
|
4053
|
+
} finally {
|
4054
|
+
_iterator2.f();
|
4055
|
+
}
|
4056
|
+
}
|
4057
|
+
if (filters.moduleFilePaths) {
|
4058
|
+
_iterator3 = _createForOfIteratorHelper(filters.moduleFilePaths);
|
4059
|
+
try {
|
4060
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
4061
|
+
moduleFilePath = _step3.value;
|
4062
|
+
params.push(["module_file_path", moduleFilePath]);
|
4063
|
+
}
|
4064
|
+
} catch (err) {
|
4065
|
+
_iterator3.e(err);
|
4066
|
+
} finally {
|
4067
|
+
_iterator3.f();
|
4068
|
+
}
|
4069
|
+
}
|
4070
|
+
if (filters.omitPatches) {
|
4071
|
+
params.push(["omit_patches", "true"]);
|
4072
|
+
}
|
4073
|
+
}
|
4074
|
+
searchParams = new URLSearchParams(params);
|
4075
|
+
return _context.abrupt("return", fetch("".concat(this.host, "/patches/~").concat(searchParams.size > 0 ? "?".concat(searchParams.toString()) : ""), {
|
3919
4076
|
headers: {
|
3920
4077
|
"Content-Type": "application/json"
|
3921
4078
|
}
|
3922
4079
|
}).then(function (res) {
|
3923
4080
|
return parse(res);
|
3924
4081
|
})["catch"](createError));
|
3925
|
-
case
|
4082
|
+
case 4:
|
3926
4083
|
case "end":
|
3927
4084
|
return _context.stop();
|
3928
4085
|
}
|
3929
4086
|
}, _callee, this);
|
3930
4087
|
}));
|
3931
|
-
function getPatches() {
|
4088
|
+
function getPatches(_x) {
|
3932
4089
|
return _getPatches.apply(this, arguments);
|
3933
4090
|
}
|
3934
4091
|
return getPatches;
|
@@ -3959,7 +4116,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
3959
4116
|
}
|
3960
4117
|
}, _callee2, this);
|
3961
4118
|
}));
|
3962
|
-
function deletePatches(
|
4119
|
+
function deletePatches(_x2, _x3) {
|
3963
4120
|
return _deletePatches.apply(this, arguments);
|
3964
4121
|
}
|
3965
4122
|
return deletePatches;
|
@@ -3967,7 +4124,8 @@ var ValApi = /*#__PURE__*/function () {
|
|
3967
4124
|
}, {
|
3968
4125
|
key: "getEditUrl",
|
3969
4126
|
value: function getEditUrl() {
|
3970
|
-
|
4127
|
+
// TODO: make route configurable
|
4128
|
+
return "/val/~";
|
3971
4129
|
}
|
3972
4130
|
}, {
|
3973
4131
|
key: "getSession",
|
@@ -4057,7 +4215,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
4057
4215
|
}
|
4058
4216
|
}, _callee3);
|
4059
4217
|
}));
|
4060
|
-
return function (
|
4218
|
+
return function (_x4) {
|
4061
4219
|
return _ref4.apply(this, arguments);
|
4062
4220
|
};
|
4063
4221
|
}())["catch"](createError);
|
@@ -4087,7 +4245,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
4087
4245
|
}
|
4088
4246
|
}, _callee4);
|
4089
4247
|
}));
|
4090
|
-
return function (
|
4248
|
+
return function (_x5) {
|
4091
4249
|
return _ref6.apply(this, arguments);
|
4092
4250
|
};
|
4093
4251
|
}())["catch"](createError);
|
@@ -4117,7 +4275,7 @@ function formatError(status, json, statusText) {
|
|
4117
4275
|
}
|
4118
4276
|
|
4119
4277
|
// TODO: validate
|
4120
|
-
function parse(
|
4278
|
+
function parse(_x6) {
|
4121
4279
|
return _parse.apply(this, arguments);
|
4122
4280
|
}
|
4123
4281
|
function _parse() {
|
@@ -4230,4 +4388,4 @@ function tryJsonParse(str) {
|
|
4230
4388
|
}
|
4231
4389
|
}
|
4232
4390
|
|
4233
|
-
export { ArraySchema as A, BooleanSchema as B, Call as C, Expr as E, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, LiteralSchema as L, NilSym as N, ObjectSchema as O, PatchError as P, RT_IMAGE_TAG as R, StringLiteral as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, StringTemplate as e, Sym as f, evaluate as g, initVal as h, index as i, Schema as j, FILE_REF_PROP as k, FILE_REF_SUBTYPE_TAG as l, modules as m, derefPatch as n, RecordSchema as o, parse$1 as p, StringSchema as q, NumberSchema as r, splitModuleFilePathAndModulePath as s, ImageSchema as t, FileSchema as u, RichTextSchema as v, deserializeSchema as w, ValApi as x };
|
4391
|
+
export { ArraySchema as A, BooleanSchema as B, Call as C, DateSchema as D, Expr as E, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, LiteralSchema as L, NilSym as N, ObjectSchema as O, PatchError as P, RT_IMAGE_TAG as R, StringLiteral as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, StringTemplate as e, Sym as f, evaluate as g, initVal as h, index as i, Schema as j, FILE_REF_PROP as k, FILE_REF_SUBTYPE_TAG as l, modules as m, derefPatch as n, RecordSchema as o, parse$1 as p, StringSchema as q, NumberSchema as r, splitModuleFilePathAndModulePath as s, ImageSchema as t, FileSchema as u, RichTextSchema as v, deserializeSchema as w, ValApi as x };
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('./index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('./index-c67ed8f9.cjs.dev.js');
|
6
6
|
require('./result-48320acd.cjs.dev.js');
|
7
7
|
require('marked');
|
8
8
|
require('@valbuild/core');
|
@@ -11,6 +11,7 @@ require('@valbuild/core');
|
|
11
11
|
|
12
12
|
exports.ArraySchema = expr_dist_valbuildCoreExpr.ArraySchema;
|
13
13
|
exports.BooleanSchema = expr_dist_valbuildCoreExpr.BooleanSchema;
|
14
|
+
exports.DateSchema = expr_dist_valbuildCoreExpr.DateSchema;
|
14
15
|
exports.FATAL_ERROR_TYPES = expr_dist_valbuildCoreExpr.FATAL_ERROR_TYPES;
|
15
16
|
exports.FILE_REF_PROP = expr_dist_valbuildCoreExpr.FILE_REF_PROP;
|
16
17
|
exports.FILE_REF_SUBTYPE_TAG = expr_dist_valbuildCoreExpr.FILE_REF_SUBTYPE_TAG;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('./index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('./index-041f75bd.cjs.prod.js');
|
6
6
|
require('./result-26f67b40.cjs.prod.js');
|
7
7
|
require('marked');
|
8
8
|
require('@valbuild/core');
|
@@ -11,6 +11,7 @@ require('@valbuild/core');
|
|
11
11
|
|
12
12
|
exports.ArraySchema = expr_dist_valbuildCoreExpr.ArraySchema;
|
13
13
|
exports.BooleanSchema = expr_dist_valbuildCoreExpr.BooleanSchema;
|
14
|
+
exports.DateSchema = expr_dist_valbuildCoreExpr.DateSchema;
|
14
15
|
exports.FATAL_ERROR_TYPES = expr_dist_valbuildCoreExpr.FATAL_ERROR_TYPES;
|
15
16
|
exports.FILE_REF_PROP = expr_dist_valbuildCoreExpr.FILE_REF_PROP;
|
16
17
|
exports.FILE_REF_SUBTYPE_TAG = expr_dist_valbuildCoreExpr.FILE_REF_SUBTYPE_TAG;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { A as ArraySchema, B as BooleanSchema, F as FATAL_ERROR_TYPES, k as FILE_REF_PROP, l as FILE_REF_SUBTYPE_TAG, u as FileSchema, G as GenericSelector, t as ImageSchema, I as Internal, L as LiteralSchema, r as NumberSchema, O as ObjectSchema, R as RT_IMAGE_TAG, o as RecordSchema, v as RichTextSchema, j as Schema, q as StringSchema, U as UnionSchema, V as VAL_EXTENSION, x as ValApi, n as derefPatch, w as deserializeSchema, i as expr, h as initVal, m as modules } from './index-
|
1
|
+
export { A as ArraySchema, B as BooleanSchema, D as DateSchema, F as FATAL_ERROR_TYPES, k as FILE_REF_PROP, l as FILE_REF_SUBTYPE_TAG, u as FileSchema, G as GenericSelector, t as ImageSchema, I as Internal, L as LiteralSchema, r as NumberSchema, O as ObjectSchema, R as RT_IMAGE_TAG, o as RecordSchema, v as RichTextSchema, j as Schema, q as StringSchema, U as UnionSchema, V as VAL_EXTENSION, x as ValApi, n as derefPatch, w as deserializeSchema, i as expr, h as initVal, m as modules } from './index-fccba617.esm.js';
|
2
2
|
import './result-a8316efa.esm.js';
|
3
3
|
import 'marked';
|
4
4
|
import '@valbuild/core';
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-c67ed8f9.cjs.dev.js');
|
6
6
|
require('../../dist/result-48320acd.cjs.dev.js');
|
7
7
|
require('marked');
|
8
8
|
require('@valbuild/core');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-041f75bd.cjs.prod.js');
|
6
6
|
require('../../dist/result-26f67b40.cjs.prod.js');
|
7
7
|
require('marked');
|
8
8
|
require('@valbuild/core');
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { C as Call, E as Expr, N as NilSym, S as StringLiteral, e as StringTemplate, f as Sym, g as evaluate, p as parse } from '../../dist/index-
|
1
|
+
export { C as Call, E as Expr, N as NilSym, S as StringLiteral, e as StringTemplate, f as Sym, g as evaluate, p as parse } from '../../dist/index-fccba617.esm.js';
|
2
2
|
import '../../dist/result-a8316efa.esm.js';
|
3
3
|
import 'marked';
|
4
4
|
import '@valbuild/core';
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-c67ed8f9.cjs.dev.js');
|
6
6
|
var result = require('../../dist/result-48320acd.cjs.dev.js');
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
8
8
|
require('marked');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-041f75bd.cjs.prod.js');
|
6
6
|
var result = require('../../dist/result-26f67b40.cjs.prod.js');
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
8
8
|
require('marked');
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-
|
2
|
-
export { P as PatchError } from '../../dist/index-
|
1
|
+
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-fccba617.esm.js';
|
2
|
+
export { P as PatchError } from '../../dist/index-fccba617.esm.js';
|
3
3
|
import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-a8316efa.esm.js';
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
5
5
|
import 'marked';
|