diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 73d40756..d1cc2244 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,6 +79,27 @@ jobs: ./reactfire-${{ github.run_id }}/unpack.sh - name: Run tests run: npm run test + type-check: + runs-on: ubuntu-latest + strategy: + matrix: + react: ["18", "19"] + fail-fast: false + name: Type check (React ${{ matrix.react }}) + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + - name: Install deps + run: npm ci + - name: Install React ${{ matrix.react }} types + run: npm install --no-save react@${{ matrix.react }} react-dom@${{ matrix.react }} @types/react@${{ matrix.react }} @types/react-dom@${{ matrix.react }} + - name: Type check + run: npx tsc --noEmit publish: runs-on: ubuntu-latest name: Publish (NPM) diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..451a5a6b --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +src/*.type-test.ts diff --git a/README.md b/README.md index 92e98e56..880b18ed 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ Firebase. - **Access Firebase libraries from any component** - Need the Firestore SDK? `useFirestore`. Remote Config? `useRemoteConfig`. - **Safely configure Firebase libraries** - Libraries like Firestore and Remote Config require settings like `enablePersistence` to be set before any data fetches are made. This can be tough to support in React's world of re-renders. ReactFire gives you `useInitFirestore` and `useInitRemoteConfig` hooks that guarantee they're set before anything else. +## Platform support + +ReactFire is designed for **web React apps** and wraps the [Firebase Web SDK](https://firebase.google.com/docs/web/setup). It is not compatible with React Native or Expo. For React Native projects, use [react-native-firebase](https://rnfirebase.io/) instead. + ## Install ```bash diff --git a/docs/reference/README.md b/docs/reference/README.md index 452cbde8..884ed7da 100644 --- a/docs/reference/README.md +++ b/docs/reference/README.md @@ -66,8 +66,6 @@ - [~~AuthCheck~~](functions/AuthCheck.md) - [checkIdField](functions/checkIdField.md) -- [checkinitialData](functions/checkinitialData.md) -- [checkOptions](functions/checkOptions.md) - [~~ClaimsCheck~~](functions/ClaimsCheck.md) - [FirebaseAppProvider](functions/FirebaseAppProvider.md) - [preloadFirestoreDoc](functions/preloadFirestoreDoc.md) diff --git a/docs/reference/classes/ReactFireError.md b/docs/reference/classes/ReactFireError.md index 591ddb68..94e568cd 100644 --- a/docs/reference/classes/ReactFireError.md +++ b/docs/reference/classes/ReactFireError.md @@ -106,8 +106,100 @@ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 `Error.stack` +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +Defined in: node\_modules/@types/node/globals.d.ts:67 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +`Error.stackTraceLimit` + ## Methods +### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` + +Defined in: node\_modules/@types/node/globals.d.ts:51 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +`Error.captureStackTrace` + +*** + ### isError() > `static` **isError**(`error`): `error is Error` @@ -129,3 +221,33 @@ Indicates whether the argument provided is a built-in Error instance or not. #### Inherited from `Error.isError` + +*** + +### prepareStackTrace() + +> `static` **prepareStackTrace**(`err`, `stackTraces`): `any` + +Defined in: node\_modules/@types/node/globals.d.ts:55 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` diff --git a/docs/reference/functions/AuthCheck.md b/docs/reference/functions/AuthCheck.md index 9bedbb15..aa03a2be 100644 --- a/docs/reference/functions/AuthCheck.md +++ b/docs/reference/functions/AuthCheck.md @@ -6,7 +6,7 @@ # ~~Function: AuthCheck()~~ -> **AuthCheck**(`__namedParameters`): `Element` +> **AuthCheck**(`__namedParameters`): `ReactElement` Defined in: [src/auth.tsx:247](https://github.com/FirebaseExtended/reactfire/blob/main/src/auth.tsx#L247) @@ -18,7 +18,7 @@ Defined in: [src/auth.tsx:247](https://github.com/FirebaseExtended/reactfire/blo ## Returns -`Element` +`ReactElement` ## Deprecated diff --git a/docs/reference/functions/SuspenseWithPerf.md b/docs/reference/functions/SuspenseWithPerf.md index ea4a1e9d..6ab06a72 100644 --- a/docs/reference/functions/SuspenseWithPerf.md +++ b/docs/reference/functions/SuspenseWithPerf.md @@ -6,7 +6,7 @@ # Function: SuspenseWithPerf() -> **SuspenseWithPerf**(`__namedParameters`): `Element` +> **SuspenseWithPerf**(`__namedParameters`): `ReactElement` Defined in: [src/performance.tsx:9](https://github.com/FirebaseExtended/reactfire/blob/main/src/performance.tsx#L9) @@ -18,4 +18,4 @@ Defined in: [src/performance.tsx:9](https://github.com/FirebaseExtended/reactfir ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/functions/checkIdField.md b/docs/reference/functions/checkIdField.md index 82d7c5a9..7c55757f 100644 --- a/docs/reference/functions/checkIdField.md +++ b/docs/reference/functions/checkIdField.md @@ -6,9 +6,9 @@ # Function: checkIdField() -> **checkIdField**(`options`): `any` +> **checkIdField**(`options`): `string` \| `undefined` -Defined in: [src/index.ts:47](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L47) +Defined in: [src/index.ts:34](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L34) ## Parameters @@ -18,4 +18,4 @@ Defined in: [src/index.ts:47](https://github.com/FirebaseExtended/reactfire/blob ## Returns -`any` +`string` \| `undefined` diff --git a/docs/reference/functions/checkOptions.md b/docs/reference/functions/checkOptions.md deleted file mode 100644 index 4f4fdaf0..00000000 --- a/docs/reference/functions/checkOptions.md +++ /dev/null @@ -1,25 +0,0 @@ -[**ReactFire reference docs**](../README.md) - -*** - -[ReactFire reference docs](../README.md) / checkOptions - -# Function: checkOptions() - -> **checkOptions**(`options`, `field`): `any` - -Defined in: [src/index.ts:34](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L34) - -## Parameters - -### options - -[`ReactFireOptions`](../interfaces/ReactFireOptions.md) - -### field - -`string` - -## Returns - -`any` diff --git a/docs/reference/functions/checkinitialData.md b/docs/reference/functions/checkinitialData.md deleted file mode 100644 index f2c78405..00000000 --- a/docs/reference/functions/checkinitialData.md +++ /dev/null @@ -1,21 +0,0 @@ -[**ReactFire reference docs**](../README.md) - -*** - -[ReactFire reference docs](../README.md) / checkinitialData - -# Function: checkinitialData() - -> **checkinitialData**(`options`): `any` - -Defined in: [src/index.ts:43](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L43) - -## Parameters - -### options - -[`ReactFireOptions`](../interfaces/ReactFireOptions.md) - -## Returns - -`any` diff --git a/docs/reference/functions/useFirestoreDocData.md b/docs/reference/functions/useFirestoreDocData.md index 51f11060..1267c3da 100644 --- a/docs/reference/functions/useFirestoreDocData.md +++ b/docs/reference/functions/useFirestoreDocData.md @@ -6,7 +6,7 @@ # Function: useFirestoreDocData() -> **useFirestoreDocData**\<`T`\>(`ref`, `options?`): [`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T`\> +> **useFirestoreDocData**\<`T`\>(`ref`, `options?`): [`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T` \| `undefined`\> Defined in: [src/firestore.tsx:62](https://github.com/FirebaseExtended/reactfire/blob/main/src/firestore.tsx#L62) @@ -30,4 +30,4 @@ Subscribe to Firestore Document changes and unwrap the document into a plain obj ## Returns -[`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T`\> +[`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T` \| `undefined`\> diff --git a/docs/reference/functions/useFirestoreDocDataOnce.md b/docs/reference/functions/useFirestoreDocDataOnce.md index b3a075cc..db47124e 100644 --- a/docs/reference/functions/useFirestoreDocDataOnce.md +++ b/docs/reference/functions/useFirestoreDocDataOnce.md @@ -6,7 +6,7 @@ # Function: useFirestoreDocDataOnce() -> **useFirestoreDocDataOnce**\<`T`\>(`ref`, `options?`): [`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T`\> +> **useFirestoreDocDataOnce**\<`T`\>(`ref`, `options?`): [`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T` \| `undefined`\> Defined in: [src/firestore.tsx:74](https://github.com/FirebaseExtended/reactfire/blob/main/src/firestore.tsx#L74) @@ -30,4 +30,4 @@ Get a Firestore document, unwrap the document into a plain object, and don't sub ## Returns -[`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T`\> +[`ObservableStatus`](../type-aliases/ObservableStatus.md)\<`T` \| `undefined`\> diff --git a/docs/reference/interfaces/ReactFireOptions.md b/docs/reference/interfaces/ReactFireOptions.md index 7ca63c5e..0503ebb7 100644 --- a/docs/reference/interfaces/ReactFireOptions.md +++ b/docs/reference/interfaces/ReactFireOptions.md @@ -30,7 +30,7 @@ Defined in: [src/index.ts:25](https://github.com/FirebaseExtended/reactfire/blob ### initialData? -> `optional` **initialData?**: `any` +> `optional` **initialData?**: `T` Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L26) @@ -38,7 +38,7 @@ Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob ### ~~startWithValue?~~ -> `optional` **startWithValue?**: `any` +> `optional` **startWithValue?**: `T` Defined in: [src/index.ts:30](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L30) diff --git a/docs/reference/interfaces/SignInCheckOptionsBasic.md b/docs/reference/interfaces/SignInCheckOptionsBasic.md index b581c6c6..e916797d 100644 --- a/docs/reference/interfaces/SignInCheckOptionsBasic.md +++ b/docs/reference/interfaces/SignInCheckOptionsBasic.md @@ -41,7 +41,7 @@ Defined in: [src/index.ts:25](https://github.com/FirebaseExtended/reactfire/blob ### initialData? -> `optional` **initialData?**: `any` +> `optional` **initialData?**: [`SigninCheckResult`](../type-aliases/SigninCheckResult.md) Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L26) @@ -53,7 +53,7 @@ Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob ### ~~startWithValue?~~ -> `optional` **startWithValue?**: `any` +> `optional` **startWithValue?**: [`SigninCheckResult`](../type-aliases/SigninCheckResult.md) Defined in: [src/index.ts:30](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L30) diff --git a/docs/reference/interfaces/SignInCheckOptionsClaimsObject.md b/docs/reference/interfaces/SignInCheckOptionsClaimsObject.md index 43a884ee..1ca170bf 100644 --- a/docs/reference/interfaces/SignInCheckOptionsClaimsObject.md +++ b/docs/reference/interfaces/SignInCheckOptionsClaimsObject.md @@ -40,7 +40,7 @@ Defined in: [src/index.ts:25](https://github.com/FirebaseExtended/reactfire/blob ### initialData? -> `optional` **initialData?**: `any` +> `optional` **initialData?**: [`SigninCheckResult`](../type-aliases/SigninCheckResult.md) Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L26) @@ -60,7 +60,7 @@ Defined in: [src/auth.tsx:78](https://github.com/FirebaseExtended/reactfire/blob ### ~~startWithValue?~~ -> `optional` **startWithValue?**: `any` +> `optional` **startWithValue?**: [`SigninCheckResult`](../type-aliases/SigninCheckResult.md) Defined in: [src/index.ts:30](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L30) diff --git a/docs/reference/interfaces/SignInCheckOptionsClaimsValidator.md b/docs/reference/interfaces/SignInCheckOptionsClaimsValidator.md index aeec944b..fe5069b7 100644 --- a/docs/reference/interfaces/SignInCheckOptionsClaimsValidator.md +++ b/docs/reference/interfaces/SignInCheckOptionsClaimsValidator.md @@ -40,7 +40,7 @@ Defined in: [src/index.ts:25](https://github.com/FirebaseExtended/reactfire/blob ### initialData? -> `optional` **initialData?**: `any` +> `optional` **initialData?**: [`SigninCheckResult`](../type-aliases/SigninCheckResult.md) Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L26) @@ -52,7 +52,7 @@ Defined in: [src/index.ts:26](https://github.com/FirebaseExtended/reactfire/blob ### ~~startWithValue?~~ -> `optional` **startWithValue?**: `any` +> `optional` **startWithValue?**: [`SigninCheckResult`](../type-aliases/SigninCheckResult.md) Defined in: [src/index.ts:30](https://github.com/FirebaseExtended/reactfire/blob/main/src/index.ts#L30) diff --git a/docs/reference/type-aliases/StorageImageProps.md b/docs/reference/type-aliases/StorageImageProps.md index 5fd6a740..b75fa337 100644 --- a/docs/reference/type-aliases/StorageImageProps.md +++ b/docs/reference/type-aliases/StorageImageProps.md @@ -14,7 +14,7 @@ Defined in: [src/storage.tsx:36](https://github.com/FirebaseExtended/reactfire/b ### placeHolder? -> `optional` **placeHolder?**: `JSX.Element` +> `optional` **placeHolder?**: `React.ReactNode` Defined in: [src/storage.tsx:40](https://github.com/FirebaseExtended/reactfire/blob/main/src/storage.tsx#L40) diff --git a/docs/reference/variables/AnalyticsProvider.md b/docs/reference/variables/AnalyticsProvider.md index 1e51416e..67edf246 100644 --- a/docs/reference/variables/AnalyticsProvider.md +++ b/docs/reference/variables/AnalyticsProvider.md @@ -6,7 +6,7 @@ # Variable: AnalyticsProvider -> `const` **AnalyticsProvider**: (`props`) => `Element` +> `const` **AnalyticsProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:74](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L74) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:74](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/AppCheckProvider.md b/docs/reference/variables/AppCheckProvider.md index dd717bde..ff42596a 100644 --- a/docs/reference/variables/AppCheckProvider.md +++ b/docs/reference/variables/AppCheckProvider.md @@ -6,7 +6,7 @@ # Variable: AppCheckProvider -> `const` **AppCheckProvider**: (`props`) => `Element` +> `const` **AppCheckProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:72](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L72) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:72](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/AuthProvider.md b/docs/reference/variables/AuthProvider.md index 47de1c97..11ea5392 100644 --- a/docs/reference/variables/AuthProvider.md +++ b/docs/reference/variables/AuthProvider.md @@ -6,7 +6,7 @@ # Variable: AuthProvider -> `const` **AuthProvider**: (`props`) => `Element` +> `const` **AuthProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:73](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L73) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:73](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/DatabaseProvider.md b/docs/reference/variables/DatabaseProvider.md index c2a3a7e7..e8069948 100644 --- a/docs/reference/variables/DatabaseProvider.md +++ b/docs/reference/variables/DatabaseProvider.md @@ -6,7 +6,7 @@ # Variable: DatabaseProvider -> `const` **DatabaseProvider**: (`props`) => `Element` +> `const` **DatabaseProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:75](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L75) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:75](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/FirestoreProvider.md b/docs/reference/variables/FirestoreProvider.md index 6e680dcf..d689f31f 100644 --- a/docs/reference/variables/FirestoreProvider.md +++ b/docs/reference/variables/FirestoreProvider.md @@ -6,7 +6,7 @@ # Variable: FirestoreProvider -> `const` **FirestoreProvider**: (`props`) => `Element` +> `const` **FirestoreProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:76](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L76) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:76](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/FunctionsProvider.md b/docs/reference/variables/FunctionsProvider.md index 0557ac83..918b2609 100644 --- a/docs/reference/variables/FunctionsProvider.md +++ b/docs/reference/variables/FunctionsProvider.md @@ -6,7 +6,7 @@ # Variable: FunctionsProvider -> `const` **FunctionsProvider**: (`props`) => `Element` +> `const` **FunctionsProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:77](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L77) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:77](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/PerformanceProvider.md b/docs/reference/variables/PerformanceProvider.md index ef926f29..ee2fcc28 100644 --- a/docs/reference/variables/PerformanceProvider.md +++ b/docs/reference/variables/PerformanceProvider.md @@ -6,7 +6,7 @@ # Variable: PerformanceProvider -> `const` **PerformanceProvider**: (`props`) => `Element` +> `const` **PerformanceProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:78](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L78) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:78](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/RemoteConfigProvider.md b/docs/reference/variables/RemoteConfigProvider.md index 071b8e4c..8d3d3625 100644 --- a/docs/reference/variables/RemoteConfigProvider.md +++ b/docs/reference/variables/RemoteConfigProvider.md @@ -6,7 +6,7 @@ # Variable: RemoteConfigProvider -> `const` **RemoteConfigProvider**: (`props`) => `Element` +> `const` **RemoteConfigProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:80](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L80) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:80](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/docs/reference/variables/StorageProvider.md b/docs/reference/variables/StorageProvider.md index f558ec1c..dbcb81c1 100644 --- a/docs/reference/variables/StorageProvider.md +++ b/docs/reference/variables/StorageProvider.md @@ -6,7 +6,7 @@ # Variable: StorageProvider -> `const` **StorageProvider**: (`props`) => `Element` +> `const` **StorageProvider**: (`props`) => `ReactElement` Defined in: [src/sdk.tsx:79](https://github.com/FirebaseExtended/reactfire/blob/main/src/sdk.tsx#L79) @@ -18,4 +18,4 @@ Defined in: [src/sdk.tsx:79](https://github.com/FirebaseExtended/reactfire/blob/ ## Returns -`Element` +`ReactElement` diff --git a/package-lock.json b/package-lock.json index 696b4302..dd2eb774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,10 +58,11 @@ } }, "node_modules/@adobe/css-tools": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", - "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==", - "dev": true + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.5.0.tgz", + "integrity": "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==", + "dev": true, + "license": "MIT" }, "node_modules/@apidevtools/json-schema-ref-parser": { "version": "9.1.2", @@ -2159,16 +2160,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/@modelcontextprotocol/sdk/node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/@modelcontextprotocol/sdk/node_modules/cookie-signature": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", @@ -2265,27 +2256,6 @@ "node": ">= 0.8" } }, - "node_modules/@modelcontextprotocol/sdk/node_modules/http-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", - "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "depd": "~2.0.0", - "inherits": "~2.0.4", - "setprototypeof": "~1.2.0", - "statuses": "~2.0.2", - "toidentifier": "~1.0.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, "node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", @@ -2377,23 +2347,6 @@ "node": ">= 0.6" } }, - "node_modules/@modelcontextprotocol/sdk/node_modules/qs": { - "version": "6.15.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", - "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "es-define-property": "^1.0.1", - "side-channel": "^1.1.1" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/@modelcontextprotocol/sdk/node_modules/raw-body": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", @@ -2457,16 +2410,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/@modelcontextprotocol/sdk/node_modules/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/@modelcontextprotocol/sdk/node_modules/type-is": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", @@ -5110,23 +5053,24 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.5", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz", + "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==", "dev": true, + "license": "MIT", "dependencies": { - "bytes": "3.1.2", + "bytes": "~3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.15.1", + "raw-body": "~2.5.3", "type-is": "~1.6.18", - "unpipe": "1.0.0" + "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8", @@ -6022,10 +5966,11 @@ "license": "MIT" }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -7396,45 +7341,50 @@ "optional": true }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", + "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==", "dev": true, + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", + "body-parser": "~1.20.5", + "content-disposition": "~0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", - "on-finished": "2.4.1", + "on-finished": "~2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "~0.1.12", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "~6.15.1", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "~0.19.0", + "serve-static": "~1.16.2", "setprototypeof": "1.2.0", - "statuses": "2.0.1", + "statuses": "~2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express-rate-limit": { @@ -7456,60 +7406,33 @@ "express": ">= 4.11" } }, - "node_modules/express/node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "dev": true, - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, "node_modules/express/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, - "node_modules/express/node_modules/ms": { + "node_modules/express/node_modules/encodeurl": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/express/node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "dev": true, - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, + "license": "MIT", "engines": { "node": ">= 0.8" } }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -7683,17 +7606,18 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", "dev": true, + "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", - "on-finished": "2.4.1", + "on-finished": "~2.4.1", "parseurl": "~1.3.3", - "statuses": "2.0.1", + "statuses": "~2.0.2", "unpipe": "~1.0.0" }, "engines": { @@ -7705,15 +7629,27 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, + "node_modules/finalhandler/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/find-up": { "version": "5.0.0", @@ -8080,6 +8016,7 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -9203,19 +9140,24 @@ } }, "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", "dev": true, + "license": "MIT", "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" }, "engines": { "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/http-parser-js": { @@ -11463,10 +11405,14 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", - "dev": true + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/merge2": { "version": "1.4.1", @@ -12514,10 +12460,11 @@ "license": "ISC" }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", - "dev": true + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", + "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", + "dev": true, + "license": "MIT" }, "node_modules/path-type": { "version": "4.0.0", @@ -13041,12 +12988,14 @@ } }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.15.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", + "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" }, "engines": { "node": ">=0.6" @@ -13144,15 +13093,16 @@ } }, "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", "dev": true, + "license": "MIT", "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" @@ -13906,24 +13856,25 @@ "dev": true }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", "dev": true, + "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", "mime": "1.6.0", "ms": "2.1.3", - "on-finished": "2.4.1", + "on-finished": "~2.4.1", "range-parser": "~1.2.1", - "statuses": "2.0.1" + "statuses": "~2.0.2" }, "engines": { "node": ">= 0.8.0" @@ -13934,6 +13885,7 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -13942,13 +13894,25 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/send/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } }, "node_modules/send/node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true, + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -13960,23 +13924,35 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", "dev": true, + "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "~0.19.1" }, "engines": { "node": ">= 0.8.0" } }, + "node_modules/serve-static/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/set-getter": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.1.tgz", @@ -14316,10 +14292,11 @@ "license": "MIT" }, "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8" } diff --git a/src/auth.tsx b/src/auth.tsx index d535b894..267ffd4d 100644 --- a/src/auth.tsx +++ b/src/auth.tsx @@ -244,7 +244,7 @@ export function ClaimsCheck({ user, fallback, children, requiredClaims }: Claims * * Meant for Concurrent mode only (``). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376). */ -export function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps): JSX.Element { +export function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps): React.ReactElement { const { data: user } = useUser(); const suspenseMode = useSuspenseEnabledFromConfigAndContext(); diff --git a/src/firestore.tsx b/src/firestore.tsx index 95f42431..fa566cfd 100644 --- a/src/firestore.tsx +++ b/src/firestore.tsx @@ -59,11 +59,11 @@ export function useFirestoreDocOnce(ref: DocumentReference, /** * Subscribe to Firestore Document changes and unwrap the document into a plain object */ -export function useFirestoreDocData(ref: DocumentReference, options?: ReactFireOptions): ObservableStatus { +export function useFirestoreDocData(ref: DocumentReference, options?: ReactFireOptions): ObservableStatus { const idField = options ? checkIdField(options) : 'NO_ID_FIELD'; const observableId = `firestore:docData:${ref.firestore.app.name}:${ref.path}:idField=${idField}`; - const observable = docData(ref, { idField }); + const observable = docData(ref, { idField: idField as keyof T }); return useObservable(observableId, observable, options) as ObservableStatus; } @@ -71,11 +71,11 @@ export function useFirestoreDocData(ref: DocumentReference, opti /** * Get a Firestore document, unwrap the document into a plain object, and don't subscribe to changes */ -export function useFirestoreDocDataOnce(ref: DocumentReference, options?: ReactFireOptions): ObservableStatus { +export function useFirestoreDocDataOnce(ref: DocumentReference, options?: ReactFireOptions): ObservableStatus { const idField = options ? checkIdField(options) : 'NO_ID_FIELD'; const observableId = `firestore:docDataOnce:${ref.firestore.app.name}:${ref.path}:idField=${idField}`; - const observable$ = docData(ref, { idField }).pipe(first()); + const observable$ = docData(ref, { idField: idField as keyof T }).pipe(first()); return useObservable(observableId, observable$, options) as ObservableStatus; } @@ -96,7 +96,7 @@ export function useFirestoreCollection(query: FirestoreQuery(query: FirestoreQuery, options?: ReactFireOptions): ObservableStatus { const idField = options ? checkIdField(options) : 'NO_ID_FIELD'; const observableId = `firestore:collectionData:${getUniqueIdForFirestoreQuery(query)}:idField=${idField}`; - const observable$ = collectionData(query, { idField }); + const observable$ = collectionData(query, { idField: idField as (string & keyof T) }); return useObservable(observableId, observable$, options); } diff --git a/src/index.ts b/src/index.ts index ab60a1fe..4a08c0bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,29 +23,16 @@ export class ReactFireError extends Error { export interface ReactFireOptions { idField?: string; - initialData?: T | any; + initialData?: T; /** * @deprecated use initialData instead */ - startWithValue?: T | any; + startWithValue?: T; suspense?: boolean; } -export function checkOptions(options: ReactFireOptions, field: string) { - // make sure the field passed in is a valid key of ReactFire Options - if (field === 'idField' || field === 'initialData' || field === 'suspense') { - return options ? (options[field] as ReactFireOptions['idField'] | ReactFireOptions['initialData'] | ReactFireOptions['suspense']) : undefined; - } - - throw new Error(`Field "${field}" is not a valid key in ReactFireOptions`); -} - -export function checkinitialData(options: ReactFireOptions) { - return checkOptions(options, 'initialData'); -} - -export function checkIdField(options: ReactFireOptions) { - return checkOptions(options, 'idField'); +export function checkIdField(options: ReactFireOptions): string | undefined { + return options?.idField; } export * from './auth'; diff --git a/src/performance.tsx b/src/performance.tsx index 92ab587b..7f444bae 100644 --- a/src/performance.tsx +++ b/src/performance.tsx @@ -6,20 +6,21 @@ export interface SuspensePerfProps { fallback: React.ReactNode; } -export function SuspenseWithPerf({ children, traceId, fallback }: SuspensePerfProps): JSX.Element { +export function SuspenseWithPerf({ children, traceId, fallback }: SuspensePerfProps): React.ReactElement { // TODO: Should this import firebase/performance? - const entries = performance?.getEntriesByName?.(traceId, 'measure') || []; + const perf = typeof globalThis !== 'undefined' ? globalThis.performance : undefined; + const entries = perf?.getEntriesByName?.(traceId, 'measure') || []; const startMarkName = `_${traceId}Start[${entries.length}]`; const endMarkName = `_${traceId}End[${entries.length}]`; const Fallback = () => { - React.useLayoutEffect(() => { - performance?.mark?.(startMarkName); + React.useEffect(() => { + perf?.mark?.(startMarkName); return () => { - performance?.mark?.(endMarkName); - performance?.measure?.(traceId, startMarkName, endMarkName); + perf?.mark?.(endMarkName); + perf?.measure?.(traceId, startMarkName, endMarkName); }; }, []); diff --git a/src/reactfire-options.type-test.ts b/src/reactfire-options.type-test.ts new file mode 100644 index 00000000..739b141a --- /dev/null +++ b/src/reactfire-options.type-test.ts @@ -0,0 +1,18 @@ +/** + * Type-level regression tests for ReactFireOptions generic constraints. + * Checked by `tsc --noEmit` in CI. No runtime behavior — not bundled. + */ +import type { ReactFireOptions } from './index'; + +// ---- initialData must match T ---- + +void ((): ReactFireOptions => ({ initialData: 'hello' }))(); +void ((): ReactFireOptions => ({ initialData: 42 }))(); + +// @ts-expect-error initialData must be T, not a different type +const _wrongInitialData: ReactFireOptions = { initialData: 123 }; +void _wrongInitialData; + +// @ts-expect-error startWithValue must be T, not a different type +const _wrongStartWithValue: ReactFireOptions = { startWithValue: 123 }; +void _wrongStartWithValue; diff --git a/src/sdk.tsx b/src/sdk.tsx index 2e7af1a6..ee66ffff 100644 --- a/src/sdk.tsx +++ b/src/sdk.tsx @@ -28,7 +28,7 @@ export const RemoteConfigSdkContext = React.createContext(SdkContext: React.Context) { - return function SdkProvider(props: React.PropsWithChildren<{ sdk: Sdk }>) { + return function SdkProvider(props: React.PropsWithChildren<{ sdk: Sdk }>): React.ReactElement { if (!props.sdk) throw new Error('no sdk provided'); const contextualAppName = useFirebaseApp().name; diff --git a/src/storage.tsx b/src/storage.tsx index 90ea56c1..5a0299da 100644 --- a/src/storage.tsx +++ b/src/storage.tsx @@ -37,7 +37,7 @@ export type StorageImageProps = { storagePath: string; storage?: FirebaseStorage; suspense?: boolean; - placeHolder?: JSX.Element; + placeHolder?: React.ReactNode; }; function StorageFromContext(props: StorageImageProps & React.DetailedHTMLProps, HTMLImageElement>) { @@ -48,7 +48,7 @@ function StorageFromContext(props: StorageImageProps & React.DetailedHTMLProps; } -function INTERNALStorageImage(props: StorageImageProps & React.DetailedHTMLProps, HTMLImageElement>): JSX.Element { +function INTERNALStorageImage(props: StorageImageProps & React.DetailedHTMLProps, HTMLImageElement>): React.ReactNode { const { storage, storagePath, suspense, placeHolder, ...imgProps } = props; const reactfireOptions: ReactFireOptions = { diff --git a/src/useObservable.ts b/src/useObservable.ts index 08e8c748..ed5bcfc4 100644 --- a/src/useObservable.ts +++ b/src/useObservable.ts @@ -127,7 +127,7 @@ export function useObservable(observableId: string, source: Observa // modify the value if initialData exists if (!observable.hasValue && hasData) { - update.data = config?.initialData ?? config?.startWithValue; + update.data = (config?.initialData ?? config?.startWithValue) as T | undefined; update.status = 'success'; update.hasEmitted = true; } diff --git a/tsconfig.json b/tsconfig.json index 9ed6d34b..7cb9a9dd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,8 +21,7 @@ // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative "noUnusedLocals": true, "noUnusedParameters": true, - "moduleResolution": "node", - "ignoreDeprecations": "6.0", + "moduleResolution": "bundler", // transpile JSX to React.createElement "jsx": "react", // interop between ESM and CJS modules. Recommended by TS