@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.
Files changed (166) hide show
  1. package/lib/index.cjs +5052 -4446
  2. package/lib/index.js +5019 -4442
  3. package/lib/src/agent/AgentClient.d.ts +4 -0
  4. package/lib/src/agent/AgentClient.js +34 -0
  5. package/lib/src/index.d.ts +2 -3
  6. package/lib/src/index.js +2 -3
  7. package/lib/src/model/Ad4mModel.d.ts +8 -782
  8. package/lib/src/model/Ad4mModel.js +160 -2354
  9. package/lib/src/model/ModelQueryBuilder.d.ts +370 -0
  10. package/lib/src/model/ModelQueryBuilder.js +556 -0
  11. package/lib/src/model/decorators.d.ts +71 -23
  12. package/lib/src/model/decorators.js +133 -384
  13. package/lib/src/model/hydration.d.ts +102 -0
  14. package/lib/src/model/hydration.js +709 -0
  15. package/lib/src/model/index.d.ts +20 -0
  16. package/lib/src/model/index.js +20 -0
  17. package/lib/src/model/{schema/fromJSONSchema.d.ts → json-schema.d.ts} +45 -12
  18. package/lib/src/model/json-schema.js +326 -0
  19. package/lib/src/model/prolog-facts.d.ts +37 -0
  20. package/lib/src/model/{prolog/generatePrologFacts.js → prolog-facts.js} +47 -52
  21. package/lib/src/model/query-common.d.ts +14 -0
  22. package/lib/src/model/query-common.js +36 -0
  23. package/lib/src/model/query-prolog.d.ts +15 -0
  24. package/lib/src/model/query-prolog.js +140 -0
  25. package/lib/src/model/query-surreal.d.ts +44 -0
  26. package/lib/src/model/query-surreal.js +249 -0
  27. package/lib/src/model/relation-filtering.test.js +838 -0
  28. package/lib/src/model/sdna.d.ts +14 -0
  29. package/lib/src/model/sdna.js +141 -0
  30. package/lib/src/model/shacl-gen.d.ts +31 -0
  31. package/lib/src/model/shacl-gen.js +246 -0
  32. package/lib/src/model/surreal-utils.d.ts +42 -0
  33. package/lib/src/model/surreal-utils.js +128 -0
  34. package/lib/src/model/types.d.ts +75 -96
  35. package/lib/src/model/types.js +4 -4
  36. package/lib/src/model/util.d.ts +4 -5
  37. package/lib/src/model/util.js +12 -32
  38. package/lib/src/perspectives/PerspectiveClient.d.ts +1 -1
  39. package/lib/src/perspectives/PerspectiveProxy.d.ts +1 -1
  40. package/lib/src/perspectives/WakerSubscriptionManager.d.ts +79 -0
  41. package/lib/src/perspectives/WakerSubscriptionManager.js +196 -0
  42. package/lib/src/runtime/RuntimeResolver.d.ts +14 -0
  43. package/lib/src/runtime/RuntimeResolver.js +73 -0
  44. package/lib/src/schema.gql +14 -0
  45. package/lib/src/shacl/SHACLShape.d.ts +23 -0
  46. package/lib/src/shacl/SHACLShape.js +45 -0
  47. package/lib/src/typeDefs.js +14 -0
  48. package/package.json +13 -8
  49. package/src/agent/AgentClient.ts +45 -0
  50. package/src/index.ts +2 -3
  51. package/src/model/Ad4mModel.ts +1089 -3686
  52. package/src/model/ModelQueryBuilder.ts +617 -0
  53. package/src/model/Subject.ts +1 -1
  54. package/src/model/decorators.ts +218 -453
  55. package/src/model/hydration.ts +796 -0
  56. package/src/model/index.ts +21 -0
  57. package/src/model/json-schema.ts +424 -0
  58. package/src/model/prolog-facts.ts +145 -0
  59. package/src/model/query-common.ts +48 -0
  60. package/src/model/query-prolog.ts +148 -0
  61. package/src/model/query-surreal.ts +280 -0
  62. package/src/model/relation-filtering.test.ts +803 -0
  63. package/src/model/sdna.ts +170 -0
  64. package/src/model/shacl-gen.ts +292 -0
  65. package/src/model/surreal-utils.ts +147 -0
  66. package/src/model/types.ts +182 -0
  67. package/src/model/util.ts +13 -36
  68. package/src/perspectives/PerspectiveClient.ts +1 -1
  69. package/src/perspectives/PerspectiveProxy.ts +1 -1
  70. package/src/perspectives/WakerSubscriptionManager.ts +292 -0
  71. package/src/runtime/RuntimeResolver.ts +53 -0
  72. package/src/shacl/SHACLShape.ts +83 -0
  73. package/lib/src/Ad4mClient.test.js +0 -1204
  74. package/lib/src/Literal.test.d.ts +0 -1
  75. package/lib/src/Literal.test.js +0 -41
  76. package/lib/src/model/mutation.d.ts +0 -81
  77. package/lib/src/model/mutation.js +0 -317
  78. package/lib/src/model/parentUtils.d.ts +0 -32
  79. package/lib/src/model/parentUtils.js +0 -64
  80. package/lib/src/model/prolog/generatePrologFacts.d.ts +0 -36
  81. package/lib/src/model/prolog/index.d.ts +0 -1
  82. package/lib/src/model/prolog/index.js +0 -1
  83. package/lib/src/model/query/ModelQueryBuilder.d.ts +0 -82
  84. package/lib/src/model/query/ModelQueryBuilder.js +0 -115
  85. package/lib/src/model/query/QueryBuilder.d.ts +0 -101
  86. package/lib/src/model/query/QueryBuilder.js +0 -193
  87. package/lib/src/model/query/SurrealQueryBuilder.d.ts +0 -48
  88. package/lib/src/model/query/SurrealQueryBuilder.js +0 -371
  89. package/lib/src/model/query/fetchInstance.d.ts +0 -24
  90. package/lib/src/model/query/fetchInstance.js +0 -144
  91. package/lib/src/model/query/hydration.d.ts +0 -54
  92. package/lib/src/model/query/hydration.js +0 -214
  93. package/lib/src/model/query/operations.d.ts +0 -59
  94. package/lib/src/model/query/operations.js +0 -384
  95. package/lib/src/model/query/snapshot.d.ts +0 -59
  96. package/lib/src/model/query/snapshot.js +0 -106
  97. package/lib/src/model/query/surrealCompiler.d.ts +0 -42
  98. package/lib/src/model/query/surrealCompiler.js +0 -304
  99. package/lib/src/model/schema/fromJSONSchema.js +0 -264
  100. package/lib/src/model/schema/metadata.d.ts +0 -15
  101. package/lib/src/model/schema/metadata.js +0 -112
  102. package/lib/src/model/subscription.d.ts +0 -47
  103. package/lib/src/model/subscription.js +0 -231
  104. package/lib/src/model/transaction.d.ts +0 -27
  105. package/lib/src/model/transaction.js +0 -32
  106. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  107. package/lib/src/shims/type-graphql.d.ts +0 -32
  108. package/lib/src/src/Ad4mClient.d.ts +0 -28
  109. package/lib/src/src/Address.d.ts +0 -1
  110. package/lib/src/src/DID.d.ts +0 -1
  111. package/lib/src/src/Exception.d.ts +0 -7
  112. package/lib/src/src/Literal.d.ts +0 -7
  113. package/lib/src/src/PubSub.d.ts +0 -17
  114. package/lib/src/src/SmartLiteral.d.ts +0 -12
  115. package/lib/src/src/agent/Agent.d.ts +0 -110
  116. package/lib/src/src/agent/AgentClient.d.ts +0 -62
  117. package/lib/src/src/agent/AgentResolver.d.ts +0 -30
  118. package/lib/src/src/agent/AgentStatus.d.ts +0 -8
  119. package/lib/src/src/ai/AIClient.d.ts +0 -32
  120. package/lib/src/src/ai/AIResolver.d.ts +0 -75
  121. package/lib/src/src/ai/Tasks.d.ts +0 -37
  122. package/lib/src/src/buildSchema.d.ts +0 -1
  123. package/lib/src/src/expression/Expression.d.ts +0 -28
  124. package/lib/src/src/expression/ExpressionClient.d.ts +0 -13
  125. package/lib/src/src/expression/ExpressionRef.d.ts +0 -9
  126. package/lib/src/src/expression/ExpressionResolver.d.ts +0 -10
  127. package/lib/src/src/index.d.ts +0 -35
  128. package/lib/src/src/jestSetup.d.ts +0 -1
  129. package/lib/src/src/language/Icon.d.ts +0 -4
  130. package/lib/src/src/language/Language.d.ts +0 -206
  131. package/lib/src/src/language/LanguageClient.d.ts +0 -17
  132. package/lib/src/src/language/LanguageContext.d.ts +0 -37
  133. package/lib/src/src/language/LanguageHandle.d.ts +0 -9
  134. package/lib/src/src/language/LanguageMeta.d.ts +0 -35
  135. package/lib/src/src/language/LanguageRef.d.ts +0 -6
  136. package/lib/src/src/language/LanguageResolver.d.ts +0 -19
  137. package/lib/src/src/links/Links.d.ts +0 -39
  138. package/lib/src/src/links/Links.test.d.ts +0 -1
  139. package/lib/src/src/model/Ad4mModel.d.ts +0 -1438
  140. package/lib/src/src/model/Ad4mModel.test.d.ts +0 -1
  141. package/lib/src/src/model/Subject.d.ts +0 -25
  142. package/lib/src/src/model/decorators.d.ts +0 -545
  143. package/lib/src/src/model/util.d.ts +0 -12
  144. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +0 -10
  145. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +0 -25
  146. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +0 -19
  147. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +0 -1
  148. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +0 -24
  149. package/lib/src/src/perspectives/LinkQuery.d.ts +0 -11
  150. package/lib/src/src/perspectives/Perspective.d.ts +0 -38
  151. package/lib/src/src/perspectives/Perspective.test.d.ts +0 -1
  152. package/lib/src/src/perspectives/PerspectiveClient.d.ts +0 -97
  153. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +0 -9
  154. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +0 -18
  155. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +0 -865
  156. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +0 -57
  157. package/lib/src/src/runtime/RuntimeClient.d.ts +0 -56
  158. package/lib/src/src/runtime/RuntimeResolver.d.ts +0 -132
  159. package/lib/src/src/shacl/SHACLFlow.d.ts +0 -171
  160. package/lib/src/src/shacl/SHACLFlow.test.d.ts +0 -1
  161. package/lib/src/src/shacl/SHACLShape.d.ts +0 -117
  162. package/lib/src/src/shacl/SHACLShape.test.d.ts +0 -1
  163. package/lib/src/src/typeDefs.d.ts +0 -1
  164. package/lib/src/src/unwrapApolloResult.d.ts +0 -2
  165. package/lib/src/src/utils.d.ts +0 -25
  166. /package/lib/src/{Ad4mClient.test.d.ts → model/relation-filtering.test.d.ts} +0 -0
@@ -1,27 +0,0 @@
1
- /** Atomic batch-transaction helper — see {@link runTransaction}. */
2
- import type { PerspectiveProxy } from "../perspectives/PerspectiveProxy";
3
- /**
4
- * An open batch transaction on a perspective.
5
- *
6
- * Obtained from the callback argument of {@link runTransaction}. Pass
7
- * `tx.batchId` to `save()`, `delete()` etc. to enlist those operations in the
8
- * transaction. Commit and abort are handled automatically by `runTransaction`.
9
- */
10
- export interface TransactionContext {
11
- /** The underlying batch ID — pass to save/delete/add/remove calls. */
12
- readonly batchId: string;
13
- /** The perspective this transaction is open on. */
14
- readonly perspective: PerspectiveProxy;
15
- }
16
- /**
17
- * Commits on success, aborts (discards batch) and re-throws on failure.
18
- *
19
- * @example
20
- * ```typescript
21
- * await Ad4mModel.transaction(perspective, async (tx) => {
22
- * await post.save(tx.batchId);
23
- * await comment.save(tx.batchId);
24
- * });
25
- * ```
26
- */
27
- export declare function runTransaction<T>(perspective: PerspectiveProxy, callback: (tx: TransactionContext) => Promise<T>): Promise<T>;
@@ -1,32 +0,0 @@
1
- /** Atomic batch-transaction helper — see {@link runTransaction}. */
2
- // ─────────────────────────────────────────────────────────────────────────────
3
- // runTransaction
4
- // ─────────────────────────────────────────────────────────────────────────────
5
- /**
6
- * Commits on success, aborts (discards batch) and re-throws on failure.
7
- *
8
- * @example
9
- * ```typescript
10
- * await Ad4mModel.transaction(perspective, async (tx) => {
11
- * await post.save(tx.batchId);
12
- * await comment.save(tx.batchId);
13
- * });
14
- * ```
15
- */
16
- export async function runTransaction(perspective, callback) {
17
- const batchId = await perspective.createBatch();
18
- const tx = { batchId, perspective };
19
- try {
20
- const result = await callback(tx);
21
- await perspective.commitBatch(batchId);
22
- return result;
23
- }
24
- catch (err) {
25
- // PerspectiveProxy has no abortBatch — the uncommitted batch will be
26
- // discarded by the runtime on its next GC cycle. Log at debug level
27
- // only: the re-thrown error already carries all actionable information,
28
- // and logging at warn would spam the console for intentional rollbacks.
29
- console.debug(`[Ad4mModel.transaction] callback threw — batch ${batchId} was NOT committed and will be discarded.`, err);
30
- throw err;
31
- }
32
- }
File without changes
@@ -1,32 +0,0 @@
1
- import * as src from "../node_modules/type-graphql/dist/index.js";
2
- export declare const dummyValue = "";
3
- export declare function dummyFn(): void;
4
- export declare function dummyDecorator(): typeof dummyFn;
5
- export declare const Arg: typeof src.Arg;
6
- export declare const Args: typeof src.Args;
7
- export declare const ArgsType: typeof src.ArgsType;
8
- export declare const Authorized: typeof src.Authorized;
9
- export declare const Ctx: typeof src.Ctx;
10
- export declare const registerEnumType: typeof src.registerEnumType;
11
- export declare const Field: typeof src.Field;
12
- export declare const FieldResolver: typeof src.FieldResolver;
13
- export declare const Info: typeof src.Info;
14
- export declare const InputType: typeof src.InputType;
15
- export declare const InterfaceType: typeof src.InterfaceType;
16
- export declare const Mutation: typeof src.Mutation;
17
- export declare const ObjectType: typeof src.ObjectType;
18
- export declare const PubSub: typeof src.PubSub;
19
- export declare const Query: typeof src.Query;
20
- export declare const Resolver: typeof src.Resolver;
21
- export declare const Root: typeof src.Root;
22
- export declare const Subscription: typeof src.Subscription;
23
- export declare const createUnionType: typeof src.createUnionType;
24
- export declare const UseMiddleware: typeof src.UseMiddleware;
25
- export declare const PubSubEngine: typeof src.PubSubEngine;
26
- export declare class ClassType<t> {
27
- }
28
- export declare const Int: typeof src.Int;
29
- export declare const Float: typeof src.Float;
30
- export declare const ID: typeof src.ID;
31
- export declare const GraphQLISODateTime: typeof src.GraphQLISODateTime;
32
- export declare const GraphQLTimestamp: typeof src.GraphQLTimestamp;
@@ -1,28 +0,0 @@
1
- import { ApolloClient } from '@apollo/client/core';
2
- import { AgentClient } from './agent/AgentClient';
3
- import { LanguageClient } from './language/LanguageClient';
4
- import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
5
- import { PerspectiveClient } from './perspectives/PerspectiveClient';
6
- import { RuntimeClient } from './runtime/RuntimeClient';
7
- import { ExpressionClient } from './expression/ExpressionClient';
8
- import { AIClient } from './ai/AIClient';
9
- /**
10
- * Client for the Ad4m interface wrapping GraphQL queryies
11
- * for convenient use in user facing code.
12
- *
13
- * Aggregates the six sub-clients:
14
- * AgentClient, ExpressionClient, LanguageClient,
15
- * NeighbourhoodClient, PerspectiveClient and RuntimeClient
16
- * for the respective functionality.
17
- */
18
- export declare class Ad4mClient {
19
- #private;
20
- constructor(client: ApolloClient<any>, subscribe?: boolean);
21
- get agent(): AgentClient;
22
- get expression(): ExpressionClient;
23
- get languages(): LanguageClient;
24
- get neighbourhood(): NeighbourhoodClient;
25
- get perspective(): PerspectiveClient;
26
- get runtime(): RuntimeClient;
27
- get ai(): AIClient;
28
- }
@@ -1 +0,0 @@
1
- export type Address = string;
@@ -1 +0,0 @@
1
- export type DID = string;
@@ -1,7 +0,0 @@
1
- export declare enum ExceptionType {
2
- LanguageIsNotLoaded = "LANGUAGE_IS_NOT_LOADED",
3
- ExpressionIsNotVerified = "EXPRESSION_IS_NOT_VERIFIED",
4
- AgentIsUntrusted = "AGENT_IS_UNTRUSTED",
5
- CapabilityRequested = "CAPABILITY_REQUESTED",
6
- InstallNotificationRequest = "INSTALL_NOTIFICATION_REQUEST"
7
- }
@@ -1,7 +0,0 @@
1
- export declare class Literal {
2
- #private;
3
- static fromUrl(url: string): Literal;
4
- static from(literal: any): Literal;
5
- toUrl(): string;
6
- get(): any;
7
- }
@@ -1,17 +0,0 @@
1
- export declare const AGENT_UPDATED = "agent-updated-topic";
2
- export declare const AGENT_STATUS_CHANGED = "agent-status-changed-topic";
3
- export declare const RUNTIME_MESSAGED_RECEIVED_TOPIC = "runtime-messaged-received-topic";
4
- export declare const PERSPECTIVE_ADDED_TOPIC = "perspective-added-topic";
5
- export declare const PERSPECTIVE_UPDATED_TOPIC = "perspective-updated-topic";
6
- export declare const PERSPECTIVE_REMOVED_TOPIC = "perspective-removed-topic";
7
- export declare const LINK_ADDED_TOPIC = "link-added-topic";
8
- export declare const LINK_REMOVED_TOPIC = "link-removed-topic";
9
- export declare const LINK_UDATED_TOPIC = "link-updated-topic";
10
- export declare const SIGNAL = "signal";
11
- export declare const EXCEPTION_OCCURRED_TOPIC = "exception-occurred-topic";
12
- export declare const RUNTIME_NOTIFICATION_REQUESTED_TOPIC = "runtime-notification-requested-topic";
13
- export declare const RUNTIME_NOTIFICATION_TRIGGERED_TOPIC = "runtime-notification-triggered-topic";
14
- export declare const NEIGHBOURHOOD_SIGNAL_RECEIVED_TOPIC = "neighbourhood-signal-received-topic";
15
- export declare const PERSPECTIVE_SYNC_STATE_CHANGE = "perspective-sync-state-change";
16
- export declare const APPS_CHANGED = "apps-changed";
17
- export declare const AI_TRANSCRIPTION_TEXT_TOPIC = "ai-transcription-text-topic";
@@ -1,12 +0,0 @@
1
- import { PerspectiveProxy } from "./perspectives/PerspectiveProxy";
2
- export declare const SMART_LITERAL_CONTENT_PREDICATE = "smart_literal://content";
3
- export declare class SmartLiteral {
4
- #private;
5
- constructor(perspective: PerspectiveProxy, base: string);
6
- get base(): string;
7
- static create(perspective: PerspectiveProxy, literal: any): Promise<SmartLiteral>;
8
- static isSmartLiteralBase(perspective: PerspectiveProxy, base: string): Promise<boolean>;
9
- static getAllSmartLiterals(perspective: PerspectiveProxy): Promise<SmartLiteral[]>;
10
- get(): Promise<any>;
11
- set(content: any): Promise<void>;
12
- }
@@ -1,110 +0,0 @@
1
- import { Perspective } from "../perspectives/Perspective";
2
- /** AD4M's representation of an Agent
3
- *
4
- * AD4M Agents are build around DIDs, which are used to identify and authenticate the Agent.
5
- * Conceptually, an Agent is regarded as something that can speak and that can listen.
6
- *
7
- * Agents speak by creating Expressions in AD4M Languages which are signed by the Agent's DID key,
8
- * And they also speak (broadcast) by putting semantic statements into their public "Agent Perspective".
9
- * They listen (can receive messages) through their "direct message Language".
10
- *
11
- * These three aspects are represented by the three fields of this class.
12
- *
13
- * This class is used as format for the Expressions in the Agent language.
14
- * Since AD4M treats DID URIs as addresses for the Agent Language,
15
- * DIDs are resolved to Expressions that are objects of this class.
16
- * Thus, this is how agents see (other) agents.
17
- */
18
- export declare class Agent {
19
- /** The DID of the Agent
20
- * All epxressions authored by them are signed with the keys mentioned
21
- * in the DID document behind this DID URI.
22
- */
23
- did: string;
24
- /** The Perspective that holds the public-facing semantics/statements of the Agent
25
- * Holds and shares a Perspective that links all information
26
- * this agent wants to offer as public-facing semantics.
27
- * This should be used for any kind of user profile information.
28
- */
29
- perspective?: Perspective;
30
- /** Address of the Language by which the Agent will receive DMs */
31
- directMessageLanguage?: string;
32
- constructor(did: string, perspective?: Perspective);
33
- }
34
- declare const AgentExpression_base: any;
35
- export declare class AgentExpression extends AgentExpression_base {
36
- }
37
- export declare class EntanglementProof {
38
- did: string;
39
- didSigningKeyId: string;
40
- deviceKeyType: string;
41
- deviceKey: string;
42
- deviceKeySignedByDid: string;
43
- didSignedByDeviceKey?: string;
44
- constructor(did: string, didSigningKeyId: string, deviceKeyType: string, deviceKey: string, deviceKeySignedByDid: string, didSignedByDeviceKey?: string);
45
- }
46
- export declare class EntanglementProofInput {
47
- did: string;
48
- didSigningKeyId: string;
49
- deviceKeyType: string;
50
- deviceKey: string;
51
- deviceKeySignedByDid: string;
52
- didSignedByDeviceKey: string;
53
- constructor(did: string, didSigningKeyId: string, deviceKeyType: string, deviceKey: string, deviceKeySignedByDid: string, didSignedByDeviceKey: string);
54
- }
55
- export declare class AgentSignature {
56
- signature: string;
57
- publicKey: string;
58
- constructor(signature: string, publicKey: string);
59
- }
60
- export declare class Resource {
61
- domain: string;
62
- pointers: string[];
63
- constructor(domain: string, pointers: string[]);
64
- }
65
- export declare class Capability {
66
- with: Resource;
67
- can: string[];
68
- constructor(withF: Resource, can: string[]);
69
- }
70
- export declare class AuthInfo {
71
- appName: string;
72
- appDesc: string;
73
- appUrl: string;
74
- appIconPath?: string;
75
- capabilities: Capability[];
76
- constructor(appName: string, appDesc: string, appUrl: string, capabilities: Capability[], appIconPath?: string);
77
- }
78
- export declare class Apps {
79
- requestId: string;
80
- token: string;
81
- revoked?: boolean;
82
- auth: AuthInfo;
83
- constructor(requestId: string, auth: AuthInfo, token: string, revoked?: boolean);
84
- }
85
- export declare class ResourceInput {
86
- domain: string;
87
- pointers: string[];
88
- constructor(domain: string, pointers: string[]);
89
- }
90
- export declare class CapabilityInput {
91
- with: ResourceInput;
92
- can: string[];
93
- constructor(withF: ResourceInput, can: string[]);
94
- }
95
- export declare class AuthInfoInput {
96
- appName: string;
97
- appDesc: string;
98
- appDomain: string;
99
- appUrl?: string;
100
- appIconPath?: string;
101
- capabilities?: CapabilityInput[];
102
- constructor(appName: string, appDesc: string, appDomain: string, appUrl?: string, appIconPath?: string, capabilities?: CapabilityInput[]);
103
- }
104
- export declare class UserCreationResult {
105
- did: string;
106
- success: boolean;
107
- error?: string;
108
- constructor(did: string, success: boolean, error?: string);
109
- }
110
- export {};
@@ -1,62 +0,0 @@
1
- import { ApolloClient } from "@apollo/client/core";
2
- import { PerspectiveInput } from "../perspectives/Perspective";
3
- import { Agent, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput, UserCreationResult } from "./Agent";
4
- import { AgentStatus } from "./AgentStatus";
5
- import { LinkMutations } from "../links/Links";
6
- import { VerificationRequestResult } from "../runtime/RuntimeResolver";
7
- export interface InitializeArgs {
8
- did: string;
9
- didDocument: string;
10
- keystore: string;
11
- passphrase: string;
12
- }
13
- export type AgentUpdatedCallback = (agent: Agent) => null;
14
- export type AgentStatusChangedCallback = (agent: Agent) => null;
15
- export type AgentAppsUpdatedCallback = () => null;
16
- /**
17
- * Provides access to all functions regarding the local agent,
18
- * such as generating, locking, unlocking, importing the DID keystore,
19
- * as well as updating the publicly shared Agent expression.
20
- */
21
- export declare class AgentClient {
22
- #private;
23
- constructor(client: ApolloClient<any>, subscribe?: boolean);
24
- /**
25
- * Returns the Agent expression of the local agent as it is shared
26
- * publicly via the AgentLanguage.
27
- *
28
- * I.e. this is the users profile.
29
- */
30
- me(): Promise<Agent>;
31
- status(): Promise<AgentStatus>;
32
- generate(passphrase: string): Promise<AgentStatus>;
33
- import(args: InitializeArgs): Promise<AgentStatus>;
34
- lock(passphrase: string): Promise<AgentStatus>;
35
- unlock(passphrase: string, holochain?: boolean): Promise<AgentStatus>;
36
- byDID(did: string): Promise<Agent>;
37
- updatePublicPerspective(perspective: PerspectiveInput): Promise<Agent>;
38
- mutatePublicPerspective(mutations: LinkMutations): Promise<Agent>;
39
- updateDirectMessageLanguage(directMessageLanguage: string): Promise<Agent>;
40
- addEntanglementProofs(proofs: EntanglementProofInput[]): Promise<EntanglementProof[]>;
41
- deleteEntanglementProofs(proofs: EntanglementProofInput[]): Promise<EntanglementProof[]>;
42
- getEntanglementProofs(): Promise<string[]>;
43
- entanglementProofPreFlight(deviceKey: string, deviceKeyType: string): Promise<EntanglementProof>;
44
- addUpdatedListener(listener: any): void;
45
- addAppChangedListener(listener: any): void;
46
- subscribeAgentUpdated(): void;
47
- subscribeAppsChanged(): void;
48
- addAgentStatusChangedListener(listener: any): void;
49
- subscribeAgentStatusChanged(): void;
50
- requestCapability(authInfo: AuthInfoInput): Promise<string>;
51
- permitCapability(auth: string): Promise<string>;
52
- generateJwt(requestId: string, rand: string): Promise<string>;
53
- getApps(): Promise<Apps[]>;
54
- removeApp(requestId: string): Promise<Apps[]>;
55
- revokeToken(requestId: string): Promise<Apps[]>;
56
- isLocked(): Promise<boolean>;
57
- signMessage(message: string): Promise<string>;
58
- createUser(email: string, password: string, appInfo?: AuthInfoInput): Promise<UserCreationResult>;
59
- loginUser(email: string, password: string): Promise<string>;
60
- requestLoginVerification(email: string, appInfo?: AuthInfoInput): Promise<VerificationRequestResult>;
61
- verifyEmailCode(email: string, code: string, verificationType: string): Promise<string>;
62
- }
@@ -1,30 +0,0 @@
1
- import { PerspectiveInput } from "../perspectives/Perspective";
2
- import { Agent, AgentSignature, AuthInfoInput, EntanglementProof, EntanglementProofInput } from "./Agent";
3
- import { AgentStatus } from "./AgentStatus";
4
- export declare const TEST_AGENT_DID = "did:ad4m:test";
5
- export default class AgentResolver {
6
- agent(): Agent;
7
- agentStatus(): AgentStatus;
8
- agentGenerate(passphrase: string, pubSub: any): AgentStatus;
9
- agentImport(did: string, didDocument: string, keystore: string, passphrase: string): AgentStatus;
10
- agentLock(passphrase: string, pubSub: any): AgentStatus;
11
- agentUnlock(passphrase: string, holochain: boolean, pubSub: any): AgentStatus;
12
- agentByDID(did: string): Agent;
13
- agentUpdatePublicPerspective(perspective: PerspectiveInput, pubSub: any): Agent;
14
- agentUpdateDirectMessageLanguage(directMessageLanguage: string, pubSub: any): Agent;
15
- agentUpdated(): Agent;
16
- agentStatusChanged(): AgentStatus;
17
- agentAddEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[];
18
- agentDeleteEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[];
19
- agentGetEntanglementProofs(): EntanglementProof[];
20
- agentEntanglementProofPreFlight(deviceKey: string, deviceKeyType: string): EntanglementProof;
21
- agentRequestCapability(authInfo: AuthInfoInput): String;
22
- agentPermitCapability(auth: string): String;
23
- agentGenerateJwt(requestId: string, rand: string): String;
24
- agentIsLocked(): Boolean;
25
- agentGetApps(): [];
26
- agentAppsChanged(): null;
27
- agentRemoveApp(requestId: string, pubSub: any): [];
28
- agentRevokeToken(requestId: string): any[];
29
- agentSignMessage(message: string): AgentSignature;
30
- }
@@ -1,8 +0,0 @@
1
- export declare class AgentStatus {
2
- isInitialized: Boolean;
3
- isUnlocked: Boolean;
4
- did?: string;
5
- didDocument?: string;
6
- error?: string;
7
- constructor(obj?: object);
8
- }
@@ -1,32 +0,0 @@
1
- import { ApolloClient } from "@apollo/client";
2
- import { AIModelLoadingStatus, AITask } from "./Tasks";
3
- import { ModelInput, Model, ModelType } from "./AIResolver";
4
- export declare class AIClient {
5
- #private;
6
- constructor(apolloClient: ApolloClient<any>, subscribe?: boolean);
7
- getModels(): Promise<Model[]>;
8
- addModel(model: ModelInput): Promise<string>;
9
- updateModel(modelId: string, model: ModelInput): Promise<boolean>;
10
- removeModel(modelId: string): Promise<boolean>;
11
- setDefaultModel(modelType: ModelType, modelId: string): Promise<boolean>;
12
- getDefaultModel(modelType: ModelType): Promise<Model>;
13
- tasks(): Promise<AITask[]>;
14
- addTask(name: string, modelId: string, systemPrompt: string, promptExamples: {
15
- input: string;
16
- output: string;
17
- }[], metaData?: string): Promise<AITask>;
18
- removeTask(taskId: string): Promise<AITask>;
19
- updateTask(taskId: string, task: AITask): Promise<AITask>;
20
- modelLoadingStatus(model: string): Promise<AIModelLoadingStatus>;
21
- prompt(taskId: string, prompt: string): Promise<string>;
22
- embed(modelId: string, text: string): Promise<Array<number>>;
23
- openTranscriptionStream(modelId: string, streamCallback: (text: string) => void, params?: {
24
- startThreshold?: number;
25
- startWindow?: number;
26
- endThreshold?: number;
27
- endWindow?: number;
28
- timeBeforeSpeech?: number;
29
- }): Promise<string>;
30
- closeTranscriptionStream(streamId: string): Promise<void>;
31
- feedTranscriptionStream(streamIds: string | string[], audio: Float32Array): Promise<void>;
32
- }
@@ -1,75 +0,0 @@
1
- import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
2
- export declare class ModelApi {
3
- baseUrl: string;
4
- apiKey: string;
5
- model: string;
6
- apiType: String;
7
- }
8
- export declare class TokenizerSource {
9
- repo: string;
10
- revision: string;
11
- fileName: string;
12
- }
13
- export declare class LocalModel {
14
- fileName: string;
15
- tokenizerSource?: TokenizerSource;
16
- huggingfaceRepo?: string;
17
- revision?: string;
18
- }
19
- export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
20
- export declare class Model {
21
- id: string;
22
- name: string;
23
- api?: ModelApi;
24
- local?: LocalModel;
25
- modelType: ModelType;
26
- }
27
- export declare class ModelApiInput {
28
- baseUrl: string;
29
- apiKey: string;
30
- model: string;
31
- apiType: string;
32
- }
33
- export declare class TokenizerSourceInput {
34
- repo: string;
35
- revision: string;
36
- fileName: string;
37
- }
38
- export declare class LocalModelInput {
39
- fileName: string;
40
- tokenizerSource?: TokenizerSourceInput;
41
- huggingfaceRepo?: string;
42
- revision?: string;
43
- }
44
- export declare class ModelInput {
45
- name: string;
46
- api?: ModelApiInput;
47
- local?: LocalModelInput;
48
- modelType: ModelType;
49
- }
50
- export declare class VoiceActivityParamsInput {
51
- startThreshold?: number;
52
- startWindow?: number;
53
- endThreshold?: number;
54
- endWindow?: number;
55
- timeBeforeSpeech?: number;
56
- }
57
- export default class AIResolver {
58
- aiGetModels(): Model[];
59
- aiAddModel(model: ModelInput): string;
60
- aiUpdateModel(modelId: string, model: ModelInput): boolean;
61
- aiRemoveModel(modelId: string): boolean;
62
- aiSetDefaultModel(modelType: ModelType, modelId: string): boolean;
63
- aiGetDefaultModel(modelType: ModelType): Model;
64
- aiTasks(): AITask[];
65
- aiAddTask(task: AITaskInput): AITask;
66
- aiRemoveTask(taskId: string): AITask;
67
- aiUpdateTask(taskId: string, task: AITaskInput): AITask;
68
- aiModelLoadingStatus(model: string): AIModelLoadingStatus;
69
- aiPrompt(taskId: string, input: string): string;
70
- aiEmbed(modelId: string, text: string): string;
71
- aiOpenTranscriptionStream(modelId: string, params?: VoiceActivityParamsInput): string;
72
- aiCloseTranscriptionStream(streamId: string): boolean;
73
- aiFeedTranscriptionStream(streamIds: string[], audio: number[], pubSub: any): boolean;
74
- aiTranscriptionText(streamId: string): string;
75
- }
@@ -1,37 +0,0 @@
1
- export declare class AIPromptExamplesInput {
2
- input: string;
3
- output: string;
4
- constructor(input: string, output: string);
5
- }
6
- export declare class AIPromptExamples {
7
- input: string;
8
- output: string;
9
- constructor(input: string, output: string);
10
- }
11
- export declare class AITaskInput {
12
- name: string;
13
- modelId: string;
14
- systemPrompt: string;
15
- promptExamples: AIPromptExamplesInput[];
16
- metaData: string;
17
- constructor(name: string, model_id: string, system_prompt: string, prompt_examples: AIPromptExamplesInput[], metaData?: string);
18
- }
19
- export declare class AITask {
20
- name: string;
21
- modelId: string;
22
- taskId: string;
23
- systemPrompt: string;
24
- promptExamples: AIPromptExamples[];
25
- metaData?: string;
26
- createdAt: string;
27
- updatedAt: string;
28
- constructor(name: string, model_id: string, task_id: string, system_prompt: string, prompt_examples: AIPromptExamples[], metaData?: string, created_at?: string, updated_at?: string);
29
- }
30
- export declare class AIModelLoadingStatus {
31
- model: string;
32
- status: string;
33
- progress: number;
34
- downloaded: boolean;
35
- loaded: boolean;
36
- constructor(model: string, status: string, progress: number, downloaded: boolean, loaded: boolean);
37
- }
@@ -1 +0,0 @@
1
- import "reflect-metadata";
@@ -1,28 +0,0 @@
1
- import { ClassType } from "type-graphql";
2
- import { Icon } from "../language/Icon";
3
- import { LanguageRef } from "../language/LanguageRef";
4
- export declare class ExpressionProof {
5
- signature: string;
6
- key: string;
7
- valid?: boolean;
8
- invalid?: boolean;
9
- constructor(sig: string, k: string);
10
- }
11
- export declare class ExpressionProofInput {
12
- signature: string;
13
- key: string;
14
- valid?: boolean;
15
- invalid?: boolean;
16
- }
17
- export declare function ExpressionGeneric<DataType>(DataTypeClass: ClassType<DataType>): any;
18
- export declare function ExpressionGenericInput<DataType>(DataTypeClass: ClassType<DataType>): any;
19
- declare const Expression_base: any;
20
- export declare class Expression extends Expression_base {
21
- }
22
- declare const ExpressionRendered_base: any;
23
- export declare class ExpressionRendered extends ExpressionRendered_base {
24
- language: LanguageRef;
25
- icon: Icon;
26
- }
27
- export declare function isExpression(e: any): boolean;
28
- export {};
@@ -1,13 +0,0 @@
1
- import { ApolloClient } from "@apollo/client/core";
2
- import { InteractionCall, InteractionMeta } from "../language/Language";
3
- import { ExpressionRendered } from "./Expression";
4
- export declare class ExpressionClient {
5
- #private;
6
- constructor(client: ApolloClient<any>);
7
- get(url: string, alwaysGet?: boolean): Promise<ExpressionRendered>;
8
- getMany(urls: string[]): Promise<ExpressionRendered[]>;
9
- getRaw(url: string): Promise<string>;
10
- create(content: any, languageAddress: string): Promise<string>;
11
- interactions(url: string): Promise<InteractionMeta[]>;
12
- interact(url: string, interactionCall: InteractionCall): Promise<string | null>;
13
- }
@@ -1,9 +0,0 @@
1
- import type { Address } from '../Address';
2
- import { LanguageRef } from '../language/LanguageRef';
3
- export declare class ExpressionRef {
4
- language: LanguageRef;
5
- expression: Address;
6
- constructor(lang: LanguageRef, expr: Address);
7
- }
8
- export declare function exprRef2String(ref: ExpressionRef): string;
9
- export declare function parseExprUrl(url: string): ExpressionRef;
@@ -1,10 +0,0 @@
1
- import { ExpressionRendered } from "./Expression";
2
- import { InteractionCall, InteractionMeta } from "../language/Language";
3
- export default class ExpressionResolver {
4
- expression(url: string): ExpressionRendered;
5
- expressionMany(urls: string[]): (ExpressionRendered | null)[];
6
- expressionRaw(url: string): string;
7
- expressionCreate(content: string, languageAddress: string): string;
8
- expressionInteractions(url: string): InteractionMeta[];
9
- expressionInteract(url: string, interactionCall: InteractionCall): string | null;
10
- }
@@ -1,35 +0,0 @@
1
- export * from "./Ad4mClient";
2
- export * from "./Address";
3
- export * from "./agent/Agent";
4
- export * from "./agent/AgentStatus";
5
- export * from "./Exception";
6
- export * from "./expression/Expression";
7
- export * from "./expression/ExpressionRef";
8
- export * from "./language/Icon";
9
- export * from "./language/Language";
10
- export * from "./language/LanguageRef";
11
- export * from "./language/LanguageContext";
12
- export * from "./language/LanguageHandle";
13
- export * from "./language/LanguageMeta";
14
- export * from "./links/Links";
15
- export * from "./Literal";
16
- export * from "./perspectives/Perspective";
17
- export * from "./perspectives/PerspectiveHandle";
18
- export * from "./perspectives/PerspectiveProxy";
19
- export * from "./perspectives/PerspectiveDiff";
20
- export * from "./perspectives/LinkQuery";
21
- export * from "./SmartLiteral";
22
- export * from "./model/decorators";
23
- export * from "./model/Subject";
24
- export * from "./neighbourhood/Neighbourhood";
25
- export * from "./neighbourhood/NeighbourhoodProxy";
26
- export * from "./typeDefs";
27
- export * from "./DID";
28
- export * from "./utils";
29
- export * from "./agent/AgentClient";
30
- export * from "./ai/AIClient";
31
- export * from "./ai/Tasks";
32
- export * from "./runtime/RuntimeResolver";
33
- export * from './model/Ad4mModel';
34
- export * from './shacl/SHACLShape';
35
- export { SHACLFlow, FlowState, FlowTransition, LinkPattern, FlowableCondition } from './shacl/SHACLFlow';
@@ -1 +0,0 @@
1
- import 'reflect-metadata';
@@ -1,4 +0,0 @@
1
- export declare class Icon {
2
- code: string;
3
- constructor(code: string);
4
- }