@happyvertical/smrt-playbooks 0.51.32 → 0.51.33

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=__smrt-register__.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import type { DatabaseInterface } from '@happyvertical/sql';
2
+ import type { PlaybookCacheValue } from './types.js';
3
+ /**
4
+ * The cache namespace a database handle resolves to.
5
+ *
6
+ * Exported so the preflight cache (#2590) partitions by the same database
7
+ * identity this cache does, rather than growing a second, divergent notion of
8
+ * "which database is this".
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function playbookCacheNamespace(db: unknown): string;
13
+ export declare function getPlaybookCacheTtlMs(): number;
14
+ export declare function getCachedPlaybookBase(key: string, tenantId: string | null | undefined, db: DatabaseInterface | unknown): PlaybookCacheValue | null;
15
+ /**
16
+ * Reads the current invalidation generation for a key.
17
+ *
18
+ * A resolution captures this *before* its asynchronous layer loads and hands
19
+ * it back to {@link setCachedPlaybookBase}. Any write that lands while those
20
+ * loads are in flight bumps the generation, so the in-flight resolution — which
21
+ * read the pre-write layers — is refused the cache write instead of
22
+ * repopulating the key it just invalidated. Without this, the acceptance rule
23
+ * "a stale entry is never served after a write" held only until a read raced a
24
+ * write, and then failed for the full TTL.
25
+ *
26
+ * Tracked per `(db, key)` rather than per `(db, key, tenantId)`: an app-level
27
+ * row is inherited by every tenant, so a write to any scope of a key must
28
+ * invalidate every scope of it.
29
+ */
30
+ export declare function getPlaybookCacheGeneration(key: string, db: DatabaseInterface | unknown): number;
31
+ export declare function setCachedPlaybookBase(key: string, tenantId: string | null | undefined, db: DatabaseInterface | unknown, value: PlaybookCacheValue, loadedAtGeneration: number): void;
32
+ /**
33
+ * Invalidates a cached resolution. An app-level write (tenantId null) clears
34
+ * every tenant's entry for that key, because each tenant inherits from it.
35
+ */
36
+ export declare function invalidatePlaybookCache(key: string, tenantId: string | null | undefined, db: DatabaseInterface | unknown): void;
37
+ export declare function clearPlaybookCache(): void;
38
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgDrD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAE1D;AAyBD,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,EAAE,EAAE,iBAAiB,GAAG,OAAO,GAC9B,kBAAkB,GAAG,IAAI,CAc3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,iBAAiB,GAAG,OAAO,GAC9B,MAAM,CAER;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,EAAE,EAAE,iBAAiB,GAAG,OAAO,EAC/B,KAAK,EAAE,kBAAkB,EACzB,kBAAkB,EAAE,MAAM,GACzB,IAAI,CAWN;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,EAAE,EAAE,iBAAiB,GAAG,OAAO,GAC9B,IAAI,CAeN;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAUzC"}
@@ -0,0 +1,19 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { PlaybookOverride } from '../models/PlaybookOverride.js';
3
+ export declare class PlaybookOverrideCollection extends SmrtCollection<PlaybookOverride> {
4
+ static readonly _itemClass: typeof PlaybookOverride;
5
+ private excludeOverrideId;
6
+ getAppOverride(key: string, options?: {
7
+ excludeId?: string;
8
+ }): Promise<PlaybookOverride | null>;
9
+ getTenantOverride(key: string, tenantId: string, options?: {
10
+ excludeId?: string;
11
+ }): Promise<PlaybookOverride | null>;
12
+ getResolutionLayers(key: string, tenantId?: string | null, options?: {
13
+ excludeId?: string;
14
+ }): Promise<{
15
+ app: PlaybookOverride | null;
16
+ tenant: PlaybookOverride | null;
17
+ }>;
18
+ }
19
+ //# sourceMappingURL=PlaybookOverrideCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaybookOverrideCollection.d.ts","sourceRoot":"","sources":["../../src/collections/PlaybookOverrideCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IAC9E,MAAM,CAAC,QAAQ,CAAC,UAAU,0BAAoB;IAE9C,OAAO,CAAC,iBAAiB;IAOnB,cAAc,CAClB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAK7B,iBAAiB,CACrB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAK7B,mBAAmB,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC;QACT,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAC7B,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;KACjC,CAAC;CAUH"}