@luvio/compiler 0.62.4 → 0.63.3
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/codegen/adapter/adapter-browser-factory.js +5 -5
- package/dist/codegen/adapter/adapter-browser-factory.js.map +1 -1
- package/dist/codegen/adapter/adapter-build-snapshot-context.js +3 -3
- package/dist/codegen/adapter/adapter-build-snapshot-context.js.map +1 -1
- package/dist/codegen/adapter/adapter-cache.js +4 -4
- package/dist/codegen/adapter/adapter-cache.js.map +1 -1
- package/dist/codegen/adapter/adapter-config-coercion.js +4 -4
- package/dist/codegen/adapter/adapter-config-coercion.js.map +1 -1
- package/dist/codegen/adapter/adapter-config-interface.js +3 -3
- package/dist/codegen/adapter/adapter-config-interface.js.map +1 -1
- package/dist/codegen/adapter/adapter-config-validation.js +3 -3
- package/dist/codegen/adapter/adapter-config-validation.js.map +1 -1
- package/dist/codegen/adapter/adapter-fragment.js +2 -2
- package/dist/codegen/adapter/adapter-fragment.js.map +1 -1
- package/dist/codegen/adapter/adapter-key-builder.js +2 -2
- package/dist/codegen/adapter/adapter-key-builder.js.map +1 -1
- package/dist/codegen/adapter/adapter-memory-cache-policy.js +4 -4
- package/dist/codegen/adapter/adapter-memory-cache-policy.js.map +1 -1
- package/dist/codegen/adapter/adapter-name.js +1 -1
- package/dist/codegen/adapter/adapter-name.js.map +1 -1
- package/dist/codegen/adapter/adapter-network-cache-policy.js +2 -2
- package/dist/codegen/adapter/adapter-network-cache-policy.js.map +1 -1
- package/dist/codegen/adapter/adapter-network.js +2 -2
- package/dist/codegen/adapter/adapter-network.js.map +1 -1
- package/dist/codegen/adapter/adapter-notify-change.js +4 -4
- package/dist/codegen/adapter/adapter-notify-change.js.map +1 -1
- package/dist/codegen/adapter/adapter-one-of-params.js +1 -1
- package/dist/codegen/adapter/adapter-one-of-params.js.map +1 -1
- package/dist/codegen/adapter/adapter-param-type-check.js +21 -21
- package/dist/codegen/adapter/adapter-param-type-check.js.map +1 -1
- package/dist/codegen/adapter/adapter-resource-error.js +3 -3
- package/dist/codegen/adapter/adapter-resource-error.js.map +1 -1
- package/dist/codegen/adapter/adapter-resource-success.js +3 -3
- package/dist/codegen/adapter/adapter-resource-success.js.map +1 -1
- package/dist/codegen/adapter/adapter-shape-key-param-coercion.js +5 -5
- package/dist/codegen/adapter/adapter-shape-key-param-coercion.js.map +1 -1
- package/dist/codegen/adapter/adapter-type-check.js +4 -4
- package/dist/codegen/adapter/adapter-type-check.js.map +1 -1
- package/dist/codegen/adapter/adapter-validation-config-object.js +2 -2
- package/dist/codegen/adapter/adapter-validation-config-object.js.map +1 -1
- package/dist/codegen/adapter/constants.js +43 -42
- package/dist/codegen/adapter/constants.js.map +1 -1
- package/dist/codegen/adapter/create-resource-params.js +7 -7
- package/dist/codegen/adapter/create-resource-params.js.map +1 -1
- package/dist/codegen/adapter/delete/adapter-browser-factory.js +5 -5
- package/dist/codegen/adapter/delete/adapter-browser-factory.js.map +1 -1
- package/dist/codegen/adapter/delete/adapter-network.js +2 -2
- package/dist/codegen/adapter/delete/adapter-network.js.map +1 -1
- package/dist/codegen/adapter/index.js +56 -56
- package/dist/codegen/adapter/index.js.map +1 -1
- package/dist/codegen/adapter/patch-post/adapter-browser-factory.js +4 -4
- package/dist/codegen/adapter/patch-post/adapter-browser-factory.js.map +1 -1
- package/dist/codegen/adapter/patch-post/adapter-network.js +2 -2
- package/dist/codegen/adapter/patch-post/adapter-network.js.map +1 -1
- package/dist/codegen/adapter/util.js +1 -1
- package/dist/codegen/adapter/util.js.map +1 -1
- package/dist/codegen/adapter-tests/expected-responses.js +10 -10
- package/dist/codegen/adapter-tests/expected-responses.js.map +1 -1
- package/dist/codegen/adapter-tests/index.js +8 -8
- package/dist/codegen/adapter-tests/index.js.map +1 -1
- package/dist/codegen/adapter-tests/invalid-configs.js +3 -3
- package/dist/codegen/adapter-tests/invalid-configs.js.map +1 -1
- package/dist/codegen/adapter-tests/mock-payloads.js +5 -5
- package/dist/codegen/adapter-tests/mock-payloads.js.map +1 -1
- package/dist/codegen/adapter-tests/valid-configs.js +3 -3
- package/dist/codegen/adapter-tests/valid-configs.js.map +1 -1
- package/dist/codegen/adapter-utils.js +15 -15
- package/dist/codegen/adapter-utils.js.map +1 -1
- package/dist/codegen/pagination-utils/cursor-based.js +9 -9
- package/dist/codegen/pagination-utils/cursor-based.js.map +1 -1
- package/dist/codegen/resource/composite/child-envelopes.js +1 -1
- package/dist/codegen/resource/composite/child-envelopes.js.map +1 -1
- package/dist/codegen/resource/composite/create-child-resource-params.js +3 -3
- package/dist/codegen/resource/composite/create-child-resource-params.js.map +1 -1
- package/dist/codegen/resource/composite/ingest-success-child-resource-params.js +1 -1
- package/dist/codegen/resource/composite/ingest-success-child-resource-params.js.map +1 -1
- package/dist/codegen/resource/composite/ingest-success.js +2 -7
- package/dist/codegen/resource/composite/ingest-success.js.map +1 -1
- package/dist/codegen/resource/composite/non-cached-errors-object.js +1 -1
- package/dist/codegen/resource/composite/non-cached-errors-object.js.map +1 -1
- package/dist/codegen/resource/composite/response-child-cache-keys.js +4 -4
- package/dist/codegen/resource/composite/response-child-cache-keys.js.map +1 -1
- package/dist/codegen/resource/composite/select-child-resource-params.js +1 -1
- package/dist/codegen/resource/composite/select-child-resource-params.js.map +1 -1
- package/dist/codegen/resource/composite/select.js +1 -1
- package/dist/codegen/resource/composite/select.js.map +1 -1
- package/dist/codegen/resource/create-resource-request-from-representation.js +1 -1
- package/dist/codegen/resource/create-resource-request-from-representation.js.map +1 -1
- package/dist/codegen/resource/create-resource-request.js +9 -9
- package/dist/codegen/resource/create-resource-request.js.map +1 -1
- package/dist/codegen/resource/evict-success.js +1 -1
- package/dist/codegen/resource/evict-success.js.map +1 -1
- package/dist/codegen/resource/index.js +14 -14
- package/dist/codegen/resource/index.js.map +1 -1
- package/dist/codegen/resource/ingest-error.js +4 -4
- package/dist/codegen/resource/ingest-error.js.map +1 -1
- package/dist/codegen/resource/ingest-success.js +3 -10
- package/dist/codegen/resource/ingest-success.js.map +1 -1
- package/dist/codegen/resource/key-builder.js +11 -11
- package/dist/codegen/resource/key-builder.js.map +1 -1
- package/dist/codegen/resource/pagination/create-pagination-params.js +3 -2
- package/dist/codegen/resource/pagination/create-pagination-params.js.map +1 -1
- package/dist/codegen/resource/pagination/select.js +1 -1
- package/dist/codegen/resource/pagination/select.js.map +1 -1
- package/dist/codegen/resource/resource-params.js +2 -2
- package/dist/codegen/resource/resource-params.js.map +1 -1
- package/dist/codegen/resource/response-cache-keys.js +3 -3
- package/dist/codegen/resource/response-cache-keys.js.map +1 -1
- package/dist/codegen/resource/select.js +5 -5
- package/dist/codegen/resource/select.js.map +1 -1
- package/dist/codegen/shape/constants.js +1 -1
- package/dist/codegen/shape/constants.js.map +1 -1
- package/dist/codegen/shape/index.js +23 -23
- package/dist/codegen/shape/index.js.map +1 -1
- package/dist/codegen/shape/shape-cache-keys.js +22 -22
- package/dist/codegen/shape/shape-cache-keys.js.map +1 -1
- package/dist/codegen/shape/shape-deep-freeze.js +20 -20
- package/dist/codegen/shape/shape-deep-freeze.js.map +1 -1
- package/dist/codegen/shape/shape-discriminator-values-enum.js +5 -5
- package/dist/codegen/shape/shape-discriminator-values-enum.js.map +1 -1
- package/dist/codegen/shape/shape-dynamic-ingest-params.js +2 -2
- package/dist/codegen/shape/shape-dynamic-ingest-params.js.map +1 -1
- package/dist/codegen/shape/shape-dynamic-ingest.js +5 -4
- package/dist/codegen/shape/shape-dynamic-ingest.js.map +1 -1
- package/dist/codegen/shape/shape-dynamic-normalize.js +5 -4
- package/dist/codegen/shape/shape-dynamic-normalize.js.map +1 -1
- package/dist/codegen/shape/shape-dynamic-select-params.js +2 -2
- package/dist/codegen/shape/shape-dynamic-select-params.js.map +1 -1
- package/dist/codegen/shape/shape-dynamic-select.js +3 -3
- package/dist/codegen/shape/shape-dynamic-select.js.map +1 -1
- package/dist/codegen/shape/shape-dynamic-utils.js +6 -5
- package/dist/codegen/shape/shape-dynamic-utils.js.map +1 -1
- package/dist/codegen/shape/shape-equals.js +27 -27
- package/dist/codegen/shape/shape-equals.js.map +1 -1
- package/dist/codegen/shape/shape-ingest-discriminator.js +4 -4
- package/dist/codegen/shape/shape-ingest-discriminator.js.map +1 -1
- package/dist/codegen/shape/shape-ingest-paginated.js +4 -3
- package/dist/codegen/shape/shape-ingest-paginated.js.map +1 -1
- package/dist/codegen/shape/shape-ingest.js +2 -2
- package/dist/codegen/shape/shape-ingest.js.map +1 -1
- package/dist/codegen/shape/shape-key-interface.js +3 -3
- package/dist/codegen/shape/shape-key-interface.js.map +1 -1
- package/dist/codegen/shape/shape-keybuilder.js +9 -9
- package/dist/codegen/shape/shape-keybuilder.js.map +1 -1
- package/dist/codegen/shape/shape-normalize.js +17 -18
- package/dist/codegen/shape/shape-normalize.js.map +1 -1
- package/dist/codegen/shape/shape-normalized-interface.js +3 -3
- package/dist/codegen/shape/shape-normalized-interface.js.map +1 -1
- package/dist/codegen/shape/shape-select-discriminator.js +7 -7
- package/dist/codegen/shape/shape-select-discriminator.js.map +1 -1
- package/dist/codegen/shape/shape-select-paginated.js +29 -26
- package/dist/codegen/shape/shape-select-paginated.js.map +1 -1
- package/dist/codegen/shape/shape-select-utils.js +36 -36
- package/dist/codegen/shape/shape-select-utils.js.map +1 -1
- package/dist/codegen/shape/shape-select.js +11 -11
- package/dist/codegen/shape/shape-select.js.map +1 -1
- package/dist/codegen/shape/shape-ttl.js +3 -3
- package/dist/codegen/shape/shape-ttl.js.map +1 -1
- package/dist/codegen/shape/shape-type-definition.js +9 -9
- package/dist/codegen/shape/shape-type-definition.js.map +1 -1
- package/dist/codegen/shape/shape-utils-ingest.js +6 -14
- package/dist/codegen/shape/shape-utils-ingest.js.map +1 -1
- package/dist/codegen/shape/shape-utils.js +6 -6
- package/dist/codegen/shape/shape-utils.js.map +1 -1
- package/dist/codegen/shape/shape-validation.js +2 -2
- package/dist/codegen/shape/shape-validation.js.map +1 -1
- package/dist/codegen/shared/constants.js +5 -5
- package/dist/codegen/shared/constants.js.map +1 -1
- package/dist/codegen/shared/normalized-type-definition.js +14 -14
- package/dist/codegen/shared/normalized-type-definition.js.map +1 -1
- package/dist/codegen/shared/type-definition.js +20 -20
- package/dist/codegen/shared/type-definition.js.map +1 -1
- package/dist/codegen/shared/validation.js +40 -40
- package/dist/codegen/shared/validation.js.map +1 -1
- package/dist/generate.js +11 -11
- package/dist/generate.js.map +1 -1
- package/dist/intermediate/pagination.d.ts +4 -3
- package/dist/intermediate/pagination.js +1 -0
- package/dist/intermediate/pagination.js.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/parse.js +1 -1
- package/dist/parse.js.map +1 -1
- package/dist/parser/annotation-adapter-tests.js +11 -11
- package/dist/parser/annotation-adapter-tests.js.map +1 -1
- package/dist/parser/annotation-adapter.js +11 -11
- package/dist/parser/annotation-adapter.js.map +1 -1
- package/dist/parser/annotation-coerceFunction.js +4 -4
- package/dist/parser/annotation-coerceFunction.js.map +1 -1
- package/dist/parser/annotation-composite.js +48 -48
- package/dist/parser/annotation-composite.js.map +1 -1
- package/dist/parser/annotation-integrity.js +5 -5
- package/dist/parser/annotation-integrity.js.map +1 -1
- package/dist/parser/annotation-key.js +17 -17
- package/dist/parser/annotation-key.js.map +1 -1
- package/dist/parser/annotation-keyPrefix.js +3 -3
- package/dist/parser/annotation-keyPrefix.js.map +1 -1
- package/dist/parser/annotation-method.js +5 -5
- package/dist/parser/annotation-method.js.map +1 -1
- package/dist/parser/annotation-opaque.js +3 -3
- package/dist/parser/annotation-opaque.js.map +1 -1
- package/dist/parser/annotation-paginated.js +37 -22
- package/dist/parser/annotation-paginated.js.map +1 -1
- package/dist/parser/annotation-paginationParams.js +30 -29
- package/dist/parser/annotation-paginationParams.js.map +1 -1
- package/dist/parser/annotation-private.js +10 -10
- package/dist/parser/annotation-private.js.map +1 -1
- package/dist/parser/annotation-resource-key.js +5 -5
- package/dist/parser/annotation-resource-key.js.map +1 -1
- package/dist/parser/annotation-ttl.js +5 -5
- package/dist/parser/annotation-ttl.js.map +1 -1
- package/dist/parser/main.js +41 -41
- package/dist/parser/main.js.map +1 -1
- package/dist/parser/overlay-resolution.js +8 -8
- package/dist/parser/overlay-resolution.js.map +1 -1
- package/dist/parser/parse.js +5 -5
- package/dist/parser/parse.js.map +1 -1
- package/dist/parser/resource.js +26 -26
- package/dist/parser/resource.js.map +1 -1
- package/dist/parser/shape-inheritance.js +16 -16
- package/dist/parser/shape-inheritance.js.map +1 -1
- package/dist/parser/shape-normalization.js +4 -4
- package/dist/parser/shape-normalization.js.map +1 -1
- package/dist/parser/shape-paginated-container.js +2 -2
- package/dist/parser/shape-paginated-container.js.map +1 -1
- package/dist/parser/shape-resolution.js +10 -10
- package/dist/parser/shape-resolution.js.map +1 -1
- package/dist/utils/annotation.js +1 -1
- package/dist/utils/annotation.js.map +1 -1
- package/dist/utils/generation.js +2 -2
- package/dist/utils/generation.js.map +1 -1
- package/dist/utils/imports.js +5 -3
- package/dist/utils/imports.js.map +1 -1
- package/package.json +3 -3
- package/resources/luvio-annotations.raml +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-integrity.js","sourceRoot":"","sources":["../../src/parser/annotation-integrity.ts"],"names":[],"mappings":";;;AACA,sCAA6E;AAC7E,oDAAoD;AACpD,qCAAoC;AAEvB,QAAA,yBAAyB,GAAG,WAAW,CAAC;AAErD,SAAgB,0BAA0B,CAAC,KAAuB;IAC9D,MAAM,UAAU,GAAG,0BAAa,
|
|
1
|
+
{"version":3,"file":"annotation-integrity.js","sourceRoot":"","sources":["../../src/parser/annotation-integrity.ts"],"names":[],"mappings":";;;AACA,sCAA6E;AAC7E,oDAAoD;AACpD,qCAAoC;AAEvB,QAAA,yBAAyB,GAAG,WAAW,CAAC;AAErD,SAAgB,0BAA0B,CAAC,KAAuB;IAC9D,MAAM,UAAU,GAAG,IAAA,0BAAa,EAAC,KAAK,EAAE,iCAAyB,CAAC,CAAC;IACnE,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,OAAO;KACV;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClD,IAAI,CAAC,IAAA,iBAAW,EAAC,SAAS,CAAC,EAAE;QACzB,IAAA,iBAAQ,EAAC,4DAA4D,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACrF,OAAO;KACV;IAED,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,MAAM,EAAE,EAAE;QACtD,IAAI,CAAC,IAAA,kBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,wBAAkB,EAAC,MAAM,CAAC,EAAE;YACtD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACzE,IAAA,iBAAQ,EAAC,sCAAsC,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;YAC3E,OAAO,GAAG,CAAC;SACd;QAED,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/B,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;AACX,CAAC;AAvBD,gEAuBC"}
|
|
@@ -7,14 +7,14 @@ const annotation_1 = require("../utils/annotation");
|
|
|
7
7
|
const logger_1 = require("./logger");
|
|
8
8
|
exports.KEY_ANNOTATION_NAME = 'key';
|
|
9
9
|
function isStringShape(shape) {
|
|
10
|
-
return aml_1.isScalarShape(shape) && aml_1.isStringScalarShape(shape);
|
|
10
|
+
return (0, aml_1.isScalarShape)(shape) && (0, aml_1.isStringScalarShape)(shape);
|
|
11
11
|
}
|
|
12
12
|
function isStringArrayShape(shape) {
|
|
13
|
-
return aml_1.isArrayShape(shape) && isStringShape(shape.items);
|
|
13
|
+
return (0, aml_1.isArrayShape)(shape) && isStringShape(shape.items);
|
|
14
14
|
}
|
|
15
15
|
function isValidKeyValueShape(shape) {
|
|
16
16
|
// boolean
|
|
17
|
-
if (aml_1.isScalarShape(shape) && aml_1.isBooleanScalarShape(shape)) {
|
|
17
|
+
if ((0, aml_1.isScalarShape)(shape) && (0, aml_1.isBooleanScalarShape)(shape)) {
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
// string
|
|
@@ -25,11 +25,11 @@ function isValidKeyValueShape(shape) {
|
|
|
25
25
|
if (isStringArrayShape(shape)) {
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
|
-
if (aml_1.isUnionShape(shape)) {
|
|
29
|
-
const shapes = union_1.getShapesFromUnionShape(shape);
|
|
28
|
+
if ((0, aml_1.isUnionShape)(shape)) {
|
|
29
|
+
const shapes = (0, union_1.getShapesFromUnionShape)(shape);
|
|
30
30
|
// string | nil or string[] | nil
|
|
31
31
|
if (shapes.length === 2 &&
|
|
32
|
-
shapes.find((s) => aml_1.isNilShape(s)) &&
|
|
32
|
+
shapes.find((s) => (0, aml_1.isNilShape)(s)) &&
|
|
33
33
|
shapes.find((s) => isStringShape(s) || isStringArrayShape(s))) {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
@@ -39,11 +39,11 @@ function isValidKeyValueShape(shape) {
|
|
|
39
39
|
function resolvePath(shape, path) {
|
|
40
40
|
if (path.length === 0) {
|
|
41
41
|
if (isValidKeyValueShape(shape)) {
|
|
42
|
-
return { shape, resolvedValueIsUnionShape: aml_1.isUnionShape(shape) };
|
|
42
|
+
return { shape, resolvedValueIsUnionShape: (0, aml_1.isUnionShape)(shape) };
|
|
43
43
|
}
|
|
44
44
|
throw new Error(`field type not supported in keys`);
|
|
45
45
|
}
|
|
46
|
-
if (!aml_1.isNodeShape(shape)) {
|
|
46
|
+
if (!(0, aml_1.isNodeShape)(shape)) {
|
|
47
47
|
throw new Error(`could not resolve path "${path.join('.')}"`);
|
|
48
48
|
}
|
|
49
49
|
const childName = path.shift();
|
|
@@ -51,25 +51,25 @@ function resolvePath(shape, path) {
|
|
|
51
51
|
if (!childProperty) {
|
|
52
52
|
throw new Error(`could not resolve field "${childName}" on type "${shape.name.value()}"`);
|
|
53
53
|
}
|
|
54
|
-
let childPropertyRange = aml_1.resolveShape(childProperty.range);
|
|
54
|
+
let childPropertyRange = (0, aml_1.resolveShape)(childProperty.range);
|
|
55
55
|
return resolvePath(childPropertyRange, path);
|
|
56
56
|
}
|
|
57
57
|
function collectKeyAnnotation(shape) {
|
|
58
|
-
const annotation = annotation_1.getAnnotation(shape, exports.KEY_ANNOTATION_NAME);
|
|
58
|
+
const annotation = (0, annotation_1.getAnnotation)(shape, exports.KEY_ANNOTATION_NAME);
|
|
59
59
|
if (annotation === undefined) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const keys = annotation.extension;
|
|
63
63
|
const { line, column } = keys.position.start;
|
|
64
|
-
if (!aml_1.isObjectNode(keys)) {
|
|
65
|
-
logger_1.logError(`Invalid key annotation format, expected a object type`, line, column);
|
|
64
|
+
if (!(0, aml_1.isObjectNode)(keys)) {
|
|
65
|
+
(0, logger_1.logError)(`Invalid key annotation format, expected a object type`, line, column);
|
|
66
66
|
return undefined;
|
|
67
67
|
}
|
|
68
68
|
const validKeys = Object.keys(keys.properties).reduce((acc, propertyName) => {
|
|
69
69
|
const valueNode = keys.properties[propertyName];
|
|
70
|
-
if (!aml_1.isScalarNode(valueNode) || !aml_1.isStringScalarNode(valueNode)) {
|
|
70
|
+
if (!(0, aml_1.isScalarNode)(valueNode) || !(0, aml_1.isStringScalarNode)(valueNode)) {
|
|
71
71
|
const { line: valueNodeLine, column: valueNodeColumn } = valueNode.position.start;
|
|
72
|
-
logger_1.logError(`Invalid data type, expected a string`, valueNodeLine, valueNodeColumn);
|
|
72
|
+
(0, logger_1.logError)(`Invalid data type, expected a string`, valueNodeLine, valueNodeColumn);
|
|
73
73
|
return acc;
|
|
74
74
|
}
|
|
75
75
|
return {
|
|
@@ -91,7 +91,7 @@ function collectKeyAnnotation(shape) {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
catch (err) {
|
|
94
|
-
logger_1.logError(`Error on key property "${validKey}: ${valuePath}" of type "${shape.name.value()}": ${err.message}`, line, column);
|
|
94
|
+
(0, logger_1.logError)(`Error on key property "${validKey}: ${valuePath}" of type "${shape.name.value()}": ${err.message}`, line, column);
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
@@ -101,12 +101,12 @@ exports.collectKeyAnnotation = collectKeyAnnotation;
|
|
|
101
101
|
function validateDeleteKey(deleteOperation, shapeForDeleteKey, shapeKeys) {
|
|
102
102
|
if (shapeForDeleteKey === undefined) {
|
|
103
103
|
const { line, column } = deleteOperation.position.start;
|
|
104
|
-
logger_1.logError(`DELETE resource with key annotation has no sibling GET resource. DELETE resource keys must match GET response keys at the same path.`, line, column);
|
|
104
|
+
(0, logger_1.logError)(`DELETE resource with key annotation has no sibling GET resource. DELETE resource keys must match GET response keys at the same path.`, line, column);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
if (shapeKeys[shapeForDeleteKey.id] === undefined) {
|
|
108
108
|
const { name, position: { start: { line, column }, }, } = shapeForDeleteKey;
|
|
109
|
-
logger_1.logError(`DELETE resource has key annotation but sibling GET response type '${name}' has no key annotation.`, line, column);
|
|
109
|
+
(0, logger_1.logError)(`DELETE resource has key annotation but sibling GET response type '${name}' has no key annotation.`, line, column);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
exports.validateDeleteKey = validateDeleteKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-key.js","sourceRoot":"","sources":["../../src/parser/annotation-key.ts"],"names":[],"mappings":";;;AACA,sCAYsB;AACtB,0CAAyD;AACzD,oDAAoD;AAEpD,qCAAoC;AAEvB,QAAA,mBAAmB,GAAG,KAAK,CAAC;AA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AAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,GAAG,WAAW,CAChE,KAAK,EACL,YAAY,CACf,CAAC;YACF,MAAM,CAAC,QAAQ,CAAC,GAAG;gBACf,SAAS;gBACT,UAAU;gBACV,yBAAyB;aAC5B,CAAC;SACL;QAAC,OAAO,GAAG,EAAE;YACV,IAAA,iBAAQ,EACJ,0BAA0B,QAAQ,KAAK,SAAS,cAAc,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAC3E,GAAa,CAAC,OACnB,EAAE,EACF,IAAI,EACJ,MAAM,CACT,CAAC;YACF,OAAO,SAAS,CAAC;SACpB;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC;AA7DD,oDA6DC;AAED,SAAgB,iBAAiB,CAC7B,eAAqC,EACrC,iBAAmD,EACnD,SAAoB;IAEpB,IAAI,iBAAiB,KAAK,SAAS,EAAE;QACjC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;QACxD,IAAA,iBAAQ,EACJ,uIAAuI,EACvI,IAAI,EACJ,MAAM,CACT,CAAC;QACF,OAAO;KACV;IAED,IAAI,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,SAAS,EAAE;QAC/C,MAAM,EACF,IAAI,EACJ,QAAQ,EAAE,EACN,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAC1B,GACJ,GAAG,iBAAiB,CAAC;QACtB,IAAA,iBAAQ,EACJ,qEAAqE,IAAI,0BAA0B,EACnG,IAAI,EACJ,MAAM,CACT,CAAC;KACL;AACL,CAAC;AA5BD,8CA4BC"}
|
|
@@ -6,14 +6,14 @@ const annotation_1 = require("../utils/annotation");
|
|
|
6
6
|
const logger_1 = require("./logger");
|
|
7
7
|
exports.KEY_PREFIX_ANNOTATION_NAME = 'keyPrefix';
|
|
8
8
|
function getKeyPrefix(api) {
|
|
9
|
-
const annotation = annotation_1.getAnnotation(api, exports.KEY_PREFIX_ANNOTATION_NAME);
|
|
9
|
+
const annotation = (0, annotation_1.getAnnotation)(api, exports.KEY_PREFIX_ANNOTATION_NAME);
|
|
10
10
|
if (annotation === undefined) {
|
|
11
11
|
return '';
|
|
12
12
|
}
|
|
13
13
|
const keyPrefix = annotation.extension;
|
|
14
14
|
const { line, column } = keyPrefix.position.start;
|
|
15
|
-
if (!aml_1.isScalarNode(keyPrefix) || !aml_1.isStringScalarNode(keyPrefix)) {
|
|
16
|
-
logger_1.logError(`Invalid keyPrefix annotation format, expected a string type`, line, column);
|
|
15
|
+
if (!(0, aml_1.isScalarNode)(keyPrefix) || !(0, aml_1.isStringScalarNode)(keyPrefix)) {
|
|
16
|
+
(0, logger_1.logError)(`Invalid keyPrefix annotation format, expected a string type`, line, column);
|
|
17
17
|
return '';
|
|
18
18
|
}
|
|
19
19
|
return keyPrefix.value.value();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-keyPrefix.js","sourceRoot":"","sources":["../../src/parser/annotation-keyPrefix.ts"],"names":[],"mappings":";;;AACA,wCAAkE;AAClE,oDAAoD;AACpD,qCAAoC;AAEvB,QAAA,0BAA0B,GAAG,WAAW,CAAC;AAEtD,SAAgB,YAAY,CAAC,GAAsB;IAC/C,MAAM,UAAU,GAAG,0BAAa,
|
|
1
|
+
{"version":3,"file":"annotation-keyPrefix.js","sourceRoot":"","sources":["../../src/parser/annotation-keyPrefix.ts"],"names":[],"mappings":";;;AACA,wCAAkE;AAClE,oDAAoD;AACpD,qCAAoC;AAEvB,QAAA,0BAA0B,GAAG,WAAW,CAAC;AAEtD,SAAgB,YAAY,CAAC,GAAsB;IAC/C,MAAM,UAAU,GAAG,IAAA,0BAAa,EAAC,GAAG,EAAE,kCAA0B,CAAC,CAAC;IAClE,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,OAAO,EAAE,CAAC;KACb;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClD,IAAI,CAAC,IAAA,kBAAY,EAAC,SAAS,CAAC,IAAI,CAAC,IAAA,wBAAkB,EAAC,SAAS,CAAC,EAAE;QAC5D,IAAA,iBAAQ,EAAC,6DAA6D,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACtF,OAAO,EAAE,CAAC;KACb;IAED,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;AACnC,CAAC;AAdD,oCAcC"}
|
|
@@ -6,25 +6,25 @@ const aml_1 = require("./../utils/aml");
|
|
|
6
6
|
const logger_1 = require("./logger");
|
|
7
7
|
exports.METHOD_ANNOTATION_NAME = 'method';
|
|
8
8
|
function collectMethodAnnotation(operation) {
|
|
9
|
-
const annotation = annotation_1.getAnnotation(operation, exports.METHOD_ANNOTATION_NAME);
|
|
9
|
+
const annotation = (0, annotation_1.getAnnotation)(operation, exports.METHOD_ANNOTATION_NAME);
|
|
10
10
|
if (annotation === undefined) {
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
const methodValue = annotation.extension;
|
|
14
14
|
const { line, column } = methodValue.position.start;
|
|
15
|
-
if (!aml_1.isScalarNode(methodValue) || !aml_1.isStringScalarNode(methodValue)) {
|
|
16
|
-
logger_1.logError(`Invalid type, expected a string`, line, column);
|
|
15
|
+
if (!(0, aml_1.isScalarNode)(methodValue) || !(0, aml_1.isStringScalarNode)(methodValue)) {
|
|
16
|
+
(0, logger_1.logError)(`Invalid type, expected a string`, line, column);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const altMethodValue = methodValue.value.value();
|
|
20
20
|
// Only 'get' is allowed value for luvio.method now
|
|
21
21
|
if (altMethodValue !== 'get') {
|
|
22
|
-
logger_1.logError(`Invalid method annotation value, expected 'get'`, line, column);
|
|
22
|
+
(0, logger_1.logError)(`Invalid method annotation value, expected 'get'`, line, column);
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
25
|
// Only 'post' can have luvio.method now
|
|
26
26
|
if (operation.method.value() !== 'post') {
|
|
27
|
-
logger_1.logError(`Method annotation value is only for 'post'`, line, column);
|
|
27
|
+
(0, logger_1.logError)(`Method annotation value is only for 'post'`, line, column);
|
|
28
28
|
return undefined;
|
|
29
29
|
}
|
|
30
30
|
return altMethodValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-method.js","sourceRoot":"","sources":["../../src/parser/annotation-method.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,wCAAkE;AAClE,qCAAoC;AAGvB,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,SAAgB,uBAAuB,CACnC,SAA+B;IAE/B,MAAM,UAAU,GAAG,0BAAa,
|
|
1
|
+
{"version":3,"file":"annotation-method.js","sourceRoot":"","sources":["../../src/parser/annotation-method.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,wCAAkE;AAClE,qCAAoC;AAGvB,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,SAAgB,uBAAuB,CACnC,SAA+B;IAE/B,MAAM,UAAU,GAAG,IAAA,0BAAa,EAAC,SAAS,EAAE,8BAAsB,CAAC,CAAC;IACpE,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,OAAO,SAAS,CAAC;KACpB;IACD,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC;IACzC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;IAEpD,IAAI,CAAC,IAAA,kBAAY,EAAC,WAAW,CAAC,IAAI,CAAC,IAAA,wBAAkB,EAAC,WAAW,CAAC,EAAE;QAChE,IAAA,iBAAQ,EAAC,iCAAiC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO;KACV;IAED,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAEjD,mDAAmD;IACnD,IAAI,cAAc,KAAK,KAAK,EAAE;QAC1B,IAAA,iBAAQ,EAAC,iDAAiD,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1E,OAAO,SAAS,CAAC;KACpB;IACD,wCAAwC;IACxC,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,MAAM,EAAE;QACrC,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACrE,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC;AA5BD,0DA4BC"}
|
|
@@ -6,14 +6,14 @@ const annotation_1 = require("../utils/annotation");
|
|
|
6
6
|
const logger_1 = require("./logger");
|
|
7
7
|
exports.OPAQUE_ANNOTATION_NAME = 'opaque';
|
|
8
8
|
function collectOpaqueAnnotation(shape) {
|
|
9
|
-
const annotation = annotation_1.getAnnotation(shape, exports.OPAQUE_ANNOTATION_NAME);
|
|
9
|
+
const annotation = (0, annotation_1.getAnnotation)(shape, exports.OPAQUE_ANNOTATION_NAME);
|
|
10
10
|
if (annotation === undefined) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const relLocation = annotation.extension;
|
|
14
14
|
const { line, column } = relLocation.position.start;
|
|
15
|
-
if (!aml_1.isScalarNode(relLocation) || !aml_1.isBooleanScalarNode(relLocation)) {
|
|
16
|
-
logger_1.logError(`Invalid opaque annotation format, expected a boolean type`, line, column);
|
|
15
|
+
if (!(0, aml_1.isScalarNode)(relLocation) || !(0, aml_1.isBooleanScalarNode)(relLocation)) {
|
|
16
|
+
(0, logger_1.logError)(`Invalid opaque annotation format, expected a boolean type`, line, column);
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
19
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-opaque.js","sourceRoot":"","sources":["../../src/parser/annotation-opaque.ts"],"names":[],"mappings":";;;AACA,sCAAiE;AACjE,oDAAoD;AACpD,qCAAoC;AAEvB,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,SAAgB,uBAAuB,CAAC,KAAuB;IAC3D,MAAM,UAAU,GAAG,0BAAa,
|
|
1
|
+
{"version":3,"file":"annotation-opaque.js","sourceRoot":"","sources":["../../src/parser/annotation-opaque.ts"],"names":[],"mappings":";;;AACA,sCAAiE;AACjE,oDAAoD;AACpD,qCAAoC;AAEvB,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,SAAgB,uBAAuB,CAAC,KAAuB;IAC3D,MAAM,UAAU,GAAG,IAAA,0BAAa,EAAC,KAAK,EAAE,8BAAsB,CAAC,CAAC;IAEhE,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,OAAO;KACV;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC;IACzC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;IACpD,IAAI,CAAC,IAAA,kBAAY,EAAC,WAAW,CAAC,IAAI,CAAC,IAAA,yBAAmB,EAAC,WAAW,CAAC,EAAE;QACjE,IAAA,iBAAQ,EAAC,2DAA2D,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACpF,OAAO,SAAS,CAAC;KACpB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAfD,0DAeC"}
|
|
@@ -7,19 +7,19 @@ const annotation_1 = require("../utils/annotation");
|
|
|
7
7
|
const logger_1 = require("./logger");
|
|
8
8
|
const PAGINATED_ANNOTATION_NAME = 'paginated';
|
|
9
9
|
function collectPaginatedAnnotation(shape, shapeKeys) {
|
|
10
|
-
const paginated = annotation_1.getAnnotation(shape, PAGINATED_ANNOTATION_NAME);
|
|
10
|
+
const paginated = (0, annotation_1.getAnnotation)(shape, PAGINATED_ANNOTATION_NAME);
|
|
11
11
|
if (paginated === undefined) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
if (!aml_1.isNodeShape(shape)) {
|
|
14
|
+
if (!(0, aml_1.isNodeShape)(shape)) {
|
|
15
15
|
const { line, column } = shape.position.start;
|
|
16
|
-
logger_1.logError('Invalid paginated annotation. Paginated annotation must be on NodeShape.', line, column);
|
|
16
|
+
(0, logger_1.logError)('Invalid paginated annotation. Paginated annotation must be on NodeShape.', line, column);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const paginatedExtension = paginated.extension;
|
|
20
|
-
if (!aml_1.isObjectNode(paginatedExtension)) {
|
|
20
|
+
if (!(0, aml_1.isObjectNode)(paginatedExtension)) {
|
|
21
21
|
const { line, column } = paginatedExtension.position.start;
|
|
22
|
-
logger_1.logError(`Invalid paginated annotation format, expected an object`, line, column);
|
|
22
|
+
(0, logger_1.logError)(`Invalid paginated annotation format, expected an object`, line, column);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
const strategyName = getStrategyName(paginatedExtension);
|
|
@@ -27,13 +27,14 @@ function collectPaginatedAnnotation(shape, shapeKeys) {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
switch (strategyName) {
|
|
30
|
+
case pagination_1.Strategy.SyntheticCursor:
|
|
30
31
|
case pagination_1.Strategy.Cursor: {
|
|
31
|
-
return collectCursorPaginated(shape, paginatedExtension, shapeKeys);
|
|
32
|
+
return collectCursorPaginated(strategyName, shape, paginatedExtension, shapeKeys);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
exports.collectPaginatedAnnotation = collectPaginatedAnnotation;
|
|
36
|
-
function collectCursorPaginated(shape, annotationNode, shapeKeys) {
|
|
37
|
+
function collectCursorPaginated(strategy, shape, annotationNode, shapeKeys) {
|
|
37
38
|
const declaredTypeProperties = {};
|
|
38
39
|
collectDeclaredProperty(declaredTypeProperties, pagination_1.PaginatedTypeProperty.Items, annotationNode);
|
|
39
40
|
collectDeclaredProperty(declaredTypeProperties, pagination_1.CursorPaginatedTypeProperty.Token, annotationNode);
|
|
@@ -42,7 +43,7 @@ function collectCursorPaginated(shape, annotationNode, shapeKeys) {
|
|
|
42
43
|
collectDeclaredProperty(declaredTypeProperties, pagination_1.CursorPaginatedTypeProperty.PageSize, annotationNode, false);
|
|
43
44
|
collectDeclaredProperty(declaredTypeProperties, pagination_1.CursorPaginatedTypeProperty.Count, annotationNode, false);
|
|
44
45
|
const paginationProperties = {
|
|
45
|
-
strategy:
|
|
46
|
+
strategy: strategy,
|
|
46
47
|
};
|
|
47
48
|
const metadata = {};
|
|
48
49
|
const cursorPaginatedTypePropertyValues = Object.values(pagination_1.CursorPaginatedTypeProperty);
|
|
@@ -55,23 +56,23 @@ function collectCursorPaginated(shape, annotationNode, shapeKeys) {
|
|
|
55
56
|
cursorPaginatedTypePropertyValues.includes(semanticName)) &&
|
|
56
57
|
isPropertyUsedInKey(propName, shapeKeys)) {
|
|
57
58
|
const { line, column } = range.position.start;
|
|
58
|
-
logger_1.logError(`Invalid value for (luvio.paginated) annotation, ${propName} is used in (luvio.key). Should this property be included on the (luvio.key)?`, line, column);
|
|
59
|
+
(0, logger_1.logError)(`Invalid value for (luvio.paginated) annotation, ${propName} is used in (luvio.key). Should this property be included on the (luvio.key)?`, line, column);
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
62
|
switch (semanticName) {
|
|
62
63
|
case pagination_1.PaginatedTypeProperty.Items: {
|
|
63
|
-
if (!aml_1.isArrayShape(range)) {
|
|
64
|
+
if (!(0, aml_1.isArrayShape)(range)) {
|
|
64
65
|
const { line, column } = range.position.start;
|
|
65
|
-
logger_1.logError(`Invalid type for ${semanticName} property, expected an array type`, line, column);
|
|
66
|
+
(0, logger_1.logError)(`Invalid type for ${semanticName} property, expected an array type`, line, column);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
69
|
paginationProperties[semanticName] = propName;
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
71
72
|
case pagination_1.CursorPaginatedTypeProperty.Token: {
|
|
72
|
-
if (!aml_1.isScalarShape(range) || !aml_1.isStringScalarShape(range)) {
|
|
73
|
+
if (!(0, aml_1.isScalarShape)(range) || !(0, aml_1.isStringScalarShape)(range)) {
|
|
73
74
|
const { line, column } = range.position.start;
|
|
74
|
-
logger_1.logError(`Invalid type for ${semanticName} property, expected an string or nil`, line, column);
|
|
75
|
+
(0, logger_1.logError)(`Invalid type for ${semanticName} property, expected an string or nil`, line, column);
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
78
|
metadata[semanticName] = propName;
|
|
@@ -81,7 +82,7 @@ function collectCursorPaginated(shape, annotationNode, shapeKeys) {
|
|
|
81
82
|
case pagination_1.CursorPaginatedTypeProperty.PreviousToken: {
|
|
82
83
|
if (!isNullableTokenShape(range)) {
|
|
83
84
|
const { line, column } = range.position.start;
|
|
84
|
-
logger_1.logError(`Invalid type for ${semanticName} property, expected an string or nil`, line, column);
|
|
85
|
+
(0, logger_1.logError)(`Invalid type for ${semanticName} property, expected an string or nil`, line, column);
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
88
|
metadata[semanticName] = propName;
|
|
@@ -89,9 +90,9 @@ function collectCursorPaginated(shape, annotationNode, shapeKeys) {
|
|
|
89
90
|
}
|
|
90
91
|
case pagination_1.CursorPaginatedTypeProperty.PageSize:
|
|
91
92
|
case pagination_1.CursorPaginatedTypeProperty.Count: {
|
|
92
|
-
if (!aml_1.isScalarShape(range) || !aml_1.isIntegerScalarShape(range)) {
|
|
93
|
+
if (!(0, aml_1.isScalarShape)(range) || !(0, aml_1.isIntegerScalarShape)(range)) {
|
|
93
94
|
const { line, column } = range.position.start;
|
|
94
|
-
logger_1.logError(`Invalid type for ${semanticName} property, expected an integer type`, line, column);
|
|
95
|
+
(0, logger_1.logError)(`Invalid type for ${semanticName} property, expected an integer type`, line, column);
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
metadata[semanticName] = propName;
|
|
@@ -103,11 +104,11 @@ function collectCursorPaginated(shape, annotationNode, shapeKeys) {
|
|
|
103
104
|
return paginationProperties;
|
|
104
105
|
}
|
|
105
106
|
function isNullableTokenShape(node) {
|
|
106
|
-
if (!aml_1.isUnionShape(node)) {
|
|
107
|
+
if (!(0, aml_1.isUnionShape)(node)) {
|
|
107
108
|
return false;
|
|
108
109
|
}
|
|
109
110
|
return (node.anyOf.find((each) => {
|
|
110
|
-
return !aml_1.isScalarShape(each) && !aml_1.isNilShape(each);
|
|
111
|
+
return !(0, aml_1.isScalarShape)(each) && !(0, aml_1.isNilShape)(each);
|
|
111
112
|
}) === undefined);
|
|
112
113
|
}
|
|
113
114
|
function isPropertyUsedInKey(propertyName, shapeKeys) {
|
|
@@ -130,18 +131,32 @@ function getStrategyName(node) {
|
|
|
130
131
|
}
|
|
131
132
|
if (!(strategyName in pagination_1.Strategy)) {
|
|
132
133
|
const { line, column } = node.position.start;
|
|
133
|
-
logger_1.logError(`Unsupported pagination strategy: ${strategyName}`, line, column);
|
|
134
|
+
(0, logger_1.logError)(`Unsupported pagination strategy: ${strategyName}`, line, column);
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
137
|
+
if (strategyName === pagination_1.Strategy.Cursor &&
|
|
138
|
+
isSyntheticCursorEnabled(node.properties['synthetic']) === true) {
|
|
139
|
+
return pagination_1.Strategy.SyntheticCursor;
|
|
140
|
+
}
|
|
136
141
|
return strategyName;
|
|
137
142
|
}
|
|
138
143
|
exports.getStrategyName = getStrategyName;
|
|
144
|
+
function isSyntheticCursorEnabled(node) {
|
|
145
|
+
if (node === undefined) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const value = getScalarValue('synthetic', node);
|
|
149
|
+
if (value === undefined) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return value === 'true';
|
|
153
|
+
}
|
|
139
154
|
function collectDeclaredProperty(properties, semanticName, annotationNode, required = true) {
|
|
140
155
|
const propNameNode = annotationNode.properties[semanticName];
|
|
141
156
|
if (propNameNode === undefined) {
|
|
142
157
|
if (required === true) {
|
|
143
158
|
const { line, column } = annotationNode.position.start;
|
|
144
|
-
logger_1.logError(`Property ${semanticName} must be declared`, line, column);
|
|
159
|
+
(0, logger_1.logError)(`Property ${semanticName} must be declared`, line, column);
|
|
145
160
|
}
|
|
146
161
|
return;
|
|
147
162
|
}
|
|
@@ -152,9 +167,9 @@ function collectDeclaredProperty(properties, semanticName, annotationNode, requi
|
|
|
152
167
|
}
|
|
153
168
|
exports.collectDeclaredProperty = collectDeclaredProperty;
|
|
154
169
|
function getScalarValue(name, node) {
|
|
155
|
-
if (!aml_1.isScalarNode(node)) {
|
|
170
|
+
if (!(0, aml_1.isScalarNode)(node)) {
|
|
156
171
|
const { line, column } = node.position.start;
|
|
157
|
-
logger_1.logError(`${name} is not a valid Scalar node`, line, column);
|
|
172
|
+
(0, logger_1.logError)(`${name} is not a valid Scalar node`, line, column);
|
|
158
173
|
return;
|
|
159
174
|
}
|
|
160
175
|
return node.value.value();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-paginated.js","sourceRoot":"","sources":["../../src/parser/annotation-paginated.ts"],"names":[],"mappings":";;;AACA,2DAMoC;AACpC,sCAUsB;AACtB,oDAAoD;AACpD,qCAAoC;AAGpC,MAAM,yBAAyB,GAAG,WAAW,CAAC;AAE9C,SAAgB,0BAA0B,CACtC,KAAuB,EACvB,SAAqC;IAErC,MAAM,SAAS,GAAG,0BAAa,
|
|
1
|
+
{"version":3,"file":"annotation-paginated.js","sourceRoot":"","sources":["../../src/parser/annotation-paginated.ts"],"names":[],"mappings":";;;AACA,2DAMoC;AACpC,sCAUsB;AACtB,oDAAoD;AACpD,qCAAoC;AAGpC,MAAM,yBAAyB,GAAG,WAAW,CAAC;AAE9C,SAAgB,0BAA0B,CACtC,KAAuB,EACvB,SAAqC;IAErC,MAAM,SAAS,GAAG,IAAA,0BAAa,EAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IAClE,IAAI,SAAS,KAAK,SA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,CAAC,CAAC;SACvE;QACD,OAAO;KACV;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC5D,IAAI,QAAQ,KAAK,SAAS,EAAE;QACxB,UAAU,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC;KACvC;AACL,CAAC;AAnBD,0DAmBC;AAED,SAAgB,cAAc,CAAC,IAAY,EAAE,IAAyB;IAClE,IAAI,CAAC,IAAA,kBAAY,EAAC,IAAI,CAAC,EAAE;QACrB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC7C,IAAA,iBAAQ,EAAC,GAAG,IAAI,6BAA6B,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7D,OAAO;KACV;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;AAC9B,CAAC;AAPD,wCAOC"}
|
|
@@ -9,22 +9,22 @@ const logger_1 = require("./logger");
|
|
|
9
9
|
const ANNOTATION_NAME = 'paginationParams';
|
|
10
10
|
const DEFAULT_SIZE_PROPERTY_NAME = 'defaultSize';
|
|
11
11
|
function collectPaginationParamsAnnotation(operation, operationMethod, queryParameters, bodyShape) {
|
|
12
|
-
const annotation = annotation_1.getAnnotation(operation, ANNOTATION_NAME);
|
|
12
|
+
const annotation = (0, annotation_1.getAnnotation)(operation, ANNOTATION_NAME);
|
|
13
13
|
if (annotation === undefined) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (operationMethod !== 'get') {
|
|
17
17
|
const { line, column } = operation.position.start;
|
|
18
|
-
logger_1.logError(`paginationParams annotation is only supported for GET or POST as GET method: ${operation.method.value()}`, line, column);
|
|
18
|
+
(0, logger_1.logError)(`paginationParams annotation is only supported for GET or POST as GET method: ${operation.method.value()}`, line, column);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const { extension } = annotation;
|
|
22
|
-
if (!aml_1.isObjectNode(extension)) {
|
|
22
|
+
if (!(0, aml_1.isObjectNode)(extension)) {
|
|
23
23
|
const { line, column } = extension.position.start;
|
|
24
|
-
logger_1.logError(`Invalid paginationParams annotation format, expected an object type`, line, column);
|
|
24
|
+
(0, logger_1.logError)(`Invalid paginationParams annotation format, expected an object type`, line, column);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const strategyName = annotation_paginated_1.getStrategyName(extension);
|
|
27
|
+
const strategyName = (0, annotation_paginated_1.getStrategyName)(extension);
|
|
28
28
|
if (strategyName === undefined) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
@@ -33,21 +33,22 @@ function collectPaginationParamsAnnotation(operation, operationMethod, queryPara
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
switch (strategyName) {
|
|
36
|
+
case pagination_1.Strategy.SyntheticCursor:
|
|
36
37
|
case pagination_1.Strategy.Cursor: {
|
|
37
|
-
return collectCursorPaginationParams(parameterNode, queryParameters, bodyShape);
|
|
38
|
+
return collectCursorPaginationParams(strategyName, parameterNode, queryParameters, bodyShape);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
exports.collectPaginationParamsAnnotation = collectPaginationParamsAnnotation;
|
|
42
|
-
function collectCursorPaginationParams(parameterDeclarationNode, queryParameters, bodyShape) {
|
|
43
|
+
function collectCursorPaginationParams(strategy, parameterDeclarationNode, queryParameters, bodyShape) {
|
|
43
44
|
const { parameterType, parameterNode } = parameterDeclarationNode;
|
|
44
45
|
const paginationParams = {
|
|
45
|
-
strategy:
|
|
46
|
+
strategy: strategy,
|
|
46
47
|
parameterType,
|
|
47
48
|
};
|
|
48
49
|
const declaredParams = {};
|
|
49
|
-
annotation_paginated_1.collectDeclaredProperty(declaredParams, pagination_1.CursorPaginationParameter.PageSize, parameterNode);
|
|
50
|
-
annotation_paginated_1.collectDeclaredProperty(declaredParams, pagination_1.CursorPaginationParameter.Token, parameterNode);
|
|
50
|
+
(0, annotation_paginated_1.collectDeclaredProperty)(declaredParams, pagination_1.CursorPaginationParameter.PageSize, parameterNode);
|
|
51
|
+
(0, annotation_paginated_1.collectDeclaredProperty)(declaredParams, pagination_1.CursorPaginationParameter.Token, parameterNode);
|
|
51
52
|
if (parameterType === pagination_1.PaginatedResourceParamType.QueryParameter) {
|
|
52
53
|
queryParameters.forEach((param) => {
|
|
53
54
|
const paramName = param.name.value();
|
|
@@ -59,9 +60,9 @@ function collectCursorPaginationParams(parameterDeclarationNode, queryParameters
|
|
|
59
60
|
}
|
|
60
61
|
case pagination_1.CursorPaginationParameter.Token: {
|
|
61
62
|
const { schema } = param;
|
|
62
|
-
if (!aml_1.isScalarShape(schema) || !aml_1.isStringScalarShape(schema)) {
|
|
63
|
+
if (!(0, aml_1.isScalarShape)(schema) || !(0, aml_1.isStringScalarShape)(schema)) {
|
|
63
64
|
const { line, column } = schema.position.start;
|
|
64
|
-
logger_1.logError(`Invalid type token parameter, expected a string type`, line, column);
|
|
65
|
+
(0, logger_1.logError)(`Invalid type token parameter, expected a string type`, line, column);
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
paginationParams[semanticName] = paramName;
|
|
@@ -72,7 +73,7 @@ function collectCursorPaginationParams(parameterDeclarationNode, queryParameters
|
|
|
72
73
|
else if (isBodyDeclaredParameterNode(parameterDeclarationNode)) {
|
|
73
74
|
if (bodyShape === undefined) {
|
|
74
75
|
const { line, column } = parameterNode.position.start;
|
|
75
|
-
logger_1.logError('The resource does not have a body defined', line, column);
|
|
76
|
+
(0, logger_1.logError)('The resource does not have a body defined', line, column);
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
bodyShape.properties.forEach((property) => {
|
|
@@ -81,16 +82,16 @@ function collectCursorPaginationParams(parameterDeclarationNode, queryParameters
|
|
|
81
82
|
const { range } = property;
|
|
82
83
|
switch (semanticName) {
|
|
83
84
|
case pagination_1.CursorPaginationParameter.PageSize: {
|
|
84
|
-
if (!aml_1.isScalarShape(range) || !aml_1.isIntegerScalarShape(range)) {
|
|
85
|
+
if (!(0, aml_1.isScalarShape)(range) || !(0, aml_1.isIntegerScalarShape)(range)) {
|
|
85
86
|
const { line, column } = range.position.start;
|
|
86
|
-
logger_1.logError(`Invalid type pageSize parameter, expected an integer type`, line, column);
|
|
87
|
+
(0, logger_1.logError)(`Invalid type pageSize parameter, expected an integer type`, line, column);
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
if (isOptionalProperty(property)) {
|
|
90
91
|
const { defaultSize } = parameterDeclarationNode;
|
|
91
92
|
if (defaultSize === undefined) {
|
|
92
93
|
const { line, column } = range.position.start;
|
|
93
|
-
logger_1.logError(`${DEFAULT_SIZE_PROPERTY_NAME} must be declared when pageSize is optional`, line, column);
|
|
94
|
+
(0, logger_1.logError)(`${DEFAULT_SIZE_PROPERTY_NAME} must be declared when pageSize is optional`, line, column);
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
97
|
paginationParams.defaultSize = defaultSize;
|
|
@@ -99,9 +100,9 @@ function collectCursorPaginationParams(parameterDeclarationNode, queryParameters
|
|
|
99
100
|
break;
|
|
100
101
|
}
|
|
101
102
|
case pagination_1.CursorPaginationParameter.Token: {
|
|
102
|
-
if (!aml_1.isScalarShape(range) || !aml_1.isStringScalarShape(range)) {
|
|
103
|
+
if (!(0, aml_1.isScalarShape)(range) || !(0, aml_1.isStringScalarShape)(range)) {
|
|
103
104
|
const { line, column } = range.position.start;
|
|
104
|
-
logger_1.logError(`Invalid type token parameter, expected a string type`, line, column);
|
|
105
|
+
(0, logger_1.logError)(`Invalid type token parameter, expected a string type`, line, column);
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
paginationParams[semanticName] = propertyName;
|
|
@@ -114,20 +115,20 @@ function collectCursorPaginationParams(parameterDeclarationNode, queryParameters
|
|
|
114
115
|
}
|
|
115
116
|
function collectPageSizeParam(paginationParams, param) {
|
|
116
117
|
const { name, schema, required, position } = param;
|
|
117
|
-
if (!aml_1.isScalarShape(schema) || !aml_1.isIntegerScalarShape(schema)) {
|
|
118
|
+
if (!(0, aml_1.isScalarShape)(schema) || !(0, aml_1.isIntegerScalarShape)(schema)) {
|
|
118
119
|
const { line, column } = position.start;
|
|
119
|
-
logger_1.logError(`Invalid type pageSize parameter, expected an integer type`, line, column);
|
|
120
|
+
(0, logger_1.logError)(`Invalid type pageSize parameter, expected an integer type`, line, column);
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
123
|
if (required.value() === false) {
|
|
123
124
|
const { defaultValue } = schema;
|
|
124
|
-
if (aml_1.isScalarNode(defaultValue)) {
|
|
125
|
+
if ((0, aml_1.isScalarNode)(defaultValue)) {
|
|
125
126
|
const defaultSize = parseInt(defaultValue.value.value(), 10);
|
|
126
127
|
paginationParams.defaultSize = defaultSize;
|
|
127
128
|
}
|
|
128
129
|
else {
|
|
129
130
|
const { line, column } = position.start;
|
|
130
|
-
logger_1.logError(`pageSize parameter must have a default value when it is optional`, line, column);
|
|
131
|
+
(0, logger_1.logError)(`pageSize parameter must have a default value when it is optional`, line, column);
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
133
134
|
}
|
|
@@ -140,12 +141,12 @@ function getParametersNode(annotation) {
|
|
|
140
141
|
if (property !== undefined) {
|
|
141
142
|
if (parametersNode !== undefined) {
|
|
142
143
|
const { line, column } = annotation.position.start;
|
|
143
|
-
logger_1.logError('Pagination parameters can be only declared with single parameter type', line, column);
|
|
144
|
+
(0, logger_1.logError)('Pagination parameters can be only declared with single parameter type', line, column);
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
|
-
if (!aml_1.isObjectNode(property)) {
|
|
147
|
+
if (!(0, aml_1.isObjectNode)(property)) {
|
|
147
148
|
const { line, column } = property.position.start;
|
|
148
|
-
logger_1.logError(`Invalid format for parameters on '${paramType}', expected an object type`, line, column);
|
|
149
|
+
(0, logger_1.logError)(`Invalid format for parameters on '${paramType}', expected an object type`, line, column);
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
152
|
parametersNode = {
|
|
@@ -156,14 +157,14 @@ function getParametersNode(annotation) {
|
|
|
156
157
|
}
|
|
157
158
|
if (parametersNode === undefined) {
|
|
158
159
|
const { line, column } = annotation.position.start;
|
|
159
|
-
logger_1.logError('Pagination parameters must be declared', line, column);
|
|
160
|
+
(0, logger_1.logError)('Pagination parameters must be declared', line, column);
|
|
160
161
|
return;
|
|
161
162
|
}
|
|
162
163
|
const defaultSizeProperty = annotation.properties[DEFAULT_SIZE_PROPERTY_NAME];
|
|
163
164
|
if (defaultSizeProperty !== undefined) {
|
|
164
165
|
if (!isBodyDeclaredParameterNode(parametersNode)) {
|
|
165
166
|
const { line, column } = defaultSizeProperty.position.start;
|
|
166
|
-
logger_1.logError(`${DEFAULT_SIZE_PROPERTY_NAME} can only be declared when parameterType is body`, line, column);
|
|
167
|
+
(0, logger_1.logError)(`${DEFAULT_SIZE_PROPERTY_NAME} can only be declared when parameterType is body`, line, column);
|
|
167
168
|
return;
|
|
168
169
|
}
|
|
169
170
|
parametersNode.defaultSize = getDefaultSize(defaultSizeProperty);
|
|
@@ -174,13 +175,13 @@ function isOptionalProperty(property) {
|
|
|
174
175
|
return property.minCount.value() === 0;
|
|
175
176
|
}
|
|
176
177
|
function getDefaultSize(defaultSizeProperty) {
|
|
177
|
-
const defaultSizeScalarValue = annotation_paginated_1.getScalarValue(DEFAULT_SIZE_PROPERTY_NAME, defaultSizeProperty);
|
|
178
|
+
const defaultSizeScalarValue = (0, annotation_paginated_1.getScalarValue)(DEFAULT_SIZE_PROPERTY_NAME, defaultSizeProperty);
|
|
178
179
|
if (defaultSizeScalarValue === undefined)
|
|
179
180
|
return;
|
|
180
181
|
const defaultSize = parseInt(defaultSizeScalarValue, 10);
|
|
181
182
|
if (isNaN(defaultSize)) {
|
|
182
183
|
const { line, column } = defaultSizeProperty.position.start;
|
|
183
|
-
logger_1.logError(`${DEFAULT_SIZE_PROPERTY_NAME} must be a number`, line, column);
|
|
184
|
+
(0, logger_1.logError)(`${DEFAULT_SIZE_PROPERTY_NAME} must be a number`, line, column);
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
186
187
|
return defaultSize;
|