@getstrata/core 0.5.18 → 0.5.20

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.
@@ -2108,7 +2108,6 @@ var db = new Proxy(function database() {}, {
2108
2108
  return typeof value === "function" ? value.bind(connection) : value;
2109
2109
  }
2110
2110
  });
2111
- var connection_default = db;
2112
2111
 
2113
2112
  // ../../src/modules/user/apiTokenTable.ts
2114
2113
  var apiTokenTable = defineTable({
@@ -20,6 +20,7 @@ export { default as MembershipService, resolveMembershipService, } from "../core
20
20
  export { Policy, PolicyGate } from "../core/auth/policy.ts";
21
21
  export { createScimAuthMiddleware } from "../core/auth/scimAuthMiddleware.ts";
22
22
  export { type CacheDriver, type CreateCacheStoreOptions, createCacheStore, } from "../core/cache/createCacheStore.ts";
23
+ export { cacheTagsForModelWrite, discoverModelTableNames } from "../core/cache/modelCacheTags.ts";
23
24
  export { default as CacheRepository } from "../core/cache/repository.ts";
24
25
  export { CACHE_TAGS } from "../core/cache/tags.ts";
25
26
  export type { DatabaseConnection } from "../core/database/baseRepository.ts";
package/dist/index.js CHANGED
@@ -3920,6 +3920,23 @@ function createCacheStore(options) {
3920
3920
  }
3921
3921
  return new simpleCacheStore_default(new simpleCache_default(options.ttlMs, options.maxEntries));
3922
3922
  }
3923
+ // ../../src/bootstrap/discoverModules.ts
3924
+ var appModules = [];
3925
+ function discoverModules() {
3926
+ return appModules;
3927
+ }
3928
+
3929
+ // ../../src/bootstrap/cache/modelCacheTags.ts
3930
+ function cacheTagsForModelWrite(tableName, action) {
3931
+ const module = discoverModules().find((entry) => entry.tableName === tableName);
3932
+ const baseTags = module?.cacheTags ?? [`${tableName}s`];
3933
+ const isDelete = action === "deleted" || action === "force-deleted";
3934
+ const extraTags = isDelete ? module?.cacheDeleteExtraTags ?? [] : [];
3935
+ return [...new Set([...baseTags, ...extraTags])];
3936
+ }
3937
+ function discoverModelTableNames() {
3938
+ return discoverModules().map((module) => module.tableName).filter((tableName) => tableName !== undefined);
3939
+ }
3923
3940
  // ../../src/core/cache/taggedCache.ts
3924
3941
  class TaggedCache {
3925
3942
  store;
@@ -6804,6 +6821,7 @@ export {
6804
6821
  etagFromResource,
6805
6822
  emptyPaginateResult,
6806
6823
  emailRule,
6824
+ discoverModelTableNames,
6807
6825
  dehydrateValue,
6808
6826
  defineTable,
6809
6827
  currentTraceId,
@@ -6853,6 +6871,7 @@ export {
6853
6871
  composeMiddleware,
6854
6872
  compileBlueprint,
6855
6873
  collectQueueMetrics,
6874
+ cacheTagsForModelWrite,
6856
6875
  cache,
6857
6876
  buildSmtpPayload,
6858
6877
  buildRequestCacheKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/core",
3
- "version": "0.5.18",
3
+ "version": "0.5.20",
4
4
  "description": "Strata — Laravel-inspired Bun framework public API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- export { appModules, discoverModules } from "./discoverModules";
@@ -1,14 +0,0 @@
1
- interface RegisteredRoute {
2
- method: string;
3
- path: string;
4
- middleware: string[];
5
- }
6
- declare class RouteRegistry {
7
- private readonly routes;
8
- register(route: RegisteredRoute): void;
9
- clear(): void;
10
- list(): RegisteredRoute[];
11
- }
12
- declare const routeRegistry: RouteRegistry;
13
- export type { RegisteredRoute };
14
- export { RouteRegistry, routeRegistry };