@lifestreamdynamics/vault-sdk 1.0.0 → 1.1.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/README.md +146 -40
- package/dist/client.d.ts +66 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +129 -15
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/calendar.d.ts +208 -0
- package/dist/resources/calendar.d.ts.map +1 -0
- package/dist/resources/calendar.js +205 -0
- package/dist/resources/calendar.js.map +1 -0
- package/dist/resources/documents.d.ts +63 -0
- package/dist/resources/documents.d.ts.map +1 -1
- package/dist/resources/documents.js +55 -0
- package/dist/resources/documents.js.map +1 -1
- package/dist/resources/mfa.d.ts +190 -0
- package/dist/resources/mfa.d.ts.map +1 -0
- package/dist/resources/mfa.js +249 -0
- package/dist/resources/mfa.js.map +1 -0
- package/dist/resources/search.d.ts +13 -0
- package/dist/resources/search.d.ts.map +1 -1
- package/dist/resources/search.js +12 -0
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/subscription.d.ts +1 -1
- package/dist/resources/subscription.d.ts.map +1 -1
- package/dist/resources/vaults.d.ts +73 -0
- package/dist/resources/vaults.d.ts.map +1 -1
- package/dist/resources/vaults.js +59 -0
- package/dist/resources/vaults.js.map +1 -1
- package/dist/types/api.d.ts +50 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/api.js +4 -1
- package/dist/types/api.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources.d.ts +2 -2
- package/dist/types/resources.d.ts.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { handleError } from '../handle-error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resource for managing multi-factor authentication (MFA).
|
|
4
|
+
*
|
|
5
|
+
* Supports TOTP (Time-based One-Time Password) via authenticator apps,
|
|
6
|
+
* passkeys (WebAuthn), and backup codes for account recovery.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Check current MFA status
|
|
11
|
+
* const status = await client.mfa.getStatus();
|
|
12
|
+
* if (!status.totpConfigured) {
|
|
13
|
+
* // Set up TOTP
|
|
14
|
+
* const setup = await client.mfa.setupTotp();
|
|
15
|
+
* console.log('Scan QR code:', setup.qrCodeDataUri);
|
|
16
|
+
* // Verify with code from authenticator app
|
|
17
|
+
* const { backupCodes } = await client.mfa.verifyTotp('123456');
|
|
18
|
+
* console.log('Save these backup codes:', backupCodes);
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class MfaResource {
|
|
23
|
+
http;
|
|
24
|
+
constructor(http) {
|
|
25
|
+
this.http = http;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves the current MFA status for the authenticated user.
|
|
29
|
+
*
|
|
30
|
+
* @returns MFA status including TOTP configuration, passkey count, and backup codes remaining
|
|
31
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
32
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const status = await client.mfa.getStatus();
|
|
37
|
+
* console.log('MFA enabled:', status.mfaEnabled);
|
|
38
|
+
* console.log('TOTP configured:', status.totpConfigured);
|
|
39
|
+
* console.log('Passkeys registered:', status.passkeyCount);
|
|
40
|
+
* console.log('Backup codes remaining:', status.backupCodesRemaining);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
async getStatus() {
|
|
44
|
+
try {
|
|
45
|
+
return await this.http.get('account/mfa/status').json();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw await handleError(error, 'MFA Status');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Initiates TOTP (authenticator app) setup.
|
|
53
|
+
*
|
|
54
|
+
* Returns a secret key, OTP auth URI, and QR code data URI that can be
|
|
55
|
+
* scanned by authenticator apps like Google Authenticator, Authy, or 1Password.
|
|
56
|
+
* TOTP is not enabled until you call {@link verifyTotp} with a valid code.
|
|
57
|
+
*
|
|
58
|
+
* @returns TOTP setup data including secret, OTP auth URI, and QR code
|
|
59
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
60
|
+
* @throws {ConflictError} If TOTP is already configured
|
|
61
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const setup = await client.mfa.setupTotp();
|
|
66
|
+
* console.log('Secret:', setup.secret);
|
|
67
|
+
* console.log('URI:', setup.otpauthUri);
|
|
68
|
+
* // Display QR code to user
|
|
69
|
+
* document.querySelector('img').src = setup.qrCodeDataUri;
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async setupTotp() {
|
|
73
|
+
try {
|
|
74
|
+
return await this.http.post('account/mfa/totp/setup').json();
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
throw await handleError(error, 'TOTP Setup');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Verifies TOTP setup with a code from the authenticator app.
|
|
82
|
+
*
|
|
83
|
+
* Once verified, TOTP is enabled and backup codes are generated.
|
|
84
|
+
* **Save the backup codes immediately** — they are only shown once.
|
|
85
|
+
*
|
|
86
|
+
* @param code - 6-digit code from the authenticator app
|
|
87
|
+
* @returns Backup codes for account recovery (store securely)
|
|
88
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
89
|
+
* @throws {ValidationError} If the code is invalid or expired
|
|
90
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const { backupCodes } = await client.mfa.verifyTotp('123456');
|
|
95
|
+
* console.log('Backup codes:', backupCodes);
|
|
96
|
+
* // Store backup codes securely!
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async verifyTotp(code) {
|
|
100
|
+
try {
|
|
101
|
+
return await this.http
|
|
102
|
+
.post('account/mfa/totp/verify', { json: { code } })
|
|
103
|
+
.json();
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw await handleError(error, 'TOTP Verification');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Disables TOTP authentication.
|
|
111
|
+
*
|
|
112
|
+
* Requires the user's password for security. After disabling TOTP,
|
|
113
|
+
* MFA may still be enabled if passkeys are registered.
|
|
114
|
+
*
|
|
115
|
+
* @param password - The user's current password
|
|
116
|
+
* @throws {AuthenticationError} If the request is not authenticated or password is incorrect
|
|
117
|
+
* @throws {ValidationError} If the password is invalid
|
|
118
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* await client.mfa.disableTotp('my-secure-password');
|
|
123
|
+
* console.log('TOTP disabled');
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
async disableTotp(password) {
|
|
127
|
+
try {
|
|
128
|
+
return await this.http
|
|
129
|
+
.delete('account/mfa/totp', { json: { password } })
|
|
130
|
+
.json();
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
throw await handleError(error, 'TOTP Disable');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Lists all registered passkeys for the authenticated user.
|
|
138
|
+
*
|
|
139
|
+
* @returns Array of passkey metadata including ID, name, and last used timestamp
|
|
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 { passkeys } = await client.mfa.listPasskeys();
|
|
146
|
+
* for (const pk of passkeys) {
|
|
147
|
+
* console.log(`${pk.name} (created ${pk.createdAt}, last used ${pk.lastUsedAt || 'never'})`);
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
async listPasskeys() {
|
|
152
|
+
try {
|
|
153
|
+
return await this.http.get('account/mfa/passkeys').json();
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
throw await handleError(error, 'Passkey List');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Deletes a registered passkey.
|
|
161
|
+
*
|
|
162
|
+
* Requires password confirmation if it's the user's last MFA method
|
|
163
|
+
* (to prevent account lockout).
|
|
164
|
+
*
|
|
165
|
+
* @param id - Passkey ID to delete
|
|
166
|
+
* @param password - User password (required if this is the last MFA method)
|
|
167
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
168
|
+
* @throws {NotFoundError} If the passkey does not exist
|
|
169
|
+
* @throws {ValidationError} If password is required but not provided
|
|
170
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* await client.mfa.deletePasskey('passkey-id-123');
|
|
175
|
+
* console.log('Passkey deleted');
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
async deletePasskey(id, password) {
|
|
179
|
+
try {
|
|
180
|
+
return await this.http
|
|
181
|
+
.delete(`account/mfa/passkeys/${id}`, {
|
|
182
|
+
json: password ? { password } : undefined,
|
|
183
|
+
})
|
|
184
|
+
.json();
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
throw await handleError(error, 'Passkey Deletion', id);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Renames a registered passkey.
|
|
192
|
+
*
|
|
193
|
+
* Useful for identifying devices (e.g., "YubiKey 5", "iPhone 15", "Work Laptop").
|
|
194
|
+
*
|
|
195
|
+
* @param id - Passkey ID to rename
|
|
196
|
+
* @param name - New name for the passkey
|
|
197
|
+
* @returns Updated passkey metadata
|
|
198
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
199
|
+
* @throws {NotFoundError} If the passkey does not exist
|
|
200
|
+
* @throws {ValidationError} If the name is invalid
|
|
201
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* const passkey = await client.mfa.renamePasskey('passkey-id-123', 'YubiKey 5');
|
|
206
|
+
* console.log('Renamed to:', passkey.name);
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
async renamePasskey(id, name) {
|
|
210
|
+
try {
|
|
211
|
+
return await this.http
|
|
212
|
+
.patch(`account/mfa/passkeys/${id}`, { json: { name } })
|
|
213
|
+
.json();
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
throw await handleError(error, 'Passkey Rename', id);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Regenerates backup codes.
|
|
221
|
+
*
|
|
222
|
+
* Invalidates all existing backup codes and generates a new set.
|
|
223
|
+
* Requires password confirmation. **Save the new codes immediately** — they are only shown once.
|
|
224
|
+
*
|
|
225
|
+
* @param password - User's current password
|
|
226
|
+
* @returns New set of backup codes (store securely)
|
|
227
|
+
* @throws {AuthenticationError} If the request is not authenticated or password is incorrect
|
|
228
|
+
* @throws {ValidationError} If the password is invalid
|
|
229
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* const { backupCodes } = await client.mfa.regenerateBackupCodes('my-password');
|
|
234
|
+
* console.log('New backup codes:', backupCodes);
|
|
235
|
+
* // Store backup codes securely!
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
async regenerateBackupCodes(password) {
|
|
239
|
+
try {
|
|
240
|
+
return await this.http
|
|
241
|
+
.post('account/mfa/backup-codes/regenerate', { json: { password } })
|
|
242
|
+
.json();
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
throw await handleError(error, 'Backup Codes Regeneration');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=mfa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa.js","sourceRoot":"","sources":["../../src/resources/mfa.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,SAAS;QACb,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAa,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,SAAS;QACb,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,IAAI,EAAqB,CAAC;QAClF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,UAAU,CAAC,IAAY;QAC3B,IAAI,CAAC;YACH,OAAO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,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,aAAa,CAAC,EAAU,EAAE,IAAY;QAC1C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI;iBACnB,KAAK,CAAC,wBAAwB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;iBACvD,IAAI,EAAe,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,qBAAqB,CAAC,QAAgB;QAC1C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI;iBACnB,IAAI,CAAC,qCAAqC,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC;iBACnE,IAAI,EAA6B,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -28,6 +28,8 @@ export interface SearchResponse {
|
|
|
28
28
|
total: number;
|
|
29
29
|
/** The original query string. */
|
|
30
30
|
query: string;
|
|
31
|
+
/** The search mode used (text/semantic/hybrid). */
|
|
32
|
+
mode?: string;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Resource for full-text search across vaults.
|
|
@@ -59,6 +61,7 @@ export declare class SearchResource {
|
|
|
59
61
|
* @param params.tags - Optional comma-separated tag filter (e.g., `'work,urgent'`)
|
|
60
62
|
* @param params.limit - Maximum number of results to return
|
|
61
63
|
* @param params.offset - Number of results to skip (for pagination)
|
|
64
|
+
* @param params.mode - Search mode: 'text' (full-text), 'semantic' (vector), or 'hybrid' (default: 'text')
|
|
62
65
|
* @returns Search response with matching documents, total count, and the original query
|
|
63
66
|
* @throws {ValidationError} If the query string is empty
|
|
64
67
|
* @throws {AuthenticationError} If the request is not authenticated
|
|
@@ -82,6 +85,15 @@ export declare class SearchResource {
|
|
|
82
85
|
* });
|
|
83
86
|
* console.log(`Showing ${results.results.length} of ${results.total}`);
|
|
84
87
|
* ```
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Semantic search using vector similarity
|
|
92
|
+
* const results = await client.search.search({
|
|
93
|
+
* q: 'documents about machine learning',
|
|
94
|
+
* mode: 'semantic',
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
85
97
|
*/
|
|
86
98
|
search(params: {
|
|
87
99
|
q: string;
|
|
@@ -89,6 +101,7 @@ export declare class SearchResource {
|
|
|
89
101
|
tags?: string;
|
|
90
102
|
limit?: number;
|
|
91
103
|
offset?: number;
|
|
104
|
+
mode?: 'text' | 'semantic' | 'hybrid';
|
|
92
105
|
}): Promise<SearchResponse>;
|
|
93
106
|
}
|
|
94
107
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/resources/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGrC,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,6CAA6C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AC;IACd,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;KACvC,GAAG,OAAO,CAAC,cAAc,CAAC;CAa5B"}
|
package/dist/resources/search.js
CHANGED
|
@@ -31,6 +31,7 @@ export class SearchResource {
|
|
|
31
31
|
* @param params.tags - Optional comma-separated tag filter (e.g., `'work,urgent'`)
|
|
32
32
|
* @param params.limit - Maximum number of results to return
|
|
33
33
|
* @param params.offset - Number of results to skip (for pagination)
|
|
34
|
+
* @param params.mode - Search mode: 'text' (full-text), 'semantic' (vector), or 'hybrid' (default: 'text')
|
|
34
35
|
* @returns Search response with matching documents, total count, and the original query
|
|
35
36
|
* @throws {ValidationError} If the query string is empty
|
|
36
37
|
* @throws {AuthenticationError} If the request is not authenticated
|
|
@@ -54,6 +55,15 @@ export class SearchResource {
|
|
|
54
55
|
* });
|
|
55
56
|
* console.log(`Showing ${results.results.length} of ${results.total}`);
|
|
56
57
|
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Semantic search using vector similarity
|
|
62
|
+
* const results = await client.search.search({
|
|
63
|
+
* q: 'documents about machine learning',
|
|
64
|
+
* mode: 'semantic',
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
57
67
|
*/
|
|
58
68
|
async search(params) {
|
|
59
69
|
try {
|
|
@@ -66,6 +76,8 @@ export class SearchResource {
|
|
|
66
76
|
searchParams.limit = params.limit;
|
|
67
77
|
if (params.offset !== undefined)
|
|
68
78
|
searchParams.offset = params.offset;
|
|
79
|
+
if (params.mode)
|
|
80
|
+
searchParams.mode = params.mode;
|
|
69
81
|
return await this.http.get('search', { searchParams }).json();
|
|
70
82
|
}
|
|
71
83
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/resources/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/resources/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAoCjD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,KAAK,CAAC,MAAM,CAAC,MAOZ;QACC,IAAI,CAAC;YACH,MAAM,YAAY,GAAoC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YACtE,IAAI,MAAM,CAAC,KAAK;gBAAE,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YACpD,IAAI,MAAM,CAAC,IAAI;gBAAE,YAAY,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACjD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;gBAAE,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAClE,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;gBAAE,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACrE,IAAI,MAAM,CAAC,IAAI;gBAAE,YAAY,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACjD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAkB,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/resources/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGrC,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,qCAAqC;IACrC,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/resources/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGrC,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,qCAAqC;IACrC,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,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EAAE,CAAC;IASlC;;;;;;;;;;;;;;;;;;OAkBG;IACG,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAUtF;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5C;;;;;;;;;;;;;;;OAeG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAUpE;;;;;;;;;;;;;;OAcG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAQzC"}
|
|
@@ -16,6 +16,35 @@ export interface Vault {
|
|
|
16
16
|
/** ISO 8601 last-updated timestamp. */
|
|
17
17
|
updatedAt: string;
|
|
18
18
|
}
|
|
19
|
+
/** Node in the vault link graph. */
|
|
20
|
+
export interface LinkGraphNode {
|
|
21
|
+
id: string;
|
|
22
|
+
path: string;
|
|
23
|
+
title: string | null;
|
|
24
|
+
}
|
|
25
|
+
/** Edge in the vault link graph. */
|
|
26
|
+
export interface LinkGraphEdge {
|
|
27
|
+
source: string;
|
|
28
|
+
target: string;
|
|
29
|
+
linkText: string;
|
|
30
|
+
}
|
|
31
|
+
/** Response for the vault link graph endpoint. */
|
|
32
|
+
export interface LinkGraphResponse {
|
|
33
|
+
nodes: LinkGraphNode[];
|
|
34
|
+
edges: LinkGraphEdge[];
|
|
35
|
+
}
|
|
36
|
+
/** A reference to an unresolved (broken) link. */
|
|
37
|
+
export interface UnresolvedLinkReference {
|
|
38
|
+
sourceDocumentId: string;
|
|
39
|
+
sourcePath: string;
|
|
40
|
+
sourceTitle: string | null;
|
|
41
|
+
linkText: string;
|
|
42
|
+
}
|
|
43
|
+
/** An unresolved link grouped by target path. */
|
|
44
|
+
export interface UnresolvedLink {
|
|
45
|
+
targetPath: string;
|
|
46
|
+
references: UnresolvedLinkReference[];
|
|
47
|
+
}
|
|
19
48
|
/**
|
|
20
49
|
* Resource for managing vaults.
|
|
21
50
|
*
|
|
@@ -140,5 +169,49 @@ export declare class VaultsResource {
|
|
|
140
169
|
* ```
|
|
141
170
|
*/
|
|
142
171
|
delete(vaultId: string): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Gets the link graph for a vault showing all document connections.
|
|
174
|
+
*
|
|
175
|
+
* Returns nodes (documents) and edges (wikilinks) that form the vault's
|
|
176
|
+
* bidirectional link graph. Useful for visualization and graph analysis.
|
|
177
|
+
*
|
|
178
|
+
* @param vaultId - The vault ID
|
|
179
|
+
* @returns Nodes (documents) and edges (links) forming the vault's link graph
|
|
180
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
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 graph = await client.vaults.getGraph('vault-uuid');
|
|
187
|
+
* console.log(`${graph.nodes.length} documents, ${graph.edges.length} links`);
|
|
188
|
+
* // Render graph visualization
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
getGraph(vaultId: string): Promise<LinkGraphResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Lists unresolved (broken) links in a vault.
|
|
194
|
+
*
|
|
195
|
+
* Returns wikilinks that point to non-existent documents, grouped by
|
|
196
|
+
* target path. Useful for finding and fixing broken references.
|
|
197
|
+
*
|
|
198
|
+
* @param vaultId - The vault ID
|
|
199
|
+
* @returns Array of unresolved links grouped by target path
|
|
200
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
201
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
202
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* const broken = await client.vaults.getUnresolvedLinks('vault-uuid');
|
|
207
|
+
* for (const link of broken) {
|
|
208
|
+
* console.log(`Missing: ${link.targetPath}`);
|
|
209
|
+
* for (const ref of link.references) {
|
|
210
|
+
* console.log(` Referenced by: ${ref.sourcePath}`);
|
|
211
|
+
* }
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
getUnresolvedLinks(vaultId: string): Promise<UnresolvedLink[]>;
|
|
143
216
|
}
|
|
144
217
|
//# sourceMappingURL=vaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaults.d.ts","sourceRoot":"","sources":["../../src/resources/vaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGrC,0CAA0C;AAC1C,MAAM,WAAW,KAAK;IACpB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gEAAgE;IAChE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC;;;;;;;;;;;;;;OAcG;IACG,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAS9B;;;;;;;;;;;;;;OAcG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAQ1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,OA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;;;;;;;;;;;;;;;;OAsBG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAQrE"}
|
package/dist/resources/vaults.js
CHANGED
|
@@ -154,5 +154,64 @@ export class VaultsResource {
|
|
|
154
154
|
throw await handleError(error, 'Vault', vaultId);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Gets the link graph for a vault showing all document connections.
|
|
159
|
+
*
|
|
160
|
+
* Returns nodes (documents) and edges (wikilinks) that form the vault's
|
|
161
|
+
* bidirectional link graph. Useful for visualization and graph analysis.
|
|
162
|
+
*
|
|
163
|
+
* @param vaultId - The vault ID
|
|
164
|
+
* @returns Nodes (documents) and edges (links) forming the vault's link graph
|
|
165
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
166
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
167
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const graph = await client.vaults.getGraph('vault-uuid');
|
|
172
|
+
* console.log(`${graph.nodes.length} documents, ${graph.edges.length} links`);
|
|
173
|
+
* // Render graph visualization
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
async getGraph(vaultId) {
|
|
177
|
+
try {
|
|
178
|
+
return await this.http.get(`vaults/${vaultId}/links/graph`).json();
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
throw await handleError(error, 'Vault', vaultId);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Lists unresolved (broken) links in a vault.
|
|
186
|
+
*
|
|
187
|
+
* Returns wikilinks that point to non-existent documents, grouped by
|
|
188
|
+
* target path. Useful for finding and fixing broken references.
|
|
189
|
+
*
|
|
190
|
+
* @param vaultId - The vault ID
|
|
191
|
+
* @returns Array of unresolved links grouped by target path
|
|
192
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
193
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
194
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const broken = await client.vaults.getUnresolvedLinks('vault-uuid');
|
|
199
|
+
* for (const link of broken) {
|
|
200
|
+
* console.log(`Missing: ${link.targetPath}`);
|
|
201
|
+
* for (const ref of link.references) {
|
|
202
|
+
* console.log(` Referenced by: ${ref.sourcePath}`);
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
async getUnresolvedLinks(vaultId) {
|
|
208
|
+
try {
|
|
209
|
+
const data = await this.http.get(`vaults/${vaultId}/links/unresolved`).json();
|
|
210
|
+
return data.unresolvedLinks;
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
throw await handleError(error, 'Vault', vaultId);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
157
216
|
}
|
|
158
217
|
//# sourceMappingURL=vaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaults.js","sourceRoot":"","sources":["../../src/resources/vaults.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"vaults.js","sourceRoot":"","sources":["../../src/resources/vaults.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAsDjD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,EAA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AAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAe;QAC5B,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,OAAO,cAAc,CAAC,CAAC,IAAI,EAAqB,CAAC;QACxF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAe;QACtC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,OAAO,mBAAmB,CAAC,CAAC,IAAI,EAAyC,CAAC;YACrH,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CACF"}
|
package/dist/types/api.d.ts
CHANGED
|
@@ -14,4 +14,54 @@ export interface ApiErrorResponse {
|
|
|
14
14
|
export interface MessageResponse {
|
|
15
15
|
message: string;
|
|
16
16
|
}
|
|
17
|
+
/** Successful authentication response. */
|
|
18
|
+
export interface AuthResponse {
|
|
19
|
+
user: {
|
|
20
|
+
id: string;
|
|
21
|
+
email: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
role: string;
|
|
24
|
+
isActive: boolean;
|
|
25
|
+
mfaEnabled: boolean;
|
|
26
|
+
emailVerified: boolean;
|
|
27
|
+
avatarUrl: string | null;
|
|
28
|
+
profileSlug: string | null;
|
|
29
|
+
};
|
|
30
|
+
accessToken: string;
|
|
31
|
+
}
|
|
32
|
+
/** MFA method identifier. */
|
|
33
|
+
export type MfaMethod = 'totp' | 'passkey' | 'backup_code';
|
|
34
|
+
/** Returned instead of AuthResponse when the account has MFA enabled. */
|
|
35
|
+
export interface MfaChallengeResponse {
|
|
36
|
+
mfaRequired: true;
|
|
37
|
+
mfaToken: string;
|
|
38
|
+
mfaMethods: MfaMethod[];
|
|
39
|
+
user: {
|
|
40
|
+
email: string;
|
|
41
|
+
displayName: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Type guard — returns true when a login response requires MFA completion. */
|
|
45
|
+
export declare function isMfaChallenge(response: AuthResponse | MfaChallengeResponse): response is MfaChallengeResponse;
|
|
46
|
+
/** MFA status for the authenticated user's account. */
|
|
47
|
+
export interface MfaStatus {
|
|
48
|
+
mfaEnabled: boolean;
|
|
49
|
+
totpConfigured: boolean;
|
|
50
|
+
passkeyCount: number;
|
|
51
|
+
backupCodesRemaining: number;
|
|
52
|
+
passkeys: PasskeyInfo[];
|
|
53
|
+
}
|
|
54
|
+
/** TOTP setup initiation response. */
|
|
55
|
+
export interface TotpSetupResponse {
|
|
56
|
+
secret: string;
|
|
57
|
+
otpauthUri: string;
|
|
58
|
+
qrCodeDataUri: string;
|
|
59
|
+
}
|
|
60
|
+
/** Registered passkey summary. */
|
|
61
|
+
export interface PasskeyInfo {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
lastUsedAt: string | null;
|
|
66
|
+
}
|
|
17
67
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/types/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC7L,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,6BAA6B;AAC7B,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;AAE3D,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,GAAG,oBAAoB,GAC5C,QAAQ,IAAI,oBAAoB,CAElC;AAED,uDAAuD;AACvD,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,kCAAkC;AAClC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
|
package/dist/types/api.js
CHANGED
package/dist/types/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAoCA,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAC5B,QAA6C;IAE7C,OAAO,aAAa,IAAI,QAAQ,IAAI,QAAQ,CAAC,WAAW,KAAK,IAAI,CAAC;AACpE,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { PaginatedResponse, ApiErrorResponse, MessageResponse, } from './api.js';
|
|
2
|
-
export type { Vault, Document, DocumentWithContent, DocumentListItem, SearchResult, SearchResponse, AiChatSession, AiChatMessage, } from './resources.js';
|
|
2
|
+
export type { Vault, LinkGraphNode, LinkGraphEdge, LinkGraphResponse, UnresolvedLinkReference, UnresolvedLink, Document, DocumentWithContent, DocumentListItem, ForwardLinkResult, BacklinkResult, SearchResult, SearchResponse, AiChatSession, AiChatMessage, } from './resources.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { Vault } from '../resources/vaults.js';
|
|
2
|
-
export type { Document, DocumentWithContent, DocumentListItem, } from '../resources/documents.js';
|
|
1
|
+
export type { Vault, LinkGraphNode, LinkGraphEdge, LinkGraphResponse, UnresolvedLinkReference, UnresolvedLink, } from '../resources/vaults.js';
|
|
2
|
+
export type { Document, DocumentWithContent, DocumentListItem, ForwardLinkResult, BacklinkResult, } from '../resources/documents.js';
|
|
3
3
|
export type { SearchResult, SearchResponse } from '../resources/search.js';
|
|
4
4
|
export type { AiChatSession, AiChatMessage } from '../resources/ai.js';
|
|
5
5
|
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/types/resources.ts"],"names":[],"mappings":"AACA,YAAY,
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/types/resources.ts"],"names":[],"mappings":"AACA,YAAY,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|