@fibery/expression-utils 10.0.0 → 10.0.1

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.
Files changed (35) hide show
  1. package/lib/{src/context-variables.js → context-variables.js} +1 -1
  2. package/lib/{src/filter-expression → filter-expression}/operators.js +2 -2
  3. package/lib/index.d.ts +8 -8
  4. package/lib/index.js +8 -8
  5. package/lib/{src/params-placeholders.js → params-placeholders.js} +1 -1
  6. package/lib/{src/utils.js → utils.js} +2 -2
  7. package/lib/{src/visitors.js → visitors.js} +1 -1
  8. package/package.json +12 -38
  9. package/lib/test-data/schema-mock.d.ts +0 -73
  10. package/lib/test-data/schema-mock.js +0 -175
  11. /package/lib/{src/context-variables.d.ts → context-variables.d.ts} +0 -0
  12. /package/lib/{src/errors.d.ts → errors.d.ts} +0 -0
  13. /package/lib/{src/errors.js → errors.js} +0 -0
  14. /package/lib/{src/field-expression-visitor-type-aware.d.ts → field-expression-visitor-type-aware.d.ts} +0 -0
  15. /package/lib/{src/field-expression-visitor-type-aware.js → field-expression-visitor-type-aware.js} +0 -0
  16. /package/lib/{src/filter-expression → filter-expression}/index.d.ts +0 -0
  17. /package/lib/{src/filter-expression → filter-expression}/index.js +0 -0
  18. /package/lib/{src/filter-expression → filter-expression}/operator-utils.d.ts +0 -0
  19. /package/lib/{src/filter-expression → filter-expression}/operator-utils.js +0 -0
  20. /package/lib/{src/filter-expression → filter-expression}/operators.d.ts +0 -0
  21. /package/lib/{src/filter-expression → filter-expression}/pattern-match-placeholders.d.ts +0 -0
  22. /package/lib/{src/filter-expression → filter-expression}/pattern-match-placeholders.js +0 -0
  23. /package/lib/{src/filter-expression → filter-expression}/pattern-match.d.ts +0 -0
  24. /package/lib/{src/filter-expression → filter-expression}/pattern-match.js +0 -0
  25. /package/lib/{src/filter-expression → filter-expression}/pattern-to-expression.d.ts +0 -0
  26. /package/lib/{src/filter-expression → filter-expression}/pattern-to-expression.js +0 -0
  27. /package/lib/{src/filter-expression → filter-expression}/types.d.ts +0 -0
  28. /package/lib/{src/filter-expression → filter-expression}/types.js +0 -0
  29. /package/lib/{src/params-placeholders.d.ts → params-placeholders.d.ts} +0 -0
  30. /package/lib/{src/tsfixme.d.ts → tsfixme.d.ts} +0 -0
  31. /package/lib/{src/tsfixme.js → tsfixme.js} +0 -0
  32. /package/lib/{src/types.d.ts → types.d.ts} +0 -0
  33. /package/lib/{src/types.js → types.js} +0 -0
  34. /package/lib/{src/utils.d.ts → utils.d.ts} +0 -0
  35. /package/lib/{src/visitors.d.ts → visitors.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import flatten from "lodash/flatten.js";
3
3
  import groupBy from "lodash/groupBy.js";
4
4
  import uniqBy from "lodash/uniqBy.js";
@@ -1,14 +1,14 @@
1
- import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { doPatternMatch } from "./pattern-match.js";
3
3
  import { dateToDateTimeIntervalLookup, isDynamicFilterParam, paramsPlaceholdersLookup, parseRelativeDatePlaceholder, toRelativeDatePlaceholder } from "../params-placeholders.js";
4
4
  import { anyDateExpressionPlaceholder, boolFieldPlaceholder, collectionCountExpressionPlaceholder, dateOrDateRangeExpressionPlaceholder, dateTimeOrDateTimeRangeExpressionPlaceholder, getConstantPlaceholder, getParamPlaceholder, locationFieldPlaceholder, numberFieldPlaceholder, referenceCollectionExpressionPlaceholder, referenceCollectionFieldPlaceholder, referenceExpressionPlaceholder, textFieldPlaceholder } from "./pattern-match-placeholders.js";
5
5
  import { getCompareOperatorForDateTime, getWithinOperatorCustomConvertFn, getWithinOperatorCustomMatchFn, isDateTime, isNoValue } from "./operator-utils.js";
6
6
  import { convertToExpression } from "./pattern-to-expression.js";
7
7
  import flatten from "lodash/flatten.js";
8
- import { validate } from "uuid";
9
8
  import { mapValues } from "@fibery/helpers/src/_";
10
9
  import isString from "lodash/isString.js";
11
10
  import last from "lodash/last.js";
11
+ import { validate } from "uuid";
12
12
  import findKey from "lodash/findKey.js";
13
13
  import isEqual from "lodash/isEqual.js";
14
14
  import uniq from "lodash/uniq.js";
package/lib/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { ContextVariable, context_variables_d_exports } from "./src/context-variables.js";
2
- import { Expression, ExpressionVisitor, ExpressionVisitorWithDefault, FieldExpression, FromRootExpression, FunctionCallExpression, MultiFieldAccess, OrderBy, Query, Select, SubQuery } from "./src/types.js";
3
- import { ExpressionToFilterBy, Operator } from "./src/filter-expression/types.js";
4
- import { operators_d_exports } from "./src/filter-expression/operators.js";
5
- import { params_placeholders_d_exports } from "./src/params-placeholders.js";
6
- import { utils_d_exports } from "./src/utils.js";
7
- import { visitors_d_exports } from "./src/visitors.js";
1
+ import { ContextVariable, context_variables_d_exports } from "./context-variables.js";
2
+ import { Expression, ExpressionVisitor, ExpressionVisitorWithDefault, FieldExpression, FromRootExpression, FunctionCallExpression, MultiFieldAccess, OrderBy, Query, Select, SubQuery } from "./types.js";
3
+ import { ExpressionToFilterBy, Operator } from "./filter-expression/types.js";
4
+ import { operators_d_exports } from "./filter-expression/operators.js";
5
+ import { params_placeholders_d_exports } from "./params-placeholders.js";
6
+ import { utils_d_exports } from "./utils.js";
7
+ import { visitors_d_exports } from "./visitors.js";
8
8
  import "./index.js";
9
- //#region index.d.ts
9
+ //#region src/index.d.ts
10
10
  declare const filterExpression: {
11
11
  findMatchedFilter: (filterExpression: Expression, params: Record<string, unknown>, operators: Array<Operator>, schema: import("@fibery/schema").Schema | null, type: string) => {
12
12
  operator: Operator;
package/lib/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { context_variables_exports } from "./src/context-variables.js";
2
- import { utils_exports } from "./src/utils.js";
3
- import { findMatchedFilter } from "./src/filter-expression/index.js";
4
- import { params_placeholders_exports } from "./src/params-placeholders.js";
5
- import { convertToExpression } from "./src/filter-expression/pattern-to-expression.js";
6
- import { operators_exports } from "./src/filter-expression/operators.js";
7
- import { visitors_exports } from "./src/visitors.js";
8
- //#region index.ts
1
+ import { context_variables_exports } from "./context-variables.js";
2
+ import { utils_exports } from "./utils.js";
3
+ import { findMatchedFilter } from "./filter-expression/index.js";
4
+ import { params_placeholders_exports } from "./params-placeholders.js";
5
+ import { convertToExpression } from "./filter-expression/pattern-to-expression.js";
6
+ import { operators_exports } from "./filter-expression/operators.js";
7
+ import { visitors_exports } from "./visitors.js";
8
+ //#region src/index.ts
9
9
  const filterExpression = {
10
10
  findMatchedFilter,
11
11
  operators: operators_exports,
@@ -1,4 +1,4 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { mapValues } from "@fibery/helpers/src/_";
3
3
  import isString from "lodash/isString.js";
4
4
  import moment from "moment";
@@ -1,10 +1,10 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { NotImplementedError } from "./errors.js";
3
3
  import uniqBy from "lodash/uniqBy.js";
4
4
  import { isRecord, mapValues } from "@fibery/helpers/src/_";
5
5
  import isPlainObject from "lodash/isPlainObject.js";
6
- import isString from "lodash/isString.js";
7
6
  import { assert } from "@fibery/helpers/utils/trace";
7
+ import isString from "lodash/isString.js";
8
8
  import last from "lodash/last.js";
9
9
  //#region src/utils.ts
10
10
  var utils_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,4 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { createExpressionVisitor, firstLastFunctions, isCollectionFunctionExpression, isMultiFieldAccess, logicalOperators } from "./utils.js";
3
3
  import { fieldAccessVisitorTypeAware } from "./field-expression-visitor-type-aware.js";
4
4
  import { mapValues } from "@fibery/helpers/src/_";
package/package.json CHANGED
@@ -1,62 +1,36 @@
1
1
  {
2
2
  "name": "@fibery/expression-utils",
3
- "version": "10.0.0",
4
- "private": false,
3
+ "version": "10.0.1",
5
4
  "description": "utils for working with fibery api expressions",
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"
16
17
  },
17
18
  "./src/*": {
18
- "@fibery/source": {
19
- "types": "./src/*.ts",
20
- "default": "./src/*"
21
- },
22
- "types": "./lib/src/*.d.ts",
23
- "default": "./lib/src/*.js"
19
+ "types": "./lib/*.d.ts",
20
+ "default": "./lib/*.js"
24
21
  },
25
22
  "./src/filter-expression": {
26
- "@fibery/source": "./src/filter-expression/index.ts",
27
- "types": "./lib/src/filter-expression/index.d.ts",
28
- "default": "./lib/src/filter-expression/index.js"
23
+ "types": "./lib/filter-expression/index.d.ts",
24
+ "default": "./lib/filter-expression/index.js"
29
25
  }
30
26
  },
31
27
  "dependencies": {
32
28
  "lodash": "4.17.21",
33
29
  "moment": "2.29.4",
34
30
  "uuid": "11.1.0",
35
- "@fibery/helpers": "3.2.0"
36
- },
37
- "devDependencies": {
38
- "@types/lodash": "4.14.172",
39
- "tsdown": "0.22.7",
40
- "typescript": "rc",
41
- "@fibery/schema": "10.3.0"
31
+ "@fibery/helpers": "3.2.1"
42
32
  },
43
33
  "peerDependencies": {
44
- "@fibery/schema": "10.3.0"
45
- },
46
- "size-limit": [
47
- {
48
- "path": "lib/**/*.js",
49
- "limit": "22 kB"
50
- }
51
- ],
52
- "scripts": {
53
- "build": "pnpm run typecheck && tsdown",
54
- "test": "../../scripts/test.sh",
55
- "test:ci": "../../scripts/test.sh --ci",
56
- "test:coverage": "../../scripts/test.sh --ci --coverage",
57
- "lint": "pnpm -w lint .",
58
- "typecheck": "../../scripts/typecheck.sh",
59
- "check": "../../scripts/check.sh"
60
- },
61
- "types": "./lib/index.d.ts"
34
+ "@fibery/schema": "10.3.1"
35
+ }
62
36
  }
@@ -1,73 +0,0 @@
1
- import { FieldObject, TypeObject } from "@fibery/schema";
2
- //#region test-data/schema-mock.d.ts
3
- declare const functionsMeta: {
4
- "q/start": {
5
- overloads: {
6
- "arg-types": string[];
7
- "result-type": string;
8
- }[];
9
- };
10
- "q/end": {
11
- overloads: {
12
- "arg-types": string[];
13
- "result-type": string;
14
- }[];
15
- };
16
- "q/count": {
17
- overloads: {
18
- "arg-types": string[];
19
- "result-type": string;
20
- }[];
21
- };
22
- "q/join": {
23
- overloads: {
24
- "arg-types": string[];
25
- "result-type": string;
26
- }[];
27
- };
28
- "q/first": {
29
- overloads: {
30
- "arg-types": string[];
31
- "result-type": string;
32
- }[];
33
- };
34
- "q/if": {
35
- overloads: {
36
- "arg-types": string[];
37
- "result-type": string;
38
- }[];
39
- };
40
- "q/if-null": {
41
- overloads: {
42
- "arg-types": string[];
43
- "result-type": string;
44
- }[];
45
- };
46
- ">": {
47
- overloads: {
48
- "arg-types": string[];
49
- "result-type": string;
50
- }[];
51
- };
52
- };
53
- declare const featureTypeObject: TypeObject;
54
- declare const epicTypeObject: TypeObject;
55
- declare const taskIdFieldObject: FieldObject;
56
- declare const taskTypeObject: TypeObject;
57
- declare const tasksCollectionFieldObject: FieldObject;
58
- declare const storyStateIdFieldObject: FieldObject;
59
- declare const storyStateFieldObject: FieldObject;
60
- declare const storyDateFieldObject: FieldObject;
61
- declare const storyDateTimeFieldObject: FieldObject;
62
- declare const multiRelatedFieldObject: FieldObject & {
63
- id: string;
64
- type: string;
65
- holderType: string;
66
- name: string;
67
- typeObject?: TypeObject;
68
- holderTypeObject?: TypeObject;
69
- };
70
- declare const multiRefTypeObject: TypeObject;
71
- declare const storyTypeObject: TypeObject;
72
- //#endregion
73
- export { epicTypeObject, featureTypeObject, functionsMeta, multiRefTypeObject, multiRelatedFieldObject, storyDateFieldObject, storyDateTimeFieldObject, storyStateFieldObject, storyStateIdFieldObject, storyTypeObject, taskIdFieldObject, taskTypeObject, tasksCollectionFieldObject };
@@ -1,175 +0,0 @@
1
- //#region test-data/schema-mock.ts
2
- const fieldObjectFixture = (fieldObject) => fieldObject;
3
- const typeObjectFixture = (typeObject) => typeObject;
4
- const functionsMeta = {
5
- "q/start": { overloads: [{
6
- "arg-types": ["fibery/date-range"],
7
- "result-type": "fibery/date"
8
- }] },
9
- "q/end": { overloads: [{
10
- "arg-types": ["fibery/date-range"],
11
- "result-type": "fibery/date"
12
- }] },
13
- "q/count": { overloads: [{
14
- "arg-types": ["fibery/uuid"],
15
- "result-type": "fibery/int"
16
- }] },
17
- "q/join": { overloads: [{
18
- "arg-types": ["fibery/text", "fibery/text"],
19
- "result-type": "fibery/text"
20
- }] },
21
- "q/first": { overloads: [{
22
- "arg-types": ["fibery/uuid"],
23
- "result-type": "fibery/uuid"
24
- }] },
25
- "q/if": { overloads: [{
26
- "arg-types": [
27
- "fibery/bool",
28
- "fibery/uuid",
29
- "fibery/uuid"
30
- ],
31
- "result-type": "fibery/uuid"
32
- }] },
33
- "q/if-null": { overloads: [{
34
- "arg-types": ["fibery/uuid", "fibery/uuid"],
35
- "result-type": "fibery/uuid"
36
- }, {
37
- "arg-types": ["fibery/date-time", "fibery/date"],
38
- "result-type": "fibery/date-time"
39
- }] },
40
- ">": { overloads: [{
41
- "arg-types": ["fibery/int", "fibery/int"],
42
- "result-type": "fibery/bool"
43
- }] }
44
- };
45
- const featureNameField = fieldObjectFixture({
46
- id: "nameFieldId",
47
- name: "nameFieldName",
48
- typeObject: { name: "fibery/text" }
49
- });
50
- const featureTypeObject = typeObjectFixture({
51
- name: "kanban/feature",
52
- fieldObjects: [featureNameField],
53
- fieldObjectsById: { [featureNameField.id]: featureNameField },
54
- fieldObjectsByName: { [featureNameField.name]: featureNameField }
55
- });
56
- const featureField = fieldObjectFixture({
57
- id: "featureFieldId",
58
- name: "featureFieldName",
59
- type: "kanban/feature",
60
- typeObject: featureTypeObject
61
- });
62
- const epicTypeObject = typeObjectFixture({
63
- name: "SoftDev/Epic",
64
- fieldObjects: [featureField],
65
- fieldObjectsById: { [featureField.id]: featureField },
66
- fieldObjectsByName: { [featureField.name]: featureField }
67
- });
68
- const taskIdFieldObject = fieldObjectFixture({
69
- id: "taskIdFieldId",
70
- type: "fibery/id",
71
- name: "taskIdFieldName",
72
- isId: true,
73
- typeObject: { name: "fibery/uuid" }
74
- });
75
- const taskTypeObject = typeObjectFixture({
76
- name: "SoftDev/Task",
77
- fieldObjects: [taskIdFieldObject],
78
- fieldObjectsById: { taskIdFieldId: taskIdFieldObject },
79
- fieldObjectsByName: { taskIdFieldName: taskIdFieldObject }
80
- });
81
- const tasksCollectionFieldObject = fieldObjectFixture({
82
- id: "someCollectionFieldId",
83
- type: "SoftDev/Task",
84
- typeObject: taskTypeObject,
85
- name: "someCollectionFieldName"
86
- });
87
- const storyStateIdFieldObject = fieldObjectFixture({
88
- id: "storyStateIdFieldId",
89
- type: "fibery/id",
90
- name: "Id",
91
- isId: true,
92
- typeObject: { name: "fibery/uuid" }
93
- });
94
- const storyStateFieldObject = fieldObjectFixture({
95
- id: "storyStateFieldId",
96
- type: "SofDev/StoryState",
97
- typeObject: typeObjectFixture({
98
- name: "SoftDev/StoryState",
99
- fieldObjects: [storyStateIdFieldObject],
100
- fieldObjectsById: { storyStateIdFieldId: storyStateIdFieldObject },
101
- fieldObjectsByName: { Id: storyStateIdFieldObject }
102
- }),
103
- name: "State"
104
- });
105
- const storyDateFieldObject = fieldObjectFixture({
106
- id: "storyDateFieldId",
107
- type: "fibery/date",
108
- typeObject: { name: "fibery/date" },
109
- name: "Date"
110
- });
111
- const storyDateTimeFieldObject = fieldObjectFixture({
112
- id: "storyDateTimeFieldId",
113
- type: "fibery/date-time",
114
- typeObject: { name: "fibery/date-time" },
115
- name: "DateTime"
116
- });
117
- const multiRelatedFieldObject = fieldObjectFixture({
118
- id: "MultiRefFieldId1",
119
- type: "SoftDev/Story",
120
- holderType: "SoftDev/SomeMultiRef1",
121
- name: "Stories"
122
- });
123
- const multiRefTypeIdFieldObject = fieldObjectFixture({
124
- id: "multiRefTypeIdFieldId",
125
- type: "fibery/id",
126
- name: "Id",
127
- isId: true,
128
- typeObject: { name: "fibery/uuid" }
129
- });
130
- const multiRefTypeObject = typeObjectFixture({
131
- id: "multiRefTypeId1",
132
- name: "SoftDev/SomeMultiRef1",
133
- fieldObjects: [multiRefTypeIdFieldObject, multiRelatedFieldObject],
134
- fieldObjectsById: {
135
- multiFieldObjectId: multiRelatedFieldObject,
136
- multiRefTypeIdFieldId: multiRefTypeIdFieldObject
137
- },
138
- fieldObjectsByName: {
139
- MultiFieldName: multiRelatedFieldObject,
140
- Id: multiRefTypeIdFieldObject
141
- }
142
- });
143
- const multiFieldObject = fieldObjectFixture({
144
- id: "multiFieldObjectId",
145
- type: "fibery/entity-ref",
146
- typeObject: { isEntityRef: true },
147
- multiRelatedFieldObjects: [multiRelatedFieldObject],
148
- name: "MultiFieldName"
149
- });
150
- const storyTypeObject = typeObjectFixture({
151
- name: "SoftDev/Story",
152
- fieldObjects: [
153
- tasksCollectionFieldObject,
154
- storyStateFieldObject,
155
- multiFieldObject
156
- ],
157
- fieldObjectsById: {
158
- storyDateFieldId: storyDateFieldObject,
159
- storyDateTimeFieldId: storyDateTimeFieldObject,
160
- someCollectionFieldId: tasksCollectionFieldObject,
161
- storyStateFieldId: storyStateFieldObject,
162
- multiFieldObjectId: multiFieldObject
163
- },
164
- fieldObjectsByName: {
165
- Date: storyDateFieldObject,
166
- DateTime: storyDateTimeFieldObject,
167
- someCollectionFieldName: tasksCollectionFieldObject,
168
- State: storyStateFieldObject,
169
- MultiFieldName: multiFieldObject
170
- }
171
- });
172
- multiRelatedFieldObject.typeObject = storyTypeObject;
173
- multiRelatedFieldObject.holderTypeObject = multiRefTypeObject;
174
- //#endregion
175
- export { epicTypeObject, featureTypeObject, functionsMeta, multiRefTypeObject, multiRelatedFieldObject, storyDateFieldObject, storyDateTimeFieldObject, storyStateFieldObject, storyStateIdFieldObject, storyTypeObject, taskIdFieldObject, taskTypeObject, tasksCollectionFieldObject };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes