@tolinax/ayoune-interfaces 2026.45.0 → 2026.47.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.
@@ -538,6 +538,7 @@ export declare enum aMN {
538
538
  RunningPipelines = "RunningPipelines",
539
539
  SalesTemplates = "SalesTemplates",
540
540
  ScoreLogs = "ScoreLogs",
541
+ ScraperQuotaUsage = "ScraperQuotaUsage",
541
542
  SearchBars = "SearchBars",
542
543
  SearchBoxes = "SearchBoxes",
543
544
  SearchKeywords = "SearchKeywords",
@@ -542,6 +542,7 @@ var aMN;
542
542
  aMN["RunningPipelines"] = "RunningPipelines";
543
543
  aMN["SalesTemplates"] = "SalesTemplates";
544
544
  aMN["ScoreLogs"] = "ScoreLogs";
545
+ aMN["ScraperQuotaUsage"] = "ScraperQuotaUsage";
545
546
  aMN["SearchBars"] = "SearchBars";
546
547
  aMN["SearchBoxes"] = "SearchBoxes";
547
548
  aMN["SearchKeywords"] = "SearchKeywords";
@@ -6291,6 +6291,19 @@ const modelsAndRights = [
6291
6291
  updateBy: "_id",
6292
6292
  availableInSDK: false,
6293
6293
  },
6294
+ {
6295
+ // Scraper Platform-Service Refactor (Phase 1) — Platform-Asset,
6296
+ // kein _customerID-Field. Nur via api-superuser lesbar.
6297
+ plural: "ScraperQuotaUsage",
6298
+ singular: "ScraperQuotaUsage",
6299
+ module: "su",
6300
+ right: "su.scraper-quota",
6301
+ readOnly: true,
6302
+ importable: false,
6303
+ allowDuplicate: false,
6304
+ updateBy: "_id",
6305
+ availableInSDK: false,
6306
+ },
6294
6307
  {
6295
6308
  plural: "SearchBars",
6296
6309
  singular: "SearchBar",
@@ -139,5 +139,15 @@ export interface IKeywordResearch extends IDefaultFields {
139
139
  maxCPCs: number[];
140
140
  costRuns: ICostRun[];
141
141
  results: IResults;
142
+ /**
143
+ * Scraper-Service-Tier — determiniert welcher Scraper-Provider für Jobs
144
+ * aus dieser KeywordResearch gewählt wird. Default 'standard'.
145
+ * Siehe `platform/core/src/lib/flags/README.md`.
146
+ */
147
+ scraperTier?: "economy" | "standard" | "premium";
148
+ /**
149
+ * Opt-in-Fallback auf Eigen-Infrastruktur (Phase 1.5 / Phase 7).
150
+ */
151
+ preferOwnInfra?: boolean;
142
152
  }
143
153
  export {};
@@ -84,4 +84,16 @@ export interface IMarketResearch extends IDefaultFields {
84
84
  };
85
85
  maxCPCs: number[];
86
86
  costRuns: ICostRun[];
87
+ /**
88
+ * Scraper-Service-Tier — determiniert welcher Scraper-Provider für Jobs
89
+ * aus dieser MarketResearch gewählt wird. Default 'standard'.
90
+ * Siehe `platform/core/src/lib/flags/README.md` und
91
+ * `crawlers/core-scraper-apis/src/lib/providerRegistry.ts`.
92
+ */
93
+ scraperTier?: "economy" | "standard" | "premium";
94
+ /**
95
+ * Opt-in-Fallback auf Eigen-Infrastruktur (Phase 1.5 / Phase 7).
96
+ * In Phase 1: triggert Silent-Fallback auf Nimble weil ownInfra Stub.
97
+ */
98
+ preferOwnInfra?: boolean;
87
99
  }
@@ -1,4 +1,6 @@
1
1
  import { IDefaultFields } from "./IDefaultFields";
2
+ import { INotificationAction } from "./INotificationAction";
3
+ import { INotificationAttachment, INotificationSender } from "./INotificationAttachment";
2
4
  export interface INotification extends IDefaultFields {
3
5
  _customerID: ObjectId;
4
6
  _clientID?: ObjectId[];
@@ -14,4 +16,22 @@ export interface INotification extends IDefaultFields {
14
16
  obj?: string;
15
17
  view?: string;
16
18
  params?: object;
19
+ /**
20
+ * Who triggered the notification. Optional — system events pass `null`
21
+ * and the consumer falls back to a generic `aYOUne` header.
22
+ */
23
+ sender?: INotificationSender;
24
+ /**
25
+ * Typed rich-content attachments — calendar entries, tasks, invoices,
26
+ * orders, etc. — rendered as inline preview cards in the notifications
27
+ * panel. See `INotificationAttachment` for the supported types and
28
+ * the enrichment contract (producer may provide `{ type, _id }` and the
29
+ * orchestrator fills `preview` via model lookup).
30
+ */
31
+ attachments?: INotificationAttachment[];
32
+ /**
33
+ * Action buttons rendered under the notification (1-3 typical), and —
34
+ * where the OS supports it — as native Web-Push action buttons (first two).
35
+ */
36
+ actions?: INotificationAction[];
17
37
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Action buttons attached to a notification. Rendered both as inline buttons
3
+ * in the in-app notifications panel and (up to two primary actions) as native
4
+ * Web-Push action buttons on supporting platforms.
5
+ *
6
+ * Four dispatch modes:
7
+ * - `link` — internal router navigation (`href` relative to the app)
8
+ * - `api` — `fetch()` call to an absolute endpoint, optionally with
9
+ * a confirm prompt; the service-worker can execute this
10
+ * without the PWA being open (Bearer-token attached).
11
+ * - `reply` — native browser reply text field (if supported) OR a
12
+ * dialog in the PWA; the text is POSTed to `endpoint`.
13
+ * - `ai-copilot` — opens the Comm-Sidebar Copilot panel with
14
+ * `copilotContext` pre-populated as the first user message.
15
+ */
16
+ export type NotificationActionType = "link" | "api" | "reply" | "ai-copilot";
17
+ /** Visual weight of the action button. */
18
+ export type NotificationActionStyle = "primary" | "secondary" | "danger";
19
+ export interface INotificationAction {
20
+ /** Stable identifier per notification — used as the Web-Push `action` id. */
21
+ id: string;
22
+ /** Button label. May be a literal or an i18n key. */
23
+ label: string;
24
+ type: NotificationActionType;
25
+ style?: NotificationActionStyle;
26
+ /** Material icon name rendered before the label. */
27
+ icon?: string;
28
+ /** For `type: "link"` — absolute or app-relative route. */
29
+ href?: string;
30
+ /** For `type: "api"` or `type: "reply"` — absolute endpoint (service-worker
31
+ * executable). POST is the default for mutation-ish actions. */
32
+ endpoint?: string;
33
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
34
+ /** Static payload merged with dynamic input (reply text, notification id). */
35
+ body?: Record<string, unknown>;
36
+ /** Confirmation prompt before firing (useful for destructive actions). */
37
+ confirmLabel?: string;
38
+ /** For `type: "ai-copilot"` — the prompt pre-populated into the Copilot
39
+ * panel when the user taps this action. Supports `{{variable}}` tokens
40
+ * that are rendered against the notification's `data` context before
41
+ * being inserted into the input. */
42
+ copilotContext?: string;
43
+ /** Should this action close/dismiss the notification after firing? */
44
+ dismissOnComplete?: boolean;
45
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Structured rich-content attachments for notifications (and — in phase 4 —
3
+ * chat messages). Mirrors the legacy AngularJS attachment system documented
4
+ * in `archive/legacy-angular1/pug/chatsidebar.pug:248-334`, where chat
5
+ * messages carried typed entity references (`type` + `content` + `preview`)
6
+ * that the renderer switched over to display inline entity cards.
7
+ *
8
+ * Producer contract:
9
+ * 1. The caller of `POST /notifications/send` may provide either:
10
+ * - a bare reference: `{ type, _id }` — the orchestrator enriches it by
11
+ * looking up the entity and projecting the relevant fields into
12
+ * `preview`, OR
13
+ * - a fully-formed attachment with `preview` already populated — skips
14
+ * the lookup (use when the caller already has the data loaded).
15
+ * 2. Consumers (comm-sidebar notifications-panel, mobile-app PWA) dispatch
16
+ * on `type` and render a type-specific preview component, falling back
17
+ * to a generic card for unknown types.
18
+ *
19
+ * Phase 1 ships 5 core types. Subsequent phases add the remaining 12+
20
+ * types from the legacy chat system (document, consumer, contract,
21
+ * shipping, productionorder, creditnote, internalorder, offer, assignment,
22
+ * question, snippet, media).
23
+ */
24
+ export type NotificationAttachmentType = "calendarentry" | "task" | "invoice" | "permissionrequest" | "supplierorder";
25
+ /** Shared shape — all previews carry an optional deep-link override. */
26
+ interface INotificationAttachmentBase {
27
+ /** Reference to the source entity (the document `_id`). Required for
28
+ * enrichment and deep-linking. */
29
+ _id: ObjectId;
30
+ /** Optional router path used when the user taps the preview card.
31
+ * When absent, the consumer falls back to `/{type}/{_id}`. */
32
+ href?: string;
33
+ }
34
+ export interface ICalendarEntryPreview extends INotificationAttachmentBase {
35
+ summary?: string;
36
+ description?: string;
37
+ start?: Date | string;
38
+ end?: Date | string;
39
+ typ?: string;
40
+ status?: string;
41
+ location?: string;
42
+ allDay?: boolean;
43
+ organizer?: {
44
+ _id?: ObjectId;
45
+ name?: string;
46
+ email?: string;
47
+ };
48
+ attendees?: Array<{
49
+ _id?: ObjectId;
50
+ name?: string;
51
+ email?: string;
52
+ rsvp?: "accepted" | "declined" | "tentative" | "pending";
53
+ }>;
54
+ }
55
+ export interface ITaskPreview extends INotificationAttachmentBase {
56
+ title?: string;
57
+ ticketIdentifier?: string;
58
+ status?: string;
59
+ priority?: string;
60
+ type?: string;
61
+ due?: Date | string;
62
+ assignee?: {
63
+ _id?: ObjectId;
64
+ name?: string;
65
+ avatar?: string;
66
+ };
67
+ project?: {
68
+ _id?: ObjectId;
69
+ name?: string;
70
+ };
71
+ points?: number;
72
+ }
73
+ export interface IInvoicePreview extends INotificationAttachmentBase {
74
+ nbr?: number;
75
+ referenceNumber?: string;
76
+ title?: string;
77
+ total?: number;
78
+ currency?: string;
79
+ dueDate?: Date | string;
80
+ paid?: boolean;
81
+ status?: string;
82
+ receiver?: {
83
+ _id?: ObjectId;
84
+ name?: string;
85
+ };
86
+ }
87
+ export interface IPermissionRequestPreview extends INotificationAttachmentBase {
88
+ reason?: string;
89
+ permissionName?: string;
90
+ askedOn?: Date | string;
91
+ fromUser?: {
92
+ _id?: ObjectId;
93
+ name?: string;
94
+ avatar?: string;
95
+ };
96
+ valid_from?: Date | string;
97
+ valid_till?: Date | string;
98
+ approved?: boolean;
99
+ declined?: boolean;
100
+ temporary?: boolean;
101
+ }
102
+ export interface ISupplierOrderPreview extends INotificationAttachmentBase {
103
+ nbr?: string | number;
104
+ shopOrderNbr?: string;
105
+ title?: string;
106
+ total?: number;
107
+ currency?: string;
108
+ confirmed?: boolean;
109
+ needsInternalApproval?: string;
110
+ internalApproved?: boolean;
111
+ internalDeclined?: boolean;
112
+ supplier?: {
113
+ _id?: ObjectId;
114
+ name?: string;
115
+ };
116
+ expectedDelivery?: Date | string;
117
+ }
118
+ export type INotificationAttachment = {
119
+ type: "calendarentry";
120
+ preview: ICalendarEntryPreview;
121
+ } | {
122
+ type: "task";
123
+ preview: ITaskPreview;
124
+ } | {
125
+ type: "invoice";
126
+ preview: IInvoicePreview;
127
+ } | {
128
+ type: "permissionrequest";
129
+ preview: IPermissionRequestPreview;
130
+ } | {
131
+ type: "supplierorder";
132
+ preview: ISupplierOrderPreview;
133
+ };
134
+ /** Producer-side shape — accepts either a bare reference (orchestrator will
135
+ * enrich) or a fully-populated attachment. */
136
+ export type INotificationAttachmentInput = {
137
+ type: NotificationAttachmentType;
138
+ _id: ObjectId;
139
+ } | INotificationAttachment;
140
+ /** Sender metadata carried on the notification document so the in-app panel
141
+ * can show "Alice assigned you a task" with the avatar of the triggering
142
+ * actor rather than a faceless system row. */
143
+ export interface INotificationSender {
144
+ _userId?: ObjectId;
145
+ name?: string;
146
+ avatar?: string;
147
+ email?: string;
148
+ }
149
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Structured rich-content attachments for notifications (and — in phase 4 —
4
+ * chat messages). Mirrors the legacy AngularJS attachment system documented
5
+ * in `archive/legacy-angular1/pug/chatsidebar.pug:248-334`, where chat
6
+ * messages carried typed entity references (`type` + `content` + `preview`)
7
+ * that the renderer switched over to display inline entity cards.
8
+ *
9
+ * Producer contract:
10
+ * 1. The caller of `POST /notifications/send` may provide either:
11
+ * - a bare reference: `{ type, _id }` — the orchestrator enriches it by
12
+ * looking up the entity and projecting the relevant fields into
13
+ * `preview`, OR
14
+ * - a fully-formed attachment with `preview` already populated — skips
15
+ * the lookup (use when the caller already has the data loaded).
16
+ * 2. Consumers (comm-sidebar notifications-panel, mobile-app PWA) dispatch
17
+ * on `type` and render a type-specific preview component, falling back
18
+ * to a generic card for unknown types.
19
+ *
20
+ * Phase 1 ships 5 core types. Subsequent phases add the remaining 12+
21
+ * types from the legacy chat system (document, consumer, contract,
22
+ * shipping, productionorder, creditnote, internalorder, offer, assignment,
23
+ * question, snippet, media).
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ import { IDefaultFields } from "./IDefaultFields";
2
+ import { ScraperProviderName } from "./INormalizedSerp";
3
+ /**
4
+ * Scraper-Provider Monats-Quota-Verbrauch (Hot-Path-State für das
5
+ * Quota-Gate in der Provider-Registry).
6
+ *
7
+ * Ein Dokument pro (provider, month). `_id` ist der String
8
+ * `"YYYY-MM:{provider}"`, z.B. `"2026-04:nimble"`. Pro Provider-Call wird
9
+ * `requestsUsed` mit atomarem `$inc` hochgezählt — keine Redis-Counter,
10
+ * kein Sync-Worker (bei ~8 req/s Peak gesamt ist Mongo-$inc auf einem
11
+ * Dokument pro Provider+Monat trivial).
12
+ *
13
+ * Siehe:
14
+ * - `crawlers/core-scraper-apis/src/lib/quotaGate.ts` (Hot-Path + Gate)
15
+ * - `platform/core/src/lib/flags/README.md` (Pricing-Flag-Konventionen)
16
+ * - Plan §1.6 + §1.9
17
+ *
18
+ * **Platform-Service-Konvention**: kein `_customerID`-Feld. Scraper-Kapazität
19
+ * ist Tolinax-Platform-Asset, nicht tenant-scoped. Per-Customer-Attribution
20
+ * des Verbrauchs läuft über Events (`scraper-request` Events mit
21
+ * `_customerID` im Event-Doc), nicht über ScraperQuotaUsage.
22
+ */
23
+ export interface IScraperQuotaUsage extends Omit<IDefaultFields, "_id"> {
24
+ _id: string;
25
+ provider: ScraperProviderName;
26
+ monthStart: Date;
27
+ monthEnd: Date;
28
+ /** Snapshot aus `scraper.pricing.{provider}.monthlyQuota` zum Monatsstart */
29
+ quotaLimit: number;
30
+ /** Atomarer Counter, `$inc` pro Provider-Call */
31
+ requestsUsed: number;
32
+ /** Erhöht statt requestsUsed sobald requestsUsed > quotaLimit */
33
+ overageRequests: number;
34
+ lastUpdated: Date;
35
+ /** Snapshot der `scraper.pricing.{provider}.version` zum Monatsstart — für Audit-Trail */
36
+ pricingVersion: number;
37
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  import { IDefaultFields } from "./IDefaultFields";
2
+ import { INormalizedSerp, ScraperProviderName } from "./INormalizedSerp";
2
3
  interface ICrawlingAgent {
3
4
  _crawlingAgent: ObjectId;
4
5
  _device: ObjectId;
@@ -111,5 +112,18 @@ export interface ISerp extends IDefaultFields {
111
112
  parsingErrors?: any;
112
113
  proxyHostName?: string;
113
114
  raw?: any;
115
+ /**
116
+ * Scraper Platform-Service Refactor (Phase 1) — welcher Provider hat
117
+ * dieses SERP geliefert. Legacy-Pfad-Serps haben keinen provider-Eintrag
118
+ * (undefined). Werte: 'nimble' | 'oxy' | 'soax' | 'ownInfra'.
119
+ */
120
+ provider?: ScraperProviderName;
121
+ /**
122
+ * Scraper Platform-Service Refactor (Phase 1) — normalisierte Provider-
123
+ * agnostische Repräsentation. `raw` bleibt befüllt als Forensik + für
124
+ * existierende `storeSEA*`-Konsumenten. Phase 4 (Storage-Decompose)
125
+ * migriert Konsumenten auf `normalized`.
126
+ */
127
+ normalized?: INormalizedSerp;
114
128
  }
115
129
  export {};
@@ -462,6 +462,8 @@ export * from "./INewsletterType";
462
462
  export * from "./INewsSource";
463
463
  export * from "./INormalizedSerp";
464
464
  export * from "./INotification";
465
+ export * from "./INotificationAction";
466
+ export * from "./INotificationAttachment";
465
467
  export * from "./INotificationPolicy";
466
468
  export * from "./INotificationPreference";
467
469
  export * from "./IOffer";
@@ -572,6 +574,7 @@ export * from "./IRolloutStrategy";
572
574
  export * from "./IRunningPipeline";
573
575
  export * from "./ISalesTemplate";
574
576
  export * from "./IScoreLog";
577
+ export * from "./IScraperQuotaUsage";
575
578
  export * from "./ISearchBar";
576
579
  export * from "./ISearchBox";
577
580
  export * from "./ISearchKeyword";
@@ -478,6 +478,8 @@ __exportStar(require("./INewsletterType"), exports);
478
478
  __exportStar(require("./INewsSource"), exports);
479
479
  __exportStar(require("./INormalizedSerp"), exports);
480
480
  __exportStar(require("./INotification"), exports);
481
+ __exportStar(require("./INotificationAction"), exports);
482
+ __exportStar(require("./INotificationAttachment"), exports);
481
483
  __exportStar(require("./INotificationPolicy"), exports);
482
484
  __exportStar(require("./INotificationPreference"), exports);
483
485
  __exportStar(require("./IOffer"), exports);
@@ -588,6 +590,7 @@ __exportStar(require("./IRolloutStrategy"), exports);
588
590
  __exportStar(require("./IRunningPipeline"), exports);
589
591
  __exportStar(require("./ISalesTemplate"), exports);
590
592
  __exportStar(require("./IScoreLog"), exports);
593
+ __exportStar(require("./IScraperQuotaUsage"), exports);
591
594
  __exportStar(require("./ISearchBar"), exports);
592
595
  __exportStar(require("./ISearchBox"), exports);
593
596
  __exportStar(require("./ISearchKeyword"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolinax/ayoune-interfaces",
3
- "version": "2026.45.0",
3
+ "version": "2026.47.0",
4
4
  "description": "Houses TypeScript interfaces for aYOUne",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",