@warp-drive/utilities 5.6.0-alpha.11 → 5.6.0-alpha.13

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,23 @@
1
+ import type { ReactiveResource } from '@warp-drive/core/reactive';
2
+ /**
3
+ * A derivation for use by {@link ReactiveResource} that joins the given fields
4
+ * with the optional separator (or '' if no separator is provided).
5
+ *
6
+ * Generally you should not need to import and use this function directly.
7
+ *
8
+ * @example
9
+ * {
10
+ * name: 'fullName',
11
+ * kind: 'derived',
12
+ * type: 'concat',
13
+ * options: {
14
+ * fields: ['firstName', 'lastName'],
15
+ * separator: ' ',
16
+ * },
17
+ * }
18
+ */
19
+ export declare function concat(record: ReactiveResource & {
20
+ [key: string]: unknown;
21
+ }, options: Record<string, unknown> | null, _prop: string): string;
22
+ export declare namespace concat { }
23
+ //# sourceMappingURL=derivations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivations.d.ts","sourceRoot":"","sources":["../../src/-private/derivations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,gBAAgB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EACrD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,KAAK,EAAE,MAAM,GACZ,MAAM,CAQR;yBAZe,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"auto-compress.d.ts","sourceRoot":"","sources":["../../../src/-private/handlers/auto-compress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAMjF,eA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;AAMjF,eAAO,MAAM,sBAAsB,SAc/B,CAAC;AAEL,UAAU,WAAW;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,UAAU,kBAAkB;IAC1B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,YAAa,YAAW,OAAO;IAClC,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG;QAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;gBAE3E,OAAO,GAAE,kBAAuB;IAU5C,OAAO,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;CA4DjF"}
@@ -0,0 +1,19 @@
1
+ import type { Future, Handler, NextFn } from '@warp-drive/core/request';
2
+ import type { RequestContext, StructuredDataDocument } from '@warp-drive/core/types/request';
3
+ /**
4
+ * If CheckFn returns true, the wrapped handler will be used.
5
+ * If CheckFn returns false, the wrapped handler will be skipped.
6
+ */
7
+ type CheckFn = (context: RequestContext) => boolean;
8
+ /**
9
+ *
10
+ * @public
11
+ */
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>;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=gated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gated.d.ts","sourceRoot":"","sources":["../../../src/-private/handlers/gated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7F;;;GAGG;AACH,KAAK,OAAO,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;AAEpD;;;GAGG;AACH,qBAAa,IAAK,YAAW,OAAO;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IAK9C,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;CAMnH"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A unique identifier for the current browser tab
3
+ * useful for observability/tracing and deduping
4
+ * across multiple tabs.
5
+ */
6
+ export declare const TAB_ID: string;
7
+ /**
8
+ * The epoch seconds at which the tab id was generated
9
+ */
10
+ export declare const TAB_ASSIGNED: number;
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
+ */
20
+ export declare function addTraceHeader(headers: Headers): Headers;
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
+ */
26
+ export declare const MAX_URL_LENGTH = 8192;
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
+ */
32
+ export declare function assertInvalidUrlLength(url: string | undefined): void;
33
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/-private/handlers/utils.ts"],"names":[],"mappings":"AA4BA;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAa,CAAC;AACjC;;GAEG;AACH,eAAO,MAAM,YAAY,QAAgC,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,WAK9C;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,QAK7D"}
@@ -1,70 +1,3 @@
1
- /**
2
- *
3
- *
4
- *This package provides utilities for working with [ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html#convention-over-configuration-in-active-record) APIs.
5
- *
6
- * ## Installation
7
- *
8
- * Install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)
9
- *
10
- * ::: code-group
11
- *
12
- * ```sh [pnpm]
13
- * pnpm add -E @ember-data/active-record
14
- * ```
15
- *
16
- * ```sh [npm]
17
- * npm add -E @ember-data/active-record
18
- * ```
19
- *
20
- * ```sh [yarn]
21
- * yarn add -E @ember-data/active-record
22
- * ```
23
- *
24
- * ```sh [bun]
25
- * bun add --exact @ember-data/active-record
26
- * ```
27
- *
28
- * :::
29
- *
30
- * ## Usage
31
- *
32
- * Request builders are functions that produce [Fetch Options](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
33
- * They take a few contextual inputs about the request you want to make, abstracting away the gnarlier details.
34
- *
35
- * For instance, to construct a request that would fetch a resource from your API:
36
- *
37
- * ```ts
38
- * import { findRecord } from '@ember-data/active-record/request';
39
- *
40
- * const options = findRecord('ember-developer', '1', { include: ['pets', 'friends'] });
41
- * ```
42
- *
43
- * This would produce the following request object:
44
- *
45
- * ```js
46
- * {
47
- * url: 'https://api.example.com/v1/ember_developers/1?include=friends,pets',
48
- * method: 'GET',
49
- * headers: <Headers>, // 'Accept': 'application/json;charset=utf-8'
50
- * op: 'findRecord';
51
- * records: [{ type: 'ember-developer', id: '1' }]
52
- * }
53
- * ```
54
- *
55
- * Request builder output may be used with either `requestManager.request` or `store.request`.
56
- *
57
- * ```ts
58
- * const data = await store.request(options);
59
- * ```
60
- *
61
- * URLs are stable. The same query will produce the same URL every time, even if the order of keys in
62
- * the query or values in an array changes.
63
- *
64
- * URLs follow the most common ActiveRecord format (underscored pluralized resource types).
65
- *
66
- * @module
67
- */
68
1
  export { findRecord } from './-private/active-record/find-record';
69
2
  export { query } from './-private/active-record/query';
70
3
  export { deleteRecord, createRecord, updateRecord } from './-private/active-record/save-record';
@@ -1 +1 @@
1
- {"version":3,"file":"active-record.d.ts","sourceRoot":"","sources":["../src/active-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"active-record.d.ts","sourceRoot":"","sources":["../src/active-record.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC"}
@@ -5,4 +5,6 @@
5
5
  * @module
6
6
  */
7
7
  export { AutoCompress, SupportsRequestStreams } from './-private/handlers/auto-compress.ts';
8
+ export { Gate } from './-private/handlers/gated.ts';
9
+ export { addTraceHeader, TAB_ASSIGNED, TAB_ID, assertInvalidUrlLength, MAX_URL_LENGTH, } from './-private/handlers/utils.ts';
8
10
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,MAAM,EACN,sBAAsB,EACtB,cAAc,GACf,MAAM,8BAA8B,CAAC"}
@@ -1,42 +1,8 @@
1
- import type { QueryParamsSerializationOptions, QueryParamsSource, Serializable } from '@warp-drive/core/types/params';
2
1
  /**
3
- * Simple utility function to assist in url building,
4
- * query params, and other common request operations.
5
- *
6
- * These primitives may be used directly or composed
7
- * by request builders to provide a consistent interface
8
- * for building requests.
9
- *
10
- * For instance:
11
- *
12
- * ```ts
13
- * import { buildBaseURL, buildQueryParams } from '@ember-data/request-utils';
14
- *
15
- * const baseURL = buildBaseURL({
16
- * host: 'https://api.example.com',
17
- * namespace: 'api/v1',
18
- * resourcePath: 'emberDevelopers',
19
- * op: 'query',
20
- * identifier: { type: 'ember-developer' }
21
- * });
22
- * const url = `${baseURL}?${buildQueryParams({ name: 'Chris', include:['pets'] })}`;
23
- * // => 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris'
24
- * ```
25
- *
26
- * This is useful, but not as useful as the REST request builder for query which is sugar
27
- * over this (and more!):
28
- *
29
- * ```ts
30
- * import { query } from '@ember-data/rest/request';
31
- *
32
- * const options = query('ember-developer', { name: 'Chris', include:['pets'] });
33
- * // => { url: 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris' }
34
- * // Note: options will also include other request options like headers, method, etc.
35
- * ```
36
- *
37
2
  * @module
38
- * @public
3
+ * @mergeModuleWith <project>
39
4
  */
5
+ import type { QueryParamsSerializationOptions, QueryParamsSource, Serializable } from '@warp-drive/core/types/params';
40
6
  export interface BuildURLConfig {
41
7
  host: string | null;
42
8
  namespace: string | null;
@@ -75,8 +41,6 @@ export interface BuildURLConfig {
75
41
  * ```
76
42
  *
77
43
  * @public
78
- * @param {BuildURLConfig} config
79
- * @return {void}
80
44
  */
81
45
  export declare function setBuildURLConfig(config: BuildURLConfig): void;
82
46
  export interface FindRecordUrlOptions {
@@ -200,8 +164,6 @@ export type UrlOptions = FindRecordUrlOptions | QueryUrlOptions | FindManyUrlOpt
200
164
  * - Depending on the value of `op`, `identifier` or `identifiers` will be required.
201
165
  *
202
166
  * @public
203
- * @param urlOptions
204
- * @return {String}
205
167
  */
206
168
  export declare function buildBaseURL(urlOptions: UrlOptions): string;
207
169
  /**
@@ -209,8 +171,8 @@ export declare function buildBaseURL(urlOptions: UrlOptions): string;
209
171
  * returning a new object with only those keys that have truthy values / non-empty arrays
210
172
  *
211
173
  * @public
212
- * @param {Record<string, Serializable>} source object to filter keys with empty values from
213
- * @return {Record<string, Serializable>} A new object with the keys that contained empty values removed
174
+ * @param source object to filter keys with empty values from
175
+ * @return A new object with the keys that contained empty values removed
214
176
  */
215
177
  export declare function filterEmpty(source: Record<string, Serializable>): Record<string, Serializable>;
216
178
  /**
@@ -228,9 +190,7 @@ export declare function filterEmpty(source: Record<string, Serializable>): Recor
228
190
  * 'comma' (default): appends the key once with a comma separated list of values e.g. `&ids=1,2`
229
191
  *
230
192
  * @public
231
- * @param {URLSearchParams | object} params
232
- * @param {Object} options
233
- * @return {URLSearchParams} A URLSearchParams with keys inserted in sorted order
193
+ * @return A {@link URLSearchParams} with keys inserted in sorted order
234
194
  */
235
195
  export declare function sortQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): URLSearchParams;
236
196
  /**
@@ -247,9 +207,7 @@ export declare function sortQueryParams(params: QueryParamsSource, options?: Que
247
207
  * 'comma' (default): appends the key once with a comma separated list of values e.g. `ids=1,2`
248
208
  *
249
209
  * @public
250
- * @param {URLSearchParams | Object} params
251
- * @param {Object} [options]
252
- * @return {String} A sorted query params string without the leading `?`
210
+ * @return A sorted query params string without the leading `?`
253
211
  */
254
212
  export declare function buildQueryParams(params: QueryParamsSource, options?: QueryParamsSerializationOptions): string;
255
213
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEtH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAMH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,QAsBvD;AAED,MAAM,WAAW,oB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,CAE7G"}
@@ -1,48 +1,3 @@
1
- /**
2
- This package provides utilities for working with [JSON:API](https://json-api.org) APIs with [*Ember***Data**](https://github.com/emberjs/data/).
3
-
4
- ## Installation
5
-
6
- Install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)
7
-
8
- ```no-highlight
9
- pnpm add @ember-data/json-api
10
- ```
11
-
12
- ## Usage
13
-
14
- Request builders are functions that produce [Fetch Options](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
15
- They take a few contextual inputs about the request you want to make, abstracting away the gnarlier details.
16
-
17
- For instance, to fetch a resource from your API
18
-
19
- ```ts
20
- import { findRecord } from '@ember-data/json-api/request';
21
-
22
- const options = findRecord('ember-developer', '1', { include: ['pets', 'friends'] });
23
-
24
- /*
25
- {
26
- url: 'https://api.example.com/v1/ember-developers/1?include=friends,pets',
27
- method: 'GET',
28
- headers: <Headers>,
29
- // => 'Accept': 'application/vnd.api+json'
30
- // => 'Content-Type': 'application/vnd.api+json'
31
- op: 'findRecord';
32
- records: [{ type: 'ember-developer', id: '1' }]
33
- }
34
- *\
35
- ```
36
-
37
- Request builder output may be used with either `requestManager.request` or `store.request`.
38
-
39
- URLs are stable. The same query will produce the same URL every time, even if the order of keys in
40
- the query or values in an array changes.
41
-
42
- URLs follow the most common JSON:API format (dasherized pluralized resource types).
43
- *
44
- * @module
45
- */
46
1
  export { findRecord } from './-private/json-api/find-record';
47
2
  export { query, postQuery } from './-private/json-api/query';
48
3
  export { deleteRecord, createRecord, updateRecord } from './-private/json-api/save-record';
@@ -1 +1 @@
1
- {"version":3,"file":"json-api.d.ts","sourceRoot":"","sources":["../src/json-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"json-api.d.ts","sourceRoot":"","sources":["../src/json-api.ts"],"names":[],"mappings":"AAkDA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,50 +1,3 @@
1
- /**
2
- This package provides utilities for working with **REST**ful APIs with [*Ember***Data**](https://github.com/emberjs/data/).
3
-
4
- ## Installation
5
-
6
- Install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)
7
-
8
- ```no-highlight
9
- pnpm add @ember-data/json-api
10
- ```
11
-
12
- ## Usage
13
-
14
- Request builders are functions that produce [Fetch Options](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
15
- They take a few contextual inputs about the request you want to make, abstracting away the gnarlier details.
16
-
17
- For instance, to fetch a resource from your API
18
-
19
- ```ts
20
- import { findRecord } from '@ember-data/rest/request';
21
-
22
- const options = findRecord('ember-developer', '1', { include: ['pets', 'friends'] });
23
-
24
- /*
25
- => {
26
- url: 'https://api.example.com/v1/emberDevelopers/1?include=friends,pets',
27
- method: 'GET',
28
- headers: <Headers>, // 'Content-Type': 'application/json;charset=utf-8'
29
- op: 'findRecord';
30
- records: [{ type: 'ember-developer', id: '1' }]
31
- }
32
- * /
33
- ```
34
-
35
- Request builder output is ready to go for use with [store.request](https://api.emberjs.com/ember-data/release/classes/Store/methods/request?anchor=request),
36
- [manager.request](https://api.emberjs.com/ember-data/release/classes/RequestManager/methods/request?anchor=request) and most conventional REST APIs.
37
-
38
- Resource types are pluralized and camelized for the url.
39
-
40
- URLs are stable. The same query will produce the same URL every time, even if the order of keys in
41
- the query or values in an array changes.
42
-
43
- URLs follow the most common REST format (camelCase pluralized resource types).
44
-
45
- * @module
46
- * @public
47
- */
48
1
  export { findRecord } from './-private/rest/find-record';
49
2
  export { query } from './-private/rest/query';
50
3
  export { deleteRecord, createRecord, updateRecord } from './-private/rest/save-record';
@@ -1 +1 @@
1
- {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../src/rest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../src/rest.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * String utilties for transforming and inflecting strings useful for
2
+ * String utilities for transforming and inflecting strings useful for
3
3
  * when the format provided by the server is not the format you want to use
4
4
  * in your application.
5
5
  *
@@ -8,6 +8,7 @@
8
8
  * using the `setMaxLRUCacheSize` function. The default size is 10,000.
9
9
  *
10
10
  * @module
11
+ * @public
11
12
  */
12
13
  export { pluralize, singularize, singular, plural, loadIrregular, loadUncountable, irregular, uncountable, resetToDefaults, clear, clearRules, } from './-private/string/inflect.ts';
13
14
  export { dasherize, camelize, capitalize, underscore, setMaxLRUCacheSize } from './-private/string/transform.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,UAAU,GACX,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,UAAU,GACX,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { buildBaseURL, buildQueryParams } from "./index.js";
2
- import { p as pluralize, j as underscore } from "./inflect-C1laviCe.js";
1
+ import { buildBaseURL, buildQueryParams } from './index.js';
2
+ import { p as pluralize, j as underscore } from "./inflect-Dr20y6b1.js";
3
3
  import { e as extractCacheOptions, c as copyForwardUrlOptions } from "./builder-utils-Donkk-BZ.js";
4
4
  import { recordIdentifierFor } from '@warp-drive/core';
5
5
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
package/dist/handlers.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
1
2
  function isCompressibleMethod(method) {
2
3
  return method === 'POST' || method === 'PUT' || method === 'PATCH' || method === 'DELETE';
3
4
  }
@@ -97,7 +98,8 @@ class AutoCompress {
97
98
  const allowStreaming = request.options?.allowStreaming ?? this.options.allowStreaming;
98
99
  if (forceStreaming || SupportsRequestStreams && allowStreaming) {
99
100
  const req = Object.assign({}, request, {
100
- body: stream
101
+ body: stream,
102
+ headers
101
103
  });
102
104
  if (SupportsRequestStreams) {
103
105
  // @ts-expect-error untyped
@@ -109,17 +111,17 @@ class AutoCompress {
109
111
  // For non-chromium browsers, we have to "pull" the stream to get the final
110
112
  // bytes and supply the final byte array as the new request body.
111
113
  //
112
- } else {
113
- // we need to pull the stream to get the final bytes
114
- const resp = new Response(stream);
115
- return resp.blob().then(blob => {
116
- const req = Object.assign({}, request, {
117
- body: blob,
118
- headers
119
- });
120
- return next(req);
121
- });
122
114
  }
115
+
116
+ // we need to pull the stream to get the final bytes
117
+ const resp = new Response(stream);
118
+ return resp.blob().then(blob => {
119
+ const req = Object.assign({}, request, {
120
+ body: blob,
121
+ headers
122
+ });
123
+ return next(req);
124
+ });
123
125
  }
124
126
  }
125
127
  function canCompress(type, constraints, size) {
@@ -135,7 +137,103 @@ function encodingForFormat(format) {
135
137
  case 'deflate-raw':
136
138
  return format;
137
139
  default:
138
- throw new Error(`Unsupported compression format: ${format}`);
140
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
141
+ {
142
+ throw new Error(`Unsupported compression format: ${format}`);
143
+ }
144
+ })() : {};
145
+ // @ts-expect-error - unreachable code is reachable in production
146
+ return format;
139
147
  }
140
148
  }
141
- export { AutoCompress, SupportsRequestStreams };
149
+
150
+ /**
151
+ * If CheckFn returns true, the wrapped handler will be used.
152
+ * If CheckFn returns false, the wrapped handler will be skipped.
153
+ */
154
+
155
+ /**
156
+ *
157
+ * @public
158
+ */
159
+ class Gate {
160
+ constructor(handler, checkFn) {
161
+ this.handler = handler;
162
+ this.checkFn = checkFn;
163
+ }
164
+ request(context, next) {
165
+ if (this.checkFn(context)) {
166
+ return this.handler.request(context, next);
167
+ }
168
+ return next(context.request);
169
+ }
170
+ }
171
+ if (typeof FastBoot === 'undefined') {
172
+ globalThis.addEventListener('beforeunload', function () {
173
+ sessionStorage.setItem('tab-closed', 'true');
174
+ });
175
+ }
176
+ function getTabId() {
177
+ if (typeof sessionStorage === 'undefined') {
178
+ return crypto.randomUUID();
179
+ }
180
+ const tabId = sessionStorage.getItem('tab-id');
181
+ if (tabId) {
182
+ const tabClosed = sessionStorage.getItem('tab-closed');
183
+ if (tabClosed === 'true') {
184
+ return tabId;
185
+ }
186
+
187
+ // fall through to generate a new tab id
188
+ }
189
+ const newTabId = crypto.randomUUID();
190
+ sessionStorage.setItem('tab-id', newTabId);
191
+ return newTabId;
192
+ }
193
+
194
+ /**
195
+ * A unique identifier for the current browser tab
196
+ * useful for observability/tracing and deduping
197
+ * across multiple tabs.
198
+ */
199
+ const TAB_ID = getTabId();
200
+ /**
201
+ * The epoch seconds at which the tab id was generated
202
+ */
203
+ const TAB_ASSIGNED = Math.floor(Date.now() / 1000);
204
+
205
+ /**
206
+ * Adds the `X-Amzn-Trace-Id` header to support observability
207
+ * tooling around request routing.
208
+ *
209
+ * This makes use of the {@link TAB_ID} and {@link TAB_ASSIGNED}
210
+ * to enable tracking the browser tab of origin across multiple requests.
211
+ *
212
+ * Follows the template: `Root=1-${now}-${uuidv4};TabId=1-${epochSeconds}-${tab-uuid}`
213
+ */
214
+ function addTraceHeader(headers) {
215
+ const now = Math.floor(Date.now() / 1000);
216
+ headers.set('X-Amzn-Trace-Id', `Root=1-${now}-${crypto.randomUUID()};TabId=1-${TAB_ASSIGNED}-${TAB_ID}`);
217
+ return headers;
218
+ }
219
+
220
+ /**
221
+ * Source: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
222
+ * As of 2024-12-05 the maximum URL length is 8192 bytes.
223
+ *
224
+ */
225
+ const MAX_URL_LENGTH = 8192;
226
+
227
+ /**
228
+ * This assertion takes a URL and throws an error if the URL is longer than the maximum URL length.
229
+ *
230
+ * See also {@link MAX_URL_LENGTH}
231
+ */
232
+ function assertInvalidUrlLength(url) {
233
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
234
+ if (!test) {
235
+ throw new Error(`URL length ${url?.length} exceeds the maximum URL length of ${MAX_URL_LENGTH} bytes.\n\nConsider converting this request query a \`/query\` endpoint instead of a GET, or upgrade the current endpoint to be able to receive a POST request directly (ideally specifying the header HTTP-Method-Override: QUERY)\n\nThe Invalid URL is:\n\n${url}`);
236
+ }
237
+ })(!url || url.length <= MAX_URL_LENGTH) : {};
238
+ }
239
+ export { AutoCompress, Gate, MAX_URL_LENGTH, SupportsRequestStreams, TAB_ASSIGNED, TAB_ID, addTraceHeader, assertInvalidUrlLength };