@openfn/language-mysql 1.3.0 → 1.3.2

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 CHANGED
@@ -19,9 +19,8 @@
19
19
  "description": "upsertMany(\n 'users', // the DB table\n [\n { name: 'one', email: 'one@openfn.org' },\n { name: 'two', email: 'two@openfn.org' },\n ]\n)"
20
20
  },
21
21
  {
22
- "title": "constructor",
22
+ "title": "function",
23
23
  "description": null,
24
- "type": null,
25
24
  "name": null
26
25
  },
27
26
  {
@@ -6,33 +6,48 @@
6
6
  "type": "string",
7
7
  "description": "The database instance host URL",
8
8
  "format": "uri",
9
- "minLength": 1
9
+ "minLength": 1,
10
+ "examples": [
11
+ "some-host-url.compute-1.amazonaws.com"
12
+ ]
10
13
  },
11
14
  "port": {
12
15
  "title": "Port",
13
16
  "type": "integer",
14
17
  "default": 3306,
15
18
  "description": "Database instance port",
16
- "minLength": 1
19
+ "minLength": 1,
20
+ "examples": [
21
+ 3306
22
+ ]
17
23
  },
18
24
  "database": {
19
25
  "title": "Database",
20
26
  "type": "string",
21
27
  "description": "The database name",
22
- "minLength": 1
28
+ "minLength": 1,
29
+ "examples": [
30
+ "demo-db"
31
+ ]
23
32
  },
24
33
  "user": {
25
34
  "title": "Username",
26
35
  "type": "string",
27
36
  "description": "The username to log in the database",
28
- "minLength": 1
37
+ "minLength": 1,
38
+ "examples": [
39
+ "admin-demo"
40
+ ]
29
41
  },
30
42
  "password": {
31
43
  "title": "Password",
32
44
  "type": "string",
33
45
  "description": "The password to log in the database",
34
46
  "writeOnly": true,
35
- "minLength": 1
47
+ "minLength": 1,
48
+ "examples": [
49
+ "@super(!)Secretpass"
50
+ ]
36
51
  }
37
52
  },
38
53
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-mysql",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "A MySQL Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "main": "dist/index.cjs",
@@ -1,4 +1,3 @@
1
- /** @module Adaptor */
2
1
  /**
3
2
  * Execute a sequence of operations.
4
3
  * Wraps `language-common/execute`, and prepends initial state for mysql.
@@ -7,27 +6,11 @@
7
6
  * create('foo'),
8
7
  * delete('bar')
9
8
  * )(state)
10
- * @constructor
9
+ * @function
11
10
  * @param {Operations} operations - Operations to be performed.
12
11
  * @returns {Operation}
13
12
  */
14
13
  export function execute(...operations: Operations): Operation;
15
- export class execute {
16
- /** @module Adaptor */
17
- /**
18
- * Execute a sequence of operations.
19
- * Wraps `language-common/execute`, and prepends initial state for mysql.
20
- * @example
21
- * execute(
22
- * create('foo'),
23
- * delete('bar')
24
- * )(state)
25
- * @constructor
26
- * @param {Operations} operations - Operations to be performed.
27
- * @returns {Operation}
28
- */
29
- constructor(...operations: Operations);
30
- }
31
14
  /**
32
15
  * Insert a record
33
16
  * @example
@@ -36,28 +19,12 @@ export class execute {
36
19
  * field('name', dataValue('name'))
37
20
  * ))
38
21
  * )(state)
39
- * @constructor
22
+ * @function
40
23
  * @param {string} table - The target table
41
24
  * @param {object} fields - A fields object
42
25
  * @returns {Operation}
43
26
  */
44
27
  export function insert(table: string, fields: object): Operation;
45
- export class insert {
46
- /**
47
- * Insert a record
48
- * @example
49
- * execute(
50
- * insert('table', fields(
51
- * field('name', dataValue('name'))
52
- * ))
53
- * )(state)
54
- * @constructor
55
- * @param {string} table - The target table
56
- * @param {object} fields - A fields object
57
- * @returns {Operation}
58
- */
59
- constructor(table: string, fields: object);
60
- }
61
28
  /**
62
29
  * Insert or Update a record if matched
63
30
  * @example
@@ -66,28 +33,12 @@ export class insert {
66
33
  * field('name', dataValue('name'))
67
34
  * ))
68
35
  * )(state)
69
- * @constructor
36
+ * @function
70
37
  * @param {string} table - The target table
71
38
  * @param {object} fields - A fields object
72
39
  * @returns {Operation}
73
40
  */
74
41
  export function upsert(table: string, fields: object): Operation;
75
- export class upsert {
76
- /**
77
- * Insert or Update a record if matched
78
- * @example
79
- * execute(
80
- * upsert('table', fields(
81
- * field('name', dataValue('name'))
82
- * ))
83
- * )(state)
84
- * @constructor
85
- * @param {string} table - The target table
86
- * @param {object} fields - A fields object
87
- * @returns {Operation}
88
- */
89
- constructor(table: string, fields: object);
90
- }
91
42
  /**
92
43
  * Insert or update multiple records using ON DUPLICATE KEY
93
44
  * @public
@@ -99,76 +50,31 @@ export class upsert {
99
50
  * { name: 'two', email: 'two@openfn.org' },
100
51
  * ]
101
52
  * )
102
- * @constructor
53
+ * @function
103
54
  * @param {string} table - The target table
104
55
  * @param {array} data - An array of objects or a function that returns an array
105
56
  * @returns {Operation}
106
57
  */
107
58
  export function upsertMany(table: string, data: any[]): Operation;
108
- export class upsertMany {
109
- /**
110
- * Insert or update multiple records using ON DUPLICATE KEY
111
- * @public
112
- * @example
113
- * upsertMany(
114
- * 'users', // the DB table
115
- * [
116
- * { name: 'one', email: 'one@openfn.org' },
117
- * { name: 'two', email: 'two@openfn.org' },
118
- * ]
119
- * )
120
- * @constructor
121
- * @param {string} table - The target table
122
- * @param {array} data - An array of objects or a function that returns an array
123
- * @returns {Operation}
124
- */
125
- constructor(table: string, data: any[]);
126
- }
127
59
  /**
128
60
  * Execute a SQL statement
129
61
  * @example
130
62
  * execute(
131
63
  * query({ sql: 'select * from users;' })
132
64
  * )(state)
133
- * @constructor
65
+ * @function
134
66
  * @param {object} options - Payload data for the message
135
67
  * @returns {Operation}
136
68
  */
137
69
  export function query(options: object): Operation;
138
- export class query {
139
- /**
140
- * Execute a SQL statement
141
- * @example
142
- * execute(
143
- * query({ sql: 'select * from users;' })
144
- * )(state)
145
- * @constructor
146
- * @param {object} options - Payload data for the message
147
- * @returns {Operation}
148
- */
149
- constructor(options: object);
150
- }
151
70
  /**
152
71
  * Execute a SQL statement
153
72
  * @example
154
73
  * execute(
155
74
  * sqlString(state => "select * from items;")
156
75
  * )(state)
157
- * @constructor
76
+ * @function
158
77
  * @param {String} queryString - A query string (or function which takes state and returns a string)
159
78
  * @returns {Operation}
160
79
  */
161
80
  export function sqlString(queryString: string): Operation;
162
- export class sqlString {
163
- /**
164
- * Execute a SQL statement
165
- * @example
166
- * execute(
167
- * sqlString(state => "select * from items;")
168
- * )(state)
169
- * @constructor
170
- * @param {String} queryString - A query string (or function which takes state and returns a string)
171
- * @returns {Operation}
172
- */
173
- constructor(queryString: string);
174
- }