@deepexi/datasense-connector 0.0.0-stage → 3.0.1
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/README.md +172 -2
- package/cjs/index.cjs +1015 -0
- package/cjs/runtime.cjs +752 -0
- package/cjs/testing.cjs +3591 -0
- package/errors.d.ts +17 -0
- package/errors.js +53 -0
- package/guest.cjs +2659 -0
- package/index.d.ts +13 -0
- package/index.js +7 -0
- package/internal/location.d.ts +6 -0
- package/internal/location.js +8 -0
- package/package.json +42 -4
- package/presentation.d.ts +38 -0
- package/presentation.js +268 -0
- package/runtime/guest/bridge.d.ts +53 -0
- package/runtime/guest/bridge.js +187 -0
- package/runtime/guest/cache.d.ts +3 -0
- package/runtime/guest/cache.js +42 -0
- package/runtime/guest/crypto.d.ts +13 -0
- package/runtime/guest/crypto.js +177 -0
- package/runtime/guest/ctx.d.ts +30 -0
- package/runtime/guest/ctx.js +124 -0
- package/runtime/guest/db.d.ts +6 -0
- package/runtime/guest/db.js +59 -0
- package/runtime/guest/discover.d.ts +29 -0
- package/runtime/guest/discover.js +51 -0
- package/runtime/guest/failure.d.ts +24 -0
- package/runtime/guest/failure.js +63 -0
- package/runtime/guest/http.d.ts +4 -0
- package/runtime/guest/http.js +204 -0
- package/runtime/guest/index.d.ts +12 -0
- package/runtime/guest/index.js +89 -0
- package/runtime/guest/limits.d.ts +20 -0
- package/runtime/guest/limits.js +12 -0
- package/runtime/guest/loader.d.ts +15 -0
- package/runtime/guest/loader.js +42 -0
- package/runtime/guest/log.d.ts +10 -0
- package/runtime/guest/log.js +36 -0
- package/runtime/guest/map.d.ts +4 -0
- package/runtime/guest/map.js +45 -0
- package/runtime/guest/paginate.d.ts +6 -0
- package/runtime/guest/paginate.js +180 -0
- package/runtime/guest/pull.d.ts +12 -0
- package/runtime/guest/pull.js +150 -0
- package/runtime/guest/push.d.ts +18 -0
- package/runtime/guest/push.js +80 -0
- package/runtime/guest/signal.d.ts +3 -0
- package/runtime/guest/signal.js +12 -0
- package/runtime/guest/time.d.ts +5 -0
- package/runtime/guest/time.js +127 -0
- package/runtime/guest-runtime.d.ts +7 -0
- package/runtime/guest-runtime.js +51 -0
- package/runtime/index.d.ts +18 -0
- package/runtime/index.js +3 -0
- package/runtime/protocol.d.ts +276 -0
- package/runtime/protocol.js +409 -0
- package/runtime/session.d.ts +12 -0
- package/runtime/session.js +191 -0
- package/t.d.ts +18 -0
- package/t.js +26 -0
- package/testing/child.cjs +350 -0
- package/testing/child.d.ts +1 -0
- package/testing/child.js +12 -0
- package/testing/compliance.d.ts +41 -0
- package/testing/compliance.js +291 -0
- package/testing/engine.d.ts +66 -0
- package/testing/engine.js +339 -0
- package/testing/fixtures.d.ts +145 -0
- package/testing/fixtures.js +407 -0
- package/testing/gateway.d.ts +65 -0
- package/testing/gateway.js +402 -0
- package/testing/import-guard.d.ts +57 -0
- package/testing/import-guard.js +187 -0
- package/testing/index.d.ts +33 -0
- package/testing/index.js +10 -0
- package/testing/local-db.d.ts +27 -0
- package/testing/local-db.js +181 -0
- package/testing/pinned-http.d.ts +14 -0
- package/testing/pinned-http.js +125 -0
- package/testing/recorder.d.ts +15 -0
- package/testing/recorder.js +116 -0
- package/testing/redaction.d.ts +28 -0
- package/testing/redaction.js +67 -0
- package/testing/replay.d.ts +50 -0
- package/testing/replay.js +313 -0
- package/testing/schema.d.ts +13 -0
- package/testing/schema.js +65 -0
- package/testing/source-loader.d.ts +19 -0
- package/testing/source-loader.js +238 -0
- package/testing/types.d.ts +79 -0
- package/testing/types.js +18 -0
- package/types.d.ts +302 -0
- package/types.js +13 -0
- package/validate.d.ts +78 -0
- package/validate.js +597 -0
package/errors.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** 连接器抛给平台的错误;`code` 稳定,平台据此决定拒收、失败或重试。 */
|
|
2
|
+
export declare class ConnectorError extends Error {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
constructor(code: string, message: string);
|
|
5
|
+
}
|
|
6
|
+
export interface RateLimitedError extends ConnectorError {
|
|
7
|
+
readonly retryAfterMs: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const errors: {
|
|
10
|
+
AuthError: new (message: string) => ConnectorError;
|
|
11
|
+
RateLimited: new (retryAfterMs: number, message?: string) => RateLimitedError;
|
|
12
|
+
TransientError: new (message: string) => ConnectorError;
|
|
13
|
+
SchemaError: new (message: string) => ConnectorError;
|
|
14
|
+
FatalError: new (message: string) => ConnectorError;
|
|
15
|
+
RejectedPayload: new (message: string) => ConnectorError;
|
|
16
|
+
NotAvailable: new (feature: string) => ConnectorError;
|
|
17
|
+
};
|
package/errors.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export class ConnectorError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
constructor(code, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'ConnectorError';
|
|
6
|
+
this.code = code;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
class AuthError extends ConnectorError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super('AUTH_ERROR', message);
|
|
12
|
+
this.name = 'AuthError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class RateLimited extends ConnectorError {
|
|
16
|
+
retryAfterMs;
|
|
17
|
+
constructor(retryAfterMs, message) {
|
|
18
|
+
super('RATE_LIMITED', message ?? `rate limited, retry after ${retryAfterMs} ms`);
|
|
19
|
+
this.name = 'RateLimited';
|
|
20
|
+
this.retryAfterMs = retryAfterMs;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
class TransientError extends ConnectorError {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super('TRANSIENT_ERROR', message);
|
|
26
|
+
this.name = 'TransientError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class SchemaError extends ConnectorError {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super('SCHEMA_ERROR', message);
|
|
32
|
+
this.name = 'SchemaError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class FatalError extends ConnectorError {
|
|
36
|
+
constructor(message) {
|
|
37
|
+
super('FATAL_ERROR', message);
|
|
38
|
+
this.name = 'FatalError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class RejectedPayload extends ConnectorError {
|
|
42
|
+
constructor(message) {
|
|
43
|
+
super('REJECTED_PAYLOAD', message);
|
|
44
|
+
this.name = 'RejectedPayload';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class NotAvailable extends ConnectorError {
|
|
48
|
+
constructor(feature) {
|
|
49
|
+
super('NOT_AVAILABLE', `${feature} is not available yet`);
|
|
50
|
+
this.name = 'NotAvailable';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const errors = Object.freeze({ AuthError, RateLimited, TransientError, SchemaError, FatalError, RejectedPayload, NotAvailable });
|