@cobaltio/cobalt-js 4.0.0 → 5.0.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.
- package/README.md +10 -11
- package/cobalt.js +7 -7
- package/docs.md +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,8 +77,8 @@ cobalt.token = "COBALT_SESSION_TOKEN";
|
|
|
77
77
|
<dt><a href="#Workflow">Workflow</a> : <code>Object</code></dt>
|
|
78
78
|
<dd><p>The workflow.</p>
|
|
79
79
|
</dd>
|
|
80
|
-
<dt><a href="#
|
|
81
|
-
<dd><p>The
|
|
80
|
+
<dt><a href="#ConfigPayload">ConfigPayload</a> : <code>Object</code></dt>
|
|
81
|
+
<dd><p>The payload object for config.</p>
|
|
82
82
|
</dd>
|
|
83
83
|
<dt><a href="#DynamicField">DynamicField</a> : <code>Object</code></dt>
|
|
84
84
|
<dd><p>Field Mapping Label</p>
|
|
@@ -98,13 +98,12 @@ cobalt.token = "COBALT_SESSION_TOKEN";
|
|
|
98
98
|
* [.getApp([slug])](#Cobalt+getApp) ⇒ [<code>Promise.<Application></code>](#Application)
|
|
99
99
|
* [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.<Boolean></code>
|
|
100
100
|
* [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.<void></code>
|
|
101
|
-
* [.config(slug, [
|
|
101
|
+
* [.config(slug, [payload])](#Cobalt+config) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
102
102
|
* [.updateConfig(slug, payload)](#Cobalt+updateConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
103
103
|
* [.deleteConfig(slug, [configId])](#Cobalt+deleteConfig) ⇒ <code>Promise.<unknown></code>
|
|
104
104
|
* Additional Methods:
|
|
105
105
|
* [.getConfig(slug, [configId])](#Cobalt+getConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
106
106
|
|
|
107
|
-
|
|
108
107
|
<a name="new_Cobalt_new"></a>
|
|
109
108
|
|
|
110
109
|
### new Cobalt(options)
|
|
@@ -157,7 +156,7 @@ Disconnect the specified application and remove any associated data from Cobalt.
|
|
|
157
156
|
|
|
158
157
|
<a name="Cobalt+config"></a>
|
|
159
158
|
|
|
160
|
-
### cobalt.config(slug, [
|
|
159
|
+
### cobalt.config(slug, [payload]) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
161
160
|
Returns the specified config, or creates one if it doesn't exist.
|
|
162
161
|
|
|
163
162
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
@@ -166,8 +165,7 @@ Returns the specified config, or creates one if it doesn't exist.
|
|
|
166
165
|
| Param | Type | Description |
|
|
167
166
|
| --- | --- | --- |
|
|
168
167
|
| slug | <code>String</code> | The application slug. |
|
|
169
|
-
| [
|
|
170
|
-
| [fields] | [<code>DynamicFields</code>](#DynamicFields) | The dynamic fields payload. |
|
|
168
|
+
| [payload] | [<code>ConfigPayload</code>](#ConfigPayload) | The payload object for config. |
|
|
171
169
|
|
|
172
170
|
<a name="Cobalt+getConfig"></a>
|
|
173
171
|
|
|
@@ -270,17 +268,18 @@ The workflow.
|
|
|
270
268
|
| enabled | <code>Boolean</code> | Whether the workflow is enabled. |
|
|
271
269
|
| data_slots | <code>Object.<string, (string\|number\|boolean)></code> | A map of workflow's data slots and their values. |
|
|
272
270
|
|
|
273
|
-
<a name="
|
|
271
|
+
<a name="ConfigPayload"></a>
|
|
274
272
|
|
|
275
|
-
##
|
|
276
|
-
The
|
|
273
|
+
## ConfigPayload : <code>Object</code>
|
|
274
|
+
The payload object for config.
|
|
277
275
|
|
|
278
276
|
**Kind**: global typedef
|
|
279
277
|
**Properties**
|
|
280
278
|
|
|
281
279
|
| Name | Type | Description |
|
|
282
280
|
| --- | --- | --- |
|
|
283
|
-
|
|
|
281
|
+
| [config_id] | <code>String</code> | Unique ID for the config. |
|
|
282
|
+
| map_fields_object | <code>Object.<string, DynamicField></code> | Map fields object. |
|
|
284
283
|
|
|
285
284
|
<a name="DynamicField"></a>
|
|
286
285
|
|
package/cobalt.js
CHANGED
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* @typedef {Object}
|
|
42
|
-
* @property {
|
|
41
|
+
* @typedef {Object} ConfigPayload The payload object for config.
|
|
42
|
+
* @property {String} [config_id] Unique ID for the config.
|
|
43
|
+
* @property {Object.<string, DynamicField>} map_fields_object Map fields object.
|
|
43
44
|
*/
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -214,18 +215,17 @@ class Cobalt {
|
|
|
214
215
|
/**
|
|
215
216
|
* Returns the specified config, or creates one if it doesn't exist.
|
|
216
217
|
* @param {String} slug The application slug.
|
|
217
|
-
* @param {
|
|
218
|
-
* @param {DynamicFields} [fields] The dynamic fields payload.
|
|
218
|
+
* @param {ConfigPayload} [payload] The payload object for config.
|
|
219
219
|
* @returns {Promise<Config>} The specified config.
|
|
220
220
|
*/
|
|
221
|
-
async config(slug,
|
|
222
|
-
const res = await fetch(`${this.baseUrl}/api/v2/application/${slug}/installation
|
|
221
|
+
async config(slug, payload) {
|
|
222
|
+
const res = await fetch(`${this.baseUrl}/api/v2/application/${slug}/installation`, {
|
|
223
223
|
method: "POST",
|
|
224
224
|
headers: {
|
|
225
225
|
authorization: `Bearer ${this.token}`,
|
|
226
226
|
"content-type": "application/json",
|
|
227
227
|
},
|
|
228
|
-
body: JSON.stringify(
|
|
228
|
+
body: JSON.stringify(payload),
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
if (res.status >= 400 && res.status < 600) {
|
package/docs.md
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
<dt><a href="#Workflow">Workflow</a> : <code>Object</code></dt>
|
|
21
21
|
<dd><p>The workflow.</p>
|
|
22
22
|
</dd>
|
|
23
|
-
<dt><a href="#
|
|
24
|
-
<dd><p>The
|
|
23
|
+
<dt><a href="#ConfigPayload">ConfigPayload</a> : <code>Object</code></dt>
|
|
24
|
+
<dd><p>The payload object for config.</p>
|
|
25
25
|
</dd>
|
|
26
26
|
<dt><a href="#DynamicField">DynamicField</a> : <code>Object</code></dt>
|
|
27
27
|
<dd><p>Field Mapping Label</p>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* [.getApp([slug])](#Cobalt+getApp) ⇒ [<code>Promise.<Application></code>](#Application)
|
|
42
42
|
* [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.<Boolean></code>
|
|
43
43
|
* [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.<void></code>
|
|
44
|
-
* [.config(slug, [
|
|
44
|
+
* [.config(slug, [payload])](#Cobalt+config) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
45
45
|
* [.getConfig(slug, [configId])](#Cobalt+getConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
46
46
|
* [.updateConfig(slug, payload)](#Cobalt+updateConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
47
47
|
* [.deleteConfig(slug, [configId])](#Cobalt+deleteConfig) ⇒ <code>Promise.<unknown></code>
|
|
@@ -98,7 +98,7 @@ Disconnect the specified application and remove any associated data from Cobalt.
|
|
|
98
98
|
|
|
99
99
|
<a name="Cobalt+config"></a>
|
|
100
100
|
|
|
101
|
-
### cobalt.config(slug, [
|
|
101
|
+
### cobalt.config(slug, [payload]) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
102
102
|
Returns the specified config, or creates one if it doesn't exist.
|
|
103
103
|
|
|
104
104
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
@@ -107,8 +107,7 @@ Returns the specified config, or creates one if it doesn't exist.
|
|
|
107
107
|
| Param | Type | Description |
|
|
108
108
|
| --- | --- | --- |
|
|
109
109
|
| slug | <code>String</code> | The application slug. |
|
|
110
|
-
| [
|
|
111
|
-
| [fields] | [<code>DynamicFields</code>](#DynamicFields) | The dynamic fields payload. |
|
|
110
|
+
| [payload] | [<code>ConfigPayload</code>](#ConfigPayload) | The payload object for config. |
|
|
112
111
|
|
|
113
112
|
<a name="Cobalt+getConfig"></a>
|
|
114
113
|
|
|
@@ -211,17 +210,18 @@ The workflow.
|
|
|
211
210
|
| enabled | <code>Boolean</code> | Whether the workflow is enabled. |
|
|
212
211
|
| data_slots | <code>Object.<string, (string\|number\|boolean)></code> | A map of workflow's data slots and their values. |
|
|
213
212
|
|
|
214
|
-
<a name="
|
|
213
|
+
<a name="ConfigPayload"></a>
|
|
215
214
|
|
|
216
|
-
##
|
|
217
|
-
The
|
|
215
|
+
## ConfigPayload : <code>Object</code>
|
|
216
|
+
The payload object for config.
|
|
218
217
|
|
|
219
218
|
**Kind**: global typedef
|
|
220
219
|
**Properties**
|
|
221
220
|
|
|
222
221
|
| Name | Type | Description |
|
|
223
222
|
| --- | --- | --- |
|
|
224
|
-
|
|
|
223
|
+
| [config_id] | <code>String</code> | Unique ID for the config. |
|
|
224
|
+
| map_fields_object | <code>Object.<string, DynamicField></code> | Map fields object. |
|
|
225
225
|
|
|
226
226
|
<a name="DynamicField"></a>
|
|
227
227
|
|