@coasys/ad4m 0.12.0-rc1-dev.4 → 0.12.0-rc2
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/lib/index.cjs +5052 -4446
- package/lib/index.js +5019 -4442
- package/lib/src/agent/AgentClient.d.ts +4 -0
- package/lib/src/agent/AgentClient.js +34 -0
- package/lib/src/index.d.ts +2 -3
- package/lib/src/index.js +2 -3
- package/lib/src/model/Ad4mModel.d.ts +8 -782
- package/lib/src/model/Ad4mModel.js +160 -2354
- package/lib/src/model/ModelQueryBuilder.d.ts +370 -0
- package/lib/src/model/ModelQueryBuilder.js +556 -0
- package/lib/src/model/decorators.d.ts +71 -23
- package/lib/src/model/decorators.js +133 -384
- package/lib/src/model/hydration.d.ts +102 -0
- package/lib/src/model/hydration.js +709 -0
- package/lib/src/model/index.d.ts +20 -0
- package/lib/src/model/index.js +20 -0
- package/lib/src/model/{schema/fromJSONSchema.d.ts → json-schema.d.ts} +45 -12
- package/lib/src/model/json-schema.js +326 -0
- package/lib/src/model/prolog-facts.d.ts +37 -0
- package/lib/src/model/{prolog/generatePrologFacts.js → prolog-facts.js} +47 -52
- package/lib/src/model/query-common.d.ts +14 -0
- package/lib/src/model/query-common.js +36 -0
- package/lib/src/model/query-prolog.d.ts +15 -0
- package/lib/src/model/query-prolog.js +140 -0
- package/lib/src/model/query-surreal.d.ts +44 -0
- package/lib/src/model/query-surreal.js +249 -0
- package/lib/src/model/relation-filtering.test.js +838 -0
- package/lib/src/model/sdna.d.ts +14 -0
- package/lib/src/model/sdna.js +141 -0
- package/lib/src/model/shacl-gen.d.ts +31 -0
- package/lib/src/model/shacl-gen.js +246 -0
- package/lib/src/model/surreal-utils.d.ts +42 -0
- package/lib/src/model/surreal-utils.js +128 -0
- package/lib/src/model/types.d.ts +75 -96
- package/lib/src/model/types.js +4 -4
- package/lib/src/model/util.d.ts +4 -5
- package/lib/src/model/util.js +12 -32
- package/lib/src/perspectives/PerspectiveClient.d.ts +1 -1
- package/lib/src/perspectives/PerspectiveProxy.d.ts +1 -1
- package/lib/src/perspectives/WakerSubscriptionManager.d.ts +79 -0
- package/lib/src/perspectives/WakerSubscriptionManager.js +196 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +14 -0
- package/lib/src/runtime/RuntimeResolver.js +73 -0
- package/lib/src/schema.gql +14 -0
- package/lib/src/shacl/SHACLShape.d.ts +23 -0
- package/lib/src/shacl/SHACLShape.js +45 -0
- package/lib/src/typeDefs.js +14 -0
- package/package.json +13 -8
- package/src/agent/AgentClient.ts +45 -0
- package/src/index.ts +2 -3
- package/src/model/Ad4mModel.ts +1089 -3686
- package/src/model/ModelQueryBuilder.ts +617 -0
- package/src/model/Subject.ts +1 -1
- package/src/model/decorators.ts +218 -453
- package/src/model/hydration.ts +796 -0
- package/src/model/index.ts +21 -0
- package/src/model/json-schema.ts +424 -0
- package/src/model/prolog-facts.ts +145 -0
- package/src/model/query-common.ts +48 -0
- package/src/model/query-prolog.ts +148 -0
- package/src/model/query-surreal.ts +280 -0
- package/src/model/relation-filtering.test.ts +803 -0
- package/src/model/sdna.ts +170 -0
- package/src/model/shacl-gen.ts +292 -0
- package/src/model/surreal-utils.ts +147 -0
- package/src/model/types.ts +182 -0
- package/src/model/util.ts +13 -36
- package/src/perspectives/PerspectiveClient.ts +1 -1
- package/src/perspectives/PerspectiveProxy.ts +1 -1
- package/src/perspectives/WakerSubscriptionManager.ts +292 -0
- package/src/runtime/RuntimeResolver.ts +53 -0
- package/src/shacl/SHACLShape.ts +83 -0
- package/lib/src/Ad4mClient.test.js +0 -1204
- package/lib/src/Literal.test.d.ts +0 -1
- package/lib/src/Literal.test.js +0 -41
- package/lib/src/model/mutation.d.ts +0 -81
- package/lib/src/model/mutation.js +0 -317
- package/lib/src/model/parentUtils.d.ts +0 -32
- package/lib/src/model/parentUtils.js +0 -64
- package/lib/src/model/prolog/generatePrologFacts.d.ts +0 -36
- package/lib/src/model/prolog/index.d.ts +0 -1
- package/lib/src/model/prolog/index.js +0 -1
- package/lib/src/model/query/ModelQueryBuilder.d.ts +0 -82
- package/lib/src/model/query/ModelQueryBuilder.js +0 -115
- package/lib/src/model/query/QueryBuilder.d.ts +0 -101
- package/lib/src/model/query/QueryBuilder.js +0 -193
- package/lib/src/model/query/SurrealQueryBuilder.d.ts +0 -48
- package/lib/src/model/query/SurrealQueryBuilder.js +0 -371
- package/lib/src/model/query/fetchInstance.d.ts +0 -24
- package/lib/src/model/query/fetchInstance.js +0 -144
- package/lib/src/model/query/hydration.d.ts +0 -54
- package/lib/src/model/query/hydration.js +0 -214
- package/lib/src/model/query/operations.d.ts +0 -59
- package/lib/src/model/query/operations.js +0 -384
- package/lib/src/model/query/snapshot.d.ts +0 -59
- package/lib/src/model/query/snapshot.js +0 -106
- package/lib/src/model/query/surrealCompiler.d.ts +0 -42
- package/lib/src/model/query/surrealCompiler.js +0 -304
- package/lib/src/model/schema/fromJSONSchema.js +0 -264
- package/lib/src/model/schema/metadata.d.ts +0 -15
- package/lib/src/model/schema/metadata.js +0 -112
- package/lib/src/model/subscription.d.ts +0 -47
- package/lib/src/model/subscription.js +0 -231
- package/lib/src/model/transaction.d.ts +0 -27
- package/lib/src/model/transaction.js +0 -32
- package/lib/src/shims/reflect-metadata.d.ts +0 -0
- package/lib/src/shims/type-graphql.d.ts +0 -32
- package/lib/src/src/Ad4mClient.d.ts +0 -28
- package/lib/src/src/Address.d.ts +0 -1
- package/lib/src/src/DID.d.ts +0 -1
- package/lib/src/src/Exception.d.ts +0 -7
- package/lib/src/src/Literal.d.ts +0 -7
- package/lib/src/src/PubSub.d.ts +0 -17
- package/lib/src/src/SmartLiteral.d.ts +0 -12
- package/lib/src/src/agent/Agent.d.ts +0 -110
- package/lib/src/src/agent/AgentClient.d.ts +0 -62
- package/lib/src/src/agent/AgentResolver.d.ts +0 -30
- package/lib/src/src/agent/AgentStatus.d.ts +0 -8
- package/lib/src/src/ai/AIClient.d.ts +0 -32
- package/lib/src/src/ai/AIResolver.d.ts +0 -75
- package/lib/src/src/ai/Tasks.d.ts +0 -37
- package/lib/src/src/buildSchema.d.ts +0 -1
- package/lib/src/src/expression/Expression.d.ts +0 -28
- package/lib/src/src/expression/ExpressionClient.d.ts +0 -13
- package/lib/src/src/expression/ExpressionRef.d.ts +0 -9
- package/lib/src/src/expression/ExpressionResolver.d.ts +0 -10
- package/lib/src/src/index.d.ts +0 -35
- package/lib/src/src/jestSetup.d.ts +0 -1
- package/lib/src/src/language/Icon.d.ts +0 -4
- package/lib/src/src/language/Language.d.ts +0 -206
- package/lib/src/src/language/LanguageClient.d.ts +0 -17
- package/lib/src/src/language/LanguageContext.d.ts +0 -37
- package/lib/src/src/language/LanguageHandle.d.ts +0 -9
- package/lib/src/src/language/LanguageMeta.d.ts +0 -35
- package/lib/src/src/language/LanguageRef.d.ts +0 -6
- package/lib/src/src/language/LanguageResolver.d.ts +0 -19
- package/lib/src/src/links/Links.d.ts +0 -39
- package/lib/src/src/links/Links.test.d.ts +0 -1
- package/lib/src/src/model/Ad4mModel.d.ts +0 -1438
- package/lib/src/src/model/Ad4mModel.test.d.ts +0 -1
- package/lib/src/src/model/Subject.d.ts +0 -25
- package/lib/src/src/model/decorators.d.ts +0 -545
- package/lib/src/src/model/util.d.ts +0 -12
- package/lib/src/src/neighbourhood/Neighbourhood.d.ts +0 -10
- package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +0 -25
- package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +0 -19
- package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +0 -1
- package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +0 -24
- package/lib/src/src/perspectives/LinkQuery.d.ts +0 -11
- package/lib/src/src/perspectives/Perspective.d.ts +0 -38
- package/lib/src/src/perspectives/Perspective.test.d.ts +0 -1
- package/lib/src/src/perspectives/PerspectiveClient.d.ts +0 -97
- package/lib/src/src/perspectives/PerspectiveDiff.d.ts +0 -9
- package/lib/src/src/perspectives/PerspectiveHandle.d.ts +0 -18
- package/lib/src/src/perspectives/PerspectiveProxy.d.ts +0 -865
- package/lib/src/src/perspectives/PerspectiveResolver.d.ts +0 -57
- package/lib/src/src/runtime/RuntimeClient.d.ts +0 -56
- package/lib/src/src/runtime/RuntimeResolver.d.ts +0 -132
- package/lib/src/src/shacl/SHACLFlow.d.ts +0 -171
- package/lib/src/src/shacl/SHACLFlow.test.d.ts +0 -1
- package/lib/src/src/shacl/SHACLShape.d.ts +0 -117
- package/lib/src/src/shacl/SHACLShape.test.d.ts +0 -1
- package/lib/src/src/typeDefs.d.ts +0 -1
- package/lib/src/src/unwrapApolloResult.d.ts +0 -2
- package/lib/src/src/utils.d.ts +0 -25
- /package/lib/src/{Ad4mClient.test.d.ts → model/relation-filtering.test.d.ts} +0 -0
package/src/shacl/SHACLShape.ts
CHANGED
|
@@ -95,6 +95,19 @@ export interface AD4MAction {
|
|
|
95
95
|
local?: boolean;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* A single structured conformance condition for relation filtering.
|
|
100
|
+
* DB-agnostic representation that can be translated to any query language.
|
|
101
|
+
*/
|
|
102
|
+
export interface ConformanceCondition {
|
|
103
|
+
/** Type of check: 'flag' (predicate + value) or 'required' (predicate exists) */
|
|
104
|
+
type: 'flag' | 'required';
|
|
105
|
+
/** The predicate URI to check on the target node */
|
|
106
|
+
predicate: string;
|
|
107
|
+
/** For 'flag' conditions: the expected value */
|
|
108
|
+
value?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
98
111
|
/**
|
|
99
112
|
* SHACL Property Shape
|
|
100
113
|
* Represents constraints on a single property path
|
|
@@ -147,6 +160,20 @@ export interface SHACLPropertyShape {
|
|
|
147
160
|
|
|
148
161
|
/** AD4M-specific: Remover action for collection properties */
|
|
149
162
|
remover?: AD4MAction[];
|
|
163
|
+
|
|
164
|
+
/** AD4M-specific: Pre-computed SurrealQL getter expression for reading this relation/property.
|
|
165
|
+
* For relations with a target model, this encodes conformance filtering
|
|
166
|
+
* so that Rust/MCP can execute the exact same query as the JS runtime. */
|
|
167
|
+
getter?: string;
|
|
168
|
+
|
|
169
|
+
/** AD4M-specific: Structured conformance conditions (DB-agnostic).
|
|
170
|
+
* Each condition describes a check on the target node (flag match or required property). */
|
|
171
|
+
conformanceConditions?: ConformanceCondition[];
|
|
172
|
+
|
|
173
|
+
/** sh:class — the target SHACL node shape URI that linked nodes must conform to.
|
|
174
|
+
* Set automatically when a relation has a `target` model. Enables typed construction
|
|
175
|
+
* on the Rust/MCP side by referencing the full target shape. */
|
|
176
|
+
class?: string;
|
|
150
177
|
}
|
|
151
178
|
|
|
152
179
|
/**
|
|
@@ -494,6 +521,30 @@ export class SHACLShape {
|
|
|
494
521
|
target: `literal://string:${JSON.stringify(prop.remover)}`
|
|
495
522
|
});
|
|
496
523
|
}
|
|
524
|
+
|
|
525
|
+
if (prop.getter) {
|
|
526
|
+
links.push({
|
|
527
|
+
source: propShapeId,
|
|
528
|
+
predicate: "ad4m://getter",
|
|
529
|
+
target: `literal://string:${prop.getter}`
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (prop.conformanceConditions && prop.conformanceConditions.length > 0) {
|
|
534
|
+
links.push({
|
|
535
|
+
source: propShapeId,
|
|
536
|
+
predicate: "ad4m://conformanceConditions",
|
|
537
|
+
target: `literal://string:${JSON.stringify(prop.conformanceConditions)}`
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (prop.class) {
|
|
542
|
+
links.push({
|
|
543
|
+
source: propShapeId,
|
|
544
|
+
predicate: "sh://class",
|
|
545
|
+
target: prop.class
|
|
546
|
+
});
|
|
547
|
+
}
|
|
497
548
|
}
|
|
498
549
|
|
|
499
550
|
return links;
|
|
@@ -698,6 +749,32 @@ export class SHACLShape {
|
|
|
698
749
|
}
|
|
699
750
|
}
|
|
700
751
|
|
|
752
|
+
const getterLink = links.find(l =>
|
|
753
|
+
l.source === propShapeId && l.predicate === "ad4m://getter"
|
|
754
|
+
);
|
|
755
|
+
if (getterLink) {
|
|
756
|
+
prop.getter = getterLink.target.replace('literal://string:', '');
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
const conditionsLink = links.find(l =>
|
|
760
|
+
l.source === propShapeId && l.predicate === "ad4m://conformanceConditions"
|
|
761
|
+
);
|
|
762
|
+
if (conditionsLink) {
|
|
763
|
+
try {
|
|
764
|
+
const jsonStr = conditionsLink.target.replace('literal://string:', '');
|
|
765
|
+
prop.conformanceConditions = JSON.parse(jsonStr);
|
|
766
|
+
} catch (e) {
|
|
767
|
+
// Ignore parse errors
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
const classLink = links.find(l =>
|
|
772
|
+
l.source === propShapeId && l.predicate === "sh://class"
|
|
773
|
+
);
|
|
774
|
+
if (classLink) {
|
|
775
|
+
prop.class = classLink.target;
|
|
776
|
+
}
|
|
777
|
+
|
|
701
778
|
shape.addProperty(prop);
|
|
702
779
|
}
|
|
703
780
|
|
|
@@ -732,6 +809,9 @@ export class SHACLShape {
|
|
|
732
809
|
setter: p.setter,
|
|
733
810
|
adder: p.adder,
|
|
734
811
|
remover: p.remover,
|
|
812
|
+
getter: p.getter,
|
|
813
|
+
conformance_conditions: p.conformanceConditions,
|
|
814
|
+
class: p.class,
|
|
735
815
|
})),
|
|
736
816
|
constructor_actions: this.constructor_actions,
|
|
737
817
|
destructor_actions: this.destructor_actions,
|
|
@@ -764,6 +844,9 @@ export class SHACLShape {
|
|
|
764
844
|
setter: p.setter,
|
|
765
845
|
adder: p.adder,
|
|
766
846
|
remover: p.remover,
|
|
847
|
+
getter: p.getter,
|
|
848
|
+
conformanceConditions: p.conformance_conditions,
|
|
849
|
+
class: p.class,
|
|
767
850
|
});
|
|
768
851
|
}
|
|
769
852
|
|