@dads-framework/access 0.1.0 → 0.2.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/README.md +20 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,6 +5,23 @@ to enforce permissions, generate a SpiceDB schema, or build scoped lists.
|
|
|
5
5
|
|
|
6
6
|
## Try it
|
|
7
7
|
|
|
8
|
+
In the generated starter, [`libraries/app-runtime/index.ts`](../../apps/kit-workbench/libraries/app-runtime/index.ts)
|
|
9
|
+
defines account and tenant access handles shared by the domains.
|
|
10
|
+
[`assembly/start-app.ts`](../../apps/kit-workbench/assembly/start-app.ts) composes the selected API's declarations into one
|
|
11
|
+
model before opening its services.
|
|
12
|
+
|
|
13
|
+
Use Node.js 22 or later. This example emits schema text locally and needs no
|
|
14
|
+
authorization datastore.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @dads-framework/access zod
|
|
18
|
+
npm install -D tsx
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Save as `team-schema.mts` and run `npx tsx team-schema.mts`.
|
|
22
|
+
|
|
23
|
+
<!-- dads:check-example -->
|
|
24
|
+
|
|
8
25
|
```ts
|
|
9
26
|
import {
|
|
10
27
|
access,
|
|
@@ -31,6 +48,9 @@ console.log(emitZed(model));
|
|
|
31
48
|
```
|
|
32
49
|
|
|
33
50
|
The output includes `permission view = member` on the team definition.
|
|
51
|
+
In a service using this model, test a team member and a user with no member
|
|
52
|
+
relationship. The first should see the team's records. The second should
|
|
53
|
+
receive a denial or an empty scoped list, according to the operation.
|
|
34
54
|
|
|
35
55
|
## Use it
|
|
36
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dads-framework/access",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@dads-framework/request-work": "0.
|
|
31
|
+
"@dads-framework/request-work": "0.2.0",
|
|
32
32
|
"zod": "^4.4.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|