@protobase/server 0.62.0 → 0.62.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.
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.62.0";
2
+ var version = "0.62.1";
3
3
  //#endregion
4
4
  export { version };
@@ -32,10 +32,12 @@ const subscriptionProblems = (subscriptions, models, functions) => subscriptions
32
32
  });
33
33
  /**
34
34
  * Which subscriptions take which of a change's events: enabled, naming the event, of the change's tenant when they set
35
- * one, and passing their `when` on the record after the change (before it, for a delete). Filters are checked once,
35
+ * one and the resource declares a tenant (a resource without one is not tenant-scoped, so the owner's roles alone
36
+ * decide), and passing their `when` on the record after the change (before it, for a delete). Filters are checked once,
36
37
  * here; run `subscriptionProblems` first.
37
38
  */
38
39
  const subscriptionRouter = (subscriptions, models) => {
40
+ const untenanted = new Set(models.filter((model) => model.tenant === void 0).map((model) => model.name));
39
41
  const filters = /* @__PURE__ */ new Map();
40
42
  for (const subscription of subscriptions) {
41
43
  if (subscription.options.when === void 0) continue;
@@ -47,7 +49,7 @@ const subscriptionRouter = (subscriptions, models) => {
47
49
  const passes = (subscription, change) => {
48
50
  const { options } = subscription;
49
51
  if (options.enabled === false) return false;
50
- if (options.tenant !== void 0 && String(options.tenant) !== String(change.tenant)) return false;
52
+ if (options.tenant !== void 0 && !untenanted.has(change.resource) && String(options.tenant) !== String(change.tenant)) return false;
51
53
  const filter = filters.get(`${subscription.name}\0${change.resource}`);
52
54
  if (!filter) return true;
53
55
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/server",
3
- "version": "0.62.0",
3
+ "version": "0.62.1",
4
4
  "description": "The Protobase REST API as a Hono app, with Better Auth sign-in.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,9 +42,9 @@
42
42
  "@better-auth/sso": "^1.7.12",
43
43
  "@livekit/protocol": "1.53.1",
44
44
  "@modelcontextprotocol/server": "^2.3.1",
45
- "@protobase/layout": "0.62.0",
46
- "@protobase/query": "0.62.0",
47
- "@protobase/schema": "0.62.0",
45
+ "@protobase/layout": "0.62.1",
46
+ "@protobase/query": "0.62.1",
47
+ "@protobase/schema": "0.62.1",
48
48
  "@react-email/render": "^2.1.0",
49
49
  "@scalar/hono-api-reference": "^0.12.10",
50
50
  "@sentry/core": "^11.7.0",