@toapi/worker 1.2.2 → 1.2.4

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/dist/cache.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EXPIRES_AT_HEADER, TAGS_HEADER } from "@toapi/common";
2
- import { deleteDB, openDB } from "./idb";
2
+ import { deleteDB, openDB } from "./idb.js";
3
3
  const DB_NAME = "tapi-cache-meta";
4
4
  const CACHE_NAME = "tapi-cache";
5
5
  const DB_VERSION = 1;
package/dist/cleanup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { META_STORE_NAME, TAGS_STORE_NAME, openCache, openCacheMetaDB, } from "./cache";
1
+ import { META_STORE_NAME, TAGS_STORE_NAME, openCache, openCacheMetaDB, } from "./cache.js";
2
2
  /**
3
3
  * Reconcile the worker's cache and metadata stores. Intended to be called
4
4
  * from the service worker's `activate` event:
@@ -1,8 +1,8 @@
1
1
  import { isMutation } from "@toapi/common";
2
- import { getCachedEntry, getMetadata } from "./cache";
3
- import { mutateAndInvalidate } from "./mutate-and-invalidate";
4
- import { serveFromNetwork } from "./serve-from-network";
5
- import { consoleFallback } from "./console-fallback";
2
+ import { getCachedEntry, getMetadata } from "./cache.js";
3
+ import { mutateAndInvalidate } from "./mutate-and-invalidate.js";
4
+ import { serveFromNetwork } from "./serve-from-network.js";
5
+ import { consoleFallback } from "./console-fallback.js";
6
6
  export async function handleToapiRequest(req, options) {
7
7
  const logger = consoleFallback(options?.logger);
8
8
  if (isMutation(req)) {
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export type { Logger } from "@toapi/common";
2
- export { cleanup } from "./cleanup";
3
- export type { CleanupOptions } from "./cleanup";
4
- export { handleToapiRequest, handleTapiRequest } from "./handle-toapi-request";
5
- export { listenForInvalidations } from "./revalidation-stream";
6
- export { setupToapiWorker } from "./setup";
7
- export type { SetupToapiWorkerOptions } from "./setup";
2
+ export { cleanup } from "./cleanup.js";
3
+ export type { CleanupOptions } from "./cleanup.js";
4
+ export { handleToapiRequest, handleTapiRequest } from "./handle-toapi-request.js";
5
+ export { listenForInvalidations } from "./revalidation-stream.js";
6
+ export { setupToapiWorker } from "./setup.js";
7
+ export type { SetupToapiWorkerOptions } from "./setup.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { cleanup } from "./cleanup";
2
- export { handleToapiRequest, handleTapiRequest } from "./handle-toapi-request";
3
- export { listenForInvalidations } from "./revalidation-stream";
4
- export { setupToapiWorker } from "./setup";
1
+ export { cleanup } from "./cleanup.js";
2
+ export { handleToapiRequest, handleTapiRequest } from "./handle-toapi-request.js";
3
+ export { listenForInvalidations } from "./revalidation-stream.js";
4
+ export { setupToapiWorker } from "./setup.js";
@@ -1,5 +1,5 @@
1
1
  import { TAGS_HEADER } from "@toapi/common";
2
- import { invalidateTags } from "./cache";
2
+ import { invalidateTags } from "./cache.js";
3
3
  export async function mutateAndInvalidate(req) {
4
4
  const res = await fetch(req);
5
5
  const tags = res.headers.get(TAGS_HEADER)?.split(" ")?.filter(Boolean) ?? [];
@@ -1,6 +1,6 @@
1
1
  import { INVALIDATION_POST_EVENT, TAGS_CONTENT_TYPE, } from "@toapi/common";
2
- import { deleteCache, expireAll, invalidateTags } from "./cache";
3
- import { consoleFallback } from "./console-fallback";
2
+ import { deleteCache, expireAll, invalidateTags } from "./cache.js";
3
+ import { consoleFallback } from "./console-fallback.js";
4
4
  export async function listenForInvalidations({ url, timeout = 5000, logger: customLogger, }) {
5
5
  const logger = consoleFallback(customLogger);
6
6
  logger.info("Listening for invalidations...");
@@ -1,5 +1,5 @@
1
1
  import { EXPIRES_AT_HEADER, TAGS_HEADER } from "@toapi/common";
2
- import { deleteCacheEntry, storeCacheEntry } from "./cache";
2
+ import { deleteCacheEntry, storeCacheEntry } from "./cache.js";
3
3
  export async function serveFromNetwork(req) {
4
4
  const res = await fetch(req);
5
5
  // only cache ok responses with tags or expires-at header
package/dist/setup.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { INVALIDATIONS_ROUTE } from "@toapi/common";
2
- import { cleanup } from "./cleanup";
3
- import { handleToapiRequest } from "./handle-toapi-request";
4
- import { listenForInvalidations } from "./revalidation-stream";
5
- import { consoleFallback } from "./console-fallback";
2
+ import { cleanup } from "./cleanup.js";
3
+ import { handleToapiRequest } from "./handle-toapi-request.js";
4
+ import { listenForInvalidations } from "./revalidation-stream.js";
5
+ import { consoleFallback } from "./console-fallback.js";
6
6
  const ONE_WEEK_SECONDS = 60 * 60 * 24 * 7;
7
7
  /**
8
8
  * Wire up the whole Toapi service worker in a single call. This registers the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toapi/worker",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "author": {
5
5
  "name": "Michel Smola",
6
6
  "email": "michel.smola@farbenmeer.de"
@@ -20,7 +20,7 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@toapi/common": "^1.2.2"
23
+ "@toapi/common": "^1.2.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^25.0.3",