@fibery/schema 12.0.1 → 12.0.2

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.
@@ -1,5 +1,4 @@
1
1
  import { NotFoundError } from "./errors.js";
2
- import { relaxable } from "./relaxable.js";
3
2
  import { parseType, toNonEnumTitle } from "./utils.js";
4
3
  import { isPlainObject } from "@fibery/helpers/src/_";
5
4
  //#region src/field-object.ts
@@ -143,14 +142,11 @@ var FieldObject = class {
143
142
  }
144
143
  get typeObject() {
145
144
  const typeObject = this.resolveTypeObject();
146
- if (!typeObject) {
147
- if (relaxable()) return;
148
- throw new NotFoundError("type", {
149
- typeName: this.type,
150
- fieldId: this.id,
151
- fieldName: this.name
152
- });
153
- }
145
+ if (!typeObject) throw new NotFoundError("type", {
146
+ typeName: this.type,
147
+ fieldId: this.id,
148
+ fieldName: this.name
149
+ });
154
150
  return typeObject;
155
151
  }
156
152
  get holderTypeObject() {
@@ -158,14 +154,11 @@ var FieldObject = class {
158
154
  let value = cache.holderTypeObject;
159
155
  if (!value) {
160
156
  const holderTypeObject = this.schema.resolveTypeObject(this.holderType);
161
- if (!holderTypeObject) {
162
- if (relaxable()) return;
163
- throw new NotFoundError("type", {
164
- typeName: this.holderType,
165
- fieldId: this.id,
166
- fieldName: this.name
167
- });
168
- }
157
+ if (!holderTypeObject) throw new NotFoundError("type", {
158
+ typeName: this.holderType,
159
+ fieldId: this.id,
160
+ fieldName: this.name
161
+ });
169
162
  value = holderTypeObject;
170
163
  cache.holderTypeObject = value;
171
164
  }
package/lib/schema.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { NotFoundError } from "./errors.js";
2
- import { relaxable } from "./relaxable.js";
3
2
  //#region src/schema.ts
4
3
  const EMPTY_FIELD_OBJECTS = Object.freeze([]);
5
4
  const typeComponentFieldObjects = /* @__PURE__ */ new WeakMap();
@@ -91,18 +90,12 @@ var Schema = class {
91
90
  }
92
91
  getTypeObjectByIdOrThrow(typeId) {
93
92
  const typeObject = this.getTypeObjectById(typeId);
94
- if (!typeObject) {
95
- if (relaxable()) return;
96
- throw new NotFoundError("type", { typeId });
97
- }
93
+ if (!typeObject) throw new NotFoundError("type", { typeId });
98
94
  return typeObject;
99
95
  }
100
96
  getTypeObjectByNameOrThrow(typeName) {
101
97
  const typeObject = this.getTypeObjectByName(typeName);
102
- if (!typeObject) {
103
- if (relaxable()) return;
104
- throw new NotFoundError("type", { typeName });
105
- }
98
+ if (!typeObject) throw new NotFoundError("type", { typeName });
106
99
  return typeObject;
107
100
  }
108
101
  };
@@ -1,5 +1,4 @@
1
1
  import { NotFoundError } from "./errors.js";
2
- import { relaxable } from "./relaxable.js";
3
2
  import { parseType, toTitle } from "./utils.js";
4
3
  import { isPlainObject, truthy } from "@fibery/helpers/src/_";
5
4
  import { pluralize } from "@fibery/pluralize";
@@ -32,26 +31,20 @@ var TypeObject = class {
32
31
  }
33
32
  getFieldObjectByIdOrThrow(fieldId) {
34
33
  const fieldObject = this.getFieldObjectById(fieldId);
35
- if (!fieldObject) {
36
- if (relaxable()) return;
37
- throw new NotFoundError("field", {
38
- typeId: this.id,
39
- typeName: this.name,
40
- fieldId
41
- });
42
- }
34
+ if (!fieldObject) throw new NotFoundError("field", {
35
+ typeId: this.id,
36
+ typeName: this.name,
37
+ fieldId
38
+ });
43
39
  return fieldObject;
44
40
  }
45
41
  getFieldObjectByNameOrThrow(fieldName) {
46
42
  const fieldObject = this.getFieldObjectByName(fieldName);
47
- if (!fieldObject) {
48
- if (relaxable()) return;
49
- throw new NotFoundError("field", {
50
- typeId: this.id,
51
- typeName: this.name,
52
- fieldName
53
- });
54
- }
43
+ if (!fieldObject) throw new NotFoundError("field", {
44
+ typeId: this.id,
45
+ typeName: this.name,
46
+ fieldName
47
+ });
55
48
  return fieldObject;
56
49
  }
57
50
  get rawMeta() {
package/lib/utils.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { NotDefinedGetError } from "./errors.js";
2
- import { relaxableRealm } from "./relaxable.js";
3
2
  import { printJsPath } from "./print-utils.js";
4
3
  import { traceError } from "@fibery/helpers/utils/trace";
5
4
  //#region src/utils.ts
@@ -101,9 +100,10 @@ const makeEnumTypeNamePart = ({ holderType, enumName }) => {
101
100
  const attachEnumNamespace = ({ enumNamespace, typeNamePart }) => {
102
101
  return `${enumNamespace}/${typeNamePart}`;
103
102
  };
103
+ const insideApplication = () => typeof window !== "undefined" && Boolean(window["x-ui-version"]);
104
104
  const reportedStrippedFields = /* @__PURE__ */ new Set();
105
105
  const reportStrippedField = (holderTypeName, rawFieldObject, isTypeSoftDeleted) => {
106
- if (!relaxableRealm()) return;
106
+ if (!insideApplication()) return;
107
107
  if (process.env.NODE_ENV === "production") return;
108
108
  const key = `${holderTypeName} ${rawFieldObject["fibery/name"]} ${rawFieldObject["fibery/type"]}`;
109
109
  if (reportedStrippedFields.has(key)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/schema",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
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": "4.1.0",
25
+ "@fibery/helpers": "4.1.1",
26
26
  "@fibery/pluralize": "1.2.1"
27
27
  }
28
28
  }
@@ -1,7 +0,0 @@
1
- //#region src/relaxable.d.ts
2
- declare const relaxableRealm: () => boolean;
3
- declare let relaxable: () => boolean;
4
- /** Temporary application policy while strict lookups roll out. Standalone schema stays strict. */
5
- declare function setRelaxablePredicate(next: () => boolean): () => void;
6
- //#endregion
7
- export { relaxable, relaxableRealm, setRelaxablePredicate };
package/lib/relaxable.js DELETED
@@ -1,13 +0,0 @@
1
- //#region src/relaxable.ts
2
- const relaxableRealm = () => typeof window !== "undefined" && Boolean(window["x-ui-version"]);
3
- let relaxable = () => false;
4
- /** Temporary application policy while strict lookups roll out. Standalone schema stays strict. */
5
- function setRelaxablePredicate(next) {
6
- const previous = relaxable;
7
- relaxable = next;
8
- return () => {
9
- relaxable = previous;
10
- };
11
- }
12
- //#endregion
13
- export { relaxable, relaxableRealm, setRelaxablePredicate };