@rebasepro/types 0.11.1-canary.gfadf355 → 0.12.0
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 +147 -115
- package/dist/index.es.js.map +1 -1
- package/dist/types/admin_block.d.ts +1 -1
- package/dist/types/api_keys.d.ts +60 -5
- package/dist/types/collections.d.ts +56 -31
- package/dist/types/data_source.d.ts +10 -0
- package/dist/types/history.d.ts +62 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/postgres_introspection.d.ts +95 -0
- package/dist/types/properties.d.ts +37 -48
- package/dist/types/websockets.d.ts +0 -37
- package/package.json +1 -1
- package/src/types/admin_block.ts +5 -0
- package/src/types/api_keys.ts +61 -5
- package/src/types/collections.ts +68 -38
- package/src/types/data_source.ts +15 -0
- package/src/types/history.ts +66 -0
- package/src/types/index.ts +2 -0
- package/src/types/postgres_introspection.ts +101 -0
- package/src/types/properties.ts +42 -55
- package/src/types/websockets.ts +0 -42
package/dist/index.es.js
CHANGED
|
@@ -354,6 +354,7 @@ var ADMIN_COLLECTION_KEYS = [
|
|
|
354
354
|
* @group Models
|
|
355
355
|
*/
|
|
356
356
|
var ADMIN_PROPERTY_KEYS = [
|
|
357
|
+
"canAddElements",
|
|
357
358
|
"clearable",
|
|
358
359
|
"columnWidth",
|
|
359
360
|
"customProps",
|
|
@@ -362,7 +363,10 @@ var ADMIN_PROPERTY_KEYS = [
|
|
|
362
363
|
"Field",
|
|
363
364
|
"Filter",
|
|
364
365
|
"filterOperators",
|
|
366
|
+
"fixedFilter",
|
|
365
367
|
"hideFromCollection",
|
|
368
|
+
"includeEntityLink",
|
|
369
|
+
"includeId",
|
|
366
370
|
"markdown",
|
|
367
371
|
"minimalistView",
|
|
368
372
|
"multiline",
|
|
@@ -370,12 +374,131 @@ var ADMIN_PROPERTY_KEYS = [
|
|
|
370
374
|
"previewAsTag",
|
|
371
375
|
"previewProperties",
|
|
372
376
|
"readOnly",
|
|
377
|
+
"sortable",
|
|
373
378
|
"spreadChildren",
|
|
374
379
|
"urlPreview",
|
|
375
380
|
"widget",
|
|
376
381
|
"widthPercentage"
|
|
377
382
|
];
|
|
378
383
|
//#endregion
|
|
384
|
+
//#region src/types/data_source.ts
|
|
385
|
+
/**
|
|
386
|
+
* The default data-source key, used when a collection does not name a
|
|
387
|
+
* `dataSource`. Shared by the frontend router and the backend driver
|
|
388
|
+
* registry so both agree on "the default database".
|
|
389
|
+
* @group Models
|
|
390
|
+
*/
|
|
391
|
+
var DEFAULT_DATA_SOURCE_KEY = "(default)";
|
|
392
|
+
/**
|
|
393
|
+
* Relation kinds assumed filterable when a driver does not say.
|
|
394
|
+
*
|
|
395
|
+
* `belongsTo` alone: its filter is a comparison on a column of the row being
|
|
396
|
+
* filtered, the one shape that needs no query construction a driver might not
|
|
397
|
+
* have. Everything else is a correlated subquery over another table.
|
|
398
|
+
*
|
|
399
|
+
* @group Models
|
|
400
|
+
*/
|
|
401
|
+
var DEFAULT_FILTERABLE_RELATION_KINDS = ["belongsTo"];
|
|
402
|
+
/** @group Models */
|
|
403
|
+
var POSTGRES_CAPABILITIES = {
|
|
404
|
+
key: "postgres",
|
|
405
|
+
label: "PostgreSQL",
|
|
406
|
+
supportsRelations: true,
|
|
407
|
+
supportsSubcollections: false,
|
|
408
|
+
supportsRLS: true,
|
|
409
|
+
supportsReferences: false,
|
|
410
|
+
supportsColumnTypes: true,
|
|
411
|
+
supportsRealtime: true,
|
|
412
|
+
supportsVectors: true,
|
|
413
|
+
filterOperators: ALL_WHERE_FILTER_OPS,
|
|
414
|
+
filterableRelationKinds: [
|
|
415
|
+
"belongsTo",
|
|
416
|
+
"manyToMany",
|
|
417
|
+
"hasMany",
|
|
418
|
+
"hasOne"
|
|
419
|
+
],
|
|
420
|
+
supportsSQLAdmin: true,
|
|
421
|
+
supportsDocumentAdmin: false,
|
|
422
|
+
supportsSchemaAdmin: true
|
|
423
|
+
};
|
|
424
|
+
/** @group Models */
|
|
425
|
+
var FIREBASE_CAPABILITIES = {
|
|
426
|
+
key: "firestore",
|
|
427
|
+
label: "Firebase / Firestore",
|
|
428
|
+
supportsRelations: false,
|
|
429
|
+
supportsSubcollections: true,
|
|
430
|
+
supportsRLS: false,
|
|
431
|
+
supportsReferences: true,
|
|
432
|
+
supportsColumnTypes: false,
|
|
433
|
+
supportsRealtime: true,
|
|
434
|
+
supportsVectors: false,
|
|
435
|
+
filterOperators: ALL_WHERE_FILTER_OPS.filter((op) => op !== "like" && op !== "ilike" && op !== "not-like" && op !== "not-ilike"),
|
|
436
|
+
filterableRelationKinds: [],
|
|
437
|
+
supportsSQLAdmin: false,
|
|
438
|
+
supportsDocumentAdmin: false,
|
|
439
|
+
supportsSchemaAdmin: false
|
|
440
|
+
};
|
|
441
|
+
/** @group Models */
|
|
442
|
+
var MONGODB_CAPABILITIES = {
|
|
443
|
+
key: "mongodb",
|
|
444
|
+
label: "MongoDB",
|
|
445
|
+
supportsRelations: false,
|
|
446
|
+
supportsSubcollections: true,
|
|
447
|
+
supportsRLS: false,
|
|
448
|
+
supportsReferences: true,
|
|
449
|
+
supportsColumnTypes: false,
|
|
450
|
+
supportsRealtime: false,
|
|
451
|
+
supportsVectors: false,
|
|
452
|
+
filterOperators: ALL_WHERE_FILTER_OPS,
|
|
453
|
+
filterableRelationKinds: [],
|
|
454
|
+
supportsSQLAdmin: false,
|
|
455
|
+
supportsDocumentAdmin: true,
|
|
456
|
+
supportsSchemaAdmin: true
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* Fallback capabilities when the driver is unknown.
|
|
460
|
+
* Enables everything so nothing is hidden unexpectedly.
|
|
461
|
+
* @group Models
|
|
462
|
+
*/
|
|
463
|
+
var DEFAULT_CAPABILITIES = {
|
|
464
|
+
key: "(default)",
|
|
465
|
+
label: "Default",
|
|
466
|
+
supportsRelations: true,
|
|
467
|
+
supportsSubcollections: true,
|
|
468
|
+
supportsRLS: true,
|
|
469
|
+
supportsReferences: true,
|
|
470
|
+
supportsColumnTypes: true,
|
|
471
|
+
supportsRealtime: true,
|
|
472
|
+
supportsVectors: true,
|
|
473
|
+
filterOperators: ALL_WHERE_FILTER_OPS,
|
|
474
|
+
filterableRelationKinds: DEFAULT_FILTERABLE_RELATION_KINDS,
|
|
475
|
+
supportsSQLAdmin: true,
|
|
476
|
+
supportsDocumentAdmin: true,
|
|
477
|
+
supportsSchemaAdmin: true
|
|
478
|
+
};
|
|
479
|
+
var CAPABILITIES_REGISTRY = {
|
|
480
|
+
postgres: POSTGRES_CAPABILITIES,
|
|
481
|
+
firestore: FIREBASE_CAPABILITIES,
|
|
482
|
+
mongodb: MONGODB_CAPABILITIES,
|
|
483
|
+
"(default)": DEFAULT_CAPABILITIES
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Look up capabilities for a given engine key.
|
|
487
|
+
* If `engine` is undefined or not found, returns `DEFAULT_CAPABILITIES`.
|
|
488
|
+
* @group Models
|
|
489
|
+
*/
|
|
490
|
+
function getDataSourceCapabilities(engine) {
|
|
491
|
+
if (!engine) return POSTGRES_CAPABILITIES;
|
|
492
|
+
return CAPABILITIES_REGISTRY[engine] ?? DEFAULT_CAPABILITIES;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Register custom capabilities for a third-party driver.
|
|
496
|
+
* @group Models
|
|
497
|
+
*/
|
|
498
|
+
function registerDataSourceCapabilities(capabilities) {
|
|
499
|
+
CAPABILITIES_REGISTRY[capabilities.key] = capabilities;
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
379
502
|
//#region src/types/collections.ts
|
|
380
503
|
/**
|
|
381
504
|
* Type guard for PostgreSQL collections.
|
|
@@ -393,6 +516,29 @@ function isPostgresCollectionConfig(collection) {
|
|
|
393
516
|
return !collection.engine || collection.engine === "postgres";
|
|
394
517
|
}
|
|
395
518
|
/**
|
|
519
|
+
* Narrows to the SQL collection fields — `table`, `relations`,
|
|
520
|
+
* `disableDefaultPolicies` — by asking the engine's declared capabilities
|
|
521
|
+
* rather than by naming Postgres.
|
|
522
|
+
*
|
|
523
|
+
* The two halves of this already existed and were never joined. The engine
|
|
524
|
+
* split (`PostgresCollectionConfig` / `FirebaseCollectionConfig` /
|
|
525
|
+
* `MongoDBCollectionConfig`) said which fields belong to which engine at the
|
|
526
|
+
* type level; {@link DataSourceCapabilities} said the same thing at runtime,
|
|
527
|
+
* down to a `supportsRelations` flag. So call sites guarded on the capability
|
|
528
|
+
* and then read a field the base type had to declare for them — which is why
|
|
529
|
+
* those fields were on the base, and why a MongoDB collection could be written
|
|
530
|
+
* with a `table`.
|
|
531
|
+
*
|
|
532
|
+
* Prefer this over {@link isPostgresCollectionConfig} wherever the question is
|
|
533
|
+
* "does this collection live in a SQL table", so a custom SQL engine
|
|
534
|
+
* registered through `registerDataSourceCapabilities` is included.
|
|
535
|
+
*
|
|
536
|
+
* @group Models
|
|
537
|
+
*/
|
|
538
|
+
function isRelationalCollectionConfig(collection) {
|
|
539
|
+
return getDataSourceCapabilities(collection.engine).supportsRelations;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
396
542
|
* Type guard for Firebase / Firestore collections.
|
|
397
543
|
* @group Models
|
|
398
544
|
*/
|
|
@@ -562,120 +708,6 @@ function isChannelBusInstance(setting) {
|
|
|
562
708
|
return typeof setting?.publish === "function";
|
|
563
709
|
}
|
|
564
710
|
//#endregion
|
|
565
|
-
//#region src/types/data_source.ts
|
|
566
|
-
/**
|
|
567
|
-
* The default data-source key, used when a collection does not name a
|
|
568
|
-
* `dataSource`. Shared by the frontend router and the backend driver
|
|
569
|
-
* registry so both agree on "the default database".
|
|
570
|
-
* @group Models
|
|
571
|
-
*/
|
|
572
|
-
var DEFAULT_DATA_SOURCE_KEY = "(default)";
|
|
573
|
-
/**
|
|
574
|
-
* Relation kinds assumed filterable when a driver does not say.
|
|
575
|
-
*
|
|
576
|
-
* `belongsTo` alone: its filter is a comparison on a column of the row being
|
|
577
|
-
* filtered, the one shape that needs no query construction a driver might not
|
|
578
|
-
* have. Everything else is a correlated subquery over another table.
|
|
579
|
-
*
|
|
580
|
-
* @group Models
|
|
581
|
-
*/
|
|
582
|
-
var DEFAULT_FILTERABLE_RELATION_KINDS = ["belongsTo"];
|
|
583
|
-
/** @group Models */
|
|
584
|
-
var POSTGRES_CAPABILITIES = {
|
|
585
|
-
key: "postgres",
|
|
586
|
-
label: "PostgreSQL",
|
|
587
|
-
supportsRelations: true,
|
|
588
|
-
supportsSubcollections: false,
|
|
589
|
-
supportsRLS: true,
|
|
590
|
-
supportsReferences: false,
|
|
591
|
-
supportsColumnTypes: true,
|
|
592
|
-
supportsRealtime: true,
|
|
593
|
-
filterOperators: ALL_WHERE_FILTER_OPS,
|
|
594
|
-
filterableRelationKinds: [
|
|
595
|
-
"belongsTo",
|
|
596
|
-
"manyToMany",
|
|
597
|
-
"hasMany",
|
|
598
|
-
"hasOne"
|
|
599
|
-
],
|
|
600
|
-
supportsSQLAdmin: true,
|
|
601
|
-
supportsDocumentAdmin: false,
|
|
602
|
-
supportsSchemaAdmin: true
|
|
603
|
-
};
|
|
604
|
-
/** @group Models */
|
|
605
|
-
var FIREBASE_CAPABILITIES = {
|
|
606
|
-
key: "firestore",
|
|
607
|
-
label: "Firebase / Firestore",
|
|
608
|
-
supportsRelations: false,
|
|
609
|
-
supportsSubcollections: true,
|
|
610
|
-
supportsRLS: false,
|
|
611
|
-
supportsReferences: true,
|
|
612
|
-
supportsColumnTypes: false,
|
|
613
|
-
supportsRealtime: true,
|
|
614
|
-
filterOperators: ALL_WHERE_FILTER_OPS.filter((op) => op !== "like" && op !== "ilike" && op !== "not-like" && op !== "not-ilike"),
|
|
615
|
-
filterableRelationKinds: [],
|
|
616
|
-
supportsSQLAdmin: false,
|
|
617
|
-
supportsDocumentAdmin: false,
|
|
618
|
-
supportsSchemaAdmin: false
|
|
619
|
-
};
|
|
620
|
-
/** @group Models */
|
|
621
|
-
var MONGODB_CAPABILITIES = {
|
|
622
|
-
key: "mongodb",
|
|
623
|
-
label: "MongoDB",
|
|
624
|
-
supportsRelations: false,
|
|
625
|
-
supportsSubcollections: true,
|
|
626
|
-
supportsRLS: false,
|
|
627
|
-
supportsReferences: true,
|
|
628
|
-
supportsColumnTypes: false,
|
|
629
|
-
supportsRealtime: false,
|
|
630
|
-
filterOperators: ALL_WHERE_FILTER_OPS,
|
|
631
|
-
filterableRelationKinds: [],
|
|
632
|
-
supportsSQLAdmin: false,
|
|
633
|
-
supportsDocumentAdmin: true,
|
|
634
|
-
supportsSchemaAdmin: true
|
|
635
|
-
};
|
|
636
|
-
/**
|
|
637
|
-
* Fallback capabilities when the driver is unknown.
|
|
638
|
-
* Enables everything so nothing is hidden unexpectedly.
|
|
639
|
-
* @group Models
|
|
640
|
-
*/
|
|
641
|
-
var DEFAULT_CAPABILITIES = {
|
|
642
|
-
key: "(default)",
|
|
643
|
-
label: "Default",
|
|
644
|
-
supportsRelations: true,
|
|
645
|
-
supportsSubcollections: true,
|
|
646
|
-
supportsRLS: true,
|
|
647
|
-
supportsReferences: true,
|
|
648
|
-
supportsColumnTypes: true,
|
|
649
|
-
supportsRealtime: true,
|
|
650
|
-
filterOperators: ALL_WHERE_FILTER_OPS,
|
|
651
|
-
filterableRelationKinds: DEFAULT_FILTERABLE_RELATION_KINDS,
|
|
652
|
-
supportsSQLAdmin: true,
|
|
653
|
-
supportsDocumentAdmin: true,
|
|
654
|
-
supportsSchemaAdmin: true
|
|
655
|
-
};
|
|
656
|
-
var CAPABILITIES_REGISTRY = {
|
|
657
|
-
postgres: POSTGRES_CAPABILITIES,
|
|
658
|
-
firestore: FIREBASE_CAPABILITIES,
|
|
659
|
-
mongodb: MONGODB_CAPABILITIES,
|
|
660
|
-
"(default)": DEFAULT_CAPABILITIES
|
|
661
|
-
};
|
|
662
|
-
/**
|
|
663
|
-
* Look up capabilities for a given engine key.
|
|
664
|
-
* If `engine` is undefined or not found, returns `DEFAULT_CAPABILITIES`.
|
|
665
|
-
* @group Models
|
|
666
|
-
*/
|
|
667
|
-
function getDataSourceCapabilities(engine) {
|
|
668
|
-
if (!engine) return POSTGRES_CAPABILITIES;
|
|
669
|
-
return CAPABILITIES_REGISTRY[engine] ?? DEFAULT_CAPABILITIES;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Register custom capabilities for a third-party driver.
|
|
673
|
-
* @group Models
|
|
674
|
-
*/
|
|
675
|
-
function registerDataSourceCapabilities(capabilities) {
|
|
676
|
-
CAPABILITIES_REGISTRY[capabilities.key] = capabilities;
|
|
677
|
-
}
|
|
678
|
-
//#endregion
|
|
679
711
|
//#region src/types/storage_source.ts
|
|
680
712
|
/**
|
|
681
713
|
* Describes a named storage backend — a place files live.
|
|
@@ -1113,6 +1145,6 @@ function isPublicStoragePath(path) {
|
|
|
1113
1145
|
return p.startsWith("public/") || p.startsWith(`default/public/`);
|
|
1114
1146
|
}
|
|
1115
1147
|
//#endregion
|
|
1116
|
-
export { ADMIN_COLLECTION_KEYS, ADMIN_PROPERTY_KEYS, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, DEFAULT_CAPABILITIES, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_LIST_LIMIT, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_VECTOR_LIST_LIMIT, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, MAX_LIST_LIMIT, MONGODB_CAPABILITIES, NULL_OPS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REST_TO_CANONICAL, RUNTIME_CONTRACT_VERSION, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, Vector, canonicalSchemaPayload, computeSchemaVersion, deserializeCollections, findStorageSuffixCollision, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, hasForeignKeyOnTarget, isBranchAdmin, isChannelBusInstance, isDocumentAdmin, isFirebaseCollectionConfig, isLazyComponentRef, isManyToMany, isMongoDBCollectionConfig, isPostgresCollectionConfig, isPublicStoragePath, isSQLAdmin, isSchemaAdmin, isSerializedCollectionRef, isToMany, normalizeStorageSources, policy, registerDataSourceCapabilities, resolveClientListLimit, serializeCollections, storageEnvSuffix, toCanonicalOp };
|
|
1148
|
+
export { ADMIN_COLLECTION_KEYS, ADMIN_PROPERTY_KEYS, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, DEFAULT_CAPABILITIES, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_LIST_LIMIT, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_VECTOR_LIST_LIMIT, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, MAX_LIST_LIMIT, MONGODB_CAPABILITIES, NULL_OPS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REST_TO_CANONICAL, RUNTIME_CONTRACT_VERSION, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, Vector, canonicalSchemaPayload, computeSchemaVersion, deserializeCollections, findStorageSuffixCollision, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, hasForeignKeyOnTarget, isBranchAdmin, isChannelBusInstance, isDocumentAdmin, isFirebaseCollectionConfig, isLazyComponentRef, isManyToMany, isMongoDBCollectionConfig, isPostgresCollectionConfig, isPublicStoragePath, isRelationalCollectionConfig, isSQLAdmin, isSchemaAdmin, isSerializedCollectionRef, isToMany, normalizeStorageSources, policy, registerDataSourceCapabilities, resolveClientListLimit, serializeCollections, storageEnvSuffix, toCanonicalOp };
|
|
1117
1149
|
|
|
1118
1150
|
//# sourceMappingURL=index.es.js.map
|