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