@cratis/arc 20.1.0 → 20.1.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.
- package/ICanBeConfigured.ts +1 -1
- package/UrlHelpers.ts +14 -1
- package/dist/cjs/ICanBeConfigured.d.ts +1 -1
- package/dist/cjs/ICanBeConfigured.d.ts.map +1 -1
- package/dist/cjs/UrlHelpers.d.ts.map +1 -1
- package/dist/cjs/UrlHelpers.js +11 -1
- package/dist/cjs/UrlHelpers.js.map +1 -1
- package/dist/cjs/identity/IdentityProvider.d.ts +1 -1
- package/dist/cjs/identity/IdentityProvider.d.ts.map +1 -1
- package/dist/cjs/identity/IdentityProvider.js.map +1 -1
- package/dist/cjs/queries/for_QueryFor/given/TestQueries.d.ts +9 -0
- package/dist/cjs/queries/for_QueryFor/given/TestQueries.d.ts.map +1 -1
- package/dist/cjs/queries/for_QueryFor/given/a_query_for.d.ts +2 -1
- package/dist/cjs/queries/for_QueryFor/given/a_query_for.d.ts.map +1 -1
- package/dist/cjs/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.d.ts +2 -0
- package/dist/cjs/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.d.ts.map +1 -0
- package/dist/cjs/reflection/ParameterDescriptor.d.ts +2 -1
- package/dist/cjs/reflection/ParameterDescriptor.d.ts.map +1 -1
- package/dist/cjs/reflection/ParameterDescriptor.js +3 -1
- package/dist/cjs/reflection/ParameterDescriptor.js.map +1 -1
- package/dist/esm/ICanBeConfigured.d.ts +1 -1
- package/dist/esm/ICanBeConfigured.d.ts.map +1 -1
- package/dist/esm/UrlHelpers.d.ts.map +1 -1
- package/dist/esm/UrlHelpers.js +11 -1
- package/dist/esm/UrlHelpers.js.map +1 -1
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_array_values.d.ts +2 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_array_values.d.ts.map +1 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_array_values.js +16 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_array_values.js.map +1 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_mixed_array_and_scalar_values.d.ts +2 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_mixed_array_and_scalar_values.d.ts.map +1 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_mixed_array_and_scalar_values.js +17 -0
- package/dist/esm/for_UrlHelpers/when_building_query_params/with_mixed_array_and_scalar_values.js.map +1 -0
- package/dist/esm/for_UrlHelpers/when_replacing_route_parameters/with_array_parameters.d.ts +2 -0
- package/dist/esm/for_UrlHelpers/when_replacing_route_parameters/with_array_parameters.d.ts.map +1 -0
- package/dist/esm/for_UrlHelpers/when_replacing_route_parameters/with_array_parameters.js +17 -0
- package/dist/esm/for_UrlHelpers/when_replacing_route_parameters/with_array_parameters.js.map +1 -0
- package/dist/esm/identity/IdentityProvider.d.ts +1 -1
- package/dist/esm/identity/IdentityProvider.d.ts.map +1 -1
- package/dist/esm/identity/IdentityProvider.js.map +1 -1
- package/dist/esm/queries/for_QueryFor/given/TestQueries.d.ts +9 -0
- package/dist/esm/queries/for_QueryFor/given/TestQueries.d.ts.map +1 -1
- package/dist/esm/queries/for_QueryFor/given/TestQueries.js +16 -0
- package/dist/esm/queries/for_QueryFor/given/TestQueries.js.map +1 -1
- package/dist/esm/queries/for_QueryFor/given/a_query_for.d.ts +2 -1
- package/dist/esm/queries/for_QueryFor/given/a_query_for.d.ts.map +1 -1
- package/dist/esm/queries/for_QueryFor/given/a_query_for.js +3 -1
- package/dist/esm/queries/for_QueryFor/given/a_query_for.js.map +1 -1
- package/dist/esm/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.d.ts +2 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.js +66 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.js.map +1 -0
- package/dist/esm/reflection/ParameterDescriptor.d.ts +2 -1
- package/dist/esm/reflection/ParameterDescriptor.d.ts.map +1 -1
- package/dist/esm/reflection/ParameterDescriptor.js +3 -1
- package/dist/esm/reflection/ParameterDescriptor.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/for_UrlHelpers/when_building_query_params/with_array_values.ts +22 -0
- package/for_UrlHelpers/when_building_query_params/with_mixed_array_and_scalar_values.ts +23 -0
- package/for_UrlHelpers/when_replacing_route_parameters/with_array_parameters.ts +23 -0
- package/identity/IdentityProvider.ts +1 -1
- package/package.json +2 -2
- package/queries/for_QueryFor/given/TestQueries.ts +20 -0
- package/queries/for_QueryFor/given/a_query_for.ts +4 -1
- package/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.ts +82 -0
- package/reflection/ParameterDescriptor.ts +2 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { TestQueryFor, TestEnumerableQueryFor, TestQueryForWithoutRequiredParams, TestQueryForWithParameterDescriptorValues, TestQueryForWithMultipleRequiredParameters } from './TestQueries';
|
|
1
|
+
import { TestQueryFor, TestEnumerableQueryFor, TestQueryForWithoutRequiredParams, TestQueryForWithParameterDescriptorValues, TestQueryForWithMultipleRequiredParameters, TestQueryForWithEnumerableParameterDescriptorValues } from './TestQueries';
|
|
2
2
|
export class a_query_for {
|
|
3
3
|
query;
|
|
4
4
|
enumerableQuery;
|
|
5
5
|
queryWithoutParams;
|
|
6
6
|
queryWithParameterDescriptorValues;
|
|
7
|
+
queryWithEnumerableParameterDescriptorValues;
|
|
7
8
|
queryWithMultipleRequiredParameters;
|
|
8
9
|
constructor() {
|
|
9
10
|
this.query = new TestQueryFor();
|
|
10
11
|
this.enumerableQuery = new TestEnumerableQueryFor();
|
|
11
12
|
this.queryWithoutParams = new TestQueryForWithoutRequiredParams();
|
|
12
13
|
this.queryWithParameterDescriptorValues = new TestQueryForWithParameterDescriptorValues();
|
|
14
|
+
this.queryWithEnumerableParameterDescriptorValues = new TestQueryForWithEnumerableParameterDescriptorValues();
|
|
13
15
|
this.queryWithMultipleRequiredParameters = new TestQueryForWithMultipleRequiredParameters();
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a_query_for.js","sourceRoot":"","sources":["../../../../../queries/for_QueryFor/given/a_query_for.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,iCAAiC,EACjC,yCAAyC,EACzC,0CAA0C,
|
|
1
|
+
{"version":3,"file":"a_query_for.js","sourceRoot":"","sources":["../../../../../queries/for_QueryFor/given/a_query_for.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,iCAAiC,EACjC,yCAAyC,EACzC,0CAA0C,EAC1C,mDAAmD,EACtD,MAAM,eAAe,CAAC;AAEvB,MAAM,OAAO,WAAW;IACpB,KAAK,CAAe;IACpB,eAAe,CAAyB;IACxC,kBAAkB,CAAoC;IACtD,kCAAkC,CAA4C;IAC9E,4CAA4C,CAAsD;IAClG,mCAAmC,CAA6C;IAEhF;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAI,sBAAsB,EAAE,CAAC;QACpD,IAAI,CAAC,kBAAkB,GAAG,IAAI,iCAAiC,EAAE,CAAC;QAClE,IAAI,CAAC,kCAAkC,GAAG,IAAI,yCAAyC,EAAE,CAAC;QAC1F,IAAI,CAAC,4CAA4C,GAAG,IAAI,mDAAmD,EAAE,CAAC;QAC9G,IAAI,CAAC,mCAAmC,GAAG,IAAI,0CAA0C,EAAE,CAAC;IAChG,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_enumerable_parameter_descriptor_values.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.ts"],"names":[],"mappings":""}
|
package/dist/esm/queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { a_query_for } from '../given/a_query_for';
|
|
2
|
+
import { given } from '../../../given';
|
|
3
|
+
import * as sinon from 'sinon';
|
|
4
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
5
|
+
describe('with enumerable parameter descriptor values', given(a_query_for, context => {
|
|
6
|
+
let result;
|
|
7
|
+
let fetchStub;
|
|
8
|
+
let fetchHelper;
|
|
9
|
+
const mockResponse = {
|
|
10
|
+
data: [],
|
|
11
|
+
isSuccess: true,
|
|
12
|
+
isAuthorized: true,
|
|
13
|
+
isValid: true,
|
|
14
|
+
hasExceptions: false,
|
|
15
|
+
validationResults: [],
|
|
16
|
+
exceptionMessages: [],
|
|
17
|
+
exceptionStackTrace: '',
|
|
18
|
+
paging: {
|
|
19
|
+
totalItems: 0,
|
|
20
|
+
totalPages: 0,
|
|
21
|
+
page: 0,
|
|
22
|
+
size: 0
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
beforeEach(async () => {
|
|
26
|
+
fetchHelper = createFetchHelper();
|
|
27
|
+
fetchStub = fetchHelper.stubFetch();
|
|
28
|
+
fetchStub.resolves({
|
|
29
|
+
json: sinon.stub().resolves(mockResponse),
|
|
30
|
+
ok: true,
|
|
31
|
+
status: 200
|
|
32
|
+
});
|
|
33
|
+
context.queryWithEnumerableParameterDescriptorValues.setOrigin('https://api.example.com');
|
|
34
|
+
context.queryWithEnumerableParameterDescriptorValues.setApiBasePath('/api/v1');
|
|
35
|
+
context.queryWithEnumerableParameterDescriptorValues.names = ['Alice', 'Bob'];
|
|
36
|
+
context.queryWithEnumerableParameterDescriptorValues.ids = [1, 2, 3];
|
|
37
|
+
result = await context.queryWithEnumerableParameterDescriptorValues.perform();
|
|
38
|
+
});
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
fetchHelper.restore();
|
|
41
|
+
});
|
|
42
|
+
it('should return successful result', () => {
|
|
43
|
+
result.isSuccess.should.be.true;
|
|
44
|
+
});
|
|
45
|
+
it('should include first name in URL as repeated query parameter', () => {
|
|
46
|
+
const url = fetchStub.getCall(0).args[0].href;
|
|
47
|
+
url.should.include('names=Alice');
|
|
48
|
+
});
|
|
49
|
+
it('should include second name in URL as repeated query parameter', () => {
|
|
50
|
+
const url = fetchStub.getCall(0).args[0].href;
|
|
51
|
+
url.should.include('names=Bob');
|
|
52
|
+
});
|
|
53
|
+
it('should include first id in URL as repeated query parameter', () => {
|
|
54
|
+
const url = fetchStub.getCall(0).args[0].href;
|
|
55
|
+
url.should.include('ids=1');
|
|
56
|
+
});
|
|
57
|
+
it('should include second id in URL as repeated query parameter', () => {
|
|
58
|
+
const url = fetchStub.getCall(0).args[0].href;
|
|
59
|
+
url.should.include('ids=2');
|
|
60
|
+
});
|
|
61
|
+
it('should include third id in URL as repeated query parameter', () => {
|
|
62
|
+
const url = fetchStub.getCall(0).args[0].href;
|
|
63
|
+
url.should.include('ids=3');
|
|
64
|
+
});
|
|
65
|
+
}));
|
|
66
|
+
//# sourceMappingURL=with_enumerable_parameter_descriptor_values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_enumerable_parameter_descriptor_values.js","sourceRoot":"","sources":["../../../../../queries/for_QueryFor/when_performing/with_enumerable_parameter_descriptor_values.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,QAAQ,CAAC,6CAA6C,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE;IACjF,IAAI,MAA6B,CAAC;IAClC,IAAI,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AAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { Constructor } from '@cratis/fundamentals';
|
|
|
2
2
|
export declare class ParameterDescriptor {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly type: Constructor;
|
|
5
|
-
|
|
5
|
+
readonly isEnumerable: boolean;
|
|
6
|
+
constructor(name: string, type: Constructor, isEnumerable?: boolean);
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=ParameterDescriptor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterDescriptor.d.ts","sourceRoot":"","sources":["../../../reflection/ParameterDescriptor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKnD,qBAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"ParameterDescriptor.d.ts","sourceRoot":"","sources":["../../../reflection/ParameterDescriptor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKnD,qBAAa,mBAAmB;IAOhB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW;IAAE,QAAQ,CAAC,YAAY,EAAE,OAAO;gBAAxE,IAAI,EAAE,MAAM,EAAW,IAAI,EAAE,WAAW,EAAW,YAAY,GAAE,OAAe;CAExG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterDescriptor.js","sources":["../../../reflection/ParameterDescriptor.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from '@cratis/fundamentals';\n\n/**\n * Represents a parameter descriptor.\n */\nexport class ParameterDescriptor {\n /**\n * Initializes a new instance of the {@link ParameterDescriptor} class.\n * @param name Name of the parameter.\n * @param type Type of the parameter.\n */\n constructor(readonly name: string, readonly type: Constructor) {\n }\n}\n"],"names":[],"mappings":"MAQa,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"ParameterDescriptor.js","sources":["../../../reflection/ParameterDescriptor.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Constructor } from '@cratis/fundamentals';\n\n/**\n * Represents a parameter descriptor.\n */\nexport class ParameterDescriptor {\n /**\n * Initializes a new instance of the {@link ParameterDescriptor} class.\n * @param name Name of the parameter.\n * @param type Type of the parameter.\n * @param isEnumerable Whether the parameter is an enumerable (collection) type.\n */\n constructor(readonly name: string, readonly type: Constructor, readonly isEnumerable: boolean = false) {\n }\n}\n"],"names":[],"mappings":"MAQa,mBAAmB,CAAA;AAOP,IAAA,IAAA;AAAuB,IAAA,IAAA;AAA4B,IAAA,YAAA;AAAxE,IAAA,WAAA,CAAqB,IAAY,EAAW,IAAiB,EAAW,eAAwB,KAAK,EAAA;QAAhF,IAAA,CAAA,IAAI,GAAJ,IAAI;QAAmB,IAAA,CAAA,IAAI,GAAJ,IAAI;QAAwB,IAAA,CAAA,YAAY,GAAZ,YAAY;IACpF;AACH;;;;"}
|