@cratis/arc 20.65.4 → 20.66.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.
Files changed (58) hide show
  1. package/dist/cjs/queries/ObservableQueryFor.js +3 -7
  2. package/dist/cjs/queries/ObservableQueryFor.js.map +1 -1
  3. package/dist/cjs/queries/QueryResult.js +5 -17
  4. package/dist/cjs/queries/QueryResult.js.map +1 -1
  5. package/dist/cjs/queries/deserializeQueryModel.js +62 -0
  6. package/dist/cjs/queries/deserializeQueryModel.js.map +1 -0
  7. package/dist/cjs/queries/index.js +4 -0
  8. package/dist/cjs/queries/index.js.map +1 -1
  9. package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -1
  10. package/dist/esm/queries/ObservableQueryFor.js +3 -7
  11. package/dist/esm/queries/ObservableQueryFor.js.map +1 -1
  12. package/dist/esm/queries/QueryResult.d.ts.map +1 -1
  13. package/dist/esm/queries/QueryResult.js +5 -17
  14. package/dist/esm/queries/QueryResult.js.map +1 -1
  15. package/dist/esm/queries/deserializeQueryModel.d.ts +5 -0
  16. package/dist/esm/queries/deserializeQueryModel.d.ts.map +1 -0
  17. package/dist/esm/queries/deserializeQueryModel.js +58 -0
  18. package/dist/esm/queries/deserializeQueryModel.js.map +1 -0
  19. package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.d.ts +2 -0
  20. package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.d.ts.map +1 -0
  21. package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.js +49 -0
  22. package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.js.map +1 -0
  23. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.d.ts +2 -0
  24. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.d.ts.map +1 -0
  25. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.js +16 -0
  26. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.js.map +1 -0
  27. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.d.ts +2 -0
  28. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.d.ts.map +1 -0
  29. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.js +7 -0
  30. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.js.map +1 -0
  31. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.d.ts +2 -0
  32. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.d.ts.map +1 -0
  33. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.js +7 -0
  34. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.js.map +1 -0
  35. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.d.ts +2 -0
  36. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.d.ts.map +1 -0
  37. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.js +6 -0
  38. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.js.map +1 -0
  39. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_single_string.d.ts +2 -0
  40. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_single_string.d.ts.map +1 -0
  41. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_single_string.js +7 -0
  42. package/dist/esm/queries/for_deserializeQueryModel/when_deserializing_a_single_string.js.map +1 -0
  43. package/dist/esm/queries/index.d.ts +1 -0
  44. package/dist/esm/queries/index.d.ts.map +1 -1
  45. package/dist/esm/queries/index.js +1 -0
  46. package/dist/esm/queries/index.js.map +1 -1
  47. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +1 -1
  49. package/queries/ObservableQueryFor.ts +3 -7
  50. package/queries/QueryResult.ts +8 -26
  51. package/queries/deserializeQueryModel.ts +66 -0
  52. package/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.ts +71 -0
  53. package/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.ts +17 -0
  54. package/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.ts +12 -0
  55. package/queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.ts +12 -0
  56. package/queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.ts +11 -0
  57. package/queries/for_deserializeQueryModel/when_deserializing_a_single_string.ts +12 -0
  58. package/queries/index.ts +1 -0
@@ -0,0 +1,58 @@
1
+ import { JsonSerializer } from '@cratis/fundamentals';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /*
6
+ * ⚠️ deserializeQueryModel / deserializeQueryModels are for use WITHIN this package only.
7
+ *
8
+ * JsonSerializer's converter registry is module state, and a consumer package can easily resolve a
9
+ * different physical copy of @cratis/fundamentals than this one. Calling these from another package
10
+ * therefore looks up Guid/Date/concept converters in the wrong registry and silently degrades those
11
+ * values to plain deserialization. Other packages should use isPrimitiveModelType - which compares
12
+ * against the JavaScript globals and is safe across copies - and deserialize through their own
13
+ * JsonSerializer.
14
+ */ /**
15
+ * Determines whether a model type is a JavaScript primitive wrapper rather than a real model.
16
+ *
17
+ * A query whose backend returns a primitive collection - `IEnumerable<string>`, `IEnumerable<int>` -
18
+ * generates a proxy with `String`, `Number` or `Boolean` as its model type.
19
+ * @param {Constructor} modelType The model type the query describes itself with.
20
+ * @returns {boolean} True when the type is a primitive wrapper.
21
+ */ function isPrimitiveModelType(modelType) {
22
+ return modelType === String || modelType === Number || modelType === Boolean;
23
+ }
24
+ /**
25
+ * Deserializes a single query payload into its model type, passing primitives through untouched.
26
+ *
27
+ * {@link JsonSerializer.deserializeFromInstance} is destructive for primitive wrapper types: it
28
+ * constructs `new String()` and copies declared fields onto it, which for a primitive means the
29
+ * value is discarded and an empty wrapper object is produced. Primitives therefore need to bypass
30
+ * deserialization entirely - they already arrive in their final shape.
31
+ * @param {Constructor} modelType The model type to deserialize into.
32
+ * @param {unknown} data The payload to deserialize.
33
+ * @returns {TDataType} The deserialized instance, or the payload unchanged for primitive types.
34
+ */ function deserializeQueryModel(modelType, data) {
35
+ if (!modelType || modelType === Object || isPrimitiveModelType(modelType)) {
36
+ return data;
37
+ }
38
+ return JsonSerializer.deserializeFromInstance(modelType, data);
39
+ }
40
+ /**
41
+ * Deserializes a query payload collection into its model type, passing primitives through untouched.
42
+ *
43
+ * See {@link deserializeQueryModel} for why primitive model types must bypass deserialization.
44
+ * @param {Constructor} modelType The instance type of the items to deserialize into.
45
+ * @param {unknown} data The payload to deserialize. A non-array payload yields an empty collection.
46
+ * @returns {TDataType[]} The deserialized items, or the items unchanged for primitive types.
47
+ */ function deserializeQueryModels(modelType, data) {
48
+ if (!Array.isArray(data)) {
49
+ return [];
50
+ }
51
+ if (!modelType || modelType === Object || isPrimitiveModelType(modelType)) {
52
+ return Array.from(data);
53
+ }
54
+ return JsonSerializer.deserializeArrayFromInstance(modelType, data);
55
+ }
56
+
57
+ export { deserializeQueryModel, deserializeQueryModels, isPrimitiveModelType };
58
+ //# sourceMappingURL=deserializeQueryModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserializeQueryModel.js","sources":["../../../queries/deserializeQueryModel.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, JsonSerializer } from '@cratis/fundamentals';\n\n/*\n * ⚠️ deserializeQueryModel / deserializeQueryModels are for use WITHIN this package only.\n *\n * JsonSerializer's converter registry is module state, and a consumer package can easily resolve a\n * different physical copy of @cratis/fundamentals than this one. Calling these from another package\n * therefore looks up Guid/Date/concept converters in the wrong registry and silently degrades those\n * values to plain deserialization. Other packages should use isPrimitiveModelType - which compares\n * against the JavaScript globals and is safe across copies - and deserialize through their own\n * JsonSerializer.\n */\n\n/**\n * Determines whether a model type is a JavaScript primitive wrapper rather than a real model.\n *\n * A query whose backend returns a primitive collection - `IEnumerable<string>`, `IEnumerable<int>` -\n * generates a proxy with `String`, `Number` or `Boolean` as its model type.\n * @param {Constructor} modelType The model type the query describes itself with.\n * @returns {boolean} True when the type is a primitive wrapper.\n */\nexport function isPrimitiveModelType(modelType: Constructor | null | undefined): boolean {\n return modelType === String || modelType === Number || modelType === Boolean;\n}\n\n/**\n * Deserializes a single query payload into its model type, passing primitives through untouched.\n *\n * {@link JsonSerializer.deserializeFromInstance} is destructive for primitive wrapper types: it\n * constructs `new String()` and copies declared fields onto it, which for a primitive means the\n * value is discarded and an empty wrapper object is produced. Primitives therefore need to bypass\n * deserialization entirely - they already arrive in their final shape.\n * @param {Constructor} modelType The model type to deserialize into.\n * @param {unknown} data The payload to deserialize.\n * @returns {TDataType} The deserialized instance, or the payload unchanged for primitive types.\n */\nexport function deserializeQueryModel<TDataType>(modelType: Constructor | null | undefined, data: unknown): TDataType {\n if (!modelType || modelType === Object || isPrimitiveModelType(modelType)) {\n return data as TDataType;\n }\n\n return JsonSerializer.deserializeFromInstance(modelType, data) as TDataType;\n}\n\n/**\n * Deserializes a query payload collection into its model type, passing primitives through untouched.\n *\n * See {@link deserializeQueryModel} for why primitive model types must bypass deserialization.\n * @param {Constructor} modelType The instance type of the items to deserialize into.\n * @param {unknown} data The payload to deserialize. A non-array payload yields an empty collection.\n * @returns {TDataType[]} The deserialized items, or the items unchanged for primitive types.\n */\nexport function deserializeQueryModels<TDataType>(modelType: Constructor | null | undefined, data: unknown): TDataType[] {\n if (!Array.isArray(data)) {\n return [];\n }\n\n if (!modelType || modelType === Object || isPrimitiveModelType(modelType)) {\n return Array.from(data) as TDataType[];\n }\n\n return JsonSerializer.deserializeArrayFromInstance(modelType, data) as TDataType[];\n}\n"],"names":["isPrimitiveModelType","modelType","String","Number","Boolean","deserializeQueryModel","data","Object","JsonSerializer","deserializeFromInstance","deserializeQueryModels","Array","isArray","from","deserializeArrayFromInstance"],"mappings":";;AAAA;AACA;AAIA;;;;;;;;;;;;;;;;IAmBO,SAASA,oBAAAA,CAAqBC,SAAyC,EAAA;AAC1E,IAAA,OAAOA,SAAAA,KAAcC,MAAAA,IAAUD,SAAAA,KAAcE,MAAAA,IAAUF,SAAAA,KAAcG,OAAAA;AACzE;AAEA;;;;;;;;;;AAUC,IACM,SAASC,qBAAAA,CAAiCJ,SAAyC,EAAEK,IAAa,EAAA;AACrG,IAAA,IAAI,CAACL,SAAAA,IAAaA,SAAAA,KAAcM,MAAAA,IAAUP,qBAAqBC,SAAAA,CAAAA,EAAY;QACvE,OAAOK,IAAAA;AACX,IAAA;IAEA,OAAOE,cAAAA,CAAeC,uBAAuB,CAACR,SAAAA,EAAWK,IAAAA,CAAAA;AAC7D;AAEA;;;;;;;AAOC,IACM,SAASI,sBAAAA,CAAkCT,SAAyC,EAAEK,IAAa,EAAA;AACtG,IAAA,IAAI,CAACK,KAAAA,CAAMC,OAAO,CAACN,IAAAA,CAAAA,EAAO;AACtB,QAAA,OAAO,EAAE;AACb,IAAA;AAEA,IAAA,IAAI,CAACL,SAAAA,IAAaA,SAAAA,KAAcM,MAAAA,IAAUP,qBAAqBC,SAAAA,CAAAA,EAAY;QACvE,OAAOU,KAAAA,CAAME,IAAI,CAACP,IAAAA,CAAAA;AACtB,IAAA;IAEA,OAAOE,cAAAA,CAAeM,4BAA4B,CAACb,SAAAA,EAAWK,IAAAA,CAAAA;AAClE;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_the_model_type_is_a_primitive_collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_the_model_type_is_a_primitive_collection.d.ts","sourceRoot":"","sources":["../../../../../queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ import * as sinon from 'sinon';
2
+ import { an_observable_query_for } from '../given/an_observable_query_for';
3
+ import { given } from '../../../given';
4
+ import { Globals } from '../../../Globals';
5
+ import { QueryTransportMethod } from '../../QueryTransportMethod';
6
+ describe('and the model type is a primitive collection', given(an_observable_query_for, context => {
7
+ let subscription;
8
+ let fakeEventSource;
9
+ let received;
10
+ let originalQueryDirectMode;
11
+ let originalTransportMethod;
12
+ let originalFactory;
13
+ beforeEach(() => {
14
+ originalQueryDirectMode = Globals.queryDirectMode;
15
+ originalTransportMethod = Globals.queryTransportMethod;
16
+ originalFactory = Globals.eventSourceFactory;
17
+ Globals.queryDirectMode = true;
18
+ Globals.queryTransportMethod = QueryTransportMethod.ServerSentEvents;
19
+ fakeEventSource = { onmessage: null, onerror: null, close: sinon.stub() };
20
+ Globals.eventSourceFactory = (() => fakeEventSource);
21
+ context.enumerableQuery.setOrigin('https://example.com');
22
+ received = [];
23
+ subscription = context.enumerableQuery.subscribe(result => received.push(result), { category: 'test-category' });
24
+ fakeEventSource.onmessage({
25
+ data: JSON.stringify({
26
+ data: ['first', 'second'],
27
+ isSuccess: true,
28
+ isAuthorized: true,
29
+ isValid: true,
30
+ hasExceptions: false,
31
+ validationResults: [],
32
+ exceptionMessages: [],
33
+ exceptionStackTrace: '',
34
+ paging: { page: 0, size: 0, totalItems: 0, totalPages: 0 }
35
+ })
36
+ });
37
+ });
38
+ afterEach(() => {
39
+ subscription?.unsubscribe();
40
+ Globals.queryDirectMode = originalQueryDirectMode;
41
+ Globals.queryTransportMethod = originalTransportMethod;
42
+ Globals.eventSourceFactory = originalFactory;
43
+ sinon.restore();
44
+ });
45
+ it('should deliver the result to the subscriber', () => received.length.should.equal(1));
46
+ it('should keep every item a primitive string', () => received[0].data.every(_ => typeof _ === 'string').should.be.true);
47
+ it('should keep the values intact', () => received[0].data.should.deep.equal(['first', 'second']));
48
+ }));
49
+ //# sourceMappingURL=and_the_model_type_is_a_primitive_collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_the_model_type_is_a_primitive_collection.js","sourceRoot":"","sources":["../../../../../queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_type_is_a_primitive_collection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AASlE,QAAQ,CAAC,8CAA8C,EAAE,KAAK,CAAC,uBAAuB,EAAE,OAAO,CAAC,EAAE;IAC9F,IAAI,YAAmD,CAAC;IACxD,IAAI,eAAgC,CAAC;IACrC,IAAI,QAAiC,CAAC;IACtC,IAAI,uBAAgC,CAAC;IACrC,IAAI,uBAA6C,CAAC;IAClD,IAAI,eAA+C,CAAC;IAEpD,UAAU,CAAC,GAAG,EAAE;QACZ,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC;QAClD,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACvD,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAE7C,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;QAC/B,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,gBAAgB,CAAC;QAErE,eAAe,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1E,OAAO,CAAC,kBAAkB,GAAG,CAAC,GAAG,EAAE,CAAC,eAAe,CAAkC,CAAC;QAEtF,OAAO,CAAC,eAAe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AAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACzH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_deserializing_a_collection_of_models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_collection_of_models.d.ts","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { field } from '@cratis/fundamentals';
3
+ import { deserializeQueryModels } from '../deserializeQueryModel';
4
+ class Item {
5
+ name;
6
+ }
7
+ __decorate([
8
+ field(String),
9
+ __metadata("design:type", String)
10
+ ], Item.prototype, "name", void 0);
11
+ describe('when deserializing a collection of models', () => {
12
+ const result = deserializeQueryModels(Item, [{ name: 'first' }, { name: 'second' }]);
13
+ it('should produce instances of the model type', () => result.every(_ => _ instanceof Item).should.be.true);
14
+ it('should carry the values over', () => result.map(_ => _.name).should.deep.equal(['first', 'second']));
15
+ });
16
+ //# sourceMappingURL=when_deserializing_a_collection_of_models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_collection_of_models.js","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_collection_of_models.ts"],"names":[],"mappings":";AAGA,OAAO,EAAe,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,IAAI;IAEN,IAAI,CAAU;CACjB;AADG;IADC,KAAK,CAAC,MAAM,CAAC;;kCACA;AAGlB,QAAQ,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACvD,MAAM,MAAM,GAAG,sBAAsB,CAAO,IAAmB,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE1G,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC5G,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC7G,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_deserializing_a_collection_of_numbers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_collection_of_numbers.d.ts","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { deserializeQueryModels } from '../deserializeQueryModel';
2
+ describe('when deserializing a collection of numbers', () => {
3
+ const result = deserializeQueryModels(Number, [42, 43]);
4
+ it('should keep every item a primitive number', () => result.every(_ => typeof _ === 'number').should.be.true);
5
+ it('should keep the values intact', () => result.should.deep.equal([42, 43]));
6
+ });
7
+ //# sourceMappingURL=when_deserializing_a_collection_of_numbers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_collection_of_numbers.js","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_collection_of_numbers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACxD,MAAM,MAAM,GAAG,sBAAsB,CAAS,MAAqB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAE/E,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/G,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_deserializing_a_collection_of_strings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_collection_of_strings.d.ts","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { deserializeQueryModels } from '../deserializeQueryModel';
2
+ describe('when deserializing a collection of strings', () => {
3
+ const result = deserializeQueryModels(String, ['first', 'second']);
4
+ it('should keep every item a primitive string', () => result.every(_ => typeof _ === 'string').should.be.true);
5
+ it('should keep the values intact', () => result.should.deep.equal(['first', 'second']));
6
+ });
7
+ //# sourceMappingURL=when_deserializing_a_collection_of_strings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_collection_of_strings.js","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_collection_of_strings.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACxD,MAAM,MAAM,GAAG,sBAAsB,CAAS,MAAqB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE1F,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/G,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_deserializing_a_non_array_as_a_collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_non_array_as_a_collection.d.ts","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { deserializeQueryModels } from '../deserializeQueryModel';
2
+ describe('when deserializing a non array as a collection', () => {
3
+ const result = deserializeQueryModels(String, null);
4
+ it('should produce an empty collection', () => result.should.be.empty);
5
+ });
6
+ //# sourceMappingURL=when_deserializing_a_non_array_as_a_collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_non_array_as_a_collection.js","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_non_array_as_a_collection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,QAAQ,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAC5D,MAAM,MAAM,GAAG,sBAAsB,CAAS,MAAqB,EAAE,IAAI,CAAC,CAAC;IAE3E,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_deserializing_a_single_string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_single_string.d.ts","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_single_string.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { deserializeQueryModel } from '../deserializeQueryModel';
2
+ describe('when deserializing a single string', () => {
3
+ const result = deserializeQueryModel(String, 'the value');
4
+ it('should keep it a primitive string', () => (typeof result).should.equal('string'));
5
+ it('should keep the value intact', () => result.should.equal('the value'));
6
+ });
7
+ //# sourceMappingURL=when_deserializing_a_single_string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_deserializing_a_single_string.js","sourceRoot":"","sources":["../../../../queries/for_deserializeQueryModel/when_deserializing_a_single_string.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAChD,MAAM,MAAM,GAAG,qBAAqB,CAAS,MAAqB,EAAE,WAAW,CAAC,CAAC;IAEjF,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtF,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
@@ -33,6 +33,7 @@ export * from './WebSocketMessage';
33
33
  export * from './QueryTransportMethod';
34
34
  export * from './QueryInstanceCache';
35
35
  export * from './reconcileQueryData';
36
+ export * from './deserializeQueryModel';
36
37
  export * from './IQueryProvider';
37
38
  export * from './QueryProvider';
38
39
  export * from './QueryValidator';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sC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Ae,CAAC"}
@@ -25,6 +25,7 @@ export { WebSocketMessageType } from './WebSocketMessage.js';
25
25
  export { QueryTransportMethod } from './QueryTransportMethod.js';
26
26
  export { QueryInstanceCache } from './QueryInstanceCache.js';
27
27
  export { reconcileQueryData } from './reconcileQueryData.js';
28
+ export { deserializeQueryModel, deserializeQueryModels, isPrimitiveModelType } from './deserializeQueryModel.js';
28
29
  export { IQueryProvider } from './IQueryProvider.js';
29
30
  export { QueryProvider } from './QueryProvider.js';
30
31
  export { QueryValidator } from './QueryValidator.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../queries/index.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\nexport * from './ChangeSet';\nexport * from './IChangeStreamFor';\nexport * from './IQuery';\nexport * from './IQueryFor';\nexport * from './Paging';\nexport * from './Sorting';\nexport * from './SortDirection';\nexport * from './SortingActions';\nexport * from './SortingActionsForQuery';\nexport * from './SortingActionsForObservableQuery';\nexport * from './QueryFor';\nexport * from './QueryHttpMethod';\nexport * from './QueryHttpMethodResolver';\nexport * from './QueryHttpRequest';\nexport * from './QueryResult';\nexport * from './QueryResultWithState';\nexport * from './IObservableQueryFor';\nexport * from './ObservableQueryFor';\nexport * from './IObservableQueryConnection';\nexport * from './IObservableQueryHubConnection';\nexport * from './IReconnectPolicy';\nexport * from './ReconnectPolicy';\nexport * from './HubConnectionKeepAlive';\nexport * from './ObservableQueryConnection';\nexport * from './ObservableQueryConnectionFactory';\nexport * from './ObservableQueryConnectionPool';\nexport * from './ServerSentEventQueryConnection';\nexport * from './ServerSentEventHubConnection';\nexport * from './WebSocketHubConnection';\nexport * from './ObservableQueryMultiplexer';\nexport * from './ObservableQuerySubscription';\nexport * from './WebSocketMessage';\nexport * from './QueryTransportMethod';\nexport * from './QueryInstanceCache';\nexport * from './reconcileQueryData';\nexport * from './IQueryProvider';\nexport * from './QueryProvider';\nexport * from './QueryValidator';\nexport * from './IObservableQueryDiagnostics';\nexport * from './ObservableQueryDiagnostics';\nexport * from './ObservableQueryDiagnosticsSnapshot';\nimport '../validation';"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA"}
1
+ {"version":3,"file":"index.js","sources":["../../../queries/index.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\nexport * from './ChangeSet';\nexport * from './IChangeStreamFor';\nexport * from './IQuery';\nexport * from './IQueryFor';\nexport * from './Paging';\nexport * from './Sorting';\nexport * from './SortDirection';\nexport * from './SortingActions';\nexport * from './SortingActionsForQuery';\nexport * from './SortingActionsForObservableQuery';\nexport * from './QueryFor';\nexport * from './QueryHttpMethod';\nexport * from './QueryHttpMethodResolver';\nexport * from './QueryHttpRequest';\nexport * from './QueryResult';\nexport * from './QueryResultWithState';\nexport * from './IObservableQueryFor';\nexport * from './ObservableQueryFor';\nexport * from './IObservableQueryConnection';\nexport * from './IObservableQueryHubConnection';\nexport * from './IReconnectPolicy';\nexport * from './ReconnectPolicy';\nexport * from './HubConnectionKeepAlive';\nexport * from './ObservableQueryConnection';\nexport * from './ObservableQueryConnectionFactory';\nexport * from './ObservableQueryConnectionPool';\nexport * from './ServerSentEventQueryConnection';\nexport * from './ServerSentEventHubConnection';\nexport * from './WebSocketHubConnection';\nexport * from './ObservableQueryMultiplexer';\nexport * from './ObservableQuerySubscription';\nexport * from './WebSocketMessage';\nexport * from './QueryTransportMethod';\nexport * from './QueryInstanceCache';\nexport * from './reconcileQueryData';\nexport * from './deserializeQueryModel';\nexport * from './IQueryProvider';\nexport * from './QueryProvider';\nexport * from './QueryValidator';\nexport * from './IObservableQueryDiagnostics';\nexport * from './ObservableQueryDiagnostics';\nexport * from './ObservableQueryDiagnosticsSnapshot';\nimport '../validation';"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA"}