@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,32 +1,32 @@
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
+ 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,70 +1,70 @@
1
- /*
2
- This "shim" can be used on the frontend to prevent from errors on undefined decorators,
3
- when you are sharing same classes across backend and frontend.
4
-
5
- To use this shim, simply set up your Webpack configuration
6
- to use this file instead of a normal TypeGraphQL module.
7
-
8
- ```js
9
- plugins: [
10
- // ...here are any other existing plugins that you already have
11
- new webpack.NormalModuleReplacementPlugin(/type-graphql$/, resource => {
12
- resource.request = resource.request.replace(/type-graphql/, "type-graphql/dist/browser-shim");
13
- }),
14
- ]
15
- ```
16
-
17
- However, in some TypeScript projects like the ones using Angular,
18
- which AoT compiler requires that a full `*.ts` file is provided
19
- instead of just a `*.js` and `*.d.ts` files, to use this shim
20
- we have to simply set up our TypeScript configuration in `tsconfig.json`
21
- to use this file instead of a normal TypeGraphQL module:
22
-
23
- ```json
24
- {
25
- "compilerOptions": {
26
- "baseUrl": ".",
27
- "paths": {
28
- "type-graphql": [
29
- "./node_modules/type-graphql/dist/browser-shim.ts"
30
- ]
31
- }
32
- }
33
- }
34
- ```
35
- */
36
- export const dummyValue = "";
37
- export function dummyFn() {
38
- return;
39
- }
40
- export function dummyDecorator() {
41
- return dummyFn;
42
- }
43
- export const Arg = dummyDecorator;
44
- export const Args = dummyDecorator;
45
- export const ArgsType = dummyDecorator;
46
- export const Authorized = dummyDecorator;
47
- export const Ctx = dummyDecorator;
48
- export const registerEnumType = dummyFn;
49
- export const Field = dummyDecorator;
50
- export const FieldResolver = dummyDecorator;
51
- export const Info = dummyDecorator;
52
- export const InputType = dummyDecorator;
53
- export const InterfaceType = dummyDecorator;
54
- export const Mutation = dummyDecorator;
55
- export const ObjectType = dummyDecorator;
56
- export const PubSub = dummyDecorator;
57
- export const Query = dummyDecorator;
58
- export const Resolver = dummyDecorator;
59
- export const Root = dummyDecorator;
60
- export const Subscription = dummyDecorator;
61
- export const createUnionType = dummyFn;
62
- export const UseMiddleware = dummyDecorator;
63
- export const PubSubEngine = dummyDecorator;
64
- export class ClassType {
65
- }
66
- export const Int = dummyValue;
67
- export const Float = dummyValue;
68
- export const ID = dummyValue;
69
- export const GraphQLISODateTime = dummyValue;
70
- export const GraphQLTimestamp = dummyValue;
1
+ /*
2
+ This "shim" can be used on the frontend to prevent from errors on undefined decorators,
3
+ when you are sharing same classes across backend and frontend.
4
+
5
+ To use this shim, simply set up your Webpack configuration
6
+ to use this file instead of a normal TypeGraphQL module.
7
+
8
+ ```js
9
+ plugins: [
10
+ // ...here are any other existing plugins that you already have
11
+ new webpack.NormalModuleReplacementPlugin(/type-graphql$/, resource => {
12
+ resource.request = resource.request.replace(/type-graphql/, "type-graphql/dist/browser-shim");
13
+ }),
14
+ ]
15
+ ```
16
+
17
+ However, in some TypeScript projects like the ones using Angular,
18
+ which AoT compiler requires that a full `*.ts` file is provided
19
+ instead of just a `*.js` and `*.d.ts` files, to use this shim
20
+ we have to simply set up our TypeScript configuration in `tsconfig.json`
21
+ to use this file instead of a normal TypeGraphQL module:
22
+
23
+ ```json
24
+ {
25
+ "compilerOptions": {
26
+ "baseUrl": ".",
27
+ "paths": {
28
+ "type-graphql": [
29
+ "./node_modules/type-graphql/dist/browser-shim.ts"
30
+ ]
31
+ }
32
+ }
33
+ }
34
+ ```
35
+ */
36
+ export const dummyValue = "";
37
+ export function dummyFn() {
38
+ return;
39
+ }
40
+ export function dummyDecorator() {
41
+ return dummyFn;
42
+ }
43
+ export const Arg = dummyDecorator;
44
+ export const Args = dummyDecorator;
45
+ export const ArgsType = dummyDecorator;
46
+ export const Authorized = dummyDecorator;
47
+ export const Ctx = dummyDecorator;
48
+ export const registerEnumType = dummyFn;
49
+ export const Field = dummyDecorator;
50
+ export const FieldResolver = dummyDecorator;
51
+ export const Info = dummyDecorator;
52
+ export const InputType = dummyDecorator;
53
+ export const InterfaceType = dummyDecorator;
54
+ export const Mutation = dummyDecorator;
55
+ export const ObjectType = dummyDecorator;
56
+ export const PubSub = dummyDecorator;
57
+ export const Query = dummyDecorator;
58
+ export const Resolver = dummyDecorator;
59
+ export const Root = dummyDecorator;
60
+ export const Subscription = dummyDecorator;
61
+ export const createUnionType = dummyFn;
62
+ export const UseMiddleware = dummyDecorator;
63
+ export const PubSubEngine = dummyDecorator;
64
+ export class ClassType {
65
+ }
66
+ export const Int = dummyValue;
67
+ export const Float = dummyValue;
68
+ export const ID = dummyValue;
69
+ export const GraphQLISODateTime = dummyValue;
70
+ export const GraphQLTimestamp = dummyValue;
@@ -1,26 +1,26 @@
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
- /**
9
- * Client for the Ad4m interface wrapping GraphQL queryies
10
- * for convenient use in user facing code.
11
- *
12
- * Aggregates the six sub-clients:
13
- * AgentClient, ExpressionClient, LanguageClient,
14
- * NeighbourhoodClient, PerspectiveClient and RuntimeClient
15
- * for the respective functionality.
16
- */
17
- export declare class Ad4mClient {
18
- #private;
19
- constructor(client: ApolloClient<any>, subscribe?: boolean);
20
- get agent(): AgentClient;
21
- get expression(): ExpressionClient;
22
- get languages(): LanguageClient;
23
- get neighbourhood(): NeighbourhoodClient;
24
- get perspective(): PerspectiveClient;
25
- get runtime(): RuntimeClient;
26
- }
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
+ /**
9
+ * Client for the Ad4m interface wrapping GraphQL queryies
10
+ * for convenient use in user facing code.
11
+ *
12
+ * Aggregates the six sub-clients:
13
+ * AgentClient, ExpressionClient, LanguageClient,
14
+ * NeighbourhoodClient, PerspectiveClient and RuntimeClient
15
+ * for the respective functionality.
16
+ */
17
+ export declare class Ad4mClient {
18
+ #private;
19
+ constructor(client: ApolloClient<any>, subscribe?: boolean);
20
+ get agent(): AgentClient;
21
+ get expression(): ExpressionClient;
22
+ get languages(): LanguageClient;
23
+ get neighbourhood(): NeighbourhoodClient;
24
+ get perspective(): PerspectiveClient;
25
+ get runtime(): RuntimeClient;
26
+ }
@@ -1,66 +1,66 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _Ad4mClient_apolloClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient;
13
- import { AgentClient } from './agent/AgentClient';
14
- import { LanguageClient } from './language/LanguageClient';
15
- import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
16
- import { PerspectiveClient } from './perspectives/PerspectiveClient';
17
- import { RuntimeClient } from './runtime/RuntimeClient';
18
- import { ExpressionClient } from './expression/ExpressionClient';
19
- /**
20
- * Client for the Ad4m interface wrapping GraphQL queryies
21
- * for convenient use in user facing code.
22
- *
23
- * Aggregates the six sub-clients:
24
- * AgentClient, ExpressionClient, LanguageClient,
25
- * NeighbourhoodClient, PerspectiveClient and RuntimeClient
26
- * for the respective functionality.
27
- */
28
- export class Ad4mClient {
29
- constructor(client, subscribe = true) {
30
- _Ad4mClient_apolloClient.set(this, void 0);
31
- _Ad4mClient_agentClient.set(this, void 0);
32
- _Ad4mClient_expressionClient.set(this, void 0);
33
- _Ad4mClient_languageClient.set(this, void 0);
34
- _Ad4mClient_neighbourhoodClient.set(this, void 0);
35
- _Ad4mClient_perspectiveClient.set(this, void 0);
36
- _Ad4mClient_runtimeClient.set(this, void 0);
37
- __classPrivateFieldSet(this, _Ad4mClient_apolloClient, client, "f");
38
- __classPrivateFieldSet(this, _Ad4mClient_agentClient, new AgentClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
39
- __classPrivateFieldSet(this, _Ad4mClient_expressionClient, new ExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
40
- __classPrivateFieldSet(this, _Ad4mClient_languageClient, new LanguageClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
41
- __classPrivateFieldSet(this, _Ad4mClient_neighbourhoodClient, new NeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
42
- __classPrivateFieldSet(this, _Ad4mClient_perspectiveClient, new PerspectiveClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
43
- __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f"));
44
- __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f"));
45
- __classPrivateFieldSet(this, _Ad4mClient_runtimeClient, new RuntimeClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
46
- }
47
- get agent() {
48
- return __classPrivateFieldGet(this, _Ad4mClient_agentClient, "f");
49
- }
50
- get expression() {
51
- return __classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f");
52
- }
53
- get languages() {
54
- return __classPrivateFieldGet(this, _Ad4mClient_languageClient, "f");
55
- }
56
- get neighbourhood() {
57
- return __classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f");
58
- }
59
- get perspective() {
60
- return __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f");
61
- }
62
- get runtime() {
63
- return __classPrivateFieldGet(this, _Ad4mClient_runtimeClient, "f");
64
- }
65
- }
66
- _Ad4mClient_apolloClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap();
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _Ad4mClient_apolloClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient;
13
+ import { AgentClient } from './agent/AgentClient';
14
+ import { LanguageClient } from './language/LanguageClient';
15
+ import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
16
+ import { PerspectiveClient } from './perspectives/PerspectiveClient';
17
+ import { RuntimeClient } from './runtime/RuntimeClient';
18
+ import { ExpressionClient } from './expression/ExpressionClient';
19
+ /**
20
+ * Client for the Ad4m interface wrapping GraphQL queryies
21
+ * for convenient use in user facing code.
22
+ *
23
+ * Aggregates the six sub-clients:
24
+ * AgentClient, ExpressionClient, LanguageClient,
25
+ * NeighbourhoodClient, PerspectiveClient and RuntimeClient
26
+ * for the respective functionality.
27
+ */
28
+ export class Ad4mClient {
29
+ constructor(client, subscribe = true) {
30
+ _Ad4mClient_apolloClient.set(this, void 0);
31
+ _Ad4mClient_agentClient.set(this, void 0);
32
+ _Ad4mClient_expressionClient.set(this, void 0);
33
+ _Ad4mClient_languageClient.set(this, void 0);
34
+ _Ad4mClient_neighbourhoodClient.set(this, void 0);
35
+ _Ad4mClient_perspectiveClient.set(this, void 0);
36
+ _Ad4mClient_runtimeClient.set(this, void 0);
37
+ __classPrivateFieldSet(this, _Ad4mClient_apolloClient, client, "f");
38
+ __classPrivateFieldSet(this, _Ad4mClient_agentClient, new AgentClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
39
+ __classPrivateFieldSet(this, _Ad4mClient_expressionClient, new ExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
40
+ __classPrivateFieldSet(this, _Ad4mClient_languageClient, new LanguageClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
41
+ __classPrivateFieldSet(this, _Ad4mClient_neighbourhoodClient, new NeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
42
+ __classPrivateFieldSet(this, _Ad4mClient_perspectiveClient, new PerspectiveClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
43
+ __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f"));
44
+ __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f"));
45
+ __classPrivateFieldSet(this, _Ad4mClient_runtimeClient, new RuntimeClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
46
+ }
47
+ get agent() {
48
+ return __classPrivateFieldGet(this, _Ad4mClient_agentClient, "f");
49
+ }
50
+ get expression() {
51
+ return __classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f");
52
+ }
53
+ get languages() {
54
+ return __classPrivateFieldGet(this, _Ad4mClient_languageClient, "f");
55
+ }
56
+ get neighbourhood() {
57
+ return __classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f");
58
+ }
59
+ get perspective() {
60
+ return __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f");
61
+ }
62
+ get runtime() {
63
+ return __classPrivateFieldGet(this, _Ad4mClient_runtimeClient, "f");
64
+ }
65
+ }
66
+ _Ad4mClient_apolloClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap();
@@ -1 +1 @@
1
- export type Address = string;
1
+ export type Address = string;
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/lib/src/DID.d.ts CHANGED
@@ -1 +1 @@
1
- export type DID = string;
1
+ export type DID = string;
package/lib/src/DID.js CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,6 +1,6 @@
1
- export declare enum ExceptionType {
2
- LanguageIsNotLoaded = 0,
3
- ExpressionIsNotVerified = 1,
4
- AgentIsUntrusted = 2,
5
- CapabilityRequested = 3
6
- }
1
+ export declare enum ExceptionType {
2
+ LanguageIsNotLoaded = 0,
3
+ ExpressionIsNotVerified = 1,
4
+ AgentIsUntrusted = 2,
5
+ CapabilityRequested = 3
6
+ }
@@ -1,7 +1,7 @@
1
- export var ExceptionType;
2
- (function (ExceptionType) {
3
- ExceptionType[ExceptionType["LanguageIsNotLoaded"] = 0] = "LanguageIsNotLoaded";
4
- ExceptionType[ExceptionType["ExpressionIsNotVerified"] = 1] = "ExpressionIsNotVerified";
5
- ExceptionType[ExceptionType["AgentIsUntrusted"] = 2] = "AgentIsUntrusted";
6
- ExceptionType[ExceptionType["CapabilityRequested"] = 3] = "CapabilityRequested";
7
- })(ExceptionType || (ExceptionType = {}));
1
+ export var ExceptionType;
2
+ (function (ExceptionType) {
3
+ ExceptionType[ExceptionType["LanguageIsNotLoaded"] = 0] = "LanguageIsNotLoaded";
4
+ ExceptionType[ExceptionType["ExpressionIsNotVerified"] = 1] = "ExpressionIsNotVerified";
5
+ ExceptionType[ExceptionType["AgentIsUntrusted"] = 2] = "AgentIsUntrusted";
6
+ ExceptionType[ExceptionType["CapabilityRequested"] = 3] = "CapabilityRequested";
7
+ })(ExceptionType || (ExceptionType = {}));
@@ -1,7 +1,7 @@
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
+ 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,76 +1,76 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _Literal_literal, _Literal_url;
13
- function encodeRFC3986URIComponent(str) {
14
- return encodeURIComponent(str)
15
- .replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
16
- }
17
- export class Literal {
18
- constructor() {
19
- _Literal_literal.set(this, void 0);
20
- _Literal_url.set(this, void 0);
21
- }
22
- static fromUrl(url) {
23
- if (!url || !url.startsWith("literal://"))
24
- throw new Error("Can't create Literal from non-literal URL");
25
- const l = new Literal();
26
- __classPrivateFieldSet(l, _Literal_url, url, "f");
27
- return l;
28
- }
29
- static from(literal) {
30
- const l = new Literal();
31
- __classPrivateFieldSet(l, _Literal_literal, literal, "f");
32
- return l;
33
- }
34
- toUrl() {
35
- if (__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
36
- return __classPrivateFieldGet(this, _Literal_url, "f");
37
- if (!__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
38
- throw new Error("Can't turn empty Literal into URL");
39
- let encoded;
40
- switch (typeof __classPrivateFieldGet(this, _Literal_literal, "f")) {
41
- case 'string':
42
- encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
43
- break;
44
- case 'number':
45
- encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
46
- break;
47
- case 'object':
48
- encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet(this, _Literal_literal, "f")))}`;
49
- break;
50
- }
51
- return `literal://${encoded}`;
52
- }
53
- get() {
54
- if (__classPrivateFieldGet(this, _Literal_literal, "f"))
55
- return __classPrivateFieldGet(this, _Literal_literal, "f");
56
- if (!__classPrivateFieldGet(this, _Literal_url, "f"))
57
- throw new Error("Can't render empty Literal");
58
- if (!__classPrivateFieldGet(this, _Literal_url, "f").startsWith("literal://"))
59
- throw new Error("Can't render Literal from non-literal URL");
60
- // get rid of "literal://"
61
- const body = __classPrivateFieldGet(this, _Literal_url, "f").substring(10);
62
- if (body.startsWith("string:")) {
63
- return decodeURIComponent(body.substring(7));
64
- }
65
- if (body.startsWith("number:")) {
66
- const numberString = body.substring(7);
67
- return parseFloat(numberString);
68
- }
69
- if (body.startsWith("json:")) {
70
- const json = body.substring(5);
71
- return JSON.parse(decodeURIComponent(json));
72
- }
73
- throw new Error(`Can't parse unknown literal: ${body}`);
74
- }
75
- }
76
- _Literal_literal = new WeakMap(), _Literal_url = new WeakMap();
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _Literal_literal, _Literal_url;
13
+ function encodeRFC3986URIComponent(str) {
14
+ return encodeURIComponent(str)
15
+ .replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
16
+ }
17
+ export class Literal {
18
+ constructor() {
19
+ _Literal_literal.set(this, void 0);
20
+ _Literal_url.set(this, void 0);
21
+ }
22
+ static fromUrl(url) {
23
+ if (!url || !url.startsWith("literal://"))
24
+ throw new Error("Can't create Literal from non-literal URL");
25
+ const l = new Literal();
26
+ __classPrivateFieldSet(l, _Literal_url, url, "f");
27
+ return l;
28
+ }
29
+ static from(literal) {
30
+ const l = new Literal();
31
+ __classPrivateFieldSet(l, _Literal_literal, literal, "f");
32
+ return l;
33
+ }
34
+ toUrl() {
35
+ if (__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
36
+ return __classPrivateFieldGet(this, _Literal_url, "f");
37
+ if (!__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
38
+ throw new Error("Can't turn empty Literal into URL");
39
+ let encoded;
40
+ switch (typeof __classPrivateFieldGet(this, _Literal_literal, "f")) {
41
+ case 'string':
42
+ encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
43
+ break;
44
+ case 'number':
45
+ encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
46
+ break;
47
+ case 'object':
48
+ encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet(this, _Literal_literal, "f")))}`;
49
+ break;
50
+ }
51
+ return `literal://${encoded}`;
52
+ }
53
+ get() {
54
+ if (__classPrivateFieldGet(this, _Literal_literal, "f"))
55
+ return __classPrivateFieldGet(this, _Literal_literal, "f");
56
+ if (!__classPrivateFieldGet(this, _Literal_url, "f"))
57
+ throw new Error("Can't render empty Literal");
58
+ if (!__classPrivateFieldGet(this, _Literal_url, "f").startsWith("literal://"))
59
+ throw new Error("Can't render Literal from non-literal URL");
60
+ // get rid of "literal://"
61
+ const body = __classPrivateFieldGet(this, _Literal_url, "f").substring(10);
62
+ if (body.startsWith("string:")) {
63
+ return decodeURIComponent(body.substring(7));
64
+ }
65
+ if (body.startsWith("number:")) {
66
+ const numberString = body.substring(7);
67
+ return parseFloat(numberString);
68
+ }
69
+ if (body.startsWith("json:")) {
70
+ const json = body.substring(5);
71
+ return JSON.parse(decodeURIComponent(json));
72
+ }
73
+ throw new Error(`Can't parse unknown literal: ${body}`);
74
+ }
75
+ }
76
+ _Literal_literal = new WeakMap(), _Literal_url = new WeakMap();