@cratis/arc 25.4.0 → 25.5.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@cratis/arc",
4
- "version": "25.4.0",
4
+ "version": "25.5.1",
5
5
  "description": "TypeScript command, query, validation, identity, and messaging runtime for Cratis Arc — the CQRS application framework for ASP.NET Core — used by generated proxies.",
6
6
  "keywords": [
7
7
  "cratis",
@@ -453,7 +453,8 @@ export class QueryInstanceCache {
453
453
 
454
454
  for (const [key, entry] of this._entries) {
455
455
  const colonIndex = key.indexOf('::');
456
- const queryName = colonIndex >= 0 ? key.substring(0, colonIndex) : key;
456
+ // A query name made unique for its route carries a `#` and a number that is not part of the real name.
457
+ const queryName = (colonIndex >= 0 ? key.substring(0, colonIndex) : key).replace(/#\d+$/, '');
457
458
 
458
459
  let estimatedBytes = 0;
459
460
  try {
@@ -0,0 +1,18 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { QueryInstanceCache } from '../../QueryInstanceCache.js';
5
+
6
+ describe('when getting diagnostics for entries whose query name was made unique for its route', () => {
7
+ let names: string[];
8
+
9
+ beforeEach(() => {
10
+ const cache = new QueryInstanceCache();
11
+ cache.getOrCreate('Orders.Query::a=1', () => ({}));
12
+ cache.getOrCreate('Orders.Query#2::a=1', () => ({}));
13
+ cache.getOrCreate('Orders.Query#2', () => ({}));
14
+ names = cache.getDiagnosticsSnapshot().entries.map(entry => entry.queryName);
15
+ });
16
+
17
+ it('should show the real query name for each entry', () => names.should.deep.equal(['Orders.Query', 'Orders.Query', 'Orders.Query']));
18
+ });