@twin.org/node-core 0.0.3-next.6 → 0.0.3-next.60

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 (206) hide show
  1. package/README.md +3 -1
  2. package/dist/es/builders/engineEnvBuilder.js +538 -213
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  4. package/dist/es/builders/engineServerEnvBuilder.js +86 -39
  5. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  6. package/dist/es/builders/extensionsBuilder.js +3 -3
  7. package/dist/es/builders/extensionsBuilder.js.map +1 -1
  8. package/dist/es/cli.js +254 -0
  9. package/dist/es/cli.js.map +1 -0
  10. package/dist/es/commands/bootstrapLegacy.js +311 -0
  11. package/dist/es/commands/bootstrapLegacy.js.map +1 -0
  12. package/dist/es/commands/help.js +86 -0
  13. package/dist/es/commands/help.js.map +1 -0
  14. package/dist/es/commands/identityCreate.js +377 -0
  15. package/dist/es/commands/identityCreate.js.map +1 -0
  16. package/dist/es/commands/identityImports.js +83 -0
  17. package/dist/es/commands/identityImports.js.map +1 -0
  18. package/dist/es/commands/identityVerifiableCredentialCreate.js +146 -0
  19. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
  20. package/dist/es/commands/identityVerificationMethodCreate.js +230 -0
  21. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
  22. package/dist/es/commands/identityVerificationMethodImport.js +127 -0
  23. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
  24. package/dist/es/commands/nodeSetIdentity.js +69 -0
  25. package/dist/es/commands/nodeSetIdentity.js.map +1 -0
  26. package/dist/es/commands/removeTenantOrgAlias.js +83 -0
  27. package/dist/es/commands/removeTenantOrgAlias.js.map +1 -0
  28. package/dist/es/commands/setNodeOrgId.js +62 -0
  29. package/dist/es/commands/setNodeOrgId.js.map +1 -0
  30. package/dist/es/commands/setTenantOrgId.js +99 -0
  31. package/dist/es/commands/setTenantOrgId.js.map +1 -0
  32. package/dist/es/commands/tenantCreate.js +165 -0
  33. package/dist/es/commands/tenantCreate.js.map +1 -0
  34. package/dist/es/commands/tenantImport.js +108 -0
  35. package/dist/es/commands/tenantImport.js.map +1 -0
  36. package/dist/es/commands/tenantUpdate.js +108 -0
  37. package/dist/es/commands/tenantUpdate.js.map +1 -0
  38. package/dist/es/commands/userCreate.js +239 -0
  39. package/dist/es/commands/userCreate.js.map +1 -0
  40. package/dist/es/commands/userUpdate.js +154 -0
  41. package/dist/es/commands/userUpdate.js.map +1 -0
  42. package/dist/es/commands/vaultKeyCreate.js +191 -0
  43. package/dist/es/commands/vaultKeyCreate.js.map +1 -0
  44. package/dist/es/commands/vaultKeyImport.js +105 -0
  45. package/dist/es/commands/vaultKeyImport.js.map +1 -0
  46. package/dist/es/defaults.js +37 -2
  47. package/dist/es/defaults.js.map +1 -1
  48. package/dist/es/index.js +11 -4
  49. package/dist/es/index.js.map +1 -1
  50. package/dist/es/models/ICliArgs.js +4 -0
  51. package/dist/es/models/ICliArgs.js.map +1 -0
  52. package/dist/es/models/ICliCommand.js +2 -0
  53. package/dist/es/models/ICliCommand.js.map +1 -0
  54. package/dist/es/models/ICliCommandDefinition.js +2 -0
  55. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  56. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  57. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  58. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  59. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  60. package/dist/es/models/INodeEngineState.js.map +1 -1
  61. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
  62. package/dist/es/models/INodeOptions.js.map +1 -1
  63. package/dist/es/models/cliCommandParamType.js +4 -0
  64. package/dist/es/models/cliCommandParamType.js.map +1 -0
  65. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js +2 -0
  66. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js.map +1 -0
  67. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js +2 -0
  68. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js.map +1 -0
  69. package/dist/es/models/nodeExtensionInitialiseMethod.js +2 -0
  70. package/dist/es/models/nodeExtensionInitialiseMethod.js.map +1 -0
  71. package/dist/es/models/nodeExtensionShutdownMethod.js +4 -0
  72. package/dist/es/models/nodeExtensionShutdownMethod.js.map +1 -0
  73. package/dist/es/node.js +87 -40
  74. package/dist/es/node.js.map +1 -1
  75. package/dist/es/start.js +189 -0
  76. package/dist/es/start.js.map +1 -0
  77. package/dist/es/utils.js +24 -27
  78. package/dist/es/utils.js.map +1 -1
  79. package/dist/types/builders/engineEnvBuilder.d.ts +60 -5
  80. package/dist/types/builders/engineServerEnvBuilder.d.ts +11 -2
  81. package/dist/types/builders/extensionsBuilder.d.ts +3 -3
  82. package/dist/types/cli.d.ts +56 -0
  83. package/dist/types/commands/bootstrapLegacy.d.ts +67 -0
  84. package/dist/types/commands/help.d.ts +24 -0
  85. package/dist/types/commands/identityCreate.d.ts +45 -0
  86. package/dist/types/commands/identityImports.d.ts +25 -0
  87. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  88. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  89. package/dist/types/commands/identityVerificationMethodImport.d.ts +32 -0
  90. package/dist/types/commands/nodeSetIdentity.d.ts +23 -0
  91. package/dist/types/commands/removeTenantOrgAlias.d.ts +24 -0
  92. package/dist/types/commands/setNodeOrgId.d.ts +24 -0
  93. package/dist/types/commands/setTenantOrgId.d.ts +38 -0
  94. package/dist/types/commands/tenantCreate.d.ts +41 -0
  95. package/dist/types/commands/tenantImport.d.ts +29 -0
  96. package/dist/types/commands/tenantUpdate.d.ts +29 -0
  97. package/dist/types/commands/userCreate.d.ts +51 -0
  98. package/dist/types/commands/userUpdate.d.ts +40 -0
  99. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  100. package/dist/types/commands/vaultKeyImport.d.ts +29 -0
  101. package/dist/types/defaults.d.ts +30 -2
  102. package/dist/types/index.d.ts +11 -4
  103. package/dist/types/models/ICliArgs.d.ts +20 -0
  104. package/dist/types/models/ICliCommand.d.ts +17 -0
  105. package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
  106. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  107. package/dist/types/models/IEngineEnvironmentVariables.d.ts +168 -95
  108. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +8 -0
  109. package/dist/types/models/INodeEngineState.d.ts +2 -9
  110. package/dist/types/models/INodeEnvironmentVariables.d.ts +0 -38
  111. package/dist/types/models/INodeOptions.d.ts +6 -2
  112. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  113. package/dist/types/models/nodeExtensionInitialiseEngineMethod.d.ts +8 -0
  114. package/dist/types/models/nodeExtensionInitialiseEngineServerMethod.d.ts +9 -0
  115. package/dist/types/models/nodeExtensionInitialiseMethod.d.ts +9 -0
  116. package/dist/types/models/nodeExtensionShutdownMethod.d.ts +6 -0
  117. package/dist/types/node.d.ts +5 -4
  118. package/dist/types/{server.d.ts → start.d.ts} +4 -2
  119. package/dist/types/utils.d.ts +9 -10
  120. package/docs/changelog.md +675 -180
  121. package/docs/examples.md +99 -1
  122. package/docs/reference/functions/buildConfiguration.md +1 -1
  123. package/docs/reference/functions/buildEngineConfiguration.md +1 -7
  124. package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
  125. package/docs/reference/functions/constructCliCommand.md +27 -0
  126. package/docs/reference/functions/executeCommand.md +29 -0
  127. package/docs/reference/functions/extensionsInitialiseEngine.md +1 -1
  128. package/docs/reference/functions/extensionsInitialiseEngineServer.md +1 -1
  129. package/docs/reference/functions/getEnvDefaults.md +19 -0
  130. package/docs/reference/functions/getScriptDirectory.md +19 -0
  131. package/docs/reference/functions/initialiseLocales.md +2 -0
  132. package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
  133. package/docs/reference/functions/isAutomationRequired.md +20 -0
  134. package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
  135. package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
  136. package/docs/reference/functions/isImmutableProofRequired.md +20 -0
  137. package/docs/reference/functions/isRightsManagementRequired.md +23 -0
  138. package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
  139. package/docs/reference/functions/isTelemetryRequired.md +20 -0
  140. package/docs/reference/functions/isTrustRequired.md +20 -0
  141. package/docs/reference/functions/loadJsonFile.md +1 -1
  142. package/docs/reference/functions/loadTextFile.md +1 -1
  143. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  144. package/docs/reference/functions/processEnvOptions.md +27 -0
  145. package/docs/reference/functions/registerCommands.md +9 -0
  146. package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
  147. package/docs/reference/functions/run.md +8 -2
  148. package/docs/reference/functions/shutdownExtensions.md +1 -1
  149. package/docs/reference/functions/start.md +9 -3
  150. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  151. package/docs/reference/index.md +24 -14
  152. package/docs/reference/interfaces/ICacheMetadata.md +3 -3
  153. package/docs/reference/interfaces/ICliArgs.md +35 -0
  154. package/docs/reference/interfaces/ICliCommand.md +23 -0
  155. package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
  156. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  157. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +488 -359
  158. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +652 -431
  159. package/docs/reference/interfaces/IModuleProtocol.md +3 -3
  160. package/docs/reference/interfaces/INodeEngineState.md +6 -21
  161. package/docs/reference/interfaces/INodeEnvironmentVariables.md +661 -516
  162. package/docs/reference/interfaces/INodeOptions.md +44 -36
  163. package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
  164. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  165. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +3 -1
  166. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +3 -1
  167. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +3 -1
  168. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +3 -1
  169. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +2 -0
  170. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +2 -0
  171. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +2 -0
  172. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +2 -0
  173. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +2 -0
  174. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +2 -0
  175. package/docs/reference/variables/ModuleProtocol.md +5 -5
  176. package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +5 -0
  177. package/locales/en.json +674 -30
  178. package/package.json +10 -6
  179. package/dist/es/bootstrap.js +0 -366
  180. package/dist/es/bootstrap.js.map +0 -1
  181. package/dist/es/identity.js +0 -182
  182. package/dist/es/identity.js.map +0 -1
  183. package/dist/es/models/nodeExtensionMethods.js +0 -2
  184. package/dist/es/models/nodeExtensionMethods.js.map +0 -1
  185. package/dist/es/models/nodeFeatures.js +0 -21
  186. package/dist/es/models/nodeFeatures.js.map +0 -1
  187. package/dist/es/server.js +0 -81
  188. package/dist/es/server.js.map +0 -1
  189. package/dist/types/bootstrap.d.ts +0 -68
  190. package/dist/types/identity.d.ts +0 -14
  191. package/dist/types/models/nodeExtensionMethods.d.ts +0 -27
  192. package/dist/types/models/nodeFeatures.d.ts +0 -21
  193. package/docs/detailed-guide.md +0 -129
  194. package/docs/reference/functions/bootstrap.md +0 -29
  195. package/docs/reference/functions/bootstrapAuth.md +0 -35
  196. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  197. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  198. package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
  199. package/docs/reference/functions/bootstrapNodeId.md +0 -35
  200. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  201. package/docs/reference/functions/bootstrapTenantId.md +0 -35
  202. package/docs/reference/functions/getFeatures.md +0 -19
  203. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  204. package/docs/reference/variables/NodeFeatures.md +0 -25
  205. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +0 -3
  206. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +0 -3
@@ -8,15 +8,8 @@ export interface INodeEngineState extends IEngineState {
8
8
  */
9
9
  nodeId?: string;
10
10
  /**
11
- * The tenant id for the node.
12
- */
13
- nodeTenantId?: string;
14
- /**
15
- * The identity for the organization.
11
+ * This is the default organization used in the context ids when a user is not authenticated.
12
+ * It is not used in multi-tenant mode, which gets the organization from the tenant table.
16
13
  */
17
14
  nodeOrganizationId?: string;
18
- /**
19
- * The identity for the admin user.
20
- */
21
- nodeAdminUserId?: string;
22
15
  }
@@ -3,44 +3,6 @@ import type { IEngineServerEnvironmentVariables } from "./IEngineServerEnvironme
3
3
  * The environment variables for the node.
4
4
  */
5
5
  export interface INodeEnvironmentVariables extends IEngineServerEnvironmentVariables {
6
- /**
7
- * The features that are enabled on the node.
8
- * @default []
9
- */
10
- features?: string;
11
- /**
12
- * The identity of the node which, if empty and node-identity feature is enabled it will be generated.
13
- */
14
- nodeIdentity?: string;
15
- /**
16
- * The mnemonic for the identity, if empty and node-identity feature is enabled it will be randomly generated.
17
- */
18
- nodeMnemonic?: string;
19
- /**
20
- * If the node-admin-user feature is enabled, this will be the organization of the user, if one is not provided it will be generated
21
- */
22
- organizationIdentity?: string;
23
- /**
24
- * The mnemonic for the organization, if empty and node-admin-user feature is enabled it will be randomly generated.
25
- */
26
- organizationMnemonic?: string;
27
- /**
28
- * If the node-admin-user feature is enabled, this will be the identity of the user, if one is not provided it will be generated
29
- */
30
- adminUserIdentity?: string;
31
- /**
32
- * The mnemonic for the admin user, if empty and node-admin-user feature is enabled it will be randomly generated.
33
- */
34
- adminUserMnemonic?: string;
35
- /**
36
- * If the node-admin-user feature is enabled, this will be the name of the user.
37
- * @default admin@node
38
- */
39
- adminUserName?: string;
40
- /**
41
- * If the node-admin-user feature is enabled, this will be the password of the user, if empty it will be randomly generated.
42
- */
43
- adminUserPassword?: string;
44
6
  /**
45
7
  * Maximum size in MB for HTTPS extensions downloads.
46
8
  * @default 10
@@ -7,8 +7,8 @@ import type { INodeEnvironmentVariables } from "./INodeEnvironmentVariables.js";
7
7
  */
8
8
  export interface INodeOptions {
9
9
  /**
10
- * The name of the server, defaults to "TWIN Node Server".
11
- * @default "TWIN Node Server"
10
+ * The name of the server, defaults to "TWIN Node".
11
+ * @default "TWIN Node"
12
12
  */
13
13
  serverName?: string;
14
14
  /**
@@ -40,6 +40,10 @@ export interface INodeOptions {
40
40
  * This will be merged with any configuration loaded from the environment variables.
41
41
  */
42
42
  config?: IEngineConfig;
43
+ /**
44
+ * The directory to override the script location, defaults to location of index.js.
45
+ */
46
+ scriptDirectory?: string;
43
47
  /**
44
48
  * The directory to override the execution location, defaults to process directory.
45
49
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Type for the properties in commands.
3
+ */
4
+ export type CliCommandParamType = string | number | boolean;
@@ -0,0 +1,8 @@
1
+ import type { IEngineCore } from "@twin.org/engine-models";
2
+ /**
3
+ * The type for the initialise engine method of an extension module.
4
+ * This is called when the engine has been constructed but not yet started.
5
+ * @param engineCore The engine core instance.
6
+ * @returns A promise that resolves when the extension engine initialisation is complete.
7
+ */
8
+ export type NodeExtensionInitialiseEngineMethod = (engineCore: IEngineCore) => Promise<void>;
@@ -0,0 +1,9 @@
1
+ import type { IEngineCore, IEngineServer } from "@twin.org/engine-models";
2
+ /**
3
+ * The type for the initialise engine server method of an extension module.
4
+ * This is called when the engine server has been constructed but not yet started.
5
+ * @param engineCore The engine core instance.
6
+ * @param engineServer The engine server instance.
7
+ * @returns A promise that resolves when the extension engine-server initialisation is complete.
8
+ */
9
+ export type NodeExtensionInitialiseEngineServerMethod = (engineCore: IEngineCore, engineServer: IEngineServer) => Promise<void>;
@@ -0,0 +1,9 @@
1
+ import type { INodeEngineConfig } from "./INodeEngineConfig.js";
2
+ import type { INodeEnvironmentVariables } from "./INodeEnvironmentVariables.js";
3
+ /**
4
+ * The type for the initialise method of an extension module.
5
+ * @param envVars The environment variables for the node.
6
+ * @param nodeEngineConfig The node engine config.
7
+ * @returns A promise that resolves when the extension configuration initialisation is complete.
8
+ */
9
+ export type NodeExtensionInitialiseMethod = (envVars: INodeEnvironmentVariables, nodeEngineConfig: INodeEngineConfig) => Promise<void>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The type for the shutdown method of an extension module.
3
+ * This is called when the engine is shutting down.
4
+ * @returns A promise that resolves when the extension shutdown is complete.
5
+ */
6
+ export type NodeExtensionShutdownMethod = () => Promise<void>;
@@ -7,17 +7,18 @@ import type { INodeEngineState } from "./models/INodeEngineState.js";
7
7
  import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables.js";
8
8
  import type { INodeOptions } from "./models/INodeOptions.js";
9
9
  /**
10
- * Run the TWIN Node server.
10
+ * Run the TWIN Node.
11
11
  * @param nodeOptions Optional configuration options for running the server.
12
+ * @param args Optional command line arguments.
12
13
  * @returns A promise that resolves when the server is started containing a shutdown method.
13
14
  */
14
- export declare function run(nodeOptions?: INodeOptions): Promise<{
15
+ export declare function run(nodeOptions?: INodeOptions, args?: string[]): Promise<{
15
16
  engine: Engine<IEngineServerConfig, INodeEngineState>;
16
17
  server: EngineServer;
17
18
  shutdown: () => Promise<void>;
18
19
  } | undefined>;
19
20
  /**
20
- * Build the configuration for the TWIN Node server.
21
+ * Build the configuration for the TWIN Node.
21
22
  * @param processEnv The environment variables from the process.
22
23
  * @param options The options for running the server.
23
24
  * @param serverInfo The server information.
@@ -33,7 +34,7 @@ export declare function buildConfiguration(processEnv: {
33
34
  nodeEngineConfig: INodeEngineConfig;
34
35
  availableContextIdKeys: {
35
36
  key: string;
36
- componentFeatures: string[];
37
+ requiredHandlerFeatures: string[];
37
38
  }[];
38
39
  }>;
39
40
  /**
@@ -1,6 +1,7 @@
1
1
  import { Engine } from "@twin.org/engine";
2
2
  import { EngineServer } from "@twin.org/engine-server";
3
3
  import type { IEngineServerConfig } from "@twin.org/engine-server-types";
4
+ import type { ICliCommand } from "./models/ICliCommand.js";
4
5
  import type { INodeEngineConfig } from "./models/INodeEngineConfig.js";
5
6
  import type { INodeEngineState } from "./models/INodeEngineState.js";
6
7
  import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables.js";
@@ -10,12 +11,13 @@ import type { INodeOptions } from "./models/INodeOptions.js";
10
11
  * @param nodeOptions Optional run options for the engine server.
11
12
  * @param nodeEngineConfig The configuration for the engine server.
12
13
  * @param envVars The environment variables.
14
+ * @param cliCommand The constructed CLI command (optional).
13
15
  * @param availableContextIdKeys The context ID keys available for operation.
14
16
  * @returns The engine server.
15
17
  */
16
- export declare function start(nodeOptions: INodeOptions | undefined, nodeEngineConfig: INodeEngineConfig, envVars: INodeEnvironmentVariables, availableContextIdKeys?: {
18
+ export declare function start(nodeOptions: INodeOptions | undefined, nodeEngineConfig: INodeEngineConfig, envVars: INodeEnvironmentVariables, cliCommand?: ICliCommand, availableContextIdKeys?: {
17
19
  key: string;
18
- componentFeatures: string[];
20
+ requiredHandlerFeatures: string[];
19
21
  }[]): Promise<{
20
22
  engine: Engine<IEngineServerConfig, INodeEngineState>;
21
23
  server: EngineServer;
@@ -1,11 +1,10 @@
1
1
  import type { IModuleProtocol } from "./models/IModuleProtocol.js";
2
- import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables.js";
3
2
  import type { IProtocolHandlerResult } from "./models/IProtocolHandlerResult.js";
4
3
  import { ModuleProtocol } from "./models/moduleProtocol.js";
5
- import { NodeFeatures } from "./models/nodeFeatures.js";
6
4
  /**
7
5
  * Initialise the locales for the application.
8
6
  * @param localesDirectory The directory containing the locales.
7
+ * @returns A promise that resolves when the locale dictionary has been loaded.
9
8
  */
10
9
  export declare function initialiseLocales(localesDirectory: string): Promise<void>;
11
10
  /**
@@ -13,6 +12,12 @@ export declare function initialiseLocales(localesDirectory: string): Promise<voi
13
12
  * @returns The execution directory.
14
13
  */
15
14
  export declare function getExecutionDirectory(): string;
15
+ /**
16
+ * Get the directory where the script is located.
17
+ * @param args The command line arguments.
18
+ * @returns The directory containing the entry-point script, or the current working directory if not determinable.
19
+ */
20
+ export declare function getScriptDirectory(args?: string[]): string;
16
21
  /**
17
22
  * Does the specified file exist.
18
23
  * @param filename The filename to check for existence.
@@ -40,21 +45,15 @@ export declare function getFiles(directory: string): Promise<string[]>;
40
45
  /**
41
46
  * Load the text file.
42
47
  * @param filename The filename of the text file to load.
43
- * @returns The contents of the text file if it could not be loaded.
48
+ * @returns The contents of the text file as a UTF-8 string.
44
49
  */
45
50
  export declare function loadTextFile(filename: string): Promise<string>;
46
51
  /**
47
52
  * Load the JSON file.
48
53
  * @param filename The filename of the JSON file to load.
49
- * @returns The contents of the JSON file or null if it could not be loaded.
54
+ * @returns The parsed JSON content of the file.
50
55
  */
51
56
  export declare function loadJsonFile<T>(filename: string): Promise<T>;
52
- /**
53
- * Get the features that are enabled on the node.
54
- * @param env The environment variables for the node.
55
- * @returns The features that are enabled on the node.
56
- */
57
- export declare function getFeatures(env: INodeEnvironmentVariables): NodeFeatures[];
58
57
  /**
59
58
  * Parse the protocol from a module name.
60
59
  * @param moduleName The module name to parse.