@remit/drizzle-service 0.0.108 → 0.0.110
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/repos/cascade-delete.ts +0 -1
- package/src/repos/envelope.test.ts +0 -1
- package/src/repos/envelope.ts +0 -8
- package/src/repos/mappers.ts +0 -23
- package/src/repos/message.test.ts +0 -1
- package/src/repos/message.ts +0 -16
- package/src/schema/message-data.ts +0 -3
- package/src/schema-sets/mail.ts +0 -1
package/package.json
CHANGED
|
@@ -61,7 +61,6 @@ describe("DrizzleEnvelopeRepository", () => {
|
|
|
61
61
|
assert.equal(data.bodyPart.length, 0);
|
|
62
62
|
assert.equal(data.bodyPartParameter.length, 0);
|
|
63
63
|
assert.equal(data.rawMessageStorage.length, 0);
|
|
64
|
-
assert.equal(data.bodyPartStorage.length, 0);
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
test("throws NotFoundError for unknown messageId", async () => {
|
package/src/repos/envelope.ts
CHANGED
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
} from "../id.js";
|
|
26
26
|
import {
|
|
27
27
|
bodyPartParameterTable,
|
|
28
|
-
bodyPartStorageTable,
|
|
29
28
|
bodyPartTable,
|
|
30
29
|
bodyStructureRefetchTable,
|
|
31
30
|
envelopeAddressTable,
|
|
@@ -38,7 +37,6 @@ import { inList } from "./in-list.js";
|
|
|
38
37
|
import {
|
|
39
38
|
toBodyPartItem,
|
|
40
39
|
toBodyPartParameterItem,
|
|
41
|
-
toBodyPartStorageItem,
|
|
42
40
|
toEnvelopeAddressItem,
|
|
43
41
|
toEnvelopeItem,
|
|
44
42
|
toMessageReferenceItem,
|
|
@@ -74,7 +72,6 @@ export class DrizzleEnvelopeRepository implements IEnvelopeRepository {
|
|
|
74
72
|
bodyParts,
|
|
75
73
|
bodyPartParameters,
|
|
76
74
|
rawMessageStorages,
|
|
77
|
-
bodyPartStorages,
|
|
78
75
|
] = await Promise.all([
|
|
79
76
|
this.db
|
|
80
77
|
.select()
|
|
@@ -100,10 +97,6 @@ export class DrizzleEnvelopeRepository implements IEnvelopeRepository {
|
|
|
100
97
|
.select()
|
|
101
98
|
.from(rawMessageStorageTable)
|
|
102
99
|
.where(eq(rawMessageStorageTable.messageId, messageId)),
|
|
103
|
-
this.db
|
|
104
|
-
.select()
|
|
105
|
-
.from(bodyPartStorageTable)
|
|
106
|
-
.where(eq(bodyPartStorageTable.messageId, messageId)),
|
|
107
100
|
]);
|
|
108
101
|
|
|
109
102
|
if (envelopes.length === 0) {
|
|
@@ -117,7 +110,6 @@ export class DrizzleEnvelopeRepository implements IEnvelopeRepository {
|
|
|
117
110
|
bodyPart: bodyParts.map(toBodyPartItem),
|
|
118
111
|
bodyPartParameter: bodyPartParameters.map(toBodyPartParameterItem),
|
|
119
112
|
rawMessageStorage: rawMessageStorages.map(toRawMessageStorageItem),
|
|
120
|
-
bodyPartStorage: bodyPartStorages.map(toBodyPartStorageItem),
|
|
121
113
|
};
|
|
122
114
|
}
|
|
123
115
|
|
package/src/repos/mappers.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BodyPartItem,
|
|
3
3
|
BodyPartParameterItem,
|
|
4
|
-
BodyPartStorageItem,
|
|
5
4
|
EnvelopeAddressItem,
|
|
6
5
|
EnvelopeItem,
|
|
7
6
|
MessageReferenceItem,
|
|
@@ -9,7 +8,6 @@ import type {
|
|
|
9
8
|
} from "@remit/data-ports";
|
|
10
9
|
import type {
|
|
11
10
|
bodyPartParameterTable,
|
|
12
|
-
bodyPartStorageTable,
|
|
13
11
|
bodyPartTable,
|
|
14
12
|
envelopeAddressTable,
|
|
15
13
|
envelopeTable,
|
|
@@ -132,24 +130,3 @@ export function toRawMessageStorageItem(
|
|
|
132
130
|
...(row.expiresAt !== null ? { expiresAt: row.expiresAt } : {}),
|
|
133
131
|
};
|
|
134
132
|
}
|
|
135
|
-
|
|
136
|
-
export function toBodyPartStorageItem(
|
|
137
|
-
row: typeof bodyPartStorageTable.$inferSelect,
|
|
138
|
-
): BodyPartStorageItem {
|
|
139
|
-
return {
|
|
140
|
-
bodyPartStorageId: row.bodyPartStorageId,
|
|
141
|
-
messageId: row.messageId,
|
|
142
|
-
bodyPartId: row.bodyPartId,
|
|
143
|
-
storageType: row.storageType,
|
|
144
|
-
storageLocation: row.storageLocation,
|
|
145
|
-
storageKey: row.storageKey,
|
|
146
|
-
decodedSizeBytes: row.decodedSizeBytes,
|
|
147
|
-
checksumSha256: row.checksumSha256,
|
|
148
|
-
contentEncoding: row.contentEncoding,
|
|
149
|
-
isDeduped: row.isDeduped,
|
|
150
|
-
storedAt: row.storedAt,
|
|
151
|
-
createdAt: row.createdAt,
|
|
152
|
-
updatedAt: row.updatedAt,
|
|
153
|
-
...(row.dedupHash !== null ? { dedupHash: row.dedupHash } : {}),
|
|
154
|
-
};
|
|
155
|
-
}
|
|
@@ -122,7 +122,6 @@ describe("DrizzleMessageRepository", () => {
|
|
|
122
122
|
assert.equal(desc.bodyPart.length, 0);
|
|
123
123
|
assert.equal(desc.bodyPartParameter.length, 0);
|
|
124
124
|
assert.equal(desc.rawMessageStorage.length, 0);
|
|
125
|
-
assert.equal(desc.bodyPartStorage.length, 0);
|
|
126
125
|
});
|
|
127
126
|
|
|
128
127
|
test("throws NotFoundError for unknown messageId", async () => {
|
package/src/repos/message.ts
CHANGED
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
import { decodeToken, resultList } from "../pagination.js";
|
|
39
39
|
import {
|
|
40
40
|
bodyPartParameterTable,
|
|
41
|
-
bodyPartStorageTable,
|
|
42
41
|
bodyPartTable,
|
|
43
42
|
bodyStructureRefetchTable,
|
|
44
43
|
envelopeAddressTable,
|
|
@@ -55,7 +54,6 @@ import { inList, pairInList } from "./in-list.js";
|
|
|
55
54
|
import {
|
|
56
55
|
toBodyPartItem,
|
|
57
56
|
toBodyPartParameterItem,
|
|
58
|
-
toBodyPartStorageItem,
|
|
59
57
|
toEnvelopeAddressItem,
|
|
60
58
|
toEnvelopeItem,
|
|
61
59
|
toMessageReferenceItem,
|
|
@@ -202,14 +200,6 @@ export function deleteMessageSubtree(
|
|
|
202
200
|
guard?.(bodyPartParameterTable.messageId),
|
|
203
201
|
),
|
|
204
202
|
),
|
|
205
|
-
db
|
|
206
|
-
.delete(bodyPartStorageTable)
|
|
207
|
-
.where(
|
|
208
|
-
and(
|
|
209
|
-
inList(bodyPartStorageTable.messageId, messageIds),
|
|
210
|
-
guard?.(bodyPartStorageTable.messageId),
|
|
211
|
-
),
|
|
212
|
-
),
|
|
213
203
|
db
|
|
214
204
|
.delete(rawMessageStorageTable)
|
|
215
205
|
.where(
|
|
@@ -407,7 +397,6 @@ export class DrizzleMessageRepository implements IMessageRepository {
|
|
|
407
397
|
bodyParts,
|
|
408
398
|
bodyPartParameters,
|
|
409
399
|
rawMessageStorages,
|
|
410
|
-
bodyPartStorages,
|
|
411
400
|
] = await Promise.all([
|
|
412
401
|
this.db
|
|
413
402
|
.select()
|
|
@@ -441,10 +430,6 @@ export class DrizzleMessageRepository implements IMessageRepository {
|
|
|
441
430
|
.select()
|
|
442
431
|
.from(rawMessageStorageTable)
|
|
443
432
|
.where(eq(rawMessageStorageTable.messageId, messageId)),
|
|
444
|
-
this.db
|
|
445
|
-
.select()
|
|
446
|
-
.from(bodyPartStorageTable)
|
|
447
|
-
.where(eq(bodyPartStorageTable.messageId, messageId)),
|
|
448
433
|
]);
|
|
449
434
|
|
|
450
435
|
if (messages.length === 0) {
|
|
@@ -467,7 +452,6 @@ export class DrizzleMessageRepository implements IMessageRepository {
|
|
|
467
452
|
bodyPart: bodyParts.map(toBodyPartItem),
|
|
468
453
|
bodyPartParameter: bodyPartParameters.map(toBodyPartParameterItem),
|
|
469
454
|
rawMessageStorage: rawMessageStorages.map(toRawMessageStorageItem),
|
|
470
|
-
bodyPartStorage: bodyPartStorages.map(toBodyPartStorageItem),
|
|
471
455
|
};
|
|
472
456
|
}
|
|
473
457
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as entities from "@remit/drizzle-sqlite-schema";
|
|
2
2
|
|
|
3
3
|
const bodyPartParameterTable = entities.bodyPartParameters;
|
|
4
|
-
const bodyPartStorageTable = entities.bodyPartStorages;
|
|
5
4
|
const bodyPartTable = entities.bodyParts;
|
|
6
5
|
const bodyStructureRefetchTable = entities.bodyStructureRefetches;
|
|
7
6
|
const envelopeAddressTable = entities.envelopeAddresses;
|
|
@@ -14,7 +13,6 @@ const rawMessageStorageTable = entities.rawMessageStorages;
|
|
|
14
13
|
|
|
15
14
|
export {
|
|
16
15
|
bodyPartParameterTable,
|
|
17
|
-
bodyPartStorageTable,
|
|
18
16
|
bodyPartTable,
|
|
19
17
|
bodyStructureRefetchTable,
|
|
20
18
|
envelopeAddressTable,
|
|
@@ -33,7 +31,6 @@ export const messageDataSchema = {
|
|
|
33
31
|
bodyPart: bodyPartTable,
|
|
34
32
|
bodyPartParameter: bodyPartParameterTable,
|
|
35
33
|
rawMessageStorage: rawMessageStorageTable,
|
|
36
|
-
bodyPartStorage: bodyPartStorageTable,
|
|
37
34
|
bodyStructureRefetch: bodyStructureRefetchTable,
|
|
38
35
|
message: messageTable,
|
|
39
36
|
messageFlag: messageFlagTable,
|