mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-01 08:59:39 +02:00
feat(ingest): route direct-write connectors through isolated diffs
This commit is contained in:
parent
a00285fd42
commit
449db1d42a
4 changed files with 91 additions and 1 deletions
|
|
@ -0,0 +1,40 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
defaultIsolatedDiffSourceKeys,
|
||||
isIsolatedDiffDirectWriteSourceKey,
|
||||
ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS,
|
||||
} from './source-routing.js';
|
||||
|
||||
describe('isolated-diff source routing', () => {
|
||||
it('keeps the runner-owned direct-write connector list explicit', () => {
|
||||
expect(ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS).toEqual([
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns a mutable copy for runtime settings', () => {
|
||||
const keys = defaultIsolatedDiffSourceKeys();
|
||||
keys.push('fake');
|
||||
|
||||
expect(defaultIsolatedDiffSourceKeys()).toEqual([
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
]);
|
||||
});
|
||||
|
||||
it('recognizes migrated connector source keys only', () => {
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('notion')).toBe(true);
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('metricflow')).toBe(true);
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('historic-sql')).toBe(false);
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('live-database')).toBe(false);
|
||||
});
|
||||
});
|
||||
22
packages/context/src/ingest/isolated-diff/source-routing.ts
Normal file
22
packages/context/src/ingest/isolated-diff/source-routing.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export const ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS = [
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
] as const;
|
||||
|
||||
export type IsolatedDiffDirectWriteSourceKey = (typeof ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS)[number];
|
||||
|
||||
const ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEY_SET = new Set<string>(ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS);
|
||||
|
||||
export function defaultIsolatedDiffSourceKeys(): string[] {
|
||||
return [...ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS];
|
||||
}
|
||||
|
||||
export function isIsolatedDiffDirectWriteSourceKey(
|
||||
sourceKey: string,
|
||||
): sourceKey is IsolatedDiffDirectWriteSourceKey {
|
||||
return ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEY_SET.has(sourceKey);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue