@cargo-ai/api 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/build/src/api/ai/index.d.ts +78 -0
  2. package/build/src/api/ai/index.d.ts.map +1 -0
  3. package/build/src/api/ai/index.js +530 -0
  4. package/build/src/api/billing/index.d.ts +25 -0
  5. package/build/src/api/billing/index.d.ts.map +1 -0
  6. package/build/src/api/billing/index.js +155 -0
  7. package/build/src/api/connection/index.d.ts +28 -0
  8. package/build/src/api/connection/index.d.ts.map +1 -0
  9. package/build/src/api/connection/index.js +172 -0
  10. package/build/src/api/expression/index.d.ts +26 -0
  11. package/build/src/api/expression/index.d.ts.map +1 -0
  12. package/build/src/api/expression/index.js +115 -0
  13. package/build/src/api/index.d.ts +72 -0
  14. package/build/src/api/index.d.ts.map +1 -0
  15. package/build/src/api/index.js +51 -0
  16. package/build/src/api/orchestration/index.d.ts +66 -0
  17. package/build/src/api/orchestration/index.d.ts.map +1 -0
  18. package/build/src/api/orchestration/index.js +625 -0
  19. package/build/src/api/revenueOrganization/index.d.ts +37 -0
  20. package/build/src/api/revenueOrganization/index.d.ts.map +1 -0
  21. package/build/src/api/revenueOrganization/index.js +241 -0
  22. package/build/src/api/segmentation/index.d.ts +28 -0
  23. package/build/src/api/segmentation/index.d.ts.map +1 -0
  24. package/build/src/api/segmentation/index.js +188 -0
  25. package/build/src/api/storage/index.d.ts +45 -0
  26. package/build/src/api/storage/index.d.ts.map +1 -0
  27. package/build/src/api/storage/index.js +402 -0
  28. package/build/src/api/systemOfRecordIntegration/index.d.ts +29 -0
  29. package/build/src/api/systemOfRecordIntegration/index.d.ts.map +1 -0
  30. package/build/src/api/systemOfRecordIntegration/index.js +151 -0
  31. package/build/src/api/userManagement/index.d.ts +14 -0
  32. package/build/src/api/userManagement/index.d.ts.map +1 -0
  33. package/build/src/api/userManagement/index.js +33 -0
  34. package/build/src/api/workspaceManagement/index.d.ts +43 -0
  35. package/build/src/api/workspaceManagement/index.d.ts.map +1 -0
  36. package/build/src/api/workspaceManagement/index.js +283 -0
  37. package/build/src/client.d.ts +5 -0
  38. package/build/src/client.d.ts.map +1 -0
  39. package/build/src/client.js +24 -0
  40. package/build/src/fetcher/client.d.ts +7 -0
  41. package/build/src/fetcher/client.d.ts.map +1 -0
  42. package/build/src/fetcher/client.js +9 -0
  43. package/build/src/fetcher/error.d.ts +101 -0
  44. package/build/src/fetcher/error.d.ts.map +1 -0
  45. package/build/src/fetcher/error.js +184 -0
  46. package/build/src/fetcher/fetcher.d.ts +12 -0
  47. package/build/src/fetcher/fetcher.d.ts.map +1 -0
  48. package/build/src/fetcher/fetcher.js +1 -0
  49. package/build/src/fetcher/index.d.ts +34 -0
  50. package/build/src/fetcher/index.d.ts.map +1 -0
  51. package/build/src/fetcher/index.js +78 -0
  52. package/build/src/index.d.ts +5 -0
  53. package/build/src/index.d.ts.map +1 -0
  54. package/build/src/index.js +3 -0
  55. package/build/src/store/ai.d.ts +481 -0
  56. package/build/src/store/ai.d.ts.map +1 -0
  57. package/build/src/store/ai.js +112 -0
  58. package/build/src/store/billing.d.ts +140 -0
  59. package/build/src/store/billing.d.ts.map +1 -0
  60. package/build/src/store/billing.js +62 -0
  61. package/build/src/store/connection.d.ts +183 -0
  62. package/build/src/store/connection.d.ts.map +1 -0
  63. package/build/src/store/connection.js +88 -0
  64. package/build/src/store/expression.d.ts +112 -0
  65. package/build/src/store/expression.d.ts.map +1 -0
  66. package/build/src/store/expression.js +27 -0
  67. package/build/src/store/index.d.ts +14 -0
  68. package/build/src/store/index.d.ts.map +1 -0
  69. package/build/src/store/index.js +25 -0
  70. package/build/src/store/orchestration.d.ts +942 -0
  71. package/build/src/store/orchestration.d.ts.map +1 -0
  72. package/build/src/store/orchestration.js +217 -0
  73. package/build/src/store/revenueOrganization.d.ts +201 -0
  74. package/build/src/store/revenueOrganization.d.ts.map +1 -0
  75. package/build/src/store/revenueOrganization.js +68 -0
  76. package/build/src/store/segmentation.d.ts +566 -0
  77. package/build/src/store/segmentation.d.ts.map +1 -0
  78. package/build/src/store/segmentation.js +103 -0
  79. package/build/src/store/storage.d.ts +1096 -0
  80. package/build/src/store/storage.d.ts.map +1 -0
  81. package/build/src/store/storage.js +174 -0
  82. package/build/src/store/systemOfRecordIntegration.d.ts +122 -0
  83. package/build/src/store/systemOfRecordIntegration.d.ts.map +1 -0
  84. package/build/src/store/systemOfRecordIntegration.js +53 -0
  85. package/build/src/store/userManagement.d.ts +34 -0
  86. package/build/src/store/userManagement.d.ts.map +1 -0
  87. package/build/src/store/userManagement.js +22 -0
  88. package/build/src/store/workspaceManagement.d.ts +215 -0
  89. package/build/src/store/workspaceManagement.d.ts.map +1 -0
  90. package/build/src/store/workspaceManagement.js +103 -0
  91. package/build/src/types.d.ts +6 -0
  92. package/build/src/types.d.ts.map +1 -0
  93. package/build/src/types.js +1 -0
  94. package/build/tsconfig.tsbuildinfo +1 -0
  95. package/package.json +45 -0
@@ -0,0 +1,112 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { AiUtils } from "cargo-domain-types";
3
+ import { z } from "zod/v4";
4
+ // eslint-disable-next-line @typescript-eslint/no-namespace
5
+ export var Ai;
6
+ (function (Ai) {
7
+ Ai.agentConfig = AiUtils.agentConfig;
8
+ // eslint-disable-next-line @typescript-eslint/no-namespace
9
+ let Api;
10
+ (function (Api) {
11
+ Api.zodCreateAgentErrorReason = z.enum(["folderNotFound"]);
12
+ Api.zodUpdateAgentErrorReason = z.enum([
13
+ "agentNotFound",
14
+ "folderNotFound",
15
+ ]);
16
+ Api.zodRemoveAgentErrorReason = z.enum(["agentNotFound"]);
17
+ Api.zodUpdateDraftReleaseErrorReason = z.enum([
18
+ "agentNotFound",
19
+ "draftReleaseNotFound",
20
+ "invalidParent",
21
+ "invalidConnector",
22
+ "failedToReconciliateAgentAiTools",
23
+ ]);
24
+ Api.zodDeployDraftReleaseErrorReason = z.enum([
25
+ "agentNotFound",
26
+ "draftReleaseNotFound",
27
+ "duplicatedReleaseVersion",
28
+ "failedToReconciliateAgentAiTools",
29
+ ]);
30
+ Api.zodGetChatErrorReason = z.enum(["chatNotFound"]);
31
+ Api.zodUpdateChatErrorReason = z.enum(["chatNotFound"]);
32
+ Api.zodRemoveChatErrorReason = z.enum(["chatNotFound"]);
33
+ Api.zodGetMessageErrorReason = z.enum(["messageNotFound"]);
34
+ Api.zodRemoveMessageErrorReason = z.enum([
35
+ "messageNotFound",
36
+ "messageNotUser",
37
+ ]);
38
+ Api.zodUpdateMcpServerErrorReason = z.enum(["mcpServerNotFound"]);
39
+ Api.zodRemoveMcpServerErrorReason = z.enum(["mcpServerNotFound"]);
40
+ Api.zodRemoveMemoryErrorReason = z.enum(["memoryNotFound"]);
41
+ Api.zodUpdateMemoryErrorReason = z.enum(["memoryNotFound"]);
42
+ Api.zodUpdateFileErrorReason = z.enum([
43
+ "fileNotFound",
44
+ "folderNotFound",
45
+ ]);
46
+ Api.zodRemoveFileErrorReason = z.enum(["fileNotFound"]);
47
+ })(Api = Ai.Api || (Ai.Api = {}));
48
+ Ai.templateKeys = {
49
+ all: () => ["templates"],
50
+ };
51
+ Ai.mcpServerKeys = {
52
+ all: (workspaceUuid) => ["batches", workspaceUuid],
53
+ };
54
+ Ai.agentKeys = {
55
+ all: (workspaceUuid) => ["agents", workspaceUuid],
56
+ };
57
+ Ai.chatKeys = {
58
+ all: (workspaceUuid) => ["chats", workspaceUuid],
59
+ get: (workspaceUuid, uuid) => [...Ai.chatKeys.all(workspaceUuid), uuid],
60
+ list: (workspaceUuid, payload) => [...Ai.chatKeys.all(workspaceUuid), payload],
61
+ };
62
+ Ai.messageKeys = {
63
+ all: (workspaceUuid) => ["messages", workspaceUuid],
64
+ get: (workspaceUuid, uuid) => [...Ai.messageKeys.all(workspaceUuid), uuid],
65
+ list: (workspaceUuid, payload) => [...Ai.messageKeys.all(workspaceUuid), payload],
66
+ };
67
+ Ai.memoryKeys = {
68
+ all: (workspaceUuid) => ["memories", workspaceUuid],
69
+ list: (workspaceUuid, payload) => [...Ai.memoryKeys.all(workspaceUuid), payload],
70
+ };
71
+ Ai.voteKeys = {
72
+ all: (workspaceUuid) => ["votes", workspaceUuid],
73
+ list: (workspaceUuid, payload) => [...Ai.voteKeys.all(workspaceUuid), payload],
74
+ };
75
+ Ai.releaseKeys = {
76
+ all: (workspaceUuid) => ["releases", workspaceUuid],
77
+ get: (workspaceUuid, uuid) => [...Ai.releaseKeys.all(workspaceUuid), uuid],
78
+ getDraft: (workspaceUuid, workflowUuid) => [...Ai.releaseKeys.all(workspaceUuid), workflowUuid],
79
+ list: (workspaceUuid, payload) => [...Ai.releaseKeys.all(workspaceUuid), payload],
80
+ };
81
+ Ai.documentKeys = {
82
+ all: (workspaceUuid) => ["documents", workspaceUuid],
83
+ get: (workspaceUuid, uuid) => [...Ai.documentKeys.all(workspaceUuid), uuid],
84
+ list: (workspaceUuid, payload) => [...Ai.documentKeys.all(workspaceUuid), payload],
85
+ };
86
+ Ai.fileKeys = {
87
+ all: (workspaceUuid) => ["files", workspaceUuid],
88
+ };
89
+ })(Ai || (Ai = {}));
90
+ export const createAiSlice = (set) => ({
91
+ mcpServers: [],
92
+ setMcpServers: (mcpServers) => {
93
+ set((state) => ({
94
+ ...state,
95
+ mcpServers,
96
+ }));
97
+ },
98
+ agents: [],
99
+ setAgents: (agents) => {
100
+ set((state) => ({
101
+ ...state,
102
+ agents,
103
+ }));
104
+ },
105
+ files: [],
106
+ setFiles: (files) => {
107
+ set((state) => ({
108
+ ...state,
109
+ files,
110
+ }));
111
+ },
112
+ });
@@ -0,0 +1,140 @@
1
+ import type { BillingTypes } from "cargo-domain-types";
2
+ import { z } from "zod/v4";
3
+ import type { StateCreator } from "zustand";
4
+ import type { BackendToFrontend, DateToString } from "../types.js";
5
+ export declare namespace Billing {
6
+ type Subscription = BackendToFrontend<BillingTypes.Subscription>;
7
+ type EnrichedSubscription = BackendToFrontend<BillingTypes.EnrichedSubscription>;
8
+ type SubscriptionCreditsOverageBehavior = BackendToFrontend<BillingTypes.SubscriptionCreditsOverageBehavior>;
9
+ type Invoice = BackendToFrontend<BillingTypes.Invoice>;
10
+ type CreditCard = BackendToFrontend<BillingTypes.CreditCard>;
11
+ type SubscriptionCadence = BackendToFrontend<BillingTypes.SubscriptionCadence>;
12
+ type UsageMetric = BackendToFrontend<BillingTypes.UsageMetric>;
13
+ type UsageUnit = BackendToFrontend<BillingTypes.UsageUnit>;
14
+ type CreditsCost = BackendToFrontend<BillingTypes.CreditsCost>;
15
+ namespace Api {
16
+ type GetSubscriptionResult = {
17
+ subscription: EnrichedSubscription;
18
+ };
19
+ type GetInvoicesResult = {
20
+ invoices: Invoice[];
21
+ };
22
+ type GetCreditCardResult = {
23
+ creditCard: CreditCard | undefined;
24
+ };
25
+ type UpdatePaymentMethodPayload = DateToString<{
26
+ paymentMethodId: string;
27
+ }>;
28
+ const zodUpdatePaymentMethodResultErrorReason: z.ZodEnum<{
29
+ subscriptionNotFound: "subscriptionNotFound";
30
+ }>;
31
+ type CreateSetupIntentResult = {
32
+ setupIntent: {
33
+ clientSecret: string;
34
+ };
35
+ };
36
+ const zodCreateSetupIntentResultErrorReason: z.ZodEnum<{
37
+ subscriptionNotFound: "subscriptionNotFound";
38
+ failedToCreateSetupIntent: "failedToCreateSetupIntent";
39
+ }>;
40
+ type CreatePortalSessionResult = {
41
+ portalSession: {
42
+ url: string;
43
+ };
44
+ };
45
+ const zodCreatePortalSessionErrorReason: z.ZodEnum<{
46
+ subscriptionNotFound: "subscriptionNotFound";
47
+ }>;
48
+ type CreateStripeCreditsCheckoutSessionResult = {
49
+ checkoutSession: {
50
+ url: string;
51
+ };
52
+ };
53
+ const zodCreateStripeCreditsCheckoutSessionErrorReason: z.ZodEnum<{
54
+ subscriptionNotFound: "subscriptionNotFound";
55
+ failedToCreateCheckoutSession: "failedToCreateCheckoutSession";
56
+ }>;
57
+ type UpdatePlanPayload = DateToString<{
58
+ creditsCount: number;
59
+ cadence: BillingTypes.SubscriptionCadence;
60
+ }>;
61
+ type UpdatePlanResult = {
62
+ subscription: EnrichedSubscription;
63
+ };
64
+ const zodUpdatePlanResultErrorReason: z.ZodEnum<{
65
+ subscriptionNotFound: "subscriptionNotFound";
66
+ customerNotFound: "customerNotFound";
67
+ paymentMethodNotFound: "paymentMethodNotFound";
68
+ scheduleSubscriptionChangeFailed: "scheduleSubscriptionChangeFailed";
69
+ subscriptionNotElligible: "subscriptionNotElligible";
70
+ subscriptionAlreadyInUpdateState: "subscriptionAlreadyInUpdateState";
71
+ customerNotMigratedToOrb: "customerNotMigratedToOrb";
72
+ }>;
73
+ type UpdateTopupPayload = DateToString<{
74
+ enabled: boolean;
75
+ creditsCount: number;
76
+ threshold: number;
77
+ }>;
78
+ type UpdateTopupResult = {
79
+ subscription: EnrichedSubscription;
80
+ };
81
+ const zodUpdateTopupResultErrorReason: z.ZodEnum<{
82
+ subscriptionNotFound: "subscriptionNotFound";
83
+ customerNotFound: "customerNotFound";
84
+ paymentMethodNotFound: "paymentMethodNotFound";
85
+ subscriptionNotElligible: "subscriptionNotElligible";
86
+ customerNotMigratedToOrb: "customerNotMigratedToOrb";
87
+ }>;
88
+ type UpdateCreditsOverageBehaviorsPayload = DateToString<{
89
+ creditsOverageBehaviors: BillingTypes.SubscriptionCreditsOverageBehavior[];
90
+ }>;
91
+ const zodUpdateCreditsOverageBehaviorsResultErrorReason: z.ZodEnum<{
92
+ subscriptionNotFound: "subscriptionNotFound";
93
+ subscriptionNotEnterprise: "subscriptionNotEnterprise";
94
+ }>;
95
+ type UsageMetricsPayload = DateToString<{
96
+ workflowUuid?: string;
97
+ modelUuid?: string;
98
+ connectorUuid?: string;
99
+ integrationSlug?: string;
100
+ slug?: string;
101
+ agentUuid?: string;
102
+ from: string;
103
+ to: string;
104
+ groupBy?: "integration_slug" | "connector_uuid" | "model_uuid" | "workflow_uuid" | "agent_uuid";
105
+ unit?: BillingTypes.UsageUnit;
106
+ }>;
107
+ type UsageMetricsResult = {
108
+ metrics: UsageMetric[];
109
+ };
110
+ }
111
+ const subscriptionsKeys: {
112
+ get: (workspaceUuid: string) => readonly ["subscriptions", string];
113
+ getInvoices: (workspaceUuid: string) => readonly ["subscriptions", string, "getInvoices"];
114
+ getCreditCard: (workspaceUuid: string) => readonly ["subscriptions", string, "getCreditCard"];
115
+ createSetupIntent: (workspaceUuid: string) => readonly ["subscriptions", string, "createSetupIntent"];
116
+ };
117
+ const usagesKeys: {
118
+ all: (workspaceUuid: string) => readonly ["usages", string];
119
+ getMetrics: (workspaceUuid: string, payload: Api.UsageMetricsPayload) => readonly ["usages", string, "getMetrics", {
120
+ workflowUuid?: string | undefined;
121
+ modelUuid?: string | undefined;
122
+ connectorUuid?: string | undefined;
123
+ integrationSlug?: string | undefined;
124
+ slug?: string | undefined;
125
+ agentUuid?: string | undefined;
126
+ from: string;
127
+ to: string;
128
+ groupBy?: "integration_slug" | "connector_uuid" | "model_uuid" | "workflow_uuid" | "agent_uuid" | undefined;
129
+ unit?: BillingTypes.UsageUnit | undefined;
130
+ }];
131
+ };
132
+ }
133
+ export interface SubscriptionSlice {
134
+ subscription?: Billing.EnrichedSubscription;
135
+ setSubscription: (subscription?: Billing.EnrichedSubscription) => void;
136
+ }
137
+ export declare const createSubscriptionSlice: StateCreator<SubscriptionSlice, [
138
+ ], [
139
+ ], SubscriptionSlice>;
140
+ //# sourceMappingURL=billing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/store/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGnE,yBAAiB,OAAO,CAAC;IACv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AAC;YACjB,IAAI,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC;SAC/B,CAAC,CAAC;QAEH,KAAY,kBAAkB,GAAG;YAC/B,OAAO,EAAE,WAAW,EAAE,CAAC;SACxB,CAAC;KACH;IAEM,MAAM,iBAAiB;6BACP,MAAM;qCACE,MAAM;uCAEJ,MAAM;2CAEF,MAAM;KAE1C,CAAC;IAEK,MAAM,UAAU;6BACA,MAAM;oCACC,MAAM,WAAW,IAAI,mBAAmB;;;;;;;kBA5B5D,MAAM;gBACR,MAAM;;;;KA6Bb,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;IAC5C,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,oBAAoB,KAAK,IAAI,CAAC;CACxE;AAED,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAChD,iBAAiB,EACjB;CAAE,EACF;CAAE,EACF,iBAAiB,CASjB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { z } from "zod/v4";
2
+ // eslint-disable-next-line @typescript-eslint/no-namespace
3
+ export var Billing;
4
+ (function (Billing) {
5
+ // eslint-disable-next-line @typescript-eslint/no-namespace
6
+ let Api;
7
+ (function (Api) {
8
+ Api.zodUpdatePaymentMethodResultErrorReason = z.enum([
9
+ "subscriptionNotFound",
10
+ ]);
11
+ Api.zodCreateSetupIntentResultErrorReason = z.enum([
12
+ "subscriptionNotFound",
13
+ "failedToCreateSetupIntent",
14
+ ]);
15
+ Api.zodCreatePortalSessionErrorReason = z.enum([
16
+ "subscriptionNotFound",
17
+ ]);
18
+ Api.zodCreateStripeCreditsCheckoutSessionErrorReason = z.enum([
19
+ "subscriptionNotFound",
20
+ "failedToCreateCheckoutSession",
21
+ ]);
22
+ Api.zodUpdatePlanResultErrorReason = z.enum([
23
+ "subscriptionNotFound",
24
+ "customerNotFound",
25
+ "paymentMethodNotFound",
26
+ "scheduleSubscriptionChangeFailed",
27
+ "subscriptionNotElligible",
28
+ "subscriptionAlreadyInUpdateState",
29
+ "customerNotMigratedToOrb",
30
+ ]);
31
+ Api.zodUpdateTopupResultErrorReason = z.enum([
32
+ "subscriptionNotFound",
33
+ "customerNotFound",
34
+ "paymentMethodNotFound",
35
+ "subscriptionNotElligible",
36
+ "customerNotMigratedToOrb",
37
+ ]);
38
+ Api.zodUpdateCreditsOverageBehaviorsResultErrorReason = z.enum([
39
+ "subscriptionNotFound",
40
+ "subscriptionNotEnterprise",
41
+ ]);
42
+ })(Api = Billing.Api || (Billing.Api = {}));
43
+ Billing.subscriptionsKeys = {
44
+ get: (workspaceUuid) => ["subscriptions", workspaceUuid],
45
+ getInvoices: (workspaceUuid) => [...Billing.subscriptionsKeys.get(workspaceUuid), "getInvoices"],
46
+ getCreditCard: (workspaceUuid) => [...Billing.subscriptionsKeys.get(workspaceUuid), "getCreditCard"],
47
+ createSetupIntent: (workspaceUuid) => [...Billing.subscriptionsKeys.get(workspaceUuid), "createSetupIntent"],
48
+ };
49
+ Billing.usagesKeys = {
50
+ all: (workspaceUuid) => ["usages", workspaceUuid],
51
+ getMetrics: (workspaceUuid, payload) => [...Billing.usagesKeys.all(workspaceUuid), "getMetrics", payload],
52
+ };
53
+ })(Billing || (Billing = {}));
54
+ export const createSubscriptionSlice = (set) => ({
55
+ subscription: undefined,
56
+ setSubscription: (subscription) => {
57
+ set((state) => ({
58
+ ...state,
59
+ subscription,
60
+ }));
61
+ },
62
+ });
@@ -0,0 +1,183 @@
1
+ import type { ConnectionTypes } from "cargo-domain-types";
2
+ import type { Schema } from "cargo-utils";
3
+ import { z } from "zod/v4";
4
+ import type { StateCreator } from "zustand";
5
+ import type { BackendToFrontend, DateToString } from "../types.js";
6
+ import type { Storage } from "./storage.js";
7
+ export declare namespace Connection {
8
+ type RateLimit = BackendToFrontend<ConnectionTypes.RateLimit>;
9
+ type Connector = BackendToFrontend<ConnectionTypes.Connector>;
10
+ type IntegrationFilterConjonction = BackendToFrontend<ConnectionTypes.IntegrationFilterConjonction>;
11
+ type IntegrationFilterCondition = BackendToFrontend<ConnectionTypes.IntegrationFilterCondition>;
12
+ type IntegrationFilterGroup = BackendToFrontend<ConnectionTypes.IntegrationFilterGroup>;
13
+ type IntegrationFilter = BackendToFrontend<ConnectionTypes.IntegrationFilter>;
14
+ type IntegrationSort = BackendToFrontend<ConnectionTypes.IntegrationSort>;
15
+ type IntegrationAction = BackendToFrontend<ConnectionTypes.PostMigrationIntegrationAction>;
16
+ type Integration = BackendToFrontend<ConnectionTypes.PostMigrationIntegration>;
17
+ type IntegrationExtractor = BackendToFrontend<ConnectionTypes.PostMigrationIntegrationExtractor>;
18
+ type IntegrationExtractorMode = BackendToFrontend<ConnectionTypes.IntegrationExtractorMode>;
19
+ type IntegrationExtractorUnification = BackendToFrontend<ConnectionTypes.IntegrationExtractorUnification>;
20
+ type IntegrationCategory = BackendToFrontend<ConnectionTypes.IntegrationCategory>;
21
+ type IntegrationSubCategory = BackendToFrontend<ConnectionTypes.IntegrationSubCategory>;
22
+ type IntegrationLanguageModel = BackendToFrontend<ConnectionTypes.IntegrationLanguageModel>;
23
+ type IntegrationManifest = BackendToFrontend<ConnectionTypes.IntegrationManifest>;
24
+ type NativeIntegrationCategory = BackendToFrontend<ConnectionTypes.NativeIntegrationCategory>;
25
+ type NativeIntegrationAction = BackendToFrontend<ConnectionTypes.NativeIntegrationAction>;
26
+ type NativeIntegration = {
27
+ actions: Record<string, NativeIntegrationAction>;
28
+ };
29
+ namespace Api {
30
+ type ConnectorAutocompletePayload = DateToString<{
31
+ connectorUuid: string;
32
+ slug: string;
33
+ value?: string;
34
+ params: Record<string, any>;
35
+ refresh?: boolean;
36
+ variables?: Record<string, any>;
37
+ }>;
38
+ type ConnectorAutocompleteResult = {
39
+ results: {
40
+ label: string;
41
+ value: string;
42
+ parent?: string;
43
+ description?: string;
44
+ configOverride?: Record<string, any>;
45
+ }[];
46
+ };
47
+ const zodConnectorAutocompleteErrorReason: z.ZodEnum<{
48
+ connectorNotFound: "connectorNotFound";
49
+ failedToGetIntegration: "failedToGetIntegration";
50
+ failedToGetIntegrationAutocomplete: "failedToGetIntegrationAutocomplete";
51
+ }>;
52
+ type GetConnectorDynamicSchemaPayload = DateToString<{
53
+ connectorUuid: string;
54
+ slug: string;
55
+ params: Record<string, any>;
56
+ }>;
57
+ type GetConnectorDynamicSchemaResult = {
58
+ schema: Schema | undefined;
59
+ uiSchema: Record<string, any> | undefined;
60
+ };
61
+ const zodGetConnectorDynamicSchemaErrorReason: z.ZodEnum<{
62
+ connectorNotFound: "connectorNotFound";
63
+ failedToGetIntegration: "failedToGetIntegration";
64
+ }>;
65
+ type GetConnectorLanguageModelsPayload = DateToString<{
66
+ connectorUuid: string;
67
+ }>;
68
+ type GetConnectorLanguageModelsResult = {
69
+ languageModels: IntegrationLanguageModel[];
70
+ };
71
+ const zodGetConnectorLanguageModelsErrorReason: z.ZodEnum<{
72
+ connectorNotFound: "connectorNotFound";
73
+ integrationNotFound: "integrationNotFound";
74
+ languageModelsNotSupported: "languageModelsNotSupported";
75
+ failedToGetLanguageModels: "failedToGetLanguageModels";
76
+ }>;
77
+ type CreateConnectorPayload = DateToString<{
78
+ name: string;
79
+ slug: string;
80
+ integrationSlug: string;
81
+ config?: Record<string, any>;
82
+ rateLimit?: RateLimit;
83
+ cacheTtlMilliseconds?: number;
84
+ }>;
85
+ type CreateConnectorResult = {
86
+ connector: Connector;
87
+ dataset: Storage.Dataset;
88
+ };
89
+ const zodCreateConnectorErrorReason: z.ZodEnum<{
90
+ integrationNotFound: "integrationNotFound";
91
+ invalidConfig: "invalidConfig";
92
+ unauthenticated: "unauthenticated";
93
+ }>;
94
+ type AllConnectorsResult = {
95
+ connectors: Connector[];
96
+ };
97
+ type UpdateConnectorPayload = DateToString<{
98
+ uuid: string;
99
+ name?: string;
100
+ config?: Record<string, any> | null;
101
+ rateLimit?: RateLimit | null;
102
+ cacheTtlMilliseconds?: number | null;
103
+ }>;
104
+ type UpdateConnectorResult = {
105
+ connector: Connector;
106
+ };
107
+ const zodUpdateConnectorErrorReason: z.ZodEnum<{
108
+ connectorNotFound: "connectorNotFound";
109
+ integrationNotFound: "integrationNotFound";
110
+ invalidConfig: "invalidConfig";
111
+ unauthenticated: "unauthenticated";
112
+ }>;
113
+ type ConnectorExistsBySlugPayload = DateToString<{
114
+ slug: string;
115
+ }>;
116
+ type ConnectorExistsBySlugResult = {
117
+ exists: boolean;
118
+ };
119
+ type AllIntegrationsResult = {
120
+ integrations: Integration[];
121
+ };
122
+ type CompleteIntegrationOauthPayload = DateToString<{
123
+ slug: string;
124
+ params: Record<string, any>;
125
+ }>;
126
+ type CompleteIntegrationOauthResult = {
127
+ value: string;
128
+ };
129
+ const zodRemoveConnectorErrorReason: z.ZodEnum<{
130
+ connectorNotFound: "connectorNotFound";
131
+ connectorIsUsedInWorkflows: "connectorIsUsedInWorkflows";
132
+ connectorIsUsedInModels: "connectorIsUsedInModels";
133
+ }>;
134
+ type GetNativeIntegrationResult = {
135
+ nativeIntegration: NativeIntegration;
136
+ };
137
+ }
138
+ const connectorsKeys: {
139
+ all: (workspaceUuid: string) => readonly ["connectors", string];
140
+ get: (workspaceUuid: string, uuid: string) => readonly ["connectors", string, string];
141
+ autocomplete: (workspaceUuid: string, payload: Api.ConnectorAutocompletePayload) => readonly ["connectors", string, "autocomplete", {
142
+ connectorUuid: string;
143
+ slug: string;
144
+ value?: string | undefined;
145
+ params: {
146
+ [x: string]: any;
147
+ };
148
+ refresh?: boolean | undefined;
149
+ variables?: {
150
+ [x: string]: any;
151
+ } | undefined;
152
+ }];
153
+ getDynamicSchema: (workspaceUuid: string, payload: Api.GetConnectorDynamicSchemaPayload) => readonly ["connectors", string, "getDynamicSchema", {
154
+ connectorUuid: string;
155
+ slug: string;
156
+ params: {
157
+ [x: string]: any;
158
+ };
159
+ }];
160
+ getLanguageModels: (workspaceUuid: string, payload: Api.GetConnectorLanguageModelsPayload) => readonly ["connectors", string, "getLanguageModels", {
161
+ connectorUuid: string;
162
+ }];
163
+ };
164
+ const integrationsKeys: {
165
+ all: () => readonly ["integrations"];
166
+ getDocumentation: (slug: string) => readonly ["integrations", string];
167
+ };
168
+ const nativeIntegrationKeys: {
169
+ get: () => readonly ["nativeIntegration"];
170
+ };
171
+ }
172
+ export interface ConnectionSlice {
173
+ connectors: Connection.Connector[];
174
+ integrations: Connection.Integration[];
175
+ setConnectors: (connectors: Connection.Connector[]) => void;
176
+ setIntegrations: (integrations: Connection.Integration[]) => void;
177
+ nativeIntegration: Connection.NativeIntegration;
178
+ setNativeIntegration: (nativeIntegration: Connection.NativeIntegration) => void;
179
+ }
180
+ export declare const createConnectionSlice: StateCreator<ConnectionSlice, [
181
+ ], [
182
+ ], ConnectionSlice>;
183
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/store/connection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,yBAAiB,UAAU,CAAC;IAC1B,KAAY,SAAS,GAAG,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACrE,KAAY,SAAS,GAAG,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACrE,KAAY,4BAA4B,GACtC,iBAAiB,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC;IAClE,KAAY,0BAA0B,GACpC,iBAAiB,CAAC,eAAe,CAAC,0BAA0B,C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YAC3C,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;QAEK,MAAM,6BAA6B;;;;UAIxC,CAAC;QAEH,KAAY,0BAA0B,GAAG;YACvC,iBAAiB,EAAE,iBAAiB,CAAC;SACtC,CAAC;KACH;IAEM,MAAM,cAAc;6BACJ,MAAM;6BACN,MAAM,QAAQ,MAAM;sCAGxB,MAAM,WACZ,IAAI,4BAA4B;2BAxI1B,MAAM;kBACf,MAAM;;;;;;;;;;0CA2IG,MAAM,WACZ,IAAI,gCAAgC;2BApH9B,MAAM;kBACf,MAAM;;;;;2CA2HG,MAAM,WACZ,IAAI,iCAAiC;2BA7G/B,MAAM;;KAoHxB,CAAC;IAEK,MAAM,gBAAgB;;iCAEF,MAAM;KAEhC,CAAC;IAEK,MAAM,qBAAqB;;KAEjC,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC;IACnC,YAAY,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC;IACvC,aAAa,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5D,eAAe,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC;IAClE,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,CAAC;IAChD,oBAAoB,EAAE,CACpB,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,KAC5C,IAAI,CAAC;CACX;AAED,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAC9C,eAAe,EACf;CAAE,EACF;CAAE,EACF,eAAe,CAyBf,CAAC"}
@@ -0,0 +1,88 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { z } from "zod/v4";
3
+ // eslint-disable-next-line @typescript-eslint/no-namespace
4
+ export var Connection;
5
+ (function (Connection) {
6
+ // eslint-disable-next-line @typescript-eslint/no-namespace
7
+ let Api;
8
+ (function (Api) {
9
+ Api.zodConnectorAutocompleteErrorReason = z.enum([
10
+ "connectorNotFound",
11
+ "failedToGetIntegration",
12
+ "failedToGetIntegrationAutocomplete",
13
+ ]);
14
+ Api.zodGetConnectorDynamicSchemaErrorReason = z.enum([
15
+ "connectorNotFound",
16
+ "failedToGetIntegration",
17
+ ]);
18
+ Api.zodGetConnectorLanguageModelsErrorReason = z.enum([
19
+ "connectorNotFound",
20
+ "integrationNotFound",
21
+ "languageModelsNotSupported",
22
+ "failedToGetLanguageModels",
23
+ ]);
24
+ Api.zodCreateConnectorErrorReason = z.enum([
25
+ "unauthenticated",
26
+ "invalidConfig",
27
+ "integrationNotFound",
28
+ ]);
29
+ Api.zodUpdateConnectorErrorReason = z.enum([
30
+ "connectorNotFound",
31
+ "invalidConfig",
32
+ "integrationNotFound",
33
+ "unauthenticated",
34
+ ]);
35
+ Api.zodRemoveConnectorErrorReason = z.enum([
36
+ "connectorNotFound",
37
+ "connectorIsUsedInWorkflows",
38
+ "connectorIsUsedInModels",
39
+ ]);
40
+ })(Api = Connection.Api || (Connection.Api = {}));
41
+ Connection.connectorsKeys = {
42
+ all: (workspaceUuid) => ["connectors", workspaceUuid],
43
+ get: (workspaceUuid, uuid) => [...Connection.connectorsKeys.all(workspaceUuid), uuid],
44
+ autocomplete: (workspaceUuid, payload) => [...Connection.connectorsKeys.all(workspaceUuid), "autocomplete", payload],
45
+ getDynamicSchema: (workspaceUuid, payload) => [
46
+ ...Connection.connectorsKeys.all(workspaceUuid),
47
+ "getDynamicSchema",
48
+ payload,
49
+ ],
50
+ getLanguageModels: (workspaceUuid, payload) => [
51
+ ...Connection.connectorsKeys.all(workspaceUuid),
52
+ "getLanguageModels",
53
+ payload,
54
+ ],
55
+ };
56
+ Connection.integrationsKeys = {
57
+ all: () => ["integrations"],
58
+ getDocumentation: (slug) => [...Connection.integrationsKeys.all(), slug],
59
+ };
60
+ Connection.nativeIntegrationKeys = {
61
+ get: () => ["nativeIntegration"],
62
+ };
63
+ })(Connection || (Connection = {}));
64
+ export const createConnectionSlice = (set) => ({
65
+ connectors: [],
66
+ integrations: [],
67
+ setConnectors: (connectors) => {
68
+ set((state) => ({
69
+ ...state,
70
+ connectors,
71
+ }));
72
+ },
73
+ setIntegrations: (integrations) => {
74
+ set((state) => ({
75
+ ...state,
76
+ integrations,
77
+ }));
78
+ },
79
+ nativeIntegration: {
80
+ actions: {},
81
+ },
82
+ setNativeIntegration: (nativeIntegration) => {
83
+ set((state) => ({
84
+ ...state,
85
+ nativeIntegration,
86
+ }));
87
+ },
88
+ });