@powersync/service-core 0.0.0-dev-20261007110800 → 0.0.0-dev-20261015132441

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.
@@ -1,42 +0,0 @@
1
- import type { RouteAPI } from '@/api/RouteAPI.js';
2
- import { assertSourceCapabilities, validateNoMongoFilterExpressions } from '@/api/source-capabilities.js';
3
- import { SqlSyncRules } from '@powersync/service-sync-rules';
4
- import { describe, expect, test } from 'vitest';
5
-
6
- const FILTERED_CONFIG = /* yaml */ `
7
- # Sync config fixture.
8
- config:
9
- edition: 3
10
- source_table_options:
11
- orders:
12
- mongodb_filter_expression: { $eq: ['$$doc.active', true] }
13
- streams:
14
- orders:
15
- query: SELECT * FROM orders
16
- `;
17
-
18
- describe('unsupported MongoDB source options', () => {
19
- test('blocks deployment when a non-MongoDB source uses filtering', async () => {
20
- const { config } = SqlSyncRules.fromYaml(FILTERED_CONFIG, { defaultSchema: 'public' });
21
- const adapter = {
22
- async validateSourceCapabilities(config) {
23
- return validateNoMongoFilterExpressions(config, 'default');
24
- }
25
- } satisfies Pick<RouteAPI, 'validateSourceCapabilities'>;
26
- await expect(assertSourceCapabilities(adapter as unknown as RouteAPI, config)).rejects.toThrow(
27
- 'only supported by MongoDB sources'
28
- );
29
- });
30
-
31
- test('ignores options for a different connection', () => {
32
- const { config } = SqlSyncRules.fromYaml(FILTERED_CONFIG, { defaultSchema: 'public' });
33
- expect(validateNoMongoFilterExpressions(config, 'other')).toEqual([]);
34
- });
35
-
36
- test('allows disabled filtering', () => {
37
- const { config } = SqlSyncRules.fromYaml(FILTERED_CONFIG.replace("{ $eq: ['$$doc.active', true] }", 'disabled'), {
38
- defaultSchema: 'public'
39
- });
40
- expect(validateNoMongoFilterExpressions(config, 'default')).toEqual([]);
41
- });
42
- });