@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
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { S2Core } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import { CheckTailServerList } from "../models/operations/checktail.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Check the tail.
|
|
30
|
+
*/
|
|
31
|
+
export async function streamCheckTail(
|
|
32
|
+
client: S2Core,
|
|
33
|
+
request: operations.CheckTailRequest,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): Promise<
|
|
36
|
+
Result<
|
|
37
|
+
components.CheckTailResponse,
|
|
38
|
+
| errors.ErrorResponse
|
|
39
|
+
| errors.ErrorResponse
|
|
40
|
+
| APIError
|
|
41
|
+
| SDKValidationError
|
|
42
|
+
| UnexpectedClientError
|
|
43
|
+
| InvalidRequestError
|
|
44
|
+
| RequestAbortedError
|
|
45
|
+
| RequestTimeoutError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
>
|
|
48
|
+
> {
|
|
49
|
+
const parsed = safeParse(
|
|
50
|
+
request,
|
|
51
|
+
(value) => operations.CheckTailRequest$outboundSchema.parse(value),
|
|
52
|
+
"Input validation failed",
|
|
53
|
+
);
|
|
54
|
+
if (!parsed.ok) {
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
57
|
+
const payload = parsed.value;
|
|
58
|
+
const body = null;
|
|
59
|
+
|
|
60
|
+
const baseURL = options?.serverURL
|
|
61
|
+
|| pathToFunc(CheckTailServerList[0], { charEncoding: "percent" })({
|
|
62
|
+
basin: "my-favorite-basin",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const pathParams = {
|
|
66
|
+
stream: encodeSimple("stream", payload.stream, {
|
|
67
|
+
explode: false,
|
|
68
|
+
charEncoding: "percent",
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const path = pathToFunc("/streams/{stream}/records/tail")(pathParams);
|
|
73
|
+
|
|
74
|
+
const headers = new Headers(compactMap({
|
|
75
|
+
Accept: "application/json",
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
79
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
80
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
81
|
+
|
|
82
|
+
const context = {
|
|
83
|
+
operationID: "check_tail",
|
|
84
|
+
oAuth2Scopes: [],
|
|
85
|
+
|
|
86
|
+
resolvedSecurity: requestSecurity,
|
|
87
|
+
|
|
88
|
+
securitySource: client._options.bearerAuth,
|
|
89
|
+
retryConfig: options?.retries
|
|
90
|
+
|| client._options.retryConfig
|
|
91
|
+
|| { strategy: "none" },
|
|
92
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const requestRes = client._createRequest(context, {
|
|
96
|
+
security: requestSecurity,
|
|
97
|
+
method: "GET",
|
|
98
|
+
baseURL: baseURL,
|
|
99
|
+
path: path,
|
|
100
|
+
headers: headers,
|
|
101
|
+
body: body,
|
|
102
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
103
|
+
}, options);
|
|
104
|
+
if (!requestRes.ok) {
|
|
105
|
+
return requestRes;
|
|
106
|
+
}
|
|
107
|
+
const req = requestRes.value;
|
|
108
|
+
|
|
109
|
+
const doResult = await client._do(req, {
|
|
110
|
+
context,
|
|
111
|
+
errorCodes: ["400", "401", "404", "4XX", "500", "5XX"],
|
|
112
|
+
retryConfig: context.retryConfig,
|
|
113
|
+
retryCodes: context.retryCodes,
|
|
114
|
+
});
|
|
115
|
+
if (!doResult.ok) {
|
|
116
|
+
return doResult;
|
|
117
|
+
}
|
|
118
|
+
const response = doResult.value;
|
|
119
|
+
|
|
120
|
+
const responseFields = {
|
|
121
|
+
HttpMeta: { Response: response, Request: req },
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const [result] = await M.match<
|
|
125
|
+
components.CheckTailResponse,
|
|
126
|
+
| errors.ErrorResponse
|
|
127
|
+
| errors.ErrorResponse
|
|
128
|
+
| APIError
|
|
129
|
+
| SDKValidationError
|
|
130
|
+
| UnexpectedClientError
|
|
131
|
+
| InvalidRequestError
|
|
132
|
+
| RequestAbortedError
|
|
133
|
+
| RequestTimeoutError
|
|
134
|
+
| ConnectionError
|
|
135
|
+
>(
|
|
136
|
+
M.json(200, components.CheckTailResponse$inboundSchema),
|
|
137
|
+
M.jsonErr([400, 401, 404], errors.ErrorResponse$inboundSchema),
|
|
138
|
+
M.jsonErr(500, errors.ErrorResponse$inboundSchema),
|
|
139
|
+
M.fail("4XX"),
|
|
140
|
+
M.fail("5XX"),
|
|
141
|
+
)(response, { extraFields: responseFields });
|
|
142
|
+
if (!result.ok) {
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { S2Core } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { ReadServerList } from "../models/operations/read.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
export enum ReadAcceptEnum {
|
|
28
|
+
applicationJson = "application/json",
|
|
29
|
+
textEventStream = "text/event-stream",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Retrieve a batch of records.
|
|
34
|
+
*/
|
|
35
|
+
export async function streamRead(
|
|
36
|
+
client: S2Core,
|
|
37
|
+
request: operations.ReadRequest,
|
|
38
|
+
options?: RequestOptions & { acceptHeaderOverride?: ReadAcceptEnum },
|
|
39
|
+
): Promise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.ReadResponse,
|
|
42
|
+
| errors.ErrorResponse
|
|
43
|
+
| errors.ErrorResponse
|
|
44
|
+
| APIError
|
|
45
|
+
| SDKValidationError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| InvalidRequestError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| ConnectionError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
const parsed = safeParse(
|
|
54
|
+
request,
|
|
55
|
+
(value) => operations.ReadRequest$outboundSchema.parse(value),
|
|
56
|
+
"Input validation failed",
|
|
57
|
+
);
|
|
58
|
+
if (!parsed.ok) {
|
|
59
|
+
return parsed;
|
|
60
|
+
}
|
|
61
|
+
const payload = parsed.value;
|
|
62
|
+
const body = null;
|
|
63
|
+
|
|
64
|
+
const baseURL = options?.serverURL
|
|
65
|
+
|| pathToFunc(ReadServerList[0], { charEncoding: "percent" })({
|
|
66
|
+
basin: "my-favorite-basin",
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const pathParams = {
|
|
70
|
+
stream: encodeSimple("stream", payload.stream, {
|
|
71
|
+
explode: false,
|
|
72
|
+
charEncoding: "percent",
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const path = pathToFunc("/streams/{stream}/records")(pathParams);
|
|
77
|
+
|
|
78
|
+
const query = encodeFormQuery({
|
|
79
|
+
"limit": payload.limit,
|
|
80
|
+
"start_seq_num": payload.start_seq_num,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const headers = new Headers(compactMap({
|
|
84
|
+
Accept: options?.acceptHeaderOverride
|
|
85
|
+
|| "application/json;q=1, text/event-stream;q=0",
|
|
86
|
+
"s2-format": encodeSimple("s2-format", payload["s2-format"], {
|
|
87
|
+
explode: false,
|
|
88
|
+
charEncoding: "none",
|
|
89
|
+
}),
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
93
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
94
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
95
|
+
|
|
96
|
+
const context = {
|
|
97
|
+
operationID: "read",
|
|
98
|
+
oAuth2Scopes: [],
|
|
99
|
+
|
|
100
|
+
resolvedSecurity: requestSecurity,
|
|
101
|
+
|
|
102
|
+
securitySource: client._options.bearerAuth,
|
|
103
|
+
retryConfig: options?.retries
|
|
104
|
+
|| client._options.retryConfig
|
|
105
|
+
|| { strategy: "none" },
|
|
106
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const requestRes = client._createRequest(context, {
|
|
110
|
+
security: requestSecurity,
|
|
111
|
+
method: "GET",
|
|
112
|
+
baseURL: baseURL,
|
|
113
|
+
path: path,
|
|
114
|
+
headers: headers,
|
|
115
|
+
query: query,
|
|
116
|
+
body: body,
|
|
117
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
118
|
+
}, options);
|
|
119
|
+
if (!requestRes.ok) {
|
|
120
|
+
return requestRes;
|
|
121
|
+
}
|
|
122
|
+
const req = requestRes.value;
|
|
123
|
+
|
|
124
|
+
const doResult = await client._do(req, {
|
|
125
|
+
context,
|
|
126
|
+
errorCodes: ["400", "401", "404", "4XX", "500", "5XX"],
|
|
127
|
+
retryConfig: context.retryConfig,
|
|
128
|
+
retryCodes: context.retryCodes,
|
|
129
|
+
});
|
|
130
|
+
if (!doResult.ok) {
|
|
131
|
+
return doResult;
|
|
132
|
+
}
|
|
133
|
+
const response = doResult.value;
|
|
134
|
+
|
|
135
|
+
const responseFields = {
|
|
136
|
+
HttpMeta: { Response: response, Request: req },
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const [result] = await M.match<
|
|
140
|
+
operations.ReadResponse,
|
|
141
|
+
| errors.ErrorResponse
|
|
142
|
+
| errors.ErrorResponse
|
|
143
|
+
| APIError
|
|
144
|
+
| SDKValidationError
|
|
145
|
+
| UnexpectedClientError
|
|
146
|
+
| InvalidRequestError
|
|
147
|
+
| RequestAbortedError
|
|
148
|
+
| RequestTimeoutError
|
|
149
|
+
| ConnectionError
|
|
150
|
+
>(
|
|
151
|
+
M.json(200, operations.ReadResponse$inboundSchema),
|
|
152
|
+
M.sse(200, operations.ReadResponse$inboundSchema),
|
|
153
|
+
M.jsonErr([400, 401, 404], errors.ErrorResponse$inboundSchema),
|
|
154
|
+
M.jsonErr(500, errors.ErrorResponse$inboundSchema),
|
|
155
|
+
M.fail("4XX"),
|
|
156
|
+
M.fail("5XX"),
|
|
157
|
+
)(response, { extraFields: responseFields });
|
|
158
|
+
if (!result.ok) {
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { RequestInput } from "../lib/http.js";
|
|
6
|
+
import {
|
|
7
|
+
AfterErrorContext,
|
|
8
|
+
AfterErrorHook,
|
|
9
|
+
AfterSuccessContext,
|
|
10
|
+
AfterSuccessHook,
|
|
11
|
+
BeforeCreateRequestContext,
|
|
12
|
+
BeforeCreateRequestHook,
|
|
13
|
+
BeforeRequestContext,
|
|
14
|
+
BeforeRequestHook,
|
|
15
|
+
Hook,
|
|
16
|
+
Hooks,
|
|
17
|
+
SDKInitHook,
|
|
18
|
+
SDKInitOptions,
|
|
19
|
+
} from "./types.js";
|
|
20
|
+
|
|
21
|
+
import { initHooks } from "./registration.js";
|
|
22
|
+
|
|
23
|
+
export class SDKHooks implements Hooks {
|
|
24
|
+
sdkInitHooks: SDKInitHook[] = [];
|
|
25
|
+
beforeCreateRequestHooks: BeforeCreateRequestHook[] = [];
|
|
26
|
+
beforeRequestHooks: BeforeRequestHook[] = [];
|
|
27
|
+
afterSuccessHooks: AfterSuccessHook[] = [];
|
|
28
|
+
afterErrorHooks: AfterErrorHook[] = [];
|
|
29
|
+
|
|
30
|
+
constructor() {
|
|
31
|
+
const presetHooks: Array<Hook> = [];
|
|
32
|
+
|
|
33
|
+
for (const hook of presetHooks) {
|
|
34
|
+
if ("sdkInit" in hook) {
|
|
35
|
+
this.registerSDKInitHook(hook);
|
|
36
|
+
}
|
|
37
|
+
if ("beforeCreateRequest" in hook) {
|
|
38
|
+
this.registerBeforeCreateRequestHook(hook);
|
|
39
|
+
}
|
|
40
|
+
if ("beforeRequest" in hook) {
|
|
41
|
+
this.registerBeforeRequestHook(hook);
|
|
42
|
+
}
|
|
43
|
+
if ("afterSuccess" in hook) {
|
|
44
|
+
this.registerAfterSuccessHook(hook);
|
|
45
|
+
}
|
|
46
|
+
if ("afterError" in hook) {
|
|
47
|
+
this.registerAfterErrorHook(hook);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
initHooks(this);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
registerSDKInitHook(hook: SDKInitHook) {
|
|
54
|
+
this.sdkInitHooks.push(hook);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook) {
|
|
58
|
+
this.beforeCreateRequestHooks.push(hook);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
registerBeforeRequestHook(hook: BeforeRequestHook) {
|
|
62
|
+
this.beforeRequestHooks.push(hook);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
registerAfterSuccessHook(hook: AfterSuccessHook) {
|
|
66
|
+
this.afterSuccessHooks.push(hook);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
registerAfterErrorHook(hook: AfterErrorHook) {
|
|
70
|
+
this.afterErrorHooks.push(hook);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
sdkInit(opts: SDKInitOptions): SDKInitOptions {
|
|
74
|
+
return this.sdkInitHooks.reduce((opts, hook) => hook.sdkInit(opts), opts);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
beforeCreateRequest(
|
|
78
|
+
hookCtx: BeforeCreateRequestContext,
|
|
79
|
+
input: RequestInput,
|
|
80
|
+
): RequestInput {
|
|
81
|
+
let inp = input;
|
|
82
|
+
|
|
83
|
+
for (const hook of this.beforeCreateRequestHooks) {
|
|
84
|
+
inp = hook.beforeCreateRequest(hookCtx, inp);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return inp;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async beforeRequest(
|
|
91
|
+
hookCtx: BeforeRequestContext,
|
|
92
|
+
request: Request,
|
|
93
|
+
): Promise<Request> {
|
|
94
|
+
let req = request;
|
|
95
|
+
|
|
96
|
+
for (const hook of this.beforeRequestHooks) {
|
|
97
|
+
req = await hook.beforeRequest(hookCtx, req);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return req;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async afterSuccess(
|
|
104
|
+
hookCtx: AfterSuccessContext,
|
|
105
|
+
response: Response,
|
|
106
|
+
): Promise<Response> {
|
|
107
|
+
let res = response;
|
|
108
|
+
|
|
109
|
+
for (const hook of this.afterSuccessHooks) {
|
|
110
|
+
res = await hook.afterSuccess(hookCtx, res);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return res;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async afterError(
|
|
117
|
+
hookCtx: AfterErrorContext,
|
|
118
|
+
response: Response | null,
|
|
119
|
+
error: unknown,
|
|
120
|
+
): Promise<{ response: Response | null; error: unknown }> {
|
|
121
|
+
let res = response;
|
|
122
|
+
let err = error;
|
|
123
|
+
|
|
124
|
+
for (const hook of this.afterErrorHooks) {
|
|
125
|
+
const result = await hook.afterError(hookCtx, res, err);
|
|
126
|
+
res = result.response;
|
|
127
|
+
err = result.error;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return { response: res, error: err };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Hooks } from "./types.js";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* This file is only ever generated once on the first generation and then is free to be modified.
|
|
5
|
+
* Any hooks you wish to add should be registered in the initHooks function. Feel free to define them
|
|
6
|
+
* in this file or in separate files in the hooks folder.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// @ts-expect-error remove this line when you add your first hook and hooks is used
|
|
10
|
+
export function initHooks(hooks: Hooks) {
|
|
11
|
+
// Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook
|
|
12
|
+
// with an instance of a hook that implements that specific Hook interface
|
|
13
|
+
// Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
|
|
14
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { HTTPClient, RequestInput } from "../lib/http.js";
|
|
6
|
+
import { RetryConfig } from "../lib/retries.js";
|
|
7
|
+
import { SecurityState } from "../lib/security.js";
|
|
8
|
+
|
|
9
|
+
export type HookContext = {
|
|
10
|
+
operationID: string;
|
|
11
|
+
oAuth2Scopes?: string[];
|
|
12
|
+
securitySource?: any | (() => Promise<any>);
|
|
13
|
+
retryConfig: RetryConfig;
|
|
14
|
+
resolvedSecurity: SecurityState | null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type Awaitable<T> = T | Promise<T>;
|
|
18
|
+
|
|
19
|
+
export type SDKInitOptions = {
|
|
20
|
+
baseURL: URL | null;
|
|
21
|
+
client: HTTPClient;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type BeforeCreateRequestContext = HookContext & {};
|
|
25
|
+
export type BeforeRequestContext = HookContext & {};
|
|
26
|
+
export type AfterSuccessContext = HookContext & {};
|
|
27
|
+
export type AfterErrorContext = HookContext & {};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* SDKInitHook is called when the SDK is initializing. The
|
|
31
|
+
* hook can return a new baseURL and HTTP client to be used by the SDK.
|
|
32
|
+
*/
|
|
33
|
+
export interface SDKInitHook {
|
|
34
|
+
sdkInit: (opts: SDKInitOptions) => SDKInitOptions;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface BeforeCreateRequestHook {
|
|
38
|
+
/**
|
|
39
|
+
* A hook that is called before the SDK creates a `Request` object. The hook
|
|
40
|
+
* can modify how a request is constructed since certain modifications, like
|
|
41
|
+
* changing the request URL, cannot be done on a request object directly.
|
|
42
|
+
*/
|
|
43
|
+
beforeCreateRequest: (
|
|
44
|
+
hookCtx: BeforeCreateRequestContext,
|
|
45
|
+
input: RequestInput,
|
|
46
|
+
) => RequestInput;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface BeforeRequestHook {
|
|
50
|
+
/**
|
|
51
|
+
* A hook that is called before the SDK sends a request. The hook can
|
|
52
|
+
* introduce instrumentation code such as logging, tracing and metrics or
|
|
53
|
+
* replace the request before it is sent or throw an error to stop the
|
|
54
|
+
* request from being sent.
|
|
55
|
+
*/
|
|
56
|
+
beforeRequest: (
|
|
57
|
+
hookCtx: BeforeRequestContext,
|
|
58
|
+
request: Request,
|
|
59
|
+
) => Awaitable<Request>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface AfterSuccessHook {
|
|
63
|
+
/**
|
|
64
|
+
* A hook that is called after the SDK receives a response. The hook can
|
|
65
|
+
* introduce instrumentation code such as logging, tracing and metrics or
|
|
66
|
+
* modify the response before it is handled or throw an error to stop the
|
|
67
|
+
* response from being handled.
|
|
68
|
+
*/
|
|
69
|
+
afterSuccess: (
|
|
70
|
+
hookCtx: AfterSuccessContext,
|
|
71
|
+
response: Response,
|
|
72
|
+
) => Awaitable<Response>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AfterErrorHook {
|
|
76
|
+
/**
|
|
77
|
+
* A hook that is called after the SDK encounters an error, or a
|
|
78
|
+
* non-successful response. The hook can introduce instrumentation code such
|
|
79
|
+
* as logging, tracing and metrics or modify the response or error values.
|
|
80
|
+
*/
|
|
81
|
+
afterError: (
|
|
82
|
+
hookCtx: AfterErrorContext,
|
|
83
|
+
response: Response | null,
|
|
84
|
+
error: unknown,
|
|
85
|
+
) => Awaitable<{
|
|
86
|
+
response: Response | null;
|
|
87
|
+
error: unknown;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface Hooks {
|
|
92
|
+
/** Registers a hook to be used by the SDK for initialization event. */
|
|
93
|
+
registerSDKInitHook(hook: SDKInitHook): void;
|
|
94
|
+
/** Registers a hook to be used by the SDK for to modify `Request` construction. */
|
|
95
|
+
registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void;
|
|
96
|
+
/** Registers a hook to be used by the SDK for the before request event. */
|
|
97
|
+
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
|
98
|
+
/** Registers a hook to be used by the SDK for the after success event. */
|
|
99
|
+
registerAfterSuccessHook(hook: AfterSuccessHook): void;
|
|
100
|
+
/** Registers a hook to be used by the SDK for the after error event. */
|
|
101
|
+
registerAfterErrorHook(hook: AfterErrorHook): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type Hook =
|
|
105
|
+
| SDKInitHook
|
|
106
|
+
| BeforeCreateRequestHook
|
|
107
|
+
| BeforeRequestHook
|
|
108
|
+
| AfterSuccessHook
|
|
109
|
+
| AfterErrorHook;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
export function bytesToBase64(u8arr: Uint8Array): string {
|
|
8
|
+
return btoa(String.fromCodePoint(...u8arr));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function bytesFromBase64(encoded: string): Uint8Array {
|
|
12
|
+
return Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function stringToBytes(str: string): Uint8Array {
|
|
16
|
+
return new TextEncoder().encode(str);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function stringFromBytes(u8arr: Uint8Array): string {
|
|
20
|
+
return new TextDecoder().decode(u8arr);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function stringToBase64(str: string): string {
|
|
24
|
+
return bytesToBase64(stringToBytes(str));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function stringFromBase64(b64str: string): string {
|
|
28
|
+
return stringFromBytes(bytesFromBase64(b64str));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const zodOutbound = z
|
|
32
|
+
.instanceof(Uint8Array)
|
|
33
|
+
.or(z.string().transform(stringToBytes));
|
|
34
|
+
|
|
35
|
+
export const zodInbound = z
|
|
36
|
+
.instanceof(Uint8Array)
|
|
37
|
+
.or(z.string().transform(bytesFromBase64));
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { HTTPClient } from "./http.js";
|
|
6
|
+
import { Logger } from "./logger.js";
|
|
7
|
+
import { RetryConfig } from "./retries.js";
|
|
8
|
+
import { Params, pathToFunc } from "./url.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Contains the list of servers available to the SDK
|
|
12
|
+
*/
|
|
13
|
+
export const ServerList = [
|
|
14
|
+
"https://aws.s2.dev/v1alpha",
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export type SDKOptions = {
|
|
18
|
+
bearerAuth?: string | (() => Promise<string>);
|
|
19
|
+
|
|
20
|
+
httpClient?: HTTPClient;
|
|
21
|
+
/**
|
|
22
|
+
* Allows overriding the default server used by the SDK
|
|
23
|
+
*/
|
|
24
|
+
serverIdx?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Allows overriding the default server URL used by the SDK
|
|
27
|
+
*/
|
|
28
|
+
serverURL?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Allows overriding the default retry config used by the SDK
|
|
31
|
+
*/
|
|
32
|
+
retryConfig?: RetryConfig;
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
debugLogger?: Logger;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
38
|
+
let serverURL = options.serverURL;
|
|
39
|
+
|
|
40
|
+
const params: Params = {};
|
|
41
|
+
|
|
42
|
+
if (!serverURL) {
|
|
43
|
+
const serverIdx = options.serverIdx ?? 0;
|
|
44
|
+
if (serverIdx < 0 || serverIdx >= ServerList.length) {
|
|
45
|
+
throw new Error(`Invalid server index ${serverIdx}`);
|
|
46
|
+
}
|
|
47
|
+
serverURL = ServerList[serverIdx] || "";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const u = pathToFunc(serverURL)(params);
|
|
51
|
+
return new URL(u);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const SDK_METADATA = {
|
|
55
|
+
language: "typescript",
|
|
56
|
+
openapiDocVersion: "1.0.0",
|
|
57
|
+
sdkVersion: "0.2.5",
|
|
58
|
+
genVersion: "2.497.8",
|
|
59
|
+
userAgent: "speakeasy-sdk/typescript 0.2.5 2.497.8 1.0.0 @s2-dev/streamstore",
|
|
60
|
+
} as const;
|