pinokiod 1.3.3 → 1.3.4
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.
- package/kernel/api/index.js +0 -17
- package/kernel/api/script/index.js +2 -2
- package/kernel/index.js +1 -1
- package/package.json +1 -1
package/kernel/api/index.js
CHANGED
|
@@ -84,14 +84,12 @@ class Api {
|
|
|
84
84
|
}
|
|
85
85
|
respond(req) {
|
|
86
86
|
let requestPath = this.filePath(req.uri)
|
|
87
|
-
console.log("RESPOND", { req, waiter: this.waiter, requestPath })
|
|
88
87
|
if (this.waiter[requestPath]) {
|
|
89
88
|
this.waiter[requestPath].resolve(req.response)
|
|
90
89
|
delete this.waiter[requestPath]
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
wait(scriptPath) {
|
|
94
|
-
console.log("WAIT", scriptPath)
|
|
95
93
|
// need to reject if everything fails
|
|
96
94
|
return new Promise((resolve, reject) => {
|
|
97
95
|
this.waiter[scriptPath] = { resolve, reject }
|
|
@@ -102,7 +100,6 @@ class Api {
|
|
|
102
100
|
return result
|
|
103
101
|
}
|
|
104
102
|
async stop(req, ondata) {
|
|
105
|
-
console.log("API.STOP", req)
|
|
106
103
|
// 1. set the "stop" flag for the uri, so the next execution in the queue for the uri will NOT queue another task
|
|
107
104
|
// 2. stream a message closing the socket
|
|
108
105
|
|
|
@@ -113,12 +110,9 @@ class Api {
|
|
|
113
110
|
|
|
114
111
|
|
|
115
112
|
let { cwd, script } = await this.resolveScript(requestPath)
|
|
116
|
-
console.log("script", script)
|
|
117
113
|
if (script.on) {
|
|
118
114
|
if (script.on.stop) {
|
|
119
|
-
console.log("BEFORE STOP")
|
|
120
115
|
await this.process(script.on.stop)
|
|
121
|
-
console.log("AFTER STOP")
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
118
|
|
|
@@ -541,9 +535,6 @@ class Api {
|
|
|
541
535
|
this.state = memory
|
|
542
536
|
this.executing = request
|
|
543
537
|
|
|
544
|
-
|
|
545
|
-
console.log("memory", memory)
|
|
546
|
-
|
|
547
538
|
// render until `{{ }}` pattern does not exist
|
|
548
539
|
// 1. render once
|
|
549
540
|
let rpc = rawrpc
|
|
@@ -566,8 +557,6 @@ class Api {
|
|
|
566
557
|
// replace {{{ }}} with {{ }}
|
|
567
558
|
rpc = this.kernel.template.flatten(rpc)
|
|
568
559
|
|
|
569
|
-
console.log("rpc", rpc)
|
|
570
|
-
|
|
571
560
|
// 6. rpc must have method names
|
|
572
561
|
if (rpc.method) {
|
|
573
562
|
|
|
@@ -621,7 +610,6 @@ class Api {
|
|
|
621
610
|
if (!rpc.when) {
|
|
622
611
|
if (typeof rpc.next === "undefined" || rpc.next === null) {
|
|
623
612
|
// last call
|
|
624
|
-
console.log("SCRIPT", script)
|
|
625
613
|
if (script.daemon) {
|
|
626
614
|
this.ondata({
|
|
627
615
|
id: request.path,
|
|
@@ -658,8 +646,6 @@ class Api {
|
|
|
658
646
|
}
|
|
659
647
|
}
|
|
660
648
|
|
|
661
|
-
console.log("#", { request, rpc })
|
|
662
|
-
|
|
663
649
|
try {
|
|
664
650
|
this.ondata({
|
|
665
651
|
id: request.path,
|
|
@@ -795,7 +781,6 @@ class Api {
|
|
|
795
781
|
|
|
796
782
|
// kill all connected shells
|
|
797
783
|
// if not daemon
|
|
798
|
-
console.log("DEF")
|
|
799
784
|
if (script.daemon) {
|
|
800
785
|
this.ondata({
|
|
801
786
|
id: request.path,
|
|
@@ -874,9 +859,7 @@ class Api {
|
|
|
874
859
|
createQueue(queue_id, concurrency) {
|
|
875
860
|
this.queues[queue_id] = fastq.promise(async ({ request, rawrpc, input, step, total, cwd, args }) => {
|
|
876
861
|
try {
|
|
877
|
-
console.log("Before step", { request, rawrpc })
|
|
878
862
|
let response = await this.step(request, rawrpc, input, step, total, args)
|
|
879
|
-
console.log("After step", response)
|
|
880
863
|
if (response) {
|
|
881
864
|
if (response.rawrpc) {
|
|
882
865
|
this.queue(response.request, response.rawrpc, response.input, response.step, response.total, cwd, args)
|
|
@@ -30,7 +30,7 @@ class Script {
|
|
|
30
30
|
"params": {
|
|
31
31
|
"hash": <git commit hash>,
|
|
32
32
|
"branch": <git branch>,
|
|
33
|
-
"
|
|
33
|
+
"pull": true|false,
|
|
34
34
|
"uri": <script uri>,
|
|
35
35
|
"params": <script args>
|
|
36
36
|
}
|
|
@@ -107,7 +107,7 @@ class Script {
|
|
|
107
107
|
path: kernel.path("api", folderName)
|
|
108
108
|
}, ondata)
|
|
109
109
|
}
|
|
110
|
-
if (req.params.
|
|
110
|
+
if (req.params.pull) {
|
|
111
111
|
await kernel.bin.sh({
|
|
112
112
|
message: `git pull`,
|
|
113
113
|
path: kernel.path("api", folderName)
|
package/kernel/index.js
CHANGED