@livechat/developer-studio-api 3.0.51 → 3.0.52

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/dist/index.js CHANGED
@@ -1746,9 +1746,103 @@ var textPlatformDashboardApi = {
1746
1746
  }
1747
1747
  };
1748
1748
 
1749
+ // src/apis/integrations/text/platform/workflows/api.ts
1750
+ var textPlatformWorkflowsApi = {
1751
+ getWorkflows(authorization) {
1752
+ return __async(this, null, function* () {
1753
+ const { data: workflows } = yield textClientInstance.get(
1754
+ "/workflow_platform/workflows",
1755
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1756
+ ensureAuthorizationToken: true
1757
+ }))
1758
+ );
1759
+ return workflows;
1760
+ });
1761
+ },
1762
+ createWorkflow(payload, authorization) {
1763
+ return __async(this, null, function* () {
1764
+ yield textClientInstance.post(
1765
+ "/workflow_platform/workflows",
1766
+ payload,
1767
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1768
+ ensureAuthorizationToken: true
1769
+ }))
1770
+ );
1771
+ });
1772
+ },
1773
+ getWorkflow(payload, authorization) {
1774
+ return __async(this, null, function* () {
1775
+ const { data: workflow } = yield textClientInstance.get(
1776
+ `/workflow_platform/workflows/${payload.name}?version=${payload.version}`,
1777
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1778
+ ensureAuthorizationToken: true
1779
+ }))
1780
+ );
1781
+ return workflow;
1782
+ });
1783
+ },
1784
+ updateWorkflow(payload, authorization) {
1785
+ return __async(this, null, function* () {
1786
+ const { data: workflow } = yield textClientInstance.put(
1787
+ `/workflow_platform/workflows/${payload.name}`,
1788
+ payload,
1789
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1790
+ ensureAuthorizationToken: true
1791
+ }))
1792
+ );
1793
+ return workflow;
1794
+ });
1795
+ },
1796
+ deleteWorkflow(payload, authorization) {
1797
+ return __async(this, null, function* () {
1798
+ yield textClientInstance.delete(
1799
+ `/workflow_platform/workflows/${payload.name}`,
1800
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1801
+ ensureAuthorizationToken: true
1802
+ }))
1803
+ );
1804
+ });
1805
+ },
1806
+ executeWorkflow(payload, authorization) {
1807
+ return __async(this, null, function* () {
1808
+ const { data: execution } = yield textClientInstance.post(
1809
+ `/workflow_platform/workflows/${payload.name}/executions`,
1810
+ payload,
1811
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1812
+ ensureAuthorizationToken: true
1813
+ }))
1814
+ );
1815
+ return execution;
1816
+ });
1817
+ },
1818
+ getWorkflowExecutionsList(payload, authorization) {
1819
+ return __async(this, null, function* () {
1820
+ const { data: executions } = yield textClientInstance.get(
1821
+ `/workflow_platform/workflows/${payload.name}/executions`,
1822
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1823
+ ensureAuthorizationToken: true
1824
+ }))
1825
+ );
1826
+ return executions;
1827
+ });
1828
+ },
1829
+ getWorkflowExecutionDetails(payload, authorization) {
1830
+ return __async(this, null, function* () {
1831
+ const { data: execution } = yield textClientInstance.get(
1832
+ `/workflow_platform/workflows/${payload.name}/executions/${payload.execution_id}`,
1833
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1834
+ ensureAuthorizationToken: true
1835
+ }))
1836
+ );
1837
+ return execution;
1838
+ });
1839
+ }
1840
+ };
1841
+
1749
1842
  // src/apis/integrations/text/platform/api.ts
1750
1843
  var textPlatformApi = {
1751
- dashboard: textPlatformDashboardApi
1844
+ dashboard: textPlatformDashboardApi,
1845
+ workflows: textPlatformWorkflowsApi
1752
1846
  };
1753
1847
 
1754
1848
  // src/apis/integrations/text/api.ts
@@ -5923,6 +6017,17 @@ var platformAdapterAppApi = {
5923
6017
  }
5924
6018
  };
5925
6019
 
6020
+ // src/apis/integrations/text/platform/workflows/_contracts/dtos/workflows.ts
6021
+ var WorkflowDefinitionTaskType = {
6022
+ http: "HTTP",
6023
+ switch: "SWITCH",
6024
+ forkJoin: "FORK_JOIN",
6025
+ terminate: "TERMINATE",
6026
+ join: "JOIN",
6027
+ addNode: "ADD_NODE",
6028
+ addTrigger: "ADD_TRIGGER"
6029
+ };
6030
+
5926
6031
  // src/apis/platform/billing/instance.ts
5927
6032
  var import_axios21 = __toESM(require("axios"));
5928
6033
  var platformBillingClientInstance = import_axios21.default.create({
@@ -5965,17 +6070,6 @@ function initPlatformBillingClient(baseUrl, token) {
5965
6070
  }
5966
6071
  }
5967
6072
 
5968
- // src/apis/platform/workflows/contracts.ts
5969
- var WorkflowDefinitionTaskType = {
5970
- http: "HTTP",
5971
- switch: "SWITCH",
5972
- forkJoin: "FORK_JOIN",
5973
- terminate: "TERMINATE",
5974
- join: "JOIN",
5975
- addNode: "ADD_NODE",
5976
- addTrigger: "ADD_TRIGGER"
5977
- };
5978
-
5979
6073
  // src/apis/platform/adapter/integrations/neon/api.ts
5980
6074
  var platformAdapterNeonProxyApi = {
5981
6075
  user(authorization) {
@@ -6122,165 +6216,12 @@ var platformBillingApi = {
6122
6216
  invoices: platformBillingInvoicesApi
6123
6217
  };
6124
6218
 
6125
- // src/apis/platform/workflows/instance.ts
6126
- var import_axios22 = __toESM(require("axios"));
6127
- var PlatformWorkflowsApiError = class extends ApiErrorBase {
6128
- constructor() {
6129
- super(...arguments);
6130
- this.name = "platform_workflows";
6131
- }
6132
- };
6133
- var platformWorkflowsClientInstance = import_axios22.default.create({
6134
- baseURL: "https://api.labs.text.com/workflow_platform"
6135
- });
6136
- platformWorkflowsClientInstance.interceptors.response.use(
6137
- (response) => response,
6138
- (error) => {
6139
- var _a, _b, _c, _d;
6140
- if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
6141
- return Promise.reject(new UnauthorizeApiError("accounts"));
6142
- }
6143
- return Promise.reject(
6144
- new PlatformWorkflowsApiError(
6145
- error.message,
6146
- (_b = error.response) == null ? void 0 : _b.data,
6147
- (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
6148
- )
6149
- );
6150
- }
6151
- );
6152
- function getPlatformWorkflowsClientConfig(options = {}) {
6153
- var _a;
6154
- const currentHeaders = platformWorkflowsClientInstance.defaults.headers;
6155
- const defaultAuthorization = currentHeaders.Authorization;
6156
- if (!options.token && !defaultAuthorization) {
6157
- throw new UnauthorizeApiError("accounts");
6158
- }
6159
- const headers = {
6160
- authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
6161
- };
6162
- return {
6163
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
6164
- };
6165
- }
6166
- function initPlatformWorkflowsClient(baseUrl, token) {
6167
- const headers = platformWorkflowsClientInstance.defaults.headers;
6168
- if (baseUrl) {
6169
- platformWorkflowsClientInstance.interceptors.request.use(
6170
- (config) => {
6171
- config.baseURL = baseUrl;
6172
- return config;
6173
- },
6174
- (error) => Promise.reject(error)
6175
- );
6176
- }
6177
- if (token) {
6178
- headers.Authorization = `Bearer ${token}`;
6179
- } else {
6180
- delete headers.Authorization;
6181
- }
6182
- }
6183
-
6184
- // src/apis/platform/workflows/api.ts
6185
- var workflowsApi = {
6186
- getWorkflows(authorization) {
6187
- return __async(this, null, function* () {
6188
- const { data: workflows } = yield platformWorkflowsClientInstance.get(
6189
- "/workflows",
6190
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6191
- ensureAuthorizationToken: true
6192
- }))
6193
- );
6194
- return workflows;
6195
- });
6196
- },
6197
- createWorkflow(payload, authorization) {
6198
- return __async(this, null, function* () {
6199
- yield platformWorkflowsClientInstance.post(
6200
- "/workflows",
6201
- payload,
6202
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6203
- ensureAuthorizationToken: true
6204
- }))
6205
- );
6206
- });
6207
- },
6208
- getWorkflow(payload, authorization) {
6209
- return __async(this, null, function* () {
6210
- const { data: workflow } = yield platformWorkflowsClientInstance.get(
6211
- `/workflows/${payload.name}?version=${payload.version}`,
6212
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6213
- ensureAuthorizationToken: true
6214
- }))
6215
- );
6216
- return workflow;
6217
- });
6218
- },
6219
- updateWorkflow(payload, authorization) {
6220
- return __async(this, null, function* () {
6221
- const { data: workflow } = yield platformWorkflowsClientInstance.put(
6222
- `/workflows/${payload.name}`,
6223
- payload,
6224
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6225
- ensureAuthorizationToken: true
6226
- }))
6227
- );
6228
- return workflow;
6229
- });
6230
- },
6231
- deleteWorkflow(payload, authorization) {
6232
- return __async(this, null, function* () {
6233
- yield platformWorkflowsClientInstance.delete(
6234
- `/workflows/${payload.name}`,
6235
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6236
- ensureAuthorizationToken: true
6237
- }))
6238
- );
6239
- });
6240
- },
6241
- executeWorkflow(payload, authorization) {
6242
- return __async(this, null, function* () {
6243
- const { data: execution } = yield platformWorkflowsClientInstance.post(
6244
- `/workflows/${payload.name}/executions`,
6245
- payload,
6246
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6247
- ensureAuthorizationToken: true
6248
- }))
6249
- );
6250
- return execution;
6251
- });
6252
- },
6253
- getWorkflowExecutionsList(payload, authorization) {
6254
- return __async(this, null, function* () {
6255
- const { data: executions } = yield platformWorkflowsClientInstance.get(
6256
- `/workflows/${payload.name}/executions`,
6257
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6258
- ensureAuthorizationToken: true
6259
- }))
6260
- );
6261
- return executions;
6262
- });
6263
- },
6264
- getWorkflowExecutionDetails(payload, authorization) {
6265
- return __async(this, null, function* () {
6266
- const { data: execution } = yield platformWorkflowsClientInstance.get(
6267
- `/workflows/${payload.name}/executions/${payload.execution_id}`,
6268
- getPlatformWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6269
- ensureAuthorizationToken: true
6270
- }))
6271
- );
6272
- return execution;
6273
- });
6274
- }
6275
- };
6276
-
6277
6219
  // src/apis/platform/api.ts
6278
6220
  var platformApi = {
6279
6221
  accounts: platformAccountsApi,
6280
6222
  billing: platformBillingApi,
6281
6223
  adapter: platformAdapterApi,
6282
- dps: platformDpsApi,
6283
- workflows: workflowsApi
6224
+ dps: platformDpsApi
6284
6225
  };
6285
6226
 
6286
6227
  // src/apis/api.ts
@@ -6291,7 +6232,7 @@ var api = {
6291
6232
  isInitialized: false
6292
6233
  };
6293
6234
  function initApi(config, tokens) {
6294
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6235
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
6295
6236
  initPlatformAccountsClient(
6296
6237
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
6297
6238
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -6301,12 +6242,8 @@ function initApi(config, tokens) {
6301
6242
  (_d = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _d.token
6302
6243
  );
6303
6244
  initPlatformDpsClient((_e = config.urls.platform) == null ? void 0 : _e.dps, (_f = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _f.token);
6304
- initPlatformWorkflowsClient(
6305
- (_g = config.urls.platform) == null ? void 0 : _g.workflows,
6306
- (_h = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _h.token
6307
- );
6308
6245
  initPlatformAdapterClient(
6309
- (_i = config.urls.platform) == null ? void 0 : _i.adapter,
6246
+ (_g = config.urls.platform) == null ? void 0 : _g.adapter,
6310
6247
  tokens ? {
6311
6248
  platform: tokens.platform,
6312
6249
  github: tokens.github,
@@ -6318,15 +6255,15 @@ function initApi(config, tokens) {
6318
6255
  shopify: tokens.shopify
6319
6256
  } : void 0
6320
6257
  );
6321
- initLiveChatClient((_j = config.urls.products) == null ? void 0 : _j.livechat, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
6322
- initTextClient((_l = config.urls.integrations) == null ? void 0 : _l.text, (_m = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _m.token);
6323
- initGithubClient((_n = tokens == null ? void 0 : tokens.github) == null ? void 0 : _n.appToken);
6324
- initNetlifyClient((_o = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _o.token);
6325
- initVercelClient((_p = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _p.token);
6326
- initNeonClient((_q = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _q.token);
6327
- initPlanetScaleClient((_r = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _r.token);
6328
- initMailchimpClient((_s = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _s.token, (_t = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _t.server);
6329
- initShopifyClient((_u = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _u.token, (_v = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _v.shop);
6258
+ initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
6259
+ initTextClient((_j = config.urls.integrations) == null ? void 0 : _j.text, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
6260
+ initGithubClient((_l = tokens == null ? void 0 : tokens.github) == null ? void 0 : _l.appToken);
6261
+ initNetlifyClient((_m = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _m.token);
6262
+ initVercelClient((_n = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _n.token);
6263
+ initNeonClient((_o = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _o.token);
6264
+ initPlanetScaleClient((_p = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _p.token);
6265
+ initMailchimpClient((_q = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _q.token, (_r = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _r.server);
6266
+ initShopifyClient((_s = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _s.token, (_t = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _t.shop);
6330
6267
  api.isInitialized = true;
6331
6268
  }
6332
6269