@checkcourt/sdk 0.10.0 → 0.11.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/README.md +25 -0
- package/dist/extensions.d.ts +9 -1
- package/dist/generated/spec-hash.d.ts +1 -1
- package/dist/generated/spec-hash.js +1 -1
- package/dist/manifest.d.ts +26 -0
- package/dist/manifest.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -276,6 +276,31 @@ if (ext.point === "nav.page") {
|
|
|
276
276
|
}
|
|
277
277
|
```
|
|
278
278
|
|
|
279
|
+
#### Permissions for the club's roles
|
|
280
|
+
|
|
281
|
+
A club app can offer its own rights (at most `MAX_APP_PERMISSIONS`, keys matching
|
|
282
|
+
`APP_PERMISSION_KEY_PATTERN`). The club decides in its role editor which roles hold them; only
|
|
283
|
+
administrators hold them from the start. Every extension request carries the viewer's flags
|
|
284
|
+
for all declared keys in `viewer.capabilities.permissions`, and a `nav.page` with `requires`
|
|
285
|
+
is only listed and opened for holders:
|
|
286
|
+
|
|
287
|
+
```ts
|
|
288
|
+
defineManifest({
|
|
289
|
+
installTargets: ["tenant"],
|
|
290
|
+
permissions: [{ key: "manage_ladder", label: "Rangliste verwalten", description: "Darf Ergebnisse korrigieren" }],
|
|
291
|
+
extensions: [
|
|
292
|
+
{ point: "nav.page", kind: "declarative", url: "https://ladder.example.de/ext/admin", label: "Rangliste", icon: "trophy", requires: "manage_ladder" },
|
|
293
|
+
{ point: "dashboard.widget", kind: "declarative", url: "https://ladder.example.de/ext/widget" },
|
|
294
|
+
],
|
|
295
|
+
dataProcessing: { categories: ["Spielergebnisse"], purpose: "Führt die Rangliste", storageLocation: "EU", avvRequired: false },
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
const { context } = ext; // from verifyExtensionRequest, as above
|
|
299
|
+
if (context.viewer.capabilities.permissions?.manage_ladder) {
|
|
300
|
+
// show the edit buttons
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
279
304
|
### OAuth with PKCE (member apps)
|
|
280
305
|
|
|
281
306
|
```ts
|
package/dist/extensions.d.ts
CHANGED
|
@@ -55,6 +55,14 @@ export interface PointCapabilities {
|
|
|
55
55
|
"sidebar.action": Record<string, never>;
|
|
56
56
|
"nav.page": Record<string, never>;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Present at every point when the app's manifest declares `permissions`: each declared key with
|
|
60
|
+
* whether the viewer holds it (through a club role; administrators hold all). Absent otherwise.
|
|
61
|
+
* `false` at the kiosk, where nobody is signed in.
|
|
62
|
+
*/
|
|
63
|
+
export interface AppPermissionCapabilities {
|
|
64
|
+
permissions?: Record<string, boolean>;
|
|
65
|
+
}
|
|
58
66
|
export interface PointSubject {
|
|
59
67
|
"app.settings": {
|
|
60
68
|
type: "installation";
|
|
@@ -98,7 +106,7 @@ interface ContextClaimsOf<P extends ExtensionPoint> {
|
|
|
98
106
|
viewer: {
|
|
99
107
|
/** null on the kiosk; a stable `psn_…` pseudonym unless the installation holds `members:read`. */
|
|
100
108
|
user_id: string | null;
|
|
101
|
-
capabilities: PointCapabilities[P];
|
|
109
|
+
capabilities: PointCapabilities[P] & AppPermissionCapabilities;
|
|
102
110
|
};
|
|
103
111
|
iat: number;
|
|
104
112
|
exp: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OPENAPI_SPEC_SHA256 = "
|
|
1
|
+
export declare const OPENAPI_SPEC_SHA256 = "2bf34f4fbfba9e950b8f44b09a760f4df37b47935001c5500612f1a3cc71b909";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/generate.mjs from the CheckCourt OpenAPI spec. Do not edit.
|
|
2
|
-
export const OPENAPI_SPEC_SHA256 = "
|
|
2
|
+
export const OPENAPI_SPEC_SHA256 = "2bf34f4fbfba9e950b8f44b09a760f4df37b47935001c5500612f1a3cc71b909";
|
package/dist/manifest.d.ts
CHANGED
|
@@ -86,6 +86,25 @@ export declare const STATIC_ACTION_LABEL_MAX = 24;
|
|
|
86
86
|
/** Bounds of an iframe extension's initial `height` in pixels. */
|
|
87
87
|
export declare const IFRAME_EXTENSION_HEIGHT_MIN = 120;
|
|
88
88
|
export declare const IFRAME_EXTENSION_HEIGHT_MAX = 2000;
|
|
89
|
+
/** Keys of app permissions: lowercase letters, digits and `_`, starting with a letter, at most 40 characters. */
|
|
90
|
+
export declare const APP_PERMISSION_KEY_PATTERN: RegExp;
|
|
91
|
+
/** Most permissions one manifest may declare. */
|
|
92
|
+
export declare const MAX_APP_PERMISSIONS = 10;
|
|
93
|
+
export declare const APP_PERMISSION_LABEL_MAX = 60;
|
|
94
|
+
export declare const APP_PERMISSION_DESCRIPTION_MAX = 200;
|
|
95
|
+
/**
|
|
96
|
+
* A right the app offers the club's roles, e.g. who may manage its ladder. The club decides in
|
|
97
|
+
* its role editor which roles hold it; only administrators hold it from the start. Viewers' flags
|
|
98
|
+
* arrive as `viewer.capabilities.permissions` in the extension context.
|
|
99
|
+
*/
|
|
100
|
+
export interface AppPermission {
|
|
101
|
+
/** Matches `APP_PERMISSION_KEY_PATTERN`, unique within the manifest. */
|
|
102
|
+
key: string;
|
|
103
|
+
/** Shown in the role editor, German, 1 to 60 characters, e.g. "Rangliste verwalten". */
|
|
104
|
+
label: string;
|
|
105
|
+
/** Up to 200 characters. */
|
|
106
|
+
description?: string;
|
|
107
|
+
}
|
|
89
108
|
/** lucide icon names a static action or `nav.page` may use as `icon`. */
|
|
90
109
|
export declare const APP_ACTION_ICONS: readonly ["bell", "calendar", "calendar-check", "camera", "chart-column", "circle-help", "clipboard-list", "clock", "cloud-rain", "door-open", "file-text", "flag", "heart-pulse", "info", "key-round", "lightbulb", "link", "list-checks", "lock-open", "map-pin", "megaphone", "message-square", "receipt", "send", "sparkles", "star", "sun", "thermometer", "ticket", "triangle-alert", "trophy", "user-round", "users", "wallet", "wrench"];
|
|
91
110
|
export type AppActionIcon = (typeof APP_ACTION_ICONS)[number];
|
|
@@ -115,6 +134,11 @@ type ExtensionOf<P extends ExtensionPoint> = {
|
|
|
115
134
|
/** Navigation entry and page title, 1 to 24 characters (`STATIC_ACTION_LABEL_MAX`). */
|
|
116
135
|
label: string;
|
|
117
136
|
icon: AppActionIcon;
|
|
137
|
+
/**
|
|
138
|
+
* Key of one of the manifest's `permissions`: only holders see the entry and may open
|
|
139
|
+
* the page; CheckCourt enforces it for the page and its actions.
|
|
140
|
+
*/
|
|
141
|
+
requires?: string;
|
|
118
142
|
} : P extends "booking.action" ? {
|
|
119
143
|
label: string;
|
|
120
144
|
icon?: never;
|
|
@@ -247,6 +271,8 @@ export interface Manifest {
|
|
|
247
271
|
/** At most 20. */
|
|
248
272
|
extensions?: readonly ManifestExtension[];
|
|
249
273
|
settingsSchema?: SettingsSchema;
|
|
274
|
+
/** Rights the app offers the club's roles (at most 10). Club installations only. */
|
|
275
|
+
permissions?: readonly AppPermission[];
|
|
250
276
|
dataProcessing: DataProcessing;
|
|
251
277
|
/** Metadata other apps may read (at most 20). Club installations only. */
|
|
252
278
|
shares?: {
|
package/dist/manifest.js
CHANGED
|
@@ -41,6 +41,12 @@ export const STATIC_ACTION_LABEL_MAX = 24;
|
|
|
41
41
|
/** Bounds of an iframe extension's initial `height` in pixels. */
|
|
42
42
|
export const IFRAME_EXTENSION_HEIGHT_MIN = 120;
|
|
43
43
|
export const IFRAME_EXTENSION_HEIGHT_MAX = 2000;
|
|
44
|
+
/** Keys of app permissions: lowercase letters, digits and `_`, starting with a letter, at most 40 characters. */
|
|
45
|
+
export const APP_PERMISSION_KEY_PATTERN = /^[a-z][a-z0-9_]{0,39}$/;
|
|
46
|
+
/** Most permissions one manifest may declare. */
|
|
47
|
+
export const MAX_APP_PERMISSIONS = 10;
|
|
48
|
+
export const APP_PERMISSION_LABEL_MAX = 60;
|
|
49
|
+
export const APP_PERMISSION_DESCRIPTION_MAX = 200;
|
|
44
50
|
/** lucide icon names a static action or `nav.page` may use as `icon`. */
|
|
45
51
|
export const APP_ACTION_ICONS = [
|
|
46
52
|
"bell",
|