@codeplaydata/adapters
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -7,3 +7,4 @@ import { IndexOperations, IndexedDBQuery, LocalStorageQuery, MongoQuery } from "./enums.js"; | ||
database?: unknown; | ||
store: string; | ||
store?: string; | ||
collection?: string; | ||
indexNames?: unknown; | ||
@@ -10,0 +11,0 @@ pipeline?(descriptions: unknown): any; |
@@ -16,3 +16,3 @@ // @filename: GPUDeviceAdapter.ts | ||
*/ | ||
import { NoGpuAvaiable } from "../error/NoGpuAvaiable.js"; | ||
import { NoGpuAvaiable } from "./error/NoGpuAvailable.js"; | ||
class GPUDeviceAdapter { | ||
@@ -19,0 +19,0 @@ adapter; |
@@ -1,1 +0,27 @@ | ||
"use strict"; | ||
// @filename: Axios.ts | ||
import axios, { AxiosHeaders } from "axios"; | ||
import { AxiosInvalidArgument } from "./error/AxiosInvalidArgument.js"; | ||
class Axios { | ||
send(requestOrUrl, options) { | ||
if (requestOrUrl instanceof Request) { | ||
const { url, method, referrer, headers, body } = requestOrUrl; | ||
let axiosHeaders = new AxiosHeaders(); | ||
headers.forEach((value, key) => { | ||
axiosHeaders.set(key, value); | ||
}); | ||
return axios(url, { | ||
method, | ||
baseURL: `${referrer}/${url}`, | ||
headers: axiosHeaders, | ||
data: body | ||
}); | ||
} | ||
else if (typeof requestOrUrl === 'string') { | ||
return axios(requestOrUrl, options); | ||
} | ||
else { | ||
throw new AxiosInvalidArgument(); | ||
} | ||
} | ||
} | ||
export { Axios }; |
@@ -9,3 +9,11 @@ import { HttpClient } from "../HttpClient.js"; | ||
send(request: Request): Promise<Response>; | ||
/** | ||
* An implementation of a httpClient from the FetchAPI. | ||
* @param url @type { string } | ||
* @param options @type {{ [key: string]: any }} | ||
*/ | ||
send(url: string, options?: { | ||
[key: string]: any; | ||
}): Promise<Response>; | ||
} | ||
export { Fetch }; |
// @filename: Fetch.ts | ||
import { FetchInvalidArgument } from "./error/FetchInvalidArgument.js"; | ||
class Fetch { | ||
/** | ||
* An implementation of a httpClient from the FetchAPI. | ||
* @param request An object derived from Request constructor to be fetched. | ||
* @returns @type { Promise<Response> } The eventLoopIdentifier of the request. Be aware, is not the Response directly. | ||
*/ | ||
send(request) { | ||
return fetch(request); | ||
send(requestOrUrl, options) { | ||
if (requestOrUrl instanceof Request) { | ||
return fetch(requestOrUrl); | ||
} | ||
else if (typeof requestOrUrl === 'string') { | ||
return fetch(requestOrUrl, options); | ||
} | ||
else { | ||
throw new FetchInvalidArgument(); | ||
} | ||
} | ||
} | ||
export { Fetch }; |
@@ -21,6 +21,9 @@ // @filename: Fetch.test.ts | ||
const httpclient = new Fetch(); | ||
it('uma requisição GET.', async () => { | ||
it('uma Request.', async () => { | ||
const request = new Request('https://httpstat.us/200'); | ||
strictEqual((await httpclient.send(request)).status, 200); | ||
}); | ||
it('uma url.', async () => { | ||
strictEqual((await httpclient.send('https://httpstat.us/200')).status, 200); | ||
}); | ||
}); |
interface HttpClient { | ||
send(request: Request): Promise<Response> | Response; | ||
send(url: string, options?: any): Promise<Response>; | ||
} | ||
export { HttpClient }; |
@@ -1,9 +0,9 @@ | ||
import { IndexedDB, IDBIndex, IDBRepo, IDBConfig } from "./databases/browser/IndexedDB.js"; | ||
import { LocalStorage } from "./databases/browser/LocalStorage.js"; | ||
import { MongoDB } from "./databases/document/MongoDB.js"; | ||
import { IndexedDB, IDBIndex, IDBRepo, IDBConfig } from "./databases/browser/IndexedDB/IndexedDB.js"; | ||
import { LocalStorage } from "./databases/browser/LocalStorage/LocalStorage.js"; | ||
import { MongoDB } from "./databases/document/MongoDB/MongoDB.js"; | ||
import { Fetch } from "./http/client/Fetch/Fetch.js"; | ||
import { HttpClient } from "./http/client/HttpClient.js"; | ||
import { Collection } from "./collections/Collection.js"; | ||
import { Queue } from "./collections/Queue.js"; | ||
import { GenericQueue, DatabaseQuery } from "./collections/GenericQueue.js"; | ||
import { Collection } from "./Collection.js"; | ||
import { Queue } from "./queue/memory/Queue.js"; | ||
import { GenericQueue, DatabaseQuery } from "./queue/memory/GenericQueue.js"; | ||
import { ExpressServer } from "./http/server/Express/Server.js"; | ||
@@ -10,0 +10,0 @@ import { ExpressRouter } from "./http/server/Express/Router.js"; |
@@ -16,7 +16,7 @@ // @filename: index.ts | ||
*/ | ||
import { IndexedDB } from "./databases/browser/IndexedDB.js"; | ||
import { LocalStorage } from "./databases/browser/LocalStorage.js"; | ||
import { MongoDB } from "./databases/document/MongoDB.js"; | ||
import { IndexedDB } from "./databases/browser/IndexedDB/IndexedDB.js"; | ||
import { LocalStorage } from "./databases/browser/LocalStorage/LocalStorage.js"; | ||
import { MongoDB } from "./databases/document/MongoDB/MongoDB.js"; | ||
import { Fetch } from "./http/client/Fetch/Fetch.js"; | ||
import { GenericQueue } from "./collections/GenericQueue.js"; | ||
import { GenericQueue } from "./queue/memory/GenericQueue.js"; | ||
import { ExpressServer } from "./http/server/Express/Server.js"; | ||
@@ -23,0 +23,0 @@ import { ExpressRouter } from "./http/server/Express/Router.js"; |
{ | ||
"name": "@codeplaydata/adapters", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"type": "module", | ||
@@ -31,2 +31,3 @@ "main": "index.js", | ||
"@webgpu/types": "^0.1.23", | ||
"dotenv": "^16.0.3", | ||
"mock-local-storage": "^1.1.23", | ||
@@ -36,2 +37,3 @@ "typescript": "^4.7.4" | ||
"dependencies": { | ||
"axios": "^1.4.0", | ||
"express": "^4.18.2", | ||
@@ -38,0 +40,0 @@ "mongodb": "^4.12.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
104745
94
2082
3
6
1
7
+ Addedaxios@^1.4.0
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedproxy-from-env@1.1.0(transitive)