Skip to content

Used Trust Types When API is available for gtag URL creation #7052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4cf1388
Initial fix for Trusted Types failures
dwyfrequency Feb 22, 2023
9222f5e
Add Trusted-Types
dwyfrequency Feb 22, 2023
ac387ac
Sanitize input
dwyfrequency Feb 22, 2023
53781ab
Add check for gtag url and log error if not found
dwyfrequency Feb 27, 2023
6c30bd6
Add test and exported function
dwyfrequency Mar 8, 2023
39a6958
Add changeset
dwyfrequency Mar 9, 2023
86c0f2c
Update comment
dwyfrequency Mar 9, 2023
516a70d
Merge branch 'master' into jd-trusted-types-7048
dwyfrequency Mar 12, 2023
dc7b7f1
Created function to create policy
dwyfrequency Mar 21, 2023
80ae05e
Stub logger instead of console.log
dwyfrequency Mar 21, 2023
ff564c7
Remove returns keyword in function docstring
dwyfrequency Mar 22, 2023
5316071
Updated the changeset for OR queries to be more descriptive (#7121)
MarkDuckworth Mar 14, 2023
cc82816
New way to config Firestore SDK Cache. (#7015)
wu-hui Mar 15, 2023
f8437f5
Enable bundle spec tests for ios (#7096)
wu-hui Mar 15, 2023
715ee9b
Add a TODO (#7103)
wu-hui Mar 15, 2023
8bad12d
Change _fail to use NETWORK_REQUEST_FAILED (#7125)
NhienLam Mar 16, 2023
1794678
firestore: verify DOMException exists before using it in when base64 …
dconeybe Mar 16, 2023
c3f3f61
Version Packages (#7123)
google-oss-bot Mar 16, 2023
54035e6
remove gapi.auth fall back option for getAuthToken() (#7100)
milaGGL Mar 17, 2023
e755eae
Update dependency simple-git to v3.16.0 [SECURITY] (#6986)
renovate[bot] Mar 17, 2023
f8334ae
Update dependency webpack to v5.76.0 [SECURITY] (#7127)
renovate[bot] Mar 17, 2023
be8b265
chore(deps): update endbug/add-and-commit action to v9 (#6425)
renovate[bot] Mar 17, 2023
cc3c93a
Add changeset (#7137)
hsubox76 Mar 20, 2023
b26c072
Firestore: query.test.ts: add a test that resumes a query with existe…
dconeybe Mar 20, 2023
8a1f7a4
Unmangle a switch variable for Closure (#7136)
hsubox76 Mar 21, 2023
ee6cc36
Remove dependency merge conflicts.
dwyfrequency Feb 22, 2023
62f0a42
Remove duplicate types package
dwyfrequency Mar 23, 2023
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
6 changes: 6 additions & 0 deletions .changeset/brown-beers-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@firebase/firestore": minor
"firebase": minor
---

Introduces a new way to config Firestore SDK Cache.
6 changes: 0 additions & 6 deletions .changeset/chilled-buckets-sneeze.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fluffy-seas-behave.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/friendly-ads-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/firestore': patch
'firebase': patch
---

Check that DOMException exists before referencing it, to fix react-native, which was broken by https://github.com/firebase/firebase-js-sdk/pull/7019 in v9.17.2.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
'firebase': patch
---

Improved debug logging of networking abstractions
Remove the deprecated gapi.auth from FirstPartyToken.
5 changes: 5 additions & 0 deletions .changeset/sixty-buckets-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/auth': patch
---

Modify \_fail to use AuthErrorCode.NETWORK_REQUEST_FAILED
6 changes: 0 additions & 6 deletions .changeset/sweet-rats-compete.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/tasty-cooks-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/analytics': patch
---

Use the Trusted Types API when composing the gtag URL.
2 changes: 1 addition & 1 deletion .github/workflows/update-api-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: yarn build
id: update-api-reports
- name: Commit & Push changes
uses: EndBug/add-and-commit@v7
uses: EndBug/add-and-commit@v9
with:
add: 'common/api-review/*'
message: 'Update API reports'
Expand Down
58 changes: 56 additions & 2 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ export class DocumentSnapshot<T = DocumentData> {

export { EmulatorMockTokenOptions }

// @public
// @public @deprecated
export function enableIndexedDbPersistence(firestore: Firestore, persistenceSettings?: PersistenceSettings): Promise<void>;

// @public
// @public @deprecated
export function enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;

// @public
Expand Down Expand Up @@ -219,13 +219,17 @@ export class FirestoreError extends FirebaseError {
// @public
export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';

// @public
export type FirestoreLocalCache = MemoryLocalCache | PersistentLocalCache;

// @public
export interface FirestoreSettings {
cacheSizeBytes?: number;
experimentalAutoDetectLongPolling?: boolean;
experimentalForceLongPolling?: boolean;
host?: string;
ignoreUndefinedProperties?: boolean;
localCache?: FirestoreLocalCache;
ssl?: boolean;
}

Expand Down Expand Up @@ -327,6 +331,15 @@ export interface LoadBundleTaskProgress {

export { LogLevel }

// @public
export interface MemoryLocalCache {
// (undocumented)
kind: 'memory';
}

// @public
export function memoryLocalCache(): MemoryLocalCache;

// @public
export function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;

Expand Down Expand Up @@ -404,6 +417,47 @@ export interface PersistenceSettings {
forceOwnership?: boolean;
}

// @public
export interface PersistentCacheSettings {
cacheSizeBytes?: number;
tabManager?: PersistentTabManager;
}

// @public
export interface PersistentLocalCache {
// (undocumented)
kind: 'persistent';
}

// @public
export function persistentLocalCache(settings?: PersistentCacheSettings): PersistentLocalCache;

// @public
export interface PersistentMultipleTabManager {
// (undocumented)
kind: 'PersistentMultipleTab';
}

// @public
export function persistentMultipleTabManager(): PersistentMultipleTabManager;

// @public
export interface PersistentSingleTabManager {
// (undocumented)
kind: 'persistentSingleTab';
}

// @public
export function persistentSingleTabManager(settings: PersistentSingleTabManagerSettings | undefined): PersistentSingleTabManager;

// @public
export interface PersistentSingleTabManagerSettings {
forceOwnership?: boolean;
}

// @public
export type PersistentTabManager = PersistentSingleTabManager | PersistentMultipleTabManager;

// @public
export type Primitive = string | number | boolean | undefined | null;

Expand Down
19 changes: 18 additions & 1 deletion docs-devsite/firestore_.firestoresettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ export declare interface FirestoreSettings

| Property | Type | Description |
| --- | --- | --- |
| [cacheSizeBytes](./firestore_.firestoresettings.md#firestoresettingscachesizebytes) | number | An approximate cache size threshold for the on-disk data. If the cache grows beyond this size, Firestore will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.<!-- -->The default value is 40 MB. The threshold must be set to at least 1 MB, and can be set to <code>CACHE_SIZE_UNLIMITED</code> to disable garbage collection. |
| [cacheSizeBytes](./firestore_.firestoresettings.md#firestoresettingscachesizebytes) | number | NOTE: This field will be deprecated in a future major release. Use <code>cache</code> field instead to specify cache size, and other cache configurations.<!-- -->An approximate cache size threshold for the on-disk data. If the cache grows beyond this size, Firestore will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.<!-- -->The default value is 40 MB. The threshold must be set to at least 1 MB, and can be set to <code>CACHE_SIZE_UNLIMITED</code> to disable garbage collection. |
| [experimentalAutoDetectLongPolling](./firestore_.firestoresettings.md#firestoresettingsexperimentalautodetectlongpolling) | boolean | Configures the SDK's underlying transport (WebChannel) to automatically detect if long-polling should be used. This is very similar to <code>experimentalForceLongPolling</code>, but only uses long-polling if required.<!-- -->This setting will likely be enabled by default in future releases and cannot be combined with <code>experimentalForceLongPolling</code>. |
| [experimentalForceLongPolling](./firestore_.firestoresettings.md#firestoresettingsexperimentalforcelongpolling) | boolean | Forces the SDK’s underlying network transport (WebChannel) to use long-polling. Each response from the backend will be closed immediately after the backend sends data (by default responses are kept open in case the backend has more data to send). This avoids incompatibility issues with certain proxies, antivirus software, etc. that incorrectly buffer traffic indefinitely. Use of this option will cause some performance degradation though.<!-- -->This setting cannot be used with <code>experimentalAutoDetectLongPolling</code> and may be removed in a future release. If you find yourself using it to work around a specific network reliability issue, please tell us about it in https://github.com/firebase/firebase-js-sdk/issues/1674. |
| [host](./firestore_.firestoresettings.md#firestoresettingshost) | string | The hostname to connect to. |
| [ignoreUndefinedProperties](./firestore_.firestoresettings.md#firestoresettingsignoreundefinedproperties) | boolean | Whether to skip nested properties that are set to <code>undefined</code> during object serialization. If set to <code>true</code>, these properties are skipped and not written to Firestore. If set to <code>false</code> or omitted, the SDK throws an exception when it encounters properties of type <code>undefined</code>. |
| [localCache](./firestore_.firestoresettings.md#firestoresettingslocalcache) | [FirestoreLocalCache](./firestore_.md#firestorelocalcache) | Specifies the cache used by the SDK. Availabe options are <code>MemoryLocalCache</code> and <code>IndexedDbLocalCache</code>, each with different configuration options.<!-- -->When unspecified, <code>MemoryLocalCache</code> will be used by default.<!-- -->NOTE: setting this field and <code>cacheSizeBytes</code> at the same time will throw exception during SDK initialization. Instead, using the configuration in the <code>FirestoreLocalCache</code> object to specify the cache size. |
| [ssl](./firestore_.firestoresettings.md#firestoresettingsssl) | boolean | Whether to use SSL when connecting. |

## FirestoreSettings.cacheSizeBytes

NOTE: This field will be deprecated in a future major release. Use `cache` field instead to specify cache size, and other cache configurations.

An approximate cache size threshold for the on-disk data. If the cache grows beyond this size, Firestore will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.

The default value is 40 MB. The threshold must be set to at least 1 MB, and can be set to `CACHE_SIZE_UNLIMITED` to disable garbage collection.
Expand Down Expand Up @@ -85,6 +88,20 @@ Whether to skip nested properties that are set to `undefined` during object seri
ignoreUndefinedProperties?: boolean;
```

## FirestoreSettings.localCache

Specifies the cache used by the SDK. Availabe options are `MemoryLocalCache` and `IndexedDbLocalCache`<!-- -->, each with different configuration options.

When unspecified, `MemoryLocalCache` will be used by default.

NOTE: setting this field and `cacheSizeBytes` at the same time will throw exception during SDK initialization. Instead, using the configuration in the `FirestoreLocalCache` object to specify the cache size.

<b>Signature:</b>

```typescript
localCache?: FirestoreLocalCache;
```

## FirestoreSettings.ssl

Whether to use SSL when connecting.
Expand Down
Loading