@sprucelabs/mercury-chunking-emitter 1.2.0 → 1.3.1
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/build/.spruce/events/events.contract.d.ts +6 -0
- package/build/.spruce/events/events.contract.js +4 -0
- package/build/.spruce/permissions/permissions.d.ts +3 -0
- package/build/.spruce/permissions/permissions.js +4 -0
- package/build/.spruce/permissions/permissions.types.d.ts +7 -0
- package/build/.spruce/permissions/permissions.types.js +3 -0
- package/build/.spruce/schemas/mercuryChunkingEmitter/v2023_10_21/chunkPaging.schema.d.ts +3 -0
- package/build/.spruce/schemas/{chunkingEmitter → mercuryChunkingEmitter}/v2023_10_21/chunkPaging.schema.js +1 -1
- package/build/.spruce/schemas/schemas.types.d.ts +3 -3
- package/build/.spruce/settings.json +4 -1
- package/build/chunkingEmitter/ChunkingEmitter.d.ts +1 -1
- package/build/chunkingEmitter/MockChunkingEmitter.d.ts +4 -6
- package/build/chunkingEmitter/MockChunkingEmitter.js +5 -1
- package/build/chunkingEmitter/chunkFieldDefinition.js +1 -1
- package/build/esm/.spruce/schemas/mercuryChunkingEmitter/v2023_10_21/chunkPaging.schema.d.ts +3 -0
- package/build/esm/.spruce/schemas/{chunkingEmitter → mercuryChunkingEmitter}/v2023_10_21/chunkPaging.schema.js +1 -1
- package/build/esm/.spruce/schemas/schemas.types.d.ts +3 -3
- package/build/esm/chunkingEmitter/ChunkingEmitter.d.ts +1 -1
- package/build/esm/chunkingEmitter/MockChunkingEmitter.d.ts +4 -6
- package/build/esm/chunkingEmitter/MockChunkingEmitter.js +5 -1
- package/build/esm/chunkingEmitter/chunkFieldDefinition.js +1 -1
- package/package.json +5 -5
- package/build/.spruce/schemas/chunkingEmitter/v2023_10_21/chunkPaging.schema.d.ts +0 -3
- package/build/esm/.spruce/schemas/chunkingEmitter/v2023_10_21/chunkPaging.schema.d.ts +0 -3
|
@@ -2,7 +2,7 @@ export { SpruceSchemas } from '@sprucelabs/spruce-core-schemas/build/.spruce/sch
|
|
|
2
2
|
import { default as SchemaEntity } from '@sprucelabs/schema';
|
|
3
3
|
import * as SpruceSchema from '@sprucelabs/schema';
|
|
4
4
|
declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schemas.types' {
|
|
5
|
-
namespace SpruceSchemas.
|
|
5
|
+
namespace SpruceSchemas.MercuryChunkingEmitter.v2023_10_21 {
|
|
6
6
|
interface ChunkPaging {
|
|
7
7
|
'total': number;
|
|
8
8
|
'current': number;
|
|
@@ -10,7 +10,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
10
10
|
interface ChunkPagingSchema extends SpruceSchema.Schema {
|
|
11
11
|
id: 'chunkPaging';
|
|
12
12
|
version: 'v2023_10_21';
|
|
13
|
-
namespace: '
|
|
13
|
+
namespace: 'MercuryChunkingEmitter';
|
|
14
14
|
name: 'Chunk Paging';
|
|
15
15
|
fields: {
|
|
16
16
|
/** . */
|
|
@@ -27,7 +27,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
interface ChunkPagingEntity extends SchemaEntity<SpruceSchemas.
|
|
30
|
+
interface ChunkPagingEntity extends SchemaEntity<SpruceSchemas.MercuryChunkingEmitter.v2023_10_21.ChunkPagingSchema> {
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { EventName } from '@sprucelabs/mercury-types';
|
|
2
|
-
import { ChunkingEmitter } from './ChunkingEmitter';
|
|
2
|
+
import { ChunkingEmitter, ChunkingEmitterEmitOptions } from './ChunkingEmitter';
|
|
3
3
|
export default class MockChunkingEmitter implements ChunkingEmitter {
|
|
4
4
|
private didEmit;
|
|
5
5
|
private emittedEventName?;
|
|
6
6
|
private emittedItems?;
|
|
7
7
|
private emittedPayloadKey?;
|
|
8
8
|
static lastInstance?: MockChunkingEmitter;
|
|
9
|
+
private emittedTarget?;
|
|
9
10
|
constructor();
|
|
10
11
|
static getLastInstance(): MockChunkingEmitter;
|
|
11
12
|
static reset(): void;
|
|
12
|
-
emit(options:
|
|
13
|
-
|
|
14
|
-
items: Record<string, unknown>[];
|
|
15
|
-
payloadKey: string;
|
|
16
|
-
}): Promise<void>;
|
|
13
|
+
emit(options: ChunkingEmitterEmitOptions): Promise<void>;
|
|
14
|
+
assertDidEmitTarget(target: Record<string, any>): void;
|
|
17
15
|
assertDidEmitPayloadKey(payloadKey: string): void;
|
|
18
16
|
getTotalErrors(): number;
|
|
19
17
|
assertEmittedItems(items: Record<string, any>[]): void;
|
|
@@ -16,11 +16,15 @@ class MockChunkingEmitter {
|
|
|
16
16
|
this.lastInstance = undefined;
|
|
17
17
|
}
|
|
18
18
|
async emit(options) {
|
|
19
|
-
const { eventName, items, payloadKey } = options;
|
|
19
|
+
const { eventName, items, payloadKey, target } = options;
|
|
20
20
|
this.didEmit = true;
|
|
21
21
|
this.emittedEventName = eventName;
|
|
22
22
|
this.emittedItems = items;
|
|
23
23
|
this.emittedPayloadKey = payloadKey;
|
|
24
|
+
this.emittedTarget = target;
|
|
25
|
+
}
|
|
26
|
+
assertDidEmitTarget(target) {
|
|
27
|
+
test_utils_1.assert.isEqualDeep(this.emittedTarget, target, 'You did not chunkingEmitter.emit(...) the expected target!');
|
|
24
28
|
}
|
|
25
29
|
assertDidEmitPayloadKey(payloadKey) {
|
|
26
30
|
this.assertDidEmit();
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.chunkFieldDefinition = void 0;
|
|
7
|
-
const chunkPaging_schema_1 = __importDefault(require("./../.spruce/schemas/
|
|
7
|
+
const chunkPaging_schema_1 = __importDefault(require("./../.spruce/schemas/mercuryChunkingEmitter/v2023_10_21/chunkPaging.schema"));
|
|
8
8
|
function chunkFieldDefinition() {
|
|
9
9
|
return {
|
|
10
10
|
type: 'schema',
|
|
@@ -2,7 +2,7 @@ export { SpruceSchemas } from '@sprucelabs/spruce-core-schemas/build/.spruce/sch
|
|
|
2
2
|
import { default as SchemaEntity } from '@sprucelabs/schema';
|
|
3
3
|
import * as SpruceSchema from '@sprucelabs/schema';
|
|
4
4
|
declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schemas.types' {
|
|
5
|
-
namespace SpruceSchemas.
|
|
5
|
+
namespace SpruceSchemas.MercuryChunkingEmitter.v2023_10_21 {
|
|
6
6
|
interface ChunkPaging {
|
|
7
7
|
'total': number;
|
|
8
8
|
'current': number;
|
|
@@ -10,7 +10,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
10
10
|
interface ChunkPagingSchema extends SpruceSchema.Schema {
|
|
11
11
|
id: 'chunkPaging';
|
|
12
12
|
version: 'v2023_10_21';
|
|
13
|
-
namespace: '
|
|
13
|
+
namespace: 'MercuryChunkingEmitter';
|
|
14
14
|
name: 'Chunk Paging';
|
|
15
15
|
fields: {
|
|
16
16
|
/** . */
|
|
@@ -27,7 +27,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
interface ChunkPagingEntity extends SchemaEntity<SpruceSchemas.
|
|
30
|
+
interface ChunkPagingEntity extends SchemaEntity<SpruceSchemas.MercuryChunkingEmitter.v2023_10_21.ChunkPagingSchema> {
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { EventName } from '@sprucelabs/mercury-types';
|
|
2
|
-
import { ChunkingEmitter } from './ChunkingEmitter';
|
|
2
|
+
import { ChunkingEmitter, ChunkingEmitterEmitOptions } from './ChunkingEmitter';
|
|
3
3
|
export default class MockChunkingEmitter implements ChunkingEmitter {
|
|
4
4
|
private didEmit;
|
|
5
5
|
private emittedEventName?;
|
|
6
6
|
private emittedItems?;
|
|
7
7
|
private emittedPayloadKey?;
|
|
8
8
|
static lastInstance?: MockChunkingEmitter;
|
|
9
|
+
private emittedTarget?;
|
|
9
10
|
constructor();
|
|
10
11
|
static getLastInstance(): MockChunkingEmitter;
|
|
11
12
|
static reset(): void;
|
|
12
|
-
emit(options:
|
|
13
|
-
|
|
14
|
-
items: Record<string, unknown>[];
|
|
15
|
-
payloadKey: string;
|
|
16
|
-
}): Promise<void>;
|
|
13
|
+
emit(options: ChunkingEmitterEmitOptions): Promise<void>;
|
|
14
|
+
assertDidEmitTarget(target: Record<string, any>): void;
|
|
17
15
|
assertDidEmitPayloadKey(payloadKey: string): void;
|
|
18
16
|
getTotalErrors(): number;
|
|
19
17
|
assertEmittedItems(items: Record<string, any>[]): void;
|
|
@@ -24,13 +24,17 @@ export default class MockChunkingEmitter {
|
|
|
24
24
|
}
|
|
25
25
|
emit(options) {
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const { eventName, items, payloadKey } = options;
|
|
27
|
+
const { eventName, items, payloadKey, target } = options;
|
|
28
28
|
this.didEmit = true;
|
|
29
29
|
this.emittedEventName = eventName;
|
|
30
30
|
this.emittedItems = items;
|
|
31
31
|
this.emittedPayloadKey = payloadKey;
|
|
32
|
+
this.emittedTarget = target;
|
|
32
33
|
});
|
|
33
34
|
}
|
|
35
|
+
assertDidEmitTarget(target) {
|
|
36
|
+
assert.isEqualDeep(this.emittedTarget, target, 'You did not chunkingEmitter.emit(...) the expected target!');
|
|
37
|
+
}
|
|
34
38
|
assertDidEmitPayloadKey(payloadKey) {
|
|
35
39
|
this.assertDidEmit();
|
|
36
40
|
assert.isEqual(this.emittedPayloadKey, payloadKey, `I expected chunkingEmitter.emit() with payloadKey '${payloadKey}'! But you emitted ${this.emittedPayloadKey || 'nothing'}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import chunkPagingSchema from './../.spruce/schemas/
|
|
1
|
+
import chunkPagingSchema from './../.spruce/schemas/mercuryChunkingEmitter/v2023_10_21/chunkPaging.schema.js';
|
|
2
2
|
export function chunkFieldDefinition() {
|
|
3
3
|
return {
|
|
4
4
|
type: 'schema',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprucelabs/mercury-chunking-emitter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"build/**/*",
|
|
6
6
|
"!build/__tests__",
|
|
@@ -39,9 +39,11 @@
|
|
|
39
39
|
"release": "semantic-release"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@sprucelabs/esm-postbuild": "^5.0.83",
|
|
42
43
|
"@sprucelabs/jest-json-reporter": "^7.0.110",
|
|
43
44
|
"@sprucelabs/resolve-path-aliases": "^1.1.254",
|
|
44
|
-
"@sprucelabs/
|
|
45
|
+
"@sprucelabs/semantic-release": "^4.0.8",
|
|
46
|
+
"@sprucelabs/spruce-test-fixtures": "^60.0.138",
|
|
45
47
|
"@sprucelabs/test": "^8.0.22",
|
|
46
48
|
"@sprucelabs/test-utils": "^4.0.60",
|
|
47
49
|
"@types/node": "^20.8.7",
|
|
@@ -54,9 +56,7 @@
|
|
|
54
56
|
"prettier": "^3.0.3",
|
|
55
57
|
"ts-node": "^10.9.1",
|
|
56
58
|
"tsc-watch": "^6.0.4",
|
|
57
|
-
"typescript": "^5.2.2"
|
|
58
|
-
"@sprucelabs/esm-postbuild": "^5.0.83",
|
|
59
|
-
"@sprucelabs/semantic-release": "^4.0.8"
|
|
59
|
+
"typescript": "^5.2.2"
|
|
60
60
|
},
|
|
61
61
|
"description": "Need to emit a ton of data!? Just chunk it!",
|
|
62
62
|
"skill": {
|