tedious-fabric 1.0.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/CLAUDE.md +91 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/appveyor.yml +67 -0
- package/eslint.config.mjs +314 -0
- package/lib/all-headers.d.ts +2 -0
- package/lib/all-headers.js +24 -0
- package/lib/all-headers.js.map +1 -0
- package/lib/always-encrypted/aead-aes-256-cbc-hmac-algorithm.js +82 -0
- package/lib/always-encrypted/aead-aes-256-cbc-hmac-algorithm.js.map +1 -0
- package/lib/always-encrypted/aead-aes-256-cbc-hmac-encryption-key.js +55 -0
- package/lib/always-encrypted/aead-aes-256-cbc-hmac-encryption-key.js.map +1 -0
- package/lib/always-encrypted/cek-entry.d.ts +11 -0
- package/lib/always-encrypted/cek-entry.js +42 -0
- package/lib/always-encrypted/cek-entry.js.map +1 -0
- package/lib/always-encrypted/get-parameter-encryption-metadata.js +90 -0
- package/lib/always-encrypted/get-parameter-encryption-metadata.js.map +1 -0
- package/lib/always-encrypted/key-crypto.js +94 -0
- package/lib/always-encrypted/key-crypto.js.map +1 -0
- package/lib/always-encrypted/keystore-provider-azure-key-vault.d.ts +21 -0
- package/lib/always-encrypted/keystore-provider-azure-key-vault.js +247 -0
- package/lib/always-encrypted/keystore-provider-azure-key-vault.js.map +1 -0
- package/lib/always-encrypted/symmetric-key-cache.js +36 -0
- package/lib/always-encrypted/symmetric-key-cache.js.map +1 -0
- package/lib/always-encrypted/symmetric-key.js +25 -0
- package/lib/always-encrypted/symmetric-key.js.map +1 -0
- package/lib/always-encrypted/types.d.ts +73 -0
- package/lib/always-encrypted/types.js +61 -0
- package/lib/always-encrypted/types.js.map +1 -0
- package/lib/always-encrypted/utils.js +23 -0
- package/lib/always-encrypted/utils.js.map +1 -0
- package/lib/bulk-load-payload.d.ts +8 -0
- package/lib/bulk-load-payload.js +23 -0
- package/lib/bulk-load-payload.js.map +1 -0
- package/lib/bulk-load.d.ts +275 -0
- package/lib/bulk-load.js +515 -0
- package/lib/bulk-load.js.map +1 -0
- package/lib/collation.d.ts +28 -0
- package/lib/collation.js +348 -0
- package/lib/collation.js.map +1 -0
- package/lib/connection.d.ts +1309 -0
- package/lib/connection.js +2732 -0
- package/lib/connection.js.map +1 -0
- package/lib/connector.d.ts +18 -0
- package/lib/connector.js +142 -0
- package/lib/connector.js.map +1 -0
- package/lib/data-type.d.ts +554 -0
- package/lib/data-type.js +428 -0
- package/lib/data-type.js.map +1 -0
- package/lib/data-types/bigint.d.ts +3 -0
- package/lib/data-types/bigint.js +53 -0
- package/lib/data-types/bigint.js.map +1 -0
- package/lib/data-types/binary.d.ts +5 -0
- package/lib/data-types/binary.js +67 -0
- package/lib/data-types/binary.js.map +1 -0
- package/lib/data-types/bit.d.ts +3 -0
- package/lib/data-types/bit.js +46 -0
- package/lib/data-types/bit.js.map +1 -0
- package/lib/data-types/bitn.d.ts +3 -0
- package/lib/data-types/bitn.js +29 -0
- package/lib/data-types/bitn.js.map +1 -0
- package/lib/data-types/char.d.ts +5 -0
- package/lib/data-types/char.js +86 -0
- package/lib/data-types/char.js.map +1 -0
- package/lib/data-types/date.d.ts +3 -0
- package/lib/data-types/date.js +72 -0
- package/lib/data-types/date.js.map +1 -0
- package/lib/data-types/datetime.d.ts +3 -0
- package/lib/data-types/datetime.js +93 -0
- package/lib/data-types/datetime.js.map +1 -0
- package/lib/data-types/datetime2.d.ts +5 -0
- package/lib/data-types/datetime2.js +118 -0
- package/lib/data-types/datetime2.js.map +1 -0
- package/lib/data-types/datetimen.d.ts +3 -0
- package/lib/data-types/datetimen.js +29 -0
- package/lib/data-types/datetimen.js.map +1 -0
- package/lib/data-types/datetimeoffset.d.ts +5 -0
- package/lib/data-types/datetimeoffset.js +111 -0
- package/lib/data-types/datetimeoffset.js.map +1 -0
- package/lib/data-types/decimal.d.ts +6 -0
- package/lib/data-types/decimal.js +107 -0
- package/lib/data-types/decimal.js.map +1 -0
- package/lib/data-types/decimaln.d.ts +3 -0
- package/lib/data-types/decimaln.js +29 -0
- package/lib/data-types/decimaln.js.map +1 -0
- package/lib/data-types/float.d.ts +3 -0
- package/lib/data-types/float.js +47 -0
- package/lib/data-types/float.js.map +1 -0
- package/lib/data-types/floatn.d.ts +3 -0
- package/lib/data-types/floatn.js +29 -0
- package/lib/data-types/floatn.js.map +1 -0
- package/lib/data-types/image.d.ts +3 -0
- package/lib/data-types/image.js +56 -0
- package/lib/data-types/image.js.map +1 -0
- package/lib/data-types/int.d.ts +3 -0
- package/lib/data-types/int.js +53 -0
- package/lib/data-types/int.js.map +1 -0
- package/lib/data-types/intn.d.ts +3 -0
- package/lib/data-types/intn.js +29 -0
- package/lib/data-types/intn.js.map +1 -0
- package/lib/data-types/money.d.ts +3 -0
- package/lib/data-types/money.js +59 -0
- package/lib/data-types/money.js.map +1 -0
- package/lib/data-types/moneyn.d.ts +3 -0
- package/lib/data-types/moneyn.js +29 -0
- package/lib/data-types/moneyn.js.map +1 -0
- package/lib/data-types/nchar.d.ts +5 -0
- package/lib/data-types/nchar.js +100 -0
- package/lib/data-types/nchar.js.map +1 -0
- package/lib/data-types/ntext.d.ts +3 -0
- package/lib/data-types/ntext.js +60 -0
- package/lib/data-types/ntext.js.map +1 -0
- package/lib/data-types/null.d.ts +3 -0
- package/lib/data-types/null.js +29 -0
- package/lib/data-types/null.js.map +1 -0
- package/lib/data-types/numeric.d.ts +6 -0
- package/lib/data-types/numeric.js +106 -0
- package/lib/data-types/numeric.js.map +1 -0
- package/lib/data-types/numericn.d.ts +3 -0
- package/lib/data-types/numericn.js +29 -0
- package/lib/data-types/numericn.js.map +1 -0
- package/lib/data-types/nvarchar.d.ts +5 -0
- package/lib/data-types/nvarchar.js +133 -0
- package/lib/data-types/nvarchar.js.map +1 -0
- package/lib/data-types/real.d.ts +3 -0
- package/lib/data-types/real.js +48 -0
- package/lib/data-types/real.js.map +1 -0
- package/lib/data-types/smalldatetime.d.ts +3 -0
- package/lib/data-types/smalldatetime.js +83 -0
- package/lib/data-types/smalldatetime.js.map +1 -0
- package/lib/data-types/smallint.d.ts +3 -0
- package/lib/data-types/smallint.js +53 -0
- package/lib/data-types/smallint.js.map +1 -0
- package/lib/data-types/smallmoney.d.ts +3 -0
- package/lib/data-types/smallmoney.js +51 -0
- package/lib/data-types/smallmoney.js.map +1 -0
- package/lib/data-types/sql-variant.d.ts +3 -0
- package/lib/data-types/sql-variant.js +29 -0
- package/lib/data-types/sql-variant.js.map +1 -0
- package/lib/data-types/text.d.ts +3 -0
- package/lib/data-types/text.js +69 -0
- package/lib/data-types/text.js.map +1 -0
- package/lib/data-types/time.d.ts +3 -0
- package/lib/data-types/time.js +96 -0
- package/lib/data-types/time.js.map +1 -0
- package/lib/data-types/tinyint.d.ts +3 -0
- package/lib/data-types/tinyint.js +53 -0
- package/lib/data-types/tinyint.js.map +1 -0
- package/lib/data-types/tvp.d.ts +3 -0
- package/lib/data-types/tvp.js +117 -0
- package/lib/data-types/tvp.js.map +1 -0
- package/lib/data-types/udt.d.ts +3 -0
- package/lib/data-types/udt.js +29 -0
- package/lib/data-types/udt.js.map +1 -0
- package/lib/data-types/uniqueidentifier.d.ts +3 -0
- package/lib/data-types/uniqueidentifier.js +50 -0
- package/lib/data-types/uniqueidentifier.js.map +1 -0
- package/lib/data-types/varbinary.d.ts +5 -0
- package/lib/data-types/varbinary.js +119 -0
- package/lib/data-types/varbinary.js.map +1 -0
- package/lib/data-types/varchar.d.ts +5 -0
- package/lib/data-types/varchar.js +112 -0
- package/lib/data-types/varchar.js.map +1 -0
- package/lib/data-types/xml.d.ts +3 -0
- package/lib/data-types/xml.js +29 -0
- package/lib/data-types/xml.js.map +1 -0
- package/lib/debug.d.ts +25 -0
- package/lib/debug.js +66 -0
- package/lib/debug.js.map +1 -0
- package/lib/errors.d.ts +17 -0
- package/lib/errors.js +23 -0
- package/lib/errors.js.map +1 -0
- package/lib/guid-parser.d.ts +3 -0
- package/lib/guid-parser.js +30 -0
- package/lib/guid-parser.js.map +1 -0
- package/lib/incoming-message-stream.d.ts +19 -0
- package/lib/incoming-message-stream.js +97 -0
- package/lib/incoming-message-stream.js.map +1 -0
- package/lib/instance-lookup.d.ts +13 -0
- package/lib/instance-lookup.js +91 -0
- package/lib/instance-lookup.js.map +1 -0
- package/lib/library.d.ts +1 -0
- package/lib/library.js +8 -0
- package/lib/library.js.map +1 -0
- package/lib/login7-payload.d.ts +51 -0
- package/lib/login7-payload.js +408 -0
- package/lib/login7-payload.js.map +1 -0
- package/lib/message-io.d.ts +28 -0
- package/lib/message-io.js +152 -0
- package/lib/message-io.js.map +1 -0
- package/lib/message.d.ts +11 -0
- package/lib/message.js +21 -0
- package/lib/message.js.map +1 -0
- package/lib/metadata-parser.d.ts +48 -0
- package/lib/metadata-parser.js +380 -0
- package/lib/metadata-parser.js.map +1 -0
- package/lib/ntlm-payload.d.ts +23 -0
- package/lib/ntlm-payload.js +135 -0
- package/lib/ntlm-payload.js.map +1 -0
- package/lib/ntlm.d.ts +4 -0
- package/lib/ntlm.js +72 -0
- package/lib/ntlm.js.map +1 -0
- package/lib/outgoing-message-stream.d.ts +15 -0
- package/lib/outgoing-message-stream.js +81 -0
- package/lib/outgoing-message-stream.js.map +1 -0
- package/lib/packet.d.ts +33 -0
- package/lib/packet.js +191 -0
- package/lib/packet.js.map +1 -0
- package/lib/prelogin-payload.d.ts +67 -0
- package/lib/prelogin-payload.js +228 -0
- package/lib/prelogin-payload.js.map +1 -0
- package/lib/request.d.ts +370 -0
- package/lib/request.js +387 -0
- package/lib/request.js.map +1 -0
- package/lib/rpcrequest-payload.d.ts +16 -0
- package/lib/rpcrequest-payload.js +109 -0
- package/lib/rpcrequest-payload.js.map +1 -0
- package/lib/sender.d.ts +5 -0
- package/lib/sender.js +78 -0
- package/lib/sender.js.map +1 -0
- package/lib/special-stored-procedure.d.ts +18 -0
- package/lib/special-stored-procedure.js +26 -0
- package/lib/special-stored-procedure.js.map +1 -0
- package/lib/sqlbatch-payload.d.ts +13 -0
- package/lib/sqlbatch-payload.js +34 -0
- package/lib/sqlbatch-payload.js.map +1 -0
- package/lib/tds-versions.d.ts +6 -0
- package/lib/tds-versions.js +19 -0
- package/lib/tds-versions.js.map +1 -0
- package/lib/tedious.d.ts +13 -0
- package/lib/tedious.js +73 -0
- package/lib/tedious.js.map +1 -0
- package/lib/token/colmetadata-token-parser.d.ts +12 -0
- package/lib/token/colmetadata-token-parser.js +124 -0
- package/lib/token/colmetadata-token-parser.js.map +1 -0
- package/lib/token/done-token-parser.d.ts +6 -0
- package/lib/token/done-token-parser.js +76 -0
- package/lib/token/done-token-parser.js.map +1 -0
- package/lib/token/env-change-token-parser.d.ts +5 -0
- package/lib/token/env-change-token-parser.js +190 -0
- package/lib/token/env-change-token-parser.js.map +1 -0
- package/lib/token/feature-ext-ack-parser.d.ts +5 -0
- package/lib/token/feature-ext-ack-parser.js +52 -0
- package/lib/token/feature-ext-ack-parser.js.map +1 -0
- package/lib/token/fedauth-info-parser.d.ts +5 -0
- package/lib/token/fedauth-info-parser.js +62 -0
- package/lib/token/fedauth-info-parser.js.map +1 -0
- package/lib/token/handler.d.ts +136 -0
- package/lib/token/handler.js +445 -0
- package/lib/token/handler.js.map +1 -0
- package/lib/token/helpers.d.ts +28 -0
- package/lib/token/helpers.js +205 -0
- package/lib/token/helpers.js.map +1 -0
- package/lib/token/infoerror-token-parser.d.ts +5 -0
- package/lib/token/infoerror-token-parser.js +80 -0
- package/lib/token/infoerror-token-parser.js.map +1 -0
- package/lib/token/loginack-token-parser.d.ts +5 -0
- package/lib/token/loginack-token-parser.js +75 -0
- package/lib/token/loginack-token-parser.js.map +1 -0
- package/lib/token/nbcrow-token-parser.d.ts +4 -0
- package/lib/token/nbcrow-token-parser.js +103 -0
- package/lib/token/nbcrow-token-parser.js.map +1 -0
- package/lib/token/order-token-parser.d.ts +5 -0
- package/lib/token/order-token-parser.js +34 -0
- package/lib/token/order-token-parser.js.map +1 -0
- package/lib/token/returnstatus-token-parser.d.ts +5 -0
- package/lib/token/returnstatus-token-parser.js +21 -0
- package/lib/token/returnstatus-token-parser.js.map +1 -0
- package/lib/token/returnvalue-token-parser.d.ts +4 -0
- package/lib/token/returnvalue-token-parser.js +93 -0
- package/lib/token/returnvalue-token-parser.js.map +1 -0
- package/lib/token/row-token-parser.d.ts +4 -0
- package/lib/token/row-token-parser.js +76 -0
- package/lib/token/row-token-parser.js.map +1 -0
- package/lib/token/sspi-token-parser.d.ts +5 -0
- package/lib/token/sspi-token-parser.js +42 -0
- package/lib/token/sspi-token-parser.js.map +1 -0
- package/lib/token/stream-parser.d.ts +34 -0
- package/lib/token/stream-parser.js +341 -0
- package/lib/token/stream-parser.js.map +1 -0
- package/lib/token/token-stream-parser.d.ts +15 -0
- package/lib/token/token-stream-parser.js +36 -0
- package/lib/token/token-stream-parser.js.map +1 -0
- package/lib/token/token.d.ts +312 -0
- package/lib/token/token.js +328 -0
- package/lib/token/token.js.map +1 -0
- package/lib/tracking-buffer/writable-tracking-buffer.d.ts +47 -0
- package/lib/tracking-buffer/writable-tracking-buffer.js +249 -0
- package/lib/tracking-buffer/writable-tracking-buffer.js.map +1 -0
- package/lib/transaction.d.ts +39 -0
- package/lib/transaction.js +137 -0
- package/lib/transaction.js.map +1 -0
- package/lib/transient-error-lookup.d.ts +3 -0
- package/lib/transient-error-lookup.js +19 -0
- package/lib/transient-error-lookup.js.map +1 -0
- package/lib/value-parser.d.ts +7 -0
- package/lib/value-parser.js +813 -0
- package/lib/value-parser.js.map +1 -0
- package/package.json +145 -0
- package/pull_request_template.md +9 -0
- package/tsconfig.build-types.json +15 -0
- package/tsconfig.json +30 -0
- package/types/js-md4.d.ts +7 -0
- package/types/native-duplexpair.d.ts +12 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Tedious is a pure-JavaScript/TypeScript implementation of the TDS (Tabular Data Stream) protocol for connecting to Microsoft SQL Server databases. It supports TDS versions 7.1-7.4 (SQL Server 2000-2022).
|
|
8
|
+
|
|
9
|
+
## Common Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Build (compiles TypeScript via Babel to lib/)
|
|
13
|
+
npm run build
|
|
14
|
+
|
|
15
|
+
# Lint and type check
|
|
16
|
+
npm run lint
|
|
17
|
+
|
|
18
|
+
# Run unit tests
|
|
19
|
+
npm run test
|
|
20
|
+
|
|
21
|
+
# Run a single test file
|
|
22
|
+
npx mocha test/unit/<test-file>.ts
|
|
23
|
+
|
|
24
|
+
# Run a single test by name
|
|
25
|
+
npx mocha test/unit/ --grep "test name pattern"
|
|
26
|
+
|
|
27
|
+
# Run integration tests (requires SQL Server)
|
|
28
|
+
npm run test-integration
|
|
29
|
+
|
|
30
|
+
# Run all tests
|
|
31
|
+
npm run test-all
|
|
32
|
+
|
|
33
|
+
# Generate documentation
|
|
34
|
+
npm run docs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Integration Tests Setup
|
|
38
|
+
|
|
39
|
+
Integration tests require a SQL Server instance. Use the dev container or start SQL Server manually:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Using docker-compose (from .devcontainer/)
|
|
43
|
+
docker-compose -f .devcontainer/docker-compose.yml up -d mssql
|
|
44
|
+
|
|
45
|
+
# Default connection: server=mssql (or localhost), user=sa, password=yourStrong(!)Password
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Test configuration is in `test/config.ts`. CI uses `test/config.ci.ts`.
|
|
49
|
+
|
|
50
|
+
## Architecture
|
|
51
|
+
|
|
52
|
+
### Core Classes
|
|
53
|
+
|
|
54
|
+
- **`src/connection.ts`** - Main `Connection` class managing TDS protocol handshake, authentication, state machine, and request queuing. This is the primary entry point (~3,600 lines).
|
|
55
|
+
- **`src/request.ts`** - `Request` class representing SQL queries/commands with parameters and callbacks.
|
|
56
|
+
- **`src/bulk-load.ts`** - `BulkLoad` class for bulk data loading operations.
|
|
57
|
+
|
|
58
|
+
### TDS Protocol Implementation
|
|
59
|
+
|
|
60
|
+
- **`src/message-io.ts`** - Message encoding/decoding for TDS protocol
|
|
61
|
+
- **`src/packet.ts`** - TDS packet structure and constants
|
|
62
|
+
- **`src/prelogin-payload.ts`** - Pre-login negotiation
|
|
63
|
+
- **`src/login7-payload.ts`** - SQL Server login mechanism
|
|
64
|
+
- **`src/sqlbatch-payload.ts`** - SQL batch execution
|
|
65
|
+
- **`src/rpcrequest-payload.ts`** - RPC/stored procedure calls
|
|
66
|
+
|
|
67
|
+
### Token Parsers (`src/token/`)
|
|
68
|
+
|
|
69
|
+
~20 parsers for TDS protocol response tokens (COLMETADATA, ROW, DONE, ERROR, INFO, LOGINACK, etc.). Each parser handles a specific token type from the server response stream.
|
|
70
|
+
|
|
71
|
+
### Data Types (`src/data-types/`)
|
|
72
|
+
|
|
73
|
+
41 SQL Server data type implementations (int, varchar, datetime, money, xml, etc.). Each file exports a `DataType` object with `name`, `id`, `declaration`, `generateTypeInfo`, `generateParameterLength`, `generateParameterData`, and `validate` methods.
|
|
74
|
+
|
|
75
|
+
### Always Encrypted (`src/always-encrypted/`)
|
|
76
|
+
|
|
77
|
+
Column-level encryption support with Azure Key Vault integration for encrypted column data.
|
|
78
|
+
|
|
79
|
+
## Key Patterns
|
|
80
|
+
|
|
81
|
+
- **Event-driven async**: Connection emits events (`connect`, `end`, `error`, `infoMessage`, `errorMessage`, `debug`)
|
|
82
|
+
- **State machine**: Connection maintains internal state for TDS protocol handshake
|
|
83
|
+
- **Streaming**: Token parsers process response streams incrementally
|
|
84
|
+
- **Buffer management**: `src/tracking-buffer/` handles binary data serialization
|
|
85
|
+
|
|
86
|
+
## TypeScript Configuration
|
|
87
|
+
|
|
88
|
+
- Strict mode enabled with ES2022 target
|
|
89
|
+
- Babel transpiles to `lib/` directory
|
|
90
|
+
- Type declarations generated separately via `tsconfig.build-types.json`
|
|
91
|
+
- Node.js >=18.17 required
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2018 Mike D Pilsbury
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Tedious (node implementation of TDS)
|
|
2
|
+
[](http://badge.fury.io/js/tedious) [](https://ci.appveyor.com/project/tediousjs/tedious) [](https://codecov.io/gh/tediousjs/tedious)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Tedious is a pure-Javascript implementation of the [TDS protocol](http://msdn.microsoft.com/en-us/library/dd304523.aspx),
|
|
6
|
+
which is used to interact with instances of Microsoft's SQL Server. It is intended to be a fairly slim implementation of the protocol, with not too much additional functionality.
|
|
7
|
+
|
|
8
|
+
**NOTE: New columns are nullable by default as of version 1.11.0**
|
|
9
|
+
|
|
10
|
+
Previous behavior can be restored using `config.options.enableAnsiNullDefault = false`. See [pull request 230](https://github.com/tediousjs/tedious/pull/230).
|
|
11
|
+
|
|
12
|
+
**NOTE: Default login behavior has changed slightly as of version 1.2**
|
|
13
|
+
|
|
14
|
+
See the [changelog](https://github.com/tediousjs/tedious/releases) for version history.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Supported TDS versions
|
|
18
|
+
|
|
19
|
+
- TDS 7.4 (SQL Server 2012/2014/2016/2017/2019/2022)
|
|
20
|
+
- TDS 7.3.B (SQL Server 2008 R2)
|
|
21
|
+
- TDS 7.3.A (SQL Server 2008)
|
|
22
|
+
- TDS 7.2 (SQL Server 2005)
|
|
23
|
+
- TDS 7.1 (SQL Server 2000)
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Node.js is a prerequisite for installing tedious. Once you have installed [Node.js](https://nodejs.org/), installing tedious is simple:
|
|
28
|
+
|
|
29
|
+
npm install tedious
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
- [Node.js + macOS](https://www.microsoft.com/en-us/sql-server/developer-get-started/node/mac/)
|
|
33
|
+
- [Node.js + Red Hat Enterprise Linux](https://www.microsoft.com/en-us/sql-server/developer-get-started/node/rhel/)
|
|
34
|
+
- [Node.js + SUSE Linux Enterprise Server](https://www.microsoft.com/en-us/sql-server/developer-get-started/node/sles/)
|
|
35
|
+
- [Node.js + Ubuntu](https://www.microsoft.com/en-us/sql-server/developer-get-started/node/ubuntu/)
|
|
36
|
+
- [Node.js + Windows](https://www.microsoft.com/en-us/sql-server/developer-get-started/node/windows/)
|
|
37
|
+
|
|
38
|
+
<a name="documentation"></a>
|
|
39
|
+
## Documentation
|
|
40
|
+
More documentation and code samples are available at [tediousjs.github.io/tedious/](http://tediousjs.github.io/tedious/)
|
|
41
|
+
|
|
42
|
+
<a name="name"></a>
|
|
43
|
+
## Name
|
|
44
|
+
_Tedious_ is simply derived from a fast, slightly garbled, pronunciation of the letters T, D and S.
|
|
45
|
+
|
|
46
|
+
## Developer Survey
|
|
47
|
+
|
|
48
|
+
We'd like to learn more about how you use tedious:
|
|
49
|
+
|
|
50
|
+
<a href="https://aka.ms/mssqltedioussurvey"><img style="float: right;" height="67" width="156" src="https://sqlchoice.blob.core.windows.net/sqlchoice/static/images/survey.png"></a>
|
|
51
|
+
|
|
52
|
+
<a name="contributing"></a>
|
|
53
|
+
## Contributing
|
|
54
|
+
We welcome contributions from the community. Feel free to checkout the code and submit pull requests.
|
|
55
|
+
|
|
56
|
+
<a name="license"></a>
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
Copyright (c) 2010-2021 Mike D Pilsbury
|
|
60
|
+
|
|
61
|
+
The MIT License
|
|
62
|
+
|
|
63
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
64
|
+
|
|
65
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/appveyor.yml
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
version: "{build}"
|
|
2
|
+
|
|
3
|
+
environment:
|
|
4
|
+
matrix:
|
|
5
|
+
- nodejs_version: "18"
|
|
6
|
+
- nodejs_version: "20"
|
|
7
|
+
- nodejs_version: "21"
|
|
8
|
+
|
|
9
|
+
branches:
|
|
10
|
+
only:
|
|
11
|
+
- master
|
|
12
|
+
- /^maint\/.+/
|
|
13
|
+
- /v\d+\.\d+\.\d+/
|
|
14
|
+
|
|
15
|
+
install:
|
|
16
|
+
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
|
|
17
|
+
- npm install
|
|
18
|
+
|
|
19
|
+
services:
|
|
20
|
+
- mssql2017
|
|
21
|
+
|
|
22
|
+
cache:
|
|
23
|
+
- node_modules
|
|
24
|
+
|
|
25
|
+
build: off
|
|
26
|
+
|
|
27
|
+
before_test:
|
|
28
|
+
- npm prune
|
|
29
|
+
|
|
30
|
+
- sc config sqlbrowser start= auto
|
|
31
|
+
- net start sqlbrowser
|
|
32
|
+
|
|
33
|
+
test_script:
|
|
34
|
+
- node --version
|
|
35
|
+
- npm --version
|
|
36
|
+
|
|
37
|
+
- pwsh: |-
|
|
38
|
+
$ErrorActionPreference = "Stop"
|
|
39
|
+
|
|
40
|
+
npm run-script test
|
|
41
|
+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
42
|
+
|
|
43
|
+
Copy-Item -Force test/config.appveyor.ts test/config.ts
|
|
44
|
+
|
|
45
|
+
$env:NTLM_USERNAME = $env:USERNAME
|
|
46
|
+
$env:NTLM_PASSWORD = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", '')
|
|
47
|
+
$env:NTLM_DOMAIN = $env:COMPUTERNAME
|
|
48
|
+
|
|
49
|
+
$env:TEDIOUS_TDS_VERSION = '7_4'
|
|
50
|
+
npm run-script test-integration
|
|
51
|
+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
52
|
+
|
|
53
|
+
$env:TEDIOUS_TDS_VERSION = '7_3_B'
|
|
54
|
+
npm run-script test-integration
|
|
55
|
+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
56
|
+
|
|
57
|
+
$env:TEDIOUS_TDS_VERSION = '7_3_A'
|
|
58
|
+
npm run-script test-integration
|
|
59
|
+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
60
|
+
|
|
61
|
+
$env:TEDIOUS_TDS_VERSION = '7_2'
|
|
62
|
+
npm run-script test-integration
|
|
63
|
+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
64
|
+
|
|
65
|
+
$env:TEDIOUS_TDS_VERSION = '7_1'
|
|
66
|
+
npm run-script test-integration
|
|
67
|
+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
2
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import tsParser from '@typescript-eslint/parser';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import js from '@eslint/js';
|
|
9
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
const compat = new FlatCompat({
|
|
14
|
+
baseDirectory: __dirname,
|
|
15
|
+
recommendedConfig: js.configs.recommended,
|
|
16
|
+
allConfig: js.configs.all
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['src/**/*.d.ts']),
|
|
21
|
+
{
|
|
22
|
+
extends: compat.extends('plugin:@typescript-eslint/eslint-recommended'),
|
|
23
|
+
|
|
24
|
+
plugins: {
|
|
25
|
+
'@typescript-eslint': typescriptEslint,
|
|
26
|
+
'@stylelistic': stylistic,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
languageOptions: {
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.node,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
parser: tsParser,
|
|
35
|
+
ecmaVersion: 5,
|
|
36
|
+
sourceType: 'module',
|
|
37
|
+
|
|
38
|
+
parserOptions: {
|
|
39
|
+
project: './tsconfig.json',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
rules: {
|
|
44
|
+
'accessor-pairs': 'error',
|
|
45
|
+
'array-callback-return': 'error',
|
|
46
|
+
'arrow-parens': ['error', 'always'],
|
|
47
|
+
|
|
48
|
+
'arrow-spacing': ['error', {
|
|
49
|
+
before: true,
|
|
50
|
+
after: true,
|
|
51
|
+
}],
|
|
52
|
+
|
|
53
|
+
'block-spacing': 'error',
|
|
54
|
+
|
|
55
|
+
'brace-style': ['error', '1tbs', {
|
|
56
|
+
allowSingleLine: true,
|
|
57
|
+
}],
|
|
58
|
+
|
|
59
|
+
'comma-dangle': ['error', 'only-multiline'],
|
|
60
|
+
'comma-spacing': 'error',
|
|
61
|
+
'comma-style': 'error',
|
|
62
|
+
'computed-property-spacing': 'error',
|
|
63
|
+
'constructor-super': 'error',
|
|
64
|
+
'dot-location': ['error', 'property'],
|
|
65
|
+
'dot-notation': 'error',
|
|
66
|
+
'eol-last': 'error',
|
|
67
|
+
'eqeqeq': ['error', 'smart'],
|
|
68
|
+
'for-direction': 'error',
|
|
69
|
+
'func-call-spacing': 'error',
|
|
70
|
+
'func-name-matching': 'error',
|
|
71
|
+
|
|
72
|
+
'func-style': ['error', 'declaration', {
|
|
73
|
+
allowArrowFunctions: true,
|
|
74
|
+
}],
|
|
75
|
+
|
|
76
|
+
'indent': ['error', 2, {
|
|
77
|
+
ArrayExpression: 'first',
|
|
78
|
+
|
|
79
|
+
CallExpression: {
|
|
80
|
+
arguments: 'first',
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
FunctionDeclaration: {
|
|
84
|
+
parameters: 'first',
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
FunctionExpression: {
|
|
88
|
+
parameters: 'first',
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
MemberExpression: 'off',
|
|
92
|
+
ObjectExpression: 'first',
|
|
93
|
+
SwitchCase: 1,
|
|
94
|
+
}],
|
|
95
|
+
|
|
96
|
+
'key-spacing': ['error', {
|
|
97
|
+
mode: 'strict',
|
|
98
|
+
}],
|
|
99
|
+
|
|
100
|
+
'keyword-spacing': 'error',
|
|
101
|
+
'linebreak-style': ['error', 'unix'],
|
|
102
|
+
'new-parens': 'error',
|
|
103
|
+
'no-class-assign': 'error',
|
|
104
|
+
'no-confusing-arrow': 'error',
|
|
105
|
+
'no-const-assign': 'error',
|
|
106
|
+
'no-control-regex': 'error',
|
|
107
|
+
'no-debugger': 'error',
|
|
108
|
+
'no-delete-var': 'error',
|
|
109
|
+
'no-dupe-args': 'error',
|
|
110
|
+
'no-dupe-keys': 'error',
|
|
111
|
+
'no-duplicate-case': 'error',
|
|
112
|
+
'no-duplicate-imports': 'error',
|
|
113
|
+
'no-empty-character-class': 'error',
|
|
114
|
+
'no-ex-assign': 'error',
|
|
115
|
+
'no-extra-boolean-cast': 'error',
|
|
116
|
+
'no-extra-parens': ['error', 'functions'],
|
|
117
|
+
'no-extra-semi': 'error',
|
|
118
|
+
'no-fallthrough': 'error',
|
|
119
|
+
'no-func-assign': 'error',
|
|
120
|
+
'no-global-assign': 'error',
|
|
121
|
+
'no-invalid-regexp': 'error',
|
|
122
|
+
'no-irregular-whitespace': 'error',
|
|
123
|
+
'no-lonely-if': 'error',
|
|
124
|
+
'no-misleading-character-class': 'error',
|
|
125
|
+
'no-mixed-requires': 'error',
|
|
126
|
+
'no-mixed-spaces-and-tabs': 'error',
|
|
127
|
+
|
|
128
|
+
'no-multi-spaces': ['error', {
|
|
129
|
+
ignoreEOLComments: true,
|
|
130
|
+
}],
|
|
131
|
+
|
|
132
|
+
'no-multiple-empty-lines': ['error', {
|
|
133
|
+
max: 2,
|
|
134
|
+
maxEOF: 0,
|
|
135
|
+
maxBOF: 0,
|
|
136
|
+
}],
|
|
137
|
+
|
|
138
|
+
'no-negated-in-lhs': 'error',
|
|
139
|
+
'no-new-require': 'error',
|
|
140
|
+
'no-new-symbol': 'error',
|
|
141
|
+
'no-obj-calls': 'error',
|
|
142
|
+
'no-octal': 'error',
|
|
143
|
+
'no-path-concat': 'error',
|
|
144
|
+
'no-proto': 'error',
|
|
145
|
+
'no-redeclare': 'error',
|
|
146
|
+
'no-restricted-modules': ['error', 'sys'],
|
|
147
|
+
|
|
148
|
+
'no-restricted-syntax': ['error', {
|
|
149
|
+
selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]",
|
|
150
|
+
message: '`setTimeout()` must be invoked with at least two arguments.',
|
|
151
|
+
}, {
|
|
152
|
+
selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
|
|
153
|
+
message: '`setInterval()` must be invoked with at least two arguments.',
|
|
154
|
+
}, {
|
|
155
|
+
selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]',
|
|
156
|
+
message: 'Use `new` keyword when throwing an `Error`.',
|
|
157
|
+
}],
|
|
158
|
+
|
|
159
|
+
'no-return-await': 'off',
|
|
160
|
+
'no-self-assign': 'error',
|
|
161
|
+
'no-self-compare': 'error',
|
|
162
|
+
'no-tabs': 'error',
|
|
163
|
+
'no-template-curly-in-string': 'error',
|
|
164
|
+
'no-this-before-super': 'error',
|
|
165
|
+
'no-throw-literal': 'error',
|
|
166
|
+
'no-trailing-spaces': 2,
|
|
167
|
+
'no-undef-init': 'error',
|
|
168
|
+
'no-unexpected-multiline': 2,
|
|
169
|
+
'no-unreachable': 'error',
|
|
170
|
+
'no-unsafe-finally': 'error',
|
|
171
|
+
'no-unsafe-negation': 'error',
|
|
172
|
+
'no-unused-labels': 'error',
|
|
173
|
+
|
|
174
|
+
'no-unused-vars': ['error', {
|
|
175
|
+
args: 'none',
|
|
176
|
+
caughtErrors: 'all',
|
|
177
|
+
}],
|
|
178
|
+
|
|
179
|
+
'no-use-before-define': ['error', {
|
|
180
|
+
classes: true,
|
|
181
|
+
functions: false,
|
|
182
|
+
variables: false,
|
|
183
|
+
}],
|
|
184
|
+
|
|
185
|
+
'no-useless-call': 'error',
|
|
186
|
+
'no-useless-catch': 'error',
|
|
187
|
+
'no-useless-concat': 'error',
|
|
188
|
+
'no-useless-constructor': 'error',
|
|
189
|
+
'no-useless-escape': 'error',
|
|
190
|
+
'no-useless-return': 'error',
|
|
191
|
+
'no-void': 'error',
|
|
192
|
+
'no-whitespace-before-property': 'error',
|
|
193
|
+
'no-with': 'error',
|
|
194
|
+
'object-curly-spacing': ['error', 'always'],
|
|
195
|
+
|
|
196
|
+
'one-var': ['error', {
|
|
197
|
+
initialized: 'never',
|
|
198
|
+
}],
|
|
199
|
+
|
|
200
|
+
'one-var-declaration-per-line': 'error',
|
|
201
|
+
'operator-linebreak': ['error', 'after'],
|
|
202
|
+
|
|
203
|
+
'prefer-const': ['error', {
|
|
204
|
+
ignoreReadBeforeAssign: true,
|
|
205
|
+
}],
|
|
206
|
+
|
|
207
|
+
'quotes': ['error', 'single', {
|
|
208
|
+
avoidEscape: true,
|
|
209
|
+
}],
|
|
210
|
+
|
|
211
|
+
'quote-props': ['error', 'consistent'],
|
|
212
|
+
'rest-spread-spacing': 'error',
|
|
213
|
+
'semi': 'error',
|
|
214
|
+
'semi-spacing': 'error',
|
|
215
|
+
'space-before-blocks': ['error', 'always'],
|
|
216
|
+
|
|
217
|
+
'space-before-function-paren': ['error', {
|
|
218
|
+
anonymous: 'never',
|
|
219
|
+
named: 'never',
|
|
220
|
+
asyncArrow: 'always',
|
|
221
|
+
}],
|
|
222
|
+
|
|
223
|
+
'space-in-parens': ['error', 'never'],
|
|
224
|
+
'space-infix-ops': 'error',
|
|
225
|
+
'space-unary-ops': 'error',
|
|
226
|
+
|
|
227
|
+
'spaced-comment': ['error', 'always', {
|
|
228
|
+
block: {
|
|
229
|
+
balanced: true,
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
exceptions: ['-'],
|
|
233
|
+
}],
|
|
234
|
+
|
|
235
|
+
'symbol-description': 'error',
|
|
236
|
+
'template-curly-spacing': 'error',
|
|
237
|
+
'unicode-bom': 'error',
|
|
238
|
+
'use-isnan': 'error',
|
|
239
|
+
'valid-typeof': 'error',
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
files: ['**/*.ts'],
|
|
244
|
+
|
|
245
|
+
rules: {
|
|
246
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
247
|
+
'@typescript-eslint/ban-ts-comment': 'error',
|
|
248
|
+
|
|
249
|
+
'@typescript-eslint/no-empty-object-type': 'error',
|
|
250
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
251
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
252
|
+
|
|
253
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
254
|
+
|
|
255
|
+
'@stylelistic/member-delimiter-style': ['error', {
|
|
256
|
+
multiline: {
|
|
257
|
+
delimiter: 'semi',
|
|
258
|
+
requireLast: true,
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
singleline: {
|
|
262
|
+
delimiter: 'comma',
|
|
263
|
+
requireLast: false,
|
|
264
|
+
},
|
|
265
|
+
}],
|
|
266
|
+
|
|
267
|
+
'no-array-constructor': 'off',
|
|
268
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
269
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
270
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
271
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
272
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
273
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
274
|
+
|
|
275
|
+
'@typescript-eslint/no-this-alias': ['error', {
|
|
276
|
+
allowDestructuring: true,
|
|
277
|
+
allowedNames: ['self'],
|
|
278
|
+
}],
|
|
279
|
+
|
|
280
|
+
'no-unused-vars': 'off',
|
|
281
|
+
|
|
282
|
+
'@typescript-eslint/no-unused-vars': ['error', {
|
|
283
|
+
args: 'none',
|
|
284
|
+
caughtErrors: 'all',
|
|
285
|
+
}],
|
|
286
|
+
|
|
287
|
+
'no-use-before-define': 'off',
|
|
288
|
+
|
|
289
|
+
'@typescript-eslint/no-use-before-define': ['error', {
|
|
290
|
+
classes: true,
|
|
291
|
+
functions: false,
|
|
292
|
+
variables: false,
|
|
293
|
+
}],
|
|
294
|
+
|
|
295
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
296
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
297
|
+
'@typescript-eslint/triple-slash-reference': 'error',
|
|
298
|
+
'@stylelistic/type-annotation-spacing': 'error',
|
|
299
|
+
'@typescript-eslint/return-await': ['error', 'always'],
|
|
300
|
+
'no-var': 'error',
|
|
301
|
+
'prefer-const': 'error',
|
|
302
|
+
'prefer-rest-params': 'error',
|
|
303
|
+
'prefer-spread': 'error',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
files: ['test/**/*'],
|
|
308
|
+
languageOptions: {
|
|
309
|
+
globals: {
|
|
310
|
+
...globals.mocha,
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
}
|
|
314
|
+
]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.writeToTrackingBuffer = writeToTrackingBuffer;
|
|
7
|
+
const TYPE = {
|
|
8
|
+
QUERY_NOTIFICATIONS: 1,
|
|
9
|
+
TXN_DESCRIPTOR: 2,
|
|
10
|
+
TRACE_ACTIVITY: 3
|
|
11
|
+
};
|
|
12
|
+
const TXNDESCRIPTOR_HEADER_DATA_LEN = 4 + 8;
|
|
13
|
+
const TXNDESCRIPTOR_HEADER_LEN = 4 + 2 + TXNDESCRIPTOR_HEADER_DATA_LEN;
|
|
14
|
+
function writeToTrackingBuffer(buffer, txnDescriptor, outstandingRequestCount) {
|
|
15
|
+
buffer.writeUInt32LE(0);
|
|
16
|
+
buffer.writeUInt32LE(TXNDESCRIPTOR_HEADER_LEN);
|
|
17
|
+
buffer.writeUInt16LE(TYPE.TXN_DESCRIPTOR);
|
|
18
|
+
buffer.writeBuffer(txnDescriptor);
|
|
19
|
+
buffer.writeUInt32LE(outstandingRequestCount);
|
|
20
|
+
const data = buffer.data;
|
|
21
|
+
data.writeUInt32LE(data.length, 0);
|
|
22
|
+
return buffer;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJUWVBFIiwiUVVFUllfTk9USUZJQ0FUSU9OUyIsIlRYTl9ERVNDUklQVE9SIiwiVFJBQ0VfQUNUSVZJVFkiLCJUWE5ERVNDUklQVE9SX0hFQURFUl9EQVRBX0xFTiIsIlRYTkRFU0NSSVBUT1JfSEVBREVSX0xFTiIsIndyaXRlVG9UcmFja2luZ0J1ZmZlciIsImJ1ZmZlciIsInR4bkRlc2NyaXB0b3IiLCJvdXRzdGFuZGluZ1JlcXVlc3RDb3VudCIsIndyaXRlVUludDMyTEUiLCJ3cml0ZVVJbnQxNkxFIiwid3JpdGVCdWZmZXIiLCJkYXRhIiwibGVuZ3RoIl0sInNvdXJjZXMiOlsiLi4vc3JjL2FsbC1oZWFkZXJzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBXcml0YWJsZVRyYWNraW5nQnVmZmVyIGZyb20gJy4vdHJhY2tpbmctYnVmZmVyL3dyaXRhYmxlLXRyYWNraW5nLWJ1ZmZlcic7XG5cbmNvbnN0IFRZUEUgPSB7XG4gIFFVRVJZX05PVElGSUNBVElPTlM6IDEsXG4gIFRYTl9ERVNDUklQVE9SOiAyLFxuICBUUkFDRV9BQ1RJVklUWTogM1xufTtcblxuY29uc3QgVFhOREVTQ1JJUFRPUl9IRUFERVJfREFUQV9MRU4gPSA0ICsgODtcblxuY29uc3QgVFhOREVTQ1JJUFRPUl9IRUFERVJfTEVOID0gNCArIDIgKyBUWE5ERVNDUklQVE9SX0hFQURFUl9EQVRBX0xFTjtcblxuZXhwb3J0IGZ1bmN0aW9uIHdyaXRlVG9UcmFja2luZ0J1ZmZlcihidWZmZXI6IFdyaXRhYmxlVHJhY2tpbmdCdWZmZXIsIHR4bkRlc2NyaXB0b3I6IEJ1ZmZlciwgb3V0c3RhbmRpbmdSZXF1ZXN0Q291bnQ6IG51bWJlcikge1xuICBidWZmZXIud3JpdGVVSW50MzJMRSgwKTtcbiAgYnVmZmVyLndyaXRlVUludDMyTEUoVFhOREVTQ1JJUFRPUl9IRUFERVJfTEVOKTtcbiAgYnVmZmVyLndyaXRlVUludDE2TEUoVFlQRS5UWE5fREVTQ1JJUFRPUik7XG4gIGJ1ZmZlci53cml0ZUJ1ZmZlcih0eG5EZXNjcmlwdG9yKTtcbiAgYnVmZmVyLndyaXRlVUludDMyTEUob3V0c3RhbmRpbmdSZXF1ZXN0Q291bnQpO1xuXG4gIGNvbnN0IGRhdGEgPSBidWZmZXIuZGF0YTtcbiAgZGF0YS53cml0ZVVJbnQzMkxFKGRhdGEubGVuZ3RoLCAwKTtcbiAgcmV0dXJuIGJ1ZmZlcjtcbn1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBRUEsTUFBTUEsSUFBSSxHQUFHO0VBQ1hDLG1CQUFtQixFQUFFLENBQUM7RUFDdEJDLGNBQWMsRUFBRSxDQUFDO0VBQ2pCQyxjQUFjLEVBQUU7QUFDbEIsQ0FBQztBQUVELE1BQU1DLDZCQUE2QixHQUFHLENBQUMsR0FBRyxDQUFDO0FBRTNDLE1BQU1DLHdCQUF3QixHQUFHLENBQUMsR0FBRyxDQUFDLEdBQUdELDZCQUE2QjtBQUUvRCxTQUFTRSxxQkFBcUJBLENBQUNDLE1BQThCLEVBQUVDLGFBQXFCLEVBQUVDLHVCQUErQixFQUFFO0VBQzVIRixNQUFNLENBQUNHLGFBQWEsQ0FBQyxDQUFDLENBQUM7RUFDdkJILE1BQU0sQ0FBQ0csYUFBYSxDQUFDTCx3QkFBd0IsQ0FBQztFQUM5Q0UsTUFBTSxDQUFDSSxhQUFhLENBQUNYLElBQUksQ0FBQ0UsY0FBYyxDQUFDO0VBQ3pDSyxNQUFNLENBQUNLLFdBQVcsQ0FBQ0osYUFBYSxDQUFDO0VBQ2pDRCxNQUFNLENBQUNHLGFBQWEsQ0FBQ0QsdUJBQXVCLENBQUM7RUFFN0MsTUFBTUksSUFBSSxHQUFHTixNQUFNLENBQUNNLElBQUk7RUFDeEJBLElBQUksQ0FBQ0gsYUFBYSxDQUFDRyxJQUFJLENBQUNDLE1BQU0sRUFBRSxDQUFDLENBQUM7RUFDbEMsT0FBT1AsTUFBTTtBQUNmIiwiaWdub3JlTGlzdCI6W119
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-headers.js","names":["TYPE","QUERY_NOTIFICATIONS","TXN_DESCRIPTOR","TRACE_ACTIVITY","TXNDESCRIPTOR_HEADER_DATA_LEN","TXNDESCRIPTOR_HEADER_LEN","writeToTrackingBuffer","buffer","txnDescriptor","outstandingRequestCount","writeUInt32LE","writeUInt16LE","writeBuffer","data","length"],"sources":["../src/all-headers.ts"],"sourcesContent":["import WritableTrackingBuffer from './tracking-buffer/writable-tracking-buffer';\n\nconst TYPE = {\n QUERY_NOTIFICATIONS: 1,\n TXN_DESCRIPTOR: 2,\n TRACE_ACTIVITY: 3\n};\n\nconst TXNDESCRIPTOR_HEADER_DATA_LEN = 4 + 8;\n\nconst TXNDESCRIPTOR_HEADER_LEN = 4 + 2 + TXNDESCRIPTOR_HEADER_DATA_LEN;\n\nexport function writeToTrackingBuffer(buffer: WritableTrackingBuffer, txnDescriptor: Buffer, outstandingRequestCount: number) {\n buffer.writeUInt32LE(0);\n buffer.writeUInt32LE(TXNDESCRIPTOR_HEADER_LEN);\n buffer.writeUInt16LE(TYPE.TXN_DESCRIPTOR);\n buffer.writeBuffer(txnDescriptor);\n buffer.writeUInt32LE(outstandingRequestCount);\n\n const data = buffer.data;\n data.writeUInt32LE(data.length, 0);\n return buffer;\n}\n"],"mappings":";;;;;;AAEA,MAAMA,IAAI,GAAG;EACXC,mBAAmB,EAAE,CAAC;EACtBC,cAAc,EAAE,CAAC;EACjBC,cAAc,EAAE;AAClB,CAAC;AAED,MAAMC,6BAA6B,GAAG,CAAC,GAAG,CAAC;AAE3C,MAAMC,wBAAwB,GAAG,CAAC,GAAG,CAAC,GAAGD,6BAA6B;AAE/D,SAASE,qBAAqBA,CAACC,MAA8B,EAAEC,aAAqB,EAAEC,uBAA+B,EAAE;EAC5HF,MAAM,CAACG,aAAa,CAAC,CAAC,CAAC;EACvBH,MAAM,CAACG,aAAa,CAACL,wBAAwB,CAAC;EAC9CE,MAAM,CAACI,aAAa,CAACX,IAAI,CAACE,cAAc,CAAC;EACzCK,MAAM,CAACK,WAAW,CAACJ,aAAa,CAAC;EACjCD,MAAM,CAACG,aAAa,CAACD,uBAAuB,CAAC;EAE7C,MAAMI,IAAI,GAAGN,MAAM,CAACM,IAAI;EACxBA,IAAI,CAACH,aAAa,CAACG,IAAI,CAACC,MAAM,EAAE,CAAC,CAAC;EAClC,OAAOP,MAAM;AACf","ignoreList":[]}
|