@chevre/domain 23.1.0-alpha.14 → 23.1.0-alpha.15
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.
|
@@ -16,9 +16,10 @@ export declare class AuthorizationRepo {
|
|
|
16
16
|
constructor(connection: Connection);
|
|
17
17
|
static CREATE_MONGO_CONDITIONS(params: factory.authorization.ISearchConditions): FilterQuery<factory.authorization.IAuthorization>[];
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 承認を発行する
|
|
20
|
+
* コードが自動生成されます
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
issueAuthorization(params: IPublishParams[]): Promise<factory.authorization.IAuthorization[]>;
|
|
22
23
|
/**
|
|
23
24
|
* コードで有効な承認を参照する
|
|
24
25
|
*/
|
|
@@ -111,9 +111,10 @@ class AuthorizationRepo {
|
|
|
111
111
|
return andConditions;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* 承認を発行する
|
|
115
|
+
* コードが自動生成されます
|
|
115
116
|
*/
|
|
116
|
-
|
|
117
|
+
issueAuthorization(params) {
|
|
117
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
119
|
const saveParams = params.map(({ project, object, validFrom, expiresInSeconds, audience, author, issuedBy }) => {
|
|
119
120
|
const code = uuid.v4();
|
|
@@ -144,7 +145,7 @@ class AuthorizationRepo {
|
|
|
144
145
|
throw new factory.errors.NotFound(this.authorizationModel.modelName);
|
|
145
146
|
}
|
|
146
147
|
const { id, object, typeOf, audience, issuedBy } = doc;
|
|
147
|
-
return Object.assign(
|
|
148
|
+
return Object.assign({ id, object, typeOf, issuedBy }, (typeof (audience === null || audience === void 0 ? void 0 : audience.id) === 'string') ? { audience } : undefined);
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
151
|
/**
|
|
@@ -217,14 +218,21 @@ class AuthorizationRepo {
|
|
|
217
218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
218
219
|
if (params.length > 0) {
|
|
219
220
|
const docs = params.map(({ project, code, object, validFrom, expiresInSeconds, audience, author, issuedBy }) => {
|
|
221
|
+
// issuedByは必須化(2025-11-21~)
|
|
222
|
+
if (typeof (issuedBy === null || issuedBy === void 0 ? void 0 : issuedBy.id) !== 'string') {
|
|
223
|
+
throw new factory.errors.ArgumentNull('issuedBy?.id');
|
|
224
|
+
}
|
|
220
225
|
const validUntil = moment(validFrom)
|
|
221
226
|
.add(expiresInSeconds, 'seconds')
|
|
222
227
|
.toDate();
|
|
223
|
-
return Object.assign(
|
|
228
|
+
return Object.assign({ project, typeOf: 'Authorization', author,
|
|
224
229
|
code,
|
|
230
|
+
issuedBy,
|
|
225
231
|
object,
|
|
226
232
|
validFrom,
|
|
227
|
-
validUntil }, (typeof (audience === null || audience === void 0 ? void 0 : audience.id) === 'string') ? { audience } : undefined
|
|
233
|
+
validUntil }, (typeof (audience === null || audience === void 0 ? void 0 : audience.id) === 'string') ? { audience } : undefined
|
|
234
|
+
// ...(typeof issuedBy?.id === 'string') ? { issuedBy } : undefined
|
|
235
|
+
);
|
|
228
236
|
});
|
|
229
237
|
const result = yield this.authorizationModel.insertMany(docs, { ordered: false, rawResult: true });
|
|
230
238
|
if (result.insertedCount !== docs.length) {
|
|
@@ -31,7 +31,7 @@ function createOfferTicket(params) {
|
|
|
31
31
|
const action = yield repos.action.start(actionAttributes);
|
|
32
32
|
let authorizations;
|
|
33
33
|
try {
|
|
34
|
-
authorizations = yield repos.authorization.
|
|
34
|
+
authorizations = yield repos.authorization.issueAuthorization([{
|
|
35
35
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
36
36
|
object,
|
|
37
37
|
validFrom,
|
|
@@ -21,7 +21,7 @@ function publishCode(params) {
|
|
|
21
21
|
const issuedBy = { id: params.object.seller.id, typeOf: factory.organizationType.Corporation };
|
|
22
22
|
let authorizations;
|
|
23
23
|
try {
|
|
24
|
-
authorizations = yield repos.authorization.
|
|
24
|
+
authorizations = yield repos.authorization.issueAuthorization([{
|
|
25
25
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
26
26
|
object: authorizationObject,
|
|
27
27
|
validFrom: params.validFrom,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.3.0-alpha.
|
|
14
|
+
"@chevre/factory": "5.3.0-alpha.1",
|
|
15
15
|
"@cinerino/sdk": "12.9.0-alpha.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "23.1.0-alpha.
|
|
118
|
+
"version": "23.1.0-alpha.15"
|
|
119
119
|
}
|