link
This commit is contained in:
4
node_modules/firebase-functions/lib/common/utilities/encoder.d.ts
generated
vendored
Normal file
4
node_modules/firebase-functions/lib/common/utilities/encoder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare function dateToTimestampProto(timeString?: string): {
|
||||
seconds: number;
|
||||
nanos: number;
|
||||
};
|
||||
39
node_modules/firebase-functions/lib/common/utilities/encoder.js
generated
vendored
Normal file
39
node_modules/firebase-functions/lib/common/utilities/encoder.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2017 Firebase
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dateToTimestampProto = void 0;
|
||||
function dateToTimestampProto(timeString) {
|
||||
if (typeof timeString === "undefined") {
|
||||
return;
|
||||
}
|
||||
const date = new Date(timeString);
|
||||
const seconds = Math.floor(date.getTime() / 1000);
|
||||
let nanos = 0;
|
||||
if (timeString.length > 20) {
|
||||
const nanoString = timeString.substring(20, timeString.length - 1);
|
||||
const trailingZeroes = 9 - nanoString.length;
|
||||
nanos = parseInt(nanoString, 10) * Math.pow(10, trailingZeroes);
|
||||
}
|
||||
return { seconds, nanos };
|
||||
}
|
||||
exports.dateToTimestampProto = dateToTimestampProto;
|
||||
1
node_modules/firebase-functions/lib/common/utilities/path-pattern.d.ts
generated
vendored
Normal file
1
node_modules/firebase-functions/lib/common/utilities/path-pattern.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
143
node_modules/firebase-functions/lib/common/utilities/path-pattern.js
generated
vendored
Normal file
143
node_modules/firebase-functions/lib/common/utilities/path-pattern.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2022 Firebase
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PathPattern = exports.trimParam = void 0;
|
||||
const path_1 = require("./path");
|
||||
/** https://cloud.google.com/eventarc/docs/path-patterns */
|
||||
/** @hidden */
|
||||
const WILDCARD_CAPTURE_REGEX = new RegExp("{[^/{}]+}", "g");
|
||||
/** @internal */
|
||||
function trimParam(param) {
|
||||
const paramNoBraces = param.slice(1, -1);
|
||||
if (paramNoBraces.includes("=")) {
|
||||
return paramNoBraces.slice(0, paramNoBraces.indexOf("="));
|
||||
}
|
||||
return paramNoBraces;
|
||||
}
|
||||
exports.trimParam = trimParam;
|
||||
/** @hidden */
|
||||
class Segment {
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
this.name = "segment";
|
||||
this.trimmed = value;
|
||||
}
|
||||
isSingleSegmentWildcard() {
|
||||
return this.value.includes("*") && !this.isMultiSegmentWildcard();
|
||||
}
|
||||
isMultiSegmentWildcard() {
|
||||
return this.value.includes("**");
|
||||
}
|
||||
}
|
||||
/** @hidden */
|
||||
class SingleCaptureSegment {
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
this.name = "single-capture";
|
||||
this.trimmed = trimParam(value);
|
||||
}
|
||||
isSingleSegmentWildcard() {
|
||||
return true;
|
||||
}
|
||||
isMultiSegmentWildcard() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/** @hidden */
|
||||
class MultiCaptureSegment {
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
this.name = "multi-capture";
|
||||
this.trimmed = trimParam(value);
|
||||
}
|
||||
isSingleSegmentWildcard() {
|
||||
return false;
|
||||
}
|
||||
isMultiSegmentWildcard() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implements Eventarc's path pattern from the spec https://cloud.google.com/eventarc/docs/path-patterns
|
||||
* @internal
|
||||
*/
|
||||
class PathPattern {
|
||||
/** @throws on validation error */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
static compile(rawPath) {
|
||||
return undefined;
|
||||
}
|
||||
constructor(raw) {
|
||||
this.raw = raw;
|
||||
this.segments = [];
|
||||
this.initPathSegments(raw);
|
||||
}
|
||||
getValue() {
|
||||
return this.raw;
|
||||
}
|
||||
// If false, we don't need to use pathPattern as our eventarc match type.
|
||||
hasWildcards() {
|
||||
return this.segments.some((segment) => segment.isSingleSegmentWildcard() || segment.isMultiSegmentWildcard());
|
||||
}
|
||||
hasCaptures() {
|
||||
return this.segments.some((segment) => segment.name === "single-capture" || segment.name === "multi-capture");
|
||||
}
|
||||
extractMatches(path) {
|
||||
const matches = {};
|
||||
if (!this.hasCaptures()) {
|
||||
return matches;
|
||||
}
|
||||
const pathSegments = (0, path_1.pathParts)(path);
|
||||
let pathNdx = 0;
|
||||
for (let segmentNdx = 0; segmentNdx < this.segments.length && pathNdx < pathSegments.length; segmentNdx++) {
|
||||
const segment = this.segments[segmentNdx];
|
||||
const remainingSegments = this.segments.length - 1 - segmentNdx;
|
||||
const nextPathNdx = pathSegments.length - remainingSegments;
|
||||
if (segment.name === "single-capture") {
|
||||
matches[segment.trimmed] = pathSegments[pathNdx];
|
||||
}
|
||||
else if (segment.name === "multi-capture") {
|
||||
matches[segment.trimmed] = pathSegments.slice(pathNdx, nextPathNdx).join("/");
|
||||
}
|
||||
pathNdx = segment.isMultiSegmentWildcard() ? nextPathNdx : pathNdx + 1;
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
initPathSegments(raw) {
|
||||
const parts = (0, path_1.pathParts)(raw);
|
||||
for (const part of parts) {
|
||||
let segment;
|
||||
const capture = part.match(WILDCARD_CAPTURE_REGEX);
|
||||
if (capture && capture.length === 1) {
|
||||
segment = part.includes("**")
|
||||
? new MultiCaptureSegment(part)
|
||||
: new SingleCaptureSegment(part);
|
||||
}
|
||||
else {
|
||||
segment = new Segment(part);
|
||||
}
|
||||
this.segments.push(segment);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.PathPattern = PathPattern;
|
||||
19
node_modules/firebase-functions/lib/common/utilities/path.d.ts
generated
vendored
Normal file
19
node_modules/firebase-functions/lib/common/utilities/path.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/** @hidden
|
||||
* Removes leading and trailing slashes from a path.
|
||||
*
|
||||
* @param path A path to normalize, in POSIX format.
|
||||
*/
|
||||
export declare function normalizePath(path: string): string;
|
||||
/**
|
||||
* Normalizes a given path and splits it into an array of segments.
|
||||
*
|
||||
* @param path A path to split, in POSIX format.
|
||||
*/
|
||||
export declare function pathParts(path: string): string[];
|
||||
/**
|
||||
* Normalizes given paths and joins these together using a POSIX separator.
|
||||
*
|
||||
* @param base A first path segment, in POSIX format.
|
||||
* @param child A second path segment, in POSIX format.
|
||||
*/
|
||||
export declare function joinPath(base: string, child: string): string;
|
||||
37
node_modules/firebase-functions/lib/common/utilities/path.js
generated
vendored
Normal file
37
node_modules/firebase-functions/lib/common/utilities/path.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.joinPath = exports.pathParts = exports.normalizePath = void 0;
|
||||
/** @hidden
|
||||
* Removes leading and trailing slashes from a path.
|
||||
*
|
||||
* @param path A path to normalize, in POSIX format.
|
||||
*/
|
||||
function normalizePath(path) {
|
||||
if (!path) {
|
||||
return "";
|
||||
}
|
||||
return path.replace(/^\//, "").replace(/\/$/, "");
|
||||
}
|
||||
exports.normalizePath = normalizePath;
|
||||
/**
|
||||
* Normalizes a given path and splits it into an array of segments.
|
||||
*
|
||||
* @param path A path to split, in POSIX format.
|
||||
*/
|
||||
function pathParts(path) {
|
||||
if (!path || path === "" || path === "/") {
|
||||
return [];
|
||||
}
|
||||
return normalizePath(path).split("/");
|
||||
}
|
||||
exports.pathParts = pathParts;
|
||||
/**
|
||||
* Normalizes given paths and joins these together using a POSIX separator.
|
||||
*
|
||||
* @param base A first path segment, in POSIX format.
|
||||
* @param child A second path segment, in POSIX format.
|
||||
*/
|
||||
function joinPath(base, child) {
|
||||
return pathParts(base).concat(pathParts(child)).join("/");
|
||||
}
|
||||
exports.joinPath = joinPath;
|
||||
2
node_modules/firebase-functions/lib/common/utilities/utils.d.ts
generated
vendored
Normal file
2
node_modules/firebase-functions/lib/common/utilities/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/** @hidden */
|
||||
export declare function applyChange(src: any, dest: any): any;
|
||||
52
node_modules/firebase-functions/lib/common/utilities/utils.js
generated
vendored
Normal file
52
node_modules/firebase-functions/lib/common/utilities/utils.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2017 Firebase
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.applyChange = void 0;
|
||||
function isObject(obj) {
|
||||
return typeof obj === "object" && !!obj;
|
||||
}
|
||||
/** @hidden */
|
||||
function applyChange(src, dest) {
|
||||
// if not mergeable, don't merge
|
||||
if (!isObject(dest) || !isObject(src)) {
|
||||
return dest;
|
||||
}
|
||||
return merge(src, dest);
|
||||
}
|
||||
exports.applyChange = applyChange;
|
||||
function merge(src, dest) {
|
||||
const res = {};
|
||||
const keys = new Set([...Object.keys(src), ...Object.keys(dest)]);
|
||||
for (const key of keys.values()) {
|
||||
if (key in dest) {
|
||||
if (dest[key] === null) {
|
||||
continue;
|
||||
}
|
||||
res[key] = applyChange(src[key], dest[key]);
|
||||
}
|
||||
else if (src[key] !== null) {
|
||||
res[key] = src[key];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user