@simplysm/service-common 13.0.74 → 13.0.76

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/service-common",
3
- "version": "13.0.74",
3
+ "version": "13.0.76",
4
4
  "description": "Simplysm package - Service module (common)",
5
5
  "author": "simplysm",
6
6
  "license": "Apache-2.0",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "sideEffects": false,
21
21
  "dependencies": {
22
- "@simplysm/core-common": "13.0.74",
23
- "@simplysm/orm-common": "13.0.74"
22
+ "@simplysm/core-common": "13.0.76",
23
+ "@simplysm/orm-common": "13.0.76"
24
24
  }
25
25
  }
@@ -8,14 +8,4 @@ describe("defineEvent", () => {
8
8
  expect(evt.eventName).toBe("OrderUpdated");
9
9
  });
10
10
 
11
- it("can be used for type inference (checked at compile time)", () => {
12
- const _evt = defineEvent<{ orderId: number }, { status: string }>("OrderUpdated");
13
-
14
- // Type level verification — fails at compile time if incorrect
15
- const info: typeof _evt.$info = { orderId: 123 };
16
- const data: typeof _evt.$data = { status: "shipped" };
17
-
18
- expect(info.orderId).toBe(123);
19
- expect(data.status).toBe("shipped");
20
- });
21
11
  });
@@ -25,18 +25,6 @@ describe("ServiceProtocol", () => {
25
25
  expect(result.totalSize).toBeGreaterThan(0);
26
26
  });
27
27
 
28
- it("encode message without body", () => {
29
- const uuid = Uuid.new().toString();
30
- const message: ServiceMessage = {
31
- name: "reload",
32
- body: { clientName: undefined, changedFileSet: new Set() },
33
- };
34
-
35
- const result = protocol.encode(uuid, message);
36
-
37
- expect(result.chunks.length).toBe(1);
38
- });
39
-
40
28
  it("throw error when message exceeds 100MB", () => {
41
29
  const uuid = Uuid.new().toString();
42
30
  // Generate data larger than 100MB
@@ -215,63 +203,9 @@ describe("ServiceProtocol", () => {
215
203
  }
216
204
  });
217
205
 
218
- it("receive 3 UUIDs in random order", () => {
219
- const uuids = [Uuid.new().toString(), Uuid.new().toString(), Uuid.new().toString()];
220
- const data = [
221
- "X".repeat(4 * 1024 * 1024),
222
- "Y".repeat(4 * 1024 * 1024),
223
- "Z".repeat(4 * 1024 * 1024),
224
- ];
225
- const messages: ServiceMessage[] = data.map((d, i) => ({
226
- name: `test.method${i}`,
227
- body: [d],
228
- }));
229
-
230
- const encodedList = uuids.map((uuid, i) => protocol.encode(uuid, messages[i]));
231
-
232
- // Combine all chunks into one array
233
- const allChunks: { uuid: string; chunk: Uint8Array; originalIndex: number }[] = [];
234
- encodedList.forEach((encoded, msgIdx) => {
235
- encoded.chunks.forEach((chunk, chunkIdx) => {
236
- allChunks.push({ uuid: uuids[msgIdx], chunk, originalIndex: chunkIdx });
237
- });
238
- });
239
-
240
- // Randomize order (use reverse instead of seed-based shuffle)
241
- allChunks.reverse();
242
-
243
- // Decode all chunks
244
- const results: Map<string, ReturnType<typeof protocol.decode>> = new Map();
245
- for (const { uuid, chunk } of allChunks) {
246
- results.set(uuid, protocol.decode(chunk));
247
- }
248
-
249
- // Verify all messages completed
250
- for (let i = 0; i < 3; i++) {
251
- const result = results.get(uuids[i]);
252
- expect(result?.type).toBe("complete");
253
- if (result?.type === "complete") {
254
- expect(result.message.name).toBe(`test.method${i}`);
255
- expect(result.message.body).toEqual([data[i]]);
256
- }
257
- }
258
- });
259
206
  });
260
207
 
261
208
  describe("Edge cases", () => {
262
- it("handle empty body", () => {
263
- const uuid = Uuid.new().toString();
264
- const message: ServiceMessage = { name: "test.method", body: [""] };
265
-
266
- const encoded = protocol.encode(uuid, message);
267
- const decoded = protocol.decode(encoded.chunks[0]);
268
-
269
- expect(decoded.type).toBe("complete");
270
- if (decoded.type === "complete") {
271
- expect(decoded.message.body).toEqual([""]);
272
- }
273
- });
274
-
275
209
  it("handle null body", () => {
276
210
  const uuid = Uuid.new().toString();
277
211
  const message: ServiceMessage = { name: "test.method", body: [null] };
@@ -286,25 +220,6 @@ describe("ServiceProtocol", () => {
286
220
  }
287
221
  });
288
222
 
289
- it("serialize complex object", () => {
290
- const uuid = Uuid.new().toString();
291
- const complexData = {
292
- array: [1, 2, 3],
293
- nested: { deep: { value: "test" } },
294
- date: new Date().toISOString(),
295
- unicode: "Korean test 🚀",
296
- };
297
- const message: ServiceMessage = { name: "test.method", body: [complexData] };
298
-
299
- const encoded = protocol.encode(uuid, message);
300
- const decoded = protocol.decode(encoded.chunks[0]);
301
-
302
- expect(decoded.type).toBe("complete");
303
- if (decoded.type === "complete") {
304
- expect(decoded.message.body).toEqual([complexData]);
305
- }
306
- });
307
-
308
223
  it("handle message at exactly 3MB boundary", () => {
309
224
  const uuid = Uuid.new().toString();
310
225
  // Exactly 3MB