@infra-blocks/types 0.14.0-alpha.1 → 0.15.0-alpha.0

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,6 +1,5 @@
1
1
  export * from "./func.js";
2
2
  export * from "./guard.js";
3
- export * from "./events.js";
4
3
  export * from "./predicates.js";
5
4
  export * from "./types.js";
6
5
  /**
package/lib/cjs/index.js CHANGED
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.unreachable = void 0;
18
18
  __exportStar(require("./func.js"), exports);
19
19
  __exportStar(require("./guard.js"), exports);
20
- __exportStar(require("./events.js"), exports);
21
20
  __exportStar(require("./predicates.js"), exports);
22
21
  __exportStar(require("./types.js"), exports);
23
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,kDAAgC;AAChC,6CAA2B;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAFD,kCAEC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,kDAAgC;AAChC,6CAA2B;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAFD,kCAEC"}
@@ -1,6 +1,5 @@
1
1
  export * from "./func.js";
2
2
  export * from "./guard.js";
3
- export * from "./events.js";
4
3
  export * from "./predicates.js";
5
4
  export * from "./types.js";
6
5
  /**
package/lib/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from "./func.js";
2
2
  export * from "./guard.js";
3
- export * from "./events.js";
4
3
  export * from "./predicates.js";
5
4
  export * from "./types.js";
6
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/types",
3
- "version": "0.14.0-alpha.1",
3
+ "version": "0.15.0-alpha.0",
4
4
  "description": "Typescript types utility package.",
5
5
  "keywords": [
6
6
  "type",
@@ -1,48 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import EventEmitter from "node:events";
3
- /**
4
- * Describes the interface that "Event" types must implement.
5
- *
6
- * Every key must resolve to a callable that describes the type of the
7
- * handler for the event.
8
- */
9
- export type Events = {
10
- [key: string]: (...args: any[]) => void;
11
- };
12
- /**
13
- * An interface for classes that behave like event emitters.
14
- *
15
- * Those typically allow subscription to a very specific set of events but do not export
16
- * the emitting capabilities.
17
- */
18
- export interface EmitterLike<E extends Events> {
19
- /**
20
- * Subscribes a handler to the specific event type.
21
- * @param event
22
- * @param handler
23
- */
24
- on<Event extends keyof E>(event: Event, handler: E[Event]): this;
25
- }
26
- /**
27
- * A generic implementation of {@link EmitterLike}.
28
- *
29
- * Classes that want to implement the {@link EmitterLike} interface using a NodeJs
30
- * event emitter can do so by extending this class.
31
- *
32
- * It simply delegates `on` calls to the underlying event emitter. It also provides
33
- * an homologous implementation for `emit` that subclasses can use to emit events.
34
- */
35
- export declare class EmitterLikeBase<E extends Events> implements EmitterLike<E> {
36
- protected readonly emitter: EventEmitter;
37
- on<Event extends keyof E>(event: Event, handler: E[Event]): this;
38
- /**
39
- * Emits the event with the given arguments.
40
- *
41
- * @param event The event. This needs to be a key of the events type associated with this class.
42
- * @param args The arguments to pass to the event handler. The types are inferred from the
43
- * handler associated with the event in the events type associated with this class.
44
- *
45
- * @returns Whether the event is being listened to.
46
- */
47
- protected emit<Event extends keyof E>(event: Event, ...args: Parameters<E[Event]>): boolean;
48
- }
package/lib/cjs/events.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EmitterLikeBase = void 0;
7
- const node_events_1 = __importDefault(require("node:events"));
8
- /**
9
- * A generic implementation of {@link EmitterLike}.
10
- *
11
- * Classes that want to implement the {@link EmitterLike} interface using a NodeJs
12
- * event emitter can do so by extending this class.
13
- *
14
- * It simply delegates `on` calls to the underlying event emitter. It also provides
15
- * an homologous implementation for `emit` that subclasses can use to emit events.
16
- */
17
- class EmitterLikeBase {
18
- emitter = new node_events_1.default();
19
- on(event, handler) {
20
- this.emitter.on(event.toString(), handler);
21
- return this;
22
- }
23
- /**
24
- * Emits the event with the given arguments.
25
- *
26
- * @param event The event. This needs to be a key of the events type associated with this class.
27
- * @param args The arguments to pass to the event handler. The types are inferred from the
28
- * handler associated with the event in the events type associated with this class.
29
- *
30
- * @returns Whether the event is being listened to.
31
- */
32
- emit(event, ...args) {
33
- return this.emitter.emit(event.toString(), ...args);
34
- }
35
- }
36
- exports.EmitterLikeBase = EmitterLikeBase;
37
- //# sourceMappingURL=events.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAuC;AA4BvC;;;;;;;;GAQG;AACH,MAAa,eAAe;IACP,OAAO,GAAG,IAAI,qBAAY,EAAE,CAAC;IAEhD,EAAE,CAAwB,KAAY,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACO,IAAI,CACZ,KAAY,EACZ,GAAG,IAA0B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAvBD,0CAuBC"}
@@ -1,48 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import EventEmitter from "node:events";
3
- /**
4
- * Describes the interface that "Event" types must implement.
5
- *
6
- * Every key must resolve to a callable that describes the type of the
7
- * handler for the event.
8
- */
9
- export type Events = {
10
- [key: string]: (...args: any[]) => void;
11
- };
12
- /**
13
- * An interface for classes that behave like event emitters.
14
- *
15
- * Those typically allow subscription to a very specific set of events but do not export
16
- * the emitting capabilities.
17
- */
18
- export interface EmitterLike<E extends Events> {
19
- /**
20
- * Subscribes a handler to the specific event type.
21
- * @param event
22
- * @param handler
23
- */
24
- on<Event extends keyof E>(event: Event, handler: E[Event]): this;
25
- }
26
- /**
27
- * A generic implementation of {@link EmitterLike}.
28
- *
29
- * Classes that want to implement the {@link EmitterLike} interface using a NodeJs
30
- * event emitter can do so by extending this class.
31
- *
32
- * It simply delegates `on` calls to the underlying event emitter. It also provides
33
- * an homologous implementation for `emit` that subclasses can use to emit events.
34
- */
35
- export declare class EmitterLikeBase<E extends Events> implements EmitterLike<E> {
36
- protected readonly emitter: EventEmitter;
37
- on<Event extends keyof E>(event: Event, handler: E[Event]): this;
38
- /**
39
- * Emits the event with the given arguments.
40
- *
41
- * @param event The event. This needs to be a key of the events type associated with this class.
42
- * @param args The arguments to pass to the event handler. The types are inferred from the
43
- * handler associated with the event in the events type associated with this class.
44
- *
45
- * @returns Whether the event is being listened to.
46
- */
47
- protected emit<Event extends keyof E>(event: Event, ...args: Parameters<E[Event]>): boolean;
48
- }
package/lib/esm/events.js DELETED
@@ -1,30 +0,0 @@
1
- import EventEmitter from "node:events";
2
- /**
3
- * A generic implementation of {@link EmitterLike}.
4
- *
5
- * Classes that want to implement the {@link EmitterLike} interface using a NodeJs
6
- * event emitter can do so by extending this class.
7
- *
8
- * It simply delegates `on` calls to the underlying event emitter. It also provides
9
- * an homologous implementation for `emit` that subclasses can use to emit events.
10
- */
11
- export class EmitterLikeBase {
12
- emitter = new EventEmitter();
13
- on(event, handler) {
14
- this.emitter.on(event.toString(), handler);
15
- return this;
16
- }
17
- /**
18
- * Emits the event with the given arguments.
19
- *
20
- * @param event The event. This needs to be a key of the events type associated with this class.
21
- * @param args The arguments to pass to the event handler. The types are inferred from the
22
- * handler associated with the event in the events type associated with this class.
23
- *
24
- * @returns Whether the event is being listened to.
25
- */
26
- emit(event, ...args) {
27
- return this.emitter.emit(event.toString(), ...args);
28
- }
29
- }
30
- //# sourceMappingURL=events.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AA4BvC;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACP,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAEhD,EAAE,CAAwB,KAAY,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACO,IAAI,CACZ,KAAY,EACZ,GAAG,IAA0B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;CACF"}