@spacelr/sdk 0.10.4 → 0.10.5
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 +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -516,6 +516,15 @@ declare class SpacelrSearchFilterRequiredError extends SpacelrError {
|
|
|
516
516
|
readonly missingFields: string[];
|
|
517
517
|
constructor(message: string, details?: Record<string, unknown>);
|
|
518
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* #687 — A document-dependent `.read` bulk read could not assemble a page: the
|
|
521
|
+
* over-fetch window was entirely non-readable yet more rows exist beyond it.
|
|
522
|
+
* The caller should narrow the query (a more specific `where`/`.filter`) and
|
|
523
|
+
* retry, or page with a smaller run of non-readable rows.
|
|
524
|
+
*/
|
|
525
|
+
declare class SpacelrScanLimitExceededError extends SpacelrError {
|
|
526
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
527
|
+
}
|
|
519
528
|
declare class SpacelrEmailVerificationRequiredError extends SpacelrError {
|
|
520
529
|
readonly emailSent: boolean;
|
|
521
530
|
constructor(emailSent: boolean, details?: Record<string, unknown>);
|
|
@@ -1102,7 +1111,19 @@ interface OffsetResult<T = Record<string, unknown>> {
|
|
|
1102
1111
|
documents: (T & {
|
|
1103
1112
|
_id: string;
|
|
1104
1113
|
})[];
|
|
1105
|
-
|
|
1114
|
+
/**
|
|
1115
|
+
* Total documents matching the query. Present for auth-static reads. OMITTED
|
|
1116
|
+
* (#687) for a collection whose `.read` is document-dependent: an honest total
|
|
1117
|
+
* under per-document RLS would require a full filtered scan (a DoS vector), so
|
|
1118
|
+
* `hasMore` carries the pagination signal instead.
|
|
1119
|
+
*/
|
|
1120
|
+
total?: number;
|
|
1121
|
+
/**
|
|
1122
|
+
* True when more documents exist past the returned page. Set (#687) on the
|
|
1123
|
+
* document-dependent `.read` path where `total` is omitted; absent for
|
|
1124
|
+
* auth-static reads (use `total` there).
|
|
1125
|
+
*/
|
|
1126
|
+
hasMore?: boolean;
|
|
1106
1127
|
limit: number;
|
|
1107
1128
|
offset: number;
|
|
1108
1129
|
}
|
|
@@ -1128,7 +1149,10 @@ interface SearchResult<T = Record<string, unknown>> {
|
|
|
1128
1149
|
documents: (T & {
|
|
1129
1150
|
_id: string;
|
|
1130
1151
|
})[];
|
|
1131
|
-
total
|
|
1152
|
+
/** Omitted (#687) for a document-dependent `.read`; see OffsetResult.total. */
|
|
1153
|
+
total?: number;
|
|
1154
|
+
/** Set (#687) on the document-dependent `.read` path where `total` is omitted. */
|
|
1155
|
+
hasMore?: boolean;
|
|
1132
1156
|
limit: number;
|
|
1133
1157
|
offset: number;
|
|
1134
1158
|
}
|
|
@@ -1883,4 +1907,4 @@ interface SpacelrClient {
|
|
|
1883
1907
|
}
|
|
1884
1908
|
declare function createClient(config: SpacelrClientConfig): SpacelrClient;
|
|
1885
1909
|
|
|
1886
|
-
export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, 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 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, SpacelrSearchFilterRequiredError, 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 };
|
|
1910
|
+
export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, 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 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -516,6 +516,15 @@ declare class SpacelrSearchFilterRequiredError extends SpacelrError {
|
|
|
516
516
|
readonly missingFields: string[];
|
|
517
517
|
constructor(message: string, details?: Record<string, unknown>);
|
|
518
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* #687 — A document-dependent `.read` bulk read could not assemble a page: the
|
|
521
|
+
* over-fetch window was entirely non-readable yet more rows exist beyond it.
|
|
522
|
+
* The caller should narrow the query (a more specific `where`/`.filter`) and
|
|
523
|
+
* retry, or page with a smaller run of non-readable rows.
|
|
524
|
+
*/
|
|
525
|
+
declare class SpacelrScanLimitExceededError extends SpacelrError {
|
|
526
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
527
|
+
}
|
|
519
528
|
declare class SpacelrEmailVerificationRequiredError extends SpacelrError {
|
|
520
529
|
readonly emailSent: boolean;
|
|
521
530
|
constructor(emailSent: boolean, details?: Record<string, unknown>);
|
|
@@ -1102,7 +1111,19 @@ interface OffsetResult<T = Record<string, unknown>> {
|
|
|
1102
1111
|
documents: (T & {
|
|
1103
1112
|
_id: string;
|
|
1104
1113
|
})[];
|
|
1105
|
-
|
|
1114
|
+
/**
|
|
1115
|
+
* Total documents matching the query. Present for auth-static reads. OMITTED
|
|
1116
|
+
* (#687) for a collection whose `.read` is document-dependent: an honest total
|
|
1117
|
+
* under per-document RLS would require a full filtered scan (a DoS vector), so
|
|
1118
|
+
* `hasMore` carries the pagination signal instead.
|
|
1119
|
+
*/
|
|
1120
|
+
total?: number;
|
|
1121
|
+
/**
|
|
1122
|
+
* True when more documents exist past the returned page. Set (#687) on the
|
|
1123
|
+
* document-dependent `.read` path where `total` is omitted; absent for
|
|
1124
|
+
* auth-static reads (use `total` there).
|
|
1125
|
+
*/
|
|
1126
|
+
hasMore?: boolean;
|
|
1106
1127
|
limit: number;
|
|
1107
1128
|
offset: number;
|
|
1108
1129
|
}
|
|
@@ -1128,7 +1149,10 @@ interface SearchResult<T = Record<string, unknown>> {
|
|
|
1128
1149
|
documents: (T & {
|
|
1129
1150
|
_id: string;
|
|
1130
1151
|
})[];
|
|
1131
|
-
total
|
|
1152
|
+
/** Omitted (#687) for a document-dependent `.read`; see OffsetResult.total. */
|
|
1153
|
+
total?: number;
|
|
1154
|
+
/** Set (#687) on the document-dependent `.read` path where `total` is omitted. */
|
|
1155
|
+
hasMore?: boolean;
|
|
1132
1156
|
limit: number;
|
|
1133
1157
|
offset: number;
|
|
1134
1158
|
}
|
|
@@ -1883,4 +1907,4 @@ interface SpacelrClient {
|
|
|
1883
1907
|
}
|
|
1884
1908
|
declare function createClient(config: SpacelrClientConfig): SpacelrClient;
|
|
1885
1909
|
|
|
1886
|
-
export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, 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 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, SpacelrSearchFilterRequiredError, 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 };
|
|
1910
|
+
export { type ApiResponse, type AuthLostReason, type AuthState, type AuthStateListener, type AuthorizationUrlParams, BrowserTokenStorage, 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 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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
SpacelrEmailVerificationRequiredError: () => SpacelrEmailVerificationRequiredError,
|
|
35
35
|
SpacelrError: () => SpacelrError,
|
|
36
36
|
SpacelrNetworkError: () => SpacelrNetworkError,
|
|
37
|
+
SpacelrScanLimitExceededError: () => SpacelrScanLimitExceededError,
|
|
37
38
|
SpacelrSearchFilterRequiredError: () => SpacelrSearchFilterRequiredError,
|
|
38
39
|
SpacelrTimeoutError: () => SpacelrTimeoutError,
|
|
39
40
|
SpacelrTwoFactorRequiredError: () => SpacelrTwoFactorRequiredError,
|
|
@@ -101,6 +102,12 @@ var SpacelrSearchFilterRequiredError = class extends SpacelrError {
|
|
|
101
102
|
this.missingFields = Array.isArray(fields) ? fields.filter((f) => typeof f === "string") : [];
|
|
102
103
|
}
|
|
103
104
|
};
|
|
105
|
+
var SpacelrScanLimitExceededError = class extends SpacelrError {
|
|
106
|
+
constructor(message, details) {
|
|
107
|
+
super(message, "SCAN_LIMIT_EXCEEDED", 400, details);
|
|
108
|
+
this.name = "SpacelrScanLimitExceededError";
|
|
109
|
+
}
|
|
110
|
+
};
|
|
104
111
|
var SpacelrEmailVerificationRequiredError = class extends SpacelrError {
|
|
105
112
|
constructor(emailSent, details) {
|
|
106
113
|
super(
|
|
@@ -356,6 +363,10 @@ var HttpClient = class {
|
|
|
356
363
|
const missingFields = Array.isArray(flatBody["missingFields"]) ? flatBody["missingFields"] : [];
|
|
357
364
|
throw new SpacelrSearchFilterRequiredError(flatMessage, { missingFields });
|
|
358
365
|
}
|
|
366
|
+
if (statusCode === 400 && flatBody["errorCode"] === "SCAN_LIMIT_EXCEEDED") {
|
|
367
|
+
const flatMessage = typeof flatBody["message"] === "string" ? flatBody["message"] : message;
|
|
368
|
+
throw new SpacelrScanLimitExceededError(flatMessage);
|
|
369
|
+
}
|
|
359
370
|
if (statusCode === 401 || statusCode === 403) {
|
|
360
371
|
throw new SpacelrAuthError(message, statusCode, details);
|
|
361
372
|
}
|
|
@@ -2359,7 +2370,7 @@ var Paginator = class {
|
|
|
2359
2370
|
return { documents: [], hasMore: false };
|
|
2360
2371
|
}
|
|
2361
2372
|
this.cursor = result.documents[result.documents.length - 1]._id;
|
|
2362
|
-
const hasMore = result.mode === "cursor" ? result.hasMore : result.documents.length < result.total;
|
|
2373
|
+
const hasMore = result.mode === "cursor" ? result.hasMore : result.hasMore ?? (result.total !== void 0 ? result.documents.length < result.total : false);
|
|
2363
2374
|
return { documents: result.documents, hasMore };
|
|
2364
2375
|
}
|
|
2365
2376
|
};
|
|
@@ -3386,6 +3397,7 @@ function createClient(config) {
|
|
|
3386
3397
|
SpacelrEmailVerificationRequiredError,
|
|
3387
3398
|
SpacelrError,
|
|
3388
3399
|
SpacelrNetworkError,
|
|
3400
|
+
SpacelrScanLimitExceededError,
|
|
3389
3401
|
SpacelrSearchFilterRequiredError,
|
|
3390
3402
|
SpacelrTimeoutError,
|
|
3391
3403
|
SpacelrTwoFactorRequiredError,
|