@automagik/omni 2.260910.11 → 2.260910.12

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.
@@ -174442,6 +174442,7 @@ var init_schema2 = __esm(() => {
174442
174442
  id: uuid("id").primaryKey().defaultRandom(),
174443
174443
  name: varchar("name", { length: 100 }).notNull(),
174444
174444
  eventType: varchar("event_type", { length: 255 }).notNull(),
174445
+ excludeTypes: jsonb("exclude_types").$type(),
174445
174446
  filters: jsonb("filters").$type(),
174446
174447
  cursor: bigint2("cursor", { mode: "number" }).notNull().default(0),
174447
174448
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
@@ -251644,7 +251645,7 @@ var init_sentry_scrub = __esm(() => {
251644
251645
  var require_package7 = __commonJS((exports, module) => {
251645
251646
  module.exports = {
251646
251647
  name: "@omni/api",
251647
- version: "2.260910.11",
251648
+ version: "2.260910.12",
251648
251649
  private: true,
251649
251650
  type: "module",
251650
251651
  exports: {
@@ -370514,6 +370515,20 @@ var init_dead_letters = __esm(() => {
370514
370515
  function escapeLikePattern(value) {
370515
370516
  return value.replace(/([\\%_])/g, "\\$1");
370516
370517
  }
370518
+ function eventTypeGlobClause(globs) {
370519
+ const exact = globs.filter((t) => !t.endsWith("*"));
370520
+ const prefixes = globs.filter((t) => t.endsWith("*")).map((t) => t.slice(0, -1));
370521
+ const clauses = [
370522
+ ...exact.length ? [inArray(omniEvents.eventType, exact)] : [],
370523
+ ...prefixes.map((p2) => like(omniEvents.eventType, `${escapeLikePattern(p2)}%`))
370524
+ ];
370525
+ return clauses.length === 1 ? clauses[0] : or2(...clauses);
370526
+ }
370527
+ function eventTypeFilterClause(include, exclude) {
370528
+ const inc = include?.length ? eventTypeGlobClause(include) : undefined;
370529
+ const exc = exclude?.length ? eventTypeGlobClause(exclude) : undefined;
370530
+ return and2(inc, exc ? not2(exc) : undefined);
370531
+ }
370517
370532
  function consumerTypeMatches(filter, eventType) {
370518
370533
  return filter.endsWith("*") ? eventType.startsWith(filter.slice(0, -1)) : filter === eventType;
370519
370534
  }
@@ -370533,6 +370548,7 @@ class EventService {
370533
370548
  personId,
370534
370549
  chatId,
370535
370550
  eventType,
370551
+ excludeEventType,
370536
370552
  contentType,
370537
370553
  direction,
370538
370554
  since,
@@ -370556,17 +370572,9 @@ class EventService {
370556
370572
  if (chatId) {
370557
370573
  conditions3.push(eq(omniEvents.chatUuid, chatId));
370558
370574
  }
370559
- if (eventType?.length) {
370560
- const exact = eventType.filter((t) => !t.endsWith("*"));
370561
- const prefixes = eventType.filter((t) => t.endsWith("*")).map((t) => t.slice(0, -1));
370562
- const typeClauses = [
370563
- ...exact.length ? [inArray(omniEvents.eventType, exact)] : [],
370564
- ...prefixes.map((p2) => like(omniEvents.eventType, `${escapeLikePattern(p2)}%`))
370565
- ];
370566
- const combined = typeClauses.length === 1 ? typeClauses[0] : or2(...typeClauses);
370567
- if (combined)
370568
- conditions3.push(combined);
370569
- }
370575
+ const typeClause = eventTypeFilterClause(eventType, excludeEventType);
370576
+ if (typeClause)
370577
+ conditions3.push(typeClause);
370570
370578
  if (contentType?.length) {
370571
370579
  conditions3.push(inArray(omniEvents.contentType, contentType));
370572
370580
  }
@@ -370830,7 +370838,13 @@ class EventConsumerService {
370830
370838
  async create(input) {
370831
370839
  const head = await this.head();
370832
370840
  const cursor = resolveInitialCursor(input.startFrom ?? "now", head);
370833
- const [created] = await this.db.insert(durableConsumers).values({ name: input.name, eventType: input.eventType, filters: input.filters ?? null, cursor }).onConflictDoNothing({ target: durableConsumers.name }).returning();
370841
+ const [created] = await this.db.insert(durableConsumers).values({
370842
+ name: input.name,
370843
+ eventType: input.eventType,
370844
+ excludeTypes: input.excludeTypes?.length ? input.excludeTypes : null,
370845
+ filters: input.filters ?? null,
370846
+ cursor
370847
+ }).onConflictDoNothing({ target: durableConsumers.name }).returning();
370834
370848
  if (!created) {
370835
370849
  throw new ConflictError("DurableConsumer", `a consumer named '${input.name}' already exists`, {
370836
370850
  name: input.name
@@ -370890,7 +370904,7 @@ class EventConsumerService {
370890
370904
  return { ...updated, head, lag: computeLag(head, updated.cursor) };
370891
370905
  }
370892
370906
  async scanPage(consumer, limit2) {
370893
- const typeClause = consumer.eventType.endsWith("*") ? like(omniEvents.eventType, `${escapeLikePattern(consumer.eventType.slice(0, -1))}%`) : eq(omniEvents.eventType, consumer.eventType);
370907
+ const typeClause = eventTypeFilterClause([consumer.eventType], consumer.excludeTypes ?? undefined);
370894
370908
  return this.db.select().from(omniEvents).where(and2(gt(omniEvents.journalSeq, consumer.cursor), typeClause)).orderBy(asc(omniEvents.journalSeq)).limit(limit2);
370895
370909
  }
370896
370910
  }
@@ -379973,6 +379987,7 @@ var init_event_consumers2 = __esm(() => {
379973
379987
  id: exports_external.string().uuid().openapi({ description: "Consumer UUID" }),
379974
379988
  name: exports_external.string().openapi({ description: "Unique consumer name (the follow/ack handle)" }),
379975
379989
  eventType: exports_external.string().openapi({ description: "Type filter: exact event type or trailing-* prefix glob" }),
379990
+ excludeTypes: exports_external.array(exports_external.string()).nullable().openapi({ description: "Type globs dropped from the stream (exclusion wins over eventType), or null" }),
379976
379991
  filters: exports_external.array(ConsumerConditionSchema).nullable().openapi({ description: "Payload conditions (AND), or null" }),
379977
379992
  cursor: exports_external.number().int().openapi({ description: "Last acked journal_seq; delivery resumes strictly after it" }),
379978
379993
  head: exports_external.number().int().openapi({ description: "Highest journal_seq currently in the journal" }),
@@ -379983,6 +379998,7 @@ var init_event_consumers2 = __esm(() => {
379983
379998
  CreateConsumerSchema = exports_external.object({
379984
379999
  name: exports_external.string().min(1).max(100).regex(CONSUMER_NAME_PATTERN, "Consumer name must be lowercase tokens: a-z 0-9 . _ - (starting alphanumeric)").openapi({ description: "Unique consumer name (e.g. deploy-tracker)" }),
379985
380000
  eventType: exports_external.string().min(1).max(255).openapi({ description: "Type filter: exact event type, or trailing-* prefix glob (e.g. custom.github.*)" }),
380001
+ excludeTypes: exports_external.array(exports_external.string().min(1).max(255)).max(20).optional().openapi({ description: "Type globs to drop (same syntax as eventType); exclusion wins over inclusion" }),
379986
380002
  filters: exports_external.array(ConsumerConditionSchema).max(20).optional().openapi({ description: "Payload conditions (AND) \u2014 same matcher as events wait --filter" }),
379987
380003
  startFrom: exports_external.enum(["now", "beginning"]).optional().openapi({ description: "Initial cursor: 'now' = journal head (default), 'beginning' = full replay" })
379988
380004
  });
@@ -380299,6 +380315,7 @@ function registerEventSchemas(registry4) {
380299
380315
  personId: exports_external.string().uuid().optional().openapi({ description: "Filter by person" }),
380300
380316
  chatId: exports_external.string().uuid().optional().openapi({ description: "Filter by chat UUID" }),
380301
380317
  eventType: exports_external.string().optional().openapi({ description: "Event types (comma-separated)" }),
380318
+ excludeEventType: exports_external.string().optional().openapi({ description: "Event type globs to drop (comma-separated); exclusion wins over eventType" }),
380302
380319
  contentType: exports_external.string().optional().openapi({ description: "Content types (comma-separated)" }),
380303
380320
  direction: exports_external.enum(["inbound", "outbound"]).optional().openapi({ description: "Direction" }),
380304
380321
  since: exports_external.string().datetime().optional().openapi({ description: "Start date" }),
@@ -386871,6 +386888,7 @@ var init_events4 = __esm(() => {
386871
386888
  personId: exports_external.string().uuid().optional(),
386872
386889
  chatId: exports_external.string().uuid().optional(),
386873
386890
  eventType: exports_external.string().optional().transform((v2) => v2?.split(",")),
386891
+ excludeEventType: exports_external.string().optional().transform((v2) => v2?.split(",")),
386874
386892
  contentType: exports_external.string().optional().transform((v2) => v2?.split(",")),
386875
386893
  direction: exports_external.enum(["inbound", "outbound"]).optional(),
386876
386894
  since: optionalDateParam("since"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260910.11",
3
+ "version": "2.260910.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/automagik-dev/omni.git",