@remit/data-ports 0.0.36 → 0.0.37
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 +1 -1
- package/src/id.ts +0 -17
- package/src/mailbox-role.ts +1 -32
package/package.json
CHANGED
package/src/id.ts
CHANGED
|
@@ -7,13 +7,6 @@ const translator = shortUuid.createTranslator(shortUuid.constants.uuid25Base36);
|
|
|
7
7
|
|
|
8
8
|
export const base36uuid = (): string => translator.generate();
|
|
9
9
|
|
|
10
|
-
export const fromUUID = (uuid: string): string => translator.fromUUID(uuid);
|
|
11
|
-
|
|
12
|
-
export const toUUID = (shortId: string): string => translator.toUUID(shortId);
|
|
13
|
-
|
|
14
|
-
export const generateUuidv5 = (name: string, namespace: string): string =>
|
|
15
|
-
uuidv5(name, namespace);
|
|
16
|
-
|
|
17
10
|
export const base36uuidv5 = (name: string, namespace: string): string =>
|
|
18
11
|
translator.fromUUID(uuidv5(name, namespace));
|
|
19
12
|
|
|
@@ -118,16 +111,6 @@ export const ROOT_PART_PATH = "0";
|
|
|
118
111
|
export const deriveBodyPartId = (messageId: string, partPath: string): string =>
|
|
119
112
|
base36uuidv5(`bodypart:${messageId}:${partPath}`, REMIT_NAMESPACE);
|
|
120
113
|
|
|
121
|
-
export const deriveBodyPartParameterId = (
|
|
122
|
-
messageId: string,
|
|
123
|
-
partPath: string,
|
|
124
|
-
parameterName: string,
|
|
125
|
-
): string =>
|
|
126
|
-
base36uuidv5(
|
|
127
|
-
`bodypartparam:${messageId}:${partPath}:${parameterName.toLowerCase()}`,
|
|
128
|
-
REMIT_NAMESPACE,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
114
|
/**
|
|
132
115
|
* Identity of a quarantined message (issue #72). Derived rather than generated
|
|
133
116
|
* so re-quarantining the same message rewrites its own row: the sync path can
|
package/src/mailbox-role.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CanonicalMailboxRole } from "@remit/domain-enums";
|
|
2
|
-
import { ROLE_NAME_HINTS
|
|
2
|
+
import { ROLE_NAME_HINTS } from "./folder-role.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The conventional names for a role, taken from the one table every
|
|
@@ -12,34 +12,3 @@ export const JUNK_FOLDER_NAMES: readonly string[] =
|
|
|
12
12
|
|
|
13
13
|
export const TRASH_FOLDER_NAMES: readonly string[] =
|
|
14
14
|
ROLE_NAME_HINTS[CanonicalMailboxRole.Trash] ?? [];
|
|
15
|
-
|
|
16
|
-
export interface MailboxRole {
|
|
17
|
-
readonly fullPath: string;
|
|
18
|
-
readonly hierarchyDelimiter?: string;
|
|
19
|
-
readonly specialUse?: readonly string[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Whether one mailbox, considered alone, carries a role: its SPECIAL-USE flag
|
|
24
|
-
* or its conventional name. A single mailbox carries no account context, so
|
|
25
|
-
* this cannot see the user's appointment — a caller holding an accountId asks
|
|
26
|
-
* `IMailboxSpecialUseRepository` instead, which does.
|
|
27
|
-
*/
|
|
28
|
-
const carriesRole = (
|
|
29
|
-
mailbox: MailboxRole,
|
|
30
|
-
role: (typeof CanonicalMailboxRole)[keyof typeof CanonicalMailboxRole],
|
|
31
|
-
): boolean =>
|
|
32
|
-
resolveMailboxForRole(role, [
|
|
33
|
-
{
|
|
34
|
-
mailboxId: "",
|
|
35
|
-
fullPath: mailbox.fullPath,
|
|
36
|
-
hierarchyDelimiter: mailbox.hierarchyDelimiter ?? "",
|
|
37
|
-
specialUse: mailbox.specialUse,
|
|
38
|
-
},
|
|
39
|
-
]) !== null;
|
|
40
|
-
|
|
41
|
-
export const isJunkMailbox = (mailbox: MailboxRole): boolean =>
|
|
42
|
-
carriesRole(mailbox, CanonicalMailboxRole.Junk);
|
|
43
|
-
|
|
44
|
-
export const isTrashMailbox = (mailbox: MailboxRole): boolean =>
|
|
45
|
-
carriesRole(mailbox, CanonicalMailboxRole.Trash);
|