@acodeninja/persist 2.4.1-next.2 → 3.0.0-next.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.
@@ -54,15 +54,15 @@ export class Address extends Persist.Type.Model {
54
54
 
55
55
  By doing this, you ensure that model references are evaluated lazily, after all models have been initialized, preventing `ReferenceError` issues.
56
56
 
57
- ## Using `HTTP` Engine in Browser
57
+ ## Using `HTTP` StorageEngine in Browser
58
58
 
59
59
  When implementing thee `HTTP` engine for code that runs in the web browser, you must pass `fetch` into the engine configuration and bind it to the `window` object.
60
60
 
61
61
  ```javascript
62
62
  import Persist from "@acodeninja/persist";
63
- import HTTPEngine from "@acodeninja/persist/engine/http";
63
+ import HTTPStorageEngine from "@acodeninja/persist/engine/storage/http";
64
64
 
65
- Persist.addEngine('remote', HTTPEngine, {
65
+ Persist.addEngine('remote', HTTPStorageEngine, {
66
66
  host: 'https://api.example.com',
67
67
  fetch: fetch.bind(window),
68
68
  });
@@ -37,9 +37,9 @@ To search for any `Person` who lives on station road, the following search query
37
37
  ```javascript
38
38
  import Persist from "@acodeninja/persist";
39
39
  import Person from "./Person";
40
- import FileEngine from "@acodeninja/persist/engine/file"
40
+ import FileStorageEngine from "@acodeninja/persist/engine/storage/file"
41
41
 
42
- FileEngine
42
+ FileStorageEngine
43
43
  .configure(configuration)
44
44
  .search(Person, 'station road');
45
45
  ```
@@ -2,15 +2,15 @@
2
2
 
3
3
  Persist makes several storage engines available for use with the library
4
4
 
5
- ## Filesystem Storage Engine
5
+ ## Filesystem Storage StorageEngine
6
6
 
7
7
  To store models using the local file system, use the `File` storage engine.
8
8
 
9
9
  ```javascript
10
10
  import Persist from "@acodeninja/persist";
11
- import FileEngine from "@acodeninja/persist/engine/file";
11
+ import FileStorageEngine from "@acodeninja/persist/engine/storage/file";
12
12
 
13
- Persist.addEngine('local', FileEngine, {
13
+ Persist.addEngine('local', FileStorageEngine, {
14
14
  path: '/app/storage',
15
15
  });
16
16
 
@@ -18,18 +18,18 @@ export class Tag extends Persist.Type.Model {
18
18
  static tag = Persist.Type.String.required;
19
19
  }
20
20
 
21
- await Persist.getEngine('local', FileEngine).put(new Tag({tag: 'documentation'}));
21
+ await Persist.getEngine('local', FileStorageEngine).put(new Tag({tag: 'documentation'}));
22
22
  ```
23
23
 
24
- ## HTTP Storage Engine
24
+ ## HTTP Storage StorageEngine
25
25
 
26
26
  To store models using an HTTP server, use the `HTTP` storage engine. When using the `HTTP` engine in the browser, refer to [code quirks](./code-quirks.md#using-http-engine-in-browser).
27
27
 
28
28
  ```javascript
29
29
  import Persist from "@acodeninja/persist";
30
- import HTTPEngine from "@acodeninja/persist/engine/http";
30
+ import HTTPStorageEngine from "@acodeninja/persist/engine/storage/http";
31
31
 
32
- Persist.addEngine('remote', HTTPEngine, {
32
+ Persist.addEngine('remote', HTTPStorageEngine, {
33
33
  host: 'https://api.example.com',
34
34
  });
35
35
 
@@ -37,18 +37,18 @@ export class Tag extends Persist.Type.Model {
37
37
  static tag = Persist.Type.String.required;
38
38
  }
39
39
 
40
- await Persist.getEngine('remote', HTTPEngine).put(new Tag({tag: 'documentation'}));
40
+ await Persist.getEngine('remote', HTTPStorageEngine).put(new Tag({tag: 'documentation'}));
41
41
  ```
42
42
 
43
- ## S3 Storage Engine
43
+ ## S3 Storage StorageEngine
44
44
 
45
45
  To store models using an S3 Bucket, use the `S3` storage engine. To use the `S3` engine you must also add the `@aws-sdk/client-s3` dependency to your `package.json` file.
46
46
 
47
47
  ```javascript
48
48
  import Persist from "@acodeninja/persist";
49
- import S3Engine from "@acodeninja/persist/engine/s3";
49
+ import S3StorageEngine from "@acodeninja/persist/engine/storage/s3";
50
50
 
51
- Persist.addEngine('remote', S3Engine, {
51
+ Persist.addEngine('remote', S3StorageEngine, {
52
52
  bucket: 'test-bucket',
53
53
  client: new S3Client(),
54
54
  });
@@ -57,5 +57,5 @@ export class Tag extends Persist.Type.Model {
57
57
  static tag = Persist.Type.String.required;
58
58
  }
59
59
 
60
- await Persist.getEngine('remote', S3Engine).put(new Tag({tag: 'documentation'}));
60
+ await Persist.getEngine('remote', S3StorageEngine).put(new Tag({tag: 'documentation'}));
61
61
  ```
@@ -40,9 +40,9 @@ To query for a `Person` called `Joe Bloggs` an exact query can be written:
40
40
  ```javascript
41
41
  import Persist from "@acodeninja/persist";
42
42
  import Person from "./Person";
43
- import FileEngine from "@acodeninja/persist/engine/file"
43
+ import FileStorageEngine from "@acodeninja/persist/engine/storage/file"
44
44
 
45
- FileEngine
45
+ FileStorageEngine
46
46
  .configure(configuration)
47
47
  .find(Person, {
48
48
  name: {$is: 'Joe Bloggs'},
@@ -56,9 +56,9 @@ To query for a `Person` with name `Joe` a contains query can be written:
56
56
  ```javascript
57
57
  import Persist from "@acodeninja/persist";
58
58
  import Person from "./Person";
59
- import FileEngine from "@acodeninja/persist/engine/file"
59
+ import FileStorageEngine from "@acodeninja/persist/engine/storage/file"
60
60
 
61
- FileEngine
61
+ FileStorageEngine
62
62
  .configure(configuration)
63
63
  .find(Person, {
64
64
  name: {$contains: 'Joe'},
@@ -72,9 +72,9 @@ To query for a `Person` who lives at `SW1 1AA` a combination of contains and exa
72
72
  ```javascript
73
73
  import Persist from "@acodeninja/persist";
74
74
  import Person from "./Person";
75
- import FileEngine from "@acodeninja/persist/engine/file"
75
+ import FileStorageEngine from "@acodeninja/persist/engine/storage/file"
76
76
 
77
- FileEngine
77
+ FileStorageEngine
78
78
  .configure(configuration)
79
79
  .find(Person, {
80
80
  address: {
@@ -92,9 +92,9 @@ To query for anyone called `Joe Bloggs` who lives in the `SW1` postcode area, we
92
92
  ```javascript
93
93
  import Persist from "@acodeninja/persist";
94
94
  import Person from "./Person";
95
- import FileEngine from "@acodeninja/persist/engine/file"
95
+ import FileStorageEngine from "@acodeninja/persist/engine/storage/file"
96
96
 
97
- FileEngine
97
+ FileStorageEngine
98
98
  .configure(configuration)
99
99
  .find(Person, {
100
100
  name: {$is: 'Joe Bloggs'},
@@ -4,9 +4,9 @@ Create transactions to automatically roll back on failure.
4
4
 
5
5
  ```javascript
6
6
  import Persist from "@acodeninja/persist";
7
- import S3Engine from "@acodeninja/persist/engine/s3";
7
+ import S3StorageEngine from "@acodeninja/persist/engine/storage/s3";
8
8
 
9
- Persist.addEngine('remote', S3Engine, {
9
+ Persist.addEngine('remote', S3StorageEngine, {
10
10
  bucket: 'test-bucket',
11
11
  client: new S3Client(),
12
12
  transactions: true,
@@ -16,7 +16,7 @@ export class Tag extends Persist.Type.Model {
16
16
  static tag = Persist.Type.String.required;
17
17
  }
18
18
 
19
- const transaction = Persist.getEngine('remote', S3Engine).start();
19
+ const transaction = Persist.getEngine('remote', S3StorageEngine).start();
20
20
 
21
21
  await transaction.put(new Tag({tag: 'documentation'}));
22
22
  await transaction.commit();
@@ -0,0 +1,3 @@
1
+ import FileStorageEngine from '../../../src/engine/storage/FileStorageEngine.js';
2
+
3
+ export default FileStorageEngine;
@@ -0,0 +1,3 @@
1
+ import HTTPStorageEngine from '../../../src/engine/storage/HTTPStorageEngine.js';
2
+
3
+ export default HTTPStorageEngine;
@@ -0,0 +1,3 @@
1
+ import S3StorageEngine from '../../../src/engine/storage/S3StorageEngine.js';
2
+
3
+ export default S3StorageEngine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acodeninja/persist",
3
- "version": "2.4.1-next.2",
3
+ "version": "3.0.0-next.1",
4
4
  "description": "A JSON based data modelling and persistence module with alternate storage mechanisms.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,35 +1,35 @@
1
- import Engine, { EngineError, MissConfiguredError } from './Engine.js';
1
+ import StorageEngine, { EngineError, MissConfiguredError } from './StorageEngine.js';
2
2
  import { dirname, join } from 'node:path';
3
3
  import fs from 'node:fs/promises';
4
4
 
5
5
  /**
6
- * Custom error class for FileEngine-related errors.
6
+ * Custom error class for FileStorageEngine-related errors.
7
7
  * Extends the base `EngineError` class.
8
8
  */
9
- class FileEngineError extends EngineError {}
9
+ class FileStorageEngineError extends EngineError {}
10
10
 
11
11
  /**
12
- * Error thrown when writing to a file fails in `FileEngine`.
13
- * Extends the `FileEngineError` class.
12
+ * Error thrown when writing to a file fails in `FileStorageEngine`.
13
+ * Extends the `FileStorageEngineError` class.
14
14
  */
15
- class FailedWriteFileEngineError extends FileEngineError {}
15
+ class FailedWriteFileStorageEngineError extends FileStorageEngineError {}
16
16
 
17
17
  /**
18
- * `FileEngine` class extends the base `Engine` class to implement
18
+ * `FileStorageEngine` class extends the base `StorageEngine` class to implement
19
19
  * file system-based storage and retrieval of model data.
20
20
  *
21
- * @class FileEngine
22
- * @extends Engine
21
+ * @class FileStorageEngine
22
+ * @extends StorageEngine
23
23
  */
24
- class FileEngine extends Engine {
24
+ class FileStorageEngine extends StorageEngine {
25
25
  /**
26
- * Configures the FileEngine with a given configuration object.
26
+ * Configures the FileStorageEngine with a given configuration object.
27
27
  * Adds default `filesystem` configuration if not provided.
28
28
  *
29
- * @param {Object} configuration - Configuration settings for FileEngine.
29
+ * @param {Object} configuration - Configuration settings for FileStorageEngine.
30
30
  * @param {Object} [configuration.filesystem] - Custom filesystem module (default: Node.js fs/promises).
31
31
  * @param {Object} [configuration.path] - The absolute path on the filesystem to write models to.
32
- * @returns {FileEngine} A configured instance of FileEngine.
32
+ * @returns {FileStorageEngine} A configured instance of FileStorageEngine.
33
33
  */
34
34
  static configure(configuration) {
35
35
  if (!configuration.filesystem) {
@@ -39,7 +39,7 @@ class FileEngine extends Engine {
39
39
  }
40
40
 
41
41
  /**
42
- * Checks if the FileEngine has been configured correctly.
42
+ * Checks if the FileStorageEngine has been configured correctly.
43
43
  * Ensures that `path` and `filesystem` settings are present.
44
44
  *
45
45
  * @throws {MissConfiguredError} Throws if required configuration is missing.
@@ -94,7 +94,7 @@ class FileEngine extends Engine {
94
94
  * Saves a model to the file system.
95
95
  *
96
96
  * @param {Model} model - The model to save.
97
- * @throws {FailedWriteFileEngineError} Throws if the model cannot be written to the file system.
97
+ * @throws {FailedWriteFileStorageEngineError} Throws if the model cannot be written to the file system.
98
98
  */
99
99
  static async putModel(model) {
100
100
  const filePath = join(this.configuration.path, `${model.id}.json`);
@@ -102,7 +102,7 @@ class FileEngine extends Engine {
102
102
  await this.configuration.filesystem.mkdir(dirname(filePath), { recursive: true });
103
103
  await this.configuration.filesystem.writeFile(filePath, JSON.stringify(model.toData()));
104
104
  } catch (error) {
105
- throw new FailedWriteFileEngineError(`Failed to put file://${filePath}`, error);
105
+ throw new FailedWriteFileStorageEngineError(`Failed to put file://${filePath}`, error);
106
106
  }
107
107
  }
108
108
 
@@ -110,7 +110,7 @@ class FileEngine extends Engine {
110
110
  * Saves the index for multiple models to the file system.
111
111
  *
112
112
  * @param {Object} index - An object where keys are locations and values are key value pairs of models and their ids.
113
- * @throws {FailedWriteFileEngineError} Throws if the index cannot be written to the file system.
113
+ * @throws {FailedWriteFileStorageEngineError} Throws if the index cannot be written to the file system.
114
114
  */
115
115
  static async putIndex(index) {
116
116
  const processIndex = async (location, models) => {
@@ -125,7 +125,7 @@ class FileEngine extends Engine {
125
125
  ),
126
126
  }));
127
127
  } catch (error) {
128
- throw new FailedWriteFileEngineError(`Failed to put file://${filePath}`, error);
128
+ throw new FailedWriteFileStorageEngineError(`Failed to put file://${filePath}`, error);
129
129
  }
130
130
  };
131
131
 
@@ -175,14 +175,14 @@ class FileEngine extends Engine {
175
175
  *
176
176
  * @param {Model.constructor} model - The model for which the compiled search index is saved.
177
177
  * @param {Object} compiledIndex - The compiled search index to save.
178
- * @throws {FailedWriteFileEngineError} Throws if the compiled index cannot be written to the file system.
178
+ * @throws {FailedWriteFileStorageEngineError} Throws if the compiled index cannot be written to the file system.
179
179
  */
180
180
  static async putSearchIndexCompiled(model, compiledIndex) {
181
181
  const filePath = join(this.configuration.path, model.toString(), '_search_index.json');
182
182
  try {
183
183
  await this.configuration.filesystem.writeFile(filePath, JSON.stringify(compiledIndex));
184
184
  } catch (error) {
185
- throw new FailedWriteFileEngineError(`Failed to put file://${filePath}`, error);
185
+ throw new FailedWriteFileStorageEngineError(`Failed to put file://${filePath}`, error);
186
186
  }
187
187
  }
188
188
 
@@ -191,16 +191,16 @@ class FileEngine extends Engine {
191
191
  *
192
192
  * @param {Model.constructor} model - The model for which the raw search index is saved.
193
193
  * @param {Object} rawIndex - The raw search index to save.
194
- * @throws {FailedWriteFileEngineError} Throws if the raw index cannot be written to the file system.
194
+ * @throws {FailedWriteFileStorageEngineError} Throws if the raw index cannot be written to the file system.
195
195
  */
196
196
  static async putSearchIndexRaw(model, rawIndex) {
197
197
  const filePath = join(this.configuration.path, model.toString(), '_search_index_raw.json');
198
198
  try {
199
199
  await this.configuration.filesystem.writeFile(filePath, JSON.stringify(rawIndex));
200
200
  } catch (error) {
201
- throw new FailedWriteFileEngineError(`Failed to put file://${filePath}`, error);
201
+ throw new FailedWriteFileStorageEngineError(`Failed to put file://${filePath}`, error);
202
202
  }
203
203
  }
204
204
  }
205
205
 
206
- export default FileEngine;
206
+ export default FileStorageEngine;
@@ -1,22 +1,22 @@
1
- import Engine, {EngineError, MissConfiguredError} from './Engine.js';
1
+ import StorageEngine, {EngineError, MissConfiguredError} from './StorageEngine.js';
2
2
 
3
3
  /**
4
4
  * Represents an error specific to HTTP engine operations.
5
- * @class HTTPEngineError
5
+ * @class HTTPStorageEngineError
6
6
  * @extends EngineError
7
7
  */
8
- export class HTTPEngineError extends EngineError {}
8
+ export class HTTPStorageEngineError extends EngineError {}
9
9
 
10
10
  /**
11
11
  * Error indicating a failed HTTP request.
12
12
  * @class HTTPRequestFailedError
13
- * @extends HTTPEngineError
13
+ * @extends HTTPStorageEngineError
14
14
  *
15
15
  * @param {string} url - The URL of the failed request.
16
16
  * @param {Object} options - The options used in the fetch request.
17
17
  * @param {Response} response - The HTTP response object.
18
18
  */
19
- export class HTTPRequestFailedError extends HTTPEngineError {
19
+ export class HTTPRequestFailedError extends HTTPStorageEngineError {
20
20
  constructor(url, options, response) {
21
21
  const method = options.method?.toLowerCase() || 'get';
22
22
  super(`Failed to ${method} ${url}`);
@@ -27,13 +27,13 @@ export class HTTPRequestFailedError extends HTTPEngineError {
27
27
  }
28
28
 
29
29
  /**
30
- * HTTPEngine is an extension of the Engine class that provides methods for interacting with HTTP-based APIs.
30
+ * HTTPStorageEngine is an extension of the StorageEngine class that provides methods for interacting with HTTP-based APIs.
31
31
  * It uses the Fetch API for sending and receiving data.
32
32
  *
33
- * @class HTTPEngine
34
- * @extends Engine
33
+ * @class HTTPStorageEngine
34
+ * @extends StorageEngine
35
35
  */
36
- class HTTPEngine extends Engine {
36
+ class HTTPStorageEngine extends StorageEngine {
37
37
 
38
38
  /**
39
39
  * Configures the HTTP engine with additional fetch options.
@@ -315,4 +315,4 @@ class HTTPEngine extends Engine {
315
315
  }
316
316
  }
317
317
 
318
- export default HTTPEngine;
318
+ export default HTTPStorageEngine;
@@ -1,28 +1,28 @@
1
1
  import {DeleteObjectCommand, GetObjectCommand, PutObjectCommand} from '@aws-sdk/client-s3';
2
- import Engine, {EngineError, MissConfiguredError} from './Engine.js';
2
+ import StorageEngine, {EngineError, MissConfiguredError} from './StorageEngine.js';
3
3
 
4
4
  /**
5
5
  * Represents an error specific to the S3 engine operations.
6
- * @class S3EngineError
6
+ * @class S3StorageEngineError
7
7
  * @extends EngineError
8
8
  */
9
- class S3EngineError extends EngineError {}
9
+ class S3StorageEngineError extends EngineError {}
10
10
 
11
11
  /**
12
12
  * Error indicating a failure when putting an object to S3.
13
- * @class FailedPutS3EngineError
14
- * @extends S3EngineError
13
+ * @class FailedPutS3StorageEngineError
14
+ * @extends S3StorageEngineError
15
15
  */
16
- class FailedPutS3EngineError extends S3EngineError {}
16
+ class FailedPutS3StorageEngineError extends S3StorageEngineError {}
17
17
 
18
18
  /**
19
- * S3Engine is an extension of the Engine class that provides methods for interacting with AWS S3.
19
+ * S3StorageEngine is an extension of the StorageEngine class that provides methods for interacting with AWS S3.
20
20
  * It allows for storing, retrieving, and managing model data in an S3 bucket.
21
21
  *
22
- * @class S3Engine
23
- * @extends Engine
22
+ * @class S3StorageEngine
23
+ * @extends StorageEngine
24
24
  */
25
- class S3Engine extends Engine {
25
+ class S3StorageEngine extends StorageEngine {
26
26
  /**
27
27
  * Configures the S3 engine with additional options.
28
28
  *
@@ -92,7 +92,7 @@ class S3Engine extends Engine {
92
92
  * @param {Model} model - The model object to upload.
93
93
  * @returns {Promise<void>}
94
94
  *
95
- * @throws {FailedPutS3EngineError} Thrown if there is an error during the S3 PutObject operation.
95
+ * @throws {FailedPutS3StorageEngineError} Thrown if there is an error during the S3 PutObject operation.
96
96
  */
97
97
  static async putModel(model) {
98
98
  const Key = [this.configuration.prefix, `${model.id}.json`].join('/');
@@ -105,7 +105,7 @@ class S3Engine extends Engine {
105
105
  ContentType: 'application/json',
106
106
  }));
107
107
  } catch (error) {
108
- throw new FailedPutS3EngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
108
+ throw new FailedPutS3StorageEngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
109
109
  }
110
110
  }
111
111
 
@@ -133,7 +133,7 @@ class S3Engine extends Engine {
133
133
  *
134
134
  * @param {Object} index - An object where keys are locations and values are key value pairs of models and their ids.
135
135
  * @returns {Promise<void>}
136
- * @throws {FailedPutS3EngineError} Thrown if there is an error during the S3 PutObject operation.
136
+ * @throws {FailedPutS3StorageEngineError} Thrown if there is an error during the S3 PutObject operation.
137
137
  */
138
138
  static async putIndex(index) {
139
139
  const processIndex = async (location, models) => {
@@ -153,7 +153,7 @@ class S3Engine extends Engine {
153
153
  }),
154
154
  }));
155
155
  } catch (error) {
156
- throw new FailedPutS3EngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
156
+ throw new FailedPutS3StorageEngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
157
157
  }
158
158
  };
159
159
 
@@ -205,7 +205,7 @@ class S3Engine extends Engine {
205
205
  * @param {Object} compiledIndex - The compiled search index data.
206
206
  * @returns {Promise<void>}
207
207
  *
208
- * @throws {FailedPutS3EngineError} Thrown if there is an error during the S3 PutObject operation.
208
+ * @throws {FailedPutS3StorageEngineError} Thrown if there is an error during the S3 PutObject operation.
209
209
  */
210
210
  static async putSearchIndexCompiled(model, compiledIndex) {
211
211
  const Key = [this.configuration.prefix, model.toString(), '_search_index.json'].join('/');
@@ -218,7 +218,7 @@ class S3Engine extends Engine {
218
218
  ContentType: 'application/json',
219
219
  }));
220
220
  } catch (error) {
221
- throw new FailedPutS3EngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
221
+ throw new FailedPutS3StorageEngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
222
222
  }
223
223
  }
224
224
 
@@ -229,7 +229,7 @@ class S3Engine extends Engine {
229
229
  * @param {Object} rawIndex - The raw search index data.
230
230
  * @returns {Promise<void>}
231
231
  *
232
- * @throws {FailedPutS3EngineError} Thrown if there is an error during the S3 PutObject operation.
232
+ * @throws {FailedPutS3StorageEngineError} Thrown if there is an error during the S3 PutObject operation.
233
233
  */
234
234
  static async putSearchIndexRaw(model, rawIndex) {
235
235
  const Key = [this.configuration.prefix, model.toString(), '_search_index_raw.json'].join('/');
@@ -242,9 +242,9 @@ class S3Engine extends Engine {
242
242
  ContentType: 'application/json',
243
243
  }));
244
244
  } catch (error) {
245
- throw new FailedPutS3EngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
245
+ throw new FailedPutS3StorageEngineError(`Failed to put s3://${this.configuration.bucket}/${Key}`, error);
246
246
  }
247
247
  }
248
248
  }
249
249
 
250
- export default S3Engine;
250
+ export default S3StorageEngine;
@@ -1,14 +1,14 @@
1
- import Query from '../Query.js';
2
- import Type from '../type/index.js';
1
+ import Query from '../../Query.js';
2
+ import Type from '../../type/index.js';
3
3
  import lunr from 'lunr';
4
4
 
5
5
  /**
6
- * The `Engine` class provides a base interface for implementing data storage and retrieval engines.
6
+ * The `StorageEngine` class provides a base interface for implementing data storage and retrieval engines.
7
7
  * It includes methods for handling models, indexes, and search functionality.
8
8
  *
9
- * @class Engine
9
+ * @class StorageEngine
10
10
  */
11
- class Engine {
11
+ class StorageEngine {
12
12
  static configuration = undefined;
13
13
  static _searchCache = undefined;
14
14
 
@@ -457,7 +457,7 @@ class Engine {
457
457
  * Configures the engine with specific settings.
458
458
  *
459
459
  * @param {Object} configuration - The configuration settings for the engine.
460
- * @returns {Engine} A new engine instance with the applied configuration.
460
+ * @returns {StorageEngine} A new engine instance with the applied configuration.
461
461
  */
462
462
  static configure(configuration) {
463
463
  class ConfiguredStore extends this {
@@ -476,7 +476,7 @@ class Engine {
476
476
  * @abstract
477
477
  */
478
478
  static checkConfiguration() {
479
- // Implemented in extending Engine class
479
+ // Implemented in extending StorageEngine class
480
480
  }
481
481
 
482
482
  /**
@@ -568,9 +568,9 @@ export class MissConfiguredError extends EngineError {
568
568
  * @param {Object} configuration - The configuration object that caused the misconfiguration.
569
569
  */
570
570
  constructor(configuration) {
571
- super('Engine is miss-configured');
571
+ super('StorageEngine is miss-configured');
572
572
  this.configuration = configuration;
573
573
  }
574
574
  }
575
575
 
576
- export default Engine;
576
+ export default StorageEngine;
package/src/type/index.js CHANGED
@@ -15,23 +15,18 @@ import StringType from './simple/StringType.js';
15
15
  * @property {DateType} Date
16
16
  * @property {ArrayType} Array
17
17
  * @property {CustomType} Custom
18
- * @property {ResolvedType} Resolved
18
+ * @property {{Slug: SlugType}} Resolved
19
19
  * @property {Model} Model
20
20
  */
21
- const Type = {};
22
-
23
- Type.String = StringType;
24
- Type.Number = NumberType;
25
- Type.Boolean = BooleanType;
26
- Type.Date = DateType;
27
- Type.Array = ArrayType;
28
- Type.Custom = CustomType;
29
-
30
- /**
31
- * @class ResolvedType
32
- * @property {SlugType} Slug
33
- */
34
- Type.Resolved = {Slug: SlugType};
35
- Type.Model = Model;
21
+ class Type {
22
+ static Model = Model;
23
+ static String = StringType;
24
+ static Number = NumberType;
25
+ static Boolean = BooleanType;
26
+ static Date = DateType;
27
+ static Array = ArrayType;
28
+ static Custom = CustomType;
29
+ static Resolved = {Slug: SlugType};
30
+ }
36
31
 
37
32
  export default Type;
@@ -1,3 +0,0 @@
1
- import FileEngine from '../../src/engine/FileEngine.js';
2
-
3
- export default FileEngine;
@@ -1,3 +0,0 @@
1
- import HTTPEngine from '../../src/engine/HTTPEngine.js';
2
-
3
- export default HTTPEngine;
@@ -1,3 +0,0 @@
1
- import S3Engine from '../../src/engine/S3Engine.js';
2
-
3
- export default S3Engine;