@_linked/core 0.0.1 → 1.0.0-next.20260216062729
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 +71 -0
- package/LICENSE +1 -1
- package/README.md +147 -92
- package/lib/cjs/queries/SelectQuery.d.ts +5 -0
- package/lib/cjs/queries/SelectQuery.js +14 -0
- package/lib/cjs/queries/SelectQuery.js.map +1 -1
- package/lib/cjs/shapes/SHACL.d.ts +1 -0
- package/lib/cjs/shapes/SHACL.js +82 -2
- package/lib/cjs/shapes/SHACL.js.map +1 -1
- package/lib/cjs/shapes/Shape.d.ts +13 -1
- package/lib/cjs/shapes/Shape.js +6 -0
- package/lib/cjs/shapes/Shape.js.map +1 -1
- package/lib/cjs/test-helpers/query-fixtures.d.ts +583 -0
- package/lib/cjs/test-helpers/query-fixtures.js +39 -1
- package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
- package/lib/esm/queries/SelectQuery.d.ts +5 -0
- package/lib/esm/queries/SelectQuery.js +14 -0
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/shapes/SHACL.d.ts +1 -0
- package/lib/esm/shapes/SHACL.js +82 -2
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/Shape.d.ts +13 -1
- package/lib/esm/shapes/Shape.js +6 -0
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/test-helpers/query-fixtures.d.ts +583 -0
- package/lib/esm/test-helpers/query-fixtures.js +38 -0
- package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
- package/package.json +17 -1
- package/.context/notes.md +0 -0
- package/.context/todos.md +0 -0
- package/AGENTS.md +0 -59
- package/docs/001-core-extraction.md +0 -305
- package/jest.config.js +0 -25
- package/scripts/dual-package.js +0 -25
- package/src/collections/CoreMap.ts +0 -127
- package/src/collections/CoreSet.ts +0 -171
- package/src/collections/ShapeSet.ts +0 -18
- package/src/index.ts +0 -88
- package/src/interfaces/ICoreIterable.ts +0 -35
- package/src/interfaces/IFileStore.ts +0 -28
- package/src/interfaces/IQuadStore.ts +0 -16
- package/src/interfaces/IQueryParser.ts +0 -51
- package/src/ontologies/lincd.ts +0 -25
- package/src/ontologies/npm.ts +0 -15
- package/src/ontologies/owl.ts +0 -26
- package/src/ontologies/rdf.ts +0 -32
- package/src/ontologies/rdfs.ts +0 -38
- package/src/ontologies/shacl.ts +0 -136
- package/src/ontologies/xsd.ts +0 -47
- package/src/package.ts +0 -11
- package/src/queries/CreateQuery.ts +0 -41
- package/src/queries/DeleteQuery.ts +0 -54
- package/src/queries/MutationQuery.ts +0 -287
- package/src/queries/QueryContext.ts +0 -41
- package/src/queries/QueryFactory.ts +0 -275
- package/src/queries/QueryParser.ts +0 -79
- package/src/queries/SelectQuery.ts +0 -2101
- package/src/queries/UpdateQuery.ts +0 -47
- package/src/shapes/List.ts +0 -52
- package/src/shapes/SHACL.ts +0 -653
- package/src/shapes/Shape.ts +0 -282
- package/src/test-helpers/query-fixtures.ts +0 -313
- package/src/tests/core-utils.test.ts +0 -286
- package/src/tests/metadata.test.ts +0 -65
- package/src/tests/query.test.ts +0 -599
- package/src/tests/query.types.test.ts +0 -606
- package/src/tests/store-routing.test.ts +0 -133
- package/src/utils/LinkedErrorLogging.ts +0 -25
- package/src/utils/LinkedFileStorage.ts +0 -75
- package/src/utils/LinkedStorage.ts +0 -120
- package/src/utils/NameSpace.ts +0 -5
- package/src/utils/NodeReference.ts +0 -16
- package/src/utils/Package.ts +0 -681
- package/src/utils/Prefix.ts +0 -108
- package/src/utils/ShapeClass.ts +0 -335
- package/src/utils/Types.ts +0 -19
- package/src/utils/URI.ts +0 -40
- package/src/utils/cached.ts +0 -53
- package/tsconfig-cjs.json +0 -8
- package/tsconfig-esm.json +0 -9
- package/tsconfig.json +0 -29
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {Shape} from '../shapes/Shape.js';
|
|
2
|
-
import {
|
|
3
|
-
AddId,
|
|
4
|
-
NodeDescriptionValue,
|
|
5
|
-
NodeReferenceValue,
|
|
6
|
-
UpdatePartial,
|
|
7
|
-
toNodeReference,
|
|
8
|
-
} from './QueryFactory.js';
|
|
9
|
-
import {NodeShape} from '../shapes/SHACL.js';
|
|
10
|
-
import {MutationQueryFactory} from './MutationQuery.js';
|
|
11
|
-
|
|
12
|
-
export type UpdateQuery<ResponseType = null> = {
|
|
13
|
-
type: 'update';
|
|
14
|
-
id: string;
|
|
15
|
-
shape: NodeShape;
|
|
16
|
-
updates: NodeDescriptionValue;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export class UpdateQueryFactory<
|
|
20
|
-
ShapeType extends Shape,
|
|
21
|
-
U extends UpdatePartial<ShapeType>,
|
|
22
|
-
> extends MutationQueryFactory {
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly fields: NodeDescriptionValue;
|
|
25
|
-
|
|
26
|
-
constructor(
|
|
27
|
-
public shapeClass: typeof Shape,
|
|
28
|
-
id: string | NodeReferenceValue,
|
|
29
|
-
updateObjectOrFn: U,
|
|
30
|
-
) {
|
|
31
|
-
super();
|
|
32
|
-
this.id = toNodeReference(id).id;
|
|
33
|
-
this.fields = this.convertUpdateObject(
|
|
34
|
-
updateObjectOrFn,
|
|
35
|
-
this.shapeClass.shape,
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getQueryObject(): UpdateQuery<AddId<U>> {
|
|
40
|
-
return {
|
|
41
|
-
type: 'update',
|
|
42
|
-
id: this.id,
|
|
43
|
-
shape: this.shapeClass.shape,
|
|
44
|
-
updates: this.fields,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/shapes/List.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
-
*/
|
|
6
|
-
import {linkedShape} from '../package.js';
|
|
7
|
-
import {Shape} from './Shape.js';
|
|
8
|
-
import {linkedProperty, objectProperty} from './SHACL.js';
|
|
9
|
-
import {rdf} from '../ontologies/rdf.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A lightweight list shape for query metadata.
|
|
13
|
-
* This is no longer backed by RDF list quads in core.
|
|
14
|
-
*/
|
|
15
|
-
@linkedShape
|
|
16
|
-
export class List<T = unknown> extends Shape {
|
|
17
|
-
static targetClass = rdf.List;
|
|
18
|
-
|
|
19
|
-
@linkedProperty({path: rdf.first, maxCount: 1})
|
|
20
|
-
get first(): T {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@objectProperty({path: rdf.rest, maxCount: 1, shape: List})
|
|
25
|
-
get rest(): List<T> {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private items: T[] = [];
|
|
30
|
-
|
|
31
|
-
static fromItems<T>(items: T[]): List<T> {
|
|
32
|
-
const list = new List<T>();
|
|
33
|
-
list.items = [...items];
|
|
34
|
-
return list;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getContents(): T[] {
|
|
38
|
-
return [...this.items];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
isEmpty(): boolean {
|
|
42
|
-
return this.items.length === 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
addItem(item: T) {
|
|
46
|
-
this.items.push(item);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
addItems(items: T[]) {
|
|
50
|
-
this.items.push(...items);
|
|
51
|
-
}
|
|
52
|
-
}
|