This commit is contained in:
girinb
2025-05-29 15:41:51 +09:00
parent a1bd4f87a1
commit 485098cd1a
5611 changed files with 881685 additions and 0 deletions

12
node_modules/firebase-functions/lib/logger/common.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/** @hidden */
export declare const CONSOLE_SEVERITY: {
[severity: string]: "debug" | "info" | "warn" | "error";
};
/** @hidden */
export declare const UNPATCHED_CONSOLE: {
debug: (message?: any, ...optionalParams: any[]) => void;
info: (message?: any, ...optionalParams: any[]) => void;
log: (message?: any, ...optionalParams: any[]) => void;
warn: (message?: any, ...optionalParams: any[]) => void;
error: (message?: any, ...optionalParams: any[]) => void;
};

45
node_modules/firebase-functions/lib/logger/common.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
"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.UNPATCHED_CONSOLE = exports.CONSOLE_SEVERITY = void 0;
// Map LogSeverity types to their equivalent `console.*` method.
/** @hidden */
exports.CONSOLE_SEVERITY = {
DEBUG: "debug",
INFO: "info",
NOTICE: "info",
WARNING: "warn",
ERROR: "error",
CRITICAL: "error",
ALERT: "error",
EMERGENCY: "error",
};
// safely preserve unpatched console.* methods in case of compat require
/** @hidden */
exports.UNPATCHED_CONSOLE = {
debug: console.debug,
info: console.info,
log: console.log,
warn: console.warn,
error: console.error,
};

View File

@@ -0,0 +1 @@
export {};

41
node_modules/firebase-functions/lib/logger/compat.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"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 });
const util_1 = require("util");
const common_1 = require("./common");
/** @hidden */
function patchedConsole(severity) {
return function (data, ...args) {
let message = (0, util_1.format)(data, ...args);
if (severity === "ERROR") {
message = new Error(message).stack || message;
}
common_1.UNPATCHED_CONSOLE[common_1.CONSOLE_SEVERITY[severity]](JSON.stringify({ severity, message }));
};
}
// IMPORTANT -- "../logger" must be imported before monkeypatching!
console.debug = patchedConsole("DEBUG");
console.info = patchedConsole("INFO");
console.log = patchedConsole("INFO");
console.warn = patchedConsole("WARNING");
console.error = patchedConsole("ERROR");

57
node_modules/firebase-functions/lib/logger/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,57 @@
/**
* `LogSeverity` indicates the detailed severity of the log entry. See [LogSeverity](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity).
* @public
*/
export type LogSeverity = "DEBUG" | "INFO" | "NOTICE" | "WARNING" | "ERROR" | "CRITICAL" | "ALERT" | "EMERGENCY";
/**
* `LogEntry` represents a [structured Cloud Logging](https://cloud.google.com/logging/docs/structured-logging)
* entry. All keys aside from `severity` and `message` are
* included in the `jsonPayload` of the logged entry.
* @public
*/
export interface LogEntry {
severity: LogSeverity;
message?: string;
[key: string]: any;
}
/**
* Writes a `LogEntry` to `stdout`/`stderr` (depending on severity).
* @param entry - The `LogEntry` including severity, message, and any additional structured metadata.
* @public
*/
export declare function write(entry: LogEntry): void;
/**
* Writes a `DEBUG` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
export declare function debug(...args: any[]): void;
/**
* Writes an `INFO` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
export declare function log(...args: any[]): void;
/**
* Writes an `INFO` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
export declare function info(...args: any[]): void;
/**
* Writes a `WARNING` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
export declare function warn(...args: any[]): void;
/**
* Writes an `ERROR` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
export declare function error(...args: any[]): void;

143
node_modules/firebase-functions/lib/logger/index.js generated vendored Normal file
View File

@@ -0,0 +1,143 @@
"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.error = exports.warn = exports.info = exports.log = exports.debug = exports.write = void 0;
const util_1 = require("util");
const trace_1 = require("../common/trace");
const common_1 = require("./common");
/** @internal */
function removeCircular(obj, refs = []) {
if (typeof obj !== "object" || !obj) {
return obj;
}
// If the object defines its own toJSON, prefer that.
if (obj.toJSON) {
return obj.toJSON();
}
if (refs.includes(obj)) {
return "[Circular]";
}
else {
refs.push(obj);
}
let returnObj;
if (Array.isArray(obj)) {
returnObj = new Array(obj.length);
}
else {
returnObj = {};
}
for (const k in obj) {
if (refs.includes(obj[k])) {
returnObj[k] = "[Circular]";
}
else {
returnObj[k] = removeCircular(obj[k], refs);
}
}
return returnObj;
}
/**
* Writes a `LogEntry` to `stdout`/`stderr` (depending on severity).
* @param entry - The `LogEntry` including severity, message, and any additional structured metadata.
* @public
*/
function write(entry) {
const ctx = trace_1.traceContext.getStore();
if (ctx === null || ctx === void 0 ? void 0 : ctx.traceId) {
entry["logging.googleapis.com/trace"] = `projects/${process.env.GCLOUD_PROJECT}/traces/${ctx.traceId}`;
}
common_1.UNPATCHED_CONSOLE[common_1.CONSOLE_SEVERITY[entry.severity]](JSON.stringify(removeCircular(entry)));
}
exports.write = write;
/**
* Writes a `DEBUG` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
function debug(...args) {
write(entryFromArgs("DEBUG", args));
}
exports.debug = debug;
/**
* Writes an `INFO` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
function log(...args) {
write(entryFromArgs("INFO", args));
}
exports.log = log;
/**
* Writes an `INFO` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
function info(...args) {
write(entryFromArgs("INFO", args));
}
exports.info = info;
/**
* Writes a `WARNING` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
function warn(...args) {
write(entryFromArgs("WARNING", args));
}
exports.warn = warn;
/**
* Writes an `ERROR` severity log. If the last argument provided is a plain object,
* it is added to the `jsonPayload` in the Cloud Logging entry.
* @param args - Arguments, concatenated into the log message with space separators.
* @public
*/
function error(...args) {
write(entryFromArgs("ERROR", args));
}
exports.error = error;
/** @hidden */
function entryFromArgs(severity, args) {
let entry = {};
const lastArg = args[args.length - 1];
if (lastArg && typeof lastArg === "object" && lastArg.constructor === Object) {
entry = args.pop();
}
// mimic `console.*` behavior, see https://nodejs.org/api/console.html#console_console_log_data_args
let message = (0, util_1.format)(...args);
if (severity === "ERROR" && !args.find((arg) => arg instanceof Error)) {
message = new Error(message).stack || message;
}
const out = {
...entry,
severity,
};
if (message) {
out.message = message;
}
return out;
}