squilo 0.4.0 → 0.4.1

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/dist/index.d.ts CHANGED
@@ -1,50 +1,5 @@
1
- import { config as config2 } from "mssql";
2
- import { Transaction as Transaction2 } from "mssql";
3
- import { ConnectionError, TransactionError, RequestError, PreparedStatementError } from "mssql";
4
- type ErrorType = Error | ConnectionError | TransactionError | RequestError | PreparedStatementError;
5
- type ExecutionError = Record<string, ErrorType>;
6
- type ExecutionData<TReturn> = {
7
- database: string;
8
- data: TReturn;
9
- };
10
- type OutputStrategy<
11
- TReturn,
12
- TOutput = void
13
- > = (data: ReadableStream<ExecutionData<TReturn>>) => Promise<TOutput>;
14
- type TransformChain<
15
- TInput,
16
- TOutput
17
- > = {
18
- Output<TFinalOutput>(strategy: OutputStrategy<TOutput, TFinalOutput>): Promise<[ExecutionError[], TFinalOutput]>;
19
- };
20
- type TransformFunction<
21
- TInput,
22
- TOutput
23
- > = (data: TInput) => TOutput | Promise<TOutput>;
24
- type RetrieveChain<TReturn> = {
25
- Transform<TOutput>(transformFn: TransformFunction<TReturn, TOutput>): TransformChain<TReturn, TOutput>;
26
- Output<TOutput>(strategy: OutputStrategy<TReturn, TOutput>): Promise<[ExecutionError[], TOutput]>;
27
- };
28
- type ConnectionOptions = {
29
- database: string;
30
- query: `SELECT${string}FROM${string}`;
31
- };
32
- type ConnectionChain = {
33
- Execute(fn: (transaction: Transaction2, database: string) => Promise<void>): Promise<ExecutionError[]>;
34
- Retrieve<TResult>(fn: (transaction: Transaction2, database: string) => Promise<TResult>): RetrieveChain<TResult>;
35
- };
36
- type AuthenticationChain = {
37
- Connect(database: string): ConnectionChain;
38
- Connect(databases: string[], concurrent?: number): ConnectionChain;
39
- Connect(options: ConnectionOptions, concurrent?: number): ConnectionChain;
40
- Close(): Promise<void>;
41
- };
42
- import { config } from "mssql";
43
- type AuthStrategy = (config: ServerConfig) => config;
44
- type ServerConfig = Omit<config2, "authentication" | "user" | "password">;
45
- type ServerChain = {
46
- Auth(strategy: AuthStrategy): AuthenticationChain;
47
- };
1
+ import { ServerChain, ServerConfig } from "./shared/chunk-ydmc6s5q";
2
+ import "./shared/chunk-pmxhq7r6";
48
3
  declare const Server: (config: ServerConfig) => ServerChain;
49
4
  import * as SQL from "mssql";
50
5
  export { Server, SQL };
@@ -1,7 +1,5 @@
1
- import { config } from "mssql";
2
- type ServerConfig = Omit<config, "authentication" | "user" | "password">;
3
- import { config as config2 } from "mssql";
4
- type AuthStrategy = (config2: ServerConfig) => config2;
1
+ import { AuthStrategy } from "../../../shared/chunk-ydmc6s5q";
2
+ import "../../../shared/chunk-pmxhq7r6";
5
3
  declare const UserAndPassword: (username: string, password: string) => AuthStrategy;
6
4
  import { NodeAuthOptions } from "@azure/msal-node";
7
5
  declare const ActiveDirectoryAccessToken: (config: NodeAuthOptions) => Promise<AuthStrategy>;
@@ -1,11 +1,4 @@
1
- type ExecutionData<TReturn> = {
2
- database: string;
3
- data: TReturn;
4
- };
5
- type OutputStrategy<
6
- TReturn,
7
- TOutput = void
8
- > = (data: ReadableStream<ExecutionData<TReturn>>) => Promise<TOutput>;
1
+ import { OutputStrategy } from "../../../shared/chunk-pmxhq7r6";
9
2
  declare const MergeOutputStrategy: <
10
3
  TData,
11
4
  TMerged = TData extends Array<infer TItem> ? TItem : TData
@@ -0,0 +1,35 @@
1
+ import { ConnectionError, TransactionError, RequestError, PreparedStatementError } from "mssql";
2
+ import { Transaction } from "mssql";
3
+ type TransformChain<
4
+ TInput,
5
+ TOutput
6
+ > = {
7
+ Output<TFinalOutput>(strategy: OutputStrategy<TOutput, TFinalOutput>): Promise<[ExecutionError[], TFinalOutput]>;
8
+ };
9
+ type TransformFunction<
10
+ TInput,
11
+ TOutput
12
+ > = (data: TInput) => TOutput | Promise<TOutput>;
13
+ type RetrieveChain<TReturn> = {
14
+ Transform<TOutput>(transformFn: TransformFunction<TReturn, TOutput>): TransformChain<TReturn, TOutput>;
15
+ Output<TOutput>(strategy: OutputStrategy<TReturn, TOutput>): Promise<[ExecutionError[], TOutput]>;
16
+ };
17
+ type ConnectionOptions = {
18
+ database: string;
19
+ query: `SELECT${string}FROM${string}`;
20
+ };
21
+ type ConnectionChain = {
22
+ Execute(fn: (transaction: Transaction, database: string) => Promise<void>): Promise<ExecutionError[]>;
23
+ Retrieve<TResult>(fn: (transaction: Transaction, database: string) => Promise<TResult>): RetrieveChain<TResult>;
24
+ };
25
+ type ErrorType = Error | ConnectionError | TransactionError | RequestError | PreparedStatementError;
26
+ type ExecutionError = Record<string, ErrorType>;
27
+ type ExecutionData<TReturn> = {
28
+ database: string;
29
+ data: TReturn;
30
+ };
31
+ type OutputStrategy<
32
+ TReturn,
33
+ TOutput = void
34
+ > = (data: ReadableStream<ExecutionData<TReturn>>) => Promise<TOutput>;
35
+ export { OutputStrategy, ConnectionOptions, ConnectionChain };
@@ -0,0 +1,15 @@
1
+ import { ConnectionChain, ConnectionOptions } from "./chunk-pmxhq7r6";
2
+ import { config } from "mssql";
3
+ type AuthenticationChain = {
4
+ Connect(database: string): ConnectionChain;
5
+ Connect(databases: string[], concurrent?: number): ConnectionChain;
6
+ Connect(options: ConnectionOptions, concurrent?: number): ConnectionChain;
7
+ Close(): Promise<void>;
8
+ };
9
+ type ServerConfig = Omit<config, "authentication" | "user" | "password">;
10
+ type ServerChain = {
11
+ Auth(strategy: AuthStrategy): AuthenticationChain;
12
+ };
13
+ import { config as config2 } from "mssql";
14
+ type AuthStrategy = (config2: ServerConfig) => config2;
15
+ export { AuthStrategy, ServerConfig, ServerChain };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squilo",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"