Socket
Socket
Sign inDemoInstall

@barbershopio/sprucebot-node

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barbershopio/sprucebot-node - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

22

.vscode/settings.json
{
"eslint.enable": true,
"files.autoSave":"onFocusChange",
"eslint.autoFixOnSave": true,
"search.exclude": {
"**/node_modules": true
},
"cSpell.words": [
"POST'ing",
"metas",
"mutexes",
"upsert",
"webhook"
]
}
"eslint.enable": true,
"files.autoSave": "onFocusChange",
"eslint.autoFixOnSave": true,
"search.exclude": {
"**/node_modules": true
},
"cSpell.words": ["POST'ing", "metas", "mutexes", "upsert", "webhook"]
}

@@ -24,3 +24,4 @@ const Https = require('./https')

allowSelfSignedCerts = false,
dbEnabled = false
dbEnabled = false,
eventContract = required('eventContract')
}) {

@@ -36,2 +37,3 @@ const hostMatches = host.match(/^(https?\:\/\/|)([^\/:?#]+)(?:[\/:?#]|$)/i)

this.iframeUrl = interfaceUrl || required('interfaceUrl')
this.publicUrl = (interfaceUrl || required('interfaceUrl')) + '/public'
this.marketingUrl =

@@ -41,2 +43,3 @@ (interfaceUrl || required('interfaceUrl')) + '/marketing'

this.dbEnabled = dbEnabled
this.eventContract = eventContract
this._mutexes = {}

@@ -56,4 +59,5 @@

console.log(
`🌲 Sprucebot🌲 Skills Kit API ${this
.version}\n\nhost : ${cleanedHost} \nid : ${id} \napiKey : ${apiKey.replace(
`🌲 Sprucebot🌲 Skills Kit API ${
this.version
}\n\nhost : ${cleanedHost} \nid : ${id} \napiKey : ${apiKey.replace(
/./g,

@@ -69,2 +73,4 @@ '*'

async sync() {
this.validateEventContract(this.eventContract)
const data = {

@@ -76,3 +82,5 @@ name: this.name,

iframeUrl: this.iframeUrl,
marketingUrl: this.marketingUrl
marketingUrl: this.marketingUrl,
publicUrl: this.publicUrl,
eventContract: this.eventContract
}

@@ -106,4 +114,4 @@ const results = await this.https.patch('/', data)

* Get a user without a location. GLOBAL SKILLS ONLY
*
* @param {String} userId
*
* @param {String} userId
* @param {Object} Optional query string to be added to the request

@@ -117,3 +125,3 @@ */

* Get all locations. GLOBAL SKILLS ONLY
*
*
* @param {Object} Optional query string to be added to the request

@@ -126,7 +134,7 @@ */

/**
* Create a user
*
* @param {Object} values
* @returns {Promise}
*/
* Create a user
*
* @param {Object} values
* @returns {Promise}
*/
async createUser(values) {

@@ -137,9 +145,9 @@ return this.https.post('/ge/users', values)

/**
* Update a users role
*
* @param {String} locationId
* @param {String} userId
* @param {String} role
* @returns {Promise}
*/
* Update a users role
*
* @param {String} locationId
* @param {String} userId
* @param {String} role
* @returns {Promise}
*/
async updateRole(locationId, userId, role) {

@@ -150,2 +158,3 @@ return this.https.patch(

}
/**

@@ -158,3 +167,3 @@ * Search for users who have been to this location

*/
async users(locationId, { role, status, page, limit } = {}) {
async users(locationId, { role, status, page, limit, q } = {}) {
return this.https.get(

@@ -165,2 +174,15 @@ `/locations/${locationId}/users/`,

}
/**
* Search for users who have been to this organization
*
* @param {String} locationId
* @param {Object} query
* @returns {Promise}
*/
async orgUsers(organizationId, { role, status, page, limit, q } = {}) {
return this.https.get(
`/organizations/${organizationId}/users/`,
Array.from(arguments)[1]
)
}

@@ -224,8 +246,8 @@ /**

/**
* ONLY APPLIES TO SKILLS THAT ARE GLOBAL (are not attached to a location).
* This allows Sprucebot to communicate to business owners without them
* actually needing any skills enabled. Core usage only.
*
* @param {String} userId
* @param {String} message
* ONLY APPLIES TO SKILLS THAT ARE GLOBAL (are not attached to a location).
* This allows Sprucebot to communicate to business owners without them
* actually needing any skills enabled. Core usage only.
*
* @param {String} userId
* @param {String} message
*/

@@ -298,4 +320,4 @@ async globalMessage(userId, message) {

* Get skill meta data by id
*
* @param {String} id
*
* @param {String} id
*/

@@ -469,4 +491,24 @@ async metaById(id, { locationId, userId } = {}) {

}
validateEventContract(eventContract) {
if (
!eventContract ||
!eventContract.events ||
!eventContract.events.publish ||
!eventContract.events.subscribe
) {
console.warn(
'⚠️ The event contract is invalid. Check your config/default.js file. The "eventContracts" key must be of the form:'
)
console.log({
events: {
publish: [],
subscribe: []
}
})
throw new Error('INVALID_EVENT_CONTRACT')
}
}
}
module.exports = Sprucebot
{
"name": "@barbershopio/sprucebot-node",
"publishConfig": {
"access": "public"
},
"version": "2.0.0",
"description":
"Jam with the Sprucebot API in your favorite scripting language. 🤓",
"keywords": ["node", "components", "sprucebot", "sprucelabs"],
"homepage": "https://github.com/sprucelabsai/sprucebot-skills-kit",
"bugs": {
"url": "https://github.com/sprucelabsai/sprucebot-skills-kit/issues"
},
"scripts": {
"lint": "eslint '**/**/*{.js}'",
"test": "jest",
"precommit": "npm run lint",
"prepush": "npm run lint && npm run test"
},
"dependencies": {
"debug": "^3.1.0"
},
"devDependencies": {
"add": "^2.0.6",
"eslint": "^4.10.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-prettier": "^2.3.1",
"jest": "^22.0.5",
"nock": "^9.1.6",
"prettier": "^1.7.4",
"yarn": "^1.2.1"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
}
"name": "@barbershopio/sprucebot-node",
"publishConfig": {
"access": "public"
},
"version": "2.0.1",
"description":
"Jam with the Sprucebot API in your favorite scripting language. 🤓",
"keywords": ["node", "components", "sprucebot", "sprucelabs"],
"homepage": "https://github.com/sprucelabsai/sprucebot-skills-kit",
"bugs": {
"url": "https://github.com/sprucelabsai/sprucebot-skills-kit/issues"
},
"scripts": {
"lint": "eslint '**/**/*{.js}'",
"test": "jest",
"precommit": "npm run lint",
"prepush": "npm run lint && npm run test"
},
"dependencies": {
"debug": "^3.1.0"
},
"devDependencies": {
"add": "^2.0.6",
"eslint": "^4.10.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-prettier": "^2.3.1",
"jest": "^22.0.5",
"nock": "^9.1.6",
"prettier": "^1.7.4",
"yarn": "^1.2.1"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc