@livechat/developer-studio-api 3.0.50 → 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.mjs CHANGED
@@ -1628,9 +1628,103 @@ var textPlatformDashboardApi = {
1628
1628
  }
1629
1629
  };
1630
1630
 
1631
+ // src/apis/integrations/text/platform/workflows/api.ts
1632
+ var textPlatformWorkflowsApi = {
1633
+ getWorkflows(authorization) {
1634
+ return __async(this, null, function* () {
1635
+ const { data: workflows } = yield textClientInstance.get(
1636
+ "/workflow_platform/workflows",
1637
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1638
+ ensureAuthorizationToken: true
1639
+ }))
1640
+ );
1641
+ return workflows;
1642
+ });
1643
+ },
1644
+ createWorkflow(payload, authorization) {
1645
+ return __async(this, null, function* () {
1646
+ yield textClientInstance.post(
1647
+ "/workflow_platform/workflows",
1648
+ payload,
1649
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1650
+ ensureAuthorizationToken: true
1651
+ }))
1652
+ );
1653
+ });
1654
+ },
1655
+ getWorkflow(payload, authorization) {
1656
+ return __async(this, null, function* () {
1657
+ const { data: workflow } = yield textClientInstance.get(
1658
+ `/workflow_platform/workflows/${payload.name}?version=${payload.version}`,
1659
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1660
+ ensureAuthorizationToken: true
1661
+ }))
1662
+ );
1663
+ return workflow;
1664
+ });
1665
+ },
1666
+ updateWorkflow(payload, authorization) {
1667
+ return __async(this, null, function* () {
1668
+ const { data: workflow } = yield textClientInstance.put(
1669
+ `/workflow_platform/workflows/${payload.name}`,
1670
+ payload,
1671
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1672
+ ensureAuthorizationToken: true
1673
+ }))
1674
+ );
1675
+ return workflow;
1676
+ });
1677
+ },
1678
+ deleteWorkflow(payload, authorization) {
1679
+ return __async(this, null, function* () {
1680
+ yield textClientInstance.delete(
1681
+ `/workflow_platform/workflows/${payload.name}`,
1682
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1683
+ ensureAuthorizationToken: true
1684
+ }))
1685
+ );
1686
+ });
1687
+ },
1688
+ executeWorkflow(payload, authorization) {
1689
+ return __async(this, null, function* () {
1690
+ const { data: execution } = yield textClientInstance.post(
1691
+ `/workflow_platform/workflows/${payload.name}/executions`,
1692
+ payload,
1693
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1694
+ ensureAuthorizationToken: true
1695
+ }))
1696
+ );
1697
+ return execution;
1698
+ });
1699
+ },
1700
+ getWorkflowExecutionsList(payload, authorization) {
1701
+ return __async(this, null, function* () {
1702
+ const { data: executions } = yield textClientInstance.get(
1703
+ `/workflow_platform/workflows/${payload.name}/executions`,
1704
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1705
+ ensureAuthorizationToken: true
1706
+ }))
1707
+ );
1708
+ return executions;
1709
+ });
1710
+ },
1711
+ getWorkflowExecutionDetails(payload, authorization) {
1712
+ return __async(this, null, function* () {
1713
+ const { data: execution } = yield textClientInstance.get(
1714
+ `/workflow_platform/workflows/${payload.name}/executions/${payload.execution_id}`,
1715
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1716
+ ensureAuthorizationToken: true
1717
+ }))
1718
+ );
1719
+ return execution;
1720
+ });
1721
+ }
1722
+ };
1723
+
1631
1724
  // src/apis/integrations/text/platform/api.ts
1632
1725
  var textPlatformApi = {
1633
- dashboard: textPlatformDashboardApi
1726
+ dashboard: textPlatformDashboardApi,
1727
+ workflows: textPlatformWorkflowsApi
1634
1728
  };
1635
1729
 
1636
1730
  // src/apis/integrations/text/api.ts
@@ -5805,6 +5899,17 @@ var platformAdapterAppApi = {
5805
5899
  }
5806
5900
  };
5807
5901
 
5902
+ // src/apis/integrations/text/platform/workflows/_contracts/dtos/workflows.ts
5903
+ var WorkflowDefinitionTaskType = {
5904
+ http: "HTTP",
5905
+ switch: "SWITCH",
5906
+ forkJoin: "FORK_JOIN",
5907
+ terminate: "TERMINATE",
5908
+ join: "JOIN",
5909
+ addNode: "ADD_NODE",
5910
+ addTrigger: "ADD_TRIGGER"
5911
+ };
5912
+
5808
5913
  // src/apis/platform/billing/instance.ts
5809
5914
  import axios19 from "axios";
5810
5915
  var platformBillingClientInstance = axios19.create({
@@ -5847,17 +5952,6 @@ function initPlatformBillingClient(baseUrl, token) {
5847
5952
  }
5848
5953
  }
5849
5954
 
5850
- // src/apis/platform/workflows/contracts.ts
5851
- var WorkflowDefinitionTaskType = {
5852
- http: "HTTP",
5853
- switch: "SWITCH",
5854
- forkJoin: "FORK_JOIN",
5855
- terminate: "TERMINATE",
5856
- join: "JOIN",
5857
- addNode: "ADD_NODE",
5858
- addTrigger: "ADD_TRIGGER"
5859
- };
5860
-
5861
5955
  // src/apis/platform/adapter/integrations/neon/api.ts
5862
5956
  var platformAdapterNeonProxyApi = {
5863
5957
  user(authorization) {
@@ -6004,165 +6098,12 @@ var platformBillingApi = {
6004
6098
  invoices: platformBillingInvoicesApi
6005
6099
  };
6006
6100
 
6007
- // src/apis/platform/workflows/instance.ts
6008
- import axios20 from "axios";
6009
- var WorkflowsApiError = class extends ApiErrorBase {
6010
- constructor() {
6011
- super(...arguments);
6012
- this.name = "dps";
6013
- }
6014
- };
6015
- var workflowsClientInstance = axios20.create({
6016
- baseURL: "https://api.labs.text.com/workflow_platform"
6017
- });
6018
- workflowsClientInstance.interceptors.response.use(
6019
- (response) => response,
6020
- (error) => {
6021
- var _a, _b, _c, _d;
6022
- if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
6023
- return Promise.reject(new UnauthorizeApiError("accounts"));
6024
- }
6025
- return Promise.reject(
6026
- new WorkflowsApiError(
6027
- error.message,
6028
- (_b = error.response) == null ? void 0 : _b.data,
6029
- (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
6030
- )
6031
- );
6032
- }
6033
- );
6034
- function getWorkflowsClientConfig(options = {}) {
6035
- var _a;
6036
- const currentHeaders = workflowsClientInstance.defaults.headers;
6037
- const defaultAuthorization = currentHeaders.Authorization;
6038
- if (!options.token && !defaultAuthorization) {
6039
- throw new UnauthorizeApiError("accounts");
6040
- }
6041
- const headers = {
6042
- authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
6043
- };
6044
- return {
6045
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
6046
- };
6047
- }
6048
- function initWorkflowsClient(baseUrl, token) {
6049
- const headers = workflowsClientInstance.defaults.headers;
6050
- if (baseUrl) {
6051
- workflowsClientInstance.interceptors.request.use(
6052
- (config) => {
6053
- config.baseURL = baseUrl;
6054
- return config;
6055
- },
6056
- (error) => Promise.reject(error)
6057
- );
6058
- }
6059
- if (token) {
6060
- headers.Authorization = `Bearer ${token}`;
6061
- } else {
6062
- delete headers.Authorization;
6063
- }
6064
- }
6065
-
6066
- // src/apis/platform/workflows/api.ts
6067
- var workflowsApi = {
6068
- getWorkflows(authorization) {
6069
- return __async(this, null, function* () {
6070
- const { data: workflows } = yield workflowsClientInstance.get(
6071
- "/workflows",
6072
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6073
- ensureAuthorizationToken: true
6074
- }))
6075
- );
6076
- return workflows;
6077
- });
6078
- },
6079
- createWorkflow(payload, authorization) {
6080
- return __async(this, null, function* () {
6081
- yield workflowsClientInstance.post(
6082
- "/workflows",
6083
- payload,
6084
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6085
- ensureAuthorizationToken: true
6086
- }))
6087
- );
6088
- });
6089
- },
6090
- getWorkflow(payload, authorization) {
6091
- return __async(this, null, function* () {
6092
- const { data: workflow } = yield workflowsClientInstance.get(
6093
- `/workflows/${payload.name}?version=${payload.version}`,
6094
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6095
- ensureAuthorizationToken: true
6096
- }))
6097
- );
6098
- return workflow;
6099
- });
6100
- },
6101
- updateWorkflow(payload, authorization) {
6102
- return __async(this, null, function* () {
6103
- const { data: workflow } = yield workflowsClientInstance.put(
6104
- `/workflows/${payload.name}`,
6105
- payload,
6106
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6107
- ensureAuthorizationToken: true
6108
- }))
6109
- );
6110
- return workflow;
6111
- });
6112
- },
6113
- deleteWorkflow(payload, authorization) {
6114
- return __async(this, null, function* () {
6115
- yield workflowsClientInstance.delete(
6116
- `/workflows/${payload.name}`,
6117
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6118
- ensureAuthorizationToken: true
6119
- }))
6120
- );
6121
- });
6122
- },
6123
- executeWorkflow(payload, authorization) {
6124
- return __async(this, null, function* () {
6125
- const { data: execution } = yield workflowsClientInstance.post(
6126
- `/workflows/${payload.name}/executions`,
6127
- payload,
6128
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6129
- ensureAuthorizationToken: true
6130
- }))
6131
- );
6132
- return execution;
6133
- });
6134
- },
6135
- getWorkflowExecutionsList(payload, authorization) {
6136
- return __async(this, null, function* () {
6137
- const { data: executions } = yield workflowsClientInstance.get(
6138
- `/workflows/${payload.name}/executions`,
6139
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6140
- ensureAuthorizationToken: true
6141
- }))
6142
- );
6143
- return executions;
6144
- });
6145
- },
6146
- getWorkflowExecutionDetails(payload, authorization) {
6147
- return __async(this, null, function* () {
6148
- const { data: execution } = yield workflowsClientInstance.get(
6149
- `/workflows/${payload.name}/executions/${payload.execution_id}`,
6150
- getWorkflowsClientConfig(__spreadProps(__spreadValues({}, authorization), {
6151
- ensureAuthorizationToken: true
6152
- }))
6153
- );
6154
- return execution;
6155
- });
6156
- }
6157
- };
6158
-
6159
6101
  // src/apis/platform/api.ts
6160
6102
  var platformApi = {
6161
6103
  accounts: platformAccountsApi,
6162
6104
  billing: platformBillingApi,
6163
6105
  adapter: platformAdapterApi,
6164
- dps: platformDpsApi,
6165
- workflows: workflowsApi
6106
+ dps: platformDpsApi
6166
6107
  };
6167
6108
 
6168
6109
  // src/apis/api.ts
@@ -6173,7 +6114,7 @@ var api = {
6173
6114
  isInitialized: false
6174
6115
  };
6175
6116
  function initApi(config, tokens) {
6176
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6117
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
6177
6118
  initPlatformAccountsClient(
6178
6119
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
6179
6120
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -6183,9 +6124,8 @@ function initApi(config, tokens) {
6183
6124
  (_d = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _d.token
6184
6125
  );
6185
6126
  initPlatformDpsClient((_e = config.urls.platform) == null ? void 0 : _e.dps, (_f = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _f.token);
6186
- initWorkflowsClient((_g = config.urls.platform) == null ? void 0 : _g.workflows, (_h = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _h.token);
6187
6127
  initPlatformAdapterClient(
6188
- (_i = config.urls.platform) == null ? void 0 : _i.adapter,
6128
+ (_g = config.urls.platform) == null ? void 0 : _g.adapter,
6189
6129
  tokens ? {
6190
6130
  platform: tokens.platform,
6191
6131
  github: tokens.github,
@@ -6197,15 +6137,15 @@ function initApi(config, tokens) {
6197
6137
  shopify: tokens.shopify
6198
6138
  } : void 0
6199
6139
  );
6200
- initLiveChatClient((_j = config.urls.products) == null ? void 0 : _j.livechat, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
6201
- initTextClient((_l = config.urls.integrations) == null ? void 0 : _l.text, (_m = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _m.token);
6202
- initGithubClient((_n = tokens == null ? void 0 : tokens.github) == null ? void 0 : _n.appToken);
6203
- initNetlifyClient((_o = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _o.token);
6204
- initVercelClient((_p = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _p.token);
6205
- initNeonClient((_q = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _q.token);
6206
- initPlanetScaleClient((_r = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _r.token);
6207
- 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);
6208
- 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);
6140
+ initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
6141
+ initTextClient((_j = config.urls.integrations) == null ? void 0 : _j.text, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
6142
+ initGithubClient((_l = tokens == null ? void 0 : tokens.github) == null ? void 0 : _l.appToken);
6143
+ initNetlifyClient((_m = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _m.token);
6144
+ initVercelClient((_n = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _n.token);
6145
+ initNeonClient((_o = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _o.token);
6146
+ initPlanetScaleClient((_p = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _p.token);
6147
+ 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);
6148
+ 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);
6209
6149
  api.isInitialized = true;
6210
6150
  }
6211
6151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.0.50",
3
+ "version": "3.0.52",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "@types/node": "^17.0.12",
20
20
  "tsup": "^7.1.0",
21
21
  "typescript": "^5.1.6",
22
+ "eslint-config-custom": "0.0.8",
22
23
  "tsconfig": "0.0.1",
23
- "utils": "0.0.4",
24
- "eslint-config-custom": "0.0.8"
24
+ "utils": "0.0.4"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsup",