Skip to content

Commit 75bd9df

Browse files
committed
Resolve stale conflicts from #1153
This commit resolves faulty merge-conflicted code that did not take into account the changes from #1153.
1 parent b903593 commit 75bd9df

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

src/v1/cloud-functions.ts

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// SOFTWARE.
2222

2323
import { Request, Response } from 'express';
24-
import * as _ from 'lodash';
2524
import { warn } from '../logger';
2625
import {
2726
DEFAULT_FAILURE_POLICY,
@@ -202,95 +201,6 @@ export interface EventContext<Params = Record<string, string>> {
202201
timestamp: string;
203202
}
204203

205-
/**
206-
* The Functions interface for events that change state, such as
207-
* Realtime Database or Cloud Firestore `onWrite` and `onUpdate`.
208-
*
209-
* For more information about the format used to construct `Change` objects, see
210-
* [`cloud-functions.ChangeJson`](/docs/reference/functions/cloud_functions_.changejson).
211-
*
212-
*/
213-
export class Change<T> {
214-
constructor(public before: T, public after: T) {}
215-
}
216-
217-
/**
218-
* `ChangeJson` is the JSON format used to construct a Change object.
219-
*/
220-
export interface ChangeJson {
221-
/**
222-
* Key-value pairs representing state of data after the change.
223-
*/
224-
after?: any;
225-
/**
226-
* Key-value pairs representing state of data before the change. If
227-
* `fieldMask` is set, then only fields that changed are present in `before`.
228-
*/
229-
before?: any;
230-
/**
231-
* @hidden
232-
* Comma-separated string that represents names of fields that changed.
233-
*/
234-
fieldMask?: string;
235-
}
236-
237-
export namespace Change {
238-
/** @hidden */
239-
function reinterpretCast<T>(x: any) {
240-
return x as T;
241-
}
242-
243-
/**
244-
* @hidden
245-
* Factory method for creating a Change from a `before` object and an `after`
246-
* object.
247-
*/
248-
export function fromObjects<T>(before: T, after: T) {
249-
return new Change(before, after);
250-
}
251-
252-
/**
253-
* @hidden
254-
* Factory method for creating a Change from a JSON and an optional customizer
255-
* function to be applied to both the `before` and the `after` fields.
256-
*/
257-
export function fromJSON<T>(
258-
json: ChangeJson,
259-
customizer: (x: any) => T = reinterpretCast
260-
): Change<T> {
261-
let before = { ...json.before };
262-
if (json.fieldMask) {
263-
before = applyFieldMask(before, json.after, json.fieldMask);
264-
}
265-
266-
return Change.fromObjects(
267-
customizer(before || {}),
268-
customizer(json.after || {})
269-
);
270-
}
271-
272-
/** @hidden */
273-
export function applyFieldMask(
274-
sparseBefore: any,
275-
after: any,
276-
fieldMask: string
277-
) {
278-
const before = { ...after };
279-
const masks = fieldMask.split(',');
280-
281-
masks.forEach((mask) => {
282-
const val = _.get(sparseBefore, mask);
283-
if (typeof val === 'undefined') {
284-
_.unset(before, mask);
285-
} else {
286-
_.set(before, mask, val);
287-
}
288-
});
289-
290-
return before;
291-
}
292-
}
293-
294204
/**
295205
* Resource is a standard format for defining a resource
296206
* (google.rpc.context.AttributeContext.Resource). In Cloud Functions, it is the

0 commit comments

Comments
 (0)