@qrvey/cd-package-registry 1.0.2-935 → 1.0.3-1000

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/dist/cjs/index.js CHANGED
@@ -4820,6 +4820,62 @@ var _DashboardContentElementDependencyValidatorService = class _DashboardContent
4820
4820
  __name(_DashboardContentElementDependencyValidatorService, "DashboardContentElementDependencyValidatorService");
4821
4821
  var DashboardContentElementDependencyValidatorService = _DashboardContentElementDependencyValidatorService;
4822
4822
 
4823
+ // src/services/dependency-validators/automation.dependency-validator.ts
4824
+ var _AutomationDependencyValidatorService = class _AutomationDependencyValidatorService {
4825
+ constructor(params, options) {
4826
+ __publicField(this, "params");
4827
+ __publicField(this, "options");
4828
+ this.params = params;
4829
+ this.options = options;
4830
+ }
4831
+ getDependencyKeys(input) {
4832
+ var _a3;
4833
+ const keys = Object.keys((_a3 = input.datasets) != null ? _a3 : {}).map((datasetId) => ({
4834
+ qrveyId: datasetId
4835
+ }));
4836
+ return {
4837
+ keys
4838
+ };
4839
+ }
4840
+ async fetchDependencies(keys) {
4841
+ const args = uniqueBy(keys != null ? keys : [], "qrveyId");
4842
+ const qrveys = await this.fetchQrveysByIds(args);
4843
+ const qrveyMap = new Map(qrveys.map((q) => [
4844
+ q.qrveyid,
4845
+ q
4846
+ ]));
4847
+ return {
4848
+ qrveys: qrveyMap
4849
+ };
4850
+ }
4851
+ validateWithContext(input, context) {
4852
+ var _a3;
4853
+ const errors = [];
4854
+ for (const datasetId of Object.keys((_a3 = input.datasets) != null ? _a3 : {})) {
4855
+ const qrvey = context.qrveys.get(datasetId);
4856
+ if (!qrvey) {
4857
+ errors.push({
4858
+ field: "qrveyId",
4859
+ message: `The workflow ${input.workflowid} references a dataset that does not exist or is inaccessible. Dataset ID: ${datasetId}`,
4860
+ value: input
4861
+ });
4862
+ }
4863
+ }
4864
+ return errors;
4865
+ }
4866
+ //#region Private methods
4867
+ async fetchQrveysByIds(args) {
4868
+ const result = await Promise.allSettled(args.map(({ qrveyId }) => QrveyFetchClient.get({
4869
+ appId: this.params.appId,
4870
+ userId: this.params.userId,
4871
+ qrveyId
4872
+ }, this.options)));
4873
+ return result.filter((res) => res.status === "fulfilled").map((res) => res.value);
4874
+ }
4875
+ };
4876
+ __name(_AutomationDependencyValidatorService, "AutomationDependencyValidatorService");
4877
+ var AutomationDependencyValidatorService = _AutomationDependencyValidatorService;
4878
+
4823
4879
  // src/services/chart-validator.service.ts
4824
4880
  var _ChartValidatorService = class _ChartValidatorService extends BaseAssetWithDependenciesService {
4825
4881
  constructor(params, options) {
@@ -5024,7 +5080,12 @@ var _PageFlowValidatorService = class _PageFlowValidatorService extends BaseAsse
5024
5080
  __name(_PageFlowValidatorService, "PageFlowValidatorService");
5025
5081
  __publicField(_PageFlowValidatorService, "_logger", new telemetry.LoggerService(_PageFlowValidatorService.name));
5026
5082
  var PageFlowValidatorService = _PageFlowValidatorService;
5027
- var _AutomationValidatorService = class _AutomationValidatorService extends BaseAssetService {
5083
+ var _AutomationValidatorService = class _AutomationValidatorService extends BaseAssetWithDependenciesService {
5084
+ constructor(params, options) {
5085
+ super();
5086
+ __publicField(this, "dependencyValidator");
5087
+ this.dependencyValidator = new AutomationDependencyValidatorService(params, options);
5088
+ }
5028
5089
  get idKey() {
5029
5090
  return "workflowid";
5030
5091
  }