Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fandogh

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fandogh - npm Package Compare versions

Comparing version 0.5.0 to 0.7.0

30

client/index.js
const got = require('got')
const fs = require('fs')
const FormData = require('form-data')
const EventEmitter = require('events').EventEmitter
const baseUrl = 'https://api.fandogh.cloud/fa/api/'

@@ -97,3 +99,2 @@ const { buildImageZip, getConfigValue } = require('../helpers')

try {
let imageName = getConfigValue({source, type:'name'})
imageName = name || imageName

@@ -114,3 +115,6 @@ let headers = client.tokenHeader(token)

*/
postVersion: async ({name, version, source, token}) => {
postVersion: async ({name, version, source, token}) => {
const emitter = new EventEmitter();
try {

@@ -121,7 +125,15 @@ let imageName = getConfigValue({source, type:'name'})

let compressedSource = await buildImageZip(source)
let formData = {
source: fs.createReadStream(compressedSource),
version
}
return await client.request({api: `images/${imageName}/versions`, method:'POST', headers, formData})
const form = new FormData();
form.append('source', fs.createReadStream(compressedSource));
form.append('version', version)
got.post(`images/${imageName}/versions`, {baseUrl, headers, body: form}).on('uploadProgress', progress => {
emitter.emit('uploadProgress', progress)
if(progress.percent === 1){
emitter.emit('finish', progress)
}
}).catch(e => {
emitter.emit('error', e)
Promise.reject(e)
})
return emitter;
} catch(e) {

@@ -146,3 +158,3 @@ return Promise.reject(e)

/**
*
* depracated
* @param image_name

@@ -168,3 +180,3 @@ * @param image_version

postService: async ({token, manifest}) => {
postManifest: async ({token, manifest}) => {
try {

@@ -171,0 +183,0 @@ let headers = client.tokenHeader(token)

@@ -66,7 +66,4 @@ const {getToken, getImages, postImage, getVersions, postVersion, getServices, postService, getLogs, postManifest} = require('./client')

createVersion: async ({name, version, source, token}) => {
try {
return await postVersion({token,version, source, name})
} catch(e) {
return Promise.reject(e)
}
return await postVersion({token,version, source, name})
},

@@ -99,3 +96,3 @@ /**

try {
return await postService({token, params: {image_name, image_version, service_name, environment_variables, port, service_type, source}})
return postService({token, params: {image_name, image_version, service_name, environment_variables, port, service_type, source}})
} catch(e) {

@@ -126,3 +123,3 @@ return Promise.reject(e)

try {
return await postManifest({token, service_name})
return await postManifest({token, manifest})
} catch(e) {

@@ -129,0 +126,0 @@ return Promise.reject(e)

{
"name": "fandogh",
"version": "0.5.0",
"version": "0.7.0",
"description": "fandogh node client",

@@ -13,2 +13,3 @@ "main": "fandogh.js",

"archiver": "^2.1.1",
"form-data": "^2.3.3",
"got": "^9.3.2",

@@ -15,0 +16,0 @@ "js-yaml": "^3.12.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc