@superblocksteam/shared 0.9546.8 → 0.9547.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/socket/protocol.d.ts +10 -1
  2. package/dist/socket/protocol.d.ts.map +1 -1
  3. package/dist/socket/protocol.js.map +1 -1
  4. package/dist/types/datasource/auth.d.ts +7 -1
  5. package/dist/types/datasource/auth.d.ts.map +1 -1
  6. package/dist/types/datasource/auth.js +21 -1
  7. package/dist/types/datasource/auth.js.map +1 -1
  8. package/dist/types/datasource/index.d.ts +14 -0
  9. package/dist/types/datasource/index.d.ts.map +1 -1
  10. package/dist/types/datasource/index.js +36 -2
  11. package/dist/types/datasource/index.js.map +1 -1
  12. package/dist/types/datasource/index.test.d.ts +2 -0
  13. package/dist/types/datasource/index.test.d.ts.map +1 -0
  14. package/dist/types/datasource/index.test.js +421 -0
  15. package/dist/types/datasource/index.test.js.map +1 -0
  16. package/dist/types/lock/index.d.ts +8 -0
  17. package/dist/types/lock/index.d.ts.map +1 -1
  18. package/dist/types/plugin/integration.d.ts +2 -1
  19. package/dist/types/plugin/integration.d.ts.map +1 -1
  20. package/dist/types/plugin/integration.js +3 -1
  21. package/dist/types/plugin/integration.js.map +1 -1
  22. package/dist-esm/socket/protocol.d.ts +10 -1
  23. package/dist-esm/socket/protocol.d.ts.map +1 -1
  24. package/dist-esm/socket/protocol.js.map +1 -1
  25. package/dist-esm/types/datasource/auth.d.ts +7 -1
  26. package/dist-esm/types/datasource/auth.d.ts.map +1 -1
  27. package/dist-esm/types/datasource/auth.js +20 -0
  28. package/dist-esm/types/datasource/auth.js.map +1 -1
  29. package/dist-esm/types/datasource/index.d.ts +14 -0
  30. package/dist-esm/types/datasource/index.d.ts.map +1 -1
  31. package/dist-esm/types/datasource/index.js +33 -1
  32. package/dist-esm/types/datasource/index.js.map +1 -1
  33. package/dist-esm/types/datasource/index.test.d.ts +2 -0
  34. package/dist-esm/types/datasource/index.test.d.ts.map +1 -0
  35. package/dist-esm/types/datasource/index.test.js +419 -0
  36. package/dist-esm/types/datasource/index.test.js.map +1 -0
  37. package/dist-esm/types/lock/index.d.ts +8 -0
  38. package/dist-esm/types/lock/index.d.ts.map +1 -1
  39. package/dist-esm/types/plugin/integration.d.ts +2 -1
  40. package/dist-esm/types/plugin/integration.d.ts.map +1 -1
  41. package/dist-esm/types/plugin/integration.js +3 -1
  42. package/dist-esm/types/plugin/integration.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/socket/protocol.ts +3 -0
  45. package/src/types/datasource/auth.ts +21 -1
  46. package/src/types/datasource/index.test.ts +499 -0
  47. package/src/types/datasource/index.ts +45 -1
  48. package/src/types/lock/index.ts +9 -0
  49. package/src/types/plugin/integration.ts +4 -2
@@ -253,7 +253,51 @@ export type AuthenticatedDatasourceConfig = BaseDatasourceConfiguration & {
253
253
  };
254
254
 
255
255
  export function isAuthenticatedDatasourceConfig(dc: DatasourceConfiguration): dc is AuthenticatedDatasourceConfig {
256
- return 'authConfig' in dc && 'authType' in dc;
256
+ if (!('authConfig' in dc)) {
257
+ return false;
258
+ }
259
+
260
+ return 'authType' in dc && dc.authType !== undefined;
261
+ }
262
+
263
+ export type AuthenticatedDatasourceConfigWithDynamicAuthType = BaseDatasourceConfiguration & {
264
+ authConfig?: AuthConfig;
265
+ authTypeField: string;
266
+ [key: string]: string | AuthConfig | undefined;
267
+ };
268
+
269
+ export function isAuthenticatedDatasourceConfigWithDynamicAuthType(
270
+ dc: DatasourceConfiguration
271
+ ): dc is AuthenticatedDatasourceConfigWithDynamicAuthType {
272
+ if (!('authConfig' in dc)) {
273
+ return false;
274
+ }
275
+ if (
276
+ 'authTypeField' in dc &&
277
+ dc.authTypeField &&
278
+ dc[dc.authTypeField] !== undefined &&
279
+ dc[dc.authTypeField] !== null &&
280
+ dc[dc.authTypeField] !== ''
281
+ ) {
282
+ return true;
283
+ }
284
+ return false;
285
+ }
286
+
287
+ /**
288
+ * Safely extracts the authType from an authenticated datasource configuration.
289
+ * This function handles both direct authType fields and authTypeField references.
290
+ *
291
+ * @param dc - The datasource configuration
292
+ * @returns The authType if available, undefined otherwise
293
+ */
294
+ export function getAuthTypeFromConfig(dc: DatasourceConfiguration): AuthType | undefined {
295
+ if (isAuthenticatedDatasourceConfig(dc)) {
296
+ return dc.authType;
297
+ } else if (isAuthenticatedDatasourceConfigWithDynamicAuthType(dc)) {
298
+ return dc[dc.authTypeField] as AuthType;
299
+ }
300
+ return undefined;
257
301
  }
258
302
 
259
303
  export type GraphQLDatasourceConfiguration = AuthenticatedHttpDatasourceConfig & {
@@ -11,3 +11,12 @@ export interface AppBranchLock {
11
11
  export interface GetAppBranchLockResponseBody {
12
12
  appBranchLock: AppBranchLock[];
13
13
  }
14
+
15
+ export interface LockInfo {
16
+ isUserActive: boolean;
17
+ ownerEmail: string;
18
+ ownerName: string;
19
+ lockLifetimeMs: number;
20
+ timeSinceLastActivityMs: number | null;
21
+ canForceTakeover: boolean;
22
+ }
@@ -46,7 +46,8 @@ export enum ExtendedIntegrationPluginId {
46
46
  OPENAI_V2 = 'openai_v2',
47
47
  // Not native OpenAPI-backed integrations, but leveraging the same auth system
48
48
  GOOGLE_SHEETS_PLUGIN_ID = 'gsheets',
49
- SNOWFLAKE = 'snowflake'
49
+ SNOWFLAKE = 'snowflake',
50
+ DATABRICKS = 'databricks'
50
51
  }
51
52
 
52
53
  // Note that we cannot import the plugins themselves to reference the id as
@@ -121,7 +122,8 @@ export const extendsAnyApiIntegrationPlugin = (pluginId = ''): boolean => {
121
122
  return (
122
123
  getBasePluginId(pluginId) === ExtendedIntegrationPluginId.REST_API ||
123
124
  pluginId === ExtendedIntegrationPluginId.GRAPHQL ||
124
- pluginId === ExtendedIntegrationPluginId.SNOWFLAKE
125
+ pluginId === ExtendedIntegrationPluginId.SNOWFLAKE ||
126
+ pluginId === ExtendedIntegrationPluginId.DATABRICKS
125
127
  );
126
128
  };
127
129