From 4ee0424815acf2ac4e6527ba82cbf8298056a535 Mon Sep 17 00:00:00 2001 From: Eneko Nieto Date: Fri, 23 Jan 2026 13:24:51 +0100 Subject: [PATCH] fix: deleted node function, bum working properly --- appwrite.config.json | 22 +--- functions/aemet-node/.gitignore | 133 ------------------------- functions/aemet-node/.prettierrc.json | 6 -- functions/aemet-node/README.md | 46 --------- functions/aemet-node/package-lock.json | 111 --------------------- functions/aemet-node/package.json | 20 ---- functions/aemet-node/src/main.ts | 33 ------ functions/aemet-node/tsconfig.json | 15 --- functions/aemet/bun.lock | 39 ++++++++ functions/aemet/bun.lockb | Bin 4006 -> 0 bytes functions/aemet/package-lock.json | 109 -------------------- functions/aemet/package.json | 2 +- functions/aemet/src/main.ts | 10 +- 13 files changed, 45 insertions(+), 501 deletions(-) delete mode 100644 functions/aemet-node/.gitignore delete mode 100644 functions/aemet-node/.prettierrc.json delete mode 100644 functions/aemet-node/README.md delete mode 100644 functions/aemet-node/package-lock.json delete mode 100644 functions/aemet-node/package.json delete mode 100644 functions/aemet-node/src/main.ts delete mode 100644 functions/aemet-node/tsconfig.json create mode 100644 functions/aemet/bun.lock delete mode 100755 functions/aemet/bun.lockb delete mode 100644 functions/aemet/package-lock.json diff --git a/appwrite.config.json b/appwrite.config.json index e36833d..b5a9e7d 100644 --- a/appwrite.config.json +++ b/appwrite.config.json @@ -39,26 +39,6 @@ } }, "functions": [ - { - "$id": "6972ac200017d1159562", - "name": "aemet-node", - "runtime": "node-22", - "specification": "s-1vcpu-512mb", - "execute": [ - "any" - ], - "events": [], - "scopes": [ - "users.read" - ], - "schedule": "", - "timeout": 15, - "enabled": true, - "logging": true, - "entrypoint": "dist/main.js", - "commands": "npm install && npm run build", - "path": "functions/aemet-node" - }, { "$id": "69736073000fadb92a9f", "name": "aemet", @@ -80,4 +60,4 @@ "path": "functions/aemet" } ] -} \ No newline at end of file +} diff --git a/functions/aemet-node/.gitignore b/functions/aemet-node/.gitignore deleted file mode 100644 index 46afb6b..0000000 --- a/functions/aemet-node/.gitignore +++ /dev/null @@ -1,133 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp -.cache - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -# Directory used by Appwrite CLI for local development -.appwrite \ No newline at end of file diff --git a/functions/aemet-node/.prettierrc.json b/functions/aemet-node/.prettierrc.json deleted file mode 100644 index 0a72520..0000000 --- a/functions/aemet-node/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "trailingComma": "es5", - "tabWidth": 2, - "semi": true, - "singleQuote": true -} diff --git a/functions/aemet-node/README.md b/functions/aemet-node/README.md deleted file mode 100644 index 47cc077..0000000 --- a/functions/aemet-node/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# aemet - -## 🧰 Usage - -### GET /ping - -- Returns a "Pong" message. - -**Response** - -Sample `200` Response: - -```text -Pong -``` - -### GET, POST, PUT, PATCH, DELETE / - -- Returns a "Learn More" JSON response. - -**Response** - -Sample `200` Response: - -```json -{ - "motto": "Build like a team of hundreds_", - "learn": "https://appwrite.io/docs", - "connect": "https://appwrite.io/discord", - "getInspired": "https://builtwith.appwrite.io" -} -``` - -## ⚙️ Configuration - -| Setting | Value | -| ----------------- | ------------- | -| Runtime | Node (18.0) | -| Entrypoint | `src/main.js` | -| Build Commands | `npm install` | -| Permissions | `any` | -| Timeout (Seconds) | 15 | - -## 🔒 Environment Variables - -No environment variables required. diff --git a/functions/aemet-node/package-lock.json b/functions/aemet-node/package-lock.json deleted file mode 100644 index a1688de..0000000 --- a/functions/aemet-node/package-lock.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "aemet", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "aemet", - "version": "1.0.0", - "dependencies": { - "fast-xml-parser": "^5.3.3", - "node-appwrite": "^20.2.1", - "typescript": "^5.4.5" - }, - "devDependencies": { - "@types/node": "^22.19.0", - "prettier": "^3.2.5" - } - }, - "node_modules/@types/node": { - "version": "22.19.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.7.tgz", - "integrity": "sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" - } - }, - "node_modules/fast-xml-parser": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.3.tgz", - "integrity": "sha512-2O3dkPAAC6JavuMm8+4+pgTk+5hoAs+CjZ+sWcQLkX9+/tHRuTkQh/Oaifr8qDmZ8iEHb771Ea6G8CdwkrgvYA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "dependencies": { - "strnum": "^2.1.0" - }, - "bin": { - "fxparser": "src/cli/cli.js" - } - }, - "node_modules/node-appwrite": { - "version": "20.2.1", - "resolved": "https://registry.npmjs.org/node-appwrite/-/node-appwrite-20.2.1.tgz", - "integrity": "sha512-RweIh+3RHjprsxhWaJzcQr/UDMBMsZCma50TIJ9t3onVgs5jAT9aqFnsMlaaC9QZn1sXpPUQV90W6uvtm64DnQ==", - "license": "BSD-3-Clause", - "dependencies": { - "node-fetch-native-with-agent": "1.7.2" - } - }, - "node_modules/node-fetch-native-with-agent": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-fetch-native-with-agent/-/node-fetch-native-with-agent-1.7.2.tgz", - "integrity": "sha512-5MaOOCuJEvcckoz7/tjdx1M6OusOY6Xc5f459IaruGStWnKzlI1qpNgaAwmn4LmFYcsSlj+jBMk84wmmRxfk5g==", - "license": "MIT" - }, - "node_modules/prettier": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", - "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", - "dev": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/strnum": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.2.tgz", - "integrity": "sha512-l63NF9y/cLROq/yqKXSLtcMeeyOfnSQlfMSlzFt/K73oIaD8DGaQWd7Z34X9GPiKqP5rbSh84Hl4bOlLcjiSrQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT" - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/functions/aemet-node/package.json b/functions/aemet-node/package.json deleted file mode 100644 index 85bce6e..0000000 --- a/functions/aemet-node/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "aemet", - "version": "1.0.0", - "description": "", - "main": "src/main.js", - "type": "module", - "scripts": { - "format": "prettier --write .", - "build": "tsc" - }, - "dependencies": { - "fast-xml-parser": "^5.3.3", - "node-appwrite": "^20.2.1", - "typescript": "^5.4.5" - }, - "devDependencies": { - "@types/node": "^22.19.0", - "prettier": "^3.2.5" - } -} diff --git a/functions/aemet-node/src/main.ts b/functions/aemet-node/src/main.ts deleted file mode 100644 index 9991fc7..0000000 --- a/functions/aemet-node/src/main.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Client, Users } from 'node-appwrite'; -import { XMLParser } from 'fast-xml-parser'; - -// This Appwrite function will be executed every time your function is triggered -export default async ({ req, res, log, error }: any) => { - // You can use the Appwrite SDK to interact with other services - // For this example, we're using the Users service - const client = new Client() - .setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT ?? '') - .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID ?? '') - .setKey(req.headers['x-appwrite-key'] ?? ''); - const users = new Users(client); - - try { - const response = await fetch('https://www.aemet.es/xml/municipios_h/localidad_h_31019.xml'); - - if (!response.ok) { - throw new Error(`Error! status: ${response.status}`); - } - - const decoder = new TextDecoder('iso-8859-15'); - let xml = decoder.decode(await response.arrayBuffer()) - - const parser = new XMLParser(); - let json = parser.parse(xml); - log(json) - return res.json({sucess: true, data: json}) - - } catch(err: any) { - error("Error fetching forecast: " + err.message); - return res.json({success: false, error: err.message}) - } -}; diff --git a/functions/aemet-node/tsconfig.json b/functions/aemet-node/tsconfig.json deleted file mode 100644 index ad43694..0000000 --- a/functions/aemet-node/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "NodeNext", - "rootDir": "src", - "resolveJsonModule": true, - "allowJs": true, - "outDir": "dist", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitAny": true, - "skipLibCheck": true - } -} diff --git a/functions/aemet/bun.lock b/functions/aemet/bun.lock new file mode 100644 index 0000000..8c04091 --- /dev/null +++ b/functions/aemet/bun.lock @@ -0,0 +1,39 @@ +{ + "lockfileVersion": 1, + "configVersion": 0, + "workspaces": { + "": { + "name": "starter-template", + "dependencies": { + "fast-xml-parser": "^5.3.3", + "node-appwrite": "^20.2.1", + "typescript": "^5.4.5", + }, + "devDependencies": { + "@types/bun": "^1.1.16", + "prettier": "^3.2.5", + }, + }, + }, + "packages": { + "@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="], + + "@types/node": ["@types/node@22.19.7", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw=="], + + "bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="], + + "fast-xml-parser": ["fast-xml-parser@5.3.3", "", { "dependencies": { "strnum": "^2.1.0" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-2O3dkPAAC6JavuMm8+4+pgTk+5hoAs+CjZ+sWcQLkX9+/tHRuTkQh/Oaifr8qDmZ8iEHb771Ea6G8CdwkrgvYA=="], + + "node-appwrite": ["node-appwrite@20.2.1", "", { "dependencies": { "node-fetch-native-with-agent": "1.7.2" } }, "sha512-RweIh+3RHjprsxhWaJzcQr/UDMBMsZCma50TIJ9t3onVgs5jAT9aqFnsMlaaC9QZn1sXpPUQV90W6uvtm64DnQ=="], + + "node-fetch-native-with-agent": ["node-fetch-native-with-agent@1.7.2", "", {}, "sha512-5MaOOCuJEvcckoz7/tjdx1M6OusOY6Xc5f459IaruGStWnKzlI1qpNgaAwmn4LmFYcsSlj+jBMk84wmmRxfk5g=="], + + "prettier": ["prettier@3.6.2", "", { "bin": "bin/prettier.cjs" }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="], + + "strnum": ["strnum@2.1.2", "", {}, "sha512-l63NF9y/cLROq/yqKXSLtcMeeyOfnSQlfMSlzFt/K73oIaD8DGaQWd7Z34X9GPiKqP5rbSh84Hl4bOlLcjiSrQ=="], + + "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + + "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + } +} diff --git a/functions/aemet/bun.lockb b/functions/aemet/bun.lockb deleted file mode 100755 index c270e5ab7e84912b341a3763a3c9b6c8e9800829..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4006 zcmeH}Yfw{16o79qRt*Sf6|jN@t)Sw)2?+?nh-Dm$qa)&@T2Uw=-h>NzdG7^5sZc5? zA`Cdx*JyDRAETi4RY6DVt563YP<2LIR77lj43ioV zJ~yytcumscyw9eO9CJ3N`qaX;p41x_Gva2xxD+gRV8#Ci>27y=wTKaM=ivuBU{ zF~u9qnN>QgCtrD<{^pN*e_d&`tkaq zYG(X*M@z`a?3Cm<|bTePqs#-Nd%U&}sedqCEgG&jd)XVyvD`u{F`&K{XO{R`s! z{ROpUk-$h zX4-IZoSC^zRRtmbxr3j3u3y(~x_P^LZfNKeXVtFy2PXNSIr}S?lt;5iit`goZ+_5c zz@CQ6Y-P>h4U=~YFDmX2*d5{C^s5b5XtTe{;RVN{jFqOkx=Ok0>eel}FFW?iH$U^~XE@z9=s-@3pK*PKIL?NP&)@9t#`4SV z_1_zhM(*#}Hu&Zdj~8qAnv!&5 z(i_rJwU1`7A?wR+xHulo+^9!Y505urJ|6A0QMCOJo&3z&D?iu%cC6GhxX9&~j7fpy z=1Bv+{5C9nta@C0^lIyh_E`eYsM=4b-`(6gXzAABQX4LgXEQh8$D#&@94}@?wbPQm z2M$GPqx`bNLsi$@PddKzIa0Yda_G*Z>x^X;5kIv~k1knI(%5&+vS_!7{nq4sdm--R zmWei8+j}9*BW~>*=t?9uw7DH@TIpANrGiTA6NWFze!~ANFixvMx_7 z7%?l86nc)*h2$tM>TXu^v+7=r25xr+pCOjr>DcQ-@v2TWDp`(Zrvcv?-jMEekskgQ z)`A}ThIXgd8+~?`*&FEp8UJJlTCCZF5HclHL<&aF@k*_h!uc9CkEQ7_Z>hwaW0unf z^?2_5&e=nZPC4Van!vJ`|s_d#MEih7MrmPy0F(hdW~1ByTN2BH{8cNM(@=#9y= zGPb`X3)>$&#BCuGwnlmvBiZ$P~wmJT<+{tJoQ?7g6H7j0e;Li z?=R=5XS@gpZIoZH3JJO-NOd;FS^Y4yQF@~; zk)sT(M%-y2CT$vI5G9AB!hy>u2|}3r)ike4AoWU~NukMQ44*(M zHME|88{Uo?p3TlMX$~DUH^-{PDlLP4R3g{IY+ZI0Cg{=wTLQ8DmMyV_Di~WTB#Kih zvO&jzZxW^I(G#o&6kH``R0xoIJ`S4@!P{fG!okQeS-*r)F{Jstd)NkBHK5owNz2tj VFms5)pDI!vkuryi#O?o@{2Ps$7FhrQ diff --git a/functions/aemet/package-lock.json b/functions/aemet/package-lock.json deleted file mode 100644 index 1a528c6..0000000 --- a/functions/aemet/package-lock.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "starter-template", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "starter-template", - "version": "1.0.0", - "dependencies": { - "node-appwrite": "^20.2.1" - }, - "devDependencies": { - "@types/bun": "^1.1.16", - "prettier": "^3.0.0" - } - }, - "node_modules/@types/bun": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.0.tgz", - "integrity": "sha512-+lAGCYjXjip2qY375xX/scJeVRmZ5cY0wyHYyCYxNcdEXrQ4AOe3gACgd4iQ8ksOslJtW4VNxBJ8llUwc3a6AA==", - "dev": true, - "license": "MIT", - "dependencies": { - "bun-types": "1.3.0" - } - }, - "node_modules/@types/node": { - "version": "24.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz", - "integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~7.16.0" - } - }, - "node_modules/@types/react": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", - "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "csstype": "^3.0.2" - } - }, - "node_modules/bun-types": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.3.0.tgz", - "integrity": "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - }, - "peerDependencies": { - "@types/react": "^19" - } - }, - "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true, - "license": "MIT", - "peer": true - }, - "node_modules/node-appwrite": { - "version": "20.2.1", - "resolved": "https://registry.npmjs.org/node-appwrite/-/node-appwrite-20.2.1.tgz", - "integrity": "sha512-RweIh+3RHjprsxhWaJzcQr/UDMBMsZCma50TIJ9t3onVgs5jAT9aqFnsMlaaC9QZn1sXpPUQV90W6uvtm64DnQ==", - "license": "BSD-3-Clause", - "dependencies": { - "node-fetch-native-with-agent": "1.7.2" - } - }, - "node_modules/node-fetch-native-with-agent": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-fetch-native-with-agent/-/node-fetch-native-with-agent-1.7.2.tgz", - "integrity": "sha512-5MaOOCuJEvcckoz7/tjdx1M6OusOY6Xc5f459IaruGStWnKzlI1qpNgaAwmn4LmFYcsSlj+jBMk84wmmRxfk5g==", - "license": "MIT" - }, - "node_modules/prettier": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", - "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/functions/aemet/package.json b/functions/aemet/package.json index 4d390c4..0342011 100644 --- a/functions/aemet/package.json +++ b/functions/aemet/package.json @@ -13,7 +13,7 @@ "typescript": "^5.4.5" }, "devDependencies": { - "@types/node": "^22.19.0", + "@types/bun": "^1.1.16", "prettier": "^3.2.5" } } diff --git a/functions/aemet/src/main.ts b/functions/aemet/src/main.ts index f3a0b19..480253b 100644 --- a/functions/aemet/src/main.ts +++ b/functions/aemet/src/main.ts @@ -3,11 +3,9 @@ import { XMLParser } from 'fast-xml-parser'; // This Appwrite function will be executed every time your function is triggered export default async ({ req, res, log, error }: any) => { - // You can use the Appwrite SDK to interact with other services - // For this example, we're using the Users service const client = new Client() - .setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT ?? '') - .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID ?? '') + .setEndpoint(Bun.env["APPWRITE_FUNCTION_API_ENDPOINT"]) + .setProject(Bun.env["APPWRITE_FUNCTION_PROJECT_ID"]) .setKey(req.headers['x-appwrite-key'] ?? ''); const users = new Users(client); @@ -23,8 +21,8 @@ export default async ({ req, res, log, error }: any) => { const parser = new XMLParser(); let json = parser.parse(xml); - log(json) - return res.json({sucess: true, data: json}) + log(json.root.prediccion) + return res.json({ sucess: true, data: json.root.prediccion }) } catch(err: any) { error("Error fetching forecast: " + err.message);