@fibery/schema 10.2.18 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,186 @@
1
+ import { parseType, toTitle } from "./utils.js";
2
+ import { once } from "@fibery/helpers/src/_";
3
+ import isFunction from "lodash/isFunction.js";
4
+ import isPlainObject from "lodash/isPlainObject.js";
5
+ import { pluralize } from "@fibery/pluralize";
6
+ //#region src/type-object.ts
7
+ var TypeObject = class {
8
+ name;
9
+ description;
10
+ id;
11
+ rawMeta;
12
+ isDomain;
13
+ isPlatform;
14
+ isHighlight;
15
+ isMixin;
16
+ mixinIcon;
17
+ isEnum;
18
+ isPrimitive;
19
+ isWriterModeByDefault;
20
+ nameParts;
21
+ color;
22
+ units;
23
+ installedMixins;
24
+ syncSource;
25
+ version;
26
+ installedMixinTypeObjects;
27
+ title;
28
+ pluralTitle;
29
+ singularTitle;
30
+ fieldObjects;
31
+ fieldObjectsById;
32
+ fieldObjectsByName;
33
+ typeComponentFieldObject;
34
+ isDeleted;
35
+ isEntityRef;
36
+ constructor({ rawTypeObject, resolveTypeObject, getTypeComponentTypeToFieldObject, version, factory, resolveMultiRelatedFieldObjects }) {
37
+ if (!isPlainObject(rawTypeObject)) throw new Error("rawTypeObject arg must be plain object");
38
+ if (!isFunction(resolveTypeObject)) throw new Error("resolveTypeObject arg must be function");
39
+ this.name = rawTypeObject["fibery/name"];
40
+ this.description = rawTypeObject["fibery/description"] || null;
41
+ this.id = rawTypeObject["fibery/id"];
42
+ const rawMeta = rawTypeObject["fibery/meta"] || {};
43
+ this.rawMeta = rawMeta;
44
+ this.isDomain = rawMeta["fibery/domain?"] || false;
45
+ this.isPlatform = rawMeta["fibery/platform?"] || false;
46
+ this.isHighlight = rawMeta["fibery/highlight?"] || false;
47
+ this.isMixin = rawMeta["app/mixin?"] || false;
48
+ this.mixinIcon = rawMeta["ui/mixin-icon"] || null;
49
+ this.isEnum = rawMeta["fibery/enum?"] || false;
50
+ this.isPrimitive = rawMeta["fibery/primitive?"] || false;
51
+ this.isWriterModeByDefault = rawMeta["ui/writer-mode?"] || false;
52
+ this.isDeleted = rawTypeObject["fibery/deleted?"] || false;
53
+ this.nameParts = parseType(this.name);
54
+ this.color = rawMeta["ui/color"] || "#4978D4";
55
+ this.units = rawMeta["ui/units"] || null;
56
+ this.installedMixins = new Set(Object.keys(rawMeta["app/mixins"] || {}));
57
+ this.syncSource = rawMeta["sync/source"] || null;
58
+ this.version = version;
59
+ this.isEntityRef = rawTypeObject["fibery/name"] === "fibery/entity-ref";
60
+ const fieldObjectsByNameOnceGetter = once(() => {
61
+ return factory.makeFieldObjectsByName({
62
+ type: this.name,
63
+ fieldObjects: this.fieldObjects
64
+ });
65
+ });
66
+ const fieldObjectsGetter = once(() => rawTypeObject["fibery/fields"].map((rawFieldObject) => {
67
+ return factory.makeFieldObject({
68
+ rawFieldObject,
69
+ holderType: this.name,
70
+ resolveTypeObject,
71
+ version,
72
+ resolveMultiRelatedFieldObjects
73
+ });
74
+ }));
75
+ Object.defineProperties(this, {
76
+ toJSON: {
77
+ value() {
78
+ if (process.env.NODE_ENV === "test") return `<schema.typeObjectsByName["${rawTypeObject["fibery/name"]}"]>`;
79
+ return rawTypeObject;
80
+ },
81
+ enumerable: false
82
+ },
83
+ fieldObjects: {
84
+ configurable: false,
85
+ enumerable: true,
86
+ get: fieldObjectsGetter
87
+ },
88
+ typeComponentFieldObject: {
89
+ configurable: false,
90
+ enumerable: true,
91
+ get: () => {
92
+ return getTypeComponentTypeToFieldObject(this.name);
93
+ }
94
+ },
95
+ fieldObjectsById: {
96
+ configurable: false,
97
+ enumerable: true,
98
+ get: once(() => {
99
+ return factory.makeFieldObjectsById({
100
+ type: this.name,
101
+ fieldObjects: this.fieldObjects
102
+ });
103
+ })
104
+ },
105
+ fieldObjectsByName: {
106
+ configurable: false,
107
+ enumerable: true,
108
+ get: fieldObjectsByNameOnceGetter
109
+ },
110
+ installedMixinTypeObjects: {
111
+ configurable: false,
112
+ enumerable: true,
113
+ get: once(() => [...this.installedMixins].map(resolveTypeObject).filter((typeObject) => typeObject))
114
+ },
115
+ title: {
116
+ configurable: false,
117
+ enumerable: true,
118
+ get: once(() => toTitle(this.name))
119
+ },
120
+ pluralTitle: {
121
+ configurable: false,
122
+ enumerable: true,
123
+ get: once(() => pluralize.plural(toTitle(this.name)))
124
+ },
125
+ singularTitle: {
126
+ configurable: false,
127
+ enumerable: true,
128
+ get: once(() => pluralize.singular(toTitle(this.name)))
129
+ }
130
+ });
131
+ }
132
+ _getFieldObjectShortcuts = once(() => {
133
+ const hasRank = this.installedMixins.has("fibery/rank-mixin");
134
+ return this.fieldObjects.reduce((result, fieldObject) => {
135
+ if (fieldObject.isId) {
136
+ result.idField = fieldObject.name;
137
+ result.idFieldObject = fieldObject;
138
+ } else if (fieldObject.isPublicId) {
139
+ result.publicIdField = fieldObject.name;
140
+ result.publicIdFieldObject = fieldObject;
141
+ } else if (fieldObject.isTitle) {
142
+ result.titleField = fieldObject.name;
143
+ result.titleFieldObject = fieldObject;
144
+ } else if (hasRank && fieldObject.name === "fibery/rank") {
145
+ result.rankField = fieldObject.name;
146
+ result.rankFieldObject = fieldObject;
147
+ }
148
+ return result;
149
+ }, {
150
+ idField: null,
151
+ idFieldObject: null,
152
+ publicIdField: null,
153
+ publicIdFieldObject: null,
154
+ titleField: null,
155
+ titleFieldObject: null,
156
+ rankField: null,
157
+ rankFieldObject: null
158
+ });
159
+ });
160
+ get idField() {
161
+ return this._getFieldObjectShortcuts().idField;
162
+ }
163
+ get idFieldObject() {
164
+ return this._getFieldObjectShortcuts().idFieldObject;
165
+ }
166
+ get publicIdField() {
167
+ return this._getFieldObjectShortcuts().publicIdField;
168
+ }
169
+ get publicIdFieldObject() {
170
+ return this._getFieldObjectShortcuts().publicIdFieldObject;
171
+ }
172
+ get titleField() {
173
+ return this._getFieldObjectShortcuts().titleField;
174
+ }
175
+ get titleFieldObject() {
176
+ return this._getFieldObjectShortcuts().titleFieldObject;
177
+ }
178
+ get rankField() {
179
+ return this._getFieldObjectShortcuts().rankField;
180
+ }
181
+ get rankFieldObject() {
182
+ return this._getFieldObjectShortcuts().rankFieldObject;
183
+ }
184
+ };
185
+ //#endregion
186
+ export { TypeObject };
package/lib/utils.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ import { SyncSource, TypeObject } from "./type-object.js";
2
+ import { RawFieldObject } from "./field-object.js";
3
+ import { RawSchema } from "./schema.js";
4
+ //#region src/utils.d.ts
5
+ declare const withOnlyDefinedGets: (target: any, targetKind?: string) => any;
6
+ declare const capitalizeFirstChar: (input: string) => string;
7
+ declare const toTypeOrFieldNamePartTitle: (str: string | null | undefined) => string;
8
+ declare const toTypeOrFieldTitle: (str: string | null | undefined) => string;
9
+ declare const toPascalCase: (lispCasedString?: string) => string;
10
+ declare const toNonEnumTitle: (strName: string) => string;
11
+ declare const parseEnumType: (type: string) => {
12
+ templateName: string;
13
+ templateNamespace: string;
14
+ targetName: string;
15
+ targetNamespace: string;
16
+ };
17
+ declare const toTitle: (typeOrAttr: string) => string;
18
+ declare const parseType: ((arg: string) => {
19
+ namespace: string;
20
+ name: string;
21
+ }) & import("@fibery/helpers/src/_").MemoizedFunction<string, {
22
+ namespace: string;
23
+ name: string;
24
+ }>;
25
+ declare const makeEnumTypeNamePart: ({ holderType, enumName }: {
26
+ holderType: string;
27
+ enumName: string;
28
+ }) => string;
29
+ declare const attachEnumNamespace: ({ enumNamespace, typeNamePart }: {
30
+ enumNamespace: string;
31
+ typeNamePart: string;
32
+ }) => string;
33
+ declare const removeDeletedTypesAndFields: (rawSchema: RawSchema) => {
34
+ "fibery/id": string;
35
+ "fibery/version": string;
36
+ "fibery/types": {
37
+ "fibery/fields": RawFieldObject[];
38
+ "fibery/id": string;
39
+ "fibery/name": string;
40
+ "fibery/description"?: string | null;
41
+ "fibery/deleted?"?: boolean;
42
+ "fibery/meta": {
43
+ "fibery/domain?"?: boolean;
44
+ "fibery/platform?"?: boolean;
45
+ "fibery/highlight?"?: boolean;
46
+ "app/mixin?"?: boolean;
47
+ "ui/mixin-icon"?: string;
48
+ "fibery/enum?"?: boolean;
49
+ "fibery/primitive?"?: boolean;
50
+ "ui/writer-mode?"?: boolean;
51
+ "ui/color"?: string;
52
+ "ui/units"?: unknown[];
53
+ "app/mixins"?: Record<string, boolean>;
54
+ "sync/source"?: SyncSource;
55
+ "fibery/secured?"?: boolean;
56
+ };
57
+ }[];
58
+ };
59
+ declare const getTypeObjectTitle: (typeObject: TypeObject, form?: "singular" | "plural") => string;
60
+ //#endregion
61
+ export { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
package/lib/utils.js ADDED
@@ -0,0 +1,119 @@
1
+ import { NotDefinedGetError } from "./errors.js";
2
+ import { printJsPath } from "./print-utils.js";
3
+ import { memoize } from "@fibery/helpers/src/_";
4
+ import { traceError } from "@fibery/helpers/utils/trace";
5
+ import capitalize from "lodash/capitalize.js";
6
+ import flow from "lodash/flow.js";
7
+ import last from "lodash/last.js";
8
+ //#region src/utils.ts
9
+ const testRunnerKeys = /* @__PURE__ */ new Set([
10
+ "nodeType",
11
+ "tagName",
12
+ "hasAttribute"
13
+ ]);
14
+ const withOnlyDefinedGets = (target, targetKind = "object") => new Proxy(target, { get(target, key) {
15
+ if (!(key in target) && process.env.NODE_ENV !== "production") {
16
+ if (key === "__target__") return target;
17
+ if (key === "_reactFragment") return;
18
+ if (key === "_error") return;
19
+ if (key === "_warning") return;
20
+ if (key === "length") return;
21
+ if (key === "inspect") return;
22
+ if (key === "@@toStringTag") return;
23
+ if (key === "$$typeof") return;
24
+ if (process.env.NODE_ENV === "test") {
25
+ if (typeof key === "string" && testRunnerKeys.has(key)) return;
26
+ if (key === "@@__IMMUTABLE_ITERABLE__@@") return;
27
+ if (key === "@@__IMMUTABLE_RECORD__@@") return;
28
+ if (key === "_isMockFunction") return;
29
+ if (key === "asymmetricMatch") return;
30
+ if (key === "then") return;
31
+ if (key === "toJSON") return () => "<" + targetKind + ">";
32
+ }
33
+ if (typeof key === "symbol") return;
34
+ throw new NotDefinedGetError(`${targetKind}${printJsPath([key])} is undefined`);
35
+ }
36
+ return target[key];
37
+ } });
38
+ const getNamePart = (str) => splitKeyword(str).name;
39
+ const capitalizeFirstChar = (input) => {
40
+ const str = input || "";
41
+ return str ? str.charAt(0).toUpperCase() + str.slice(1) : str;
42
+ };
43
+ const replaceTildes = (str) => (str || "").split("~").join(" ");
44
+ const toTypeOrFieldNamePartTitle = flow([capitalizeFirstChar, replaceTildes]);
45
+ const toTypeOrFieldTitle = flow([getNamePart, toTypeOrFieldNamePartTitle]);
46
+ const toPascalCase = (lispCasedString = "") => lispCasedString && (last(lispCasedString.split("/")) || "").split("-").map(capitalize).join(" ");
47
+ const isObsoleteTitle = (str) => {
48
+ const { name } = splitKeyword(str);
49
+ return name.toLowerCase() === name && !hasTildes(name);
50
+ };
51
+ const hasTildes = (str) => str.includes("~");
52
+ const nameOverrides = {
53
+ "fibery/type": "fibery/Database",
54
+ "fibery/app": "fibery/Space"
55
+ };
56
+ const toNonEnumTitle = (strName) => {
57
+ const str = nameOverrides[strName] || strName;
58
+ return isObsoleteTitle(str) ? toPascalCase(str) : toTypeOrFieldTitle(str);
59
+ };
60
+ const parseEnumType = (type) => {
61
+ const [templateType, targetType] = type.split("_");
62
+ const { name: templateName, namespace: templateNamespace } = parseType(templateType);
63
+ const { name: targetName, namespace: targetNamespace } = parseType(targetType);
64
+ return {
65
+ templateName,
66
+ templateNamespace,
67
+ targetName,
68
+ targetNamespace
69
+ };
70
+ };
71
+ const toEnumTitle = (type) => {
72
+ const { templateName, targetName } = parseEnumType(type);
73
+ return toTitle(targetName) + " " + toTitle(templateName);
74
+ };
75
+ const toTitle = (typeOrAttr) => {
76
+ const str = typeOrAttr || "";
77
+ return str.includes("_") ? toEnumTitle(str) : toNonEnumTitle(str);
78
+ };
79
+ const splitKeyword = (keyword) => {
80
+ const str = keyword || "";
81
+ const index = str.indexOf("/");
82
+ if (index === -1) return {
83
+ namespace: "",
84
+ name: str
85
+ };
86
+ return {
87
+ namespace: str.substring(0, index),
88
+ name: str.substring(index + 1)
89
+ };
90
+ };
91
+ const parseType = memoize((type) => {
92
+ if (!type.includes("/")) traceError(`parseType invalid usage: passed type is '${type}'`);
93
+ return splitKeyword(type);
94
+ });
95
+ const makeEnumTypeNamePart = ({ holderType, enumName }) => {
96
+ const { namespace, name } = parseType(holderType);
97
+ return `${enumName}_${namespace}/${name}`;
98
+ };
99
+ const attachEnumNamespace = ({ enumNamespace, typeNamePart }) => {
100
+ return `${enumNamespace}/${typeNamePart}`;
101
+ };
102
+ const removeDeletedTypesAndFields = (rawSchema) => {
103
+ const { "fibery/types": rawTypeObjects, ...schemaRest } = rawSchema;
104
+ const filteredRawTypeObjects = rawTypeObjects.filter((rawTypeObject) => rawTypeObject["fibery/deleted?"] !== true).map((rawTypeObject) => {
105
+ const { "fibery/fields": rawFieldObjects, ...rawTypeObjectRest } = rawTypeObject;
106
+ const filteredRawFieldObjects = rawFieldObjects.filter((rawFieldObject) => rawFieldObject["fibery/deleted?"] !== true);
107
+ return {
108
+ ...rawTypeObjectRest,
109
+ "fibery/fields": filteredRawFieldObjects
110
+ };
111
+ });
112
+ return {
113
+ ...schemaRest,
114
+ "fibery/types": filteredRawTypeObjects
115
+ };
116
+ };
117
+ const getTypeObjectTitle = (typeObject, form) => form ? form === "singular" ? typeObject.singularTitle : typeObject.pluralTitle : typeObject.title;
118
+ //#endregion
119
+ export { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
package/package.json CHANGED
@@ -1,43 +1,28 @@
1
1
  {
2
2
  "name": "@fibery/schema",
3
- "version": "10.2.18",
4
- "private": false,
3
+ "version": "10.3.1",
5
4
  "description": "Fibery schema utils",
5
+ "license": "UNLICENSED",
6
6
  "files": [
7
- "./lib"
7
+ "lib"
8
8
  ],
9
+ "type": "module",
10
+ "sideEffects": false,
9
11
  "main": "./lib/index.js",
12
+ "types": "./lib/index.d.ts",
10
13
  "exports": {
11
14
  ".": {
12
- "@fibery/source": "./index.ts",
13
15
  "types": "./lib/index.d.ts",
14
16
  "default": "./lib/index.js"
17
+ },
18
+ "./src/*": {
19
+ "types": "./lib/*.d.ts",
20
+ "default": "./lib/*.js"
15
21
  }
16
22
  },
17
23
  "dependencies": {
18
24
  "lodash": "4.17.21",
19
- "memoize-one": "6.0.0",
20
- "@fibery/helpers": "3.1.0",
21
- "@fibery/pluralize": "1.1.2"
22
- },
23
- "devDependencies": {
24
- "@babel/core": "7.28.5",
25
- "@types/lodash": "4.14.172",
26
- "@typescript/native-preview": "beta",
27
- "babel-loader": "10.0.0",
28
- "typescript": "6.0.1-rc",
29
- "webpack": "5.87.0",
30
- "webpack-cli": "6.0.1",
31
- "@fibery/babel-preset": "7.4.2"
32
- },
33
- "scripts": {
34
- "build": "rm -rf lib && tsc --project tsconfig.build.json",
35
- "test": "../../scripts/test.sh",
36
- "test:ci": "../../scripts/test.sh --ci",
37
- "test:coverage": "../../scripts/test.sh --ci --coverage",
38
- "check": "../../scripts/check.sh",
39
- "lint": "pnpm -w lint .",
40
- "typecheck": "../../scripts/typecheck.sh"
41
- },
42
- "types": "./lib/index.d.ts"
25
+ "@fibery/helpers": "3.2.1",
26
+ "@fibery/pluralize": "1.2.1"
27
+ }
43
28
  }
@@ -1,2 +0,0 @@
1
- export declare class NotDefinedGetError extends Error {
2
- }
package/lib/src/errors.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotDefinedGetError = void 0;
4
- class NotDefinedGetError extends Error {
5
- }
6
- exports.NotDefinedGetError = NotDefinedGetError;
@@ -1,22 +0,0 @@
1
- import { FieldObject, type FieldObjectParams } from "./field-object";
2
- import { Schema } from "./schema";
3
- import { TypeObject, type TypeObjectParams } from "./type-object";
4
- export type Factory = {
5
- makeSchema: (rawSchema: Record<string, unknown>, options?: {
6
- shouldRemoveDeletedTypesAndFields: boolean;
7
- }) => Schema;
8
- makeTypeObject: (params: Omit<TypeObjectParams, "factory">) => TypeObject;
9
- makeTypeObjectsById: (typeObjects: TypeObject[]) => Record<string, TypeObject>;
10
- makeTypeObjectsByName: (typeObjects: TypeObject[]) => Record<string, TypeObject>;
11
- makeFieldObject: (params: FieldObjectParams) => FieldObject;
12
- makeFieldObjectsById: (params: {
13
- type: string;
14
- fieldObjects: FieldObject[];
15
- }) => Record<string, FieldObject>;
16
- makeFieldObjectsByName: (params: {
17
- type: string;
18
- fieldObjects: FieldObject[];
19
- }) => Record<string, FieldObject>;
20
- };
21
- export declare const factory: Factory;
22
- export declare const protectiveFactory: Factory;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.protectiveFactory = exports.factory = void 0;
7
- const keyBy_1 = __importDefault(require("lodash/keyBy"));
8
- const field_object_1 = require("./field-object");
9
- const schema_1 = require("./schema");
10
- const type_object_1 = require("./type-object");
11
- const utils_1 = require("./utils");
12
- exports.factory = {
13
- makeSchema: (rawSchema, options = { shouldRemoveDeletedTypesAndFields: true }) => new schema_1.Schema({
14
- rawSchema: options.shouldRemoveDeletedTypesAndFields
15
- ? (0, utils_1.removeDeletedTypesAndFields)(rawSchema)
16
- : rawSchema,
17
- factory: exports.factory,
18
- }),
19
- makeTypeObject: (args) => new type_object_1.TypeObject({ ...args, factory: exports.factory }),
20
- makeTypeObjectsById: (typeObjects) => (0, keyBy_1.default)(typeObjects, (x) => x.id),
21
- makeTypeObjectsByName: (typeObjects) => (0, keyBy_1.default)(typeObjects, (x) => x.name),
22
- makeFieldObject: (args) => new field_object_1.FieldObject(args),
23
- makeFieldObjectsById: ({ fieldObjects }) => (0, keyBy_1.default)(fieldObjects, (x) => x.id),
24
- makeFieldObjectsByName: ({ fieldObjects }) => (0, keyBy_1.default)(fieldObjects, (x) => x.name),
25
- };
26
- exports.protectiveFactory = {
27
- makeSchema: (rawSchema, options = { shouldRemoveDeletedTypesAndFields: true }) => (0, utils_1.withOnlyDefinedGets)(new schema_1.Schema({
28
- rawSchema: options.shouldRemoveDeletedTypesAndFields
29
- ? (0, utils_1.removeDeletedTypesAndFields)(rawSchema)
30
- : rawSchema,
31
- factory: exports.protectiveFactory,
32
- }), `schema`),
33
- makeTypeObject: (args) => {
34
- const typeObject = new type_object_1.TypeObject({ ...args, factory: exports.protectiveFactory });
35
- return (0, utils_1.withOnlyDefinedGets)(typeObject, `schema.typeObjectsByName["${typeObject.name}"]`);
36
- },
37
- makeTypeObjectsById: (typeObjects) => (0, utils_1.withOnlyDefinedGets)((0, keyBy_1.default)(typeObjects, (x) => x.id), "schema.typeObjectsById"),
38
- makeTypeObjectsByName: (typeObjects) => (0, utils_1.withOnlyDefinedGets)((0, keyBy_1.default)(typeObjects, (x) => x.name), "schema.typeObjectsByName"),
39
- makeFieldObject: (args) => {
40
- const fieldObject = new field_object_1.FieldObject(args);
41
- return (0, utils_1.withOnlyDefinedGets)(fieldObject, `schema.typeObjectsByName["${fieldObject.holderType}"].fieldObjectsByName["${fieldObject.name}"]`);
42
- },
43
- makeFieldObjectsById: ({ type, fieldObjects }) => (0, utils_1.withOnlyDefinedGets)((0, keyBy_1.default)(fieldObjects, (x) => x.id), `schema.typeObjectsByName["${type}"].fieldObjectsById`),
44
- makeFieldObjectsByName: ({ type, fieldObjects }) => (0, utils_1.withOnlyDefinedGets)((0, keyBy_1.default)(fieldObjects, (x) => x.name), `schema.typeObjectsByName["${type}"].fieldObjectsByName`),
45
- };
@@ -1,4 +0,0 @@
1
- export type IdField = "fibery/id";
2
- export type PublicIdField = "fibery/public-id";
3
- export type RankField = "fibery/rank";
4
- export type TitleField = "__NOTHING_INTERESTING__TitleField__";
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,89 +0,0 @@
1
- import type { TypeObject } from "./type-object";
2
- export type Cardinality = ":cardinality/one-to-one" | ":cardinality/one-to-many" | ":cardinality/many-to-many" | ":cardinality/many-to-one";
3
- export type RawFieldObject = {
4
- "fibery/id": string;
5
- "fibery/name": string;
6
- "fibery/type": string;
7
- "fibery/description"?: string;
8
- "fibery/deleted?"?: boolean;
9
- "fibery/meta": {
10
- "fibery/collection?"?: boolean;
11
- "ui/title?"?: boolean;
12
- "fibery/id?"?: boolean;
13
- "fibery/public-id?"?: boolean;
14
- "fibery/readonly?"?: boolean;
15
- "formula/formula?"?: boolean;
16
- "formula/disabled?"?: boolean;
17
- "formula/disable-reason"?: string;
18
- "formula/formula"?: unknown;
19
- "formula/lookup?"?: boolean;
20
- "link-rule/link-rule?"?: boolean;
21
- "link-rule/link-rule"?: unknown;
22
- "link-rule/disabled?"?: boolean;
23
- "link-rule/disable-reason"?: string;
24
- "fibery/relation"?: string;
25
- "fibery/default-value"?: unknown;
26
- "ui/object-editor-order"?: number;
27
- "fibery/required?"?: boolean;
28
- "ui/hidden?"?: boolean;
29
- "ui/disable-link-existing-items"?: boolean;
30
- "fibery/multi-relation"?: string;
31
- "fibery/dependency?"?: boolean;
32
- "fibery/dependency-start?"?: boolean;
33
- };
34
- };
35
- export type FieldObjectParams = {
36
- rawFieldObject: RawFieldObject;
37
- holderType: string;
38
- resolveTypeObject: (type: string) => TypeObject;
39
- version: string;
40
- resolveMultiRelatedFieldObjects: (multiRelation: string) => FieldObject[];
41
- };
42
- export declare class FieldObject {
43
- name: string;
44
- description: string | null;
45
- id: string;
46
- type: string;
47
- rawMeta: Record<string, unknown>;
48
- holderType: string;
49
- isCollection: boolean;
50
- isTitle: boolean;
51
- isId: boolean;
52
- isPublicId: boolean;
53
- isReadOnly: boolean;
54
- isFormula: boolean;
55
- isFormulaDisabled: boolean;
56
- formulaDisableReason: string | null;
57
- formula: unknown | null;
58
- isLookup: boolean;
59
- hasLinkRule: boolean;
60
- linkRule: unknown | null;
61
- isLinkRuleDisabled: boolean;
62
- linkRuleDisableReason: string | null;
63
- relation: string | null;
64
- multiRelation: string | null;
65
- defaultValue: unknown | null;
66
- objectEditorOrder: number;
67
- isRequired: boolean;
68
- isHidden: boolean;
69
- isDeleted: boolean;
70
- disableLinkExistingItems: boolean;
71
- version: string;
72
- typeObject: TypeObject;
73
- mixinTypeObject: TypeObject | undefined;
74
- holderTypeObject: TypeObject;
75
- nameParts: {
76
- namespace: string;
77
- name: string;
78
- };
79
- title: string;
80
- multiRelatedFieldObjects: Array<FieldObject>;
81
- isMultiField: boolean;
82
- isDependency: boolean;
83
- isDependencyStart: boolean;
84
- constructor({ rawFieldObject, holderType, resolveTypeObject, version, resolveMultiRelatedFieldObjects, }: FieldObjectParams);
85
- get relatedFieldObject(): FieldObject | null;
86
- get cardinality(): Cardinality;
87
- /** @deprecated use !typeObject.isPrimitive && cardinality === ... instead */
88
- get kind(): ":field/basic" | ":field/reference-collection" | ":field/reference";
89
- }