@cinerino/sdk 12.8.0-alpha.1 → 12.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "12.8.0-alpha.1",
3
+ "version": "12.8.0",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -93,7 +93,7 @@
93
93
  "watchify": "^3.11.1"
94
94
  },
95
95
  "dependencies": {
96
- "@chevre/factory": "5.2.0-alpha.11",
96
+ "@chevre/factory": "5.2.0-alpha.15",
97
97
  "debug": "3.2.7",
98
98
  "http-status": "1.7.4",
99
99
  "idtoken-verifier": "2.0.3",
@@ -1,138 +0,0 @@
1
- // tslint:disable:no-console
2
- // tslint:disable-next-line:no-implicit-dependencies
3
- import * as moment from 'moment-timezone';
4
- import * as client from '../../../../lib/index';
5
- import * as auth from '../../auth/authAsAdmin';
6
-
7
- const PROJECT_ID = String(process.env.PROJECT_ID);
8
- const SELLER_ID = '59d20831e53ebc2b4e774466';
9
- const EVENT_SERVICE_ID = '681aa7c1b53b6dbbe5efbec7';
10
- const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
11
- const ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
12
-
13
- // tslint:disable-next-line:max-func-body-length
14
- async function main() {
15
- const authClient = await auth.login();
16
- await authClient.refreshAccessToken();
17
- const loginTicket = authClient.verifyIdToken({});
18
- console.log('username is', loginTicket.getUsername());
19
-
20
- const eventService = await (await client.loadChevreAdmin({
21
- endpoint: <string>process.env.CHEVRE_ENDPOINT,
22
- auth: authClient
23
- })).createEventInstance({
24
- project: { id: PROJECT_ID },
25
- seller: { id: SELLER_ID }
26
- });
27
-
28
- const today = moment()
29
- .tz('Asia/Tokyo')
30
- .format('YYYY-MM-DD');
31
- // const identifier = `fromSamples${moment()
32
- // .format('YYYYMMDDTHHmm')}`;
33
- const identifier = 'fromSamples20251028T1337';
34
- await eventService.createIfNotExistByIdentifier(
35
- [
36
- {
37
- identifier,
38
- doorTime: moment(`${today}T13:00:00Z`)
39
- .toDate(),
40
- startDate: moment(`${today}T13:00:00Z`)
41
- .toDate(),
42
- endDate: moment(`${today}T14:00:00Z`)
43
- .toDate(),
44
- eventStatus: client.factory.eventStatusType.EventScheduled,
45
- additionalProperty: [
46
- { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
47
- ],
48
- maximumPhysicalAttendeeCapacity: 3,
49
- offers: {
50
- unacceptedPaymentMethod: [],
51
- eligibleQuantity: {
52
- maxValue: 6
53
- },
54
- itemOffered: {
55
- id: EVENT_SERVICE_ID
56
- },
57
- seller: {
58
- makesOffer: [
59
- {
60
- typeOf: client.factory.offerType.Offer,
61
- availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
62
- availabilityStarts: moment(`${today}T00:00:00+09:00`)
63
- .toDate(),
64
- availabilityEnds: moment(`${today}T14:00:00Z`)
65
- .toDate(),
66
- validFrom: moment(`${today}T00:00:00+09:00`)
67
- .toDate(),
68
- validThrough: moment(`${today}T14:00:00Z`)
69
- .toDate()
70
- }
71
- ]
72
- // makesOfferDefaultを指定するとmakesOfferよりも優先される
73
- // makesOfferDefault: {
74
- // typeOf: client.factory.offerType.Offer,
75
- // availabilityStarts: moment('2024-05-11T00:00:00.000Z')
76
- // .toDate(),
77
- // availabilityEnds: moment('2024-05-12T00:00:00.000Z')
78
- // .toDate(),
79
- // validFrom: moment('2024-05-11T00:00:00.000Z')
80
- // .toDate(),
81
- // validThrough: moment('2024-05-12T00:00:00.000Z')
82
- // .toDate()
83
- // }
84
- }
85
- }
86
- }
87
- ],
88
- {
89
- locationBranchCode: '10',
90
- superEventId: '7k9ayl8hc',
91
- hasTicketedSeat: true,
92
- typeOf: client.factory.eventType.ScreeningEvent,
93
- disableOverwriteMakesOffer: true,
94
- useExtensibleOffer: false
95
- }
96
- );
97
- console.log('created.');
98
-
99
- await eventService.updateEventsByIdentifier(
100
- [
101
- {
102
- identifier,
103
- doorTime: moment(`${today}T13:00:00Z`)
104
- .toDate(),
105
- startDate: moment(`${today}T13:00:00Z`)
106
- .toDate(),
107
- endDate: moment(`${today}T14:00:00Z`)
108
- .toDate(),
109
- eventStatus: client.factory.eventStatusType.EventScheduled,
110
- additionalProperty: [
111
- { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
112
- ],
113
- maximumPhysicalAttendeeCapacity: 3,
114
- offers: {
115
- unacceptedPaymentMethod: [],
116
- eligibleQuantity: {
117
- maxValue: 6
118
- },
119
- itemOffered: {
120
- id: EVENT_SERVICE_ID
121
- }
122
- }
123
- }
124
- ],
125
- {
126
- typeOf: client.factory.eventType.ScreeningEvent,
127
- disableOverwriteMakesOffer: false
128
- }
129
- );
130
- console.log('updated.');
131
-
132
- }
133
-
134
- main()
135
- .then(() => {
136
- console.log('success!');
137
- })
138
- .catch(console.error);