@ndustrial/contxt-sdk
Advanced tools
Comparing version 0.0.43 to 1.0.0-beta.0
@@ -0,1 +1,16 @@ | ||
## [v1.0.0](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.0.0) (2019-xx-xx) | ||
**Changed** | ||
- Updated build process to only transpile source files instead of also concatenating into a single module | ||
- This will allow us to substitute out modules when the browser and Node version needs to differ (like the Message Bus module at the moment) | ||
- Additionally, it will allow end users to import a specific file from the package to use or extend it (i.e. when creating a custom module, a user might want to use our object utilities to transform object key cases or extend off an already built module to add or monkey-patch functionality) | ||
- Provides separate CommonJS and ES Module file trees (in `/lib` and `/esm`, respectively) to be used directly by Node, Webpack, or the user's preferred bundling application | ||
- The directory for the ES modules build has changed. If a project was directly importing the ES module instead of the root package, this will need to be updated (i.e. `import ContxtSdk from 'contxt-sdk/es'` to `import ContxtSdk from 'contxt-sdk/esm'`) | ||
- **NOTE:** The Babel configuration has been moved from the `.babelrc` file to the `package.json` so that the configuration can be shared with the Gulp build process and testing via Mocha. If upgrading to Babel 7, this should be moved to a `babel.config.js` file (this functionality was added in 7). | ||
- Added Browser versions of Message Bus related modules that indicate connecting to the Message Bus is not supported in browser environments at the moment. | ||
- Changed back to using UUIDv4s as IDs for Message Bus subscriptions and publications. | ||
## [v0.0.43](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.43) (2019-03-13) | ||
@@ -2,0 +17,0 @@ |
<a name="Bus"></a> | ||
## Bus | ||
Module that provides access to the message bus | ||
Module that provides access to the message bus. This is for Node | ||
environments. Documentation for browser environments is found under | ||
`BrowserBus`. | ||
@@ -6,0 +8,0 @@ **Kind**: global class |
<a name="Files"></a> | ||
## Files | ||
Module that provides access to information about Files | ||
Module that provides access to information about Files. | ||
More information about the best way to use this module is available at: | ||
https://contxt.readme.io/reference#files-overview | ||
@@ -38,3 +40,3 @@ **Kind**: global class | ||
**Kind**: instance method of [<code>Files</code>](#Files) | ||
**Fulfill**: [<code>File</code>](./Typedefs.md#File) | ||
**Fulfill**: [<code>FileWithUploadInformation</code>](./Typedefs.md#FileWithUploadInformation) | ||
**Rejects**: <code>Error</code> | ||
@@ -41,0 +43,0 @@ |
@@ -31,4 +31,16 @@ ## Classes | ||
</dd> | ||
<dt><a href="./BrowserBus.md">BrowserBus</a></dt> | ||
<dd><p>Module that provides access to the message bus. This is for browser | ||
environments. Documentation for Node environments is found under <code>Bus</code>.</p> | ||
</dd> | ||
<dt><a href="./BrowserWebSocketConnection.md">BrowserWebSocketConnection</a></dt> | ||
<dd><p>Module that wraps the websocket connection to the message bus to provide the | ||
developer with a specific set of functionality. This is for browser | ||
environments. Documentation for Node environments is found under | ||
<code>WebSocketConnection</code>.</p> | ||
</dd> | ||
<dt><a href="./Bus.md">Bus</a></dt> | ||
<dd><p>Module that provides access to the message bus</p> | ||
<dd><p>Module that provides access to the message bus. This is for Node | ||
environments. Documentation for browser environments is found under | ||
<code>BrowserBus</code>.</p> | ||
</dd> | ||
@@ -76,3 +88,5 @@ <dt><a href="./Channels.md">Channels</a></dt> | ||
<dt><a href="./Files.md">Files</a></dt> | ||
<dd><p>Module that provides access to information about Files</p> | ||
<dd><p>Module that provides access to information about Files. | ||
More information about the best way to use this module is available at: | ||
<a href="https://contxt.readme.io/reference#files-overview">https://contxt.readme.io/reference#files-overview</a></p> | ||
</dd> | ||
@@ -100,4 +114,6 @@ <dt><a href="./Iot.md">Iot</a></dt> | ||
<dt><a href="./WebSocketConnection.md">WebSocketConnection</a></dt> | ||
<dd><p>Module that wraps the websocket connection to the message bus | ||
to provide the developer with a specific set of functionality</p> | ||
<dd><p>Module that wraps the websocket connection to the message bus to provide the | ||
developer with a specific set of functionality. This is for Node | ||
environments. Documentation for browser environments is found under | ||
<code>BrowserWebSocketConnection</code>.</p> | ||
</dd> | ||
@@ -104,0 +120,0 @@ </dl> |
@@ -591,4 +591,15 @@ <a name="Asset"></a> | ||
| --- | --- | --- | | ||
| expiresAt | <code>string</code> | ISO 8601 Extended Format date/time | | ||
| temporaryUrl | <code>string</code> | A temporary URL that can be used to download the file | | ||
| createdAt | <code>string</code> | ISO 8601 Extended Format date/time string | | ||
| contentType | <code>string</code> | The MIME type of the file | | ||
| description | <code>string</code> | | | ||
| downloadInfo | <code>Object</code> | | | ||
| downloadInfo.attachmentUrl | <code>string</code> | A URL that can be used to download the file from the external storage | | ||
| downloadInfo.expiresAt | <code>string</code> | ISO 8601 Extended Format date/time indicating when the attachement and inline URLs expire | | ||
| downloadInfo.inlineUrl | <code>string</code> | A URL that can be used for embedding the file into a page | | ||
| filename | <code>string</code> | | | ||
| id | <code>string</code> | UUID of the file | | ||
| organizationId | <code>string</code> | UUID of the organization to which the file belongs | | ||
| ownerId | <code>string</code> | The ID of the user who owns the file | | ||
| status | <code>string</code> | The status of the File, e.g. "ACTIVE" | | ||
| updatedAt | <code>string</code> | ISO 8601 Extended Format date/time string | | ||
@@ -595,0 +606,0 @@ <a name="FileWithUploadInformation"></a> |
<a name="WebSocketConnection"></a> | ||
## WebSocketConnection | ||
Module that wraps the websocket connection to the message bus | ||
to provide the developer with a specific set of functionality | ||
Module that wraps the websocket connection to the message bus to provide the | ||
developer with a specific set of functionality. This is for Node | ||
environments. Documentation for browser environments is found under | ||
`BrowserWebSocketConnection`. | ||
@@ -7,0 +9,0 @@ **Kind**: global class |
{ | ||
"name": "@ndustrial/contxt-sdk", | ||
"version": "0.0.43", | ||
"version": "1.0.0-beta.0", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"module": "es/index.js", | ||
"module": "esm/index.js", | ||
"browser": { | ||
"./esm/bus/index.js": "./esm/bus/index.browser.js", | ||
"./lib/bus/index.js": "./lib/bus/index.browser.js", | ||
"./esm/bus/webSocketConnection.js": "./esm/bus/webSocketConnection.browser.js", | ||
"./lib/bus/webSocketConnection.js": "./lib/bus/webSocketConnection.browser.js" | ||
}, | ||
"scripts": { | ||
"build": "npm run build:js && npm run build:docs", | ||
"build:docs": "node ./support/docs", | ||
"build:js": "rollup -c", | ||
"build:js": "gulp build", | ||
"coverage": "nyc npm run test:js", | ||
@@ -20,3 +26,3 @@ "lint": "eslint --format 'node_modules/eslint-friendly-formatter' '+(src|support)/**/*.js'", | ||
"test:js:inspect": "npm run test:js -- --inspect-brk", | ||
"watch": "npm run build:js -- --watch" | ||
"watch": "gulp watch" | ||
}, | ||
@@ -30,15 +36,42 @@ "author": "ndustrial.io <dev@ndustrial.io> (ndustrial.io)", | ||
}, | ||
"babel": { | ||
"env": { | ||
"test": { | ||
"plugins": [ | ||
"istanbul" | ||
], | ||
"presets": [ | ||
"env", | ||
"stage-2" | ||
] | ||
} | ||
}, | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"modules": false, | ||
"targets": { | ||
"browsers": "> 0.5%, last 2 versions, Firefox ESR, not dead", | ||
"node": "6" | ||
} | ||
} | ||
], | ||
"stage-2" | ||
] | ||
}, | ||
"dependencies": { | ||
"auth0-js": "^9.3.0", | ||
"axios": "^0.17.0", | ||
"change-case": "^3.0.2", | ||
"lodash.has": "^4.5.2", | ||
"lodash.isplainobject": "^4.0.6", | ||
"nanoid": "^2.0.1", | ||
"url-parse": "^1.4.3" | ||
"url-parse": "^1.4.3", | ||
"uuid": "^3.3.2", | ||
"ws": "^6.1.3" | ||
}, | ||
"devDependencies": { | ||
"auth0-js": "^9.3.0", | ||
"axios": "~0.17.0", | ||
"babel-eslint": "^8.2.1", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-istanbul": "^4.1.5", | ||
"babel-plugin-istanbul": "^5.1.1", | ||
"babel-preset-env": "^1.7.0", | ||
@@ -49,2 +82,3 @@ "babel-preset-stage-2": "^6.24.1", | ||
"chai-as-promised": "^7.1.1", | ||
"del": "^4.0.0", | ||
"eslint": "^4.15.0", | ||
@@ -57,2 +91,5 @@ "eslint-config-ndustrial": "^1.0.5", | ||
"fast-glob": "^2.1.0", | ||
"gulp": "^4.0.0", | ||
"gulp-babel": "^7.0.1", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"husky": "^0.14.3", | ||
@@ -70,18 +107,6 @@ "jsdoc-to-markdown": "^4.0.1", | ||
"proxyquire": "^2.1.0", | ||
"rollup": "^0.54.1", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-cleanup": "^2.0.0", | ||
"rollup-plugin-commonjs": "^8.2.6", | ||
"rollup-plugin-node-resolve": "^3.0.2", | ||
"rollup-watch": "^4.3.1", | ||
"rosie": "^1.6.0", | ||
"sinon": "^4.1.6", | ||
"sinon-chai": "^2.14.0", | ||
"ws": "~6.1.3" | ||
}, | ||
"peerDependencies": { | ||
"auth0-js": "^9.3.0", | ||
"axios": "~0.17.0", | ||
"ws": "~6.1.3" | ||
"sinon-chai": "^2.14.0" | ||
} | ||
} |
@@ -91,4 +91,19 @@ # contxt-sdk [![wercker status](https://app.wercker.com/status/869ef086297da79ddd0cbf3564f7cba6/s/master 'wercker status')](https://app.wercker.com/project/byKey/869ef086297da79ddd0cbf3564f7cba6) | ||
[rollup.js](https://rollupjs.org/guide/en) is used to build the source code into CommonJS and ES6 modules that can be used for distribution. These modules are both built by running one command: `npm run build`. If you'd like to continuously create builds as files are changed (i.e. if you are developing new features and have set things up correctly with `npm link` to serve the newly updated files to your app), you can run `npm run watch`. | ||
[Gulp](https://gulpjs.com/) is used to build the source code in CommonJS and ES Module distributions that can be used across many platforms. These distributions are both built by running one command: `npm run build`. If you'd like to continuously create builds as files are changed (i.e. if you are developing new features and have set things up correctly with `npm link` to serve the newly updated files to your app), you can run `npm run watch`. Currently, the docs are built by a custom script, but may move to Gulp in the future. | ||
If there is a module that needs to be different between browser and Node implementations, this can be achieved by creating a separate file with a file name indicating it is only for a browser (like `module.browser.js`) and adding the source path and replacement path of the files to the `browser` section of the `package.json` (example below). It will need to be added for both the `esm` and `lib` directories to account for whether the end user is using CommonJS or ES modules. When the client application is built, Webpack will pick up the browser version instead of the Node version. | ||
```javascript | ||
{ | ||
... other stuff | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"browser": { | ||
"./esm/module.js": "./esm/module.browser.js", | ||
"./lib/module.js": "./lib/module.browser.js", | ||
} | ||
... other stuff | ||
} | ||
``` | ||
### Testing & Code Quality | ||
@@ -95,0 +110,0 @@ |
@@ -39,3 +39,5 @@ import WebSocket from 'ws'; | ||
/** | ||
* Module that provides access to the message bus | ||
* Module that provides access to the message bus. This is for Node | ||
* environments. Documentation for browser environments is found under | ||
* `BrowserBus`. | ||
* | ||
@@ -42,0 +44,0 @@ * @typicalname contxtSdk.bus |
@@ -1,2 +0,2 @@ | ||
import nanoid from 'nanoid/non-secure'; | ||
import uuid from 'uuid/v4'; | ||
@@ -22,5 +22,6 @@ /** | ||
/** | ||
* Module that wraps the websocket connection to the message bus | ||
* to provide the developer with a specific set of functionality | ||
* | ||
* Module that wraps the websocket connection to the message bus to provide the | ||
* developer with a specific set of functionality. This is for Node | ||
* environments. Documentation for browser environments is found under | ||
* `BrowserWebSocketConnection`. | ||
*/ | ||
@@ -77,3 +78,3 @@ class WebSocketConnection { | ||
const messageId = nanoid(); | ||
const messageId = uuid(); | ||
@@ -203,3 +204,3 @@ this._messageHandlers[messageId] = (message) => { | ||
const messageId = nanoid(); | ||
const messageId = uuid(); | ||
@@ -206,0 +207,0 @@ this._messageHandlers[messageId] = (message) => { |
@@ -52,4 +52,15 @@ import axios from 'axios'; | ||
* @typedef {Object} FileToDownload | ||
* @property {string} expiresAt ISO 8601 Extended Format date/time | ||
* @property {string} temporaryUrl A temporary URL that can be used to download the file | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} contentType The MIME type of the file | ||
* @property {string} description | ||
* @property {Object} downloadInfo | ||
* @property {string} downloadInfo.attachmentUrl A URL that can be used to download the file from the external storage | ||
* @property {string} downloadInfo.expiresAt ISO 8601 Extended Format date/time indicating when the attachement and inline URLs expire | ||
* @property {string} downloadInfo.inlineUrl A URL that can be used for embedding the file into a page | ||
* @property {string} filename | ||
* @property {string} id UUID of the file | ||
* @property {string} organizationId UUID of the organization to which the file belongs | ||
* @property {string} ownerId The ID of the user who owns the file | ||
* @property {string} status The status of the File, e.g. "ACTIVE" | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
@@ -75,3 +86,5 @@ | ||
/** | ||
* Module that provides access to information about Files | ||
* Module that provides access to information about Files. | ||
* More information about the best way to use this module is available at: | ||
* https://contxt.readme.io/reference#files-overview | ||
* | ||
@@ -107,3 +120,3 @@ * @typicalname contxtSdk.files | ||
* @returns {Promise} | ||
* @fulfill {File} | ||
* @fulfill {FileWithUploadInformation} | ||
* @rejects {Error} | ||
@@ -110,0 +123,0 @@ * |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
2087269
34
337
33608
160
0
+ Addedauth0-js@^9.3.0
+ Addedaxios@^0.17.0
+ Addeduuid@^3.3.2
+ Addedws@^6.1.3
+ Addeduuid@3.4.0(transitive)
+ Addedws@6.2.3(transitive)
- Removednanoid@^2.0.1
- Removednanoid@2.1.11(transitive)
- Removedws@6.1.4(transitive)