@inneropen/marvin-sdk 4.2.0 → 4.4.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.
@@ -1,5 +1,5 @@
1
- import { H as HttpClient } from './HttpClient-B_rEmJuO.js';
2
- import { t as components, A as AuthToken } from './index-BEEbnrXV.js';
1
+ import { H as HttpClient, a as BinaryResponse } from './HttpClient-DXMNOPqu.js';
2
+ import { t as components, A as AuthToken } from './index-7sv2m2Pe.js';
3
3
 
4
4
  /**
5
5
  * Platform API Types
@@ -14,6 +14,18 @@ import { t as components, A as AuthToken } from './index-BEEbnrXV.js';
14
14
  type PlatformEntry = components['schemas']['EntryRead'];
15
15
  type PlatformEntryCreate = components['schemas']['EntryCreate'];
16
16
  type PlatformEntryUpdate = components['schemas']['EntryUpdate'];
17
+ /**
18
+ * Entry counts by status (`GET /api/platform/entries/counts`): every known status, zero-filled,
19
+ * plus `total` — e.g. `{ inbox: 2, draft: 5, needs_review: 1, published: 40, …, total: 48 }`.
20
+ */
21
+ type PlatformEntryCounts = Record<string, number>;
22
+ /**
23
+ * The dashboard (`GET /api/platform/stats/dashboard`): recent activity and the "needs attention"
24
+ * counts — inbox, drafts, entries needing review, pending AI suggestions, failures in the last 7 days.
25
+ */
26
+ type PlatformDashboard = components['schemas']['DashboardData'];
27
+ type PlatformAttentionCounts = components['schemas']['AttentionCounts'];
28
+ type PlatformRecentEvent = components['schemas']['RecentEvent'];
17
29
  /**
18
30
  * Tag (Platform API) — the shared, group-scoped label vocabulary.
19
31
  */
@@ -51,6 +63,28 @@ interface SmartCollectionRules {
51
63
  /** how to combine the dimensions above (default "all") */
52
64
  match?: 'all' | 'any';
53
65
  }
66
+ /**
67
+ * Smart-collection rule preview: what unsaved rules would select, without saving anything.
68
+ */
69
+ interface SmartRulesPreviewRequest {
70
+ /** Which kind of item the rules select (default 'entry'). */
71
+ targetType?: 'entry' | 'asset' | 'resource';
72
+ /** The rules, in the same shape as a collection's `smartRules`. */
73
+ smartRules?: SmartCollectionRules | Record<string, unknown> | null;
74
+ /** How many matches to list (default 10, at most 50); `total` counts them all. */
75
+ limit?: number;
76
+ }
77
+ type SmartRulesPreview = components['schemas']['SmartRulesPreview'];
78
+ /**
79
+ * One member of a collection of any target type (`GET /api/platform/collections/{id}/members`).
80
+ */
81
+ interface CollectionMember {
82
+ id: string;
83
+ /** The entry's title, or the asset's / resource's name. */
84
+ label: string;
85
+ slug: string | null;
86
+ type: 'entry' | 'asset' | 'resource';
87
+ }
54
88
  /**
55
89
  * Resource (Platform API - full CRUD)
56
90
  */
@@ -111,6 +145,10 @@ declare class EntriesModule {
111
145
  * List all entries
112
146
  */
113
147
  list(): Promise<PlatformEntry[]>;
148
+ /**
149
+ * Entry counts by status, zero-filled, plus `total` (what the sidebar's inbox badge reads).
150
+ */
151
+ counts(): Promise<PlatformEntryCounts>;
114
152
  /**
115
153
  * Get a single entry by ID
116
154
  */
@@ -141,6 +179,24 @@ declare class EntriesModule {
141
179
  * Remove entry from a collection
142
180
  */
143
181
  removeFromCollection(entryId: string, collectionId: string): Promise<void>;
182
+ /**
183
+ * Apply the entry's staged AI suggestion (`suggestionJson`) and clear it — the approval half of
184
+ * AI write-back. Returns the updated entry.
185
+ */
186
+ applySuggestion(id: string): Promise<PlatformEntry>;
187
+ /**
188
+ * Discard the entry's staged AI suggestion without applying it.
189
+ */
190
+ rejectSuggestion(id: string): Promise<PlatformEntry>;
191
+ /**
192
+ * Approve an AI-suggested asset on an entry: it becomes a normal attached asset (and reaches
193
+ * published output).
194
+ */
195
+ approveSuggestedAsset(entryId: string, assetId: string): Promise<PlatformEntry>;
196
+ /**
197
+ * Reject an AI-suggested asset: unlink it, and delete the asset if nothing else uses it.
198
+ */
199
+ rejectSuggestedAsset(entryId: string, assetId: string): Promise<PlatformEntry>;
144
200
  }
145
201
 
146
202
  /**
@@ -170,6 +226,17 @@ declare class CollectionsModule {
170
226
  * server keeps membership in sync. Pass extra fields (description, icon, …) via `extra`.
171
227
  */
172
228
  createSmart(name: string, rules: SmartCollectionRules, extra?: Partial<PlatformCollectionCreate>): Promise<PlatformCollection>;
229
+ /**
230
+ * Preview unsaved smart-collection rules: how many items they match (`total`) and the first
231
+ * `limit` of them (default 10, at most 50), evaluated by the same code that materializes
232
+ * membership on save. Saves nothing. Needs EDITOR.
233
+ */
234
+ preview(request: SmartRulesPreviewRequest): Promise<SmartRulesPreview>;
235
+ /**
236
+ * A collection's members, whatever it groups — entries, assets or resources — as
237
+ * `{id, label, slug, type}`, ordered by label.
238
+ */
239
+ members(id: string): Promise<CollectionMember[]>;
173
240
  /**
174
241
  * Update a collection
175
242
  */
@@ -284,6 +351,14 @@ declare class ResourcesModule {
284
351
  * Get entries that reference this resource
285
352
  */
286
353
  getEntries(id: string): Promise<PlatformEntry[]>;
354
+ /**
355
+ * Apply the resource's staged AI suggestion (`suggestionJson`) and clear it. Needs EDITOR.
356
+ */
357
+ applySuggestion(id: string): Promise<PlatformResource>;
358
+ /**
359
+ * Discard the resource's staged AI suggestion without applying it. Needs EDITOR.
360
+ */
361
+ rejectSuggestion(id: string): Promise<PlatformResource>;
287
362
  }
288
363
 
289
364
  /**
@@ -343,7 +418,13 @@ declare class AssetsModule {
343
418
  */
344
419
  delete(id: string): Promise<void>;
345
420
  /**
346
- * Fetch the raw file for an asset
421
+ * Download an asset's file: its bytes and content type. A redirect to storage is followed.
422
+ */
423
+ download(id: string): Promise<BinaryResponse>;
424
+ /**
425
+ * Fetch the raw file for an asset.
426
+ * @deprecated Use {@link download}, which is typed. (Before 4.3 this resolved to `undefined` for
427
+ * any file that wasn't JSON; it now returns the same `BinaryResponse` as `download`.)
347
428
  */
348
429
  getFile(id: string): Promise<unknown>;
349
430
  /**
@@ -351,6 +432,14 @@ declare class AssetsModule {
351
432
  * Use this to create download links or fetch the file directly
352
433
  */
353
434
  getDownloadUrl(id: string, baseUrl?: string): string;
435
+ /**
436
+ * Apply the asset's staged AI suggestion (`suggestionJson`) and clear it. Needs EDITOR.
437
+ */
438
+ applySuggestion(id: string): Promise<PlatformAsset>;
439
+ /**
440
+ * Discard the asset's staged AI suggestion without applying it. Needs EDITOR.
441
+ */
442
+ rejectSuggestion(id: string): Promise<PlatformAsset>;
354
443
  }
355
444
 
356
445
  /**
@@ -542,6 +631,11 @@ declare class WorkspacesModule {
542
631
  * Get platform-level stats for the current workspace
543
632
  */
544
633
  getStats(): Promise<unknown>;
634
+ /**
635
+ * The current workspace's dashboard: recent activity and the "needs attention" counts (inbox,
636
+ * drafts, entries needing review, pending AI suggestions, failures in the last 7 days).
637
+ */
638
+ getDashboard(): Promise<PlatformDashboard>;
545
639
  /**
546
640
  * List available workspace backups
547
641
  */
@@ -1254,9 +1348,22 @@ declare class UserModule {
1254
1348
  /**
1255
1349
  * Events Module - Platform API
1256
1350
  *
1257
- * Event type information for webhooks and automations
1258
- */
1259
-
1351
+ * Event type information for webhooks and automations, and the Events hub: what sends each event type and
1352
+ * what reacts to it in the current workspace (workspace OWNER/ADMIN; platform event types are not listed).
1353
+ *
1354
+ * Routes: /api/event/types, /api/platform/event-types/connections, /api/platform/event-types/{type}/connections.
1355
+ */
1356
+
1357
+ /** One event type's whole story: senders, reactions (switched-off ones too), recent events, the chain. */
1358
+ type EventConnections = components['schemas']['EventConnections'];
1359
+ /** One row of `getConnectionsSummary`: how many senders and reactions a type has, and when it last happened. */
1360
+ type EventConnectionCounts = components['schemas']['EventConnectionCounts'];
1361
+ /** Something that runs when the event happens: a workflow, integration action, email, webhook or built-in reaction. */
1362
+ type EventReaction = components['schemas']['EventReaction'];
1363
+ /** Something that sends the event: Marvin itself, a workflow, an incoming webhook or a scheduled task. */
1364
+ type EventSender = components['schemas']['EventSender'];
1365
+ /** The integration whose blueprint created a workflow, task, incoming webhook or integration action. */
1366
+ type EventInstalledBy = components['schemas']['InstalledBy'];
1260
1367
  interface EventVariable {
1261
1368
  slug: string;
1262
1369
  description: string;
@@ -1279,6 +1386,17 @@ declare class EventsModule {
1279
1386
  * Get available event types for webhooks and automations
1280
1387
  */
1281
1388
  getOptions(): Promise<EventOption[]>;
1389
+ /**
1390
+ * Every workspace event type, in catalog order, with how many things send it and react to it.
1391
+ */
1392
+ getConnectionsSummary(): Promise<EventConnectionCounts[]>;
1393
+ /**
1394
+ * What sends an event type and what reacts to it, with its newest `limit` events (default 10, max 50).
1395
+ * Rejects with 404 for an unknown or platform-scope type.
1396
+ */
1397
+ getConnections(eventType: string, options?: {
1398
+ limit?: number;
1399
+ }): Promise<EventConnections>;
1282
1400
  }
1283
1401
 
1284
1402
  /**
@@ -2912,7 +3030,32 @@ declare class AutomationsModule {
2912
3030
  * Routes: /api/incoming-webhooks (CRUD) + /api/incoming-webhooks/{id}/token (mint/revoke).
2913
3031
  */
2914
3032
 
2915
- interface IncomingWebhook {
3033
+ /**
3034
+ * How a webhook verifies its sender. Unset = no verification, or the default HMAC check
3035
+ * (`sha256=<hex>` in `X-Signature-256`) once `signingSecretRef` names the workspace secret
3036
+ * holding the sender's key. `signatureScheme` picks a preset (see
3037
+ * {@link IncomingWebhooksModule.signatureSchemes}) or `custom`, described by `signatureConfig`.
3038
+ */
3039
+ interface IncomingWebhookSignature {
3040
+ /** Slug of the workspace secret holding the sender's signing key. */
3041
+ signingSecretRef?: string | null;
3042
+ /** The header carrying the signature (defaults to X-Signature-256). */
3043
+ signatureHeader?: string | null;
3044
+ /** A core preset, an integration's preset, or `custom`. */
3045
+ signatureScheme?: string | null;
3046
+ /** The URL the sender signs, for schemes that sign the URL (when it differs from the receiver's). */
3047
+ signatureUrl?: string | null;
3048
+ /** The construction for `custom`. */
3049
+ signatureConfig?: Record<string, unknown> | null;
3050
+ }
3051
+ /** A scheme a webhook can verify with: core presets, then integration presets, then `custom`. */
3052
+ interface IncomingWebhookSignatureScheme {
3053
+ name: string;
3054
+ notes: string;
3055
+ /** `core`, or the slug of the integration that contributes it. */
3056
+ source: string;
3057
+ }
3058
+ interface IncomingWebhook extends IncomingWebhookSignature {
2916
3059
  id: string;
2917
3060
  groupId: string;
2918
3061
  name: string;
@@ -2924,13 +3067,13 @@ interface IncomingWebhook {
2924
3067
  receivedCount: number;
2925
3068
  lastReceivedAt: string | null;
2926
3069
  }
2927
- interface IncomingWebhookCreate {
3070
+ interface IncomingWebhookCreate extends IncomingWebhookSignature {
2928
3071
  name: string;
2929
3072
  slug?: string;
2930
3073
  description?: string;
2931
3074
  enabled?: boolean;
2932
3075
  }
2933
- interface IncomingWebhookUpdate {
3076
+ interface IncomingWebhookUpdate extends IncomingWebhookSignature {
2934
3077
  name?: string;
2935
3078
  description?: string;
2936
3079
  enabled?: boolean;
@@ -2940,6 +3083,8 @@ declare class IncomingWebhooksModule {
2940
3083
  constructor(http: HttpClient);
2941
3084
  /** List the workspace's incoming webhooks. */
2942
3085
  list(): Promise<IncomingWebhook[]>;
3086
+ /** The signature schemes a webhook can pick (`signatureScheme`). */
3087
+ signatureSchemes(): Promise<IncomingWebhookSignatureScheme[]>;
2943
3088
  get(id: string): Promise<IncomingWebhook>;
2944
3089
  /** Create an incoming webhook (no token yet — mint one with {@link mintToken}). */
2945
3090
  create(body: IncomingWebhookCreate): Promise<IncomingWebhook>;
@@ -2951,6 +3096,66 @@ declare class IncomingWebhooksModule {
2951
3096
  revokeToken(id: string): Promise<IncomingWebhook>;
2952
3097
  }
2953
3098
 
3099
+ /**
3100
+ * Blueprints Module — Platform API
3101
+ *
3102
+ * The catalog of structure a workspace could have — collections, entry types, scheduled tasks and
3103
+ * workflows that core ships and installed integrations contribute — and applying them to the active
3104
+ * workspace. Each catalog entry says whether this workspace can use it (`available`,
3105
+ * `missingRequirements`), already has it (`applied`), or has an older version of it (`outdated`).
3106
+ *
3107
+ * Applying creates what is missing and never overwrites what exists, so a repeat call is a no-op;
3108
+ * the result says what happened. Reads: any member. Apply and update: workspace ADMIN.
3109
+ *
3110
+ * Routes: /api/groups/blueprints (+ /categories, /{slug}, /{slug}/apply, /{slug}/update, /apply).
3111
+ */
3112
+
3113
+ type Blueprint = components['schemas']['BlueprintRead'];
3114
+ type BlueprintApplyResult = components['schemas']['BlueprintApplyResult'];
3115
+ type BlueprintParameter = components['schemas']['BlueprintParameter'];
3116
+ interface BlueprintListOptions {
3117
+ /** `collection`, `entry_type`, `scheduled_task`, … */
3118
+ kind?: string;
3119
+ category?: string;
3120
+ /** `core`, or a provider slug. */
3121
+ source?: string;
3122
+ /** The connection to check per-integration blueprints against (`applied`). */
3123
+ integrationId?: string;
3124
+ }
3125
+ interface BlueprintApplyOptions {
3126
+ /** Pick the blueprint from this source when several share a slug. */
3127
+ source?: string;
3128
+ /** The connection a per-integration blueprint is applied for. */
3129
+ integrationId?: string;
3130
+ }
3131
+ declare class BlueprintsModule {
3132
+ private http;
3133
+ constructor(http: HttpClient);
3134
+ private query;
3135
+ /** The catalog, annotated with what this workspace can do about each blueprint. */
3136
+ list(options?: BlueprintListOptions): Promise<Blueprint[]>;
3137
+ /** Category names in catalog order: core's first, then each provider's. */
3138
+ categories(): Promise<string[]>;
3139
+ /** One blueprint, including its payload. */
3140
+ get(slug: string, options?: {
3141
+ source?: string;
3142
+ }): Promise<Blueprint>;
3143
+ /**
3144
+ * Create this blueprint's object in the workspace if it isn't there yet. `params` fills the
3145
+ * parameters the blueprint declares, e.g. `{ entry_type: 'post' }`. Needs ADMIN.
3146
+ */
3147
+ apply(slug: string, params?: Record<string, unknown>, options?: BlueprintApplyOptions): Promise<BlueprintApplyResult>;
3148
+ /**
3149
+ * Apply several blueprints at once; entry types are created before the collections and tasks that
3150
+ * use them, whatever the order here. `params` is keyed by blueprint slug. Needs ADMIN.
3151
+ */
3152
+ applyMany(slugs: string[], params?: Record<string, Record<string, unknown>>, options?: BlueprintApplyOptions): Promise<BlueprintApplyResult[]>;
3153
+ /** Replace an applied workflow's steps with what its integration declares now. Needs ADMIN. */
3154
+ update(slug: string, params?: Record<string, unknown>, options?: {
3155
+ source?: string;
3156
+ }): Promise<BlueprintApplyResult>;
3157
+ }
3158
+
2954
3159
  /**
2955
3160
  * Site Module - Platform API
2956
3161
  *
@@ -3024,6 +3229,8 @@ declare class PlatformClient extends HttpClient {
3024
3229
  ai: AIModule;
3025
3230
  automations: AutomationsModule;
3026
3231
  incomingWebhooks: IncomingWebhooksModule;
3232
+ /** Blueprint catalog: browse and apply collections, entry types, tasks and workflows */
3233
+ blueprints: BlueprintsModule;
3027
3234
  site: SiteModule;
3028
3235
  adminUsers: AdminUsersModule;
3029
3236
  adminSystem: AdminSystemModule;
@@ -3055,4 +3262,4 @@ declare class PlatformClient extends HttpClient {
3055
3262
  */
3056
3263
  declare function createPlatformClient(config?: Partial<PlatformClientConfig>): PlatformClient;
3057
3264
 
3058
- export { type AIApprovalMode, type AIChatRequest, type AIChatResult, type AICredentialMode, type AIExecution, type AIExecutionListParams, type AIExecutionStatus, AIExecutionsModule, AIMcpServersModule, type AIModel, type AIModelCreate, type AIModelUpdate, AIModelsModule, AIModule, type AIOperationExecuteRequest, type AIOperationInfo, AIOperationsModule, type AIProvider, type AIProviderCreate, type AIProviderTestResult, type AIProviderType, type AIProviderUpdate, AIProvidersModule, type AIReindexRequest, type AISettings, AISettingsModule, type AISettingsUpdate, type AIToolInfo, type AIToolInvokeRequest, AIToolsModule, APIClientsModule, type AdminAboutInfo, AdminBackupsModule, AdminMaintenanceModule, type AdminPlugin, type AdminPluginProvider, AdminScheduledTasksModule, AdminSystemModule, AdminUsersModule, type AdminWorkspaceMemberCreate, type AdminWorkspaceMemberUpdate, type AdminWorkspaceMembership, AdminWorkspacesModule, type AgentToolInfo, type AlertRouting, type AlertRoutingTarget, type AlertRoutingUpdate, type ApiToken, type ApiTokenCreate, type ApiTokenUpdate, type ApiTokenWithToken, type AppAboutInfo, AppModule, type AppTheme, AssetsModule, AuthModule, type Automation, type AutomationAction, type AutomationActionExecution, type AutomationActionOption, type AutomationCondition, type AutomationConditionField, type AutomationCreate, type AutomationDefinition, type AutomationDryRunOptions, type AutomationDryRunResult, type AutomationDryRunSample, type AutomationExecution, type AutomationExecutionDetail, type AutomationIncomingWebhookOption, type AutomationOptions, type AutomationPlanStep, type AutomationPreviewMatch, type AutomationPreviewResult, type AutomationRunResult, type AutomationSamples, type AutomationTarget, type AutomationTargetOption, type AutomationTrigger, type AutomationUpdate, type AutomationValidateResult, type AutomationValidationIssue, type AutomationWebhookOption, AutomationsModule, CollectionsModule, type EmailEventSubscription, type EmailEventSubscriptionCreate, EmailEventSubscriptionsModule, type EmailInvitationRequest, type EmailSettings, type EmailSettingsUpdate, type EmailSuccess, type EmailTemplateCreate$1 as EmailTemplateCreate, type EmailTemplateRead, type EmailTemplateSummary, type EmailTemplateUpdate, EmailTemplatesClient, type EmailTest, EntriesModule, EntryTypesModule, type EventLogEntry, EventLogModule, type EventLogQueryParams, type EventLogSummary, type EventOption, type EventVariable, EventsModule, FormsModule, type IncomingWebhook, type IncomingWebhookCreate, type IncomingWebhookUpdate, IncomingWebhooksModule, type Integration, type IntegrationActionResult, type IntegrationAttention, type IntegrationCheckResult, type IntegrationCreate, type IntegrationErrorOverrides, type IntegrationEventSubscription, type IntegrationEventSubscriptionCreate, type IntegrationEventSubscriptionUpdate, type IntegrationOption, type IntegrationPluginInfo, type IntegrationProviderAction, type IntegrationProviderCredential, type IntegrationProviderEvent, type IntegrationProviderInfo, type IntegrationResolveResult, type IntegrationUpdate, IntegrationsModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type LoginInfo, type MaintenanceStorageDetails, type MaintenanceSummary, type McpServer, type McpServerCreate, type McpServerTestResult, type McpServerToolInfo, type McpServerUpdate, type McpTransport, type PasswordChange, type PasswordResetTokenRequest, type PasswordResetTokenResponse, type PlatformAPIClient, type PlatformAPIClientCreate, type PlatformAPIClientUpdate, type PlatformAPIClientWithToken, type PlatformAsset, type PlatformAssetUpdate, PlatformClient, type PlatformClientConfig, type PlatformCollection, type PlatformCollectionCreate, type PlatformCollectionUpdate, type PlatformEntry, type PlatformEntryCreate, type PlatformEntryType, type PlatformEntryUpdate, type PlatformForm, type PlatformFormCreate, type PlatformFormSubmission, type PlatformFormUpdate, type PlatformResource, type PlatformResourceCreate, type PlatformResourceUpdate, type PlatformTag, type PlatformTagCreate, type PlatformTagUpdate, type PlatformWorkspaceMember, type PlatformWorkspaceMemberCreate, type PlatformWorkspaceMemberUpdate, type RecipientType, ResourcesModule, type ScheduledTask, type ScheduledTaskCreate, type ScheduledTaskExecutionLog, type ScheduledTaskUpdate, ScheduledTasksModule, type SiteBuildStatus, SiteModule, type SiteRebuildPending, type SiteRebuildRequested, type SiteRebuildSent, type SiteRebuildStatus, type SiteRebuildTarget, type SmartCollectionRules, type StartupInfo, type SystemStatistics, TagsModule, type TaskTypeInfo, type TestEmailRequest, ThemeModule, type UnlockUserRequest, type User, type UserCreate, UserModule, type UserPagination, type UserProfile, type UserProfileUpdate, type UserSummary, type UserUpdate, type Webhook, type WebhookCreate, type WebhookMethod, type WebhookPagination, type WebhookUpdate, WebhooksModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspacePagination, type WorkspacePreferences, type WorkspacePreferencesUpdate, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient, createPlatformConfigFromEnv };
3265
+ export { type AIApprovalMode, type AIChatRequest, type AIChatResult, type AICredentialMode, type AIExecution, type AIExecutionListParams, type AIExecutionStatus, AIExecutionsModule, AIMcpServersModule, type AIModel, type AIModelCreate, type AIModelUpdate, AIModelsModule, AIModule, type AIOperationExecuteRequest, type AIOperationInfo, AIOperationsModule, type AIProvider, type AIProviderCreate, type AIProviderTestResult, type AIProviderType, type AIProviderUpdate, AIProvidersModule, type AIReindexRequest, type AISettings, AISettingsModule, type AISettingsUpdate, type AIToolInfo, type AIToolInvokeRequest, AIToolsModule, APIClientsModule, type AdminAboutInfo, AdminBackupsModule, AdminMaintenanceModule, type AdminPlugin, type AdminPluginProvider, AdminScheduledTasksModule, AdminSystemModule, AdminUsersModule, type AdminWorkspaceMemberCreate, type AdminWorkspaceMemberUpdate, type AdminWorkspaceMembership, AdminWorkspacesModule, type AgentToolInfo, type AlertRouting, type AlertRoutingTarget, type AlertRoutingUpdate, type ApiToken, type ApiTokenCreate, type ApiTokenUpdate, type ApiTokenWithToken, type AppAboutInfo, AppModule, type AppTheme, AssetsModule, AuthModule, type Automation, type AutomationAction, type AutomationActionExecution, type AutomationActionOption, type AutomationCondition, type AutomationConditionField, type AutomationCreate, type AutomationDefinition, type AutomationDryRunOptions, type AutomationDryRunResult, type AutomationDryRunSample, type AutomationExecution, type AutomationExecutionDetail, type AutomationIncomingWebhookOption, type AutomationOptions, type AutomationPlanStep, type AutomationPreviewMatch, type AutomationPreviewResult, type AutomationRunResult, type AutomationSamples, type AutomationTarget, type AutomationTargetOption, type AutomationTrigger, type AutomationUpdate, type AutomationValidateResult, type AutomationValidationIssue, type AutomationWebhookOption, AutomationsModule, type Blueprint, type BlueprintApplyOptions, type BlueprintApplyResult, type BlueprintListOptions, type BlueprintParameter, BlueprintsModule, type CollectionMember, CollectionsModule, type EmailEventSubscription, type EmailEventSubscriptionCreate, EmailEventSubscriptionsModule, type EmailInvitationRequest, type EmailSettings, type EmailSettingsUpdate, type EmailSuccess, type EmailTemplateCreate$1 as EmailTemplateCreate, type EmailTemplateRead, type EmailTemplateSummary, type EmailTemplateUpdate, EmailTemplatesClient, type EmailTest, EntriesModule, EntryTypesModule, type EventConnectionCounts, type EventConnections, type EventInstalledBy, type EventLogEntry, EventLogModule, type EventLogQueryParams, type EventLogSummary, type EventOption, type EventReaction, type EventSender, type EventVariable, EventsModule, FormsModule, type IncomingWebhook, type IncomingWebhookCreate, type IncomingWebhookSignature, type IncomingWebhookSignatureScheme, type IncomingWebhookUpdate, IncomingWebhooksModule, type Integration, type IntegrationActionResult, type IntegrationAttention, type IntegrationCheckResult, type IntegrationCreate, type IntegrationErrorOverrides, type IntegrationEventSubscription, type IntegrationEventSubscriptionCreate, type IntegrationEventSubscriptionUpdate, type IntegrationOption, type IntegrationPluginInfo, type IntegrationProviderAction, type IntegrationProviderCredential, type IntegrationProviderEvent, type IntegrationProviderInfo, type IntegrationResolveResult, type IntegrationUpdate, IntegrationsModule, type InviteTokenCreate, type InviteTokenPagination, type InviteTokenSummary, InvitesModule, type LoginInfo, type MaintenanceStorageDetails, type MaintenanceSummary, type McpServer, type McpServerCreate, type McpServerTestResult, type McpServerToolInfo, type McpServerUpdate, type McpTransport, type PasswordChange, type PasswordResetTokenRequest, type PasswordResetTokenResponse, type PlatformAPIClient, type PlatformAPIClientCreate, type PlatformAPIClientUpdate, type PlatformAPIClientWithToken, type PlatformAsset, type PlatformAssetUpdate, type PlatformAttentionCounts, PlatformClient, type PlatformClientConfig, type PlatformCollection, type PlatformCollectionCreate, type PlatformCollectionUpdate, type PlatformDashboard, type PlatformEntry, type PlatformEntryCounts, type PlatformEntryCreate, type PlatformEntryType, type PlatformEntryUpdate, type PlatformForm, type PlatformFormCreate, type PlatformFormSubmission, type PlatformFormUpdate, type PlatformRecentEvent, type PlatformResource, type PlatformResourceCreate, type PlatformResourceUpdate, type PlatformTag, type PlatformTagCreate, type PlatformTagUpdate, type PlatformWorkspaceMember, type PlatformWorkspaceMemberCreate, type PlatformWorkspaceMemberUpdate, type RecipientType, ResourcesModule, type ScheduledTask, type ScheduledTaskCreate, type ScheduledTaskExecutionLog, type ScheduledTaskUpdate, ScheduledTasksModule, type SiteBuildStatus, SiteModule, type SiteRebuildPending, type SiteRebuildRequested, type SiteRebuildSent, type SiteRebuildStatus, type SiteRebuildTarget, type SmartCollectionRules, type SmartRulesPreview, type SmartRulesPreviewRequest, type StartupInfo, type SystemStatistics, TagsModule, type TaskTypeInfo, type TestEmailRequest, ThemeModule, type UnlockUserRequest, type User, type UserCreate, UserModule, type UserPagination, type UserProfile, type UserProfileUpdate, type UserSummary, type UserUpdate, type Webhook, type WebhookCreate, type WebhookMethod, type WebhookPagination, type WebhookUpdate, WebhooksModule, type Workspace, type WorkspaceActivationRequest, type WorkspaceCreate, WorkspaceMembersModule, type WorkspacePagination, type WorkspacePreferences, type WorkspacePreferencesUpdate, type WorkspaceUpdate, type WorkspaceWithMembership, WorkspacesModule, createPlatformClient, createPlatformConfigFromEnv };
package/dist/platform.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  MarvinValidationError,
4
4
  SessionAuth,
5
5
  init_core
6
- } from "./chunk-DSVYCVQD.js";
6
+ } from "./chunk-LTX3MAUE.js";
7
7
 
8
8
  // src/platform/client.ts
9
9
  init_core();
@@ -20,6 +20,12 @@ var EntriesModule = class {
20
20
  async list() {
21
21
  return this.http.get("/api/platform/entries");
22
22
  }
23
+ /**
24
+ * Entry counts by status, zero-filled, plus `total` (what the sidebar's inbox badge reads).
25
+ */
26
+ async counts() {
27
+ return this.http.get("/api/platform/entries/counts");
28
+ }
23
29
  /**
24
30
  * Get a single entry by ID
25
31
  */
@@ -73,6 +79,38 @@ var EntriesModule = class {
73
79
  const validCollectionId = this.http.validatePathParam(collectionId, "collection ID");
74
80
  return this.http.delete(`/api/platform/entries/${validEntryId}/collections/${validCollectionId}`);
75
81
  }
82
+ /**
83
+ * Apply the entry's staged AI suggestion (`suggestionJson`) and clear it — the approval half of
84
+ * AI write-back. Returns the updated entry.
85
+ */
86
+ async applySuggestion(id) {
87
+ const validId = this.http.validatePathParam(id, "entry ID");
88
+ return this.http.post(`/api/platform/entries/${validId}/apply-suggestion`, {});
89
+ }
90
+ /**
91
+ * Discard the entry's staged AI suggestion without applying it.
92
+ */
93
+ async rejectSuggestion(id) {
94
+ const validId = this.http.validatePathParam(id, "entry ID");
95
+ return this.http.post(`/api/platform/entries/${validId}/reject-suggestion`, {});
96
+ }
97
+ /**
98
+ * Approve an AI-suggested asset on an entry: it becomes a normal attached asset (and reaches
99
+ * published output).
100
+ */
101
+ async approveSuggestedAsset(entryId, assetId) {
102
+ const e = this.http.validatePathParam(entryId, "entry ID");
103
+ const a = this.http.validatePathParam(assetId, "asset ID");
104
+ return this.http.post(`/api/platform/entries/${e}/suggested-assets/${a}/approve`, {});
105
+ }
106
+ /**
107
+ * Reject an AI-suggested asset: unlink it, and delete the asset if nothing else uses it.
108
+ */
109
+ async rejectSuggestedAsset(entryId, assetId) {
110
+ const e = this.http.validatePathParam(entryId, "entry ID");
111
+ const a = this.http.validatePathParam(assetId, "asset ID");
112
+ return this.http.post(`/api/platform/entries/${e}/suggested-assets/${a}/reject`, {});
113
+ }
76
114
  };
77
115
 
78
116
  // src/platform/collections.ts
@@ -113,6 +151,22 @@ var CollectionsModule = class {
113
151
  smartRules: rules
114
152
  });
115
153
  }
154
+ /**
155
+ * Preview unsaved smart-collection rules: how many items they match (`total`) and the first
156
+ * `limit` of them (default 10, at most 50), evaluated by the same code that materializes
157
+ * membership on save. Saves nothing. Needs EDITOR.
158
+ */
159
+ async preview(request) {
160
+ return this.http.post("/api/platform/collections/preview", request);
161
+ }
162
+ /**
163
+ * A collection's members, whatever it groups — entries, assets or resources — as
164
+ * `{id, label, slug, type}`, ordered by label.
165
+ */
166
+ async members(id) {
167
+ const validId = this.http.validatePathParam(id, "collection ID");
168
+ return this.http.get(`/api/platform/collections/${validId}/members`);
169
+ }
116
170
  /**
117
171
  * Update a collection
118
172
  */
@@ -286,6 +340,20 @@ var ResourcesModule = class {
286
340
  async getEntries(id) {
287
341
  return this.http.get(`/api/platform/resources/${id}/entries`);
288
342
  }
343
+ /**
344
+ * Apply the resource's staged AI suggestion (`suggestionJson`) and clear it. Needs EDITOR.
345
+ */
346
+ async applySuggestion(id) {
347
+ const validId = this.http.validatePathParam(id, "resource ID");
348
+ return this.http.post(`/api/platform/resources/${validId}/apply-suggestion`, {});
349
+ }
350
+ /**
351
+ * Discard the resource's staged AI suggestion without applying it. Needs EDITOR.
352
+ */
353
+ async rejectSuggestion(id) {
354
+ const validId = this.http.validatePathParam(id, "resource ID");
355
+ return this.http.post(`/api/platform/resources/${validId}/reject-suggestion`, {});
356
+ }
289
357
  };
290
358
 
291
359
  // src/platform/assets.ts
@@ -401,11 +469,19 @@ var AssetsModule = class {
401
469
  return this.http.delete(`/api/platform/assets/${validId}`);
402
470
  }
403
471
  /**
404
- * Fetch the raw file for an asset
472
+ * Download an asset's file: its bytes and content type. A redirect to storage is followed.
405
473
  */
406
- async getFile(id) {
474
+ async download(id) {
407
475
  const validId = this.http.validatePathParam(id, "asset ID");
408
- return this.http.get(`/api/platform/assets/${validId}/file`);
476
+ return this.http.getBinary(`/api/platform/assets/${validId}/file`);
477
+ }
478
+ /**
479
+ * Fetch the raw file for an asset.
480
+ * @deprecated Use {@link download}, which is typed. (Before 4.3 this resolved to `undefined` for
481
+ * any file that wasn't JSON; it now returns the same `BinaryResponse` as `download`.)
482
+ */
483
+ async getFile(id) {
484
+ return this.download(id);
409
485
  }
410
486
  /**
411
487
  * Get download URL for an asset file
@@ -416,6 +492,20 @@ var AssetsModule = class {
416
492
  const base = baseUrl || (typeof window !== "undefined" && window.location ? window.location.origin : "");
417
493
  return `${base}/api/platform/assets/${validId}/file`;
418
494
  }
495
+ /**
496
+ * Apply the asset's staged AI suggestion (`suggestionJson`) and clear it. Needs EDITOR.
497
+ */
498
+ async applySuggestion(id) {
499
+ const validId = this.http.validatePathParam(id, "asset ID");
500
+ return this.http.post(`/api/platform/assets/${validId}/apply-suggestion`, {});
501
+ }
502
+ /**
503
+ * Discard the asset's staged AI suggestion without applying it. Needs EDITOR.
504
+ */
505
+ async rejectSuggestion(id) {
506
+ const validId = this.http.validatePathParam(id, "asset ID");
507
+ return this.http.post(`/api/platform/assets/${validId}/reject-suggestion`, {});
508
+ }
419
509
  };
420
510
 
421
511
  // src/platform/apiClients.ts
@@ -666,6 +756,13 @@ var WorkspacesModule = class {
666
756
  async getStats() {
667
757
  return this.http.get("/api/platform/stats");
668
758
  }
759
+ /**
760
+ * The current workspace's dashboard: recent activity and the "needs attention" counts (inbox,
761
+ * drafts, entries needing review, pending AI suggestions, failures in the last 7 days).
762
+ */
763
+ async getDashboard() {
764
+ return this.http.get("/api/platform/stats/dashboard");
765
+ }
669
766
  /**
670
767
  * List available workspace backups
671
768
  */
@@ -1328,6 +1425,20 @@ var EventsModule = class {
1328
1425
  async getOptions() {
1329
1426
  return this.http.get("/api/event/types");
1330
1427
  }
1428
+ /**
1429
+ * Every workspace event type, in catalog order, with how many things send it and react to it.
1430
+ */
1431
+ async getConnectionsSummary() {
1432
+ return this.http.get("/api/platform/event-types/connections");
1433
+ }
1434
+ /**
1435
+ * What sends an event type and what reacts to it, with its newest `limit` events (default 10, max 50).
1436
+ * Rejects with 404 for an unknown or platform-scope type.
1437
+ */
1438
+ async getConnections(eventType, options = {}) {
1439
+ const path = `/api/platform/event-types/${encodeURIComponent(eventType)}/connections`;
1440
+ return options.limit === void 0 ? this.http.get(path) : this.http.get(path, { limit: options.limit });
1441
+ }
1331
1442
  };
1332
1443
 
1333
1444
  // src/platform/eventLog.ts
@@ -2364,6 +2475,10 @@ var IncomingWebhooksModule = class {
2364
2475
  async list() {
2365
2476
  return this.http.get("/api/incoming-webhooks");
2366
2477
  }
2478
+ /** The signature schemes a webhook can pick (`signatureScheme`). */
2479
+ async signatureSchemes() {
2480
+ return this.http.get("/api/incoming-webhooks/signature-schemes");
2481
+ }
2367
2482
  async get(id) {
2368
2483
  const validId = this.http.validatePathParam(id, "incoming webhook id");
2369
2484
  return this.http.get(`/api/incoming-webhooks/${validId}`);
@@ -2392,6 +2507,59 @@ var IncomingWebhooksModule = class {
2392
2507
  }
2393
2508
  };
2394
2509
 
2510
+ // src/platform/blueprints.ts
2511
+ var BASE2 = "/api/groups/blueprints";
2512
+ var BlueprintsModule = class {
2513
+ constructor(http) {
2514
+ this.http = http;
2515
+ }
2516
+ http;
2517
+ query(options = {}) {
2518
+ return this.http.buildQueryString({ source: options.source, integration_id: options.integrationId });
2519
+ }
2520
+ /** The catalog, annotated with what this workspace can do about each blueprint. */
2521
+ async list(options = {}) {
2522
+ return this.http.get(BASE2, {
2523
+ kind: options.kind,
2524
+ category: options.category,
2525
+ source: options.source,
2526
+ integration_id: options.integrationId
2527
+ });
2528
+ }
2529
+ /** Category names in catalog order: core's first, then each provider's. */
2530
+ async categories() {
2531
+ return this.http.get(`${BASE2}/categories`);
2532
+ }
2533
+ /** One blueprint, including its payload. */
2534
+ async get(slug, options = {}) {
2535
+ const validSlug = this.http.validatePathParam(slug, "blueprint slug");
2536
+ return this.http.get(`${BASE2}/${validSlug}`, { source: options.source });
2537
+ }
2538
+ /**
2539
+ * Create this blueprint's object in the workspace if it isn't there yet. `params` fills the
2540
+ * parameters the blueprint declares, e.g. `{ entry_type: 'post' }`. Needs ADMIN.
2541
+ */
2542
+ async apply(slug, params, options = {}) {
2543
+ const validSlug = this.http.validatePathParam(slug, "blueprint slug");
2544
+ return this.http.post(`${BASE2}/${validSlug}/apply${this.query(options)}`, params);
2545
+ }
2546
+ /**
2547
+ * Apply several blueprints at once; entry types are created before the collections and tasks that
2548
+ * use them, whatever the order here. `params` is keyed by blueprint slug. Needs ADMIN.
2549
+ */
2550
+ async applyMany(slugs, params, options = {}) {
2551
+ return this.http.post(`${BASE2}/apply${this.query(options)}`, {
2552
+ slugs,
2553
+ ...params ? { params } : {}
2554
+ });
2555
+ }
2556
+ /** Replace an applied workflow's steps with what its integration declares now. Needs ADMIN. */
2557
+ async update(slug, params, options = {}) {
2558
+ const validSlug = this.http.validatePathParam(slug, "blueprint slug");
2559
+ return this.http.post(`${BASE2}/${validSlug}/update${this.query(options)}`, params);
2560
+ }
2561
+ };
2562
+
2395
2563
  // src/platform/site.ts
2396
2564
  var REBUILD = "/api/platform/site/rebuild";
2397
2565
  var SiteModule = class {
@@ -2458,6 +2626,8 @@ var PlatformClient = class extends HttpClient {
2458
2626
  automations;
2459
2627
  // Incoming (ingress) webhooks — tokened endpoints that drop events on the bus.
2460
2628
  incomingWebhooks;
2629
+ /** Blueprint catalog: browse and apply collections, entry types, tasks and workflows */
2630
+ blueprints;
2461
2631
  // Site — request a rebuild of the workspace's static site and read its status.
2462
2632
  site;
2463
2633
  // Admin modules
@@ -2502,6 +2672,7 @@ var PlatformClient = class extends HttpClient {
2502
2672
  this.ai = new AIModule(this);
2503
2673
  this.automations = new AutomationsModule(this);
2504
2674
  this.incomingWebhooks = new IncomingWebhooksModule(this);
2675
+ this.blueprints = new BlueprintsModule(this);
2505
2676
  this.site = new SiteModule(this);
2506
2677
  this.adminUsers = new AdminUsersModule(this);
2507
2678
  this.adminSystem = new AdminSystemModule(this);
@@ -2536,6 +2707,7 @@ export {
2536
2707
  AssetsModule,
2537
2708
  AuthModule,
2538
2709
  AutomationsModule,
2710
+ BlueprintsModule,
2539
2711
  CollectionsModule,
2540
2712
  EmailEventSubscriptionsModule,
2541
2713
  EmailTemplatesClient,