@sprucelabs/mercury-chunking-emitter 3.0.598 → 3.0.600

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.
@@ -13,12 +13,11 @@ class ChunkingEmitterImpl {
13
13
  this.totalErrors = 0;
14
14
  const { client, chunkSize } = (0, schema_1.assertOptions)(options, ['client']);
15
15
  this.client = client;
16
- this.chunkSize = chunkSize !== null && chunkSize !== void 0 ? chunkSize : 10;
16
+ this.chunkSize = chunkSize ?? 10;
17
17
  }
18
18
  static async Emitter(options) {
19
- var _a;
20
19
  (0, schema_1.assertOptions)(options, ['client']);
21
- return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)(options);
20
+ return new (this.Class ?? this)(options);
22
21
  }
23
22
  async emit(options) {
24
23
  const { items, batchCursor: cursor, uniqueKey: unqiueKey, } = (0, schema_1.assertOptions)(options, ['eventName', 'payloadKey']);
@@ -60,12 +60,11 @@ class MockChunkingEmitter {
60
60
  test_utils_1.assert.isEqual(this.emittedEventName, fqen, `I expected chunkingEmitter to emit '${fqen}'! But you emitted ${this.emittedEventName || 'nothing'}`);
61
61
  }
62
62
  assertEventHonorsChunkingSignature(fqen) {
63
- var _a, _b, _c, _d, _e, _f;
64
63
  const emitter = mercury_client_1.MercuryTestClient.getInternalEmitter();
65
64
  const contract = emitter.getContract();
66
- const payload = (_b = (_a = contract.eventSignatures[fqen]) === null || _a === void 0 ? void 0 : _a.emitPayloadSchema) === null || _b === void 0 ? void 0 : _b.fields;
65
+ const payload = contract.eventSignatures[fqen]?.emitPayloadSchema?.fields;
67
66
  // @ts-ignore
68
- const chunkField = (_f = (_e = (_d = (_c = payload === null || payload === void 0 ? void 0 : payload.payload) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.schema) === null || _e === void 0 ? void 0 : _e.fields) === null || _f === void 0 ? void 0 : _f.chunk;
67
+ const chunkField = payload?.payload?.options?.schema?.fields?.chunk;
69
68
  test_utils_1.assert.isTruthy(chunkField, 'Your event does not conform to the chunking signature. Please add a chunk field to your event payload. Add a field to your payload called chunk: chunkFieldDefinition()');
70
69
  test_utils_1.assert.isEqualDeep(chunkField, (0, chunkFieldDefinition_1.default)(), 'Your chunk field is there but not properly formed. Use chunkFieldDefinition() to define it.');
71
70
  }
@@ -24,9 +24,8 @@ class SingleChunkEmitter {
24
24
  return this.totalErrors;
25
25
  }
26
26
  async emit() {
27
- var _a, _b;
28
27
  let current = 0;
29
- const actualCursor = (_a = this.cursor) !== null && _a !== void 0 ? _a : this.Cursor((_b = this.items) !== null && _b !== void 0 ? _b : []);
28
+ const actualCursor = this.cursor ?? this.Cursor(this.items ?? []);
30
29
  this.total = await actualCursor.getTotalRecords();
31
30
  for await (const chunk of actualCursor) {
32
31
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprucelabs/mercury-chunking-emitter",
3
- "version": "3.0.598",
3
+ "version": "3.0.600",
4
4
  "files": [
5
5
  "build/**/*",
6
6
  "!build/__tests__",
@@ -38,14 +38,14 @@
38
38
  "release": "semantic-release"
39
39
  },
40
40
  "devDependencies": {
41
- "@sprucelabs/esm-postbuild": "^6.0.460",
42
- "@sprucelabs/jest-json-reporter": "^8.0.476",
43
- "@sprucelabs/resolve-path-aliases": "^2.0.455",
41
+ "@sprucelabs/esm-postbuild": "^6.0.462",
42
+ "@sprucelabs/jest-json-reporter": "^8.0.480",
43
+ "@sprucelabs/resolve-path-aliases": "^2.0.457",
44
44
  "@sprucelabs/semantic-release": "^5.0.2",
45
- "@sprucelabs/spruce-test-fixtures": "^62.3.43",
46
- "@sprucelabs/test": "^9.0.50",
47
- "@sprucelabs/test-utils": "^5.1.426",
48
- "@types/node": "^22.7.5",
45
+ "@sprucelabs/spruce-test-fixtures": "^62.3.45",
46
+ "@sprucelabs/test": "^9.0.51",
47
+ "@sprucelabs/test-utils": "^5.1.433",
48
+ "@types/node": "^22.7.6",
49
49
  "chokidar-cli": "^3.0.0",
50
50
  "eslint": "^9.12.0",
51
51
  "eslint-config-spruce": "^11.2.26",
@@ -84,12 +84,12 @@
84
84
  }
85
85
  },
86
86
  "dependencies": {
87
- "@sprucelabs/data-stores": "^28.3.135",
88
- "@sprucelabs/mercury-client": "^42.0.526",
89
- "@sprucelabs/mercury-types": "^47.0.527",
90
- "@sprucelabs/schema": "^30.0.485",
91
- "@sprucelabs/spruce-core-schemas": "^40.1.471",
92
- "@sprucelabs/spruce-event-utils": "^40.1.247",
93
- "@sprucelabs/spruce-skill-utils": "^31.0.544"
87
+ "@sprucelabs/data-stores": "^28.3.141",
88
+ "@sprucelabs/mercury-client": "^42.0.528",
89
+ "@sprucelabs/mercury-types": "^47.0.529",
90
+ "@sprucelabs/schema": "^30.0.489",
91
+ "@sprucelabs/spruce-core-schemas": "^40.1.474",
92
+ "@sprucelabs/spruce-event-utils": "^40.1.249",
93
+ "@sprucelabs/spruce-skill-utils": "^31.0.548"
94
94
  }
95
95
  }