@relayfile/sdk 0.8.28 → 0.8.30
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/dist/client.d.ts +6 -1
- package/dist/client.js +73 -0
- package/dist/index.d.ts +1 -1
- package/dist/sync.js +1 -0
- package/dist/types.d.ts +61 -0
- package/package.json +6 -6
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AdminIngressStatusResponse, type AdminSyncStatusResponse, type BulkWriteInput, type BulkWriteResponse, type BackendStatusResponse, type AckResponse, type CommitForkInput, type CommitForkResponse, type CreateForkInput, type DeleteFileInput, type DeadLetterItem, type DeadLetterFeedResponse, type DiscardForkInput, type EventFeedResponse, type ExportJsonResponse, type ExportOptions, type FileQueryResponse, type FileReadResponse, type FilesystemEvent, type GetEventsOptions, type GetAdminIngressStatusOptions, type GetAdminSyncStatusOptions, type GetOperationsOptions, type GetSyncDeadLettersOptions, type GetSyncIngressStatusOptions, type GetSyncStatusOptions, type ListTreeOptions, type OperationFeedResponse, type OperationStatusResponse, type QueuedResponse, type ResourceAtEventResult, type ReadFileInput, type QueryFilesOptions, type Subscription, type SyncIngressStatusResponse, type SyncStatusResponse, type TreeResponse, type WriteFileInput, type WriteQueuedResponse, type IngestWebhookInput, type WritebackItem, type AckWritebackInput, type AckWritebackResponse, type SweepWritebackDraftsInput, type SweepWritebackDraftsResponse, type ChangeEvent, type ChangeLogQueryResult, type ChangeStreamConnection, type ChangeStreamConnectionOptions, type SubscribeOptions } from "./types.js";
|
|
1
|
+
import { type AdminIngressStatusResponse, type AdminSyncStatusResponse, type BulkWriteInput, type BulkWriteResponse, type BackendStatusResponse, type AckResponse, type CommitForkInput, type CommitForkResponse, type CreateForkInput, type DeleteFileInput, type DeadLetterItem, type DeadLetterFeedResponse, type DeleteWebhookOptions, type DiscardForkInput, type EventFeedResponse, type ExportJsonResponse, type ExportOptions, type FileQueryResponse, type FileReadResponse, type FilesystemEvent, type GetEventsOptions, type GetAdminIngressStatusOptions, type GetAdminSyncStatusOptions, type GetOperationsOptions, type GetSyncDeadLettersOptions, type GetSyncIngressStatusOptions, type GetSyncStatusOptions, type GetWebhookDeadLettersOptions, type ListWebhooksOptions, type ListTreeOptions, type OperationFeedResponse, type OperationStatusResponse, type QueuedResponse, type ResourceAtEventResult, type ReadFileInput, type QueryFilesOptions, type RegisterWebhookInput, type RegisterWebhookResponse, type Subscription, type SyncIngressStatusResponse, type SyncStatusResponse, type TreeResponse, type WriteFileInput, type WriteQueuedResponse, type IngestWebhookInput, type WritebackItem, type WebhookDeliveryDeadLetterFeedResponse, type WebhookSubscription, type AckWritebackInput, type AckWritebackResponse, type SweepWritebackDraftsInput, type SweepWritebackDraftsResponse, type ChangeEvent, type ChangeLogQueryResult, type ChangeStreamConnection, type ChangeStreamConnectionOptions, type SubscribeOptions } from "./types.js";
|
|
2
2
|
import type { ForkHandle } from "@relayfile/core";
|
|
3
3
|
/**
|
|
4
4
|
* Bearer token or token factory used for Relayfile API requests.
|
|
@@ -125,6 +125,11 @@ export declare class RelayFileClient {
|
|
|
125
125
|
ackSyncDeadLetter(workspaceId: string, envelopeId: string, correlationId?: string, signal?: AbortSignal): Promise<AckResponse>;
|
|
126
126
|
triggerSyncRefresh(workspaceId: string, provider: string, reason?: string, correlationId?: string, signal?: AbortSignal): Promise<QueuedResponse>;
|
|
127
127
|
ingestWebhook(input: IngestWebhookInput): Promise<QueuedResponse>;
|
|
128
|
+
registerWebhook(input: RegisterWebhookInput): Promise<RegisterWebhookResponse>;
|
|
129
|
+
listWebhooks(workspaceId: string, options?: ListWebhooksOptions): Promise<WebhookSubscription[]>;
|
|
130
|
+
deleteWebhook(workspaceId: string, subscriptionId: string, options?: DeleteWebhookOptions): Promise<void>;
|
|
131
|
+
getWebhookDeadLetters(workspaceId: string, options?: GetWebhookDeadLettersOptions): Promise<WebhookDeliveryDeadLetterFeedResponse>;
|
|
132
|
+
replayWebhookDeadLetter(workspaceId: string, deliveryId: string, correlationId?: string, signal?: AbortSignal): Promise<QueuedResponse>;
|
|
128
133
|
listPendingWritebacks(workspaceId: string, correlationId?: string, signal?: AbortSignal): Promise<WritebackItem[]>;
|
|
129
134
|
ackWriteback(input: AckWritebackInput): Promise<AckWritebackResponse>;
|
|
130
135
|
/**
|
package/dist/client.js
CHANGED
|
@@ -1508,6 +1508,79 @@ export class RelayFileClient {
|
|
|
1508
1508
|
signal: input.signal
|
|
1509
1509
|
});
|
|
1510
1510
|
}
|
|
1511
|
+
async registerWebhook(input) {
|
|
1512
|
+
if (!input.workspaceId) {
|
|
1513
|
+
throw new Error("workspaceId is required");
|
|
1514
|
+
}
|
|
1515
|
+
if (!input.url) {
|
|
1516
|
+
throw new Error("url is required");
|
|
1517
|
+
}
|
|
1518
|
+
return this.request({
|
|
1519
|
+
method: "POST",
|
|
1520
|
+
path: `/v1/workspaces/${encodeURIComponent(input.workspaceId)}/webhooks`,
|
|
1521
|
+
correlationId: input.correlationId,
|
|
1522
|
+
body: {
|
|
1523
|
+
url: input.url,
|
|
1524
|
+
pathGlobs: input.pathGlobs,
|
|
1525
|
+
secret: input.secret
|
|
1526
|
+
},
|
|
1527
|
+
signal: input.signal
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
async listWebhooks(workspaceId, options = {}) {
|
|
1531
|
+
if (!workspaceId) {
|
|
1532
|
+
throw new Error("workspaceId is required");
|
|
1533
|
+
}
|
|
1534
|
+
return this.request({
|
|
1535
|
+
method: "GET",
|
|
1536
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/webhooks`,
|
|
1537
|
+
correlationId: options.correlationId,
|
|
1538
|
+
signal: options.signal
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
async deleteWebhook(workspaceId, subscriptionId, options = {}) {
|
|
1542
|
+
if (!workspaceId) {
|
|
1543
|
+
throw new Error("workspaceId is required");
|
|
1544
|
+
}
|
|
1545
|
+
if (!subscriptionId) {
|
|
1546
|
+
throw new Error("subscriptionId is required");
|
|
1547
|
+
}
|
|
1548
|
+
await this.performRequest({
|
|
1549
|
+
method: "DELETE",
|
|
1550
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/webhooks/${encodeURIComponent(subscriptionId)}`,
|
|
1551
|
+
correlationId: options.correlationId,
|
|
1552
|
+
signal: options.signal
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
async getWebhookDeadLetters(workspaceId, options = {}) {
|
|
1556
|
+
if (!workspaceId) {
|
|
1557
|
+
throw new Error("workspaceId is required");
|
|
1558
|
+
}
|
|
1559
|
+
const query = buildQuery({
|
|
1560
|
+
cursor: options.cursor,
|
|
1561
|
+
limit: options.limit
|
|
1562
|
+
});
|
|
1563
|
+
return this.request({
|
|
1564
|
+
method: "GET",
|
|
1565
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/webhooks/dlq${query}`,
|
|
1566
|
+
correlationId: options.correlationId,
|
|
1567
|
+
signal: options.signal
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
async replayWebhookDeadLetter(workspaceId, deliveryId, correlationId, signal) {
|
|
1571
|
+
if (!workspaceId) {
|
|
1572
|
+
throw new Error("workspaceId is required");
|
|
1573
|
+
}
|
|
1574
|
+
if (!deliveryId) {
|
|
1575
|
+
throw new Error("deliveryId is required");
|
|
1576
|
+
}
|
|
1577
|
+
return this.request({
|
|
1578
|
+
method: "POST",
|
|
1579
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/webhooks/dlq/${encodeURIComponent(deliveryId)}/replay`,
|
|
1580
|
+
correlationId,
|
|
1581
|
+
signal
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1511
1584
|
async listPendingWritebacks(workspaceId, correlationId, signal) {
|
|
1512
1585
|
return this.request({
|
|
1513
1586
|
method: "GET",
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { InvalidStateError, PayloadTooLargeError, QueueFullError, RelayFileApiEr
|
|
|
9
9
|
export { IntegrationProvider, computeCanonicalPath } from "./provider.js";
|
|
10
10
|
export type { WebhookInput, ListProviderFilesOptions, WatchProviderEventsOptions } from "./provider.js";
|
|
11
11
|
export type { ConnectionProvider, NormalizedWebhook, ProxyHeaders, ProxyMethod, ProxyQuery, ProxyRequest, ProxyResponse, } from "./connection.js";
|
|
12
|
-
export type { AckResponse, AckWritebackInput, AckWritebackDraftDisposition, AckWritebackResponse, AdminIngressAlert, AdminIngressAlertProfile, AdminIngressEffectiveAlertProfile, AdminIngressAlertSeverity, AdminIngressAlertThresholds, AdminIngressAlertTotals, AdminIngressAlertType, AdminIngressStatusResponse, AdminSyncAlert, AdminSyncAlertSeverity, AdminSyncAlertThresholds, AdminSyncAlertTotals, AdminSyncAlertType, AdminSyncStatusResponse, BackendStatusResponse, BulkWriteFile, BulkWriteInput, BulkWriteResponse, ChangeLogQueryResult, ChangeEvent, ChangeEventActor, ChangeEventResource, ChangeEventSummary, ChangeStreamConnection, ChangeStreamConnectionOptions, CommitForkInput, CommitForkResponse, ConflictErrorResponse, CreateForkInput, ContentIdentity, DeleteFileInput, DeadLetterFeedResponse, DeadLetterItem, DigestBullet, DigestContext, DigestHandler, DigestSection, DigestWindow, DiscardForkInput, ErrorResponse, EventSummary, EventFeedResponse, ExportFormat, ExportJsonResponse, ExportOptions, FileQueryItem, FileQueryResponse, FileReadResponse, FileSemantics, FileWriteRequest, FilesystemEvent, FilesystemEventType, EventOrigin, Expansion, ExpansionLevel, GetEventsOptions, GetAdminSyncStatusOptions, GetAdminIngressStatusOptions, GetOperationsOptions, GetSyncDeadLettersOptions, GetSyncIngressStatusOptions, GetSyncStatusOptions, IngestWebhookInput, LayoutManifest, LayoutManifestAlias, LayoutManifestResource, ListTreeOptions, OperationFeedResponse, OperationStatus, OperationStatusResponse, QueuedResponse, QueryFilesOptions, ReadFileInput, ReplayOptions, ResourceAtEventResult, SummaryExpansion, FullExpansion, DiffExpansion, ThreadExpansion, RelayFileJwtClaims, SubscribeOptions, Subscription, SyncIngressStatusResponse, SyncProviderStatus, SyncProviderStatusState, SyncRefreshRequest, SyncStatusResponse, SweepWritebackDraftsInput, SweepWritebackDraftsResponse, TreeEntry, TreeResponse, WritebackActionType, WritebackDeadLetterError, WritebackDeadLetterErrorCode, WritebackListState, WritebackState, WritebackItem, WritebackItemDetail, WritebackSchemaRef, WriteFileInput, WriteQueuedResponse } from "./types.js";
|
|
12
|
+
export type { AckResponse, AckWritebackInput, AckWritebackDraftDisposition, AckWritebackResponse, AdminIngressAlert, AdminIngressAlertProfile, AdminIngressEffectiveAlertProfile, AdminIngressAlertSeverity, AdminIngressAlertThresholds, AdminIngressAlertTotals, AdminIngressAlertType, AdminIngressStatusResponse, AdminSyncAlert, AdminSyncAlertSeverity, AdminSyncAlertThresholds, AdminSyncAlertTotals, AdminSyncAlertType, AdminSyncStatusResponse, BackendStatusResponse, BulkWriteFile, BulkWriteInput, BulkWriteResponse, ChangeLogQueryResult, ChangeEvent, ChangeEventActor, ChangeEventResource, ChangeEventSummary, ChangeStreamConnection, ChangeStreamConnectionOptions, CommitForkInput, CommitForkResponse, ConflictErrorResponse, CreateForkInput, ContentIdentity, DeleteFileInput, DeleteWebhookOptions, DeadLetterFeedResponse, DeadLetterItem, DigestBullet, DigestContext, DigestHandler, DigestSection, DigestWindow, DiscardForkInput, ErrorResponse, EventSummary, EventFeedResponse, ExportFormat, ExportJsonResponse, ExportOptions, FileQueryItem, FileQueryResponse, FileReadResponse, FileSemantics, FileWriteRequest, FilesystemEvent, FilesystemEventType, EventOrigin, Expansion, ExpansionLevel, GetEventsOptions, GetAdminSyncStatusOptions, GetAdminIngressStatusOptions, GetOperationsOptions, GetSyncDeadLettersOptions, GetSyncIngressStatusOptions, GetSyncStatusOptions, GetWebhookDeadLettersOptions, IngestWebhookInput, LayoutManifest, LayoutManifestAlias, LayoutManifestResource, ListWebhooksOptions, ListTreeOptions, OperationFeedResponse, OperationStatus, OperationStatusResponse, QueuedResponse, QueryFilesOptions, ReadFileInput, RegisterWebhookInput, RegisterWebhookResponse, ReplayOptions, ResourceAtEventResult, SummaryExpansion, FullExpansion, DiffExpansion, ThreadExpansion, RelayFileJwtClaims, SubscribeOptions, Subscription, SyncIngressStatusResponse, SyncProviderStatus, SyncProviderStatusState, SyncRefreshRequest, SyncStatusResponse, SweepWritebackDraftsInput, SweepWritebackDraftsResponse, TreeEntry, TreeResponse, WebhookDeliveryDeadLetterFeedResponse, WebhookDeliveryDeadLetterItem, WebhookSubscription, WebhookSubscriptionHealth, WritebackActionType, WritebackDeadLetterError, WritebackDeadLetterErrorCode, WritebackListState, WritebackState, WritebackItem, WritebackItemDetail, WritebackSchemaRef, WriteFileInput, WriteQueuedResponse } from "./types.js";
|
|
13
13
|
export type { ForkHandle, ForkOptions } from "@relayfile/core";
|
|
14
14
|
export type { WriteEvent, WriteEventActor, WriteEventOperation, WriteEventSource } from "@relayfile/core";
|
|
15
15
|
export { WritebackConsumer } from "./writeback-consumer.js";
|
package/dist/sync.js
CHANGED
|
@@ -136,6 +136,7 @@ function normalizeFilesystemEvent(message) {
|
|
|
136
136
|
type: message.type,
|
|
137
137
|
path: message.path ?? "",
|
|
138
138
|
revision: message.revision ?? "",
|
|
139
|
+
contentHash: message.contentHash,
|
|
139
140
|
origin: message.origin,
|
|
140
141
|
provider: message.provider,
|
|
141
142
|
correlationId: message.correlationId,
|
package/dist/types.d.ts
CHANGED
|
@@ -144,6 +144,7 @@ export interface FilesystemEvent {
|
|
|
144
144
|
type: FilesystemEventType;
|
|
145
145
|
path: string;
|
|
146
146
|
revision: string;
|
|
147
|
+
contentHash?: string;
|
|
147
148
|
origin?: EventOrigin;
|
|
148
149
|
provider?: string;
|
|
149
150
|
correlationId?: string;
|
|
@@ -616,6 +617,66 @@ export interface DeadLetterFeedResponse {
|
|
|
616
617
|
items: DeadLetterItem[];
|
|
617
618
|
nextCursor: string | null;
|
|
618
619
|
}
|
|
620
|
+
export interface WebhookSubscriptionHealth {
|
|
621
|
+
lastDeliveryAt: string | null;
|
|
622
|
+
lastSuccessAt: string | null;
|
|
623
|
+
lastError: string | null;
|
|
624
|
+
consecutiveFailures: number;
|
|
625
|
+
}
|
|
626
|
+
export interface WebhookSubscription {
|
|
627
|
+
id: string;
|
|
628
|
+
url: string;
|
|
629
|
+
pathGlobs: string[];
|
|
630
|
+
createdAt: string;
|
|
631
|
+
updatedAt: string;
|
|
632
|
+
health: WebhookSubscriptionHealth;
|
|
633
|
+
}
|
|
634
|
+
export interface RegisterWebhookInput {
|
|
635
|
+
workspaceId: string;
|
|
636
|
+
url: string;
|
|
637
|
+
pathGlobs: string[];
|
|
638
|
+
/**
|
|
639
|
+
* Optional HMAC secret. If omitted, relayfile generates a secret and returns
|
|
640
|
+
* it once from the registration response.
|
|
641
|
+
*/
|
|
642
|
+
secret?: string;
|
|
643
|
+
correlationId?: string;
|
|
644
|
+
signal?: AbortSignal;
|
|
645
|
+
}
|
|
646
|
+
export interface RegisterWebhookResponse {
|
|
647
|
+
subscriptionId: string;
|
|
648
|
+
secret?: string;
|
|
649
|
+
}
|
|
650
|
+
export interface ListWebhooksOptions {
|
|
651
|
+
correlationId?: string;
|
|
652
|
+
signal?: AbortSignal;
|
|
653
|
+
}
|
|
654
|
+
export interface DeleteWebhookOptions {
|
|
655
|
+
correlationId?: string;
|
|
656
|
+
signal?: AbortSignal;
|
|
657
|
+
}
|
|
658
|
+
export interface GetWebhookDeadLettersOptions {
|
|
659
|
+
cursor?: string;
|
|
660
|
+
limit?: number;
|
|
661
|
+
correlationId?: string;
|
|
662
|
+
signal?: AbortSignal;
|
|
663
|
+
}
|
|
664
|
+
export interface WebhookDeliveryDeadLetterItem {
|
|
665
|
+
deliveryId: string;
|
|
666
|
+
workspaceId: string;
|
|
667
|
+
subscriptionId: string;
|
|
668
|
+
eventId: string;
|
|
669
|
+
url: string;
|
|
670
|
+
failedAt: string;
|
|
671
|
+
attemptCount: number;
|
|
672
|
+
lastError: string;
|
|
673
|
+
replayCount: number;
|
|
674
|
+
status: "dead_lettered" | "queued" | "delivered";
|
|
675
|
+
}
|
|
676
|
+
export interface WebhookDeliveryDeadLetterFeedResponse {
|
|
677
|
+
items: WebhookDeliveryDeadLetterItem[];
|
|
678
|
+
nextCursor: string | null;
|
|
679
|
+
}
|
|
619
680
|
export interface WriteFileInput {
|
|
620
681
|
workspaceId: string;
|
|
621
682
|
path: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relayfile/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.30",
|
|
4
4
|
"description": "TypeScript SDK for relayfile — real-time filesystem for humans and agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"prepublishOnly": "npm run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@relayfile/core": "0.8.
|
|
62
|
+
"@relayfile/core": "0.8.30",
|
|
63
63
|
"ignore": "^7.0.5",
|
|
64
64
|
"tar": "^7.5.10"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@relayfile/mount-darwin-arm64": "0.8.
|
|
68
|
-
"@relayfile/mount-darwin-x64": "0.8.
|
|
69
|
-
"@relayfile/mount-linux-arm64": "0.8.
|
|
70
|
-
"@relayfile/mount-linux-x64": "0.8.
|
|
67
|
+
"@relayfile/mount-darwin-arm64": "0.8.30",
|
|
68
|
+
"@relayfile/mount-darwin-x64": "0.8.30",
|
|
69
|
+
"@relayfile/mount-linux-arm64": "0.8.30",
|
|
70
|
+
"@relayfile/mount-linux-x64": "0.8.30"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {},
|
|
73
73
|
"devDependencies": {
|