@dev-fastn-ai/react-core 1.0.18 → 1.0.20

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.esm.js CHANGED
@@ -90,278 +90,6 @@ function v4(options, buf, offset) {
90
90
  return unsafeStringify(rnds);
91
91
  }
92
92
 
93
- // GraphQL endpoint (customize as needed)
94
- const GRAPHQL_ENDPOINT = "/graphql";
95
- // Utility to perform GraphQL queries/mutations using fetch
96
- async function fetchGraphQL({ query, variables }) {
97
- const config = getConfig();
98
- const response = await fetch(config.baseUrl + GRAPHQL_ENDPOINT, {
99
- method: "POST",
100
- headers: {
101
- "Content-Type": "application/json",
102
- authorization: `Bearer ${config.authToken}`,
103
- realm: REALM,
104
- [CUSTOM_AUTH_HEADER_KEY]: String(config.customAuth),
105
- [PROJECT_ID_HEADER_KEY]: config.spaceId,
106
- [TENANT_ID_HEADER_KEY]: config.tenantId,
107
- [REQUEST_TRACE_ID_HEADER_KEY]: `fastn-ai-ts-${v4()}`,
108
- },
109
- body: JSON.stringify({ query, variables }),
110
- });
111
- if (!response.ok) {
112
- switch (response.status) {
113
- case 401:
114
- throw new Error("Unauthorized: Please check your auth token");
115
- case 403:
116
- throw new Error("Forbidden: Please check your access");
117
- case 404:
118
- throw new Error("Not Found: Please check your request");
119
- default:
120
- throw new Error("Failed to fetch: Please check your request");
121
- }
122
- }
123
- const result = await response.json();
124
- if (result.errors) {
125
- throw new Error(result.errors.map((e) => e.message).join("; "));
126
- }
127
- return {
128
- data: result.data,
129
- errors: result.errors
130
- };
131
- }
132
- // GraphQL Queries & Mutations (as plain strings)
133
- const GET_WIDGET_CONNECTORS = `
134
- query Connectors($input: GetConnectorsListInput!) {
135
- connectors(input: $input) {
136
- name
137
- id
138
- imageUri
139
- description
140
- content
141
- actions {
142
- name
143
- handler
144
- actionType
145
- activatedStateLabel
146
- content
147
- shows
148
- handlerPayload
149
- multiConnectorWidgetConnectors {
150
- name
151
- id
152
- imageUri
153
- description
154
- content
155
- connectionId
156
- actions {
157
- name
158
- handler
159
- actionType
160
- activatedStateLabel
161
- content
162
- shows
163
- handlerPayload
164
- }
165
- events {
166
- name
167
- eventId
168
- content
169
- payload
170
- }
171
- connectedConnectors {
172
- id
173
- imageUrl
174
- clientId
175
- name
176
- enableActivate
177
- activateStatus
178
- authMethods {
179
- title
180
- inputContract
181
- type
182
- details
183
- isDefault
184
- }
185
- }
186
- status
187
- }
188
- }
189
- events {
190
- name
191
- eventId
192
- content
193
- payload
194
- }
195
- connectedConnectors {
196
- id
197
- imageUrl
198
- clientId
199
- name
200
- enableActivate
201
- activateStatus
202
- authMethods {
203
- title
204
- inputContract
205
- type
206
- details
207
- isDefault
208
- }
209
- }
210
- status
211
- }
212
- }
213
- `;
214
- const SAVE_ACTIVATE_CONNECTOR_STATUS = `
215
- mutation SaveActivateConnectorStatus(
216
- $input: SaveWidgetConnectorStatusInput!
217
- ) {
218
- saveWidgetConnectorStatus(input: $input)
219
- }
220
- `;
221
- const DEACTIVATE_CONNECTOR = `
222
- mutation DeactivateConnector($input: DeactivateConnectorInput!) {
223
- deactivateConnector(input: $input)
224
- }
225
- `;
226
- const GET_FIELD_DATA_QUERY = `
227
- query executeGetFieldDataFlow($input: ApiPrimaryResolverInvocationInput!) {
228
- executeGetFieldDataFlow(input: $input) {
229
- data
230
- }
231
- }
232
- `;
233
- const GET_TENANT_CONFIGURATIONS = `
234
- query GetConfigurationSubscription($input: ConfigurationSubscriptionInput!) {
235
- getConfigurationSubscription(input: $input) {
236
- connector {
237
- id
238
- name
239
- description
240
- imageUri
241
- status
242
- active
243
- actions {
244
- name
245
- handler
246
- actionType
247
- }
248
- connectedConnectors {
249
- id
250
- name
251
- clientId
252
- imageUrl
253
- enableActivate
254
- activateStatus
255
- authMethods {
256
- title
257
- inputContract
258
- type
259
- details
260
- isDefault
261
- }
262
- }
263
- }
264
- status
265
- metaData
266
- }
267
- }
268
- `;
269
- const GET_TENANT_CONFIGURATIONS_BY_ID = `
270
- query GetConfigurationSubscription($input: GetTenantConfigurationsInput) {
271
- tenantConfigurationsById(input: $input) {
272
- uiCode
273
- flowId
274
- stepId
275
- status
276
- configurations
277
- configuredStepSetting {
278
- keyIsEditable
279
- addButton {
280
- label
281
- isDisabled
282
- fieldsLimit
283
- }
284
- description
285
- label
286
- validation {
287
- fieldValidation
288
- submitValidation
289
- modelId
290
- jsonSchema
291
- submitValidationFunction
292
- }
293
- }
294
- }
295
- }
296
- `;
297
- const CREATE_TENANT_CONFIGURATION = `
298
- mutation CreateTenantConfiguration($input: TenantConfigurationsInput!) {
299
- createTenantConfiguration(input: $input) {
300
- id
301
- }
302
- }
303
- `;
304
- const UPDATE_TENANT_CONFIGURATION = `
305
- mutation UpdateTenantConfiguration($input: TenantConfigurationsInput!) {
306
- updateTenantConfiguration(input: $input) {
307
- id
308
- }
309
- }
310
- `;
311
- const DELETE_TENANT_CONFIG = `
312
- mutation DeleteTenantConfig($input: GetTenantConfigurationsInput!) {
313
- deleteTenantConfig(input: $input) {
314
- id
315
- }
316
- }
317
- `;
318
- const DISABLE_TENANT_CONFIG = `
319
- mutation DisableTenantConfig($input: GetTenantConfigurationsInput!) {
320
- disableTenantConfig(input: $input) {
321
- id
322
- }
323
- }
324
- `;
325
- const GENERATE_ACCESS_TOKEN = `
326
- query GenerateAccessToken($input: ConnectorConnectionInput!) {
327
- connectorConnection(input: $input)
328
- }
329
- `;
330
- // Refactored functions using fetchGraphQL
331
- async function getConnectors$1(variables) {
332
- return fetchGraphQL({ query: GET_WIDGET_CONNECTORS, variables });
333
- }
334
- async function saveActivateConnectorStatus(variables) {
335
- return fetchGraphQL({ query: SAVE_ACTIVATE_CONNECTOR_STATUS, variables });
336
- }
337
- async function deactivateConnector$1(variables) {
338
- return fetchGraphQL({ query: DEACTIVATE_CONNECTOR, variables });
339
- }
340
- async function getFieldData(variables) {
341
- return fetchGraphQL({ query: GET_FIELD_DATA_QUERY, variables });
342
- }
343
- async function getConfigurationSubscriptions(variables) {
344
- return fetchGraphQL({ query: GET_TENANT_CONFIGURATIONS, variables });
345
- }
346
- async function getConfigurationSubscriptionById(variables) {
347
- return fetchGraphQL({ query: GET_TENANT_CONFIGURATIONS_BY_ID, variables });
348
- }
349
- async function createTenantConfiguration(variables) {
350
- return fetchGraphQL({ query: CREATE_TENANT_CONFIGURATION, variables });
351
- }
352
- async function updateTenantConfiguration(variables) {
353
- return fetchGraphQL({ query: UPDATE_TENANT_CONFIGURATION, variables });
354
- }
355
- async function deleteTenantConfig(variables) {
356
- return fetchGraphQL({ query: DELETE_TENANT_CONFIG, variables });
357
- }
358
- async function disableTenantConfig(variables) {
359
- return fetchGraphQL({ query: DISABLE_TENANT_CONFIG, variables });
360
- }
361
- async function generateAccessToken(variables) {
362
- return fetchGraphQL({ query: GENERATE_ACCESS_TOKEN, variables });
363
- }
364
-
365
93
  /**
366
94
  * Supported field types for connector forms.
367
95
  */
@@ -417,6 +145,70 @@ var ResourceAction;
417
145
  ResourceAction["DELETE_CONFIGURATION"] = "DELETE_CONFIGURATION";
418
146
  })(ResourceAction || (ResourceAction = {}));
419
147
 
148
+ const getCustomAuthContextValue = (operationName, variables) => {
149
+ var _a;
150
+ try {
151
+ if (!operationName)
152
+ return "";
153
+ return btoa(JSON.stringify(getCustomAuthContext(operationName, (_a = variables === null || variables === void 0 ? void 0 : variables.input) !== null && _a !== void 0 ? _a : {})));
154
+ }
155
+ catch (error) {
156
+ console.error("Error getting custom auth context value:", error);
157
+ return "";
158
+ }
159
+ };
160
+ const getCustomAuthContext = (operationName, input) => {
161
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
162
+ if (!operationName)
163
+ return {};
164
+ try {
165
+ let action = ResourceAction.QUERY;
166
+ let resourceId = "";
167
+ switch (operationName) {
168
+ case "metadata":
169
+ case "connectors":
170
+ case "api":
171
+ case "tenantflow":
172
+ case "generateaccesstoken":
173
+ break;
174
+ case "deactivateconnector":
175
+ action = ResourceAction.DEACTIVATION;
176
+ resourceId = (_a = input.connectorId) !== null && _a !== void 0 ? _a : "";
177
+ break;
178
+ case "configuretenantflow":
179
+ action = ResourceAction.CONFIGURE;
180
+ resourceId = (_b = input.connectorId) !== null && _b !== void 0 ? _b : "";
181
+ break;
182
+ case "deletetenantconfiguration":
183
+ action = ResourceAction.UNCONFIGURE;
184
+ resourceId = (_c = input.connectorId) !== null && _c !== void 0 ? _c : "";
185
+ break;
186
+ case "createtenantconfiguration":
187
+ action = ResourceAction.ENABLE_CONFIGURATION;
188
+ resourceId = (_d = input.connectorId) !== null && _d !== void 0 ? _d : "";
189
+ break;
190
+ case "updatetenantconfiguration":
191
+ action = ResourceAction.UPDATE_CONFIGURATION;
192
+ resourceId = (_e = input.connectorId) !== null && _e !== void 0 ? _e : "";
193
+ break;
194
+ case "disabletenantconfig":
195
+ action = ResourceAction.DISABLE_CONFIGURATION;
196
+ resourceId = (_f = input.connectorId) !== null && _f !== void 0 ? _f : "";
197
+ break;
198
+ case "deletetenantconfig":
199
+ action = ResourceAction.DELETE_CONFIGURATION;
200
+ resourceId = (_g = input.connectorId) !== null && _g !== void 0 ? _g : "";
201
+ break;
202
+ default:
203
+ resourceId = (_j = (_h = input.clientId) !== null && _h !== void 0 ? _h : input.projectId) !== null && _j !== void 0 ? _j : "";
204
+ }
205
+ return { action, resourceId };
206
+ }
207
+ catch (error) {
208
+ console.error("Error parsing custom auth context:", error);
209
+ return {};
210
+ }
211
+ };
420
212
  const addCustomAuthContextHeader = (headers, context) => {
421
213
  try {
422
214
  const contextString = JSON.stringify(context);
@@ -689,92 +481,365 @@ function populateFormDataInUiCode(uiCodeString, formData) {
689
481
  else {
690
482
  acc[key] = target[key];
691
483
  }
692
- return acc;
693
- }, {});
694
- return Object.assign(Object.assign({}, uiCode), { target: updatedTarget });
695
- }
696
- else if (targetType === "array" && Array.isArray(target)) {
697
- const updatedTarget = target.map((item, index) => {
698
- const updatedItem = Object.assign({}, item);
699
- // Assuming item has a unique key (e.g., id or name) to match formData fields
700
- Object.keys(item).forEach((key) => {
701
- var _a, _b;
702
- const formValue = (_a = formData[`${index}.${key}`]) !== null && _a !== void 0 ? _a : formData[key];
703
- if (formValue !== undefined) {
704
- updatedItem[key] = Object.assign(Object.assign({}, item[key]), { target: (_b = convertFormDataToUiCodeFormData(formValue)) === null || _b === void 0 ? void 0 : _b.target });
705
- }
706
- });
707
- return updatedItem;
708
- });
709
- return Object.assign(Object.assign({}, uiCode), { target: updatedTarget });
484
+ return acc;
485
+ }, {});
486
+ return Object.assign(Object.assign({}, uiCode), { target: updatedTarget });
487
+ }
488
+ else if (targetType === "array" && Array.isArray(target)) {
489
+ const updatedTarget = target.map((item, index) => {
490
+ const updatedItem = Object.assign({}, item);
491
+ // Assuming item has a unique key (e.g., id or name) to match formData fields
492
+ Object.keys(item).forEach((key) => {
493
+ var _a, _b;
494
+ const formValue = (_a = formData[`${index}.${key}`]) !== null && _a !== void 0 ? _a : formData[key];
495
+ if (formValue !== undefined) {
496
+ updatedItem[key] = Object.assign(Object.assign({}, item[key]), { target: (_b = convertFormDataToUiCodeFormData(formValue)) === null || _b === void 0 ? void 0 : _b.target });
497
+ }
498
+ });
499
+ return updatedItem;
500
+ });
501
+ return Object.assign(Object.assign({}, uiCode), { target: updatedTarget });
502
+ }
503
+ return uiCode;
504
+ }
505
+ const convertFormDataToUiCodeFormData = (formData) => {
506
+ if (Array.isArray(formData)) {
507
+ return {
508
+ actionType: "map",
509
+ targetType: "array",
510
+ target: formData.map((item) => convertFormDataToUiCodeFormData(item)),
511
+ };
512
+ }
513
+ else if (formData !== null && typeof formData === "object") {
514
+ const target = {};
515
+ for (const key in formData) {
516
+ target[key] = convertFormDataToUiCodeFormData(formData[key]);
517
+ }
518
+ return {
519
+ actionType: "map",
520
+ targetType: "object",
521
+ target,
522
+ };
523
+ }
524
+ else if (typeof formData === "string") {
525
+ return {
526
+ actionType: "map",
527
+ targetType: "string",
528
+ target: formData,
529
+ };
530
+ }
531
+ else if (typeof formData === "number") {
532
+ return {
533
+ actionType: "map",
534
+ targetType: "number",
535
+ target: formData,
536
+ };
537
+ }
538
+ else if (typeof formData === "boolean") {
539
+ return {
540
+ actionType: "map",
541
+ targetType: "boolean",
542
+ target: formData,
543
+ };
544
+ }
545
+ else {
546
+ return {
547
+ actionType: "map",
548
+ targetType: "string",
549
+ target: formData,
550
+ };
551
+ }
552
+ };
553
+ /**
554
+ * Recursively removes __typename fields from an object or array.
555
+ */
556
+ function stripTypename(obj) {
557
+ if (Array.isArray(obj)) {
558
+ return obj.map(stripTypename);
559
+ }
560
+ else if (obj && typeof obj === 'object') {
561
+ const newObj = {};
562
+ for (const key in obj) {
563
+ if (key === '__typename')
564
+ continue;
565
+ newObj[key] = stripTypename(obj[key]);
566
+ }
567
+ return newObj;
568
+ }
569
+ return obj;
570
+ }
571
+
572
+ // GraphQL endpoint (customize as needed)
573
+ const GRAPHQL_ENDPOINT = "/graphql";
574
+ // Utility to perform GraphQL queries/mutations using fetch
575
+ async function fetchGraphQL({ query, variables, operationName }) {
576
+ const config = getConfig();
577
+ const response = await fetch(config.baseUrl + GRAPHQL_ENDPOINT, {
578
+ method: "POST",
579
+ headers: {
580
+ "Content-Type": "application/json",
581
+ authorization: `Bearer ${config.authToken}`,
582
+ realm: REALM,
583
+ [CUSTOM_AUTH_HEADER_KEY]: String(config.customAuth),
584
+ [PROJECT_ID_HEADER_KEY]: config.spaceId,
585
+ [TENANT_ID_HEADER_KEY]: config.tenantId,
586
+ [REQUEST_TRACE_ID_HEADER_KEY]: `react-ai-core-${v4()}`,
587
+ [CUSTOM_AUTH_CONTEXT_HEADER_KEY]: getCustomAuthContextValue(operationName, variables),
588
+ },
589
+ body: JSON.stringify({ query, variables }),
590
+ });
591
+ if (!response.ok) {
592
+ switch (response.status) {
593
+ case 401:
594
+ throw new Error("Unauthorized: Please check your auth token");
595
+ case 403:
596
+ throw new Error("Forbidden: Please check your access");
597
+ case 404:
598
+ throw new Error("Not Found: Please check your request");
599
+ default:
600
+ throw new Error("Failed to fetch: Please check your request");
601
+ }
602
+ }
603
+ const result = await response.json();
604
+ if (result.errors) {
605
+ throw new Error(result.errors.map((e) => e.message).join("; "));
606
+ }
607
+ return {
608
+ data: result.data,
609
+ errors: result.errors
610
+ };
611
+ }
612
+ // GraphQL Queries & Mutations (as plain strings)
613
+ const GET_WIDGET_CONNECTORS = `
614
+ query Connectors($input: GetConnectorsListInput!) {
615
+ connectors(input: $input) {
616
+ name
617
+ id
618
+ imageUri
619
+ description
620
+ content
621
+ actions {
622
+ name
623
+ handler
624
+ actionType
625
+ activatedStateLabel
626
+ content
627
+ shows
628
+ handlerPayload
629
+ multiConnectorWidgetConnectors {
630
+ name
631
+ id
632
+ imageUri
633
+ description
634
+ content
635
+ connectionId
636
+ actions {
637
+ name
638
+ handler
639
+ actionType
640
+ activatedStateLabel
641
+ content
642
+ shows
643
+ handlerPayload
644
+ }
645
+ events {
646
+ name
647
+ eventId
648
+ content
649
+ payload
650
+ }
651
+ connectedConnectors {
652
+ id
653
+ imageUrl
654
+ clientId
655
+ name
656
+ enableActivate
657
+ activateStatus
658
+ authMethods {
659
+ title
660
+ inputContract
661
+ type
662
+ details
663
+ isDefault
664
+ }
665
+ }
666
+ status
667
+ }
668
+ }
669
+ events {
670
+ name
671
+ eventId
672
+ content
673
+ payload
674
+ }
675
+ connectedConnectors {
676
+ id
677
+ imageUrl
678
+ clientId
679
+ name
680
+ enableActivate
681
+ activateStatus
682
+ authMethods {
683
+ title
684
+ inputContract
685
+ type
686
+ details
687
+ isDefault
688
+ }
689
+ }
690
+ status
710
691
  }
711
- return uiCode;
712
- }
713
- const convertFormDataToUiCodeFormData = (formData) => {
714
- if (Array.isArray(formData)) {
715
- return {
716
- actionType: "map",
717
- targetType: "array",
718
- target: formData.map((item) => convertFormDataToUiCodeFormData(item)),
719
- };
692
+ }
693
+ `;
694
+ const SAVE_ACTIVATE_CONNECTOR_STATUS = `
695
+ mutation SaveActivateConnectorStatus(
696
+ $input: SaveWidgetConnectorStatusInput!
697
+ ) {
698
+ saveWidgetConnectorStatus(input: $input)
699
+ }
700
+ `;
701
+ const DEACTIVATE_CONNECTOR = `
702
+ mutation DeactivateConnector($input: DeactivateConnectorInput!) {
703
+ deactivateConnector(input: $input)
704
+ }
705
+ `;
706
+ const GET_FIELD_DATA_QUERY = `
707
+ query executeGetFieldDataFlow($input: ApiPrimaryResolverInvocationInput!) {
708
+ executeGetFieldDataFlow(input: $input) {
709
+ data
720
710
  }
721
- else if (formData !== null && typeof formData === "object") {
722
- const target = {};
723
- for (const key in formData) {
724
- target[key] = convertFormDataToUiCodeFormData(formData[key]);
711
+ }
712
+ `;
713
+ const GET_TENANT_CONFIGURATIONS = `
714
+ query GetConfigurationSubscription($input: ConfigurationSubscriptionInput!) {
715
+ getConfigurationSubscription(input: $input) {
716
+ connector {
717
+ id
718
+ name
719
+ description
720
+ imageUri
721
+ status
722
+ active
723
+ actions {
724
+ name
725
+ handler
726
+ actionType
725
727
  }
726
- return {
727
- actionType: "map",
728
- targetType: "object",
729
- target,
730
- };
731
- }
732
- else if (typeof formData === "string") {
733
- return {
734
- actionType: "map",
735
- targetType: "string",
736
- target: formData,
737
- };
728
+ connectedConnectors {
729
+ id
730
+ name
731
+ clientId
732
+ imageUrl
733
+ enableActivate
734
+ activateStatus
735
+ authMethods {
736
+ title
737
+ inputContract
738
+ type
739
+ details
740
+ isDefault
741
+ }
742
+ }
743
+ }
744
+ status
745
+ metaData
738
746
  }
739
- else if (typeof formData === "number") {
740
- return {
741
- actionType: "map",
742
- targetType: "number",
743
- target: formData,
744
- };
747
+ }
748
+ `;
749
+ const GET_TENANT_CONFIGURATIONS_BY_ID = `
750
+ query GetConfigurationSubscription($input: GetTenantConfigurationsInput) {
751
+ tenantConfigurationsById(input: $input) {
752
+ uiCode
753
+ flowId
754
+ stepId
755
+ status
756
+ configurations
757
+ configuredStepSetting {
758
+ keyIsEditable
759
+ addButton {
760
+ label
761
+ isDisabled
762
+ fieldsLimit
763
+ }
764
+ description
765
+ label
766
+ validation {
767
+ fieldValidation
768
+ submitValidation
769
+ modelId
770
+ jsonSchema
771
+ submitValidationFunction
772
+ }
773
+ }
745
774
  }
746
- else if (typeof formData === "boolean") {
747
- return {
748
- actionType: "map",
749
- targetType: "boolean",
750
- target: formData,
751
- };
775
+ }
776
+ `;
777
+ const CREATE_TENANT_CONFIGURATION = `
778
+ mutation CreateTenantConfiguration($input: TenantConfigurationsInput!) {
779
+ createTenantConfiguration(input: $input) {
780
+ id
752
781
  }
753
- else {
754
- return {
755
- actionType: "map",
756
- targetType: "string",
757
- target: formData,
758
- };
782
+ }
783
+ `;
784
+ const UPDATE_TENANT_CONFIGURATION = `
785
+ mutation UpdateTenantConfiguration($input: TenantConfigurationsInput!) {
786
+ updateTenantConfiguration(input: $input) {
787
+ id
759
788
  }
760
- };
761
- /**
762
- * Recursively removes __typename fields from an object or array.
763
- */
764
- function stripTypename(obj) {
765
- if (Array.isArray(obj)) {
766
- return obj.map(stripTypename);
789
+ }
790
+ `;
791
+ const DELETE_TENANT_CONFIG = `
792
+ mutation DeleteTenantConfig($input: GetTenantConfigurationsInput!) {
793
+ deleteTenantConfig(input: $input) {
794
+ id
767
795
  }
768
- else if (obj && typeof obj === 'object') {
769
- const newObj = {};
770
- for (const key in obj) {
771
- if (key === '__typename')
772
- continue;
773
- newObj[key] = stripTypename(obj[key]);
774
- }
775
- return newObj;
796
+ }
797
+ `;
798
+ const DISABLE_TENANT_CONFIG = `
799
+ mutation DisableTenantConfig($input: GetTenantConfigurationsInput!) {
800
+ disableTenantConfig(input: $input) {
801
+ id
776
802
  }
777
- return obj;
803
+ }
804
+ `;
805
+ const GENERATE_ACCESS_TOKEN = `
806
+ query GenerateAccessToken($input: ConnectorConnectionInput!) {
807
+ connectorConnection(input: $input)
808
+ }
809
+ `;
810
+ // Refactored functions using fetchGraphQL
811
+ async function getConnectors$1(variables) {
812
+ return fetchGraphQL({ query: GET_WIDGET_CONNECTORS, variables, operationName: "connectors" });
813
+ }
814
+ async function saveActivateConnectorStatus(variables) {
815
+ return fetchGraphQL({ query: SAVE_ACTIVATE_CONNECTOR_STATUS, variables, operationName: "saveactivatconnectorstatus" });
816
+ }
817
+ async function deactivateConnector$1(variables) {
818
+ return fetchGraphQL({ query: DEACTIVATE_CONNECTOR, variables, operationName: "deactivateConnector" });
819
+ }
820
+ async function getFieldData(variables) {
821
+ return fetchGraphQL({ query: GET_FIELD_DATA_QUERY, variables, operationName: "executeGetFieldDataFlow" });
822
+ }
823
+ async function getConfigurationSubscriptions(variables) {
824
+ return fetchGraphQL({ query: GET_TENANT_CONFIGURATIONS, variables, operationName: "getconfigurationsubscription" });
825
+ }
826
+ async function getConfigurationSubscriptionById(variables) {
827
+ return fetchGraphQL({ query: GET_TENANT_CONFIGURATIONS_BY_ID, variables, operationName: "getconfigurationsubscriptionbyid" });
828
+ }
829
+ async function createTenantConfiguration(variables) {
830
+ return fetchGraphQL({ query: CREATE_TENANT_CONFIGURATION, variables, operationName: "createtenantconfiguration" });
831
+ }
832
+ async function updateTenantConfiguration(variables) {
833
+ return fetchGraphQL({ query: UPDATE_TENANT_CONFIGURATION, variables, operationName: "updatetenantconfiguration" });
834
+ }
835
+ async function deleteTenantConfig(variables) {
836
+ return fetchGraphQL({ query: DELETE_TENANT_CONFIG, variables, operationName: "deletetenantconfig" });
837
+ }
838
+ async function disableTenantConfig(variables) {
839
+ return fetchGraphQL({ query: DISABLE_TENANT_CONFIG, variables, operationName: "disabletenantconfig" });
840
+ }
841
+ async function generateAccessToken(variables) {
842
+ return fetchGraphQL({ query: GENERATE_ACCESS_TOKEN, variables, operationName: "generateaccesstoken" });
778
843
  }
779
844
 
780
845
  /**
@@ -845,7 +910,7 @@ const callActivateConnector = async (input, headers) => {
845
910
  const url = config.baseUrl + ACTIVATE_CONNECTOR_URL;
846
911
  const response = await fetch(url, {
847
912
  method: "POST",
848
- headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, headers), { "x-fastn-api-key": ACTIVATE_CONNECTOR_ACCESS_KEY, "x-fastn-space-id": ACTIVATE_CONNECTOR_PROJECT_ID, "x-fastn-space-client-id": config.spaceId }),
913
+ headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, headers), { "x-fastn-api-key": ACTIVATE_CONNECTOR_ACCESS_KEY, "x-fastn-space-id": ACTIVATE_CONNECTOR_PROJECT_ID, "x-fastn-space-client-id": config.spaceId, 'stage': "LIVE" }),
849
914
  body: JSON.stringify({
850
915
  input
851
916
  })
@@ -952,7 +1017,7 @@ const deactivateConnector = async ({ connectorId, action, }) => {
952
1017
  const config = getConfig();
953
1018
  // Execute the action handler
954
1019
  let response = {};
955
- response = await executeActionHandler(action === null || action === void 0 ? void 0 : action.handler, addCustomAuthContextHeader({}, { resourceId: connectorId, action: ResourceAction.ACTIVATION }));
1020
+ response = await executeActionHandler(action === null || action === void 0 ? void 0 : action.handler, addCustomAuthContextHeader({}, { resourceId: connectorId, action: ResourceAction.DEACTIVATION }));
956
1021
  // Deactivate the connector
957
1022
  await deactivateConnector$1({
958
1023
  input: {