@fougere/adapter-memory 0.6.0-alpha.0 → 0.7.0-alpha.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 +9 -9
- package/dist/index.d.ts +1 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -23
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/src/index.ts +12 -24
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @fougere/adapter-memory
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> A Map — the source that ships no driver
|
|
4
4
|
|
|
5
5
|
What an app with no `db` runs on, and what a test runs on when the shape is the subject
|
|
6
6
|
and the engine is not.
|
|
@@ -27,15 +27,15 @@ That is not written here. `storageOver` (`@fougere/core`) derives the thirteen f
|
|
|
27
27
|
below, so this package is the four:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
const
|
|
30
|
+
const map = new Map<string, Values>();
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
|
-
client:
|
|
34
|
-
get: async (key) =>
|
|
35
|
-
has: async (key) =>
|
|
36
|
-
set: async (key,
|
|
37
|
-
delete: async (key) =>
|
|
38
|
-
all: async () => [...
|
|
33
|
+
client: map,
|
|
34
|
+
get: async (key) => map.get(key),
|
|
35
|
+
has: async (key) => map.has(key),
|
|
36
|
+
set: async (key, values) => { map.set(key, values); },
|
|
37
|
+
delete: async (key) => map.delete(key),
|
|
38
|
+
all: async () => [...map.values()],
|
|
39
39
|
};
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -46,5 +46,5 @@ No `transacted`: a Map has no unit of work. A
|
|
|
46
46
|
transacting, and the boot says which of the two it built. No `migrate` either — a Map has no
|
|
47
47
|
shape to bring up to date.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Instances live for the life of the process and go with it. Nothing is written anywhere; for rows
|
|
50
50
|
that must survive a restart, see `@fougere/adapter-file`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rows in a Map — the source that ships no driver, in the ten lines the frame leaves.
|
|
3
|
-
*
|
|
4
|
-
* It is what an app with no `db` runs on, and what a test runs on when the shape is the
|
|
5
|
-
* subject and the engine is not. `storageOver` derives the thirteen gestures from the four
|
|
6
|
-
* below, so nothing about pages, criteria or lifecycle stamps is respelled here — three
|
|
7
|
-
* hand-written copies of this in the demos each answered six of the thirteen, forced the
|
|
8
|
-
* field name `id` and minted a uuid whatever the entity declared.
|
|
9
|
-
*
|
|
10
|
-
* No `transacted`: a Map has no unit of work, so a frame reads the absence and compensates
|
|
11
|
-
* instead of transacting (`boot/together.ts`), saying which of the two it built. No
|
|
12
|
-
* `migrate` either — a Map has no shape to bring up to date.
|
|
13
|
-
*/
|
|
1
|
+
/** A Map — the source that ships no driver, in the ten lines the frame leaves. */
|
|
14
2
|
import { type Source } from '@fougere/core';
|
|
15
3
|
/** The whole port over a Map, per entity. */
|
|
16
4
|
export declare const createMemoryStorage: import("@fougere/core").StorageFactory;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAiD,KAAK,MAAM,EAAqB,MAAM,eAAe,CAAC;AAgB9G,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,wCAAgC,CAAC;AAEjE,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rows in a Map — the source that ships no driver, in the ten lines the frame leaves.
|
|
3
|
-
*
|
|
4
|
-
* It is what an app with no `db` runs on, and what a test runs on when the shape is the
|
|
5
|
-
* subject and the engine is not. `storageOver` derives the thirteen gestures from the four
|
|
6
|
-
* below, so nothing about pages, criteria or lifecycle stamps is respelled here — three
|
|
7
|
-
* hand-written copies of this in the demos each answered six of the thirteen, forced the
|
|
8
|
-
* field name `id` and minted a uuid whatever the entity declared.
|
|
9
|
-
*
|
|
10
|
-
* No `transacted`: a Map has no unit of work, so a frame reads the absence and compensates
|
|
11
|
-
* instead of transacting (`boot/together.ts`), saying which of the two it built. No
|
|
12
|
-
* `migrate` either — a Map has no shape to bring up to date.
|
|
13
|
-
*/
|
|
1
|
+
/** A Map — the source that ships no driver, in the ten lines the frame leaves. */
|
|
14
2
|
import { Sources, storageOver } from '@fougere/core';
|
|
15
|
-
/** One entity
|
|
16
|
-
function
|
|
17
|
-
const
|
|
3
|
+
/** One entity, held for the life of the process, released with nothing to close. */
|
|
4
|
+
function mapStore() {
|
|
5
|
+
const map = new Map();
|
|
18
6
|
return {
|
|
19
|
-
client:
|
|
20
|
-
get: async (key) =>
|
|
21
|
-
has: async (key) =>
|
|
22
|
-
set: async (key,
|
|
23
|
-
delete: async (key) =>
|
|
24
|
-
all: async () => [...
|
|
7
|
+
client: map,
|
|
8
|
+
get: async (key) => map.get(key),
|
|
9
|
+
has: async (key) => map.has(key),
|
|
10
|
+
set: async (key, values) => { map.set(key, values); },
|
|
11
|
+
delete: async (key) => map.delete(key),
|
|
12
|
+
all: async () => [...map.values()],
|
|
25
13
|
};
|
|
26
14
|
}
|
|
27
15
|
/** The whole port over a Map, per entity. */
|
|
28
|
-
export const createMemoryStorage = storageOver(() =>
|
|
16
|
+
export const createMemoryStorage = storageOver(() => mapStore());
|
|
29
17
|
export function setupMemory() {
|
|
30
18
|
return { storageFactory: createMemoryStorage, name: 'memory' };
|
|
31
19
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAE,OAAO,EAAE,WAAW,EAA2D,MAAM,eAAe,CAAC;AAE9G,oFAAoF;AACpF,SAAS,QAAQ;IACf,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEtC,OAAO;QACL,MAAM,EAAE,GAAG;QACX,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;QAChC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;QAChC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;QACtC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;KACnC,CAAC;AACJ,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEjE,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACjE,CAAC;AAED,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAmB,EAAU,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/adapter-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-alpha.0",
|
|
4
4
|
"description": "Rows in a Map — the source a first run meets, and the one that ships no driver.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@fougere/core": "0.
|
|
33
|
-
"@fougere/schema": "0.6.0-alpha.0"
|
|
32
|
+
"@fougere/core": "0.7.0-alpha.0"
|
|
34
33
|
},
|
|
35
34
|
"publishConfig": {
|
|
36
35
|
"access": "public"
|
|
37
36
|
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@fougere/schema": "0.7.0-alpha.0"
|
|
39
|
+
},
|
|
38
40
|
"scripts": {
|
|
39
41
|
"build": "rm -rf dist && tsc",
|
|
40
42
|
"test": "vitest run",
|
package/src/index.ts
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* It is what an app with no `db` runs on, and what a test runs on when the shape is the
|
|
5
|
-
* subject and the engine is not. `storageOver` derives the thirteen gestures from the four
|
|
6
|
-
* below, so nothing about pages, criteria or lifecycle stamps is respelled here — three
|
|
7
|
-
* hand-written copies of this in the demos each answered six of the thirteen, forced the
|
|
8
|
-
* field name `id` and minted a uuid whatever the entity declared.
|
|
9
|
-
*
|
|
10
|
-
* No `transacted`: a Map has no unit of work, so a frame reads the absence and compensates
|
|
11
|
-
* instead of transacting (`boot/together.ts`), saying which of the two it built. No
|
|
12
|
-
* `migrate` either — a Map has no shape to bring up to date.
|
|
13
|
-
*/
|
|
14
|
-
import { Sources, storageOver, type Row, type Rows, type Source, type SourceConfig } from '@fougere/core';
|
|
1
|
+
/** A Map — the source that ships no driver, in the ten lines the frame leaves. */
|
|
2
|
+
import { Sources, storageOver, type Store, type Values, type Source, type SourceConfig } from '@fougere/core';
|
|
15
3
|
|
|
16
|
-
/** One entity
|
|
17
|
-
function
|
|
18
|
-
const
|
|
4
|
+
/** One entity, held for the life of the process, released with nothing to close. */
|
|
5
|
+
function mapStore(): Store {
|
|
6
|
+
const map = new Map<string, Values>();
|
|
19
7
|
|
|
20
8
|
return {
|
|
21
|
-
client:
|
|
22
|
-
get: async (key) =>
|
|
23
|
-
has: async (key) =>
|
|
24
|
-
set: async (key,
|
|
25
|
-
delete: async (key) =>
|
|
26
|
-
all: async () => [...
|
|
9
|
+
client: map,
|
|
10
|
+
get: async (key) => map.get(key),
|
|
11
|
+
has: async (key) => map.has(key),
|
|
12
|
+
set: async (key, values) => { map.set(key, values); },
|
|
13
|
+
delete: async (key) => map.delete(key),
|
|
14
|
+
all: async () => [...map.values()],
|
|
27
15
|
};
|
|
28
16
|
}
|
|
29
17
|
|
|
30
18
|
/** The whole port over a Map, per entity. */
|
|
31
|
-
export const createMemoryStorage = storageOver(() =>
|
|
19
|
+
export const createMemoryStorage = storageOver(() => mapStore());
|
|
32
20
|
|
|
33
21
|
export function setupMemory(): Source {
|
|
34
22
|
return { storageFactory: createMemoryStorage, name: 'memory' };
|