@platecms/delta-client 0.6.0 → 0.8.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.
- package/README.md +309 -96
- package/package.json +4 -6
- package/src/__generated__/fragment-masking.ts +87 -0
- package/src/__generated__/gql.ts +52 -0
- package/src/__generated__/graphql.ts +3141 -0
- package/src/__generated__/{index.d.ts → index.ts} +1 -1
- package/src/api/index.ts +1 -0
- package/src/apollo/index.ts +70 -0
- package/src/graphql/tags/tag.query.gql +5 -0
- package/src/graphql/tags/tags.fragments.gql +17 -0
- package/src/index.ts +1 -0
- package/src/schema/index.spec.ts +211 -0
- package/src/schema/index.ts +18 -0
- package/src/schema/lib/schemas/array.spec.ts +111 -0
- package/src/schema/lib/schemas/array.ts +38 -0
- package/src/schema/lib/schemas/asset.spec.ts +101 -0
- package/src/schema/lib/schemas/asset.ts +12 -0
- package/src/schema/lib/schemas/baseSchema.ts +42 -0
- package/src/schema/lib/schemas/boolean.spec.ts +65 -0
- package/src/schema/lib/schemas/boolean.ts +12 -0
- package/src/schema/lib/schemas/buildingBlock.spec.ts +56 -0
- package/src/schema/lib/schemas/buildingBlock.ts +33 -0
- package/src/schema/lib/schemas/contentItem.spec.ts +61 -0
- package/src/schema/lib/schemas/contentItem.ts +31 -0
- package/src/schema/lib/schemas/contentType.spec.ts +113 -0
- package/src/schema/lib/schemas/contentType.ts +12 -0
- package/src/schema/lib/schemas/date.spec.ts +82 -0
- package/src/schema/lib/schemas/date.ts +17 -0
- package/src/schema/lib/schemas/gridPlacement.spec.ts +77 -0
- package/src/schema/lib/schemas/gridPlacement.ts +12 -0
- package/src/schema/lib/schemas/index.ts +66 -0
- package/src/schema/lib/schemas/number.spec.ts +65 -0
- package/src/schema/lib/schemas/number.ts +12 -0
- package/src/schema/lib/schemas/pathPart.spec.ts +120 -0
- package/src/schema/lib/schemas/pathPart.ts +12 -0
- package/src/schema/lib/schemas/smartText.spec.ts +105 -0
- package/src/schema/lib/schemas/smartText.ts +12 -0
- package/src/schema/lib/schemas/string.spec.ts +65 -0
- package/src/schema/lib/schemas/string.ts +12 -0
- package/src/schema/lib/schemas/tag.spec.ts +89 -0
- package/src/schema/lib/schemas/tag.ts +12 -0
- package/src/schema/lib/utils/isContentValue.spec.ts +111 -0
- package/src/schema/lib/utils/isContentValue.ts +17 -0
- package/src/schema/lib/utils/isPrimitiveValue.spec.ts +38 -0
- package/src/schema/lib/utils/isPrimitiveValue.ts +7 -0
- package/src/slate/index.ts +84 -0
- package/src/utils/{index.d.ts → index.ts} +3 -2
- package/src/utils/lib/connectors/BaseConnector.ts +26 -0
- package/src/utils/lib/connectors/WindowConnector.ts +70 -0
- package/src/utils/lib/events/ConnectorEvents.ts +89 -0
- package/src/utils/lib/events/EventEmitter.ts +19 -0
- package/src/__generated__/fragment-masking.d.ts +0 -19
- package/src/__generated__/fragment-masking.js +0 -22
- package/src/__generated__/fragment-masking.js.map +0 -1
- package/src/__generated__/gql.d.ts +0 -12
- package/src/__generated__/gql.js +0 -13
- package/src/__generated__/gql.js.map +0 -1
- package/src/__generated__/graphql.d.ts +0 -2157
- package/src/__generated__/graphql.js +0 -70
- package/src/__generated__/graphql.js.map +0 -1
- package/src/__generated__/index.js +0 -6
- package/src/__generated__/index.js.map +0 -1
- package/src/api/index.d.ts +0 -2
- package/src/api/index.js +0 -4
- package/src/api/index.js.map +0 -1
- package/src/apollo/index.d.ts +0 -7
- package/src/apollo/index.js +0 -40
- package/src/apollo/index.js.map +0 -1
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -3
- package/src/index.js.map +0 -1
- package/src/schema/index.d.ts +0 -2
- package/src/schema/index.js +0 -8
- package/src/schema/index.js.map +0 -1
- package/src/schema/lib/nodes.d.ts +0 -46
- package/src/schema/lib/nodes.js +0 -14
- package/src/schema/lib/nodes.js.map +0 -1
- package/src/schema/lib/parser.d.ts +0 -12
- package/src/schema/lib/parser.js +0 -49
- package/src/schema/lib/parser.js.map +0 -1
- package/src/schema/lib/schema.d.ts +0 -17
- package/src/schema/lib/schema.js +0 -65
- package/src/schema/lib/schema.js.map +0 -1
- package/src/schema/lib/utils.d.ts +0 -12
- package/src/schema/lib/utils.js +0 -66
- package/src/schema/lib/utils.js.map +0 -1
- package/src/slate/index.d.ts +0 -65
- package/src/slate/index.js +0 -3
- package/src/slate/index.js.map +0 -1
- package/src/utils/index.js +0 -6
- package/src/utils/index.js.map +0 -1
- package/src/utils/lib/connectors/BaseConnector.d.ts +0 -16
- package/src/utils/lib/connectors/BaseConnector.js +0 -17
- package/src/utils/lib/connectors/BaseConnector.js.map +0 -1
- package/src/utils/lib/connectors/WindowConnector.d.ts +0 -10
- package/src/utils/lib/connectors/WindowConnector.js +0 -53
- package/src/utils/lib/connectors/WindowConnector.js.map +0 -1
- package/src/utils/lib/events/ConnectorEvents.d.ts +0 -63
- package/src/utils/lib/events/ConnectorEvents.js +0 -24
- package/src/utils/lib/events/ConnectorEvents.js.map +0 -1
- package/src/utils/lib/events/EventEmitter.d.ts +0 -7
- package/src/utils/lib/events/EventEmitter.js +0 -21
- package/src/utils/lib/events/EventEmitter.js.map +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseConnector = void 0;
|
|
4
|
-
const EventEmitter_1 = require("../events/EventEmitter");
|
|
5
|
-
class BaseConnector extends EventEmitter_1.EventEmitter {
|
|
6
|
-
constructor(id) {
|
|
7
|
-
super();
|
|
8
|
-
this.id = id;
|
|
9
|
-
this.status = "idle";
|
|
10
|
-
}
|
|
11
|
-
updateStatus(status) {
|
|
12
|
-
this.status = status;
|
|
13
|
-
this.emit("statusChanged", status);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.BaseConnector = BaseConnector;
|
|
17
|
-
//# sourceMappingURL=BaseConnector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseConnector.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/utils/lib/connectors/BaseConnector.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AAGtD,MAAsB,aAAc,SAAQ,2BAK1C;IAKA,YAAgC,EAAU;QACxC,KAAK,EAAE,CAAC;QADsB,OAAE,GAAF,EAAE,CAAQ;QAJhC,WAAM,GAAyD,MAAM,CAAC;IAMhF,CAAC;IAEM,YAAY,CAAC,MAA4D;QAC9E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CAKF;AAtBD,sCAsBC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseConnector } from "./BaseConnector";
|
|
2
|
-
import { ConnectorEventOption } from "../events/ConnectorEvents";
|
|
3
|
-
export declare class WindowConnector extends BaseConnector {
|
|
4
|
-
private readonly receiveOn;
|
|
5
|
-
private readonly sendOn;
|
|
6
|
-
connectorName: string;
|
|
7
|
-
constructor(id: string, receiveOn: Window, sendOn: Window);
|
|
8
|
-
send(event: ConnectorEventOption): void;
|
|
9
|
-
connect(): void;
|
|
10
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WindowConnector = void 0;
|
|
4
|
-
const BaseConnector_1 = require("./BaseConnector");
|
|
5
|
-
class WindowConnector extends BaseConnector_1.BaseConnector {
|
|
6
|
-
constructor(id, receiveOn, sendOn) {
|
|
7
|
-
super(id);
|
|
8
|
-
this.receiveOn = receiveOn;
|
|
9
|
-
this.sendOn = sendOn;
|
|
10
|
-
this.connectorName = "window";
|
|
11
|
-
this.receiveOn.addEventListener("message", (event) => {
|
|
12
|
-
if (event.data.type === "offer") {
|
|
13
|
-
this.updateStatus("connecting");
|
|
14
|
-
this.sendOn.postMessage({ type: "answer", payload: null }, "*");
|
|
15
|
-
}
|
|
16
|
-
else if (event.data.type === "answer") {
|
|
17
|
-
this.updateStatus("connected");
|
|
18
|
-
this.sendOn.postMessage({ type: "connected", payload: null }, "*");
|
|
19
|
-
}
|
|
20
|
-
else if (event.data.type === "connected") {
|
|
21
|
-
this.updateStatus("connected");
|
|
22
|
-
}
|
|
23
|
-
else if (this.status === "connected") {
|
|
24
|
-
if (event.data.payload !== null) {
|
|
25
|
-
try {
|
|
26
|
-
const data = JSON.parse(event.data.payload);
|
|
27
|
-
this.emit("message", {
|
|
28
|
-
type: event.data.type,
|
|
29
|
-
payload: data,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
send(event) {
|
|
39
|
-
this.sendOn.postMessage({
|
|
40
|
-
type: event.type,
|
|
41
|
-
payload: JSON.stringify(event.payload),
|
|
42
|
-
}, "*");
|
|
43
|
-
}
|
|
44
|
-
connect() {
|
|
45
|
-
this.updateStatus("connecting");
|
|
46
|
-
this.sendOn.postMessage({
|
|
47
|
-
type: "offer",
|
|
48
|
-
payload: null,
|
|
49
|
-
}, "*");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.WindowConnector = WindowConnector;
|
|
53
|
-
//# sourceMappingURL=WindowConnector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WindowConnector.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/utils/lib/connectors/WindowConnector.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAQhD,MAAa,eAAgB,SAAQ,6BAAa;IAGhD,YACE,EAAU,EACO,SAAiB,EACjB,MAAc;QAE/B,KAAK,CAAC,EAAE,CAAC,CAAC;QAHO,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAQ;QAL1B,kBAAa,GAAG,QAAQ,CAAC;QAS9B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAmB,EAAE,EAAE;YAEjE,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAChC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;gBAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;YAElE,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;gBAC/B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;YAErE,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBAC3C,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;YACjC,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;gBAEvC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;oBAChC,IAAI,CAAC;wBAEH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAiB,CAAC,CAAC;wBACtD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;4BAEnB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;4BACrB,OAAO,EAAE,IAAI;yBACd,CAAC,CAAC;oBACL,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;oBAEjB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,IAAI,CAAC,KAA2B;QACrC,IAAI,CAAC,MAAM,CAAC,WAAW,CACrB;YACE,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC;SACvC,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CACrB;YACE,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,IAAI;SACd,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;CACF;AA7DD,0CA6DC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { BuildingBlock, ExperienceComponent } from "../../../__generated__/graphql";
|
|
2
|
-
export declare enum ConnectorEventType {
|
|
3
|
-
ROOT_EXPERIENCE_COMPONENT_SEND = "root-experience-component-send",
|
|
4
|
-
ROOT_EXPERIENCE_COMPONENT_REQUIRED = "root-experience-component-required",
|
|
5
|
-
ROOT_EXPERIENCE_COMPONENT_SET_MODE = "root-experience-component-set-mode",
|
|
6
|
-
BLUEPRINT_OVERLAY_OPEN = "blueprint-overlay-open",
|
|
7
|
-
EXPERIENCE_COMPONENT_EDIT = "experience-component-edit",
|
|
8
|
-
EXPERIENCE_COMPONENT_REMOVE = "experience-component-remove",
|
|
9
|
-
EXPERIENCE_COMPONENT_CREATE = "experience-component-create",
|
|
10
|
-
GRID_PLACEMENT_UP = "grid-placement-up",
|
|
11
|
-
GRID_PLACEMENT_DOWN = "grid-placement-down",
|
|
12
|
-
MOUSE_UP = "mouse-up",
|
|
13
|
-
MOUSE_MOVE = "mouse-move",
|
|
14
|
-
DRAG_START = "drag-start",
|
|
15
|
-
DRAG_END = "drag-end",
|
|
16
|
-
NEGOTIATE_BUILDING_BLOCKS = "negotiate-building-blocks",
|
|
17
|
-
SNAPSHOT_GENERATE = "snapshot-generate",
|
|
18
|
-
SNAPSHOT_GENERATED = "snapshot-generated"
|
|
19
|
-
}
|
|
20
|
-
export interface ConnectorEvent<T> {
|
|
21
|
-
type: ConnectorEventType;
|
|
22
|
-
payload: T;
|
|
23
|
-
}
|
|
24
|
-
export type RootExperienceComponentSendEvent = ConnectorEvent<ExperienceComponent>;
|
|
25
|
-
export type RootExperienceComponentRequiredEvent = ConnectorEvent<null>;
|
|
26
|
-
export type RootExperienceComponentSetModeEvent = ConnectorEvent<{
|
|
27
|
-
prn?: string;
|
|
28
|
-
uuid?: string;
|
|
29
|
-
mode: "drag" | "edit" | "preview";
|
|
30
|
-
type?: "blueprint" | "experience";
|
|
31
|
-
}>;
|
|
32
|
-
export type ExperienceComponentCreateEvent = ConnectorEvent<{
|
|
33
|
-
index: number;
|
|
34
|
-
}>;
|
|
35
|
-
export type ExperienceComponentEditEvent = ConnectorEvent<{
|
|
36
|
-
prn?: string;
|
|
37
|
-
uuid?: string;
|
|
38
|
-
}>;
|
|
39
|
-
export type ExperienceComponentRemoveEvent = ConnectorEvent<{
|
|
40
|
-
prn?: string;
|
|
41
|
-
uuid?: string;
|
|
42
|
-
}>;
|
|
43
|
-
export type GridPlacementUpEvent = ConnectorEvent<{
|
|
44
|
-
prn?: string;
|
|
45
|
-
uuid?: string;
|
|
46
|
-
}>;
|
|
47
|
-
export type GridPlacementDownEvent = ConnectorEvent<{
|
|
48
|
-
prn?: string;
|
|
49
|
-
uuid?: string;
|
|
50
|
-
}>;
|
|
51
|
-
export type MouseUpEvent = ConnectorEvent<null>;
|
|
52
|
-
export type MouseMoveEvent = ConnectorEvent<{
|
|
53
|
-
x: number;
|
|
54
|
-
y: number;
|
|
55
|
-
}>;
|
|
56
|
-
export type DragStartEvent = ConnectorEvent<BuildingBlock>;
|
|
57
|
-
export type DragEndEvent = ConnectorEvent<null>;
|
|
58
|
-
export type NegotiateBuildingBlocksEvent = ConnectorEvent<Record<string, string>>;
|
|
59
|
-
export type SnapshotGenerateEvent = ConnectorEvent<null>;
|
|
60
|
-
export type SnapshotGeneratedEvent = ConnectorEvent<string>;
|
|
61
|
-
export type ConnectorEventOption = DragEndEvent | DragStartEvent | ExperienceComponentCreateEvent | ExperienceComponentEditEvent | ExperienceComponentRemoveEvent | GridPlacementDownEvent | GridPlacementUpEvent | MouseMoveEvent | MouseUpEvent | NegotiateBuildingBlocksEvent | RootExperienceComponentRequiredEvent | RootExperienceComponentSendEvent | RootExperienceComponentSetModeEvent | SnapshotGeneratedEvent | SnapshotGenerateEvent;
|
|
62
|
-
declare const _default: {};
|
|
63
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConnectorEventType = void 0;
|
|
4
|
-
var ConnectorEventType;
|
|
5
|
-
(function (ConnectorEventType) {
|
|
6
|
-
ConnectorEventType["ROOT_EXPERIENCE_COMPONENT_SEND"] = "root-experience-component-send";
|
|
7
|
-
ConnectorEventType["ROOT_EXPERIENCE_COMPONENT_REQUIRED"] = "root-experience-component-required";
|
|
8
|
-
ConnectorEventType["ROOT_EXPERIENCE_COMPONENT_SET_MODE"] = "root-experience-component-set-mode";
|
|
9
|
-
ConnectorEventType["BLUEPRINT_OVERLAY_OPEN"] = "blueprint-overlay-open";
|
|
10
|
-
ConnectorEventType["EXPERIENCE_COMPONENT_EDIT"] = "experience-component-edit";
|
|
11
|
-
ConnectorEventType["EXPERIENCE_COMPONENT_REMOVE"] = "experience-component-remove";
|
|
12
|
-
ConnectorEventType["EXPERIENCE_COMPONENT_CREATE"] = "experience-component-create";
|
|
13
|
-
ConnectorEventType["GRID_PLACEMENT_UP"] = "grid-placement-up";
|
|
14
|
-
ConnectorEventType["GRID_PLACEMENT_DOWN"] = "grid-placement-down";
|
|
15
|
-
ConnectorEventType["MOUSE_UP"] = "mouse-up";
|
|
16
|
-
ConnectorEventType["MOUSE_MOVE"] = "mouse-move";
|
|
17
|
-
ConnectorEventType["DRAG_START"] = "drag-start";
|
|
18
|
-
ConnectorEventType["DRAG_END"] = "drag-end";
|
|
19
|
-
ConnectorEventType["NEGOTIATE_BUILDING_BLOCKS"] = "negotiate-building-blocks";
|
|
20
|
-
ConnectorEventType["SNAPSHOT_GENERATE"] = "snapshot-generate";
|
|
21
|
-
ConnectorEventType["SNAPSHOT_GENERATED"] = "snapshot-generated";
|
|
22
|
-
})(ConnectorEventType || (exports.ConnectorEventType = ConnectorEventType = {}));
|
|
23
|
-
exports.default = {};
|
|
24
|
-
//# sourceMappingURL=ConnectorEvents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectorEvents.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/utils/lib/events/ConnectorEvents.ts"],"names":[],"mappings":";;;AAEA,IAAY,kBAuBX;AAvBD,WAAY,kBAAkB;IAC5B,uFAAiE,CAAA;IACjE,+FAAyE,CAAA;IAEzE,+FAAyE,CAAA;IAEzE,uEAAiD,CAAA;IAEjD,6EAAuD,CAAA;IACvD,iFAA2D,CAAA;IAC3D,iFAA2D,CAAA;IAE3D,6DAAuC,CAAA;IACvC,iEAA2C,CAAA;IAE3C,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IAErB,6EAAuD,CAAA;IACvD,6DAAuC,CAAA;IACvC,+DAAyC,CAAA;AAC3C,CAAC,EAvBW,kBAAkB,kCAAlB,kBAAkB,QAuB7B;AA+DD,kBAAe,EAAE,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type Listener<T extends unknown[]> = (...args: T) => void;
|
|
2
|
-
export declare class EventEmitter<TEventMap extends Record<string, unknown[]>> {
|
|
3
|
-
private eventListeners;
|
|
4
|
-
on<T extends keyof TEventMap>(eventName: T, listener: Listener<TEventMap[T]>): void;
|
|
5
|
-
emit<T extends keyof TEventMap>(eventName: T, ...args: TEventMap[T]): void;
|
|
6
|
-
}
|
|
7
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventEmitter = void 0;
|
|
4
|
-
class EventEmitter {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.eventListeners = {};
|
|
7
|
-
}
|
|
8
|
-
on(eventName, listener) {
|
|
9
|
-
const listeners = this.eventListeners[eventName] || new Set();
|
|
10
|
-
listeners.add(listener);
|
|
11
|
-
this.eventListeners[eventName] = listeners;
|
|
12
|
-
}
|
|
13
|
-
emit(eventName, ...args) {
|
|
14
|
-
const listeners = this.eventListeners[eventName] || new Set();
|
|
15
|
-
for (const listener of listeners) {
|
|
16
|
-
listener(...args);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.EventEmitter = EventEmitter;
|
|
21
|
-
//# sourceMappingURL=EventEmitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.js","sourceRoot":"","sources":["../../../../../../../../packages/delta-client/src/utils/lib/events/EventEmitter.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IAAzB;QACU,mBAAc,GAA6D,EAAE,CAAC;IAexF,CAAC;IAbQ,EAAE,CAA4B,SAAY,EAAE,QAAgC;QACjF,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAC9D,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC7C,CAAC;IAEM,IAAI,CAA4B,SAAY,EAAE,GAAG,IAAkB;QACxE,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAE9D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;CACF;AAhBD,oCAgBC"}
|