@coasys/ad4m 0.12.0-rc1-dev.5 → 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 +4968 -4805
- package/lib/index.js +4936 -4801
- 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 -812
- package/lib/src/model/Ad4mModel.js +78 -2390
- package/lib/src/model/ModelQueryBuilder.d.ts +370 -0
- package/lib/src/model/ModelQueryBuilder.js +556 -0
- package/lib/src/model/decorators.d.ts +2 -20
- package/lib/src/model/decorators.js +5 -410
- 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/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 +1 -1
- 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/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 +1084 -3818
- package/src/model/ModelQueryBuilder.ts +617 -0
- package/src/model/Subject.ts +1 -1
- package/src/model/decorators.ts +17 -475
- 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 +0 -1
- package/src/model/sdna.ts +170 -0
- package/src/model/shacl-gen.ts +292 -0
- package/src/model/surreal-utils.ts +1 -1
- 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/lib/src/Ad4mClient.test.d.ts +0 -1
- 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
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations } from "../links/Links";
|
|
2
|
-
import { LinkQuery } from "./LinkQuery";
|
|
3
|
-
import { Perspective } from "./Perspective";
|
|
4
|
-
import { LinkStatus } from "./PerspectiveProxy";
|
|
5
|
-
import { PerspectiveHandle, PerspectiveState } from "./PerspectiveHandle";
|
|
6
|
-
export declare const testLink: LinkExpression;
|
|
7
|
-
export declare const PERSPECTIVE_QUERY_SUBSCRIPTION = "PERSPECTIVE_QUERY_SUBSCRIPTION";
|
|
8
|
-
export declare class QuerySubscription {
|
|
9
|
-
subscriptionId: string;
|
|
10
|
-
result: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Resolver classes are used here to define the GraphQL schema
|
|
14
|
-
* (through the type-graphql annotations)
|
|
15
|
-
* and are spawned in the client tests in Ad4mClient.test.ts.
|
|
16
|
-
* For the latter, they return test fixtures.
|
|
17
|
-
*/
|
|
18
|
-
export default class PerspectiveResolver {
|
|
19
|
-
perspectives(): PerspectiveHandle[];
|
|
20
|
-
perspective(uuid: string): PerspectiveHandle | null;
|
|
21
|
-
perspectiveSnapshot(uuid: string): Perspective | null;
|
|
22
|
-
perspectivePublishSnapshot(uuid: string): String | null;
|
|
23
|
-
perspectiveQueryLinks(uuid: string, query: LinkQuery): LinkExpression[];
|
|
24
|
-
perspectiveQueryProlog(uuid: string, query: string): Promise<string>;
|
|
25
|
-
perspectiveQuerySurrealDB(uuid: string, query: string): Promise<string>;
|
|
26
|
-
perspectiveSubscribeQuery(uuid: string, query: string): Promise<QuerySubscription>;
|
|
27
|
-
perspectiveAdd(name: string, pubSub: any): PerspectiveHandle;
|
|
28
|
-
perspectiveUpdate(uuid: string, name: string, pubSub: any): PerspectiveHandle;
|
|
29
|
-
perspectiveRemove(uuid: string, pubSub: any): boolean;
|
|
30
|
-
perspectiveCreateBatch(uuid: string): Promise<string>;
|
|
31
|
-
perspectiveCommitBatch(uuid: string, batchId: string): Promise<LinkExpressionMutations>;
|
|
32
|
-
perspectiveAddLink(uuid: string, link: LinkInput, status: LinkStatus, batchId: string, pubSub: any): LinkExpression;
|
|
33
|
-
perspectiveAddLinks(uuid: string, links: LinkInput[], status: LinkStatus, batchId: string, pubSub: any): LinkExpression[];
|
|
34
|
-
perspectiveRemoveLink(uuid: string, link: LinkExpressionInput, batchId: string, pubSub: any): Boolean;
|
|
35
|
-
perspectiveRemoveLinks(uuid: string, links: LinkExpressionInput[], batchId: string, pubSub: any): LinkExpression[];
|
|
36
|
-
perspectiveLinkMutations(uuid: string, mutations: LinkMutations, status: LinkStatus, pubSub: any): LinkExpressionMutations;
|
|
37
|
-
perspectiveUpdateLink(uuid: string, oldLink: LinkExpressionInput, newLink: LinkInput, batchId: string, pubSub: any): LinkExpression;
|
|
38
|
-
perspectiveAddLinkExpression(uuid: string, link: LinkExpressionInput, status: LinkStatus, batchId: string, pubSub: any): LinkExpression;
|
|
39
|
-
perspectiveAddSdna(uuid: string, name: string, sdnaCode: string, sdnaType: string, shaclJson: string, pubSub: any): Boolean;
|
|
40
|
-
perspectiveExecuteCommands(uuid: string, commands: string, expression: string, parameters: string, batchId?: string): Boolean;
|
|
41
|
-
perspectiveCreateSubject(uuid: string, SubjectClass: string, expressionAddress: string, initialValues?: string, batchId?: string): Boolean;
|
|
42
|
-
perspectiveGetSubjectData(uuid: string, SubjectClass: string, expressionAddress: string): String;
|
|
43
|
-
perspectiveAdded(): PerspectiveHandle;
|
|
44
|
-
perspectiveUpdated(): PerspectiveHandle;
|
|
45
|
-
perspectiveRemoved(): string;
|
|
46
|
-
perspectiveLinkAdded(uuid: string): LinkExpression;
|
|
47
|
-
perspectiveLinkRemoved(uuid: string): LinkExpression;
|
|
48
|
-
perspectiveLinkUpdated(uuid: string): LinkExpressionUpdated;
|
|
49
|
-
perspectiveSyncStateChange(uuid: string): PerspectiveState;
|
|
50
|
-
perspectiveKeepAliveQuery(uuid: string, subscriptionId: string): boolean;
|
|
51
|
-
perspectiveQuerySubscription(subscriptionId: string, payload: {
|
|
52
|
-
subscriptionId: string;
|
|
53
|
-
uuid: string;
|
|
54
|
-
result: string;
|
|
55
|
-
}): string;
|
|
56
|
-
perspectiveDisposeQuerySubscription(uuid: string, subscriptionId: string): Promise<boolean>;
|
|
57
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ApolloClient } from "@apollo/client/core";
|
|
2
|
-
import { Perspective, PerspectiveExpression } from "../perspectives/Perspective";
|
|
3
|
-
import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult, UserStatistics } from "./RuntimeResolver";
|
|
4
|
-
export type MessageCallback = (message: PerspectiveExpression) => null;
|
|
5
|
-
export type ExceptionCallback = (info: ExceptionInfo) => null;
|
|
6
|
-
export type NotificationTriggeredCallback = (notification: TriggeredNotification) => null;
|
|
7
|
-
export type NotificationRequestedCallback = (notification: Notification) => null;
|
|
8
|
-
export declare class RuntimeClient {
|
|
9
|
-
#private;
|
|
10
|
-
constructor(client: ApolloClient<any>, subscribe?: boolean);
|
|
11
|
-
info(): Promise<RuntimeInfo>;
|
|
12
|
-
quit(): Promise<Boolean>;
|
|
13
|
-
openLink(url: string): Promise<Boolean>;
|
|
14
|
-
addTrustedAgents(agents: string[]): Promise<string[]>;
|
|
15
|
-
deleteTrustedAgents(agents: string[]): Promise<string[]>;
|
|
16
|
-
getTrustedAgents(): Promise<string[]>;
|
|
17
|
-
addKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]>;
|
|
18
|
-
removeKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]>;
|
|
19
|
-
knownLinkLanguageTemplates(): Promise<string[]>;
|
|
20
|
-
addFriends(dids: string[]): Promise<string[]>;
|
|
21
|
-
removeFriends(dids: string[]): Promise<string[]>;
|
|
22
|
-
friends(): Promise<string[]>;
|
|
23
|
-
hcAgentInfos(): Promise<string>;
|
|
24
|
-
getNetworkMetrics(): Promise<string>;
|
|
25
|
-
restartHolochain(): Promise<boolean>;
|
|
26
|
-
hcAddAgentInfos(agentInfos: String): Promise<void>;
|
|
27
|
-
verifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): Promise<boolean>;
|
|
28
|
-
setStatus(perspective: Perspective): Promise<boolean>;
|
|
29
|
-
friendStatus(did: string): Promise<PerspectiveExpression>;
|
|
30
|
-
friendSendMessage(did: string, message: Perspective): Promise<boolean>;
|
|
31
|
-
messageInbox(filter?: string): Promise<PerspectiveExpression[]>;
|
|
32
|
-
messageOutbox(filter?: string): Promise<SentMessage[]>;
|
|
33
|
-
requestInstallNotification(notification: NotificationInput): Promise<any>;
|
|
34
|
-
grantNotification(id: string): Promise<boolean>;
|
|
35
|
-
exportDb(filePath: string): Promise<boolean>;
|
|
36
|
-
importDb(filePath: string): Promise<ImportResult>;
|
|
37
|
-
notifications(): Promise<Notification[]>;
|
|
38
|
-
updateNotification(id: string, notification: NotificationInput): Promise<boolean>;
|
|
39
|
-
removeNotification(id: string): Promise<boolean>;
|
|
40
|
-
exportPerspective(uuid: string, filePath: string): Promise<boolean>;
|
|
41
|
-
importPerspective(filePath: string): Promise<boolean>;
|
|
42
|
-
multiUserEnabled(): Promise<boolean>;
|
|
43
|
-
setMultiUserEnabled(enabled: boolean): Promise<boolean>;
|
|
44
|
-
listUsers(): Promise<UserStatistics[]>;
|
|
45
|
-
emailTestModeEnable(): Promise<boolean>;
|
|
46
|
-
emailTestModeDisable(): Promise<boolean>;
|
|
47
|
-
emailTestGetCode(email: string): Promise<string | null>;
|
|
48
|
-
emailTestClearCodes(): Promise<boolean>;
|
|
49
|
-
emailTestSetExpiry(email: string, verificationType: string, expiresAt: number): Promise<boolean>;
|
|
50
|
-
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback): void;
|
|
51
|
-
subscribeNotificationTriggered(): void;
|
|
52
|
-
addMessageCallback(cb: MessageCallback): void;
|
|
53
|
-
subscribeMessageReceived(): void;
|
|
54
|
-
addExceptionCallback(cb: ExceptionCallback): void;
|
|
55
|
-
subscribeExceptionOccurred(): void;
|
|
56
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { Perspective, PerspectiveExpression, PerspectiveInput } from "../perspectives/Perspective";
|
|
2
|
-
import { ExceptionType } from "../Exception";
|
|
3
|
-
import { UserCreationResult, AuthInfoInput } from "../agent/Agent";
|
|
4
|
-
export declare class SentMessage {
|
|
5
|
-
recipient: string;
|
|
6
|
-
message: PerspectiveExpression;
|
|
7
|
-
}
|
|
8
|
-
export declare class RuntimeInfo {
|
|
9
|
-
ad4mExecutorVersion: string;
|
|
10
|
-
isInitialized: Boolean;
|
|
11
|
-
isUnlocked: Boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class ExceptionInfo {
|
|
14
|
-
title: string;
|
|
15
|
-
message: string;
|
|
16
|
-
type: ExceptionType;
|
|
17
|
-
addon?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare class NotificationInput {
|
|
20
|
-
description: string;
|
|
21
|
-
appName: string;
|
|
22
|
-
appUrl: string;
|
|
23
|
-
appIconPath: string;
|
|
24
|
-
trigger: string;
|
|
25
|
-
perspectiveIds: string[];
|
|
26
|
-
webhookUrl: string;
|
|
27
|
-
webhookAuth: string;
|
|
28
|
-
}
|
|
29
|
-
export declare class Notification {
|
|
30
|
-
id: string;
|
|
31
|
-
granted: boolean;
|
|
32
|
-
description: string;
|
|
33
|
-
appName: string;
|
|
34
|
-
appUrl: string;
|
|
35
|
-
appIconPath: string;
|
|
36
|
-
trigger: string;
|
|
37
|
-
perspectiveIds: string[];
|
|
38
|
-
webhookUrl: string;
|
|
39
|
-
webhookAuth: string;
|
|
40
|
-
}
|
|
41
|
-
export declare class TriggeredNotification {
|
|
42
|
-
notification: Notification;
|
|
43
|
-
perspectiveId: string;
|
|
44
|
-
triggerMatch: string;
|
|
45
|
-
}
|
|
46
|
-
export declare class ImportStats {
|
|
47
|
-
total: number;
|
|
48
|
-
imported: number;
|
|
49
|
-
failed: number;
|
|
50
|
-
omitted: number;
|
|
51
|
-
errors: string[];
|
|
52
|
-
}
|
|
53
|
-
export declare class ImportResult {
|
|
54
|
-
perspectives: ImportStats;
|
|
55
|
-
links: ImportStats;
|
|
56
|
-
expressions: ImportStats;
|
|
57
|
-
perspectiveDiffs: ImportStats;
|
|
58
|
-
notifications: ImportStats;
|
|
59
|
-
models: ImportStats;
|
|
60
|
-
defaultModels: ImportStats;
|
|
61
|
-
tasks: ImportStats;
|
|
62
|
-
friends: ImportStats;
|
|
63
|
-
trustedAgents: ImportStats;
|
|
64
|
-
knownLinkLanguages: ImportStats;
|
|
65
|
-
}
|
|
66
|
-
export declare class UserStatistics {
|
|
67
|
-
email: string;
|
|
68
|
-
did: string;
|
|
69
|
-
lastSeen?: string;
|
|
70
|
-
perspectiveCount: number;
|
|
71
|
-
}
|
|
72
|
-
export declare class VerificationRequestResult {
|
|
73
|
-
success: boolean;
|
|
74
|
-
message: string;
|
|
75
|
-
requiresPassword: boolean;
|
|
76
|
-
isExistingUser: boolean;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Resolver classes are used here to define the GraphQL schema
|
|
80
|
-
* (through the type-graphql annotations)
|
|
81
|
-
* and are spawned in the client tests in Ad4mClient.test.ts.
|
|
82
|
-
* For the latter, they return test fixtures.
|
|
83
|
-
*/
|
|
84
|
-
export default class RuntimeResolver {
|
|
85
|
-
runtimeQuit(): Boolean;
|
|
86
|
-
runtimeOpenLink(url: string): Boolean;
|
|
87
|
-
runtimeInfo(): RuntimeInfo;
|
|
88
|
-
addTrustedAgents(agents: string[]): string[];
|
|
89
|
-
deleteTrustedAgents(agents: string[]): string[];
|
|
90
|
-
getTrustedAgents(): string[];
|
|
91
|
-
runtimeKnownLinkLanguageTemplates(): string[];
|
|
92
|
-
runtimeAddKnownLinkLanguageTemplates(addresses: string[]): string[];
|
|
93
|
-
runtimeRemoveKnownLinkLanguageTemplates(addresses: string[]): string[];
|
|
94
|
-
runtimeFriends(): string[];
|
|
95
|
-
runtimeAddFriends(dids: string[]): string[];
|
|
96
|
-
runtimeRemoveFriends(dids: string[]): string[];
|
|
97
|
-
runtimeHcAgentInfos(): string;
|
|
98
|
-
runtimeGetNetworkMetrics(): string;
|
|
99
|
-
runtimeRestartHolochain(): boolean;
|
|
100
|
-
runtimeHcAddAgentInfos(agentInfos: any): boolean;
|
|
101
|
-
runtimeVerifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): boolean;
|
|
102
|
-
runtimeSetStatus(status: Perspective): boolean;
|
|
103
|
-
runtimeFriendStatus(did: string): PerspectiveExpression;
|
|
104
|
-
runtimeFriendSendMessage(did: string, message: PerspectiveInput): boolean;
|
|
105
|
-
runtimeMessageInbox(filter?: string): PerspectiveExpression[];
|
|
106
|
-
runtimeMessageOutbox(filter?: string): SentMessage[];
|
|
107
|
-
runtimeMessageReceived(): PerspectiveExpression;
|
|
108
|
-
exceptionOccurred(): ExceptionInfo;
|
|
109
|
-
runtimeRequestInstallNotification(notification: NotificationInput): string;
|
|
110
|
-
runtimeNotifications(): Notification[];
|
|
111
|
-
runtimeUpdateNotification(id: string, notification: NotificationInput): boolean;
|
|
112
|
-
runtimeRemoveNotification(id: string): boolean;
|
|
113
|
-
runtimeGrantNotification(id: string): boolean;
|
|
114
|
-
runtimeNotificationTriggered(): TriggeredNotification;
|
|
115
|
-
runtimeExportDb(filePath: string): boolean;
|
|
116
|
-
runtimeImportDb(filePath: string): boolean;
|
|
117
|
-
runtimeExportPerspective(perspectiveUuid: string, filePath: string): boolean;
|
|
118
|
-
runtimeImportPerspective(filePath: string): boolean;
|
|
119
|
-
runtimeMultiUserEnabled(): boolean;
|
|
120
|
-
runtimeSetMultiUserEnabled(enabled: boolean): boolean;
|
|
121
|
-
runtimeListUsers(): UserStatistics[];
|
|
122
|
-
runtimeRequestLoginVerification(email: string, appInfo?: AuthInfoInput): VerificationRequestResult;
|
|
123
|
-
runtimeVerifyEmailCode(email: string, code: string, verificationType: string): string;
|
|
124
|
-
runtimeTestEmail(to: string): boolean;
|
|
125
|
-
runtimeCreateUser(email: string, password: string, appInfo?: AuthInfoInput): UserCreationResult;
|
|
126
|
-
runtimeLoginUser(email: string, password: string): string;
|
|
127
|
-
runtimeEmailTestModeEnable(): boolean;
|
|
128
|
-
runtimeEmailTestModeDisable(): boolean;
|
|
129
|
-
runtimeEmailTestGetCode(email: string): string | null;
|
|
130
|
-
runtimeEmailTestClearCodes(): boolean;
|
|
131
|
-
runtimeEmailTestSetExpiry(email: string, verificationType: string, expiresAt: number): boolean;
|
|
132
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Link } from "../links/Links";
|
|
2
|
-
import { AD4MAction } from "./SHACLShape";
|
|
3
|
-
export { AD4MAction };
|
|
4
|
-
/**
|
|
5
|
-
* Link pattern for state detection
|
|
6
|
-
* Used to check if an expression is in a particular state
|
|
7
|
-
*/
|
|
8
|
-
export interface LinkPattern {
|
|
9
|
-
/** Optional source pattern (if omitted, uses the expression address) */
|
|
10
|
-
source?: string;
|
|
11
|
-
/** Required predicate to match */
|
|
12
|
-
predicate: string;
|
|
13
|
-
/** Required target value to match */
|
|
14
|
-
target: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Flow State definition
|
|
18
|
-
* Represents a single state in the flow state machine
|
|
19
|
-
*/
|
|
20
|
-
export interface FlowState {
|
|
21
|
-
/** State name (e.g., "ready", "doing", "done") */
|
|
22
|
-
name: string;
|
|
23
|
-
/** Numeric state value for ordering (e.g., 0, 0.5, 1) */
|
|
24
|
-
value: number;
|
|
25
|
-
/** Link pattern that indicates this state */
|
|
26
|
-
stateCheck: LinkPattern;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Flow Transition definition
|
|
30
|
-
* Represents a transition between two states
|
|
31
|
-
*/
|
|
32
|
-
export interface FlowTransition {
|
|
33
|
-
/** Name of this action (shown to users, e.g., "Start", "Finish") */
|
|
34
|
-
actionName: string;
|
|
35
|
-
/** State to transition from */
|
|
36
|
-
fromState: string;
|
|
37
|
-
/** State to transition to */
|
|
38
|
-
toState: string;
|
|
39
|
-
/** Actions to execute for this transition */
|
|
40
|
-
actions: AD4MAction[];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Flowable condition - determines which expressions can enter this flow
|
|
44
|
-
* "any" means all expressions can start this flow
|
|
45
|
-
* Otherwise, a link pattern to check
|
|
46
|
-
*/
|
|
47
|
-
export type FlowableCondition = "any" | LinkPattern;
|
|
48
|
-
/**
|
|
49
|
-
* SHACL Flow - represents a state machine for AD4M expressions
|
|
50
|
-
*
|
|
51
|
-
* Flows define:
|
|
52
|
-
* - Which expressions can enter the flow (flowable condition)
|
|
53
|
-
* - What states exist and how to detect them (via link patterns)
|
|
54
|
-
* - How to transition between states (via actions)
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* const todoFlow = new SHACLFlow('todo://TODO', 'todo://');
|
|
59
|
-
*
|
|
60
|
-
* // Any expression can become a TODO
|
|
61
|
-
* todoFlow.flowable = 'any';
|
|
62
|
-
*
|
|
63
|
-
* // Define states
|
|
64
|
-
* todoFlow.addState({
|
|
65
|
-
* name: 'ready',
|
|
66
|
-
* value: 0,
|
|
67
|
-
* stateCheck: { predicate: 'todo://state', target: 'todo://ready' }
|
|
68
|
-
* });
|
|
69
|
-
* todoFlow.addState({
|
|
70
|
-
* name: 'doing',
|
|
71
|
-
* value: 0.5,
|
|
72
|
-
* stateCheck: { predicate: 'todo://state', target: 'todo://doing' }
|
|
73
|
-
* });
|
|
74
|
-
* todoFlow.addState({
|
|
75
|
-
* name: 'done',
|
|
76
|
-
* value: 1,
|
|
77
|
-
* stateCheck: { predicate: 'todo://state', target: 'todo://done' }
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* // Define start action
|
|
81
|
-
* todoFlow.startAction = [{
|
|
82
|
-
* action: 'addLink',
|
|
83
|
-
* source: 'this',
|
|
84
|
-
* predicate: 'todo://state',
|
|
85
|
-
* target: 'todo://ready'
|
|
86
|
-
* }];
|
|
87
|
-
*
|
|
88
|
-
* // Define transitions
|
|
89
|
-
* todoFlow.addTransition({
|
|
90
|
-
* actionName: 'Start',
|
|
91
|
-
* fromState: 'ready',
|
|
92
|
-
* toState: 'doing',
|
|
93
|
-
* actions: [
|
|
94
|
-
* { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://doing' },
|
|
95
|
-
* { action: 'removeLink', source: 'this', predicate: 'todo://state', target: 'todo://ready' }
|
|
96
|
-
* ]
|
|
97
|
-
* });
|
|
98
|
-
*
|
|
99
|
-
* // Store in perspective
|
|
100
|
-
* await perspective.addFlow('TODO', todoFlow);
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare class SHACLFlow {
|
|
104
|
-
/** Flow name (e.g., "TODO") */
|
|
105
|
-
name: string;
|
|
106
|
-
/** Namespace for generated URIs */
|
|
107
|
-
namespace: string;
|
|
108
|
-
/** Condition for which expressions can start this flow */
|
|
109
|
-
flowable: FlowableCondition;
|
|
110
|
-
/** Actions to execute when starting the flow */
|
|
111
|
-
startAction: AD4MAction[];
|
|
112
|
-
/** States in this flow */
|
|
113
|
-
private _states;
|
|
114
|
-
/** Transitions between states */
|
|
115
|
-
private _transitions;
|
|
116
|
-
/**
|
|
117
|
-
* Create a new SHACL Flow
|
|
118
|
-
* @param name - Flow name (e.g., "TODO")
|
|
119
|
-
* @param namespace - Namespace for URIs (e.g., "todo://")
|
|
120
|
-
*/
|
|
121
|
-
constructor(name: string, namespace: string);
|
|
122
|
-
/** Get all states */
|
|
123
|
-
get states(): FlowState[];
|
|
124
|
-
/** Get all transitions */
|
|
125
|
-
get transitions(): FlowTransition[];
|
|
126
|
-
/**
|
|
127
|
-
* Add a state to the flow
|
|
128
|
-
* @param state - State definition
|
|
129
|
-
*/
|
|
130
|
-
addState(state: FlowState): void;
|
|
131
|
-
/**
|
|
132
|
-
* Add a transition to the flow
|
|
133
|
-
* @param transition - Transition definition
|
|
134
|
-
*/
|
|
135
|
-
addTransition(transition: FlowTransition): void;
|
|
136
|
-
/**
|
|
137
|
-
* Get the flow shape URI
|
|
138
|
-
*/
|
|
139
|
-
get flowUri(): string;
|
|
140
|
-
/**
|
|
141
|
-
* Get a state URI
|
|
142
|
-
*/
|
|
143
|
-
stateUri(stateName: string): string;
|
|
144
|
-
/**
|
|
145
|
-
* Get a transition URI
|
|
146
|
-
*/
|
|
147
|
-
transitionUri(fromState: string, toState: string): string;
|
|
148
|
-
/**
|
|
149
|
-
* Serialize the flow to AD4M links
|
|
150
|
-
* These links can be stored in a perspective and queried via SurrealDB
|
|
151
|
-
*
|
|
152
|
-
* @returns Array of Link objects representing the flow
|
|
153
|
-
*/
|
|
154
|
-
toLinks(): Link[];
|
|
155
|
-
/**
|
|
156
|
-
* Reconstruct a SHACLFlow from links
|
|
157
|
-
*
|
|
158
|
-
* @param links - Array of links containing the flow definition
|
|
159
|
-
* @param flowUri - The URI of the flow to reconstruct
|
|
160
|
-
* @returns Reconstructed SHACLFlow
|
|
161
|
-
*/
|
|
162
|
-
static fromLinks(links: Link[], flowUri: string): SHACLFlow;
|
|
163
|
-
/**
|
|
164
|
-
* Convert to JSON representation
|
|
165
|
-
*/
|
|
166
|
-
toJSON(): object;
|
|
167
|
-
/**
|
|
168
|
-
* Create from JSON representation
|
|
169
|
-
*/
|
|
170
|
-
static fromJSON(json: any): SHACLFlow;
|
|
171
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { Link } from "../links/Links";
|
|
2
|
-
/**
|
|
3
|
-
* AD4M Action - represents a link operation
|
|
4
|
-
*/
|
|
5
|
-
export interface AD4MAction {
|
|
6
|
-
action: string;
|
|
7
|
-
source: string;
|
|
8
|
-
predicate: string;
|
|
9
|
-
target: string;
|
|
10
|
-
local?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* SHACL Property Shape
|
|
14
|
-
* Represents constraints on a single property path
|
|
15
|
-
*/
|
|
16
|
-
export interface SHACLPropertyShape {
|
|
17
|
-
/** Property name (e.g., "name", "ingredients") - used for generating named URIs */
|
|
18
|
-
name?: string;
|
|
19
|
-
/** The property path (predicate URI) */
|
|
20
|
-
path: string;
|
|
21
|
-
/** Expected datatype (e.g., xsd:string, xsd:integer) */
|
|
22
|
-
datatype?: string;
|
|
23
|
-
/** Node kind constraint (IRI, Literal, BlankNode) */
|
|
24
|
-
nodeKind?: 'IRI' | 'Literal' | 'BlankNode';
|
|
25
|
-
/** Minimum cardinality (required if >= 1) */
|
|
26
|
-
minCount?: number;
|
|
27
|
-
/** Maximum cardinality (single-valued if 1, omit for collections) */
|
|
28
|
-
maxCount?: number;
|
|
29
|
-
/** Regex pattern for string validation */
|
|
30
|
-
pattern?: string;
|
|
31
|
-
/** Minimum value (inclusive) for numeric properties */
|
|
32
|
-
minInclusive?: number;
|
|
33
|
-
/** Maximum value (inclusive) for numeric properties */
|
|
34
|
-
maxInclusive?: number;
|
|
35
|
-
/** Fixed value constraint (for Flag properties) */
|
|
36
|
-
hasValue?: string;
|
|
37
|
-
/** AD4M-specific: Local-only property */
|
|
38
|
-
local?: boolean;
|
|
39
|
-
/** AD4M-specific: Writable property */
|
|
40
|
-
writable?: boolean;
|
|
41
|
-
/** AD4M-specific: Language to resolve property values through */
|
|
42
|
-
resolveLanguage?: string;
|
|
43
|
-
/** AD4M-specific: Setter action for this property */
|
|
44
|
-
setter?: AD4MAction[];
|
|
45
|
-
/** AD4M-specific: Adder action for collection properties */
|
|
46
|
-
adder?: AD4MAction[];
|
|
47
|
-
/** AD4M-specific: Remover action for collection properties */
|
|
48
|
-
remover?: AD4MAction[];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* SHACL Node Shape
|
|
52
|
-
* Defines constraints for instances of a class
|
|
53
|
-
*/
|
|
54
|
-
export declare class SHACLShape {
|
|
55
|
-
/** URI of this shape (e.g., recipe:RecipeShape) */
|
|
56
|
-
nodeShapeUri: string;
|
|
57
|
-
/** Target class this shape applies to (e.g., recipe:Recipe) */
|
|
58
|
-
targetClass?: string;
|
|
59
|
-
/** Property constraints */
|
|
60
|
-
properties: SHACLPropertyShape[];
|
|
61
|
-
/** AD4M-specific: Constructor actions for creating instances */
|
|
62
|
-
constructor_actions?: AD4MAction[];
|
|
63
|
-
/** AD4M-specific: Destructor actions for removing instances */
|
|
64
|
-
destructor_actions?: AD4MAction[];
|
|
65
|
-
/** Parent shape URIs for model inheritance (sh:node references) */
|
|
66
|
-
parentShapes: string[];
|
|
67
|
-
/**
|
|
68
|
-
* Create a new SHACL Shape
|
|
69
|
-
* @param targetClassOrShapeUri - If one argument: the target class (shape URI auto-derived as {class}Shape)
|
|
70
|
-
* If two arguments: first is shape URI, second is target class
|
|
71
|
-
* @param targetClass - Optional target class when first arg is shape URI
|
|
72
|
-
*/
|
|
73
|
-
constructor(targetClassOrShapeUri: string, targetClass?: string);
|
|
74
|
-
/**
|
|
75
|
-
* Add a parent shape reference (sh:node) for model inheritance.
|
|
76
|
-
* When a @Model class extends another @Model, the child shape
|
|
77
|
-
* references the parent shape so SHACL validators can walk the
|
|
78
|
-
* class hierarchy.
|
|
79
|
-
*/
|
|
80
|
-
addParentShape(parentShapeUri: string): void;
|
|
81
|
-
/**
|
|
82
|
-
* Add a property constraint to this shape
|
|
83
|
-
*/
|
|
84
|
-
addProperty(prop: SHACLPropertyShape): void;
|
|
85
|
-
/**
|
|
86
|
-
* Set constructor actions for this shape
|
|
87
|
-
*/
|
|
88
|
-
setConstructorActions(actions: AD4MAction[]): void;
|
|
89
|
-
/**
|
|
90
|
-
* Set destructor actions for this shape
|
|
91
|
-
*/
|
|
92
|
-
setDestructorActions(actions: AD4MAction[]): void;
|
|
93
|
-
/**
|
|
94
|
-
* Serialize shape to Turtle (RDF) format
|
|
95
|
-
*/
|
|
96
|
-
toTurtle(): string;
|
|
97
|
-
/**
|
|
98
|
-
* Serialize shape to AD4M Links (RDF triples)
|
|
99
|
-
* Stores the shape as a graph of links in a Perspective
|
|
100
|
-
*/
|
|
101
|
-
toLinks(): Link[];
|
|
102
|
-
/**
|
|
103
|
-
* Reconstruct shape from AD4M Links
|
|
104
|
-
*/
|
|
105
|
-
static fromLinks(links: Link[], shapeUri: string): SHACLShape;
|
|
106
|
-
/**
|
|
107
|
-
* Convert the shape to a JSON-serializable object.
|
|
108
|
-
* Useful for passing to addSdna() as shaclJson parameter.
|
|
109
|
-
*
|
|
110
|
-
* @returns JSON-serializable object representing the shape
|
|
111
|
-
*/
|
|
112
|
-
toJSON(): object;
|
|
113
|
-
/**
|
|
114
|
-
* Create a shape from a JSON object (inverse of toJSON)
|
|
115
|
-
*/
|
|
116
|
-
static fromJSON(json: any): SHACLShape;
|
|
117
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const typeDefsString = "";
|
package/lib/src/src/utils.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare function formatList(list: any): any;
|
|
2
|
-
export declare function capSentence(cap: any): string;
|
|
3
|
-
/**
|
|
4
|
-
* Escapes a string value for safe use in SurrealQL queries.
|
|
5
|
-
*
|
|
6
|
-
* @description
|
|
7
|
-
* Prevents SQL injection by properly escaping special characters in string values
|
|
8
|
-
* that will be interpolated into SurrealQL queries. This handles the most common
|
|
9
|
-
* special characters that could break SQL queries or enable injection attacks.
|
|
10
|
-
*
|
|
11
|
-
* Single quotes, backslashes, and other special characters are escaped using
|
|
12
|
-
* backslash notation, which is the standard escaping mechanism for SurrealQL.
|
|
13
|
-
*
|
|
14
|
-
* @param value - The string value to escape
|
|
15
|
-
* @returns The escaped string safe for SurrealQL interpolation (without surrounding quotes)
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const userInput = "user's input with 'quotes'";
|
|
20
|
-
* const escaped = escapeSurrealString(userInput);
|
|
21
|
-
* const query = `SELECT * FROM link WHERE uri = '${escaped}'`;
|
|
22
|
-
* // Results in: SELECT * FROM link WHERE uri = 'user\'s input with \'quotes\''
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function escapeSurrealString(value: string): string;
|