@acodeninja/persist 3.0.0-next.13 → 3.0.0-next.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acodeninja/persist",
3
- "version": "3.0.0-next.13",
3
+ "version": "3.0.0-next.14",
4
4
  "description": "A JSON based data modelling and persistence module with alternate storage mechanisms.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -93,7 +93,7 @@ export default class HTTPStorageEngine extends StorageEngine {
93
93
  * @return Promise<void>
94
94
  */
95
95
  putIndex(constructor, index) {
96
- return this.#processFetch(this.#generateURL([constructor.name]), {
96
+ return this.#processFetch(this.#generateURL([constructor.toString()]), {
97
97
  ...this.#getWriteOptions(),
98
98
  body: JSON.stringify(index),
99
99
  });
@@ -107,7 +107,7 @@ export default class HTTPStorageEngine extends StorageEngine {
107
107
  */
108
108
  getSearchIndex(constructor) {
109
109
  return this.#processFetch(
110
- this.#generateURL([constructor.name, 'search']),
110
+ this.#generateURL([constructor.toString(), 'search']),
111
111
  this.#getReadOptions(),
112
112
  {},
113
113
  );
@@ -121,7 +121,7 @@ export default class HTTPStorageEngine extends StorageEngine {
121
121
  * @return Promise<void>
122
122
  */
123
123
  putSearchIndex(constructor, index) {
124
- return this.#processFetch(this.#generateURL([constructor.name, 'search']), {
124
+ return this.#processFetch(this.#generateURL([constructor.toString(), 'search']), {
125
125
  ...this.#getWriteOptions(),
126
126
  body: JSON.stringify(index),
127
127
  });
@@ -1,29 +0,0 @@
1
- # Persist future interface
2
-
3
- ```javascript
4
- import Persist from "@acodeninja/persist";
5
- import S3StorageEngine from "@acodeninja/persist/engine/storage/s3";
6
- class Person extends Persist.Model {
7
- static {
8
- this.withName('Person');
9
- this.withIndex(['string']);
10
- this.withSearch(['string']);
11
-
12
- this.name = Persist.Property.String.required;
13
- }
14
- }
15
-
16
- const connection = Persist.register('main', {
17
- storage: new S3StorageEngine({
18
- client: new S3Client(),
19
- }),
20
- });
21
-
22
- // to get the connection `Persist.get('main')`
23
-
24
- const person = new Person({name: 'Joe Bloggs'});
25
-
26
- await connection.put(person);
27
-
28
- await connection.delete(person);
29
- ```