@chevre/domain 26.0.0-alpha.35 → 26.0.0-alpha.36
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/lib/chevre/repo/action/inform.js +6 -2
- package/lib/chevre/repo/action/update.d.ts +2 -1
- package/lib/chevre/repo/action/update.js +5 -1
- package/lib/chevre/repo/action/use.js +6 -2
- package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/inform.js +9 -4
- package/lib/chevre/repo/mongoose/schemas/action/update.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/update.js +13 -8
- package/lib/chevre/repo/mongoose/schemas/action/use.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action/use.js +11 -6
- package/package.json +2 -2
|
@@ -18,8 +18,10 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
18
18
|
'about',
|
|
19
19
|
'purpose',
|
|
20
20
|
'recipient',
|
|
21
|
-
'target'
|
|
21
|
+
'target',
|
|
22
|
+
'expires'
|
|
22
23
|
];
|
|
24
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
23
25
|
/**
|
|
24
26
|
* 通知アクションリポジトリ
|
|
25
27
|
*/
|
|
@@ -65,10 +67,12 @@ class InformActionRepo {
|
|
|
65
67
|
*/
|
|
66
68
|
async startInformAction(attributes) {
|
|
67
69
|
const startDate = new Date();
|
|
70
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
68
71
|
const creatingAction = {
|
|
69
72
|
...attributes,
|
|
70
73
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
71
|
-
startDate
|
|
74
|
+
startDate,
|
|
75
|
+
expires
|
|
72
76
|
};
|
|
73
77
|
const result = await this.informActionModel.insertMany(creatingAction, { rawResult: true });
|
|
74
78
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -3,6 +3,7 @@ import { factory } from '../../factory';
|
|
|
3
3
|
import { IDocType } from '../mongoose/schemas/action/update';
|
|
4
4
|
type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction;
|
|
5
5
|
type IAction<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : never;
|
|
6
|
+
type IActionAttributes<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAttributes : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAttributes : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAttributes : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAttributes : never;
|
|
6
7
|
type IKeyOfProjection = keyof IDocType;
|
|
7
8
|
type IFindParams = factory.action.update.update.IFindParams;
|
|
8
9
|
/**
|
|
@@ -15,7 +16,7 @@ export declare class UpdateActionRepo {
|
|
|
15
16
|
/**
|
|
16
17
|
* アクション開始
|
|
17
18
|
*/
|
|
18
|
-
startUpdateAction<T extends StartableActionType>(attributes:
|
|
19
|
+
startUpdateAction<T extends StartableActionType>(attributes: IActionAttributes<T>): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>>;
|
|
19
20
|
completeUpdateAction(params: {
|
|
20
21
|
typeOf: StartableActionType;
|
|
21
22
|
id: string;
|
|
@@ -18,7 +18,9 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
18
18
|
'instrument',
|
|
19
19
|
'targetCollection',
|
|
20
20
|
'sameAs',
|
|
21
|
+
'expires'
|
|
21
22
|
];
|
|
23
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
22
24
|
/**
|
|
23
25
|
* リソース編集アクションリポジトリ
|
|
24
26
|
*/
|
|
@@ -63,10 +65,12 @@ class UpdateActionRepo {
|
|
|
63
65
|
*/
|
|
64
66
|
async startUpdateAction(attributes) {
|
|
65
67
|
const startDate = new Date();
|
|
68
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
66
69
|
const creatingAction = {
|
|
67
70
|
...attributes,
|
|
68
71
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
69
|
-
startDate
|
|
72
|
+
startDate,
|
|
73
|
+
expires
|
|
70
74
|
};
|
|
71
75
|
const result = await this.updateActionModel.insertMany(creatingAction, { rawResult: true });
|
|
72
76
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -15,8 +15,10 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
15
15
|
'startDate',
|
|
16
16
|
'endDate',
|
|
17
17
|
'instrument',
|
|
18
|
-
'location'
|
|
18
|
+
'location',
|
|
19
|
+
'expires'
|
|
19
20
|
];
|
|
21
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
20
22
|
/**
|
|
21
23
|
* 予約使用アクションリポジトリ
|
|
22
24
|
*/
|
|
@@ -58,10 +60,12 @@ class UseActionRepo {
|
|
|
58
60
|
*/
|
|
59
61
|
async startUseAction(attributes) {
|
|
60
62
|
const startDate = new Date();
|
|
63
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
61
64
|
const creatingAction = {
|
|
62
65
|
...attributes,
|
|
63
66
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
64
|
-
startDate
|
|
67
|
+
startDate,
|
|
68
|
+
expires
|
|
65
69
|
};
|
|
66
70
|
const result = await this.useActionModel.insertMany(creatingAction, { rawResult: true });
|
|
67
71
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../../virtuals';
|
|
3
3
|
import { factory } from '../../../../factory';
|
|
4
|
-
type IDocType = Pick<factory.action.interact.inform.IAction, 'about' | 'actionStatus' | 'agent' | 'endDate' | 'object' | 'project' | 'recipient' | 'result' | 'startDate' | 'target' | 'typeOf' | 'purpose' | 'error'>;
|
|
4
|
+
type IDocType = Pick<factory.action.interact.inform.IAction, 'about' | 'actionStatus' | 'agent' | 'endDate' | 'object' | 'project' | 'recipient' | 'result' | 'startDate' | 'target' | 'typeOf' | 'purpose' | 'error' | 'expires'>;
|
|
5
5
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
7
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -14,6 +14,7 @@ const schemaDefinition = {
|
|
|
14
14
|
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
15
|
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
|
+
expires: { type: Date, required: true },
|
|
17
18
|
target: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
18
19
|
recipient: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
19
20
|
result: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -48,14 +49,18 @@ const schemaOptions = {
|
|
|
48
49
|
};
|
|
49
50
|
const indexes = [
|
|
50
51
|
[
|
|
51
|
-
{
|
|
52
|
+
{ expires: 1 },
|
|
52
53
|
{
|
|
53
|
-
name: '
|
|
54
|
-
expireAfterSeconds:
|
|
54
|
+
name: 'expires',
|
|
55
|
+
expireAfterSeconds: 0
|
|
55
56
|
}
|
|
56
57
|
],
|
|
57
58
|
[
|
|
58
|
-
{
|
|
59
|
+
{ startDate: -1 },
|
|
60
|
+
{ name: 'startDate' }
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
{ 'project.id': 1, startDate: -1 },
|
|
59
64
|
{ name: 'projectId' }
|
|
60
65
|
],
|
|
61
66
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../../virtuals';
|
|
3
3
|
import { factory } from '../../../../factory';
|
|
4
|
-
type Keys = 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'object' | 'project' | 'result' | 'sameAs' | 'startDate' | 'targetCollection' | 'typeOf';
|
|
4
|
+
type Keys = 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'object' | 'project' | 'result' | 'sameAs' | 'startDate' | 'targetCollection' | 'typeOf' | 'expires';
|
|
5
5
|
type IDocType = Pick<factory.action.update.add.IAction, Keys> | Pick<factory.action.update.replace.IAction, Keys> | Pick<factory.action.update.update.IAction, Keys> | Pick<factory.action.update.deleteAction.IAction, Keys>;
|
|
6
6
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
7
7
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -14,6 +14,7 @@ const schemaDefinition = {
|
|
|
14
14
|
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
15
|
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
|
+
expires: { type: Date, required: true },
|
|
17
18
|
result: mongoose_1.SchemaTypes.Mixed,
|
|
18
19
|
error: mongoose_1.SchemaTypes.Mixed,
|
|
19
20
|
endDate: Date,
|
|
@@ -47,22 +48,26 @@ const schemaOptions = {
|
|
|
47
48
|
};
|
|
48
49
|
const indexes = [
|
|
49
50
|
[
|
|
50
|
-
{
|
|
51
|
+
{ expires: 1 },
|
|
51
52
|
{
|
|
52
|
-
name: '
|
|
53
|
-
expireAfterSeconds:
|
|
53
|
+
name: 'expires',
|
|
54
|
+
expireAfterSeconds: 0
|
|
54
55
|
}
|
|
55
56
|
],
|
|
56
57
|
[
|
|
57
|
-
{
|
|
58
|
+
{ startDate: -1 },
|
|
59
|
+
{ name: 'startDate' }
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
{ 'project.id': 1, startDate: -1 },
|
|
58
63
|
{ name: 'projectId' }
|
|
59
64
|
],
|
|
60
65
|
[
|
|
61
|
-
{ typeOf: 1, startDate: 1 },
|
|
66
|
+
{ typeOf: 1, startDate: -1 },
|
|
62
67
|
{ name: 'typeOf' }
|
|
63
68
|
],
|
|
64
69
|
[
|
|
65
|
-
{ 'object.id': 1, startDate: 1 },
|
|
70
|
+
{ 'object.id': 1, startDate: -1 },
|
|
66
71
|
{
|
|
67
72
|
name: 'objectId',
|
|
68
73
|
partialFilterExpression: {
|
|
@@ -71,7 +76,7 @@ const indexes = [
|
|
|
71
76
|
}
|
|
72
77
|
],
|
|
73
78
|
[
|
|
74
|
-
{ 'result.id': 1, startDate: 1 },
|
|
79
|
+
{ 'result.id': 1, startDate: -1 },
|
|
75
80
|
{
|
|
76
81
|
name: 'resultId',
|
|
77
82
|
partialFilterExpression: {
|
|
@@ -80,7 +85,7 @@ const indexes = [
|
|
|
80
85
|
}
|
|
81
86
|
],
|
|
82
87
|
[
|
|
83
|
-
{ 'sameAs.id': 1, startDate: 1 },
|
|
88
|
+
{ 'sameAs.id': 1, startDate: -1 },
|
|
84
89
|
{
|
|
85
90
|
name: 'sameAsId',
|
|
86
91
|
partialFilterExpression: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../../virtuals';
|
|
3
3
|
import { factory } from '../../../../factory';
|
|
4
|
-
type IDocType = Pick<factory.action.consume.use.reservation.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'location' | 'object' | 'project' | 'startDate' | 'typeOf'>;
|
|
4
|
+
type IDocType = Pick<factory.action.consume.use.reservation.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'location' | 'object' | 'project' | 'startDate' | 'typeOf' | 'expires'>;
|
|
5
5
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
7
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -14,6 +14,7 @@ const schemaDefinition = {
|
|
|
14
14
|
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
15
|
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
startDate: { type: Date, required: true },
|
|
17
|
+
expires: { type: Date, required: true },
|
|
17
18
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
18
19
|
location: mongoose_1.SchemaTypes.Mixed,
|
|
19
20
|
error: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -45,22 +46,26 @@ const schemaOptions = {
|
|
|
45
46
|
};
|
|
46
47
|
const indexes = [
|
|
47
48
|
[
|
|
48
|
-
{
|
|
49
|
+
{ expires: 1 },
|
|
49
50
|
{
|
|
50
|
-
name: '
|
|
51
|
-
expireAfterSeconds:
|
|
51
|
+
name: 'expires',
|
|
52
|
+
expireAfterSeconds: 0
|
|
52
53
|
}
|
|
53
54
|
],
|
|
54
55
|
[
|
|
55
|
-
{
|
|
56
|
+
{ startDate: -1 },
|
|
57
|
+
{ name: 'startDate' }
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
{ 'project.id': 1, startDate: -1 },
|
|
56
61
|
{ name: 'projectId' }
|
|
57
62
|
],
|
|
58
63
|
[
|
|
59
|
-
{ actionStatus: 1, startDate: 1 },
|
|
64
|
+
{ actionStatus: 1, startDate: -1 },
|
|
60
65
|
{ name: 'actionStatus' }
|
|
61
66
|
],
|
|
62
67
|
[
|
|
63
|
-
{ 'object.id': 1, startDate: 1 },
|
|
68
|
+
{ 'object.id': 1, startDate: -1 },
|
|
64
69
|
{
|
|
65
70
|
name: 'objectId',
|
|
66
71
|
partialFilterExpression: {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "10.3.0-alpha.
|
|
14
|
+
"@chevre/factory": "10.3.0-alpha.10",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "26.0.0-alpha.
|
|
91
|
+
"version": "26.0.0-alpha.36"
|
|
92
92
|
}
|