@fieldia/core 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/schema/page.schema.json +55 -5
- package/src/index.d.mts +5 -14
- package/src/index.d.ts +5 -14
- package/src/index.js +4 -29
- package/src/index.js.map +1 -1
- package/src/index.mjs +4 -11
- package/src/index.mjs.map +1 -1
- package/src/lib/format/check-page.d.mts +9 -0
- package/src/lib/format/check-page.d.ts +9 -0
- package/src/lib/format/check-page.js +54 -0
- package/src/lib/format/check-page.js.map +1 -0
- package/src/lib/format/check-page.mjs +51 -0
- package/src/lib/format/check-page.mjs.map +1 -0
- package/src/lib/format/columns.d.mts +3 -0
- package/src/lib/format/columns.d.ts +3 -0
- package/src/lib/format/columns.js +8 -0
- package/src/lib/format/columns.js.map +1 -0
- package/src/lib/format/columns.mjs +5 -0
- package/src/lib/format/columns.mjs.map +1 -0
- package/src/lib/format/field.d.mts +163 -35
- package/src/lib/format/field.d.ts +163 -35
- package/src/lib/format/field.js +36 -38
- package/src/lib/format/field.js.map +1 -1
- package/src/lib/format/field.mjs +25 -29
- package/src/lib/format/field.mjs.map +1 -1
- package/src/lib/format/layout.d.mts +1 -2
- package/src/lib/format/layout.d.ts +1 -2
- package/src/lib/format/layout.js +3 -6
- package/src/lib/format/layout.js.map +1 -1
- package/src/lib/format/layout.mjs +1 -4
- package/src/lib/format/layout.mjs.map +1 -1
- package/src/lib/format/names.d.mts +5 -0
- package/src/lib/format/names.d.ts +5 -0
- package/src/lib/format/names.js +27 -0
- package/src/lib/format/names.js.map +1 -0
- package/src/lib/format/names.mjs +24 -0
- package/src/lib/format/names.mjs.map +1 -0
- package/src/lib/format/page.d.mts +46 -10
- package/src/lib/format/page.d.ts +46 -10
- package/src/lib/format/page.js +4 -3
- package/src/lib/format/page.js.map +1 -1
- package/src/lib/format/page.mjs +2 -2
- package/src/lib/format/page.mjs.map +1 -1
- package/src/lib/format/references.d.mts +35 -0
- package/src/lib/format/references.d.ts +35 -0
- package/src/lib/format/references.js +278 -0
- package/src/lib/format/references.js.map +1 -0
- package/src/lib/format/references.mjs +274 -0
- package/src/lib/format/references.mjs.map +1 -0
- package/src/lib/format/translate.d.mts +8 -0
- package/src/lib/format/translate.d.ts +8 -0
- package/src/lib/format/translate.js +36 -0
- package/src/lib/format/translate.js.map +1 -0
- package/src/lib/format/translate.mjs +33 -0
- package/src/lib/format/translate.mjs.map +1 -0
- package/src/lib/format/validate.d.mts +2 -13
- package/src/lib/format/validate.d.ts +2 -13
- package/src/lib/format/validate.js +2 -265
- package/src/lib/format/validate.js.map +1 -1
- package/src/lib/format/validate.mjs +1 -264
- package/src/lib/format/validate.mjs.map +1 -1
- package/src/lib/format/version.d.mts +2 -0
- package/src/lib/format/version.d.ts +2 -0
- package/src/lib/format/version.js +6 -0
- package/src/lib/format/version.js.map +1 -0
- package/src/lib/format/version.mjs +3 -0
- package/src/lib/format/version.mjs.map +1 -0
- package/src/lib/record/data-source.d.mts +27 -1
- package/src/lib/record/data-source.d.ts +27 -1
- package/src/lib/record/data-source.js +16 -0
- package/src/lib/record/data-source.js.map +1 -1
- package/src/lib/record/data-source.mjs +14 -1
- package/src/lib/record/data-source.mjs.map +1 -1
- package/src/lib/record/filter.d.mts +8 -0
- package/src/lib/record/filter.d.ts +8 -0
- package/src/lib/record/filter.js +66 -0
- package/src/lib/record/filter.js.map +1 -0
- package/src/lib/record/filter.mjs +63 -0
- package/src/lib/record/filter.mjs.map +1 -0
- package/src/lib/record/form.d.mts +5 -1
- package/src/lib/record/form.d.ts +5 -1
- package/src/lib/record/form.js +33 -10
- package/src/lib/record/form.js.map +1 -1
- package/src/lib/record/form.mjs +33 -10
- package/src/lib/record/form.mjs.map +1 -1
- package/src/lib/record/memory-data-source.js +2 -28
- package/src/lib/record/memory-data-source.js.map +1 -1
- package/src/lib/record/memory-data-source.mjs +2 -28
- package/src/lib/record/memory-data-source.mjs.map +1 -1
- package/src/runtime.d.mts +26 -0
- package/src/runtime.d.ts +26 -0
- package/src/runtime.js +44 -0
- package/src/runtime.js.map +1 -0
- package/src/runtime.mjs +16 -0
- package/src/runtime.mjs.map +1 -0
package/package.json
CHANGED
package/schema/page.schema.json
CHANGED
|
@@ -573,7 +573,7 @@
|
|
|
573
573
|
"filter": {
|
|
574
574
|
"type": "array",
|
|
575
575
|
"items": {
|
|
576
|
-
"$ref": "#/$defs/
|
|
576
|
+
"$ref": "#/$defs/FilterItem"
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
},
|
|
@@ -613,7 +613,7 @@
|
|
|
613
613
|
"filter": {
|
|
614
614
|
"type": "array",
|
|
615
615
|
"items": {
|
|
616
|
-
"$ref": "#/$defs/
|
|
616
|
+
"$ref": "#/$defs/FilterItem"
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
},
|
|
@@ -832,6 +832,19 @@
|
|
|
832
832
|
],
|
|
833
833
|
"additionalProperties": false
|
|
834
834
|
},
|
|
835
|
+
"FilterItem": {
|
|
836
|
+
"anyOf": [
|
|
837
|
+
{
|
|
838
|
+
"$ref": "#/$defs/FilterCondition"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
"$ref": "#/$defs/FilterAny"
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"$ref": "#/$defs/FilterAll"
|
|
845
|
+
}
|
|
846
|
+
]
|
|
847
|
+
},
|
|
835
848
|
"FilterCondition": {
|
|
836
849
|
"type": "object",
|
|
837
850
|
"properties": {
|
|
@@ -851,7 +864,12 @@
|
|
|
851
864
|
"in",
|
|
852
865
|
"not in",
|
|
853
866
|
"like",
|
|
854
|
-
"ilike"
|
|
867
|
+
"ilike",
|
|
868
|
+
"startswith",
|
|
869
|
+
"endswith",
|
|
870
|
+
"set",
|
|
871
|
+
"notset",
|
|
872
|
+
"between"
|
|
855
873
|
]
|
|
856
874
|
},
|
|
857
875
|
"value": {
|
|
@@ -868,6 +886,38 @@
|
|
|
868
886
|
],
|
|
869
887
|
"additionalProperties": false
|
|
870
888
|
},
|
|
889
|
+
"FilterAny": {
|
|
890
|
+
"type": "object",
|
|
891
|
+
"properties": {
|
|
892
|
+
"any": {
|
|
893
|
+
"minItems": 1,
|
|
894
|
+
"type": "array",
|
|
895
|
+
"items": {
|
|
896
|
+
"$ref": "#/$defs/FilterItem"
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
"required": [
|
|
901
|
+
"any"
|
|
902
|
+
],
|
|
903
|
+
"additionalProperties": false
|
|
904
|
+
},
|
|
905
|
+
"FilterAll": {
|
|
906
|
+
"type": "object",
|
|
907
|
+
"properties": {
|
|
908
|
+
"all": {
|
|
909
|
+
"minItems": 1,
|
|
910
|
+
"type": "array",
|
|
911
|
+
"items": {
|
|
912
|
+
"$ref": "#/$defs/FilterItem"
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
"required": [
|
|
917
|
+
"all"
|
|
918
|
+
],
|
|
919
|
+
"additionalProperties": false
|
|
920
|
+
},
|
|
871
921
|
"LineField": {
|
|
872
922
|
"oneOf": [
|
|
873
923
|
{
|
|
@@ -1349,7 +1399,7 @@
|
|
|
1349
1399
|
"filter": {
|
|
1350
1400
|
"type": "array",
|
|
1351
1401
|
"items": {
|
|
1352
|
-
"$ref": "#/$defs/
|
|
1402
|
+
"$ref": "#/$defs/FilterItem"
|
|
1353
1403
|
}
|
|
1354
1404
|
}
|
|
1355
1405
|
},
|
|
@@ -1389,7 +1439,7 @@
|
|
|
1389
1439
|
"filter": {
|
|
1390
1440
|
"type": "array",
|
|
1391
1441
|
"items": {
|
|
1392
|
-
"$ref": "#/$defs/
|
|
1442
|
+
"$ref": "#/$defs/FilterItem"
|
|
1393
1443
|
}
|
|
1394
1444
|
}
|
|
1395
1445
|
},
|
package/src/index.d.mts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export { ModifierSchema, LayoutNodeSchema, RootLayoutSchema
|
|
4
|
-
export {
|
|
5
|
-
export { validatePage
|
|
1
|
+
export * from './runtime.mjs';
|
|
2
|
+
export { FieldSchema, FieldsSchema, LineFieldSchema, LineKindsSchema, OptionSchema, PropertyDefinitionSchema, FilterConditionSchema, FilterItemSchema, } from './lib/format/field.mjs';
|
|
3
|
+
export { ModifierSchema, LayoutNodeSchema, RootLayoutSchema } from './lib/format/layout.mjs';
|
|
4
|
+
export { PageSchema } from './lib/format/page.mjs';
|
|
5
|
+
export { validatePage } from './lib/format/validate.mjs';
|
|
6
6
|
export { pageJsonSchema } from './lib/format/json-schema.mjs';
|
|
7
|
-
export { compileModifier, type CompiledModifier } from './lib/expression/modifier.mjs';
|
|
8
|
-
export { evaluateModifier, isModifierValid } from './lib/expression/evaluateModifier.mjs';
|
|
9
|
-
export { emptyValue, initialValues, isEmpty, expressionContext, lineKind, type RecordId, type RelatedRecord, type ReferenceValue, type FileValue, type Line, type Value, type Values, } from './lib/record/values.mjs';
|
|
10
|
-
export { checkValue, formatBytes } from './lib/record/check.mjs';
|
|
11
|
-
export type { DataSource, LoadRequest, SaveRequest, SaveResult, OnchangeRequest, OnchangeResult, SearchRequest, CreateRequest, SubmitRequest, SubmitResult, ResolvedFilterCondition, RecordChanges, LineOp, LinkOp, } from './lib/record/data-source.mjs';
|
|
12
|
-
export { createMemoryDataSource, type MemoryDataSource, type MemoryDataSourceOptions } from './lib/record/memory-data-source.mjs';
|
|
13
|
-
export { hostScheduler, wait, type Scheduler } from './lib/record/scheduler.mjs';
|
|
14
|
-
export { createForm, type Form, type FormOptions, type FormState, type FormStatus, type NodeState, type DraftStore, type ActionRequest, } from './lib/record/form.mjs';
|
|
15
|
-
export { MESSAGES, fill, type Messages, type Locale } from './lib/record/messages.mjs';
|
package/src/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export { ModifierSchema, LayoutNodeSchema, RootLayoutSchema
|
|
4
|
-
export {
|
|
5
|
-
export { validatePage
|
|
1
|
+
export * from './runtime';
|
|
2
|
+
export { FieldSchema, FieldsSchema, LineFieldSchema, LineKindsSchema, OptionSchema, PropertyDefinitionSchema, FilterConditionSchema, FilterItemSchema, } from './lib/format/field';
|
|
3
|
+
export { ModifierSchema, LayoutNodeSchema, RootLayoutSchema } from './lib/format/layout';
|
|
4
|
+
export { PageSchema } from './lib/format/page';
|
|
5
|
+
export { validatePage } from './lib/format/validate';
|
|
6
6
|
export { pageJsonSchema } from './lib/format/json-schema';
|
|
7
|
-
export { compileModifier, type CompiledModifier } from './lib/expression/modifier';
|
|
8
|
-
export { evaluateModifier, isModifierValid } from './lib/expression/evaluateModifier';
|
|
9
|
-
export { emptyValue, initialValues, isEmpty, expressionContext, lineKind, type RecordId, type RelatedRecord, type ReferenceValue, type FileValue, type Line, type Value, type Values, } from './lib/record/values';
|
|
10
|
-
export { checkValue, formatBytes } from './lib/record/check';
|
|
11
|
-
export type { DataSource, LoadRequest, SaveRequest, SaveResult, OnchangeRequest, OnchangeResult, SearchRequest, CreateRequest, SubmitRequest, SubmitResult, ResolvedFilterCondition, RecordChanges, LineOp, LinkOp, } from './lib/record/data-source';
|
|
12
|
-
export { createMemoryDataSource, type MemoryDataSource, type MemoryDataSourceOptions } from './lib/record/memory-data-source';
|
|
13
|
-
export { hostScheduler, wait, type Scheduler } from './lib/record/scheduler';
|
|
14
|
-
export { createForm, type Form, type FormOptions, type FormState, type FormStatus, type NodeState, type DraftStore, type ActionRequest, } from './lib/record/form';
|
|
15
|
-
export { MESSAGES, fill, type Messages, type Locale } from './lib/record/messages';
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.pageJsonSchema = exports.validatePage = exports.PageSchema = exports.RootLayoutSchema = exports.LayoutNodeSchema = exports.ModifierSchema = exports.FilterItemSchema = exports.FilterConditionSchema = exports.PropertyDefinitionSchema = exports.OptionSchema = exports.LineKindsSchema = exports.LineFieldSchema = exports.FieldsSchema = exports.FieldSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./runtime"), exports);
|
|
4
6
|
var field_1 = require("./lib/format/field");
|
|
5
|
-
Object.defineProperty(exports, "FIELD_NAME", { enumerable: true, get: function () { return field_1.FIELD_NAME; } });
|
|
6
|
-
Object.defineProperty(exports, "FIELD_TYPES", { enumerable: true, get: function () { return field_1.FIELD_TYPES; } });
|
|
7
7
|
Object.defineProperty(exports, "FieldSchema", { enumerable: true, get: function () { return field_1.FieldSchema; } });
|
|
8
8
|
Object.defineProperty(exports, "FieldsSchema", { enumerable: true, get: function () { return field_1.FieldsSchema; } });
|
|
9
9
|
Object.defineProperty(exports, "LineFieldSchema", { enumerable: true, get: function () { return field_1.LineFieldSchema; } });
|
|
@@ -11,40 +11,15 @@ Object.defineProperty(exports, "LineKindsSchema", { enumerable: true, get: funct
|
|
|
11
11
|
Object.defineProperty(exports, "OptionSchema", { enumerable: true, get: function () { return field_1.OptionSchema; } });
|
|
12
12
|
Object.defineProperty(exports, "PropertyDefinitionSchema", { enumerable: true, get: function () { return field_1.PropertyDefinitionSchema; } });
|
|
13
13
|
Object.defineProperty(exports, "FilterConditionSchema", { enumerable: true, get: function () { return field_1.FilterConditionSchema; } });
|
|
14
|
+
Object.defineProperty(exports, "FilterItemSchema", { enumerable: true, get: function () { return field_1.FilterItemSchema; } });
|
|
14
15
|
var layout_1 = require("./lib/format/layout");
|
|
15
16
|
Object.defineProperty(exports, "ModifierSchema", { enumerable: true, get: function () { return layout_1.ModifierSchema; } });
|
|
16
17
|
Object.defineProperty(exports, "LayoutNodeSchema", { enumerable: true, get: function () { return layout_1.LayoutNodeSchema; } });
|
|
17
18
|
Object.defineProperty(exports, "RootLayoutSchema", { enumerable: true, get: function () { return layout_1.RootLayoutSchema; } });
|
|
18
|
-
Object.defineProperty(exports, "wideColumns", { enumerable: true, get: function () { return layout_1.wideColumns; } });
|
|
19
19
|
var page_1 = require("./lib/format/page");
|
|
20
|
-
Object.defineProperty(exports, "FORMAT_VERSION", { enumerable: true, get: function () { return page_1.FORMAT_VERSION; } });
|
|
21
20
|
Object.defineProperty(exports, "PageSchema", { enumerable: true, get: function () { return page_1.PageSchema; } });
|
|
22
21
|
var validate_1 = require("./lib/format/validate");
|
|
23
22
|
Object.defineProperty(exports, "validatePage", { enumerable: true, get: function () { return validate_1.validatePage; } });
|
|
24
23
|
var json_schema_1 = require("./lib/format/json-schema");
|
|
25
24
|
Object.defineProperty(exports, "pageJsonSchema", { enumerable: true, get: function () { return json_schema_1.pageJsonSchema; } });
|
|
26
|
-
var modifier_1 = require("./lib/expression/modifier");
|
|
27
|
-
Object.defineProperty(exports, "compileModifier", { enumerable: true, get: function () { return modifier_1.compileModifier; } });
|
|
28
|
-
var evaluateModifier_1 = require("./lib/expression/evaluateModifier");
|
|
29
|
-
Object.defineProperty(exports, "evaluateModifier", { enumerable: true, get: function () { return evaluateModifier_1.evaluateModifier; } });
|
|
30
|
-
Object.defineProperty(exports, "isModifierValid", { enumerable: true, get: function () { return evaluateModifier_1.isModifierValid; } });
|
|
31
|
-
var values_1 = require("./lib/record/values");
|
|
32
|
-
Object.defineProperty(exports, "emptyValue", { enumerable: true, get: function () { return values_1.emptyValue; } });
|
|
33
|
-
Object.defineProperty(exports, "initialValues", { enumerable: true, get: function () { return values_1.initialValues; } });
|
|
34
|
-
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return values_1.isEmpty; } });
|
|
35
|
-
Object.defineProperty(exports, "expressionContext", { enumerable: true, get: function () { return values_1.expressionContext; } });
|
|
36
|
-
Object.defineProperty(exports, "lineKind", { enumerable: true, get: function () { return values_1.lineKind; } });
|
|
37
|
-
var check_1 = require("./lib/record/check");
|
|
38
|
-
Object.defineProperty(exports, "checkValue", { enumerable: true, get: function () { return check_1.checkValue; } });
|
|
39
|
-
Object.defineProperty(exports, "formatBytes", { enumerable: true, get: function () { return check_1.formatBytes; } });
|
|
40
|
-
var memory_data_source_1 = require("./lib/record/memory-data-source");
|
|
41
|
-
Object.defineProperty(exports, "createMemoryDataSource", { enumerable: true, get: function () { return memory_data_source_1.createMemoryDataSource; } });
|
|
42
|
-
var scheduler_1 = require("./lib/record/scheduler");
|
|
43
|
-
Object.defineProperty(exports, "hostScheduler", { enumerable: true, get: function () { return scheduler_1.hostScheduler; } });
|
|
44
|
-
Object.defineProperty(exports, "wait", { enumerable: true, get: function () { return scheduler_1.wait; } });
|
|
45
|
-
var form_1 = require("./lib/record/form");
|
|
46
|
-
Object.defineProperty(exports, "createForm", { enumerable: true, get: function () { return form_1.createForm; } });
|
|
47
|
-
var messages_1 = require("./lib/record/messages");
|
|
48
|
-
Object.defineProperty(exports, "MESSAGES", { enumerable: true, get: function () { return messages_1.MESSAGES; } });
|
|
49
|
-
Object.defineProperty(exports, "fill", { enumerable: true, get: function () { return messages_1.fill; } });
|
|
50
25
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/core/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/core/src/index.ts"],"names":[],"mappings":";;;;AAAA,oDAA0B;AAC1B,4CAS4B;AAR1B,oGAAA,WAAW,OAAA;AACX,qGAAA,YAAY,OAAA;AACZ,wGAAA,eAAe,OAAA;AACf,wGAAA,eAAe,OAAA;AACf,qGAAA,YAAY,OAAA;AACZ,iHAAA,wBAAwB,OAAA;AACxB,8GAAA,qBAAqB,OAAA;AACrB,yGAAA,gBAAgB,OAAA;AAElB,8CAAyF;AAAhF,wGAAA,cAAc,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAC3D,0CAA+C;AAAtC,kGAAA,UAAU,OAAA;AACnB,kDAAqD;AAA5C,wGAAA,YAAY,OAAA;AACrB,wDAA0D;AAAjD,6GAAA,cAAc,OAAA"}
|
package/src/index.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export * from './runtime.mjs';
|
|
2
|
+
export { FieldSchema, FieldsSchema, LineFieldSchema, LineKindsSchema, OptionSchema, PropertyDefinitionSchema, FilterConditionSchema, FilterItemSchema, } from './lib/format/field.mjs';
|
|
3
|
+
export { ModifierSchema, LayoutNodeSchema, RootLayoutSchema } from './lib/format/layout.mjs';
|
|
4
|
+
export { PageSchema } from './lib/format/page.mjs';
|
|
4
5
|
export { validatePage } from './lib/format/validate.mjs';
|
|
5
6
|
export { pageJsonSchema } from './lib/format/json-schema.mjs';
|
|
6
|
-
export { compileModifier } from './lib/expression/modifier.mjs';
|
|
7
|
-
export { evaluateModifier, isModifierValid } from './lib/expression/evaluateModifier.mjs';
|
|
8
|
-
export { emptyValue, initialValues, isEmpty, expressionContext, lineKind, } from './lib/record/values.mjs';
|
|
9
|
-
export { checkValue, formatBytes } from './lib/record/check.mjs';
|
|
10
|
-
export { createMemoryDataSource } from './lib/record/memory-data-source.mjs';
|
|
11
|
-
export { hostScheduler, wait } from './lib/record/scheduler.mjs';
|
|
12
|
-
export { createForm, } from './lib/record/form.mjs';
|
|
13
|
-
export { MESSAGES, fill } from './lib/record/messages.mjs';
|
|
14
7
|
//# sourceMappingURL=index.mjs.map
|
package/src/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../libs/core/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../libs/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PageValidation } from './references.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* The check a page gets as it is shown: its outline, then every name and
|
|
4
|
+
* condition in it, the same as `validatePage` finds them. It leaves out the
|
|
5
|
+
* key-by-key check of the format, and so the validation library, which an app
|
|
6
|
+
* showing forms need not carry; run `validatePage` where pages are made or
|
|
7
|
+
* tested. A page that passes is handed back as it is.
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkPage(input: unknown): PageValidation;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PageValidation } from './references';
|
|
2
|
+
/**
|
|
3
|
+
* The check a page gets as it is shown: its outline, then every name and
|
|
4
|
+
* condition in it, the same as `validatePage` finds them. It leaves out the
|
|
5
|
+
* key-by-key check of the format, and so the validation library, which an app
|
|
6
|
+
* showing forms need not carry; run `validatePage` where pages are made or
|
|
7
|
+
* tested. A page that passes is handed back as it is.
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkPage(input: unknown): PageValidation;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkPage = checkPage;
|
|
4
|
+
const names_1 = require("./names");
|
|
5
|
+
const references_1 = require("./references");
|
|
6
|
+
const version_1 = require("./version");
|
|
7
|
+
const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
8
|
+
const LAYOUTS = ['sheet', 'sections', 'tabs', 'wizard'];
|
|
9
|
+
/**
|
|
10
|
+
* The check a page gets as it is shown: its outline, then every name and
|
|
11
|
+
* condition in it, the same as `validatePage` finds them. It leaves out the
|
|
12
|
+
* key-by-key check of the format, and so the validation library, which an app
|
|
13
|
+
* showing forms need not carry; run `validatePage` where pages are made or
|
|
14
|
+
* tested. A page that passes is handed back as it is.
|
|
15
|
+
*/
|
|
16
|
+
function checkPage(input) {
|
|
17
|
+
if (!isObject(input))
|
|
18
|
+
return { ok: false, issues: [{ path: '(page)', message: 'a page is a JSON object' }] };
|
|
19
|
+
const issues = [];
|
|
20
|
+
const say = (path, message) => issues.push({ path, message });
|
|
21
|
+
if (input['fieldia'] !== version_1.FORMAT_VERSION)
|
|
22
|
+
say('fieldia', `this build reads format ${version_1.FORMAT_VERSION}`);
|
|
23
|
+
if (typeof input['id'] !== 'string' || !input['id'])
|
|
24
|
+
say('id', 'a page needs an id');
|
|
25
|
+
const data = input['data'];
|
|
26
|
+
if (!isObject(data) || !(data['kind'] === 'responses' || (data['kind'] === 'record' && typeof data['model'] === 'string' && data['model']))) {
|
|
27
|
+
say('data', 'data is { "kind": "record", "model": … } or { "kind": "responses" }');
|
|
28
|
+
}
|
|
29
|
+
const fields = input['fields'];
|
|
30
|
+
if (!isObject(fields))
|
|
31
|
+
say('fields', 'fields is an object of field definitions, by name');
|
|
32
|
+
else {
|
|
33
|
+
for (const [name, def] of Object.entries(fields)) {
|
|
34
|
+
if (!isObject(def) || !names_1.FIELD_TYPES.includes(def['type']) || typeof def['label'] !== 'string') {
|
|
35
|
+
say(`fields.${name}`, 'a field needs a type Fieldia knows and a label');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const layout = input['layout'];
|
|
40
|
+
if (!isObject(layout) || !LAYOUTS.includes(layout['type']) || !Array.isArray(layout['children'])) {
|
|
41
|
+
say('layout', 'the layout is a sheet, sections, tabs or wizard, with children');
|
|
42
|
+
}
|
|
43
|
+
if (issues.length)
|
|
44
|
+
return { ok: false, issues };
|
|
45
|
+
const page = input;
|
|
46
|
+
try {
|
|
47
|
+
const found = new references_1.ReferenceCheck(page).run();
|
|
48
|
+
return found.length ? { ok: false, issues: found } : { ok: true, page };
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return { ok: false, issues: [{ path: '(page)', message: `a part of this page cannot be read: ${error.message}` }] };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=check-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-page.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/check-page.ts"],"names":[],"mappings":";;AAeA,8BA+BC;AA9CD,mCAAsC;AAEtC,6CAAmF;AACnF,uCAA2C;AAE3C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5I,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAExD;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,KAAc;IACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,EAAE,CAAC;IAC7G,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9E,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,wBAAc;QAAE,GAAG,CAAC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MAAM,CAAC,MAAM,CAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAC3G,GAAG,CAAC,QAAQ,EAAE,gEAAgE,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChD,MAAM,IAAI,GAAG,KAAwB,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,2BAAc,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uCAAwC,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;IACjI,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FIELD_TYPES } from './names.mjs';
|
|
2
|
+
import { ReferenceCheck } from './references.mjs';
|
|
3
|
+
import { FORMAT_VERSION } from './version.mjs';
|
|
4
|
+
const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
5
|
+
const LAYOUTS = ['sheet', 'sections', 'tabs', 'wizard'];
|
|
6
|
+
/**
|
|
7
|
+
* The check a page gets as it is shown: its outline, then every name and
|
|
8
|
+
* condition in it, the same as `validatePage` finds them. It leaves out the
|
|
9
|
+
* key-by-key check of the format, and so the validation library, which an app
|
|
10
|
+
* showing forms need not carry; run `validatePage` where pages are made or
|
|
11
|
+
* tested. A page that passes is handed back as it is.
|
|
12
|
+
*/
|
|
13
|
+
export function checkPage(input) {
|
|
14
|
+
if (!isObject(input))
|
|
15
|
+
return { ok: false, issues: [{ path: '(page)', message: 'a page is a JSON object' }] };
|
|
16
|
+
const issues = [];
|
|
17
|
+
const say = (path, message) => issues.push({ path, message });
|
|
18
|
+
if (input['fieldia'] !== FORMAT_VERSION)
|
|
19
|
+
say('fieldia', `this build reads format ${FORMAT_VERSION}`);
|
|
20
|
+
if (typeof input['id'] !== 'string' || !input['id'])
|
|
21
|
+
say('id', 'a page needs an id');
|
|
22
|
+
const data = input['data'];
|
|
23
|
+
if (!isObject(data) || !(data['kind'] === 'responses' || (data['kind'] === 'record' && typeof data['model'] === 'string' && data['model']))) {
|
|
24
|
+
say('data', 'data is { "kind": "record", "model": … } or { "kind": "responses" }');
|
|
25
|
+
}
|
|
26
|
+
const fields = input['fields'];
|
|
27
|
+
if (!isObject(fields))
|
|
28
|
+
say('fields', 'fields is an object of field definitions, by name');
|
|
29
|
+
else {
|
|
30
|
+
for (const [name, def] of Object.entries(fields)) {
|
|
31
|
+
if (!isObject(def) || !FIELD_TYPES.includes(def['type']) || typeof def['label'] !== 'string') {
|
|
32
|
+
say(`fields.${name}`, 'a field needs a type Fieldia knows and a label');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const layout = input['layout'];
|
|
37
|
+
if (!isObject(layout) || !LAYOUTS.includes(layout['type']) || !Array.isArray(layout['children'])) {
|
|
38
|
+
say('layout', 'the layout is a sheet, sections, tabs or wizard, with children');
|
|
39
|
+
}
|
|
40
|
+
if (issues.length)
|
|
41
|
+
return { ok: false, issues };
|
|
42
|
+
const page = input;
|
|
43
|
+
try {
|
|
44
|
+
const found = new ReferenceCheck(page).run();
|
|
45
|
+
return found.length ? { ok: false, issues: found } : { ok: true, page };
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return { ok: false, issues: [{ path: '(page)', message: `a part of this page cannot be read: ${error.message}` }] };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=check-page.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-page.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/check-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAuC,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5I,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,EAAE,CAAC;IAC7G,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9E,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,cAAc;QAAE,GAAG,CAAC,SAAS,EAAE,2BAA2B,cAAc,EAAE,CAAC,CAAC;IACrG,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,GAAG,CAAC,IAAI,EAAE,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AC;IACD,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChD,MAAM,IAAI,GAAG,KAAwB,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uCAAwC,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;IACjI,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wideColumns = wideColumns;
|
|
4
|
+
/** A section's columns at full width, whichever way they are written. */
|
|
5
|
+
function wideColumns(columns) {
|
|
6
|
+
return typeof columns === 'object' ? columns.wide : columns ?? 1;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=columns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/columns.ts"],"names":[],"mappings":";;AAGA,kCAEC;AAHD,yEAAyE;AACzE,SAAgB,WAAW,CAAC,OAAiD;IAC3E,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columns.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/columns.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,UAAU,WAAW,CAAC,OAAiD;IAC3E,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC;AACnE,CAAC"}
|