@krak-stack/registry 0.1.10 → 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.
@@ -0,0 +1,227 @@
1
+ // ../../src/services/notification/persistence/drizzle.ts
2
+ import { sql } from "drizzle-orm";
3
+ import {
4
+ boolean,
5
+ check,
6
+ index,
7
+ integer,
8
+ jsonb,
9
+ pgTable,
10
+ text,
11
+ timestamp,
12
+ uniqueIndex,
13
+ uuid
14
+ } from "drizzle-orm/pg-core";
15
+
16
+ // ../../src/services/notification/persistence/schema.ts
17
+ import { Schema } from "effect";
18
+ var NOTIFICATION_DELIVERY_PURPOSES = [
19
+ "transactional",
20
+ "notification"
21
+ ];
22
+ var NOTIFICATION_DELIVERY_STATUSES = [
23
+ "queued",
24
+ "processing",
25
+ "sent",
26
+ "retrying",
27
+ "failed",
28
+ "suppressed",
29
+ "cancelled"
30
+ ];
31
+ var NotificationDeliveryPurpose = Schema.Literals(NOTIFICATION_DELIVERY_PURPOSES).annotate({ identifier: "NotificationDeliveryPurpose" });
32
+ var NotificationDeliveryStatus = Schema.Literals(NOTIFICATION_DELIVERY_STATUSES).annotate({ identifier: "NotificationDeliveryStatus" });
33
+ var NotificationId = Schema.String.pipe(Schema.brand("NotificationId")).annotate({ identifier: "NotificationId" });
34
+ var NotificationSettingId = Schema.String.pipe(Schema.brand("NotificationSettingId")).annotate({ identifier: "NotificationSettingId" });
35
+ var NotificationDeliveryId = Schema.String.pipe(Schema.brand("NotificationDeliveryId")).annotate({ identifier: "NotificationDeliveryId" });
36
+ var InboxNotificationSchema = Schema.Struct({
37
+ id: NotificationId,
38
+ idempotencyKey: Schema.NonEmptyString,
39
+ recipientUserId: Schema.NonEmptyString,
40
+ organizationId: Schema.NullOr(Schema.NonEmptyString),
41
+ workspaceId: Schema.NullOr(Schema.NonEmptyString),
42
+ eventKey: Schema.NonEmptyString,
43
+ eventVersion: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
44
+ locale: Schema.NonEmptyString,
45
+ title: Schema.NonEmptyString,
46
+ description: Schema.NullOr(Schema.String),
47
+ href: Schema.NullOr(Schema.String),
48
+ metadata: Schema.Json,
49
+ createdAt: Schema.Date,
50
+ readAt: Schema.NullOr(Schema.Date),
51
+ archivedAt: Schema.NullOr(Schema.Date)
52
+ }).annotate({ identifier: "InboxNotification" });
53
+ var NotificationSettingSchema = Schema.Struct({
54
+ id: NotificationSettingId,
55
+ recipientUserId: Schema.NonEmptyString,
56
+ organizationId: Schema.NullOr(Schema.NonEmptyString),
57
+ workspaceId: Schema.NullOr(Schema.NonEmptyString),
58
+ eventKey: Schema.NullOr(Schema.NonEmptyString),
59
+ channel: Schema.NonEmptyString,
60
+ enabled: Schema.Boolean,
61
+ createdAt: Schema.Date,
62
+ updatedAt: Schema.Date
63
+ }).annotate({ identifier: "NotificationSetting" });
64
+ var NotificationDeliverySchema = Schema.Struct({
65
+ id: NotificationDeliveryId,
66
+ notificationId: Schema.NullOr(NotificationId),
67
+ idempotencyKey: Schema.NonEmptyString,
68
+ recipientUserId: Schema.NullOr(Schema.NonEmptyString),
69
+ organizationId: Schema.NullOr(Schema.NonEmptyString),
70
+ workspaceId: Schema.NullOr(Schema.NonEmptyString),
71
+ eventKey: Schema.NonEmptyString,
72
+ eventVersion: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
73
+ channel: Schema.NonEmptyString,
74
+ purpose: NotificationDeliveryPurpose,
75
+ template: Schema.NullOr(Schema.NonEmptyString),
76
+ recipientAddress: Schema.NonEmptyString,
77
+ recipientName: Schema.NullOr(Schema.NonEmptyString),
78
+ payloadVersion: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
79
+ payload: Schema.Json,
80
+ status: NotificationDeliveryStatus,
81
+ attempts: Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0))),
82
+ maxAttempts: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
83
+ provider: Schema.NullOr(Schema.NonEmptyString),
84
+ providerMessageId: Schema.NullOr(Schema.NonEmptyString),
85
+ errorMessage: Schema.NullOr(Schema.String),
86
+ scheduledFor: Schema.Date,
87
+ processingAt: Schema.NullOr(Schema.Date),
88
+ lastAttemptAt: Schema.NullOr(Schema.Date),
89
+ leaseExpiresAt: Schema.NullOr(Schema.Date),
90
+ claimedBy: Schema.NullOr(Schema.NonEmptyString),
91
+ sentAt: Schema.NullOr(Schema.Date),
92
+ failedAt: Schema.NullOr(Schema.Date),
93
+ suppressedAt: Schema.NullOr(Schema.Date),
94
+ cancelledAt: Schema.NullOr(Schema.Date),
95
+ createdAt: Schema.Date,
96
+ updatedAt: Schema.Date
97
+ }).annotate({ identifier: "NotificationDelivery" });
98
+ var EmailDeliveryPayloadV1 = Schema.Struct({
99
+ from: Schema.optional(Schema.NonEmptyString),
100
+ to: Schema.Union([
101
+ Schema.NonEmptyString,
102
+ Schema.NonEmptyArray(Schema.NonEmptyString)
103
+ ]),
104
+ cc: Schema.optional(Schema.Array(Schema.NonEmptyString)),
105
+ bcc: Schema.optional(Schema.Array(Schema.NonEmptyString)),
106
+ replyTo: Schema.optional(Schema.Array(Schema.NonEmptyString)),
107
+ subject: Schema.NonEmptyString,
108
+ text: Schema.optional(Schema.NonEmptyString),
109
+ html: Schema.optional(Schema.NonEmptyString)
110
+ }).pipe(Schema.refine((payload) => payload.text !== undefined || payload.html !== undefined, { message: "Email delivery payload requires text or html" })).annotate({ identifier: "EmailDeliveryPayloadV1" });
111
+ var PersistedNotificationDeliveryPayload = Schema.Union([
112
+ Schema.Struct({
113
+ channel: Schema.Literal("email"),
114
+ payloadVersion: Schema.Literal(1),
115
+ payload: EmailDeliveryPayloadV1
116
+ })
117
+ ]).annotate({ identifier: "PersistedNotificationDeliveryPayload" });
118
+ var decodeNotificationDeliveryPayload = Schema.decodeUnknownEffect(PersistedNotificationDeliveryPayload);
119
+
120
+ // ../../src/services/notification/persistence/drizzle.ts
121
+ var timestampWithTimezone = (name) => timestamp(name, { withTimezone: true });
122
+ var nonEmpty = (column) => sql`length(btrim(${column})) > 0`;
123
+ var notifications = pgTable("notifications", {
124
+ id: uuid("id").defaultRandom().primaryKey(),
125
+ idempotencyKey: text("idempotency_key").notNull(),
126
+ recipientUserId: text("recipient_user_id").notNull(),
127
+ organizationId: text("organization_id"),
128
+ workspaceId: text("workspace_id"),
129
+ eventKey: text("event_key").notNull(),
130
+ eventVersion: integer("event_version").default(1).notNull(),
131
+ locale: text("locale").notNull(),
132
+ title: text("title").notNull(),
133
+ description: text("description"),
134
+ href: text("href"),
135
+ metadata: jsonb("metadata").$type().default({}).notNull(),
136
+ createdAt: timestampWithTimezone("created_at").defaultNow().notNull(),
137
+ readAt: timestampWithTimezone("read_at"),
138
+ archivedAt: timestampWithTimezone("archived_at")
139
+ }, (table) => [
140
+ uniqueIndex("notifications_idempotency_key_uidx").on(table.idempotencyKey),
141
+ index("notifications_recipient_inbox_created_idx").on(table.recipientUserId, table.organizationId, table.workspaceId, table.archivedAt, table.createdAt),
142
+ index("notifications_recipient_unread_idx").on(table.recipientUserId, table.organizationId, table.workspaceId, table.readAt),
143
+ check("notifications_non_empty_fields_check", sql`${nonEmpty(table.idempotencyKey)} and ${nonEmpty(table.recipientUserId)} and ${nonEmpty(table.eventKey)} and ${nonEmpty(table.locale)} and ${nonEmpty(table.title)} and (${table.organizationId} is null or ${nonEmpty(table.organizationId)}) and (${table.workspaceId} is null or ${nonEmpty(table.workspaceId)})`),
144
+ check("notifications_event_version_check", sql`${table.eventVersion} > 0`)
145
+ ]);
146
+ var notificationSettings = pgTable("notification_settings", {
147
+ id: uuid("id").defaultRandom().primaryKey(),
148
+ recipientUserId: text("recipient_user_id").notNull(),
149
+ organizationId: text("organization_id"),
150
+ workspaceId: text("workspace_id"),
151
+ eventKey: text("event_key"),
152
+ channel: text("channel").notNull(),
153
+ enabled: boolean("enabled").default(true).notNull(),
154
+ createdAt: timestampWithTimezone("created_at").defaultNow().notNull(),
155
+ updatedAt: timestampWithTimezone("updated_at").defaultNow().notNull()
156
+ }, (table) => [
157
+ uniqueIndex("notification_settings_scope_channel_uidx").on(table.recipientUserId, sql`coalesce(${table.organizationId}, '')`, sql`coalesce(${table.workspaceId}, '')`, sql`coalesce(${table.eventKey}, '')`, table.channel),
158
+ index("notification_settings_recipient_channel_idx").on(table.recipientUserId, table.channel),
159
+ check("notification_settings_non_empty_fields_check", sql`${nonEmpty(table.recipientUserId)} and ${nonEmpty(table.channel)} and (${table.organizationId} is null or ${nonEmpty(table.organizationId)}) and (${table.workspaceId} is null or ${nonEmpty(table.workspaceId)}) and (${table.eventKey} is null or ${nonEmpty(table.eventKey)})`)
160
+ ]);
161
+ var notificationDeliveries = pgTable("notification_deliveries", {
162
+ id: uuid("id").defaultRandom().primaryKey(),
163
+ notificationId: uuid("notification_id").references(() => notifications.id, {
164
+ onDelete: "set null"
165
+ }),
166
+ idempotencyKey: text("idempotency_key").notNull(),
167
+ recipientUserId: text("recipient_user_id"),
168
+ organizationId: text("organization_id"),
169
+ workspaceId: text("workspace_id"),
170
+ eventKey: text("event_key").notNull(),
171
+ eventVersion: integer("event_version").default(1).notNull(),
172
+ channel: text("channel").notNull(),
173
+ purpose: text("purpose").notNull(),
174
+ template: text("template"),
175
+ recipientAddress: text("recipient_address").notNull(),
176
+ recipientName: text("recipient_name"),
177
+ payloadVersion: integer("payload_version").default(1).notNull(),
178
+ payload: jsonb("payload").$type().notNull(),
179
+ status: text("status").default("queued").notNull(),
180
+ attempts: integer("attempts").default(0).notNull(),
181
+ maxAttempts: integer("max_attempts").default(5).notNull(),
182
+ provider: text("provider"),
183
+ providerMessageId: text("provider_message_id"),
184
+ errorMessage: text("error_message"),
185
+ scheduledFor: timestampWithTimezone("scheduled_for").defaultNow().notNull(),
186
+ processingAt: timestampWithTimezone("processing_at"),
187
+ lastAttemptAt: timestampWithTimezone("last_attempt_at"),
188
+ leaseExpiresAt: timestampWithTimezone("lease_expires_at"),
189
+ claimedBy: text("claimed_by"),
190
+ sentAt: timestampWithTimezone("sent_at"),
191
+ failedAt: timestampWithTimezone("failed_at"),
192
+ suppressedAt: timestampWithTimezone("suppressed_at"),
193
+ cancelledAt: timestampWithTimezone("cancelled_at"),
194
+ createdAt: timestampWithTimezone("created_at").defaultNow().notNull(),
195
+ updatedAt: timestampWithTimezone("updated_at").defaultNow().notNull()
196
+ }, (table) => [
197
+ uniqueIndex("notification_deliveries_idempotency_key_uidx").on(table.idempotencyKey),
198
+ index("notification_deliveries_claim_idx").on(table.channel, table.status, table.scheduledFor),
199
+ index("notification_deliveries_notification_id_idx").on(table.notificationId),
200
+ index("notification_deliveries_recipient_address_idx").on(table.recipientAddress),
201
+ index("notification_deliveries_scope_created_idx").on(table.organizationId, table.workspaceId, table.createdAt),
202
+ index("notification_deliveries_template_idx").on(table.template),
203
+ check("notification_deliveries_non_empty_fields_check", sql`${nonEmpty(table.idempotencyKey)} and ${nonEmpty(table.eventKey)} and ${nonEmpty(table.channel)} and ${nonEmpty(table.recipientAddress)} and (${table.recipientUserId} is null or ${nonEmpty(table.recipientUserId)}) and (${table.organizationId} is null or ${nonEmpty(table.organizationId)}) and (${table.workspaceId} is null or ${nonEmpty(table.workspaceId)}) and (${table.template} is null or ${nonEmpty(table.template)}) and (${table.recipientName} is null or ${nonEmpty(table.recipientName)}) and (${table.provider} is null or ${nonEmpty(table.provider)}) and (${table.providerMessageId} is null or ${nonEmpty(table.providerMessageId)}) and (${table.claimedBy} is null or ${nonEmpty(table.claimedBy)})`),
204
+ check("notification_deliveries_purpose_check", sql`${table.purpose} in (${sql.join(NOTIFICATION_DELIVERY_PURPOSES.map((value) => sql`${value}`), sql`, `)})`),
205
+ check("notification_deliveries_status_check", sql`${table.status} in (${sql.join(NOTIFICATION_DELIVERY_STATUSES.map((value) => sql`${value}`), sql`, `)})`),
206
+ check("notification_deliveries_versions_check", sql`${table.eventVersion} > 0 and ${table.payloadVersion} > 0`),
207
+ check("notification_deliveries_attempts_check", sql`${table.attempts} >= 0 and ${table.maxAttempts} > 0 and ${table.attempts} <= ${table.maxAttempts}`),
208
+ check("notification_deliveries_lease_check", sql`(${table.claimedBy} is null and ${table.leaseExpiresAt} is null) or (${table.claimedBy} is not null and ${table.leaseExpiresAt} is not null)`)
209
+ ]);
210
+ export {
211
+ notifications,
212
+ notificationSettings,
213
+ notificationDeliveries,
214
+ decodeNotificationDeliveryPayload,
215
+ PersistedNotificationDeliveryPayload,
216
+ NotificationSettingSchema,
217
+ NotificationSettingId,
218
+ NotificationId,
219
+ NotificationDeliveryStatus,
220
+ NotificationDeliverySchema,
221
+ NotificationDeliveryPurpose,
222
+ NotificationDeliveryId,
223
+ NOTIFICATION_DELIVERY_STATUSES,
224
+ NOTIFICATION_DELIVERY_PURPOSES,
225
+ InboxNotificationSchema,
226
+ EmailDeliveryPayloadV1
227
+ };
@@ -0,0 +1,118 @@
1
+ // ../../src/services/notification/persistence/schema.ts
2
+ import { Schema } from "effect";
3
+ var NOTIFICATION_DELIVERY_PURPOSES = [
4
+ "transactional",
5
+ "notification"
6
+ ];
7
+ var NOTIFICATION_DELIVERY_STATUSES = [
8
+ "queued",
9
+ "processing",
10
+ "sent",
11
+ "retrying",
12
+ "failed",
13
+ "suppressed",
14
+ "cancelled"
15
+ ];
16
+ var NotificationDeliveryPurpose = Schema.Literals(NOTIFICATION_DELIVERY_PURPOSES).annotate({ identifier: "NotificationDeliveryPurpose" });
17
+ var NotificationDeliveryStatus = Schema.Literals(NOTIFICATION_DELIVERY_STATUSES).annotate({ identifier: "NotificationDeliveryStatus" });
18
+ var NotificationId = Schema.String.pipe(Schema.brand("NotificationId")).annotate({ identifier: "NotificationId" });
19
+ var NotificationSettingId = Schema.String.pipe(Schema.brand("NotificationSettingId")).annotate({ identifier: "NotificationSettingId" });
20
+ var NotificationDeliveryId = Schema.String.pipe(Schema.brand("NotificationDeliveryId")).annotate({ identifier: "NotificationDeliveryId" });
21
+ var InboxNotificationSchema = Schema.Struct({
22
+ id: NotificationId,
23
+ idempotencyKey: Schema.NonEmptyString,
24
+ recipientUserId: Schema.NonEmptyString,
25
+ organizationId: Schema.NullOr(Schema.NonEmptyString),
26
+ workspaceId: Schema.NullOr(Schema.NonEmptyString),
27
+ eventKey: Schema.NonEmptyString,
28
+ eventVersion: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
29
+ locale: Schema.NonEmptyString,
30
+ title: Schema.NonEmptyString,
31
+ description: Schema.NullOr(Schema.String),
32
+ href: Schema.NullOr(Schema.String),
33
+ metadata: Schema.Json,
34
+ createdAt: Schema.Date,
35
+ readAt: Schema.NullOr(Schema.Date),
36
+ archivedAt: Schema.NullOr(Schema.Date)
37
+ }).annotate({ identifier: "InboxNotification" });
38
+ var NotificationSettingSchema = Schema.Struct({
39
+ id: NotificationSettingId,
40
+ recipientUserId: Schema.NonEmptyString,
41
+ organizationId: Schema.NullOr(Schema.NonEmptyString),
42
+ workspaceId: Schema.NullOr(Schema.NonEmptyString),
43
+ eventKey: Schema.NullOr(Schema.NonEmptyString),
44
+ channel: Schema.NonEmptyString,
45
+ enabled: Schema.Boolean,
46
+ createdAt: Schema.Date,
47
+ updatedAt: Schema.Date
48
+ }).annotate({ identifier: "NotificationSetting" });
49
+ var NotificationDeliverySchema = Schema.Struct({
50
+ id: NotificationDeliveryId,
51
+ notificationId: Schema.NullOr(NotificationId),
52
+ idempotencyKey: Schema.NonEmptyString,
53
+ recipientUserId: Schema.NullOr(Schema.NonEmptyString),
54
+ organizationId: Schema.NullOr(Schema.NonEmptyString),
55
+ workspaceId: Schema.NullOr(Schema.NonEmptyString),
56
+ eventKey: Schema.NonEmptyString,
57
+ eventVersion: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
58
+ channel: Schema.NonEmptyString,
59
+ purpose: NotificationDeliveryPurpose,
60
+ template: Schema.NullOr(Schema.NonEmptyString),
61
+ recipientAddress: Schema.NonEmptyString,
62
+ recipientName: Schema.NullOr(Schema.NonEmptyString),
63
+ payloadVersion: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
64
+ payload: Schema.Json,
65
+ status: NotificationDeliveryStatus,
66
+ attempts: Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0))),
67
+ maxAttempts: Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0))),
68
+ provider: Schema.NullOr(Schema.NonEmptyString),
69
+ providerMessageId: Schema.NullOr(Schema.NonEmptyString),
70
+ errorMessage: Schema.NullOr(Schema.String),
71
+ scheduledFor: Schema.Date,
72
+ processingAt: Schema.NullOr(Schema.Date),
73
+ lastAttemptAt: Schema.NullOr(Schema.Date),
74
+ leaseExpiresAt: Schema.NullOr(Schema.Date),
75
+ claimedBy: Schema.NullOr(Schema.NonEmptyString),
76
+ sentAt: Schema.NullOr(Schema.Date),
77
+ failedAt: Schema.NullOr(Schema.Date),
78
+ suppressedAt: Schema.NullOr(Schema.Date),
79
+ cancelledAt: Schema.NullOr(Schema.Date),
80
+ createdAt: Schema.Date,
81
+ updatedAt: Schema.Date
82
+ }).annotate({ identifier: "NotificationDelivery" });
83
+ var EmailDeliveryPayloadV1 = Schema.Struct({
84
+ from: Schema.optional(Schema.NonEmptyString),
85
+ to: Schema.Union([
86
+ Schema.NonEmptyString,
87
+ Schema.NonEmptyArray(Schema.NonEmptyString)
88
+ ]),
89
+ cc: Schema.optional(Schema.Array(Schema.NonEmptyString)),
90
+ bcc: Schema.optional(Schema.Array(Schema.NonEmptyString)),
91
+ replyTo: Schema.optional(Schema.Array(Schema.NonEmptyString)),
92
+ subject: Schema.NonEmptyString,
93
+ text: Schema.optional(Schema.NonEmptyString),
94
+ html: Schema.optional(Schema.NonEmptyString)
95
+ }).pipe(Schema.refine((payload) => payload.text !== undefined || payload.html !== undefined, { message: "Email delivery payload requires text or html" })).annotate({ identifier: "EmailDeliveryPayloadV1" });
96
+ var PersistedNotificationDeliveryPayload = Schema.Union([
97
+ Schema.Struct({
98
+ channel: Schema.Literal("email"),
99
+ payloadVersion: Schema.Literal(1),
100
+ payload: EmailDeliveryPayloadV1
101
+ })
102
+ ]).annotate({ identifier: "PersistedNotificationDeliveryPayload" });
103
+ var decodeNotificationDeliveryPayload = Schema.decodeUnknownEffect(PersistedNotificationDeliveryPayload);
104
+ export {
105
+ decodeNotificationDeliveryPayload,
106
+ PersistedNotificationDeliveryPayload,
107
+ NotificationSettingSchema,
108
+ NotificationSettingId,
109
+ NotificationId,
110
+ NotificationDeliveryStatus,
111
+ NotificationDeliverySchema,
112
+ NotificationDeliveryPurpose,
113
+ NotificationDeliveryId,
114
+ NOTIFICATION_DELIVERY_STATUSES,
115
+ NOTIFICATION_DELIVERY_PURPOSES,
116
+ InboxNotificationSchema,
117
+ EmailDeliveryPayloadV1
118
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  "types": "./dist/services/agent/schema.d.ts",
29
29
  "import": "./dist/services/agent/schema.js"
30
30
  },
31
- "./httpapi/ai": {
32
- "types": "./dist/lib/httpapi-ai.d.ts",
33
- "import": "./dist/lib/httpapi-ai.js"
31
+ "./httpapi-toolkit": {
32
+ "types": "./dist/lib/httpapi-toolkit.d.ts",
33
+ "import": "./dist/lib/httpapi-toolkit.js"
34
34
  },
35
35
  "./httpapi/cli": {
36
36
  "types": "./dist/lib/httpapi-cli.d.ts",
@@ -52,9 +52,13 @@
52
52
  "types": "./dist/lib/docs-core.d.ts",
53
53
  "import": "./dist/lib/docs-core.js"
54
54
  },
55
- "./docs-ai": {
56
- "types": "./dist/lib/docs-ai.d.ts",
57
- "import": "./dist/lib/docs-ai.js"
55
+ "./documentation-toolkit": {
56
+ "types": "./dist/lib/documentation-toolkit.d.ts",
57
+ "import": "./dist/lib/documentation-toolkit.js"
58
+ },
59
+ "./webfetch-toolkit": {
60
+ "types": "./dist/lib/webfetch-toolkit.d.ts",
61
+ "import": "./dist/lib/webfetch-toolkit.js"
58
62
  },
59
63
  "./query": {
60
64
  "types": "./dist/lib/query.d.ts",
@@ -164,6 +168,18 @@
164
168
  "types": "./dist/services/notification/channels/ses/schema.d.ts",
165
169
  "import": "./dist/services/notification/channels/ses/schema.js"
166
170
  },
171
+ "./service-notification/persistence": {
172
+ "types": "./dist/services/notification/persistence/index.d.ts",
173
+ "import": "./dist/services/notification/persistence/index.js"
174
+ },
175
+ "./service-notification/persistence/drizzle": {
176
+ "types": "./dist/services/notification/persistence/drizzle.d.ts",
177
+ "import": "./dist/services/notification/persistence/drizzle.js"
178
+ },
179
+ "./service-notification/persistence/schema": {
180
+ "types": "./dist/services/notification/persistence/schema.d.ts",
181
+ "import": "./dist/services/notification/persistence/schema.js"
182
+ },
167
183
  "./service-s3": {
168
184
  "types": "./dist/services/s3/index.d.ts",
169
185
  "import": "./dist/services/s3/index.js"
@@ -212,6 +228,7 @@
212
228
  "class-variance-authority": "^0.7.1",
213
229
  "clsx": "^2.1.1",
214
230
  "cmdk": "^1.1.1",
231
+ "drizzle-orm": "^1.0.0-rc.4-5d5b77c",
215
232
  "effect": "4.0.0-beta.99",
216
233
  "lucide-react": "^1.18.0",
217
234
  "react": "^19.2.0",
@@ -249,6 +266,9 @@
249
266
  "cmdk": {
250
267
  "optional": true
251
268
  },
269
+ "drizzle-orm": {
270
+ "optional": true
271
+ },
252
272
  "@lucas-barake/effect-form": {
253
273
  "optional": true
254
274
  },
@@ -1,142 +0,0 @@
1
- import { Effect, Schema } from "effect";
2
- import { Tool, Toolkit } from "effect/unstable/ai";
3
- import { type DocsCatalog, type DocsLocale } from "./docs-core.js";
4
- export declare const searchDocumentation: (args_0: {
5
- readonly docs: DocsCatalog;
6
- readonly locale: DocsLocale;
7
- readonly query: string;
8
- }) => Effect.Effect<{
9
- path: string;
10
- title: string;
11
- description: string;
12
- heading?: string | undefined;
13
- }[], never, never>;
14
- export declare const readDocumentation: (args_0: {
15
- readonly locale: DocsLocale;
16
- readonly paths: ReadonlyArray<string>;
17
- readonly docs: DocsCatalog;
18
- }) => Effect.Effect<{
19
- pages: {
20
- readonly slug: string;
21
- readonly path: string;
22
- readonly title: string;
23
- readonly description: string;
24
- readonly icon?: string | undefined;
25
- readonly order: number;
26
- readonly locale: string;
27
- readonly section: string;
28
- readonly type: "concept" | "how-to" | "reference" | "runbook" | "tutorial";
29
- readonly createdAt?: string | undefined;
30
- readonly updatedAt?: string | undefined;
31
- readonly legacySlugs?: readonly string[] | undefined;
32
- readonly headings: readonly Schema.Struct.ReadonlySide<{
33
- readonly depth: Schema.Literals<readonly [2, 3]>;
34
- readonly id: Schema.String;
35
- readonly title: Schema.String;
36
- }, "Type">[];
37
- readonly searchText: string;
38
- readonly sourceFile: string;
39
- readonly source: string;
40
- }[];
41
- missingPaths: string[];
42
- }, never, never>;
43
- export declare const makeChatDocumentation: (args_0: {
44
- readonly locale: DocsLocale;
45
- readonly docs: DocsCatalog;
46
- }) => Effect.Effect<{
47
- layer: import("effect/Layer").Layer<Tool.HandlersFor<{
48
- readonly readDocumentation: Tool.Tool<"readDocumentation", {
49
- readonly parameters: Schema.Struct<{
50
- readonly paths: Schema.$Array<Schema.String>;
51
- }>;
52
- readonly success: Schema.Struct<{
53
- readonly pages: Schema.$Array<Schema.Struct<{
54
- readonly slug: Schema.String;
55
- readonly path: Schema.String;
56
- readonly title: Schema.String;
57
- readonly description: Schema.String;
58
- readonly icon: Schema.optional<Schema.String>;
59
- readonly order: Schema.Number;
60
- readonly locale: Schema.String;
61
- readonly section: Schema.String;
62
- readonly type: Schema.Literals<readonly ["concept", "tutorial", "how-to", "reference", "runbook"]>;
63
- readonly createdAt: Schema.optional<Schema.String>;
64
- readonly updatedAt: Schema.optional<Schema.String>;
65
- readonly legacySlugs: Schema.optional<Schema.$Array<Schema.String>>;
66
- readonly headings: Schema.$Array<Schema.Struct<{
67
- readonly depth: Schema.Literals<readonly [2, 3]>;
68
- readonly id: Schema.String;
69
- readonly title: Schema.String;
70
- }>>;
71
- readonly searchText: Schema.String;
72
- readonly sourceFile: Schema.String;
73
- readonly source: Schema.String;
74
- }>>;
75
- readonly missingPaths: Schema.$Array<Schema.String>;
76
- }>;
77
- readonly failure: Schema.Never;
78
- readonly failureMode: "error";
79
- }, never>;
80
- readonly searchDocumentation: Tool.Tool<"searchDocumentation", {
81
- readonly parameters: Schema.Struct<{
82
- readonly query: Schema.String;
83
- }>;
84
- readonly success: Schema.$Array<Schema.Struct<{
85
- readonly path: Schema.String;
86
- readonly title: Schema.String;
87
- readonly description: Schema.String;
88
- readonly heading: Schema.optional<Schema.String>;
89
- }>>;
90
- readonly failure: Schema.Never;
91
- readonly failureMode: "error";
92
- }, never>;
93
- }>, never, never>;
94
- systemPrompt: string;
95
- toolkit: Toolkit.Toolkit<{
96
- readonly readDocumentation: Tool.Tool<"readDocumentation", {
97
- readonly parameters: Schema.Struct<{
98
- readonly paths: Schema.$Array<Schema.String>;
99
- }>;
100
- readonly success: Schema.Struct<{
101
- readonly pages: Schema.$Array<Schema.Struct<{
102
- readonly slug: Schema.String;
103
- readonly path: Schema.String;
104
- readonly title: Schema.String;
105
- readonly description: Schema.String;
106
- readonly icon: Schema.optional<Schema.String>;
107
- readonly order: Schema.Number;
108
- readonly locale: Schema.String;
109
- readonly section: Schema.String;
110
- readonly type: Schema.Literals<readonly ["concept", "tutorial", "how-to", "reference", "runbook"]>;
111
- readonly createdAt: Schema.optional<Schema.String>;
112
- readonly updatedAt: Schema.optional<Schema.String>;
113
- readonly legacySlugs: Schema.optional<Schema.$Array<Schema.String>>;
114
- readonly headings: Schema.$Array<Schema.Struct<{
115
- readonly depth: Schema.Literals<readonly [2, 3]>;
116
- readonly id: Schema.String;
117
- readonly title: Schema.String;
118
- }>>;
119
- readonly searchText: Schema.String;
120
- readonly sourceFile: Schema.String;
121
- readonly source: Schema.String;
122
- }>>;
123
- readonly missingPaths: Schema.$Array<Schema.String>;
124
- }>;
125
- readonly failure: Schema.Never;
126
- readonly failureMode: "error";
127
- }, never>;
128
- readonly searchDocumentation: Tool.Tool<"searchDocumentation", {
129
- readonly parameters: Schema.Struct<{
130
- readonly query: Schema.String;
131
- }>;
132
- readonly success: Schema.$Array<Schema.Struct<{
133
- readonly path: Schema.String;
134
- readonly title: Schema.String;
135
- readonly description: Schema.String;
136
- readonly heading: Schema.optional<Schema.String>;
137
- }>>;
138
- readonly failure: Schema.Never;
139
- readonly failureMode: "error";
140
- }, never>;
141
- }>;
142
- }, never, never>;
@@ -1,54 +0,0 @@
1
- import { Context, Effect, JsonSchema, Layer, Schema } from "effect";
2
- import { Tool, Toolkit } from "effect/unstable/ai";
3
- import { ApiClient } from "./httpapi-client.js";
4
- import { HttpApiSpec, type HttpApiOperationEntry } from "./httpapi-helpers.js";
5
- export type HttpApiAiConfig = {
6
- readonly needsApproval?: (operation: HttpApiOperationEntry) => boolean;
7
- readonly strict?: (operation: HttpApiOperationEntry) => boolean;
8
- readonly transformResult?: (operation: HttpApiOperationEntry, result: unknown) => unknown;
9
- };
10
- export declare const makeOpenAiStrictJsonSchema: (schema: JsonSchema.JsonSchema) => JsonSchema.JsonSchema;
11
- export declare const makeHttpApiAiToolkit: (config: HttpApiAiConfig) => Effect.Effect<{
12
- systemPrompt: string;
13
- operations: HttpApiOperationEntry[];
14
- toolkit: Toolkit.Toolkit<{
15
- readonly [x: string]: Tool.Tool<string, {
16
- readonly parameters: Schema.Struct<{}>;
17
- readonly success: Schema.Unknown;
18
- readonly failure: Schema.String;
19
- readonly failureMode: "return";
20
- }, never>;
21
- }>;
22
- layer: Layer.Layer<Tool.Handler<string>, never, ApiClient>;
23
- }, Error, HttpApiSpec>;
24
- declare const HttpApiAi_base: Context.ServiceClass<HttpApiAi, "HttpApiAi", {
25
- systemPrompt: string;
26
- operations: HttpApiOperationEntry[];
27
- toolkit: Toolkit.Toolkit<{
28
- readonly [x: string]: Tool.Tool<string, {
29
- readonly parameters: Schema.Struct<{}>;
30
- readonly success: Schema.Unknown;
31
- readonly failure: Schema.String;
32
- readonly failureMode: "return";
33
- }, never>;
34
- }>;
35
- layer: Layer.Layer<Tool.Handler<string>, never, ApiClient>;
36
- }> & {
37
- readonly make: (config: HttpApiAiConfig) => Effect.Effect<{
38
- systemPrompt: string;
39
- operations: HttpApiOperationEntry[];
40
- toolkit: Toolkit.Toolkit<{
41
- readonly [x: string]: Tool.Tool<string, {
42
- readonly parameters: Schema.Struct<{}>;
43
- readonly success: Schema.Unknown;
44
- readonly failure: Schema.String;
45
- readonly failureMode: "return";
46
- }, never>;
47
- }>;
48
- layer: Layer.Layer<Tool.Handler<string>, never, ApiClient>;
49
- }, Error, HttpApiSpec>;
50
- };
51
- export declare class HttpApiAi extends HttpApiAi_base {
52
- static readonly layer: (config: HttpApiAiConfig) => Layer.Layer<HttpApiAi, Error, HttpApiSpec>;
53
- }
54
- export {};