@fibery/schema 8.1.3 → 8.1.4
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/index.js +11 -11
- package/package.json +1 -1
- package/types.d.ts +3 -0
package/lib/index.js
CHANGED
|
@@ -81,13 +81,13 @@ const formatWithCustomInspectParams = values => {
|
|
|
81
81
|
};
|
|
82
82
|
function assert(condition, ...args) {
|
|
83
83
|
if (!condition) {
|
|
84
|
-
const message = args.length > 0 ? formatWithCustomInspectParams(args) :
|
|
84
|
+
const message = args.length > 0 ? formatWithCustomInspectParams(args) : `Assertion failed with no details`;
|
|
85
85
|
throw new Error(message);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
function assertWithTraceError(condition, ...args) {
|
|
89
89
|
if (!condition) {
|
|
90
|
-
const message = args.length > 0 ? formatWithCustomInspectParams(args) :
|
|
90
|
+
const message = args.length > 0 ? formatWithCustomInspectParams(args) : `Assertion failed with no details`;
|
|
91
91
|
traceError(message);
|
|
92
92
|
}
|
|
93
93
|
} // eslint-disable-next-line no-console
|
|
@@ -253,7 +253,7 @@ const splitKeyword = keyword => {
|
|
|
253
253
|
|
|
254
254
|
const parseType = external_lodash_default().memoize(type => {
|
|
255
255
|
if (!type.includes("/")) {
|
|
256
|
-
traceError(
|
|
256
|
+
traceError(`parseType invalid usage: passed type is '${type}'`);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
return splitKeyword(type);
|
|
@@ -266,13 +266,13 @@ const makeEnumTypeNamePart = ({
|
|
|
266
266
|
namespace,
|
|
267
267
|
name
|
|
268
268
|
} = parseType(holderType);
|
|
269
|
-
return
|
|
269
|
+
return `${enumName}_${namespace}/${name}`;
|
|
270
270
|
};
|
|
271
271
|
const attachEnumNamespace = ({
|
|
272
272
|
enumNamespace,
|
|
273
273
|
typeNamePart
|
|
274
274
|
}) => {
|
|
275
|
-
return
|
|
275
|
+
return `${enumNamespace}/${typeNamePart}`;
|
|
276
276
|
};
|
|
277
277
|
const removeDeletedTypesAndFields = rawSchema => {
|
|
278
278
|
const {
|
|
@@ -389,7 +389,7 @@ class FieldObject {
|
|
|
389
389
|
const fieldObject = this.typeObject.fieldObjects.find(selector);
|
|
390
390
|
|
|
391
391
|
if (!fieldObject) {
|
|
392
|
-
throw new Error(
|
|
392
|
+
throw new Error(`there no other end for relation ${relation}`);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
return fieldObject;
|
|
@@ -710,27 +710,27 @@ const protectiveFactory = {
|
|
|
710
710
|
}) => withOnlyDefinedGets(new Schema({
|
|
711
711
|
rawSchema: options.shouldRemoveDeletedTypesAndFields ? removeDeletedTypesAndFields(rawSchema) : rawSchema,
|
|
712
712
|
factory: protectiveFactory
|
|
713
|
-
}),
|
|
713
|
+
}), `schema`),
|
|
714
714
|
makeTypeObject: args => {
|
|
715
715
|
const typeObject = new TypeObject({ ...args,
|
|
716
716
|
factory: protectiveFactory
|
|
717
717
|
});
|
|
718
|
-
return withOnlyDefinedGets(typeObject,
|
|
718
|
+
return withOnlyDefinedGets(typeObject, `schema.typeObjectsByName["${typeObject.name}"]`);
|
|
719
719
|
},
|
|
720
720
|
makeTypeObjectsById: typeObjects => withOnlyDefinedGets(external_lodash_default().keyBy(typeObjects, x => x.id), "schema.typeObjectsById"),
|
|
721
721
|
makeTypeObjectsByName: typeObjects => withOnlyDefinedGets(external_lodash_default().keyBy(typeObjects, x => x.name), "schema.typeObjectsByName"),
|
|
722
722
|
makeFieldObject: args => {
|
|
723
723
|
const fieldObject = new FieldObject(args);
|
|
724
|
-
return withOnlyDefinedGets(fieldObject,
|
|
724
|
+
return withOnlyDefinedGets(fieldObject, `schema.typeObjectsByName["${fieldObject.holderType}"].fieldObjectsByName["${fieldObject.name}"]`);
|
|
725
725
|
},
|
|
726
726
|
makeFieldObjectsById: ({
|
|
727
727
|
type,
|
|
728
728
|
fieldObjects
|
|
729
|
-
}) => withOnlyDefinedGets(external_lodash_default().keyBy(fieldObjects, x => x.id),
|
|
729
|
+
}) => withOnlyDefinedGets(external_lodash_default().keyBy(fieldObjects, x => x.id), `schema.typeObjectsByName["${type}"].fieldObjectsById`),
|
|
730
730
|
makeFieldObjectsByName: ({
|
|
731
731
|
type,
|
|
732
732
|
fieldObjects
|
|
733
|
-
}) => withOnlyDefinedGets(external_lodash_default().keyBy(fieldObjects, x => x.name),
|
|
733
|
+
}) => withOnlyDefinedGets(external_lodash_default().keyBy(fieldObjects, x => x.name), `schema.typeObjectsByName["${type}"].fieldObjectsByName`)
|
|
734
734
|
};
|
|
735
735
|
module.exports = __webpack_exports__;
|
|
736
736
|
/******/ })()
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -46,8 +46,10 @@ export type TypeObject = {
|
|
|
46
46
|
description: string | null;
|
|
47
47
|
id: string;
|
|
48
48
|
idField: string;
|
|
49
|
+
idFieldObject: FieldObject;
|
|
49
50
|
publicIdField: string;
|
|
50
51
|
titleField: string;
|
|
52
|
+
titleFieldObject: FieldObject;
|
|
51
53
|
rankField: string | null;
|
|
52
54
|
rawMeta: Record<string, unknown>;
|
|
53
55
|
isDomain: boolean;
|
|
@@ -73,6 +75,7 @@ export type TypeObject = {
|
|
|
73
75
|
fieldObjectsById: Record<string, FieldObject>;
|
|
74
76
|
fieldObjectsByName: Record<string, FieldObject>;
|
|
75
77
|
typeComponentFieldObject: FieldObject | undefined;
|
|
78
|
+
isDeleted: boolean;
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
export type Schema = {
|