@powerhousedao/reactor-local 1.10.0 → 1.10.2
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/CHANGELOG.md +5 -21
- package/dist/{chunk-PS645UBL.js → chunk-73W7YM3M.js} +51 -29
- package/dist/cli.js +1 -1
- package/dist/index.js +2 -2
- package/dist/server.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
## 1.10.
|
|
2
|
-
|
|
3
|
-
### 🚀 Features
|
|
4
|
-
|
|
5
|
-
- **reactor-api:** Added support for processors ([#655](https://github.com/powerhouse-inc/powerhouse/pull/655))
|
|
6
|
-
|
|
7
|
-
### 🩹 Fixes
|
|
8
|
-
|
|
9
|
-
- **reactor-local:** start issues ([#670](https://github.com/powerhouse-inc/powerhouse/pull/670))
|
|
10
|
-
- **monorepo:** remove nx cloud id ([45da8784](https://github.com/powerhouse-inc/powerhouse/commit/45da8784))
|
|
1
|
+
## 1.10.2 (2024-12-11)
|
|
11
2
|
|
|
12
3
|
### 🧱 Updated Dependencies
|
|
13
4
|
|
|
14
|
-
- Updated document-model-libs to 1.121.
|
|
15
|
-
- Updated document-drive to 1.
|
|
16
|
-
- Updated document-model to 2.
|
|
17
|
-
- Updated @powerhousedao/reactor-api to 1.10.
|
|
18
|
-
- Updated @powerhousedao/scalars to 1.13.0
|
|
19
|
-
|
|
20
|
-
### ❤️ Thank You
|
|
21
|
-
|
|
22
|
-
- acaldas
|
|
23
|
-
- frankp.eth @froid1911
|
|
24
|
-
- ryanwolhuter @ryanwolhuter
|
|
5
|
+
- Updated document-model-libs to 1.121.2
|
|
6
|
+
- Updated document-drive to 1.10.1
|
|
7
|
+
- Updated document-model to 2.12.0
|
|
8
|
+
- Updated @powerhousedao/reactor-api to 1.10.2
|
|
25
9
|
|
|
26
10
|
## 1.1.0 (2024-10-29)
|
|
27
11
|
|
|
@@ -1349,16 +1349,17 @@ var InternalTransmitter = class {
|
|
|
1349
1349
|
if (state) {
|
|
1350
1350
|
return state;
|
|
1351
1351
|
}
|
|
1352
|
-
const
|
|
1352
|
+
const getDocumentOptions = {
|
|
1353
|
+
revisions: {
|
|
1354
|
+
[strand.scope]: index
|
|
1355
|
+
},
|
|
1356
|
+
checkHashes: false
|
|
1357
|
+
};
|
|
1358
|
+
const document = await (strand.documentId ? this.drive.getDocument(
|
|
1353
1359
|
strand.driveId,
|
|
1354
1360
|
strand.documentId,
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
[strand.scope]: index
|
|
1358
|
-
},
|
|
1359
|
-
checkHashes: false
|
|
1360
|
-
}
|
|
1361
|
-
);
|
|
1361
|
+
getDocumentOptions
|
|
1362
|
+
) : this.drive.getDrive(strand.driveId, getDocumentOptions));
|
|
1362
1363
|
if (index < 0) {
|
|
1363
1364
|
stateByIndex.set(index, document.initialState.state[strand.scope]);
|
|
1364
1365
|
} else {
|
|
@@ -2133,13 +2134,25 @@ function filterOperationsByRevision(operations, revisions) {
|
|
|
2133
2134
|
if (!revisions) {
|
|
2134
2135
|
return operations;
|
|
2135
2136
|
}
|
|
2136
|
-
return Object.keys(operations).reduce(
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2137
|
+
return Object.keys(operations).reduce(
|
|
2138
|
+
(acc, scope) => {
|
|
2139
|
+
const revision = revisions[scope];
|
|
2140
|
+
if (revision !== void 0) {
|
|
2141
|
+
acc[scope] = operations[scope].filter((op) => op.index <= revision);
|
|
2142
|
+
}
|
|
2143
|
+
return acc;
|
|
2144
|
+
},
|
|
2145
|
+
{ global: [], local: [] }
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
function isAtRevision(document, revisions) {
|
|
2149
|
+
return !revisions || Object.entries(revisions).find(([scope, revision]) => {
|
|
2150
|
+
const operation = document.operations[scope].at(-1);
|
|
2151
|
+
if (revision === -1) {
|
|
2152
|
+
return operation !== void 0;
|
|
2153
|
+
}
|
|
2154
|
+
return operation?.index !== revision;
|
|
2155
|
+
}) === void 0;
|
|
2143
2156
|
}
|
|
2144
2157
|
|
|
2145
2158
|
// ../document-drive/src/server/index.ts
|
|
@@ -2761,21 +2774,27 @@ var BaseDocumentDriveServer = class extends AbstractDocumentDriveServer {
|
|
|
2761
2774
|
return this.storage.getDrives();
|
|
2762
2775
|
}
|
|
2763
2776
|
async getDrive(drive, options) {
|
|
2777
|
+
let document;
|
|
2764
2778
|
try {
|
|
2765
|
-
const
|
|
2766
|
-
if (
|
|
2767
|
-
|
|
2779
|
+
const cachedDocument = await this.cache.getDocument("drives", drive);
|
|
2780
|
+
if (cachedDocument && isDocumentDrive(cachedDocument)) {
|
|
2781
|
+
document = cachedDocument;
|
|
2782
|
+
if (isAtRevision(document, options?.revisions)) {
|
|
2783
|
+
return document;
|
|
2784
|
+
}
|
|
2768
2785
|
}
|
|
2769
2786
|
} catch (e) {
|
|
2770
2787
|
logger.error("Error getting drive from cache", e);
|
|
2771
2788
|
}
|
|
2772
|
-
const driveStorage = await this.storage.getDrive(drive);
|
|
2773
|
-
const
|
|
2774
|
-
if (!isDocumentDrive(
|
|
2789
|
+
const driveStorage = document ?? await this.storage.getDrive(drive);
|
|
2790
|
+
const result = this._buildDocument(driveStorage, options);
|
|
2791
|
+
if (!isDocumentDrive(result)) {
|
|
2775
2792
|
throw new Error(`Document with id ${drive} is not a Document Drive`);
|
|
2776
2793
|
} else {
|
|
2777
|
-
|
|
2778
|
-
|
|
2794
|
+
if (!options?.revisions) {
|
|
2795
|
+
this.cache.setDocument("drives", drive, result).catch(logger.error);
|
|
2796
|
+
}
|
|
2797
|
+
return result;
|
|
2779
2798
|
}
|
|
2780
2799
|
}
|
|
2781
2800
|
async getDriveBySlug(slug, options) {
|
|
@@ -2797,17 +2816,20 @@ var BaseDocumentDriveServer = class extends AbstractDocumentDriveServer {
|
|
|
2797
2816
|
}
|
|
2798
2817
|
}
|
|
2799
2818
|
async getDocument(drive, id, options) {
|
|
2819
|
+
let cachedDocument;
|
|
2800
2820
|
try {
|
|
2801
|
-
|
|
2802
|
-
if (
|
|
2803
|
-
return
|
|
2821
|
+
cachedDocument = await this.cache.getDocument(drive, id);
|
|
2822
|
+
if (cachedDocument && isAtRevision(cachedDocument, options?.revisions)) {
|
|
2823
|
+
return cachedDocument;
|
|
2804
2824
|
}
|
|
2805
2825
|
} catch (e) {
|
|
2806
2826
|
logger.error("Error getting document from cache", e);
|
|
2807
2827
|
}
|
|
2808
|
-
const documentStorage = await this.storage.getDocument(drive, id);
|
|
2828
|
+
const documentStorage = cachedDocument ?? await this.storage.getDocument(drive, id);
|
|
2809
2829
|
const document = this._buildDocument(documentStorage, options);
|
|
2810
|
-
|
|
2830
|
+
if (!options?.revisions) {
|
|
2831
|
+
this.cache.setDocument(drive, id, document).catch(logger.error);
|
|
2832
|
+
}
|
|
2811
2833
|
return document;
|
|
2812
2834
|
}
|
|
2813
2835
|
getDocuments(drive) {
|
|
@@ -2966,7 +2988,7 @@ var BaseDocumentDriveServer = class extends AbstractDocumentDriveServer {
|
|
|
2966
2988
|
};
|
|
2967
2989
|
}
|
|
2968
2990
|
_buildDocument(documentStorage, options) {
|
|
2969
|
-
if (documentStorage.state && (!options || options.checkHashes === false)) {
|
|
2991
|
+
if (documentStorage.state && (!options || options.checkHashes === false) && isAtRevision(documentStorage, options?.revisions)) {
|
|
2970
2992
|
return documentStorage;
|
|
2971
2993
|
}
|
|
2972
2994
|
const documentModel2 = this.getDocumentModel(documentStorage.documentType);
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { startServer } from './chunk-
|
|
2
|
-
export { DefaultStartServerOptions, startServer } from './chunk-
|
|
1
|
+
import { startServer } from './chunk-73W7YM3M.js';
|
|
2
|
+
export { DefaultStartServerOptions, startServer } from './chunk-73W7YM3M.js';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
startServer({ dev: true }).catch((error) => {
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DefaultStartServerOptions, startServer } from './chunk-
|
|
1
|
+
export { DefaultStartServerOptions, startServer } from './chunk-73W7YM3M.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-local",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.2",
|
|
5
5
|
"main": "dist/server.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"reactor-local": "dist/cli.js"
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"nanoevents": "^9.0.0",
|
|
28
28
|
"sanitize-filename": "^1.6.3",
|
|
29
29
|
"uuid": "^11.0.2",
|
|
30
|
-
"@powerhousedao/reactor-api": "1.10.
|
|
31
|
-
"document-model": "2.
|
|
30
|
+
"@powerhousedao/reactor-api": "1.10.2",
|
|
31
|
+
"document-model": "2.12.0",
|
|
32
32
|
"@powerhousedao/scalars": "1.13.0",
|
|
33
|
-
"document-model-libs": "1.121.
|
|
33
|
+
"document-model-libs": "1.121.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@powerhousedao/analytics-engine-graphql": "^0.2.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/ms": "^0.7.34",
|
|
41
41
|
"@types/node": "^22.7.5",
|
|
42
42
|
"tsup": "^8.3.5",
|
|
43
|
-
"document-drive": "1.
|
|
43
|
+
"document-drive": "1.10.1"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"start": "vite-node src/index.ts",
|