@superjackfruitlabs/treaty-matrix-events 0.0.10 → 0.0.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.
- package/README.md +2 -1
- package/dist/board-room.d.ts +19 -1
- package/dist/board-room.js +27 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,4 +27,5 @@ the old one; an additive change bumps `schema_version` inside the content, and r
|
|
|
27
27
|
properties they do not know.
|
|
28
28
|
|
|
29
29
|
The board-room names (`boardRoomAlias`, `boardSpeakerMxid`) are the names existing rooms have, in
|
|
30
|
-
the AgentPod appservice's namespace.
|
|
30
|
+
the AgentPod appservice's namespace. `boardRoomNames(carrier)` gives each carrier its own set:
|
|
31
|
+
`agentpod` returns those same names, `superexchange` names inside SuperExchange's namespace.
|
package/dist/board-room.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* The localpart and the alias sit inside the AgentPod appservice's exclusive `@agent_.*` and
|
|
10
10
|
* `#agentpod_.*` namespaces, which is where every board room lives today. A carrier with its own
|
|
11
|
-
* namespace (SuperExchange) needs its own names; these stay what existing rooms are called
|
|
11
|
+
* namespace (SuperExchange) needs its own names; these stay what existing rooms are called, and
|
|
12
|
+
* `boardRoomNames` gives each carrier its set.
|
|
12
13
|
*/
|
|
13
14
|
/** The localpart the board speaks as. */
|
|
14
15
|
export declare const BOARD_SPEAKER_LOCALPART = "agent_superpipeline";
|
|
@@ -18,3 +19,20 @@ export declare const BOARD_SPEAKER_DISPLAY_NAME = "superpipeline";
|
|
|
18
19
|
export declare function boardRoomAlias(boardId: string): string;
|
|
19
20
|
/** The speaker's full Matrix id on a homeserver. */
|
|
20
21
|
export declare function boardSpeakerMxid(domain: string): string;
|
|
22
|
+
/** The carriers that hold board rooms, each inside its own appservice's exclusive namespace. */
|
|
23
|
+
export type BoardRoomCarrier = "agentpod" | "superexchange";
|
|
24
|
+
/** One carrier's board-room names. */
|
|
25
|
+
export interface BoardRoomNames {
|
|
26
|
+
/** The localpart the board speaks as. */
|
|
27
|
+
speakerLocalpart: string;
|
|
28
|
+
/** The room alias's localpart for a board, unsafe characters as `_`. */
|
|
29
|
+
alias(boardId: string): string;
|
|
30
|
+
/** The speaker's full Matrix id on a homeserver. */
|
|
31
|
+
speakerMxid(domain: string): string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A carrier's board-room names. Both speak with the display name `BOARD_SPEAKER_DISPLAY_NAME`, so
|
|
35
|
+
* a person sees the board, not the carrier. A board's room under one carrier is a different room
|
|
36
|
+
* from its room under the other: neither carrier can speak in, or claim the alias of, the other's.
|
|
37
|
+
*/
|
|
38
|
+
export declare function boardRoomNames(carrier: BoardRoomCarrier): BoardRoomNames;
|
package/dist/board-room.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* The localpart and the alias sit inside the AgentPod appservice's exclusive `@agent_.*` and
|
|
10
10
|
* `#agentpod_.*` namespaces, which is where every board room lives today. A carrier with its own
|
|
11
|
-
* namespace (SuperExchange) needs its own names; these stay what existing rooms are called
|
|
11
|
+
* namespace (SuperExchange) needs its own names; these stay what existing rooms are called, and
|
|
12
|
+
* `boardRoomNames` gives each carrier its set.
|
|
12
13
|
*/
|
|
13
14
|
/** The localpart the board speaks as. */
|
|
14
15
|
export const BOARD_SPEAKER_LOCALPART = "agent_superpipeline";
|
|
@@ -22,3 +23,28 @@ export function boardRoomAlias(boardId) {
|
|
|
22
23
|
export function boardSpeakerMxid(domain) {
|
|
23
24
|
return `@${BOARD_SPEAKER_LOCALPART}:${domain}`;
|
|
24
25
|
}
|
|
26
|
+
const LOCALPART = {
|
|
27
|
+
// Inside `@agent_.*` and `#agentpod_.*`: the names every existing room has.
|
|
28
|
+
agentpod: {
|
|
29
|
+
speaker: BOARD_SPEAKER_LOCALPART,
|
|
30
|
+
aliasPrefix: "agentpod_board_",
|
|
31
|
+
},
|
|
32
|
+
// Inside `@superexchange_.*` and `#superexchange_.*`.
|
|
33
|
+
superexchange: {
|
|
34
|
+
speaker: "superexchange_board",
|
|
35
|
+
aliasPrefix: "superexchange_board_",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A carrier's board-room names. Both speak with the display name `BOARD_SPEAKER_DISPLAY_NAME`, so
|
|
40
|
+
* a person sees the board, not the carrier. A board's room under one carrier is a different room
|
|
41
|
+
* from its room under the other: neither carrier can speak in, or claim the alias of, the other's.
|
|
42
|
+
*/
|
|
43
|
+
export function boardRoomNames(carrier) {
|
|
44
|
+
const { speaker, aliasPrefix } = LOCALPART[carrier];
|
|
45
|
+
return {
|
|
46
|
+
speakerLocalpart: speaker,
|
|
47
|
+
alias: (boardId) => `${aliasPrefix}${boardId.replace(/[^A-Za-z0-9_-]/g, "_")}`,
|
|
48
|
+
speakerMxid: (domain) => `@${speaker}:${domain}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superjackfruitlabs/treaty-matrix-events",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "The board-room Matrix event contract: JSON Schemas, builders and parsers for the gates, questions, follow-ups and waiting cards Super Jackfruit Labs products carry into chat, and the answers back.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|