@wenex/sdk 0.7.6 → 0.7.7
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/common/interfaces/special/saga/history.interface.d.ts +1 -1
- package/common/interfaces/special/saga/saga.interface.d.ts +1 -1
- package/common/utils/transform.util.d.ts +1 -0
- package/common/utils/transform.util.js +9 -0
- package/common/utils/transform.util.js.map +1 -1
- package/package.json +1 -1
- package/services/special/sagas/sagas.service.d.ts +6 -2
- package/services/special/sagas/sagas.service.js +30 -1
- package/services/special/sagas/sagas.service.js.map +1 -1
|
@@ -10,4 +10,4 @@ export interface SagaHistory<Req = any, Res = any> extends Core {
|
|
|
10
10
|
}
|
|
11
11
|
export type SagaHistoryDoc<Req = any, Res = any> = SagaHistory<Req, Res> & Document;
|
|
12
12
|
export type SagaHistoryDto<Req = any, Res = any> = Dto<SagaHistory<Req, Res>>;
|
|
13
|
-
export type
|
|
13
|
+
export type SagaHistoryAppendDto<Req = any, Res = any> = Dto<MakeOptional<SagaHistory<Req, Res>, 'res'>>;
|
|
@@ -12,4 +12,4 @@ export interface Saga extends Core {
|
|
|
12
12
|
export type SagaDoc = Saga & Document;
|
|
13
13
|
export type SagaDto = Dto<MakeOptional<Saga, 'state'>>;
|
|
14
14
|
export type SagaId = Pick<Saga, 'id'>;
|
|
15
|
-
export type
|
|
15
|
+
export type SagaStartDto = Dto<MakeOptional<Saga, 'job' | 'state' | 'session'>>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.toJSON = toJSON;
|
|
5
5
|
exports.toDate = toDate;
|
|
6
|
+
exports.toString = toString;
|
|
6
7
|
function toJSON(val) {
|
|
7
8
|
try {
|
|
8
9
|
return JSON.parse(val);
|
|
@@ -19,4 +20,12 @@ function toDate(val) {
|
|
|
19
20
|
return val;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
23
|
+
function toString(val) {
|
|
24
|
+
try {
|
|
25
|
+
return typeof val === 'string' ? val : JSON.stringify(val);
|
|
26
|
+
}
|
|
27
|
+
catch (_a) {
|
|
28
|
+
return String(val);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
22
31
|
//# sourceMappingURL=transform.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.util.js","sourceRoot":"","sources":["../../src/common/utils/transform.util.ts"],"names":[],"mappings":";AAAA,uDAAuD;;AAEvD,wBAMC;AAED,wBAMC;
|
|
1
|
+
{"version":3,"file":"transform.util.js","sourceRoot":"","sources":["../../src/common/utils/transform.util.ts"],"names":[],"mappings":";AAAA,uDAAuD;;AAEvD,wBAMC;AAED,wBAMC;AAED,4BAMC;AAtBD,SAAgB,MAAM,CAAU,GAAW;IACzC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,GAAQ,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAgB,MAAM,CAAC,GAA2B;IAChD,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,GAAW,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAgB,QAAQ,CAAU,GAAM;IACtC,IAAI,CAAC;QACH,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7D,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
|
-
import {
|
|
2
|
+
import { Saga, SagaDto, SagaHistory, SagaHistoryAppendDto, SagaStartDto, Serializer } from '../../../common/interfaces';
|
|
3
3
|
import { SagaHistoriesService } from './history.service';
|
|
4
|
-
import {
|
|
4
|
+
import { RequestConfig, RestfulService } from '../../../common/classes';
|
|
5
5
|
export declare class SagasService extends RestfulService<Saga, SagaDto> {
|
|
6
6
|
protected axios: AxiosInstance;
|
|
7
7
|
protected $histories?: SagaHistoriesService;
|
|
8
8
|
constructor(axios: AxiosInstance);
|
|
9
9
|
get histories(): SagaHistoriesService;
|
|
10
|
+
start(data: SagaStartDto, config?: RequestConfig<Saga>): Promise<Serializer<Saga>>;
|
|
11
|
+
append(data: SagaHistoryAppendDto, config?: RequestConfig<SagaHistory>): Promise<Serializer<SagaHistory>>;
|
|
12
|
+
commit(id: string, config?: RequestConfig<Saga>): Promise<Serializer<Saga>>;
|
|
13
|
+
abort(id: string, config?: RequestConfig<Saga>): Promise<Serializer<Saga>>;
|
|
10
14
|
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.SagasService = void 0;
|
|
4
|
-
const classes_1 = require("../../../common/classes");
|
|
5
13
|
const history_service_1 = require("./history.service");
|
|
14
|
+
const classes_1 = require("../../../common/classes");
|
|
6
15
|
class SagasService extends classes_1.RestfulService {
|
|
7
16
|
constructor(axios) {
|
|
8
17
|
super('sagas', axios);
|
|
@@ -12,6 +21,26 @@ class SagasService extends classes_1.RestfulService {
|
|
|
12
21
|
var _a;
|
|
13
22
|
return (this.$histories = (_a = this.$histories) !== null && _a !== void 0 ? _a : new history_service_1.SagaHistoriesService(this.axios));
|
|
14
23
|
}
|
|
24
|
+
start(data, config) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return (yield this.post(this.url('start'), data, config)).data;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
append(data, config) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return (yield this.post(this.url('append'), data, config)).data;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
commit(id, config) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return (yield this.patch(this.url(`${id}/commit`), undefined, config)).data;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
abort(id, config) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return (yield this.patch(this.url(`${id}/abort`), undefined, config)).data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
15
44
|
}
|
|
16
45
|
exports.SagasService = SagasService;
|
|
17
46
|
//# sourceMappingURL=sagas.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sagas.service.js","sourceRoot":"","sources":["../../../src/services/special/sagas/sagas.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sagas.service.js","sourceRoot":"","sources":["../../../src/services/special/sagas/sagas.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,uDAAyD;AACzD,qDAAwE;AAExE,MAAa,YAAa,SAAQ,wBAA6B;IAG7D,YAAsB,KAAoB;QACxC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QADF,UAAK,GAAL,KAAK,CAAe;IAE1C,CAAC;IAED,IAAI,SAAS;;QACX,OAAO,CAAC,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,sCAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrF,CAAC;IAEK,KAAK,CACT,IAAkB,EAClB,MAA4B;;YAE5B,OAAO,CACL,MAAM,IAAI,CAAC,IAAI,CACb,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EACjB,IAAI,EACJ,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;IAEK,MAAM,CACV,IAA0B,EAC1B,MAAmC;;YAEnC,OAAO,CACL,MAAM,IAAI,CAAC,IAAI,CACb,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAClB,IAAI,EACJ,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;IAEK,MAAM,CAAC,EAAU,EAAE,MAA4B;;YACnD,OAAO,CACL,MAAM,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EACxB,SAAS,EACT,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;IAEK,KAAK,CAAC,EAAU,EAAE,MAA4B;;YAClD,OAAO,CACL,MAAM,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,EACvB,SAAS,EACT,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;CACF;AAxDD,oCAwDC"}
|