@rebasepro/types 0.35.1 → 0.36.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/controllers/client.d.ts +6 -3
- package/dist/index.es.js +11 -1
- package/dist/index.es.js.map +1 -1
- package/dist/types/backend.d.ts +31 -0
- package/dist/users/import.d.ts +42 -3
- package/package.json +6 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImportUserInput, ImportUsersResult, User } from "../users/index.js";
|
|
1
|
+
import type { ImportedPasswordHashAlgorithm, ImportUserInput, ImportUsersResult, User } from "../users/index.js";
|
|
2
2
|
import type { ResourceRef } from "../types/resources.js";
|
|
3
3
|
import type { RebaseSdkData } from "./data.js";
|
|
4
4
|
import type { EmailService } from "./email.js";
|
|
@@ -258,12 +258,15 @@ export interface AdminAPI {
|
|
|
258
258
|
emailDeliveryFailed?: boolean;
|
|
259
259
|
}>;
|
|
260
260
|
/**
|
|
261
|
-
* Accounts from another system, keeping their ids; no
|
|
262
|
-
*
|
|
261
|
+
* Accounts from another system, keeping their ids; no email. No password
|
|
262
|
+
* either, unless each carries the other system's hash as `passwordHash`
|
|
263
|
+
* and `passwordHashAlgorithm` names its format (`"bcrypt"`). An id or
|
|
264
|
+
* email already taken is `skipped`, never updated. At most
|
|
263
265
|
* `MAX_USERS_PER_IMPORT` (100) per call.
|
|
264
266
|
*/
|
|
265
267
|
importUsers(users: ImportUserInput[], options?: {
|
|
266
268
|
dryRun?: boolean;
|
|
269
|
+
passwordHashAlgorithm?: ImportedPasswordHashAlgorithm;
|
|
267
270
|
}): Promise<ImportUsersResult>;
|
|
268
271
|
updateUser(uid: string, data: {
|
|
269
272
|
email?: string;
|
package/dist/index.es.js
CHANGED
|
@@ -2514,6 +2514,16 @@ function importedUserIdProblem(id) {
|
|
|
2514
2514
|
if (!/^[A-Za-z0-9][A-Za-z0-9_.:|-]*$/.test(id)) return "may hold only letters, digits and _ - . : |, starting with a letter or a digit";
|
|
2515
2515
|
if (RESERVED_USER_IDS.has(id.toLowerCase())) return "is reserved: it names a caller who is not an account";
|
|
2516
2516
|
}
|
|
2517
|
+
var IMPORTED_PASSWORD_HASH_ALGORITHMS = ["bcrypt"];
|
|
2518
|
+
function importedPasswordHashProblem(hash, algorithm) {
|
|
2519
|
+
if (typeof hash !== "string") return "is not a string";
|
|
2520
|
+
if (algorithm === "bcrypt") {
|
|
2521
|
+
const match = /^\$2[aby]\$(\d{2})\$[./A-Za-z0-9]{53}$/.exec(hash);
|
|
2522
|
+
if (!match) return "is not a bcrypt hash: one starts with $2a$, $2b$ or $2y$, then a two-digit cost and 53 characters";
|
|
2523
|
+
const cost = Number(match[1]);
|
|
2524
|
+
if (cost < 4 || cost > 31) return `has a bcrypt cost of ${cost}, outside 4 to 31`;
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2517
2527
|
//#endregion
|
|
2518
2528
|
//#region src/schema/column_type.ts
|
|
2519
2529
|
var TEXT_KINDS = [
|
|
@@ -3882,6 +3892,6 @@ function rulePatches(table, before, after) {
|
|
|
3882
3892
|
return out;
|
|
3883
3893
|
}
|
|
3884
3894
|
//#endregion
|
|
3885
|
-
export { ADMIN_ROLE, ADMIN_SCOPES, AGGREGATE_FUNCTIONS, AGGREGATE_GROUP_TRANSFORMS, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, ANONYMOUS_USER_IDS, AUTH_FLOW_HEADER, BATCH_REF_KEY, BUILT_IN_SCOPES, BUILT_IN_SCOPE_DESCRIPTIONS, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, COLUMN_BRAND, ColumnBuilder, DATA_PLANE_SCOPES, DEFAULT_CAPABILITIES, DEFAULT_COMMIT_PATHS, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_FUZZY_THRESHOLD, DEFAULT_LIST_LIMIT, DEFAULT_PUBLIC_RPC_RATE_LIMIT, DEFAULT_RESOURCE_KEY, DEFAULT_SEARCH_COLUMN, DEFAULT_SEARCH_LANGUAGE, DEFAULT_SEARCH_MODE, DEFAULT_SEARCH_WEIGHT, DEFAULT_STATIC_REDIRECT_STATUS, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_TENANT_BYPASS_ROLES, DEFAULT_VECTOR_LIST_LIMIT, EMPTY_ACCESS_MODEL, FIELDLESS_AGGREGATES, FIELD_OPERATORS, FIREBASE_CAPABILITIES, IMPERSONATE_HEADER, INCLUDE_COUNT_KEY, JSON_FIELD_BRAND, JUNCTION_PIVOT_KEY, JsonField, KEY_MANAGEMENT_SCOPES, LEGACY_LAYOUT_REMEDY, LEGACY_RLS_JWT_SQL, LEGACY_RLS_ROLES_SQL, LEGACY_RLS_SCHEMA, LEGACY_RLS_UID_SQL, LEGACY_SCHEMA_VERSION_PREFIX, LIST_OPS, ListLimitError, MAX_IMPORTED_USER_ID_LENGTH, MAX_INCLUDE_DEPTH, MAX_LIST_LIMIT, MAX_USERS_PER_IMPORT, MCP_APP_MODULES, NULL_OPS, POLICY_EXPRESSION_KINDS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REBASE_ADMIN_REQUEST_ROLE, REBASE_ADMIN_ROLE, REBASE_SCHEMA, RECOMMENDED_STORAGE_RULES, RELATION_BRAND, RELEVANCE_SORT_FIELD, RESERVED_BACKEND_PREFIXES, RESOURCE_GRAPH_VERSION, REST_TO_CANONICAL, RLS_IS_ANONYMOUS_SQL, RLS_IS_REQUEST_ROLE_SQL, RLS_JWT_SQL, RLS_ROLES_SQL, RLS_UID_SQL, RPC_BRAND, RUNTIME_CONTRACT_VERSION, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, SCOPE_TARGETS, SIMULATED_CONTEXT_HEADER, SIMULATE_API_KEY_ID_HEADER, SIMULATE_ROLE_HEADER, SIMULATE_USER_ID_HEADER, STATIC_REDIRECT_STATUSES, STORAGE_REFERENCE_SCHEME, TABLE_BRAND, TABLE_OPTION_KEYS, TablePatchError, UI_PREFERENCE_FIELD_KEYS, UI_PREFERENCE_TABLE_KEYS, VIEW_BRAND, adminRequestRoleFor, aggregateAlias, aggregateGroupKey, amendResourceKind, bucket, buildResourceGraph, canonicalSchemaPayload, cleanUrlFor, col, columnDefFromWire, columnTypeLabel, compareStaticRoutes, compileStaticRedirects, computeSchemaVersion, database, declareCron, declareFunction, declareResource, declaredDataSources, declaredDatabaseExtensions, declaredDatabaseRls, declaredQueueConsumers, declaredResources, declaredRlsPolicyShape, declaredStorageSources, declaredSubscriptions, defineAuthTable, defineRpc, defineTable, defineView, describeJsonShape, describeScope, encodeRelationAggregateSort, envBasesForResource, findEnvSuffixCollision, findStorageSuffixCollision, formatSimulatedContext, getDataSourceCapabilities, hasAdminRole, hasFieldOperation, holdsAdminRole, importedUserIdProblem, intersectScopes, isAdminScope, isAnonymousUid, isAuthTableDef, isBranchAdmin, isBuiltInScope, isChannelBusInstance, isColumnBuilder, isContentHashedFileName, isDataPlaneScope, isFieldOperation, isJsonColumnType, isJsonField, isNumericColumnType, isPercentileFraction, isPolicyExpressionKind, isPolicyShorthand, isPublicStorageKey, isPublicStoragePath, isRedactedSecurityRule, isRelationAggregateSort, isRelationDef, isResourceHandle, isRpcDef, isSQLAdmin, isSchemaAdmin, isSchemaEditingAdmin, isSqlTemplate, isStaticRedirectStatus, isStorageReference, isTableDef, isTablePatchList, isTemporalColumnType, isTenantClaimSource, isTenantMembershipSource, isTextColumnType, isTimeZoneName, isUiTablePreferences, isUnsupported, isValidAppHost, isValidEngine, isViewDef, joinConditions, json, knownScopes, matchStaticRoute, mergeUiTablePreferences, normalizeColumnAccess, normalizeStorage, normalizeValidation, parseAppAddress, parseByteSize, parseCaseFoldedFieldPath, parseEnvBoolean, parseFrameAncestor, parseRelationAggregateSort, parseScope, parseSimulatedContext, parseStorageReference, parseTablePatches, pgEnum, policy, queue, registerDataSourceCapabilities, registerResourceKind, rel, reservedPrefixFor, resetDeclaredQueueConsumers, resetDeclaredResources, resetDeclaredSubscriptions, resolveClientListLimit, resolveResourceRefs, resolveStorageReferences, resourceEnvSuffix, resourceId, resourceKeyOf, resourceKind, resourceKinds, resourceToDataSource, resourceToStorageSource, rewriteLegacyRlsFunctions, roleNameProblem, rulePatches, scopeAcceptsTarget, scopeGrants, scopeGrantsAny, scopeTargets, scopesBeyond, scopesForRoles, setQueueRuntime, setTopicRuntime, simulationHeaders, soleJoinCondition, sortKeyToString, sql, storageEnvSuffix, storageObjectPath, storageReference, storageReferencesForDownloadUrls, storageTargetOfDownloadUrl, storageTargetsInText, summarizeRoles, summarizeScopes, tablePatchProblems, toCanonicalOp, toDriverAggregate, toDriverAggregateGroup, topic, uiTablePreferencesProblems, unsupportedMethod, usesLegacyRlsFunctions, validateScopes, validateStaticRedirect, validateStaticRoute };
|
|
3895
|
+
export { ADMIN_ROLE, ADMIN_SCOPES, AGGREGATE_FUNCTIONS, AGGREGATE_GROUP_TRANSFORMS, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, ANONYMOUS_USER_IDS, AUTH_FLOW_HEADER, BATCH_REF_KEY, BUILT_IN_SCOPES, BUILT_IN_SCOPE_DESCRIPTIONS, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, COLUMN_BRAND, ColumnBuilder, DATA_PLANE_SCOPES, DEFAULT_CAPABILITIES, DEFAULT_COMMIT_PATHS, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_FUZZY_THRESHOLD, DEFAULT_LIST_LIMIT, DEFAULT_PUBLIC_RPC_RATE_LIMIT, DEFAULT_RESOURCE_KEY, DEFAULT_SEARCH_COLUMN, DEFAULT_SEARCH_LANGUAGE, DEFAULT_SEARCH_MODE, DEFAULT_SEARCH_WEIGHT, DEFAULT_STATIC_REDIRECT_STATUS, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_TENANT_BYPASS_ROLES, DEFAULT_VECTOR_LIST_LIMIT, EMPTY_ACCESS_MODEL, FIELDLESS_AGGREGATES, FIELD_OPERATORS, FIREBASE_CAPABILITIES, IMPERSONATE_HEADER, IMPORTED_PASSWORD_HASH_ALGORITHMS, INCLUDE_COUNT_KEY, JSON_FIELD_BRAND, JUNCTION_PIVOT_KEY, JsonField, KEY_MANAGEMENT_SCOPES, LEGACY_LAYOUT_REMEDY, LEGACY_RLS_JWT_SQL, LEGACY_RLS_ROLES_SQL, LEGACY_RLS_SCHEMA, LEGACY_RLS_UID_SQL, LEGACY_SCHEMA_VERSION_PREFIX, LIST_OPS, ListLimitError, MAX_IMPORTED_USER_ID_LENGTH, MAX_INCLUDE_DEPTH, MAX_LIST_LIMIT, MAX_USERS_PER_IMPORT, MCP_APP_MODULES, NULL_OPS, POLICY_EXPRESSION_KINDS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REBASE_ADMIN_REQUEST_ROLE, REBASE_ADMIN_ROLE, REBASE_SCHEMA, RECOMMENDED_STORAGE_RULES, RELATION_BRAND, RELEVANCE_SORT_FIELD, RESERVED_BACKEND_PREFIXES, RESOURCE_GRAPH_VERSION, REST_TO_CANONICAL, RLS_IS_ANONYMOUS_SQL, RLS_IS_REQUEST_ROLE_SQL, RLS_JWT_SQL, RLS_ROLES_SQL, RLS_UID_SQL, RPC_BRAND, RUNTIME_CONTRACT_VERSION, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, SCOPE_TARGETS, SIMULATED_CONTEXT_HEADER, SIMULATE_API_KEY_ID_HEADER, SIMULATE_ROLE_HEADER, SIMULATE_USER_ID_HEADER, STATIC_REDIRECT_STATUSES, STORAGE_REFERENCE_SCHEME, TABLE_BRAND, TABLE_OPTION_KEYS, TablePatchError, UI_PREFERENCE_FIELD_KEYS, UI_PREFERENCE_TABLE_KEYS, VIEW_BRAND, adminRequestRoleFor, aggregateAlias, aggregateGroupKey, amendResourceKind, bucket, buildResourceGraph, canonicalSchemaPayload, cleanUrlFor, col, columnDefFromWire, columnTypeLabel, compareStaticRoutes, compileStaticRedirects, computeSchemaVersion, database, declareCron, declareFunction, declareResource, declaredDataSources, declaredDatabaseExtensions, declaredDatabaseRls, declaredQueueConsumers, declaredResources, declaredRlsPolicyShape, declaredStorageSources, declaredSubscriptions, defineAuthTable, defineRpc, defineTable, defineView, describeJsonShape, describeScope, encodeRelationAggregateSort, envBasesForResource, findEnvSuffixCollision, findStorageSuffixCollision, formatSimulatedContext, getDataSourceCapabilities, hasAdminRole, hasFieldOperation, holdsAdminRole, importedPasswordHashProblem, importedUserIdProblem, intersectScopes, isAdminScope, isAnonymousUid, isAuthTableDef, isBranchAdmin, isBuiltInScope, isChannelBusInstance, isColumnBuilder, isContentHashedFileName, isDataPlaneScope, isFieldOperation, isJsonColumnType, isJsonField, isNumericColumnType, isPercentileFraction, isPolicyExpressionKind, isPolicyShorthand, isPublicStorageKey, isPublicStoragePath, isRedactedSecurityRule, isRelationAggregateSort, isRelationDef, isResourceHandle, isRpcDef, isSQLAdmin, isSchemaAdmin, isSchemaEditingAdmin, isSqlTemplate, isStaticRedirectStatus, isStorageReference, isTableDef, isTablePatchList, isTemporalColumnType, isTenantClaimSource, isTenantMembershipSource, isTextColumnType, isTimeZoneName, isUiTablePreferences, isUnsupported, isValidAppHost, isValidEngine, isViewDef, joinConditions, json, knownScopes, matchStaticRoute, mergeUiTablePreferences, normalizeColumnAccess, normalizeStorage, normalizeValidation, parseAppAddress, parseByteSize, parseCaseFoldedFieldPath, parseEnvBoolean, parseFrameAncestor, parseRelationAggregateSort, parseScope, parseSimulatedContext, parseStorageReference, parseTablePatches, pgEnum, policy, queue, registerDataSourceCapabilities, registerResourceKind, rel, reservedPrefixFor, resetDeclaredQueueConsumers, resetDeclaredResources, resetDeclaredSubscriptions, resolveClientListLimit, resolveResourceRefs, resolveStorageReferences, resourceEnvSuffix, resourceId, resourceKeyOf, resourceKind, resourceKinds, resourceToDataSource, resourceToStorageSource, rewriteLegacyRlsFunctions, roleNameProblem, rulePatches, scopeAcceptsTarget, scopeGrants, scopeGrantsAny, scopeTargets, scopesBeyond, scopesForRoles, setQueueRuntime, setTopicRuntime, simulationHeaders, soleJoinCondition, sortKeyToString, sql, storageEnvSuffix, storageObjectPath, storageReference, storageReferencesForDownloadUrls, storageTargetOfDownloadUrl, storageTargetsInText, summarizeRoles, summarizeScopes, tablePatchProblems, toCanonicalOp, toDriverAggregate, toDriverAggregateGroup, topic, uiTablePreferencesProblems, unsupportedMethod, usesLegacyRlsFunctions, validateScopes, validateStaticRedirect, validateStaticRoute };
|
|
3886
3896
|
|
|
3887
3897
|
//# sourceMappingURL=index.es.js.map
|