@prisma/ts-builders 6.6.0-dev.96 → 6.6.0-dev.97
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/ConstDeclaration.d.ts +6 -3
- package/dist/ConstDeclaration.js +12 -1
- package/dist/ConstDeclaration.mjs +12 -1
- package/dist/ExportFrom.d.ts +2 -0
- package/dist/ExportFrom.js +8 -0
- package/dist/ExportFrom.mjs +8 -0
- package/dist/FunctionCall.d.ts +9 -0
- package/dist/FunctionCall.js +49 -0
- package/dist/FunctionCall.mjs +24 -0
- package/dist/Import.d.ts +2 -0
- package/dist/Import.js +8 -0
- package/dist/Import.mjs +8 -0
- package/dist/NamedValue.d.ts +8 -0
- package/dist/NamedValue.js +43 -0
- package/dist/NamedValue.mjs +18 -0
- package/dist/StringLiteralType.d.ts +7 -0
- package/dist/StringLiteralType.js +16 -0
- package/dist/StringLiteralType.mjs +15 -0
- package/dist/ValueBuilder.d.ts +12 -0
- package/dist/ValueBuilder.js +46 -0
- package/dist/ValueBuilder.mjs +21 -0
- package/dist/helpers.d.ts +0 -3
- package/dist/helpers.js +2 -17
- package/dist/helpers.mjs +2 -14
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/index.mjs +3 -0
- package/package.json +2 -2
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { BasicBuilder } from './BasicBuilder';
|
|
2
2
|
import { DocComment } from './DocComment';
|
|
3
3
|
import { TypeBuilder } from './TypeBuilder';
|
|
4
|
+
import { ValueBuilder } from './ValueBuilder';
|
|
4
5
|
import { Writer } from './Writer';
|
|
5
6
|
export declare class ConstDeclaration implements BasicBuilder {
|
|
6
7
|
readonly name: string;
|
|
7
|
-
readonly type
|
|
8
|
+
readonly type?: TypeBuilder | undefined;
|
|
8
9
|
private docComment?;
|
|
9
|
-
|
|
10
|
+
private value?;
|
|
11
|
+
constructor(name: string, type?: TypeBuilder | undefined);
|
|
10
12
|
setDocComment(docComment: DocComment): this;
|
|
13
|
+
setValue(value: ValueBuilder): this;
|
|
11
14
|
write(writer: Writer): void;
|
|
12
15
|
}
|
|
13
|
-
export declare function constDeclaration(name: string, type
|
|
16
|
+
export declare function constDeclaration(name: string, type?: TypeBuilder): ConstDeclaration;
|
package/dist/ConstDeclaration.js
CHANGED
|
@@ -28,15 +28,26 @@ class ConstDeclaration {
|
|
|
28
28
|
this.type = type;
|
|
29
29
|
}
|
|
30
30
|
docComment;
|
|
31
|
+
value;
|
|
31
32
|
setDocComment(docComment) {
|
|
32
33
|
this.docComment = docComment;
|
|
33
34
|
return this;
|
|
34
35
|
}
|
|
36
|
+
setValue(value) {
|
|
37
|
+
this.value = value;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
35
40
|
write(writer) {
|
|
36
41
|
if (this.docComment) {
|
|
37
42
|
writer.write(this.docComment);
|
|
38
43
|
}
|
|
39
|
-
writer.write("const ").write(this.name)
|
|
44
|
+
writer.write("const ").write(this.name);
|
|
45
|
+
if (this.type) {
|
|
46
|
+
writer.write(": ").write(this.type);
|
|
47
|
+
}
|
|
48
|
+
if (this.value) {
|
|
49
|
+
writer.write(" = ").write(this.value);
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
function constDeclaration(name, type) {
|
|
@@ -4,15 +4,26 @@ class ConstDeclaration {
|
|
|
4
4
|
this.type = type;
|
|
5
5
|
}
|
|
6
6
|
docComment;
|
|
7
|
+
value;
|
|
7
8
|
setDocComment(docComment) {
|
|
8
9
|
this.docComment = docComment;
|
|
9
10
|
return this;
|
|
10
11
|
}
|
|
12
|
+
setValue(value) {
|
|
13
|
+
this.value = value;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
11
16
|
write(writer) {
|
|
12
17
|
if (this.docComment) {
|
|
13
18
|
writer.write(this.docComment);
|
|
14
19
|
}
|
|
15
|
-
writer.write("const ").write(this.name)
|
|
20
|
+
writer.write("const ").write(this.name);
|
|
21
|
+
if (this.type) {
|
|
22
|
+
writer.write(": ").write(this.type);
|
|
23
|
+
}
|
|
24
|
+
if (this.value) {
|
|
25
|
+
writer.write(" = ").write(this.value);
|
|
26
|
+
}
|
|
16
27
|
}
|
|
17
28
|
}
|
|
18
29
|
function constDeclaration(name, type) {
|
package/dist/ExportFrom.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ export declare class BindingsExport implements BasicBuilder {
|
|
|
17
17
|
export declare class NamedExport implements BasicBuilder {
|
|
18
18
|
readonly name: string;
|
|
19
19
|
private alias;
|
|
20
|
+
private type;
|
|
20
21
|
constructor(name: string);
|
|
21
22
|
as(alias: string): this;
|
|
23
|
+
typeOnly(): this;
|
|
22
24
|
write(writer: Writer): void;
|
|
23
25
|
}
|
|
24
26
|
export declare class ExportAllFrom implements BasicBuilder {
|
package/dist/ExportFrom.js
CHANGED
|
@@ -56,11 +56,19 @@ class NamedExport {
|
|
|
56
56
|
this.name = name;
|
|
57
57
|
}
|
|
58
58
|
alias;
|
|
59
|
+
type = false;
|
|
59
60
|
as(alias) {
|
|
60
61
|
this.alias = alias;
|
|
61
62
|
return this;
|
|
62
63
|
}
|
|
64
|
+
typeOnly() {
|
|
65
|
+
this.type = true;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
63
68
|
write(writer) {
|
|
69
|
+
if (this.type) {
|
|
70
|
+
writer.write("type ");
|
|
71
|
+
}
|
|
64
72
|
writer.write(this.name);
|
|
65
73
|
if (this.alias) {
|
|
66
74
|
writer.write(" as ").write(this.alias);
|
package/dist/ExportFrom.mjs
CHANGED
|
@@ -28,11 +28,19 @@ class NamedExport {
|
|
|
28
28
|
this.name = name;
|
|
29
29
|
}
|
|
30
30
|
alias;
|
|
31
|
+
type = false;
|
|
31
32
|
as(alias) {
|
|
32
33
|
this.alias = alias;
|
|
33
34
|
return this;
|
|
34
35
|
}
|
|
36
|
+
typeOnly() {
|
|
37
|
+
this.type = true;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
35
40
|
write(writer) {
|
|
41
|
+
if (this.type) {
|
|
42
|
+
writer.write("type ");
|
|
43
|
+
}
|
|
36
44
|
writer.write(this.name);
|
|
37
45
|
if (this.alias) {
|
|
38
46
|
writer.write(" as ").write(this.alias);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValueBuilder } from './ValueBuilder';
|
|
2
|
+
import { Writer } from './Writer';
|
|
3
|
+
export declare class FunctionCall extends ValueBuilder {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(name: string, args: ValueBuilder[]);
|
|
6
|
+
addArgument(arg: ValueBuilder): this;
|
|
7
|
+
write(writer: Writer): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function functionCall(name: string, args?: ValueBuilder[]): FunctionCall;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FunctionCall_exports = {};
|
|
20
|
+
__export(FunctionCall_exports, {
|
|
21
|
+
FunctionCall: () => FunctionCall,
|
|
22
|
+
functionCall: () => functionCall
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(FunctionCall_exports);
|
|
25
|
+
var import_ValueBuilder = require("./ValueBuilder");
|
|
26
|
+
class FunctionCall extends import_ValueBuilder.ValueBuilder {
|
|
27
|
+
#name;
|
|
28
|
+
#args;
|
|
29
|
+
constructor(name, args) {
|
|
30
|
+
super();
|
|
31
|
+
this.#name = name;
|
|
32
|
+
this.#args = args;
|
|
33
|
+
}
|
|
34
|
+
addArgument(arg) {
|
|
35
|
+
this.#args.push(arg);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
write(writer) {
|
|
39
|
+
writer.write(this.#name).write("(").writeJoined(", ", this.#args).write(")");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function functionCall(name, args = []) {
|
|
43
|
+
return new FunctionCall(name, args);
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
FunctionCall,
|
|
48
|
+
functionCall
|
|
49
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ValueBuilder } from "./ValueBuilder";
|
|
2
|
+
class FunctionCall extends ValueBuilder {
|
|
3
|
+
#name;
|
|
4
|
+
#args;
|
|
5
|
+
constructor(name, args) {
|
|
6
|
+
super();
|
|
7
|
+
this.#name = name;
|
|
8
|
+
this.#args = args;
|
|
9
|
+
}
|
|
10
|
+
addArgument(arg) {
|
|
11
|
+
this.#args.push(arg);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
write(writer) {
|
|
15
|
+
writer.write(this.#name).write("(").writeJoined(", ", this.#args).write(")");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function functionCall(name, args = []) {
|
|
19
|
+
return new FunctionCall(name, args);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
FunctionCall,
|
|
23
|
+
functionCall
|
|
24
|
+
};
|
package/dist/Import.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ export declare class BindingsImport implements BasicBuilder {
|
|
|
20
20
|
export declare class NamedImport implements BasicBuilder {
|
|
21
21
|
readonly name: string;
|
|
22
22
|
private alias;
|
|
23
|
+
private type;
|
|
23
24
|
constructor(name: string);
|
|
24
25
|
as(alias: string): this;
|
|
26
|
+
typeOnly(): this;
|
|
25
27
|
write(writer: Writer): void;
|
|
26
28
|
}
|
|
27
29
|
export declare class ModuleImport implements BasicBuilder {
|
package/dist/Import.js
CHANGED
|
@@ -74,11 +74,19 @@ class NamedImport {
|
|
|
74
74
|
this.name = name;
|
|
75
75
|
}
|
|
76
76
|
alias;
|
|
77
|
+
type = false;
|
|
77
78
|
as(alias) {
|
|
78
79
|
this.alias = alias;
|
|
79
80
|
return this;
|
|
80
81
|
}
|
|
82
|
+
typeOnly() {
|
|
83
|
+
this.type = true;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
81
86
|
write(writer) {
|
|
87
|
+
if (this.type) {
|
|
88
|
+
writer.write("type ");
|
|
89
|
+
}
|
|
82
90
|
writer.write(this.name);
|
|
83
91
|
if (this.alias) {
|
|
84
92
|
writer.write(" as ").write(this.alias);
|
package/dist/Import.mjs
CHANGED
|
@@ -46,11 +46,19 @@ class NamedImport {
|
|
|
46
46
|
this.name = name;
|
|
47
47
|
}
|
|
48
48
|
alias;
|
|
49
|
+
type = false;
|
|
49
50
|
as(alias) {
|
|
50
51
|
this.alias = alias;
|
|
51
52
|
return this;
|
|
52
53
|
}
|
|
54
|
+
typeOnly() {
|
|
55
|
+
this.type = true;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
53
58
|
write(writer) {
|
|
59
|
+
if (this.type) {
|
|
60
|
+
writer.write("type ");
|
|
61
|
+
}
|
|
54
62
|
writer.write(this.name);
|
|
55
63
|
if (this.alias) {
|
|
56
64
|
writer.write(" as ").write(this.alias);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ValueBuilder } from './ValueBuilder';
|
|
2
|
+
import { Writer } from './Writer';
|
|
3
|
+
export declare class NamedValue extends ValueBuilder {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(name: string);
|
|
6
|
+
write(writer: Writer): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function namedValue(name: string): NamedValue;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var NamedValue_exports = {};
|
|
20
|
+
__export(NamedValue_exports, {
|
|
21
|
+
NamedValue: () => NamedValue,
|
|
22
|
+
namedValue: () => namedValue
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(NamedValue_exports);
|
|
25
|
+
var import_ValueBuilder = require("./ValueBuilder");
|
|
26
|
+
class NamedValue extends import_ValueBuilder.ValueBuilder {
|
|
27
|
+
#name;
|
|
28
|
+
constructor(name) {
|
|
29
|
+
super();
|
|
30
|
+
this.#name = name;
|
|
31
|
+
}
|
|
32
|
+
write(writer) {
|
|
33
|
+
writer.write(this.#name);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function namedValue(name) {
|
|
37
|
+
return new NamedValue(name);
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
NamedValue,
|
|
42
|
+
namedValue
|
|
43
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ValueBuilder } from "./ValueBuilder";
|
|
2
|
+
class NamedValue extends ValueBuilder {
|
|
3
|
+
#name;
|
|
4
|
+
constructor(name) {
|
|
5
|
+
super();
|
|
6
|
+
this.#name = name;
|
|
7
|
+
}
|
|
8
|
+
write(writer) {
|
|
9
|
+
writer.write(this.#name);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function namedValue(name) {
|
|
13
|
+
return new NamedValue(name);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
NamedValue,
|
|
17
|
+
namedValue
|
|
18
|
+
};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { TypeBuilder } from './TypeBuilder';
|
|
2
|
+
import { ValueBuilder } from './ValueBuilder';
|
|
2
3
|
import { Writer } from './Writer';
|
|
3
4
|
export declare class StringLiteralType extends TypeBuilder {
|
|
4
5
|
readonly content: string;
|
|
5
6
|
constructor(content: string);
|
|
6
7
|
write(writer: Writer): void;
|
|
8
|
+
asValue(): StringLiteralValue;
|
|
9
|
+
}
|
|
10
|
+
export declare class StringLiteralValue extends ValueBuilder {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(type: StringLiteralType);
|
|
13
|
+
write(writer: Writer): void;
|
|
7
14
|
}
|
|
8
15
|
export declare function stringLiteral(content: string): StringLiteralType;
|
|
@@ -19,10 +19,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var StringLiteralType_exports = {};
|
|
20
20
|
__export(StringLiteralType_exports, {
|
|
21
21
|
StringLiteralType: () => StringLiteralType,
|
|
22
|
+
StringLiteralValue: () => StringLiteralValue,
|
|
22
23
|
stringLiteral: () => stringLiteral
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(StringLiteralType_exports);
|
|
25
26
|
var import_TypeBuilder = require("./TypeBuilder");
|
|
27
|
+
var import_ValueBuilder = require("./ValueBuilder");
|
|
26
28
|
class StringLiteralType extends import_TypeBuilder.TypeBuilder {
|
|
27
29
|
constructor(content) {
|
|
28
30
|
super();
|
|
@@ -31,6 +33,19 @@ class StringLiteralType extends import_TypeBuilder.TypeBuilder {
|
|
|
31
33
|
write(writer) {
|
|
32
34
|
writer.write(JSON.stringify(this.content));
|
|
33
35
|
}
|
|
36
|
+
asValue() {
|
|
37
|
+
return new StringLiteralValue(this);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class StringLiteralValue extends import_ValueBuilder.ValueBuilder {
|
|
41
|
+
#type;
|
|
42
|
+
constructor(type) {
|
|
43
|
+
super();
|
|
44
|
+
this.#type = type;
|
|
45
|
+
}
|
|
46
|
+
write(writer) {
|
|
47
|
+
writer.write(this.#type);
|
|
48
|
+
}
|
|
34
49
|
}
|
|
35
50
|
function stringLiteral(content) {
|
|
36
51
|
return new StringLiteralType(content);
|
|
@@ -38,5 +53,6 @@ function stringLiteral(content) {
|
|
|
38
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
54
|
0 && (module.exports = {
|
|
40
55
|
StringLiteralType,
|
|
56
|
+
StringLiteralValue,
|
|
41
57
|
stringLiteral
|
|
42
58
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TypeBuilder } from "./TypeBuilder";
|
|
2
|
+
import { ValueBuilder } from "./ValueBuilder";
|
|
2
3
|
class StringLiteralType extends TypeBuilder {
|
|
3
4
|
constructor(content) {
|
|
4
5
|
super();
|
|
@@ -7,11 +8,25 @@ class StringLiteralType extends TypeBuilder {
|
|
|
7
8
|
write(writer) {
|
|
8
9
|
writer.write(JSON.stringify(this.content));
|
|
9
10
|
}
|
|
11
|
+
asValue() {
|
|
12
|
+
return new StringLiteralValue(this);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class StringLiteralValue extends ValueBuilder {
|
|
16
|
+
#type;
|
|
17
|
+
constructor(type) {
|
|
18
|
+
super();
|
|
19
|
+
this.#type = type;
|
|
20
|
+
}
|
|
21
|
+
write(writer) {
|
|
22
|
+
writer.write(this.#type);
|
|
23
|
+
}
|
|
10
24
|
}
|
|
11
25
|
function stringLiteral(content) {
|
|
12
26
|
return new StringLiteralType(content);
|
|
13
27
|
}
|
|
14
28
|
export {
|
|
15
29
|
StringLiteralType,
|
|
30
|
+
StringLiteralValue,
|
|
16
31
|
stringLiteral
|
|
17
32
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BasicBuilder } from './BasicBuilder';
|
|
2
|
+
import { TypeBuilder } from './TypeBuilder';
|
|
3
|
+
import { Writer } from './Writer';
|
|
4
|
+
export declare abstract class ValueBuilder implements BasicBuilder {
|
|
5
|
+
as(type: TypeBuilder): TypeAssertion;
|
|
6
|
+
abstract write(writer: Writer<undefined>): void;
|
|
7
|
+
}
|
|
8
|
+
export declare class TypeAssertion extends ValueBuilder {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(value: ValueBuilder, type: TypeBuilder);
|
|
11
|
+
write(writer: Writer): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ValueBuilder_exports = {};
|
|
20
|
+
__export(ValueBuilder_exports, {
|
|
21
|
+
TypeAssertion: () => TypeAssertion,
|
|
22
|
+
ValueBuilder: () => ValueBuilder
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ValueBuilder_exports);
|
|
25
|
+
class ValueBuilder {
|
|
26
|
+
as(type) {
|
|
27
|
+
return new TypeAssertion(this, type);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class TypeAssertion extends ValueBuilder {
|
|
31
|
+
#value;
|
|
32
|
+
#type;
|
|
33
|
+
constructor(value, type) {
|
|
34
|
+
super();
|
|
35
|
+
this.#value = value;
|
|
36
|
+
this.#type = type;
|
|
37
|
+
}
|
|
38
|
+
write(writer) {
|
|
39
|
+
writer.write(this.#value).write(" as ").write(this.#type);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
TypeAssertion,
|
|
45
|
+
ValueBuilder
|
|
46
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class ValueBuilder {
|
|
2
|
+
as(type) {
|
|
3
|
+
return new TypeAssertion(this, type);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
class TypeAssertion extends ValueBuilder {
|
|
7
|
+
#value;
|
|
8
|
+
#type;
|
|
9
|
+
constructor(value, type) {
|
|
10
|
+
super();
|
|
11
|
+
this.#value = value;
|
|
12
|
+
this.#type = type;
|
|
13
|
+
}
|
|
14
|
+
write(writer) {
|
|
15
|
+
writer.write(this.#value).write(" as ").write(this.#type);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
TypeAssertion,
|
|
20
|
+
ValueBuilder
|
|
21
|
+
};
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { NamedType } from './NamedType';
|
|
2
2
|
import { TypeBuilder } from './TypeBuilder';
|
|
3
3
|
export declare function omit(type: TypeBuilder, keyType: TypeBuilder): NamedType;
|
|
4
|
-
export declare function promise(resultType: TypeBuilder): NamedType;
|
|
5
|
-
export declare function prismaPromise(resultType: TypeBuilder): NamedType;
|
|
6
|
-
export declare function optional(innerType: TypeBuilder): NamedType;
|
package/dist/helpers.js
CHANGED
|
@@ -18,29 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var helpers_exports = {};
|
|
20
20
|
__export(helpers_exports, {
|
|
21
|
-
omit: () => omit
|
|
22
|
-
optional: () => optional,
|
|
23
|
-
prismaPromise: () => prismaPromise,
|
|
24
|
-
promise: () => promise
|
|
21
|
+
omit: () => omit
|
|
25
22
|
});
|
|
26
23
|
module.exports = __toCommonJS(helpers_exports);
|
|
27
24
|
var import_NamedType = require("./NamedType");
|
|
28
25
|
function omit(type, keyType) {
|
|
29
26
|
return (0, import_NamedType.namedType)("Omit").addGenericArgument(type).addGenericArgument(keyType);
|
|
30
27
|
}
|
|
31
|
-
function promise(resultType) {
|
|
32
|
-
return new import_NamedType.NamedType("$Utils.JsPromise").addGenericArgument(resultType);
|
|
33
|
-
}
|
|
34
|
-
function prismaPromise(resultType) {
|
|
35
|
-
return new import_NamedType.NamedType("Prisma.PrismaPromise").addGenericArgument(resultType);
|
|
36
|
-
}
|
|
37
|
-
function optional(innerType) {
|
|
38
|
-
return new import_NamedType.NamedType("$Utils.Optional").addGenericArgument(innerType);
|
|
39
|
-
}
|
|
40
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
29
|
0 && (module.exports = {
|
|
42
|
-
omit
|
|
43
|
-
optional,
|
|
44
|
-
prismaPromise,
|
|
45
|
-
promise
|
|
30
|
+
omit
|
|
46
31
|
});
|
package/dist/helpers.mjs
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { namedType } from "./NamedType";
|
|
2
2
|
function omit(type, keyType) {
|
|
3
3
|
return namedType("Omit").addGenericArgument(type).addGenericArgument(keyType);
|
|
4
4
|
}
|
|
5
|
-
function promise(resultType) {
|
|
6
|
-
return new NamedType("$Utils.JsPromise").addGenericArgument(resultType);
|
|
7
|
-
}
|
|
8
|
-
function prismaPromise(resultType) {
|
|
9
|
-
return new NamedType("Prisma.PrismaPromise").addGenericArgument(resultType);
|
|
10
|
-
}
|
|
11
|
-
function optional(innerType) {
|
|
12
|
-
return new NamedType("$Utils.Optional").addGenericArgument(innerType);
|
|
13
|
-
}
|
|
14
5
|
export {
|
|
15
|
-
omit
|
|
16
|
-
optional,
|
|
17
|
-
prismaPromise,
|
|
18
|
-
promise
|
|
6
|
+
omit
|
|
19
7
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './DocComment';
|
|
|
8
8
|
export * from './Export';
|
|
9
9
|
export * from './ExportFrom';
|
|
10
10
|
export * from './File';
|
|
11
|
+
export * from './FunctionCall';
|
|
11
12
|
export * from './FunctionType';
|
|
12
13
|
export * from './GenericParameter';
|
|
13
14
|
export * from './helpers';
|
|
@@ -17,6 +18,7 @@ export * from './KeyofType';
|
|
|
17
18
|
export * from './KeyType';
|
|
18
19
|
export * from './Method';
|
|
19
20
|
export * from './NamedType';
|
|
21
|
+
export * from './NamedValue';
|
|
20
22
|
export * from './NamespaceDeclaration';
|
|
21
23
|
export * from './ObjectType';
|
|
22
24
|
export * from './Parameter';
|
|
@@ -28,5 +30,6 @@ export * from './TupleType';
|
|
|
28
30
|
export * from './TypeBuilder';
|
|
29
31
|
export * from './TypeDeclaration';
|
|
30
32
|
export * from './UnionType';
|
|
33
|
+
export * from './ValueBuilder';
|
|
31
34
|
export * from './WellKnownSymbol';
|
|
32
35
|
export * from './Writer';
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __reExport(index_exports, require("./DocComment"), module.exports);
|
|
|
25
25
|
__reExport(index_exports, require("./Export"), module.exports);
|
|
26
26
|
__reExport(index_exports, require("./ExportFrom"), module.exports);
|
|
27
27
|
__reExport(index_exports, require("./File"), module.exports);
|
|
28
|
+
__reExport(index_exports, require("./FunctionCall"), module.exports);
|
|
28
29
|
__reExport(index_exports, require("./FunctionType"), module.exports);
|
|
29
30
|
__reExport(index_exports, require("./GenericParameter"), module.exports);
|
|
30
31
|
__reExport(index_exports, require("./helpers"), module.exports);
|
|
@@ -34,6 +35,7 @@ __reExport(index_exports, require("./KeyofType"), module.exports);
|
|
|
34
35
|
__reExport(index_exports, require("./KeyType"), module.exports);
|
|
35
36
|
__reExport(index_exports, require("./Method"), module.exports);
|
|
36
37
|
__reExport(index_exports, require("./NamedType"), module.exports);
|
|
38
|
+
__reExport(index_exports, require("./NamedValue"), module.exports);
|
|
37
39
|
__reExport(index_exports, require("./NamespaceDeclaration"), module.exports);
|
|
38
40
|
__reExport(index_exports, require("./ObjectType"), module.exports);
|
|
39
41
|
__reExport(index_exports, require("./Parameter"), module.exports);
|
|
@@ -45,6 +47,7 @@ __reExport(index_exports, require("./TupleType"), module.exports);
|
|
|
45
47
|
__reExport(index_exports, require("./TypeBuilder"), module.exports);
|
|
46
48
|
__reExport(index_exports, require("./TypeDeclaration"), module.exports);
|
|
47
49
|
__reExport(index_exports, require("./UnionType"), module.exports);
|
|
50
|
+
__reExport(index_exports, require("./ValueBuilder"), module.exports);
|
|
48
51
|
__reExport(index_exports, require("./WellKnownSymbol"), module.exports);
|
|
49
52
|
__reExport(index_exports, require("./Writer"), module.exports);
|
|
50
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -59,6 +62,7 @@ __reExport(index_exports, require("./Writer"), module.exports);
|
|
|
59
62
|
...require("./Export"),
|
|
60
63
|
...require("./ExportFrom"),
|
|
61
64
|
...require("./File"),
|
|
65
|
+
...require("./FunctionCall"),
|
|
62
66
|
...require("./FunctionType"),
|
|
63
67
|
...require("./GenericParameter"),
|
|
64
68
|
...require("./helpers"),
|
|
@@ -68,6 +72,7 @@ __reExport(index_exports, require("./Writer"), module.exports);
|
|
|
68
72
|
...require("./KeyType"),
|
|
69
73
|
...require("./Method"),
|
|
70
74
|
...require("./NamedType"),
|
|
75
|
+
...require("./NamedValue"),
|
|
71
76
|
...require("./NamespaceDeclaration"),
|
|
72
77
|
...require("./ObjectType"),
|
|
73
78
|
...require("./Parameter"),
|
|
@@ -79,6 +84,7 @@ __reExport(index_exports, require("./Writer"), module.exports);
|
|
|
79
84
|
...require("./TypeBuilder"),
|
|
80
85
|
...require("./TypeDeclaration"),
|
|
81
86
|
...require("./UnionType"),
|
|
87
|
+
...require("./ValueBuilder"),
|
|
82
88
|
...require("./WellKnownSymbol"),
|
|
83
89
|
...require("./Writer")
|
|
84
90
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./DocComment";
|
|
|
8
8
|
export * from "./Export";
|
|
9
9
|
export * from "./ExportFrom";
|
|
10
10
|
export * from "./File";
|
|
11
|
+
export * from "./FunctionCall";
|
|
11
12
|
export * from "./FunctionType";
|
|
12
13
|
export * from "./GenericParameter";
|
|
13
14
|
export * from "./helpers";
|
|
@@ -17,6 +18,7 @@ export * from "./KeyofType";
|
|
|
17
18
|
export * from "./KeyType";
|
|
18
19
|
export * from "./Method";
|
|
19
20
|
export * from "./NamedType";
|
|
21
|
+
export * from "./NamedValue";
|
|
20
22
|
export * from "./NamespaceDeclaration";
|
|
21
23
|
export * from "./ObjectType";
|
|
22
24
|
export * from "./Parameter";
|
|
@@ -28,5 +30,6 @@ export * from "./TupleType";
|
|
|
28
30
|
export * from "./TypeBuilder";
|
|
29
31
|
export * from "./TypeDeclaration";
|
|
30
32
|
export * from "./UnionType";
|
|
33
|
+
export * from "./ValueBuilder";
|
|
31
34
|
export * from "./WellKnownSymbol";
|
|
32
35
|
export * from "./Writer";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/ts-builders",
|
|
3
|
-
"version": "6.6.0-dev.
|
|
3
|
+
"version": "6.6.0-dev.97",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@prisma/internals": "6.6.0-dev.
|
|
27
|
+
"@prisma/internals": "6.6.0-dev.97"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vitest": "3.0.9"
|