@twin.org/background-task-models 0.0.2-next.8 → 0.0.3-next.1
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/dist/es/factories/backgroundTaskConnectorFactory.js +9 -0
- package/dist/es/factories/backgroundTaskConnectorFactory.js.map +1 -0
- package/dist/es/index.js +10 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IBackgroundTask.js +2 -0
- package/dist/es/models/IBackgroundTask.js.map +1 -0
- package/dist/es/models/IBackgroundTaskConnector.js +2 -0
- package/dist/es/models/IBackgroundTaskConnector.js.map +1 -0
- package/dist/es/models/IScheduledTaskInfo.js +2 -0
- package/dist/es/models/IScheduledTaskInfo.js.map +1 -0
- package/dist/es/models/IScheduledTaskTime.js +4 -0
- package/dist/es/models/IScheduledTaskTime.js.map +1 -0
- package/dist/es/models/ITaskSchedulerComponent.js +2 -0
- package/dist/es/models/ITaskSchedulerComponent.js.map +1 -0
- package/dist/{esm/index.mjs → es/models/taskStatus.js} +2 -13
- package/dist/es/models/taskStatus.js.map +1 -0
- package/dist/types/factories/backgroundTaskConnectorFactory.d.ts +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/types/models/IBackgroundTask.d.ts +1 -1
- package/dist/types/models/IBackgroundTaskConnector.d.ts +4 -4
- package/dist/types/models/IScheduledTaskInfo.d.ts +1 -1
- package/dist/types/models/ITaskSchedulerComponent.d.ts +2 -2
- package/docs/changelog.md +23 -0
- package/docs/reference/interfaces/IBackgroundTaskConnector.md +5 -5
- package/package.json +25 -8
- package/dist/cjs/index.cjs +0 -43
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Factory } from "@twin.org/core";
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating background task connectors.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
export const BackgroundTaskConnectorFactory = Factory.createFactory("background-task");
|
|
9
|
+
//# sourceMappingURL=backgroundTaskConnectorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backgroundTaskConnectorFactory.js","sourceRoot":"","sources":["../../../src/factories/backgroundTaskConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAC1C,OAAO,CAAC,aAAa,CAA2B,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IBackgroundTaskConnector } from \"../models/IBackgroundTaskConnector.js\";\n\n/**\n * Factory for creating background task connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const BackgroundTaskConnectorFactory =\n\tFactory.createFactory<IBackgroundTaskConnector>(\"background-task\");\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./factories/backgroundTaskConnectorFactory.js";
|
|
4
|
+
export * from "./models/IBackgroundTask.js";
|
|
5
|
+
export * from "./models/IBackgroundTaskConnector.js";
|
|
6
|
+
export * from "./models/IScheduledTaskInfo.js";
|
|
7
|
+
export * from "./models/IScheduledTaskTime.js";
|
|
8
|
+
export * from "./models/ITaskSchedulerComponent.js";
|
|
9
|
+
export * from "./models/taskStatus.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./factories/backgroundTaskConnectorFactory.js\";\nexport * from \"./models/IBackgroundTask.js\";\nexport * from \"./models/IBackgroundTaskConnector.js\";\nexport * from \"./models/IScheduledTaskInfo.js\";\nexport * from \"./models/IScheduledTaskTime.js\";\nexport * from \"./models/ITaskSchedulerComponent.js\";\nexport * from \"./models/taskStatus.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBackgroundTask.js","sourceRoot":"","sources":["../../../src/models/IBackgroundTask.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { TaskStatus } from \"./taskStatus.js\";\n\n/**\n * Interface describing a background task.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IBackgroundTask<T = any, U = any> {\n\t/**\n\t * The id.\n\t */\n\tid: string;\n\n\t/**\n\t * The type of the task.\n\t */\n\ttype: string;\n\n\t/**\n\t * The thread id for the task.\n\t */\n\tthreadId: string;\n\n\t/**\n\t * The retry interval in milliseconds, undefined if default scheduling.\n\t */\n\tretryInterval?: number;\n\n\t/**\n\t * The number of retries remaining, undefined if infinite retries.\n\t */\n\tretriesRemaining?: number;\n\n\t/**\n\t * The date the task was created.\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * The date the task was last modified.\n\t */\n\tdateModified: string;\n\n\t/**\n\t * The date the task was complete.\n\t */\n\tdateCompleted?: string;\n\n\t/**\n\t * The date the task was cancelled.\n\t */\n\tdateCancelled?: string;\n\n\t/**\n\t * The date until when to retain.\n\t */\n\tdateRetainUntil?: string;\n\n\t/**\n\t * The status of the task.\n\t */\n\tstatus: TaskStatus;\n\n\t/**\n\t * The payload to execute the task with.\n\t */\n\tpayload?: T;\n\n\t/**\n\t * The result of the execution.\n\t */\n\tresult?: U;\n\n\t/**\n\t * The error at last execution.\n\t */\n\terror?: IError;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBackgroundTaskConnector.js","sourceRoot":"","sources":["../../../src/models/IBackgroundTaskConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { SortDirection } from \"@twin.org/entity\";\nimport type { IBackgroundTask } from \"./IBackgroundTask.js\";\nimport type { TaskStatus } from \"./taskStatus.js\";\n\n/**\n * Interface describing a background task connector.\n */\nexport interface IBackgroundTaskConnector extends IComponent {\n\t/**\n\t * Register a handler for a task.\n\t * @param taskType The type of the task the handler can process.\n\t * @param module The module the handler is in.\n\t * @param method The method in the module to execute.\n\t * @param stateChangeCallback The callback to execute when the task state is updated.\n\t * @returns Nothing.\n\t */\n\tregisterHandler<T, U>(\n\t\ttaskType: string,\n\t\tmodule: string,\n\t\tmethod: string,\n\t\tstateChangeCallback?: (task: IBackgroundTask<T, U>) => Promise<void>\n\t): Promise<void>;\n\n\t/**\n\t * Unregister a handler for a task.\n\t * @param taskType The type of the task handler to remove.\n\t * @returns Nothing.\n\t */\n\tunregisterHandler(taskType: string): Promise<void>;\n\n\t/**\n\t * Create a new task.\n\t * @param type The type of the task.\n\t * @param payload The payload for the task.\n\t * @param options Additional options for the task.\n\t * @param options.retryCount The number of times to retry the task if it fails, leave undefined to retry forever.\n\t * @param options.retryInterval The interval in milliseconds to wait between retries, defaults to 5000, leave undefined for default scheduling.\n\t * @param options.retainFor The amount of time in milliseconds to retain the result until removal, defaults to 0 for immediate removal, set to -1 to keep forever.\n\t * @returns The id of the created task.\n\t */\n\tcreate<T>(\n\t\ttype: string,\n\t\tpayload?: T,\n\t\toptions?: {\n\t\t\tretryCount?: number;\n\t\t\tretryInterval?: number;\n\t\t\tretainFor?: number;\n\t\t}\n\t): Promise<string>;\n\n\t/**\n\t * Get the task details.\n\t * @param taskId The id of the task to get the details for.\n\t * @returns The details of the task.\n\t */\n\tget<T, U>(taskId: string): Promise<IBackgroundTask<T, U> | undefined>;\n\n\t/**\n\t * Retry a failed task immediately instead of waiting for it's next scheduled retry time.\n\t * @param taskId The id of the task to retry.\n\t * @returns Nothing.\n\t */\n\tretry(taskId: string): Promise<void>;\n\n\t/**\n\t * Remove a task ignoring any retain until date.\n\t * @param taskId The id of the task to remove.\n\t * @returns Nothing.\n\t */\n\tremove(taskId: string): Promise<void>;\n\n\t/**\n\t * Cancel a task, will only be actioned if the task is currently pending.\n\t * @param taskId The id of the task to cancel.\n\t * @returns Nothing.\n\t */\n\tcancel(taskId: string): Promise<void>;\n\n\t/**\n\t * Get a list of tasks.\n\t * @param taskType The type of the task to get.\n\t * @param taskStatus The status of the task to get.\n\t * @param sortProperty The property to sort by, defaults to dateCreated.\n\t * @param sortDirection The order to sort by, defaults to ascending.\n\t * @param cursor The cursor to get the next page of tasks.\n\t * @param limit Limit the number of entities to return.\n\t * @returns The list of tasks.\n\t */\n\tquery(\n\t\ttaskType?: string,\n\t\ttaskStatus?: TaskStatus,\n\t\tsortProperty?: \"dateCreated\" | \"dateModified\" | \"dateCompleted\" | \"status\",\n\t\tsortDirection?: SortDirection,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentities: IBackgroundTask[];\n\t\tcursor?: string;\n\t}>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IScheduledTaskInfo.js","sourceRoot":"","sources":["../../../src/models/IScheduledTaskInfo.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IScheduledTaskTime } from \"./IScheduledTaskTime.js\";\n\n/**\n * Interface describing a scheduled task information.\n */\nexport interface IScheduledTaskInfo {\n\t/**\n\t * The information for the tasks.\n\t */\n\ttasks: {\n\t\t[id: string]: IScheduledTaskTime[];\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IScheduledTaskTime.js","sourceRoot":"","sources":["../../../src/models/IScheduledTaskTime.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing a scheduled task time.\n */\nexport interface IScheduledTaskTime {\n\t/**\n\t * The date/time to start the task, if not provided defaults to first interval from now.\n\t */\n\tnextTriggerTime?: number;\n\n\t/**\n\t * The interval in days to repeat the task, if no intervals are set the task will not repeat.\n\t */\n\tintervalDays?: number;\n\n\t/**\n\t * The interval in hours to repeat the task, if no intervals are set the task will not repeat.\n\t */\n\tintervalHours?: number;\n\n\t/**\n\t * The interval in minutes to repeat the task, if no intervals are set the task will not repeat.\n\t */\n\tintervalMinutes?: number;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITaskSchedulerComponent.js","sourceRoot":"","sources":["../../../src/models/ITaskSchedulerComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IScheduledTaskInfo } from \"./IScheduledTaskInfo.js\";\nimport type { IScheduledTaskTime } from \"./IScheduledTaskTime.js\";\n\n/**\n * Interface describing a task scheduler.\n */\nexport interface ITaskSchedulerComponent extends IComponent {\n\t/**\n\t * Add a task to the scheduler.\n\t * @param taskId The id of the task to add.\n\t * @param times The times at which the task should be scheduled.\n\t * @param taskCallback The callback to execute when the task is scheduled.\n\t * @returns Nothing.\n\t */\n\taddTask(\n\t\ttaskId: string,\n\t\ttimes: IScheduledTaskTime[],\n\t\ttaskCallback: () => Promise<void>\n\t): Promise<void>;\n\n\t/**\n\t * Remove a task from the scheduler.\n\t * @param taskId The id of the task to remove.\n\t * @returns Nothing.\n\t */\n\tremoveTask(taskId: string): Promise<void>;\n\n\t/**\n\t * Get the information about the tasks.\n\t * @returns The tasks information.\n\t */\n\ttasksInfo(): Promise<IScheduledTaskInfo>;\n}\n"]}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import { Factory } from '@twin.org/core';
|
|
2
|
-
|
|
3
|
-
// Copyright 2024 IOTA Stiftung.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
5
|
-
/**
|
|
6
|
-
* Factory for creating background task connectors.
|
|
7
|
-
*/
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
-
const BackgroundTaskConnectorFactory = Factory.createFactory("background-task");
|
|
10
|
-
|
|
11
1
|
// Copyright 2024 IOTA Stiftung.
|
|
12
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
13
3
|
/**
|
|
14
4
|
* Task statuses.
|
|
15
5
|
*/
|
|
16
6
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
-
const TaskStatus = {
|
|
7
|
+
export const TaskStatus = {
|
|
18
8
|
/**
|
|
19
9
|
* Pending.
|
|
20
10
|
*/
|
|
@@ -36,5 +26,4 @@ const TaskStatus = {
|
|
|
36
26
|
*/
|
|
37
27
|
Cancelled: "cancelled"
|
|
38
28
|
};
|
|
39
|
-
|
|
40
|
-
export { BackgroundTaskConnectorFactory, TaskStatus };
|
|
29
|
+
//# sourceMappingURL=taskStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskStatus.js","sourceRoot":"","sources":["../../../src/models/taskStatus.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,UAAU,EAAE,YAAY;IAExB;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,SAAS,EAAE,WAAW;CACb,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Task statuses.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const TaskStatus = {\n\t/**\n\t * Pending.\n\t */\n\tPending: \"pending\",\n\n\t/**\n\t * Processing.\n\t */\n\tProcessing: \"processing\",\n\n\t/**\n\t * Success.\n\t */\n\tSuccess: \"success\",\n\n\t/**\n\t * Failed.\n\t */\n\tFailed: \"failed\",\n\n\t/**\n\t * Cancelled.\n\t */\n\tCancelled: \"cancelled\"\n} as const;\n\n/**\n * Task statuses.\n */\nexport type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Factory } from "@twin.org/core";
|
|
2
|
-
import type { IBackgroundTaskConnector } from "../models/IBackgroundTaskConnector";
|
|
2
|
+
import type { IBackgroundTaskConnector } from "../models/IBackgroundTaskConnector.js";
|
|
3
3
|
/**
|
|
4
4
|
* Factory for creating background task connectors.
|
|
5
5
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./factories/backgroundTaskConnectorFactory";
|
|
2
|
-
export * from "./models/IBackgroundTask";
|
|
3
|
-
export * from "./models/IBackgroundTaskConnector";
|
|
4
|
-
export * from "./models/IScheduledTaskInfo";
|
|
5
|
-
export * from "./models/IScheduledTaskTime";
|
|
6
|
-
export * from "./models/ITaskSchedulerComponent";
|
|
7
|
-
export * from "./models/taskStatus";
|
|
1
|
+
export * from "./factories/backgroundTaskConnectorFactory.js";
|
|
2
|
+
export * from "./models/IBackgroundTask.js";
|
|
3
|
+
export * from "./models/IBackgroundTaskConnector.js";
|
|
4
|
+
export * from "./models/IScheduledTaskInfo.js";
|
|
5
|
+
export * from "./models/IScheduledTaskTime.js";
|
|
6
|
+
export * from "./models/ITaskSchedulerComponent.js";
|
|
7
|
+
export * from "./models/taskStatus.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
2
|
import type { SortDirection } from "@twin.org/entity";
|
|
3
|
-
import type { IBackgroundTask } from "./IBackgroundTask";
|
|
4
|
-
import type { TaskStatus } from "./taskStatus";
|
|
3
|
+
import type { IBackgroundTask } from "./IBackgroundTask.js";
|
|
4
|
+
import type { TaskStatus } from "./taskStatus.js";
|
|
5
5
|
/**
|
|
6
6
|
* Interface describing a background task connector.
|
|
7
7
|
*/
|
|
@@ -67,10 +67,10 @@ export interface IBackgroundTaskConnector extends IComponent {
|
|
|
67
67
|
* @param sortProperty The property to sort by, defaults to dateCreated.
|
|
68
68
|
* @param sortDirection The order to sort by, defaults to ascending.
|
|
69
69
|
* @param cursor The cursor to get the next page of tasks.
|
|
70
|
-
* @param
|
|
70
|
+
* @param limit Limit the number of entities to return.
|
|
71
71
|
* @returns The list of tasks.
|
|
72
72
|
*/
|
|
73
|
-
query(taskType?: string, taskStatus?: TaskStatus, sortProperty?: "dateCreated" | "dateModified" | "dateCompleted" | "status", sortDirection?: SortDirection, cursor?: string,
|
|
73
|
+
query(taskType?: string, taskStatus?: TaskStatus, sortProperty?: "dateCreated" | "dateModified" | "dateCompleted" | "status", sortDirection?: SortDirection, cursor?: string, limit?: number): Promise<{
|
|
74
74
|
entities: IBackgroundTask[];
|
|
75
75
|
cursor?: string;
|
|
76
76
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
import type { IScheduledTaskInfo } from "./IScheduledTaskInfo";
|
|
3
|
-
import type { IScheduledTaskTime } from "./IScheduledTaskTime";
|
|
2
|
+
import type { IScheduledTaskInfo } from "./IScheduledTaskInfo.js";
|
|
3
|
+
import type { IScheduledTaskTime } from "./IScheduledTaskTime.js";
|
|
4
4
|
/**
|
|
5
5
|
* Interface describing a task scheduler.
|
|
6
6
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @twin.org/background-task-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.3-next.0...background-task-models-v0.0.3-next.1) (2025-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add context id features ([#29](https://github.com/twinfoundation/background-task/issues/29)) ([46ede49](https://github.com/twinfoundation/background-task/commit/46ede49a51a4955fe1530e645a66f0073db9a1fd))
|
|
9
|
+
* add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
10
|
+
* add validate-locales ([968cbf9](https://github.com/twinfoundation/background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
|
|
11
|
+
* eslint migration to flat config ([6c9136c](https://github.com/twinfoundation/background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
|
|
12
|
+
* improve comment ([f2b4ac2](https://github.com/twinfoundation/background-task/commit/f2b4ac22fb8f735d2bf4ce28583cf7c54acdf272))
|
|
13
|
+
* only run tasks from your own thread ([c7d305b](https://github.com/twinfoundation/background-task/commit/c7d305b9807e65b8b1af6d0c2ca59e74190cab69))
|
|
14
|
+
* update dependencies ([8e65767](https://github.com/twinfoundation/background-task/commit/8e657679f5e4305dbcb15ac7bcb3ab8a4613a60b))
|
|
15
|
+
* update framework core ([a068098](https://github.com/twinfoundation/background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
|
|
16
|
+
* update IComponent signatures ([e1a79bc](https://github.com/twinfoundation/background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
|
|
17
|
+
* use shared store mechanism ([#6](https://github.com/twinfoundation/background-task/issues/6)) ([27ed203](https://github.com/twinfoundation/background-task/commit/27ed20367d5ace7257bfa7a82b59ad70e5b5d209))
|
|
18
|
+
|
|
19
|
+
## [0.0.2-next.9](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.2-next.8...background-task-models-v0.0.2-next.9) (2025-10-09)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add validate-locales ([968cbf9](https://github.com/twinfoundation/background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
|
|
25
|
+
|
|
3
26
|
## [0.0.2-next.8](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.2-next.7...background-task-models-v0.0.2-next.8) (2025-09-29)
|
|
4
27
|
|
|
5
28
|
|
|
@@ -138,7 +138,7 @@ The id of the created task.
|
|
|
138
138
|
|
|
139
139
|
### get()
|
|
140
140
|
|
|
141
|
-
> **get**\<`T`, `U`\>(`taskId`): `Promise
|
|
141
|
+
> **get**\<`T`, `U`\>(`taskId`): `Promise`\<[`IBackgroundTask`](IBackgroundTask.md)\<`T`, `U`\> \| `undefined`\>
|
|
142
142
|
|
|
143
143
|
Get the task details.
|
|
144
144
|
|
|
@@ -162,7 +162,7 @@ The id of the task to get the details for.
|
|
|
162
162
|
|
|
163
163
|
#### Returns
|
|
164
164
|
|
|
165
|
-
`Promise
|
|
165
|
+
`Promise`\<[`IBackgroundTask`](IBackgroundTask.md)\<`T`, `U`\> \| `undefined`\>
|
|
166
166
|
|
|
167
167
|
The details of the task.
|
|
168
168
|
|
|
@@ -236,7 +236,7 @@ Nothing.
|
|
|
236
236
|
|
|
237
237
|
### query()
|
|
238
238
|
|
|
239
|
-
> **query**(`taskType?`, `taskStatus?`, `sortProperty?`, `sortDirection?`, `cursor?`, `
|
|
239
|
+
> **query**(`taskType?`, `taskStatus?`, `sortProperty?`, `sortDirection?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: [`IBackgroundTask`](IBackgroundTask.md)\<`any`, `any`\>[]; `cursor?`: `string`; \}\>
|
|
240
240
|
|
|
241
241
|
Get a list of tasks.
|
|
242
242
|
|
|
@@ -272,11 +272,11 @@ The order to sort by, defaults to ascending.
|
|
|
272
272
|
|
|
273
273
|
The cursor to get the next page of tasks.
|
|
274
274
|
|
|
275
|
-
#####
|
|
275
|
+
##### limit?
|
|
276
276
|
|
|
277
277
|
`number`
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
Limit the number of entities to return.
|
|
280
280
|
|
|
281
281
|
#### Returns
|
|
282
282
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/background-task-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.1",
|
|
4
4
|
"description": "Models which define the structure of the background task contracts and connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,22 +18,39 @@
|
|
|
18
18
|
"@twin.org/entity": "next",
|
|
19
19
|
"@twin.org/nameof": "next"
|
|
20
20
|
},
|
|
21
|
-
"main": "./dist/
|
|
22
|
-
"module": "./dist/esm/index.mjs",
|
|
21
|
+
"main": "./dist/es/index.js",
|
|
23
22
|
"types": "./dist/types/index.d.ts",
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
26
25
|
"types": "./dist/types/index.d.ts",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"import": "./dist/es/index.js",
|
|
27
|
+
"default": "./dist/es/index.js"
|
|
29
28
|
},
|
|
30
29
|
"./locales/*.json": "./locales/*.json"
|
|
31
30
|
},
|
|
32
31
|
"files": [
|
|
33
|
-
"dist/
|
|
34
|
-
"dist/esm",
|
|
32
|
+
"dist/es",
|
|
35
33
|
"dist/types",
|
|
36
34
|
"locales",
|
|
37
35
|
"docs"
|
|
38
|
-
]
|
|
36
|
+
],
|
|
37
|
+
"keywords": [
|
|
38
|
+
"twin",
|
|
39
|
+
"trade",
|
|
40
|
+
"iota",
|
|
41
|
+
"framework",
|
|
42
|
+
"blockchain",
|
|
43
|
+
"background-task",
|
|
44
|
+
"tasks",
|
|
45
|
+
"scheduling",
|
|
46
|
+
"jobs",
|
|
47
|
+
"async",
|
|
48
|
+
"models",
|
|
49
|
+
"types",
|
|
50
|
+
"schemas"
|
|
51
|
+
],
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "git+https://github.com/twinfoundation/background-task/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://twindev.org"
|
|
39
56
|
}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@twin.org/core');
|
|
4
|
-
|
|
5
|
-
// Copyright 2024 IOTA Stiftung.
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
7
|
-
/**
|
|
8
|
-
* Factory for creating background task connectors.
|
|
9
|
-
*/
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
-
const BackgroundTaskConnectorFactory = core.Factory.createFactory("background-task");
|
|
12
|
-
|
|
13
|
-
// Copyright 2024 IOTA Stiftung.
|
|
14
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
15
|
-
/**
|
|
16
|
-
* Task statuses.
|
|
17
|
-
*/
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
|
-
const TaskStatus = {
|
|
20
|
-
/**
|
|
21
|
-
* Pending.
|
|
22
|
-
*/
|
|
23
|
-
Pending: "pending",
|
|
24
|
-
/**
|
|
25
|
-
* Processing.
|
|
26
|
-
*/
|
|
27
|
-
Processing: "processing",
|
|
28
|
-
/**
|
|
29
|
-
* Success.
|
|
30
|
-
*/
|
|
31
|
-
Success: "success",
|
|
32
|
-
/**
|
|
33
|
-
* Failed.
|
|
34
|
-
*/
|
|
35
|
-
Failed: "failed",
|
|
36
|
-
/**
|
|
37
|
-
* Cancelled.
|
|
38
|
-
*/
|
|
39
|
-
Cancelled: "cancelled"
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
exports.BackgroundTaskConnectorFactory = BackgroundTaskConnectorFactory;
|
|
43
|
-
exports.TaskStatus = TaskStatus;
|