@_linked/server 3.11.0 → 3.12.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.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#212](https://github.com/linked-fw/server/pull/212) [`2ac07c4`](https://github.com/linked-fw/server/commit/2ac07c49918f31d94bcec03821a0ab29b1811f85) Thanks [@flyon](https://github.com/flyon)! - The graph targets are one global setting (`@_linked/core` 2.42). At boot the server reads `LINKED_ONTOLOGY_GRAPH` / `LINKED_SHAPE_GRAPH` (an invalid value is still a fatal boot error) and calls core's `setGraphTargets` once, before the boot initialises the stores and before the syncs; it no longer sets targets on each store. `GET /admin/routes` reports the setting as `graphTargets` (`{ontologyGraph, shapeGraph}`) next to `graphTargetEnv`; the per-dataset `ontologyGraph` / `shapeGraph` fields are gone. New boot warning: when routing pins `NodeShape` / `PropertyShape` or the ontology term shapes (`rdfs:Class`, `owl:Class`, `rdf:Property`, `owl:ObjectProperty`, `owl:DatatypeProperty`, `owl:AnnotationProperty`) to a dataset other than the default one, the server names them and the dataset and says the syncs write into the default dataset only. `applyGraphTargetsFromEnv(env)` takes no stores any more. Requires `@_linked/core` 2.42.0.
8
+
3
9
  ## 3.11.0
4
10
 
5
11
  ### Minor Changes
@@ -133,6 +133,12 @@ export declare class LinkedServer extends Shape {
133
133
  private syncRegisteredShapes;
134
134
  /** The root directory of a package with shapes: the app, a discovered linked package, or one the app resolves. */
135
135
  private shapePackageDir;
136
+ /**
137
+ * Boot: one warning when routing pins the shape shapes or the ontology term shapes to a dataset
138
+ * other than the default one, since the syncs write into the default dataset only (see
139
+ * {@link syncPinWarning}).
140
+ */
141
+ private warnOfSyncPins;
136
142
  /**
137
143
  * Boot: sync the registered ontologies into their graphs in app data and run the shape
138
144
  * check, before the shape sync (see utils/ontologySync). The sync follows the shape sync's
@@ -139,7 +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
+ import { applyGraphTargetsFromEnv, syncPinWarning } from '../utils/graphTargets.js';
143
143
  import { AdminRequestError, assertReloadablePackages, registerAdminRoutes, resolveAdminSecret, } from '../utils/adminChannel.js';
144
144
  import { envMs, withTimeout } from '../utils/withTimeout.js';
145
145
  import { invalidateSourceUnder } from '../utils/reloadSource.js';
@@ -364,6 +364,7 @@ let LinkedServer = class LinkedServer extends Shape {
364
364
  this.initPackage();
365
365
  this.server = express();
366
366
  await this.initBackendProviders();
367
+ this.warnOfSyncPins();
367
368
  await this.syncOntologiesOnBoot();
368
369
  await this.materializeShapesIntoStore();
369
370
  return this;
@@ -437,6 +438,16 @@ let LinkedServer = class LinkedServer extends Shape {
437
438
  const installed = readInstalledPackage(name, process.cwd());
438
439
  return installed === null || installed === void 0 ? void 0 : installed.root;
439
440
  }
441
+ /**
442
+ * Boot: one warning when routing pins the shape shapes or the ontology term shapes to a dataset
443
+ * other than the default one, since the syncs write into the default dataset only (see
444
+ * {@link syncPinWarning}).
445
+ */
446
+ warnOfSyncPins() {
447
+ const warning = syncPinWarning();
448
+ if (warning)
449
+ console.warn(warning);
450
+ }
440
451
  /**
441
452
  * Boot: sync the registered ontologies into their graphs in app data and run the shape
442
453
  * check, before the shape sync (see utils/ontologySync). The sync follows the shape sync's
@@ -684,6 +695,7 @@ let LinkedServer = class LinkedServer extends Shape {
684
695
  // });
685
696
  // before controllers
686
697
  await this.initBackendProviders();
698
+ this.warnOfSyncPins();
687
699
  await this.syncOntologiesOnBoot();
688
700
  await this.materializeShapesIntoStore();
689
701
  //START OF EXPRESS ROUTES AND MIDDLEWARE
@@ -808,11 +820,11 @@ let LinkedServer = class LinkedServer extends Shape {
808
820
  */
809
821
  async initStores() {
810
822
  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.
823
+ // LINKED_ONTOLOGY_GRAPH / LINKED_SHAPE_GRAPH: checked (an invalid value stops the boot) and set
824
+ // once as core's global graph targets, before any store is initialised and before the syncs.
813
825
  // A rejected boot does not end the process by itself, so the error is fatal.
814
826
  try {
815
- applyGraphTargetsFromEnv(process.env, LinkedStorage.getDatasets());
827
+ applyGraphTargetsFromEnv(process.env);
816
828
  }
817
829
  catch (err) {
818
830
  throw new FatalStartupError(`[LinkedServer] ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`, { cause: err });