From ead87ceb63538903d8cefd4068a9049f1e96ec5d Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 9 Feb 2020 17:54:33 +0000 Subject: [PATCH] fix(core): update --- readme.md | 49 ++++++++++++++++++++++++++ ts/cloudflare.classes.worker.ts | 2 +- ts/cloudflare.classes.workermanager.ts | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..339ac63 --- /dev/null +++ b/readme.md @@ -0,0 +1,49 @@ +# @mojoio/cloudflare +easy cloudflare management + +## Availabililty and Links +* [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/cloudflare) +* [gitlab.com (source)](https://gitlab.com/mojoio/cloudflare) +* [github.com (source mirror)](https://github.com/mojoio/cloudflare) +* [docs (typedoc)](https://mojoio.gitlab.io/cloudflare/) + +## Status for master +[![pipeline status](https://gitlab.com/mojoio/cloudflare/badges/master/pipeline.svg)](https://gitlab.com/mojoio/cloudflare/commits/master) +[![coverage report](https://gitlab.com/mojoio/cloudflare/badges/master/coverage.svg)](https://gitlab.com/mojoio/cloudflare/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/@mojoio/cloudflare.svg)](https://www.npmjs.com/package/@mojoio/cloudflare) +[![Known Vulnerabilities](https://snyk.io/test/npm/@mojoio/cloudflare/badge.svg)](https://snyk.io/test/npm/@mojoio/cloudflare) +[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) + +## Usage + +Use TypeScript for best in class instellisense. + +```javascript +import * as cflare from '@mojoio/cloudflare' + +const myCflareAccount = new cflare.CflareAccount() +testCflareAccount.auth({ + email: 'someuser@example.com', + key: 'someLongApiKey' +}) + +const myAsyncCflareManagement = async () => { + // get things + const myZones = await myCflareAccount.listZones() // zones are fully typed + const myIdForADomain = await myCflareAccount.getZoneId('example.com') // type number + const myRecordsForADomain = await myCflareAccount.listRecords('example.com') // records are fully typed +} +``` + +## Contribution + +We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) + +For further information read the linked docs at the top of this readme. + +> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) + +[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) diff --git a/ts/cloudflare.classes.worker.ts b/ts/cloudflare.classes.worker.ts index caf3a8e..659af4a 100644 --- a/ts/cloudflare.classes.worker.ts +++ b/ts/cloudflare.classes.worker.ts @@ -13,7 +13,7 @@ export class CloudflareWorker { apiObject ): Promise { const newWorker = new CloudflareWorker(workerManager); - Object.assign(newWorker, apiObject.result); + Object.assign(newWorker, apiObject); await newWorker.getRoutes(); return newWorker; } diff --git a/ts/cloudflare.classes.workermanager.ts b/ts/cloudflare.classes.workermanager.ts index ef6dfe1..3a83573 100644 --- a/ts/cloudflare.classes.workermanager.ts +++ b/ts/cloudflare.classes.workermanager.ts @@ -16,7 +16,7 @@ export class WorkerManager { 'Content-Type': 'application/javascript', 'Content-Length': Buffer.byteLength(workerScript) }); - return CloudflareWorker.fromApiObject(this, responseBody); + return CloudflareWorker.fromApiObject(this, responseBody.result); } /**