@relayfile/sdk 0.10.33 → 0.10.34

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 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 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 RelayFileReadCacheOptions, type Subscription, type SyncIngressStatusResponse, type SyncProviderStatus, 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, type WaitForDataOptions } from "./types.js";
1
+ import { type AdminIngressStatusResponse, type AdminSyncStatusResponse, type BulkWriteInput, type BulkWriteResponse, type BackendStatusResponse, type AckResponse, type CommitForkInput, type CommitForkResponse, type AcceptDurableSubscriptionDeliveryInput, type CancelDurableResourceSubscriptionOptions, type ClaimDurableSubscriptionDeliveriesInput, type CreateOrRenewDurableResourceSubscriptionInput, type CreateForkInput, type DeleteFileInput, type DeadLetterItem, type DeadLetterFeedResponse, type DeleteWebhookOptions, type DiscardForkInput, type DurableResourceSubscription, type DurableResourceSubscriptionListResponse, type DurableSubscriptionDeliveryListResponse, type DurableSubscriptionDeliveryResponse, 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 ListDurableResourceSubscriptionsOptions, type ListTreeOptions, type OperationFeedResponse, type OperationStatusResponse, type QueuedResponse, type ResourceAtEventResult, type ReadFileInput, type QueryFilesOptions, type RegisterWebhookInput, type RegisterWebhookResponse, type RelayFileReadCacheOptions, type Subscription, type SyncIngressStatusResponse, type SyncProviderStatus, 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, type WaitForDataOptions } 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.
@@ -108,6 +108,11 @@ export declare class RelayFileClient {
108
108
  discardFork(input: DiscardForkInput): Promise<void>;
109
109
  commitFork(input: CommitForkInput): Promise<CommitForkResponse>;
110
110
  getEvents(workspaceId: string, options?: GetEventsOptions): Promise<EventFeedResponse>;
111
+ createOrRenewDurableResourceSubscription(input: CreateOrRenewDurableResourceSubscriptionInput): Promise<DurableResourceSubscription>;
112
+ listDurableResourceSubscriptions(workspaceId: string, options?: ListDurableResourceSubscriptionsOptions): Promise<DurableResourceSubscriptionListResponse>;
113
+ cancelDurableResourceSubscription(workspaceId: string, subscriptionId: string, options?: CancelDurableResourceSubscriptionOptions): Promise<void>;
114
+ claimDurableSubscriptionDeliveries(input: ClaimDurableSubscriptionDeliveriesInput): Promise<DurableSubscriptionDeliveryListResponse>;
115
+ acceptDurableSubscriptionDelivery(input: AcceptDurableSubscriptionDeliveryInput): Promise<DurableSubscriptionDeliveryResponse>;
111
116
  subscribe(globs: string[], onChange: (event: ChangeEvent) => void, options?: SubscribeOptions): Subscription;
112
117
  open(options: ChangeStreamConnectionOptions): ChangeStreamConnection;
113
118
  getResourceAtEvent(eventId: string, context?: ProactiveRequestContext): Promise<ResourceAtEventResult>;
package/dist/client.js CHANGED
@@ -1354,6 +1354,85 @@ export class RelayFileClient {
1354
1354
  nextCursor: response.nextCursor ?? null
1355
1355
  };
1356
1356
  }
1357
+ async createOrRenewDurableResourceSubscription(input) {
1358
+ if (!input.workspaceId)
1359
+ throw new Error("workspaceId is required");
1360
+ if (!input.provider)
1361
+ throw new Error("provider is required");
1362
+ if (!input.resourceRef)
1363
+ throw new Error("resourceRef is required");
1364
+ if (!input.subscriberId)
1365
+ throw new Error("subscriberId is required");
1366
+ if (!Array.isArray(input.eventTypes) || input.eventTypes.length === 0) {
1367
+ throw new Error("eventTypes is required and must be a non-empty array");
1368
+ }
1369
+ if (!Number.isInteger(input.ttlSeconds) || input.ttlSeconds < 60 || input.ttlSeconds > 2_592_000) {
1370
+ throw new Error("ttlSeconds must be an integer between 60 and 2592000");
1371
+ }
1372
+ return this.request({
1373
+ method: "POST",
1374
+ path: `/v1/workspaces/${encodeURIComponent(input.workspaceId)}/subscriptions`,
1375
+ correlationId: input.correlationId,
1376
+ body: {
1377
+ provider: input.provider,
1378
+ resourceRef: input.resourceRef,
1379
+ eventTypes: input.eventTypes,
1380
+ terminalEventTypes: input.terminalEventTypes,
1381
+ subscriberId: input.subscriberId,
1382
+ intent: input.intent,
1383
+ ttlSeconds: input.ttlSeconds
1384
+ },
1385
+ signal: input.signal
1386
+ });
1387
+ }
1388
+ async listDurableResourceSubscriptions(workspaceId, options = {}) {
1389
+ if (!workspaceId)
1390
+ throw new Error("workspaceId is required");
1391
+ return this.request({
1392
+ method: "GET",
1393
+ path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/subscriptions`,
1394
+ correlationId: options.correlationId,
1395
+ signal: options.signal
1396
+ });
1397
+ }
1398
+ async cancelDurableResourceSubscription(workspaceId, subscriptionId, options = {}) {
1399
+ if (!workspaceId)
1400
+ throw new Error("workspaceId is required");
1401
+ if (!subscriptionId)
1402
+ throw new Error("subscriptionId is required");
1403
+ await this.performRequest({
1404
+ method: "DELETE",
1405
+ path: `/v1/workspaces/${encodeURIComponent(workspaceId)}/subscriptions/${encodeURIComponent(subscriptionId)}`,
1406
+ correlationId: options.correlationId,
1407
+ signal: options.signal
1408
+ });
1409
+ }
1410
+ async claimDurableSubscriptionDeliveries(input) {
1411
+ if (!input.workspaceId)
1412
+ throw new Error("workspaceId is required");
1413
+ return this.request({
1414
+ method: "POST",
1415
+ path: `/v1/workspaces/${encodeURIComponent(input.workspaceId)}/subscriptions/deliveries/claim`,
1416
+ correlationId: input.correlationId,
1417
+ body: input.limit === undefined ? {} : { limit: input.limit },
1418
+ signal: input.signal
1419
+ });
1420
+ }
1421
+ async acceptDurableSubscriptionDelivery(input) {
1422
+ if (!input.workspaceId)
1423
+ throw new Error("workspaceId is required");
1424
+ if (!input.deliveryId)
1425
+ throw new Error("deliveryId is required");
1426
+ if (!input.claimToken)
1427
+ throw new Error("claimToken is required");
1428
+ return this.request({
1429
+ method: "POST",
1430
+ path: `/v1/workspaces/${encodeURIComponent(input.workspaceId)}/subscriptions/deliveries/${encodeURIComponent(input.deliveryId)}/accept`,
1431
+ correlationId: input.correlationId,
1432
+ body: { claimToken: input.claimToken },
1433
+ signal: input.signal
1434
+ });
1435
+ }
1357
1436
  subscribe(globs, onChange, options) {
1358
1437
  const setup = this.resolveWorkspaceId(options?.aclToken)
1359
1438
  .then((workspaceId) => {
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export type { ConnectCapableProvider, ConnectConnectionStatus, ConnectSession, C
13
13
  export { supportsConnect } from "./connection.js";
14
14
  export { SelfHostConnect } from "./self-host-connect.js";
15
15
  export type { SelfHostConnectOptions, SelfHostConnectResult, StartSelfHostConnectOptions, WaitForSelfHostConnectionOptions } from "./self-host-connect.js";
16
- 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, WaitForDataOptions, 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";
16
+ export type { AckResponse, AcceptDurableSubscriptionDeliveryInput, AckWritebackInput, AckWritebackDraftDisposition, AckWritebackResponse, AdminIngressAlert, AdminIngressAlertProfile, AdminIngressEffectiveAlertProfile, AdminIngressAlertSeverity, AdminIngressAlertThresholds, AdminIngressAlertTotals, AdminIngressAlertType, AdminIngressStatusResponse, AdminSyncAlert, AdminSyncAlertSeverity, AdminSyncAlertThresholds, AdminSyncAlertTotals, AdminSyncAlertType, AdminSyncStatusResponse, BackendStatusResponse, BulkWriteFile, BulkWriteInput, BulkWriteResponse, CancelDurableResourceSubscriptionOptions, ChangeLogQueryResult, ChangeEvent, ChangeEventActor, ChangeEventResource, ChangeEventSummary, ChangeStreamConnection, ChangeStreamConnectionOptions, ClaimDurableSubscriptionDeliveriesInput, CommitForkInput, CommitForkResponse, ConflictErrorResponse, CreateOrRenewDurableResourceSubscriptionInput, CreateForkInput, ContentIdentity, DeleteFileInput, DeleteWebhookOptions, DeadLetterFeedResponse, DeadLetterItem, DigestBullet, DigestContext, DigestHandler, DigestSection, DigestWindow, DiscardForkInput, DurableResourceSubscription, DurableResourceSubscriptionListResponse, DurableResourceSubscriptionStatus, DurableSubscriptionDelivery, DurableSubscriptionDeliveryListResponse, DurableSubscriptionDeliveryResponse, DurableSubscriptionDeliveryStatus, DurableSubscriptionEvent, ErrorResponse, EventSummary, EventFeedResponse, ExportFormat, ExportJsonResponse, ExportOptions, FileQueryItem, FileQueryResponse, FileReadResponse, FileSemantics, FileWriteRequest, FilesystemEvent, FilesystemEventType, EventOrigin, Expansion, ExpansionLevel, GetEventsOptions, GetAdminSyncStatusOptions, GetAdminIngressStatusOptions, GetOperationsOptions, GetSyncDeadLettersOptions, GetSyncIngressStatusOptions, GetSyncStatusOptions, WaitForDataOptions, GetWebhookDeadLettersOptions, IngestWebhookInput, LayoutManifest, LayoutManifestAlias, LayoutManifestResource, ListWebhooksOptions, ListDurableResourceSubscriptionsOptions, 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";
17
17
  export type { ForkHandle, ForkOptions } from "@relayfile/core";
18
18
  export type { WriteEvent, WriteEventActor, WriteEventOperation, WriteEventSource } from "@relayfile/core";
19
19
  export { WritebackConsumer } from "./writeback-consumer.js";
package/dist/types.d.ts CHANGED
@@ -312,6 +312,96 @@ export interface EventFeedResponse {
312
312
  events: FilesystemEvent[];
313
313
  nextCursor: string | null;
314
314
  }
315
+ export type DurableResourceSubscriptionStatus = "active" | "cancelled" | "expired" | "retired";
316
+ export type DurableSubscriptionDeliveryStatus = "pending" | "claimed" | "accepted" | "cancelled";
317
+ /**
318
+ * Create-or-renew request for an owner-scoped durable resource subscription.
319
+ * The server derives ownerId from the bearer token; callers cannot supply it.
320
+ */
321
+ export interface CreateOrRenewDurableResourceSubscriptionInput {
322
+ workspaceId: string;
323
+ provider: string;
324
+ resourceRef: string;
325
+ eventTypes: string[];
326
+ terminalEventTypes?: string[];
327
+ subscriberId: string;
328
+ intent?: string;
329
+ ttlSeconds: number;
330
+ correlationId?: string;
331
+ signal?: AbortSignal;
332
+ }
333
+ export interface DurableResourceSubscription {
334
+ id: string;
335
+ ownerId: string;
336
+ subscriberId: string;
337
+ provider: string;
338
+ resourceRef: string;
339
+ eventTypes: string[];
340
+ terminalEventTypes: string[];
341
+ intent: string | null;
342
+ status: DurableResourceSubscriptionStatus;
343
+ createdAt: string;
344
+ updatedAt: string;
345
+ expiresAt: string;
346
+ retiredAt: string | null;
347
+ }
348
+ export interface ListDurableResourceSubscriptionsOptions {
349
+ correlationId?: string;
350
+ signal?: AbortSignal;
351
+ }
352
+ export interface DurableResourceSubscriptionListResponse {
353
+ subscriptions: DurableResourceSubscription[];
354
+ }
355
+ export interface DurableSubscriptionEvent {
356
+ id: string;
357
+ type: string;
358
+ path: string;
359
+ revision: string;
360
+ origin: string;
361
+ provider: string;
362
+ correlationId: string;
363
+ timestamp: string;
364
+ }
365
+ export interface DurableSubscriptionDelivery {
366
+ id: string;
367
+ subscriptionId: string;
368
+ ownerId: string;
369
+ subscriberId: string;
370
+ provider: string;
371
+ resourceRef: string;
372
+ event: DurableSubscriptionEvent;
373
+ terminal: boolean;
374
+ status: DurableSubscriptionDeliveryStatus;
375
+ createdAt: string;
376
+ claimedAt: string | null;
377
+ claimLeaseExpiresAt: string | null;
378
+ /** Present only while the delivery has a live claim. */
379
+ claimToken: string | null;
380
+ acceptedAt: string | null;
381
+ }
382
+ export interface ClaimDurableSubscriptionDeliveriesInput {
383
+ workspaceId: string;
384
+ limit?: number;
385
+ correlationId?: string;
386
+ signal?: AbortSignal;
387
+ }
388
+ export interface DurableSubscriptionDeliveryListResponse {
389
+ deliveries: DurableSubscriptionDelivery[];
390
+ }
391
+ export interface AcceptDurableSubscriptionDeliveryInput {
392
+ workspaceId: string;
393
+ deliveryId: string;
394
+ claimToken: string;
395
+ correlationId?: string;
396
+ signal?: AbortSignal;
397
+ }
398
+ export interface DurableSubscriptionDeliveryResponse {
399
+ delivery: DurableSubscriptionDelivery;
400
+ }
401
+ export interface CancelDurableResourceSubscriptionOptions {
402
+ correlationId?: string;
403
+ signal?: AbortSignal;
404
+ }
315
405
  export type ExportFormat = "tar" | "json" | "patch";
316
406
  export interface ExportOptions {
317
407
  workspaceId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relayfile/sdk",
3
- "version": "0.10.33",
3
+ "version": "0.10.34",
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.10.33",
62
+ "@relayfile/core": "0.10.34",
63
63
  "ignore": "^7.0.5",
64
64
  "tar": "^7.5.10"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@relayfile/mount-darwin-arm64": "0.10.33",
68
- "@relayfile/mount-darwin-x64": "0.10.33",
69
- "@relayfile/mount-linux-arm64": "0.10.33",
70
- "@relayfile/mount-linux-x64": "0.10.33"
67
+ "@relayfile/mount-darwin-arm64": "0.10.34",
68
+ "@relayfile/mount-darwin-x64": "0.10.34",
69
+ "@relayfile/mount-linux-arm64": "0.10.34",
70
+ "@relayfile/mount-linux-x64": "0.10.34"
71
71
  },
72
72
  "devDependencies": {
73
73
  "typescript": "^5.7.3",