@cinerino/sdk 12.3.0-alpha.0 → 12.3.0-alpha.1
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/example/src/chevre/console/adminEvents.ts +75 -0
- package/example/src/cloud/admin/adminUpsertManyEventsByAdditionalProperty.ts +18 -13
- package/lib/abstract/chevreAdmin/event.d.ts +2 -0
- package/lib/abstract/chevreAdmin/event.js +7 -8
- package/lib/abstract/cloud/admin/event.d.ts +10 -0
- package/lib/abstract/cloud/admin/event.js +6 -2
- package/lib/bundle.js +13 -10
- package/package.json +2 -2
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import * as moment from 'moment';
|
|
4
|
+
import { factory, loadChevreConsole } from '../../../../lib/index';
|
|
5
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
const authClient = await auth.login();
|
|
11
|
+
await authClient.refreshAccessToken();
|
|
12
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
13
|
+
console.log('username is', loginTicket.getUsername());
|
|
14
|
+
|
|
15
|
+
const eventService = await (await loadChevreConsole({
|
|
16
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
17
|
+
auth: authClient
|
|
18
|
+
})).createEventInstance({
|
|
19
|
+
project,
|
|
20
|
+
seller: { id: '' }
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
await eventService.createScreeningEvents(
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
typeOf: factory.eventType.ScreeningEvent,
|
|
27
|
+
eventStatus: factory.eventStatusType.EventScheduled,
|
|
28
|
+
startDate: moment('2025-09-01T10:00:00Z')
|
|
29
|
+
.toDate(),
|
|
30
|
+
endDate: moment('2025-09-01T11:00:00Z')
|
|
31
|
+
.toDate(),
|
|
32
|
+
offers: {
|
|
33
|
+
itemOffered: { id: '681aa7c1b53b6dbbe5efbec7' },
|
|
34
|
+
eligibleQuantity: { maxValue: 6 },
|
|
35
|
+
seller: {
|
|
36
|
+
makesOffer: [
|
|
37
|
+
// {
|
|
38
|
+
// typeOf: factory.offerType.Offer,
|
|
39
|
+
// availabilityEnds: moment('2025-09-30T10:00:00Z')
|
|
40
|
+
// .toDate(),
|
|
41
|
+
// availabilityStarts: moment('2025-05-30T10:00:00Z')
|
|
42
|
+
// .toDate(),
|
|
43
|
+
// validFrom: moment('2025-05-30T10:00:00Z')
|
|
44
|
+
// .toDate(),
|
|
45
|
+
// validThrough: moment('2025-09-30T10:00:00Z')
|
|
46
|
+
// .toDate(),
|
|
47
|
+
// availableAtOrFrom: { id: '51qbjcfr72h62m06vtv5kkhgje' }
|
|
48
|
+
// }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
additionalProperty: [
|
|
53
|
+
{ name: 'sampleCreateId', value: 'xxx' }
|
|
54
|
+
],
|
|
55
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
56
|
+
// location: {
|
|
57
|
+
// branchCode: '10'
|
|
58
|
+
// },
|
|
59
|
+
superEvent: { id: '7k9ayl8hc' }
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
{
|
|
63
|
+
superEventId: '7k9ayl8hc',
|
|
64
|
+
locationBranchCode: '10',
|
|
65
|
+
hasTicketedSeat: true
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
console.log('created.');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
main()
|
|
72
|
+
.then(() => {
|
|
73
|
+
console.log('success!');
|
|
74
|
+
})
|
|
75
|
+
.catch(console.error);
|
|
@@ -6,7 +6,7 @@ import * as auth from '../../auth/authAsAdmin';
|
|
|
6
6
|
|
|
7
7
|
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
8
8
|
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
9
|
-
const EVENT_SERVICE_ID = '
|
|
9
|
+
const EVENT_SERVICE_ID = '681aa7c1b53b6dbbe5efbec7';
|
|
10
10
|
const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
|
|
11
11
|
const ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
|
|
12
12
|
|
|
@@ -26,6 +26,10 @@ async function main() {
|
|
|
26
26
|
|
|
27
27
|
await eventService.upsertManyByAdditionalProperty({
|
|
28
28
|
filter: { name: ADDITIONAL_PROPERTY_NAME },
|
|
29
|
+
options: {
|
|
30
|
+
superEventId: '7k9ayl8hc',
|
|
31
|
+
locationBranchCode: '10'
|
|
32
|
+
},
|
|
29
33
|
attributes: [
|
|
30
34
|
{
|
|
31
35
|
typeOf: client.factory.eventType.ScreeningEvent,
|
|
@@ -33,25 +37,26 @@ async function main() {
|
|
|
33
37
|
typeOf: client.factory.organizationType.Project,
|
|
34
38
|
id: PROJECT_ID
|
|
35
39
|
},
|
|
36
|
-
doorTime: moment('2025-
|
|
40
|
+
doorTime: moment('2025-09-01T10:00:00Z')
|
|
37
41
|
.toDate(),
|
|
38
|
-
startDate: moment('2025-
|
|
42
|
+
startDate: moment('2025-09-01T10:00:00Z')
|
|
39
43
|
.toDate(),
|
|
40
|
-
endDate: moment('2025-
|
|
44
|
+
endDate: moment('2025-09-01T11:00:00Z')
|
|
41
45
|
.toDate(),
|
|
42
46
|
eventStatus: client.factory.eventStatusType.EventScheduled,
|
|
43
47
|
additionalProperty: [
|
|
44
48
|
// { name: ADDITIONAL_PROPERTY_NAME, value: `fromSamples:${Date.now()}` }
|
|
45
49
|
{
|
|
46
50
|
name: ADDITIONAL_PROPERTY_NAME, value: `fromSamples:${moment()
|
|
47
|
-
.format('
|
|
51
|
+
.format('YYYY-MM-DD HH:mm')}`
|
|
48
52
|
}
|
|
49
53
|
],
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
// maximumPhysicalAttendeeCapacity: 3,
|
|
55
|
+
// location: {
|
|
56
|
+
// branchCode: '10'
|
|
57
|
+
// },
|
|
53
58
|
superEvent: {
|
|
54
|
-
id: '
|
|
59
|
+
id: '7k9ayl8hc'
|
|
55
60
|
},
|
|
56
61
|
offers: {
|
|
57
62
|
unacceptedPaymentMethod: [],
|
|
@@ -66,13 +71,13 @@ async function main() {
|
|
|
66
71
|
{
|
|
67
72
|
typeOf: client.factory.offerType.Offer,
|
|
68
73
|
availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
|
|
69
|
-
availabilityStarts: moment('2025-
|
|
74
|
+
availabilityStarts: moment('2025-06-30T10:00:00Z')
|
|
70
75
|
.toDate(),
|
|
71
|
-
availabilityEnds: moment('2025-
|
|
76
|
+
availabilityEnds: moment('2025-09-30T10:00:00Z')
|
|
72
77
|
.toDate(),
|
|
73
|
-
validFrom: moment('2025-
|
|
78
|
+
validFrom: moment('2025-06-30T10:00:00Z')
|
|
74
79
|
.toDate(),
|
|
75
|
-
validThrough: moment('2025-
|
|
80
|
+
validThrough: moment('2025-09-30T10:00:00Z')
|
|
76
81
|
.toDate()
|
|
77
82
|
}
|
|
78
83
|
]
|
|
@@ -69,22 +69,21 @@ var EventService = /** @class */ (function (_super) {
|
|
|
69
69
|
* 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
|
|
70
70
|
*/
|
|
71
71
|
EventService.prototype.upsertManyByAdditionalProperty = function (params, options) {
|
|
72
|
-
var _a, _b, _c, _d;
|
|
73
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
73
|
var superEventId, locationBranchCode;
|
|
75
|
-
return __generator(this, function (
|
|
76
|
-
switch (
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
77
76
|
case 0:
|
|
78
77
|
if (!Array.isArray(params) || params.length === 0) {
|
|
79
78
|
throw new factory.errors.ArgumentNull('body');
|
|
80
79
|
}
|
|
81
|
-
superEventId =
|
|
82
|
-
locationBranchCode =
|
|
80
|
+
superEventId = options.superEventId;
|
|
81
|
+
locationBranchCode = options.locationBranchCode;
|
|
83
82
|
if (typeof superEventId !== 'string' || superEventId === '') {
|
|
84
|
-
throw new factory.errors.ArgumentNull('
|
|
83
|
+
throw new factory.errors.ArgumentNull('superEventId');
|
|
85
84
|
}
|
|
86
85
|
if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
|
|
87
|
-
throw new factory.errors.ArgumentNull('
|
|
86
|
+
throw new factory.errors.ArgumentNull('locationBranchCode');
|
|
88
87
|
}
|
|
89
88
|
return [4 /*yield*/, this.fetch({
|
|
90
89
|
uri: '/events',
|
|
@@ -100,7 +99,7 @@ var EventService = /** @class */ (function (_super) {
|
|
|
100
99
|
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
101
100
|
})];
|
|
102
101
|
case 1:
|
|
103
|
-
|
|
102
|
+
_a.sent();
|
|
104
103
|
return [2 /*return*/];
|
|
105
104
|
}
|
|
106
105
|
});
|
|
@@ -23,6 +23,16 @@ export declare class EventService extends Service {
|
|
|
23
23
|
*/
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
|
+
options: {
|
|
27
|
+
/**
|
|
28
|
+
* 施設コンテンツID
|
|
29
|
+
*/
|
|
30
|
+
superEventId: string;
|
|
31
|
+
/**
|
|
32
|
+
* ルームコード
|
|
33
|
+
*/
|
|
34
|
+
locationBranchCode: string;
|
|
35
|
+
};
|
|
26
36
|
}): Promise<void>;
|
|
27
37
|
/**
|
|
28
38
|
* イベントステータス更新
|
|
@@ -86,7 +86,9 @@ var EventService = /** @class */ (function (_super) {
|
|
|
86
86
|
eventService = _b.sent();
|
|
87
87
|
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
|
|
88
88
|
filter: { name: params.filter.name },
|
|
89
|
-
update: false
|
|
89
|
+
update: false,
|
|
90
|
+
superEventId: params.options.superEventId,
|
|
91
|
+
locationBranchCode: params.options.locationBranchCode
|
|
90
92
|
})];
|
|
91
93
|
case 3:
|
|
92
94
|
_b.sent();
|
|
@@ -99,7 +101,9 @@ var EventService = /** @class */ (function (_super) {
|
|
|
99
101
|
_b.sent();
|
|
100
102
|
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
|
|
101
103
|
filter: { name: params.filter.name },
|
|
102
|
-
update: true
|
|
104
|
+
update: true,
|
|
105
|
+
superEventId: params.options.superEventId,
|
|
106
|
+
locationBranchCode: params.options.locationBranchCode
|
|
103
107
|
})];
|
|
104
108
|
case 5:
|
|
105
109
|
_b.sent();
|
package/lib/bundle.js
CHANGED
|
@@ -2575,22 +2575,21 @@ var EventService = /** @class */ (function (_super) {
|
|
|
2575
2575
|
* 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
|
|
2576
2576
|
*/
|
|
2577
2577
|
EventService.prototype.upsertManyByAdditionalProperty = function (params, options) {
|
|
2578
|
-
var _a, _b, _c, _d;
|
|
2579
2578
|
return __awaiter(this, void 0, void 0, function () {
|
|
2580
2579
|
var superEventId, locationBranchCode;
|
|
2581
|
-
return __generator(this, function (
|
|
2582
|
-
switch (
|
|
2580
|
+
return __generator(this, function (_a) {
|
|
2581
|
+
switch (_a.label) {
|
|
2583
2582
|
case 0:
|
|
2584
2583
|
if (!Array.isArray(params) || params.length === 0) {
|
|
2585
2584
|
throw new factory.errors.ArgumentNull('body');
|
|
2586
2585
|
}
|
|
2587
|
-
superEventId =
|
|
2588
|
-
locationBranchCode =
|
|
2586
|
+
superEventId = options.superEventId;
|
|
2587
|
+
locationBranchCode = options.locationBranchCode;
|
|
2589
2588
|
if (typeof superEventId !== 'string' || superEventId === '') {
|
|
2590
|
-
throw new factory.errors.ArgumentNull('
|
|
2589
|
+
throw new factory.errors.ArgumentNull('superEventId');
|
|
2591
2590
|
}
|
|
2592
2591
|
if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
|
|
2593
|
-
throw new factory.errors.ArgumentNull('
|
|
2592
|
+
throw new factory.errors.ArgumentNull('locationBranchCode');
|
|
2594
2593
|
}
|
|
2595
2594
|
return [4 /*yield*/, this.fetch({
|
|
2596
2595
|
uri: '/events',
|
|
@@ -2606,7 +2605,7 @@ var EventService = /** @class */ (function (_super) {
|
|
|
2606
2605
|
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
2607
2606
|
})];
|
|
2608
2607
|
case 1:
|
|
2609
|
-
|
|
2608
|
+
_a.sent();
|
|
2610
2609
|
return [2 /*return*/];
|
|
2611
2610
|
}
|
|
2612
2611
|
});
|
|
@@ -20766,7 +20765,9 @@ var EventService = /** @class */ (function (_super) {
|
|
|
20766
20765
|
eventService = _b.sent();
|
|
20767
20766
|
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
|
|
20768
20767
|
filter: { name: params.filter.name },
|
|
20769
|
-
update: false
|
|
20768
|
+
update: false,
|
|
20769
|
+
superEventId: params.options.superEventId,
|
|
20770
|
+
locationBranchCode: params.options.locationBranchCode
|
|
20770
20771
|
})];
|
|
20771
20772
|
case 3:
|
|
20772
20773
|
_b.sent();
|
|
@@ -20779,7 +20780,9 @@ var EventService = /** @class */ (function (_super) {
|
|
|
20779
20780
|
_b.sent();
|
|
20780
20781
|
return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
|
|
20781
20782
|
filter: { name: params.filter.name },
|
|
20782
|
-
update: true
|
|
20783
|
+
update: true,
|
|
20784
|
+
superEventId: params.options.superEventId,
|
|
20785
|
+
locationBranchCode: params.options.locationBranchCode
|
|
20783
20786
|
})];
|
|
20784
20787
|
case 5:
|
|
20785
20788
|
_b.sent();
|
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.1",
|
|
4
4
|
"description": "Cinerino SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"watchify": "^3.11.1"
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"@chevre/factory": "4.398.0-alpha.
|
|
95
|
+
"@chevre/factory": "4.398.0-alpha.1",
|
|
96
96
|
"debug": "3.2.7",
|
|
97
97
|
"http-status": "1.7.4",
|
|
98
98
|
"idtoken-verifier": "2.0.3",
|