@faasjs/react 8.0.0-beta.26 → 8.0.0-beta.27

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.
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Component, ComponentProps, ComponentType, Dispatch, ErrorInfo, JSX, Rea
3
3
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import { FaasAction, FaasAction as FaasAction$1, FaasActionUnionType, FaasActionUnionType as FaasActionUnionType$1, FaasData, FaasData as FaasData$1, FaasParams, FaasParams as FaasParams$1 } from "@faasjs/types";
5
5
 
6
- //#region src/generateId.d.ts
6
+ //#region src/generateId/index.d.ts
7
7
  /**
8
8
  * Generate a random identifier with an optional prefix.
9
9
  *
@@ -23,7 +23,7 @@ import { FaasAction, FaasAction as FaasAction$1, FaasActionUnionType, FaasAction
23
23
  */
24
24
  declare function generateId(prefix?: string, length?: number): string;
25
25
  //#endregion
26
- //#region src/browser.d.ts
26
+ //#region src/browser/index.d.ts
27
27
  /**
28
28
  * Template literal type for URL strings that must end with a forward slash.
29
29
  *
@@ -111,7 +111,7 @@ type Options = RequestInit & {
111
111
  *
112
112
  * Notes:
113
113
  * - Headers are case-insensitive in HTTP but stored with exact casing in this object
114
- * - Common headers include: Content-Type, Authorization, X-Request-Id, X-Custom-Header
114
+ * - Common headers include: Content-Type, Authorization, x-faasjs-request-id, X-Custom-Header
115
115
  * - No support for multi-value headers (use comma-separated values instead)
116
116
  * - Used in Response, ResponseError, and Options types
117
117
  * - Simplified model compared to browser's Headers interface (no .get(), .set() methods)
@@ -250,7 +250,7 @@ type ResponseProps<T = any> = {
250
250
  * data: { created: true },
251
251
  * headers: {
252
252
  * 'Content-Type': 'application/json',
253
- * 'X-Request-Id': 'req-123',
253
+ * 'x-faasjs-request-id': 'req-123',
254
254
  * 'X-Cache-Key': 'user-123'
255
255
  * }
256
256
  * })
@@ -401,8 +401,8 @@ type ResponseErrorProps = {
401
401
  * if (error.body) {
402
402
  * console.error('Error details:', error.body)
403
403
  * }
404
- * if (error.headers['X-Request-Id']) {
405
- * console.error('Request ID:', error.headers['X-Request-Id'])
404
+ * if (error.headers['x-faasjs-request-id']) {
405
+ * console.error('Request ID:', error.headers['x-faasjs-request-id'])
406
406
  * }
407
407
  * }
408
408
  * }
@@ -848,7 +848,7 @@ declare class FaasBrowserClient {
848
848
  action<PathOrData extends FaasActionUnionType$1>(action: FaasAction$1<PathOrData>, params?: FaasParams$1<PathOrData>, options?: Options): Promise<Response<FaasData$1<PathOrData>>>;
849
849
  }
850
850
  //#endregion
851
- //#region src/faas.d.ts
851
+ //#region src/faas/index.d.ts
852
852
  /**
853
853
  * Call the currently configured FaasReactClient.
854
854
  *
@@ -876,7 +876,7 @@ declare class FaasBrowserClient {
876
876
  */
877
877
  declare function faas<PathOrData extends FaasActionUnionType$1>(action: FaasAction$1<PathOrData>, params: FaasParams$1<PathOrData>, options?: Options): Promise<Response<FaasData$1<PathOrData>>>;
878
878
  //#endregion
879
- //#region src/FaasDataWrapper.d.ts
879
+ //#region src/FaasDataWrapper/index.d.ts
880
880
  /**
881
881
  * Request state injected by {@link useFaas}, {@link FaasDataWrapper}, and {@link withFaasData}.
882
882
  *
@@ -1073,7 +1073,7 @@ type SharedUseFaasOptions<Params, Data> = {
1073
1073
  baseUrl?: BaseUrl;
1074
1074
  };
1075
1075
  //#endregion
1076
- //#region src/useFaas.d.ts
1076
+ //#region src/useFaas/index.d.ts
1077
1077
  /**
1078
1078
  * Options that customize the {@link useFaas} request lifecycle.
1079
1079
  *
@@ -1236,7 +1236,7 @@ declare function FaasReactClient(options?: FaasReactClientOptions): FaasReactCli
1236
1236
  */
1237
1237
  declare function getClient(host?: string): FaasReactClientInstance;
1238
1238
  //#endregion
1239
- //#region src/constant.d.ts
1239
+ //#region src/constant/index.d.ts
1240
1240
  /**
1241
1241
  * Returns a constant value that is created by the given function.
1242
1242
  *
@@ -1257,7 +1257,7 @@ declare function getClient(host?: string): FaasReactClientInstance;
1257
1257
  */
1258
1258
  declare function useConstant<T>(fn: () => T): T;
1259
1259
  //#endregion
1260
- //#region src/ErrorBoundary.d.ts
1260
+ //#region src/ErrorBoundary/index.d.ts
1261
1261
  /**
1262
1262
  * Props for the {@link ErrorBoundary} component.
1263
1263
  */
@@ -1328,7 +1328,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
1328
1328
  render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
1329
1329
  }
1330
1330
  //#endregion
1331
- //#region src/equal.d.ts
1331
+ //#region src/equal/index.d.ts
1332
1332
  /**
1333
1333
  * Compares two values for deep equality.
1334
1334
  *
@@ -1433,7 +1433,7 @@ declare function useEqualMemo<T>(callback: () => T, dependencies: any[]): T;
1433
1433
  */
1434
1434
  declare function useEqualCallback<T extends (...args: any[]) => any>(callback: T, dependencies: any[]): T;
1435
1435
  //#endregion
1436
- //#region src/OptionalWrapper.d.ts
1436
+ //#region src/OptionalWrapper/index.d.ts
1437
1437
  /**
1438
1438
  * Props for the {@link OptionalWrapper} helper component.
1439
1439
  *
@@ -1477,7 +1477,7 @@ declare namespace OptionalWrapper {
1477
1477
  var displayName: string;
1478
1478
  }
1479
1479
  //#endregion
1480
- //#region src/splittingContext.d.ts
1480
+ //#region src/splittingContext/index.d.ts
1481
1481
  /**
1482
1482
  * Create a context whose keys can be consumed independently.
1483
1483
  *
@@ -1593,7 +1593,7 @@ declare function createSplittingContext<T extends Record<string, any>>(defaultVa
1593
1593
  use: <NewT extends T = T>(this: void) => Readonly<NewT>;
1594
1594
  };
1595
1595
  //#endregion
1596
- //#region src/splittingState.d.ts
1596
+ //#region src/splittingState/index.d.ts
1597
1597
  /**
1598
1598
  * Setter map generated by {@link useSplittingState} for each state key.
1599
1599
  *
@@ -1624,7 +1624,7 @@ type StatesWithSetters<T> = T & StateSetters<T>;
1624
1624
  */
1625
1625
  declare function useSplittingState<T extends Record<string, unknown>>(initialStates: T): StatesWithSetters<T>;
1626
1626
  //#endregion
1627
- //#region src/useFaasStream.d.ts
1627
+ //#region src/useFaasStream/index.d.ts
1628
1628
  /**
1629
1629
  * Options that customize the {@link useFaasStream} request lifecycle.
1630
1630
  */
@@ -1686,7 +1686,7 @@ type UseFaasStreamResult = {
1686
1686
  */
1687
1687
  declare function useFaasStream(action: string, defaultParams: Record<string, any>, options?: UseFaasStreamOptions): UseFaasStreamResult;
1688
1688
  //#endregion
1689
- //#region src/usePrevious.d.ts
1689
+ //#region src/usePrevious/index.d.ts
1690
1690
  /**
1691
1691
  * Hook to store the previous value of a state or prop.
1692
1692
  *
@@ -1707,7 +1707,7 @@ declare function useFaasStream(action: string, defaultParams: Record<string, any
1707
1707
  */
1708
1708
  declare function usePrevious<T = any>(value: T): T | undefined;
1709
1709
  //#endregion
1710
- //#region src/useStateRef.d.ts
1710
+ //#region src/useStateRef/index.d.ts
1711
1711
  /**
1712
1712
  * Custom hook that returns a stateful value and a ref to that value.
1713
1713
  *
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Component, cloneElement, createContext, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- //#region src/generateId.ts
3
+ //#region src/generateId/index.ts
4
4
  /**
5
5
  * Generate a random identifier with an optional prefix.
6
6
  *
@@ -23,7 +23,7 @@ function generateId(prefix = "", length = 18) {
23
23
  return `${prefix}${Date.now().toString(36).padStart(8, "0")}${Math.random().toString(36).substring(2, length - 6).padEnd(length - 8, "0")}`;
24
24
  }
25
25
  //#endregion
26
- //#region src/browser.ts
26
+ //#region src/browser/index.ts
27
27
  /**
28
28
  * Wrapper class for HTTP responses from FaasJS functions.
29
29
  *
@@ -88,7 +88,7 @@ function generateId(prefix = "", length = 18) {
88
88
  * data: { created: true },
89
89
  * headers: {
90
90
  * 'Content-Type': 'application/json',
91
- * 'X-Request-Id': 'req-123',
91
+ * 'x-faasjs-request-id': 'req-123',
92
92
  * 'X-Cache-Key': 'user-123'
93
93
  * }
94
94
  * })
@@ -235,8 +235,8 @@ var Response = class {
235
235
  * if (error.body) {
236
236
  * console.error('Error details:', error.body)
237
237
  * }
238
- * if (error.headers['X-Request-Id']) {
239
- * console.error('Request ID:', error.headers['X-Request-Id'])
238
+ * if (error.headers['x-faasjs-request-id']) {
239
+ * console.error('Request ID:', error.headers['x-faasjs-request-id'])
240
240
  * }
241
241
  * }
242
242
  * }
@@ -778,7 +778,7 @@ var FaasBrowserClient = class {
778
778
  }
779
779
  };
780
780
  //#endregion
781
- //#region src/faas.ts
781
+ //#region src/faas/index.ts
782
782
  /**
783
783
  * Call the currently configured FaasReactClient.
784
784
  *
@@ -814,7 +814,7 @@ async function faas(action, params, options) {
814
814
  return client.browserClient.action(action, params, options);
815
815
  }
816
816
  //#endregion
817
- //#region src/equal.ts
817
+ //#region src/equal/index.ts
818
818
  const AsyncFunction = (async () => {}).constructor;
819
819
  /**
820
820
  * Compares two values for deep equality.
@@ -1336,7 +1336,7 @@ function useFaasRequest({ action, defaultParams, options, beforeSend, onSuccess,
1336
1336
  };
1337
1337
  }
1338
1338
  //#endregion
1339
- //#region src/useFaas.tsx
1339
+ //#region src/useFaas/index.tsx
1340
1340
  /**
1341
1341
  * Request FaasJS data and keep request state in React state.
1342
1342
  *
@@ -1518,7 +1518,7 @@ function getClient(host) {
1518
1518
  return client;
1519
1519
  }
1520
1520
  //#endregion
1521
- //#region src/constant.ts
1521
+ //#region src/constant/index.ts
1522
1522
  /**
1523
1523
  * Returns a constant value that is created by the given function.
1524
1524
  *
@@ -1543,7 +1543,7 @@ function useConstant(fn) {
1543
1543
  return ref.current.v;
1544
1544
  }
1545
1545
  //#endregion
1546
- //#region src/ErrorBoundary.tsx
1546
+ //#region src/ErrorBoundary/index.tsx
1547
1547
  /**
1548
1548
  * React error boundary with an optional custom fallback element.
1549
1549
  *
@@ -1617,7 +1617,7 @@ var ErrorBoundary = class extends Component {
1617
1617
  }
1618
1618
  };
1619
1619
  //#endregion
1620
- //#region src/OptionalWrapper.tsx
1620
+ //#region src/OptionalWrapper/index.tsx
1621
1621
  /**
1622
1622
  * Conditionally wrap children with another component.
1623
1623
  *
@@ -1653,7 +1653,7 @@ function OptionalWrapper(props) {
1653
1653
  }
1654
1654
  OptionalWrapper.displayName = "OptionalWrapper";
1655
1655
  //#endregion
1656
- //#region src/splittingState.tsx
1656
+ //#region src/splittingState/index.tsx
1657
1657
  /**
1658
1658
  * Create local state entries and matching setters for each key in an object.
1659
1659
  *
@@ -1682,7 +1682,7 @@ function useSplittingState(initialStates) {
1682
1682
  return states;
1683
1683
  }
1684
1684
  //#endregion
1685
- //#region src/splittingContext.tsx
1685
+ //#region src/splittingContext/index.tsx
1686
1686
  /**
1687
1687
  * Create a context whose keys can be consumed independently.
1688
1688
  *
@@ -1770,7 +1770,7 @@ function createSplittingContext(defaultValue) {
1770
1770
  };
1771
1771
  }
1772
1772
  //#endregion
1773
- //#region src/useFaasStream.tsx
1773
+ //#region src/useFaasStream/index.tsx
1774
1774
  /**
1775
1775
  * Stream a FaasJS response into React state.
1776
1776
  *
@@ -1871,7 +1871,7 @@ function useFaasStream(action, defaultParams, options = {}) {
1871
1871
  };
1872
1872
  }
1873
1873
  //#endregion
1874
- //#region src/usePrevious.ts
1874
+ //#region src/usePrevious/index.ts
1875
1875
  /**
1876
1876
  * Hook to store the previous value of a state or prop.
1877
1877
  *
@@ -1898,7 +1898,7 @@ function usePrevious(value) {
1898
1898
  return ref.current;
1899
1899
  }
1900
1900
  //#endregion
1901
- //#region src/useStateRef.ts
1901
+ //#region src/useStateRef/index.ts
1902
1902
  /**
1903
1903
  * Custom hook that returns a stateful value and a ref to that value.
1904
1904
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/react",
3
- "version": "8.0.0-beta.26",
3
+ "version": "8.0.0-beta.27",
4
4
  "homepage": "https://faasjs.com/doc/react/",
5
5
  "bugs": {
6
6
  "url": "https://github.com/faasjs/faasjs/issues"
@@ -26,12 +26,12 @@
26
26
  }
27
27
  },
28
28
  "devDependencies": {
29
- "@faasjs/types": ">=8.0.0-beta.26",
29
+ "@faasjs/types": ">=8.0.0-beta.27",
30
30
  "@types/react": "^19.0.0",
31
31
  "react": "^19.0.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@faasjs/types": ">=8.0.0-beta.26"
34
+ "@faasjs/types": ">=8.0.0-beta.27"
35
35
  },
36
36
  "engines": {
37
37
  "node": ">=24.0.0",