-
Notifications
You must be signed in to change notification settings - Fork 0
/
validation.jsonl
67 lines (67 loc) · 20.7 KB
/
validation.jsonl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{"prompt":"A node that deletes a file from a specified path\n\n###\n\n","completion":" Delete File | path | | IMPLICIT | NONE\nfunction (input, output, adv) {\n const { path } = input;\n const { result } = output;\n\n fs.unlink(path, (err) => {\n if (err) {\n result.error(err);\n } else {\n result.complete();\n }\n });\n}###"}
{"prompt":"Check if file exists\n\n###\n\n","completion":" Exists | path | exists | IMPLICIT | NONE\n({ path, contents, encoding }) => {\n return fs.promises.appendFile(path, contents, encoding);\n }###"}
{"prompt":"Verify file existence\n\n###\n\n","completion":" Exists | path | exists | IMPLICIT | NONE\nfunction (input, output) {\n const { path } = input;\n const { exists } = output;\n \n fs.access(path, fs.constants.F_OK, (err) => {\n if (err) {\n exists.next(false);\n } else {\n exists.next(true);\n }\n });\n}###"}
{"prompt":"File existence checker\n\n###\n\n","completion":" Exists | path | exists | IMPLICIT | NONE\n({ path, contents, encoding }) => {\n return fs.promises.appendFile(path, contents, encoding);\n }###"}
{"prompt":"Determine if file exists\n\n###\n\n","completion":" Exists | path | exists | IMPLICIT | NONE\nfunction (input, output) {\n const { path } = input;\n const { exists } = output;\n \n fs.access(path, fs.constants.F_OK, (err) => {\n if (err) {\n exists.next(false);\n } else {\n exists.next(true);\n }\n });\n}###"}
{"prompt":"Run SQL query\n\n###\n\n","completion":" Query | connection,query | result | IMPLICIT | NONE\nasync ({ connection, query }, { result }) => {\n const queryResult = await connection.value?.query(query);\n result.next(queryResult?.rows);\n }###"}
{"prompt":"Execute database query\n\n###\n\n","completion":" Query | connection,query | result | IMPLICIT | NONE\nfunction (inputData, outputData, adv) {\n const { dbConnection, sqlQuery } = inputData;\n const { queryResult } = outputData;\n\n const queryResultData = await dbConnection.value?.query(sqlQuery);\n queryResult.next(queryResultData?.rows);\n}###"}
{"prompt":"Query database for results\n\n###\n\n","completion":" Query | connection,query | result | IMPLICIT | NONE\nasync ({ connection, query }, { result }) => {\n const queryResult = await connection.value?.query(query);\n result.next(queryResult?.rows);\n }###"}
{"prompt":"Send SQL query and receive results\n\n###\n\n","completion":" Query | connection,query | result | IMPLICIT | NONE\nfunction (inputData, outputData, adv) {\n const { dbConnection, sqlQuery } = inputData;\n const { queryResult } = outputData;\n\n const queryResultData = await dbConnection.value?.query(sqlQuery);\n queryResult.next(queryResultData?.rows);\n}###"}
{"prompt":"Parse JSON string to object\n\n###\n\n","completion":" JSON Parse | json | object | IMPLICIT | NONE\n({ json }, { object }) => object.next(JSON.parse(json))###"}
{"prompt":"Convert JSON string to object\n\n###\n\n","completion":" JSON Parse | json | object | IMPLICIT | NONE\nfunction (input, output) {\n const { json } = input;\n const { object } = output;\n try {\n const parsed = JSON.parse(json);\n object.next(parsed);\n } catch (error) {\n object.error(error);\n }\n}###"}
{"prompt":"JSON string to object converter\n\n###\n\n","completion":" JSON Parse | json | object | IMPLICIT | NONE\n({ json }, { object }) => object.next(JSON.parse(json))###"}
{"prompt":"JSON string parser\n\n###\n\n","completion":" JSON Parse | json | object | IMPLICIT | NONE\nfunction (input, output) {\n const { json } = input;\n const { object } = output;\n try {\n const parsed = JSON.parse(json);\n object.next(parsed);\n } catch (error) {\n object.error(error);\n }\n}###"}
{"prompt":"Add two numbers\n\n###\n\n","completion":" Add | n1,n2 | sum | IMPLICIT | NONE\n({ n1, n2 }, { sum }) => sum.next(n1 + n2)###"}
{"prompt":"Calculate sum of two numbers\n\n###\n\n","completion":" Add | n1,n2 | sum | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const { n1, n2 } = inputs;\n const { sum } = outputs;\n\n sum.next(n1 + n2);\n}###"}
{"prompt":"Simple addition\n\n###\n\n","completion":" Add | n1,n2 | sum | IMPLICIT | NONE\n({ n1, n2 }, { sum }) => sum.next(n1 + n2)###"}
{"prompt":"Addition of two numbers\n\n###\n\n","completion":" Add | n1,n2 | sum | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const { n1, n2 } = inputs;\n const { sum } = outputs;\n\n sum.next(n1 + n2);\n}###"}
{"prompt":"Round a number\n\n###\n\n","completion":" Round | n | rounded | IMPLICIT | NONE\n({ n }, { rounded }) => rounded.next(Math.round(n))###"}
{"prompt":"Create a rounded number\n\n###\n\n","completion":" Round | n | rounded | IMPLICIT | NONE\nfunction (input, output) {\n const { n } = input;\n const { rounded } = output;\n rounded.next(Math.round(n));\n}###"}
{"prompt":"Round to precision\n\n###\n\n","completion":" To Precision | number,places | precision | IMPLICIT | NONE\n({ number, places }, { precision }) =>\n precision.next(number.toPrecision(places))###"}
{"prompt":"Set number precision\n\n###\n\n","completion":" To Precision | number,places | precision | IMPLICIT | NONE\nfunction ({ num, dec }, { result }) {\n const { num, dec } = inputs;\n const { result } = outputs;\n result.next(num.toFixed(dec));\n}###"}
{"prompt":"Precision calculator\n\n###\n\n","completion":" To Precision | number,places | precision | IMPLICIT | NONE\n({ number, places }, { precision }) =>\n precision.next(number.toPrecision(places))###"}
{"prompt":"Number precision\n\n###\n\n","completion":" To Precision | number,places | precision | IMPLICIT | NONE\nfunction ({ num, dec }, { result }) {\n const { num, dec } = inputs;\n const { result } = outputs;\n result.next(num.toFixed(dec));\n}###"}
{"prompt":"Combine two values\n\n###\n\n","completion":" Concat | a,b | value | IMPLICIT | NONE\n({ a, b }, { value }) => value.next(a + b)###"}
{"prompt":"Concatenate two inputs\n\n###\n\n","completion":" Concat | a,b | value | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const { a, b } = inputs;\n const { value } = outputs;\n\n value.next(`${a}${b}`);\n}###"}
{"prompt":"Join two values together\n\n###\n\n","completion":" Concat | a,b | value | IMPLICIT | NONE\n({ a, b }, { value }) => value.next(a + b)###"}
{"prompt":"Create a single value from two inputs\n\n###\n\n","completion":" Concat | a,b | value | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const { a, b } = inputs;\n const { value } = outputs;\n\n value.next(`${a}${b}`);\n}###"}
{"prompt":"Find last occurrence of substring\n\n###\n\n","completion":" Last Index Of | string,searchValue,fromIndex | value | IMPLICIT | NONE\n({ string, searchValue, fromIndex }, { value }) =>\n value.next(string.lastIndexOf(searchValue, fromIndex))###"}
{"prompt":"Get index of last substring\n\n###\n\n","completion":" Last Index Of | string,searchValue,fromIndex | value | IMPLICIT | NONE\nfunction ({ inputString, searchValue, fromIndex }, { lastIndex }) { lastIndex.next(inputString.lastIndexOf(searchValue, fromIndex)); }###"}
{"prompt":"Find last index of substring in string\n\n###\n\n","completion":" Last Index Of | string,searchValue,fromIndex | value | IMPLICIT | NONE\n({ string, searchValue, fromIndex }, { value }) =>\n value.next(string.lastIndexOf(searchValue, fromIndex))###"}
{"prompt":"Find the last position of a substring in a string\n\n###\n\n","completion":" Last Index Of | string,searchValue,fromIndex | value | IMPLICIT | NONE\nfunction ({ inputString, searchValue, fromIndex }, { lastIndex }) { lastIndex.next(inputString.lastIndexOf(searchValue, fromIndex)); }###"}
{"prompt":"Limit input to certain number of times\n\n###\n\n","completion":" Limit Times | item,times,reset | ok | | item,reset\nfunction (inputs, outputs, adv) {\n \/\/ magic here\n const { state } = adv;\n const { item, times, reset } = inputs;\n const { ok } = outputs;\n\n if (typeof reset !== \"undefined\") {\n state.set(\"val\", 0);\n return;\n }\n\n let curr = state.get(\"val\") || 0;\n curr++;\n state.set(\"val\", curr);\n if (curr >= times) {\n adv.onError(new Error(`Limit of ${times} reached`));\n } else {\n ok.next(item);\n }\n }###"}
{"prompt":"Limit input to specific count\n\n###\n\n","completion":" Limit Times | item,times,reset | ok | | item,reset\nfunction (inputs, outputs, adv) {\n const { state } = adv;\n const { input, count, reset } = inputs;\n const { output } = outputs;\n\n if (typeof reset !== \"undefined\") {\n state.set(\"val\", 0);\n return;\n }\n\n let curr = state.get(\"val\") || 0;\n curr++;\n state.set(\"val\", curr);\n if (curr >= count) {\n adv.onError(new Error(`Limit of ${count} reached`));\n } else {\n output.next(input);\n }\n }###"}
{"prompt":"Limit input to a certain number of occurrences\n\n###\n\n","completion":" Limit Times | item,times,reset | ok | | item,reset\nfunction (inputs, outputs, adv) {\n \/\/ magic here\n const { state } = adv;\n const { item, times, reset } = inputs;\n const { ok } = outputs;\n\n if (typeof reset !== \"undefined\") {\n state.set(\"val\", 0);\n return;\n }\n\n let curr = state.get(\"val\") || 0;\n curr++;\n state.set(\"val\", curr);\n if (curr >= times) {\n adv.onError(new Error(`Limit of ${times} reached`));\n } else {\n ok.next(item);\n }\n }###"}
{"prompt":"Limit input to a specific number of times\n\n###\n\n","completion":" Limit Times | item,times,reset | ok | | item,reset\nfunction (inputs, outputs, adv) {\n const { state } = adv;\n const { input, count, reset } = inputs;\n const { output } = outputs;\n\n if (typeof reset !== \"undefined\") {\n state.set(\"val\", 0);\n return;\n }\n\n let curr = state.get(\"val\") || 0;\n curr++;\n state.set(\"val\", curr);\n if (curr >= count) {\n adv.onError(new Error(`Limit of ${count} reached`));\n } else {\n output.next(input);\n }\n }###"}
{"prompt":"A part that routes values to different outputs\n\n###\n\n","completion":" Switch 4 | value,firstCase,secondCase,thirdCase,fourthCase,outputValue | first,second,third,fourth,default | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const {\n first,\n second,\n third,\n fourth,\n default: defaultOutput,\n outputValue,\n } = outputs;\n const { value, firstCase, secondCase, thirdCase, fourthCase } = inputs;\n if (value === firstCase) {\n first.next(outputValue ?? value);\n } else if (value === secondCase) {\n second.next(outputValue ?? value);\n } else if (value === thirdCase) {\n third.next(outputValue ?? value);\n } else if (value === fourthCase) {\n fourth.next(outputValue ?? value);\n } else {\n defaultOutput.next(outputValue ?? value);\n }\n }###"}
{"prompt":"Switch between multiple output values\n\n###\n\n","completion":" Switch 4 | value,firstCase,secondCase,thirdCase,fourthCase,outputValue | first,second,third,fourth,default | IMPLICIT | NONE\nfunction ({ value, case1, case2, case3, case4, output }, { case1Output, case2Output, case3Output, case4Output, defaultOutput }) {\n if (value === case1) {\n case1Output.next(output);\n } else if (value === case2) {\n case2Output.next(output);\n } else if (value === case3) {\n case3Output.next(output);\n } else if (value === case4) {\n case4Output.next(output);\n } else {\n defaultOutput.next(output);\n }\n}###"}
{"prompt":"A node that directs input values to different outputs\n\n###\n\n","completion":" Switch 4 | value,firstCase,secondCase,thirdCase,fourthCase,outputValue | first,second,third,fourth,default | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const {\n first,\n second,\n third,\n fourth,\n default: defaultOutput,\n outputValue,\n } = outputs;\n const { value, firstCase, secondCase, thirdCase, fourthCase } = inputs;\n if (value === firstCase) {\n first.next(outputValue ?? value);\n } else if (value === secondCase) {\n second.next(outputValue ?? value);\n } else if (value === thirdCase) {\n third.next(outputValue ?? value);\n } else if (value === fourthCase) {\n fourth.next(outputValue ?? value);\n } else {\n defaultOutput.next(outputValue ?? value);\n }\n }###"}
{"prompt":"A flow-based programming node that routes input values to different outputs\n\n###\n\n","completion":" Switch 4 | value,firstCase,secondCase,thirdCase,fourthCase,outputValue | first,second,third,fourth,default | IMPLICIT | NONE\nfunction ({ value, case1, case2, case3, case4, output }, { case1Output, case2Output, case3Output, case4Output, defaultOutput }) {\n if (value === case1) {\n case1Output.next(output);\n } else if (value === case2) {\n case2Output.next(output);\n } else if (value === case3) {\n case3Output.next(output);\n } else if (value === case4) {\n case4Output.next(output);\n } else {\n defaultOutput.next(output);\n }\n}###"}
{"prompt":"Count items in list\n\n###\n\n","completion":" List Length | list | length | IMPLICIT | NONE\n({ list }, { length }) => length.next(list.length)###"}
{"prompt":"Get list length\n\n###\n\n","completion":" List Length | list | length | IMPLICIT | NONE\nfunction (inputs, outputs, adv) {\n const { myList } = inputs;\n const { listLength } = outputs;\n listLength.next(myList.length);\n}###"}
{"prompt":"Calculate list size\n\n###\n\n","completion":" List Length | list | length | IMPLICIT | NONE\n({ list }, { length }) => length.next(list.length)###"}
{"prompt":"Determine number of items in list\n\n###\n\n","completion":" List Length | list | length | IMPLICIT | NONE\nfunction (inputs, outputs, adv) {\n const { myList } = inputs;\n const { listLength } = outputs;\n listLength.next(myList.length);\n}###"}
{"prompt":"Loop through a list\n\n###\n\n","completion":" Loop List | list | item,index,length | IMPLICIT | NONE\n(inputs, outputs) => {\n const { list } = inputs;\n const { item, index } = outputs;\n for (const i of list) {\n item.next(i);\n index.next(list.indexOf(i));\n }\n outputs.length.next(list.length);\n }###"}
{"prompt":"Iterate over a list\n\n###\n\n","completion":" Loop List | list | item,index,length | IMPLICIT | NONE\nfunction (inputList, outputItem, outputIndex, outputLength) {\n const { list } = inputList;\n for (const i of list) {\n outputItem.next(i);\n outputIndex.next(list.indexOf(i));\n }\n outputLength.next(list.length);\n}###"}
{"prompt":"Loop through items in a list\n\n###\n\n","completion":" Loop List | list | item,index,length | IMPLICIT | NONE\n(inputs, outputs) => {\n const { list } = inputs;\n const { item, index } = outputs;\n for (const i of list) {\n item.next(i);\n index.next(list.indexOf(i));\n }\n outputs.length.next(list.length);\n }###"}
{"prompt":"Loop through a list and output item, index, and length\n\n###\n\n","completion":" Loop List | list | item,index,length | IMPLICIT | NONE\nfunction (inputList, outputItem, outputIndex, outputLength) {\n const { list } = inputList;\n for (const i of list) {\n outputItem.next(i);\n outputIndex.next(list.indexOf(i));\n }\n outputLength.next(list.length);\n}###"}
{"prompt":"Add item to beginning of list\n\n###\n\n","completion":" Prepend | list,item | list | IMPLICIT | NONE\n({ list, item }, { list: outputList }) => {\n outputList.next([item, ...list]);\n }###"}
{"prompt":"Prepend item to list\n\n###\n\n","completion":" Prepend | list,item | list | IMPLICIT | NONE\nfunction (inputs, outputs, adv) {\n const { list, item } = inputs;\n const { list: outputList } = outputs;\n\n const newList = [item, ...list];\n outputList.next(newList);\n}###"}
{"prompt":"Add to start of list\n\n###\n\n","completion":" Prepend | list,item | list | IMPLICIT | NONE\n({ list, item }, { list: outputList }) => {\n outputList.next([item, ...list]);\n }###"}
{"prompt":"Insert item at beginning of list\n\n###\n\n","completion":" Prepend | list,item | list | IMPLICIT | NONE\nfunction (inputs, outputs, adv) {\n const { list, item } = inputs;\n const { list: outputList } = outputs;\n\n const newList = [item, ...list];\n outputList.next(newList);\n}###"}
{"prompt":"Current Date\n\n###\n\n","completion":" Now | | now | IMPLICIT | NONE\n(_, { now }) => now.next(new Date())###"}
{"prompt":"Get Current Time\n\n###\n\n","completion":" Now | | now | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const { now } = outputs;\n setInterval(() => {\n now.next(new Date());\n }, 1000);\n}###"}
{"prompt":"Real-time Clock\n\n###\n\n","completion":" Now | | now | IMPLICIT | NONE\n(_, { now }) => now.next(new Date())###"}
{"prompt":"Part that outputs current date\/time\n\n###\n\n","completion":" Now | | now | IMPLICIT | NONE\nfunction (inputs, outputs) {\n const { now } = outputs;\n setInterval(() => {\n now.next(new Date());\n }, 1000);\n}###"}
{"prompt":"Convert date to year\n\n###\n\n","completion":" Date To Year | date | year | IMPLICIT | NONE\n({ date }, { year }) => year.next(date.getFullYear())###"}
{"prompt":"Extract year from date\n\n###\n\n","completion":" Date To Year | date | year | IMPLICIT | NONE\nfunction ({ dateInput }, { yearOutput }) {\n const { date } = dateInput;\n const { year } = yearOutput;\n year.next(date.getFullYear());\n}###"}
{"prompt":"Get year from date\n\n###\n\n","completion":" Date To Year | date | year | IMPLICIT | NONE\n({ date }, { year }) => year.next(date.getFullYear())###"}
{"prompt":"Transform date to year\n\n###\n\n","completion":" Date To Year | date | year | IMPLICIT | NONE\nfunction ({ dateInput }, { yearOutput }) {\n const { date } = dateInput;\n const { year } = yearOutput;\n year.next(date.getFullYear());\n}###"}
{"prompt":"Database connection initializer\n\n###\n\n","completion":" Find | connection,collection,query,options | result | IMPLICIT | NONE\nasync ({ host, port, database, user, password }, { connection }) => {\n const { Client } = await import(\"pg\");\n const client = new Client({\n host,\n port,\n database,\n user,\n password,\n });\n await client.connect();\n connection.next(client);\n }###"}
{"prompt":"Initialize database connection\n\n###\n\n","completion":" Find | connection,collection,query,options | result | IMPLICIT | NONE\nfunction (inputs, outputs, adv) {\n const { hostName, portNumber, dbName, userName, password } = inputs;\n const { connection } = outputs;\n\n const { Client } = await import(\"pg\");\n const client = new Client({\n host: hostName,\n port: portNumber,\n database: dbName,\n user: userName,\n password: password,\n });\n await client.connect();\n connection.next(client);\n}###"}
{"prompt":"Create database connection\n\n###\n\n","completion":" Find | connection,collection,query,options | result | IMPLICIT | NONE\nasync ({ host, port, database, user, password }, { connection }) => {\n const { Client } = await import(\"pg\");\n const client = new Client({\n host,\n port,\n database,\n user,\n password,\n });\n await client.connect();\n connection.next(client);\n }###"}
{"prompt":"Connect to database\n\n###\n\n","completion":" Find | connection,collection,query,options | result | IMPLICIT | NONE\nfunction (inputs, outputs, adv) {\n const { hostName, portNumber, dbName, userName, password } = inputs;\n const { connection } = outputs;\n\n const { Client } = await import(\"pg\");\n const client = new Client({\n host: hostName,\n port: portNumber,\n database: dbName,\n user: userName,\n password: password,\n });\n await client.connect();\n connection.next(client);\n}###"}
{"prompt":"Read contents of file\n\n###\n\n","completion":" Read File | path,encoding | contents | IMPLICIT | NONE\nasync ({ connection, collection, fieldOrSpec, options }, { result }) => {\n const res = await connection\n .db()\n .collection(collection)\n .createIndex(fieldOrSpec, options);\n result.next(res);\n }###"}
{"prompt":"Get file contents\n\n###\n\n","completion":" Read File | path,encoding | contents | IMPLICIT | NONE\nfunction (fileData, fileEncoding, fileContents) {\n const fs = require('fs');\n fs.readFile(fileData, fileEncoding, (err, data) => {\n if (err) throw err;\n fileContents.next(data);\n });\n}###"}
{"prompt":"Read file data\n\n###\n\n","completion":" Read File | path,encoding | contents | IMPLICIT | NONE\nasync ({ connection, collection, fieldOrSpec, options }, { result }) => {\n const res = await connection\n .db()\n .collection(collection)\n .createIndex(fieldOrSpec, options);\n result.next(res);\n }###"}
{"prompt":"Retrieve file contents\n\n###\n\n","completion":" Read File | path,encoding | contents | IMPLICIT | NONE\nfunction (fileData, fileEncoding, fileContents) {\n const fs = require('fs');\n fs.readFile(fileData, fileEncoding, (err, data) => {\n if (err) throw err;\n fileContents.next(data);\n });\n}###"}