@spacelr/sdk 0.10.3 → 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 +51 -3
- package/dist/index.d.ts +51 -3
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -2
- 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>);
|
|
@@ -581,6 +590,18 @@ interface StreamSubscriptionOptions {
|
|
|
581
590
|
projectId: string;
|
|
582
591
|
collectionName: string;
|
|
583
592
|
sinceId?: string;
|
|
593
|
+
/**
|
|
594
|
+
* #685 — "replay from earliest retained". When true, a brand-new subscription
|
|
595
|
+
* (no prior cursor) replays every retained stream entry from the earliest
|
|
596
|
+
* still-retained id before going live, each entry gated by the same
|
|
597
|
+
* per-event rule check as live delivery. Lets a first-time subscriber
|
|
598
|
+
* bootstrap history for a recipient-scoped collection. Ignored on reconnect
|
|
599
|
+
* (a stored cursor resumes from the last delivered event instead) and
|
|
600
|
+
* overrides `sinceId` on the first subscription. Coverage is bounded by the
|
|
601
|
+
* stream's retention window; a truncated replay still fires `onGap` with
|
|
602
|
+
* `replay-truncated`.
|
|
603
|
+
*/
|
|
604
|
+
fromStart?: boolean;
|
|
584
605
|
where?: WhereFilter;
|
|
585
606
|
/**
|
|
586
607
|
* Called for each delivered event. Awaited — the cursor does NOT advance
|
|
@@ -1090,7 +1111,19 @@ interface OffsetResult<T = Record<string, unknown>> {
|
|
|
1090
1111
|
documents: (T & {
|
|
1091
1112
|
_id: string;
|
|
1092
1113
|
})[];
|
|
1093
|
-
|
|
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;
|
|
1094
1127
|
limit: number;
|
|
1095
1128
|
offset: number;
|
|
1096
1129
|
}
|
|
@@ -1116,7 +1149,10 @@ interface SearchResult<T = Record<string, unknown>> {
|
|
|
1116
1149
|
documents: (T & {
|
|
1117
1150
|
_id: string;
|
|
1118
1151
|
})[];
|
|
1119
|
-
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;
|
|
1120
1156
|
limit: number;
|
|
1121
1157
|
offset: number;
|
|
1122
1158
|
}
|
|
@@ -1246,6 +1282,18 @@ interface SubscribeWithSnapshotOptions<T> {
|
|
|
1246
1282
|
interface SubscribeEventsHandlers<T = Record<string, unknown>> {
|
|
1247
1283
|
/** Cursor to resume from. Undefined = fresh subscription, deliver only new events. */
|
|
1248
1284
|
sinceId?: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* #685 — "replay from earliest retained". When true, a fresh subscription
|
|
1287
|
+
* (no `sinceId` and no stored cursor) first replays every retained stream
|
|
1288
|
+
* entry from the earliest still-retained id, each gated by the same rule
|
|
1289
|
+
* check as live delivery, before going live. Lets a first-time subscriber
|
|
1290
|
+
* bootstrap history for a recipient-scoped collection (e.g. a chat invite /
|
|
1291
|
+
* MLS Welcome written before they subscribed). Ignored once a cursor exists
|
|
1292
|
+
* (reconnect resumes from the last delivered event). Coverage is bounded by
|
|
1293
|
+
* the stream's retention window; a truncated replay fires `onGap` with
|
|
1294
|
+
* `replay-truncated`.
|
|
1295
|
+
*/
|
|
1296
|
+
fromStart?: boolean;
|
|
1249
1297
|
where?: WhereFilter;
|
|
1250
1298
|
/**
|
|
1251
1299
|
* Optional resume-cursor store. When set, the SDK loads the previous cursor
|
|
@@ -1859,4 +1907,4 @@ interface SpacelrClient {
|
|
|
1859
1907
|
}
|
|
1860
1908
|
declare function createClient(config: SpacelrClientConfig): SpacelrClient;
|
|
1861
1909
|
|
|
1862
|
-
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>);
|
|
@@ -581,6 +590,18 @@ interface StreamSubscriptionOptions {
|
|
|
581
590
|
projectId: string;
|
|
582
591
|
collectionName: string;
|
|
583
592
|
sinceId?: string;
|
|
593
|
+
/**
|
|
594
|
+
* #685 — "replay from earliest retained". When true, a brand-new subscription
|
|
595
|
+
* (no prior cursor) replays every retained stream entry from the earliest
|
|
596
|
+
* still-retained id before going live, each entry gated by the same
|
|
597
|
+
* per-event rule check as live delivery. Lets a first-time subscriber
|
|
598
|
+
* bootstrap history for a recipient-scoped collection. Ignored on reconnect
|
|
599
|
+
* (a stored cursor resumes from the last delivered event instead) and
|
|
600
|
+
* overrides `sinceId` on the first subscription. Coverage is bounded by the
|
|
601
|
+
* stream's retention window; a truncated replay still fires `onGap` with
|
|
602
|
+
* `replay-truncated`.
|
|
603
|
+
*/
|
|
604
|
+
fromStart?: boolean;
|
|
584
605
|
where?: WhereFilter;
|
|
585
606
|
/**
|
|
586
607
|
* Called for each delivered event. Awaited — the cursor does NOT advance
|
|
@@ -1090,7 +1111,19 @@ interface OffsetResult<T = Record<string, unknown>> {
|
|
|
1090
1111
|
documents: (T & {
|
|
1091
1112
|
_id: string;
|
|
1092
1113
|
})[];
|
|
1093
|
-
|
|
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;
|
|
1094
1127
|
limit: number;
|
|
1095
1128
|
offset: number;
|
|
1096
1129
|
}
|
|
@@ -1116,7 +1149,10 @@ interface SearchResult<T = Record<string, unknown>> {
|
|
|
1116
1149
|
documents: (T & {
|
|
1117
1150
|
_id: string;
|
|
1118
1151
|
})[];
|
|
1119
|
-
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;
|
|
1120
1156
|
limit: number;
|
|
1121
1157
|
offset: number;
|
|
1122
1158
|
}
|
|
@@ -1246,6 +1282,18 @@ interface SubscribeWithSnapshotOptions<T> {
|
|
|
1246
1282
|
interface SubscribeEventsHandlers<T = Record<string, unknown>> {
|
|
1247
1283
|
/** Cursor to resume from. Undefined = fresh subscription, deliver only new events. */
|
|
1248
1284
|
sinceId?: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* #685 — "replay from earliest retained". When true, a fresh subscription
|
|
1287
|
+
* (no `sinceId` and no stored cursor) first replays every retained stream
|
|
1288
|
+
* entry from the earliest still-retained id, each gated by the same rule
|
|
1289
|
+
* check as live delivery, before going live. Lets a first-time subscriber
|
|
1290
|
+
* bootstrap history for a recipient-scoped collection (e.g. a chat invite /
|
|
1291
|
+
* MLS Welcome written before they subscribed). Ignored once a cursor exists
|
|
1292
|
+
* (reconnect resumes from the last delivered event). Coverage is bounded by
|
|
1293
|
+
* the stream's retention window; a truncated replay fires `onGap` with
|
|
1294
|
+
* `replay-truncated`.
|
|
1295
|
+
*/
|
|
1296
|
+
fromStart?: boolean;
|
|
1249
1297
|
where?: WhereFilter;
|
|
1250
1298
|
/**
|
|
1251
1299
|
* Optional resume-cursor store. When set, the SDK loads the previous cursor
|
|
@@ -1859,4 +1907,4 @@ interface SpacelrClient {
|
|
|
1859
1907
|
}
|
|
1860
1908
|
declare function createClient(config: SpacelrClientConfig): SpacelrClient;
|
|
1861
1909
|
|
|
1862
|
-
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
|
}
|
|
@@ -1368,7 +1379,11 @@ var RealtimeClient = class {
|
|
|
1368
1379
|
buildStreamPayload(state) {
|
|
1369
1380
|
const { projectId, collectionName, where } = state.options;
|
|
1370
1381
|
const payload = { projectId, collectionName };
|
|
1371
|
-
if (state.lastDeliveredId)
|
|
1382
|
+
if (state.lastDeliveredId) {
|
|
1383
|
+
payload["sinceId"] = state.lastDeliveredId;
|
|
1384
|
+
} else if (state.options.fromStart) {
|
|
1385
|
+
payload["fromStart"] = true;
|
|
1386
|
+
}
|
|
1372
1387
|
if (where && Object.keys(where).length > 0) payload["where"] = where;
|
|
1373
1388
|
return payload;
|
|
1374
1389
|
}
|
|
@@ -2355,7 +2370,7 @@ var Paginator = class {
|
|
|
2355
2370
|
return { documents: [], hasMore: false };
|
|
2356
2371
|
}
|
|
2357
2372
|
this.cursor = result.documents[result.documents.length - 1]._id;
|
|
2358
|
-
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);
|
|
2359
2374
|
return { documents: result.documents, hasMore };
|
|
2360
2375
|
}
|
|
2361
2376
|
};
|
|
@@ -2682,6 +2697,9 @@ var CollectionRef = class {
|
|
|
2682
2697
|
projectId: this.projectId,
|
|
2683
2698
|
collectionName: this.collectionName,
|
|
2684
2699
|
sinceId,
|
|
2700
|
+
// #685 — only meaningful on a fresh subscription (no sinceId/cursor);
|
|
2701
|
+
// buildStreamPayload ignores it once a cursor exists.
|
|
2702
|
+
fromStart: handlers.fromStart,
|
|
2685
2703
|
where: handlers.where,
|
|
2686
2704
|
onEvent,
|
|
2687
2705
|
onGap: handlers.onGap,
|
|
@@ -3379,6 +3397,7 @@ function createClient(config) {
|
|
|
3379
3397
|
SpacelrEmailVerificationRequiredError,
|
|
3380
3398
|
SpacelrError,
|
|
3381
3399
|
SpacelrNetworkError,
|
|
3400
|
+
SpacelrScanLimitExceededError,
|
|
3382
3401
|
SpacelrSearchFilterRequiredError,
|
|
3383
3402
|
SpacelrTimeoutError,
|
|
3384
3403
|
SpacelrTwoFactorRequiredError,
|