@mastra/core 0.1.11 → 0.1.13
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/agents/file-logger.d.ts +0 -13
- package/dist/agents/file-logger.d.ts.map +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/openai/assistant.d.ts +16 -3
- package/dist/agents/openai/assistant.d.ts.map +1 -1
- package/dist/agents/utils.d.ts +7 -0
- package/dist/agents/utils.d.ts.map +1 -1
- package/dist/agents/vector-sync.d.ts +3 -2
- package/dist/agents/vector-sync.d.ts.map +1 -1
- package/dist/core.cjs.development.js +1673 -1395
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +1671 -1398
- package/dist/core.esm.js.map +1 -1
- package/dist/framework.d.ts +8 -3
- package/dist/framework.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/integration.d.ts.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/logger-utils/logger.d.ts +98 -0
- package/dist/lib/logger-utils/logger.d.ts.map +1 -0
- package/dist/next/cron.d.ts +13 -0
- package/dist/next/cron.d.ts.map +1 -0
- package/dist/next/index.d.ts.map +1 -1
- package/dist/schemas.d.ts +13 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/text.d.ts +2 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/vector-access/index.d.ts +4 -0
- package/dist/vector-access/index.d.ts.map +1 -1
- package/dist/workflows/apis.d.ts +9 -0
- package/dist/workflows/apis.d.ts.map +1 -0
- package/dist/workflows/handler.d.ts +8 -0
- package/dist/workflows/handler.d.ts.map +1 -1
- package/dist/workflows/runner.d.ts +3 -1
- package/dist/workflows/runner.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/prisma/client.ts +0 -31
- package/dist/prisma/gen.js +0 -139
- package/dist/prisma/migrations/20240828034109_initial_migration/migration.sql +0 -111
- package/dist/prisma/migrations/20240829210901_initial_migration/migration.sql +0 -1
- package/dist/prisma/migrations/20240905143158_initial_migration/migration.sql +0 -1
- package/dist/prisma/migrations/20240911212856_initial_migration/migration.sql +0 -1
- package/dist/prisma/migrations/20240915044235_initial_migration/migration.sql +0 -1
- package/dist/prisma/migrations/20241008024219_initial_migration/migration.sql +0 -69
- package/dist/prisma/migrations/migration_lock.toml +0 -3
- package/dist/prisma/schema.prisma +0 -129
package/dist/prisma/gen.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
const { writeFileSync } = require('fs');
|
|
2
|
-
|
|
3
|
-
const tmpl = `
|
|
4
|
-
enum PropertyType {
|
|
5
|
-
LONG_TEXT
|
|
6
|
-
SINGLE_LINE_TEXT
|
|
7
|
-
SINGLE_SELECT
|
|
8
|
-
MULTI_SELECT
|
|
9
|
-
CHECKBOX
|
|
10
|
-
DATE
|
|
11
|
-
USER
|
|
12
|
-
BADGE_LIST
|
|
13
|
-
CURRENCY
|
|
14
|
-
URL
|
|
15
|
-
PHONE
|
|
16
|
-
CONTACT
|
|
17
|
-
COMPANY
|
|
18
|
-
PERSON
|
|
19
|
-
ENRICHMENT
|
|
20
|
-
COMPOSITE
|
|
21
|
-
BOOLEAN
|
|
22
|
-
NUMBER
|
|
23
|
-
FLOAT
|
|
24
|
-
JSON_OBJECT
|
|
25
|
-
JSON_ARRAY
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
model Property {
|
|
29
|
-
id String @id @default(cuid())
|
|
30
|
-
name String
|
|
31
|
-
displayName String
|
|
32
|
-
visible Boolean @default(true)
|
|
33
|
-
config Json?
|
|
34
|
-
description String?
|
|
35
|
-
type PropertyType
|
|
36
|
-
order Int
|
|
37
|
-
modifiable Boolean @default(true)
|
|
38
|
-
parentId String? @map("parentId")
|
|
39
|
-
parent Property? @relation("PropertyToProperty", fields: [parentId], references: [id])
|
|
40
|
-
compositeProperty Property[] @relation("PropertyToProperty")
|
|
41
|
-
entity Entity? @relation(fields: [entityId], references: [id])
|
|
42
|
-
entityId String?
|
|
43
|
-
@@map("properties")
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
enum RecordStatus {
|
|
47
|
-
ACTIVE
|
|
48
|
-
ARCHIVED
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
enum RecordEnrichmentStatus {
|
|
52
|
-
PENDING
|
|
53
|
-
APPLIED
|
|
54
|
-
UNAPPLIED
|
|
55
|
-
FAILED
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
model Record {
|
|
59
|
-
id String @id @default(cuid())
|
|
60
|
-
externalId String?
|
|
61
|
-
data Json @default("{}")
|
|
62
|
-
source String @default("MANUAL")
|
|
63
|
-
entityType String
|
|
64
|
-
entity Entity? @relation(fields: [entityId], references: [id])
|
|
65
|
-
entityId String?
|
|
66
|
-
status RecordStatus @default(ACTIVE)
|
|
67
|
-
enrichmentStatus RecordEnrichmentStatus @default(UNAPPLIED)
|
|
68
|
-
deletedAt DateTime?
|
|
69
|
-
createdAt DateTime @default(now())
|
|
70
|
-
updatedAt DateTime? @default(now())
|
|
71
|
-
|
|
72
|
-
@@index([externalId])
|
|
73
|
-
@@map("records")
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
model Credential {
|
|
77
|
-
id String @id @default(cuid())
|
|
78
|
-
type String
|
|
79
|
-
value Json
|
|
80
|
-
scope String[]
|
|
81
|
-
connection Connection @relation(fields: [k_id], references: [id], onDelete: Cascade)
|
|
82
|
-
k_id String @unique
|
|
83
|
-
@@map("credentials")
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
model Connection {
|
|
87
|
-
id String @id @default(cuid())
|
|
88
|
-
name String
|
|
89
|
-
issues String[] @default([])
|
|
90
|
-
syncConfig Json?
|
|
91
|
-
connectionId String
|
|
92
|
-
createdAt DateTime @default(now())
|
|
93
|
-
updatedAt DateTime? @updatedAt
|
|
94
|
-
|
|
95
|
-
lastSyncAt DateTime?
|
|
96
|
-
credential Credential?
|
|
97
|
-
subscriptionId String?
|
|
98
|
-
entities Entity[]
|
|
99
|
-
@@unique([connectionId, name])
|
|
100
|
-
@@index([subscriptionId])
|
|
101
|
-
@@map("connections")
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
model Entity {
|
|
105
|
-
id String @id @default(cuid())
|
|
106
|
-
type String
|
|
107
|
-
properties Property[]
|
|
108
|
-
records Record[]
|
|
109
|
-
|
|
110
|
-
createdAt DateTime @default(now())
|
|
111
|
-
updatedAt DateTime? @default(now())
|
|
112
|
-
createdBy String
|
|
113
|
-
|
|
114
|
-
connection Connection @relation(fields: [k_id], references: [id])
|
|
115
|
-
k_id String
|
|
116
|
-
|
|
117
|
-
lastSyncId String?
|
|
118
|
-
@@unique([k_id, type])
|
|
119
|
-
@@map("entity")
|
|
120
|
-
}
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
function main() {
|
|
124
|
-
const schema = `
|
|
125
|
-
datasource db {
|
|
126
|
-
provider = "postgresql"
|
|
127
|
-
url = env("DB_URL")
|
|
128
|
-
}
|
|
129
|
-
generator client {
|
|
130
|
-
provider = "prisma-client-js"
|
|
131
|
-
output = "../../node_modules/@prisma-app/client"
|
|
132
|
-
}
|
|
133
|
-
${tmpl}
|
|
134
|
-
`;
|
|
135
|
-
|
|
136
|
-
writeFileSync(__dirname + '/schema.prisma', schema);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
main();
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
-- CreateEnum
|
|
2
|
-
CREATE TYPE "PropertyType" AS ENUM ('LONG_TEXT', 'SINGLE_LINE_TEXT', 'SINGLE_SELECT', 'MULTI_SELECT', 'CHECKBOX', 'DATE', 'USER', 'BADGE_LIST', 'CURRENCY', 'URL', 'PHONE', 'CONTACT', 'COMPANY', 'PERSON', 'ENRICHMENT', 'COMPOSITE');
|
|
3
|
-
|
|
4
|
-
-- CreateEnum
|
|
5
|
-
CREATE TYPE "RecordStatus" AS ENUM ('ACTIVE', 'ARCHIVED');
|
|
6
|
-
|
|
7
|
-
-- CreateEnum
|
|
8
|
-
CREATE TYPE "RecordEnrichmentStatus" AS ENUM ('PENDING', 'APPLIED', 'UNAPPLIED', 'FAILED');
|
|
9
|
-
|
|
10
|
-
-- CreateTable
|
|
11
|
-
CREATE TABLE "properties" (
|
|
12
|
-
"id" TEXT NOT NULL,
|
|
13
|
-
"name" TEXT NOT NULL,
|
|
14
|
-
"displayName" TEXT NOT NULL,
|
|
15
|
-
"visible" BOOLEAN NOT NULL DEFAULT true,
|
|
16
|
-
"config" JSONB,
|
|
17
|
-
"description" TEXT,
|
|
18
|
-
"type" "PropertyType" NOT NULL,
|
|
19
|
-
"order" INTEGER NOT NULL,
|
|
20
|
-
"modifiable" BOOLEAN NOT NULL DEFAULT true,
|
|
21
|
-
"parentId" TEXT,
|
|
22
|
-
"entityId" TEXT,
|
|
23
|
-
|
|
24
|
-
CONSTRAINT "properties_pkey" PRIMARY KEY ("id")
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
-- CreateTable
|
|
28
|
-
CREATE TABLE "records" (
|
|
29
|
-
"id" TEXT NOT NULL,
|
|
30
|
-
"externalId" TEXT,
|
|
31
|
-
"data" JSONB NOT NULL DEFAULT '{}',
|
|
32
|
-
"source" TEXT NOT NULL DEFAULT 'MANUAL',
|
|
33
|
-
"entityType" TEXT NOT NULL,
|
|
34
|
-
"entityId" TEXT,
|
|
35
|
-
"status" "RecordStatus" NOT NULL DEFAULT 'ACTIVE',
|
|
36
|
-
"enrichmentStatus" "RecordEnrichmentStatus" NOT NULL DEFAULT 'UNAPPLIED',
|
|
37
|
-
"deletedAt" TIMESTAMP(3),
|
|
38
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
39
|
-
"updatedAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
|
40
|
-
|
|
41
|
-
CONSTRAINT "records_pkey" PRIMARY KEY ("id")
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
-- CreateTable
|
|
45
|
-
CREATE TABLE "credentials" (
|
|
46
|
-
"id" TEXT NOT NULL,
|
|
47
|
-
"type" TEXT NOT NULL,
|
|
48
|
-
"value" JSONB NOT NULL,
|
|
49
|
-
"scope" TEXT[],
|
|
50
|
-
"connectionId" TEXT NOT NULL,
|
|
51
|
-
|
|
52
|
-
CONSTRAINT "credentials_pkey" PRIMARY KEY ("id")
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
-- CreateTable
|
|
56
|
-
CREATE TABLE "connections" (
|
|
57
|
-
"id" TEXT NOT NULL,
|
|
58
|
-
"name" TEXT NOT NULL,
|
|
59
|
-
"issues" TEXT[] DEFAULT ARRAY[]::TEXT[],
|
|
60
|
-
"syncConfig" JSONB,
|
|
61
|
-
"referenceId" TEXT NOT NULL,
|
|
62
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
63
|
-
"updatedAt" TIMESTAMP(3),
|
|
64
|
-
"lastSyncAt" TIMESTAMP(3),
|
|
65
|
-
"subscriptionId" TEXT,
|
|
66
|
-
|
|
67
|
-
CONSTRAINT "connections_pkey" PRIMARY KEY ("id")
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
-- CreateTable
|
|
71
|
-
CREATE TABLE "entity" (
|
|
72
|
-
"id" TEXT NOT NULL,
|
|
73
|
-
"type" TEXT NOT NULL,
|
|
74
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
75
|
-
"updatedAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
|
76
|
-
"createdBy" TEXT NOT NULL,
|
|
77
|
-
"connectionId" TEXT NOT NULL,
|
|
78
|
-
"lastSyncId" TEXT,
|
|
79
|
-
|
|
80
|
-
CONSTRAINT "entity_pkey" PRIMARY KEY ("id")
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
-- CreateIndex
|
|
84
|
-
CREATE INDEX "records_externalId_idx" ON "records"("externalId");
|
|
85
|
-
|
|
86
|
-
-- CreateIndex
|
|
87
|
-
CREATE UNIQUE INDEX "credentials_connectionId_key" ON "credentials"("connectionId");
|
|
88
|
-
|
|
89
|
-
-- CreateIndex
|
|
90
|
-
CREATE INDEX "connections_subscriptionId_idx" ON "connections"("subscriptionId");
|
|
91
|
-
|
|
92
|
-
-- CreateIndex
|
|
93
|
-
CREATE UNIQUE INDEX "connections_referenceId_name_key" ON "connections"("referenceId", "name");
|
|
94
|
-
|
|
95
|
-
-- CreateIndex
|
|
96
|
-
CREATE UNIQUE INDEX "entity_connectionId_type_key" ON "entity"("connectionId", "type");
|
|
97
|
-
|
|
98
|
-
-- AddForeignKey
|
|
99
|
-
ALTER TABLE "properties" ADD CONSTRAINT "properties_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "properties"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
100
|
-
|
|
101
|
-
-- AddForeignKey
|
|
102
|
-
ALTER TABLE "properties" ADD CONSTRAINT "properties_entityId_fkey" FOREIGN KEY ("entityId") REFERENCES "entity"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
103
|
-
|
|
104
|
-
-- AddForeignKey
|
|
105
|
-
ALTER TABLE "records" ADD CONSTRAINT "records_entityId_fkey" FOREIGN KEY ("entityId") REFERENCES "entity"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
106
|
-
|
|
107
|
-
-- AddForeignKey
|
|
108
|
-
ALTER TABLE "credentials" ADD CONSTRAINT "credentials_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "connections"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
109
|
-
|
|
110
|
-
-- AddForeignKey
|
|
111
|
-
ALTER TABLE "entity" ADD CONSTRAINT "entity_connectionId_fkey" FOREIGN KEY ("connectionId") REFERENCES "connections"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- You are about to drop the column `referenceId` on the `connections` table. All the data in the column will be lost.
|
|
5
|
-
- You are about to drop the column `connectionId` on the `credentials` table. All the data in the column will be lost.
|
|
6
|
-
- You are about to drop the column `connectionId` on the `entity` table. All the data in the column will be lost.
|
|
7
|
-
- A unique constraint covering the columns `[connectionId,name]` on the table `connections` will be added. If there are existing duplicate values, this will fail.
|
|
8
|
-
- A unique constraint covering the columns `[k_id]` on the table `credentials` will be added. If there are existing duplicate values, this will fail.
|
|
9
|
-
- A unique constraint covering the columns `[k_id,type]` on the table `entity` will be added. If there are existing duplicate values, this will fail.
|
|
10
|
-
- Added the required column `connectionId` to the `connections` table without a default value. This is not possible if the table is not empty.
|
|
11
|
-
- Added the required column `k_id` to the `credentials` table without a default value. This is not possible if the table is not empty.
|
|
12
|
-
- Added the required column `k_id` to the `entity` table without a default value. This is not possible if the table is not empty.
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
-- AlterEnum
|
|
16
|
-
-- This migration adds more than one value to an enum.
|
|
17
|
-
-- With PostgreSQL versions 11 and earlier, this is not possible
|
|
18
|
-
-- in a single migration. This can be worked around by creating
|
|
19
|
-
-- multiple migrations, each migration adding only one value to
|
|
20
|
-
-- the enum.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ALTER TYPE "PropertyType" ADD VALUE 'BOOLEAN';
|
|
24
|
-
ALTER TYPE "PropertyType" ADD VALUE 'NUMBER';
|
|
25
|
-
ALTER TYPE "PropertyType" ADD VALUE 'FLOAT';
|
|
26
|
-
ALTER TYPE "PropertyType" ADD VALUE 'JSON_OBJECT';
|
|
27
|
-
ALTER TYPE "PropertyType" ADD VALUE 'JSON_ARRAY';
|
|
28
|
-
|
|
29
|
-
-- DropForeignKey
|
|
30
|
-
ALTER TABLE "credentials" DROP CONSTRAINT "credentials_connectionId_fkey";
|
|
31
|
-
|
|
32
|
-
-- DropForeignKey
|
|
33
|
-
ALTER TABLE "entity" DROP CONSTRAINT "entity_connectionId_fkey";
|
|
34
|
-
|
|
35
|
-
-- DropIndex
|
|
36
|
-
DROP INDEX "connections_referenceId_name_key";
|
|
37
|
-
|
|
38
|
-
-- DropIndex
|
|
39
|
-
DROP INDEX "credentials_connectionId_key";
|
|
40
|
-
|
|
41
|
-
-- DropIndex
|
|
42
|
-
DROP INDEX "entity_connectionId_type_key";
|
|
43
|
-
|
|
44
|
-
-- AlterTable
|
|
45
|
-
ALTER TABLE "connections" DROP COLUMN "referenceId",
|
|
46
|
-
ADD COLUMN "connectionId" TEXT NOT NULL;
|
|
47
|
-
|
|
48
|
-
-- AlterTable
|
|
49
|
-
ALTER TABLE "credentials" DROP COLUMN "connectionId",
|
|
50
|
-
ADD COLUMN "k_id" TEXT NOT NULL;
|
|
51
|
-
|
|
52
|
-
-- AlterTable
|
|
53
|
-
ALTER TABLE "entity" DROP COLUMN "connectionId",
|
|
54
|
-
ADD COLUMN "k_id" TEXT NOT NULL;
|
|
55
|
-
|
|
56
|
-
-- CreateIndex
|
|
57
|
-
CREATE UNIQUE INDEX "connections_connectionId_name_key" ON "connections"("connectionId", "name");
|
|
58
|
-
|
|
59
|
-
-- CreateIndex
|
|
60
|
-
CREATE UNIQUE INDEX "credentials_k_id_key" ON "credentials"("k_id");
|
|
61
|
-
|
|
62
|
-
-- CreateIndex
|
|
63
|
-
CREATE UNIQUE INDEX "entity_k_id_type_key" ON "entity"("k_id", "type");
|
|
64
|
-
|
|
65
|
-
-- AddForeignKey
|
|
66
|
-
ALTER TABLE "credentials" ADD CONSTRAINT "credentials_k_id_fkey" FOREIGN KEY ("k_id") REFERENCES "connections"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
67
|
-
|
|
68
|
-
-- AddForeignKey
|
|
69
|
-
ALTER TABLE "entity" ADD CONSTRAINT "entity_k_id_fkey" FOREIGN KEY ("k_id") REFERENCES "connections"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
datasource db {
|
|
3
|
-
provider = "postgresql"
|
|
4
|
-
url = env("DB_URL")
|
|
5
|
-
}
|
|
6
|
-
generator client {
|
|
7
|
-
provider = "prisma-client-js"
|
|
8
|
-
output = "../../node_modules/@prisma-app/client"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
enum PropertyType {
|
|
12
|
-
LONG_TEXT
|
|
13
|
-
SINGLE_LINE_TEXT
|
|
14
|
-
SINGLE_SELECT
|
|
15
|
-
MULTI_SELECT
|
|
16
|
-
CHECKBOX
|
|
17
|
-
DATE
|
|
18
|
-
USER
|
|
19
|
-
BADGE_LIST
|
|
20
|
-
CURRENCY
|
|
21
|
-
URL
|
|
22
|
-
PHONE
|
|
23
|
-
CONTACT
|
|
24
|
-
COMPANY
|
|
25
|
-
PERSON
|
|
26
|
-
ENRICHMENT
|
|
27
|
-
COMPOSITE
|
|
28
|
-
BOOLEAN
|
|
29
|
-
NUMBER
|
|
30
|
-
FLOAT
|
|
31
|
-
JSON_OBJECT
|
|
32
|
-
JSON_ARRAY
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
model Property {
|
|
36
|
-
id String @id @default(cuid())
|
|
37
|
-
name String
|
|
38
|
-
displayName String
|
|
39
|
-
visible Boolean @default(true)
|
|
40
|
-
config Json?
|
|
41
|
-
description String?
|
|
42
|
-
type PropertyType
|
|
43
|
-
order Int
|
|
44
|
-
modifiable Boolean @default(true)
|
|
45
|
-
parentId String? @map("parentId")
|
|
46
|
-
parent Property? @relation("PropertyToProperty", fields: [parentId], references: [id])
|
|
47
|
-
compositeProperty Property[] @relation("PropertyToProperty")
|
|
48
|
-
entity Entity? @relation(fields: [entityId], references: [id])
|
|
49
|
-
entityId String?
|
|
50
|
-
@@map("properties")
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
enum RecordStatus {
|
|
54
|
-
ACTIVE
|
|
55
|
-
ARCHIVED
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
enum RecordEnrichmentStatus {
|
|
59
|
-
PENDING
|
|
60
|
-
APPLIED
|
|
61
|
-
UNAPPLIED
|
|
62
|
-
FAILED
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
model Record {
|
|
66
|
-
id String @id @default(cuid())
|
|
67
|
-
externalId String?
|
|
68
|
-
data Json @default("{}")
|
|
69
|
-
source String @default("MANUAL")
|
|
70
|
-
entityType String
|
|
71
|
-
entity Entity? @relation(fields: [entityId], references: [id])
|
|
72
|
-
entityId String?
|
|
73
|
-
status RecordStatus @default(ACTIVE)
|
|
74
|
-
enrichmentStatus RecordEnrichmentStatus @default(UNAPPLIED)
|
|
75
|
-
deletedAt DateTime?
|
|
76
|
-
createdAt DateTime @default(now())
|
|
77
|
-
updatedAt DateTime? @default(now())
|
|
78
|
-
|
|
79
|
-
@@index([externalId])
|
|
80
|
-
@@map("records")
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
model Credential {
|
|
84
|
-
id String @id @default(cuid())
|
|
85
|
-
type String
|
|
86
|
-
value Json
|
|
87
|
-
scope String[]
|
|
88
|
-
connection Connection @relation(fields: [k_id], references: [id], onDelete: Cascade)
|
|
89
|
-
k_id String @unique
|
|
90
|
-
@@map("credentials")
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
model Connection {
|
|
94
|
-
id String @id @default(cuid())
|
|
95
|
-
name String
|
|
96
|
-
issues String[] @default([])
|
|
97
|
-
syncConfig Json?
|
|
98
|
-
connectionId String
|
|
99
|
-
createdAt DateTime @default(now())
|
|
100
|
-
updatedAt DateTime? @updatedAt
|
|
101
|
-
|
|
102
|
-
lastSyncAt DateTime?
|
|
103
|
-
credential Credential?
|
|
104
|
-
subscriptionId String?
|
|
105
|
-
entities Entity[]
|
|
106
|
-
@@unique([connectionId, name])
|
|
107
|
-
@@index([subscriptionId])
|
|
108
|
-
@@map("connections")
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
model Entity {
|
|
112
|
-
id String @id @default(cuid())
|
|
113
|
-
type String
|
|
114
|
-
properties Property[]
|
|
115
|
-
records Record[]
|
|
116
|
-
|
|
117
|
-
createdAt DateTime @default(now())
|
|
118
|
-
updatedAt DateTime? @default(now())
|
|
119
|
-
createdBy String
|
|
120
|
-
|
|
121
|
-
connection Connection @relation(fields: [k_id], references: [id])
|
|
122
|
-
k_id String
|
|
123
|
-
|
|
124
|
-
lastSyncId String?
|
|
125
|
-
@@unique([k_id, type])
|
|
126
|
-
@@map("entity")
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|