@soundworks/core 5.4.3 → 5.6.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/.gitattributes +1 -0
- package/CHANGELOG.md +5 -0
- package/README.md +6 -0
- package/package.json +18 -12
- package/src/client/Client.js +7 -4
- package/src/client/ClientSocket.js +9 -3
- package/src/common/BasePlugin.js +2 -2
- package/src/common/BasePluginManager.js +2 -2
- package/src/common/BaseStateManager.js +8 -3
- package/src/common/ParameterBag.js +14 -14
- package/src/common/SharedState.js +40 -8
- package/src/common/SharedStateCollection.js +3 -3
- package/src/common/constants.js +2 -0
- package/src/common/isomorphic/colored-logger.browser.js +17 -0
- package/src/common/isomorphic/colored-logger.node.js +19 -0
- package/src/common/isomorphic/web-socket.browser.js +1 -0
- package/src/common/isomorphic/web-socket.node.js +3 -0
- package/src/common/logs/gated-logger.js +30 -0
- package/src/common/logs/warnings.js +36 -0
- package/src/common/version.js +1 -1
- package/src/server/Server.js +23 -35
- package/src/server/ServerClient.js +7 -3
- package/src/server/ServerStateManager.js +10 -6
- package/src/server/SharedStatePrivate.js +19 -0
- package/src/server/create-http-server.js +81 -39
- package/src/server/crypto.js +2 -3
- package/types/client/Client.d.ts.map +1 -1
- package/types/client/ClientPluginManager.d.ts +1 -1
- package/types/client/ClientPluginManager.d.ts.map +1 -1
- package/types/client/ClientSocket.d.ts +4 -0
- package/types/client/ClientSocket.d.ts.map +1 -1
- package/types/client/index.d.ts +3 -3
- package/types/client/index.d.ts.map +1 -1
- package/types/common/BasePluginManager.d.ts +1 -1
- package/types/common/BasePluginManager.d.ts.map +1 -1
- package/types/common/BaseStateManager.d.ts.map +1 -1
- package/types/common/BatchedTransport.d.ts +1 -1
- package/types/common/BatchedTransport.d.ts.map +1 -1
- package/types/common/ParameterBag.d.ts +30 -8
- package/types/common/ParameterBag.d.ts.map +1 -1
- package/types/common/PromiseStore.d.ts +1 -1
- package/types/common/PromiseStore.d.ts.map +1 -1
- package/types/common/SharedState.d.ts +11 -4
- package/types/common/SharedState.d.ts.map +1 -1
- package/types/common/SharedStateCollection.d.ts +7 -7
- package/types/common/SharedStateCollection.d.ts.map +1 -1
- package/types/common/constants.d.ts +1 -0
- package/types/common/constants.d.ts.map +1 -1
- package/types/common/isomorphic/colored-logger.browser.d.ts +8 -0
- package/types/common/isomorphic/colored-logger.browser.d.ts.map +1 -0
- package/types/common/isomorphic/colored-logger.node.d.ts +8 -0
- package/types/common/isomorphic/colored-logger.node.d.ts.map +1 -0
- package/types/common/isomorphic/web-socket.browser.d.ts +10 -0
- package/types/common/isomorphic/web-socket.browser.d.ts.map +1 -0
- package/types/common/isomorphic/web-socket.node.d.ts +2 -0
- package/types/common/isomorphic/web-socket.node.d.ts.map +1 -0
- package/types/common/logs/gated-logger.d.ts +9 -0
- package/types/common/logs/gated-logger.d.ts.map +1 -0
- package/types/common/logs/warnings.d.ts +7 -0
- package/types/common/logs/warnings.d.ts.map +1 -0
- package/types/common/shared-state-types.d.ts +11 -11
- package/types/common/shared-state-types.d.ts.map +1 -1
- package/types/common/version.d.ts +1 -1
- package/types/server/Server.d.ts +5 -5
- package/types/server/Server.d.ts.map +1 -1
- package/types/server/ServerClient.d.ts.map +1 -1
- package/types/server/ServerPluginManager.d.ts +1 -1
- package/types/server/ServerPluginManager.d.ts.map +1 -1
- package/types/server/ServerSocket.d.ts +1 -1
- package/types/server/ServerSocket.d.ts.map +1 -1
- package/types/server/ServerStateManager.d.ts.map +1 -1
- package/types/server/SharedStatePrivate.d.ts +5 -5
- package/types/server/SharedStatePrivate.d.ts.map +1 -1
- package/types/server/create-http-server.d.ts +1 -0
- package/types/server/create-http-server.d.ts.map +1 -1
- package/types/server/crypto.d.ts +1 -1
- package/types/server/crypto.d.ts.map +1 -1
- package/types/server/index.d.ts +3 -3
- package/types/server/index.d.ts.map +1 -1
- package/src/common/logger.js +0 -150
- package/types/common/logger.d.ts +0 -19
- package/types/common/logger.d.ts.map +0 -1
|
@@ -3,7 +3,7 @@ export default SharedState;
|
|
|
3
3
|
/**
|
|
4
4
|
* Callback executed when updates are applied on a {@link SharedState}.
|
|
5
5
|
*/
|
|
6
|
-
export type sharedStateOnUpdateCallback = (newValues:
|
|
6
|
+
export type sharedStateOnUpdateCallback = (newValues: Object, oldValues: Object) => any;
|
|
7
7
|
/**
|
|
8
8
|
* Delete the registered {@link sharedStateOnUpdateCallback}.
|
|
9
9
|
*/
|
|
@@ -108,6 +108,13 @@ declare class SharedState {
|
|
|
108
108
|
* @type {Boolean}
|
|
109
109
|
*/
|
|
110
110
|
get isOwner(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Indicates if the node as siblings, i.e. if several versions of the same state
|
|
113
|
+
* exists on the network
|
|
114
|
+
* Always return true if the state instance is attached
|
|
115
|
+
* @type {Boolean}
|
|
116
|
+
*/
|
|
117
|
+
get hasSiblings(): boolean;
|
|
111
118
|
/**
|
|
112
119
|
* Return the underlying {@link SharedStateClassDescription} or the
|
|
113
120
|
* {@link SharedStateParameterDescription} if `paramName` is given.
|
|
@@ -124,7 +131,7 @@ declare class SharedState {
|
|
|
124
131
|
/**
|
|
125
132
|
* @deprecated Use {@link SharedState#getDescription} instead.
|
|
126
133
|
*/
|
|
127
|
-
getSchema(paramName?:
|
|
134
|
+
getSchema(paramName?: null): any;
|
|
128
135
|
/**
|
|
129
136
|
* Update the values of the state.
|
|
130
137
|
*
|
|
@@ -135,7 +142,7 @@ declare class SharedState {
|
|
|
135
142
|
* @param {object} updates - Key / value pairs of updates to apply to the state.
|
|
136
143
|
* @returns {Promise<Object>} - Promise to the (coerced) updates.
|
|
137
144
|
*/
|
|
138
|
-
set(updates: object): Promise<
|
|
145
|
+
set(updates: object): Promise<Object>;
|
|
139
146
|
/**
|
|
140
147
|
* Update the values of the state.
|
|
141
148
|
*
|
|
@@ -147,7 +154,7 @@ declare class SharedState {
|
|
|
147
154
|
* @param {*} value - Value of the parameter.
|
|
148
155
|
* @returns {Promise<Object>} - Promise to the (coerced) updates.
|
|
149
156
|
*/
|
|
150
|
-
set(name: SharedStateParameterName, value: any): Promise<
|
|
157
|
+
set(name: SharedStateParameterName, value: any): Promise<Object>;
|
|
151
158
|
/**
|
|
152
159
|
* Get the value of a parameter of the state.
|
|
153
160
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedState.d.ts","sourceRoot":"","sources":["../../src/common/SharedState.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SharedState.d.ts","sourceRoot":"","sources":["../../src/common/SharedState.js"],"names":[],"mappings":"AA2BA,qDAAwF;;;;;sDAM7E,MAAM,aAEN,MAAM;;;;;AANjB;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH;IAiBE;;;;;;;;;OAkKC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,wBAEC;IAED;;OAEG;IACH,yBAGC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;;OAKG;IACH,2BAUC;IAwED;;;;;;;;;;;OAWG;IACH,2BARW,MAAM,GAEL,2BAA2B,GAAC,+BAA+B,CAYtE;IAED;;OAEG;IACH,iCAGC;;;;;;;;;;;IAQE,aACQ,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAC3B;;;;;;;;;;;;IAOE,UACQ,wBAAwB,SACxB,GAAC,GACC,OAAO,CAAC,MAAM,CAAC,CAC3B;IA8KD;;;;;;;;;;;;;;OAcG;IACH,UANW,wBAAwB,GACvB,GAAG,CAiBd;IAED;;;;;;;;;;;;;;OAcG;IACH,gBANW,wBAAwB,GACvB,GAAG,CAiBd;IAED;;;;;;;;OAQG;IACH,aAJY,MAAM,CAgBjB;IAED;;;;;;;;;;;;OAYG;IACH,mBAJY,MAAM,CAgBjB;IAED;;;;;;;OAOG;IACH,iBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,eAJY,MAAM,CAMjB;IAED;;;;;;;;OAQG;IACH,uBAiBC;IAED;;;;;;;;;;;;;;OAcG;IACH,uBAUC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,oDAba,iCAAiC,CAkC7C;IAED;;;;;;;OAOG;IACH,4CAGC;IAED;;;;;;OAMG;IACH,4CAOC;IAluBC,eAAe;IACf,mCAAwE;;CAkuB3E"}
|
|
@@ -53,7 +53,7 @@ export default SharedStateCollection;
|
|
|
53
53
|
* Callback to execute when an update is triggered on one of the shared states
|
|
54
54
|
* of the collection.
|
|
55
55
|
*/
|
|
56
|
-
export type sharedStateCollectionOnUpdateCallback = (state: SharedState, newValues:
|
|
56
|
+
export type sharedStateCollectionOnUpdateCallback = (state: SharedState, newValues: Object, oldValues: Object) => any;
|
|
57
57
|
/**
|
|
58
58
|
* Delete the registered {@link sharedStateCollectionOnUpdateCallback} when executed.
|
|
59
59
|
*/
|
|
@@ -102,7 +102,7 @@ export type sharedStateCollectionDeleteOnChangeCallback = () => any;
|
|
|
102
102
|
* @hideconstructor
|
|
103
103
|
*/
|
|
104
104
|
declare class SharedStateCollection {
|
|
105
|
-
constructor(stateManager: any, className: any, filter?:
|
|
105
|
+
constructor(stateManager: any, className: any, filter?: null, options?: {});
|
|
106
106
|
/**
|
|
107
107
|
* Size of the collection, alias `size`
|
|
108
108
|
* @type {number}
|
|
@@ -126,7 +126,7 @@ declare class SharedStateCollection {
|
|
|
126
126
|
/**
|
|
127
127
|
* @deprecated Use {@link SharedStateCollection#getDescription} instead.
|
|
128
128
|
*/
|
|
129
|
-
getSchema(paramName?:
|
|
129
|
+
getSchema(paramName?: null): any;
|
|
130
130
|
/**
|
|
131
131
|
* Return the underlying {@link SharedStateClassDescription} or the
|
|
132
132
|
* {@link SharedStateParameterDescription} if `paramName` is given.
|
|
@@ -152,7 +152,7 @@ declare class SharedStateCollection {
|
|
|
152
152
|
* Return the current values of all the states in the collection.
|
|
153
153
|
* @return {Object[]}
|
|
154
154
|
*/
|
|
155
|
-
getValues():
|
|
155
|
+
getValues(): Object[];
|
|
156
156
|
/**
|
|
157
157
|
* Return the current values of all the states in the collection.
|
|
158
158
|
*
|
|
@@ -164,7 +164,7 @@ declare class SharedStateCollection {
|
|
|
164
164
|
*
|
|
165
165
|
* @return {Object[]}
|
|
166
166
|
*/
|
|
167
|
-
getValuesUnsafe():
|
|
167
|
+
getValuesUnsafe(): Object[];
|
|
168
168
|
/**
|
|
169
169
|
* Return the current param value of all the states in the collection.
|
|
170
170
|
*
|
|
@@ -193,7 +193,7 @@ declare class SharedStateCollection {
|
|
|
193
193
|
* @param {object} updates - key / value pairs of updates to apply to the collection.
|
|
194
194
|
* @returns {Promise<Array<Object>>} - Promise to the list of (coerced) updates.
|
|
195
195
|
*/
|
|
196
|
-
set(updates: object): Promise<Array<
|
|
196
|
+
set(updates: object): Promise<Array<Object>>;
|
|
197
197
|
/**
|
|
198
198
|
* Update all states of the collection with given values.
|
|
199
199
|
*
|
|
@@ -205,7 +205,7 @@ declare class SharedStateCollection {
|
|
|
205
205
|
* @param {*} value - Value of the parameter.
|
|
206
206
|
* @returns {Promise<Array<Object>>} - Promise to the list of (coerced) updates.
|
|
207
207
|
*/
|
|
208
|
-
set(name: SharedStateParameterName, value: any): Promise<Array<
|
|
208
|
+
set(name: SharedStateParameterName, value: any): Promise<Array<Object>>;
|
|
209
209
|
/**
|
|
210
210
|
* Register a function to execute when any shared state of the collection is updated.
|
|
211
211
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedStateCollection.d.ts","sourceRoot":"","sources":["../../src/common/SharedStateCollection.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH,uDAA4F;;;;;;4DApDjF,WAAW;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SharedStateCollection.d.ts","sourceRoot":"","sources":["../../src/common/SharedStateCollection.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH,uDAA4F;;;;;;4DApDjF,WAAW,aACX,MAAM,aAEN,MAAM;;;;;;;;4DAcN,WAAW;;;;;;;;;4DAcX,WAAW;;;;;;;;;;;;;AAuBtB;;;;;;;;;;;;;;;;;GAiBG;AACH;IAaE,4EAKC;IAuCD;;;;OAIG;IACH,uBAHU,MAAM,CAKf;IAED;;;OAGG;IACH,YAFU,MAAM,CAIf;IAED;;;OAGG;IACH,wBAEC;IAED;;OAEG;IACH,yBAGC;IAED;;OAEG;IACH,iCAGC;IAED;;;;;;;;;;;OAWG;IACH,2BARW,MAAM,GAEL,2BAA2B,GAAC,+BAA+B,CAgBtE;IAED;;;;;;OAMG;IACH,eAJY,MAAM,CAUjB;IAED;;;OAGG;IACH,aAFY,MAAM,EAAE,CAInB;IAED;;;;;;;;;;OAUG;IACH,mBAFY,MAAM,EAAE,CAInB;IAED;;;;;OAKG;IACH,mBAFY,GAAG,EAAE,CAMhB;IAED;;;;;;;;;OASG;IACH,yBAFY,GAAG,EAAE,CAMhB;;;;;;;;;;;IAQE,aACQ,MAAM,GACJ,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAClC;;;;;;;;;;;;IAOE,UACQ,wBAAwB,SACxB,GAAC,GACC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAClC;IAwBD;;;;;;;;;OASG;IACH,mBAPW,qCAAqC,8BAInC,2CAA2C,CAyBvD;IAED;;;;;;;;;;OAUG;IACH,mBAPW,qCAAqC,oBAErC,OAAO,GAEL,2CAA2C,CAWvD;IAED;;;;;;;;OAQG;IACH,mBALW,qCAAqC,GAEnC,2CAA2C,CAOvD;IAED;;;;;;;;;;;OAWG;IACH,mBARW,qCAAqC,8BAEnC,2CAA2C,CAcvD;IAED;;;OAGG;IACH,wBAUC;IAED;;;;;OAKG;IACH,8BAEC;IAED;;;;;;OAMG;IACH,2BAEC;IAED;;;;;;;OAOG;IACH,8BAEC;IAED;;;;OAIG;IACH,2BAEC;IAED;;;;;;;OAOG;IACH,0BAEC;IAED;;;;;;;;;;;;;;OAcG;IACH,OAVa,CAAC,gCAKH,CAAC,mBAGA,CAAC,CASZ;IA5YD,eAAe;IACf,qCAkCC;IA2WD;;OAEG;IACH;;;;;MAYC;;CACF"}
|
|
@@ -29,6 +29,7 @@ export const DELETE_SHARED_STATE_CLASS: "s:d:s";
|
|
|
29
29
|
export const GET_CLASS_DESCRIPTION_REQUEST: "s:s:req";
|
|
30
30
|
export const GET_CLASS_DESCRIPTION_RESPONSE: "s:s:res";
|
|
31
31
|
export const GET_CLASS_DESCRIPTION_ERROR: "s:s:err";
|
|
32
|
+
export const HAS_SIBLINGS_NOTIFICATION: "s:hs:not";
|
|
32
33
|
export const CONTEXT_ENTER_REQUEST: "c:en:req";
|
|
33
34
|
export const CONTEXT_ENTER_RESPONSE: "c:en:res";
|
|
34
35
|
export const CONTEXT_ENTER_ERROR: "c:en:err";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.js"],"names":[],"mappings":"AACA,wBAAyB,CAAC,CAAC,CAAC;AAE5B,mCAAuC;AACvC,2BAA4B,QAAQ,CAAC;AACrC,2BAA4B,QAAQ,CAAC;AAGrC,wCAAyC,KAAK,CAAC;AAG/C,6BAA8B,SAAS,CAAC;AACxC,8BAA+B,SAAS,CAAC;AACzC,2BAA4B,SAAS,CAAC;AAEtC,6BAA8B,UAAU,CAAC;AACzC,8BAA+B,UAAU,CAAC;AAC1C,2BAA4B,UAAU,CAAC;AACvC,kCAAmC,UAAU,CAAC;AAE9C,6BAA8B,SAAS,CAAC;AACxC,8BAA+B,SAAS,CAAC;AACzC,2BAA4B,SAAS,CAAC;AAEtC,6BAA8B,UAAU,CAAC;AACzC,8BAA+B,UAAU,CAAC;AAC1C,2BAA4B,UAAU,CAAC;AAEvC,8BAA+B,SAAS,CAAC;AACzC,+BAAgC,SAAS,CAAC;AAC1C,4BAA6B,SAAS,CAAC;AACvC,mCAAoC,SAAS,CAAC;AAE9C,qCAAsC,UAAU,CAAC;AAEjD,6BAA8B,SAAS,CAAC;AACxC,8BAA+B,SAAS,CAAC;AACzC,2BAA4B,QAAQ,CAAC;AACrC,kCAAmC,SAAS,CAAC;AAE7C,wCAAyC,OAAO,CAAC;AAEjD,4CAA6C,SAAS,CAAC;AACvD,6CAA8C,SAAS,CAAC;AACxD,0CAA2C,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.js"],"names":[],"mappings":"AACA,wBAAyB,CAAC,CAAC,CAAC;AAE5B,mCAAuC;AACvC,2BAA4B,QAAQ,CAAC;AACrC,2BAA4B,QAAQ,CAAC;AAGrC,wCAAyC,KAAK,CAAC;AAG/C,6BAA8B,SAAS,CAAC;AACxC,8BAA+B,SAAS,CAAC;AACzC,2BAA4B,SAAS,CAAC;AAEtC,6BAA8B,UAAU,CAAC;AACzC,8BAA+B,UAAU,CAAC;AAC1C,2BAA4B,UAAU,CAAC;AACvC,kCAAmC,UAAU,CAAC;AAE9C,6BAA8B,SAAS,CAAC;AACxC,8BAA+B,SAAS,CAAC;AACzC,2BAA4B,SAAS,CAAC;AAEtC,6BAA8B,UAAU,CAAC;AACzC,8BAA+B,UAAU,CAAC;AAC1C,2BAA4B,UAAU,CAAC;AAEvC,8BAA+B,SAAS,CAAC;AACzC,+BAAgC,SAAS,CAAC;AAC1C,4BAA6B,SAAS,CAAC;AACvC,mCAAoC,SAAS,CAAC;AAE9C,qCAAsC,UAAU,CAAC;AAEjD,6BAA8B,SAAS,CAAC;AACxC,8BAA+B,SAAS,CAAC;AACzC,2BAA4B,QAAQ,CAAC;AACrC,kCAAmC,SAAS,CAAC;AAE7C,wCAAyC,OAAO,CAAC;AAEjD,4CAA6C,SAAS,CAAC;AACvD,6CAA8C,SAAS,CAAC;AACxD,0CAA2C,SAAS,CAAC;AAErD,wCAAyC,UAAU,CAAC;AAGpD,oCAAqC,UAAU,CAAC;AAChD,qCAAsC,UAAU,CAAC;AACjD,kCAAmC,UAAU,CAAC;AAE9C,mCAAoC,UAAU,CAAC;AAC/C,oCAAqC,UAAU,CAAC;AAChD,iCAAkC,UAAU,CAAC;AAG7C,uCAAwC,UAAU,CAAC;AACnD,wCAAyC,UAAU,CAAC;AACpD,qCAAsC,UAAU,CAAC;AAGjD,+BAAgC,WAAW,CAAC;AAC5C,sCAAiD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colored-logger.browser.d.ts","sourceRoot":"","sources":["../../../src/common/isomorphic/colored-logger.browser.js"],"names":[],"mappings":";IAIE,+BAEC;IACD,6BAEC;IACD,8BAEC;IACD,+BAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colored-logger.node.d.ts","sourceRoot":"","sources":["../../../src/common/isomorphic/colored-logger.node.js"],"names":[],"mappings":";IAME,+BAEC;IACD,6BAEC;IACD,8BAEC;IACD,+BAEC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
3
|
+
prototype: WebSocket;
|
|
4
|
+
readonly CONNECTING: 0;
|
|
5
|
+
readonly OPEN: 1;
|
|
6
|
+
readonly CLOSING: 2;
|
|
7
|
+
readonly CLOSED: 3;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=web-socket.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-socket.browser.d.ts","sourceRoot":"","sources":["../../../src/common/isomorphic/web-socket.browser.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-socket.node.d.ts","sourceRoot":"","sources":["../../../src/common/isomorphic/web-socket.node.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gated-logger.d.ts","sourceRoot":"","sources":["../../../src/common/logs/gated-logger.js"],"names":[],"mappings":";;IASE,+BAIC;IACD,6BAIC;IACD,8BAIC;IACD,+BAIC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
function versionDiscrepancies(clientRole: any, clientVersion: any, serverVersion: any): void;
|
|
3
|
+
function deprecated(oldAPI: any, newAPI: any, lastSupportedVersion: any): void;
|
|
4
|
+
function removed(oldAPI: any, hint: any, lastSupportedVersion: any): never;
|
|
5
|
+
}
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=warnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../src/common/logs/warnings.js"],"names":[],"mappings":";IAGE,6FAaC;IAED,+EAOC;IAED,2EAOC"}
|
|
@@ -35,18 +35,18 @@ type SharedStateParameterDescription = {
|
|
|
35
35
|
* - Defines if the parameter is nullable.
|
|
36
36
|
* When `true` the parameter `default` is set to `null`.
|
|
37
37
|
*/
|
|
38
|
-
nullable?: boolean;
|
|
38
|
+
nullable?: boolean | undefined;
|
|
39
39
|
/**
|
|
40
40
|
* - Define if the parameter is a volatile, i.e.
|
|
41
41
|
* its value only exists on an update and is set back to `null` after propagation.
|
|
42
42
|
* When `true`, `nullable` is automatically set to `true` and `default` to `null`.
|
|
43
43
|
*/
|
|
44
|
-
event?: boolean;
|
|
44
|
+
event?: boolean | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* - When set to true, the parameter must be
|
|
47
47
|
* provided at the creation of the shared state.
|
|
48
48
|
*/
|
|
49
|
-
required?: boolean;
|
|
49
|
+
required?: boolean | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* - When set to `false`, an update will
|
|
52
52
|
* trigger the propagation of a parameter even when its value didn't change.
|
|
@@ -55,7 +55,7 @@ type SharedStateParameterDescription = {
|
|
|
55
55
|
* option (which has no state per se). Hence, setting this options to `false` if
|
|
56
56
|
* `event=true` makes no sens.
|
|
57
57
|
*/
|
|
58
|
-
filterChange?: boolean;
|
|
58
|
+
filterChange?: boolean | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* - When set to `true`, an update will
|
|
61
61
|
* trigger the update listeners immediately on the node that generated the update,
|
|
@@ -66,7 +66,7 @@ type SharedStateParameterDescription = {
|
|
|
66
66
|
* Setting this modifier to `true` will trigger the `onUpdate` callback synchronously
|
|
67
67
|
* according to the `set` call.
|
|
68
68
|
*/
|
|
69
|
-
immediate?: boolean;
|
|
69
|
+
immediate?: boolean | undefined;
|
|
70
70
|
/**
|
|
71
71
|
* - When set to true, the parameter is never
|
|
72
72
|
* propagated on the network (hence it is no longer a shared parameter :). This
|
|
@@ -75,7 +75,7 @@ type SharedStateParameterDescription = {
|
|
|
75
75
|
* Setting this modifier to `true` will trigger the `onUpdate` callback synchronously
|
|
76
76
|
* according to the `set` call.
|
|
77
77
|
*/
|
|
78
|
-
local?: boolean;
|
|
78
|
+
local?: boolean | undefined;
|
|
79
79
|
/**
|
|
80
80
|
* - When set to false, the acknowledgement
|
|
81
81
|
* is never sent back to the shared state that initiated an update. This can be
|
|
@@ -83,25 +83,25 @@ type SharedStateParameterDescription = {
|
|
|
83
83
|
* Setting this modifier to `true` will trigger the `onUpdate` callback synchronously
|
|
84
84
|
* according to the `set` call.
|
|
85
85
|
*/
|
|
86
|
-
acknowledge?: boolean;
|
|
86
|
+
acknowledge?: boolean | undefined;
|
|
87
87
|
/**
|
|
88
88
|
* - Minimum value of the parameter. Only applies
|
|
89
89
|
* for `integer` and `float` types.
|
|
90
90
|
*/
|
|
91
|
-
min?: number;
|
|
91
|
+
min?: number | undefined;
|
|
92
92
|
/**
|
|
93
93
|
* - Maximum value of the parameter. Only applies
|
|
94
94
|
* for `integer` and `float` types.
|
|
95
95
|
*/
|
|
96
|
-
max?: number;
|
|
96
|
+
max?: number | undefined;
|
|
97
97
|
/**
|
|
98
98
|
* - Possible values of the parameter. Only applies and
|
|
99
99
|
* mandatory for `enum` type.
|
|
100
100
|
*/
|
|
101
|
-
list?:
|
|
101
|
+
list?: any[] | undefined;
|
|
102
102
|
/**
|
|
103
103
|
* - Optional metadata of the parameter.
|
|
104
104
|
*/
|
|
105
|
-
metas?: object;
|
|
105
|
+
metas?: object | undefined;
|
|
106
106
|
};
|
|
107
107
|
//# sourceMappingURL=shared-state-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-state-types.d.ts","sourceRoot":"","sources":["../../src/common/shared-state-types.js"],"names":[],"mappings":";;;4BAGa,MAAM;;;;;;;;;;;;;;;;gCAoCN,MAAM;;;;;;;;UAOL,SAAS,GAAC,QAAQ,GAAC,SAAS,GAAC,OAAO,GAAC,MAAM,GAAC,KAAK;;;;;aACjD,GAAG
|
|
1
|
+
{"version":3,"file":"shared-state-types.d.ts","sourceRoot":"","sources":["../../src/common/shared-state-types.js"],"names":[],"mappings":";;;4BAGa,MAAM;;;;;;;;;;;;;;;;gCAoCN,MAAM;;;;;;;;UAOL,SAAS,GAAC,QAAQ,GAAC,SAAS,GAAC,OAAO,GAAC,MAAM,GAAC,KAAK;;;;;aACjD,GAAG"}
|
package/types/server/Server.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ declare class Server {
|
|
|
81
81
|
* @type {'idle'|'inited'|'started'|'errored'}
|
|
82
82
|
*/
|
|
83
83
|
get status(): "idle" | "inited" | "started" | "errored";
|
|
84
|
-
set router(router:
|
|
84
|
+
set router(router: null);
|
|
85
85
|
/**
|
|
86
86
|
* Instance of the router if any.
|
|
87
87
|
*
|
|
@@ -100,20 +100,20 @@ declare class Server {
|
|
|
100
100
|
* // expose assets located in the `soundfiles` directory on the network
|
|
101
101
|
* server.router.use('/soundfiles', express.static('soundfiles')));
|
|
102
102
|
*/
|
|
103
|
-
get router():
|
|
103
|
+
get router(): null;
|
|
104
104
|
/**
|
|
105
105
|
* Instance of the Node.js `http.Server` or `https.Server`
|
|
106
106
|
*
|
|
107
107
|
* @see {@link https://nodejs.org/api/http.html#class-httpserver}
|
|
108
108
|
* @see {@link https://nodejs.org/api/https.html#class-httpsserver}
|
|
109
109
|
*/
|
|
110
|
-
get httpServer():
|
|
110
|
+
get httpServer(): null;
|
|
111
111
|
/**
|
|
112
112
|
* Simple key / value filesystem database with Promise based Map API.
|
|
113
113
|
*
|
|
114
114
|
* Basically a tiny wrapper around the {@link https://github.com/lukechilds/keyv} package.
|
|
115
115
|
*/
|
|
116
|
-
get db():
|
|
116
|
+
get db(): null;
|
|
117
117
|
/**
|
|
118
118
|
* Instance of the {@link ServerSockets} class.
|
|
119
119
|
*
|
|
@@ -252,7 +252,7 @@ declare class Server {
|
|
|
252
252
|
* be internally used to check the WebSocket connection and reject it if the
|
|
253
253
|
* token is invalid.
|
|
254
254
|
*/
|
|
255
|
-
generateAuthToken(req: any):
|
|
255
|
+
generateAuthToken(req: any): any;
|
|
256
256
|
/**
|
|
257
257
|
* Check if the given client is trusted, i.e. config.env.type == 'production'
|
|
258
258
|
* and the client is protected behind a password.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../src/server/Server.js"],"names":[],"mappings":"AA2FA,sDAA0F;AAC1F,0DAAmG;AAEnG,2DAAqG;;AAErG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAuBE;;;;;;;;OAQG;IACH,oBARW,YAAY,EA+FtB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAFU,YAAY,CAIrB;IAED;;;;OAIG;IACH,eAFU,MAAM,CAIf;IAED;;;;OAIG;IACH,mBAHU,MAAM,CAKf;IAED;;;;OAIG;IACH,cAFU,MAAM,GAAC,QAAQ,GAAC,SAAS,GAAC,SAAS,CAI5C;IAwBD,
|
|
1
|
+
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../src/server/Server.js"],"names":[],"mappings":"AA2FA,sDAA0F;AAC1F,0DAAmG;AAEnG,2DAAqG;;AAErG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAuBE;;;;;;;;OAQG;IACH,oBARW,YAAY,EA+FtB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAFU,YAAY,CAIrB;IAED;;;;OAIG;IACH,eAFU,MAAM,CAIf;IAED;;;;OAIG;IACH,mBAHU,MAAM,CAKf;IAED;;;;OAIG;IACH,cAFU,MAAM,GAAC,QAAQ,GAAC,SAAS,GAAC,SAAS,CAI5C;IAwBD,yBAaC;IAnCD;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAEC;IAiBD;;;;;OAKG;IACH,uBAEC;IAED;;;;OAIG;IACH,eAEC;IAED;;;;OAIG;IACH,eAFU,aAAa,CAItB;IAED;;;;OAIG;IACH,8CAEC;IAED;;;;OAIG;IACH,oBAFU,kBAAkB,CAI3B;IAED;;;;OAIG;IACH,gDAEC;IAqBD;;;;;;;;;;;OAWG;IACH,kDAGC;IAED;;;;;;;;;;;;;;;OAeG;IACH,iBAPa,OAAO,CAAC,WAAW,CAAC,CAahC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,sBA2CC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,sBAgCC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,sBAqBC;IAED,8CAGC;IAED,iDAGC;IAiHD,eAAe;IACf,8BAMC;IAED;;;;;;OAMG;IACH,iCAcC;IAqBD;;;;;;OAMG;IACH,wBAHW,YAAY,GACV,OAAO,CAQnB;IAED;;;;;;;;OAQG;IAEH,yBANW,MAAM,YACN,MAAM,SACN,MAAM,GACJ,OAAO,CAqBnB;IAED;;;;;;;OAOG;IACH,2BAmBC;IAED;;OAEG;IACH,sCAGC;IAlPD;;;OAGG;IACH,oCAwGC;IAmCD,eAAe;IACf,wCAgBC;IA3iBC,eAAe;IACf,yCAAgD;;CA6nBnD;0BA/yBM,oBAAoB;gCApBpB,0BAA0B;+BAS1B,yBAAyB;iCAdzB,2BAA2B;yBAN3B,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerClient.d.ts","sourceRoot":"","sources":["../../src/server/ServerClient.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerClient.d.ts","sourceRoot":"","sources":["../../src/server/ServerClient.js"],"names":[],"mappings":"AASA,+CAA2E;;AAE3E;;;;;GAKG;AACH;IAME;;;OAGG;IACH,kCAFW,YAAY,EAatB;IAED;;;;OAIG;IACH,mBAEC;IAED;;;;OAIG;IACH,iBAEC;IAED;;;;OAIG;IACH,mBAEC;IAED;;;;OAIG;IACH,cAFU,YAAY,CAIrB;IAzCC;;;OAGG;IACH,6BAA+B;;CAsClC"}
|
|
@@ -84,7 +84,7 @@ declare class ServerPluginManager<T> extends BasePluginManager {
|
|
|
84
84
|
* // server-side
|
|
85
85
|
* server.pluginManager.register('user-defined-id', pluginFactory);
|
|
86
86
|
*/
|
|
87
|
-
register(id: string, ctor: T<ServerPlugin>, options?: object, deps?:
|
|
87
|
+
register(id: string, ctor: T<ServerPlugin>, options?: object, deps?: array): void;
|
|
88
88
|
/**
|
|
89
89
|
* Retrieve a fully started instance of a registered plugin.
|
|
90
90
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerPluginManager.d.ts","sourceRoot":"","sources":["../../src/server/ServerPluginManager.js"],"names":[],"mappings":"AAMA,uEAA8H;AAC9H,0DAAmG;AACnG,6DAAyG;;AAEzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,kCAFa,CAAC;IAGZ,uBAAuB;IACvB,yBAMC;IA2CD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAfW,MAAM,QAEN,CAAC,CAAC,YAAY,CAAC,YACf,MAAM,
|
|
1
|
+
{"version":3,"file":"ServerPluginManager.d.ts","sourceRoot":"","sources":["../../src/server/ServerPluginManager.js"],"names":[],"mappings":"AAMA,uEAA8H;AAC9H,0DAAmG;AACnG,6DAAyG;;AAEzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,kCAFa,CAAC;IAGZ,uBAAuB;IACvB,yBAMC;IA2CD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAfW,MAAM,QAEN,CAAC,CAAC,YAAY,CAAC,YACf,MAAM,SACN,KAAK,QAkBf;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,cAFa,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAQpC;IAjGD,eAAe;IACf,qDAYC;IAED,eAAe;IACf,wCAUC;IAED,eAAe;IACf,2CAUC;CA2DF;8BA3KM,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerSocket.d.ts","sourceRoot":"","sources":["../../src/server/ServerSocket.js"],"names":[],"mappings":"AAgBA,4CAAqE;AACrE,6CAAsE;;AAEtE;;;;;;;;;;;GAWG;AACH;IAME,mCAmFC;IA8CD;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"ServerSocket.d.ts","sourceRoot":"","sources":["../../src/server/ServerSocket.js"],"names":[],"mappings":"AAgBA,4CAAqE;AACrE,6CAAsE;;AAEtE;;;;;;;;;;;GAWG;AACH;IAME,mCAmFC;IA8CD;;OAEG;IACH,oBAEC;IAED;;;;;OAKG;IACH,kBAFU,MAAM,CAIf;IAED;;;;;;OAMG;IACH,cAJW,MAAM,WACH,GAAC,EAAA,QAkBd;IAED;;;;;;;OAOG;IACH,qBALW,MAAM,4BAYhB;IAED;;;;;OAKG;IACH,wBAHW,MAAM,4BAYhB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAQhB;IAtHD;;;;;;;OAOG;IACH,2BAsBC;;CAyFF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerStateManager.d.ts","sourceRoot":"","sources":["../../src/server/ServerStateManager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerStateManager.d.ts","sourceRoot":"","sources":["../../src/server/ServerStateManager.js"],"names":[],"mappings":"AA4CA,yDAAiG;AACjG,4DAAuG;AACvG,yDAAiG;AACjG,kEAAoH;AACpH,8DAA4G;AAE5G,yDAAiG;;;;;AAGjG;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH;IA0TE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,uBApBW,oBAAoB,oBACpB,2BAA2B,QA2CrC;IAED;;OAEG;IACH,4DAGC;IAED;;;;;;;OAOG;IACH,uBAFW,oBAAoB,QA8B9B;IAED;;OAEG;IACH,mCAGC;IAED;;;;;OAKG;IACH,0BAHW,oBAAoB,GAClB,OAAO,CAInB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,8BAzBW,MAAM,cACN,4BAA4B,YAqCtC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,8BAnBW,MAAM,6BAgChB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,8BAxBW,MAAM,cACN,4BAA4B,YAoCtC;IAxjBD,eAAe;IACf,4BAIC;IAED,eAAe;IACf,gDAiBC;IAED,eAAe;IACf,4CAEC;IAED,eAAe;IACf,uCAEC;IAED;;;;;;;;;;OAUG;IACH,uCAqMC;IAED;;;;;;;;;OASG;IACH,0CAoCC;IAzSC,eAAe;IACf,uCAA8C;;CA4jBjD;6BAtsBM,+BAA+B;kCAA/B,+BAA+B"}
|
|
@@ -10,12 +10,12 @@ export default SharedStatePrivate;
|
|
|
10
10
|
*/
|
|
11
11
|
declare class SharedStatePrivate {
|
|
12
12
|
constructor(manager: any, className: any, classDefinition: any, id: any, initValues?: {});
|
|
13
|
-
get id():
|
|
14
|
-
get className():
|
|
15
|
-
get creatorId():
|
|
16
|
-
get creatorInstanceId():
|
|
13
|
+
get id(): null;
|
|
14
|
+
get className(): null;
|
|
15
|
+
get creatorId(): null;
|
|
16
|
+
get creatorInstanceId(): null;
|
|
17
17
|
get attachedClients(): Map<any, any>;
|
|
18
|
-
get parameters():
|
|
18
|
+
get parameters(): null;
|
|
19
19
|
[kSharedStatePrivateGetValues](): any;
|
|
20
20
|
[kSharedStatePrivateAttachClient](instanceId: any, client: any, isOwner: any, filter: any): void;
|
|
21
21
|
[kSharedStatePrivateDetachClient](instanceId: any, client: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedStatePrivate.d.ts","sourceRoot":"","sources":["../../src/server/SharedStatePrivate.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SharedStatePrivate.d.ts","sourceRoot":"","sources":["../../src/server/SharedStatePrivate.js"],"names":[],"mappings":"AA6DA,4DAAuG;AACvG,4DAAuG;AACvG,yDAAiG;;AAEjG;;;;;GAKG;AACH;IASE,0FAMC;IAED,eAEC;IAED,sBAEC;IAED,sBAEC;IAED,8BAEC;IAED,qCAEC;IAED,uBAEC;IAED,sCAEC;IAED,iGA2LC;IAED,sEAQC;;CAeF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-http-server.d.ts","sourceRoot":"","sources":["../../src/server/create-http-server.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-http-server.d.ts","sourceRoot":"","sources":["../../src/server/create-http-server.js"],"names":[],"mappings":"AA0IA;;;GAGG;AACH,+CAFY,UAAU,GAAC,WAAW,CAUjC;AAED,qDAgBC"}
|
package/types/server/crypto.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/server/crypto.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/server/crypto.js"],"names":[],"mappings":"AAsBA,eAAe;AACf,2CAKC;AAED,eAAe;AACf,qDAMC"}
|
package/types/server/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type ClientDescription = {
|
|
|
17
17
|
* - For browser client, define is the client should be
|
|
18
18
|
* accessible at the default / root HTTP endpoint
|
|
19
19
|
*/
|
|
20
|
-
default?: boolean;
|
|
20
|
+
default?: boolean | undefined;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
23
|
* Application configuration object.
|
|
@@ -30,11 +30,11 @@ export type ServerAppConfig = {
|
|
|
30
30
|
/**
|
|
31
31
|
* - Name of the application.
|
|
32
32
|
*/
|
|
33
|
-
name?: string;
|
|
33
|
+
name?: string | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* - Name of the author.
|
|
36
36
|
*/
|
|
37
|
-
author?: string;
|
|
37
|
+
author?: string | undefined;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Environment configuration object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.js"],"names":[],"mappings":";;;;;;;;;yBAcU,MAAM;;;;;aAKF,SAAS,GAAC,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.js"],"names":[],"mappings":";;;;;;;;;yBAcU,MAAM;;;;;aAKF,SAAS,GAAC,MAAM;;;;;;;;;;;;;;QAShB,MAAM;;;;;;;;;;;;;8BAQV,MAAM;;;;;;;;SAwBF,SAAS;;;;SACT,eAAe"}
|
package/src/common/logger.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
const logger = {
|
|
7
|
-
verbose: true,
|
|
8
|
-
|
|
9
|
-
configure(verbose) {
|
|
10
|
-
this.verbose = verbose;
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
title(msg) {
|
|
14
|
-
if (!this.verbose) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
console.log(chalk.cyan(`+ ${msg}`));
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
log(msg) {
|
|
22
|
-
if (!this.verbose) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
console.log(msg);
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
warn(msg) {
|
|
30
|
-
if (!this.verbose) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.warn(chalk.yellow(msg));
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
error(msg) {
|
|
38
|
-
if (!this.verbose) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
console.error(chalk.red(msg));
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
ip(protocol, address, port) {
|
|
46
|
-
if (!this.verbose) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
console.log(` ${protocol}://${address}:${chalk.green(port)}`);
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
pluginStart(name) {
|
|
54
|
-
if (!this.verbose) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
console.log(` ${name} ${chalk.yellow('start...')}`);
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
pluginStarted(name) {
|
|
62
|
-
if (!this.verbose) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log(` ${name} ${chalk.cyan('started')}`);
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
pluginReady(name) {
|
|
70
|
-
if (!this.verbose) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
console.log(` ${name} ${chalk.green('ready')}`);
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
pluginErrored(name) {
|
|
78
|
-
if (!this.verbose) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
console.log(` ${name} ${chalk.red('errors')}`);
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
warnVersionDiscrepancies(clientRole, clientVersion, serverVersion) {
|
|
86
|
-
console.warn(`
|
|
87
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
88
|
-
|
|
89
|
-
WARNING
|
|
90
|
-
|
|
91
|
-
Version discrepancies between server and "${clientRole}" client:
|
|
92
|
-
+ server: ${serverVersion} | client: ${clientVersion}
|
|
93
|
-
|
|
94
|
-
This might lead to unexpected behavior, you should consider to re-install your
|
|
95
|
-
dependencies on both your server and clients.
|
|
96
|
-
|
|
97
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`);
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
deprecated(oldAPI, newAPI, lastSupportedVersion) {
|
|
101
|
-
if (!lastSupportedVersion) {
|
|
102
|
-
throw new Error(`Invalid 'logger.deprecated call: a deprecation version is required`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const msg = `DEPRECATION WARNING: \`${oldAPI}\` is deprecated (last supported version: ${lastSupportedVersion}) and will be removed in the next major revision, please use ${newAPI} instead.\n`;
|
|
106
|
-
console.warn(chalk.yellow(msg));
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
removed(oldAPI, hint, lastSupportedVersion) {
|
|
110
|
-
if (!lastSupportedVersion) {
|
|
111
|
-
throw new Error(`Invalid 'logger.deprecated call: a deprecation version is required`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const msg = `[Removed API] ${oldAPI} has been removed (last supported version: ${lastSupportedVersion}), please use ${hint} instead.`;
|
|
115
|
-
throw new Error(msg);
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
httpsCertsInfos(httpsCertsInfos) {
|
|
119
|
-
if (!this.verbose) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
this.title(`https certificates infos`);
|
|
124
|
-
|
|
125
|
-
if (httpsCertsInfos.selfSigned) {
|
|
126
|
-
this.log(` self-signed: ${httpsCertsInfos.selfSigned ? 'true' : 'false'}`);
|
|
127
|
-
this.log(chalk.yellow` > INVALID CERTIFICATE (self-signed)`);
|
|
128
|
-
} else {
|
|
129
|
-
this.log(` valid from: ${httpsCertsInfos.validFrom}`);
|
|
130
|
-
this.log(` valid to: ${httpsCertsInfos.validTo}`);
|
|
131
|
-
|
|
132
|
-
if (!httpsCertsInfos.isValid) {
|
|
133
|
-
this.error(chalk.red` -------------------------------------------`);
|
|
134
|
-
this.error(chalk.red` > INVALID CERTIFICATE `);
|
|
135
|
-
this.error(chalk.red` i.e. you pretend to be safe but you are not`);
|
|
136
|
-
this.error(chalk.red` -------------------------------------------`);
|
|
137
|
-
} else {
|
|
138
|
-
if (httpsCertsInfos.daysRemaining < 5) {
|
|
139
|
-
this.log(chalk.red` > CERTIFICATE IS VALID... BUT ONLY ${httpsCertsInfos.daysRemaining} DAYS LEFT, PLEASE CONSIDER UPDATING YOUR CERTS!`);
|
|
140
|
-
} else if (httpsCertsInfos.daysRemaining < 15) {
|
|
141
|
-
this.log(chalk.yellow` > CERTIFICATE IS VALID - only ${httpsCertsInfos.daysRemaining} days left, be careful...`);
|
|
142
|
-
} else {
|
|
143
|
-
this.log(chalk.green` > CERTIFICATE IS VALID (${httpsCertsInfos.daysRemaining} days left)`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export default logger;
|