@amityco/ts-sdk 6.4.2-045209e.0 → 6.4.2-66daf4a.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/.eslintrc.json +2 -1
- package/dist/client/utils/markerSyncEngine.d.ts +4 -0
- package/dist/client/utils/markerSyncEngine.d.ts.map +1 -1
- package/dist/core/transports/mqtt.d.ts.map +1 -1
- package/dist/index.cjs.js +24 -7
- package/dist/index.esm.js +24 -7
- package/dist/index.umd.js +1 -1
- package/dist/subChannelRepository/utils/markReadEngine.d.ts +1 -1
- package/dist/subChannelRepository/utils/markReadEngine.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/utils/markerSyncEngine.ts +9 -0
- package/src/core/transports/mqtt.ts +4 -2
- package/src/subChannelRepository/utils/markReadEngine.ts +9 -4
package/.eslintrc.json
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
|
|
29
29
|
"import/no-unresolved": "off",
|
|
30
30
|
"no-shadow": "off",
|
|
31
|
-
"no-unused-vars": "off"
|
|
31
|
+
"no-unused-vars": "off",
|
|
32
|
+
"no-console": ["error", { "allow": ["warn", "error"] }]
|
|
32
33
|
},
|
|
33
34
|
"settings": {
|
|
34
35
|
"import/resolver": {
|
|
@@ -41,4 +41,8 @@ export declare const startUnreadSync: () => Promise<void>;
|
|
|
41
41
|
* @category Marker API
|
|
42
42
|
*/
|
|
43
43
|
export declare const stopUnreadSync: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Please use `startUnreadSync` instead
|
|
46
|
+
*/
|
|
47
|
+
export declare const stopUnreadSyncing: () => void;
|
|
44
48
|
//# sourceMappingURL=markerSyncEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markerSyncEngine.d.ts","sourceRoot":"","sources":["../../../src/client/utils/markerSyncEngine.ts"],"names":[],"mappings":"AAiDA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+BAAe,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,cAAe,MAAM,eAAe,EAAE,SAErE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,eAAe,WAAuB,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,qBA4B7B,CAAC;AAgDF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,qBAiB3B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,YAK1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"markerSyncEngine.d.ts","sourceRoot":"","sources":["../../../src/client/utils/markerSyncEngine.ts"],"names":[],"mappings":"AAiDA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+BAAe,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,cAAe,MAAM,eAAe,EAAE,SAErE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,eAAe,WAAuB,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,qBA4B7B,CAAC;AAgDF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,qBAiB3B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,YAK1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,YAI7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../../../src/core/transports/mqtt.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,cAAc,EAAsB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAetF,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAiBjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../../../src/core/transports/mqtt.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,cAAc,EAAsB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAetF,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAiBjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,KAAG,gBA2GtD,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -20511,7 +20511,10 @@ const createMqttTransport = (endpoint) => {
|
|
|
20511
20511
|
},
|
|
20512
20512
|
subscribe(topic, callback) {
|
|
20513
20513
|
const callbackWrapper = (error, granted) => {
|
|
20514
|
-
|
|
20514
|
+
var _a;
|
|
20515
|
+
// In MQTT.js, when you subscribe to a topic with QoS 0, the granted parameter
|
|
20516
|
+
// in the callback will typically be empty or undefined
|
|
20517
|
+
if (error || ((_a = granted[0]) === null || _a === void 0 ? void 0 : _a.qos) === QOS_FAILURE_CODE) {
|
|
20515
20518
|
const ascError = error
|
|
20516
20519
|
? new ASCError(error.message, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */)
|
|
20517
20520
|
: // TODO throw the actual error, once BE can tell us the actual error code
|
|
@@ -20521,7 +20524,7 @@ const createMqttTransport = (endpoint) => {
|
|
|
20521
20524
|
callback === null || callback === void 0 ? void 0 : callback(ascError);
|
|
20522
20525
|
}
|
|
20523
20526
|
else {
|
|
20524
|
-
console.log(`Subscribed to topic ${
|
|
20527
|
+
console.log(`Subscribed to topic ${topic}`);
|
|
20525
20528
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
20526
20529
|
}
|
|
20527
20530
|
};
|
|
@@ -21465,11 +21468,11 @@ const getReadingSubChannels = () => {
|
|
|
21465
21468
|
/**
|
|
21466
21469
|
* call start reading API with reading list
|
|
21467
21470
|
*/
|
|
21468
|
-
const startReadingFromReadingList = () => {
|
|
21471
|
+
const startReadingFromReadingList = async () => {
|
|
21469
21472
|
const isReadingSubChannelIds = getReadingSubChannels();
|
|
21470
21473
|
if (isReadingSubChannelIds.length === 0) {
|
|
21471
21474
|
// no subChannel that require to call start reading API
|
|
21472
|
-
return;
|
|
21475
|
+
return false;
|
|
21473
21476
|
}
|
|
21474
21477
|
return startReadingAPI(isReadingSubChannelIds);
|
|
21475
21478
|
};
|
|
@@ -21548,13 +21551,19 @@ const disposeAll = () => {
|
|
|
21548
21551
|
* @category Channel API
|
|
21549
21552
|
* @async
|
|
21550
21553
|
*/
|
|
21551
|
-
const startReading = (subChannelId) => {
|
|
21554
|
+
const startReading = async (subChannelId) => {
|
|
21552
21555
|
isReadingMap[subChannelId] = true;
|
|
21553
21556
|
if (disposers$1.length === 0) {
|
|
21554
21557
|
registerEventListeners$1();
|
|
21555
21558
|
registerTopicSubscribers(subChannelId);
|
|
21556
21559
|
}
|
|
21557
|
-
|
|
21560
|
+
try {
|
|
21561
|
+
return await startReadingFromReadingList();
|
|
21562
|
+
}
|
|
21563
|
+
catch (e) {
|
|
21564
|
+
isReadingMap[subChannelId] = false;
|
|
21565
|
+
return false;
|
|
21566
|
+
}
|
|
21558
21567
|
};
|
|
21559
21568
|
/* end_public_function */
|
|
21560
21569
|
/* begin_public_function
|
|
@@ -24459,6 +24468,13 @@ const stopUnreadSync = () => {
|
|
|
24459
24468
|
clearSyncTrigger = undefined;
|
|
24460
24469
|
setMarkerSyncEvents([]);
|
|
24461
24470
|
unRegisterEventListeners();
|
|
24471
|
+
};
|
|
24472
|
+
/**
|
|
24473
|
+
* @deprecated Please use `startUnreadSync` instead
|
|
24474
|
+
*/
|
|
24475
|
+
const stopUnreadSyncing = () => {
|
|
24476
|
+
console.warn('`stopUnreadSyncing` has been deprecated, please use `stopUnreadSync` instead');
|
|
24477
|
+
return stopUnreadSync();
|
|
24462
24478
|
};
|
|
24463
24479
|
|
|
24464
24480
|
var index$f = /*#__PURE__*/Object.freeze({
|
|
@@ -24483,7 +24499,8 @@ var index$f = /*#__PURE__*/Object.freeze({
|
|
|
24483
24499
|
pushMarkerSyncEvent: pushMarkerSyncEvent,
|
|
24484
24500
|
markerSyncTrigger: markerSyncTrigger,
|
|
24485
24501
|
startUnreadSync: startUnreadSync,
|
|
24486
|
-
stopUnreadSync: stopUnreadSync
|
|
24502
|
+
stopUnreadSync: stopUnreadSync,
|
|
24503
|
+
stopUnreadSyncing: stopUnreadSyncing
|
|
24487
24504
|
});
|
|
24488
24505
|
|
|
24489
24506
|
const blockUser = async (userId) => {
|
package/dist/index.esm.js
CHANGED
|
@@ -20497,7 +20497,10 @@ const createMqttTransport = (endpoint) => {
|
|
|
20497
20497
|
},
|
|
20498
20498
|
subscribe(topic, callback) {
|
|
20499
20499
|
const callbackWrapper = (error, granted) => {
|
|
20500
|
-
|
|
20500
|
+
var _a;
|
|
20501
|
+
// In MQTT.js, when you subscribe to a topic with QoS 0, the granted parameter
|
|
20502
|
+
// in the callback will typically be empty or undefined
|
|
20503
|
+
if (error || ((_a = granted[0]) === null || _a === void 0 ? void 0 : _a.qos) === QOS_FAILURE_CODE) {
|
|
20501
20504
|
const ascError = error
|
|
20502
20505
|
? new ASCError(error.message, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */)
|
|
20503
20506
|
: // TODO throw the actual error, once BE can tell us the actual error code
|
|
@@ -20507,7 +20510,7 @@ const createMqttTransport = (endpoint) => {
|
|
|
20507
20510
|
callback === null || callback === void 0 ? void 0 : callback(ascError);
|
|
20508
20511
|
}
|
|
20509
20512
|
else {
|
|
20510
|
-
console.log(`Subscribed to topic ${
|
|
20513
|
+
console.log(`Subscribed to topic ${topic}`);
|
|
20511
20514
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
20512
20515
|
}
|
|
20513
20516
|
};
|
|
@@ -21451,11 +21454,11 @@ const getReadingSubChannels = () => {
|
|
|
21451
21454
|
/**
|
|
21452
21455
|
* call start reading API with reading list
|
|
21453
21456
|
*/
|
|
21454
|
-
const startReadingFromReadingList = () => {
|
|
21457
|
+
const startReadingFromReadingList = async () => {
|
|
21455
21458
|
const isReadingSubChannelIds = getReadingSubChannels();
|
|
21456
21459
|
if (isReadingSubChannelIds.length === 0) {
|
|
21457
21460
|
// no subChannel that require to call start reading API
|
|
21458
|
-
return;
|
|
21461
|
+
return false;
|
|
21459
21462
|
}
|
|
21460
21463
|
return startReadingAPI(isReadingSubChannelIds);
|
|
21461
21464
|
};
|
|
@@ -21534,13 +21537,19 @@ const disposeAll = () => {
|
|
|
21534
21537
|
* @category Channel API
|
|
21535
21538
|
* @async
|
|
21536
21539
|
*/
|
|
21537
|
-
const startReading = (subChannelId) => {
|
|
21540
|
+
const startReading = async (subChannelId) => {
|
|
21538
21541
|
isReadingMap[subChannelId] = true;
|
|
21539
21542
|
if (disposers$1.length === 0) {
|
|
21540
21543
|
registerEventListeners$1();
|
|
21541
21544
|
registerTopicSubscribers(subChannelId);
|
|
21542
21545
|
}
|
|
21543
|
-
|
|
21546
|
+
try {
|
|
21547
|
+
return await startReadingFromReadingList();
|
|
21548
|
+
}
|
|
21549
|
+
catch (e) {
|
|
21550
|
+
isReadingMap[subChannelId] = false;
|
|
21551
|
+
return false;
|
|
21552
|
+
}
|
|
21544
21553
|
};
|
|
21545
21554
|
/* end_public_function */
|
|
21546
21555
|
/* begin_public_function
|
|
@@ -24445,6 +24454,13 @@ const stopUnreadSync = () => {
|
|
|
24445
24454
|
clearSyncTrigger = undefined;
|
|
24446
24455
|
setMarkerSyncEvents([]);
|
|
24447
24456
|
unRegisterEventListeners();
|
|
24457
|
+
};
|
|
24458
|
+
/**
|
|
24459
|
+
* @deprecated Please use `startUnreadSync` instead
|
|
24460
|
+
*/
|
|
24461
|
+
const stopUnreadSyncing = () => {
|
|
24462
|
+
console.warn('`stopUnreadSyncing` has been deprecated, please use `stopUnreadSync` instead');
|
|
24463
|
+
return stopUnreadSync();
|
|
24448
24464
|
};
|
|
24449
24465
|
|
|
24450
24466
|
var index$f = /*#__PURE__*/Object.freeze({
|
|
@@ -24469,7 +24485,8 @@ var index$f = /*#__PURE__*/Object.freeze({
|
|
|
24469
24485
|
pushMarkerSyncEvent: pushMarkerSyncEvent,
|
|
24470
24486
|
markerSyncTrigger: markerSyncTrigger,
|
|
24471
24487
|
startUnreadSync: startUnreadSync,
|
|
24472
|
-
stopUnreadSync: stopUnreadSync
|
|
24488
|
+
stopUnreadSync: stopUnreadSync,
|
|
24489
|
+
stopUnreadSyncing: stopUnreadSyncing
|
|
24473
24490
|
});
|
|
24474
24491
|
|
|
24475
24492
|
const blockUser = async (userId) => {
|