@uniformdev/automations-sdk 20.72.3-alpha.25 → 20.72.3-alpha.40

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.
@@ -393,6 +393,8 @@ interface paths {
393
393
  query: {
394
394
  /** @description The project ID. */
395
395
  projectId: string;
396
+ /** @description Comma-separated list of automation public IDs to return. Omit to return all. */
397
+ automationIDs?: string;
396
398
  };
397
399
  header?: never;
398
400
  path?: never;
@@ -764,6 +766,13 @@ type AutomationsClientOptions = Omit<ClientOptions, 'projectId'> & {
764
766
  */
765
767
  declare class AutomationsClient extends ApiClient<AutomationsClientOptions> {
766
768
  #private;
769
+ /**
770
+ * Fetches a single automation by public ID.
771
+ *
772
+ * @param publicId - The automation public ID.
773
+ * @throws ApiClientError with status 404 when no such automation exists.
774
+ */
775
+ get(publicId: string): Promise<AutomationSummary>;
767
776
  /**
768
777
  * Lists the automations configured for a project.
769
778
  */
@@ -7,9 +7,28 @@ import {
7
7
  } from "../chunk-I6KKUHEY.mjs";
8
8
 
9
9
  // src/api/AutomationsClient.ts
10
- import { ApiClient } from "@uniformdev/context/api";
10
+ import { ApiClient, ApiClientError } from "@uniformdev/context/api";
11
11
  var _automationsUrl, _runsUrl, _logsUrl;
12
12
  var _AutomationsClient = class _AutomationsClient extends ApiClient {
13
+ /**
14
+ * Fetches a single automation by public ID.
15
+ *
16
+ * @param publicId - The automation public ID.
17
+ * @throws ApiClientError with status 404 when no such automation exists.
18
+ */
19
+ async get(publicId) {
20
+ const { projectId } = this.options;
21
+ const url = this.createUrl(__privateGet(_AutomationsClient, _automationsUrl), {
22
+ projectId,
23
+ automationIDs: [publicId]
24
+ });
25
+ const { automations } = await this.apiClient(url);
26
+ const automation = automations[0];
27
+ if (!automation) {
28
+ throw new ApiClientError("Automation not found", "GET", url.toString(), 404, "Not Found");
29
+ }
30
+ return automation;
31
+ }
13
32
  /**
14
33
  * Lists the automations configured for a project.
15
34
  */
package/dist/index.d.mts CHANGED
@@ -2,6 +2,7 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import { WebhookEventName, WebhookPayloadFor } from '@uniformdev/webhooks';
3
3
  import { AutomationResult, AutomationLogEntry } from './schemas/index.mjs';
4
4
  export { f as formatAutomationWebhookUrl } from './formatAutomationWebhookUrl-CD1HQmu6.mjs';
5
+ import { ApiClient, ClientOptions } from '@uniformdev/context/api';
5
6
  import 'zod';
6
7
 
7
8
  /**
@@ -370,4 +371,388 @@ declare function defineAutomation<const M extends AutomationMetadata>(config: {
370
371
  handler: HandlerFromAutomationMetadata<M>;
371
372
  }): AutomationDefinition<M>;
372
373
 
373
- export { type AiToolAutomationMetadata, type AiToolInputSchema, type AiToolTriggerConfig, type AutomationContext, type AutomationDefinition, type AutomationHandler, type AutomationInvokePayload, type AutomationInvoker, AutomationLogEntry, type AutomationLogLevel, type AutomationLogger, type AutomationMetadata, type AutomationPermissions, AutomationResult, type ComposableTriggerConfig, type ComposedAutomationMetadata, type CredentialsFromAutomationMetadata, type EventTriggerConfig, type HandlerFromAutomationMetadata, type IncomingWebhookInput, type IncomingWebhookTriggerConfig, type InputFromAutomationMetadata, type JsonSchemaObject, type ScheduleRunInput, type ScheduleTriggerConfig, type TriggerConfig, type TriggerFromAutomationMetadata, type UniformConnectionParams, defineAutomation };
374
+ interface paths {
375
+ "/api/v1/notifications": {
376
+ parameters: {
377
+ query?: never;
378
+ header?: never;
379
+ path?: never;
380
+ cookie?: never;
381
+ };
382
+ /**
383
+ * @deprecated
384
+ * @description Lists the current user's notifications. Results are cursor-paginated newest-first and may be scoped to the current team. Omit teamId to list every notification for the caller.
385
+ */
386
+ get: {
387
+ parameters: {
388
+ query?: {
389
+ /** @description Opaque cursor returned by the previous response. Omit to read the newest page of notifications. */
390
+ cursor?: string;
391
+ /** @description When true, only unread notifications are returned. */
392
+ unreadOnly?: boolean | null;
393
+ /** @description Optional team scope. Use teamId to limit results to one team. */
394
+ teamId?: string;
395
+ /** @description Maximum number of notifications to return. Defaults to 50. */
396
+ limit?: number;
397
+ };
398
+ header?: never;
399
+ path?: never;
400
+ cookie?: never;
401
+ };
402
+ requestBody?: never;
403
+ responses: {
404
+ /** @description OK */
405
+ 200: {
406
+ headers: {
407
+ [name: string]: unknown;
408
+ };
409
+ content: {
410
+ "application/json": {
411
+ notifications: {
412
+ id: string;
413
+ /**
414
+ * @description The notification content type. Currently, only text notifications are supported.
415
+ * @enum {string}
416
+ */
417
+ type: "text";
418
+ teamId: string;
419
+ project: {
420
+ id: string;
421
+ name: string;
422
+ } | null;
423
+ author: {
424
+ subject: string;
425
+ name: string;
426
+ } | null;
427
+ summary: {
428
+ /** @enum {string} */
429
+ format: "markdown";
430
+ value: string;
431
+ };
432
+ entity?: {
433
+ entityId: string;
434
+ /** @enum {string} */
435
+ type: "entry" | "composition";
436
+ releaseId?: string;
437
+ editionId?: string;
438
+ } | {
439
+ entityId: string;
440
+ /** @enum {string} */
441
+ type: "entryPattern" | "componentPattern" | "compositionPattern";
442
+ releaseId?: string;
443
+ } | {
444
+ entityId: string;
445
+ /** @enum {string} */
446
+ type: "component" | "contentType" | "blockType" | "asset" | "audience" | "intent" | "enrichment" | "signal" | "quirk" | "test" | "projectMapNode";
447
+ } | {
448
+ /** @enum {string} */
449
+ type: "external";
450
+ /** Format: uri */
451
+ url: string;
452
+ };
453
+ /** Format: date-time */
454
+ createdAt: string;
455
+ /** Format: date-time */
456
+ readAt?: string | null;
457
+ }[];
458
+ cursor?: string;
459
+ unreadCount: number;
460
+ };
461
+ };
462
+ };
463
+ 400: components["responses"]["BadRequestError"];
464
+ 401: components["responses"]["UnauthorizedError"];
465
+ 403: components["responses"]["ForbiddenError"];
466
+ 429: components["responses"]["RateLimitError"];
467
+ 500: components["responses"]["InternalServerError"];
468
+ };
469
+ };
470
+ put?: never;
471
+ /**
472
+ * @deprecated
473
+ * @description Creates a project-scoped notification for recipients who belong to the project's team. The caller must have access to the project. A missing or inaccessible project returns 404.
474
+ */
475
+ post: {
476
+ parameters: {
477
+ query?: never;
478
+ header?: never;
479
+ path?: never;
480
+ cookie?: never;
481
+ };
482
+ requestBody: {
483
+ content: {
484
+ "application/json": {
485
+ recipients: string[];
486
+ /**
487
+ * @description The notification content type. Currently, only text notifications are supported.
488
+ * @default text
489
+ * @enum {string}
490
+ */
491
+ type?: "text";
492
+ summary: {
493
+ /** @enum {string} */
494
+ format: "markdown";
495
+ value: string;
496
+ };
497
+ entity?: {
498
+ entityId: string;
499
+ /** @enum {string} */
500
+ type: "entry" | "composition";
501
+ releaseId?: string;
502
+ editionId?: string;
503
+ } | {
504
+ entityId: string;
505
+ /** @enum {string} */
506
+ type: "entryPattern" | "componentPattern" | "compositionPattern";
507
+ releaseId?: string;
508
+ } | {
509
+ entityId: string;
510
+ /** @enum {string} */
511
+ type: "component" | "contentType" | "blockType" | "asset" | "audience" | "intent" | "enrichment" | "signal" | "quirk" | "test" | "projectMapNode";
512
+ } | {
513
+ /** @enum {string} */
514
+ type: "external";
515
+ /** Format: uri */
516
+ url: string;
517
+ };
518
+ projectId: string;
519
+ };
520
+ };
521
+ };
522
+ responses: {
523
+ /** @description Created */
524
+ 201: {
525
+ headers: {
526
+ [name: string]: unknown;
527
+ };
528
+ content: {
529
+ "application/json": {
530
+ id: string;
531
+ /**
532
+ * @description The notification content type. Currently, only text notifications are supported.
533
+ * @enum {string}
534
+ */
535
+ type: "text";
536
+ teamId: string;
537
+ project: {
538
+ id: string;
539
+ name: string;
540
+ } | null;
541
+ author: {
542
+ subject: string;
543
+ name: string;
544
+ } | null;
545
+ summary: {
546
+ /** @enum {string} */
547
+ format: "markdown";
548
+ value: string;
549
+ };
550
+ entity?: {
551
+ entityId: string;
552
+ /** @enum {string} */
553
+ type: "entry" | "composition";
554
+ releaseId?: string;
555
+ editionId?: string;
556
+ } | {
557
+ entityId: string;
558
+ /** @enum {string} */
559
+ type: "entryPattern" | "componentPattern" | "compositionPattern";
560
+ releaseId?: string;
561
+ } | {
562
+ entityId: string;
563
+ /** @enum {string} */
564
+ type: "component" | "contentType" | "blockType" | "asset" | "audience" | "intent" | "enrichment" | "signal" | "quirk" | "test" | "projectMapNode";
565
+ } | {
566
+ /** @enum {string} */
567
+ type: "external";
568
+ /** Format: uri */
569
+ url: string;
570
+ };
571
+ /** Format: date-time */
572
+ createdAt: string;
573
+ /** Format: date-time */
574
+ readAt?: string | null;
575
+ };
576
+ };
577
+ };
578
+ 400: components["responses"]["BadRequestError"];
579
+ 401: components["responses"]["UnauthorizedError"];
580
+ 403: components["responses"]["ForbiddenError"];
581
+ /** @description Project not found or inaccessible to the caller */
582
+ 404: {
583
+ headers: {
584
+ [name: string]: unknown;
585
+ };
586
+ content?: never;
587
+ };
588
+ 429: components["responses"]["RateLimitError"];
589
+ 500: components["responses"]["InternalServerError"];
590
+ };
591
+ };
592
+ delete?: never;
593
+ /** @description Handles preflight requests. This endpoint allows CORS. */
594
+ options: {
595
+ parameters: {
596
+ query?: never;
597
+ header?: never;
598
+ path?: never;
599
+ cookie?: never;
600
+ };
601
+ requestBody?: never;
602
+ responses: {
603
+ /** @description ok */
604
+ 204: {
605
+ headers: {
606
+ [name: string]: unknown;
607
+ };
608
+ content?: never;
609
+ };
610
+ };
611
+ };
612
+ head?: never;
613
+ /**
614
+ * @deprecated
615
+ * @description Updates read state for the current user's notifications. Use target: ids to update specific notifications, or target: all to mark all notifications as read. Read-all may be scoped to a team.
616
+ */
617
+ patch: {
618
+ parameters: {
619
+ query?: never;
620
+ header?: never;
621
+ path?: never;
622
+ cookie?: never;
623
+ };
624
+ requestBody: {
625
+ content: {
626
+ "application/json": {
627
+ /** @enum {string} */
628
+ target: "ids";
629
+ ids: string[];
630
+ read: boolean;
631
+ } | {
632
+ /** @enum {string} */
633
+ target: "all";
634
+ teamId?: string;
635
+ };
636
+ };
637
+ };
638
+ responses: {
639
+ /** @description No Content */
640
+ 204: {
641
+ headers: {
642
+ [name: string]: unknown;
643
+ };
644
+ content: {
645
+ "application/json": unknown;
646
+ };
647
+ };
648
+ 400: components["responses"]["BadRequestError"];
649
+ 401: components["responses"]["UnauthorizedError"];
650
+ 403: components["responses"]["ForbiddenError"];
651
+ 429: components["responses"]["RateLimitError"];
652
+ 500: components["responses"]["InternalServerError"];
653
+ };
654
+ };
655
+ trace?: never;
656
+ };
657
+ }
658
+ interface components {
659
+ schemas: {
660
+ Error: {
661
+ /** @description Error message(s) that occurred while processing the request */
662
+ errorMessage?: string[] | string;
663
+ };
664
+ };
665
+ responses: {
666
+ /** @description Request input validation failed */
667
+ BadRequestError: {
668
+ headers: {
669
+ [name: string]: unknown;
670
+ };
671
+ content: {
672
+ "application/json": components["schemas"]["Error"];
673
+ };
674
+ };
675
+ /** @description API key or token was not valid */
676
+ UnauthorizedError: {
677
+ headers: {
678
+ [name: string]: unknown;
679
+ };
680
+ content: {
681
+ "application/json": components["schemas"]["Error"];
682
+ };
683
+ };
684
+ /** @description Permission was denied */
685
+ ForbiddenError: {
686
+ headers: {
687
+ [name: string]: unknown;
688
+ };
689
+ content: {
690
+ "application/json": components["schemas"]["Error"];
691
+ };
692
+ };
693
+ /** @description Too many requests in allowed time period */
694
+ RateLimitError: {
695
+ headers: {
696
+ [name: string]: unknown;
697
+ };
698
+ content?: never;
699
+ };
700
+ /** @description Execution error occurred */
701
+ InternalServerError: {
702
+ headers: {
703
+ [name: string]: unknown;
704
+ };
705
+ content?: never;
706
+ };
707
+ };
708
+ parameters: never;
709
+ requestBodies: never;
710
+ headers: never;
711
+ pathItems: never;
712
+ }
713
+
714
+ type NotificationsApi = paths['/api/v1/notifications'];
715
+ /** Query parameters for listing the current user's notifications. */
716
+ type NotificationsGetParameters = NonNullable<NotificationsApi['get']['parameters']['query']>;
717
+ /** A page of notifications for the current user. */
718
+ type NotificationsGetResponse = NotificationsApi['get']['responses']['200']['content']['application/json'];
719
+ /** A notification returned by the Notifications API. */
720
+ type Notification = NotificationsGetResponse['notifications'][number];
721
+ /** An entity referenced by a notification. */
722
+ type NotificationEntity = NonNullable<Notification['entity']>;
723
+ /** Parameters for creating a notification. */
724
+ type NotificationPostParameters = NotificationsApi['post']['requestBody']['content']['application/json'];
725
+ /** The notification created by the Notifications API. */
726
+ type NotificationPostResponse = NotificationsApi['post']['responses']['201']['content']['application/json'];
727
+ /** Parameters for updating notification read state. */
728
+ type NotificationPatchParameters = NotificationsApi['patch']['requestBody']['content']['application/json'];
729
+
730
+ /**
731
+ * API client for listing, creating, and updating notifications.
732
+ *
733
+ * @deprecated This API is experimental and may change without notice.
734
+ */
735
+ declare class NotificationsClient extends ApiClient {
736
+ #private;
737
+ constructor(options: ClientOptions);
738
+ /**
739
+ * Lists notifications for the current user.
740
+ *
741
+ * @deprecated This API is experimental and may change without notice.
742
+ */
743
+ list(options?: NotificationsGetParameters): Promise<NotificationsGetResponse>;
744
+ /**
745
+ * Creates a notification for one or more recipients.
746
+ *
747
+ * @deprecated This API is experimental and may change without notice.
748
+ */
749
+ create(body: NotificationPostParameters): Promise<NotificationPostResponse>;
750
+ /**
751
+ * Updates the read state of the current user's notifications.
752
+ *
753
+ * @deprecated This API is experimental and may change without notice.
754
+ */
755
+ setReadState(body: NotificationPatchParameters): Promise<void>;
756
+ }
757
+
758
+ export { type AiToolAutomationMetadata, type AiToolInputSchema, type AiToolTriggerConfig, type AutomationContext, type AutomationDefinition, type AutomationHandler, type AutomationInvokePayload, type AutomationInvoker, AutomationLogEntry, type AutomationLogLevel, type AutomationLogger, type AutomationMetadata, type AutomationPermissions, AutomationResult, type ComposableTriggerConfig, type ComposedAutomationMetadata, type CredentialsFromAutomationMetadata, type EventTriggerConfig, type HandlerFromAutomationMetadata, type IncomingWebhookInput, type IncomingWebhookTriggerConfig, type InputFromAutomationMetadata, type JsonSchemaObject, type Notification, type NotificationEntity, type NotificationPatchParameters, type NotificationPostParameters, type NotificationPostResponse, NotificationsClient, type NotificationsGetParameters, type NotificationsGetResponse, type ScheduleRunInput, type ScheduleTriggerConfig, type TriggerConfig, type TriggerFromAutomationMetadata, type UniformConnectionParams, defineAutomation };
package/dist/index.mjs CHANGED
@@ -1,7 +1,10 @@
1
1
  import {
2
2
  formatAutomationWebhookUrl
3
3
  } from "./chunk-TWKWPWN3.mjs";
4
- import "./chunk-I6KKUHEY.mjs";
4
+ import {
5
+ __privateAdd,
6
+ __privateGet
7
+ } from "./chunk-I6KKUHEY.mjs";
5
8
 
6
9
  // src/runtime.ts
7
10
  function captureLog(logs, level, message) {
@@ -65,7 +68,54 @@ function defineAutomation(config) {
65
68
  const invoker = (payload) => runAutomationHandler(config.handler, payload, { requireUniformCredentials });
66
69
  return Object.assign(invoker, { metadata: config.metadata });
67
70
  }
71
+
72
+ // src/NotificationsClient.ts
73
+ import { ApiClient } from "@uniformdev/context/api";
74
+ var _url;
75
+ var _NotificationsClient = class _NotificationsClient extends ApiClient {
76
+ constructor(options) {
77
+ super(options);
78
+ }
79
+ /**
80
+ * Lists notifications for the current user.
81
+ *
82
+ * @deprecated This API is experimental and may change without notice.
83
+ */
84
+ async list(options) {
85
+ const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url), options);
86
+ return await this.apiClient(fetchUri);
87
+ }
88
+ /**
89
+ * Creates a notification for one or more recipients.
90
+ *
91
+ * @deprecated This API is experimental and may change without notice.
92
+ */
93
+ async create(body) {
94
+ const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url));
95
+ return await this.apiClient(fetchUri, {
96
+ method: "POST",
97
+ body: JSON.stringify(body)
98
+ });
99
+ }
100
+ /**
101
+ * Updates the read state of the current user's notifications.
102
+ *
103
+ * @deprecated This API is experimental and may change without notice.
104
+ */
105
+ async setReadState(body) {
106
+ const fetchUri = this.createUrl(__privateGet(_NotificationsClient, _url));
107
+ await this.apiClient(fetchUri, {
108
+ method: "PATCH",
109
+ body: JSON.stringify(body),
110
+ expectNoContent: true
111
+ });
112
+ }
113
+ };
114
+ _url = new WeakMap();
115
+ __privateAdd(_NotificationsClient, _url, "/api/v1/notifications");
116
+ var NotificationsClient = _NotificationsClient;
68
117
  export {
118
+ NotificationsClient,
69
119
  defineAutomation,
70
120
  formatAutomationWebhookUrl
71
121
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/automations-sdk",
3
- "version": "20.72.3-alpha.25+cd10fe6e1e",
3
+ "version": "20.72.3-alpha.40+ffbec41570",
4
4
  "description": "Uniform Automations SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "exports": {
@@ -40,8 +40,8 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@standard-schema/spec": "^1.1.0",
43
- "@uniformdev/context": "20.72.3-alpha.25+cd10fe6e1e",
44
- "@uniformdev/webhooks": "20.72.3-alpha.25+cd10fe6e1e"
43
+ "@uniformdev/context": "20.72.3-alpha.40+ffbec41570",
44
+ "@uniformdev/webhooks": "20.72.3-alpha.40+ffbec41570"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "ai": "^6.0.0",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "cd10fe6e1e8877ed1ec45290d74ac160d597e84e"
65
+ "gitHead": "ffbec41570c4266c69674871c97146bf7bf86383"
66
66
  }