@coasys/ad4m 0.12.0-rc1-dev.1 → 0.12.0-rc1-dev.2

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 (128) hide show
  1. package/jest.config.js +4 -4
  2. package/lib/index.cjs +5999 -6046
  3. package/lib/index.js +5977 -6040
  4. package/lib/src/Ad4mClient.d.ts +16 -9
  5. package/lib/src/Ad4mClient.js +25 -46
  6. package/lib/src/Ad4mClient.test.d.ts +1 -0
  7. package/lib/src/Ad4mClient.test.js +1204 -0
  8. package/lib/src/Literal.d.ts +2 -1
  9. package/lib/src/Literal.js +35 -38
  10. package/lib/src/Literal.test.d.ts +1 -0
  11. package/lib/src/Literal.test.js +41 -0
  12. package/lib/src/SmartLiteral.d.ts +2 -1
  13. package/lib/src/SmartLiteral.js +15 -30
  14. package/lib/src/agent/AgentClient.d.ts +4 -1
  15. package/lib/src/agent/AgentClient.js +99 -79
  16. package/lib/src/ai/AIClient.d.ts +2 -1
  17. package/lib/src/ai/AIClient.js +220 -224
  18. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  19. package/lib/src/expression/ExpressionClient.js +86 -73
  20. package/lib/src/index.d.ts +1 -1
  21. package/lib/src/index.js +1 -1
  22. package/lib/src/language/LanguageClient.d.ts +1 -1
  23. package/lib/src/language/LanguageClient.js +52 -52
  24. package/lib/src/model/Ad4mModel.d.ts +157 -937
  25. package/lib/src/model/Ad4mModel.js +212 -2799
  26. package/lib/src/model/Ad4mModel.test.js +1002 -561
  27. package/lib/src/model/decorators.d.ts +94 -426
  28. package/lib/src/model/decorators.js +333 -741
  29. package/lib/src/model/mutation.d.ts +81 -0
  30. package/lib/src/model/mutation.js +317 -0
  31. package/lib/src/model/parentUtils.d.ts +32 -0
  32. package/lib/src/model/parentUtils.js +64 -0
  33. package/lib/src/model/prolog/generatePrologFacts.d.ts +36 -0
  34. package/lib/src/model/prolog/generatePrologFacts.js +139 -0
  35. package/lib/src/model/prolog/index.d.ts +1 -0
  36. package/lib/src/model/prolog/index.js +1 -0
  37. package/lib/src/model/query/ModelQueryBuilder.d.ts +82 -0
  38. package/lib/src/model/query/ModelQueryBuilder.js +115 -0
  39. package/lib/src/model/query/QueryBuilder.d.ts +101 -0
  40. package/lib/src/model/query/QueryBuilder.js +193 -0
  41. package/lib/src/model/query/SurrealQueryBuilder.d.ts +48 -0
  42. package/lib/src/model/query/SurrealQueryBuilder.js +371 -0
  43. package/lib/src/model/query/fetchInstance.d.ts +24 -0
  44. package/lib/src/model/query/fetchInstance.js +144 -0
  45. package/lib/src/model/query/hydration.d.ts +54 -0
  46. package/lib/src/model/query/hydration.js +214 -0
  47. package/lib/src/model/query/operations.d.ts +59 -0
  48. package/lib/src/model/query/operations.js +384 -0
  49. package/lib/src/model/query/snapshot.d.ts +59 -0
  50. package/lib/src/model/query/snapshot.js +106 -0
  51. package/lib/src/model/query/surrealCompiler.d.ts +42 -0
  52. package/lib/src/model/query/surrealCompiler.js +304 -0
  53. package/lib/src/model/schema/fromJSONSchema.d.ts +67 -0
  54. package/lib/src/model/schema/fromJSONSchema.js +264 -0
  55. package/lib/src/model/schema/metadata.d.ts +15 -0
  56. package/lib/src/model/schema/metadata.js +112 -0
  57. package/lib/src/model/subscription.d.ts +47 -0
  58. package/lib/src/model/subscription.js +231 -0
  59. package/lib/src/model/transaction.d.ts +27 -0
  60. package/lib/src/model/transaction.js +32 -0
  61. package/lib/src/model/types.d.ts +195 -0
  62. package/lib/src/model/types.js +8 -0
  63. package/lib/src/model/util.js +7 -7
  64. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +5 -1
  65. package/lib/src/neighbourhood/NeighbourhoodClient.js +263 -181
  66. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -1
  67. package/lib/src/neighbourhood/NeighbourhoodProxy.js +13 -28
  68. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +1 -5
  69. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  70. package/lib/src/perspectives/PerspectiveClient.js +316 -240
  71. package/lib/src/perspectives/PerspectiveProxy.d.ts +54 -92
  72. package/lib/src/perspectives/PerspectiveProxy.js +803 -444
  73. package/lib/src/runtime/RuntimeClient.d.ts +5 -1
  74. package/lib/src/runtime/RuntimeClient.js +412 -238
  75. package/lib/src/shacl/SHACLFlow.test.js +164 -105
  76. package/lib/src/shacl/SHACLShape.d.ts +17 -3
  77. package/lib/src/shacl/SHACLShape.js +127 -90
  78. package/lib/src/shacl/SHACLShape.test.js +244 -176
  79. package/lib/src/utils.d.ts +8 -0
  80. package/lib/src/utils.js +21 -7
  81. package/package.json +8 -13
  82. package/src/Ad4mClient.test.ts +1564 -1315
  83. package/src/Ad4mClient.ts +55 -54
  84. package/src/Literal.test.ts +45 -26
  85. package/src/Literal.ts +82 -66
  86. package/src/SmartLiteral.ts +74 -58
  87. package/src/agent/AgentClient.ts +144 -99
  88. package/src/ai/AIClient.ts +409 -359
  89. package/src/expression/ExpressionClient.ts +142 -96
  90. package/src/index.ts +1 -1
  91. package/src/language/LanguageClient.ts +137 -113
  92. package/src/model/Ad4mModel.test.ts +1128 -647
  93. package/src/model/Ad4mModel.ts +485 -3249
  94. package/src/model/IMPROVEMENTS.md +482 -0
  95. package/src/model/PREDICATE_COLLISION_FIX.md +651 -0
  96. package/src/model/README.md +317 -0
  97. package/src/model/SHACL_MUTATION_DECOUPLING.md +356 -0
  98. package/src/model/SUBSCRIPTION_STRATEGY.md +317 -0
  99. package/src/model/TC39_STAGE_3_DECORATORS.md +609 -0
  100. package/src/model/decorators.ts +689 -1046
  101. package/src/model/mutation.ts +461 -0
  102. package/src/model/parentUtils.ts +91 -0
  103. package/src/model/prolog/generatePrologFacts.ts +176 -0
  104. package/src/model/prolog/index.ts +1 -0
  105. package/src/model/query/ModelQueryBuilder.ts +173 -0
  106. package/src/model/query/fetchInstance.ts +181 -0
  107. package/src/model/query/hydration.ts +273 -0
  108. package/src/model/query/operations.ts +510 -0
  109. package/src/model/query/snapshot.ts +126 -0
  110. package/src/model/query/surrealCompiler.ts +376 -0
  111. package/src/model/schema/fromJSONSchema.ts +411 -0
  112. package/src/model/schema/metadata.ts +148 -0
  113. package/src/model/subscription.ts +307 -0
  114. package/src/model/transaction.ts +60 -0
  115. package/src/model/types.ts +207 -0
  116. package/src/model/util.ts +47 -48
  117. package/src/neighbourhood/NeighbourhoodClient.ts +393 -251
  118. package/src/neighbourhood/NeighbourhoodProxy.test.ts +3 -7
  119. package/src/neighbourhood/NeighbourhoodProxy.ts +58 -40
  120. package/src/perspectives/PerspectiveClient.ts +779 -540
  121. package/src/perspectives/PerspectiveProxy.ts +2860 -2053
  122. package/src/runtime/RuntimeClient.ts +775 -476
  123. package/src/shacl/SHACLFlow.test.ts +196 -129
  124. package/src/shacl/SHACLShape.test.ts +284 -190
  125. package/src/shacl/SHACLShape.ts +225 -172
  126. package/src/utils.ts +31 -17
  127. package/tsconfig.json +9 -10
  128. package/src/model/Subject.ts +0 -159
@@ -5,108 +5,154 @@ import { ExpressionRendered } from "./Expression";
5
5
  import { Literal } from "../Literal";
6
6
 
7
7
  export class ExpressionClient {
8
- #apolloClient: ApolloClient<any>
8
+ private _apolloClient: ApolloClient<any>;
9
9
 
10
- constructor(client: ApolloClient<any>) {
11
- this.#apolloClient = client
12
- }
10
+ constructor(client: ApolloClient<any>) {
11
+ this._apolloClient = client;
12
+ }
13
13
 
14
- async get(url: string, alwaysGet: boolean = false): Promise<ExpressionRendered> {
15
- if(!alwaysGet){
16
- try {
17
- let literalValue = Literal.fromUrl(url).get();
18
- if (typeof literalValue === 'object' && literalValue !== null) {
19
- if ('author' in literalValue && 'timestamp' in literalValue && 'data' in literalValue && 'proof' in literalValue) {
20
- return literalValue;
21
- }
22
- }
23
- } catch(e) {}
14
+ async get(
15
+ url: string,
16
+ alwaysGet: boolean = false,
17
+ ): Promise<ExpressionRendered> {
18
+ if (!alwaysGet) {
19
+ try {
20
+ let literalValue = Literal.fromUrl(url).get();
21
+ if (typeof literalValue === "object" && literalValue !== null) {
22
+ if (
23
+ "author" in literalValue &&
24
+ "timestamp" in literalValue &&
25
+ "data" in literalValue &&
26
+ "proof" in literalValue
27
+ ) {
28
+ return literalValue;
29
+ }
24
30
  }
25
-
26
-
27
- const { expression } = unwrapApolloResult(await this.#apolloClient.query({
28
- query: gql`query expression($url: String!) {
29
- expression(url: $url) {
30
- author
31
- timestamp
32
- data
33
- language {
34
- address
35
- }
36
- proof {
37
- valid
38
- invalid
39
- }
40
- }
41
- }`,
42
- variables: { url }
43
- }))
44
- return expression
31
+ } catch (e) {}
45
32
  }
46
33
 
47
- async getMany(urls: string[]): Promise<ExpressionRendered[]> {
48
- const { expressionMany } = unwrapApolloResult(await this.#apolloClient.query({
49
- query: gql`query expressionMany($urls: [String!]!) {
50
- expressionMany(urls: $urls) {
51
- author
52
- timestamp
53
- data
54
- language {
55
- address
56
- }
57
- proof {
58
- valid
59
- invalid
60
- }
61
- }
62
- }`,
63
- variables: { urls }
64
- }))
65
- return expressionMany
66
- }
34
+ const { expression } = unwrapApolloResult(
35
+ await this._apolloClient.query({
36
+ query: gql`
37
+ query expression($url: String!) {
38
+ expression(url: $url) {
39
+ author
40
+ timestamp
41
+ data
42
+ language {
43
+ address
44
+ }
45
+ proof {
46
+ valid
47
+ invalid
48
+ }
49
+ }
50
+ }
51
+ `,
52
+ variables: { url },
53
+ }),
54
+ );
55
+ return expression;
56
+ }
67
57
 
68
- async getRaw(url: string): Promise<string> {
69
- const { expressionRaw } = unwrapApolloResult(await this.#apolloClient.query({
70
- query: gql`query expressionRaw($url: String!) {
71
- expressionRaw(url: $url)
72
- }`,
73
- variables: { url }
74
- }))
75
- return expressionRaw
76
- }
58
+ async getMany(urls: string[]): Promise<ExpressionRendered[]> {
59
+ const { expressionMany } = unwrapApolloResult(
60
+ await this._apolloClient.query({
61
+ query: gql`
62
+ query expressionMany($urls: [String!]!) {
63
+ expressionMany(urls: $urls) {
64
+ author
65
+ timestamp
66
+ data
67
+ language {
68
+ address
69
+ }
70
+ proof {
71
+ valid
72
+ invalid
73
+ }
74
+ }
75
+ }
76
+ `,
77
+ variables: { urls },
78
+ }),
79
+ );
80
+ return expressionMany;
81
+ }
77
82
 
78
- async create(content: any, languageAddress: string): Promise<string> {
79
- content = JSON.stringify(content)
80
- const { expressionCreate } = unwrapApolloResult(await this.#apolloClient.mutate({
81
- mutation: gql`mutation expressionCreate($content: String!, $languageAddress: String!){
82
- expressionCreate(content: $content, languageAddress: $languageAddress)
83
- }`,
84
- variables: { content, languageAddress }
85
- }))
86
- return expressionCreate
87
- }
83
+ async getRaw(url: string): Promise<string> {
84
+ const { expressionRaw } = unwrapApolloResult(
85
+ await this._apolloClient.query({
86
+ query: gql`
87
+ query expressionRaw($url: String!) {
88
+ expressionRaw(url: $url)
89
+ }
90
+ `,
91
+ variables: { url },
92
+ }),
93
+ );
94
+ return expressionRaw;
95
+ }
88
96
 
89
- async interactions(url: string): Promise<InteractionMeta[]> {
90
- const { expressionInteractions } = unwrapApolloResult(await this.#apolloClient.query({
91
- query: gql`query expressionInteractions($url: String!) {
92
- expressionInteractions(url: $url) {
93
- label
94
- name
95
- parameters { name, type }
96
- }
97
- }`,
98
- variables: { url }
99
- }))
100
- return expressionInteractions
101
- }
97
+ async create(content: any, languageAddress: string): Promise<string> {
98
+ content = JSON.stringify(content);
99
+ const { expressionCreate } = unwrapApolloResult(
100
+ await this._apolloClient.mutate({
101
+ mutation: gql`
102
+ mutation expressionCreate(
103
+ $content: String!
104
+ $languageAddress: String!
105
+ ) {
106
+ expressionCreate(
107
+ content: $content
108
+ languageAddress: $languageAddress
109
+ )
110
+ }
111
+ `,
112
+ variables: { content, languageAddress },
113
+ }),
114
+ );
115
+ return expressionCreate;
116
+ }
102
117
 
103
- async interact(url: string, interactionCall: InteractionCall): Promise<string|null> {
104
- const { expressionInteract } = unwrapApolloResult(await this.#apolloClient.mutate({
105
- mutation: gql`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
106
- expressionInteract(url: $url, interactionCall: $interactionCall)
107
- }`,
108
- variables: { url, interactionCall }
109
- }))
110
- return expressionInteract
111
- }
112
- }
118
+ async interactions(url: string): Promise<InteractionMeta[]> {
119
+ const { expressionInteractions } = unwrapApolloResult(
120
+ await this._apolloClient.query({
121
+ query: gql`
122
+ query expressionInteractions($url: String!) {
123
+ expressionInteractions(url: $url) {
124
+ label
125
+ name
126
+ parameters {
127
+ name
128
+ type
129
+ }
130
+ }
131
+ }
132
+ `,
133
+ variables: { url },
134
+ }),
135
+ );
136
+ return expressionInteractions;
137
+ }
138
+
139
+ async interact(
140
+ url: string,
141
+ interactionCall: InteractionCall,
142
+ ): Promise<string | null> {
143
+ const { expressionInteract } = unwrapApolloResult(
144
+ await this._apolloClient.mutate({
145
+ mutation: gql`
146
+ mutation expressionInteract(
147
+ $url: String!
148
+ $interactionCall: InteractionCall!
149
+ ) {
150
+ expressionInteract(url: $url, interactionCall: $interactionCall)
151
+ }
152
+ `,
153
+ variables: { url, interactionCall },
154
+ }),
155
+ );
156
+ return expressionInteract;
157
+ }
158
+ }
package/src/index.ts CHANGED
@@ -20,7 +20,7 @@ export * from "./perspectives/PerspectiveDiff";
20
20
  export * from "./perspectives/LinkQuery";
21
21
  export * from "./SmartLiteral";
22
22
  export * from "./model/decorators";
23
- export * from "./model/Subject";
23
+ export * from "./model/prolog";
24
24
  export * from "./neighbourhood/Neighbourhood";
25
25
  export * from "./neighbourhood/NeighbourhoodProxy";
26
26
  export * from "./typeDefs";
@@ -1,8 +1,8 @@
1
- import { ApolloClient, gql } from "@apollo/client/core"
2
- import unwrapApolloResult from "../unwrapApolloResult"
3
- import { LanguageHandle } from "./LanguageHandle"
4
- import { LanguageMeta, LanguageMetaInput } from "./LanguageMeta"
5
- import { LanguageRef } from "./LanguageRef"
1
+ import { ApolloClient, gql } from "@apollo/client/core";
2
+ import unwrapApolloResult from "../unwrapApolloResult";
3
+ import { LanguageHandle } from "./LanguageHandle";
4
+ import { LanguageMeta, LanguageMetaInput } from "./LanguageMeta";
5
+ import { LanguageRef } from "./LanguageRef";
6
6
 
7
7
  const LANGUAGE_COMPLETE = `
8
8
  name
@@ -11,7 +11,7 @@ const LANGUAGE_COMPLETE = `
11
11
  icon { code }
12
12
  constructorIcon { code }
13
13
  settingsIcon { code }
14
- `
14
+ `;
15
15
 
16
16
  const LANGUAGE_META = `
17
17
  name
@@ -23,81 +23,104 @@ const LANGUAGE_META = `
23
23
  templateAppliedParams
24
24
  possibleTemplateParams
25
25
  sourceCodeLink
26
- `
26
+ `;
27
27
 
28
28
  export class LanguageClient {
29
- #apolloClient: ApolloClient<any>
29
+ private _apolloClient: ApolloClient<any>;
30
30
 
31
- constructor(apolloClient: ApolloClient<any>) {
32
- this.#apolloClient = apolloClient
33
- }
31
+ constructor(apolloClient: ApolloClient<any>) {
32
+ this._apolloClient = apolloClient;
33
+ }
34
34
 
35
- async byAddress(address: string): Promise<LanguageHandle> {
36
- const { language } = unwrapApolloResult(await this.#apolloClient.query({
37
- query: gql`query byAddress($address: String!) {
35
+ async byAddress(address: string): Promise<LanguageHandle> {
36
+ const { language } = unwrapApolloResult(
37
+ await this._apolloClient.query({
38
+ query: gql`query byAddress($address: String!) {
38
39
  language(address: $address) {
39
40
  ${LANGUAGE_COMPLETE}
40
41
  }
41
42
  }`,
42
- variables: { address }
43
- }))
44
- return language
45
- }
46
-
47
- async byFilter(filter: string): Promise<LanguageHandle[]> {
48
- const { languages } = unwrapApolloResult(await this.#apolloClient.query({
49
- query: gql`query byFilter($filter: String!) {
43
+ variables: { address },
44
+ }),
45
+ );
46
+ return language;
47
+ }
48
+
49
+ async byFilter(filter: string): Promise<LanguageHandle[]> {
50
+ const { languages } = unwrapApolloResult(
51
+ await this._apolloClient.query({
52
+ query: gql`query byFilter($filter: String!) {
50
53
  languages(filter: $filter) {
51
54
  ${LANGUAGE_COMPLETE}
52
55
  }
53
56
  }`,
54
- variables: { filter }
55
- }))
56
- return languages
57
- }
58
-
59
- async all(): Promise<LanguageHandle[]> {
60
- return this.byFilter('')
61
- }
62
-
63
- async writeSettings(
64
- languageAddress: string,
65
- settings: string
66
- ): Promise<Boolean> {
67
- const { languageWriteSettings } = unwrapApolloResult(await this.#apolloClient.mutate({
68
- mutation: gql`mutation writeSettings($languageAddress: String!, $settings: String!) {
69
- languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
70
- }`,
71
- variables: { languageAddress, settings }
72
- }))
73
- return languageWriteSettings
74
- }
75
-
76
- async applyTemplateAndPublish(
77
- sourceLanguageHash: string,
78
- templateData: string
79
- ): Promise<LanguageRef> {
80
- const { languageApplyTemplateAndPublish } = unwrapApolloResult(await this.#apolloClient.mutate({
81
- mutation: gql`mutation languageApplyTemplateAndPublish(
82
- $sourceLanguageHash: String!,
83
- $templateData: String!,
57
+ variables: { filter },
58
+ }),
59
+ );
60
+ return languages;
61
+ }
62
+
63
+ async all(): Promise<LanguageHandle[]> {
64
+ return this.byFilter("");
65
+ }
66
+
67
+ async writeSettings(
68
+ languageAddress: string,
69
+ settings: string,
70
+ ): Promise<Boolean> {
71
+ const { languageWriteSettings } = unwrapApolloResult(
72
+ await this._apolloClient.mutate({
73
+ mutation: gql`
74
+ mutation writeSettings(
75
+ $languageAddress: String!
76
+ $settings: String!
77
+ ) {
78
+ languageWriteSettings(
79
+ languageAddress: $languageAddress
80
+ settings: $settings
81
+ )
82
+ }
83
+ `,
84
+ variables: { languageAddress, settings },
85
+ }),
86
+ );
87
+ return languageWriteSettings;
88
+ }
89
+
90
+ async applyTemplateAndPublish(
91
+ sourceLanguageHash: string,
92
+ templateData: string,
93
+ ): Promise<LanguageRef> {
94
+ const { languageApplyTemplateAndPublish } = unwrapApolloResult(
95
+ await this._apolloClient.mutate({
96
+ mutation: gql`
97
+ mutation languageApplyTemplateAndPublish(
98
+ $sourceLanguageHash: String!
99
+ $templateData: String!
100
+ ) {
101
+ languageApplyTemplateAndPublish(
102
+ sourceLanguageHash: $sourceLanguageHash
103
+ templateData: $templateData
84
104
  ) {
85
- languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
86
- name, address
87
- }
88
- }`,
89
- variables: { sourceLanguageHash, templateData }
90
- }))
91
-
92
- return languageApplyTemplateAndPublish
93
- }
94
-
95
- async publish(
96
- languagePath: string,
97
- languageMeta: LanguageMetaInput
98
- ): Promise<LanguageMeta> {
99
- const { languagePublish } = unwrapApolloResult(await this.#apolloClient.mutate({
100
- mutation: gql`mutation languagePublish(
105
+ name
106
+ address
107
+ }
108
+ }
109
+ `,
110
+ variables: { sourceLanguageHash, templateData },
111
+ }),
112
+ );
113
+
114
+ return languageApplyTemplateAndPublish;
115
+ }
116
+
117
+ async publish(
118
+ languagePath: string,
119
+ languageMeta: LanguageMetaInput,
120
+ ): Promise<LanguageMeta> {
121
+ const { languagePublish } = unwrapApolloResult(
122
+ await this._apolloClient.mutate({
123
+ mutation: gql`mutation languagePublish(
101
124
  $languagePath: String!,
102
125
  $languageMeta: LanguageMetaInput!,
103
126
  ) {
@@ -105,56 +128,57 @@ export class LanguageClient {
105
128
  ${LANGUAGE_META}
106
129
  }
107
130
  }`,
108
- variables: { languagePath, languageMeta }
109
- }))
131
+ variables: { languagePath, languageMeta },
132
+ }),
133
+ );
110
134
 
111
- return languagePublish
112
- }
135
+ return languagePublish;
136
+ }
113
137
 
114
- async meta(
115
- address: string,
116
- ): Promise<LanguageMeta> {
117
- const { languageMeta } = unwrapApolloResult(await this.#apolloClient.query({
118
- query: gql`query languageMeta(
138
+ async meta(address: string): Promise<LanguageMeta> {
139
+ const { languageMeta } = unwrapApolloResult(
140
+ await this._apolloClient.query({
141
+ query: gql`query languageMeta(
119
142
  $address: String!,
120
143
  ) {
121
144
  languageMeta(address: $address) {
122
145
  ${LANGUAGE_META}
123
146
  }
124
147
  }`,
125
- variables: { address }
126
- }))
127
-
128
- return languageMeta
129
- }
130
-
131
- async source(
132
- address: string,
133
- ): Promise<string> {
134
- const { languageSource } = unwrapApolloResult(await this.#apolloClient.query({
135
- query: gql`query languageSource(
136
- $address: String!,
137
- ) {
138
- languageSource(address: $address)
139
- }`,
140
- variables: { address }
141
- }))
142
-
143
- return languageSource
144
- }
145
-
146
- async remove(
147
- address: string
148
- ): Promise<Boolean> {
149
- const { languageRemove } = unwrapApolloResult(await this.#apolloClient.mutate({
150
- mutation: gql`mutation languageRemove(
151
- $address: String!,
152
- ) {
153
- languageRemove(address: $address)
154
- }`,
155
- variables: { address }
156
- }))
157
-
158
- return languageRemove
159
- }
160
- }
148
+ variables: { address },
149
+ }),
150
+ );
151
+
152
+ return languageMeta;
153
+ }
154
+
155
+ async source(address: string): Promise<string> {
156
+ const { languageSource } = unwrapApolloResult(
157
+ await this._apolloClient.query({
158
+ query: gql`
159
+ query languageSource($address: String!) {
160
+ languageSource(address: $address)
161
+ }
162
+ `,
163
+ variables: { address },
164
+ }),
165
+ );
166
+
167
+ return languageSource;
168
+ }
169
+
170
+ async remove(address: string): Promise<Boolean> {
171
+ const { languageRemove } = unwrapApolloResult(
172
+ await this._apolloClient.mutate({
173
+ mutation: gql`
174
+ mutation languageRemove($address: String!) {
175
+ languageRemove(address: $address)
176
+ }
177
+ `,
178
+ variables: { address },
179
+ }),
180
+ );
181
+
182
+ return languageRemove;
183
+ }
184
+ }