@cosmicdrift/kumiko-bundled-features 0.275.0 → 0.276.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.275.0",
3
+ "version": "0.276.0",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -129,12 +129,12 @@
129
129
  "./workflow-runner": "./src/workflow-runner/index.ts"
130
130
  },
131
131
  "dependencies": {
132
- "@cosmicdrift/kumiko-dispatcher-live": "0.275.0",
133
- "@cosmicdrift/kumiko-framework": "0.275.0",
134
- "@cosmicdrift/kumiko-headless": "0.275.0",
135
- "@cosmicdrift/kumiko-renderer": "0.275.0",
136
- "@cosmicdrift/kumiko-renderer-web": "0.275.0",
137
- "@cosmicdrift/kumiko-types": "0.275.0",
132
+ "@cosmicdrift/kumiko-dispatcher-live": "0.276.0",
133
+ "@cosmicdrift/kumiko-framework": "0.276.0",
134
+ "@cosmicdrift/kumiko-headless": "0.276.0",
135
+ "@cosmicdrift/kumiko-renderer": "0.276.0",
136
+ "@cosmicdrift/kumiko-renderer-web": "0.276.0",
137
+ "@cosmicdrift/kumiko-types": "0.276.0",
138
138
  "@mollie/api-client": "^4.5.0",
139
139
  "@node-rs/argon2": "^2.0.2",
140
140
  "@types/mailparser": "^3.4.6",
@@ -163,7 +163,7 @@
163
163
  ],
164
164
  "devDependencies": {
165
165
  "@testing-library/user-event": "^14.6.1",
166
- "@cosmicdrift/kumiko-locale-de": "0.275.0",
167
- "@cosmicdrift/kumiko-locale-es": "0.275.0"
166
+ "@cosmicdrift/kumiko-locale-de": "0.276.0",
167
+ "@cosmicdrift/kumiko-locale-es": "0.276.0"
168
168
  }
169
169
  }
@@ -0,0 +1,50 @@
1
+ // fw#2933: a `money` field's `currency: { kind: "tenant" }` declaration
2
+ // resolves in the renderer via config:query:values — this pins that a
3
+ // normal (non-admin) tenant user, not just an Admin, can read
4
+ // tenant-settings:config:currency through that query. Real HTTP via
5
+ // setupTestStack (never createTestDispatcher).
6
+
7
+ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
8
+ import {
9
+ configValuesTable,
10
+ createConfigAccessorFactory,
11
+ createConfigFeature,
12
+ createConfigResolver,
13
+ } from "@cosmicdrift/kumiko-bundled-features/config";
14
+ import {
15
+ setupTestStack,
16
+ type TestStack,
17
+ TestUsers,
18
+ unsafePushTables,
19
+ } from "@cosmicdrift/kumiko-framework/stack";
20
+ import { TenantSettingsConfig } from "../constants";
21
+ import { createTenantSettingsFeature } from "../feature";
22
+
23
+ let stack: TestStack;
24
+
25
+ beforeAll(async () => {
26
+ const resolver = createConfigResolver();
27
+ stack = await setupTestStack({
28
+ features: [createConfigFeature(), createTenantSettingsFeature({ defaultCurrency: "GBP" })],
29
+ extraContext: ({ registry }) => ({
30
+ configResolver: resolver,
31
+ _configAccessorFactory: createConfigAccessorFactory(registry, resolver),
32
+ }),
33
+ });
34
+ await unsafePushTables(stack.db, { configValuesTable });
35
+ });
36
+
37
+ afterAll(async () => {
38
+ await stack.cleanup();
39
+ });
40
+
41
+ describe("tenant-settings currency — read access", () => {
42
+ test('a non-admin tenant user (roles: ["User"]) can read tenant-settings:config:currency via config:query:values', async () => {
43
+ const res = await stack.http.queryOk<Record<string, { value: unknown }>>(
44
+ "config:query:values",
45
+ {},
46
+ TestUsers.user,
47
+ );
48
+ expect(res[TenantSettingsConfig.currency]?.value).toBe("GBP");
49
+ });
50
+ });
@@ -1,3 +1,5 @@
1
+ import { TENANT_CURRENCY_CONFIG_KEY } from "@cosmicdrift/kumiko-framework/engine";
2
+
1
3
  // tenant-settings bundle constants — feature-name + qualified config names.
2
4
  //
3
5
  // Motivation (solon#P19): apps kept hard-coding a single currency/locale
@@ -11,6 +13,9 @@ export const TENANT_SETTINGS_FEATURE_NAME = "tenant-settings";
11
13
  // ctx.config(...) reads. Clients reference the object instead of magic
12
14
  // strings (mirror tags' Handlers/Queries constants).
13
15
  export const TenantSettingsConfig = {
14
- currency: "tenant-settings:config:currency",
16
+ // Shared with engine/constants.ts's TENANT_CURRENCY_CONFIG_KEY — a
17
+ // `money` field's `currency: { kind: "tenant" }` declaration (fw#2933)
18
+ // resolves against this same key.
19
+ currency: TENANT_CURRENCY_CONFIG_KEY,
15
20
  locale: "tenant-settings:config:locale",
16
21
  } as const;