@coasys/ad4m 0.8.0-fix → 0.8.1

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 (161) hide show
  1. package/README.md +229 -229
  2. package/jest.config.js +5 -5
  3. package/jsdoc.json +27 -27
  4. package/lib/index.cjs +4522 -4571
  5. package/lib/index.js +4522 -4571
  6. package/lib/shims/type-graphql.d.ts +32 -32
  7. package/lib/shims/type-graphql.js +70 -70
  8. package/lib/src/Ad4mClient.d.ts +26 -26
  9. package/lib/src/Ad4mClient.js +66 -66
  10. package/lib/src/Address.d.ts +1 -1
  11. package/lib/src/Address.js +1 -1
  12. package/lib/src/DID.d.ts +1 -1
  13. package/lib/src/DID.js +1 -1
  14. package/lib/src/Exception.d.ts +6 -6
  15. package/lib/src/Exception.js +7 -7
  16. package/lib/src/Literal.d.ts +7 -7
  17. package/lib/src/Literal.js +76 -76
  18. package/lib/src/PubSub.d.ts +14 -14
  19. package/lib/src/PubSub.js +14 -14
  20. package/lib/src/SmartLiteral.d.ts +12 -12
  21. package/lib/src/SmartLiteral.js +74 -74
  22. package/lib/src/agent/Agent.d.ts +104 -104
  23. package/lib/src/agent/Agent.js +337 -337
  24. package/lib/src/agent/AgentClient.d.ts +57 -57
  25. package/lib/src/agent/AgentClient.js +431 -431
  26. package/lib/src/agent/AgentResolver.d.ts +30 -30
  27. package/lib/src/agent/AgentResolver.js +325 -325
  28. package/lib/src/agent/AgentStatus.d.ts +8 -8
  29. package/lib/src/agent/AgentStatus.js +61 -61
  30. package/lib/src/buildSchema.d.ts +1 -1
  31. package/lib/src/buildSchema.js +36 -36
  32. package/lib/src/expression/Expression.d.ts +28 -28
  33. package/lib/src/expression/Expression.js +143 -143
  34. package/lib/src/expression/ExpressionClient.d.ts +13 -13
  35. package/lib/src/expression/ExpressionClient.js +102 -102
  36. package/lib/src/expression/ExpressionRef.d.ts +9 -9
  37. package/lib/src/expression/ExpressionRef.js +67 -67
  38. package/lib/src/expression/ExpressionResolver.d.ts +10 -10
  39. package/lib/src/expression/ExpressionResolver.js +106 -106
  40. package/lib/src/index.d.ts +30 -30
  41. package/lib/src/index.js +30 -30
  42. package/lib/src/jestSetup.d.ts +1 -1
  43. package/lib/src/jestSetup.js +1 -1
  44. package/lib/src/language/Icon.d.ts +4 -4
  45. package/lib/src/language/Icon.js +24 -24
  46. package/lib/src/language/Language.d.ts +195 -195
  47. package/lib/src/language/Language.js +79 -79
  48. package/lib/src/language/LanguageClient.d.ts +17 -17
  49. package/lib/src/language/LanguageClient.js +137 -137
  50. package/lib/src/language/LanguageContext.d.ts +37 -37
  51. package/lib/src/language/LanguageContext.js +2 -2
  52. package/lib/src/language/LanguageHandle.d.ts +9 -9
  53. package/lib/src/language/LanguageHandle.js +41 -41
  54. package/lib/src/language/LanguageMeta.d.ts +35 -35
  55. package/lib/src/language/LanguageMeta.js +89 -89
  56. package/lib/src/language/LanguageRef.d.ts +6 -6
  57. package/lib/src/language/LanguageRef.js +30 -30
  58. package/lib/src/language/LanguageResolver.d.ts +19 -19
  59. package/lib/src/language/LanguageResolver.js +143 -143
  60. package/lib/src/links/Links.d.ts +39 -39
  61. package/lib/src/links/Links.js +148 -148
  62. package/lib/src/links/Links.test.d.ts +1 -1
  63. package/lib/src/links/Links.test.js +33 -33
  64. package/lib/src/neighbourhood/Neighbourhood.d.ts +10 -10
  65. package/lib/src/neighbourhood/Neighbourhood.js +38 -38
  66. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +25 -25
  67. package/lib/src/neighbourhood/NeighbourhoodClient.js +256 -256
  68. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -19
  69. package/lib/src/neighbourhood/NeighbourhoodProxy.js +54 -54
  70. package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -24
  71. package/lib/src/neighbourhood/NeighbourhoodResolver.js +180 -180
  72. package/lib/src/perspectives/LinkQuery.d.ts +11 -11
  73. package/lib/src/perspectives/LinkQuery.js +80 -80
  74. package/lib/src/perspectives/Perspective.d.ts +38 -38
  75. package/lib/src/perspectives/Perspective.js +144 -144
  76. package/lib/src/perspectives/Perspective.test.d.ts +1 -1
  77. package/lib/src/perspectives/Perspective.test.js +20 -20
  78. package/lib/src/perspectives/PerspectiveClient.d.ts +55 -54
  79. package/lib/src/perspectives/PerspectiveClient.js +418 -410
  80. package/lib/src/perspectives/PerspectiveDiff.d.ts +9 -9
  81. package/lib/src/perspectives/PerspectiveDiff.js +33 -33
  82. package/lib/src/perspectives/PerspectiveHandle.d.ts +16 -16
  83. package/lib/src/perspectives/PerspectiveHandle.js +59 -59
  84. package/lib/src/perspectives/PerspectiveProxy.d.ts +178 -178
  85. package/lib/src/perspectives/PerspectiveProxy.js +501 -540
  86. package/lib/src/perspectives/PerspectiveResolver.d.ts +38 -37
  87. package/lib/src/perspectives/PerspectiveResolver.js +376 -362
  88. package/lib/src/runtime/RuntimeClient.d.ts +33 -33
  89. package/lib/src/runtime/RuntimeClient.js +263 -263
  90. package/lib/src/runtime/RuntimeResolver.d.ts +47 -47
  91. package/lib/src/runtime/RuntimeResolver.js +328 -328
  92. package/lib/src/schema.gql +1 -0
  93. package/lib/src/subject/SDNADecorators.d.ts +45 -45
  94. package/lib/src/subject/SDNADecorators.js +250 -250
  95. package/lib/src/subject/Subject.d.ts +7 -7
  96. package/lib/src/subject/Subject.js +160 -160
  97. package/lib/src/subject/SubjectEntity.d.ts +31 -31
  98. package/lib/src/subject/SubjectEntity.js +250 -250
  99. package/lib/src/subject/util.d.ts +12 -12
  100. package/lib/src/subject/util.js +73 -73
  101. package/lib/src/typeDefs.d.ts +1 -1
  102. package/lib/src/typeDefs.js +1 -0
  103. package/lib/src/unwrapApolloResult.d.ts +2 -2
  104. package/lib/src/unwrapApolloResult.js +14 -12
  105. package/lib/src/utils.d.ts +2 -2
  106. package/lib/src/utils.js +21 -21
  107. package/package.json +61 -61
  108. package/rollup.config.js +26 -26
  109. package/shims/type-graphql.ts +75 -75
  110. package/src/Ad4mClient.test.ts +1089 -1084
  111. package/src/Ad4mClient.ts +62 -62
  112. package/src/Address.ts +1 -1
  113. package/src/Exception.ts +6 -6
  114. package/src/Literal.test.ts +30 -30
  115. package/src/Literal.ts +80 -80
  116. package/src/PubSub.ts +13 -13
  117. package/src/SmartLiteral.ts +74 -74
  118. package/src/agent/Agent.ts +293 -293
  119. package/src/agent/AgentClient.ts +531 -531
  120. package/src/agent/AgentResolver.ts +263 -263
  121. package/src/agent/AgentStatus.ts +43 -43
  122. package/src/buildSchema.ts +41 -41
  123. package/src/expression/Expression.ts +99 -99
  124. package/src/expression/ExpressionClient.ts +98 -98
  125. package/src/expression/ExpressionRef.ts +62 -62
  126. package/src/expression/ExpressionResolver.ts +63 -63
  127. package/src/index.ts +30 -30
  128. package/src/language/Icon.ts +10 -10
  129. package/src/language/Language.ts +266 -266
  130. package/src/language/LanguageClient.ts +159 -159
  131. package/src/language/LanguageContext.ts +37 -37
  132. package/src/language/LanguageHandle.ts +23 -23
  133. package/src/language/LanguageMeta.ts +69 -69
  134. package/src/language/LanguageRef.ts +18 -18
  135. package/src/language/LanguageResolver.ts +98 -98
  136. package/src/links/Links.test.ts +39 -39
  137. package/src/links/Links.ts +107 -107
  138. package/src/neighbourhood/Neighbourhood.ts +22 -22
  139. package/src/neighbourhood/NeighbourhoodClient.ts +275 -275
  140. package/src/neighbourhood/NeighbourhoodProxy.ts +58 -58
  141. package/src/neighbourhood/NeighbourhoodResolver.ts +99 -99
  142. package/src/perspectives/LinkQuery.ts +65 -65
  143. package/src/perspectives/Perspective.test.ts +22 -22
  144. package/src/perspectives/Perspective.ts +118 -118
  145. package/src/perspectives/PerspectiveClient.ts +452 -443
  146. package/src/perspectives/PerspectiveDiff.ts +15 -15
  147. package/src/perspectives/PerspectiveHandle.ts +39 -39
  148. package/src/perspectives/PerspectiveProxy.ts +576 -610
  149. package/src/perspectives/PerspectiveResolver.ts +224 -219
  150. package/src/runtime/RuntimeClient.ts +282 -282
  151. package/src/runtime/RuntimeResolver.ts +192 -192
  152. package/src/subject/SDNADecorators.ts +333 -333
  153. package/src/subject/Subject.ts +152 -152
  154. package/src/subject/SubjectEntity.ts +291 -291
  155. package/src/subject/util.ts +84 -84
  156. package/src/typeDefs.ts +5 -5
  157. package/src/unwrapApolloResult.ts +15 -13
  158. package/src/utils.ts +25 -25
  159. package/tsconfig-browser.json +82 -82
  160. package/tsconfig.json +80 -80
  161. package/yarn-error.log +0 -22814
@@ -1,9 +1,9 @@
1
- import { LinkExpression } from "../links/Links";
2
- export declare class PerspectiveDiff {
3
- additions: LinkExpression[];
4
- removals: LinkExpression[];
5
- }
6
- declare const PerspectiveDiffExpression_base: any;
7
- export declare class PerspectiveDiffExpression extends PerspectiveDiffExpression_base {
8
- }
9
- export {};
1
+ import { LinkExpression } from "../links/Links";
2
+ export declare class PerspectiveDiff {
3
+ additions: LinkExpression[];
4
+ removals: LinkExpression[];
5
+ }
6
+ declare const PerspectiveDiffExpression_base: any;
7
+ export declare class PerspectiveDiffExpression extends PerspectiveDiffExpression_base {
8
+ }
9
+ export {};
@@ -1,33 +1,33 @@
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 { ExpressionGeneric } from "../expression/Expression";
12
- import { LinkExpression } from "../links/Links";
13
- let PerspectiveDiff = class PerspectiveDiff {
14
- };
15
- __decorate([
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 };
33
- ;
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 { ExpressionGeneric } from "../expression/Expression";
12
+ import { LinkExpression } from "../links/Links";
13
+ let PerspectiveDiff = class PerspectiveDiff {
14
+ };
15
+ __decorate([
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 };
33
+ ;
@@ -1,16 +1,16 @@
1
- import { NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
2
- export declare enum PerspectiveState {
3
- Private = "Private",
4
- NeighbourhoodJoinInitiated = "NeighbourhoodJoinInitiated",
5
- LinkLanguageFailedToInstall = "LinkLanguageFailedToInstall",
6
- LinkLanguageInstalledButNotSynced = "LinkLanguageInstalledButNotSynced",
7
- Synced = "Synced"
8
- }
9
- export declare class PerspectiveHandle {
10
- uuid: string;
11
- name: string;
12
- state: PerspectiveState;
13
- sharedUrl?: string;
14
- neighbourhood?: NeighbourhoodExpression;
15
- constructor(uuid?: string, name?: string, state?: PerspectiveState);
16
- }
1
+ import { NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
2
+ export declare enum PerspectiveState {
3
+ Private = "Private",
4
+ NeighbourhoodJoinInitiated = "NeighbourhoodJoinInitiated",
5
+ LinkLanguageFailedToInstall = "LinkLanguageFailedToInstall",
6
+ LinkLanguageInstalledButNotSynced = "LinkLanguageInstalledButNotSynced",
7
+ Synced = "Synced"
8
+ }
9
+ export declare class PerspectiveHandle {
10
+ uuid: string;
11
+ name: string;
12
+ state: PerspectiveState;
13
+ sharedUrl?: string;
14
+ neighbourhood?: NeighbourhoodExpression;
15
+ constructor(uuid?: string, name?: string, state?: PerspectiveState);
16
+ }
@@ -1,59 +1,59 @@
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
- export var PerspectiveState;
13
- (function (PerspectiveState) {
14
- PerspectiveState["Private"] = "Private";
15
- PerspectiveState["NeighbourhoodJoinInitiated"] = "NeighbourhoodJoinInitiated";
16
- PerspectiveState["LinkLanguageFailedToInstall"] = "LinkLanguageFailedToInstall";
17
- PerspectiveState["LinkLanguageInstalledButNotSynced"] = "LinkLanguageInstalledButNotSynced";
18
- PerspectiveState["Synced"] = "Synced";
19
- })(PerspectiveState || (PerspectiveState = {}));
20
- // This type is used in the GraphQL interface to reference a mutable
21
- // prespective that is implemented locally by the Ad4m runtime.
22
- // The UUID is used in mutations to identify the perspective that gets mutated.
23
- let PerspectiveHandle = class PerspectiveHandle {
24
- constructor(uuid, name, state) {
25
- this.uuid = uuid;
26
- this.name = name;
27
- if (state) {
28
- this.state = state;
29
- }
30
- else {
31
- this.state = PerspectiveState.Private;
32
- }
33
- }
34
- };
35
- __decorate([
36
- Field(),
37
- __metadata("design:type", String)
38
- ], PerspectiveHandle.prototype, "uuid", void 0);
39
- __decorate([
40
- Field(),
41
- __metadata("design:type", String)
42
- ], PerspectiveHandle.prototype, "name", void 0);
43
- __decorate([
44
- Field(),
45
- __metadata("design:type", String)
46
- ], PerspectiveHandle.prototype, "state", void 0);
47
- __decorate([
48
- Field(type => String, { nullable: true }),
49
- __metadata("design:type", String)
50
- ], PerspectiveHandle.prototype, "sharedUrl", void 0);
51
- __decorate([
52
- Field(type => NeighbourhoodExpression, { nullable: true }),
53
- __metadata("design:type", NeighbourhoodExpression)
54
- ], PerspectiveHandle.prototype, "neighbourhood", void 0);
55
- PerspectiveHandle = __decorate([
56
- ObjectType(),
57
- __metadata("design:paramtypes", [String, String, String])
58
- ], PerspectiveHandle);
59
- export { PerspectiveHandle };
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
+ export var PerspectiveState;
13
+ (function (PerspectiveState) {
14
+ PerspectiveState["Private"] = "Private";
15
+ PerspectiveState["NeighbourhoodJoinInitiated"] = "NeighbourhoodJoinInitiated";
16
+ PerspectiveState["LinkLanguageFailedToInstall"] = "LinkLanguageFailedToInstall";
17
+ PerspectiveState["LinkLanguageInstalledButNotSynced"] = "LinkLanguageInstalledButNotSynced";
18
+ PerspectiveState["Synced"] = "Synced";
19
+ })(PerspectiveState || (PerspectiveState = {}));
20
+ // This type is used in the GraphQL interface to reference a mutable
21
+ // prespective that is implemented locally by the Ad4m runtime.
22
+ // The UUID is used in mutations to identify the perspective that gets mutated.
23
+ let PerspectiveHandle = class PerspectiveHandle {
24
+ constructor(uuid, name, state) {
25
+ this.uuid = uuid;
26
+ this.name = name;
27
+ if (state) {
28
+ this.state = state;
29
+ }
30
+ else {
31
+ this.state = PerspectiveState.Private;
32
+ }
33
+ }
34
+ };
35
+ __decorate([
36
+ Field(),
37
+ __metadata("design:type", String)
38
+ ], PerspectiveHandle.prototype, "uuid", void 0);
39
+ __decorate([
40
+ Field(),
41
+ __metadata("design:type", String)
42
+ ], PerspectiveHandle.prototype, "name", void 0);
43
+ __decorate([
44
+ Field(),
45
+ __metadata("design:type", String)
46
+ ], PerspectiveHandle.prototype, "state", void 0);
47
+ __decorate([
48
+ Field(type => String, { nullable: true }),
49
+ __metadata("design:type", String)
50
+ ], PerspectiveHandle.prototype, "sharedUrl", void 0);
51
+ __decorate([
52
+ Field(type => NeighbourhoodExpression, { nullable: true }),
53
+ __metadata("design:type", NeighbourhoodExpression)
54
+ ], PerspectiveHandle.prototype, "neighbourhood", void 0);
55
+ PerspectiveHandle = __decorate([
56
+ ObjectType(),
57
+ __metadata("design:paramtypes", [String, String, String])
58
+ ], PerspectiveHandle);
59
+ export { PerspectiveHandle };
@@ -1,178 +1,178 @@
1
- import { LinkCallback, PerspectiveClient, SyncStateChangeCallback } from "./PerspectiveClient";
2
- import { Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkMutations } from "../links/Links";
3
- import { LinkQuery } from "./LinkQuery";
4
- import { PerspectiveHandle, PerspectiveState } from './PerspectiveHandle';
5
- import { Perspective } from "./Perspective";
6
- import { ExpressionRendered } from "../expression/Expression";
7
- import { NeighbourhoodProxy } from "../neighbourhood/NeighbourhoodProxy";
8
- import { NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
9
- type PerspectiveListenerTypes = "link-added" | "link-removed" | "link-updated";
10
- export type LinkStatus = "shared" | "local";
11
- interface Parameter {
12
- name: string;
13
- value: string;
14
- }
15
- /** Perspective UI proxy object
16
- *
17
- * Convenience object for UIs to interact with a perspective.
18
- * It is created by some of the methods in the PerspectiveClient class and includes
19
- * a reference to the PerspectiveClient object that created it.
20
- */
21
- export declare class PerspectiveProxy {
22
- #private;
23
- constructor(handle: PerspectiveHandle, ad4m: PerspectiveClient);
24
- executeAction(actions: any, expression: any, parameters: Parameter[]): Promise<void>;
25
- /** Unique ID of the perspective */
26
- get uuid(): string;
27
- /** Given name of the perspective */
28
- get name(): string;
29
- /** If the perspective is shared as a Neighbourhood, this is the Neighbourhood URL */
30
- get sharedUrl(): string | void;
31
- /** If the perspective is shared as a Neighbourhood, this is the Neighbourhood Expression */
32
- get neighbourhood(): NeighbourhoodExpression | void;
33
- /** Returns the state of the perspective **/
34
- get state(): PerspectiveState;
35
- /** Returns all the links of this perspective that matches the LinkQuery */
36
- get(query: LinkQuery): Promise<LinkExpression[]>;
37
- /** Runs a Prolog query on the perspective's Prolog engine */
38
- infer(query: string): Promise<any>;
39
- /** Adds a link to this perspective */
40
- add(link: Link, status?: LinkStatus): Promise<LinkExpression>;
41
- /** Adds multiple links to this perspective **/
42
- addLinks(links: Link[], status?: LinkStatus): Promise<LinkExpression[]>;
43
- /** Removes multiple links from this perspective **/
44
- removeLinks(links: LinkExpressionInput[]): Promise<LinkExpression[]>;
45
- /** Adds and removes multiple links from this perspective **/
46
- linkMutations(mutations: LinkMutations, status?: LinkStatus): Promise<LinkExpressionMutations>;
47
- /** Adds a linkExpression to this perspective */
48
- addLinkExpression(link: LinkExpression, status?: LinkStatus): Promise<LinkExpression>;
49
- update(oldLink: LinkExpressionInput, newLink: Link): Promise<LinkExpression>;
50
- remove(link: LinkExpressionInput): Promise<{
51
- perspectiveRemoveLink: boolean;
52
- }>;
53
- getExpression(expressionURI: string): Promise<ExpressionRendered>;
54
- createExpression(content: any, languageAddress: string): Promise<string>;
55
- /** Adds a link listener
56
- * @param type Can be 'link-added' or 'link-removed'
57
- * @param cb Callback function that is called when a link is added to the perspective
58
- */
59
- addListener(type: PerspectiveListenerTypes, cb: LinkCallback): Promise<void>;
60
- /** Adds a sync state listener
61
- * @param cb Callback function that is called when the sync state of the perspective changes
62
- * @returns A function that can be called to remove the listener
63
- */
64
- addSyncStateChangeListener(cb: SyncStateChangeCallback): Promise<void>;
65
- /** Removes a previously added link listener
66
- * @param type Can be 'link-added' or 'link-removed'
67
- * @param cb Callback function that is called when a link is added to the perspective
68
- */
69
- removeListener(type: PerspectiveListenerTypes, cb: LinkCallback): Promise<void>;
70
- /** Create and return a snapshot of this perspective
71
- * A snapshot is a rendered Perspectie object that contains all the links of the perspective.
72
- */
73
- snapshot(): Promise<Perspective>;
74
- /** Take and load all the links from the given snapshot */
75
- loadSnapshot(snapshot: Perspective): Promise<void>;
76
- /** Convenience function to get the target of the first link that matches the given query
77
- * This makes sense when the query is expected to return only one link
78
- * and the target of that link is what you are looking for.
79
- *
80
- * Works best together with @member setSingelTarget()
81
- */
82
- getSingleTarget(query: LinkQuery): Promise<string | void>;
83
- /** Convenience function to ensure there is only one link with given source and predicate
84
- * This function will remove all links with the same source and predicate as the given link,
85
- * and then add the given link.
86
- * This ensures there is only one target for the given source and predicate.
87
- *
88
- * Works best together with @member getSingleTarget()
89
- */
90
- setSingleTarget(link: Link, status?: LinkStatus): Promise<void>;
91
- /** Returns all the Social DNA flows defined in this perspective */
92
- sdnaFlows(): Promise<string[]>;
93
- /** Returns all Social DNA flows that can be started from the given expression */
94
- availableFlows(exprAddr: string): Promise<string[]>;
95
- /** Starts the Social DNA flow @param flowName on the expression @param exprAddr */
96
- startFlow(flowName: string, exprAddr: string): Promise<void>;
97
- /** Returns all expressions in the given state of given Social DNA flow */
98
- expressionsInFlowState(flowName: string, flowState: number): Promise<string[]>;
99
- /** Returns the given expression's flow state with regard to given Social DNA flow */
100
- flowState(flowName: string, exprAddr: string): Promise<number>;
101
- /** Returns available action names, with regard to Social DNA flow and expression's flow state */
102
- flowActions(flowName: string, exprAddr: string): Promise<string[]>;
103
- /** Runs given Social DNA flow action */
104
- runFlowAction(flowName: string, exprAddr: string, actionName: string): Promise<void>;
105
- /** Returns the perspective's Social DNA code
106
- * This will return all SDNA code elements in an array.
107
- */
108
- getSdna(): Promise<string[]>;
109
- /** Adds the given Social DNA code to the perspective's SDNA code */
110
- addSdna(name: string, sdnaCode: string, type: "subject_class" | "flow" | "custom"): Promise<void>;
111
- /** Returns all the Subject classes defined in this perspectives SDNA */
112
- subjectClasses(): Promise<string[]>;
113
- stringOrTemplateObjectToSubjectClass<T>(subjectClass: T): Promise<string>;
114
- /** Creates a new subject instance by running its (SDNA defined) constructor,
115
- * which means adding links around the given expression address so that it
116
- * conforms to the given subject class.
117
- *
118
- * @param subjectClass Either a string with the name of the subject class, or an object
119
- * with the properties of the subject class. In the latter case, the first subject class
120
- * that matches the given properties will be used.
121
- * @param exprAddr The address of the expression to be turned into a subject instance
122
- */
123
- createSubject<T>(subjectClass: T, exprAddr: string): Promise<T>;
124
- /** Removes a subject instance by running its (SDNA defined) destructor,
125
- * which means removing links around the given expression address
126
- *
127
- * @param subjectClass Either a string with the name of the subject class, or an object
128
- * with the properties of the subject class. In the latter case, the first subject class
129
- * that matches the given properties will be used.
130
- * @param exprAddr The address of the expression to be turned into a subject instance
131
- */
132
- removeSubject<T>(subjectClass: T, exprAddr: string): Promise<void>;
133
- /** Checks if the given expression is a subject instance of the given subject class
134
- * @param expression The expression to be checked
135
- * @param subjectClass Either a string with the name of the subject class, or an object
136
- * with the properties of the subject class. In the latter case, the first subject class
137
- * that matches the given properties will be used.
138
- */
139
- isSubjectInstance<T>(expression: string, subjectClass: T): Promise<boolean>;
140
- /** For an existing subject instance (existing in the perspective's links)
141
- * this function returns a proxy object that can be used to access the subject's
142
- * properties and methods.
143
- *
144
- * @param base URI of the subject's root expression
145
- * @param subjectClass Either a string with the name of the subject class, or an object
146
- * with the properties of the subject class. In the latter case, the first subject class
147
- * that matches the given properties will be used.
148
- */
149
- getSubjectProxy<T>(base: string, subjectClass: T): Promise<T>;
150
- /** Returns all subject instances of the given subject class as proxy objects.
151
- * @param subjectClass Either a string with the name of the subject class, or an object
152
- * with the properties of the subject class. In the latter case, all subject classes
153
- * that match the given properties will be used.
154
- */
155
- getAllSubjectInstances<T>(subjectClass: T): Promise<T[]>;
156
- getAllSubjectProxies<T>(subjectClass: T): Promise<T[]>;
157
- /** Returns all subject classes that match the given template object.
158
- * This function looks at the properties of the template object and
159
- * its setters and collections to create a Prolog query that finds
160
- * all subject classes that would be converted to a proxy object
161
- * with exactly the same properties and collections.
162
- *
163
- * Since there could be multiple subject classes that match the given
164
- * criteria, this function returns a list of class names.
165
- *
166
- * @param obj The template object
167
- */
168
- subjectClassesByTemplate(obj: object): Promise<string[]>;
169
- /** Takes a JS class (its constructor) and assumes that it was decorated by
170
- * the @subjectClass etc. decorators. It then tests if there is a subject class
171
- * already present in the perspective's SDNA that matches the given class.
172
- * If there is no such class, it gets the JS class's SDNA by calling its
173
- * static generateSDNA() function and adds it to the perspective's SDNA.
174
- */
175
- ensureSDNASubjectClass(jsClass: any): Promise<void>;
176
- getNeighbourhoodProxy(): NeighbourhoodProxy;
177
- }
178
- export {};
1
+ import { LinkCallback, PerspectiveClient, SyncStateChangeCallback } from "./PerspectiveClient";
2
+ import { Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkMutations } from "../links/Links";
3
+ import { LinkQuery } from "./LinkQuery";
4
+ import { PerspectiveHandle, PerspectiveState } from './PerspectiveHandle';
5
+ import { Perspective } from "./Perspective";
6
+ import { ExpressionRendered } from "../expression/Expression";
7
+ import { NeighbourhoodProxy } from "../neighbourhood/NeighbourhoodProxy";
8
+ import { NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
9
+ type PerspectiveListenerTypes = "link-added" | "link-removed" | "link-updated";
10
+ export type LinkStatus = "shared" | "local";
11
+ interface Parameter {
12
+ name: string;
13
+ value: string;
14
+ }
15
+ /** Perspective UI proxy object
16
+ *
17
+ * Convenience object for UIs to interact with a perspective.
18
+ * It is created by some of the methods in the PerspectiveClient class and includes
19
+ * a reference to the PerspectiveClient object that created it.
20
+ */
21
+ export declare class PerspectiveProxy {
22
+ #private;
23
+ /** Unique ID of the perspective */
24
+ uuid: string;
25
+ /** Given name of the perspective */
26
+ name: string;
27
+ /** If the perspective is shared as a Neighbourhood, this is the Neighbourhood URL */
28
+ sharedUrl: string | null;
29
+ /** If the perspective is shared as a Neighbourhood, this is the Neighbourhood Expression */
30
+ neighbourhood: NeighbourhoodExpression | null;
31
+ /** Returns the state of the perspective **/
32
+ state: PerspectiveState | null;
33
+ constructor(handle: PerspectiveHandle, ad4m: PerspectiveClient);
34
+ executeAction(actions: any, expression: any, parameters: Parameter[]): Promise<void>;
35
+ /** Returns all the links of this perspective that matches the LinkQuery */
36
+ get(query: LinkQuery): Promise<LinkExpression[]>;
37
+ /** Runs a Prolog query on the perspective's Prolog engine */
38
+ infer(query: string): Promise<any>;
39
+ /** Adds a link to this perspective */
40
+ add(link: Link, status?: LinkStatus): Promise<LinkExpression>;
41
+ /** Adds multiple links to this perspective **/
42
+ addLinks(links: Link[], status?: LinkStatus): Promise<LinkExpression[]>;
43
+ /** Removes multiple links from this perspective **/
44
+ removeLinks(links: LinkExpressionInput[]): Promise<LinkExpression[]>;
45
+ /** Adds and removes multiple links from this perspective **/
46
+ linkMutations(mutations: LinkMutations, status?: LinkStatus): Promise<LinkExpressionMutations>;
47
+ /** Adds a linkExpression to this perspective */
48
+ addLinkExpression(link: LinkExpression, status?: LinkStatus): Promise<LinkExpression>;
49
+ update(oldLink: LinkExpressionInput, newLink: Link): Promise<LinkExpression>;
50
+ remove(link: LinkExpressionInput): Promise<{
51
+ perspectiveRemoveLink: boolean;
52
+ }>;
53
+ getExpression(expressionURI: string): Promise<ExpressionRendered>;
54
+ createExpression(content: any, languageAddress: string): Promise<string>;
55
+ /** Adds a link listener
56
+ * @param type Can be 'link-added' or 'link-removed'
57
+ * @param cb Callback function that is called when a link is added to the perspective
58
+ */
59
+ addListener(type: PerspectiveListenerTypes, cb: LinkCallback): Promise<void>;
60
+ /** Adds a sync state listener
61
+ * @param cb Callback function that is called when the sync state of the perspective changes
62
+ * @returns A function that can be called to remove the listener
63
+ */
64
+ addSyncStateChangeListener(cb: SyncStateChangeCallback): Promise<void>;
65
+ /** Removes a previously added link listener
66
+ * @param type Can be 'link-added' or 'link-removed'
67
+ * @param cb Callback function that is called when a link is added to the perspective
68
+ */
69
+ removeListener(type: PerspectiveListenerTypes, cb: LinkCallback): Promise<void>;
70
+ /** Create and return a snapshot of this perspective
71
+ * A snapshot is a rendered Perspectie object that contains all the links of the perspective.
72
+ */
73
+ snapshot(): Promise<Perspective>;
74
+ /** Take and load all the links from the given snapshot */
75
+ loadSnapshot(snapshot: Perspective): Promise<void>;
76
+ /** Convenience function to get the target of the first link that matches the given query
77
+ * This makes sense when the query is expected to return only one link
78
+ * and the target of that link is what you are looking for.
79
+ *
80
+ * Works best together with @member setSingelTarget()
81
+ */
82
+ getSingleTarget(query: LinkQuery): Promise<string | void>;
83
+ /** Convenience function to ensure there is only one link with given source and predicate
84
+ * This function will remove all links with the same source and predicate as the given link,
85
+ * and then add the given link.
86
+ * This ensures there is only one target for the given source and predicate.
87
+ *
88
+ * Works best together with @member getSingleTarget()
89
+ */
90
+ setSingleTarget(link: Link, status?: LinkStatus): Promise<void>;
91
+ /** Returns all the Social DNA flows defined in this perspective */
92
+ sdnaFlows(): Promise<string[]>;
93
+ /** Returns all Social DNA flows that can be started from the given expression */
94
+ availableFlows(exprAddr: string): Promise<string[]>;
95
+ /** Starts the Social DNA flow @param flowName on the expression @param exprAddr */
96
+ startFlow(flowName: string, exprAddr: string): Promise<void>;
97
+ /** Returns all expressions in the given state of given Social DNA flow */
98
+ expressionsInFlowState(flowName: string, flowState: number): Promise<string[]>;
99
+ /** Returns the given expression's flow state with regard to given Social DNA flow */
100
+ flowState(flowName: string, exprAddr: string): Promise<number>;
101
+ /** Returns available action names, with regard to Social DNA flow and expression's flow state */
102
+ flowActions(flowName: string, exprAddr: string): Promise<string[]>;
103
+ /** Runs given Social DNA flow action */
104
+ runFlowAction(flowName: string, exprAddr: string, actionName: string): Promise<void>;
105
+ /** Returns the perspective's Social DNA code
106
+ * This will return all SDNA code elements in an array.
107
+ */
108
+ getSdna(): Promise<string[]>;
109
+ /** Adds the given Social DNA code to the perspective's SDNA code */
110
+ addSdna(name: string, sdnaCode: string, sdnaType: "subject_class" | "flow" | "custom"): Promise<boolean>;
111
+ /** Returns all the Subject classes defined in this perspectives SDNA */
112
+ subjectClasses(): Promise<string[]>;
113
+ stringOrTemplateObjectToSubjectClass<T>(subjectClass: T): Promise<string>;
114
+ /** Creates a new subject instance by running its (SDNA defined) constructor,
115
+ * which means adding links around the given expression address so that it
116
+ * conforms to the given subject class.
117
+ *
118
+ * @param subjectClass Either a string with the name of the subject class, or an object
119
+ * with the properties of the subject class. In the latter case, the first subject class
120
+ * that matches the given properties will be used.
121
+ * @param exprAddr The address of the expression to be turned into a subject instance
122
+ */
123
+ createSubject<T>(subjectClass: T, exprAddr: string): Promise<T>;
124
+ /** Removes a subject instance by running its (SDNA defined) destructor,
125
+ * which means removing links around the given expression address
126
+ *
127
+ * @param subjectClass Either a string with the name of the subject class, or an object
128
+ * with the properties of the subject class. In the latter case, the first subject class
129
+ * that matches the given properties will be used.
130
+ * @param exprAddr The address of the expression to be turned into a subject instance
131
+ */
132
+ removeSubject<T>(subjectClass: T, exprAddr: string): Promise<void>;
133
+ /** Checks if the given expression is a subject instance of the given subject class
134
+ * @param expression The expression to be checked
135
+ * @param subjectClass Either a string with the name of the subject class, or an object
136
+ * with the properties of the subject class. In the latter case, the first subject class
137
+ * that matches the given properties will be used.
138
+ */
139
+ isSubjectInstance<T>(expression: string, subjectClass: T): Promise<boolean>;
140
+ /** For an existing subject instance (existing in the perspective's links)
141
+ * this function returns a proxy object that can be used to access the subject's
142
+ * properties and methods.
143
+ *
144
+ * @param base URI of the subject's root expression
145
+ * @param subjectClass Either a string with the name of the subject class, or an object
146
+ * with the properties of the subject class. In the latter case, the first subject class
147
+ * that matches the given properties will be used.
148
+ */
149
+ getSubjectProxy<T>(base: string, subjectClass: T): Promise<T>;
150
+ /** Returns all subject instances of the given subject class as proxy objects.
151
+ * @param subjectClass Either a string with the name of the subject class, or an object
152
+ * with the properties of the subject class. In the latter case, all subject classes
153
+ * that match the given properties will be used.
154
+ */
155
+ getAllSubjectInstances<T>(subjectClass: T): Promise<T[]>;
156
+ getAllSubjectProxies<T>(subjectClass: T): Promise<T[]>;
157
+ /** Returns all subject classes that match the given template object.
158
+ * This function looks at the properties of the template object and
159
+ * its setters and collections to create a Prolog query that finds
160
+ * all subject classes that would be converted to a proxy object
161
+ * with exactly the same properties and collections.
162
+ *
163
+ * Since there could be multiple subject classes that match the given
164
+ * criteria, this function returns a list of class names.
165
+ *
166
+ * @param obj The template object
167
+ */
168
+ subjectClassesByTemplate(obj: object): Promise<string[]>;
169
+ /** Takes a JS class (its constructor) and assumes that it was decorated by
170
+ * the @subjectClass etc. decorators. It then tests if there is a subject class
171
+ * already present in the perspective's SDNA that matches the given class.
172
+ * If there is no such class, it gets the JS class's SDNA by calling its
173
+ * static generateSDNA() function and adds it to the perspective's SDNA.
174
+ */
175
+ ensureSDNASubjectClass(jsClass: any): Promise<void>;
176
+ getNeighbourhoodProxy(): NeighbourhoodProxy;
177
+ }
178
+ export {};