@cinerino/sdk 12.2.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.
@@ -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 = '656038908b1cd5ce629f5992';
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-08-27T07:00:00.000Z')
40
+ doorTime: moment('2025-09-01T10:00:00Z')
37
41
  .toDate(),
38
- startDate: moment('2025-08-27T07:00:00.000Z')
42
+ startDate: moment('2025-09-01T10:00:00Z')
39
43
  .toDate(),
40
- endDate: moment('2025-08-27T07:10:00.000Z')
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('YYYYMMDD')}`
51
+ .format('YYYY-MM-DD HH:mm')}`
48
52
  }
49
53
  ],
50
- location: {
51
- branchCode: '90'
52
- },
54
+ // maximumPhysicalAttendeeCapacity: 3,
55
+ // location: {
56
+ // branchCode: '10'
57
+ // },
53
58
  superEvent: {
54
- id: 'bkeuv7fdu'
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-08-27T00:00:00.000Z')
74
+ availabilityStarts: moment('2025-06-30T10:00:00Z')
70
75
  .toDate(),
71
- availabilityEnds: moment('2025-08-27T00:00:00.000Z')
76
+ availabilityEnds: moment('2025-09-30T10:00:00Z')
72
77
  .toDate(),
73
- validFrom: moment('2025-08-27T00:00:00.000Z')
78
+ validFrom: moment('2025-06-30T10:00:00Z')
74
79
  .toDate(),
75
- validThrough: moment('2025-08-27T15:00:00.000Z')
80
+ validThrough: moment('2025-09-30T10:00:00Z')
76
81
  .toDate()
77
82
  }
78
83
  ]
@@ -20,6 +20,8 @@ export declare class EventService extends Service {
20
20
  name: string;
21
21
  };
22
22
  update: boolean;
23
+ superEventId: string;
24
+ locationBranchCode: string;
23
25
  }): Promise<void>;
24
26
  /**
25
27
  * イベント部分更新
@@ -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 (_e) {
76
- switch (_e.label) {
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 = (_b = (_a = params[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
82
- locationBranchCode = (_d = (_c = params[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
80
+ superEventId = options.superEventId;
81
+ locationBranchCode = options.locationBranchCode;
83
82
  if (typeof superEventId !== 'string' || superEventId === '') {
84
- throw new factory.errors.ArgumentNull('superEvent.id');
83
+ throw new factory.errors.ArgumentNull('superEventId');
85
84
  }
86
85
  if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
87
- throw new factory.errors.ArgumentNull('location.branchCode');
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
- _e.sent();
102
+ _a.sent();
104
103
  return [2 /*return*/];
105
104
  }
106
105
  });
@@ -13,11 +13,12 @@ declare type IUnset<T extends factory.eventType> = {
13
13
  */
14
14
  export declare class EventService extends Service {
15
15
  /**
16
- * 上映イベント複数作成
16
+ * 興行イベント複数作成
17
17
  */
18
18
  createScreeningEvents(params: factory.event.ICreateParams<factory.eventType.ScreeningEvent>[], options: {
19
19
  superEventId: string;
20
20
  locationBranchCode: string;
21
+ hasTicketedSeat: boolean;
21
22
  }): Promise<void>;
22
23
  /**
23
24
  * イベント複数作成
@@ -39,13 +40,22 @@ export declare class EventService extends Service {
39
40
  id: string;
40
41
  typeOf: T;
41
42
  }): Promise<factory.event.IEvent<T>>;
43
+ /**
44
+ * 興行イベント更新
45
+ */
46
+ updateScreeningEventById(params: {
47
+ id: string;
48
+ attributes: factory.event.screeningEvent.IUpdateParams & {
49
+ $unset?: IUnset<factory.eventType.ScreeningEvent>;
50
+ };
51
+ }): Promise<void>;
42
52
  /**
43
53
  * イベント更新
44
54
  */
45
- updateById<T extends factory.eventType.Event | factory.eventType.ScreeningEvent>(params: {
55
+ updateAnyEventById(params: {
46
56
  id: string;
47
- attributes: factory.event.IUpdateParams<T> & {
48
- $unset?: IUnset<T>;
57
+ attributes: factory.event.IUpdateParams<factory.eventType.Event> & {
58
+ $unset?: IUnset<factory.eventType.Event>;
49
59
  };
50
60
  }): Promise<void>;
51
61
  }
@@ -64,7 +64,7 @@ var EventService = /** @class */ (function (_super) {
64
64
  return _super !== null && _super.apply(this, arguments) || this;
65
65
  }
66
66
  /**
67
- * 上映イベント複数作成
67
+ * 興行イベント複数作成
68
68
  */
69
69
  EventService.prototype.createScreeningEvents = function (params,
70
70
  // add options(2025-08-26~)
@@ -164,10 +164,33 @@ var EventService = /** @class */ (function (_super) {
164
164
  });
165
165
  });
166
166
  };
167
+ /**
168
+ * 興行イベント更新
169
+ */
170
+ EventService.prototype.updateScreeningEventById = function (params) {
171
+ return __awaiter(this, void 0, void 0, function () {
172
+ return __generator(this, function (_a) {
173
+ switch (_a.label) {
174
+ case 0: return [4 /*yield*/, this.fetch({
175
+ uri: "/events/" + encodeURIComponent(String(params.id)),
176
+ method: 'PUT',
177
+ body: params.attributes,
178
+ qs: {
179
+ typeOf: factory.eventType.ScreeningEvent
180
+ },
181
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
182
+ })];
183
+ case 1:
184
+ _a.sent();
185
+ return [2 /*return*/];
186
+ }
187
+ });
188
+ });
189
+ };
167
190
  /**
168
191
  * イベント更新
169
192
  */
170
- EventService.prototype.updateById = function (params) {
193
+ EventService.prototype.updateAnyEventById = function (params) {
171
194
  return __awaiter(this, void 0, void 0, function () {
172
195
  return __generator(this, function (_a) {
173
196
  switch (_a.label) {
@@ -175,7 +198,9 @@ var EventService = /** @class */ (function (_super) {
175
198
  uri: "/events/" + encodeURIComponent(String(params.id)),
176
199
  method: 'PUT',
177
200
  body: params.attributes,
178
- // qs: params.qs,
201
+ qs: {
202
+ typeOf: factory.eventType.Event
203
+ },
179
204
  expectedStatusCodes: [http_status_1.NO_CONTENT]
180
205
  })];
181
206
  case 1:
@@ -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 (_e) {
2582
- switch (_e.label) {
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 = (_b = (_a = params[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
2588
- locationBranchCode = (_d = (_c = params[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
2586
+ superEventId = options.superEventId;
2587
+ locationBranchCode = options.locationBranchCode;
2589
2588
  if (typeof superEventId !== 'string' || superEventId === '') {
2590
- throw new factory.errors.ArgumentNull('superEvent.id');
2589
+ throw new factory.errors.ArgumentNull('superEventId');
2591
2590
  }
2592
2591
  if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
2593
- throw new factory.errors.ArgumentNull('location.branchCode');
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
- _e.sent();
2608
+ _a.sent();
2610
2609
  return [2 /*return*/];
2611
2610
  }
2612
2611
  });
@@ -9520,7 +9519,7 @@ var EventService = /** @class */ (function (_super) {
9520
9519
  return _super !== null && _super.apply(this, arguments) || this;
9521
9520
  }
9522
9521
  /**
9523
- * 上映イベント複数作成
9522
+ * 興行イベント複数作成
9524
9523
  */
9525
9524
  EventService.prototype.createScreeningEvents = function (params,
9526
9525
  // add options(2025-08-26~)
@@ -9620,10 +9619,33 @@ var EventService = /** @class */ (function (_super) {
9620
9619
  });
9621
9620
  });
9622
9621
  };
9622
+ /**
9623
+ * 興行イベント更新
9624
+ */
9625
+ EventService.prototype.updateScreeningEventById = function (params) {
9626
+ return __awaiter(this, void 0, void 0, function () {
9627
+ return __generator(this, function (_a) {
9628
+ switch (_a.label) {
9629
+ case 0: return [4 /*yield*/, this.fetch({
9630
+ uri: "/events/" + encodeURIComponent(String(params.id)),
9631
+ method: 'PUT',
9632
+ body: params.attributes,
9633
+ qs: {
9634
+ typeOf: factory.eventType.ScreeningEvent
9635
+ },
9636
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
9637
+ })];
9638
+ case 1:
9639
+ _a.sent();
9640
+ return [2 /*return*/];
9641
+ }
9642
+ });
9643
+ });
9644
+ };
9623
9645
  /**
9624
9646
  * イベント更新
9625
9647
  */
9626
- EventService.prototype.updateById = function (params) {
9648
+ EventService.prototype.updateAnyEventById = function (params) {
9627
9649
  return __awaiter(this, void 0, void 0, function () {
9628
9650
  return __generator(this, function (_a) {
9629
9651
  switch (_a.label) {
@@ -9631,7 +9653,9 @@ var EventService = /** @class */ (function (_super) {
9631
9653
  uri: "/events/" + encodeURIComponent(String(params.id)),
9632
9654
  method: 'PUT',
9633
9655
  body: params.attributes,
9634
- // qs: params.qs,
9656
+ qs: {
9657
+ typeOf: factory.eventType.Event
9658
+ },
9635
9659
  expectedStatusCodes: [http_status_1.NO_CONTENT]
9636
9660
  })];
9637
9661
  case 1:
@@ -20741,7 +20765,9 @@ var EventService = /** @class */ (function (_super) {
20741
20765
  eventService = _b.sent();
20742
20766
  return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
20743
20767
  filter: { name: params.filter.name },
20744
- update: false
20768
+ update: false,
20769
+ superEventId: params.options.superEventId,
20770
+ locationBranchCode: params.options.locationBranchCode
20745
20771
  })];
20746
20772
  case 3:
20747
20773
  _b.sent();
@@ -20754,7 +20780,9 @@ var EventService = /** @class */ (function (_super) {
20754
20780
  _b.sent();
20755
20781
  return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
20756
20782
  filter: { name: params.filter.name },
20757
- update: true
20783
+ update: true,
20784
+ superEventId: params.options.superEventId,
20785
+ locationBranchCode: params.options.locationBranchCode
20758
20786
  })];
20759
20787
  case 5:
20760
20788
  _b.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "12.2.0",
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.397.0-alpha.0",
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",