@spacelr/sdk 0.18.0 → 0.18.1

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.mts CHANGED
@@ -1116,8 +1116,18 @@ declare class AuthModule {
1116
1116
  refresh(refreshToken: string): Promise<TokenResponse>;
1117
1117
  getProfile(): Promise<UserProfile>;
1118
1118
  logout(): Promise<void>;
1119
+ /**
1120
+ * Verify an email address with the token from the verification email.
1121
+ *
1122
+ * The token is sent in the request BODY, never the URL (#941): a query
1123
+ * string reaches server, proxy and CDN logs. When the project mints one, the
1124
+ * response carries a one-time `loginCode`; pass it to `exchangeCode` to sign
1125
+ * the user in.
1126
+ */
1119
1127
  verifyEmail(token: string): Promise<{
1120
1128
  message: string;
1129
+ valid: boolean;
1130
+ loginCode?: string;
1121
1131
  }>;
1122
1132
  resendVerification(email: string): Promise<{
1123
1133
  message: string;
@@ -1212,6 +1222,11 @@ declare class AuthModule {
1212
1222
  /**
1213
1223
  * Fetch WebAuthn attestation options to register a new passkey for the
1214
1224
  * currently authenticated user.
1225
+ *
1226
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
1227
+ * server answers 401 `STALE_SESSION` and this throws
1228
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
1229
+ * A token refresh does not help.
1215
1230
  */
1216
1231
  beginPasskeyRegistration(): Promise<PasskeyRegistrationOptionsJSON>;
1217
1232
  /**
@@ -1219,6 +1234,11 @@ declare class AuthModule {
1219
1234
  * against the options returned by `beginPasskeyRegistration()`, saving the
1220
1235
  * new credential under the current user. This does not issue tokens or
1221
1236
  * change auth state — the caller is already authenticated.
1237
+ *
1238
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
1239
+ * server answers 401 `STALE_SESSION` and this throws
1240
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
1241
+ * A token refresh does not help.
1222
1242
  */
1223
1243
  verifyPasskeyRegistration(response: PasskeyRegistrationResponseJSON, label?: string): Promise<PasskeyRegistrationResult>;
1224
1244
  /**
@@ -1347,6 +1367,11 @@ declare class AuthModule {
1347
1367
  /**
1348
1368
  * Approve the pending device link (signed-in device A). Authenticated.
1349
1369
  * Ownership/identity are derived server-side from the JWT.
1370
+ *
1371
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
1372
+ * server answers 401 `STALE_SESSION` and this throws
1373
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
1374
+ * A token refresh does not help.
1350
1375
  */
1351
1376
  approveDeviceLink(code: string): Promise<{
1352
1377
  approved: true;
@@ -2389,4 +2414,4 @@ interface SpacelrClient {
2389
2414
  }
2390
2415
  declare function createClient(config: SpacelrClientConfig): SpacelrClient;
2391
2416
 
2392
- export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, CONSUMER_ID_STORAGE_KEY, CodeChallengeMethod, type ConnectionState, CursorInvalidError, type CursorStorage, type DatabaseChangeEvent, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, ForbiddenError, type FunctionInvokeOptions, type FunctionInvokeResult, type GapReason, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, NotFoundError, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PasskeyAuthenticationOptionsJSON, type PasskeyAuthenticationResponseJSON, type PasskeyCredential, type PasskeyCredentialDescriptorJSON, type PasskeyLoginResponse, type PasskeyRegistrationOptionsJSON, type PasskeyRegistrationResponseJSON, type PasskeyRegistrationResult, type PushSubscriptionInfo, type QuotaInfo, type RecoveryRedeemResponse, type RecoveryStatusResponse, type RegisterParams, type RegisterResponse, type Schedule, type ScheduleInvokeOptions, type ScheduleListOptions, type ScheduleStatus, type SearchOptions, ServerConfigError, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrScanLimitExceededError, SpacelrSearchFilterRequiredError, SpacelrStepUpRequiredError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type StreamGapInfo, type StreamSubscription, type SubscribeEventsHandlers, type SubscribeHandlers, type SubscribeWithSnapshotOptions, type TimelineAndFilter, TimelineError, type TimelineFieldFilter, type TimelineFilter, type TimelineLeafFilter, TimelineModule, type TimelineOrderBy, type TimelineQueryOptions, type TimelineQueryResponse, type TimelineScalar, type TimelineSourceStats, TimeoutError, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, ValidationError, type VapidKeyResponse, type WhereFilter, type WhereOperator, type WhereScalar, type WhereValue, createClient, generatePKCEChallenge, localStorageCursorStorage, memoryCursorStorage, resolveConsumerId };
2417
+ export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, CONSUMER_ID_STORAGE_KEY, CodeChallengeMethod, type ConnectionState, CursorInvalidError, type CursorStorage, type DatabaseChangeEvent, type DeviceLinkCompleteResponse, type DeviceLinkInit, type DeviceLinkStatus, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, ForbiddenError, type FunctionInvokeOptions, type FunctionInvokeResult, type GapReason, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, NotFoundError, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PasskeyAuthenticationOptionsJSON, type PasskeyAuthenticationResponseJSON, type PasskeyCredential, type PasskeyCredentialDescriptorJSON, type PasskeyLoginResponse, type PasskeyRegistrationOptionsJSON, type PasskeyRegistrationResponseJSON, type PasskeyRegistrationResult, type PasskeySignupResponse, type PushSubscriptionInfo, type QuotaInfo, type RecoveryRedeemResponse, type RecoveryStatusResponse, type RegisterParams, type RegisterResponse, type Schedule, type ScheduleInvokeOptions, type ScheduleListOptions, type ScheduleStatus, type SearchOptions, ServerConfigError, type SessionSummary, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrScanLimitExceededError, SpacelrSearchFilterRequiredError, SpacelrStepUpRequiredError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type StreamGapInfo, type StreamSubscription, type SubscribeEventsHandlers, type SubscribeHandlers, type SubscribeWithSnapshotOptions, type TimelineAndFilter, TimelineError, type TimelineFieldFilter, type TimelineFilter, type TimelineLeafFilter, TimelineModule, type TimelineOrderBy, type TimelineQueryOptions, type TimelineQueryResponse, type TimelineScalar, type TimelineSourceStats, TimeoutError, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, ValidationError, type VapidKeyResponse, type WhereFilter, type WhereOperator, type WhereScalar, type WhereValue, createClient, generatePKCEChallenge, localStorageCursorStorage, memoryCursorStorage, resolveConsumerId };
package/dist/index.d.ts CHANGED
@@ -1116,8 +1116,18 @@ declare class AuthModule {
1116
1116
  refresh(refreshToken: string): Promise<TokenResponse>;
1117
1117
  getProfile(): Promise<UserProfile>;
1118
1118
  logout(): Promise<void>;
1119
+ /**
1120
+ * Verify an email address with the token from the verification email.
1121
+ *
1122
+ * The token is sent in the request BODY, never the URL (#941): a query
1123
+ * string reaches server, proxy and CDN logs. When the project mints one, the
1124
+ * response carries a one-time `loginCode`; pass it to `exchangeCode` to sign
1125
+ * the user in.
1126
+ */
1119
1127
  verifyEmail(token: string): Promise<{
1120
1128
  message: string;
1129
+ valid: boolean;
1130
+ loginCode?: string;
1121
1131
  }>;
1122
1132
  resendVerification(email: string): Promise<{
1123
1133
  message: string;
@@ -1212,6 +1222,11 @@ declare class AuthModule {
1212
1222
  /**
1213
1223
  * Fetch WebAuthn attestation options to register a new passkey for the
1214
1224
  * currently authenticated user.
1225
+ *
1226
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
1227
+ * server answers 401 `STALE_SESSION` and this throws
1228
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
1229
+ * A token refresh does not help.
1215
1230
  */
1216
1231
  beginPasskeyRegistration(): Promise<PasskeyRegistrationOptionsJSON>;
1217
1232
  /**
@@ -1219,6 +1234,11 @@ declare class AuthModule {
1219
1234
  * against the options returned by `beginPasskeyRegistration()`, saving the
1220
1235
  * new credential under the current user. This does not issue tokens or
1221
1236
  * change auth state — the caller is already authenticated.
1237
+ *
1238
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
1239
+ * server answers 401 `STALE_SESSION` and this throws
1240
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
1241
+ * A token refresh does not help.
1222
1242
  */
1223
1243
  verifyPasskeyRegistration(response: PasskeyRegistrationResponseJSON, label?: string): Promise<PasskeyRegistrationResult>;
1224
1244
  /**
@@ -1347,6 +1367,11 @@ declare class AuthModule {
1347
1367
  /**
1348
1368
  * Approve the pending device link (signed-in device A). Authenticated.
1349
1369
  * Ownership/identity are derived server-side from the JWT.
1370
+ *
1371
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
1372
+ * server answers 401 `STALE_SESSION` and this throws
1373
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
1374
+ * A token refresh does not help.
1350
1375
  */
1351
1376
  approveDeviceLink(code: string): Promise<{
1352
1377
  approved: true;
@@ -2389,4 +2414,4 @@ interface SpacelrClient {
2389
2414
  }
2390
2415
  declare function createClient(config: SpacelrClientConfig): SpacelrClient;
2391
2416
 
2392
- export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, CONSUMER_ID_STORAGE_KEY, CodeChallengeMethod, type ConnectionState, CursorInvalidError, type CursorStorage, type DatabaseChangeEvent, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, ForbiddenError, type FunctionInvokeOptions, type FunctionInvokeResult, type GapReason, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, NotFoundError, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PasskeyAuthenticationOptionsJSON, type PasskeyAuthenticationResponseJSON, type PasskeyCredential, type PasskeyCredentialDescriptorJSON, type PasskeyLoginResponse, type PasskeyRegistrationOptionsJSON, type PasskeyRegistrationResponseJSON, type PasskeyRegistrationResult, type PushSubscriptionInfo, type QuotaInfo, type RecoveryRedeemResponse, type RecoveryStatusResponse, type RegisterParams, type RegisterResponse, type Schedule, type ScheduleInvokeOptions, type ScheduleListOptions, type ScheduleStatus, type SearchOptions, ServerConfigError, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrScanLimitExceededError, SpacelrSearchFilterRequiredError, SpacelrStepUpRequiredError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type StreamGapInfo, type StreamSubscription, type SubscribeEventsHandlers, type SubscribeHandlers, type SubscribeWithSnapshotOptions, type TimelineAndFilter, TimelineError, type TimelineFieldFilter, type TimelineFilter, type TimelineLeafFilter, TimelineModule, type TimelineOrderBy, type TimelineQueryOptions, type TimelineQueryResponse, type TimelineScalar, type TimelineSourceStats, TimeoutError, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, ValidationError, type VapidKeyResponse, type WhereFilter, type WhereOperator, type WhereScalar, type WhereValue, createClient, generatePKCEChallenge, localStorageCursorStorage, memoryCursorStorage, resolveConsumerId };
2417
+ export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, CONSUMER_ID_STORAGE_KEY, CodeChallengeMethod, type ConnectionState, CursorInvalidError, type CursorStorage, type DatabaseChangeEvent, type DeviceLinkCompleteResponse, type DeviceLinkInit, type DeviceLinkStatus, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, ForbiddenError, type FunctionInvokeOptions, type FunctionInvokeResult, type GapReason, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, NotFoundError, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PasskeyAuthenticationOptionsJSON, type PasskeyAuthenticationResponseJSON, type PasskeyCredential, type PasskeyCredentialDescriptorJSON, type PasskeyLoginResponse, type PasskeyRegistrationOptionsJSON, type PasskeyRegistrationResponseJSON, type PasskeyRegistrationResult, type PasskeySignupResponse, type PushSubscriptionInfo, type QuotaInfo, type RecoveryRedeemResponse, type RecoveryStatusResponse, type RegisterParams, type RegisterResponse, type Schedule, type ScheduleInvokeOptions, type ScheduleListOptions, type ScheduleStatus, type SearchOptions, ServerConfigError, type SessionSummary, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrScanLimitExceededError, SpacelrSearchFilterRequiredError, SpacelrStepUpRequiredError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type StreamGapInfo, type StreamSubscription, type SubscribeEventsHandlers, type SubscribeHandlers, type SubscribeWithSnapshotOptions, type TimelineAndFilter, TimelineError, type TimelineFieldFilter, type TimelineFilter, type TimelineLeafFilter, TimelineModule, type TimelineOrderBy, type TimelineQueryOptions, type TimelineQueryResponse, type TimelineScalar, type TimelineSourceStats, TimeoutError, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, ValidationError, type VapidKeyResponse, type WhereFilter, type WhereOperator, type WhereScalar, type WhereValue, createClient, generatePKCEChallenge, localStorageCursorStorage, memoryCursorStorage, resolveConsumerId };
package/dist/index.js CHANGED
@@ -2046,11 +2046,19 @@ var AuthModule = class _AuthModule {
2046
2046
  await this.tokenManager.clearTokens();
2047
2047
  this.emitState("unauthenticated");
2048
2048
  }
2049
+ /**
2050
+ * Verify an email address with the token from the verification email.
2051
+ *
2052
+ * The token is sent in the request BODY, never the URL (#941): a query
2053
+ * string reaches server, proxy and CDN logs. When the project mints one, the
2054
+ * response carries a one-time `loginCode`; pass it to `exchangeCode` to sign
2055
+ * the user in.
2056
+ */
2049
2057
  async verifyEmail(token) {
2050
2058
  return this.http.request({
2051
- method: "GET",
2059
+ method: "POST",
2052
2060
  path: "/auth/verify-email",
2053
- query: { token }
2061
+ body: { token }
2054
2062
  });
2055
2063
  }
2056
2064
  async resendVerification(email) {
@@ -2295,6 +2303,11 @@ var AuthModule = class _AuthModule {
2295
2303
  /**
2296
2304
  * Fetch WebAuthn attestation options to register a new passkey for the
2297
2305
  * currently authenticated user.
2306
+ *
2307
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
2308
+ * server answers 401 `STALE_SESSION` and this throws
2309
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
2310
+ * A token refresh does not help.
2298
2311
  */
2299
2312
  async beginPasskeyRegistration() {
2300
2313
  return this.http.request({
@@ -2309,6 +2322,11 @@ var AuthModule = class _AuthModule {
2309
2322
  * against the options returned by `beginPasskeyRegistration()`, saving the
2310
2323
  * new credential under the current user. This does not issue tokens or
2311
2324
  * change auth state — the caller is already authenticated.
2325
+ *
2326
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
2327
+ * server answers 401 `STALE_SESSION` and this throws
2328
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
2329
+ * A token refresh does not help.
2312
2330
  */
2313
2331
  async verifyPasskeyRegistration(response, label) {
2314
2332
  return this.http.request({
@@ -2558,6 +2576,11 @@ var AuthModule = class _AuthModule {
2558
2576
  /**
2559
2577
  * Approve the pending device link (signed-in device A). Authenticated.
2560
2578
  * Ownership/identity are derived server-side from the JWT.
2579
+ *
2580
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
2581
+ * server answers 401 `STALE_SESSION` and this throws
2582
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
2583
+ * A token refresh does not help.
2561
2584
  */
2562
2585
  async approveDeviceLink(code) {
2563
2586
  return this.http.request({