@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,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type of error that occurred.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare type ErrorType =
|
|
6
|
+
| "invalid-retry"
|
|
7
|
+
| "unknown-field"
|
|
8
|
+
| "max-buffer-size-exceeded";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A parsed EventSource message event
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare interface EventSourceMessage {
|
|
16
|
+
/**
|
|
17
|
+
* The event type sent from the server. Note that this differs from the browser `EventSource`
|
|
18
|
+
* implementation in that browsers will default this to `message`, whereas this parser will
|
|
19
|
+
* leave this as `undefined` if not explicitly declared.
|
|
20
|
+
*/
|
|
21
|
+
event?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* ID of the message, if any was provided by the server. Can be used by clients to keep the
|
|
24
|
+
* last received message ID in sync when reconnecting.
|
|
25
|
+
*/
|
|
26
|
+
id?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The data received for this message
|
|
29
|
+
*/
|
|
30
|
+
data: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A TransformStream that ingests a stream of strings and produces a stream of `EventSourceMessage`.
|
|
35
|
+
*
|
|
36
|
+
* @example Basic usage
|
|
37
|
+
* ```
|
|
38
|
+
* const eventStream =
|
|
39
|
+
* response.body
|
|
40
|
+
* .pipeThrough(new TextDecoderStream())
|
|
41
|
+
* .pipeThrough(new EventSourceParserStream())
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Terminate stream on parsing errors
|
|
45
|
+
* ```
|
|
46
|
+
* const eventStream =
|
|
47
|
+
* response.body
|
|
48
|
+
* .pipeThrough(new TextDecoderStream())
|
|
49
|
+
* .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export declare class EventSourceParserStream extends TransformStream<
|
|
55
|
+
string,
|
|
56
|
+
EventSourceMessage
|
|
57
|
+
> {
|
|
58
|
+
constructor({ onError, onRetry, onComment, maxBufferSize }?: StreamOptions);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Error thrown when encountering an issue during parsing.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare class ParseError extends Error {
|
|
67
|
+
/**
|
|
68
|
+
* The type of error that occurred.
|
|
69
|
+
*/
|
|
70
|
+
type: ErrorType;
|
|
71
|
+
/**
|
|
72
|
+
* In the case of an unknown field encountered in the stream, this will be the field name.
|
|
73
|
+
*/
|
|
74
|
+
field?: string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* In the case of an unknown field encountered in the stream, this will be the value of the field.
|
|
77
|
+
*/
|
|
78
|
+
value?: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The line that caused the error, if available.
|
|
81
|
+
*/
|
|
82
|
+
line?: string | undefined;
|
|
83
|
+
constructor(
|
|
84
|
+
message: string,
|
|
85
|
+
options: {
|
|
86
|
+
type: ErrorType;
|
|
87
|
+
field?: string;
|
|
88
|
+
value?: string;
|
|
89
|
+
line?: string;
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Options for the EventSourceParserStream.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
export declare interface StreamOptions {
|
|
100
|
+
/**
|
|
101
|
+
* Behavior when a parsing error occurs.
|
|
102
|
+
*
|
|
103
|
+
* - A custom function can be provided to handle the error.
|
|
104
|
+
* - `'terminate'` will error the stream and stop parsing.
|
|
105
|
+
* - Any other value will ignore the error and continue parsing.
|
|
106
|
+
*
|
|
107
|
+
* @defaultValue `undefined`
|
|
108
|
+
*/
|
|
109
|
+
onError?: ("terminate" | ((error: Error) => void)) | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Callback for when a reconnection interval is sent from the server.
|
|
112
|
+
*
|
|
113
|
+
* @param retry - The number of milliseconds to wait before reconnecting.
|
|
114
|
+
*/
|
|
115
|
+
onRetry?: ((retry: number) => void) | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Callback for when a comment is encountered in the stream.
|
|
118
|
+
*
|
|
119
|
+
* @param comment - The comment encountered in the stream.
|
|
120
|
+
*/
|
|
121
|
+
onComment?: ((comment: string) => void) | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
|
|
124
|
+
* See {@link ParserConfig.maxBufferSize} for details.
|
|
125
|
+
*
|
|
126
|
+
* When the limit is exceeded, the stream is always errored (regardless of the `onError`
|
|
127
|
+
* setting) since the underlying parser is unrecoverable without a `reset()`.
|
|
128
|
+
*
|
|
129
|
+
* @defaultValue `undefined` (unbounded)
|
|
130
|
+
*/
|
|
131
|
+
maxBufferSize?: number | undefined;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type of error that occurred.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare type ErrorType =
|
|
6
|
+
| "invalid-retry"
|
|
7
|
+
| "unknown-field"
|
|
8
|
+
| "max-buffer-size-exceeded";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A parsed EventSource message event
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare interface EventSourceMessage {
|
|
16
|
+
/**
|
|
17
|
+
* The event type sent from the server. Note that this differs from the browser `EventSource`
|
|
18
|
+
* implementation in that browsers will default this to `message`, whereas this parser will
|
|
19
|
+
* leave this as `undefined` if not explicitly declared.
|
|
20
|
+
*/
|
|
21
|
+
event?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* ID of the message, if any was provided by the server. Can be used by clients to keep the
|
|
24
|
+
* last received message ID in sync when reconnecting.
|
|
25
|
+
*/
|
|
26
|
+
id?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The data received for this message
|
|
29
|
+
*/
|
|
30
|
+
data: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A TransformStream that ingests a stream of strings and produces a stream of `EventSourceMessage`.
|
|
35
|
+
*
|
|
36
|
+
* @example Basic usage
|
|
37
|
+
* ```
|
|
38
|
+
* const eventStream =
|
|
39
|
+
* response.body
|
|
40
|
+
* .pipeThrough(new TextDecoderStream())
|
|
41
|
+
* .pipeThrough(new EventSourceParserStream())
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Terminate stream on parsing errors
|
|
45
|
+
* ```
|
|
46
|
+
* const eventStream =
|
|
47
|
+
* response.body
|
|
48
|
+
* .pipeThrough(new TextDecoderStream())
|
|
49
|
+
* .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export declare class EventSourceParserStream extends TransformStream<
|
|
55
|
+
string,
|
|
56
|
+
EventSourceMessage
|
|
57
|
+
> {
|
|
58
|
+
constructor({ onError, onRetry, onComment, maxBufferSize }?: StreamOptions);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Error thrown when encountering an issue during parsing.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare class ParseError extends Error {
|
|
67
|
+
/**
|
|
68
|
+
* The type of error that occurred.
|
|
69
|
+
*/
|
|
70
|
+
type: ErrorType;
|
|
71
|
+
/**
|
|
72
|
+
* In the case of an unknown field encountered in the stream, this will be the field name.
|
|
73
|
+
*/
|
|
74
|
+
field?: string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* In the case of an unknown field encountered in the stream, this will be the value of the field.
|
|
77
|
+
*/
|
|
78
|
+
value?: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The line that caused the error, if available.
|
|
81
|
+
*/
|
|
82
|
+
line?: string | undefined;
|
|
83
|
+
constructor(
|
|
84
|
+
message: string,
|
|
85
|
+
options: {
|
|
86
|
+
type: ErrorType;
|
|
87
|
+
field?: string;
|
|
88
|
+
value?: string;
|
|
89
|
+
line?: string;
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Options for the EventSourceParserStream.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
export declare interface StreamOptions {
|
|
100
|
+
/**
|
|
101
|
+
* Behavior when a parsing error occurs.
|
|
102
|
+
*
|
|
103
|
+
* - A custom function can be provided to handle the error.
|
|
104
|
+
* - `'terminate'` will error the stream and stop parsing.
|
|
105
|
+
* - Any other value will ignore the error and continue parsing.
|
|
106
|
+
*
|
|
107
|
+
* @defaultValue `undefined`
|
|
108
|
+
*/
|
|
109
|
+
onError?: ("terminate" | ((error: Error) => void)) | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Callback for when a reconnection interval is sent from the server.
|
|
112
|
+
*
|
|
113
|
+
* @param retry - The number of milliseconds to wait before reconnecting.
|
|
114
|
+
*/
|
|
115
|
+
onRetry?: ((retry: number) => void) | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Callback for when a comment is encountered in the stream.
|
|
118
|
+
*
|
|
119
|
+
* @param comment - The comment encountered in the stream.
|
|
120
|
+
*/
|
|
121
|
+
onComment?: ((comment: string) => void) | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
|
|
124
|
+
* See {@link ParserConfig.maxBufferSize} for details.
|
|
125
|
+
*
|
|
126
|
+
* When the limit is exceeded, the stream is always errored (regardless of the `onError`
|
|
127
|
+
* setting) since the underlying parser is unrecoverable without a `reset()`.
|
|
128
|
+
*
|
|
129
|
+
* @defaultValue `undefined` (unbounded)
|
|
130
|
+
*/
|
|
131
|
+
maxBufferSize?: number | undefined;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createParser } from "./index.js";
|
|
2
|
+
import { ParseError } from "./index.js";
|
|
3
|
+
class EventSourceParserStream extends TransformStream {
|
|
4
|
+
constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
|
|
5
|
+
let parser;
|
|
6
|
+
super({
|
|
7
|
+
start(controller) {
|
|
8
|
+
parser = createParser({
|
|
9
|
+
onEvent: (event) => {
|
|
10
|
+
controller.enqueue(event);
|
|
11
|
+
},
|
|
12
|
+
onError(error) {
|
|
13
|
+
typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
|
|
14
|
+
},
|
|
15
|
+
onRetry,
|
|
16
|
+
onComment,
|
|
17
|
+
maxBufferSize
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
transform(chunk) {
|
|
21
|
+
parser.feed(chunk);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
EventSourceParserStream,
|
|
28
|
+
ParseError
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sources":["../src/stream.ts"],"sourcesContent":["import {createParser} from './parse.ts'\nimport type {EventSourceMessage, EventSourceParser} from './types.ts'\n\n/**\n * Options for the EventSourceParserStream.\n *\n * @public\n */\nexport interface StreamOptions {\n /**\n * Behavior when a parsing error occurs.\n *\n * - A custom function can be provided to handle the error.\n * - `'terminate'` will error the stream and stop parsing.\n * - Any other value will ignore the error and continue parsing.\n *\n * @defaultValue `undefined`\n */\n onError?: ('terminate' | ((error: Error) => void)) | undefined\n\n /**\n * Callback for when a reconnection interval is sent from the server.\n *\n * @param retry - The number of milliseconds to wait before reconnecting.\n */\n onRetry?: ((retry: number) => void) | undefined\n\n /**\n * Callback for when a comment is encountered in the stream.\n *\n * @param comment - The comment encountered in the stream.\n */\n onComment?: ((comment: string) => void) | undefined\n\n /**\n * Maximum number of characters the parser is allowed to buffer across calls to `feed()`.\n * See {@link ParserConfig.maxBufferSize} for details.\n *\n * When the limit is exceeded, the stream is always errored (regardless of the `onError`\n * setting) since the underlying parser is unrecoverable without a `reset()`.\n *\n * @defaultValue `undefined` (unbounded)\n */\n maxBufferSize?: number | undefined\n}\n\n/**\n * A TransformStream that ingests a stream of strings and produces a stream of `EventSourceMessage`.\n *\n * @example Basic usage\n * ```\n * const eventStream =\n * response.body\n * .pipeThrough(new TextDecoderStream())\n * .pipeThrough(new EventSourceParserStream())\n * ```\n *\n * @example Terminate stream on parsing errors\n * ```\n * const eventStream =\n * response.body\n * .pipeThrough(new TextDecoderStream())\n * .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))\n * ```\n *\n * @public\n */\nexport class EventSourceParserStream extends TransformStream<string, EventSourceMessage> {\n constructor({onError, onRetry, onComment, maxBufferSize}: StreamOptions = {}) {\n let parser!: EventSourceParser\n\n super({\n start(controller) {\n parser = createParser({\n onEvent: (event) => {\n controller.enqueue(event)\n },\n onError(error) {\n if (typeof onError === 'function') {\n onError(error)\n }\n\n // `max-buffer-size-exceeded` is fatal — the parser is unusable until\n // `reset()`, which the stream wrapper has no way to call. Always\n // terminate the stream in that case so consumers see the meaningful\n // `ParseError` instead of an opaque \"cannot feed terminated parser\"\n // throw from the next chunk.\n if (onError === 'terminate' || error.type === 'max-buffer-size-exceeded') {\n controller.error(error)\n }\n\n // Ignore by default\n },\n onRetry,\n onComment,\n maxBufferSize,\n })\n },\n transform(chunk) {\n parser.feed(chunk)\n },\n })\n }\n}\n\nexport {type ErrorType, ParseError} from './errors.ts'\nexport type {EventSourceMessage} from './types.ts'\n"],"names":[],"mappings":";;AAmEO,MAAM,gCAAgC,gBAA4C;AAAA,EACvF,YAAY,EAAC,SAAS,SAAS,WAAW,cAAA,IAAgC,IAAI;AAC5E,QAAI;AAEJ,UAAM;AAAA,MACJ,MAAM,YAAY;AAChB,iBAAS,aAAa;AAAA,UACpB,SAAS,CAAC,UAAU;AAClB,uBAAW,QAAQ,KAAK;AAAA,UAC1B;AAAA,UACA,QAAQ,OAAO;AACT,mBAAO,WAAY,cACrB,QAAQ,KAAK,IAQX,YAAY,eAAe,MAAM,SAAS,+BAC5C,WAAW,MAAM,KAAK;AAAA,UAI1B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,MACH;AAAA,MACA,UAAU,OAAO;AACf,eAAO,KAAK,KAAK;AAAA,MACnB;AAAA,IAAA,CACD;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eventsource-parser",
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"description": "Streaming, source-agnostic EventSource/Server-Sent Events parser",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eventsource",
|
|
7
|
+
"server-sent-events",
|
|
8
|
+
"sse"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/rexxars/eventsource-parser#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/rexxars/eventsource-parser/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Espen Hovlandsdal <espen@hovlandsdal.com>",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+ssh://git@github.com/rexxars/eventsource-parser.git"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"!dist/stats.html",
|
|
23
|
+
"!dist/index.min.js",
|
|
24
|
+
"src",
|
|
25
|
+
"stream.js"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.cjs",
|
|
30
|
+
"module": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"source": "./src/index.ts",
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"require": "./dist/index.cjs",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./stream": {
|
|
40
|
+
"source": "./src/stream.ts",
|
|
41
|
+
"import": "./dist/stream.js",
|
|
42
|
+
"require": "./dist/stream.cjs",
|
|
43
|
+
"default": "./dist/stream.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "pkg-utils build && pkg-utils --strict",
|
|
49
|
+
"clean": "rimraf dist coverage",
|
|
50
|
+
"check": "npm run clean && npm run format && npm run lint && npm run build && vitest run",
|
|
51
|
+
"format": "oxfmt",
|
|
52
|
+
"format:check": "oxfmt --check",
|
|
53
|
+
"bench": "node --expose-gc --experimental-strip-types --no-warnings=ExperimentalWarning bench/parse.bench.ts",
|
|
54
|
+
"bundle-size": "node --experimental-strip-types --no-warnings=ExperimentalWarning scripts/bundle-size.ts",
|
|
55
|
+
"knip": "knip",
|
|
56
|
+
"lint": "oxlint && tsc --noEmit",
|
|
57
|
+
"posttest": "npm run lint",
|
|
58
|
+
"prebuild": "npm run clean",
|
|
59
|
+
"prepublishOnly": "npm run build",
|
|
60
|
+
"test": "npm run test:node",
|
|
61
|
+
"test:bun": "bun test",
|
|
62
|
+
"test:deno": "deno run --allow-write --allow-net --allow-run --allow-sys --allow-ffi --allow-env --allow-read npm:vitest",
|
|
63
|
+
"test:node": "vitest --reporter=verbose"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@sanity/pkg-utils": "^10.4.18",
|
|
67
|
+
"@sanity/semantic-release-preset": "^6.0.0",
|
|
68
|
+
"@sanity/tsconfig": "^2.1.0",
|
|
69
|
+
"@types/node": "^20.19.0",
|
|
70
|
+
"eventsource-encoder": "^1.0.2",
|
|
71
|
+
"knip": "^6.7.0",
|
|
72
|
+
"mitata": "^1.0.34",
|
|
73
|
+
"oxfmt": "^0.47.0",
|
|
74
|
+
"oxlint": "^1.62.0",
|
|
75
|
+
"rimraf": "^6.1.3",
|
|
76
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
77
|
+
"semantic-release": "^25.0.3",
|
|
78
|
+
"terser": "^5.46.2",
|
|
79
|
+
"typescript": "^5.9.3",
|
|
80
|
+
"vitest": "^4.1.5"
|
|
81
|
+
},
|
|
82
|
+
"browserslist": [
|
|
83
|
+
"node >= 18",
|
|
84
|
+
"chrome >= 71",
|
|
85
|
+
"safari >= 14.1",
|
|
86
|
+
"firefox >= 105",
|
|
87
|
+
"edge >= 79"
|
|
88
|
+
],
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=18.0.0"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Error thrown when encountering an issue during parsing.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export class ParseError extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* The type of error that occurred.
|
|
15
|
+
*/
|
|
16
|
+
type: ErrorType
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* In the case of an unknown field encountered in the stream, this will be the field name.
|
|
20
|
+
*/
|
|
21
|
+
field?: string | undefined
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* In the case of an unknown field encountered in the stream, this will be the value of the field.
|
|
25
|
+
*/
|
|
26
|
+
value?: string | undefined
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The line that caused the error, if available.
|
|
30
|
+
*/
|
|
31
|
+
line?: string | undefined
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
message: string,
|
|
35
|
+
options: {type: ErrorType; field?: string; value?: string; line?: string},
|
|
36
|
+
) {
|
|
37
|
+
super(message)
|
|
38
|
+
this.name = 'ParseError'
|
|
39
|
+
this.type = options.type
|
|
40
|
+
this.field = options.field
|
|
41
|
+
this.value = options.value
|
|
42
|
+
this.line = options.line
|
|
43
|
+
}
|
|
44
|
+
}
|