@relayfile/sdk 0.1.6 → 0.1.7
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/integration-adapter.d.ts +63 -0
- package/dist/integration-adapter.js +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export type { ConnectionProvider, NormalizedWebhook, ProxyHeaders, ProxyMethod,
|
|
|
7
7
|
export type { AckResponse, AckWritebackInput, AckWritebackResponse, AdminIngressAlert, AdminIngressAlertProfile, AdminIngressEffectiveAlertProfile, AdminIngressAlertSeverity, AdminIngressAlertThresholds, AdminIngressAlertTotals, AdminIngressAlertType, AdminIngressStatusResponse, AdminSyncAlert, AdminSyncAlertSeverity, AdminSyncAlertThresholds, AdminSyncAlertTotals, AdminSyncAlertType, AdminSyncStatusResponse, BackendStatusResponse, BulkWriteFile, BulkWriteInput, BulkWriteResponse, ConflictErrorResponse, DeleteFileInput, DeadLetterFeedResponse, DeadLetterItem, ErrorResponse, EventFeedResponse, ExportFormat, ExportJsonResponse, ExportOptions, FileQueryItem, FileQueryResponse, FileReadResponse, FileSemantics, FileWriteRequest, FilesystemEvent, FilesystemEventType, EventOrigin, GetEventsOptions, GetAdminSyncStatusOptions, GetAdminIngressStatusOptions, GetOperationsOptions, GetSyncDeadLettersOptions, GetSyncIngressStatusOptions, GetSyncStatusOptions, IngestWebhookInput, ListTreeOptions, OperationFeedResponse, OperationStatus, OperationStatusResponse, QueuedResponse, QueryFilesOptions, RelayFileJwtClaims, SyncIngressStatusResponse, SyncProviderStatus, SyncProviderStatusState, SyncRefreshRequest, SyncStatusResponse, TreeEntry, TreeResponse, WritebackActionType, WritebackState, WritebackItem, WriteFileInput, WriteQueuedResponse } from "./types.js";
|
|
8
8
|
export { WritebackConsumer } from "./writeback-consumer.js";
|
|
9
9
|
export type { WritebackHandler, WritebackConsumerOptions } from "./writeback-consumer.js";
|
|
10
|
+
export * from "./integration-adapter.js";
|
package/dist/index.js
CHANGED
|
@@ -4,3 +4,4 @@ export { InvalidStateError, PayloadTooLargeError, QueueFullError, RelayFileApiEr
|
|
|
4
4
|
// Integration providers
|
|
5
5
|
export { IntegrationProvider, computeCanonicalPath } from "./provider.js";
|
|
6
6
|
export { WritebackConsumer } from "./writeback-consumer.js";
|
|
7
|
+
export * from "./integration-adapter.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { RelayFileClient } from "./client.js";
|
|
2
|
+
import type { ConnectionProvider } from "./connection.js";
|
|
3
|
+
import type { FileSemantics } from "./types.js";
|
|
4
|
+
export interface AdapterWebhookMetadata {
|
|
5
|
+
deliveryId?: string;
|
|
6
|
+
delivery_id?: string;
|
|
7
|
+
timestamp?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface AdapterWebhook {
|
|
11
|
+
provider: string;
|
|
12
|
+
connectionId?: string;
|
|
13
|
+
eventType: string;
|
|
14
|
+
objectType: string;
|
|
15
|
+
objectId: string;
|
|
16
|
+
payload: Record<string, unknown>;
|
|
17
|
+
metadata?: AdapterWebhookMetadata;
|
|
18
|
+
raw?: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface IngestError {
|
|
21
|
+
path: string;
|
|
22
|
+
error: string;
|
|
23
|
+
}
|
|
24
|
+
export interface IngestResult {
|
|
25
|
+
filesWritten: number;
|
|
26
|
+
filesUpdated: number;
|
|
27
|
+
filesDeleted: number;
|
|
28
|
+
paths: string[];
|
|
29
|
+
errors: IngestError[];
|
|
30
|
+
}
|
|
31
|
+
export interface SyncOptions {
|
|
32
|
+
cursor?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
export interface SyncResult {
|
|
38
|
+
filesWritten: number;
|
|
39
|
+
filesUpdated: number;
|
|
40
|
+
filesDeleted: number;
|
|
41
|
+
paths?: string[];
|
|
42
|
+
cursor?: string;
|
|
43
|
+
nextCursor?: string | null;
|
|
44
|
+
syncedObjectTypes?: string[];
|
|
45
|
+
errors: Array<{
|
|
46
|
+
path?: string;
|
|
47
|
+
objectType?: string;
|
|
48
|
+
error: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
export declare abstract class IntegrationAdapter {
|
|
52
|
+
protected readonly client: RelayFileClient;
|
|
53
|
+
protected readonly provider: ConnectionProvider;
|
|
54
|
+
abstract readonly name: string;
|
|
55
|
+
abstract readonly version: string;
|
|
56
|
+
constructor(client: RelayFileClient, provider: ConnectionProvider);
|
|
57
|
+
abstract ingestWebhook(workspaceId: string, event: AdapterWebhook): Promise<IngestResult>;
|
|
58
|
+
abstract computePath(objectType: string, objectId: string): string;
|
|
59
|
+
abstract computeSemantics(objectType: string, objectId: string, payload: Record<string, unknown>): FileSemantics;
|
|
60
|
+
supportedEvents?(): string[];
|
|
61
|
+
writeBack?(workspaceId: string, path: string, content: string): Promise<unknown>;
|
|
62
|
+
sync?(workspaceId: string, options?: SyncOptions): Promise<SyncResult>;
|
|
63
|
+
}
|