@cinerino/sdk 12.3.0-alpha.0 → 12.3.0-alpha.10

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.
Files changed (34) hide show
  1. package/example/playground/public/lib/bundle.js +59 -24
  2. package/example/src/chevre/admin/adminCreateEventIfNotExistByIdentifier.ts +150 -0
  3. package/example/src/chevre/admin/adminCreateEventIfNotExistByIdentifierBySoftware.ts +103 -0
  4. package/example/src/chevre/admin/adminCreateNotesIfNotExistByIdentifier.ts +71 -0
  5. package/example/src/chevre/admin/adminProductOffersByIdentifier.ts +83 -0
  6. package/example/src/chevre/console/adminEvents.ts +74 -0
  7. package/example/src/cloud/admin/adminCreateEventIfNotExistByIdentifierBySoftware.ts +102 -0
  8. package/example/src/cloud/admin/adminUpsertManyEventsByAdditionalProperty.ts +21 -18
  9. package/example/src/cloud/findOrderByConfirmationNumber.ts +2 -2
  10. package/example/src/cloud/search/findProducts.ts +2 -1
  11. package/example/src/cloud/transaction/processPlaceOrderUsingMemberProgramTier.ts +10 -2
  12. package/example/src/searchEvents.ts +6 -4
  13. package/lib/abstract/chevreAdmin/event.d.ts +43 -0
  14. package/lib/abstract/chevreAdmin/event.js +61 -8
  15. package/lib/abstract/chevreAdmin/note.d.ts +50 -10
  16. package/lib/abstract/chevreAdmin/note.js +42 -19
  17. package/lib/abstract/chevreAdmin/noteAboutOrder.d.ts +21 -0
  18. package/lib/abstract/chevreAdmin/noteAboutOrder.js +120 -0
  19. package/lib/abstract/chevreAdmin/productOffer.d.ts +69 -0
  20. package/lib/abstract/{chevreConsole/eventOffer.js → chevreAdmin/productOffer.js} +46 -63
  21. package/lib/abstract/chevreAdmin.d.ts +20 -2
  22. package/lib/abstract/chevreAdmin.js +40 -0
  23. package/lib/abstract/chevreConsole/event.js +4 -3
  24. package/lib/abstract/chevreConsole.d.ts +0 -9
  25. package/lib/abstract/chevreConsole.js +0 -20
  26. package/lib/abstract/cloud/admin/event.d.ts +45 -1
  27. package/lib/abstract/cloud/admin/event.js +102 -10
  28. package/lib/abstract/cloud/admin/{note.d.ts → noteAboutOrder.d.ts} +17 -3
  29. package/lib/abstract/cloud/admin/{note.js → noteAboutOrder.js} +18 -13
  30. package/lib/abstract/cloud/admin.d.ts +8 -8
  31. package/lib/abstract/cloud/admin.js +8 -8
  32. package/lib/bundle.js +1285 -955
  33. package/package.json +3 -2
  34. package/lib/abstract/chevreConsole/eventOffer.d.ts +0 -32
@@ -1121,22 +1121,21 @@ var EventService = /** @class */ (function (_super) {
1121
1121
  * 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
1122
1122
  */
1123
1123
  EventService.prototype.upsertManyByAdditionalProperty = function (params, options) {
1124
- var _a, _b, _c, _d;
1125
1124
  return __awaiter(this, void 0, void 0, function () {
1126
1125
  var superEventId, locationBranchCode;
1127
- return __generator(this, function (_e) {
1128
- switch (_e.label) {
1126
+ return __generator(this, function (_a) {
1127
+ switch (_a.label) {
1129
1128
  case 0:
1130
1129
  if (!Array.isArray(params) || params.length === 0) {
1131
1130
  throw new factory.errors.ArgumentNull('body');
1132
1131
  }
1133
- superEventId = (_b = (_a = params[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
1134
- locationBranchCode = (_d = (_c = params[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
1132
+ superEventId = options.superEventId;
1133
+ locationBranchCode = options.locationBranchCode;
1135
1134
  if (typeof superEventId !== 'string' || superEventId === '') {
1136
- throw new factory.errors.ArgumentNull('superEvent.id');
1135
+ throw new factory.errors.ArgumentNull('superEventId');
1137
1136
  }
1138
1137
  if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
1139
- throw new factory.errors.ArgumentNull('location.branchCode');
1138
+ throw new factory.errors.ArgumentNull('locationBranchCode');
1140
1139
  }
1141
1140
  return [4 /*yield*/, this.fetch({
1142
1141
  uri: '/events',
@@ -1152,7 +1151,7 @@ var EventService = /** @class */ (function (_super) {
1152
1151
  expectedStatusCodes: [http_status_1.NO_CONTENT]
1153
1152
  })];
1154
1153
  case 1:
1155
- _e.sent();
1154
+ _a.sent();
1156
1155
  return [2 /*return*/];
1157
1156
  }
1158
1157
  });
@@ -8072,11 +8071,11 @@ var EventService = /** @class */ (function (_super) {
8072
8071
  // add options(2025-08-26~)
8073
8072
  options) {
8074
8073
  return __awaiter(this, void 0, void 0, function () {
8075
- var superEventId, locationBranchCode;
8074
+ var superEventId, locationBranchCode, hasTicketedSeat;
8076
8075
  return __generator(this, function (_a) {
8077
8076
  switch (_a.label) {
8078
8077
  case 0:
8079
- superEventId = options.superEventId, locationBranchCode = options.locationBranchCode;
8078
+ superEventId = options.superEventId, locationBranchCode = options.locationBranchCode, hasTicketedSeat = options.hasTicketedSeat;
8080
8079
  return [4 /*yield*/, this.fetch({
8081
8080
  uri: '/events',
8082
8081
  method: 'POST',
@@ -8085,7 +8084,8 @@ var EventService = /** @class */ (function (_super) {
8085
8084
  expectsNoContent: '1',
8086
8085
  typeOf: factory.eventType.ScreeningEvent,
8087
8086
  superEventId: superEventId,
8088
- locationBranchCode: locationBranchCode
8087
+ locationBranchCode: locationBranchCode,
8088
+ hasTicketedSeat: hasTicketedSeat
8089
8089
  },
8090
8090
  expectedStatusCodes: [http_status_1.NO_CONTENT]
8091
8091
  })];
@@ -20730,11 +20730,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
20730
20730
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
20731
20731
  }
20732
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
+ };
20733
20744
  Object.defineProperty(exports, "__esModule", { value: true });
20734
20745
  exports.EventService = void 0;
20735
20746
  var factory = require("../../factory");
20736
20747
  var index_1 = require("../../index");
20737
20748
  var service_1 = require("../../service");
20749
+ function createUpsertParams(params) {
20750
+ var _a, _b, _c, _d;
20751
+ if (!Array.isArray(params.attributes) || params.attributes.length === 0) {
20752
+ throw new factory.errors.ArgumentNull('body');
20753
+ }
20754
+ var superEventId = (_b = (_a = params.attributes[0]) === null || _a === void 0 ? void 0 : _a.superEvent) === null || _b === void 0 ? void 0 : _b.id;
20755
+ var locationBranchCode = (_d = (_c = params.attributes[0]) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.branchCode;
20756
+ if (typeof superEventId !== 'string' || superEventId === '') {
20757
+ throw new factory.errors.ArgumentNull('superEvent.id');
20758
+ }
20759
+ if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
20760
+ throw new factory.errors.ArgumentNull('location.branchCode');
20761
+ }
20762
+ var upsertParams = params.attributes.map(function (_a) {
20763
+ var location = _a.location, superEvent = _a.superEvent, identifier = _a.identifier, typeOf = _a.typeOf, project = _a.project, createFields = __rest(_a, ["location", "superEvent", "identifier", "typeOf", "project"]);
20764
+ return createFields;
20765
+ });
20766
+ return { upsertParams: upsertParams, superEventId: superEventId, locationBranchCode: locationBranchCode };
20767
+ }
20738
20768
  /**
20739
20769
  * イベントサービス
20740
20770
  */
@@ -20750,39 +20780,44 @@ var EventService = /** @class */ (function (_super) {
20750
20780
  */
20751
20781
  EventService.prototype.upsertManyByAdditionalProperty = function (params) {
20752
20782
  return __awaiter(this, void 0, void 0, function () {
20753
- var _a, auth, endpoint, project, seller, chevreAdmin, eventService;
20754
- return __generator(this, function (_b) {
20755
- switch (_b.label) {
20783
+ var _a, upsertParams, superEventId, locationBranchCode, _b, auth, endpoint, project, seller, chevreAdmin, eventService;
20784
+ return __generator(this, function (_c) {
20785
+ switch (_c.label) {
20756
20786
  case 0:
20757
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
20787
+ _a = createUpsertParams(params), upsertParams = _a.upsertParams, superEventId = _a.superEventId, locationBranchCode = _a.locationBranchCode;
20788
+ _b = this.options, auth = _b.auth, endpoint = _b.endpoint, project = _b.project, seller = _b.seller;
20758
20789
  return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
20759
20790
  case 1:
20760
- chevreAdmin = _b.sent();
20791
+ chevreAdmin = _c.sent();
20761
20792
  return [4 /*yield*/, chevreAdmin.createEventInstance({
20762
20793
  project: project,
20763
20794
  seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
20764
20795
  })];
20765
20796
  case 2:
20766
- eventService = _b.sent();
20767
- return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
20797
+ eventService = _c.sent();
20798
+ return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
20768
20799
  filter: { name: params.filter.name },
20769
- update: false
20800
+ update: false,
20801
+ superEventId: superEventId,
20802
+ locationBranchCode: locationBranchCode
20770
20803
  })];
20771
20804
  case 3:
20772
- _b.sent();
20805
+ _c.sent();
20773
20806
  return [4 /*yield*/, new Promise(function (resolve) {
20774
20807
  setTimeout(function () { resolve(); },
20775
20808
  // tslint:disable-next-line:no-magic-numbers
20776
20809
  1000);
20777
20810
  })];
20778
20811
  case 4:
20779
- _b.sent();
20780
- return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(params.attributes, {
20812
+ _c.sent();
20813
+ return [4 /*yield*/, eventService.upsertManyByAdditionalProperty(upsertParams, {
20781
20814
  filter: { name: params.filter.name },
20782
- update: true
20815
+ update: true,
20816
+ superEventId: superEventId,
20817
+ locationBranchCode: locationBranchCode
20783
20818
  })];
20784
20819
  case 5:
20785
- _b.sent();
20820
+ _c.sent();
20786
20821
  return [2 /*return*/];
20787
20822
  }
20788
20823
  });
@@ -0,0 +1,150 @@
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
+ await eventService.createIfNotExistByIdentifier(
34
+ [
35
+ {
36
+ identifier,
37
+ doorTime: moment(`${today}T13:00:00Z`)
38
+ .toDate(),
39
+ startDate: moment(`${today}T13:00:00Z`)
40
+ .toDate(),
41
+ endDate: moment(`${today}T14:00:00Z`)
42
+ .toDate(),
43
+ eventStatus: client.factory.eventStatusType.EventScheduled,
44
+ additionalProperty: [
45
+ { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
46
+ ],
47
+ maximumPhysicalAttendeeCapacity: 3,
48
+ offers: {
49
+ unacceptedPaymentMethod: [],
50
+ eligibleQuantity: {
51
+ maxValue: 6
52
+ },
53
+ itemOffered: {
54
+ id: EVENT_SERVICE_ID
55
+ },
56
+ seller: {
57
+ makesOffer: [
58
+ {
59
+ typeOf: client.factory.offerType.Offer,
60
+ availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
61
+ availabilityStarts: moment(`${today}T00:00:00+09:00`)
62
+ .toDate(),
63
+ availabilityEnds: moment(`${today}T14:00:00Z`)
64
+ .toDate(),
65
+ validFrom: moment(`${today}T00:00:00+09:00`)
66
+ .toDate(),
67
+ validThrough: moment(`${today}T14:00:00Z`)
68
+ .toDate()
69
+ }
70
+ ]
71
+ // makesOfferDefaultを指定するとmakesOfferよりも優先される
72
+ // makesOfferDefault: {
73
+ // typeOf: client.factory.offerType.Offer,
74
+ // availabilityStarts: moment('2024-05-11T00:00:00.000Z')
75
+ // .toDate(),
76
+ // availabilityEnds: moment('2024-05-12T00:00:00.000Z')
77
+ // .toDate(),
78
+ // validFrom: moment('2024-05-11T00:00:00.000Z')
79
+ // .toDate(),
80
+ // validThrough: moment('2024-05-12T00:00:00.000Z')
81
+ // .toDate()
82
+ // }
83
+ }
84
+ }
85
+ }
86
+ ],
87
+ {
88
+ locationBranchCode: '10',
89
+ superEventId: '7k9ayl8hc',
90
+ hasTicketedSeat: true,
91
+ typeOf: client.factory.eventType.ScreeningEvent
92
+ }
93
+ );
94
+ console.log('created.');
95
+
96
+ await eventService.updateEventsByIdentifier(
97
+ [
98
+ {
99
+ identifier,
100
+ doorTime: moment(`${today}T13:00:00Z`)
101
+ .toDate(),
102
+ startDate: moment(`${today}T13:00:00Z`)
103
+ .toDate(),
104
+ endDate: moment(`${today}T14:00:00Z`)
105
+ .toDate(),
106
+ eventStatus: client.factory.eventStatusType.EventScheduled,
107
+ additionalProperty: [
108
+ { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
109
+ ],
110
+ maximumPhysicalAttendeeCapacity: 3,
111
+ offers: {
112
+ unacceptedPaymentMethod: [],
113
+ eligibleQuantity: {
114
+ maxValue: 6
115
+ },
116
+ itemOffered: {
117
+ id: EVENT_SERVICE_ID
118
+ },
119
+ seller: {
120
+ makesOffer: [
121
+ {
122
+ typeOf: client.factory.offerType.Offer,
123
+ availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
124
+ availabilityStarts: moment(`${today}T00:00:00+09:00`)
125
+ .toDate(),
126
+ availabilityEnds: moment(`${today}T14:00:00Z`)
127
+ .toDate(),
128
+ validFrom: moment(`${today}T00:00:00+09:00`)
129
+ .toDate(),
130
+ validThrough: moment(`${today}T14:00:00Z`)
131
+ .toDate()
132
+ }
133
+ ]
134
+ }
135
+ }
136
+ }
137
+ ],
138
+ {
139
+ typeOf: client.factory.eventType.ScreeningEvent
140
+ }
141
+ );
142
+ console.log('updated.');
143
+
144
+ }
145
+
146
+ main()
147
+ .then(() => {
148
+ console.log('success!');
149
+ })
150
+ .catch(console.error);
@@ -0,0 +1,103 @@
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
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const SELLER_ID = '5a392dfdfca1c8737fb6da42';
8
+ const EVENT_SERVICE_ID = '630b139e4dd0621c0496a30c';
9
+ const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
10
+ const ADDITIONAL_PROPERTY_NAME = 'oldEventId';
11
+ const SUPER_EVENT_ID = '7kaf1djmz';
12
+ const LOCATION_BRANCH_CODE = '01';
13
+
14
+ // tslint:disable-next-line:max-func-body-length
15
+ async function main() {
16
+ const authClient = await client.auth.ClientCredentials.createInstance({
17
+ domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
18
+ clientId: <string>process.env.CHEVRE_CLIENT_ID,
19
+ clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
20
+ scopes: [],
21
+ state: ''
22
+ });
23
+
24
+ const eventService = await (await client.loadChevreAdmin({
25
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
26
+ auth: authClient
27
+ })).createEventInstance({
28
+ project: { id: PROJECT_ID },
29
+ seller: { id: SELLER_ID }
30
+ });
31
+
32
+ const today = moment()
33
+ .tz('Asia/Tokyo')
34
+ .format('YYYY-MM-DD');
35
+ const identifier = '250909001001010900';
36
+ await eventService.createIfNotExistByIdentifier(
37
+ [
38
+ {
39
+ identifier,
40
+ doorTime: moment(`${today}T13:00:00Z`)
41
+ .toDate(),
42
+ startDate: moment(`${today}T13:00:00Z`)
43
+ .toDate(),
44
+ endDate: moment(`${today}T14:00:00Z`)
45
+ .toDate(),
46
+ eventStatus: client.factory.eventStatusType.EventScheduled,
47
+ additionalProperty: [
48
+ { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
49
+ ],
50
+ offers: {
51
+ unacceptedPaymentMethod: [],
52
+ eligibleQuantity: {
53
+ maxValue: 6
54
+ },
55
+ itemOffered: {
56
+ id: EVENT_SERVICE_ID
57
+ },
58
+ seller: {
59
+ makesOffer: [
60
+ {
61
+ typeOf: client.factory.offerType.Offer,
62
+ availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
63
+ availabilityStarts: moment(`${today}T00:00:00+09:00`)
64
+ .toDate(),
65
+ availabilityEnds: moment(`${today}T14:00:00Z`)
66
+ .toDate(),
67
+ validFrom: moment(`${today}T00:00:00+09:00`)
68
+ .toDate(),
69
+ validThrough: moment(`${today}T14:00:00Z`)
70
+ .toDate()
71
+ }
72
+ ]
73
+ // makesOfferDefaultを指定するとmakesOfferよりも優先される
74
+ // makesOfferDefault: {
75
+ // typeOf: client.factory.offerType.Offer,
76
+ // availabilityStarts: moment('2024-05-11T00:00:00.000Z')
77
+ // .toDate(),
78
+ // availabilityEnds: moment('2024-05-12T00:00:00.000Z')
79
+ // .toDate(),
80
+ // validFrom: moment('2024-05-11T00:00:00.000Z')
81
+ // .toDate(),
82
+ // validThrough: moment('2024-05-12T00:00:00.000Z')
83
+ // .toDate()
84
+ // }
85
+ }
86
+ }
87
+ }
88
+ ],
89
+ {
90
+ locationBranchCode: LOCATION_BRANCH_CODE,
91
+ superEventId: SUPER_EVENT_ID,
92
+ hasTicketedSeat: true,
93
+ typeOf: client.factory.eventType.ScreeningEvent
94
+ }
95
+ );
96
+ console.log('created.');
97
+ }
98
+
99
+ main()
100
+ .then(() => {
101
+ console.log('success!');
102
+ })
103
+ .catch(console.error);
@@ -0,0 +1,71 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as client from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
8
+ const EVENT_SERVICE_ID = '656038908b1cd5ce629f5992';
9
+ // const EVENT_SERVICE_ID = '656038908b1cd5ce629f5991';
10
+
11
+ // tslint:disable-next-line:max-func-body-length
12
+ async function main() {
13
+ const authClient = await auth.login();
14
+ await authClient.refreshAccessToken();
15
+ const loginTicket = authClient.verifyIdToken({});
16
+ console.log('username is', loginTicket.getUsername());
17
+
18
+ const noteService = await (await client.loadChevreAdmin({
19
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
20
+ auth: authClient
21
+ })).createNoteInstance({
22
+ project: { id: PROJECT_ID },
23
+ seller: { id: SELLER_ID }
24
+ });
25
+
26
+ await noteService.createNotesByIdentifier(
27
+ [
28
+ {
29
+ about: { id: EVENT_SERVICE_ID },
30
+ identifier: 'abcdefgh',
31
+ text: 'sample note text...'
32
+ }
33
+ ],
34
+ {
35
+ aboutTypeOf: client.factory.product.ProductType.EventService
36
+ }
37
+ );
38
+ console.log('created.');
39
+
40
+ await noteService.updateNotesByIdentifier(
41
+ [
42
+ {
43
+ about: { id: EVENT_SERVICE_ID },
44
+ identifier: 'abcdefgh',
45
+ text: 'updated text xxxxx'
46
+ }
47
+ ],
48
+ {
49
+ aboutTypeOf: client.factory.product.ProductType.EventService
50
+ }
51
+ );
52
+ console.log('updated.');
53
+
54
+ const notes = await noteService.findNotes({
55
+ limit: 10,
56
+ page: 1,
57
+ aboutTypeOf: client.factory.product.ProductType.EventService,
58
+ inclusion: ['id', 'identifier', 'text', 'about']
59
+ // aboutIds: [EVENT_SERVICE_ID],
60
+ // identifiers: ['abcdefgh', 'xxx']
61
+ });
62
+ // tslint:disable-next-line:no-null-keyword
63
+ console.dir(notes, { depth: null });
64
+ console.log(notes.length, 'notes found');
65
+ }
66
+
67
+ main()
68
+ .then(() => {
69
+ console.log('success!');
70
+ })
71
+ .catch(console.error);
@@ -0,0 +1,83 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as client from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const MEMBER_TIER_IDENTIFIER = 'bronze';
8
+ const OFFER_IDENTIFIER = '20250924ValidForMemberTier';
9
+ const itemOfferedIdentifier = '20250924ValidForMemberTier';
10
+
11
+ // tslint:disable-next-line:max-func-body-length
12
+ async function main() {
13
+ const authClient = await auth.login();
14
+ await authClient.refreshAccessToken();
15
+ const loginTicket = authClient.verifyIdToken({});
16
+ console.log('username is', loginTicket.getUsername());
17
+
18
+ const productOfferService = await (await client.loadChevreAdmin({
19
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
20
+ auth: authClient
21
+ })).createProductOfferInstance({
22
+ project: { id: PROJECT_ID },
23
+ seller: { id: '' }
24
+ });
25
+
26
+ const now = new Date();
27
+ await productOfferService.createValidForMemberTierByIdentifier(
28
+ [
29
+ {
30
+ identifier: OFFER_IDENTIFIER,
31
+ validForMemberTier: { identifier: MEMBER_TIER_IDENTIFIER },
32
+ validFrom: now,
33
+ validThrough: now
34
+ },
35
+ {
36
+ identifier: OFFER_IDENTIFIER,
37
+ validForMemberTier: { identifier: MEMBER_TIER_IDENTIFIER },
38
+ validFrom: now,
39
+ validThrough: now
40
+ }
41
+ ],
42
+ {
43
+ itemOfferedIdentifier
44
+ }
45
+ );
46
+ console.log('created.');
47
+
48
+ await productOfferService.updateValidForMemberTierByIdentifier(
49
+ [
50
+ {
51
+ identifier: OFFER_IDENTIFIER,
52
+ validForMemberTier: { identifier: MEMBER_TIER_IDENTIFIER },
53
+ validFrom: now,
54
+ validThrough: now
55
+ },
56
+ {
57
+ identifier: OFFER_IDENTIFIER,
58
+ validForMemberTier: { identifier: MEMBER_TIER_IDENTIFIER },
59
+ validFrom: now,
60
+ validThrough: now
61
+ }
62
+ ],
63
+ {
64
+ itemOfferedIdentifier
65
+ }
66
+ );
67
+ console.log('updated.');
68
+
69
+ const offers = await productOfferService.findProductOffers({
70
+ limit: 10,
71
+ page: 1,
72
+ itemOfferedIdentifier
73
+ });
74
+ // tslint:disable-next-line:no-null-keyword
75
+ console.dir(offers, { depth: null });
76
+ console.log(offers.length, 'offers found');
77
+ }
78
+
79
+ main()
80
+ .then(() => {
81
+ console.log('success!');
82
+ })
83
+ .catch(console.error);
@@ -0,0 +1,74 @@
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
+ eventStatus: factory.eventStatusType.EventScheduled,
27
+ startDate: moment('2025-09-01T10:00:00Z')
28
+ .toDate(),
29
+ endDate: moment('2025-09-01T11:00:00Z')
30
+ .toDate(),
31
+ offers: {
32
+ itemOffered: { id: '681aa7c1b53b6dbbe5efbec7' },
33
+ eligibleQuantity: { maxValue: 6 },
34
+ seller: {
35
+ makesOffer: [
36
+ // {
37
+ // typeOf: factory.offerType.Offer,
38
+ // availabilityEnds: moment('2025-09-30T10:00:00Z')
39
+ // .toDate(),
40
+ // availabilityStarts: moment('2025-05-30T10:00:00Z')
41
+ // .toDate(),
42
+ // validFrom: moment('2025-05-30T10:00:00Z')
43
+ // .toDate(),
44
+ // validThrough: moment('2025-09-30T10:00:00Z')
45
+ // .toDate(),
46
+ // availableAtOrFrom: { id: '51qbjcfr72h62m06vtv5kkhgje' }
47
+ // }
48
+ ]
49
+ }
50
+ },
51
+ additionalProperty: [
52
+ { name: 'sampleCreateId', value: 'xxx' }
53
+ ]
54
+ // project: { id: project.id, typeOf: factory.organizationType.Project },
55
+ // location: {
56
+ // branchCode: '10'
57
+ // },
58
+ // superEvent: { id: '7k9ayl8hc' }
59
+ }
60
+ ],
61
+ {
62
+ superEventId: '7k9ayl8hc',
63
+ locationBranchCode: '10',
64
+ hasTicketedSeat: true
65
+ }
66
+ );
67
+ console.log('created.');
68
+ }
69
+
70
+ main()
71
+ .then(() => {
72
+ console.log('success!');
73
+ })
74
+ .catch(console.error);