@tinycloud/sdk-services 3.11.0-beta.2 → 3.12.0-beta.3
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/{BaseService-Ma2MwJAd.d.ts → BaseService-BRDG69KR.d.ts} +1 -1
- package/dist/{BaseService-O0iyuFLk.d.cts → BaseService-CdBkfPGE.d.cts} +1 -1
- package/dist/{IHooksService-4QNODVy6.d.cts → IHooksService-C9p3stsB.d.cts} +1 -1
- package/dist/{IHooksService-CvTpJbQD.d.ts → IHooksService-D6eyZat1.d.ts} +1 -1
- package/dist/{ISQLService-Aly1CBsW.d.ts → ISQLService-B_4KcGA-.d.ts} +1 -1
- package/dist/{ISQLService-BOgWzHLT.d.cts → ISQLService-C6nNpcls.d.cts} +1 -1
- package/dist/context.cjs +4 -0
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +4 -0
- package/dist/context.js.map +1 -1
- package/dist/encryption/index.cjs +60 -3
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +12 -22
- package/dist/encryption/index.d.ts +12 -22
- package/dist/encryption/index.js +60 -3
- package/dist/encryption/index.js.map +1 -1
- package/dist/encryption/named-keys.cjs +2 -0
- package/dist/encryption/named-keys.cjs.map +1 -1
- package/dist/encryption/named-keys.d.cts +2 -2
- package/dist/encryption/named-keys.d.ts +2 -2
- package/dist/encryption/named-keys.js +2 -0
- package/dist/encryption/named-keys.js.map +1 -1
- package/dist/encryption/resource.cjs.map +1 -1
- package/dist/encryption/resource.js.map +1 -1
- package/dist/feed/index.cjs +4 -0
- package/dist/feed/index.cjs.map +1 -1
- package/dist/feed/index.d.cts +3 -3
- package/dist/feed/index.d.ts +3 -3
- package/dist/feed/index.js +4 -0
- package/dist/feed/index.js.map +1 -1
- package/dist/index.cjs +260 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/index.js +253 -7
- package/dist/index.js.map +1 -1
- package/dist/internal/decrypt-transport-response-error.d.cts +1 -1
- package/dist/internal/decrypt-transport-response-error.d.ts +1 -1
- package/dist/kv/index.cjs +34 -0
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +4 -4
- package/dist/kv/index.d.ts +4 -4
- package/dist/kv/index.js +34 -0
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/replication/index.cjs +34 -0
- package/dist/kv/replication/index.cjs.map +1 -1
- package/dist/kv/replication/index.d.cts +3 -3
- package/dist/kv/replication/index.d.ts +3 -3
- package/dist/kv/replication/index.js +34 -0
- package/dist/kv/replication/index.js.map +1 -1
- package/dist/{scope-DEgc9f-W.d.cts → scope-DtcbyRKY.d.cts} +1 -1
- package/dist/{scope-BZr0QwxX.d.ts → scope-J20PQP3u.d.ts} +1 -1
- package/dist/sql/index.cjs +36 -0
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +4 -4
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +36 -0
- package/dist/sql/index.js.map +1 -1
- package/dist/telemetry/requestLog.cjs +4 -0
- package/dist/telemetry/requestLog.cjs.map +1 -1
- package/dist/telemetry/requestLog.d.cts +1 -1
- package/dist/telemetry/requestLog.d.ts +1 -1
- package/dist/telemetry/requestLog.js +4 -0
- package/dist/telemetry/requestLog.js.map +1 -1
- package/dist/{types-CSd0RYir.d.ts → types-DjAP8dve.d.cts} +4 -0
- package/dist/{types-CSd0RYir.d.cts → types-DjAP8dve.d.ts} +4 -0
- package/dist/{types-D4XbIfFJ.d.cts → types-XE4tyBLH.d.ts} +60 -3
- package/dist/{types-Bf91gup6.d.ts → types-cWtQmCCw.d.cts} +60 -3
- package/package.json +1 -1
package/dist/sql/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { f as Result } from '../types-
|
|
3
|
-
import { d as ISQLService, g as SQLServiceConfig, I as IDatabaseHandle, l as SqlValue, Q as QueryOptions, e as QueryResponse, E as ExecuteOptions, b as ExecuteResponse, k as SqlStatement, B as BatchOptions, a as BatchResponse, i as SqlMigrationApplyOptions, j as SqlMigrationApplyResponse, c as ISQLMigrations } from '../ISQLService-
|
|
4
|
-
export { S as SQLAction, f as SQLActionType, h as SqlMigration } from '../ISQLService-
|
|
1
|
+
import { B as BaseService } from '../BaseService-BRDG69KR.js';
|
|
2
|
+
import { f as Result } from '../types-DjAP8dve.js';
|
|
3
|
+
import { d as ISQLService, g as SQLServiceConfig, I as IDatabaseHandle, l as SqlValue, Q as QueryOptions, e as QueryResponse, E as ExecuteOptions, b as ExecuteResponse, k as SqlStatement, B as BatchOptions, a as BatchResponse, i as SqlMigrationApplyOptions, j as SqlMigrationApplyResponse, c as ISQLMigrations } from '../ISQLService-B_4KcGA-.js';
|
|
4
|
+
export { S as SQLAction, f as SQLActionType, h as SqlMigration } from '../ISQLService-B_4KcGA-.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* SQLService - SQL database service implementation.
|
package/dist/sql/index.js
CHANGED
|
@@ -10,6 +10,10 @@ var ErrorCodes = {
|
|
|
10
10
|
/** HTTP 401: a delegation the cited one rests on was revoked. */
|
|
11
11
|
AUTH_DELEGATION_ANCESTOR_REVOKED: "AUTH_DELEGATION_ANCESTOR_REVOKED",
|
|
12
12
|
NETWORK_ERROR: "NETWORK_ERROR",
|
|
13
|
+
NODE_NOT_RESPONDING: "NODE_NOT_RESPONDING",
|
|
14
|
+
NODE_IDENTITY_MISMATCH: "NODE_IDENTITY_MISMATCH",
|
|
15
|
+
PARTIAL_NODE_WRITE: "PARTIAL_NODE_WRITE",
|
|
16
|
+
RESOURCE_NOT_ROUTED: "RESOURCE_NOT_ROUTED",
|
|
13
17
|
TIMEOUT: "TIMEOUT",
|
|
14
18
|
ABORTED: "ABORTED",
|
|
15
19
|
INVALID_INPUT: "INVALID_INPUT",
|
|
@@ -136,6 +140,36 @@ function compactMessage(message) {
|
|
|
136
140
|
|
|
137
141
|
// src/errors.ts
|
|
138
142
|
import { CAPABILITY_REGISTRY } from "@tinycloud/bootstrap";
|
|
143
|
+
|
|
144
|
+
// src/resourceRouting.ts
|
|
145
|
+
var ROUTING_FAILURE_CODES = {
|
|
146
|
+
NODE_NOT_RESPONDING: true,
|
|
147
|
+
PARTIAL_NODE_WRITE: true,
|
|
148
|
+
NODE_IDENTITY_MISMATCH: true,
|
|
149
|
+
RESOURCE_NOT_ROUTED: true,
|
|
150
|
+
DECRYPTION_DEPENDENCY_UNAVAILABLE: true,
|
|
151
|
+
registry_unavailable: true,
|
|
152
|
+
node_not_found: true,
|
|
153
|
+
node_registry_entry_exists: true
|
|
154
|
+
};
|
|
155
|
+
function isRoutingFailureCode(code) {
|
|
156
|
+
return Object.prototype.hasOwnProperty.call(ROUTING_FAILURE_CODES, code);
|
|
157
|
+
}
|
|
158
|
+
function routingFailure(error) {
|
|
159
|
+
if (typeof error === "object" && error !== null && "code" in error && "message" in error && typeof error.code === "string" && typeof error.message === "string" && isRoutingFailureCode(error.code)) {
|
|
160
|
+
const candidate = "meta" in error ? error.meta : void 0;
|
|
161
|
+
let meta = typeof candidate === "object" && candidate !== null && !Array.isArray(candidate) ? candidate : void 0;
|
|
162
|
+
if (error.code === "NODE_NOT_RESPONDING" && "hosts" in error && Array.isArray(error.hosts)) {
|
|
163
|
+
meta = { ...meta, hosts: error.hosts };
|
|
164
|
+
} else if (error.code === "PARTIAL_NODE_WRITE" && "succeeded" in error && Array.isArray(error.succeeded) && "failed" in error && Array.isArray(error.failed)) {
|
|
165
|
+
meta = { ...meta, succeeded: error.succeeded, failed: error.failed };
|
|
166
|
+
}
|
|
167
|
+
return { code: error.code, message: error.message, ...error instanceof Error ? { cause: error } : {}, ...meta ? { meta } : {} };
|
|
168
|
+
}
|
|
169
|
+
return void 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/errors.ts
|
|
139
173
|
function authRequiredError(service) {
|
|
140
174
|
return {
|
|
141
175
|
code: ErrorCodes.AUTH_REQUIRED,
|
|
@@ -280,6 +314,8 @@ function storageRejectionError(service, status, meta, responseText) {
|
|
|
280
314
|
return status === 402 ? storageQuotaExceededError(service, STORAGE_FULL_MESSAGE, quotaMeta) : storageLimitReachedError(service, STORAGE_WRITE_TOO_LARGE_MESSAGE, quotaMeta);
|
|
281
315
|
}
|
|
282
316
|
function wrapError(service, error, defaultCode = ErrorCodes.NETWORK_ERROR) {
|
|
317
|
+
const routing = routingFailure(error);
|
|
318
|
+
if (routing) return { ...routing, service };
|
|
283
319
|
if (error instanceof Error) {
|
|
284
320
|
if (isRequestTimeoutError(error)) {
|
|
285
321
|
return timeoutError(service, error.timeoutMs, error);
|