@jayesol/jayeson.lib.delivery 2.0.7 → 2.0.8

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/lib/index.d.ts CHANGED
@@ -1,217 +1,217 @@
1
- export function generateUUID(): string;
2
- export class IEndPointEventSource {
3
- attachListener(listener :IEndPointEventListener) :void;
4
- detachListener(listener :IEndPointEventListener) :void;
5
- clearListeners() :void;
6
- dispatch(event :EPEvent) :void;
7
- }
8
-
9
- export class IEndPoint extends IEndPointEventSource {
10
- send(wrapper: MessageWrapper): void;
11
- }
12
-
13
- /************* STANDARD EVENTS **************************/
14
- export class EPEvent {
15
- constructor(endpoint: IEndPoint);
16
- endPoint :IEndPoint;
17
- }
18
-
19
- export class EPConnectedEvent extends EPEvent {
20
- constructor(endPoint: IEndPoint);
21
- }
22
-
23
- export class EPDisconnectedEvent extends EPEvent {
24
- constructor(endPoint: IEndPoint);
25
- }
26
-
27
- export class EPConnectionError extends EPEvent {
28
- constructor(endPoint: IEndPoint);
29
- }
30
- /************ END STANDARD EVENTS *************************/
31
-
32
- export class IClient {
33
- constructor(config: any);
34
- }
35
-
36
- export class DefaultClient extends IClient {
37
- constructor(configuration: any, keepAliveMsgGrp: KeepAliveMessageGroup);
38
- connect(): void;
39
- disconnect(): void;
40
- enableKeepAlive(): void;
41
- disableKeepAlive(): void;
42
- sendKeepAlive(): void;
43
- send(wrapper: MessageWrapper): void;
44
- onConnnected(event :EPEvent): void;
45
- onDisconnected(event :EPEvent): void;
46
- onConnectionError(event :EPEvent): void;
47
- processUnparsedMessage(mw :MessageWrapper): boolean;
48
- config: any;
49
- keepAlive: boolean;
50
- }
51
-
52
- export class MetaInformationCode {
53
- constructor(code: number);
54
- code(): number;
55
- }
56
-
57
- export class StreamNameCode extends MetaInformationCode {
58
- constructor();
59
- }
60
-
61
- export class MessageIdCode extends MetaInformationCode {
62
- constructor();
63
- }
64
-
65
- export class MessageWrapper {
66
- constructor(message: any, messageClass: IMessageClass, metaInfo?: MetaInfo);
67
- message: any;
68
- messageClass: IMessageClass;
69
- metaInfo: MetaInfo;
70
- hasMetaInfo(): boolean;
71
- containsMetaInfo(): boolean;
72
- getMetaInfo(k: number): any;
73
- addMetaInfo(k: number, content: any): void;
74
- }
75
-
76
- export class IMessageGroup {
77
- constructor(id: number);
78
- id(): number;
79
- classById(id: number): IMessageClass;
80
- allClasses(): IMessageClass[];
81
- protected _classes: IMessageClass[];
82
- }
83
-
84
- export class KeepAliveMessageGroup extends IMessageGroup {
85
- constructor();
86
- }
87
-
88
- export class GenericMessageGroup extends IMessageGroup {
89
- constructor();
90
- }
91
-
92
- export class IMessageClass {
93
- constructor(msgGroup: IMessageGroup, id: number, instanceClass: any);
94
- id(): number;
95
- group(): IMessageGroup;
96
- inHandlers(): MsgHandler[];
97
- outHandlers(): MsgHandler[];
98
- instanceClass(): any;
99
- }
100
-
101
- export type MsgHandler = {
102
- unpack: (msg: MessageWrapper) => void
103
- };
104
-
105
- export type MetaInfo = { [k: number]: any };
106
-
107
- /****************** MESSAGE CLASS DEFINITIONS *******************/
108
-
109
- export class EmptyMessageClass extends IMessageClass {
110
- constructor(grp: IMessageGroup, id: number);
111
- }
112
-
113
- export class StringMessageClass extends EmptyMessageClass{
114
- constructor(grp: IMessageGroup, id: number);
115
- }
116
-
117
- export class JSonMessageClass extends IMessageClass {
118
- constructor(msgGroup: IMessageGroup, id: number, instanceClass: any);
119
- }
120
-
121
- export abstract class IMessageGroupProcessor {
122
- constructor(msgGroup: IMessageGroup);
123
- group(): IMessageGroup;
124
- abstract process(wrapper: MessageWrapper): void;
125
- }
126
-
127
- export abstract class IPreparsingHook extends IMessageGroupProcessor {
128
- constructor(msgGroup: IMessageGroup);
129
- abstract processUnparsedMessage(wrapper: MessageWrapper): void;
130
- }
131
-
132
- /****************** END OF MESSAGE CLASS DEFINITIONS *******************/
133
-
134
- /**************** AUTH MESSAGE GROUP DEFINITION **********************/
135
-
136
- export class AuthGroup extends IMessageGroup {
137
- constructor();
138
- }
139
-
140
- export class TicketRenew {
141
- constructor (clientId: string, newTicket: any);
142
- getClientId(): string;
143
- getNewTicket(): any;
144
- }
145
-
146
- /**************** END OF AUTH MESSAGE GROUP DEFINITION **********************/
147
-
148
- /**************** STREAM REGISTRATION GROUP **********************/
149
-
150
- export class StreamRegistryMessageGroup extends IMessageGroup {
151
- constructor();
152
- }
153
-
154
- export class StreamRegistryRequest {
155
- constructor(messageGroup: IMessageGroup, streams: any[], requestType: number);
156
- }
157
-
158
- export class StreamRegistryResponse {
159
- constructor(messageGroup: IMessageGroup, streams: any[], responseType: number);
160
- }
161
-
162
- /**************** END OF STREAM REGISTRATION GROUP **********************/
163
-
164
- export class SubscriberConfig {
165
- autoDiscover: boolean;
166
- streamFinder: string;
167
- username: string;
168
- password: string;
169
- //A map of {group and List of streams}
170
- //E:g {"69" : [".*"]}
171
- discoveryPattern: any;
172
- // A map of { Group and Processor}
173
- //E:g {"69" : IMessageGrouProcessor}
174
- processors: any;
175
- schemes: string[];
176
- ticketRenewalInterval: number;
177
- reconnectionInterval: number;
178
- exclusionThreshold: number;
179
- feedScope: string;
180
- discoverByScope: boolean;
181
- }
182
-
183
- interface IEndPointEventListener {
184
- onEvent(eve: EPEvent): void;
185
- }
186
-
187
-
188
- export class Subscriber {
189
- constructor(config: SubscriberConfig);
190
- attachListener(listener: IEndPointEventListener): void;
191
- start(): void;
192
- uuid(): string;
193
- config(): SubscriberConfig;
194
- consumptionState: object;
195
- }
196
-
197
- export namespace Subscriber {
198
- export namespace Event {
199
- export class ConsumptionStart extends EPEvent {
200
- constructor(client: DefaultClient, streams :any);
201
- client :DefaultClient;
202
- streams :any;
203
- }
204
-
205
- export class ConsumptionStop extends EPEvent {
206
- constructor(client: DefaultClient, streams :any);
207
- client :DefaultClient;
208
- streams :any;
209
- }
210
-
211
- export class ConsumptionError extends EPEvent {
212
- constructor(client: DefaultClient, streams :any);
213
- client :DefaultClient;
214
- streams :any;
215
- }
216
- }
217
- }
1
+ export function generateUUID(): string;
2
+ export class IEndPointEventSource {
3
+ attachListener(listener :IEndPointEventListener) :void;
4
+ detachListener(listener :IEndPointEventListener) :void;
5
+ clearListeners() :void;
6
+ dispatch(event :EPEvent) :void;
7
+ }
8
+
9
+ export class IEndPoint extends IEndPointEventSource {
10
+ send(wrapper: MessageWrapper): void;
11
+ }
12
+
13
+ /************* STANDARD EVENTS **************************/
14
+ export class EPEvent {
15
+ constructor(endpoint: IEndPoint);
16
+ endPoint :IEndPoint;
17
+ }
18
+
19
+ export class EPConnectedEvent extends EPEvent {
20
+ constructor(endPoint: IEndPoint);
21
+ }
22
+
23
+ export class EPDisconnectedEvent extends EPEvent {
24
+ constructor(endPoint: IEndPoint);
25
+ }
26
+
27
+ export class EPConnectionError extends EPEvent {
28
+ constructor(endPoint: IEndPoint);
29
+ }
30
+ /************ END STANDARD EVENTS *************************/
31
+
32
+ export class IClient {
33
+ constructor(config: any);
34
+ }
35
+
36
+ export class DefaultClient extends IClient {
37
+ constructor(configuration: any, keepAliveMsgGrp: KeepAliveMessageGroup);
38
+ connect(): void;
39
+ disconnect(): void;
40
+ enableKeepAlive(): void;
41
+ disableKeepAlive(): void;
42
+ sendKeepAlive(): void;
43
+ send(wrapper: MessageWrapper): void;
44
+ onConnnected(event :EPEvent): void;
45
+ onDisconnected(event :EPEvent): void;
46
+ onConnectionError(event :EPEvent): void;
47
+ processUnparsedMessage(mw :MessageWrapper): boolean;
48
+ config: any;
49
+ keepAlive: boolean;
50
+ }
51
+
52
+ export class MetaInformationCode {
53
+ constructor(code: number);
54
+ code(): number;
55
+ }
56
+
57
+ export class StreamNameCode extends MetaInformationCode {
58
+ constructor();
59
+ }
60
+
61
+ export class MessageIdCode extends MetaInformationCode {
62
+ constructor();
63
+ }
64
+
65
+ export class MessageWrapper {
66
+ constructor(message: any, messageClass: IMessageClass, metaInfo?: MetaInfo);
67
+ message: any;
68
+ messageClass: IMessageClass;
69
+ metaInfo: MetaInfo;
70
+ hasMetaInfo(): boolean;
71
+ containsMetaInfo(): boolean;
72
+ getMetaInfo(k: number): any;
73
+ addMetaInfo(k: number, content: any): void;
74
+ }
75
+
76
+ export class IMessageGroup {
77
+ constructor(id: number);
78
+ id(): number;
79
+ classById(id: number): IMessageClass;
80
+ allClasses(): IMessageClass[];
81
+ protected _classes: IMessageClass[];
82
+ }
83
+
84
+ export class KeepAliveMessageGroup extends IMessageGroup {
85
+ constructor();
86
+ }
87
+
88
+ export class GenericMessageGroup extends IMessageGroup {
89
+ constructor();
90
+ }
91
+
92
+ export class IMessageClass {
93
+ constructor(msgGroup: IMessageGroup, id: number, instanceClass: any);
94
+ id(): number;
95
+ group(): IMessageGroup;
96
+ inHandlers(): MsgHandler[];
97
+ outHandlers(): MsgHandler[];
98
+ instanceClass(): any;
99
+ }
100
+
101
+ export type MsgHandler = {
102
+ unpack: (msg: MessageWrapper) => void
103
+ };
104
+
105
+ export type MetaInfo = { [k: number]: any };
106
+
107
+ /****************** MESSAGE CLASS DEFINITIONS *******************/
108
+
109
+ export class EmptyMessageClass extends IMessageClass {
110
+ constructor(grp: IMessageGroup, id: number);
111
+ }
112
+
113
+ export class StringMessageClass extends EmptyMessageClass{
114
+ constructor(grp: IMessageGroup, id: number);
115
+ }
116
+
117
+ export class JSonMessageClass extends IMessageClass {
118
+ constructor(msgGroup: IMessageGroup, id: number, instanceClass: any);
119
+ }
120
+
121
+ export abstract class IMessageGroupProcessor {
122
+ constructor(msgGroup: IMessageGroup);
123
+ group(): IMessageGroup;
124
+ abstract process(wrapper: MessageWrapper): void;
125
+ }
126
+
127
+ export abstract class IPreparsingHook extends IMessageGroupProcessor {
128
+ constructor(msgGroup: IMessageGroup);
129
+ abstract processUnparsedMessage(wrapper: MessageWrapper): void;
130
+ }
131
+
132
+ /****************** END OF MESSAGE CLASS DEFINITIONS *******************/
133
+
134
+ /**************** AUTH MESSAGE GROUP DEFINITION **********************/
135
+
136
+ export class AuthGroup extends IMessageGroup {
137
+ constructor();
138
+ }
139
+
140
+ export class TicketRenew {
141
+ constructor (clientId: string, newTicket: any);
142
+ getClientId(): string;
143
+ getNewTicket(): any;
144
+ }
145
+
146
+ /**************** END OF AUTH MESSAGE GROUP DEFINITION **********************/
147
+
148
+ /**************** STREAM REGISTRATION GROUP **********************/
149
+
150
+ export class StreamRegistryMessageGroup extends IMessageGroup {
151
+ constructor();
152
+ }
153
+
154
+ export class StreamRegistryRequest {
155
+ constructor(messageGroup: IMessageGroup, streams: any[], requestType: number);
156
+ }
157
+
158
+ export class StreamRegistryResponse {
159
+ constructor(messageGroup: IMessageGroup, streams: any[], responseType: number);
160
+ }
161
+
162
+ /**************** END OF STREAM REGISTRATION GROUP **********************/
163
+
164
+ export class SubscriberConfig {
165
+ autoDiscover: boolean;
166
+ streamFinder: string;
167
+ username: string;
168
+ password: string;
169
+ //A map of {group and List of streams}
170
+ //E:g {"69" : [".*"]}
171
+ discoveryPattern: any;
172
+ // A map of { Group and Processor}
173
+ //E:g {"69" : IMessageGrouProcessor}
174
+ processors: any;
175
+ schemes: string[];
176
+ ticketRenewalInterval: number;
177
+ reconnectionInterval: number;
178
+ exclusionThreshold: number;
179
+ feedScope: string;
180
+ discoverByScope: boolean;
181
+ }
182
+
183
+ interface IEndPointEventListener {
184
+ onEvent(eve: EPEvent): void;
185
+ }
186
+
187
+
188
+ export class Subscriber {
189
+ constructor(config: SubscriberConfig);
190
+ attachListener(listener: IEndPointEventListener): void;
191
+ start(): void;
192
+ uuid(): string;
193
+ config(): SubscriberConfig;
194
+ consumptionState: object;
195
+ }
196
+
197
+ export namespace Subscriber {
198
+ export namespace Event {
199
+ export class ConsumptionStart extends EPEvent {
200
+ constructor(client: DefaultClient, streams :any);
201
+ client :DefaultClient;
202
+ streams :any;
203
+ }
204
+
205
+ export class ConsumptionStop extends EPEvent {
206
+ constructor(client: DefaultClient, streams :any);
207
+ client :DefaultClient;
208
+ streams :any;
209
+ }
210
+
211
+ export class ConsumptionError extends EPEvent {
212
+ constructor(client: DefaultClient, streams :any);
213
+ client :DefaultClient;
214
+ streams :any;
215
+ }
216
+ }
217
+ }
package/lib/index.js CHANGED
@@ -1,7 +1 @@
1
- var CoreMessages = require("./CoreMessages");
2
- var DeliveryStack = require("./DeliveryStack");
3
- var Subscriber = require("./Subscriber");
4
-
5
- function __export(e) { for (var r in e) exports.hasOwnProperty(r) || (exports[r] = e[r]) }
6
-
7
- __export(CoreMessages), __export(DeliveryStack), __export(Subscriber);
1
+ var CoreMessages=require("./CoreMessages"),DeliveryStack=require("./DeliveryStack"),Subscriber=require("./Subscriber");function __export(e){for(var r in e)exports.hasOwnProperty(r)||(exports[r]=e[r])}__export(CoreMessages),__export(DeliveryStack),__export(Subscriber);
package/lib/util.js CHANGED
@@ -1,64 +1 @@
1
- var _ = require("underscore")
2
-
3
- /************* UTILITY **********************************/
4
-
5
- /**
6
- * Represent an abstract method
7
- */
8
- function _abstract() { throw "Abstract method is not yet implemented" };
9
-
10
- /**
11
- * Define a class A with definition Def
12
- * This method extend class A from a list of classes Bs (if Bs are defined)
13
- *
14
- * Example: _c(A, {}, B, C) will create a class A which extends B and C with B prioritized over C
15
- * B will be the parent class of A, e.g. the super property of A will point to B
16
- *
17
- * Within A, we can call the constructor of the parent class with A.super(this). We can add in arguments if wanted
18
- * e.g. A.super(this, a, b, c)
19
- *
20
- */
21
- function _c(A, def) {
22
-
23
- if (def === undefined) {
24
- throw "Cannot initialize a class with undefined definition";
25
- }
26
-
27
- if (A === undefined) {
28
- throw "Cannot initialize class Undefined";
29
- }
30
-
31
- // construct the prototype chain
32
- var last;
33
- var obj = {};
34
- var firstIndex;
35
- for (firstIndex = 2; firstIndex < arguments.length; firstIndex ++)
36
- if (arguments[firstIndex] !== undefined && arguments[firstIndex] !== null)
37
- break;
38
-
39
- for (var i = firstIndex + 1; i < arguments.length; i++) {
40
- if (arguments[i] !== undefined && arguments[i] !== null) { // mixin all prototypes into obj first
41
- _.extend(obj, arguments[i].prototype);
42
- }
43
- }
44
-
45
- if (firstIndex < arguments.length) last = arguments[firstIndex];
46
-
47
- if (last !== undefined) A.prototype = Object.create(last.prototype); // put "last" into the A prototype chain
48
-
49
- _.extend(A.prototype, obj); // mixin the combined mixins
50
- _.extend(A.prototype, def); // mixin the definition
51
-
52
- A.prototype.constructor = A;
53
- if (last !== undefined && last !== null) A.super = function(self) {
54
- var params = Array.prototype.slice.call(arguments);
55
- params.shift();
56
- last.apply(self, params); // call the parent constructor
57
- };
58
-
59
- }
60
-
61
- module.exports = exports = {
62
- _abstract : _abstract,
63
- _c : _c
64
- }
1
+ var _=require("underscore");function _abstract(){throw"Abstract method is not yet implemented"}function _c(t,e){if(void 0===e)throw"Cannot initialize a class with undefined definition";if(void 0===t)throw"Cannot initialize class Undefined";var o,r,n={};for(r=2;r<arguments.length&&null==arguments[r];r++);for(var i=r+1;i<arguments.length;i++)null!=arguments[i]&&_.extend(n,arguments[i].prototype);r<arguments.length&&(o=arguments[r]),void 0!==o&&(t.prototype=Object.create(o.prototype)),_.extend(t.prototype,n),_.extend(t.prototype,e),t.prototype.constructor=t,null!=o&&(t.super=function(t){var e=Array.prototype.slice.call(arguments);e.shift(),o.apply(t,e)})}module.exports=exports={_abstract:_abstract,_c:_c};
package/package.json CHANGED
@@ -1,40 +1,42 @@
1
- {
2
- "name": "@jayesol/jayeson.lib.delivery",
3
- "version": "2.0.7",
4
- "description": "Javascript implementation of Delivery",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "scripts": {
8
- "test": "gulp test",
9
- "build": "gulp compile",
10
- "prepublishOnly": "gulp prepublish"
11
- },
12
- "repository": {
13
- "type": "git"
14
- },
15
- "keywords": [
16
- "delivery"
17
- ],
18
- "author": "ryan",
19
- "license": "ISC",
20
- "dependencies": {
21
- "@jayesol/jayeson.lib.streamfinder": "2.0.0",
22
- "eventemitter3": "^5.0.1",
23
- "jquery": "^3.7.1",
24
- "secure-random": "^1.1.2",
25
- "typescript": "^5.3.3",
26
- "underscore": "^1.13.6",
27
- "websocket": "^1.0.34"
28
- },
29
- "devDependencies": {
30
- "del": "^7.1.0",
31
- "glob": "^10.3.10",
32
- "gulp": "^4.0.2",
33
- "gulp-install": "^1.1.0",
34
- "gulp-jasmine": "^4.0.0",
35
- "gulp-typescript": "^6.0.0-alpha.1",
36
- "gulp-uglify": "^3.0.2",
37
- "jasmine": "^5.1.0",
38
- "semver": "^7.5.4"
39
- }
40
- }
1
+ {
2
+ "name": "@jayesol/jayeson.lib.delivery",
3
+ "version": "2.0.8",
4
+ "description": "Javascript implementation of Delivery",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "test": "gulp test",
9
+ "build": "gulp compile",
10
+ "prepack": "npx gulp compile"
11
+ },
12
+ "repository": {
13
+ "type": "git"
14
+ },
15
+ "keywords": [
16
+ "delivery"
17
+ ],
18
+ "author": "ryan",
19
+ "license": "ISC",
20
+ "dependencies": {
21
+ "@jayesol/jayeson.lib.streamfinder": "2.0.0",
22
+ "eventemitter3": "^5.0.1",
23
+ "jquery": "^3.7.1",
24
+ "secure-random": "^1.1.2",
25
+ "typescript": "^5.3.3",
26
+ "underscore": "^1.13.6",
27
+ "websocket": "^1.0.34"
28
+ },
29
+ "devDependencies": {
30
+ "del": "^7.1.0",
31
+ "glob": "^10.3.10",
32
+ "gulp": "^4.0.2",
33
+ "gulp-install": "^1.1.0",
34
+ "gulp-jasmine": "^4.0.0",
35
+ "gulp-terser": "^2.1.0",
36
+ "gulp-typescript": "^6.0.0-alpha.1",
37
+ "gulp-uglify": "^3.0.2",
38
+ "jasmine": "^5.1.0",
39
+ "semver": "^7.5.4",
40
+ "terser": "^5.44.1"
41
+ }
42
+ }