@wirecat/cli-core 0.604.0 → 0.606.0
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/CHANGELOG.md +159 -0
- package/dist/calendar/prepare.d.ts +4 -2
- package/dist/calendar/prepare.js +8 -8
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +2 -1
- package/dist/cli/messenger/contacts-command.js +3 -2
- package/dist/cli/messenger/doctor-command.js +14 -7
- package/dist/cli/messenger/store-maintenance-command.d.ts +34 -2
- package/dist/cli/messenger/store-maintenance-command.js +31 -4
- package/dist/cli/program.js +11 -2
- package/dist/cli/steps.js +9 -1
- package/dist/cli/store-recover.d.ts +10 -2
- package/dist/cli/store-recover.js +18 -4
- package/dist/cli/store-settings.js +38 -4
- package/dist/crm/cli/index.js +3 -1
- package/dist/crm/index.d.ts +2 -2
- package/dist/crm/index.js +1 -1
- package/dist/crm/source.d.ts +35 -5
- package/dist/crm/sync.d.ts +15 -7
- package/dist/crm/sync.js +169 -11
- package/dist/domain/crm.d.ts +41 -2
- package/dist/domain/deals.d.ts +5 -2
- package/dist/domain/deals.js +5 -2
- package/dist/domain/record-types.d.ts +61 -0
- package/dist/domain/record-types.js +26 -0
- package/dist/domain/records.d.ts +3 -5
- package/dist/domain/records.js +10 -13
- package/dist/domain/relations.d.ts +125 -0
- package/dist/domain/relations.js +107 -0
- package/dist/entities/contact-activity.d.ts +4 -0
- package/dist/entities/contact-activity.js +1 -0
- package/dist/entities/contact-context.d.ts +20 -0
- package/dist/entities/contact-context.js +2 -0
- package/dist/entities/deal.d.ts +2 -2
- package/dist/entities/deal.js +2 -1
- package/dist/entities/index.d.ts +39 -13
- package/dist/entities/relationship.d.ts +8 -2
- package/dist/entities/relationship.js +8 -2
- package/dist/entities/task-results.d.ts +10 -10
- package/dist/errors/failures.d.ts +17 -1
- package/dist/errors/failures.js +57 -1
- package/dist/errors/reasons.js +28 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/mail/cli/review.js +20 -6
- package/dist/mail/index.d.ts +1 -1
- package/dist/mail/marks.d.ts +10 -5
- package/dist/mail/marks.js +16 -8
- package/dist/mail/review.d.ts +5 -0
- package/dist/mcp/tool.js +2 -1
- package/dist/runs/recording.js +13 -4
- package/dist/services/deps.js +4 -6
- package/dist/services/index.d.ts +1 -1
- package/dist/services/link-scorers/chat-senders.d.ts +3 -2
- package/dist/services/link-scorers/chat-senders.js +7 -4
- package/dist/services/link-scorers/mail-thread.js +1 -0
- package/dist/services/link-scorers/member-chats.js +1 -0
- package/dist/services/link-scorers/member-dialog.d.ts +1 -1
- package/dist/services/link-scorers/member-dialog.js +4 -3
- package/dist/services/link-scorers/scan.d.ts +5 -2
- package/dist/services/link-scorers/scan.js +100 -54
- package/dist/services/link-scorers/shared.d.ts +2 -2
- package/dist/services/link-scorers/shared.js +8 -4
- package/dist/services/link-scorers/types.d.ts +3 -0
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/person-context.d.ts +24 -7
- package/dist/services/person-context.js +45 -11
- package/dist/services/person-preparation.js +4 -5
- package/dist/services/project-status/index.js +2 -1
- package/dist/services/stored-project-gathering.js +4 -3
- package/dist/store/damage.d.ts +3 -1
- package/dist/store/damage.js +19 -12
- package/dist/store/document-transfer/index.js +7 -0
- package/dist/store/exports.d.ts +1 -0
- package/dist/store/exports.js +1 -0
- package/dist/store/index.d.ts +7 -1
- package/dist/store/index.js +2 -0
- package/dist/store/marks.d.ts +57 -0
- package/dist/store/marks.js +121 -0
- package/dist/store/project-transfer/preview.js +12 -7
- package/dist/store/project-transfer/request.d.ts +4 -1
- package/dist/store/project-transfer/schema.d.ts +9 -2
- package/dist/store/project-transfer/schema.js +4 -0
- package/dist/store/project-transfer/snapshot-model.d.ts +8 -2
- package/dist/store/recover.js +16 -1
- package/dist/store/sqlite/crm-settings.d.ts +28 -0
- package/dist/store/sqlite/crm-settings.js +80 -0
- package/dist/store/sqlite/crm.d.ts +42 -2
- package/dist/store/sqlite/crm.js +397 -36
- package/dist/store/sqlite/deals.js +3 -2
- package/dist/store/sqlite/finance.d.ts +8 -1
- package/dist/store/sqlite/finance.js +10 -3
- package/dist/store/sqlite/involvement-queue.js +4 -3
- package/dist/store/sqlite/knowledge.d.ts +7 -3
- package/dist/store/sqlite/knowledge.js +43 -31
- package/dist/store/sqlite/link-kinds.d.ts +2 -3
- package/dist/store/sqlite/link-kinds.js +4 -2
- package/dist/store/sqlite/manifest.js +5 -0
- package/dist/store/sqlite/memories.d.ts +1 -1
- package/dist/store/sqlite/memories.js +33 -7
- package/dist/store/sqlite/migrations.generated.js +31 -0
- package/dist/store/sqlite/notes.d.ts +3 -2
- package/dist/store/sqlite/notes.js +23 -6
- package/dist/store/sqlite/open-store.js +4 -1
- package/dist/store/sqlite/organizations.d.ts +8 -0
- package/dist/store/sqlite/organizations.js +14 -0
- package/dist/store/sqlite/own-identities.d.ts +1 -1
- package/dist/store/sqlite/own-identities.js +7 -5
- package/dist/store/sqlite/person-links.d.ts +5 -2
- package/dist/store/sqlite/person-links.js +24 -18
- package/dist/store/sqlite/person-preparation.d.ts +1 -1
- package/dist/store/sqlite/person-preparation.js +3 -2
- package/dist/store/sqlite/person-separation.d.ts +5 -0
- package/dist/store/sqlite/person-separation.js +26 -0
- package/dist/store/sqlite/project-transfer/records.js +14 -3
- package/dist/store/sqlite/project-transfer/snapshot.d.ts +4 -1
- package/dist/store/sqlite/project-transfer/snapshot.js +6 -0
- package/dist/store/sqlite/record-projectors.d.ts +44 -0
- package/dist/store/sqlite/record-projectors.js +72 -0
- package/dist/store/sqlite/records.js +12 -70
- package/dist/store/sqlite/relation-list.d.ts +43 -0
- package/dist/store/sqlite/relation-list.js +133 -0
- package/dist/store/sqlite/relation-proposals.d.ts +28 -6
- package/dist/store/sqlite/relation-proposals.js +134 -10
- package/dist/store/sqlite/relation-reads.d.ts +8 -0
- package/dist/store/sqlite/relation-reads.js +7 -0
- package/dist/store/sqlite/relation-roles.d.ts +26 -0
- package/dist/store/sqlite/relation-roles.js +91 -0
- package/dist/store/sqlite/reported-relations.d.ts +63 -0
- package/dist/store/sqlite/reported-relations.js +132 -0
- package/dist/store/sqlite/schema/link-revisions.d.ts +136 -0
- package/dist/store/sqlite/schema/link-revisions.js +11 -0
- package/dist/store/sqlite/schema/links.d.ts +360 -0
- package/dist/store/sqlite/schema/links.js +32 -0
- package/dist/store/sqlite/schema.d.ts +2 -296
- package/dist/store/sqlite/schema.js +2 -24
- package/dist/store/sqlite/transaction.js +2 -5
- package/dist/store/store.d.ts +3 -0
- package/dist/store/store.js +5 -0
- package/dist/store/types.d.ts +5 -0
- package/package.json +5 -5
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type RelationKind } from "../../domain/relations.js";
|
|
2
|
+
import type { AccountKey } from "../types.js";
|
|
3
|
+
import type { Author } from "./memories.js";
|
|
4
|
+
import type { StoreContext } from "./open.js";
|
|
5
|
+
/** One relationship as a source account reports it, by the store's refs. */
|
|
6
|
+
export interface ReportedRelation {
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
kind: RelationKind;
|
|
10
|
+
role?: string | null;
|
|
11
|
+
/** Epoch ms; `endsAt` exclusive. Only what the source gives: never a guess. */
|
|
12
|
+
startsAt?: number | null;
|
|
13
|
+
endsAt?: number | null;
|
|
14
|
+
/** Kept on the link: the source's own role name, a job title, how it was derived. */
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Which of the account's relationships a call reports completely: those from the `from` refs or to the `to` refs, of
|
|
19
|
+
* these kinds and, when given, these roles. One it holds there and the call lacks is withdrawn; nothing else is touched.
|
|
20
|
+
*/
|
|
21
|
+
export interface ReportedScope {
|
|
22
|
+
from: string[];
|
|
23
|
+
to?: string[];
|
|
24
|
+
kinds: RelationKind[];
|
|
25
|
+
roles?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface ReportedIssue {
|
|
28
|
+
reason: "relationship.reference-unknown" | "relationship.invalid";
|
|
29
|
+
message: string;
|
|
30
|
+
from: string;
|
|
31
|
+
to: string;
|
|
32
|
+
kind: RelationKind;
|
|
33
|
+
}
|
|
34
|
+
export interface ReportedSync {
|
|
35
|
+
added: number;
|
|
36
|
+
kept: number;
|
|
37
|
+
restored: number;
|
|
38
|
+
withdrawn: number;
|
|
39
|
+
/** New relationships waiting as `relationship` proposals: the account's setting is `review`. */
|
|
40
|
+
proposed: number;
|
|
41
|
+
/** Left out: the owner removed or rejected that very relationship, role included. */
|
|
42
|
+
skippedOwnerRejected: number;
|
|
43
|
+
issues: ReportedIssue[];
|
|
44
|
+
}
|
|
45
|
+
export interface ReportedOptions {
|
|
46
|
+
/** `links.source` of a link it writes; `import` when absent. */
|
|
47
|
+
source?: string;
|
|
48
|
+
/** Who proposes in `review` mode; the source's provider, as a rule, when absent. */
|
|
49
|
+
by?: Exclude<Author, "owner">;
|
|
50
|
+
}
|
|
51
|
+
export interface RelationsStore {
|
|
52
|
+
/**
|
|
53
|
+
* Writes what a source account reports as a diff keyed by the relationship's unique key. A new one is a `reported`
|
|
54
|
+
* link (a `relationship` proposal when the account's `crm.<provider>:<account>.links` is `review`); one held is
|
|
55
|
+
* kept; one inside `scope` it no longer reports is withdrawn (`deleted_at`), never deleted. A link the owner
|
|
56
|
+
* confirmed is never withdrawn, and one the owner removed or rejected, with the same role, is never written again.
|
|
57
|
+
* Another role on a pair is another relationship. A ref the store does not hold is an issue, not an error.
|
|
58
|
+
*/
|
|
59
|
+
syncReported(key: AccountKey, relationships: ReportedRelation[], scope: ReportedScope, options?: ReportedOptions): Promise<ReportedSync>;
|
|
60
|
+
}
|
|
61
|
+
/** The call, inside a transaction the caller holds: a CRM page saves its rows and their relationships together. */
|
|
62
|
+
export declare const syncReportedIn: (context: StoreContext, key: AccountKey, relationships: ReportedRelation[], scope: ReportedScope, { source, by }?: ReportedOptions) => ReportedSync;
|
|
63
|
+
export declare const relationsStoreOver: (context: StoreContext) => RelationsStore;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { checkEnds, isSymmetric } from "../../domain/relations.js";
|
|
3
|
+
import { accountPk } from "./accounts.js";
|
|
4
|
+
import { crmLinkMode } from "./crm-settings.js";
|
|
5
|
+
import { linkKind } from "./link-kinds.js";
|
|
6
|
+
import { relationProposalsOver } from "./relation-proposals.js";
|
|
7
|
+
import { checkStoredRole } from "./relation-roles.js";
|
|
8
|
+
import { referenceOfThing, thingOf } from "./things.js";
|
|
9
|
+
import { write } from "./transaction.js";
|
|
10
|
+
const metadataOf = (relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null;
|
|
11
|
+
/** The call, inside a transaction the caller holds: a CRM page saves its rows and their relationships together. */
|
|
12
|
+
export const syncReportedIn = (context, key, relationships, scope, { source = "import", by = { bot: key.provider, kind: "rule" } } = {}) => {
|
|
13
|
+
const { database, now } = context;
|
|
14
|
+
const proposals = relationProposalsOver(context);
|
|
15
|
+
const accountId = accountPk(context, key);
|
|
16
|
+
const review = crmLinkMode(database, key) === "review";
|
|
17
|
+
const at = now();
|
|
18
|
+
const result = {
|
|
19
|
+
added: 0,
|
|
20
|
+
kept: 0,
|
|
21
|
+
restored: 0,
|
|
22
|
+
withdrawn: 0,
|
|
23
|
+
proposed: 0,
|
|
24
|
+
skippedOwnerRejected: 0,
|
|
25
|
+
issues: [],
|
|
26
|
+
};
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
const issue = (relation, reason, message) => result.issues.push({ reason, message, from: relation.from, to: relation.to, kind: relation.kind });
|
|
29
|
+
const sameKey = "kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND anchor IS NULL AND ifnull(role, '') = ?";
|
|
30
|
+
for (const relation of relationships) {
|
|
31
|
+
let from = thingOf(database, relation.from);
|
|
32
|
+
let to = thingOf(database, relation.to);
|
|
33
|
+
if (!from || !to) {
|
|
34
|
+
issue(relation, "relationship.reference-unknown", `${!from ? relation.from : relation.to} is not in the store`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const role = relation.role?.trim() || null;
|
|
38
|
+
try {
|
|
39
|
+
if (from.type === to.type && from.id === to.id)
|
|
40
|
+
throw new CliError("validation_error", "a relationship needs two distinct ends");
|
|
41
|
+
checkEnds(relation.kind, from.type, to.type);
|
|
42
|
+
if (role !== null)
|
|
43
|
+
checkStoredRole(database, relation.kind, from.type, to.type, role);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (!(error instanceof CliError))
|
|
47
|
+
throw error;
|
|
48
|
+
issue(relation, "relationship.invalid", error.message);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (isSymmetric(relation.kind) && to.id < from.id)
|
|
52
|
+
[from, to] = [to, from];
|
|
53
|
+
const wanted = [relation.kind, from.type, from.id, to.type, to.id, role ?? ""];
|
|
54
|
+
// The owner's link of the same role answers for the source too, and a confirmed one is never withdrawn.
|
|
55
|
+
if (database.prepare(`SELECT 1 FROM links WHERE ${sameKey} AND confirmed = 1 LIMIT 1`).get(...wanted))
|
|
56
|
+
continue;
|
|
57
|
+
const toRef = referenceOfThing(database, to);
|
|
58
|
+
if (rejected(context, from, toRef, relation.kind, role)) {
|
|
59
|
+
result.skippedOwnerRejected += 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const held = database.prepare(`SELECT * FROM links WHERE ${sameKey} AND account_id = ?`).get(...wanted, accountId);
|
|
63
|
+
const startsAt = relation.startsAt ?? null;
|
|
64
|
+
const endsAt = relation.endsAt ?? null;
|
|
65
|
+
const metadata = metadataOf(relation);
|
|
66
|
+
if (held) {
|
|
67
|
+
seen.add(Number(held.id));
|
|
68
|
+
if (held.deleted_at != null)
|
|
69
|
+
result.restored += 1;
|
|
70
|
+
else
|
|
71
|
+
result.kept += 1;
|
|
72
|
+
database
|
|
73
|
+
.prepare("UPDATE links SET deleted_at = NULL, starts_at = ?, ends_at = ?, metadata = ?, updated_at = ? WHERE id = ?")
|
|
74
|
+
.run(startsAt, endsAt, metadata, at, Number(held.id));
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (review) {
|
|
78
|
+
proposals.propose(from, {
|
|
79
|
+
from: referenceOfThing(database, from),
|
|
80
|
+
to: toRef,
|
|
81
|
+
kind: relation.kind,
|
|
82
|
+
...(role === null ? {} : { role }),
|
|
83
|
+
reason: `reported by ${key.provider}:${key.account}`,
|
|
84
|
+
}, by);
|
|
85
|
+
result.proposed += 1;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const row = database
|
|
89
|
+
.prepare("INSERT INTO links (from_type, from_id, to_type, to_id, kind, role, source, metadata, confirmed, account_id, " +
|
|
90
|
+
"starts_at, ends_at, created_at, author, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, 'rule', ?) " +
|
|
91
|
+
"RETURNING id")
|
|
92
|
+
.get(from.type, from.id, to.type, to.id, relation.kind, role, source, metadata, accountId, startsAt, endsAt, at, at);
|
|
93
|
+
seen.add(Number(row?.id));
|
|
94
|
+
result.added += 1;
|
|
95
|
+
}
|
|
96
|
+
const withdraw = database.prepare("UPDATE links SET deleted_at = ?, updated_at = ? WHERE id = ?");
|
|
97
|
+
const kinds = scope.kinds.map(linkKind).join(", ");
|
|
98
|
+
const roles = scope.roles?.map(() => "?").join(", ");
|
|
99
|
+
const ends = [
|
|
100
|
+
...[...new Set(scope.from)].map((ref) => ["from", ref]),
|
|
101
|
+
...[...new Set(scope.to ?? [])].map((ref) => ["to", ref]),
|
|
102
|
+
];
|
|
103
|
+
for (const [end, ref] of kinds ? ends : []) {
|
|
104
|
+
const thing = thingOf(database, ref);
|
|
105
|
+
if (!thing)
|
|
106
|
+
continue;
|
|
107
|
+
// A partnership is stored once, either way round, so either end covers it.
|
|
108
|
+
const match = end === "from"
|
|
109
|
+
? `((from_type = ? AND from_id = ?) OR (kind = ${linkKind("partner-of")} AND to_type = ? AND to_id = ?))`
|
|
110
|
+
: `((to_type = ? AND to_id = ?) OR (kind = ${linkKind("partner-of")} AND from_type = ? AND from_id = ?))`;
|
|
111
|
+
const rows = database
|
|
112
|
+
.prepare(`SELECT id FROM links WHERE account_id = ? AND confirmed = 0 AND deleted_at IS NULL AND kind IN (${kinds}) ` +
|
|
113
|
+
`AND ${match}${roles ? ` AND ifnull(role, '') IN (${roles})` : ""}`)
|
|
114
|
+
.all(accountId, thing.type, thing.id, thing.type, thing.id, ...(scope.roles ?? []));
|
|
115
|
+
for (const row of rows)
|
|
116
|
+
if (!seen.has(Number(row.id))) {
|
|
117
|
+
seen.add(Number(row.id));
|
|
118
|
+
withdraw.run(at, at, Number(row.id));
|
|
119
|
+
result.withdrawn += 1;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
};
|
|
124
|
+
/** The owner rejected or removed exactly this relationship: its pair, kind and role, whoever reported it. */
|
|
125
|
+
const rejected = ({ database }, from, to, kind, role) => database
|
|
126
|
+
.prepare("SELECT 1 FROM proposed_actions WHERE kind = 'relationship' AND status = 'rejected' AND target_type = ? " +
|
|
127
|
+
"AND target_id = ? AND json_extract(payload, '$.to') = ? AND json_extract(payload, '$.kind') = ? " +
|
|
128
|
+
"AND json_extract(payload, '$.role') IS ? LIMIT 1")
|
|
129
|
+
.get(from.type, from.id, to, kind, role) !== undefined;
|
|
130
|
+
export const relationsStoreOver = (context) => ({
|
|
131
|
+
syncReported: async (key, relationships, scope, options) => write(context.database, () => syncReportedIn(context, key, relationships, scope, options)),
|
|
132
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export declare const linkRevisions: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2
|
+
name: "link_revisions";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
6
|
+
name: string;
|
|
7
|
+
tableName: "link_revisions";
|
|
8
|
+
dataType: "number int53";
|
|
9
|
+
data: number;
|
|
10
|
+
driverParam: number;
|
|
11
|
+
notNull: true;
|
|
12
|
+
hasDefault: true;
|
|
13
|
+
isPrimaryKey: true;
|
|
14
|
+
isAutoincrement: false;
|
|
15
|
+
hasRuntimeDefault: false;
|
|
16
|
+
enumValues: undefined;
|
|
17
|
+
baseColumn: never;
|
|
18
|
+
identity: undefined;
|
|
19
|
+
generated: undefined;
|
|
20
|
+
}, {}>;
|
|
21
|
+
linkId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
22
|
+
name: string;
|
|
23
|
+
tableName: "link_revisions";
|
|
24
|
+
dataType: "number int53";
|
|
25
|
+
data: number;
|
|
26
|
+
driverParam: number;
|
|
27
|
+
notNull: true;
|
|
28
|
+
hasDefault: false;
|
|
29
|
+
isPrimaryKey: false;
|
|
30
|
+
isAutoincrement: false;
|
|
31
|
+
hasRuntimeDefault: false;
|
|
32
|
+
enumValues: undefined;
|
|
33
|
+
baseColumn: never;
|
|
34
|
+
identity: undefined;
|
|
35
|
+
generated: undefined;
|
|
36
|
+
}, {}>;
|
|
37
|
+
change: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
38
|
+
name: string;
|
|
39
|
+
tableName: "link_revisions";
|
|
40
|
+
dataType: "string";
|
|
41
|
+
data: string;
|
|
42
|
+
driverParam: string;
|
|
43
|
+
notNull: true;
|
|
44
|
+
hasDefault: false;
|
|
45
|
+
isPrimaryKey: false;
|
|
46
|
+
isAutoincrement: false;
|
|
47
|
+
hasRuntimeDefault: false;
|
|
48
|
+
enumValues: [string, ...string[]];
|
|
49
|
+
baseColumn: never;
|
|
50
|
+
identity: undefined;
|
|
51
|
+
generated: undefined;
|
|
52
|
+
}, {}>;
|
|
53
|
+
before: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
54
|
+
name: string;
|
|
55
|
+
tableName: "link_revisions";
|
|
56
|
+
dataType: "string";
|
|
57
|
+
data: string;
|
|
58
|
+
driverParam: string;
|
|
59
|
+
notNull: false;
|
|
60
|
+
hasDefault: false;
|
|
61
|
+
isPrimaryKey: false;
|
|
62
|
+
isAutoincrement: false;
|
|
63
|
+
hasRuntimeDefault: false;
|
|
64
|
+
enumValues: [string, ...string[]];
|
|
65
|
+
baseColumn: never;
|
|
66
|
+
identity: undefined;
|
|
67
|
+
generated: undefined;
|
|
68
|
+
}, {}>;
|
|
69
|
+
after: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
70
|
+
name: string;
|
|
71
|
+
tableName: "link_revisions";
|
|
72
|
+
dataType: "string";
|
|
73
|
+
data: string;
|
|
74
|
+
driverParam: string;
|
|
75
|
+
notNull: false;
|
|
76
|
+
hasDefault: false;
|
|
77
|
+
isPrimaryKey: false;
|
|
78
|
+
isAutoincrement: false;
|
|
79
|
+
hasRuntimeDefault: false;
|
|
80
|
+
enumValues: [string, ...string[]];
|
|
81
|
+
baseColumn: never;
|
|
82
|
+
identity: undefined;
|
|
83
|
+
generated: undefined;
|
|
84
|
+
}, {}>;
|
|
85
|
+
author: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
86
|
+
name: string;
|
|
87
|
+
tableName: "link_revisions";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
data: string;
|
|
90
|
+
driverParam: string;
|
|
91
|
+
notNull: false;
|
|
92
|
+
hasDefault: false;
|
|
93
|
+
isPrimaryKey: false;
|
|
94
|
+
isAutoincrement: false;
|
|
95
|
+
hasRuntimeDefault: false;
|
|
96
|
+
enumValues: [string, ...string[]];
|
|
97
|
+
baseColumn: never;
|
|
98
|
+
identity: undefined;
|
|
99
|
+
generated: undefined;
|
|
100
|
+
}, {}>;
|
|
101
|
+
accountId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
102
|
+
name: string;
|
|
103
|
+
tableName: "link_revisions";
|
|
104
|
+
dataType: "number int53";
|
|
105
|
+
data: number;
|
|
106
|
+
driverParam: number;
|
|
107
|
+
notNull: false;
|
|
108
|
+
hasDefault: false;
|
|
109
|
+
isPrimaryKey: false;
|
|
110
|
+
isAutoincrement: false;
|
|
111
|
+
hasRuntimeDefault: false;
|
|
112
|
+
enumValues: undefined;
|
|
113
|
+
baseColumn: never;
|
|
114
|
+
identity: undefined;
|
|
115
|
+
generated: undefined;
|
|
116
|
+
}, {}>;
|
|
117
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
118
|
+
name: string;
|
|
119
|
+
tableName: "link_revisions";
|
|
120
|
+
dataType: "number int53";
|
|
121
|
+
data: number;
|
|
122
|
+
driverParam: number;
|
|
123
|
+
notNull: true;
|
|
124
|
+
hasDefault: false;
|
|
125
|
+
isPrimaryKey: false;
|
|
126
|
+
isAutoincrement: false;
|
|
127
|
+
hasRuntimeDefault: false;
|
|
128
|
+
enumValues: undefined;
|
|
129
|
+
baseColumn: never;
|
|
130
|
+
identity: undefined;
|
|
131
|
+
generated: undefined;
|
|
132
|
+
}, {}>;
|
|
133
|
+
};
|
|
134
|
+
dialect: 'sqlite';
|
|
135
|
+
isAlias: false;
|
|
136
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { index, integer, sqliteTable, text } from "../drizzle/core.js";
|
|
2
|
+
export const linkRevisions = sqliteTable("link_revisions", {
|
|
3
|
+
id: integer("id").primaryKey(),
|
|
4
|
+
linkId: integer("link_id").notNull(),
|
|
5
|
+
change: text("change").notNull(),
|
|
6
|
+
before: text("before"),
|
|
7
|
+
after: text("after"),
|
|
8
|
+
author: text("author"),
|
|
9
|
+
accountId: integer("account_id"),
|
|
10
|
+
createdAt: integer("created_at").notNull(),
|
|
11
|
+
}, (table) => [index("link_revisions_by_link_id_created_at").on(table.linkId, table.createdAt)]);
|