@coasys/ad4m 0.13.0-test-3 → 0.13.0-test-4
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/README.md +2 -25
- package/jest-setup.ts +1 -1
- package/lib/index.cjs +2406 -11070
- package/lib/index.js +2209 -10925
- package/lib/src/Ad4mClient.d.ts +7 -3
- package/lib/src/Ad4mClient.js +29 -13
- package/lib/src/agent/Agent.js +26 -272
- package/lib/src/agent/AgentClient.d.ts +10 -21
- package/lib/src/agent/AgentClient.js +75 -427
- package/lib/src/agent/AgentStatus.js +2 -37
- package/lib/src/ai/AIClient.d.ts +12 -4
- package/lib/src/ai/AIClient.js +81 -285
- package/lib/src/ai/AITypes.d.ts +55 -0
- package/lib/src/ai/AITypes.js +18 -0
- package/lib/src/ai/Tasks.js +10 -133
- package/lib/src/apiClient.d.ts +52 -0
- package/lib/src/apiClient.js +231 -0
- package/lib/src/expression/Expression.d.ts +1 -1
- package/lib/src/expression/Expression.js +13 -122
- package/lib/src/expression/ExpressionClient.d.ts +3 -3
- package/lib/src/expression/ExpressionClient.js +13 -76
- package/lib/src/expression/ExpressionRef.js +2 -25
- package/lib/src/generated/api/AIModelLoadingStatus.d.ts +7 -0
- package/lib/src/generated/api/AIModelLoadingStatus.js +2 -0
- package/lib/src/generated/api/AddLinkExpressionRequest.d.ts +6 -0
- package/lib/src/generated/api/AddLinkExpressionRequest.js +1 -0
- package/lib/src/generated/api/AddLinkRequest.d.ts +6 -0
- package/lib/src/generated/api/AddLinkRequest.js +1 -0
- package/lib/src/generated/api/AddLinksBulkRequest.d.ts +6 -0
- package/lib/src/generated/api/AddLinksBulkRequest.js +1 -0
- package/lib/src/generated/api/AddSdnaRequest.d.ts +6 -0
- package/lib/src/generated/api/AddSdnaRequest.js +2 -0
- package/lib/src/generated/api/ApplyTemplateRequest.d.ts +4 -0
- package/lib/src/generated/api/ApplyTemplateRequest.js +2 -0
- package/lib/src/generated/api/AuthInfoInput.d.ts +10 -0
- package/lib/src/generated/api/AuthInfoInput.js +1 -0
- package/lib/src/generated/api/CapabilityInput.d.ts +5 -0
- package/lib/src/generated/api/CapabilityInput.js +1 -0
- package/lib/src/generated/api/CommitBatchRequest.d.ts +3 -0
- package/lib/src/generated/api/CommitBatchRequest.js +2 -0
- package/lib/src/generated/api/ComputeLogEntry.d.ts +9 -0
- package/lib/src/generated/api/ComputeLogEntry.js +2 -0
- package/lib/src/generated/api/CreateExpressionRequest.d.ts +4 -0
- package/lib/src/generated/api/CreateExpressionRequest.js +2 -0
- package/lib/src/generated/api/CreatePerspectiveRequest.d.ts +3 -0
- package/lib/src/generated/api/CreatePerspectiveRequest.js +2 -0
- package/lib/src/generated/api/CreateSubjectRequest.d.ts +6 -0
- package/lib/src/generated/api/CreateSubjectRequest.js +2 -0
- package/lib/src/generated/api/EmbedRequest.d.ts +4 -0
- package/lib/src/generated/api/EmbedRequest.js +2 -0
- package/lib/src/generated/api/EntanglementProofInput.d.ts +6 -0
- package/lib/src/generated/api/EntanglementProofInput.js +2 -0
- package/lib/src/generated/api/ExecuteCommandsRequest.d.ts +4 -0
- package/lib/src/generated/api/ExecuteCommandsRequest.js +2 -0
- package/lib/src/generated/api/ExportRequest.d.ts +5 -0
- package/lib/src/generated/api/ExportRequest.js +2 -0
- package/lib/src/generated/api/ExpressionManyRequest.d.ts +3 -0
- package/lib/src/generated/api/ExpressionManyRequest.js +2 -0
- package/lib/src/generated/api/ExpressionProof.d.ts +4 -0
- package/lib/src/generated/api/ExpressionProof.js +2 -0
- package/lib/src/generated/api/ExpressionProofInput.d.ts +6 -0
- package/lib/src/generated/api/ExpressionProofInput.js +2 -0
- package/lib/src/generated/api/FriendSendMessageRequest.d.ts +3 -0
- package/lib/src/generated/api/FriendSendMessageRequest.js +2 -0
- package/lib/src/generated/api/FriendsListRequest.d.ts +3 -0
- package/lib/src/generated/api/FriendsListRequest.js +2 -0
- package/lib/src/generated/api/GenerateAgentRequest.d.ts +3 -0
- package/lib/src/generated/api/GenerateAgentRequest.js +2 -0
- package/lib/src/generated/api/GenerateJwtRequest.d.ts +4 -0
- package/lib/src/generated/api/GenerateJwtRequest.js +2 -0
- package/lib/src/generated/api/GetSubjectDataRequest.d.ts +4 -0
- package/lib/src/generated/api/GetSubjectDataRequest.js +2 -0
- package/lib/src/generated/api/ImportAgentRequest.d.ts +6 -0
- package/lib/src/generated/api/ImportAgentRequest.js +2 -0
- package/lib/src/generated/api/ImportRequest.d.ts +4 -0
- package/lib/src/generated/api/ImportRequest.js +2 -0
- package/lib/src/generated/api/JoinNeighbourhoodRequest.d.ts +3 -0
- package/lib/src/generated/api/JoinNeighbourhoodRequest.js +2 -0
- package/lib/src/generated/api/LanguageMetaInput.d.ts +6 -0
- package/lib/src/generated/api/LanguageMetaInput.js +2 -0
- package/lib/src/generated/api/Link.d.ts +5 -0
- package/lib/src/generated/api/Link.js +2 -0
- package/lib/src/generated/api/LinkExpression.d.ts +10 -0
- package/lib/src/generated/api/LinkExpression.js +1 -0
- package/lib/src/generated/api/LinkExpressionInput.d.ts +10 -0
- package/lib/src/generated/api/LinkExpressionInput.js +1 -0
- package/lib/src/generated/api/LinkInput.d.ts +5 -0
- package/lib/src/generated/api/LinkInput.js +2 -0
- package/lib/src/generated/api/LinkLanguageTemplatesRequest.d.ts +3 -0
- package/lib/src/generated/api/LinkLanguageTemplatesRequest.js +2 -0
- package/lib/src/generated/api/LinkMutations.d.ts +6 -0
- package/lib/src/generated/api/LinkMutations.js +1 -0
- package/lib/src/generated/api/LinkStatus.d.ts +1 -0
- package/lib/src/generated/api/LinkStatus.js +2 -0
- package/lib/src/generated/api/LockAgentRequest.d.ts +3 -0
- package/lib/src/generated/api/LockAgentRequest.js +2 -0
- package/lib/src/generated/api/ModelType.d.ts +1 -0
- package/lib/src/generated/api/ModelType.js +2 -0
- package/lib/src/generated/api/NotificationInput.d.ts +10 -0
- package/lib/src/generated/api/NotificationInput.js +2 -0
- package/lib/src/generated/api/OpenLinkRequest.d.ts +3 -0
- package/lib/src/generated/api/OpenLinkRequest.js +2 -0
- package/lib/src/generated/api/PermitCapabilityRequest.d.ts +3 -0
- package/lib/src/generated/api/PermitCapabilityRequest.js +2 -0
- package/lib/src/generated/api/PerspectiveInput.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveInput.js +1 -0
- package/lib/src/generated/api/PromptRequest.d.ts +4 -0
- package/lib/src/generated/api/PromptRequest.js +2 -0
- package/lib/src/generated/api/PublishLanguageRequest.d.ts +5 -0
- package/lib/src/generated/api/PublishLanguageRequest.js +1 -0
- package/lib/src/generated/api/PublishNeighbourhoodRequest.d.ts +6 -0
- package/lib/src/generated/api/PublishNeighbourhoodRequest.js +1 -0
- package/lib/src/generated/api/QueryRequest.d.ts +7 -0
- package/lib/src/generated/api/QueryRequest.js +2 -0
- package/lib/src/generated/api/RemoveLinkRequest.d.ts +5 -0
- package/lib/src/generated/api/RemoveLinkRequest.js +1 -0
- package/lib/src/generated/api/RemoveLinksBulkRequest.d.ts +5 -0
- package/lib/src/generated/api/RemoveLinksBulkRequest.js +1 -0
- package/lib/src/generated/api/ResourceInput.d.ts +4 -0
- package/lib/src/generated/api/ResourceInput.js +2 -0
- package/lib/src/generated/api/SetDefaultModelRequest.d.ts +4 -0
- package/lib/src/generated/api/SetDefaultModelRequest.js +1 -0
- package/lib/src/generated/api/SetFreeHostingEnabledRequest.d.ts +3 -0
- package/lib/src/generated/api/SetFreeHostingEnabledRequest.js +2 -0
- package/lib/src/generated/api/SetMultiUserRequest.d.ts +3 -0
- package/lib/src/generated/api/SetMultiUserRequest.js +2 -0
- package/lib/src/generated/api/SetStatusRequest.d.ts +3 -0
- package/lib/src/generated/api/SetStatusRequest.js +2 -0
- package/lib/src/generated/api/SignMessageRequest.d.ts +3 -0
- package/lib/src/generated/api/SignMessageRequest.js +2 -0
- package/lib/src/generated/api/TrustedAgentsRequest.d.ts +3 -0
- package/lib/src/generated/api/TrustedAgentsRequest.js +2 -0
- package/lib/src/generated/api/UnlockAgentRequest.d.ts +4 -0
- package/lib/src/generated/api/UnlockAgentRequest.js +2 -0
- package/lib/src/generated/api/UpdateLinkRequest.d.ts +7 -0
- package/lib/src/generated/api/UpdateLinkRequest.js +1 -0
- package/lib/src/generated/api/UpdatePerspectiveRequest.d.ts +3 -0
- package/lib/src/generated/api/UpdatePerspectiveRequest.js +2 -0
- package/lib/src/generated/api/UserStatistics.d.ts +9 -0
- package/lib/src/generated/api/UserStatistics.js +2 -0
- package/lib/src/generated/api/VerificationRequestResult.d.ts +6 -0
- package/lib/src/generated/api/VerificationRequestResult.js +2 -0
- package/lib/src/generated/api/VerifySignatureRequest.d.ts +5 -0
- package/lib/src/generated/api/VerifySignatureRequest.js +2 -0
- package/lib/src/generated/api/WriteSettingsRequest.d.ts +3 -0
- package/lib/src/generated/api/WriteSettingsRequest.js +2 -0
- package/lib/src/generated/api/index.d.ts +42 -0
- package/lib/src/generated/api/index.js +7 -0
- package/lib/src/index.d.ts +6 -1
- package/lib/src/index.js +6 -1
- package/lib/src/jestSetup.d.ts +0 -1
- package/lib/src/jestSetup.js +1 -1
- package/lib/src/language/Icon.js +2 -21
- package/lib/src/language/Language.d.ts +1 -1
- package/lib/src/language/Language.js +10 -76
- package/lib/src/language/LanguageClient.d.ts +2 -2
- package/lib/src/language/LanguageClient.js +15 -105
- package/lib/src/language/LanguageHandle.js +2 -41
- package/lib/src/language/LanguageMeta.js +4 -75
- package/lib/src/language/LanguageRef.js +2 -25
- package/lib/src/links/Links.js +14 -111
- package/lib/src/model/Ad4mModel.d.ts +57 -38
- package/lib/src/model/Ad4mModel.js +594 -460
- package/lib/src/model/Ad4mModel.test.js +371 -815
- package/lib/src/model/ModelQueryBuilder.d.ts +9 -21
- package/lib/src/model/ModelQueryBuilder.js +138 -217
- package/lib/src/model/decorators.d.ts +22 -0
- package/lib/src/model/decorators.js +7 -0
- package/lib/src/model/hydration.d.ts +7 -60
- package/lib/src/model/hydration.js +7 -716
- package/lib/src/model/index.d.ts +0 -4
- package/lib/src/model/index.js +0 -4
- package/lib/src/model/model-manifest.d.ts +41 -0
- package/lib/src/model/model-manifest.js +11 -0
- package/lib/src/model/query-sparql.d.ts +4 -67
- package/lib/src/model/query-sparql.js +26 -322
- package/lib/src/model/query-sparql.test.js +35 -218
- package/lib/src/model/shacl-gen.js +4 -0
- package/lib/src/model/types.d.ts +47 -38
- package/lib/src/model/types.js +4 -1
- package/lib/src/neighbourhood/Neighbourhood.js +4 -32
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +3 -3
- package/lib/src/neighbourhood/NeighbourhoodClient.js +40 -203
- package/lib/src/perspectives/LinkQuery.js +2 -42
- package/lib/src/perspectives/Perspective.d.ts +1 -1
- package/lib/src/perspectives/Perspective.js +10 -52
- package/lib/src/perspectives/PerspectiveClient.d.ts +12 -17
- package/lib/src/perspectives/PerspectiveClient.js +169 -429
- package/lib/src/perspectives/PerspectiveClient.test.js +55 -0
- package/lib/src/perspectives/PerspectiveDiff.js +4 -31
- package/lib/src/perspectives/PerspectiveHandle.js +3 -43
- package/lib/src/perspectives/PerspectiveProxy.d.ts +92 -71
- package/lib/src/perspectives/PerspectiveProxy.js +273 -310
- package/lib/src/runtime/RuntimeClient.d.ts +6 -6
- package/lib/src/runtime/RuntimeClient.js +93 -467
- package/lib/src/runtime/RuntimeTypes.d.ts +101 -0
- package/lib/src/runtime/RuntimeTypes.js +45 -0
- package/lib/src/shacl/SHACLShape.d.ts +7 -0
- package/lib/src/shacl/SHACLShape.js +19 -0
- package/lib/src/shacl/SHACLShape.test.js +82 -0
- package/lib/src/typeDefs.js +3 -628
- package/package.json +9 -24
- package/rollup.config.js +0 -7
- package/src/Ad4mClient.test.ts +1179 -1340
- package/src/Ad4mClient.ts +30 -15
- package/src/agent/Agent.ts +0 -99
- package/src/agent/AgentClient.ts +112 -526
- package/src/agent/AgentStatus.ts +0 -12
- package/src/ai/AIClient.ts +96 -296
- package/src/ai/AITypes.ts +66 -0
- package/src/ai/Tasks.ts +0 -52
- package/src/apiClient.ts +283 -0
- package/src/expression/Expression.ts +3 -43
- package/src/expression/ExpressionClient.ts +14 -77
- package/src/expression/ExpressionRef.ts +0 -6
- package/src/generated/api/AIModelLoadingStatus.ts +3 -0
- package/src/generated/api/AddLinkExpressionRequest.ts +4 -0
- package/src/generated/api/AddLinkRequest.ts +4 -0
- package/src/generated/api/AddLinksBulkRequest.ts +4 -0
- package/src/generated/api/AddSdnaRequest.ts +3 -0
- package/src/generated/api/ApplyTemplateRequest.ts +3 -0
- package/src/generated/api/AuthInfoInput.ts +4 -0
- package/src/generated/api/CapabilityInput.ts +4 -0
- package/src/generated/api/CommitBatchRequest.ts +3 -0
- package/src/generated/api/ComputeLogEntry.ts +3 -0
- package/src/generated/api/CreateExpressionRequest.ts +3 -0
- package/src/generated/api/CreatePerspectiveRequest.ts +3 -0
- package/src/generated/api/CreateSubjectRequest.ts +3 -0
- package/src/generated/api/EmbedRequest.ts +3 -0
- package/src/generated/api/EntanglementProofInput.ts +3 -0
- package/src/generated/api/ExecuteCommandsRequest.ts +3 -0
- package/src/generated/api/ExportRequest.ts +3 -0
- package/src/generated/api/ExpressionManyRequest.ts +3 -0
- package/src/generated/api/ExpressionProof.ts +3 -0
- package/src/generated/api/ExpressionProofInput.ts +3 -0
- package/src/generated/api/FriendSendMessageRequest.ts +3 -0
- package/src/generated/api/FriendsListRequest.ts +3 -0
- package/src/generated/api/GenerateAgentRequest.ts +3 -0
- package/src/generated/api/GenerateJwtRequest.ts +3 -0
- package/src/generated/api/GetSubjectDataRequest.ts +3 -0
- package/src/generated/api/ImportAgentRequest.ts +3 -0
- package/src/generated/api/ImportRequest.ts +3 -0
- package/src/generated/api/JoinNeighbourhoodRequest.ts +3 -0
- package/src/generated/api/LanguageMetaInput.ts +3 -0
- package/src/generated/api/Link.ts +3 -0
- package/src/generated/api/LinkExpression.ts +6 -0
- package/src/generated/api/LinkExpressionInput.ts +6 -0
- package/src/generated/api/LinkInput.ts +3 -0
- package/src/generated/api/LinkLanguageTemplatesRequest.ts +3 -0
- package/src/generated/api/LinkMutations.ts +5 -0
- package/src/generated/api/LinkStatus.ts +3 -0
- package/src/generated/api/LockAgentRequest.ts +3 -0
- package/src/generated/api/ModelType.ts +3 -0
- package/src/generated/api/NotificationInput.ts +3 -0
- package/src/generated/api/OpenLinkRequest.ts +3 -0
- package/src/generated/api/PermitCapabilityRequest.ts +3 -0
- package/src/generated/api/PerspectiveInput.ts +4 -0
- package/src/generated/api/PromptRequest.ts +3 -0
- package/src/generated/api/PublishLanguageRequest.ts +4 -0
- package/src/generated/api/PublishNeighbourhoodRequest.ts +4 -0
- package/src/generated/api/QueryRequest.ts +6 -0
- package/src/generated/api/RemoveLinkRequest.ts +4 -0
- package/src/generated/api/RemoveLinksBulkRequest.ts +4 -0
- package/src/generated/api/ResourceInput.ts +3 -0
- package/src/generated/api/SetDefaultModelRequest.ts +4 -0
- package/src/generated/api/SetFreeHostingEnabledRequest.ts +3 -0
- package/src/generated/api/SetMultiUserRequest.ts +3 -0
- package/src/generated/api/SetStatusRequest.ts +3 -0
- package/src/generated/api/SignMessageRequest.ts +3 -0
- package/src/generated/api/TrustedAgentsRequest.ts +3 -0
- package/src/generated/api/UnlockAgentRequest.ts +3 -0
- package/src/generated/api/UpdateLinkRequest.ts +5 -0
- package/src/generated/api/UpdatePerspectiveRequest.ts +3 -0
- package/src/generated/api/UserStatistics.ts +3 -0
- package/src/generated/api/VerificationRequestResult.ts +3 -0
- package/src/generated/api/VerifySignatureRequest.ts +3 -0
- package/src/generated/api/WriteSettingsRequest.ts +3 -0
- package/src/generated/api/index.ts +49 -0
- package/src/index.ts +6 -1
- package/src/jestSetup.ts +1 -1
- package/src/language/Icon.ts +0 -4
- package/src/language/Language.ts +2 -23
- package/src/language/LanguageClient.ts +21 -132
- package/src/language/LanguageHandle.ts +0 -14
- package/src/language/LanguageMeta.ts +0 -29
- package/src/language/LanguageRef.ts +0 -7
- package/src/links/Links.ts +0 -37
- package/src/model/Ad4mModel.test.ts +708 -876
- package/src/model/Ad4mModel.ts +613 -508
- package/src/model/ModelQueryBuilder.ts +178 -244
- package/src/model/decorators.ts +29 -0
- package/src/model/hydration.ts +9 -766
- package/src/model/index.ts +0 -4
- package/src/model/query-sparql.test.ts +34 -242
- package/src/model/query-sparql.ts +27 -337
- package/src/model/shacl-gen.ts +5 -0
- package/src/model/types.ts +51 -39
- package/src/neighbourhood/Neighbourhood.ts +0 -9
- package/src/neighbourhood/NeighbourhoodClient.ts +42 -207
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +34 -36
- package/src/perspectives/LinkQuery.ts +0 -15
- package/src/perspectives/Perspective.ts +1 -12
- package/src/perspectives/PerspectiveClient.test.ts +206 -148
- package/src/perspectives/PerspectiveClient.ts +228 -442
- package/src/perspectives/PerspectiveDiff.ts +0 -8
- package/src/perspectives/PerspectiveHandle.ts +1 -12
- package/src/perspectives/PerspectiveProxy.test.ts +41 -0
- package/src/perspectives/PerspectiveProxy.ts +307 -348
- package/src/runtime/RuntimeClient.ts +112 -474
- package/src/runtime/RuntimeTypes.ts +144 -0
- package/src/shacl/SHACLShape.test.ts +94 -0
- package/src/shacl/SHACLShape.ts +27 -0
- package/src/typeDefs.ts +3 -5
- package/tsconfig.json +3 -7
- package/shims/reflect-metadata.ts +0 -0
- package/shims/type-graphql.ts +0 -75
- package/src/PubSub.ts +0 -17
- package/src/agent/AgentResolver.ts +0 -263
- package/src/ai/AIResolver.ts +0 -372
- package/src/buildSchema.ts +0 -43
- package/src/expression/ExpressionResolver.ts +0 -64
- package/src/language/LanguageResolver.ts +0 -98
- package/src/model/Subject.ts +0 -159
- package/src/model/hydration-batch.ts +0 -205
- package/src/model/hydration-batching.test.ts +0 -563
- package/src/model/prolog-facts.ts +0 -145
- package/src/model/query-prolog.ts +0 -148
- package/src/model/query-sparql-batch.ts +0 -301
- package/src/model/subscription-delta.test.ts +0 -207
- package/src/model/subscription-pool.ts +0 -211
- package/src/neighbourhood/NeighbourhoodResolver.ts +0 -100
- package/src/perspectives/PerspectiveResolver.ts +0 -364
- package/src/runtime/RuntimeResolver.ts +0 -749
- package/src/unwrapApolloResult.ts +0 -16
|
@@ -167,3 +167,58 @@ describe('PerspectiveClient proxy cache', () => {
|
|
|
167
167
|
expect(original.name).toBe('FreshName'); // original ref also updated
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
|
+
describe('PerspectiveProxy getClassShape sh:in URI-decoding', () => {
|
|
171
|
+
// This tests the sh:in parsing logic in getClassShape() which was fixed
|
|
172
|
+
// to URI-decode values from the Rust executor's SPARQL results
|
|
173
|
+
function parseShInValue(raw) {
|
|
174
|
+
// Reproduce the exact parsing logic from PerspectiveProxy.getClassShape()
|
|
175
|
+
try {
|
|
176
|
+
if (raw.startsWith('literal:string:')) {
|
|
177
|
+
raw = decodeURIComponent(raw.substring('literal:string:'.length));
|
|
178
|
+
}
|
|
179
|
+
return JSON.parse(raw);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
it('parses plain JSON sh:in values', () => {
|
|
186
|
+
const result = parseShInValue('[{"value":"a"},{"value":"b","label":"B"}]');
|
|
187
|
+
expect(result).toEqual([
|
|
188
|
+
{ value: 'a' },
|
|
189
|
+
{ value: 'b', label: 'B' },
|
|
190
|
+
]);
|
|
191
|
+
});
|
|
192
|
+
it('strips literal:string: prefix and parses', () => {
|
|
193
|
+
const result = parseShInValue('literal:string:[{"value":"x"},{"value":"y"}]');
|
|
194
|
+
expect(result).toEqual([
|
|
195
|
+
{ value: 'x' },
|
|
196
|
+
{ value: 'y' },
|
|
197
|
+
]);
|
|
198
|
+
});
|
|
199
|
+
it('URI-decodes encoded sh:in values from Rust executor', () => {
|
|
200
|
+
// Rust executor may URI-encode the JSON when returning SPARQL results
|
|
201
|
+
const encoded = 'literal:string:' + encodeURIComponent('[{"value":"hello world"},{"value":"a&b"}]');
|
|
202
|
+
const result = parseShInValue(encoded);
|
|
203
|
+
expect(result).toEqual([
|
|
204
|
+
{ value: 'hello world' },
|
|
205
|
+
{ value: 'a&b' },
|
|
206
|
+
]);
|
|
207
|
+
});
|
|
208
|
+
it('handles double-encoded brackets and quotes', () => {
|
|
209
|
+
const encoded = 'literal:string:%5B%7B%22value%22%3A%22active%22%7D%2C%7B%22value%22%3A%22inactive%22%7D%5D';
|
|
210
|
+
const result = parseShInValue(encoded);
|
|
211
|
+
expect(result).toEqual([
|
|
212
|
+
{ value: 'active' },
|
|
213
|
+
{ value: 'inactive' },
|
|
214
|
+
]);
|
|
215
|
+
});
|
|
216
|
+
it('returns undefined for malformed JSON', () => {
|
|
217
|
+
const result = parseShInValue('literal:string:not-json');
|
|
218
|
+
expect(result).toBeUndefined();
|
|
219
|
+
});
|
|
220
|
+
it('handles already-decoded values without prefix', () => {
|
|
221
|
+
const result = parseShInValue('[{"value":"test"}]');
|
|
222
|
+
expect(result).toEqual([{ value: 'test' }]);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
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 { Field, ObjectType } from "type-graphql";
|
|
11
1
|
import { ExpressionGeneric } from "../expression/Expression";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Field(type => [LinkExpression]),
|
|
17
|
-
__metadata("design:type", Array)
|
|
18
|
-
], PerspectiveDiff.prototype, "additions", void 0);
|
|
19
|
-
__decorate([
|
|
20
|
-
Field(type => [LinkExpression]),
|
|
21
|
-
__metadata("design:type", Array)
|
|
22
|
-
], PerspectiveDiff.prototype, "removals", void 0);
|
|
23
|
-
PerspectiveDiff = __decorate([
|
|
24
|
-
ObjectType()
|
|
25
|
-
], PerspectiveDiff);
|
|
26
|
-
export { PerspectiveDiff };
|
|
27
|
-
let PerspectiveDiffExpression = class PerspectiveDiffExpression extends ExpressionGeneric(PerspectiveDiff) {
|
|
28
|
-
};
|
|
29
|
-
PerspectiveDiffExpression = __decorate([
|
|
30
|
-
ObjectType()
|
|
31
|
-
], PerspectiveDiffExpression);
|
|
32
|
-
export { PerspectiveDiffExpression };
|
|
2
|
+
export class PerspectiveDiff {
|
|
3
|
+
}
|
|
4
|
+
export class PerspectiveDiffExpression extends ExpressionGeneric(PerspectiveDiff) {
|
|
5
|
+
}
|
|
33
6
|
;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
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 { Field, ObjectType } from "type-graphql";
|
|
11
|
-
import { NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
|
|
12
1
|
export var PerspectiveState;
|
|
13
2
|
(function (PerspectiveState) {
|
|
14
3
|
PerspectiveState["Private"] = "PRIVATE";
|
|
@@ -18,10 +7,10 @@ export var PerspectiveState;
|
|
|
18
7
|
PerspectiveState["LinkLanguageInstalledButNotSynced"] = "LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED";
|
|
19
8
|
PerspectiveState["Synced"] = "SYNCED";
|
|
20
9
|
})(PerspectiveState || (PerspectiveState = {}));
|
|
21
|
-
// This type is used in the
|
|
10
|
+
// This type is used in the REST interface to reference a mutable
|
|
22
11
|
// prespective that is implemented locally by the Ad4m runtime.
|
|
23
12
|
// The UUID is used in mutations to identify the perspective that gets mutated.
|
|
24
|
-
|
|
13
|
+
export class PerspectiveHandle {
|
|
25
14
|
constructor(uuid, name, state) {
|
|
26
15
|
this.uuid = uuid;
|
|
27
16
|
this.name = name;
|
|
@@ -32,33 +21,4 @@ let PerspectiveHandle = class PerspectiveHandle {
|
|
|
32
21
|
this.state = PerspectiveState.Private;
|
|
33
22
|
}
|
|
34
23
|
}
|
|
35
|
-
}
|
|
36
|
-
__decorate([
|
|
37
|
-
Field(),
|
|
38
|
-
__metadata("design:type", String)
|
|
39
|
-
], PerspectiveHandle.prototype, "uuid", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
Field(),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], PerspectiveHandle.prototype, "name", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
Field(),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], PerspectiveHandle.prototype, "state", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
Field(type => String, { nullable: true }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], PerspectiveHandle.prototype, "sharedUrl", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
Field(type => NeighbourhoodExpression, { nullable: true }),
|
|
54
|
-
__metadata("design:type", NeighbourhoodExpression)
|
|
55
|
-
], PerspectiveHandle.prototype, "neighbourhood", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
Field(type => [String], { nullable: true }),
|
|
58
|
-
__metadata("design:type", Array)
|
|
59
|
-
], PerspectiveHandle.prototype, "owners", void 0);
|
|
60
|
-
PerspectiveHandle = __decorate([
|
|
61
|
-
ObjectType(),
|
|
62
|
-
__metadata("design:paramtypes", [String, String, String])
|
|
63
|
-
], PerspectiveHandle);
|
|
64
|
-
export { PerspectiveHandle };
|
|
24
|
+
}
|
|
@@ -16,7 +16,7 @@ type QueryCallback = (result: AllInstancesResult) => void;
|
|
|
16
16
|
* This class handles:
|
|
17
17
|
* - Keeping the subscription alive by sending periodic keepalive signals
|
|
18
18
|
* - Managing callbacks for result updates
|
|
19
|
-
* - Subscribing to query updates via
|
|
19
|
+
* - Subscribing to query updates via WebSocket subscriptions
|
|
20
20
|
* - Maintaining the latest query result
|
|
21
21
|
* - Ensuring subscription is fully initialized before allowing access
|
|
22
22
|
* - Cleaning up resources when disposed
|
|
@@ -107,7 +107,7 @@ export declare class QuerySubscriptionProxy {
|
|
|
107
107
|
*
|
|
108
108
|
* This method:
|
|
109
109
|
* 1. Stops the keepalive timer
|
|
110
|
-
* 2. Unsubscribes from
|
|
110
|
+
* 2. Unsubscribes from subscription updates
|
|
111
111
|
* 3. Clears all registered callbacks
|
|
112
112
|
* 4. Cleans up any pending initialization timeout
|
|
113
113
|
*
|
|
@@ -175,6 +175,8 @@ export declare class PerspectiveProxy {
|
|
|
175
175
|
state: PerspectiveState | null;
|
|
176
176
|
/** List of owners of this perspective */
|
|
177
177
|
owners?: string[];
|
|
178
|
+
/** @internal Exposed for ModelQueryBuilder subscription management */
|
|
179
|
+
get client(): PerspectiveClient;
|
|
178
180
|
/**
|
|
179
181
|
* Creates a new PerspectiveProxy instance.
|
|
180
182
|
* Note: Don't create this directly, use ad4m.perspective.add() instead.
|
|
@@ -317,6 +319,35 @@ export declare class PerspectiveProxy {
|
|
|
317
319
|
* @returns Query results as parsed JSON
|
|
318
320
|
*/
|
|
319
321
|
querySparql(query: string): Promise<any>;
|
|
322
|
+
/**
|
|
323
|
+
* Execute a model query — the executor-side replacement for SPARQL query building + JS hydration.
|
|
324
|
+
*
|
|
325
|
+
* @param className - The model class name (e.g. "Recipe")
|
|
326
|
+
* @param queryJson - Structured query as JSON string
|
|
327
|
+
* @param shapeJson - Optional shape metadata JSON from the model class
|
|
328
|
+
* @returns Object with `instances` array and `totalCount`
|
|
329
|
+
*/
|
|
330
|
+
modelQuery(className: string, queryJson: string, shapeJson?: string): Promise<{
|
|
331
|
+
instances: any[];
|
|
332
|
+
totalCount: number;
|
|
333
|
+
}>;
|
|
334
|
+
/**
|
|
335
|
+
* Subscribe to model query changes. Builds trigger SPARQL from the model shape
|
|
336
|
+
* internally in Rust, registers a subscription, runs the initial query, and
|
|
337
|
+
* pushes updated results when relevant links change.
|
|
338
|
+
*
|
|
339
|
+
* The subscription reuses the same GraphQL subscription channel as subscribeQuery().
|
|
340
|
+
* Use keepAliveQuery() / disposeQuerySubscription() with the returned subscriptionId.
|
|
341
|
+
*
|
|
342
|
+
* @param className - The model class name
|
|
343
|
+
* @param queryJson - JSON-serialized query parameters (same as modelQuery)
|
|
344
|
+
* @param shapeJson - Optional shape metadata JSON from the model class
|
|
345
|
+
* @returns Object with `subscriptionId` and initial `result`
|
|
346
|
+
*/
|
|
347
|
+
modelSubscribe(className: string, queryJson: string, shapeJson?: string): Promise<{
|
|
348
|
+
subscriptionId: string;
|
|
349
|
+
result: any;
|
|
350
|
+
}>;
|
|
320
351
|
/**
|
|
321
352
|
* Adds a new link to the perspective.
|
|
322
353
|
*
|
|
@@ -526,7 +557,7 @@ export declare class PerspectiveProxy {
|
|
|
526
557
|
* Adds Social DNA code to the perspective.
|
|
527
558
|
*
|
|
528
559
|
* **Recommended:** Use {@link addShacl} instead, which accepts the `SHACLShape` type directly.
|
|
529
|
-
* This method is primarily for the
|
|
560
|
+
* This method is primarily for the RPC API layer and legacy Prolog code.
|
|
530
561
|
*
|
|
531
562
|
* @param name - Unique name for this SDNA definition
|
|
532
563
|
* @param sdnaCode - Prolog SDNA code (legacy, can be empty string if shaclJson provided)
|
|
@@ -675,16 +706,6 @@ export declare class PerspectiveProxy {
|
|
|
675
706
|
* that matches the given properties will be used.
|
|
676
707
|
*/
|
|
677
708
|
isSubjectInstance<T>(expression: string, subjectClass: T): Promise<boolean>;
|
|
678
|
-
/** For an existing subject instance (existing in the perspective's links)
|
|
679
|
-
* this function returns a proxy object that can be used to access the subject's
|
|
680
|
-
* properties and methods.
|
|
681
|
-
*
|
|
682
|
-
* @param base URI of the subject's root expression
|
|
683
|
-
* @param subjectClass Either a string with the name of the subject class, or an object
|
|
684
|
-
* with the properties of the subject class. In the latter case, the first subject class
|
|
685
|
-
* that matches the given properties will be used.
|
|
686
|
-
*/
|
|
687
|
-
getSubjectProxy<T>(base: string, subjectClass: T): Promise<T>;
|
|
688
709
|
/**
|
|
689
710
|
* Gets subject class metadata from SHACL links using SHACLShape.fromLinks().
|
|
690
711
|
* Retrieves the SHACL shape and extracts metadata for instance queries.
|
|
@@ -705,23 +726,6 @@ export declare class PerspectiveProxy {
|
|
|
705
726
|
condition?: string;
|
|
706
727
|
}>;
|
|
707
728
|
} | null>;
|
|
708
|
-
/** @deprecated Use getSubjectClassMetadata() */
|
|
709
|
-
getSubjectClassMetadataFromSDNA(className: string): Promise<{
|
|
710
|
-
requiredPredicates: string[];
|
|
711
|
-
requiredTriples: Array<{
|
|
712
|
-
predicate: string;
|
|
713
|
-
target?: string;
|
|
714
|
-
}>;
|
|
715
|
-
properties: Map<string, {
|
|
716
|
-
predicate: string;
|
|
717
|
-
resolveLanguage?: string;
|
|
718
|
-
}>;
|
|
719
|
-
relations: Map<string, {
|
|
720
|
-
predicate: string;
|
|
721
|
-
instanceFilter?: string;
|
|
722
|
-
condition?: string;
|
|
723
|
-
}>;
|
|
724
|
-
} | null>;
|
|
725
729
|
/**
|
|
726
730
|
* Generates a SPARQL query to find instances based on class metadata.
|
|
727
731
|
*/
|
|
@@ -730,53 +734,12 @@ export declare class PerspectiveProxy {
|
|
|
730
734
|
* Returns base URIs of matching instances.
|
|
731
735
|
*/
|
|
732
736
|
private findInstancesByMetadata;
|
|
733
|
-
/**
|
|
734
|
-
* Gets a property value using SPARQL when Prolog fails.
|
|
735
|
-
* This is used as a fallback in SdnaOnly mode where link data isn't in Prolog.
|
|
736
|
-
*/
|
|
737
|
-
getPropertyValueViaSparql(baseExpression: string, className: string, propertyName: string): Promise<any>;
|
|
738
|
-
/**
|
|
739
|
-
* Gets relation values using SPARQL when Prolog fails.
|
|
740
|
-
* This is used as a fallback in SdnaOnly mode where link data isn't in Prolog.
|
|
741
|
-
* Note: This is used by Subject.ts (legacy pattern). Ad4mModel.ts uses getModelMetadata() instead.
|
|
742
|
-
*/
|
|
743
|
-
getRelationValuesViaSparql(baseExpression: string, className: string, relationName: string): Promise<any[]>;
|
|
744
|
-
/**
|
|
745
|
-
* Batch-checks multiple expressions against subject class metadata using a single or limited SPARQL queries.
|
|
746
|
-
* This avoids N+1 query problems by checking all values at once.
|
|
747
|
-
*/
|
|
748
|
-
batchCheckSubjectInstances(expressions: string[], metadata: {
|
|
749
|
-
requiredPredicates: string[];
|
|
750
|
-
requiredTriples: Array<{
|
|
751
|
-
predicate: string;
|
|
752
|
-
target?: string;
|
|
753
|
-
}>;
|
|
754
|
-
properties: Map<string, {
|
|
755
|
-
predicate: string;
|
|
756
|
-
resolveLanguage?: string;
|
|
757
|
-
}>;
|
|
758
|
-
relations: Map<string, {
|
|
759
|
-
predicate: string;
|
|
760
|
-
instanceFilter?: string;
|
|
761
|
-
condition?: string;
|
|
762
|
-
}>;
|
|
763
|
-
}): Promise<string[]>;
|
|
764
|
-
/**
|
|
765
|
-
* Fallback sequential instance checking when batch checking isn't available.
|
|
766
|
-
*/
|
|
767
|
-
private filterInstancesSequential;
|
|
768
737
|
/** Returns all subject instances of the given subject class as proxy objects.
|
|
769
738
|
* @param subjectClass Either a string with the name of the subject class, or an object
|
|
770
739
|
* with the properties of the subject class. In the latter case, all subject classes
|
|
771
740
|
* that match the given properties will be used.
|
|
772
741
|
*/
|
|
773
742
|
getAllSubjectInstances<T>(subjectClass: T): Promise<T[]>;
|
|
774
|
-
/** Returns all subject proxies of the given subject class as proxy objects.
|
|
775
|
-
* @param subjectClass Either a string with the name of the subject class, or an object
|
|
776
|
-
* with the properties of the subject class. In the latter case, all subject classes
|
|
777
|
-
* that match the given properties will be used.
|
|
778
|
-
*/
|
|
779
|
-
getAllSubjectProxies<T>(subjectClass: T): Promise<T[]>;
|
|
780
743
|
/**
|
|
781
744
|
* Find a subject class by matching an object's properties/relations against SHACL shapes.
|
|
782
745
|
* Queries SHACL links client-side to find a class whose properties contain all required ones.
|
|
@@ -808,6 +771,64 @@ export declare class PerspectiveProxy {
|
|
|
808
771
|
* Call this after wiping a perspective's links so that
|
|
809
772
|
* subsequent register() calls re-add SHACL definitions. */
|
|
810
773
|
clearEnsuredSubjectClasses(): void;
|
|
774
|
+
/**
|
|
775
|
+
* Returns a list of all class names that have been registered as SHACL
|
|
776
|
+
* subject classes in this perspective (via `ensureSDNASubjectClass` or `addSdna`).
|
|
777
|
+
*
|
|
778
|
+
* @returns Array of class name strings (e.g. `["Channel", "Message", "Task"]`)
|
|
779
|
+
*/
|
|
780
|
+
listRegisteredClasses(): Promise<string[]>;
|
|
781
|
+
/**
|
|
782
|
+
* Returns the SHACL shape metadata for a registered class, including
|
|
783
|
+
* property names, predicates, datatypes, and cardinality constraints.
|
|
784
|
+
*
|
|
785
|
+
* @param className - The name of the registered class
|
|
786
|
+
* @returns Shape metadata or `null` if the class is not registered
|
|
787
|
+
*/
|
|
788
|
+
getClassShape(className: string): Promise<{
|
|
789
|
+
className: string;
|
|
790
|
+
shapeUri: string;
|
|
791
|
+
properties: Array<{
|
|
792
|
+
name: string;
|
|
793
|
+
predicate: string;
|
|
794
|
+
datatype?: string;
|
|
795
|
+
required: boolean;
|
|
796
|
+
collection: boolean;
|
|
797
|
+
writable: boolean;
|
|
798
|
+
options?: Array<{
|
|
799
|
+
value: string;
|
|
800
|
+
label?: string;
|
|
801
|
+
}>;
|
|
802
|
+
}>;
|
|
803
|
+
} | null>;
|
|
804
|
+
/**
|
|
805
|
+
* Detects which registered subject classes a given instance conforms to,
|
|
806
|
+
* based on its stored triples matching the class shapes' required properties.
|
|
807
|
+
*
|
|
808
|
+
* @param baseExpression - The instance's base expression / subject URI
|
|
809
|
+
* @returns Array of class names the instance matches
|
|
810
|
+
*/
|
|
811
|
+
getInstanceClasses(baseExpression: string): Promise<string[]>;
|
|
812
|
+
/**
|
|
813
|
+
* Returns all named options (sh:in values) for a registered class, grouped by property.
|
|
814
|
+
*
|
|
815
|
+
* @param className - The name of the registered class
|
|
816
|
+
* @returns Record mapping property name → array of { value, label } options
|
|
817
|
+
*/
|
|
818
|
+
getNamedOptions(className: string): Promise<Record<string, Array<{
|
|
819
|
+
value: string;
|
|
820
|
+
label?: string;
|
|
821
|
+
}>>>;
|
|
822
|
+
/**
|
|
823
|
+
* Adds a named option (sh:in value) to a property of a registered class.
|
|
824
|
+
* This appends to the existing sh:in list stored on the property shape.
|
|
825
|
+
*
|
|
826
|
+
* @param className - The registered class name
|
|
827
|
+
* @param propertyName - The property to add the option to
|
|
828
|
+
* @param value - The RDF value for the option
|
|
829
|
+
* @param label - Optional human-readable label
|
|
830
|
+
*/
|
|
831
|
+
addNamedOption(className: string, propertyName: string, value: string, label?: string): Promise<void>;
|
|
811
832
|
getNeighbourhoodProxy(): NeighbourhoodProxy;
|
|
812
833
|
/**
|
|
813
834
|
* Returns a proxy object for working with AI capabilities.
|