@astrogate/sdk 0.0.0-stage → 0.1.0
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/README.md +6 -2
- package/THIRD_PARTY_NOTICES.md +17 -0
- package/dist/browser.d.ts +85 -0
- package/dist/browser.js +16 -0
- package/dist/database-binding.d.ts +7 -0
- package/dist/database-binding.js +11 -0
- package/dist/hosted-session.d.ts +1 -0
- package/dist/hosted-session.js +11 -0
- package/dist/http.d.ts +24 -0
- package/dist/http.js +92 -0
- package/dist/inventory.d.ts +7 -0
- package/dist/inventory.js +18 -0
- package/dist/management-read.d.ts +17 -0
- package/dist/management-read.js +104 -0
- package/dist/management.d.ts +347 -0
- package/dist/management.js +137 -0
- package/dist/operator.d.ts +136 -0
- package/dist/operator.js +53 -0
- package/dist/react.d.ts +16 -0
- package/dist/react.js +10 -0
- package/dist/server.d.ts +27 -0
- package/dist/server.js +30 -0
- package/dist/services.d.ts +7 -0
- package/dist/services.js +53 -0
- package/dist/storage.d.ts +68 -0
- package/dist/storage.js +30 -0
- package/dist/tasks.d.ts +42 -0
- package/dist/tasks.js +24 -0
- package/dist/wire.gen.d.ts +7107 -0
- package/dist/wire.gen.js +5 -0
- package/native-provenance.json +15 -0
- package/node_modules/@instantdb/admin/LICENSE +202 -0
- package/node_modules/@instantdb/admin/dist/esm/index.d.ts +607 -0
- package/node_modules/@instantdb/admin/dist/esm/index.js +1036 -0
- package/node_modules/@instantdb/admin/dist/esm/polyfill.d.ts +16 -0
- package/node_modules/@instantdb/admin/dist/esm/polyfill.js +21 -0
- package/node_modules/@instantdb/admin/dist/esm/subscribe.d.ts +38 -0
- package/node_modules/@instantdb/admin/dist/esm/subscribe.js +301 -0
- package/node_modules/@instantdb/admin/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/admin/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/admin/package.json +23 -0
- package/node_modules/@instantdb/core/LICENSE +202 -0
- package/node_modules/@instantdb/core/dist/esm/Connection.d.ts +92 -0
- package/node_modules/@instantdb/core/dist/esm/Connection.js +188 -0
- package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.d.ts +10 -0
- package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.js +25 -0
- package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.d.ts +17 -0
- package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.js +309 -0
- package/node_modules/@instantdb/core/dist/esm/InstantError.d.ts +6 -0
- package/node_modules/@instantdb/core/dist/esm/InstantError.js +23 -0
- package/node_modules/@instantdb/core/dist/esm/Reactor.d.ts +430 -0
- package/node_modules/@instantdb/core/dist/esm/Reactor.js +2369 -0
- package/node_modules/@instantdb/core/dist/esm/StorageAPI.d.ts +39 -0
- package/node_modules/@instantdb/core/dist/esm/StorageAPI.js +65 -0
- package/node_modules/@instantdb/core/dist/esm/Stream.d.ts +120 -0
- package/node_modules/@instantdb/core/dist/esm/Stream.js +811 -0
- package/node_modules/@instantdb/core/dist/esm/SyncTable.d.ts +144 -0
- package/node_modules/@instantdb/core/dist/esm/SyncTable.js +523 -0
- package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.d.ts +4 -0
- package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.js +19 -0
- package/node_modules/@instantdb/core/dist/esm/attrTypes.d.ts +25 -0
- package/node_modules/@instantdb/core/dist/esm/attrTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/authAPI.d.ts +64 -0
- package/node_modules/@instantdb/core/dist/esm/authAPI.js +103 -0
- package/node_modules/@instantdb/core/dist/esm/clientTypes.d.ts +40 -0
- package/node_modules/@instantdb/core/dist/esm/clientTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/coreTypes.d.ts +33 -0
- package/node_modules/@instantdb/core/dist/esm/coreTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/createRouteHandler.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/createRouteHandler.js +51 -0
- package/node_modules/@instantdb/core/dist/esm/datalog.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/datalog.js +99 -0
- package/node_modules/@instantdb/core/dist/esm/devtool.d.ts +3 -0
- package/node_modules/@instantdb/core/dist/esm/devtool.js +144 -0
- package/node_modules/@instantdb/core/dist/esm/framework.d.ts +80 -0
- package/node_modules/@instantdb/core/dist/esm/framework.js +243 -0
- package/node_modules/@instantdb/core/dist/esm/helperTypes.d.ts +75 -0
- package/node_modules/@instantdb/core/dist/esm/helperTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/index.d.ts +597 -0
- package/node_modules/@instantdb/core/dist/esm/index.js +649 -0
- package/node_modules/@instantdb/core/dist/esm/infiniteQuery.d.ts +25 -0
- package/node_modules/@instantdb/core/dist/esm/infiniteQuery.js +430 -0
- package/node_modules/@instantdb/core/dist/esm/instaml.d.ts +17 -0
- package/node_modules/@instantdb/core/dist/esm/instaml.js +576 -0
- package/node_modules/@instantdb/core/dist/esm/instaql.d.ts +12 -0
- package/node_modules/@instantdb/core/dist/esm/instaql.js +632 -0
- package/node_modules/@instantdb/core/dist/esm/instatx.d.ts +127 -0
- package/node_modules/@instantdb/core/dist/esm/instatx.js +93 -0
- package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.js +24 -0
- package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.js +142 -0
- package/node_modules/@instantdb/core/dist/esm/presence.d.ts +50 -0
- package/node_modules/@instantdb/core/dist/esm/presence.js +50 -0
- package/node_modules/@instantdb/core/dist/esm/presenceTypes.d.ts +9 -0
- package/node_modules/@instantdb/core/dist/esm/presenceTypes.js +3 -0
- package/node_modules/@instantdb/core/dist/esm/queryTypes.d.ts +271 -0
- package/node_modules/@instantdb/core/dist/esm/queryTypes.js +3 -0
- package/node_modules/@instantdb/core/dist/esm/queryValidation.d.ts +5 -0
- package/node_modules/@instantdb/core/dist/esm/queryValidation.js +287 -0
- package/node_modules/@instantdb/core/dist/esm/reactorTypes.d.ts +29 -0
- package/node_modules/@instantdb/core/dist/esm/reactorTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.d.ts +19 -0
- package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/rulesTypes.d.ts +85 -0
- package/node_modules/@instantdb/core/dist/esm/rulesTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.d.ts +18 -0
- package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.js +152 -0
- package/node_modules/@instantdb/core/dist/esm/schema.d.ts +72 -0
- package/node_modules/@instantdb/core/dist/esm/schema.js +128 -0
- package/node_modules/@instantdb/core/dist/esm/schemaTypes.d.ts +244 -0
- package/node_modules/@instantdb/core/dist/esm/schemaTypes.js +106 -0
- package/node_modules/@instantdb/core/dist/esm/store.d.ts +89 -0
- package/node_modules/@instantdb/core/dist/esm/store.js +722 -0
- package/node_modules/@instantdb/core/dist/esm/transactionValidation.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/transactionValidation.js +130 -0
- package/node_modules/@instantdb/core/dist/esm/utils/Deferred.d.ts +8 -0
- package/node_modules/@instantdb/core/dist/esm/utils/Deferred.js +17 -0
- package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.d.ts +80 -0
- package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.js +448 -0
- package/node_modules/@instantdb/core/dist/esm/utils/dates.d.ts +1 -0
- package/node_modules/@instantdb/core/dist/esm/utils/dates.js +211 -0
- package/node_modules/@instantdb/core/dist/esm/utils/error.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/utils/error.js +8 -0
- package/node_modules/@instantdb/core/dist/esm/utils/fetch.d.ts +125 -0
- package/node_modules/@instantdb/core/dist/esm/utils/fetch.js +31 -0
- package/node_modules/@instantdb/core/dist/esm/utils/flags.d.ts +4 -0
- package/node_modules/@instantdb/core/dist/esm/utils/flags.js +10 -0
- package/node_modules/@instantdb/core/dist/esm/utils/id.d.ts +3 -0
- package/node_modules/@instantdb/core/dist/esm/utils/id.js +25 -0
- package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.js +17 -0
- package/node_modules/@instantdb/core/dist/esm/utils/log.d.ts +6 -0
- package/node_modules/@instantdb/core/dist/esm/utils/log.js +13 -0
- package/node_modules/@instantdb/core/dist/esm/utils/object.d.ts +16 -0
- package/node_modules/@instantdb/core/dist/esm/utils/object.js +143 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pgtime.d.ts +197 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pgtime.js +197 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pick.d.ts +1 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pick.js +9 -0
- package/node_modules/@instantdb/core/dist/esm/utils/strings.d.ts +1 -0
- package/node_modules/@instantdb/core/dist/esm/utils/strings.js +15 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHash.d.ts +15 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHash.js +71 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.js +72 -0
- package/node_modules/@instantdb/core/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/core/dist/esm/warningToggle.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/warningToggle.js +4 -0
- package/node_modules/@instantdb/core/package.json +20 -0
- package/node_modules/@instantdb/eventsource/LICENSE +22 -0
- package/node_modules/@instantdb/eventsource/README.md +226 -0
- package/node_modules/@instantdb/eventsource/dist/index.cjs +279 -0
- package/node_modules/@instantdb/eventsource/dist/index.cjs.map +1 -0
- package/node_modules/@instantdb/eventsource/dist/index.d.cts +346 -0
- package/node_modules/@instantdb/eventsource/dist/index.d.ts +346 -0
- package/node_modules/@instantdb/eventsource/dist/index.js +279 -0
- package/node_modules/@instantdb/eventsource/dist/index.js.map +1 -0
- package/node_modules/@instantdb/eventsource/package.json +128 -0
- package/node_modules/@instantdb/eventsource/src/EventSource.ts +614 -0
- package/node_modules/@instantdb/eventsource/src/errors.ts +141 -0
- package/node_modules/@instantdb/eventsource/src/index.ts +3 -0
- package/node_modules/@instantdb/eventsource/src/types.ts +164 -0
- package/node_modules/@instantdb/react/LICENSE +202 -0
- package/node_modules/@instantdb/react/dist/esm/Cursors.d.ts +18 -0
- package/node_modules/@instantdb/react/dist/esm/Cursors.js +103 -0
- package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.d.ts +5 -0
- package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.js +5 -0
- package/node_modules/@instantdb/react/dist/esm/index.d.ts +6 -0
- package/node_modules/@instantdb/react/dist/esm/index.js +22 -0
- package/node_modules/@instantdb/react/dist/esm/init.d.ts +40 -0
- package/node_modules/@instantdb/react/dist/esm/init.js +49 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.d.ts +65 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.js +96 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.d.ts +11 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.js +31 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.d.ts +24 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.js +162 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.d.ts +9 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.js +16 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.d.ts +2 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.js +20 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/index.d.ts +29 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/index.js +34 -0
- package/node_modules/@instantdb/react/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/react/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/react/package.json +24 -0
- package/node_modules/@instantdb/react-common/LICENSE +202 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.d.ts +282 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.js +386 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.d.ts +182 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.js +280 -0
- package/node_modules/@instantdb/react-common/dist/esm/index.d.ts +4 -0
- package/node_modules/@instantdb/react-common/dist/esm/index.js +3 -0
- package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.d.ts +27 -0
- package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.js +53 -0
- package/node_modules/@instantdb/react-common/dist/esm/useQuery.d.ts +6 -0
- package/node_modules/@instantdb/react-common/dist/esm/useQuery.js +75 -0
- package/node_modules/@instantdb/react-common/dist/esm/useTimeout.d.ts +4 -0
- package/node_modules/@instantdb/react-common/dist/esm/useTimeout.js +17 -0
- package/node_modules/@instantdb/react-common/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/react-common/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/react-common/package.json +22 -0
- package/node_modules/@instantdb/version/LICENSE +202 -0
- package/node_modules/@instantdb/version/dist/esm/index.d.ts +2 -0
- package/node_modules/@instantdb/version/dist/esm/index.js +2 -0
- package/node_modules/@instantdb/version/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/version/dist/esm/version.js +5 -0
- package/node_modules/@instantdb/version/package.json +16 -0
- package/node_modules/@instantdb/webhooks/LICENSE +202 -0
- package/node_modules/@instantdb/webhooks/dist/esm/index.d.ts +587 -0
- package/node_modules/@instantdb/webhooks/dist/esm/index.js +748 -0
- package/node_modules/@instantdb/webhooks/package.json +18 -0
- package/node_modules/cookie/LICENSE +24 -0
- package/node_modules/cookie/README.md +295 -0
- package/node_modules/cookie/dist/index.d.ts +143 -0
- package/node_modules/cookie/dist/index.js +355 -0
- package/node_modules/cookie/dist/index.js.map +1 -0
- package/node_modules/cookie/package.json +57 -0
- package/node_modules/eventsource/LICENSE +22 -0
- package/node_modules/eventsource/README.md +252 -0
- package/node_modules/eventsource/dist/EventSource.d.ts +128 -0
- package/node_modules/eventsource/dist/EventSource.d.ts.map +1 -0
- package/node_modules/eventsource/dist/EventSource.js +556 -0
- package/node_modules/eventsource/dist/EventSource.js.map +1 -0
- package/node_modules/eventsource/dist/errors.d.ts +53 -0
- package/node_modules/eventsource/dist/errors.d.ts.map +1 -0
- package/node_modules/eventsource/dist/errors.js +120 -0
- package/node_modules/eventsource/dist/errors.js.map +1 -0
- package/node_modules/eventsource/dist/index.d.ts +4 -0
- package/node_modules/eventsource/dist/index.d.ts.map +1 -0
- package/node_modules/eventsource/dist/index.js +3 -0
- package/node_modules/eventsource/dist/index.js.map +1 -0
- package/node_modules/eventsource/dist/types.d.ts +156 -0
- package/node_modules/eventsource/dist/types.d.ts.map +1 -0
- package/node_modules/eventsource/dist/types.js +2 -0
- package/node_modules/eventsource/dist/types.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/LICENSE +21 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/README.md +177 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts +35 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js +16 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts +4 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js +3 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts +12 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js +509 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts +76 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js +59 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts +130 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/package.json +96 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/errors.ts +44 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/index.ts +3 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/parse.ts +576 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/stream.ts +118 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/types.ts +138 -0
- package/node_modules/eventsource/package.json +103 -0
- package/node_modules/eventsource/src/EventSource.ts +844 -0
- package/node_modules/eventsource/src/errors.ts +141 -0
- package/node_modules/eventsource/src/index.ts +3 -0
- package/node_modules/eventsource/src/types.ts +166 -0
- package/node_modules/eventsource-parser/LICENSE +21 -0
- package/node_modules/eventsource-parser/README.md +157 -0
- package/node_modules/eventsource-parser/dist/index.cjs +177 -0
- package/node_modules/eventsource-parser/dist/index.cjs.map +1 -0
- package/node_modules/eventsource-parser/dist/index.d.cts +169 -0
- package/node_modules/eventsource-parser/dist/index.d.ts +169 -0
- package/node_modules/eventsource-parser/dist/index.js +177 -0
- package/node_modules/eventsource-parser/dist/index.js.map +1 -0
- package/node_modules/eventsource-parser/dist/stream.cjs +29 -0
- package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -0
- package/node_modules/eventsource-parser/dist/stream.d.cts +134 -0
- package/node_modules/eventsource-parser/dist/stream.d.ts +134 -0
- package/node_modules/eventsource-parser/dist/stream.js +30 -0
- package/node_modules/eventsource-parser/dist/stream.js.map +1 -0
- package/node_modules/eventsource-parser/package.json +92 -0
- package/node_modules/eventsource-parser/src/errors.ts +44 -0
- package/node_modules/eventsource-parser/src/index.ts +8 -0
- package/node_modules/eventsource-parser/src/parse.ts +439 -0
- package/node_modules/eventsource-parser/src/stream.ts +107 -0
- package/node_modules/eventsource-parser/src/types.ts +122 -0
- package/node_modules/eventsource-parser/stream.js +2 -0
- package/node_modules/mutative/LICENSE +21 -0
- package/node_modules/mutative/README.md +870 -0
- package/node_modules/mutative/dist/apply.d.ts +31 -0
- package/node_modules/mutative/dist/array.d.ts +45 -0
- package/node_modules/mutative/dist/constant.d.ts +8 -0
- package/node_modules/mutative/dist/create.d.ts +46 -0
- package/node_modules/mutative/dist/current.d.ts +23 -0
- package/node_modules/mutative/dist/draft.d.ts +3 -0
- package/node_modules/mutative/dist/draftify.d.ts +2 -0
- package/node_modules/mutative/dist/error.d.ts +54 -0
- package/node_modules/mutative/dist/index.d.mts +1 -0
- package/node_modules/mutative/dist/index.d.ts +12 -0
- package/node_modules/mutative/dist/index.js +8 -0
- package/node_modules/mutative/dist/index.mjs +3 -0
- package/node_modules/mutative/dist/interface.d.ts +200 -0
- package/node_modules/mutative/dist/internal.d.ts +4 -0
- package/node_modules/mutative/dist/makeCreator.d.ts +54 -0
- package/node_modules/mutative/dist/map.d.ts +15 -0
- package/node_modules/mutative/dist/mutative.cjs.development.js +2126 -0
- package/node_modules/mutative/dist/mutative.cjs.development.js.map +1 -0
- package/node_modules/mutative/dist/mutative.cjs.production.min.js +2 -0
- package/node_modules/mutative/dist/mutative.cjs.production.min.js.map +1 -0
- package/node_modules/mutative/dist/mutative.esm.js +2123 -0
- package/node_modules/mutative/dist/mutative.esm.js.map +1 -0
- package/node_modules/mutative/dist/mutative.esm.mjs +2123 -0
- package/node_modules/mutative/dist/mutative.esm.mjs.map +1 -0
- package/node_modules/mutative/dist/mutative.esm.production.min.mjs +2 -0
- package/node_modules/mutative/dist/mutative.esm.production.min.mjs.map +1 -0
- package/node_modules/mutative/dist/mutative.umd.development.js +2132 -0
- package/node_modules/mutative/dist/mutative.umd.development.js.map +1 -0
- package/node_modules/mutative/dist/mutative.umd.production.min.js +2 -0
- package/node_modules/mutative/dist/mutative.umd.production.min.js.map +1 -0
- package/node_modules/mutative/dist/original.d.ts +19 -0
- package/node_modules/mutative/dist/patch.d.ts +2 -0
- package/node_modules/mutative/dist/rawReturn.d.ts +19 -0
- package/node_modules/mutative/dist/set.d.ts +14 -0
- package/node_modules/mutative/dist/unsafe.d.ts +34 -0
- package/node_modules/mutative/dist/utils/cast.d.ts +13 -0
- package/node_modules/mutative/dist/utils/copy.d.ts +5 -0
- package/node_modules/mutative/dist/utils/deepFreeze.d.ts +1 -0
- package/node_modules/mutative/dist/utils/draft.d.ts +27 -0
- package/node_modules/mutative/dist/utils/finalize.d.ts +13 -0
- package/node_modules/mutative/dist/utils/forEach.d.ts +1 -0
- package/node_modules/mutative/dist/utils/index.d.ts +7 -0
- package/node_modules/mutative/dist/utils/mark.d.ts +2 -0
- package/node_modules/mutative/dist/utils/marker.d.ts +5 -0
- package/node_modules/mutative/dist/utils/proto.d.ts +10 -0
- package/node_modules/mutative/package.json +142 -0
- package/node_modules/mutative/src/apply.ts +239 -0
- package/node_modules/mutative/src/array.ts +679 -0
- package/node_modules/mutative/src/constant.ts +17 -0
- package/node_modules/mutative/src/create.ts +27 -0
- package/node_modules/mutative/src/current.ts +206 -0
- package/node_modules/mutative/src/draft.ts +489 -0
- package/node_modules/mutative/src/draftify.ts +57 -0
- package/node_modules/mutative/src/error.ts +129 -0
- package/node_modules/mutative/src/index.ts +21 -0
- package/node_modules/mutative/src/interface.ts +321 -0
- package/node_modules/mutative/src/internal.ts +5 -0
- package/node_modules/mutative/src/makeCreator.ts +382 -0
- package/node_modules/mutative/src/map.ts +160 -0
- package/node_modules/mutative/src/original.ts +28 -0
- package/node_modules/mutative/src/patch.ts +386 -0
- package/node_modules/mutative/src/rawReturn.ts +41 -0
- package/node_modules/mutative/src/set.ts +201 -0
- package/node_modules/mutative/src/unsafe.ts +66 -0
- package/node_modules/mutative/src/utils/cast.ts +22 -0
- package/node_modules/mutative/src/utils/copy.ts +224 -0
- package/node_modules/mutative/src/utils/deepFreeze.ts +103 -0
- package/node_modules/mutative/src/utils/draft.ts +189 -0
- package/node_modules/mutative/src/utils/finalize.ts +232 -0
- package/node_modules/mutative/src/utils/forEach.ts +24 -0
- package/node_modules/mutative/src/utils/index.ts +7 -0
- package/node_modules/mutative/src/utils/mark.ts +11 -0
- package/node_modules/mutative/src/utils/marker.ts +34 -0
- package/node_modules/mutative/src/utils/proto.ts +38 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +491 -0
- package/node_modules/uuid/dist/index.d.ts +15 -0
- package/node_modules/uuid/dist/index.js +14 -0
- package/node_modules/uuid/dist/max.d.ts +2 -0
- package/node_modules/uuid/dist/max.js +1 -0
- package/node_modules/uuid/dist/md5.d.ts +2 -0
- package/node_modules/uuid/dist/md5.js +135 -0
- package/node_modules/uuid/dist/nil.d.ts +2 -0
- package/node_modules/uuid/dist/nil.js +1 -0
- package/node_modules/uuid/dist/parse.d.ts +3 -0
- package/node_modules/uuid/dist/parse.js +9 -0
- package/node_modules/uuid/dist/regex.d.ts +2 -0
- package/node_modules/uuid/dist/regex.js +1 -0
- package/node_modules/uuid/dist/rng.d.ts +1 -0
- package/node_modules/uuid/dist/rng.js +4 -0
- package/node_modules/uuid/dist/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/sha1.js +70 -0
- package/node_modules/uuid/dist/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/stringify.js +35 -0
- package/node_modules/uuid/dist/types.d.ts +22 -0
- package/node_modules/uuid/dist/types.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/v1.d.ts +11 -0
- package/node_modules/uuid/dist/v1.js +87 -0
- package/node_modules/uuid/dist/v1ToV6.d.ts +3 -0
- package/node_modules/uuid/dist/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/v3.d.ts +9 -0
- package/node_modules/uuid/dist/v3.js +9 -0
- package/node_modules/uuid/dist/v35.d.ts +7 -0
- package/node_modules/uuid/dist/v35.js +39 -0
- package/node_modules/uuid/dist/v4.d.ts +4 -0
- package/node_modules/uuid/dist/v4.js +29 -0
- package/node_modules/uuid/dist/v5.d.ts +9 -0
- package/node_modules/uuid/dist/v5.js +9 -0
- package/node_modules/uuid/dist/v6.d.ts +4 -0
- package/node_modules/uuid/dist/v6.js +20 -0
- package/node_modules/uuid/dist/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/v7.d.ts +9 -0
- package/node_modules/uuid/dist/v7.js +68 -0
- package/node_modules/uuid/dist/validate.d.ts +2 -0
- package/node_modules/uuid/dist/validate.js +5 -0
- package/node_modules/uuid/dist/version.d.ts +2 -0
- package/node_modules/uuid/dist/version.js +8 -0
- package/node_modules/uuid/dist-node/bin/uuid +2 -0
- package/node_modules/uuid/dist-node/index.js +14 -0
- package/node_modules/uuid/dist-node/max.js +1 -0
- package/node_modules/uuid/dist-node/md5.js +11 -0
- package/node_modules/uuid/dist-node/nil.js +1 -0
- package/node_modules/uuid/dist-node/parse.js +9 -0
- package/node_modules/uuid/dist-node/regex.js +1 -0
- package/node_modules/uuid/dist-node/rng.js +4 -0
- package/node_modules/uuid/dist-node/sha1.js +11 -0
- package/node_modules/uuid/dist-node/stringify.js +35 -0
- package/node_modules/uuid/dist-node/types.js +1 -0
- package/node_modules/uuid/dist-node/uuid-bin.js +70 -0
- package/node_modules/uuid/dist-node/v1.js +87 -0
- package/node_modules/uuid/dist-node/v1ToV6.js +10 -0
- package/node_modules/uuid/dist-node/v3.js +9 -0
- package/node_modules/uuid/dist-node/v35.js +39 -0
- package/node_modules/uuid/dist-node/v4.js +29 -0
- package/node_modules/uuid/dist-node/v5.js +9 -0
- package/node_modules/uuid/dist-node/v6.js +20 -0
- package/node_modules/uuid/dist-node/v6ToV1.js +10 -0
- package/node_modules/uuid/dist-node/v7.js +68 -0
- package/node_modules/uuid/dist-node/validate.js +5 -0
- package/node_modules/uuid/dist-node/version.js +8 -0
- package/node_modules/uuid/package.json +115 -0
- package/package.json +80 -4
- package/release.json +78 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An extended version of the `Event` emitted by the `EventSource` object when an error occurs.
|
|
3
|
+
* While the spec does not include any additional properties, we intentionally go beyond the spec
|
|
4
|
+
* and provide some (minimal) additional information to aid in debugging.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class ErrorEvent extends Event {
|
|
9
|
+
/**
|
|
10
|
+
* HTTP status code, if this was triggered by an HTTP error
|
|
11
|
+
* Note: this is not part of the spec, but is included for better error handling.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
code;
|
|
16
|
+
/**
|
|
17
|
+
* Optional message attached to the error.
|
|
18
|
+
* Note: this is not part of the spec, but is included for better error handling.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
message;
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
25
|
+
* but rather emitted by the `EventSource` object when an error occurs.
|
|
26
|
+
*
|
|
27
|
+
* @param type - The type of the event (should be "error")
|
|
28
|
+
* @param errorEventInitDict - Optional properties to include in the error event
|
|
29
|
+
*/
|
|
30
|
+
constructor(type, errorEventInitDict) {
|
|
31
|
+
super(type);
|
|
32
|
+
this.code = errorEventInitDict?.code ?? undefined;
|
|
33
|
+
this.message = errorEventInitDict?.message ?? undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
37
|
+
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
38
|
+
* we explicitly include the properties in the `inspect` method.
|
|
39
|
+
*
|
|
40
|
+
* This is automatically called by Node.js when you `console.log` an instance of this class.
|
|
41
|
+
*
|
|
42
|
+
* @param _depth - The current depth
|
|
43
|
+
* @param options - The options passed to `util.inspect`
|
|
44
|
+
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
45
|
+
* @returns A string representation of the error
|
|
46
|
+
*/
|
|
47
|
+
[Symbol.for('nodejs.util.inspect.custom')](_depth, options, inspect) {
|
|
48
|
+
return inspect(inspectableError(this), options);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
52
|
+
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
53
|
+
* we explicitly include the properties in the `inspect` method.
|
|
54
|
+
*
|
|
55
|
+
* This is automatically called by Deno when you `console.log` an instance of this class.
|
|
56
|
+
*
|
|
57
|
+
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
58
|
+
* @param options - The options passed to `Deno.inspect`
|
|
59
|
+
* @returns A string representation of the error
|
|
60
|
+
*/
|
|
61
|
+
[Symbol.for('Deno.customInspect')](inspect, options) {
|
|
62
|
+
return inspect(inspectableError(this), options);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* For environments where DOMException may not exist, we will use a SyntaxError instead.
|
|
67
|
+
* While this isn't strictly according to spec, it is very close.
|
|
68
|
+
*
|
|
69
|
+
* @param message - The message to include in the error
|
|
70
|
+
* @returns A `DOMException` or `SyntaxError` instance
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export function syntaxError(message) {
|
|
74
|
+
// If someone can figure out a way to make this work without depending on DOM/Node.js typings,
|
|
75
|
+
// and without casting to `any`, please send a PR 🙏
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
+
const DomException = globalThis.DOMException;
|
|
78
|
+
if (typeof DomException === 'function') {
|
|
79
|
+
return new DomException(message, 'SyntaxError');
|
|
80
|
+
}
|
|
81
|
+
return new SyntaxError(message);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Flatten an error into a single error message string.
|
|
85
|
+
* Unwraps nested errors and joins them with a comma.
|
|
86
|
+
*
|
|
87
|
+
* @param err - The error to flatten
|
|
88
|
+
* @returns A string representation of the error
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export function flattenError(err) {
|
|
92
|
+
if (!(err instanceof Error)) {
|
|
93
|
+
return `${err}`;
|
|
94
|
+
}
|
|
95
|
+
if ('errors' in err && Array.isArray(err.errors)) {
|
|
96
|
+
return err.errors.map(flattenError).join(', ');
|
|
97
|
+
}
|
|
98
|
+
if ('cause' in err && err.cause instanceof Error) {
|
|
99
|
+
return `${err}: ${flattenError(err.cause)}`;
|
|
100
|
+
}
|
|
101
|
+
return err.message;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Convert an `ErrorEvent` instance into a plain object for inspection.
|
|
105
|
+
*
|
|
106
|
+
* @param err - The `ErrorEvent` instance to inspect
|
|
107
|
+
* @returns A plain object representation of the error
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
function inspectableError(err) {
|
|
111
|
+
return {
|
|
112
|
+
type: err.type,
|
|
113
|
+
message: err.message,
|
|
114
|
+
code: err.code,
|
|
115
|
+
defaultPrevented: err.defaultPrevented,
|
|
116
|
+
cancelable: err.cancelable,
|
|
117
|
+
timeStamp: err.timeStamp,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC;;;;;OAKG;IACI,IAAI,CAAqB;IAEhC;;;;;OAKG;IACI,OAAO,CAAqB;IAEnC;;;;;;OAMG;IACH,YACE,IAAY,EACZ,kBAA8E;QAE9E,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,IAAI,GAAG,kBAAkB,EAAE,IAAI,IAAI,SAAS,CAAA;QACjD,IAAI,CAAC,OAAO,GAAG,kBAAkB,EAAE,OAAO,IAAI,SAAS,CAAA;IACzD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CACxC,MAAc,EACd,OAA0B,EAC1B,OAAoE;QAEpE,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;;;;;OAUG;IACH,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAChC,OAAoE,EACpE,OAA0B;QAE1B,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,8FAA8F;IAC9F,oDAAoD;IAEpD,8DAA8D;IAC9D,MAAM,YAAY,GAAI,UAAkB,CAAC,YAAY,CAAA;IACrD,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE,CAAC;QACvC,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IACjD,CAAC;IAED,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,GAAG,EAAE,CAAA;IACjB,CAAC;IAED,IAAI,QAAQ,IAAI,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,OAAO,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,YAAY,KAAK,EAAE,CAAC;QACjD,OAAO,GAAG,GAAG,KAAK,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAA;IAC7C,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAA;AACpB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,GAAe;IACvC,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;QACtC,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,WAAW,EAAE,KAAK,sBAAsB,EAAC,MAAM,kBAAkB,CAAA;AACzE,mBAAmB,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,WAAW,EAA8B,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { ErrorEvent } from './errors.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Stripped down version of `fetch()`, only defining the parts we care about.
|
|
4
|
+
* This ensures it should work with "most" fetch implementations.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type FetchLike = (url: string | URL, init: EventSourceFetchInit) => Promise<FetchLikeResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Subset of `RequestInit` used for `fetch()` calls made by the `EventSource` class.
|
|
11
|
+
* As we know that we will be passing certain values, we can be more specific and have
|
|
12
|
+
* users not have to do optional chaining and similar for things that will always be there.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export interface EventSourceFetchInit {
|
|
17
|
+
/** An AbortSignal to set request's signal. Typed as `any` because of polyfill inconsistencies. */
|
|
18
|
+
signal: {
|
|
19
|
+
aborted: boolean;
|
|
20
|
+
} | any;
|
|
21
|
+
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
22
|
+
headers: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
Accept: 'text/event-stream';
|
|
25
|
+
};
|
|
26
|
+
/** A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. */
|
|
27
|
+
mode: 'cors' | 'no-cors' | 'same-origin';
|
|
28
|
+
/** A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. */
|
|
29
|
+
credentials?: 'include' | 'omit' | 'same-origin';
|
|
30
|
+
/** Controls how the request is cached. */
|
|
31
|
+
cache: 'no-store';
|
|
32
|
+
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
|
|
33
|
+
redirect: 'error' | 'follow' | 'manual';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A chunk read off a response body.
|
|
37
|
+
*
|
|
38
|
+
* Chunks are handed to a `TextDecoder`, which only accepts buffers, so this is what a reader has
|
|
39
|
+
* to yield to be usable. The union is spelled out because the node (`TypedArray | DataView`) and
|
|
40
|
+
* DOM (`ArrayBufferView`) typings describe "any buffer view" differently, and these three members
|
|
41
|
+
* are accepted by both.
|
|
42
|
+
*/
|
|
43
|
+
type BodyChunk = Uint8Array | DataView | ArrayBuffer;
|
|
44
|
+
/**
|
|
45
|
+
* Stripped down version of `ReadableStreamDefaultReader`, only defining the parts we care about.
|
|
46
|
+
*
|
|
47
|
+
* Note that the `done: true` result allows `value` to be missing _or_ explicitly `undefined`:
|
|
48
|
+
* TypeScript 5.9's DOM lib types `ReadableStreamDefaultReader.read()`'s done-result as
|
|
49
|
+
* `{done: true, value: T | undefined}`, so under `exactOptionalPropertyTypes` an optional
|
|
50
|
+
* property alone would reject standard readers.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export interface ReaderLike {
|
|
55
|
+
read(): Promise<{
|
|
56
|
+
done: false;
|
|
57
|
+
value: BodyChunk;
|
|
58
|
+
} | {
|
|
59
|
+
done: true;
|
|
60
|
+
value?: BodyChunk | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
cancel(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Minimal version of the `Response` type returned by `fetch()`.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export interface FetchLikeResponse {
|
|
70
|
+
readonly body: {
|
|
71
|
+
getReader(): ReaderLike;
|
|
72
|
+
} | Response['body'] | null;
|
|
73
|
+
readonly url: string;
|
|
74
|
+
readonly status: number;
|
|
75
|
+
readonly redirected: boolean;
|
|
76
|
+
readonly headers: {
|
|
77
|
+
get(name: string): string | null;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Mirrors the official DOM typings, with the exception of the extended ErrorEvent.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export interface EventSourceEventMap {
|
|
86
|
+
error: ErrorEvent;
|
|
87
|
+
message: MessageEvent;
|
|
88
|
+
open: Event;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Mirrors the official DOM typings (for the most part)
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export interface EventSourceInit {
|
|
96
|
+
/**
|
|
97
|
+
* A boolean value, defaulting to `false`, indicating if CORS should be set to `include` credentials.
|
|
98
|
+
*/
|
|
99
|
+
withCredentials?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Optional fetch implementation to use. Defaults to `globalThis.fetch`.
|
|
102
|
+
* Can also be used for advanced use cases like mocking, proxying, custom certs etc.
|
|
103
|
+
*/
|
|
104
|
+
fetch?: FetchLike;
|
|
105
|
+
/**
|
|
106
|
+
* Maximum number of characters to buffer while parsing an incomplete EventSource line.
|
|
107
|
+
* Defaults to 100 MB.
|
|
108
|
+
*/
|
|
109
|
+
maxBufferSize?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Mirrors the official DOM typings (sorta).
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export interface EventListenerOptions {
|
|
117
|
+
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
|
|
118
|
+
capture?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Mirrors the official DOM typings (sorta).
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export interface AddEventListenerOptions extends EventListenerOptions {
|
|
126
|
+
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
|
|
127
|
+
once?: boolean;
|
|
128
|
+
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
|
|
129
|
+
passive?: boolean;
|
|
130
|
+
/** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Mirrors the official DOM typings.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
|
139
|
+
/**
|
|
140
|
+
* Mirrors the official DOM typings.
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
export interface EventListener {
|
|
145
|
+
(evt: Event | MessageEvent): void;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Mirrors the official DOM typings.
|
|
149
|
+
*
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
export interface EventListenerObject {
|
|
153
|
+
handleEvent(object: Event): void;
|
|
154
|
+
}
|
|
155
|
+
export {};
|
|
156
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,CACtB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,EAAE,oBAAoB,KACvB,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE/B;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,kGAAkG;IAElG,MAAM,EAAE;QAAC,OAAO,EAAE,OAAO,CAAA;KAAC,GAAG,GAAG,CAAA;IAEhC,oGAAoG;IACpG,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;QACrB,MAAM,EAAE,mBAAmB,CAAA;KAC5B,CAAA;IAED,8HAA8H;IAC9H,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAAA;IAExC,+JAA+J;IAC/J,WAAW,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,aAAa,CAAA;IAEhD,0CAA0C;IAC1C,KAAK,EAAE,UAAU,CAAA;IAEjB,wLAAwL;IACxL,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;CACxC;AAED;;;;;;;GAOG;AACH,KAAK,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEpD;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,IAAI,OAAO,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAC,GAAG;QAAC,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;KAAC,CAAC,CAAA;IAC9F,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,CAAC,IAAI,EAAE;QAAC,SAAS,IAAI,UAAU,CAAA;KAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAClE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE;QAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAC,CAAA;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,UAAU,CAAA;IACjB,OAAO,EAAE,YAAY,CAAA;IACrB,IAAI,EAAE,KAAK,CAAA;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,qGAAqG;IACrG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oIAAoI;IACpI,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mGAAmG;IACnG,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAAG,aAAa,GAAG,mBAAmB,CAAA;AAEpF;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,KAAK,GAAG,YAAY,GAAG,IAAI,CAAA;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAA;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Espen Hovlandsdal <espen@hovlandsdal.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# eventsource-parser
|
|
2
|
+
|
|
3
|
+
[](https://npmx.dev/package/eventsource-parser) [](https://npmx.dev/package/eventsource-parser) [](https://npmx.dev/package/eventsource-parser) [](https://npmx.dev/package/eventsource-parser)
|
|
4
|
+
|
|
5
|
+
A streaming parser for [server-sent events/eventsource](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events), without any assumptions about how the actual stream of data is retrieved. It is intended to be a building block for [clients](https://github.com/rexxars/eventsource-client) and polyfills in javascript environments such as browsers, node.js and deno.
|
|
6
|
+
|
|
7
|
+
If you are looking for a modern client implementation, see [eventsource-client](https://github.com/rexxars/eventsource-client).
|
|
8
|
+
|
|
9
|
+
You create an instance of the parser, and _feed_ it chunks of data - partial or complete, and the parser emits parsed messages once it receives a complete message. A [TransformStream variant](#stream-usage) is also available for environments that support it (modern browsers, Node 22.12 and higher).
|
|
10
|
+
|
|
11
|
+
Other modules in the EventSource family:
|
|
12
|
+
|
|
13
|
+
- [eventsource](https://github.com/eventsource/eventsource): Cross-runtime polyfill for the WhatWG EventSource API.
|
|
14
|
+
- [eventsource-encoder](https://github.com/rexxars/eventsource-encoder): encodes messages in the EventSource/Server-Sent Events format.
|
|
15
|
+
- [eventsource-client](https://github.com/rexxars/eventsource-client): modern, feature rich eventsource client for browsers, node.js, bun, deno and other modern JavaScript environments.
|
|
16
|
+
|
|
17
|
+
> [!NOTE]
|
|
18
|
+
> Migrating from eventsource-parser 1.x/2.x? See the [migration guide](./MIGRATE-v3.md).
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save eventsource-parser
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import {createParser, type EventSourceMessage} from 'eventsource-parser'
|
|
30
|
+
|
|
31
|
+
function onEvent(event: EventSourceMessage) {
|
|
32
|
+
console.log('Received event!')
|
|
33
|
+
console.log('id: %s', event.id || '<none>')
|
|
34
|
+
console.log('event: %s', event.event || '<none>')
|
|
35
|
+
console.log('data: %s', event.data)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const parser = createParser({onEvent})
|
|
39
|
+
const sseStream = getSomeReadableStream()
|
|
40
|
+
|
|
41
|
+
for await (const chunk of sseStream) {
|
|
42
|
+
parser.feed(chunk)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// If you want to re-use the parser for a new stream of events, make sure to reset it!
|
|
46
|
+
parser.reset()
|
|
47
|
+
console.log('Done!')
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Event IDs
|
|
51
|
+
|
|
52
|
+
Use `onId` if you need to track event IDs for reconnection. The parser calls it once when a blank
|
|
53
|
+
line ends a block containing a valid `id` field. It runs for blocks with or without `data`, and it
|
|
54
|
+
runs before `onEvent` when the same block produces an event. An empty `id` field is reported as an
|
|
55
|
+
empty string. An `id` field containing U+0000 is ignored.
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
let lastEventId = ''
|
|
59
|
+
|
|
60
|
+
const parser = createParser({
|
|
61
|
+
onId(id) {
|
|
62
|
+
lastEventId = id
|
|
63
|
+
},
|
|
64
|
+
onEvent(event) {
|
|
65
|
+
// …
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Retry intervals
|
|
71
|
+
|
|
72
|
+
If the server sends a `retry` field in the event stream, the parser will call any `onRetry` callback specified to the `createParser` function:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const parser = createParser({
|
|
76
|
+
onRetry(retryInterval) {
|
|
77
|
+
console.log('Server requested retry interval of %dms', retryInterval)
|
|
78
|
+
},
|
|
79
|
+
onEvent(event) {
|
|
80
|
+
// …
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Parse errors
|
|
86
|
+
|
|
87
|
+
If the parser encounters an error while parsing, it will call any `onError` callback provided to the `createParser` function:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import {type ParseError} from 'eventsource-parser'
|
|
91
|
+
|
|
92
|
+
const parser = createParser({
|
|
93
|
+
onError(error: ParseError) {
|
|
94
|
+
console.error('Error parsing event:', error)
|
|
95
|
+
if (error.type === 'unknown-field') {
|
|
96
|
+
console.error('Field name:', error.field)
|
|
97
|
+
console.error('Field value:', error.value)
|
|
98
|
+
console.error('Line:', error.line)
|
|
99
|
+
} else if (error.type === 'invalid-retry') {
|
|
100
|
+
console.error('Invalid retry interval:', error.value)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onEvent(event) {
|
|
104
|
+
// …
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Note that `unknown-field` errors are emitted for completed invalid lines, not only data shaped as `field: value`. This is because the EventSource specification says to treat anything prior to a `:` as the field name. Incomplete lines that cannot become a valid SSE field may be discarded before completion to avoid unbounded buffering, in which case `onError` is not called and no `line`, `field`, or `value` is retained.
|
|
110
|
+
|
|
111
|
+
> [!NOTE]
|
|
112
|
+
> When encountering the end of a stream, calling `.reset({consume: true})` on the parser to flush any remaining data and reset the parser state. This will trigger the `onError` callback if the pending data has not already been discarded as an invalid line.
|
|
113
|
+
|
|
114
|
+
### Comments
|
|
115
|
+
|
|
116
|
+
The parser will ignore comments (lines starting with `:`) by default. If you want to handle comments, you can provide an `onComment` callback to the `createParser` function:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
const parser = createParser({
|
|
120
|
+
onComment(comment) {
|
|
121
|
+
console.log('Received comment:', comment)
|
|
122
|
+
},
|
|
123
|
+
onEvent(event) {
|
|
124
|
+
// …
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
> [!NOTE]
|
|
130
|
+
> Leading whitespace is not stripped from comments, eg `: comment` will give ` comment` as the comment value, not `comment` (note the leading space).
|
|
131
|
+
|
|
132
|
+
### Limiting buffered memory (`maxBufferSize`)
|
|
133
|
+
|
|
134
|
+
By default the parser buffers valid partial lines and event data until a server completes an event. A server (or proxy) that starts a valid field and never terminates the line, or that keeps appending `data:` lines without ever sending a blank line to dispatch the event, can therefore grow the parser's buffers without bound. Lines that cannot become valid SSE fields are discarded without buffering.
|
|
135
|
+
|
|
136
|
+
Pass a `maxBufferSize` (in characters) to `createParser` to cap this. If the combined size of the pending line buffer and the in-progress event's data buffer exceeds the limit, the parser emits a `ParseError` with `type: 'max-buffer-size-exceeded'` and becomes terminated: subsequent calls to `feed()` will throw until `reset()` is called.
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
const parser = createParser({
|
|
140
|
+
maxBufferSize: 1024 * 1024, // 1 MB
|
|
141
|
+
onEvent(event) {
|
|
142
|
+
// …
|
|
143
|
+
},
|
|
144
|
+
onError(error) {
|
|
145
|
+
if (error.type === 'max-buffer-size-exceeded') {
|
|
146
|
+
// Stream peer is misbehaving — typically you'd close the connection.
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The same option is available on the [stream variant](#stream-usage); the stream is always errored when this limit is exceeded, regardless of the `onError` setting (since the underlying parser is unrecoverable without a `reset()`).
|
|
153
|
+
|
|
154
|
+
## Stream usage
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import {EventSourceParserStream} from 'eventsource-parser/stream'
|
|
158
|
+
|
|
159
|
+
const eventStream = response.body
|
|
160
|
+
.pipeThrough(new TextDecoderStream())
|
|
161
|
+
.pipeThrough(new EventSourceParserStream())
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The stream constructor accepts a subset of the `createParser` options (`onComment`, `onId`, `onRetry`, `maxBufferSize`) plus an `onError` that can either be a function or set to `'terminate'` to error the stream on parse errors. Events are delivered through the stream itself rather than via an `onEvent` callback:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
new EventSourceParserStream({
|
|
168
|
+
maxBufferSize: 1024 * 1024,
|
|
169
|
+
onError: 'terminate',
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Note that the TransformStream is exposed under a separate export (`eventsource-parser/stream`), in order to maximize compatibility with environments that do not have the `TransformStream` constructor available.
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT © [Espen Hovlandsdal](https://espen.codes/)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type of error that occurred.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export type ErrorType = 'invalid-retry' | 'unknown-field' | 'max-buffer-size-exceeded';
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown when encountering an issue during parsing.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare class ParseError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* The type of error that occurred.
|
|
14
|
+
*/
|
|
15
|
+
type: ErrorType;
|
|
16
|
+
/**
|
|
17
|
+
* In the case of a completed unknown field encountered in the stream, this will be the field name.
|
|
18
|
+
*/
|
|
19
|
+
field?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* In the case of a completed unknown field encountered in the stream, this will be the value of the field.
|
|
22
|
+
*/
|
|
23
|
+
value?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The line that caused the error, if available.
|
|
26
|
+
*/
|
|
27
|
+
line?: string | undefined;
|
|
28
|
+
constructor(message: string, options: {
|
|
29
|
+
type: ErrorType;
|
|
30
|
+
field?: string;
|
|
31
|
+
value?: string;
|
|
32
|
+
line?: string;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,eAAe,GAAG,0BAA0B,CAAA;AAEtF;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACH,IAAI,EAAE,SAAS,CAAA;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAE1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAEzB,YACE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAC,IAAI,EAAE,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAQ1E;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when encountering an issue during parsing.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export class ParseError extends Error {
|
|
7
|
+
constructor(message, options) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'ParseError';
|
|
10
|
+
this.type = options.type;
|
|
11
|
+
this.field = options.field;
|
|
12
|
+
this.value = options.value;
|
|
13
|
+
this.line = options.line;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAqBnC,YACE,OAAe,EACf,OAAyE;QAEzE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;QACxB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,SAAS,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AACvC,YAAY,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAC,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAC,MAAM,aAAa,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EventSourceParser, ParserConfig } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new EventSource parser.
|
|
4
|
+
*
|
|
5
|
+
* @param config - Parser configuration. Accepts callbacks (see {@link ParserCallbacks})
|
|
6
|
+
* and options like `maxBufferSize` (see {@link ParserConfig}).
|
|
7
|
+
*
|
|
8
|
+
* @returns A new EventSource parser, with `feed` and `reset` methods.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function createParser(config: ParserConfig): EventSourceParser;
|
|
12
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,YAAY,CAAA;AAQ/D;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,iBAAiB,CAsfpE"}
|