@chevre/domain 21.30.0-alpha.29 → 21.30.0-alpha.30

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.
@@ -23,6 +23,7 @@ export declare class AuthorizationRepo {
23
23
  object: IObject;
24
24
  validFrom: Date;
25
25
  expiresInSeconds: number;
26
+ audience?: factory.authorization.IAudience;
26
27
  }[]): Promise<factory.authorization.IAuthorization[]>;
27
28
  /**
28
29
  * コードで有効な承認を参照する
@@ -101,9 +101,9 @@ class AuthorizationRepo {
101
101
  */
102
102
  publish(params) {
103
103
  return __awaiter(this, void 0, void 0, function* () {
104
- const saveParams = params.map(({ project, object, validFrom, expiresInSeconds }) => {
104
+ const saveParams = params.map(({ project, object, validFrom, expiresInSeconds, audience }) => {
105
105
  const code = uuid.v4();
106
- return { project, code, object, validFrom, expiresInSeconds };
106
+ return { project, code, object, validFrom, expiresInSeconds, audience };
107
107
  });
108
108
  return this.save(saveParams);
109
109
  });
@@ -194,11 +194,14 @@ class AuthorizationRepo {
194
194
  save(params) {
195
195
  return __awaiter(this, void 0, void 0, function* () {
196
196
  if (params.length > 0) {
197
- const docs = params.map(({ project, code, object, validFrom, expiresInSeconds }) => {
197
+ const docs = params.map(({ project, code, object, validFrom, expiresInSeconds, audience }) => {
198
198
  const validUntil = moment(validFrom)
199
199
  .add(expiresInSeconds, 'seconds')
200
200
  .toDate();
201
- return { project, typeOf: 'Authorization', code, object, validFrom, validUntil };
201
+ return Object.assign({ project, typeOf: 'Authorization', code,
202
+ object,
203
+ validFrom,
204
+ validUntil }, (typeof (audience === null || audience === void 0 ? void 0 : audience.id) === 'string') ? { audience } : undefined);
202
205
  });
203
206
  const result = yield this.authorizationModel.insertMany(docs, { ordered: false, rawResult: true });
204
207
  if (result.insertedCount !== docs.length) {
@@ -27,7 +27,8 @@ const schemaDefinition = {
27
27
  validUntil: {
28
28
  type: Date,
29
29
  required: true
30
- }
30
+ },
31
+ audience: mongoose_1.SchemaTypes.Mixed // add(2024-05-02~)
31
32
  };
32
33
  const schemaOptions = {
33
34
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -63,6 +63,9 @@ function validateObjectWithoutDetail(params) {
63
63
  agent: params.project,
64
64
  token: String(programMembershipUsed)
65
65
  })({ action: repos.action, authorization: repos.authorization });
66
+ if (Array.isArray(permitOwnershipInfo)) {
67
+ throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
68
+ }
66
69
  if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
67
70
  throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
68
71
  }
@@ -446,6 +446,9 @@ function fixAccountIdIfPossible(params) {
446
446
  agent: { id: params.project.id, typeOf: factory.organizationType.Project },
447
447
  token: fromLocation
448
448
  })(repos);
449
+ if (Array.isArray(paymentCardOwnershipInfo)) {
450
+ throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
451
+ }
449
452
  if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
450
453
  throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
451
454
  }
@@ -25,6 +25,9 @@ function findByCode(params) {
25
25
  project: { id: params.project.id },
26
26
  code: params.code
27
27
  });
28
+ if (Array.isArray(authorization.object)) {
29
+ throw new factory.errors.NotImplemented('payload as an array not implemented');
30
+ }
28
31
  switch (authorization.object.typeOf) {
29
32
  case factory.order.OrderType.Order:
30
33
  const { orderNumber } = authorization.object;
@@ -37,6 +37,9 @@ function verifyToken4reservation(params) {
37
37
  else {
38
38
  throw new factory.errors.ArgumentNull('ticket.token or ticket.ticketToken');
39
39
  }
40
+ if (Array.isArray(payload)) {
41
+ throw new factory.errors.NotImplemented('payload as an array not implemented');
42
+ }
40
43
  switch (payload.typeOf) {
41
44
  case factory.order.OrderType.Order:
42
45
  const { orderNumber } = payload;
@@ -53,6 +53,9 @@ function onAuthorizationCreated(params) {
53
53
  code: params.code,
54
54
  project: { id: params.project.id }
55
55
  });
56
+ if (Array.isArray(authorization.object)) {
57
+ return;
58
+ }
56
59
  switch (authorization.object.typeOf) {
57
60
  case factory.order.OrderType.Order:
58
61
  // 注文検索
@@ -381,6 +381,9 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
381
381
  action: repos.action,
382
382
  authorization: repos.authorization
383
383
  });
384
+ if (Array.isArray(paymentCardOwnershipInfo)) {
385
+ throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
386
+ }
384
387
  if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
385
388
  throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
386
389
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.369.0-alpha.4",
13
+ "@chevre/factory": "4.369.0-alpha.5",
14
14
  "@cinerino/sdk": "5.18.0-alpha.16",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.30.0-alpha.29"
113
+ "version": "21.30.0-alpha.30"
114
114
  }