dirac-lang 0.1.2 → 0.1.3
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.
|
@@ -172,7 +172,6 @@ async function executeParameters(session, element) {
|
|
|
172
172
|
}
|
|
173
173
|
if (value !== void 0) {
|
|
174
174
|
setVariable(session, attrName, value, false);
|
|
175
|
-
console.error(`[PARAMETERS] Variable stack after setting '${attrName}':`, JSON.stringify(session.variables));
|
|
176
175
|
}
|
|
177
176
|
for (const child of element.children) {
|
|
178
177
|
await integrate(session, child);
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/examples/lib/mongodb.di
CHANGED
|
@@ -9,17 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
<require_module name="mongodb" var="mongo" />
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
and the dollar sign expression : ${mongo} -->
|
|
14
|
-
<!-- the body is ${body} -->
|
|
12
|
+
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
|
|
18
16
|
<eval name="result">
|
|
19
17
|
{ let output = body;
|
|
20
18
|
const uri = process.env.MONGODB_URI || 'mongodb://localhost:27017';
|
|
21
|
-
|
|
22
|
-
console.log('DEBUG: body content before JSON.parse:', body);
|
|
19
|
+
|
|
23
20
|
const query = body ? JSON.parse(body) : {};
|
|
24
21
|
const client = new mongo.MongoClient(uri);
|
|
25
22
|
|
|
@@ -58,39 +55,7 @@
|
|
|
58
55
|
|
|
59
56
|
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const uri = process.env.MONGODB_URI || 'mongodb://localhost:27017';
|
|
64
|
-
// database, collection, action, and body are available as variables
|
|
65
|
-
console.log('DEBUG: body content before JSON.parse:', body);
|
|
66
|
-
const query = body ? JSON.parse(body) : {};
|
|
67
|
-
const client = new mongo.MongoClient(uri);
|
|
68
|
-
let output;
|
|
69
|
-
try {
|
|
70
|
-
await client.connect();
|
|
71
|
-
const db = database ? client.db(database) : undefined;
|
|
72
|
-
const col = db && collection ? db.collection(collection) : undefined;
|
|
73
|
-
switch (action || 'find') {
|
|
74
|
-
case 'find':
|
|
75
|
-
output = await col.find(query).toArray();
|
|
76
|
-
break;
|
|
77
|
-
case 'aggregate':
|
|
78
|
-
output = await col.aggregate(query).toArray();
|
|
79
|
-
break;
|
|
80
|
-
case 'insert':
|
|
81
|
-
output = await col.insertOne(query);
|
|
82
|
-
break;
|
|
83
|
-
case 'count':
|
|
84
|
-
output = await col.countDocuments(query);
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
throw new Error('Unknown action for MONGODB: ' + action);
|
|
88
|
-
}
|
|
89
|
-
} finally {
|
|
90
|
-
await client.close();
|
|
91
|
-
}
|
|
92
|
-
return JSON.stringify(output, null, 2);
|
|
93
|
-
</eval> -->
|
|
94
|
-
<output>${result}\n</output>
|
|
58
|
+
|
|
59
|
+
<output>${result}</output>
|
|
95
60
|
</subroutine>
|
|
96
61
|
</dirac>
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<!-- Import the MongoDB extension library -->
|
|
7
7
|
<import src="./lib/mongodb.di" />
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<!--
|
|
10
10
|
<MONGODB database="betting" collection="events" action="find">{ "type.name": "Pass" }</MONGODB>
|
|
11
|
+
-->
|
|
11
12
|
|
|
12
|
-
<!--
|
|
13
13
|
<output>Testing MongoDB count: </output>
|
|
14
14
|
|
|
15
15
|
<MONGODB database="betting" collection="events" action="count">{ "type.name": "Pass" }</MONGODB>
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
|
|
18
18
|
</dirac>
|
package/package.json
CHANGED
package/src/tags/parameters.ts
CHANGED
|
@@ -65,8 +65,6 @@ export async function executeParameters(session: DiracSession, element: DiracEle
|
|
|
65
65
|
}
|
|
66
66
|
if (value !== undefined) {
|
|
67
67
|
setVariable(session, attrName, value, false);
|
|
68
|
-
// Debug: print variable stack after setting
|
|
69
|
-
console.error(`[PARAMETERS] Variable stack after setting '${attrName}':`, JSON.stringify(session.variables));
|
|
70
68
|
}
|
|
71
69
|
for (const child of element.children) {
|
|
72
70
|
await integrate(session, child);
|