@remit/backend 0.0.154 → 0.0.155
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.
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build the public CloudFront URL that fetches a single body part for a
|
|
3
|
-
* message. The path layout is what the Lambda@Edge JWT verifier expects
|
|
4
|
-
* (PR 1 of #224): `/content/accounts/{accountConfigId}/{accountId}/messages/
|
|
5
|
-
* {messageId}/parts/{partPath}`.
|
|
6
|
-
*
|
|
7
|
-
* The function is intentionally pure — domain comes from configuration so
|
|
8
|
-
* tests can pin the output without env vars. `partPath` is passed through
|
|
9
|
-
* `encodeURIComponent` because IMAP section paths are dot-separated digits
|
|
10
|
-
* (e.g. `1`, `1.2`, `2.1.3`) but a defensive encode keeps the builder safe
|
|
11
|
-
* if the path ever carries unexpected characters.
|
|
12
|
-
*/
|
|
13
1
|
import type { ContentSigner } from "./contentSignature.js";
|
|
14
2
|
export interface BuildContentUrlInput {
|
|
15
3
|
domain: string;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the public CloudFront URL that fetches a single body part for a
|
|
3
|
+
* message. The path layout is what the Lambda@Edge JWT verifier expects
|
|
4
|
+
* (PR 1 of #224): `/content/accounts/{accountConfigId}/{accountId}/messages/
|
|
5
|
+
* {messageId}/parts/{partPath}`.
|
|
6
|
+
*
|
|
7
|
+
* The function is intentionally pure — domain comes from configuration so
|
|
8
|
+
* tests can pin the output without env vars. `partPath` is passed through
|
|
9
|
+
* `encodeURIComponent` because IMAP section paths are dot-separated digits
|
|
10
|
+
* (e.g. `1`, `1.2`, `2.1.3`) but a defensive encode keeps the builder safe
|
|
11
|
+
* if the path ever carries unexpected characters.
|
|
12
|
+
*/
|
|
13
|
+
import { buildBodyPartKey } from "@remit/storage-service";
|
|
1
14
|
export const buildStorageContentUrl = (input) => {
|
|
2
15
|
const { domain, storageKey, sign } = input;
|
|
3
16
|
const normalizedDomain = domain.replace(/\/+$/, "");
|
|
@@ -21,7 +34,7 @@ export const buildContentUrl = (input) => {
|
|
|
21
34
|
const { domain, accountConfigId, accountId, messageId, partPath, sign } = input;
|
|
22
35
|
return buildStorageContentUrl({
|
|
23
36
|
domain,
|
|
24
|
-
storageKey:
|
|
37
|
+
storageKey: buildBodyPartKey(accountConfigId, accountId, messageId, partPath),
|
|
25
38
|
sign,
|
|
26
39
|
});
|
|
27
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BETTER_SQLITE3_LIMITS, createSqliteRepositories,
|
|
1
|
+
import { BETTER_SQLITE3_LIMITS, createSqliteRepositories, openSqliteDatabases, sqliteDatabasePathsFromEnv, } from "@remit/drizzle-service";
|
|
2
2
|
import { createRemitClient, } from "./create-remit-client.js";
|
|
3
3
|
import { buildSharedDeps, sqsQueues, sqsQueueUrlsFromEnv, } from "./shared-deps.js";
|
|
4
4
|
// The SQLite adapter composition (RFC 036). Every repo runs on the database
|
|
@@ -8,7 +8,6 @@ export const composeSqliteClient = async (shared) => {
|
|
|
8
8
|
return createRemitClient({
|
|
9
9
|
repositories: createSqliteRepositories(databases, BETTER_SQLITE3_LIMITS, {
|
|
10
10
|
storage: shared.storage,
|
|
11
|
-
messageObjectDeleteConcurrency: DEFAULT_MESSAGE_OBJECT_DELETE_CONCURRENCY,
|
|
12
11
|
}),
|
|
13
12
|
...shared,
|
|
14
13
|
});
|