{"id":20692103,"url":"https://github.com/richie-south/flying-functions","last_synced_at":"2025-04-22T17:04:05.916Z","repository":{"id":86917962,"uuid":"85070886","full_name":"richie-south/flying-functions","owner":"richie-south","description":"✈️ functions in the cloud with rest api. Test site -\u003e","archived":false,"fork":false,"pushed_at":"2017-05-07T07:48:03.000Z","size":9052,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T17:01:31.826Z","etag":null,"topics":["cloud","cloud-function","functions","microservice"],"latest_commit_sha":null,"homepage":"https://richie-south.github.io/flying-functions/#/flying/create","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richie-south.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-03-15T12:41:01.000Z","updated_at":"2022-09-16T20:54:22.000Z","dependencies_parsed_at":"2023-03-13T19:49:17.675Z","dependency_job_id":null,"html_url":"https://github.com/richie-south/flying-functions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-south%2Fflying-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-south%2Fflying-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-south%2Fflying-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richie-south%2Fflying-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richie-south","download_url":"https://codeload.github.com/richie-south/flying-functions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250285644,"owners_count":21405296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud","cloud-function","functions","microservice"],"created_at":"2024-11-16T23:19:16.537Z","updated_at":"2025-04-22T17:04:05.903Z","avatar_url":"https://github.com/richie-south.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flying-functions  \nYour functions in the cloud with rest api  \n\n\u003cimg src=\"https://raw.githubusercontent.com/richie-south/flying-functions/master/ff.png\" width=\"200\"\u003e  \n\n# Usage  \n\n## Summary  \n\n* [Basic how to](#basic-how-to)\n* [Flying function params](#flying-function-params)\n* [Globals](#globals)\n* [Persistent Storage](#persistent-storage)\n* [Api](#api)\n* [Flying function Api](#flying-functions-api)\n* [Webhook Api](#webhook-api)\n* [Todo](#todo)\n\n\n# Basic how to\n\n 1. write your function like this.\n```javascript\nmodule.exports = async (data) =\u003e {\n  // your code here \n\n  // example\n  return 10; \n};\n```\n 2. post it to flying functions like example in API bellow.\n 3. execute url from response.\n 4. Response from server executing function above.\n```json \n{\n  \"result\": 10,\n  \"invocations\": 1,\n  \"self\": \"URL TO SELF\" \n}\n```\n\n# Flying function params\n\n### Syntax  \n\n```javascript\nmodule.exports = async (data) =\u003e {}\n```\n\n### Parameters\n\n  - data\n    - express req.query (GET) or express req.data (POST)\n\n# Globals  \n\nthese globals are accessible from your flying function  \n\n- console\n- Number\n- Math\n- Promise\n- setTimeout\n- fetch \n  - `isomorphic-fetch` from npm\n- R\n  - `ramda` from npm\n- plura\n  - `plura` from npm\n- flaxa\n  - `flaxa` from npm\n- laiva\n  - `laiva` from npm\n- timeeditApi\n  - `timeeditApi` from npm\n- destructo\n  - `destructo` from npm\n- storageHandler\n  - Persistent storage handler\n- _requestOrigin \n  - What origin is the request from\n- _flyingFunctionData\n  - Object with data about your flying function, contains:\n    - name.\n    - urlId\n    - secretId\n    - invocations:\n      - nr of times function has been invocated (including current)\n    - HTTPType\n\n# Persistent Storage\n\nuse the global `storageHandler` to manipulate data  \n\n## Overview\n\n* [create](#create)\n* [getById](#getbyid)\n* [getByCollectionId](#getbycollectionid)\n* [updateDataById](#updatedatabyid)\n* [remove](#remove)\n* [example](#example)\n\n## create  \n\n### Syntax  \n\n```javascript\nconst result = await storageHandler.create(collectionId, dataToStore)\n```\n\n### Parameters\n\n- collectionId: string\n  - used to store your data under a shared id so you can retirve large collections of that data.\n- dataToStore: object\n  - the data you want to store.  \n\n### Return value\n\nObject stored in the database\n\n## getById  \n\n### Syntax  \n\n```javascript\nconst result = await storageHandler.getById(id)\n```\n\n### Parameters\n\n- id: string\n  - Id for specific resource.  \n\n### Return value\n\nObject stored in the database\n\n## getByCollectionId\n\n### Syntax  \n\n```javascript\nconst result = await storageHandler.getByCollectionId(id)\n```\n\n### Parameters\n\n- id: string\n  - Id of a collection id.  \n\n### Return value\n\nAn Array of multible objects that are stored under the same collection id.\n\n## updateDataById\n\n### Syntax  \n\n```javascript\nconst result = await storageHandler.updateDataById(id, data)\n```\n\n### Parameters\n\n- id: string\n  - Id of a specific resource.  \n- data: object\n  - object of data to be uppdated.\n\n### Return value\n\nUpdated object that is stored in the database.\n\n## remove\n\n### Syntax  \n\n```javascript\nconst result = await storageHandler.remove(id)\n```\n\n### Parameters\n\n- id: string\n  - Id of a specific resource\n\n### Return value\n\nObject confirming the removal.\n\n\n## example\n\n```javascript\nmodule.exports = async (data currentInvocation, flyingId) =\u003e {\n  // all your saved data will be stored with an collection id \n  // so you can retrive all data within an collection\n  const collectionId = flyingId\n\n  // data to store has to be object\n  const dataToStore = {\n    value: 10,\n  };\n\n  const storedData = await flyingStorageHandler.create(collectionId, dataToStore)\n  const storedData2 = await flyingStorageHandler.create(collectionId, { value: 11 })\n  // returns storedData object, _id, collectionId, timestamps\n  await flyingStorageHandler.getById(storedData._id)\n  // returns array of all stored objects on collectionId\n  await flyingStorageHandler.getByCollectionId(collectionId) \n\n  return storedData\n};\n```  \n\n# API\n\n## flying functions api\n\n**GET - /flying/**  \n*view all stored functions - dev only*  \nResponce: \n```json\n[\n  \"ARRY WITH OBJECTS JUST LIKE (GET - /flying/:id)\"\n]\n```\n\n**GET - /flying/:secretId**  \n*info about flying function*  \nResponce:\n```json\n{\n  \"_id\": \"ID OF FLYING FUNCTION\",\n  \"secretId\": \"SECRET ID TO REMOVE/UPDATE/VIEW\",\n  \"name\": \"NAME OF FLYING FUNCTION\",\n  \"code\": \"CODE FOR FLYING FUNCTION\",\n  \"HTTPType\": \"HTTP REQUEST TYPE FOR YOUR FLYING FUNCTION\", \n  \"invocations\": \"NUMBER OF INVOCATIONS FOR FLYING FUNCTION\",\n  \"createdAt\": \"TIME OF CREATION\",\n  \"updatedAt\": \"TIME OF LATEST UPDATE\",\n  \"invocationUrl\": \"URL TO INVOC FLYING FUNCTION\",\n  \"self\": \"URL TO SELF\"\n}\n```\n\n**GET - /flying/:urlId/:name**  \n*invoc flying function*  \nSend flying functions params in query  \nResponce:\n```json\n{\n  \"result\": \"RESULT FROM FLYING FUNCTION\",\n  \"invocations\": \"NUMBER OF INVOCATIONS FOR FLYING FUNCTION\",\n  \"self\": \"URL TO SELF\"\n}\n```\n\n**POST - /flying/:urlId/:name**  \n*invoc flying function*  \nSend flying functions params in body  \nResponce:\n```json\n{\n  \"result\": \"RESULT FROM FLYING FUNCTION\",\n  \"invocations\": \"NUMBER OF INVOCATIONS OF FLYING FUNCTION\",\n  \"self\": \"URL TO SELF\"\n}\n```\n\n**POST - /flying/**  \n*creates a new flying function*  \nSend json object to create flying function  \n```json\n{\n  \"name\": \"YOUR FLYING FUNCTION NAME\",\n  \"code\": \"CODE FOR FLYING FUNCTION\",\n  \"HTTPType\":  \"HTTP REQUEST TYPE FOR YOUR FLYING FUNCTION\"\n}\n```  \nResponce:  \n```json\n{\n  \"invocationUrl\": \"URL TO INVOC FLYING FUNCTION\",\n  \"urlId\": \"ID ONLY USED TO INVOC FLYING FUNCTION\",\n  \"secretId\": \"SECRET ID TO REMOVE/UPDATE/VIEW\",\n  \"name\": \"NAME OF FLYING FUNCTION\",\n  \"HTTPType\": \"HTTP REQUEST TYPE FOR YOUR FLYING FUNCTION\"\n}\n```\n\n**PUT - /flying/:secretId**  \n*updates a flying function*  \nSend json object to update flying function  \n```json\n{\n  \"code\": \"CODE FOR FLYING FUNCTION\"\n}\n```  \nResponce:  \n```json\n{\n  \"message\": \"Flying function updated\"\n}\n```\n\n**DELETE - /flying/:secretId**  \n*removes flying function*  \n\nResponce:  \n```json\n{\n  \"message\": \"Flying function removed\"\n}\n```\n\n## Webhook api\n\n**POST - /webhook/:urlId**  \n*creates a new webhook*  \nSend json object to create webhook  \n```json\n{\n  \"url\": \"WEBHOOK URL\"\n}\n```  \nResponce:  \n```json\n{\n  \"url\": \"WEBHOOK URL\",\n  \"id\": \"ID OF WEBHOOK\",\n}\n```\n**DELETE - /webhook/:id**  \n*removes webhook*  \n\nResponce:  \n```json\n{\n  \"secretId\": \"SECRET ID OF REMOVED FLYING FUNCTION\",\n  \"message\": \"webhook removed!\"\n}\n```\n\n# TODO\n\n## general\n- Code cleanup\n\n## doc  \n\n## client\n- Validation messages\n- Add button to show available globals and examples\n- Localstorage for previously create flying functions and webhooks.\n\n## server  \n- Add more globals\n- Add better api error messages\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichie-south%2Fflying-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichie-south%2Fflying-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichie-south%2Fflying-functions/lists"}