logisheets-core 1.13.0 → 1.14.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/dist/permissions/index.d.ts +16 -0
- package/dist/permissions/index.js +22 -0
- package/package.json +2 -2
|
@@ -5,6 +5,22 @@ declare class CallerRegistry {
|
|
|
5
5
|
getUserUuid(): string;
|
|
6
6
|
getCraftUuid(craftId: string): string;
|
|
7
7
|
isUser(uuid: string | undefined): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The engine-side identity a caller uuid stands for: `'user'`, or the
|
|
10
|
+
* craft named by the id it registered under.
|
|
11
|
+
*
|
|
12
|
+
* The uuids here are session-scoped, while a block's `owner` is a craft id
|
|
13
|
+
* saved in the file — so asking the engine whether a caller may touch a
|
|
14
|
+
* block means translating back first. `undefined` for a uuid this registry
|
|
15
|
+
* never issued, which the caller should treat as unidentified rather than
|
|
16
|
+
* as the user.
|
|
17
|
+
*/
|
|
18
|
+
resolveActor(uuid: string | undefined): {
|
|
19
|
+
type: 'user';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'craft';
|
|
22
|
+
craftId: string;
|
|
23
|
+
} | undefined;
|
|
8
24
|
registerBlockOwner(sheetIdx: number, blockId: number, callerUuid: string): void;
|
|
9
25
|
getBlockOwner(sheetIdx: number, blockId: number): string | undefined;
|
|
10
26
|
/**
|
|
@@ -33,6 +33,28 @@ class CallerRegistry {
|
|
|
33
33
|
isUser(uuid) {
|
|
34
34
|
return uuid === this._entries.get(USER_KEY);
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The engine-side identity a caller uuid stands for: `'user'`, or the
|
|
38
|
+
* craft named by the id it registered under.
|
|
39
|
+
*
|
|
40
|
+
* The uuids here are session-scoped, while a block's `owner` is a craft id
|
|
41
|
+
* saved in the file — so asking the engine whether a caller may touch a
|
|
42
|
+
* block means translating back first. `undefined` for a uuid this registry
|
|
43
|
+
* never issued, which the caller should treat as unidentified rather than
|
|
44
|
+
* as the user.
|
|
45
|
+
*/
|
|
46
|
+
resolveActor(uuid) {
|
|
47
|
+
if (uuid === undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
for (const [key, value] of this._entries) {
|
|
50
|
+
if (value !== uuid)
|
|
51
|
+
continue;
|
|
52
|
+
return key === USER_KEY
|
|
53
|
+
? { type: 'user' }
|
|
54
|
+
: { type: 'craft', craftId: key };
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
36
58
|
registerBlockOwner(sheetIdx, blockId, callerUuid) {
|
|
37
59
|
this._blockOwners.set(`${sheetIdx}-${blockId}`, callerUuid);
|
|
38
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logisheets-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "UI-free LogiSheets logic — runs in the browser or on Node. Depends on logisheets-web only for types; the engine Client is injected by the host.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"homepage": "https://github.com/logisky/LogiSheets",
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"logisheets-web": "^1.
|
|
66
|
+
"logisheets-web": "^1.14.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/node": "^18",
|