Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move getCachePlugin to shared #799

Merged
merged 1 commit into from
May 3, 2023
Merged

Conversation

dominique-pfister
Copy link
Contributor

@dominique-pfister dominique-pfister commented May 3, 2023

... and add a location to the cache plugin

@github-actions
Copy link

github-actions bot commented May 3, 2023

This PR will trigger a minor release when merged.

@@ -26,4 +26,6 @@ export declare class FSCachePlugin implements ICachePlugin {
afterCacheAccess(tokenCacheContext: TokenCacheContext): Promise<boolean>;

beforeCacheAccess(tokenCacheContext: TokenCacheContext): Promise<boolean>;

location: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all cache plugins now have a location

Comment on lines +114 to +116
get location() {
return `${this.bucket}/${this.key}`;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for S3, the location is just the S3 URI

* @returns {ICachePlugin} the cache plugin
*/
export async function getCachePlugin(opts, type) {
const { log, contentBusId } = opts;
Copy link
Contributor Author

@dominique-pfister dominique-pfister May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the content bus id is expected in opts, all clients currently have an extra context as first argument in their implementation of getCachePlugin.

Comment on lines +89 to +91
get location() {
return this.base ? this.base.location : this.key;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when a MemCachePlugin has a base plugin, show that location

@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Merging #799 (9febaf3) into main (c9e92db) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #799      +/-   ##
==========================================
+ Coverage   99.10%   99.11%   +0.01%     
==========================================
  Files          47       48       +1     
  Lines        4786     4850      +64     
  Branches        9        9              
==========================================
+ Hits         4743     4807      +64     
  Misses         43       43              
Impacted Files Coverage Δ
...kages/helix-shared-tokencache/src/FSCachePlugin.js 100.00% <100.00%> (ø)
...ages/helix-shared-tokencache/src/MemCachePlugin.js 100.00% <100.00%> (ø)
...kages/helix-shared-tokencache/src/S3CachePlugin.js 100.00% <100.00%> (ø)
...ages/helix-shared-tokencache/src/getCachePlugin.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dominique-pfister dominique-pfister merged commit 939b2b2 into main May 3, 2023
@dominique-pfister dominique-pfister deleted the move-cache-plugin branch May 3, 2023 10:48
tripodsan pushed a commit that referenced this pull request May 3, 2023
@tripodsan
Copy link
Contributor

🎉 This PR is included in version @adobe/helix-shared-tokencache-v1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

adobe-bot pushed a commit that referenced this pull request Jan 21, 2024
# [8.0.0](v7.29.1...v8.0.0) (2024-01-21)

### Bug Fixes

* @adobe/helix-fetch -> @adobe/helix ([0d05930](0d05930))
* add back innerHTML ([#694](#694)) ([5965a44](5965a44))
* add mocha ([#631](#631)) ([2849219](2849219))
* add url to github mount ([#526](#526)) ([5f989bf](5f989bf))
* allow adding sitemap or languages ([#690](#690)) ([5f095ef](5f095ef))
* **body-data:** reduce eagerness to coerce numbers ([6926f34](6926f34)), closes [#580](#580)
* **bounce:** add better error handling for promise rejections in bounce ([0341743](0341743))
* **bounce:** add timeout to http request, shorten default timeout ([998d87d](998d87d))
* **bounce:** guard against incomplete context ([380cdd0](380cdd0))
* **bounce:** guard against missing `context.invocation` ([e72e5b9](e72e5b9))
* **bounce:** prevent the process from hanging ([3085161](3085161))
* **bounce:** quick responder function should wait as little as possible ([0fc4256](0fc4256))
* **bounce:** re-build request from `request.init` ([da0797b](da0797b))
* **bounce:** trigger release ([f7f52bf](f7f52bf))
* **bounce:** use modified headers, not just original headers ([e8474cf](e8474cf))
* **build:** create monorepo ([9bef792](9bef792)), closes [#444](#444)
* catch unsupported selectors ([#761](#761)) ([59b3f8f](59b3f8f))
* correct export ([6b36f3b](6b36f3b))
* create release ([91d16e0](91d16e0))
* default path for name-function and usage example ([#880](#880)) ([e8d932a](e8d932a))
* **deps:** downgrade @semantic-release/npm to 9.0.2 again ([#793](#793)) ([14e7611](14e7611))
* **deps:** remove [email protected] by updating helix-shared-git dependency ([#800](#800)) ([73f24d2](73f24d2))
* **deps:** update adobe fixes ([0e2b0a5](0e2b0a5))
* **deps:** update adobe fixes ([067f1bb](067f1bb))
* **deps:** update adobe fixes ([#497](#497)) ([1864a7f](1864a7f))
* **deps:** update adobe fixes ([#520](#520)) ([6fae196](6fae196))
* **deps:** update adobe fixes ([#775](#775)) ([74feecb](74feecb))
* **deps:** update adobe fixes ([#785](#785)) ([7a3bb0f](7a3bb0f))
* **deps:** update adobe fixes ([#787](#787)) ([b065890](b065890))
* **deps:** update adobe fixes ([#842](#842)) ([45060ff](45060ff))
* **deps:** update dependency @adobe/fetch to ^4.0.1 ([#756](#756)) ([41fccd4](41fccd4))
* **deps:** update dependency @adobe/fetch to v3.2.0 ([#721](#721)) ([12ea8bc](12ea8bc))
* **deps:** update dependency @adobe/fetch to v3.3.0 ([#726](#726)) ([2dc6fcf](2dc6fcf))
* **deps:** update dependency @adobe/fetch to v4.0.12 ([#806](#806)) ([74e3fa5](74e3fa5))
* **deps:** update dependency @adobe/fetch to v4.0.7 ([#784](#784)) ([fc995a8](fc995a8))
* **deps:** update dependency @adobe/fetch to v4.1.1 ([#863](#863)) ([fb52443](fb52443))
* **deps:** update dependency @adobe/helix-fetch to v2.4.2 ([#543](#543)) ([d06e0c4](d06e0c4))
* **deps:** update dependency @adobe/helix-fetch to v3 ([bb7b3d4](bb7b3d4))
* **deps:** update dependency @adobe/helix-fetch to v3.0.9 ([#670](#670)) ([768d02f](768d02f))
* **deps:** update dependency @adobe/helix-universal to v1.6.12 ([#565](#565)) ([f3e7468](f3e7468))
* **deps:** update dependency @adobe/helix-universal to v1.8.1 ([#587](#587)) ([7c05aea](7c05aea))
* **deps:** update dependency @adobe/helix-universal to v1.9.1 ([#602](#602)) ([fc9987a](fc9987a))
* **deps:** update dependency @adobe/helix-universal to v2 ([#617](#617)) ([0d06223](0d06223))
* **deps:** update dependency @adobe/helix-universal to v2.0.1 ([#621](#621)) ([fab5d6a](fab5d6a))
* **deps:** update dependency @adobe/helix-universal to v3 ([#625](#625)) ([cd33862](cd33862))
* **deps:** update dependency @adobe/helix-universal to v3.0.1 ([da807ff](da807ff))
* **deps:** update dependency @adobe/helix-universal to v3.0.2 ([01ffe0e](01ffe0e))
* **deps:** update dependency @aws-sdk/client-s3 to v3.359.0 ([#818](#818)) ([1616f98](1616f98))
* **deps:** update dependency @aws-sdk/client-s3 to v3.367.0 ([#821](#821)) ([213948a](213948a))
* **deps:** update dependency @aws-sdk/client-s3 to v3.478.0 ([91c46e1](91c46e1))
* **deps:** update dependency @aws-sdk/client-s3 to v3.484.0 ([20fbd78](20fbd78))
* **deps:** update dependency @aws-sdk/client-s3 to v3.496.0 ([26e4636](26e4636))
* **deps:** update dependency ajv to v8.6.0 ([2cbd4d3](2cbd4d3))
* **deps:** update dependency ferrum to v1.9.3 ([#568](#568)) ([2f7516f](2f7516f))
* **deps:** update dependency fs-extra to v10.1.0 ([#673](#673)) ([290378c](290378c))
* **deps:** update dependency fs-extra to v11.1.1 ([#860](#860)) ([1a70f39](1a70f39))
* **deps:** update dependency fs-extra to v11.1.1 ([#862](#862)) ([03f3c65](03f3c65))
* **deps:** update dependency fs-extra to v11.2.0 ([4e819b3](4e819b3))
* **deps:** update dependency lint-staged to v12 ([#599](#599)) ([5ccc345](5ccc345))
* **deps:** update dependency lru-cache to v7 ([#647](#647)) ([4feaa27](4feaa27))
* **deps:** update dependency lru-cache to v7.7.3 ([#666](#666)) ([3935048](3935048))
* **deps:** update dependency lru-cache to v8 ([#774](#774)) ([07aa5ba](07aa5ba))
* **deps:** update dependency lru-cache to v9 ([#783](#783)) ([1b454af](1b454af))
* **deps:** update dependency moment to v2.29.4 ([aa03d49](aa03d49))
* **deps:** update dependency object-hash to v2.2.0 ([07b40d1](07b40d1))
* **deps:** update dependency object-hash to v3 ([d79b768](d79b768))
* **deps:** update dependency yaml to v2 and remove unused configs ([e2fd978](e2fd978))
* **deps:** update dependency yaml to v2.3.2 ([#841](#841)) ([200d590](200d590))
* **deps:** update dependency yaml to v2.3.2 ([#844](#844)) ([14c9b26](14c9b26))
* **deps:** update dependency yaml to v2.3.2 ([#851](#851)) ([35021fa](35021fa))
* **deps:** update external fixes ([9abd444](9abd444))
* **deps:** update external fixes ([eaf2543](eaf2543))
* **deps:** update external fixes ([76b6024](76b6024))
* **deps:** update external fixes ([57ec4b1](57ec4b1))
* **deps:** update external fixes ([08161b3](08161b3))
* **deps:** update external fixes ([6d20238](6d20238))
* **deps:** update external fixes ([d7641d8](d7641d8))
* **deps:** update external fixes ([fb55e25](fb55e25))
* **deps:** update external fixes ([24c8309](24c8309))
* **deps:** update external fixes ([cdddbc5](cdddbc5))
* **deps:** update external fixes ([06e6c6e](06e6c6e))
* **deps:** update external fixes ([fdbdea1](fdbdea1))
* **deps:** update external fixes ([2d80dbd](2d80dbd))
* **deps:** update external fixes ([3325d4d](3325d4d))
* **deps:** update external fixes ([a8dc79e](a8dc79e))
* **deps:** update external fixes ([f055338](f055338))
* **deps:** update external fixes ([94dbdfd](94dbdfd))
* **deps:** update external fixes ([ad49a64](ad49a64))
* **deps:** update external fixes ([#498](#498)) ([8e99853](8e99853))
* **deps:** update external fixes ([#506](#506)) ([6f237fe](6f237fe))
* **deps:** update external fixes ([#567](#567)) ([0ce7d79](0ce7d79))
* **deps:** update external fixes ([#654](#654)) ([fc6c499](fc6c499))
* **deps:** update external fixes ([#665](#665)) ([fb2322d](fb2322d))
* **deps:** update external fixes ([#668](#668)) ([d32918b](d32918b))
* **deps:** update external fixes ([#669](#669)) ([abf4a21](abf4a21))
* **deps:** update external fixes ([#680](#680)) ([75dc78e](75dc78e))
* **deps:** update external fixes ([#742](#742)) ([94ba5fc](94ba5fc))
* **deps:** update external fixes ([#745](#745)) ([67f9cf6](67f9cf6))
* **deps:** update external fixes ([#803](#803)) ([2ddf050](2ddf050))
* **deps:** update external fixes ([#808](#808)) ([797e067](797e067))
* **deps:** update external fixes ([#812](#812)) ([a7e9598](a7e9598))
* **deps:** update external fixes ([#813](#813)) ([ea2d8fd](ea2d8fd))
* **deps:** update external fixes ([#815](#815)) ([c76c8ba](c76c8ba))
* **deps:** update external fixes ([#817](#817)) ([86f672f](86f672f))
* **deps:** update external fixes ([#819](#819)) ([d617f47](d617f47))
* **deps:** update external fixes ([#822](#822)) ([c70b431](c70b431))
* **deps:** update external fixes ([#824](#824)) ([8c57e81](8c57e81))
* **deps:** update external fixes ([#826](#826)) ([a0d260b](a0d260b))
* **deps:** update external fixes ([#830](#830)) ([f182b55](f182b55))
* **deps:** update external fixes ([#831](#831)) ([c1398ec](c1398ec))
* **deps:** update external fixes ([#832](#832)) ([f42ffaf](f42ffaf))
* **deps:** update external fixes ([#836](#836)) ([2000b91](2000b91))
* **deps:** update external fixes ([#840](#840)) ([1337f74](1337f74))
* **deps:** update external fixes ([#843](#843)) ([1651b26](1651b26))
* **deps:** update external fixes ([#845](#845)) ([f638637](f638637))
* **deps:** update external fixes ([#850](#850)) ([33f858a](33f858a))
* **deps:** update external fixes ([#853](#853)) ([d6f4dd2](d6f4dd2))
* **deps:** update external fixes ([#854](#854)) ([646c4f2](646c4f2))
* **deps:** update external fixes ([#856](#856)) ([40b83df](40b83df))
* **deps:** update external fixes ([#859](#859)) ([07f9109](07f9109))
* **deps:** update external fixes ([#868](#868)) ([e73fca1](e73fca1))
* **deps:** update external fixes ([#870](#870)) ([c549fe1](c549fe1))
* **deps:** update external fixes ([#872](#872)) ([e12321d](e12321d))
* **deps:** update external fixes ([#889](#889)) ([d44f945](d44f945))
* **deps:** update external major ([#738](#738)) ([931219f](931219f))
* **deps:** update external major ([#864](#864)) ([cfa60a9](cfa60a9))
* **deps:** update external major ([#866](#866)) ([642e342](642e342))
* don't pin helix-fetch and universal for better deduping ([#639](#639)) ([d4f4060](d4f4060))
* don't throw error if context is invalid ([#757](#757)) ([3b6ec5d](3b6ec5d))
* downgrade semantic-release/npm ([99bcf1d](99bcf1d))
* export getCachePlugin in index.js ([39f6c9c](39f6c9c))
* export SitemapConfig ([5074666](5074666))
* fetch and source should be optional ([#533](#533)) ([a962662](a962662))
* fix release ([e8c058e](e8c058e))
* fix webcrypto calls for non-node env ([dead3d4](dead3d4))
* ignore non body bearing methods for json and form-data ([#630](#630)) ([1473d7b](1473d7b)), closes [#593](#593)
* improve context checks ([#758](#758)) ([d22e740](d22e740))
* increase timeout for slow tests ([c1454e9](c1454e9))
* issues 837/838 ([#839](#839)) ([94c7e93](94c7e93))
* keep trailing slash in relPath of matched mountpoint ([205d1f2](205d1f2))
* log error and stack as well ([1efda5e](1efda5e))
* match should enforce array input ([#835](#835)) ([91874c9](91874c9))
* plugin metadata lost on cache update ([#825](#825)) ([44ccdba](44ccdba))
* prevent prototype pollution ([#765](#765)) ([b6d1677](b6d1677))
* proxy clone to not change original configuration ([#686](#686)) ([96f9ce7](96f9ce7))
* reduce dependencies ([#537](#537)) ([289942b](289942b))
* replace jsdom with rehype ([#691](#691)) ([be2c049](be2c049))
* replace jsdom with rehype-parse ([4c83a85](4c83a85))
* reverse order of cache locations ([#807](#807)) ([101d09e](101d09e))
* Revert "chore: use semantic-release-monorepo-esm ([#867](#867))" ([#878](#878)) ([4b48a4f](4b48a4f))
* **sitemap:** create a separate context for each sitemap ([a27e80b](a27e80b))
* **sitemap:** use h1 ([25a4f97](25a4f97))
* suppress deprecation warning (maxAge has been replaced by ttl) ([#678](#678)) ([7fb2df9](7fb2df9))
* trigger release ([93aaa05](93aaa05))
* trigger release ([5804493](5804493))
* update renovate config to auto detect pin versions ([#644](#644)) ([3ae0423](3ae0423))
* Update semantic-release.yaml ([879e6df](879e6df))
* use and export ValidationError ([#532](#532)) ([0c11d92](0c11d92))
* use correct deps ([6398a43](6398a43))
* use esm ([1ee2a3a](1ee2a3a))
* use Jsep.Field instead of strings ([#869](#869)) ([df2e6da](df2e6da))

### Features

* add contains method and improve index config schema ([97c5134](97c5134))
* add folders to fstab ([c91fcda](c91fcda))
* add hashContentBusId ([#732](#732)) ([595c980](595c980))
* add helix-shared-secrets ([#752](#752)) ([0791f53](0791f53))
* add IMS wrapper ([bb52f86](bb52f86))
* add index configuration ([#684](#684)) ([2cdec6f](2cdec6f))
* add modifiers config ([0016e95](0016e95))
* add shared index ([#604](#604)) ([e915251](e915251))
* add support for debounce function ([#664](#664)) ([70864a8](70864a8))
* add support for iterables ([#600](#600)) ([d480b4d](d480b4d))
* add support for owner global connected users ([b9a27a1](b9a27a1)), closes [#798](#798)
* allow to specify microsoft tenantid for custom domains ([#698](#698)) ([d5b7744](d5b7744))
* **bounce:** add new middleware to bounce slow running functions and get a fast response ([4b5fe31](4b5fe31))
* **bounce:** allow debouncing by setting the `HELIX_DEBOUNCE` environment variable ([dea1558](dea1558))
* **config:** add ignore config, parser ([#542](#542)) ([c95ca88](c95ca88))
* delete generated index configuration ([#792](#792)) ([f08aac7](f08aac7))
* export loadSecrets() ([#814](#814)) ([fa1bab8](fa1bab8))
* improve cross platform compatibilty with conditional crypto import ([b5a1111](b5a1111))
* Improve process queue ([350515e](350515e)), closes [#735](#735)
* introduce helix-sitemap.yaml ([#575](#575)) ([900fe9f](900fe9f))
* move getCachePlugin to shared ([#799](#799)) ([939b2b2](939b2b2))
* move tokencache plugin from onedrive support ([11ec507](11ec507))
* provide support for plugin metadata ([#823](#823)) ([5af56f6](5af56f6))
* replace index definition ([#714](#714)) ([88b6389](88b6389))
* **schema:** add schemas for helix-data-embed ([#507](#507)) ([4563e25](4563e25)), closes [/github.com/adobe/helix-data-embed/pull/356#issuecomment-836357581](https://github.com//github.com/adobe/helix-data-embed/pull/356/issues/issuecomment-836357581)
* set origin of sitemap ([#820](#820)) ([ad12143](ad12143))
* **sitemap:** allow resetting the fetch context ([df861d8](df861d8))
* **sitemap:** propagate resets ([41f77ab](41f77ab))
* **sitemaps:** add `getContents()` and `getXML()` methods to retrieve sitemap content ([ee3fb07](ee3fb07))
* support dynamic options ([#566](#566)) ([8a3aff1](8a3aff1))
* support multiple hreflangs in sitemap ([#802](#802)) ([6fcba40](6fcba40))
* support resolving secrets name via function ([#879](#879)) ([841e7a0](841e7a0))
* target URI should be allowed relative ([#597](#597)) ([d8327c3](d8327c3))
* use base64url encoding for surrogate computation ([#622](#622)) ([8ad0fc0](8ad0fc0))

### BREAKING CHANGES

* requires ESM
* return value of handler is added to result set if the value defined.

- fix TS types
- add support for async generators
* relPath keeps trailing slash after resolution
* convert to esm
* turn library into ESM
* moved to ESM
* moved to ESM and removed innerHTML

* chore: remove comment

* fix: remove typo

* fix: turn parse errors silent again

* fix: apply merges from main

* fix: merge conflict
* **deps:** redirects, markup and helix-config removed
* the encoding for surrogate computation changed from the regular to the url-safe base64 encoding. i.e. '+' -> '-', '/' -> '_'.
@adobe-bot
Copy link

🎉 This PR is included in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants