enlace 0.0.1-beta.19 → 0.0.1-beta.20

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.
@@ -1,24 +1,11 @@
1
- import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, EnlaceResponse, WildcardClient, EnlaceClient, EnlaceOptions, EnlaceCallbacks } from 'enlace-core';
1
+ import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, EnlaceResponse, CoreRequestOptionsBase, WildcardClient, EnlaceClient, EnlaceOptions, EnlaceCallbacks } from 'enlace-core';
2
2
 
3
- /**
4
- * Dynamic params option - only available when accessing dynamic URL segments.
5
- * Used internally by the type system to conditionally show params option.
6
- */
7
- type DynamicParamsOption = {
8
- /**
9
- * Path parameters for dynamic URL segments.
10
- * Used to replace :paramName placeholders in the URL path.
11
- * @example
12
- * // With path api.products[':id'].delete
13
- * trigger({ params: { id: '123' } }) // → DELETE /products/123
14
- */
15
- params?: Record<string, string | number>;
16
- };
17
3
  /**
18
4
  * Per-request options for React hooks.
5
+ * Extends CoreRequestOptionsBase which provides conditional params support.
19
6
  * The params option is only available when accessing dynamic URL segments (via _ or index access).
20
7
  */
21
- type ReactRequestOptionsBase = {
8
+ type ReactRequestOptionsBase = CoreRequestOptionsBase & {
22
9
  /**
23
10
  * Cache tags for caching (GET requests only)
24
11
  * This will auto generate tags from the URL path if not provided and autoGenerateTags is enabled.
@@ -43,11 +30,11 @@ type ReactRequestOptionsBase = {
43
30
  * // If autoRevalidateTags produces ['posts'], final tags: ['posts', 'other-tag']
44
31
  */
45
32
  additionalRevalidateTags?: string[];
46
- /** @internal Used by type system to conditionally include params */
47
- __hasDynamicParams?: DynamicParamsOption;
48
33
  };
49
34
  /** Runtime request options that includes all possible properties */
50
- type AnyReactRequestOptions = ReactRequestOptionsBase & DynamicParamsOption;
35
+ type AnyReactRequestOptions = ReactRequestOptionsBase & {
36
+ params?: Record<string, string | number>;
37
+ };
51
38
  /** Polling interval value: milliseconds to wait, or false to stop polling */
52
39
  type PollingIntervalValue = number | false;
53
40
  /** Function that determines polling interval based on current data/error state */
@@ -1,24 +1,11 @@
1
- import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, EnlaceResponse, WildcardClient, EnlaceClient, EnlaceOptions, EnlaceCallbacks } from 'enlace-core';
1
+ import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, EnlaceResponse, CoreRequestOptionsBase, WildcardClient, EnlaceClient, EnlaceOptions, EnlaceCallbacks } from 'enlace-core';
2
2
 
3
- /**
4
- * Dynamic params option - only available when accessing dynamic URL segments.
5
- * Used internally by the type system to conditionally show params option.
6
- */
7
- type DynamicParamsOption = {
8
- /**
9
- * Path parameters for dynamic URL segments.
10
- * Used to replace :paramName placeholders in the URL path.
11
- * @example
12
- * // With path api.products[':id'].delete
13
- * trigger({ params: { id: '123' } }) // → DELETE /products/123
14
- */
15
- params?: Record<string, string | number>;
16
- };
17
3
  /**
18
4
  * Per-request options for React hooks.
5
+ * Extends CoreRequestOptionsBase which provides conditional params support.
19
6
  * The params option is only available when accessing dynamic URL segments (via _ or index access).
20
7
  */
21
- type ReactRequestOptionsBase = {
8
+ type ReactRequestOptionsBase = CoreRequestOptionsBase & {
22
9
  /**
23
10
  * Cache tags for caching (GET requests only)
24
11
  * This will auto generate tags from the URL path if not provided and autoGenerateTags is enabled.
@@ -43,11 +30,11 @@ type ReactRequestOptionsBase = {
43
30
  * // If autoRevalidateTags produces ['posts'], final tags: ['posts', 'other-tag']
44
31
  */
45
32
  additionalRevalidateTags?: string[];
46
- /** @internal Used by type system to conditionally include params */
47
- __hasDynamicParams?: DynamicParamsOption;
48
33
  };
49
34
  /** Runtime request options that includes all possible properties */
50
- type AnyReactRequestOptions = ReactRequestOptionsBase & DynamicParamsOption;
35
+ type AnyReactRequestOptions = ReactRequestOptionsBase & {
36
+ params?: Record<string, string | number>;
37
+ };
51
38
  /** Polling interval value: milliseconds to wait, or false to stop polling */
52
39
  type PollingIntervalValue = number | false;
53
40
  /** Function that determines polling interval based on current data/error state */
@@ -351,7 +351,11 @@ function createTrackingProxy(onTrack) {
351
351
  selectorPath: null,
352
352
  selectorMethod: null
353
353
  });
354
- return Promise.resolve({ status: 200, data: void 0, error: void 0 });
354
+ return Promise.resolve({
355
+ status: 200,
356
+ data: void 0,
357
+ error: void 0
358
+ });
355
359
  };
356
360
  onTrack({
357
361
  trackedCall: null,
@@ -559,15 +563,11 @@ function enlaceHookNext(baseUrl, defaultOptions = {}, hookOptions = {}) {
559
563
  staleTime = 0,
560
564
  ...nextOptions
561
565
  } = hookOptions;
562
- const api = enlaceNext(
563
- baseUrl,
564
- defaultOptions,
565
- {
566
- autoGenerateTags,
567
- autoRevalidateTags,
568
- ...nextOptions
569
- }
570
- );
566
+ const api = enlaceNext(baseUrl, defaultOptions, {
567
+ autoGenerateTags,
568
+ autoRevalidateTags,
569
+ ...nextOptions
570
+ });
571
571
  function useEnlaceHook(selectorOrQuery, queryOptions) {
572
572
  let trackedCall = null;
573
573
  let selectorPath = null;
@@ -2,9 +2,7 @@
2
2
  "use client";
3
3
 
4
4
  // src/react/enlaceHookReact.ts
5
- import {
6
- enlace
7
- } from "enlace-core";
5
+ import { enlace } from "enlace-core";
8
6
 
9
7
  // src/react/useQueryMode.ts
10
8
  import { useRef, useReducer, useEffect } from "react";
@@ -326,7 +324,11 @@ function createTrackingProxy(onTrack) {
326
324
  selectorPath: null,
327
325
  selectorMethod: null
328
326
  });
329
- return Promise.resolve({ status: 200, data: void 0, error: void 0 });
327
+ return Promise.resolve({
328
+ status: 200,
329
+ data: void 0,
330
+ error: void 0
331
+ });
330
332
  };
331
333
  onTrack({
332
334
  trackedCall: null,
@@ -538,15 +540,11 @@ function enlaceHookNext(baseUrl, defaultOptions = {}, hookOptions = {}) {
538
540
  staleTime = 0,
539
541
  ...nextOptions
540
542
  } = hookOptions;
541
- const api = enlaceNext(
542
- baseUrl,
543
- defaultOptions,
544
- {
545
- autoGenerateTags,
546
- autoRevalidateTags,
547
- ...nextOptions
548
- }
549
- );
543
+ const api = enlaceNext(baseUrl, defaultOptions, {
544
+ autoGenerateTags,
545
+ autoRevalidateTags,
546
+ ...nextOptions
547
+ });
550
548
  function useEnlaceHook(selectorOrQuery, queryOptions) {
551
549
  let trackedCall = null;
552
550
  let selectorPath = null;
package/dist/index.d.mts CHANGED
@@ -1,25 +1,12 @@
1
- import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, EnlaceCallbacks, EnlaceOptions, WildcardClient, EnlaceClient } from 'enlace-core';
1
+ import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, CoreRequestOptionsBase, EnlaceCallbacks, EnlaceOptions, WildcardClient, EnlaceClient } from 'enlace-core';
2
2
  export * from 'enlace-core';
3
3
 
4
- /**
5
- * Dynamic params option - only available when accessing dynamic URL segments.
6
- * Used internally by the type system to conditionally show params option.
7
- */
8
- type DynamicParamsOption = {
9
- /**
10
- * Path parameters for dynamic URL segments.
11
- * Used to replace :paramName placeholders in the URL path.
12
- * @example
13
- * // With path api.products[':id'].delete
14
- * trigger({ params: { id: '123' } }) // → DELETE /products/123
15
- */
16
- params?: Record<string, string | number>;
17
- };
18
4
  /**
19
5
  * Per-request options for React hooks.
6
+ * Extends CoreRequestOptionsBase which provides conditional params support.
20
7
  * The params option is only available when accessing dynamic URL segments (via _ or index access).
21
8
  */
22
- type ReactRequestOptionsBase = {
9
+ type ReactRequestOptionsBase = CoreRequestOptionsBase & {
23
10
  /**
24
11
  * Cache tags for caching (GET requests only)
25
12
  * This will auto generate tags from the URL path if not provided and autoGenerateTags is enabled.
@@ -44,8 +31,6 @@ type ReactRequestOptionsBase = {
44
31
  * // If autoRevalidateTags produces ['posts'], final tags: ['posts', 'other-tag']
45
32
  */
46
33
  additionalRevalidateTags?: string[];
47
- /** @internal Used by type system to conditionally include params */
48
- __hasDynamicParams?: DynamicParamsOption;
49
34
  };
50
35
  /** Options for enlaceHookReact factory */
51
36
  type EnlaceHookOptions = {
package/dist/index.d.ts CHANGED
@@ -1,25 +1,12 @@
1
- import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, EnlaceCallbacks, EnlaceOptions, WildcardClient, EnlaceClient } from 'enlace-core';
1
+ import { EnlaceCallbackPayload, EnlaceErrorCallbackPayload, CoreRequestOptionsBase, EnlaceCallbacks, EnlaceOptions, WildcardClient, EnlaceClient } from 'enlace-core';
2
2
  export * from 'enlace-core';
3
3
 
4
- /**
5
- * Dynamic params option - only available when accessing dynamic URL segments.
6
- * Used internally by the type system to conditionally show params option.
7
- */
8
- type DynamicParamsOption = {
9
- /**
10
- * Path parameters for dynamic URL segments.
11
- * Used to replace :paramName placeholders in the URL path.
12
- * @example
13
- * // With path api.products[':id'].delete
14
- * trigger({ params: { id: '123' } }) // → DELETE /products/123
15
- */
16
- params?: Record<string, string | number>;
17
- };
18
4
  /**
19
5
  * Per-request options for React hooks.
6
+ * Extends CoreRequestOptionsBase which provides conditional params support.
20
7
  * The params option is only available when accessing dynamic URL segments (via _ or index access).
21
8
  */
22
- type ReactRequestOptionsBase = {
9
+ type ReactRequestOptionsBase = CoreRequestOptionsBase & {
23
10
  /**
24
11
  * Cache tags for caching (GET requests only)
25
12
  * This will auto generate tags from the URL path if not provided and autoGenerateTags is enabled.
@@ -44,8 +31,6 @@ type ReactRequestOptionsBase = {
44
31
  * // If autoRevalidateTags produces ['posts'], final tags: ['posts', 'other-tag']
45
32
  */
46
33
  additionalRevalidateTags?: string[];
47
- /** @internal Used by type system to conditionally include params */
48
- __hasDynamicParams?: DynamicParamsOption;
49
34
  };
50
35
  /** Options for enlaceHookReact factory */
51
36
  type EnlaceHookOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enlace",
3
- "version": "0.0.1-beta.19",
3
+ "version": "0.0.1-beta.20",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "enlace-core": "0.0.1-beta.12"
30
+ "enlace-core": "0.0.1-beta.13"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^19"
@@ -36,6 +36,7 @@
36
36
  "dev": "tsup --watch",
37
37
  "build": "tsup",
38
38
  "typecheck": "tsc --noEmit",
39
- "lint": "eslint src --max-warnings 0"
39
+ "lint": "eslint src --max-warnings 0",
40
+ "format": "prettier --write 'src/**/*.ts'"
40
41
  }
41
42
  }