@effect/sql-mssql 4.0.0-beta.7 → 4.0.0-beta.71

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.
@@ -1,17 +1,21 @@
1
1
  import * as Layer from "effect/Layer";
2
2
  import * as Migrator from "effect/unstable/sql/Migrator";
3
3
  /**
4
- * @since 1.0.0
4
+ * @since 4.0.0
5
5
  */
6
6
  export * from "effect/unstable/sql/Migrator";
7
7
  /**
8
- * @category constructor
9
- * @since 1.0.0
8
+ * Runs SQL migrations using the configured `SqlClient`, returning the migrations that were applied.
9
+ *
10
+ * @category constructors
11
+ * @since 4.0.0
10
12
  */
11
13
  export const run = /*#__PURE__*/Migrator.make({});
12
14
  /**
15
+ * Creates a layer that runs the configured SQL migrations during layer construction.
16
+ *
13
17
  * @category layers
14
- * @since 1.0.0
18
+ * @since 4.0.0
15
19
  */
16
20
  export const layer = options => Layer.effectDiscard(run(options));
17
21
  //# sourceMappingURL=MssqlMigrator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MssqlMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/MssqlMigrator.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,8BAA8B;AAIxD;;;AAGA,cAAc,8BAA8B;AAE5C;;;;AAIA,OAAO,MAAMC,GAAG,gBAMZD,QAAQ,CAACE,IAAI,CAAC,EAAE,CAAC;AAErB;;;;AAIA,OAAO,MAAMC,KAAK,GAChBC,OAAoC,IAC6CL,KAAK,CAACM,aAAa,CAACJ,GAAG,CAACG,OAAO,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"MssqlMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/MssqlMigrator.ts"],"sourcesContent":[null],"mappings":"AAyBA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,8BAA8B;AAIxD;;;AAGA,cAAc,8BAA8B;AAE5C;;;;;;AAMA,OAAO,MAAMC,GAAG,gBAMZD,QAAQ,CAACE,IAAI,CAAC,EAAE,CAAC;AAErB;;;;;;AAMA,OAAO,MAAMC,KAAK,GAChBC,OAAoC,IAC6CL,KAAK,CAACM,aAAa,CAACJ,GAAG,CAACG,OAAO,CAAC,CAAC","ignoreList":[]}
@@ -1,18 +1,24 @@
1
1
  import type { DataType } from "tedious/lib/data-type.ts";
2
2
  import type { ParameterOptions } from "tedious/lib/request.ts";
3
3
  /**
4
+ * Runtime type identifier used to mark SQL Server stored procedure parameter metadata.
5
+ *
4
6
  * @category type id
5
- * @since 1.0.0
7
+ * @since 4.0.0
6
8
  */
7
9
  export declare const TypeId: TypeId;
8
10
  /**
11
+ * Type-level identifier used to mark SQL Server stored procedure parameter metadata.
12
+ *
9
13
  * @category type id
10
- * @since 1.0.0
14
+ * @since 4.0.0
11
15
  */
12
16
  export type TypeId = "~@effect/sql-mssql/Parameter";
13
17
  /**
14
- * @category model
15
- * @since 1.0.0
18
+ * Metadata for a SQL Server stored procedure parameter, including its name, Tedious data type, options, and phantom value type.
19
+ *
20
+ * @category models
21
+ * @since 4.0.0
16
22
  */
17
23
  export interface Parameter<out A> {
18
24
  readonly [TypeId]: (_: never) => A;
@@ -22,8 +28,10 @@ export interface Parameter<out A> {
22
28
  readonly options: ParameterOptions;
23
29
  }
24
30
  /**
25
- * @category constructor
26
- * @since 1.0.0
31
+ * Creates typed metadata for a SQL Server stored procedure parameter.
32
+ *
33
+ * @category constructors
34
+ * @since 4.0.0
27
35
  */
28
36
  export declare const make: <A>(name: string, type: DataType, options?: ParameterOptions) => Parameter<A>;
29
37
  //# sourceMappingURL=Parameter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../src/Parameter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BA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AC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CACnC;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EACpB,MAAM,MAAM,EACZ,MAAM,QAAQ,EACd,UAAS,gBAAqB,KAC7B,SAAS,CAAC,CAAC,CAMZ,CAAA"}
package/dist/Parameter.js CHANGED
@@ -1,15 +1,54 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Typed SQL Server stored procedure parameter metadata.
3
+ *
4
+ * This module builds {@link Parameter} values that pair a stored procedure
5
+ * parameter name with a Tedious `DataType`, Tedious `ParameterOptions`, and a
6
+ * phantom TypeScript value type. `Procedure.param` and
7
+ * `Procedure.outputParam` use this metadata, and `MssqlClient.call` forwards it
8
+ * to Tedious when registering input and output parameters.
9
+ *
10
+ * **Mental model**
11
+ *
12
+ * A `Parameter<A>` describes how Tedious should bind a value; it is not the
13
+ * value itself. The `A` type guides the record accepted by
14
+ * `Procedure.compile`, while Tedious validates and encodes the runtime value
15
+ * when the request is executed.
16
+ *
17
+ * **Common tasks**
18
+ *
19
+ * - Annotate inputs that need explicit SQL Server data types, sizes, precision,
20
+ * scale, or table-valued parameter options.
21
+ * - Define output parameters so `MssqlClient.call` can collect returned values
22
+ * by name.
23
+ * - Reuse the same metadata shape from direct `make` calls and the `Procedure`
24
+ * builders.
25
+ *
26
+ * **Gotchas**
27
+ *
28
+ * Names should match the stored procedure parameter name expected by Tedious,
29
+ * normally without a leading `@`. Table-valued parameter values must use
30
+ * Tedious' table shape with `name`, optional `schema`, `columns`, and `rows`.
31
+ * Output parameters are registered without an initial value, so input-output
32
+ * parameters need explicit modeling instead of assuming compiled input values
33
+ * are reused.
34
+ *
35
+ * @see {@link make} for constructing parameter metadata directly.
36
+ *
37
+ * @since 4.0.0
3
38
  */
4
39
  import { identity } from "effect/Function";
5
40
  /**
41
+ * Runtime type identifier used to mark SQL Server stored procedure parameter metadata.
42
+ *
6
43
  * @category type id
7
- * @since 1.0.0
44
+ * @since 4.0.0
8
45
  */
9
46
  export const TypeId = "~@effect/sql-mssql/Parameter";
10
47
  /**
11
- * @category constructor
12
- * @since 1.0.0
48
+ * Creates typed metadata for a SQL Server stored procedure parameter.
49
+ *
50
+ * @category constructors
51
+ * @since 4.0.0
13
52
  */
14
53
  export const make = (name, type, options = {}) => ({
15
54
  [TypeId]: identity,
@@ -1 +1 @@
1
- {"version":3,"file":"Parameter.js","names":["identity","TypeId","make","name","type","options","_tag"],"sources":["../src/Parameter.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,SAASA,QAAQ,QAAQ,iBAAiB;AAI1C;;;;AAIA,OAAO,MAAMC,MAAM,GAAW,8BAA8B;AAoB5D;;;;AAIA,OAAO,MAAMC,IAAI,GAAGA,CAClBC,IAAY,EACZC,IAAc,EACdC,OAAA,GAA4B,EAAE,MACZ;EAClB,CAACJ,MAAM,GAAGD,QAAQ;EAClBM,IAAI,EAAE,WAAW;EACjBH,IAAI;EACJC,IAAI;EACJC;CACD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Parameter.js","names":["identity","TypeId","make","name","type","options","_tag"],"sources":["../src/Parameter.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAASA,QAAQ,QAAQ,iBAAiB;AAI1C;;;;;;AAMA,OAAO,MAAMC,MAAM,GAAW,8BAA8B;AAwB5D;;;;;;AAMA,OAAO,MAAMC,IAAI,GAAGA,CAClBC,IAAY,EACZC,IAAc,EACdC,OAAA,GAA4B,EAAE,MACZ;EAClB,CAACJ,MAAM,GAAGD,QAAQ;EAClBM,IAAI,EAAE,WAAW;EACjBH,IAAI;EACJC,IAAI;EACJC;CACD,CAAC","ignoreList":[]}
@@ -5,18 +5,24 @@ import type { DataType } from "tedious/lib/data-type.ts";
5
5
  import type { ParameterOptions } from "tedious/lib/request.ts";
6
6
  import * as Parameter from "./Parameter.ts";
7
7
  /**
8
+ * Runtime type identifier used to mark SQL Server stored procedure definitions.
9
+ *
8
10
  * @category type id
9
- * @since 1.0.0
11
+ * @since 4.0.0
10
12
  */
11
13
  export declare const TypeId: TypeId;
12
14
  /**
15
+ * Type-level identifier used to mark SQL Server stored procedure definitions.
16
+ *
13
17
  * @category type id
14
- * @since 1.0.0
18
+ * @since 4.0.0
15
19
  */
16
20
  export type TypeId = "~@effect/sql-mssql/Procedure";
17
21
  /**
18
- * @category model
19
- * @since 1.0.0
22
+ * Pipeable definition of a SQL Server stored procedure, tracking its input parameters, output parameters, and result row type.
23
+ *
24
+ * @category models
25
+ * @since 4.0.0
20
26
  */
21
27
  export interface Procedure<I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>, A = never> extends Pipeable {
22
28
  readonly [TypeId]: {
@@ -28,25 +34,34 @@ export interface Procedure<I extends Record<string, Parameter.Parameter<any>>, O
28
34
  readonly outputParams: O;
29
35
  }
30
36
  /**
31
- * @category model
32
- * @since 1.0.0
37
+ * Stored procedure definition with concrete input values bound for execution.
38
+ *
39
+ * @category models
40
+ * @since 4.0.0
33
41
  */
34
42
  export interface ProcedureWithValues<I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>, A> extends Procedure<I, O, A> {
35
43
  readonly values: Procedure.ParametersRecord<I>;
36
44
  }
37
45
  /**
38
- * @since 1.0.0
46
+ * Namespace containing type helpers and result types for SQL Server stored procedures.
47
+ *
48
+ * @since 4.0.0
39
49
  */
40
50
  export declare namespace Procedure {
41
51
  /**
42
- * @since 1.0.0
52
+ * Maps a record of `Parameter` metadata to the corresponding record of parameter value types.
53
+ *
54
+ * @category utility types
55
+ * @since 4.0.0
43
56
  */
44
57
  type ParametersRecord<A extends Record<string, Parameter.Parameter<any>>> = {
45
58
  readonly [K in keyof A]: A[K] extends Parameter.Parameter<infer T> ? T : never;
46
59
  } & {};
47
60
  /**
48
- * @category model
49
- * @since 1.0.0
61
+ * Result of a SQL Server stored procedure call, containing typed output parameter values and returned rows.
62
+ *
63
+ * @category models
64
+ * @since 4.0.0
50
65
  */
51
66
  interface Result<O extends Record<string, Parameter.Parameter<any>>, A> {
52
67
  readonly output: ParametersRecord<O>;
@@ -57,28 +72,38 @@ type Simplify<A> = {
57
72
  [K in keyof A]: A[K];
58
73
  } & {};
59
74
  /**
60
- * @category constructor
61
- * @since 1.0.0
75
+ * Creates an empty SQL Server stored procedure definition for the given procedure name.
76
+ *
77
+ * @category constructors
78
+ * @since 4.0.0
62
79
  */
63
80
  export declare const make: (name: string) => Procedure<{}, {}>;
64
81
  /**
82
+ * Adds a typed input parameter to a SQL Server stored procedure definition.
83
+ *
65
84
  * @category combinator
66
- * @since 1.0.0
85
+ * @since 4.0.0
67
86
  */
68
87
  export declare const param: <A>() => <N extends string, T extends DataType>(name: N, type: T, options?: ParameterOptions) => <I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>>(self: Procedure<I, O>) => Procedure<Simplify<I & { [K in N]: Parameter.Parameter<A>; }>, O>;
69
88
  /**
89
+ * Adds a typed output parameter to a SQL Server stored procedure definition.
90
+ *
70
91
  * @category combinator
71
- * @since 1.0.0
92
+ * @since 4.0.0
72
93
  */
73
94
  export declare const outputParam: <A>() => <N extends string, T extends DataType>(name: N, type: T, options?: ParameterOptions) => <I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>>(self: Procedure<I, O>) => Procedure<I, Simplify<O & { [K in N]: Parameter.Parameter<A>; }>>;
74
95
  /**
96
+ * Sets the expected row type for a SQL Server stored procedure definition.
97
+ *
75
98
  * @category combinator
76
- * @since 1.0.0
99
+ * @since 4.0.0
77
100
  */
78
101
  export declare const withRows: <A extends object = Row>() => <I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>>(self: Procedure<I, O>) => Procedure<I, O, A>;
79
102
  /**
103
+ * Binds input values to a SQL Server stored procedure definition, producing a value that can be executed with `MssqlClient.call`.
104
+ *
80
105
  * @category combinator
81
- * @since 1.0.0
106
+ * @since 4.0.0
82
107
  */
83
108
  export declare const compile: <I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>, A>(self: Procedure<I, O, A>) => (input: Procedure.ParametersRecord<I>) => ProcedureWithValues<I, O, A>;
84
109
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Procedure.d.ts","sourceRoot":"","sources":["../src/Procedure.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,MAAuC,CAAA;AAE5D;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,8BAA8B,CAAA;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAS,CACxB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAClD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAClD,CAAC,GAAG,KAAK,CACT,SAAQ,QAAQ;IAChB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE;QACjB,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;KAC1B,CAAA;IACD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM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C,CAAC,EAElD,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KACpB,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAAE,CAAC,CAMhE,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,GAAG,GAAG,QAE7C,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAClD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAElD,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KACpB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAgB,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAClD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAClD,CAAC,EAED,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAEzB,OAAO,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAG,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAGjE,CAAA"}
package/dist/Procedure.js CHANGED
@@ -1,12 +1,45 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Typed metadata builders for Microsoft SQL Server stored procedure calls.
3
+ *
4
+ * This module defines the `Procedure` values consumed by `MssqlClient.call`.
5
+ * Use it when application code invokes SQL Server stored procedures for
6
+ * commands, reports, migrations, or workflows that need explicit Tedious
7
+ * parameter metadata, output parameters, and typed result rows.
8
+ *
9
+ * **Mental model**
10
+ *
11
+ * A `Procedure` is a typed description, not an executable request. Start with
12
+ * `make`, add input parameters with `param` and output parameters with
13
+ * `outputParam`, optionally attach the expected row type with `withRows`, and
14
+ * finish with `compile` to bind the input value record. `MssqlClient.call`
15
+ * turns the compiled value into a Tedious request, registers output parameters,
16
+ * and returns output values separately from returned rows.
17
+ *
18
+ * **Common tasks**
19
+ *
20
+ * Use `param<A>()` for every input parameter whose value should appear in the
21
+ * record passed to `compile`, and `outputParam<A>()` for values collected from
22
+ * SQL Server `returnValue` events. Use `withRows<A>()` when the procedure
23
+ * returns a result set and callers should see a typed row array.
24
+ *
25
+ * **Gotchas**
26
+ *
27
+ * The generic type arguments are supplied explicitly; they are not inferred from
28
+ * Tedious `DataType`s or `ParameterOptions`. Parameter names should match the
29
+ * stored procedure parameter names used by Tedious, typically without a leading
30
+ * `@`. `withRows` records only the expected TypeScript row type; runtime row
31
+ * names and transforms still follow the configured `MssqlClient`.
32
+ *
33
+ * @since 4.0.0
3
34
  */
4
35
  import { identity } from "effect/Function";
5
36
  import { pipeArguments } from "effect/Pipeable";
6
37
  import * as Parameter from "./Parameter.js";
7
38
  /**
39
+ * Runtime type identifier used to mark SQL Server stored procedure definitions.
40
+ *
8
41
  * @category type id
9
- * @since 1.0.0
42
+ * @since 4.0.0
10
43
  */
11
44
  export const TypeId = "~@effect/sql-mssql/Procedure";
12
45
  const procedureProto = {
@@ -19,8 +52,10 @@ const procedureProto = {
19
52
  }
20
53
  };
21
54
  /**
22
- * @category constructor
23
- * @since 1.0.0
55
+ * Creates an empty SQL Server stored procedure definition for the given procedure name.
56
+ *
57
+ * @category constructors
58
+ * @since 4.0.0
24
59
  */
25
60
  export const make = name => {
26
61
  const procedure = Object.create(procedureProto);
@@ -30,8 +65,10 @@ export const make = name => {
30
65
  return procedure;
31
66
  };
32
67
  /**
68
+ * Adds a typed input parameter to a SQL Server stored procedure definition.
69
+ *
33
70
  * @category combinator
34
- * @since 1.0.0
71
+ * @since 4.0.0
35
72
  */
36
73
  export const param = () => (name, type, options) => self => ({
37
74
  ...self,
@@ -41,8 +78,10 @@ export const param = () => (name, type, options) => self => ({
41
78
  }
42
79
  });
43
80
  /**
81
+ * Adds a typed output parameter to a SQL Server stored procedure definition.
82
+ *
44
83
  * @category combinator
45
- * @since 1.0.0
84
+ * @since 4.0.0
46
85
  */
47
86
  export const outputParam = () => (name, type, options) => self => ({
48
87
  ...self,
@@ -52,13 +91,17 @@ export const outputParam = () => (name, type, options) => self => ({
52
91
  }
53
92
  });
54
93
  /**
94
+ * Sets the expected row type for a SQL Server stored procedure definition.
95
+ *
55
96
  * @category combinator
56
- * @since 1.0.0
97
+ * @since 4.0.0
57
98
  */
58
99
  export const withRows = () => self => self;
59
100
  /**
101
+ * Binds input values to a SQL Server stored procedure definition, producing a value that can be executed with `MssqlClient.call`.
102
+ *
60
103
  * @category combinator
61
- * @since 1.0.0
104
+ * @since 4.0.0
62
105
  */
63
106
  export const compile = self => input => ({
64
107
  ...self,
@@ -1 +1 @@
1
- {"version":3,"file":"Procedure.js","names":["identity","pipeArguments","Parameter","TypeId","procedureProto","_A","_tag","pipe","arguments","make","name","procedure","Object","create","params","outputParams","param","type","options","self","outputParam","withRows","compile","input","values"],"sources":["../src/Procedure.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,SAASA,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,aAAa,QAAQ,iBAAiB;AAK/C,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAE3C;;;;AAIA,OAAO,MAAMC,MAAM,GAAW,8BAA8B;AAqE5D,MAAMC,cAAc,GAAG;EACrB,CAACD,MAAM,GAAG;IACRE,EAAE,EAAEL;GACL;EACDM,IAAI,EAAE,WAAW;EACjBC,IAAIA,CAAA;IACF,OAAON,aAAa,CAAC,IAAI,EAAEO,SAAS,CAAC;EACvC;CACD;AAED;;;;AAIA,OAAO,MAAMC,IAAI,GAAIC,IAAY,IAAuB;EACtD,MAAMC,SAAS,GAAGC,MAAM,CAACC,MAAM,CAACT,cAAc,CAAC;EAC/CO,SAAS,CAACD,IAAI,GAAGA,IAAI;EACrBC,SAAS,CAACG,MAAM,GAAG,EAAE;EACrBH,SAAS,CAACI,YAAY,GAAG,EAAE;EAC3B,OAAOJ,SAAS;AAClB,CAAC;AAED;;;;AAIA,OAAO,MAAMK,KAAK,GAAGA,CAAA,KACrB,CACEN,IAAO,EACPO,IAAO,EACPC,OAA0B,KAM1BC,IAAqB,KACiD;EACtE,GAAGA,IAAI;EACPL,MAAM,EAAE;IACN,GAAGK,IAAI,CAACL,MAAM;IACd,CAACJ,IAAI,GAAGR,SAAS,CAACO,IAAI,CAACC,IAAI,EAAEO,IAAI,EAAEC,OAAO;;CAE7C,CAAC;AAEF;;;;AAIA,OAAO,MAAME,WAAW,GAAGA,CAAA,KAC3B,CACEV,IAAO,EACPO,IAAO,EACPC,OAA0B,KAM1BC,IAAqB,KACiD;EACtE,GAAGA,IAAI;EACPJ,YAAY,EAAE;IACZ,GAAGI,IAAI,CAACJ,YAAY;IACpB,CAACL,IAAI,GAAGR,SAAS,CAACO,IAAI,CAACC,IAAI,EAAEO,IAAI,EAAEC,OAAO;;CAE7C,CAAC;AAEF;;;;AAIA,OAAO,MAAMG,QAAQ,GAAGA,CAAA,KAKtBF,IAAqB,IACEA,IAAW;AAEpC;;;;AAIA,OAAO,MAAMG,OAAO,GAKlBH,IAAwB,IAEzBI,KAAoC,KAAoC;EACvE,GAAGJ,IAAI;EACPK,MAAM,EAAED;CACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Procedure.js","names":["identity","pipeArguments","Parameter","TypeId","procedureProto","_A","_tag","pipe","arguments","make","name","procedure","Object","create","params","outputParams","param","type","options","self","outputParam","withRows","compile","input","values"],"sources":["../src/Procedure.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAASA,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,aAAa,QAAQ,iBAAiB;AAK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AEzBI,KAAoC,KAAoC;EACvE,GAAGJ,IAAI;EACPK,MAAM,EAAED;CACT,CAAC","ignoreList":[]}
package/dist/index.d.ts CHANGED
@@ -1,25 +1,25 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  export {
5
5
  /**
6
- * @since 1.0.0
6
+ * @since 4.0.0
7
7
  */
8
8
  TYPES as MssqlTypes } from "tedious";
9
9
  /**
10
- * @since 1.0.0
10
+ * @since 4.0.0
11
11
  */
12
12
  export * as MssqlClient from "./MssqlClient.ts";
13
13
  /**
14
- * @since 1.0.0
14
+ * @since 4.0.0
15
15
  */
16
16
  export * as MssqlMigrator from "./MssqlMigrator.ts";
17
17
  /**
18
- * @since 1.0.0
18
+ * @since 4.0.0
19
19
  */
20
20
  export * as Parameter from "./Parameter.ts";
21
21
  /**
22
- * @since 1.0.0
22
+ * @since 4.0.0
23
23
  */
24
24
  export * as Procedure from "./Procedure.ts";
25
25
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,26 +1,26 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  export {
5
5
  /**
6
- * @since 1.0.0
6
+ * @since 4.0.0
7
7
  */
8
8
  TYPES as MssqlTypes } from "tedious";
9
9
  // @barrel: Auto-generated exports. Do not edit manually.
10
10
  /**
11
- * @since 1.0.0
11
+ * @since 4.0.0
12
12
  */
13
13
  export * as MssqlClient from "./MssqlClient.js";
14
14
  /**
15
- * @since 1.0.0
15
+ * @since 4.0.0
16
16
  */
17
17
  export * as MssqlMigrator from "./MssqlMigrator.js";
18
18
  /**
19
- * @since 1.0.0
19
+ * @since 4.0.0
20
20
  */
21
21
  export * as Parameter from "./Parameter.js";
22
22
  /**
23
- * @since 1.0.0
23
+ * @since 4.0.0
24
24
  */
25
25
  export * as Procedure from "./Procedure.js";
26
26
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/sql-mssql",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.71",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A Microsoft SQL Server toolkit for Effect",
@@ -43,13 +43,13 @@
43
43
  "provenance": true
44
44
  },
45
45
  "devDependencies": {
46
- "effect": "^4.0.0-beta.7"
46
+ "effect": "^4.0.0-beta.71"
47
47
  },
48
48
  "peerDependencies": {
49
- "effect": "^4.0.0-beta.7"
49
+ "effect": "^4.0.0-beta.71"
50
50
  },
51
51
  "dependencies": {
52
- "tedious": "^19.2.0"
52
+ "tedious": "^19.2.1"
53
53
  },
54
54
  "scripts": {
55
55
  "codegen": "effect-utils codegen",