@_linked/server 3.10.0 → 3.11.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @\_linked/server
2
2
 
3
+ ## 3.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#210](https://github.com/linked-fw/server/pull/210) [`f494caa`](https://github.com/linked-fw/server/commit/f494caadb531d8acdbd3729a31df7ffe3dfbd525) Thanks [@flyon](https://github.com/flyon)! - `LINKED_ONTOLOGY_GRAPH` and `LINKED_SHAPE_GRAPH` set where the stores keep the packages' ontology data and shapes (core 2.41's graph targets): `package` (default), `default`, or the absolute IRI of one shared graph. The server checks them at boot (an invalid value stops the boot, naming the variable) and fills them into every store that takes graph targets, where the store's own options leave them unset; a store that takes none (`RemoteDataset`) runs `package`, with a warning when the variables ask for another mode. `GET /admin/routes` reports each store's `ontologyGraph` / `shapeGraph` and the variables (`graphTargetEnv`). The boot log names a shared graph or the default graph when the syncs wrote there, and `shapeGraphs` reports `target`. The ontology phase's `graphs` / `droppedGraphs` no longer list the inference probe's temporary graphs. Needs `@_linked/core` ^2.41.0.
8
+
3
9
  ## 3.10.0
4
10
 
5
11
  ### Minor Changes
@@ -39,7 +39,7 @@ import { LinkedStorage } from '@_linked/core/utils/LinkedStorage';
39
39
  import { getAllShapeClasses, getShapeClass, getSuperShapesClasses, } from '@_linked/core/utils/ShapeClass';
40
40
  import path from 'path';
41
41
  import { pathToFileURL } from 'node:url';
42
- import { isFatalError } from '../utils/fatalError.js';
42
+ import { FatalStartupError, isFatalError } from '../utils/fatalError.js';
43
43
  import { discoverLinkedDependencies, hasModuleEntry, isBundledBySsr, NODE_IMPORT_CONDITIONS, readDependencyLists, readInstalledPackage, resolveBackendEntry, resolveDevBackendEntry, ssrNoExternalOf, } from '../utils/linkedDependencies.js';
44
44
  /**
45
45
  * `instanceof ShapeProvider`, tolerating a second copy of server-utils.
@@ -139,6 +139,7 @@ import { resolveRouteAssets } from '../utils/routeAssets.js';
139
139
  import { resolveRouteComponent, ssrCssInlineUrls, ssrCssScope, } from '../utils/ssrCss.js';
140
140
  import { appShapesGraph, bootOrphanScope, loadShapeGraphCore, syncShapeGraphsInto, viteShapesTurtleGenerator, } from '../utils/syncShapes.js';
141
141
  import { bootSyncsOntologies, loadOntologyCore, runOntologyPhase, ontologyPackageDirs, sourceModuleImporter, shapeSyncOn, syncOntologiesThenShapes, } from '../utils/ontologySync.js';
142
+ import { applyGraphTargetsFromEnv } from '../utils/graphTargets.js';
142
143
  import { AdminRequestError, assertReloadablePackages, registerAdminRoutes, resolveAdminSecret, } from '../utils/adminChannel.js';
143
144
  import { envMs, withTimeout } from '../utils/withTimeout.js';
144
145
  import { invalidateSourceUnder } from '../utils/reloadSource.js';
@@ -806,6 +807,16 @@ let LinkedServer = class LinkedServer extends Shape {
806
807
  * @todo Check if default file store is set, if not, set it
807
808
  */
808
809
  async initStores() {
810
+ var _a;
811
+ // LINKED_ONTOLOGY_GRAPH / LINKED_SHAPE_GRAPH: checked (an invalid value stops the boot) and
812
+ // filled into every store that takes graph targets, before anything reads or syncs.
813
+ // A rejected boot does not end the process by itself, so the error is fatal.
814
+ try {
815
+ applyGraphTargetsFromEnv(process.env, LinkedStorage.getDatasets());
816
+ }
817
+ catch (err) {
818
+ throw new FatalStartupError(`[LinkedServer] ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`, { cause: err });
819
+ }
809
820
  return Promise.all(LinkedStorage.getDatasets().map((store) => {
810
821
  return store.init ? store.init() : Promise.resolve();
811
822
  }));