@relayfile/sdk 0.10.32 → 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 +6 -1
- package/dist/client.js +79 -0
- package/dist/index.d.ts +1 -1
- package/dist/setup.d.ts +2 -0
- package/dist/setup.js +110 -0
- package/dist/types.d.ts +90 -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 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/setup.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare class RelayfileSetup {
|
|
|
42
42
|
private readonly accessToken?;
|
|
43
43
|
private readonly requestTimeoutMs;
|
|
44
44
|
private readonly retryOptions;
|
|
45
|
+
private readonly ensuredMounts;
|
|
45
46
|
static login(options?: RelayfileCloudLoginOptions): Promise<RelayfileSetup>;
|
|
46
47
|
static fromCloudTokens(tokens: RelayfileCloudTokenSet, options?: RelayfileCloudTokenSetupOptions): RelayfileSetup;
|
|
47
48
|
constructor(options?: RelayfileSetupOptions);
|
|
@@ -49,6 +50,7 @@ export declare class RelayfileSetup {
|
|
|
49
50
|
joinWorkspace(workspaceId: string, options?: JoinWorkspaceOptions): Promise<WorkspaceHandle>;
|
|
50
51
|
mountWorkspace(input: MountWorkspaceInput): Promise<MountedWorkspaceHandle>;
|
|
51
52
|
ensureMountedWorkspace(input: EnsureMountedWorkspaceInput): Promise<MountedWorkspaceHandle>;
|
|
53
|
+
private startEnsuredMount;
|
|
52
54
|
joinWorkspaceResponse(workspaceId: string, options: NormalizedJoinWorkspaceOptions, overrides?: {
|
|
53
55
|
tokenProvider?: AccessTokenProvider;
|
|
54
56
|
}): Promise<ValidatedJoinWorkspaceResponse>;
|
package/dist/setup.js
CHANGED
|
@@ -32,6 +32,7 @@ export class RelayfileSetup {
|
|
|
32
32
|
accessToken;
|
|
33
33
|
requestTimeoutMs;
|
|
34
34
|
retryOptions;
|
|
35
|
+
ensuredMounts = new Map();
|
|
35
36
|
static async login(options = {}) {
|
|
36
37
|
void options;
|
|
37
38
|
throw new RelayfileSetupError("RelayfileSetup.login() starts a local HTTP callback server and is only available from @relayfile/sdk/cli. Import RelayfileSetup from @relayfile/sdk/cli for interactive Cloud login.", "node_only_sdk_feature");
|
|
@@ -136,6 +137,35 @@ export class RelayfileSetup {
|
|
|
136
137
|
async ensureMountedWorkspace(input) {
|
|
137
138
|
const normalized = normalizeEnsureMountedWorkspaceInput(input);
|
|
138
139
|
const workspace = await this.resolveWorkspaceForMount(normalized);
|
|
140
|
+
throwIfAborted(normalized.signal, "ensureMountedWorkspace");
|
|
141
|
+
const mountKey = ensuredMountKey(workspace, normalized);
|
|
142
|
+
const existing = this.ensuredMounts.get(mountKey);
|
|
143
|
+
if (existing) {
|
|
144
|
+
return waitForEnsuredMount(existing, normalized.signal);
|
|
145
|
+
}
|
|
146
|
+
let shared;
|
|
147
|
+
// The physical mount belongs to the logical target, not the first caller.
|
|
148
|
+
// Individual abort signals only cancel that caller's wait below.
|
|
149
|
+
shared = this.startEnsuredMount(workspace, {
|
|
150
|
+
...normalized,
|
|
151
|
+
signal: undefined
|
|
152
|
+
}).then((mounted) => new SharedMountedWorkspaceHandle({
|
|
153
|
+
mounted,
|
|
154
|
+
onStopped: () => {
|
|
155
|
+
if (this.ensuredMounts.get(mountKey) === shared) {
|
|
156
|
+
this.ensuredMounts.delete(mountKey);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
this.ensuredMounts.set(mountKey, shared);
|
|
161
|
+
void shared.catch(() => {
|
|
162
|
+
if (this.ensuredMounts.get(mountKey) === shared) {
|
|
163
|
+
this.ensuredMounts.delete(mountKey);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return waitForEnsuredMount(shared, normalized.signal);
|
|
167
|
+
}
|
|
168
|
+
async startEnsuredMount(workspace, normalized) {
|
|
139
169
|
if (normalized.verifyProvider) {
|
|
140
170
|
if (!normalized.provider) {
|
|
141
171
|
throw new MountSessionInputError("provider required when verifyProvider=true");
|
|
@@ -781,6 +811,55 @@ class MountedWorkspaceHandleImpl {
|
|
|
781
811
|
await safeStopLauncher(this.launcherInstance);
|
|
782
812
|
}
|
|
783
813
|
}
|
|
814
|
+
class SharedMountedWorkspaceHandle {
|
|
815
|
+
mounted;
|
|
816
|
+
onStopped;
|
|
817
|
+
stopPromise;
|
|
818
|
+
constructor(input) {
|
|
819
|
+
this.mounted = input.mounted;
|
|
820
|
+
this.onStopped = input.onStopped;
|
|
821
|
+
}
|
|
822
|
+
get workspaceId() {
|
|
823
|
+
return this.mounted.workspaceId;
|
|
824
|
+
}
|
|
825
|
+
get localDir() {
|
|
826
|
+
return this.mounted.localDir;
|
|
827
|
+
}
|
|
828
|
+
get remotePath() {
|
|
829
|
+
return this.mounted.remotePath;
|
|
830
|
+
}
|
|
831
|
+
get mode() {
|
|
832
|
+
return this.mounted.mode;
|
|
833
|
+
}
|
|
834
|
+
get ready() {
|
|
835
|
+
return this.mounted.ready;
|
|
836
|
+
}
|
|
837
|
+
get expiresAt() {
|
|
838
|
+
return this.mounted.expiresAt;
|
|
839
|
+
}
|
|
840
|
+
get suggestedRefreshAt() {
|
|
841
|
+
return this.mounted.suggestedRefreshAt;
|
|
842
|
+
}
|
|
843
|
+
env() {
|
|
844
|
+
return this.mounted.env();
|
|
845
|
+
}
|
|
846
|
+
status() {
|
|
847
|
+
return this.mounted.status();
|
|
848
|
+
}
|
|
849
|
+
async stop() {
|
|
850
|
+
if (!this.stopPromise)
|
|
851
|
+
this.stopPromise = this.performStop();
|
|
852
|
+
await this.stopPromise;
|
|
853
|
+
}
|
|
854
|
+
async performStop() {
|
|
855
|
+
try {
|
|
856
|
+
await this.mounted.stop();
|
|
857
|
+
}
|
|
858
|
+
finally {
|
|
859
|
+
this.onStopped();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
784
863
|
class SupervisedMountedWorkspaceHandle {
|
|
785
864
|
mounted;
|
|
786
865
|
launch;
|
|
@@ -941,6 +1020,37 @@ class SupervisedMountedWorkspaceHandle {
|
|
|
941
1020
|
void Promise.resolve(this.onEvent?.(event)).catch(() => { });
|
|
942
1021
|
}
|
|
943
1022
|
}
|
|
1023
|
+
function ensuredMountKey(workspace, input) {
|
|
1024
|
+
return JSON.stringify([
|
|
1025
|
+
workspace.workspaceId,
|
|
1026
|
+
input.localDir,
|
|
1027
|
+
input.remotePath,
|
|
1028
|
+
input.mode,
|
|
1029
|
+
input.localLayout,
|
|
1030
|
+
input.syncMode,
|
|
1031
|
+
input.background
|
|
1032
|
+
]);
|
|
1033
|
+
}
|
|
1034
|
+
async function waitForEnsuredMount(mounted, signal) {
|
|
1035
|
+
if (!signal)
|
|
1036
|
+
return mounted;
|
|
1037
|
+
if (signal.aborted)
|
|
1038
|
+
throw new CloudAbortError("ensureMountedWorkspace");
|
|
1039
|
+
let onAbort;
|
|
1040
|
+
try {
|
|
1041
|
+
return await Promise.race([
|
|
1042
|
+
mounted,
|
|
1043
|
+
new Promise((_, reject) => {
|
|
1044
|
+
onAbort = () => reject(new CloudAbortError("ensureMountedWorkspace"));
|
|
1045
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
1046
|
+
})
|
|
1047
|
+
]);
|
|
1048
|
+
}
|
|
1049
|
+
finally {
|
|
1050
|
+
if (onAbort)
|
|
1051
|
+
signal.removeEventListener("abort", onAbort);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
944
1054
|
function setupErrorCode(error) {
|
|
945
1055
|
return error instanceof RelayfileSetupError ? error.code : "mount_refresh_failed";
|
|
946
1056
|
}
|
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.
|
|
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.
|
|
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.
|
|
68
|
-
"@relayfile/mount-darwin-x64": "0.10.
|
|
69
|
-
"@relayfile/mount-linux-arm64": "0.10.
|
|
70
|
-
"@relayfile/mount-linux-x64": "0.10.
|
|
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",
|