@s2-dev/streamstore 0.2.5
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/.devcontainer/README.md +35 -0
- package/.devcontainer/devcontainer.json +45 -0
- package/FUNCTIONS.md +106 -0
- package/README.md +559 -0
- package/RUNTIMES.md +48 -0
- package/core.d.ts +10 -0
- package/core.d.ts.map +1 -0
- package/core.js +17 -0
- package/core.js.map +1 -0
- package/docs/sdks/account/README.md +406 -0
- package/docs/sdks/basin/README.md +415 -0
- package/docs/sdks/s2/README.md +7 -0
- package/docs/sdks/stream/README.md +267 -0
- package/funcs/accountCreateBasin.d.ts +14 -0
- package/funcs/accountCreateBasin.d.ts.map +1 -0
- package/funcs/accountCreateBasin.js +118 -0
- package/funcs/accountCreateBasin.js.map +1 -0
- package/funcs/accountDeleteBasin.d.ts +13 -0
- package/funcs/accountDeleteBasin.d.ts.map +1 -0
- package/funcs/accountDeleteBasin.js +114 -0
- package/funcs/accountDeleteBasin.js.map +1 -0
- package/funcs/accountGetBasinConfig.d.ts +14 -0
- package/funcs/accountGetBasinConfig.d.ts.map +1 -0
- package/funcs/accountGetBasinConfig.js +114 -0
- package/funcs/accountGetBasinConfig.js.map +1 -0
- package/funcs/accountListBasins.d.ts +16 -0
- package/funcs/accountListBasins.d.ts.map +1 -0
- package/funcs/accountListBasins.js +130 -0
- package/funcs/accountListBasins.js.map +1 -0
- package/funcs/accountReconfigureBasin.d.ts +14 -0
- package/funcs/accountReconfigureBasin.d.ts.map +1 -0
- package/funcs/accountReconfigureBasin.js +115 -0
- package/funcs/accountReconfigureBasin.js.map +1 -0
- package/funcs/basinCreateStream.d.ts +14 -0
- package/funcs/basinCreateStream.d.ts.map +1 -0
- package/funcs/basinCreateStream.js +123 -0
- package/funcs/basinCreateStream.js.map +1 -0
- package/funcs/basinDeleteStream.d.ts +13 -0
- package/funcs/basinDeleteStream.d.ts.map +1 -0
- package/funcs/basinDeleteStream.js +119 -0
- package/funcs/basinDeleteStream.js.map +1 -0
- package/funcs/basinGetStreamConfig.d.ts +14 -0
- package/funcs/basinGetStreamConfig.d.ts.map +1 -0
- package/funcs/basinGetStreamConfig.js +119 -0
- package/funcs/basinGetStreamConfig.js.map +1 -0
- package/funcs/basinListStreams.d.ts +16 -0
- package/funcs/basinListStreams.d.ts.map +1 -0
- package/funcs/basinListStreams.js +137 -0
- package/funcs/basinListStreams.js.map +1 -0
- package/funcs/basinReconfigureStream.d.ts +14 -0
- package/funcs/basinReconfigureStream.d.ts.map +1 -0
- package/funcs/basinReconfigureStream.js +120 -0
- package/funcs/basinReconfigureStream.js.map +1 -0
- package/funcs/streamAppend.d.ts +14 -0
- package/funcs/streamAppend.d.ts.map +1 -0
- package/funcs/streamAppend.js +124 -0
- package/funcs/streamAppend.js.map +1 -0
- package/funcs/streamCheckTail.d.ts +14 -0
- package/funcs/streamCheckTail.d.ts.map +1 -0
- package/funcs/streamCheckTail.js +119 -0
- package/funcs/streamCheckTail.js.map +1 -0
- package/funcs/streamRead.d.ts +19 -0
- package/funcs/streamRead.d.ts.map +1 -0
- package/funcs/streamRead.js +134 -0
- package/funcs/streamRead.js.map +1 -0
- package/hooks/hooks.d.ts +24 -0
- package/hooks/hooks.d.ts.map +1 -0
- package/hooks/hooks.js +86 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.d.ts.map +1 -0
- package/hooks/index.js +22 -0
- package/hooks/index.js.map +1 -0
- package/hooks/registration.d.ts +3 -0
- package/hooks/registration.d.ts.map +1 -0
- package/hooks/registration.js +15 -0
- package/hooks/registration.js.map +1 -0
- package/hooks/types.d.ts +77 -0
- package/hooks/types.d.ts.map +1 -0
- package/hooks/types.js +6 -0
- package/hooks/types.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +46 -0
- package/index.js.map +1 -0
- package/jsr.json +28 -0
- package/lib/base64.d.ts +10 -0
- package/lib/base64.d.ts.map +1 -0
- package/lib/base64.js +71 -0
- package/lib/base64.js.map +1 -0
- package/lib/config.d.ts +34 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +35 -0
- package/lib/config.js.map +1 -0
- package/lib/dlv.d.ts +14 -0
- package/lib/dlv.d.ts.map +1 -0
- package/lib/dlv.js +49 -0
- package/lib/dlv.js.map +1 -0
- package/lib/encodings.d.ts +52 -0
- package/lib/encodings.d.ts.map +1 -0
- package/lib/encodings.js +368 -0
- package/lib/encodings.js.map +1 -0
- package/lib/env.d.ts +15 -0
- package/lib/env.d.ts.map +1 -0
- package/lib/env.js +65 -0
- package/lib/env.js.map +1 -0
- package/lib/event-streams.d.ts +17 -0
- package/lib/event-streams.d.ts.map +1 -0
- package/lib/event-streams.js +220 -0
- package/lib/event-streams.js.map +1 -0
- package/lib/files.d.ts +8 -0
- package/lib/files.d.ts.map +1 -0
- package/lib/files.js +36 -0
- package/lib/files.js.map +1 -0
- package/lib/http.d.ts +67 -0
- package/lib/http.d.ts.map +1 -0
- package/lib/http.js +217 -0
- package/lib/http.js.map +1 -0
- package/lib/is-plain-object.d.ts +2 -0
- package/lib/is-plain-object.d.ts.map +1 -0
- package/lib/is-plain-object.js +41 -0
- package/lib/is-plain-object.js.map +1 -0
- package/lib/logger.d.ts +6 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +6 -0
- package/lib/logger.js.map +1 -0
- package/lib/matchers.d.ts +64 -0
- package/lib/matchers.d.ts.map +1 -0
- package/lib/matchers.js +207 -0
- package/lib/matchers.js.map +1 -0
- package/lib/primitives.d.ts +23 -0
- package/lib/primitives.d.ts.map +1 -0
- package/lib/primitives.js +104 -0
- package/lib/primitives.js.map +1 -0
- package/lib/retries.d.ts +38 -0
- package/lib/retries.d.ts.map +1 -0
- package/lib/retries.js +154 -0
- package/lib/retries.js.map +1 -0
- package/lib/schemas.d.ts +19 -0
- package/lib/schemas.d.ts.map +1 -0
- package/lib/schemas.js +62 -0
- package/lib/schemas.js.map +1 -0
- package/lib/sdks.d.ts +60 -0
- package/lib/sdks.d.ts.map +1 -0
- package/lib/sdks.js +280 -0
- package/lib/sdks.js.map +1 -0
- package/lib/security.d.ts +82 -0
- package/lib/security.d.ts.map +1 -0
- package/lib/security.js +139 -0
- package/lib/security.js.map +1 -0
- package/lib/url.d.ts +5 -0
- package/lib/url.d.ts.map +1 -0
- package/lib/url.js +25 -0
- package/lib/url.js.map +1 -0
- package/models/components/appendinput.d.ts +49 -0
- package/models/components/appendinput.d.ts.map +1 -0
- package/models/components/appendinput.js +85 -0
- package/models/components/appendinput.js.map +1 -0
- package/models/components/appendoutput.d.ts +51 -0
- package/models/components/appendoutput.d.ts.map +1 -0
- package/models/components/appendoutput.js +86 -0
- package/models/components/appendoutput.js.map +1 -0
- package/models/components/appendrecord.d.ts +40 -0
- package/models/components/appendrecord.d.ts.map +1 -0
- package/models/components/appendrecord.js +71 -0
- package/models/components/appendrecord.js.map +1 -0
- package/models/components/assignment.d.ts +90 -0
- package/models/components/assignment.d.ts.map +1 -0
- package/models/components/assignment.js +127 -0
- package/models/components/assignment.js.map +1 -0
- package/models/components/basinconfig.d.ts +33 -0
- package/models/components/basinconfig.d.ts.map +1 -0
- package/models/components/basinconfig.js +79 -0
- package/models/components/basinconfig.js.map +1 -0
- package/models/components/basininfo.d.ts +51 -0
- package/models/components/basininfo.d.ts.map +1 -0
- package/models/components/basininfo.js +76 -0
- package/models/components/basininfo.js.map +1 -0
- package/models/components/basinstate.d.ts +40 -0
- package/models/components/basinstate.d.ts.map +1 -0
- package/models/components/basinstate.js +66 -0
- package/models/components/basinstate.js.map +1 -0
- package/models/components/checktailresponse.d.ts +35 -0
- package/models/components/checktailresponse.d.ts.map +1 -0
- package/models/components/checktailresponse.js +78 -0
- package/models/components/checktailresponse.js.map +1 -0
- package/models/components/createbasinrequest.d.ts +36 -0
- package/models/components/createbasinrequest.d.ts.map +1 -0
- package/models/components/createbasinrequest.js +73 -0
- package/models/components/createbasinrequest.js.map +1 -0
- package/models/components/createstreamrequest.d.ts +33 -0
- package/models/components/createstreamrequest.d.ts.map +1 -0
- package/models/components/createstreamrequest.js +70 -0
- package/models/components/createstreamrequest.js.map +1 -0
- package/models/components/header.d.ts +43 -0
- package/models/components/header.d.ts.map +1 -0
- package/models/components/header.js +72 -0
- package/models/components/header.js.map +1 -0
- package/models/components/index.d.ts +23 -0
- package/models/components/index.d.ts.map +1 -0
- package/models/components/index.js +42 -0
- package/models/components/index.js.map +1 -0
- package/models/components/listbasinsresponse.d.ts +41 -0
- package/models/components/listbasinsresponse.d.ts.map +1 -0
- package/models/components/listbasinsresponse.js +81 -0
- package/models/components/listbasinsresponse.js.map +1 -0
- package/models/components/liststreamsresponse.d.ts +41 -0
- package/models/components/liststreamsresponse.d.ts.map +1 -0
- package/models/components/liststreamsresponse.js +81 -0
- package/models/components/liststreamsresponse.js.map +1 -0
- package/models/components/output.d.ts +140 -0
- package/models/components/output.d.ts.map +1 -0
- package/models/components/output.js +174 -0
- package/models/components/output.js.map +1 -0
- package/models/components/readresponse.d.ts +83 -0
- package/models/components/readresponse.d.ts.map +1 -0
- package/models/components/readresponse.js +141 -0
- package/models/components/readresponse.js.map +1 -0
- package/models/components/retentionpolicy.d.ts +68 -0
- package/models/components/retentionpolicy.d.ts.map +1 -0
- package/models/components/retentionpolicy.js +94 -0
- package/models/components/retentionpolicy.js.map +1 -0
- package/models/components/security.d.ts +29 -0
- package/models/components/security.d.ts.map +1 -0
- package/models/components/security.js +69 -0
- package/models/components/security.js.map +1 -0
- package/models/components/sequencedrecord.d.ts +46 -0
- package/models/components/sequencedrecord.d.ts.map +1 -0
- package/models/components/sequencedrecord.js +83 -0
- package/models/components/sequencedrecord.js.map +1 -0
- package/models/components/sequencedrecordbatch.d.ts +36 -0
- package/models/components/sequencedrecordbatch.d.ts.map +1 -0
- package/models/components/sequencedrecordbatch.js +70 -0
- package/models/components/sequencedrecordbatch.js.map +1 -0
- package/models/components/storageclass.d.ts +37 -0
- package/models/components/storageclass.d.ts.map +1 -0
- package/models/components/storageclass.js +64 -0
- package/models/components/storageclass.js.map +1 -0
- package/models/components/streamconfig.d.ts +39 -0
- package/models/components/streamconfig.d.ts.map +1 -0
- package/models/components/streamconfig.js +84 -0
- package/models/components/streamconfig.js.map +1 -0
- package/models/components/streaminfo.d.ts +45 -0
- package/models/components/streaminfo.d.ts.map +1 -0
- package/models/components/streaminfo.js +84 -0
- package/models/components/streaminfo.js.map +1 -0
- package/models/errors/apierror.d.ts +8 -0
- package/models/errors/apierror.d.ts.map +1 -0
- package/models/errors/apierror.js +21 -0
- package/models/errors/apierror.js.map +1 -0
- package/models/errors/errorresponse.d.ts +31 -0
- package/models/errors/errorresponse.d.ts.map +1 -0
- package/models/errors/errorresponse.js +77 -0
- package/models/errors/errorresponse.js.map +1 -0
- package/models/errors/httpclienterrors.d.ts +44 -0
- package/models/errors/httpclienterrors.d.ts.map +1 -0
- package/models/errors/httpclienterrors.js +78 -0
- package/models/errors/httpclienterrors.js.map +1 -0
- package/models/errors/index.d.ts +5 -0
- package/models/errors/index.d.ts.map +1 -0
- package/models/errors/index.js +24 -0
- package/models/errors/index.js.map +1 -0
- package/models/errors/sdkvalidationerror.d.ts +20 -0
- package/models/errors/sdkvalidationerror.d.ts.map +1 -0
- package/models/errors/sdkvalidationerror.js +115 -0
- package/models/errors/sdkvalidationerror.js.map +1 -0
- package/models/operations/append.d.ts +97 -0
- package/models/operations/append.d.ts.map +1 -0
- package/models/operations/append.js +134 -0
- package/models/operations/append.js.map +1 -0
- package/models/operations/checktail.d.ts +33 -0
- package/models/operations/checktail.d.ts.map +1 -0
- package/models/operations/checktail.js +75 -0
- package/models/operations/checktail.js.map +1 -0
- package/models/operations/createbasin.d.ts +37 -0
- package/models/operations/createbasin.d.ts.map +1 -0
- package/models/operations/createbasin.js +85 -0
- package/models/operations/createbasin.js.map +1 -0
- package/models/operations/createstream.d.ts +38 -0
- package/models/operations/createstream.d.ts.map +1 -0
- package/models/operations/createstream.js +91 -0
- package/models/operations/createstream.js.map +1 -0
- package/models/operations/deletebasin.d.ts +32 -0
- package/models/operations/deletebasin.d.ts.map +1 -0
- package/models/operations/deletebasin.js +69 -0
- package/models/operations/deletebasin.js.map +1 -0
- package/models/operations/deletestream.d.ts +33 -0
- package/models/operations/deletestream.d.ts.map +1 -0
- package/models/operations/deletestream.js +75 -0
- package/models/operations/deletestream.js.map +1 -0
- package/models/operations/getbasinconfig.d.ts +32 -0
- package/models/operations/getbasinconfig.d.ts.map +1 -0
- package/models/operations/getbasinconfig.js +69 -0
- package/models/operations/getbasinconfig.js.map +1 -0
- package/models/operations/getstreamconfig.d.ts +33 -0
- package/models/operations/getstreamconfig.d.ts.map +1 -0
- package/models/operations/getstreamconfig.js +75 -0
- package/models/operations/getstreamconfig.js.map +1 -0
- package/models/operations/index.d.ts +14 -0
- package/models/operations/index.d.ts.map +1 -0
- package/models/operations/index.js +33 -0
- package/models/operations/index.js.map +1 -0
- package/models/operations/listbasins.d.ts +72 -0
- package/models/operations/listbasins.d.ts.map +1 -0
- package/models/operations/listbasins.js +118 -0
- package/models/operations/listbasins.js.map +1 -0
- package/models/operations/liststreams.d.ts +73 -0
- package/models/operations/liststreams.d.ts.map +1 -0
- package/models/operations/liststreams.js +124 -0
- package/models/operations/liststreams.js.map +1 -0
- package/models/operations/read.d.ts +163 -0
- package/models/operations/read.d.ts.map +1 -0
- package/models/operations/read.js +200 -0
- package/models/operations/read.js.map +1 -0
- package/models/operations/reconfigurebasin.d.ts +35 -0
- package/models/operations/reconfigurebasin.d.ts.map +1 -0
- package/models/operations/reconfigurebasin.js +81 -0
- package/models/operations/reconfigurebasin.js.map +1 -0
- package/models/operations/reconfigurestream.d.ts +36 -0
- package/models/operations/reconfigurestream.d.ts.map +1 -0
- package/models/operations/reconfigurestream.js +87 -0
- package/models/operations/reconfigurestream.js.map +1 -0
- package/package.json +32 -0
- package/sdk/account.d.ts +29 -0
- package/sdk/account.d.ts.map +1 -0
- package/sdk/account.js +48 -0
- package/sdk/account.js.map +1 -0
- package/sdk/basin.d.ts +29 -0
- package/sdk/basin.d.ts.map +1 -0
- package/sdk/basin.js +48 -0
- package/sdk/basin.js.map +1 -0
- package/sdk/index.d.ts +2 -0
- package/sdk/index.d.ts.map +1 -0
- package/sdk/index.js +21 -0
- package/sdk/index.js.map +1 -0
- package/sdk/sdk.d.ts +13 -0
- package/sdk/sdk.d.ts.map +1 -0
- package/sdk/sdk.js +23 -0
- package/sdk/sdk.js.map +1 -0
- package/sdk/stream.d.ts +22 -0
- package/sdk/stream.d.ts.map +1 -0
- package/sdk/stream.js +35 -0
- package/sdk/stream.js.map +1 -0
- package/src/core.ts +13 -0
- package/src/funcs/accountCreateBasin.ts +149 -0
- package/src/funcs/accountDeleteBasin.ts +141 -0
- package/src/funcs/accountGetBasinConfig.ts +141 -0
- package/src/funcs/accountListBasins.ts +188 -0
- package/src/funcs/accountReconfigureBasin.ts +142 -0
- package/src/funcs/basinCreateStream.ts +155 -0
- package/src/funcs/basinDeleteStream.ts +147 -0
- package/src/funcs/basinGetStreamConfig.ts +147 -0
- package/src/funcs/basinListStreams.ts +196 -0
- package/src/funcs/basinReconfigureStream.ts +148 -0
- package/src/funcs/streamAppend.ts +152 -0
- package/src/funcs/streamCheckTail.ts +147 -0
- package/src/funcs/streamRead.ts +163 -0
- package/src/hooks/hooks.ts +132 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/registration.ts +14 -0
- package/src/hooks/types.ts +109 -0
- package/src/index.ts +7 -0
- package/src/lib/base64.ts +37 -0
- package/src/lib/config.ts +60 -0
- package/src/lib/dlv.ts +53 -0
- package/src/lib/encodings.ts +483 -0
- package/src/lib/env.ts +41 -0
- package/src/lib/event-streams.ts +264 -0
- package/src/lib/files.ts +40 -0
- package/src/lib/http.ts +323 -0
- package/src/lib/is-plain-object.ts +43 -0
- package/src/lib/logger.ts +9 -0
- package/src/lib/matchers.ts +325 -0
- package/src/lib/primitives.ts +136 -0
- package/src/lib/retries.ts +219 -0
- package/src/lib/schemas.ts +91 -0
- package/src/lib/sdks.ts +400 -0
- package/src/lib/security.ts +254 -0
- package/src/lib/url.ts +33 -0
- package/src/models/components/appendinput.ts +102 -0
- package/src/models/components/appendoutput.ts +101 -0
- package/src/models/components/appendrecord.ts +75 -0
- package/src/models/components/assignment.ts +177 -0
- package/src/models/components/basinconfig.ts +80 -0
- package/src/models/components/basininfo.ts +94 -0
- package/src/models/components/basinstate.ts +39 -0
- package/src/models/components/checktailresponse.ts +81 -0
- package/src/models/components/createbasinrequest.ts +85 -0
- package/src/models/components/createstreamrequest.ts +75 -0
- package/src/models/components/header.ts +75 -0
- package/src/models/components/index.ts +26 -0
- package/src/models/components/listbasinsresponse.ts +94 -0
- package/src/models/components/liststreamsresponse.ts +94 -0
- package/src/models/components/output.ts +277 -0
- package/src/models/components/readresponse.ts +197 -0
- package/src/models/components/retentionpolicy.ts +122 -0
- package/src/models/components/security.ts +62 -0
- package/src/models/components/sequencedrecord.ts +99 -0
- package/src/models/components/sequencedrecordbatch.ts +78 -0
- package/src/models/components/storageclass.ts +38 -0
- package/src/models/components/streamconfig.ts +94 -0
- package/src/models/components/streaminfo.ts +93 -0
- package/src/models/errors/apierror.ts +27 -0
- package/src/models/errors/errorresponse.ts +69 -0
- package/src/models/errors/httpclienterrors.ts +62 -0
- package/src/models/errors/index.ts +8 -0
- package/src/models/errors/sdkvalidationerror.ts +97 -0
- package/src/models/operations/append.ts +176 -0
- package/src/models/operations/checktail.ts +76 -0
- package/src/models/operations/createbasin.ts +89 -0
- package/src/models/operations/createstream.ts +96 -0
- package/src/models/operations/deletebasin.ts +69 -0
- package/src/models/operations/deletestream.ts +76 -0
- package/src/models/operations/getbasinconfig.ts +69 -0
- package/src/models/operations/getstreamconfig.ts +76 -0
- package/src/models/operations/index.ts +17 -0
- package/src/models/operations/listbasins.ts +163 -0
- package/src/models/operations/liststreams.ts +170 -0
- package/src/models/operations/read.ts +309 -0
- package/src/models/operations/reconfigurebasin.ts +83 -0
- package/src/models/operations/reconfigurestream.ts +90 -0
- package/src/sdk/account.ts +86 -0
- package/src/sdk/basin.ts +86 -0
- package/src/sdk/index.ts +5 -0
- package/src/sdk/sdk.ts +25 -0
- package/src/sdk/stream.ts +57 -0
- package/src/types/blobs.ts +31 -0
- package/src/types/constdatetime.ts +15 -0
- package/src/types/enums.ts +16 -0
- package/src/types/fp.ts +50 -0
- package/src/types/index.ts +11 -0
- package/src/types/operations.ts +105 -0
- package/src/types/rfcdate.ts +54 -0
- package/src/types/streams.ts +21 -0
- package/tsconfig.json +41 -0
- package/types/blobs.d.ts +4 -0
- package/types/blobs.d.ts.map +1 -0
- package/types/blobs.js +62 -0
- package/types/blobs.js.map +1 -0
- package/types/constdatetime.d.ts +3 -0
- package/types/constdatetime.d.ts.map +1 -0
- package/types/constdatetime.js +46 -0
- package/types/constdatetime.js.map +1 -0
- package/types/enums.d.ts +12 -0
- package/types/enums.d.ts.map +1 -0
- package/types/enums.js +10 -0
- package/types/enums.js.map +1 -0
- package/types/fp.d.ts +31 -0
- package/types/fp.d.ts.map +1 -0
- package/types/fp.js +37 -0
- package/types/fp.js.map +1 -0
- package/types/index.d.ts +8 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +16 -0
- package/types/index.js.map +1 -0
- package/types/operations.d.ts +27 -0
- package/types/operations.d.ts.map +1 -0
- package/types/operations.js +83 -0
- package/types/operations.js.map +1 -0
- package/types/rfcdate.d.ts +21 -0
- package/types/rfcdate.d.ts.map +1 -0
- package/types/rfcdate.js +46 -0
- package/types/rfcdate.js.map +1 -0
- package/types/streams.d.ts +2 -0
- package/types/streams.d.ts.map +1 -0
- package/types/streams.js +18 -0
- package/types/streams.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
# streamstore
|
|
2
|
+
|
|
3
|
+
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *streamstore* API.
|
|
4
|
+
|
|
5
|
+
<div align="left">
|
|
6
|
+
<a href="https://www.speakeasy.com/?utm_source=streamstore&utm_campaign=typescript"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
7
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
8
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
|
9
|
+
</a>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<br /><br />
|
|
14
|
+
> [!IMPORTANT]
|
|
15
|
+
> This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/stream-store/s2). Delete this section before > publishing to a package manager.
|
|
16
|
+
|
|
17
|
+
<!-- Start Summary [summary] -->
|
|
18
|
+
## Summary
|
|
19
|
+
|
|
20
|
+
S2 API: Serverless API for streaming data backed by object storage.
|
|
21
|
+
<!-- End Summary [summary] -->
|
|
22
|
+
|
|
23
|
+
<!-- Start Table of Contents [toc] -->
|
|
24
|
+
## Table of Contents
|
|
25
|
+
<!-- $toc-max-depth=2 -->
|
|
26
|
+
* [streamstore](#streamstore)
|
|
27
|
+
* [SDK Installation](#sdk-installation)
|
|
28
|
+
* [Requirements](#requirements)
|
|
29
|
+
* [SDK Example Usage](#sdk-example-usage)
|
|
30
|
+
* [Authentication](#authentication)
|
|
31
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
|
32
|
+
* [Standalone functions](#standalone-functions)
|
|
33
|
+
* [Server-sent event streaming](#server-sent-event-streaming)
|
|
34
|
+
* [Pagination](#pagination)
|
|
35
|
+
* [Retries](#retries)
|
|
36
|
+
* [Error Handling](#error-handling)
|
|
37
|
+
* [Server Selection](#server-selection)
|
|
38
|
+
* [Custom HTTP Client](#custom-http-client)
|
|
39
|
+
* [Debugging](#debugging)
|
|
40
|
+
* [Development](#development)
|
|
41
|
+
* [Maturity](#maturity)
|
|
42
|
+
* [Contributions](#contributions)
|
|
43
|
+
|
|
44
|
+
<!-- End Table of Contents [toc] -->
|
|
45
|
+
|
|
46
|
+
<!-- Start SDK Installation [installation] -->
|
|
47
|
+
## SDK Installation
|
|
48
|
+
|
|
49
|
+
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
50
|
+
|
|
51
|
+
### NPM
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm add @s2-dev/streamstore
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### PNPM
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm add @s2-dev/streamstore
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Bun
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bun add @s2-dev/streamstore
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Yarn
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
yarn add @s2-dev/streamstore zod
|
|
73
|
+
|
|
74
|
+
# Note that Yarn does not install peer dependencies automatically. You will need
|
|
75
|
+
# to install zod as shown above.
|
|
76
|
+
```
|
|
77
|
+
<!-- End SDK Installation [installation] -->
|
|
78
|
+
|
|
79
|
+
<!-- Start Requirements [requirements] -->
|
|
80
|
+
## Requirements
|
|
81
|
+
|
|
82
|
+
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
83
|
+
<!-- End Requirements [requirements] -->
|
|
84
|
+
|
|
85
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
86
|
+
## SDK Example Usage
|
|
87
|
+
|
|
88
|
+
### Example
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
92
|
+
|
|
93
|
+
const s2 = new S2({
|
|
94
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
async function run() {
|
|
98
|
+
const result = await s2.account.listBasins({});
|
|
99
|
+
|
|
100
|
+
for await (const page of result) {
|
|
101
|
+
// Handle the page
|
|
102
|
+
console.log(page);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
run();
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
<!-- End SDK Example Usage [usage] -->
|
|
110
|
+
|
|
111
|
+
<!-- Start Authentication [security] -->
|
|
112
|
+
## Authentication
|
|
113
|
+
|
|
114
|
+
### Per-Client Security Schemes
|
|
115
|
+
|
|
116
|
+
This SDK supports the following security scheme globally:
|
|
117
|
+
|
|
118
|
+
| Name | Type | Scheme | Environment Variable |
|
|
119
|
+
| ------------ | ---- | ----------- | -------------------- |
|
|
120
|
+
| `bearerAuth` | http | HTTP Bearer | `S2_BEARER_AUTH` |
|
|
121
|
+
|
|
122
|
+
To authenticate with the API the `bearerAuth` parameter must be set when initializing the SDK client instance. For example:
|
|
123
|
+
```typescript
|
|
124
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
125
|
+
|
|
126
|
+
const s2 = new S2({
|
|
127
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
async function run() {
|
|
131
|
+
const result = await s2.account.listBasins({});
|
|
132
|
+
|
|
133
|
+
for await (const page of result) {
|
|
134
|
+
// Handle the page
|
|
135
|
+
console.log(page);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
run();
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
<!-- End Authentication [security] -->
|
|
143
|
+
|
|
144
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
145
|
+
## Available Resources and Operations
|
|
146
|
+
|
|
147
|
+
<details open>
|
|
148
|
+
<summary>Available methods</summary>
|
|
149
|
+
|
|
150
|
+
### [account](docs/sdks/account/README.md)
|
|
151
|
+
|
|
152
|
+
* [listBasins](docs/sdks/account/README.md#listbasins) - List basins.
|
|
153
|
+
* [getBasinConfig](docs/sdks/account/README.md#getbasinconfig) - Get basin configuration.
|
|
154
|
+
* [createBasin](docs/sdks/account/README.md#createbasin) - Create a new basin.
|
|
155
|
+
* [deleteBasin](docs/sdks/account/README.md#deletebasin) - Delete a basin.
|
|
156
|
+
* [reconfigureBasin](docs/sdks/account/README.md#reconfigurebasin) - Update basin configuration.
|
|
157
|
+
|
|
158
|
+
### [basin](docs/sdks/basin/README.md)
|
|
159
|
+
|
|
160
|
+
* [listStreams](docs/sdks/basin/README.md#liststreams) - List Streams.
|
|
161
|
+
* [getStreamConfig](docs/sdks/basin/README.md#getstreamconfig) - Get stream configuration.
|
|
162
|
+
* [createStream](docs/sdks/basin/README.md#createstream) - Create a stream.
|
|
163
|
+
* [deleteStream](docs/sdks/basin/README.md#deletestream) - Delete a stream.
|
|
164
|
+
* [reconfigureStream](docs/sdks/basin/README.md#reconfigurestream) - Update stream configuration.
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### [stream](docs/sdks/stream/README.md)
|
|
168
|
+
|
|
169
|
+
* [read](docs/sdks/stream/README.md#read) - Retrieve a batch of records.
|
|
170
|
+
* [append](docs/sdks/stream/README.md#append) - Append a batch of records.
|
|
171
|
+
* [checkTail](docs/sdks/stream/README.md#checktail) - Check the tail.
|
|
172
|
+
|
|
173
|
+
</details>
|
|
174
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
175
|
+
|
|
176
|
+
<!-- Start Standalone functions [standalone-funcs] -->
|
|
177
|
+
## Standalone functions
|
|
178
|
+
|
|
179
|
+
All the methods listed above are available as standalone functions. These
|
|
180
|
+
functions are ideal for use in applications running in the browser, serverless
|
|
181
|
+
runtimes or other environments where application bundle size is a primary
|
|
182
|
+
concern. When using a bundler to build your application, all unused
|
|
183
|
+
functionality will be either excluded from the final bundle or tree-shaken away.
|
|
184
|
+
|
|
185
|
+
To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
186
|
+
|
|
187
|
+
<details>
|
|
188
|
+
|
|
189
|
+
<summary>Available standalone functions</summary>
|
|
190
|
+
|
|
191
|
+
- [`accountCreateBasin`](docs/sdks/account/README.md#createbasin) - Create a new basin.
|
|
192
|
+
- [`accountDeleteBasin`](docs/sdks/account/README.md#deletebasin) - Delete a basin.
|
|
193
|
+
- [`accountGetBasinConfig`](docs/sdks/account/README.md#getbasinconfig) - Get basin configuration.
|
|
194
|
+
- [`accountListBasins`](docs/sdks/account/README.md#listbasins) - List basins.
|
|
195
|
+
- [`accountReconfigureBasin`](docs/sdks/account/README.md#reconfigurebasin) - Update basin configuration.
|
|
196
|
+
- [`basinCreateStream`](docs/sdks/basin/README.md#createstream) - Create a stream.
|
|
197
|
+
- [`basinDeleteStream`](docs/sdks/basin/README.md#deletestream) - Delete a stream.
|
|
198
|
+
- [`basinGetStreamConfig`](docs/sdks/basin/README.md#getstreamconfig) - Get stream configuration.
|
|
199
|
+
- [`basinListStreams`](docs/sdks/basin/README.md#liststreams) - List Streams.
|
|
200
|
+
- [`basinReconfigureStream`](docs/sdks/basin/README.md#reconfigurestream) - Update stream configuration.
|
|
201
|
+
- [`streamAppend`](docs/sdks/stream/README.md#append) - Append a batch of records.
|
|
202
|
+
- [`streamCheckTail`](docs/sdks/stream/README.md#checktail) - Check the tail.
|
|
203
|
+
- [`streamRead`](docs/sdks/stream/README.md#read) - Retrieve a batch of records.
|
|
204
|
+
|
|
205
|
+
</details>
|
|
206
|
+
<!-- End Standalone functions [standalone-funcs] -->
|
|
207
|
+
|
|
208
|
+
<!-- Start Server-sent event streaming [eventstream] -->
|
|
209
|
+
## Server-sent event streaming
|
|
210
|
+
|
|
211
|
+
[Server-sent events][mdn-sse] are used to stream content from certain
|
|
212
|
+
operations. These operations will expose the stream as an async iterable that
|
|
213
|
+
can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
|
|
214
|
+
terminate when the server no longer has any events to send and closes the
|
|
215
|
+
underlying connection.
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
219
|
+
|
|
220
|
+
const s2 = new S2({
|
|
221
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
async function run() {
|
|
225
|
+
const result = await s2.stream.read({
|
|
226
|
+
stream: "<value>",
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
for await (const event of result) {
|
|
230
|
+
// Handle the event
|
|
231
|
+
console.log(event);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
run();
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
[mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
|
|
240
|
+
[mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
241
|
+
<!-- End Server-sent event streaming [eventstream] -->
|
|
242
|
+
|
|
243
|
+
<!-- Start Pagination [pagination] -->
|
|
244
|
+
## Pagination
|
|
245
|
+
|
|
246
|
+
Some of the endpoints in this SDK support pagination. To use pagination, you
|
|
247
|
+
make your SDK calls as usual, but the returned response object will also be an
|
|
248
|
+
async iterable that can be consumed using the [`for await...of`][for-await-of]
|
|
249
|
+
syntax.
|
|
250
|
+
|
|
251
|
+
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
252
|
+
|
|
253
|
+
Here's an example of one such pagination call:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
257
|
+
|
|
258
|
+
const s2 = new S2({
|
|
259
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
async function run() {
|
|
263
|
+
const result = await s2.account.listBasins({});
|
|
264
|
+
|
|
265
|
+
for await (const page of result) {
|
|
266
|
+
// Handle the page
|
|
267
|
+
console.log(page);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
run();
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
<!-- End Pagination [pagination] -->
|
|
275
|
+
|
|
276
|
+
<!-- Start Retries [retries] -->
|
|
277
|
+
## Retries
|
|
278
|
+
|
|
279
|
+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
280
|
+
|
|
281
|
+
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
282
|
+
```typescript
|
|
283
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
284
|
+
|
|
285
|
+
const s2 = new S2({
|
|
286
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
async function run() {
|
|
290
|
+
const result = await s2.account.listBasins({}, {
|
|
291
|
+
retries: {
|
|
292
|
+
strategy: "backoff",
|
|
293
|
+
backoff: {
|
|
294
|
+
initialInterval: 1,
|
|
295
|
+
maxInterval: 50,
|
|
296
|
+
exponent: 1.1,
|
|
297
|
+
maxElapsedTime: 100,
|
|
298
|
+
},
|
|
299
|
+
retryConnectionErrors: false,
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
for await (const page of result) {
|
|
304
|
+
// Handle the page
|
|
305
|
+
console.log(page);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
run();
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
314
|
+
```typescript
|
|
315
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
316
|
+
|
|
317
|
+
const s2 = new S2({
|
|
318
|
+
retryConfig: {
|
|
319
|
+
strategy: "backoff",
|
|
320
|
+
backoff: {
|
|
321
|
+
initialInterval: 1,
|
|
322
|
+
maxInterval: 50,
|
|
323
|
+
exponent: 1.1,
|
|
324
|
+
maxElapsedTime: 100,
|
|
325
|
+
},
|
|
326
|
+
retryConnectionErrors: false,
|
|
327
|
+
},
|
|
328
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
async function run() {
|
|
332
|
+
const result = await s2.account.listBasins({});
|
|
333
|
+
|
|
334
|
+
for await (const page of result) {
|
|
335
|
+
// Handle the page
|
|
336
|
+
console.log(page);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
run();
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
<!-- End Retries [retries] -->
|
|
344
|
+
|
|
345
|
+
<!-- Start Error Handling [errors] -->
|
|
346
|
+
## Error Handling
|
|
347
|
+
|
|
348
|
+
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `listBasins` method may throw the following errors:
|
|
349
|
+
|
|
350
|
+
| Error Type | Status Code | Content Type |
|
|
351
|
+
| -------------------- | ----------- | ---------------- |
|
|
352
|
+
| errors.ErrorResponse | 400, 401 | application/json |
|
|
353
|
+
| errors.ErrorResponse | 500 | application/json |
|
|
354
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
355
|
+
|
|
356
|
+
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
360
|
+
import {
|
|
361
|
+
ErrorResponse,
|
|
362
|
+
SDKValidationError,
|
|
363
|
+
} from "@s2-dev/streamstore/models/errors";
|
|
364
|
+
|
|
365
|
+
const s2 = new S2({
|
|
366
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
async function run() {
|
|
370
|
+
let result;
|
|
371
|
+
try {
|
|
372
|
+
result = await s2.account.listBasins({});
|
|
373
|
+
|
|
374
|
+
for await (const page of result) {
|
|
375
|
+
// Handle the page
|
|
376
|
+
console.log(page);
|
|
377
|
+
}
|
|
378
|
+
} catch (err) {
|
|
379
|
+
switch (true) {
|
|
380
|
+
// The server response does not match the expected SDK schema
|
|
381
|
+
case (err instanceof SDKValidationError): {
|
|
382
|
+
// Pretty-print will provide a human-readable multi-line error message
|
|
383
|
+
console.error(err.pretty());
|
|
384
|
+
// Raw value may also be inspected
|
|
385
|
+
console.error(err.rawValue);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
case (err instanceof ErrorResponse): {
|
|
389
|
+
// Handle err.data$: ErrorResponseData
|
|
390
|
+
console.error(err);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
case (err instanceof ErrorResponse): {
|
|
394
|
+
// Handle err.data$: ErrorResponseData
|
|
395
|
+
console.error(err);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
default: {
|
|
399
|
+
// Other errors such as network errors, see HTTPClientErrors for more details
|
|
400
|
+
throw err;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
run();
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
|
|
411
|
+
|
|
412
|
+
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
|
|
413
|
+
|
|
414
|
+
| HTTP Client Error | Description |
|
|
415
|
+
| ---------------------------------------------------- | ---------------------------------------------------- |
|
|
416
|
+
| RequestAbortedError | HTTP request was aborted by the client |
|
|
417
|
+
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
|
|
418
|
+
| ConnectionError | HTTP client was unable to make a request to a server |
|
|
419
|
+
| InvalidRequestError | Any input used to create a request is invalid |
|
|
420
|
+
| UnexpectedClientError | Unrecognised or unexpected error |
|
|
421
|
+
<!-- End Error Handling [errors] -->
|
|
422
|
+
|
|
423
|
+
<!-- Start Server Selection [server] -->
|
|
424
|
+
## Server Selection
|
|
425
|
+
|
|
426
|
+
### Override Server URL Per-Client
|
|
427
|
+
|
|
428
|
+
The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
|
|
429
|
+
```typescript
|
|
430
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
431
|
+
|
|
432
|
+
const s2 = new S2({
|
|
433
|
+
serverURL: "https://aws.s2.dev/v1alpha",
|
|
434
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
async function run() {
|
|
438
|
+
const result = await s2.account.listBasins({});
|
|
439
|
+
|
|
440
|
+
for await (const page of result) {
|
|
441
|
+
// Handle the page
|
|
442
|
+
console.log(page);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
run();
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Override Server URL Per-Operation
|
|
451
|
+
|
|
452
|
+
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
|
|
453
|
+
```typescript
|
|
454
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
455
|
+
|
|
456
|
+
const s2 = new S2({
|
|
457
|
+
bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
async function run() {
|
|
461
|
+
const result = await s2.basin.listStreams({}, {
|
|
462
|
+
serverURL: "https://my-favorite-basin.b.aws.s2.dev/v1alpha",
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
for await (const page of result) {
|
|
466
|
+
// Handle the page
|
|
467
|
+
console.log(page);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
run();
|
|
472
|
+
|
|
473
|
+
```
|
|
474
|
+
<!-- End Server Selection [server] -->
|
|
475
|
+
|
|
476
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
477
|
+
## Custom HTTP Client
|
|
478
|
+
|
|
479
|
+
The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
|
|
480
|
+
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
|
|
481
|
+
client is a thin wrapper around `fetch` and provides the ability to attach hooks
|
|
482
|
+
around the request lifecycle that can be used to modify the request or handle
|
|
483
|
+
errors and response.
|
|
484
|
+
|
|
485
|
+
The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
486
|
+
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
487
|
+
the HTTP client and feed in fixtures.
|
|
488
|
+
|
|
489
|
+
The following example shows how to use the `"beforeRequest"` hook to to add a
|
|
490
|
+
custom header and a timeout to requests and how to use the `"requestError"` hook
|
|
491
|
+
to log errors:
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
495
|
+
import { HTTPClient } from "@s2-dev/streamstore/lib/http";
|
|
496
|
+
|
|
497
|
+
const httpClient = new HTTPClient({
|
|
498
|
+
// fetcher takes a function that has the same signature as native `fetch`.
|
|
499
|
+
fetcher: (request) => {
|
|
500
|
+
return fetch(request);
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
httpClient.addHook("beforeRequest", (request) => {
|
|
505
|
+
const nextRequest = new Request(request, {
|
|
506
|
+
signal: request.signal || AbortSignal.timeout(5000)
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
nextRequest.headers.set("x-custom-header", "custom value");
|
|
510
|
+
|
|
511
|
+
return nextRequest;
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
httpClient.addHook("requestError", (error, request) => {
|
|
515
|
+
console.group("Request Error");
|
|
516
|
+
console.log("Reason:", `${error}`);
|
|
517
|
+
console.log("Endpoint:", `${request.method} ${request.url}`);
|
|
518
|
+
console.groupEnd();
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
const sdk = new S2({ httpClient });
|
|
522
|
+
```
|
|
523
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
524
|
+
|
|
525
|
+
<!-- Start Debugging [debug] -->
|
|
526
|
+
## Debugging
|
|
527
|
+
|
|
528
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
529
|
+
|
|
530
|
+
You can pass a logger that matches `console`'s interface as an SDK option.
|
|
531
|
+
|
|
532
|
+
> [!WARNING]
|
|
533
|
+
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
|
|
534
|
+
|
|
535
|
+
```typescript
|
|
536
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
537
|
+
|
|
538
|
+
const sdk = new S2({ debugLogger: console });
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
You can also enable a default debug logger by setting an environment variable `S2_DEBUG` to true.
|
|
542
|
+
<!-- End Debugging [debug] -->
|
|
543
|
+
|
|
544
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
545
|
+
|
|
546
|
+
# Development
|
|
547
|
+
|
|
548
|
+
## Maturity
|
|
549
|
+
|
|
550
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
551
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
552
|
+
looking for the latest version.
|
|
553
|
+
|
|
554
|
+
## Contributions
|
|
555
|
+
|
|
556
|
+
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
557
|
+
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
558
|
+
|
|
559
|
+
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=streamstore&utm_campaign=typescript)
|
package/RUNTIMES.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Supported JavaScript runtimes
|
|
2
|
+
|
|
3
|
+
This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
|
|
4
|
+
|
|
5
|
+
* [Web Fetch API][web-fetch]
|
|
6
|
+
* [Web Streams API][web-streams] and in particular `ReadableStream`
|
|
7
|
+
* [Async iterables][async-iter] using `Symbol.asyncIterator`
|
|
8
|
+
|
|
9
|
+
[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
10
|
+
[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
11
|
+
[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
12
|
+
|
|
13
|
+
Runtime environments that are explicitly supported are:
|
|
14
|
+
|
|
15
|
+
- Evergreen browsers which include: Chrome, Safari, Edge, Firefox
|
|
16
|
+
- Node.js active and maintenance LTS releases
|
|
17
|
+
- Currently, this is v18 and v20
|
|
18
|
+
- Bun v1 and above
|
|
19
|
+
- Deno v1.39
|
|
20
|
+
- Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
|
|
21
|
+
|
|
22
|
+
[deno-file-streaming]: https://github.com/denoland/deno/issues/11018
|
|
23
|
+
|
|
24
|
+
## Recommended TypeScript compiler options
|
|
25
|
+
|
|
26
|
+
The following `tsconfig.json` options are recommended for projects using this
|
|
27
|
+
SDK in order to get static type support for features like async iterables,
|
|
28
|
+
streams and `fetch`-related APIs ([`for await...of`][for-await-of],
|
|
29
|
+
[`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
|
|
30
|
+
so on):
|
|
31
|
+
|
|
32
|
+
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
33
|
+
[abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
34
|
+
[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
35
|
+
[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
{
|
|
39
|
+
"compilerOptions": {
|
|
40
|
+
"target": "es2020", // or higher
|
|
41
|
+
"lib": ["es2020", "dom", "dom.iterable"],
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
While `target` can be set to older ECMAScript versions, it may result in extra,
|
|
47
|
+
unnecessary compatibility code being generated if you are not targeting old
|
|
48
|
+
runtimes.
|
package/core.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientSDK } from "./lib/sdks.js";
|
|
2
|
+
/**
|
|
3
|
+
* A minimal client to use when calling standalone SDK functions. Typically, an
|
|
4
|
+
* instance of this class would be instantiated once at the start of an
|
|
5
|
+
* application and passed around through some dependency injection mechanism to
|
|
6
|
+
* parts of an application that need to make SDK calls.
|
|
7
|
+
*/
|
|
8
|
+
export declare class S2Core extends ClientSDK {
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=core.d.ts.map
|
package/core.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,SAAS;CAAG"}
|
package/core.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.S2Core = void 0;
|
|
7
|
+
const sdks_js_1 = require("./lib/sdks.js");
|
|
8
|
+
/**
|
|
9
|
+
* A minimal client to use when calling standalone SDK functions. Typically, an
|
|
10
|
+
* instance of this class would be instantiated once at the start of an
|
|
11
|
+
* application and passed around through some dependency injection mechanism to
|
|
12
|
+
* parts of an application that need to make SDK calls.
|
|
13
|
+
*/
|
|
14
|
+
class S2Core extends sdks_js_1.ClientSDK {
|
|
15
|
+
}
|
|
16
|
+
exports.S2Core = S2Core;
|
|
17
|
+
//# sourceMappingURL=core.js.map
|
package/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2CAA0C;AAE1C;;;;;GAKG;AACH,MAAa,MAAO,SAAQ,mBAAS;CAAG;AAAxC,wBAAwC"}
|