Comparing version 1.0.0 to 2.0.0
export declare class D1 { | ||
private accountId; | ||
private apiKey; | ||
private fetch; | ||
constructor(accountId: string, apiKey: string, fetch?: typeof globalThis.fetch); | ||
constructor(accountId: string, apiKey: string); | ||
list(params?: { | ||
@@ -7,0 +6,0 @@ name?: string; |
@@ -81,7 +81,5 @@ import { array, boolean, isNull, number, scanner, string, union } from 'typescanner'; | ||
apiKey; | ||
fetch; | ||
constructor(accountId, apiKey, fetch = globalThis.fetch) { | ||
constructor(accountId, apiKey) { | ||
this.accountId = accountId; | ||
this.apiKey = apiKey; | ||
this.fetch = fetch; | ||
} | ||
@@ -100,3 +98,3 @@ async list(params) { | ||
} | ||
const res = await this.fetch(url.href, { | ||
const res = await fetch(url.href, { | ||
method: 'GET', | ||
@@ -116,3 +114,3 @@ headers: { | ||
async create(name) { | ||
const res = await this.fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database`, { | ||
const res = await fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database`, { | ||
method: 'POST', | ||
@@ -134,3 +132,3 @@ headers: { | ||
async delete(uuid) { | ||
const res = await this.fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}`, { | ||
const res = await fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}`, { | ||
method: 'DELETE', | ||
@@ -150,3 +148,3 @@ headers: { | ||
async get(uuid) { | ||
const res = await this.fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}`, { | ||
const res = await fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}`, { | ||
method: 'GET', | ||
@@ -167,3 +165,3 @@ headers: { | ||
async query(uuid, sql, params = []) { | ||
const res = await this.fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}/query`, { | ||
const res = await fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}/query`, { | ||
method: 'POST', | ||
@@ -184,3 +182,3 @@ headers: { | ||
async raw(uuid, sql, params = []) { | ||
const res = await this.fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}/query`, { | ||
const res = await fetch(`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/d1/database/${uuid}/query`, { | ||
method: 'POST', | ||
@@ -187,0 +185,0 @@ headers: { |
{ | ||
"name": "d1-driver", | ||
"description": "🌤️ Cloudflare D1 External Fetch Compatible Driver", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"type": "module", | ||
@@ -46,3 +46,3 @@ "files": [ | ||
"url": "https://github.com/jill64/d1-driver.git", | ||
"image": "https://opengraph.githubassets.com/c59cf7a56548842f373bb45f59a603550ea060cd19a4cb35698af3ee48db4906/jill64/d1-driver" | ||
"image": "https://opengraph.githubassets.com/c86adefa67b03905fad742dbad1417907539962f849353328d9d2d6775f5e5cc/jill64/d1-driver" | ||
}, | ||
@@ -49,0 +49,0 @@ "keywords": [ |
13180
317
6