@_linked/server 2.12.4 → 2.13.1
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 +58 -0
- package/lib/esm/backend.d.ts +5 -1
- package/lib/esm/backend.js +33 -1
- package/lib/esm/backend.js.map +1 -1
- package/lib/esm/ontologies/lincd-server.d.ts +0 -11
- package/lib/esm/ontologies/lincd-server.js +18 -11
- package/lib/esm/ontologies/lincd-server.js.map +1 -1
- package/lib/esm/shapes/quadstores/BackendAPIStore.d.ts +21 -5
- package/lib/esm/shapes/quadstores/BackendAPIStore.js +26 -32
- package/lib/esm/shapes/quadstores/BackendAPIStore.js.map +1 -1
- package/package.json +1 -1
- package/lib/esm/shapes/quadstores/BackendAPIStoreProvider.d.ts +0 -19
- package/lib/esm/shapes/quadstores/BackendAPIStoreProvider.js +0 -35
- package/lib/esm/shapes/quadstores/BackendAPIStoreProvider.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @\_linked/server
|
|
2
2
|
|
|
3
|
+
## 2.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#87](https://github.com/linked-fw/server/pull/87) [`063464c`](https://github.com/linked-fw/server/commit/063464ccfe9df2ae3498479483b33f12e926c91f) Thanks [@flyon](https://github.com/flyon)! - Ontology terms are no longer individual module exports.
|
|
8
|
+
|
|
9
|
+
`lincd-server.ts` exported all 11 of its terms as module-scope bindings, and
|
|
10
|
+
several of those names are also shape class names in this package —
|
|
11
|
+
`LincdWebApp`, `LincdAPI`, `BackendAPIStore` and others. Two bindings of the
|
|
12
|
+
same name in one bundle scope make the bundler rename one of them:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
Ju = ns("BackendAPIStore"); // the term keeps the binding
|
|
16
|
+
n(nt, "BackendAPIStore2"); // the class is renamed
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
When the loser is a shape class, `constructor.name` is its IRI and the name
|
|
20
|
+
`Server.call` routes on, so a production client asks the backend for a shape it
|
|
21
|
+
has never heard of and the call answers 501.
|
|
22
|
+
|
|
23
|
+
Terms are now reached only through the `lincdServer` namespace object:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { lincdServer } from "@_linked/server/ontologies/lincd-server";
|
|
27
|
+
lincdServer.LincdWebApp; // instead of a bare `LincdWebApp` import
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Nothing imported a term individually, so no call site changes.
|
|
31
|
+
|
|
32
|
+
## 2.13.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- [#84](https://github.com/linked-fw/server/pull/84) [`7c743e3`](https://github.com/linked-fw/server/commit/7c743e30665889b99e866cc5aff87e45c8c16b1a) Thanks [@flyon](https://github.com/flyon)! - `BackendAPIStore` is no longer a Shape; it addresses the backend by package name.
|
|
37
|
+
|
|
38
|
+
It used to call `Server.call(this, …)`, whose transport derives the target from
|
|
39
|
+
`shape instanceof Shape && shape.id` (which instance) and `shapeClass.shape.id` (which class).
|
|
40
|
+
That was the only reason this class was a Shape — and the reason the server had to rebuild it
|
|
41
|
+
with `new (providerShapeClass)({id})` on every request, instantiating a Shape purely to discard
|
|
42
|
+
it.
|
|
43
|
+
|
|
44
|
+
None of that carried meaning. The provider took the store as its first argument and never read
|
|
45
|
+
it, and query routing is decided by the QUERY's shape via `LinkedStorage`, not by the store. So
|
|
46
|
+
the instance identity was pure addressing.
|
|
47
|
+
|
|
48
|
+
It now uses `Server.call`'s existing package-name overload, which sends `{args}` to
|
|
49
|
+
`/call/<packageName>/<method>` with no shape fields, and is answered by this package's generic
|
|
50
|
+
backend provider without any shape resolution. The five query methods moved from
|
|
51
|
+
`BackendAPIStoreProvider` onto `LincdServerBackendProvider`, losing the unused first argument;
|
|
52
|
+
`BackendAPIStoreProvider` is removed.
|
|
53
|
+
|
|
54
|
+
**Breaking** for anyone importing `BackendAPIStoreProvider`, or relying on `BackendAPIStore`
|
|
55
|
+
being a Shape (`instanceof Shape`, `.shape`, `targetClass`). The constructor signature is
|
|
56
|
+
unchanged and `IDataset` is implemented in full, so ordinary use through
|
|
57
|
+
`linked.{frontend,backend}.datasets.json` is unaffected.
|
|
58
|
+
|
|
59
|
+
This removes the last of the four classes blocking core's deferred Shape-instantiation guard.
|
|
60
|
+
|
|
3
61
|
## 2.12.4
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
package/lib/esm/backend.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';
|
|
2
|
-
export * from './shapes/quadstores/BackendAPIStoreProvider.js';
|
|
3
2
|
export default class LincdServerBackendProvider extends BackendProvider {
|
|
4
3
|
setupBeforeControllers(): Promise<void>;
|
|
5
4
|
getShapes(): Record<string, import("@_linked/server-utils/types/ShapeDetails.js").ShapeDetails>;
|
|
5
|
+
selectQuery(json: any): Promise<unknown>;
|
|
6
|
+
askQuery(json: any): Promise<boolean>;
|
|
7
|
+
updateQuery(json: any): Promise<unknown>;
|
|
8
|
+
createQuery(json: any): Promise<unknown>;
|
|
9
|
+
deleteQuery(json: any): Promise<import("@_linked/core/queries/DeleteQuery").DeleteResponse>;
|
|
6
10
|
}
|
package/lib/esm/backend.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BackendProvider } from '@_linked/server-utils/utils/BackendProvider';
|
|
2
2
|
import { LinkedFileStorage } from '@_linked/core/utils/LinkedFileStorage';
|
|
3
|
+
import { LinkedStorage } from '@_linked/core/utils/LinkedStorage';
|
|
4
|
+
import { fromJSON } from '@_linked/core';
|
|
3
5
|
import { LocalFileStore } from './shapes/filestores/LocalFileStore.js';
|
|
4
6
|
import { getShapeIndex } from './utils/Shapes.js';
|
|
5
7
|
import path from 'path';
|
|
6
8
|
import fs from 'fs/promises';
|
|
7
|
-
export * from './shapes/quadstores/BackendAPIStoreProvider.js';
|
|
8
9
|
export default class LincdServerBackendProvider extends BackendProvider {
|
|
9
10
|
async setupBeforeControllers() {
|
|
10
11
|
if (!LinkedFileStorage.getDefaultStore()) {
|
|
@@ -23,5 +24,36 @@ export default class LincdServerBackendProvider extends BackendProvider {
|
|
|
23
24
|
getShapes() {
|
|
24
25
|
return getShapeIndex();
|
|
25
26
|
}
|
|
27
|
+
// ── BackendAPIStore query execution ──────────────────────────────────────
|
|
28
|
+
//
|
|
29
|
+
// These answer the frontend `BackendAPIStore`, which calls
|
|
30
|
+
// `Server.call(packageName, {method}, json)` — the PACKAGE form, so the request
|
|
31
|
+
// arrives here on the generic provider rather than through Shape resolution.
|
|
32
|
+
//
|
|
33
|
+
// They used to live on `BackendAPIStoreProvider`, a `ShapeProvider`, whose methods
|
|
34
|
+
// took the store as a first argument and never read it. Reaching that provider meant
|
|
35
|
+
// the transport had to carry a `shapeURI` and an `instanceNode`, and the server had to
|
|
36
|
+
// rebuild the store with `new (providerShapeClass)({id})` — instantiating a Shape only
|
|
37
|
+
// to discard it. Addressing by package removes all of that.
|
|
38
|
+
//
|
|
39
|
+
// A query cannot cross the wire live (core 2.10.0 contract flip), so the client ships
|
|
40
|
+
// `toJSON()` and `fromJSON()` rehydrates it here into a live, closed query.
|
|
41
|
+
// `LinkedStorage` then routes it by the QUERY's shape — which is, and always was, what
|
|
42
|
+
// decides the target dataset. The store instance never participated.
|
|
43
|
+
selectQuery(json) {
|
|
44
|
+
return LinkedStorage.selectQuery(fromJSON(json));
|
|
45
|
+
}
|
|
46
|
+
askQuery(json) {
|
|
47
|
+
return LinkedStorage.askQuery(fromJSON(json));
|
|
48
|
+
}
|
|
49
|
+
updateQuery(json) {
|
|
50
|
+
return LinkedStorage.updateQuery(fromJSON(json));
|
|
51
|
+
}
|
|
52
|
+
createQuery(json) {
|
|
53
|
+
return LinkedStorage.createQuery(fromJSON(json));
|
|
54
|
+
}
|
|
55
|
+
deleteQuery(json) {
|
|
56
|
+
return LinkedStorage.deleteQuery(fromJSON(json));
|
|
57
|
+
}
|
|
26
58
|
}
|
|
27
59
|
//# sourceMappingURL=backend.js.map
|
package/lib/esm/backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,eAAe;IACrE,KAAK,CAAC,sBAAsB;QAC1B,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,EAAE,CAAC;YACzC,iBAAiB,CAAC,eAAe,CAC/B,IAAI,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC,CACxD,CAAC;QACJ,CAAC;QACD,IAAI,oBAAoB,GAA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
|
|
23
23
|
export declare var ns: (term: string) => import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
24
24
|
export declare var _self: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
25
|
-
export declare var LincdServer: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
26
|
-
export declare var BackendFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
27
|
-
export declare var NodeFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
28
|
-
export declare var BackendStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
29
|
-
export declare var BackendAPIStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
30
|
-
export declare var LincdWebApp: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
31
|
-
export declare var ownPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
32
|
-
export declare var maintainsPackage: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
33
|
-
export declare var N3FileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
34
|
-
export declare var LincdAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
35
|
-
export declare var hasAPI: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
36
25
|
export declare const lincdServer: {
|
|
37
26
|
LincdServer: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
38
27
|
BackendFileStore: import("@_linked/core/utils/NodeReference").NodeReferenceValue;
|
|
@@ -14,17 +14,24 @@ export var loadData = async () => {
|
|
|
14
14
|
};
|
|
15
15
|
export var ns = createNameSpace('http://lincd.org/ont/lincd-server/');
|
|
16
16
|
export var _self = ns('');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
// Terms are properties of the namespace object below, not module-scope
|
|
18
|
+
// exports. Most of these names are also SHAPE CLASS names in this package
|
|
19
|
+
// (BackendAPIStore, LincdWebApp, LincdAPI, ...). Two bindings of the same name
|
|
20
|
+
// in one bundle scope make the bundler rename one of them, and when the loser
|
|
21
|
+
// is the class, `constructor.name` becomes `BackendAPIStore2` -- which is the
|
|
22
|
+
// shape's IRI and the name `Server.call` routes on. The client then asks a
|
|
23
|
+
// backend that has no such shape, and every store round-trip answers 501.
|
|
24
|
+
const LincdServer = ns('LincdServer');
|
|
25
|
+
const BackendFileStore = ns('BackendFileStore');
|
|
26
|
+
const NodeFileStore = ns('NodeFileStore');
|
|
27
|
+
const BackendStore = ns('BackendStore');
|
|
28
|
+
const BackendAPIStore = ns('BackendAPIStore');
|
|
29
|
+
const LincdWebApp = ns('LincdWebApp');
|
|
30
|
+
const ownPackage = ns('ownPackage');
|
|
31
|
+
const maintainsPackage = ns('maintainsPackage');
|
|
32
|
+
const N3FileStore = ns('N3FileStore');
|
|
33
|
+
const LincdAPI = ns('LincdAPI');
|
|
34
|
+
const hasAPI = ns('hasAPI');
|
|
28
35
|
export const lincdServer = {
|
|
29
36
|
LincdServer,
|
|
30
37
|
BackendFileStore,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-server.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,IAAI,QAAQ,GAAG,KAAK,IAAI,EAAE;IAC/B,YAAY;IACZ,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,2BAA2B,EAAE;QACrD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACvB,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;AAC9B,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,CAAC;AACtC,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;AACpC,MAAM,gBAAgB,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAChD,MAAM,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;AACtC,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAE5B,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,WAAW;IACX,eAAe;IACf,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,QAAQ;IACR,MAAM;CACP,CAAC;AAEF,cAAc,CACZ,KAAK,EACL,EAAE,EACF,cAAc,EACd,QAAQ,EACR,2BAA2B,CAC5B,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
2
1
|
import type { IDataset } from '@_linked/core/interfaces/IDataset';
|
|
3
2
|
import type { SelectQuery } from '@_linked/core/queries/SelectQuery';
|
|
4
3
|
import type { AskQuery } from '@_linked/core/queries/AskQuery';
|
|
@@ -18,11 +17,28 @@ export interface BackendAPIStoreConfig {
|
|
|
18
17
|
id?: string;
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
21
|
-
* Frontend-side store that routes all queries to the backend via Server.call()
|
|
22
|
-
* The backend's
|
|
20
|
+
* Frontend-side store that routes all queries to the backend via `Server.call()`.
|
|
21
|
+
* The backend's generic provider for this package executes them against the real store.
|
|
22
|
+
*
|
|
23
|
+
* A store is not a Shape. This class used to `extends Shape` and carry `@linkedShape`
|
|
24
|
+
* with a `targetClass`, purely so that `Server.call(this, …)` could address it: the
|
|
25
|
+
* transport derived the target from `shape instanceof Shape && shape.id` (the instance)
|
|
26
|
+
* and `shapeClass.shape.id` (the class). Neither carried any meaning — the backend
|
|
27
|
+
* provider never read the store it was handed, and query routing is decided by the
|
|
28
|
+
* QUERY's shape, not the store's.
|
|
29
|
+
*
|
|
30
|
+
* It now uses `Server.call`'s package form instead, which addresses the backend by
|
|
31
|
+
* package name and sends no shape fields at all. That removes the last reason for this
|
|
32
|
+
* class to be a Shape, and with it the `new (providerShapeClass)({id})` the backend had
|
|
33
|
+
* to perform to rebuild a store instance nobody used.
|
|
23
34
|
*/
|
|
24
|
-
export declare class BackendAPIStore
|
|
25
|
-
|
|
35
|
+
export declare class BackendAPIStore implements IDataset {
|
|
36
|
+
/**
|
|
37
|
+
* Kept so the config form is still accepted and a store can be named, but it is no
|
|
38
|
+
* longer an addressing mechanism — nothing transmits or resolves it. Retained because
|
|
39
|
+
* `linked.{frontend,backend}.datasets.json` may still pass `name`/`id`.
|
|
40
|
+
*/
|
|
41
|
+
readonly id?: string;
|
|
26
42
|
constructor(config?: BackendAPIStoreConfig | string | {
|
|
27
43
|
id?: string;
|
|
28
44
|
});
|
|
@@ -1,41 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { lincdServer } from '../../ontologies/lincd-server.js';
|
|
11
|
-
import { linkedShape } from '../../package.js';
|
|
12
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
1
|
+
import { packageName } from '../../package.js';
|
|
13
2
|
import { Server } from '@_linked/server-utils/utils/Server';
|
|
14
3
|
/**
|
|
15
|
-
* Frontend-side store that routes all queries to the backend via Server.call()
|
|
16
|
-
* The backend's
|
|
4
|
+
* Frontend-side store that routes all queries to the backend via `Server.call()`.
|
|
5
|
+
* The backend's generic provider for this package executes them against the real store.
|
|
6
|
+
*
|
|
7
|
+
* A store is not a Shape. This class used to `extends Shape` and carry `@linkedShape`
|
|
8
|
+
* with a `targetClass`, purely so that `Server.call(this, …)` could address it: the
|
|
9
|
+
* transport derived the target from `shape instanceof Shape && shape.id` (the instance)
|
|
10
|
+
* and `shapeClass.shape.id` (the class). Neither carried any meaning — the backend
|
|
11
|
+
* provider never read the store it was handed, and query routing is decided by the
|
|
12
|
+
* QUERY's shape, not the store's.
|
|
13
|
+
*
|
|
14
|
+
* It now uses `Server.call`'s package form instead, which addresses the backend by
|
|
15
|
+
* package name and sends no shape fields at all. That removes the last reason for this
|
|
16
|
+
* class to be a Shape, and with it the `new (providerShapeClass)({id})` the backend had
|
|
17
|
+
* to perform to rebuild a store instance nobody used.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
export class BackendAPIStore {
|
|
19
20
|
constructor(config) {
|
|
20
|
-
if (!config)
|
|
21
|
-
super();
|
|
21
|
+
if (!config)
|
|
22
22
|
return;
|
|
23
|
-
}
|
|
24
23
|
if (typeof config === 'string') {
|
|
25
|
-
|
|
26
|
-
super({ id: `${process.env.DATA_ROOT}/backend-api-store/${config}` });
|
|
24
|
+
this.id = `${process.env.DATA_ROOT}/backend-api-store/${config}`;
|
|
27
25
|
return;
|
|
28
26
|
}
|
|
29
27
|
if (config.id) {
|
|
30
|
-
|
|
28
|
+
this.id = config.id;
|
|
31
29
|
return;
|
|
32
30
|
}
|
|
33
31
|
if (config.name) {
|
|
34
32
|
const name = config.name;
|
|
35
|
-
|
|
36
|
-
return;
|
|
33
|
+
this.id = `${process.env.DATA_ROOT}/backend-api-store/${name}`;
|
|
37
34
|
}
|
|
38
|
-
super();
|
|
39
35
|
}
|
|
40
36
|
async init() {
|
|
41
37
|
// No initialization needed — queries are routed to the backend
|
|
@@ -65,13 +61,11 @@ let BackendAPIStore = class BackendAPIStore extends Shape {
|
|
|
65
61
|
* Whatever a successful call returns, `undefined` included, resolves as is.
|
|
66
62
|
*/
|
|
67
63
|
callBackend(method, json) {
|
|
68
|
-
|
|
64
|
+
// The PACKAGE form, not the shape form. It posts to
|
|
65
|
+
// `/call/<packageName>/<method>` with a body of `{args}` only — no `shapeURI`,
|
|
66
|
+
// no `instanceNode` — and the backend answers from this package's generic
|
|
67
|
+
// provider without resolving or instantiating any Shape.
|
|
68
|
+
return Server.call(packageName, { method, rejectOnError: true }, json);
|
|
69
69
|
}
|
|
70
|
-
}
|
|
71
|
-
BackendAPIStore.targetClass = lincdServer.BackendAPIStore;
|
|
72
|
-
BackendAPIStore = __decorate([
|
|
73
|
-
linkedShape,
|
|
74
|
-
__metadata("design:paramtypes", [Object])
|
|
75
|
-
], BackendAPIStore);
|
|
76
|
-
export { BackendAPIStore };
|
|
70
|
+
}
|
|
77
71
|
//# sourceMappingURL=BackendAPIStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendAPIStore.js","sourceRoot":"","sources":["../../../../src/shapes/quadstores/BackendAPIStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BackendAPIStore.js","sourceRoot":"","sources":["../../../../src/shapes/quadstores/BackendAPIStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AA4B5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,eAAe;IAQ1B,YAAY,MAAyD;QACnE,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAA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C,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BackendAPIStore } from './BackendAPIStore.js';
|
|
2
|
-
import { ShapeProvider } from '@_linked/server-utils/utils/ShapeProvider';
|
|
3
|
-
/**
|
|
4
|
-
* Server-side provider that handles BackendAPIStore query requests.
|
|
5
|
-
*
|
|
6
|
-
* The client (BackendAPIStore) ships each query as DSL-JSON over Server.call
|
|
7
|
-
* (core 2.10.0 contract flip — the live query can't cross the wire). Here we
|
|
8
|
-
* rehydrate it with `fromJSON()` back into a live (closed) query, then route it
|
|
9
|
-
* through LinkedStorage, which delegates to the actual backend store (e.g.
|
|
10
|
-
* FusekiStore) — the store lowers the live query to IR/SPARQL itself.
|
|
11
|
-
*/
|
|
12
|
-
export declare class BackendAPIStoreProvider extends ShapeProvider {
|
|
13
|
-
shape: typeof BackendAPIStore;
|
|
14
|
-
selectQuery(store: BackendAPIStore, json: any): Promise<unknown>;
|
|
15
|
-
askQuery(store: BackendAPIStore, json: any): Promise<boolean>;
|
|
16
|
-
updateQuery(store: BackendAPIStore, json: any): Promise<unknown>;
|
|
17
|
-
createQuery(store: BackendAPIStore, json: any): Promise<unknown>;
|
|
18
|
-
deleteQuery(store: BackendAPIStore, json: any): Promise<import("@_linked/core/queries/DeleteQuery").DeleteResponse>;
|
|
19
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BackendAPIStore } from './BackendAPIStore.js';
|
|
2
|
-
import { ShapeProvider } from '@_linked/server-utils/utils/ShapeProvider';
|
|
3
|
-
import { LinkedStorage } from '@_linked/core/utils/LinkedStorage';
|
|
4
|
-
import { fromJSON } from '@_linked/core';
|
|
5
|
-
/**
|
|
6
|
-
* Server-side provider that handles BackendAPIStore query requests.
|
|
7
|
-
*
|
|
8
|
-
* The client (BackendAPIStore) ships each query as DSL-JSON over Server.call
|
|
9
|
-
* (core 2.10.0 contract flip — the live query can't cross the wire). Here we
|
|
10
|
-
* rehydrate it with `fromJSON()` back into a live (closed) query, then route it
|
|
11
|
-
* through LinkedStorage, which delegates to the actual backend store (e.g.
|
|
12
|
-
* FusekiStore) — the store lowers the live query to IR/SPARQL itself.
|
|
13
|
-
*/
|
|
14
|
-
export class BackendAPIStoreProvider extends ShapeProvider {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.shape = BackendAPIStore;
|
|
18
|
-
}
|
|
19
|
-
selectQuery(store, json) {
|
|
20
|
-
return LinkedStorage.selectQuery(fromJSON(json));
|
|
21
|
-
}
|
|
22
|
-
askQuery(store, json) {
|
|
23
|
-
return LinkedStorage.askQuery(fromJSON(json));
|
|
24
|
-
}
|
|
25
|
-
updateQuery(store, json) {
|
|
26
|
-
return LinkedStorage.updateQuery(fromJSON(json));
|
|
27
|
-
}
|
|
28
|
-
createQuery(store, json) {
|
|
29
|
-
return LinkedStorage.createQuery(fromJSON(json));
|
|
30
|
-
}
|
|
31
|
-
deleteQuery(store, json) {
|
|
32
|
-
return LinkedStorage.deleteQuery(fromJSON(json));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=BackendAPIStoreProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BackendAPIStoreProvider.js","sourceRoot":"","sources":["../../../../src/shapes/quadstores/BackendAPIStoreProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,aAAa;IAA1D;;QACS,UAAK,GAAG,eAAe,CAAC;IAqBjC,CAAC;IAnBC,WAAW,CAAC,KAAsB,EAAE,IAAS;QAC3C,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,QAAQ,CAAC,KAAsB,EAAE,IAAS;QACxC,OAAO,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IACvD,CAAC;IAED,WAAW,CAAC,KAAsB,EAAE,IAAS;QAC3C,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,WAAW,CAAC,KAAsB,EAAE,IAAS;QAC3C,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,WAAW,CAAC,KAAsB,EAAE,IAAS;QAC3C,OAAO,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAAC,CAAC;IAC1D,CAAC;CACF"}
|