@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.
@@ -79,6 +79,11 @@ interface RetryConfig {
79
79
  */
80
80
  retryableStatuses: number[];
81
81
  }
82
+ /** A successful binary read: the body's bytes and the server's content type. */
83
+ interface BinaryResponse {
84
+ data: Uint8Array;
85
+ contentType: string | null;
86
+ }
82
87
  interface HttpClientConfig {
83
88
  baseUrl: string;
84
89
  auth: AuthStrategy;
@@ -158,6 +163,11 @@ declare class HttpClient {
158
163
  * Still clamped to MAX_TIMEOUT.
159
164
  */
160
165
  timeout?: number;
166
+ /**
167
+ * `'binary'` hands back a {@link BinaryResponse} (the raw bytes) instead of parsing JSON. Retries,
168
+ * redirects and errors behave exactly as for a JSON read.
169
+ */
170
+ responseType?: 'json' | 'binary';
161
171
  }, retryAttempt?: number): Promise<T>;
162
172
  /**
163
173
  * A successful response's JSON body, or `undefined` when there is none: 204/205, `content-length: 0`,
@@ -165,10 +175,16 @@ declare class HttpClient {
165
175
  * JSON is a `MarvinApiError` naming the request — never a network error, and never retried.
166
176
  */
167
177
  private readBody;
178
+ /** A successful response's bytes; a 204/205 is an empty array. A failed read is a network error. */
179
+ private readBinary;
168
180
  /**
169
181
  * GET request
170
182
  */
171
183
  get<T>(endpoint: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
184
+ /**
185
+ * GET a binary body (a file download). Follows redirects; retried like any GET.
186
+ */
187
+ getBinary(endpoint: string, params?: Record<string, string | number | boolean | undefined>): Promise<BinaryResponse>;
172
188
  /**
173
189
  * POST request
174
190
  */
@@ -189,4 +205,4 @@ declare class HttpClient {
189
205
  delete<T>(endpoint: string): Promise<T>;
190
206
  }
191
207
 
192
- export { type AuthStrategy as A, BearerTokenAuth as B, HttpClient as H, NoAuth as N, SessionAuth as S, type HttpClientConfig as a };
208
+ export { type AuthStrategy as A, BearerTokenAuth as B, HttpClient as H, NoAuth as N, SessionAuth as S, type BinaryResponse as a, type HttpClientConfig as b };
@@ -79,6 +79,11 @@ interface RetryConfig {
79
79
  */
80
80
  retryableStatuses: number[];
81
81
  }
82
+ /** A successful binary read: the body's bytes and the server's content type. */
83
+ interface BinaryResponse {
84
+ data: Uint8Array;
85
+ contentType: string | null;
86
+ }
82
87
  interface HttpClientConfig {
83
88
  baseUrl: string;
84
89
  auth: AuthStrategy;
@@ -158,6 +163,11 @@ declare class HttpClient {
158
163
  * Still clamped to MAX_TIMEOUT.
159
164
  */
160
165
  timeout?: number;
166
+ /**
167
+ * `'binary'` hands back a {@link BinaryResponse} (the raw bytes) instead of parsing JSON. Retries,
168
+ * redirects and errors behave exactly as for a JSON read.
169
+ */
170
+ responseType?: 'json' | 'binary';
161
171
  }, retryAttempt?: number): Promise<T>;
162
172
  /**
163
173
  * A successful response's JSON body, or `undefined` when there is none: 204/205, `content-length: 0`,
@@ -165,10 +175,16 @@ declare class HttpClient {
165
175
  * JSON is a `MarvinApiError` naming the request — never a network error, and never retried.
166
176
  */
167
177
  private readBody;
178
+ /** A successful response's bytes; a 204/205 is an empty array. A failed read is a network error. */
179
+ private readBinary;
168
180
  /**
169
181
  * GET request
170
182
  */
171
183
  get<T>(endpoint: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
184
+ /**
185
+ * GET a binary body (a file download). Follows redirects; retried like any GET.
186
+ */
187
+ getBinary(endpoint: string, params?: Record<string, string | number | boolean | undefined>): Promise<BinaryResponse>;
172
188
  /**
173
189
  * POST request
174
190
  */
@@ -189,4 +205,4 @@ declare class HttpClient {
189
205
  delete<T>(endpoint: string): Promise<T>;
190
206
  }
191
207
 
192
- export { type AuthStrategy as A, BearerTokenAuth as B, HttpClient as H, NoAuth as N, SessionAuth as S, type HttpClientConfig as a };
208
+ export { type AuthStrategy as A, BearerTokenAuth as B, HttpClient as H, NoAuth as N, SessionAuth as S, type BinaryResponse as a, type HttpClientConfig as b };
@@ -6,7 +6,7 @@ import {
6
6
  __export,
7
7
  init_core,
8
8
  init_errors
9
- } from "./chunk-DSVYCVQD.js";
9
+ } from "./chunk-LTX3MAUE.js";
10
10
 
11
11
  // src/client/config.ts
12
12
  var config_exports = {};
@@ -320,6 +320,11 @@ var init_resource = __esm({
320
320
  });
321
321
 
322
322
  // src/entries/entries.ts
323
+ function csv(value) {
324
+ if (value === void 0) return void 0;
325
+ const joined = (Array.isArray(value) ? value : [value]).map((v) => v.trim()).filter(Boolean).join(",");
326
+ return joined || void 0;
327
+ }
323
328
  function toListEntry(raw) {
324
329
  const { collections, ...rest } = raw;
325
330
  return {
@@ -347,6 +352,9 @@ var init_entries = __esm({
347
352
  const queryString = this.http.buildQueryString({
348
353
  entry_type: options.entryType,
349
354
  collection: options.collection,
355
+ tag: csv(options.tag),
356
+ slug: csv(options.slug),
357
+ updated_since: options.updatedSince instanceof Date ? options.updatedSince.toISOString() : options.updatedSince,
350
358
  limit: options.limit,
351
359
  offset: options.offset,
352
360
  expand: options.expand
@@ -514,6 +522,14 @@ var init_assets = __esm({
514
522
  const endpoint = `/api/publish/${this.workspaceSlug}/assets/${slugOrId}`;
515
523
  return this.http.fetch(endpoint);
516
524
  }
525
+ /**
526
+ * Download a published asset's file by slug: its bytes and content type. The file route
527
+ * redirects to storage; the redirect is followed. Needs the `read:assets` permission.
528
+ */
529
+ async download(slug) {
530
+ const validSlug = this.http.validatePathParam(slug, "asset slug");
531
+ return this.http.getBinary(`/api/publish/${this.workspaceSlug}/assets/${validSlug}/file`);
532
+ }
517
533
  /**
518
534
  * Convenience: Get all images
519
535
  */
@@ -383,6 +383,9 @@ var init_HttpClient = __esm({
383
383
  errorText
384
384
  );
385
385
  }
386
+ if (options?.responseType === "binary") {
387
+ return await this.readBinary(response, method, endpoint);
388
+ }
386
389
  const data = await this.readBody(response, method, endpoint);
387
390
  if (this.debug && data !== void 0) {
388
391
  const sanitized = this.sanitizeForLogging(data);
@@ -428,12 +431,34 @@ var init_HttpClient = __esm({
428
431
  );
429
432
  }
430
433
  }
434
+ /** A successful response's bytes; a 204/205 is an empty array. A failed read is a network error. */
435
+ async readBinary(response, method, endpoint) {
436
+ const contentType = response.headers.get("content-type");
437
+ if (response.status === 204 || response.status === 205) {
438
+ return { data: new Uint8Array(0), contentType };
439
+ }
440
+ try {
441
+ return { data: new Uint8Array(await response.arrayBuffer()), contentType };
442
+ } catch (error) {
443
+ const cause = error instanceof Error ? error : void 0;
444
+ throw new MarvinNetworkError(
445
+ `Reading the ${response.status} response to ${method} ${endpoint} failed: ${cause?.message ?? String(error)}`,
446
+ cause
447
+ );
448
+ }
449
+ }
431
450
  /**
432
451
  * GET request
433
452
  */
434
453
  async get(endpoint, params) {
435
454
  return this.request("GET", endpoint, { params });
436
455
  }
456
+ /**
457
+ * GET a binary body (a file download). Follows redirects; retried like any GET.
458
+ */
459
+ async getBinary(endpoint, params) {
460
+ return this.request("GET", endpoint, { params, responseType: "binary" });
461
+ }
437
462
  /**
438
463
  * POST request
439
464
  */
@@ -700,6 +700,167 @@ interface components {
700
700
  /** Buildid */
701
701
  buildId: string;
702
702
  };
703
+ /**
704
+ * AdminEventConnections
705
+ * @description A platform event type's story across the platform: what sends it, what happens (built in, plus each
706
+ * workspace's own subscriptions, grouped by workspace), and its newest events in any workspace.
707
+ */
708
+ AdminEventConnections: {
709
+ /** Eventtype */
710
+ eventType: string;
711
+ /** Name */
712
+ name: string;
713
+ /** Description */
714
+ description: string;
715
+ /** Category */
716
+ category: string;
717
+ /** Senders */
718
+ senders: components["schemas"]["EventSender"][];
719
+ /** Reactions */
720
+ reactions: components["schemas"]["EventReaction"][];
721
+ /** Workspaces */
722
+ workspaces: components["schemas"]["WorkspaceEventReactions"][];
723
+ /** Recent */
724
+ recent: components["schemas"]["AdminEventSummary"][];
725
+ /** Leadsto */
726
+ leadsTo: components["schemas"]["EventTypeRef"][];
727
+ /** Causedby */
728
+ causedBy: components["schemas"]["EventTypeRef"][];
729
+ };
730
+ /**
731
+ * AdminEventPagination
732
+ * @description One page of platform events, newest first.
733
+ */
734
+ AdminEventPagination: {
735
+ /**
736
+ * Page
737
+ * @default 1
738
+ */
739
+ page: number;
740
+ /**
741
+ * Per Page
742
+ * @default 10
743
+ */
744
+ per_page: number;
745
+ /**
746
+ * Total
747
+ * @default 0
748
+ */
749
+ total: number;
750
+ /**
751
+ * Total Pages
752
+ * @default 0
753
+ */
754
+ total_pages: number;
755
+ /** Items */
756
+ items: components["schemas"]["AdminEventSummary"][];
757
+ /** Next */
758
+ next?: string | null;
759
+ /** Previous */
760
+ previous?: string | null;
761
+ };
762
+ /**
763
+ * AdminEventRead
764
+ * @description A platform event with its full payload.
765
+ */
766
+ AdminEventRead: {
767
+ /**
768
+ * Eventid
769
+ * Format: uuid4
770
+ */
771
+ eventId: string;
772
+ /** Eventtype */
773
+ eventType: string;
774
+ /** Eventname */
775
+ eventName: string;
776
+ /**
777
+ * Occurredat
778
+ * Format: date-time
779
+ */
780
+ occurredAt: string;
781
+ /** Messagetitle */
782
+ messageTitle: string;
783
+ /** Messagebody */
784
+ messageBody?: string | null;
785
+ /** Workspaceid */
786
+ workspaceId?: string | null;
787
+ /** Workspacename */
788
+ workspaceName?: string | null;
789
+ /** Workspaceslug */
790
+ workspaceSlug?: string | null;
791
+ /** Userid */
792
+ userId?: string | null;
793
+ /** Username */
794
+ userName?: string | null;
795
+ /** Useremail */
796
+ userEmail?: string | null;
797
+ /** Entityid */
798
+ entityId?: string | null;
799
+ /** Entitytype */
800
+ entityType?: string | null;
801
+ /** Integrationid */
802
+ integrationId: string;
803
+ /** Correlationid */
804
+ correlationId?: string | null;
805
+ /** Eventdata */
806
+ eventData: {
807
+ [key: string]: unknown;
808
+ };
809
+ };
810
+ /**
811
+ * AdminEventSummary
812
+ * @description A platform event as the admin Events page lists it, with the names a super admin needs to read it.
813
+ */
814
+ AdminEventSummary: {
815
+ /**
816
+ * Eventid
817
+ * Format: uuid4
818
+ */
819
+ eventId: string;
820
+ /** Eventtype */
821
+ eventType: string;
822
+ /** Eventname */
823
+ eventName: string;
824
+ /**
825
+ * Occurredat
826
+ * Format: date-time
827
+ */
828
+ occurredAt: string;
829
+ /** Messagetitle */
830
+ messageTitle: string;
831
+ /** Messagebody */
832
+ messageBody?: string | null;
833
+ /** Workspaceid */
834
+ workspaceId?: string | null;
835
+ /** Workspacename */
836
+ workspaceName?: string | null;
837
+ /** Workspaceslug */
838
+ workspaceSlug?: string | null;
839
+ /** Userid */
840
+ userId?: string | null;
841
+ /** Username */
842
+ userName?: string | null;
843
+ /** Useremail */
844
+ userEmail?: string | null;
845
+ /** Entityid */
846
+ entityId?: string | null;
847
+ /** Entitytype */
848
+ entityType?: string | null;
849
+ };
850
+ /**
851
+ * AdminEventType
852
+ * @description A platform-scope event type, for the Events page's filter.
853
+ */
854
+ AdminEventType: {
855
+ /** Eventtype */
856
+ eventType: string;
857
+ /** Name */
858
+ name: string;
859
+ /** Description */
860
+ description: string;
861
+ /** Category */
862
+ category: string;
863
+ };
703
864
  /** AgentCreate */
704
865
  AgentCreate: {
705
866
  /** Name */
@@ -1389,6 +1550,47 @@ interface components {
1389
1550
  */
1390
1551
  failures: number;
1391
1552
  };
1553
+ /**
1554
+ * AuditEventSetting
1555
+ * @description One catalog event type and whether this workspace's Event Log records it.
1556
+ */
1557
+ AuditEventSetting: {
1558
+ /** Eventtype */
1559
+ eventType: string;
1560
+ /** Name */
1561
+ name: string;
1562
+ /** Category */
1563
+ category: string;
1564
+ /** Defaultaudited */
1565
+ defaultAudited: boolean;
1566
+ /** Audited */
1567
+ audited: boolean;
1568
+ /** Locked */
1569
+ locked: boolean;
1570
+ };
1571
+ /**
1572
+ * AuditExcludedEvent
1573
+ * @description An event type this workspace's Event Log does not record.
1574
+ */
1575
+ AuditExcludedEvent: {
1576
+ /** Eventtype */
1577
+ eventType: string;
1578
+ /** Name */
1579
+ name: string;
1580
+ /** Category */
1581
+ category: string;
1582
+ };
1583
+ /**
1584
+ * AuditSettingsUpdate
1585
+ * @description Overrides to merge: `{event_type: true | false}` to record or skip a type, `null` for its default.
1586
+ * Types left out keep their current setting.
1587
+ */
1588
+ AuditSettingsUpdate: {
1589
+ /** Overrides */
1590
+ overrides?: {
1591
+ [key: string]: boolean | null;
1592
+ };
1593
+ };
1392
1594
  /**
1393
1595
  * AuthMethod
1394
1596
  * @description Enumeration for the authentication methods a user can be associated with.
@@ -1696,6 +1898,11 @@ interface components {
1696
1898
  triggerGroups: {
1697
1899
  [key: string]: string[];
1698
1900
  };
1901
+ /**
1902
+ * Emittable
1903
+ * @default []
1904
+ */
1905
+ emittable: string[];
1699
1906
  /**
1700
1907
  * Conditionops
1701
1908
  * @default []
@@ -1834,6 +2041,10 @@ interface components {
1834
2041
  };
1835
2042
  /** Createdby */
1836
2043
  createdBy?: string | null;
2044
+ /** Sourceintegrationid */
2045
+ sourceIntegrationId?: string | null;
2046
+ /** Sourceblueprint */
2047
+ sourceBlueprint?: string | null;
1837
2048
  };
1838
2049
  /**
1839
2050
  * AutomationTargetOption
@@ -2498,6 +2709,10 @@ interface components {
2498
2709
  metadataJson?: {
2499
2710
  [key: string]: unknown;
2500
2711
  } | null;
2712
+ /** Sourceintegrationid */
2713
+ sourceIntegrationId?: string | null;
2714
+ /** Sourceblueprint */
2715
+ sourceBlueprint?: string | null;
2501
2716
  };
2502
2717
  /**
2503
2718
  * CollectionUpdate
@@ -3418,6 +3633,50 @@ interface components {
3418
3633
  /** Tag Ids */
3419
3634
  tag_ids?: string[] | null;
3420
3635
  };
3636
+ /**
3637
+ * EventConnectionCounts
3638
+ * @description One row of the Events catalog: how connected an event type is, in both directions.
3639
+ */
3640
+ EventConnectionCounts: {
3641
+ /** Eventtype */
3642
+ eventType: string;
3643
+ /** Senders */
3644
+ senders: number;
3645
+ /** Reactions */
3646
+ reactions: number;
3647
+ /** Activereactions */
3648
+ activeReactions: number;
3649
+ /** Builtinreactions */
3650
+ builtinReactions: number;
3651
+ /** Lastoccurredat */
3652
+ lastOccurredAt?: string | null;
3653
+ };
3654
+ /**
3655
+ * EventConnections
3656
+ * @description An event type's whole story in one workspace: what sends it, what happens, and when it last did.
3657
+ */
3658
+ EventConnections: {
3659
+ /** Eventtype */
3660
+ eventType: string;
3661
+ /** Name */
3662
+ name: string;
3663
+ /** Description */
3664
+ description: string;
3665
+ /** Category */
3666
+ category: string;
3667
+ /** Senders */
3668
+ senders: components["schemas"]["EventSender"][];
3669
+ /** Reactions */
3670
+ reactions: components["schemas"]["EventReaction"][];
3671
+ /** Audited */
3672
+ audited: boolean;
3673
+ /** Recent */
3674
+ recent: components["schemas"]["EventLogSummary"][];
3675
+ /** Leadsto */
3676
+ leadsTo: components["schemas"]["EventTypeRef"][];
3677
+ /** Causedby */
3678
+ causedBy: components["schemas"]["EventTypeRef"][];
3679
+ };
3421
3680
  /**
3422
3681
  * EventFeed
3423
3682
  * @description Events since a cursor, oldest first, plus the server's clock to poll from next.
@@ -3596,6 +3855,63 @@ interface components {
3596
3855
  /** Relatedentitylabel */
3597
3856
  relatedEntityLabel?: string | null;
3598
3857
  };
3858
+ /**
3859
+ * EventReaction
3860
+ * @description One thing that runs when the event happens.
3861
+ */
3862
+ EventReaction: {
3863
+ /**
3864
+ * Kind
3865
+ * @enum {string}
3866
+ */
3867
+ kind: "workflow" | "integration_action" | "email" | "webhook" | "builtin";
3868
+ /** Id */
3869
+ id?: string | null;
3870
+ /** Name */
3871
+ name: string;
3872
+ /** Enabled */
3873
+ enabled: boolean;
3874
+ /** Detail */
3875
+ detail?: string | null;
3876
+ /** Triggertype */
3877
+ triggerType?: string | null;
3878
+ /** Managedat */
3879
+ managedAt?: string | null;
3880
+ installedBy?: components["schemas"]["InstalledBy"] | null;
3881
+ };
3882
+ /**
3883
+ * EventSender
3884
+ * @description One thing that sends the event: Marvin itself (a line from the catalog) or a row in this workspace.
3885
+ */
3886
+ EventSender: {
3887
+ /**
3888
+ * Kind
3889
+ * @enum {string}
3890
+ */
3891
+ kind: "marvin" | "workflow" | "incoming_webhook" | "scheduled_task";
3892
+ /** Id */
3893
+ id?: string | null;
3894
+ /** Name */
3895
+ name: string;
3896
+ /** Enabled */
3897
+ enabled: boolean;
3898
+ /** Detail */
3899
+ detail?: string | null;
3900
+ /** Viaworkflowid */
3901
+ viaWorkflowId?: string | null;
3902
+ /** Viaworkflowname */
3903
+ viaWorkflowName?: string | null;
3904
+ /** Managedat */
3905
+ managedAt?: string | null;
3906
+ installedBy?: components["schemas"]["InstalledBy"] | null;
3907
+ };
3908
+ /** EventTypeRef */
3909
+ EventTypeRef: {
3910
+ /** Eventtype */
3911
+ eventType: string;
3912
+ /** Name */
3913
+ name: string;
3914
+ };
3599
3915
  /**
3600
3916
  * ForgotPassword
3601
3917
  * @description Schema for the "forgot password" request.
@@ -4127,6 +4443,10 @@ interface components {
4127
4443
  receivedCount: number;
4128
4444
  /** Lastreceivedat */
4129
4445
  lastReceivedAt?: string | null;
4446
+ /** Sourceintegrationid */
4447
+ sourceIntegrationId?: string | null;
4448
+ /** Sourceblueprint */
4449
+ sourceBlueprint?: string | null;
4130
4450
  };
4131
4451
  /** IncomingWebhookUpdate */
4132
4452
  IncomingWebhookUpdate: {
@@ -4149,6 +4469,23 @@ interface components {
4149
4469
  [key: string]: unknown;
4150
4470
  } | null;
4151
4471
  };
4472
+ /**
4473
+ * InstalledBy
4474
+ * @description The integration whose blueprint created a workflow, task, incoming webhook or integration action.
4475
+ */
4476
+ InstalledBy: {
4477
+ /**
4478
+ * Integrationid
4479
+ * Format: uuid4
4480
+ */
4481
+ integrationId: string;
4482
+ /** Name */
4483
+ name: string;
4484
+ /** Provider */
4485
+ provider: string;
4486
+ /** Blueprint */
4487
+ blueprint?: string | null;
4488
+ };
4152
4489
  /**
4153
4490
  * InstalledModels
4154
4491
  * @description The models actually present in the workspace's active provider (e.g. Ollama's /api/tags).
@@ -4359,6 +4696,10 @@ interface components {
4359
4696
  } | null;
4360
4697
  /** Enabled */
4361
4698
  enabled: boolean;
4699
+ /** Sourceintegrationid */
4700
+ sourceIntegrationId?: string | null;
4701
+ /** Sourceblueprint */
4702
+ sourceBlueprint?: string | null;
4362
4703
  };
4363
4704
  /** IntegrationEventSubscriptionUpdate */
4364
4705
  IntegrationEventSubscriptionUpdate: {
@@ -6070,6 +6411,10 @@ interface components {
6070
6411
  } | null;
6071
6412
  /** Lastdurationms */
6072
6413
  lastDurationMs?: number | null;
6414
+ /** Sourceintegrationid */
6415
+ sourceIntegrationId?: string | null;
6416
+ /** Sourceblueprint */
6417
+ sourceBlueprint?: string | null;
6073
6418
  };
6074
6419
  /**
6075
6420
  * ScheduledTaskUpdate
@@ -7490,6 +7835,20 @@ interface components {
7490
7835
  /** Workspace */
7491
7836
  workspace: string;
7492
7837
  };
7838
+ /** WorkspaceEventReactions */
7839
+ WorkspaceEventReactions: {
7840
+ /**
7841
+ * Workspaceid
7842
+ * Format: uuid4
7843
+ */
7844
+ workspaceId: string;
7845
+ /** Workspacename */
7846
+ workspaceName?: string | null;
7847
+ /** Workspaceslug */
7848
+ workspaceSlug?: string | null;
7849
+ /** Reactions */
7850
+ reactions: components["schemas"]["EventReaction"][];
7851
+ };
7493
7852
  /**
7494
7853
  * WorkspaceInfo
7495
7854
  * @description Public workspace information for publishing API.