pico-engine 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ ruleset io.picolabs.oauth {
2
+ meta {
3
+ name "OAuth Mesh"
4
+ description <<
5
+ Optional mesh-level OAuth. Install on the root pico to require Bearer tokens on external /sky/*
6
+ for this mesh, and to hold per-mesh OAuth configuration (apps, consent policy, defaults).
7
+ Webhook Client Credentials (per channel) and app Authorization Code grants coexist here.
8
+ Not installed by default.
9
+
10
+ use module io.picolabs.oauth alias oauth
11
+ >>
12
+ author "PICOLABS"
13
+
14
+ provides meshEnabled, meshRequiresOAuth,
15
+ channelStatus, createChannelSecret, revokeChannelSecret, revokeTokens
16
+
17
+ shares meshEnabled, meshRequiresOAuth,
18
+ channelStatus, createChannelSecret, revokeChannelSecret, revokeTokens
19
+ }
20
+
21
+ global {
22
+ /** True when this ruleset is installed on the pico (mesh OAuth opt-in marker). */
23
+ meshEnabled = function() {
24
+ true
25
+ }
26
+
27
+ /** True when external /sky/* for eci requires a Bearer token (mesh lock or oauth-webhook tag). */
28
+ meshRequiresOAuth = function(eci) {
29
+ oauth:meshRequiresOAuth(eci)
30
+ }
31
+
32
+ channelStatus = function(eci) {
33
+ oauth:channelStatus(eci)
34
+ }
35
+
36
+ createChannelSecret = function(eci) {
37
+ oauth:createChannelSecret(eci)
38
+ }
39
+
40
+ revokeChannelSecret = function(eci) {
41
+ oauth:revokeChannelSecret(eci)
42
+ }
43
+
44
+ revokeTokens = function(eci) {
45
+ oauth:revokeTokens(eci)
46
+ }
47
+ }
48
+ }
@@ -68,10 +68,10 @@ ruleset io.picolabs.wrangler {
68
68
  Note this must include protocol (http:// or https://) being used and port number if not 80.
69
69
  For example "http://localhost:8080", which also is the default.
70
70
  _path - The sub path of the url which does not include mod or func.
71
- For example "/sky/cloud/", which also is the default.
71
+ For example "/sky/query/", which also is the default.
72
72
  _root_url - The entire url except eci, mod, func.
73
73
  For example, dependent on _host and _path is
74
- "http://localhost:8080/sky/cloud/", which also is the default.
74
+ "http://localhost:8080/sky/query/", which also is the default.
75
75
  picoQuery on success (if status code of request is 200) returns results of the called function.
76
76
  picoQuery on failure (if status code of request is not 200) returns a Map of error information which contains;
77
77
  error - general error message.
@@ -88,7 +88,7 @@ ruleset io.picolabs.wrangler {
88
88
  buildWebHook = function(eci, mod, func, _host, _path, _root_url) {
89
89
  createRootUrl = function (_host,_path){
90
90
  host = _host || meta:host;
91
- path = _path || "/sky/cloud/";
91
+ path = _path || "/sky/query/";
92
92
  root_url = host+path;
93
93
  root_url
94
94
  };
@@ -118,7 +118,7 @@ ruleset io.picolabs.wrangler {
118
118
  }
119
119
 
120
120
  skyQuery = function(eci, mod, func, params,_host,_path,_root_url) { // path must start with "/"", _host must include protocol(http:// or https://)
121
- //.../sky/cloud/<eci>/<rid>/<name>?name0=value0&...&namen=valuen
121
+ //.../sky/query/<eci>/<rid>/<name>?name0=value0&...&namen=valuen
122
122
  thisPico = ctx:channels.any(function(c){c{"id"}==eci})
123
123
  web_hook = buildWebHook(eci, mod, func, _host, _path, _root_url)
124
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pico-engine",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "An implementation of the pico-engine targeting node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,9 +39,14 @@
39
39
  "dev": "scriptsp -r dev:tsc dev:api",
40
40
  "dev:tsc": "tsc -w --preserveWatchOutput",
41
41
  "dev:api": "onchange -i -k dist/ -- node dist/cli.js",
42
- "test": "ava reset-cache && ava"
42
+ "test": "ava reset-cache && ava",
43
+ "test:auth": "ava reset-cache && ava --serial ./test/auth.ts --timeout=2m",
44
+ "test:oauth": "ava reset-cache && ava --serial ./test/oauth.ts --timeout=2m",
45
+ "test:acg": "ava reset-cache && ava --serial ./test/acg.ts --timeout=2m",
46
+ "test:http": "ava reset-cache && ava --serial ./test/httpSurface.ts --timeout=2m"
43
47
  },
44
48
  "dependencies": {
49
+ "@simplewebauthn/server": "^13.2.2",
45
50
  "body-parser": "^1.18.3",
46
51
  "charwise": "^3.0.1",
47
52
  "classic-level": "^1.3.0",
@@ -50,14 +55,14 @@
50
55
  "express": "^4.16.4",
51
56
  "helmet": "^7.1.0",
52
57
  "home-dir": "^1.0.0",
53
- "krl-compiler": "^1.4.0",
54
- "krl-stdlib": "^1.4.0",
58
+ "krl-compiler": "^1.5.0",
59
+ "krl-stdlib": "^1.5.0",
55
60
  "level-json-coerce-null": "^1.0.1",
56
61
  "lodash": "^4.17.11",
57
62
  "make-dir": "^4.0.0",
58
63
  "minimist": "^1.2.5",
59
- "pico-engine-core": "^1.4.0",
60
- "pico-framework": "^0.7.0",
64
+ "pico-engine-core": "^1.5.0",
65
+ "pico-framework": "^0.8.0",
61
66
  "rotating-file-stream": "^1.4.1"
62
67
  },
63
68
  "devDependencies": {
@@ -76,12 +81,13 @@
76
81
  "ts"
77
82
  ],
78
83
  "require": [
79
- "ts-node/register"
84
+ "ts-node/register",
85
+ "./test/helpers/testEnv.ts"
80
86
  ],
81
87
  "files": [
82
88
  "test/**/*",
83
89
  "!test/helpers/**/*"
84
90
  ]
85
91
  },
86
- "gitHead": "9004831f943022f7d37bc2260076ad038c6e7b9e"
92
+ "gitHead": "38f550eb9a0de399e9f1c4554176d4a7cc84d8c8"
87
93
  }