meadow-connection-mssql 1.0.21 → 1.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meadow-connection-mssql",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Meadow MSSQL Plugin",
5
5
  "main": "source/Meadow-Connection-MSSQL.js",
6
6
  "scripts": {
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Connection form schema for Microsoft SQL Server.
3
+ *
4
+ * Consumed by meadow-connection-manager#getProviderFormSchema('MSSQL').
5
+ * Pure data — safe to require() even when the mssql driver is not
6
+ * installed. See Meadow-Connection-MySQL-FormSchema.js for the field
7
+ * contract.
8
+ *
9
+ * MSSQL has reliability tuning that lives in nested keys under
10
+ * ConnectRetryOptions / DDLRetryOptions. The form exposes "initial
11
+ * delay" and "max delay" once each, but each value populates BOTH
12
+ * Connect and DDL retry buckets — that's why those fields use MapTo.
13
+ *
14
+ * Unit convention: timeouts and delays are entered in seconds in the UI
15
+ * but stored in milliseconds in the config blob; expressed via
16
+ * Multiplier: 1000.
17
+ */
18
+ 'use strict';
19
+
20
+ module.exports =
21
+ {
22
+ Provider: 'MSSQL',
23
+ DisplayName: 'MSSQL',
24
+ Description: 'Connect to a Microsoft SQL Server instance.',
25
+ Fields:
26
+ [
27
+ // ── Basic ──
28
+ { Name: 'server', Label: 'Server', Type: 'String', Default: '127.0.0.1', Required: true, Placeholder: '127.0.0.1' },
29
+ { Name: 'port', Label: 'Port', Type: 'Number', Default: 1433, Required: true, Min: 1, Max: 65535 },
30
+ { Name: 'user', Label: 'User', Type: 'String', Default: 'sa', Required: true },
31
+ { Name: 'password', Label: 'Password', Type: 'Password' },
32
+ { Name: 'database', Label: 'Database', Type: 'String', Placeholder: 'meadow_clone' },
33
+ { Name: 'connectionLimit', Label: 'Connection Limit', Type: 'Number', Default: 20, Min: 1, Group: 'Advanced' },
34
+ {
35
+ Name: 'LegacyPagination',
36
+ Label: 'Legacy pagination (SQL Server < 2012 / compat level < 110)',
37
+ Type: 'Boolean',
38
+ Help: 'Use ROW_NUMBER() instead of OFFSET/FETCH for older SQL Server versions.'
39
+ },
40
+
41
+ // ── Advanced: timeouts (entered as sec, stored as ms) ──
42
+ {
43
+ Name: 'RequestTimeoutMs',
44
+ Label: 'Request timeout (sec)',
45
+ Type: 'Number',
46
+ Default: 120,
47
+ Min: 1,
48
+ Multiplier: 1000,
49
+ OmitIfFalsy: true,
50
+ Group: 'Advanced'
51
+ },
52
+ {
53
+ Name: 'ConnectionTimeoutMs',
54
+ Label: 'Connection timeout (sec)',
55
+ Type: 'Number',
56
+ Default: 60,
57
+ Min: 1,
58
+ Multiplier: 1000,
59
+ OmitIfFalsy: true,
60
+ Group: 'Advanced'
61
+ },
62
+
63
+ // ── Advanced: retry buckets (Connect + DDL) ──
64
+ {
65
+ Name: 'ConnectRetryOptions.MaxAttempts',
66
+ Label: 'Connect retries (max attempts)',
67
+ Type: 'Number',
68
+ Default: 5,
69
+ Min: 1,
70
+ Max: 20,
71
+ OmitIfFalsy: true,
72
+ Group: 'Advanced'
73
+ },
74
+ {
75
+ Name: 'DDLRetryOptions.MaxAttempts',
76
+ Label: 'DDL retries (max attempts)',
77
+ Type: 'Number',
78
+ Default: 5,
79
+ Min: 1,
80
+ Max: 20,
81
+ OmitIfFalsy: true,
82
+ Group: 'Advanced'
83
+ },
84
+ {
85
+ // Same UI value populates BOTH buckets — DataCloner has done it
86
+ // this way since these timings should track each other. MapTo
87
+ // preserves that behavior declaratively.
88
+ Name: 'RetryInitialDelaySec',
89
+ Label: 'Retry initial delay (sec)',
90
+ Type: 'Number',
91
+ Default: 3,
92
+ Min: 1,
93
+ Max: 60,
94
+ Multiplier: 1000,
95
+ MapTo: [ 'ConnectRetryOptions.InitialDelayMs', 'DDLRetryOptions.InitialDelayMs' ],
96
+ OmitIfFalsy: true,
97
+ Group: 'Advanced'
98
+ },
99
+ {
100
+ Name: 'RetryMaxDelaySec',
101
+ Label: 'Retry max delay (sec)',
102
+ Type: 'Number',
103
+ Default: 30,
104
+ Min: 1,
105
+ Max: 600,
106
+ Multiplier: 1000,
107
+ MapTo: [ 'ConnectRetryOptions.MaxDelayMs', 'DDLRetryOptions.MaxDelayMs' ],
108
+ OmitIfFalsy: true,
109
+ Group: 'Advanced'
110
+ }
111
+ ]
112
+ };
@@ -148,7 +148,11 @@ class MeadowSchemaMSSQL extends libFableServiceProviderBase
148
148
  // previous VARCHAR(254) was inconsistent with later ALTER
149
149
  // migrations and caused every introspection-then-diff cycle
150
150
  // to re-alter the column.
151
- tmpCreateTableStatement += ` [${tmpColumn.Column}] NCHAR(${tmpColumn.Size || '36'}) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`;
151
+ //
152
+ // Default size is 255 — UUIDs need 36 but composite GUIDs
153
+ // from integration adapters often exceed that, and silent
154
+ // truncation manifests as missing rows downstream.
155
+ tmpCreateTableStatement += ` [${tmpColumn.Column}] NCHAR(${tmpColumn.Size || '255'}) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`;
152
156
  break;
153
157
  case 'ForeignKey':
154
158
  tmpCreateTableStatement += ` [${tmpColumn.Column}] INT NOT NULL DEFAULT 0`;