dub 0.10.0 → 0.20.2
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/.github/workflows/sdk_generation.yaml +26 -0
- package/.github/workflows/sdk_publish.yaml +15 -0
- package/.speakeasy/gen.lock +205 -0
- package/.speakeasy/gen.yaml +37 -0
- package/.speakeasy/workflow.yaml +12 -0
- package/README.md +292 -182
- package/docs/sdks/analytics/README.md +535 -0
- package/docs/sdks/dub/README.md +9 -0
- package/docs/sdks/links/README.md +415 -0
- package/docs/sdks/qrcodes/README.md +58 -0
- package/docs/sdks/tags/README.md +113 -0
- package/docs/sdks/workspaces/README.md +168 -0
- package/hooks/hooks.d.ts +20 -0
- package/hooks/hooks.d.ts.map +1 -0
- package/hooks/hooks.js +55 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.d.ts.map +1 -0
- package/{_shims/auto/runtime-bun.js → hooks/index.js} +6 -5
- package/hooks/index.js.map +1 -0
- package/hooks/types.d.ts +59 -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 -125
- package/index.d.ts.map +1 -1
- package/index.js +10 -103
- package/index.js.map +1 -1
- package/lib/base64.d.ts +10 -0
- package/lib/base64.d.ts.map +1 -0
- package/lib/base64.js +61 -0
- package/lib/base64.js.map +1 -0
- package/lib/config.d.ts +39 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +39 -0
- package/lib/config.js.map +1 -0
- package/lib/encodings.d.ts +39 -0
- package/lib/encodings.d.ts.map +1 -0
- package/lib/encodings.js +311 -0
- package/lib/encodings.js.map +1 -0
- package/lib/http.d.ts +46 -0
- package/lib/http.d.ts.map +1 -0
- package/lib/http.js +143 -0
- package/lib/http.js.map +1 -0
- package/lib/retries.d.ts +18 -0
- package/lib/retries.d.ts.map +1 -0
- package/lib/retries.js +157 -0
- package/lib/retries.js.map +1 -0
- package/lib/schemas.d.ts +7 -0
- package/lib/schemas.d.ts.map +1 -0
- package/{shims/web.js → lib/schemas.js} +24 -6
- package/lib/schemas.js.map +1 -0
- package/lib/sdks.d.ts +39 -0
- package/lib/sdks.d.ts.map +1 -0
- package/lib/sdks.js +98 -0
- package/lib/sdks.js.map +1 -0
- package/lib/security.d.ts +57 -0
- package/lib/security.d.ts.map +1 -0
- package/lib/security.js +115 -0
- package/lib/security.js.map +1 -0
- package/lib/url.d.ts +4 -0
- package/lib/url.d.ts.map +1 -0
- package/lib/url.js +26 -0
- package/lib/url.js.map +1 -0
- package/models/components/index.d.ts +5 -0
- package/models/components/index.d.ts.map +1 -0
- package/{_shims/auto/runtime-node.js → models/components/index.js} +8 -5
- package/models/components/index.js.map +1 -0
- package/models/components/linkschema.d.ts +222 -0
- package/models/components/linkschema.d.ts.map +1 -0
- package/models/components/linkschema.js +189 -0
- package/models/components/linkschema.js.map +1 -0
- package/models/components/security.d.ts +16 -0
- package/models/components/security.d.ts.map +1 -0
- package/models/components/security.js +53 -0
- package/models/components/security.js.map +1 -0
- package/models/components/tagschema.d.ts +45 -0
- package/models/components/tagschema.d.ts.map +1 -0
- package/models/components/tagschema.js +76 -0
- package/models/components/tagschema.js.map +1 -0
- package/models/components/workspaceschema.d.ts +178 -0
- package/models/components/workspaceschema.d.ts.map +1 -0
- package/models/components/workspaceschema.js +190 -0
- package/models/components/workspaceschema.js.map +1 -0
- package/models/errors/badrequest.d.ts +65 -0
- package/models/errors/badrequest.d.ts.map +1 -0
- package/models/errors/badrequest.js +111 -0
- package/models/errors/badrequest.js.map +1 -0
- package/models/errors/conflict.d.ts +65 -0
- package/models/errors/conflict.d.ts.map +1 -0
- package/models/errors/conflict.js +111 -0
- package/models/errors/conflict.js.map +1 -0
- package/models/errors/forbidden.d.ts +65 -0
- package/models/errors/forbidden.d.ts.map +1 -0
- package/models/errors/forbidden.js +111 -0
- package/models/errors/forbidden.js.map +1 -0
- package/models/errors/index.d.ts +12 -0
- package/models/errors/index.d.ts.map +1 -0
- package/{_shims/auto/types-node.js → models/errors/index.js} +15 -5
- package/models/errors/index.js.map +1 -0
- package/models/errors/internalservererror.d.ts +65 -0
- package/models/errors/internalservererror.d.ts.map +1 -0
- package/models/errors/internalservererror.js +111 -0
- package/models/errors/internalservererror.js.map +1 -0
- package/models/errors/inviteexpired.d.ts +65 -0
- package/models/errors/inviteexpired.d.ts.map +1 -0
- package/models/errors/inviteexpired.js +111 -0
- package/models/errors/inviteexpired.js.map +1 -0
- package/models/errors/notfound.d.ts +65 -0
- package/models/errors/notfound.d.ts.map +1 -0
- package/models/errors/notfound.js +111 -0
- package/models/errors/notfound.js.map +1 -0
- package/models/errors/ratelimitexceeded.d.ts +65 -0
- package/models/errors/ratelimitexceeded.d.ts.map +1 -0
- package/models/errors/ratelimitexceeded.js +111 -0
- package/models/errors/ratelimitexceeded.js.map +1 -0
- package/models/errors/sdkerror.d.ts +7 -0
- package/models/errors/sdkerror.d.ts.map +1 -0
- package/models/errors/sdkerror.js +19 -0
- package/models/errors/sdkerror.js.map +1 -0
- package/models/errors/sdkvalidationerror.d.ts +17 -0
- package/models/errors/sdkvalidationerror.d.ts.map +1 -0
- package/models/errors/sdkvalidationerror.js +107 -0
- package/models/errors/sdkvalidationerror.js.map +1 -0
- package/models/errors/unauthorized.d.ts +65 -0
- package/models/errors/unauthorized.d.ts.map +1 -0
- package/models/errors/unauthorized.js +111 -0
- package/models/errors/unauthorized.js.map +1 -0
- package/models/errors/unprocessableentity.d.ts +65 -0
- package/models/errors/unprocessableentity.d.ts.map +1 -0
- package/models/errors/unprocessableentity.js +111 -0
- package/models/errors/unprocessableentity.js.map +1 -0
- package/models/operations/bulkcreatelinks.d.ts +146 -0
- package/models/operations/bulkcreatelinks.d.ts.map +1 -0
- package/models/operations/bulkcreatelinks.js +138 -0
- package/models/operations/bulkcreatelinks.js.map +1 -0
- package/models/operations/createlink.d.ts +146 -0
- package/models/operations/createlink.d.ts.map +1 -0
- package/models/operations/createlink.js +141 -0
- package/models/operations/createlink.js.map +1 -0
- package/models/operations/createtag.d.ts +39 -0
- package/models/operations/createtag.d.ts.map +1 -0
- package/models/operations/createtag.js +72 -0
- package/models/operations/createtag.js.map +1 -0
- package/models/operations/createworkspace.d.ts +22 -0
- package/models/operations/createworkspace.d.ts.map +1 -0
- package/models/operations/createworkspace.js +61 -0
- package/models/operations/createworkspace.js.map +1 -0
- package/models/operations/deletelink.d.ts +39 -0
- package/models/operations/deletelink.d.ts.map +1 -0
- package/models/operations/deletelink.js +75 -0
- package/models/operations/deletelink.js.map +1 -0
- package/models/operations/editlink.d.ts +166 -0
- package/models/operations/editlink.d.ts.map +1 -0
- package/models/operations/editlink.js +167 -0
- package/models/operations/editlink.js.map +1 -0
- package/models/operations/getbrowseranalytics.d.ts +378 -0
- package/models/operations/getbrowseranalytics.d.ts.map +1 -0
- package/models/operations/getbrowseranalytics.js +395 -0
- package/models/operations/getbrowseranalytics.js.map +1 -0
- package/models/operations/getcityanalytics.d.ts +641 -0
- package/models/operations/getcityanalytics.d.ts.map +1 -0
- package/models/operations/getcityanalytics.js +657 -0
- package/models/operations/getcityanalytics.js.map +1 -0
- package/models/operations/getclicksanalytics.d.ts +355 -0
- package/models/operations/getclicksanalytics.d.ts.map +1 -0
- package/models/operations/getclicksanalytics.js +369 -0
- package/models/operations/getclicksanalytics.js.map +1 -0
- package/models/operations/getcountryanalytics.d.ts +635 -0
- package/models/operations/getcountryanalytics.d.ts.map +1 -0
- package/models/operations/getcountryanalytics.js +653 -0
- package/models/operations/getcountryanalytics.js.map +1 -0
- package/models/operations/getdeviceanalytics.d.ts +378 -0
- package/models/operations/getdeviceanalytics.d.ts.map +1 -0
- package/models/operations/getdeviceanalytics.js +395 -0
- package/models/operations/getdeviceanalytics.js.map +1 -0
- package/models/operations/getlinkinfo.d.ts +25 -0
- package/models/operations/getlinkinfo.d.ts.map +1 -0
- package/models/operations/getlinkinfo.js +57 -0
- package/models/operations/getlinkinfo.js.map +1 -0
- package/models/operations/getlinks.d.ts +88 -0
- package/models/operations/getlinks.d.ts.map +1 -0
- package/models/operations/getlinks.js +108 -0
- package/models/operations/getlinks.js.map +1 -0
- package/models/operations/getlinkscount.d.ts +93 -0
- package/models/operations/getlinkscount.d.ts.map +1 -0
- package/models/operations/getlinkscount.js +105 -0
- package/models/operations/getlinkscount.js.map +1 -0
- package/models/operations/getosanalytics.d.ts +378 -0
- package/models/operations/getosanalytics.d.ts.map +1 -0
- package/models/operations/getosanalytics.js +395 -0
- package/models/operations/getosanalytics.js.map +1 -0
- package/models/operations/getqrcode.d.ts +60 -0
- package/models/operations/getqrcode.d.ts.map +1 -0
- package/models/operations/getqrcode.js +85 -0
- package/models/operations/getqrcode.js.map +1 -0
- package/models/operations/getrefereranalytics.d.ts +378 -0
- package/models/operations/getrefereranalytics.d.ts.map +1 -0
- package/models/operations/getrefereranalytics.js +395 -0
- package/models/operations/getrefereranalytics.js.map +1 -0
- package/models/operations/gettags.d.ts +10 -0
- package/models/operations/gettags.d.ts.map +1 -0
- package/{shims/node.js → models/operations/gettags.js} +12 -6
- package/models/operations/gettags.js.map +1 -0
- package/models/operations/gettimeseriesanalytics.d.ts +378 -0
- package/models/operations/gettimeseriesanalytics.d.ts.map +1 -0
- package/models/operations/gettimeseriesanalytics.js +395 -0
- package/models/operations/gettimeseriesanalytics.js.map +1 -0
- package/models/operations/gettoplinks.d.ts +378 -0
- package/models/operations/gettoplinks.d.ts.map +1 -0
- package/models/operations/gettoplinks.js +395 -0
- package/models/operations/gettoplinks.js.map +1 -0
- package/models/operations/gettopurls.d.ts +378 -0
- package/models/operations/gettopurls.d.ts.map +1 -0
- package/models/operations/gettopurls.js +395 -0
- package/models/operations/gettopurls.js.map +1 -0
- package/models/operations/getworkspace.d.ts +19 -0
- package/models/operations/getworkspace.d.ts.map +1 -0
- package/models/operations/getworkspace.js +53 -0
- package/models/operations/getworkspace.js.map +1 -0
- package/models/operations/index.d.ts +23 -0
- package/models/operations/index.d.ts.map +1 -0
- package/models/operations/index.js +42 -0
- package/models/operations/index.js.map +1 -0
- package/package.json +25 -98
- package/sdk/analytics.d.ts +78 -0
- package/sdk/analytics.d.ts.map +1 -0
- package/sdk/analytics.js +2044 -0
- package/sdk/analytics.js.map +1 -0
- package/sdk/index.d.ts +2 -0
- package/sdk/index.d.ts.map +1 -0
- package/{_shims/auto/runtime.js → sdk/index.js} +5 -5
- package/sdk/index.js.map +1 -0
- package/sdk/links.d.ts +58 -0
- package/sdk/links.d.ts.map +1 -0
- package/sdk/links.js +1309 -0
- package/sdk/links.js.map +1 -0
- package/sdk/qrcodes.d.ts +21 -0
- package/sdk/qrcodes.d.ts.map +1 -0
- package/sdk/qrcodes.js +249 -0
- package/sdk/qrcodes.js.map +1 -0
- package/sdk/sdk.d.ts +22 -0
- package/sdk/sdk.d.ts.map +1 -0
- package/sdk/sdk.js +59 -0
- package/sdk/sdk.js.map +1 -0
- package/sdk/tags.d.ts +23 -0
- package/sdk/tags.d.ts.map +1 -0
- package/sdk/tags.js +401 -0
- package/sdk/tags.js.map +1 -0
- package/sdk/workspaces.d.ts +30 -0
- package/sdk/workspaces.d.ts.map +1 -0
- package/sdk/workspaces.js +556 -0
- package/sdk/workspaces.js.map +1 -0
- package/src/hooks/hooks.ts +81 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/types.ts +74 -0
- package/src/index.ts +8 -209
- package/src/lib/base64.ts +37 -0
- package/src/lib/config.ts +70 -0
- package/src/lib/encodings.ts +384 -0
- package/src/lib/http.ts +215 -0
- package/src/lib/retries.ts +226 -0
- package/src/lib/schemas.ts +22 -0
- package/src/lib/sdks.ts +139 -0
- package/src/lib/security.ts +180 -0
- package/src/lib/url.ts +31 -0
- package/src/models/components/index.ts +8 -0
- package/src/models/components/linkschema.ts +383 -0
- package/src/models/components/security.ts +40 -0
- package/src/models/components/tagschema.ts +79 -0
- package/src/models/components/workspaceschema.ts +316 -0
- package/src/models/errors/badrequest.ts +140 -0
- package/src/models/errors/conflict.ts +140 -0
- package/src/models/errors/forbidden.ts +140 -0
- package/src/models/errors/index.ts +15 -0
- package/src/models/errors/internalservererror.ts +140 -0
- package/src/models/errors/inviteexpired.ts +140 -0
- package/src/models/errors/notfound.ts +140 -0
- package/src/models/errors/ratelimitexceeded.ts +140 -0
- package/src/models/errors/sdkerror.ts +22 -0
- package/src/models/errors/sdkvalidationerror.ts +95 -0
- package/src/models/errors/unauthorized.ts +140 -0
- package/src/models/errors/unprocessableentity.ts +140 -0
- package/src/models/operations/bulkcreatelinks.ts +254 -0
- package/src/models/operations/createlink.ts +255 -0
- package/src/models/operations/createtag.ts +69 -0
- package/src/models/operations/createworkspace.ts +54 -0
- package/src/models/operations/deletelink.ts +84 -0
- package/src/models/operations/editlink.ts +300 -0
- package/src/models/operations/getbrowseranalytics.ts +484 -0
- package/src/models/operations/getcityanalytics.ts +744 -0
- package/src/models/operations/getclicksanalytics.ts +427 -0
- package/src/models/operations/getcountryanalytics.ts +743 -0
- package/src/models/operations/getdeviceanalytics.ts +480 -0
- package/src/models/operations/getlinkinfo.ts +53 -0
- package/src/models/operations/getlinks.ts +155 -0
- package/src/models/operations/getlinkscount.ts +157 -0
- package/src/models/operations/getosanalytics.ts +475 -0
- package/src/models/operations/getqrcode.ts +106 -0
- package/src/models/operations/getrefereranalytics.ts +484 -0
- package/src/models/operations/gettags.ts +18 -0
- package/src/models/operations/gettimeseriesanalytics.ts +476 -0
- package/src/models/operations/gettoplinks.ts +475 -0
- package/src/models/operations/gettopurls.ts +475 -0
- package/src/models/operations/getworkspace.ts +43 -0
- package/src/models/operations/index.ts +26 -0
- package/src/sdk/analytics.ts +2493 -0
- package/src/sdk/index.ts +5 -0
- package/src/sdk/links.ts +1617 -0
- package/src/sdk/qrcodes.ts +276 -0
- package/src/sdk/sdk.ts +66 -0
- package/src/sdk/tags.ts +470 -0
- package/src/sdk/workspaces.ts +670 -0
- package/src/types/blobs.ts +30 -0
- package/src/types/index.ts +8 -0
- package/src/types/operations.ts +25 -0
- package/src/types/rfcdate.ts +54 -0
- package/types/blobs.d.ts +4 -0
- package/types/blobs.d.ts.map +1 -0
- package/{resources/projects/projects.js → types/blobs.js} +23 -24
- package/types/blobs.js.map +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +14 -0
- package/types/index.js.map +1 -0
- package/types/operations.d.ts +13 -0
- package/types/operations.d.ts.map +1 -0
- package/types/operations.js +19 -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/CHANGELOG.md +0 -116
- package/LICENSE +0 -201
- package/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -81
- package/_shims/index.js +0 -13
- package/_shims/index.mjs +0 -7
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -90
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -237
- package/core.d.ts.map +0 -1
- package/core.js +0 -868
- package/core.js.map +0 -1
- package/core.mjs +0 -837
- package/core.mjs.map +0 -1
- package/error.d.ts +0 -53
- package/error.d.ts.map +0 -1
- package/error.js +0 -143
- package/error.js.map +0 -1
- package/error.mjs +0 -127
- package/error.mjs.map +0 -1
- package/index.d.mts +0 -127
- package/index.mjs +0 -90
- package/index.mjs.map +0 -1
- package/resource.d.ts +0 -6
- package/resource.d.ts.map +0 -1
- package/resource.js +0 -11
- package/resource.js.map +0 -1
- package/resource.mjs +0 -7
- package/resource.mjs.map +0 -1
- package/resources/index.d.ts +0 -4
- package/resources/index.d.ts.map +0 -1
- package/resources/index.js +0 -11
- package/resources/index.js.map +0 -1
- package/resources/index.mjs +0 -5
- package/resources/index.mjs.map +0 -1
- package/resources/links/bulk.d.ts +0 -274
- package/resources/links/bulk.d.ts.map +0 -1
- package/resources/links/bulk.js +0 -18
- package/resources/links/bulk.js.map +0 -1
- package/resources/links/bulk.mjs +0 -14
- package/resources/links/bulk.mjs.map +0 -1
- package/resources/links/index.d.ts +0 -4
- package/resources/links/index.d.ts.map +0 -1
- package/resources/links/index.js +0 -11
- package/resources/links/index.js.map +0 -1
- package/resources/links/index.mjs +0 -5
- package/resources/links/index.mjs.map +0 -1
- package/resources/links/info.d.ts +0 -186
- package/resources/links/info.d.ts.map +0 -1
- package/resources/links/info.js +0 -18
- package/resources/links/info.js.map +0 -1
- package/resources/links/info.mjs +0 -14
- package/resources/links/info.mjs.map +0 -1
- package/resources/links/links.d.ts +0 -916
- package/resources/links/links.d.ts.map +0 -1
- package/resources/links/links.js +0 -72
- package/resources/links/links.js.map +0 -1
- package/resources/links/links.mjs +0 -45
- package/resources/links/links.mjs.map +0 -1
- package/resources/projects/index.d.ts +0 -3
- package/resources/projects/index.d.ts.map +0 -1
- package/resources/projects/index.js +0 -9
- package/resources/projects/index.js.map +0 -1
- package/resources/projects/index.mjs +0 -4
- package/resources/projects/index.mjs.map +0 -1
- package/resources/projects/projects.d.ts +0 -200
- package/resources/projects/projects.d.ts.map +0 -1
- package/resources/projects/projects.js.map +0 -1
- package/resources/projects/projects.mjs +0 -26
- package/resources/projects/projects.mjs.map +0 -1
- package/resources/projects/tags.d.ts +0 -4
- package/resources/projects/tags.d.ts.map +0 -1
- package/resources/projects/tags.js +0 -9
- package/resources/projects/tags.js.map +0 -1
- package/resources/projects/tags.mjs +0 -5
- package/resources/projects/tags.mjs.map +0 -1
- package/resources/qr.d.ts +0 -45
- package/resources/qr.d.ts.map +0 -1
- package/resources/qr.js +0 -18
- package/resources/qr.js.map +0 -1
- package/resources/qr.mjs +0 -14
- package/resources/qr.mjs.map +0 -1
- package/shims/node.d.ts +0 -29
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -81
- package/src/_shims/index.js +0 -13
- package/src/_shims/index.mjs +0 -7
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -83
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -63
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1145
- package/src/error.ts +0 -146
- package/src/lib/.keep +0 -4
- package/src/resource.ts +0 -11
- package/src/resources/index.ts +0 -20
- package/src/resources/links/bulk.ts +0 -337
- package/src/resources/links/index.ts +0 -15
- package/src/resources/links/info.ts +0 -230
- package/src/resources/links/links.ts +0 -1135
- package/src/resources/projects/index.ts +0 -4
- package/src/resources/projects/projects.ts +0 -253
- package/src/resources/projects/tags.ts +0 -5
- package/src/resources/qr.ts +0 -64
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
- package/src/tsconfig.json +0 -11
- package/src/uploads.ts +0 -245
- package/src/version.ts +0 -1
- package/uploads.d.ts +0 -75
- package/uploads.d.ts.map +0 -1
- package/uploads.js +0 -163
- package/uploads.js.map +0 -1
- package/uploads.mjs +0 -150
- package/uploads.mjs.map +0 -1
- package/version.d.ts +0 -2
- package/version.d.ts.map +0 -1
- package/version.js +0 -5
- package/version.js.map +0 -1
- package/version.mjs +0 -2
- package/version.mjs.map +0 -1
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
-
|
|
3
|
-
import * as Core from "../../core";
|
|
4
|
-
import { APIResource } from "../../resource";
|
|
5
|
-
import * as ProjectsAPI from "./projects";
|
|
6
|
-
import * as TagsAPI from "./tags";
|
|
7
|
-
|
|
8
|
-
export class Projects extends APIResource {
|
|
9
|
-
tags: TagsAPI.Tags = new TagsAPI.Tags(this._client);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Retrieve a project for the authenticated user.
|
|
13
|
-
*/
|
|
14
|
-
retrieve(
|
|
15
|
-
params: ProjectRetrieveParams,
|
|
16
|
-
options?: Core.RequestOptions,
|
|
17
|
-
): Core.APIPromise<ProjectRetrieveResponse> {
|
|
18
|
-
const { projectSlug = this._client.projectSlug } = params;
|
|
19
|
-
return this._client.get(`/projects/${projectSlug}`, options);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Retrieve a list of projects for the authenticated user.
|
|
24
|
-
*/
|
|
25
|
-
list(options?: Core.RequestOptions): Core.APIPromise<ProjectListResponse> {
|
|
26
|
-
return this._client.get('/projects', options);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ProjectRetrieveResponse {
|
|
31
|
-
/**
|
|
32
|
-
* The unique ID of the project.
|
|
33
|
-
*/
|
|
34
|
-
id: string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The date and time when the billing cycle starts for the project.
|
|
38
|
-
*/
|
|
39
|
-
billingCycleStart: number;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The date and time when the project was created.
|
|
43
|
-
*/
|
|
44
|
-
createdAt: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The domains of the project.
|
|
48
|
-
*/
|
|
49
|
-
domains: Array<ProjectRetrieveResponse.Domain>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The domains limit of the project.
|
|
53
|
-
*/
|
|
54
|
-
domainsLimit: number;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The links limit of the project.
|
|
58
|
-
*/
|
|
59
|
-
linksLimit: number;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The links usage of the project.
|
|
63
|
-
*/
|
|
64
|
-
linksUsage: number;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The logo of the project.
|
|
68
|
-
*/
|
|
69
|
-
logo: string | null;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The name of the project.
|
|
73
|
-
*/
|
|
74
|
-
name: string;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The plan of the project.
|
|
78
|
-
*/
|
|
79
|
-
plan: 'free' | 'pro' | 'business' | 'business plus' | 'business extra' | 'business max' | 'enterprise';
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* The slug of the project.
|
|
83
|
-
*/
|
|
84
|
-
slug: string;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* The Stripe ID of the project.
|
|
88
|
-
*/
|
|
89
|
-
stripeId: string | null;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The tags limit of the project.
|
|
93
|
-
*/
|
|
94
|
-
tagsLimit: number;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* The usage of the project.
|
|
98
|
-
*/
|
|
99
|
-
usage: number;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The usage limit of the project.
|
|
103
|
-
*/
|
|
104
|
-
usageLimit: number;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* The role of the authenticated user in the project.
|
|
108
|
-
*/
|
|
109
|
-
users: Array<ProjectRetrieveResponse.User>;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The users limit of the project.
|
|
113
|
-
*/
|
|
114
|
-
usersLimit: number;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export namespace ProjectRetrieveResponse {
|
|
118
|
-
export interface Domain {
|
|
119
|
-
/**
|
|
120
|
-
* The domain of the project.
|
|
121
|
-
*/
|
|
122
|
-
slug: string;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface User {
|
|
126
|
-
/**
|
|
127
|
-
* The role of the authenticated user in the project.
|
|
128
|
-
*/
|
|
129
|
-
role: 'owner' | 'member';
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export type ProjectListResponse = Array<ProjectListResponse.ProjectListResponseItem>;
|
|
134
|
-
|
|
135
|
-
export namespace ProjectListResponse {
|
|
136
|
-
export interface ProjectListResponseItem {
|
|
137
|
-
/**
|
|
138
|
-
* The unique ID of the project.
|
|
139
|
-
*/
|
|
140
|
-
id: string;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* The date and time when the billing cycle starts for the project.
|
|
144
|
-
*/
|
|
145
|
-
billingCycleStart: number;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* The date and time when the project was created.
|
|
149
|
-
*/
|
|
150
|
-
createdAt: string;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* The domains of the project.
|
|
154
|
-
*/
|
|
155
|
-
domains: Array<ProjectListResponseItem.Domain>;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The domains limit of the project.
|
|
159
|
-
*/
|
|
160
|
-
domainsLimit: number;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* The links limit of the project.
|
|
164
|
-
*/
|
|
165
|
-
linksLimit: number;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* The links usage of the project.
|
|
169
|
-
*/
|
|
170
|
-
linksUsage: number;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* The logo of the project.
|
|
174
|
-
*/
|
|
175
|
-
logo: string | null;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* The name of the project.
|
|
179
|
-
*/
|
|
180
|
-
name: string;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* The plan of the project.
|
|
184
|
-
*/
|
|
185
|
-
plan: 'free' | 'pro' | 'business' | 'business plus' | 'business extra' | 'business max' | 'enterprise';
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* The slug of the project.
|
|
189
|
-
*/
|
|
190
|
-
slug: string;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* The Stripe ID of the project.
|
|
194
|
-
*/
|
|
195
|
-
stripeId: string | null;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* The tags limit of the project.
|
|
199
|
-
*/
|
|
200
|
-
tagsLimit: number;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* The usage of the project.
|
|
204
|
-
*/
|
|
205
|
-
usage: number;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* The usage limit of the project.
|
|
209
|
-
*/
|
|
210
|
-
usageLimit: number;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* The role of the authenticated user in the project.
|
|
214
|
-
*/
|
|
215
|
-
users: Array<ProjectListResponseItem.User>;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The users limit of the project.
|
|
219
|
-
*/
|
|
220
|
-
usersLimit: number;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export namespace ProjectListResponseItem {
|
|
224
|
-
export interface Domain {
|
|
225
|
-
/**
|
|
226
|
-
* The domain of the project.
|
|
227
|
-
*/
|
|
228
|
-
slug: string;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export interface User {
|
|
232
|
-
/**
|
|
233
|
-
* The role of the authenticated user in the project.
|
|
234
|
-
*/
|
|
235
|
-
role: 'owner' | 'member';
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export interface ProjectRetrieveParams {
|
|
241
|
-
/**
|
|
242
|
-
* The slug for the project to retrieve. E.g. for `app.dub.co/acme`, the
|
|
243
|
-
* projectSlug is `acme`.
|
|
244
|
-
*/
|
|
245
|
-
projectSlug?: string;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export namespace Projects {
|
|
249
|
-
export import ProjectRetrieveResponse = ProjectsAPI.ProjectRetrieveResponse;
|
|
250
|
-
export import ProjectListResponse = ProjectsAPI.ProjectListResponse;
|
|
251
|
-
export import ProjectRetrieveParams = ProjectsAPI.ProjectRetrieveParams;
|
|
252
|
-
export import Tags = TagsAPI.Tags;
|
|
253
|
-
}
|
package/src/resources/qr.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
-
|
|
3
|
-
import * as Core from "../core";
|
|
4
|
-
import { APIResource } from "../resource";
|
|
5
|
-
import { isRequestOptions } from "../core";
|
|
6
|
-
import { type Response } from "../_shims/index";
|
|
7
|
-
import * as QrAPI from "./qr";
|
|
8
|
-
|
|
9
|
-
export class Qr extends APIResource {
|
|
10
|
-
/**
|
|
11
|
-
* Retrieve a QR code for a link.
|
|
12
|
-
*/
|
|
13
|
-
retrieve(query?: QrRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<Response>;
|
|
14
|
-
retrieve(options?: Core.RequestOptions): Core.APIPromise<Response>;
|
|
15
|
-
retrieve(
|
|
16
|
-
query: QrRetrieveParams | Core.RequestOptions = {},
|
|
17
|
-
options?: Core.RequestOptions,
|
|
18
|
-
): Core.APIPromise<Response> {
|
|
19
|
-
if (isRequestOptions(query)) {
|
|
20
|
-
return this.retrieve({}, query);
|
|
21
|
-
}
|
|
22
|
-
return this._client.get('/qr', { query, ...options, __binaryResponse: true });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface QrRetrieveParams {
|
|
27
|
-
/**
|
|
28
|
-
* The background color of the QR code in hex format. Defaults to `#ffffff` if not
|
|
29
|
-
* provided.
|
|
30
|
-
*/
|
|
31
|
-
bgColor?: string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The foreground color of the QR code in hex format. Defaults to `#000000` if not
|
|
35
|
-
* provided.
|
|
36
|
-
*/
|
|
37
|
-
fgColor?: string;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Whether to include a margin around the QR code. Defaults to `false` if not
|
|
41
|
-
* provided.
|
|
42
|
-
*/
|
|
43
|
-
includeMargin?: boolean;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The level of error correction to use for the QR code. Defaults to `L` if not
|
|
47
|
-
* provided.
|
|
48
|
-
*/
|
|
49
|
-
level?: 'L' | 'M' | 'Q' | 'H';
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The size of the QR code in pixels. Defaults to `600` if not provided.
|
|
53
|
-
*/
|
|
54
|
-
size?: number;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The URL to generate a QR code for. Defaults to `https://dub.co` if not provided.
|
|
58
|
-
*/
|
|
59
|
-
url?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export namespace Qr {
|
|
63
|
-
export import QrRetrieveParams = QrAPI.QrRetrieveParams;
|
|
64
|
-
}
|
package/src/shims/node.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import * as types from '../_shims/node-types';
|
|
3
|
-
import { setShims } from '../_shims/registry';
|
|
4
|
-
import { getRuntime } from '../_shims/node-runtime';
|
|
5
|
-
setShims(getRuntime());
|
|
6
|
-
|
|
7
|
-
declare module '../_shims/manual-types' {
|
|
8
|
-
export namespace manual {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
export type Agent = types.Agent;
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
export import fetch = types.fetch;
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
export type Request = types.Request;
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
export type RequestInfo = types.RequestInfo;
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
export type RequestInit = types.RequestInit;
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
export type Response = types.Response;
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
export type ResponseInit = types.ResponseInit;
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
export type ResponseType = types.ResponseType;
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
export type BodyInit = types.BodyInit;
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
export type Headers = types.Headers;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
export type HeadersInit = types.HeadersInit;
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
export type BlobPropertyBag = types.BlobPropertyBag;
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
export type FilePropertyBag = types.FilePropertyBag;
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
export type FileFromPathOptions = types.FileFromPathOptions;
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
export import FormData = types.FormData;
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
export import File = types.File;
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
export import Blob = types.Blob;
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
export type Readable = types.Readable;
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
export type FsReadStream = types.FsReadStream;
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
export import ReadableStream = types.ReadableStream;
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/shims/web.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import * as types from '../_shims/web-types';
|
|
3
|
-
import { setShims } from '../_shims/registry';
|
|
4
|
-
import { getRuntime } from '../_shims/web-runtime';
|
|
5
|
-
setShims(getRuntime({ manuallyImported: true }));
|
|
6
|
-
|
|
7
|
-
declare module '../_shims/manual-types' {
|
|
8
|
-
export namespace manual {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
export type Agent = types.Agent;
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
export import fetch = types.fetch;
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
export type Request = types.Request;
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
export type RequestInfo = types.RequestInfo;
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
export type RequestInit = types.RequestInit;
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
export type Response = types.Response;
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
export type ResponseInit = types.ResponseInit;
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
export type ResponseType = types.ResponseType;
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
export type BodyInit = types.BodyInit;
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
export type Headers = types.Headers;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
export type HeadersInit = types.HeadersInit;
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
export type BlobPropertyBag = types.BlobPropertyBag;
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
export type FilePropertyBag = types.FilePropertyBag;
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
export type FileFromPathOptions = types.FileFromPathOptions;
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
export import FormData = types.FormData;
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
export import File = types.File;
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
export import Blob = types.Blob;
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
export type Readable = types.Readable;
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
export type FsReadStream = types.FsReadStream;
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
export import ReadableStream = types.ReadableStream;
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/tsconfig.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// this config is included in the published src directory to prevent TS errors
|
|
3
|
-
// from appearing when users go to source, and VSCode opens the source .ts file
|
|
4
|
-
// via declaration maps
|
|
5
|
-
"include": ["index.ts"],
|
|
6
|
-
"compilerOptions": {
|
|
7
|
-
"target": "es2015",
|
|
8
|
-
"lib": ["DOM"],
|
|
9
|
-
"moduleResolution": "node"
|
|
10
|
-
}
|
|
11
|
-
}
|
package/src/uploads.ts
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { type RequestOptions } from './core';
|
|
2
|
-
import {
|
|
3
|
-
FormData,
|
|
4
|
-
File,
|
|
5
|
-
type Blob,
|
|
6
|
-
type FilePropertyBag,
|
|
7
|
-
getMultipartRequestOptions,
|
|
8
|
-
type FsReadStream,
|
|
9
|
-
isFsReadStream,
|
|
10
|
-
} from './_shims/index';
|
|
11
|
-
import { MultipartBody } from './_shims/MultipartBody';
|
|
12
|
-
export { fileFromPath } from './_shims/index';
|
|
13
|
-
|
|
14
|
-
type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView;
|
|
15
|
-
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Typically, this is a native "File" class.
|
|
19
|
-
*
|
|
20
|
-
* We provide the {@link toFile} utility to convert a variety of objects
|
|
21
|
-
* into the File class.
|
|
22
|
-
*
|
|
23
|
-
* For convenience, you can also pass a fetch Response, or in Node,
|
|
24
|
-
* the result of fs.createReadStream().
|
|
25
|
-
*/
|
|
26
|
-
export type Uploadable = FileLike | ResponseLike | FsReadStream;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
|
|
30
|
-
*/
|
|
31
|
-
export interface BlobLike {
|
|
32
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
|
|
33
|
-
readonly size: number;
|
|
34
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
|
|
35
|
-
readonly type: string;
|
|
36
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
37
|
-
text(): Promise<string>;
|
|
38
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
39
|
-
slice(start?: number, end?: number): BlobLike;
|
|
40
|
-
// unfortunately @types/node-fetch@^2.6.4 doesn't type the arrayBuffer method
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Intended to match web.File, node.File, node-fetch.File, etc.
|
|
45
|
-
*/
|
|
46
|
-
export interface FileLike extends BlobLike {
|
|
47
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
|
|
48
|
-
readonly lastModified: number;
|
|
49
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
|
|
50
|
-
readonly name: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Intended to match web.Response, node.Response, node-fetch.Response, etc.
|
|
55
|
-
*/
|
|
56
|
-
export interface ResponseLike {
|
|
57
|
-
url: string;
|
|
58
|
-
blob(): Promise<BlobLike>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const isResponseLike = (value: any): value is ResponseLike =>
|
|
62
|
-
value != null &&
|
|
63
|
-
typeof value === 'object' &&
|
|
64
|
-
typeof value.url === 'string' &&
|
|
65
|
-
typeof value.blob === 'function';
|
|
66
|
-
|
|
67
|
-
export const isFileLike = (value: any): value is FileLike =>
|
|
68
|
-
value != null &&
|
|
69
|
-
typeof value === 'object' &&
|
|
70
|
-
typeof value.name === 'string' &&
|
|
71
|
-
typeof value.lastModified === 'number' &&
|
|
72
|
-
isBlobLike(value);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The BlobLike type omits arrayBuffer() because @types/node-fetch@^2.6.4 lacks it; but this check
|
|
76
|
-
* adds the arrayBuffer() method type because it is available and used at runtime
|
|
77
|
-
*/
|
|
78
|
-
export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise<ArrayBuffer> } =>
|
|
79
|
-
value != null &&
|
|
80
|
-
typeof value === 'object' &&
|
|
81
|
-
typeof value.size === 'number' &&
|
|
82
|
-
typeof value.type === 'string' &&
|
|
83
|
-
typeof value.text === 'function' &&
|
|
84
|
-
typeof value.slice === 'function' &&
|
|
85
|
-
typeof value.arrayBuffer === 'function';
|
|
86
|
-
|
|
87
|
-
export const isUploadable = (value: any): value is Uploadable => {
|
|
88
|
-
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export type ToFileInput = Uploadable | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart>;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
95
|
-
* @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s
|
|
96
|
-
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
|
|
97
|
-
* @param {Object=} options additional properties
|
|
98
|
-
* @param {string=} options.type the MIME type of the content
|
|
99
|
-
* @param {number=} options.lastModified the last modified timestamp
|
|
100
|
-
* @returns a {@link File} with the given properties
|
|
101
|
-
*/
|
|
102
|
-
export async function toFile(
|
|
103
|
-
value: ToFileInput | PromiseLike<ToFileInput>,
|
|
104
|
-
name?: string | null | undefined,
|
|
105
|
-
options: FilePropertyBag | undefined = {},
|
|
106
|
-
): Promise<FileLike> {
|
|
107
|
-
// If it's a promise, resolve it.
|
|
108
|
-
value = await value;
|
|
109
|
-
|
|
110
|
-
if (isResponseLike(value)) {
|
|
111
|
-
const blob = await value.blob();
|
|
112
|
-
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file';
|
|
113
|
-
|
|
114
|
-
return new File([blob as any], name, options);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const bits = await getBytes(value);
|
|
118
|
-
|
|
119
|
-
name ||= getName(value) ?? 'unknown_file';
|
|
120
|
-
|
|
121
|
-
if (!options.type) {
|
|
122
|
-
const type = (bits[0] as any)?.type;
|
|
123
|
-
if (typeof type === 'string') {
|
|
124
|
-
options = { ...options, type };
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return new File(bits, name, options);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
|
|
132
|
-
let parts: Array<BlobPart> = [];
|
|
133
|
-
if (
|
|
134
|
-
typeof value === 'string' ||
|
|
135
|
-
ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
136
|
-
value instanceof ArrayBuffer
|
|
137
|
-
) {
|
|
138
|
-
parts.push(value);
|
|
139
|
-
} else if (isBlobLike(value)) {
|
|
140
|
-
parts.push(await value.arrayBuffer());
|
|
141
|
-
} else if (
|
|
142
|
-
isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc.
|
|
143
|
-
) {
|
|
144
|
-
for await (const chunk of value) {
|
|
145
|
-
parts.push(chunk as BlobPart); // TODO, consider validating?
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
throw new Error(
|
|
149
|
-
`Unexpected data type: ${typeof value}; constructor: ${value?.constructor
|
|
150
|
-
?.name}; props: ${propsForError(value)}`,
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return parts;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function propsForError(value: any): string {
|
|
158
|
-
const props = Object.getOwnPropertyNames(value);
|
|
159
|
-
return `[${props.map((p) => `"${p}"`).join(', ')}]`;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function getName(value: any): string | undefined {
|
|
163
|
-
return (
|
|
164
|
-
getStringFromMaybeBuffer(value.name) ||
|
|
165
|
-
getStringFromMaybeBuffer(value.filename) ||
|
|
166
|
-
// For fs.ReadStream
|
|
167
|
-
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop()
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefined => {
|
|
172
|
-
if (typeof x === 'string') return x;
|
|
173
|
-
if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x);
|
|
174
|
-
return undefined;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator<unknown> =>
|
|
178
|
-
value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
|
|
179
|
-
|
|
180
|
-
export const isMultipartBody = (body: any): body is MultipartBody =>
|
|
181
|
-
body && typeof body === 'object' && body.body && body[Symbol.toStringTag] === 'MultipartBody';
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
|
185
|
-
* Otherwise returns the request as is.
|
|
186
|
-
*/
|
|
187
|
-
export const maybeMultipartFormRequestOptions = async <T = Record<string, unknown>>(
|
|
188
|
-
opts: RequestOptions<T>,
|
|
189
|
-
): Promise<RequestOptions<T | MultipartBody>> => {
|
|
190
|
-
if (!hasUploadableValue(opts.body)) return opts;
|
|
191
|
-
|
|
192
|
-
const form = await createForm(opts.body);
|
|
193
|
-
return getMultipartRequestOptions(form, opts);
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export const multipartFormRequestOptions = async <T = Record<string, unknown>>(
|
|
197
|
-
opts: RequestOptions<T>,
|
|
198
|
-
): Promise<RequestOptions<T | MultipartBody>> => {
|
|
199
|
-
const form = await createForm(opts.body);
|
|
200
|
-
return getMultipartRequestOptions(form, opts);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
export const createForm = async <T = Record<string, unknown>>(body: T | undefined): Promise<FormData> => {
|
|
204
|
-
const form = new FormData();
|
|
205
|
-
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
206
|
-
return form;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const hasUploadableValue = (value: unknown): boolean => {
|
|
210
|
-
if (isUploadable(value)) return true;
|
|
211
|
-
if (Array.isArray(value)) return value.some(hasUploadableValue);
|
|
212
|
-
if (value && typeof value === 'object') {
|
|
213
|
-
for (const k in value) {
|
|
214
|
-
if (hasUploadableValue((value as any)[k])) return true;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return false;
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const addFormValue = async (form: FormData, key: string, value: unknown): Promise<void> => {
|
|
221
|
-
if (value === undefined) return;
|
|
222
|
-
if (value == null) {
|
|
223
|
-
throw new TypeError(
|
|
224
|
-
`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`,
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// TODO: make nested formats configurable
|
|
229
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
230
|
-
form.append(key, String(value));
|
|
231
|
-
} else if (isUploadable(value)) {
|
|
232
|
-
const file = await toFile(value);
|
|
233
|
-
form.append(key, file as File);
|
|
234
|
-
} else if (Array.isArray(value)) {
|
|
235
|
-
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)));
|
|
236
|
-
} else if (typeof value === 'object') {
|
|
237
|
-
await Promise.all(
|
|
238
|
-
Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)),
|
|
239
|
-
);
|
|
240
|
-
} else {
|
|
241
|
-
throw new TypeError(
|
|
242
|
-
`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`,
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
};
|
package/src/version.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const VERSION = '0.10.0'; // x-release-please-version
|