diff --git a/.gitignore b/.gitignore index 5415d9f4f..25fca64a5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ node_modules public locales/zz-ZZ nodes/core/locales/zz-ZZ +!packages/node_modules +packages/node_modules/@node-red/editor-client/public +!test/**/node_modules +docs diff --git a/.npmignore b/.npmignore deleted file mode 100644 index b0d89b67e..000000000 --- a/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.settings -.jshintignore -.jshintrc -.project -.tern-project -.travis.yml -.git diff --git a/.travis.yml b/.travis.yml index 054edefba..94bf3698c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,3 @@ matrix: before_script: - npm install -g istanbul coveralls - node_js: "8" - - node_js: "6" - - node_js: "4" diff --git a/Gruntfile.js b/Gruntfile.js index a1e40d475..44abf1e40 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -42,7 +42,7 @@ module.exports = function(grunt) { reporter: 'spec' }, all: { src: ['test/**/*_spec.js'] }, - core: { src: ["test/_spec.js","test/red/**/*_spec.js"]}, + core: { src: ["test/_spec.js","test/unit/**/*_spec.js"]}, nodes: { src: ["test/nodes/**/*_spec.js"]} }, webdriver: { @@ -59,8 +59,8 @@ module.exports = function(grunt) { reportFormats: ['lcov','html'], print: 'both' }, - all: { src: ["test/_spec.js","test/red/**/*_spec.js","test/nodes/**/*_spec.js"] }, - core: { src: ["test/_spec.js","test/red/**/*_spec.js"]}, + all: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js","test/nodes/**/*_spec.js"] }, + core: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js"]}, nodes: { src: ["test/nodes/**/*_spec.js"]} }, jshint: { @@ -80,16 +80,14 @@ module.exports = function(grunt) { all: [ 'Gruntfile.js', 'red.js', - 'red/**/*.js', - 'nodes/core/*/*.js', - 'editor/js/**/*.js' + 'packages/**/*.js' ], core: { files: { src: [ 'Gruntfile.js', 'red.js', - 'red/**/*.js' + 'packages/**/*.js', ] } }, @@ -120,81 +118,81 @@ module.exports = function(grunt) { src: [ // Ensure editor source files are concatenated in // the right order - "editor/js/red.js", - "editor/js/events.js", - "editor/js/i18n.js", - "editor/js/settings.js", - "editor/js/user.js", - "editor/js/comms.js", - "editor/js/text/bidi.js", - "editor/js/text/format.js", - "editor/js/ui/state.js", - "editor/js/nodes.js", - "editor/js/history.js", - "editor/js/validators.js", - "editor/js/ui/utils.js", - "editor/js/ui/common/editableList.js", - "editor/js/ui/common/checkboxSet.js", - "editor/js/ui/common/menu.js", - "editor/js/ui/common/panels.js", - "editor/js/ui/common/popover.js", - "editor/js/ui/common/searchBox.js", - "editor/js/ui/common/tabs.js", - "editor/js/ui/common/stack.js", - "editor/js/ui/common/typedInput.js", - "editor/js/ui/actions.js", - "editor/js/ui/deploy.js", - "editor/js/ui/diff.js", - "editor/js/ui/keyboard.js", - "editor/js/ui/workspaces.js", - "editor/js/ui/view.js", - "editor/js/ui/view-navigator.js", - "editor/js/ui/sidebar.js", - "editor/js/ui/palette.js", - "editor/js/ui/tab-info.js", - "editor/js/ui/tab-config.js", - "editor/js/ui/tab-context.js", - "editor/js/ui/palette-editor.js", - "editor/js/ui/editor.js", - "editor/js/ui/editors/*.js", - "editor/js/ui/tray.js", - "editor/js/ui/clipboard.js", - "editor/js/ui/library.js", - "editor/js/ui/notifications.js", - "editor/js/ui/search.js", - "editor/js/ui/typeSearch.js", - "editor/js/ui/subflow.js", - "editor/js/ui/userSettings.js", - "editor/js/ui/projects/projects.js", - "editor/js/ui/projects/projectSettings.js", - "editor/js/ui/projects/projectUserSettings.js", - "editor/js/ui/projects/tab-versionControl.js", - "editor/js/ui/touch/radialMenu.js" + "packages/node_modules/@node-red/editor-client/src/js/red.js", + "packages/node_modules/@node-red/editor-client/src/js/events.js", + "packages/node_modules/@node-red/editor-client/src/js/i18n.js", + "packages/node_modules/@node-red/editor-client/src/js/settings.js", + "packages/node_modules/@node-red/editor-client/src/js/user.js", + "packages/node_modules/@node-red/editor-client/src/js/comms.js", + "packages/node_modules/@node-red/editor-client/src/js/text/bidi.js", + "packages/node_modules/@node-red/editor-client/src/js/text/format.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/state.js", + "packages/node_modules/@node-red/editor-client/src/js/nodes.js", + "packages/node_modules/@node-red/editor-client/src/js/history.js", + "packages/node_modules/@node-red/editor-client/src/js/validators.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/utils.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/searchBox.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/stack.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/actions.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/diff.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/view.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/view-navigator.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/sidebar.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/palette.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/tab-info.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/tab-config.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/tab-context.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/editor.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/editors/*.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/tray.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/library.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/search.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/userSettings.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/projects/projects.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/projects/projectSettings.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/projects/projectUserSettings.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/projects/tab-versionControl.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/touch/radialMenu.js" ], - dest: "public/red/red.js" + dest: "packages/node_modules/@node-red/editor-client/public/red/red.js" }, vendor: { files: { - "public/vendor/vendor.js": [ - "editor/vendor/jquery/js/jquery-1.11.3.min.js", - "editor/vendor/bootstrap/js/bootstrap.min.js", - "editor/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js", - "editor/vendor/jquery/js/jquery.ui.touch-punch.min.js", - "editor/vendor/marked/marked.min.js", - "editor/vendor/d3/d3.v3.min.js", - "editor/vendor/i18next/i18next.min.js" + "packages/node_modules/@node-red/editor-client/public/vendor/vendor.js": [ + "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/js/bootstrap.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/marked/marked.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/d3/d3.v3.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js" ], - "public/vendor/vendor.css": [ + "packages/node_modules/@node-red/editor-client/public/vendor/vendor.css": [ // TODO: resolve relative resource paths in // bootstrap/FA/jquery ], - "public/vendor/jsonata/jsonata.min.js": [ + "packages/node_modules/@node-red/editor-client/public/vendor/jsonata/jsonata.min.js": [ "node_modules/jsonata/jsonata-es5.min.js", - "editor/vendor/jsonata/formatter.js" + "packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js" ], - "public/vendor/ace/worker-jsonata.js": [ + "packages/node_modules/@node-red/editor-client/public/vendor/ace/worker-jsonata.js": [ "node_modules/jsonata/jsonata-es5.min.js", - "editor/vendor/jsonata/worker-jsonata.js" + "packages/node_modules/@node-red/editor-client/src/vendor/jsonata/worker-jsonata.js" ] } } @@ -202,10 +200,10 @@ module.exports = function(grunt) { uglify: { build: { files: { - 'public/red/red.min.js': 'public/red/red.js', - 'public/red/main.min.js': 'public/red/main.js', - 'public/vendor/ace/mode-jsonata.js': 'editor/vendor/jsonata/mode-jsonata.js', - 'public/vendor/ace/snippets/jsonata.js': 'editor/vendor/jsonata/snippets-jsonata.js' + 'packages/node_modules/@node-red/editor-client/public/red/red.min.js': 'packages/node_modules/@node-red/editor-client/public/red/red.js', + 'packages/node_modules/@node-red/editor-client/public/red/main.min.js': 'packages/node_modules/@node-red/editor-client/public/red/main.js', + 'packages/node_modules/@node-red/editor-client/public/vendor/ace/mode-jsonata.js': 'packages/node_modules/@node-red/editor-client/src/vendor/jsonata/mode-jsonata.js', + 'packages/node_modules/@node-red/editor-client/public/vendor/ace/snippets/jsonata.js': 'packages/node_modules/@node-red/editor-client/src/vendor/jsonata/snippets-jsonata.js' } } }, @@ -215,50 +213,50 @@ module.exports = function(grunt) { outputStyle: 'compressed' }, files: [{ - dest: 'public/red/style.min.css', - src: 'editor/sass/style.scss' + dest: 'packages/node_modules/@node-red/editor-client/public/red/style.min.css', + src: 'packages/node_modules/@node-red/editor-client/src/sass/style.scss' }, { - dest: 'public/vendor/bootstrap/css/bootstrap.min.css', - src: 'editor/vendor/bootstrap/css/bootstrap.css' + dest: 'packages/node_modules/@node-red/editor-client/public/vendor/bootstrap/css/bootstrap.min.css', + src: 'packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.css' }] } }, jsonlint: { messages: { src: [ - 'nodes/core/locales/en-US/messages.json', - 'red/api/locales/en-US/editor.json', - 'red/runtime/locales/en-US/runtime.json' + 'packages/node_modules/@node-red/nodes/locales/**/*.json', + 'packages/node_modules/@node-red/editor-api/lib/editor/locales/**/*.json', + 'packages/node_modules/@node-red/runtime/locales/**/*.json' ] }, keymaps: { src: [ - 'editor/js/keymap.json' + 'packages/node_modules/@node-red/editor-client/src/js/keymap.json' ] } }, attachCopyright: { js: { src: [ - 'public/red/red.min.js', - 'public/red/main.min.js' + 'packages/node_modules/@node-red/editor-client/public/red/red.min.js', + 'packages/node_modules/@node-red/editor-client/public/red/main.min.js' ] }, css: { src: [ - 'public/red/style.min.css' + 'packages/node_modules/@node-red/editor-client/public/red/style.min.css' ] } }, clean: { build: { src: [ - "public/red", - "public/index.html", - "public/favicon.ico", - "public/icons", - "public/vendor" + "packages/node_modules/@node-red/editor-client/public/red", + "packages/node_modules/@node-red/editor-client/public/index.html", + "packages/node_modules/@node-red/editor-client/public/favicon.ico", + "packages/node_modules/@node-red/editor-client/public/icons", + "packages/node_modules/@node-red/editor-client/public/vendor" ] }, release: { @@ -270,27 +268,27 @@ module.exports = function(grunt) { watch: { js: { files: [ - 'editor/js/**/*.js' + 'packages/node_modules/@node-red/editor-client/src/js/**/*.js' ], tasks: ['copy:build','concat','uglify','attachCopyright:js'] }, sass: { files: [ - 'editor/sass/**/*.scss' + 'packages/node_modules/@node-red/editor-client/src/sass/**/*.scss' ], tasks: ['sass','attachCopyright:css'] }, json: { files: [ - 'nodes/core/locales/en-US/messages.json', - 'red/api/locales/en-US/editor.json', - 'red/runtime/locales/en-US/runtime.json' + 'packages/node_modules/@node-red/nodes/locales/**/*.json', + 'packages/node_modules/@node-red/editor-api/lib/editor/locales/**/*.json', + 'packages/node_modules/@node-red/runtime/locales/**/*.json' ], tasks: ['jsonlint:messages'] }, keymaps: { files: [ - 'editor/js/keymap.json' + 'packages/node_modules/@node-red/editor-client/src/js/keymap.json' ], tasks: ['jsonlint:keymaps','copy:build'] }, @@ -305,12 +303,13 @@ module.exports = function(grunt) { nodemon: { /* uses .nodemonignore */ dev: { - script: 'red.js', + script: 'packages/node_modules/node-red/red.js', options: { args: nodemonArgs, ext: 'js,html,json', watch: [ - 'red','nodes' + 'packages/node_modules', + '!packages/node_modules/@node-red/editor-client' ] } } @@ -329,21 +328,21 @@ module.exports = function(grunt) { build: { files:[ { - src: 'editor/js/main.js', - dest: 'public/red/main.js' + src: 'packages/node_modules/@node-red/editor-client/src/js/main.js', + dest: 'packages/node_modules/@node-red/editor-client/public/red/main.js' }, { - src: 'editor/js/keymap.json', - dest: 'public/red/keymap.json' + src: 'packages/node_modules/@node-red/editor-client/src/js/keymap.json', + dest: 'packages/node_modules/@node-red/editor-client/public/red/keymap.json' }, { - cwd: 'editor/images', + cwd: 'packages/node_modules/@node-red/editor-client/src/images', src: '**', expand: true, - dest: 'public/red/images/' + dest: 'packages/node_modules/@node-red/editor-client/public/red/images/' }, { - cwd: 'editor/vendor', + cwd: 'packages/node_modules/@node-red/editor-client/src/vendor', src: [ 'ace/**', //'bootstrap/css/**', @@ -352,46 +351,25 @@ module.exports = function(grunt) { 'font-awesome/**' ], expand: true, - dest: 'public/vendor/' + dest: 'packages/node_modules/@node-red/editor-client/public/vendor/' }, { - cwd: 'editor/icons', + cwd: 'packages/node_modules/@node-red/editor-client/src/icons', src: '**', expand: true, - dest: 'public/icons/' + dest: 'packages/node_modules/@node-red/editor-client/public/icons/' }, { expand: true, - src: ['editor/index.html','editor/favicon.ico'], - dest: 'public/', + src: ['packages/node_modules/@node-red/editor-client/src/index.html','packages/node_modules/@node-red/editor-client/src/favicon.ico'], + dest: 'packages/node_modules/@node-red/editor-client/public/', flatten: true }, { src: 'CHANGELOG.md', - dest: 'public/red/about' + dest: 'packages/node_modules/@node-red/editor-client/public/red/about' } ] - }, - release: { - files: [{ - mode: true, - expand: true, - src: [ - '*.md', - 'LICENSE', - 'package.json', - 'settings.js', - 'red.js', - 'lib/.gitignore', - 'nodes/*.demo', - 'nodes/core/**', - 'red/**', - 'public/**', - 'editor/templates/**', - 'bin/**' - ], - dest: path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>') - }] } }, chmod: { @@ -400,8 +378,8 @@ module.exports = function(grunt) { }, release: { src: [ - path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/nodes/core/hardware/nrgpio*'), - path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/red/runtime/storage/localfilesystem/projects/git/node-red-*sh') + "packages/node_modules/@node-red/nodes/core/hardware/nrgpio", + "packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/node-red-*sh" ] } }, @@ -411,8 +389,43 @@ module.exports = function(grunt) { archive: '<%= paths.dist %>/node-red-<%= pkg.version %>.zip' }, expand: true, - cwd: '<%= paths.dist %>/', - src: ['node-red-<%= pkg.version %>/**'] + cwd: 'packages/node_modules/', + src: [ + '**', + '!@node-red/editor-client/src/**' + ] + } + }, + jsdoc : { + runtimeAPI: { + src: 'packages/node_modules/@node-red/runtime/lib/api/*.js', + options: { + destination: 'docs', + configure: './jsdoc.json' + } + }, + nodeREDUtil: { + src: 'packages/node_modules/@node-red/util/**/*.js', + options: { + destination: 'packages/node_modules/@node-red/util/docs', + configure: './jsdoc.json' + } + } + }, + jsdoc2md: { + runtimeAPI: { + options: { + separators: true + }, + src: 'packages/node_modules/@node-red/runtime/lib/api/*.js', + dest: 'docs/runtime-api.md' + }, + nodeREDUtil: { + options: { + separators: true + }, + src: 'packages/node_modules/@node-red/util/**/*.js', + dest: 'packages/node_modules/@node-red/util/docs/api.md' } } }); @@ -432,6 +445,8 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-jsonlint'); grunt.loadNpmTasks('grunt-mocha-istanbul'); grunt.loadNpmTasks('grunt-webdriver'); + grunt.loadNpmTasks('grunt-jsdoc'); + grunt.loadNpmTasks('grunt-jsdoc-to-markdown'); grunt.registerMultiTask('attachCopyright', function() { var files = this.data.src; @@ -473,6 +488,15 @@ module.exports = function(grunt) { } }); + grunt.registerTask('verifyPackageDependencies', function() { + var verifyDependencies = require("./scripts/verify-package-dependencies.js"); + var failures = verifyDependencies(); + if (failures.length > 0) { + failures.forEach(f => grunt.log.error(f)); + grunt.fail.fatal("Failed to verify package dependencies"); + } + }); + grunt.registerTask('setDevEnv', 'Sets NODE_ENV=development so non-minified assets are used', function () { @@ -481,7 +505,7 @@ module.exports = function(grunt) { grunt.registerTask('default', 'Builds editor content then runs code style checks and unit tests on all components', - ['build','jshint:editor','mocha_istanbul:all']); + ['build','verifyPackageDependencies','jshint:editor','mocha_istanbul:all']); grunt.registerTask('test-core', 'Runs code style check and unit tests on core runtime code', @@ -509,9 +533,13 @@ module.exports = function(grunt) { grunt.registerTask('release', 'Create distribution zip file', - ['build','clean:release','copy:release','chmod:release','compress:release']); + ['build','verifyPackageDependencies','clean:release','chmod:release','compress:release']); grunt.registerTask('coverage', 'Run Istanbul code test coverage task', ['build','mocha_istanbul:all']); + + grunt.registerTask('docs', + 'Generates API documentation', + ['jsdoc','jsdoc2md']); }; diff --git a/README.md b/README.md index c1306a796..cde5dd1d8 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,6 @@ If you want to run the latest code from git, here's how to get started: 4. Run npm start - or - - node red.js ## Contributing diff --git a/jsdoc.json b/jsdoc.json new file mode 100644 index 000000000..dca8b7e26 --- /dev/null +++ b/jsdoc.json @@ -0,0 +1,26 @@ +{ + "opts": { + "template": "./node_modules/jsdoc-nr-template", + "destination": "./docs", + "recurse": true + }, + "tags": { + "allowUnknownTags": false, + "dictionaries": ["jsdoc"] + }, + "source": { + "_include": [ + "./packages/node_modules/@node-red/runtime/lib/api" + ] + }, + "templates": { + "systemName": "Node-RED Runtime API", + "theme":"yeti", + "footer": "", + "copyright": "Released under the Apache License v2.0", + "default": { + "outputSourceFiles": false + } + }, + "plugins": ["plugins/markdown"] +} diff --git a/lib/.gitignore b/lib/.gitignore deleted file mode 100644 index 72e8ffc0d..000000000 --- a/lib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/nodes/core/io/lib/mqttConnectionPool.js b/nodes/core/io/lib/mqttConnectionPool.js deleted file mode 100644 index e7b520582..000000000 --- a/nodes/core/io/lib/mqttConnectionPool.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ -var util = require("util"); -var mqtt = require("./mqtt"); -var settings = require(process.env.NODE_RED_HOME+"/red/red").settings; - -util.log("[warn] nodes/core/io/lib/mqttConnectionPool.js is deprecated and will be removed in a future release of Node-RED. Please report this usage to the Node-RED mailing list."); - -var connections = {}; - -function matchTopic(ts,t) { - if (ts == "#") { - return true; - } - var re = new RegExp("^"+ts.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g,"\\$1").replace(/\+/g,"[^/]+").replace(/\/#$/,"(\/.*)?")+"$"); - return re.test(t); -} - -module.exports = { - get: function(broker,port,clientid,username,password,will) { - var id = "["+(username||"")+":"+(password||"")+"]["+(clientid||"")+"]@"+broker+":"+port; - if (!connections[id]) { - connections[id] = function() { - var uid = (1+Math.random()*4294967295).toString(16); - var client = mqtt.createClient(port,broker); - client.uid = uid; - client.setMaxListeners(0); - var options = {keepalive:15}; - options.clientId = clientid || 'mqtt_' + (1+Math.random()*4294967295).toString(16); - options.username = username; - options.password = password; - options.will = will; - var queue = []; - var subscriptions = {}; - var connecting = false; - var obj = { - _instances: 0, - publish: function(msg) { - if (client.isConnected()) { - client.publish(msg.topic,msg.payload,msg.qos,msg.retain); - } else { - if (!connecting) { - connecting = true; - client.connect(options); - } - queue.push(msg); - } - }, - subscribe: function(topic,qos,callback,ref) { - ref = ref||0; - subscriptions[topic] = subscriptions[topic]||{}; - - var sub = { - topic:topic, - qos:qos, - handler:function(mtopic,mpayload,mqos,mretain) { - if (matchTopic(topic,mtopic)) { - callback(mtopic,mpayload,mqos,mretain); - } - }, - ref: ref - }; - subscriptions[topic][ref] = sub; - client.on('message',sub.handler); - if (client.isConnected()) { - client.subscribe(topic,qos); - } - }, - unsubscribe: function(topic,ref) { - ref = ref||0; - var sub = subscriptions[topic]; - if (sub) { - if (sub[ref]) { - client.removeListener('message',sub[ref].handler); - delete sub[ref]; - } - if (Object.keys(sub).length == 0) { - delete subscriptions[topic]; - client.unsubscribe(topic); - } - } - }, - on: function(a,b){ - client.on(a,b); - }, - once: function(a,b){ - client.once(a,b); - }, - connect: function() { - if (client && !client.isConnected() && !connecting) { - connecting = true; - client.connect(options); - } - }, - disconnect: function(ref) { - - this._instances -= 1; - if (this._instances == 0) { - client.disconnect(); - client = null; - delete connections[id]; - } - }, - isConnected: function() { - return client.isConnected(); - } - }; - client.on('connect',function() { - if (client) { - util.log('[mqtt] ['+uid+'] connected to broker tcp://'+broker+':'+port); - connecting = false; - for (var s in subscriptions) { - var topic = s; - var qos = 0; - for (var r in subscriptions[s]) { - qos = Math.max(qos,subscriptions[s][r].qos); - } - client.subscribe(topic,qos); - } - //console.log("connected - publishing",queue.length,"messages"); - while(queue.length) { - var msg = queue.shift(); - //console.log(msg); - client.publish(msg.topic,msg.payload,msg.qos,msg.retain); - } - } - }); - client.on('connectionlost', function(err) { - util.log('[mqtt] ['+uid+'] connection lost to broker tcp://'+broker+':'+port); - connecting = false; - setTimeout(function() { - obj.connect(); - }, settings.mqttReconnectTime||5000); - }); - client.on('disconnect', function() { - connecting = false; - util.log('[mqtt] ['+uid+'] disconnected from broker tcp://'+broker+':'+port); - }); - - return obj - }(); - } - connections[id]._instances += 1; - return connections[id]; - } -}; diff --git a/package.json b/package.json index c0bf3b94d..d26870846 100644 --- a/package.json +++ b/package.json @@ -1,121 +1,116 @@ { - "name": "node-red", - "version": "0.19.4", - "description": "A visual tool for wiring the Internet of Things", - "homepage": "http://nodered.org", - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "https://github.com/node-red/node-red.git" - }, - "main": "red/red.js", - "scripts": { - "start": "node red.js", - "test": "grunt", - "build": "grunt build" - }, - "bin": { - "node-red": "./red.js", - "node-red-pi": "bin/node-red-pi" - }, - "contributors": [ - { - "name": "Nick O'Leary" + "name": "node-red", + "version": "0.20.0", + "description": "A visual tool for wiring the Internet of Things", + "homepage": "http://nodered.org", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/node-red/node-red.git" }, - { - "name": "Dave Conway-Jones" + "private": "true", + "scripts": { + "start": "node packages/node_modules/node-red/red.js", + "test": "grunt", + "build": "grunt build", + "docs": "grunt docs" + }, + "contributors": [ + { + "name": "Nick O'Leary" + }, + { + "name": "Dave Conway-Jones" + } + ], + "dependencies": { + "ajv": "6.5.3", + "basic-auth": "2.0.0", + "bcryptjs": "2.4.3", + "body-parser": "1.18.3", + "cheerio": "0.22.0", + "clone": "2.1.2", + "cookie": "0.3.1", + "cookie-parser": "1.4.3", + "cors": "2.8.4", + "cron": "1.4.1", + "denque": "1.3.0", + "express": "4.16.3", + "express-session": "1.15.6", + "fs-extra": "5.0.0", + "fs.notify": "0.0.4", + "hash-sum": "1.0.2", + "https-proxy-agent": "2.2.1", + "i18next": "11.6.0", + "is-utf8": "0.2.1", + "js-yaml": "3.12.0", + "json-stringify-safe": "5.0.1", + "jsonata": "1.5.4", + "media-typer": "0.3.0", + "memorystore": "1.6.0", + "mime": "1.4.1", + "mqtt": "2.18.8", + "multer": "1.3.1", + "mustache": "2.3.2", + "node-red-node-email": "0.1.*", + "node-red-node-feedparser": "^0.1.12", + "node-red-node-rbe": "0.2.*", + "node-red-node-twitter": "^1.1.0", + "nopt": "4.0.1", + "oauth2orize": "1.11.0", + "on-headers": "1.0.1", + "passport": "0.4.0", + "passport-http-bearer": "1.0.1", + "passport-oauth2-client-password": "0.1.2", + "raw-body": "2.3.3", + "request": "2.88.0", + "semver": "5.5.1", + "sentiment": "2.1.0", + "uglify-js": "3.4.9", + "when": "3.7.8", + "ws": "1.1.5", + "xml2js": "0.4.19" + }, + "optionalDependencies": { + "bcrypt": "~2.0.0" + }, + "devDependencies": { + "chromedriver": "^2.41.0", + "grunt": "~1.0.3", + "grunt-chmod": "~1.1.1", + "grunt-cli": "~1.3.1", + "grunt-concurrent": "~2.3.1", + "grunt-contrib-clean": "~1.1.0", + "grunt-contrib-compress": "~1.4.0", + "grunt-contrib-concat": "~1.0.1", + "grunt-contrib-copy": "~1.0.0", + "grunt-contrib-jshint": "~1.1.0", + "grunt-contrib-uglify": "~3.4.0", + "grunt-contrib-watch": "~1.1.0", + "grunt-jsdoc": "^2.2.1", + "grunt-jsdoc-to-markdown": "^4.0.0", + "grunt-jsonlint": "~1.1.0", + "grunt-mocha-istanbul": "5.0.2", + "grunt-nodemon": "~0.4.2", + "grunt-sass": "~2.0.0", + "grunt-simple-mocha": "~0.4.1", + "grunt-webdriver": "^2.0.3", + "http-proxy": "^1.16.2", + "istanbul": "0.4.5", + "minami": "1.2.3", + "mocha": "^5.2.0", + "should": "^8.4.0", + "sinon": "1.17.7", + "stoppable": "^1.0.6", + "supertest": "3.1.0", + "wdio-chromedriver-service": "^0.1.3", + "wdio-mocha-framework": "^0.6.2", + "wdio-spec-reporter": "^0.1.5", + "webdriverio": "^4.13.1", + "node-red-node-test-helper": "node-red/node-red-node-test-helper", + "jsdoc-nr-template": "node-red/jsdoc-nr-template" + }, + "engines": { + "node": ">=8" } - ], - "keywords": [ - "editor", - "messaging", - "iot", - "flow" - ], - "dependencies": { - "ajv": "6.5.3", - "basic-auth": "2.0.0", - "bcryptjs": "2.4.3", - "body-parser": "1.18.3", - "cheerio": "0.22.0", - "clone": "2.1.2", - "cookie": "0.3.1", - "cookie-parser": "1.4.3", - "cors": "2.8.4", - "cron": "1.4.1", - "denque": "1.3.0", - "express": "4.16.3", - "express-session": "1.15.6", - "fs-extra": "5.0.0", - "fs.notify": "0.0.4", - "hash-sum": "1.0.2", - "https-proxy-agent": "2.2.1", - "i18next": "11.6.0", - "is-utf8": "0.2.1", - "js-yaml": "3.12.0", - "json-stringify-safe": "5.0.1", - "jsonata": "1.5.4", - "media-typer": "0.3.0", - "memorystore": "1.6.0", - "mqtt": "2.18.8", - "multer": "1.3.1", - "mustache": "2.3.2", - "node-red-node-email": "0.1.*", - "node-red-node-feedparser": "^0.1.12", - "node-red-node-rbe": "0.2.*", - "node-red-node-twitter": "^1.1.0", - "nopt": "4.0.1", - "oauth2orize": "1.11.0", - "on-headers": "1.0.1", - "passport": "0.4.0", - "passport-http-bearer": "1.0.1", - "passport-oauth2-client-password": "0.1.2", - "raw-body": "2.3.3", - "request": "2.88.0", - "semver": "5.5.1", - "sentiment": "2.1.0", - "uglify-js": "3.4.9", - "when": "3.7.8", - "ws": "1.1.5", - "xml2js": "0.4.19" - }, - "optionalDependencies": { - "bcrypt": "~2.0.0" - }, - "devDependencies": { - "chromedriver": "^2.41.0", - "grunt": "~1.0.3", - "grunt-chmod": "~1.1.1", - "grunt-cli": "~1.3.1", - "grunt-concurrent": "~2.3.1", - "grunt-contrib-clean": "~1.1.0", - "grunt-contrib-compress": "~1.4.0", - "grunt-contrib-concat": "~1.0.1", - "grunt-contrib-copy": "~1.0.0", - "grunt-contrib-jshint": "~1.1.0", - "grunt-contrib-uglify": "~3.4.0", - "grunt-contrib-watch": "~1.1.0", - "grunt-jsonlint": "~1.1.0", - "grunt-mocha-istanbul": "5.0.2", - "grunt-nodemon": "~0.4.2", - "grunt-sass": "~2.0.0", - "grunt-simple-mocha": "~0.4.1", - "grunt-webdriver": "^2.0.3", - "http-proxy": "^1.16.2", - "istanbul": "0.4.5", - "mocha": "^5.2.0", - "mosca": "^2.8.3", - "node-red-node-test-helper": "0.1.7", - "should": "^8.4.0", - "sinon": "1.17.7", - "stoppable": "^1.0.6", - "supertest": "3.1.0", - "wdio-chromedriver-service": "^0.1.3", - "wdio-mocha-framework": "^0.6.2", - "wdio-spec-reporter": "^0.1.5", - "webdriverio": "^4.13.1" - }, - "engines": { - "node": ">=4" - } } diff --git a/packages/node_modules/@node-red/editor-api/LICENSE b/packages/node_modules/@node-red/editor-api/LICENSE new file mode 100644 index 000000000..fc619bd15 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/LICENSE @@ -0,0 +1,178 @@ +Copyright JS Foundation and other contributors, http://js.foundation + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/packages/node_modules/@node-red/editor-api/README.md b/packages/node_modules/@node-red/editor-api/README.md new file mode 100644 index 000000000..47c4bac96 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/README.md @@ -0,0 +1,12 @@ +@node-red/editor-api +==================== + +Node-RED editor api module. + +This provides an Express application that can be used to serve the Node-RED +editor. + + +### Source + +The main Node-RED modules are maintained as a monorepo on [GitHub](https://github.com/node-red/node-red). diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/context.js b/packages/node_modules/@node-red/editor-api/lib/admin/context.js new file mode 100644 index 000000000..09b1aa53b --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/admin/context.js @@ -0,0 +1,41 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var apiUtils = require("../util"); + +var runtimeAPI; + + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + + get: function(req,res) { + var opts = { + user: req.user, + scope: req.params.scope, + id: req.params.id, + key: req.params[0], + store: req.query['store'] + } + runtimeAPI.context.getValue(opts).then(function(result) { + res.json(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } +} diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/flow.js b/packages/node_modules/@node-red/editor-api/lib/admin/flow.js new file mode 100644 index 000000000..5ba5d7a04 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/admin/flow.js @@ -0,0 +1,69 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var runtimeAPI; +var apiUtils = require("../util"); + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + get: function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.flows.getFlow(opts).then(function(result) { + return res.json(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + post: function(req,res) { + var opts = { + user: req.user, + flow: req.body + } + runtimeAPI.flows.addFlow(opts).then(function(id) { + return res.json({id:id}); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + put: function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + flow: req.body + } + runtimeAPI.flows.updateFlow(opts).then(function(id) { + return res.json({id:id}); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + delete: function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.flows.deleteFlow(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } +} diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/flows.js b/packages/node_modules/@node-red/editor-api/lib/admin/flows.js new file mode 100644 index 000000000..ccad8718f --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/admin/flows.js @@ -0,0 +1,70 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var runtimeAPI; +var apiUtils = require("../util"); + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + get: function(req,res) { + var version = req.get("Node-RED-API-Version")||"v1"; + if (!/^v[12]$/.test(version)) { + return res.status(400).json({code:"invalid_api_version", message:"Invalid API Version requested"}); + } + var opts = { + user: req.user + } + runtimeAPI.flows.getFlows(opts).then(function(result) { + if (version === "v1") { + res.json(result.flows); + } else if (version === "v2") { + res.json(result); + } + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + post: function(req,res) { + var version = req.get("Node-RED-API-Version")||"v1"; + if (!/^v[12]$/.test(version)) { + return res.status(400).json({code:"invalid_api_version", message:"Invalid API Version requested"}); + } + var opts = { + user: req.user, + deploymentType: req.get("Node-RED-Deployment-Type")||"full" + } + + if (opts.deploymentType !== 'reload') { + if (version === "v1") { + opts.flows = {flows: req.body} + } else { + opts.flows = req.body; + } + } + + runtimeAPI.flows.setFlows(opts).then(function(result) { + if (version === "v1") { + res.status(204).end(); + } else { + res.json(result); + } + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } +} diff --git a/red/api/admin/index.js b/packages/node_modules/@node-red/editor-api/lib/admin/index.js similarity index 87% rename from red/api/admin/index.js rename to packages/node_modules/@node-red/editor-api/lib/admin/index.js index 15e56aecf..1f77b70b4 100644 --- a/red/api/admin/index.js +++ b/packages/node_modules/@node-red/editor-api/lib/admin/index.js @@ -25,11 +25,11 @@ var auth = require("../auth"); var apiUtil = require("../util"); module.exports = { - init: function(runtime) { - flows.init(runtime); - flow.init(runtime); - nodes.init(runtime); - context.init(runtime); + init: function(runtimeAPI) { + flows.init(runtimeAPI); + flow.init(runtimeAPI); + nodes.init(runtimeAPI); + context.init(runtimeAPI); var needsPermission = auth.needsPermission; @@ -48,6 +48,8 @@ module.exports = { // Nodes adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll,apiUtil.errorHandler); adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post,apiUtil.errorHandler); + adminApp.get(/\/nodes\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalogs,apiUtil.errorHandler); + adminApp.get(/\/nodes\/((@[^\/]+\/)?[^\/]+\/[^\/]+)\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalog,apiUtil.errorHandler); adminApp.get(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.read"),nodes.getModule,apiUtil.errorHandler); adminApp.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.write"),nodes.putModule,apiUtil.errorHandler); adminApp.delete(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.write"),nodes.delete,apiUtil.errorHandler); diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js b/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js new file mode 100644 index 000000000..59a137587 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js @@ -0,0 +1,173 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var apiUtils = require("../util"); + +var runtimeAPI; + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + getAll: function(req,res) { + var opts = { + user: req.user + } + if (req.get("accept") == "application/json") { + runtimeAPI.nodes.getNodeList(opts).then(function(list) { + res.json(list); + }) + } else { + opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages()); + runtimeAPI.nodes.getNodeConfigs(opts).then(function(configs) { + res.send(configs); + }) + } + }, + + post: function(req,res) { + var opts = { + user: req.user, + module: req.body.module, + version: req.body.version + } + runtimeAPI.nodes.addModule(opts).then(function(info) { + res.json(info); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + + delete: function(req,res) { + var opts = { + user: req.user, + module: req.params[0] + } + runtimeAPI.nodes.removeModule(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + + getSet: function(req,res) { + var opts = { + user: req.user, + id: req.params[0] + "/" + req.params[2] + } + if (req.get("accept") === "application/json") { + runtimeAPI.nodes.getNodeInfo(opts).then(function(result) { + res.send(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } else { + opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages()); + runtimeAPI.nodes.getNodeConfig(opts).then(function(result) { + return res.send(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } + }, + + getModule: function(req,res) { + var opts = { + user: req.user, + module: req.params[0] + } + runtimeAPI.nodes.getModuleInfo(opts).then(function(result) { + res.send(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + + putSet: function(req,res) { + var body = req.body; + if (!body.hasOwnProperty("enabled")) { + // log.audit({event: "nodes.module.set",error:"invalid_request"},req); + res.status(400).json({code:"invalid_request", message:"Invalid request"}); + return; + } + var opts = { + user: req.user, + id: req.params[0] + "/" + req.params[2], + enabled: body.enabled + } + runtimeAPI.nodes.setNodeSetState(opts).then(function(result) { + res.send(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }, + + putModule: function(req,res) { + var body = req.body; + if (!body.hasOwnProperty("enabled")) { + // log.audit({event: "nodes.module.set",error:"invalid_request"},req); + res.status(400).json({code:"invalid_request", message:"Invalid request"}); + return; + } + var opts = { + user: req.user, + module: req.params[0], + enabled: body.enabled + } + runtimeAPI.nodes.setModuleState(opts).then(function(result) { + res.send(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + + }, + + getModuleCatalog: function(req,res) { + var opts = { + user: req.user, + module: req.params[0], + lang: req.query.lng + } + runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) { + res.json(result); + }).catch(function(err) { + console.log(err.stack); + apiUtils.rejectHandler(req,res,err); + }) + }, + + getModuleCatalogs: function(req,res) { + var opts = { + user: req.user, + lang: req.query.lng + } + runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) { + res.json(result); + }).catch(function(err) { + console.log(err.stack); + apiUtils.rejectHandler(req,res,err); + }) + }, + + getIcons: function(req,res) { + var opts = { + user: req.user + } + runtimeAPI.nodes.getIconList(opts).then(function(list) { + res.json(list); + }); + } +}; diff --git a/red/api/auth/clients.js b/packages/node_modules/@node-red/editor-api/lib/auth/clients.js similarity index 100% rename from red/api/auth/clients.js rename to packages/node_modules/@node-red/editor-api/lib/auth/clients.js diff --git a/red/api/auth/index.js b/packages/node_modules/@node-red/editor-api/lib/auth/index.js similarity index 97% rename from red/api/auth/index.js rename to packages/node_modules/@node-red/editor-api/lib/auth/index.js index 211a712a7..138dd12f5 100644 --- a/red/api/auth/index.js +++ b/packages/node_modules/@node-red/editor-api/lib/auth/index.js @@ -25,7 +25,7 @@ var permissions = require("./permissions"); var theme = require("../editor/theme"); var settings = null; -var log = null +var log = require("@node-red/util").log; // TODO: separate module passport.use(strategies.bearerStrategy.BearerStrategy); @@ -36,13 +36,11 @@ var server = oauth2orize.createServer(); server.exchange(oauth2orize.exchange.password(strategies.passwordTokenExchange)); -function init(runtime) { - settings = runtime.settings; - log = runtime.log; +function init(_settings,storage) { + settings = _settings; if (settings.adminAuth) { Users.init(settings.adminAuth); - Tokens.init(settings.adminAuth,runtime.storage); - strategies.init(runtime); + Tokens.init(settings.adminAuth,storage); } } diff --git a/red/api/auth/permissions.js b/packages/node_modules/@node-red/editor-api/lib/auth/permissions.js similarity index 100% rename from red/api/auth/permissions.js rename to packages/node_modules/@node-red/editor-api/lib/auth/permissions.js diff --git a/red/api/auth/strategies.js b/packages/node_modules/@node-red/editor-api/lib/auth/strategies.js similarity index 98% rename from red/api/auth/strategies.js rename to packages/node_modules/@node-red/editor-api/lib/auth/strategies.js index 0f5b554e4..b17bf1473 100644 --- a/red/api/auth/strategies.js +++ b/packages/node_modules/@node-red/editor-api/lib/auth/strategies.js @@ -26,7 +26,7 @@ var Users = require("./users"); var Clients = require("./clients"); var permissions = require("./permissions"); -var log; +var log = require("@node-red/util").log; // TODO: separate module var bearerStrategy = function (accessToken, done) { // is this a valid token? @@ -124,9 +124,6 @@ AnonymousStrategy.prototype.authenticate = function(req) { } module.exports = { - init: function(runtime) { - log = runtime.log; - }, bearerStrategy: bearerStrategy, clientPasswordStrategy: clientPasswordStrategy, passwordTokenExchange: passwordTokenExchange, diff --git a/red/api/auth/tokens.js b/packages/node_modules/@node-red/editor-api/lib/auth/tokens.js similarity index 100% rename from red/api/auth/tokens.js rename to packages/node_modules/@node-red/editor-api/lib/auth/tokens.js diff --git a/red/api/auth/users.js b/packages/node_modules/@node-red/editor-api/lib/auth/users.js similarity index 100% rename from red/api/auth/users.js rename to packages/node_modules/@node-red/editor-api/lib/auth/users.js diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/comms.js b/packages/node_modules/@node-red/editor-api/lib/editor/comms.js new file mode 100644 index 000000000..adca1602d --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/editor/comms.js @@ -0,0 +1,243 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var ws = require("ws"); + +var log = require("@node-red/util").log; // TODO: separate module +var Tokens; +var Users; +var Permissions; + +var server; +var settings; +var runtimeAPI; + +var wsServer; +var activeConnections = []; + +var anonymousUser; + +var retained = {}; + +var heartbeatTimer; +var lastSentTime; + +function init(_server,_settings,_runtimeAPI) { + server = _server; + settings = _settings; + runtimeAPI = _runtimeAPI; + Tokens = require("../auth/tokens"); + Users = require("../auth/users"); + Permissions = require("../auth/permissions"); + +} + +function generateSession(length) { + var c = "ABCDEFGHIJKLMNOPQRSTUZWXYZabcdefghijklmnopqrstuvwxyz1234567890"; + var token = []; + for (var i=0;i webSocketKeepAliveTime) { + activeConnections.forEach(connection => connection.send("hb",lastSentTime)); + } + }, webSocketKeepAliveTime); + }); + } +} + +function stop() { + if (heartbeatTimer) { + clearInterval(heartbeatTimer); + heartbeatTimer = null; + } + if (wsServer) { + wsServer.close(); + wsServer = null; + } +} + +function addActiveConnection(connection) { + activeConnections.push(connection); + runtimeAPI.comms.addConnection({client: connection}); +} +function removeActiveConnection(connection) { + for (var i=0;i { + if (!started) { + log.error("Node-RED runtime not started"); + res.status(503).send("Not started"); + } else { + next() + } + }) } module.exports = { - init: function(server, _runtime) { - runtime = _runtime; - log = runtime.log; + init: function(server, settings, _runtimeAPI) { + runtimeAPI = _runtimeAPI; needsPermission = auth.needsPermission; - var settings = runtime.settings; if (!settings.disableEditor) { - info.init(runtime); - comms.init(server,runtime); + info.init(runtimeAPI); + comms.init(server,settings,runtimeAPI); var ui = require("./ui"); - ui.init(runtime); + + ui.init(runtimeAPI); + var editorApp = express(); if (settings.requireHttps === true) { editorApp.enable('trust proxy'); @@ -67,31 +71,31 @@ module.exports = { editorApp.get("/icons/:scope/:module/:icon",ui.icon); var theme = require("./theme"); - theme.init(runtime); + theme.init(settings); editorApp.use("/theme",theme.app()); editorApp.use("/",ui.editorResources); //Projects var projects = require("./projects"); - projects.init(runtime); + projects.init(runtimeAPI); editorApp.use("/projects",projects.app()); // Locales var locales = require("./locales"); - locales.init(runtime); - editorApp.get('/locales/nodes',locales.getAllNodes,apiUtil.errorHandler); + locales.init(runtimeAPI); editorApp.get(/locales\/(.+)\/?$/,locales.get,apiUtil.errorHandler); // Library var library = require("./library"); - library.init(editorApp,runtime); - editorApp.post(new RegExp("/library/flows\/(.*)"),needsPermission("library.write"),library.post,apiUtil.errorHandler); + library.init(runtimeAPI); editorApp.get("/library/flows",needsPermission("library.read"),library.getAll,apiUtil.errorHandler); - editorApp.get(new RegExp("/library/flows\/(.*)"),needsPermission("library.read"),library.get,apiUtil.errorHandler); + editorApp.get(/library\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry); + editorApp.post(/library\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry); + // Credentials var credentials = require("./credentials"); - credentials.init(runtime); + credentials.init(runtimeAPI); editorApp.get('/credentials/:type/:id', needsPermission("credentials.read"),credentials.get,apiUtil.errorHandler); // Settings @@ -100,18 +104,15 @@ module.exports = { editorApp.get("/settings/user",needsPermission("settings.read"),info.userSettings,apiUtil.errorHandler); // User Settings editorApp.post("/settings/user",needsPermission("settings.write"),info.updateUserSettings,apiUtil.errorHandler); - // SSH keys - var sshkeys = require("./sshkeys"); - sshkeys.init(runtime); - editorApp.use("/settings/user/keys",sshkeys.app()); + editorApp.use("/settings/user/keys",needsPermission("settings.write"),info.sshkeys()); return editorApp; } }, start: function() { var catalogPath = path.resolve(path.join(__dirname,"locales")); - return runtime.i18n.registerMessageCatalogs([ + return i18n.registerMessageCatalogs([ {namespace: "editor", dir: catalogPath, file:"editor.json"}, {namespace: "jsonata", dir: catalogPath, file:"jsonata.json"}, {namespace: "infotips", dir: catalogPath, file:"infotips.json"} @@ -119,7 +120,5 @@ module.exports = { comms.start(); }); }, - stop: comms.stop, - publish: comms.publish, - registerLibrary: library.register + stop: comms.stop } diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/library.js b/packages/node_modules/@node-red/editor-api/lib/editor/library.js new file mode 100644 index 000000000..e8b09424a --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/editor/library.js @@ -0,0 +1,83 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var apiUtils = require("../util"); +var fs = require('fs'); +var fspath = require('path'); +var when = require('when'); + +var runtimeAPI; + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + + getAll: function(req,res) { + var opts = { + user: req.user, + type: 'flows' + } + runtimeAPI.library.getEntries(opts).then(function(result) { + res.json(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }, + getEntry: function(req,res) { + var opts = { + user: req.user, + type: req.params[0], + path: req.params[1]||"" + } + runtimeAPI.library.getEntry(opts).then(function(result) { + if (typeof result === "string") { + if (opts.type === 'flows') { + res.writeHead(200, {'Content-Type': 'application/json'}); + } else { + res.writeHead(200, {'Content-Type': 'text/plain'}); + } + res.write(result); + res.end(); + } else { + res.json(result); + } + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }, + saveEntry: function(req,res) { + var opts = { + user: req.user, + type: req.params[0], + path: req.params[1]||"" + } + // TODO: horrible inconsistencies between flows and all other types + if (opts.type === "flows") { + opts.meta = {}; + opts.body = JSON.stringify(req.body); + } else { + opts.meta = req.body; + opts.body = opts.meta.text; + delete opts.meta.text; + } + runtimeAPI.library.saveEntry(opts).then(function(result) { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + } +} diff --git a/red/api/editor/locales.js b/packages/node_modules/@node-red/editor-api/lib/editor/locales.js similarity index 73% rename from red/api/editor/locales.js rename to packages/node_modules/@node-red/editor-api/lib/editor/locales.js index f9ef022ee..ecf21d1ff 100644 --- a/red/api/editor/locales.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/locales.js @@ -16,13 +16,14 @@ var fs = require('fs'); var path = require('path'); //var apiUtil = require('../util'); -var i18n; -var redNodes; + +var i18n = require("@node-red/util").i18n; // TODO: separate module + +var runtimeAPI; module.exports = { - init: function(runtime) { - i18n = runtime.i18n; - redNodes = runtime.nodes; + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; }, get: function(req,res) { var namespace = req.params[0]; @@ -36,17 +37,5 @@ module.exports = { res.json(catalog||{}); }); i18n.i.changeLanguage(prevLang); - - }, - getAllNodes: function(req,res) { - var lngs = req.query.lng; - var nodeList = redNodes.getNodeList(); - var result = {}; - nodeList.forEach(function(n) { - if (n.module !== "node-red") { - result[n.id] = i18n.i.getResourceBundle(lngs, n.id)||{}; - } - }); - res.json(result); } } diff --git a/red/api/editor/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/editor.json similarity index 99% rename from red/api/editor/locales/en-US/editor.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/editor.json index cb9029810..97295d706 100644 --- a/red/api/editor/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/editor.json @@ -172,7 +172,10 @@ "modifiedFlowsDesc": "Only deploys flows that contain changed nodes", "modifiedNodes": "Modified Nodes", "modifiedNodesDesc": "Only deploys nodes that have changed", + "restartFlows": "Restart Flows", + "restartFlowsDesc": "Restarts the current deployed flows", "successfulDeploy": "Successfully deployed", + "successfulRestart": "Successfully restarted flows", "deployFailed": "Deploy failed: __message__", "unusedConfigNodes":"You have some unused configuration nodes.", "unusedConfigNodesLink":"Click here to see them", diff --git a/red/api/editor/locales/en-US/infotips.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/infotips.json similarity index 100% rename from red/api/editor/locales/en-US/infotips.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/infotips.json diff --git a/red/api/editor/locales/en-US/jsonata.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/jsonata.json similarity index 100% rename from red/api/editor/locales/en-US/jsonata.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/en-US/jsonata.json diff --git a/red/api/editor/locales/ja/editor.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/ja/editor.json similarity index 100% rename from red/api/editor/locales/ja/editor.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/ja/editor.json diff --git a/red/api/editor/locales/ja/infotips.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/ja/infotips.json similarity index 100% rename from red/api/editor/locales/ja/infotips.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/ja/infotips.json diff --git a/red/api/editor/locales/ja/jsonata.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/ja/jsonata.json similarity index 100% rename from red/api/editor/locales/ja/jsonata.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/ja/jsonata.json diff --git a/red/api/editor/locales/zh-CN/editor.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/zh-CN/editor.json similarity index 100% rename from red/api/editor/locales/zh-CN/editor.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/zh-CN/editor.json diff --git a/red/api/editor/locales/zh-CN/infotips.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/zh-CN/infotips.json similarity index 100% rename from red/api/editor/locales/zh-CN/infotips.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/zh-CN/infotips.json diff --git a/red/api/editor/locales/zh-CN/jsonata.json b/packages/node_modules/@node-red/editor-api/lib/editor/locales/zh-CN/jsonata.json similarity index 100% rename from red/api/editor/locales/zh-CN/jsonata.json rename to packages/node_modules/@node-red/editor-api/lib/editor/locales/zh-CN/jsonata.json diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/projects.js b/packages/node_modules/@node-red/editor-api/lib/editor/projects.js new file mode 100644 index 000000000..468580459 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/editor/projects.js @@ -0,0 +1,507 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var express = require("express"); +var apiUtils = require("../util"); + +var runtimeAPI; +var needsPermission = require("../auth").needsPermission; + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + app: function() { + var app = express(); + + app.use(function(req,res,next) { + runtimeAPI.projects.available().then(function(available) { + if (!available) { + res.status(404).end(); + } else { + next(); + } + }) + }); + + // Projects + + // List all projects + app.get("/", needsPermission("projects.read"), function(req,res) { + var opts = { + user: req.user + } + runtimeAPI.projects.listProjects(opts).then(function(result) { + res.json(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }); + + // Create project + app.post("/", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + project: req.body + } + runtimeAPI.projects.createProject(opts).then(function(result) { + res.json(result); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }); + + // Update a project + app.put("/:id", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + project: req.body + } + + if (req.body.active) { + runtimeAPI.projects.setActiveProject(opts).then(function() { + res.redirect(303,req.baseUrl + '/'); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } else if (req.body.initialise) { + runtimeAPI.projects.initialiseProject(opts).then(function() { + res.redirect(303,req.baseUrl + '/'+ req.params.id); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } else if (req.body.hasOwnProperty('credentialSecret') || + req.body.hasOwnProperty('description') || + req.body.hasOwnProperty('dependencies')|| + req.body.hasOwnProperty('summary') || + req.body.hasOwnProperty('files') || + req.body.hasOwnProperty('git')) { + runtimeAPI.projects.updateProject(opts).then(function() { + res.redirect(303,req.baseUrl + '/'+ req.params.id); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + } else { + res.status(400).json({error:"unexpected_error", message:"invalid_request"}); + } + }); + + // Get project metadata + app.get("/:id", needsPermission("projects.read"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.projects.getProject(opts).then(function(data) { + if (data) { + res.json(data); + } else { + res.status(404).end(); + } + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Delete project + app.delete("/:id", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.projects.deleteProject(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + + // Get project status - files, commit counts, branch info + app.get("/:id/status", needsPermission("projects.read"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + remote: req.query.remote + } + runtimeAPI.projects.getStatus(opts).then(function(data){ + if (data) { + res.json(data); + } else { + res.status(404).end(); + } + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + + // Project file listing + app.get("/:id/files", needsPermission("projects.read"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.projects.getFiles(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + + }); + + + // Get file content in a given tree (index/stage) + app.get("/:id/files/:treeish/*", needsPermission("projects.read"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.params[0], + tree: req.params.treeish + } + runtimeAPI.projects.getFile(opts).then(function(data) { + res.json({content:data}); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Revert a file + app.delete("/:id/files/_/*", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.params[0] + } + + runtimeAPI.projects.revertFile(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Stage a file + app.post("/:id/stage/*", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.params[0] + } + runtimeAPI.projects.stageFile(opts).then(function() { + res.redirect(303,req.baseUrl+"/"+opts.id+"/status"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Stage multiple files + app.post("/:id/stage", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.body.files + } + runtimeAPI.projects.stageFile(opts).then(function() { + res.redirect(303,req.baseUrl+"/"+opts.id+"/status"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Commit changes + app.post("/:id/commit", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + message: req.body.message + } + runtimeAPI.projects.commit(opts).then(function() { + res.redirect(303,req.baseUrl+"/"+opts.id+"/status"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Unstage a file + app.delete("/:id/stage/*", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.params[0] + } + runtimeAPI.projects.unstageFile(opts).then(function() { + res.redirect(303,req.baseUrl+"/"+opts.id+"/status"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Unstage multiple files + app.delete("/:id/stage", needsPermission("projects.write"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.projects.unstageFile(opts).then(function() { + res.redirect(303,req.baseUrl+"/"+opts.id+"/status"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get a file diff + app.get("/:id/diff/:type/*", needsPermission("projects.read"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.params[0], + type: req.params.type + } + runtimeAPI.projects.getFileDiff(opts).then(function(data) { + res.json({ + diff: data + }) + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get a list of commits + app.get("/:id/commits", needsPermission("projects.read"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + limit: req.query.limit || 20, + before: req.query.before + } + runtimeAPI.projects.getCommits(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get an individual commit details + app.get("/:id/commits/:sha", needsPermission("projects.read"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + sha: req.params.sha + } + runtimeAPI.projects.getCommit(opts).then(function(data) { + res.json({commit:data}); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Push local commits to remote + app.post("/:id/push/?*", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + remote: req.params[0], + track: req.query.u + } + runtimeAPI.projects.push(opts).then(function(data) { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Pull remote commits + app.post("/:id/pull/?*", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + remote: req.params[0], + track: req.query.setUpstream, + allowUnrelatedHistories: req.query.allowUnrelatedHistories + } + runtimeAPI.projects.pull(opts).then(function(data) { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Abort an ongoing merge + app.delete("/:id/merge", needsPermission("projects.write"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.projects.abortMerge(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Resolve a merge + app.post("/:id/resolve/*", needsPermission("projects.write"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + path: req.params[0], + resolution: req.body.resolutions + } + runtimeAPI.projects.resolveMerge(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get a list of local branches + app.get("/:id/branches", needsPermission("projects.read"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + remote: false + } + runtimeAPI.projects.getBranches(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Delete a local branch - ?force=true + app.delete("/:id/branches/:branchName", needsPermission("projects.write"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + branch: req.params.branchName, + force: !!req.query.force + } + runtimeAPI.projects.deleteBranch(opts).then(function(data) { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get a list of remote branches + app.get("/:id/branches/remote", needsPermission("projects.read"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + remote: true + } + runtimeAPI.projects.getBranches(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get branch status - commit counts/ahead/behind + app.get("/:id/branches/remote/*/status", needsPermission("projects.read"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + branch: req.params[0] + } + runtimeAPI.projects.getBranchStatus(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Set the active local branch + app.post("/:id/branches", needsPermission("projects.write"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + branch: req.body.name, + create: req.body.create + } + runtimeAPI.projects.setBranch(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Get a list of remotes + app.get("/:id/remotes", needsPermission("projects.read"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.projects.getRemotes(opts).then(function(data) { + res.json(data); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Add a remote + app.post("/:id/remotes", needsPermission("projects.write"), function(req,res) { + var opts = { + user: req.user, + id: req.params.id, + remote: req.body + } + if (/^https?:\/\/[^/]+@/i.test(req.body.url)) { + res.status(400).json({error:"unexpected_error", message:"Git http url must not include username/password"}); + return; + } + runtimeAPI.projects.addRemote(opts).then(function(data) { + res.redirect(303,req.baseUrl+"/"+opts.id+"/remotes"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Delete a remote + app.delete("/:id/remotes/:remoteName", needsPermission("projects.write"), function(req, res) { + var opts = { + user: req.user, + id: req.params.id, + remote: req.params.remoteName + } + runtimeAPI.projects.removeRemote(opts).then(function(data) { + res.redirect(303,req.baseUrl+"/"+opts.id+"/remotes"); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + // Update a remote + app.put("/:id/remotes/:remoteName", needsPermission("projects.write"), function(req,res) { + var remote = req.body || {}; + remote.name = req.params.remoteName; + var opts = { + user: req.user, + id: req.params.id, + remote: remote + } + runtimeAPI.projects.updateRemote(opts).then(function() { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }) + }); + + return app; + } +} diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/settings.js b/packages/node_modules/@node-red/editor-api/lib/editor/settings.js new file mode 100644 index 000000000..4c2ea5847 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/editor/settings.js @@ -0,0 +1,60 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +var apiUtils = require("../util"); +var runtimeAPI; +var sshkeys = require("./sshkeys"); +var theme = require("./theme"); + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + sshkeys.init(runtimeAPI); + }, + runtimeSettings: function(req,res) { + var opts = { + user: req.user + } + runtimeAPI.settings.getRuntimeSettings(opts).then(function(result) { + var themeSettings = theme.settings(); + if (themeSettings) { + result.editorTheme = themeSettings; + } + res.json(result); + }); + }, + userSettings: function(req, res) { + var opts = { + user: req.user + } + runtimeAPI.settings.getUserSettings(opts).then(function(result) { + res.json(result); + }); + }, + updateUserSettings: function(req,res) { + var opts = { + user: req.user, + settings: req.body + } + runtimeAPI.settings.updateUserSettings(opts).then(function(result) { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }, + sshkeys: function() { + return sshkeys.app() + } +} diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/sshkeys.js b/packages/node_modules/@node-red/editor-api/lib/editor/sshkeys.js new file mode 100644 index 000000000..3e7b0de87 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/lib/editor/sshkeys.js @@ -0,0 +1,101 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var apiUtils = require("../util"); +var express = require("express"); +var runtimeAPI; + +function getUsername(userObj) { + var username = '__default'; + if ( userObj && userObj.name ) { + username = userObj.name; + } + return username; +} + +module.exports = { + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + }, + app: function() { + var app = express(); + + // List all SSH keys + app.get("/", function(req,res) { + var opts = { + user: req.user + } + runtimeAPI.settings.getUserKeys(opts).then(function(list) { + res.json({ + keys: list + }); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }); + + // Get SSH key detail + app.get("/:id", function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.settings.getUserKey(opts).then(function(data) { + res.json({ + publickey: data + }); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }); + + // Generate a SSH key + app.post("/", function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + // TODO: validate params + opts.name = req.body.name; + opts.password = req.body.password; + opts.comment = req.body.comment; + opts.size = req.body.size; + + runtimeAPI.settings.generateUserKey(opts).then(function(name) { + res.json({ + name: name + }); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }); + + // Delete a SSH key + app.delete("/:id", function(req,res) { + var opts = { + user: req.user, + id: req.params.id + } + runtimeAPI.settings.removeUserKey(opts).then(function(name) { + res.status(204).end(); + }).catch(function(err) { + apiUtils.rejectHandler(req,res,err); + }); + }); + + return app; + } +} diff --git a/red/api/editor/theme.js b/packages/node_modules/@node-red/editor-api/lib/editor/theme.js similarity index 96% rename from red/api/editor/theme.js rename to packages/node_modules/@node-red/editor-api/lib/editor/theme.js index 6699e7cd7..ea088b3eb 100644 --- a/red/api/editor/theme.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/theme.js @@ -40,7 +40,6 @@ var defaultContext = { var theme = null; var themeContext = clone(defaultContext); var themeSettings = null; -var runtime = null; var themeApp; @@ -78,12 +77,8 @@ function serveFilesFromTheme(themeValue, themeApp, directory) { } module.exports = { - init: function(runtime) { - var settings = runtime.settings; + init: function(settings) { themeContext = clone(defaultContext); - if (runtime.version) { - themeContext.version = runtime.version(); - } themeSettings = null; theme = settings.editorTheme || {}; }, diff --git a/red/api/editor/ui.js b/packages/node_modules/@node-red/editor-api/lib/editor/ui.js similarity index 57% rename from red/api/editor/ui.js rename to packages/node_modules/@node-red/editor-api/lib/editor/ui.js index aec8c2fef..d37439c92 100644 --- a/red/api/editor/ui.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/ui.js @@ -17,18 +17,22 @@ var express = require('express'); var fs = require("fs"); var path = require("path"); var Mustache = require("mustache"); +var mime = require("mime"); + +var apiUtils = require("../util"); var theme = require("./theme"); -var redNodes; - -var templateDir = path.resolve(__dirname+"/../../../editor/templates"); +var runtimeAPI; +var editorClientDir = path.dirname(require.resolve("@node-red/editor-client")); +var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.png"); +var editorTemplatePath = path.join(editorClientDir,"templates","index.mst"); var editorTemplate; module.exports = { - init: function(runtime) { - redNodes = runtime.nodes; - editorTemplate = fs.readFileSync(path.join(templateDir,"index.mst"),"utf8"); + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; + editorTemplate = fs.readFileSync(editorTemplatePath,"utf8"); Mustache.parse(editorTemplate); }, @@ -46,11 +50,26 @@ module.exports = { var icon = req.params.icon; var scope = req.params.scope; var module = scope ? scope + '/' + req.params.module : req.params.module; - var iconPath = redNodes.getNodeIconPath(module,icon); - res.sendFile(iconPath); + var opts = { + user: req.user, + module: module, + icon: icon + } + runtimeAPI.nodes.getIcon(opts).then(function(data) { + if (data) { + var contentType = mime.lookup(icon); + res.set("Content-Type", contentType); + res.send(data); + } else { + res.sendFile(defaultNodeIcon); + } + }).catch(function(err) { + console.log(err.stack); + apiUtils.rejectHandler(req,res,err); + }) }, editor: function(req,res) { res.send(Mustache.render(editorTemplate,theme.context())); }, - editorResources: express.static(__dirname + '/../../../public') + editorResources: express.static(path.join(editorClientDir,'public')) }; diff --git a/red/api/index.js b/packages/node_modules/@node-red/editor-api/lib/index.js similarity index 82% rename from red/api/index.js rename to packages/node_modules/@node-red/editor-api/lib/index.js index dab88064c..51fd1079c 100644 --- a/red/api/index.js +++ b/packages/node_modules/@node-red/editor-api/lib/index.js @@ -26,17 +26,21 @@ var apiUtil = require("./util"); var adminApp; var server; -var runtime; var editor; -function init(_server,_runtime) { +function init(_server,settings,storage,runtimeAPI) { server = _server; - runtime = _runtime; - var settings = runtime.settings; if (settings.httpAdminRoot !== false) { - apiUtil.init(runtime); adminApp = express(); - auth.init(runtime); + + var cors = require('cors'); + var corsHandler = cors({ + origin: "*", + methods: "GET,PUT,POST,DELETE" + }); + adminApp.use(corsHandler); + + auth.init(settings,storage); var maxApiRequestSize = settings.apiMaxLength || '5mb'; adminApp.use(bodyParser.json({limit:maxApiRequestSize})); @@ -61,7 +65,7 @@ function init(_server,_runtime) { // Editor if (!settings.disableEditor) { editor = require("./editor"); - var editorApp = editor.init(server, runtime); + var editorApp = editor.init(server, settings, runtimeAPI); adminApp.use(editorApp); } @@ -70,7 +74,7 @@ function init(_server,_runtime) { adminApp.use(corsHandler); } - var adminApiApp = require("./admin").init(runtime); + var adminApiApp = require("./admin").init(runtimeAPI); adminApp.use(adminApiApp); } else { adminApp = null; @@ -93,23 +97,9 @@ module.exports = { init: init, start: start, stop: stop, - library: { - register: function(type) { - if (editor) { - editor.registerLibrary(type); - } - } - }, auth: { needsPermission: auth.needsPermission }, - comms: { - publish: function(topic,data,retain) { - if (editor) { - editor.publish(topic,data,retain); - } - } - }, get adminApp() { return adminApp; }, get server() { return server; } }; diff --git a/red/api/util.js b/packages/node_modules/@node-red/editor-api/lib/util.js similarity index 80% rename from red/api/util.js rename to packages/node_modules/@node-red/editor-api/lib/util.js index bb3e2be47..73c222e5c 100644 --- a/red/api/util.js +++ b/packages/node_modules/@node-red/editor-api/lib/util.js @@ -15,16 +15,12 @@ **/ -var i18n; -var log; +var log = require("@node-red/util").log; // TODO: separate module +var i18n = require("@node-red/util").i18n; // TODO: separate module + module.exports = { - init: function(_runtime) { - log = _runtime.log; - i18n = _runtime.i18n; - }, errorHandler: function(err,req,res,next) { - console.error(err.stack); if (err.message === "request entity too large") { log.error(err); } else { @@ -41,5 +37,11 @@ module.exports = { lang = acceptedLanguages[0]; } return lang; + }, + rejectHandler: function(req,res,err) { + res.status(err.status||500).json({ + code: err.code||"unexpected_error", + message: err.message||err.toString() + }); } } diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json new file mode 100644 index 000000000..7ad9293c0 --- /dev/null +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -0,0 +1,33 @@ +{ + "name": "@node-red/editor", + "version": "0.20.0", + "license": "Apache-2.0", + "main": "./lib/index.js", + "repository": { + "type": "git", + "url": "https://github.com/node-red/node-red.git" + }, + "contributors": [ + { "name": "Nick O'Leary" }, + { "name": "Dave Conway-Jones"} + ], + "dependencies": { + "@node-red/util": "*", + "@node-red/editor-client": "*", + "bcryptjs": "2.4.3", + "body-parser": "1.18.3", + "clone": "2.1.2", + "cors": "2.8.4", + "express-session": "1.15.6", + "express": "4.16.3", + "memorystore": "1.6.0", + "mime": "1.4.1", + "mustache": "2.3.2", + "oauth2orize": "1.11.0", + "passport-http-bearer": "1.0.1", + "passport-oauth2-client-password": "0.1.2", + "passport": "0.4.0", + "when": "3.7.8", + "ws": "1.1.5" + } +} diff --git a/packages/node_modules/@node-red/editor-client/.npmignore b/packages/node_modules/@node-red/editor-client/.npmignore new file mode 100644 index 000000000..85de9cf93 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/.npmignore @@ -0,0 +1 @@ +src diff --git a/packages/node_modules/@node-red/editor-client/LICENSE b/packages/node_modules/@node-red/editor-client/LICENSE new file mode 100644 index 000000000..fc619bd15 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/LICENSE @@ -0,0 +1,178 @@ +Copyright JS Foundation and other contributors, http://js.foundation + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/packages/node_modules/@node-red/editor-client/README.md b/packages/node_modules/@node-red/editor-client/README.md new file mode 100644 index 000000000..18781bfb3 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/README.md @@ -0,0 +1,10 @@ +@node-red/editor-client +==================== + +Node-RED editor resources module. + +This provides all of the client-side resources of the Node-RED editor application. + +### Source + +The main Node-RED modules are maintained as a monorepo on [GitHub](https://github.com/node-red/node-red). diff --git a/editor/js/red.js b/packages/node_modules/@node-red/editor-client/index.js similarity index 96% rename from editor/js/red.js rename to packages/node_modules/@node-red/editor-client/index.js index daced75cd..14800aae9 100644 --- a/editor/js/red.js +++ b/packages/node_modules/@node-red/editor-client/index.js @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -var RED = {}; + +module.exports = false diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json new file mode 100644 index 000000000..a352d1ab2 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/package.json @@ -0,0 +1,14 @@ +{ + "name": "@node-red/editor-client", + "version": "0.20.0", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/node-red/node-red.git" + }, + "contributors": [ + { "name": "Nick O'Leary" }, + { "name": "Dave Conway-Jones"} + ], + "main": "./lib/index.js" +} diff --git a/editor/favicon.ico b/packages/node_modules/@node-red/editor-client/src/favicon.ico similarity index 100% rename from editor/favicon.ico rename to packages/node_modules/@node-red/editor-client/src/favicon.ico diff --git a/editor/images/deploy-flows-o.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.png similarity index 100% rename from editor/images/deploy-flows-o.png rename to packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.png diff --git a/editor/images/deploy-flows.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.png similarity index 100% rename from editor/images/deploy-flows.png rename to packages/node_modules/@node-red/editor-client/src/images/deploy-flows.png diff --git a/editor/images/deploy-full-o.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.png similarity index 100% rename from editor/images/deploy-full-o.png rename to packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.png diff --git a/editor/images/deploy-full.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-full.png similarity index 100% rename from editor/images/deploy-full.png rename to packages/node_modules/@node-red/editor-client/src/images/deploy-full.png diff --git a/editor/images/deploy-nodes-o.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.png similarity index 100% rename from editor/images/deploy-nodes-o.png rename to packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.png diff --git a/editor/images/deploy-nodes.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.png similarity index 100% rename from editor/images/deploy-nodes.png rename to packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.png diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.png new file mode 100644 index 000000000..197fc610d Binary files /dev/null and b/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.png differ diff --git a/editor/images/grip.png b/packages/node_modules/@node-red/editor-client/src/images/grip.png similarity index 100% rename from editor/images/grip.png rename to packages/node_modules/@node-red/editor-client/src/images/grip.png diff --git a/editor/icons/arrow-in.png b/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.png similarity index 100% rename from editor/icons/arrow-in.png rename to packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.png diff --git a/editor/icons/node-changed.png b/packages/node_modules/@node-red/editor-client/src/images/icons/node-changed.png similarity index 100% rename from editor/icons/node-changed.png rename to packages/node_modules/@node-red/editor-client/src/images/icons/node-changed.png diff --git a/editor/icons/node-error.png b/packages/node_modules/@node-red/editor-client/src/images/icons/node-error.png similarity index 100% rename from editor/icons/node-error.png rename to packages/node_modules/@node-red/editor-client/src/images/icons/node-error.png diff --git a/editor/images/node-red-256.png b/packages/node_modules/@node-red/editor-client/src/images/node-red-256.png similarity index 100% rename from editor/images/node-red-256.png rename to packages/node_modules/@node-red/editor-client/src/images/node-red-256.png diff --git a/editor/images/node-red-icon-black.svg b/packages/node_modules/@node-red/editor-client/src/images/node-red-icon-black.svg similarity index 100% rename from editor/images/node-red-icon-black.svg rename to packages/node_modules/@node-red/editor-client/src/images/node-red-icon-black.svg diff --git a/editor/images/node-red-icon.svg b/packages/node_modules/@node-red/editor-client/src/images/node-red-icon.svg similarity index 100% rename from editor/images/node-red-icon.svg rename to packages/node_modules/@node-red/editor-client/src/images/node-red-icon.svg diff --git a/editor/images/node-red.png b/packages/node_modules/@node-red/editor-client/src/images/node-red.png similarity index 100% rename from editor/images/node-red.png rename to packages/node_modules/@node-red/editor-client/src/images/node-red.png diff --git a/editor/images/pw_maze_white.png b/packages/node_modules/@node-red/editor-client/src/images/pw_maze_white.png similarity index 100% rename from editor/images/pw_maze_white.png rename to packages/node_modules/@node-red/editor-client/src/images/pw_maze_white.png diff --git a/editor/images/spin.svg b/packages/node_modules/@node-red/editor-client/src/images/spin.svg similarity index 100% rename from editor/images/spin.svg rename to packages/node_modules/@node-red/editor-client/src/images/spin.svg diff --git a/editor/images/subflow_tab.png b/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.png similarity index 100% rename from editor/images/subflow_tab.png rename to packages/node_modules/@node-red/editor-client/src/images/subflow_tab.png diff --git a/editor/images/typedInput/09.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.png similarity index 100% rename from editor/images/typedInput/09.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/09.png diff --git a/editor/images/typedInput/az.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.png similarity index 100% rename from editor/images/typedInput/az.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/az.png diff --git a/editor/images/typedInput/bin.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.png similarity index 100% rename from editor/images/typedInput/bin.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.png diff --git a/editor/images/typedInput/bool.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.png similarity index 100% rename from editor/images/typedInput/bool.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.png diff --git a/editor/images/typedInput/env.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.png similarity index 100% rename from editor/images/typedInput/env.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/env.png diff --git a/editor/images/typedInput/expr.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.png similarity index 100% rename from editor/images/typedInput/expr.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.png diff --git a/editor/images/typedInput/json.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.png similarity index 100% rename from editor/images/typedInput/json.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/json.png diff --git a/editor/images/typedInput/re.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.png similarity index 100% rename from editor/images/typedInput/re.png rename to packages/node_modules/@node-red/editor-client/src/images/typedInput/re.png diff --git a/editor/js/comms.js b/packages/node_modules/@node-red/editor-client/src/js/comms.js similarity index 89% rename from editor/js/comms.js rename to packages/node_modules/@node-red/editor-client/src/js/comms.js index 6340deb50..f4c082466 100644 --- a/editor/js/comms.js +++ b/packages/node_modules/@node-red/editor-client/src/js/comms.js @@ -28,14 +28,24 @@ RED.comms = (function() { function connectWS() { active = true; - var path = location.hostname; - var port = location.port; - if (port.length !== 0) { - path = path+":"+port; + var wspath; + + if (RED.settings.apiRootUrl) { + var m = /^(https?):\/\/(.*)$/.exec(RED.settings.apiRootUrl); + if (m) { + console.log(m); + wspath = "ws"+(m[1]==="https"?"s":"")+"://"+m[2]+"comms"; + } + } else { + var path = location.hostname; + var port = location.port; + if (port.length !== 0) { + path = path+":"+port; + } + path = path+document.location.pathname; + path = path+(path.slice(-1) == "/"?"":"/")+"comms"; + wspath = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path; } - path = path+document.location.pathname; - path = path+(path.slice(-1) == "/"?"":"/")+"comms"; - path = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path; var auth_tokens = RED.settings.get("auth-tokens"); pendingAuth = (auth_tokens!=null); @@ -48,7 +58,7 @@ RED.comms = (function() { } } - ws = new WebSocket(path); + ws = new WebSocket(wspath); ws.onopen = function() { reconnectAttempts = 0; if (errornotification) { diff --git a/editor/js/events.js b/packages/node_modules/@node-red/editor-client/src/js/events.js similarity index 100% rename from editor/js/events.js rename to packages/node_modules/@node-red/editor-client/src/js/events.js diff --git a/editor/js/history.js b/packages/node_modules/@node-red/editor-client/src/js/history.js similarity index 100% rename from editor/js/history.js rename to packages/node_modules/@node-red/editor-client/src/js/history.js diff --git a/editor/js/i18n.js b/packages/node_modules/@node-red/editor-client/src/js/i18n.js similarity index 87% rename from editor/js/i18n.js rename to packages/node_modules/@node-red/editor-client/src/js/i18n.js index 0e2d0968a..9e9695163 100644 --- a/editor/js/i18n.js +++ b/packages/node_modules/@node-red/editor-client/src/js/i18n.js @@ -16,10 +16,13 @@ RED.i18n = (function() { + var apiRootUrl; + return { - init: function(done) { + init: function(options, done) { + apiRootUrl = options.apiRootUrl||""; i18n.init({ - resGetPath: 'locales/__ns__?lng=__lng__', + resGetPath: apiRootUrl+'locales/__ns__?lng=__lng__', dynamicLoad: false, load:'current', ns: { @@ -36,7 +39,7 @@ RED.i18n = (function() { } }, - loadCatalog: function(namespace,done) { + loadNodeCatalog: function(namespace,done) { var languageList = i18n.functions.toLanguages(i18n.detectLanguage()); var toLoad = languageList.length; languageList.forEach(function(lang) { @@ -45,7 +48,7 @@ RED.i18n = (function() { "Accept":"application/json" }, cache: false, - url: 'locales/'+namespace+'?lng='+lang, + url: apiRootUrl+'nodes/'+namespace+'/messages?lng='+lang, success: function(data) { i18n.addResourceBundle(lang,namespace,data); toLoad--; @@ -68,7 +71,7 @@ RED.i18n = (function() { "Accept":"application/json" }, cache: false, - url: 'locales/nodes?lng='+lang, + url: apiRootUrl+'nodes/messages?lng='+lang, success: function(data) { var namespaces = Object.keys(data); namespaces.forEach(function(ns) { diff --git a/editor/js/keymap.json b/packages/node_modules/@node-red/editor-client/src/js/keymap.json similarity index 100% rename from editor/js/keymap.json rename to packages/node_modules/@node-red/editor-client/src/js/keymap.json diff --git a/packages/node_modules/@node-red/editor-client/src/js/main.js b/packages/node_modules/@node-red/editor-client/src/js/main.js new file mode 100644 index 000000000..7aeea168e --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/js/main.js @@ -0,0 +1,24 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +$(function() { + if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) { + document.title = document.title+" : "+window.location.hostname; + } + RED.init({ + apiRootUrl: "" + }); +}); diff --git a/editor/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js similarity index 100% rename from editor/js/nodes.js rename to packages/node_modules/@node-red/editor-client/src/js/nodes.js diff --git a/editor/js/main.js b/packages/node_modules/@node-red/editor-client/src/js/red.js similarity index 82% rename from editor/js/main.js rename to packages/node_modules/@node-red/editor-client/src/js/red.js index 80e0a692f..8acf93d67 100644 --- a/editor/js/main.js +++ b/packages/node_modules/@node-red/editor-client/src/js/red.js @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -(function() { +var RED = (function() { - function appendNodeConfig(nodeConfig) { + function appendNodeConfig(nodeConfig,done) { + done = done || function(){}; var m = //.exec(nodeConfig.trim()); var moduleId; if (m) { @@ -24,13 +25,31 @@ moduleId = "unknown"; } try { - $("body").append(nodeConfig); + var hasDeferred = false; + + var nodeConfigEls = $("
"+nodeConfig+"
"); + nodeConfigEls.find("script").each(function(i,el) { + var srcUrl = $(el).attr('src'); + if (srcUrl && !/^\s*(https?:|\/|\.)/.test(srcUrl)) { + $(el).remove(); + var newScript = document.createElement("script"); + newScript.onload = function() { $("body").append(nodeConfigEls); done() } + $('body').append(newScript); + newScript.src = RED.settings.apiRootUrl+srcUrl; + hasDeferred = true; + } + }) + if (!hasDeferred) { + $("body").append(nodeConfigEls); + done(); + } } catch(err) { RED.notify(RED._("notification.errors.failedToAppendNode",{module:moduleId, error:err.toString()}),{ type: "error", timeout: 10000 }); console.log("["+moduleId+"] "+err.toString()); + done(); } } @@ -75,36 +94,40 @@ url: 'nodes', success: function(data) { var configs = data.trim().split(/(?=)/); - configs.forEach(function(data) { - appendNodeConfig(data); - }); - - $("body").i18n(); - $("#palette > .palette-spinner").hide(); - $(".palette-scroll").removeClass("hide"); - $("#palette-search").removeClass("hide"); - loadFlows(function() { - if (RED.settings.theme("projects.enabled",false)) { - RED.projects.refresh(function(activeProject) { - RED.sidebar.info.refresh() - if (!activeProject) { - // Projects enabled but no active project - RED.menu.setDisabled('menu-item-projects-open',true); - RED.menu.setDisabled('menu-item-projects-settings',true); - if (activeProject === false) { - // User previously decline the migration to projects. - } else { // null/undefined - RED.projects.showStartup(); - } + var stepConfig = function() { + if (configs.length === 0) { + $("body").i18n(); + $("#palette > .palette-spinner").hide(); + $(".palette-scroll").removeClass("hide"); + $("#palette-search").removeClass("hide"); + loadFlows(function() { + if (RED.settings.theme("projects.enabled",false)) { + RED.projects.refresh(function(activeProject) { + RED.sidebar.info.refresh() + if (!activeProject) { + // Projects enabled but no active project + RED.menu.setDisabled('menu-item-projects-open',true); + RED.menu.setDisabled('menu-item-projects-settings',true); + if (activeProject === false) { + // User previously decline the migration to projects. + } else { // null/undefined + RED.projects.showStartup(); + } + } + completeLoad(); + }); + } else { + // Projects disabled by the user + RED.sidebar.info.refresh() + completeLoad(); } - completeLoad(); }); } else { - // Projects disabled by the user - RED.sidebar.info.refresh() - completeLoad(); + var config = configs.shift(); + appendNodeConfig(config,stepConfig); } - }); + } + stepConfig(); } }); } @@ -190,7 +213,7 @@ } } ] - // } else if (RED.settings.theme('palette.editable') !== false) { + // } else if (RED.settings.theme('palette.editable') !== false) { } else { options.buttons = [ { @@ -207,7 +230,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: RED._("notification.label.setup-cred"), + text: "Setup credentials", click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.showCredentialsPrompt(); @@ -218,7 +241,7 @@ } else { options.buttons = [ { - text: RED._("common.label.close"), + text: "Close", click: function() { persistentNotifications[notificationId].hideNotification(); } @@ -229,7 +252,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: RED._("notification.label.setup-project"), + text: "Setup project files", click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.showFilesPrompt(); @@ -241,7 +264,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: RED._("notification.label.create-default-package"), + text: "Create default package file", click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.createDefaultPackageFile(); @@ -253,13 +276,13 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: RED._("notification.label.no-thanks"), + text: "No thanks", click: function() { persistentNotifications[notificationId].hideNotification(); } }, { - text: RED._("notification.label.create-default-project"), + text: "Create default project files", click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.createDefaultFileSet(); @@ -273,7 +296,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: RED._("notification.label.show-merge-conflicts"), + text: "Show merge conflicts", click: function() { persistentNotifications[notificationId].hideNotification(); RED.sidebar.versionControl.showLocalChanges(); @@ -317,7 +340,7 @@ var id = m.id; RED.nodes.addNodeSet(m); addedTypes = addedTypes.concat(m.types); - RED.i18n.loadCatalog(id, function() { + RED.i18n.loadNodeCatalog(id, function() { $.get('nodes/'+id, function(data) { appendNodeConfig(data); }); @@ -371,8 +394,8 @@ function showAbout() { $.get('red/about', function(data) { var aboutHeader = '
'+ - ''+ - '
'; + ''+ + ''; RED.sidebar.info.set(aboutHeader+marked(data)); RED.sidebar.info.show(); @@ -382,10 +405,10 @@ function loadEditor() { var menuOptions = []; if (RED.settings.theme("projects.enabled",false)) { - menuOptions.push({id:"menu-item-projects-menu",label:RED._("menu.label.projects"),options:[ - {id:"menu-item-projects-new",label:RED._("menu.label.projects-new"),disabled:false,onselect:"core:new-project"}, - {id:"menu-item-projects-open",label:RED._("menu.label.projects-open"),disabled:false,onselect:"core:open-project"}, - {id:"menu-item-projects-settings",label:RED._("menu.label.projects-settings"),disabled:false,onselect:"core:show-project-settings"} + menuOptions.push({id:"menu-item-projects-menu",label:"Projects",options:[ + {id:"menu-item-projects-new",label:"New",disabled:false,onselect:"core:new-project"}, + {id:"menu-item-projects-open",label:"Open",disabled:false,onselect:"core:open-project"}, + {id:"menu-item-projects-settings",label:"Project Settings",disabled:false,onselect:"core:show-project-settings"} ]}); } @@ -486,16 +509,25 @@ loadNodeList(); } - $(function() { + var initialised = false; - if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) { - document.title = document.title+" : "+window.location.hostname; + function init(options) { + if (initialised) { + throw new Error("RED already initialised"); } - + initialised = true; ace.require("ace/ext/language_tools"); - - RED.i18n.init(function() { - RED.settings.init(loadEditor); + options = options || {}; + options.apiRootUrl = options.apiRootUrl || ""; + if (options.apiRootUrl && !/\/$/.test(options.apiRootUrl)) { + options.apiRootUrl = options.apiRootUrl+"/"; + } + RED.i18n.init(options, function() { + RED.settings.init(options, loadEditor); }) - }); + } + + return { + init: init + } })(); diff --git a/editor/js/settings.js b/packages/node_modules/@node-red/editor-client/src/js/settings.js similarity index 96% rename from editor/js/settings.js rename to packages/node_modules/@node-red/editor-client/src/js/settings.js index 9594bec43..faf80c083 100644 --- a/editor/js/settings.js +++ b/packages/node_modules/@node-red/editor-client/src/js/settings.js @@ -89,18 +89,22 @@ RED.settings = (function () { userSettings = data; } - var init = function (done) { + var init = function (options, done) { var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search); if (accessTokenMatch) { var accessToken = accessTokenMatch[1]; RED.settings.set("auth-tokens",{access_token: accessToken}); window.location.search = ""; } + RED.settings.apiRootUrl = options.apiRootUrl; $.ajaxSetup({ beforeSend: function(jqXHR,settings) { // Only attach auth header for requests to relative paths if (!/^\s*(https?:|\/|\.)/.test(settings.url)) { + if (options.apiRootUrl) { + settings.url = options.apiRootUrl+settings.url; + } var auth_tokens = RED.settings.get("auth-tokens"); if (auth_tokens) { jqXHR.setRequestHeader("Authorization","Bearer "+auth_tokens.access_token); diff --git a/editor/js/text/bidi.js b/packages/node_modules/@node-red/editor-client/src/js/text/bidi.js similarity index 100% rename from editor/js/text/bidi.js rename to packages/node_modules/@node-red/editor-client/src/js/text/bidi.js diff --git a/editor/js/text/format.js b/packages/node_modules/@node-red/editor-client/src/js/text/format.js similarity index 100% rename from editor/js/text/format.js rename to packages/node_modules/@node-red/editor-client/src/js/text/format.js diff --git a/editor/js/ui/actions.js b/packages/node_modules/@node-red/editor-client/src/js/ui/actions.js similarity index 100% rename from editor/js/ui/actions.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/actions.js diff --git a/editor/js/ui/clipboard.js b/packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js similarity index 100% rename from editor/js/ui/clipboard.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js diff --git a/editor/js/ui/common/checkboxSet.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js similarity index 100% rename from editor/js/ui/common/checkboxSet.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js diff --git a/editor/js/ui/common/editableList.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js similarity index 100% rename from editor/js/ui/common/editableList.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js diff --git a/editor/js/ui/common/menu.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js similarity index 100% rename from editor/js/ui/common/menu.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js diff --git a/editor/js/ui/common/panels.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js similarity index 100% rename from editor/js/ui/common/panels.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js diff --git a/editor/js/ui/common/popover.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js similarity index 100% rename from editor/js/ui/common/popover.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js diff --git a/editor/js/ui/common/searchBox.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/searchBox.js similarity index 100% rename from editor/js/ui/common/searchBox.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/searchBox.js diff --git a/editor/js/ui/common/stack.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/stack.js similarity index 100% rename from editor/js/ui/common/stack.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/stack.js diff --git a/editor/js/ui/common/tabs.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js similarity index 100% rename from editor/js/ui/common/tabs.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js diff --git a/editor/js/ui/common/typedInput.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js similarity index 100% rename from editor/js/ui/common/typedInput.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js diff --git a/editor/js/ui/deploy.js b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js similarity index 88% rename from editor/js/ui/deploy.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js index a8c10930a..772acb567 100644 --- a/editor/js/ui/deploy.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js @@ -67,7 +67,10 @@ RED.deploy = (function() { options: [ {id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.png",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}}, {id:"deploymenu-item-flow",toggle:"deploy-type",icon:"red/images/deploy-flows.png",label:RED._("deploy.modifiedFlows"),sublabel:RED._("deploy.modifiedFlowsDesc"), onselect:function(s) {if(s){changeDeploymentType("flows")}}}, - {id:"deploymenu-item-node",toggle:"deploy-type",icon:"red/images/deploy-nodes.png",label:RED._("deploy.modifiedNodes"),sublabel:RED._("deploy.modifiedNodesDesc"),onselect:function(s) { if(s){changeDeploymentType("nodes")}}} + {id:"deploymenu-item-node",toggle:"deploy-type",icon:"red/images/deploy-nodes.png",label:RED._("deploy.modifiedNodes"),sublabel:RED._("deploy.modifiedNodesDesc"),onselect:function(s) { if(s){changeDeploymentType("nodes")}}}, + null, + {id:"deploymenu-item-reload", icon:"red/images/deploy-reload.png",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"}, + ] }); } else if (type == "simple") { @@ -96,6 +99,7 @@ RED.deploy = (function() { }); RED.actions.add("core:deploy-flows",save); + RED.actions.add("core:restart-flows",restart); RED.events.on('nodes:change',function(state) { @@ -257,6 +261,56 @@ RED.deploy = (function() { } return list; } + + function restart() { + var startTime = Date.now(); + $(".deploy-button-content").css('opacity',0); + $(".deploy-button-spinner").show(); + var deployWasEnabled = !$("#btn-deploy").hasClass("disabled"); + $("#btn-deploy").addClass("disabled"); + deployInflight = true; + $("#header-shade").show(); + $("#editor-shade").show(); + $("#palette-shade").show(); + $("#sidebar-shade").show(); + + $.ajax({ + url:"flows", + type: "POST", + headers: { + "Node-RED-Deployment-Type":"reload" + } + }).done(function(data,textStatus,xhr) { + if (deployWasEnabled) { + $("#btn-deploy").removeClass("disabled"); + } + RED.notify('

'+RED._("deploy.successfulRestart")+'

',"success"); + }).fail(function(xhr,textStatus,err) { + if (deployWasEnabled) { + $("#btn-deploy").removeClass("disabled"); + } + if (xhr.status === 401) { + RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error"); + } else if (xhr.status === 409) { + resolveConflict(nns, true); + } else if (xhr.responseText) { + RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error"); + } else { + RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error"); + } + }).always(function() { + deployInflight = false; + var delta = Math.max(0,300-(Date.now()-startTime)); + setTimeout(function() { + $(".deploy-button-content").css('opacity',1); + $(".deploy-button-spinner").hide(); + $("#header-shade").hide(); + $("#editor-shade").hide(); + $("#palette-shade").hide(); + $("#sidebar-shade").hide(); + },delta); + }); + } function save(skipValidation,force) { if (!$("#btn-deploy").hasClass("disabled")) { if (!RED.user.hasPermission("flows.write")) { diff --git a/editor/js/ui/diff.js b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js similarity index 100% rename from editor/js/ui/diff.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/diff.js diff --git a/editor/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js similarity index 100% rename from editor/js/ui/editor.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/editor.js diff --git a/editor/js/ui/editors/buffer.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/buffer.js similarity index 100% rename from editor/js/ui/editors/buffer.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/editors/buffer.js diff --git a/editor/js/ui/editors/expression.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js similarity index 100% rename from editor/js/ui/editors/expression.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js diff --git a/editor/js/ui/editors/js.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/js.js similarity index 100% rename from editor/js/ui/editors/js.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/editors/js.js diff --git a/editor/js/ui/editors/json.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/json.js similarity index 100% rename from editor/js/ui/editors/json.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/editors/json.js diff --git a/editor/js/ui/editors/markdown.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/markdown.js similarity index 100% rename from editor/js/ui/editors/markdown.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/editors/markdown.js diff --git a/editor/js/ui/keyboard.js b/packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js similarity index 100% rename from editor/js/ui/keyboard.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js diff --git a/editor/js/ui/library.js b/packages/node_modules/@node-red/editor-client/src/js/ui/library.js similarity index 92% rename from editor/js/ui/library.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/library.js index 2f78828c3..f99cdf0a8 100644 --- a/editor/js/ui/library.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/library.js @@ -18,6 +18,12 @@ RED.library = (function() { var exportToLibraryDialog; var elementPrefix = "node-input-"; + + var _librarySaveConfirm = '
'; + var _librarySave = '
'; + var _libraryLookup = '
    '; + + function loadFlowLibrary() { $.getJSON("library/flows",function(data) { //console.log(data); @@ -410,6 +416,11 @@ RED.library = (function() { return { init: function() { + + $(_librarySave).appendTo(document.body); + $(_librarySaveConfirm).appendTo(document.body); + $(_libraryLookup).appendTo(document.body); + RED.actions.add("core:library-export",exportFlow); RED.events.on("view:selection-changed",function(selection) { diff --git a/editor/js/ui/notifications.js b/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js similarity index 100% rename from editor/js/ui/notifications.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js diff --git a/editor/js/ui/palette-editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js similarity index 100% rename from editor/js/ui/palette-editor.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js diff --git a/editor/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js similarity index 99% rename from editor/js/ui/palette.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index a345233ff..d3aa044b9 100644 --- a/editor/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -459,7 +459,6 @@ RED.palette = (function() { } }); RED.events.on('registry:node-set-disabled', function(nodeSet) { - console.log(nodeSet); for (var j=0;j '+ + '
    '+ + '
    '+ + ''; + + function getSubflow() { return RED.nodes.subflow(RED.workspaces.active()); } @@ -386,6 +394,10 @@ RED.subflow = (function() { RED.actions.add("core:create-subflow",createSubflow); RED.actions.add("core:convert-to-subflow",convertToSubflow); + + $(_subflowEditTemplate).appendTo(document.body); + $(_subflowTemplateEditTemplate).appendTo(document.body); + } function createSubflow() { diff --git a/editor/js/ui/tab-config.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-config.js similarity index 100% rename from editor/js/ui/tab-config.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/tab-config.js diff --git a/editor/js/ui/tab-context.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-context.js similarity index 100% rename from editor/js/ui/tab-context.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/tab-context.js diff --git a/editor/js/ui/tab-info.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info.js similarity index 100% rename from editor/js/ui/tab-info.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/tab-info.js diff --git a/editor/js/ui/touch/radialMenu.js b/packages/node_modules/@node-red/editor-client/src/js/ui/touch/radialMenu.js similarity index 100% rename from editor/js/ui/touch/radialMenu.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/touch/radialMenu.js diff --git a/editor/js/ui/tray.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tray.js similarity index 100% rename from editor/js/ui/tray.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/tray.js diff --git a/editor/js/ui/typeSearch.js b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js similarity index 100% rename from editor/js/ui/typeSearch.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js diff --git a/editor/js/ui/userSettings.js b/packages/node_modules/@node-red/editor-client/src/js/ui/userSettings.js similarity index 100% rename from editor/js/ui/userSettings.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/userSettings.js diff --git a/editor/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js similarity index 98% rename from editor/js/ui/utils.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/utils.js index c944f3504..bdfd2088b 100644 --- a/editor/js/ui/utils.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js @@ -756,25 +756,25 @@ RED.utils = (function() { function getNodeIcon(def,node) { if (def.category === 'config') { - return "icons/node-red/cog.png" + return RED.settings.apiRootUrl+"icons/node-red/cog.png" } else if (node && node.type === 'tab') { - return "icons/node-red/subflow.png" + return RED.settings.apiRootUrl+"icons/node-red/subflow.png" } else if (node && node.type === 'unknown') { - return "icons/node-red/alert.png" + return RED.settings.apiRootUrl+"icons/node-red/alert.png" } else if (node && node.icon) { var iconPath = separateIconPath(node.icon); if (isIconExists(iconPath)) { - return "icons/" + node.icon; + return RED.settings.apiRootUrl+"icons/" + node.icon; } } var iconPath = getDefaultNodeIcon(def, node); if (def.category === 'subflows') { if (!isIconExists(iconPath)) { - return "icons/node-red/subflow.png"; + return RED.settings.apiRootUrl+"icons/node-red/subflow.png"; } } - return "icons/"+iconPath.module+"/"+iconPath.file; + return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file; } function getNodeLabel(node,defaultLabel) { diff --git a/editor/js/ui/view-navigator.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view-navigator.js similarity index 100% rename from editor/js/ui/view-navigator.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/view-navigator.js diff --git a/editor/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js similarity index 99% rename from editor/js/ui/view.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/view.js index f3928351f..6e6560418 100644 --- a/editor/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -2182,8 +2182,8 @@ RED.view = (function() { //node.append("path").attr("class","node_error").attr("d","M 3,-3 l 10,0 l -5,-8 z"); //TODO: these ought to be SVG - node.append("image").attr("class","node_error hidden").attr("xlink:href","icons/node-red/node-error.png").attr("x",0).attr("y",-6).attr("width",10).attr("height",9); - node.append("image").attr("class","node_changed hidden").attr("xlink:href","icons/node-red/node-changed.png").attr("x",12).attr("y",-6).attr("width",10).attr("height",10); + node.append("image").attr("class","node_error hidden").attr("xlink:href","red/images/icons/node-error.png").attr("x",0).attr("y",-6).attr("width",10).attr("height",9); + node.append("image").attr("class","node_changed hidden").attr("xlink:href","red/images/icons/node-changed.png").attr("x",12).attr("y",-6).attr("width",10).attr("height",10); }); node.each(function(d,i) { diff --git a/editor/js/ui/workspaces.js b/packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js similarity index 100% rename from editor/js/ui/workspaces.js rename to packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js diff --git a/editor/js/user.js b/packages/node_modules/@node-red/editor-client/src/js/user.js similarity index 100% rename from editor/js/user.js rename to packages/node_modules/@node-red/editor-client/src/js/user.js diff --git a/editor/js/validators.js b/packages/node_modules/@node-red/editor-client/src/js/validators.js similarity index 100% rename from editor/js/validators.js rename to packages/node_modules/@node-red/editor-client/src/js/validators.js diff --git a/editor/sass/ace.scss b/packages/node_modules/@node-red/editor-client/src/sass/ace.scss similarity index 100% rename from editor/sass/ace.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ace.scss diff --git a/editor/sass/bootstrap.scss b/packages/node_modules/@node-red/editor-client/src/sass/bootstrap.scss similarity index 100% rename from editor/sass/bootstrap.scss rename to packages/node_modules/@node-red/editor-client/src/sass/bootstrap.scss diff --git a/editor/sass/colors.scss b/packages/node_modules/@node-red/editor-client/src/sass/colors.scss similarity index 100% rename from editor/sass/colors.scss rename to packages/node_modules/@node-red/editor-client/src/sass/colors.scss diff --git a/editor/sass/debug.scss b/packages/node_modules/@node-red/editor-client/src/sass/debug.scss similarity index 100% rename from editor/sass/debug.scss rename to packages/node_modules/@node-red/editor-client/src/sass/debug.scss diff --git a/editor/sass/diff.scss b/packages/node_modules/@node-red/editor-client/src/sass/diff.scss similarity index 100% rename from editor/sass/diff.scss rename to packages/node_modules/@node-red/editor-client/src/sass/diff.scss diff --git a/editor/sass/dragdrop.scss b/packages/node_modules/@node-red/editor-client/src/sass/dragdrop.scss similarity index 100% rename from editor/sass/dragdrop.scss rename to packages/node_modules/@node-red/editor-client/src/sass/dragdrop.scss diff --git a/editor/sass/dropdownMenu.scss b/packages/node_modules/@node-red/editor-client/src/sass/dropdownMenu.scss similarity index 100% rename from editor/sass/dropdownMenu.scss rename to packages/node_modules/@node-red/editor-client/src/sass/dropdownMenu.scss diff --git a/editor/sass/editor.scss b/packages/node_modules/@node-red/editor-client/src/sass/editor.scss similarity index 100% rename from editor/sass/editor.scss rename to packages/node_modules/@node-red/editor-client/src/sass/editor.scss diff --git a/editor/sass/flow.scss b/packages/node_modules/@node-red/editor-client/src/sass/flow.scss similarity index 100% rename from editor/sass/flow.scss rename to packages/node_modules/@node-red/editor-client/src/sass/flow.scss diff --git a/editor/sass/forms.scss b/packages/node_modules/@node-red/editor-client/src/sass/forms.scss similarity index 100% rename from editor/sass/forms.scss rename to packages/node_modules/@node-red/editor-client/src/sass/forms.scss diff --git a/editor/sass/header.scss b/packages/node_modules/@node-red/editor-client/src/sass/header.scss similarity index 100% rename from editor/sass/header.scss rename to packages/node_modules/@node-red/editor-client/src/sass/header.scss diff --git a/editor/sass/jquery.scss b/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss similarity index 100% rename from editor/sass/jquery.scss rename to packages/node_modules/@node-red/editor-client/src/sass/jquery.scss diff --git a/editor/sass/keyboard.scss b/packages/node_modules/@node-red/editor-client/src/sass/keyboard.scss similarity index 100% rename from editor/sass/keyboard.scss rename to packages/node_modules/@node-red/editor-client/src/sass/keyboard.scss diff --git a/editor/sass/library.scss b/packages/node_modules/@node-red/editor-client/src/sass/library.scss similarity index 100% rename from editor/sass/library.scss rename to packages/node_modules/@node-red/editor-client/src/sass/library.scss diff --git a/editor/sass/mixins.scss b/packages/node_modules/@node-red/editor-client/src/sass/mixins.scss similarity index 100% rename from editor/sass/mixins.scss rename to packages/node_modules/@node-red/editor-client/src/sass/mixins.scss diff --git a/editor/sass/notifications.scss b/packages/node_modules/@node-red/editor-client/src/sass/notifications.scss similarity index 100% rename from editor/sass/notifications.scss rename to packages/node_modules/@node-red/editor-client/src/sass/notifications.scss diff --git a/editor/sass/palette-editor.scss b/packages/node_modules/@node-red/editor-client/src/sass/palette-editor.scss similarity index 100% rename from editor/sass/palette-editor.scss rename to packages/node_modules/@node-red/editor-client/src/sass/palette-editor.scss diff --git a/editor/sass/palette.scss b/packages/node_modules/@node-red/editor-client/src/sass/palette.scss similarity index 100% rename from editor/sass/palette.scss rename to packages/node_modules/@node-red/editor-client/src/sass/palette.scss diff --git a/editor/sass/panels.scss b/packages/node_modules/@node-red/editor-client/src/sass/panels.scss similarity index 100% rename from editor/sass/panels.scss rename to packages/node_modules/@node-red/editor-client/src/sass/panels.scss diff --git a/editor/sass/popover.scss b/packages/node_modules/@node-red/editor-client/src/sass/popover.scss similarity index 100% rename from editor/sass/popover.scss rename to packages/node_modules/@node-red/editor-client/src/sass/popover.scss diff --git a/editor/sass/projects.scss b/packages/node_modules/@node-red/editor-client/src/sass/projects.scss similarity index 100% rename from editor/sass/projects.scss rename to packages/node_modules/@node-red/editor-client/src/sass/projects.scss diff --git a/editor/sass/search.scss b/packages/node_modules/@node-red/editor-client/src/sass/search.scss similarity index 100% rename from editor/sass/search.scss rename to packages/node_modules/@node-red/editor-client/src/sass/search.scss diff --git a/editor/sass/sidebar.scss b/packages/node_modules/@node-red/editor-client/src/sass/sidebar.scss similarity index 100% rename from editor/sass/sidebar.scss rename to packages/node_modules/@node-red/editor-client/src/sass/sidebar.scss diff --git a/editor/sass/style.scss b/packages/node_modules/@node-red/editor-client/src/sass/style.scss similarity index 100% rename from editor/sass/style.scss rename to packages/node_modules/@node-red/editor-client/src/sass/style.scss diff --git a/editor/sass/tab-config.scss b/packages/node_modules/@node-red/editor-client/src/sass/tab-config.scss similarity index 100% rename from editor/sass/tab-config.scss rename to packages/node_modules/@node-red/editor-client/src/sass/tab-config.scss diff --git a/editor/sass/tab-context.scss b/packages/node_modules/@node-red/editor-client/src/sass/tab-context.scss similarity index 100% rename from editor/sass/tab-context.scss rename to packages/node_modules/@node-red/editor-client/src/sass/tab-context.scss diff --git a/editor/sass/tab-info.scss b/packages/node_modules/@node-red/editor-client/src/sass/tab-info.scss similarity index 100% rename from editor/sass/tab-info.scss rename to packages/node_modules/@node-red/editor-client/src/sass/tab-info.scss diff --git a/editor/sass/tabs.scss b/packages/node_modules/@node-red/editor-client/src/sass/tabs.scss similarity index 100% rename from editor/sass/tabs.scss rename to packages/node_modules/@node-red/editor-client/src/sass/tabs.scss diff --git a/editor/sass/ui/common/checkboxSet.scss b/packages/node_modules/@node-red/editor-client/src/sass/ui/common/checkboxSet.scss similarity index 100% rename from editor/sass/ui/common/checkboxSet.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ui/common/checkboxSet.scss diff --git a/editor/sass/ui/common/editableList.scss b/packages/node_modules/@node-red/editor-client/src/sass/ui/common/editableList.scss similarity index 100% rename from editor/sass/ui/common/editableList.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ui/common/editableList.scss diff --git a/editor/sass/ui/common/nodeList.scss b/packages/node_modules/@node-red/editor-client/src/sass/ui/common/nodeList.scss similarity index 100% rename from editor/sass/ui/common/nodeList.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ui/common/nodeList.scss diff --git a/editor/sass/ui/common/searchBox.scss b/packages/node_modules/@node-red/editor-client/src/sass/ui/common/searchBox.scss similarity index 100% rename from editor/sass/ui/common/searchBox.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ui/common/searchBox.scss diff --git a/editor/sass/ui/common/stack.scss b/packages/node_modules/@node-red/editor-client/src/sass/ui/common/stack.scss similarity index 100% rename from editor/sass/ui/common/stack.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ui/common/stack.scss diff --git a/editor/sass/ui/common/typedInput.scss b/packages/node_modules/@node-red/editor-client/src/sass/ui/common/typedInput.scss similarity index 100% rename from editor/sass/ui/common/typedInput.scss rename to packages/node_modules/@node-red/editor-client/src/sass/ui/common/typedInput.scss diff --git a/editor/sass/userSettings.scss b/packages/node_modules/@node-red/editor-client/src/sass/userSettings.scss similarity index 100% rename from editor/sass/userSettings.scss rename to packages/node_modules/@node-red/editor-client/src/sass/userSettings.scss diff --git a/editor/sass/widgetStyle.scss b/packages/node_modules/@node-red/editor-client/src/sass/widgetStyle.scss similarity index 100% rename from editor/sass/widgetStyle.scss rename to packages/node_modules/@node-red/editor-client/src/sass/widgetStyle.scss diff --git a/editor/sass/workspace.scss b/packages/node_modules/@node-red/editor-client/src/sass/workspace.scss similarity index 100% rename from editor/sass/workspace.scss rename to packages/node_modules/@node-red/editor-client/src/sass/workspace.scss diff --git a/editor/sass/workspaceToolbar.scss b/packages/node_modules/@node-red/editor-client/src/sass/workspaceToolbar.scss similarity index 100% rename from editor/sass/workspaceToolbar.scss rename to packages/node_modules/@node-red/editor-client/src/sass/workspaceToolbar.scss diff --git a/editor/vendor/ace/LICENSE b/packages/node_modules/@node-red/editor-client/src/vendor/ace/LICENSE similarity index 100% rename from editor/vendor/ace/LICENSE rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/LICENSE diff --git a/editor/vendor/ace/ace.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/ace.js similarity index 100% rename from editor/vendor/ace/ace.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/ace.js diff --git a/editor/vendor/ace/ext-language_tools.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/ext-language_tools.js similarity index 100% rename from editor/vendor/ace/ext-language_tools.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/ext-language_tools.js diff --git a/editor/vendor/ace/ext-searchbox.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/ext-searchbox.js similarity index 100% rename from editor/vendor/ace/ext-searchbox.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/ext-searchbox.js diff --git a/editor/vendor/ace/mode-css.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-css.js similarity index 100% rename from editor/vendor/ace/mode-css.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-css.js diff --git a/editor/vendor/ace/mode-handlebars.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-handlebars.js similarity index 100% rename from editor/vendor/ace/mode-handlebars.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-handlebars.js diff --git a/editor/vendor/ace/mode-html.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-html.js similarity index 100% rename from editor/vendor/ace/mode-html.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-html.js diff --git a/editor/vendor/ace/mode-javascript.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-javascript.js similarity index 100% rename from editor/vendor/ace/mode-javascript.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-javascript.js diff --git a/editor/vendor/ace/mode-json.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-json.js similarity index 100% rename from editor/vendor/ace/mode-json.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-json.js diff --git a/editor/vendor/ace/mode-markdown.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-markdown.js similarity index 100% rename from editor/vendor/ace/mode-markdown.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-markdown.js diff --git a/editor/vendor/ace/mode-properties.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-properties.js similarity index 100% rename from editor/vendor/ace/mode-properties.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-properties.js diff --git a/editor/vendor/ace/mode-python.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-python.js similarity index 100% rename from editor/vendor/ace/mode-python.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-python.js diff --git a/editor/vendor/ace/mode-sql.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-sql.js similarity index 100% rename from editor/vendor/ace/mode-sql.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-sql.js diff --git a/editor/vendor/ace/mode-swift.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-swift.js similarity index 100% rename from editor/vendor/ace/mode-swift.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-swift.js diff --git a/editor/vendor/ace/mode-yaml.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-yaml.js similarity index 100% rename from editor/vendor/ace/mode-yaml.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/mode-yaml.js diff --git a/editor/vendor/ace/snippets/css.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/css.js similarity index 100% rename from editor/vendor/ace/snippets/css.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/css.js diff --git a/editor/vendor/ace/snippets/handlebars.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/handlebars.js similarity index 100% rename from editor/vendor/ace/snippets/handlebars.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/handlebars.js diff --git a/editor/vendor/ace/snippets/html.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/html.js similarity index 100% rename from editor/vendor/ace/snippets/html.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/html.js diff --git a/editor/vendor/ace/snippets/javascript.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/javascript.js similarity index 100% rename from editor/vendor/ace/snippets/javascript.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/javascript.js diff --git a/editor/vendor/ace/snippets/json.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/json.js similarity index 100% rename from editor/vendor/ace/snippets/json.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/json.js diff --git a/editor/vendor/ace/snippets/markdown.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/markdown.js similarity index 100% rename from editor/vendor/ace/snippets/markdown.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/markdown.js diff --git a/editor/vendor/ace/snippets/properties.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/properties.js similarity index 100% rename from editor/vendor/ace/snippets/properties.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/properties.js diff --git a/editor/vendor/ace/snippets/python.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/python.js similarity index 100% rename from editor/vendor/ace/snippets/python.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/python.js diff --git a/editor/vendor/ace/snippets/sql.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/sql.js similarity index 100% rename from editor/vendor/ace/snippets/sql.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/sql.js diff --git a/editor/vendor/ace/snippets/swift.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/swift.js similarity index 100% rename from editor/vendor/ace/snippets/swift.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/swift.js diff --git a/editor/vendor/ace/snippets/text.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/text.js similarity index 100% rename from editor/vendor/ace/snippets/text.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/text.js diff --git a/editor/vendor/ace/snippets/yaml.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/yaml.js similarity index 100% rename from editor/vendor/ace/snippets/yaml.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/snippets/yaml.js diff --git a/editor/vendor/ace/theme-chrome.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/theme-chrome.js similarity index 100% rename from editor/vendor/ace/theme-chrome.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/theme-chrome.js diff --git a/editor/vendor/ace/theme-tomorrow.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/theme-tomorrow.js similarity index 100% rename from editor/vendor/ace/theme-tomorrow.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/theme-tomorrow.js diff --git a/editor/vendor/ace/worker-html.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/worker-html.js similarity index 100% rename from editor/vendor/ace/worker-html.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/worker-html.js diff --git a/editor/vendor/ace/worker-javascript.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/worker-javascript.js similarity index 100% rename from editor/vendor/ace/worker-javascript.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/worker-javascript.js diff --git a/editor/vendor/ace/worker-json.js b/packages/node_modules/@node-red/editor-client/src/vendor/ace/worker-json.js similarity index 100% rename from editor/vendor/ace/worker-json.js rename to packages/node_modules/@node-red/editor-client/src/vendor/ace/worker-json.js diff --git a/editor/vendor/bootstrap/css/bootstrap.css b/packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.css similarity index 100% rename from editor/vendor/bootstrap/css/bootstrap.css rename to packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.css diff --git a/editor/vendor/bootstrap/css/bootstrap.min.css b/packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.min.css similarity index 100% rename from editor/vendor/bootstrap/css/bootstrap.min.css rename to packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.min.css diff --git a/editor/vendor/bootstrap/img/glyphicons-halflings-white.png b/packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png similarity index 100% rename from editor/vendor/bootstrap/img/glyphicons-halflings-white.png rename to packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png diff --git a/editor/vendor/bootstrap/img/glyphicons-halflings.png b/packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png similarity index 100% rename from editor/vendor/bootstrap/img/glyphicons-halflings.png rename to packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png diff --git a/editor/vendor/bootstrap/js/bootstrap.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/js/bootstrap.min.js similarity index 100% rename from editor/vendor/bootstrap/js/bootstrap.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/js/bootstrap.min.js diff --git a/editor/vendor/d3/d3.v3.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/d3/d3.v3.min.js similarity index 100% rename from editor/vendor/d3/d3.v3.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/d3/d3.v3.min.js diff --git a/editor/vendor/font-awesome/css/font-awesome.min.css b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/css/font-awesome.min.css similarity index 100% rename from editor/vendor/font-awesome/css/font-awesome.min.css rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/css/font-awesome.min.css diff --git a/editor/vendor/font-awesome/fonts/FontAwesome.otf b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf similarity index 100% rename from editor/vendor/font-awesome/fonts/FontAwesome.otf rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf diff --git a/editor/vendor/font-awesome/fonts/fontawesome-webfont.eot b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot similarity index 100% rename from editor/vendor/font-awesome/fonts/fontawesome-webfont.eot rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot diff --git a/editor/vendor/font-awesome/fonts/fontawesome-webfont.svg b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg similarity index 100% rename from editor/vendor/font-awesome/fonts/fontawesome-webfont.svg rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg diff --git a/editor/vendor/font-awesome/fonts/fontawesome-webfont.ttf b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf similarity index 100% rename from editor/vendor/font-awesome/fonts/fontawesome-webfont.ttf rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf diff --git a/editor/vendor/font-awesome/fonts/fontawesome-webfont.woff b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff similarity index 100% rename from editor/vendor/font-awesome/fonts/fontawesome-webfont.woff rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff diff --git a/editor/vendor/font-awesome/fonts/fontawesome-webfont.woff2 b/packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 similarity index 100% rename from editor/vendor/font-awesome/fonts/fontawesome-webfont.woff2 rename to packages/node_modules/@node-red/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 diff --git a/editor/vendor/i18next/i18next.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js similarity index 100% rename from editor/vendor/i18next/i18next.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js diff --git a/editor/vendor/jquery/css/smoothness/images/animated-overlay.gif b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/animated-overlay.gif rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png diff --git a/editor/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from editor/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png diff --git a/editor/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css similarity index 100% rename from editor/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css diff --git a/editor/vendor/jquery/js/jquery-1.11.3.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js similarity index 100% rename from editor/vendor/jquery/js/jquery-1.11.3.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js diff --git a/editor/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js similarity index 100% rename from editor/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js diff --git a/editor/vendor/jquery/js/jquery.ui.touch-punch.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js similarity index 100% rename from editor/vendor/jquery/js/jquery.ui.touch-punch.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js diff --git a/editor/vendor/jsonata/formatter.js b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js similarity index 100% rename from editor/vendor/jsonata/formatter.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js diff --git a/editor/vendor/jsonata/mode-jsonata.js b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/mode-jsonata.js similarity index 100% rename from editor/vendor/jsonata/mode-jsonata.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jsonata/mode-jsonata.js diff --git a/editor/vendor/jsonata/snippets-jsonata.js b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/snippets-jsonata.js similarity index 100% rename from editor/vendor/jsonata/snippets-jsonata.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jsonata/snippets-jsonata.js diff --git a/editor/vendor/jsonata/worker-jsonata.js b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/worker-jsonata.js similarity index 100% rename from editor/vendor/jsonata/worker-jsonata.js rename to packages/node_modules/@node-red/editor-client/src/vendor/jsonata/worker-jsonata.js diff --git a/editor/vendor/marked/marked.min.js b/packages/node_modules/@node-red/editor-client/src/vendor/marked/marked.min.js similarity index 100% rename from editor/vendor/marked/marked.min.js rename to packages/node_modules/@node-red/editor-client/src/vendor/marked/marked.min.js diff --git a/editor/templates/index.mst b/packages/node_modules/@node-red/editor-client/templates/index.mst similarity index 58% rename from editor/templates/index.mst rename to packages/node_modules/@node-red/editor-client/templates/index.mst index 5815b5afb..6e095a475 100644 --- a/editor/templates/index.mst +++ b/packages/node_modules/@node-red/editor-client/templates/index.mst @@ -36,7 +36,7 @@