@koolbase/core 12.28.0 → 12.30.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/cjs/auth.js CHANGED
@@ -4,6 +4,7 @@ exports.KoolbaseAuth = void 0;
4
4
  const network_js_1 = require("./network.js");
5
5
  const types_js_1 = require("./types.js");
6
6
  const auth_errors_js_1 = require("./auth-errors.js");
7
+ const errors_js_1 = require("./errors.js");
7
8
  const platform_js_1 = require("./platform.js");
8
9
  const device_metadata_js_1 = require("./device-metadata.js");
9
10
  /** The server's `{ bucket, path }`; undefined when it is not one. */
@@ -1315,6 +1316,8 @@ class KoolbaseAuth {
1315
1316
  throw new auth_errors_js_1.InvalidCredentialsError();
1316
1317
  case 'email_in_use':
1317
1318
  throw new auth_errors_js_1.EmailAlreadyInUseError();
1319
+ case 'placement_unavailable':
1320
+ throw new errors_js_1.KoolbaseServiceUnavailableError(msg || undefined);
1318
1321
  case 'account_disabled':
1319
1322
  throw new auth_errors_js_1.UserDisabledError();
1320
1323
  case 'account_locked':
@@ -134,6 +134,46 @@ export declare class KoolbaseFieldNotAutoEmbedError extends KoolbaseDataError {
134
134
  export declare class KoolbaseInvalidEmbeddingConfigError extends KoolbaseDataError {
135
135
  constructor(message?: string);
136
136
  }
137
+ /**
138
+ * The vector field is filled by automatic embedding: Koolbase makes its
139
+ * vectors from the record's fields, so the app cannot write one, delete one,
140
+ * or send text for it (a 409, `auto_embedding_managed`). Write the record's
141
+ * fields instead; the vector follows.
142
+ */
143
+ export declare class KoolbaseAutoEmbeddingManagedError extends KoolbaseDataError {
144
+ constructor(message?: string);
145
+ }
146
+ /** What embedding a collection again costs, roughly (#162). */
147
+ export interface KoolbaseReembedEstimate {
148
+ records: number;
149
+ records_to_embed: number;
150
+ estimated_input_tokens: number;
151
+ provider: string;
152
+ model: string;
153
+ dimensions: number;
154
+ billed_by: string;
155
+ estimate: boolean;
156
+ cache_may_apply: boolean;
157
+ sampled_records: number;
158
+ }
159
+ /**
160
+ * A change to a vector field's embedding would embed the collection again,
161
+ * and was not confirmed (a 409, `reembed_confirmation_required`). `estimate`
162
+ * says what it would cost; send the change again with `confirm_reembed: true`
163
+ * to make it.
164
+ */
165
+ export declare class KoolbaseReembedConfirmationRequiredError extends KoolbaseDataError {
166
+ readonly estimate?: KoolbaseReembedEstimate;
167
+ constructor(message?: string, estimate?: KoolbaseReembedEstimate);
168
+ }
169
+ /**
170
+ * The embedding model is not one Koolbase offers, has been shut down by its
171
+ * provider, or cannot store vectors of that size (a 400,
172
+ * `embedding_model_unsupported`).
173
+ */
174
+ export declare class KoolbaseEmbeddingModelUnsupportedError extends KoolbaseDataError {
175
+ constructor(message?: string);
176
+ }
137
177
  /**
138
178
  * The project has no embedding provider configured. Embedding runs on the
139
179
  * project's own Gemini or OpenAI key.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KoolbaseVectorDimensionMismatchError = exports.KoolbaseRateLimitError = exports.KoolbasePermissionError = exports.KoolbaseInsufficientAuthorityError = exports.KoolbaseValidationError = exports.KoolbaseNotFoundError = exports.KoolbaseCollectionReferencedError = exports.KoolbaseDanglingReferencesError = exports.KoolbaseReferenceInUseError = exports.KoolbaseReferenceInvalidError = exports.KoolbaseConflictError = exports.KoolbaseConstraintNotFoundError = exports.KoolbaseConstraintExistsError = exports.KoolbaseAmbiguousMatchError = exports.KoolbaseDuplicateValuesError = exports.KoolbaseBatchFailedError = exports.KoolbaseIdempotencyKeyReusedError = exports.KoolbaseRevisionMismatchError = exports.KoolbaseProviderInvalidError = exports.KoolbaseProviderNotConfiguredError = exports.KoolbaseInvalidEmbeddingConfigError = exports.KoolbaseFieldNotAutoEmbedError = exports.KoolbaseVectorFieldExistsError = exports.KoolbaseStateConflictError = exports.KoolbaseNoChangesError = exports.KoolbaseInvalidBodyError = exports.KoolbaseProjectInvalidError = exports.KoolbaseInvitationInvalidError = exports.KoolbaseSlugTakenError = exports.KoolbaseSeedError = exports.KoolbaseDataError = void 0;
3
+ exports.KoolbaseVectorDimensionMismatchError = exports.KoolbaseRateLimitError = exports.KoolbasePermissionError = exports.KoolbaseInsufficientAuthorityError = exports.KoolbaseValidationError = exports.KoolbaseNotFoundError = exports.KoolbaseCollectionReferencedError = exports.KoolbaseDanglingReferencesError = exports.KoolbaseReferenceInUseError = exports.KoolbaseReferenceInvalidError = exports.KoolbaseConflictError = exports.KoolbaseConstraintNotFoundError = exports.KoolbaseConstraintExistsError = exports.KoolbaseAmbiguousMatchError = exports.KoolbaseDuplicateValuesError = exports.KoolbaseBatchFailedError = exports.KoolbaseIdempotencyKeyReusedError = exports.KoolbaseRevisionMismatchError = exports.KoolbaseProviderInvalidError = exports.KoolbaseProviderNotConfiguredError = exports.KoolbaseEmbeddingModelUnsupportedError = exports.KoolbaseReembedConfirmationRequiredError = exports.KoolbaseAutoEmbeddingManagedError = exports.KoolbaseInvalidEmbeddingConfigError = exports.KoolbaseFieldNotAutoEmbedError = exports.KoolbaseVectorFieldExistsError = exports.KoolbaseStateConflictError = exports.KoolbaseNoChangesError = exports.KoolbaseInvalidBodyError = exports.KoolbaseProjectInvalidError = exports.KoolbaseInvitationInvalidError = exports.KoolbaseSlugTakenError = exports.KoolbaseSeedError = exports.KoolbaseDataError = void 0;
4
4
  exports.koolbaseDataError = koolbaseDataError;
5
5
  const errors_js_1 = require("./errors.js");
6
6
  /**
@@ -187,6 +187,48 @@ class KoolbaseInvalidEmbeddingConfigError extends KoolbaseDataError {
187
187
  }
188
188
  }
189
189
  exports.KoolbaseInvalidEmbeddingConfigError = KoolbaseInvalidEmbeddingConfigError;
190
+ /**
191
+ * The vector field is filled by automatic embedding: Koolbase makes its
192
+ * vectors from the record's fields, so the app cannot write one, delete one,
193
+ * or send text for it (a 409, `auto_embedding_managed`). Write the record's
194
+ * fields instead; the vector follows.
195
+ */
196
+ class KoolbaseAutoEmbeddingManagedError extends KoolbaseDataError {
197
+ constructor(message) {
198
+ super(message ?? 'This vector field is managed by automatic embedding and cannot be written manually.', 'auto_embedding_managed');
199
+ this.name = 'KoolbaseAutoEmbeddingManagedError';
200
+ Object.setPrototypeOf(this, KoolbaseAutoEmbeddingManagedError.prototype);
201
+ }
202
+ }
203
+ exports.KoolbaseAutoEmbeddingManagedError = KoolbaseAutoEmbeddingManagedError;
204
+ /**
205
+ * A change to a vector field's embedding would embed the collection again,
206
+ * and was not confirmed (a 409, `reembed_confirmation_required`). `estimate`
207
+ * says what it would cost; send the change again with `confirm_reembed: true`
208
+ * to make it.
209
+ */
210
+ class KoolbaseReembedConfirmationRequiredError extends KoolbaseDataError {
211
+ constructor(message, estimate) {
212
+ super(message ?? 'This change embeds every record again; confirm it with confirm_reembed', 'reembed_confirmation_required');
213
+ this.estimate = estimate;
214
+ this.name = 'KoolbaseReembedConfirmationRequiredError';
215
+ Object.setPrototypeOf(this, KoolbaseReembedConfirmationRequiredError.prototype);
216
+ }
217
+ }
218
+ exports.KoolbaseReembedConfirmationRequiredError = KoolbaseReembedConfirmationRequiredError;
219
+ /**
220
+ * The embedding model is not one Koolbase offers, has been shut down by its
221
+ * provider, or cannot store vectors of that size (a 400,
222
+ * `embedding_model_unsupported`).
223
+ */
224
+ class KoolbaseEmbeddingModelUnsupportedError extends KoolbaseDataError {
225
+ constructor(message) {
226
+ super(message ?? 'Embedding model not offered', 'embedding_model_unsupported');
227
+ this.name = 'KoolbaseEmbeddingModelUnsupportedError';
228
+ Object.setPrototypeOf(this, KoolbaseEmbeddingModelUnsupportedError.prototype);
229
+ }
230
+ }
231
+ exports.KoolbaseEmbeddingModelUnsupportedError = KoolbaseEmbeddingModelUnsupportedError;
190
232
  /**
191
233
  * The project has no embedding provider configured. Embedding runs on the
192
234
  * project's own Gemini or OpenAI key.
@@ -526,6 +568,14 @@ function koolbaseDataError(status, body, fallbackMessage = 'Request failed') {
526
568
  return attach(new KoolbaseFieldNotAutoEmbedError(message));
527
569
  case 'invalid_embedding_config':
528
570
  return attach(new KoolbaseInvalidEmbeddingConfigError(message));
571
+ case 'auto_embedding_managed':
572
+ return attach(new KoolbaseAutoEmbeddingManagedError(message));
573
+ case 'reembed_confirmation_required':
574
+ return attach(new KoolbaseReembedConfirmationRequiredError(message, body?.details));
575
+ case 'embedding_model_unsupported':
576
+ return attach(new KoolbaseEmbeddingModelUnsupportedError(message));
577
+ case 'placement_unavailable':
578
+ return new errors_js_1.KoolbaseServiceUnavailableError(message);
529
579
  case 'provider_not_configured':
530
580
  return attach(new KoolbaseProviderNotConfiguredError(message));
531
581
  case 'provider_invalid':
@@ -266,7 +266,9 @@ export declare class KoolbaseDatabase {
266
266
  *
267
267
  * The field must already be declared on the collection via the dashboard
268
268
  * or CLI. `vector.length` must match the field's declared dimension;
269
- * otherwise throws `KoolbaseVectorDimensionMismatchError`.
269
+ * otherwise throws `KoolbaseVectorDimensionMismatchError`. A field Koolbase
270
+ * embeds itself refuses it with `KoolbaseAutoEmbeddingManagedError`: write
271
+ * the record's fields instead.
270
272
  *
271
273
  * Online-only — vectors are not cached locally or queued offline because
272
274
  * HNSW similarity search has no useful offline semantics.
@@ -918,7 +918,9 @@ class KoolbaseDatabase {
918
918
  *
919
919
  * The field must already be declared on the collection via the dashboard
920
920
  * or CLI. `vector.length` must match the field's declared dimension;
921
- * otherwise throws `KoolbaseVectorDimensionMismatchError`.
921
+ * otherwise throws `KoolbaseVectorDimensionMismatchError`. A field Koolbase
922
+ * embeds itself refuses it with `KoolbaseAutoEmbeddingManagedError`: write
923
+ * the record's fields instead.
922
924
  *
923
925
  * Online-only — vectors are not cached locally or queued offline because
924
926
  * HNSW similarity search has no useful offline semantics.
@@ -73,6 +73,19 @@ export declare class KoolbasePlanLimitError extends KoolbaseError {
73
73
  readonly plan?: string | undefined;
74
74
  constructor(message?: string, resource?: string | undefined, limit?: number | undefined, plan?: string | undefined);
75
75
  }
76
+ /**
77
+ * The project's database could not be reached just now, or which database it
78
+ * is could not be established (a 503, `placement_unavailable`). Koolbase never
79
+ * answers from another database in its place, so nothing was read or written:
80
+ * try again shortly.
81
+ *
82
+ * Shared: any request to the project -- a query, an upload, a sign-in -- can
83
+ * meet it.
84
+ */
85
+ export declare class KoolbaseServiceUnavailableError extends KoolbaseError {
86
+ readonly retryable = true;
87
+ constructor(message?: string);
88
+ }
76
89
  export declare class KoolbaseOfflineBaselineUnavailableError extends KoolbaseError {
77
90
  constructor(message: string);
78
91
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KoolbaseOfflineBaselineUnavailableError = exports.KoolbasePlanLimitError = exports.KoolbaseUnauthenticatedError = exports.KoolbaseError = void 0;
3
+ exports.KoolbaseOfflineBaselineUnavailableError = exports.KoolbaseServiceUnavailableError = exports.KoolbasePlanLimitError = exports.KoolbaseUnauthenticatedError = exports.KoolbaseError = void 0;
4
4
  /**
5
5
  * The root of every error the SDK raises.
6
6
  *
@@ -94,6 +94,24 @@ class KoolbasePlanLimitError extends KoolbaseError {
94
94
  }
95
95
  }
96
96
  exports.KoolbasePlanLimitError = KoolbasePlanLimitError;
97
+ /**
98
+ * The project's database could not be reached just now, or which database it
99
+ * is could not be established (a 503, `placement_unavailable`). Koolbase never
100
+ * answers from another database in its place, so nothing was read or written:
101
+ * try again shortly.
102
+ *
103
+ * Shared: any request to the project -- a query, an upload, a sign-in -- can
104
+ * meet it.
105
+ */
106
+ class KoolbaseServiceUnavailableError extends KoolbaseError {
107
+ constructor(message) {
108
+ super(message ?? "This project's database is temporarily unavailable. Please try again.", 'placement_unavailable');
109
+ this.retryable = true;
110
+ this.name = 'KoolbaseServiceUnavailableError';
111
+ Object.setPrototypeOf(this, KoolbaseServiceUnavailableError.prototype);
112
+ }
113
+ }
114
+ exports.KoolbaseServiceUnavailableError = KoolbaseServiceUnavailableError;
97
115
  class KoolbaseOfflineBaselineUnavailableError extends KoolbaseError {
98
116
  constructor(message) {
99
117
  super(message, 'offline_baseline_unavailable');
@@ -417,6 +417,8 @@ function koolbaseStorageError(status, body, fallbackMessage = 'Storage request f
417
417
  const d = (body?.details ?? {});
418
418
  return new errors_js_1.KoolbasePlanLimitError(message, d.resource, d.limit, d.plan);
419
419
  }
420
+ case 'placement_unavailable':
421
+ return new errors_js_1.KoolbaseServiceUnavailableError(message);
420
422
  case 'quota_exceeded':
421
423
  return new KoolbaseStorageQuotaError(message);
422
424
  case 'upload_expired':
package/dist/esm/auth.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { koolbaseFetch } from './network.js';
2
2
  import { RestoreResult, } from './types.js';
3
3
  import { AccountLockedError, EmailAlreadyInUseError, InvalidCredentialsError, InvalidPhoneNumberError, KoolbaseAuthError, OtpExpiredError, OtpInvalidError, OtpMaxAttemptsError, OtpRateLimitError, PhoneAlreadyLinkedError, IdentityNotFoundError, InsufficientScopeError, MalformedSessionResponseError, ProviderIdentityAlreadyLinkedError, AccountExistsError, ContactNotVerifiedError, CurrentPasswordIncorrectError, HideRequiresVerificationError, InsufficientAuthorityError, LastCredentialError, OAuthOnlyAccountError, SessionRequiredError, SignupsDisabledError, TokenAlreadyUsedError, TokenExpiredError, UnsupportedOAuthProviderError, RateLimitError, VerificationResendCooldownError, VerificationResendDailyCapError, SessionExpiredError, SmsConfigMissingError, TokenRevokedError, UnlockTokenInvalidError, UserDisabledError, WeakPasswordError, AppleEmailRequiredError, AppleSignInNotConfiguredError, InvalidAppleTokenError, OAuthEmailConflictError, GoogleEmailRequiredError, GoogleSignInNotConfiguredError, InvalidGoogleTokenError, EmailCodeDisabledError, MfaRequiredError, RecentAuthRequiredError, RecentMfaRequiredError, MfaAlreadyEnabledError, MfaEnrollmentNotFoundError, MfaNotEnabledError, } from './auth-errors.js';
4
+ import { KoolbaseServiceUnavailableError } from './errors.js';
4
5
  import { getPlatform } from './platform.js';
5
6
  import { DeviceMetadata } from './device-metadata.js';
6
7
  /** The server's `{ bucket, path }`; undefined when it is not one. */
@@ -1312,6 +1313,8 @@ export class KoolbaseAuth {
1312
1313
  throw new InvalidCredentialsError();
1313
1314
  case 'email_in_use':
1314
1315
  throw new EmailAlreadyInUseError();
1316
+ case 'placement_unavailable':
1317
+ throw new KoolbaseServiceUnavailableError(msg || undefined);
1315
1318
  case 'account_disabled':
1316
1319
  throw new UserDisabledError();
1317
1320
  case 'account_locked':
@@ -134,6 +134,46 @@ export declare class KoolbaseFieldNotAutoEmbedError extends KoolbaseDataError {
134
134
  export declare class KoolbaseInvalidEmbeddingConfigError extends KoolbaseDataError {
135
135
  constructor(message?: string);
136
136
  }
137
+ /**
138
+ * The vector field is filled by automatic embedding: Koolbase makes its
139
+ * vectors from the record's fields, so the app cannot write one, delete one,
140
+ * or send text for it (a 409, `auto_embedding_managed`). Write the record's
141
+ * fields instead; the vector follows.
142
+ */
143
+ export declare class KoolbaseAutoEmbeddingManagedError extends KoolbaseDataError {
144
+ constructor(message?: string);
145
+ }
146
+ /** What embedding a collection again costs, roughly (#162). */
147
+ export interface KoolbaseReembedEstimate {
148
+ records: number;
149
+ records_to_embed: number;
150
+ estimated_input_tokens: number;
151
+ provider: string;
152
+ model: string;
153
+ dimensions: number;
154
+ billed_by: string;
155
+ estimate: boolean;
156
+ cache_may_apply: boolean;
157
+ sampled_records: number;
158
+ }
159
+ /**
160
+ * A change to a vector field's embedding would embed the collection again,
161
+ * and was not confirmed (a 409, `reembed_confirmation_required`). `estimate`
162
+ * says what it would cost; send the change again with `confirm_reembed: true`
163
+ * to make it.
164
+ */
165
+ export declare class KoolbaseReembedConfirmationRequiredError extends KoolbaseDataError {
166
+ readonly estimate?: KoolbaseReembedEstimate;
167
+ constructor(message?: string, estimate?: KoolbaseReembedEstimate);
168
+ }
169
+ /**
170
+ * The embedding model is not one Koolbase offers, has been shut down by its
171
+ * provider, or cannot store vectors of that size (a 400,
172
+ * `embedding_model_unsupported`).
173
+ */
174
+ export declare class KoolbaseEmbeddingModelUnsupportedError extends KoolbaseDataError {
175
+ constructor(message?: string);
176
+ }
137
177
  /**
138
178
  * The project has no embedding provider configured. Embedding runs on the
139
179
  * project's own Gemini or OpenAI key.
@@ -1,4 +1,4 @@
1
- import { KoolbaseError, KoolbasePlanLimitError, KoolbaseUnauthenticatedError } from './errors.js';
1
+ import { KoolbaseError, KoolbasePlanLimitError, KoolbaseServiceUnavailableError, KoolbaseUnauthenticatedError } from './errors.js';
2
2
  /**
3
3
  * Base class for errors surfaced by the Koolbase data layer (database reads
4
4
  * and writes). Every data error carries a `message` and, when the server
@@ -172,6 +172,45 @@ export class KoolbaseInvalidEmbeddingConfigError extends KoolbaseDataError {
172
172
  Object.setPrototypeOf(this, KoolbaseInvalidEmbeddingConfigError.prototype);
173
173
  }
174
174
  }
175
+ /**
176
+ * The vector field is filled by automatic embedding: Koolbase makes its
177
+ * vectors from the record's fields, so the app cannot write one, delete one,
178
+ * or send text for it (a 409, `auto_embedding_managed`). Write the record's
179
+ * fields instead; the vector follows.
180
+ */
181
+ export class KoolbaseAutoEmbeddingManagedError extends KoolbaseDataError {
182
+ constructor(message) {
183
+ super(message ?? 'This vector field is managed by automatic embedding and cannot be written manually.', 'auto_embedding_managed');
184
+ this.name = 'KoolbaseAutoEmbeddingManagedError';
185
+ Object.setPrototypeOf(this, KoolbaseAutoEmbeddingManagedError.prototype);
186
+ }
187
+ }
188
+ /**
189
+ * A change to a vector field's embedding would embed the collection again,
190
+ * and was not confirmed (a 409, `reembed_confirmation_required`). `estimate`
191
+ * says what it would cost; send the change again with `confirm_reembed: true`
192
+ * to make it.
193
+ */
194
+ export class KoolbaseReembedConfirmationRequiredError extends KoolbaseDataError {
195
+ constructor(message, estimate) {
196
+ super(message ?? 'This change embeds every record again; confirm it with confirm_reembed', 'reembed_confirmation_required');
197
+ this.estimate = estimate;
198
+ this.name = 'KoolbaseReembedConfirmationRequiredError';
199
+ Object.setPrototypeOf(this, KoolbaseReembedConfirmationRequiredError.prototype);
200
+ }
201
+ }
202
+ /**
203
+ * The embedding model is not one Koolbase offers, has been shut down by its
204
+ * provider, or cannot store vectors of that size (a 400,
205
+ * `embedding_model_unsupported`).
206
+ */
207
+ export class KoolbaseEmbeddingModelUnsupportedError extends KoolbaseDataError {
208
+ constructor(message) {
209
+ super(message ?? 'Embedding model not offered', 'embedding_model_unsupported');
210
+ this.name = 'KoolbaseEmbeddingModelUnsupportedError';
211
+ Object.setPrototypeOf(this, KoolbaseEmbeddingModelUnsupportedError.prototype);
212
+ }
213
+ }
175
214
  /**
176
215
  * The project has no embedding provider configured. Embedding runs on the
177
216
  * project's own Gemini or OpenAI key.
@@ -491,6 +530,14 @@ export function koolbaseDataError(status, body, fallbackMessage = 'Request faile
491
530
  return attach(new KoolbaseFieldNotAutoEmbedError(message));
492
531
  case 'invalid_embedding_config':
493
532
  return attach(new KoolbaseInvalidEmbeddingConfigError(message));
533
+ case 'auto_embedding_managed':
534
+ return attach(new KoolbaseAutoEmbeddingManagedError(message));
535
+ case 'reembed_confirmation_required':
536
+ return attach(new KoolbaseReembedConfirmationRequiredError(message, body?.details));
537
+ case 'embedding_model_unsupported':
538
+ return attach(new KoolbaseEmbeddingModelUnsupportedError(message));
539
+ case 'placement_unavailable':
540
+ return new KoolbaseServiceUnavailableError(message);
494
541
  case 'provider_not_configured':
495
542
  return attach(new KoolbaseProviderNotConfiguredError(message));
496
543
  case 'provider_invalid':
@@ -266,7 +266,9 @@ export declare class KoolbaseDatabase {
266
266
  *
267
267
  * The field must already be declared on the collection via the dashboard
268
268
  * or CLI. `vector.length` must match the field's declared dimension;
269
- * otherwise throws `KoolbaseVectorDimensionMismatchError`.
269
+ * otherwise throws `KoolbaseVectorDimensionMismatchError`. A field Koolbase
270
+ * embeds itself refuses it with `KoolbaseAutoEmbeddingManagedError`: write
271
+ * the record's fields instead.
270
272
  *
271
273
  * Online-only — vectors are not cached locally or queued offline because
272
274
  * HNSW similarity search has no useful offline semantics.
@@ -915,7 +915,9 @@ export class KoolbaseDatabase {
915
915
  *
916
916
  * The field must already be declared on the collection via the dashboard
917
917
  * or CLI. `vector.length` must match the field's declared dimension;
918
- * otherwise throws `KoolbaseVectorDimensionMismatchError`.
918
+ * otherwise throws `KoolbaseVectorDimensionMismatchError`. A field Koolbase
919
+ * embeds itself refuses it with `KoolbaseAutoEmbeddingManagedError`: write
920
+ * the record's fields instead.
919
921
  *
920
922
  * Online-only — vectors are not cached locally or queued offline because
921
923
  * HNSW similarity search has no useful offline semantics.
@@ -73,6 +73,19 @@ export declare class KoolbasePlanLimitError extends KoolbaseError {
73
73
  readonly plan?: string | undefined;
74
74
  constructor(message?: string, resource?: string | undefined, limit?: number | undefined, plan?: string | undefined);
75
75
  }
76
+ /**
77
+ * The project's database could not be reached just now, or which database it
78
+ * is could not be established (a 503, `placement_unavailable`). Koolbase never
79
+ * answers from another database in its place, so nothing was read or written:
80
+ * try again shortly.
81
+ *
82
+ * Shared: any request to the project -- a query, an upload, a sign-in -- can
83
+ * meet it.
84
+ */
85
+ export declare class KoolbaseServiceUnavailableError extends KoolbaseError {
86
+ readonly retryable = true;
87
+ constructor(message?: string);
88
+ }
76
89
  export declare class KoolbaseOfflineBaselineUnavailableError extends KoolbaseError {
77
90
  constructor(message: string);
78
91
  }
@@ -88,6 +88,23 @@ export class KoolbasePlanLimitError extends KoolbaseError {
88
88
  Object.setPrototypeOf(this, KoolbasePlanLimitError.prototype);
89
89
  }
90
90
  }
91
+ /**
92
+ * The project's database could not be reached just now, or which database it
93
+ * is could not be established (a 503, `placement_unavailable`). Koolbase never
94
+ * answers from another database in its place, so nothing was read or written:
95
+ * try again shortly.
96
+ *
97
+ * Shared: any request to the project -- a query, an upload, a sign-in -- can
98
+ * meet it.
99
+ */
100
+ export class KoolbaseServiceUnavailableError extends KoolbaseError {
101
+ constructor(message) {
102
+ super(message ?? "This project's database is temporarily unavailable. Please try again.", 'placement_unavailable');
103
+ this.retryable = true;
104
+ this.name = 'KoolbaseServiceUnavailableError';
105
+ Object.setPrototypeOf(this, KoolbaseServiceUnavailableError.prototype);
106
+ }
107
+ }
91
108
  export class KoolbaseOfflineBaselineUnavailableError extends KoolbaseError {
92
109
  constructor(message) {
93
110
  super(message, 'offline_baseline_unavailable');
@@ -1,4 +1,4 @@
1
- import { KoolbaseError, KoolbasePlanLimitError, KoolbaseUnauthenticatedError } from './errors.js';
1
+ import { KoolbaseError, KoolbasePlanLimitError, KoolbaseServiceUnavailableError, KoolbaseUnauthenticatedError } from './errors.js';
2
2
  /**
3
3
  * Base error type for all Koolbase storage errors. Catchable via
4
4
  * `instanceof KoolbaseStorageError` to handle any storage-related failure
@@ -388,6 +388,8 @@ export function koolbaseStorageError(status, body, fallbackMessage = 'Storage re
388
388
  const d = (body?.details ?? {});
389
389
  return new KoolbasePlanLimitError(message, d.resource, d.limit, d.plan);
390
390
  }
391
+ case 'placement_unavailable':
392
+ return new KoolbaseServiceUnavailableError(message);
391
393
  case 'quota_exceeded':
392
394
  return new KoolbaseStorageQuotaError(message);
393
395
  case 'upload_expired':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/core",
3
- "version": "12.28.0",
3
+ "version": "12.30.0",
4
4
  "description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",