@sealkeeper/schema 0.4.5 → 0.4.7

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.
Files changed (73) hide show
  1. package/README.md +2 -2
  2. package/dist/api.d.ts +30 -38
  3. package/dist/api.js +87 -42
  4. package/dist/client-address.d.ts +6 -0
  5. package/dist/client-address.js +81 -0
  6. package/dist/credential.d.ts +1 -66
  7. package/dist/credential.js +25 -63
  8. package/dist/events.d.ts +1 -0
  9. package/dist/events.js +13 -1
  10. package/dist/goal.js +2 -2
  11. package/dist/hidden.d.ts +1 -0
  12. package/dist/hidden.js +5 -0
  13. package/dist/index.d.ts +3 -1
  14. package/dist/index.js +3 -1
  15. package/dist/json-shape.d.ts +9 -0
  16. package/dist/json-shape.js +70 -0
  17. package/dist/moderation.d.ts +2 -1
  18. package/dist/moderation.js +169 -75
  19. package/dist/seal-conformance.js +2 -2
  20. package/dist/seal-verify.d.ts +21 -0
  21. package/dist/seal-verify.js +63 -0
  22. package/dist/standing.js +1 -1
  23. package/dist/tasks.d.ts +2 -0
  24. package/dist/tasks.js +14 -4
  25. package/package.json +2 -6
  26. package/dist/db/agent-milestones.d.ts +0 -75
  27. package/dist/db/agent-milestones.js +0 -16
  28. package/dist/db/agent-renames.d.ts +0 -126
  29. package/dist/db/agent-renames.js +0 -20
  30. package/dist/db/agents.d.ts +0 -266
  31. package/dist/db/agents.js +0 -79
  32. package/dist/db/client.d.ts +0 -2471
  33. package/dist/db/client.js +0 -40
  34. package/dist/db/credentials.d.ts +0 -143
  35. package/dist/db/credentials.js +0 -16
  36. package/dist/db/deleted-operators.d.ts +0 -75
  37. package/dist/db/deleted-operators.js +0 -13
  38. package/dist/db/events.d.ts +0 -160
  39. package/dist/db/events.js +0 -41
  40. package/dist/db/feed-items.d.ts +0 -109
  41. package/dist/db/feed-items.js +0 -21
  42. package/dist/db/index.d.ts +0 -76
  43. package/dist/db/index.js +0 -28
  44. package/dist/db/migrate.d.ts +0 -1
  45. package/dist/db/migrate.js +0 -34
  46. package/dist/db/migrator.d.ts +0 -4
  47. package/dist/db/migrator.js +0 -26
  48. package/dist/db/operator-identities.d.ts +0 -211
  49. package/dist/db/operator-identities.js +0 -49
  50. package/dist/db/operator-level-grants.d.ts +0 -109
  51. package/dist/db/operator-level-grants.js +0 -30
  52. package/dist/db/operator-slugs.d.ts +0 -92
  53. package/dist/db/operator-slugs.js +0 -25
  54. package/dist/db/operators.d.ts +0 -228
  55. package/dist/db/operators.js +0 -39
  56. package/dist/db/quota-counters.d.ts +0 -109
  57. package/dist/db/quota-counters.js +0 -17
  58. package/dist/db/ratings.d.ts +0 -160
  59. package/dist/db/ratings.js +0 -27
  60. package/dist/db/scores.d.ts +0 -160
  61. package/dist/db/scores.js +0 -15
  62. package/dist/db/standing.d.ts +0 -264
  63. package/dist/db/standing.js +0 -34
  64. package/dist/db/task-claim-failures.d.ts +0 -143
  65. package/dist/db/task-claim-failures.js +0 -37
  66. package/dist/db/task-outcomes.d.ts +0 -145
  67. package/dist/db/task-outcomes.js +0 -25
  68. package/dist/db/tasks.d.ts +0 -381
  69. package/dist/db/tasks.js +0 -100
  70. package/dist/db/timestamps.d.ts +0 -4
  71. package/dist/db/timestamps.js +0 -24
  72. package/dist/db/url.d.ts +0 -12
  73. package/dist/db/url.js +0 -25
@@ -1,25 +0,0 @@
1
- import { bigserial, index, pgTable, text, uuid } from 'drizzle-orm/pg-core';
2
- import { operators } from './operators.js';
3
- import { timestamps } from './timestamps.js';
4
- // One row per operator slug change, holding the slug given up. For
5
- // SLUG_REDIRECT_DAYS after created_at a handle with the old slug answers
6
- // 404 renamed with the new handle, and no other operator can take the old
7
- // slug. The operator itself can take it back.
8
- //
9
- // operator_id is null once the operator is deleted. deleteOperator adds a
10
- // row for its current slug then and clears operator_id on the rows still
11
- // inside their hold, so those slugs stay held for everyone for the rest of
12
- // SLUG_REDIRECT_DAYS. With no operator to follow, a handle with one of them
13
- // answers 404 not_found. The row keeps only the slug string and its dates.
14
- //
15
- // The scoring run deletes every row once SLUG_REDIRECT_DAYS are up, with
16
- // an operator or without, since past that it redirects and holds nothing.
17
- export const operatorSlugs = pgTable('operator_slugs', {
18
- id: bigserial('id', { mode: 'number' }).primaryKey(),
19
- operatorId: uuid('operator_id').references(() => operators.id),
20
- oldSlug: text('old_slug').notNull(),
21
- ...timestamps,
22
- }, (t) => [
23
- index('operator_slugs_old_slug_created_idx').on(t.oldSlug, t.createdAt),
24
- index('operator_slugs_operator_idx').on(t.operatorId),
25
- ]);
@@ -1,228 +0,0 @@
1
- export declare const operators: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
- name: "operators";
3
- schema: undefined;
4
- columns: {
5
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
6
- name: "created_at";
7
- tableName: "operators";
8
- dataType: "date";
9
- columnType: "PgTimestamp";
10
- data: Date;
11
- driverParam: string;
12
- notNull: true;
13
- hasDefault: true;
14
- isPrimaryKey: false;
15
- isAutoincrement: false;
16
- hasRuntimeDefault: false;
17
- enumValues: undefined;
18
- baseColumn: never;
19
- identity: undefined;
20
- generated: undefined;
21
- }, {}, {}>;
22
- updatedAt: import("drizzle-orm/pg-core").PgColumn<{
23
- name: "updated_at";
24
- tableName: "operators";
25
- dataType: "date";
26
- columnType: "PgTimestamp";
27
- data: Date;
28
- driverParam: string;
29
- notNull: true;
30
- hasDefault: true;
31
- isPrimaryKey: false;
32
- isAutoincrement: false;
33
- hasRuntimeDefault: false;
34
- enumValues: undefined;
35
- baseColumn: never;
36
- identity: undefined;
37
- generated: undefined;
38
- }, {}, {}>;
39
- id: import("drizzle-orm/pg-core").PgColumn<{
40
- name: "id";
41
- tableName: "operators";
42
- dataType: "string";
43
- columnType: "PgUUID";
44
- data: string;
45
- driverParam: string;
46
- notNull: true;
47
- hasDefault: true;
48
- isPrimaryKey: true;
49
- isAutoincrement: false;
50
- hasRuntimeDefault: false;
51
- enumValues: undefined;
52
- baseColumn: never;
53
- identity: undefined;
54
- generated: undefined;
55
- }, {}, {}>;
56
- githubId: import("drizzle-orm/pg-core").PgColumn<{
57
- name: "github_id";
58
- tableName: "operators";
59
- dataType: "number";
60
- columnType: "PgBigInt53";
61
- data: number;
62
- driverParam: string | number;
63
- notNull: true;
64
- hasDefault: false;
65
- isPrimaryKey: false;
66
- isAutoincrement: false;
67
- hasRuntimeDefault: false;
68
- enumValues: undefined;
69
- baseColumn: never;
70
- identity: undefined;
71
- generated: undefined;
72
- }, {}, {}>;
73
- login: import("drizzle-orm/pg-core").PgColumn<{
74
- name: "login";
75
- tableName: "operators";
76
- dataType: "string";
77
- columnType: "PgText";
78
- data: string;
79
- driverParam: string;
80
- notNull: true;
81
- hasDefault: false;
82
- isPrimaryKey: false;
83
- isAutoincrement: false;
84
- hasRuntimeDefault: false;
85
- enumValues: [string, ...string[]];
86
- baseColumn: never;
87
- identity: undefined;
88
- generated: undefined;
89
- }, {}, {}>;
90
- slug: import("drizzle-orm/pg-core").PgColumn<{
91
- name: "slug";
92
- tableName: "operators";
93
- dataType: "string";
94
- columnType: "PgText";
95
- data: string;
96
- driverParam: string;
97
- notNull: true;
98
- hasDefault: false;
99
- isPrimaryKey: false;
100
- isAutoincrement: false;
101
- hasRuntimeDefault: false;
102
- enumValues: [string, ...string[]];
103
- baseColumn: never;
104
- identity: undefined;
105
- generated: undefined;
106
- }, {}, {}>;
107
- displayName: import("drizzle-orm/pg-core").PgColumn<{
108
- name: "display_name";
109
- tableName: "operators";
110
- dataType: "string";
111
- columnType: "PgText";
112
- data: string;
113
- driverParam: string;
114
- notNull: true;
115
- hasDefault: false;
116
- isPrimaryKey: false;
117
- isAutoincrement: false;
118
- hasRuntimeDefault: false;
119
- enumValues: [string, ...string[]];
120
- baseColumn: never;
121
- identity: undefined;
122
- generated: undefined;
123
- }, {}, {}>;
124
- displayNameKey: import("drizzle-orm/pg-core").PgColumn<{
125
- name: "display_name_key";
126
- tableName: "operators";
127
- dataType: "string";
128
- columnType: "PgText";
129
- data: string;
130
- driverParam: string;
131
- notNull: true;
132
- hasDefault: false;
133
- isPrimaryKey: false;
134
- isAutoincrement: false;
135
- hasRuntimeDefault: false;
136
- enumValues: [string, ...string[]];
137
- baseColumn: never;
138
- identity: undefined;
139
- generated: undefined;
140
- }, {}, {}>;
141
- slugChangedAt: import("drizzle-orm/pg-core").PgColumn<{
142
- name: "slug_changed_at";
143
- tableName: "operators";
144
- dataType: "date";
145
- columnType: "PgTimestamp";
146
- data: Date;
147
- driverParam: string;
148
- notNull: false;
149
- hasDefault: false;
150
- isPrimaryKey: false;
151
- isAutoincrement: false;
152
- hasRuntimeDefault: false;
153
- enumValues: undefined;
154
- baseColumn: never;
155
- identity: undefined;
156
- generated: undefined;
157
- }, {}, {}>;
158
- slugNoticeDismissedAt: import("drizzle-orm/pg-core").PgColumn<{
159
- name: "slug_notice_dismissed_at";
160
- tableName: "operators";
161
- dataType: "date";
162
- columnType: "PgTimestamp";
163
- data: Date;
164
- driverParam: string;
165
- notNull: false;
166
- hasDefault: false;
167
- isPrimaryKey: false;
168
- isAutoincrement: false;
169
- hasRuntimeDefault: false;
170
- enumValues: undefined;
171
- baseColumn: never;
172
- identity: undefined;
173
- generated: undefined;
174
- }, {}, {}>;
175
- accountCreatedAt: import("drizzle-orm/pg-core").PgColumn<{
176
- name: "account_created_at";
177
- tableName: "operators";
178
- dataType: "date";
179
- columnType: "PgTimestamp";
180
- data: Date;
181
- driverParam: string;
182
- notNull: true;
183
- hasDefault: false;
184
- isPrimaryKey: false;
185
- isAutoincrement: false;
186
- hasRuntimeDefault: false;
187
- enumValues: undefined;
188
- baseColumn: never;
189
- identity: undefined;
190
- generated: undefined;
191
- }, {}, {}>;
192
- termsVersion: import("drizzle-orm/pg-core").PgColumn<{
193
- name: "terms_version";
194
- tableName: "operators";
195
- dataType: "string";
196
- columnType: "PgText";
197
- data: string;
198
- driverParam: string;
199
- notNull: false;
200
- hasDefault: false;
201
- isPrimaryKey: false;
202
- isAutoincrement: false;
203
- hasRuntimeDefault: false;
204
- enumValues: [string, ...string[]];
205
- baseColumn: never;
206
- identity: undefined;
207
- generated: undefined;
208
- }, {}, {}>;
209
- privacyVersion: import("drizzle-orm/pg-core").PgColumn<{
210
- name: "privacy_version";
211
- tableName: "operators";
212
- dataType: "string";
213
- columnType: "PgText";
214
- data: string;
215
- driverParam: string;
216
- notNull: false;
217
- hasDefault: false;
218
- isPrimaryKey: false;
219
- isAutoincrement: false;
220
- hasRuntimeDefault: false;
221
- enumValues: [string, ...string[]];
222
- baseColumn: never;
223
- identity: undefined;
224
- generated: undefined;
225
- }, {}, {}>;
226
- };
227
- dialect: 'pg';
228
- }>;
@@ -1,39 +0,0 @@
1
- import { bigint, pgTable, text, timestamp, uniqueIndex, uuid, } from 'drizzle-orm/pg-core';
2
- import { timestamps } from './timestamps.js';
3
- // github_id is the identity, since logins change. login is kept fresh from
4
- // GitHub and shows only in the operator section of a profile. slug is what
5
- // the operator is known by, the first half of every handle, as in
6
- // alice/claude-code. It defaults to the login lowercased and changes on the
7
- // web only (PATCH /v1/me). display_name is free text, and display_name_key
8
- // is its normalised form (displayNameKey in @sealkeeper/schema), unique so
9
- // two operators never hold names that read the same, even under concurrent
10
- // writes. slug_changed_at is when the slug last changed, null until the
11
- // first change, for the one change every SLUG_CHANGE_DAYS.
12
- // slug_notice_dismissed_at is when the operator dismissed the one time
13
- // notice on /me that says what its slug is and that it can change, null
14
- // until then (VOU-190). Held here, not in the browser, so it shows once
15
- // across devices. terms_version and privacy_version are the "Last updated"
16
- // dates of the terms and the privacy policy (POLICY_VERSIONS in
17
- // @sealkeeper/schema) in force when the API created the row, which is when
18
- // the operator accepted them (VOU-121). Null for operators created before.
19
- export const operators = pgTable('operators', {
20
- id: uuid('id').primaryKey().defaultRandom(),
21
- githubId: bigint('github_id', { mode: 'number' }).notNull().unique(),
22
- login: text('login').notNull(),
23
- slug: text('slug').notNull(),
24
- displayName: text('display_name').notNull(),
25
- displayNameKey: text('display_name_key').notNull(),
26
- slugChangedAt: timestamp('slug_changed_at', { withTimezone: true }),
27
- slugNoticeDismissedAt: timestamp('slug_notice_dismissed_at', {
28
- withTimezone: true,
29
- }),
30
- accountCreatedAt: timestamp('account_created_at', {
31
- withTimezone: true,
32
- }).notNull(),
33
- termsVersion: text('terms_version'),
34
- privacyVersion: text('privacy_version'),
35
- ...timestamps,
36
- }, (t) => [
37
- uniqueIndex('operators_slug_unique').on(t.slug),
38
- uniqueIndex('operators_display_name_key_unique').on(t.displayNameKey),
39
- ]);
@@ -1,109 +0,0 @@
1
- export declare const quotaCounters: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
- name: "quota_counters";
3
- schema: undefined;
4
- columns: {
5
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
6
- name: "created_at";
7
- tableName: "quota_counters";
8
- dataType: "date";
9
- columnType: "PgTimestamp";
10
- data: Date;
11
- driverParam: string;
12
- notNull: true;
13
- hasDefault: true;
14
- isPrimaryKey: false;
15
- isAutoincrement: false;
16
- hasRuntimeDefault: false;
17
- enumValues: undefined;
18
- baseColumn: never;
19
- identity: undefined;
20
- generated: undefined;
21
- }, {}, {}>;
22
- updatedAt: import("drizzle-orm/pg-core").PgColumn<{
23
- name: "updated_at";
24
- tableName: "quota_counters";
25
- dataType: "date";
26
- columnType: "PgTimestamp";
27
- data: Date;
28
- driverParam: string;
29
- notNull: true;
30
- hasDefault: true;
31
- isPrimaryKey: false;
32
- isAutoincrement: false;
33
- hasRuntimeDefault: false;
34
- enumValues: undefined;
35
- baseColumn: never;
36
- identity: undefined;
37
- generated: undefined;
38
- }, {}, {}>;
39
- key: import("drizzle-orm/pg-core").PgColumn<{
40
- name: "key";
41
- tableName: "quota_counters";
42
- dataType: "string";
43
- columnType: "PgText";
44
- data: string;
45
- driverParam: string;
46
- notNull: true;
47
- hasDefault: false;
48
- isPrimaryKey: false;
49
- isAutoincrement: false;
50
- hasRuntimeDefault: false;
51
- enumValues: [string, ...string[]];
52
- baseColumn: never;
53
- identity: undefined;
54
- generated: undefined;
55
- }, {}, {}>;
56
- windowStart: import("drizzle-orm/pg-core").PgColumn<{
57
- name: "window_start";
58
- tableName: "quota_counters";
59
- dataType: "date";
60
- columnType: "PgTimestamp";
61
- data: Date;
62
- driverParam: string;
63
- notNull: true;
64
- hasDefault: false;
65
- isPrimaryKey: false;
66
- isAutoincrement: false;
67
- hasRuntimeDefault: false;
68
- enumValues: undefined;
69
- baseColumn: never;
70
- identity: undefined;
71
- generated: undefined;
72
- }, {}, {}>;
73
- expiresAt: import("drizzle-orm/pg-core").PgColumn<{
74
- name: "expires_at";
75
- tableName: "quota_counters";
76
- dataType: "date";
77
- columnType: "PgTimestamp";
78
- data: Date;
79
- driverParam: string;
80
- notNull: true;
81
- hasDefault: false;
82
- isPrimaryKey: false;
83
- isAutoincrement: false;
84
- hasRuntimeDefault: false;
85
- enumValues: undefined;
86
- baseColumn: never;
87
- identity: undefined;
88
- generated: undefined;
89
- }, {}, {}>;
90
- count: import("drizzle-orm/pg-core").PgColumn<{
91
- name: "count";
92
- tableName: "quota_counters";
93
- dataType: "number";
94
- columnType: "PgInteger";
95
- data: number;
96
- driverParam: string | number;
97
- notNull: true;
98
- hasDefault: false;
99
- isPrimaryKey: false;
100
- isAutoincrement: false;
101
- hasRuntimeDefault: false;
102
- enumValues: undefined;
103
- baseColumn: never;
104
- identity: undefined;
105
- generated: undefined;
106
- }, {}, {}>;
107
- };
108
- dialect: 'pg';
109
- }>;
@@ -1,17 +0,0 @@
1
- import { index, integer, pgTable, primaryKey, text, timestamp, } from 'drizzle-orm/pg-core';
2
- import { timestamps } from './timestamps.js';
3
- // Per-agent write quotas. One row per (key, fixed window). The API increments
4
- // the count with one upsert, so the count survives Cloud Run scaling to zero
5
- // and is shared by every instance. Windows differ in length between keys, so
6
- // each row carries the end of its own window in expires_at, and the API
7
- // deletes rows whose window has ended.
8
- export const quotaCounters = pgTable('quota_counters', {
9
- key: text('key').notNull(),
10
- windowStart: timestamp('window_start', { withTimezone: true }).notNull(),
11
- expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
12
- count: integer('count').notNull(),
13
- ...timestamps,
14
- }, (t) => [
15
- primaryKey({ columns: [t.key, t.windowStart] }),
16
- index('quota_counters_expires_at_idx').on(t.expiresAt),
17
- ]);
@@ -1,160 +0,0 @@
1
- export declare const ratings: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
- name: "ratings";
3
- schema: undefined;
4
- columns: {
5
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
6
- name: "created_at";
7
- tableName: "ratings";
8
- dataType: "date";
9
- columnType: "PgTimestamp";
10
- data: Date;
11
- driverParam: string;
12
- notNull: true;
13
- hasDefault: true;
14
- isPrimaryKey: false;
15
- isAutoincrement: false;
16
- hasRuntimeDefault: false;
17
- enumValues: undefined;
18
- baseColumn: never;
19
- identity: undefined;
20
- generated: undefined;
21
- }, {}, {}>;
22
- updatedAt: import("drizzle-orm/pg-core").PgColumn<{
23
- name: "updated_at";
24
- tableName: "ratings";
25
- dataType: "date";
26
- columnType: "PgTimestamp";
27
- data: Date;
28
- driverParam: string;
29
- notNull: true;
30
- hasDefault: true;
31
- isPrimaryKey: false;
32
- isAutoincrement: false;
33
- hasRuntimeDefault: false;
34
- enumValues: undefined;
35
- baseColumn: never;
36
- identity: undefined;
37
- generated: undefined;
38
- }, {}, {}>;
39
- id: import("drizzle-orm/pg-core").PgColumn<{
40
- name: "id";
41
- tableName: "ratings";
42
- dataType: "string";
43
- columnType: "PgUUID";
44
- data: string;
45
- driverParam: string;
46
- notNull: true;
47
- hasDefault: false;
48
- isPrimaryKey: true;
49
- isAutoincrement: false;
50
- hasRuntimeDefault: false;
51
- enumValues: undefined;
52
- baseColumn: never;
53
- identity: undefined;
54
- generated: undefined;
55
- }, {}, {}>;
56
- raterAgentId: import("drizzle-orm/pg-core").PgColumn<{
57
- name: "rater_agent_id";
58
- tableName: "ratings";
59
- dataType: "string";
60
- columnType: "PgText";
61
- data: string;
62
- driverParam: string;
63
- notNull: true;
64
- hasDefault: false;
65
- isPrimaryKey: false;
66
- isAutoincrement: false;
67
- hasRuntimeDefault: false;
68
- enumValues: [string, ...string[]];
69
- baseColumn: never;
70
- identity: undefined;
71
- generated: undefined;
72
- }, {}, {}>;
73
- rateeAgentId: import("drizzle-orm/pg-core").PgColumn<{
74
- name: "ratee_agent_id";
75
- tableName: "ratings";
76
- dataType: "string";
77
- columnType: "PgText";
78
- data: string;
79
- driverParam: string;
80
- notNull: true;
81
- hasDefault: false;
82
- isPrimaryKey: false;
83
- isAutoincrement: false;
84
- hasRuntimeDefault: false;
85
- enumValues: [string, ...string[]];
86
- baseColumn: never;
87
- identity: undefined;
88
- generated: undefined;
89
- }, {}, {}>;
90
- dimension: import("drizzle-orm/pg-core").PgColumn<{
91
- name: "dimension";
92
- tableName: "ratings";
93
- dataType: "string";
94
- columnType: "PgText";
95
- data: string;
96
- driverParam: string;
97
- notNull: true;
98
- hasDefault: false;
99
- isPrimaryKey: false;
100
- isAutoincrement: false;
101
- hasRuntimeDefault: false;
102
- enumValues: [string, ...string[]];
103
- baseColumn: never;
104
- identity: undefined;
105
- generated: undefined;
106
- }, {}, {}>;
107
- value: import("drizzle-orm/pg-core").PgColumn<{
108
- name: "value";
109
- tableName: "ratings";
110
- dataType: "number";
111
- columnType: "PgInteger";
112
- data: number;
113
- driverParam: string | number;
114
- notNull: true;
115
- hasDefault: false;
116
- isPrimaryKey: false;
117
- isAutoincrement: false;
118
- hasRuntimeDefault: false;
119
- enumValues: undefined;
120
- baseColumn: never;
121
- identity: undefined;
122
- generated: undefined;
123
- }, {}, {}>;
124
- raterScoreAtTime: import("drizzle-orm/pg-core").PgColumn<{
125
- name: "rater_score_at_time";
126
- tableName: "ratings";
127
- dataType: "number";
128
- columnType: "PgReal";
129
- data: number;
130
- driverParam: string | number;
131
- notNull: true;
132
- hasDefault: false;
133
- isPrimaryKey: false;
134
- isAutoincrement: false;
135
- hasRuntimeDefault: false;
136
- enumValues: undefined;
137
- baseColumn: never;
138
- identity: undefined;
139
- generated: undefined;
140
- }, {}, {}>;
141
- issuedAt: import("drizzle-orm/pg-core").PgColumn<{
142
- name: "issued_at";
143
- tableName: "ratings";
144
- dataType: "date";
145
- columnType: "PgTimestamp";
146
- data: Date;
147
- driverParam: string;
148
- notNull: true;
149
- hasDefault: false;
150
- isPrimaryKey: false;
151
- isAutoincrement: false;
152
- hasRuntimeDefault: false;
153
- enumValues: undefined;
154
- baseColumn: never;
155
- identity: undefined;
156
- generated: undefined;
157
- }, {}, {}>;
158
- };
159
- dialect: 'pg';
160
- }>;
@@ -1,27 +0,0 @@
1
- import { sql } from 'drizzle-orm';
2
- import { check, integer, pgTable, real, text, timestamp, unique, uuid, } from 'drizzle-orm/pg-core';
3
- import { agents } from './agents.js';
4
- import { timestamps } from './timestamps.js';
5
- export const ratings = pgTable('ratings', {
6
- id: uuid('id').primaryKey(),
7
- raterAgentId: text('rater_agent_id')
8
- .notNull()
9
- .references(() => agents.id),
10
- rateeAgentId: text('ratee_agent_id')
11
- .notNull()
12
- .references(() => agents.id),
13
- dimension: text('dimension').notNull(),
14
- value: integer('value').notNull(),
15
- raterScoreAtTime: real('rater_score_at_time').notNull(),
16
- // The signed issuedAt of the rating that wrote the row. A rating only
17
- // replaces the row when it was issued later, so a replayed envelope
18
- // changes nothing.
19
- issuedAt: timestamp('issued_at', { withTimezone: true }).notNull(),
20
- ...timestamps,
21
- }, (t) => [
22
- unique('ratings_rater_ratee_dimension_unique').on(t.raterAgentId, t.rateeAgentId, t.dimension),
23
- // Scoring maps value to (value - 1) / 4 and weights it by the rater
24
- // score, so a row outside these ranges would push a score past 1.
25
- check('ratings_value_range', sql `${t.value} between 1 and 5`),
26
- check('ratings_rater_score_range', sql `${t.raterScoreAtTime} between 0 and 1`),
27
- ]);