@lowdefy/operators-mql 4.0.0-rc.8 → 4.0.0

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,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -15,23 +15,7 @@
15
15
  */ import mingo from 'mingo';
16
16
  import { get, type } from '@lowdefy/helpers';
17
17
  import { runClass } from '@lowdefy/operators';
18
- // TODO: fix build to work with:
19
- // import 'mingo/init/system';
20
- import { useOperators, OperatorType } from 'mingo/core.js';
21
- import * as accumulatorOperators from 'mingo/operators/accumulator/index.js';
22
- import * as expressionOperators from 'mingo/operators/expression/index.js';
23
- import * as pipelineOperators from 'mingo/operators/pipeline/index.js';
24
- import * as queryOperators from 'mingo/operators/query/index.js';
25
- import * as projectionOperators from 'mingo/operators/projection/index.js';
26
- // "import * as" is returning different object structures when the connection is being
27
- // imported in the build or when running the tests.
28
- // So we check for the a default object with all the named exports, otherwise the
29
- // returned object has all the named exports.
30
- useOperators(OperatorType.ACCUMULATOR, accumulatorOperators.default || accumulatorOperators);
31
- useOperators(OperatorType.EXPRESSION, expressionOperators.default || expressionOperators);
32
- useOperators(OperatorType.PIPELINE, pipelineOperators.default || pipelineOperators);
33
- useOperators(OperatorType.QUERY, queryOperators.default || queryOperators);
34
- useOperators(OperatorType.PROJECTION, projectionOperators.default || projectionOperators);
18
+ import 'mingo/init/system';
35
19
  function aggregate(data, pipeline) {
36
20
  if (data === null) {
37
21
  data = [];
@@ -45,7 +29,7 @@ function aggregate(data, pipeline) {
45
29
  const agg = new mingo.Aggregator(pipeline);
46
30
  return agg.run(data);
47
31
  }
48
- function expr(data, expr) {
32
+ function expr(data, expression) {
49
33
  if (data === null) {
50
34
  data = {};
51
35
  }
@@ -55,7 +39,7 @@ function expr(data, expr) {
55
39
  const agg = new mingo.Aggregator([
56
40
  {
57
41
  $project: {
58
- value: expr
42
+ value: expression
59
43
  }
60
44
  }
61
45
  ]);
@@ -66,17 +50,17 @@ function expr(data, expr) {
66
50
  default: null
67
51
  });
68
52
  }
69
- function test(data, test) {
53
+ function test(data, testQuery) {
70
54
  if (data === null) {
71
55
  data = {};
72
56
  }
73
57
  if (!type.isObject(data)) {
74
58
  throw new Error('Data must be of type object.');
75
59
  }
76
- if (!type.isObject(test)) {
60
+ if (!type.isObject(testQuery)) {
77
61
  throw new Error('Query test must be of type object.');
78
62
  }
79
- const query = new mingo.Query(test);
63
+ const query = new mingo.Query(testQuery);
80
64
  return query.test(data);
81
65
  }
82
66
  const meta = {
@@ -116,7 +100,7 @@ const functions = {
116
100
  expr,
117
101
  test
118
102
  };
119
- function mql({ params , location , methodName }) {
103
+ function mql({ params, location, methodName }) {
120
104
  return runClass({
121
105
  functions,
122
106
  location,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/operators-mql",
3
- "version": "4.0.0-rc.8",
3
+ "version": "4.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -35,26 +35,24 @@
35
35
  "files": [
36
36
  "dist/*"
37
37
  ],
38
- "scripts": {
39
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
40
- "clean": "rm -rf dist",
41
- "prepublishOnly": "pnpm build",
42
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
43
- },
44
38
  "dependencies": {
45
- "@lowdefy/helpers": "4.0.0-rc.8",
46
- "@lowdefy/operators": "4.0.0-rc.8",
47
- "mingo": "6.2.1"
39
+ "@lowdefy/helpers": "4.0.0",
40
+ "@lowdefy/operators": "4.0.0",
41
+ "mingo": "6.4.9"
48
42
  },
49
43
  "devDependencies": {
50
- "@swc/cli": "0.1.59",
51
- "@swc/core": "1.3.24",
52
- "@swc/jest": "0.2.24",
53
- "jest": "28.1.0",
54
- "jest-environment-jsdom": "28.1.0"
44
+ "@swc/cli": "0.1.63",
45
+ "@swc/core": "1.3.99",
46
+ "@swc/jest": "0.2.29",
47
+ "jest": "28.1.3",
48
+ "jest-environment-jsdom": "28.1.3"
55
49
  },
56
50
  "publishConfig": {
57
51
  "access": "public"
58
52
  },
59
- "gitHead": "db883daef0443647439b6fe2db845b846ffb6d4e"
60
- }
53
+ "scripts": {
54
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
55
+ "clean": "rm -rf dist",
56
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
57
+ }
58
+ }