@fibery/schema 11.1.0 → 11.3.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/lib/brands.d.ts +13 -0
- package/lib/brands.js +0 -0
- package/lib/field-object.d.ts +10 -7
- package/lib/field-object.js +14 -11
- package/lib/index.d.ts +3 -2
- package/lib/index.js +2 -2
- package/lib/relaxable.d.ts +2 -1
- package/lib/relaxable.js +1 -1
- package/lib/schema.d.ts +6 -5
- package/lib/schema.js +1 -1
- package/lib/type-object.d.ts +9 -8
- package/lib/utils.d.ts +5 -28
- package/lib/utils.js +39 -13
- package/package.json +2 -2
package/lib/brands.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HolderTODO, KindTODO } from "@fibery/helpers/utils/types";
|
|
2
|
+
//#region src/brands.d.ts
|
|
3
|
+
type Id = string & KindTODO<"id">;
|
|
4
|
+
type PublicId = string & KindTODO<"publicId">;
|
|
5
|
+
type Name = string & KindTODO<"name">;
|
|
6
|
+
type TypeId = Id & HolderTODO<"type">;
|
|
7
|
+
type FieldId = Id & HolderTODO<"field">;
|
|
8
|
+
type EntityId = Id & HolderTODO<"entity">;
|
|
9
|
+
type TypeName = Name & HolderTODO<"type">;
|
|
10
|
+
type FieldName = Name & HolderTODO<"field">;
|
|
11
|
+
type SpaceName = Name & HolderTODO<"space">;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { EntityId, FieldId, FieldName, Id, Name, PublicId, SpaceName, TypeId, TypeName };
|
package/lib/brands.js
ADDED
|
File without changes
|
package/lib/field-object.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FieldId, FieldName, TypeName } from "./brands.js";
|
|
1
2
|
import { TypeObject } from "./type-object.js";
|
|
2
3
|
import { SchemaRef } from "./schema.js";
|
|
3
4
|
//#region src/field-object.d.ts
|
|
@@ -21,12 +22,12 @@ type SyncRelation = {
|
|
|
21
22
|
type: string;
|
|
22
23
|
part: string;
|
|
23
24
|
targetName: string;
|
|
24
|
-
targetFieldId:
|
|
25
|
+
targetFieldId: FieldId;
|
|
25
26
|
};
|
|
26
27
|
type RawFieldObject = {
|
|
27
|
-
"fibery/id":
|
|
28
|
-
"fibery/name":
|
|
29
|
-
"fibery/type":
|
|
28
|
+
"fibery/id": FieldId;
|
|
29
|
+
"fibery/name": FieldName;
|
|
30
|
+
"fibery/type": TypeName;
|
|
30
31
|
"fibery/description"?: string;
|
|
31
32
|
"fibery/deleted?"?: boolean;
|
|
32
33
|
"fibery/meta": {
|
|
@@ -88,10 +89,10 @@ declare class FieldObject {
|
|
|
88
89
|
constructor({ rawFieldObject, holderType, schema }: FieldObjectParams);
|
|
89
90
|
toJSON(): string | RawFieldObject;
|
|
90
91
|
get rawMeta(): Readonly<RawFieldObject["fibery/meta"]>;
|
|
91
|
-
get name():
|
|
92
|
+
get name(): FieldName;
|
|
92
93
|
get description(): string | null;
|
|
93
|
-
get id():
|
|
94
|
-
get type():
|
|
94
|
+
get id(): FieldId;
|
|
95
|
+
get type(): TypeName;
|
|
95
96
|
get version(): string;
|
|
96
97
|
get isDeleted(): boolean;
|
|
97
98
|
get isCollection(): boolean;
|
|
@@ -122,6 +123,8 @@ declare class FieldObject {
|
|
|
122
123
|
name: string;
|
|
123
124
|
}>;
|
|
124
125
|
get title(): string;
|
|
126
|
+
/** the target type object, or null when the relation points at a removed Database */
|
|
127
|
+
resolveTypeObject(): TypeObject | null;
|
|
125
128
|
get typeObject(): TypeObject;
|
|
126
129
|
get holderTypeObject(): TypeObject;
|
|
127
130
|
get mixinTypeObject(): TypeObject | null;
|
package/lib/field-object.js
CHANGED
|
@@ -132,19 +132,22 @@ var FieldObject = class {
|
|
|
132
132
|
}
|
|
133
133
|
return value;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
/** the target type object, or null when the relation points at a removed Database */
|
|
136
|
+
resolveTypeObject() {
|
|
136
137
|
const cache = this.cache ??= {};
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
const value = cache.typeObject;
|
|
139
|
+
if (value) return value;
|
|
140
|
+
const typeObject = this.schema.resolveTypeObject(this.type);
|
|
141
|
+
if (typeObject) cache.typeObject = typeObject;
|
|
142
|
+
return typeObject;
|
|
143
|
+
}
|
|
144
|
+
get typeObject() {
|
|
145
|
+
const typeObject = this.resolveTypeObject();
|
|
146
|
+
if (!typeObject) {
|
|
147
|
+
if (relaxable("fieldObject.typeObject")) return;
|
|
148
|
+
throw new NotFoundError(`!schema.typeObjectsByName["${this.type}"]`);
|
|
146
149
|
}
|
|
147
|
-
return
|
|
150
|
+
return typeObject;
|
|
148
151
|
}
|
|
149
152
|
get holderTypeObject() {
|
|
150
153
|
const cache = this.cache ??= {};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { EntityId, FieldId, FieldName, Id, Name, PublicId, SpaceName, TypeId, TypeName } from "./brands.js";
|
|
1
2
|
import { NotDefinedGetError, NotFoundError } from "./errors.js";
|
|
2
3
|
import { RawTypeObject, SyncSource, TypeObject, TypeObjectFactory, TypeObjectParams } from "./type-object.js";
|
|
3
4
|
import { RawSchema, Schema, SchemaRef } from "./schema.js";
|
|
4
5
|
import { Cardinality, FieldObject, FieldObjectParams, LinkRule, LinkRuleOperand, RawFieldObject, SyncField, SyncRelation } from "./field-object.js";
|
|
5
6
|
import { Factory, factory, protectiveFactory } from "./factory.js";
|
|
6
|
-
import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./utils.js";
|
|
7
|
-
export { Cardinality, Factory, FieldObject, FieldObjectParams, LinkRule, LinkRuleOperand, NotDefinedGetError, NotFoundError, RawFieldObject, RawSchema, RawTypeObject, Schema, SchemaRef, SyncField, SyncRelation, SyncSource, TypeObject, TypeObjectFactory, TypeObjectParams, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
|
7
|
+
import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, isOneOf, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./utils.js";
|
|
8
|
+
export { Cardinality, EntityId, Factory, FieldId, FieldName, FieldObject, FieldObjectParams, Id, LinkRule, LinkRuleOperand, Name, NotDefinedGetError, NotFoundError, PublicId, RawFieldObject, RawSchema, RawTypeObject, Schema, SchemaRef, SpaceName, SyncField, SyncRelation, SyncSource, TypeId, TypeName, TypeObject, TypeObjectFactory, TypeObjectParams, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, isOneOf, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NotDefinedGetError, NotFoundError } from "./errors.js";
|
|
2
|
-
import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./utils.js";
|
|
2
|
+
import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, isOneOf, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./utils.js";
|
|
3
3
|
import { FieldObject } from "./field-object.js";
|
|
4
4
|
import { Schema } from "./schema.js";
|
|
5
5
|
import { TypeObject } from "./type-object.js";
|
|
6
6
|
import { factory, protectiveFactory } from "./factory.js";
|
|
7
|
-
export { FieldObject, NotDefinedGetError, NotFoundError, Schema, TypeObject, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
|
7
|
+
export { FieldObject, NotDefinedGetError, NotFoundError, Schema, TypeObject, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, isOneOf, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
package/lib/relaxable.d.ts
CHANGED
package/lib/relaxable.js
CHANGED
package/lib/schema.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TypeId, TypeName } from "./brands.js";
|
|
1
2
|
import { RawTypeObject, TypeObject } from "./type-object.js";
|
|
2
3
|
import { FieldObject } from "./field-object.js";
|
|
3
4
|
import { Factory } from "./factory.js";
|
|
@@ -35,15 +36,15 @@ declare class Schema implements SchemaRef {
|
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
/** @internal resolves a field's `fibery/type` to its type object */
|
|
38
|
-
resolveTypeObject(type:
|
|
39
|
+
resolveTypeObject(type: TypeName): TypeObject | null;
|
|
39
40
|
/** @internal the type-component field pointing at `type`, if any */
|
|
40
41
|
resolveTypeComponentFieldObject(type: string): FieldObject | null;
|
|
41
42
|
/** @internal the non-entity-ref ends of a multi-relation */
|
|
42
43
|
resolveMultiRelatedFieldObjects(multiRelation: string): ReadonlyArray<FieldObject>;
|
|
43
|
-
getTypeObjectById(typeId:
|
|
44
|
-
getTypeObjectByName(typeName:
|
|
45
|
-
getTypeObjectByIdOrThrow(typeId:
|
|
46
|
-
getTypeObjectByNameOrThrow(typeName:
|
|
44
|
+
getTypeObjectById(typeId: TypeId): TypeObject | null;
|
|
45
|
+
getTypeObjectByName(typeName: TypeName): TypeObject | null;
|
|
46
|
+
getTypeObjectByIdOrThrow(typeId: TypeId): TypeObject;
|
|
47
|
+
getTypeObjectByNameOrThrow(typeName: TypeName): TypeObject;
|
|
47
48
|
}
|
|
48
49
|
//#endregion
|
|
49
50
|
export { RawSchema, Schema, SchemaRef };
|
package/lib/schema.js
CHANGED
|
@@ -31,7 +31,7 @@ var Schema = class {
|
|
|
31
31
|
}
|
|
32
32
|
/** @internal resolves a field's `fibery/type` to its type object */
|
|
33
33
|
resolveTypeObject(type) {
|
|
34
|
-
return this.
|
|
34
|
+
return this.getTypeObjectByName(type);
|
|
35
35
|
}
|
|
36
36
|
/** @internal the type-component field pointing at `type`, if any */
|
|
37
37
|
resolveTypeComponentFieldObject(type) {
|
package/lib/type-object.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FieldId, FieldName, TypeId, TypeName } from "./brands.js";
|
|
1
2
|
import { SchemaRef } from "./schema.js";
|
|
2
3
|
import { FieldObject, FieldObjectParams, RawFieldObject } from "./field-object.js";
|
|
3
4
|
//#region src/type-object.d.ts
|
|
@@ -9,8 +10,8 @@ type SyncSource = {
|
|
|
9
10
|
type: string;
|
|
10
11
|
};
|
|
11
12
|
type RawTypeObject = {
|
|
12
|
-
"fibery/id":
|
|
13
|
-
"fibery/name":
|
|
13
|
+
"fibery/id": TypeId;
|
|
14
|
+
"fibery/name": TypeName;
|
|
14
15
|
"fibery/description"?: string | null;
|
|
15
16
|
"fibery/deleted?"?: boolean;
|
|
16
17
|
"fibery/fields": RawFieldObject[];
|
|
@@ -57,14 +58,14 @@ declare class TypeObject {
|
|
|
57
58
|
private cache;
|
|
58
59
|
constructor({ rawTypeObject, schema, factory }: TypeObjectParams);
|
|
59
60
|
toJSON(): string | RawTypeObject;
|
|
60
|
-
getFieldObjectById(fieldId:
|
|
61
|
-
getFieldObjectByName(fieldName:
|
|
62
|
-
getFieldObjectByIdOrThrow(fieldId:
|
|
63
|
-
getFieldObjectByNameOrThrow(fieldName:
|
|
61
|
+
getFieldObjectById(fieldId: FieldId): FieldObject | null;
|
|
62
|
+
getFieldObjectByName(fieldName: FieldName): FieldObject | null;
|
|
63
|
+
getFieldObjectByIdOrThrow(fieldId: FieldId): FieldObject;
|
|
64
|
+
getFieldObjectByNameOrThrow(fieldName: FieldName): FieldObject;
|
|
64
65
|
get rawMeta(): Readonly<RawTypeObject["fibery/meta"]>;
|
|
65
|
-
get name():
|
|
66
|
+
get name(): TypeName;
|
|
66
67
|
get description(): string | null;
|
|
67
|
-
get id():
|
|
68
|
+
get id(): TypeId;
|
|
68
69
|
get isDeleted(): boolean;
|
|
69
70
|
get version(): string;
|
|
70
71
|
get isEntityRef(): boolean;
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawTypeObject, TypeObject } from "./type-object.js";
|
|
2
2
|
import { RawSchema } from "./schema.js";
|
|
3
|
-
import { RawFieldObject } from "./field-object.js";
|
|
4
3
|
//#region src/utils.d.ts
|
|
5
4
|
declare const withOnlyDefinedGets: (target: any, targetKind?: string) => any;
|
|
6
5
|
declare const capitalizeFirstChar: (input: string) => string;
|
|
@@ -28,34 +27,12 @@ declare const attachEnumNamespace: ({ enumNamespace, typeNamePart }: {
|
|
|
28
27
|
typeNamePart: string;
|
|
29
28
|
}) => string;
|
|
30
29
|
declare const removeDeletedTypesAndFields: (rawSchema: RawSchema) => {
|
|
31
|
-
"fibery/types":
|
|
32
|
-
"fibery/fields": RawFieldObject[];
|
|
33
|
-
"fibery/id": string;
|
|
34
|
-
"fibery/name": string;
|
|
35
|
-
"fibery/description"?: string | null;
|
|
36
|
-
"fibery/deleted?"?: boolean;
|
|
37
|
-
"fibery/meta": {
|
|
38
|
-
"fibery/domain?"?: boolean;
|
|
39
|
-
"fibery/platform?"?: boolean;
|
|
40
|
-
"fibery/highlight?"?: boolean;
|
|
41
|
-
"app/mixin?"?: boolean;
|
|
42
|
-
"ui/mixin-icon"?: string;
|
|
43
|
-
"fibery/enum?"?: boolean;
|
|
44
|
-
"fibery/primitive?"?: boolean;
|
|
45
|
-
"ui/writer-mode?"?: boolean;
|
|
46
|
-
"ui/color"?: string;
|
|
47
|
-
"ui/units"?: unknown[];
|
|
48
|
-
"app/mixins"?: Record<string, boolean>;
|
|
49
|
-
"sync/source"?: SyncSource;
|
|
50
|
-
"fibery/secured?"?: boolean;
|
|
51
|
-
"fibery/type-component?"?: boolean;
|
|
52
|
-
"ref/ref-db?"?: boolean;
|
|
53
|
-
"semantic-index/enabled"?: boolean;
|
|
54
|
-
};
|
|
55
|
-
}[];
|
|
30
|
+
"fibery/types": RawTypeObject[];
|
|
56
31
|
"fibery/id": string;
|
|
57
32
|
"fibery/version": string;
|
|
58
33
|
};
|
|
59
34
|
declare const getTypeObjectTitle: (typeObject: TypeObject, form?: "singular" | "plural") => string;
|
|
35
|
+
/** `===` does not narrow a branded string (`TypeName`, `FieldName`) to a literal; this does. */
|
|
36
|
+
declare const isOneOf: <const L extends readonly string[]>(value: string, literals: L) => value is L[number];
|
|
60
37
|
//#endregion
|
|
61
|
-
export { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
|
38
|
+
export { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, isOneOf, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
package/lib/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NotDefinedGetError } from "./errors.js";
|
|
2
|
+
import { relaxableRealm } from "./relaxable.js";
|
|
2
3
|
import { printJsPath } from "./print-utils.js";
|
|
3
4
|
import { traceError } from "@fibery/helpers/utils/trace";
|
|
4
5
|
//#region src/utils.ts
|
|
@@ -43,7 +44,11 @@ const capitalizeWord = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLow
|
|
|
43
44
|
const toPascalCase = (lispCasedString = "") => lispCasedString && (lispCasedString.split("/").at(-1) || "").split("-").map(capitalizeWord).join(" ");
|
|
44
45
|
const isObsoleteTitle = (str) => {
|
|
45
46
|
const { name } = splitKeyword(str);
|
|
46
|
-
return name.toLowerCase() === name && !hasTildes(name);
|
|
47
|
+
return startsWithLowercaseLetter(name) && name.toLowerCase() === name && !hasTildes(name);
|
|
48
|
+
};
|
|
49
|
+
const startsWithLowercaseLetter = (str) => {
|
|
50
|
+
const first = str.charAt(0);
|
|
51
|
+
return first !== "" && first !== first.toUpperCase();
|
|
47
52
|
};
|
|
48
53
|
const hasTildes = (str) => str.includes("~");
|
|
49
54
|
const nameOverrides = {
|
|
@@ -96,21 +101,42 @@ const makeEnumTypeNamePart = ({ holderType, enumName }) => {
|
|
|
96
101
|
const attachEnumNamespace = ({ enumNamespace, typeNamePart }) => {
|
|
97
102
|
return `${enumNamespace}/${typeNamePart}`;
|
|
98
103
|
};
|
|
104
|
+
const reportedStrippedFields = /* @__PURE__ */ new Set();
|
|
105
|
+
const reportStrippedField = (holderTypeName, rawFieldObject, isTypeSoftDeleted) => {
|
|
106
|
+
if (!relaxableRealm()) return;
|
|
107
|
+
const key = `${holderTypeName} ${rawFieldObject["fibery/name"]} ${rawFieldObject["fibery/type"]}`;
|
|
108
|
+
if (reportedStrippedFields.has(key)) return;
|
|
109
|
+
reportedStrippedFields.add(key);
|
|
110
|
+
traceError(`Stripped field "${rawFieldObject["fibery/name"]}" of "${holderTypeName}": its type "${rawFieldObject["fibery/type"]}" is ${isTypeSoftDeleted ? "soft-deleted" : "not in schema"}`);
|
|
111
|
+
};
|
|
99
112
|
const removeDeletedTypesAndFields = (rawSchema) => {
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
const rawTypeObjects = rawSchema["fibery/types"];
|
|
114
|
+
const survivingTypeNames = /* @__PURE__ */ new Set();
|
|
115
|
+
const deletedTypeNames = /* @__PURE__ */ new Set();
|
|
116
|
+
for (const rawTypeObject of rawTypeObjects) if (rawTypeObject["fibery/deleted?"] === true) deletedTypeNames.add(rawTypeObject["fibery/name"]);
|
|
117
|
+
else survivingTypeNames.add(rawTypeObject["fibery/name"]);
|
|
118
|
+
const survivingRawTypeObjects = [];
|
|
119
|
+
for (const rawTypeObject of rawTypeObjects) {
|
|
120
|
+
if (rawTypeObject["fibery/deleted?"] === true) continue;
|
|
121
|
+
const rawFieldObjects = rawTypeObject["fibery/fields"];
|
|
122
|
+
const survivingRawFieldObjects = rawFieldObjects.filter((rawFieldObject) => {
|
|
123
|
+
if (rawFieldObject["fibery/deleted?"] === true) return false;
|
|
124
|
+
if (survivingTypeNames.has(rawFieldObject["fibery/type"])) return true;
|
|
125
|
+
reportStrippedField(rawTypeObject["fibery/name"], rawFieldObject, deletedTypeNames.has(rawFieldObject["fibery/type"]));
|
|
126
|
+
return false;
|
|
127
|
+
});
|
|
128
|
+
survivingRawTypeObjects.push(survivingRawFieldObjects.length === rawFieldObjects.length ? rawTypeObject : {
|
|
129
|
+
...rawTypeObject,
|
|
130
|
+
"fibery/fields": survivingRawFieldObjects
|
|
131
|
+
});
|
|
132
|
+
}
|
|
109
133
|
return {
|
|
110
|
-
...
|
|
111
|
-
"fibery/types":
|
|
134
|
+
...rawSchema,
|
|
135
|
+
"fibery/types": survivingRawTypeObjects
|
|
112
136
|
};
|
|
113
137
|
};
|
|
114
138
|
const getTypeObjectTitle = (typeObject, form) => form ? form === "singular" ? typeObject.singularTitle : typeObject.pluralTitle : typeObject.title;
|
|
139
|
+
/** `===` does not narrow a branded string (`TypeName`, `FieldName`) to a literal; this does. */
|
|
140
|
+
const isOneOf = (value, literals) => literals.includes(value);
|
|
115
141
|
//#endregion
|
|
116
|
-
export { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
|
142
|
+
export { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, isOneOf, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/schema",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Fibery schema utils",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"lodash": "4.17.21",
|
|
25
|
-
"@fibery/helpers": "3.
|
|
25
|
+
"@fibery/helpers": "3.4.0",
|
|
26
26
|
"@fibery/pluralize": "1.2.1"
|
|
27
27
|
}
|
|
28
28
|
}
|