Skip to content

Commit

Permalink
Merge pull request #827 from codigoencasa/release/production
Browse files Browse the repository at this point in the history
0.1.31
  • Loading branch information
leifermendez authored Aug 26, 2023
2 parents 10d680d + 3ebac12 commit c358d58
Show file tree
Hide file tree
Showing 61 changed files with 6,929 additions and 4,104 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand All @@ -76,7 +76,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/netlify-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand All @@ -39,5 +39,4 @@ jobs:
- name: Build and Deploy
run: |
cd packages/docs
netlify deploy --prod --build --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }}
cd packages/docs && netlify deploy --prod --build --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/releases-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/

Expand Down
6 changes: 3 additions & 3 deletions __test__/0.0.0-case.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ suiteCase.after.each(clear)
suiteCase(`Responder a "hola"`, async ({ database, provider }) => {
const flow = addKeyword('hola').addAnswer('Buenas!').addAnswer('Como vamos!')

createBot({
await createBot({
database,
provider,
flow: createFlow([flow]),
Expand All @@ -22,7 +22,7 @@ suiteCase(`Responder a "hola"`, async ({ database, provider }) => {
body: 'hola',
})

await delay(10)
await delay(50)
assert.is('Buenas!', database.listHistory[0].answer)
assert.is('Como vamos!', database.listHistory[1].answer)
assert.is(undefined, database.listHistory[2])
Expand All @@ -42,7 +42,7 @@ suiteCase(`NO reponder a "pepe"`, async ({ database, provider }) => {
body: 'pepe',
})

await delay(100)
await delay(1000)

assert.is(undefined, database.listHistory[0])
assert.is(undefined, database.listHistory[1])
Expand Down
9 changes: 7 additions & 2 deletions __test__/0.1.6-case.test.js → __test__/1.1.6-case.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ suiteCase(`Debe retornar un mensaje resumen`, async ({ database, provider }) =>
assert.is('🤖🤖 Gracias por tu participacion', getHistory[9])
assert.is('Maria', getHistory[10])
assert.is('Gracias por tu nombre!', getHistory[11])
assert.is('100', getHistory[12])
assert.is(undefined, getHistory[13])
assert.is('¿Cual es tu edad?', getHistory[12])
assert.is('100', getHistory[13])
assert.is('Gracias por tu edad! Maria', getHistory[14])
assert.is('Tu datos son:', getHistory[15])
assert.is('Nombre: Maria Edad: 100', getHistory[16])
assert.is('🤖🤖 Gracias por tu participacion', getHistory[17])
assert.is(undefined, getHistory[18])
})

suiteCase.run()
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/root",
"version": "0.1.29",
"version": "0.1.30",
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
"main": "app.js",
"private": true,
Expand All @@ -24,7 +24,7 @@
"build": "pnpm run cli:rollup && pnpm run bot:rollup && pnpm run provider:rollup && pnpm run database:rollup && pnpm run contexts:rollup && pnpm run create-bot-whatsapp:rollup && pnpm run portal:rollup",
"copy.lib": "node ./scripts/move.js",
"test.unit": "node ./node_modules/uvu/bin.js packages test",
"test.e2e": "node ./node_modules/uvu/bin.js __test__",
"test.e2e": "node ./node_modules/uvu/bin.js __test__ ",
"test.coverage": "node ./node_modules/c8/bin/c8.js npm run test.unit",
"test": "npm run test.coverage",
"cli": "node ./packages/cli/bin/cli.js",
Expand Down Expand Up @@ -84,12 +84,12 @@
"standard-version": "^9.5.0",
"uvu": "^0.5.6"
},
"packageManager": "pnpm@8.5.0",
"packageManager": "pnpm@8.6.12",
"engines": {
"node": ">=16",
"node": ">=18",
"npm": "please-use-pnpm",
"yarn": "please-use-pnpm",
"pnpm": ">=8.5.0"
"pnpm": ">=8.6.12"
},
"author": "Leifer Mendez <[email protected]>"
}
40 changes: 40 additions & 0 deletions packages/bot/context/globalState.class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class GlobalState {
STATE = new Map()
RAW = {}
constructor() {}

/**
*
* @param {*} ctx
* @returns
*/
updateState = () => {
const currentStateByFrom = this.STATE.get('__global__')
return (keyValue) => this.STATE.set('__global__', { ...currentStateByFrom, ...keyValue })
}

/**
*
* @returns
*/
getMyState = () => {
return () => this.STATE.get('__global__')
}

/**
*
* @returns
*/
getAllState = () => this.STATE.values()

/**
*
* @param {*} from
* @returns
*/
clear = () => {
return () => this.STATE.delete('__global__')
}
}

module.exports = GlobalState
4 changes: 2 additions & 2 deletions packages/bot/context/state.class.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class GlobalState {
class SingleState {
STATE = new Map()
constructor() {}

Expand Down Expand Up @@ -36,4 +36,4 @@ class GlobalState {
}
}

module.exports = GlobalState
module.exports = SingleState
Loading

0 comments on commit c358d58

Please sign in to comment.