rerobe-js-orm 2.7.19 → 2.7.20

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.
@@ -0,0 +1,5 @@
1
+ import Base from '../../Base';
2
+ import SellerLedgerTransaction from '../../models/SellerLedgerTransaction';
3
+ export default abstract class SellerLedgerTransactionFactory extends Base {
4
+ abstract createSellerLedgerTransaction(timestamp: number, type: SellerLedgerTransactionTypeOptions | string, amount: string | number, balance: string | number, accountId: string, merchantId: string, merchantCurrency: string): SellerLedgerTransaction;
5
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Base_1 = require("../../Base");
4
+ class SellerLedgerTransactionFactory extends Base_1.default {
5
+ }
6
+ exports.default = SellerLedgerTransactionFactory;
@@ -0,0 +1,33 @@
1
+ import Base from '../Base';
2
+ export default class SellerLedgerTransaction extends Base {
3
+ documentId: string;
4
+ createdAtTimestamp: number;
5
+ timestamp: number;
6
+ type: SellerLedgerTransactionTypeOptions | string;
7
+ amount: string | number;
8
+ balance: string | number;
9
+ accountId: string;
10
+ accountName: string;
11
+ accountEmail: string;
12
+ sellerId: string;
13
+ merchantId: string;
14
+ merchantCurrency: string;
15
+ orderId: string;
16
+ productId: string;
17
+ productPrice: string | number;
18
+ productTitle: string;
19
+ productImgUrl: string;
20
+ productCommission: string | number;
21
+ constructor(props?: any);
22
+ toObj(): SellerLedgerTransactionType;
23
+ generateSchemaForTypesense(name?: string): {
24
+ default_sorting_field: string;
25
+ fields: {
26
+ facet: boolean;
27
+ name: string;
28
+ type: string;
29
+ }[];
30
+ name: string;
31
+ };
32
+ toObjForTypesense(): TypesenseSellerLedgerTransactionObj;
33
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Base_1 = require("../Base");
4
+ class SellerLedgerTransaction extends Base_1.default {
5
+ constructor(props) {
6
+ super();
7
+ this.documentId = (props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28);
8
+ this.createdAtTimestamp = (props === null || props === void 0 ? void 0 : props.createdAtTimestamp) || 0;
9
+ this.timestamp = (props === null || props === void 0 ? void 0 : props.timestamp) || 0;
10
+ this.type = (props === null || props === void 0 ? void 0 : props.type) || '';
11
+ this.amount = Number((props === null || props === void 0 ? void 0 : props.amount) || 0);
12
+ this.balance = Number((props === null || props === void 0 ? void 0 : props.balance) || 0);
13
+ this.accountId = (props === null || props === void 0 ? void 0 : props.accountId) || '';
14
+ this.accountName = (props === null || props === void 0 ? void 0 : props.accountName) || '';
15
+ this.accountEmail = (props === null || props === void 0 ? void 0 : props.accountEmail) || '';
16
+ this.sellerId = (props === null || props === void 0 ? void 0 : props.sellerId) || '';
17
+ this.merchantId = (props === null || props === void 0 ? void 0 : props.merchantId) || '';
18
+ this.merchantCurrency = (props === null || props === void 0 ? void 0 : props.merchantCurrency) || '';
19
+ this.orderId = (props === null || props === void 0 ? void 0 : props.orderId) || '';
20
+ this.productId = (props === null || props === void 0 ? void 0 : props.productId) || '';
21
+ this.productPrice = (props === null || props === void 0 ? void 0 : props.productPrice) || '';
22
+ this.productTitle = (props === null || props === void 0 ? void 0 : props.productTitle) || '';
23
+ this.productImgUrl = (props === null || props === void 0 ? void 0 : props.productImgUrl) || '';
24
+ this.productCommission = Number((props === null || props === void 0 ? void 0 : props.productCommission) || 0);
25
+ }
26
+ toObj() {
27
+ const transactionObj = {
28
+ documentId: this.documentId,
29
+ createdAtTimestamp: this.createdAtTimestamp,
30
+ timestamp: this.timestamp,
31
+ type: this.type,
32
+ amount: this.amount,
33
+ balance: this.balance,
34
+ accountId: this.accountId,
35
+ accountName: this.accountName,
36
+ accountEmail: this.accountEmail,
37
+ sellerId: this.sellerId,
38
+ merchantId: this.merchantId,
39
+ merchantCurrency: this.merchantCurrency,
40
+ orderId: this.orderId,
41
+ productId: this.productId,
42
+ productPrice: this.productPrice,
43
+ productTitle: this.productTitle,
44
+ productImgUrl: this.productImgUrl,
45
+ productCommission: this.productCommission,
46
+ };
47
+ return transactionObj;
48
+ }
49
+ generateSchemaForTypesense(name = 'prod_sellerLedgerTransactions_20221026') {
50
+ return {
51
+ default_sorting_field: 'createdAtTimestamp',
52
+ fields: [
53
+ {
54
+ facet: false,
55
+ name: 'id',
56
+ type: 'string',
57
+ },
58
+ {
59
+ facet: false,
60
+ name: 'documentId',
61
+ type: 'string',
62
+ },
63
+ {
64
+ facet: true,
65
+ name: 'createdAtTimestamp',
66
+ type: 'int64',
67
+ },
68
+ {
69
+ facet: true,
70
+ name: 'timestamp',
71
+ type: 'int64',
72
+ },
73
+ {
74
+ facet: true,
75
+ name: 'type',
76
+ type: 'string',
77
+ },
78
+ {
79
+ facet: true,
80
+ name: 'amount',
81
+ type: 'number',
82
+ },
83
+ {
84
+ facet: true,
85
+ name: 'balance',
86
+ type: 'number',
87
+ },
88
+ {
89
+ facet: true,
90
+ name: 'accountId',
91
+ type: 'string',
92
+ },
93
+ {
94
+ facet: true,
95
+ name: 'accountName',
96
+ type: 'string',
97
+ },
98
+ {
99
+ facet: true,
100
+ name: 'accountEmail',
101
+ type: 'string',
102
+ },
103
+ {
104
+ facet: true,
105
+ name: 'sellerId',
106
+ type: 'string',
107
+ },
108
+ {
109
+ facet: true,
110
+ name: 'merchantId',
111
+ type: 'string',
112
+ },
113
+ {
114
+ facet: true,
115
+ name: 'merchantCurrency',
116
+ type: 'string',
117
+ },
118
+ {
119
+ facet: true,
120
+ name: 'orderId',
121
+ type: 'string',
122
+ },
123
+ {
124
+ facet: true,
125
+ name: 'productId',
126
+ type: 'string',
127
+ },
128
+ {
129
+ facet: true,
130
+ name: 'productPrice',
131
+ type: 'string',
132
+ },
133
+ {
134
+ facet: true,
135
+ name: 'productTitle',
136
+ type: 'string',
137
+ },
138
+ {
139
+ facet: false,
140
+ name: 'productImgUrl',
141
+ type: 'string',
142
+ },
143
+ {
144
+ facet: true,
145
+ name: 'productCommission',
146
+ type: 'number',
147
+ },
148
+ ],
149
+ name: 'dev_sellerLedgerTransactions_20221026',
150
+ };
151
+ }
152
+ toObjForTypesense() {
153
+ const stagedObj = {
154
+ id: this.utilities.sanitizeString(this.documentId),
155
+ documentId: this.utilities.sanitizeString(this.documentId),
156
+ createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
157
+ timestamp: this.utilities.sanitizeMillisTimeStamp(this.timestamp),
158
+ type: this.utilities.sanitizeString(this.type),
159
+ amount: this.utilities.sanitizeNumber(this.amount),
160
+ balance: this.utilities.sanitizeNumber(this.balance),
161
+ accountId: this.utilities.sanitizeString(this.accountId),
162
+ accountName: this.utilities.sanitizeString(this.accountName),
163
+ accountEmail: this.utilities.sanitizeString(this.accountEmail),
164
+ sellerId: this.utilities.sanitizeString(this.sellerId),
165
+ merchantId: this.utilities.sanitizeString(this.merchantId),
166
+ merchantCurrency: this.utilities.sanitizeString(this.merchantCurrency),
167
+ orderId: this.utilities.sanitizeString(this.orderId),
168
+ productId: this.utilities.sanitizeString(this.productId),
169
+ productPrice: this.utilities.sanitizeString(this.productPrice),
170
+ productTitle: this.utilities.sanitizeString(this.productTitle),
171
+ productImgUrl: this.utilities.sanitizeString(this.productImgUrl),
172
+ productCommission: this.utilities.sanitizeNumber(this.productCommission),
173
+ };
174
+ return stagedObj;
175
+ }
176
+ }
177
+ exports.default = SellerLedgerTransaction;
@@ -0,0 +1,44 @@
1
+ declare type SellerLedgerTransactionTypeOptions = 'MERCHANT_CREDIT' | 'MERCHANT_DEBIT' | 'SELLER_CREDIT' | 'SELLER_DEBIT';
2
+ declare type SellerLedgerTransactionType = {
3
+ documentId: string;
4
+ createdAtTimestamp: number;
5
+ createdAt?: string;
6
+ updatedAt?: string;
7
+ timestamp?: number;
8
+ type: SellerLedgerTransactionTypeOptions | string;
9
+ amount: string | number;
10
+ balance: string | number;
11
+ accountId: string;
12
+ accountName?: string;
13
+ accountEmail?: string;
14
+ sellerId: string;
15
+ merchantId: string;
16
+ merchantCurrency: string;
17
+ orderId?: string;
18
+ productId?: string;
19
+ productPrice?: string | number;
20
+ productTitle?: string;
21
+ productImgUrl?: string;
22
+ productCommission?: string | number;
23
+ };
24
+ declare type TypesenseSellerLedgerTransactionObj = {
25
+ id: string;
26
+ documentId: string;
27
+ createdAtTimestamp: number;
28
+ timestamp: number;
29
+ type: string;
30
+ amount: number;
31
+ balance: number;
32
+ accountId: string;
33
+ accountName: string;
34
+ accountEmail: string;
35
+ sellerId: string;
36
+ merchantId: string;
37
+ merchantCurrency: string;
38
+ orderId: string;
39
+ productId: string;
40
+ productPrice: string;
41
+ productTitle: string;
42
+ productImgUrl: string;
43
+ productCommission: number;
44
+ };
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.7.19",
3
+ "version": "2.7.20",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",