Skip to content

Commit 3a9e7f0

Browse files
committed
fixed imports
Signed-off-by: RAWx18 <rawx18.dev@gmail.com>
1 parent 02e7812 commit 3a9e7f0

File tree

1 file changed

+36
-9
lines changed
  • services/libs/integrations/src/integrations

1 file changed

+36
-9
lines changed

services/libs/integrations/src/integrations/index.ts

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,44 @@ export * from './github/memberAttributes'
2323
export * from './hackernews/grid'
2424
export * from './hackernews/types'
2525
export * from './hackernews/memberAttributes'
26+
export * from './hackernews/grid'
27+
export * from './hackernews/types'
28+
export * from './hackernews/memberAttributes'
29+
30+
// Premium integrations are optional in community edition. Attempt to load
31+
// them only if the module files exist; silently skip when missing.
32+
const tryExport = (p: string) => {
33+
try {
34+
// Use require to load at runtime; merge into exports for compatibility
35+
// with existing `export *` usage.
36+
// eslint-disable-next-line @typescript-eslint/no-var-requires
37+
const mod = require(p)
38+
if (mod) {
39+
Object.keys(mod).forEach(k => {
40+
// @ts-ignore
41+
exports[k] = mod[k]
42+
})
43+
}
44+
} catch (err: any) {
45+
if (err && err.code && err.code === 'MODULE_NOT_FOUND') {
46+
// module absent — skip silently for community edition
47+
return
48+
}
49+
// rethrow unexpected errors
50+
throw err
51+
}
52+
}
2653

27-
export * from './premium/linkedin/grid'
28-
export * from './premium/linkedin/types'
29-
export * from './premium/linkedin/memberAttributes'
54+
tryExport('./premium/linkedin/grid')
55+
tryExport('./premium/linkedin/types')
56+
tryExport('./premium/linkedin/memberAttributes')
3057

31-
export * from './premium/hubspot/types'
32-
export * from './premium/hubspot/api/types'
33-
export * from './premium/hubspot/field-mapper/mapperFactory'
34-
export { getProperties as getHubspotProperties } from './premium/hubspot/api/properties'
35-
export { getTokenInfo as getHubspotTokenInfo } from './premium/hubspot/api/tokenInfo'
36-
export { getLists as getHubspotLists } from './premium/hubspot/api/lists'
58+
tryExport('./premium/hubspot/types')
59+
tryExport('./premium/hubspot/api/types')
60+
tryExport('./premium/hubspot/field-mapper/mapperFactory')
61+
tryExport('./premium/hubspot/api/properties')
62+
tryExport('./premium/hubspot/api/tokenInfo')
63+
tryExport('./premium/hubspot/api/lists')
3764

3865
export * from './reddit/grid'
3966
export * from './reddit/types'

0 commit comments

Comments
 (0)