Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/logging-min

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/logging-min - npm Package Compare versions

Comparing version 9.9.0 to 10.0.0

2

build/src/entry.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Entry=exports.TRACE_SAMPLED_KEY=exports.TRACE_KEY=exports.SPAN_ID_KEY=exports.SOURCE_LOCATION_KEY=exports.OPERATION_KEY=exports.LABELS_KEY=exports.INSERT_ID_KEY=void 0;const EventId=require("eventid");const extend=require("extend");const common_1=require("./utils/common");const http_request_1=require("./utils/http-request");const context_1=require("./utils/context");const eventId=new EventId;exports.INSERT_ID_KEY="logging.googleapis.com/insertId";exports.LABELS_KEY="logging.googleapis.com/labels";exports.OPERATION_KEY="logging.googleapis.com/operation";exports.SOURCE_LOCATION_KEY="logging.googleapis.com/sourceLocation";exports.SPAN_ID_KEY="logging.googleapis.com/spanId";exports.TRACE_KEY="logging.googleapis.com/trace";exports.TRACE_SAMPLED_KEY="logging.googleapis.com/trace_sampled";class Entry{constructor(metadata,data){this.metadata=extend({timestamp:new Date},metadata);this.metadata.insertId=this.metadata.insertId||eventId.new();this.data=data}toJSON(options={},projectId=""){const entry=extend(true,{},this.metadata);if(Object.prototype.toString.call(this.data)==="[object Object]"){entry.jsonPayload=common_1.objToStruct(this.data,{removeCircular:!!options.removeCircular,stringify:true})}else if(typeof this.data==="string"){entry.textPayload=this.data}if(entry.timestamp instanceof Date){const seconds=entry.timestamp.getTime()/1e3;const secondsRounded=Math.floor(seconds);entry.timestamp={seconds:secondsRounded,nanos:Math.floor((seconds-secondsRounded)*1e9)}}else if(typeof entry.timestamp==="string"){entry.timestamp=common_1.zuluToDateObj(entry.timestamp)}const req=this.metadata.httpRequest;if(http_request_1.isRawHttpRequest(req)){entry.httpRequest=http_request_1.makeHttpRequestData(req);const traceContext=this.extractTraceFromHeaders(projectId);if(traceContext){if(!this.metadata.trace&&traceContext.trace)entry.trace=traceContext.trace;if(!this.metadata.spanId&&traceContext.spanId)entry.spanId=traceContext.spanId;if(this.metadata.traceSampled===undefined)entry.traceSampled=traceContext.traceSampled}}return entry}toStructuredJSON(projectId=""){const meta=this.metadata;const{textPayload,jsonPayload,insertId,trace,spanId,traceSampled,operation,sourceLocation,labels,...validKeys}=meta;const entry=extend(true,{},validKeys);entry[exports.LABELS_KEY]=meta.labels?Object.assign({},meta.labels):undefined;entry[exports.INSERT_ID_KEY]=meta.insertId||undefined;entry[exports.TRACE_KEY]=meta.trace||undefined;entry[exports.SPAN_ID_KEY]=meta.spanId||undefined;entry[exports.TRACE_SAMPLED_KEY]="traceSampled"in meta&&meta.traceSampled!==null?meta.traceSampled:undefined;entry.message=meta.textPayload||meta.jsonPayload||meta.protoPayload||undefined;entry.message=this.data||entry.message;if(meta.timestamp instanceof Date){entry.timestamp=meta.timestamp.toISOString()}const req=meta.httpRequest;if(http_request_1.isRawHttpRequest(req)){entry.httpRequest=http_request_1.makeHttpRequestData(req);const traceContext=this.extractTraceFromHeaders(projectId);if(traceContext){if(!entry[exports.TRACE_KEY]&&traceContext.trace)entry[exports.TRACE_KEY]=traceContext.trace;if(!entry[exports.SPAN_ID_KEY]&&traceContext.spanId)entry[exports.SPAN_ID_KEY]=traceContext.spanId;if(entry[exports.TRACE_SAMPLED_KEY]===undefined)entry[exports.TRACE_SAMPLED_KEY]=traceContext.traceSampled}}return entry}extractTraceFromHeaders(projectId){const rawReq=this.metadata.httpRequest;if(rawReq&&"headers"in rawReq){return context_1.getOrInjectContext(rawReq,projectId,false)}return null}static fromApiResponse_(entry){let data=entry[entry.payload];if(entry.payload==="jsonPayload"){data=common_1.structToObj(data)}const serializedEntry=new Entry(entry,data);if(entry.timestamp){let ms=Number(entry.timestamp.seconds)*1e3;ms+=Number(entry.timestamp.nanos)/1e6;serializedEntry.metadata.timestamp=new Date(ms)}return serializedEntry}}exports.Entry=Entry;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Entry=exports.TRACE_SAMPLED_KEY=exports.TRACE_KEY=exports.SPAN_ID_KEY=exports.SOURCE_LOCATION_KEY=exports.OPERATION_KEY=exports.LABELS_KEY=exports.INSERT_ID_KEY=void 0;const EventId=require("eventid");const extend=require("extend");const common_1=require("./utils/common");const http_request_1=require("./utils/http-request");const context_1=require("./utils/context");const eventId=new EventId;exports.INSERT_ID_KEY="logging.googleapis.com/insertId";exports.LABELS_KEY="logging.googleapis.com/labels";exports.OPERATION_KEY="logging.googleapis.com/operation";exports.SOURCE_LOCATION_KEY="logging.googleapis.com/sourceLocation";exports.SPAN_ID_KEY="logging.googleapis.com/spanId";exports.TRACE_KEY="logging.googleapis.com/trace";exports.TRACE_SAMPLED_KEY="logging.googleapis.com/trace_sampled";class Entry{constructor(metadata,data){this.metadata=extend({timestamp:new Date},metadata);this.metadata.insertId=this.metadata.insertId||eventId.new();this.data=data}toJSON(options={},projectId=""){const entry=extend(true,{},this.metadata);if(Object.prototype.toString.call(this.data)==="[object Object]"){entry.jsonPayload=(0,common_1.objToStruct)(this.data,{removeCircular:!!options.removeCircular,stringify:true})}else if(typeof this.data==="string"){entry.textPayload=this.data}if(entry.timestamp instanceof Date){const seconds=entry.timestamp.getTime()/1e3;const secondsRounded=Math.floor(seconds);entry.timestamp={seconds:secondsRounded,nanos:Math.floor((seconds-secondsRounded)*1e9)}}else if(typeof entry.timestamp==="string"){entry.timestamp=(0,common_1.zuluToDateObj)(entry.timestamp)}const req=this.metadata.httpRequest;if((0,http_request_1.isRawHttpRequest)(req)){entry.httpRequest=(0,http_request_1.makeHttpRequestData)(req);const traceContext=this.extractTraceFromHeaders(projectId);if(traceContext){if(!this.metadata.trace&&traceContext.trace)entry.trace=traceContext.trace;if(!this.metadata.spanId&&traceContext.spanId)entry.spanId=traceContext.spanId;if(this.metadata.traceSampled===undefined)entry.traceSampled=traceContext.traceSampled}}return entry}toStructuredJSON(projectId=""){const meta=this.metadata;const{textPayload,jsonPayload,insertId,trace,spanId,traceSampled,operation,sourceLocation,labels,...validKeys}=meta;const entry=extend(true,{},validKeys);entry[exports.LABELS_KEY]=meta.labels?Object.assign({},meta.labels):undefined;entry[exports.INSERT_ID_KEY]=meta.insertId||undefined;entry[exports.TRACE_KEY]=meta.trace||undefined;entry[exports.SPAN_ID_KEY]=meta.spanId||undefined;entry[exports.TRACE_SAMPLED_KEY]="traceSampled"in meta&&meta.traceSampled!==null?meta.traceSampled:undefined;entry.message=meta.textPayload||meta.jsonPayload||meta.protoPayload||undefined;entry.message=this.data||entry.message;if(meta.timestamp instanceof Date){entry.timestamp=meta.timestamp.toISOString()}const req=meta.httpRequest;if((0,http_request_1.isRawHttpRequest)(req)){entry.httpRequest=(0,http_request_1.makeHttpRequestData)(req);const traceContext=this.extractTraceFromHeaders(projectId);if(traceContext){if(!entry[exports.TRACE_KEY]&&traceContext.trace)entry[exports.TRACE_KEY]=traceContext.trace;if(!entry[exports.SPAN_ID_KEY]&&traceContext.spanId)entry[exports.SPAN_ID_KEY]=traceContext.spanId;if(entry[exports.TRACE_SAMPLED_KEY]===undefined)entry[exports.TRACE_SAMPLED_KEY]=traceContext.traceSampled}}return entry}extractTraceFromHeaders(projectId){const rawReq=this.metadata.httpRequest;if(rawReq&&"headers"in rawReq){return(0,context_1.getOrInjectContext)(rawReq,projectId,false)}return null}static fromApiResponse_(entry){let data=entry[entry.payload];if(entry.payload==="jsonPayload"){data=(0,common_1.structToObj)(data)}const serializedEntry=new Entry(entry,data);if(entry.timestamp){let ms=Number(entry.timestamp.seconds)*1e3;ms+=Number(entry.timestamp.nanos)/1e6;serializedEntry.metadata.timestamp=new Date(ms)}return serializedEntry}}exports.Entry=Entry;
//# sourceMappingURL=entry.js.map

@@ -57,3 +57,7 @@ /*!

}
export declare type GetEntriesResponse = [Entry[], google.logging.v2.IListLogEntriesRequest, google.logging.v2.IListLogEntriesResponse];
export declare type GetEntriesResponse = [
Entry[],
google.logging.v2.IListLogEntriesRequest,
google.logging.v2.IListLogEntriesResponse
];
export interface GetEntriesCallback {

@@ -74,3 +78,7 @@ (err: Error | null, entries?: Entry[], request?: google.logging.v2.IListLogEntriesRequest, apiResponse?: google.logging.v2.IListLogEntriesResponse): void;

}
export declare type GetLogsResponse = [Sink[], google.logging.v2.IListLogsRequest, google.logging.v2.IListLogsResponse];
export declare type GetLogsResponse = [
Sink[],
google.logging.v2.IListLogsRequest,
google.logging.v2.IListLogsResponse
];
export interface GetLogsCallback {

@@ -87,3 +95,7 @@ (err: Error | null, entries?: Sink[], request?: google.logging.v2.IListLogsRequest, apiResponse?: google.logging.v2.IListLogsResponse): void;

}
export declare type GetSinksResponse = [Sink[], google.logging.v2.IListSinksRequest, google.logging.v2.IListSinksResponse];
export declare type GetSinksResponse = [
Sink[],
google.logging.v2.IListSinksRequest,
google.logging.v2.IListSinksResponse
];
export interface GetSinksCallback {

@@ -90,0 +102,0 @@ (err: Error | null, entries?: Sink[], request?: google.logging.v2.IListSinksRequest, apiResponse?: google.logging.v2.IListSinksResponse): void;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.v2=exports.protos=exports.Logging=exports.Sink=exports.LogSync=exports.formatLogName=exports.assignSeverityToEntries=exports.Severity=exports.Log=exports.Entry=exports.detectServiceContext=exports.middleware=void 0;const common_1=require("@google-cloud/common");const paginator_1=require("@google-cloud/paginator");const projectify_1=require("@google-cloud/projectify");const promisify_1=require("@google-cloud/promisify");const arrify=require("arrify");const extend=require("extend");const gax=require("google-gax");const pumpify=require("pumpify");const streamEvents=require("stream-events");const middleware=require("./middleware");exports.middleware=middleware;const metadata_1=require("./utils/metadata");Object.defineProperty(exports,"detectServiceContext",{enumerable:true,get:function(){return metadata_1.detectServiceContext}});const version=require("../../package.json").version;const v2=require("./v2");exports.v2=v2;const entry_1=require("./entry");Object.defineProperty(exports,"Entry",{enumerable:true,get:function(){return entry_1.Entry}});const log_common_1=require("./utils/log-common");Object.defineProperty(exports,"Severity",{enumerable:true,get:function(){return log_common_1.Severity}});Object.defineProperty(exports,"formatLogName",{enumerable:true,get:function(){return log_common_1.formatLogName}});Object.defineProperty(exports,"assignSeverityToEntries",{enumerable:true,get:function(){return log_common_1.assignSeverityToEntries}});const log_1=require("./log");Object.defineProperty(exports,"Log",{enumerable:true,get:function(){return log_1.Log}});const log_sync_1=require("./log-sync");Object.defineProperty(exports,"LogSync",{enumerable:true,get:function(){return log_sync_1.LogSync}});const sink_1=require("./sink");Object.defineProperty(exports,"Sink",{enumerable:true,get:function(){return sink_1.Sink}});const stream_1=require("stream");class Logging{constructor(options){const scopes=[];const clientClasses=[v2.ConfigServiceV2Client,v2.LoggingServiceV2Client,v2.MetricsServiceV2Client];for(const clientClass of clientClasses){for(const scope of clientClass.scopes){if(scopes.indexOf(scope)===-1){scopes.push(scope)}}}const options_=extend({libName:"gccl",libVersion:version,scopes:scopes},options);this.api={};this.auth=new gax.GoogleAuth(options_);this.options=options_;this.projectId=this.options.projectId||"{{projectId}}";this.configService=new v2.ConfigServiceV2Client(this.options);this.loggingService=new v2.LoggingServiceV2Client(this.options)}async createSink(name,config){if(typeof name!=="string"){throw new Error("A sink name must be provided.")}if(typeof config!=="object"){throw new Error("A sink configuration object must be provided.")}if(common_1.util.isCustomType(config.destination,"bigquery/dataset")){await this.setAclForDataset_(config)}if(common_1.util.isCustomType(config.destination,"pubsub/topic")){await this.setAclForTopic_(config)}if(common_1.util.isCustomType(config.destination,"storage/bucket")){await this.setAclForBucket_(config)}const reqOpts={parent:"projects/"+this.projectId,sink:extend({},config,{name:name}),uniqueWriterIdentity:config.uniqueWriterIdentity};delete reqOpts.sink.gaxOptions;delete reqOpts.sink.uniqueWriterIdentity;await this.setProjectId(reqOpts);const[resp]=await this.configService.createSink(reqOpts,config.gaxOptions);const sink=this.sink(resp.name);sink.metadata=resp;return[sink,resp]}entry(resource,data){return new entry_1.Entry(resource,data)}async getEntries(opts){const options=opts?opts:{};let reqOpts=extend({orderBy:"timestamp desc"},options);const time=new Date;time.setDate(time.getDate()-1);const timeFilter=`timestamp >= "${time.toISOString()}"`;if(!options.filter){reqOpts=extend({filter:timeFilter},reqOpts)}else if(!options.filter.includes("timestamp")){reqOpts.filter+=` AND ${timeFilter}`}reqOpts.resourceNames=arrify(reqOpts.resourceNames);this.projectId=await this.auth.getProjectId();const resourceName="projects/"+this.projectId;if(reqOpts.resourceNames.indexOf(resourceName)===-1){reqOpts.resourceNames.push(resourceName)}delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);const resp=await this.loggingService.listLogEntries(reqOpts,gaxOptions);const[entries]=resp;if(entries){resp[0]=entries.map(entry_1.Entry.fromApiResponse_)}return resp}getEntriesStream(options={}){let requestStream;const userStream=streamEvents(pumpify.obj());userStream.abort=()=>{if(requestStream){requestStream.abort()}};const toEntryStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{callback(null,entry_1.Entry.fromApiResponse_(chunk))}});userStream.once("reading",()=>{this.auth.getProjectId().then(projectId=>{this.projectId=projectId;if(options.log){if(options.filter){options.filter=`(${options.filter}) AND logName="${log_common_1.formatLogName(this.projectId,options.log)}"`}else{options.filter=`logName="${log_common_1.formatLogName(this.projectId,options.log)}"`}delete options.log}const reqOpts=extend({orderBy:"timestamp desc"},options);reqOpts.resourceNames=arrify(reqOpts.resourceNames);reqOpts.resourceNames.push(`projects/${this.projectId}`);delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);let gaxStream;requestStream=streamEvents(new stream_1.PassThrough({objectMode:true}));requestStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};if(!global.GCLOUD_SANDBOX_ENV){requestStream.once("reading",()=>{try{gaxStream=this.loggingService.listLogEntriesStream(reqOpts,gaxOptions)}catch(error){requestStream.destroy(error);return}gaxStream.on("error",err=>{requestStream.destroy(err)}).pipe(requestStream);return})}userStream.setPipeline(requestStream,toEntryStream)})});return userStream}tailEntries(options={}){const userStream=streamEvents(pumpify.obj());let gaxStream;userStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};const transformStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{callback(null,(()=>{const formattedEntries=[];chunk.entries.forEach(entry=>{formattedEntries.push(entry_1.Entry.fromApiResponse_(entry))});const resp={entries:formattedEntries,suppressionInfo:chunk.suppressionInfo};return resp})())}});this.auth.getProjectId().then(projectId=>{this.projectId=projectId;if(options.log){if(options.filter){options.filter=`(${options.filter}) AND logName="${log_common_1.formatLogName(this.projectId,options.log)}"`}else{options.filter=`logName="${log_common_1.formatLogName(this.projectId,options.log)}"`}}options.resourceNames=arrify(options.resourceNames);options.resourceNames.push(`projects/${this.projectId}`);const writeOptions={resourceNames:options.resourceNames,...options.filter&&{filter:options.filter},...options.bufferWindow&&{bufferwindow:options.bufferWindow}};if(!global.GCLOUD_SANDBOX_ENV){gaxStream=this.loggingService.tailLogEntries(options.gaxOptions);gaxStream.write(writeOptions);userStream.setPipeline(gaxStream,transformStream)}});return userStream}async getLogs(opts){const options=opts?opts:{};this.projectId=await this.auth.getProjectId();const reqOpts=extend({},options,{parent:"projects/"+this.projectId});delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);const resp=await this.loggingService.listLogs(reqOpts,gaxOptions);const[logs]=resp;if(logs){resp[0]=logs.map(logName=>this.log(logName))}return resp}getLogsStream(options={}){options=options||{};let requestStream;const userStream=streamEvents(pumpify.obj());userStream.abort=()=>{if(requestStream){requestStream.abort()}};const toLogStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{callback(null,this.log(chunk))}});userStream.once("reading",()=>{this.auth.getProjectId().then(projectId=>{this.projectId=projectId;const reqOpts=extend({},options,{parent:"projects/"+this.projectId});delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);let gaxStream;requestStream=streamEvents(new stream_1.PassThrough({objectMode:true}));requestStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};requestStream.once("reading",()=>{try{gaxStream=this.loggingService.listLogsStream(reqOpts,gaxOptions)}catch(error){requestStream.destroy(error);return}gaxStream.on("error",err=>{requestStream.destroy(err)}).pipe(requestStream);return});userStream.setPipeline(requestStream,toLogStream)})});return userStream}async getSinks(opts){const options=opts?opts:{};this.projectId=await this.auth.getProjectId();const reqOpts=extend({},options,{parent:"projects/"+this.projectId});delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);const resp=await this.configService.listSinks(reqOpts,gaxOptions);const[sinks]=resp;if(sinks){resp[0]=sinks.map(sink=>{const sinkInstance=this.sink(sink.name);sinkInstance.metadata=sink;return sinkInstance})}return resp}getSinksStream(options){const self=this;options=options||{};let requestStream;const userStream=streamEvents(pumpify.obj());userStream.abort=()=>{if(requestStream){requestStream.abort()}};const toSinkStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{const sinkInstance=self.sink(chunk.name);sinkInstance.metadata=chunk;callback(null,sinkInstance)}});userStream.once("reading",()=>{this.auth.getProjectId().then(projectId=>{this.projectId=projectId;const reqOpts=extend({},options,{parent:"projects/"+self.projectId});delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);let gaxStream;requestStream=streamEvents(new stream_1.PassThrough({objectMode:true}));requestStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};if(!global.GCLOUD_SANDBOX_ENV){requestStream.once("reading",()=>{try{gaxStream=this.configService.listSinksStream(reqOpts,gaxOptions)}catch(error){requestStream.destroy(error);return}gaxStream.on("error",err=>{requestStream.destroy(err)}).pipe(requestStream);return})}userStream.setPipeline(requestStream,toSinkStream)})});return userStream}log(name,options){return new log_1.Log(this,name,options)}logSync(name,transport){return new log_sync_1.LogSync(this,name,transport)}sink(name){return new sink_1.Sink(this,name)}request(config,callback){const self=this;const isStreamMode=!callback;let gaxStream;let stream;if(isStreamMode){stream=streamEvents(new stream_1.PassThrough({objectMode:true}));stream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};stream.once("reading",makeRequestStream)}else{makeRequestCallback()}function prepareGaxRequest(callback){self.auth.getProjectId((err,projectId)=>{if(err){callback(err);return}self.projectId=projectId;let gaxClient=self.api[config.client];if(!gaxClient){gaxClient=new v2[config.client](self.options);self.api[config.client]=gaxClient}let reqOpts=extend(true,{},config.reqOpts);reqOpts=projectify_1.replaceProjectIdToken(reqOpts,projectId);const requestFn=gaxClient[config.method].bind(gaxClient,reqOpts,config.gaxOpts);callback(null,requestFn)})}function makeRequestCallback(){if(global.GCLOUD_SANDBOX_ENV){return}prepareGaxRequest((err,requestFn)=>{if(err){callback(err);return}requestFn(callback)})}function makeRequestStream(){if(global.GCLOUD_SANDBOX_ENV){return new stream_1.PassThrough({objectMode:true})}prepareGaxRequest((err,requestFn)=>{if(err){stream.destroy(err);return}gaxStream=requestFn();gaxStream.on("error",err=>{stream.destroy(err)}).pipe(stream)});return}return stream}async setAclForBucket_(config){const bucket=config.destination;await bucket.acl.owners.addGroup("cloud-logs@google.com");config.destination="storage.googleapis.com/"+bucket.name}async setAclForDataset_(config){const dataset=config.destination;const[metadata]=await dataset.getMetadata();const access=[].slice.call(arrify(metadata.access));access.push({role:"WRITER",groupByEmail:"cloud-logs@google.com"});await dataset.setMetadata({access:access});const baseUrl="bigquery.googleapis.com";const pId=dataset.parent.projectId;const dId=dataset.id;config.destination=`${baseUrl}/projects/${pId}/datasets/${dId}`}async setAclForTopic_(config){const topic=config.destination;const[policy]=await topic.iam.getPolicy();policy.bindings=arrify(policy.bindings);policy.bindings.push({role:"roles/pubsub.publisher",members:["serviceAccount:cloud-logs@system.gserviceaccount.com"]});await topic.iam.setPolicy(policy);const baseUrl="pubsub.googleapis.com";const topicName=topic.name;config.destination=`${baseUrl}/${topicName}`}async setProjectId(reqOpts){if(this.projectId==="{{projectId}}")this.projectId=await this.auth.getProjectId();if(reqOpts)reqOpts=projectify_1.replaceProjectIdToken(reqOpts,this.projectId)}async setDetectedResource(){if(!this.detectedResource){this.detectedResource=await metadata_1.getDefaultResource(this.auth)}}}exports.Logging=Logging;promisify_1.callbackifyAll(Logging,{exclude:["request"]});paginator_1.paginator.extend(Logging,["getEntries","getLogs","getSinks"]);module.exports.v2=v2;const protos=require("../protos/protos");exports.protos=protos;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.v2=exports.protos=exports.Logging=exports.Sink=exports.LogSync=exports.formatLogName=exports.assignSeverityToEntries=exports.Severity=exports.Log=exports.Entry=exports.detectServiceContext=exports.middleware=void 0;const common_1=require("@google-cloud/common");const paginator_1=require("@google-cloud/paginator");const projectify_1=require("@google-cloud/projectify");const promisify_1=require("@google-cloud/promisify");const arrify=require("arrify");const extend=require("extend");const gax=require("google-gax");const pumpify=require("pumpify");const streamEvents=require("stream-events");const middleware=require("./middleware");exports.middleware=middleware;const metadata_1=require("./utils/metadata");Object.defineProperty(exports,"detectServiceContext",{enumerable:true,get:function(){return metadata_1.detectServiceContext}});const version=require("../../package.json").version;const v2=require("./v2");exports.v2=v2;const entry_1=require("./entry");Object.defineProperty(exports,"Entry",{enumerable:true,get:function(){return entry_1.Entry}});const log_common_1=require("./utils/log-common");Object.defineProperty(exports,"Severity",{enumerable:true,get:function(){return log_common_1.Severity}});Object.defineProperty(exports,"formatLogName",{enumerable:true,get:function(){return log_common_1.formatLogName}});Object.defineProperty(exports,"assignSeverityToEntries",{enumerable:true,get:function(){return log_common_1.assignSeverityToEntries}});const log_1=require("./log");Object.defineProperty(exports,"Log",{enumerable:true,get:function(){return log_1.Log}});const log_sync_1=require("./log-sync");Object.defineProperty(exports,"LogSync",{enumerable:true,get:function(){return log_sync_1.LogSync}});const sink_1=require("./sink");Object.defineProperty(exports,"Sink",{enumerable:true,get:function(){return sink_1.Sink}});const stream_1=require("stream");class Logging{constructor(options){const scopes=[];const clientClasses=[v2.ConfigServiceV2Client,v2.LoggingServiceV2Client,v2.MetricsServiceV2Client];for(const clientClass of clientClasses){for(const scope of clientClass.scopes){if(scopes.indexOf(scope)===-1){scopes.push(scope)}}}const options_=extend({libName:"gccl",libVersion:version,scopes:scopes},options);this.api={};this.auth=new gax.GoogleAuth(options_);this.options=options_;this.projectId=this.options.projectId||"{{projectId}}";this.configService=new v2.ConfigServiceV2Client(this.options);this.loggingService=new v2.LoggingServiceV2Client(this.options)}async createSink(name,config){if(typeof name!=="string"){throw new Error("A sink name must be provided.")}if(typeof config!=="object"){throw new Error("A sink configuration object must be provided.")}if(common_1.util.isCustomType(config.destination,"bigquery/dataset")){await this.setAclForDataset_(config)}if(common_1.util.isCustomType(config.destination,"pubsub/topic")){await this.setAclForTopic_(config)}if(common_1.util.isCustomType(config.destination,"storage/bucket")){await this.setAclForBucket_(config)}const reqOpts={parent:"projects/"+this.projectId,sink:extend({},config,{name:name}),uniqueWriterIdentity:config.uniqueWriterIdentity};delete reqOpts.sink.gaxOptions;delete reqOpts.sink.uniqueWriterIdentity;await this.setProjectId(reqOpts);const[resp]=await this.configService.createSink(reqOpts,config.gaxOptions);const sink=this.sink(resp.name);sink.metadata=resp;return[sink,resp]}entry(resource,data){return new entry_1.Entry(resource,data)}async getEntries(opts){const options=opts?opts:{};let reqOpts=extend({orderBy:"timestamp desc"},options);const time=new Date;time.setDate(time.getDate()-1);const timeFilter=`timestamp >= "${time.toISOString()}"`;if(!options.filter){reqOpts=extend({filter:timeFilter},reqOpts)}else if(!options.filter.includes("timestamp")){reqOpts.filter+=` AND ${timeFilter}`}reqOpts.resourceNames=arrify(reqOpts.resourceNames);this.projectId=await this.auth.getProjectId();const resourceName="projects/"+this.projectId;if(reqOpts.resourceNames.indexOf(resourceName)===-1){reqOpts.resourceNames.push(resourceName)}delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);const resp=await this.loggingService.listLogEntries(reqOpts,gaxOptions);const[entries]=resp;if(entries){resp[0]=entries.map(entry_1.Entry.fromApiResponse_)}return resp}getEntriesStream(options={}){let requestStream;const userStream=streamEvents(pumpify.obj());userStream.abort=()=>{if(requestStream){requestStream.abort()}};const toEntryStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{callback(null,entry_1.Entry.fromApiResponse_(chunk))}});userStream.once("reading",()=>{this.auth.getProjectId().then(projectId=>{this.projectId=projectId;if(options.log){if(options.filter){options.filter=`(${options.filter}) AND logName="${(0,log_common_1.formatLogName)(this.projectId,options.log)}"`}else{options.filter=`logName="${(0,log_common_1.formatLogName)(this.projectId,options.log)}"`}delete options.log}const reqOpts=extend({orderBy:"timestamp desc"},options);reqOpts.resourceNames=arrify(reqOpts.resourceNames);reqOpts.resourceNames.push(`projects/${this.projectId}`);delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);let gaxStream;requestStream=streamEvents(new stream_1.PassThrough({objectMode:true}));requestStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};if(!global.GCLOUD_SANDBOX_ENV){requestStream.once("reading",()=>{try{gaxStream=this.loggingService.listLogEntriesStream(reqOpts,gaxOptions)}catch(error){requestStream.destroy(error);return}gaxStream.on("error",err=>{requestStream.destroy(err)}).pipe(requestStream);return})}userStream.setPipeline(requestStream,toEntryStream)})});return userStream}tailEntries(options={}){const userStream=streamEvents(pumpify.obj());let gaxStream;userStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};const transformStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{callback(null,(()=>{const formattedEntries=[];chunk.entries.forEach(entry=>{formattedEntries.push(entry_1.Entry.fromApiResponse_(entry))});const resp={entries:formattedEntries,suppressionInfo:chunk.suppressionInfo};return resp})())}});this.auth.getProjectId().then(projectId=>{this.projectId=projectId;if(options.log){if(options.filter){options.filter=`(${options.filter}) AND logName="${(0,log_common_1.formatLogName)(this.projectId,options.log)}"`}else{options.filter=`logName="${(0,log_common_1.formatLogName)(this.projectId,options.log)}"`}}options.resourceNames=arrify(options.resourceNames);options.resourceNames.push(`projects/${this.projectId}`);const writeOptions={resourceNames:options.resourceNames,...options.filter&&{filter:options.filter},...options.bufferWindow&&{bufferwindow:options.bufferWindow}};if(!global.GCLOUD_SANDBOX_ENV){gaxStream=this.loggingService.tailLogEntries(options.gaxOptions);gaxStream.write(writeOptions);userStream.setPipeline(gaxStream,transformStream)}});return userStream}async getLogs(opts){const options=opts?opts:{};this.projectId=await this.auth.getProjectId();const reqOpts=extend({},options,{parent:"projects/"+this.projectId});delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);const resp=await this.loggingService.listLogs(reqOpts,gaxOptions);const[logs]=resp;if(logs){resp[0]=logs.map(logName=>this.log(logName))}return resp}getLogsStream(options={}){options=options||{};let requestStream;const userStream=streamEvents(pumpify.obj());userStream.abort=()=>{if(requestStream){requestStream.abort()}};const toLogStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{callback(null,this.log(chunk))}});userStream.once("reading",()=>{this.auth.getProjectId().then(projectId=>{this.projectId=projectId;const reqOpts=extend({},options,{parent:"projects/"+this.projectId});delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);let gaxStream;requestStream=streamEvents(new stream_1.PassThrough({objectMode:true}));requestStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};requestStream.once("reading",()=>{try{gaxStream=this.loggingService.listLogsStream(reqOpts,gaxOptions)}catch(error){requestStream.destroy(error);return}gaxStream.on("error",err=>{requestStream.destroy(err)}).pipe(requestStream);return});userStream.setPipeline(requestStream,toLogStream)})});return userStream}async getSinks(opts){const options=opts?opts:{};this.projectId=await this.auth.getProjectId();const reqOpts=extend({},options,{parent:"projects/"+this.projectId});delete reqOpts.autoPaginate;delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);const resp=await this.configService.listSinks(reqOpts,gaxOptions);const[sinks]=resp;if(sinks){resp[0]=sinks.map(sink=>{const sinkInstance=this.sink(sink.name);sinkInstance.metadata=sink;return sinkInstance})}return resp}getSinksStream(options){const self=this;options=options||{};let requestStream;const userStream=streamEvents(pumpify.obj());userStream.abort=()=>{if(requestStream){requestStream.abort()}};const toSinkStream=new stream_1.Transform({objectMode:true,transform:(chunk,encoding,callback)=>{const sinkInstance=self.sink(chunk.name);sinkInstance.metadata=chunk;callback(null,sinkInstance)}});userStream.once("reading",()=>{this.auth.getProjectId().then(projectId=>{this.projectId=projectId;const reqOpts=extend({},options,{parent:"projects/"+self.projectId});delete reqOpts.gaxOptions;const gaxOptions=extend({autoPaginate:options.autoPaginate},options.gaxOptions);let gaxStream;requestStream=streamEvents(new stream_1.PassThrough({objectMode:true}));requestStream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};if(!global.GCLOUD_SANDBOX_ENV){requestStream.once("reading",()=>{try{gaxStream=this.configService.listSinksStream(reqOpts,gaxOptions)}catch(error){requestStream.destroy(error);return}gaxStream.on("error",err=>{requestStream.destroy(err)}).pipe(requestStream);return})}userStream.setPipeline(requestStream,toSinkStream)})});return userStream}log(name,options){return new log_1.Log(this,name,options)}logSync(name,transport){return new log_sync_1.LogSync(this,name,transport)}sink(name){return new sink_1.Sink(this,name)}request(config,callback){const self=this;const isStreamMode=!callback;let gaxStream;let stream;if(isStreamMode){stream=streamEvents(new stream_1.PassThrough({objectMode:true}));stream.abort=()=>{if(gaxStream&&gaxStream.cancel){gaxStream.cancel()}};stream.once("reading",makeRequestStream)}else{makeRequestCallback()}function prepareGaxRequest(callback){self.auth.getProjectId((err,projectId)=>{if(err){callback(err);return}self.projectId=projectId;let gaxClient=self.api[config.client];if(!gaxClient){gaxClient=new v2[config.client](self.options);self.api[config.client]=gaxClient}let reqOpts=extend(true,{},config.reqOpts);reqOpts=(0,projectify_1.replaceProjectIdToken)(reqOpts,projectId);const requestFn=gaxClient[config.method].bind(gaxClient,reqOpts,config.gaxOpts);callback(null,requestFn)})}function makeRequestCallback(){if(global.GCLOUD_SANDBOX_ENV){return}prepareGaxRequest((err,requestFn)=>{if(err){callback(err);return}requestFn(callback)})}function makeRequestStream(){if(global.GCLOUD_SANDBOX_ENV){return new stream_1.PassThrough({objectMode:true})}prepareGaxRequest((err,requestFn)=>{if(err){stream.destroy(err);return}gaxStream=requestFn();gaxStream.on("error",err=>{stream.destroy(err)}).pipe(stream)});return}return stream}async setAclForBucket_(config){const bucket=config.destination;await bucket.acl.owners.addGroup("cloud-logs@google.com");config.destination="storage.googleapis.com/"+bucket.name}async setAclForDataset_(config){const dataset=config.destination;const[metadata]=await dataset.getMetadata();const access=[].slice.call(arrify(metadata.access));access.push({role:"WRITER",groupByEmail:"cloud-logs@google.com"});await dataset.setMetadata({access:access});const baseUrl="bigquery.googleapis.com";const pId=dataset.parent.projectId;const dId=dataset.id;config.destination=`${baseUrl}/projects/${pId}/datasets/${dId}`}async setAclForTopic_(config){const topic=config.destination;const[policy]=await topic.iam.getPolicy();policy.bindings=arrify(policy.bindings);policy.bindings.push({role:"roles/pubsub.publisher",members:["serviceAccount:cloud-logs@system.gserviceaccount.com"]});await topic.iam.setPolicy(policy);const baseUrl="pubsub.googleapis.com";const topicName=topic.name;config.destination=`${baseUrl}/${topicName}`}async setProjectId(reqOpts){if(this.projectId==="{{projectId}}")this.projectId=await this.auth.getProjectId();if(reqOpts)reqOpts=(0,projectify_1.replaceProjectIdToken)(reqOpts,this.projectId)}async setDetectedResource(){if(!this.detectedResource){this.detectedResource=await(0,metadata_1.getDefaultResource)(this.auth)}}}exports.Logging=Logging;(0,promisify_1.callbackifyAll)(Logging,{exclude:["request"]});paginator_1.paginator.extend(Logging,["getEntries","getLogs","getSinks"]);module.exports.v2=v2;const protos=require("../protos/protos");exports.protos=protos;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LogSync=void 0;const entry_1=require("./entry");const instrumentation_1=require("./utils/instrumentation");const log_common_1=require("./utils/log-common");class LogSync{constructor(logging,name,transport){this.formattedName_=log_common_1.formatLogName(logging.projectId,name);this.logging=logging;this.name=this.formattedName_.split("/").pop();this.transport=transport||process.stdout}alert(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"ALERT"),options)}critical(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"CRITICAL"),options)}debug(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"DEBUG"),options)}emergency(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"EMERGENCY"),options)}entry(metadataOrData,data){let metadata;if(!data&&metadataOrData!==null&&Object.prototype.hasOwnProperty.call(metadataOrData,"httpRequest")){metadata=metadataOrData;data={}}else if(!data){data=metadataOrData;metadata={}}else{metadata=metadataOrData}return this.logging.entry(metadata,data)}error(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"ERROR"),options)}info(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"INFO"),options)}notice(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"NOTICE"),options)}warning(entry,options){this.write(log_common_1.assignSeverityToEntries(entry,"WARNING"),options)}write(entry,opts){var _a;const options=opts?opts:{};let structuredEntries;this.formattedName_=log_common_1.formatLogName(this.logging.projectId,this.name);try{structuredEntries=instrumentation_1.populateInstrumentationInfo(entry).map(entry=>{if(!(entry instanceof entry_1.Entry)){entry=this.entry(entry)}return entry.toStructuredJSON(this.logging.projectId)});for(const entry of structuredEntries){entry.logName=this.formattedName_;entry.resource=log_common_1.snakecaseKeys((_a=options.resource)===null||_a===void 0?void 0:_a.labels)||entry.resource||this.logging.detectedResource;entry[entry_1.LABELS_KEY]=options.labels||entry[entry_1.LABELS_KEY];this.transport.write(JSON.stringify(entry)+"\n")}}catch(err){}}}exports.LogSync=LogSync;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LogSync=void 0;const entry_1=require("./entry");const instrumentation_1=require("./utils/instrumentation");const log_common_1=require("./utils/log-common");class LogSync{constructor(logging,name,transport){this.formattedName_=(0,log_common_1.formatLogName)(logging.projectId,name);this.logging=logging;this.name=this.formattedName_.split("/").pop();this.transport=transport||process.stdout}alert(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"ALERT"),options)}critical(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"CRITICAL"),options)}debug(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"DEBUG"),options)}emergency(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"EMERGENCY"),options)}entry(metadataOrData,data){let metadata;if(!data&&metadataOrData!==null&&Object.prototype.hasOwnProperty.call(metadataOrData,"httpRequest")){metadata=metadataOrData;data={}}else if(!data){data=metadataOrData;metadata={}}else{metadata=metadataOrData}return this.logging.entry(metadata,data)}error(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"ERROR"),options)}info(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"INFO"),options)}notice(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"NOTICE"),options)}warning(entry,options){this.write((0,log_common_1.assignSeverityToEntries)(entry,"WARNING"),options)}write(entry,opts){var _a;const options=opts?opts:{};let structuredEntries;this.formattedName_=(0,log_common_1.formatLogName)(this.logging.projectId,this.name);try{structuredEntries=(0,instrumentation_1.populateInstrumentationInfo)(entry).map(entry=>{if(!(entry instanceof entry_1.Entry)){entry=this.entry(entry)}return entry.toStructuredJSON(this.logging.projectId)});for(const entry of structuredEntries){entry.logName=this.formattedName_;entry.resource=(0,log_common_1.snakecaseKeys)((_a=options.resource)===null||_a===void 0?void 0:_a.labels)||entry.resource||this.logging.detectedResource;entry[entry_1.LABELS_KEY]=options.labels||entry[entry_1.LABELS_KEY];this.transport.write(JSON.stringify(entry)+"\n")}}catch(err){}}}exports.LogSync=LogSync;
//# sourceMappingURL=log-sync.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Log=void 0;const promisify_1=require("@google-cloud/promisify");const dotProp=require("dot-prop");const extend=require("extend");const entry_1=require("./entry");const instrumentation_1=require("./utils/instrumentation");const log_common_1=require("./utils/log-common");class Log{constructor(logging,name,options){options=options||{};this.formattedName_=log_common_1.formatLogName(logging.projectId,name);this.removeCircular_=options.removeCircular===true;this.maxEntrySize=options.maxEntrySize;this.logging=logging;this.name=this.formattedName_.split("/").pop();this.jsonFieldsToTruncate=["jsonPayload.fields.metadata.structValue.fields.stack.stringValue","jsonPayload.fields.msg.stringValue","jsonPayload.fields.err.structValue.fields.stack.stringValue","jsonPayload.fields.err.structValue.fields.message.stringValue","jsonPayload.fields.message.stringValue"];if(options.jsonFieldsToTruncate!==null&&options.jsonFieldsToTruncate!==undefined){const filteredList=options.jsonFieldsToTruncate.filter(str=>str!==null&&!this.jsonFieldsToTruncate.includes(str)&&str.startsWith("jsonPayload"));const uniqueSet=new Set(filteredList);this.jsonFieldsToTruncate=Array.from(uniqueSet).concat(this.jsonFieldsToTruncate)}this.defaultWriteDeleteCallback=options.defaultWriteDeleteCallback}alert(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"ALERT"),options)}critical(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"CRITICAL"),options)}debug(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"DEBUG"),options)}async delete(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_=log_common_1.formatLogName(projectId,this.name);const reqOpts={logName:this.formattedName_};return this.logging.loggingService.deleteLog(reqOpts,gaxOptions,this.defaultWriteDeleteCallback)}emergency(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"EMERGENCY"),options)}entry(metadataOrData,data){let metadata;if(!data&&metadataOrData!==null&&Object.prototype.hasOwnProperty.call(metadataOrData,"httpRequest")){metadata=metadataOrData;data={}}else if(!data){data=metadataOrData;metadata={}}else{metadata=metadataOrData}return this.logging.entry(metadata,data)}error(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"ERROR"),options)}async getEntries(opts){const options=extend({},opts);const projectId=await this.logging.auth.getProjectId();this.formattedName_=log_common_1.formatLogName(projectId,this.name);if(options.filter&&!options.filter.includes("logName=")){options.filter=`(${options.filter}) AND logName="${this.formattedName_}"`}else if(!options.filter){options.filter=`logName="${this.formattedName_}"`}return this.logging.getEntries(options)}getEntriesStream(options){options=extend({log:this.name},options);return this.logging.getEntriesStream(options)}tailEntries(options){options=extend({log:this.name},options);return this.logging.tailEntries(options)}info(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"INFO"),options)}notice(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"NOTICE"),options)}warning(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"WARNING"),options)}async write(entry,opts){const isInfoAdded=instrumentation_1.getInstrumentationInfoStatus();const options=opts?opts:{};if(!isInfoAdded){options.partialSuccess=true}await this.logging.setProjectId();this.formattedName_=log_common_1.formatLogName(this.logging.projectId,this.name);const resource=await this.getOrSetResource(options);const decoratedEntries=this.decorateEntries(instrumentation_1.populateInstrumentationInfo(entry));this.truncateEntries(decoratedEntries);const reqOpts=extend({logName:this.formattedName_,entries:decoratedEntries,resource:resource},options);delete reqOpts.gaxOptions;return this.logging.loggingService.writeLogEntries(reqOpts,options.gaxOptions,this.defaultWriteDeleteCallback)}async getOrSetResource(options){if(options.resource){if(options.resource.labels)log_common_1.snakecaseKeys(options.resource.labels);return options.resource}await this.logging.setDetectedResource();return this.logging.detectedResource}decorateEntries(entries){return entries.map(entry=>{if(!(entry instanceof entry_1.Entry)){entry=this.entry(entry)}return entry.toJSON({removeCircular:this.removeCircular_},this.logging.projectId)})}truncateEntries(entries){return entries.forEach(entry=>{if(this.maxEntrySize===undefined)return;const payloadSize=JSON.stringify(entry).length;if(payloadSize<this.maxEntrySize)return;let delta=payloadSize-this.maxEntrySize;if(entry.textPayload){entry.textPayload=entry.textPayload.slice(0,Math.max(entry.textPayload.length-delta,0))}else{for(const field of this.jsonFieldsToTruncate){const msg=dotProp.get(entry,field,"");if(msg!==null&&msg!==undefined&&msg!==""){dotProp.set(entry,field,msg.slice(0,Math.max(msg.length-delta,0)));delta-=Math.min(msg.length,delta);if(delta<=0){break}}}}})}static assignSeverityToEntries_(entries,severity){return log_common_1.assignSeverityToEntries(entries,severity)}static formatName_(projectId,name){return log_common_1.formatLogName(projectId,name)}}exports.Log=Log;promisify_1.callbackifyAll(Log,{exclude:["entry","getEntriesStream"]});
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Log=void 0;const promisify_1=require("@google-cloud/promisify");const dotProp=require("dot-prop");const extend=require("extend");const entry_1=require("./entry");const instrumentation_1=require("./utils/instrumentation");const log_common_1=require("./utils/log-common");class Log{constructor(logging,name,options){options=options||{};this.formattedName_=(0,log_common_1.formatLogName)(logging.projectId,name);this.removeCircular_=options.removeCircular===true;this.maxEntrySize=options.maxEntrySize;this.logging=logging;this.name=this.formattedName_.split("/").pop();this.jsonFieldsToTruncate=["jsonPayload.fields.metadata.structValue.fields.stack.stringValue","jsonPayload.fields.msg.stringValue","jsonPayload.fields.err.structValue.fields.stack.stringValue","jsonPayload.fields.err.structValue.fields.message.stringValue","jsonPayload.fields.message.stringValue"];if(options.jsonFieldsToTruncate!==null&&options.jsonFieldsToTruncate!==undefined){const filteredList=options.jsonFieldsToTruncate.filter(str=>str!==null&&!this.jsonFieldsToTruncate.includes(str)&&str.startsWith("jsonPayload"));const uniqueSet=new Set(filteredList);this.jsonFieldsToTruncate=Array.from(uniqueSet).concat(this.jsonFieldsToTruncate)}this.defaultWriteDeleteCallback=options.defaultWriteDeleteCallback}alert(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"ALERT"),options)}critical(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"CRITICAL"),options)}debug(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"DEBUG"),options)}async delete(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_=(0,log_common_1.formatLogName)(projectId,this.name);const reqOpts={logName:this.formattedName_};return this.logging.loggingService.deleteLog(reqOpts,gaxOptions,this.defaultWriteDeleteCallback)}emergency(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"EMERGENCY"),options)}entry(metadataOrData,data){let metadata;if(!data&&metadataOrData!==null&&Object.prototype.hasOwnProperty.call(metadataOrData,"httpRequest")){metadata=metadataOrData;data={}}else if(!data){data=metadataOrData;metadata={}}else{metadata=metadataOrData}return this.logging.entry(metadata,data)}error(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"ERROR"),options)}async getEntries(opts){const options=extend({},opts);const projectId=await this.logging.auth.getProjectId();this.formattedName_=(0,log_common_1.formatLogName)(projectId,this.name);if(options.filter&&!options.filter.includes("logName=")){options.filter=`(${options.filter}) AND logName="${this.formattedName_}"`}else if(!options.filter){options.filter=`logName="${this.formattedName_}"`}return this.logging.getEntries(options)}getEntriesStream(options){options=extend({log:this.name},options);return this.logging.getEntriesStream(options)}tailEntries(options){options=extend({log:this.name},options);return this.logging.tailEntries(options)}info(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"INFO"),options)}notice(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"NOTICE"),options)}warning(entry,options){return this.write((0,log_common_1.assignSeverityToEntries)(entry,"WARNING"),options)}async write(entry,opts){const isInfoAdded=(0,instrumentation_1.getInstrumentationInfoStatus)();const options=opts?opts:{};if(!isInfoAdded){options.partialSuccess=true}await this.logging.setProjectId();this.formattedName_=(0,log_common_1.formatLogName)(this.logging.projectId,this.name);const resource=await this.getOrSetResource(options);const decoratedEntries=this.decorateEntries((0,instrumentation_1.populateInstrumentationInfo)(entry));this.truncateEntries(decoratedEntries);const reqOpts=extend({logName:this.formattedName_,entries:decoratedEntries,resource:resource},options);delete reqOpts.gaxOptions;return this.logging.loggingService.writeLogEntries(reqOpts,options.gaxOptions,this.defaultWriteDeleteCallback)}async getOrSetResource(options){if(options.resource){if(options.resource.labels)(0,log_common_1.snakecaseKeys)(options.resource.labels);return options.resource}await this.logging.setDetectedResource();return this.logging.detectedResource}decorateEntries(entries){return entries.map(entry=>{if(!(entry instanceof entry_1.Entry)){entry=this.entry(entry)}return entry.toJSON({removeCircular:this.removeCircular_},this.logging.projectId)})}truncateEntries(entries){return entries.forEach(entry=>{if(this.maxEntrySize===undefined)return;const payloadSize=JSON.stringify(entry).length;if(payloadSize<this.maxEntrySize)return;let delta=payloadSize-this.maxEntrySize;if(entry.textPayload){entry.textPayload=entry.textPayload.slice(0,Math.max(entry.textPayload.length-delta,0))}else{for(const field of this.jsonFieldsToTruncate){const msg=dotProp.get(entry,field,"");if(msg!==null&&msg!==undefined&&msg!==""){dotProp.set(entry,field,msg.slice(0,Math.max(msg.length-delta,0)));delta-=Math.min(msg.length,delta);if(delta<=0){break}}}}})}static assignSeverityToEntries_(entries,severity){return(0,log_common_1.assignSeverityToEntries)(entries,severity)}static formatName_(projectId,name){return(0,log_common_1.formatLogName)(projectId,name)}}exports.Log=Log;(0,promisify_1.callbackifyAll)(Log,{exclude:["entry","getEntriesStream"]});
//# sourceMappingURL=log.js.map

@@ -1,2 +0,2 @@

"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){if(k2===undefined)k2=k;Object.defineProperty(o,k2,{enumerable:true,get:function(){return m[k]}})}:function(o,m,k,k2){if(k2===undefined)k2=k;o[k2]=m[k]});var __exportStar=this&&this.__exportStar||function(m,exports){for(var p in m)if(p!=="default"&&!exports.hasOwnProperty(p))__createBinding(exports,m,p)};Object.defineProperty(exports,"__esModule",{value:true});__exportStar(require("./make-middleware"),exports);
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){if(k2===undefined)k2=k;var desc=Object.getOwnPropertyDescriptor(m,k);if(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable)){desc={enumerable:true,get:function(){return m[k]}}}Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){if(k2===undefined)k2=k;o[k2]=m[k]});var __exportStar=this&&this.__exportStar||function(m,exports){for(var p in m)if(p!=="default"&&!Object.prototype.hasOwnProperty.call(exports,p))__createBinding(exports,m,p)};Object.defineProperty(exports,"__esModule",{value:true});__exportStar(require("./make-middleware"),exports);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.makeMiddleware=void 0;const onFinished=require("on-finished");const context_1=require("../../utils/context");const http_request_1=require("../../utils/http-request");function makeMiddleware(projectId,makeChildLogger,emitRequestLog){return(req,res,next)=>{const requestStartMs=Date.now();const traceContext=context_1.getOrInjectContext(req,projectId,true);req.log=makeChildLogger(traceContext.trace,traceContext.spanId,traceContext.traceSampled);if(emitRequestLog){onFinished(res,()=>{const latencyMs=Date.now()-requestStartMs;const httpRequest=http_request_1.makeHttpRequestData(req,res,latencyMs);emitRequestLog(httpRequest,traceContext.trace,traceContext.spanId,traceContext.traceSampled)})}next()}}exports.makeMiddleware=makeMiddleware;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.makeMiddleware=void 0;const onFinished=require("on-finished");const context_1=require("../../utils/context");const http_request_1=require("../../utils/http-request");function makeMiddleware(projectId,makeChildLogger,emitRequestLog){return(req,res,next)=>{const requestStartMs=Date.now();const traceContext=(0,context_1.getOrInjectContext)(req,projectId,true);req.log=makeChildLogger(traceContext.trace,traceContext.spanId,traceContext.traceSampled);if(emitRequestLog){onFinished(res,()=>{const latencyMs=Date.now()-requestStartMs;const httpRequest=(0,http_request_1.makeHttpRequestData)(req,res,latencyMs);emitRequestLog(httpRequest,traceContext.trace,traceContext.spanId,traceContext.traceSampled)})}next()}}exports.makeMiddleware=makeMiddleware;
//# sourceMappingURL=make-middleware.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Sink=void 0;const promisify_1=require("@google-cloud/promisify");const extend=require("extend");class Sink{constructor(logging,name){this.logging=logging;this.name=name;this.formattedName_="projects/"+logging.projectId+"/sinks/"+name}create(config){return this.logging.createSink(this.name,config)}async delete(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_="projects/"+projectId+"/sinks/"+this.name;const reqOpts={sinkName:this.formattedName_};return this.logging.configService.deleteSink(reqOpts,gaxOptions)}async getMetadata(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_="projects/"+projectId+"/sinks/"+this.name;const reqOpts={sinkName:this.formattedName_};[this.metadata]=await this.logging.configService.getSink(reqOpts,gaxOptions);return[this.metadata]}setFilter(filter){return this.setMetadata({filter:filter})}async setMetadata(metadata){const[currentMetadata]=await this.getMetadata();const uniqueWriterIdentity=metadata.uniqueWriterIdentity;delete metadata.uniqueWriterIdentity;let reqOpts={sinkName:this.formattedName_,sink:extend({},currentMetadata,metadata)};delete reqOpts.sink.gaxOptions;reqOpts={...reqOpts,...uniqueWriterIdentity&&{uniqueWriterIdentity:uniqueWriterIdentity}};[this.metadata]=await this.logging.configService.updateSink(reqOpts,metadata.gaxOptions);return[this.metadata]}}exports.Sink=Sink;promisify_1.callbackifyAll(Sink);
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Sink=void 0;const promisify_1=require("@google-cloud/promisify");const extend=require("extend");class Sink{constructor(logging,name){this.logging=logging;this.name=name;this.formattedName_="projects/"+logging.projectId+"/sinks/"+name}create(config){return this.logging.createSink(this.name,config)}async delete(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_="projects/"+projectId+"/sinks/"+this.name;const reqOpts={sinkName:this.formattedName_};return this.logging.configService.deleteSink(reqOpts,gaxOptions)}async getMetadata(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_="projects/"+projectId+"/sinks/"+this.name;const reqOpts={sinkName:this.formattedName_};[this.metadata]=await this.logging.configService.getSink(reqOpts,gaxOptions);return[this.metadata]}setFilter(filter){return this.setMetadata({filter:filter})}async setMetadata(metadata){const[currentMetadata]=await this.getMetadata();const uniqueWriterIdentity=metadata.uniqueWriterIdentity;delete metadata.uniqueWriterIdentity;let reqOpts={sinkName:this.formattedName_,sink:extend({},currentMetadata,metadata)};delete reqOpts.sink.gaxOptions;reqOpts={...reqOpts,...uniqueWriterIdentity&&{uniqueWriterIdentity:uniqueWriterIdentity}};[this.metadata]=await this.logging.configService.updateSink(reqOpts,metadata.gaxOptions);return[this.metadata]}}exports.Sink=Sink;(0,promisify_1.callbackifyAll)(Sink);
//# sourceMappingURL=sink.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.detectServiceContext=exports.getDefaultResource=exports.getGlobalDescriptor=exports.getGKEDescriptor=exports.KUBERNETES_NAMESPACE_ID_PATH=exports.getGCEDescriptor=exports.getGAEDescriptor=exports.getCloudRunDescriptor=exports.getCloudFunctionDescriptor=void 0;const fs=require("fs");const gcpMetadata=require("gcp-metadata");const google_auth_library_1=require("google-auth-library");const util_1=require("util");const readFile=util_1.promisify(fs.readFile);function zoneFromQualifiedZone(qualified){return qualified.split("/").pop()}function regionFromQualifiedZone(qualified){const zone=zoneFromQualifiedZone(qualified);const region=zone===undefined?undefined:zone.slice(0,zone.lastIndexOf("-"));return region}async function getCloudFunctionDescriptor(){let region=undefined;if(!(process.env.GOOGLE_CLOUD_REGION||process.env.FUNCTION_REGION)){const qualifiedZone=await gcpMetadata.instance("zone");region=regionFromQualifiedZone(qualifiedZone)}return{type:"cloud_function",labels:{function_name:process.env.K_SERVICE||process.env.FUNCTION_NAME,region:process.env.GOOGLE_CLOUD_REGION||process.env.FUNCTION_REGION||region}}}exports.getCloudFunctionDescriptor=getCloudFunctionDescriptor;async function getCloudRunDescriptor(){const qualifiedZone=await gcpMetadata.instance("zone");const location=regionFromQualifiedZone(qualifiedZone);return{type:"cloud_run_revision",labels:{location:location,service_name:process.env.K_SERVICE,revision_name:process.env.K_REVISION,configuration_name:process.env.K_CONFIGURATION}}}exports.getCloudRunDescriptor=getCloudRunDescriptor;async function getGAEDescriptor(){const qualifiedZone=await gcpMetadata.instance("zone");const zone=zoneFromQualifiedZone(qualifiedZone);return{type:"gae_app",labels:{module_id:process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME,version_id:process.env.GAE_VERSION,zone:zone}}}exports.getGAEDescriptor=getGAEDescriptor;async function getGCEDescriptor(){const idResponse=await gcpMetadata.instance("id");const zoneResponse=await gcpMetadata.instance("zone");const zone=zoneFromQualifiedZone(zoneResponse);return{type:"gce_instance",labels:{instance_id:idResponse.toString(),zone:zone}}}exports.getGCEDescriptor=getGCEDescriptor;exports.KUBERNETES_NAMESPACE_ID_PATH="/var/run/secrets/kubernetes.io/serviceaccount/namespace";async function getGKEDescriptor(){const resp=await gcpMetadata.instance("attributes/cluster-name");const qualifiedZone=await gcpMetadata.instance("zone");const location=zoneFromQualifiedZone(qualifiedZone);let namespace="";try{namespace=await readFile(exports.KUBERNETES_NAMESPACE_ID_PATH,"utf8")}catch(err){}return{type:"k8s_container",labels:{location:location,cluster_name:resp,namespace_name:namespace,pod_name:process.env.HOSTNAME,container_name:process.env.CONTAINER_NAME}}}exports.getGKEDescriptor=getGKEDescriptor;function getGlobalDescriptor(){return{type:"global"}}exports.getGlobalDescriptor=getGlobalDescriptor;async function getDefaultResource(auth){const env=await auth.getEnv();switch(env){case google_auth_library_1.GCPEnv.KUBERNETES_ENGINE:return getGKEDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.APP_ENGINE:return getGAEDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.CLOUD_FUNCTIONS:return getCloudFunctionDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.CLOUD_RUN:return getCloudRunDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.COMPUTE_ENGINE:return getGCEDescriptor().catch(()=>getGlobalDescriptor());default:return getGlobalDescriptor()}}exports.getDefaultResource=getDefaultResource;async function detectServiceContext(auth){const env=await auth.getEnv();switch(env){case google_auth_library_1.GCPEnv.APP_ENGINE:return{service:process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME,version:process.env.GAE_VERSION||process.env.GAE_MODULE_VERSION};case google_auth_library_1.GCPEnv.CLOUD_FUNCTIONS:return{service:process.env.FUNCTION_NAME};case google_auth_library_1.GCPEnv.KUBERNETES_ENGINE:return{service:process.env.HOSTNAME};case google_auth_library_1.GCPEnv.CLOUD_RUN:return{service:process.env.K_SERVICE};case google_auth_library_1.GCPEnv.COMPUTE_ENGINE:return null;default:return null}}exports.detectServiceContext=detectServiceContext;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.detectServiceContext=exports.getDefaultResource=exports.getGlobalDescriptor=exports.getGKEDescriptor=exports.KUBERNETES_NAMESPACE_ID_PATH=exports.getGCEDescriptor=exports.getGAEDescriptor=exports.getCloudRunDescriptor=exports.getCloudFunctionDescriptor=void 0;const fs=require("fs");const gcpMetadata=require("gcp-metadata");const google_auth_library_1=require("google-auth-library");const util_1=require("util");const readFile=(0,util_1.promisify)(fs.readFile);function zoneFromQualifiedZone(qualified){return qualified.split("/").pop()}function regionFromQualifiedZone(qualified){const zone=zoneFromQualifiedZone(qualified);const region=zone===undefined?undefined:zone.slice(0,zone.lastIndexOf("-"));return region}async function getCloudFunctionDescriptor(){let region=undefined;if(!(process.env.GOOGLE_CLOUD_REGION||process.env.FUNCTION_REGION)){const qualifiedZone=await gcpMetadata.instance("zone");region=regionFromQualifiedZone(qualifiedZone)}return{type:"cloud_function",labels:{function_name:process.env.K_SERVICE||process.env.FUNCTION_NAME,region:process.env.GOOGLE_CLOUD_REGION||process.env.FUNCTION_REGION||region}}}exports.getCloudFunctionDescriptor=getCloudFunctionDescriptor;async function getCloudRunDescriptor(){const qualifiedZone=await gcpMetadata.instance("zone");const location=regionFromQualifiedZone(qualifiedZone);return{type:"cloud_run_revision",labels:{location:location,service_name:process.env.K_SERVICE,revision_name:process.env.K_REVISION,configuration_name:process.env.K_CONFIGURATION}}}exports.getCloudRunDescriptor=getCloudRunDescriptor;async function getGAEDescriptor(){const qualifiedZone=await gcpMetadata.instance("zone");const zone=zoneFromQualifiedZone(qualifiedZone);return{type:"gae_app",labels:{module_id:process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME,version_id:process.env.GAE_VERSION,zone:zone}}}exports.getGAEDescriptor=getGAEDescriptor;async function getGCEDescriptor(){const idResponse=await gcpMetadata.instance("id");const zoneResponse=await gcpMetadata.instance("zone");const zone=zoneFromQualifiedZone(zoneResponse);return{type:"gce_instance",labels:{instance_id:idResponse.toString(),zone:zone}}}exports.getGCEDescriptor=getGCEDescriptor;exports.KUBERNETES_NAMESPACE_ID_PATH="/var/run/secrets/kubernetes.io/serviceaccount/namespace";async function getGKEDescriptor(){const resp=await gcpMetadata.instance("attributes/cluster-name");const qualifiedZone=await gcpMetadata.instance("zone");const location=zoneFromQualifiedZone(qualifiedZone);let namespace="";try{namespace=await readFile(exports.KUBERNETES_NAMESPACE_ID_PATH,"utf8")}catch(err){}return{type:"k8s_container",labels:{location:location,cluster_name:resp,namespace_name:namespace,pod_name:process.env.HOSTNAME,container_name:process.env.CONTAINER_NAME}}}exports.getGKEDescriptor=getGKEDescriptor;function getGlobalDescriptor(){return{type:"global"}}exports.getGlobalDescriptor=getGlobalDescriptor;async function getDefaultResource(auth){const env=await auth.getEnv();switch(env){case google_auth_library_1.GCPEnv.KUBERNETES_ENGINE:return getGKEDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.APP_ENGINE:return getGAEDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.CLOUD_FUNCTIONS:return getCloudFunctionDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.CLOUD_RUN:return getCloudRunDescriptor().catch(()=>getGlobalDescriptor());case google_auth_library_1.GCPEnv.COMPUTE_ENGINE:return getGCEDescriptor().catch(()=>getGlobalDescriptor());default:return getGlobalDescriptor()}}exports.getDefaultResource=getDefaultResource;async function detectServiceContext(auth){const env=await auth.getEnv();switch(env){case google_auth_library_1.GCPEnv.APP_ENGINE:return{service:process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME,version:process.env.GAE_VERSION||process.env.GAE_MODULE_VERSION};case google_auth_library_1.GCPEnv.CLOUD_FUNCTIONS:return{service:process.env.FUNCTION_NAME};case google_auth_library_1.GCPEnv.KUBERNETES_ENGINE:return{service:process.env.HOSTNAME};case google_auth_library_1.GCPEnv.CLOUD_RUN:return{service:process.env.K_SERVICE};case google_auth_library_1.GCPEnv.COMPUTE_ENGINE:return null;default:return null}}exports.detectServiceContext=detectServiceContext;
//# sourceMappingURL=metadata.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});var config_service_v2_client_1=require("./config_service_v2_client");Object.defineProperty(exports,"ConfigServiceV2Client",{enumerable:true,get:function(){return config_service_v2_client_1.ConfigServiceV2Client}});var logging_service_v2_client_1=require("./logging_service_v2_client");Object.defineProperty(exports,"LoggingServiceV2Client",{enumerable:true,get:function(){return logging_service_v2_client_1.LoggingServiceV2Client}});var metrics_service_v2_client_1=require("./metrics_service_v2_client");Object.defineProperty(exports,"MetricsServiceV2Client",{enumerable:true,get:function(){return metrics_service_v2_client_1.MetricsServiceV2Client}});
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MetricsServiceV2Client=exports.LoggingServiceV2Client=exports.ConfigServiceV2Client=void 0;var config_service_v2_client_1=require("./config_service_v2_client");Object.defineProperty(exports,"ConfigServiceV2Client",{enumerable:true,get:function(){return config_service_v2_client_1.ConfigServiceV2Client}});var logging_service_v2_client_1=require("./logging_service_v2_client");Object.defineProperty(exports,"LoggingServiceV2Client",{enumerable:true,get:function(){return logging_service_v2_client_1.LoggingServiceV2Client}});var metrics_service_v2_client_1=require("./metrics_service_v2_client");Object.defineProperty(exports,"MetricsServiceV2Client",{enumerable:true,get:function(){return metrics_service_v2_client_1.MetricsServiceV2Client}});
//# sourceMappingURL=index.js.map

@@ -123,3 +123,7 @@ /// <reference types="node" />

*/
getLogMetric(request?: protos.google.logging.v2.IGetLogMetricRequest, options?: CallOptions): Promise<[protos.google.logging.v2.ILogMetric, protos.google.logging.v2.IGetLogMetricRequest | undefined, {} | undefined]>;
getLogMetric(request?: protos.google.logging.v2.IGetLogMetricRequest, options?: CallOptions): Promise<[
protos.google.logging.v2.ILogMetric,
protos.google.logging.v2.IGetLogMetricRequest | undefined,
{} | undefined
]>;
getLogMetric(request: protos.google.logging.v2.IGetLogMetricRequest, options: CallOptions, callback: Callback<protos.google.logging.v2.ILogMetric, protos.google.logging.v2.IGetLogMetricRequest | null | undefined, {} | null | undefined>): void;

@@ -151,3 +155,7 @@ getLogMetric(request: protos.google.logging.v2.IGetLogMetricRequest, callback: Callback<protos.google.logging.v2.ILogMetric, protos.google.logging.v2.IGetLogMetricRequest | null | undefined, {} | null | undefined>): void;

*/
createLogMetric(request?: protos.google.logging.v2.ICreateLogMetricRequest, options?: CallOptions): Promise<[protos.google.logging.v2.ILogMetric, protos.google.logging.v2.ICreateLogMetricRequest | undefined, {} | undefined]>;
createLogMetric(request?: protos.google.logging.v2.ICreateLogMetricRequest, options?: CallOptions): Promise<[
protos.google.logging.v2.ILogMetric,
protos.google.logging.v2.ICreateLogMetricRequest | undefined,
{} | undefined
]>;
createLogMetric(request: protos.google.logging.v2.ICreateLogMetricRequest, options: CallOptions, callback: Callback<protos.google.logging.v2.ILogMetric, protos.google.logging.v2.ICreateLogMetricRequest | null | undefined, {} | null | undefined>): void;

@@ -180,3 +188,7 @@ createLogMetric(request: protos.google.logging.v2.ICreateLogMetricRequest, callback: Callback<protos.google.logging.v2.ILogMetric, protos.google.logging.v2.ICreateLogMetricRequest | null | undefined, {} | null | undefined>): void;

*/
updateLogMetric(request?: protos.google.logging.v2.IUpdateLogMetricRequest, options?: CallOptions): Promise<[protos.google.logging.v2.ILogMetric, protos.google.logging.v2.IUpdateLogMetricRequest | undefined, {} | undefined]>;
updateLogMetric(request?: protos.google.logging.v2.IUpdateLogMetricRequest, options?: CallOptions): Promise<[
protos.google.logging.v2.ILogMetric,
protos.google.logging.v2.IUpdateLogMetricRequest | undefined,
{} | undefined
]>;
updateLogMetric(request: protos.google.logging.v2.IUpdateLogMetricRequest, options: CallOptions, callback: Callback<protos.google.logging.v2.ILogMetric, protos.google.logging.v2.IUpdateLogMetricRequest | null | undefined, {} | null | undefined>): void;

@@ -203,3 +215,7 @@ updateLogMetric(request: protos.google.logging.v2.IUpdateLogMetricRequest, callback: Callback<protos.google.logging.v2.ILogMetric, protos.google.logging.v2.IUpdateLogMetricRequest | null | undefined, {} | null | undefined>): void;

*/
deleteLogMetric(request?: protos.google.logging.v2.IDeleteLogMetricRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.logging.v2.IDeleteLogMetricRequest | undefined, {} | undefined]>;
deleteLogMetric(request?: protos.google.logging.v2.IDeleteLogMetricRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
protos.google.logging.v2.IDeleteLogMetricRequest | undefined,
{} | undefined
]>;
deleteLogMetric(request: protos.google.logging.v2.IDeleteLogMetricRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.logging.v2.IDeleteLogMetricRequest | null | undefined, {} | null | undefined>): void;

@@ -238,3 +254,7 @@ deleteLogMetric(request: protos.google.logging.v2.IDeleteLogMetricRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.logging.v2.IDeleteLogMetricRequest | null | undefined, {} | null | undefined>): void;

*/
listLogMetrics(request?: protos.google.logging.v2.IListLogMetricsRequest, options?: CallOptions): Promise<[protos.google.logging.v2.ILogMetric[], protos.google.logging.v2.IListLogMetricsRequest | null, protos.google.logging.v2.IListLogMetricsResponse]>;
listLogMetrics(request?: protos.google.logging.v2.IListLogMetricsRequest, options?: CallOptions): Promise<[
protos.google.logging.v2.ILogMetric[],
protos.google.logging.v2.IListLogMetricsRequest | null,
protos.google.logging.v2.IListLogMetricsResponse
]>;
listLogMetrics(request: protos.google.logging.v2.IListLogMetricsRequest, options: CallOptions, callback: PaginationCallback<protos.google.logging.v2.IListLogMetricsRequest, protos.google.logging.v2.IListLogMetricsResponse | null | undefined, protos.google.logging.v2.ILogMetric>): void;

@@ -241,0 +261,0 @@ listLogMetrics(request: protos.google.logging.v2.IListLogMetricsRequest, callback: PaginationCallback<protos.google.logging.v2.IListLogMetricsRequest, protos.google.logging.v2.IListLogMetricsResponse | null | undefined, protos.google.logging.v2.ILogMetric>): void;

{
"name": "@google-cloud/logging-min",
"version": "9.9.0",
"version": "10.0.0",
"description": "Stackdriver Logging Client Library for Node.js",

@@ -51,3 +51,3 @@ "keywords": [

"@google-cloud/projectify": "^2.0.0",
"@google-cloud/promisify": "^2.0.0",
"@google-cloud/promisify": "^3.0.0",
"arrify": "^2.0.1",

@@ -58,4 +58,4 @@ "dot-prop": "^6.0.0",

"gcp-metadata": "^4.0.0",
"google-auth-library": "^7.0.0",
"google-gax": "^2.24.1",
"google-auth-library": "^8.0.2",
"google-gax": "^3.0.1",
"on-finished": "^2.3.0",

@@ -81,3 +81,3 @@ "pumpify": "^2.0.1",

"codecov": "^3.6.5",
"gts": "^3.0.0",
"gts": "^3.1.0",
"http2spy": "^2.0.0",

@@ -88,3 +88,3 @@ "jsdoc": "^3.6.3",

"linkinator": "^2.0.3",
"mocha": "^8.0.0",
"mocha": "^9.2.2",
"nock": "^13.0.0",

@@ -96,10 +96,10 @@ "null-loader": "^4.0.0",

"ts-loader": "^9.0.0",
"typescript": "^3.8.3",
"typescript": "^4.6.4",
"uglify-js": "^3.13.5",
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0",
"uglify-js": "^3.13.5"
"webpack-cli": "^4.0.0"
},
"engines": {
"node": ">=10"
"node": ">=12.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc