@rebasepro/server 0.13.0 → 0.13.1-canary.g249daa1
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/{admin_block-CcSGdH7M.js → admin_block-CLeUMG8G.js} +3 -1
- package/dist/admin_block-CLeUMG8G.js.map +1 -0
- package/dist/api/errors.d.ts +0 -6
- package/dist/api/openapi-generator.d.ts +14 -0
- package/dist/api/rest/idempotency.d.ts +41 -4
- package/dist/api/rest/write-validation.d.ts +12 -5
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/jwt.d.ts +12 -0
- package/dist/{auth-CuC9M2x6.js → auth-BANhRhN9.js} +194 -84
- package/dist/auth-BANhRhN9.js.map +1 -0
- package/dist/{backup-CVggVhR2.js → backup-BJiY_mM-.js} +2 -2
- package/dist/{backup-CVggVhR2.js.map → backup-BJiY_mM-.js.map} +1 -1
- package/dist/boot/boot.d.ts +19 -0
- package/dist/boot/ddl-bootstrap.d.ts +70 -0
- package/dist/{contract-routes-Dj8i5AiM.js → contract-routes-FSt0Nyfk.js} +2 -2
- package/dist/{contract-routes-Dj8i5AiM.js.map → contract-routes-FSt0Nyfk.js.map} +1 -1
- package/dist/cron/cron-scheduler.d.ts +8 -3
- package/dist/cron/define-cron.d.ts +5 -3
- package/dist/{cron-routes-CrQ0tK-_.js → cron-routes-D5a9v1HY.js} +2 -2
- package/dist/{cron-routes-CrQ0tK-_.js.map → cron-routes-D5a9v1HY.js.map} +1 -1
- package/dist/{cron-scheduler-B3RFt0HS.js → cron-scheduler-CsQtYLMq.js} +28 -3
- package/dist/cron-scheduler-CsQtYLMq.js.map +1 -0
- package/dist/{cron-store-BywZsyfZ.js → cron-store-ZbjfuvMb.js} +65 -46
- package/dist/cron-store-ZbjfuvMb.js.map +1 -0
- package/dist/ddl-bootstrap-Bp3mr6Td.js +183 -0
- package/dist/ddl-bootstrap-Bp3mr6Td.js.map +1 -0
- package/dist/{errors-CgkCzoj7.js → errors-BpudWAVU.js} +2 -10
- package/dist/errors-BpudWAVU.js.map +1 -0
- package/dist/functions/define-function.d.ts +1 -1
- package/dist/history/history-routes.d.ts +6 -0
- package/dist/index.es.js +835 -276
- package/dist/index.es.js.map +1 -1
- package/dist/{jwt-DD6EtpGj.js → jwt-CzeviDcB.js} +17 -2
- package/dist/{jwt-DD6EtpGj.js.map → jwt-CzeviDcB.js.map} +1 -1
- package/dist/{openapi-generator-BEwyiaAr.js → openapi-generator-VB0MUH8h.js} +340 -128
- package/dist/openapi-generator-VB0MUH8h.js.map +1 -0
- package/dist/{schema-editor-routes-CbF20Mf1.js → schema-editor-routes-BqjzvvWU.js} +4 -4
- package/dist/{schema-editor-routes-CbF20Mf1.js.map → schema-editor-routes-BqjzvvWU.js.map} +1 -1
- package/dist/{src-_qQ3RNCK.js → src-Ca6NhxKs.js} +79 -2
- package/dist/src-Ca6NhxKs.js.map +1 -0
- package/dist/{src-Cum9kox5.js → src-DVb5a0bp.js} +153 -39
- package/dist/src-DVb5a0bp.js.map +1 -0
- package/dist/storage/keys.d.ts +65 -0
- package/dist/utils/logging.d.ts +0 -4
- package/dist/utils/sql.d.ts +11 -6
- package/package.json +6 -6
- package/dist/admin_block-CcSGdH7M.js.map +0 -1
- package/dist/auth-CuC9M2x6.js.map +0 -1
- package/dist/backend-CIxN4FVm.js +0 -15
- package/dist/backend-CIxN4FVm.js.map +0 -1
- package/dist/cron-scheduler-B3RFt0HS.js.map +0 -1
- package/dist/cron-store-BywZsyfZ.js.map +0 -1
- package/dist/errors-CgkCzoj7.js.map +0 -1
- package/dist/openapi-generator-BEwyiaAr.js.map +0 -1
- package/dist/src-Cum9kox5.js.map +0 -1
- package/dist/src-_qQ3RNCK.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "module";
|
|
|
2
2
|
import "process";
|
|
3
3
|
__createRequire(import.meta.url);
|
|
4
4
|
import { r as __require, t as __commonJSMin } from "./rolldown-runtime-DSJWtz9O.js";
|
|
5
|
-
import {
|
|
5
|
+
import { a as getDeclaredSubcollections, d as NULL_OPS, f as REST_TO_CANONICAL, l as getDataSourceCapabilities, o as isPostgresCollectionConfig, p as toCanonicalOp, s as isRelationalCollectionConfig, u as CANONICAL_TO_REST } from "./src-Ca6NhxKs.js";
|
|
6
6
|
//#region ../types/src/types/entities.ts
|
|
7
7
|
/**
|
|
8
8
|
* Class used to create a reference to a entity in a different path.
|
|
@@ -129,7 +129,7 @@ var Vector = class {
|
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region ../types/src/types/policy.ts
|
|
131
131
|
/**
|
|
132
|
-
* The id a request without a logged-in user reports as `
|
|
132
|
+
* The id a request without a logged-in user reports as `rebase.uid()`.
|
|
133
133
|
*
|
|
134
134
|
* A user-context request always sets `app.uid`: blank would read back as
|
|
135
135
|
* `NULL`, and `NULL` is how the trusted server context is recognised, so an
|
|
@@ -137,7 +137,7 @@ var Vector = class {
|
|
|
137
137
|
* therefore substitutes this sentinel at the single chokepoint where the GUC
|
|
138
138
|
* is set.
|
|
139
139
|
*
|
|
140
|
-
* The consequence for policy authors is that **`
|
|
140
|
+
* The consequence for policy authors is that **`rebase.uid() IS NOT NULL` is a
|
|
141
141
|
* tautology on the user path** — it is true for anonymous visitors too. Use
|
|
142
142
|
* {@link policy.authenticated} to mean "signed in", and
|
|
143
143
|
* {@link policy.serverContext} to mean "the trusted server context". Do not
|
|
@@ -154,7 +154,7 @@ var ANONYMOUS_USER_ID = "anonymous";
|
|
|
154
154
|
* JavaScript evaluator and the linter were all built on
|
|
155
155
|
* {@link ANONYMOUS_USER_ID}, while the request path scoped unauthenticated
|
|
156
156
|
* callers as `'anon'` — so `policy.authenticated()`, which compiled to
|
|
157
|
-
* `
|
|
157
|
+
* `rebase.uid() <> 'anonymous'`, was *true* for an anonymous visitor. The
|
|
158
158
|
* sanctioned way to write "signed in" granted to everyone, and the linter
|
|
159
159
|
* flagged the spelling that actually worked as a foreign convention.
|
|
160
160
|
*
|
|
@@ -235,6 +235,27 @@ var policy = {
|
|
|
235
235
|
authUid: () => ({ kind: "authUid" }),
|
|
236
236
|
authRoles: () => ({ kind: "authRoles" })
|
|
237
237
|
};
|
|
238
|
+
/** Hard ceiling clamped onto any client-supplied `limit`, on every surface. */
|
|
239
|
+
var MAX_LIST_LIMIT = 1e3;
|
|
240
|
+
/**
|
|
241
|
+
* Resolve a client-supplied list `limit` into a safe, always-defined value.
|
|
242
|
+
*
|
|
243
|
+
* - A provided limit is coerced to an integer and clamped to `[1, maxLimit]`,
|
|
244
|
+
* so `0`, negatives, and absurd values can never bypass the cap.
|
|
245
|
+
* - An absent / blank / non-numeric limit falls back to the mode default:
|
|
246
|
+
* `vectorDefaultLimit` for a vector search, otherwise `defaultLimit`.
|
|
247
|
+
*
|
|
248
|
+
* The return is never `undefined` — no ingress that routes its client limit
|
|
249
|
+
* through this can produce an unbounded read.
|
|
250
|
+
*/
|
|
251
|
+
function resolveClientListLimit(rawLimit, opts = {}) {
|
|
252
|
+
const maxLimit = opts.maxLimit ?? 1e3;
|
|
253
|
+
if (rawLimit != null && String(rawLimit).trim() !== "") {
|
|
254
|
+
const parsed = typeof rawLimit === "number" ? rawLimit : parseInt(String(rawLimit), 10);
|
|
255
|
+
if (Number.isFinite(parsed)) return Math.min(Math.max(1, Math.floor(parsed)), maxLimit);
|
|
256
|
+
}
|
|
257
|
+
return opts.vectorSearch ? opts.vectorDefaultLimit ?? 10 : opts.defaultLimit ?? 50;
|
|
258
|
+
}
|
|
238
259
|
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
239
260
|
(function(e) {
|
|
240
261
|
var t;
|
|
@@ -1382,10 +1403,21 @@ function singularizeForKey(name) {
|
|
|
1382
1403
|
* have `id` and `path` fields — these are relation-shaped objects from
|
|
1383
1404
|
* edge cases in the data pipeline (REST fallback, stale cache, custom data source).
|
|
1384
1405
|
*
|
|
1406
|
+
* When `targetPath` is given, also accepts a bare id. A relation column is a
|
|
1407
|
+
* foreign key, and the REST layer returns it as the scalar it is; only some
|
|
1408
|
+
* fetch paths hydrate it into an object. Which form a caller sees therefore
|
|
1409
|
+
* depends on how the row was loaded, and a caller that only accepted objects
|
|
1410
|
+
* reported half of its own data as a type error. The declared target is the
|
|
1411
|
+
* missing half: with it, an id is a relation that has not been fetched yet.
|
|
1412
|
+
*
|
|
1385
1413
|
* Returns null if the value cannot be coerced.
|
|
1386
1414
|
*/
|
|
1387
|
-
function normalizeToEntityRelation(value, propertyType) {
|
|
1415
|
+
function normalizeToEntityRelation(value, propertyType, targetPath) {
|
|
1388
1416
|
if (value instanceof EntityRelation) return value;
|
|
1417
|
+
if (targetPath && (typeof value === "string" || typeof value === "number")) {
|
|
1418
|
+
if (value === "") return null;
|
|
1419
|
+
return new EntityRelation(value, targetPath);
|
|
1420
|
+
}
|
|
1389
1421
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1390
1422
|
const obj = value;
|
|
1391
1423
|
if (!(obj.__type === "relation" || obj.__type === "reference" || typeof obj.isEntityRelation === "function" && obj.isEntityRelation() || typeof obj.isEntityReference === "function" && obj.isEntityReference() || propertyType === "relation" && typeof obj.id !== "undefined" && typeof obj.path === "string")) return null;
|
|
@@ -2883,8 +2915,24 @@ var QueryBuilder = class {
|
|
|
2883
2915
|
/**
|
|
2884
2916
|
* Set a free-text search string if supported by the backend.
|
|
2885
2917
|
*/
|
|
2886
|
-
search(searchString) {
|
|
2918
|
+
search(searchString, options) {
|
|
2887
2919
|
this.params.searchString = searchString;
|
|
2920
|
+
if (options?.explain !== void 0) this.params.searchExplain = options.explain;
|
|
2921
|
+
return this;
|
|
2922
|
+
}
|
|
2923
|
+
/**
|
|
2924
|
+
* Order rows by nearest-neighbour distance to `vector`, closest first.
|
|
2925
|
+
*
|
|
2926
|
+
* Postgres only, over a property declared as `type: "vector"`. Rows come
|
|
2927
|
+
* back with a `_distance`; `where` filters before the ordering.
|
|
2928
|
+
*/
|
|
2929
|
+
vectorSearch(property, vector, options) {
|
|
2930
|
+
this.params.vectorSearch = {
|
|
2931
|
+
property,
|
|
2932
|
+
vector,
|
|
2933
|
+
...options?.distance !== void 0 && { distance: options.distance },
|
|
2934
|
+
...options?.threshold !== void 0 && { threshold: options.threshold }
|
|
2935
|
+
};
|
|
2888
2936
|
return this;
|
|
2889
2937
|
}
|
|
2890
2938
|
/**
|
|
@@ -2941,6 +2989,30 @@ var RebasePaginationError = class RebasePaginationError extends Error {
|
|
|
2941
2989
|
Object.setPrototypeOf(this, RebasePaginationError.prototype);
|
|
2942
2990
|
}
|
|
2943
2991
|
};
|
|
2992
|
+
/**
|
|
2993
|
+
* Resolve `limit`/`offset`/`page` into the window a read will actually use.
|
|
2994
|
+
*
|
|
2995
|
+
* Lives here, next to the walk, for the reason at the top of this file: every
|
|
2996
|
+
* transport has to mean the same thing by "page two". Four of them did not —
|
|
2997
|
+
* the REST layer strode by {@link DEFAULT_LIST_LIMIT}, the local-first
|
|
2998
|
+
* evaluator by {@link DEFAULT_PAGE_SIZE}, the in-process accessor by 20, and
|
|
2999
|
+
* the published type documented a fourth number. Pages that overlap or skip
|
|
3000
|
+
* rows are the mildest of those outcomes.
|
|
3001
|
+
*
|
|
3002
|
+
* `page` wins over `offset`, as {@link FindParams} documents. `driverOffset`
|
|
3003
|
+
* is the value to hand a driver: it stays `undefined` when the caller named no
|
|
3004
|
+
* offset, because keyset pagination seeks with a `where` clause and must not
|
|
3005
|
+
* look like it is paging by offset.
|
|
3006
|
+
*/
|
|
3007
|
+
function resolveFindWindow(params) {
|
|
3008
|
+
const limit = params?.limit ?? 50;
|
|
3009
|
+
const offset = params?.page != null ? Math.max(0, (params.page - 1) * limit) : params?.offset ?? 0;
|
|
3010
|
+
return {
|
|
3011
|
+
limit,
|
|
3012
|
+
offset,
|
|
3013
|
+
driverOffset: params?.page != null ? offset : params?.offset
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
2944
3016
|
function normalizePageSize(raw) {
|
|
2945
3017
|
if (raw === void 0 || !Number.isFinite(raw)) return 200;
|
|
2946
3018
|
return Math.max(1, Math.floor(raw));
|
|
@@ -3251,18 +3323,8 @@ function serializeLogicalCondition(cond) {
|
|
|
3251
3323
|
}
|
|
3252
3324
|
return `${cond.column}.${restOp}.${stringifyValue(cond.value)}`;
|
|
3253
3325
|
}
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
* `LogicalCondition` or `FilterCondition`.
|
|
3257
|
-
*
|
|
3258
|
-
* @example
|
|
3259
|
-
* deserializeLogicalCondition("status.eq.active")
|
|
3260
|
-
* // → { column: "status", operator: "==", value: "active" }
|
|
3261
|
-
*
|
|
3262
|
-
* deserializeLogicalCondition("or(status.eq.active,age.gte.18)")
|
|
3263
|
-
* // → { type: "or", conditions: [...] }
|
|
3264
|
-
*/
|
|
3265
|
-
function deserializeLogicalCondition(str) {
|
|
3326
|
+
function deserializeLogicalCondition(str, nesting = 0) {
|
|
3327
|
+
if (nesting > 32) throw new Error(`Filter groups nest more than 32 levels deep. Flatten the condition — \`or(a,or(b,c))\` is \`or(a,b,c)\`.`);
|
|
3266
3328
|
const logicalMatch = str.match(/^(and|or)\((.+)\)$/);
|
|
3267
3329
|
if (logicalMatch) {
|
|
3268
3330
|
const type = logicalMatch[1];
|
|
@@ -3273,10 +3335,10 @@ function deserializeLogicalCondition(str) {
|
|
|
3273
3335
|
for (let i = 0; i < innerStr.length; i++) if (innerStr[i] === "(") depth++;
|
|
3274
3336
|
else if (innerStr[i] === ")") depth--;
|
|
3275
3337
|
else if (innerStr[i] === "," && depth === 0) {
|
|
3276
|
-
conditions.push(deserializeLogicalCondition(innerStr.slice(start, i)));
|
|
3338
|
+
conditions.push(deserializeLogicalCondition(innerStr.slice(start, i), nesting + 1));
|
|
3277
3339
|
start = i + 1;
|
|
3278
3340
|
}
|
|
3279
|
-
conditions.push(deserializeLogicalCondition(innerStr.slice(start)));
|
|
3341
|
+
conditions.push(deserializeLogicalCondition(innerStr.slice(start), nesting + 1));
|
|
3280
3342
|
return {
|
|
3281
3343
|
type,
|
|
3282
3344
|
conditions
|
|
@@ -3344,10 +3406,12 @@ function createPrimaryKeyResolver(options) {
|
|
|
3344
3406
|
* than postgres still serve rows with one, and this keeps them working.
|
|
3345
3407
|
*/
|
|
3346
3408
|
function rowToEntity(row, slug, primaryKeys = []) {
|
|
3409
|
+
const { _matches, ...values } = row;
|
|
3347
3410
|
return {
|
|
3348
3411
|
id: primaryKeys.length > 0 ? buildCompositeId(row, primaryKeys) : row.id,
|
|
3349
3412
|
path: slug,
|
|
3350
|
-
values
|
|
3413
|
+
values,
|
|
3414
|
+
..._matches ? { searchMatches: _matches } : {}
|
|
3351
3415
|
};
|
|
3352
3416
|
}
|
|
3353
3417
|
/**
|
|
@@ -3390,21 +3454,22 @@ function createDriverAccessor(driver, slug, getPks = () => []) {
|
|
|
3390
3454
|
const accessor = {
|
|
3391
3455
|
async find(params) {
|
|
3392
3456
|
const filter = params?.where ? deserializeFilter(params.where) : void 0;
|
|
3393
|
-
const limit = params
|
|
3394
|
-
const offset = params?.offset ?? 0;
|
|
3457
|
+
const { limit, offset, driverOffset } = resolveFindWindow(params);
|
|
3395
3458
|
const fetchService = driver.restFetchService;
|
|
3396
3459
|
const rows = fetchService ? await fetchService.fetchCollectionForRest(slug, {
|
|
3397
3460
|
filter,
|
|
3398
|
-
|
|
3399
|
-
|
|
3461
|
+
logical: params?.logical,
|
|
3462
|
+
limit,
|
|
3463
|
+
offset: driverOffset,
|
|
3400
3464
|
orderBy: params?.orderBy?.[0],
|
|
3401
3465
|
order: params?.orderBy?.[1],
|
|
3402
3466
|
searchString: params?.searchString
|
|
3403
3467
|
}, params?.include) : await driver.fetchCollection({
|
|
3404
3468
|
path: slug,
|
|
3405
|
-
limit
|
|
3406
|
-
offset:
|
|
3469
|
+
limit,
|
|
3470
|
+
offset: driverOffset,
|
|
3407
3471
|
filter,
|
|
3472
|
+
logical: params?.logical,
|
|
3408
3473
|
orderBy: params?.orderBy?.[0],
|
|
3409
3474
|
order: params?.orderBy?.[1],
|
|
3410
3475
|
searchString: params?.searchString
|
|
@@ -3414,7 +3479,9 @@ function createDriverAccessor(driver, slug, getPks = () => []) {
|
|
|
3414
3479
|
if (driver.count) {
|
|
3415
3480
|
total = await driver.count({
|
|
3416
3481
|
path: slug,
|
|
3417
|
-
filter
|
|
3482
|
+
filter,
|
|
3483
|
+
logical: params?.logical,
|
|
3484
|
+
searchString: params?.searchString
|
|
3418
3485
|
});
|
|
3419
3486
|
hasMore = offset + rows.length < total;
|
|
3420
3487
|
}
|
|
@@ -3466,30 +3533,48 @@ function createDriverAccessor(driver, slug, getPks = () => []) {
|
|
|
3466
3533
|
values: {}
|
|
3467
3534
|
} });
|
|
3468
3535
|
},
|
|
3536
|
+
updateMany: driver.updateMany ? async (updates) => {
|
|
3537
|
+
return (await driver.updateMany({
|
|
3538
|
+
path: slug,
|
|
3539
|
+
updates: updates.map((u) => ({
|
|
3540
|
+
id: u.id,
|
|
3541
|
+
values: u.data
|
|
3542
|
+
}))
|
|
3543
|
+
})).map((row) => rowToEntity(row, slug, getPks()));
|
|
3544
|
+
} : void 0,
|
|
3545
|
+
deleteMany: driver.deleteMany ? async (ids) => {
|
|
3546
|
+
await driver.deleteMany({
|
|
3547
|
+
path: slug,
|
|
3548
|
+
ids
|
|
3549
|
+
});
|
|
3550
|
+
} : void 0,
|
|
3469
3551
|
count: driver.count ? async (params) => {
|
|
3470
3552
|
const filter = params?.where ? deserializeFilter(params.where) : void 0;
|
|
3471
3553
|
return driver.count({
|
|
3472
3554
|
path: slug,
|
|
3473
|
-
filter
|
|
3555
|
+
filter,
|
|
3556
|
+
logical: params?.logical,
|
|
3557
|
+
searchString: params?.searchString
|
|
3474
3558
|
});
|
|
3475
3559
|
} : void 0,
|
|
3476
3560
|
listen: driver.listenCollection ? (params, onUpdate, onError) => {
|
|
3477
|
-
const limit = params
|
|
3478
|
-
const offset = params?.offset ?? 0;
|
|
3561
|
+
const { limit, offset, driverOffset } = resolveFindWindow(params);
|
|
3479
3562
|
const normalize = driver.restFetchService ? inlineRelationRefs : (row) => row;
|
|
3480
3563
|
return driver.listenCollection({
|
|
3481
3564
|
path: slug,
|
|
3482
|
-
limit
|
|
3483
|
-
offset:
|
|
3565
|
+
limit,
|
|
3566
|
+
offset: driverOffset,
|
|
3484
3567
|
filter: params?.where,
|
|
3568
|
+
logical: params?.logical,
|
|
3485
3569
|
orderBy: params?.orderBy?.[0],
|
|
3486
3570
|
order: params?.orderBy?.[1],
|
|
3487
3571
|
searchString: params?.searchString,
|
|
3572
|
+
searchExplain: params?.searchExplain,
|
|
3488
3573
|
onUpdate: (entities) => {
|
|
3489
3574
|
onUpdate({
|
|
3490
3575
|
data: entities.map((row) => rowToEntity(normalize(row), slug, getPks())),
|
|
3491
3576
|
meta: {
|
|
3492
|
-
total: entities.length,
|
|
3577
|
+
total: offset + entities.length,
|
|
3493
3578
|
limit,
|
|
3494
3579
|
offset,
|
|
3495
3580
|
hasMore: entities.length >= limit
|
|
@@ -3522,8 +3607,11 @@ function createDriverAccessor(driver, slug, getPks = () => []) {
|
|
|
3522
3607
|
offset(count) {
|
|
3523
3608
|
return new QueryBuilder(accessor).offset(count);
|
|
3524
3609
|
},
|
|
3525
|
-
search(searchString) {
|
|
3526
|
-
return new QueryBuilder(accessor).search(searchString);
|
|
3610
|
+
search(searchString, options) {
|
|
3611
|
+
return new QueryBuilder(accessor).search(searchString, options);
|
|
3612
|
+
},
|
|
3613
|
+
vectorSearch(property, vector, options) {
|
|
3614
|
+
return new QueryBuilder(accessor).vectorSearch(property, vector, options);
|
|
3527
3615
|
},
|
|
3528
3616
|
include(...relations) {
|
|
3529
3617
|
return new QueryBuilder(accessor).include(...relations);
|
|
@@ -3611,8 +3699,18 @@ var SdkQueryBuilder = class {
|
|
|
3611
3699
|
this.params.offset = count;
|
|
3612
3700
|
return this;
|
|
3613
3701
|
}
|
|
3614
|
-
search(searchString) {
|
|
3702
|
+
search(searchString, options) {
|
|
3615
3703
|
this.params.searchString = searchString;
|
|
3704
|
+
if (options?.explain !== void 0) this.params.searchExplain = options.explain;
|
|
3705
|
+
return this;
|
|
3706
|
+
}
|
|
3707
|
+
vectorSearch(property, vector, options) {
|
|
3708
|
+
this.params.vectorSearch = {
|
|
3709
|
+
property,
|
|
3710
|
+
vector,
|
|
3711
|
+
...options?.distance !== void 0 && { distance: options.distance },
|
|
3712
|
+
...options?.threshold !== void 0 && { threshold: options.threshold }
|
|
3713
|
+
};
|
|
3616
3714
|
return this;
|
|
3617
3715
|
}
|
|
3618
3716
|
include(...relations) {
|
|
@@ -3666,9 +3764,24 @@ function toSdkCollectionClient(snap, slug = "collection") {
|
|
|
3666
3764
|
async update(id, data) {
|
|
3667
3765
|
return entityToRow(await snap.update(id, data));
|
|
3668
3766
|
},
|
|
3767
|
+
async updateMany(updates) {
|
|
3768
|
+
if (!Array.isArray(updates)) throw new TypeError("updateMany expects an array of { id, data } entries.");
|
|
3769
|
+
if (updates.length === 0) return [];
|
|
3770
|
+
if (!snap.updateMany) throw new Error("Bulk updates are not supported by this collection's data source. Fall back to update() per record.");
|
|
3771
|
+
return (await snap.updateMany(updates.map((u) => ({
|
|
3772
|
+
id: u.id,
|
|
3773
|
+
data: u.data
|
|
3774
|
+
})))).map(entityToRow);
|
|
3775
|
+
},
|
|
3669
3776
|
delete(id) {
|
|
3670
3777
|
return snap.delete(id);
|
|
3671
3778
|
},
|
|
3779
|
+
async deleteMany(ids) {
|
|
3780
|
+
if (!Array.isArray(ids)) throw new TypeError("deleteMany expects an array of ids.");
|
|
3781
|
+
if (ids.length === 0) return;
|
|
3782
|
+
if (!snap.deleteMany) throw new Error("Bulk deletes are not supported by this collection's data source. Fall back to delete() per record.");
|
|
3783
|
+
await snap.deleteMany(ids);
|
|
3784
|
+
},
|
|
3672
3785
|
count: snap.count ? (params) => snap.count(params) : void 0,
|
|
3673
3786
|
listen: snap.listen ? (params, onUpdate, onError) => snap.listen(params, (res) => onUpdate({
|
|
3674
3787
|
data: res.data.map(entityToRow),
|
|
@@ -3684,6 +3797,7 @@ function toSdkCollectionClient(snap, slug = "collection") {
|
|
|
3684
3797
|
limit: (count) => new SdkQueryBuilder(client).limit(count),
|
|
3685
3798
|
offset: (count) => new SdkQueryBuilder(client).offset(count),
|
|
3686
3799
|
search: (searchString) => new SdkQueryBuilder(client).search(searchString),
|
|
3800
|
+
vectorSearch: (property, vector, options) => new SdkQueryBuilder(client).vectorSearch(property, vector, options),
|
|
3687
3801
|
include: (...relations) => new SdkQueryBuilder(client).include(...relations)
|
|
3688
3802
|
};
|
|
3689
3803
|
return client;
|
|
@@ -3772,6 +3886,6 @@ function buildRoutedRebaseData({ defaultData, sources, resolveKey }) {
|
|
|
3772
3886
|
} });
|
|
3773
3887
|
}
|
|
3774
3888
|
//#endregion
|
|
3775
|
-
export { Vector as S,
|
|
3889
|
+
export { EntityReference as C, Vector as E, isAnonymousUid as S, GeoPoint as T, resolvePrimaryKeys as _, serializeFilter as a, resolveClientListLimit as b, paginateFind as c, createDataSourceRegistry as d, resolveDataSource as f, buildCompositeId as g, resolveCollectionRelations as h, deserializeLogicalCondition as i, resolveFindWindow as l, findRelation as m, buildSdkData as n, serializeLogicalCondition as o, getEffectiveSecurityRules as p, deserializeFilter as r, collectAllPages as s, buildRoutedRebaseData as t, CollectionRegistry as u, toSnakeCase as v, EntityRelation as w, ANONYMOUS_USER_ID as x, MAX_LIST_LIMIT as y };
|
|
3776
3890
|
|
|
3777
|
-
//# sourceMappingURL=src-
|
|
3891
|
+
//# sourceMappingURL=src-DVb5a0bp.js.map
|