@ahoo-wang/fetcher-wow 1.6.2 → 1.6.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.
@@ -0,0 +1,53 @@
1
+ import { FieldSort, SortDirection } from './sort';
2
+ import { ListQuery } from './queryable';
3
+ import { Condition } from './condition';
4
+ /**
5
+ * Represents a cursor-based pagination query configuration.
6
+ * This interface defines the structure for implementing cursor-based pagination,
7
+ * which is an efficient way to paginate through large datasets.
8
+ */
9
+ export interface CursorQuery {
10
+ /** Field name used for cursor-based sorting and filtering */
11
+ field: string;
12
+ /**
13
+ * Cursor ID marking the starting point (exclusive)
14
+ * Uses CURSOR_ID_START constant for initial query
15
+ */
16
+ cursorId?: string;
17
+ /** Sort direction for pagination traversal (ascending or descending) */
18
+ direction?: SortDirection;
19
+ /** Base query object to be enhanced with cursor-based parameters */
20
+ query: ListQuery;
21
+ }
22
+ /** Special cursor ID value representing the starting point of a dataset */
23
+ export declare const CURSOR_ID_START = "~";
24
+ /**
25
+ * Generates a cursor condition for filtering records relative to the cursor position
26
+ * @param params - Cursor parameters excluding the base query
27
+ * @param params.field - The field to apply the cursor condition on
28
+ * @param params.cursorId - The cursor ID to compare against (defaults to CURSOR_ID_START)
29
+ * @param params.direction - Sort direction which determines the comparison operator (defaults to SortDirection.DESC)
30
+ * @returns Condition object for filtering records based on cursor position
31
+ */
32
+ export declare function cursorCondition({ field, cursorId, direction, }: Omit<CursorQuery, 'query'>): Condition;
33
+ /**
34
+ * Creates a sort configuration based on cursor parameters
35
+ * @param params - Cursor parameters excluding the base query
36
+ * @param params.field - The field to sort by
37
+ * @param params.direction - Sort direction (defaults to SortDirection.DESC)
38
+ * @returns FieldSort configuration for cursor-based pagination
39
+ */
40
+ export declare function cursorSort({ field, direction }: Omit<CursorQuery, 'query'>): FieldSort;
41
+ /**
42
+ * Enhances a base query with cursor-based pagination parameters
43
+ * This function combines the cursor condition with the existing query condition
44
+ * and sets the sorting according to the cursor parameters.
45
+ * @param options - Complete cursor query configuration
46
+ * @param options.field - The field used for cursor-based sorting and filtering
47
+ * @param options.cursorId - The cursor ID marking the starting point (exclusive)
48
+ * @param options.direction - Sort direction for pagination traversal
49
+ * @param options.query - Base query object to be enhanced with cursor-based parameters
50
+ * @returns Enhanced query with cursor-based filtering and sorting
51
+ */
52
+ export declare function cursorQuery(options: CursorQuery): ListQuery;
53
+ //# sourceMappingURL=cursorQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursorQuery.d.ts","sourceRoot":"","sources":["../../src/query/cursorQuery.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAO,SAAS,EAAU,MAAM,aAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,oEAAoE;IACpE,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,2EAA2E;AAC3E,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EACE,KAAK,EACL,QAA0B,EAC1B,SAA8B,GAC/B,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,SAAS,CAQxE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,SAA8B,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,SAAS,CAE3G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAS3D"}
@@ -7,4 +7,5 @@ export * from './queryApi';
7
7
  export * from './sort';
8
8
  export * from './event';
9
9
  export * from './snapshot';
10
+ export * from './cursorQuery';
10
11
  //# 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,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"}
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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher-wow",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Support for Wow(https://github.com/Ahoo-Wang/Wow) in Fetcher",
5
5
  "keywords": [
6
6
  "fetch",
@@ -38,8 +38,8 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "@ahoo-wang/fetcher": "1.6.2",
42
- "@ahoo-wang/fetcher-eventstream": "1.6.2"
41
+ "@ahoo-wang/fetcher": "1.6.3",
42
+ "@ahoo-wang/fetcher-eventstream": "1.6.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@vitest/coverage-v8": "^3.2.4",