now using tsclass

This commit is contained in:
Philipp Kunz 2017-06-11 21:07:41 +02:00
parent d3d5f72193
commit 9c036925fd
10 changed files with 53 additions and 27 deletions

View File

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

View File

@ -1,6 +1,8 @@
import 'typings-global';
export declare let beautylog: any;
export import q = require('smartq');
export import smartrequest = require('smartrequest');
export import smartstring = require('smartstring');
export import smartdelay = require('smartdelay');
import * as beautylog from 'beautylog';
import * as q from 'smartq';
import * as smartdelay from 'smartdelay';
import * as smartrequest from 'smartrequest';
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";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
exports.beautylog = require('beautylog');
exports.q = require("smartq");
exports.smartrequest = require("smartrequest");
exports.smartstring = require("smartstring");
exports.smartdelay = require("smartdelay");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZsYXJlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZmxhcmUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUNaLFFBQUEsU0FBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQTtBQUMzQyw4QkFBbUM7QUFDbkMsK0NBQW9EO0FBQ3BELDZDQUFrRDtBQUNsRCwyQ0FBZ0QifQ==
const beautylog = require("beautylog");
exports.beautylog = beautylog;
const q = require("smartq");
exports.q = q;
const smartdelay = require("smartdelay");
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

@ -27,6 +27,7 @@
"smartq": "^1.1.1",
"smartrequest": "^1.0.6",
"smartstring": "^2.0.24",
"tsclass": "^1.0.12",
"typings-global": "^1.0.17"
},
"devDependencies": {

View File

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

View File

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

View File

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

View File

@ -606,6 +606,10 @@ through2@^2.0.1:
readable-stream "^2.1.5"
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:
version "0.1.1"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"