@twin.org/node-core 0.0.2-next.9 → 0.0.3-next.10
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/README.md +1 -1
- package/dist/es/builders/engineEnvBuilder.js +1132 -0
- package/dist/es/builders/engineEnvBuilder.js.map +1 -0
- package/dist/es/builders/engineServerEnvBuilder.js +206 -0
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -0
- package/dist/es/builders/extensionsBuilder.js +109 -0
- package/dist/es/builders/extensionsBuilder.js.map +1 -0
- package/dist/es/cli.js +255 -0
- package/dist/es/cli.js.map +1 -0
- package/dist/es/commands/bootstrapLegacy.js +175 -0
- package/dist/es/commands/bootstrapLegacy.js.map +1 -0
- package/dist/es/commands/help.js +85 -0
- package/dist/es/commands/help.js.map +1 -0
- package/dist/es/commands/identityCreate.js +310 -0
- package/dist/es/commands/identityCreate.js.map +1 -0
- package/dist/es/commands/identityImports.js +76 -0
- package/dist/es/commands/identityImports.js.map +1 -0
- package/dist/es/commands/identityVerifiableCredentialCreate.js +140 -0
- package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
- package/dist/es/commands/identityVerificationMethodCreate.js +208 -0
- package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
- package/dist/es/commands/identityVerificationMethodImport.js +120 -0
- package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
- package/dist/es/commands/nodeSetIdentity.js +51 -0
- package/dist/es/commands/nodeSetIdentity.js.map +1 -0
- package/dist/es/commands/nodeSetTenant.js +49 -0
- package/dist/es/commands/nodeSetTenant.js.map +1 -0
- package/dist/es/commands/tenantCreate.js +120 -0
- package/dist/es/commands/tenantCreate.js.map +1 -0
- package/dist/es/commands/tenantImport.js +78 -0
- package/dist/es/commands/tenantImport.js.map +1 -0
- package/dist/es/commands/userCreate.js +197 -0
- package/dist/es/commands/userCreate.js.map +1 -0
- package/dist/es/commands/vaultKeyCreate.js +185 -0
- package/dist/es/commands/vaultKeyCreate.js.map +1 -0
- package/dist/es/commands/vaultKeyImport.js +98 -0
- package/dist/es/commands/vaultKeyImport.js.map +1 -0
- package/dist/es/defaults.js +28 -0
- package/dist/es/defaults.js.map +1 -0
- package/dist/es/index.js +27 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/ICacheMetadata.js +4 -0
- package/dist/es/models/ICacheMetadata.js.map +1 -0
- package/dist/es/models/ICliArgs.js +4 -0
- package/dist/es/models/ICliArgs.js.map +1 -0
- package/dist/es/models/ICliCommand.js +2 -0
- package/dist/es/models/ICliCommand.js.map +1 -0
- package/dist/es/models/ICliCommandDefinition.js +2 -0
- package/dist/es/models/ICliCommandDefinition.js.map +1 -0
- package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
- package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
- package/dist/es/models/IEngineEnvironmentVariables.js +4 -0
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -0
- package/dist/es/models/IEngineServerEnvironmentVariables.js +2 -0
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -0
- package/dist/es/models/IModuleProtocol.js +2 -0
- package/dist/es/models/IModuleProtocol.js.map +1 -0
- package/dist/es/models/INodeEngineConfig.js +2 -0
- package/dist/es/models/INodeEngineConfig.js.map +1 -0
- package/dist/es/models/INodeEngineState.js +2 -0
- package/dist/es/models/INodeEngineState.js.map +1 -0
- package/dist/es/models/INodeEnvironmentVariables.js +2 -0
- package/dist/es/models/INodeEnvironmentVariables.js.map +1 -0
- package/dist/es/models/INodeOptions.js +2 -0
- package/dist/es/models/INodeOptions.js.map +1 -0
- package/dist/es/models/IProtocolHandlerResult.js +4 -0
- package/dist/es/models/IProtocolHandlerResult.js.map +1 -0
- package/dist/es/models/cliCommandParamType.js +4 -0
- package/dist/es/models/cliCommandParamType.js.map +1 -0
- package/dist/es/models/moduleProtocol.js +29 -0
- package/dist/es/models/moduleProtocol.js.map +1 -0
- package/dist/es/models/nodeExtensionMethods.js +2 -0
- package/dist/es/models/nodeExtensionMethods.js.map +1 -0
- package/dist/es/node.js +285 -0
- package/dist/es/node.js.map +1 -0
- package/dist/es/start.js +128 -0
- package/dist/es/start.js.map +1 -0
- package/dist/es/utils.js +397 -0
- package/dist/es/utils.js.map +1 -0
- package/dist/types/builders/engineEnvBuilder.d.ts +6 -2
- package/dist/types/builders/engineServerEnvBuilder.d.ts +7 -3
- package/dist/types/builders/extensionsBuilder.d.ts +32 -0
- package/dist/types/cli.d.ts +66 -0
- package/dist/types/commands/bootstrapLegacy.d.ts +66 -0
- package/dist/types/commands/help.d.ts +23 -0
- package/dist/types/commands/identityCreate.d.ts +39 -0
- package/dist/types/commands/identityImports.d.ts +24 -0
- package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
- package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
- package/dist/types/commands/identityVerificationMethodImport.d.ts +31 -0
- package/dist/types/commands/nodeSetIdentity.d.ts +22 -0
- package/dist/types/commands/nodeSetTenant.d.ts +22 -0
- package/dist/types/commands/tenantCreate.d.ts +35 -0
- package/dist/types/commands/tenantImport.d.ts +24 -0
- package/dist/types/commands/userCreate.d.ts +46 -0
- package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
- package/dist/types/commands/vaultKeyImport.d.ts +28 -0
- package/dist/types/defaults.d.ts +16 -0
- package/dist/types/index.d.ts +24 -11
- package/dist/types/models/ICacheMetadata.d.ts +17 -0
- package/dist/types/models/ICliArgs.d.ts +20 -0
- package/dist/types/models/ICliCommand.d.ts +17 -0
- package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
- package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +154 -37
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +12 -3
- package/dist/types/models/IModuleProtocol.d.ts +18 -0
- package/dist/types/models/INodeEngineConfig.d.ts +6 -0
- package/dist/types/models/INodeEngineState.d.ts +14 -0
- package/dist/types/models/INodeEnvironmentVariables.d.ts +17 -15
- package/dist/types/models/INodeOptions.d.ts +14 -3
- package/dist/types/models/IProtocolHandlerResult.d.ts +13 -0
- package/dist/types/models/cliCommandParamType.d.ts +4 -0
- package/dist/types/models/moduleProtocol.d.ts +29 -0
- package/dist/types/models/nodeExtensionMethods.d.ts +27 -0
- package/dist/types/node.d.ts +21 -7
- package/dist/types/start.d.ts +25 -0
- package/dist/types/utils.d.ts +83 -6
- package/docs/changelog.md +241 -0
- package/docs/detailed-guide.md +129 -0
- package/docs/reference/functions/buildConfiguration.md +2 -2
- package/docs/reference/functions/buildEngineConfiguration.md +8 -2
- package/docs/reference/functions/buildEngineServerConfiguration.md +9 -3
- package/docs/reference/functions/constructCliCommand.md +27 -0
- package/docs/reference/functions/createModuleImportUrl.md +21 -0
- package/docs/reference/functions/directoryExists.md +19 -0
- package/docs/reference/functions/executeCommand.md +29 -0
- package/docs/reference/functions/extensionsConfiguration.md +25 -0
- package/docs/reference/functions/extensionsInitialiseEngine.md +25 -0
- package/docs/reference/functions/extensionsInitialiseEngineServer.md +31 -0
- package/docs/reference/functions/getEnvDefaults.md +19 -0
- package/docs/reference/functions/getExtensionsCacheDir.md +31 -0
- package/docs/reference/functions/getFiles.md +19 -0
- package/docs/reference/functions/getSubFolders.md +19 -0
- package/docs/reference/functions/handleHttpsProtocol.md +49 -0
- package/docs/reference/functions/handleNpmProtocol.md +31 -0
- package/docs/reference/functions/hashUrl.md +19 -0
- package/docs/reference/functions/initCli.md +27 -0
- package/docs/reference/functions/isCacheExpired.md +31 -0
- package/docs/reference/functions/overrideModuleImport.md +8 -2
- package/docs/reference/functions/parseCommandLineArgs.md +19 -0
- package/docs/reference/functions/parseModuleProtocol.md +19 -0
- package/docs/reference/functions/processEnvOptions.md +27 -0
- package/docs/reference/functions/registerCommands.md +9 -0
- package/docs/reference/functions/resolvePackageEntryPoint.md +32 -0
- package/docs/reference/functions/run.md +9 -3
- package/docs/reference/functions/shutdownExtensions.md +25 -0
- package/docs/reference/functions/start.md +17 -5
- package/docs/reference/functions/substituteEnvOptions.md +25 -0
- package/docs/reference/index.md +47 -10
- package/docs/reference/interfaces/ICacheMetadata.md +27 -0
- package/docs/reference/interfaces/ICliArgs.md +35 -0
- package/docs/reference/interfaces/ICliCommand.md +23 -0
- package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
- package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +303 -60
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +1737 -5
- package/docs/reference/interfaces/IModuleProtocol.md +27 -0
- package/docs/reference/interfaces/INodeEngineConfig.md +7 -0
- package/docs/reference/interfaces/INodeEngineState.md +23 -0
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +599 -198
- package/docs/reference/interfaces/INodeOptions.md +27 -3
- package/docs/reference/interfaces/IProtocolHandlerResult.md +19 -0
- package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
- package/docs/reference/type-aliases/ModuleProtocol.md +5 -0
- package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +18 -0
- package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +24 -0
- package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +23 -0
- package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +10 -0
- package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +3 -0
- package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +3 -0
- package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
- package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +3 -0
- package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +3 -0
- package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +3 -0
- package/docs/reference/variables/ModuleProtocol.md +37 -0
- package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
- package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +3 -0
- package/locales/en.json +479 -28
- package/package.json +29 -9
- package/dist/cjs/index.cjs +0 -1910
- package/dist/esm/index.mjs +0 -1870
- package/dist/types/bootstrap.d.ts +0 -59
- package/dist/types/models/nodeFeatures.d.ts +0 -21
- package/dist/types/server.d.ts +0 -17
- package/docs/reference/functions/bootstrap.md +0 -29
- package/docs/reference/functions/bootstrapAuth.md +0 -35
- package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
- package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
- package/docs/reference/functions/bootstrapNodeIdentity.md +0 -35
- package/docs/reference/functions/bootstrapNodeUser.md +0 -35
- package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
- package/docs/reference/functions/getFeatures.md +0 -19
- package/docs/reference/type-aliases/NodeFeatures.md +0 -5
- package/docs/reference/variables/NodeFeatures.md +0 -25
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: extensionsConfiguration()
|
|
2
|
+
|
|
3
|
+
> **extensionsConfiguration**(`envVars`, `nodeEngineConfig`): `Promise`\<[`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)\>
|
|
4
|
+
|
|
5
|
+
Handles the configuration of the extensions.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### envVars
|
|
10
|
+
|
|
11
|
+
[`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
|
|
12
|
+
|
|
13
|
+
The environment variables for the node.
|
|
14
|
+
|
|
15
|
+
### nodeEngineConfig
|
|
16
|
+
|
|
17
|
+
[`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)
|
|
18
|
+
|
|
19
|
+
The node engine config.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`Promise`\<[`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)\>
|
|
24
|
+
|
|
25
|
+
The config for the core and the server.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: extensionsInitialiseEngine()
|
|
2
|
+
|
|
3
|
+
> **extensionsInitialiseEngine**(`envVars`, `engineCore`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Handles the initialisation of the extensions when the engine has been constructed.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### envVars
|
|
10
|
+
|
|
11
|
+
[`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
|
|
12
|
+
|
|
13
|
+
The environment variables for the node.
|
|
14
|
+
|
|
15
|
+
### engineCore
|
|
16
|
+
|
|
17
|
+
`IEngineCore`
|
|
18
|
+
|
|
19
|
+
The engine core instance.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`Promise`\<`void`\>
|
|
24
|
+
|
|
25
|
+
Nothing.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: extensionsInitialiseEngineServer()
|
|
2
|
+
|
|
3
|
+
> **extensionsInitialiseEngineServer**(`envVars`, `engineCore`, `engineServer`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Handles the initialisation of the extensions when the engine server has been constructed.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### envVars
|
|
10
|
+
|
|
11
|
+
[`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
|
|
12
|
+
|
|
13
|
+
The environment variables for the node.
|
|
14
|
+
|
|
15
|
+
### engineCore
|
|
16
|
+
|
|
17
|
+
`IEngineCore`
|
|
18
|
+
|
|
19
|
+
The engine core instance.
|
|
20
|
+
|
|
21
|
+
### engineServer
|
|
22
|
+
|
|
23
|
+
`IEngineServer`
|
|
24
|
+
|
|
25
|
+
The engine server instance.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`void`\>
|
|
30
|
+
|
|
31
|
+
Nothing.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: getEnvDefaults()
|
|
2
|
+
|
|
3
|
+
> **getEnvDefaults**(`envPrefix`): `object`
|
|
4
|
+
|
|
5
|
+
Get the default environment variables for the node.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### envPrefix
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The environment variable prefix.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`object`
|
|
18
|
+
|
|
19
|
+
The default environment variables.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: getExtensionsCacheDir()
|
|
2
|
+
|
|
3
|
+
> **getExtensionsCacheDir**(`executionDirectory`, `protocol`, `cacheDirectory?`): `string`
|
|
4
|
+
|
|
5
|
+
Get the extensions cache directory.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### executionDirectory
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The execution directory.
|
|
14
|
+
|
|
15
|
+
### protocol
|
|
16
|
+
|
|
17
|
+
[`ModuleProtocol`](../type-aliases/ModuleProtocol.md)
|
|
18
|
+
|
|
19
|
+
The protocol type for subdirectory organization.
|
|
20
|
+
|
|
21
|
+
### cacheDirectory?
|
|
22
|
+
|
|
23
|
+
`string`
|
|
24
|
+
|
|
25
|
+
The cache directory base path.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`string`
|
|
30
|
+
|
|
31
|
+
The cache directory path.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: getFiles()
|
|
2
|
+
|
|
3
|
+
> **getFiles**(`directory`): `Promise`\<`string`[]\>
|
|
4
|
+
|
|
5
|
+
Get the files in the directory.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### directory
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The directory to get the files from.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`Promise`\<`string`[]\>
|
|
18
|
+
|
|
19
|
+
The list of files in the directory.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: getSubFolders()
|
|
2
|
+
|
|
3
|
+
> **getSubFolders**(`directory`): `Promise`\<`string`[]\>
|
|
4
|
+
|
|
5
|
+
Get the sub folders for the folder.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### directory
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The directory to get the sub folders.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`Promise`\<`string`[]\>
|
|
18
|
+
|
|
19
|
+
The list of sub folders.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Function: handleHttpsProtocol()
|
|
2
|
+
|
|
3
|
+
> **handleHttpsProtocol**(`url`, `executionDirectory`, `maxSizeMb`, `cacheDirectory?`, `ttlHours?`, `forceRefresh?`): `Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
|
|
4
|
+
|
|
5
|
+
Handle the https: protocol by downloading the module if needed.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### url
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The HTTPS URL to download from.
|
|
14
|
+
|
|
15
|
+
### executionDirectory
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The execution directory.
|
|
20
|
+
|
|
21
|
+
### maxSizeMb
|
|
22
|
+
|
|
23
|
+
`number`
|
|
24
|
+
|
|
25
|
+
The maximum size in MB for the download.
|
|
26
|
+
|
|
27
|
+
### cacheDirectory?
|
|
28
|
+
|
|
29
|
+
`string`
|
|
30
|
+
|
|
31
|
+
The cache directory base path.
|
|
32
|
+
|
|
33
|
+
### ttlHours?
|
|
34
|
+
|
|
35
|
+
`number`
|
|
36
|
+
|
|
37
|
+
TTL in hours for cache expiration.
|
|
38
|
+
|
|
39
|
+
### forceRefresh?
|
|
40
|
+
|
|
41
|
+
`boolean`
|
|
42
|
+
|
|
43
|
+
Whether to force refresh the cache.
|
|
44
|
+
|
|
45
|
+
## Returns
|
|
46
|
+
|
|
47
|
+
`Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
|
|
48
|
+
|
|
49
|
+
The resolved path to the downloaded module.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: handleNpmProtocol()
|
|
2
|
+
|
|
3
|
+
> **handleNpmProtocol**(`packageName`, `executionDirectory`, `cacheDirectory?`): `Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
|
|
4
|
+
|
|
5
|
+
Handle the npm: protocol by installing the package if needed.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### packageName
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The npm package name (without npm: prefix).
|
|
14
|
+
|
|
15
|
+
### executionDirectory
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The execution directory.
|
|
20
|
+
|
|
21
|
+
### cacheDirectory?
|
|
22
|
+
|
|
23
|
+
`string`
|
|
24
|
+
|
|
25
|
+
The cache directory base path.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
|
|
30
|
+
|
|
31
|
+
The resolved path to the installed module.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: hashUrl()
|
|
2
|
+
|
|
3
|
+
> **hashUrl**(`url`): `string`
|
|
4
|
+
|
|
5
|
+
Hash a URL to create a safe filename.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### url
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The URL to hash.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
A hashed filename safe for the filesystem.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Function: initCli()
|
|
2
|
+
|
|
3
|
+
> **initCli**(`processEnv`, `args?`): [`ICliCommand`](../interfaces/ICliCommand.md) \| `undefined`
|
|
4
|
+
|
|
5
|
+
Initialise the CLI.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### processEnv
|
|
10
|
+
|
|
11
|
+
The environment variables from the process.
|
|
12
|
+
|
|
13
|
+
### args?
|
|
14
|
+
|
|
15
|
+
`string`[]
|
|
16
|
+
|
|
17
|
+
The command line arguments.
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
[`ICliCommand`](../interfaces/ICliCommand.md) \| `undefined`
|
|
22
|
+
|
|
23
|
+
The constructed CLI command if there is one.
|
|
24
|
+
|
|
25
|
+
## Throws
|
|
26
|
+
|
|
27
|
+
GeneralError if the command is missing or invalid.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: isCacheExpired()
|
|
2
|
+
|
|
3
|
+
> **isCacheExpired**(`metadataPath`, `ttlHours`, `forceRefresh`): `Promise`\<`boolean`\>
|
|
4
|
+
|
|
5
|
+
Check if a cached file has expired based on TTL and force refresh settings.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### metadataPath
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
Path to the cache metadata file.
|
|
14
|
+
|
|
15
|
+
### ttlHours
|
|
16
|
+
|
|
17
|
+
`number`
|
|
18
|
+
|
|
19
|
+
Time to live in hours.
|
|
20
|
+
|
|
21
|
+
### forceRefresh
|
|
22
|
+
|
|
23
|
+
`boolean`
|
|
24
|
+
|
|
25
|
+
Whether to force refresh regardless of TTL.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`boolean`\>
|
|
30
|
+
|
|
31
|
+
True if the cache is expired or should be refreshed.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Function: overrideModuleImport()
|
|
2
2
|
|
|
3
|
-
> **overrideModuleImport**(`executionDirectory`): `void`
|
|
3
|
+
> **overrideModuleImport**(`executionDirectory`, `envVars?`): `void`
|
|
4
4
|
|
|
5
|
-
Override module imports to
|
|
5
|
+
Override module imports to support protocol-based loading (npm:, https:) and local files.
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
@@ -12,6 +12,12 @@ Override module imports to use local files where possible.
|
|
|
12
12
|
|
|
13
13
|
The execution directory for resolving local module paths.
|
|
14
14
|
|
|
15
|
+
### envVars?
|
|
16
|
+
|
|
17
|
+
[`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
|
|
18
|
+
|
|
19
|
+
The environment variables containing extension configuration (optional, uses defaults if not provided).
|
|
20
|
+
|
|
15
21
|
## Returns
|
|
16
22
|
|
|
17
23
|
`void`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: parseCommandLineArgs()
|
|
2
|
+
|
|
3
|
+
> **parseCommandLineArgs**(`args?`): [`ICliArgs`](../interfaces/ICliArgs.md)
|
|
4
|
+
|
|
5
|
+
Parse command line arguments.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### args?
|
|
10
|
+
|
|
11
|
+
`string`[]
|
|
12
|
+
|
|
13
|
+
The command line arguments.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[`ICliArgs`](../interfaces/ICliArgs.md)
|
|
18
|
+
|
|
19
|
+
The parsed command line arguments.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: parseModuleProtocol()
|
|
2
|
+
|
|
3
|
+
> **parseModuleProtocol**(`moduleName`): [`IModuleProtocol`](../interfaces/IModuleProtocol.md)
|
|
4
|
+
|
|
5
|
+
Parse the protocol from a module name.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### moduleName
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The module name to parse.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[`IModuleProtocol`](../interfaces/IModuleProtocol.md)
|
|
18
|
+
|
|
19
|
+
The parsed protocol information.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Function: processEnvOptions()
|
|
2
|
+
|
|
3
|
+
> **processEnvOptions**(`processEnv`, `options`): `void`
|
|
4
|
+
|
|
5
|
+
Load the env files and process the options.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### processEnv
|
|
10
|
+
|
|
11
|
+
The environment variables from the process.
|
|
12
|
+
|
|
13
|
+
### options
|
|
14
|
+
|
|
15
|
+
`object`[]
|
|
16
|
+
|
|
17
|
+
The options.
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`void`
|
|
22
|
+
|
|
23
|
+
The processed parameters.
|
|
24
|
+
|
|
25
|
+
## Throws
|
|
26
|
+
|
|
27
|
+
GeneralError if an env file has errors.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Function: resolvePackageEntryPoint()
|
|
2
|
+
|
|
3
|
+
> **resolvePackageEntryPoint**(`packagePath`, `packageName`, `fallback`): `Promise`\<`string`\>
|
|
4
|
+
|
|
5
|
+
Resolve the main entry point from a package directory using Node.js resolution with fallback.
|
|
6
|
+
Uses require.resolve() when possible for standard Node.js behavior, with manual fallback.
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
### packagePath
|
|
11
|
+
|
|
12
|
+
`string`
|
|
13
|
+
|
|
14
|
+
The absolute path to the package directory.
|
|
15
|
+
|
|
16
|
+
### packageName
|
|
17
|
+
|
|
18
|
+
`string`
|
|
19
|
+
|
|
20
|
+
The package name for require.resolve().
|
|
21
|
+
|
|
22
|
+
### fallback
|
|
23
|
+
|
|
24
|
+
`string` = `"index.js"`
|
|
25
|
+
|
|
26
|
+
The fallback file name if no entry point is found.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<`string`\>
|
|
31
|
+
|
|
32
|
+
The resolved entry point file name (relative to package directory).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: run()
|
|
2
2
|
|
|
3
|
-
> **run**(`nodeOptions?`): `Promise`\<`void`\>
|
|
3
|
+
> **run**(`nodeOptions?`, `args?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
|
|
4
4
|
|
|
5
5
|
Run the TWIN Node server.
|
|
6
6
|
|
|
@@ -12,8 +12,14 @@ Run the TWIN Node server.
|
|
|
12
12
|
|
|
13
13
|
Optional configuration options for running the server.
|
|
14
14
|
|
|
15
|
+
### args?
|
|
16
|
+
|
|
17
|
+
`string`[]
|
|
18
|
+
|
|
19
|
+
Optional command line arguments.
|
|
20
|
+
|
|
15
21
|
## Returns
|
|
16
22
|
|
|
17
|
-
`Promise`\<`void`\>
|
|
23
|
+
`Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
|
|
18
24
|
|
|
19
|
-
A promise that resolves when the server is started.
|
|
25
|
+
A promise that resolves when the server is started containing a shutdown method.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: shutdownExtensions()
|
|
2
|
+
|
|
3
|
+
> **shutdownExtensions**(`envVars`, `engineCore`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Handles the shutdown of the extensions.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### envVars
|
|
10
|
+
|
|
11
|
+
[`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
|
|
12
|
+
|
|
13
|
+
The environment variables for the node.
|
|
14
|
+
|
|
15
|
+
### engineCore
|
|
16
|
+
|
|
17
|
+
`IEngineCore`
|
|
18
|
+
|
|
19
|
+
The engine core instance.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`Promise`\<`void`\>
|
|
24
|
+
|
|
25
|
+
Nothing.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: start()
|
|
2
2
|
|
|
3
|
-
> **start**(`nodeOptions`, `
|
|
3
|
+
> **start**(`nodeOptions`, `nodeEngineConfig`, `envVars`, `cliCommand?`, `availableContextIdKeys?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
|
|
4
4
|
|
|
5
5
|
Start the engine server.
|
|
6
6
|
|
|
@@ -10,11 +10,11 @@ Start the engine server.
|
|
|
10
10
|
|
|
11
11
|
Optional run options for the engine server.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[`INodeOptions`](../interfaces/INodeOptions.md) | `undefined`
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### nodeEngineConfig
|
|
16
16
|
|
|
17
|
-
`
|
|
17
|
+
[`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)
|
|
18
18
|
|
|
19
19
|
The configuration for the engine server.
|
|
20
20
|
|
|
@@ -24,8 +24,20 @@ The configuration for the engine server.
|
|
|
24
24
|
|
|
25
25
|
The environment variables.
|
|
26
26
|
|
|
27
|
+
### cliCommand?
|
|
28
|
+
|
|
29
|
+
[`ICliCommand`](../interfaces/ICliCommand.md)
|
|
30
|
+
|
|
31
|
+
The constructed CLI command (optional).
|
|
32
|
+
|
|
33
|
+
### availableContextIdKeys?
|
|
34
|
+
|
|
35
|
+
`object`[]
|
|
36
|
+
|
|
37
|
+
The context ID keys available for operation.
|
|
38
|
+
|
|
27
39
|
## Returns
|
|
28
40
|
|
|
29
|
-
`Promise
|
|
41
|
+
`Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
|
|
30
42
|
|
|
31
43
|
The engine server.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: substituteEnvOptions()
|
|
2
|
+
|
|
3
|
+
> **substituteEnvOptions**(`processEnv`, `options`): `void`
|
|
4
|
+
|
|
5
|
+
Process options and replace any env variables with their values.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### processEnv
|
|
10
|
+
|
|
11
|
+
The environment variables from the process.
|
|
12
|
+
|
|
13
|
+
### options
|
|
14
|
+
|
|
15
|
+
`object`[]
|
|
16
|
+
|
|
17
|
+
The options.
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`void`
|
|
22
|
+
|
|
23
|
+
## Throws
|
|
24
|
+
|
|
25
|
+
GeneralError if an env variable is missing.
|
package/docs/reference/index.md
CHANGED
|
@@ -2,30 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
## Interfaces
|
|
4
4
|
|
|
5
|
+
- [ICacheMetadata](interfaces/ICacheMetadata.md)
|
|
6
|
+
- [ICliArgs](interfaces/ICliArgs.md)
|
|
7
|
+
- [ICliCommand](interfaces/ICliCommand.md)
|
|
8
|
+
- [ICliCommandDefinition](interfaces/ICliCommandDefinition.md)
|
|
9
|
+
- [ICliCommandDefinitionParam](interfaces/ICliCommandDefinitionParam.md)
|
|
5
10
|
- [IEngineEnvironmentVariables](interfaces/IEngineEnvironmentVariables.md)
|
|
6
11
|
- [IEngineServerEnvironmentVariables](interfaces/IEngineServerEnvironmentVariables.md)
|
|
12
|
+
- [IModuleProtocol](interfaces/IModuleProtocol.md)
|
|
13
|
+
- [INodeEngineConfig](interfaces/INodeEngineConfig.md)
|
|
14
|
+
- [INodeEngineState](interfaces/INodeEngineState.md)
|
|
7
15
|
- [INodeEnvironmentVariables](interfaces/INodeEnvironmentVariables.md)
|
|
8
16
|
- [INodeOptions](interfaces/INodeOptions.md)
|
|
17
|
+
- [IProtocolHandlerResult](interfaces/IProtocolHandlerResult.md)
|
|
9
18
|
|
|
10
19
|
## Type Aliases
|
|
11
20
|
|
|
12
|
-
- [
|
|
21
|
+
- [CliCommandParamType](type-aliases/CliCommandParamType.md)
|
|
22
|
+
- [ModuleProtocol](type-aliases/ModuleProtocol.md)
|
|
23
|
+
- [NodeExtensionInitialiseMethod](type-aliases/NodeExtensionInitialiseMethod.md)
|
|
24
|
+
- [NodeExtensionInitialiseEngineMethod](type-aliases/NodeExtensionInitialiseEngineMethod.md)
|
|
25
|
+
- [NodeExtensionInitialiseEngineServerMethod](type-aliases/NodeExtensionInitialiseEngineServerMethod.md)
|
|
26
|
+
- [NodeExtensionShutdownMethod](type-aliases/NodeExtensionShutdownMethod.md)
|
|
13
27
|
|
|
14
28
|
## Variables
|
|
15
29
|
|
|
16
|
-
- [
|
|
30
|
+
- [ATTESTATION\_VERIFICATION\_METHOD\_ID](variables/ATTESTATION_VERIFICATION_METHOD_ID.md)
|
|
31
|
+
- [IMMUTABLE\_PROOF\_VERIFICATION\_METHOD\_ID](variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md)
|
|
32
|
+
- [BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID](variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md)
|
|
33
|
+
- [SYNCHRONISED\_STORAGE\_BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID](variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md)
|
|
34
|
+
- [VC\_AUTHENTICATION\_VERIFICATION\_METHOD\_ID](variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md)
|
|
35
|
+
- [AUTH\_SIGNING\_KEY\_ID](variables/AUTH_SIGNING_KEY_ID.md)
|
|
36
|
+
- [CONTEXT\_ID\_HANDLER\_FEATURE\_DID](variables/CONTEXT_ID_HANDLER_FEATURE_DID.md)
|
|
37
|
+
- [CONTEXT\_ID\_HANDLER\_FEATURE\_TENANT](variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md)
|
|
38
|
+
- [ModuleProtocol](variables/ModuleProtocol.md)
|
|
17
39
|
|
|
18
40
|
## Functions
|
|
19
41
|
|
|
20
|
-
- [bootstrap](functions/bootstrap.md)
|
|
21
|
-
- [bootstrapNodeIdentity](functions/bootstrapNodeIdentity.md)
|
|
22
|
-
- [bootstrapNodeUser](functions/bootstrapNodeUser.md)
|
|
23
|
-
- [bootstrapImmutableProofMethod](functions/bootstrapImmutableProofMethod.md)
|
|
24
|
-
- [bootstrapBlobEncryption](functions/bootstrapBlobEncryption.md)
|
|
25
|
-
- [bootstrapAuth](functions/bootstrapAuth.md)
|
|
26
|
-
- [bootstrapSynchronisedStorage](functions/bootstrapSynchronisedStorage.md)
|
|
27
42
|
- [buildEngineConfiguration](functions/buildEngineConfiguration.md)
|
|
28
43
|
- [buildEngineServerConfiguration](functions/buildEngineServerConfiguration.md)
|
|
44
|
+
- [extensionsConfiguration](functions/extensionsConfiguration.md)
|
|
45
|
+
- [extensionsInitialiseEngine](functions/extensionsInitialiseEngine.md)
|
|
46
|
+
- [extensionsInitialiseEngineServer](functions/extensionsInitialiseEngineServer.md)
|
|
47
|
+
- [shutdownExtensions](functions/shutdownExtensions.md)
|
|
48
|
+
- [initCli](functions/initCli.md)
|
|
49
|
+
- [parseCommandLineArgs](functions/parseCommandLineArgs.md)
|
|
50
|
+
- [constructCliCommand](functions/constructCliCommand.md)
|
|
51
|
+
- [executeCommand](functions/executeCommand.md)
|
|
52
|
+
- [processEnvOptions](functions/processEnvOptions.md)
|
|
53
|
+
- [substituteEnvOptions](functions/substituteEnvOptions.md)
|
|
54
|
+
- [registerCommands](functions/registerCommands.md)
|
|
55
|
+
- [getEnvDefaults](functions/getEnvDefaults.md)
|
|
29
56
|
- [run](functions/run.md)
|
|
30
57
|
- [buildConfiguration](functions/buildConfiguration.md)
|
|
31
58
|
- [overrideModuleImport](functions/overrideModuleImport.md)
|
|
@@ -33,6 +60,16 @@
|
|
|
33
60
|
- [initialiseLocales](functions/initialiseLocales.md)
|
|
34
61
|
- [getExecutionDirectory](functions/getExecutionDirectory.md)
|
|
35
62
|
- [fileExists](functions/fileExists.md)
|
|
63
|
+
- [directoryExists](functions/directoryExists.md)
|
|
64
|
+
- [getSubFolders](functions/getSubFolders.md)
|
|
65
|
+
- [getFiles](functions/getFiles.md)
|
|
36
66
|
- [loadTextFile](functions/loadTextFile.md)
|
|
37
67
|
- [loadJsonFile](functions/loadJsonFile.md)
|
|
38
|
-
- [
|
|
68
|
+
- [parseModuleProtocol](functions/parseModuleProtocol.md)
|
|
69
|
+
- [hashUrl](functions/hashUrl.md)
|
|
70
|
+
- [getExtensionsCacheDir](functions/getExtensionsCacheDir.md)
|
|
71
|
+
- [handleNpmProtocol](functions/handleNpmProtocol.md)
|
|
72
|
+
- [isCacheExpired](functions/isCacheExpired.md)
|
|
73
|
+
- [handleHttpsProtocol](functions/handleHttpsProtocol.md)
|
|
74
|
+
- [resolvePackageEntryPoint](functions/resolvePackageEntryPoint.md)
|
|
75
|
+
- [createModuleImportUrl](functions/createModuleImportUrl.md)
|