@settlemint/sdk-js 1.0.5-main99d4b95b → 1.0.5-mainb935fa12
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.
- package/README.md +36 -17
- package/dist/settlemint.cjs +9 -2
- package/dist/settlemint.cjs.map +1 -1
- package/dist/settlemint.d.cts +9 -2
- package/dist/settlemint.d.ts +9 -2
- package/dist/settlemint.mjs +9 -2
- package/dist/settlemint.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
- [createSettleMintClient()](#createsettlemintclient)
|
|
33
33
|
- [Interfaces](#interfaces)
|
|
34
34
|
- [SettlemintClient](#settlemintclient)
|
|
35
|
+
- [SettlemintClientOptions](#settlemintclientoptions)
|
|
35
36
|
- [Type Aliases](#type-aliases)
|
|
36
37
|
- [Application](#application)
|
|
37
38
|
- [BlockchainNetwork](#blockchainnetwork)
|
|
@@ -60,7 +61,7 @@ The SettleMint JavaScript SDK provides a type-safe wrapper around the SettleMint
|
|
|
60
61
|
|
|
61
62
|
> **createSettleMintClient**(`options`): [`SettlemintClient`](README.md#settlemintclient)
|
|
62
63
|
|
|
63
|
-
Defined in: [
|
|
64
|
+
Defined in: [settlemint.ts:210](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/settlemint.ts#L210)
|
|
64
65
|
|
|
65
66
|
Creates a SettleMint client with the provided options. The client provides methods to interact with
|
|
66
67
|
various SettleMint resources like workspaces, applications, blockchain networks, blockchain nodes, middleware,
|
|
@@ -70,9 +71,7 @@ integration tools, storage, private keys, insights and custom deployments.
|
|
|
70
71
|
|
|
71
72
|
| Parameter | Type | Description |
|
|
72
73
|
| ------ | ------ | ------ |
|
|
73
|
-
| `options` |
|
|
74
|
-
| `options.accessToken` | `string` | The access token used to authenticate with the SettleMint platform |
|
|
75
|
-
| `options.instance` | `string` | The URL of the SettleMint instance to connect to |
|
|
74
|
+
| `options` | [`SettlemintClientOptions`](README.md#settlemintclientoptions) | Configuration options for the client including access token and instance URL |
|
|
76
75
|
|
|
77
76
|
##### Returns
|
|
78
77
|
|
|
@@ -109,17 +108,37 @@ const workspace = await client.workspace.read('workspace-unique-name');
|
|
|
109
108
|
|
|
110
109
|
#### SettlemintClient
|
|
111
110
|
|
|
112
|
-
Defined in: [
|
|
111
|
+
Defined in: [settlemint.ts:110](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/settlemint.ts#L110)
|
|
113
112
|
|
|
114
113
|
Client interface for interacting with the SettleMint platform.
|
|
115
114
|
|
|
115
|
+
***
|
|
116
|
+
|
|
117
|
+
#### SettlemintClientOptions
|
|
118
|
+
|
|
119
|
+
Defined in: [settlemint.ts:102](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/settlemint.ts#L102)
|
|
120
|
+
|
|
121
|
+
Options for the Settlemint client.
|
|
122
|
+
|
|
123
|
+
##### Extends
|
|
124
|
+
|
|
125
|
+
- `ClientOptions`
|
|
126
|
+
|
|
127
|
+
##### Properties
|
|
128
|
+
|
|
129
|
+
| Property | Type | Default value | Description | Inherited from | Defined in |
|
|
130
|
+
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
131
|
+
| <a id="accesstoken"></a> `accessToken` | `string` | `AccessTokenSchema` | The access token used to authenticate with the SettleMint platform | `ClientOptions.accessToken` | [helpers/client-options.schema.ts:9](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/helpers/client-options.schema.ts#L9) |
|
|
132
|
+
| <a id="anonymous"></a> `anonymous?` | `boolean` | `undefined` | Whether to allow anonymous access (no access token required) | - | [settlemint.ts:104](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/settlemint.ts#L104) |
|
|
133
|
+
| <a id="instance"></a> `instance` | `string` | `UrlSchema` | The URL of the SettleMint instance to connect to | `ClientOptions.instance` | [helpers/client-options.schema.ts:11](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/helpers/client-options.schema.ts#L11) |
|
|
134
|
+
|
|
116
135
|
### Type Aliases
|
|
117
136
|
|
|
118
137
|
#### Application
|
|
119
138
|
|
|
120
139
|
> **Application**: `ResultOf`\<*typeof* `ApplicationFragment`\>
|
|
121
140
|
|
|
122
|
-
Defined in: [
|
|
141
|
+
Defined in: [graphql/application.ts:23](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/application.ts#L23)
|
|
123
142
|
|
|
124
143
|
Type representing an application entity.
|
|
125
144
|
|
|
@@ -129,7 +148,7 @@ Type representing an application entity.
|
|
|
129
148
|
|
|
130
149
|
> **BlockchainNetwork**: `ResultOf`\<*typeof* `BlockchainNetworkFragment`\>
|
|
131
150
|
|
|
132
|
-
Defined in: [
|
|
151
|
+
Defined in: [graphql/blockchain-network.ts:29](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/blockchain-network.ts#L29)
|
|
133
152
|
|
|
134
153
|
Type representing a blockchain network entity.
|
|
135
154
|
|
|
@@ -139,7 +158,7 @@ Type representing a blockchain network entity.
|
|
|
139
158
|
|
|
140
159
|
> **BlockchainNode**: `ResultOf`\<*typeof* `BlockchainNodeFragment`\>
|
|
141
160
|
|
|
142
|
-
Defined in: [
|
|
161
|
+
Defined in: [graphql/blockchain-node.ts:48](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/blockchain-node.ts#L48)
|
|
143
162
|
|
|
144
163
|
Type representing a blockchain node entity.
|
|
145
164
|
|
|
@@ -149,7 +168,7 @@ Type representing a blockchain node entity.
|
|
|
149
168
|
|
|
150
169
|
> **CustomDeployment**: `ResultOf`\<*typeof* `CustomDeploymentFragment`\>
|
|
151
170
|
|
|
152
|
-
Defined in: [
|
|
171
|
+
Defined in: [graphql/custom-deployment.ts:30](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/custom-deployment.ts#L30)
|
|
153
172
|
|
|
154
173
|
Type representing a custom deployment entity.
|
|
155
174
|
|
|
@@ -159,7 +178,7 @@ Type representing a custom deployment entity.
|
|
|
159
178
|
|
|
160
179
|
> **Insights**: `ResultOf`\<*typeof* `InsightsFragment`\>
|
|
161
180
|
|
|
162
|
-
Defined in: [
|
|
181
|
+
Defined in: [graphql/insights.ts:34](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/insights.ts#L34)
|
|
163
182
|
|
|
164
183
|
Type representing an insights entity.
|
|
165
184
|
|
|
@@ -169,7 +188,7 @@ Type representing an insights entity.
|
|
|
169
188
|
|
|
170
189
|
> **IntegrationTool**: `ResultOf`\<*typeof* `IntegrationFragment`\>
|
|
171
190
|
|
|
172
|
-
Defined in: [
|
|
191
|
+
Defined in: [graphql/integration-tool.ts:32](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/integration-tool.ts#L32)
|
|
173
192
|
|
|
174
193
|
Type representing an integration tool entity.
|
|
175
194
|
|
|
@@ -179,7 +198,7 @@ Type representing an integration tool entity.
|
|
|
179
198
|
|
|
180
199
|
> **Middleware**: `ResultOf`\<*typeof* `MiddlewareFragment`\>
|
|
181
200
|
|
|
182
|
-
Defined in: [
|
|
201
|
+
Defined in: [graphql/middleware.ts:40](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/middleware.ts#L40)
|
|
183
202
|
|
|
184
203
|
Type representing a middleware entity.
|
|
185
204
|
|
|
@@ -189,7 +208,7 @@ Type representing a middleware entity.
|
|
|
189
208
|
|
|
190
209
|
> **MiddlewareWithSubgraphs**: `ResultOf`\<*typeof* `getGraphMiddlewareSubgraphs`\>\[`"middlewareByUniqueName"`\]
|
|
191
210
|
|
|
192
|
-
Defined in: [
|
|
211
|
+
Defined in: [graphql/middleware.ts:98](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/middleware.ts#L98)
|
|
193
212
|
|
|
194
213
|
Type representing a middleware entity with subgraphs.
|
|
195
214
|
|
|
@@ -199,7 +218,7 @@ Type representing a middleware entity with subgraphs.
|
|
|
199
218
|
|
|
200
219
|
> **PlatformConfig**: `ResultOf`\<*typeof* `getPlatformConfigQuery`\>\[`"config"`\]
|
|
201
220
|
|
|
202
|
-
Defined in: [
|
|
221
|
+
Defined in: [graphql/platform.ts:44](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/platform.ts#L44)
|
|
203
222
|
|
|
204
223
|
Type representing the platform configuration.
|
|
205
224
|
|
|
@@ -209,7 +228,7 @@ Type representing the platform configuration.
|
|
|
209
228
|
|
|
210
229
|
> **PrivateKey**: `ResultOf`\<*typeof* `PrivateKeyFragment`\>
|
|
211
230
|
|
|
212
|
-
Defined in: [
|
|
231
|
+
Defined in: [graphql/private-key.ts:24](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/private-key.ts#L24)
|
|
213
232
|
|
|
214
233
|
Type representing a private key entity.
|
|
215
234
|
|
|
@@ -219,7 +238,7 @@ Type representing a private key entity.
|
|
|
219
238
|
|
|
220
239
|
> **Storage**: `ResultOf`\<*typeof* `StorageFragment`\>
|
|
221
240
|
|
|
222
|
-
Defined in: [
|
|
241
|
+
Defined in: [graphql/storage.ts:32](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/storage.ts#L32)
|
|
223
242
|
|
|
224
243
|
Type representing a storage entity.
|
|
225
244
|
|
|
@@ -229,7 +248,7 @@ Type representing a storage entity.
|
|
|
229
248
|
|
|
230
249
|
> **Workspace**: `ResultOf`\<*typeof* `WorkspaceFragment`\>
|
|
231
250
|
|
|
232
|
-
Defined in: [
|
|
251
|
+
Defined in: [graphql/workspace.ts:26](https://github.com/settlemint/sdk/blob/v1.0.5/sdk/js/src/graphql/workspace.ts#L26)
|
|
233
252
|
|
|
234
253
|
Type representing a workspace entity.
|
|
235
254
|
|
package/dist/settlemint.cjs
CHANGED
|
@@ -27,6 +27,7 @@ var import_http = require("@settlemint/sdk-utils/http");
|
|
|
27
27
|
var import_runtime = require("@settlemint/sdk-utils/runtime");
|
|
28
28
|
var import_validation3 = require("@settlemint/sdk-utils/validation");
|
|
29
29
|
var import_graphql_request = require("graphql-request");
|
|
30
|
+
var import_zod2 = require("zod");
|
|
30
31
|
|
|
31
32
|
// src/helpers/graphql.ts
|
|
32
33
|
var import_gql = require("gql.tada");
|
|
@@ -1498,11 +1499,17 @@ var ClientOptionsSchema = import_zod.z.object({
|
|
|
1498
1499
|
// src/settlemint.ts
|
|
1499
1500
|
function createSettleMintClient(options) {
|
|
1500
1501
|
(0, import_runtime.ensureServer)();
|
|
1501
|
-
const validatedOptions = (0, import_validation3.validate)(
|
|
1502
|
+
const validatedOptions = options.anonymous ? (0, import_validation3.validate)(
|
|
1503
|
+
import_zod2.z.object({
|
|
1504
|
+
...ClientOptionsSchema.shape,
|
|
1505
|
+
accessToken: import_zod2.z.literal("")
|
|
1506
|
+
}),
|
|
1507
|
+
options
|
|
1508
|
+
) : (0, import_validation3.validate)(ClientOptionsSchema, options);
|
|
1502
1509
|
const baseUrl = new URL(validatedOptions.instance).toString().replace(/\/$/, "");
|
|
1503
1510
|
const gqlClient = new import_graphql_request.GraphQLClient(`${baseUrl}/api/graphql`, {
|
|
1504
1511
|
headers: {
|
|
1505
|
-
"x-auth-token": validatedOptions.accessToken
|
|
1512
|
+
"x-auth-token": validatedOptions.accessToken ?? ""
|
|
1506
1513
|
},
|
|
1507
1514
|
fetch: async (input, init) => {
|
|
1508
1515
|
const response = await (0, import_http.fetchWithRetry)(input, init);
|