@a_team/prisma 2.0.0 → 2.0.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.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.PrismaClient = exports.disconnect = exports.connect = void 0;
|
|
18
|
+
const client_1 = require("@prisma/client");
|
|
19
|
+
let prisma = null;
|
|
20
|
+
const connect = (connectionString) => {
|
|
21
|
+
if (!prisma) {
|
|
22
|
+
prisma = new client_1.PrismaClient({
|
|
23
|
+
datasources: {
|
|
24
|
+
db: { url: connectionString }
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return prisma;
|
|
29
|
+
};
|
|
30
|
+
exports.connect = connect;
|
|
31
|
+
const disconnect = async () => {
|
|
32
|
+
if (prisma) {
|
|
33
|
+
await prisma.$disconnect();
|
|
34
|
+
prisma = null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.disconnect = disconnect;
|
|
38
|
+
__exportStar(require("./models"), exports);
|
|
39
|
+
var client_2 = require("@prisma/client");
|
|
40
|
+
Object.defineProperty(exports, "PrismaClient", { enumerable: true, get: function () { return client_2.PrismaClient; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// npx ts-node playground/contract.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const client_1 = require("@prisma/client");
|
|
5
|
+
const prisma = new client_1.PrismaClient();
|
|
6
|
+
async function main() {
|
|
7
|
+
const contract = await prisma.contract.findUnique({
|
|
8
|
+
where: { sid: "66cf64d100e0d700127facdf" },
|
|
9
|
+
include: {
|
|
10
|
+
mission: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
console.log(contract);
|
|
14
|
+
}
|
|
15
|
+
main()
|
|
16
|
+
.then(async () => {
|
|
17
|
+
await prisma.$disconnect();
|
|
18
|
+
})
|
|
19
|
+
.catch(async (e) => {
|
|
20
|
+
console.error(e);
|
|
21
|
+
await prisma.$disconnect();
|
|
22
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// npx ts-node playground/contracts.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const client_1 = require("@prisma/client");
|
|
5
|
+
const prisma = new client_1.PrismaClient();
|
|
6
|
+
async function main() {
|
|
7
|
+
const contracts = await prisma.contract.findMany({
|
|
8
|
+
take: 5,
|
|
9
|
+
});
|
|
10
|
+
console.log(contracts);
|
|
11
|
+
}
|
|
12
|
+
main()
|
|
13
|
+
.then(async () => {
|
|
14
|
+
await prisma.$disconnect();
|
|
15
|
+
})
|
|
16
|
+
.catch(async (e) => {
|
|
17
|
+
console.error(e);
|
|
18
|
+
await prisma.$disconnect();
|
|
19
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// npx ts-node playground/missionSpec.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const client_1 = require("@prisma/client");
|
|
5
|
+
const prisma = new client_1.PrismaClient();
|
|
6
|
+
async function main() {
|
|
7
|
+
const missionSpec = await prisma.missionSpec.findUnique({
|
|
8
|
+
where: { id: "66b3856aa504b6860c86f3ac" },
|
|
9
|
+
select: {
|
|
10
|
+
account: {
|
|
11
|
+
select: {
|
|
12
|
+
company: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
console.log(missionSpec);
|
|
18
|
+
}
|
|
19
|
+
main()
|
|
20
|
+
.then(async () => {
|
|
21
|
+
await prisma.$disconnect();
|
|
22
|
+
})
|
|
23
|
+
.catch(async (e) => {
|
|
24
|
+
console.error(e);
|
|
25
|
+
await prisma.$disconnect();
|
|
26
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// npx ts-node playground/missionSpecs.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const client_1 = require("@prisma/client");
|
|
5
|
+
const prisma = new client_1.PrismaClient();
|
|
6
|
+
async function main() {
|
|
7
|
+
const missionSpec = await prisma.missionSpec.findMany({
|
|
8
|
+
take: 5,
|
|
9
|
+
});
|
|
10
|
+
console.log(missionSpec);
|
|
11
|
+
}
|
|
12
|
+
main()
|
|
13
|
+
.then(async () => {
|
|
14
|
+
await prisma.$disconnect();
|
|
15
|
+
})
|
|
16
|
+
.catch(async (e) => {
|
|
17
|
+
console.error(e);
|
|
18
|
+
await prisma.$disconnect();
|
|
19
|
+
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a_team/prisma",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "tsc",
|
|
6
|
+
"build": "rm -rf ./dist & tsc",
|
|
7
7
|
"generate": "npx prisma generate",
|
|
8
8
|
"format": "npx prisma format",
|
|
9
9
|
"postinstall": "npx prisma generate"
|