@openfn/language-mssql 4.1.10 → 4.2.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.
- package/ast.json +77 -0
- package/configuration-schema.json +39 -6
- package/dist/index.cjs +18 -4
- package/dist/index.js +18 -4
- package/package.json +1 -1
- package/types/Adaptor.d.ts +1 -1
package/ast.json
CHANGED
|
@@ -1082,6 +1082,83 @@
|
|
|
1082
1082
|
]
|
|
1083
1083
|
},
|
|
1084
1084
|
"valid": true
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"name": "cursor",
|
|
1088
|
+
"params": [
|
|
1089
|
+
"value",
|
|
1090
|
+
"options"
|
|
1091
|
+
],
|
|
1092
|
+
"docs": {
|
|
1093
|
+
"description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones \nare not yet supported.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
|
|
1094
|
+
"tags": [
|
|
1095
|
+
{
|
|
1096
|
+
"title": "public",
|
|
1097
|
+
"description": null,
|
|
1098
|
+
"type": null
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
"title": "example",
|
|
1102
|
+
"description": "cursor($.cursor, { defaultValue: 'today' })",
|
|
1103
|
+
"caption": "Use a cursor from state if present, or else use the default value"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
"title": "example",
|
|
1107
|
+
"description": "cursor(22)",
|
|
1108
|
+
"caption": "Use a pagination cursor"
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
"title": "function",
|
|
1112
|
+
"description": null,
|
|
1113
|
+
"name": null
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
"title": "param",
|
|
1117
|
+
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
|
|
1118
|
+
"type": {
|
|
1119
|
+
"type": "NameExpression",
|
|
1120
|
+
"name": "any"
|
|
1121
|
+
},
|
|
1122
|
+
"name": "value"
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
"title": "param",
|
|
1126
|
+
"description": "options to control the cursor.",
|
|
1127
|
+
"type": {
|
|
1128
|
+
"type": "NameExpression",
|
|
1129
|
+
"name": "object"
|
|
1130
|
+
},
|
|
1131
|
+
"name": "options"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
"title": "param",
|
|
1135
|
+
"description": "set the cursor key. Will persist through the whole run.",
|
|
1136
|
+
"type": {
|
|
1137
|
+
"type": "NameExpression",
|
|
1138
|
+
"name": "string"
|
|
1139
|
+
},
|
|
1140
|
+
"name": "options.key"
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
"title": "param",
|
|
1144
|
+
"description": "the value to use if value is falsy",
|
|
1145
|
+
"type": {
|
|
1146
|
+
"type": "NameExpression",
|
|
1147
|
+
"name": "any"
|
|
1148
|
+
},
|
|
1149
|
+
"name": "options.defaultValue"
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
"title": "returns",
|
|
1153
|
+
"description": null,
|
|
1154
|
+
"type": {
|
|
1155
|
+
"type": "NameExpression",
|
|
1156
|
+
"name": "Operation"
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1161
|
+
"valid": false
|
|
1085
1162
|
}
|
|
1086
1163
|
]
|
|
1087
1164
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/draft-07/schema#",
|
|
3
3
|
"properties": {
|
|
4
4
|
"server": {
|
|
5
5
|
"title": "Server URL",
|
|
6
|
-
"type": "string",
|
|
7
6
|
"description": "The database instance server URL or IP address",
|
|
8
|
-
"
|
|
7
|
+
"type": "string",
|
|
9
8
|
"minLength": 1,
|
|
10
9
|
"examples": [
|
|
11
|
-
"something.database.windows.net"
|
|
10
|
+
"something.database.windows.net",
|
|
11
|
+
"192.168.12.10"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"database": {
|
|
@@ -38,9 +38,42 @@
|
|
|
38
38
|
"examples": [
|
|
39
39
|
"@super(!)Password"
|
|
40
40
|
]
|
|
41
|
+
},
|
|
42
|
+
"port": {
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"default": 1433,
|
|
45
|
+
"examples": [
|
|
46
|
+
1432
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"encrypt": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"default": true,
|
|
52
|
+
"examples": [
|
|
53
|
+
false
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"rowCollectionOnRequestCompletion": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"default": true,
|
|
59
|
+
"examples": [
|
|
60
|
+
false
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"trustServerCertificate": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"default": true,
|
|
66
|
+
"examples": [
|
|
67
|
+
false
|
|
68
|
+
]
|
|
41
69
|
}
|
|
42
70
|
},
|
|
43
71
|
"type": "object",
|
|
44
72
|
"additionalProperties": true,
|
|
45
|
-
"required": [
|
|
46
|
-
|
|
73
|
+
"required": [
|
|
74
|
+
"server",
|
|
75
|
+
"database",
|
|
76
|
+
"userName",
|
|
77
|
+
"password"
|
|
78
|
+
]
|
|
79
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var src_exports = {};
|
|
|
21
21
|
__export(src_exports, {
|
|
22
22
|
alterState: () => import_language_common2.alterState,
|
|
23
23
|
combine: () => import_language_common2.combine,
|
|
24
|
+
cursor: () => import_language_common2.cursor,
|
|
24
25
|
dataPath: () => import_language_common2.dataPath,
|
|
25
26
|
dataValue: () => import_language_common2.dataValue,
|
|
26
27
|
dateFns: () => import_language_common2.dateFns,
|
|
@@ -52,6 +53,7 @@ var Adaptor_exports = {};
|
|
|
52
53
|
__export(Adaptor_exports, {
|
|
53
54
|
alterState: () => import_language_common2.alterState,
|
|
54
55
|
combine: () => import_language_common2.combine,
|
|
56
|
+
cursor: () => import_language_common2.cursor,
|
|
55
57
|
dataPath: () => import_language_common2.dataPath,
|
|
56
58
|
dataValue: () => import_language_common2.dataValue,
|
|
57
59
|
dateFns: () => import_language_common2.dateFns,
|
|
@@ -79,7 +81,16 @@ var import_language_common = require("@openfn/language-common");
|
|
|
79
81
|
var import_tedious = require("tedious");
|
|
80
82
|
var import_language_common2 = require("@openfn/language-common");
|
|
81
83
|
function createConnection(state) {
|
|
82
|
-
const {
|
|
84
|
+
const {
|
|
85
|
+
server,
|
|
86
|
+
userName,
|
|
87
|
+
password,
|
|
88
|
+
database,
|
|
89
|
+
port = 1433,
|
|
90
|
+
encrypt = true,
|
|
91
|
+
rowCollectionOnRequestCompletion = true,
|
|
92
|
+
trustServerCertificate = true
|
|
93
|
+
} = state.configuration;
|
|
83
94
|
if (!server) {
|
|
84
95
|
throw new Error("server missing from configuration.");
|
|
85
96
|
}
|
|
@@ -90,12 +101,14 @@ function createConnection(state) {
|
|
|
90
101
|
},
|
|
91
102
|
server,
|
|
92
103
|
options: {
|
|
104
|
+
port,
|
|
93
105
|
database,
|
|
94
|
-
encrypt
|
|
95
|
-
rowCollectionOnRequestCompletion
|
|
106
|
+
encrypt,
|
|
107
|
+
rowCollectionOnRequestCompletion,
|
|
108
|
+
trustServerCertificate
|
|
96
109
|
}
|
|
97
110
|
};
|
|
98
|
-
|
|
111
|
+
const connection = new import_tedious.Connection(config);
|
|
99
112
|
return new Promise((resolve, reject) => {
|
|
100
113
|
connection.on("connect", (err) => {
|
|
101
114
|
if (err) {
|
|
@@ -546,6 +559,7 @@ var src_default = Adaptor_exports;
|
|
|
546
559
|
0 && (module.exports = {
|
|
547
560
|
alterState,
|
|
548
561
|
combine,
|
|
562
|
+
cursor,
|
|
549
563
|
dataPath,
|
|
550
564
|
dataValue,
|
|
551
565
|
dateFns,
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var Adaptor_exports = {};
|
|
|
9
9
|
__export(Adaptor_exports, {
|
|
10
10
|
alterState: () => alterState,
|
|
11
11
|
combine: () => combine,
|
|
12
|
+
cursor: () => cursor,
|
|
12
13
|
dataPath: () => dataPath,
|
|
13
14
|
dataValue: () => dataValue,
|
|
14
15
|
dateFns: () => dateFns,
|
|
@@ -49,11 +50,21 @@ import {
|
|
|
49
50
|
fn,
|
|
50
51
|
http,
|
|
51
52
|
lastReferenceValue,
|
|
53
|
+
cursor,
|
|
52
54
|
merge,
|
|
53
55
|
sourceValue
|
|
54
56
|
} from "@openfn/language-common";
|
|
55
57
|
function createConnection(state) {
|
|
56
|
-
const {
|
|
58
|
+
const {
|
|
59
|
+
server,
|
|
60
|
+
userName,
|
|
61
|
+
password,
|
|
62
|
+
database,
|
|
63
|
+
port = 1433,
|
|
64
|
+
encrypt = true,
|
|
65
|
+
rowCollectionOnRequestCompletion = true,
|
|
66
|
+
trustServerCertificate = true
|
|
67
|
+
} = state.configuration;
|
|
57
68
|
if (!server) {
|
|
58
69
|
throw new Error("server missing from configuration.");
|
|
59
70
|
}
|
|
@@ -64,12 +75,14 @@ function createConnection(state) {
|
|
|
64
75
|
},
|
|
65
76
|
server,
|
|
66
77
|
options: {
|
|
78
|
+
port,
|
|
67
79
|
database,
|
|
68
|
-
encrypt
|
|
69
|
-
rowCollectionOnRequestCompletion
|
|
80
|
+
encrypt,
|
|
81
|
+
rowCollectionOnRequestCompletion,
|
|
82
|
+
trustServerCertificate
|
|
70
83
|
}
|
|
71
84
|
};
|
|
72
|
-
|
|
85
|
+
const connection = new Connection(config);
|
|
73
86
|
return new Promise((resolve, reject) => {
|
|
74
87
|
connection.on("connect", (err) => {
|
|
75
88
|
if (err) {
|
|
@@ -519,6 +532,7 @@ var src_default = Adaptor_exports;
|
|
|
519
532
|
export {
|
|
520
533
|
alterState,
|
|
521
534
|
combine,
|
|
535
|
+
cursor,
|
|
522
536
|
dataPath,
|
|
523
537
|
dataValue,
|
|
524
538
|
dateFns,
|
package/package.json
CHANGED
package/types/Adaptor.d.ts
CHANGED
|
@@ -161,4 +161,4 @@ export function insertTable(tableName: string, columns: any[], options: object):
|
|
|
161
161
|
* @returns {Operation}
|
|
162
162
|
*/
|
|
163
163
|
export function modifyTable(tableName: string, columns: any[], options: object): Operation;
|
|
164
|
-
export { alterState, combine, dataPath, dataValue, dateFns, each, field, fields, fn, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|
|
164
|
+
export { alterState, combine, dataPath, dataValue, dateFns, each, field, fields, fn, http, lastReferenceValue, cursor, merge, sourceValue } from "@openfn/language-common";
|