Skip to content

Commit

Permalink
Add check for empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch committed Jun 3, 2020
1 parent e106758 commit 9a5436c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
59 changes: 44 additions & 15 deletions deploy-cloudrun/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30048,6 +30048,25 @@ prng.create = function(plugin) {
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -30057,14 +30076,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudRun = void 0;
const core = __importStar(__webpack_require__(470));
const googleapis_1 = __webpack_require__(819);
/**
Expand Down Expand Up @@ -30155,7 +30168,10 @@ class CloudRun {
};
const serviceListResponse = yield this.run.projects.locations.services.list(listRequest, this.methodOptions);
const serviceList = serviceListResponse.data;
const serviceNames = serviceList.items.map((service) => service.metadata.name);
let serviceNames = [];
if (serviceList.items !== undefined) {
serviceNames = serviceList.items.map((service) => service.metadata.name);
}
return serviceNames;
});
}
Expand Down Expand Up @@ -105756,6 +105772,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Service = void 0;
const fs_1 = __importDefault(__webpack_require__(747));
const yaml_1 = __importDefault(__webpack_require__(521));
/**
Expand Down Expand Up @@ -107426,6 +107443,25 @@ module.exports = isStream;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -107435,13 +107471,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const cloudRun_1 = __webpack_require__(115);
Expand Down
9 changes: 6 additions & 3 deletions deploy-cloudrun/src/cloudRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ export class CloudRun {
);
const serviceList: run_v1.Schema$ListServicesResponse =
serviceListResponse.data;
const serviceNames = serviceList.items!.map(
(service: run_v1.Schema$Service) => service.metadata!.name as string,
);
let serviceNames: string[] = [];
if (serviceList.items !== undefined) {
serviceNames = serviceList.items!.map(
(service: run_v1.Schema$Service) => service.metadata!.name as string,
);
}
return serviceNames;
}

Expand Down

0 comments on commit 9a5436c

Please sign in to comment.