@ahoo-wang/fetcher-wow 2.16.0 → 2.16.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.
@@ -8,6 +8,7 @@ export * from './queryApi';
8
8
  export * from './sort';
9
9
  export * from './event';
10
10
  export * from './snapshot';
11
+ export * from './state';
11
12
  export * from './cursorQuery';
12
13
  export * from './queryClients';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/query/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/query/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -3,6 +3,7 @@ import { ApiMetadata } from '@ahoo-wang/fetcher-decorator';
3
3
  import { AggregateNameCapable, AliasBoundedContext, ResourceAttributionPathSpec } from '../types';
4
4
  import { SnapshotQueryClient } from './snapshot';
5
5
  import { EventStreamQueryClient } from './event';
6
+ import { LoadStateAggregateClient, LoadOwnerStateAggregateClient } from './state';
6
7
  /**
7
8
  * Configuration options for query clients.
8
9
  *
@@ -62,6 +63,62 @@ export declare class QueryClientFactory<S, FIELDS extends string = string, Domai
62
63
  * ```
63
64
  */
64
65
  createSnapshotQueryClient(options: QueryClientOptions): SnapshotQueryClient<S, FIELDS>;
66
+ /**
67
+ * Creates a client for loading aggregate state by ID.
68
+ *
69
+ * This method merges the provided options with the factory's default options,
70
+ * then creates API metadata and instantiates a LoadStateAggregateClient.
71
+ * The client supports loading current state, versioned state, and time-based state.
72
+ *
73
+ * @param options - The query client options used to configure the state aggregate client
74
+ * @returns A new instance of LoadStateAggregateClient
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const stateClient = factory.createLoadStateAggregateClient({
79
+ * aggregateName: 'cart',
80
+ * });
81
+ *
82
+ * // Load current state
83
+ * const currentState = await stateClient.load('cart-123');
84
+ *
85
+ * // Load specific version
86
+ * const versionedState = await stateClient.loadVersioned('cart-123', 5);
87
+ *
88
+ * // Load state at specific time
89
+ * const timeBasedState = await stateClient.loadTimeBased('cart-123', Date.now());
90
+ * ```
91
+ */
92
+ createLoadStateAggregateClient(options: QueryClientOptions): LoadStateAggregateClient<S>;
93
+ /**
94
+ * Creates a client for loading owner-specific aggregate state.
95
+ *
96
+ * This method merges the provided options with the factory's default options,
97
+ * then creates API metadata and instantiates a LoadOwnerStateAggregateClient.
98
+ * Unlike the standard state client, this client loads state for the current owner
99
+ * without requiring an explicit ID parameter.
100
+ *
101
+ * @param options - The query client options used to configure the owner state aggregate client
102
+ * @returns A new instance of LoadOwnerStateAggregateClient
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const ownerStateClient = factory.createOwnerLoadStateAggregateClient({
107
+ * aggregateName: 'cart',
108
+ * resourceAttribution: ResourceAttributionPathSpec.OWNER,
109
+ * });
110
+ *
111
+ * // Load current owner's state
112
+ * const currentState = await ownerStateClient.load();
113
+ *
114
+ * // Load specific version of owner's state
115
+ * const versionedState = await ownerStateClient.loadVersioned(5);
116
+ *
117
+ * // Load owner's state at specific time
118
+ * const timeBasedState = await ownerStateClient.loadTimeBased(Date.now());
119
+ * ```
120
+ */
121
+ createOwnerLoadStateAggregateClient(options: QueryClientOptions): LoadOwnerStateAggregateClient<S>;
65
122
  /**
66
123
  * Creates an event stream query client for querying domain event streams.
67
124
  *
@@ -1 +1 @@
1
- {"version":3,"file":"queryClients.d.ts","sourceRoot":"","sources":["../../src/query/queryClients.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,kBACf,SAAQ,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,EACxC,OAAO,CAAC,mBAAmB,CAAC,EAC5B,OAAO,CAAC,oBAAoB,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,kBAAkB,GAC1B,WAAW,CASb;AAED,qBAAa,kBAAkB,CAC7B,CAAC,EACD,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,eAAe,GAAG,GAAG;IAkBT,OAAO,CAAC,QAAQ,CAAC,cAAc;IAhB3C;;;;;;;;;;;;;;;OAeG;gBAC0B,cAAc,EAAE,kBAAkB;IAG/D;;;;;;;;;;;;;;;;;OAiBG;IACH,yBAAyB,CACvB,OAAO,EAAE,k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D;;;;;;;;;;;;;;;;;OAiBG;IACH,yBAAyB,CACvB,OAAO,EAAE,kBAAkB,GAC1B,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC;IAQjC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,8BAA8B,CAC5B,OAAO,EAAE,kBAAkB,GAC1B,wBAAwB,CAAC,CAAC,CAAC;IAQ9B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,mCAAmC,CACjC,OAAO,EAAE,kBAAkB,GAC1B,6BAA6B,CAAC,CAAC,CAAC;IAQnC;;;;;;;;;;;;;;;;;OAiBG;IACH,4BAA4B,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,EACzD,OAAO,EAAE,kBAAkB,GAC1B,sBAAsB,CAAC,eAAe,EAAE,MAAM,CAAC;CAOnD"}
@@ -0,0 +1,3 @@
1
+ export * from './loadStateAggregateClient';
2
+ export * from './loadOwnerStateAggregateClient';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query/state/index.ts"],"names":[],"mappings":"AAaA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { ApiMetadata, ApiMetadataCapable } from '@ahoo-wang/fetcher-decorator';
2
+ export declare class LoadOwnerStateAggregateEndpointPaths {
3
+ static readonly LOAD = "state";
4
+ static readonly LOAD_VERSIONED: string;
5
+ static readonly LOAD_TIME_BASED: string;
6
+ }
7
+ export declare class LoadOwnerStateAggregateClient<S> implements ApiMetadataCapable {
8
+ readonly apiMetadata?: ApiMetadata | undefined;
9
+ constructor(apiMetadata?: ApiMetadata | undefined);
10
+ load(attributes?: Record<string, any>): Promise<S>;
11
+ loadVersioned(version: number, attributes?: Record<string, any>): Promise<S>;
12
+ loadTimeBased(createTime: number, attributes?: Record<string, any>): Promise<S>;
13
+ }
14
+ //# sourceMappingURL=loadOwnerStateAggregateClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadOwnerStateAggregateClient.d.ts","sourceRoot":"","sources":["../../../src/query/state/loadOwnerStateAggregateClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,WAAW,EACX,kBAAkB,EAKnB,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,oCAAoC;IAC/C,MAAM,CAAC,QAAQ,CAAC,IAAI,WAAW;IAC/B,MAAM,CAAC,QAAQ,CAAC,cAAc,SAA4D;IAC1F,MAAM,CAAC,QAAQ,CAAC,eAAe,SAAoE;CACpG;AAED,qBACa,6BAA6B,CAAC,CAAC,CAAE,YAAW,kBAAkB;aAC7C,WAAW,CAAC,EAAE,WAAW;gBAAzB,WAAW,CAAC,EAAE,WAAW,YAAA;IAIrD,IAAI,CAAc,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAK/D,aAAa,CAAkB,OAAO,EAAE,MAAM,EAAe,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAK1G,aAAa,CAAqB,UAAU,EAAE,MAAM,EAAe,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAIjH"}
@@ -0,0 +1,14 @@
1
+ import { ApiMetadata, ApiMetadataCapable } from '@ahoo-wang/fetcher-decorator';
2
+ export declare class LoadStateAggregateEndpointPaths {
3
+ static readonly LOAD = "{id}/state";
4
+ static readonly LOAD_VERSIONED: string;
5
+ static readonly LOAD_TIME_BASED: string;
6
+ }
7
+ export declare class LoadStateAggregateClient<S> implements ApiMetadataCapable {
8
+ readonly apiMetadata?: ApiMetadata | undefined;
9
+ constructor(apiMetadata?: ApiMetadata | undefined);
10
+ load(id: string, attributes?: Record<string, any>): Promise<S>;
11
+ loadVersioned(id: string, version: number, attributes?: Record<string, any>): Promise<S>;
12
+ loadTimeBased(id: string, createTime: number, attributes?: Record<string, any>): Promise<S>;
13
+ }
14
+ //# sourceMappingURL=loadStateAggregateClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadStateAggregateClient.d.ts","sourceRoot":"","sources":["../../../src/query/state/loadStateAggregateClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,WAAW,EACX,kBAAkB,EAKnB,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,+BAA+B;IAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB;IACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,SAAuD;IACrF,MAAM,CAAC,QAAQ,CAAC,eAAe,SAA+D;CAC/F;AAED,qBACa,wBAAwB,CAAC,CAAC,CAAE,YAAW,kBAAkB;aACxC,WAAW,CAAC,EAAE,WAAW;gBAAzB,WAAW,CAAC,EAAE,WAAW,YAAA;IAKrD,IAAI,CAAa,EAAE,EAAE,MAAM,EAAe,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAKvF,aAAa,CAAa,EAAE,EAAE,MAAM,EAAmB,OAAO,EAAE,MAAM,EAAe,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAKlI,aAAa,CAAa,EAAE,EAAE,MAAM,EAAsB,UAAU,EAAE,MAAM,EAAe,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAIzI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher-wow",
3
- "version": "2.16.0",
3
+ "version": "2.16.1",
4
4
  "description": "Support for Wow(https://github.com/Ahoo-Wang/Wow) in Fetcher",
5
5
  "keywords": [
6
6
  "fetch",