@lifestreamdynamics/vault-sdk 1.0.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/LICENSE +21 -0
- package/README.md +1121 -0
- package/dist/client.d.ts +143 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +286 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +28 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +49 -0
- package/dist/errors.js.map +1 -0
- package/dist/handle-error.d.ts +8 -0
- package/dist/handle-error.d.ts.map +1 -0
- package/dist/handle-error.js +35 -0
- package/dist/handle-error.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/audit-logger.d.ts +29 -0
- package/dist/lib/audit-logger.d.ts.map +1 -0
- package/dist/lib/audit-logger.js +99 -0
- package/dist/lib/audit-logger.js.map +1 -0
- package/dist/lib/encryption.d.ts +34 -0
- package/dist/lib/encryption.d.ts.map +1 -0
- package/dist/lib/encryption.js +87 -0
- package/dist/lib/encryption.js.map +1 -0
- package/dist/lib/signature.d.ts +47 -0
- package/dist/lib/signature.d.ts.map +1 -0
- package/dist/lib/signature.js +71 -0
- package/dist/lib/signature.js.map +1 -0
- package/dist/lib/token-manager.d.ts +80 -0
- package/dist/lib/token-manager.d.ts.map +1 -0
- package/dist/lib/token-manager.js +116 -0
- package/dist/lib/token-manager.js.map +1 -0
- package/dist/resources/admin.d.ts +280 -0
- package/dist/resources/admin.d.ts.map +1 -0
- package/dist/resources/admin.js +236 -0
- package/dist/resources/admin.js.map +1 -0
- package/dist/resources/ai.d.ts +184 -0
- package/dist/resources/ai.d.ts.map +1 -0
- package/dist/resources/ai.js +179 -0
- package/dist/resources/ai.js.map +1 -0
- package/dist/resources/api-keys.d.ts +172 -0
- package/dist/resources/api-keys.d.ts.map +1 -0
- package/dist/resources/api-keys.js +166 -0
- package/dist/resources/api-keys.js.map +1 -0
- package/dist/resources/connectors.d.ts +263 -0
- package/dist/resources/connectors.d.ts.map +1 -0
- package/dist/resources/connectors.js +226 -0
- package/dist/resources/connectors.js.map +1 -0
- package/dist/resources/documents.d.ts +334 -0
- package/dist/resources/documents.d.ts.map +1 -0
- package/dist/resources/documents.js +377 -0
- package/dist/resources/documents.js.map +1 -0
- package/dist/resources/hooks.d.ts +195 -0
- package/dist/resources/hooks.d.ts.map +1 -0
- package/dist/resources/hooks.js +166 -0
- package/dist/resources/hooks.js.map +1 -0
- package/dist/resources/publish.d.ts +165 -0
- package/dist/resources/publish.d.ts.map +1 -0
- package/dist/resources/publish.js +150 -0
- package/dist/resources/publish.js.map +1 -0
- package/dist/resources/search.d.ts +94 -0
- package/dist/resources/search.d.ts.map +1 -0
- package/dist/resources/search.js +76 -0
- package/dist/resources/search.js.map +1 -0
- package/dist/resources/shares.d.ts +130 -0
- package/dist/resources/shares.d.ts.map +1 -0
- package/dist/resources/shares.js +115 -0
- package/dist/resources/shares.js.map +1 -0
- package/dist/resources/subscription.d.ts +172 -0
- package/dist/resources/subscription.d.ts.map +1 -0
- package/dist/resources/subscription.js +166 -0
- package/dist/resources/subscription.js.map +1 -0
- package/dist/resources/teams.d.ts +356 -0
- package/dist/resources/teams.d.ts.map +1 -0
- package/dist/resources/teams.js +395 -0
- package/dist/resources/teams.js.map +1 -0
- package/dist/resources/user.d.ts +92 -0
- package/dist/resources/user.d.ts.map +1 -0
- package/dist/resources/user.js +64 -0
- package/dist/resources/user.js.map +1 -0
- package/dist/resources/vaults.d.ts +144 -0
- package/dist/resources/vaults.d.ts.map +1 -0
- package/dist/resources/vaults.js +158 -0
- package/dist/resources/vaults.js.map +1 -0
- package/dist/resources/webhooks.d.ts +187 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +171 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/types/api.d.ts +17 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +2 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/resources.d.ts +5 -0
- package/dist/types/resources.d.ts.map +1 -0
- package/dist/types/resources.js +2 -0
- package/dist/types/resources.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { handleError } from '../handle-error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resource for managing API keys.
|
|
4
|
+
*
|
|
5
|
+
* API keys provide programmatic access to the Lifestream Vault API.
|
|
6
|
+
* Keys can be scoped to specific permissions and optionally restricted
|
|
7
|
+
* to a single vault.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const keys = await client.apiKeys.list();
|
|
12
|
+
* const newKey = await client.apiKeys.create({
|
|
13
|
+
* name: 'CI/CD Key',
|
|
14
|
+
* scopes: ['read', 'write'],
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export class ApiKeysResource {
|
|
19
|
+
http;
|
|
20
|
+
constructor(http) {
|
|
21
|
+
this.http = http;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Lists all API keys for the authenticated user.
|
|
25
|
+
*
|
|
26
|
+
* Returns key metadata without secrets. Use this to audit existing keys
|
|
27
|
+
* or find keys to update/revoke.
|
|
28
|
+
*
|
|
29
|
+
* @returns Array of API key objects (without secrets)
|
|
30
|
+
* @throws {AuthenticationError} If not authenticated
|
|
31
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const keys = await client.apiKeys.list();
|
|
36
|
+
* for (const key of keys) {
|
|
37
|
+
* console.log(key.name, key.prefix, key.isActive);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
async list() {
|
|
42
|
+
try {
|
|
43
|
+
const data = await this.http.get('api-keys').json();
|
|
44
|
+
return data.apiKeys;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw await handleError(error, 'API keys', '');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves a specific API key by ID.
|
|
52
|
+
*
|
|
53
|
+
* @param keyId - The unique identifier of the API key
|
|
54
|
+
* @returns The API key object (without secret)
|
|
55
|
+
* @throws {NotFoundError} If no API key exists with the given ID
|
|
56
|
+
* @throws {AuthenticationError} If not authenticated
|
|
57
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const key = await client.apiKeys.get('key-uuid');
|
|
62
|
+
* console.log(key.name, key.scopes);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
async get(keyId) {
|
|
66
|
+
try {
|
|
67
|
+
const data = await this.http.get(`api-keys/${keyId}`).json();
|
|
68
|
+
return data.apiKey;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw await handleError(error, 'API key', keyId);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Creates a new API key.
|
|
76
|
+
*
|
|
77
|
+
* The full key string (including secret) is only returned on creation.
|
|
78
|
+
* Store it securely — it cannot be retrieved later.
|
|
79
|
+
*
|
|
80
|
+
* @param params - API key creation parameters
|
|
81
|
+
* @param params.name - Human-readable name for the key
|
|
82
|
+
* @param params.scopes - Permission scopes to grant
|
|
83
|
+
* @param params.vaultId - Optional vault ID to restrict the key to
|
|
84
|
+
* @param params.expiresAt - Optional ISO 8601 expiration date
|
|
85
|
+
* @returns API key object including the full key string
|
|
86
|
+
* @throws {ValidationError} If parameters are invalid
|
|
87
|
+
* @throws {AuthenticationError} If not authenticated
|
|
88
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const apiKey = await client.apiKeys.create({
|
|
93
|
+
* name: 'Production Key',
|
|
94
|
+
* scopes: ['read', 'write'],
|
|
95
|
+
* vaultId: 'vault-123',
|
|
96
|
+
* expiresAt: '2027-01-01T00:00:00Z',
|
|
97
|
+
* });
|
|
98
|
+
* console.log('Save this key:', apiKey.key);
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
async create(params) {
|
|
102
|
+
try {
|
|
103
|
+
return await this.http.post('api-keys', { json: params }).json();
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw await handleError(error, 'API key', params.name);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Updates an existing API key.
|
|
111
|
+
*
|
|
112
|
+
* Only the provided fields are modified; omitted fields remain unchanged.
|
|
113
|
+
*
|
|
114
|
+
* @param keyId - The unique identifier of the API key to update
|
|
115
|
+
* @param params - Fields to update
|
|
116
|
+
* @param params.name - New name for the key
|
|
117
|
+
* @param params.isActive - Whether the key should be active
|
|
118
|
+
* @returns The updated API key object
|
|
119
|
+
* @throws {ValidationError} If parameters are invalid
|
|
120
|
+
* @throws {NotFoundError} If no API key exists with the given ID
|
|
121
|
+
* @throws {AuthenticationError} If not authenticated
|
|
122
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const updated = await client.apiKeys.update('key-uuid', {
|
|
127
|
+
* name: 'Renamed Key',
|
|
128
|
+
* isActive: false,
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
async update(keyId, params) {
|
|
133
|
+
try {
|
|
134
|
+
const data = await this.http.patch(`api-keys/${keyId}`, { json: params }).json();
|
|
135
|
+
return data.apiKey;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
throw await handleError(error, 'API key', keyId);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Deletes an API key permanently.
|
|
143
|
+
*
|
|
144
|
+
* Once deleted, the key can no longer be used for authentication.
|
|
145
|
+
* This action is irreversible.
|
|
146
|
+
*
|
|
147
|
+
* @param keyId - The unique identifier of the API key to delete
|
|
148
|
+
* @throws {NotFoundError} If no API key exists with the given ID
|
|
149
|
+
* @throws {AuthenticationError} If not authenticated
|
|
150
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* await client.apiKeys.delete('key-uuid');
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
async delete(keyId) {
|
|
158
|
+
try {
|
|
159
|
+
await this.http.delete(`api-keys/${keyId}`);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
throw await handleError(error, 'API key', keyId);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=api-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAoDjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,eAAe;IACN;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,EAAyB,CAAC;YAC3E,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,E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CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,KAAK,EAAE,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import type { KyInstance } from 'ky';
|
|
2
|
+
/** Supported connector providers. */
|
|
3
|
+
export type ConnectorProvider = 'google_drive';
|
|
4
|
+
/** Sync direction for a connector. */
|
|
5
|
+
export type SyncDirection = 'pull' | 'push' | 'bidirectional';
|
|
6
|
+
/** Current status of a connector. */
|
|
7
|
+
export type ConnectorStatus = 'inactive' | 'active' | 'syncing' | 'error';
|
|
8
|
+
/** A connector object returned by the API. */
|
|
9
|
+
export interface Connector {
|
|
10
|
+
/** Unique connector identifier. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** User ID of the connector owner. */
|
|
13
|
+
userId: string;
|
|
14
|
+
/** Vault ID the connector is associated with. */
|
|
15
|
+
vaultId: string;
|
|
16
|
+
/** Connector provider type. */
|
|
17
|
+
provider: ConnectorProvider;
|
|
18
|
+
/** Display name for the connector. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Provider-specific configuration (sensitive fields stripped). */
|
|
21
|
+
config: Record<string, unknown>;
|
|
22
|
+
/** Direction of synchronization. */
|
|
23
|
+
syncDirection: SyncDirection;
|
|
24
|
+
/** Optional path prefix for syncing. */
|
|
25
|
+
syncPath: string | null;
|
|
26
|
+
/** ISO 8601 timestamp of the last successful sync, or null if never synced. */
|
|
27
|
+
lastSyncAt: string | null;
|
|
28
|
+
/** Current connector status. */
|
|
29
|
+
status: ConnectorStatus;
|
|
30
|
+
/** Whether the connector is active. */
|
|
31
|
+
isActive: boolean;
|
|
32
|
+
/** ISO 8601 creation timestamp. */
|
|
33
|
+
createdAt: string;
|
|
34
|
+
/** ISO 8601 last-updated timestamp. */
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
/** A sync log entry for a connector. */
|
|
38
|
+
export interface ConnectorSyncLog {
|
|
39
|
+
/** Unique log entry identifier. */
|
|
40
|
+
id: string;
|
|
41
|
+
/** ID of the connector this log belongs to. */
|
|
42
|
+
connectorId: string;
|
|
43
|
+
/** Sync status (e.g., 'success', 'error'). */
|
|
44
|
+
status: string;
|
|
45
|
+
/** Number of files added during sync. */
|
|
46
|
+
filesAdded: number;
|
|
47
|
+
/** Number of files updated during sync. */
|
|
48
|
+
filesUpdated: number;
|
|
49
|
+
/** Number of files deleted during sync. */
|
|
50
|
+
filesDeleted: number;
|
|
51
|
+
/** Array of error details, or null if no errors. */
|
|
52
|
+
errors: Record<string, unknown>[] | null;
|
|
53
|
+
/** Duration of the sync in milliseconds, or null. */
|
|
54
|
+
durationMs: number | null;
|
|
55
|
+
/** ISO 8601 timestamp when the sync occurred. */
|
|
56
|
+
createdAt: string;
|
|
57
|
+
}
|
|
58
|
+
/** Parameters for creating a new connector. */
|
|
59
|
+
export interface CreateConnectorParams {
|
|
60
|
+
/** Connector provider type. */
|
|
61
|
+
provider: ConnectorProvider;
|
|
62
|
+
/** Display name for the connector. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Vault ID to associate the connector with. */
|
|
65
|
+
vaultId: string;
|
|
66
|
+
/** Direction of synchronization. */
|
|
67
|
+
syncDirection: SyncDirection;
|
|
68
|
+
/** Optional path prefix for syncing. */
|
|
69
|
+
syncPath?: string;
|
|
70
|
+
/** Provider-specific configuration. */
|
|
71
|
+
config?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
/** Parameters for updating an existing connector. */
|
|
74
|
+
export interface UpdateConnectorParams {
|
|
75
|
+
/** New display name. */
|
|
76
|
+
name?: string;
|
|
77
|
+
/** New sync direction. */
|
|
78
|
+
syncDirection?: SyncDirection;
|
|
79
|
+
/** New sync path, or `null` to clear. */
|
|
80
|
+
syncPath?: string | null;
|
|
81
|
+
/** Updated provider configuration. */
|
|
82
|
+
config?: Record<string, unknown>;
|
|
83
|
+
/** Whether the connector is active. */
|
|
84
|
+
isActive?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Result of testing a connector's connection. */
|
|
87
|
+
export interface TestConnectionResult {
|
|
88
|
+
/** Whether the connection test succeeded. */
|
|
89
|
+
success: boolean;
|
|
90
|
+
/** Error message if the test failed. */
|
|
91
|
+
error?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Result of triggering a connector sync. */
|
|
94
|
+
export interface TriggerSyncResult {
|
|
95
|
+
/** Confirmation message. */
|
|
96
|
+
message: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resource for managing external connectors (e.g., Google Drive).
|
|
100
|
+
*
|
|
101
|
+
* Connectors allow bidirectional synchronization between vaults and
|
|
102
|
+
* external storage providers. Requires the `connectors` plan feature.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const connectors = await client.connectors.list();
|
|
107
|
+
* const connector = await client.connectors.create({
|
|
108
|
+
* provider: 'google_drive',
|
|
109
|
+
* name: 'My Drive',
|
|
110
|
+
* vaultId: 'vault-uuid',
|
|
111
|
+
* syncDirection: 'bidirectional',
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare class ConnectorsResource {
|
|
116
|
+
private http;
|
|
117
|
+
constructor(http: KyInstance);
|
|
118
|
+
/**
|
|
119
|
+
* Lists all connectors for the authenticated user.
|
|
120
|
+
*
|
|
121
|
+
* @param vaultId - Optional vault ID to filter connectors by
|
|
122
|
+
* @returns Array of connector objects
|
|
123
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
124
|
+
* @throws {AuthorizationError} If the user's plan does not include connectors
|
|
125
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const connectors = await client.connectors.list();
|
|
130
|
+
* const vaultConnectors = await client.connectors.list('vault-uuid');
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
list(vaultId?: string): Promise<Connector[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Retrieves a single connector by ID.
|
|
136
|
+
*
|
|
137
|
+
* @param connectorId - The unique identifier of the connector
|
|
138
|
+
* @returns The connector object
|
|
139
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
140
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
141
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* const connector = await client.connectors.get('connector-uuid');
|
|
146
|
+
* console.log(connector.name, connector.status);
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
get(connectorId: string): Promise<Connector>;
|
|
150
|
+
/**
|
|
151
|
+
* Creates a new connector.
|
|
152
|
+
*
|
|
153
|
+
* @param params - Connector creation parameters
|
|
154
|
+
* @returns The newly created connector object
|
|
155
|
+
* @throws {ValidationError} If the request body is invalid
|
|
156
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
157
|
+
* @throws {AuthorizationError} If the user's plan does not include connectors
|
|
158
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const connector = await client.connectors.create({
|
|
163
|
+
* provider: 'google_drive',
|
|
164
|
+
* name: 'Work Drive',
|
|
165
|
+
* vaultId: 'vault-uuid',
|
|
166
|
+
* syncDirection: 'bidirectional',
|
|
167
|
+
* });
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
create(params: CreateConnectorParams): Promise<Connector>;
|
|
171
|
+
/**
|
|
172
|
+
* Updates an existing connector.
|
|
173
|
+
*
|
|
174
|
+
* Only the provided fields are modified; omitted fields remain unchanged.
|
|
175
|
+
*
|
|
176
|
+
* @param connectorId - The unique identifier of the connector to update
|
|
177
|
+
* @param params - Fields to update
|
|
178
|
+
* @returns The updated connector object
|
|
179
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
180
|
+
* @throws {ValidationError} If the update parameters are invalid
|
|
181
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
182
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* const updated = await client.connectors.update('connector-uuid', {
|
|
187
|
+
* name: 'Renamed Drive',
|
|
188
|
+
* syncDirection: 'pull',
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
update(connectorId: string, params: UpdateConnectorParams): Promise<Connector>;
|
|
193
|
+
/**
|
|
194
|
+
* Permanently deletes a connector.
|
|
195
|
+
*
|
|
196
|
+
* @param connectorId - The unique identifier of the connector to delete
|
|
197
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
198
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
199
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* await client.connectors.delete('connector-uuid');
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
delete(connectorId: string): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Tests a connector's connection to the external provider.
|
|
209
|
+
*
|
|
210
|
+
* @param connectorId - The unique identifier of the connector to test
|
|
211
|
+
* @returns Object indicating success or failure with optional error message
|
|
212
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
213
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
214
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const result = await client.connectors.test('connector-uuid');
|
|
219
|
+
* if (result.success) {
|
|
220
|
+
* console.log('Connection works!');
|
|
221
|
+
* } else {
|
|
222
|
+
* console.error('Connection failed:', result.error);
|
|
223
|
+
* }
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
test(connectorId: string): Promise<TestConnectionResult>;
|
|
227
|
+
/**
|
|
228
|
+
* Triggers a sync for a connector. The sync runs asynchronously via a background worker.
|
|
229
|
+
*
|
|
230
|
+
* @param connectorId - The unique identifier of the connector to sync
|
|
231
|
+
* @returns Object with a confirmation message
|
|
232
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
233
|
+
* @throws {ValidationError} If the connector is inactive
|
|
234
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
235
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const result = await client.connectors.sync('connector-uuid');
|
|
240
|
+
* console.log(result.message); // 'Sync triggered successfully'
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
sync(connectorId: string): Promise<TriggerSyncResult>;
|
|
244
|
+
/**
|
|
245
|
+
* Retrieves recent sync logs for a connector.
|
|
246
|
+
*
|
|
247
|
+
* @param connectorId - The unique identifier of the connector
|
|
248
|
+
* @returns Array of sync log entries, ordered by most recent first
|
|
249
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
250
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
251
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* const logs = await client.connectors.logs('connector-uuid');
|
|
256
|
+
* for (const log of logs) {
|
|
257
|
+
* console.log(`${log.status}: +${log.filesAdded} ~${log.filesUpdated} -${log.filesDeleted}`);
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
logs(connectorId: string): Promise<ConnectorSyncLog[]>;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=connectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../src/resources/connectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGrC,qCAAqC;AACrC,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C,sCAAsC;AACtC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;AAE9D,qCAAqC;AACrC,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1E,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,oCAAoC;IACpC,aAAa,EAAE,aAAa,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wCAAwC;AACxC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* Resource for managing external connectors (e.g., Google Drive).
|
|
4
|
+
*
|
|
5
|
+
* Connectors allow bidirectional synchronization between vaults and
|
|
6
|
+
* external storage providers. Requires the `connectors` plan feature.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const connectors = await client.connectors.list();
|
|
11
|
+
* const connector = await client.connectors.create({
|
|
12
|
+
* provider: 'google_drive',
|
|
13
|
+
* name: 'My Drive',
|
|
14
|
+
* vaultId: 'vault-uuid',
|
|
15
|
+
* syncDirection: 'bidirectional',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class ConnectorsResource {
|
|
20
|
+
http;
|
|
21
|
+
constructor(http) {
|
|
22
|
+
this.http = http;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lists all connectors for the authenticated user.
|
|
26
|
+
*
|
|
27
|
+
* @param vaultId - Optional vault ID to filter connectors by
|
|
28
|
+
* @returns Array of connector objects
|
|
29
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
30
|
+
* @throws {AuthorizationError} If the user's plan does not include connectors
|
|
31
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const connectors = await client.connectors.list();
|
|
36
|
+
* const vaultConnectors = await client.connectors.list('vault-uuid');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
async list(vaultId) {
|
|
40
|
+
try {
|
|
41
|
+
const searchParams = vaultId ? { vaultId } : undefined;
|
|
42
|
+
return await this.http.get('connectors', { searchParams }).json();
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throw await handleError(error, 'Connectors', '');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves a single connector by ID.
|
|
50
|
+
*
|
|
51
|
+
* @param connectorId - The unique identifier of the connector
|
|
52
|
+
* @returns The connector object
|
|
53
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
54
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
55
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const connector = await client.connectors.get('connector-uuid');
|
|
60
|
+
* console.log(connector.name, connector.status);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
async get(connectorId) {
|
|
64
|
+
try {
|
|
65
|
+
return await this.http.get(`connectors/${connectorId}`).json();
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw await handleError(error, 'Connector', connectorId);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new connector.
|
|
73
|
+
*
|
|
74
|
+
* @param params - Connector creation parameters
|
|
75
|
+
* @returns The newly created connector object
|
|
76
|
+
* @throws {ValidationError} If the request body is invalid
|
|
77
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
78
|
+
* @throws {AuthorizationError} If the user's plan does not include connectors
|
|
79
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const connector = await client.connectors.create({
|
|
84
|
+
* provider: 'google_drive',
|
|
85
|
+
* name: 'Work Drive',
|
|
86
|
+
* vaultId: 'vault-uuid',
|
|
87
|
+
* syncDirection: 'bidirectional',
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
async create(params) {
|
|
92
|
+
try {
|
|
93
|
+
return await this.http.post('connectors', { json: params }).json();
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw await handleError(error, 'Connector', params.name);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Updates an existing connector.
|
|
101
|
+
*
|
|
102
|
+
* Only the provided fields are modified; omitted fields remain unchanged.
|
|
103
|
+
*
|
|
104
|
+
* @param connectorId - The unique identifier of the connector to update
|
|
105
|
+
* @param params - Fields to update
|
|
106
|
+
* @returns The updated connector object
|
|
107
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
108
|
+
* @throws {ValidationError} If the update parameters are invalid
|
|
109
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
110
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const updated = await client.connectors.update('connector-uuid', {
|
|
115
|
+
* name: 'Renamed Drive',
|
|
116
|
+
* syncDirection: 'pull',
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
async update(connectorId, params) {
|
|
121
|
+
try {
|
|
122
|
+
return await this.http.put(`connectors/${connectorId}`, { json: params }).json();
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
throw await handleError(error, 'Connector', connectorId);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Permanently deletes a connector.
|
|
130
|
+
*
|
|
131
|
+
* @param connectorId - The unique identifier of the connector to delete
|
|
132
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
133
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
134
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* await client.connectors.delete('connector-uuid');
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
async delete(connectorId) {
|
|
142
|
+
try {
|
|
143
|
+
await this.http.delete(`connectors/${connectorId}`);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
throw await handleError(error, 'Connector', connectorId);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Tests a connector's connection to the external provider.
|
|
151
|
+
*
|
|
152
|
+
* @param connectorId - The unique identifier of the connector to test
|
|
153
|
+
* @returns Object indicating success or failure with optional error message
|
|
154
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
155
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
156
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const result = await client.connectors.test('connector-uuid');
|
|
161
|
+
* if (result.success) {
|
|
162
|
+
* console.log('Connection works!');
|
|
163
|
+
* } else {
|
|
164
|
+
* console.error('Connection failed:', result.error);
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
async test(connectorId) {
|
|
169
|
+
try {
|
|
170
|
+
return await this.http.post(`connectors/${connectorId}/test`).json();
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
throw await handleError(error, 'Connector', connectorId);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Triggers a sync for a connector. The sync runs asynchronously via a background worker.
|
|
178
|
+
*
|
|
179
|
+
* @param connectorId - The unique identifier of the connector to sync
|
|
180
|
+
* @returns Object with a confirmation message
|
|
181
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
182
|
+
* @throws {ValidationError} If the connector is inactive
|
|
183
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
184
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const result = await client.connectors.sync('connector-uuid');
|
|
189
|
+
* console.log(result.message); // 'Sync triggered successfully'
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
async sync(connectorId) {
|
|
193
|
+
try {
|
|
194
|
+
return await this.http.post(`connectors/${connectorId}/sync`).json();
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
throw await handleError(error, 'Connector', connectorId);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Retrieves recent sync logs for a connector.
|
|
202
|
+
*
|
|
203
|
+
* @param connectorId - The unique identifier of the connector
|
|
204
|
+
* @returns Array of sync log entries, ordered by most recent first
|
|
205
|
+
* @throws {NotFoundError} If no connector exists with the given ID
|
|
206
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
207
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const logs = await client.connectors.logs('connector-uuid');
|
|
212
|
+
* for (const log of logs) {
|
|
213
|
+
* console.log(`${log.status}: +${log.filesAdded} ~${log.filesUpdated} -${log.filesDeleted}`);
|
|
214
|
+
* }
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
async logs(connectorId) {
|
|
218
|
+
try {
|
|
219
|
+
return await this.http.get(`connectors/${connectorId}/logs`).json();
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
throw await handleError(error, 'Connector', connectorId);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=connectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.js","sourceRoot":"","sources":["../../src/resources/connectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA2GjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,kBAAkB;IACT;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,IAAI,CAAC,OAAgB;QACzB,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACvD,OAAO,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