@fabrika/check 0.9.0-dev.19 → 0.9.0-dev.20
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 +6 -6
- package/src/reader/surface.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/check",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/parser": "8.0.7",
|
|
50
|
-
"@fabrika/app": "0.9.0-dev.
|
|
51
|
-
"@fabrika/auth-core": "0.9.0-dev.
|
|
52
|
-
"@fabrika/db": "0.9.0-dev.
|
|
53
|
-
"@fabrika/operations-contract": "0.9.0-dev.
|
|
54
|
-
"@fabrika/platform-node": "0.9.0-dev.
|
|
50
|
+
"@fabrika/app": "0.9.0-dev.20",
|
|
51
|
+
"@fabrika/auth-core": "0.9.0-dev.20",
|
|
52
|
+
"@fabrika/db": "0.9.0-dev.20",
|
|
53
|
+
"@fabrika/operations-contract": "0.9.0-dev.20",
|
|
54
|
+
"@fabrika/platform-node": "0.9.0-dev.20",
|
|
55
55
|
"zod": "^3.25.76"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/src/reader/surface.ts
CHANGED
|
@@ -82,7 +82,7 @@ const CONTRACT_ALLOWED = 'export const contract = app.contract((c) => ({ … }))
|
|
|
82
82
|
/** Which builders a surface is written with: `defineContract`'s `c`, or the staged kit's (`app.*` and its `c`). */
|
|
83
83
|
type Form = 'surface' | 'kit'
|
|
84
84
|
const ACCESS_ALLOWED =
|
|
85
|
-
|
|
85
|
+
"{ member: true }, { action, over }, { action, in, from }, { action, on, from }, { action, creates }, { action, app: true }, { anyOf: ['<action>', …], app: true }, { capabilities: { <name>: … } } or { public: true }"
|
|
86
86
|
const CAPABILITY_ALLOWED = '{ action, over }, { action, in, from } or { action, on, from }'
|
|
87
87
|
|
|
88
88
|
type Entries = ReadonlyMap<string, LiteralValue>
|
|
@@ -1057,6 +1057,12 @@ function isApp(fields: Entries): boolean {
|
|
|
1057
1057
|
return hasKeys(fields, ['action', 'app']) && app?.kind === 'boolean' && app.value
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
|
+
/** `{ anyOf: [...], app: true }`: `app` is the literal `true`; `buildArtifact` checks the list. */
|
|
1061
|
+
function isAnyOf(fields: Entries): boolean {
|
|
1062
|
+
const app = fields.get('app')
|
|
1063
|
+
return hasKeys(fields, ['anyOf', 'app']) && app?.kind === 'boolean' && app.value
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1060
1066
|
/** `{ public: true }`: `public` is the literal `true`. */
|
|
1061
1067
|
function isPublic(fields: Entries): boolean {
|
|
1062
1068
|
const open = fields.get('public')
|
|
@@ -1085,6 +1091,9 @@ function accessDeclaration(value: LiteralValue | undefined, at: BuilderValue): A
|
|
|
1085
1091
|
if (isApp(fields)) {
|
|
1086
1092
|
return { action: field('action'), app: true }
|
|
1087
1093
|
}
|
|
1094
|
+
if (isAnyOf(fields)) {
|
|
1095
|
+
return { anyOf: texts(fields.get('anyOf'), value ?? at, 'access.anyOf'), app: true }
|
|
1096
|
+
}
|
|
1088
1097
|
if (isPublic(fields)) {
|
|
1089
1098
|
return { public: true }
|
|
1090
1099
|
}
|