@chevre/domain 21.9.0 → 21.10.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/README.md
CHANGED
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
[](https://snyk.io/test/github/chevre-jp/domain)
|
|
7
7
|
[](https://nodei.co/npm/@chevre/domain/)
|
|
8
8
|
|
|
9
|
-
Node.js client library for using Chevre backend programming.
|
|
10
|
-
|
|
11
9
|
## Table of contents
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
- [Chevre Domain Library for Node.js](#chevre-domain-library-for-nodejs)
|
|
12
|
+
- [Table of contents](#table-of-contents)
|
|
13
|
+
- [Usage](#usage)
|
|
14
|
+
- [License](#license)
|
|
16
15
|
|
|
17
16
|
## Usage
|
|
18
17
|
|
|
@@ -20,36 +19,6 @@ Node.js client library for using Chevre backend programming.
|
|
|
20
19
|
npm install @chevre/domain
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
### Environment variables
|
|
24
|
-
|
|
25
|
-
| Name | Required | Value | Purpose |
|
|
26
|
-
| -------------------------------- | -------- | --------------- | ------------------------------ |
|
|
27
|
-
| `AWS_ACCESS_KEY_ID` | true | | AWS access key |
|
|
28
|
-
| `AWS_SECRET_ACCESS_KEY` | true | | AWS secret access key |
|
|
29
|
-
| `CHEVRE_AUTHORIZE_SERVER_DOMAIN` | true | | Chevre credentials |
|
|
30
|
-
| `CHEVRE_CLIENT_ID` | true | | Chevre credentials |
|
|
31
|
-
| `CHEVRE_CLIENT_SECRET` | true | | Chevre credentials |
|
|
32
|
-
| `CHEVRE_ENDPOINT` | true | | Chevre credentials |
|
|
33
|
-
| `CUSTOM_SEARCH_ENGINE_ID` | true | | Google Custom Search Engine ID |
|
|
34
|
-
| `COA_ENDPOINT` | true | | COA credentilas |
|
|
35
|
-
| `COA_REFRESH_TOKEN` | true | | credentilas |
|
|
36
|
-
| `DEBUG` | false | chevre-domain:* | Debug |
|
|
37
|
-
| `GOOGLE_API_KEY` | true | | Google API Key |
|
|
38
|
-
| `INFORM_ORDER_URL` | false | | Inform Order URLs |
|
|
39
|
-
| `INFORM_TRANSACTION_URL` | false | | Inform Transaction URLs |
|
|
40
|
-
| `LINE_NOTIFY_URL` | true | | LINE Notify URL |
|
|
41
|
-
| `LINE_NOTIFY_ACCESS_TOKEN` | true | | LINE Notify access token |
|
|
42
|
-
| `SENDGRID_API_KEY` | true | | SendGrid API key |
|
|
43
|
-
| `COA_TIMEOUT` | false | | Timeout settings |
|
|
44
|
-
| `GMO_TIMEOUT` | false | | Timeout settings |
|
|
45
|
-
| `MVTK_TIMEOUT` | false | | Timeout settings |
|
|
46
|
-
| `TRIGGER_WEBHOOK_TIMEOUT` | false | | Timeout settings |
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## Code Samples
|
|
50
|
-
|
|
51
|
-
Code sample are [here](https://github.com/chevre-jp/domain/tree/master/example).
|
|
52
|
-
|
|
53
22
|
## License
|
|
54
23
|
|
|
55
24
|
ISC
|
|
@@ -92,7 +92,7 @@ async function main() {
|
|
|
92
92
|
.toDate(),
|
|
93
93
|
description: {
|
|
94
94
|
en: 'english description',
|
|
95
|
-
ja: '
|
|
95
|
+
ja: 'イベント説明'
|
|
96
96
|
},
|
|
97
97
|
headline: {
|
|
98
98
|
en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
|
|
@@ -261,7 +261,7 @@ async function main() {
|
|
|
261
261
|
.toDate(),
|
|
262
262
|
description: {
|
|
263
263
|
en: 'english description',
|
|
264
|
-
ja: '
|
|
264
|
+
ja: 'イベント説明'
|
|
265
265
|
},
|
|
266
266
|
headline: {
|
|
267
267
|
en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
|
|
@@ -6,27 +6,31 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
7
|
|
|
8
8
|
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex:
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
11
|
const orderRepo = new chevre.repository.Order(mongoose.connection);
|
|
12
12
|
|
|
13
13
|
const orders = await orderRepo.search({
|
|
14
14
|
limit: 10,
|
|
15
15
|
project: { id: { $eq: project.id } },
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// $in: [
|
|
25
|
-
// { name: 'orderId', value: '0102022031518442020' },
|
|
26
|
-
// { name: 'orderId', value: '0102022031518423030' }
|
|
27
|
-
// ]
|
|
28
|
-
// }
|
|
16
|
+
acceptedOffers: {
|
|
17
|
+
// $size: 1
|
|
18
|
+
// itemOffered: {
|
|
19
|
+
// issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.MembershipService } }
|
|
20
|
+
// }
|
|
21
|
+
},
|
|
22
|
+
orderedItem: {
|
|
23
|
+
$size: 3
|
|
29
24
|
}
|
|
25
|
+
// paymentMethods: {
|
|
26
|
+
// paymentMethod: { identifier: { $in: ['Cash'] } }
|
|
27
|
+
// additionalProperty: {
|
|
28
|
+
// $in: [
|
|
29
|
+
// { name: 'orderId', value: '0102022031518442020' },
|
|
30
|
+
// { name: 'orderId', value: '0102022031518423030' }
|
|
31
|
+
// ]
|
|
32
|
+
// }
|
|
33
|
+
// }
|
|
30
34
|
});
|
|
31
35
|
console.log('orders found', orders);
|
|
32
36
|
console.log(orders.length, 'orders found');
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -24,7 +24,7 @@ class MongoRepository {
|
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
26
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
|
|
28
28
|
const andConditions = [];
|
|
29
29
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
30
30
|
if (typeof projectIdEq === 'string') {
|
|
@@ -345,7 +345,15 @@ class MongoRepository {
|
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
|
-
const
|
|
348
|
+
const orderedItemSize = (_r = params.orderedItem) === null || _r === void 0 ? void 0 : _r.$size;
|
|
349
|
+
if (typeof orderedItemSize === 'number') {
|
|
350
|
+
andConditions.push({ orderedItem: { $size: orderedItemSize } });
|
|
351
|
+
}
|
|
352
|
+
const acceptedOffersSize = (_s = params.acceptedOffers) === null || _s === void 0 ? void 0 : _s.$size;
|
|
353
|
+
if (typeof acceptedOffersSize === 'number') {
|
|
354
|
+
andConditions.push({ acceptedOffers: { $size: acceptedOffersSize } });
|
|
355
|
+
}
|
|
356
|
+
const itemOfferedIdentifierIn = (_v = (_u = (_t = params.acceptedOffers) === null || _t === void 0 ? void 0 : _t.itemOffered) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$in;
|
|
349
357
|
if (Array.isArray(itemOfferedIdentifierIn)) {
|
|
350
358
|
andConditions.push({
|
|
351
359
|
'acceptedOffers.itemOffered.identifier': {
|
|
@@ -354,7 +362,7 @@ class MongoRepository {
|
|
|
354
362
|
}
|
|
355
363
|
});
|
|
356
364
|
}
|
|
357
|
-
const itemOfferedTypeOfIn = (
|
|
365
|
+
const itemOfferedTypeOfIn = (_y = (_x = (_w = params.acceptedOffers) === null || _w === void 0 ? void 0 : _w.itemOffered) === null || _x === void 0 ? void 0 : _x.typeOf) === null || _y === void 0 ? void 0 : _y.$in;
|
|
358
366
|
if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
359
367
|
andConditions.push({
|
|
360
368
|
'acceptedOffers.itemOffered.typeOf': {
|
|
@@ -363,7 +371,7 @@ class MongoRepository {
|
|
|
363
371
|
}
|
|
364
372
|
});
|
|
365
373
|
}
|
|
366
|
-
const itemOfferedIssuedThroughTypeOfEq = (
|
|
374
|
+
const itemOfferedIssuedThroughTypeOfEq = (_2 = (_1 = (_0 = (_z = params.acceptedOffers) === null || _z === void 0 ? void 0 : _z.itemOffered) === null || _0 === void 0 ? void 0 : _0.issuedThrough) === null || _1 === void 0 ? void 0 : _1.typeOf) === null || _2 === void 0 ? void 0 : _2.$eq;
|
|
367
375
|
if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
368
376
|
andConditions.push({
|
|
369
377
|
'acceptedOffers.itemOffered.issuedThrough.typeOf': {
|
|
@@ -372,7 +380,7 @@ class MongoRepository {
|
|
|
372
380
|
}
|
|
373
381
|
});
|
|
374
382
|
}
|
|
375
|
-
const itemOfferedIssuedThroughIdIn = (
|
|
383
|
+
const itemOfferedIssuedThroughIdIn = (_6 = (_5 = (_4 = (_3 = params.acceptedOffers) === null || _3 === void 0 ? void 0 : _3.itemOffered) === null || _4 === void 0 ? void 0 : _4.issuedThrough) === null || _5 === void 0 ? void 0 : _5.id) === null || _6 === void 0 ? void 0 : _6.$in;
|
|
376
384
|
if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
377
385
|
andConditions.push({
|
|
378
386
|
'acceptedOffers.itemOffered.issuedThrough.id': {
|
|
@@ -381,7 +389,7 @@ class MongoRepository {
|
|
|
381
389
|
}
|
|
382
390
|
});
|
|
383
391
|
}
|
|
384
|
-
const itemOfferedProgramMembershipUsedIdentifierEq = (
|
|
392
|
+
const itemOfferedProgramMembershipUsedIdentifierEq = (_10 = (_9 = (_8 = (_7 = params.acceptedOffers) === null || _7 === void 0 ? void 0 : _7.itemOffered) === null || _8 === void 0 ? void 0 : _8.programMembershipUsed) === null || _9 === void 0 ? void 0 : _9.identifier) === null || _10 === void 0 ? void 0 : _10.$eq;
|
|
385
393
|
if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
386
394
|
andConditions.push({
|
|
387
395
|
'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
|
|
@@ -390,7 +398,7 @@ class MongoRepository {
|
|
|
390
398
|
}
|
|
391
399
|
});
|
|
392
400
|
}
|
|
393
|
-
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (
|
|
401
|
+
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_16 = (_15 = (_14 = (_13 = (_12 = (_11 = params.acceptedOffers) === null || _11 === void 0 ? void 0 : _11.itemOffered) === null || _12 === void 0 ? void 0 : _12.programMembershipUsed) === null || _13 === void 0 ? void 0 : _13.issuedThrough) === null || _14 === void 0 ? void 0 : _14.serviceType) === null || _15 === void 0 ? void 0 : _15.codeValue) === null || _16 === void 0 ? void 0 : _16.$eq;
|
|
394
402
|
if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
395
403
|
andConditions.push({
|
|
396
404
|
'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
@@ -552,11 +560,11 @@ class MongoRepository {
|
|
|
552
560
|
}
|
|
553
561
|
}
|
|
554
562
|
}
|
|
555
|
-
const paymentMethodIdentifierIn = (
|
|
563
|
+
const paymentMethodIdentifierIn = (_19 = (_18 = (_17 = params.paymentMethods) === null || _17 === void 0 ? void 0 : _17.paymentMethod) === null || _18 === void 0 ? void 0 : _18.identifier) === null || _19 === void 0 ? void 0 : _19.$in;
|
|
556
564
|
if (Array.isArray(paymentMethodIdentifierIn)) {
|
|
557
565
|
andConditions.push({ 'paymentMethods.paymentMethod.identifier': { $exists: true, $in: paymentMethodIdentifierIn } });
|
|
558
566
|
}
|
|
559
|
-
const paymentMethodsTypeOfIn = (
|
|
567
|
+
const paymentMethodsTypeOfIn = (_20 = params.paymentMethods) === null || _20 === void 0 ? void 0 : _20.typeOfs;
|
|
560
568
|
if (Array.isArray(paymentMethodsTypeOfIn)) {
|
|
561
569
|
andConditions.push({ 'paymentMethods.typeOf': { $exists: true, $in: paymentMethodsTypeOfIn } });
|
|
562
570
|
}
|
|
@@ -584,7 +592,7 @@ class MongoRepository {
|
|
|
584
592
|
});
|
|
585
593
|
}
|
|
586
594
|
}
|
|
587
|
-
const paymentMethodAdditionalPropertyAll = (
|
|
595
|
+
const paymentMethodAdditionalPropertyAll = (_22 = (_21 = params.paymentMethods) === null || _21 === void 0 ? void 0 : _21.additionalProperty) === null || _22 === void 0 ? void 0 : _22.$all;
|
|
588
596
|
if (Array.isArray(paymentMethodAdditionalPropertyAll)) {
|
|
589
597
|
andConditions.push({
|
|
590
598
|
'paymentMethods.additionalProperty': {
|
|
@@ -593,7 +601,7 @@ class MongoRepository {
|
|
|
593
601
|
}
|
|
594
602
|
});
|
|
595
603
|
}
|
|
596
|
-
const paymentMethodAdditionalPropertyIn = (
|
|
604
|
+
const paymentMethodAdditionalPropertyIn = (_24 = (_23 = params.paymentMethods) === null || _23 === void 0 ? void 0 : _23.additionalProperty) === null || _24 === void 0 ? void 0 : _24.$in;
|
|
597
605
|
if (Array.isArray(paymentMethodAdditionalPropertyIn)) {
|
|
598
606
|
andConditions.push({
|
|
599
607
|
'paymentMethods.additionalProperty': {
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.331.0",
|
|
13
|
+
"@cinerino/sdk": "3.170.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.
|
|
120
|
+
"version": "21.10.0"
|
|
121
121
|
}
|