diff --git a/build.config.ts b/build.config.ts
index bd7000b..2e047c9 100644
--- a/build.config.ts
+++ b/build.config.ts
@@ -1,40 +1,40 @@
-///
-import * as esbuild from 'https://deno.land/x/esbuild@v0.19.12/mod.js';
-import { green } from 'https://deno.land/std@0.211.0/fmt/colors.ts';
-import { parseArgs } from 'https://deno.land/std@0.211.0/cli/parse_args.ts';
-
-const args = parseArgs<{
- watch: boolean | undefined,
- develope: boolean | undefined,
- logLevel: esbuild.LogLevel
-}>(Deno.args);
-
-const filesConfig : esbuild.BuildOptions = {
- allowOverwrite: true,
- logLevel: args.logLevel ?? 'info',
- legalComments: args.develope ? 'inline' : 'none',
- color: true,
- minify: !args.develope ?? true,
- bundle: true,
- format: 'esm',
- target: 'es2022',
- sourcemap: args.develope ?? false,
- sourcesContent: args.develope ?? false,
- outfile: 'worker/worker.js',
- entryPoints: [
- './src/index.ts'
- ],
-}
-
-console.log('Build process started.');
-
-const timestampNow = Date.now();
-
-if (args.watch) {
- esbuild.context(filesConfig).then((context) => context.watch());
-} else {
- esbuild.build(filesConfig).then(() => {
- esbuild.stop();
- console.log(green(`esbuild ${esbuild.version} finished build in ${(Date.now() - timestampNow).toString()}ms.`));
- })
-}
+///
+import * as esbuild from 'https://deno.land/x/esbuild@v0.19.12/mod.js';
+import { green } from 'https://deno.land/std@0.211.0/fmt/colors.ts';
+import { parseArgs } from 'https://deno.land/std@0.211.0/cli/parse_args.ts';
+
+const args = parseArgs<{
+ watch: boolean | undefined,
+ develope: boolean | undefined,
+ logLevel: esbuild.LogLevel
+}>(Deno.args);
+
+const filesConfig : esbuild.BuildOptions = {
+ allowOverwrite: true,
+ logLevel: args.logLevel ?? 'info',
+ legalComments: args.develope ? 'inline' : 'none',
+ color: true,
+ minify: !args.develope ?? true,
+ bundle: true,
+ format: 'esm',
+ target: 'es2022',
+ sourcemap: args.develope ?? false,
+ sourcesContent: args.develope ?? false,
+ outfile: 'worker/worker.js',
+ entryPoints: [
+ './src/index.ts'
+ ],
+}
+
+console.log('Build process started.');
+
+const timestampNow = Date.now();
+
+if (args.watch) {
+ esbuild.context(filesConfig).then((context) => context.watch());
+} else {
+ esbuild.build(filesConfig).then(() => {
+ esbuild.stop();
+ console.log(green(`esbuild ${esbuild.version} finished build in ${(Date.now() - timestampNow).toString()}ms.`));
+ })
+}
diff --git a/deno.jsonc b/deno.jsonc
index f7ee291..b6bd2a6 100644
--- a/deno.jsonc
+++ b/deno.jsonc
@@ -1,52 +1,52 @@
-{
- "tasks": {
- "build": "deno run -A ./build.config.ts",
- "build:watch": "deno run -A ./build.config.ts --watch",
- "build:dev": "deno run -A ./build.config.ts --develope",
- "build:dev:watch": "deno run -A ./build.config.ts --develope --watch",
- "lint": "deno lint",
- "test": "deno test -A --check --reload --doc --allow-none --junit-path=\"./report.xml\""
- },
- "exclude": [
- "./dist/",
- "./worker/"
- ],
- "test": {
- "include": [
- "**/*.test.ts"
- ]
- },
- "compilerOptions": {
- "experimentalDecorators": true,
- "lib": [
- "ES6",
- "DOM",
- "DOM.Iterable"
- ]
- },
- "fmt": {
- "singleQuote": true,
- "lineWidth": 120
- },
- "lint": {
- "rules": {
- "tags": [
- "recommended"
- ],
- "include": [
- "camelcase",
- "default-param-last",
- "eqeqeq",
- "explicit-function-return-type",
- "explicit-module-boundary-types",
- "guard-for-in",
- "no-eval",
- "no-sparse-arrays",
- "prefer-ascii"
- ],
- "exclude": [
- "no-inferrable-types"
- ]
- }
- }
-}
+{
+ "tasks": {
+ "build": "deno run -A ./build.config.ts",
+ "build:watch": "deno run -A ./build.config.ts --watch",
+ "build:dev": "deno run -A ./build.config.ts --develope",
+ "build:dev:watch": "deno run -A ./build.config.ts --develope --watch",
+ "lint": "deno lint",
+ "test": "deno test -A --check --reload --doc --allow-none --junit-path=\"./report.xml\""
+ },
+ "exclude": [
+ "./dist/",
+ "./worker/"
+ ],
+ "test": {
+ "include": [
+ "**/*.test.ts"
+ ]
+ },
+ "compilerOptions": {
+ "experimentalDecorators": true,
+ "lib": [
+ "ES6",
+ "DOM",
+ "DOM.Iterable"
+ ]
+ },
+ "fmt": {
+ "singleQuote": true,
+ "lineWidth": 120
+ },
+ "lint": {
+ "rules": {
+ "tags": [
+ "recommended"
+ ],
+ "include": [
+ "camelcase",
+ "default-param-last",
+ "eqeqeq",
+ "explicit-function-return-type",
+ "explicit-module-boundary-types",
+ "guard-for-in",
+ "no-eval",
+ "no-sparse-arrays",
+ "prefer-ascii"
+ ],
+ "exclude": [
+ "no-inferrable-types"
+ ]
+ }
+ }
+}
diff --git a/src/api/dns_records_url.ts b/src/api/dns_records_url.ts
index 6e56d94..a5fecb4 100644
--- a/src/api/dns_records_url.ts
+++ b/src/api/dns_records_url.ts
@@ -1,9 +1,9 @@
-import { endpoints } from './endpoints.ts';
-
-export default function dnsRecordsUrl(
- zoneId : string,
- filter? : Record[]
-) : string {
- const filterString = filter?.map((key_value) => `${Object.keys(key_value)[0]}=${key_value[0]}`)
- return `${endpoints.BASE}zones/${zoneId}/dns_records/?${filterString?.join('&')}`
-}
+import { endpoints } from './endpoints.ts';
+
+export default function dnsRecordsUrl(
+ zoneId : string,
+ filter? : Record[]
+) : string {
+ const filterString = filter?.map((key_value) => `${Object.keys(key_value)[0]}=${key_value[0]}`)
+ return `${endpoints.BASE}zones/${zoneId}/dns_records/?${filterString?.join('&')}`
+}
diff --git a/src/api/endpoints.ts b/src/api/endpoints.ts
index fe746fb..8845723 100644
--- a/src/api/endpoints.ts
+++ b/src/api/endpoints.ts
@@ -1,3 +1,3 @@
-export const endpoints = {
- BASE: "https://api.cloudflare.com/client/v4/"
-}
+export const endpoints = {
+ BASE: "https://api.cloudflare.com/client/v4/"
+}
diff --git a/src/index.ts b/src/index.ts
index 496b68a..27d2b8b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,38 +1,38 @@
-import buildUrlWithFilter from './url/build_url_with_filter.ts';
-import { ListDNSRecordsResponse } from './response/list_dns_records_response.ts';
-import { parseUrlParameters } from './url/parse_url_parameters.ts';
-import { endpoints } from './api/endpoints.ts';
-import getAllDnsRecords from './record/get_all_dns_records.ts';
-
-
-
-export default {
- /**
- * [Reference](https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/)
- * @param request Incoming http request
- */
- async fetch(request : Request) : Promise {
- const urlParameters = parseUrlParameters(new URL(request.url).searchParams);
- const {
- token,
- zoneId,
- records
- } = urlParameters;
-
- const authorizationHeader = {
- 'Content-Type': 'application/json',
- 'Authorization': `Bearer ${token}`
- }
-
- getAllDnsRecords(
- `${endpoints.BASE}zones/${zoneId}/dns_records/`,
- authorizationHeader
- ).then((response) => {
- response
- })
-
- records.forEach(({type, name}) => {
-
- })
- }
-}
+import buildUrlWithFilter from './url/build_url_with_filter.ts';
+import { ListDNSRecordsResponse } from './response/list_dns_records_response.ts';
+import { parseUrlParameters } from './url/parse_url_parameters.ts';
+import { endpoints } from './api/endpoints.ts';
+import getAllDnsRecords from './record/get_all_dns_records.ts';
+
+
+
+export default {
+ /**
+ * [Reference](https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/)
+ * @param request Incoming http request
+ */
+ async fetch(request : Request) : Promise {
+ const urlParameters = parseUrlParameters(new URL(request.url).searchParams);
+ const {
+ token,
+ zoneId,
+ records
+ } = urlParameters;
+
+ const authorizationHeader = {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${token}`
+ }
+
+ getAllDnsRecords(
+ `${endpoints.BASE}zones/${zoneId}/dns_records/`,
+ authorizationHeader
+ ).then((response) => {
+ response
+ })
+
+ records.forEach(({type, name}) => {
+
+ })
+ }
+}
diff --git a/src/record/get_all_dns_records.ts b/src/record/get_all_dns_records.ts
index 664d2c4..994ec02 100644
--- a/src/record/get_all_dns_records.ts
+++ b/src/record/get_all_dns_records.ts
@@ -1,11 +1,11 @@
-import { DNSRecord } from './dns_record.ts';
-
-export default function getAllDnsRecords(
- url : string,
- authorizationHeader : {}
-) : Promise {
- return fetch(
- url,
- {headers: authorizationHeader}
- ).then(response => response.json()) as Promise
-}
+import { DNSRecord } from './dns_record.ts';
+
+export default function getAllDnsRecords(
+ url : string,
+ authorizationHeader : {}
+) : Promise {
+ return fetch(
+ url,
+ {headers: authorizationHeader}
+ ).then(response => response.json()) as Promise
+}
diff --git a/src/response/list_dns_records_response.ts b/src/response/list_dns_records_response.ts
index dd564bf..2746ffb 100644
--- a/src/response/list_dns_records_response.ts
+++ b/src/response/list_dns_records_response.ts
@@ -1,14 +1,14 @@
-import { DNSRecord } from '../record/dns_record.ts';
-
-export interface ListDNSRecordsResponse {
- errors : [],
- messages : [],
- result : DNSRecord[],
- success : boolean,
- result_info : {
- count : number,
- page : number,
- per_page : number,
- total_count : number
- }
-}
+import { DNSRecord } from '../record/dns_record.ts';
+
+export interface ListDNSRecordsResponse {
+ errors : [],
+ messages : [],
+ result : DNSRecord[],
+ success : boolean,
+ result_info : {
+ count : number,
+ page : number,
+ per_page : number,
+ total_count : number
+ }
+}
diff --git a/src/url/build_url_with_filter.ts b/src/url/build_url_with_filter.ts
index c7e595b..2b624b3 100644
--- a/src/url/build_url_with_filter.ts
+++ b/src/url/build_url_with_filter.ts
@@ -1,10 +1,10 @@
-export default function buildUrlWithFilter(
- url : string,
- filter? : Record
-) : string {
- if (filter) {
- return `${url}/?${Object.entries(filter).map(([key, value]) => `${key}=${value}`).join('&')}`
- }
-
- return url;
-}
+export default function buildUrlWithFilter(
+ url : string,
+ filter? : Record
+) : string {
+ if (filter) {
+ return `${url}/?${Object.entries(filter).map(([key, value]) => `${key}=${value}`).join('&')}`
+ }
+
+ return url;
+}
diff --git a/src/url/parse_url_parameters.ts b/src/url/parse_url_parameters.ts
index 909a026..6923f9e 100644
--- a/src/url/parse_url_parameters.ts
+++ b/src/url/parse_url_parameters.ts
@@ -1,24 +1,24 @@
-import { URLParameters } from './url_parameters.ts';
-import { DNSRecord } from '../record/dns_record.ts'
-
-export function parseUrlParameters(parameters : URLSearchParams) : URLParameters {
- const token = parameters.get('token');
- const zoneId = parameters.get('zoneId');
- const records = parameters.get('records');
-
- if (!token) {
- throw new Error('Missing parameter: "token"')
- }
- if (!zoneId) {
- throw new Error('Missing parameter: "zoneId"')
- }
- if (!records) {
- throw new Error('Missing parameter: "records"')
- }
-
- return {
- token,
- zoneId,
- records: JSON.parse(records) as DNSRecord[]
- }
-}
+import { URLParameters } from './url_parameters.ts';
+import { DNSRecord } from '../record/dns_record.ts'
+
+export function parseUrlParameters(parameters : URLSearchParams) : URLParameters {
+ const token = parameters.get('token');
+ const zoneId = parameters.get('zoneId');
+ const records = parameters.get('records');
+
+ if (!token) {
+ throw new Error('Missing parameter: "token"')
+ }
+ if (!zoneId) {
+ throw new Error('Missing parameter: "zoneId"')
+ }
+ if (!records) {
+ throw new Error('Missing parameter: "records"')
+ }
+
+ return {
+ token,
+ zoneId,
+ records: JSON.parse(records) as DNSRecord[]
+ }
+}
diff --git a/worker/worker.js b/worker/worker.js
index 74f930f..38b85f5 100644
--- a/worker/worker.js
+++ b/worker/worker.js
@@ -1 +1 @@
-function n(r){let e=r.get("token"),o=r.get("zoneId"),t=r.get("records");if(!e)throw new Error('Missing parameter: "token"');if(!o)throw new Error('Missing parameter: "zoneId"');if(!t)throw new Error('Missing parameter: "records"');return{token:e,zoneId:o,records:JSON.parse(t)}}var a="https://api.cloudflare.com/client/v4/",f={async fetch(r){let e=n(new URL(r.url).searchParams),{token:o,zoneId:t,records:s}=e,c=`${a}zones/${t}/dns_records`,i={"Content-Type":"application/json",Authorization:`Bearer ${o}`};s.forEach(d=>{})}};export{f as default};
+function n(r){let e=r.get("token"),o=r.get("zoneId"),t=r.get("records");if(!e)throw new Error('Missing parameter: "token"');if(!o)throw new Error('Missing parameter: "zoneId"');if(!t)throw new Error('Missing parameter: "records"');return{token:e,zoneId:o,records:JSON.parse(t)}}var a="https://api.cloudflare.com/client/v4/",f={async fetch(r){let e=n(new URL(r.url).searchParams),{token:o,zoneId:t,records:s}=e,c=`${a}zones/${t}/dns_records`,i={"Content-Type":"application/json",Authorization:`Bearer ${o}`};s.forEach(d=>{})}};export{f as default};