diff --git a/lib/actions/transformSchemaToWidget.js b/lib/actions/transformSchemaToWidget.js index fb9577c..18dec73 100644 --- a/lib/actions/transformSchemaToWidget.js +++ b/lib/actions/transformSchemaToWidget.js @@ -155,11 +155,13 @@ const processSchema = (fileSchema) => { // do projeto // 1 - Verifica se é um arquivo que vem da lib Além - const isAlemFile = importedItemFileSource.includes( - "lib/alem-vm/importable", // OSX, Linux - ) || importedItemFileSource.includes( - "lib\\alem-vm\\importable", // Windows - ) + const isAlemFile = + importedItemFileSource.includes( + "lib/alem-vm/importable", // OSX, Linux + ) || + importedItemFileSource.includes( + "lib\\alem-vm\\importable", // Windows + ); // 2 - Se não for, continua o processo normalmente, se for, ignora o tratamento abaixo if (!isAlemFile) { diff --git a/lib/alem-vm/alem-vm.d.ts b/lib/alem-vm/alem-vm.d.ts index 5a88400..6f1ad66 100644 --- a/lib/alem-vm/alem-vm.d.ts +++ b/lib/alem-vm/alem-vm.d.ts @@ -312,19 +312,39 @@ export declare function useEffect( export declare function useMemo(factory: () => T, deps: DependencyList): T; +type FetchOptions = { + responseType?: + | "arraybuffer" + | "blob" + | "formdata" + | "json" + | "text" + | "application/json"; + method?: string; + headers?: Record; + body?: string; + [key]?: any; +}; + /** * `fetch` allows to fetch data from the URL. It acts like a hook. It's a wrapper around the fetch function from the browser behind the caching layer. * * Know more: https://docs.near.org/bos/api/web-methods#fetch */ -export declare const fetch: (url: string) => { body: any }; +export declare const fetch: ( + url: string, + options?: FetchOptions, +) => { body: any }; /** * `asyncFetch` is the async version of `fetch`, meaning that it returns a promise instead of a value. * - * Know more: https://docs.near.org/bos/api/web-methods#async-version + * Know more: https://docs.near.org/build/near-components/anatomy/web-methods#async-version */ -export declare const asyncFetch: (url: string) => Promise; +export declare const asyncFetch: ( + url: string, + options?: FetchOptions, +) => Promise; /** * The `useCache` hook takes a promise through a generator function, fetches the data and caches it. It can be used to easily use and cache data from async data sources. diff --git a/lib/constants.js b/lib/constants.js index cbaa319..e44781f 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,7 +1,7 @@ const os = require("os"); const ALEM_VM_FOLDER = "alem-vm"; -const isWindows = os.platform().includes('win'); +const isWindows = os.platform().includes("win32"); module.exports = { ALEM_VM_FOLDER, diff --git a/lib/helpers.js b/lib/helpers.js index 25959ca..e1dcdf8 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -520,7 +520,9 @@ function getImportedElementFileSource(fileContent, importedElementName) { // Windows adjusment appContainerImportPath = appContainerImportPath.replaceAll("\\\\", "\\"); - return isWindows ? appContainerImportPath.replaceAll("/", "\\") : appContainerImportPath; + return isWindows + ? appContainerImportPath.replaceAll("/", "\\") + : appContainerImportPath; } /** diff --git a/package-lock.json b/package-lock.json index bf41853..4cae814 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "alem", - "version": "1.0.0-beta.18", + "version": "1.0.0-beta.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "alem", - "version": "1.0.0-beta.18", + "version": "1.0.0-beta.20", "license": "MIT", "dependencies": { "@babel/core": "^7.24.3", diff --git a/package.json b/package.json index 292981f..b3dcf31 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alem", "description": "Create web3 applications for NEAR BOS with a focus on performance and friendly development.", - "version": "1.0.0-beta.19", + "version": "1.0.0-beta.20", "main": "main.js", "types": "index.d.ts", "author": "Wenderson Pires - wendersonpires.near",