@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
@@ -0,0 +1,102 @@
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
+ import { auth } from '../../auth/clientCredentials';
7
+
8
+ const PROJECT_ID = String(process.env.PROJECT_ID);
9
+ const SELLER_ID = '5a392dfdfca1c8737fb6da42';
10
+ const EVENT_SERVICE_ID = '630b139e4dd0621c0496a30c';
11
+ const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
12
+ const ADDITIONAL_PROPERTY_NAME = 'oldEventId';
13
+ const SUPER_EVENT_ID = '7kaf1djmz';
14
+ const LOCATION_BRANCH_CODE = '01';
15
+
16
+ // tslint:disable-next-line:max-func-body-length
17
+ async function main() {
18
+ // const authClient = await auth.login();
19
+ // await authClient.refreshAccessToken();
20
+ // const loginTicket = authClient.verifyIdToken({});
21
+ // console.log('username is', loginTicket.getUsername());
22
+
23
+ const eventService = await (await client.loadCloudAdmin({
24
+ endpoint: <string>process.env.API_ADMIN_ENDPOINT,
25
+ auth: await auth()
26
+ })).createEventInstance({
27
+ project: { id: PROJECT_ID },
28
+ seller: { id: SELLER_ID }
29
+ });
30
+
31
+ const today = moment()
32
+ .tz('Asia/Tokyo')
33
+ .format('YYYY-MM-DD');
34
+ const identifier = '250909001001010900';
35
+ await eventService.createIfNotExistByIdentifier(
36
+ [
37
+ {
38
+ identifier,
39
+ doorTime: moment(`${today}T13:00:00Z`)
40
+ .toDate(),
41
+ startDate: moment(`${today}T13:00:00Z`)
42
+ .toDate(),
43
+ endDate: moment(`${today}T14:00:00Z`)
44
+ .toDate(),
45
+ eventStatus: client.factory.eventStatusType.EventScheduled,
46
+ additionalProperty: [
47
+ { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
48
+ ],
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: LOCATION_BRANCH_CODE,
90
+ superEventId: SUPER_EVENT_ID,
91
+ hasTicketedSeat: true,
92
+ typeOf: client.factory.eventType.ScreeningEvent
93
+ }
94
+ );
95
+ console.log('created.');
96
+ }
97
+
98
+ main()
99
+ .then(() => {
100
+ console.log('success!');
101
+ })
102
+ .catch(console.error);
@@ -1,12 +1,12 @@
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
 
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
 
@@ -24,34 +24,33 @@ 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
32
  attributes: [
30
33
  {
31
- typeOf: client.factory.eventType.ScreeningEvent,
32
- project: {
33
- typeOf: client.factory.organizationType.Project,
34
- id: PROJECT_ID
35
- },
36
- doorTime: moment('2025-08-27T07:00:00.000Z')
34
+ doorTime: moment(`${today}T13:00:00Z`)
37
35
  .toDate(),
38
- startDate: moment('2025-08-27T07:00:00.000Z')
36
+ startDate: moment(`${today}T13:00:00Z`)
39
37
  .toDate(),
40
- endDate: moment('2025-08-27T07:10:00.000Z')
38
+ endDate: moment(`${today}T14:00:00Z`)
41
39
  .toDate(),
42
40
  eventStatus: client.factory.eventStatusType.EventScheduled,
43
41
  additionalProperty: [
44
42
  // { name: ADDITIONAL_PROPERTY_NAME, value: `fromSamples:${Date.now()}` }
45
43
  {
46
44
  name: ADDITIONAL_PROPERTY_NAME, value: `fromSamples:${moment()
47
- .format('YYYYMMDD')}`
45
+ .format('YYYY-MM-DD HH:mm')}`
48
46
  }
49
47
  ],
48
+ // maximumPhysicalAttendeeCapacity: 3,
50
49
  location: {
51
- branchCode: '90'
50
+ branchCode: '10'
52
51
  },
53
52
  superEvent: {
54
- id: 'bkeuv7fdu'
53
+ id: '7k9ayl8hc'
55
54
  },
56
55
  offers: {
57
56
  unacceptedPaymentMethod: [],
@@ -59,20 +58,24 @@ async function main() {
59
58
  maxValue: 6
60
59
  },
61
60
  itemOffered: {
62
- id: EVENT_SERVICE_ID
61
+ id: EVENT_SERVICE_ID,
62
+ serviceOutput: {
63
+ typeOf: client.factory.reservationType.EventReservation,
64
+ reservedTicket: { typeOf: 'Ticket', ticketedSeat: { typeOf: client.factory.placeType.Seat } }
65
+ }
63
66
  },
64
67
  seller: {
65
68
  makesOffer: [
66
69
  {
67
70
  typeOf: client.factory.offerType.Offer,
68
71
  availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
69
- availabilityStarts: moment('2025-08-27T00:00:00.000Z')
72
+ availabilityStarts: moment(`${today}T13:00:00Z`)
70
73
  .toDate(),
71
- availabilityEnds: moment('2025-08-27T00:00:00.000Z')
74
+ availabilityEnds: moment(`${today}T14:00:00Z`)
72
75
  .toDate(),
73
- validFrom: moment('2025-08-27T00:00:00.000Z')
76
+ validFrom: moment(`${today}T13:00:00Z`)
74
77
  .toDate(),
75
- validThrough: moment('2025-08-27T15:00:00.000Z')
78
+ validThrough: moment(`${today}T14:00:00Z`)
76
79
  .toDate()
77
80
  }
78
81
  ]
@@ -14,9 +14,9 @@ async function main() {
14
14
  seller: { id: '' }
15
15
  });
16
16
  const orders = await orderService.findByConfirmationNumber({
17
- confirmationNumber: '96678',
17
+ confirmationNumber: '74441',
18
18
  customer: {
19
- telephone: '+819012345678'
19
+ telephone: '+819011111111'
20
20
  }
21
21
  });
22
22
  // tslint:disable-next-line:no-null-keyword
@@ -19,7 +19,8 @@ async function main() {
19
19
  page: 1,
20
20
  typeOf: factory.product.ProductType.EventService
21
21
  });
22
- console.log(result);
22
+ // tslint:disable-next-line:no-null-keyword
23
+ console.dir(result, { depth: null });
23
24
  console.log(result.length, 'data found');
24
25
  }
25
26
 
@@ -237,7 +237,7 @@ type IAuthorizeReservationAction = Pick<client.factory.action.authorize.offer.ev
237
237
 
238
238
  // tslint:disable-next-line:max-func-body-length
239
239
  async function authorizeSeatReservationByEvent(params: {
240
- event: Omit<client.factory.event.screeningEvent.IEvent, 'offers'>;
240
+ event: { id: string };
241
241
  transaction: Pick<client.factory.transaction.placeOrder.ITransaction, 'id'>;
242
242
  }): Promise<{
243
243
  price: number;
@@ -320,12 +320,20 @@ async function authorizeSeatReservationByEvent(params: {
320
320
  console.log(selectedSeatOffers.length, 'seats selected');
321
321
 
322
322
  await wait(3000);
323
+ if (typeof MEMBER_PROGRAM_TIER_TOKEN !== 'string') {
324
+ throw new Error('process.env.MEMBER_PROGRAM_TIER_TOKEN required');
325
+ }
323
326
  console.log('authorizing seat reservation...');
324
327
  const seatReservationAuth = <IAuthorizeReservationAction>await offerService.authorizeEventService({
325
328
  object: {
326
329
  reservationFor: {
327
330
  id: screeningEvent.id,
328
- offers: { validForMemberTier: MEMBER_PROGRAM_TIER_TOKEN }
331
+ offers: {
332
+ validForMemberTier: {
333
+ token: MEMBER_PROGRAM_TIER_TOKEN,
334
+ isTierOf: { identifier: 'DefaultMemberProgram' }
335
+ }
336
+ }
329
337
  },
330
338
  acceptedOffer: selectedSeatOffers.map((o) => {
331
339
  return {
@@ -6,6 +6,7 @@ import { auth } from './auth/clientCredentials';
6
6
  const PROJECT_ID = String(process.env.PROJECT_ID);
7
7
 
8
8
  async function main() {
9
+ const now = new Date();
9
10
  const eventService = new (await client.loadService()).Event({
10
11
  endpoint: <string>process.env.API_ENDPOINT,
11
12
  auth: await auth(),
@@ -17,17 +18,18 @@ async function main() {
17
18
  page: 1,
18
19
  limit: 1,
19
20
  typeOf: client.factory.eventType.ScreeningEvent,
20
- startFrom: new Date(),
21
- startThrough: moment()
21
+ startFrom: now,
22
+ startThrough: moment(now)
22
23
  .add(1, 'days')
23
24
  .toDate(),
24
25
  sort: {
25
26
  startDate: client.factory.sortType.Ascending
26
27
  },
27
- sellerMakesOfferAvailableAtIn: ['xx', 'xxx']
28
+ sellerMakesOfferAvailableAtIn: ['xx', 'xxx'],
29
+ identifiers: ['x', 'x']
28
30
  });
29
31
  // tslint:disable-next-line:no-null-keyword
30
- // console.dir(data.at(0), { depth: null });
32
+ console.dir(data.at(0), { depth: null });
31
33
  // tslint:disable-next-line:no-null-keyword
32
34
  // console.dir(data.at(0)?.offers?.seller.makesOffer, { depth: null });
33
35
  console.log(data.length, 'events');
@@ -3,10 +3,51 @@ 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
+ export declare type ICreateParamsByIdentifier = Pick<factory.event.ICreateParams<factory.eventType.ScreeningEvent>, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
7
+ identifier: string;
8
+ offers: Pick<factory.event.screeningEvent.IOffers4create, 'eligibleQuantity' | 'seller' | 'unacceptedPaymentMethod'> & {
9
+ itemOffered: Pick<factory.event.screeningEvent.IItemOffered, 'id'>;
10
+ };
11
+ };
12
+ export declare type IUpdateParamsByIdentifier = Pick<factory.event.IUpdateParams<factory.eventType.ScreeningEvent>, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
13
+ identifier: string;
14
+ offers: Pick<factory.event.screeningEvent.IOffers4create, 'eligibleQuantity' | 'seller' | 'unacceptedPaymentMethod'> & {
15
+ itemOffered: Pick<factory.event.screeningEvent.IItemOffered, 'id'>;
16
+ };
17
+ location?: never;
18
+ superEvent?: never;
19
+ };
6
20
  /**
7
21
  * イベントサービス
8
22
  */
9
23
  export declare class EventService extends Service {
24
+ /**
25
+ * イベント冪等複数作成
26
+ * イベントコードをキーにして、存在しなければ作成する
27
+ */
28
+ createIfNotExistByIdentifier(params: ICreateParamsByIdentifier[], options: {
29
+ /**
30
+ * 施設コンテンツID
31
+ */
32
+ superEventId: string;
33
+ /**
34
+ * ルームコード
35
+ */
36
+ locationBranchCode: string;
37
+ /**
38
+ * 座席有無
39
+ */
40
+ hasTicketedSeat: boolean;
41
+ typeOf: factory.eventType.ScreeningEvent;
42
+ }): Promise<void>;
43
+ /**
44
+ * 識別子によるイベント複数更新
45
+ * 識別子のイベントが存在しなければNotFound
46
+ * 座席有無は変更できない
47
+ */
48
+ updateEventsByIdentifier(params: IUpdateParamsByIdentifier[], options: {
49
+ typeOf: factory.eventType.ScreeningEvent;
50
+ }): Promise<void>;
10
51
  /**
11
52
  * イベント冪等複数作成
12
53
  * 特定の追加特性をキーにして、存在しなければ作成する
@@ -20,6 +61,8 @@ export declare class EventService extends Service {
20
61
  name: string;
21
62
  };
22
63
  update: boolean;
64
+ superEventId: string;
65
+ locationBranchCode: string;
23
66
  }): Promise<void>;
24
67
  /**
25
68
  * イベント部分更新
@@ -63,28 +63,81 @@ var EventService = /** @class */ (function (_super) {
63
63
  function EventService() {
64
64
  return _super !== null && _super.apply(this, arguments) || this;
65
65
  }
66
+ /**
67
+ * イベント冪等複数作成
68
+ * イベントコードをキーにして、存在しなければ作成する
69
+ */
70
+ EventService.prototype.createIfNotExistByIdentifier = function (params, options) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var superEventId, locationBranchCode, hasTicketedSeat, typeOf;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ superEventId = options.superEventId, locationBranchCode = options.locationBranchCode, hasTicketedSeat = options.hasTicketedSeat, typeOf = options.typeOf;
77
+ return [4 /*yield*/, this.fetch({
78
+ uri: '/events',
79
+ method: 'POST',
80
+ body: params,
81
+ qs: { superEventId: superEventId, locationBranchCode: locationBranchCode, hasTicketedSeat: hasTicketedSeat, typeOf: typeOf },
82
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
83
+ })];
84
+ case 1:
85
+ _a.sent();
86
+ return [2 /*return*/];
87
+ }
88
+ });
89
+ });
90
+ };
91
+ /**
92
+ * 識別子によるイベント複数更新
93
+ * 識別子のイベントが存在しなければNotFound
94
+ * 座席有無は変更できない
95
+ */
96
+ EventService.prototype.updateEventsByIdentifier = function (params, options) {
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var typeOf;
99
+ return __generator(this, function (_a) {
100
+ switch (_a.label) {
101
+ case 0:
102
+ typeOf = options.typeOf;
103
+ return [4 /*yield*/, this.fetch({
104
+ uri: '/events',
105
+ method: 'PUT',
106
+ body: params,
107
+ qs: {
108
+ typeOf: typeOf,
109
+ updateBy: 'identifier'
110
+ },
111
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
112
+ })];
113
+ case 1:
114
+ _a.sent();
115
+ return [2 /*return*/];
116
+ }
117
+ });
118
+ });
119
+ };
66
120
  /**
67
121
  * イベント冪等複数作成
68
122
  * 特定の追加特性をキーにして、存在しなければ作成する
69
123
  * 存在すれば、一部属性を更新する(eventStatus,superEvent,offers.seller.makesOffer)
70
124
  */
71
125
  EventService.prototype.upsertManyByAdditionalProperty = function (params, options) {
72
- var _a, _b, _c, _d;
73
126
  return __awaiter(this, void 0, void 0, function () {
74
127
  var superEventId, locationBranchCode;
75
- return __generator(this, function (_e) {
76
- switch (_e.label) {
128
+ return __generator(this, function (_a) {
129
+ switch (_a.label) {
77
130
  case 0:
78
131
  if (!Array.isArray(params) || params.length === 0) {
79
132
  throw new factory.errors.ArgumentNull('body');
80
133
  }
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;
134
+ superEventId = options.superEventId;
135
+ locationBranchCode = options.locationBranchCode;
83
136
  if (typeof superEventId !== 'string' || superEventId === '') {
84
- throw new factory.errors.ArgumentNull('superEvent.id');
137
+ throw new factory.errors.ArgumentNull('superEventId');
85
138
  }
86
139
  if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
87
- throw new factory.errors.ArgumentNull('location.branchCode');
140
+ throw new factory.errors.ArgumentNull('locationBranchCode');
88
141
  }
89
142
  return [4 /*yield*/, this.fetch({
90
143
  uri: '/events',
@@ -100,7 +153,7 @@ var EventService = /** @class */ (function (_super) {
100
153
  expectedStatusCodes: [http_status_1.NO_CONTENT]
101
154
  })];
102
155
  case 1:
103
- _e.sent();
156
+ _a.sent();
104
157
  return [2 /*return*/];
105
158
  }
106
159
  });
@@ -1,21 +1,61 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
3
  declare type INoteDigitalDocument = factory.creativeWork.noteDigitalDocument.INoteDigitalDocument;
4
- declare type IKeyOfProjection = keyof INoteDigitalDocument;
5
- declare type ICreateParams = Pick<INoteDigitalDocument, 'identifier' | 'text'> & {
6
- about: Pick<factory.creativeWork.noteDigitalDocument.IAbout, 'id' | 'typeOf'>;
7
- };
4
+ interface ICreateParams {
5
+ /**
6
+ * メモ識別子
7
+ */
8
+ identifier: string;
9
+ /**
10
+ * メモコンテンツ
11
+ */
12
+ text: string;
13
+ about: {
14
+ /**
15
+ * メモの主題リソースID
16
+ */
17
+ id: string;
18
+ };
19
+ }
20
+ interface IDeleteParams {
21
+ id: string;
22
+ }
23
+ export interface IFindParams {
24
+ limit: number;
25
+ page: number;
26
+ inclusion?: (keyof factory.creativeWork.noteDigitalDocument.INoteDigitalDocument)[];
27
+ /**
28
+ * 主題リソースタイプ
29
+ */
30
+ aboutTypeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
31
+ /**
32
+ * 主題リソースIDリスト
33
+ * max: 10
34
+ */
35
+ aboutIds?: string[];
36
+ /**
37
+ * メモ識別子リスト
38
+ * max: 10
39
+ */
40
+ identifiers?: string[];
41
+ /**
42
+ * メモID
43
+ */
44
+ id?: string;
45
+ }
8
46
  /**
9
47
  * メモサービス
10
48
  */
11
49
  export declare class NoteService extends Service {
12
- upsertByIdentifier(params: ICreateParams[]): Promise<void>;
13
- search(params: Omit<factory.creativeWork.noteDigitalDocument.ISearchConditions, 'project'> & {
14
- inclusion: IKeyOfProjection[];
15
- exclusion: IKeyOfProjection[];
16
- }): Promise<(INoteDigitalDocument & {
50
+ createNotesByIdentifier(params: ICreateParams[], options: {
51
+ aboutTypeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
52
+ }): Promise<void>;
53
+ updateNotesByIdentifier(params: ICreateParams[], options: {
54
+ aboutTypeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
55
+ }): Promise<void>;
56
+ findNotes(params: IFindParams): Promise<(INoteDigitalDocument & {
17
57
  id: string;
18
58
  })[]>;
19
- updateById(id: string, body: Pick<INoteDigitalDocument, 'text'>): Promise<void>;
59
+ deleteNotesByIds(params: IDeleteParams[]): Promise<void>;
20
60
  }
21
61
  export {};
@@ -54,6 +54,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.NoteService = void 0;
55
55
  var http_status_1 = require("http-status");
56
56
  var service_1 = require("../service");
57
+ var BASE_URI = '/creativeWorks/noteDigitalDocument';
57
58
  /**
58
59
  * メモサービス
59
60
  */
@@ -62,16 +63,41 @@ var NoteService = /** @class */ (function (_super) {
62
63
  function NoteService() {
63
64
  return _super !== null && _super.apply(this, arguments) || this;
64
65
  }
65
- NoteService.prototype.upsertByIdentifier = function (params) {
66
+ NoteService.prototype.createNotesByIdentifier = function (params, options) {
66
67
  return __awaiter(this, void 0, void 0, function () {
68
+ var aboutTypeOf;
67
69
  return __generator(this, function (_a) {
68
70
  switch (_a.label) {
69
- case 0: return [4 /*yield*/, this.fetch({
70
- uri: '/notes',
71
- method: 'PUT',
72
- body: params,
73
- expectedStatusCodes: [http_status_1.NO_CONTENT]
74
- })];
71
+ case 0:
72
+ aboutTypeOf = options.aboutTypeOf;
73
+ return [4 /*yield*/, this.fetch({
74
+ uri: BASE_URI,
75
+ method: 'POST',
76
+ body: params,
77
+ qs: { aboutTypeOf: aboutTypeOf },
78
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
79
+ })];
80
+ case 1:
81
+ _a.sent();
82
+ return [2 /*return*/];
83
+ }
84
+ });
85
+ });
86
+ };
87
+ NoteService.prototype.updateNotesByIdentifier = function (params, options) {
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ var aboutTypeOf;
90
+ return __generator(this, function (_a) {
91
+ switch (_a.label) {
92
+ case 0:
93
+ aboutTypeOf = options.aboutTypeOf;
94
+ return [4 /*yield*/, this.fetch({
95
+ uri: BASE_URI,
96
+ method: 'PUT',
97
+ body: params,
98
+ qs: { aboutTypeOf: aboutTypeOf },
99
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
100
+ })];
75
101
  case 1:
76
102
  _a.sent();
77
103
  return [2 /*return*/];
@@ -79,12 +105,12 @@ var NoteService = /** @class */ (function (_super) {
79
105
  });
80
106
  });
81
107
  };
82
- NoteService.prototype.search = function (params) {
108
+ NoteService.prototype.findNotes = function (params) {
83
109
  return __awaiter(this, void 0, void 0, function () {
84
110
  var _this = this;
85
111
  return __generator(this, function (_a) {
86
112
  return [2 /*return*/, this.fetch({
87
- uri: '/notes',
113
+ uri: BASE_URI,
88
114
  method: 'GET',
89
115
  qs: params,
90
116
  expectedStatusCodes: [http_status_1.OK]
@@ -95,19 +121,16 @@ var NoteService = /** @class */ (function (_super) {
95
121
  });
96
122
  });
97
123
  };
98
- NoteService.prototype.updateById = function (id, body) {
124
+ NoteService.prototype.deleteNotesByIds = function (params) {
99
125
  return __awaiter(this, void 0, void 0, function () {
100
- var text;
101
126
  return __generator(this, function (_a) {
102
127
  switch (_a.label) {
103
- case 0:
104
- text = body.text;
105
- return [4 /*yield*/, this.fetch({
106
- uri: "/notes/" + String(id),
107
- method: 'PUT',
108
- body: { text: text },
109
- expectedStatusCodes: [http_status_1.NO_CONTENT]
110
- })];
128
+ case 0: return [4 /*yield*/, this.fetch({
129
+ uri: BASE_URI,
130
+ method: 'DELETE',
131
+ body: params,
132
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
133
+ })];
111
134
  case 1:
112
135
  _a.sent();
113
136
  return [2 /*return*/];
@@ -0,0 +1,21 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ declare type INoteDigitalDocument = factory.creativeWork.noteDigitalDocument.INoteDigitalDocument;
4
+ declare type IKeyOfProjection = keyof INoteDigitalDocument;
5
+ declare type ICreateParams = Pick<INoteDigitalDocument, 'identifier' | 'text'> & {
6
+ about: Pick<factory.creativeWork.noteDigitalDocument.IAbout, 'id' | 'typeOf'>;
7
+ };
8
+ /**
9
+ * 注文メモサービス
10
+ */
11
+ export declare class NoteAboutOrderService extends Service {
12
+ upsertByIdentifier(params: ICreateParams[]): Promise<void>;
13
+ search(params: Omit<factory.creativeWork.noteDigitalDocument.ISearchConditions, 'project'> & {
14
+ inclusion: IKeyOfProjection[];
15
+ exclusion: IKeyOfProjection[];
16
+ }): Promise<(INoteDigitalDocument & {
17
+ id: string;
18
+ })[]>;
19
+ updateById(id: string, body: Pick<INoteDigitalDocument, 'text'>): Promise<void>;
20
+ }
21
+ export {};