@static-suite/static-suite-data-server 0.0.2 → 0.0.4
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
CHANGED
|
@@ -31,10 +31,12 @@ There are three main use cases:
|
|
|
31
31
|
|
|
32
32
|
### SSG develop/build phase
|
|
33
33
|
|
|
34
|
-
Require `dist/lib
|
|
34
|
+
Require `dataServer` from `@static-suite/static-suite-data-server/dist/lib/` inside the SSG, and call its `init()` function:
|
|
35
35
|
|
|
36
36
|
```javascript
|
|
37
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
dataServer,
|
|
39
|
+
} = require('@static-suite/static-suite-data-server/dist/lib/');
|
|
38
40
|
|
|
39
41
|
// Init Data Server.
|
|
40
42
|
const { store } = dataServer.init({ dataDir: '../data/prod' });
|
package/dist/http/README.md
CHANGED
|
@@ -31,10 +31,12 @@ There are three main use cases:
|
|
|
31
31
|
|
|
32
32
|
### SSG develop/build phase
|
|
33
33
|
|
|
34
|
-
Require `dist/lib
|
|
34
|
+
Require `dataServer` from `@static-suite/static-suite-data-server/dist/lib/` inside the SSG, and call its `init()` function:
|
|
35
35
|
|
|
36
36
|
```javascript
|
|
37
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
dataServer,
|
|
39
|
+
} = require('@static-suite/static-suite-data-server/dist/lib/');
|
|
38
40
|
|
|
39
41
|
// Init Data Server.
|
|
40
42
|
const { store } = dataServer.init({ dataDir: '../data/prod' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storeManager.d.ts","sourceRoot":"","sources":["../../../src/lib/store/storeManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsG7C,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"storeManager.d.ts","sourceRoot":"","sources":["../../../src/lib/store/storeManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsG7C,eAAO,MAAM,YAAY,EAAE,YAmG1B,CAAC"}
|
|
@@ -112,16 +112,18 @@ exports.storeManager = {
|
|
|
112
112
|
remove: (relativeFilepath) => {
|
|
113
113
|
// Get stored data before removing it from store.
|
|
114
114
|
const storedData = _1.store.data.get(relativeFilepath);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
if (storedData) {
|
|
116
|
+
// Remove data from URL index.
|
|
117
|
+
const url = storedData.data?.content?.url?.path;
|
|
118
|
+
if (url) {
|
|
119
|
+
_1.store.index.url.delete(url);
|
|
120
|
+
}
|
|
121
|
+
// Remove data from UUID index.
|
|
122
|
+
const uuid = storedData.data?.content?.uuid;
|
|
123
|
+
const langcode = storedData.data?.content?.langcode?.value;
|
|
124
|
+
if (uuid && langcode) {
|
|
125
|
+
_1.store.index.uuid.get(langcode)?.delete(uuid);
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
// Delete file contents from store.
|
|
127
129
|
_1.store.data.delete(relativeFilepath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@static-suite/static-suite-data-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A flexible, fast and developer friendly Data Server for Static Suite",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"typings": "./dist/lib/index.d.ts",
|
|
@@ -99,4 +99,4 @@
|
|
|
99
99
|
"pre-commit": "yarn build"
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
}
|
|
102
|
+
}
|
|
@@ -145,17 +145,19 @@ export const storeManager: StoreManager = {
|
|
|
145
145
|
// Get stored data before removing it from store.
|
|
146
146
|
const storedData = store.data.get(relativeFilepath);
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
if (storedData) {
|
|
149
|
+
// Remove data from URL index.
|
|
150
|
+
const url = storedData.data?.content?.url?.path;
|
|
151
|
+
if (url) {
|
|
152
|
+
store.index.url.delete(url);
|
|
153
|
+
}
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
// Remove data from UUID index.
|
|
156
|
+
const uuid = storedData.data?.content?.uuid;
|
|
157
|
+
const langcode = storedData.data?.content?.langcode?.value;
|
|
158
|
+
if (uuid && langcode) {
|
|
159
|
+
store.index.uuid.get(langcode)?.delete(uuid);
|
|
160
|
+
}
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
// Delete file contents from store.
|