@qrvey/cd-package-registry 1.0.1-beta → 1.0.2-955

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
@@ -181,6 +181,24 @@ _ts_decorate([
181
181
  classValidator.MaxLength(255),
182
182
  _ts_metadata("design:type", String)
183
183
  ], ApplicationAssetDto.prototype, "userEmail", void 0);
184
+ function IsAny(validationOptions) {
185
+ return function(object, propertyName) {
186
+ classValidator.registerDecorator({
187
+ name: "isAny",
188
+ target: object.constructor,
189
+ propertyName,
190
+ options: validationOptions,
191
+ validator: {
192
+ validate(value) {
193
+ return true;
194
+ }
195
+ }
196
+ });
197
+ };
198
+ }
199
+ __name(IsAny, "IsAny");
200
+
201
+ // src/dtos/connection-asset.dto.ts
184
202
  function _ts_decorate2(decorators, target, key, desc) {
185
203
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
186
204
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -419,7 +437,7 @@ _ts_decorate2([
419
437
  ], ConnectionAssetDto.prototype, "useSSL", void 0);
420
438
  _ts_decorate2([
421
439
  classValidator.IsOptional(),
422
- classValidator.IsObject(),
440
+ IsAny(),
423
441
  _ts_metadata2("design:type", Object)
424
442
  ], ConnectionAssetDto.prototype, "connectionConfig", void 0);
425
443
  _ts_decorate2([
@@ -4802,6 +4820,62 @@ var _DashboardContentElementDependencyValidatorService = class _DashboardContent
4802
4820
  __name(_DashboardContentElementDependencyValidatorService, "DashboardContentElementDependencyValidatorService");
4803
4821
  var DashboardContentElementDependencyValidatorService = _DashboardContentElementDependencyValidatorService;
4804
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
+
4805
4879
  // src/services/chart-validator.service.ts
4806
4880
  var _ChartValidatorService = class _ChartValidatorService extends BaseAssetWithDependenciesService {
4807
4881
  constructor(params, options) {
@@ -5006,7 +5080,12 @@ var _PageFlowValidatorService = class _PageFlowValidatorService extends BaseAsse
5006
5080
  __name(_PageFlowValidatorService, "PageFlowValidatorService");
5007
5081
  __publicField(_PageFlowValidatorService, "_logger", new telemetry.LoggerService(_PageFlowValidatorService.name));
5008
5082
  var PageFlowValidatorService = _PageFlowValidatorService;
5009
- 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
+ }
5010
5089
  get idKey() {
5011
5090
  return "workflowid";
5012
5091
  }