@juzi/wechaty-puppet-service 1.0.66-no-redux → 1.0.67
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/dist/cjs/src/client/duck/actions.d.ts +6 -0
- package/dist/cjs/src/client/duck/actions.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/actions.js +54 -0
- package/dist/cjs/src/client/duck/actions.js.map +1 -0
- package/dist/cjs/src/client/duck/epic-recover.d.ts +36 -0
- package/dist/cjs/src/client/duck/epic-recover.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/epic-recover.js +41 -0
- package/dist/cjs/src/client/duck/epic-recover.js.map +1 -0
- package/dist/cjs/src/client/duck/epic-recover.spec.d.ts +3 -0
- package/dist/cjs/src/client/duck/epic-recover.spec.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/epic-recover.spec.js +131 -0
- package/dist/cjs/src/client/duck/epic-recover.spec.js.map +1 -0
- package/dist/cjs/src/client/duck/epics.d.ts +4 -0
- package/dist/cjs/src/client/duck/epics.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/epics.js +36 -0
- package/dist/cjs/src/client/duck/epics.js.map +1 -0
- package/dist/cjs/src/client/duck/mod.d.ts +29 -0
- package/dist/cjs/src/client/duck/mod.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/mod.js +63 -0
- package/dist/cjs/src/client/duck/mod.js.map +1 -0
- package/dist/cjs/src/client/duck/operations.d.ts +23 -0
- package/dist/cjs/src/client/duck/operations.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/operations.js +30 -0
- package/dist/cjs/src/client/duck/operations.js.map +1 -0
- package/dist/cjs/src/client/duck/reducers.d.ts +59 -0
- package/dist/cjs/src/client/duck/reducers.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/reducers.js +51 -0
- package/dist/cjs/src/client/duck/reducers.js.map +1 -0
- package/dist/cjs/src/client/duck/selectors.d.ts +21 -0
- package/dist/cjs/src/client/duck/selectors.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/selectors.js +23 -0
- package/dist/cjs/src/client/duck/selectors.js.map +1 -0
- package/dist/cjs/src/client/duck/tests.spec.d.ts +3 -0
- package/dist/cjs/src/client/duck/tests.spec.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/tests.spec.js +49 -0
- package/dist/cjs/src/client/duck/tests.spec.js.map +1 -0
- package/dist/cjs/src/client/duck/types.d.ts +21 -0
- package/dist/cjs/src/client/duck/types.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/types.js +24 -0
- package/dist/cjs/src/client/duck/types.js.map +1 -0
- package/dist/cjs/src/client/duck/utils.d.ts +21 -0
- package/dist/cjs/src/client/duck/utils.d.ts.map +1 -0
- package/dist/cjs/src/client/duck/utils.js +3 -0
- package/dist/cjs/src/client/duck/utils.js.map +1 -0
- package/dist/cjs/src/client/puppet-service.d.ts +11 -0
- package/dist/cjs/src/client/puppet-service.d.ts.map +1 -1
- package/dist/cjs/src/client/puppet-service.js +20 -1
- package/dist/cjs/src/client/puppet-service.js.map +1 -1
- package/dist/cjs/src/package-json.d.ts.map +1 -1
- package/dist/cjs/src/package-json.js +2 -1
- package/dist/cjs/src/package-json.js.map +1 -1
- package/dist/esm/src/client/duck/actions.d.ts +6 -0
- package/dist/esm/src/client/duck/actions.d.ts.map +1 -0
- package/dist/esm/src/client/duck/actions.js +28 -0
- package/dist/esm/src/client/duck/actions.js.map +1 -0
- package/dist/esm/src/client/duck/epic-recover.d.ts +36 -0
- package/dist/esm/src/client/duck/epic-recover.d.ts.map +1 -0
- package/dist/esm/src/client/duck/epic-recover.js +36 -0
- package/dist/esm/src/client/duck/epic-recover.js.map +1 -0
- package/dist/esm/src/client/duck/epic-recover.spec.d.ts +3 -0
- package/dist/esm/src/client/duck/epic-recover.spec.d.ts.map +1 -0
- package/dist/esm/src/client/duck/epic-recover.spec.js +126 -0
- package/dist/esm/src/client/duck/epic-recover.spec.js.map +1 -0
- package/dist/esm/src/client/duck/epics.d.ts +4 -0
- package/dist/esm/src/client/duck/epics.d.ts.map +1 -0
- package/dist/esm/src/client/duck/epics.js +33 -0
- package/dist/esm/src/client/duck/epics.js.map +1 -0
- package/dist/esm/src/client/duck/mod.d.ts +29 -0
- package/dist/esm/src/client/duck/mod.d.ts.map +1 -0
- package/dist/esm/src/client/duck/mod.js +29 -0
- package/dist/esm/src/client/duck/mod.js.map +1 -0
- package/dist/esm/src/client/duck/operations.d.ts +23 -0
- package/dist/esm/src/client/duck/operations.d.ts.map +1 -0
- package/dist/esm/src/client/duck/operations.js +4 -0
- package/dist/esm/src/client/duck/operations.js.map +1 -0
- package/dist/esm/src/client/duck/reducers.d.ts +59 -0
- package/dist/esm/src/client/duck/reducers.d.ts.map +1 -0
- package/dist/esm/src/client/duck/reducers.js +26 -0
- package/dist/esm/src/client/duck/reducers.js.map +1 -0
- package/dist/esm/src/client/duck/selectors.d.ts +21 -0
- package/dist/esm/src/client/duck/selectors.d.ts.map +1 -0
- package/dist/esm/src/client/duck/selectors.js +22 -0
- package/dist/esm/src/client/duck/selectors.js.map +1 -0
- package/dist/esm/src/client/duck/tests.spec.d.ts +3 -0
- package/dist/esm/src/client/duck/tests.spec.d.ts.map +1 -0
- package/dist/esm/src/client/duck/tests.spec.js +24 -0
- package/dist/esm/src/client/duck/tests.spec.js.map +1 -0
- package/dist/esm/src/client/duck/types.d.ts +21 -0
- package/dist/esm/src/client/duck/types.d.ts.map +1 -0
- package/dist/esm/src/client/duck/types.js +21 -0
- package/dist/esm/src/client/duck/types.js.map +1 -0
- package/dist/esm/src/client/duck/utils.d.ts +21 -0
- package/dist/esm/src/client/duck/utils.d.ts.map +1 -0
- package/dist/esm/src/client/duck/utils.js +2 -0
- package/dist/esm/src/client/duck/utils.js.map +1 -0
- package/dist/esm/src/client/puppet-service.d.ts +11 -0
- package/dist/esm/src/client/puppet-service.d.ts.map +1 -1
- package/dist/esm/src/client/puppet-service.js +22 -1
- package/dist/esm/src/client/puppet-service.js.map +1 -1
- package/dist/esm/src/package-json.d.ts.map +1 -1
- package/dist/esm/src/package-json.js +2 -1
- package/dist/esm/src/package-json.js.map +1 -1
- package/package.json +2 -1
- package/src/client/duck/actions.ts +31 -0
- package/src/client/duck/epic-recover.spec.ts +180 -0
- package/src/client/duck/epic-recover.ts +109 -0
- package/src/client/duck/epics.ts +53 -0
- package/src/client/duck/mod.ts +38 -0
- package/src/client/duck/operations.ts +28 -0
- package/src/client/duck/reducers.ts +36 -0
- package/src/client/duck/selectors.ts +27 -0
- package/src/client/duck/tests.spec.ts +25 -0
- package/src/client/duck/types.ts +20 -0
- package/src/client/duck/utils.ts +20 -0
- package/src/client/puppet-service.ts +35 -2
- package/src/package-json.ts +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../../src/client/duck/actions.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,eAAO,MAAM,GAAG,6EAA4B,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.nop = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
29
|
+
*
|
|
30
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
31
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
32
|
+
*
|
|
33
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
34
|
+
* you may not use this file except in compliance with the License.
|
|
35
|
+
* You may obtain a copy of the License at
|
|
36
|
+
*
|
|
37
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
40
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
42
|
+
* See the License for the specific language governing permissions and
|
|
43
|
+
* limitations under the License.
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
/* eslint-disable sort-keys */
|
|
47
|
+
const typesafe_actions_1 = require("typesafe-actions");
|
|
48
|
+
const types = __importStar(require("./types.js"));
|
|
49
|
+
/**
|
|
50
|
+
* Bug compatible & workaround for Ducks API
|
|
51
|
+
* https://github.com/huan/ducks/issues/2
|
|
52
|
+
*/
|
|
53
|
+
exports.nop = (0, typesafe_actions_1.createAction)(types.NOP)();
|
|
54
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../../src/client/duck/actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAA8B;AAC9B,uDAE2C;AAE3C,kDAAqC;AAErC;;;GAGG;AACU,QAAA,GAAG,GAAG,IAAA,+BAAY,EAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
5
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
import { Observable } from 'rxjs';
|
|
21
|
+
import type { AnyAction } from 'redux';
|
|
22
|
+
declare const monitorHeartbeat$: (timeoutMilliseconds: number) => (action$: Observable<AnyAction>) => Observable<import("typesafe-actions").PayloadMetaAction<"wechaty-redux/ERROR_RECEIVED_EVENT", import("@juzi/wechaty-puppet/payloads").EventError, {
|
|
23
|
+
puppetId: string;
|
|
24
|
+
}>>;
|
|
25
|
+
declare const epicRecoverDing$: (timeoutMilliseconds: number) => (action$: Observable<AnyAction>) => Observable<import("typesafe-actions").PayloadMetaAction<"wechaty-redux/DING_COMMAND", {
|
|
26
|
+
data: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
puppetId: string;
|
|
29
|
+
}>>;
|
|
30
|
+
declare const epicRecoverReset$: (timeoutMilliseconds: number) => (action$: Observable<AnyAction>) => Observable<import("typesafe-actions").PayloadMetaAction<"wechaty-redux/RESET_COMMAND", {
|
|
31
|
+
data: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
puppetId: string;
|
|
34
|
+
}>>;
|
|
35
|
+
export { monitorHeartbeat$, epicRecoverReset$, epicRecoverDing$, };
|
|
36
|
+
//# sourceMappingURL=epic-recover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epic-recover.d.ts","sourceRoot":"","sources":["../../../../../src/client/duck/epic-recover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,UAAU,EAGX,MAA4B,MAAM,CAAA;AAYnC,OAAO,KAAK,EAEV,SAAS,EACV,MAA4B,OAAO,CAAA;AAuBpC,QAAA,MAAM,iBAAiB,wBAAyB,MAAM,eAC1C,WAAW,SAAS,CAAC;;GAY5B,CAAA;AAEL,QAAA,MAAM,gBAAgB,wBAAyB,MAAM,eACzC,WAAW,SAAS,CAAC;;;;GAW5B,CAAA;AAEL,QAAA,MAAM,iBAAiB,wBAAyB,MAAM,eAC1C,WAAW,SAAS,CAAC;;;;GAW5B,CAAA;AAEL,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.epicRecoverDing$ = exports.epicRecoverReset$ = exports.monitorHeartbeat$ = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
6
|
+
*
|
|
7
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
8
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const rxjs_1 = require("rxjs");
|
|
24
|
+
const operators_1 = require("rxjs/operators");
|
|
25
|
+
const typesafe_actions_1 = require("typesafe-actions");
|
|
26
|
+
const wechaty_redux_1 = require("@juzi/wechaty-redux");
|
|
27
|
+
const wechaty_puppet_1 = require("@juzi/wechaty-puppet");
|
|
28
|
+
const stateActive$ = (action$) => action$.pipe((0, operators_1.filter)((0, typesafe_actions_1.isActionOf)(wechaty_redux_1.Duck.actions.STATE_ACTIVATED_EVENT)), (0, operators_1.filter)(action => action.payload.state === true));
|
|
29
|
+
const stateInactive$ = (action$) => action$.pipe((0, operators_1.filter)((0, typesafe_actions_1.isActionOf)(wechaty_redux_1.Duck.actions.STATE_INACTIVATED_EVENT)));
|
|
30
|
+
const heartbeat$ = (action$) => action$.pipe((0, operators_1.filter)((0, typesafe_actions_1.isActionOf)([
|
|
31
|
+
wechaty_redux_1.Duck.actions.HEARTBEAT_RECEIVED_EVENT,
|
|
32
|
+
wechaty_redux_1.Duck.actions.DONG_RECEIVED_EVENT,
|
|
33
|
+
])));
|
|
34
|
+
// Emit once when an active puppet lost heartbeat after a timeout period
|
|
35
|
+
const monitorHeartbeat$ = (timeoutMilliseconds) => (action$) => stateActive$(action$).pipe((0, operators_1.switchMap)(action => heartbeat$(action$).pipe((0, operators_1.debounce)(() => (0, rxjs_1.interval)(timeoutMilliseconds)), (0, operators_1.tap)(() => wechaty_puppet_1.log.verbose('PuppetService', 'monitorHeartbeat$() %d seconds TIMEOUT', Math.floor(timeoutMilliseconds / 1000))), (0, operators_1.map)(() => wechaty_redux_1.Duck.actions.ERROR_RECEIVED_EVENT(action.meta.puppetId, { gerror: `monitorHeartbeat$() TIMEOUT(${timeoutMilliseconds})` })))));
|
|
36
|
+
exports.monitorHeartbeat$ = monitorHeartbeat$;
|
|
37
|
+
const epicRecoverDing$ = (timeoutMilliseconds) => (action$) => monitorHeartbeat$(timeoutMilliseconds)(action$).pipe((0, operators_1.switchMap)(action => (0, rxjs_1.timer)(0, Math.floor(timeoutMilliseconds)).pipe((0, operators_1.tap)(n => wechaty_puppet_1.log.verbose('PuppetService', 'epicRecoverDing$() actions.ding() emitted #%d', n)), (0, operators_1.map)(() => wechaty_redux_1.Duck.actions.DING_COMMAND(action.meta.puppetId, 'epicRecoverDing$')), (0, operators_1.takeUntil)(heartbeat$(action$)), (0, operators_1.takeUntil)(stateInactive$(action$)))));
|
|
38
|
+
exports.epicRecoverDing$ = epicRecoverDing$;
|
|
39
|
+
const epicRecoverReset$ = (timeoutMilliseconds) => (action$) => monitorHeartbeat$(timeoutMilliseconds)(action$).pipe((0, operators_1.switchMap)(action => (0, rxjs_1.timer)(0, timeoutMilliseconds * 2).pipe((0, operators_1.tap)(n => wechaty_puppet_1.log.verbose('PuppetService', 'epicRecoverReset$() actions.reset() emitted #%d', n)), (0, operators_1.map)(() => wechaty_redux_1.Duck.actions.RESET_COMMAND(action.meta.puppetId, 'epicRecoverReset$')), (0, operators_1.takeUntil)(heartbeat$(action$)), (0, operators_1.takeUntil)(stateInactive$(action$)))));
|
|
40
|
+
exports.epicRecoverReset$ = epicRecoverReset$;
|
|
41
|
+
//# sourceMappingURL=epic-recover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epic-recover.js","sourceRoot":"","sources":["../../../../../src/client/duck/epic-recover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,eAAG,EAAC,CAAC,CAAC,EAAE,CAAC,oBAAG,CAAC,OAAO,CAAC,eAAe,EAAE,iDAAiD,EAAE,CAAC,CAAC,CAAC,EAC5F,IAAA,eAAG,EAAC,GAAG,EAAE,CAAC,oBAAU,CAAC,OAAO,CAAC,aAAa,CACxC,MAAM,CAAC,IAAI,CAAC,QAAQ,EACpB,mBAAmB,CACpB,CAAC,EACF,IAAA,qBAAS,EAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAC9B,IAAA,qBAAS,EAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CACnC,CAAC,CACH,CAAA;AAIH,8CAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epic-recover.spec.d.ts","sourceRoot":"","sources":["../../../../../src/client/duck/epic-recover.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm
|
|
2
|
+
"use strict";
|
|
3
|
+
/* eslint-disable func-call-spacing */
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
const tstest_1 = require("tstest");
|
|
9
|
+
const testing_1 = require("rxjs/testing");
|
|
10
|
+
const operators_1 = require("rxjs/operators");
|
|
11
|
+
const wechaty_puppet_mock_1 = __importDefault(require("@juzi/wechaty-puppet-mock"));
|
|
12
|
+
const wechaty_redux_1 = require("@juzi/wechaty-redux");
|
|
13
|
+
const epic_recover_js_1 = require("./epic-recover.js");
|
|
14
|
+
/**
|
|
15
|
+
* RxJS Marble Testing
|
|
16
|
+
*
|
|
17
|
+
* - https://rxjs.dev/guide/testing/marble-testing
|
|
18
|
+
* - https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/testing/marble-testing.md
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
(0, tstest_1.test)('Example: marble testing', async (t) => {
|
|
22
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
23
|
+
testScheduler.run(helpers => {
|
|
24
|
+
const { cold, time, expectObservable, expectSubscriptions } = helpers;
|
|
25
|
+
const e1 = cold('-a--b--c---|');
|
|
26
|
+
const e1subs = ' ^----------!';
|
|
27
|
+
const t = time('---| '); // t = 3
|
|
28
|
+
const expected = ' -a-----c---|';
|
|
29
|
+
expectObservable(e1.pipe((0, operators_1.throttleTime)(t))).toBe(expected);
|
|
30
|
+
expectSubscriptions(e1.subscriptions).toBe(e1subs);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
(0, tstest_1.test)('Example 2: marble subscribe time frame testing', async (t) => {
|
|
34
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
35
|
+
testScheduler.run(helpers => {
|
|
36
|
+
const { hot, expectObservable, expectSubscriptions } = helpers;
|
|
37
|
+
const source = hot(' --a--b--c--d--e--f');
|
|
38
|
+
const subscription = '-----^------!-';
|
|
39
|
+
const expected = ' -----b--c--d--';
|
|
40
|
+
expectObservable(source, subscription).toBe(expected);
|
|
41
|
+
void expectSubscriptions;
|
|
42
|
+
// expectSubscriptions(source.subscriptions).toBe(subscription)
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
(0, tstest_1.test)('Example 3: subscribe with unsubscribe / complete', async (t) => {
|
|
46
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
47
|
+
testScheduler.run(({ hot, expectObservable }) => {
|
|
48
|
+
const values = {
|
|
49
|
+
a: 0,
|
|
50
|
+
b: 1,
|
|
51
|
+
c: 2,
|
|
52
|
+
};
|
|
53
|
+
const source = hot(' 10ms a 9ms b 9ms c-|', values);
|
|
54
|
+
const subscription1 = ' 20ms ^ 9ms -!-';
|
|
55
|
+
const subscription2 = ' 30ms ^--';
|
|
56
|
+
const expected1 = ' 20ms b 9ms c--';
|
|
57
|
+
const expected2 = ' 30ms c-|';
|
|
58
|
+
expectObservable(source, subscription1).toBe(expected1, values);
|
|
59
|
+
expectObservable(source, subscription2).toBe(expected2, values);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
(0, tstest_1.test)('Example 4: play ground', async (t) => {
|
|
63
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
64
|
+
testScheduler.run(helpers => {
|
|
65
|
+
const { hot, cold, expectObservable } = helpers;
|
|
66
|
+
void hot;
|
|
67
|
+
void cold;
|
|
68
|
+
const TIMEOUT = 15;
|
|
69
|
+
const source = hot(`-----a-----h------h ${TIMEOUT}ms --`);
|
|
70
|
+
const sub = ` ------^-------!---- ${TIMEOUT}ms --`;
|
|
71
|
+
const expected = ` -----------h------- ${TIMEOUT}ms --`;
|
|
72
|
+
expectObservable(source, sub).toBe(expected);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
(0, tstest_1.test)('monitorHeartbeat$() emit once after lost heartbeat', async (t) => {
|
|
76
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
77
|
+
const puppet = new wechaty_puppet_mock_1.default();
|
|
78
|
+
const TIMEOUT = 15;
|
|
79
|
+
testScheduler.run(helpers => {
|
|
80
|
+
const { hot, expectObservable, expectSubscriptions } = helpers;
|
|
81
|
+
const marble = {
|
|
82
|
+
a: wechaty_redux_1.Duck.actions.STATE_ACTIVATED_EVENT(puppet.id, true),
|
|
83
|
+
d: wechaty_redux_1.Duck.actions.DONG_RECEIVED_EVENT(puppet.id, { data: 'dong' }),
|
|
84
|
+
e: wechaty_redux_1.Duck.actions.ERROR_RECEIVED_EVENT(puppet.id, { gerror: `monitorHeartbeat$() TIMEOUT(${TIMEOUT})` }),
|
|
85
|
+
h: wechaty_redux_1.Duck.actions.HEARTBEAT_RECEIVED_EVENT(puppet.id, { data: 'heartbeat' }),
|
|
86
|
+
};
|
|
87
|
+
const puppet$ = hot(` -a----h----h ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT - 1}ms h ${TIMEOUT}ms ${TIMEOUT - 1}ms d ${TIMEOUT}ms ------`, marble);
|
|
88
|
+
const subscription = `^----------- ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms -----!`;
|
|
89
|
+
const expected = ` ------------ ${TIMEOUT - 1}ms e ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT - 1}ms e ${TIMEOUT}ms ${TIMEOUT - 1}ms e ------`;
|
|
90
|
+
expectObservable((0, epic_recover_js_1.monitorHeartbeat$)(TIMEOUT)(puppet$), subscription).toBe(expected, marble);
|
|
91
|
+
void expectSubscriptions;
|
|
92
|
+
// expectSubscriptions(puppet$.subscriptions).toBe(sub)
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
(0, tstest_1.test)('epicRecoverDing$() emit periodly', async (t) => {
|
|
96
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
97
|
+
const puppet = new wechaty_puppet_mock_1.default();
|
|
98
|
+
const TIMEOUT = 15;
|
|
99
|
+
testScheduler.run(helpers => {
|
|
100
|
+
const { hot, expectObservable } = helpers;
|
|
101
|
+
const marble = {
|
|
102
|
+
a: wechaty_redux_1.Duck.actions.STATE_ACTIVATED_EVENT(puppet.id, true),
|
|
103
|
+
d: wechaty_redux_1.Duck.actions.DONG_RECEIVED_EVENT(puppet.id, { data: 'dong' }),
|
|
104
|
+
h: wechaty_redux_1.Duck.actions.HEARTBEAT_RECEIVED_EVENT(puppet.id, { data: 'heartbeat' }),
|
|
105
|
+
i: wechaty_redux_1.Duck.actions.DING_COMMAND(puppet.id, 'epicRecoverDing$'),
|
|
106
|
+
};
|
|
107
|
+
const puppet$ = hot(` -a----h----h ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT - 1}ms h ${TIMEOUT - 1}ms h ${TIMEOUT - 1}ms d ${TIMEOUT - 1}ms d ------`, marble);
|
|
108
|
+
const subscription = `^----------- ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms -----!`;
|
|
109
|
+
const expected = ` ------------ ${TIMEOUT - 1}ms i ${TIMEOUT - 1}ms i ${TIMEOUT - 1}ms i ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ------`;
|
|
110
|
+
expectObservable((0, epic_recover_js_1.epicRecoverDing$)(TIMEOUT)(puppet$), subscription).toBe(expected, marble);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
(0, tstest_1.test)('epicRecoverReset$() emit periodly', async (t) => {
|
|
114
|
+
const testScheduler = new testing_1.TestScheduler(t.same);
|
|
115
|
+
const puppet = new wechaty_puppet_mock_1.default();
|
|
116
|
+
const TIMEOUT = 60;
|
|
117
|
+
testScheduler.run(helpers => {
|
|
118
|
+
const { hot, expectObservable } = helpers;
|
|
119
|
+
const marble = {
|
|
120
|
+
a: wechaty_redux_1.Duck.actions.STATE_ACTIVATED_EVENT(puppet.id, true),
|
|
121
|
+
d: wechaty_redux_1.Duck.actions.DONG_RECEIVED_EVENT(puppet.id, { data: 'dong' }),
|
|
122
|
+
h: wechaty_redux_1.Duck.actions.HEARTBEAT_RECEIVED_EVENT(puppet.id, { data: 'heartbeat' }),
|
|
123
|
+
r: wechaty_redux_1.Duck.actions.RESET_COMMAND(puppet.id, 'epicRecoverReset$'),
|
|
124
|
+
};
|
|
125
|
+
const puppet$ = hot(` -a----h----h ${TIMEOUT}ms ${TIMEOUT * 2}ms ${TIMEOUT * 2}ms ${TIMEOUT * 2 - 1}ms h ${TIMEOUT - 1}ms h ${TIMEOUT - 1}ms d ${TIMEOUT - 1}ms d ------`, marble);
|
|
126
|
+
const subscription = `^----------- ${TIMEOUT}ms ${TIMEOUT * 2}ms ${TIMEOUT * 2}ms ${TIMEOUT * 2}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms -----!`;
|
|
127
|
+
const expected = ` ------------ ${TIMEOUT - 1}ms r ${TIMEOUT * 2 - 1}ms r ${TIMEOUT * 2 - 1}ms r ${TIMEOUT * 2}ms ${TIMEOUT}ms ${TIMEOUT}ms ${TIMEOUT}ms ------`;
|
|
128
|
+
expectObservable((0, epic_recover_js_1.epicRecoverReset$)(TIMEOUT)(puppet$), subscription).toBe(expected, marble);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=epic-recover.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epic-recover.spec.js","sourceRoot":"","sources":["../../../../../src/client/duck/epic-recover.spec.ts"],"names":[],"mappings":";;AACA,sCAAsC;;;;;AAEtC,mCAA8B;AAE9B,0CAEyC;AACzC,8CAE2C;AAC3C,oFAAsD;AAEtD,uDAEgD;AAEhD,uDAI8C;AAE9C;;;;;;GAMG;AACH,IAAA,aAAI,EAAC,yBAAyB,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IACxC,MAAM,aAAa,GAAG,IAAI,uBAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAE/C,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC1B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAA;QACrE,MAAM,EAAE,GAAS,IAAI,CAAC,cAAc,CAAC,CAAA;QACrC,MAAM,MAAM,GAAK,mBAAmB,CAAA;QACpC,MAAM,CAAC,GAAU,IAAI,CAAC,cAAc,CAAC,CAAA,CAAE,QAAQ;QAC/C,MAAM,QAAQ,GAAG,mBAAmB,CAAA;QAEpC,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,IAAA,wBAAY,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACzD,mBAA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GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QACpM,MAAM,YAAY,GAAG,gBAAgB,OAAO,YAAY,OAAO,GAAG,CAAC,YAAY,OAAO,GAAG,CAAC,YAAY,OAAO,GAAG,CAAC,YAAY,OAAO,YAAY,OAAO,YAAY,OAAO,iBAAiB,CAAA;QAC3L,MAAM,QAAQ,GAAI,mBAAmB,OAAO,GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,YAAY,OAAO,YAAY,OAAO,YAAY,OAAO,iBAAiB,CAAA;QAE3L,gBAAgB,CACd,IAAA,mCAAiB,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EACnC,YAAY,CACb,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epics.d.ts","sourceRoot":"","sources":["../../../../../src/client/duck/epics.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,IAAI,EACL,MAAoB,kBAAkB,CAAA;AAiBvC,QAAA,MAAM,WAAW,EAAE,IAGlB,CAAA;AAED,OAAO,EACL,WAAW,GACZ,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recoverEpic = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
6
|
+
*
|
|
7
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
8
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const rxjs_1 = require("rxjs");
|
|
24
|
+
const epic_recover_js_1 = require("./epic-recover.js");
|
|
25
|
+
/**
|
|
26
|
+
* The GRPC keepalive timeout is 20 seconds
|
|
27
|
+
* So we use 15 seconds to save the GRPC keepalive cost
|
|
28
|
+
*
|
|
29
|
+
* https://github.com/grpc/grpc/blob/master/doc/keepalive.md
|
|
30
|
+
* GRPC_ARG_KEEPALIVE_TIMEOUT_MS 20000 (20 seconds) 20000 (20 seconds)
|
|
31
|
+
*/
|
|
32
|
+
const TIMEOUT_SOFT = 15 * 1000;
|
|
33
|
+
const TIMEOUT_HARD = Math.floor(4.5 * TIMEOUT_SOFT);
|
|
34
|
+
const recoverEpic = (action$) => (0, rxjs_1.merge)((0, epic_recover_js_1.epicRecoverDing$)(TIMEOUT_SOFT)(action$), (0, epic_recover_js_1.epicRecoverReset$)(TIMEOUT_HARD)(action$));
|
|
35
|
+
exports.recoverEpic = recoverEpic;
|
|
36
|
+
//# sourceMappingURL=epics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epics.js","sourceRoot":"","sources":["../../../../../src/client/duck/epics.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,+BAG2B;AAQ3B,uDAGsD;AAEtD;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,CAAA;AAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,YAAY,CAAC,CAAA;AAEnD,MAAM,WAAW,GAAS,CAAC,OAA8B,EAAE,EAAE,CAAC,IAAA,YAAK,EACjE,IAAA,kCAAgB,EAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EACvC,IAAA,mCAAiB,EAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CACzC,CAAA;AAGC,kCAAW"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
5
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
import reducer from './reducers.js';
|
|
21
|
+
import * as actions from './actions.js';
|
|
22
|
+
import * as epics from './epics.js';
|
|
23
|
+
import * as operations from './operations.js';
|
|
24
|
+
import * as selectors from './selectors.js';
|
|
25
|
+
import * as types from './types.js';
|
|
26
|
+
import * as utils from './utils.js';
|
|
27
|
+
export { actions, epics, operations, selectors, types, utils, };
|
|
28
|
+
export default reducer;
|
|
29
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../src/client/duck/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,OAAO,MAAM,eAAe,CAAA;AAEnC,OAAO,KAAK,OAAO,MAAS,cAAc,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAW,YAAY,CAAA;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,SAAS,MAAO,gBAAgB,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAW,YAAY,CAAA;AACxC,OAAO,KAAK,KAAK,MAAW,YAAY,CAAA;AAExC,OAAO,EACL,OAAO,EACP,KAAK,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,KAAK,GACN,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.utils = exports.types = exports.selectors = exports.operations = exports.epics = exports.actions = void 0;
|
|
30
|
+
/**
|
|
31
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
32
|
+
*
|
|
33
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
34
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
35
|
+
*
|
|
36
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
37
|
+
* you may not use this file except in compliance with the License.
|
|
38
|
+
* You may obtain a copy of the License at
|
|
39
|
+
*
|
|
40
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
41
|
+
*
|
|
42
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
43
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
44
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
45
|
+
* See the License for the specific language governing permissions and
|
|
46
|
+
* limitations under the License.
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
const reducers_js_1 = __importDefault(require("./reducers.js"));
|
|
50
|
+
const actions = __importStar(require("./actions.js"));
|
|
51
|
+
exports.actions = actions;
|
|
52
|
+
const epics = __importStar(require("./epics.js"));
|
|
53
|
+
exports.epics = epics;
|
|
54
|
+
const operations = __importStar(require("./operations.js"));
|
|
55
|
+
exports.operations = operations;
|
|
56
|
+
const selectors = __importStar(require("./selectors.js"));
|
|
57
|
+
exports.selectors = selectors;
|
|
58
|
+
const types = __importStar(require("./types.js"));
|
|
59
|
+
exports.types = types;
|
|
60
|
+
const utils = __importStar(require("./utils.js"));
|
|
61
|
+
exports.utils = utils;
|
|
62
|
+
exports.default = reducers_js_1.default;
|
|
63
|
+
//# sourceMappingURL=mod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../../../src/client/duck/mod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,gEAAmC;AAEnC,sDAA0C;AAQxC,0BAAO;AAPT,kDAAwC;AAQtC,sBAAK;AAPP,4DAA6C;AAQ3C,gCAAU;AAPZ,0DAA4C;AAQ1C,8BAAS;AAPX,kDAAwC;AAQtC,sBAAK;AAPP,kDAAwC;AAQtC,sBAAK;AAGP,kBAAe,qBAAO,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wechaty Open Source Software - https://github.com/wechaty
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
|
|
5
|
+
* Wechaty Contributors <https://github.com/wechaty>.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
import type { Dispatch } from 'redux';
|
|
21
|
+
declare const nop: (dispatch: Dispatch) => () => import("typesafe-actions").EmptyAction<"wechaty-puppet-service/NOP">;
|
|
22
|
+
export { nop, };
|
|
23
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../../src/client/duck/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIrC,QAAA,MAAM,GAAG,aAAc,QAAQ,+EAAkC,CAAA;AAEjE,OAAO,EACL,GAAG,GACJ,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.nop = void 0;
|
|
27
|
+
const actions = __importStar(require("./actions.js"));
|
|
28
|
+
const nop = (dispatch) => () => dispatch(actions.nop());
|
|
29
|
+
exports.nop = nop;
|
|
30
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../../src/client/duck/operations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,sDAAuC;AAEvC,MAAM,GAAG,GAAG,CAAC,QAAkB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;AAG/D,kBAAG"}
|