@spacelr/sdk 0.1.7 → 0.1.8
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 +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -544,6 +544,21 @@ interface DeleteResult {
|
|
|
544
544
|
interface FindByIdOptions {
|
|
545
545
|
populate?: PopulateOption[];
|
|
546
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Options for a server-side substring search.
|
|
549
|
+
*
|
|
550
|
+
* Limits: `query` 1–200 chars, `fields` 1–10 entries (each matching
|
|
551
|
+
* `/^[a-zA-Z0-9_.]+$/`, max 64 chars), `limit` max 100.
|
|
552
|
+
*/
|
|
553
|
+
interface SearchOptions {
|
|
554
|
+
query: string;
|
|
555
|
+
fields: string[];
|
|
556
|
+
filter?: Record<string, unknown>;
|
|
557
|
+
sort?: Record<string, 1 | -1>;
|
|
558
|
+
limit?: number;
|
|
559
|
+
offset?: number;
|
|
560
|
+
select?: string[];
|
|
561
|
+
}
|
|
547
562
|
interface SubscribeHandlers<T = Record<string, unknown>> {
|
|
548
563
|
where?: Record<string, string | number | boolean>;
|
|
549
564
|
onInsert?: (doc: T & {
|
|
@@ -586,6 +601,18 @@ declare class CollectionRef<T = Record<string, unknown>> {
|
|
|
586
601
|
_id?: string;
|
|
587
602
|
})[]): Promise<InsertResult>;
|
|
588
603
|
find(filter?: Record<string, unknown>): QueryBuilder<T>;
|
|
604
|
+
/**
|
|
605
|
+
* Server-side substring search across the specified fields.
|
|
606
|
+
*
|
|
607
|
+
* The query is regex-escaped server-side and matched case-insensitively via
|
|
608
|
+
* MongoDB `$regex`. Performance note: unanchored case-insensitive regex
|
|
609
|
+
* cannot use a standard B-tree index — on very large collections consider
|
|
610
|
+
* narrowing with `filter` to scope the scan.
|
|
611
|
+
*
|
|
612
|
+
* Limits: `query` 1–200 chars, `fields` 1–10 entries (each matching
|
|
613
|
+
* `/^[a-zA-Z0-9_.]+$/`, max 64 chars), `limit` max 100.
|
|
614
|
+
*/
|
|
615
|
+
search(opts: SearchOptions): Promise<FindResult<T>>;
|
|
589
616
|
findById(id: string, options?: FindByIdOptions): Promise<T & {
|
|
590
617
|
_id: string;
|
|
591
618
|
}>;
|
|
@@ -741,4 +768,4 @@ interface SpacelrClient {
|
|
|
741
768
|
}
|
|
742
769
|
declare function createClient(config: SpacelrClientConfig): SpacelrClient;
|
|
743
770
|
|
|
744
|
-
export { type ApiResponse, type AuthLostReason, type AuthorizationUrlParams, BrowserTokenStorage, CodeChallengeMethod, type ConnectionState, type DatabaseChangeEvent, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, type FunctionInvokeOptions, type FunctionInvokeResult, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PushSubscriptionInfo, type QuotaInfo, type RegisterParams, type RegisterResponse, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type SubscribeHandlers, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, type VapidKeyResponse, createClient, generatePKCEChallenge };
|
|
771
|
+
export { type ApiResponse, type AuthLostReason, type AuthorizationUrlParams, BrowserTokenStorage, CodeChallengeMethod, type ConnectionState, type DatabaseChangeEvent, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, type FunctionInvokeOptions, type FunctionInvokeResult, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PushSubscriptionInfo, type QuotaInfo, type RegisterParams, type RegisterResponse, type SearchOptions, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type SubscribeHandlers, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, type VapidKeyResponse, createClient, generatePKCEChallenge };
|
package/dist/index.d.ts
CHANGED
|
@@ -544,6 +544,21 @@ interface DeleteResult {
|
|
|
544
544
|
interface FindByIdOptions {
|
|
545
545
|
populate?: PopulateOption[];
|
|
546
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Options for a server-side substring search.
|
|
549
|
+
*
|
|
550
|
+
* Limits: `query` 1–200 chars, `fields` 1–10 entries (each matching
|
|
551
|
+
* `/^[a-zA-Z0-9_.]+$/`, max 64 chars), `limit` max 100.
|
|
552
|
+
*/
|
|
553
|
+
interface SearchOptions {
|
|
554
|
+
query: string;
|
|
555
|
+
fields: string[];
|
|
556
|
+
filter?: Record<string, unknown>;
|
|
557
|
+
sort?: Record<string, 1 | -1>;
|
|
558
|
+
limit?: number;
|
|
559
|
+
offset?: number;
|
|
560
|
+
select?: string[];
|
|
561
|
+
}
|
|
547
562
|
interface SubscribeHandlers<T = Record<string, unknown>> {
|
|
548
563
|
where?: Record<string, string | number | boolean>;
|
|
549
564
|
onInsert?: (doc: T & {
|
|
@@ -586,6 +601,18 @@ declare class CollectionRef<T = Record<string, unknown>> {
|
|
|
586
601
|
_id?: string;
|
|
587
602
|
})[]): Promise<InsertResult>;
|
|
588
603
|
find(filter?: Record<string, unknown>): QueryBuilder<T>;
|
|
604
|
+
/**
|
|
605
|
+
* Server-side substring search across the specified fields.
|
|
606
|
+
*
|
|
607
|
+
* The query is regex-escaped server-side and matched case-insensitively via
|
|
608
|
+
* MongoDB `$regex`. Performance note: unanchored case-insensitive regex
|
|
609
|
+
* cannot use a standard B-tree index — on very large collections consider
|
|
610
|
+
* narrowing with `filter` to scope the scan.
|
|
611
|
+
*
|
|
612
|
+
* Limits: `query` 1–200 chars, `fields` 1–10 entries (each matching
|
|
613
|
+
* `/^[a-zA-Z0-9_.]+$/`, max 64 chars), `limit` max 100.
|
|
614
|
+
*/
|
|
615
|
+
search(opts: SearchOptions): Promise<FindResult<T>>;
|
|
589
616
|
findById(id: string, options?: FindByIdOptions): Promise<T & {
|
|
590
617
|
_id: string;
|
|
591
618
|
}>;
|
|
@@ -741,4 +768,4 @@ interface SpacelrClient {
|
|
|
741
768
|
}
|
|
742
769
|
declare function createClient(config: SpacelrClientConfig): SpacelrClient;
|
|
743
770
|
|
|
744
|
-
export { type ApiResponse, type AuthLostReason, type AuthorizationUrlParams, BrowserTokenStorage, CodeChallengeMethod, type ConnectionState, type DatabaseChangeEvent, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, type FunctionInvokeOptions, type FunctionInvokeResult, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PushSubscriptionInfo, type QuotaInfo, type RegisterParams, type RegisterResponse, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type SubscribeHandlers, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, type VapidKeyResponse, createClient, generatePKCEChallenge };
|
|
771
|
+
export { type ApiResponse, type AuthLostReason, type AuthorizationUrlParams, BrowserTokenStorage, CodeChallengeMethod, type ConnectionState, type DatabaseChangeEvent, type DownloadUrlResponse, type ExchangeCodeParams, type FileInfo, type FileListResponse, FileVisibility, type FunctionInvokeOptions, type FunctionInvokeResult, GrantType, type InitMultipartUploadParams, type InitMultipartUploadResponse, type JWK, type JWKSResponse, type ListFilesParams, type LoginParams, type LoginResponse, MemoryTokenStorage, type OpenIDConfiguration, type PKCEChallenge, type PartEtag, type PushSubscriptionInfo, type QuotaInfo, type RegisterParams, type RegisterResponse, type SearchOptions, type ShareFileParams, SharePermission, SpacelrAuthError, type SpacelrClient, type SpacelrClientConfig, SpacelrEmailVerificationRequiredError, SpacelrError, SpacelrNetworkError, SpacelrTimeoutError, SpacelrTwoFactorRequiredError, type StoredTokens, type SubscribeHandlers, type TokenResponse, type TokenStorage, type TwoFactorResponse, type TwoFactorVerifyParams, type UnshareFileParams, type UploadFileParams, type UploadLargeFileParams, type UploadProgress, type UserInfo, type UserProfile, type VapidKeyResponse, createClient, generatePKCEChallenge };
|
package/dist/index.js
CHANGED
|
@@ -1413,6 +1413,25 @@ var CollectionRef = class {
|
|
|
1413
1413
|
find(filter) {
|
|
1414
1414
|
return new QueryBuilder(this.http, this.basePath, filter);
|
|
1415
1415
|
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Server-side substring search across the specified fields.
|
|
1418
|
+
*
|
|
1419
|
+
* The query is regex-escaped server-side and matched case-insensitively via
|
|
1420
|
+
* MongoDB `$regex`. Performance note: unanchored case-insensitive regex
|
|
1421
|
+
* cannot use a standard B-tree index — on very large collections consider
|
|
1422
|
+
* narrowing with `filter` to scope the scan.
|
|
1423
|
+
*
|
|
1424
|
+
* Limits: `query` 1–200 chars, `fields` 1–10 entries (each matching
|
|
1425
|
+
* `/^[a-zA-Z0-9_.]+$/`, max 64 chars), `limit` max 100.
|
|
1426
|
+
*/
|
|
1427
|
+
async search(opts) {
|
|
1428
|
+
return this.http.request({
|
|
1429
|
+
method: "POST",
|
|
1430
|
+
path: `${this.basePath}/search`,
|
|
1431
|
+
body: opts,
|
|
1432
|
+
authenticated: true
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1416
1435
|
async findById(id, options) {
|
|
1417
1436
|
const query = {};
|
|
1418
1437
|
if (options?.populate?.length) {
|