@_linked/core 0.0.1 → 1.0.0-next.20260211072341

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE +1 -1
  3. package/README.md +1 -53
  4. package/package.json +17 -1
  5. package/.context/notes.md +0 -0
  6. package/.context/todos.md +0 -0
  7. package/AGENTS.md +0 -59
  8. package/docs/001-core-extraction.md +0 -305
  9. package/jest.config.js +0 -25
  10. package/scripts/dual-package.js +0 -25
  11. package/src/collections/CoreMap.ts +0 -127
  12. package/src/collections/CoreSet.ts +0 -171
  13. package/src/collections/ShapeSet.ts +0 -18
  14. package/src/index.ts +0 -88
  15. package/src/interfaces/ICoreIterable.ts +0 -35
  16. package/src/interfaces/IFileStore.ts +0 -28
  17. package/src/interfaces/IQuadStore.ts +0 -16
  18. package/src/interfaces/IQueryParser.ts +0 -51
  19. package/src/ontologies/lincd.ts +0 -25
  20. package/src/ontologies/npm.ts +0 -15
  21. package/src/ontologies/owl.ts +0 -26
  22. package/src/ontologies/rdf.ts +0 -32
  23. package/src/ontologies/rdfs.ts +0 -38
  24. package/src/ontologies/shacl.ts +0 -136
  25. package/src/ontologies/xsd.ts +0 -47
  26. package/src/package.ts +0 -11
  27. package/src/queries/CreateQuery.ts +0 -41
  28. package/src/queries/DeleteQuery.ts +0 -54
  29. package/src/queries/MutationQuery.ts +0 -287
  30. package/src/queries/QueryContext.ts +0 -41
  31. package/src/queries/QueryFactory.ts +0 -275
  32. package/src/queries/QueryParser.ts +0 -79
  33. package/src/queries/SelectQuery.ts +0 -2101
  34. package/src/queries/UpdateQuery.ts +0 -47
  35. package/src/shapes/List.ts +0 -52
  36. package/src/shapes/SHACL.ts +0 -653
  37. package/src/shapes/Shape.ts +0 -282
  38. package/src/test-helpers/query-fixtures.ts +0 -313
  39. package/src/tests/core-utils.test.ts +0 -286
  40. package/src/tests/metadata.test.ts +0 -65
  41. package/src/tests/query.test.ts +0 -599
  42. package/src/tests/query.types.test.ts +0 -606
  43. package/src/tests/store-routing.test.ts +0 -133
  44. package/src/utils/LinkedErrorLogging.ts +0 -25
  45. package/src/utils/LinkedFileStorage.ts +0 -75
  46. package/src/utils/LinkedStorage.ts +0 -120
  47. package/src/utils/NameSpace.ts +0 -5
  48. package/src/utils/NodeReference.ts +0 -16
  49. package/src/utils/Package.ts +0 -681
  50. package/src/utils/Prefix.ts +0 -108
  51. package/src/utils/ShapeClass.ts +0 -335
  52. package/src/utils/Types.ts +0 -19
  53. package/src/utils/URI.ts +0 -40
  54. package/src/utils/cached.ts +0 -53
  55. package/tsconfig-cjs.json +0 -8
  56. package/tsconfig-esm.json +0 -9
  57. 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
- }
@@ -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
- }