Compare commits

..

4 Commits

Author SHA1 Message Date
05677231f7 1.0.5 2017-06-11 21:07:45 +02:00
9c036925fd now using tsclass 2017-06-11 21:07:41 +02:00
d3d5f72193 1.0.4 2017-06-09 22:25:22 +02:00
3d7c0e6b64 update dependencies 2017-06-09 22:25:19 +02:00
10 changed files with 112 additions and 55 deletions

View File

@ -1,5 +1,6 @@
import 'typings-global'; import 'typings-global';
import * as interfaces from './cflare.interfaces'; import * as interfaces from './cflare.interfaces';
import { TDnsRecord } from 'tsclass';
export declare class CflareAccount { export declare class CflareAccount {
private authEmail; private authEmail;
private authKey; private authKey;
@ -9,9 +10,9 @@ export declare class CflareAccount {
key: string; key: string;
}): void; }): void;
getZoneId(domainName: string): Promise<string>; getZoneId(domainName: string): Promise<string>;
getRecord(domainNameArg: string, typeArg: interfaces.TRecord): Promise<interfaces.ICflareRecord>; getRecord(domainNameArg: string, typeArg: TDnsRecord): Promise<interfaces.ICflareRecord>;
createRecord(domainNameArg: string, typeArg: interfaces.TRecord, contentArg: string): Promise<{}>; createRecord(domainNameArg: string, typeArg: TDnsRecord, contentArg: string): Promise<{}>;
removeRecord(domainNameArg: string, typeArg: interfaces.TRecord): Promise<{}>; removeRecord(domainNameArg: string, typeArg: TDnsRecord): Promise<{}>;
updateRecord(domainNameArg: string, typeArg: string, valueArg: any): Promise<{}>; updateRecord(domainNameArg: string, typeArg: string, valueArg: any): Promise<{}>;
/** /**
* list all records of a specified domain name * list all records of a specified domain name

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
export declare type TRecord = 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'SRV' | 'LOC' | 'MX' | 'NS' | 'SPF';
export interface ICflareZone { export interface ICflareZone {
'id': string; 'id': string;
'name': string; 'name': string;

View File

@ -1,6 +1,8 @@
import 'typings-global'; import 'typings-global';
export declare let beautylog: any; import * as beautylog from 'beautylog';
export import q = require('smartq'); import * as q from 'smartq';
export import smartrequest = require('smartrequest'); import * as smartdelay from 'smartdelay';
export import smartstring = require('smartstring'); import * as smartrequest from 'smartrequest';
export import smartdelay = require('smartdelay'); import * as smartstring from 'smartstring';
import * as tsclass from 'tsclass';
export { beautylog, q, smartdelay, smartrequest, smartstring, tsclass };

View File

@ -1,9 +1,16 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global"); require("typings-global");
exports.beautylog = require('beautylog'); const beautylog = require("beautylog");
exports.q = require("smartq"); exports.beautylog = beautylog;
exports.smartrequest = require("smartrequest"); const q = require("smartq");
exports.smartstring = require("smartstring"); exports.q = q;
exports.smartdelay = require("smartdelay"); const smartdelay = require("smartdelay");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZsYXJlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZmxhcmUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUNaLFFBQUEsU0FBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQTtBQUMzQyw4QkFBbUM7QUFDbkMsK0NBQW9EO0FBQ3BELDZDQUFrRDtBQUNsRCwyQ0FBZ0QifQ== exports.smartdelay = smartdelay;
const smartrequest = require("smartrequest");
exports.smartrequest = smartrequest;
const smartstring = require("smartstring");
exports.smartstring = smartstring;
const tsclass = require("tsclass");
exports.tsclass = tsclass;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZsYXJlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZmxhcmUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix1Q0FBc0M7QUFRcEMsOEJBQVM7QUFQWCw0QkFBMkI7QUFRekIsY0FBQztBQVBILHlDQUF3QztBQVF0QyxnQ0FBVTtBQVBaLDZDQUE0QztBQVExQyxvQ0FBWTtBQVBkLDJDQUEwQztBQVF4QyxrQ0FBVztBQVBiLG1DQUFrQztBQVFoQywwQkFBTyJ9

View File

@ -1,6 +1,6 @@
{ {
"name": "cflare", "name": "cflare",
"version": "1.0.3", "version": "1.0.5",
"description": "easy cloudflare management", "description": "easy cloudflare management",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
@ -25,9 +25,10 @@
"beautylog": "^6.1.10", "beautylog": "^6.1.10",
"smartdelay": "^1.0.3", "smartdelay": "^1.0.3",
"smartq": "^1.1.1", "smartq": "^1.1.1",
"smartrequest": "^1.0.4", "smartrequest": "^1.0.6",
"smartstring": "^2.0.24", "smartstring": "^2.0.24",
"typings-global": "^1.0.16" "tsclass": "^1.0.12",
"typings-global": "^1.0.17"
}, },
"devDependencies": { "devDependencies": {
"qenv": "^1.1.7", "qenv": "^1.1.7",

View File

@ -2,11 +2,14 @@ import 'typings-global'
import plugins = require('./cflare.plugins') import plugins = require('./cflare.plugins')
import * as interfaces from './cflare.interfaces' import * as interfaces from './cflare.interfaces'
// interfaces
import { TDnsRecord } from 'tsclass'
export class CflareAccount { export class CflareAccount {
private authEmail: string private authEmail: string
private authKey: string private authKey: string
constructor() { constructor() {
// Nothing here
} }
auth (optionsArg: { email: string, key: string }) { auth (optionsArg: { email: string, key: string }) {
@ -28,7 +31,7 @@ export class CflareAccount {
} }
} }
getRecord (domainNameArg: string, typeArg: interfaces.TRecord): Promise<interfaces.ICflareRecord> { getRecord (domainNameArg: string, typeArg: TDnsRecord): Promise<interfaces.ICflareRecord> {
let done = plugins.q.defer() let done = plugins.q.defer()
let result: interfaces.ICflareRecord let result: interfaces.ICflareRecord
@ -43,7 +46,7 @@ export class CflareAccount {
return done.promise return done.promise
} }
async createRecord (domainNameArg: string, typeArg: interfaces.TRecord, contentArg: string) { async createRecord (domainNameArg: string, typeArg: TDnsRecord, contentArg: string) {
let done = plugins.q.defer() let done = plugins.q.defer()
let domain = new plugins.smartstring.Domain(domainNameArg) let domain = new plugins.smartstring.Domain(domainNameArg)
let domainIdArg = await this.getZoneId(domain.zoneName) let domainIdArg = await this.getZoneId(domain.zoneName)
@ -59,7 +62,7 @@ export class CflareAccount {
return done.promise return done.promise
} }
removeRecord (domainNameArg: string, typeArg: interfaces.TRecord) { removeRecord (domainNameArg: string, typeArg: TDnsRecord) {
let done = plugins.q.defer() let done = plugins.q.defer()
let domain = new plugins.smartstring.Domain(domainNameArg) let domain = new plugins.smartstring.Domain(domainNameArg)
this.getRecord(domain.fullName, typeArg) this.getRecord(domain.fullName, typeArg)

View File

@ -1,7 +1,5 @@
import * as plugins from './cflare.plugins' import * as plugins from './cflare.plugins'
export type TRecord = 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'SRV' | 'LOC' | 'MX' | 'NS' | 'SPF'
export interface ICflareZone { export interface ICflareZone {
'id': string 'id': string
'name': string 'name': string

View File

@ -1,6 +1,16 @@
import 'typings-global' import 'typings-global'
export let beautylog = require('beautylog') import * as beautylog from 'beautylog'
export import q = require('smartq') import * as q from 'smartq'
export import smartrequest = require('smartrequest') import * as smartdelay from 'smartdelay'
export import smartstring = require('smartstring') import * as smartrequest from 'smartrequest'
export import smartdelay = require('smartdelay') import * as smartstring from 'smartstring'
import * as tsclass from 'tsclass'
export {
beautylog,
q,
smartdelay,
smartrequest,
smartstring,
tsclass
}

View File

@ -29,20 +29,30 @@
version "4.14.65" version "4.14.65"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.65.tgz#a0f78d71ffcd3c02628d5f616410c98c424326d5" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.65.tgz#a0f78d71ffcd3c02628d5f616410c98c424326d5"
"@types/node@*": "@types/node@*", "@types/node@^7.0.29":
version "7.0.27" version "7.0.29"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.27.tgz#ba5e1a87aca2b4f5817289615ffe56472927687e" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.29.tgz#ccfcec5b7135c7caf6c4ffb8c7f33102340d99df"
"@types/promises-a-plus@*": "@types/promises-a-plus@*":
version "0.0.27" version "0.0.27"
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780" resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
"@types/shelljs@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.6.0.tgz#090b705c102ce7fc5c0c5ea9b524418ff15840df"
dependencies:
"@types/node" "*"
"@types/vinyl@^2.0.0": "@types/vinyl@^2.0.0":
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/vinyl/-/vinyl-2.0.0.tgz#fd213bf7f4136dde21fe1895500b12c186f8c268" resolved "https://registry.yarnpkg.com/@types/vinyl/-/vinyl-2.0.0.tgz#fd213bf7f4136dde21fe1895500b12c186f8c268"
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/which@^1.0.28":
version "1.0.28"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
ansi-256-colors@^1.1.0: ansi-256-colors@^1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a" resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
@ -272,6 +282,10 @@ isarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
js-base64@^2.1.9: js-base64@^2.1.9:
version "2.1.9" version "2.1.9"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
@ -392,14 +406,14 @@ qenv@^1.1.7:
typings-global "^1.0.16" typings-global "^1.0.16"
readable-stream@^2.0.2, readable-stream@^2.1.5: readable-stream@^2.0.2, readable-stream@^2.1.5:
version "2.2.10" version "2.2.11"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.10.tgz#effe72bb7c884c0dd335e2379d526196d9d011ee" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.11.tgz#0796b31f8d7688007ff0b93a8088d34aa17c0f72"
dependencies: dependencies:
core-util-is "~1.0.0" core-util-is "~1.0.0"
inherits "~2.0.1" inherits "~2.0.1"
isarray "~1.0.0" isarray "~1.0.0"
process-nextick-args "~1.0.6" process-nextick-args "~1.0.6"
safe-buffer "^5.0.1" safe-buffer "~5.0.1"
string_decoder "~1.0.0" string_decoder "~1.0.0"
util-deprecate "~1.0.1" util-deprecate "~1.0.1"
@ -410,8 +424,8 @@ rechoir@^0.6.2:
resolve "^1.1.6" resolve "^1.1.6"
remove-trailing-separator@^1.0.1: remove-trailing-separator@^1.0.1:
version "1.0.1" version "1.0.2"
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.1.tgz#615ebb96af559552d4bf4057c8436d486ab63cc4" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz#69b062d978727ad14dc6b56ba4ab772fd8d70511"
replace-ext@^1.0.0: replace-ext@^1.0.0:
version "1.0.0" version "1.0.0"
@ -434,17 +448,17 @@ restore-cursor@^2.0.0:
onetime "^2.0.0" onetime "^2.0.0"
signal-exit "^3.0.2" signal-exit "^3.0.2"
safe-buffer@^5.0.1: safe-buffer@~5.0.1:
version "5.1.0" version "5.0.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.0.tgz#fe4c8460397f9eaaaa58e73be46273408a45e223" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
semver@^5.3.0: semver@^5.3.0:
version "5.3.0" version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
shelljs@^0.7.7: shelljs@^0.7.6:
version "0.7.7" version "0.7.8"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
dependencies: dependencies:
glob "^7.0.0" glob "^7.0.0"
interpret "^1.0.0" interpret "^1.0.0"
@ -511,12 +525,22 @@ smartq@^1.1.0, smartq@^1.1.1:
typed-promisify "^0.3.0" typed-promisify "^0.3.0"
typings-global "^1.0.14" typings-global "^1.0.14"
smartrequest@^1.0.4: smartrequest@^1.0.4, smartrequest@^1.0.6:
version "1.0.4" version "1.0.6"
resolved "https://registry.yarnpkg.com/smartrequest/-/smartrequest-1.0.4.tgz#86af2163ae28f1031b01c2d8ad8c429733920611" resolved "https://registry.yarnpkg.com/smartrequest/-/smartrequest-1.0.6.tgz#a006454332453b0a70d38a003a29963d039a7783"
dependencies: dependencies:
smartq "^1.1.1"
typings-global "^1.0.17"
smartshell@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.6.tgz#27b1c79029784abe72ac7e91fe698b7ebecc6629"
dependencies:
"@types/shelljs" "^0.6.0"
"@types/which" "^1.0.28"
shelljs "^0.7.6"
smartq "^1.1.0" smartq "^1.1.0"
typings-global "^1.0.14" which "^1.2.12"
smartstring@^2.0.24: smartstring@^2.0.24:
version "2.0.24" version "2.0.24"
@ -530,10 +554,10 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
string_decoder@~1.0.0: string_decoder@~1.0.0:
version "1.0.1" version "1.0.2"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.1.tgz#62e200f039955a6810d8df0a33ffc0f013662d98" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.2.tgz#b29e1f4e1125fa97a10382b8a533737b7491e179"
dependencies: dependencies:
safe-buffer "^5.0.1" safe-buffer "~5.0.1"
strip-ansi@^3.0.0: strip-ansi@^3.0.0:
version "3.0.1" version "3.0.1"
@ -582,6 +606,10 @@ through2@^2.0.1:
readable-stream "^2.1.5" readable-stream "^2.1.5"
xtend "~4.0.1" xtend "~4.0.1"
tsclass@^1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/tsclass/-/tsclass-1.0.12.tgz#350c4e567ca7ae7fa426b95bbb77ec478ec0edef"
type-detect@0.1.1: type-detect@0.1.1:
version "0.1.1" version "0.1.1"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
@ -594,12 +622,13 @@ typed-promisify@^0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853" resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
typings-global@^1.0.14, typings-global@^1.0.16: typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.17:
version "1.0.16" version "1.0.17"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.16.tgz#489b71781af24268750c2899316400a5e482961f" resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.17.tgz#41edc331ccec3168289adc8849e1e255efbe7152"
dependencies: dependencies:
"@types/node" "^7.0.29"
semver "^5.3.0" semver "^5.3.0"
shelljs "^0.7.7" smartshell "^1.0.6"
universalify@^0.1.0: universalify@^0.1.0:
version "0.1.0" version "0.1.0"
@ -631,6 +660,12 @@ vinyl@^2.0.1, vinyl@^2.0.2:
remove-trailing-separator "^1.0.1" remove-trailing-separator "^1.0.1"
replace-ext "^1.0.0" replace-ext "^1.0.0"
which@^1.2.12:
version "1.2.14"
resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
dependencies:
isexe "^2.0.0"
wrappy@1: wrappy@1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"