@warp-drive/utilities 5.6.0-alpha.15 → 5.6.0-alpha.17

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 (73) hide show
  1. package/declarations/-private/active-record/find-record.d.ts +59 -60
  2. package/declarations/-private/active-record/query.d.ts +50 -51
  3. package/declarations/-private/active-record/save-record.d.ts +136 -134
  4. package/declarations/-private/builder-utils.d.ts +2 -3
  5. package/declarations/-private/handlers/auto-compress.d.ts +142 -143
  6. package/declarations/-private/handlers/gated.d.ts +12 -13
  7. package/declarations/-private/handlers/utils.d.ts +22 -23
  8. package/declarations/-private/json-api/-utils.d.ts +96 -97
  9. package/declarations/-private/json-api/find-record.d.ts +59 -60
  10. package/declarations/-private/json-api/query.d.ts +97 -98
  11. package/declarations/-private/json-api/save-record.d.ts +180 -178
  12. package/declarations/-private/json-api/serialize.d.ts +43 -44
  13. package/declarations/-private/rest/find-record.d.ts +59 -60
  14. package/declarations/-private/rest/query.d.ts +50 -51
  15. package/declarations/-private/rest/save-record.d.ts +136 -134
  16. package/declarations/-private/string/inflect.d.ts +60 -83
  17. package/declarations/-private/string/inflections.d.ts +4 -5
  18. package/declarations/-private/string/transform.d.ts +68 -80
  19. package/declarations/-private.d.ts +1 -2
  20. package/declarations/active-record.d.ts +3 -4
  21. package/declarations/handlers.d.ts +8 -9
  22. package/declarations/index.d.ts +180 -182
  23. package/declarations/json-api.d.ts +5 -6
  24. package/declarations/rest.d.ts +3 -4
  25. package/declarations/string.d.ts +13 -14
  26. package/dist/active-record.js +1 -1
  27. package/dist/{inflect-Dr20y6b1.js → inflect-BSG696t-.js} +0 -32
  28. package/dist/json-api.js +1 -1
  29. package/dist/rest.js +1 -1
  30. package/dist/string.cjs +0 -33
  31. package/dist/string.js +1 -1
  32. package/package.json +5 -5
  33. package/declarations/-private/active-record/find-record.d.ts.map +0 -1
  34. package/declarations/-private/active-record/query.d.ts.map +0 -1
  35. package/declarations/-private/active-record/save-record.d.ts.map +0 -1
  36. package/declarations/-private/builder-utils.d.ts.map +0 -1
  37. package/declarations/-private/derivations.d.ts +0 -23
  38. package/declarations/-private/derivations.d.ts.map +0 -1
  39. package/declarations/-private/handlers/auto-compress.d.ts.map +0 -1
  40. package/declarations/-private/handlers/gated.d.ts.map +0 -1
  41. package/declarations/-private/handlers/utils.d.ts.map +0 -1
  42. package/declarations/-private/json-api/-utils.d.ts.map +0 -1
  43. package/declarations/-private/json-api/find-record.d.ts.map +0 -1
  44. package/declarations/-private/json-api/find-record.type-test.d.ts +0 -2
  45. package/declarations/-private/json-api/find-record.type-test.d.ts.map +0 -1
  46. package/declarations/-private/json-api/query.d.ts.map +0 -1
  47. package/declarations/-private/json-api/query.type-test.d.ts +0 -2
  48. package/declarations/-private/json-api/query.type-test.d.ts.map +0 -1
  49. package/declarations/-private/json-api/save-record.d.ts.map +0 -1
  50. package/declarations/-private/json-api/serialize.d.ts.map +0 -1
  51. package/declarations/-private/rest/find-record.d.ts.map +0 -1
  52. package/declarations/-private/rest/query.d.ts.map +0 -1
  53. package/declarations/-private/rest/save-record.d.ts.map +0 -1
  54. package/declarations/-private/string/inflect.d.ts.map +0 -1
  55. package/declarations/-private/string/inflections.d.ts.map +0 -1
  56. package/declarations/-private/string/transform.d.ts.map +0 -1
  57. package/declarations/-private.d.ts.map +0 -1
  58. package/declarations/active-record.d.ts.map +0 -1
  59. package/declarations/handlers.d.ts.map +0 -1
  60. package/declarations/index.d.ts.map +0 -1
  61. package/declarations/json-api.d.ts.map +0 -1
  62. package/declarations/rest.d.ts.map +0 -1
  63. package/declarations/string.d.ts.map +0 -1
  64. package/dist/-private.js.map +0 -1
  65. package/dist/active-record.js.map +0 -1
  66. package/dist/builder-utils-Donkk-BZ.js.map +0 -1
  67. package/dist/handlers.js.map +0 -1
  68. package/dist/index.js.map +0 -1
  69. package/dist/inflect-Dr20y6b1.js.map +0 -1
  70. package/dist/json-api.js.map +0 -1
  71. package/dist/rest.js.map +0 -1
  72. package/dist/string.cjs.map +0 -1
  73. package/dist/string.js.map +0 -1
@@ -1,153 +1,152 @@
1
- import type { Future, Handler, NextFn } from '@warp-drive/core/request';
2
- import type { RequestContext } from '@warp-drive/core/types/request';
1
+ import type { Future, Handler, NextFn } from "@warp-drive/core/request";
2
+ import type { RequestContext } from "@warp-drive/core/types/request";
3
3
  export declare const SupportsRequestStreams: boolean;
4
4
  interface Constraints {
5
- /**
6
- * The minimum size at which to compress blobs
7
- *
8
- * @default 1000
9
- */
10
- Blob?: number;
11
- /**
12
- * The minimum size at which to compress array buffers
13
- *
14
- * @default 1000
15
- */
16
- ArrayBuffer?: number;
17
- /**
18
- * The minimum size at which to compress typed arrays
19
- *
20
- * @default 1000
21
- */
22
- TypedArray?: number;
23
- /**
24
- * The minimum size at which to compress data views
25
- *
26
- * @default 1000
27
- */
28
- DataView?: number;
29
- /**
30
- * The minimum size at which to compress strings
31
- *
32
- * @default 1000
33
- */
34
- String?: number;
5
+ /**
6
+ * The minimum size at which to compress blobs
7
+ *
8
+ * @default 1000
9
+ */
10
+ Blob?: number;
11
+ /**
12
+ * The minimum size at which to compress array buffers
13
+ *
14
+ * @default 1000
15
+ */
16
+ ArrayBuffer?: number;
17
+ /**
18
+ * The minimum size at which to compress typed arrays
19
+ *
20
+ * @default 1000
21
+ */
22
+ TypedArray?: number;
23
+ /**
24
+ * The minimum size at which to compress data views
25
+ *
26
+ * @default 1000
27
+ */
28
+ DataView?: number;
29
+ /**
30
+ * The minimum size at which to compress strings
31
+ *
32
+ * @default 1000
33
+ */
34
+ String?: number;
35
35
  }
36
36
  /**
37
- * Options for configuring the AutoCompress handler.
38
- *
39
- */
37
+ * Options for configuring the AutoCompress handler.
38
+ *
39
+ */
40
40
  interface CompressionOptions {
41
- /**
42
- * The compression format to use. Must be a valid
43
- * compression format supported by [CompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
44
- *
45
- * The default is `gzip`.
46
- *
47
- */
48
- format?: CompressionFormat;
49
- /**
50
- * Some browsers support `ReadableStream` as a request body. This option
51
- * enables passing the compression stream as the request body instead of
52
- * the final compressed body when the browser supports doing so.
53
- *
54
- * This comes with several caveats:
55
- *
56
- * - the request will be put into `duplex: 'half'` mode. This should be
57
- * transparent to you, but it is worth noting.
58
- * - the request mode cannot be `no-cors` as requests with a `ReadableStream`
59
- * have no content length and thus are a new form of request that triggers
60
- * cors requirements and a preflight request.
61
- * - http/1.x is not supported.
62
- *
63
- * For additional reading about the restrictions of using `ReadableStream`
64
- * as a request body, see the [Chromium Documentation](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#restrictions)
65
- *
66
- * Streaming can be enabled per-request in browsers which support it by
67
- * setting `request.options.allowStreaming` to `true`.
68
- *
69
- * Streaming can be forced even when the browser does not support it by setting
70
- * `request.options.forceStreaming` to `true`. This is useful if later handlers
71
- * in the chain can handle the request body as a stream.
72
- *
73
- * @default false
74
- */
75
- allowStreaming?: boolean;
76
- /**
77
- * If `true`, the request will be forced into streaming mode even
78
- * if the browser does not support it. This is useful if later handlers
79
- * in the chain can handle the request body as a stream.
80
- *
81
- * @default false
82
- */
83
- forceStreaming?: boolean;
84
- /**
85
- * The constraints for the request body. This is used to determine
86
- * whether to compress the request body or not.
87
- *
88
- * The defaults are:
89
- *
90
- * ```ts
91
- * {
92
- * Blob: 1000, // blob.size
93
- * ArrayBuffer: 1000, // buffer.byteLength
94
- * TypedArray: 1000, // array.byteLength
95
- * DataView: 1000, // view.byteLength
96
- * String: 1000, // string.length
97
- * }
98
- * ```
99
- *
100
- * The following body types are never compressed unless explicitly
101
- * configured by the request:
102
- * - `FormData`
103
- * - `URLSearchParams`
104
- * - `ReadableStream`
105
- *
106
- * A request.options.compress value of `false` will disable
107
- * compression for a request body of any type. While a value of
108
- * `true` will enable compression for the request.
109
- *
110
- * An undefined value will use the default, a value of `0` will
111
- * enable compression for all values, and a value of `-1` will
112
- * disable compression.
113
- *
114
- */
115
- constraints?: Constraints;
41
+ /**
42
+ * The compression format to use. Must be a valid
43
+ * compression format supported by [CompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
44
+ *
45
+ * The default is `gzip`.
46
+ *
47
+ */
48
+ format?: CompressionFormat;
49
+ /**
50
+ * Some browsers support `ReadableStream` as a request body. This option
51
+ * enables passing the compression stream as the request body instead of
52
+ * the final compressed body when the browser supports doing so.
53
+ *
54
+ * This comes with several caveats:
55
+ *
56
+ * - the request will be put into `duplex: 'half'` mode. This should be
57
+ * transparent to you, but it is worth noting.
58
+ * - the request mode cannot be `no-cors` as requests with a `ReadableStream`
59
+ * have no content length and thus are a new form of request that triggers
60
+ * cors requirements and a preflight request.
61
+ * - http/1.x is not supported.
62
+ *
63
+ * For additional reading about the restrictions of using `ReadableStream`
64
+ * as a request body, see the [Chromium Documentation](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#restrictions)
65
+ *
66
+ * Streaming can be enabled per-request in browsers which support it by
67
+ * setting `request.options.allowStreaming` to `true`.
68
+ *
69
+ * Streaming can be forced even when the browser does not support it by setting
70
+ * `request.options.forceStreaming` to `true`. This is useful if later handlers
71
+ * in the chain can handle the request body as a stream.
72
+ *
73
+ * @default false
74
+ */
75
+ allowStreaming?: boolean;
76
+ /**
77
+ * If `true`, the request will be forced into streaming mode even
78
+ * if the browser does not support it. This is useful if later handlers
79
+ * in the chain can handle the request body as a stream.
80
+ *
81
+ * @default false
82
+ */
83
+ forceStreaming?: boolean;
84
+ /**
85
+ * The constraints for the request body. This is used to determine
86
+ * whether to compress the request body or not.
87
+ *
88
+ * The defaults are:
89
+ *
90
+ * ```ts
91
+ * {
92
+ * Blob: 1000, // blob.size
93
+ * ArrayBuffer: 1000, // buffer.byteLength
94
+ * TypedArray: 1000, // array.byteLength
95
+ * DataView: 1000, // view.byteLength
96
+ * String: 1000, // string.length
97
+ * }
98
+ * ```
99
+ *
100
+ * The following body types are never compressed unless explicitly
101
+ * configured by the request:
102
+ * - `FormData`
103
+ * - `URLSearchParams`
104
+ * - `ReadableStream`
105
+ *
106
+ * A request.options.compress value of `false` will disable
107
+ * compression for a request body of any type. While a value of
108
+ * `true` will enable compression for the request.
109
+ *
110
+ * An undefined value will use the default, a value of `0` will
111
+ * enable compression for all values, and a value of `-1` will
112
+ * disable compression.
113
+ *
114
+ */
115
+ constraints?: Constraints;
116
116
  }
117
117
  /**
118
- * A request handler that automatically compresses the request body
119
- * if the request body is a string, array buffer, blob, or form data.
120
- *
121
- * This uses the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
122
- *
123
- * The compression format as well as the kinds of data to compress can be
124
- * configured using the `format` and `constraints` options.
125
- *
126
- * ```diff
127
- * +import { AutoCompress } from '@ember-data/request-utils/handlers';
128
- * import Fetch from '@ember-data/request/fetch';
129
- * import RequestManager from '@ember-data/request';
130
- * import Store from '@ember-data/store';
131
- *
132
- * class AppStore extends Store {
133
- * requestManager = new RequestManager()
134
- * .use([
135
- * + new AutoCompress(),
136
- * Fetch
137
- * ]);
138
- * }
139
- * ```
140
- *
141
- * @class AutoCompress
142
- * @public
143
- * @since 5.5.0
144
- */
118
+ * A request handler that automatically compresses the request body
119
+ * if the request body is a string, array buffer, blob, or form data.
120
+ *
121
+ * This uses the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
122
+ *
123
+ * The compression format as well as the kinds of data to compress can be
124
+ * configured using the `format` and `constraints` options.
125
+ *
126
+ * ```diff
127
+ * +import { AutoCompress } from '@ember-data/request-utils/handlers';
128
+ * import Fetch from '@ember-data/request/fetch';
129
+ * import RequestManager from '@ember-data/request';
130
+ * import Store from '@ember-data/store';
131
+ *
132
+ * class AppStore extends Store {
133
+ * requestManager = new RequestManager()
134
+ * .use([
135
+ * + new AutoCompress(),
136
+ * Fetch
137
+ * ]);
138
+ * }
139
+ * ```
140
+ *
141
+ * @class AutoCompress
142
+ * @public
143
+ * @since 5.5.0
144
+ */
145
145
  export declare class AutoCompress implements Handler {
146
- options: Required<CompressionOptions> & {
147
- constraints: Required<Constraints>;
148
- };
149
- constructor(options?: CompressionOptions);
150
- request<T>({ request }: RequestContext, next: NextFn<T>): Promise<T> | Future<T>;
146
+ options: Required<CompressionOptions> & {
147
+ constraints: Required<Constraints>;
148
+ };
149
+ constructor(options?: CompressionOptions);
150
+ request<T>({ request }: RequestContext, next: NextFn<T>): Promise<T> | Future<T>;
151
151
  }
152
152
  export {};
153
- //# sourceMappingURL=auto-compress.d.ts.map
@@ -1,19 +1,18 @@
1
- import type { Future, Handler, NextFn } from '@warp-drive/core/request';
2
- import type { RequestContext, StructuredDataDocument } from '@warp-drive/core/types/request';
1
+ import type { Future, Handler, NextFn } from "@warp-drive/core/request";
2
+ import type { RequestContext, StructuredDataDocument } from "@warp-drive/core/types/request";
3
3
  /**
4
- * If CheckFn returns true, the wrapped handler will be used.
5
- * If CheckFn returns false, the wrapped handler will be skipped.
6
- */
4
+ * If CheckFn returns true, the wrapped handler will be used.
5
+ * If CheckFn returns false, the wrapped handler will be skipped.
6
+ */
7
7
  type CheckFn = (context: RequestContext) => boolean;
8
8
  /**
9
- *
10
- * @public
11
- */
9
+ *
10
+ * @public
11
+ */
12
12
  export declare class Gate implements Handler {
13
- handler: Handler;
14
- checkFn: CheckFn;
15
- constructor(handler: Handler, checkFn: CheckFn);
16
- request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T>;
13
+ handler: Handler;
14
+ checkFn: CheckFn;
15
+ constructor(handler: Handler, checkFn: CheckFn);
16
+ request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T>;
17
17
  }
18
18
  export {};
19
- //# sourceMappingURL=gated.d.ts.map
@@ -1,33 +1,32 @@
1
1
  /**
2
- * A unique identifier for the current browser tab
3
- * useful for observability/tracing and deduping
4
- * across multiple tabs.
5
- */
2
+ * A unique identifier for the current browser tab
3
+ * useful for observability/tracing and deduping
4
+ * across multiple tabs.
5
+ */
6
6
  export declare const TAB_ID: string;
7
7
  /**
8
- * The epoch seconds at which the tab id was generated
9
- */
8
+ * The epoch seconds at which the tab id was generated
9
+ */
10
10
  export declare const TAB_ASSIGNED: number;
11
11
  /**
12
- * Adds the `X-Amzn-Trace-Id` header to support observability
13
- * tooling around request routing.
14
- *
15
- * This makes use of the {@link TAB_ID} and {@link TAB_ASSIGNED}
16
- * to enable tracking the browser tab of origin across multiple requests.
17
- *
18
- * Follows the template: `Root=1-${now}-${uuidv4};TabId=1-${epochSeconds}-${tab-uuid}`
19
- */
12
+ * Adds the `X-Amzn-Trace-Id` header to support observability
13
+ * tooling around request routing.
14
+ *
15
+ * This makes use of the {@link TAB_ID} and {@link TAB_ASSIGNED}
16
+ * to enable tracking the browser tab of origin across multiple requests.
17
+ *
18
+ * Follows the template: `Root=1-${now}-${uuidv4};TabId=1-${epochSeconds}-${tab-uuid}`
19
+ */
20
20
  export declare function addTraceHeader(headers: Headers): Headers;
21
21
  /**
22
- * Source: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
23
- * As of 2024-12-05 the maximum URL length is 8192 bytes.
24
- *
25
- */
22
+ * Source: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
23
+ * As of 2024-12-05 the maximum URL length is 8192 bytes.
24
+ *
25
+ */
26
26
  export declare const MAX_URL_LENGTH = 8192;
27
27
  /**
28
- * This assertion takes a URL and throws an error if the URL is longer than the maximum URL length.
29
- *
30
- * See also {@link MAX_URL_LENGTH}
31
- */
28
+ * This assertion takes a URL and throws an error if the URL is longer than the maximum URL length.
29
+ *
30
+ * See also {@link MAX_URL_LENGTH}
31
+ */
32
32
  export declare function assertInvalidUrlLength(url: string | undefined): void;
33
- //# sourceMappingURL=utils.d.ts.map
@@ -1,110 +1,109 @@
1
- import type { QueryParamsSource } from '@warp-drive/core/types/params';
2
- import type { BuildURLConfig } from '../../index.ts';
1
+ import type { QueryParamsSource } from "@warp-drive/core/types/params";
2
+ import type { BuildURLConfig } from "../../index.js";
3
3
  export interface JSONAPIConfig extends BuildURLConfig {
4
- profiles?: {
5
- pagination?: string;
6
- [key: string]: string | undefined;
7
- };
8
- extensions?: {
9
- atomic?: string;
10
- [key: string]: string | undefined;
11
- };
4
+ profiles?: {
5
+ pagination?: string;
6
+ [key: string]: string | undefined;
7
+ };
8
+ extensions?: {
9
+ atomic?: string;
10
+ [key: string]: string | undefined;
11
+ };
12
12
  }
13
13
  export declare let CONFIG: JSONAPIConfig;
14
14
  export declare let ACCEPT_HEADER_VALUE: string;
15
15
  /**
16
- * Allows setting extensions and profiles to be used in the `Accept` header.
17
- *
18
- * Extensions and profiles are keyed by their namespace with the value being
19
- * their URI.
20
- *
21
- * Example:
22
- *
23
- * ```ts
24
- * setBuildURLConfig({
25
- * extensions: {
26
- * atomic: 'https://jsonapi.org/ext/atomic'
27
- * },
28
- * profiles: {
29
- * pagination: 'https://jsonapi.org/profiles/ethanresnick/cursor-pagination'
30
- * }
31
- * });
32
- * ```
33
- *
34
- * This also sets the global configuration for `buildBaseURL`
35
- * for host and namespace values for the global coniguration
36
- * done via `import { setBuildURLConfig } from '@warp-drive/utilities';`
37
- *
38
- * These values may still be overridden by passing
39
- * them to buildBaseURL directly.
40
- *
41
- * This method may be called as many times as needed
42
- *
43
- * ```ts
44
- * type BuildURLConfig = {
45
- * host: string;
46
- * namespace: string'
47
- * }
48
- * ```
49
- *
50
- * @public
51
- * @param {BuildURLConfig} config
52
- * @return {void}
53
- */
16
+ * Allows setting extensions and profiles to be used in the `Accept` header.
17
+ *
18
+ * Extensions and profiles are keyed by their namespace with the value being
19
+ * their URI.
20
+ *
21
+ * Example:
22
+ *
23
+ * ```ts
24
+ * setBuildURLConfig({
25
+ * extensions: {
26
+ * atomic: 'https://jsonapi.org/ext/atomic'
27
+ * },
28
+ * profiles: {
29
+ * pagination: 'https://jsonapi.org/profiles/ethanresnick/cursor-pagination'
30
+ * }
31
+ * });
32
+ * ```
33
+ *
34
+ * This also sets the global configuration for `buildBaseURL`
35
+ * for host and namespace values for the global coniguration
36
+ * done via `import { setBuildURLConfig } from '@warp-drive/utilities';`
37
+ *
38
+ * These values may still be overridden by passing
39
+ * them to buildBaseURL directly.
40
+ *
41
+ * This method may be called as many times as needed
42
+ *
43
+ * ```ts
44
+ * type BuildURLConfig = {
45
+ * host: string;
46
+ * namespace: string'
47
+ * }
48
+ * ```
49
+ *
50
+ * @public
51
+ * @param {BuildURLConfig} config
52
+ * @return {void}
53
+ */
54
54
  export declare function setBuildURLConfig(config: JSONAPIConfig): void;
55
55
  interface RelatedObject {
56
- [key: string]: string | string[] | RelatedObject;
56
+ [key: string]: string | string[] | RelatedObject;
57
57
  }
58
58
  export type JsonApiQuery = {
59
- include?: string | string[] | RelatedObject;
60
- fields?: Record<string, string | string[]>;
61
- page?: {
62
- size?: number;
63
- after?: string;
64
- before?: string;
65
- };
59
+ include?: string | string[] | RelatedObject;
60
+ fields?: Record<string, string | string[]>;
61
+ page?: {
62
+ size?: number;
63
+ after?: string;
64
+ before?: string;
65
+ };
66
66
  };
67
67
  /**
68
- * Sorts query params by both key and value, returning a query params string
69
- *
70
- * Treats `included` specially, splicing it into an array if it is a string and sorting the array.
71
- * - If `included` is an object we build paths dynamically for you
72
- * Treats `fields` specially, building JSON:API partial fields params from an object
73
- * Treats `page` specially, building cursor-pagination profile page params from an object
74
- *
75
- * ```ts
76
- * const params = buildQueryParams({
77
- * include: {
78
- * company: {
79
- * locations: 'address'
80
- * }
81
- * },
82
- * fields: {
83
- * company: ['name', 'ticker'],
84
- * person: 'name'
85
- * },
86
- * page: {
87
- * size: 10,
88
- * after: 'abc',
89
- * }
90
- * });
91
- *
92
- * // => 'fields[company]=name,ticker&fields[person]=name&include=company.locations,company.locations.address&page[after]=abc&page[size]=10'
93
- * ```
94
- *
95
- * Options:
96
- * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
97
- *
98
- * 'bracket': appends [] to the key for every value e.g. `ids[]=1&ids[]=2`
99
- * 'indices': appends [i] to the key for every value e.g. `ids[0]=1&ids[1]=2`
100
- * 'repeat': appends the key for every value e.g. `ids=1&ids=2`
101
- * 'comma' (default): appends the key once with a comma separated list of values e.g. `ids=1,2`
102
- *
103
- * @public
104
- * @param {URLSearchParams | Object} params
105
- * @param {Object} [options]
106
- * @return {String} A sorted query params string without the leading `?`
107
- */
68
+ * Sorts query params by both key and value, returning a query params string
69
+ *
70
+ * Treats `included` specially, splicing it into an array if it is a string and sorting the array.
71
+ * - If `included` is an object we build paths dynamically for you
72
+ * Treats `fields` specially, building JSON:API partial fields params from an object
73
+ * Treats `page` specially, building cursor-pagination profile page params from an object
74
+ *
75
+ * ```ts
76
+ * const params = buildQueryParams({
77
+ * include: {
78
+ * company: {
79
+ * locations: 'address'
80
+ * }
81
+ * },
82
+ * fields: {
83
+ * company: ['name', 'ticker'],
84
+ * person: 'name'
85
+ * },
86
+ * page: {
87
+ * size: 10,
88
+ * after: 'abc',
89
+ * }
90
+ * });
91
+ *
92
+ * // => 'fields[company]=name,ticker&fields[person]=name&include=company.locations,company.locations.address&page[after]=abc&page[size]=10'
93
+ * ```
94
+ *
95
+ * Options:
96
+ * - arrayFormat: 'bracket' | 'indices' | 'repeat' | 'comma'
97
+ *
98
+ * 'bracket': appends [] to the key for every value e.g. `ids[]=1&ids[]=2`
99
+ * 'indices': appends [i] to the key for every value e.g. `ids[0]=1&ids[1]=2`
100
+ * 'repeat': appends the key for every value e.g. `ids=1&ids=2`
101
+ * 'comma' (default): appends the key once with a comma separated list of values e.g. `ids=1,2`
102
+ *
103
+ * @public
104
+ * @param {URLSearchParams | Object} params
105
+ * @param {Object} [options]
106
+ * @return {String} A sorted query params string without the leading `?`
107
+ */
108
108
  export declare function buildQueryParams(query: JsonApiQuery | QueryParamsSource): string;
109
109
  export {};
110
- //# sourceMappingURL=-utils.d.ts.map