@wenex/sdk 0.8.0 → 0.8.2
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/enums/special/sagas/histories/{fn.enum.d.ts → action.enum.d.ts} +1 -1
- package/common/enums/special/sagas/histories/action.enum.js +22 -0
- package/common/enums/special/sagas/histories/action.enum.js.map +1 -0
- package/common/enums/special/sagas/histories/index.d.ts +2 -2
- package/common/enums/special/sagas/histories/index.js +3 -3
- package/common/enums/special/sagas/histories/index.js.map +1 -1
- package/common/interfaces/financial/transaction.interface.d.ts +4 -1
- package/common/interfaces/special/saga/history.interface.d.ts +4 -4
- package/package.json +1 -1
- package/services/financial/transactions.service.d.ts +5 -2
- package/services/financial/transactions.service.js +24 -0
- package/services/financial/transactions.service.js.map +1 -1
- package/common/enums/special/sagas/histories/fn.enum.js +0 -22
- package/common/enums/special/sagas/histories/fn.enum.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SagaHistoryAction = void 0;
|
|
4
|
+
var SagaHistoryAction;
|
|
5
|
+
(function (SagaHistoryAction) {
|
|
6
|
+
SagaHistoryAction["Count"] = "count";
|
|
7
|
+
SagaHistoryAction["Create"] = "create";
|
|
8
|
+
SagaHistoryAction["CreateBulk"] = "create-bulk";
|
|
9
|
+
SagaHistoryAction["Find"] = "find";
|
|
10
|
+
SagaHistoryAction["FindOne"] = "find-one";
|
|
11
|
+
SagaHistoryAction["FindById"] = "find-by-id";
|
|
12
|
+
SagaHistoryAction["DeleteOne"] = "delete-one";
|
|
13
|
+
SagaHistoryAction["DeleteById"] = "delete-by-id";
|
|
14
|
+
SagaHistoryAction["RestoreOne"] = "restore-one";
|
|
15
|
+
SagaHistoryAction["RestoreById"] = "restore-by-id";
|
|
16
|
+
SagaHistoryAction["DestroyOne"] = "destroy-one";
|
|
17
|
+
SagaHistoryAction["DestroyById"] = "destroy-by-id";
|
|
18
|
+
SagaHistoryAction["UpdateOne"] = "update-one";
|
|
19
|
+
SagaHistoryAction["UpdateById"] = "update-by-id";
|
|
20
|
+
SagaHistoryAction["UpdateBulk"] = "update-bulk";
|
|
21
|
+
})(SagaHistoryAction || (exports.SagaHistoryAction = SagaHistoryAction = {}));
|
|
22
|
+
//# sourceMappingURL=action.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.enum.js","sourceRoot":"","sources":["../../../../../src/common/enums/special/sagas/histories/action.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAqBX;AArBD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,sCAAiB,CAAA;IACjB,+CAA0B,CAAA;IAE1B,kCAAa,CAAA;IACb,yCAAoB,CAAA;IACpB,4CAAuB,CAAA;IAEvB,6CAAwB,CAAA;IACxB,gDAA2B,CAAA;IAE3B,+CAA0B,CAAA;IAC1B,kDAA6B,CAAA;IAE7B,+CAA0B,CAAA;IAC1B,kDAA6B,CAAA;IAE7B,6CAAwB,CAAA;IACxB,gDAA2B,CAAA;IAC3B,+CAA0B,CAAA;AAC5B,CAAC,EArBW,iBAAiB,iCAAjB,iBAAiB,QAqB5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export { Collection as
|
|
1
|
+
export * from './action.enum';
|
|
2
|
+
export { Collection as SagaHistoryResource } from '../../../common';
|
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
exports.SagaHistoryResource = void 0;
|
|
18
|
+
__exportStar(require("./action.enum"), exports);
|
|
19
19
|
var common_1 = require("../../../common");
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "SagaHistoryResource", { enumerable: true, get: function () { return common_1.Collection; } });
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/common/enums/special/sagas/histories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/common/enums/special/sagas/histories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAE9B,0CAAoE;AAA3D,6GAAA,UAAU,OAAuB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Document } from 'mongoose';
|
|
2
2
|
import { Pay, PayDto } from './common';
|
|
3
|
-
import { Core, Dto, Properties } from '../common';
|
|
3
|
+
import { Core, Dto, MakeOptional, Properties } from '../common';
|
|
4
4
|
import { TransactionReason, TransactionState, TransactionType } from '../../enums';
|
|
5
5
|
export interface Transaction<Props extends Properties = Properties> extends Core<Props> {
|
|
6
6
|
type: TransactionType;
|
|
@@ -9,8 +9,10 @@ export interface Transaction<Props extends Properties = Properties> extends Core
|
|
|
9
9
|
amount: number;
|
|
10
10
|
payees?: Pay[];
|
|
11
11
|
payers?: Pay[];
|
|
12
|
+
failed_at?: Date;
|
|
12
13
|
verified_at?: Date;
|
|
13
14
|
canceled_at?: Date;
|
|
15
|
+
rollbacked_at?: Date;
|
|
14
16
|
invoice?: string;
|
|
15
17
|
}
|
|
16
18
|
export type TransactionDoc = Transaction & Document;
|
|
@@ -18,3 +20,4 @@ export type TransactionDto = Dto<Omit<Transaction, 'payers' | 'payees'>> & {
|
|
|
18
20
|
payees?: PayDto[];
|
|
19
21
|
payers?: PayDto[];
|
|
20
22
|
};
|
|
23
|
+
export type TransactionInitDto = MakeOptional<TransactionDto, 'state' | 'failed_at' | 'verified_at' | 'canceled_at' | 'rollbacked_at'>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Document } from 'mongoose';
|
|
2
2
|
import { Core, Dto, MakeOptional } from '../../common';
|
|
3
|
-
import {
|
|
3
|
+
import { SagaHistoryAction, SagaHistoryResource } from '../../../enums';
|
|
4
4
|
export interface SagaHistory<Req = any, Res = any> extends Core {
|
|
5
5
|
saga: string;
|
|
6
6
|
db: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
action: SagaHistoryAction;
|
|
8
|
+
resource: SagaHistoryResource;
|
|
9
9
|
req: Req;
|
|
10
10
|
res: Res;
|
|
11
11
|
}
|
|
12
12
|
export type SagaHistoryDoc<Req = any, Res = any> = SagaHistory<Req, Res> & Document;
|
|
13
13
|
export type SagaHistoryDto<Req = any, Res = any> = Dto<SagaHistory<Req, Res>>;
|
|
14
|
-
export type SagaHistoryAppendDto<Req = any, Res = any> = Dto<MakeOptional<SagaHistory<Req, Res>, 'res'>>;
|
|
14
|
+
export type SagaHistoryAppendDto<Req = any, Res = any> = Dto<MakeOptional<SagaHistory<Req, Res>, 'db' | 'res'>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Serializer, Transaction, TransactionDto, TransactionInitDto } from '../../common/interfaces';
|
|
3
|
+
import { RequestConfig, RestfulService } from '../../common/classes';
|
|
4
4
|
export declare class TransactionsService extends RestfulService<Transaction, TransactionDto> {
|
|
5
5
|
protected axios: AxiosInstance;
|
|
6
6
|
constructor(axios: AxiosInstance);
|
|
7
|
+
init(data: TransactionInitDto, config?: RequestConfig<Transaction>): Promise<Serializer<Transaction>>;
|
|
8
|
+
abort(id: string, config?: RequestConfig<Transaction>): Promise<Serializer<Transaction>>;
|
|
9
|
+
verify(id: string, config?: RequestConfig<Transaction>): Promise<Serializer<Transaction>>;
|
|
7
10
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
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.TransactionsService = void 0;
|
|
4
13
|
const classes_1 = require("../../common/classes");
|
|
@@ -7,6 +16,21 @@ class TransactionsService extends classes_1.RestfulService {
|
|
|
7
16
|
super('transactions', axios);
|
|
8
17
|
this.axios = axios;
|
|
9
18
|
}
|
|
19
|
+
init(data, config) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return (yield this.post(this.url('init'), data, config)).data;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
abort(id, config) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return (yield this.patch(this.url(`${id}/abort`), undefined, config)).data;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
verify(id, config) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return (yield this.patch(this.url(`${id}/verify`), undefined, config)).data;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
10
34
|
}
|
|
11
35
|
exports.TransactionsService = TransactionsService;
|
|
12
36
|
//# sourceMappingURL=transactions.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.service.js","sourceRoot":"","sources":["../../src/services/financial/transactions.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transactions.service.js","sourceRoot":"","sources":["../../src/services/financial/transactions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,kDAAqE;AAErE,MAAa,mBAAoB,SAAQ,wBAA2C;IAClF,YAAsB,KAAoB;QACxC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QADT,UAAK,GAAL,KAAK,CAAe;IAE1C,CAAC;IAEK,IAAI,CACR,IAAwB,EACxB,MAAmC;;YAEnC,OAAO,CACL,MAAM,IAAI,CAAC,IAAI,CACb,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAChB,IAAI,EACJ,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;IAEK,KAAK,CACT,EAAU,EACV,MAAmC;;YAEnC,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;IAEK,MAAM,CACV,EAAU,EACV,MAAmC;;YAEnC,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;CACF;AA3CD,kDA2CC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SagaHistoryFn = void 0;
|
|
4
|
-
var SagaHistoryFn;
|
|
5
|
-
(function (SagaHistoryFn) {
|
|
6
|
-
SagaHistoryFn["Count"] = "count";
|
|
7
|
-
SagaHistoryFn["Create"] = "create";
|
|
8
|
-
SagaHistoryFn["CreateBulk"] = "create-bulk";
|
|
9
|
-
SagaHistoryFn["Find"] = "find";
|
|
10
|
-
SagaHistoryFn["FindOne"] = "find-one";
|
|
11
|
-
SagaHistoryFn["FindById"] = "find-by-id";
|
|
12
|
-
SagaHistoryFn["DeleteOne"] = "delete-one";
|
|
13
|
-
SagaHistoryFn["DeleteById"] = "delete-by-id";
|
|
14
|
-
SagaHistoryFn["RestoreOne"] = "restore-one";
|
|
15
|
-
SagaHistoryFn["RestoreById"] = "restore-by-id";
|
|
16
|
-
SagaHistoryFn["DestroyOne"] = "destroy-one";
|
|
17
|
-
SagaHistoryFn["DestroyById"] = "destroy-by-id";
|
|
18
|
-
SagaHistoryFn["UpdateOne"] = "update-one";
|
|
19
|
-
SagaHistoryFn["UpdateById"] = "update-by-id";
|
|
20
|
-
SagaHistoryFn["UpdateBulk"] = "update-bulk";
|
|
21
|
-
})(SagaHistoryFn || (exports.SagaHistoryFn = SagaHistoryFn = {}));
|
|
22
|
-
//# sourceMappingURL=fn.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fn.enum.js","sourceRoot":"","sources":["../../../../../src/common/enums/special/sagas/histories/fn.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAqBX;AArBD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,kCAAiB,CAAA;IACjB,2CAA0B,CAAA;IAE1B,8BAAa,CAAA;IACb,qCAAoB,CAAA;IACpB,wCAAuB,CAAA;IAEvB,yCAAwB,CAAA;IACxB,4CAA2B,CAAA;IAE3B,2CAA0B,CAAA;IAC1B,8CAA6B,CAAA;IAE7B,2CAA0B,CAAA;IAC1B,8CAA6B,CAAA;IAE7B,yCAAwB,CAAA;IACxB,4CAA2B,CAAA;IAC3B,2CAA0B,CAAA;AAC5B,CAAC,EArBW,aAAa,6BAAb,aAAa,QAqBxB"}
|