@cinerino/sdk 12.3.0-alpha.1 → 12.3.0-alpha.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.
|
@@ -51,12 +51,12 @@ async function main() {
|
|
|
51
51
|
},
|
|
52
52
|
additionalProperty: [
|
|
53
53
|
{ name: 'sampleCreateId', value: 'xxx' }
|
|
54
|
-
]
|
|
55
|
-
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
54
|
+
]
|
|
55
|
+
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
56
56
|
// location: {
|
|
57
57
|
// branchCode: '10'
|
|
58
58
|
// },
|
|
59
|
-
superEvent: { id: '7k9ayl8hc' }
|
|
59
|
+
// superEvent: { id: '7k9ayl8hc' }
|
|
60
60
|
}
|
|
61
61
|
],
|
|
62
62
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
2
|
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
-
import * as moment from 'moment';
|
|
3
|
+
import * as moment from 'moment-timezone';
|
|
4
4
|
import * as client from '../../../../lib/index';
|
|
5
5
|
import * as auth from '../../auth/authAsAdmin';
|
|
6
6
|
|
|
@@ -24,24 +24,23 @@ async function main() {
|
|
|
24
24
|
seller: { id: SELLER_ID }
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
+
const today = moment()
|
|
28
|
+
.tz('Asia/Tokyo')
|
|
29
|
+
.format('YYYY-MM-DD');
|
|
27
30
|
await eventService.upsertManyByAdditionalProperty({
|
|
28
31
|
filter: { name: ADDITIONAL_PROPERTY_NAME },
|
|
29
|
-
options: {
|
|
30
|
-
superEventId: '7k9ayl8hc',
|
|
31
|
-
locationBranchCode: '10'
|
|
32
|
-
},
|
|
33
32
|
attributes: [
|
|
34
33
|
{
|
|
35
34
|
typeOf: client.factory.eventType.ScreeningEvent,
|
|
36
|
-
project: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
doorTime: moment(
|
|
35
|
+
// project: {
|
|
36
|
+
// typeOf: client.factory.organizationType.Project,
|
|
37
|
+
// id: PROJECT_ID
|
|
38
|
+
// },
|
|
39
|
+
doorTime: moment(`${today}T13:00:00Z`)
|
|
41
40
|
.toDate(),
|
|
42
|
-
startDate: moment(
|
|
41
|
+
startDate: moment(`${today}T13:00:00Z`)
|
|
43
42
|
.toDate(),
|
|
44
|
-
endDate: moment(
|
|
43
|
+
endDate: moment(`${today}T14:00:00Z`)
|
|
45
44
|
.toDate(),
|
|
46
45
|
eventStatus: client.factory.eventStatusType.EventScheduled,
|
|
47
46
|
additionalProperty: [
|
|
@@ -52,9 +51,9 @@ async function main() {
|
|
|
52
51
|
}
|
|
53
52
|
],
|
|
54
53
|
// maximumPhysicalAttendeeCapacity: 3,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
location: {
|
|
55
|
+
branchCode: '10'
|
|
56
|
+
},
|
|
58
57
|
superEvent: {
|
|
59
58
|
id: '7k9ayl8hc'
|
|
60
59
|
},
|
|
@@ -71,13 +70,13 @@ async function main() {
|
|
|
71
70
|
{
|
|
72
71
|
typeOf: client.factory.offerType.Offer,
|
|
73
72
|
availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
|
|
74
|
-
availabilityStarts: moment(
|
|
73
|
+
availabilityStarts: moment(`${today}T13:00:00Z`)
|
|
75
74
|
.toDate(),
|
|
76
|
-
availabilityEnds: moment(
|
|
75
|
+
availabilityEnds: moment(`${today}T14:00:00Z`)
|
|
77
76
|
.toDate(),
|
|
78
|
-
validFrom: moment(
|
|
77
|
+
validFrom: moment(`${today}T13:00:00Z`)
|
|
79
78
|
.toDate(),
|
|
80
|
-
validThrough: moment(
|
|
79
|
+
validThrough: moment(`${today}T14:00:00Z`)
|
|
81
80
|
.toDate()
|
|
82
81
|
}
|
|
83
82
|
]
|
|
@@ -3,6 +3,20 @@ import { Service } from '../../service';
|
|
|
3
3
|
declare type ISendEmailMessageOnEventUpdated = Pick<factory.action.transfer.send.message.email.IAttributes, 'purpose' | 'recipient'> & {
|
|
4
4
|
object: factory.action.transfer.send.message.email.IObjectAsEmailMessage;
|
|
5
5
|
};
|
|
6
|
+
declare type ICreateScreeningEventParams = Omit<factory.event.ICreateParams<factory.eventType.ScreeningEvent>, 'location' | 'superEvent'> & {
|
|
7
|
+
/**
|
|
8
|
+
* ルームコードを指定
|
|
9
|
+
*/
|
|
10
|
+
location: {
|
|
11
|
+
branchCode: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 施設コンテンツIDを指定
|
|
15
|
+
*/
|
|
16
|
+
superEvent: {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
6
20
|
/**
|
|
7
21
|
* イベントサービス
|
|
8
22
|
*/
|
|
@@ -16,23 +30,13 @@ export declare class EventService extends Service {
|
|
|
16
30
|
/**
|
|
17
31
|
* 最大長:10
|
|
18
32
|
*/
|
|
19
|
-
attributes:
|
|
33
|
+
attributes: ICreateScreeningEventParams[];
|
|
20
34
|
filter: {
|
|
21
35
|
/**
|
|
22
36
|
* キーにする追加特性name
|
|
23
37
|
*/
|
|
24
38
|
name: string;
|
|
25
39
|
};
|
|
26
|
-
options: {
|
|
27
|
-
/**
|
|
28
|
-
* 施設コンテンツID
|
|
29
|
-
*/
|
|
30
|
-
superEventId: string;
|
|
31
|
-
/**
|
|
32
|
-
* ルームコード
|
|
33
|
-
*/
|
|
34
|
-
locationBranchCode: string;
|
|
35
|
-
};
|
|
36
40
|
}): Promise<void>;
|
|
37
41
|
/**
|
|
38
42
|
* イベントステータス更新
|
|
@@ -50,6 +50,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
54
|
+
var t = {};
|
|
55
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
56
|
+
t[p] = s[p];
|
|
57
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
58
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
59
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
60
|
+
t[p[i]] = s[p[i]];
|
|
61
|
+
}
|
|
62
|
+
return t;
|
|
63
|
+
};
|
|
53
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
65
|
exports.EventService = void 0;
|
|
55
66
|
var factory = require("../../factory");
|
|
@@ -69,44 +80,60 @@ var EventService = /** @class */ (function (_super) {
|
|
|
69
80
|
* 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
|
|
70
81
|
*/
|
|
71
82
|
EventService.prototype.upsertManyByAdditionalProperty = function (params) {
|
|
83
|
+
var _a, _b, _c, _d;
|
|
72
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
85
|
+
var superEventId, locationBranchCode, upsertParams, _e, auth, endpoint, project, seller, chevreAdmin, eventService;
|
|
86
|
+
return __generator(this, function (_f) {
|
|
87
|
+
switch (_f.label) {
|
|
76
88
|
case 0:
|
|
77
|
-
|
|
89
|
+
if (!Array.isArray(params.attributes) || params.attributes.length === 0) {
|
|
90
|
+
throw new factory.errors.ArgumentNull('body');
|
|
91
|
+
}
|
|
92
|
+
superEventId = (_b = (_a = params.attributes[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
|
|
93
|
+
locationBranchCode = (_d = (_c = params.attributes[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
|
|
94
|
+
if (typeof superEventId !== 'string' || superEventId === '') {
|
|
95
|
+
throw new factory.errors.ArgumentNull('superEvent.id');
|
|
96
|
+
}
|
|
97
|
+
if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
|
|
98
|
+
throw new factory.errors.ArgumentNull('location.branchCode');
|
|
99
|
+
}
|
|
100
|
+
upsertParams = params.attributes.map(function (_a) {
|
|
101
|
+
var location = _a.location, superEvent = _a.superEvent, identifier = _a.identifier, createFields = __rest(_a, ["location", "superEvent", "identifier"]);
|
|
102
|
+
return createFields;
|
|
103
|
+
});
|
|
104
|
+
_e = this.options, auth = _e.auth, endpoint = _e.endpoint, project = _e.project, seller = _e.seller;
|
|
78
105
|
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
|
|
79
106
|
case 1:
|
|
80
|
-
chevreAdmin =
|
|
107
|
+
chevreAdmin = _f.sent();
|
|
81
108
|
return [4 /*yield*/, chevreAdmin.createEventInstance({
|
|
82
109
|
project: project,
|
|
83
110
|
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
84
111
|
})];
|
|
85
112
|
case 2:
|
|
86
|
-
eventService =
|
|
87
|
-
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(
|
|
113
|
+
eventService = _f.sent();
|
|
114
|
+
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
|
|
88
115
|
filter: { name: params.filter.name },
|
|
89
116
|
update: false,
|
|
90
|
-
superEventId:
|
|
91
|
-
locationBranchCode:
|
|
117
|
+
superEventId: superEventId,
|
|
118
|
+
locationBranchCode: locationBranchCode
|
|
92
119
|
})];
|
|
93
120
|
case 3:
|
|
94
|
-
|
|
121
|
+
_f.sent();
|
|
95
122
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
96
123
|
setTimeout(function () { resolve(); },
|
|
97
124
|
// tslint:disable-next-line:no-magic-numbers
|
|
98
125
|
1000);
|
|
99
126
|
})];
|
|
100
127
|
case 4:
|
|
101
|
-
|
|
102
|
-
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(
|
|
128
|
+
_f.sent();
|
|
129
|
+
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
|
|
103
130
|
filter: { name: params.filter.name },
|
|
104
131
|
update: true,
|
|
105
|
-
superEventId:
|
|
106
|
-
locationBranchCode:
|
|
132
|
+
superEventId: superEventId,
|
|
133
|
+
locationBranchCode: locationBranchCode
|
|
107
134
|
})];
|
|
108
135
|
case 5:
|
|
109
|
-
|
|
136
|
+
_f.sent();
|
|
110
137
|
return [2 /*return*/];
|
|
111
138
|
}
|
|
112
139
|
});
|
package/lib/bundle.js
CHANGED
|
@@ -20729,6 +20729,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
20729
20729
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
20730
20730
|
}
|
|
20731
20731
|
};
|
|
20732
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
20733
|
+
var t = {};
|
|
20734
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20735
|
+
t[p] = s[p];
|
|
20736
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
20737
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
20738
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20739
|
+
t[p[i]] = s[p[i]];
|
|
20740
|
+
}
|
|
20741
|
+
return t;
|
|
20742
|
+
};
|
|
20732
20743
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20733
20744
|
exports.EventService = void 0;
|
|
20734
20745
|
var factory = require("../../factory");
|
|
@@ -20748,44 +20759,60 @@ var EventService = /** @class */ (function (_super) {
|
|
|
20748
20759
|
* 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
|
|
20749
20760
|
*/
|
|
20750
20761
|
EventService.prototype.upsertManyByAdditionalProperty = function (params) {
|
|
20762
|
+
var _a, _b, _c, _d;
|
|
20751
20763
|
return __awaiter(this, void 0, void 0, function () {
|
|
20752
|
-
var
|
|
20753
|
-
return __generator(this, function (
|
|
20754
|
-
switch (
|
|
20764
|
+
var superEventId, locationBranchCode, upsertParams, _e, auth, endpoint, project, seller, chevreAdmin, eventService;
|
|
20765
|
+
return __generator(this, function (_f) {
|
|
20766
|
+
switch (_f.label) {
|
|
20755
20767
|
case 0:
|
|
20756
|
-
|
|
20768
|
+
if (!Array.isArray(params.attributes) || params.attributes.length === 0) {
|
|
20769
|
+
throw new factory.errors.ArgumentNull('body');
|
|
20770
|
+
}
|
|
20771
|
+
superEventId = (_b = (_a = params.attributes[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
|
|
20772
|
+
locationBranchCode = (_d = (_c = params.attributes[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
|
|
20773
|
+
if (typeof superEventId !== 'string' || superEventId === '') {
|
|
20774
|
+
throw new factory.errors.ArgumentNull('superEvent.id');
|
|
20775
|
+
}
|
|
20776
|
+
if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
|
|
20777
|
+
throw new factory.errors.ArgumentNull('location.branchCode');
|
|
20778
|
+
}
|
|
20779
|
+
upsertParams = params.attributes.map(function (_a) {
|
|
20780
|
+
var location = _a.location, superEvent = _a.superEvent, identifier = _a.identifier, createFields = __rest(_a, ["location", "superEvent", "identifier"]);
|
|
20781
|
+
return createFields;
|
|
20782
|
+
});
|
|
20783
|
+
_e = this.options, auth = _e.auth, endpoint = _e.endpoint, project = _e.project, seller = _e.seller;
|
|
20757
20784
|
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
|
|
20758
20785
|
case 1:
|
|
20759
|
-
chevreAdmin =
|
|
20786
|
+
chevreAdmin = _f.sent();
|
|
20760
20787
|
return [4 /*yield*/, chevreAdmin.createEventInstance({
|
|
20761
20788
|
project: project,
|
|
20762
20789
|
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
20763
20790
|
})];
|
|
20764
20791
|
case 2:
|
|
20765
|
-
eventService =
|
|
20766
|
-
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(
|
|
20792
|
+
eventService = _f.sent();
|
|
20793
|
+
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
|
|
20767
20794
|
filter: { name: params.filter.name },
|
|
20768
20795
|
update: false,
|
|
20769
|
-
superEventId:
|
|
20770
|
-
locationBranchCode:
|
|
20796
|
+
superEventId: superEventId,
|
|
20797
|
+
locationBranchCode: locationBranchCode
|
|
20771
20798
|
})];
|
|
20772
20799
|
case 3:
|
|
20773
|
-
|
|
20800
|
+
_f.sent();
|
|
20774
20801
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
20775
20802
|
setTimeout(function () { resolve(); },
|
|
20776
20803
|
// tslint:disable-next-line:no-magic-numbers
|
|
20777
20804
|
1000);
|
|
20778
20805
|
})];
|
|
20779
20806
|
case 4:
|
|
20780
|
-
|
|
20781
|
-
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(
|
|
20807
|
+
_f.sent();
|
|
20808
|
+
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
|
|
20782
20809
|
filter: { name: params.filter.name },
|
|
20783
20810
|
update: true,
|
|
20784
|
-
superEventId:
|
|
20785
|
-
locationBranchCode:
|
|
20811
|
+
superEventId: superEventId,
|
|
20812
|
+
locationBranchCode: locationBranchCode
|
|
20786
20813
|
})];
|
|
20787
20814
|
case 5:
|
|
20788
|
-
|
|
20815
|
+
_f.sent();
|
|
20789
20816
|
return [2 /*return*/];
|
|
20790
20817
|
}
|
|
20791
20818
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cinerino/sdk",
|
|
3
|
-
"version": "12.3.0-alpha.
|
|
3
|
+
"version": "12.3.0-alpha.2",
|
|
4
4
|
"description": "Cinerino SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"jwt-decode": "^2.2.0",
|
|
79
79
|
"mocha": "10.6.0",
|
|
80
80
|
"moment": "2.30.1",
|
|
81
|
+
"moment-timezone": "0.6.0",
|
|
81
82
|
"nock": "13.4.0",
|
|
82
83
|
"nyc": "17.0.0",
|
|
83
84
|
"open": "^8.2.1",
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
"watchify": "^3.11.1"
|
|
93
94
|
},
|
|
94
95
|
"dependencies": {
|
|
95
|
-
"@chevre/factory": "4.398.0-alpha.
|
|
96
|
+
"@chevre/factory": "4.398.0-alpha.2",
|
|
96
97
|
"debug": "3.2.7",
|
|
97
98
|
"http-status": "1.7.4",
|
|
98
99
|
"idtoken-verifier": "2.0.3",
|