@cobaltio/cobalt-js 7.0.1 → 8.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 +8 -246
- package/cobalt.d.ts +162 -0
- package/cobalt.js +175 -234
- package/cobalt.ts +360 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +113 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1394 -0
- package/docs/classes/Cobalt.html +50 -0
- package/docs/index.html +15 -0
- package/docs/interfaces/Application.html +20 -0
- package/docs/interfaces/CobaltOptions.html +5 -0
- package/docs/interfaces/ConfigPayload.html +8 -0
- package/docs/interfaces/InputField.html +12 -0
- package/docs/interfaces/Label.html +6 -0
- package/docs/interfaces/UpdateConfigPayload.html +10 -0
- package/docs/interfaces/WorkflowPayload.html +8 -0
- package/docs/modules.html +9 -0
- package/package.json +5 -4
- package/tsconfig.json +12 -0
- package/docs.md +0 -236
package/tsconfig.json
ADDED
package/docs.md
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
## Classes
|
|
2
|
-
|
|
3
|
-
<dl>
|
|
4
|
-
<dt><a href="#Cobalt">Cobalt</a></dt>
|
|
5
|
-
<dd></dd>
|
|
6
|
-
</dl>
|
|
7
|
-
|
|
8
|
-
## Typedefs
|
|
9
|
-
|
|
10
|
-
<dl>
|
|
11
|
-
<dt><a href="#Application">Application</a> : <code>Object</code></dt>
|
|
12
|
-
<dd><p>An application in Cobalt.</p>
|
|
13
|
-
</dd>
|
|
14
|
-
<dt><a href="#InputField">InputField</a> : <code>Object</code></dt>
|
|
15
|
-
<dd><p>An Input field to take input from the user.</p>
|
|
16
|
-
</dd>
|
|
17
|
-
<dt><a href="#ConfigPayload">ConfigPayload</a> : <code>Object</code></dt>
|
|
18
|
-
<dd><p>The payload object for config.</p>
|
|
19
|
-
</dd>
|
|
20
|
-
<dt><a href="#Label">Label</a> : <code>Object</code></dt>
|
|
21
|
-
<dd><p>Label Mapping</p>
|
|
22
|
-
</dd>
|
|
23
|
-
<dt><a href="#UpdateConfigPayload">UpdateConfigPayload</a> : <code>Object</code></dt>
|
|
24
|
-
<dd><p>The configuration data for an application.</p>
|
|
25
|
-
</dd>
|
|
26
|
-
<dt><a href="#WorkflowPayload">WorkflowPayload</a> : <code>Object</code></dt>
|
|
27
|
-
<dd><p>The workflow.</p>
|
|
28
|
-
</dd>
|
|
29
|
-
</dl>
|
|
30
|
-
|
|
31
|
-
<a name="Cobalt"></a>
|
|
32
|
-
|
|
33
|
-
## Cobalt
|
|
34
|
-
**Kind**: global class
|
|
35
|
-
|
|
36
|
-
* [Cobalt](#Cobalt)
|
|
37
|
-
* [new Cobalt(options)](#new_Cobalt_new)
|
|
38
|
-
* [.getApp([slug])](#Cobalt+getApp) ⇒ [<code>Promise.<Application></code>](#Application)
|
|
39
|
-
* [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.<Boolean></code>
|
|
40
|
-
* [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.<void></code>
|
|
41
|
-
* [.config(payload)](#Cobalt+config) ⇒ <code>Promise.<Config></code>
|
|
42
|
-
* [.getConfig(slug, [configId])](#Cobalt+getConfig) ⇒ <code>Promise.<Config></code>
|
|
43
|
-
* [.updateConfig(payload)](#Cobalt+updateConfig) ⇒ <code>Promise.<Config></code>
|
|
44
|
-
* [.deleteConfig(slug, [configId])](#Cobalt+deleteConfig) ⇒ <code>Promise.<unknown></code>
|
|
45
|
-
|
|
46
|
-
<a name="new_Cobalt_new"></a>
|
|
47
|
-
|
|
48
|
-
### new Cobalt(options)
|
|
49
|
-
Cobalt Frontend SDK
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
| Param | Type | Default | Description |
|
|
53
|
-
| --- | --- | --- | --- |
|
|
54
|
-
| options | <code>Object</code> | | The options to configure the Cobalt SDK. |
|
|
55
|
-
| [options.token] | <code>String</code> | | The session token. |
|
|
56
|
-
| [options.baseUrl] | <code>String</code> | <code>https://api.gocobalt.io</code> | The base URL of the Cobalt API. |
|
|
57
|
-
|
|
58
|
-
<a name="Cobalt+getApp"></a>
|
|
59
|
-
|
|
60
|
-
### cobalt.getApp([slug]) ⇒ [<code>Promise.<Application></code>](#Application)
|
|
61
|
-
Returns the application details for the specified application, provided
|
|
62
|
-
the application is enabled in Cobalt. If no application is specified,
|
|
63
|
-
it returns all the enabled applications.
|
|
64
|
-
|
|
65
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
66
|
-
**Returns**: [<code>Promise.<Application></code>](#Application) - The application details.
|
|
67
|
-
|
|
68
|
-
| Param | Type | Description |
|
|
69
|
-
| --- | --- | --- |
|
|
70
|
-
| [slug] | <code>String</code> | The application slug. |
|
|
71
|
-
|
|
72
|
-
<a name="Cobalt+connect"></a>
|
|
73
|
-
|
|
74
|
-
### cobalt.connect(slug, [payload]) ⇒ <code>Promise.<Boolean></code>
|
|
75
|
-
Connect the specified application, optionally with the auth data that user provides.
|
|
76
|
-
|
|
77
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
78
|
-
**Returns**: <code>Promise.<Boolean></code> - Whether the connection was successful.
|
|
79
|
-
|
|
80
|
-
| Param | Type | Default | Description |
|
|
81
|
-
| --- | --- | --- | --- |
|
|
82
|
-
| slug | <code>String</code> | | The application slug. |
|
|
83
|
-
| [payload] | <code>Object.<string, (string\|number\|boolean)></code> | <code>{}</code> | The key value pairs of auth data. |
|
|
84
|
-
|
|
85
|
-
<a name="Cobalt+disconnect"></a>
|
|
86
|
-
|
|
87
|
-
### cobalt.disconnect(slug) ⇒ <code>Promise.<void></code>
|
|
88
|
-
Disconnect the specified application and remove any associated data from Cobalt.
|
|
89
|
-
|
|
90
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
91
|
-
|
|
92
|
-
| Param | Type | Description |
|
|
93
|
-
| --- | --- | --- |
|
|
94
|
-
| slug | <code>String</code> | The application slug. |
|
|
95
|
-
|
|
96
|
-
<a name="Cobalt+config"></a>
|
|
97
|
-
|
|
98
|
-
### cobalt.config(payload) ⇒ <code>Promise.<Config></code>
|
|
99
|
-
Returns the specified config, or creates one if it doesn't exist.
|
|
100
|
-
|
|
101
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
102
|
-
**Returns**: <code>Promise.<Config></code> - The specified config.
|
|
103
|
-
|
|
104
|
-
| Param | Type | Description |
|
|
105
|
-
| --- | --- | --- |
|
|
106
|
-
| payload | [<code>ConfigPayload</code>](#ConfigPayload) | The payload object for config. |
|
|
107
|
-
|
|
108
|
-
<a name="Cobalt+getConfig"></a>
|
|
109
|
-
|
|
110
|
-
### cobalt.getConfig(slug, [configId]) ⇒ <code>Promise.<Config></code>
|
|
111
|
-
Returns the specified config.
|
|
112
|
-
|
|
113
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
114
|
-
**Returns**: <code>Promise.<Config></code> - The specified config.
|
|
115
|
-
|
|
116
|
-
| Param | Type | Description |
|
|
117
|
-
| --- | --- | --- |
|
|
118
|
-
| slug | <code>String</code> | The application slug. |
|
|
119
|
-
| [configId] | <code>String</code> | The unique ID of the config. |
|
|
120
|
-
|
|
121
|
-
<a name="Cobalt+updateConfig"></a>
|
|
122
|
-
|
|
123
|
-
### cobalt.updateConfig(payload) ⇒ <code>Promise.<Config></code>
|
|
124
|
-
Update the specified config.
|
|
125
|
-
|
|
126
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
127
|
-
**Returns**: <code>Promise.<Config></code> - The specified config.
|
|
128
|
-
|
|
129
|
-
| Param | Type | Description |
|
|
130
|
-
| --- | --- | --- |
|
|
131
|
-
| payload | [<code>UpdateConfigPayload</code>](#UpdateConfigPayload) | The update payload. |
|
|
132
|
-
|
|
133
|
-
<a name="Cobalt+deleteConfig"></a>
|
|
134
|
-
|
|
135
|
-
### cobalt.deleteConfig(slug, [configId]) ⇒ <code>Promise.<unknown></code>
|
|
136
|
-
Delete the specified config.
|
|
137
|
-
|
|
138
|
-
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
139
|
-
|
|
140
|
-
| Param | Type | Description |
|
|
141
|
-
| --- | --- | --- |
|
|
142
|
-
| slug | <code>String</code> | The application slug. |
|
|
143
|
-
| [configId] | <code>String</code> | The unique ID of the config. |
|
|
144
|
-
|
|
145
|
-
<a name="Application"></a>
|
|
146
|
-
|
|
147
|
-
## Application : <code>Object</code>
|
|
148
|
-
An application in Cobalt.
|
|
149
|
-
|
|
150
|
-
**Kind**: global typedef
|
|
151
|
-
**Properties**
|
|
152
|
-
|
|
153
|
-
| Name | Type | Description |
|
|
154
|
-
| --- | --- | --- |
|
|
155
|
-
| name | <code>String</code> | The application name. |
|
|
156
|
-
| description | <code>String</code> | The application description. |
|
|
157
|
-
| icon | <code>String</code> | The application icon. |
|
|
158
|
-
| type | <code>String</code> | The application slug for native apps. |
|
|
159
|
-
| [slug] | <code>String</code> | The application slug for custom apps. |
|
|
160
|
-
| auth_type | <code>"oauth2"</code> \| <code>"keybased"</code> | The type of auth used by application. |
|
|
161
|
-
| [connected] | <code>Boolean</code> | Whether the user has connected the application. |
|
|
162
|
-
| [reauth_required] | <code>Boolean</code> | Whether the connection has expired and re-auth is required. |
|
|
163
|
-
| [auth_input_map] | [<code>Array.<InputField></code>](#InputField) | The fields required from the user to connect the application (for `keybased` auth type). |
|
|
164
|
-
|
|
165
|
-
<a name="InputField"></a>
|
|
166
|
-
|
|
167
|
-
## InputField : <code>Object</code>
|
|
168
|
-
An Input field to take input from the user.
|
|
169
|
-
|
|
170
|
-
**Kind**: global typedef
|
|
171
|
-
**Properties**
|
|
172
|
-
|
|
173
|
-
| Name | Type | Description |
|
|
174
|
-
| --- | --- | --- |
|
|
175
|
-
| name | <code>String</code> | Key name of the field. |
|
|
176
|
-
| type | <code>String</code> | Input type of the field. |
|
|
177
|
-
| required | <code>String</code> | Whether the field is required. |
|
|
178
|
-
| placeholder | <code>String</code> | The placeholder of the field. |
|
|
179
|
-
| label | <code>String</code> | The label of the field. |
|
|
180
|
-
|
|
181
|
-
<a name="ConfigPayload"></a>
|
|
182
|
-
|
|
183
|
-
## ConfigPayload : <code>Object</code>
|
|
184
|
-
The payload object for config.
|
|
185
|
-
|
|
186
|
-
**Kind**: global typedef
|
|
187
|
-
**Properties**
|
|
188
|
-
|
|
189
|
-
| Name | Type | Description |
|
|
190
|
-
| --- | --- | --- |
|
|
191
|
-
| slug | <code>String</code> | The application slug. |
|
|
192
|
-
| [config_id] | <code>String</code> | Unique ID for the config. |
|
|
193
|
-
| labels | <code>Object.<string, Array.<Label>></code> | The dynamic label mappings. |
|
|
194
|
-
|
|
195
|
-
<a name="Label"></a>
|
|
196
|
-
|
|
197
|
-
## Label : <code>Object</code>
|
|
198
|
-
Label Mapping
|
|
199
|
-
|
|
200
|
-
**Kind**: global typedef
|
|
201
|
-
**Properties**
|
|
202
|
-
|
|
203
|
-
| Name | Type | Description |
|
|
204
|
-
| --- | --- | --- |
|
|
205
|
-
| name | <code>string</code> | The label name. |
|
|
206
|
-
| value | <code>string</code> \| <code>number</code> \| <code>boolean</code> | The label value. |
|
|
207
|
-
|
|
208
|
-
<a name="UpdateConfigPayload"></a>
|
|
209
|
-
|
|
210
|
-
## UpdateConfigPayload : <code>Object</code>
|
|
211
|
-
The configuration data for an application.
|
|
212
|
-
|
|
213
|
-
**Kind**: global typedef
|
|
214
|
-
**Properties**
|
|
215
|
-
|
|
216
|
-
| Name | Type | Description |
|
|
217
|
-
| --- | --- | --- |
|
|
218
|
-
| slug | <code>String</code> | The application slug. |
|
|
219
|
-
| [config_id] | <code>String</code> | Unique ID for the config. |
|
|
220
|
-
| fields | <code>Object.<string, (string\|number\|boolean)></code> | A map of application fields and their values. |
|
|
221
|
-
| workflows | [<code>Array.<WorkflowPayload></code>](#WorkflowPayload) | Whether the workflow is enabled. |
|
|
222
|
-
|
|
223
|
-
<a name="WorkflowPayload"></a>
|
|
224
|
-
|
|
225
|
-
## WorkflowPayload : <code>Object</code>
|
|
226
|
-
The workflow.
|
|
227
|
-
|
|
228
|
-
**Kind**: global typedef
|
|
229
|
-
**Properties**
|
|
230
|
-
|
|
231
|
-
| Name | Type | Description |
|
|
232
|
-
| --- | --- | --- |
|
|
233
|
-
| id | <code>String</code> | The ID of the workflow. |
|
|
234
|
-
| enabled | <code>Boolean</code> | Whether the workflow is enabled. |
|
|
235
|
-
| fields | <code>Object.<string, (string\|number\|boolean)></code> | A map of workflow fields and their values. |
|
|
236
|
-
|