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

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 (153) hide show
  1. package/jest.config.js +10 -3
  2. package/lib/index.cjs +6893 -5884
  3. package/lib/index.js +6889 -5872
  4. package/lib/src/Ad4mClient.d.ts +9 -16
  5. package/lib/src/Ad4mClient.js +46 -25
  6. package/lib/src/Literal.d.ts +1 -2
  7. package/lib/src/Literal.js +38 -35
  8. package/lib/src/SmartLiteral.d.ts +1 -2
  9. package/lib/src/SmartLiteral.js +30 -15
  10. package/lib/src/agent/AgentClient.d.ts +1 -4
  11. package/lib/src/agent/AgentClient.js +79 -99
  12. package/lib/src/ai/AIClient.d.ts +1 -2
  13. package/lib/src/ai/AIClient.js +224 -220
  14. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  15. package/lib/src/expression/ExpressionClient.js +73 -86
  16. package/lib/src/index.d.ts +1 -1
  17. package/lib/src/index.js +1 -1
  18. package/lib/src/language/LanguageClient.d.ts +1 -1
  19. package/lib/src/language/LanguageClient.js +52 -52
  20. package/lib/src/model/Ad4mModel.d.ts +1351 -144
  21. package/lib/src/model/Ad4mModel.js +3760 -228
  22. package/lib/src/model/Ad4mModel.test.js +522 -979
  23. package/lib/src/model/Subject.d.ts +3 -3
  24. package/lib/src/model/Subject.js +25 -25
  25. package/lib/src/model/decorators.d.ts +444 -100
  26. package/lib/src/model/decorators.js +686 -321
  27. package/lib/src/model/util.d.ts +6 -6
  28. package/lib/src/model/util.js +24 -24
  29. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +1 -5
  30. package/lib/src/neighbourhood/NeighbourhoodClient.js +179 -242
  31. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +1 -2
  32. package/lib/src/neighbourhood/NeighbourhoodProxy.js +28 -13
  33. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +5 -1
  34. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  35. package/lib/src/perspectives/PerspectiveClient.js +240 -316
  36. package/lib/src/perspectives/PerspectiveProxy.d.ts +99 -61
  37. package/lib/src/perspectives/PerspectiveProxy.js +485 -832
  38. package/lib/src/runtime/RuntimeClient.d.ts +1 -5
  39. package/lib/src/runtime/RuntimeClient.js +238 -412
  40. package/lib/src/shacl/SHACLFlow.test.js +105 -164
  41. package/lib/src/shacl/SHACLShape.d.ts +12 -17
  42. package/lib/src/shacl/SHACLShape.js +115 -128
  43. package/lib/src/shacl/SHACLShape.test.js +176 -244
  44. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  45. package/lib/src/shims/type-graphql.d.ts +32 -0
  46. package/lib/src/src/Ad4mClient.d.ts +28 -0
  47. package/lib/src/src/Address.d.ts +1 -0
  48. package/lib/src/src/DID.d.ts +1 -0
  49. package/lib/src/src/Exception.d.ts +7 -0
  50. package/lib/src/src/Literal.d.ts +7 -0
  51. package/lib/src/src/PubSub.d.ts +17 -0
  52. package/lib/src/src/SmartLiteral.d.ts +12 -0
  53. package/lib/src/src/agent/Agent.d.ts +110 -0
  54. package/lib/src/src/agent/AgentClient.d.ts +62 -0
  55. package/lib/src/src/agent/AgentResolver.d.ts +30 -0
  56. package/lib/src/src/agent/AgentStatus.d.ts +8 -0
  57. package/lib/src/src/ai/AIClient.d.ts +32 -0
  58. package/lib/src/src/ai/AIResolver.d.ts +75 -0
  59. package/lib/src/src/ai/Tasks.d.ts +37 -0
  60. package/lib/src/src/buildSchema.d.ts +1 -0
  61. package/lib/src/src/expression/Expression.d.ts +28 -0
  62. package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
  63. package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
  64. package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
  65. package/lib/src/src/index.d.ts +35 -0
  66. package/lib/src/src/jestSetup.d.ts +1 -0
  67. package/lib/src/src/language/Icon.d.ts +4 -0
  68. package/lib/src/src/language/Language.d.ts +206 -0
  69. package/lib/src/src/language/LanguageClient.d.ts +17 -0
  70. package/lib/src/src/language/LanguageContext.d.ts +37 -0
  71. package/lib/src/src/language/LanguageHandle.d.ts +9 -0
  72. package/lib/src/src/language/LanguageMeta.d.ts +35 -0
  73. package/lib/src/src/language/LanguageRef.d.ts +6 -0
  74. package/lib/src/src/language/LanguageResolver.d.ts +19 -0
  75. package/lib/src/src/links/Links.d.ts +39 -0
  76. package/lib/src/src/links/Links.test.d.ts +1 -0
  77. package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
  78. package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
  79. package/lib/src/src/model/Subject.d.ts +25 -0
  80. package/lib/src/src/model/decorators.d.ts +545 -0
  81. package/lib/src/src/model/util.d.ts +12 -0
  82. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
  83. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  84. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  85. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  86. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  87. package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
  88. package/lib/src/src/perspectives/Perspective.d.ts +38 -0
  89. package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
  90. package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
  91. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
  92. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
  93. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
  94. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
  95. package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
  96. package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
  97. package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
  98. package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
  99. package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
  100. package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
  101. package/lib/src/src/typeDefs.d.ts +1 -0
  102. package/lib/src/src/unwrapApolloResult.d.ts +2 -0
  103. package/lib/src/src/utils.d.ts +25 -0
  104. package/lib/src/utils.d.ts +0 -8
  105. package/lib/src/utils.js +7 -21
  106. package/package.json +15 -14
  107. package/src/Ad4mClient.test.ts +1315 -1564
  108. package/src/Ad4mClient.ts +54 -55
  109. package/src/Literal.test.ts +26 -45
  110. package/src/Literal.ts +66 -82
  111. package/src/SmartLiteral.ts +58 -74
  112. package/src/agent/AgentClient.ts +99 -144
  113. package/src/ai/AIClient.ts +359 -409
  114. package/src/expression/ExpressionClient.ts +96 -142
  115. package/src/index.ts +1 -1
  116. package/src/language/LanguageClient.ts +113 -137
  117. package/src/model/Ad4mModel.test.ts +616 -1114
  118. package/src/model/Ad4mModel.ts +4386 -451
  119. package/src/model/Subject.ts +159 -0
  120. package/src/model/decorators.ts +1168 -667
  121. package/src/model/util.ts +54 -53
  122. package/src/neighbourhood/NeighbourhoodClient.ts +266 -392
  123. package/src/neighbourhood/NeighbourhoodProxy.test.ts +7 -3
  124. package/src/neighbourhood/NeighbourhoodProxy.ts +40 -58
  125. package/src/perspectives/PerspectiveClient.ts +540 -779
  126. package/src/perspectives/PerspectiveProxy.ts +2067 -2860
  127. package/src/runtime/RuntimeClient.ts +476 -775
  128. package/src/shacl/SHACLFlow.test.ts +129 -196
  129. package/src/shacl/SHACLShape.test.ts +190 -284
  130. package/src/shacl/SHACLShape.ts +200 -224
  131. package/src/utils.ts +17 -31
  132. package/tsconfig.json +10 -9
  133. package/src/model/IMPROVEMENTS.md +0 -482
  134. package/src/model/PREDICATE_COLLISION_FIX.md +0 -651
  135. package/src/model/README.md +0 -317
  136. package/src/model/SHACL_MUTATION_DECOUPLING.md +0 -356
  137. package/src/model/SUBSCRIPTION_STRATEGY.md +0 -317
  138. package/src/model/TC39_STAGE_3_DECORATORS.md +0 -609
  139. package/src/model/mutation.ts +0 -461
  140. package/src/model/parentUtils.ts +0 -91
  141. package/src/model/prolog/generatePrologFacts.ts +0 -176
  142. package/src/model/prolog/index.ts +0 -1
  143. package/src/model/query/ModelQueryBuilder.ts +0 -173
  144. package/src/model/query/fetchInstance.ts +0 -181
  145. package/src/model/query/hydration.ts +0 -273
  146. package/src/model/query/operations.ts +0 -510
  147. package/src/model/query/snapshot.ts +0 -126
  148. package/src/model/query/surrealCompiler.ts +0 -376
  149. package/src/model/schema/fromJSONSchema.ts +0 -411
  150. package/src/model/schema/metadata.ts +0 -148
  151. package/src/model/subscription.ts +0 -307
  152. package/src/model/transaction.ts +0 -60
  153. package/src/model/types.ts +0 -207
@@ -5,154 +5,108 @@ import { ExpressionRendered } from "./Expression";
5
5
  import { Literal } from "../Literal";
6
6
 
7
7
  export class ExpressionClient {
8
- private _apolloClient: ApolloClient<any>;
8
+ #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(
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
- }
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) {}
30
24
  }
31
- } catch (e) {}
32
- }
25
+
33
26
 
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
- }
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
45
+ }
57
46
 
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
- }
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
+ }
82
67
 
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
- }
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
+ }
96
77
 
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
- }
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
+ }
117
88
 
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
- }
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
+ }
138
102
 
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
- }
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
+ }
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/prolog";
23
+ export * from "./model/Subject";
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,104 +23,81 @@ const LANGUAGE_META = `
23
23
  templateAppliedParams
24
24
  possibleTemplateParams
25
25
  sourceCodeLink
26
- `;
26
+ `
27
27
 
28
28
  export class LanguageClient {
29
- private _apolloClient: ApolloClient<any>;
29
+ #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(
37
- await this._apolloClient.query({
38
- query: gql`query byAddress($address: String!) {
35
+ async byAddress(address: string): Promise<LanguageHandle> {
36
+ const { language } = unwrapApolloResult(await this.#apolloClient.query({
37
+ query: gql`query byAddress($address: String!) {
39
38
  language(address: $address) {
40
39
  ${LANGUAGE_COMPLETE}
41
40
  }
42
41
  }`,
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!) {
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!) {
53
50
  languages(filter: $filter) {
54
51
  ${LANGUAGE_COMPLETE}
55
52
  }
56
53
  }`,
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
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!,
104
84
  ) {
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(
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(
124
101
  $languagePath: String!,
125
102
  $languageMeta: LanguageMetaInput!,
126
103
  ) {
@@ -128,57 +105,56 @@ export class LanguageClient {
128
105
  ${LANGUAGE_META}
129
106
  }
130
107
  }`,
131
- variables: { languagePath, languageMeta },
132
- }),
133
- );
108
+ variables: { languagePath, languageMeta }
109
+ }))
134
110
 
135
- return languagePublish;
136
- }
111
+ return languagePublish
112
+ }
137
113
 
138
- async meta(address: string): Promise<LanguageMeta> {
139
- const { languageMeta } = unwrapApolloResult(
140
- await this._apolloClient.query({
141
- query: gql`query languageMeta(
114
+ async meta(
115
+ address: string,
116
+ ): Promise<LanguageMeta> {
117
+ const { languageMeta } = unwrapApolloResult(await this.#apolloClient.query({
118
+ query: gql`query languageMeta(
142
119
  $address: String!,
143
120
  ) {
144
121
  languageMeta(address: $address) {
145
122
  ${LANGUAGE_META}
146
123
  }
147
124
  }`,
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
- }
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
+ }