@twin.org/node-core 0.9.1-next.1 → 0.9.1-next.11

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 (62) hide show
  1. package/dist/es/builders/engineEnvBuilder.js +52 -7
  2. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  3. package/dist/es/cli.js +41 -12
  4. package/dist/es/cli.js.map +1 -1
  5. package/dist/es/commands/bootstrapLegacy.js +1 -1
  6. package/dist/es/commands/bootstrapLegacy.js.map +1 -1
  7. package/dist/es/commands/help.js +10 -1
  8. package/dist/es/commands/help.js.map +1 -1
  9. package/dist/es/commands/identityCreate.js +3 -3
  10. package/dist/es/commands/identityCreate.js.map +1 -1
  11. package/dist/es/commands/identityList.js +65 -0
  12. package/dist/es/commands/identityList.js.map +1 -0
  13. package/dist/es/commands/identityResolve.js +83 -0
  14. package/dist/es/commands/identityResolve.js.map +1 -0
  15. package/dist/es/commands/nodeIdentityGet.js +68 -0
  16. package/dist/es/commands/nodeIdentityGet.js.map +1 -0
  17. package/dist/es/commands/{nodeSetIdentity.js → nodeIdentitySet.js} +16 -15
  18. package/dist/es/commands/nodeIdentitySet.js.map +1 -0
  19. package/dist/es/commands/nodeOrgIdGet.js +55 -0
  20. package/dist/es/commands/nodeOrgIdGet.js.map +1 -0
  21. package/dist/es/commands/{setNodeOrgId.js → nodeOrgIdSet.js} +15 -13
  22. package/dist/es/commands/nodeOrgIdSet.js.map +1 -0
  23. package/dist/es/commands/orgUsersList.js +94 -0
  24. package/dist/es/commands/orgUsersList.js.map +1 -0
  25. package/dist/es/commands/tenantGet.js +68 -0
  26. package/dist/es/commands/tenantGet.js.map +1 -0
  27. package/dist/es/commands/tenantList.js +69 -0
  28. package/dist/es/commands/tenantList.js.map +1 -0
  29. package/dist/es/commands/tenantListByOrg.js +80 -0
  30. package/dist/es/commands/tenantListByOrg.js.map +1 -0
  31. package/dist/es/commands/{setTenantOrgId.js → tenantOrgIdSet.js} +16 -15
  32. package/dist/es/commands/tenantOrgIdSet.js.map +1 -0
  33. package/dist/es/commands/userGet.js +77 -0
  34. package/dist/es/commands/userGet.js.map +1 -0
  35. package/dist/es/models/ICliCommandDefinition.js.map +1 -1
  36. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  37. package/dist/es/models/engineEnvironmentVariableKeys.js +13 -0
  38. package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -1
  39. package/dist/es/node.js +4 -35
  40. package/dist/es/node.js.map +1 -1
  41. package/dist/types/commands/identityList.d.ts +17 -0
  42. package/dist/types/commands/identityResolve.d.ts +24 -0
  43. package/dist/types/commands/nodeIdentityGet.d.ts +20 -0
  44. package/dist/types/commands/{nodeSetIdentity.d.ts → nodeIdentitySet.d.ts} +2 -2
  45. package/dist/types/commands/nodeOrgIdGet.d.ts +19 -0
  46. package/dist/types/commands/{setNodeOrgId.d.ts → nodeOrgIdSet.d.ts} +2 -2
  47. package/dist/types/commands/orgUsersList.d.ts +27 -0
  48. package/dist/types/commands/tenantGet.d.ts +22 -0
  49. package/dist/types/commands/tenantList.d.ts +22 -0
  50. package/dist/types/commands/tenantListByOrg.d.ts +22 -0
  51. package/dist/types/commands/{setTenantOrgId.d.ts → tenantOrgIdSet.d.ts} +2 -2
  52. package/dist/types/commands/userGet.d.ts +24 -0
  53. package/dist/types/models/ICliCommandDefinition.d.ts +8 -0
  54. package/dist/types/models/IEngineEnvironmentVariables.d.ts +73 -5
  55. package/docs/changelog.md +72 -0
  56. package/docs/reference/interfaces/ICliCommandDefinition.md +16 -0
  57. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +145 -5
  58. package/locales/en.json +229 -14
  59. package/package.json +2 -3
  60. package/dist/es/commands/nodeSetIdentity.js.map +0 -1
  61. package/dist/es/commands/setNodeOrgId.js.map +0 -1
  62. package/dist/es/commands/setTenantOrgId.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import path from "node:path";
4
4
  import { Coerce, Is, Mutex } from "@twin.org/core";
5
- import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TrustComponentType, TrustVerifierComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
5
+ import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SchemaVersionMigrationComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TrustComponentType, TrustVerifierComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
6
6
  import { OpenTelemetryExporterTypes } from "@twin.org/logging-connector-opentelemetry";
7
7
  import { OpenTelemetryReaderTypes } from "@twin.org/telemetry-connector-opentelemetry";
8
8
  import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
@@ -28,6 +28,7 @@ export async function buildEngineConfiguration(envVars) {
28
28
  if (!Is.empty(mutexTimeoutMs)) {
29
29
  Mutex.setDefaultTimeoutMs(mutexTimeoutMs);
30
30
  }
31
+ await configureSchemaMigration(coreConfig, envVars);
31
32
  await configurePlatform(coreConfig, envVars);
32
33
  await configureTenant(coreConfig, envVars);
33
34
  await configureContextIdHandlers(coreConfig, envVars);
@@ -343,6 +344,10 @@ async function configureLogging(coreConfig, envVars) {
343
344
  config: {
344
345
  batchSize: Coerce.integer(envVars.loggingBatchSize),
345
346
  batchIntervalMs: (Coerce.integer(envVars.loggingBatchFlushInterval) ?? 5) * 1000,
347
+ retainForMs: Coerce.integer(envVars.loggingRetainForMs),
348
+ maxEntries: Coerce.integer(envVars.loggingMaxEntries),
349
+ retentionIntervalMs: Coerce.integer(envVars.loggingRetentionIntervalMs),
350
+ retentionBatchSize: Coerce.integer(envVars.loggingRetentionBatchSize),
346
351
  mutexTimeoutMs: Coerce.integer(envVars.loggingMutexTimeout)
347
352
  }
348
353
  }
@@ -372,6 +377,21 @@ async function configureLogging(coreConfig, envVars) {
372
377
  });
373
378
  additionalConnectorCount++;
374
379
  }
380
+ else if (loggingConnector === LoggingConnectorType.File) {
381
+ coreConfig.types.loggingConnector.push({
382
+ type: LoggingConnectorType.File,
383
+ options: {
384
+ config: {
385
+ directory: envVars.loggingFileDirectory ?? envVars.storageFileRoot ?? "",
386
+ filename: envVars.loggingFileFilename,
387
+ maxFileSizeBytes: Coerce.integer(envVars.loggingFileMaxFileSizeBytes),
388
+ maxRetainedFiles: Coerce.integer(envVars.loggingFileMaxRetainedFiles),
389
+ mutexTimeoutMs: Coerce.integer(envVars.loggingMutexTimeout)
390
+ }
391
+ }
392
+ });
393
+ additionalConnectorCount++;
394
+ }
375
395
  }
376
396
  // If more than one logging connector, then we need to add a multi connector
377
397
  // and set it as the default one
@@ -510,7 +530,8 @@ async function configureMetricsCollector(coreConfig, envVars) {
510
530
  coreConfig.types.metricsCollectorComponent ??= [];
511
531
  coreConfig.types.metricsCollectorComponent.push({
512
532
  type: MetricsCollectorComponentType.Service,
513
- options: { config: { intervalMs: intervalSec * 1000 } }
533
+ options: { config: { intervalMs: intervalSec * 1000 } },
534
+ isCloneable: false
514
535
  });
515
536
  const maxHistory = Coerce.integer(envVars.telemetryMetricsProducerMaxHistory) ?? 1440;
516
537
  coreConfig.types.metricsProducerComponent ??= [];
@@ -519,7 +540,8 @@ async function configureMetricsCollector(coreConfig, envVars) {
519
540
  for (const producerType of metricsProducers) {
520
541
  coreConfig.types.metricsProducerComponent.push({
521
542
  type: producerType,
522
- options: { maxHistory }
543
+ options: { maxHistory },
544
+ isCloneable: false
523
545
  });
524
546
  }
525
547
  }
@@ -564,7 +586,24 @@ async function configureHealth(coreConfig, envVars) {
564
586
  healthCheckInterval: (Coerce.integer(envVars.healthInterval) ?? 60) * 1000,
565
587
  initialInterval: (Coerce.integer(envVars.healthStartupInterval) ?? 2) * 1000
566
588
  }
567
- }
589
+ },
590
+ isCloneable: false
591
+ });
592
+ }
593
+ }
594
+ /**
595
+ * Configures the schema migration.
596
+ * @param coreConfig The core config.
597
+ * @param envVars The environment variables.
598
+ * @returns A promise that resolves when the schema migration configuration has been applied.
599
+ */
600
+ async function configureSchemaMigration(coreConfig, envVars) {
601
+ const isSchemaMigrationEnabled = Coerce.boolean(envVars.schemaMigrationEnabled) ?? true;
602
+ if (isSchemaMigrationEnabled) {
603
+ coreConfig.types.schemaVersionMigrationComponent ??= [];
604
+ coreConfig.types.schemaVersionMigrationComponent.push({
605
+ type: SchemaVersionMigrationComponentType.Service,
606
+ isCloneable: false
568
607
  });
569
608
  }
570
609
  }
@@ -858,7 +897,8 @@ async function configureIdentity(coreConfig, envVars) {
858
897
  identityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)
859
898
  ? envVars.iotaIdentityPackageId
860
899
  : undefined,
861
- walletAddressIndex: Coerce.integer(envVars.identityWalletAddressIndex) ?? 0
900
+ walletAddressIndex: Coerce.integer(envVars.identityWalletAddressIndex) ?? 0,
901
+ didResolutionCacheTtlMs: Coerce.integer(envVars.identityDidResolutionCacheTtlMs)
862
902
  }
863
903
  }
864
904
  });
@@ -1235,7 +1275,8 @@ async function configureFederatedCatalogue(coreConfig, envVars) {
1235
1275
  coreConfig.types.federatedCatalogueComponent.push({
1236
1276
  type: FederatedCatalogueComponentType.RestClient,
1237
1277
  options: {
1238
- endpoint: envVars.federatedCatalogueRemoteEndpoint
1278
+ endpoint: envVars.federatedCatalogueRemoteEndpoint,
1279
+ pathPrefix: envVars.federatedCatalogueRestClientPathPrefix ?? "federated-catalogue"
1239
1280
  }
1240
1281
  });
1241
1282
  }
@@ -1286,6 +1327,8 @@ async function configureDataspace(coreConfig, envVars) {
1286
1327
  // Must match the control-plane REST mount, as it is combined with the public origin
1287
1328
  // to build the consumer's advertised callback address;
1288
1329
  callbackPath: envVars.dataspaceCallbackPath ?? "dataspace-control-plane",
1330
+ // Base mount path of the data plane only; the transfer handlers append the
1331
+ // sub-paths themselves (`/entities` for PULL, `/inbox` for PUSH).
1289
1332
  dataPlanePath: envVars.dataspaceDataPlanePath,
1290
1333
  autoStartTransfers: Coerce.boolean(envVars.dataspaceAutoStartTransfers),
1291
1334
  stalledNegotiationTimeoutMs: !Is.empty(stalledNegotiationTimeout)
@@ -1343,7 +1386,9 @@ async function configureDlt(coreConfig, envVars) {
1343
1386
  },
1344
1387
  network: envVars.iotaNetwork ?? "",
1345
1388
  coinType: Coerce.integer(envVars.iotaCoinType),
1346
- gasStation: gasStationConfig
1389
+ gasStation: gasStationConfig,
1390
+ gasBudget: Coerce.integer(envVars.iotaGasBudget),
1391
+ gasReservationDuration: Coerce.integer(envVars.iotaGasReservationDuration)
1347
1392
  }
1348
1393
  }
1349
1394
  });