@fibery/schema 10.2.16 → 10.2.17

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,6 +1,6 @@
1
- import { FieldObject, FieldObjectParams } from "./field-object";
1
+ import { FieldObject, type FieldObjectParams } from "./field-object";
2
2
  import { Schema } from "./schema";
3
- import { TypeObject, TypeObjectParams } from "./type-object";
3
+ import { TypeObject, type TypeObjectParams } from "./type-object";
4
4
  export type Factory = {
5
5
  makeSchema: (rawSchema: Record<string, unknown>, options?: {
6
6
  shouldRemoveDeletedTypesAndFields: boolean;
@@ -1,4 +1,4 @@
1
- import { TypeObject } from "./type-object";
1
+ import type { TypeObject } from "./type-object";
2
2
  export type Cardinality = ":cardinality/one-to-one" | ":cardinality/one-to-many" | ":cardinality/many-to-many" | ":cardinality/many-to-one";
3
3
  export type RawFieldObject = {
4
4
  "fibery/id": string;
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FieldObject = void 0;
7
+ const _1 = require("@fibery/helpers/src/_");
7
8
  const isFunction_1 = __importDefault(require("lodash/isFunction"));
8
9
  const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
9
10
  const isString_1 = __importDefault(require("lodash/isString"));
10
- const once_1 = __importDefault(require("lodash/once"));
11
11
  const utils_1 = require("./utils");
12
12
  class FieldObject {
13
13
  name;
@@ -97,12 +97,12 @@ class FieldObject {
97
97
  typeObject: {
98
98
  configurable: false,
99
99
  enumerable: true,
100
- get: (0, once_1.default)(() => resolveTypeObject(this.type)),
100
+ get: (0, _1.once)(() => resolveTypeObject(this.type)),
101
101
  },
102
102
  mixinTypeObject: {
103
103
  configurable: false,
104
104
  enumerable: true,
105
- get: (0, once_1.default)(() => {
105
+ get: (0, _1.once)(() => {
106
106
  return this.holderTypeObject.installedMixinTypeObjects.find((mixinTypeObject) => Object.hasOwn(mixinTypeObject.fieldObjectsByName, this.name) ||
107
107
  (this.name === "workflow/state" && mixinTypeObject.name === "workflow/workflow"));
108
108
  }),
@@ -110,19 +110,19 @@ class FieldObject {
110
110
  holderTypeObject: {
111
111
  configurable: false,
112
112
  enumerable: true,
113
- get: (0, once_1.default)(() => {
113
+ get: (0, _1.once)(() => {
114
114
  return resolveTypeObject(holderType);
115
115
  }),
116
116
  },
117
117
  nameParts: {
118
118
  configurable: false,
119
119
  enumerable: true,
120
- get: (0, once_1.default)(() => (0, utils_1.parseType)(rawFieldObject["fibery/name"])),
120
+ get: (0, _1.once)(() => (0, utils_1.parseType)(rawFieldObject["fibery/name"])),
121
121
  },
122
122
  title: {
123
123
  configurable: false,
124
124
  enumerable: true,
125
- get: (0, once_1.default)(() => {
125
+ get: (0, _1.once)(() => {
126
126
  if (this.name === "fibery/role" && this.holderType === "fibery/user") {
127
127
  return "User Role";
128
128
  }
@@ -132,7 +132,7 @@ class FieldObject {
132
132
  multiRelatedFieldObjects: {
133
133
  configurable: false,
134
134
  enumerable: true,
135
- get: (0, once_1.default)(() => {
135
+ get: (0, _1.once)(() => {
136
136
  const { multiRelation, typeObject } = this;
137
137
  if (!multiRelation || !typeObject.isEntityRef) {
138
138
  return [];
@@ -143,7 +143,7 @@ class FieldObject {
143
143
  isMultiField: {
144
144
  configurable: false,
145
145
  enumerable: true,
146
- get: (0, once_1.default)(() => {
146
+ get: (0, _1.once)(() => {
147
147
  return this.typeObject.isEntityRef;
148
148
  }),
149
149
  },
@@ -1,5 +1,5 @@
1
- import { RawTypeObject, TypeObject } from "./type-object";
2
- import { Factory } from "./factory";
1
+ import type { Factory } from "./factory";
2
+ import type { RawTypeObject, TypeObject } from "./type-object";
3
3
  export type RawSchema = {
4
4
  "fibery/id": string;
5
5
  "fibery/types": RawTypeObject[];
package/lib/src/schema.js CHANGED
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Schema = void 0;
7
- const once_1 = __importDefault(require("lodash/once"));
4
+ const _1 = require("@fibery/helpers/src/_");
8
5
  class Schema {
9
6
  typeObjects;
10
7
  typeObjectsById;
@@ -21,7 +18,7 @@ class Schema {
21
18
  enumerable: false,
22
19
  },
23
20
  });
24
- const getTypeComponentTypeToFieldObject = (0, once_1.default)(() => {
21
+ const getTypeComponentTypeToFieldObject = (0, _1.once)(() => {
25
22
  const typeComponentTypeToFieldObject = new Map();
26
23
  this.typeObjects
27
24
  .flatMap((typeObject) => typeObject.fieldObjects)
@@ -1,5 +1,5 @@
1
- import { FieldObject, FieldObjectParams, RawFieldObject } from "./field-object";
2
1
  import type { IdField, PublicIdField, RankField, TitleField } from "./field-keys";
2
+ import type { FieldObject, FieldObjectParams, RawFieldObject } from "./field-object";
3
3
  export type SyncSource = {
4
4
  appId: string;
5
5
  appName: string;
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TypeObject = void 0;
7
+ const _1 = require("@fibery/helpers/src/_");
8
+ const pluralize_1 = require("@fibery/pluralize");
7
9
  const isFunction_1 = __importDefault(require("lodash/isFunction"));
8
10
  const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
9
- const once_1 = __importDefault(require("lodash/once"));
10
11
  const utils_1 = require("./utils");
11
- const pluralize_1 = require("@fibery/pluralize");
12
12
  class TypeObject {
13
13
  name;
14
14
  description;
@@ -66,13 +66,13 @@ class TypeObject {
66
66
  this.syncSource = rawMeta["sync/source"] || null;
67
67
  this.version = version;
68
68
  this.isEntityRef = rawTypeObject["fibery/name"] === "fibery/entity-ref";
69
- const fieldObjectsByNameOnceGetter = (0, once_1.default)(() => {
69
+ const fieldObjectsByNameOnceGetter = (0, _1.once)(() => {
70
70
  return factory.makeFieldObjectsByName({
71
71
  type: this.name,
72
72
  fieldObjects: this.fieldObjects,
73
73
  });
74
74
  });
75
- const fieldObjectsGetter = (0, once_1.default)(() => rawTypeObject["fibery/fields"].map((rawFieldObject) => {
75
+ const fieldObjectsGetter = (0, _1.once)(() => rawTypeObject["fibery/fields"].map((rawFieldObject) => {
76
76
  return factory.makeFieldObject({
77
77
  rawFieldObject,
78
78
  holderType: this.name,
@@ -106,7 +106,7 @@ class TypeObject {
106
106
  fieldObjectsById: {
107
107
  configurable: false,
108
108
  enumerable: true,
109
- get: (0, once_1.default)(() => {
109
+ get: (0, _1.once)(() => {
110
110
  return factory.makeFieldObjectsById({
111
111
  type: this.name,
112
112
  fieldObjects: this.fieldObjects,
@@ -121,26 +121,26 @@ class TypeObject {
121
121
  installedMixinTypeObjects: {
122
122
  configurable: false,
123
123
  enumerable: true,
124
- get: (0, once_1.default)(() => [...this.installedMixins].map(resolveTypeObject).filter((typeObject) => typeObject)),
124
+ get: (0, _1.once)(() => [...this.installedMixins].map(resolveTypeObject).filter((typeObject) => typeObject)),
125
125
  },
126
126
  title: {
127
127
  configurable: false,
128
128
  enumerable: true,
129
- get: (0, once_1.default)(() => (0, utils_1.toTitle)(this.name)),
129
+ get: (0, _1.once)(() => (0, utils_1.toTitle)(this.name)),
130
130
  },
131
131
  pluralTitle: {
132
132
  configurable: false,
133
133
  enumerable: true,
134
- get: (0, once_1.default)(() => pluralize_1.pluralize.plural((0, utils_1.toTitle)(this.name))),
134
+ get: (0, _1.once)(() => pluralize_1.pluralize.plural((0, utils_1.toTitle)(this.name))),
135
135
  },
136
136
  singularTitle: {
137
137
  configurable: false,
138
138
  enumerable: true,
139
- get: (0, once_1.default)(() => pluralize_1.pluralize.singular((0, utils_1.toTitle)(this.name))),
139
+ get: (0, _1.once)(() => pluralize_1.pluralize.singular((0, utils_1.toTitle)(this.name))),
140
140
  },
141
141
  });
142
142
  }
143
- _getFieldObjectShortcuts = (0, once_1.default)(() => {
143
+ _getFieldObjectShortcuts = (0, _1.once)(() => {
144
144
  const hasRank = this.installedMixins.has("fibery/rank-mixin");
145
145
  return this.fieldObjects.reduce((result, fieldObject) => {
146
146
  if (fieldObject.isId) {
@@ -1,5 +1,5 @@
1
- import { RawSchema } from "./schema";
2
- import { TypeObject } from "./type-object";
1
+ import type { RawSchema } from "./schema";
2
+ import type { TypeObject } from "./type-object";
3
3
  export declare const withOnlyDefinedGets: (target: any, targetKind?: string) => any;
4
4
  export declare const capitalizeFirstChar: (input: string) => string;
5
5
  export declare const toTypeOrFieldNamePartTitle: (str: string | null | undefined) => string;
@@ -13,10 +13,13 @@ export declare const parseEnumType: (type: string) => {
13
13
  targetNamespace: string;
14
14
  };
15
15
  export declare const toTitle: (typeOrAttr: string) => string;
16
- export declare const parseType: ((type: string) => {
16
+ export declare const parseType: ((arg: string) => {
17
17
  namespace: string;
18
18
  name: string;
19
- }) & import("lodash").MemoizedFunction;
19
+ }) & import("@fibery/helpers/src/_").MemoizedFunction<string, {
20
+ namespace: string;
21
+ name: string;
22
+ }>;
20
23
  export declare const makeEnumTypeNamePart: ({ holderType, enumName }: {
21
24
  holderType: string;
22
25
  enumName: string;
package/lib/src/utils.js CHANGED
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getTypeObjectTitle = exports.removeDeletedTypesAndFields = exports.attachEnumNamespace = exports.makeEnumTypeNamePart = exports.parseType = exports.toTitle = exports.parseEnumType = exports.toNonEnumTitle = exports.toPascalCase = exports.toTypeOrFieldTitle = exports.toTypeOrFieldNamePartTitle = exports.capitalizeFirstChar = exports.withOnlyDefinedGets = void 0;
7
+ const _1 = require("@fibery/helpers/src/_");
7
8
  const trace_1 = require("@fibery/helpers/utils/trace");
8
9
  const capitalize_1 = __importDefault(require("lodash/capitalize"));
9
10
  const flow_1 = __importDefault(require("lodash/flow"));
10
11
  const last_1 = __importDefault(require("lodash/last"));
11
- const memoize_1 = __importDefault(require("lodash/memoize"));
12
12
  const errors_1 = require("./errors");
13
13
  const print_utils_1 = require("./print-utils");
14
- const jestKey = new Set(["nodeType", "tagName", "hasAttribute"]);
14
+ const testRunnerKeys = new Set(["nodeType", "tagName", "hasAttribute"]);
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  const withOnlyDefinedGets = (target, targetKind = "object") => new Proxy(target, {
17
17
  get(target, key) {
@@ -36,7 +36,7 @@ const withOnlyDefinedGets = (target, targetKind = "object") => new Proxy(target,
36
36
  return undefined;
37
37
  }
38
38
  if (key === "inspect") {
39
- // greetings from jest console implementation
39
+ // greetings from vitest/node console implementation
40
40
  return undefined;
41
41
  }
42
42
  if (key === "@@toStringTag") {
@@ -48,8 +48,8 @@ const withOnlyDefinedGets = (target, targetKind = "object") => new Proxy(target,
48
48
  return undefined;
49
49
  }
50
50
  if (process.env.NODE_ENV === "test") {
51
- // greetings from jest
52
- if (typeof key === "string" && jestKey.has(key)) {
51
+ // greetings from vitest serializer
52
+ if (typeof key === "string" && testRunnerKeys.has(key)) {
53
53
  return undefined;
54
54
  }
55
55
  if (key === "@@__IMMUTABLE_ITERABLE__@@") {
@@ -62,7 +62,7 @@ const withOnlyDefinedGets = (target, targetKind = "object") => new Proxy(target,
62
62
  return undefined;
63
63
  }
64
64
  if (key === "asymmetricMatch") {
65
- // greetings from jest expect().toEqual
65
+ // greetings from vitest expect().toEqual
66
66
  return undefined;
67
67
  }
68
68
  if (key === "then") {
@@ -141,7 +141,7 @@ const splitKeyword = (keyword) => {
141
141
  name,
142
142
  };
143
143
  };
144
- exports.parseType = (0, memoize_1.default)((type) => {
144
+ exports.parseType = (0, _1.memoize)((type) => {
145
145
  if (!type.includes("/")) {
146
146
  (0, trace_1.traceError)(`parseType invalid usage: passed type is '${type}'`);
147
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/schema",
3
- "version": "10.2.16",
3
+ "version": "10.2.17",
4
4
  "private": false,
5
5
  "description": "Fibery schema utils",
6
6
  "files": [
@@ -9,8 +9,8 @@
9
9
  "main": "./lib/index.js",
10
10
  "exports": {
11
11
  ".": {
12
- "types": "./lib/index.d.ts",
13
12
  "@fibery/source": "./index.ts",
13
+ "types": "./lib/index.d.ts",
14
14
  "default": "./lib/index.js"
15
15
  }
16
16
  },
@@ -18,17 +18,13 @@
18
18
  "lodash": "4.17.21",
19
19
  "memoize-one": "6.0.0",
20
20
  "@fibery/pluralize": "1.1.2",
21
- "@fibery/helpers": "2.0.1"
21
+ "@fibery/helpers": "3.0.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@babel/core": "7.28.5",
25
- "@swc/jest": "0.2.39",
26
- "@types/jest": "30.0.0",
27
25
  "@types/lodash": "4.14.172",
28
- "@typescript/native-preview": "7.0.0-dev.20260401.1",
26
+ "@typescript/native-preview": "beta",
29
27
  "babel-loader": "10.0.0",
30
- "jest": "30.2.0",
31
- "jest-junit": "16.0.0",
32
28
  "typescript": "6.0.1-rc",
33
29
  "webpack": "5.87.0",
34
30
  "webpack-cli": "6.0.1",
@@ -36,9 +32,9 @@
36
32
  },
37
33
  "scripts": {
38
34
  "build": "rm -rf lib && tsc --project tsconfig.build.json",
39
- "test": "jest",
40
- "test:ci": "pnpm run test --reporters=default --reporters=jest-junit",
41
- "test:coverage": "pnpm run test --coverage --coverageDirectory=${JEST_COVERAGE_RESULT_DIR:-$(pwd)}/coverage/schema --reporters=default --reporters=jest-junit",
35
+ "test": "../../scripts/test.sh",
36
+ "test:ci": "../../scripts/test.sh --ci",
37
+ "test:coverage": "../../scripts/test.sh --ci --coverage",
42
38
  "check": "../../scripts/check.sh",
43
39
  "lint": "../../scripts/lint.sh",
44
40
  "typecheck": "../../scripts/typecheck.sh"
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /** @type {import('@jest/schemas').InitialOptions} */
3
- const config = {
4
- collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}", "!src/**/*.d.ts"],
5
- coveragePathIgnorePatterns: ["/node_modules/"],
6
- coverageReporters: ["text", "cobertura"],
7
- testEnvironment: "node",
8
- testEnvironmentOptions: {
9
- customExportConditions: ["@fibery/source"],
10
- url: "http://localhost",
11
- },
12
- testPathIgnorePatterns: ["<rootDir>[/\\\\](build|docs|node_modules|scripts)[/\\\\]"],
13
- transform: {
14
- "^.+\\.(js|jsx|ts|tsx)$": [
15
- "@swc/jest",
16
- {
17
- jsc: {
18
- parser: {
19
- syntax: "typescript",
20
- tsx: true,
21
- decorators: true,
22
- dynamicImport: true,
23
- },
24
- transform: {
25
- react: {
26
- runtime: "automatic",
27
- },
28
- },
29
- },
30
- },
31
- ],
32
- },
33
- };
34
- module.exports = config;
@@ -1,3 +0,0 @@
1
- export = config;
2
- /** @type {import('@jest/schemas').InitialOptions} */
3
- declare const config: any;