@happyvertical/smrt-preferences 0.0.0-stage → 0.55.11

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.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Store-only write capability for `UiPreferenceRecord` (#3727).
3
+ *
4
+ * A preference payload is only meaningful after its kind validated it, and
5
+ * only the store runs the validator. So the model refuses every insert,
6
+ * update and delete that the store did not grant: an insert carries
7
+ * {@link STORE_WRITE} as a constructor option (a symbol key never arrives
8
+ * from JSON), and an update or delete is granted per instance just before
9
+ * the store calls `save()` / `delete()`. A write grant is bound to the exact
10
+ * `payloadJson` the store validated, and every grant is single-use.
11
+ *
12
+ * Not part of the package's public exports (the smrt-approvals
13
+ * `write-capability.ts` pattern). This guards in-process callers of the
14
+ * model and collection; it is not a defence against raw SQL.
15
+ *
16
+ * @internal
17
+ * @packageDocumentation
18
+ */
19
+ /** Constructor-option key carrying the capability. Never exported publicly. */
20
+ export declare const STORE_WRITE: unique symbol;
21
+ /** Constructor options fragment that grants an insert of `payloadJson`. */
22
+ export declare function storeWriteOption(): {
23
+ [STORE_WRITE]: object;
24
+ };
25
+ /** Record an insert grant when the constructor options carry the token. */
26
+ export declare function adoptStoreWrite(instance: object, options: unknown): void;
27
+ /** Grant one save of `instance` with its current, validated payload. */
28
+ export declare function grantStoreWrite(instance: {
29
+ payloadJson: string;
30
+ }): void;
31
+ /** Grant one delete of `instance`. */
32
+ export declare function grantStoreDelete(instance: object): void;
33
+ /** Whether a save of `instance` with `payloadJson` was granted. */
34
+ export declare function hasStoreWrite(instance: object, payloadJson: string): boolean;
35
+ /** Spend the save grant of `instance`. */
36
+ export declare function spendStoreWrite(instance: object): void;
37
+ /** Spend the delete grant of `instance`; false when there was none. */
38
+ export declare function takeStoreDelete(instance: object): boolean;
39
+ //# sourceMappingURL=write-capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-capability.d.ts","sourceRoot":"","sources":["../src/write-capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,WAAW,eAAwC,CAAC;AAWjE,2EAA2E;AAC3E,wBAAgB,gBAAgB,IAAI;IAAE,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAE5D;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CASxE;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAEvE;AAED,sCAAsC;AACtC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED,mEAAmE;AACnE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAE5E;AAED,0CAA0C;AAC1C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD"}
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-preferences",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.55.11",
4
+ "description": "Tenant defaults and per-user overrides for user-interface preferences (overview layouts, shell layout), validated per registered kind",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "CLAUDE.md",
11
+ "AGENTS.md",
12
+ "agents"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./manifest": "./dist/manifest.json",
20
+ "./manifest.json": "./dist/manifest.json"
21
+ },
22
+ "dependencies": {
23
+ "@happyvertical/smrt-core": "0.55.11",
24
+ "@happyvertical/smrt-svelte": "0.55.11",
25
+ "@happyvertical/smrt-tenancy": "0.55.11",
26
+ "@happyvertical/smrt-users": "0.55.11",
27
+ "@happyvertical/sql": "^0.103.1"
28
+ },
29
+ "devDependencies": {
30
+ "@happyvertical/smrt-vitest": "0.55.11",
31
+ "@types/node": "24.13.6",
32
+ "svelte": "^5.57.1",
33
+ "typescript": "6.0.3",
34
+ "vite": "8.1.4",
35
+ "vitest": "4.1.10"
36
+ },
37
+ "keywords": [
38
+ "smrt",
39
+ "preferences",
40
+ "overview",
41
+ "shell",
42
+ "multi-tenancy"
43
+ ],
44
+ "author": "HappyVertical",
45
+ "license": "MIT",
46
+ "publishConfig": {
47
+ "registry": "https://registry.npmjs.org",
48
+ "access": "public"
49
+ },
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "https://github.com/happyvertical/smrt.git",
53
+ "directory": "packages/preferences"
54
+ },
55
+ "scripts": {
56
+ "build": "vite build --mode library",
57
+ "build:watch": "vite build --mode library --watch",
58
+ "clean": "rm -rf dist",
59
+ "dev": "vite dev",
60
+ "test": "vitest run",
61
+ "test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run optional.test.ts",
62
+ "test:watch": "vitest",
63
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
64
+ "verify:pack": "node ../../scripts/verify-package-types-exports.js ."
65
+ }
6
66
  }