@workos-inc/widgets 1.19.0-next.1790708352913 → 1.19.0-next.1790711094592

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 (188) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/cjs/admin-portal-audit-log-streaming.client.d.cts +1 -3
  3. package/dist/cjs/admin-portal-domain-verification.client.d.cts +1 -3
  4. package/dist/cjs/admin-portal-sso-connection.client.d.cts +1 -3
  5. package/dist/cjs/api/utils.cjs +2 -39
  6. package/dist/cjs/api/utils.cjs.map +1 -1
  7. package/dist/cjs/api/utils.d.cts +1 -7
  8. package/dist/cjs/api-keys.client.d.cts +1 -3
  9. package/dist/cjs/directory-sync.client.d.cts +1 -3
  10. package/dist/cjs/index.cjs.map +1 -1
  11. package/dist/cjs/index.d.cts +1 -2
  12. package/dist/cjs/lib/admin-portal-audit-log-streaming.d.cts +1 -3
  13. package/dist/cjs/lib/admin-portal-domain-verification.d.cts +1 -3
  14. package/dist/cjs/lib/admin-portal-sso-connection.d.cts +1 -3
  15. package/dist/cjs/lib/api/api-key.cjs.map +1 -1
  16. package/dist/cjs/lib/api/api-key.d.cts +1 -2
  17. package/dist/cjs/lib/api/config.cjs +0 -9
  18. package/dist/cjs/lib/api/config.cjs.map +1 -1
  19. package/dist/cjs/lib/api/config.d.cts +1 -8
  20. package/dist/cjs/lib/api/pipes.cjs.map +1 -1
  21. package/dist/cjs/lib/api/pipes.d.cts +1 -3
  22. package/dist/cjs/lib/api/types.cjs +17 -0
  23. package/dist/cjs/lib/api/types.cjs.map +1 -0
  24. package/dist/cjs/lib/api/types.d.cts +293 -0
  25. package/dist/cjs/lib/api/user-api-key.cjs.map +1 -1
  26. package/dist/cjs/lib/api/user-api-key.d.cts +2 -3
  27. package/dist/cjs/lib/api-keys/api-key-details-card.cjs.map +1 -1
  28. package/dist/cjs/lib/api-keys/api-key-details-card.d.cts +1 -3
  29. package/dist/cjs/lib/api-keys/api-key-details-dialog.cjs.map +1 -1
  30. package/dist/cjs/lib/api-keys/api-key-details-dialog.d.cts +1 -3
  31. package/dist/cjs/lib/api-keys/api-keys-context.cjs.map +1 -1
  32. package/dist/cjs/lib/api-keys/api-keys-context.d.cts +1 -3
  33. package/dist/cjs/lib/api-keys/api-keys-state.cjs.map +1 -1
  34. package/dist/cjs/lib/api-keys/api-keys-state.d.cts +1 -3
  35. package/dist/cjs/lib/api-keys/api-keys-table.cjs.map +1 -1
  36. package/dist/cjs/lib/api-keys/api-keys-table.d.cts +1 -3
  37. package/dist/cjs/lib/api-keys/api-keys.cjs.map +1 -1
  38. package/dist/cjs/lib/api-keys/api-keys.d.cts +1 -3
  39. package/dist/cjs/lib/api-keys/create-api-key.cjs.map +1 -1
  40. package/dist/cjs/lib/api-keys/revoke-api-key-dialog.cjs.map +1 -1
  41. package/dist/cjs/lib/api-keys/revoke-api-key-dialog.d.cts +1 -3
  42. package/dist/cjs/lib/data-integration-icon.cjs.map +1 -1
  43. package/dist/cjs/lib/data-integration-icon.d.cts +1 -3
  44. package/dist/cjs/lib/directory-sync.d.cts +1 -3
  45. package/dist/cjs/lib/empty-state.d.cts +1 -3
  46. package/dist/cjs/lib/identity-providers.d.cts +2 -2
  47. package/dist/cjs/lib/organization-switcher.d.cts +1 -3
  48. package/dist/cjs/lib/pipes-admin.cjs.map +1 -1
  49. package/dist/cjs/lib/pipes-admin.d.cts +1 -3
  50. package/dist/cjs/lib/pipes.cjs.map +1 -1
  51. package/dist/cjs/lib/pipes.d.cts +1 -3
  52. package/dist/cjs/lib/provider-icon.cjs.map +1 -1
  53. package/dist/cjs/lib/provider-icon.d.cts +1 -3
  54. package/dist/cjs/lib/user-api-keys/revoke-user-api-key-dialog.d.cts +1 -3
  55. package/dist/cjs/lib/user-api-keys/user-api-key-details-card.d.cts +1 -3
  56. package/dist/cjs/lib/user-api-keys/user-api-key-details-dialog.d.cts +1 -3
  57. package/dist/cjs/lib/user-api-keys/user-api-key-owner.d.cts +1 -3
  58. package/dist/cjs/lib/user-api-keys/user-api-keys-context.cjs.map +1 -1
  59. package/dist/cjs/lib/user-api-keys/user-api-keys-context.d.cts +1 -3
  60. package/dist/cjs/lib/user-api-keys/user-api-keys-state.cjs.map +1 -1
  61. package/dist/cjs/lib/user-api-keys/user-api-keys-state.d.cts +1 -3
  62. package/dist/cjs/lib/user-api-keys/user-api-keys-table.d.cts +1 -3
  63. package/dist/cjs/lib/user-api-keys/user-api-keys.d.cts +1 -3
  64. package/dist/cjs/lib/user-profile.d.cts +1 -2
  65. package/dist/cjs/lib/user-security.d.cts +1 -3
  66. package/dist/cjs/lib/user-sessions.d.cts +1 -3
  67. package/dist/cjs/lib/users-management.d.cts +2 -3
  68. package/dist/cjs/lib/utils.cjs.map +1 -1
  69. package/dist/cjs/lib/utils.d.cts +5 -4
  70. package/dist/cjs/organization-switcher.client.d.cts +1 -3
  71. package/dist/cjs/pipes-admin.client.d.cts +1 -3
  72. package/dist/cjs/pipes.client.cjs.map +1 -1
  73. package/dist/cjs/pipes.client.d.cts +1 -3
  74. package/dist/cjs/user-profile.client.d.cts +1 -2
  75. package/dist/cjs/user-security.client.d.cts +1 -3
  76. package/dist/cjs/user-sessions.client.d.cts +1 -3
  77. package/dist/cjs/users-management.client.d.cts +1 -2
  78. package/dist/cjs/utils.cjs +1 -3
  79. package/dist/cjs/utils.cjs.map +1 -1
  80. package/dist/esm/admin-portal-audit-log-streaming.client.d.ts +1 -3
  81. package/dist/esm/admin-portal-domain-verification.client.d.ts +1 -3
  82. package/dist/esm/admin-portal-sso-connection.client.d.ts +1 -3
  83. package/dist/esm/api/utils.d.ts +1 -7
  84. package/dist/esm/api/utils.js +1 -36
  85. package/dist/esm/api/utils.js.map +1 -1
  86. package/dist/esm/api-keys.client.d.ts +1 -3
  87. package/dist/esm/directory-sync.client.d.ts +1 -3
  88. package/dist/esm/index.d.ts +1 -2
  89. package/dist/esm/index.js.map +1 -1
  90. package/dist/esm/lib/admin-portal-audit-log-streaming.d.ts +1 -3
  91. package/dist/esm/lib/admin-portal-domain-verification.d.ts +1 -3
  92. package/dist/esm/lib/admin-portal-sso-connection.d.ts +1 -3
  93. package/dist/esm/lib/api/api-key.d.ts +1 -2
  94. package/dist/esm/lib/api/api-key.js.map +1 -1
  95. package/dist/esm/lib/api/config.d.ts +1 -8
  96. package/dist/esm/lib/api/config.js +0 -8
  97. package/dist/esm/lib/api/config.js.map +1 -1
  98. package/dist/esm/lib/api/pipes.d.ts +1 -3
  99. package/dist/esm/lib/api/pipes.js.map +1 -1
  100. package/dist/esm/lib/api/types.d.ts +293 -0
  101. package/dist/esm/lib/api/types.js +1 -0
  102. package/dist/esm/lib/api/types.js.map +1 -0
  103. package/dist/esm/lib/api/user-api-key.d.ts +2 -3
  104. package/dist/esm/lib/api/user-api-key.js.map +1 -1
  105. package/dist/esm/lib/api-keys/api-key-details-card.d.ts +1 -3
  106. package/dist/esm/lib/api-keys/api-key-details-card.js.map +1 -1
  107. package/dist/esm/lib/api-keys/api-key-details-dialog.d.ts +1 -3
  108. package/dist/esm/lib/api-keys/api-key-details-dialog.js.map +1 -1
  109. package/dist/esm/lib/api-keys/api-keys-context.d.ts +1 -3
  110. package/dist/esm/lib/api-keys/api-keys-context.js.map +1 -1
  111. package/dist/esm/lib/api-keys/api-keys-state.d.ts +1 -3
  112. package/dist/esm/lib/api-keys/api-keys-state.js.map +1 -1
  113. package/dist/esm/lib/api-keys/api-keys-table.d.ts +1 -3
  114. package/dist/esm/lib/api-keys/api-keys-table.js.map +1 -1
  115. package/dist/esm/lib/api-keys/api-keys.d.ts +1 -3
  116. package/dist/esm/lib/api-keys/api-keys.js.map +1 -1
  117. package/dist/esm/lib/api-keys/create-api-key.js.map +1 -1
  118. package/dist/esm/lib/api-keys/revoke-api-key-dialog.d.ts +1 -3
  119. package/dist/esm/lib/api-keys/revoke-api-key-dialog.js.map +1 -1
  120. package/dist/esm/lib/data-integration-icon.d.ts +1 -3
  121. package/dist/esm/lib/data-integration-icon.js.map +1 -1
  122. package/dist/esm/lib/directory-sync.d.ts +1 -3
  123. package/dist/esm/lib/empty-state.d.ts +1 -3
  124. package/dist/esm/lib/identity-providers.d.ts +2 -2
  125. package/dist/esm/lib/organization-switcher.d.ts +1 -3
  126. package/dist/esm/lib/pipes-admin.d.ts +1 -3
  127. package/dist/esm/lib/pipes-admin.js.map +1 -1
  128. package/dist/esm/lib/pipes.d.ts +1 -3
  129. package/dist/esm/lib/pipes.js.map +1 -1
  130. package/dist/esm/lib/provider-icon.d.ts +1 -3
  131. package/dist/esm/lib/provider-icon.js.map +1 -1
  132. package/dist/esm/lib/user-api-keys/revoke-user-api-key-dialog.d.ts +1 -3
  133. package/dist/esm/lib/user-api-keys/user-api-key-details-card.d.ts +1 -3
  134. package/dist/esm/lib/user-api-keys/user-api-key-details-dialog.d.ts +1 -3
  135. package/dist/esm/lib/user-api-keys/user-api-key-owner.d.ts +1 -3
  136. package/dist/esm/lib/user-api-keys/user-api-keys-context.d.ts +1 -3
  137. package/dist/esm/lib/user-api-keys/user-api-keys-context.js.map +1 -1
  138. package/dist/esm/lib/user-api-keys/user-api-keys-state.d.ts +1 -3
  139. package/dist/esm/lib/user-api-keys/user-api-keys-state.js.map +1 -1
  140. package/dist/esm/lib/user-api-keys/user-api-keys-table.d.ts +1 -3
  141. package/dist/esm/lib/user-api-keys/user-api-keys.d.ts +1 -3
  142. package/dist/esm/lib/user-profile.d.ts +1 -2
  143. package/dist/esm/lib/user-security.d.ts +1 -3
  144. package/dist/esm/lib/user-sessions.d.ts +1 -3
  145. package/dist/esm/lib/users-management.d.ts +2 -3
  146. package/dist/esm/lib/utils.d.ts +5 -4
  147. package/dist/esm/lib/utils.js.map +1 -1
  148. package/dist/esm/organization-switcher.client.d.ts +1 -3
  149. package/dist/esm/pipes-admin.client.d.ts +1 -3
  150. package/dist/esm/pipes.client.d.ts +1 -3
  151. package/dist/esm/pipes.client.js.map +1 -1
  152. package/dist/esm/user-profile.client.d.ts +1 -2
  153. package/dist/esm/user-security.client.d.ts +1 -3
  154. package/dist/esm/user-sessions.client.d.ts +1 -3
  155. package/dist/esm/users-management.client.d.ts +1 -2
  156. package/dist/esm/utils.js +1 -3
  157. package/dist/esm/utils.js.map +1 -1
  158. package/package.json +2 -22
  159. package/dist/cjs/api/endpoint.cjs +0 -2480
  160. package/dist/cjs/api/endpoint.cjs.map +0 -1
  161. package/dist/cjs/api/endpoint.d.cts +0 -2956
  162. package/dist/cjs/api/widgets-api-client.cjs +0 -120
  163. package/dist/cjs/api/widgets-api-client.cjs.map +0 -1
  164. package/dist/cjs/api/widgets-api-client.d.cts +0 -22
  165. package/dist/cjs/experimental/api/fetch.cjs +0 -1476
  166. package/dist/cjs/experimental/api/fetch.cjs.map +0 -1
  167. package/dist/cjs/experimental/api/fetch.d.cts +0 -3125
  168. package/dist/cjs/experimental/api/react-query.cjs +0 -2728
  169. package/dist/cjs/experimental/api/react-query.cjs.map +0 -1
  170. package/dist/cjs/experimental/api/react-query.d.cts +0 -4482
  171. package/dist/cjs/experimental/api/swr.cjs +0 -2926
  172. package/dist/cjs/experimental/api/swr.cjs.map +0 -1
  173. package/dist/cjs/experimental/api/swr.d.cts +0 -4198
  174. package/dist/esm/api/endpoint.d.ts +0 -2956
  175. package/dist/esm/api/endpoint.js +0 -2238
  176. package/dist/esm/api/endpoint.js.map +0 -1
  177. package/dist/esm/api/widgets-api-client.d.ts +0 -22
  178. package/dist/esm/api/widgets-api-client.js +0 -98
  179. package/dist/esm/api/widgets-api-client.js.map +0 -1
  180. package/dist/esm/experimental/api/fetch.d.ts +0 -3125
  181. package/dist/esm/experimental/api/fetch.js +0 -1319
  182. package/dist/esm/experimental/api/fetch.js.map +0 -1
  183. package/dist/esm/experimental/api/react-query.d.ts +0 -4482
  184. package/dist/esm/experimental/api/react-query.js +0 -2424
  185. package/dist/esm/experimental/api/react-query.js.map +0 -1
  186. package/dist/esm/experimental/api/swr.d.ts +0 -4198
  187. package/dist/esm/experimental/api/swr.js +0 -2596
  188. package/dist/esm/experimental/api/swr.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## 1.19.0-next.1790708352913
3
+ ## 1.19.0-next.1790711094592
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -2,9 +2,7 @@ import * as React from 'react';
2
2
  import { AuthToken } from './api/api-provider.cjs';
3
3
  import { WidgetRootDomProps } from './lib/utils.cjs';
4
4
  export { AdminPortalAuditLogStreamingButton, AdminPortalAuditLogStreamingError, AdminPortalAuditLogStreamingLoading, AdminPortalAuditLogStreaming as AdminPortalAuditLogStreamingPresentational, AdminPortalAuditLogStreamingStatusProps } from './lib/admin-portal-audit-log-streaming.cjs';
5
- import './api/endpoint.cjs';
6
- import '@tanstack/react-query';
7
- import './api/widgets-api-client.cjs';
5
+ import './lib/api/types.cjs';
8
6
  import './lib/elements.cjs';
9
7
  import '@radix-ui/themes';
10
8
  import '@radix-ui/themes/props';
@@ -4,9 +4,7 @@ import { AuthToken } from './api/api-provider.cjs';
4
4
  import { WidgetRootDomProps } from './lib/utils.cjs';
5
5
  import './api/client-graphql/generated.cjs';
6
6
  import 'graphql-request';
7
- import './api/endpoint.cjs';
8
- import '@tanstack/react-query';
9
- import './api/widgets-api-client.cjs';
7
+ import './lib/api/types.cjs';
10
8
  import './lib/elements.cjs';
11
9
  import '@radix-ui/themes';
12
10
  import '@radix-ui/themes/props';
@@ -3,9 +3,7 @@ export { AdminPortalSsoConnectionError, AdminPortalSsoConnectionErrorProps, Admi
3
3
  import { AuthToken } from './api/api-provider.cjs';
4
4
  import { WidgetRootDomProps } from './lib/utils.cjs';
5
5
  import './lib/identity-providers.cjs';
6
- import './api/endpoint.cjs';
7
- import '@tanstack/react-query';
8
- import './api/widgets-api-client.cjs';
6
+ import './lib/api/types.cjs';
9
7
  import './lib/elements.cjs';
10
8
  import '@radix-ui/themes';
11
9
  import '@radix-ui/themes/props';
@@ -18,61 +18,24 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var utils_exports = {};
20
20
  __export(utils_exports, {
21
- getAuthHeaders: () => getAuthHeaders,
22
21
  getClaims: () => getClaims,
23
22
  isErrorLike: () => isErrorLike,
24
- isObjectLike: () => isObjectLike,
25
- parseErrorResponse: () => parseErrorResponse
23
+ isObjectLike: () => isObjectLike
26
24
  });
27
25
  module.exports = __toCommonJS(utils_exports);
28
- var import_constants = require("./constants.js");
29
- function getAuthHeaders(authToken) {
30
- if (!authToken) {
31
- return {
32
- "WorkOS-Widgets-Version": import_constants.WIDGETS_API_VERSION
33
- };
34
- }
35
- return {
36
- Authorization: `Bearer ${authToken}`,
37
- "WorkOS-Widgets-Version": import_constants.WIDGETS_API_VERSION
38
- };
39
- }
40
26
  function isObjectLike(value) {
41
27
  return typeof value === "object" && value !== null;
42
28
  }
43
29
  function isErrorLike(value) {
44
30
  return isObjectLike(value) && typeof value.message === "string";
45
31
  }
46
- async function parseErrorResponse(response) {
47
- try {
48
- const json = await response.json();
49
- if (!isObjectLike(json) || typeof json.message !== "string") {
50
- return {
51
- status: response.status,
52
- message: response.statusText
53
- };
54
- }
55
- return {
56
- ...json,
57
- status: response.status,
58
- message: json.message || response.statusText
59
- };
60
- } catch {
61
- return {
62
- status: response.status,
63
- message: response.statusText
64
- };
65
- }
66
- }
67
32
  function getClaims(accessToken) {
68
33
  return JSON.parse(atob(accessToken.split(".")[1]));
69
34
  }
70
35
  // Annotate the CommonJS export names for ESM import in node:
71
36
  0 && (module.exports = {
72
- getAuthHeaders,
73
37
  getClaims,
74
38
  isErrorLike,
75
- isObjectLike,
76
- parseErrorResponse
39
+ isObjectLike
77
40
  });
78
41
  //# sourceMappingURL=utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/api/utils.ts"],"sourcesContent":["import { WIDGETS_API_VERSION } from \"./constants.js\";\n\nexport function getAuthHeaders(authToken?: string): HeadersInit {\n if (!authToken) {\n return {\n \"WorkOS-Widgets-Version\": WIDGETS_API_VERSION,\n };\n }\n\n return {\n Authorization: `Bearer ${authToken}`,\n \"WorkOS-Widgets-Version\": WIDGETS_API_VERSION,\n };\n}\n\nexport function isObjectLike(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport function isErrorLike(\n value: unknown,\n): value is Record<string, unknown> & { message: string } {\n return isObjectLike(value) && typeof value.message === \"string\";\n}\n\nexport async function parseErrorResponse(\n response: Response,\n): Promise<{ message: string; status: number; errors?: unknown[] }> {\n try {\n const json = await response.json();\n if (!isObjectLike(json) || typeof json.message !== \"string\") {\n return {\n status: response.status,\n message: response.statusText,\n };\n }\n return {\n ...json,\n status: response.status,\n message: json.message || response.statusText,\n };\n } catch {\n return {\n status: response.status,\n message: response.statusText,\n };\n }\n}\n\ntype Claims = {\n sid: string;\n permissions?: string[];\n exp?: number;\n};\n\nexport function getClaims(accessToken: string): Claims {\n return JSON.parse(atob(accessToken.split(\".\")[1]));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAoC;AAE7B,SAAS,eAAe,WAAiC;AAC9D,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,MACL,0BAA0B;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AAAA,IACL,eAAe,UAAU,SAAS;AAAA,IAClC,0BAA0B;AAAA,EAC5B;AACF;AAEO,SAAS,aAAa,OAAkD;AAC7E,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEO,SAAS,YACd,OACwD;AACxD,SAAO,aAAa,KAAK,KAAK,OAAO,MAAM,YAAY;AACzD;AAEA,eAAsB,mBACpB,UACkE;AAClE,MAAI;AACF,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,QAAI,CAAC,aAAa,IAAI,KAAK,OAAO,KAAK,YAAY,UAAU;AAC3D,aAAO;AAAA,QACL,QAAQ,SAAS;AAAA,QACjB,SAAS,SAAS;AAAA,MACpB;AAAA,IACF;AACA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,SAAS;AAAA,MACjB,SAAS,KAAK,WAAW,SAAS;AAAA,IACpC;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,MACL,QAAQ,SAAS;AAAA,MACjB,SAAS,SAAS;AAAA,IACpB;AAAA,EACF;AACF;AAQO,SAAS,UAAU,aAA6B;AACrD,SAAO,KAAK,MAAM,KAAK,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD;","names":[]}
1
+ {"version":3,"sources":["../../../src/api/utils.ts"],"sourcesContent":["export function isObjectLike(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport function isErrorLike(\n value: unknown,\n): value is Record<string, unknown> & { message: string } {\n return isObjectLike(value) && typeof value.message === \"string\";\n}\n\ntype Claims = {\n sid: string;\n permissions?: string[];\n exp?: number;\n};\n\nexport function getClaims(accessToken: string): Claims {\n return JSON.parse(atob(accessToken.split(\".\")[1]));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,aAAa,OAAkD;AAC7E,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEO,SAAS,YACd,OACwD;AACxD,SAAO,aAAa,KAAK,KAAK,OAAO,MAAM,YAAY;AACzD;AAQO,SAAS,UAAU,aAA6B;AACrD,SAAO,KAAK,MAAM,KAAK,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD;","names":[]}
@@ -1,13 +1,7 @@
1
- declare function getAuthHeaders(authToken?: string): HeadersInit;
2
1
  declare function isObjectLike(value: unknown): value is Record<string, unknown>;
3
2
  declare function isErrorLike(value: unknown): value is Record<string, unknown> & {
4
3
  message: string;
5
4
  };
6
- declare function parseErrorResponse(response: Response): Promise<{
7
- message: string;
8
- status: number;
9
- errors?: unknown[];
10
- }>;
11
5
  type Claims = {
12
6
  sid: string;
13
7
  permissions?: string[];
@@ -15,4 +9,4 @@ type Claims = {
15
9
  };
16
10
  declare function getClaims(accessToken: string): Claims;
17
11
 
18
- export { getAuthHeaders, getClaims, isErrorLike, isObjectLike, parseErrorResponse };
12
+ export { getClaims, isErrorLike, isObjectLike };
@@ -2,9 +2,7 @@ import { AuthToken } from './api/api-provider.cjs';
2
2
  export { ApiKeysError, ApiKeysErrorProps, ApiKeysLoading, ApiKeysLoadingProps } from './lib/api-keys/api-keys.cjs';
3
3
  import * as React from 'react';
4
4
  import { WidgetRootDomProps } from './lib/utils.cjs';
5
- import './api/endpoint.cjs';
6
- import '@tanstack/react-query';
7
- import './api/widgets-api-client.cjs';
5
+ import './lib/api/types.cjs';
8
6
  import './lib/elements.cjs';
9
7
  import '@radix-ui/themes';
10
8
  import '@radix-ui/themes/props';
@@ -2,9 +2,7 @@ import * as React from 'react';
2
2
  export { DirectorySyncError, DirectorySyncErrorProps, DirectorySyncLoading, DirectorySyncLoadingProps } from './lib/directory-sync.cjs';
3
3
  import { AuthToken } from './api/api-provider.cjs';
4
4
  import { WidgetRootDomProps } from './lib/utils.cjs';
5
- import './api/endpoint.cjs';
6
- import '@tanstack/react-query';
7
- import './api/widgets-api-client.cjs';
5
+ import './lib/api/types.cjs';
8
6
  import './lib/elements.cjs';
9
7
  import '@radix-ui/themes';
10
8
  import '@radix-ui/themes/props';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n WorkOsWidgets,\n type WorkOsWidgetsProps,\n} from \"./workos-widgets.client.js\";\nexport {\n OrganizationSwitcher,\n OrganizationSwitcherLoading,\n type OrganizationSwitcherProps,\n} from \"./organization-switcher.client.js\";\nexport {\n AdminPortalSsoConnection,\n AdminPortalSsoConnectionLoading,\n type AdminPortalSsoConnectionProps,\n} from \"./admin-portal-sso-connection.client.js\";\nexport {\n UserProfile,\n UserProfileLoading,\n type UserProfileProps,\n} from \"./user-profile.client.js\";\nexport {\n UserSecurity,\n UserSecurityLoading,\n type UserSecurityProps,\n} from \"./user-security.client.js\";\nexport {\n UserSessions,\n UserSessionsLoading,\n type UserSessionsProps,\n} from \"./user-sessions.client.js\";\nexport {\n UsersManagement,\n UsersManagementLoading,\n type UsersManagementProps,\n} from \"./users-management.client.js\";\nexport {\n AdminPortalDomainVerification,\n AdminPortalDomainVerificationLoading,\n type AdminPortalDomainVerificationProps,\n} from \"./admin-portal-domain-verification.client.js\";\nexport {\n AdminPortalAuditLogStreaming,\n AdminPortalAuditLogStreamingLoading,\n AdminPortalAuditLogStreamingError,\n type AdminPortalAuditLogStreamingProps,\n AdminPortalAuditLogStreamingPresentational,\n AdminPortalAuditLogStreamingButton as AdminPortalAuditLogStreamingOpenButton,\n type AdminPortalAuditLogStreamingStatusProps,\n} from \"./admin-portal-audit-log-streaming.client.js\";\nexport {\n ApiKeys,\n ApiKeysLoading,\n type ApiKeysProps,\n} from \"./api-keys.client.js\";\nexport {\n Pipes,\n PipesLoading,\n type PipesAuthMethod,\n type PipesConnection,\n type PipesConnectionFilter,\n type PipesFilter,\n type PipesFilterCriteria,\n type PipesProps,\n} from \"./pipes.client.js\";\nexport type { DataIntegration, SharedDataConnection } from \"./api/endpoint.js\";\nexport {\n PipesAdmin,\n PipesAdminLoading,\n type PipesAdminProps,\n} from \"./pipes-admin.client.js\";\nexport {\n DirectorySync,\n DirectorySyncLoading,\n type DirectorySyncProps,\n} from \"./directory-sync.client.js\";\nexport { IntlContext as internal_IntlContext } from \"./lib/i18n/intl-context.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAGO;AACP,0CAIO;AACP,gDAIO;AACP,iCAIO;AACP,kCAIO;AACP,kCAIO;AACP,qCAIO;AACP,qDAIO;AACP,qDAQO;AACP,6BAIO;AACP,0BASO;AAEP,gCAIO;AACP,mCAIO;AACP,0BAAoD;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n WorkOsWidgets,\n type WorkOsWidgetsProps,\n} from \"./workos-widgets.client.js\";\nexport {\n OrganizationSwitcher,\n OrganizationSwitcherLoading,\n type OrganizationSwitcherProps,\n} from \"./organization-switcher.client.js\";\nexport {\n AdminPortalSsoConnection,\n AdminPortalSsoConnectionLoading,\n type AdminPortalSsoConnectionProps,\n} from \"./admin-portal-sso-connection.client.js\";\nexport {\n UserProfile,\n UserProfileLoading,\n type UserProfileProps,\n} from \"./user-profile.client.js\";\nexport {\n UserSecurity,\n UserSecurityLoading,\n type UserSecurityProps,\n} from \"./user-security.client.js\";\nexport {\n UserSessions,\n UserSessionsLoading,\n type UserSessionsProps,\n} from \"./user-sessions.client.js\";\nexport {\n UsersManagement,\n UsersManagementLoading,\n type UsersManagementProps,\n} from \"./users-management.client.js\";\nexport {\n AdminPortalDomainVerification,\n AdminPortalDomainVerificationLoading,\n type AdminPortalDomainVerificationProps,\n} from \"./admin-portal-domain-verification.client.js\";\nexport {\n AdminPortalAuditLogStreaming,\n AdminPortalAuditLogStreamingLoading,\n AdminPortalAuditLogStreamingError,\n type AdminPortalAuditLogStreamingProps,\n AdminPortalAuditLogStreamingPresentational,\n AdminPortalAuditLogStreamingButton as AdminPortalAuditLogStreamingOpenButton,\n type AdminPortalAuditLogStreamingStatusProps,\n} from \"./admin-portal-audit-log-streaming.client.js\";\nexport {\n ApiKeys,\n ApiKeysLoading,\n type ApiKeysProps,\n} from \"./api-keys.client.js\";\nexport {\n Pipes,\n PipesLoading,\n type PipesAuthMethod,\n type PipesConnection,\n type PipesConnectionFilter,\n type PipesFilter,\n type PipesFilterCriteria,\n type PipesProps,\n} from \"./pipes.client.js\";\nexport type { DataIntegration, SharedDataConnection } from \"./lib/api/types.js\";\nexport {\n PipesAdmin,\n PipesAdminLoading,\n type PipesAdminProps,\n} from \"./pipes-admin.client.js\";\nexport {\n DirectorySync,\n DirectorySyncLoading,\n type DirectorySyncProps,\n} from \"./directory-sync.client.js\";\nexport { IntlContext as internal_IntlContext } from \"./lib/i18n/intl-context.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAGO;AACP,0CAIO;AACP,gDAIO;AACP,iCAIO;AACP,kCAIO;AACP,kCAIO;AACP,qCAIO;AACP,qDAIO;AACP,qDAQO;AACP,6BAIO;AACP,0BASO;AAEP,gCAIO;AACP,mCAIO;AACP,0BAAoD;","names":[]}
@@ -9,7 +9,7 @@ export { AdminPortalDomainVerification, AdminPortalDomainVerificationProps } fro
9
9
  export { AdminPortalAuditLogStreaming, AdminPortalAuditLogStreamingProps } from './admin-portal-audit-log-streaming.client.cjs';
10
10
  export { ApiKeys, ApiKeysProps } from './api-keys.client.cjs';
11
11
  export { Pipes, PipesAuthMethod, PipesConnection, PipesConnectionFilter, PipesFilter, PipesFilterCriteria, PipesProps } from './pipes.client.cjs';
12
- export { DataIntegration, SharedDataConnection } from './api/endpoint.cjs';
12
+ export { DataIntegration, SharedDataConnection } from './lib/api/types.cjs';
13
13
  export { PipesAdmin, PipesAdminProps } from './pipes-admin.client.cjs';
14
14
  export { DirectorySync, DirectorySyncProps } from './directory-sync.client.cjs';
15
15
  export { IntlContext as internal_IntlContext } from './lib/i18n/intl-context.cjs';
@@ -40,7 +40,6 @@ import './select-KR89Qnvm.cjs';
40
40
  import '@radix-ui/themes/components/select';
41
41
  import './api/api-provider.cjs';
42
42
  import './lib/utils.cjs';
43
- import './api/widgets-api-client.cjs';
44
43
  import './api/client-graphql/generated.cjs';
45
44
  import 'graphql-request';
46
45
  import './lib/identity-providers.cjs';
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { WidgetRootDomProps } from './utils.cjs';
3
3
  import { AuditLogStreamType } from '../api/client-graphql/generated.cjs';
4
- import '../api/endpoint.cjs';
5
- import '@tanstack/react-query';
6
- import '../api/widgets-api-client.cjs';
4
+ import './api/types.cjs';
7
5
  import './elements.cjs';
8
6
  import '@radix-ui/themes';
9
7
  import '@radix-ui/themes/props';
@@ -2,9 +2,7 @@ import * as React from 'react';
2
2
  import { OrganizationDomainFieldsFragment } from '../api/client-graphql/generated.cjs';
3
3
  import { WidgetRootDomProps } from './utils.cjs';
4
4
  import 'graphql-request';
5
- import '../api/endpoint.cjs';
6
- import '@tanstack/react-query';
7
- import '../api/widgets-api-client.cjs';
5
+ import './api/types.cjs';
8
6
  import './elements.cjs';
9
7
  import '@radix-ui/themes';
10
8
  import '@radix-ui/themes/props';
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { IdentityProvider } from './identity-providers.cjs';
3
3
  import { WidgetRootDomProps } from './utils.cjs';
4
- import '../api/endpoint.cjs';
5
- import '@tanstack/react-query';
6
- import '../api/widgets-api-client.cjs';
4
+ import './api/types.cjs';
7
5
  import './elements.cjs';
8
6
  import '@radix-ui/themes';
9
7
  import '@radix-ui/themes/props';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/api/api-key.ts"],"sourcesContent":["import { keepPreviousData, useQueryClient } from \"@tanstack/react-query\";\nimport type {\n CreateOrganizationApiKeyRequest,\n CreateOrganizationApiKeyResponse,\n ListOrganizationApiKeyPermission,\n ListOrganizationApiKeyPermissionsParams,\n ListOrganizationApiKeyPermissionsResponse,\n ListOrganizationApiKeysResponse,\n ListOrganizationApiKeysResponseData,\n} from \"../../api/endpoint.js\";\nimport {\n type ApiKeyOwnerType,\n type CreateOrganizationApiKeyMutation,\n type ExpireOrganizationApiKeyMutation,\n type ListApiKeyPermissionsQuery,\n type OrganizationApiKeyFieldsFragment,\n} from \"../../api/client-graphql/generated.js\";\nimport {\n clientGraphqlQueryKey,\n useClientGraphqlMutation,\n useClientGraphqlQuery,\n} from \"../../api/client-graphql/hooks.js\";\nimport { ApiError } from \"../../api/errors.js\";\nimport {\n useApiKeysContext,\n type ApiKeysContextType,\n} from \"../api-keys/api-keys-context.js\";\n\nexport const API_KEYS_PAGE_SIZE = 10;\n\ntype ApiKeyPermissionsParams = ListOrganizationApiKeyPermissionsParams;\n\nexport function toApiKeyPermissions(\n list: ListApiKeyPermissionsQuery[\"permissions\"],\n): ListOrganizationApiKeyPermissionsResponse {\n return {\n data: list.data.map(\n (permission): ListOrganizationApiKeyPermission => ({\n id: permission.id,\n slug: permission.slug,\n name: permission.name,\n description: permission.description ?? null,\n }),\n ),\n list_metadata: {\n after: list.listMetadata.after ?? undefined,\n before: list.listMetadata.before ?? undefined,\n },\n };\n}\n\nexport const useListApiKeyPermissions = (\n apiKeyOwnerType: ApiKeyOwnerType,\n params: ApiKeyPermissionsParams = {},\n) => {\n const variables = {\n apiKeyOwnerType,\n after: params.after,\n before: params.before,\n limit: params.limit,\n search: params.search || undefined,\n };\n\n return useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListApiKeyPermissions\", variables),\n queryFn: async (sdk) => {\n const { permissions } = await sdk.ListApiKeyPermissions(variables);\n return permissions;\n },\n select: toApiKeyPermissions,\n placeholderData: keepPreviousData,\n });\n};\n\nexport const useListOrganizationApiKeyPermissions = (\n params?: ApiKeyPermissionsParams,\n) => useListApiKeyPermissions(\"Organization\", params);\n\nexport const organizationApiKeysQueryKey = clientGraphqlQueryKey(\n \"ListOrganizationApiKeys\",\n);\n\nexport function toOrganizationApiKey(\n apiKey: OrganizationApiKeyFieldsFragment,\n): ListOrganizationApiKeysResponseData {\n return {\n id: apiKey.id,\n name: apiKey.name,\n obfuscatedValue: apiKey.obfuscatedValue,\n createdAt: apiKey.createdAt,\n lastUsedAt: apiKey.lastUsedAt ?? null,\n expiresAt: apiKey.expiresAt ?? null,\n permissions: apiKey.permissions,\n };\n}\n\nexport function apiKeyMutationFailure(\n typename: string,\n message: string,\n): ApiError {\n return new ApiError({\n message,\n status: 400,\n queryType: \"mutation\",\n context: { typename },\n });\n}\n\nfunction unwrapCreateOrganizationApiKey(\n result: CreateOrganizationApiKeyMutation[\"createOrganizationApiKey\"],\n): CreateOrganizationApiKeyResponse {\n switch (result.__typename) {\n case \"OrganizationApiKeyCreated\":\n return {\n ...toOrganizationApiKey(result.apiKey),\n value: result.value,\n };\n case \"ApiKeyPermissionsNotHeld\":\n case \"ApiKeyPermissionsUnsupportedForToken\":\n case \"InvalidApiKeyExpiration\":\n case \"InvalidApiKeyName\":\n case \"InvalidApiKeyPermissions\":\n throw apiKeyMutationFailure(result.__typename, result.message);\n }\n}\n\nfunction unwrapExpireOrganizationApiKey(\n result: ExpireOrganizationApiKeyMutation[\"expireOrganizationApiKey\"],\n): ListOrganizationApiKeysResponseData {\n switch (result.__typename) {\n case \"OrganizationApiKeyExpired\":\n return toOrganizationApiKey(result.apiKey);\n case \"ApiKeyAlreadyExpired\":\n throw apiKeyMutationFailure(\n result.__typename,\n \"API key is already expired\",\n );\n }\n}\n\nexport const useApiKeys = (context?: ApiKeysContextType) => {\n const {\n state: { pagination, searchQuery },\n } = useApiKeysContext(context);\n const { before, after } = pagination || {};\n const variables = {\n after: after ?? undefined,\n before: before ?? undefined,\n limit: API_KEYS_PAGE_SIZE,\n search: searchQuery || undefined,\n };\n\n return useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListOrganizationApiKeys\", variables),\n queryFn: async (sdk) => {\n const { organizationApiKeys } =\n await sdk.ListOrganizationApiKeys(variables);\n return organizationApiKeys;\n },\n select: (list): ListOrganizationApiKeysResponse => ({\n data: list.data.map(toOrganizationApiKey),\n list_metadata: {\n after: list.listMetadata.after ?? undefined,\n before: list.listMetadata.before ?? undefined,\n },\n }),\n placeholderData: keepPreviousData,\n });\n};\n\nexport const useInvalidateApiKeys = () => {\n const queryClient = useQueryClient();\n return () =>\n queryClient.invalidateQueries({ queryKey: organizationApiKeysQueryKey });\n};\n\nexport const useCreateApiKey = () => {\n const invalidate = useInvalidateApiKeys();\n\n return useClientGraphqlMutation({\n mutationFn: async (\n sdk,\n { data }: { data: CreateOrganizationApiKeyRequest },\n ) => {\n const { createOrganizationApiKey: result } =\n await sdk.CreateOrganizationApiKey({\n input: {\n name: data.name,\n permissions: data.permissions,\n expiresAt: data.expiresAt ?? null,\n },\n });\n return unwrapCreateOrganizationApiKey(result);\n },\n onSuccess: invalidate,\n });\n};\n\nexport const useDeleteApiKey = ({\n onSuccess,\n}: { onSuccess?: () => void } = {}) => {\n const invalidate = useInvalidateApiKeys();\n\n return useClientGraphqlMutation({\n mutationFn: async (sdk, { apiKeyId }: { apiKeyId: string }) => {\n const { deleteOrganizationApiKey } = await sdk.DeleteOrganizationApiKey({\n apiKeyId,\n });\n return toOrganizationApiKey(deleteOrganizationApiKey);\n },\n onSuccess: () => {\n void invalidate();\n onSuccess?.();\n },\n });\n};\n\nexport const useExpireApiKey = () => {\n const invalidate = useInvalidateApiKeys();\n\n return useClientGraphqlMutation({\n mutationFn: async (\n sdk,\n { apiKeyId, expiresAt }: { apiKeyId: string; expiresAt: string | null },\n ) => {\n const { expireOrganizationApiKey: result } =\n await sdk.ExpireOrganizationApiKey({\n input: { apiKeyId, expiresAt },\n });\n return unwrapExpireOrganizationApiKey(result);\n },\n onSuccess: invalidate,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAiD;AAiBjD,mBAIO;AACP,oBAAyB;AACzB,8BAGO;AAEA,MAAM,qBAAqB;AAI3B,SAAS,oBACd,MAC2C;AAC3C,SAAO;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UAAU,4BAA4B,CAAC;AAC3E;AAEO,MAAM,kBAAkB,MAAM;AACnC,QAAM,aAAa,qBAAqB;AAExC,aAAO,uCAAyB;AAAA,IAC9B,YAAY,OACV,KACA,EAAE,KAAK,MACJ;AACH,YAAM,EAAE,0BAA0B,OAAO,IACvC,MAAM,IAAI,yBAAyB;AAAA,QACjC,OAAO;AAAA,UACL,MAAM,KAAK;AAAA,UACX,aAAa,KAAK;AAAA,UAClB,WAAW,KAAK,aAAa;AAAA,QAC/B;AAAA,MACF,CAAC;AACH,aAAO,+BAA+B,MAAM;AAAA,IAC9C;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;AAEO,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AACF,IAAgC,CAAC,MAAM;AACrC,QAAM,aAAa,qBAAqB;AAExC,aAAO,uCAAyB;AAAA,IAC9B,YAAY,OAAO,KAAK,EAAE,SAAS,MAA4B;AAC7D,YAAM,EAAE,yBAAyB,IAAI,MAAM,IAAI,yBAAyB;AAAA,QACtE;AAAA,MACF,CAAC;AACD,aAAO,qBAAqB,wBAAwB;AAAA,IACtD;AAAA,IACA,WAAW,MAAM;AACf,WAAK,WAAW;AAChB,kBAAY;AAAA,IACd;AAAA,EACF,CAAC;AACH;AAEO,MAAM,kBAAkB,MAAM;AACnC,QAAM,aAAa,qBAAqB;AAExC,aAAO,uCAAyB;AAAA,IAC9B,YAAY,OACV,KACA,EAAE,UAAU,UAAU,MACnB;AACH,YAAM,EAAE,0BAA0B,OAAO,IACvC,MAAM,IAAI,yBAAyB;AAAA,QACjC,OAAO,EAAE,UAAU,UAAU;AAAA,MAC/B,CAAC;AACH,aAAO,+BAA+B,MAAM;AAAA,IAC9C;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/api/api-key.ts"],"sourcesContent":["import { keepPreviousData, useQueryClient } from \"@tanstack/react-query\";\nimport type {\n CreateOrganizationApiKeyRequest,\n CreateOrganizationApiKeyResponse,\n ListOrganizationApiKeyPermission,\n ListOrganizationApiKeyPermissionsParams,\n ListOrganizationApiKeyPermissionsResponse,\n ListOrganizationApiKeysResponse,\n ListOrganizationApiKeysResponseData,\n} from \"./types.js\";\nimport {\n type ApiKeyOwnerType,\n type CreateOrganizationApiKeyMutation,\n type ExpireOrganizationApiKeyMutation,\n type ListApiKeyPermissionsQuery,\n type OrganizationApiKeyFieldsFragment,\n} from \"../../api/client-graphql/generated.js\";\nimport {\n clientGraphqlQueryKey,\n useClientGraphqlMutation,\n useClientGraphqlQuery,\n} from \"../../api/client-graphql/hooks.js\";\nimport { ApiError } from \"../../api/errors.js\";\nimport {\n useApiKeysContext,\n type ApiKeysContextType,\n} from \"../api-keys/api-keys-context.js\";\n\nexport const API_KEYS_PAGE_SIZE = 10;\n\ntype ApiKeyPermissionsParams = ListOrganizationApiKeyPermissionsParams;\n\nexport function toApiKeyPermissions(\n list: ListApiKeyPermissionsQuery[\"permissions\"],\n): ListOrganizationApiKeyPermissionsResponse {\n return {\n data: list.data.map(\n (permission): ListOrganizationApiKeyPermission => ({\n id: permission.id,\n slug: permission.slug,\n name: permission.name,\n description: permission.description ?? null,\n }),\n ),\n list_metadata: {\n after: list.listMetadata.after ?? undefined,\n before: list.listMetadata.before ?? undefined,\n },\n };\n}\n\nexport const useListApiKeyPermissions = (\n apiKeyOwnerType: ApiKeyOwnerType,\n params: ApiKeyPermissionsParams = {},\n) => {\n const variables = {\n apiKeyOwnerType,\n after: params.after,\n before: params.before,\n limit: params.limit,\n search: params.search || undefined,\n };\n\n return useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListApiKeyPermissions\", variables),\n queryFn: async (sdk) => {\n const { permissions } = await sdk.ListApiKeyPermissions(variables);\n return permissions;\n },\n select: toApiKeyPermissions,\n placeholderData: keepPreviousData,\n });\n};\n\nexport const useListOrganizationApiKeyPermissions = (\n params?: ApiKeyPermissionsParams,\n) => useListApiKeyPermissions(\"Organization\", params);\n\nexport const organizationApiKeysQueryKey = clientGraphqlQueryKey(\n \"ListOrganizationApiKeys\",\n);\n\nexport function toOrganizationApiKey(\n apiKey: OrganizationApiKeyFieldsFragment,\n): ListOrganizationApiKeysResponseData {\n return {\n id: apiKey.id,\n name: apiKey.name,\n obfuscatedValue: apiKey.obfuscatedValue,\n createdAt: apiKey.createdAt,\n lastUsedAt: apiKey.lastUsedAt ?? null,\n expiresAt: apiKey.expiresAt ?? null,\n permissions: apiKey.permissions,\n };\n}\n\nexport function apiKeyMutationFailure(\n typename: string,\n message: string,\n): ApiError {\n return new ApiError({\n message,\n status: 400,\n queryType: \"mutation\",\n context: { typename },\n });\n}\n\nfunction unwrapCreateOrganizationApiKey(\n result: CreateOrganizationApiKeyMutation[\"createOrganizationApiKey\"],\n): CreateOrganizationApiKeyResponse {\n switch (result.__typename) {\n case \"OrganizationApiKeyCreated\":\n return {\n ...toOrganizationApiKey(result.apiKey),\n value: result.value,\n };\n case \"ApiKeyPermissionsNotHeld\":\n case \"ApiKeyPermissionsUnsupportedForToken\":\n case \"InvalidApiKeyExpiration\":\n case \"InvalidApiKeyName\":\n case \"InvalidApiKeyPermissions\":\n throw apiKeyMutationFailure(result.__typename, result.message);\n }\n}\n\nfunction unwrapExpireOrganizationApiKey(\n result: ExpireOrganizationApiKeyMutation[\"expireOrganizationApiKey\"],\n): ListOrganizationApiKeysResponseData {\n switch (result.__typename) {\n case \"OrganizationApiKeyExpired\":\n return toOrganizationApiKey(result.apiKey);\n case \"ApiKeyAlreadyExpired\":\n throw apiKeyMutationFailure(\n result.__typename,\n \"API key is already expired\",\n );\n }\n}\n\nexport const useApiKeys = (context?: ApiKeysContextType) => {\n const {\n state: { pagination, searchQuery },\n } = useApiKeysContext(context);\n const { before, after } = pagination || {};\n const variables = {\n after: after ?? undefined,\n before: before ?? undefined,\n limit: API_KEYS_PAGE_SIZE,\n search: searchQuery || undefined,\n };\n\n return useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListOrganizationApiKeys\", variables),\n queryFn: async (sdk) => {\n const { organizationApiKeys } =\n await sdk.ListOrganizationApiKeys(variables);\n return organizationApiKeys;\n },\n select: (list): ListOrganizationApiKeysResponse => ({\n data: list.data.map(toOrganizationApiKey),\n list_metadata: {\n after: list.listMetadata.after ?? undefined,\n before: list.listMetadata.before ?? undefined,\n },\n }),\n placeholderData: keepPreviousData,\n });\n};\n\nexport const useInvalidateApiKeys = () => {\n const queryClient = useQueryClient();\n return () =>\n queryClient.invalidateQueries({ queryKey: organizationApiKeysQueryKey });\n};\n\nexport const useCreateApiKey = () => {\n const invalidate = useInvalidateApiKeys();\n\n return useClientGraphqlMutation({\n mutationFn: async (\n sdk,\n { data }: { data: CreateOrganizationApiKeyRequest },\n ) => {\n const { createOrganizationApiKey: result } =\n await sdk.CreateOrganizationApiKey({\n input: {\n name: data.name,\n permissions: data.permissions,\n expiresAt: data.expiresAt ?? null,\n },\n });\n return unwrapCreateOrganizationApiKey(result);\n },\n onSuccess: invalidate,\n });\n};\n\nexport const useDeleteApiKey = ({\n onSuccess,\n}: { onSuccess?: () => void } = {}) => {\n const invalidate = useInvalidateApiKeys();\n\n return useClientGraphqlMutation({\n mutationFn: async (sdk, { apiKeyId }: { apiKeyId: string }) => {\n const { deleteOrganizationApiKey } = await sdk.DeleteOrganizationApiKey({\n apiKeyId,\n });\n return toOrganizationApiKey(deleteOrganizationApiKey);\n },\n onSuccess: () => {\n void invalidate();\n onSuccess?.();\n },\n });\n};\n\nexport const useExpireApiKey = () => {\n const invalidate = useInvalidateApiKeys();\n\n return useClientGraphqlMutation({\n mutationFn: async (\n sdk,\n { apiKeyId, expiresAt }: { apiKeyId: string; expiresAt: string | null },\n ) => {\n const { expireOrganizationApiKey: result } =\n await sdk.ExpireOrganizationApiKey({\n input: { apiKeyId, expiresAt },\n });\n return unwrapExpireOrganizationApiKey(result);\n },\n onSuccess: invalidate,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;A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A,IAC9C;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -1,9 +1,8 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { ListOrganizationApiKeyPermissionsResponse, ListOrganizationApiKeyPermissionsParams, ListOrganizationApiKeysResponseData, ListOrganizationApiKeysResponse, CreateOrganizationApiKeyResponse, CreateOrganizationApiKeyRequest } from '../../api/endpoint.cjs';
2
+ import { ListOrganizationApiKeyPermissionsResponse, ListOrganizationApiKeyPermissionsParams, ListOrganizationApiKeysResponseData, ListOrganizationApiKeysResponse, CreateOrganizationApiKeyResponse, CreateOrganizationApiKeyRequest } from './types.cjs';
3
3
  import { ListApiKeyPermissionsQuery, ApiKeyOwnerType, OrganizationApiKeyFieldsFragment } from '../../api/client-graphql/generated.cjs';
4
4
  import { ApiError } from '../../api/errors.cjs';
5
5
  import { ApiKeysContextType } from '../api-keys/api-keys-context.cjs';
6
- import '../../api/widgets-api-client.cjs';
7
6
  import 'graphql-request';
8
7
  import 'react';
9
8
  import '../api-keys/api-keys-state.cjs';
@@ -18,21 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var config_exports = {};
20
20
  __export(config_exports, {
21
- API_ENDPOINTS: () => API_ENDPOINTS,
22
21
  DEFAULT_API_HOSTNAME: () => DEFAULT_API_HOSTNAME
23
22
  });
24
23
  module.exports = __toCommonJS(config_exports);
25
24
  const DEFAULT_API_HOSTNAME = "api.workos.com";
26
- const API_ENDPOINTS = {
27
- USERS: "_widgets/UserManagement/members",
28
- USER_ROLES: "_widgets/UserManagement/roles",
29
- USER_INVITE: "_widgets/UserManagement/invite-user",
30
- USER_INVITES: "_widgets/UserManagement/invites",
31
- USER_INVITES_RESEND: (userId) => `_widgets/UserManagement/invites/${userId}/resend`
32
- };
33
25
  // Annotate the CommonJS export names for ESM import in node:
34
26
  0 && (module.exports = {
35
- API_ENDPOINTS,
36
27
  DEFAULT_API_HOSTNAME
37
28
  });
38
29
  //# sourceMappingURL=config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/api/config.ts"],"sourcesContent":["export const DEFAULT_API_HOSTNAME = \"api.workos.com\";\nexport const API_ENDPOINTS = {\n USERS: \"_widgets/UserManagement/members\",\n USER_ROLES: \"_widgets/UserManagement/roles\",\n USER_INVITE: \"_widgets/UserManagement/invite-user\",\n USER_INVITES: \"_widgets/UserManagement/invites\",\n USER_INVITES_RESEND: (userId: string) =>\n `_widgets/UserManagement/invites/${userId}/resend`,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uBAAuB;AAC7B,MAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,qBAAqB,CAAC,WACpB,mCAAmC,MAAM;AAC7C;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/api/config.ts"],"sourcesContent":["export const DEFAULT_API_HOSTNAME = \"api.workos.com\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uBAAuB;","names":[]}
@@ -1,10 +1,3 @@
1
1
  declare const DEFAULT_API_HOSTNAME = "api.workos.com";
2
- declare const API_ENDPOINTS: {
3
- USERS: string;
4
- USER_ROLES: string;
5
- USER_INVITE: string;
6
- USER_INVITES: string;
7
- USER_INVITES_RESEND: (userId: string) => string;
8
- };
9
2
 
10
- export { API_ENDPOINTS, DEFAULT_API_HOSTNAME };
3
+ export { DEFAULT_API_HOSTNAME };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/api/pipes.ts"],"sourcesContent":["import { useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type {\n DataInstallation,\n DataIntegrationConfigField,\n DataIntegrationConfiguration,\n DataIntegrationCredentials,\n DataIntegrationWithConnections,\n OrganizationDataIntegration,\n SharedConnection,\n SharedDataConnection,\n} from \"../../api/endpoint.js\";\nimport type {\n ConfigurableDataProviderFieldsFragment,\n DataProviderConfigFieldFieldsFragment,\n DataProviderConnectionFieldsFragment,\n DataProviderFieldsFragment,\n OrganizationDataProviderFieldsFragment,\n SharedDataProviderFieldsFragment,\n Sdk,\n} from \"../../api/client-graphql/generated.js\";\nimport {\n clientGraphqlQueryKey,\n useClientGraphqlQuery,\n} from \"../../api/client-graphql/hooks.js\";\n\nconst PAGE_SIZE = 100;\n\n/**\n * The Pipes list queries default to `limit: 10` and the widgets render every\n * row, so each list is walked to its end before it is adapted.\n */\nasync function listAllPages<T>(\n fetchPage: (after: string | null) => Promise<{\n data: T[];\n listMetadata: { after?: string | null };\n }>,\n): Promise<T[]> {\n const rows: T[] = [];\n let after: string | null = null;\n do {\n const page = await fetchPage(after);\n rows.push(...page.data);\n after = page.listMetadata.after ?? null;\n } while (after !== null);\n return rows;\n}\n\nfunction isOneOf<const T extends readonly string[]>(\n values: T,\n value: string,\n): value is T[number] {\n return values.includes(value);\n}\n\nconst AUTH_METHODS = [\"oauth\", \"api_key\", \"client_credentials\"] as const;\nconst CONNECTION_STATES = [\"connected\", \"needs_reauthorization\"] as const;\nconst AVAILABILITIES = [\"available\", \"needs_admin_attention\"] as const;\nconst CREDENTIALS_TYPES = [\"shared\", \"custom\", \"organization\"] as const;\nconst DISABLED_SOURCES = [\"developer\", \"organization\"] as const;\nconst CONFIG_FIELD_SCOPES = [\"integration\", \"installation\"] as const;\n\nfunction toAuthMethods(\n authMethods: readonly string[],\n): NonNullable<DataIntegrationWithConnections[\"authMethods\"]> {\n return authMethods.filter((method) => isOneOf(AUTH_METHODS, method));\n}\n\n/**\n * The GraphQL types carry these as plain strings; the REST DTOs the widgets\n * render from narrow them. Unknown values fall back to the option that\n * renders the least capable state.\n */\nfunction toCredentialsType(\n credentialsType: string,\n): DataIntegrationWithConnections[\"credentialsType\"] {\n return isOneOf(CREDENTIALS_TYPES, credentialsType)\n ? credentialsType\n : \"shared\";\n}\n\nfunction toConnectionState(state: string): DataInstallation[\"state\"] {\n return isOneOf(CONNECTION_STATES, state) ? state : \"needs_reauthorization\";\n}\n\nfunction toConfig(\n entries: readonly { name: string; value: string }[],\n): Record<string, string> {\n return Object.fromEntries(entries.map(({ name, value }) => [name, value]));\n}\n\nfunction toConfigField(\n field: DataProviderConfigFieldFieldsFragment,\n): DataIntegrationConfigField {\n return {\n key: field.key,\n label: field.label,\n required: field.required,\n scope: isOneOf(CONFIG_FIELD_SCOPES, field.scope)\n ? field.scope\n : \"integration\",\n description: field.description ?? undefined,\n example: field.example ?? undefined,\n pattern: field.pattern ?? undefined,\n patternFlags: field.patternFlags ?? undefined,\n order: field.order ?? undefined,\n secret: field.secret ?? undefined,\n default: field.default ?? undefined,\n };\n}\n\nfunction toIconFields(provider: {\n iconSlug?: string | null;\n iconUrl?: string | null;\n iconDarkUrl?: string | null;\n}): Pick<\n DataIntegrationWithConnections,\n \"iconSlug\" | \"iconUrl\" | \"iconDarkUrl\"\n> {\n return {\n iconSlug: provider.iconSlug ?? undefined,\n iconUrl: provider.iconUrl ?? undefined,\n iconDarkUrl: provider.iconDarkUrl ?? undefined,\n };\n}\n\nexport function toDataInstallation(\n connection: DataProviderConnectionFieldsFragment,\n): DataInstallation {\n return {\n object: \"data_installation\",\n id: connection.id,\n connection_role:\n connection.connectionRole === \"Standard\" ? \"standard\" : \"compatibility\",\n account_identifier: connection.accountIdentifier ?? null,\n account_display_name: connection.accountDisplayName ?? null,\n user_id: connection.userId ?? null,\n organization_id: connection.organizationId ?? null,\n scopes: connection.scopes,\n auth_method: isOneOf(AUTH_METHODS, connection.authMethod)\n ? connection.authMethod\n : \"oauth\",\n api_key_last_4: connection.apiKeyLast4 ?? null,\n client_id: connection.clientId ?? null,\n client_secret_last_4: connection.clientSecretLast4 ?? null,\n config: toConfig(connection.config),\n state: toConnectionState(connection.state),\n created_at: connection.createdAt,\n updated_at: connection.updatedAt,\n };\n}\n\n/**\n * Joins the member's providers with their own connections the way\n * `GET /_widgets/DataIntegrations/mine` did: the member's connection sits\n * inline as `installation` and is repeated in `connected_accounts`.\n */\nexport function toMyDataIntegrations(\n providers: readonly DataProviderFieldsFragment[],\n connections: readonly DataProviderConnectionFieldsFragment[],\n): DataIntegrationWithConnections[] {\n const connectionsByProviderId = new Map<string, DataInstallation[]>();\n for (const connection of connections) {\n const installations =\n connectionsByProviderId.get(connection.dataProviderId) ?? [];\n installations.push(toDataInstallation(connection));\n connectionsByProviderId.set(connection.dataProviderId, installations);\n }\n\n return providers.map((provider) => {\n const installations = connectionsByProviderId.get(provider.id) ?? [];\n return {\n object: \"data_integration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n integrationType: provider.integrationType,\n ownership: \"userland_user\",\n credentialsType: toCredentialsType(provider.credentialsType),\n scopes: provider.scopes,\n authMethods: toAuthMethods(provider.authMethods),\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n installation: installations[0] ?? null,\n connected_accounts: installations,\n createdAt: provider.createdAt,\n updatedAt: provider.updatedAt,\n ...toIconFields(provider),\n };\n });\n}\n\n/**\n * Presents a shared provider the way\n * `GET /_widgets/DataIntegrations/shared-connections` did for any active\n * member: identity, presentation and the state of each shared connection,\n * without credentials or account identifiers.\n */\nexport function toSharedDataConnection(\n provider: SharedDataProviderFieldsFragment,\n): SharedDataConnection {\n return {\n object: \"data_integration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n ownership: \"organization\",\n connected_accounts: provider.connectedAccounts.map(\n (connection): SharedConnection => ({\n object: \"connected_account\",\n id: connection.id,\n state: toConnectionState(connection.state),\n availability: isOneOf(AVAILABILITIES, connection.availability)\n ? connection.availability\n : \"needs_admin_attention\",\n created_at: connection.createdAt,\n updated_at: connection.updatedAt,\n }),\n ),\n ...toIconFields(provider),\n };\n}\n\n/**\n * Presents the organization's policy configuration of a member-connectable\n * provider the way `GET /_widgets/DataIntegrations/configurations` did.\n */\nexport function toDataIntegrationConfiguration(\n provider: ConfigurableDataProviderFieldsFragment,\n): DataIntegrationConfiguration {\n return {\n object: \"data_integration_configuration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n integrationType: provider.integrationType,\n ownership: \"userland_user\",\n enabled: provider.enabled,\n scopes: provider.scopes,\n defaultScopes: provider.defaultScopes,\n availableScopes: provider.availableScopes,\n credentials: toCredentials(provider.credentials),\n authMethods: toAuthMethods(provider.authMethods),\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n createdAt: provider.createdAt,\n updatedAt: provider.updatedAt,\n ...toIconFields(provider),\n };\n}\n\nfunction toCredentials(\n credentials: OrganizationDataProviderFieldsFragment[\"credentials\"],\n): DataIntegrationCredentials {\n return {\n credentialsType: toCredentialsType(credentials.credentialsType),\n hasCredentials: credentials.hasCredentials,\n client_id: credentials.clientId ?? null,\n redactedClientSecret: credentials.redactedClientSecret ?? null,\n redirectUri: credentials.redirectUri,\n };\n}\n\n/**\n * Presents an organization-owned provider the way\n * `GET /_widgets/DataIntegrations/organization` did. The GraphQL type\n * resolves the organization's override into the effective `enabled` /\n * `disabledSource`, so the raw override fields are derived from those.\n */\nexport function toOrganizationDataIntegration(\n provider: OrganizationDataProviderFieldsFragment,\n): OrganizationDataIntegration {\n const disabledSource = provider.disabledSource ?? null;\n const overrideDisabled = disabledSource === \"organization\";\n const connectedAccounts = provider.connectedAccounts.map(toDataInstallation);\n return {\n object: \"data_integration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n integrationType: provider.integrationType,\n ownership: \"organization\",\n credentialsType: toCredentialsType(provider.credentialsType),\n scopes: provider.scopes,\n authMethods: toAuthMethods(provider.authMethods),\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n installation: provider.connection\n ? toDataInstallation(provider.connection)\n : null,\n connected_accounts: connectedAccounts,\n createdAt: provider.createdAt,\n updatedAt: provider.updatedAt,\n ...toIconFields(provider),\n configuration: {\n hasOverride: overrideDisabled,\n rootEnabled: disabledSource !== \"developer\",\n overrideEnabled: overrideDisabled ? false : null,\n enabled: provider.enabled,\n disabledSource:\n disabledSource !== null && isOneOf(DISABLED_SOURCES, disabledSource)\n ? disabledSource\n : null,\n scopes: provider.scopes,\n defaultScopes: provider.defaultScopes,\n availableScopes: provider.availableScopes,\n credentials: toCredentials(provider.credentials),\n configured: provider.configured,\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n },\n capabilities: {\n canConfigure: provider.capabilities.canConfigure,\n canConnect: provider.capabilities.canConnect,\n canUpdateCredentials: provider.capabilities.canUpdateCredentials,\n canReauthorize: provider.capabilities.canReauthorize,\n canDisconnect: provider.capabilities.canDisconnect,\n },\n };\n}\n\nexport async function listAllDataProviders(\n sdk: Sdk,\n): Promise<DataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { dataProviders } = await sdk.ListDataProviders({\n after,\n limit: PAGE_SIZE,\n });\n return dataProviders;\n });\n}\n\nexport async function listAllDataProviderConnections(\n sdk: Sdk,\n): Promise<DataProviderConnectionFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { dataProviderConnections } = await sdk.ListDataProviderConnections({\n after,\n limit: PAGE_SIZE,\n });\n return dataProviderConnections;\n });\n}\n\nexport async function listAllOrganizationDataProviders(\n sdk: Sdk,\n): Promise<OrganizationDataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { organizationDataProviders } =\n await sdk.ListOrganizationDataProviders({ after, limit: PAGE_SIZE });\n return organizationDataProviders;\n });\n}\n\nexport async function listAllSharedDataProviders(\n sdk: Sdk,\n): Promise<SharedDataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { sharedDataProviders } = await sdk.ListSharedDataProviders({\n after,\n limit: PAGE_SIZE,\n });\n return sharedDataProviders;\n });\n}\n\nexport async function listAllConfigurableDataProviders(\n sdk: Sdk,\n): Promise<ConfigurableDataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { configurableDataProviders } =\n await sdk.ListConfigurableDataProviders({ after, limit: PAGE_SIZE });\n return configurableDataProviders;\n });\n}\n\nexport const sharedDataConnectionsQueryKey = clientGraphqlQueryKey(\n \"ListSharedDataProviders\",\n);\n\nexport const dataIntegrationConfigurationsQueryKey = clientGraphqlQueryKey(\n \"ListConfigurableDataProviders\",\n);\n\nexport const myDataIntegrationsQueryKeys = [\n clientGraphqlQueryKey(\"ListDataProviders\"),\n clientGraphqlQueryKey(\"ListDataProviderConnections\"),\n];\n\nexport const organizationDataIntegrationsQueryKey = clientGraphqlQueryKey(\n \"ListOrganizationDataProviders\",\n);\n\ninterface ListResult<T> {\n data: T[];\n isLoading: boolean;\n isPending: boolean;\n isSuccess: boolean;\n isError: boolean;\n error: Error | null;\n failureCount: number;\n refetch: () => void;\n}\n\n/** The member's connectable providers joined with their own connections. */\nexport function useMyDataIntegrations({\n enabled = true,\n}: { enabled?: boolean } = {}): ListResult<DataIntegrationWithConnections> {\n const providers = useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListDataProviders\"),\n queryFn: listAllDataProviders,\n enabled,\n });\n const connections = useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListDataProviderConnections\"),\n queryFn: listAllDataProviderConnections,\n enabled,\n });\n\n const isSuccess = providers.isSuccess && connections.isSuccess;\n return {\n data: isSuccess\n ? toMyDataIntegrations(providers.data, connections.data)\n : [],\n isLoading: providers.isLoading || connections.isLoading,\n isPending: providers.isPending || connections.isPending,\n isSuccess,\n isError: providers.isError || connections.isError,\n error: providers.error ?? connections.error,\n failureCount: Math.max(providers.failureCount, connections.failureCount),\n refetch: () => {\n void providers.refetch();\n void connections.refetch();\n },\n };\n}\n\n/** The organization's provider inventory with its shared connections. */\nexport function useOrganizationDataIntegrations({\n enabled = true,\n}: { enabled?: boolean } = {}): ListResult<OrganizationDataIntegration> {\n const query = useClientGraphqlQuery({\n queryKey: organizationDataIntegrationsQueryKey,\n queryFn: listAllOrganizationDataProviders,\n select: (providers) => providers.map(toOrganizationDataIntegration),\n enabled,\n });\n return {\n data: query.data ?? [],\n isLoading: query.isLoading,\n isPending: query.isPending,\n isSuccess: query.isSuccess,\n isError: query.isError,\n error: query.error,\n failureCount: query.failureCount,\n refetch: () => {\n void query.refetch();\n },\n };\n}\n\n/** The organization's shared connections, readable by any active member. */\nexport function useSharedDataConnections(): ListResult<SharedDataConnection> {\n const query = useClientGraphqlQuery({\n queryKey: sharedDataConnectionsQueryKey,\n queryFn: listAllSharedDataProviders,\n select: (providers) => providers.map(toSharedDataConnection),\n });\n return {\n data: query.data ?? [],\n isLoading: query.isLoading,\n isPending: query.isPending,\n isSuccess: query.isSuccess,\n isError: query.isError,\n error: query.error,\n failureCount: query.failureCount,\n refetch: () => {\n void query.refetch();\n },\n };\n}\n\n/** The organization's policy configuration of each connectable provider. */\nexport function useDataIntegrationConfigurations({\n enabled = true,\n}: { enabled?: boolean } = {}): ListResult<DataIntegrationConfiguration> {\n const query = useClientGraphqlQuery({\n queryKey: dataIntegrationConfigurationsQueryKey,\n queryFn: listAllConfigurableDataProviders,\n select: (providers) => providers.map(toDataIntegrationConfiguration),\n enabled,\n });\n return {\n data: query.data ?? [],\n isLoading: query.isLoading,\n isPending: query.isPending,\n isSuccess: query.isSuccess,\n isError: query.isError,\n error: query.error,\n failureCount: query.failureCount,\n refetch: () => {\n void query.refetch();\n },\n };\n}\n\n/** Refreshes the member's own lists after one of their connections changed. */\nexport function useInvalidateMyDataIntegrations() {\n const queryClient = useQueryClient();\n return useCallback(() => {\n for (const queryKey of myDataIntegrationsQueryKeys) {\n queryClient.invalidateQueries({ queryKey });\n }\n }, [queryClient]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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SAAS,MAAM;AACb,WAAK,MAAM,QAAQ;AAAA,IACrB;AAAA,EACF;AACF;AAGO,SAAS,kCAAkC;AAChD,QAAM,kBAAc,mCAAe;AACnC,aAAO,0BAAY,MAAM;AACvB,eAAW,YAAY,6BAA6B;AAClD,kBAAY,kBAAkB,EAAE,SAAS,CAAC;AAAA,IAC5C;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAClB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/api/pipes.ts"],"sourcesContent":["import { useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type {\n DataInstallation,\n DataIntegrationConfigField,\n DataIntegrationConfiguration,\n DataIntegrationCredentials,\n DataIntegrationWithConnections,\n OrganizationDataIntegration,\n SharedConnection,\n SharedDataConnection,\n} from \"./types.js\";\nimport type {\n ConfigurableDataProviderFieldsFragment,\n DataProviderConfigFieldFieldsFragment,\n DataProviderConnectionFieldsFragment,\n DataProviderFieldsFragment,\n OrganizationDataProviderFieldsFragment,\n SharedDataProviderFieldsFragment,\n Sdk,\n} from \"../../api/client-graphql/generated.js\";\nimport {\n clientGraphqlQueryKey,\n useClientGraphqlQuery,\n} from \"../../api/client-graphql/hooks.js\";\n\nconst PAGE_SIZE = 100;\n\n/**\n * The Pipes list queries default to `limit: 10` and the widgets render every\n * row, so each list is walked to its end before it is adapted.\n */\nasync function listAllPages<T>(\n fetchPage: (after: string | null) => Promise<{\n data: T[];\n listMetadata: { after?: string | null };\n }>,\n): Promise<T[]> {\n const rows: T[] = [];\n let after: string | null = null;\n do {\n const page = await fetchPage(after);\n rows.push(...page.data);\n after = page.listMetadata.after ?? null;\n } while (after !== null);\n return rows;\n}\n\nfunction isOneOf<const T extends readonly string[]>(\n values: T,\n value: string,\n): value is T[number] {\n return values.includes(value);\n}\n\nconst AUTH_METHODS = [\"oauth\", \"api_key\", \"client_credentials\"] as const;\nconst CONNECTION_STATES = [\"connected\", \"needs_reauthorization\"] as const;\nconst AVAILABILITIES = [\"available\", \"needs_admin_attention\"] as const;\nconst CREDENTIALS_TYPES = [\"shared\", \"custom\", \"organization\"] as const;\nconst DISABLED_SOURCES = [\"developer\", \"organization\"] as const;\nconst CONFIG_FIELD_SCOPES = [\"integration\", \"installation\"] as const;\n\nfunction toAuthMethods(\n authMethods: readonly string[],\n): NonNullable<DataIntegrationWithConnections[\"authMethods\"]> {\n return authMethods.filter((method) => isOneOf(AUTH_METHODS, method));\n}\n\n/**\n * The GraphQL types carry these as plain strings; the REST DTOs the widgets\n * render from narrow them. Unknown values fall back to the option that\n * renders the least capable state.\n */\nfunction toCredentialsType(\n credentialsType: string,\n): DataIntegrationWithConnections[\"credentialsType\"] {\n return isOneOf(CREDENTIALS_TYPES, credentialsType)\n ? credentialsType\n : \"shared\";\n}\n\nfunction toConnectionState(state: string): DataInstallation[\"state\"] {\n return isOneOf(CONNECTION_STATES, state) ? state : \"needs_reauthorization\";\n}\n\nfunction toConfig(\n entries: readonly { name: string; value: string }[],\n): Record<string, string> {\n return Object.fromEntries(entries.map(({ name, value }) => [name, value]));\n}\n\nfunction toConfigField(\n field: DataProviderConfigFieldFieldsFragment,\n): DataIntegrationConfigField {\n return {\n key: field.key,\n label: field.label,\n required: field.required,\n scope: isOneOf(CONFIG_FIELD_SCOPES, field.scope)\n ? field.scope\n : \"integration\",\n description: field.description ?? undefined,\n example: field.example ?? undefined,\n pattern: field.pattern ?? undefined,\n patternFlags: field.patternFlags ?? undefined,\n order: field.order ?? undefined,\n secret: field.secret ?? undefined,\n default: field.default ?? undefined,\n };\n}\n\nfunction toIconFields(provider: {\n iconSlug?: string | null;\n iconUrl?: string | null;\n iconDarkUrl?: string | null;\n}): Pick<\n DataIntegrationWithConnections,\n \"iconSlug\" | \"iconUrl\" | \"iconDarkUrl\"\n> {\n return {\n iconSlug: provider.iconSlug ?? undefined,\n iconUrl: provider.iconUrl ?? undefined,\n iconDarkUrl: provider.iconDarkUrl ?? undefined,\n };\n}\n\nexport function toDataInstallation(\n connection: DataProviderConnectionFieldsFragment,\n): DataInstallation {\n return {\n object: \"data_installation\",\n id: connection.id,\n connection_role:\n connection.connectionRole === \"Standard\" ? \"standard\" : \"compatibility\",\n account_identifier: connection.accountIdentifier ?? null,\n account_display_name: connection.accountDisplayName ?? null,\n user_id: connection.userId ?? null,\n organization_id: connection.organizationId ?? null,\n scopes: connection.scopes,\n auth_method: isOneOf(AUTH_METHODS, connection.authMethod)\n ? connection.authMethod\n : \"oauth\",\n api_key_last_4: connection.apiKeyLast4 ?? null,\n client_id: connection.clientId ?? null,\n client_secret_last_4: connection.clientSecretLast4 ?? null,\n config: toConfig(connection.config),\n state: toConnectionState(connection.state),\n created_at: connection.createdAt,\n updated_at: connection.updatedAt,\n };\n}\n\n/**\n * Joins the member's providers with their own connections the way\n * `GET /_widgets/DataIntegrations/mine` did: the member's connection sits\n * inline as `installation` and is repeated in `connected_accounts`.\n */\nexport function toMyDataIntegrations(\n providers: readonly DataProviderFieldsFragment[],\n connections: readonly DataProviderConnectionFieldsFragment[],\n): DataIntegrationWithConnections[] {\n const connectionsByProviderId = new Map<string, DataInstallation[]>();\n for (const connection of connections) {\n const installations =\n connectionsByProviderId.get(connection.dataProviderId) ?? [];\n installations.push(toDataInstallation(connection));\n connectionsByProviderId.set(connection.dataProviderId, installations);\n }\n\n return providers.map((provider) => {\n const installations = connectionsByProviderId.get(provider.id) ?? [];\n return {\n object: \"data_integration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n integrationType: provider.integrationType,\n ownership: \"userland_user\",\n credentialsType: toCredentialsType(provider.credentialsType),\n scopes: provider.scopes,\n authMethods: toAuthMethods(provider.authMethods),\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n installation: installations[0] ?? null,\n connected_accounts: installations,\n createdAt: provider.createdAt,\n updatedAt: provider.updatedAt,\n ...toIconFields(provider),\n };\n });\n}\n\n/**\n * Presents a shared provider the way\n * `GET /_widgets/DataIntegrations/shared-connections` did for any active\n * member: identity, presentation and the state of each shared connection,\n * without credentials or account identifiers.\n */\nexport function toSharedDataConnection(\n provider: SharedDataProviderFieldsFragment,\n): SharedDataConnection {\n return {\n object: \"data_integration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n ownership: \"organization\",\n connected_accounts: provider.connectedAccounts.map(\n (connection): SharedConnection => ({\n object: \"connected_account\",\n id: connection.id,\n state: toConnectionState(connection.state),\n availability: isOneOf(AVAILABILITIES, connection.availability)\n ? connection.availability\n : \"needs_admin_attention\",\n created_at: connection.createdAt,\n updated_at: connection.updatedAt,\n }),\n ),\n ...toIconFields(provider),\n };\n}\n\n/**\n * Presents the organization's policy configuration of a member-connectable\n * provider the way `GET /_widgets/DataIntegrations/configurations` did.\n */\nexport function toDataIntegrationConfiguration(\n provider: ConfigurableDataProviderFieldsFragment,\n): DataIntegrationConfiguration {\n return {\n object: \"data_integration_configuration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n integrationType: provider.integrationType,\n ownership: \"userland_user\",\n enabled: provider.enabled,\n scopes: provider.scopes,\n defaultScopes: provider.defaultScopes,\n availableScopes: provider.availableScopes,\n credentials: toCredentials(provider.credentials),\n authMethods: toAuthMethods(provider.authMethods),\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n createdAt: provider.createdAt,\n updatedAt: provider.updatedAt,\n ...toIconFields(provider),\n };\n}\n\nfunction toCredentials(\n credentials: OrganizationDataProviderFieldsFragment[\"credentials\"],\n): DataIntegrationCredentials {\n return {\n credentialsType: toCredentialsType(credentials.credentialsType),\n hasCredentials: credentials.hasCredentials,\n client_id: credentials.clientId ?? null,\n redactedClientSecret: credentials.redactedClientSecret ?? null,\n redirectUri: credentials.redirectUri,\n };\n}\n\n/**\n * Presents an organization-owned provider the way\n * `GET /_widgets/DataIntegrations/organization` did. The GraphQL type\n * resolves the organization's override into the effective `enabled` /\n * `disabledSource`, so the raw override fields are derived from those.\n */\nexport function toOrganizationDataIntegration(\n provider: OrganizationDataProviderFieldsFragment,\n): OrganizationDataIntegration {\n const disabledSource = provider.disabledSource ?? null;\n const overrideDisabled = disabledSource === \"organization\";\n const connectedAccounts = provider.connectedAccounts.map(toDataInstallation);\n return {\n object: \"data_integration\",\n id: provider.id,\n name: provider.name,\n description: provider.description,\n slug: provider.slug,\n integrationType: provider.integrationType,\n ownership: \"organization\",\n credentialsType: toCredentialsType(provider.credentialsType),\n scopes: provider.scopes,\n authMethods: toAuthMethods(provider.authMethods),\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n installation: provider.connection\n ? toDataInstallation(provider.connection)\n : null,\n connected_accounts: connectedAccounts,\n createdAt: provider.createdAt,\n updatedAt: provider.updatedAt,\n ...toIconFields(provider),\n configuration: {\n hasOverride: overrideDisabled,\n rootEnabled: disabledSource !== \"developer\",\n overrideEnabled: overrideDisabled ? false : null,\n enabled: provider.enabled,\n disabledSource:\n disabledSource !== null && isOneOf(DISABLED_SOURCES, disabledSource)\n ? disabledSource\n : null,\n scopes: provider.scopes,\n defaultScopes: provider.defaultScopes,\n availableScopes: provider.availableScopes,\n credentials: toCredentials(provider.credentials),\n configured: provider.configured,\n configFields: provider.configFields.map(toConfigField),\n config: toConfig(provider.config),\n },\n capabilities: {\n canConfigure: provider.capabilities.canConfigure,\n canConnect: provider.capabilities.canConnect,\n canUpdateCredentials: provider.capabilities.canUpdateCredentials,\n canReauthorize: provider.capabilities.canReauthorize,\n canDisconnect: provider.capabilities.canDisconnect,\n },\n };\n}\n\nexport async function listAllDataProviders(\n sdk: Sdk,\n): Promise<DataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { dataProviders } = await sdk.ListDataProviders({\n after,\n limit: PAGE_SIZE,\n });\n return dataProviders;\n });\n}\n\nexport async function listAllDataProviderConnections(\n sdk: Sdk,\n): Promise<DataProviderConnectionFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { dataProviderConnections } = await sdk.ListDataProviderConnections({\n after,\n limit: PAGE_SIZE,\n });\n return dataProviderConnections;\n });\n}\n\nexport async function listAllOrganizationDataProviders(\n sdk: Sdk,\n): Promise<OrganizationDataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { organizationDataProviders } =\n await sdk.ListOrganizationDataProviders({ after, limit: PAGE_SIZE });\n return organizationDataProviders;\n });\n}\n\nexport async function listAllSharedDataProviders(\n sdk: Sdk,\n): Promise<SharedDataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { sharedDataProviders } = await sdk.ListSharedDataProviders({\n after,\n limit: PAGE_SIZE,\n });\n return sharedDataProviders;\n });\n}\n\nexport async function listAllConfigurableDataProviders(\n sdk: Sdk,\n): Promise<ConfigurableDataProviderFieldsFragment[]> {\n return listAllPages(async (after) => {\n const { configurableDataProviders } =\n await sdk.ListConfigurableDataProviders({ after, limit: PAGE_SIZE });\n return configurableDataProviders;\n });\n}\n\nexport const sharedDataConnectionsQueryKey = clientGraphqlQueryKey(\n \"ListSharedDataProviders\",\n);\n\nexport const dataIntegrationConfigurationsQueryKey = clientGraphqlQueryKey(\n \"ListConfigurableDataProviders\",\n);\n\nexport const myDataIntegrationsQueryKeys = [\n clientGraphqlQueryKey(\"ListDataProviders\"),\n clientGraphqlQueryKey(\"ListDataProviderConnections\"),\n];\n\nexport const organizationDataIntegrationsQueryKey = clientGraphqlQueryKey(\n \"ListOrganizationDataProviders\",\n);\n\ninterface ListResult<T> {\n data: T[];\n isLoading: boolean;\n isPending: boolean;\n isSuccess: boolean;\n isError: boolean;\n error: Error | null;\n failureCount: number;\n refetch: () => void;\n}\n\n/** The member's connectable providers joined with their own connections. */\nexport function useMyDataIntegrations({\n enabled = true,\n}: { enabled?: boolean } = {}): ListResult<DataIntegrationWithConnections> {\n const providers = useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListDataProviders\"),\n queryFn: listAllDataProviders,\n enabled,\n });\n const connections = useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListDataProviderConnections\"),\n queryFn: listAllDataProviderConnections,\n enabled,\n });\n\n const isSuccess = providers.isSuccess && connections.isSuccess;\n return {\n data: isSuccess\n ? toMyDataIntegrations(providers.data, connections.data)\n : [],\n isLoading: providers.isLoading || connections.isLoading,\n isPending: providers.isPending || connections.isPending,\n isSuccess,\n isError: providers.isError || connections.isError,\n error: providers.error ?? connections.error,\n failureCount: Math.max(providers.failureCount, connections.failureCount),\n refetch: () => {\n void providers.refetch();\n void connections.refetch();\n },\n };\n}\n\n/** The organization's provider inventory with its shared connections. */\nexport function useOrganizationDataIntegrations({\n enabled = true,\n}: { enabled?: boolean } = {}): ListResult<OrganizationDataIntegration> {\n const query = useClientGraphqlQuery({\n queryKey: organizationDataIntegrationsQueryKey,\n queryFn: listAllOrganizationDataProviders,\n select: (providers) => providers.map(toOrganizationDataIntegration),\n enabled,\n });\n return {\n data: query.data ?? [],\n isLoading: query.isLoading,\n isPending: query.isPending,\n isSuccess: query.isSuccess,\n isError: query.isError,\n error: query.error,\n failureCount: query.failureCount,\n refetch: () => {\n void query.refetch();\n },\n };\n}\n\n/** The organization's shared connections, readable by any active member. */\nexport function useSharedDataConnections(): ListResult<SharedDataConnection> {\n const query = useClientGraphqlQuery({\n queryKey: sharedDataConnectionsQueryKey,\n queryFn: listAllSharedDataProviders,\n select: (providers) => providers.map(toSharedDataConnection),\n });\n return {\n data: query.data ?? [],\n isLoading: query.isLoading,\n isPending: query.isPending,\n isSuccess: query.isSuccess,\n isError: query.isError,\n error: query.error,\n failureCount: query.failureCount,\n refetch: () => {\n void query.refetch();\n },\n };\n}\n\n/** The organization's policy configuration of each connectable provider. */\nexport function useDataIntegrationConfigurations({\n enabled = true,\n}: { enabled?: boolean } = {}): ListResult<DataIntegrationConfiguration> {\n const query = useClientGraphqlQuery({\n queryKey: dataIntegrationConfigurationsQueryKey,\n queryFn: listAllConfigurableDataProviders,\n select: (providers) => providers.map(toDataIntegrationConfiguration),\n enabled,\n });\n return {\n data: query.data ?? [],\n isLoading: query.isLoading,\n isPending: query.isPending,\n isSuccess: query.isSuccess,\n isError: query.isError,\n error: query.error,\n failureCount: query.failureCount,\n refetch: () => {\n void query.refetch();\n },\n };\n}\n\n/** Refreshes the member's own lists after one of their connections changed. */\nexport function useInvalidateMyDataIntegrations() {\n const queryClient = useQueryClient();\n return useCallback(() => {\n for (const queryKey of myDataIntegrationsQueryKeys) {\n queryClient.invalidateQueries({ queryKey });\n }\n }, [queryClient]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA+B;AAC/B,mBAA4B;AAoB5B,mBAGO;AAEP,MAAM,YAAY;AAMlB,eAAe,aACb,WAIc;AACd,QAAM,OAAY,CAAC;AACnB,MAAI,QAAuB;AAC3B,KAAG;AACD,UAAM,OAAO,MAAM,UAAU,KAAK;AAClC,SAAK,KAAK,GAAG,KAAK,IAAI;AACtB,YAAQ,KAAK,aAAa,SAAS;AAAA,EACrC,SAAS,UAAU;AACnB,SAAO;AACT;AAEA,SAAS,QACP,QACA,OACoB;AACpB,SAAO,OAAO,SAAS,KAAK;AAC9B;AAEA,MAAM,eAAe,CAAC,SAAS,WAAW,oBAAoB;AAC9D,MAAM,oBAAoB,CAAC,aAAa,uBAAuB;AAC/D,MAAM,iBAAiB,CAAC,aAAa,uBAAuB;AAC5D,MAAM,oBAAoB,CAAC,UAAU,UAAU,cAAc;AAC7D,MAAM,mBAAmB,CAAC,aAAa,cAAc;AACrD,MAAM,sBAAsB,CAAC,eAAe,cAAc;AAE1D,SAAS,cACP,aAC4D;AAC5D,SAAO,YAAY,OAAO,CAAC,WAAW,QAAQ,cAAc,MAAM,CAAC;AACrE;AAOA,SAAS,kBACP,iBACmD;AACnD,SAAO,QAAQ,mBAAmB,eAAe,IAC7C,kBACA;AACN;AAEA,SAAS,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A,EACF;AACF;AAGO,SAAS,iCAAiC;AAAA,EAC/C,UAAU;AACZ,IAA2B,CAAC,GAA6C;AACvE,QAAM,YAAQ,oCAAsB;AAAA,IAClC,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ,CAAC,cAAc,UAAU,IAAI,8BAA8B;AAAA,IACnE;AAAA,EACF,CAAC;AACD,SAAO;AAAA,IACL,MAAM,MAAM,QAAQ,CAAC;AAAA,IACrB,WAAW,MAAM;AAAA,IACjB,WAAW,MAAM;AAAA,IACjB,WAAW,MAAM;AAAA,IACjB,SAAS,MAAM;AAAA,IACf,OAAO,MAAM;AAAA,IACb,cAAc,MAAM;AAAA,IACpB,SAAS,MAAM;AACb,WAAK,MAAM,QAAQ;AAAA,IACrB;AAAA,EACF;AACF;AAGO,SAAS,kCAAkC;AAChD,QAAM,kBAAc,mCAAe;AACnC,aAAO,0BAAY,MAAM;AACvB,eAAW,YAAY,6BAA6B;AAClD,kBAAY,kBAAkB,EAAE,SAAS,CAAC;AAAA,IAC5C;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAClB;","names":[]}
@@ -1,7 +1,5 @@
1
- import { DataInstallation, DataIntegrationWithConnections, SharedDataConnection, DataIntegrationConfiguration, OrganizationDataIntegration } from '../../api/endpoint.cjs';
1
+ import { DataInstallation, DataIntegrationWithConnections, SharedDataConnection, DataIntegrationConfiguration, OrganizationDataIntegration } from './types.cjs';
2
2
  import { DataProviderConnectionFieldsFragment, DataProviderFieldsFragment, SharedDataProviderFieldsFragment, ConfigurableDataProviderFieldsFragment, OrganizationDataProviderFieldsFragment, Sdk } from '../../api/client-graphql/generated.cjs';
3
- import '@tanstack/react-query';
4
- import '../../api/widgets-api-client.cjs';
5
3
  import 'graphql-request';
6
4
 
7
5
  declare function toDataInstallation(connection: DataProviderConnectionFieldsFragment): DataInstallation;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/api/types.ts"],"sourcesContent":["// REST-shaped types kept as the public/internal contract of the widget hooks.\n// GraphQL responses are mapped onto these shapes in src/lib/api/*.ts.\n\nexport type CreateOrganizationApiKeyRequest = {\n name: string;\n permissions: string[];\n} & {\n /** @nullable */\n expiresAt?: string | null;\n};\n\nexport interface CreateOrganizationApiKeyResponse {\n id: string;\n value: string;\n obfuscatedValue: string;\n createdAt: string;\n name: string;\n permissions: string[];\n /** @nullable */\n expiresAt?: string | null;\n}\n\nexport type CreateUserApiKeyRequest = {\n name: string;\n permissions: string[];\n} & {\n /** @nullable */\n expiresAt?: string | null;\n};\n\nexport interface CreateUserApiKeyResponse {\n id: string;\n value: string;\n obfuscatedValue: string;\n createdAt: string;\n name: string;\n permissions: string[];\n /** @nullable */\n expiresAt?: string | null;\n}\n\nexport type DataInstallation = {\n object: \"data_installation\" | \"connected_account\";\n id: string;\n connection_role: \"compatibility\" | \"standard\";\n /** @nullable */\n account_identifier?: string | null;\n /** @nullable */\n account_display_name?: string | null;\n /** @nullable */\n user_id?: string | null;\n /** @nullable */\n organization_id?: string | null;\n scopes: string[];\n auth_method: \"oauth\" | \"api_key\" | \"client_credentials\";\n /** @nullable */\n api_key_last_4?: string | null;\n state: \"connected\" | \"needs_reauthorization\";\n created_at: string;\n updated_at: string;\n} & {\n /** @nullable */\n client_id?: string | null;\n /** @nullable */\n client_secret_last_4?: string | null;\n config?: { [key: string]: unknown };\n /** @nullable */\n userlandUserId?: string | null;\n /** @nullable */\n organizationId?: string | null;\n createdAt?: string;\n updatedAt?: string;\n};\n\nexport type DataIntegrationConfigField = {\n key: string;\n label: string;\n required: boolean;\n scope: \"integration\" | \"installation\";\n} & {\n description?: string;\n example?: string;\n pattern?: string;\n patternFlags?: string;\n order?: number;\n secret?: boolean;\n default?: string;\n};\n\nexport type DataIntegration = {\n object: \"data_integration\";\n id: string;\n name: string;\n /** @nullable */\n description?: string | null;\n slug: string;\n integrationType:\n | \"asana\"\n | \"attio\"\n | \"box\"\n | \"cal-dot-com\"\n | \"calendly\"\n | \"confluence\"\n | \"datadog\"\n | \"dropbox\"\n | \"frame-io\"\n | \"front\"\n | \"github\"\n | \"gitlab\"\n | \"gmail\"\n | \"gong\"\n | \"google\"\n | \"google-calendar\"\n | \"google-drive\"\n | \"helpscout\"\n | \"hubspot\"\n | \"intercom\"\n | \"intralinks\"\n | \"jira\"\n | \"linear\"\n | \"microsoft\"\n | \"microsoft-onedrive\"\n | \"microsoft-onenote\"\n | \"microsoft-outlook\"\n | \"microsoft-outlook-calendar\"\n | \"microsoft-sharepoint\"\n | \"microsoft-teams\"\n | \"microsoft-todo\"\n | \"notion\"\n | \"prefect\"\n | \"pydantic-logfire\"\n | \"quickbooks\"\n | \"salesforce\"\n | \"sentry\"\n | \"slack\"\n | \"snowflake\"\n | \"stripe\"\n | \"xero\"\n | \"zendesk\"\n | \"zoom\"\n | string;\n ownership: \"userland_user\" | \"organization\";\n credentialsType: \"shared\" | \"custom\" | \"organization\";\n scopes?: string[] | null;\n createdAt: string;\n updatedAt: string;\n installation?: DataInstallation | null;\n configFields: DataIntegrationConfigField[];\n config: { [key: string]: unknown };\n} & {\n iconSlug?: string;\n iconUrl?: string;\n iconDarkUrl?: string;\n authMethods?: (\"oauth\" | \"api_key\" | \"client_credentials\")[];\n};\n\nexport interface DataIntegrationCredentials {\n credentialsType: \"shared\" | \"custom\" | \"organization\";\n hasCredentials: boolean;\n /** @nullable */\n client_id?: string | null;\n /** @nullable */\n redactedClientSecret?: string | null;\n redirectUri: string;\n}\n\nexport type DataIntegrationConfigurationConfig = { [key: string]: unknown };\n\nexport interface DataIntegrationConfiguration {\n object: \"data_integration_configuration\";\n id: string;\n name: string;\n /** @nullable */\n description?: string | null;\n slug: string;\n integrationType: string;\n ownership: \"userland_user\" | \"organization\";\n enabled: boolean;\n scopes?: string[] | null;\n defaultScopes: string[];\n availableScopes: string[];\n credentials: DataIntegrationCredentials;\n authMethods: (\"oauth\" | \"api_key\" | \"client_credentials\")[];\n configFields: DataIntegrationConfigField[];\n config: DataIntegrationConfigurationConfig;\n createdAt: string;\n updatedAt: string;\n}\n\nexport type DataIntegrationWithConnections = DataIntegration & {\n connected_accounts: DataInstallation[];\n};\n\n/**\n * Pagination cursors for navigating between pages of results.\n */\nexport interface ListMetadata {\n /**\n * An object ID that defines your place in the list. When the ID is not present, you are at the start of the list.\n * @nullable\n */\n before: string | null;\n /**\n * An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.\n * @nullable\n */\n after: string | null;\n}\n\nexport interface ListOrganizationApiKeyPermission {\n id: string;\n slug: string;\n name: string;\n /** @nullable */\n description?: string | null;\n}\n\nexport type ListOrganizationApiKeyPermissionsParams = {\n search?: string;\n limit?: number;\n before?: string;\n after?: string;\n};\n\nexport type ListOrganizationApiKeyPermissionsResponseListMetadata = {\n before?: string;\n after?: string;\n};\n\nexport interface ListOrganizationApiKeyPermissionsResponse {\n data: ListOrganizationApiKeyPermission[];\n list_metadata: ListOrganizationApiKeyPermissionsResponseListMetadata;\n}\n\nexport interface ListOrganizationApiKeysResponseData {\n id: string;\n name: string;\n obfuscatedValue: string;\n createdAt: string;\n /** @nullable */\n lastUsedAt?: string | null;\n /** @nullable */\n expiresAt?: string | null;\n permissions: string[];\n}\n\nexport type ListOrganizationApiKeysResponseListMetadata = {\n before?: string;\n after?: string;\n};\n\nexport interface ListOrganizationApiKeysResponse {\n data: ListOrganizationApiKeysResponseData[];\n list_metadata: ListOrganizationApiKeysResponseListMetadata;\n}\n\nexport interface ListUserApiKeyPermission {\n id: string;\n slug: string;\n name: string;\n /** @nullable */\n description?: string | null;\n}\n\nexport type ListUserApiKeyPermissionsParams = {\n search?: string;\n limit?: number;\n before?: string;\n after?: string;\n};\n\nexport type ListUserApiKeysResponseDataOwner = {\n type: \"user\";\n id: string;\n email: string;\n /** @nullable */\n firstName?: string | null;\n /** @nullable */\n lastName?: string | null;\n displayName: string;\n};\n\nexport interface ListUserApiKeysResponseData {\n id: string;\n owner: ListUserApiKeysResponseDataOwner;\n name: string;\n obfuscatedValue: string;\n createdAt: string;\n /** @nullable */\n lastUsedAt?: string | null;\n /** @nullable */\n expiresAt?: string | null;\n permissions: string[];\n}\n\nexport type ListUserApiKeysResponseListMetadata = {\n before?: string;\n after?: string;\n};\n\nexport interface ListUserApiKeysResponse {\n data: ListUserApiKeysResponseData[];\n list_metadata: ListUserApiKeysResponseListMetadata;\n}\n\nexport type OrganizationDataIntegrationConfigurationConfig = {\n [key: string]: unknown;\n};\n\nexport interface OrganizationDataIntegrationConfiguration {\n hasOverride: boolean;\n rootEnabled: boolean;\n /** @nullable */\n overrideEnabled?: boolean | null;\n enabled: boolean;\n disabledSource?: \"developer\" | \"organization\" | null;\n scopes?: string[] | null;\n defaultScopes: string[];\n availableScopes: string[];\n credentials: DataIntegrationCredentials;\n configured: boolean;\n configFields: DataIntegrationConfigField[];\n config: OrganizationDataIntegrationConfigurationConfig;\n}\n\nexport interface OrganizationDataIntegrationCapabilities {\n canConfigure: boolean;\n canConnect: boolean;\n canUpdateCredentials: boolean;\n canReauthorize: boolean;\n canDisconnect: boolean;\n}\n\nexport type OrganizationDataIntegration = DataIntegration & {\n connected_accounts: DataInstallation[];\n configuration: OrganizationDataIntegrationConfiguration;\n capabilities: OrganizationDataIntegrationCapabilities;\n};\n\nexport interface SharedConnection {\n object: \"connected_account\";\n id: string;\n state: \"connected\" | \"needs_reauthorization\";\n availability: \"available\" | \"needs_admin_attention\";\n created_at: string;\n updated_at: string;\n}\n\nexport type SharedDataConnection = {\n object: \"data_integration\";\n id: string;\n name: string;\n /** @nullable */\n description?: string | null;\n slug: string;\n ownership: \"organization\";\n connected_accounts: SharedConnection[];\n} & {\n iconSlug?: string;\n iconUrl?: string;\n iconDarkUrl?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}