@polarityio/integration-types 1.0.4 → 1.1.1
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/context.d.ts +72 -0
- package/package.json +1 -2
package/dist/context.d.ts
CHANGED
|
@@ -11,8 +11,32 @@ export interface CacheOptions {
|
|
|
11
11
|
* Use for system-wide statistics, feature flags, or shared configuration.
|
|
12
12
|
*/
|
|
13
13
|
export interface GlobalCache {
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves a value from the global cache.
|
|
16
|
+
*
|
|
17
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
18
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
19
|
+
* @returns The cached value, or `undefined` if the key does not exist or has expired.
|
|
20
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
21
|
+
*/
|
|
14
22
|
get(key: string): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Stores a value in the global cache.
|
|
25
|
+
*
|
|
26
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
27
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
28
|
+
* @param value - Value to cache.
|
|
29
|
+
* @param options - Optional cache settings (e.g. TTL).
|
|
30
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
31
|
+
*/
|
|
15
32
|
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Deletes a value from the global cache.
|
|
35
|
+
*
|
|
36
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
37
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
38
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
39
|
+
*/
|
|
16
40
|
delete(key: string): Promise<void>;
|
|
17
41
|
}
|
|
18
42
|
/**
|
|
@@ -20,8 +44,32 @@ export interface GlobalCache {
|
|
|
20
44
|
* Use for API responses, configuration, or data that's the same for all users.
|
|
21
45
|
*/
|
|
22
46
|
export interface IntegrationCache {
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves a value from the integration-scoped cache.
|
|
49
|
+
*
|
|
50
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
51
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
52
|
+
* @returns The cached value, or `undefined` if the key does not exist or has expired.
|
|
53
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
54
|
+
*/
|
|
23
55
|
get(key: string): Promise<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Stores a value in the integration-scoped cache.
|
|
58
|
+
*
|
|
59
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
60
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
61
|
+
* @param value - Value to cache.
|
|
62
|
+
* @param options - Optional cache settings (e.g. TTL).
|
|
63
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
64
|
+
*/
|
|
24
65
|
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Deletes a value from the integration-scoped cache.
|
|
68
|
+
*
|
|
69
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
70
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
71
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
72
|
+
*/
|
|
25
73
|
delete(key: string): Promise<void>;
|
|
26
74
|
}
|
|
27
75
|
/**
|
|
@@ -29,8 +77,32 @@ export interface IntegrationCache {
|
|
|
29
77
|
* Use for user preferences, recent activity, or personalized data.
|
|
30
78
|
*/
|
|
31
79
|
export interface UserCache {
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves a value from the user-scoped cache.
|
|
82
|
+
*
|
|
83
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
84
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
85
|
+
* @returns The cached value, or `undefined` if the key does not exist or has expired.
|
|
86
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
87
|
+
*/
|
|
32
88
|
get(key: string): Promise<unknown>;
|
|
89
|
+
/**
|
|
90
|
+
* Stores a value in the user-scoped cache.
|
|
91
|
+
*
|
|
92
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
93
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
94
|
+
* @param value - Value to cache.
|
|
95
|
+
* @param options - Optional cache settings (e.g. TTL).
|
|
96
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
97
|
+
*/
|
|
33
98
|
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Deletes a value from the user-scoped cache.
|
|
101
|
+
*
|
|
102
|
+
* @param key - Cache key. Must be 1–250 characters and match `/^[a-zA-Z0-9._-]+$/`
|
|
103
|
+
* (alphanumeric characters, dots, underscores, and hyphens only).
|
|
104
|
+
* @throws {Error} If `key` is empty, exceeds 250 characters, or contains invalid characters.
|
|
105
|
+
*/
|
|
34
106
|
delete(key: string): Promise<void>;
|
|
35
107
|
}
|
|
36
108
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polarityio/integration-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "TypeScript type definitions for Polarity Integrations",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
|
-
"type": "module",
|
|
15
14
|
"sideEffects": false,
|
|
16
15
|
"scripts": {
|
|
17
16
|
"build": "tsc -p tsconfig.build.json",
|