aws-delivlib 14.4.2 → 14.4.3
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/lib/publishing/github/node_modules/.yarn-integrity +42 -36
- package/lib/publishing/github/node_modules/@octokit/app/dist-node/index.js +146 -106
- package/lib/publishing/github/node_modules/@octokit/app/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/each-installation.js +34 -23
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/each-repository.js +46 -38
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/get-installation-octokit.js +16 -13
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/index.js +76 -63
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/middleware/node/index.js +48 -41
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/middleware/node/on-unhandled-request-default.js +12 -7
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/webhooks.js +44 -51
- package/lib/publishing/github/node_modules/@octokit/app/dist-types/each-installation.d.ts +6 -3
- package/lib/publishing/github/node_modules/@octokit/app/dist-types/each-repository.d.ts +1 -0
- package/lib/publishing/github/node_modules/@octokit/app/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/app/dist-web/index.js +306 -0
- package/lib/publishing/github/node_modules/@octokit/app/dist-web/index.js.map +7 -0
- package/lib/publishing/github/node_modules/@octokit/app/package.json +22 -21
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-node/index.js +239 -180
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/auth.js +27 -24
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/cache.js +73 -66
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/get-app-authentication.js +28 -21
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/get-installation-authentication.js +96 -74
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/hook.js +79 -75
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/index.js +51 -39
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/requires-app-auth.js +30 -47
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/to-token-authentication.js +29 -11
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/auth.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/cache.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/get-app-authentication.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/get-installation-authentication.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/hook.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/index.d.ts +2 -2
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/to-token-authentication.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/types.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-web/index.js +405 -360
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/package.json +24 -25
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-node/index.js +15 -17
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-types/types.d.ts +17 -17
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-web/index.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/dist-web/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-app/package.json +3 -3
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-node/index.js +23 -31
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-types/types.d.ts +12 -12
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-web/index.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/dist-web/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-device/package.json +5 -5
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/README.md +23 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-node/index.js +40 -39
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-src/auth.js +8 -0
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-src/get-authentication.js +3 -0
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-src/index.js +2 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-types/hook.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-types/types.d.ts +38 -34
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-web/index.js +14 -2
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-web/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/package.json +5 -5
- package/lib/publishing/github/node_modules/@octokit/auth-token/README.md +5 -10
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-node/index.js +44 -20
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-src/auth.js +13 -17
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-src/hook.js +10 -4
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-src/index.js +16 -11
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js +8 -10
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-types/auth.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-types/hook.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-types/index.d.ts +2 -2
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-types/types.d.ts +13 -13
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-web/index.js +42 -45
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/auth-token/package.json +23 -27
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-node/index.js +47 -22
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-src/auth.js +8 -5
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-src/hook.js +33 -24
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-src/index.js +12 -7
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-src/is-abuse-limit-error.js +8 -5
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-src/is-rate-limit-error.js +11 -9
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-types/index.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-types/types.d.ts +9 -9
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-web/index.js +62 -50
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/package.json +22 -23
- package/lib/publishing/github/node_modules/@octokit/core/README.md +4 -4
- package/lib/publishing/github/node_modules/@octokit/core/dist-node/index.js +119 -100
- package/lib/publishing/github/node_modules/@octokit/core/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/core/dist-src/index.js +114 -112
- package/lib/publishing/github/node_modules/@octokit/core/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/core/dist-types/types.d.ts +7 -7
- package/lib/publishing/github/node_modules/@octokit/core/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/core/dist-web/index.js +124 -122
- package/lib/publishing/github/node_modules/@octokit/core/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/core/package.json +26 -27
- package/lib/publishing/github/node_modules/@octokit/endpoint/README.md +3 -3
- package/lib/publishing/github/node_modules/@octokit/endpoint/dist-node/index.js +22 -62
- package/lib/publishing/github/node_modules/@octokit/endpoint/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/endpoint/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/endpoint/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/endpoint/dist-web/index.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/endpoint/dist-web/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/endpoint/package.json +4 -4
- package/lib/publishing/github/node_modules/@octokit/graphql/README.md +1 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-node/index.js +81 -39
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-src/error.js +17 -17
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-src/graphql.js +55 -44
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-src/index.js +17 -12
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-src/with-defaults.js +12 -9
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-types/error.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-types/graphql.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-types/index.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-types/types.d.ts +7 -7
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-types/with-defaults.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-web/index.js +103 -90
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/package.json +23 -24
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-node/index.js +290 -263
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/add-event-handler.js +13 -10
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/emit-event.js +13 -10
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/index.js +108 -64
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/check-token.js +14 -11
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/create-token.js +27 -24
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/delete-authorization.js +43 -40
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/delete-token.js +32 -29
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/get-oauth-client-code.js +5 -2
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/get-user-octokit.js +29 -24
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/get-web-flow-authorization-url.js +16 -28
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/refresh-token.js +34 -29
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/reset-token.js +58 -55
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/methods/scope-token.js +34 -29
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/aws-lambda/api-gateway-v2-parse-request.js +14 -11
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/aws-lambda/api-gateway-v2-send-response.js +9 -6
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/aws-lambda/api-gateway-v2.js +21 -13
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/handle-request.js +217 -210
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/node/index.js +30 -20
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/node/parse-request.js +13 -13
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/node/send-response.js +6 -3
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/on-unhandled-request-default.js +11 -8
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/web-worker/index.js +31 -19
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/web-worker/parse-request.js +11 -9
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/web-worker/send-response.js +8 -5
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/oauth-app-octokit.js +5 -2
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-types/middleware/web-worker/index.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-app/package.json +20 -20
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-node/index.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/check-token.d.ts +4 -4
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/create-device-code.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/delete-authorization.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/delete-token.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/exchange-device-code.d.ts +11 -11
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/exchange-web-flow-code.d.ts +4 -4
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/get-web-flow-authorization-url.d.ts +4 -4
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/refresh-token.d.ts +2 -2
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/reset-token.d.ts +4 -4
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/scope-token.d.ts +8 -8
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/types.d.ts +9 -9
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-methods/package.json +7 -7
- package/lib/publishing/github/node_modules/@octokit/openapi-types/package.json +2 -2
- package/lib/publishing/github/node_modules/@octokit/openapi-types/types.d.ts +77450 -13127
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js +292 -57
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/compose-paginate.js +5 -2
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/generated/paginating-endpoints.js +226 -213
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/index.js +17 -12
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/iterator.js +36 -37
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/normalize-paginated-list-response.js +29 -45
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/paginate.js +31 -21
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/paginating-endpoints.js +14 -9
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/compose-paginate.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts +183 -111
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/index.d.ts +3 -4
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/iterator.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/normalize-paginated-list-response.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/paginate.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/types.d.ts +29 -29
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-web/index.js +334 -334
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/package.json +24 -26
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js +99 -39
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js +197 -77
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types.d.ts +1419 -661
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts +359 -119
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/types.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-web/index.js +198 -78
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-web/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-rest-endpoint-methods/package.json +9 -9
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-node/index.js +80 -35
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-src/error-request.js +12 -13
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-src/index.js +29 -22
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-src/wrap-request.js +31 -15
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-types/error-request.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-types/wrap-request.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-web/index.js +68 -54
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-retry/package.json +21 -22
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-node/index.js +18 -11
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-src/index.js +21 -14
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-src/version.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-types/index.d.ts +6 -0
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-types/types.d.ts +13 -12
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-web/index.js +22 -15
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/dist-web/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-throttling/package.json +7 -7
- package/lib/publishing/github/node_modules/@octokit/request/README.md +3 -3
- package/lib/publishing/github/node_modules/@octokit/request/dist-node/index.js +105 -77
- package/lib/publishing/github/node_modules/@octokit/request/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/request/dist-src/fetch-wrapper.js +111 -108
- package/lib/publishing/github/node_modules/@octokit/request/dist-src/get-buffer-response.js +5 -2
- package/lib/publishing/github/node_modules/@octokit/request/dist-src/index.js +7 -4
- package/lib/publishing/github/node_modules/@octokit/request/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/request/dist-src/with-defaults.js +23 -18
- package/lib/publishing/github/node_modules/@octokit/request/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/request/dist-web/index.js +148 -138
- package/lib/publishing/github/node_modules/@octokit/request/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/request/package.json +23 -24
- package/lib/publishing/github/node_modules/@octokit/request-error/dist-node/index.js +10 -19
- package/lib/publishing/github/node_modules/@octokit/request-error/dist-node/index.js.map +1 -1
- package/lib/publishing/github/node_modules/@octokit/request-error/dist-types/types.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/request-error/package.json +4 -4
- package/lib/publishing/github/node_modules/@octokit/tsconfig/LICENSE +7 -0
- package/lib/publishing/github/node_modules/@octokit/tsconfig/README.md +31 -0
- package/lib/publishing/github/node_modules/@octokit/tsconfig/package.json +28 -0
- package/lib/publishing/github/node_modules/@octokit/types/dist-node/index.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-src/VERSION.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/EndpointDefaults.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/EndpointOptions.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/Fetch.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/GetResponseTypeFromEndpointMethod.d.ts +4 -4
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/OctokitResponse.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/RequestError.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/RequestHeaders.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/RequestMethod.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/RequestOptions.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/RequestParameters.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/RequestRequestOptions.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/ResponseHeaders.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/Route.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/Signal.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/Url.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/VERSION.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/dist-types/generated/Endpoints.d.ts +464 -332
- package/lib/publishing/github/node_modules/@octokit/types/dist-web/index.js +1 -1
- package/lib/publishing/github/node_modules/@octokit/types/package.json +10 -10
- package/lib/publishing/github/node_modules/@octokit/webhooks/README.md +68 -64
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-node/index.js +467 -97
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/createLogger.js +11 -6
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/event-handler/index.js +23 -16
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/event-handler/on.js +31 -22
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/event-handler/receive.js +51 -49
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/event-handler/remove-listener.js +18 -15
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/event-handler/wrap-error-handler.js +17 -18
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/generated/webhook-names.js +262 -254
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/index.js +40 -22
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/middleware/node/get-missing-headers.js +8 -6
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/middleware/node/get-payload.js +27 -22
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/middleware/node/index.js +19 -6
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/middleware/node/middleware.js +86 -72
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/middleware/node/on-unhandled-request-default.js +12 -7
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/sign.js +8 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/to-normalized-json-string.js +8 -8
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/verify-and-receive.js +22 -16
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/verify.js +9 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/event-handler/on.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/event-handler/remove-listener.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/generated/webhook-names.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/index.d.ts +14 -4
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/middleware/node/get-missing-headers.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/middleware/node/get-payload.d.ts +3 -3
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/middleware/node/index.d.ts +2 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/middleware/node/middleware.d.ts +4 -4
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/middleware/node/on-unhandled-request-default.d.ts +2 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/middleware/node/types.d.ts +5 -4
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/to-normalized-json-string.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/types.d.ts +12 -11
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-types/verify-and-receive.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-web/index.js +609 -533
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/package.json +20 -22
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/README.md +84 -3
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-node/index.js +89 -48
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/index.js +22 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/node/sign.js +19 -16
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/node/verify.js +18 -14
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/types.js +8 -5
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/utils.js +5 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-src/web.js +62 -44
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-types/index.d.ts +3 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-types/node/sign.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-types/types.d.ts +2 -2
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-types/web.d.ts +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-web/index.js +71 -53
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-methods/package.json +36 -25
- package/lib/publishing/github/node_modules/@octokit/webhooks-types/package.json +1 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks-types/schema.d.ts +670 -35
- package/lib/publishing/github/node_modules/@types/aws-lambda/README.md +2 -2
- package/lib/publishing/github/node_modules/@types/aws-lambda/index.d.ts +3 -2
- package/lib/publishing/github/node_modules/@types/aws-lambda/package.json +3 -8
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/amplify-resolver.d.ts +38 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts +75 -1
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/appsync-resolver.d.ts +4 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/codecommit.d.ts +36 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-message.d.ts +8 -4
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-sms-sender.d.ts +49 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/dynamodb-stream.d.ts +11 -1
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/kinesis-stream.d.ts +26 -1
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/msk.d.ts +7 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/self-managed-kafka.d.ts +27 -0
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/sns.d.ts +2 -2
- package/lib/publishing/github/node_modules/@types/aws-lambda/trigger/sqs.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/README.md +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/index.d.ts +14 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/README.md +2 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/assert.d.ts +135 -75
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/async_hooks.d.ts +67 -38
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/buffer.d.ts +220 -101
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/child_process.d.ts +87 -58
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/cluster.d.ts +25 -29
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/console.d.ts +5 -5
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/crypto.d.ts +873 -249
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dgram.d.ts +16 -16
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dns/promises.d.ts +52 -8
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dns.d.ts +27 -18
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dom-events.d.ts +126 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/domain.d.ts +6 -5
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/events.d.ts +166 -93
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/fs/promises.d.ts +149 -74
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/fs.d.ts +288 -121
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/globals.d.ts +22 -13
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/http.d.ts +453 -125
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/http2.d.ts +74 -46
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/https.d.ts +103 -53
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/index.d.ts +6 -2
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/inspector.d.ts +20 -16
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/module.d.ts +6 -4
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/net.d.ts +106 -16
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/os.d.ts +36 -14
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/package.json +15 -3
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/path.d.ts +37 -26
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/perf_hooks.d.ts +96 -15
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/process.d.ts +53 -50
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/punycode.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/querystring.d.ts +6 -6
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/readline/promises.d.ts +145 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/readline.d.ts +51 -175
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/repl.d.ts +21 -21
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/stream/consumers.d.ts +2 -14
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/stream.d.ts +983 -824
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/string_decoder.d.ts +6 -6
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/test.d.ts +1052 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/timers/promises.d.ts +26 -1
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/timers.d.ts +125 -4
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/tls.d.ts +149 -50
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/trace_events.d.ts +30 -9
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/buffer.d.ts +2351 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/crypto.d.ts +3961 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/events.d.ts +724 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/fs.d.ts +4043 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/https.d.ts +441 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/module.d.ts +116 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/net.d.ts +886 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/os.d.ts +477 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/process.d.ts +1485 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/tty.d.ts +205 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/url.d.ts +901 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/tty.d.ts +7 -6
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/url.d.ts +66 -56
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/util.d.ts +528 -70
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/v8.d.ts +271 -14
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/vm.d.ts +421 -34
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/wasi.d.ts +13 -19
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/worker_threads.d.ts +81 -37
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/zlib.d.ts +11 -11
- package/lib/publishing/github/node_modules/@types/jsonwebtoken/package.json +3 -3
- package/lib/publishing/github/node_modules/@types/node/README.md +1 -1
- package/lib/publishing/github/node_modules/@types/node/child_process.d.ts +41 -2
- package/lib/publishing/github/node_modules/@types/node/crypto.d.ts +77 -7
- package/lib/publishing/github/node_modules/@types/node/fs/promises.d.ts +15 -12
- package/lib/publishing/github/node_modules/@types/node/globals.d.ts +5 -3
- package/lib/publishing/github/node_modules/@types/node/http.d.ts +142 -53
- package/lib/publishing/github/node_modules/@types/node/http2.d.ts +1 -2
- package/lib/publishing/github/node_modules/@types/node/https.d.ts +192 -62
- package/lib/publishing/github/node_modules/@types/node/index.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/node/inspector.d.ts +1 -1
- package/lib/publishing/github/node_modules/@types/node/net.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/node/os.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/node/package.json +10 -3
- package/lib/publishing/github/node_modules/@types/node/path.d.ts +32 -21
- package/lib/publishing/github/node_modules/@types/node/stream.d.ts +99 -0
- package/lib/publishing/github/node_modules/@types/node/tls.d.ts +13 -13
- package/lib/publishing/github/node_modules/@types/node/ts4.8/assert.d.ts +128 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/async_hooks.d.ts +229 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/buffer.d.ts +89 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/child_process.d.ts +553 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/cluster.d.ts +265 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/console.d.ts +142 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/crypto.d.ts +1283 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/dgram.d.ts +144 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/dns.d.ts +387 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/domain.d.ts +27 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/events.d.ts +82 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/fs/promises.d.ts +572 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/fs.d.ts +2281 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/globals.d.ts +746 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/http.d.ts +580 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/http2.d.ts +961 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/https.d.ts +272 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/index.d.ts +53 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/inspector.d.ts +3051 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/module.d.ts +56 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/net.d.ts +309 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/os.d.ts +243 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/path.d.ts +168 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/perf_hooks.d.ts +274 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/process.d.ts +413 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/punycode.d.ts +78 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/querystring.d.ts +31 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/readline.d.ts +174 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/repl.d.ts +398 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/stream.d.ts +458 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/string_decoder.d.ts +10 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/timers.d.ts +19 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/tls.d.ts +784 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/trace_events.d.ts +64 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/tty.d.ts +69 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/url.d.ts +177 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/util.d.ts +216 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/v8.d.ts +190 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/vm.d.ts +155 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/wasi.d.ts +89 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/worker_threads.d.ts +241 -0
- package/lib/publishing/github/node_modules/@types/node/ts4.8/zlib.d.ts +364 -0
- package/lib/publishing/github/node_modules/@types/node/url.d.ts +28 -0
- package/lib/publishing/github/node_modules/before-after-hook/README.md +1 -3
- package/lib/publishing/github/node_modules/before-after-hook/index.d.ts +48 -48
- package/lib/publishing/github/node_modules/before-after-hook/index.js +43 -39
- package/lib/publishing/github/node_modules/before-after-hook/package.json +15 -10
- package/lib/publishing/github/node_modules/lru-cache/LICENSE +1 -1
- package/lib/publishing/github/node_modules/lru-cache/README.md +1127 -104
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/index.d.ts +834 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/index.d.ts.map +1 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/index.js +1395 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/index.js.map +1 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/index.min.js +2 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/index.min.js.map +7 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/cjs/package.json +3 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/index.d.ts +834 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/index.d.ts.map +1 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/index.js +1391 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/index.js.map +1 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/index.min.js +2 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/index.min.js.map +7 -0
- package/lib/publishing/github/node_modules/lru-cache/dist/mjs/package.json +3 -0
- package/lib/publishing/github/node_modules/lru-cache/package.json +86 -12
- package/lib/publishing/github/node_modules/node-fetch/README.md +43 -0
- package/lib/publishing/github/node_modules/node-fetch/browser.js +7 -7
- package/lib/publishing/github/node_modules/node-fetch/lib/index.es.js +92 -2
- package/lib/publishing/github/node_modules/node-fetch/lib/index.js +92 -2
- package/lib/publishing/github/node_modules/node-fetch/lib/index.mjs +92 -2
- package/lib/publishing/github/node_modules/node-fetch/package.json +16 -3
- package/lib/publishing/github/node_modules/octokit/README.md +4 -4
- package/lib/publishing/github/node_modules/octokit/dist-node/index.js +60 -33
- package/lib/publishing/github/node_modules/octokit/dist-node/index.js.map +7 -1
- package/lib/publishing/github/node_modules/octokit/dist-src/app.js +8 -3
- package/lib/publishing/github/node_modules/octokit/dist-src/index.js +8 -2
- package/lib/publishing/github/node_modules/octokit/dist-src/octokit.js +28 -20
- package/lib/publishing/github/node_modules/octokit/dist-src/version.js +4 -1
- package/lib/publishing/github/node_modules/octokit/dist-types/app.d.ts +2 -2
- package/lib/publishing/github/node_modules/octokit/dist-types/octokit.d.ts +1 -1
- package/lib/publishing/github/node_modules/octokit/dist-types/version.d.ts +1 -1
- package/lib/publishing/github/node_modules/octokit/dist-web/index.js +46 -34
- package/lib/publishing/github/node_modules/octokit/dist-web/index.js.map +7 -1
- package/lib/publishing/github/node_modules/octokit/package.json +26 -28
- package/lib/publishing/github/node_modules/semver/README.md +67 -0
- package/lib/publishing/github/node_modules/semver/bin/semver.js +16 -2
- package/lib/publishing/github/node_modules/semver/classes/comparator.js +37 -33
- package/lib/publishing/github/node_modules/semver/classes/range.js +6 -2
- package/lib/publishing/github/node_modules/semver/classes/semver.js +27 -14
- package/lib/publishing/github/node_modules/semver/functions/diff.js +48 -17
- package/lib/publishing/github/node_modules/semver/functions/inc.js +3 -2
- package/lib/publishing/github/node_modules/semver/functions/parse.js +5 -22
- package/lib/publishing/github/node_modules/semver/index.js +1 -0
- package/lib/publishing/github/node_modules/semver/internal/constants.js +15 -2
- package/lib/publishing/github/node_modules/semver/internal/parse-options.js +14 -10
- package/lib/publishing/github/node_modules/semver/node_modules/lru-cache/LICENSE +15 -0
- package/lib/publishing/github/node_modules/semver/node_modules/lru-cache/README.md +166 -0
- package/lib/publishing/github/node_modules/semver/node_modules/lru-cache/package.json +34 -0
- package/lib/publishing/github/node_modules/semver/package.json +7 -6
- package/lib/publishing/github/node_modules/semver/ranges/intersects.js +1 -1
- package/lib/publishing/github/node_modules/semver/ranges/subset.js +6 -3
- package/lib/publishing/github/node_modules/typescript/lib/tsc.js +8 -3
- package/lib/publishing/github/node_modules/typescript/lib/tsserver.js +13 -3
- package/lib/publishing/github/node_modules/typescript/lib/tsserverlibrary.js +13 -3
- package/lib/publishing/github/node_modules/typescript/lib/typescript.js +13 -3
- package/lib/publishing/github/node_modules/typescript/lib/typescriptServices.js +13 -3
- package/lib/publishing/github/node_modules/typescript/lib/typingsInstaller.js +13 -3
- package/lib/publishing/github/node_modules/typescript/package.json +1 -1
- package/lib/publishing/github/package-lock.json +675 -0
- package/lib/publishing/github/package.json +1 -1
- package/lib/publishing/github/publish.sh +3 -1
- package/package.json +1 -1
- package/lib/publishing/github/node_modules/@octokit/app/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/auth-app/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/auth-token/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/auth-unauthenticated/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/core/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/graphql/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/middleware/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/oauth-app/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/plugin-paginate-rest/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/middleware/node/types.js +0 -1
- package/lib/publishing/github/node_modules/@octokit/webhooks/dist-src/types.js +0 -1
- package/lib/publishing/github/node_modules/@types/lru-cache/LICENSE +0 -21
- package/lib/publishing/github/node_modules/@types/lru-cache/README.md +0 -16
- package/lib/publishing/github/node_modules/@types/lru-cache/index.d.ts +0 -193
- package/lib/publishing/github/node_modules/@types/lru-cache/package.json +0 -30
- package/lib/publishing/github/yarn.lock +0 -473
- /package/lib/publishing/github/node_modules/{lru-cache → semver/node_modules/lru-cache}/index.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/get-authentication.js","../dist-src/auth.js","../dist-src/requires-basic-auth.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"2.0.4\";\n","// @ts-nocheck there is only place for one of us in this file. And it's not you, TS\nimport { createOAuthDeviceAuth } from \"@octokit/auth-oauth-device\";\nimport { exchangeWebFlowCode } from \"@octokit/oauth-methods\";\nexport async function getAuthentication(state) {\n // handle code exchange form OAuth Web Flow\n if (\"code\" in state.strategyOptions) {\n const { authentication } = await exchangeWebFlowCode({\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n ...state.strategyOptions,\n request: state.request,\n });\n return {\n type: \"token\",\n tokenType: \"oauth\",\n ...authentication,\n };\n }\n // handle OAuth device flow\n if (\"onVerification\" in state.strategyOptions) {\n const deviceAuth = createOAuthDeviceAuth({\n clientType: state.clientType,\n clientId: state.clientId,\n ...state.strategyOptions,\n request: state.request,\n });\n const authentication = await deviceAuth({\n type: \"oauth\",\n });\n return {\n clientSecret: state.clientSecret,\n ...authentication,\n };\n }\n // use existing authentication\n if (\"token\" in state.strategyOptions) {\n return {\n type: \"token\",\n tokenType: \"oauth\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n ...state.strategyOptions,\n };\n }\n throw new Error(\"[@octokit/auth-oauth-user] Invalid strategy options\");\n}\n","import { getAuthentication } from \"./get-authentication\";\nimport { checkToken, deleteAuthorization, deleteToken, refreshToken, resetToken, } from \"@octokit/oauth-methods\";\nexport async function auth(state, options = {}) {\n if (!state.authentication) {\n // This is what TS makes us do ¯\\_(ツ)_/¯\n state.authentication =\n state.clientType === \"oauth-app\"\n ? await getAuthentication(state)\n : await getAuthentication(state);\n }\n if (state.authentication.invalid) {\n throw new Error(\"[@octokit/auth-oauth-user] Token is invalid\");\n }\n const currentAuthentication = state.authentication;\n // (auto) refresh for user-to-server tokens\n if (\"expiresAt\" in currentAuthentication) {\n if (options.type === \"refresh\" ||\n new Date(currentAuthentication.expiresAt) < new Date()) {\n const { authentication } = await refreshToken({\n clientType: \"github-app\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n refreshToken: currentAuthentication.refreshToken,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n ...authentication,\n };\n }\n }\n // throw error for invalid refresh call\n if (options.type === \"refresh\") {\n if (state.clientType === \"oauth-app\") {\n throw new Error(\"[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens\");\n }\n if (!currentAuthentication.hasOwnProperty(\"expiresAt\")) {\n throw new Error(\"[@octokit/auth-oauth-user] Refresh token missing\");\n }\n }\n // check or reset token\n if (options.type === \"check\" || options.type === \"reset\") {\n const method = options.type === \"check\" ? checkToken : resetToken;\n try {\n const { authentication } = await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n // @ts-expect-error TBD\n ...authentication,\n };\n return state.authentication;\n }\n catch (error) {\n // istanbul ignore else\n if (error.status === 404) {\n error.message = \"[@octokit/auth-oauth-user] Token is invalid\";\n // @ts-expect-error TBD\n state.authentication.invalid = true;\n }\n throw error;\n }\n }\n // invalidate\n if (options.type === \"delete\" || options.type === \"deleteAuthorization\") {\n const method = options.type === \"delete\" ? deleteToken : deleteAuthorization;\n try {\n await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n }\n catch (error) {\n // istanbul ignore if\n if (error.status !== 404)\n throw error;\n }\n state.authentication.invalid = true;\n return state.authentication;\n }\n return state.authentication;\n}\n","/**\n * The following endpoints require an OAuth App to authenticate using its client_id and client_secret.\n *\n * - [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) - Check a token\n * - [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) - Reset a token\n * - [`POST /applications/{client_id}/token/scoped`](https://docs.github.com/en/rest/reference/apps#create-a-scoped-access-token) - Create a scoped access token\n * - [`DELETE /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#delete-an-app-token) - Delete an app token\n * - [`DELETE /applications/{client_id}/grant`](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization) - Delete an app authorization\n *\n * deprecated:\n *\n * - [`GET /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#check-an-authorization) - Check an authorization\n * - [`POST /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#reset-an-authorization) - Reset an authorization\n * - [`DELETE /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-an-authorization-for-an-application) - Revoke an authorization for an application\n * - [`DELETE /applications/{client_id}/grants/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-a-grant-for-an-application) - Revoke a grant for an application\n */\nconst ROUTES_REQUIRING_BASIC_AUTH = /\\/applications\\/[^/]+\\/(token|grant)s?/;\nexport function requiresBasicAuth(url) {\n return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);\n}\n","import btoa from \"btoa-lite\";\nimport { auth } from \"./auth\";\nimport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport async function hook(state, request, route, parameters = {}) {\n const endpoint = request.endpoint.merge(route, parameters);\n // Do not intercept OAuth Web/Device flow request\n if (/\\/login\\/(oauth\\/access_token|device\\/code)$/.test(endpoint.url)) {\n return request(endpoint);\n }\n if (requiresBasicAuth(endpoint.url)) {\n const credentials = btoa(`${state.clientId}:${state.clientSecret}`);\n endpoint.headers.authorization = `basic ${credentials}`;\n return request(endpoint);\n }\n // TS makes us do this ¯\\_(ツ)_/¯\n const { token } = state.clientType === \"oauth-app\"\n ? await auth({ ...state, request })\n : await auth({ ...state, request });\n endpoint.headers.authorization = \"token \" + token;\n return request(endpoint);\n}\n","import { getUserAgent } from \"universal-user-agent\";\nimport { request as octokitRequest } from \"@octokit/request\";\nimport { VERSION } from \"./version\";\nimport { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport function createOAuthUserAuth({ clientId, clientSecret, clientType = \"oauth-app\", request = octokitRequest.defaults({\n headers: {\n \"user-agent\": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`,\n },\n}), ...strategyOptions }) {\n const state = Object.assign({\n clientType,\n clientId,\n clientSecret,\n strategyOptions,\n request,\n });\n // @ts-expect-error not worth the extra code needed to appease TS\n return Object.assign(auth.bind(null, state), {\n // @ts-expect-error not worth the extra code needed to appease TS\n hook: hook.bind(null, state),\n });\n}\ncreateOAuthUserAuth.VERSION = VERSION;\n"],"names":["VERSION","getAuthentication","state","strategyOptions","authentication","exchangeWebFlowCode","clientId","clientSecret","clientType","request","type","tokenType","deviceAuth","createOAuthDeviceAuth","Error","auth","options","invalid","currentAuthentication","Date","expiresAt","refreshToken","hasOwnProperty","method","checkToken","resetToken","token","error","status","message","deleteToken","deleteAuthorization","ROUTES_REQUIRING_BASIC_AUTH","requiresBasicAuth","url","test","hook","route","parameters","endpoint","merge","credentials","btoa","headers","authorization","createOAuthUserAuth","octokitRequest","defaults","getUserAgent","Object","assign","bind"],"mappings":";;;;;;;;;;;;AAAO,MAAMA,OAAO,GAAG,mBAAhB;;ACAP;AACA,AAEO,eAAeC,iBAAf,CAAiCC,KAAjC,EAAwC;;EAE3C,IAAI,UAAUA,KAAK,CAACC,eAApB,EAAqC;IACjC,MAAM;MAAEC;QAAmB,MAAMC,gCAAmB,CAAC;MACjDC,QAAQ,EAAEJ,KAAK,CAACI,QADiC;MAEjDC,YAAY,EAAEL,KAAK,CAACK,YAF6B;MAGjDC,UAAU,EAAEN,KAAK,CAACM,UAH+B;MAIjD,GAAGN,KAAK,CAACC,eAJwC;MAKjDM,OAAO,EAAEP,KAAK,CAACO;KALiC,CAApD;IAOA,OAAO;MACHC,IAAI,EAAE,OADH;MAEHC,SAAS,EAAE,OAFR;MAGH,GAAGP;KAHP;GAVuC;;;EAiB3C,IAAI,oBAAoBF,KAAK,CAACC,eAA9B,EAA+C;IAC3C,MAAMS,UAAU,GAAGC,qCAAqB,CAAC;MACrCL,UAAU,EAAEN,KAAK,CAACM,UADmB;MAErCF,QAAQ,EAAEJ,KAAK,CAACI,QAFqB;MAGrC,GAAGJ,KAAK,CAACC,eAH4B;MAIrCM,OAAO,EAAEP,KAAK,CAACO;KAJqB,CAAxC;IAMA,MAAML,cAAc,GAAG,MAAMQ,UAAU,CA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,CAAC7C,OAApB,GAA8BA,OAA9B;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/get-authentication.js","../dist-src/auth.js","../dist-src/requires-basic-auth.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"2.1.1\";\n","// @ts-nocheck there is only place for one of us in this file. And it's not you, TS\nimport { createOAuthDeviceAuth } from \"@octokit/auth-oauth-device\";\nimport { exchangeWebFlowCode } from \"@octokit/oauth-methods\";\nexport async function getAuthentication(state) {\n // handle code exchange form OAuth Web Flow\n if (\"code\" in state.strategyOptions) {\n const { authentication } = await exchangeWebFlowCode({\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n onTokenCreated: state.onTokenCreated,\n ...state.strategyOptions,\n request: state.request,\n });\n return {\n type: \"token\",\n tokenType: \"oauth\",\n ...authentication,\n };\n }\n // handle OAuth device flow\n if (\"onVerification\" in state.strategyOptions) {\n const deviceAuth = createOAuthDeviceAuth({\n clientType: state.clientType,\n clientId: state.clientId,\n onTokenCreated: state.onTokenCreated,\n ...state.strategyOptions,\n request: state.request,\n });\n const authentication = await deviceAuth({\n type: \"oauth\",\n });\n return {\n clientSecret: state.clientSecret,\n ...authentication,\n };\n }\n // use existing authentication\n if (\"token\" in state.strategyOptions) {\n return {\n type: \"token\",\n tokenType: \"oauth\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n onTokenCreated: state.onTokenCreated,\n ...state.strategyOptions,\n };\n }\n throw new Error(\"[@octokit/auth-oauth-user] Invalid strategy options\");\n}\n","import { getAuthentication } from \"./get-authentication\";\nimport { checkToken, deleteAuthorization, deleteToken, refreshToken, resetToken, } from \"@octokit/oauth-methods\";\nexport async function auth(state, options = {}) {\n if (!state.authentication) {\n // This is what TS makes us do ¯\\_(ツ)_/¯\n state.authentication =\n state.clientType === \"oauth-app\"\n ? await getAuthentication(state)\n : await getAuthentication(state);\n }\n if (state.authentication.invalid) {\n throw new Error(\"[@octokit/auth-oauth-user] Token is invalid\");\n }\n const currentAuthentication = state.authentication;\n // (auto) refresh for user-to-server tokens\n if (\"expiresAt\" in currentAuthentication) {\n if (options.type === \"refresh\" ||\n new Date(currentAuthentication.expiresAt) < new Date()) {\n const { authentication } = await refreshToken({\n clientType: \"github-app\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n refreshToken: currentAuthentication.refreshToken,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n ...authentication,\n };\n }\n }\n // throw error for invalid refresh call\n if (options.type === \"refresh\") {\n if (state.clientType === \"oauth-app\") {\n throw new Error(\"[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens\");\n }\n if (!currentAuthentication.hasOwnProperty(\"expiresAt\")) {\n throw new Error(\"[@octokit/auth-oauth-user] Refresh token missing\");\n }\n await state.onTokenCreated?.(state.authentication, {\n type: options.type,\n });\n }\n // check or reset token\n if (options.type === \"check\" || options.type === \"reset\") {\n const method = options.type === \"check\" ? checkToken : resetToken;\n try {\n const { authentication } = await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n // @ts-expect-error TBD\n ...authentication,\n };\n if (options.type === \"reset\") {\n await state.onTokenCreated?.(state.authentication, {\n type: options.type,\n });\n }\n return state.authentication;\n }\n catch (error) {\n // istanbul ignore else\n if (error.status === 404) {\n error.message = \"[@octokit/auth-oauth-user] Token is invalid\";\n // @ts-expect-error TBD\n state.authentication.invalid = true;\n }\n throw error;\n }\n }\n // invalidate\n if (options.type === \"delete\" || options.type === \"deleteAuthorization\") {\n const method = options.type === \"delete\" ? deleteToken : deleteAuthorization;\n try {\n await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n }\n catch (error) {\n // istanbul ignore if\n if (error.status !== 404)\n throw error;\n }\n state.authentication.invalid = true;\n return state.authentication;\n }\n return state.authentication;\n}\n","/**\n * The following endpoints require an OAuth App to authenticate using its client_id and client_secret.\n *\n * - [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) - Check a token\n * - [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) - Reset a token\n * - [`POST /applications/{client_id}/token/scoped`](https://docs.github.com/en/rest/reference/apps#create-a-scoped-access-token) - Create a scoped access token\n * - [`DELETE /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#delete-an-app-token) - Delete an app token\n * - [`DELETE /applications/{client_id}/grant`](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization) - Delete an app authorization\n *\n * deprecated:\n *\n * - [`GET /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#check-an-authorization) - Check an authorization\n * - [`POST /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#reset-an-authorization) - Reset an authorization\n * - [`DELETE /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-an-authorization-for-an-application) - Revoke an authorization for an application\n * - [`DELETE /applications/{client_id}/grants/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-a-grant-for-an-application) - Revoke a grant for an application\n */\nconst ROUTES_REQUIRING_BASIC_AUTH = /\\/applications\\/[^/]+\\/(token|grant)s?/;\nexport function requiresBasicAuth(url) {\n return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);\n}\n","import btoa from \"btoa-lite\";\nimport { auth } from \"./auth\";\nimport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport async function hook(state, request, route, parameters = {}) {\n const endpoint = request.endpoint.merge(route, parameters);\n // Do not intercept OAuth Web/Device flow request\n if (/\\/login\\/(oauth\\/access_token|device\\/code)$/.test(endpoint.url)) {\n return request(endpoint);\n }\n if (requiresBasicAuth(endpoint.url)) {\n const credentials = btoa(`${state.clientId}:${state.clientSecret}`);\n endpoint.headers.authorization = `basic ${credentials}`;\n return request(endpoint);\n }\n // TS makes us do this ¯\\_(ツ)_/¯\n const { token } = state.clientType === \"oauth-app\"\n ? await auth({ ...state, request })\n : await auth({ ...state, request });\n endpoint.headers.authorization = \"token \" + token;\n return request(endpoint);\n}\n","import { getUserAgent } from \"universal-user-agent\";\nimport { request as octokitRequest } from \"@octokit/request\";\nimport { VERSION } from \"./version\";\nimport { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport function createOAuthUserAuth({ clientId, clientSecret, clientType = \"oauth-app\", request = octokitRequest.defaults({\n headers: {\n \"user-agent\": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`,\n },\n}), onTokenCreated, ...strategyOptions }) {\n const state = Object.assign({\n clientType,\n clientId,\n clientSecret,\n onTokenCreated,\n strategyOptions,\n request,\n });\n // @ts-expect-error not worth the extra code needed to appease TS\n return Object.assign(auth.bind(null, state), {\n // @ts-expect-error not worth the extra code needed to appease TS\n hook: hook.bind(null, state),\n });\n}\ncreateOAuthUserAuth.VERSION = VERSION;\n"],"names":["VERSION","getAuthentication","state","strategyOptions","authentication","exchangeWebFlowCode","clientId","clientSecret","clientType","onTokenCreated","request","type","tokenType","deviceAuth","createOAuthDeviceAuth","Error","auth","options","invalid","currentAuthentication","Date","expiresAt","refreshToken","hasOwnProperty","method","checkToken","resetToken","token","error","status","message","deleteToken","deleteAuthorization","ROUTES_REQUIRING_BASIC_AUTH","requiresBasicAuth","url","test","hook","route","parameters","endpoint","merge","credentials","btoa","headers","authorization","createOAuthUserAuth","octokitRequest","defaults","getUserAgent","Object","assign","bind"],"mappings":";;;;;;;;;;;;AAAO,MAAMA,OAAO,GAAG,mBAAmB;;ACA1C;AACA,AAEO,eAAeC,iBAAiB,CAACC,KAAK,EAAE;;EAE3C,IAAI,M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AOhC,OAAO,CAAC8B,QAAQ,CAAC;;;EAG5B,MAAM;IAAEb;GAAO,GAAGzB,KAAK,CAACM,UAAU,KAAK,WAAW,GAC5C,MAAMQ,IAAI,CAAC;IAAE,GAAGd,KAAK;IAAEQ;GAAS,CAAC,GACjC,MAAMM,IAAI,CAAC;IAAE,GAAGd,KAAK;IAAEQ;GAAS,CAAC;EACvC8B,QAAQ,CAACI,OAAO,CAACC,aAAa,GAAG,QAAQ,GAAGlB,KAAK;EACjD,OAAOjB,OAAO,CAAC8B,QAAQ,CAAC;AAC5B;;ACdO,SAASM,mBAAmB,CAAC;EAAExC,QAAQ;EAAEC,YAAY;EAAEC,UAAU,GAAG,WAAW;WAAEE,SAAO,GAAGqC,eAAc,CAACC,QAAQ,CAAC;IACtHJ,OAAO,EAAE;MACL,YAAY,EAAG,6BAA4B5C,OAAQ,IAAGiD,+BAAY,EAAG;;GAE5E,CAAC;EAAExC,cAAc;EAAE,GAAGN;AAAgB,CAAC,EAAE;EACtC,MAAMD,KAAK,GAAGgD,MAAM,CAACC,MAAM,CAAC;IACxB3C,UAAU;IACVF,QAAQ;IACRC,YAAY;IACZE,cAAc;IACdN,eAAe;aACfO;GACH,CAAC;;EAEF,OAAOwC,MAAM,CAACC,MAAM,CAACnC,IAAI,CAACoC,IAAI,CAAC,IAAI,EAAElD,KAAK,CAAC,EAAE;;IAEzCmC,IAAI,EAAEA,IAAI,CAACe,IAAI,CAAC,IAAI,EAAElD,KAAK;GAC9B,CAAC;AACN;AACA4C,mBAAmB,CAAC9C,OAAO,GAAGA,OAAO;;;;;"}
|
|
@@ -38,6 +38,9 @@ export async function auth(state, options = {}) {
|
|
|
38
38
|
if (!currentAuthentication.hasOwnProperty("expiresAt")) {
|
|
39
39
|
throw new Error("[@octokit/auth-oauth-user] Refresh token missing");
|
|
40
40
|
}
|
|
41
|
+
await state.onTokenCreated?.(state.authentication, {
|
|
42
|
+
type: options.type,
|
|
43
|
+
});
|
|
41
44
|
}
|
|
42
45
|
// check or reset token
|
|
43
46
|
if (options.type === "check" || options.type === "reset") {
|
|
@@ -57,6 +60,11 @@ export async function auth(state, options = {}) {
|
|
|
57
60
|
// @ts-expect-error TBD
|
|
58
61
|
...authentication,
|
|
59
62
|
};
|
|
63
|
+
if (options.type === "reset") {
|
|
64
|
+
await state.onTokenCreated?.(state.authentication, {
|
|
65
|
+
type: options.type,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
60
68
|
return state.authentication;
|
|
61
69
|
}
|
|
62
70
|
catch (error) {
|
package/lib/publishing/github/node_modules/@octokit/auth-oauth-user/dist-src/get-authentication.js
CHANGED
|
@@ -8,6 +8,7 @@ export async function getAuthentication(state) {
|
|
|
8
8
|
clientId: state.clientId,
|
|
9
9
|
clientSecret: state.clientSecret,
|
|
10
10
|
clientType: state.clientType,
|
|
11
|
+
onTokenCreated: state.onTokenCreated,
|
|
11
12
|
...state.strategyOptions,
|
|
12
13
|
request: state.request,
|
|
13
14
|
});
|
|
@@ -22,6 +23,7 @@ export async function getAuthentication(state) {
|
|
|
22
23
|
const deviceAuth = createOAuthDeviceAuth({
|
|
23
24
|
clientType: state.clientType,
|
|
24
25
|
clientId: state.clientId,
|
|
26
|
+
onTokenCreated: state.onTokenCreated,
|
|
25
27
|
...state.strategyOptions,
|
|
26
28
|
request: state.request,
|
|
27
29
|
});
|
|
@@ -41,6 +43,7 @@ export async function getAuthentication(state) {
|
|
|
41
43
|
clientId: state.clientId,
|
|
42
44
|
clientSecret: state.clientSecret,
|
|
43
45
|
clientType: state.clientType,
|
|
46
|
+
onTokenCreated: state.onTokenCreated,
|
|
44
47
|
...state.strategyOptions,
|
|
45
48
|
};
|
|
46
49
|
}
|
|
@@ -8,11 +8,12 @@ export function createOAuthUserAuth({ clientId, clientSecret, clientType = "oaut
|
|
|
8
8
|
headers: {
|
|
9
9
|
"user-agent": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`,
|
|
10
10
|
},
|
|
11
|
-
}), ...strategyOptions }) {
|
|
11
|
+
}), onTokenCreated, ...strategyOptions }) {
|
|
12
12
|
const state = Object.assign({
|
|
13
13
|
clientType,
|
|
14
14
|
clientId,
|
|
15
15
|
clientSecret,
|
|
16
|
+
onTokenCreated,
|
|
16
17
|
strategyOptions,
|
|
17
18
|
request,
|
|
18
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.
|
|
1
|
+
export const VERSION = "2.1.1";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EndpointOptions, OctokitResponse, RequestInterface, RequestParameters, Route } from "@octokit/types";
|
|
2
2
|
import { OAuthAppState, GitHubAppState } from "./types";
|
|
3
|
-
|
|
3
|
+
type AnyResponse = OctokitResponse<any>;
|
|
4
4
|
export declare function hook(state: OAuthAppState, request: RequestInterface, route: Route | EndpointOptions, parameters: RequestParameters): Promise<AnyResponse>;
|
|
5
5
|
export declare function hook(state: GitHubAppState, request: RequestInterface, route: Route | EndpointOptions, parameters: RequestParameters): Promise<AnyResponse>;
|
|
6
6
|
export {};
|
|
@@ -1,63 +1,64 @@
|
|
|
1
1
|
import * as OctokitTypes from "@octokit/types";
|
|
2
2
|
import * as DeviceTypes from "@octokit/auth-oauth-device";
|
|
3
3
|
import * as OAuthMethodsTypes from "@octokit/oauth-methods";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type ClientType = "oauth-app" | "github-app";
|
|
5
|
+
export type WebFlowOptions = {
|
|
6
6
|
code: string;
|
|
7
7
|
state?: string;
|
|
8
8
|
redirectUrl?: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
clientType?:
|
|
10
|
+
type CommonAppStrategyOptions = {
|
|
11
|
+
clientType?: ClientType;
|
|
12
12
|
clientId: string;
|
|
13
13
|
clientSecret: string;
|
|
14
14
|
request?: OctokitTypes.RequestInterface;
|
|
15
|
+
onTokenCreated?: OnToketCreatedCallback;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
type CommonOAuthAppStrategyOptions = {
|
|
18
|
+
clientType?: "oauth-app";
|
|
19
|
+
} & CommonAppStrategyOptions;
|
|
20
|
+
type CommonGitHubAppStrategyOptions = {
|
|
17
21
|
clientType?: "github-app";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
request?: OctokitTypes.RequestInterface;
|
|
21
|
-
};
|
|
22
|
-
declare type OAuthAppDeviceFlowOptions = {
|
|
22
|
+
} & CommonAppStrategyOptions;
|
|
23
|
+
type OAuthAppDeviceFlowOptions = {
|
|
23
24
|
onVerification: DeviceTypes.OAuthAppStrategyOptions["onVerification"];
|
|
24
25
|
scopes?: string[];
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
+
type GitHubDeviceFlowOptions = {
|
|
27
28
|
onVerification: DeviceTypes.OAuthAppStrategyOptions["onVerification"];
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
+
type ExistingOAuthAppAuthenticationOptions = {
|
|
30
31
|
clientType: "oauth-app";
|
|
31
32
|
token: string;
|
|
32
33
|
scopes: string[];
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
+
type ExistingGitHubAppAuthenticationOptions = {
|
|
35
36
|
token: string;
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
+
type ExistingGitHubAppAuthenticationWithExpirationOptions = {
|
|
38
39
|
token: string;
|
|
39
40
|
refreshToken: string;
|
|
40
41
|
expiresAt: string;
|
|
41
42
|
refreshTokenExpiresAt: string;
|
|
42
43
|
};
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
44
|
+
export type OAuthAppStrategyOptionsWebFlow = CommonOAuthAppStrategyOptions & WebFlowOptions;
|
|
45
|
+
export type GitHubAppStrategyOptionsWebFlow = CommonGitHubAppStrategyOptions & WebFlowOptions;
|
|
46
|
+
export type OAuthAppStrategyOptionsDeviceFlow = CommonOAuthAppStrategyOptions & OAuthAppDeviceFlowOptions;
|
|
47
|
+
export type GitHubAppStrategyOptionsDeviceFlow = CommonGitHubAppStrategyOptions & GitHubDeviceFlowOptions;
|
|
48
|
+
export type OAuthAppStrategyOptionsExistingAuthentication = CommonOAuthAppStrategyOptions & ExistingOAuthAppAuthenticationOptions;
|
|
49
|
+
export type GitHubAppStrategyOptionsExistingAuthentication = CommonGitHubAppStrategyOptions & ExistingGitHubAppAuthenticationOptions;
|
|
50
|
+
export type GitHubAppStrategyOptionsExistingAuthenticationWithExpiration = CommonGitHubAppStrategyOptions & ExistingGitHubAppAuthenticationWithExpirationOptions;
|
|
51
|
+
export type OAuthAppStrategyOptions = OAuthAppStrategyOptionsWebFlow | OAuthAppStrategyOptionsDeviceFlow | OAuthAppStrategyOptionsExistingAuthentication;
|
|
52
|
+
export type GitHubAppStrategyOptions = GitHubAppStrategyOptionsWebFlow | GitHubAppStrategyOptionsDeviceFlow | GitHubAppStrategyOptionsExistingAuthentication | GitHubAppStrategyOptionsExistingAuthenticationWithExpiration;
|
|
53
|
+
export type OAuthAppAuthentication = {
|
|
53
54
|
tokenType: "oauth";
|
|
54
55
|
type: "token";
|
|
55
56
|
} & OAuthMethodsTypes.OAuthAppAuthentication;
|
|
56
|
-
export
|
|
57
|
+
export type GitHubAppAuthentication = {
|
|
57
58
|
tokenType: "oauth";
|
|
58
59
|
type: "token";
|
|
59
60
|
} & OAuthMethodsTypes.GitHubAppAuthentication;
|
|
60
|
-
export
|
|
61
|
+
export type GitHubAppAuthenticationWithExpiration = {
|
|
61
62
|
tokenType: "oauth";
|
|
62
63
|
type: "token";
|
|
63
64
|
} & OAuthMethodsTypes.GitHubAppAuthenticationWithExpiration;
|
|
@@ -69,42 +70,45 @@ export interface GitHubAppAuthInterface {
|
|
|
69
70
|
(options?: GitHubAppAuthOptions): Promise<GitHubAppAuthentication | GitHubAppAuthenticationWithExpiration>;
|
|
70
71
|
hook(request: OctokitTypes.RequestInterface, route: OctokitTypes.Route | OctokitTypes.EndpointOptions, parameters?: OctokitTypes.RequestParameters): Promise<OctokitTypes.OctokitResponse<any>>;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
type OnToketCreatedCallback = (authentication: OAuthAppAuthentication | GitHubAppAuthentication | GitHubAppAuthenticationWithExpiration | undefined, options: OAuthAppAuthOptions | GitHubAppAuthOptions) => void | Promise<void>;
|
|
74
|
+
export type OAuthAppState = {
|
|
73
75
|
clientId: string;
|
|
74
76
|
clientSecret: string;
|
|
75
77
|
clientType: "oauth-app";
|
|
76
78
|
request: OctokitTypes.RequestInterface;
|
|
79
|
+
onTokenCreated?: CommonAppStrategyOptions["onTokenCreated"];
|
|
77
80
|
strategyOptions: WebFlowOptions | OAuthAppDeviceFlowOptions | ExistingOAuthAppAuthenticationOptions;
|
|
78
81
|
authentication?: OAuthAppAuthentication & {
|
|
79
82
|
invalid?: true;
|
|
80
83
|
};
|
|
81
84
|
};
|
|
82
|
-
|
|
85
|
+
type GitHubAppStateAuthentication = GitHubAppAuthentication & {
|
|
83
86
|
invalid?: true;
|
|
84
87
|
};
|
|
85
|
-
|
|
88
|
+
type GitHubAppStateAuthenticationWIthExpiration = GitHubAppAuthenticationWithExpiration & {
|
|
86
89
|
invalid?: true;
|
|
87
90
|
};
|
|
88
|
-
export
|
|
91
|
+
export type GitHubAppState = {
|
|
89
92
|
clientId: string;
|
|
90
93
|
clientSecret: string;
|
|
91
94
|
clientType: "github-app";
|
|
92
95
|
request: OctokitTypes.RequestInterface;
|
|
96
|
+
onTokenCreated?: CommonAppStrategyOptions["onTokenCreated"];
|
|
93
97
|
strategyOptions: WebFlowOptions | GitHubDeviceFlowOptions | ExistingGitHubAppAuthenticationOptions | ExistingGitHubAppAuthenticationWithExpirationOptions;
|
|
94
98
|
authentication?: GitHubAppStateAuthentication | GitHubAppStateAuthenticationWIthExpiration;
|
|
95
99
|
};
|
|
96
|
-
export
|
|
97
|
-
export
|
|
100
|
+
export type State = OAuthAppState | GitHubAppState;
|
|
101
|
+
export type WebFlowState = {
|
|
98
102
|
clientId: string;
|
|
99
103
|
clientSecret: string;
|
|
100
104
|
clientType: ClientType;
|
|
101
105
|
request: OctokitTypes.RequestInterface;
|
|
102
106
|
strategyOptions: WebFlowOptions;
|
|
103
107
|
};
|
|
104
|
-
export
|
|
108
|
+
export type OAuthAppAuthOptions = {
|
|
105
109
|
type?: "get" | "check" | "reset" | "delete" | "deleteAuthorization";
|
|
106
110
|
};
|
|
107
|
-
export
|
|
111
|
+
export type GitHubAppAuthOptions = {
|
|
108
112
|
type?: "get" | "check" | "reset" | "refresh" | "delete" | "deleteAuthorization";
|
|
109
113
|
};
|
|
110
114
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.1.1";
|
|
@@ -4,7 +4,7 @@ import { createOAuthDeviceAuth } from '@octokit/auth-oauth-device';
|
|
|
4
4
|
import { exchangeWebFlowCode, refreshToken, checkToken, resetToken, deleteToken, deleteAuthorization } from '@octokit/oauth-methods';
|
|
5
5
|
import btoa from 'btoa-lite';
|
|
6
6
|
|
|
7
|
-
const VERSION = "2.
|
|
7
|
+
const VERSION = "2.1.1";
|
|
8
8
|
|
|
9
9
|
// @ts-nocheck there is only place for one of us in this file. And it's not you, TS
|
|
10
10
|
async function getAuthentication(state) {
|
|
@@ -14,6 +14,7 @@ async function getAuthentication(state) {
|
|
|
14
14
|
clientId: state.clientId,
|
|
15
15
|
clientSecret: state.clientSecret,
|
|
16
16
|
clientType: state.clientType,
|
|
17
|
+
onTokenCreated: state.onTokenCreated,
|
|
17
18
|
...state.strategyOptions,
|
|
18
19
|
request: state.request,
|
|
19
20
|
});
|
|
@@ -28,6 +29,7 @@ async function getAuthentication(state) {
|
|
|
28
29
|
const deviceAuth = createOAuthDeviceAuth({
|
|
29
30
|
clientType: state.clientType,
|
|
30
31
|
clientId: state.clientId,
|
|
32
|
+
onTokenCreated: state.onTokenCreated,
|
|
31
33
|
...state.strategyOptions,
|
|
32
34
|
request: state.request,
|
|
33
35
|
});
|
|
@@ -47,6 +49,7 @@ async function getAuthentication(state) {
|
|
|
47
49
|
clientId: state.clientId,
|
|
48
50
|
clientSecret: state.clientSecret,
|
|
49
51
|
clientType: state.clientType,
|
|
52
|
+
onTokenCreated: state.onTokenCreated,
|
|
50
53
|
...state.strategyOptions,
|
|
51
54
|
};
|
|
52
55
|
}
|
|
@@ -91,6 +94,9 @@ async function auth(state, options = {}) {
|
|
|
91
94
|
if (!currentAuthentication.hasOwnProperty("expiresAt")) {
|
|
92
95
|
throw new Error("[@octokit/auth-oauth-user] Refresh token missing");
|
|
93
96
|
}
|
|
97
|
+
await state.onTokenCreated?.(state.authentication, {
|
|
98
|
+
type: options.type,
|
|
99
|
+
});
|
|
94
100
|
}
|
|
95
101
|
// check or reset token
|
|
96
102
|
if (options.type === "check" || options.type === "reset") {
|
|
@@ -110,6 +116,11 @@ async function auth(state, options = {}) {
|
|
|
110
116
|
// @ts-expect-error TBD
|
|
111
117
|
...authentication,
|
|
112
118
|
};
|
|
119
|
+
if (options.type === "reset") {
|
|
120
|
+
await state.onTokenCreated?.(state.authentication, {
|
|
121
|
+
type: options.type,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
113
124
|
return state.authentication;
|
|
114
125
|
}
|
|
115
126
|
catch (error) {
|
|
@@ -190,11 +201,12 @@ function createOAuthUserAuth({ clientId, clientSecret, clientType = "oauth-app",
|
|
|
190
201
|
headers: {
|
|
191
202
|
"user-agent": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`,
|
|
192
203
|
},
|
|
193
|
-
}), ...strategyOptions }) {
|
|
204
|
+
}), onTokenCreated, ...strategyOptions }) {
|
|
194
205
|
const state = Object.assign({
|
|
195
206
|
clientType,
|
|
196
207
|
clientId,
|
|
197
208
|
clientSecret,
|
|
209
|
+
onTokenCreated,
|
|
198
210
|
strategyOptions,
|
|
199
211
|
request: request$1,
|
|
200
212
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/get-authentication.js","../dist-src/auth.js","../dist-src/requires-basic-auth.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"2.0.4\";\n","// @ts-nocheck there is only place for one of us in this file. And it's not you, TS\nimport { createOAuthDeviceAuth } from \"@octokit/auth-oauth-device\";\nimport { exchangeWebFlowCode } from \"@octokit/oauth-methods\";\nexport async function getAuthentication(state) {\n // handle code exchange form OAuth Web Flow\n if (\"code\" in state.strategyOptions) {\n const { authentication } = await exchangeWebFlowCode({\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n ...state.strategyOptions,\n request: state.request,\n });\n return {\n type: \"token\",\n tokenType: \"oauth\",\n ...authentication,\n };\n }\n // handle OAuth device flow\n if (\"onVerification\" in state.strategyOptions) {\n const deviceAuth = createOAuthDeviceAuth({\n clientType: state.clientType,\n clientId: state.clientId,\n ...state.strategyOptions,\n request: state.request,\n });\n const authentication = await deviceAuth({\n type: \"oauth\",\n });\n return {\n clientSecret: state.clientSecret,\n ...authentication,\n };\n }\n // use existing authentication\n if (\"token\" in state.strategyOptions) {\n return {\n type: \"token\",\n tokenType: \"oauth\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n ...state.strategyOptions,\n };\n }\n throw new Error(\"[@octokit/auth-oauth-user] Invalid strategy options\");\n}\n","import { getAuthentication } from \"./get-authentication\";\nimport { checkToken, deleteAuthorization, deleteToken, refreshToken, resetToken, } from \"@octokit/oauth-methods\";\nexport async function auth(state, options = {}) {\n if (!state.authentication) {\n // This is what TS makes us do ¯\\_(ツ)_/¯\n state.authentication =\n state.clientType === \"oauth-app\"\n ? await getAuthentication(state)\n : await getAuthentication(state);\n }\n if (state.authentication.invalid) {\n throw new Error(\"[@octokit/auth-oauth-user] Token is invalid\");\n }\n const currentAuthentication = state.authentication;\n // (auto) refresh for user-to-server tokens\n if (\"expiresAt\" in currentAuthentication) {\n if (options.type === \"refresh\" ||\n new Date(currentAuthentication.expiresAt) < new Date()) {\n const { authentication } = await refreshToken({\n clientType: \"github-app\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n refreshToken: currentAuthentication.refreshToken,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n ...authentication,\n };\n }\n }\n // throw error for invalid refresh call\n if (options.type === \"refresh\") {\n if (state.clientType === \"oauth-app\") {\n throw new Error(\"[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens\");\n }\n if (!currentAuthentication.hasOwnProperty(\"expiresAt\")) {\n throw new Error(\"[@octokit/auth-oauth-user] Refresh token missing\");\n }\n }\n // check or reset token\n if (options.type === \"check\" || options.type === \"reset\") {\n const method = options.type === \"check\" ? checkToken : resetToken;\n try {\n const { authentication } = await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n // @ts-expect-error TBD\n ...authentication,\n };\n return state.authentication;\n }\n catch (error) {\n // istanbul ignore else\n if (error.status === 404) {\n error.message = \"[@octokit/auth-oauth-user] Token is invalid\";\n // @ts-expect-error TBD\n state.authentication.invalid = true;\n }\n throw error;\n }\n }\n // invalidate\n if (options.type === \"delete\" || options.type === \"deleteAuthorization\") {\n const method = options.type === \"delete\" ? deleteToken : deleteAuthorization;\n try {\n await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n }\n catch (error) {\n // istanbul ignore if\n if (error.status !== 404)\n throw error;\n }\n state.authentication.invalid = true;\n return state.authentication;\n }\n return state.authentication;\n}\n","/**\n * The following endpoints require an OAuth App to authenticate using its client_id and client_secret.\n *\n * - [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) - Check a token\n * - [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) - Reset a token\n * - [`POST /applications/{client_id}/token/scoped`](https://docs.github.com/en/rest/reference/apps#create-a-scoped-access-token) - Create a scoped access token\n * - [`DELETE /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#delete-an-app-token) - Delete an app token\n * - [`DELETE /applications/{client_id}/grant`](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization) - Delete an app authorization\n *\n * deprecated:\n *\n * - [`GET /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#check-an-authorization) - Check an authorization\n * - [`POST /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#reset-an-authorization) - Reset an authorization\n * - [`DELETE /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-an-authorization-for-an-application) - Revoke an authorization for an application\n * - [`DELETE /applications/{client_id}/grants/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-a-grant-for-an-application) - Revoke a grant for an application\n */\nconst ROUTES_REQUIRING_BASIC_AUTH = /\\/applications\\/[^/]+\\/(token|grant)s?/;\nexport function requiresBasicAuth(url) {\n return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);\n}\n","import btoa from \"btoa-lite\";\nimport { auth } from \"./auth\";\nimport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport async function hook(state, request, route, parameters = {}) {\n const endpoint = request.endpoint.merge(route, parameters);\n // Do not intercept OAuth Web/Device flow request\n if (/\\/login\\/(oauth\\/access_token|device\\/code)$/.test(endpoint.url)) {\n return request(endpoint);\n }\n if (requiresBasicAuth(endpoint.url)) {\n const credentials = btoa(`${state.clientId}:${state.clientSecret}`);\n endpoint.headers.authorization = `basic ${credentials}`;\n return request(endpoint);\n }\n // TS makes us do this ¯\\_(ツ)_/¯\n const { token } = state.clientType === \"oauth-app\"\n ? await auth({ ...state, request })\n : await auth({ ...state, request });\n endpoint.headers.authorization = \"token \" + token;\n return request(endpoint);\n}\n","import { getUserAgent } from \"universal-user-agent\";\nimport { request as octokitRequest } from \"@octokit/request\";\nimport { VERSION } from \"./version\";\nimport { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport function createOAuthUserAuth({ clientId, clientSecret, clientType = \"oauth-app\", request = octokitRequest.defaults({\n headers: {\n \"user-agent\": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`,\n },\n}), ...strategyOptions }) {\n const state = Object.assign({\n clientType,\n clientId,\n clientSecret,\n strategyOptions,\n request,\n });\n // @ts-expect-error not worth the extra code needed to appease TS\n return Object.assign(auth.bind(null, state), {\n // @ts-expect-error not worth the extra code needed to appease TS\n hook: hook.bind(null, state),\n });\n}\ncreateOAuthUserAuth.VERSION = VERSION;\n"],"names":["request","octokitRequest"],"mappings":";;;;;;AAAO,MAAM,OAAO,GAAG,mBAAmB;;ACA1C;AACA,AAEO,eAAe,iBAAiB,CAAC,KAAK,EAAE;AAC/C;AACA,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC,eAAe,EAAE;AACzC,QAAQ,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,mBAAmB,CAAC;AAC7D,YAAY,QAAQ,EAAE,KAAK,CAAC,QAAQ;AACpC,YAAY,YAAY,EAAE,KAAK,CAAC,YAAY;AAC5C,YAAY,UAAU,EAAE,KAAK,CAAC,UAAU;AACxC,YAAY,GAAG,KAAK,CAAC,eAAe;AACpC,YAAY,OAAO,EAAE,KAAK,CAAC,OAAO;AAClC,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO;AACf,YAAY,IAAI,EAAE,OAAO;AACzB,YAAY,SAAS,EAAE,OAAO;AAC9B,YAAY,GAAG,cAAc;AAC7B,SAAS,CAAC;AACV,KAAK;AACL;AACA,IAAI,IAAI,gBAAgB,IAAI,KAAK,CAAC,eAAe,EAAE;AACnD,QAAQ,MAAM,UAAU,GA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;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/get-authentication.js","../dist-src/auth.js","../dist-src/requires-basic-auth.js","../dist-src/hook.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"2.1.1\";\n","// @ts-nocheck there is only place for one of us in this file. And it's not you, TS\nimport { createOAuthDeviceAuth } from \"@octokit/auth-oauth-device\";\nimport { exchangeWebFlowCode } from \"@octokit/oauth-methods\";\nexport async function getAuthentication(state) {\n // handle code exchange form OAuth Web Flow\n if (\"code\" in state.strategyOptions) {\n const { authentication } = await exchangeWebFlowCode({\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n onTokenCreated: state.onTokenCreated,\n ...state.strategyOptions,\n request: state.request,\n });\n return {\n type: \"token\",\n tokenType: \"oauth\",\n ...authentication,\n };\n }\n // handle OAuth device flow\n if (\"onVerification\" in state.strategyOptions) {\n const deviceAuth = createOAuthDeviceAuth({\n clientType: state.clientType,\n clientId: state.clientId,\n onTokenCreated: state.onTokenCreated,\n ...state.strategyOptions,\n request: state.request,\n });\n const authentication = await deviceAuth({\n type: \"oauth\",\n });\n return {\n clientSecret: state.clientSecret,\n ...authentication,\n };\n }\n // use existing authentication\n if (\"token\" in state.strategyOptions) {\n return {\n type: \"token\",\n tokenType: \"oauth\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n clientType: state.clientType,\n onTokenCreated: state.onTokenCreated,\n ...state.strategyOptions,\n };\n }\n throw new Error(\"[@octokit/auth-oauth-user] Invalid strategy options\");\n}\n","import { getAuthentication } from \"./get-authentication\";\nimport { checkToken, deleteAuthorization, deleteToken, refreshToken, resetToken, } from \"@octokit/oauth-methods\";\nexport async function auth(state, options = {}) {\n if (!state.authentication) {\n // This is what TS makes us do ¯\\_(ツ)_/¯\n state.authentication =\n state.clientType === \"oauth-app\"\n ? await getAuthentication(state)\n : await getAuthentication(state);\n }\n if (state.authentication.invalid) {\n throw new Error(\"[@octokit/auth-oauth-user] Token is invalid\");\n }\n const currentAuthentication = state.authentication;\n // (auto) refresh for user-to-server tokens\n if (\"expiresAt\" in currentAuthentication) {\n if (options.type === \"refresh\" ||\n new Date(currentAuthentication.expiresAt) < new Date()) {\n const { authentication } = await refreshToken({\n clientType: \"github-app\",\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n refreshToken: currentAuthentication.refreshToken,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n ...authentication,\n };\n }\n }\n // throw error for invalid refresh call\n if (options.type === \"refresh\") {\n if (state.clientType === \"oauth-app\") {\n throw new Error(\"[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens\");\n }\n if (!currentAuthentication.hasOwnProperty(\"expiresAt\")) {\n throw new Error(\"[@octokit/auth-oauth-user] Refresh token missing\");\n }\n await state.onTokenCreated?.(state.authentication, {\n type: options.type,\n });\n }\n // check or reset token\n if (options.type === \"check\" || options.type === \"reset\") {\n const method = options.type === \"check\" ? checkToken : resetToken;\n try {\n const { authentication } = await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n state.authentication = {\n tokenType: \"oauth\",\n type: \"token\",\n // @ts-expect-error TBD\n ...authentication,\n };\n if (options.type === \"reset\") {\n await state.onTokenCreated?.(state.authentication, {\n type: options.type,\n });\n }\n return state.authentication;\n }\n catch (error) {\n // istanbul ignore else\n if (error.status === 404) {\n error.message = \"[@octokit/auth-oauth-user] Token is invalid\";\n // @ts-expect-error TBD\n state.authentication.invalid = true;\n }\n throw error;\n }\n }\n // invalidate\n if (options.type === \"delete\" || options.type === \"deleteAuthorization\") {\n const method = options.type === \"delete\" ? deleteToken : deleteAuthorization;\n try {\n await method({\n // @ts-expect-error making TS happy would require unnecessary code so no\n clientType: state.clientType,\n clientId: state.clientId,\n clientSecret: state.clientSecret,\n token: state.authentication.token,\n request: state.request,\n });\n }\n catch (error) {\n // istanbul ignore if\n if (error.status !== 404)\n throw error;\n }\n state.authentication.invalid = true;\n return state.authentication;\n }\n return state.authentication;\n}\n","/**\n * The following endpoints require an OAuth App to authenticate using its client_id and client_secret.\n *\n * - [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) - Check a token\n * - [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) - Reset a token\n * - [`POST /applications/{client_id}/token/scoped`](https://docs.github.com/en/rest/reference/apps#create-a-scoped-access-token) - Create a scoped access token\n * - [`DELETE /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#delete-an-app-token) - Delete an app token\n * - [`DELETE /applications/{client_id}/grant`](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization) - Delete an app authorization\n *\n * deprecated:\n *\n * - [`GET /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#check-an-authorization) - Check an authorization\n * - [`POST /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#reset-an-authorization) - Reset an authorization\n * - [`DELETE /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-an-authorization-for-an-application) - Revoke an authorization for an application\n * - [`DELETE /applications/{client_id}/grants/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-a-grant-for-an-application) - Revoke a grant for an application\n */\nconst ROUTES_REQUIRING_BASIC_AUTH = /\\/applications\\/[^/]+\\/(token|grant)s?/;\nexport function requiresBasicAuth(url) {\n return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);\n}\n","import btoa from \"btoa-lite\";\nimport { auth } from \"./auth\";\nimport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport async function hook(state, request, route, parameters = {}) {\n const endpoint = request.endpoint.merge(route, parameters);\n // Do not intercept OAuth Web/Device flow request\n if (/\\/login\\/(oauth\\/access_token|device\\/code)$/.test(endpoint.url)) {\n return request(endpoint);\n }\n if (requiresBasicAuth(endpoint.url)) {\n const credentials = btoa(`${state.clientId}:${state.clientSecret}`);\n endpoint.headers.authorization = `basic ${credentials}`;\n return request(endpoint);\n }\n // TS makes us do this ¯\\_(ツ)_/¯\n const { token } = state.clientType === \"oauth-app\"\n ? await auth({ ...state, request })\n : await auth({ ...state, request });\n endpoint.headers.authorization = \"token \" + token;\n return request(endpoint);\n}\n","import { getUserAgent } from \"universal-user-agent\";\nimport { request as octokitRequest } from \"@octokit/request\";\nimport { VERSION } from \"./version\";\nimport { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nexport { requiresBasicAuth } from \"./requires-basic-auth\";\nexport function createOAuthUserAuth({ clientId, clientSecret, clientType = \"oauth-app\", request = octokitRequest.defaults({\n headers: {\n \"user-agent\": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`,\n },\n}), onTokenCreated, ...strategyOptions }) {\n const state = Object.assign({\n clientType,\n clientId,\n clientSecret,\n onTokenCreated,\n strategyOptions,\n request,\n });\n // @ts-expect-error not worth the extra code needed to appease TS\n return Object.assign(auth.bind(null, state), {\n // @ts-expect-error not worth the extra code needed to appease TS\n hook: hook.bind(null, state),\n });\n}\ncreateOAuthUserAuth.VERSION = VERSION;\n"],"names":["request","octokitRequest"],"mappings":";;;;;;AAAO,MAAM,OAAO,GAAG,mBAAmB;;ACA1C;AACA,AAEO,eAAe,iBAAiB,CAAC,KAAK,EAAE;AAC/C;AACA,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC,eAAe,EAAE;AACzC,QAAQ,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,mBAAmB,CAAC;AAC7D,YAAY,QAAQ,EAAE,KAAK,CAAC,QAAQ;AACpC,YAAY,YAAY,EAAE,KAAK,CAAC,YAAY;AAC5C,YAAY,UAAU,EAAE,KAAK,CAAC,UAAU;AACxC,YAAY,cAAc,EAAE,KAAK,CAAC,cAAc;AAChD,YAAY,GAAG,KAAK,CAAC,eAAe;AACpC,YAAY,OAAO,EAAE,KAAK,CAAC,OAAO;A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AG,WAAW,WAAEA,SAAO,GAAGC,OAAc,CAAC,QAAQ,CAAC;AAC1H,IAAI,OAAO,EAAE;AACb,QAAQ,YAAY,EAAE,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;AAC9E,KAAK;AACL,CAAC,CAAC,EAAE,cAAc,EAAE,GAAG,eAAe,EAAE,EAAE;AAC1C,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;AAChC,QAAQ,UAAU;AAClB,QAAQ,QAAQ;AAChB,QAAQ,YAAY;AACpB,QAAQ,cAAc;AACtB,QAAQ,eAAe;AACvB,iBAAQD,SAAO;AACf,KAAK,CAAC,CAAC;AACP;AACA,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;AACjD;AACA,QAAQ,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;AACpC,KAAK,CAAC,CAAC;AACP,CAAC;AACD,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octokit/auth-oauth-user",
|
|
3
3
|
"description": "Octokit authentication strategy for OAuth clients",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist-*/",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@octokit/auth-oauth-device": "^4.0.0",
|
|
21
21
|
"@octokit/oauth-methods": "^2.0.0",
|
|
22
22
|
"@octokit/request": "^6.0.0",
|
|
23
|
-
"@octokit/types": "^
|
|
23
|
+
"@octokit/types": "^9.0.0",
|
|
24
24
|
"btoa-lite": "^1.0.0",
|
|
25
25
|
"universal-user-agent": "^6.0.0"
|
|
26
26
|
},
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@pika/plugin-ts-standard-pkg": "^0.9.2",
|
|
35
35
|
"@types/btoa-lite": "^1.0.0",
|
|
36
36
|
"@types/jest": "^29.0.0",
|
|
37
|
-
"@types/node": "^
|
|
37
|
+
"@types/node": "^18.0.0",
|
|
38
38
|
"fetch-mock": "^9.11.0",
|
|
39
39
|
"jest": "^29.0.0",
|
|
40
40
|
"mockdate": "^3.0.4",
|
|
41
|
-
"prettier": "2.
|
|
42
|
-
"semantic-release": "^
|
|
41
|
+
"prettier": "2.8.3",
|
|
42
|
+
"semantic-release": "^20.0.0",
|
|
43
43
|
"semantic-release-plugin-update-version-in-files": "^1.1.0",
|
|
44
44
|
"ts-jest": "^29.0.0",
|
|
45
45
|
"typescript": "^4.2.3"
|
|
@@ -205,9 +205,7 @@ const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
|
|
205
205
|
const auth = createTokenAuth(TOKEN);
|
|
206
206
|
const authentication = await auth();
|
|
207
207
|
|
|
208
|
-
const response = await request("HEAD /"
|
|
209
|
-
headers: authentication.headers,
|
|
210
|
-
});
|
|
208
|
+
const response = await request("HEAD /");
|
|
211
209
|
const scopes = response.headers["x-oauth-scopes"].split(/,\s+/);
|
|
212
210
|
|
|
213
211
|
if (scopes.length) {
|
|
@@ -227,9 +225,7 @@ const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
|
|
227
225
|
const auth = createTokenAuth(TOKEN);
|
|
228
226
|
const authentication = await auth();
|
|
229
227
|
|
|
230
|
-
const response = await request("HEAD /"
|
|
231
|
-
headers: authentication.headers,
|
|
232
|
-
});
|
|
228
|
+
const response = await request("HEAD /");
|
|
233
229
|
const clientId = response.headers["x-oauth-client-id"];
|
|
234
230
|
|
|
235
231
|
if (clientId) {
|
|
@@ -252,12 +248,11 @@ const auth = createTokenAuth(TOKEN);
|
|
|
252
248
|
const authentication = await auth();
|
|
253
249
|
|
|
254
250
|
const response = await request("GET /repos/{owner}/{repo}", {
|
|
255
|
-
owner:
|
|
256
|
-
repo:
|
|
257
|
-
headers: authentication.headers
|
|
251
|
+
owner: "octocat",
|
|
252
|
+
repo: "hello-world",
|
|
258
253
|
});
|
|
259
254
|
|
|
260
|
-
console.log(response.data.permissions)
|
|
255
|
+
console.log(response.data.permissions);
|
|
261
256
|
// {
|
|
262
257
|
// admin: true,
|
|
263
258
|
// push: true,
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
20
|
+
// pkg/dist-src/index.js
|
|
21
|
+
var dist_src_exports = {};
|
|
22
|
+
__export(dist_src_exports, {
|
|
23
|
+
createTokenAuth: () => createTokenAuth
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dist_src_exports);
|
|
4
26
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
27
|
+
// pkg/dist-src/auth.js
|
|
28
|
+
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
|
29
|
+
var REGEX_IS_INSTALLATION = /^ghs_/;
|
|
30
|
+
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
|
8
31
|
async function auth(token) {
|
|
9
32
|
const isApp = token.split(/\./).length === 3;
|
|
10
33
|
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
|
@@ -12,44 +35,45 @@ async function auth(token) {
|
|
|
12
35
|
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
|
13
36
|
return {
|
|
14
37
|
type: "token",
|
|
15
|
-
token
|
|
38
|
+
token,
|
|
16
39
|
tokenType
|
|
17
40
|
};
|
|
18
41
|
}
|
|
19
42
|
|
|
20
|
-
|
|
21
|
-
* Prefix token for usage in the Authorization header
|
|
22
|
-
*
|
|
23
|
-
* @param token OAuth token or JSON Web Token
|
|
24
|
-
*/
|
|
43
|
+
// pkg/dist-src/with-authorization-prefix.js
|
|
25
44
|
function withAuthorizationPrefix(token) {
|
|
26
45
|
if (token.split(/\./).length === 3) {
|
|
27
46
|
return `bearer ${token}`;
|
|
28
47
|
}
|
|
29
|
-
|
|
30
48
|
return `token ${token}`;
|
|
31
49
|
}
|
|
32
50
|
|
|
51
|
+
// pkg/dist-src/hook.js
|
|
33
52
|
async function hook(token, request, route, parameters) {
|
|
34
|
-
const endpoint = request.endpoint.merge(
|
|
53
|
+
const endpoint = request.endpoint.merge(
|
|
54
|
+
route,
|
|
55
|
+
parameters
|
|
56
|
+
);
|
|
35
57
|
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
|
36
58
|
return request(endpoint);
|
|
37
59
|
}
|
|
38
60
|
|
|
39
|
-
|
|
61
|
+
// pkg/dist-src/index.js
|
|
62
|
+
var createTokenAuth = function createTokenAuth2(token) {
|
|
40
63
|
if (!token) {
|
|
41
64
|
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
|
42
65
|
}
|
|
43
|
-
|
|
44
66
|
if (typeof token !== "string") {
|
|
45
|
-
throw new Error(
|
|
67
|
+
throw new Error(
|
|
68
|
+
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
|
69
|
+
);
|
|
46
70
|
}
|
|
47
|
-
|
|
48
71
|
token = token.replace(/^(token|bearer) +/i, "");
|
|
49
72
|
return Object.assign(auth.bind(null, token), {
|
|
50
73
|
hook: hook.bind(null, token)
|
|
51
74
|
});
|
|
52
75
|
};
|
|
53
|
-
|
|
54
|
-
exports
|
|
55
|
-
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
createTokenAuth
|
|
79
|
+
});
|