@atom8n/client-oauth2 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/jest-expect-message/types/index.d.ts","../../../../node_modules/.pnpm/axios@1.12.0_debug@4.4.1/node_modules/axios/index.d.ts","../src/types.ts","../src/constants.ts","../src/utils.ts","../src/code-flow.ts","../src/credentials-flow.ts","../src/client-oauth2.ts","../src/client-oauth2-token.ts","../src/index.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/globals.typedarray.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/buffer.buffer.d.ts","../../../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/header.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/readable.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/file.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/fetch.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/formdata.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/connector.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/client.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/global-origin.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/handlers.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-client.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/retry-handler.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/retry-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/api.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/interceptors.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/util.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/cookies.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/patch.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/websocket.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/eventsource.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/filereader.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/content-type.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/cache.d.ts","../../../../node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/index.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/globals.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/assert.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/buffer.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/child_process.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/cluster.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/console.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/constants.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/crypto.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/dgram.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/dns.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/domain.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/dom-events.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/events.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/fs.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/http.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/http2.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/https.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/inspector.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/module.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/net.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/os.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/path.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/process.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/punycode.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/querystring.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/readline.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/repl.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/sea.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/stream.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/stream/web.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/test.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/timers.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/tls.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/trace_events.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/tty.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/url.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/util.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/v8.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/vm.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/wasi.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/zlib.d.ts","../../../../node_modules/.pnpm/@types+node@20.17.57/node_modules/@types/node/index.d.ts"],"fileIdsList":[[68,108,111],[68,110,111],[111],[68,111,116,145],[68,111,112,117,123,124,131,142,153],[68,111,112,113,123,131],[68,111],[63,64,65,68,111],[68,111,114,154],[68,111,115,116,124,132],[68,111,116,142,150],[68,111,117,119,123,131],[68,110,111,118],[68,111,119,120],[68,111,121,123],[68,110,111,123],[68,111,123,124,125,142,153],[68,111,123,124,125,138,142,145],[68,106,111],[68,111,119,123,126,131,142,153],[68,111,123,124,126,127,131,142,150,153],[68,111,126,128,142,150,153],[66,67,68,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159],[68,111,123,129],[68,111,130,153,158],[68,111,119,123,131,142],[68,111,132],[68,111,133],[68,110,111,134],[68,108,109,110,111,112,113,114,115,116,117,118,119,120,121,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159],[68,111,136],[68,111,137],[68,111,123,138,139],[68,111,138,140,154,156],[68,111,123,142,143,145],[68,111,144,145],[68,111,142,143],[68,111,145],[68,111,146],[68,108,111,142],[68,111,123,148,149],[68,111,148,149],[68,111,116,131,142,150],[68,111,151],[68,111,131,152],[68,111,126,137,153],[68,111,116,154],[68,111,142,155],[68,111,130,156],[68,111,157],[68,111,123,125,134,142,145,153,156,158],[68,111,142,159],[68,78,82,111,153],[68,78,111,142,153],[68,73,111],[68,75,78,111,150,153],[68,111,131,150],[68,111,160],[68,73,111,160],[68,75,78,111,131,153],[68,70,71,74,77,111,123,142,153],[68,78,85,111],[68,70,76,111],[68,78,99,100,111],[68,74,78,111,145,153,160],[68,99,111,160],[68,72,73,111,160],[68,78,111],[68,72,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,100,101,102,103,104,105,111],[68,78,93,111],[68,78,85,86,111],[68,76,78,86,87,111],[68,77,111],[68,70,73,78,111],[68,78,82,86,87,111],[68,82,111],[68,76,78,81,111,153],[68,70,75,78,85,111],[68,111,142],[68,73,78,99,111,158,160],[56,57,60,68,108,111],[54,55,57,58,59,61,68,111,128,137],[56,57,60,61,68,111,137],[55,68,111],[55,56,57,60,61,68,111],[55,60,61,68,111],[56,60,68,111]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"406a5a771d97867cba07e7fbd3cd1fb2dd1004558b973733205737e9dd7ed929","affectsGlobalScope":true,"impliedFormat":1},{"version":"c16757462a7a36ffcd0a7a7a1188d9a376de762d565e415dcba727fd463e8f7a","impliedFormat":99},{"version":"392e256db1ed40c404a1c03dd3a446bbcc3acc4fa2aef608e3fd253e698e45bb","signature":"bbe0865456489868cb63c55de0c6aa4a8e38210c63e9625b618b0d84237bc1d4"},{"version":"178541b72aea05e9413135c368c1e448462267d3dd7e1d514864b56bb9efb4a6","signature":"242433744c6e75d737eb8d39f719a6aa802067b73c448485c7a0207ca6e24303"},{"version":"246b2d83ae4f20658b019b488c190291f9ecc418ef221ef7b162de2f97ae8bef","signature":"622bd252aff90460352cc2868518da49e12ae93daf0941c232189dbf192d7e1e"},{"version":"5a1ec15c1099c24bfda544c45edd0b480436b19f31de0e469e899eec0452026d","signature":"bcc6a925f6379546c6cb5bef44722fa52a7d9e4d4366d6224ba44c9af758e79f"},{"version":"237eb6cf4308594083a069871a7d94418fc979b4071cc10b5fa07bfbef1c8843","signature":"534fe2a6ba6aa226d15bd2972d88bc47d5c096846562fcf25022a4f5fb05d140"},{"version":"cc734f7b5e38ddb3c5e44fe1b13fe3ae03a519398b08897ad832c49b8591bdc7","signature":"23e4a8aeaad82b6124d6919aa410d74d569940442be57fd17b9ed9e035c7a15f"},{"version":"258bed0ba6f4ce0d7a72b8b74d0502440d43569f2c2f45c6f077d4874843bce5","signature":"9a7590c6e2f3b5b3c32e224a87d7076b49f42db82dfe3668e45227ccfa606614"},"4bd742df7f43ab58cbf33b1e3f1fd181e86617e516fd464da4ddc5f9d8fc3805",{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"49a5a44f2e68241a1d2bd9ec894535797998841c09729e506a7cbfcaa40f2180","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"4d2b0eb911816f66abe4970898f97a2cfc902bcd743cbfa5017fad79f7ef90d8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","impliedFormat":1},{"version":"24b8685c62562f5d98615c5a0c1d05f297cf5065f15246edfe99e81ec4c0e011","impliedFormat":1},{"version":"93507c745e8f29090efb99399c3f77bec07db17acd75634249dc92f961573387","impliedFormat":1},{"version":"339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"b8582f8bf95b9b901bf6cf47b9ee3560c7f340be0bd39cb432f21e9e136c36a7","affectsGlobalScope":true,"impliedFormat":1},{"version":"6b042aa5d277ad6963e2837179fd2f8fbb01968ac67115b0833c0244e93d1d50","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"9e025aa38cad40827cc30aca974fe33fe2c4652fe8c88f48dadbbbd6300c8b07","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","impliedFormat":1},{"version":"84c1930e33d1bb12ad01bcbe11d656f9646bd21b2fb2afd96e8e10615a021aef","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"5a369483ac4cfbdf0331c248deeb36140e6907db5e1daed241546b4a2055f82c","impliedFormat":1},{"version":"e8f5b5cc36615c17d330eaf8eebbc0d6bdd942c25991f96ef122f246f4ff722f","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"71450bbc2d82821d24ca05699a533e72758964e9852062c53b30f31c36978ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4c21aaa8257d7950a5b75a251d9075b6a371208fc948c9c8402f6690ef3b5b55","impliedFormat":1},{"version":"b5895e6353a5d708f55d8685c38a235c3a6d8138e374dee8ceb8ffde5aa8002a","impliedFormat":1},{"version":"5b75ca915164e4a7ad94a60729fe45b8a62e7750ab232d0122f8ccdd768f5314","impliedFormat":1},{"version":"93bd413918fa921c8729cef45302b24d8b6c7855d72d5bf82d3972595ae8dcbf","impliedFormat":1},{"version":"4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","impliedFormat":1},{"version":"dccdf1677e531e33f8ac961a68bc537418c9a414797c1ea7e91307501cdc3f5e","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"5155da3047ef977944d791a2188ff6e6c225f6975cc1910ab7bb6838ab84cede","impliedFormat":1},{"version":"93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","impliedFormat":1},{"version":"afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5","impliedFormat":1},{"version":"3e5b3163e34f3dc24cba59db4bb90bcc33555cccac06b707501439bdcf3d4df4","affectsGlobalScope":true,"impliedFormat":1},{"version":"6b19db3600a17af69d4f33d08cc7076a7d19fb65bb36e442cac58929ec7c9482","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"5b6844ad931dcc1d3aca53268f4bd671428421464b1286746027aede398094f2","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093","impliedFormat":1},{"version":"0dbcebe2126d03936c70545e96a6e41007cf065be38a1ce4d32a39fcedefead4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb","impliedFormat":1},{"version":"09d479208911ac3ac6a7c2fe86217fc1abe6c4f04e2d52e4890e500699eeab32","affectsGlobalScope":true,"impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"c40b3d3cfbb1227c8935f681c2480a32b560e387dd771d329cdbd1641f2d6da5","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"5b566927cad2ed2139655d55d690ffa87df378b956e7fe1c96024c4d9f75c4cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"c4a3720550d1787c8d6284040853c0781ff1e2cd8d842f2cb44547525ee34c36","affectsGlobalScope":true,"impliedFormat":1},{"version":"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","impliedFormat":1},{"version":"f008d63ce0077f533e39df44b82d660707b15b0f8e31fbc153a62bb00b99bfe5","impliedFormat":1},{"version":"d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c","impliedFormat":1},{"version":"6bdb3144f8bf020f513651a6ea1cb8a378a612c0791042e0436fd9adf7372a17","affectsGlobalScope":true,"impliedFormat":1},{"version":"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","impliedFormat":1},{"version":"cac793cc47c29e26e4ac3601dcb00b4435ebed26203485790e44f2ad8b6ad847","impliedFormat":1}],"root":[53,[55,62]],"options":{"composite":true,"declaration":true,"esModuleInterop":true,"module":1,"noImplicitAny":true,"noImplicitReturns":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","preserveConstEnums":true,"removeComments":true,"rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":8,"tsBuildInfoFile":"./build.tsbuildinfo","useUnknownInCatchVariables":true},"referencedMap":[[108,1],[109,1],[110,2],[68,3],[111,4],[112,5],[113,6],[63,7],[66,8],[64,7],[65,7],[114,9],[115,10],[116,11],[117,12],[118,13],[119,14],[120,14],[122,7],[121,15],[123,16],[124,17],[125,18],[107,19],[67,7],[126,20],[127,21],[128,22],[160,23],[129,24],[130,25],[131,26],[132,27],[133,28],[134,29],[135,30],[136,31],[137,32],[138,33],[139,33],[140,34],[141,7],[142,35],[144,36],[143,37],[145,38],[146,39],[147,40],[148,41],[149,42],[150,43],[151,44],[152,45],[153,46],[154,47],[155,48],[156,49],[157,50],[158,51],[159,52],[54,7],[69,7],[51,7],[52,7],[9,7],[11,7],[10,7],[2,7],[12,7],[13,7],[14,7],[15,7],[16,7],[17,7],[18,7],[19,7],[3,7],[20,7],[21,7],[4,7],[22,7],[26,7],[23,7],[24,7],[25,7],[27,7],[28,7],[29,7],[5,7],[30,7],[31,7],[32,7],[33,7],[6,7],[37,7],[34,7],[35,7],[36,7],[38,7],[7,7],[39,7],[44,7],[45,7],[40,7],[41,7],[42,7],[43,7],[8,7],[49,7],[46,7],[47,7],[48,7],[50,7],[1,7],[85,53],[95,54],[84,53],[105,55],[76,56],[75,57],[104,58],[98,59],[103,60],[78,61],[92,62],[77,63],[101,64],[73,65],[72,58],[102,66],[74,67],[79,68],[80,7],[83,68],[70,7],[106,69],[96,70],[87,71],[88,72],[90,73],[86,74],[89,75],[99,58],[81,76],[82,77],[91,78],[71,79],[94,70],[93,68],[97,7],[100,80],[53,7],[61,81],[60,82],[58,83],[56,84],[59,85],[62,86],[55,7],[57,87]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.2"}
@@ -0,0 +1,20 @@
1
+ import type { ClientOAuth2, ClientOAuth2Options, ClientOAuth2RequestObject } from './client-oauth2';
2
+ export interface ClientOAuth2TokenData extends Record<string, string | undefined> {
3
+ token_type?: string | undefined;
4
+ access_token: string;
5
+ refresh_token: string;
6
+ expires_in?: string;
7
+ scope?: string | undefined;
8
+ }
9
+ export declare class ClientOAuth2Token {
10
+ readonly client: ClientOAuth2;
11
+ readonly data: ClientOAuth2TokenData;
12
+ readonly tokenType?: string;
13
+ readonly accessToken: string;
14
+ readonly refreshToken: string;
15
+ private expires;
16
+ constructor(client: ClientOAuth2, data: ClientOAuth2TokenData);
17
+ sign(requestObject: ClientOAuth2RequestObject): ClientOAuth2RequestObject;
18
+ refresh(opts?: ClientOAuth2Options): Promise<ClientOAuth2Token>;
19
+ expired(): boolean;
20
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ClientOAuth2Token = void 0;
37
+ const a = __importStar(require("node:assert"));
38
+ const constants_1 = require("./constants");
39
+ const utils_1 = require("./utils");
40
+ class ClientOAuth2Token {
41
+ constructor(client, data) {
42
+ this.client = client;
43
+ this.data = data;
44
+ this.tokenType = data.token_type?.toLowerCase() ?? 'bearer';
45
+ this.accessToken = data.access_token;
46
+ this.refreshToken = data.refresh_token;
47
+ this.expires = new Date();
48
+ this.expires.setSeconds(this.expires.getSeconds() + Number(data.expires_in));
49
+ }
50
+ sign(requestObject) {
51
+ if (!this.accessToken) {
52
+ throw new Error('Unable to sign without access token');
53
+ }
54
+ requestObject.headers = requestObject.headers ?? {};
55
+ if (this.tokenType === 'bearer') {
56
+ requestObject.headers.Authorization = 'Bearer ' + this.accessToken;
57
+ }
58
+ else {
59
+ const parts = requestObject.url.split('#');
60
+ const token = 'access_token=' + this.accessToken;
61
+ const url = parts[0].replace(/[?&]access_token=[^&#]/, '');
62
+ const fragment = parts[1] ? '#' + parts[1] : '';
63
+ requestObject.url = url + (url.indexOf('?') > -1 ? '&' : '?') + token + fragment;
64
+ requestObject.headers.Pragma = 'no-store';
65
+ requestObject.headers['Cache-Control'] = 'no-store';
66
+ }
67
+ return requestObject;
68
+ }
69
+ async refresh(opts) {
70
+ const options = { ...this.client.options, ...opts };
71
+ a.ok(this.refreshToken, 'refreshToken is required');
72
+ const { clientId, clientSecret } = options;
73
+ const headers = { ...constants_1.DEFAULT_HEADERS };
74
+ const body = {
75
+ refresh_token: this.refreshToken,
76
+ grant_type: 'refresh_token',
77
+ };
78
+ if (clientSecret) {
79
+ if (options.authentication === 'body') {
80
+ body.client_id = clientId;
81
+ body.client_secret = clientSecret;
82
+ }
83
+ else {
84
+ headers.Authorization = (0, utils_1.auth)(clientId, clientSecret);
85
+ }
86
+ }
87
+ else {
88
+ body.client_id = clientId;
89
+ }
90
+ const requestOptions = (0, utils_1.getRequestOptions)({
91
+ url: options.accessTokenUri,
92
+ method: 'POST',
93
+ headers,
94
+ body,
95
+ }, options);
96
+ const responseData = await this.client.accessTokenRequest(requestOptions);
97
+ return this.client.createToken({ ...this.data, ...responseData });
98
+ }
99
+ expired() {
100
+ return Date.now() > this.expires.getTime();
101
+ }
102
+ }
103
+ exports.ClientOAuth2Token = ClientOAuth2Token;
104
+ //# sourceMappingURL=client-oauth2-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-oauth2-token.js","sourceRoot":"","sources":["../src/client-oauth2-token.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAGjC,2CAA8C;AAC9C,mCAAkD;AAalD,MAAa,iBAAiB;IAS7B,YACU,MAAoB,EACpB,IAA2B;QAD3B,WAAM,GAAN,MAAM,CAAc;QACpB,SAAI,GAAJ,IAAI,CAAuB;QAEpC,IAA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MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;IACnE,CAAC;IAKD,OAAO;QACN,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5C,CAAC;CACD;AAvGD,8CAuGC"}
@@ -0,0 +1,46 @@
1
+ import * as qs from 'querystring';
2
+ import type { ClientOAuth2TokenData } from './client-oauth2-token';
3
+ import { ClientOAuth2Token } from './client-oauth2-token';
4
+ import { CodeFlow } from './code-flow';
5
+ import { CredentialsFlow } from './credentials-flow';
6
+ import type { Headers } from './types';
7
+ export interface ClientOAuth2RequestObject {
8
+ url: string;
9
+ method: 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
10
+ body?: Record<string, any>;
11
+ query?: qs.ParsedUrlQuery;
12
+ headers?: Headers;
13
+ ignoreSSLIssues?: boolean;
14
+ }
15
+ export interface ClientOAuth2Options {
16
+ clientId: string;
17
+ clientSecret?: string;
18
+ accessTokenUri: string;
19
+ authentication?: 'header' | 'body';
20
+ authorizationUri?: string;
21
+ redirectUri?: string;
22
+ scopes?: string[];
23
+ scopesSeparator?: ',' | ' ';
24
+ authorizationGrants?: string[];
25
+ state?: string;
26
+ additionalBodyProperties?: Record<string, any>;
27
+ body?: Record<string, any>;
28
+ query?: qs.ParsedUrlQuery;
29
+ ignoreSSLIssues?: boolean;
30
+ }
31
+ export declare class ResponseError extends Error {
32
+ readonly status: number;
33
+ readonly body: unknown;
34
+ readonly code: string;
35
+ readonly message: string;
36
+ constructor(status: number, body: unknown, code?: string, message?: string);
37
+ }
38
+ export declare class ClientOAuth2 {
39
+ readonly options: ClientOAuth2Options;
40
+ code: CodeFlow;
41
+ credentials: CredentialsFlow;
42
+ constructor(options: ClientOAuth2Options);
43
+ createToken(data: ClientOAuth2TokenData, type?: string): ClientOAuth2Token;
44
+ accessTokenRequest(options: ClientOAuth2RequestObject): Promise<ClientOAuth2TokenData>;
45
+ private parseResponseBody;
46
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.ClientOAuth2 = exports.ResponseError = void 0;
40
+ const axios_1 = __importDefault(require("axios"));
41
+ const https_1 = require("https");
42
+ const qs = __importStar(require("querystring"));
43
+ const client_oauth2_token_1 = require("./client-oauth2-token");
44
+ const code_flow_1 = require("./code-flow");
45
+ const credentials_flow_1 = require("./credentials-flow");
46
+ const utils_1 = require("./utils");
47
+ class ResponseError extends Error {
48
+ constructor(status, body, code = 'ESTATUS', message = `HTTP status ${status}`) {
49
+ super(message);
50
+ this.status = status;
51
+ this.body = body;
52
+ this.code = code;
53
+ this.message = message;
54
+ }
55
+ }
56
+ exports.ResponseError = ResponseError;
57
+ const sslIgnoringAgent = new https_1.Agent({ rejectUnauthorized: false });
58
+ class ClientOAuth2 {
59
+ constructor(options) {
60
+ this.options = options;
61
+ this.code = new code_flow_1.CodeFlow(this);
62
+ this.credentials = new credentials_flow_1.CredentialsFlow(this);
63
+ }
64
+ createToken(data, type) {
65
+ return new client_oauth2_token_1.ClientOAuth2Token(this, {
66
+ ...data,
67
+ ...(typeof type === 'string' ? { token_type: type } : type),
68
+ });
69
+ }
70
+ async accessTokenRequest(options) {
71
+ let url = options.url;
72
+ const query = qs.stringify(options.query);
73
+ if (query) {
74
+ url += (url.indexOf('?') === -1 ? '?' : '&') + query;
75
+ }
76
+ const requestConfig = {
77
+ url,
78
+ method: options.method,
79
+ data: qs.stringify(options.body),
80
+ headers: options.headers,
81
+ transformResponse: (res) => res,
82
+ validateStatus: (status) => status < 500,
83
+ };
84
+ if (options.ignoreSSLIssues) {
85
+ requestConfig.httpsAgent = sslIgnoringAgent;
86
+ }
87
+ const response = await axios_1.default.request(requestConfig);
88
+ if (response.status >= 400) {
89
+ const body = this.parseResponseBody(response);
90
+ const authErr = (0, utils_1.getAuthError)(body);
91
+ if (authErr)
92
+ throw authErr;
93
+ else
94
+ throw new ResponseError(response.status, response.data);
95
+ }
96
+ if (response.status >= 300) {
97
+ throw new ResponseError(response.status, response.data);
98
+ }
99
+ return this.parseResponseBody(response);
100
+ }
101
+ parseResponseBody(response) {
102
+ const contentType = response.headers['content-type'] ?? '';
103
+ const body = response.data;
104
+ if (contentType.startsWith('application/json')) {
105
+ return JSON.parse(body);
106
+ }
107
+ if (contentType.startsWith('application/x-www-form-urlencoded')) {
108
+ return qs.parse(body);
109
+ }
110
+ throw new ResponseError(response.status, body, undefined, `Unsupported content type: ${contentType}`);
111
+ }
112
+ }
113
+ exports.ClientOAuth2 = ClientOAuth2;
114
+ //# sourceMappingURL=client-oauth2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-oauth2.js","sourceRoot":"","sources":["../src/client-oauth2.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAA0B;AAE1B,iCAA8B;AAC9B,gDAAkC;AAGlC,+DAA0D;AAC1D,2CAAuC;AACvC,yDAAqD;AAErD,mCAAuC;AA4BvC,MAAa,aAAc,SAAQ,KAAK;IACvC,YACU,MAAc,EACd,IAAa,EACb,OAAO,SAAS,EAChB,UAAU,eAAe,MAAM,EAAE;QAE1C,KAAK,CAAC,OAAO,CAAC,CAAC;QALN,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;QACb,SAAI,GAAJ,IAAI,CAAY;QAChB,YAAO,GAAP,OAAO,CAA0B;IAG3C,CAAC;CACD;AATD,sCASC;AAED,MAAM,gBAAgB,GAAG,IAAI,aAAK,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC;AAKlE,MAAa,YAAY;IAKxB,YAAqB,OAA4B;QAA5B,YAAO,GAAP,OAAO,CAAqB;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,oBAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,kCAAe,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAKD,WAAW,CAAC,IAA2B,EAAE,IAAa;QACrD,OAAO,IAAI,uCAAiB,CAAC,IAAI,EAAE;YAClC,GAAG,IAAI;YACP,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CA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;QAED,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAwB,QAAQ,CAAC,CAAC;IAChE,CAAC;IAKO,iBAAiB,CAAmB,QAAgC;QAC3E,MAAM,WAAW,GAAI,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAY,IAAI,EAAE,CAAC;QACvE,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAc,CAAC;QAErC,IAAI,WAAW,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QAC9B,CAAC;QAED,IAAI,WAAW,CAAC,UAAU,CAAC,mCAAmC,CAAC,EAAE,CAAC;YACjE,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QAC5B,CAAC;QAED,MAAM,IAAI,aAAa,CACtB,QAAQ,CAAC,MAAM,EACf,IAAI,EACJ,SAAS,EACT,6BAA6B,WAAW,EAAE,CAC1C,CAAC;IACH,CAAC;CACD;AAxFD,oCAwFC"}
@@ -0,0 +1,8 @@
1
+ import type { ClientOAuth2, ClientOAuth2Options } from './client-oauth2';
2
+ import type { ClientOAuth2Token } from './client-oauth2-token';
3
+ export declare class CodeFlow {
4
+ private client;
5
+ constructor(client: ClientOAuth2);
6
+ getUri(opts?: Partial<ClientOAuth2Options>): string;
7
+ getToken(urlString: string, opts?: Partial<ClientOAuth2Options>): Promise<ClientOAuth2Token>;
8
+ }
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CodeFlow = void 0;
37
+ const qs = __importStar(require("querystring"));
38
+ const constants_1 = require("./constants");
39
+ const utils_1 = require("./utils");
40
+ class CodeFlow {
41
+ constructor(client) {
42
+ this.client = client;
43
+ }
44
+ getUri(opts) {
45
+ const options = { ...this.client.options, ...opts };
46
+ (0, utils_1.expects)(options, 'clientId', 'authorizationUri');
47
+ const url = new URL(options.authorizationUri);
48
+ const queryParams = {
49
+ ...options.query,
50
+ client_id: options.clientId,
51
+ redirect_uri: options.redirectUri,
52
+ response_type: 'code',
53
+ state: options.state,
54
+ ...(options.scopes ? { scope: options.scopes.join(options.scopesSeparator ?? ' ') } : {}),
55
+ };
56
+ for (const [key, value] of Object.entries(queryParams)) {
57
+ if (value !== null && value !== undefined) {
58
+ url.searchParams.append(key, value);
59
+ }
60
+ }
61
+ return url.toString();
62
+ }
63
+ async getToken(urlString, opts) {
64
+ const options = { ...this.client.options, ...opts };
65
+ (0, utils_1.expects)(options, 'clientId', 'accessTokenUri');
66
+ const url = new URL(urlString, constants_1.DEFAULT_URL_BASE);
67
+ if (typeof options.redirectUri === 'string' &&
68
+ typeof url.pathname === 'string' &&
69
+ url.pathname !== new URL(options.redirectUri, constants_1.DEFAULT_URL_BASE).pathname) {
70
+ throw new TypeError('Redirected path should match configured path, but got: ' + url.pathname);
71
+ }
72
+ if (!url.search?.substring(1)) {
73
+ throw new TypeError(`Unable to process uri: ${urlString}`);
74
+ }
75
+ const data = typeof url.search === 'string' ? qs.parse(url.search.substring(1)) : url.search || {};
76
+ const error = (0, utils_1.getAuthError)(data);
77
+ if (error)
78
+ throw error;
79
+ if (options.state && data.state !== options.state) {
80
+ throw new TypeError(`Invalid state: ${data.state}`);
81
+ }
82
+ if (!data.code) {
83
+ throw new TypeError('Missing code, unable to request token');
84
+ }
85
+ const headers = { ...constants_1.DEFAULT_HEADERS };
86
+ const body = {
87
+ code: data.code,
88
+ grant_type: 'authorization_code',
89
+ redirect_uri: options.redirectUri,
90
+ };
91
+ if (options.clientSecret) {
92
+ headers.Authorization = (0, utils_1.auth)(options.clientId, options.clientSecret);
93
+ }
94
+ else {
95
+ body.client_id = options.clientId;
96
+ }
97
+ const requestOptions = (0, utils_1.getRequestOptions)({
98
+ url: options.accessTokenUri,
99
+ method: 'POST',
100
+ headers,
101
+ body,
102
+ }, options);
103
+ const responseData = await this.client.accessTokenRequest(requestOptions);
104
+ return this.client.createToken(responseData);
105
+ }
106
+ }
107
+ exports.CodeFlow = CodeFlow;
108
+ //# sourceMappingURL=code-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-flow.js","sourceRoot":"","sources":["../src/code-flow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAIlC,2CAAgE;AAChE,mCAAyE;AAczE,MAAa,QAAQ;IACpB,YAA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EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,oBAAoB;YAChC,YAAY,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QAKF,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YAC1B,OAAO,CAAC,aAAa,GAAG,IAAA,YAAI,EAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;QACnC,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,yBAAiB,EACvC;YACC,GAAG,EAAE,OAAO,CAAC,cAAc;YAC3B,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;SACJ,EACD,OAAO,CACP,CAAC;QAEF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;CACD;AAvGD,4BAuGC"}
@@ -0,0 +1,4 @@
1
+ import type { Headers } from './types';
2
+ export declare const DEFAULT_URL_BASE = "https://example.org/";
3
+ export declare const DEFAULT_HEADERS: Headers;
4
+ export declare const ERROR_RESPONSES: Record<string, string>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERROR_RESPONSES = exports.DEFAULT_HEADERS = exports.DEFAULT_URL_BASE = void 0;
4
+ exports.DEFAULT_URL_BASE = 'https://example.org/';
5
+ exports.DEFAULT_HEADERS = {
6
+ Accept: 'application/json, application/x-www-form-urlencoded',
7
+ 'Content-Type': 'application/x-www-form-urlencoded',
8
+ };
9
+ exports.ERROR_RESPONSES = {
10
+ invalid_request: [
11
+ 'The request is missing a required parameter, includes an',
12
+ 'invalid parameter value, includes a parameter more than',
13
+ 'once, or is otherwise malformed.',
14
+ ].join(' '),
15
+ invalid_client: [
16
+ 'Client authentication failed (e.g., unknown client, no',
17
+ 'client authentication included, or unsupported',
18
+ 'authentication method).',
19
+ ].join(' '),
20
+ invalid_grant: [
21
+ 'The provided authorization grant (e.g., authorization',
22
+ 'code, resource owner credentials) or refresh token is',
23
+ 'invalid, expired, revoked, does not match the redirection',
24
+ 'URI used in the authorization request, or was issued to',
25
+ 'another client.',
26
+ ].join(' '),
27
+ unauthorized_client: [
28
+ 'The client is not authorized to request an authorization',
29
+ 'code using this method.',
30
+ ].join(' '),
31
+ unsupported_grant_type: [
32
+ 'The authorization grant type is not supported by the',
33
+ 'authorization server.',
34
+ ].join(' '),
35
+ access_denied: ['The resource owner or authorization server denied the request.'].join(' '),
36
+ unsupported_response_type: [
37
+ 'The authorization server does not support obtaining',
38
+ 'an authorization code using this method.',
39
+ ].join(' '),
40
+ invalid_scope: ['The requested scope is invalid, unknown, or malformed.'].join(' '),
41
+ server_error: [
42
+ 'The authorization server encountered an unexpected',
43
+ 'condition that prevented it from fulfilling the request.',
44
+ '(This error code is needed because a 500 Internal Server',
45
+ 'Error HTTP status code cannot be returned to the client',
46
+ 'via an HTTP redirect.)',
47
+ ].join(' '),
48
+ temporarily_unavailable: [
49
+ 'The authorization server is currently unable to handle',
50
+ 'the request due to a temporary overloading or maintenance',
51
+ 'of the server.',
52
+ ].join(' '),
53
+ };
54
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG,sBAAsB,CAAC;AAK1C,QAAA,eAAe,GAAY;IACvC,MAAM,EAAE,qDAAqD;IAC7D,cAAc,EAAE,mCAAmC;CACnD,CAAC;AAOW,QAAA,eAAe,GAA2B;IACtD,eAAe,EAAE;QAChB,0DAA0D;QAC1D,yDAAyD;QACzD,kCAAkC;KAClC,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,cAAc,EAAE;QACf,wDAAwD;QACxD,gDAAgD;QAChD,yBAAyB;KACzB,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,aAAa,EAAE;QACd,uDAAuD;QACvD,uDAAuD;QACvD,2DAA2D;QAC3D,yDAAyD;QACzD,iBAAiB;KACjB,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,mBAAmB,EAAE;QACpB,0DAA0D;QAC1D,yBAAyB;KACzB,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,sBAAsB,EAAE;QACvB,sDAAsD;QACtD,uBAAuB;KACvB,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,aAAa,EAAE,CAAC,gEAAgE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;IAC3F,yBAAyB,EAAE;QAC1B,qDAAqD;QACrD,0CAA0C;KAC1C,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,aAAa,EAAE,CAAC,wDAAwD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;IACnF,YAAY,EAAE;QACb,oDAAoD;QACpD,0DAA0D;QAC1D,0DAA0D;QAC1D,yDAAyD;QACzD,wBAAwB;KACxB,CAAC,IAAI,CAAC,GAAG,CAAC;IACX,uBAAuB,EAAE;QACxB,wDAAwD;QACxD,2DAA2D;QAC3D,gBAAgB;KAChB,CAAC,IAAI,CAAC,GAAG,CAAC;CACX,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ClientOAuth2 } from './client-oauth2';
2
+ import type { ClientOAuth2Token } from './client-oauth2-token';
3
+ export declare class CredentialsFlow {
4
+ private client;
5
+ constructor(client: ClientOAuth2);
6
+ getToken(): Promise<ClientOAuth2Token>;
7
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CredentialsFlow = void 0;
4
+ const constants_1 = require("./constants");
5
+ const utils_1 = require("./utils");
6
+ class CredentialsFlow {
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async getToken() {
11
+ const options = { ...this.client.options };
12
+ (0, utils_1.expects)(options, 'clientId', 'clientSecret', 'accessTokenUri');
13
+ const headers = { ...constants_1.DEFAULT_HEADERS };
14
+ const body = {
15
+ grant_type: 'client_credentials',
16
+ ...(options.additionalBodyProperties ?? {}),
17
+ };
18
+ if (options.scopes !== undefined) {
19
+ body.scope = options.scopes.join(options.scopesSeparator ?? ' ');
20
+ }
21
+ const clientId = options.clientId;
22
+ const clientSecret = options.clientSecret;
23
+ if (options.authentication === 'body') {
24
+ body.client_id = clientId;
25
+ body.client_secret = clientSecret;
26
+ }
27
+ else {
28
+ headers.Authorization = (0, utils_1.auth)(clientId, clientSecret);
29
+ }
30
+ const requestOptions = (0, utils_1.getRequestOptions)({
31
+ url: options.accessTokenUri,
32
+ method: 'POST',
33
+ headers,
34
+ body,
35
+ }, options);
36
+ const responseData = await this.client.accessTokenRequest(requestOptions);
37
+ return this.client.createToken(responseData);
38
+ }
39
+ }
40
+ exports.CredentialsFlow = CredentialsFlow;
41
+ //# sourceMappingURL=credentials-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials-flow.js","sourceRoot":"","sources":["../src/credentials-flow.ts"],"names":[],"mappings":";;;AAEA,2CAA8C;AAE9C,mCAA2D;AAc3D,MAAa,eAAe;IAC3B,YAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAK5C,KAAK,CAAC,QAAQ;QACb,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAA,eAAO,EAAC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;QAE/D,MAAM,OAAO,GAAY,EAAE,GAAG,2BAAe,EAAE,CAAC;QAChD,MAAM,IAAI,GAAwB;YACjC,UAAU,EAAE,oBAAoB;YAChC,GAAG,CAAC,OAAO,CAAC,wBAAwB,IAAI,EAAE,CAAC;SAC3C,CAAC;QAEF,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,GAAG,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QAE1C,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;YACvC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;YAC1B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QACnC,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,aAAa,GAAG,IAAA,YAAI,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,yBAAiB,EACvC;YACC,GAAG,EAAE,OAAO,CAAC,cAAc;YAC3B,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;SACJ,EACD,OAAO,CACP,CAAC;QAEF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;CACD;AA3CD,0CA2CC"}
@@ -0,0 +1,5 @@
1
+ export type { ClientOAuth2Options, ClientOAuth2RequestObject } from './client-oauth2';
2
+ export { ClientOAuth2 } from './client-oauth2';
3
+ export type { ClientOAuth2TokenData } from './client-oauth2-token';
4
+ export { ClientOAuth2Token } from './client-oauth2-token';
5
+ export type * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientOAuth2Token = exports.ClientOAuth2 = void 0;
4
+ var client_oauth2_1 = require("./client-oauth2");
5
+ Object.defineProperty(exports, "ClientOAuth2", { enumerable: true, get: function () { return client_oauth2_1.ClientOAuth2; } });
6
+ var client_oauth2_token_1 = require("./client-oauth2-token");
7
+ Object.defineProperty(exports, "ClientOAuth2Token", { enumerable: true, get: function () { return client_oauth2_token_1.ClientOAuth2Token; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,26 @@
1
+ export type Headers = Record<string, string | string[]>;
2
+ export type OAuth2GrantType = 'pkce' | 'authorizationCode' | 'clientCredentials';
3
+ export type OAuth2AuthenticationMethod = 'header' | 'body';
4
+ export interface OAuth2CredentialData {
5
+ clientId: string;
6
+ clientSecret?: string;
7
+ accessTokenUrl: string;
8
+ authentication?: OAuth2AuthenticationMethod;
9
+ authUrl?: string;
10
+ scope?: string;
11
+ authQueryParameters?: string;
12
+ additionalBodyProperties?: string;
13
+ grantType: OAuth2GrantType;
14
+ ignoreSSLIssues?: boolean;
15
+ oauthTokenData?: {
16
+ access_token: string;
17
+ refresh_token?: string;
18
+ };
19
+ useDynamicClientRegistration?: boolean;
20
+ serverUrl?: string;
21
+ }
22
+ export interface OAuth2AccessTokenErrorResponse extends Record<string, unknown> {
23
+ error: string;
24
+ error_description?: string;
25
+ error_uri?: string;
26
+ }
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { ClientOAuth2Options, ClientOAuth2RequestObject } from './client-oauth2';
2
+ export declare function expects<Keys extends keyof ClientOAuth2Options>(obj: ClientOAuth2Options, ...keys: Keys[]): asserts obj is ClientOAuth2Options & {
3
+ [K in Keys]: NonNullable<ClientOAuth2Options[K]>;
4
+ };
5
+ export declare class AuthError extends Error {
6
+ readonly body: any;
7
+ readonly code: string;
8
+ constructor(message: string, body: any, code?: string);
9
+ }
10
+ export declare function getAuthError(body: {
11
+ error: string;
12
+ error_description?: string;
13
+ }): Error | undefined;
14
+ export declare function auth(username: string, password: string): string;
15
+ export declare function getRequestOptions({ url, method, body, query, headers }: ClientOAuth2RequestObject, options: ClientOAuth2Options): ClientOAuth2RequestObject;
package/dist/utils.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthError = void 0;
4
+ exports.expects = expects;
5
+ exports.getAuthError = getAuthError;
6
+ exports.auth = auth;
7
+ exports.getRequestOptions = getRequestOptions;
8
+ const constants_1 = require("./constants");
9
+ function expects(obj, ...keys) {
10
+ for (const key of keys) {
11
+ if (obj[key] === null || obj[key] === undefined) {
12
+ throw new TypeError('Expected "' + key + '" to exist');
13
+ }
14
+ }
15
+ }
16
+ class AuthError extends Error {
17
+ constructor(message, body, code = 'EAUTH') {
18
+ super(message);
19
+ this.body = body;
20
+ this.code = code;
21
+ }
22
+ }
23
+ exports.AuthError = AuthError;
24
+ function getAuthError(body) {
25
+ const message = constants_1.ERROR_RESPONSES[body.error] ?? body.error_description ?? body.error;
26
+ if (message) {
27
+ return new AuthError(message, body);
28
+ }
29
+ return undefined;
30
+ }
31
+ function toString(str) {
32
+ return str === null ? '' : String(str);
33
+ }
34
+ function auth(username, password) {
35
+ return 'Basic ' + Buffer.from(toString(username) + ':' + toString(password)).toString('base64');
36
+ }
37
+ function getRequestOptions({ url, method, body, query, headers }, options) {
38
+ const rOptions = {
39
+ url,
40
+ method,
41
+ body: { ...body, ...options.body },
42
+ query: { ...query, ...options.query },
43
+ headers: headers ?? {},
44
+ ignoreSSLIssues: options.ignoreSSLIssues,
45
+ };
46
+ if (rOptions.headers.Authorization === '') {
47
+ delete rOptions.headers.Authorization;
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C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACjG,CAAC;AAKD,SAAgB,iBAAiB,CAChC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAA6B,EAChE,OAA4B;IAE5B,MAAM,QAAQ,GAAG;QAChB,GAAG;QACH,MAAM;QACN,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE;QAClC,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE;QACrC,OAAO,EAAE,OAAO,IAAI,EAAE;QACtB,eAAe,EAAE,OAAO,CAAC,eAAe;KACxC,CAAC;IAEF,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,KAAK,EAAE,EAAE,CAAC;QAC3C,OAAO,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC;IACvC,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@atom8n/client-oauth2",
3
+ "version": "1.0.0-rc.0",
4
+ "scripts": {
5
+ "clean": "rimraf dist .turbo",
6
+ "dev": "pnpm watch",
7
+ "typecheck": "tsc --noEmit",
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "format": "biome format --write src test",
10
+ "format:check": "biome ci src test",
11
+ "lint": "eslint . --quiet",
12
+ "lint:fix": "eslint . --fix",
13
+ "watch": "tsc -p tsconfig.build.json --watch",
14
+ "test": "jest",
15
+ "test:unit": "jest",
16
+ "test:dev": "jest --watch"
17
+ },
18
+ "main": "dist/index.js",
19
+ "module": "src/index.ts",
20
+ "types": "dist/index.d.ts",
21
+ "files": [
22
+ "dist/**/*"
23
+ ],
24
+ "dependencies": {
25
+ "axios": "catalog:"
26
+ },
27
+ "devDependencies": {
28
+ "@atom8n/typescript-config": "1.3.0"
29
+ }
30
+ }