@twin.org/engine-core 0.0.1-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.
Files changed (35) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +1662 -0
  4. package/dist/esm/index.mjs +1657 -0
  5. package/dist/types/components/attestation.d.ts +21 -0
  6. package/dist/types/components/auditableItemGraph.d.ts +11 -0
  7. package/dist/types/components/auditableItemStream.d.ts +11 -0
  8. package/dist/types/components/backgroundTask.d.ts +11 -0
  9. package/dist/types/components/blobStorage.d.ts +21 -0
  10. package/dist/types/components/entityStorage.d.ts +20 -0
  11. package/dist/types/components/faucet.d.ts +11 -0
  12. package/dist/types/components/identity.d.ts +21 -0
  13. package/dist/types/components/identityProfile.d.ts +21 -0
  14. package/dist/types/components/immutableProof.d.ts +11 -0
  15. package/dist/types/components/immutableStorage.d.ts +11 -0
  16. package/dist/types/components/logging.d.ts +21 -0
  17. package/dist/types/components/nft.d.ts +21 -0
  18. package/dist/types/components/telemetry.d.ts +21 -0
  19. package/dist/types/components/vault.d.ts +11 -0
  20. package/dist/types/components/wallet.d.ts +21 -0
  21. package/dist/types/engineCore.d.ts +65 -0
  22. package/dist/types/index.d.ts +5 -0
  23. package/dist/types/models/IEngineCoreOptions.d.ts +22 -0
  24. package/dist/types/storage/fileStateStorage.d.ts +29 -0
  25. package/dist/types/storage/memoryStateStorage.d.ts +28 -0
  26. package/docs/changelog.md +5 -0
  27. package/docs/examples.md +1 -0
  28. package/docs/reference/classes/EngineCore.md +209 -0
  29. package/docs/reference/classes/FileStateStorage.md +89 -0
  30. package/docs/reference/classes/MemoryStateStorage.md +85 -0
  31. package/docs/reference/functions/initialiseEntityStorageConnector.md +31 -0
  32. package/docs/reference/index.md +15 -0
  33. package/docs/reference/interfaces/IEngineCoreOptions.md +45 -0
  34. package/locales/en.json +42 -0
  35. package/package.json +102 -0
@@ -0,0 +1,89 @@
1
+ # Class: FileStateStorage
2
+
3
+ Store state in a file.
4
+
5
+ ## Implements
6
+
7
+ - `IEngineStateStorage`
8
+
9
+ ## Constructors
10
+
11
+ ### new FileStateStorage()
12
+
13
+ > **new FileStateStorage**(`filename`, `readonlyMode`): [`FileStateStorage`](FileStateStorage.md)
14
+
15
+ Create a new instance of FileStateStorage.
16
+
17
+ #### Parameters
18
+
19
+ • **filename**: `string`
20
+
21
+ The filename to store the state.
22
+
23
+ • **readonlyMode**: `boolean` = `false`
24
+
25
+ Whether the file is in read-only mode.
26
+
27
+ #### Returns
28
+
29
+ [`FileStateStorage`](FileStateStorage.md)
30
+
31
+ ## Properties
32
+
33
+ ### CLASS\_NAME
34
+
35
+ > `readonly` **CLASS\_NAME**: `string`
36
+
37
+ Runtime name for the class.
38
+
39
+ ## Methods
40
+
41
+ ### load()
42
+
43
+ > **load**(`engineCore`): `Promise`\<`undefined` \| `IEngineState`\>
44
+
45
+ Method for loading the state.
46
+
47
+ #### Parameters
48
+
49
+ • **engineCore**: `IEngineCore`
50
+
51
+ The engine core to load the state for.
52
+
53
+ #### Returns
54
+
55
+ `Promise`\<`undefined` \| `IEngineState`\>
56
+
57
+ The state of the engine or undefined if it doesn't exist.
58
+
59
+ #### Implementation of
60
+
61
+ `IEngineStateStorage.load`
62
+
63
+ ***
64
+
65
+ ### save()
66
+
67
+ > **save**(`engineCore`, `state`): `Promise`\<`void`\>
68
+
69
+ Method for saving the state.
70
+
71
+ #### Parameters
72
+
73
+ • **engineCore**: `IEngineCore`
74
+
75
+ The engine core to save the state for.
76
+
77
+ • **state**: `IEngineState`
78
+
79
+ The state of the engine to save.
80
+
81
+ #### Returns
82
+
83
+ `Promise`\<`void`\>
84
+
85
+ Nothing.
86
+
87
+ #### Implementation of
88
+
89
+ `IEngineStateStorage.save`
@@ -0,0 +1,85 @@
1
+ # Class: MemoryStateStorage
2
+
3
+ Store state in memory.
4
+
5
+ ## Implements
6
+
7
+ - `IEngineStateStorage`
8
+
9
+ ## Constructors
10
+
11
+ ### new MemoryStateStorage()
12
+
13
+ > **new MemoryStateStorage**(`readonlyMode`): [`MemoryStateStorage`](MemoryStateStorage.md)
14
+
15
+ Create a new instance of MemoryStateStorage.
16
+
17
+ #### Parameters
18
+
19
+ • **readonlyMode**: `boolean` = `false`
20
+
21
+ Whether the file is in read-only mode.
22
+
23
+ #### Returns
24
+
25
+ [`MemoryStateStorage`](MemoryStateStorage.md)
26
+
27
+ ## Properties
28
+
29
+ ### CLASS\_NAME
30
+
31
+ > `readonly` **CLASS\_NAME**: `string`
32
+
33
+ Runtime name for the class.
34
+
35
+ ## Methods
36
+
37
+ ### load()
38
+
39
+ > **load**(`engineCore`): `Promise`\<`undefined` \| `IEngineState`\>
40
+
41
+ Method for loading the state.
42
+
43
+ #### Parameters
44
+
45
+ • **engineCore**: `IEngineCore`
46
+
47
+ The engine core to load the state for.
48
+
49
+ #### Returns
50
+
51
+ `Promise`\<`undefined` \| `IEngineState`\>
52
+
53
+ The state of the engine or undefined if it doesn't exist.
54
+
55
+ #### Implementation of
56
+
57
+ `IEngineStateStorage.load`
58
+
59
+ ***
60
+
61
+ ### save()
62
+
63
+ > **save**(`engineCore`, `state`): `Promise`\<`void`\>
64
+
65
+ Method for saving the state.
66
+
67
+ #### Parameters
68
+
69
+ • **engineCore**: `IEngineCore`
70
+
71
+ The engine core to save the state for.
72
+
73
+ • **state**: `IEngineState`
74
+
75
+ The state of the engine to save.
76
+
77
+ #### Returns
78
+
79
+ `Promise`\<`void`\>
80
+
81
+ Nothing.
82
+
83
+ #### Implementation of
84
+
85
+ `IEngineStateStorage.save`
@@ -0,0 +1,31 @@
1
+ # Function: initialiseEntityStorageConnector()
2
+
3
+ > **initialiseEntityStorageConnector**(`engineCore`, `context`, `typeCustom`, `schema`): `void`
4
+
5
+ Initialise the entity storage connector.
6
+
7
+ ## Parameters
8
+
9
+ • **engineCore**: `IEngineCore`
10
+
11
+ The engine core.
12
+
13
+ • **context**: `IEngineCoreContext`
14
+
15
+ The context for the engine.
16
+
17
+ • **typeCustom**: `undefined` \| `string`
18
+
19
+ Override the type of connector to use instead of default configuration.
20
+
21
+ • **schema**: `string`
22
+
23
+ The schema for the entity storage.
24
+
25
+ ## Returns
26
+
27
+ `void`
28
+
29
+ ## Throws
30
+
31
+ GeneralError if the connector type is unknown.
@@ -0,0 +1,15 @@
1
+ # @twin.org/engine-core
2
+
3
+ ## Classes
4
+
5
+ - [EngineCore](classes/EngineCore.md)
6
+ - [FileStateStorage](classes/FileStateStorage.md)
7
+ - [MemoryStateStorage](classes/MemoryStateStorage.md)
8
+
9
+ ## Interfaces
10
+
11
+ - [IEngineCoreOptions](interfaces/IEngineCoreOptions.md)
12
+
13
+ ## Functions
14
+
15
+ - [initialiseEntityStorageConnector](functions/initialiseEntityStorageConnector.md)
@@ -0,0 +1,45 @@
1
+ # Interface: IEngineCoreOptions
2
+
3
+ The options for creating engine core.
4
+
5
+ ## Properties
6
+
7
+ ### config?
8
+
9
+ > `optional` **config**: `IEngineCoreConfig`
10
+
11
+ The engine core config.
12
+
13
+ ***
14
+
15
+ ### stateStorage?
16
+
17
+ > `optional` **stateStorage**: `IEngineStateStorage`
18
+
19
+ The state storage component.
20
+
21
+ ***
22
+
23
+ ### skipBootstrap?
24
+
25
+ > `optional` **skipBootstrap**: `boolean`
26
+
27
+ Skip the bootstrap process, useful for additional engine instances.
28
+
29
+ ***
30
+
31
+ ### customBootstrap()?
32
+
33
+ > `optional` **customBootstrap**: (`engineCore`, `context`) => `Promise`\<`void`\>
34
+
35
+ Custom bootstrap method for the engine.
36
+
37
+ #### Parameters
38
+
39
+ • **engineCore**: `IEngineCore`
40
+
41
+ • **context**: `IEngineCoreContext`
42
+
43
+ #### Returns
44
+
45
+ `Promise`\<`void`\>
@@ -0,0 +1,42 @@
1
+ {
2
+ "error": {
3
+ "engineCore": {
4
+ "connectorUnknownType": "Unknown connector type \"{type}\" specified for \"{connectorType}\"",
5
+ "componentUnknownType": "Unknown component type \"{type}\" specified for \"{componentType}\"",
6
+ "entityStorageCustomMissing": "Entity storage custom \"{typeCustom}\" missing for component \"{storageName}\"",
7
+ "entityStorageMissing": "Entity storage configuration missing for component \"{storageName}\"",
8
+ "bootstrapFailed": "Bootstrap failed for component \"{component}\", please check the logs for more information",
9
+ "componentStopFailed": "Failed to stop component \"{component}\""
10
+ },
11
+ "fileStateStorage": {
12
+ "failedLoading": "Failed to load file state storage from \"{filename}\"",
13
+ "failedSaving": "Failed to save file state storage to \"{filename}\""
14
+ }
15
+ },
16
+ "engineCore": {
17
+ "debuggingEnabled": "Debugging is enabled",
18
+ "starting": "Engine is starting",
19
+ "started": "Engine has started",
20
+ "stopping": "Engine is stopping",
21
+ "stopped": "Engine has stopped",
22
+ "configuring": "Configuring {element}",
23
+ "configuringEntityStorage": "Configuring {element} with name \"{storageName}\" using \"{storageType}\" connector",
24
+ "bootstrapStarted": "Bootstrap started",
25
+ "bootstrapComplete": "Bootstrap complete",
26
+ "bootstrapping": "Bootstrap {element}",
27
+ "componentsStarting": "Components are starting",
28
+ "componentsComplete": "Components have started",
29
+ "componentsStopping": "Components are stopping",
30
+ "componentsStopped": "Components have stopped",
31
+ "componentStarting": "Starting {element}",
32
+ "componentStopping": "Stopping {element}"
33
+ },
34
+ "fileStateStorage": {
35
+ "loading": "Loading state from file storage with filename \"{filename}\"",
36
+ "saving": "Saving state to file storage with filename \"{filename}\""
37
+ },
38
+ "memoryStateStorage": {
39
+ "loading": "Loading state from memory",
40
+ "saving": "Saving state to memory"
41
+ }
42
+ }
package/package.json ADDED
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "@twin.org/engine-core",
3
+ "version": "0.0.1-next.1",
4
+ "description": "Engine implementation for a core.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/engine.git",
8
+ "directory": "packages/engine-core"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/api-auth-entity-storage-service": "next",
18
+ "@twin.org/api-core": "next",
19
+ "@twin.org/api-models": "next",
20
+ "@twin.org/api-processors": "next",
21
+ "@twin.org/api-server-fastify": "next",
22
+ "@twin.org/api-service": "next",
23
+ "@twin.org/attestation-connector-entity-storage": "next",
24
+ "@twin.org/attestation-connector-iota": "next",
25
+ "@twin.org/attestation-models": "next",
26
+ "@twin.org/attestation-service": "next",
27
+ "@twin.org/auditable-item-graph-models": "next",
28
+ "@twin.org/auditable-item-graph-service": "next",
29
+ "@twin.org/auditable-item-stream-models": "next",
30
+ "@twin.org/auditable-item-stream-service": "next",
31
+ "@twin.org/background-task-connector-entity-storage": "next",
32
+ "@twin.org/background-task-models": "next",
33
+ "@twin.org/blob-storage-connector-aws-s3": "next",
34
+ "@twin.org/blob-storage-connector-azure": "next",
35
+ "@twin.org/blob-storage-connector-file": "next",
36
+ "@twin.org/blob-storage-connector-gcp": "next",
37
+ "@twin.org/blob-storage-connector-ipfs": "next",
38
+ "@twin.org/blob-storage-connector-memory": "next",
39
+ "@twin.org/blob-storage-models": "next",
40
+ "@twin.org/blob-storage-service": "next",
41
+ "@twin.org/cli-core": "next",
42
+ "@twin.org/core": "next",
43
+ "@twin.org/crypto": "next",
44
+ "@twin.org/data-core": "next",
45
+ "@twin.org/data-schema-org": "next",
46
+ "@twin.org/engine-models": "0.0.1-next.1",
47
+ "@twin.org/entity": "next",
48
+ "@twin.org/entity-storage-connector-cosmosdb": "next",
49
+ "@twin.org/entity-storage-connector-dynamodb": "next",
50
+ "@twin.org/entity-storage-connector-file": "next",
51
+ "@twin.org/entity-storage-connector-gcp-firestore": "next",
52
+ "@twin.org/entity-storage-connector-memory": "next",
53
+ "@twin.org/entity-storage-connector-scylladb": "next",
54
+ "@twin.org/entity-storage-models": "next",
55
+ "@twin.org/entity-storage-service": "next",
56
+ "@twin.org/identity-connector-entity-storage": "next",
57
+ "@twin.org/identity-connector-iota": "next",
58
+ "@twin.org/identity-models": "next",
59
+ "@twin.org/identity-service": "next",
60
+ "@twin.org/immutable-proof-models": "next",
61
+ "@twin.org/immutable-proof-service": "next",
62
+ "@twin.org/immutable-storage-connector-entity-storage": "next",
63
+ "@twin.org/immutable-storage-connector-iota": "next",
64
+ "@twin.org/immutable-storage-models": "next",
65
+ "@twin.org/logging-connector-console": "next",
66
+ "@twin.org/logging-connector-entity-storage": "next",
67
+ "@twin.org/logging-models": "next",
68
+ "@twin.org/logging-service": "next",
69
+ "@twin.org/nameof": "next",
70
+ "@twin.org/nft-connector-entity-storage": "next",
71
+ "@twin.org/nft-connector-iota": "next",
72
+ "@twin.org/nft-models": "next",
73
+ "@twin.org/nft-service": "next",
74
+ "@twin.org/telemetry-connector-entity-storage": "next",
75
+ "@twin.org/telemetry-models": "next",
76
+ "@twin.org/telemetry-service": "next",
77
+ "@twin.org/vault-connector-entity-storage": "next",
78
+ "@twin.org/vault-connector-hashicorp": "next",
79
+ "@twin.org/vault-models": "next",
80
+ "@twin.org/wallet-connector-entity-storage": "next",
81
+ "@twin.org/wallet-connector-iota": "next",
82
+ "@twin.org/wallet-models": "next"
83
+ },
84
+ "main": "./dist/cjs/index.cjs",
85
+ "module": "./dist/esm/index.mjs",
86
+ "types": "./dist/types/index.d.ts",
87
+ "exports": {
88
+ ".": {
89
+ "require": "./dist/cjs/index.cjs",
90
+ "import": "./dist/esm/index.mjs",
91
+ "types": "./dist/types/index.d.ts"
92
+ },
93
+ "./locales/*.json": "./locales/*.json"
94
+ },
95
+ "files": [
96
+ "dist/cjs",
97
+ "dist/esm",
98
+ "dist/types",
99
+ "locales",
100
+ "docs"
101
+ ]
102
+ }