@hypequery/protocol 0.2.0 → 0.2.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/deployments/validate.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,uBAAuB,EASvB,0BAA0B,EAE1B,yBAAyB,EAK1B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/deployments/validate.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,uBAAuB,EASvB,0BAA0B,EAE1B,yBAAyB,EAK1B,MAAM,YAAY,CAAC;AAsfpB,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,uBAAuB,CAEzB;AAoKD,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,0BAA0B,CAgC5B"}
|
|
@@ -333,6 +333,15 @@ function validateMetric(input, path, limits) {
|
|
|
333
333
|
if ((value.kind === 'grained-metric') !== (value.grain !== undefined)) {
|
|
334
334
|
deploymentError('HQ_DEPLOYMENT_INVALID_VALUE', `${path}.grain`);
|
|
335
335
|
}
|
|
336
|
+
const grain = value.grain === undefined
|
|
337
|
+
? undefined
|
|
338
|
+
: parseGrain(value.grain, `${path}.grain`);
|
|
339
|
+
if (grain !== undefined && grains.length === 0) {
|
|
340
|
+
deploymentError('HQ_DEPLOYMENT_INVALID_VALUE', `${path}.grains`);
|
|
341
|
+
}
|
|
342
|
+
if (grain !== undefined && !grains.includes(grain)) {
|
|
343
|
+
deploymentError('HQ_DEPLOYMENT_INVALID_VALUE', `${path}.grain`);
|
|
344
|
+
}
|
|
336
345
|
const result = {
|
|
337
346
|
name: identifier(value.name, `${path}.name`),
|
|
338
347
|
kind: value.kind,
|
|
@@ -342,8 +351,8 @@ function validateMetric(input, path, limits) {
|
|
|
342
351
|
grains,
|
|
343
352
|
endpoint: validateEndpoint(value.endpoint, `${path}.endpoint`, limits),
|
|
344
353
|
};
|
|
345
|
-
if (
|
|
346
|
-
result.grain =
|
|
354
|
+
if (grain !== undefined)
|
|
355
|
+
result.grain = grain;
|
|
347
356
|
optionalText(value.label, 'label', result, path, limits);
|
|
348
357
|
optionalText(value.description, 'description', result, path, limits);
|
|
349
358
|
return freezeRecord(result);
|
|
@@ -440,7 +449,8 @@ function validateReferences(contract) {
|
|
|
440
449
|
|| metric.filters.some(filter => !filters.has(filter))) {
|
|
441
450
|
deploymentError('HQ_DEPLOYMENT_INVALID_REFERENCE', `$.datasets[${datasetIndex}].metrics[${metricIndex}]`);
|
|
442
451
|
}
|
|
443
|
-
if (metric.grains.length > 0
|
|
452
|
+
if ((metric.kind === 'grained-metric' || metric.grains.length > 0)
|
|
453
|
+
&& dataset.timeField === undefined) {
|
|
444
454
|
deploymentError('HQ_DEPLOYMENT_INVALID_REFERENCE', `$.datasets[${datasetIndex}].metrics[${metricIndex}].grains`);
|
|
445
455
|
}
|
|
446
456
|
if (dataset.tenant.kind === 'required' && metric.endpoint.tenant.kind !== 'required') {
|