@livechat/developer-studio-api 2.3.51 → 2.3.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
@@ -91,7 +91,7 @@ __export(src_exports, {
91
91
  getPlatformDpsAdminClientAuthorization: () => getPlatformDpsAdminClientAuthorization,
92
92
  getPlatformDpsClientAuthorization: () => getPlatformDpsClientAuthorization,
93
93
  getPlatformDpsClientConfig: () => getPlatformDpsClientConfig,
94
- getRegion: () => getRegion,
94
+ getRegion: () => getRegion2,
95
95
  getSentryClientAuthorization: () => getSentryClientAuthorization,
96
96
  getSentryClientConfig: () => getSentryClientConfig,
97
97
  getTextClientAuthorization: () => getTextClientAuthorization,
@@ -2464,7 +2464,7 @@ var vercelApi = {
2464
2464
  };
2465
2465
 
2466
2466
  // src/apis/integrations/neon/api.ts
2467
- var import_axios11 = __toESM(require("axios"));
2467
+ var import_axios16 = __toESM(require("axios"));
2468
2468
 
2469
2469
  // src/apis/integrations/neon/instance.ts
2470
2470
  var import_axios10 = __toESM(require("axios"));
@@ -2488,28 +2488,420 @@ function getNeonClientAuthorization(req) {
2488
2488
  token: req.headers["neon-token"]
2489
2489
  };
2490
2490
  }
2491
- function getNeonClientConfig(options = {}) {
2492
- const currentHeaders = neonClientInstance.defaults.headers;
2491
+ function getNeonClientConfig(options = {}) {
2492
+ const currentHeaders = neonClientInstance.defaults.headers;
2493
+ const defaultAuthorization = currentHeaders.Authorization;
2494
+ const headers = {
2495
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2496
+ };
2497
+ if (options.ensureAuthorizationToken && !headers.authorization) {
2498
+ throw new UnauthorizeApiError("neon");
2499
+ }
2500
+ return {
2501
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2502
+ };
2503
+ }
2504
+ function initNeonClientInstance(token) {
2505
+ if (token) {
2506
+ updateNeonClientInstance(token);
2507
+ }
2508
+ }
2509
+ function updateNeonClientInstance(token) {
2510
+ const headers = neonClientInstance.defaults.headers;
2511
+ if (token) {
2512
+ headers.Authorization = `${token}`;
2513
+ } else {
2514
+ delete headers.Authorization;
2515
+ }
2516
+ }
2517
+
2518
+ // src/apis/platform/accounts/instance.ts
2519
+ var import_axios11 = __toESM(require("axios"));
2520
+ var platformAccountsClientInstance = import_axios11.default.create({
2521
+ baseURL: "https://accounts.labs.livechatinc.com"
2522
+ });
2523
+ function getPlatformAccountsClientAuthorization(req) {
2524
+ return {
2525
+ token: req.headers["platform-accounts-token"]
2526
+ };
2527
+ }
2528
+ function getPlatformAccountsClientConfig(options = {}) {
2529
+ const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
2530
+ const headers = {
2531
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2532
+ };
2533
+ return {
2534
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2535
+ };
2536
+ }
2537
+ function initPlatformAccountsClientInstance(baseUrl, token) {
2538
+ if (baseUrl) {
2539
+ platformAccountsClientInstance.interceptors.request.use(
2540
+ (config) => __async(this, null, function* () {
2541
+ config.baseURL = baseUrl;
2542
+ return config;
2543
+ }),
2544
+ (error) => Promise.reject(error)
2545
+ );
2546
+ }
2547
+ if (token) {
2548
+ platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2549
+ } else {
2550
+ delete platformAccountsClientInstance.defaults.headers["Authorization"];
2551
+ }
2552
+ }
2553
+
2554
+ // src/apis/platform/billing/instance.ts
2555
+ var import_axios12 = __toESM(require("axios"));
2556
+ var platformBillingClientInstance = import_axios12.default.create({
2557
+ baseURL: "https://billing.labs.livechatinc.com"
2558
+ });
2559
+ function getPlatformBillingClientAuthorization(req) {
2560
+ return {
2561
+ token: req.headers["platform-token"]
2562
+ };
2563
+ }
2564
+ function getPlatformBillingClientConfig(options = {}) {
2565
+ const defaultAuthorization = platformBillingClientInstance.defaults.headers.Authorization;
2566
+ const headers = {
2567
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2568
+ };
2569
+ return {
2570
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2571
+ };
2572
+ }
2573
+ function initPlatformBillingClientInstance(baseUrl, token) {
2574
+ if (baseUrl) {
2575
+ platformBillingClientInstance.interceptors.request.use(
2576
+ (config) => __async(this, null, function* () {
2577
+ config.baseURL = baseUrl;
2578
+ return config;
2579
+ }),
2580
+ (error) => Promise.reject(error)
2581
+ );
2582
+ }
2583
+ if (token) {
2584
+ platformBillingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
2585
+ } else {
2586
+ delete platformBillingClientInstance.defaults.headers.Authorization;
2587
+ }
2588
+ }
2589
+
2590
+ // src/apis/platform/adapter/instance.ts
2591
+ var import_axios13 = __toESM(require("axios"));
2592
+ var REGION = {
2593
+ FRA: "fra",
2594
+ DAL: "dal",
2595
+ FRA_A: "fra-a",
2596
+ FRA_B: "fra-b"
2597
+ };
2598
+ var supportedRegions = Object.values(REGION);
2599
+ var getRegion = (token) => {
2600
+ const region = token.split(":")[0];
2601
+ if (supportedRegions.includes(region)) {
2602
+ return region;
2603
+ }
2604
+ };
2605
+ function getPlatformAdapterClientAuthorization(req) {
2606
+ return {
2607
+ platform: {
2608
+ dps: req.headers["platform-dps-token"]
2609
+ },
2610
+ github: {
2611
+ app: req.headers["github-app-token"],
2612
+ oauth: req.headers["github-oauth-token"]
2613
+ },
2614
+ netlify: req.headers["netlify-token"],
2615
+ vercel: req.headers["vercel-token"],
2616
+ planetscale: req.headers["planetscale-token"],
2617
+ neon: req.headers["neon-token"],
2618
+ sentry: req.headers["sentry-token"],
2619
+ openai: req.headers["openai-token"]
2620
+ };
2621
+ }
2622
+ var platformAdapterClientInstance = import_axios13.default.create({
2623
+ baseURL: "https://platform.labs.text.com/console-adapter/api",
2624
+ headers: {
2625
+ "Content-Type": "application/json"
2626
+ }
2627
+ });
2628
+ platformAdapterClientInstance.interceptors.response.use(
2629
+ (r) => r,
2630
+ (error) => {
2631
+ var _a;
2632
+ if (import_axios13.default.isAxiosError(error)) {
2633
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2634
+ const source = error.response.data.error.source;
2635
+ if (source) {
2636
+ throw new UnauthorizeApiError(source);
2637
+ }
2638
+ }
2639
+ }
2640
+ throw error;
2641
+ }
2642
+ );
2643
+ function getPlatformAdapterClientConfig(options = {}) {
2644
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2645
+ const currentHeaders = platformAdapterClientInstance.defaults.headers;
2646
+ const headers = {
2647
+ platform: {
2648
+ dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
2649
+ },
2650
+ integrations: {
2651
+ github: {
2652
+ app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
2653
+ oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
2654
+ },
2655
+ netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
2656
+ vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
2657
+ planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
2658
+ neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
2659
+ sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
2660
+ openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
2661
+ }
2662
+ };
2663
+ if (currentHeaders["platform-dps-token"]) {
2664
+ currentHeaders["X-Region"] = (_m = getRegion(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
2665
+ }
2666
+ if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
2667
+ throw new UnauthorizeApiError("dps");
2668
+ }
2669
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2670
+ throw new UnauthorizeApiError("github");
2671
+ }
2672
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
2673
+ throw new UnauthorizeApiError("vercel");
2674
+ }
2675
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
2676
+ throw new UnauthorizeApiError("netlify");
2677
+ }
2678
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
2679
+ throw new UnauthorizeApiError("planetscale");
2680
+ }
2681
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
2682
+ throw new UnauthorizeApiError("neon");
2683
+ }
2684
+ if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
2685
+ throw new UnauthorizeApiError("sentry");
2686
+ }
2687
+ if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
2688
+ throw new UnauthorizeApiError("openai");
2689
+ }
2690
+ return {
2691
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), 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.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
2692
+ };
2693
+ }
2694
+ function initPlatformAdapterClientInstance(baseUrl, tokens) {
2695
+ if (baseUrl) {
2696
+ platformAdapterClientInstance.interceptors.request.use(
2697
+ (config) => {
2698
+ config.baseURL = baseUrl;
2699
+ return config;
2700
+ },
2701
+ (error) => Promise.reject(error)
2702
+ );
2703
+ }
2704
+ if (tokens) {
2705
+ updatePlatformAdapterClientInstance(tokens);
2706
+ }
2707
+ }
2708
+ function updatePlatformAdapterClientInstance(tokens) {
2709
+ var _a, _b, _c;
2710
+ const headers = platformAdapterClientInstance.defaults.headers;
2711
+ if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
2712
+ headers["platform-dps-token"] = tokens.platform.dps;
2713
+ }
2714
+ if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.app) {
2715
+ headers["github-app-token"] = tokens.github.app;
2716
+ }
2717
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauth) {
2718
+ headers["github-oauth-token"] = tokens.github.oauth;
2719
+ }
2720
+ if (tokens == null ? void 0 : tokens.netlify) {
2721
+ headers["netlify-token"] = tokens.netlify;
2722
+ }
2723
+ if (tokens == null ? void 0 : tokens.vercel) {
2724
+ headers["vercel-token"] = tokens.vercel;
2725
+ }
2726
+ if (tokens == null ? void 0 : tokens.planetscale) {
2727
+ headers["planetscale-token"] = tokens.planetscale;
2728
+ }
2729
+ if (tokens == null ? void 0 : tokens.neon) {
2730
+ headers["neon-token"] = tokens.neon;
2731
+ }
2732
+ if (tokens == null ? void 0 : tokens.sentry) {
2733
+ headers["sentry-token"] = tokens.sentry;
2734
+ }
2735
+ if (tokens == null ? void 0 : tokens.openai) {
2736
+ headers["openai-token"] = tokens.openai;
2737
+ }
2738
+ }
2739
+
2740
+ // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
2741
+ var getEmptyAppAutoReview = () => ({
2742
+ isReviewed: false,
2743
+ recommendations: {
2744
+ listingDetails: {
2745
+ appName: "",
2746
+ shortDescription: "",
2747
+ longDescription: "",
2748
+ features: "",
2749
+ benefits: ""
2750
+ },
2751
+ auth: {
2752
+ hasZeroScopes: false
2753
+ }
2754
+ },
2755
+ errors: {
2756
+ listingDetails: {
2757
+ appName: "",
2758
+ shortDescription: "",
2759
+ longDescription: "",
2760
+ features: "",
2761
+ benefits: ""
2762
+ },
2763
+ auth: {
2764
+ hasAllScopes: false,
2765
+ isRedirectUriSafe: false
2766
+ },
2767
+ links: {
2768
+ tutorial: {
2769
+ returns200: false,
2770
+ isValid: false
2771
+ },
2772
+ privacyPolicy: {
2773
+ returns200: false,
2774
+ isValid: false
2775
+ }
2776
+ },
2777
+ images: {
2778
+ icon: {
2779
+ isNsfw: false,
2780
+ isRatioValid: false
2781
+ },
2782
+ screenshots: {
2783
+ areNsfw: false,
2784
+ areRatiosValid: false
2785
+ }
2786
+ }
2787
+ }
2788
+ });
2789
+
2790
+ // src/apis/platform/dps/applications/application/autoReview/_contracts/payloads/autoReview.ts
2791
+ var getAppAutoReviewPayload = (value) => {
2792
+ return {
2793
+ appName: value,
2794
+ shortDescription: value,
2795
+ longDescription: value,
2796
+ features: value,
2797
+ benefits: value,
2798
+ scopes: value,
2799
+ redirect: value,
2800
+ tutorial: value,
2801
+ privacyPolicy: value,
2802
+ icons: value,
2803
+ screenshots: value
2804
+ };
2805
+ };
2806
+
2807
+ // src/apis/platform/dps/instance.ts
2808
+ var import_axios14 = __toESM(require("axios"));
2809
+ var platformDpsClientInstance = import_axios14.default.create({
2810
+ baseURL: "https://dev-platform.labs.livechatinc.com"
2811
+ });
2812
+ function getPlatformDpsClientAuthorization(req) {
2813
+ var _a;
2814
+ return {
2815
+ token: (_a = req.headers["platform-dps-token"]) != null ? _a : req.headers["platform-token"],
2816
+ tokenType: "Bearer"
2817
+ };
2818
+ }
2819
+ function getPlatformDpsAdminClientAuthorization() {
2820
+ var _a, _b;
2821
+ const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? (_a = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB) != null ? _a : "" : (_b = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS) != null ? _b : "";
2822
+ return {
2823
+ token: btoa(`apps@livechatinc.com:${token}`),
2824
+ tokenType: "Basic"
2825
+ };
2826
+ }
2827
+ function getPlatformDpsClientConfig(options = {}) {
2828
+ const currentHeaders = platformDpsClientInstance.defaults.headers;
2829
+ const defaultAuthorization = currentHeaders.Authorization;
2830
+ const headers = {
2831
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2832
+ };
2833
+ return {
2834
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2835
+ };
2836
+ }
2837
+ function initPlatformDpsClientInstance(baseUrl, token) {
2838
+ const headers = platformDpsClientInstance.defaults.headers;
2839
+ if (baseUrl) {
2840
+ platformDpsClientInstance.interceptors.request.use(
2841
+ (config) => {
2842
+ config.baseURL = baseUrl;
2843
+ return config;
2844
+ },
2845
+ (error) => Promise.reject(error)
2846
+ );
2847
+ }
2848
+ if (token) {
2849
+ headers.Authorization = `Bearer ${token}`;
2850
+ } else {
2851
+ delete headers.Authorization;
2852
+ }
2853
+ }
2854
+
2855
+ // src/apis/products/livechat/instance.ts
2856
+ var import_axios15 = __toESM(require("axios"));
2857
+ var REGION2 = {
2858
+ FRA: "fra",
2859
+ DAL: "dal",
2860
+ FRA_A: "fra-a",
2861
+ FRA_B: "fra-b"
2862
+ };
2863
+ var supportedRegions2 = Object.values(REGION2);
2864
+ var getRegion2 = (token) => {
2865
+ const region = token.split(":")[0];
2866
+ if (supportedRegions2.includes(region)) {
2867
+ return region;
2868
+ }
2869
+ };
2870
+ var livechatClientInstance = import_axios15.default.create({
2871
+ baseURL: "https://api.labs.livechatinc.com"
2872
+ });
2873
+ function getLiveChatClientAuthorization(req) {
2874
+ return {
2875
+ token: req.headers["livechat-token"]
2876
+ };
2877
+ }
2878
+ function getLiveChatClientConfig(options = {}) {
2879
+ const currentHeaders = livechatClientInstance.defaults.headers;
2493
2880
  const defaultAuthorization = currentHeaders.Authorization;
2494
2881
  const headers = {
2495
2882
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2496
2883
  };
2497
- if (options.ensureAuthorizationToken && !headers.authorization) {
2498
- throw new UnauthorizeApiError("neon");
2499
- }
2500
2884
  return {
2501
2885
  headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2502
2886
  };
2503
2887
  }
2504
- function initNeonClientInstance(token) {
2505
- if (token) {
2506
- updateNeonClientInstance(token);
2888
+ function initLiveChatClientInstance(baseUrl, token) {
2889
+ const region = token ? getRegion2(token) : void 0;
2890
+ const headers = livechatClientInstance.defaults.headers;
2891
+ if (baseUrl) {
2892
+ livechatClientInstance.interceptors.request.use(
2893
+ (config) => {
2894
+ config.baseURL = baseUrl;
2895
+ return config;
2896
+ },
2897
+ (error) => Promise.reject(error)
2898
+ );
2899
+ }
2900
+ if (region) {
2901
+ headers["X-Region"] = region;
2507
2902
  }
2508
- }
2509
- function updateNeonClientInstance(token) {
2510
- const headers = neonClientInstance.defaults.headers;
2511
2903
  if (token) {
2512
- headers.Authorization = `${token}`;
2904
+ headers.Authorization = `Bearer ${token}`;
2513
2905
  } else {
2514
2906
  delete headers.Authorization;
2515
2907
  }
@@ -2517,20 +2909,88 @@ function updateNeonClientInstance(token) {
2517
2909
 
2518
2910
  // src/apis/integrations/neon/project/branch/api.ts
2519
2911
  var neonProjectBranchApi = {
2520
- getBranch(projectId, branchId, authorization) {
2912
+ getBranches(projectId, authorization) {
2521
2913
  return __async(this, null, function* () {
2522
2914
  const response = yield neonClientInstance.get(
2523
- `projects/${projectId}/branches/${branchId}`,
2524
- getNeonClientConfig(__spreadValues({}, authorization))
2915
+ `projects/${projectId}/branches`,
2916
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2917
+ ensureAuthorizationToken: true
2918
+ }))
2525
2919
  );
2526
2920
  return response.data;
2527
2921
  });
2528
2922
  },
2529
- getBranches(projectId, authorization) {
2923
+ createDatabase(projectId, branchId, databaseName, ownerName, authorization) {
2924
+ return __async(this, null, function* () {
2925
+ const response = yield neonClientInstance.post(
2926
+ `projects/${projectId}/branches/${branchId}/databases`,
2927
+ {
2928
+ database: {
2929
+ name: databaseName,
2930
+ owner_name: ownerName
2931
+ }
2932
+ },
2933
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2934
+ ensureAuthorizationToken: true
2935
+ }))
2936
+ );
2937
+ return response.data;
2938
+ });
2939
+ },
2940
+ deleteDatabase(projectId, branchId, databaseName, authorization) {
2941
+ return __async(this, null, function* () {
2942
+ const response = yield neonClientInstance.delete(
2943
+ `projects/${projectId}/branches/${branchId}/databases/${databaseName}`,
2944
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2945
+ ensureAuthorizationToken: true
2946
+ }))
2947
+ );
2948
+ return response.data;
2949
+ });
2950
+ },
2951
+ getDatabases(projectId, branchId, authorization) {
2530
2952
  return __async(this, null, function* () {
2531
2953
  const response = yield neonClientInstance.get(
2532
- `projects/${projectId}/branches`,
2533
- getNeonClientConfig(__spreadValues({}, authorization))
2954
+ `projects/${projectId}/branches/${branchId}/databases`,
2955
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2956
+ ensureAuthorizationToken: true
2957
+ }))
2958
+ );
2959
+ return response.data;
2960
+ });
2961
+ },
2962
+ getNeonDatabases(projectId, authorization) {
2963
+ return __async(this, null, function* () {
2964
+ const response = yield platformAdapterClientInstance.post(
2965
+ `integrations/neon/databases`,
2966
+ {
2967
+ projectId
2968
+ },
2969
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2970
+ ensureAuthorizationToken: true
2971
+ }))
2972
+ );
2973
+ return response.data;
2974
+ });
2975
+ },
2976
+ getRolePassword(projectId, branchId, roleName, authorization) {
2977
+ return __async(this, null, function* () {
2978
+ const response = yield neonClientInstance.get(
2979
+ `projects/${projectId}/branches/${branchId}/roles/${roleName}/reveal_password`,
2980
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2981
+ ensureAuthorizationToken: true
2982
+ }))
2983
+ );
2984
+ return response.data;
2985
+ });
2986
+ },
2987
+ getBranchEndpoints(projectId, branchId, authorization) {
2988
+ return __async(this, null, function* () {
2989
+ const response = yield neonClientInstance.get(
2990
+ `projects/${projectId}/branches/${branchId}/endpoints`,
2991
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
2992
+ ensureAuthorizationToken: true
2993
+ }))
2534
2994
  );
2535
2995
  return response.data;
2536
2996
  });
@@ -2540,13 +3000,16 @@ var neonProjectBranchApi = {
2540
3000
  // src/apis/integrations/neon/project/api.ts
2541
3001
  var neonProjectApi = {
2542
3002
  branch: neonProjectBranchApi,
2543
- createProject(projectName, authorization) {
3003
+ createProject(projectName, databaseName, authorization) {
2544
3004
  return __async(this, null, function* () {
2545
3005
  const response = yield neonClientInstance.post(
2546
3006
  `/projects`,
2547
3007
  {
2548
3008
  project: {
2549
- name: projectName
3009
+ name: projectName,
3010
+ branch: {
3011
+ database_name: databaseName
3012
+ }
2550
3013
  }
2551
3014
  },
2552
3015
  getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -2588,6 +3051,17 @@ var neonProjectApi = {
2588
3051
  );
2589
3052
  return response.data;
2590
3053
  });
3054
+ },
3055
+ getNeonProjects(authorization) {
3056
+ return __async(this, null, function* () {
3057
+ const response = yield platformAdapterClientInstance.get(
3058
+ "/integrations/neon/projects",
3059
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
3060
+ ensureAuthorizationToken: true
3061
+ }))
3062
+ );
3063
+ return response.data;
3064
+ });
2591
3065
  }
2592
3066
  };
2593
3067
 
@@ -2603,6 +3077,17 @@ var neonUserApi = {
2603
3077
  );
2604
3078
  return response.data;
2605
3079
  });
3080
+ },
3081
+ getNeonUser(authorization) {
3082
+ return __async(this, null, function* () {
3083
+ const response = yield platformAdapterClientInstance.get(
3084
+ "/integrations/neon/user",
3085
+ getNeonClientConfig(__spreadProps(__spreadValues({}, authorization), {
3086
+ ensureAuthorizationToken: true
3087
+ }))
3088
+ );
3089
+ return response.data;
3090
+ });
2606
3091
  }
2607
3092
  };
2608
3093
 
@@ -2612,7 +3097,7 @@ var neonApi = {
2612
3097
  user: neonUserApi,
2613
3098
  getToken(code, clientId, clientSecret, redirectUri) {
2614
3099
  return __async(this, null, function* () {
2615
- var _a;
3100
+ var _a, _b;
2616
3101
  const data = new URLSearchParams({
2617
3102
  code,
2618
3103
  client_id: clientId,
@@ -2620,7 +3105,7 @@ var neonApi = {
2620
3105
  redirect_uri: redirectUri,
2621
3106
  grant_type: "authorization_code"
2622
3107
  });
2623
- const response = yield import_axios11.default.post(
3108
+ const response = yield import_axios16.default.post(
2624
3109
  "https://oauth2.neon.tech/oauth2/token",
2625
3110
  data,
2626
3111
  {
@@ -2630,7 +3115,10 @@ var neonApi = {
2630
3115
  }
2631
3116
  );
2632
3117
  const params = new URLSearchParams(response.data);
2633
- return (_a = params.get("access_token")) != null ? _a : "";
3118
+ return {
3119
+ token: (_a = params.get("access_token")) != null ? _a : "",
3120
+ refreshToken: (_b = params.get("refresh_token")) != null ? _b : ""
3121
+ };
2634
3122
  });
2635
3123
  }
2636
3124
  };
@@ -2646,61 +3134,6 @@ var integrationsApi = {
2646
3134
  text: textApi
2647
3135
  };
2648
3136
 
2649
- // src/apis/products/livechat/instance.ts
2650
- var import_axios12 = __toESM(require("axios"));
2651
- var REGION = {
2652
- FRA: "fra",
2653
- DAL: "dal",
2654
- FRA_A: "fra-a",
2655
- FRA_B: "fra-b"
2656
- };
2657
- var supportedRegions = Object.values(REGION);
2658
- var getRegion = (token) => {
2659
- const region = token.split(":")[0];
2660
- if (supportedRegions.includes(region)) {
2661
- return region;
2662
- }
2663
- };
2664
- var livechatClientInstance = import_axios12.default.create({
2665
- baseURL: "https://api.labs.livechatinc.com"
2666
- });
2667
- function getLiveChatClientAuthorization(req) {
2668
- return {
2669
- token: req.headers["livechat-token"]
2670
- };
2671
- }
2672
- function getLiveChatClientConfig(options = {}) {
2673
- const currentHeaders = livechatClientInstance.defaults.headers;
2674
- const defaultAuthorization = currentHeaders.Authorization;
2675
- const headers = {
2676
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2677
- };
2678
- return {
2679
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
2680
- };
2681
- }
2682
- function initLiveChatClientInstance(baseUrl, token) {
2683
- const region = token ? getRegion(token) : void 0;
2684
- const headers = livechatClientInstance.defaults.headers;
2685
- if (baseUrl) {
2686
- livechatClientInstance.interceptors.request.use(
2687
- (config) => {
2688
- config.baseURL = baseUrl;
2689
- return config;
2690
- },
2691
- (error) => Promise.reject(error)
2692
- );
2693
- }
2694
- if (region) {
2695
- headers["X-Region"] = region;
2696
- }
2697
- if (token) {
2698
- headers.Authorization = `Bearer ${token}`;
2699
- } else {
2700
- delete headers.Authorization;
2701
- }
2702
- }
2703
-
2704
3137
  // src/apis/products/livechat/agents/api.ts
2705
3138
  var livechatAgentApi = {
2706
3139
  getUser() {
@@ -3143,42 +3576,6 @@ var productsApi = {
3143
3576
  livechat: livechatApi
3144
3577
  };
3145
3578
 
3146
- // src/apis/platform/accounts/instance.ts
3147
- var import_axios13 = __toESM(require("axios"));
3148
- var platformAccountsClientInstance = import_axios13.default.create({
3149
- baseURL: "https://accounts.labs.livechatinc.com"
3150
- });
3151
- function getPlatformAccountsClientAuthorization(req) {
3152
- return {
3153
- token: req.headers["platform-accounts-token"]
3154
- };
3155
- }
3156
- function getPlatformAccountsClientConfig(options = {}) {
3157
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
3158
- const headers = {
3159
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3160
- };
3161
- return {
3162
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
3163
- };
3164
- }
3165
- function initPlatformAccountsClientInstance(baseUrl, token) {
3166
- if (baseUrl) {
3167
- platformAccountsClientInstance.interceptors.request.use(
3168
- (config) => __async(this, null, function* () {
3169
- config.baseURL = baseUrl;
3170
- return config;
3171
- }),
3172
- (error) => Promise.reject(error)
3173
- );
3174
- }
3175
- if (token) {
3176
- platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
3177
- } else {
3178
- delete platformAccountsClientInstance.defaults.headers["Authorization"];
3179
- }
3180
- }
3181
-
3182
3579
  // src/apis/platform/accounts/accounts/api.ts
3183
3580
  var platformAccountsAccountApi = {
3184
3581
  getAccounts(authorization) {
@@ -3590,61 +3987,13 @@ var platformAccountsTokenApi = {
3590
3987
  var platformAccountsApi = {
3591
3988
  account: platformAccountsAccountApi,
3592
3989
  client: platformAccountsClientApi,
3593
- pat: platformAccountsPersonalAccessTokenApi,
3594
- organization: platformAccountsOrganizationApi,
3595
- products: platformAccountsProductsApi,
3596
- scopes: platformAccountsScopesApi,
3597
- sessions: platformAccountsSessionsApi,
3598
- token: platformAccountsTokenApi
3599
- };
3600
-
3601
- // src/apis/platform/dps/instance.ts
3602
- var import_axios14 = __toESM(require("axios"));
3603
- var platformDpsClientInstance = import_axios14.default.create({
3604
- baseURL: "https://dev-platform.labs.livechatinc.com"
3605
- });
3606
- function getPlatformDpsClientAuthorization(req) {
3607
- var _a;
3608
- return {
3609
- token: (_a = req.headers["platform-dps-token"]) != null ? _a : req.headers["platform-token"],
3610
- tokenType: "Bearer"
3611
- };
3612
- }
3613
- function getPlatformDpsAdminClientAuthorization() {
3614
- var _a, _b;
3615
- const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? (_a = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB) != null ? _a : "" : (_b = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS) != null ? _b : "";
3616
- return {
3617
- token: btoa(`apps@livechatinc.com:${token}`),
3618
- tokenType: "Basic"
3619
- };
3620
- }
3621
- function getPlatformDpsClientConfig(options = {}) {
3622
- const currentHeaders = platformDpsClientInstance.defaults.headers;
3623
- const defaultAuthorization = currentHeaders.Authorization;
3624
- const headers = {
3625
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3626
- };
3627
- return {
3628
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
3629
- };
3630
- }
3631
- function initPlatformDpsClientInstance(baseUrl, token) {
3632
- const headers = platformDpsClientInstance.defaults.headers;
3633
- if (baseUrl) {
3634
- platformDpsClientInstance.interceptors.request.use(
3635
- (config) => {
3636
- config.baseURL = baseUrl;
3637
- return config;
3638
- },
3639
- (error) => Promise.reject(error)
3640
- );
3641
- }
3642
- if (token) {
3643
- headers.Authorization = `Bearer ${token}`;
3644
- } else {
3645
- delete headers.Authorization;
3646
- }
3647
- }
3990
+ pat: platformAccountsPersonalAccessTokenApi,
3991
+ organization: platformAccountsOrganizationApi,
3992
+ products: platformAccountsProductsApi,
3993
+ scopes: platformAccountsScopesApi,
3994
+ sessions: platformAccountsSessionsApi,
3995
+ token: platformAccountsTokenApi
3996
+ };
3648
3997
 
3649
3998
  // src/apis/platform/dps/applications/application/authorization/api.ts
3650
3999
  var platformDpsApplicationAuthorizationApi = {
@@ -3668,73 +4017,6 @@ var platformDpsApplicationAuthorizationApi = {
3668
4017
  }
3669
4018
  };
3670
4019
 
3671
- // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3672
- var getEmptyAppAutoReview = () => ({
3673
- isReviewed: false,
3674
- recommendations: {
3675
- listingDetails: {
3676
- appName: "",
3677
- shortDescription: "",
3678
- longDescription: "",
3679
- features: "",
3680
- benefits: ""
3681
- },
3682
- auth: {
3683
- hasZeroScopes: false
3684
- }
3685
- },
3686
- errors: {
3687
- listingDetails: {
3688
- appName: "",
3689
- shortDescription: "",
3690
- longDescription: "",
3691
- features: "",
3692
- benefits: ""
3693
- },
3694
- auth: {
3695
- hasAllScopes: false,
3696
- isRedirectUriSafe: false
3697
- },
3698
- links: {
3699
- tutorial: {
3700
- returns200: false,
3701
- isValid: false
3702
- },
3703
- privacyPolicy: {
3704
- returns200: false,
3705
- isValid: false
3706
- }
3707
- },
3708
- images: {
3709
- icon: {
3710
- isNsfw: false,
3711
- isRatioValid: false
3712
- },
3713
- screenshots: {
3714
- areNsfw: false,
3715
- areRatiosValid: false
3716
- }
3717
- }
3718
- }
3719
- });
3720
-
3721
- // src/apis/platform/dps/applications/application/autoReview/_contracts/payloads/autoReview.ts
3722
- var getAppAutoReviewPayload = (value) => {
3723
- return {
3724
- appName: value,
3725
- shortDescription: value,
3726
- longDescription: value,
3727
- features: value,
3728
- benefits: value,
3729
- scopes: value,
3730
- redirect: value,
3731
- tutorial: value,
3732
- privacyPolicy: value,
3733
- icons: value,
3734
- screenshots: value
3735
- };
3736
- };
3737
-
3738
4020
  // src/apis/platform/dps/applications/application/autoReview/api.ts
3739
4021
  var platformDpsApplicationAutoReviewApi = {
3740
4022
  getAutoReview(appId, authorization) {
@@ -5215,156 +5497,6 @@ var platformDpsApi = {
5215
5497
  research: platformDpsResearchApi
5216
5498
  };
5217
5499
 
5218
- // src/apis/platform/adapter/instance.ts
5219
- var import_axios15 = __toESM(require("axios"));
5220
- var REGION2 = {
5221
- FRA: "fra",
5222
- DAL: "dal",
5223
- FRA_A: "fra-a",
5224
- FRA_B: "fra-b"
5225
- };
5226
- var supportedRegions2 = Object.values(REGION2);
5227
- var getRegion2 = (token) => {
5228
- const region = token.split(":")[0];
5229
- if (supportedRegions2.includes(region)) {
5230
- return region;
5231
- }
5232
- };
5233
- function getPlatformAdapterClientAuthorization(req) {
5234
- return {
5235
- platform: {
5236
- dps: req.headers["platform-dps-token"]
5237
- },
5238
- github: {
5239
- app: req.headers["github-app-token"],
5240
- oauth: req.headers["github-oauth-token"]
5241
- },
5242
- netlify: req.headers["netlify-token"],
5243
- vercel: req.headers["vercel-token"],
5244
- planetscale: req.headers["planetscale-token"],
5245
- neon: req.headers["neon-token"],
5246
- sentry: req.headers["sentry-token"],
5247
- openai: req.headers["openai-token"]
5248
- };
5249
- }
5250
- var platformAdapterClientInstance = import_axios15.default.create({
5251
- baseURL: "https://platform.labs.text.com/console-adapter/api",
5252
- headers: {
5253
- "Content-Type": "application/json"
5254
- }
5255
- });
5256
- platformAdapterClientInstance.interceptors.response.use(
5257
- (r) => r,
5258
- (error) => {
5259
- var _a;
5260
- if (import_axios15.default.isAxiosError(error)) {
5261
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5262
- const source = error.response.data.error.source;
5263
- if (source) {
5264
- throw new UnauthorizeApiError(source);
5265
- }
5266
- }
5267
- }
5268
- throw error;
5269
- }
5270
- );
5271
- function getPlatformAdapterClientConfig(options = {}) {
5272
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
5273
- const currentHeaders = platformAdapterClientInstance.defaults.headers;
5274
- const headers = {
5275
- platform: {
5276
- dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
5277
- },
5278
- integrations: {
5279
- github: {
5280
- app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
5281
- oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
5282
- },
5283
- netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
5284
- vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5285
- planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5286
- neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
5287
- sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
5288
- openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
5289
- }
5290
- };
5291
- if (currentHeaders["platform-dps-token"]) {
5292
- currentHeaders["X-Region"] = (_m = getRegion2(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
5293
- }
5294
- if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
5295
- throw new UnauthorizeApiError("dps");
5296
- }
5297
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5298
- throw new UnauthorizeApiError("github");
5299
- }
5300
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
5301
- throw new UnauthorizeApiError("vercel");
5302
- }
5303
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
5304
- throw new UnauthorizeApiError("netlify");
5305
- }
5306
- if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
5307
- throw new UnauthorizeApiError("planetscale");
5308
- }
5309
- if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
5310
- throw new UnauthorizeApiError("neon");
5311
- }
5312
- if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
5313
- throw new UnauthorizeApiError("sentry");
5314
- }
5315
- if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
5316
- throw new UnauthorizeApiError("openai");
5317
- }
5318
- return {
5319
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), 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.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5320
- };
5321
- }
5322
- function initPlatformAdapterClientInstance(baseUrl, tokens) {
5323
- if (baseUrl) {
5324
- platformAdapterClientInstance.interceptors.request.use(
5325
- (config) => {
5326
- config.baseURL = baseUrl;
5327
- return config;
5328
- },
5329
- (error) => Promise.reject(error)
5330
- );
5331
- }
5332
- if (tokens) {
5333
- updatePlatformAdapterClientInstance(tokens);
5334
- }
5335
- }
5336
- function updatePlatformAdapterClientInstance(tokens) {
5337
- var _a, _b, _c;
5338
- const headers = platformAdapterClientInstance.defaults.headers;
5339
- if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
5340
- headers["platform-dps-token"] = tokens.platform.dps;
5341
- }
5342
- if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.app) {
5343
- headers["github-app-token"] = tokens.github.app;
5344
- }
5345
- if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauth) {
5346
- headers["github-oauth-token"] = tokens.github.oauth;
5347
- }
5348
- if (tokens == null ? void 0 : tokens.netlify) {
5349
- headers["netlify-token"] = tokens.netlify;
5350
- }
5351
- if (tokens == null ? void 0 : tokens.vercel) {
5352
- headers["vercel-token"] = tokens.vercel;
5353
- }
5354
- if (tokens == null ? void 0 : tokens.planetscale) {
5355
- headers["planetscale-token"] = tokens.planetscale;
5356
- }
5357
- if (tokens == null ? void 0 : tokens.neon) {
5358
- headers["neon-token"] = tokens.neon;
5359
- }
5360
- if (tokens == null ? void 0 : tokens.sentry) {
5361
- headers["sentry-token"] = tokens.sentry;
5362
- }
5363
- if (tokens == null ? void 0 : tokens.openai) {
5364
- headers["openai-token"] = tokens.openai;
5365
- }
5366
- }
5367
-
5368
5500
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
5369
5501
  var platformAdapterAppDeploymentApi = {
5370
5502
  get(appId, authorization) {
@@ -5905,42 +6037,6 @@ var platformAdapterApi = {
5905
6037
  conductor: platformAdapterConductorApi
5906
6038
  };
5907
6039
 
5908
- // src/apis/platform/billing/instance.ts
5909
- var import_axios16 = __toESM(require("axios"));
5910
- var platformBillingClientInstance = import_axios16.default.create({
5911
- baseURL: "https://billing.labs.livechatinc.com"
5912
- });
5913
- function getPlatformBillingClientAuthorization(req) {
5914
- return {
5915
- token: req.headers["platform-token"]
5916
- };
5917
- }
5918
- function getPlatformBillingClientConfig(options = {}) {
5919
- const defaultAuthorization = platformBillingClientInstance.defaults.headers.Authorization;
5920
- const headers = {
5921
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
5922
- };
5923
- return {
5924
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
5925
- };
5926
- }
5927
- function initPlatformBillingClientInstance(baseUrl, token) {
5928
- if (baseUrl) {
5929
- platformBillingClientInstance.interceptors.request.use(
5930
- (config) => __async(this, null, function* () {
5931
- config.baseURL = baseUrl;
5932
- return config;
5933
- }),
5934
- (error) => Promise.reject(error)
5935
- );
5936
- }
5937
- if (token) {
5938
- platformBillingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
5939
- } else {
5940
- delete platformBillingClientInstance.defaults.headers.Authorization;
5941
- }
5942
- }
5943
-
5944
6040
  // src/apis/platform/billing/account/api.ts
5945
6041
  var platformBillingAccountApi = {
5946
6042
  getAccount(authorization) {