Skip to content

Commit

Permalink
merge-up-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Nov 7, 2023
2 parents d8b827f + 2d2046e commit ff8ac0e
Show file tree
Hide file tree
Showing 77 changed files with 1,381 additions and 710 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: build

on:
push:
branches: [ master ]
branches: [ master, 3.x ]
pull_request:
branches: [ master ]
branches: [ master, 3.x ]

jobs:
build:
Expand Down
53 changes: 0 additions & 53 deletions API.md

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@

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

* Node >= 14
* Remove Joi
* Remove seneca-transport


## 3.33.0 2023-11-05

* Remove norma library, replace functionality with update gubu library.


## 3.32.1 2023-09-16

* Provide Seneca 4 act-err argument variants via `act-err-4` temporary event.


## 3.32.0 2023-06-29

* Translation also operates on message add and sub.
Expand Down
6 changes: 6 additions & 0 deletions DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# Branches

- 3.x: Version 3
- master: Version 4

30 changes: 28 additions & 2 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.

47 changes: 44 additions & 3 deletions lib/act.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
/* Copyright © 2019-2022 Richard Rodger and other contributors, MIT License. */
/* Copyright © 2019-2023 Richard Rodger and other contributors, MIT License. */

import { Gubu, MakeArgu, Open, Skip, One, Empty } from 'gubu'


import { Meta } from './meta'


import {
build_message,
inspect,
noop,
error,
deep,
msgstr,
make_standard_err_log_entry,
make_standard_act_log_entry,
parse_jsonic,
} from './common'


const Argu = MakeArgu('seneca')


const ActArgu: any = Argu('act', {
props: One(Empty(String), Object),
moreprops: Skip(Object),
reply: Skip(Function),
})


// Perform an action and optionally return the result by callback.
// The properties of the combined arguments are matched against known
// patterns, and the most specific one wins.
Expand All @@ -24,7 +36,18 @@ exports.api_act = function() {
const opts = instance.options()

const spec =
build_message(instance, [...arguments], 'reply:f?', instance.fixedargs)
// build_message(instance, [...arguments], 'reply:f?', instance.fixedargs)
ActArgu(arguments)

spec.msg = Object.assign(
{},
spec.moreprops ? spec.moreprops : null,
'string' === typeof spec.props ?
parse_jsonic(spec.props, 'msg_jsonic_syntax') :
spec.props,
instance.fixedargs,
)

const msg = spec.msg
const reply = spec.reply

Expand Down Expand Up @@ -96,6 +119,20 @@ const intern = (module.exports.intern = {
action_reply
)
} catch (e: any) {

// TODO: review, needs better test for when this actually happens
for (let intercept of instance.private$.intercept.act_error) {
intercept.call(instance, {
error: e,
execspec,
opts,
actctxt,
actmsg,
meta,
action_reply
})
}

if (opts.error.capture.action && true !== e?.$$seneca_callback_error$$) {
const ex = opts.error.identify(e) ? e : new Error(inspect(e))
intern.handle_reply(opts, meta, actctxt, actmsg, ex)
Expand Down Expand Up @@ -299,6 +336,7 @@ const intern = (module.exports.intern = {

const inwardres = act_instance.order.inward.execSync(actctxt, data)


if (inwardres.err) {
throw inwardres.err
}
Expand Down Expand Up @@ -486,6 +524,9 @@ const intern = (module.exports.intern = {

instance.emit('act-err', 'callback', msg, meta, err, data.res)

// Seneca 4 arguments
instance.emit('act-err-4', 'callback', msg, meta, err, data.res)

if (opts.errhandler) {
opts.errhandler.call(instance, err, err.meta$)
}
Expand Down
9 changes: 5 additions & 4 deletions lib/actions.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/actions.js.map

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

13 changes: 9 additions & 4 deletions lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,24 @@ function on_point(this: any, msg: any, reply: any) {
reply()
}

function cmd_ping(this: any, msg: any, reply: any) {
reply(this.ping())

function cmd_ping(this: any, _msg: any, reply: any) {
let ping = this.ping()
reply(ping)
}

function action_seneca_fatal(this: any, msg: any, reply: any) {

function action_seneca_fatal(this: any, _msg: any, reply: any) {
reply()
}

function action_seneca_close(this: any, msg: any, reply: any) {

function action_seneca_close(this: any, _msg: any, reply: any) {
this.emit('close')
reply()
}


function make_action_seneca_stats(private$: any) {
return function action_seneca_stats(this: any, msg: any, reply: any) {
msg = msg || {}
Expand Down
16 changes: 13 additions & 3 deletions lib/add.js

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

Loading

0 comments on commit ff8ac0e

Please sign in to comment.