@aeriajs/core 0.0.163 → 0.0.164

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.
package/dist/assets.d.ts CHANGED
@@ -18,7 +18,7 @@ export declare const getCollectionAsset: <TCollectionName extends string, TAsset
18
18
  readonly error: undefined;
19
19
  readonly result: NonNullable<Collection[TAssetName]>;
20
20
  }>;
21
- export declare const getFunction: <TCollectionName extends string, TFunctionName extends string>(collectionName: TCollectionName, functionName: TFunctionName, token?: Token, options?: {
21
+ export declare const getFunction: <TFunction extends (payload: any, context: Context) => unknown>(collectionName: string, functionName: string, token?: Token, options?: {
22
22
  exposedOnly: boolean;
23
23
  }) => Promise<{
24
24
  readonly _tag: "Error";
@@ -39,5 +39,5 @@ export declare const getFunction: <TCollectionName extends string, TFunctionName
39
39
  } | {
40
40
  readonly _tag: "Result";
41
41
  readonly error: undefined;
42
- readonly result: (payload: unknown, context: Context) => Promise<any>;
42
+ readonly result: TFunction;
43
43
  }>;
@@ -15,9 +15,8 @@ const preferredRemove = async (targetId, reference, parentContext) => {
15
15
  collectionName: reference.referencedCollection,
16
16
  });
17
17
  if (Array.isArray(targetId)) {
18
- const { result } = await (0, assets_js_1.getFunction)(reference.referencedCollection, 'removeAll');
19
- if (result) {
20
- const removeAll = result;
18
+ const { result: removeAll } = await (0, assets_js_1.getFunction)(reference.referencedCollection, 'removeAll');
19
+ if (removeAll) {
21
20
  return removeAll({
22
21
  filters: targetId,
23
22
  }, context);
@@ -28,9 +27,8 @@ const preferredRemove = async (targetId, reference, parentContext) => {
28
27
  },
29
28
  });
30
29
  }
31
- const { result } = await (0, assets_js_1.getFunction)(reference.referencedCollection, 'remove');
32
- if (result) {
33
- const remove = result;
30
+ const { result: remove } = await (0, assets_js_1.getFunction)(reference.referencedCollection, 'remove');
31
+ if (remove) {
34
32
  return remove({
35
33
  filters: {
36
34
  _id: targetId,
@@ -13,9 +13,8 @@ const preferredRemove = async (targetId, reference, parentContext) => {
13
13
  collectionName: reference.referencedCollection
14
14
  });
15
15
  if (Array.isArray(targetId)) {
16
- const { result: result2 } = await getFunction(reference.referencedCollection, "removeAll");
17
- if (result2) {
18
- const removeAll = result2;
16
+ const { result: removeAll } = await getFunction(reference.referencedCollection, "removeAll");
17
+ if (removeAll) {
19
18
  return removeAll({
20
19
  filters: targetId
21
20
  }, context);
@@ -26,9 +25,8 @@ const preferredRemove = async (targetId, reference, parentContext) => {
26
25
  }
27
26
  });
28
27
  }
29
- const { result } = await getFunction(reference.referencedCollection, "remove");
30
- if (result) {
31
- const remove = result;
28
+ const { result: remove } = await getFunction(reference.referencedCollection, "remove");
29
+ if (remove) {
32
30
  return remove({
33
31
  filters: {
34
32
  _id: targetId
@@ -5,7 +5,7 @@ const prepareCreate = (doc, description) => {
5
5
  const result = Object.assign({}, description.defaults || {});
6
6
  for (const propName in doc) {
7
7
  const value = doc[propName];
8
- if (value === null || value === undefined) {
8
+ if (value === undefined) {
9
9
  continue;
10
10
  }
11
11
  result[propName] = value;
@@ -19,7 +19,7 @@ const prepareUpdate = (doc) => {
19
19
  };
20
20
  for (const propName in doc) {
21
21
  const value = doc[propName];
22
- if (value === null || value === undefined) {
22
+ if (value === undefined) {
23
23
  result.$unset[propName] = value;
24
24
  continue;
25
25
  }
@@ -3,7 +3,7 @@ const prepareCreate = (doc, description) => {
3
3
  const result = Object.assign({}, description.defaults || {});
4
4
  for (const propName in doc) {
5
5
  const value = doc[propName];
6
- if (value === null || value === void 0) {
6
+ if (value === void 0) {
7
7
  continue;
8
8
  }
9
9
  result[propName] = value;
@@ -17,7 +17,7 @@ const prepareUpdate = (doc) => {
17
17
  };
18
18
  for (const propName in doc) {
19
19
  const value = doc[propName];
20
- if (value === null || value === void 0) {
20
+ if (value === void 0) {
21
21
  result.$unset[propName] = value;
22
22
  continue;
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/core",
3
- "version": "0.0.163",
3
+ "version": "0.0.164",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "aeriaMain": "tests/fixtures/aeriaMain.js",
@@ -42,13 +42,13 @@
42
42
  "mongodb-memory-server": "^9.2.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@aeriajs/builtins": "^0.0.163",
46
- "@aeriajs/common": "^0.0.99",
47
- "@aeriajs/entrypoint": "^0.0.101",
48
- "@aeriajs/http": "^0.0.112",
49
- "@aeriajs/security": "^0.0.163",
50
- "@aeriajs/types": "^0.0.85",
51
- "@aeriajs/validation": "^0.0.102"
45
+ "@aeriajs/builtins": "^0.0.164",
46
+ "@aeriajs/common": "^0.0.100",
47
+ "@aeriajs/entrypoint": "^0.0.102",
48
+ "@aeriajs/http": "^0.0.113",
49
+ "@aeriajs/security": "^0.0.164",
50
+ "@aeriajs/types": "^0.0.86",
51
+ "@aeriajs/validation": "^0.0.103"
52
52
  },
53
53
  "dependencies": {
54
54
  "mongodb": "^6.5.0",