@rebasepro/types 0.14.1 → 0.14.2-canary.g27a129e

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.es.js CHANGED
@@ -180,6 +180,56 @@ var Vector = class {
180
180
  };
181
181
  //#endregion
182
182
  //#region src/types/filter-operators.ts
183
+ /** The wire spelling of a {@link RelationAggregateSort}: `min(applications.created_at)`. */
184
+ var RELATION_AGGREGATE_SORT_PATTERN = /^(min|max|count|sum|avg)\(([^().]+)(?:\.([^()]+))?\)$/;
185
+ /**
186
+ * A {@link RelationAggregateSort} as a single string — `min(applications.created_at)`,
187
+ * `count(applications)`.
188
+ *
189
+ * The wire form is a string because every layer below the call site already is
190
+ * one: `OrderByTuple` is `[string, direction]`, the REST parameter is
191
+ * `?orderBy=key:direction`, the driver contract takes `orderBy?: string |
192
+ * OrderByTuple[]`, and a cursor names its keys by string. `_score` established
193
+ * the same pattern — a sort key that is not a column, spelled as one — and this
194
+ * reuses it rather than widening five signatures to carry an object that would
195
+ * be flattened at the end anyway.
196
+ *
197
+ * SQL's own spelling, so the key reads as what it compiles to. Neither `:` nor
198
+ * `,` appears in it, which is what keeps it safe in the colon-delimited wire
199
+ * shorthand.
200
+ *
201
+ * @group Models
202
+ */
203
+ function encodeRelationAggregateSort(sort) {
204
+ return `${sort.agg}(${sort.relation}${sort.field ? `.${sort.field}` : ""})`;
205
+ }
206
+ /**
207
+ * Read the string spelling back, or `undefined` if it is not one.
208
+ *
209
+ * `undefined` rather than a throw: this is asked of *every* sort key to find
210
+ * out which kind it is, and an ordinary column name is not an error.
211
+ *
212
+ * @group Models
213
+ */
214
+ function parseRelationAggregateSort(key) {
215
+ const match = RELATION_AGGREGATE_SORT_PATTERN.exec(key);
216
+ if (!match) return void 0;
217
+ const [, agg, relation, field] = match;
218
+ if (!field && agg !== "count") return void 0;
219
+ return {
220
+ agg,
221
+ relation,
222
+ ...field && { field }
223
+ };
224
+ }
225
+ /** Is this sort key the object form rather than a field name? */
226
+ function isRelationAggregateSort(key) {
227
+ return typeof key === "object" && key !== null && typeof key.relation === "string" && typeof key.agg === "string";
228
+ }
229
+ /** A sort key in the single-string form every layer below the call site speaks. */
230
+ function sortKeyToString(key) {
231
+ return isRelationAggregateSort(key) ? encodeRelationAggregateSort(key) : key;
232
+ }
183
233
  /** Maps canonical operators to their REST short-code equivalents. */
184
234
  var CANONICAL_TO_REST = {
185
235
  "==": "eq",
@@ -314,6 +364,7 @@ var ADMIN_COLLECTION_KEYS = [
314
364
  "additionalFields",
315
365
  "alwaysApplyDefaultValues",
316
366
  "components",
367
+ "customViews",
317
368
  "defaultEntityAction",
318
369
  "defaultFilter",
319
370
  "defaultSelectedView",
@@ -491,6 +542,8 @@ var POSTGRES_CAPABILITIES = {
491
542
  "hasMany",
492
543
  "hasOne"
493
544
  ],
545
+ supportsRelationFieldFilters: true,
546
+ relationAggregateSorts: true,
494
547
  supportsSQLAdmin: true,
495
548
  supportsDocumentAdmin: false,
496
549
  supportsSchemaAdmin: true
@@ -508,6 +561,8 @@ var FIREBASE_CAPABILITIES = {
508
561
  supportsVectors: false,
509
562
  filterOperators: ALL_WHERE_FILTER_OPS.filter((op) => op !== "like" && op !== "ilike" && op !== "not-like" && op !== "not-ilike"),
510
563
  filterableRelationKinds: [],
564
+ supportsRelationFieldFilters: false,
565
+ relationAggregateSorts: false,
511
566
  supportsSQLAdmin: false,
512
567
  supportsDocumentAdmin: false,
513
568
  supportsSchemaAdmin: false
@@ -525,6 +580,8 @@ var MONGODB_CAPABILITIES = {
525
580
  supportsVectors: false,
526
581
  filterOperators: ALL_WHERE_FILTER_OPS,
527
582
  filterableRelationKinds: [],
583
+ supportsRelationFieldFilters: false,
584
+ relationAggregateSorts: false,
528
585
  supportsSQLAdmin: false,
529
586
  supportsDocumentAdmin: true,
530
587
  supportsSchemaAdmin: true
@@ -546,6 +603,8 @@ var DEFAULT_CAPABILITIES = {
546
603
  supportsVectors: true,
547
604
  filterOperators: ALL_WHERE_FILTER_OPS,
548
605
  filterableRelationKinds: DEFAULT_FILTERABLE_RELATION_KINDS,
606
+ supportsRelationFieldFilters: false,
607
+ relationAggregateSorts: false,
549
608
  supportsSQLAdmin: true,
550
609
  supportsDocumentAdmin: true,
551
610
  supportsSchemaAdmin: true
@@ -1386,6 +1445,6 @@ function isPublicStoragePath(path) {
1386
1445
  return p.startsWith("public/") || p.startsWith(`default/public/`);
1387
1446
  }
1388
1447
  //#endregion
1389
- export { ADMIN_COLLECTION_KEYS, ADMIN_PROPERTY_KEYS, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, ANONYMOUS_USER_IDS, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, DEFAULT_CAPABILITIES, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_FUZZY_THRESHOLD, DEFAULT_LIST_LIMIT, DEFAULT_SEARCH_COLUMN, DEFAULT_SEARCH_LANGUAGE, DEFAULT_SEARCH_WEIGHT, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_VECTOR_LIST_LIMIT, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, LEGACY_RLS_JWT_SQL, LEGACY_RLS_ROLES_SQL, LEGACY_RLS_SCHEMA, LEGACY_RLS_UID_SQL, ListLimitError, MAX_LIST_LIMIT, MONGODB_CAPABILITIES, NULL_OPS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REBASE_SCHEMA, RELEVANCE_SORT_FIELD, REST_TO_CANONICAL, RLS_JWT_SQL, RLS_ROLES_SQL, RLS_UID_SQL, RUNTIME_CONTRACT_VERSION, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, Vector, canonicalSchemaPayload, computeSchemaVersion, deserializeCollections, findStorageSuffixCollision, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, hasForeignKeyOnTarget, isAnonymousUid, isBranchAdmin, isChannelBusInstance, isDocumentAdmin, isFirebaseCollectionConfig, isLazyComponentRef, isManyToMany, isMongoDBCollectionConfig, isPostgresCollectionConfig, isPublicStoragePath, isRelationalCollectionConfig, isSQLAdmin, isSchemaAdmin, isSerializedCollectionRef, isToMany, nestAdminCollectionKeys, nestAdminKeysOf, nestAdminPropertyKeys, normalizeStorageSources, policy, registerDataSourceCapabilities, resolveClientListLimit, rewriteLegacyRlsFunctions, serializeCollections, storageEnvSuffix, toCanonicalOp, usesLegacyRlsFunctions };
1448
+ export { ADMIN_COLLECTION_KEYS, ADMIN_PROPERTY_KEYS, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, ANONYMOUS_USER_IDS, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, DEFAULT_CAPABILITIES, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_FUZZY_THRESHOLD, DEFAULT_LIST_LIMIT, DEFAULT_SEARCH_COLUMN, DEFAULT_SEARCH_LANGUAGE, DEFAULT_SEARCH_WEIGHT, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_VECTOR_LIST_LIMIT, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, LEGACY_RLS_JWT_SQL, LEGACY_RLS_ROLES_SQL, LEGACY_RLS_SCHEMA, LEGACY_RLS_UID_SQL, ListLimitError, MAX_LIST_LIMIT, MONGODB_CAPABILITIES, NULL_OPS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REBASE_SCHEMA, RELEVANCE_SORT_FIELD, REST_TO_CANONICAL, RLS_JWT_SQL, RLS_ROLES_SQL, RLS_UID_SQL, RUNTIME_CONTRACT_VERSION, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, Vector, canonicalSchemaPayload, computeSchemaVersion, deserializeCollections, encodeRelationAggregateSort, findStorageSuffixCollision, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, hasForeignKeyOnTarget, isAnonymousUid, isBranchAdmin, isChannelBusInstance, isDocumentAdmin, isFirebaseCollectionConfig, isLazyComponentRef, isManyToMany, isMongoDBCollectionConfig, isPostgresCollectionConfig, isPublicStoragePath, isRelationAggregateSort, isRelationalCollectionConfig, isSQLAdmin, isSchemaAdmin, isSerializedCollectionRef, isToMany, nestAdminCollectionKeys, nestAdminKeysOf, nestAdminPropertyKeys, normalizeStorageSources, parseRelationAggregateSort, policy, registerDataSourceCapabilities, resolveClientListLimit, rewriteLegacyRlsFunctions, serializeCollections, sortKeyToString, storageEnvSuffix, toCanonicalOp, usesLegacyRlsFunctions };
1390
1449
 
1391
1450
  //# sourceMappingURL=index.es.js.map