@meshmakers/octo-services 3.4.1050 → 3.4.1080

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 CHANGED
@@ -22,7 +22,7 @@ npm run build:octo-services
22
22
  npm run lint:octo-services
23
23
 
24
24
  # Run tests
25
- npm test -- --project=@meshmakers/octo-services --watch=false
25
+ npm run test:octo-services
26
26
  ```
27
27
 
28
28
  ## Architecture
@@ -4507,19 +4507,23 @@ class AssetRepoService {
4507
4507
  }
4508
4508
  }
4509
4509
  /**
4510
- * Reads the tenant-level Stream Data status. `tenantEnabled` reflects the
4511
- * tenant flag that `enableStreamData` / `disableStreamData` switch unlike
4512
- * the presence of the `System.StreamData` CK model, which a disable keeps
4513
- * (AB#4255). Returns `null` when the asset service is not configured.
4514
- * Errors propagate to the caller.
4510
+ * Reads the aggregate tenant feature status: the enabled flags of Stream
4511
+ * Data, Communication, Reporting and AI Servicesthe same flags the tenant
4512
+ * delete/detach guard evaluates (AB#4255), so the Tenant Features panel and
4513
+ * the guard never disagree (AB#4884). CK model presence is deliberately not
4514
+ * the source (a disable keeps the model). Whether a service is installed at
4515
+ * all comes from the `_configuration` document (empty URL = not installed),
4516
+ * except Stream Data's `instanceEnabled` flag, which is part of the status.
4517
+ * Returns `null` when the asset service is not configured. Errors propagate
4518
+ * to the caller.
4515
4519
  *
4516
- * Tenant-scoped REST endpoint: `GET {assetServices}{tenantId}/v1/streamdata/status`.
4520
+ * Tenant-scoped REST endpoint: `GET {assetServices}{tenantId}/v1/features/status`.
4517
4521
  */
4518
- async getStreamDataStatus(tenantId) {
4522
+ async getTenantFeaturesStatus(tenantId) {
4519
4523
  if (!this.configurationService.config?.assetServices) {
4520
4524
  return null;
4521
4525
  }
4522
- const uri = `${this.configurationService.config.assetServices}${tenantId}/v1/streamdata/status`;
4526
+ const uri = `${this.configurationService.config.assetServices}${tenantId}/v1/features/status`;
4523
4527
  return await firstValueFrom(this.httpClient.get(uri));
4524
4528
  }
4525
4529
  async importRtModel(tenantId, file, importStrategy = ImportStrategyDto.InsertOnly) {
@@ -4527,7 +4531,7 @@ class AssetRepoService {
4527
4531
  .set('importStrategy', importStrategy.toString());
4528
4532
  if (this.configurationService.config?.assetServices) {
4529
4533
  const formData = new FormData();
4530
- formData.append("file", file);
4534
+ formData.append('file', file);
4531
4535
  const r = await firstValueFrom(this.httpClient.post(this.configurationService.config.assetServices + tenantId + '/v1/Models/ImportRt', formData, {
4532
4536
  params,
4533
4537
  observe: 'response'
@@ -4541,7 +4545,7 @@ class AssetRepoService {
4541
4545
  .set('importStrategy', importStrategy.toString());
4542
4546
  if (this.configurationService.config?.assetServices) {
4543
4547
  const formData = new FormData();
4544
- formData.append("file", file);
4548
+ formData.append('file', file);
4545
4549
  const r = await firstValueFrom(this.httpClient.post(this.configurationService.config.assetServices + tenantId + '/v1/Models/ImportCk', formData, {
4546
4550
  params,
4547
4551
  observe: 'response'
@@ -4774,7 +4778,7 @@ class HealthService {
4774
4778
  return error.error;
4775
4779
  }
4776
4780
  }
4777
- console.error("error", error);
4781
+ console.error('error', error);
4778
4782
  }
4779
4783
  return null;
4780
4784
  }
@@ -6146,6 +6150,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
6146
6150
  }]
6147
6151
  }] });
6148
6152
 
6153
+ /**
6154
+ * Service for the tenant AI Services feature toggle (AB#4884).
6155
+ *
6156
+ * Backed by the AI service base URL (`config.aiServices`), it enables/disables
6157
+ * the AI Services feature per tenant via the tenant-scoped REST endpoints
6158
+ * `POST {aiServices}{tenantId}/v1/aiservice/{enable,disable}`. An empty
6159
+ * `aiServices` URL means the AI service is not part of this installation —
6160
+ * both methods throw before any HTTP call then.
6161
+ */
6162
+ class AiService {
6163
+ httpClient = inject(HttpClient);
6164
+ configurationService = inject(CONFIGURATION_SERVICE);
6165
+ /**
6166
+ * Gets the base URL for the AI service.
6167
+ */
6168
+ get aiServicesUrl() {
6169
+ return this.configurationService.config?.aiServices;
6170
+ }
6171
+ /**
6172
+ * Enables the AI Services feature for a tenant. Provisions the `System.Ai`
6173
+ * CK model and the default AI configuration. Refused with HTTP 409 while
6174
+ * Communication is disabled for the tenant (the AI worker is deployed
6175
+ * through Communication). Errors propagate to the caller.
6176
+ */
6177
+ async enableAi(tenantId) {
6178
+ if (!this.aiServicesUrl) {
6179
+ throw new Error('AI services URL is not configured');
6180
+ }
6181
+ const uri = `${this.aiServicesUrl}${tenantId}/v1/aiservice/enable`;
6182
+ await firstValueFrom(this.httpClient.post(uri, null, { observe: 'response' }));
6183
+ }
6184
+ /**
6185
+ * Disables the AI Services feature for a tenant. Reversible flag flip: AI
6186
+ * configuration and session data stay in the tenant and are accessible again
6187
+ * after `enableAi`. Precondition for tenant delete/detach (AB#4255). The UI
6188
+ * must confirm before calling. Errors propagate to the caller.
6189
+ */
6190
+ async disableAi(tenantId) {
6191
+ if (!this.aiServicesUrl) {
6192
+ throw new Error('AI services URL is not configured');
6193
+ }
6194
+ const uri = `${this.aiServicesUrl}${tenantId}/v1/aiservice/disable`;
6195
+ await firstValueFrom(this.httpClient.post(uri, null, { observe: 'response' }));
6196
+ }
6197
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6198
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AiService, providedIn: 'root' });
6199
+ }
6200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AiService, decorators: [{
6201
+ type: Injectable,
6202
+ args: [{
6203
+ providedIn: 'root'
6204
+ }]
6205
+ }] });
6206
+
6149
6207
  class TusUploadService {
6150
6208
  httpClient = inject(HttpClient);
6151
6209
  configurationService = inject(CONFIGURATION_SERVICE);
@@ -6796,5 +6854,5 @@ function provideOctoServices(octoServiceOptions) {
6796
6854
  * Generated bundle index. Do not edit.
6797
6855
  */
6798
6856
 
6799
- export { AggregationInputTypesDto, AggregationTypeDto, AggregationTypesDto, ArchiveStorageHealthDto, AssetRepoGraphQlDataSource, AssetRepoService, AssociationModOptionsDto, AttributeSelectorService, AttributeValueTypeDto, BasicEnergyCarrierTypeDto, BasicEnergyDataQualityDto, BasicEnergyFacilityTypeDto, BasicEnergyProductionTypeDto, BasicEnergyStateDto, BasicLegalEntityTypeDto, BasicSalutationDto, BasicTypeOfTelephoneBasicDto, BasicTypeOfTelephoneEnhancedDto, BasicUnitOfMeasureDto, BlueprintConflictResolutionDto, BlueprintUpdateModeDto, BotService, BucketAlignmentInputDto, CONFIGURATION_SERVICE, CkExtensionUpdateOperationsDto, CkModelCatalogService, CkModelService, CkRollupFunctionDto, CkTypeAttributeService, CkTypeMetaData, CkTypeSelectorService, CommunicationService, DeleteStrategiesDto, DeploymentState, EnergyCommunityBillingCycleDto, EnergyCommunityBillingDocumentStateDto, EnergyCommunityBillingTypeDto, EnergyCommunityDataQualityDto, EnergyCommunityFacilityTypeDto, EnergyCommunityProductionTypeDto, EnergyCommunityStateDto, EnergyCommunityTaxProcedureCreditNoteDto, EnvironmentCarbonScopeDto, EnvironmentComplianceCategoryDto, EnvironmentComplianceStatusDto, EnvironmentEnergySourceDto, EnvironmentGoalStateDto, FieldFilterOperatorsDto, FormulaResultTypeDto, GetCkModelByIdDocumentDto, GetCkModelByIdDtoGQL, GetCkRecordAttributesDocumentDto, GetCkRecordAttributesDtoGQL, GetCkTypeAttributesDocumentDto, GetCkTypeAttributesDtoGQL, GetCkTypeAvailableQueryColumnsDocumentDto, GetCkTypeAvailableQueryColumnsDtoGQL, GetCkTypesDocumentDto, GetCkTypesDtoGQL, GetDerivedCkTypesDocumentDto, GetDerivedCkTypesDtoGQL, GetEntitiesByCkTypeDocumentDto, GetEntitiesByCkTypeDtoGQL, GraphDirectionDto, GraphQL, GraphQLCloneIgnoredProperties, GraphQLCommonIgnoredProperties, GraphQlDataSource, HealthService, HealthStatus, IDENTITY_PROVIDER_TYPE_LABELS, IdentityProviderType, IdentityService, ImportStrategyDto, IndustryBasicAlarmPriorityDto, IndustryBasicAlarmSourceTypeDto, IndustryBasicAlarmStateDto, IndustryBasicAlarmTypeDto, IndustryBasicIecDataTypeDto, IndustryBasicMachineCapabilitiesDto, IndustryBasicMachineStateDto, IndustryEnergyDemandResponseMarketDto, IndustryEnergyDemandResponseStatusDto, IndustryEnergyTariffTypeDto, IndustryMaintenanceAggregationTypeDto, IndustryMaintenanceCostCategoryDto, IndustryMaintenanceEnergyBalanceGroupDto, IndustryMaintenanceEnergyBalanceProductDto, IndustryMaintenanceEnergyBalanceUnitDto, IndustryMaintenanceOrderPriorityDto, IndustryMaintenanceOrderStateDto, IndustryMaintenanceOrderTypeDto, IndustryMaintenanceServiceTypeDto, IndustryManufacturingFeedbackSyncStateDto, IndustryManufacturingProductionOrderItemStateDto, IndustryManufacturingProductionOrderStateDto, JobManagementService, LevelMetaData, LoggerSeverity, ModelStateDto, MultiplicitiesDto, NavigationFilterModeDto, OctoErrorLink, OctoGraphQLServiceBase, OctoSdkDemoCustomerStatusDto, OctoSdkDemoNetworkOperatorDto, OctoSdkDemoOperatingStatusDto, OctoServiceOptions, OctoServicesModule, PagedGraphResultDto, ProgressValue, ProgressWindowService, QueryModeDto, ReportingService, RtAssociationMetaData, RuntimeEntityDialogDataSource, RuntimeEntitySelectDataSource, SearchFilterTypesDto, SeriesComparisonPolicyDto, SeriesResolutionSignalDto, SortOrdersDto, SystemAggregationTypesDto, SystemAiApprovalModeDto, SystemAiApprovalReasonDto, SystemAiApprovalStatusDto, SystemAiAuthModeDto, SystemAiConflictModeDto, SystemAiCredentialKindDto, SystemAiJobKindDto, SystemAiJobStatusDto, SystemAiKnowledgeKindDto, SystemAiLeaseStatusDto, SystemAiModelTierDto, SystemAiRiskLevelDto, SystemAiSessionEventKindDto, SystemAiSessionStatusDto, SystemAiSubscriptionScopeDto, SystemAiTicketScopeDto, SystemAiTicketStatusDto, SystemAiWorkspaceModeDto, SystemCommunicationCommunicationStateDto, SystemCommunicationConfigurationStateDto, SystemCommunicationDeploymentStateDto, SystemCommunicationEnvironmentDto, SystemCommunicationHelmChannelDto, SystemCommunicationLifecycleModeDto, SystemCommunicationLifecycleStateDto, SystemCommunicationPipelineExecutionStatusDto, SystemCommunicationPipelineTriggerTypeDto, SystemEnvironmentModesDto, SystemFieldFilterOperatorDto, SystemIdentityTokenExpirationDto, SystemIdentityTokenTypeDto, SystemIdentityTokenUsageDto, SystemMaintenanceLevelsDto, SystemNavigationFilterModesDto, SystemNotificationEventLevelsDto, SystemNotificationEventSourcesDto, SystemNotificationEventStatesDto, SystemNotificationNotificationTypesDto, SystemNotificationRenderingTypesDto, SystemQueryTypesDto, SystemSortOrdersDto, SystemStreamDataBucketAlignmentDto, SystemStreamDataCkArchiveStatusDto, SystemStreamDataCkComputedColumnResultTypeDto, SystemStreamDataCkComputedColumnStateDto, SystemStreamDataCkRecomputeChangeKindDto, SystemStreamDataCkRecomputeChangeSourceDto, SystemStreamDataCkRecomputeJobStateDto, SystemStreamDataCkRecomputeTriggerDto, SystemStreamDataCkRollupFunctionDto, TENANT_ID_PROVIDER, TusUploadService, UpdateTypeDto, octoDataIdFromObject, result as possibleTypes, provideOctoServices };
6857
+ export { AggregationInputTypesDto, AggregationTypeDto, AggregationTypesDto, AiService, ArchiveStorageHealthDto, AssetRepoGraphQlDataSource, AssetRepoService, AssociationModOptionsDto, AttributeSelectorService, AttributeValueTypeDto, BasicEnergyCarrierTypeDto, BasicEnergyDataQualityDto, BasicEnergyFacilityTypeDto, BasicEnergyProductionTypeDto, BasicEnergyStateDto, BasicLegalEntityTypeDto, BasicSalutationDto, BasicTypeOfTelephoneBasicDto, BasicTypeOfTelephoneEnhancedDto, BasicUnitOfMeasureDto, BlueprintConflictResolutionDto, BlueprintUpdateModeDto, BotService, BucketAlignmentInputDto, CONFIGURATION_SERVICE, CkExtensionUpdateOperationsDto, CkModelCatalogService, CkModelService, CkRollupFunctionDto, CkTypeAttributeService, CkTypeMetaData, CkTypeSelectorService, CommunicationService, DeleteStrategiesDto, DeploymentState, EnergyCommunityBillingCycleDto, EnergyCommunityBillingDocumentStateDto, EnergyCommunityBillingTypeDto, EnergyCommunityDataQualityDto, EnergyCommunityFacilityTypeDto, EnergyCommunityProductionTypeDto, EnergyCommunityStateDto, EnergyCommunityTaxProcedureCreditNoteDto, EnvironmentCarbonScopeDto, EnvironmentComplianceCategoryDto, EnvironmentComplianceStatusDto, EnvironmentEnergySourceDto, EnvironmentGoalStateDto, FieldFilterOperatorsDto, FormulaResultTypeDto, GetCkModelByIdDocumentDto, GetCkModelByIdDtoGQL, GetCkRecordAttributesDocumentDto, GetCkRecordAttributesDtoGQL, GetCkTypeAttributesDocumentDto, GetCkTypeAttributesDtoGQL, GetCkTypeAvailableQueryColumnsDocumentDto, GetCkTypeAvailableQueryColumnsDtoGQL, GetCkTypesDocumentDto, GetCkTypesDtoGQL, GetDerivedCkTypesDocumentDto, GetDerivedCkTypesDtoGQL, GetEntitiesByCkTypeDocumentDto, GetEntitiesByCkTypeDtoGQL, GraphDirectionDto, GraphQL, GraphQLCloneIgnoredProperties, GraphQLCommonIgnoredProperties, GraphQlDataSource, HealthService, HealthStatus, IDENTITY_PROVIDER_TYPE_LABELS, IdentityProviderType, IdentityService, ImportStrategyDto, IndustryBasicAlarmPriorityDto, IndustryBasicAlarmSourceTypeDto, IndustryBasicAlarmStateDto, IndustryBasicAlarmTypeDto, IndustryBasicIecDataTypeDto, IndustryBasicMachineCapabilitiesDto, IndustryBasicMachineStateDto, IndustryEnergyDemandResponseMarketDto, IndustryEnergyDemandResponseStatusDto, IndustryEnergyTariffTypeDto, IndustryMaintenanceAggregationTypeDto, IndustryMaintenanceCostCategoryDto, IndustryMaintenanceEnergyBalanceGroupDto, IndustryMaintenanceEnergyBalanceProductDto, IndustryMaintenanceEnergyBalanceUnitDto, IndustryMaintenanceOrderPriorityDto, IndustryMaintenanceOrderStateDto, IndustryMaintenanceOrderTypeDto, IndustryMaintenanceServiceTypeDto, IndustryManufacturingFeedbackSyncStateDto, IndustryManufacturingProductionOrderItemStateDto, IndustryManufacturingProductionOrderStateDto, JobManagementService, LevelMetaData, LoggerSeverity, ModelStateDto, MultiplicitiesDto, NavigationFilterModeDto, OctoErrorLink, OctoGraphQLServiceBase, OctoSdkDemoCustomerStatusDto, OctoSdkDemoNetworkOperatorDto, OctoSdkDemoOperatingStatusDto, OctoServiceOptions, OctoServicesModule, PagedGraphResultDto, ProgressValue, ProgressWindowService, QueryModeDto, ReportingService, RtAssociationMetaData, RuntimeEntityDialogDataSource, RuntimeEntitySelectDataSource, SearchFilterTypesDto, SeriesComparisonPolicyDto, SeriesResolutionSignalDto, SortOrdersDto, SystemAggregationTypesDto, SystemAiApprovalModeDto, SystemAiApprovalReasonDto, SystemAiApprovalStatusDto, SystemAiAuthModeDto, SystemAiConflictModeDto, SystemAiCredentialKindDto, SystemAiJobKindDto, SystemAiJobStatusDto, SystemAiKnowledgeKindDto, SystemAiLeaseStatusDto, SystemAiModelTierDto, SystemAiRiskLevelDto, SystemAiSessionEventKindDto, SystemAiSessionStatusDto, SystemAiSubscriptionScopeDto, SystemAiTicketScopeDto, SystemAiTicketStatusDto, SystemAiWorkspaceModeDto, SystemCommunicationCommunicationStateDto, SystemCommunicationConfigurationStateDto, SystemCommunicationDeploymentStateDto, SystemCommunicationEnvironmentDto, SystemCommunicationHelmChannelDto, SystemCommunicationLifecycleModeDto, SystemCommunicationLifecycleStateDto, SystemCommunicationPipelineExecutionStatusDto, SystemCommunicationPipelineTriggerTypeDto, SystemEnvironmentModesDto, SystemFieldFilterOperatorDto, SystemIdentityTokenExpirationDto, SystemIdentityTokenTypeDto, SystemIdentityTokenUsageDto, SystemMaintenanceLevelsDto, SystemNavigationFilterModesDto, SystemNotificationEventLevelsDto, SystemNotificationEventSourcesDto, SystemNotificationEventStatesDto, SystemNotificationNotificationTypesDto, SystemNotificationRenderingTypesDto, SystemQueryTypesDto, SystemSortOrdersDto, SystemStreamDataBucketAlignmentDto, SystemStreamDataCkArchiveStatusDto, SystemStreamDataCkComputedColumnResultTypeDto, SystemStreamDataCkComputedColumnStateDto, SystemStreamDataCkRecomputeChangeKindDto, SystemStreamDataCkRecomputeChangeSourceDto, SystemStreamDataCkRecomputeJobStateDto, SystemStreamDataCkRecomputeTriggerDto, SystemStreamDataCkRollupFunctionDto, TENANT_ID_PROVIDER, TusUploadService, UpdateTypeDto, octoDataIdFromObject, result as possibleTypes, provideOctoServices };
6800
6858
  //# sourceMappingURL=meshmakers-octo-services.mjs.map