@alva-ai/toolkit 0.9.4 → 0.11.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.
- package/README.md +2 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +139 -83
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +71 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -33
- package/dist/index.d.ts +65 -33
- package/dist/index.js +71 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -626,17 +626,27 @@ interface PushSubscriptionListResponse {
|
|
|
626
626
|
/** Empty when there is no next page. */
|
|
627
627
|
next_cursor?: string;
|
|
628
628
|
}
|
|
629
|
-
interface
|
|
630
|
-
|
|
629
|
+
interface PlaybookFollow {
|
|
630
|
+
id: string;
|
|
631
|
+
user_id: string;
|
|
632
|
+
playbook_id: string;
|
|
633
|
+
created_at_ms: number;
|
|
634
|
+
updated_at_ms: number;
|
|
635
|
+
}
|
|
636
|
+
interface SubscribePlaybookResponse {
|
|
637
|
+
/** The follow row created (or confirmed) by the cascade subscribe. */
|
|
638
|
+
follow: PlaybookFollow;
|
|
639
|
+
/** Feed ids whose alert this subscribe enabled (push-enabled automations). */
|
|
640
|
+
subscribed_feed_ids: string[];
|
|
631
641
|
/** Canonical alfs path: `/alva/home/<username>/playbooks/<name>`. */
|
|
632
642
|
playbook_path: string;
|
|
633
643
|
}
|
|
634
|
-
interface
|
|
644
|
+
interface SubscribeFeedResponse {
|
|
635
645
|
subscription: PushSubscription;
|
|
636
646
|
/** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
|
|
637
647
|
feed_path: string;
|
|
638
648
|
}
|
|
639
|
-
interface
|
|
649
|
+
interface UnsubscribeResponse {
|
|
640
650
|
ok: true;
|
|
641
651
|
}
|
|
642
652
|
type ChannelGroupSubscriptionTargetType = 'feed' | 'playbook';
|
|
@@ -785,6 +795,18 @@ declare class FeedResource {
|
|
|
785
795
|
delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
|
|
786
796
|
}
|
|
787
797
|
|
|
798
|
+
/** Playbook visibility states understood by the gateway. */
|
|
799
|
+
type PlaybookVisibility = 'public' | 'private' | 'paid';
|
|
800
|
+
interface SetVisibilityParams {
|
|
801
|
+
/** URL-safe playbook name. The owner is derived server-side from auth. */
|
|
802
|
+
name: string;
|
|
803
|
+
/** Target visibility: public, private, or paid. */
|
|
804
|
+
visibility: PlaybookVisibility;
|
|
805
|
+
}
|
|
806
|
+
interface SetVisibilityResponse {
|
|
807
|
+
/** ALFS-style "<owner>/<name>" path echoed back by the gateway. */
|
|
808
|
+
playbook_path: string;
|
|
809
|
+
}
|
|
788
810
|
type TrendingPlaybooksSort = 'FOLLOWS' | 'RECENT';
|
|
789
811
|
type TrendingPlaybooksDir = 'FORWARD' | 'BACKWARD';
|
|
790
812
|
interface TrendingPlaybooksParams {
|
|
@@ -842,6 +864,16 @@ declare class PlaybooksResource {
|
|
|
842
864
|
* it into a smaller, agent-friendly shape.
|
|
843
865
|
*/
|
|
844
866
|
trending(params?: TrendingPlaybooksParams): Promise<TrendingPlaybooksResponse>;
|
|
867
|
+
/**
|
|
868
|
+
* Set a playbook's visibility. Requires authentication; the owner is
|
|
869
|
+
* resolved server-side from the authenticated user, so only the playbook
|
|
870
|
+
* `name` is needed.
|
|
871
|
+
*
|
|
872
|
+
* Note: `private` and `paid` are paid-tier capabilities. A free-tier user
|
|
873
|
+
* receives a `PERMISSION_DENIED` error from the gateway, which is surfaced
|
|
874
|
+
* here unchanged.
|
|
875
|
+
*/
|
|
876
|
+
setVisibility(params: SetVisibilityParams): Promise<SetVisibilityResponse>;
|
|
845
877
|
}
|
|
846
878
|
|
|
847
879
|
declare class SecretsResource {
|
|
@@ -926,6 +958,7 @@ declare class DataSkillsResource {
|
|
|
926
958
|
interface PlaybookSkillSummary {
|
|
927
959
|
username: string;
|
|
928
960
|
name: string;
|
|
961
|
+
display_name: string;
|
|
929
962
|
description: string;
|
|
930
963
|
tags: string[];
|
|
931
964
|
creator_uid: number;
|
|
@@ -1088,46 +1121,45 @@ declare class NotificationPreferencesResource {
|
|
|
1088
1121
|
}
|
|
1089
1122
|
|
|
1090
1123
|
/**
|
|
1091
|
-
*
|
|
1092
|
-
* DM/web push for a target. Independent of social follow:
|
|
1124
|
+
* Subscriptions — subscribe the caller to playbooks and feeds.
|
|
1093
1125
|
*
|
|
1094
|
-
* - `subscribePlaybook`
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1126
|
+
* - `subscribePlaybook` is a CASCADE: it follows the playbook AND enables
|
|
1127
|
+
* personal push for every push-enabled automation of its latest release,
|
|
1128
|
+
* in one call. `unsubscribePlaybook` reverses both (unfollow + disable
|
|
1129
|
+
* all of the playbook's push alerts).
|
|
1130
|
+
* - `subscribeFeed` / `unsubscribeFeed` toggle personal push for ONE feed
|
|
1131
|
+
* (a single automation's alert) without touching the playbook follow.
|
|
1098
1132
|
*
|
|
1099
|
-
* Backed by alva-gateway REST
|
|
1100
|
-
* `pkg/schema/push_subscription.graphql`).
|
|
1133
|
+
* Backed by alva-gateway REST under `/api/v1/subscriptions/...`.
|
|
1101
1134
|
*/
|
|
1102
|
-
declare class
|
|
1135
|
+
declare class SubscriptionsResource {
|
|
1103
1136
|
private client;
|
|
1104
1137
|
constructor(client: AlvaClient);
|
|
1105
1138
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1139
|
+
* Subscribe to a playbook `(username, name)`: follow it and enable alerts
|
|
1140
|
+
* on all its push-enabled automations. Idempotent. Auth: the caller must be
|
|
1141
|
+
* able to read the playbook — public passes; paid requires an active unlock;
|
|
1142
|
+
* private requires owner/admin.
|
|
1110
1143
|
*/
|
|
1111
|
-
subscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<
|
|
1144
|
+
subscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<SubscribePlaybookResponse>;
|
|
1112
1145
|
/**
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1146
|
+
* Unsubscribe from a playbook `(username, name)`: unfollow it and disable
|
|
1147
|
+
* all of its push alerts for the caller. Idempotent.
|
|
1115
1148
|
*/
|
|
1116
|
-
unsubscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<
|
|
1149
|
+
unsubscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<UnsubscribeResponse>;
|
|
1117
1150
|
/**
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
* push per playbook context. Idempotent.
|
|
1151
|
+
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
1152
|
+
* single automation's alerts, regardless of which playbook(s) consume it.
|
|
1153
|
+
* Does NOT follow any playbook. Idempotent.
|
|
1122
1154
|
*/
|
|
1123
|
-
subscribeFeed(params: PushSubscriptionFeedParams): Promise<
|
|
1155
|
+
subscribeFeed(params: PushSubscriptionFeedParams): Promise<SubscribeFeedResponse>;
|
|
1124
1156
|
/**
|
|
1125
|
-
*
|
|
1126
|
-
* Idempotent.
|
|
1157
|
+
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
1158
|
+
* alerts for the caller. Idempotent.
|
|
1127
1159
|
*/
|
|
1128
|
-
unsubscribeFeed(params: PushSubscriptionFeedParams): Promise<
|
|
1160
|
+
unsubscribeFeed(params: PushSubscriptionFeedParams): Promise<UnsubscribeResponse>;
|
|
1129
1161
|
/**
|
|
1130
|
-
* List the caller's currently active
|
|
1162
|
+
* List the caller's currently active subscriptions.
|
|
1131
1163
|
* Results are cursor-paginated.
|
|
1132
1164
|
*/
|
|
1133
1165
|
list(params?: PushSubscriptionListParams): Promise<PushSubscriptionListResponse>;
|
|
@@ -1189,7 +1221,7 @@ declare class AlvaClient {
|
|
|
1189
1221
|
private _arraysJwt?;
|
|
1190
1222
|
private _notifications?;
|
|
1191
1223
|
private _notificationPreferences?;
|
|
1192
|
-
private
|
|
1224
|
+
private _subscriptions?;
|
|
1193
1225
|
private _channelGroupSubscriptions?;
|
|
1194
1226
|
constructor(config: AlvaClientConfig);
|
|
1195
1227
|
get fs(): FsResource;
|
|
@@ -1211,7 +1243,7 @@ declare class AlvaClient {
|
|
|
1211
1243
|
get arraysJwt(): ArraysJwtResource;
|
|
1212
1244
|
get notifications(): NotificationsResource;
|
|
1213
1245
|
get notificationPreferences(): NotificationPreferencesResource;
|
|
1214
|
-
get
|
|
1246
|
+
get subscriptions(): SubscriptionsResource;
|
|
1215
1247
|
get channelGroupSubscriptions(): ChannelGroupSubscriptionsResource;
|
|
1216
1248
|
_requireAuth(): void;
|
|
1217
1249
|
_request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
@@ -1338,4 +1370,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
|
|
|
1338
1370
|
/** SDK version, injected at build time from package.json. */
|
|
1339
1371
|
declare const VERSION: string;
|
|
1340
1372
|
|
|
1341
|
-
export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
|
|
1373
|
+
export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
|
package/dist/index.d.ts
CHANGED
|
@@ -626,17 +626,27 @@ interface PushSubscriptionListResponse {
|
|
|
626
626
|
/** Empty when there is no next page. */
|
|
627
627
|
next_cursor?: string;
|
|
628
628
|
}
|
|
629
|
-
interface
|
|
630
|
-
|
|
629
|
+
interface PlaybookFollow {
|
|
630
|
+
id: string;
|
|
631
|
+
user_id: string;
|
|
632
|
+
playbook_id: string;
|
|
633
|
+
created_at_ms: number;
|
|
634
|
+
updated_at_ms: number;
|
|
635
|
+
}
|
|
636
|
+
interface SubscribePlaybookResponse {
|
|
637
|
+
/** The follow row created (or confirmed) by the cascade subscribe. */
|
|
638
|
+
follow: PlaybookFollow;
|
|
639
|
+
/** Feed ids whose alert this subscribe enabled (push-enabled automations). */
|
|
640
|
+
subscribed_feed_ids: string[];
|
|
631
641
|
/** Canonical alfs path: `/alva/home/<username>/playbooks/<name>`. */
|
|
632
642
|
playbook_path: string;
|
|
633
643
|
}
|
|
634
|
-
interface
|
|
644
|
+
interface SubscribeFeedResponse {
|
|
635
645
|
subscription: PushSubscription;
|
|
636
646
|
/** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
|
|
637
647
|
feed_path: string;
|
|
638
648
|
}
|
|
639
|
-
interface
|
|
649
|
+
interface UnsubscribeResponse {
|
|
640
650
|
ok: true;
|
|
641
651
|
}
|
|
642
652
|
type ChannelGroupSubscriptionTargetType = 'feed' | 'playbook';
|
|
@@ -785,6 +795,18 @@ declare class FeedResource {
|
|
|
785
795
|
delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
|
|
786
796
|
}
|
|
787
797
|
|
|
798
|
+
/** Playbook visibility states understood by the gateway. */
|
|
799
|
+
type PlaybookVisibility = 'public' | 'private' | 'paid';
|
|
800
|
+
interface SetVisibilityParams {
|
|
801
|
+
/** URL-safe playbook name. The owner is derived server-side from auth. */
|
|
802
|
+
name: string;
|
|
803
|
+
/** Target visibility: public, private, or paid. */
|
|
804
|
+
visibility: PlaybookVisibility;
|
|
805
|
+
}
|
|
806
|
+
interface SetVisibilityResponse {
|
|
807
|
+
/** ALFS-style "<owner>/<name>" path echoed back by the gateway. */
|
|
808
|
+
playbook_path: string;
|
|
809
|
+
}
|
|
788
810
|
type TrendingPlaybooksSort = 'FOLLOWS' | 'RECENT';
|
|
789
811
|
type TrendingPlaybooksDir = 'FORWARD' | 'BACKWARD';
|
|
790
812
|
interface TrendingPlaybooksParams {
|
|
@@ -842,6 +864,16 @@ declare class PlaybooksResource {
|
|
|
842
864
|
* it into a smaller, agent-friendly shape.
|
|
843
865
|
*/
|
|
844
866
|
trending(params?: TrendingPlaybooksParams): Promise<TrendingPlaybooksResponse>;
|
|
867
|
+
/**
|
|
868
|
+
* Set a playbook's visibility. Requires authentication; the owner is
|
|
869
|
+
* resolved server-side from the authenticated user, so only the playbook
|
|
870
|
+
* `name` is needed.
|
|
871
|
+
*
|
|
872
|
+
* Note: `private` and `paid` are paid-tier capabilities. A free-tier user
|
|
873
|
+
* receives a `PERMISSION_DENIED` error from the gateway, which is surfaced
|
|
874
|
+
* here unchanged.
|
|
875
|
+
*/
|
|
876
|
+
setVisibility(params: SetVisibilityParams): Promise<SetVisibilityResponse>;
|
|
845
877
|
}
|
|
846
878
|
|
|
847
879
|
declare class SecretsResource {
|
|
@@ -926,6 +958,7 @@ declare class DataSkillsResource {
|
|
|
926
958
|
interface PlaybookSkillSummary {
|
|
927
959
|
username: string;
|
|
928
960
|
name: string;
|
|
961
|
+
display_name: string;
|
|
929
962
|
description: string;
|
|
930
963
|
tags: string[];
|
|
931
964
|
creator_uid: number;
|
|
@@ -1088,46 +1121,45 @@ declare class NotificationPreferencesResource {
|
|
|
1088
1121
|
}
|
|
1089
1122
|
|
|
1090
1123
|
/**
|
|
1091
|
-
*
|
|
1092
|
-
* DM/web push for a target. Independent of social follow:
|
|
1124
|
+
* Subscriptions — subscribe the caller to playbooks and feeds.
|
|
1093
1125
|
*
|
|
1094
|
-
* - `subscribePlaybook`
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1126
|
+
* - `subscribePlaybook` is a CASCADE: it follows the playbook AND enables
|
|
1127
|
+
* personal push for every push-enabled automation of its latest release,
|
|
1128
|
+
* in one call. `unsubscribePlaybook` reverses both (unfollow + disable
|
|
1129
|
+
* all of the playbook's push alerts).
|
|
1130
|
+
* - `subscribeFeed` / `unsubscribeFeed` toggle personal push for ONE feed
|
|
1131
|
+
* (a single automation's alert) without touching the playbook follow.
|
|
1098
1132
|
*
|
|
1099
|
-
* Backed by alva-gateway REST
|
|
1100
|
-
* `pkg/schema/push_subscription.graphql`).
|
|
1133
|
+
* Backed by alva-gateway REST under `/api/v1/subscriptions/...`.
|
|
1101
1134
|
*/
|
|
1102
|
-
declare class
|
|
1135
|
+
declare class SubscriptionsResource {
|
|
1103
1136
|
private client;
|
|
1104
1137
|
constructor(client: AlvaClient);
|
|
1105
1138
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1139
|
+
* Subscribe to a playbook `(username, name)`: follow it and enable alerts
|
|
1140
|
+
* on all its push-enabled automations. Idempotent. Auth: the caller must be
|
|
1141
|
+
* able to read the playbook — public passes; paid requires an active unlock;
|
|
1142
|
+
* private requires owner/admin.
|
|
1110
1143
|
*/
|
|
1111
|
-
subscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<
|
|
1144
|
+
subscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<SubscribePlaybookResponse>;
|
|
1112
1145
|
/**
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1146
|
+
* Unsubscribe from a playbook `(username, name)`: unfollow it and disable
|
|
1147
|
+
* all of its push alerts for the caller. Idempotent.
|
|
1115
1148
|
*/
|
|
1116
|
-
unsubscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<
|
|
1149
|
+
unsubscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<UnsubscribeResponse>;
|
|
1117
1150
|
/**
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
* push per playbook context. Idempotent.
|
|
1151
|
+
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
1152
|
+
* single automation's alerts, regardless of which playbook(s) consume it.
|
|
1153
|
+
* Does NOT follow any playbook. Idempotent.
|
|
1122
1154
|
*/
|
|
1123
|
-
subscribeFeed(params: PushSubscriptionFeedParams): Promise<
|
|
1155
|
+
subscribeFeed(params: PushSubscriptionFeedParams): Promise<SubscribeFeedResponse>;
|
|
1124
1156
|
/**
|
|
1125
|
-
*
|
|
1126
|
-
* Idempotent.
|
|
1157
|
+
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
1158
|
+
* alerts for the caller. Idempotent.
|
|
1127
1159
|
*/
|
|
1128
|
-
unsubscribeFeed(params: PushSubscriptionFeedParams): Promise<
|
|
1160
|
+
unsubscribeFeed(params: PushSubscriptionFeedParams): Promise<UnsubscribeResponse>;
|
|
1129
1161
|
/**
|
|
1130
|
-
* List the caller's currently active
|
|
1162
|
+
* List the caller's currently active subscriptions.
|
|
1131
1163
|
* Results are cursor-paginated.
|
|
1132
1164
|
*/
|
|
1133
1165
|
list(params?: PushSubscriptionListParams): Promise<PushSubscriptionListResponse>;
|
|
@@ -1189,7 +1221,7 @@ declare class AlvaClient {
|
|
|
1189
1221
|
private _arraysJwt?;
|
|
1190
1222
|
private _notifications?;
|
|
1191
1223
|
private _notificationPreferences?;
|
|
1192
|
-
private
|
|
1224
|
+
private _subscriptions?;
|
|
1193
1225
|
private _channelGroupSubscriptions?;
|
|
1194
1226
|
constructor(config: AlvaClientConfig);
|
|
1195
1227
|
get fs(): FsResource;
|
|
@@ -1211,7 +1243,7 @@ declare class AlvaClient {
|
|
|
1211
1243
|
get arraysJwt(): ArraysJwtResource;
|
|
1212
1244
|
get notifications(): NotificationsResource;
|
|
1213
1245
|
get notificationPreferences(): NotificationPreferencesResource;
|
|
1214
|
-
get
|
|
1246
|
+
get subscriptions(): SubscriptionsResource;
|
|
1215
1247
|
get channelGroupSubscriptions(): ChannelGroupSubscriptionsResource;
|
|
1216
1248
|
_requireAuth(): void;
|
|
1217
1249
|
_request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
@@ -1338,4 +1370,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
|
|
|
1338
1370
|
/** SDK version, injected at build time from package.json. */
|
|
1339
1371
|
declare const VERSION: string;
|
|
1340
1372
|
|
|
1341
|
-
export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
|
|
1373
|
+
export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
|
package/dist/index.js
CHANGED
|
@@ -323,6 +323,11 @@ var FeedResource = class {
|
|
|
323
323
|
};
|
|
324
324
|
|
|
325
325
|
// src/resources/playbooks.ts
|
|
326
|
+
var PLAYBOOK_VISIBILITIES = [
|
|
327
|
+
"public",
|
|
328
|
+
"private",
|
|
329
|
+
"paid"
|
|
330
|
+
];
|
|
326
331
|
var PlaybooksResource = class {
|
|
327
332
|
constructor(client) {
|
|
328
333
|
this.client = client;
|
|
@@ -356,6 +361,30 @@ var PlaybooksResource = class {
|
|
|
356
361
|
has_next: raw.has_next ?? false
|
|
357
362
|
};
|
|
358
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Set a playbook's visibility. Requires authentication; the owner is
|
|
366
|
+
* resolved server-side from the authenticated user, so only the playbook
|
|
367
|
+
* `name` is needed.
|
|
368
|
+
*
|
|
369
|
+
* Note: `private` and `paid` are paid-tier capabilities. A free-tier user
|
|
370
|
+
* receives a `PERMISSION_DENIED` error from the gateway, which is surfaced
|
|
371
|
+
* here unchanged.
|
|
372
|
+
*/
|
|
373
|
+
async setVisibility(params) {
|
|
374
|
+
if (!PLAYBOOK_VISIBILITIES.includes(params.visibility)) {
|
|
375
|
+
throw new AlvaError(
|
|
376
|
+
"INVALID_ARGUMENT",
|
|
377
|
+
`Invalid visibility "${params.visibility}". Expected one of: ${PLAYBOOK_VISIBILITIES.join(", ")}.`,
|
|
378
|
+
400
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
this.client._requireAuth();
|
|
382
|
+
return await this.client._request(
|
|
383
|
+
"POST",
|
|
384
|
+
`/api/v1/playbook/${encodeURIComponent(params.name)}/visibility`,
|
|
385
|
+
{ body: { visibility: params.visibility } }
|
|
386
|
+
);
|
|
387
|
+
}
|
|
359
388
|
};
|
|
360
389
|
function toAgentPlaybook(raw) {
|
|
361
390
|
const username = raw.creator?.name ?? "";
|
|
@@ -1623,6 +1652,17 @@ function metadataSummaryForSkill(skill) {
|
|
|
1623
1652
|
}
|
|
1624
1653
|
|
|
1625
1654
|
// src/resources/playbookSkills.ts
|
|
1655
|
+
function normalizePlaybookSkillSummary(raw) {
|
|
1656
|
+
return {
|
|
1657
|
+
username: raw.username,
|
|
1658
|
+
name: raw.name,
|
|
1659
|
+
display_name: raw.display_name,
|
|
1660
|
+
description: raw.description,
|
|
1661
|
+
tags: raw.tags,
|
|
1662
|
+
creator_uid: raw.creator_uid,
|
|
1663
|
+
updated_at: raw.updated_at
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1626
1666
|
function parsePlaybookSkillId(s) {
|
|
1627
1667
|
const parts = s.split("/");
|
|
1628
1668
|
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
@@ -1646,7 +1686,7 @@ var PlaybookSkillsResource = class {
|
|
|
1646
1686
|
const res = await this.client._request("GET", "/api/v1/skills", {
|
|
1647
1687
|
query
|
|
1648
1688
|
});
|
|
1649
|
-
return { skills: res.data ?? [] };
|
|
1689
|
+
return { skills: (res.data ?? []).map(normalizePlaybookSkillSummary) };
|
|
1650
1690
|
}
|
|
1651
1691
|
async tags() {
|
|
1652
1692
|
const res = await this.client._request(
|
|
@@ -1671,7 +1711,10 @@ var PlaybookSkillsResource = class {
|
|
|
1671
1711
|
0
|
|
1672
1712
|
);
|
|
1673
1713
|
}
|
|
1674
|
-
return
|
|
1714
|
+
return {
|
|
1715
|
+
...normalizePlaybookSkillSummary(meta),
|
|
1716
|
+
files: meta.files ?? []
|
|
1717
|
+
};
|
|
1675
1718
|
}
|
|
1676
1719
|
async file(id, path) {
|
|
1677
1720
|
const { username, name } = parsePlaybookSkillId(id);
|
|
@@ -1982,66 +2025,56 @@ var NotificationPreferencesResource = class {
|
|
|
1982
2025
|
}
|
|
1983
2026
|
};
|
|
1984
2027
|
|
|
1985
|
-
// src/resources/
|
|
1986
|
-
var
|
|
2028
|
+
// src/resources/subscriptions.ts
|
|
2029
|
+
var SubscriptionsResource = class {
|
|
1987
2030
|
constructor(client) {
|
|
1988
2031
|
this.client = client;
|
|
1989
2032
|
}
|
|
1990
2033
|
client;
|
|
1991
2034
|
/**
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
1994
|
-
*
|
|
1995
|
-
*
|
|
2035
|
+
* Subscribe to a playbook `(username, name)`: follow it and enable alerts
|
|
2036
|
+
* on all its push-enabled automations. Idempotent. Auth: the caller must be
|
|
2037
|
+
* able to read the playbook — public passes; paid requires an active unlock;
|
|
2038
|
+
* private requires owner/admin.
|
|
1996
2039
|
*/
|
|
1997
2040
|
async subscribePlaybook(params) {
|
|
1998
2041
|
this.client._requireAuth();
|
|
1999
|
-
const path = `/api/v1/
|
|
2042
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2000
2043
|
return this.client._request(
|
|
2001
2044
|
"POST",
|
|
2002
2045
|
path
|
|
2003
2046
|
);
|
|
2004
2047
|
}
|
|
2005
2048
|
/**
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2049
|
+
* Unsubscribe from a playbook `(username, name)`: unfollow it and disable
|
|
2050
|
+
* all of its push alerts for the caller. Idempotent.
|
|
2008
2051
|
*/
|
|
2009
2052
|
async unsubscribePlaybook(params) {
|
|
2010
2053
|
this.client._requireAuth();
|
|
2011
|
-
const path = `/api/v1/
|
|
2012
|
-
return this.client._request(
|
|
2013
|
-
"DELETE",
|
|
2014
|
-
path
|
|
2015
|
-
);
|
|
2054
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2055
|
+
return this.client._request("DELETE", path);
|
|
2016
2056
|
}
|
|
2017
2057
|
/**
|
|
2018
|
-
*
|
|
2019
|
-
*
|
|
2020
|
-
*
|
|
2021
|
-
* push per playbook context. Idempotent.
|
|
2058
|
+
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
2059
|
+
* single automation's alerts, regardless of which playbook(s) consume it.
|
|
2060
|
+
* Does NOT follow any playbook. Idempotent.
|
|
2022
2061
|
*/
|
|
2023
2062
|
async subscribeFeed(params) {
|
|
2024
2063
|
this.client._requireAuth();
|
|
2025
|
-
const path = `/api/v1/
|
|
2026
|
-
return this.client._request(
|
|
2027
|
-
"POST",
|
|
2028
|
-
path
|
|
2029
|
-
);
|
|
2064
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2065
|
+
return this.client._request("POST", path);
|
|
2030
2066
|
}
|
|
2031
2067
|
/**
|
|
2032
|
-
*
|
|
2033
|
-
* Idempotent.
|
|
2068
|
+
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
2069
|
+
* alerts for the caller. Idempotent.
|
|
2034
2070
|
*/
|
|
2035
2071
|
async unsubscribeFeed(params) {
|
|
2036
2072
|
this.client._requireAuth();
|
|
2037
|
-
const path = `/api/v1/
|
|
2038
|
-
return this.client._request(
|
|
2039
|
-
"DELETE",
|
|
2040
|
-
path
|
|
2041
|
-
);
|
|
2073
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2074
|
+
return this.client._request("DELETE", path);
|
|
2042
2075
|
}
|
|
2043
2076
|
/**
|
|
2044
|
-
* List the caller's currently active
|
|
2077
|
+
* List the caller's currently active subscriptions.
|
|
2045
2078
|
* Results are cursor-paginated.
|
|
2046
2079
|
*/
|
|
2047
2080
|
async list(params = {}) {
|
|
@@ -2051,7 +2084,7 @@ var PushSubscriptionsResource = class {
|
|
|
2051
2084
|
query.first = String(params.first);
|
|
2052
2085
|
}
|
|
2053
2086
|
if (params.cursor) query.cursor = params.cursor;
|
|
2054
|
-
return this.client._request("GET", "/api/v1/me/
|
|
2087
|
+
return this.client._request("GET", "/api/v1/me/subscriptions", {
|
|
2055
2088
|
query
|
|
2056
2089
|
});
|
|
2057
2090
|
}
|
|
@@ -2151,7 +2184,7 @@ var AlvaClient = class {
|
|
|
2151
2184
|
_arraysJwt;
|
|
2152
2185
|
_notifications;
|
|
2153
2186
|
_notificationPreferences;
|
|
2154
|
-
|
|
2187
|
+
_subscriptions;
|
|
2155
2188
|
_channelGroupSubscriptions;
|
|
2156
2189
|
constructor(config) {
|
|
2157
2190
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
@@ -2220,8 +2253,8 @@ var AlvaClient = class {
|
|
|
2220
2253
|
get notificationPreferences() {
|
|
2221
2254
|
return this._notificationPreferences ??= new NotificationPreferencesResource(this);
|
|
2222
2255
|
}
|
|
2223
|
-
get
|
|
2224
|
-
return this.
|
|
2256
|
+
get subscriptions() {
|
|
2257
|
+
return this._subscriptions ??= new SubscriptionsResource(this);
|
|
2225
2258
|
}
|
|
2226
2259
|
get channelGroupSubscriptions() {
|
|
2227
2260
|
return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
|
|
@@ -2710,7 +2743,7 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
2710
2743
|
};
|
|
2711
2744
|
|
|
2712
2745
|
// src/index.ts
|
|
2713
|
-
var VERSION = true ? "0.
|
|
2746
|
+
var VERSION = true ? "0.11.0" : "dev";
|
|
2714
2747
|
export {
|
|
2715
2748
|
AlvaClient,
|
|
2716
2749
|
AlvaError,
|