@fibery/schema 10.3.0 → 10.3.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,6 +1,15 @@
1
1
  import { TypeObject } from "./type-object.js";
2
2
  //#region src/field-object.d.ts
3
3
  type Cardinality = ":cardinality/one-to-one" | ":cardinality/one-to-many" | ":cardinality/many-to-many" | ":cardinality/many-to-one";
4
+ type LinkRuleOperand = {
5
+ expression: unknown;
6
+ relationExpression: unknown;
7
+ operator: string;
8
+ };
9
+ type LinkRule = {
10
+ logicalOperator: string;
11
+ operands: Array<LinkRuleOperand>;
12
+ };
4
13
  type RawFieldObject = {
5
14
  "fibery/id": string;
6
15
  "fibery/name": string;
@@ -19,7 +28,7 @@ type RawFieldObject = {
19
28
  "formula/formula"?: unknown;
20
29
  "formula/lookup?"?: boolean;
21
30
  "link-rule/link-rule?"?: boolean;
22
- "link-rule/link-rule"?: unknown;
31
+ "link-rule/link-rule"?: LinkRule;
23
32
  "link-rule/disabled?"?: boolean;
24
33
  "link-rule/disable-reason"?: string;
25
34
  "fibery/relation"?: string;
@@ -58,7 +67,7 @@ declare class FieldObject {
58
67
  formula: unknown | null;
59
68
  isLookup: boolean;
60
69
  hasLinkRule: boolean;
61
- linkRule: unknown | null;
70
+ linkRule: LinkRule | null;
62
71
  isLinkRuleDisabled: boolean;
63
72
  linkRuleDisableReason: string | null;
64
73
  relation: string | null;
@@ -89,4 +98,4 @@ declare class FieldObject {
89
98
  get kind(): ":field/basic" | ":field/reference" | ":field/reference-collection";
90
99
  }
91
100
  //#endregion
92
- export { Cardinality, FieldObject, FieldObjectParams, RawFieldObject };
101
+ export { Cardinality, FieldObject, FieldObjectParams, LinkRule, LinkRuleOperand, RawFieldObject };
@@ -163,9 +163,10 @@ var FieldObject = class {
163
163
  }
164
164
  /** @deprecated use !typeObject.isPrimitive && cardinality === ... instead */
165
165
  get kind() {
166
- if (this.typeObject.isPrimitive) if (this.isCollection) throw new Error("basic collection is not implemented");
167
- else return ":field/basic";
168
- else if (this.isCollection) return ":field/reference-collection";
166
+ if (this.typeObject.isPrimitive) {
167
+ if (this.isCollection) throw new Error("basic collection is not implemented");
168
+ else return ":field/basic";
169
+ } else if (this.isCollection) return ":field/reference-collection";
169
170
  else return ":field/reference";
170
171
  }
171
172
  };
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { RawTypeObject, SyncSource, TypeObject, TypeObjectParams } from "./src/type-object.js";
2
- import { Cardinality, FieldObject, FieldObjectParams, RawFieldObject } from "./src/field-object.js";
3
- import { RawSchema, Schema } from "./src/schema.js";
4
- import { Factory, factory, protectiveFactory } from "./src/factory.js";
5
- import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./src/utils.js";
6
- import { NotDefinedGetError } from "./src/errors.js";
7
- export { Cardinality, Factory, FieldObject, FieldObjectParams, NotDefinedGetError, RawFieldObject, RawSchema, RawTypeObject, Schema, SyncSource, TypeObject, TypeObjectParams, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
1
+ import { NotDefinedGetError } from "./errors.js";
2
+ import { RawTypeObject, SyncSource, TypeObject, TypeObjectParams } from "./type-object.js";
3
+ import { Cardinality, FieldObject, FieldObjectParams, LinkRule, LinkRuleOperand, RawFieldObject } from "./field-object.js";
4
+ import { RawSchema, Schema } from "./schema.js";
5
+ 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, RawFieldObject, RawSchema, RawTypeObject, Schema, SyncSource, TypeObject, TypeObjectParams, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { NotDefinedGetError } from "./src/errors.js";
2
- import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./src/utils.js";
3
- import { FieldObject } from "./src/field-object.js";
4
- import { Schema } from "./src/schema.js";
5
- import { TypeObject } from "./src/type-object.js";
6
- import { factory, protectiveFactory } from "./src/factory.js";
1
+ import { NotDefinedGetError } from "./errors.js";
2
+ import { attachEnumNamespace, capitalizeFirstChar, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets } from "./utils.js";
3
+ import { FieldObject } from "./field-object.js";
4
+ import { Schema } from "./schema.js";
5
+ import { TypeObject } from "./type-object.js";
6
+ import { factory, protectiveFactory } from "./factory.js";
7
7
  export { FieldObject, NotDefinedGetError, Schema, TypeObject, attachEnumNamespace, capitalizeFirstChar, factory, getTypeObjectTitle, makeEnumTypeNamePart, parseEnumType, parseType, protectiveFactory, removeDeletedTypesAndFields, toNonEnumTitle, toPascalCase, toTitle, toTypeOrFieldNamePartTitle, toTypeOrFieldTitle, withOnlyDefinedGets };
@@ -15,13 +15,10 @@ declare const parseEnumType: (type: string) => {
15
15
  targetNamespace: string;
16
16
  };
17
17
  declare const toTitle: (typeOrAttr: string) => string;
18
- declare const parseType: ((arg: string) => {
18
+ declare const parseType: (type: string) => {
19
19
  namespace: string;
20
20
  name: string;
21
- }) & import("@fibery/helpers/src/_").MemoizedFunction<string, {
22
- namespace: string;
23
- name: string;
24
- }>;
21
+ };
25
22
  declare const makeEnumTypeNamePart: ({ holderType, enumName }: {
26
23
  holderType: string;
27
24
  enumName: string;
@@ -1,6 +1,5 @@
1
1
  import { NotDefinedGetError } from "./errors.js";
2
2
  import { printJsPath } from "./print-utils.js";
3
- import { memoize } from "@fibery/helpers/src/_";
4
3
  import { traceError } from "@fibery/helpers/utils/trace";
5
4
  import capitalize from "lodash/capitalize.js";
6
5
  import flow from "lodash/flow.js";
@@ -88,10 +87,10 @@ const splitKeyword = (keyword) => {
88
87
  name: str.substring(index + 1)
89
88
  };
90
89
  };
91
- const parseType = memoize((type) => {
90
+ const parseType = (type) => {
92
91
  if (!type.includes("/")) traceError(`parseType invalid usage: passed type is '${type}'`);
93
92
  return splitKeyword(type);
94
- });
93
+ };
95
94
  const makeEnumTypeNamePart = ({ holderType, enumName }) => {
96
95
  const { namespace, name } = parseType(holderType);
97
96
  return `${enumName}_${namespace}/${name}`;
package/package.json CHANGED
@@ -1,45 +1,28 @@
1
1
  {
2
2
  "name": "@fibery/schema",
3
- "version": "10.3.0",
4
- "private": false,
3
+ "version": "10.3.2",
5
4
  "description": "Fibery schema utils",
5
+ "license": "UNLICENSED",
6
6
  "files": [
7
- "./lib"
7
+ "lib"
8
8
  ],
9
9
  "type": "module",
10
+ "sideEffects": false,
10
11
  "main": "./lib/index.js",
12
+ "types": "./lib/index.d.ts",
11
13
  "exports": {
12
14
  ".": {
13
- "@fibery/source": "./index.ts",
14
15
  "types": "./lib/index.d.ts",
15
16
  "default": "./lib/index.js"
17
+ },
18
+ "./src/*": {
19
+ "types": "./lib/*.d.ts",
20
+ "default": "./lib/*.js"
16
21
  }
17
22
  },
18
23
  "dependencies": {
19
24
  "lodash": "4.17.21",
20
- "memoize-one": "6.0.0",
21
- "@fibery/pluralize": "1.2.0",
22
- "@fibery/helpers": "3.2.0"
23
- },
24
- "devDependencies": {
25
- "@types/lodash": "4.14.172",
26
- "tsdown": "0.22.7",
27
- "typescript": "rc"
28
- },
29
- "size-limit": [
30
- {
31
- "path": "lib/**/*.js",
32
- "limit": "7 kB"
33
- }
34
- ],
35
- "scripts": {
36
- "build": "pnpm run typecheck && tsdown",
37
- "test": "../../scripts/test.sh",
38
- "test:ci": "../../scripts/test.sh --ci",
39
- "test:coverage": "../../scripts/test.sh --ci --coverage",
40
- "lint": "pnpm -w lint .",
41
- "typecheck": "../../scripts/typecheck.sh",
42
- "check": "../../scripts/check.sh"
43
- },
44
- "types": "./lib/index.d.ts"
25
+ "@fibery/pluralize": "1.2.1",
26
+ "@fibery/helpers": "3.3.0"
27
+ }
45
28
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes