@macss/modular-api-sqlserver 0.5.0 → 0.7.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/README.md +4 -2
- package/dist/dbClient.d.ts +34 -1
- package/dist/dbClient.js +43 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -33,10 +33,12 @@ if (result.isSuccess) {
|
|
|
33
33
|
|
|
34
34
|
See [example/example.ts](example/example.ts) for a complete in-memory wiring sample.
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## What this package provides
|
|
37
37
|
|
|
38
38
|
- normalized SQL Server connection defaults and redacted summaries
|
|
39
39
|
- engine-agnostic `DbClient`, `DbRepository`, and transaction contracts
|
|
40
40
|
- explicit lease ownership semantics for package-owned and application-owned sessions
|
|
41
41
|
- health contributor and GraphQL support bundle for higher-level integrations
|
|
42
|
-
-
|
|
42
|
+
- the application supplies the driver binding (adapter) for its chosen engine and driver
|
|
43
|
+
|
|
44
|
+
This package is **contracts-only by design** and will never ship a driver binding; you choose your engine and driver and provide the adapter. See [ADR-0004](../../../docs/adr/0004-contracts-only-database-packages.md).
|
package/dist/dbClient.d.ts
CHANGED
|
@@ -2,7 +2,13 @@ export declare enum DbCommandKind {
|
|
|
2
2
|
query = "query",
|
|
3
3
|
execute = "execute",
|
|
4
4
|
batch = "batch",
|
|
5
|
-
scalar = "scalar"
|
|
5
|
+
scalar = "scalar",
|
|
6
|
+
procedure = "procedure"
|
|
7
|
+
}
|
|
8
|
+
export declare enum DbParameterDirection {
|
|
9
|
+
input = "input",
|
|
10
|
+
output = "output",
|
|
11
|
+
inputOutput = "inputOutput"
|
|
6
12
|
}
|
|
7
13
|
export declare enum DbFailureKind {
|
|
8
14
|
connectivity = "connectivity",
|
|
@@ -53,6 +59,29 @@ export declare class DbCommand {
|
|
|
53
59
|
label?: string;
|
|
54
60
|
});
|
|
55
61
|
}
|
|
62
|
+
export declare class DbParameter {
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly value: unknown;
|
|
65
|
+
readonly direction: DbParameterDirection;
|
|
66
|
+
readonly typeHint?: string;
|
|
67
|
+
constructor(options: {
|
|
68
|
+
name: string;
|
|
69
|
+
value?: unknown;
|
|
70
|
+
direction?: DbParameterDirection;
|
|
71
|
+
typeHint?: string;
|
|
72
|
+
});
|
|
73
|
+
static input(name: string, value: unknown, typeHint?: string): DbParameter;
|
|
74
|
+
static output(name: string, typeHint?: string): DbParameter;
|
|
75
|
+
static inputOutput(name: string, value: unknown, typeHint?: string): DbParameter;
|
|
76
|
+
}
|
|
77
|
+
export declare class DbProcedureOutcome {
|
|
78
|
+
readonly returnValue?: unknown;
|
|
79
|
+
readonly outputParameters?: Record<string, unknown>;
|
|
80
|
+
constructor(options: {
|
|
81
|
+
returnValue?: unknown;
|
|
82
|
+
outputParameters?: Record<string, unknown>;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
56
85
|
export declare class DbExecutionMetadata {
|
|
57
86
|
readonly duration: number;
|
|
58
87
|
readonly commandLabel?: string;
|
|
@@ -68,17 +97,21 @@ export declare class DbExecutionMetadata {
|
|
|
68
97
|
export declare class DbRowSet {
|
|
69
98
|
readonly rows: Array<Record<string, unknown>>;
|
|
70
99
|
readonly metadata: DbExecutionMetadata;
|
|
100
|
+
readonly procedure?: DbProcedureOutcome;
|
|
71
101
|
constructor(options: {
|
|
72
102
|
rows: Array<Record<string, unknown>>;
|
|
73
103
|
metadata: DbExecutionMetadata;
|
|
104
|
+
procedure?: DbProcedureOutcome;
|
|
74
105
|
});
|
|
75
106
|
}
|
|
76
107
|
export declare class DbExecutionSummary {
|
|
77
108
|
readonly affectedCount: number;
|
|
78
109
|
readonly metadata: DbExecutionMetadata;
|
|
110
|
+
readonly procedure?: DbProcedureOutcome;
|
|
79
111
|
constructor(options: {
|
|
80
112
|
affectedCount: number;
|
|
81
113
|
metadata: DbExecutionMetadata;
|
|
114
|
+
procedure?: DbProcedureOutcome;
|
|
82
115
|
});
|
|
83
116
|
}
|
|
84
117
|
export declare class DbScalar<T> {
|
package/dist/dbClient.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DbGraphqlSupport = exports.DbHealthContributor = exports.DbHealthReport = exports.DbClient = exports.DbRepository = exports.DbRepositoryContext = exports.DbTransactionContext = exports.DbSessionLease = exports.DbProviderDescription = exports.DbResult = exports.DbFailure = exports.DbScalar = exports.DbExecutionSummary = exports.DbRowSet = exports.DbExecutionMetadata = exports.DbCommand = exports.DbConnectionSettings = exports.DbHealthStatus = exports.DbFailureKind = exports.DbCommandKind = void 0;
|
|
3
|
+
exports.DbGraphqlSupport = exports.DbHealthContributor = exports.DbHealthReport = exports.DbClient = exports.DbRepository = exports.DbRepositoryContext = exports.DbTransactionContext = exports.DbSessionLease = exports.DbProviderDescription = exports.DbResult = exports.DbFailure = exports.DbScalar = exports.DbExecutionSummary = exports.DbRowSet = exports.DbExecutionMetadata = exports.DbProcedureOutcome = exports.DbParameter = exports.DbCommand = exports.DbConnectionSettings = exports.DbHealthStatus = exports.DbFailureKind = exports.DbParameterDirection = exports.DbCommandKind = void 0;
|
|
4
4
|
var DbCommandKind;
|
|
5
5
|
(function (DbCommandKind) {
|
|
6
6
|
DbCommandKind["query"] = "query";
|
|
7
7
|
DbCommandKind["execute"] = "execute";
|
|
8
8
|
DbCommandKind["batch"] = "batch";
|
|
9
9
|
DbCommandKind["scalar"] = "scalar";
|
|
10
|
+
DbCommandKind["procedure"] = "procedure";
|
|
10
11
|
})(DbCommandKind || (exports.DbCommandKind = DbCommandKind = {}));
|
|
12
|
+
var DbParameterDirection;
|
|
13
|
+
(function (DbParameterDirection) {
|
|
14
|
+
DbParameterDirection["input"] = "input";
|
|
15
|
+
DbParameterDirection["output"] = "output";
|
|
16
|
+
DbParameterDirection["inputOutput"] = "inputOutput";
|
|
17
|
+
})(DbParameterDirection || (exports.DbParameterDirection = DbParameterDirection = {}));
|
|
11
18
|
var DbFailureKind;
|
|
12
19
|
(function (DbFailureKind) {
|
|
13
20
|
DbFailureKind["connectivity"] = "connectivity";
|
|
@@ -75,6 +82,37 @@ class DbCommand {
|
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
84
|
exports.DbCommand = DbCommand;
|
|
85
|
+
class DbParameter {
|
|
86
|
+
name;
|
|
87
|
+
value;
|
|
88
|
+
direction;
|
|
89
|
+
typeHint;
|
|
90
|
+
constructor(options) {
|
|
91
|
+
this.name = options.name;
|
|
92
|
+
this.value = options.value;
|
|
93
|
+
this.direction = options.direction ?? DbParameterDirection.input;
|
|
94
|
+
this.typeHint = options.typeHint;
|
|
95
|
+
}
|
|
96
|
+
static input(name, value, typeHint) {
|
|
97
|
+
return new DbParameter({ name, value, direction: DbParameterDirection.input, typeHint });
|
|
98
|
+
}
|
|
99
|
+
static output(name, typeHint) {
|
|
100
|
+
return new DbParameter({ name, direction: DbParameterDirection.output, typeHint });
|
|
101
|
+
}
|
|
102
|
+
static inputOutput(name, value, typeHint) {
|
|
103
|
+
return new DbParameter({ name, value, direction: DbParameterDirection.inputOutput, typeHint });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.DbParameter = DbParameter;
|
|
107
|
+
class DbProcedureOutcome {
|
|
108
|
+
returnValue;
|
|
109
|
+
outputParameters;
|
|
110
|
+
constructor(options) {
|
|
111
|
+
this.returnValue = options.returnValue;
|
|
112
|
+
this.outputParameters = options.outputParameters;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.DbProcedureOutcome = DbProcedureOutcome;
|
|
78
116
|
class DbExecutionMetadata {
|
|
79
117
|
duration;
|
|
80
118
|
commandLabel;
|
|
@@ -91,18 +129,22 @@ exports.DbExecutionMetadata = DbExecutionMetadata;
|
|
|
91
129
|
class DbRowSet {
|
|
92
130
|
rows;
|
|
93
131
|
metadata;
|
|
132
|
+
procedure;
|
|
94
133
|
constructor(options) {
|
|
95
134
|
this.rows = [...options.rows];
|
|
96
135
|
this.metadata = options.metadata;
|
|
136
|
+
this.procedure = options.procedure;
|
|
97
137
|
}
|
|
98
138
|
}
|
|
99
139
|
exports.DbRowSet = DbRowSet;
|
|
100
140
|
class DbExecutionSummary {
|
|
101
141
|
affectedCount;
|
|
102
142
|
metadata;
|
|
143
|
+
procedure;
|
|
103
144
|
constructor(options) {
|
|
104
145
|
this.affectedCount = options.affectedCount;
|
|
105
146
|
this.metadata = options.metadata;
|
|
147
|
+
this.procedure = options.procedure;
|
|
106
148
|
}
|
|
107
149
|
}
|
|
108
150
|
exports.DbExecutionSummary = DbExecutionSummary;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macss/modular-api-sqlserver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Official MACSS SQL Server integration package for TypeScript.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc --project tsconfig.build.json",
|
|
14
14
|
"prepublishOnly": "npm run build",
|
|
15
|
-
"
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"test": "npm run typecheck && vitest run",
|
|
17
|
+
"test:unit": "vitest run"
|
|
16
18
|
},
|
|
17
19
|
"keywords": [
|
|
18
20
|
"macss",
|
|
@@ -35,4 +37,4 @@
|
|
|
35
37
|
"typescript": "^5.9.3",
|
|
36
38
|
"vitest": "^4.0.18"
|
|
37
39
|
}
|
|
38
|
-
}
|
|
40
|
+
}
|