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
|
@@ -0,0 +1,1395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module LRUCache
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LRUCache = void 0;
|
|
7
|
+
const perf = typeof performance === 'object' &&
|
|
8
|
+
performance &&
|
|
9
|
+
typeof performance.now === 'function'
|
|
10
|
+
? performance
|
|
11
|
+
: Date;
|
|
12
|
+
const warned = new Set();
|
|
13
|
+
/* c8 ignore start */
|
|
14
|
+
const PROCESS = (typeof process === 'object' && !!process ? process : {});
|
|
15
|
+
/* c8 ignore start */
|
|
16
|
+
const emitWarning = (msg, type, code, fn) => {
|
|
17
|
+
typeof PROCESS.emitWarning === 'function'
|
|
18
|
+
? PROCESS.emitWarning(msg, type, code, fn)
|
|
19
|
+
: console.error(`[${code}] ${type}: ${msg}`);
|
|
20
|
+
};
|
|
21
|
+
let AC = globalThis.AbortController;
|
|
22
|
+
let AS = globalThis.AbortSignal;
|
|
23
|
+
/* c8 ignore start */
|
|
24
|
+
if (typeof AC === 'undefined') {
|
|
25
|
+
//@ts-ignore
|
|
26
|
+
AS = class AbortSignal {
|
|
27
|
+
onabort;
|
|
28
|
+
_onabort = [];
|
|
29
|
+
reason;
|
|
30
|
+
aborted = false;
|
|
31
|
+
addEventListener(_, fn) {
|
|
32
|
+
this._onabort.push(fn);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
//@ts-ignore
|
|
36
|
+
AC = class AbortController {
|
|
37
|
+
constructor() {
|
|
38
|
+
warnACPolyfill();
|
|
39
|
+
}
|
|
40
|
+
signal = new AS();
|
|
41
|
+
abort(reason) {
|
|
42
|
+
if (this.signal.aborted)
|
|
43
|
+
return;
|
|
44
|
+
//@ts-ignore
|
|
45
|
+
this.signal.reason = reason;
|
|
46
|
+
//@ts-ignore
|
|
47
|
+
this.signal.aborted = true;
|
|
48
|
+
//@ts-ignore
|
|
49
|
+
for (const fn of this.signal._onabort) {
|
|
50
|
+
fn(reason);
|
|
51
|
+
}
|
|
52
|
+
this.signal.onabort?.(reason);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1';
|
|
56
|
+
const warnACPolyfill = () => {
|
|
57
|
+
if (!printACPolyfillWarning)
|
|
58
|
+
return;
|
|
59
|
+
printACPolyfillWarning = false;
|
|
60
|
+
emitWarning('AbortController is not defined. If using lru-cache in ' +
|
|
61
|
+
'node 14, load an AbortController polyfill from the ' +
|
|
62
|
+
'`node-abort-controller` package. A minimal polyfill is ' +
|
|
63
|
+
'provided for use by LRUCache.fetch(), but it should not be ' +
|
|
64
|
+
'relied upon in other contexts (eg, passing it to other APIs that ' +
|
|
65
|
+
'use AbortController/AbortSignal might have undesirable effects). ' +
|
|
66
|
+
'You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.', 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/* c8 ignore stop */
|
|
70
|
+
const shouldWarn = (code) => !warned.has(code);
|
|
71
|
+
const TYPE = Symbol('type');
|
|
72
|
+
const isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
73
|
+
/* c8 ignore start */
|
|
74
|
+
// This is a little bit ridiculous, tbh.
|
|
75
|
+
// The maximum array length is 2^32-1 or thereabouts on most JS impls.
|
|
76
|
+
// And well before that point, you're caching the entire world, I mean,
|
|
77
|
+
// that's ~32GB of just integers for the next/prev links, plus whatever
|
|
78
|
+
// else to hold that many keys and values. Just filling the memory with
|
|
79
|
+
// zeroes at init time is brutal when you get that big.
|
|
80
|
+
// But why not be complete?
|
|
81
|
+
// Maybe in the future, these limits will have expanded.
|
|
82
|
+
const getUintArray = (max) => !isPosInt(max)
|
|
83
|
+
? null
|
|
84
|
+
: max <= Math.pow(2, 8)
|
|
85
|
+
? Uint8Array
|
|
86
|
+
: max <= Math.pow(2, 16)
|
|
87
|
+
? Uint16Array
|
|
88
|
+
: max <= Math.pow(2, 32)
|
|
89
|
+
? Uint32Array
|
|
90
|
+
: max <= Number.MAX_SAFE_INTEGER
|
|
91
|
+
? ZeroArray
|
|
92
|
+
: null;
|
|
93
|
+
/* c8 ignore stop */
|
|
94
|
+
class ZeroArray extends Array {
|
|
95
|
+
constructor(size) {
|
|
96
|
+
super(size);
|
|
97
|
+
this.fill(0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class Stack {
|
|
101
|
+
heap;
|
|
102
|
+
length;
|
|
103
|
+
// private constructor
|
|
104
|
+
static #constructing = false;
|
|
105
|
+
static create(max) {
|
|
106
|
+
const HeapCls = getUintArray(max);
|
|
107
|
+
if (!HeapCls)
|
|
108
|
+
return [];
|
|
109
|
+
Stack.#constructing = true;
|
|
110
|
+
const s = new Stack(max, HeapCls);
|
|
111
|
+
Stack.#constructing = false;
|
|
112
|
+
return s;
|
|
113
|
+
}
|
|
114
|
+
constructor(max, HeapCls) {
|
|
115
|
+
/* c8 ignore start */
|
|
116
|
+
if (!Stack.#constructing) {
|
|
117
|
+
throw new TypeError('instantiate Stack using Stack.create(n)');
|
|
118
|
+
}
|
|
119
|
+
/* c8 ignore stop */
|
|
120
|
+
this.heap = new HeapCls(max);
|
|
121
|
+
this.length = 0;
|
|
122
|
+
}
|
|
123
|
+
push(n) {
|
|
124
|
+
this.heap[this.length++] = n;
|
|
125
|
+
}
|
|
126
|
+
pop() {
|
|
127
|
+
return this.heap[--this.length];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Default export, the thing you're using this module to get.
|
|
132
|
+
*
|
|
133
|
+
* All properties from the options object (with the exception of
|
|
134
|
+
* {@link OptionsBase.max} and {@link OptionsBase.maxSize}) are added as
|
|
135
|
+
* normal public members. (`max` and `maxBase` are read-only getters.)
|
|
136
|
+
* Changing any of these will alter the defaults for subsequent method calls,
|
|
137
|
+
* but is otherwise safe.
|
|
138
|
+
*/
|
|
139
|
+
class LRUCache {
|
|
140
|
+
// properties coming in from the options of these, only max and maxSize
|
|
141
|
+
// really *need* to be protected. The rest can be modified, as they just
|
|
142
|
+
// set defaults for various methods.
|
|
143
|
+
#max;
|
|
144
|
+
#maxSize;
|
|
145
|
+
#dispose;
|
|
146
|
+
#disposeAfter;
|
|
147
|
+
#fetchMethod;
|
|
148
|
+
/**
|
|
149
|
+
* {@link LRUCache.OptionsBase.ttl}
|
|
150
|
+
*/
|
|
151
|
+
ttl;
|
|
152
|
+
/**
|
|
153
|
+
* {@link LRUCache.OptionsBase.ttlResolution}
|
|
154
|
+
*/
|
|
155
|
+
ttlResolution;
|
|
156
|
+
/**
|
|
157
|
+
* {@link LRUCache.OptionsBase.ttlAutopurge}
|
|
158
|
+
*/
|
|
159
|
+
ttlAutopurge;
|
|
160
|
+
/**
|
|
161
|
+
* {@link LRUCache.OptionsBase.updateAgeOnGet}
|
|
162
|
+
*/
|
|
163
|
+
updateAgeOnGet;
|
|
164
|
+
/**
|
|
165
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas}
|
|
166
|
+
*/
|
|
167
|
+
updateAgeOnHas;
|
|
168
|
+
/**
|
|
169
|
+
* {@link LRUCache.OptionsBase.allowStale}
|
|
170
|
+
*/
|
|
171
|
+
allowStale;
|
|
172
|
+
/**
|
|
173
|
+
* {@link LRUCache.OptionsBase.noDisposeOnSet}
|
|
174
|
+
*/
|
|
175
|
+
noDisposeOnSet;
|
|
176
|
+
/**
|
|
177
|
+
* {@link LRUCache.OptionsBase.noUpdateTTL}
|
|
178
|
+
*/
|
|
179
|
+
noUpdateTTL;
|
|
180
|
+
/**
|
|
181
|
+
* {@link LRUCache.OptionsBase.maxEntrySize}
|
|
182
|
+
*/
|
|
183
|
+
maxEntrySize;
|
|
184
|
+
/**
|
|
185
|
+
* {@link LRUCache.OptionsBase.sizeCalculation}
|
|
186
|
+
*/
|
|
187
|
+
sizeCalculation;
|
|
188
|
+
/**
|
|
189
|
+
* {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
|
|
190
|
+
*/
|
|
191
|
+
noDeleteOnFetchRejection;
|
|
192
|
+
/**
|
|
193
|
+
* {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
|
|
194
|
+
*/
|
|
195
|
+
noDeleteOnStaleGet;
|
|
196
|
+
/**
|
|
197
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
|
|
198
|
+
*/
|
|
199
|
+
allowStaleOnFetchAbort;
|
|
200
|
+
/**
|
|
201
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
|
|
202
|
+
*/
|
|
203
|
+
allowStaleOnFetchRejection;
|
|
204
|
+
/**
|
|
205
|
+
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
|
206
|
+
*/
|
|
207
|
+
ignoreFetchAbort;
|
|
208
|
+
// computed properties
|
|
209
|
+
#size;
|
|
210
|
+
#calculatedSize;
|
|
211
|
+
#keyMap;
|
|
212
|
+
#keyList;
|
|
213
|
+
#valList;
|
|
214
|
+
#next;
|
|
215
|
+
#prev;
|
|
216
|
+
#head;
|
|
217
|
+
#tail;
|
|
218
|
+
#free;
|
|
219
|
+
#disposed;
|
|
220
|
+
#sizes;
|
|
221
|
+
#starts;
|
|
222
|
+
#ttls;
|
|
223
|
+
#hasDispose;
|
|
224
|
+
#hasFetchMethod;
|
|
225
|
+
#hasDisposeAfter;
|
|
226
|
+
/**
|
|
227
|
+
* Do not call this method unless you need to inspect the
|
|
228
|
+
* inner workings of the cache. If anything returned by this
|
|
229
|
+
* object is modified in any way, strange breakage may occur.
|
|
230
|
+
*
|
|
231
|
+
* These fields are private for a reason!
|
|
232
|
+
*
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
235
|
+
static unsafeExposeInternals(c) {
|
|
236
|
+
return {
|
|
237
|
+
// properties
|
|
238
|
+
starts: c.#starts,
|
|
239
|
+
ttls: c.#ttls,
|
|
240
|
+
sizes: c.#sizes,
|
|
241
|
+
keyMap: c.#keyMap,
|
|
242
|
+
keyList: c.#keyList,
|
|
243
|
+
valList: c.#valList,
|
|
244
|
+
next: c.#next,
|
|
245
|
+
prev: c.#prev,
|
|
246
|
+
get head() {
|
|
247
|
+
return c.#head;
|
|
248
|
+
},
|
|
249
|
+
get tail() {
|
|
250
|
+
return c.#tail;
|
|
251
|
+
},
|
|
252
|
+
free: c.#free,
|
|
253
|
+
// methods
|
|
254
|
+
isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
|
|
255
|
+
backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
|
|
256
|
+
moveToTail: (index) => c.#moveToTail(index),
|
|
257
|
+
indexes: (options) => c.#indexes(options),
|
|
258
|
+
rindexes: (options) => c.#rindexes(options),
|
|
259
|
+
isStale: (index) => c.#isStale(index),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
// Protected read-only members
|
|
263
|
+
/**
|
|
264
|
+
* {@link LRUCache.OptionsBase.max} (read-only)
|
|
265
|
+
*/
|
|
266
|
+
get max() {
|
|
267
|
+
return this.#max;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* {@link LRUCache.OptionsBase.maxSize} (read-only)
|
|
271
|
+
*/
|
|
272
|
+
get maxSize() {
|
|
273
|
+
return this.#maxSize;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* The total computed size of items in the cache (read-only)
|
|
277
|
+
*/
|
|
278
|
+
get calculatedSize() {
|
|
279
|
+
return this.#calculatedSize;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The number of items stored in the cache (read-only)
|
|
283
|
+
*/
|
|
284
|
+
get size() {
|
|
285
|
+
return this.#size;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* {@link LRUCache.OptionsBase.fetchMethod} (read-only)
|
|
289
|
+
*/
|
|
290
|
+
get fetchMethod() {
|
|
291
|
+
return this.#fetchMethod;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
295
|
+
*/
|
|
296
|
+
get dispose() {
|
|
297
|
+
return this.#dispose;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
301
|
+
*/
|
|
302
|
+
get disposeAfter() {
|
|
303
|
+
return this.#disposeAfter;
|
|
304
|
+
}
|
|
305
|
+
constructor(options) {
|
|
306
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = options;
|
|
307
|
+
if (max !== 0 && !isPosInt(max)) {
|
|
308
|
+
throw new TypeError('max option must be a nonnegative integer');
|
|
309
|
+
}
|
|
310
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
311
|
+
if (!UintArray) {
|
|
312
|
+
throw new Error('invalid max value: ' + max);
|
|
313
|
+
}
|
|
314
|
+
this.#max = max;
|
|
315
|
+
this.#maxSize = maxSize;
|
|
316
|
+
this.maxEntrySize = maxEntrySize || this.#maxSize;
|
|
317
|
+
this.sizeCalculation = sizeCalculation;
|
|
318
|
+
if (this.sizeCalculation) {
|
|
319
|
+
if (!this.#maxSize && !this.maxEntrySize) {
|
|
320
|
+
throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
|
|
321
|
+
}
|
|
322
|
+
if (typeof this.sizeCalculation !== 'function') {
|
|
323
|
+
throw new TypeError('sizeCalculation set to non-function');
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (fetchMethod !== undefined &&
|
|
327
|
+
typeof fetchMethod !== 'function') {
|
|
328
|
+
throw new TypeError('fetchMethod must be a function if specified');
|
|
329
|
+
}
|
|
330
|
+
this.#fetchMethod = fetchMethod;
|
|
331
|
+
this.#hasFetchMethod = !!fetchMethod;
|
|
332
|
+
this.#keyMap = new Map();
|
|
333
|
+
this.#keyList = new Array(max).fill(undefined);
|
|
334
|
+
this.#valList = new Array(max).fill(undefined);
|
|
335
|
+
this.#next = new UintArray(max);
|
|
336
|
+
this.#prev = new UintArray(max);
|
|
337
|
+
this.#head = 0;
|
|
338
|
+
this.#tail = 0;
|
|
339
|
+
this.#free = Stack.create(max);
|
|
340
|
+
this.#size = 0;
|
|
341
|
+
this.#calculatedSize = 0;
|
|
342
|
+
if (typeof dispose === 'function') {
|
|
343
|
+
this.#dispose = dispose;
|
|
344
|
+
}
|
|
345
|
+
if (typeof disposeAfter === 'function') {
|
|
346
|
+
this.#disposeAfter = disposeAfter;
|
|
347
|
+
this.#disposed = [];
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
this.#disposeAfter = undefined;
|
|
351
|
+
this.#disposed = undefined;
|
|
352
|
+
}
|
|
353
|
+
this.#hasDispose = !!this.#dispose;
|
|
354
|
+
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
355
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
356
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
357
|
+
this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
|
|
358
|
+
this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
|
|
359
|
+
this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
|
|
360
|
+
this.ignoreFetchAbort = !!ignoreFetchAbort;
|
|
361
|
+
// NB: maxEntrySize is set to maxSize if it's set
|
|
362
|
+
if (this.maxEntrySize !== 0) {
|
|
363
|
+
if (this.#maxSize !== 0) {
|
|
364
|
+
if (!isPosInt(this.#maxSize)) {
|
|
365
|
+
throw new TypeError('maxSize must be a positive integer if specified');
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (!isPosInt(this.maxEntrySize)) {
|
|
369
|
+
throw new TypeError('maxEntrySize must be a positive integer if specified');
|
|
370
|
+
}
|
|
371
|
+
this.#initializeSizeTracking();
|
|
372
|
+
}
|
|
373
|
+
this.allowStale = !!allowStale;
|
|
374
|
+
this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
|
|
375
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
376
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
377
|
+
this.ttlResolution =
|
|
378
|
+
isPosInt(ttlResolution) || ttlResolution === 0
|
|
379
|
+
? ttlResolution
|
|
380
|
+
: 1;
|
|
381
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
382
|
+
this.ttl = ttl || 0;
|
|
383
|
+
if (this.ttl) {
|
|
384
|
+
if (!isPosInt(this.ttl)) {
|
|
385
|
+
throw new TypeError('ttl must be a positive integer if specified');
|
|
386
|
+
}
|
|
387
|
+
this.#initializeTTLTracking();
|
|
388
|
+
}
|
|
389
|
+
// do not allow completely unbounded caches
|
|
390
|
+
if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
|
|
391
|
+
throw new TypeError('At least one of max, maxSize, or ttl is required');
|
|
392
|
+
}
|
|
393
|
+
if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
|
|
394
|
+
const code = 'LRU_CACHE_UNBOUNDED';
|
|
395
|
+
if (shouldWarn(code)) {
|
|
396
|
+
warned.add(code);
|
|
397
|
+
const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
|
|
398
|
+
'result in unbounded memory consumption.';
|
|
399
|
+
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Return the remaining TTL time for a given entry key
|
|
405
|
+
*/
|
|
406
|
+
getRemainingTTL(key) {
|
|
407
|
+
return this.#keyMap.has(key) ? Infinity : 0;
|
|
408
|
+
}
|
|
409
|
+
#initializeTTLTracking() {
|
|
410
|
+
const ttls = new ZeroArray(this.#max);
|
|
411
|
+
const starts = new ZeroArray(this.#max);
|
|
412
|
+
this.#ttls = ttls;
|
|
413
|
+
this.#starts = starts;
|
|
414
|
+
this.#setItemTTL = (index, ttl, start = perf.now()) => {
|
|
415
|
+
starts[index] = ttl !== 0 ? start : 0;
|
|
416
|
+
ttls[index] = ttl;
|
|
417
|
+
if (ttl !== 0 && this.ttlAutopurge) {
|
|
418
|
+
const t = setTimeout(() => {
|
|
419
|
+
if (this.#isStale(index)) {
|
|
420
|
+
this.delete(this.#keyList[index]);
|
|
421
|
+
}
|
|
422
|
+
}, ttl + 1);
|
|
423
|
+
// unref() not supported on all platforms
|
|
424
|
+
/* c8 ignore start */
|
|
425
|
+
if (t.unref) {
|
|
426
|
+
t.unref();
|
|
427
|
+
}
|
|
428
|
+
/* c8 ignore stop */
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
this.#updateItemAge = index => {
|
|
432
|
+
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
433
|
+
};
|
|
434
|
+
this.#statusTTL = (status, index) => {
|
|
435
|
+
if (ttls[index]) {
|
|
436
|
+
const ttl = ttls[index];
|
|
437
|
+
const start = starts[index];
|
|
438
|
+
status.ttl = ttl;
|
|
439
|
+
status.start = start;
|
|
440
|
+
status.now = cachedNow || getNow();
|
|
441
|
+
const age = status.now - start;
|
|
442
|
+
status.remainingTTL = ttl - age;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
// debounce calls to perf.now() to 1s so we're not hitting
|
|
446
|
+
// that costly call repeatedly.
|
|
447
|
+
let cachedNow = 0;
|
|
448
|
+
const getNow = () => {
|
|
449
|
+
const n = perf.now();
|
|
450
|
+
if (this.ttlResolution > 0) {
|
|
451
|
+
cachedNow = n;
|
|
452
|
+
const t = setTimeout(() => (cachedNow = 0), this.ttlResolution);
|
|
453
|
+
// not available on all platforms
|
|
454
|
+
/* c8 ignore start */
|
|
455
|
+
if (t.unref) {
|
|
456
|
+
t.unref();
|
|
457
|
+
}
|
|
458
|
+
/* c8 ignore stop */
|
|
459
|
+
}
|
|
460
|
+
return n;
|
|
461
|
+
};
|
|
462
|
+
this.getRemainingTTL = key => {
|
|
463
|
+
const index = this.#keyMap.get(key);
|
|
464
|
+
if (index === undefined) {
|
|
465
|
+
return 0;
|
|
466
|
+
}
|
|
467
|
+
const ttl = ttls[index];
|
|
468
|
+
const start = starts[index];
|
|
469
|
+
if (ttl === 0 || start === 0) {
|
|
470
|
+
return Infinity;
|
|
471
|
+
}
|
|
472
|
+
const age = (cachedNow || getNow()) - start;
|
|
473
|
+
return ttl - age;
|
|
474
|
+
};
|
|
475
|
+
this.#isStale = index => {
|
|
476
|
+
return (ttls[index] !== 0 &&
|
|
477
|
+
starts[index] !== 0 &&
|
|
478
|
+
(cachedNow || getNow()) - starts[index] > ttls[index]);
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
// conditionally set private methods related to TTL
|
|
482
|
+
#updateItemAge = () => { };
|
|
483
|
+
#statusTTL = () => { };
|
|
484
|
+
#setItemTTL = () => { };
|
|
485
|
+
/* c8 ignore stop */
|
|
486
|
+
#isStale = () => false;
|
|
487
|
+
#initializeSizeTracking() {
|
|
488
|
+
const sizes = new ZeroArray(this.#max);
|
|
489
|
+
this.#calculatedSize = 0;
|
|
490
|
+
this.#sizes = sizes;
|
|
491
|
+
this.#removeItemSize = index => {
|
|
492
|
+
this.#calculatedSize -= sizes[index];
|
|
493
|
+
sizes[index] = 0;
|
|
494
|
+
};
|
|
495
|
+
this.#requireSize = (k, v, size, sizeCalculation) => {
|
|
496
|
+
// provisionally accept background fetches.
|
|
497
|
+
// actual value size will be checked when they return.
|
|
498
|
+
if (this.#isBackgroundFetch(v)) {
|
|
499
|
+
return 0;
|
|
500
|
+
}
|
|
501
|
+
if (!isPosInt(size)) {
|
|
502
|
+
if (sizeCalculation) {
|
|
503
|
+
if (typeof sizeCalculation !== 'function') {
|
|
504
|
+
throw new TypeError('sizeCalculation must be a function');
|
|
505
|
+
}
|
|
506
|
+
size = sizeCalculation(v, k);
|
|
507
|
+
if (!isPosInt(size)) {
|
|
508
|
+
throw new TypeError('sizeCalculation return invalid (expect positive integer)');
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
throw new TypeError('invalid size value (must be positive integer). ' +
|
|
513
|
+
'When maxSize or maxEntrySize is used, sizeCalculation ' +
|
|
514
|
+
'or size must be set.');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return size;
|
|
518
|
+
};
|
|
519
|
+
this.#addItemSize = (index, size, status) => {
|
|
520
|
+
sizes[index] = size;
|
|
521
|
+
if (this.#maxSize) {
|
|
522
|
+
const maxSize = this.#maxSize - sizes[index];
|
|
523
|
+
while (this.#calculatedSize > maxSize) {
|
|
524
|
+
this.#evict(true);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
this.#calculatedSize += sizes[index];
|
|
528
|
+
if (status) {
|
|
529
|
+
status.entrySize = size;
|
|
530
|
+
status.totalCalculatedSize = this.#calculatedSize;
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
#removeItemSize = _i => { };
|
|
535
|
+
#addItemSize = (_i, _s, _st) => { };
|
|
536
|
+
#requireSize = (_k, _v, size, sizeCalculation) => {
|
|
537
|
+
if (size || sizeCalculation) {
|
|
538
|
+
throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
|
|
539
|
+
}
|
|
540
|
+
return 0;
|
|
541
|
+
};
|
|
542
|
+
*#indexes({ allowStale = this.allowStale } = {}) {
|
|
543
|
+
if (this.#size) {
|
|
544
|
+
for (let i = this.#tail; true;) {
|
|
545
|
+
if (!this.#isValidIndex(i)) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
if (allowStale || !this.#isStale(i)) {
|
|
549
|
+
yield i;
|
|
550
|
+
}
|
|
551
|
+
if (i === this.#head) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
i = this.#prev[i];
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
*#rindexes({ allowStale = this.allowStale } = {}) {
|
|
561
|
+
if (this.#size) {
|
|
562
|
+
for (let i = this.#head; true;) {
|
|
563
|
+
if (!this.#isValidIndex(i)) {
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
if (allowStale || !this.#isStale(i)) {
|
|
567
|
+
yield i;
|
|
568
|
+
}
|
|
569
|
+
if (i === this.#tail) {
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
i = this.#next[i];
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
#isValidIndex(index) {
|
|
579
|
+
return (index !== undefined &&
|
|
580
|
+
this.#keyMap.get(this.#keyList[index]) === index);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
584
|
+
* in order from most recently used to least recently used.
|
|
585
|
+
*/
|
|
586
|
+
*entries() {
|
|
587
|
+
for (const i of this.#indexes()) {
|
|
588
|
+
if (this.#valList[i] !== undefined &&
|
|
589
|
+
this.#keyList[i] !== undefined &&
|
|
590
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
591
|
+
yield [this.#keyList[i], this.#valList[i]];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Inverse order version of {@link LRUCache.entries}
|
|
597
|
+
*
|
|
598
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
599
|
+
* in order from least recently used to most recently used.
|
|
600
|
+
*/
|
|
601
|
+
*rentries() {
|
|
602
|
+
for (const i of this.#rindexes()) {
|
|
603
|
+
if (this.#valList[i] !== undefined &&
|
|
604
|
+
this.#keyList[i] !== undefined &&
|
|
605
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
606
|
+
yield [this.#keyList[i], this.#valList[i]];
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Return a generator yielding the keys in the cache,
|
|
612
|
+
* in order from most recently used to least recently used.
|
|
613
|
+
*/
|
|
614
|
+
*keys() {
|
|
615
|
+
for (const i of this.#indexes()) {
|
|
616
|
+
const k = this.#keyList[i];
|
|
617
|
+
if (k !== undefined &&
|
|
618
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
619
|
+
yield k;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Inverse order version of {@link LRUCache.keys}
|
|
625
|
+
*
|
|
626
|
+
* Return a generator yielding the keys in the cache,
|
|
627
|
+
* in order from least recently used to most recently used.
|
|
628
|
+
*/
|
|
629
|
+
*rkeys() {
|
|
630
|
+
for (const i of this.#rindexes()) {
|
|
631
|
+
const k = this.#keyList[i];
|
|
632
|
+
if (k !== undefined &&
|
|
633
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
634
|
+
yield k;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Return a generator yielding the values in the cache,
|
|
640
|
+
* in order from most recently used to least recently used.
|
|
641
|
+
*/
|
|
642
|
+
*values() {
|
|
643
|
+
for (const i of this.#indexes()) {
|
|
644
|
+
const v = this.#valList[i];
|
|
645
|
+
if (v !== undefined &&
|
|
646
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
647
|
+
yield this.#valList[i];
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Inverse order version of {@link LRUCache.values}
|
|
653
|
+
*
|
|
654
|
+
* Return a generator yielding the values in the cache,
|
|
655
|
+
* in order from least recently used to most recently used.
|
|
656
|
+
*/
|
|
657
|
+
*rvalues() {
|
|
658
|
+
for (const i of this.#rindexes()) {
|
|
659
|
+
const v = this.#valList[i];
|
|
660
|
+
if (v !== undefined &&
|
|
661
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
662
|
+
yield this.#valList[i];
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Iterating over the cache itself yields the same results as
|
|
668
|
+
* {@link LRUCache.entries}
|
|
669
|
+
*/
|
|
670
|
+
[Symbol.iterator]() {
|
|
671
|
+
return this.entries();
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Find a value for which the supplied fn method returns a truthy value,
|
|
675
|
+
* similar to Array.find(). fn is called as fn(value, key, cache).
|
|
676
|
+
*/
|
|
677
|
+
find(fn, getOptions = {}) {
|
|
678
|
+
for (const i of this.#indexes()) {
|
|
679
|
+
const v = this.#valList[i];
|
|
680
|
+
const value = this.#isBackgroundFetch(v)
|
|
681
|
+
? v.__staleWhileFetching
|
|
682
|
+
: v;
|
|
683
|
+
if (value === undefined)
|
|
684
|
+
continue;
|
|
685
|
+
if (fn(value, this.#keyList[i], this)) {
|
|
686
|
+
return this.get(this.#keyList[i], getOptions);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Call the supplied function on each item in the cache, in order from
|
|
692
|
+
* most recently used to least recently used. fn is called as
|
|
693
|
+
* fn(value, key, cache). Does not update age or recenty of use.
|
|
694
|
+
* Does not iterate over stale values.
|
|
695
|
+
*/
|
|
696
|
+
forEach(fn, thisp = this) {
|
|
697
|
+
for (const i of this.#indexes()) {
|
|
698
|
+
const v = this.#valList[i];
|
|
699
|
+
const value = this.#isBackgroundFetch(v)
|
|
700
|
+
? v.__staleWhileFetching
|
|
701
|
+
: v;
|
|
702
|
+
if (value === undefined)
|
|
703
|
+
continue;
|
|
704
|
+
fn.call(thisp, value, this.#keyList[i], this);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* The same as {@link LRUCache.forEach} but items are iterated over in
|
|
709
|
+
* reverse order. (ie, less recently used items are iterated over first.)
|
|
710
|
+
*/
|
|
711
|
+
rforEach(fn, thisp = this) {
|
|
712
|
+
for (const i of this.#rindexes()) {
|
|
713
|
+
const v = this.#valList[i];
|
|
714
|
+
const value = this.#isBackgroundFetch(v)
|
|
715
|
+
? v.__staleWhileFetching
|
|
716
|
+
: v;
|
|
717
|
+
if (value === undefined)
|
|
718
|
+
continue;
|
|
719
|
+
fn.call(thisp, value, this.#keyList[i], this);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Delete any stale entries. Returns true if anything was removed,
|
|
724
|
+
* false otherwise.
|
|
725
|
+
*/
|
|
726
|
+
purgeStale() {
|
|
727
|
+
let deleted = false;
|
|
728
|
+
for (const i of this.#rindexes({ allowStale: true })) {
|
|
729
|
+
if (this.#isStale(i)) {
|
|
730
|
+
this.delete(this.#keyList[i]);
|
|
731
|
+
deleted = true;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return deleted;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
738
|
+
* passed to cache.load()
|
|
739
|
+
*/
|
|
740
|
+
dump() {
|
|
741
|
+
const arr = [];
|
|
742
|
+
for (const i of this.#indexes({ allowStale: true })) {
|
|
743
|
+
const key = this.#keyList[i];
|
|
744
|
+
const v = this.#valList[i];
|
|
745
|
+
const value = this.#isBackgroundFetch(v)
|
|
746
|
+
? v.__staleWhileFetching
|
|
747
|
+
: v;
|
|
748
|
+
if (value === undefined || key === undefined)
|
|
749
|
+
continue;
|
|
750
|
+
const entry = { value };
|
|
751
|
+
if (this.#ttls && this.#starts) {
|
|
752
|
+
entry.ttl = this.#ttls[i];
|
|
753
|
+
// always dump the start relative to a portable timestamp
|
|
754
|
+
// it's ok for this to be a bit slow, it's a rare operation.
|
|
755
|
+
const age = perf.now() - this.#starts[i];
|
|
756
|
+
entry.start = Math.floor(Date.now() - age);
|
|
757
|
+
}
|
|
758
|
+
if (this.#sizes) {
|
|
759
|
+
entry.size = this.#sizes[i];
|
|
760
|
+
}
|
|
761
|
+
arr.unshift([key, entry]);
|
|
762
|
+
}
|
|
763
|
+
return arr;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Reset the cache and load in the items in entries in the order listed.
|
|
767
|
+
* Note that the shape of the resulting cache may be different if the
|
|
768
|
+
* same options are not used in both caches.
|
|
769
|
+
*/
|
|
770
|
+
load(arr) {
|
|
771
|
+
this.clear();
|
|
772
|
+
for (const [key, entry] of arr) {
|
|
773
|
+
if (entry.start) {
|
|
774
|
+
// entry.start is a portable timestamp, but we may be using
|
|
775
|
+
// node's performance.now(), so calculate the offset, so that
|
|
776
|
+
// we get the intended remaining TTL, no matter how long it's
|
|
777
|
+
// been on ice.
|
|
778
|
+
//
|
|
779
|
+
// it's ok for this to be a bit slow, it's a rare operation.
|
|
780
|
+
const age = Date.now() - entry.start;
|
|
781
|
+
entry.start = perf.now() - age;
|
|
782
|
+
}
|
|
783
|
+
this.set(key, entry.value, entry);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Add a value to the cache.
|
|
788
|
+
*
|
|
789
|
+
* Note: if `undefined` is specified as a value, this is an alias for
|
|
790
|
+
* {@link LRUCache#delete}
|
|
791
|
+
*/
|
|
792
|
+
set(k, v, setOptions = {}) {
|
|
793
|
+
if (v === undefined) {
|
|
794
|
+
this.delete(k);
|
|
795
|
+
return this;
|
|
796
|
+
}
|
|
797
|
+
const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions;
|
|
798
|
+
let { noUpdateTTL = this.noUpdateTTL } = setOptions;
|
|
799
|
+
const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
|
|
800
|
+
// if the item doesn't fit, don't do anything
|
|
801
|
+
// NB: maxEntrySize set to maxSize by default
|
|
802
|
+
if (this.maxEntrySize && size > this.maxEntrySize) {
|
|
803
|
+
if (status) {
|
|
804
|
+
status.set = 'miss';
|
|
805
|
+
status.maxEntrySizeExceeded = true;
|
|
806
|
+
}
|
|
807
|
+
// have to delete, in case something is there already.
|
|
808
|
+
this.delete(k);
|
|
809
|
+
return this;
|
|
810
|
+
}
|
|
811
|
+
let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
|
|
812
|
+
if (index === undefined) {
|
|
813
|
+
// addition
|
|
814
|
+
index = (this.#size === 0
|
|
815
|
+
? this.#tail
|
|
816
|
+
: this.#free.length !== 0
|
|
817
|
+
? this.#free.pop()
|
|
818
|
+
: this.#size === this.#max
|
|
819
|
+
? this.#evict(false)
|
|
820
|
+
: this.#size);
|
|
821
|
+
this.#keyList[index] = k;
|
|
822
|
+
this.#valList[index] = v;
|
|
823
|
+
this.#keyMap.set(k, index);
|
|
824
|
+
this.#next[this.#tail] = index;
|
|
825
|
+
this.#prev[index] = this.#tail;
|
|
826
|
+
this.#tail = index;
|
|
827
|
+
this.#size++;
|
|
828
|
+
this.#addItemSize(index, size, status);
|
|
829
|
+
if (status)
|
|
830
|
+
status.set = 'add';
|
|
831
|
+
noUpdateTTL = false;
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
// update
|
|
835
|
+
this.#moveToTail(index);
|
|
836
|
+
const oldVal = this.#valList[index];
|
|
837
|
+
if (v !== oldVal) {
|
|
838
|
+
if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
|
|
839
|
+
oldVal.__abortController.abort(new Error('replaced'));
|
|
840
|
+
}
|
|
841
|
+
else if (!noDisposeOnSet) {
|
|
842
|
+
if (this.#hasDispose) {
|
|
843
|
+
this.#dispose?.(oldVal, k, 'set');
|
|
844
|
+
}
|
|
845
|
+
if (this.#hasDisposeAfter) {
|
|
846
|
+
this.#disposed?.push([oldVal, k, 'set']);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
this.#removeItemSize(index);
|
|
850
|
+
this.#addItemSize(index, size, status);
|
|
851
|
+
this.#valList[index] = v;
|
|
852
|
+
if (status) {
|
|
853
|
+
status.set = 'replace';
|
|
854
|
+
const oldValue = oldVal && this.#isBackgroundFetch(oldVal)
|
|
855
|
+
? oldVal.__staleWhileFetching
|
|
856
|
+
: oldVal;
|
|
857
|
+
if (oldValue !== undefined)
|
|
858
|
+
status.oldValue = oldValue;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
else if (status) {
|
|
862
|
+
status.set = 'update';
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
if (ttl !== 0 && !this.#ttls) {
|
|
866
|
+
this.#initializeTTLTracking();
|
|
867
|
+
}
|
|
868
|
+
if (this.#ttls) {
|
|
869
|
+
if (!noUpdateTTL) {
|
|
870
|
+
this.#setItemTTL(index, ttl, start);
|
|
871
|
+
}
|
|
872
|
+
if (status)
|
|
873
|
+
this.#statusTTL(status, index);
|
|
874
|
+
}
|
|
875
|
+
if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
|
|
876
|
+
const dt = this.#disposed;
|
|
877
|
+
let task;
|
|
878
|
+
while ((task = dt?.shift())) {
|
|
879
|
+
this.#disposeAfter?.(...task);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return this;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Evict the least recently used item, returning its value or
|
|
886
|
+
* `undefined` if cache is empty.
|
|
887
|
+
*/
|
|
888
|
+
pop() {
|
|
889
|
+
try {
|
|
890
|
+
while (this.#size) {
|
|
891
|
+
const val = this.#valList[this.#head];
|
|
892
|
+
this.#evict(true);
|
|
893
|
+
if (this.#isBackgroundFetch(val)) {
|
|
894
|
+
if (val.__staleWhileFetching) {
|
|
895
|
+
return val.__staleWhileFetching;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
else if (val !== undefined) {
|
|
899
|
+
return val;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
finally {
|
|
904
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
905
|
+
const dt = this.#disposed;
|
|
906
|
+
let task;
|
|
907
|
+
while ((task = dt?.shift())) {
|
|
908
|
+
this.#disposeAfter?.(...task);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
#evict(free) {
|
|
914
|
+
const head = this.#head;
|
|
915
|
+
const k = this.#keyList[head];
|
|
916
|
+
const v = this.#valList[head];
|
|
917
|
+
if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
|
|
918
|
+
v.__abortController.abort(new Error('evicted'));
|
|
919
|
+
}
|
|
920
|
+
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
921
|
+
if (this.#hasDispose) {
|
|
922
|
+
this.#dispose?.(v, k, 'evict');
|
|
923
|
+
}
|
|
924
|
+
if (this.#hasDisposeAfter) {
|
|
925
|
+
this.#disposed?.push([v, k, 'evict']);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
this.#removeItemSize(head);
|
|
929
|
+
// if we aren't about to use the index, then null these out
|
|
930
|
+
if (free) {
|
|
931
|
+
this.#keyList[head] = undefined;
|
|
932
|
+
this.#valList[head] = undefined;
|
|
933
|
+
this.#free.push(head);
|
|
934
|
+
}
|
|
935
|
+
if (this.#size === 1) {
|
|
936
|
+
this.#head = this.#tail = 0;
|
|
937
|
+
this.#free.length = 0;
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
this.#head = this.#next[head];
|
|
941
|
+
}
|
|
942
|
+
this.#keyMap.delete(k);
|
|
943
|
+
this.#size--;
|
|
944
|
+
return head;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Check if a key is in the cache, without updating the recency of use.
|
|
948
|
+
* Will return false if the item is stale, even though it is technically
|
|
949
|
+
* in the cache.
|
|
950
|
+
*
|
|
951
|
+
* Will not update item age unless
|
|
952
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
953
|
+
*/
|
|
954
|
+
has(k, hasOptions = {}) {
|
|
955
|
+
const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
|
|
956
|
+
const index = this.#keyMap.get(k);
|
|
957
|
+
if (index !== undefined) {
|
|
958
|
+
const v = this.#valList[index];
|
|
959
|
+
if (this.#isBackgroundFetch(v) &&
|
|
960
|
+
v.__staleWhileFetching === undefined) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
if (!this.#isStale(index)) {
|
|
964
|
+
if (updateAgeOnHas) {
|
|
965
|
+
this.#updateItemAge(index);
|
|
966
|
+
}
|
|
967
|
+
if (status) {
|
|
968
|
+
status.has = 'hit';
|
|
969
|
+
this.#statusTTL(status, index);
|
|
970
|
+
}
|
|
971
|
+
return true;
|
|
972
|
+
}
|
|
973
|
+
else if (status) {
|
|
974
|
+
status.has = 'stale';
|
|
975
|
+
this.#statusTTL(status, index);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
else if (status) {
|
|
979
|
+
status.has = 'miss';
|
|
980
|
+
}
|
|
981
|
+
return false;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Like {@link LRUCache#get} but doesn't update recency or delete stale
|
|
985
|
+
* items.
|
|
986
|
+
*
|
|
987
|
+
* Returns `undefined` if the item is stale, unless
|
|
988
|
+
* {@link LRUCache.OptionsBase.allowStale} is set.
|
|
989
|
+
*/
|
|
990
|
+
peek(k, peekOptions = {}) {
|
|
991
|
+
const { allowStale = this.allowStale } = peekOptions;
|
|
992
|
+
const index = this.#keyMap.get(k);
|
|
993
|
+
if (index !== undefined &&
|
|
994
|
+
(allowStale || !this.#isStale(index))) {
|
|
995
|
+
const v = this.#valList[index];
|
|
996
|
+
// either stale and allowed, or forcing a refresh of non-stale value
|
|
997
|
+
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
#backgroundFetch(k, index, options, context) {
|
|
1001
|
+
const v = index === undefined ? undefined : this.#valList[index];
|
|
1002
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1003
|
+
return v;
|
|
1004
|
+
}
|
|
1005
|
+
const ac = new AC();
|
|
1006
|
+
const { signal } = options;
|
|
1007
|
+
// when/if our AC signals, then stop listening to theirs.
|
|
1008
|
+
signal?.addEventListener('abort', () => ac.abort(signal.reason), {
|
|
1009
|
+
signal: ac.signal,
|
|
1010
|
+
});
|
|
1011
|
+
const fetchOpts = {
|
|
1012
|
+
signal: ac.signal,
|
|
1013
|
+
options,
|
|
1014
|
+
context,
|
|
1015
|
+
};
|
|
1016
|
+
const cb = (v, updateCache = false) => {
|
|
1017
|
+
const { aborted } = ac.signal;
|
|
1018
|
+
const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
|
|
1019
|
+
if (options.status) {
|
|
1020
|
+
if (aborted && !updateCache) {
|
|
1021
|
+
options.status.fetchAborted = true;
|
|
1022
|
+
options.status.fetchError = ac.signal.reason;
|
|
1023
|
+
if (ignoreAbort)
|
|
1024
|
+
options.status.fetchAbortIgnored = true;
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
options.status.fetchResolved = true;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (aborted && !ignoreAbort && !updateCache) {
|
|
1031
|
+
return fetchFail(ac.signal.reason);
|
|
1032
|
+
}
|
|
1033
|
+
// either we didn't abort, and are still here, or we did, and ignored
|
|
1034
|
+
const bf = p;
|
|
1035
|
+
if (this.#valList[index] === p) {
|
|
1036
|
+
if (v === undefined) {
|
|
1037
|
+
if (bf.__staleWhileFetching) {
|
|
1038
|
+
this.#valList[index] = bf.__staleWhileFetching;
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
this.delete(k);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
else {
|
|
1045
|
+
if (options.status)
|
|
1046
|
+
options.status.fetchUpdated = true;
|
|
1047
|
+
this.set(k, v, fetchOpts.options);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return v;
|
|
1051
|
+
};
|
|
1052
|
+
const eb = (er) => {
|
|
1053
|
+
if (options.status) {
|
|
1054
|
+
options.status.fetchRejected = true;
|
|
1055
|
+
options.status.fetchError = er;
|
|
1056
|
+
}
|
|
1057
|
+
return fetchFail(er);
|
|
1058
|
+
};
|
|
1059
|
+
const fetchFail = (er) => {
|
|
1060
|
+
const { aborted } = ac.signal;
|
|
1061
|
+
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
1062
|
+
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
1063
|
+
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
1064
|
+
const bf = p;
|
|
1065
|
+
if (this.#valList[index] === p) {
|
|
1066
|
+
// if we allow stale on fetch rejections, then we need to ensure that
|
|
1067
|
+
// the stale value is not removed from the cache when the fetch fails.
|
|
1068
|
+
const del = !noDelete || bf.__staleWhileFetching === undefined;
|
|
1069
|
+
if (del) {
|
|
1070
|
+
this.delete(k);
|
|
1071
|
+
}
|
|
1072
|
+
else if (!allowStaleAborted) {
|
|
1073
|
+
// still replace the *promise* with the stale value,
|
|
1074
|
+
// since we are done with the promise at this point.
|
|
1075
|
+
// leave it untouched if we're still waiting for an
|
|
1076
|
+
// aborted background fetch that hasn't yet returned.
|
|
1077
|
+
this.#valList[index] = bf.__staleWhileFetching;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
if (allowStale) {
|
|
1081
|
+
if (options.status && bf.__staleWhileFetching !== undefined) {
|
|
1082
|
+
options.status.returnedStale = true;
|
|
1083
|
+
}
|
|
1084
|
+
return bf.__staleWhileFetching;
|
|
1085
|
+
}
|
|
1086
|
+
else if (bf.__returned === bf) {
|
|
1087
|
+
throw er;
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
const pcall = (res, rej) => {
|
|
1091
|
+
const fmp = this.#fetchMethod?.(k, v, fetchOpts);
|
|
1092
|
+
if (fmp && fmp instanceof Promise) {
|
|
1093
|
+
fmp.then(v => res(v), rej);
|
|
1094
|
+
}
|
|
1095
|
+
// ignored, we go until we finish, regardless.
|
|
1096
|
+
// defer check until we are actually aborting,
|
|
1097
|
+
// so fetchMethod can override.
|
|
1098
|
+
ac.signal.addEventListener('abort', () => {
|
|
1099
|
+
if (!options.ignoreFetchAbort ||
|
|
1100
|
+
options.allowStaleOnFetchAbort) {
|
|
1101
|
+
res();
|
|
1102
|
+
// when it eventually resolves, update the cache.
|
|
1103
|
+
if (options.allowStaleOnFetchAbort) {
|
|
1104
|
+
res = v => cb(v, true);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
};
|
|
1109
|
+
if (options.status)
|
|
1110
|
+
options.status.fetchDispatched = true;
|
|
1111
|
+
const p = new Promise(pcall).then(cb, eb);
|
|
1112
|
+
const bf = Object.assign(p, {
|
|
1113
|
+
__abortController: ac,
|
|
1114
|
+
__staleWhileFetching: v,
|
|
1115
|
+
__returned: undefined,
|
|
1116
|
+
});
|
|
1117
|
+
if (index === undefined) {
|
|
1118
|
+
// internal, don't expose status.
|
|
1119
|
+
this.set(k, bf, { ...fetchOpts.options, status: undefined });
|
|
1120
|
+
index = this.#keyMap.get(k);
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
this.#valList[index] = bf;
|
|
1124
|
+
}
|
|
1125
|
+
return bf;
|
|
1126
|
+
}
|
|
1127
|
+
#isBackgroundFetch(p) {
|
|
1128
|
+
if (!this.#hasFetchMethod)
|
|
1129
|
+
return false;
|
|
1130
|
+
const b = p;
|
|
1131
|
+
return (!!b &&
|
|
1132
|
+
b instanceof Promise &&
|
|
1133
|
+
b.hasOwnProperty('__staleWhileFetching') &&
|
|
1134
|
+
b.__abortController instanceof AC);
|
|
1135
|
+
}
|
|
1136
|
+
async fetch(k, fetchOptions = {}) {
|
|
1137
|
+
const {
|
|
1138
|
+
// get options
|
|
1139
|
+
allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet,
|
|
1140
|
+
// set options
|
|
1141
|
+
ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL,
|
|
1142
|
+
// fetch exclusive options
|
|
1143
|
+
noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions;
|
|
1144
|
+
if (!this.#hasFetchMethod) {
|
|
1145
|
+
if (status)
|
|
1146
|
+
status.fetch = 'get';
|
|
1147
|
+
return this.get(k, {
|
|
1148
|
+
allowStale,
|
|
1149
|
+
updateAgeOnGet,
|
|
1150
|
+
noDeleteOnStaleGet,
|
|
1151
|
+
status,
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
const options = {
|
|
1155
|
+
allowStale,
|
|
1156
|
+
updateAgeOnGet,
|
|
1157
|
+
noDeleteOnStaleGet,
|
|
1158
|
+
ttl,
|
|
1159
|
+
noDisposeOnSet,
|
|
1160
|
+
size,
|
|
1161
|
+
sizeCalculation,
|
|
1162
|
+
noUpdateTTL,
|
|
1163
|
+
noDeleteOnFetchRejection,
|
|
1164
|
+
allowStaleOnFetchRejection,
|
|
1165
|
+
allowStaleOnFetchAbort,
|
|
1166
|
+
ignoreFetchAbort,
|
|
1167
|
+
status,
|
|
1168
|
+
signal,
|
|
1169
|
+
};
|
|
1170
|
+
let index = this.#keyMap.get(k);
|
|
1171
|
+
if (index === undefined) {
|
|
1172
|
+
if (status)
|
|
1173
|
+
status.fetch = 'miss';
|
|
1174
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
1175
|
+
return (p.__returned = p);
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
// in cache, maybe already fetching
|
|
1179
|
+
const v = this.#valList[index];
|
|
1180
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1181
|
+
const stale = allowStale && v.__staleWhileFetching !== undefined;
|
|
1182
|
+
if (status) {
|
|
1183
|
+
status.fetch = 'inflight';
|
|
1184
|
+
if (stale)
|
|
1185
|
+
status.returnedStale = true;
|
|
1186
|
+
}
|
|
1187
|
+
return stale ? v.__staleWhileFetching : (v.__returned = v);
|
|
1188
|
+
}
|
|
1189
|
+
// if we force a refresh, that means do NOT serve the cached value,
|
|
1190
|
+
// unless we are already in the process of refreshing the cache.
|
|
1191
|
+
const isStale = this.#isStale(index);
|
|
1192
|
+
if (!forceRefresh && !isStale) {
|
|
1193
|
+
if (status)
|
|
1194
|
+
status.fetch = 'hit';
|
|
1195
|
+
this.#moveToTail(index);
|
|
1196
|
+
if (updateAgeOnGet) {
|
|
1197
|
+
this.#updateItemAge(index);
|
|
1198
|
+
}
|
|
1199
|
+
if (status)
|
|
1200
|
+
this.#statusTTL(status, index);
|
|
1201
|
+
return v;
|
|
1202
|
+
}
|
|
1203
|
+
// ok, it is stale or a forced refresh, and not already fetching.
|
|
1204
|
+
// refresh the cache.
|
|
1205
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
1206
|
+
const hasStale = p.__staleWhileFetching !== undefined;
|
|
1207
|
+
const staleVal = hasStale && allowStale;
|
|
1208
|
+
if (status) {
|
|
1209
|
+
status.fetch = isStale ? 'stale' : 'refresh';
|
|
1210
|
+
if (staleVal && isStale)
|
|
1211
|
+
status.returnedStale = true;
|
|
1212
|
+
}
|
|
1213
|
+
return staleVal ? p.__staleWhileFetching : (p.__returned = p);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Return a value from the cache. Will update the recency of the cache
|
|
1218
|
+
* entry found.
|
|
1219
|
+
*
|
|
1220
|
+
* If the key is not found, get() will return `undefined`.
|
|
1221
|
+
*/
|
|
1222
|
+
get(k, getOptions = {}) {
|
|
1223
|
+
const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions;
|
|
1224
|
+
const index = this.#keyMap.get(k);
|
|
1225
|
+
if (index !== undefined) {
|
|
1226
|
+
const value = this.#valList[index];
|
|
1227
|
+
const fetching = this.#isBackgroundFetch(value);
|
|
1228
|
+
if (status)
|
|
1229
|
+
this.#statusTTL(status, index);
|
|
1230
|
+
if (this.#isStale(index)) {
|
|
1231
|
+
if (status)
|
|
1232
|
+
status.get = 'stale';
|
|
1233
|
+
// delete only if not an in-flight background fetch
|
|
1234
|
+
if (!fetching) {
|
|
1235
|
+
if (!noDeleteOnStaleGet) {
|
|
1236
|
+
this.delete(k);
|
|
1237
|
+
}
|
|
1238
|
+
if (status && allowStale)
|
|
1239
|
+
status.returnedStale = true;
|
|
1240
|
+
return allowStale ? value : undefined;
|
|
1241
|
+
}
|
|
1242
|
+
else {
|
|
1243
|
+
if (status &&
|
|
1244
|
+
allowStale &&
|
|
1245
|
+
value.__staleWhileFetching !== undefined) {
|
|
1246
|
+
status.returnedStale = true;
|
|
1247
|
+
}
|
|
1248
|
+
return allowStale ? value.__staleWhileFetching : undefined;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
if (status)
|
|
1253
|
+
status.get = 'hit';
|
|
1254
|
+
// if we're currently fetching it, we don't actually have it yet
|
|
1255
|
+
// it's not stale, which means this isn't a staleWhileRefetching.
|
|
1256
|
+
// If it's not stale, and fetching, AND has a __staleWhileFetching
|
|
1257
|
+
// value, then that means the user fetched with {forceRefresh:true},
|
|
1258
|
+
// so it's safe to return that value.
|
|
1259
|
+
if (fetching) {
|
|
1260
|
+
return value.__staleWhileFetching;
|
|
1261
|
+
}
|
|
1262
|
+
this.#moveToTail(index);
|
|
1263
|
+
if (updateAgeOnGet) {
|
|
1264
|
+
this.#updateItemAge(index);
|
|
1265
|
+
}
|
|
1266
|
+
return value;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
else if (status) {
|
|
1270
|
+
status.get = 'miss';
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
#connect(p, n) {
|
|
1274
|
+
this.#prev[n] = p;
|
|
1275
|
+
this.#next[p] = n;
|
|
1276
|
+
}
|
|
1277
|
+
#moveToTail(index) {
|
|
1278
|
+
// if tail already, nothing to do
|
|
1279
|
+
// if head, move head to next[index]
|
|
1280
|
+
// else
|
|
1281
|
+
// move next[prev[index]] to next[index] (head has no prev)
|
|
1282
|
+
// move prev[next[index]] to prev[index]
|
|
1283
|
+
// prev[index] = tail
|
|
1284
|
+
// next[tail] = index
|
|
1285
|
+
// tail = index
|
|
1286
|
+
if (index !== this.#tail) {
|
|
1287
|
+
if (index === this.#head) {
|
|
1288
|
+
this.#head = this.#next[index];
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
this.#connect(this.#prev[index], this.#next[index]);
|
|
1292
|
+
}
|
|
1293
|
+
this.#connect(this.#tail, index);
|
|
1294
|
+
this.#tail = index;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Deletes a key out of the cache.
|
|
1299
|
+
* Returns true if the key was deleted, false otherwise.
|
|
1300
|
+
*/
|
|
1301
|
+
delete(k) {
|
|
1302
|
+
let deleted = false;
|
|
1303
|
+
if (this.#size !== 0) {
|
|
1304
|
+
const index = this.#keyMap.get(k);
|
|
1305
|
+
if (index !== undefined) {
|
|
1306
|
+
deleted = true;
|
|
1307
|
+
if (this.#size === 1) {
|
|
1308
|
+
this.clear();
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
this.#removeItemSize(index);
|
|
1312
|
+
const v = this.#valList[index];
|
|
1313
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1314
|
+
v.__abortController.abort(new Error('deleted'));
|
|
1315
|
+
}
|
|
1316
|
+
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
1317
|
+
if (this.#hasDispose) {
|
|
1318
|
+
this.#dispose?.(v, k, 'delete');
|
|
1319
|
+
}
|
|
1320
|
+
if (this.#hasDisposeAfter) {
|
|
1321
|
+
this.#disposed?.push([v, k, 'delete']);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
this.#keyMap.delete(k);
|
|
1325
|
+
this.#keyList[index] = undefined;
|
|
1326
|
+
this.#valList[index] = undefined;
|
|
1327
|
+
if (index === this.#tail) {
|
|
1328
|
+
this.#tail = this.#prev[index];
|
|
1329
|
+
}
|
|
1330
|
+
else if (index === this.#head) {
|
|
1331
|
+
this.#head = this.#next[index];
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
this.#next[this.#prev[index]] = this.#next[index];
|
|
1335
|
+
this.#prev[this.#next[index]] = this.#prev[index];
|
|
1336
|
+
}
|
|
1337
|
+
this.#size--;
|
|
1338
|
+
this.#free.push(index);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
if (this.#hasDisposeAfter && this.#disposed?.length) {
|
|
1343
|
+
const dt = this.#disposed;
|
|
1344
|
+
let task;
|
|
1345
|
+
while ((task = dt?.shift())) {
|
|
1346
|
+
this.#disposeAfter?.(...task);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return deleted;
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Clear the cache entirely, throwing away all values.
|
|
1353
|
+
*/
|
|
1354
|
+
clear() {
|
|
1355
|
+
for (const index of this.#rindexes({ allowStale: true })) {
|
|
1356
|
+
const v = this.#valList[index];
|
|
1357
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1358
|
+
v.__abortController.abort(new Error('deleted'));
|
|
1359
|
+
}
|
|
1360
|
+
else {
|
|
1361
|
+
const k = this.#keyList[index];
|
|
1362
|
+
if (this.#hasDispose) {
|
|
1363
|
+
this.#dispose?.(v, k, 'delete');
|
|
1364
|
+
}
|
|
1365
|
+
if (this.#hasDisposeAfter) {
|
|
1366
|
+
this.#disposed?.push([v, k, 'delete']);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
this.#keyMap.clear();
|
|
1371
|
+
this.#valList.fill(undefined);
|
|
1372
|
+
this.#keyList.fill(undefined);
|
|
1373
|
+
if (this.#ttls && this.#starts) {
|
|
1374
|
+
this.#ttls.fill(0);
|
|
1375
|
+
this.#starts.fill(0);
|
|
1376
|
+
}
|
|
1377
|
+
if (this.#sizes) {
|
|
1378
|
+
this.#sizes.fill(0);
|
|
1379
|
+
}
|
|
1380
|
+
this.#head = 0;
|
|
1381
|
+
this.#tail = 0;
|
|
1382
|
+
this.#free.length = 0;
|
|
1383
|
+
this.#calculatedSize = 0;
|
|
1384
|
+
this.#size = 0;
|
|
1385
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
1386
|
+
const dt = this.#disposed;
|
|
1387
|
+
let task;
|
|
1388
|
+
while ((task = dt?.shift())) {
|
|
1389
|
+
this.#disposeAfter?.(...task);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
exports.LRUCache = LRUCache;
|
|
1395
|
+
//# sourceMappingURL=index.js.map
|