@rebasepro/types 0.16.0 → 0.16.1-canary.g2d1aec8

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.
@@ -1,8 +1,8 @@
1
- import type { DataDriver } from "./controllers/data_driver";
2
- import type { StorageSource } from "./controllers/storage";
3
- import type { RebaseClient } from "./controllers/client";
4
- import type { RebaseSdkData } from "./controllers/data";
5
- import type { User } from "./users";
1
+ import type { DataDriver } from "./controllers/data_driver.js";
2
+ import type { StorageSource } from "./controllers/storage.js";
3
+ import type { RebaseClient } from "./controllers/client.js";
4
+ import type { RebaseSdkData } from "./controllers/data.js";
5
+ import type { User } from "./users/index.js";
6
6
  /**
7
7
  * Context that is provided to entity callbacks (hooks).
8
8
  * It contains only the dependencies that are available in both the frontend and the backend.
@@ -1,4 +1,4 @@
1
- import type { User } from "../users";
1
+ import type { User } from "../users/index.js";
2
2
  /**
3
3
  * The read-only slice of authentication state that property resolution needs.
4
4
  *
@@ -1,11 +1,11 @@
1
- import type { User } from "../users";
2
- import type { RebaseSdkData } from "./data";
3
- import type { EmailService } from "./email";
4
- import type { StorageSource } from "./storage";
5
- import type { CronJobStatus, CronJobLogEntry } from "../types/cron";
6
- import type { BackupInfo, BackupDestinationKind } from "../types/backup";
7
- import type { ApiKeysAPI } from "../types/api_keys";
8
- import type { StorageSourceDefinition } from "../types/storage_source";
1
+ import type { User } from "../users/index.js";
2
+ import type { RebaseSdkData } from "./data.js";
3
+ import type { EmailService } from "./email.js";
4
+ import type { StorageSource } from "./storage.js";
5
+ import type { CronJobStatus, CronJobLogEntry } from "../types/cron.js";
6
+ import type { BackupInfo, BackupDestinationKind } from "../types/backup.js";
7
+ import type { ApiKeysAPI } from "../types/api_keys.js";
8
+ import type { StorageSourceDefinition } from "../types/storage_source.js";
9
9
  /**
10
10
  * Event type for authentication state changes
11
11
  */
@@ -443,6 +443,19 @@ export interface RebaseServerClient<DB = unknown> extends Omit<RebaseClient<DB>,
443
443
  * Execute raw SQL against the database. Always present server-side for SQL
444
444
  * engines. Values interpolated into the query should be passed via
445
445
  * `params`, referenced as `$1`, `$2`, … placeholders in the query text.
446
+ *
447
+ * **Runtime note.** This is the one accessor on this object that is not
448
+ * portable. It runs on the database owner connection over a TCP socket, so
449
+ * it is available wherever the framework holds that connection — every Node
450
+ * deployment, self-hosted or managed — and not on a host that has no
451
+ * sockets and no business holding owner credentials.
452
+ *
453
+ * Nothing about that is a problem for a Node deployment, and it is not a
454
+ * reason to avoid it there. It is a reason not to build a function's *only*
455
+ * data path on it if that function may later move: `c.get("driver")` and
456
+ * `rebase.dataAsAdmin` go over the same wire wherever they run. A function
457
+ * that genuinely needs raw SQL can ask `runtimeKey()` and degrade, rather
458
+ * than discovering it at the call.
446
459
  */
447
460
  sql(query: string, options?: {
448
461
  database?: string;
@@ -1,5 +1,5 @@
1
- import type { CollectionConfig } from "../types/collections";
2
- import type { EntityReference } from "../types/entities";
1
+ import type { CollectionConfig } from "../types/collections.js";
2
+ import type { EntityReference } from "../types/entities.js";
3
3
  /**
4
4
  * Controller that provides access to the registered entity collections.
5
5
  * @group Models
@@ -1,7 +1,7 @@
1
- import type { VectorSearchParams } from "./data_driver";
2
- import type { ComputedSortField, SearchMatch } from "../types/search";
3
- import { Entity, EntityValues } from "../types/entities";
4
- import { WhereFilterOp, FieldPath, FilterValues, OrderBySpec } from "../types/filter-operators";
1
+ import type { VectorSearchParams } from "./data_driver.js";
2
+ import type { ComputedSortField, SearchMatch } from "../types/search.js";
3
+ import { Entity, EntityValues } from "../types/entities.js";
4
+ import { WhereFilterOp, FieldPath, FilterValues, OrderBySpec } from "../types/filter-operators.js";
5
5
  /**
6
6
  * Operator-blind filter value: whatever the column holds, a list of it, or null.
7
7
  *
@@ -1,9 +1,9 @@
1
- import { RebaseApiError } from "../errors";
2
- import type { EntityStatus, EntityValues } from "../types/entities";
3
- import type { CollectionConfig, FilterValues } from "../types/collections";
4
- import type { OrderByTuple } from "../types/filter-operators";
5
- import type { RebaseCallContext } from "../call_context";
6
- import type { LogicalCondition } from "./data";
1
+ import { RebaseApiError } from "../errors.js";
2
+ import type { EntityStatus, EntityValues } from "../types/entities.js";
3
+ import type { CollectionConfig, FilterValues } from "../types/collections.js";
4
+ import type { OrderByTuple } from "../types/filter-operators.js";
5
+ import type { RebaseCallContext } from "../call_context.js";
6
+ import type { LogicalCondition } from "./data.js";
7
7
  /**
8
8
  * @internal
9
9
  */
@@ -384,7 +384,7 @@ export interface DataDriver {
384
384
  * @see DocumentAdmin
385
385
  * @see SchemaAdmin
386
386
  */
387
- admin?: import("../types/backend").DatabaseAdmin;
387
+ admin?: import("../types/backend.js").DatabaseAdmin;
388
388
  }
389
389
  /**
390
390
  * REST-optimised fetch service exposed by drivers that support
@@ -7,5 +7,5 @@
7
7
  *
8
8
  * @group Admin
9
9
  */
10
- export type { SQLAdmin, DocumentAdmin, SchemaAdmin, DatabaseAdmin, HealthCheckResult } from "../types/backend";
11
- export { isSQLAdmin, isDocumentAdmin, isSchemaAdmin } from "../types/backend";
10
+ export type { SQLAdmin, DocumentAdmin, SchemaAdmin, DatabaseAdmin, HealthCheckResult } from "../types/backend.js";
11
+ export { isSQLAdmin, isDocumentAdmin, isSchemaAdmin } from "../types/backend.js";
@@ -1,9 +1,9 @@
1
- export * from "./collection_registry";
2
- export * from "./auth_state";
3
- export * from "./data";
4
- export * from "./database_admin";
5
- export * from "./data_driver";
6
- export * from "./effective_role";
7
- export * from "./storage";
8
- export * from "./email";
9
- export * from "./client";
1
+ export * from "./collection_registry.js";
2
+ export * from "./auth_state.js";
3
+ export * from "./data.js";
4
+ export * from "./database_admin.js";
5
+ export * from "./data_driver.js";
6
+ export * from "./effective_role.js";
7
+ export * from "./storage.js";
8
+ export * from "./email.js";
9
+ export * from "./client.js";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from "./errors";
2
- export * from "./call_context";
3
- export * from "./types";
4
- export * from "./controllers";
5
- export * from "./users";
1
+ export * from "./errors.js";
2
+ export * from "./call_context.js";
3
+ export * from "./types/index.js";
4
+ export * from "./controllers/index.js";
5
+ export * from "./users/index.js";
package/dist/index.es.js CHANGED
@@ -940,6 +940,20 @@ function usesLegacyRlsFunctions(sql) {
940
940
  //#endregion
941
941
  //#region src/types/backend.ts
942
942
  /**
943
+ * Type guard: can this admin plan a live schema change?
944
+ *
945
+ * Planning is engine-specific — it renders DDL, a Drizzle schema and the
946
+ * declarative SQL artifacts — so the implementation lives in the driver
947
+ * package. The server detects the capability structurally, exactly as it does
948
+ * for SQL, rather than importing an engine it is supposed to know nothing
949
+ * about.
950
+ *
951
+ * @group Admin
952
+ */
953
+ function isSchemaEditingAdmin(admin) {
954
+ return !!admin && typeof admin.planSchemaChange === "function";
955
+ }
956
+ /**
943
957
  * Type guard: does this admin support SQL operations?
944
958
  * @group Admin
945
959
  */
@@ -968,6 +982,14 @@ function isBranchAdmin(admin) {
968
982
  return !!admin && typeof admin.createBranch === "function";
969
983
  }
970
984
  //#endregion
985
+ //#region src/types/schema_editing.ts
986
+ var DEFAULT_COMMIT_PATHS = {
987
+ schemaFile: "backend/src/schema.generated.ts",
988
+ ddlFile: "drizzle/schema.sql",
989
+ policiesFile: "drizzle/policies.sql",
990
+ searchFile: "drizzle/search.sql"
991
+ };
992
+ //#endregion
971
993
  //#region src/types/channel_bus.ts
972
994
  /**
973
995
  * Whether `setting` is an already-constructed transport rather than a request
@@ -1445,6 +1467,6 @@ function isPublicStoragePath(path) {
1445
1467
  return p.startsWith("public/") || p.startsWith(`default/public/`);
1446
1468
  }
1447
1469
  //#endregion
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 };
1470
+ 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_COMMIT_PATHS, 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, isSchemaEditingAdmin, isSerializedCollectionRef, isToMany, nestAdminCollectionKeys, nestAdminKeysOf, nestAdminPropertyKeys, normalizeStorageSources, parseRelationAggregateSort, policy, registerDataSourceCapabilities, resolveClientListLimit, rewriteLegacyRlsFunctions, serializeCollections, sortKeyToString, storageEnvSuffix, toCanonicalOp, usesLegacyRlsFunctions };
1449
1471
 
1450
1472
  //# sourceMappingURL=index.es.js.map