@cinerino/sdk 12.3.0-alpha.1 → 12.3.0-alpha.3

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
- typeOf: client.factory.organizationType.Project,
38
- id: PROJECT_ID
39
- },
40
- doorTime: moment('2025-09-01T10:00:00Z')
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('2025-09-01T10:00:00Z')
41
+ startDate: moment(`${today}T13:00:00Z`)
43
42
  .toDate(),
44
- endDate: moment('2025-09-01T11:00:00Z')
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
- // location: {
56
- // branchCode: '10'
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('2025-06-30T10:00:00Z')
73
+ availabilityStarts: moment(`${today}T13:00:00Z`)
75
74
  .toDate(),
76
- availabilityEnds: moment('2025-09-30T10:00:00Z')
75
+ availabilityEnds: moment(`${today}T14:00:00Z`)
77
76
  .toDate(),
78
- validFrom: moment('2025-06-30T10:00:00Z')
77
+ validFrom: moment(`${today}T13:00:00Z`)
79
78
  .toDate(),
80
- validThrough: moment('2025-09-30T10:00:00Z')
79
+ validThrough: moment(`${today}T14:00:00Z`)
81
80
  .toDate()
82
81
  }
83
82
  ]
@@ -70,11 +70,11 @@ var EventService = /** @class */ (function (_super) {
70
70
  // add options(2025-08-26~)
71
71
  options) {
72
72
  return __awaiter(this, void 0, void 0, function () {
73
- var superEventId, locationBranchCode;
73
+ var superEventId, locationBranchCode, hasTicketedSeat;
74
74
  return __generator(this, function (_a) {
75
75
  switch (_a.label) {
76
76
  case 0:
77
- superEventId = options.superEventId, locationBranchCode = options.locationBranchCode;
77
+ superEventId = options.superEventId, locationBranchCode = options.locationBranchCode, hasTicketedSeat = options.hasTicketedSeat;
78
78
  return [4 /*yield*/, this.fetch({
79
79
  uri: '/events',
80
80
  method: 'POST',
@@ -83,7 +83,8 @@ var EventService = /** @class */ (function (_super) {
83
83
  expectsNoContent: '1',
84
84
  typeOf: factory.eventType.ScreeningEvent,
85
85
  superEventId: superEventId,
86
- locationBranchCode: locationBranchCode
86
+ locationBranchCode: locationBranchCode,
87
+ hasTicketedSeat: hasTicketedSeat
87
88
  },
88
89
  expectedStatusCodes: [http_status_1.NO_CONTENT]
89
90
  })];
@@ -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: factory.event.ICreateParams<factory.eventType.ScreeningEvent>[];
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 _a, auth, endpoint, project, seller, chevreAdmin, eventService;
74
- return __generator(this, function (_b) {
75
- switch (_b.label) {
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
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
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 = _b.sent();
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 = _b.sent();
87
- return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
113
+ eventService = _f.sent();
114
+ return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
88
115
  filter: { name: params.filter.name },
89
116
  update: false,
90
- superEventId: params.options.superEventId,
91
- locationBranchCode: params.options.locationBranchCode
117
+ superEventId: superEventId,
118
+ locationBranchCode: locationBranchCode
92
119
  })];
93
120
  case 3:
94
- _b.sent();
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
- _b.sent();
102
- return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
128
+ _f.sent();
129
+ return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
103
130
  filter: { name: params.filter.name },
104
131
  update: true,
105
- superEventId: params.options.superEventId,
106
- locationBranchCode: params.options.locationBranchCode
132
+ superEventId: superEventId,
133
+ locationBranchCode: locationBranchCode
107
134
  })];
108
135
  case 5:
109
- _b.sent();
136
+ _f.sent();
110
137
  return [2 /*return*/];
111
138
  }
112
139
  });
package/lib/bundle.js CHANGED
@@ -9525,11 +9525,11 @@ var EventService = /** @class */ (function (_super) {
9525
9525
  // add options(2025-08-26~)
9526
9526
  options) {
9527
9527
  return __awaiter(this, void 0, void 0, function () {
9528
- var superEventId, locationBranchCode;
9528
+ var superEventId, locationBranchCode, hasTicketedSeat;
9529
9529
  return __generator(this, function (_a) {
9530
9530
  switch (_a.label) {
9531
9531
  case 0:
9532
- superEventId = options.superEventId, locationBranchCode = options.locationBranchCode;
9532
+ superEventId = options.superEventId, locationBranchCode = options.locationBranchCode, hasTicketedSeat = options.hasTicketedSeat;
9533
9533
  return [4 /*yield*/, this.fetch({
9534
9534
  uri: '/events',
9535
9535
  method: 'POST',
@@ -9538,7 +9538,8 @@ var EventService = /** @class */ (function (_super) {
9538
9538
  expectsNoContent: '1',
9539
9539
  typeOf: factory.eventType.ScreeningEvent,
9540
9540
  superEventId: superEventId,
9541
- locationBranchCode: locationBranchCode
9541
+ locationBranchCode: locationBranchCode,
9542
+ hasTicketedSeat: hasTicketedSeat
9542
9543
  },
9543
9544
  expectedStatusCodes: [http_status_1.NO_CONTENT]
9544
9545
  })];
@@ -20729,6 +20730,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
20729
20730
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
20730
20731
  }
20731
20732
  };
20733
+ var __rest = (this && this.__rest) || function (s, e) {
20734
+ var t = {};
20735
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20736
+ t[p] = s[p];
20737
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
20738
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20739
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20740
+ t[p[i]] = s[p[i]];
20741
+ }
20742
+ return t;
20743
+ };
20732
20744
  Object.defineProperty(exports, "__esModule", { value: true });
20733
20745
  exports.EventService = void 0;
20734
20746
  var factory = require("../../factory");
@@ -20748,44 +20760,60 @@ var EventService = /** @class */ (function (_super) {
20748
20760
  * 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
20749
20761
  */
20750
20762
  EventService.prototype.upsertManyByAdditionalProperty = function (params) {
20763
+ var _a, _b, _c, _d;
20751
20764
  return __awaiter(this, void 0, void 0, function () {
20752
- var _a, auth, endpoint, project, seller, chevreAdmin, eventService;
20753
- return __generator(this, function (_b) {
20754
- switch (_b.label) {
20765
+ var superEventId, locationBranchCode, upsertParams, _e, auth, endpoint, project, seller, chevreAdmin, eventService;
20766
+ return __generator(this, function (_f) {
20767
+ switch (_f.label) {
20755
20768
  case 0:
20756
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
20769
+ if (!Array.isArray(params.attributes) || params.attributes.length === 0) {
20770
+ throw new factory.errors.ArgumentNull('body');
20771
+ }
20772
+ superEventId = (_b = (_a = params.attributes[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
20773
+ locationBranchCode = (_d = (_c = params.attributes[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
20774
+ if (typeof superEventId !== 'string' || superEventId === '') {
20775
+ throw new factory.errors.ArgumentNull('superEvent.id');
20776
+ }
20777
+ if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
20778
+ throw new factory.errors.ArgumentNull('location.branchCode');
20779
+ }
20780
+ upsertParams = params.attributes.map(function (_a) {
20781
+ var location = _a.location, superEvent = _a.superEvent, identifier = _a.identifier, createFields = __rest(_a, ["location", "superEvent", "identifier"]);
20782
+ return createFields;
20783
+ });
20784
+ _e = this.options, auth = _e.auth, endpoint = _e.endpoint, project = _e.project, seller = _e.seller;
20757
20785
  return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
20758
20786
  case 1:
20759
- chevreAdmin = _b.sent();
20787
+ chevreAdmin = _f.sent();
20760
20788
  return [4 /*yield*/, chevreAdmin.createEventInstance({
20761
20789
  project: project,
20762
20790
  seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
20763
20791
  })];
20764
20792
  case 2:
20765
- eventService = _b.sent();
20766
- return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
20793
+ eventService = _f.sent();
20794
+ return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
20767
20795
  filter: { name: params.filter.name },
20768
20796
  update: false,
20769
- superEventId: params.options.superEventId,
20770
- locationBranchCode: params.options.locationBranchCode
20797
+ superEventId: superEventId,
20798
+ locationBranchCode: locationBranchCode
20771
20799
  })];
20772
20800
  case 3:
20773
- _b.sent();
20801
+ _f.sent();
20774
20802
  return [4 /*yield*/, new Promise(function (resolve) {
20775
20803
  setTimeout(function () { resolve(); },
20776
20804
  // tslint:disable-next-line:no-magic-numbers
20777
20805
  1000);
20778
20806
  })];
20779
20807
  case 4:
20780
- _b.sent();
20781
- return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
20808
+ _f.sent();
20809
+ return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
20782
20810
  filter: { name: params.filter.name },
20783
20811
  update: true,
20784
- superEventId: params.options.superEventId,
20785
- locationBranchCode: params.options.locationBranchCode
20812
+ superEventId: superEventId,
20813
+ locationBranchCode: locationBranchCode
20786
20814
  })];
20787
20815
  case 5:
20788
- _b.sent();
20816
+ _f.sent();
20789
20817
  return [2 /*return*/];
20790
20818
  }
20791
20819
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "12.3.0-alpha.1",
3
+ "version": "12.3.0-alpha.3",
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.1",
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",