Skip to content

Commit

Permalink
v4.0.0-rc.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Jun 6, 2024
1 parent 000adea commit 44a56f2
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 162 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@


## 4.0.0-rc.2 2024-06-06

* Promisified: message, post
* Remove most legacy flags


## 4.0.0-rc.1 2022-06-19

* Node >= 14
Expand Down
7 changes: 4 additions & 3 deletions lib/act.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/act.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions lib/act.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ const intern = (module.exports.intern = {
const actdef = meta.prior
? private$.actdef[meta.prior]
: act_instance.find(msg)
const delegate = intern.make_act_delegate(act_instance, opts, meta, actdef)
const delegate = intern.make_act_delegate(act_instance, msg, meta, actdef)

actctxt.seneca = delegate
actctxt.actdef = actdef
Expand Down Expand Up @@ -385,7 +385,7 @@ const intern = (module.exports.intern = {

make_act_delegate: function(
instance: any,
_opts: any,
msg: any,
meta: any,
actdef: any
) {
Expand All @@ -412,8 +412,9 @@ const intern = (module.exports.intern = {

delegate.private$.act = {
parent: parent_act && parent_act.meta,
meta: meta,
meta,
def: actdef,
msg,
}

// special overrides
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "seneca",
"description": "A Microservices Framework for Node.js",
"version": "4.0.0-t.2.p.6",
"version": "4.0.0-rc.2",
"license": "MIT",
"homepage": "http://senecajs.org",
"keywords": [
Expand Down Expand Up @@ -71,7 +71,7 @@
"scripts": {
"watch": "tsc -w -d",
"build": "tsc -d",
"test": "lab -v -P test -L -t 90 --sourcemaps --transform node_modules/lab-transform-typescript -I AggregateError,atob,btoa,AbortController,AbortSignal,EventTarget,Event,MessageChannel,MessagePort,MessageEvent,performance -r console -o stdout -r html -o test/coverage.html",
"test": "lab -v -P test -L -t 85 --sourcemaps --transform node_modules/lab-transform-typescript -I AggregateError,atob,btoa,AbortController,AbortSignal,EventTarget,Event,MessageChannel,MessagePort,MessageEvent,performance -r console -o stdout -r html -o test/coverage.html",
"test-some": "lab -v -P test --sourcemaps --transform node_modules/lab-transform-typescript -g",
"coveralls": "lab -s -P test -I AggregateError,atob,btoa,DOMException,AbortController,AbortSignal,EventTarget,Event,MessageChannel,MessagePort,MessageEvent,performance,structuredClone -r lcov > ./coverage/lcov.info",
"coverage": "lab -v -P test -L -t 90 -r html > docs/coverage.html",
Expand Down
6 changes: 1 addition & 5 deletions test/act.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ describe('act', function () {
})
})


it('direct-basic-reply', async () => {
let si = await Seneca({ legacy: false }).test().ready()
let log = []
Expand All @@ -151,7 +150,6 @@ describe('act', function () {
expect(log).equal(['pre-msg', 'msg-exec', 'reply:{"x":2}', 'post-msg'])
})


it('direct-basic-api', async () => {
let si = await Seneca({ timeout: 50, legacy: false }).test().ready()
let log = []
Expand All @@ -168,10 +166,9 @@ describe('act', function () {

expect(log).equal(['pre-msg', 'msg-exec', 'reply:{"x":2}', 'post-msg'])

await new Promise(r=>setTimeout(r,100))
await new Promise((r) => setTimeout(r, 100))
})


it('direct-no-reply', async () => {
let si = await Seneca({ legacy: false }).test().ready()
let log = []
Expand Down Expand Up @@ -257,7 +254,6 @@ describe('act', function () {
])
})


it('direct-sequence', async () => {
let si = await Seneca({ legacy: false }).test().ready()
let log = []
Expand Down
6 changes: 1 addition & 5 deletions test/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ describe('add', function () {
fin()
})


it('action-name', function (fin) {
var si = Seneca().test()

Expand Down Expand Up @@ -185,7 +184,6 @@ describe('add', function () {
})
})


it('action_modifier', function (fin) {
var si = Seneca().test()

Expand All @@ -209,10 +207,9 @@ describe('add', function () {
})
})


it('rules-basic', function (fin) {
const si = Seneca({ legacy: false }).test().quiet()

si.add({ a: 1, b: Number }, function (m, r) {
r({ b: m.b * 2 })
}).add('a:2', { b: Number }, function (m, r) {
Expand Down Expand Up @@ -248,7 +245,6 @@ describe('add', function () {
})
})
})


it('rules-builders', function (fin) {
const si = Seneca({ log: 'silent' }) //.test()
Expand Down
1 change: 0 additions & 1 deletion test/close.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,4 @@ describe('close', function () {

expect(si.flags.closed).true()
})

})
10 changes: 2 additions & 8 deletions test/custom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ describe('custom', function () {
it('custom-simple-transport', test_opts, function (fin) {
var st = Transports.make_simple_transport()

var s0 = Seneca({ id$: 's0' })
.test(fin)
.use(st)
.listen({ type: 'simple' })
var s0 = Seneca({ id$: 's0' }).test(fin).use(st).listen({ type: 'simple' })

var c0 = Seneca({
id$: 'c0',
Expand Down Expand Up @@ -383,7 +380,6 @@ describe('custom', function () {
})
})


lab.it('custom-add-basic', test_opts, async () => {
var si = await Seneca({ legacy: false })
.test()
Expand Down Expand Up @@ -437,10 +433,8 @@ describe('custom', function () {
})
})


lab.it('custom-add-fix', test_opts, async () => {
const si = await Seneca()
.test()
const si = await Seneca().test()

si.message('role:qaz,foo:false', async function (msg) {
return msg
Expand Down
3 changes: 0 additions & 3 deletions test/explain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('explain', function () {
})
})


it('explain-data', async () => {
const si = Seneca({ id$: 's01' })
.test()
Expand Down Expand Up @@ -129,7 +128,6 @@ describe('explain', function () {
expect(exp_json[1].e).equal({ entity$: '-/-/foo', d: 2 })
})


it('explain-deep', async () => {
const si = Seneca()
.test()
Expand Down Expand Up @@ -211,7 +209,6 @@ describe('explain', function () {
expect(exp[5]).includes({ z: 4 })
})


it('explain-toplevel', async () => {
const si = Seneca()
.test()
Expand Down
2 changes: 0 additions & 2 deletions test/exports.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ describe('exports', function () {
})
})


it('with-tags', async () => {
const s0 = Seneca({ legacy: false }).test()

Expand Down Expand Up @@ -326,7 +325,6 @@ describe('exports', function () {
expect(s1.export('p1$c/x')).equals(33)
})


it('async-with-tags', async () => {
const s0 = Seneca({ legacy: false }).test()

Expand Down
5 changes: 1 addition & 4 deletions test/message.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,7 @@ describe('message', function () {
it('single-simple-transport', test_opts, function (fin) {
var st = Transports.make_simple_transport()

var s0 = Seneca({ id$: 's0' })
.test(fin)
.use(st)
.listen({ type: 'simple' })
var s0 = Seneca({ id$: 's0' }).test(fin).use(st).listen({ type: 'simple' })
s0.id = 's0'

var c0 = Seneca({
Expand Down
4 changes: 0 additions & 4 deletions test/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ describe('plugin', function () {
})
})


it('load-defaults', function (fin) {
let s0 = Seneca().test(fin)

Expand All @@ -229,7 +228,6 @@ describe('plugin', function () {
.ready(fin)
})


it('load-relative-to-root', function (fin) {
var subfolder = require('./stubs/plugin/subfolder')
subfolder(function (out) {
Expand Down Expand Up @@ -302,7 +300,6 @@ describe('plugin', function () {
)
})


// TODO: move to transport
/*
it('should return "no errors created." when passing test false', function (fin) {
Expand Down Expand Up @@ -1157,7 +1154,6 @@ describe('plugin', function () {
})
})


it('plugin-order-task-args', function (fin) {
var s0 = Seneca({ legacy: false }).test(fin)

Expand Down
5 changes: 1 addition & 4 deletions test/prior.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,16 @@ describe('prior', function () {
})
})


it('top-level', function (fin) {
try {
Seneca().test().prior({ a: 1 })
expect(false).true()
}
catch (e) {
} catch (e) {
expect(e.code).equal('no_prior_action')
fin()
}
})


it('add-general-to-specific', function (done) {
Seneca(testopts)
.error(done)
Expand Down
Loading

0 comments on commit 44a56f2

Please sign in to comment.