@aooth/arbac-moost 0.1.80 → 0.1.82

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 (2) hide show
  1. package/dist/index.mjs +6 -23
  2. package/package.json +18 -19
package/dist/index.mjs CHANGED
@@ -5,9 +5,8 @@ import { Authenticate, HttpError } from "@moostjs/event-http";
5
5
  import { cached, cachedBy, current, eventTypeKey, key, tryGetCurrent } from "@wooksjs/event-core";
6
6
  import { Inherit, Injectable, TInterceptorPriority, defineBeforeInterceptor, getConstructor, getMoostMate, useControllerContext, useLogger } from "moost";
7
7
  import { computeInsights, containsRelationFilter, findAncestorInSet, getPath, hasRelationOp, isPlainObject, isRelationOp, translateQueryTree } from "@atscript/db";
8
- import { AsDbController, AsDbReadableController, AsJsonValueHelpController, AsValueHelpController, DB_CRUD_HANDLERS, VALUE_HELP_CRUD_HANDLERS, badRequest, discoverRowLevelActions, getControllerFormType, getDbEndpoint, hasActionDelegations, resolveTerminalRef } from "@atscript/moost-db";
8
+ import { AsDbController, AsDbReadableController, AsJsonValueHelpController, AsValueHelpController, DB_CRUD_HANDLERS, VALUE_HELP_CRUD_HANDLERS, badRequest, discoverRowLevelActions, getControllerFormType, getDbEndpoint, hasActionDelegations, resolveTerminalRef, stableMeta } from "@atscript/moost-db";
9
9
  import { groupByFields, walkFilter } from "@uniqu/core";
10
- import { prerenderJson } from "@wooksjs/event-http";
11
10
  //#region src/db/helpers.ts
12
11
  /** `map.get(key)`, created with `create()` and stored on a miss. */
13
12
  function getOrCreate(map, key, create) {
@@ -1296,29 +1295,13 @@ function memoMetaProjection(envelope, key, max, compute) {
1296
1295
  return out;
1297
1296
  }
1298
1297
  /**
1299
- * Make a memoized `/meta` object shareable across requests: frozen (deeply in
1300
- * development / test, so an in-place mutation throws instead of serving old
1301
- * bytes) and registered for prerendering with a weak ETag.
1298
+ * Make a memoized `/meta` object shareable across requests: moost-db's
1299
+ * `stableMeta()` deep-freezes it and marks it identity-stable, so every later
1300
+ * `/meta` step memoizes on it and `GET /meta` serves it (or the step's
1301
+ * memoized output) serialized once, with a weak ETag.
1302
1302
  */
1303
1303
  function shareMeta(obj) {
1304
- if (shouldDeepFreeze()) deepFreeze(obj);
1305
- else Object.freeze(obj);
1306
- return prerenderJson(obj, { etag: true });
1307
- }
1308
- let deepFreezeOn;
1309
- function shouldDeepFreeze() {
1310
- if (deepFreezeOn === void 0) {
1311
- const env = typeof process === "undefined" ? void 0 : process.env.NODE_ENV;
1312
- deepFreezeOn = env === "test" || env === "development";
1313
- }
1314
- return deepFreezeOn;
1315
- }
1316
- const deepFrozen = /* @__PURE__ */ new WeakSet();
1317
- function deepFreeze(value) {
1318
- if (value === null || typeof value !== "object" || deepFrozen.has(value)) return;
1319
- deepFrozen.add(value);
1320
- Object.freeze(value);
1321
- for (const key of Object.keys(value)) deepFreeze(value[key]);
1304
+ return stableMeta(obj);
1322
1305
  }
1323
1306
  //#endregion
1324
1307
  //#region src/db/meta-projection.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aooth/arbac-moost",
3
- "version": "0.1.80",
3
+ "version": "0.1.82",
4
4
  "description": "Moost RBAC integration for aoothjs (migrated from @moostjs/arbac)",
5
5
  "keywords": [
6
6
  "abac",
@@ -61,30 +61,29 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@uniqu/core": "^0.1.15",
64
- "@aooth/arbac": "0.1.80",
65
- "@aooth/user": "0.1.80",
66
- "@aooth/arbac-core": "0.1.80"
64
+ "@aooth/arbac": "0.1.82",
65
+ "@aooth/arbac-core": "0.1.82",
66
+ "@aooth/user": "0.1.82"
67
67
  },
68
68
  "devDependencies": {
69
- "@atscript/core": "^0.1.106",
70
- "@atscript/db": "^0.1.156",
71
- "@atscript/db-sql-tools": "^0.1.156",
72
- "@atscript/db-sqlite": "^0.1.156",
73
- "@atscript/moost-db": "^0.1.156",
74
- "@atscript/typescript": "^0.1.106",
75
- "@moostjs/event-http": "^0.6.51",
69
+ "@atscript/core": "^0.1.107",
70
+ "@atscript/db": "^0.1.159",
71
+ "@atscript/db-sql-tools": "^0.1.159",
72
+ "@atscript/db-sqlite": "^0.1.159",
73
+ "@atscript/moost-db": "^0.1.159",
74
+ "@atscript/typescript": "^0.1.107",
75
+ "@moostjs/event-http": "^0.6.52",
76
76
  "@types/better-sqlite3": "^7.6.13",
77
77
  "better-sqlite3": "^12.6.2",
78
- "unplugin-atscript": "^0.1.106"
78
+ "unplugin-atscript": "^0.1.107"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atscript/db": "^0.1.156",
82
- "@atscript/moost-db": "^0.1.156",
83
- "@atscript/typescript": "^0.1.106",
84
- "@moostjs/event-http": "^0.6.51",
85
- "@wooksjs/event-core": "^0.7.29",
86
- "@wooksjs/event-http": "^0.7.29",
87
- "moost": "^0.6.51"
81
+ "@atscript/db": "^0.1.159",
82
+ "@atscript/moost-db": "^0.1.159",
83
+ "@atscript/typescript": "^0.1.107",
84
+ "@moostjs/event-http": "^0.6.52",
85
+ "@wooksjs/event-core": "^0.7.30",
86
+ "moost": "^0.6.52"
88
87
  },
89
88
  "peerDependenciesMeta": {
90
89
  "@atscript/db": {