@aeriajs/core 0.0.172 → 0.0.173

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,3 +1,3 @@
1
1
  import type { Description } from '@aeriajs/types';
2
2
  export declare const prepareCreate: (doc: Record<string, unknown>, description: Description) => Record<string, unknown>;
3
- export declare const prepareUpdate: (doc: Record<string, unknown>) => Record<string, Record<string, unknown>>;
3
+ export declare const prepareUpdate: (doc: Record<string, unknown>) => Record<"$set" | "$unset", Record<string, unknown>>;
package/dist/context.js CHANGED
@@ -112,9 +112,7 @@ const createContext = async (_options) => {
112
112
  message,
113
113
  details,
114
114
  context: collectionName,
115
- owner: token.authenticated
116
- ? token.sub
117
- : options.parentContext?.token.sub,
115
+ owner: token.sub,
118
116
  created_at: new Date(),
119
117
  });
120
118
  },
@@ -131,7 +129,12 @@ const createContext = async (_options) => {
131
129
  const description = (0, common_1.throwIfError)(await getCollectionAsset(collectionName, 'description'));
132
130
  context.description = await (0, preload_js_1.preloadDescription)(description);
133
131
  context.collectionName = collectionName;
134
- context.calledFunction = options.calledFunction;
132
+ if (!options.calledFunction && parentContext && 'calledFunction' in parentContext) {
133
+ context.calledFunction = parentContext.calledFunction;
134
+ }
135
+ else {
136
+ context.calledFunction = options.calledFunction;
137
+ }
135
138
  context.collection = indepthCollection(collectionName, collections, context);
136
139
  }
137
140
  return context;
package/dist/context.mjs CHANGED
@@ -86,7 +86,7 @@ export const createContext = async (_options) => {
86
86
  message,
87
87
  details,
88
88
  context: collectionName,
89
- owner: token.authenticated ? token.sub : options.parentContext?.token.sub,
89
+ owner: token.sub,
90
90
  created_at: /* @__PURE__ */ new Date()
91
91
  });
92
92
  },
@@ -103,7 +103,11 @@ export const createContext = async (_options) => {
103
103
  const description = throwIfError(await getCollectionAsset(collectionName, "description"));
104
104
  context.description = await preloadDescription(description);
105
105
  context.collectionName = collectionName;
106
- context.calledFunction = options.calledFunction;
106
+ if (!options.calledFunction && parentContext && "calledFunction" in parentContext) {
107
+ context.calledFunction = parentContext.calledFunction;
108
+ } else {
109
+ context.calledFunction = options.calledFunction;
110
+ }
107
111
  context.collection = indepthCollection(collectionName, collections, context);
108
112
  }
109
113
  return context;
package/dist/database.js CHANGED
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getDatabaseCollection = exports.getDatabaseSync = exports.getDatabase = exports.ObjectId = void 0;
27
27
  const entrypoint_1 = require("@aeriajs/entrypoint");
28
+ const util_1 = require("util");
28
29
  const mongodb_1 = require("mongodb");
29
30
  var mongodb_2 = require("mongodb");
30
31
  Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return mongodb_2.ObjectId; } });
@@ -48,12 +49,10 @@ const getDatabase = async () => {
48
49
  });
49
50
  if (logQueries) {
50
51
  client.on('commandStarted', (event) => {
51
- try {
52
- console.debug(JSON.stringify(event, null, 2));
53
- }
54
- catch (err) {
55
- console.debug(event);
56
- }
52
+ console.debug((0, util_1.inspect)(event, {
53
+ colors: true,
54
+ compact: false,
55
+ }));
57
56
  });
58
57
  }
59
58
  dbMemo.client = client;
package/dist/database.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  import { getConfig } from "@aeriajs/entrypoint";
3
+ import { inspect } from "util";
3
4
  import { MongoClient } from "mongodb";
4
5
  export {
5
6
  ObjectId
@@ -24,11 +25,10 @@ export const getDatabase = async () => {
24
25
  });
25
26
  if (logQueries) {
26
27
  client.on("commandStarted", (event) => {
27
- try {
28
- console.debug(JSON.stringify(event, null, 2));
29
- } catch (err) {
30
- console.debug(event);
31
- }
28
+ console.debug(inspect(event, {
29
+ colors: true,
30
+ compact: false
31
+ }));
32
32
  });
33
33
  }
34
34
  dbMemo.client = client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/core",
3
- "version": "0.0.172",
3
+ "version": "0.0.173",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "aeriaMain": "tests/fixtures/aeriaMain.js",
@@ -42,11 +42,11 @@
42
42
  "mongodb-memory-server": "^9.2.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@aeriajs/builtins": "^0.0.172",
45
+ "@aeriajs/builtins": "^0.0.173",
46
46
  "@aeriajs/common": "^0.0.105",
47
47
  "@aeriajs/entrypoint": "^0.0.107",
48
48
  "@aeriajs/http": "^0.0.118",
49
- "@aeriajs/security": "^0.0.172",
49
+ "@aeriajs/security": "^0.0.173",
50
50
  "@aeriajs/types": "^0.0.88",
51
51
  "@aeriajs/validation": "^0.0.108"
52
52
  },