@oxyhq/core 3.8.1 → 3.8.2
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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/HttpService.js +18 -4
- package/dist/cjs/mixins/OxyServices.applications.js +69 -6
- package/dist/cjs/mixins/OxyServices.assets.js +16 -3
- package/dist/cjs/mixins/OxyServices.features.js +47 -10
- package/dist/cjs/mixins/OxyServices.managedAccounts.js +29 -3
- package/dist/cjs/mixins/OxyServices.privacy.js +34 -8
- package/dist/cjs/mixins/OxyServices.topics.js +5 -1
- package/dist/cjs/mixins/OxyServices.user.js +11 -2
- package/dist/cjs/mixins/OxyServices.workspaces.js +38 -3
- package/dist/cjs/utils/cache.js +9 -2
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/HttpService.js +18 -4
- package/dist/esm/mixins/OxyServices.applications.js +69 -6
- package/dist/esm/mixins/OxyServices.assets.js +16 -3
- package/dist/esm/mixins/OxyServices.features.js +47 -10
- package/dist/esm/mixins/OxyServices.managedAccounts.js +29 -3
- package/dist/esm/mixins/OxyServices.privacy.js +34 -8
- package/dist/esm/mixins/OxyServices.topics.js +5 -1
- package/dist/esm/mixins/OxyServices.user.js +11 -2
- package/dist/esm/mixins/OxyServices.workspaces.js +38 -3
- package/dist/esm/utils/cache.js +9 -2
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/HttpService.d.ts +9 -0
- package/dist/types/mixins/OxyServices.applications.d.ts +26 -0
- package/dist/types/mixins/OxyServices.features.d.ts +27 -6
- package/dist/types/mixins/OxyServices.managedAccounts.d.ts +16 -1
- package/dist/types/mixins/OxyServices.privacy.d.ts +22 -4
- package/dist/types/mixins/OxyServices.user.d.ts +8 -1
- package/dist/types/mixins/OxyServices.workspaces.d.ts +12 -0
- package/dist/types/models/interfaces.d.ts +12 -0
- package/dist/types/utils/cache.d.ts +4 -1
- package/package.json +1 -4
- package/src/HttpService.ts +28 -4
- package/src/__tests__/httpServiceCache.test.ts +68 -0
- package/src/mixins/OxyServices.applications.ts +71 -6
- package/src/mixins/OxyServices.assets.ts +16 -3
- package/src/mixins/OxyServices.features.ts +47 -10
- package/src/mixins/OxyServices.managedAccounts.ts +29 -3
- package/src/mixins/OxyServices.privacy.ts +34 -8
- package/src/mixins/OxyServices.topics.ts +5 -1
- package/src/mixins/OxyServices.user.ts +11 -2
- package/src/mixins/OxyServices.workspaces.ts +39 -3
- package/src/mixins/__tests__/privacyCacheInvalidation.test.ts +147 -0
- package/src/models/interfaces.ts +13 -1
- package/src/utils/cache.ts +9 -2
package/src/utils/cache.ts
CHANGED
|
@@ -91,11 +91,18 @@ export class TTLCache<T> {
|
|
|
91
91
|
* Set a value in cache
|
|
92
92
|
* @param key Cache key
|
|
93
93
|
* @param data Data to cache
|
|
94
|
-
* @param ttl Optional TTL override (uses default if not provided)
|
|
94
|
+
* @param ttl Optional TTL override (uses default if not provided). An
|
|
95
|
+
* explicit `0` or negative value is honored as "already expired" — the
|
|
96
|
+
* entry is stored with `expiresAt <= now`, so the next `get`/`has` treats
|
|
97
|
+
* it as a miss — rather than silently falling back to the default TTL.
|
|
95
98
|
*/
|
|
96
99
|
set(key: string, data: T, ttl?: number): void {
|
|
97
100
|
const now = Date.now();
|
|
98
|
-
|
|
101
|
+
// Distinguish "no override provided" (undefined → use default) from an
|
|
102
|
+
// explicit `0`/negative (do not cache). `ttl || this.defaultTTL` collapsed
|
|
103
|
+
// both into the default, making `cacheTTL:0` impossible to honor.
|
|
104
|
+
const effectiveTTL = ttl === undefined ? this.defaultTTL : ttl;
|
|
105
|
+
const expiresAt = now + effectiveTTL;
|
|
99
106
|
this.cache.set(key, { data, timestamp: now, expiresAt });
|
|
100
107
|
}
|
|
101
108
|
|