/var/www/greso.tech/server/nsm/node_modules/google-gax/build/src
NameSizeModeActions
bundlingCalls/-0755rm
longRunningCalls/-0755rm
normalCalls/-0755rm
paginationCalls/-0755rm
streamingCalls/-0755rm
apiCaller.d.ts17460644editdlrm
apiCaller.js10370644editdlrm
apiCaller.js.map3220644editdlrm
apitypes.d.ts27900644editdlrm
apitypes.js7090644editdlrm
apitypes.js.map1340644editdlrm
call.d.ts19570644editdlrm
call.js38850644editdlrm
call.js.map21100644editdlrm
clientInterface.d.ts17520644editdlrm
clientInterface.js9080644editdlrm
clientInterface.js.map3330644editdlrm
createApiCall.d.ts18020644editdlrm
createApiCall.js44980644editdlrm
createApiCall.js.map18740644editdlrm
descriptor.d.ts10730644editdlrm
descriptor.js16910644editdlrm
descriptor.js.map2860644editdlrm
fallback.d.ts77610644editdlrm
fallback.js169910644editdlrm
fallback.js.map71960644editdlrm
fallbackProto.d.ts9460644editdlrm
fallbackProto.js22660644editdlrm
fallbackProto.js.map14290644editdlrm
fallbackRest.d.ts9690644editdlrm
fallbackRest.js33530644editdlrm
fallbackRest.js.map21390644editdlrm
fallbackServiceStub.d.ts16830644editdlrm
fallbackServiceStub.js63260644editdlrm
fallbackServiceStub.js.map36630644editdlrm
featureDetection.d.ts8560644editdlrm
featureDetection.js21140644editdlrm
featureDetection.js.map9240644editdlrm
gax.d.ts150500644editdlrm
gax.js225200644editdlrm
gax.js.map83600644editdlrm
googleError.d.ts24260644editdlrm
googleError.js98850644editdlrm
googleError.js.map60230644editdlrm
grpc.d.ts90250644editdlrm
grpc.js206320644editdlrm
grpc.js.map114160644editdlrm
iamService.d.ts59540644editdlrm
iamService.js90530644editdlrm
iamService.js.map59480644editdlrm
iam_policy_service_client_config.json10630644editdlrm
index.d.ts31010644editdlrm
index.js74500644editdlrm
index.js.map16800644editdlrm
locationService.d.ts74100644editdlrm
locationService.js170790644editdlrm
locationService.js.map70410644editdlrm
locations_client_config.json9330644editdlrm
operationsClient.d.ts163130644editdlrm
operationsClient.js199830644editdlrm
operationsClient.js.map57430644editdlrm
operations_client_config.json12490644editdlrm
pathTemplate.d.ts19660644editdlrm
pathTemplate.js99330644editdlrm
pathTemplate.js.map65950644editdlrm
protobuf.d.ts6510644editdlrm
protobuf.js10370644editdlrm
protobuf.js.map2070644editdlrm
protosList.json49210644editdlrm
routingHeader.d.ts11240644editdlrm
routingHeader.js13170644editdlrm
routingHeader.js.map2830644editdlrm
status.d.ts11530644editdlrm
status.js32290644editdlrm
status.js.map15700644editdlrm
streamArrayParser.d.ts22730644editdlrm
streamArrayParser.js61690644editdlrm
streamArrayParser.js.map32590644editdlrm
transcoding.d.ts23710644editdlrm
transcoding.js108770644editdlrm
transcoding.js.map86740644editdlrm
util.d.ts12540644editdlrm
util.js34730644editdlrm
util.js.map23590644editdlrm
warnings.d.ts6820644editdlrm
warnings.js13810644editdlrm
warnings.js.map6340644editdlrm
Edit: /var/www/greso.tech/server/nsm/node_modules/google-gax/build/src/pathTemplate.js (9933B)
"use strict"; /** * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PathTemplate = void 0; class PathTemplate { /** * @param {String} data the of the template * * @constructor */ constructor(data) { this.bindings = {}; this.data = data; this.segments = this.parsePathTemplate(data); this.size = this.segments.length; } /** * Matches a fully-qualified path template string. * * @param {String} path a fully-qualified path template string * @return {Object} contains const names matched to binding values * @throws {TypeError} if path can't be matched to this template */ match(path) { let pathSegments = path.split('/'); const bindings = {}; if (pathSegments.length !== this.segments.length) { // if the path contains a wildcard, then the length may differ by 1. if (!this.data.includes('**')) { throw new TypeError(`This path ${path} does not match path template ${this.data}, the number of parameters is not same.`); } else if (pathSegments.length !== this.segments.length + 1) { throw new TypeError(`This path ${path} does not match path template ${this.data}, the number of parameters is not same with one wildcard.`); } } for (let index = 0; index < this.segments.length && pathSegments.length > 0; index++) { if (this.segments[index] !== pathSegments[0]) { if (!this.segments[index].includes('*')) { throw new TypeError(`segment does not match, ${this.segments[index]} and ${pathSegments[index]}.`); } else { let segment = this.segments[index]; const matches = segment.match(/\{[$0-9a-zA-Z_]+=.*?\}/g); if (!matches) { throw new Error(`Error processing path template segment ${segment}`); } const variables = matches.map(str => str.replace(/^\{/, '').replace(/=.*/, '')); if (segment.includes('**')) { bindings[variables[0]] = pathSegments[0] + '/' + pathSegments[1]; pathSegments = pathSegments.slice(2); } else { // atomic resource if (variables.length === 1) { bindings[variables[0]] = pathSegments[0]; } else { // non-slash resource // segment: {blurb_id=*}.{legacy_user=*} to match pathSegments: ['bar.user2'] // split the match pathSegments[0] -> value: ['bar', 'user2'] // compare the length of two arrays, and compare array items const value = pathSegments[0].split(/[-_.~]/); if (value.length !== variables.length) { throw new Error(`segment ${segment} does not match ${pathSegments[0]}`); } for (const v of variables) { bindings[v] = value[0]; segment = segment.replace(`{${v}=*}`, `${value[0]}`); value.shift(); } // segment: {blurb_id=*}.{legacy_user=*} matching pathSegments: ['bar~user2'] should fail if (segment !== pathSegments[0]) { throw new TypeError(`non slash resource pattern ${this.segments[index]} and ${pathSegments[0]} should have same separator`); } } pathSegments.shift(); } } } else { pathSegments.shift(); } } return bindings; } /** * Renders a path template using the provided bindings. * * @param {Object} bindings a mapping of const names to binding strings * @return {String} a rendered representation of the path template * @throws {TypeError} if a key is missing, or if a sub-template cannot be * parsed */ render(bindings) { if (Object.keys(bindings).length !== Object.keys(this.bindings).length) { throw new TypeError(`The number of variables ${Object.keys(bindings).length} does not match the number of needed variables ${Object.keys(this.bindings).length}`); } let path = this.inspect(); for (const key of Object.keys(bindings)) { const b = bindings[key].toString(); if (!this.bindings[key]) { throw new TypeError(`render fails for not matching ${bindings[key]}`); } const variable = this.bindings[key]; if (variable === '*') { if (!b.match(/[^/{}]+/)) { throw new TypeError(`render fails for not matching ${b}`); } path = path.replace(`{${key}=*}`, `${b}`); } else if (variable === '**') { if (!b.match(/[^{}]+/)) { throw new TypeError(`render fails for not matching ${b}`); } path = path.replace(`{${key}=**}`, `${b}`); } } return path; } /** * Renders the path template. * * @return {string} contains const names matched to binding values */ inspect() { return this.segments.join('/'); } /** * Parse the path template. * * @return {string[]} return segments of the input path. * For example: 'buckets/{hello}'' will give back ['buckets', {hello=*}] */ parsePathTemplate(data) { const pathSegments = splitPathTemplate(data); let index = 0; let wildCardCount = 0; const segments = []; let matches; pathSegments.forEach(segment => { // * or ** -> segments.push('{$0=*}'); // -> bindings['$0'] = '*' if (segment === '*' || segment === '**') { this.bindings[`$${index}`] = segment; segments.push(`{$${index}=${segment}}`); index = index + 1; if (segment === '**') { ++wildCardCount; } } else if ((matches = segment.match(/\{[0-9a-zA-Z-.~_]+(?:=.*?)?\}/g))) { for (const subsegment of matches) { const pairMatch = subsegment.match(/^\{([0-9a-zA-Z-.~_]+)(?:=(.*?))?\}$/); if (!pairMatch) { throw new Error(`Cannot process path template segment ${subsegment}`); } const key = pairMatch[1]; let value = pairMatch[2]; if (!value) { value = '*'; segment = segment.replace(key, key + '=*'); this.bindings[key] = value; } else if (value === '*') { this.bindings[key] = value; } else if (value === '**') { ++wildCardCount; this.bindings[key] = value; } } segments.push(segment); } else if (segment.match(/[0-9a-zA-Z-.~_]+/)) { segments.push(segment); } }); if (wildCardCount > 1) { throw new TypeError('Can not have more than one wildcard.'); } return segments; } } exports.PathTemplate = PathTemplate; /** * Split the path template by `/`. * It can not be simply splitted by `/` because there might be `/` in the segments. * For example: 'a/b/{a=hello/world}' we do not want to break the brackets pair * so above path will be splitted as ['a', 'b', '{a=hello/world}'] */ function splitPathTemplate(data) { let left = 0; let right = 0; let bracketCount = 0; const segments = []; while (right >= left && right < data.length) { if (data.charAt(right) === '{') { bracketCount = bracketCount + 1; } else if (data.charAt(right) === '}') { bracketCount = bracketCount - 1; } else if (data.charAt(right) === '/') { if (right === data.length - 1) { throw new TypeError('Invalid path, it can not be ended by /'); } if (bracketCount === 0) { // complete bracket, to avoid the case a/b/**/*/{a=hello/world} segments.push(data.substring(left, right)); left = right + 1; } } if (right === data.length - 1) { if (bracketCount !== 0) { throw new TypeError('Brackets are invalid.'); } segments.push(data.substring(left)); } right = right + 1; } return segments; } //# sourceMappingURL=pathTemplate.js.map