@aegis-framework/artemis 0.4.0 → 0.5.0
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/README.md +547 -96
- package/dist/artemis.browser.js +2 -2
- package/dist/artemis.browser.js.map +18 -17
- package/dist/artemis.js +2 -2
- package/dist/artemis.js.map +18 -17
- package/dist/types/DOM.d.ts +189 -207
- package/dist/types/DOM.d.ts.map +1 -1
- package/dist/types/Debug.d.ts +73 -2
- package/dist/types/Debug.d.ts.map +1 -1
- package/dist/types/FileSystem.d.ts +55 -38
- package/dist/types/FileSystem.d.ts.map +1 -1
- package/dist/types/Form.d.ts +41 -16
- package/dist/types/Form.d.ts.map +1 -1
- package/dist/types/Platform.d.ts +62 -63
- package/dist/types/Platform.d.ts.map +1 -1
- package/dist/types/Preload.d.ts +70 -11
- package/dist/types/Preload.d.ts.map +1 -1
- package/dist/types/Request.d.ts +111 -47
- package/dist/types/Request.d.ts.map +1 -1
- package/dist/types/Space.d.ts +19 -6
- package/dist/types/Space.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/IndexedDB.d.ts +10 -7
- package/dist/types/SpaceAdapter/IndexedDB.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/LocalStorage.d.ts +18 -8
- package/dist/types/SpaceAdapter/LocalStorage.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts +15 -2
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/SessionStorage.d.ts +21 -2
- package/dist/types/SpaceAdapter/SessionStorage.d.ts.map +1 -1
- package/dist/types/SpaceAdapter/types.d.ts +32 -1
- package/dist/types/SpaceAdapter/types.d.ts.map +1 -1
- package/dist/types/Text.d.ts +34 -23
- package/dist/types/Text.d.ts.map +1 -1
- package/dist/types/Util.d.ts +18 -14
- package/dist/types/Util.d.ts.map +1 -1
- package/package.json +3 -4
package/dist/types/Request.d.ts
CHANGED
|
@@ -3,84 +3,148 @@
|
|
|
3
3
|
* Request
|
|
4
4
|
* ==============================
|
|
5
5
|
*/
|
|
6
|
+
export type RequestData = Record<string, unknown> | FormData;
|
|
7
|
+
export interface RequestOptions extends Omit<RequestInit, 'body' | 'method'> {
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export type RequestData = Record<string, string | number | boolean>;
|
|
10
|
-
/**
|
|
11
|
-
* Type for request options
|
|
12
|
+
* Error thrown when a request fails
|
|
12
13
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
14
|
+
export declare class RequestError extends Error {
|
|
15
|
+
status: number;
|
|
16
|
+
statusText: string;
|
|
17
|
+
response: Response;
|
|
18
|
+
constructor(response: Response, message?: string);
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
|
-
*
|
|
21
|
+
* Error thrown when a request times out
|
|
18
22
|
*/
|
|
23
|
+
export declare class RequestTimeoutError extends Error {
|
|
24
|
+
constructor(url: string, timeout: number);
|
|
25
|
+
}
|
|
19
26
|
export declare class Request {
|
|
20
27
|
/**
|
|
21
|
-
* Serialize
|
|
28
|
+
* Serialize data to URL query string
|
|
29
|
+
* Handles nested objects and arrays
|
|
22
30
|
*
|
|
23
|
-
* @param data -
|
|
24
|
-
* @
|
|
31
|
+
* @param data - Data to serialize
|
|
32
|
+
* @param prefix - Key prefix for nested objects
|
|
25
33
|
*/
|
|
26
|
-
static serialize(data: RequestData): string;
|
|
34
|
+
static serialize(data: RequestData, prefix?: string): string;
|
|
27
35
|
/**
|
|
28
|
-
*
|
|
29
|
-
* and an optional configuration object for the request.
|
|
36
|
+
* Parse a URL safely
|
|
30
37
|
*
|
|
31
|
-
* @param url - URL to
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
* @param url - URL to parse
|
|
39
|
+
*/
|
|
40
|
+
private static parseUrl;
|
|
41
|
+
/**
|
|
42
|
+
* Create an AbortController with timeout
|
|
43
|
+
*
|
|
44
|
+
* @param timeout - Timeout in milliseconds
|
|
45
|
+
* @param url - URL for error message
|
|
46
|
+
*/
|
|
47
|
+
private static createTimeoutController;
|
|
48
|
+
private static send;
|
|
49
|
+
/**
|
|
50
|
+
* Make a GET request
|
|
51
|
+
*
|
|
52
|
+
* @param url - Request URL
|
|
53
|
+
* @param data - Query parameters
|
|
54
|
+
* @param options - Request options
|
|
35
55
|
*/
|
|
36
56
|
static get(url: string, data?: RequestData, options?: RequestOptions): Promise<Response>;
|
|
37
57
|
/**
|
|
38
|
-
* Make a POST request
|
|
39
|
-
* configuration object for the request.
|
|
58
|
+
* Make a POST request
|
|
40
59
|
*
|
|
41
|
-
* @param url - URL
|
|
42
|
-
* @param data -
|
|
43
|
-
* @param options -
|
|
44
|
-
* @returns Resolves to the response of the request
|
|
60
|
+
* @param url - Request URL
|
|
61
|
+
* @param data - Request body
|
|
62
|
+
* @param options - Request options
|
|
45
63
|
*/
|
|
46
64
|
static post(url: string, data: RequestData, options?: RequestOptions): Promise<Response>;
|
|
47
65
|
/**
|
|
48
|
-
* Make a PUT request
|
|
49
|
-
* configuration object for the request.
|
|
66
|
+
* Make a PUT request
|
|
50
67
|
*
|
|
51
|
-
* @param url - URL
|
|
52
|
-
* @param data -
|
|
53
|
-
* @param options -
|
|
54
|
-
* @returns Resolves to the response of the request
|
|
68
|
+
* @param url - Request URL
|
|
69
|
+
* @param data - Request body
|
|
70
|
+
* @param options - Request options
|
|
55
71
|
*/
|
|
56
72
|
static put(url: string, data: RequestData, options?: RequestOptions): Promise<Response>;
|
|
57
73
|
/**
|
|
58
|
-
* Make a
|
|
59
|
-
*
|
|
74
|
+
* Make a PATCH request
|
|
75
|
+
*
|
|
76
|
+
* @param url - Request URL
|
|
77
|
+
* @param data - Request body
|
|
78
|
+
* @param options - Request options
|
|
79
|
+
*/
|
|
80
|
+
static patch(url: string, data: RequestData, options?: RequestOptions): Promise<Response>;
|
|
81
|
+
/**
|
|
82
|
+
* Make a DELETE request
|
|
60
83
|
*
|
|
61
|
-
* @param url - URL
|
|
62
|
-
* @param data -
|
|
63
|
-
* @param options -
|
|
64
|
-
* @returns Resolves to the response of the request
|
|
84
|
+
* @param url - Request URL
|
|
85
|
+
* @param data - Query parameters
|
|
86
|
+
* @param options - Request options
|
|
65
87
|
*/
|
|
66
|
-
static delete(url: string, data
|
|
88
|
+
static delete(url: string, data?: RequestData, options?: RequestOptions): Promise<Response>;
|
|
67
89
|
/**
|
|
68
|
-
*
|
|
90
|
+
* Make a HEAD request
|
|
69
91
|
*
|
|
70
|
-
* @param url - URL
|
|
71
|
-
* @param data -
|
|
72
|
-
* @param options -
|
|
73
|
-
|
|
92
|
+
* @param url - Request URL
|
|
93
|
+
* @param data - Query parameters
|
|
94
|
+
* @param options - Request options
|
|
95
|
+
*/
|
|
96
|
+
static head(url: string, data?: RequestData, options?: RequestOptions): Promise<Response>;
|
|
97
|
+
/**
|
|
98
|
+
* Make a GET request and parse JSON response
|
|
99
|
+
*
|
|
100
|
+
* @param url - Request URL
|
|
101
|
+
* @param data - Query parameters
|
|
102
|
+
* @param options - Request options
|
|
103
|
+
* @throws {RequestError} If the response is not ok
|
|
74
104
|
*/
|
|
75
105
|
static json<T = unknown>(url: string, data?: RequestData, options?: RequestOptions): Promise<T>;
|
|
76
106
|
/**
|
|
77
|
-
*
|
|
107
|
+
* Make a POST request with JSON body and parse JSON response
|
|
108
|
+
*
|
|
109
|
+
* @param url - Request URL
|
|
110
|
+
* @param data - Request body
|
|
111
|
+
* @param options - Request options
|
|
112
|
+
* @throws {RequestError} If the response is not ok
|
|
113
|
+
*/
|
|
114
|
+
static postJson<T = unknown>(url: string, data: RequestData, options?: RequestOptions): Promise<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Make a GET request and return as Blob
|
|
78
117
|
*
|
|
79
|
-
* @param url - URL
|
|
80
|
-
* @param data -
|
|
81
|
-
* @param options -
|
|
82
|
-
* @
|
|
118
|
+
* @param url - Request URL
|
|
119
|
+
* @param data - Query parameters
|
|
120
|
+
* @param options - Request options
|
|
121
|
+
* @throws {RequestError} If the response is not ok
|
|
83
122
|
*/
|
|
84
123
|
static blob(url: string, data?: RequestData, options?: RequestOptions): Promise<Blob>;
|
|
124
|
+
/**
|
|
125
|
+
* Make a GET request and return as text
|
|
126
|
+
*
|
|
127
|
+
* @param url - Request URL
|
|
128
|
+
* @param data - Query parameters
|
|
129
|
+
* @param options - Request options
|
|
130
|
+
* @throws {RequestError} If the response is not ok
|
|
131
|
+
*/
|
|
132
|
+
static text(url: string, data?: RequestData, options?: RequestOptions): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* Make a GET request and return as ArrayBuffer
|
|
135
|
+
*
|
|
136
|
+
* @param url - Request URL
|
|
137
|
+
* @param data - Query parameters
|
|
138
|
+
* @param options - Request options
|
|
139
|
+
* @throws {RequestError} If the response is not ok
|
|
140
|
+
*/
|
|
141
|
+
static arrayBuffer(url: string, data?: RequestData, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
142
|
+
/**
|
|
143
|
+
* Check if a URL exists (returns 2xx status)
|
|
144
|
+
*
|
|
145
|
+
* @param url - URL to check
|
|
146
|
+
* @param options - Request options
|
|
147
|
+
*/
|
|
148
|
+
static exists(url: string, options?: RequestOptions): Promise<boolean>;
|
|
85
149
|
}
|
|
86
150
|
//# sourceMappingURL=Request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/Request.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/Request.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,M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 import { LocalStorage } from './SpaceAdapter/LocalStorage';
|
|
|
7
7
|
import { SessionStorage } from './SpaceAdapter/SessionStorage';
|
|
8
8
|
import { IndexedDB } from './SpaceAdapter/IndexedDB';
|
|
9
9
|
import { RemoteStorage } from './SpaceAdapter/RemoteStorage';
|
|
10
|
-
import type { SpaceConfiguration, StorageValue, KeyValueResult, UpgradeCallback } from './SpaceAdapter/types';
|
|
10
|
+
import type { SpaceConfiguration, StorageValue, KeyValueResult, UpgradeCallback, SpaceAdapterInterface } from './SpaceAdapter/types';
|
|
11
11
|
/**
|
|
12
12
|
* List of Adapters Available
|
|
13
13
|
*/
|
|
@@ -20,10 +20,7 @@ export declare const SpaceAdapter: {
|
|
|
20
20
|
/**
|
|
21
21
|
* Space adapter type (any of the available adapters)
|
|
22
22
|
*/
|
|
23
|
-
export type SpaceAdapterType =
|
|
24
|
-
/**
|
|
25
|
-
* Space adapter constructor type
|
|
26
|
-
*/
|
|
23
|
+
export type SpaceAdapterType = SpaceAdapterInterface;
|
|
27
24
|
export type SpaceAdapterConstructor = typeof LocalStorage | typeof SessionStorage | typeof IndexedDB | typeof RemoteStorage;
|
|
28
25
|
/**
|
|
29
26
|
* Callback function type for space events
|
|
@@ -70,13 +67,29 @@ export declare class Space {
|
|
|
70
67
|
* @param object - Configuration object to set up
|
|
71
68
|
* @returns Configuration object if no param was passed
|
|
72
69
|
*/
|
|
73
|
-
configuration(object?: SpaceConfiguration | null): SpaceConfiguration |
|
|
70
|
+
configuration(object?: SpaceConfiguration | null): SpaceConfiguration | undefined;
|
|
74
71
|
/**
|
|
75
72
|
* Open the Storage Object to be used depending on the SpaceAdapter
|
|
76
73
|
*
|
|
77
74
|
* @returns Promise resolving to this Space
|
|
78
75
|
*/
|
|
79
76
|
open(): Promise<this>;
|
|
77
|
+
/**
|
|
78
|
+
* Apply set transformations to a value
|
|
79
|
+
*
|
|
80
|
+
* @param key - The key being set
|
|
81
|
+
* @param value - The value to transform
|
|
82
|
+
* @returns The transformed value
|
|
83
|
+
*/
|
|
84
|
+
private applySetTransformations;
|
|
85
|
+
/**
|
|
86
|
+
* Apply get transformations to a value
|
|
87
|
+
*
|
|
88
|
+
* @param key - The key being retrieved
|
|
89
|
+
* @param value - The value to transform
|
|
90
|
+
* @returns The transformed value
|
|
91
|
+
*/
|
|
92
|
+
private applyGetTransformations;
|
|
80
93
|
/**
|
|
81
94
|
* Store a key-value pair
|
|
82
95
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../../src/Space.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../../src/Space.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGrI;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD,MAAM,MAAM,uBAAuB,G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EAAE,CAAC;IAI9C;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtB;AAGD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
* IndexedDB Adapter
|
|
4
4
|
* ==============================
|
|
5
5
|
*/
|
|
6
|
-
import type { IndexedDBConfiguration, StorageValue, KeyValueResult, UpgradeCallback } from './types';
|
|
6
|
+
import type { IndexedDBConfiguration, StorageValue, KeyValueResult, UpgradeCallback, SpaceAdapterInterface } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown when a key is not found in storage
|
|
9
|
+
*/
|
|
10
|
+
export declare class KeyNotFoundError extends Error {
|
|
11
|
+
constructor(key: string);
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* The IndexedDB Adapter provides the Space Class the ability to interact
|
|
9
15
|
* with the IndexedDB API found in most modern browsers.
|
|
10
16
|
*/
|
|
11
|
-
export declare class IndexedDB {
|
|
17
|
+
export declare class IndexedDB implements SpaceAdapterInterface {
|
|
12
18
|
name: string;
|
|
13
19
|
version: string;
|
|
14
20
|
store: string;
|
|
@@ -67,7 +73,8 @@ export declare class IndexedDB {
|
|
|
67
73
|
*/
|
|
68
74
|
get(key: string): Promise<StorageValue>;
|
|
69
75
|
/**
|
|
70
|
-
* Retrieves all the values in the space in a key-value JSON object
|
|
76
|
+
* Retrieves all the values in the space in a key-value JSON object.
|
|
77
|
+
* Note: The keyPath property is preserved in the returned items.
|
|
71
78
|
*
|
|
72
79
|
* @returns Promise resolving to all values
|
|
73
80
|
*/
|
|
@@ -89,10 +96,6 @@ export declare class IndexedDB {
|
|
|
89
96
|
* @returns Promise
|
|
90
97
|
*/
|
|
91
98
|
upgrade(oldVersion: string, newVersion: string, callback: UpgradeCallback<IndexedDB>): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Helper for the upgrade progress by executing callbacks in order
|
|
94
|
-
*/
|
|
95
|
-
private _upgrade;
|
|
96
99
|
/**
|
|
97
100
|
* Renaming the space is not possible with the IndexedDB adapter therefore
|
|
98
101
|
* this function always gets rejected.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedDB.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/IndexedDB.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"IndexedDB.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/IndexedDB.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAG5H;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,GAAG,EAAE,MAAM;CAIvB;AAED;;;GAGG;AACH,qBAAa,SAAU,YAAW,qBAAqB;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC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AAI,OAAO,CAAC,KAAK,CAAC;IAIrB;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAmB/B;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAmBhD;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB5B"}
|
|
@@ -3,19 +3,26 @@
|
|
|
3
3
|
* Local Storage Adapter
|
|
4
4
|
* ==============================
|
|
5
5
|
*/
|
|
6
|
-
import type { LocalStorageConfiguration, StorageValue, KeyValueResult, UpgradeCallback } from './types';
|
|
6
|
+
import type { LocalStorageConfiguration, StorageValue, KeyValueResult, UpgradeCallback, SpaceAdapterInterface } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown when a key is not found in storage
|
|
9
|
+
*/
|
|
10
|
+
export declare class KeyNotFoundError extends Error {
|
|
11
|
+
constructor(key: string);
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* The Local Storage Adapter provides the Space Class the ability to interact
|
|
9
15
|
* with the localStorage API found in most modern browsers.
|
|
10
16
|
*/
|
|
11
|
-
export declare class LocalStorage {
|
|
17
|
+
export declare class LocalStorage implements SpaceAdapterInterface {
|
|
12
18
|
name: string;
|
|
13
19
|
version: string;
|
|
14
20
|
store: string;
|
|
15
21
|
id: string;
|
|
16
22
|
numericVersion: number;
|
|
17
23
|
upgrades: Record<string, UpgradeCallback<LocalStorage>>;
|
|
18
|
-
storage: Storage |
|
|
24
|
+
storage: Storage | undefined;
|
|
25
|
+
private _openPromise;
|
|
19
26
|
/**
|
|
20
27
|
* Create a new LocalStorage. If no configuration is provided, the LocalStorage
|
|
21
28
|
* global object is used. The LocalStorage Adapter can provide independency
|
|
@@ -24,6 +31,12 @@ export declare class LocalStorage {
|
|
|
24
31
|
* @param configuration - Configuration Object for the Adapter
|
|
25
32
|
*/
|
|
26
33
|
constructor({ name, version, store }: LocalStorageConfiguration);
|
|
34
|
+
/**
|
|
35
|
+
* Compute the storage ID based on current name, version, and store
|
|
36
|
+
*
|
|
37
|
+
* @returns The computed ID string
|
|
38
|
+
*/
|
|
39
|
+
private computeId;
|
|
27
40
|
/**
|
|
28
41
|
* Modify the configuration
|
|
29
42
|
*
|
|
@@ -82,10 +95,6 @@ export declare class LocalStorage {
|
|
|
82
95
|
* @returns Promise
|
|
83
96
|
*/
|
|
84
97
|
upgrade(oldVersion: string, newVersion: string, callback: UpgradeCallback<LocalStorage>): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Helper for the upgrade progress by executing callbacks in order
|
|
87
|
-
*/
|
|
88
|
-
private _upgrade;
|
|
89
98
|
/**
|
|
90
99
|
* Rename a Space
|
|
91
100
|
*
|
|
@@ -94,7 +103,8 @@ export declare class LocalStorage {
|
|
|
94
103
|
*/
|
|
95
104
|
rename(name: string): Promise<void>;
|
|
96
105
|
/**
|
|
97
|
-
* Get the key that corresponds to a given index in the storage
|
|
106
|
+
* Get the key that corresponds to a given index in the storage.
|
|
107
|
+
* Only considers keys belonging to this space.
|
|
98
108
|
*
|
|
99
109
|
* @param index - Index to get the key from
|
|
100
110
|
* @param full - Whether to return the full key name including space id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/LocalStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"LocalStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/LocalStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAG/H;;GAEG;AACH,qBAAa,gBAAi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CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7G;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBzC;;;;;;;OAOG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhE;;;;;OAKG;IACG,IAAI,CAAC,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAapD;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAMhD;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B"}
|
|
@@ -5,17 +5,24 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Request } from '../Request';
|
|
7
7
|
import type { RequestOptions } from '../Request';
|
|
8
|
-
import type { RemoteStorageConfiguration, StorageValue, KeyValueResult } from './types';
|
|
8
|
+
import type { RemoteStorageConfiguration, StorageValue, KeyValueResult, SpaceAdapterInterface } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when a key is not found in storage
|
|
11
|
+
*/
|
|
12
|
+
export declare class KeyNotFoundError extends Error {
|
|
13
|
+
constructor(key: string);
|
|
14
|
+
}
|
|
9
15
|
/**
|
|
10
16
|
* The Remote Storage Adapter provides the Space Class the ability to interact
|
|
11
17
|
* with a server in order to handle data persistence. The server's implementation
|
|
12
18
|
* is up to the developer but it will need to respond to this adapter's request
|
|
13
19
|
* formatting. This adapter uses the Request class to perform its tasks.
|
|
14
20
|
*/
|
|
15
|
-
export declare class RemoteStorage {
|
|
21
|
+
export declare class RemoteStorage implements SpaceAdapterInterface {
|
|
16
22
|
name: string;
|
|
17
23
|
version: string;
|
|
18
24
|
store: string;
|
|
25
|
+
baseEndpoint: string;
|
|
19
26
|
endpoint: string;
|
|
20
27
|
props: RequestOptions;
|
|
21
28
|
storage: typeof Request | undefined;
|
|
@@ -26,6 +33,12 @@ export declare class RemoteStorage {
|
|
|
26
33
|
* @param configuration - Configuration Object for the Adapter
|
|
27
34
|
*/
|
|
28
35
|
constructor({ name, version, store, endpoint, props }: RemoteStorageConfiguration);
|
|
36
|
+
/**
|
|
37
|
+
* Compute the full endpoint URL
|
|
38
|
+
*
|
|
39
|
+
* @returns The computed endpoint URL
|
|
40
|
+
*/
|
|
41
|
+
private computeEndpoint;
|
|
29
42
|
/**
|
|
30
43
|
* Modify the configuration
|
|
31
44
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/RemoteStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"RemoteStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/RemoteStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAG/G;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,GAAG,EAAE,MAAM;CAIvB;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,qBAAqB;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,E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
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
* ==============================
|
|
5
5
|
*/
|
|
6
6
|
import { LocalStorage } from './LocalStorage';
|
|
7
|
-
import type { LocalStorageConfiguration } from './types';
|
|
7
|
+
import type { LocalStorageConfiguration, UpgradeCallback } from './types';
|
|
8
8
|
/**
|
|
9
9
|
* The Session Storage Adapter provides the Space Class the ability to interact
|
|
10
10
|
* with the sessionStorage API found in most modern browsers. Since this API
|
|
11
11
|
* shares pretty much the same methods as the local storage one, this class
|
|
12
12
|
* inherits from the LocalStorage adapter.
|
|
13
|
+
*
|
|
14
|
+
* Note: SessionStorage does not support versioning and upgrades because session
|
|
15
|
+
* data is inherently temporary and cleared when the browser session ends.
|
|
16
|
+
* Any declared upgrades will be ignored.
|
|
13
17
|
*/
|
|
14
18
|
export declare class SessionStorage extends LocalStorage {
|
|
15
19
|
/**
|
|
@@ -17,14 +21,29 @@ export declare class SessionStorage extends LocalStorage {
|
|
|
17
21
|
* global object is used. The SessionStorage Adapter can provide independency
|
|
18
22
|
* by store name and space name.
|
|
19
23
|
*
|
|
24
|
+
* Note: Version is accepted for API compatibility but upgrades are not supported.
|
|
25
|
+
*
|
|
20
26
|
* @param configuration - Configuration Object for the Adapter
|
|
21
27
|
*/
|
|
22
28
|
constructor({ name, version, store }: LocalStorageConfiguration);
|
|
23
29
|
/**
|
|
24
|
-
* Open the Storage Object
|
|
30
|
+
* Open the Storage Object.
|
|
31
|
+
*
|
|
32
|
+
* Unlike LocalStorage, SessionStorage does not perform upgrade migrations
|
|
33
|
+
* because session data is temporary and cleared when the session ends.
|
|
25
34
|
*
|
|
26
35
|
* @returns Promise resolving to this adapter
|
|
27
36
|
*/
|
|
28
37
|
open(): Promise<this>;
|
|
38
|
+
/**
|
|
39
|
+
* Upgrade is not supported for SessionStorage.
|
|
40
|
+
* Session data is temporary and should not require migrations.
|
|
41
|
+
*
|
|
42
|
+
* @param _oldVersion - Ignored
|
|
43
|
+
* @param _newVersion - Ignored
|
|
44
|
+
* @param _callback - Ignored
|
|
45
|
+
* @returns Promise that resolves immediately (no-op)
|
|
46
|
+
*/
|
|
47
|
+
upgrade(_oldVersion: string, _newVersion: string, _callback: UpgradeCallback<SessionStorage>): Promise<void>;
|
|
29
48
|
}
|
|
30
49
|
//# sourceMappingURL=SessionStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/SessionStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/SessionStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC/C;;;;;;;;OAQG;gBACS,EAAE,IAAS,EAAE,OAAY,EAAE,KAAU,EAAE,EAAE,yBAAyB;IAI9E;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B;;;;;;;;OAQG;IACG,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlH"}
|
|
@@ -31,7 +31,7 @@ export interface IndexedDBConfiguration extends SpaceConfiguration {
|
|
|
31
31
|
*/
|
|
32
32
|
export interface RemoteStorageConfiguration extends SpaceConfiguration {
|
|
33
33
|
endpoint?: string;
|
|
34
|
-
props?: Record<string,
|
|
34
|
+
props?: Record<string, unknown>;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Generic storage value type
|
|
@@ -73,4 +73,35 @@ export interface SpaceAdapterInterface {
|
|
|
73
73
|
* Space adapter constructor type
|
|
74
74
|
*/
|
|
75
75
|
export type SpaceAdapterConstructor = new (config: SpaceConfiguration) => SpaceAdapterInterface;
|
|
76
|
+
/**
|
|
77
|
+
* Convert a version string to a numeric value for comparison.
|
|
78
|
+
* Each segment is padded to 5 digits to support versions up to 99999.x.x
|
|
79
|
+
*
|
|
80
|
+
* @param version - Version string (e.g., "1.0.0", "10.2.15")
|
|
81
|
+
* @returns Numeric version for comparison
|
|
82
|
+
*/
|
|
83
|
+
export declare function versionToNumber(version: string): number;
|
|
84
|
+
/**
|
|
85
|
+
* Compare two version strings
|
|
86
|
+
*
|
|
87
|
+
* @param v1 - First version string
|
|
88
|
+
* @param v2 - Second version string
|
|
89
|
+
* @returns -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
|
|
90
|
+
*/
|
|
91
|
+
export declare function compareVersions(v1: string, v2: string): number;
|
|
92
|
+
/**
|
|
93
|
+
* Deep clone a value to prevent mutation
|
|
94
|
+
*
|
|
95
|
+
* @param value - Value to clone
|
|
96
|
+
* @returns Cloned value
|
|
97
|
+
*/
|
|
98
|
+
export declare function cloneValue<T>(value: T): T;
|
|
99
|
+
/**
|
|
100
|
+
* Normalize a URL by ensuring proper slash handling
|
|
101
|
+
*
|
|
102
|
+
* @param base - Base URL
|
|
103
|
+
* @param path - Path to append
|
|
104
|
+
* @returns Normalized URL
|
|
105
|
+
*/
|
|
106
|
+
export declare function normalizeUrl(base: string, path: string): string;
|
|
76
107
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,CAAC,EA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