@chevre/domain 22.11.0-alpha.14 → 22.11.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.
@@ -13,7 +13,7 @@ interface IExecuteSettings {
13
13
  redisClient?: RedisClientType;
14
14
  }
15
15
  type IOperationExecute<T> = (settings: IExecuteSettings) => Promise<T>;
16
- type INextFunction = (task: Pick<factory.task.ITask<factory.taskName>, 'id' | 'remainingNumberOfTries' | 'name' | 'status' | 'data'>) => IOperationExecute<void>;
16
+ type INextFunction = (task: Pick<factory.task.ITask<factory.taskName>, 'id' | 'remainingNumberOfTries' | 'name' | 'status'>) => IOperationExecute<void>;
17
17
  interface IReadyTask {
18
18
  id: string;
19
19
  name?: factory.taskName;
@@ -42,7 +42,6 @@ interface IExecutedTask {
42
42
  */
43
43
  remainingNumberOfTries: number;
44
44
  name: factory.taskName;
45
- data: factory.task.IData<factory.taskName>;
46
45
  expires?: never;
47
46
  }
48
47
  type IChangedTask = IReadyTask | IRunningTask | IExecutedTask;
@@ -167,7 +167,6 @@ export declare class TaskRepo {
167
167
  status: factory.taskStatus.Executed | factory.taskStatus.Running;
168
168
  remainingNumberOfTries: number;
169
169
  name: factory.taskName;
170
- data: factory.task.IData<factory.taskName>;
171
170
  }, executionResult: factory.task.IExecutionResult, next?: INextFunction): Promise<void>;
172
171
  count(params: factory.task.ISearchConditions): Promise<{
173
172
  count: number;
@@ -212,7 +211,6 @@ export declare class TaskRepo {
212
211
  remainingNumberOfTries: number;
213
212
  name: factory.taskName;
214
213
  status: factory.taskStatus;
215
- data: import("@chevre/factory/lib/task").IData;
216
214
  alternateName?: string | undefined;
217
215
  identifier?: string | undefined;
218
216
  description?: string | undefined;
@@ -222,13 +220,13 @@ export declare class TaskRepo {
222
220
  numberOfTried: number;
223
221
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
224
222
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
223
+ data: import("@chevre/factory/lib/task").IData;
225
224
  dateAborted?: Date | undefined;
226
225
  expires?: Date | undefined;
227
226
  }> & {
228
227
  remainingNumberOfTries: number;
229
228
  name: factory.taskName;
230
229
  status: factory.taskStatus;
231
- data: import("@chevre/factory/lib/task").IData;
232
230
  alternateName?: string | undefined;
233
231
  identifier?: string | undefined;
234
232
  description?: string | undefined;
@@ -238,6 +236,7 @@ export declare class TaskRepo {
238
236
  numberOfTried: number;
239
237
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
240
238
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
239
+ data: import("@chevre/factory/lib/task").IData;
241
240
  dateAborted?: Date | undefined;
242
241
  expires?: Date | undefined;
243
242
  } & {
@@ -246,7 +245,6 @@ export declare class TaskRepo {
246
245
  remainingNumberOfTries: number;
247
246
  name: factory.taskName;
248
247
  status: factory.taskStatus;
249
- data: import("@chevre/factory/lib/task").IData;
250
248
  alternateName?: string | undefined;
251
249
  identifier?: string | undefined;
252
250
  description?: string | undefined;
@@ -256,13 +254,13 @@ export declare class TaskRepo {
256
254
  numberOfTried: number;
257
255
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
258
256
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
257
+ data: import("@chevre/factory/lib/task").IData;
259
258
  dateAborted?: Date | undefined;
260
259
  expires?: Date | undefined;
261
260
  }> & {
262
261
  remainingNumberOfTries: number;
263
262
  name: factory.taskName;
264
263
  status: factory.taskStatus;
265
- data: import("@chevre/factory/lib/task").IData;
266
264
  alternateName?: string | undefined;
267
265
  identifier?: string | undefined;
268
266
  description?: string | undefined;
@@ -272,6 +270,7 @@ export declare class TaskRepo {
272
270
  numberOfTried: number;
273
271
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
274
272
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
273
+ data: import("@chevre/factory/lib/task").IData;
275
274
  dateAborted?: Date | undefined;
276
275
  expires?: Date | undefined;
277
276
  } & {
@@ -743,7 +743,7 @@ class TaskRepo {
743
743
  // support customr function(2025-05-25~)
744
744
  next) {
745
745
  return __awaiter(this, void 0, void 0, function* () {
746
- const { id, status, remainingNumberOfTries, name, data } = params;
746
+ const { id, status, remainingNumberOfTries, name } = params;
747
747
  yield this.taskModel.updateOne({ _id: { $eq: id } }, {
748
748
  $set: { status },
749
749
  $push: { executionResults: executionResult }
@@ -751,7 +751,7 @@ class TaskRepo {
751
751
  .exec();
752
752
  // emit event(2025-05-26~)
753
753
  if (typeof next === 'function') {
754
- const changedTask = { id, name, status, data, remainingNumberOfTries, executionResult };
754
+ const changedTask = { id, name, status, remainingNumberOfTries, executionResult };
755
755
  task_1.taskEventEmitter.emitTaskStatusChanged(changedTask, next);
756
756
  }
757
757
  });
@@ -74,8 +74,7 @@ function executeTask(task, next) {
74
74
  id: task.id,
75
75
  status: factory.taskStatus.Executed,
76
76
  remainingNumberOfTries: task.remainingNumberOfTries,
77
- name: task.name,
78
- data: task.data
77
+ name: task.name
79
78
  }, result, (typeof next === 'function') ? next : undefined);
80
79
  }
81
80
  catch (error) {
@@ -94,8 +93,7 @@ function executeTask(task, next) {
94
93
  id: task.id,
95
94
  status: task.status,
96
95
  remainingNumberOfTries: task.remainingNumberOfTries,
97
- name: task.name,
98
- data: task.data
96
+ name: task.name
99
97
  }, result, (typeof next === 'function') ? next : undefined);
100
98
  }
101
99
  });
package/package.json CHANGED
@@ -11,8 +11,8 @@
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": "4.395.0",
15
- "@cinerino/sdk": "11.0.0-alpha.8",
14
+ "@chevre/factory": "4.396.0-alpha.1",
15
+ "@cinerino/sdk": "11.1.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
18
18
  "@sendgrid/client": "8.1.4",
@@ -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": "22.11.0-alpha.14"
118
+ "version": "22.11.0-alpha.15"
119
119
  }
@@ -1,50 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- // const project = { id: String(process.env.PROJECT_ID) };
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
11
-
12
- const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
13
-
14
- setInterval(
15
- async () => {
16
- const startTime = process.hrtime();
17
- const task = await taskRepo.findExecutableOne({
18
- name: {
19
- $eq: chevre.factory.taskName.VoidReserveTransaction
20
- // $nin: [
21
- // chevre.factory.taskName.DeleteTransaction,
22
- // chevre.factory.taskName.ImportEventCapacitiesFromCOA,
23
- // chevre.factory.taskName.ImportEventsFromCOA,
24
- // chevre.factory.taskName.AcceptCOAOffer,
25
- // chevre.factory.taskName.CheckMovieTicket,
26
- // chevre.factory.taskName.AuthorizePayment,
27
- // chevre.factory.taskName.PublishPaymentUrl
28
- // ]
29
- },
30
- runsAt: {
31
- $lt: moment()
32
- // tslint:disable-next-line:no-magic-numbers
33
- .add(-60, 'seconds')
34
- .toDate()
35
- }
36
- });
37
- const diff = process.hrtime(startTime);
38
- console.log(`took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
39
-
40
- // tslint:disable-next-line:no-null-keyword
41
- console.dir(task?.id, { depth: null });
42
- },
43
- // tslint:disable-next-line:no-magic-numbers
44
- 1000
45
- );
46
- }
47
-
48
- main()
49
- .then()
50
- .catch(console.error);