@_linked/server 3.2.0 → 3.4.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/CHANGELOG.md +12 -0
- package/lib/esm/shapes/LinkedServer.js +38 -24
- package/lib/esm/shapes/LinkedServer.js.map +1 -1
- package/lib/esm/shapes/quadstores/RemoteDataset.d.ts +20 -0
- package/lib/esm/shapes/quadstores/RemoteDataset.js +37 -0
- package/lib/esm/shapes/quadstores/RemoteDataset.js.map +1 -1
- package/lib/esm/utils/fatalError.js +2 -0
- package/lib/esm/utils/fatalError.js.map +1 -1
- package/lib/esm/utils/queryPlane.js +11 -3
- package/lib/esm/utils/queryPlane.js.map +1 -1
- package/lib/esm/utils/rawQueries.js +14 -6
- package/lib/esm/utils/rawQueries.js.map +1 -1
- package/lib/esm/utils/rpcExposure.js +13 -5
- package/lib/esm/utils/rpcExposure.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +37 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @\_linked/server
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#190](https://github.com/linked-fw/server/pull/190) [`1059665`](https://github.com/linked-fw/server/commit/10596652c4f481c96c50cb711ba63df0051e4e1e) Thanks [@flyon](https://github.com/flyon)! - `RemoteDataset`'s url form sends the signed-in user's WebID of the current call as `x-linked-end-user` (exported as `END_USER_HEADER`). A system context, an anonymous request and code outside any call send none; `forwardEndUser: false` turns it off.
|
|
8
|
+
|
|
9
|
+
## 3.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#187](https://github.com/linked-fw/server/pull/187) [`33a34ea`](https://github.com/linked-fw/server/commit/33a34eaf62deb591140542d8d324ae3ea0eb74a4) Thanks [@flyon](https://github.com/flyon)! - A second copy of this package in one process no longer falls back to defaults: `server.rawQueries`, `server.rpcExposure` and the host's query catalog resolver live on `globalThis` (core's `sharedState`), and the process setup (cookie-jar `fetch`, `process` error listeners) runs once per process. `RemoteDatasetError`, its two subclasses and `FatalStartupError` are branded, so `isLinkedError(err, RemoteDatasetUnreachableError)` from `@_linked/core` matches one thrown by another copy. Requires `@_linked/core` 2.36.0.
|
|
14
|
+
|
|
3
15
|
## 3.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -30,6 +30,7 @@ import { ShapeProvider } from '@_linked/server-utils/utils/ShapeProvider';
|
|
|
30
30
|
import { getCallContext, httpCallContext, runAsSystem, runInHttpContext, runWithCallContext, } from '@_linked/server-utils/utils/CallContext';
|
|
31
31
|
import { Shape } from '@_linked/core/shapes/Shape';
|
|
32
32
|
import { LinkedErrorLogging } from '@_linked/core/utils/LinkedErrorLogging';
|
|
33
|
+
import { sharedState } from '@_linked/core/utils/sharedState';
|
|
33
34
|
import { FileStorePurposes, LinkedFileStorage, } from '@_linked/core/utils/LinkedFileStorage';
|
|
34
35
|
import { getResizedImagesStore } from '../utils/resizedImagesPurpose.js';
|
|
35
36
|
import { paint } from '../utils/paint.js';
|
|
@@ -146,30 +147,43 @@ import { setRawQueriesMode } from '../utils/rawQueries.js';
|
|
|
146
147
|
//prevent errors in node.js when (s)css files are imported in js
|
|
147
148
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
148
149
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
//
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
process.on('
|
|
171
|
-
|
|
172
|
-
|
|
150
|
+
// The process-wide setup below runs once per process, not once per copy of this module: a
|
|
151
|
+
// second copy would wrap the already-wrapped fetch in a second cookie jar and register every
|
|
152
|
+
// process listener twice. See
|
|
153
|
+
// https://github.com/linked-fw/cli/blob/main/docs/architecture/shared-state-and-error-brands.md.
|
|
154
|
+
const processSetup = sharedState('@_linked/server', 'LinkedServer.processSetup', () => ({
|
|
155
|
+
done: false,
|
|
156
|
+
}));
|
|
157
|
+
if (!processSetup.done) {
|
|
158
|
+
processSetup.done = true;
|
|
159
|
+
installProcessSetup();
|
|
160
|
+
}
|
|
161
|
+
function installProcessSetup() {
|
|
162
|
+
// Install a global fetch that persists cookies across redirects using a CookieJar.
|
|
163
|
+
// This ensures server-side requests behave more like browsers when handling Set-Cookie + redirects.
|
|
164
|
+
const __lincdCookieJar = new CookieJar();
|
|
165
|
+
// Wrap native fetch with fetch-cookie so it reads/writes cookies in the jar.
|
|
166
|
+
const __lincdFetchWithCookies = fetchCookie(fetch, __lincdCookieJar);
|
|
167
|
+
// Expose (optionally) for debugging/tests; not required by app logic.
|
|
168
|
+
globalThis.__lincdCookieJar = __lincdCookieJar;
|
|
169
|
+
// Set the global fetch used throughout the server code path
|
|
170
|
+
globalThis.fetch = __lincdFetchWithCookies;
|
|
171
|
+
process.on('uncaughtException', (err) => {
|
|
172
|
+
console.warn(paint('red', 'Asynchronous error caught.'));
|
|
173
|
+
console.error(err);
|
|
174
|
+
// error logging
|
|
175
|
+
LinkedErrorLogging.log(err);
|
|
176
|
+
});
|
|
177
|
+
process.on('unhandledRejection', (err) => {
|
|
178
|
+
console.warn(paint('red', 'Unhandled rejection caught.'));
|
|
179
|
+
console.error(err);
|
|
180
|
+
// error logging
|
|
181
|
+
LinkedErrorLogging.log(err);
|
|
182
|
+
});
|
|
183
|
+
process.on('warning', (e) => console.warn(e.stack));
|
|
184
|
+
//allow more listeners for when we have many concurrent users
|
|
185
|
+
events.EventEmitter.prototype.setMaxListeners(500);
|
|
186
|
+
}
|
|
173
187
|
// const jsdom = require("jsdom");
|
|
174
188
|
// const { JSDOM } = jsdom;
|
|
175
189
|
// const { document } = (new JSDOM(`...`)).window;
|