Coder Social home page Coder Social logo

cli's Introduction

Join the chat at https://gitter.im/formio/formio StackOverflow

A combined form and API platform for Serverless applications

Form.io is a revolutionary combined Form and API platform for Serverless applications. This repository serves as the core Form and API engine for https://form.io. This system allows you to build "serverless" data management applications using a simple drag-and-drop form builder interface. These forms can then easily be embedded within your Angular.js and React applications using the <formio> HTML element.

Walkthrough video and tutorial

For a walkthrough tutorial on how to use this Open Source platform to build a Serverless application, watch the video 0 to M.E.A.N in 30 minutes

Form Building & Rendering Demo

Here is a link to a demo of the Form Building and Form Rendering capability that can be hooked into this API platform.

http://codepen.io/travist/full/xVyMjo/

Run with Docker Compose

The fastest way to run this library locally is to use Docker.

  • Install Docker

  • Download and unzip this package to a local directory on your machine.

  • Open up your terminal and navigate to the unzipped folder of this library.

  • Type the following in your terminal

    docker-compose up -d
    
  • Go to the following URL in your browser.

    http://localhost:3001
    
  • Use the following credentials to login.

  • To change the admin password.

    • Once you login, click on the Admin resource
    • Click View Data
    • Click on the [email protected] row
    • Click Edit Submission
    • Set the password field
    • Click Save Submission
    • Logout
  • Have fun!

Manual Installation (Node + MongoDB)

To get started you will first need the following installed on your machine.

Running with Node.js

You can then download this repository, navigate to the folder in your Terminal, and then type the following.

npm install
npm start

This will walk you through the installation process. When it is done, you will have a running Form.io management application running at the following address in your browser.

http://localhost:3001

The installation process will also ask if you would like to download an application. If selected, the application can be found at the following URL.

http://localhost:8080

You can also see the contents of the application (for modification) within the app folder which exists inside of the folder where you downloaded this repository.

Development

To start server with auto restart capability for development simply run this command:

npm run start:dev

Deploy to Hosted Form.io

If you wish to deploy all of your forms and resources into the Form.io Hosted platform @ https://portal.form.io, you can do this by using the Form.io CLI command line tool.

npm install -g formio-cli

Once you have this tool installed, you will need to follow these steps.

  • Create a new project within Form.io
  • Create an API Key within this project by going to the Project Settings | Stage Settings | API Keys
  • Next, you can execute the following command to deploy your local project into Hosted Form.io.
formio deploy http://localhost:3001 https://{PROJECTNAME}.form.io --dst-key={APIKEY}

You will need to make sure you replace {PROJECTNAME} and {APIKEY} with your new Hosted Form.io project name (found in the API url), as well as the API key that was created in the second step above.

This will then ask you to log into the local Form.io server (which can be provided within the Admin resource), and then after it authenticates, it will export the project and deploy that project to the Form.io hosted form.

License Change (March 8th, 2020)

This library is now licensed under the OSL-v3 license, which is a copy-left OSI approved license. Please read the license @ https://opensource.org/licenses/OSL-3.0 for more information. Our goal for the change to OSLv3 from BSD is to ensure that appropriate Attribution is provided when creating proprietary products that leverage or extend this library.

Help

We will be updating the help guides found @ https://help.form.io as questions arise and also to help you get started with Form.io.

Thanks for using Form.io!

The Form.io Team.

Security

If you find and/or think you have found a Security issue, please quietly disclose it to [email protected], and give us sufficient time to patch the issue before disclosing it publicly.

cli's People

Contributors

alexeydavyd avatar brendanbond avatar dependabot[bot] avatar lane-formio avatar mikekotikov avatar randallknutson avatar ryanformio avatar tmy2017 avatar travist avatar vinothsubramanian avatar zackurben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

[BUG] Error running migrate command

Environment

Please provide as many details as you can:

  • Hosting type
    • Form.io
    • On-premise environment
    • Local deployment
      • Version:
        • docker image: 7.0.0-rc.57
        • formio cli: 1.8.2
        • node version: v15.0.1
        • OS: MacOS 10.15.7 (19H15)

Steps to Reproduce

  1. run
    formio migrate https://project-x.form.io project https://forms.example.com/project-x --src-key API_KEY --dst-key API_KEY

Expected behavior

The migrate command finish sucessufly

Observed behavior

Migration fails with exception / error:

โžœ ~ formio migrate https://project-x.form.io project https://forms.example.com/project-x --src-key API_KEY --dst-key API_KEY

(node:46702) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)


/ / / | ___ _ __ _ __ ___ () ___ \
/ / | |_ / _ | '| '_ ` _ \ | |/ _ \ \
\ \ | | () | | | | | | | | _ | | () | / /
_|
| _
/|| || || ||()||___/ /_/

Welcome to the Form.io Command Line!

This action requires a login to SOURCE::https://form.io.
An API Key was provided. Authenticated as Project Owner.

This action requires a login to DESTINATION::https://example.com.
An API Key was provided. Authenticated as Project Owner.

Migrating to https://forms.example.com/project-x/admin
Migrating to https://forms.example.com/project-x/admin/login
Migrating to https://forms.example.com/project-x/csite........../usr/local/lib/node_modules/formio-cli/node_modules/async/dist/async.js:318
if (fn === null) throw new Error("Callback was already called.");
^

Error: Callback was already called.
at /usr/local/lib/node_modules/formio-cli/node_modules/async/dist/async.js:318:36
at Transformer. (/usr/local/lib/node_modules/formio-cli/src/migrate.js:152:16)
at Transformer.emit (node:events:327:20)
at finish (node:internal/streams/writable:734:10)
at processTicksAndRejections (node:internal/process/task_queues:80:21)

Separate credentials for destination are not used if source and destination are on same host

I want to copy data between forms on two different projects hosted on form.io. When running

formio migrate https://myprojecta.form.io/someform form https://myprojectb.form.io/someform --src-key abc1234 --dst-key cde2468

the CLI will use the src-key for both source and destination. The result is that reading the data from the source succeeds, but writing it to the destination results in "Unauthorized" errors.

The issue here is that the CLI currently assumes that all endpoints on the same hostname (in this case "form.io") use the same authentication (in src/authenticate.js line 200, the subdomain is not taken into account for the comparison).

I suggest that the whole URL is used in the comparison. If source and destination share the same credentials, the user can supply them twice as parameters.

[BUG] Error running migrate command

Environment

Please provide as many details as you can:

  • Hosting type
    • Form.io
    • On-premise environment
    • Local deployment
      • Version:
  • Formio.js version: 7.0.0-rc46

Steps to Reproduce

  1. Run
    ./bin/formio migrate https://portal.form.io/\#/project/xxxxxxxxx/form/aaaaaaa form https://forms.example.com/\#/project/xxxxxxxxx/form/aaaaaa/ --src-username USERNAME --src-password PASSWORD --username USERNAME --password PASSWORD

Expected behavior

The migrate command finish sucessufly

Observed behavior

The following error:

This action requires a login to SOURCE::https://form.io#/project/xxxxxxxx/form/aaaaaaaaa.

Authenticating to https://form.io#/project/5d95720e46ae113bad5db10b/form/5fa408bd2149cc648af23eb2
Authentication successful

This action requires a login to DESTINATION::https://forms.example.com#/project/xxxxxx/form/aaaaaaa/.

Authenticating to https://forms.example.com#/project/xxxxxx/form/aaaaaaa/
Authentication successful

Migrating to https://forms.example.com/#/project/xxxxxxxx/form/aaaaaaa/internal/streams/legacy.js:61
      throw er; // Unhandled stream error in pipe.
      ^

Error: Invalid JSON (Unexpected "!" at position 1 in state STOP)
    at Parser.proto.charError (/home/user/formio-cli/node_modules/jsonparse/jsonparse.js:90:16)
    at Parser.proto.write (/home/user/formio-cli/node_modules/jsonparse/jsonparse.js:267:27)
    at Stream.<anonymous> (/home/user/formio-cli/node_modules/JSONStream/index.js:23:12)
    at Stream.stream.write (/home/user/formio-cli/node_modules/through/index.js:26:11)
    at Request.ondata (internal/streams/legacy.js:19:31)
    at Request.emit (events.js:314:20)
    at IncomingMessage.<anonymous> (/home/user/formio-cli/node_modules/request/request.js:1073:12)
    at IncomingMessage.emit (events.js:314:20)
    at IncomingMessage.Readable.read (_stream_readable.js:508:10)
    at flow (_stream_readable.js:1008:34)

bootstraping application outputs bad request

Hey,

I was trying to bootstrap an formion app using the following command.

formio bootstrap formio/formio-app-todo
formio bootstrap formio/formio-app-formio

I am getting bad request after I have enter the authentication information. Can you guys help me with this error ?

Error: getaddrinfo ENOTFOUND formio.forms.example.com

When trying to run deploy or migrate commands I'm getting the error:

Error: getaddrinfo ENOTFOUND formio.forms.example.com

This is an on-premise formio environment, the url is i.e forms.example.com and the objective is to migrate a portal project (in portal.form.io) to an on-premise project but the script is adding the formio subdomain when trying to autheticate to the destination.

A workaround to this was to put an entry to the IP of the on-premise portal in /etc/hosts pointing to a domain with the formio part:

123.456.789.12	formio.forms.example.com

This way the destination authetication works and the deploy/migrate step starts. Is there a way to avoid the need to add the /etc/hosts entry?

Error Upon Bind

Environment

Please provide as many details as you can: Trying to run the bind command as documented in the remote middleware docs.

  • Hosting type
    • Form.io
    • Local deployment
      • Version:
  • Formio.js version:
  • Frontend framework: N/A
  • Browser: N/A
  • Browser version: N/A

Steps to Reproduce

  1. Run the formio CLI bind command: formio bind POST https://project-slug.form.io/volunteerform/submission

Observed behavior

I am asks to authenticate and this works fine, however I then get an: Error: Unexpected server response: 400, and the remote middleware does not run. I also tried with simply https://project-slug.form.io/volunteerform (omitting the /submission).

[BUG] Error running deploy command

Environment

Please provide as many details as you can:

  • Hosting type
    • Form.io
    • On-premise environment
    • Local deployment
      • Version:
  • Formio.js version: 7.0.0-rc46

Steps to Reproduce

  1. Run
    ./bin/formio deploy --src-username USER --src-password PASSWORD --username USERNAME --password PASSWORD https://portal.form.io/project/5e861xxxxx20ec06daxxx5f2/ https://forms.example.com/project/5fa465b7bxxx9c7689xxxxd7/

Expected behavior

The deploy command finish sucessufly

Observed behavior

The following error:

Authenticating to https://form.io
Authentication successful

This action requires a login to DESTINATION::https://forms.example.com.

Authenticating to https://forms.example.com
Authentication successful
Exporting Template
Error: <html>
<head><title>404 Not Found</title></head>
<body>
<h1>404 Not Found</h1>
<ul>
<li>Code: NoSuchKey</li>
<li>Message: The specified key does not exist.</li>
<li>Key: project/5e8618469020xxx6da7xxxf2/export</li>
<li>RequestId: E4291F33333C167C</li>
<li>HostId: GhyHVmVqTxEKAVexxxxxxxxMmG+CHMVVUNTJKJ54vi+cF4xxxxxxxxxqrHnmMCpwjPK3+js=</li>
</ul>
<hr/>
</body>
</html>

Steps to Reproduce

If the web URL is used (notice the \#/ part added):
./bin/formio deploy --src-username USERNAME --src-password PASSWORD --username USERNAME --password PASSWORD https://portal.form.io/\#/project/xxxx18469020ec06daxxxxxx/ https://forms.example.com//\#/project/xxxxx5b7b39c9c7689xxxxxx/

Observed behavior

The following error:

This action requires a login to SOURCE::https://form.io#/project/xxxxxx469020ec06daxxxxxx/.

Authenticating to https://form.io#/project/xxxxxx469020ec06daxxxxxx/
Authentication successful

This action requires a login to DESTINATION::https://forms.example.com/#/project/5fa465b7b39c9c76893345d7/.

Authenticating to https://forms.example.com#/project/5fa465b7b39c9c76893345d7/
Authentication successful
Exporting Template
Importing Template
Updating Project
Error: Unexpected token " in JSON at position 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.