Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 36 additions & 83 deletions .github/scripts/compare-types/configs/firestore-pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,117 +19,62 @@

import type { PackageConfig } from '../src/types';


const config: PackageConfig = {
nameMapping: {},
missingInRN: [
{
name: 'arrayFilter',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayFirst',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayFirstN',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayIndexOf',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayIndexOfAll',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayLast',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayLastIndexOf',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayLastN',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayMaximum',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayMaximumN',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayMinimum',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayMinimumN',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arraySlice',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayTransform',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'arrayTransformWithIndex',
reason: 'Newer firebase-js-sdk array expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'coalesce',
reason: 'Newer firebase-js-sdk expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'currentDocument',
reason: 'Newer firebase-js-sdk document expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk document expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'documentMatches',
reason: 'Newer firebase-js-sdk document expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk document expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'geoDistance',
reason: 'Newer firebase-js-sdk geospatial expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk geospatial expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'ifNull',
reason: 'Newer firebase-js-sdk null-handling expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk null-handling expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'nor',
reason: 'Newer firebase-js-sdk boolean expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk boolean expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'score',
reason: 'Newer firebase-js-sdk search score expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk search score expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'subcollection',
reason: 'Newer firebase-js-sdk subcollection stage helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk subcollection stage helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'switchOn',
reason: 'Newer firebase-js-sdk conditional expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk conditional expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'timestampDiff',
reason: 'Newer firebase-js-sdk timestamp expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk timestamp expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'timestampExtract',
reason: 'Newer firebase-js-sdk timestamp expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'variable',
reason: 'Newer firebase-js-sdk variable expression helper not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk timestamp expression helper not yet exposed by RN Firebase pipelines.',
},
{
name: 'DefineStageOptions',
Expand All @@ -141,15 +86,18 @@ const config: PackageConfig = {
},
{
name: 'SearchStageOptions',
reason: 'Newer firebase-js-sdk search stage options type not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk search stage options type not yet exposed by RN Firebase pipelines.',
},
{
name: 'SubcollectionStageOptions',
reason: 'Newer firebase-js-sdk subcollection stage options type not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk subcollection stage options type not yet exposed by RN Firebase pipelines.',
},
{
name: 'TimePart',
reason: 'Newer firebase-js-sdk timestamp extraction type not yet exposed by RN Firebase pipelines.',
reason:
'Newer firebase-js-sdk timestamp extraction type not yet exposed by RN Firebase pipelines.',
},
{
name: 'TimeUnit',
Expand All @@ -159,25 +107,30 @@ const config: PackageConfig = {
extraInRN: [
{
name: 'Type',
reason: 'RN Firebase exposes a local type discriminator alias for pipeline expression helpers.',
reason:
'RN Firebase exposes a local type discriminator alias for pipeline expression helpers.',
},
],
differentShape: [
{
name: 'isType',
reason: 'RN Firebase accepts its local `Type` alias where the firebase-js-sdk declaration accepts a string.',
reason:
'RN Firebase accepts its local `Type` alias where the firebase-js-sdk declaration accepts a string.',
},
{
name: 'ExpressionType',
reason: 'RN Firebase has not yet exposed the newer firebase-js-sdk `Variable` and `PipelineValue` expression kinds.',
reason:
'RN Firebase has not yet exposed the newer firebase-js-sdk `PipelineValue` expression kind.',
},
{
name: 'StageOptions',
reason: 'Declaration formatting differs for the raw options object, but the public shape is equivalent.',
reason:
'Declaration formatting differs for the raw options object, but the public shape is equivalent.',
},
{
name: 'TimeGranularity',
reason: 'RN Firebase uses the existing `isoWeek` and `isoYear` casing while the firebase-js-sdk declaration includes lowercase variants.',
reason:
'RN Firebase uses the existing `isoWeek` and `isoYear` casing while the firebase-js-sdk declaration includes lowercase variants.',
},
],
};
Expand Down
18 changes: 18 additions & 0 deletions packages/firestore/__tests__/pipelines-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ const ANDROID_EXECUTOR_PATH = join(
ROOT,
'packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineParser.java',
);
const ANDROID_NODE_BUILDER_PATH = join(
ROOT,
'packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineNodeBuilder.java',
);
const IOS_EXECUTOR_PATH = join(
ROOT,
'packages/firestore/ios/RNFBFirestore/RNFBFirestorePipelineParser.swift',
);
const IOS_NODE_BUILDER_PATH = join(
ROOT,
'packages/firestore/ios/RNFBFirestore/RNFBFirestorePipelineNodeBuilder.swift',
);

function extractQuotedList(source: string, marker: string, endMarker: string): string[] {
const markerIndex = source.indexOf(marker);
Expand Down Expand Up @@ -79,4 +87,14 @@ describe('Firestore pipeline native parity', function () {
expect(iosSource).toContain('does not support options.rawOptions on iOS');
expect(iosSource).toContain('does not support pipeline.source.rawOptions');
});

it('keeps arrayFirst and arrayFirstN on native lowering paths', function () {
const androidSource = readFileSync(ANDROID_NODE_BUILDER_PATH, 'utf8');
const iosSource = readFileSync(IOS_NODE_BUILDER_PATH, 'utf8');

expect(androidSource).toContain('currentExpression.arrayFirst()');
expect(androidSource).toContain('arrayExpr.arrayFirstN');
expect(iosSource).toContain('"array_first"');
expect(iosSource).toContain('"array_first_n"');
});
});
4 changes: 3 additions & 1 deletion packages/firestore/__tests__/pipelines-web.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jest.mock('@react-native-firebase/app/dist/module/internal/web/firebaseFirestore
conditional: jest.fn(actual.conditional as (...args: unknown[]) => unknown),
isType: jest.fn(actual.isType as (...args: unknown[]) => unknown),
mapGet: jest.fn(actual.mapGet as (...args: unknown[]) => unknown),
variable: jest.fn(actual.variable as (...args: unknown[]) => unknown),
euclideanDistance: jest.fn(actual.euclideanDistance as (...args: unknown[]) => unknown),
};
});
Expand Down Expand Up @@ -70,7 +71,7 @@ describe('Firestore web pipeline bridge', function () {
exprType: 'Function',
name: 'greaterThan',
args: [
{ __kind: 'expression', exprType: 'Field', path: 'rating' },
{ __kind: 'expression', exprType: 'Variable', name: 'score' },
{ __kind: 'expression', exprType: 'Constant', value: 3 },
],
},
Expand Down Expand Up @@ -124,6 +125,7 @@ describe('Firestore web pipeline bridge', function () {
const whereArg = (pipelineInstance.where as jest.Mock).mock.calls[0][0] as any;
expect(whereArg).toBeDefined();
expect(whereArg.__kind).toBeUndefined();
expect(firebaseFirestorePipelines.variable).toHaveBeenCalledWith('score');

const selectArg = (pipelineInstance.select as jest.Mock).mock.calls[0][0] as any;
expect(selectArg).toBeDefined();
Expand Down
Loading
Loading