Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker:
digest: sha256:f556e6e7be625deb1b2429fe608df27be57185c3e6b7d39ee0059f1609f17530
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest

19 changes: 19 additions & 0 deletions .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 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.
docker:
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest


begin-after-commit-hash: 397c0bfd367a2427104f988d5329bc117caafd95

16 changes: 16 additions & 0 deletions .github/generated-files-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
generatedFiles:
- path: '.kokoro/**'
message: '`.kokoro` files are templated and should be updated in [`synthtool`](https://github.com/googleapis/synthtool)'
- path: '.github/CODEOWNERS'
message: 'CODEOWNERS should instead be modified via the `codeowner_team` property in .repo-metadata.json'
- path: '.github/workflows/**'
message: '`.github/workflows` (GitHub Actions) should be updated in [`synthtool`](https://github.com/googleapis/synthtool)'
- path: '.github/generated-files-bot.+(yml|yaml)'
message: '`.github/generated-files-bot.(yml|yaml)` should be updated in [`synthtool`](https://github.com/googleapis/synthtool)'
- path: 'README.md'
message: '`README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml'
- path: 'samples/README.md'
message: '`samples/README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml'
ignoreAuthors:
- 'gcf-owl-bot[bot]'
- 'yoshi-automation'
14 changes: 1 addition & 13 deletions synth.py → owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.node as node
import logging

logging.basicConfig(level=logging.DEBUG)

AUTOSYNTH_MULTIPLE_COMMITS = True

common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates, excludes=['.eslintignore', '.mocharc.js', '.github/workflows/ci.yaml'])

node.install()
node.fix()
node.owlbot_main(templates_excludes=['.eslintignore', '.mocharc.js', '.github/workflows/ci.yaml'])
4 changes: 2 additions & 2 deletions src/agent/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Controller extends ServiceObject {
} else if (response.statusCode === 404) {
// The v2 API returns 404 (google.rpc.Code.NOT_FOUND) when the agent
// registration expires. We should re-register.
callback(null, (response as {}) as t.Response);
callback(null, response as {} as t.Response);
return;
} else if (response.statusCode !== 200) {
callback(
Expand All @@ -146,7 +146,7 @@ export class Controller extends ServiceObject {
} else {
body = body || {};
that.nextWaitToken = body.nextWaitToken;
callback(null, (response as {}) as t.Response, body);
callback(null, response as {} as t.Response, body);
}
}
);
Expand Down
34 changes: 18 additions & 16 deletions src/agent/debuglet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export class Debuglet extends EventEmitter {
let sourceContext;
try {
sourceContext =
((that.config.sourceContext as {}) as SourceContext) ||
(that.config.sourceContext as {} as SourceContext) ||
(await Debuglet.getSourceContextFromFile());
} catch (err5) {
that.logger.warn('Unable to discover source context', err5);
Expand Down Expand Up @@ -741,9 +741,11 @@ export class Debuglet extends EventEmitter {
);
// TODO: Handle the case when `that.debuggee` is null.
// TODO: Handle the case when `result` is undefined.
(that.debuggee as Debuggee).id = (result as {
debuggee: Debuggee;
}).debuggee.id;
(that.debuggee as Debuggee).id = (
result as {
debuggee: Debuggee;
}
).debuggee.id;
// TODO: Handle the case when `result` is undefined.
that.emit('registered', (result as {debuggee: Debuggee}).debuggee.id);
that.debuggeeRegistered.resolve();
Expand Down Expand Up @@ -926,9 +928,7 @@ export class Debuglet extends EventEmitter {
// field. It is possible that breakpoint.id is always
// undefined!
// TODO: Make sure the use of `that` here is correct.
delete that.completedBreakpointMap[
((breakpoint as {}) as {id: number}).id
];
delete that.completedBreakpointMap[(breakpoint as {} as {id: number}).id];
});

// Remove active breakpoints that the server no longer care about.
Expand All @@ -946,9 +946,9 @@ export class Debuglet extends EventEmitter {
* @return {Object.<string, Breakpoint>} A map of breakpoint IDs to breakpoints.
* @private
*/
convertBreakpointListToMap_(
breakpointList: stackdriver.Breakpoint[]
): {[key: string]: stackdriver.Breakpoint} {
convertBreakpointListToMap_(breakpointList: stackdriver.Breakpoint[]): {
[key: string]: stackdriver.Breakpoint;
} {
const map: {[id: string]: stackdriver.Breakpoint} = {};
breakpointList.forEach(breakpoint => {
// TODO: Address the case when `breakpoint.id` is `undefined`.
Expand Down Expand Up @@ -1098,13 +1098,15 @@ export class Debuglet extends EventEmitter {
const that = this;

// TODO: Address the case when `that.debuggee` is `null`.
that.controller.updateBreakpoint(that.debuggee as Debuggee, breakpoint, (
err /*, body*/
) => {
if (err) {
that.logger.error('Unable to complete breakpoint on server', err);
that.controller.updateBreakpoint(
that.debuggee as Debuggee,
breakpoint,
(err /*, body*/) => {
if (err) {
that.logger.error('Unable to complete breakpoint on server', err);
}
}
});
);
}

/**
Expand Down
11 changes: 6 additions & 5 deletions src/agent/io/sourcemapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ async function processSourcemap(
// TODO: Resolve the cast of `contents as any` (This is needed because the
// type is expected to be of `RawSourceMap` but the existing
// working code uses a string.)
consumer = (new sourceMap.SourceMapConsumer(
(contents as {}) as sourceMap.RawSourceMap
) as {}) as sourceMap.RawSourceMap;
consumer = new sourceMap.SourceMapConsumer(
contents as {} as sourceMap.RawSourceMap
) as {} as sourceMap.RawSourceMap;
} catch (e) {
throw new Error(
'An error occurred while reading the ' +
Expand Down Expand Up @@ -246,7 +246,8 @@ export class SourceMapper {
};

// TODO: Determine how to remove the explicit cast here.
const consumer: sourceMap.SourceMapConsumer = (entry.mapConsumer as {}) as sourceMap.SourceMapConsumer;
const consumer: sourceMap.SourceMapConsumer =
entry.mapConsumer as {} as sourceMap.SourceMapConsumer;
const allPos = consumer.allGeneratedPositionsFor(sourcePos);
/*
* Based on testing, it appears that the following code is needed to
Expand All @@ -270,7 +271,7 @@ export class SourceMapper {
// TODO: The `sourceMap.Position` type definition has a `column`
// attribute and not a `col` attribute. Determine if the type
// definition or this code is correct.
column: ((mappedPos as {}) as {col: number}).col, // SourceMapConsumer uses
column: (mappedPos as {} as {col: number}).col, // SourceMapConsumer uses
// zero-based column
// numbers which is the
// same as the expected
Expand Down
2 changes: 1 addition & 1 deletion src/agent/state/inspector-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class StateResolver {
};

// TODO: Determine why _extend is used here
this.resolvedVariableTable = ((util as {}) as {_extend: Function})._extend(
this.resolvedVariableTable = (util as {} as {_extend: Function})._extend(
[],
this.messageTable
);
Expand Down
4 changes: 2 additions & 2 deletions src/agent/state/legacy-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class StateResolver {
};

// TODO: Determine why _extend is used here
this.resolvedVariableTable = ((util as {}) as {_extend: Function})._extend(
this.resolvedVariableTable = (util as {} as {_extend: Function})._extend(
[],
this.messageTable
);
Expand All @@ -148,7 +148,7 @@ class StateResolver {

// This constructor is only used in situations where the legacy vm
// interface is used that has the `runInDebugContext` method.
this.scopeType = ((vm as {}) as LegacyVm).runInDebugContext('ScopeType');
this.scopeType = (vm as {} as LegacyVm).runInDebugContext('ScopeType');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/agent/util/debug-assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ const fakeAssert: FakeAssert = {

export function debugAssert(enableAssertions: boolean): FakeAssert {
// The typecast is needed since the @types/node doesn't cover Node 10 yet
return enableAssertions ? ((realAssert as {}) as FakeAssert) : fakeAssert;
return enableAssertions ? (realAssert as {} as FakeAssert) : fakeAssert;
}
11 changes: 7 additions & 4 deletions src/agent/v8/inspector-debugapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,11 @@ export class InspectorDebugApi implements debugapi.DebugApi {
// TODO: Address the case where `breakpoint.id` is `null`.
breakpoint.expressions[i] =
// TODO: Address the case where `compile` is `null`.
(this.breakpoints[breakpoint.id].compile as (
text: string
) => string)(breakpoint.expressions[i]);
(
this.breakpoints[breakpoint.id].compile as (
text: string
) => string
)(breakpoint.expressions[i]);
} catch (e) {
this.logger.info(
'Unable to compile watch expression >> ' +
Expand Down Expand Up @@ -617,7 +619,8 @@ export class InspectorDebugApi implements debugapi.DebugApi {
breakpoint.stackFrames = captured.stackFrames;
// TODO: This suggests the Status type and Variable type are the same.
// Determine if that is the case.
breakpoint.variableTable = captured.variableTable as stackdriver.Variable[];
breakpoint.variableTable =
captured.variableTable as stackdriver.Variable[];
breakpoint.evaluatedExpressions = expressionErrors.concat(
captured.evaluatedExpressions
);
Expand Down
13 changes: 8 additions & 5 deletions src/agent/v8/legacy-debugapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class V8DebugApi implements debugapi.DebugApi {
this.sourcemapper = sourcemapper;
// This constructor is only used in situations where the legacy vm
// interface is used that has the `runInDebugContext` method.
this.v8 = ((vm as {}) as LegacyVm).runInDebugContext('Debug');
this.v8 = (vm as {} as LegacyVm).runInDebugContext('Debug');
this.config = config;
this.fileStats = jsFiles;
this.v8Version = /(\d+\.\d+\.\d+)\.\d+/.exec(process.versions.v8);
Expand Down Expand Up @@ -522,9 +522,11 @@ export class V8DebugApi implements debugapi.DebugApi {
try {
breakpoint.expressions[i] =
// TODO: Address the case where `compile` is `null`.
(this.breakpoints[breakpoint.id].compile as (
text: string
) => string)(breakpoint.expressions[i]);
(
this.breakpoints[breakpoint.id].compile as (
text: string
) => string
)(breakpoint.expressions[i]);
} catch (e) {
this.logger.info(
'Unable to compile watch expression >> ' +
Expand Down Expand Up @@ -579,7 +581,8 @@ export class V8DebugApi implements debugapi.DebugApi {
breakpoint.stackFrames = captured.stackFrames;
// TODO: This suggests the Status type and Variable type are the same.
// Determine if that is the case.
breakpoint.variableTable = captured.variableTable as stackdriver.Variable[];
breakpoint.variableTable =
captured.variableTable as stackdriver.Variable[];
breakpoint.evaluatedExpressions = expressionErrors.concat(
captured.evaluatedExpressions
);
Expand Down
18 changes: 0 additions & 18 deletions synth.metadata

This file was deleted.

2 changes: 1 addition & 1 deletion system-test/test-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {ncp} from 'ncp';
import * as tmp from 'tmp-promise';
import {promisify} from 'util';

const mvp = (promisify(mv) as {}) as (...args: string[]) => Promise<void>;
const mvp = promisify(mv) as {} as (...args: string[]) => Promise<void>;
const ncpp = promisify(ncp);
const stagingDir = tmp.dirSync({keep: false, unsafeCleanup: true});
const stagingPath = stagingDir.name;
Expand Down
6 changes: 3 additions & 3 deletions test/test-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ delete process.env.GCLOUD_PROJECT;

import {Controller} from '../src/agent/controller';
// TODO: Fix fakeDebug to actually implement Debug.
const fakeDebug = ({
const fakeDebug = {
apiEndpoint: 'clouddebugger.googleapis.com',
request: (options: t.Options, cb: t.RequestCallback) => {
teenyRequest(options, (err, r) => {
cb(err, r ? r.body : undefined, r);
});
},
} as {}) as Debug;
} as {} as Debug;

const agentVersion = 'SomeName/client/SomeVersion';
const url = 'https://clouddebugger.googleapis.com';
Expand Down Expand Up @@ -226,7 +226,7 @@ describe('Controller API', () => {
// TODO: Fix this error that states `body` is not a property
// of `ServerResponse`.
assert(
((response as {}) as {body: {waitExpired: {}}}).body.waitExpired,
(response as {} as {body: {waitExpired: {}}}).body.waitExpired,
'should have expired set'
);
scope.done();
Expand Down
2 changes: 1 addition & 1 deletion test/test-debug-assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('debug-assert', () => {
it.skip('should cover the full assert API', () => {
Object.keys(realAssert).forEach(key => {
realAssert.strictEqual(
typeof ((assert as {}) as {[key: string]: Function})[key],
typeof (assert as {} as {[key: string]: Function})[key],
'function',
`${key} does not exist on the debug assert library`
);
Expand Down
Loading