@livechat/developer-studio-api 3.0.51 → 3.0.53

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
@@ -93,13 +93,13 @@ githubClientInstance.interceptors.response.use(
93
93
  function getGitHubClientAuthorization(req) {
94
94
  if (req.headers instanceof Headers) {
95
95
  return {
96
- appToken: req.headers.get("github-app-token"),
97
- oauthToken: req.headers.get("github-oauth-token")
96
+ appToken: req.headers.get("x-adapter-github-app-token"),
97
+ oauthToken: req.headers.get("x-adapter-github-oauth-token")
98
98
  };
99
99
  }
100
100
  return {
101
- appToken: req.headers["github-app-token"],
102
- oauthToken: req.headers["github-oauth-token"]
101
+ appToken: req.headers["x-adapter-github-app-token"],
102
+ oauthToken: req.headers["x-adapter-github-oauth-token"]
103
103
  };
104
104
  }
105
105
  function getGithubClientConfig(options = {}) {
@@ -556,11 +556,11 @@ netlifyClientInstance.interceptors.response.use(
556
556
  function getNetlifyClientAuthorization(req) {
557
557
  if (req.headers instanceof Headers) {
558
558
  return {
559
- token: req.headers.get("netlify-token")
559
+ token: req.headers.get("x-adapter-netlify-token")
560
560
  };
561
561
  }
562
562
  return {
563
- token: req.headers["netlify-token"]
563
+ token: req.headers["x-adapter-netlify-token"]
564
564
  };
565
565
  }
566
566
  function getNetlifyClientConfig(options = {}) {
@@ -1020,11 +1020,11 @@ planetScaleClientInstance.interceptors.response.use(
1020
1020
  function getPlanetScaleClientAuthorization(req) {
1021
1021
  if (req.headers instanceof Headers) {
1022
1022
  return {
1023
- token: req.headers.get("planetscale-token")
1023
+ token: req.headers.get("x-adapter-planetscale-token")
1024
1024
  };
1025
1025
  }
1026
1026
  return {
1027
- token: req.headers["planetscale-token"]
1027
+ token: req.headers["x-adapter-planetscale-token"]
1028
1028
  };
1029
1029
  }
1030
1030
  function getPlanetScaleClientConfig(options = {}) {
@@ -1237,12 +1237,12 @@ var textClientInstance = axios6.create({
1237
1237
  function getTextClientAuthorization(req) {
1238
1238
  if (req.headers instanceof Headers) {
1239
1239
  return {
1240
- token: req.headers.get("platform-token"),
1240
+ token: req.headers.get("x-adapter-platform-token"),
1241
1241
  tokenType: "Bearer"
1242
1242
  };
1243
1243
  }
1244
1244
  return {
1245
- token: req.headers["platform-token"],
1245
+ token: req.headers["x-adapter-platform-token"],
1246
1246
  tokenType: "Bearer"
1247
1247
  };
1248
1248
  }
@@ -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
@@ -1662,11 +1756,11 @@ vercelClientInstance.interceptors.response.use(
1662
1756
  function getVercelClientAuthorization(req) {
1663
1757
  if (req.headers instanceof Headers) {
1664
1758
  return {
1665
- token: req.headers.get("vercel-token")
1759
+ token: req.headers.get("x-adapter-vercel-token")
1666
1760
  };
1667
1761
  }
1668
1762
  return {
1669
- token: req.headers["vercel-token"]
1763
+ token: req.headers["x-adapter-vercel-token"]
1670
1764
  };
1671
1765
  }
1672
1766
  function getVercelClientConfig(options = {}) {
@@ -1986,11 +2080,11 @@ neonClientInstance.interceptors.response.use(
1986
2080
  function getNeonClientAuthorization(req) {
1987
2081
  if (req.headers instanceof Headers) {
1988
2082
  return {
1989
- token: req.headers.get("neon-token")
2083
+ token: req.headers.get("x-adapter-neon-token")
1990
2084
  };
1991
2085
  }
1992
2086
  return {
1993
- token: req.headers["neon-token"]
2087
+ token: req.headers["x-adapter-neon-token"]
1994
2088
  };
1995
2089
  }
1996
2090
  function getNeonClientConfig(options = {}) {
@@ -2319,13 +2413,13 @@ mailchimpClientInstance.interceptors.response.use(
2319
2413
  function getMailchimpClientAuthorization(req) {
2320
2414
  if (req.headers instanceof Headers) {
2321
2415
  return {
2322
- server: req.headers.get("mailchimp-server"),
2323
- token: req.headers.get("mailchimp-token")
2416
+ server: req.headers.get("x-adapter-mailchimp-server"),
2417
+ token: req.headers.get("x-adapter-mailchimp-token")
2324
2418
  };
2325
2419
  }
2326
2420
  return {
2327
- server: req.headers["mailchimp-server"],
2328
- token: req.headers["mailchimp-token"]
2421
+ server: req.headers["x-adapter-mailchimp-server"],
2422
+ token: req.headers["x-adapter-mailchimp-token"]
2329
2423
  };
2330
2424
  }
2331
2425
  function getMailchimpClientConfig(options = {}) {
@@ -2490,13 +2584,13 @@ var getShopifyClientUrl = (store) => `https://${store}.myshopify.com/admin/api/2
2490
2584
  function getShopifyClientAuthorization(req) {
2491
2585
  if (req.headers instanceof Headers) {
2492
2586
  return {
2493
- shop: req.headers.get("shopify-shop"),
2494
- token: req.headers.get("shopify-token")
2587
+ shop: req.headers.get("x-adapter-shopify-shop"),
2588
+ token: req.headers.get("x-adapter-shopify-token")
2495
2589
  };
2496
2590
  }
2497
2591
  return {
2498
- shop: req.headers["shopify-shop"],
2499
- token: req.headers["shopify-token"]
2592
+ shop: req.headers["x-adapter-shopify-shop"],
2593
+ token: req.headers["x-adapter-shopify-token"]
2500
2594
  };
2501
2595
  }
2502
2596
  function getShopifyClientConfig(options) {
@@ -2660,11 +2754,11 @@ livechatClientInstance.interceptors.response.use(
2660
2754
  function getLiveChatClientAuthorization(req) {
2661
2755
  if (req.headers instanceof Headers) {
2662
2756
  return {
2663
- token: req.headers.get("platform-token")
2757
+ token: req.headers.get("x-adapter-platform-token")
2664
2758
  };
2665
2759
  }
2666
2760
  return {
2667
- token: req.headers["platform-token"]
2761
+ token: req.headers["x-adapter-platform-token"]
2668
2762
  };
2669
2763
  }
2670
2764
  function getLiveChatClientConfig(options = {}) {
@@ -3232,11 +3326,11 @@ platformAccountsClientInstance.interceptors.response.use(
3232
3326
  function getPlatformAccountsClientAuthorization(req) {
3233
3327
  if (req.headers instanceof Headers) {
3234
3328
  return {
3235
- token: req.headers.get("platform-token")
3329
+ token: req.headers.get("x-adapter-platform-token")
3236
3330
  };
3237
3331
  }
3238
3332
  return {
3239
- token: req.headers["platform-token"]
3333
+ token: req.headers["x-adapter-platform-token"]
3240
3334
  };
3241
3335
  }
3242
3336
  function getPlatformAccountsClientConfig(options = {}) {
@@ -3574,12 +3668,12 @@ platformDpsClientInstance.interceptors.response.use(
3574
3668
  function getPlatformDpsClientAuthorization(req) {
3575
3669
  if (req.headers instanceof Headers) {
3576
3670
  return {
3577
- token: req.headers.get("platform-token"),
3671
+ token: req.headers.get("x-adapter-platform-token"),
3578
3672
  tokenType: "Bearer"
3579
3673
  };
3580
3674
  }
3581
3675
  return {
3582
- token: req.headers["platform-token"],
3676
+ token: req.headers["x-adapter-platform-token"],
3583
3677
  tokenType: "Bearer"
3584
3678
  };
3585
3679
  }
@@ -5163,61 +5257,61 @@ function getPlatformAdapterClientAuthorization(req) {
5163
5257
  if (req.headers instanceof Headers) {
5164
5258
  return {
5165
5259
  platform: {
5166
- token: req.headers.get("platform-token")
5260
+ token: req.headers.get("x-adapter-platform-token")
5167
5261
  },
5168
5262
  github: {
5169
- appToken: req.headers.get("github-app-token"),
5170
- oauthToken: req.headers.get("github-oauth-token")
5263
+ appToken: req.headers.get("x-adapter-github-app-token"),
5264
+ oauthToken: req.headers.get("x-adapter-github-oauth-token")
5171
5265
  },
5172
5266
  netlify: {
5173
- token: req.headers.get("netlify-token")
5267
+ token: req.headers.get("x-adapter-netlify-token")
5174
5268
  },
5175
5269
  vercel: {
5176
- token: req.headers.get("vercel-token")
5270
+ token: req.headers.get("x-adapter-vercel-token")
5177
5271
  },
5178
5272
  planetscale: {
5179
- token: req.headers.get("planetscale-token")
5273
+ token: req.headers.get("x-adapter-planetscale-token")
5180
5274
  },
5181
5275
  neon: {
5182
- token: req.headers.get("neon-token")
5276
+ token: req.headers.get("x-adapter-neon-token")
5183
5277
  },
5184
5278
  mailchimp: {
5185
- token: req.headers.get("mailchimp-token"),
5186
- server: req.headers.get("mailchimp-server")
5279
+ token: req.headers.get("x-adapter-mailchimp-token"),
5280
+ server: req.headers.get("x-adapter-mailchimp-server")
5187
5281
  },
5188
5282
  shopify: {
5189
- token: req.headers.get("shopify-token"),
5190
- shop: req.headers.get("shopify-shop")
5283
+ token: req.headers.get("x-adapter-shopify-token"),
5284
+ shop: req.headers.get("x-adapter-shopify-shop")
5191
5285
  }
5192
5286
  };
5193
5287
  }
5194
5288
  return {
5195
5289
  platform: {
5196
- token: req.headers["platform-token"]
5290
+ token: req.headers["x-adapter-platform-token"]
5197
5291
  },
5198
5292
  github: {
5199
- appToken: req.headers["github-app-token"],
5200
- oauthToken: req.headers["github-oauth-token"]
5293
+ appToken: req.headers["x-adapter-github-app-token"],
5294
+ oauthToken: req.headers["x-adapter-github-oauth-token"]
5201
5295
  },
5202
5296
  netlify: {
5203
- token: req.headers["netlify-token"]
5297
+ token: req.headers["x-adapter-netlify-token"]
5204
5298
  },
5205
5299
  vercel: {
5206
- token: req.headers["vercel-token"]
5300
+ token: req.headers["x-adapter-vercel-token"]
5207
5301
  },
5208
5302
  planetscale: {
5209
- token: req.headers["planetscale-token"]
5303
+ token: req.headers["x-adapter-planetscale-token"]
5210
5304
  },
5211
5305
  neon: {
5212
- token: req.headers["neon-token"]
5306
+ token: req.headers["x-adapter-neon-token"]
5213
5307
  },
5214
5308
  mailchimp: {
5215
- token: req.headers["mailchimp-token"],
5216
- server: req.headers["mailchimp-server"]
5309
+ token: req.headers["x-adapter-mailchimp-token"],
5310
+ server: req.headers["x-adapter-mailchimp-server"]
5217
5311
  },
5218
5312
  shopify: {
5219
- token: req.headers["shopify-token"],
5220
- shop: req.headers["shopify-shop"]
5313
+ token: req.headers["x-adapter-shopify-token"],
5314
+ shop: req.headers["x-adapter-shopify-shop"]
5221
5315
  }
5222
5316
  };
5223
5317
  }
@@ -5226,25 +5320,25 @@ function getPlatformAdapterClientConfig(options = {}) {
5226
5320
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5227
5321
  const headers = {
5228
5322
  platform: {
5229
- token: (_b = currentHeaders["platform-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.token
5323
+ token: (_b = currentHeaders["x-adapter-platform-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.token
5230
5324
  },
5231
5325
  integrations: {
5232
5326
  github: {
5233
- app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.appToken,
5234
- oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauthToken
5327
+ app: (_d = currentHeaders["x-adapter-github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.appToken,
5328
+ oauth: (_f = currentHeaders["x-adapter-github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauthToken
5235
5329
  },
5236
- netlify: (_h = currentHeaders["netlify-token"]) != null ? _h : (_g = options.netlify) == null ? void 0 : _g.token,
5237
- vercel: (_j = currentHeaders["vercel-token"]) != null ? _j : (_i = options.vercel) == null ? void 0 : _i.token,
5238
- planetscale: (_l = currentHeaders["planetscale-token"]) != null ? _l : (_k = options.planetscale) == null ? void 0 : _k.token,
5239
- neon: (_n = currentHeaders["neon-token"]) != null ? _n : (_m = options.neon) == null ? void 0 : _m.token,
5240
- mailchimp: (_p = currentHeaders["mailchimp-token"]) != null ? _p : (_o = options.mailchimp) == null ? void 0 : _o.token,
5241
- mailchimpServer: (_r = currentHeaders["mailchimp-server"]) != null ? _r : (_q = options.mailchimp) == null ? void 0 : _q.server,
5242
- shopify: (_t = currentHeaders["shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
5243
- shopifyShop: (_v = currentHeaders["shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop
5330
+ netlify: (_h = currentHeaders["x-adapter-netlify-token"]) != null ? _h : (_g = options.netlify) == null ? void 0 : _g.token,
5331
+ vercel: (_j = currentHeaders["x-adapter-vercel-token"]) != null ? _j : (_i = options.vercel) == null ? void 0 : _i.token,
5332
+ planetscale: (_l = currentHeaders["x-adapter-planetscale-token"]) != null ? _l : (_k = options.planetscale) == null ? void 0 : _k.token,
5333
+ neon: (_n = currentHeaders["x-adapter-neon-token"]) != null ? _n : (_m = options.neon) == null ? void 0 : _m.token,
5334
+ mailchimp: (_p = currentHeaders["x-adapter-mailchimp-token"]) != null ? _p : (_o = options.mailchimp) == null ? void 0 : _o.token,
5335
+ mailchimpServer: (_r = currentHeaders["x-adapter-mailchimp-server"]) != null ? _r : (_q = options.mailchimp) == null ? void 0 : _q.server,
5336
+ shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
5337
+ shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop
5244
5338
  }
5245
5339
  };
5246
- if (currentHeaders["platform-token"]) {
5247
- currentHeaders["X-Region"] = (_w = getRegion2(currentHeaders["platform-token"])) != null ? _w : void 0;
5340
+ if (currentHeaders["x-adapter-platform-token"]) {
5341
+ currentHeaders["X-Region"] = (_w = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _w : void 0;
5248
5342
  }
5249
5343
  if (((_x = options.ensureAuthorizationToken) == null ? void 0 : _x.platform) && !headers.platform.token) {
5250
5344
  throw new UnauthorizeApiError("accounts");
@@ -5271,7 +5365,7 @@ function getPlatformAdapterClientConfig(options = {}) {
5271
5365
  throw new UnauthorizeApiError("shopify");
5272
5366
  }
5273
5367
  return {
5274
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { "platform-token": headers.platform.token } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "shopify-shop": headers.integrations.shopifyShop } : {})
5368
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { "x-adapter-platform-token": headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {})
5275
5369
  };
5276
5370
  }
5277
5371
  var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -5297,37 +5391,37 @@ function updatePlatformAdapterClient(tokens) {
5297
5391
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5298
5392
  const headers = platformAdapterClientInstance.defaults.headers;
5299
5393
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
5300
- headers["platform-token"] = tokens.platform.token;
5394
+ headers["x-adapter-platform-token"] = tokens.platform.token;
5301
5395
  }
5302
5396
  if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.appToken) {
5303
- headers["github-app-token"] = tokens.github.appToken;
5397
+ headers["x-adapter-github-app-token"] = tokens.github.appToken;
5304
5398
  }
5305
5399
  if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauthToken) {
5306
- headers["github-oauth-token"] = tokens.github.oauthToken;
5400
+ headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
5307
5401
  }
5308
5402
  if ((_d = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _d.token) {
5309
- headers["netlify-token"] = tokens.netlify.token;
5403
+ headers["x-adapter-netlify-token"] = tokens.netlify.token;
5310
5404
  }
5311
5405
  if ((_e = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _e.token) {
5312
- headers["vercel-token"] = tokens.vercel.token;
5406
+ headers["x-adapter-vercel-token"] = tokens.vercel.token;
5313
5407
  }
5314
5408
  if ((_f = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _f.token) {
5315
- headers["planetscale-token"] = tokens.planetscale.token;
5409
+ headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
5316
5410
  }
5317
5411
  if ((_g = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _g.token) {
5318
- headers["neon-token"] = tokens.neon.token;
5412
+ headers["x-adapter-neon-token"] = tokens.neon.token;
5319
5413
  }
5320
5414
  if ((_h = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _h.server) {
5321
- headers["mailchimp-server"] = tokens.mailchimp.server;
5415
+ headers["x-adapter-mailchimp-server"] = tokens.mailchimp.server;
5322
5416
  }
5323
5417
  if ((_i = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _i.token) {
5324
- headers["mailchimp-token"] = tokens.mailchimp.token;
5418
+ headers["x-adapter-mailchimp-token"] = tokens.mailchimp.token;
5325
5419
  }
5326
5420
  if ((_j = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _j.shop) {
5327
- headers["shopify-shop"] = tokens.shopify.shop;
5421
+ headers["x-adapter-shopify-shop"] = tokens.shopify.shop;
5328
5422
  }
5329
5423
  if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.token) {
5330
- headers["shopify-token"] = tokens.shopify.token;
5424
+ headers["x-adapter-shopify-token"] = tokens.shopify.token;
5331
5425
  }
5332
5426
  }
5333
5427
 
@@ -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({
@@ -5813,11 +5918,11 @@ var platformBillingClientInstance = axios19.create({
5813
5918
  function getPlatformBillingClientAuthorization(req) {
5814
5919
  if (req.headers instanceof Headers) {
5815
5920
  return {
5816
- token: req.headers.get("platform-token")
5921
+ token: req.headers.get("x-adapter-platform-token")
5817
5922
  };
5818
5923
  }
5819
5924
  return {
5820
- token: req.headers["platform-token"]
5925
+ token: req.headers["x-adapter-platform-token"]
5821
5926
  };
5822
5927
  }
5823
5928
  function getPlatformBillingClientConfig(options = {}) {
@@ -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 PlatformWorkflowsApiError = class extends ApiErrorBase {
6010
- constructor() {
6011
- super(...arguments);
6012
- this.name = "platform_workflows";
6013
- }
6014
- };
6015
- var platformWorkflowsClientInstance = axios20.create({
6016
- baseURL: "https://api.labs.text.com/workflow_platform"
6017
- });
6018
- platformWorkflowsClientInstance.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 PlatformWorkflowsApiError(
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 getPlatformWorkflowsClientConfig(options = {}) {
6035
- var _a;
6036
- const currentHeaders = platformWorkflowsClientInstance.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 initPlatformWorkflowsClient(baseUrl, token) {
6049
- const headers = platformWorkflowsClientInstance.defaults.headers;
6050
- if (baseUrl) {
6051
- platformWorkflowsClientInstance.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 platformWorkflowsClientInstance.get(
6071
- "/workflows",
6072
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.post(
6082
- "/workflows",
6083
- payload,
6084
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.get(
6093
- `/workflows/${payload.name}?version=${payload.version}`,
6094
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.put(
6104
- `/workflows/${payload.name}`,
6105
- payload,
6106
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.delete(
6116
- `/workflows/${payload.name}`,
6117
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.post(
6126
- `/workflows/${payload.name}/executions`,
6127
- payload,
6128
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.get(
6138
- `/workflows/${payload.name}/executions`,
6139
- getPlatformWorkflowsClientConfig(__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 platformWorkflowsClientInstance.get(
6149
- `/workflows/${payload.name}/executions/${payload.execution_id}`,
6150
- getPlatformWorkflowsClientConfig(__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,12 +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
- initPlatformWorkflowsClient(
6187
- (_g = config.urls.platform) == null ? void 0 : _g.workflows,
6188
- (_h = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _h.token
6189
- );
6190
6127
  initPlatformAdapterClient(
6191
- (_i = config.urls.platform) == null ? void 0 : _i.adapter,
6128
+ (_g = config.urls.platform) == null ? void 0 : _g.adapter,
6192
6129
  tokens ? {
6193
6130
  platform: tokens.platform,
6194
6131
  github: tokens.github,
@@ -6200,15 +6137,15 @@ function initApi(config, tokens) {
6200
6137
  shopify: tokens.shopify
6201
6138
  } : void 0
6202
6139
  );
6203
- initLiveChatClient((_j = config.urls.products) == null ? void 0 : _j.livechat, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
6204
- initTextClient((_l = config.urls.integrations) == null ? void 0 : _l.text, (_m = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _m.token);
6205
- initGithubClient((_n = tokens == null ? void 0 : tokens.github) == null ? void 0 : _n.appToken);
6206
- initNetlifyClient((_o = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _o.token);
6207
- initVercelClient((_p = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _p.token);
6208
- initNeonClient((_q = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _q.token);
6209
- initPlanetScaleClient((_r = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _r.token);
6210
- 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);
6211
- 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);
6212
6149
  api.isInitialized = true;
6213
6150
  }
6214
6151