@superdurable/connector-chinaz 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +4 -2
- package/dex-connector.json +65 -0
- package/dist/chunk-TCBT664S.js +124 -0
- package/dist/connection-DDnMA7Kj.d.ts +84 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +198 -0
- package/dist/mock.d.ts +35 -0
- package/dist/mock.js +75 -0
- package/package.json +59 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Chinaz TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read a public site's title, keywords, description, and IP address by domain.
|
|
4
|
+
|
|
5
|
+
Install `@superdurable/connector-chinaz` and use `newProjectConnection` with the static connection name in the runnable [`examples/basic`](examples/basic) Flow. Configure the connection and provider credentials in Dex Web Connections. The operation `getSiteTDK` resolves credentials for each call. Local conformance tests replay the Go provider scenarios; live provider authorization has not been verified.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "chinaz",
|
|
3
|
+
"releaseTag": "connectors/chinaz/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-chinaz",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newGetSiteTDKStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "getSiteTDK",
|
|
14
|
+
"inputType": "GetSiteTDKInput",
|
|
15
|
+
"description": "Read public title, keywords, description, and IP for one domain.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "found",
|
|
25
|
+
"field": "found",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "notFound",
|
|
30
|
+
"field": "notFound",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "providerRejected",
|
|
35
|
+
"field": "providerRejected",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "invalidResponse",
|
|
40
|
+
"field": "invalidResponse",
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "defect",
|
|
45
|
+
"field": "defect",
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"inputSchema": {
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"description": "GetSiteTDKInput selects one public website by domain name.",
|
|
52
|
+
"properties": {
|
|
53
|
+
"domain": {
|
|
54
|
+
"description": "Domain is a hostname without scheme, port, or path.",
|
|
55
|
+
"type": "string"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": [
|
|
59
|
+
"domain"
|
|
60
|
+
],
|
|
61
|
+
"type": "object"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var ConfigSchema = z.object({
|
|
5
|
+
"baseUrl": z.string().optional(),
|
|
6
|
+
"timeoutMs": z.number().int().optional(),
|
|
7
|
+
"maxResponseBytes": z.number().int().optional()
|
|
8
|
+
});
|
|
9
|
+
var CredentialMaterialError = class extends TypeError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "CredentialMaterialError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
16
|
+
"project credential decoding failed",
|
|
17
|
+
"shared project credential decoding failed",
|
|
18
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
19
|
+
]);
|
|
20
|
+
function isCredentialMaterialError(error) {
|
|
21
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
22
|
+
}
|
|
23
|
+
function decodeCredentials(value) {
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
25
|
+
const fields = value;
|
|
26
|
+
const allowed = /* @__PURE__ */ new Set(["api_key"]);
|
|
27
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
28
|
+
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new CredentialMaterialError("credential api_key has an invalid type");
|
|
29
|
+
const credentials = {};
|
|
30
|
+
if (!fields["api_key"]) throw new CredentialMaterialError("credential api_key is required");
|
|
31
|
+
credentials.apiKey = new SecretString(fields["api_key"] ?? "");
|
|
32
|
+
return credentials;
|
|
33
|
+
}
|
|
34
|
+
var GetSiteTDKInputSchema = z.strictObject({
|
|
35
|
+
"domain": z.string()
|
|
36
|
+
});
|
|
37
|
+
var SiteTDKSchema = z.strictObject({
|
|
38
|
+
"domain": z.string(),
|
|
39
|
+
"title": z.string(),
|
|
40
|
+
"keywords": z.string(),
|
|
41
|
+
"description": z.string(),
|
|
42
|
+
"ipAddress": z.string()
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/generated/definitions.ts
|
|
46
|
+
var ConnectorID = "chinaz";
|
|
47
|
+
var ProviderID = "chinaz";
|
|
48
|
+
var GetSiteTDKBranch = {
|
|
49
|
+
Found: "found",
|
|
50
|
+
NotFound: "notFound",
|
|
51
|
+
ProviderRejected: "providerRejected",
|
|
52
|
+
InvalidResponse: "invalidResponse",
|
|
53
|
+
Defect: "defect"
|
|
54
|
+
};
|
|
55
|
+
var GetSiteTDKBranchFound = GetSiteTDKBranch.Found;
|
|
56
|
+
var GetSiteTDKBranchNotFound = GetSiteTDKBranch.NotFound;
|
|
57
|
+
var GetSiteTDKBranchProviderRejected = GetSiteTDKBranch.ProviderRejected;
|
|
58
|
+
var GetSiteTDKBranchInvalidResponse = GetSiteTDKBranch.InvalidResponse;
|
|
59
|
+
var GetSiteTDKBranchDefect = GetSiteTDKBranch.Defect;
|
|
60
|
+
var GetSiteTDKDefinition = {
|
|
61
|
+
operation: { connectorId: ConnectorID, operationId: "getSiteTDK" },
|
|
62
|
+
branches: [
|
|
63
|
+
{ id: "found", description: "Chinaz returned TDK metadata for the domain." },
|
|
64
|
+
{ id: "notFound", description: "Chinaz could not find site metadata for the domain.", optional: true },
|
|
65
|
+
{ id: "providerRejected", description: "Chinaz rejected the key, plan, or domain.", optional: true },
|
|
66
|
+
{ id: "invalidResponse", description: "Chinaz returned malformed or oversized data.", optional: true },
|
|
67
|
+
{ id: "defect", description: "Local connection configuration, key, or domain is invalid.", optional: true }
|
|
68
|
+
],
|
|
69
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
70
|
+
};
|
|
71
|
+
var GetSiteTDKMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
72
|
+
|
|
73
|
+
// src/generated/connection.ts
|
|
74
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
75
|
+
var Connection = class {
|
|
76
|
+
/** Stable provider and connection name. */
|
|
77
|
+
reference;
|
|
78
|
+
/** Bound provider operations. */
|
|
79
|
+
operations;
|
|
80
|
+
/** Validate a reference and bind operations. */
|
|
81
|
+
constructor(reference, operations) {
|
|
82
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
83
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
84
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
85
|
+
this.operations = operations;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function newConnection(client, reference) {
|
|
89
|
+
if (!client) throw new TypeError("connector client is required");
|
|
90
|
+
return new Connection(reference, client);
|
|
91
|
+
}
|
|
92
|
+
function newConnectionWithOperations(operations, reference) {
|
|
93
|
+
return new Connection(reference, operations);
|
|
94
|
+
}
|
|
95
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
96
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
97
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
98
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
99
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
100
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
ConfigSchema,
|
|
105
|
+
CredentialMaterialError,
|
|
106
|
+
isCredentialMaterialError,
|
|
107
|
+
decodeCredentials,
|
|
108
|
+
GetSiteTDKInputSchema,
|
|
109
|
+
SiteTDKSchema,
|
|
110
|
+
ConnectorID,
|
|
111
|
+
ProviderID,
|
|
112
|
+
GetSiteTDKBranch,
|
|
113
|
+
GetSiteTDKBranchFound,
|
|
114
|
+
GetSiteTDKBranchNotFound,
|
|
115
|
+
GetSiteTDKBranchProviderRejected,
|
|
116
|
+
GetSiteTDKBranchInvalidResponse,
|
|
117
|
+
GetSiteTDKBranchDefect,
|
|
118
|
+
GetSiteTDKDefinition,
|
|
119
|
+
GetSiteTDKMetadata,
|
|
120
|
+
Connection,
|
|
121
|
+
newConnection,
|
|
122
|
+
newConnectionWithOperations,
|
|
123
|
+
newProjectConnection
|
|
124
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** HTTPS origin of Chinaz API Data v2. Leave blank for the displayed production endpoint; override only for a trusted test server or provider-approved proxy. */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Maximum duration of one site TDK request as a positive Go duration such as 30s or 1m. Leave blank for the displayed default; raise it only when the provider responds slowly from your network. Runtime value in milliseconds. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Maximum single-domain TDK response size in bytes as a positive integer. Leave blank for the displayed default; raise only for a documented larger provider response. */
|
|
11
|
+
maxResponseBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Runtime schema for manifest configuration. */
|
|
14
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
16
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
/** Private connector credentials resolved by the host. */
|
|
20
|
+
interface Credentials {
|
|
21
|
+
/** Secret key from https://api.chinaz.com/ApiDetails/SiteData > Apply or purchase API > User Center > My Data. Copy the exact key; blank prevents requests. It is sent in the HTTPS POST form body, never in the URL. */
|
|
22
|
+
apiKey: SecretString;
|
|
23
|
+
}
|
|
24
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
25
|
+
declare class CredentialMaterialError extends TypeError {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
29
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
30
|
+
/** Decode private credential fields for the connector. */
|
|
31
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
32
|
+
/** Host-owned source of private connector credentials. */
|
|
33
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
34
|
+
/** GetSiteTDKInput selects one public website by domain name. */
|
|
35
|
+
interface GetSiteTDKInput {
|
|
36
|
+
/** Domain is a hostname without scheme, port, or path. */
|
|
37
|
+
"domain": string;
|
|
38
|
+
}
|
|
39
|
+
/** SiteTDK contains selected public metadata from the Chinaz site index. */
|
|
40
|
+
interface SiteTDK {
|
|
41
|
+
/** Domain is the requested domain name. */
|
|
42
|
+
"domain": string;
|
|
43
|
+
/** Title is the indexed site title. */
|
|
44
|
+
"title": string;
|
|
45
|
+
/** Keywords is the indexed site keyword text. */
|
|
46
|
+
"keywords": string;
|
|
47
|
+
/** Description is the indexed site description. */
|
|
48
|
+
"description": string;
|
|
49
|
+
/** IPAddress is the provider-reported site IP address. */
|
|
50
|
+
"ipAddress": string;
|
|
51
|
+
}
|
|
52
|
+
/** Runtime validator for GetSiteTDKInput. */
|
|
53
|
+
declare const GetSiteTDKInputSchema: z.ZodObject<{
|
|
54
|
+
domain: z.ZodString;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
/** Runtime validator for SiteTDK. */
|
|
57
|
+
declare const SiteTDKSchema: z.ZodObject<{
|
|
58
|
+
domain: z.ZodString;
|
|
59
|
+
title: z.ZodString;
|
|
60
|
+
keywords: z.ZodString;
|
|
61
|
+
description: z.ZodString;
|
|
62
|
+
ipAddress: z.ZodString;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
|
|
65
|
+
/** Typed operations supplied by a client or mock. */
|
|
66
|
+
interface Operations {
|
|
67
|
+
/** Invoke getSiteTDK through this connection. */
|
|
68
|
+
getSiteTDK(): Query<GetSiteTDKInput, SiteTDK>;
|
|
69
|
+
}
|
|
70
|
+
/** Named connector connection kept outside Flow state. */
|
|
71
|
+
declare class Connection<BoundOperations = Operations> {
|
|
72
|
+
/** Stable provider and connection name. */
|
|
73
|
+
readonly reference: ConnectionRef;
|
|
74
|
+
/** Bound provider operations. */
|
|
75
|
+
readonly operations: BoundOperations;
|
|
76
|
+
/** Validate a reference and bind operations. */
|
|
77
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
78
|
+
}
|
|
79
|
+
/** Bind a client to a named connection. */
|
|
80
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
81
|
+
/** Bind scripted operations to a named connection. */
|
|
82
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
83
|
+
|
|
84
|
+
export { Connection as C, type GetSiteTDKInput as G, type Operations as O, type SiteTDK as S, type Config as a, type Credentials as b, ConfigSchema as c, CredentialMaterialError as d, type CredentialSource as e, GetSiteTDKInputSchema as f, SiteTDKSchema as g, decodeCredentials as h, isCredentialMaterialError as i, newConnectionWithOperations as j, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { G as GetSiteTDKInput, S as SiteTDK, C as Connection, O as Operations, a as Config, b as Credentials } from './connection-DDnMA7Kj.js';
|
|
2
|
+
export { c as ConfigSchema, d as CredentialMaterialError, e as CredentialSource, f as GetSiteTDKInputSchema, g as SiteTDKSchema, h as decodeCredentials, i as isCredentialMaterialError, n as newConnection, j as newConnectionWithOperations } from './connection-DDnMA7Kj.js';
|
|
3
|
+
import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, CredentialProvider, Call, QueryAttempt } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { StepTarget } from '@superdurable/dex';
|
|
5
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
6
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
7
|
+
import 'zod';
|
|
8
|
+
|
|
9
|
+
/** Stable connector identity. */
|
|
10
|
+
declare const ConnectorID = "chinaz";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "chinaz";
|
|
13
|
+
/** Branch IDs for getSiteTDK. */
|
|
14
|
+
declare const GetSiteTDKBranch: {
|
|
15
|
+
readonly Found: "found";
|
|
16
|
+
readonly NotFound: "notFound";
|
|
17
|
+
readonly ProviderRejected: "providerRejected";
|
|
18
|
+
readonly InvalidResponse: "invalidResponse";
|
|
19
|
+
readonly Defect: "defect";
|
|
20
|
+
};
|
|
21
|
+
/** Chinaz returned TDK metadata for the domain. */
|
|
22
|
+
declare const GetSiteTDKBranchFound: "found";
|
|
23
|
+
/** Chinaz could not find site metadata for the domain. */
|
|
24
|
+
declare const GetSiteTDKBranchNotFound: "notFound";
|
|
25
|
+
/** Chinaz rejected the key, plan, or domain. */
|
|
26
|
+
declare const GetSiteTDKBranchProviderRejected: "providerRejected";
|
|
27
|
+
/** Chinaz returned malformed or oversized data. */
|
|
28
|
+
declare const GetSiteTDKBranchInvalidResponse: "invalidResponse";
|
|
29
|
+
/** Local connection configuration, key, or domain is invalid. */
|
|
30
|
+
declare const GetSiteTDKBranchDefect: "defect";
|
|
31
|
+
/** Manifest definition for getSiteTDK. */
|
|
32
|
+
declare const GetSiteTDKDefinition: QueryDefinition;
|
|
33
|
+
/** Manifest metadata for getSiteTDK. */
|
|
34
|
+
declare const GetSiteTDKMetadata: {
|
|
35
|
+
readonly kind: "query";
|
|
36
|
+
readonly idempotency: "none";
|
|
37
|
+
readonly authorization: "required";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Configuration for the getSiteTDK connector Step. */
|
|
41
|
+
interface GetSiteTDKStepConfig<StepInput, OperationInput = GetSiteTDKInput, OperationOutput = SiteTDK> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
42
|
+
/** Named connection supplying this operation. */
|
|
43
|
+
connection: Connection<{
|
|
44
|
+
getSiteTDK(): Query<OperationInput, OperationOutput>;
|
|
45
|
+
}>;
|
|
46
|
+
/** Name matching the bound connection. */
|
|
47
|
+
connectionName: string;
|
|
48
|
+
/** Chinaz returned TDK metadata for the domain. */
|
|
49
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
50
|
+
/** Chinaz could not find site metadata for the domain. */
|
|
51
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
52
|
+
/** Chinaz rejected the key, plan, or domain. */
|
|
53
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
54
|
+
/** Chinaz returned malformed or oversized data. */
|
|
55
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
56
|
+
/** Local connection configuration, key, or domain is invalid. */
|
|
57
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
58
|
+
}
|
|
59
|
+
/** Build the getSiteTDK Step from a named connection. */
|
|
60
|
+
declare function newGetSiteTDKStep<StepInput, OperationInput = GetSiteTDKInput, OperationOutput = SiteTDK>(configuration: GetSiteTDKStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
61
|
+
|
|
62
|
+
/** Open one named Chinaz connection from Dex project configuration. */
|
|
63
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
64
|
+
|
|
65
|
+
/** Optional HTTP transport for local provider tests. */
|
|
66
|
+
interface ChinazClientOptions {
|
|
67
|
+
send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
68
|
+
}
|
|
69
|
+
/** Resolve Chinaz credentials for each public site metadata query. */
|
|
70
|
+
declare class ChinazClient {
|
|
71
|
+
private readonly credentials;
|
|
72
|
+
private readonly baseURL;
|
|
73
|
+
private readonly timeoutMs;
|
|
74
|
+
private readonly maxResponseBytes;
|
|
75
|
+
private readonly send;
|
|
76
|
+
/** Validate connection settings without contacting Chinaz. */
|
|
77
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: ChinazClientOptions);
|
|
78
|
+
/** Bind the public site TDK Query. */ getSiteTDK(): GetSiteTDKOperation;
|
|
79
|
+
/** Send one bounded multipart site TDK request. */
|
|
80
|
+
getTDK(call: Call, domain: string): Promise<{
|
|
81
|
+
response?: ProviderResponse;
|
|
82
|
+
error?: 'credential' | 'transport' | 'tooLarge';
|
|
83
|
+
retryAfterMs: number;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/** Read public site title, keywords, description, and IP address. */
|
|
87
|
+
declare class GetSiteTDKOperation implements Query<GetSiteTDKInput, SiteTDK> {
|
|
88
|
+
private readonly client;
|
|
89
|
+
/** Bind the provider client. */ constructor(client: ChinazClient);
|
|
90
|
+
/** Return the generated Query definition. */ definition(): QueryDefinition;
|
|
91
|
+
/** Classify one provider response using the Go connector contract. */
|
|
92
|
+
invoke(call: Call, input: GetSiteTDKInput): Promise<QueryAttempt<SiteTDK>>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { ChinazClient, type ChinazClientOptions, Config, Connection, ConnectorID, Credentials, GetSiteTDKBranch, GetSiteTDKBranchDefect, GetSiteTDKBranchFound, GetSiteTDKBranchInvalidResponse, GetSiteTDKBranchNotFound, GetSiteTDKBranchProviderRejected, GetSiteTDKDefinition, GetSiteTDKInput, GetSiteTDKMetadata, type GetSiteTDKStepConfig, ProviderID, SiteTDK, newGetSiteTDKStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
CredentialMaterialError,
|
|
6
|
+
GetSiteTDKBranch,
|
|
7
|
+
GetSiteTDKBranchDefect,
|
|
8
|
+
GetSiteTDKBranchFound,
|
|
9
|
+
GetSiteTDKBranchInvalidResponse,
|
|
10
|
+
GetSiteTDKBranchNotFound,
|
|
11
|
+
GetSiteTDKBranchProviderRejected,
|
|
12
|
+
GetSiteTDKDefinition,
|
|
13
|
+
GetSiteTDKInputSchema,
|
|
14
|
+
GetSiteTDKMetadata,
|
|
15
|
+
ProviderID,
|
|
16
|
+
SiteTDKSchema,
|
|
17
|
+
decodeCredentials,
|
|
18
|
+
isCredentialMaterialError,
|
|
19
|
+
newConnection,
|
|
20
|
+
newConnectionWithOperations,
|
|
21
|
+
newProjectConnection
|
|
22
|
+
} from "./chunk-TCBT664S.js";
|
|
23
|
+
|
|
24
|
+
// src/generated/steps.ts
|
|
25
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
26
|
+
function newGetSiteTDKStep(configuration) {
|
|
27
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
28
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
29
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getSiteTDK(), connection: connection.reference, branches: [
|
|
30
|
+
goToBranch("found", found),
|
|
31
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
32
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
33
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
34
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/client.ts
|
|
39
|
+
import { randomBytes } from "crypto";
|
|
40
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
41
|
+
import { BodyTooLargeError, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
42
|
+
var ChinazClient = class {
|
|
43
|
+
/** Validate connection settings without contacting Chinaz. */
|
|
44
|
+
constructor(config, credentials, options = {}) {
|
|
45
|
+
this.credentials = credentials;
|
|
46
|
+
if (!config || !credentials) throw new TypeError("Chinaz configuration and credentials are required");
|
|
47
|
+
this.baseURL = validateBaseURL(config.baseUrl || "https://apidatav2.chinaz.com");
|
|
48
|
+
this.timeoutMs = config.timeoutMs || 15e3;
|
|
49
|
+
this.maxResponseBytes = config.maxResponseBytes || 1048576;
|
|
50
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0) throw new TypeError("Chinaz request limits are invalid");
|
|
51
|
+
this.send = options.send ?? sendProviderRequest;
|
|
52
|
+
}
|
|
53
|
+
credentials;
|
|
54
|
+
baseURL;
|
|
55
|
+
timeoutMs;
|
|
56
|
+
maxResponseBytes;
|
|
57
|
+
send;
|
|
58
|
+
/** Bind the public site TDK Query. */
|
|
59
|
+
getSiteTDK() {
|
|
60
|
+
return new GetSiteTDKOperation(this);
|
|
61
|
+
}
|
|
62
|
+
/** Send one bounded multipart site TDK request. */
|
|
63
|
+
async getTDK(call, domain) {
|
|
64
|
+
let apiKey = "";
|
|
65
|
+
try {
|
|
66
|
+
const credential = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
67
|
+
apiKey = credential.apiKey instanceof SecretString ? credential.apiKey.reveal() : "";
|
|
68
|
+
} catch {
|
|
69
|
+
return { error: "credential", retryAfterMs: 0 };
|
|
70
|
+
}
|
|
71
|
+
if (!apiKey || apiKey.length > 2048 || /[^\x21-\x7e]/.test(apiKey)) return { error: "credential", retryAfterMs: 0 };
|
|
72
|
+
const boundary = "dex-" + randomBytes(16).toString("hex");
|
|
73
|
+
const form = "--" + boundary + '\r\nContent-Disposition: form-data; name="key"\r\n\r\n' + apiKey + "\r\n--" + boundary + '\r\nContent-Disposition: form-data; name="domain"\r\n\r\n' + domain + "\r\n--" + boundary + "--\r\n";
|
|
74
|
+
const request = { url: this.baseURL + "/single/tdk", method: "POST", headers: { Accept: "application/json", "Content-Type": "multipart/form-data; boundary=" + boundary }, body: new TextEncoder().encode(form), timeoutMs: this.timeoutMs, maxResponseBytes: this.maxResponseBytes, addressPolicy: this.baseURL.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP", signal: call.context.cancellationSignal };
|
|
75
|
+
let response;
|
|
76
|
+
try {
|
|
77
|
+
response = await this.send(request);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (error instanceof BodyTooLargeError && error.status !== void 0) return { response: { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() }, error: "tooLarge", retryAfterMs: 0 };
|
|
80
|
+
return { error: "transport", retryAfterMs: 0 };
|
|
81
|
+
}
|
|
82
|
+
return { response, error: response.body.length > this.maxResponseBytes ? "tooLarge" : void 0, retryAfterMs: parseRetryAfter(header(response.headers, "retry-after")) };
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var GetSiteTDKOperation = class {
|
|
86
|
+
/** Bind the provider client. */
|
|
87
|
+
constructor(client) {
|
|
88
|
+
this.client = client;
|
|
89
|
+
}
|
|
90
|
+
client;
|
|
91
|
+
/** Return the generated Query definition. */
|
|
92
|
+
definition() {
|
|
93
|
+
return GetSiteTDKDefinition;
|
|
94
|
+
}
|
|
95
|
+
/** Classify one provider response using the Go connector contract. */
|
|
96
|
+
async invoke(call, input) {
|
|
97
|
+
if (!input || typeof input.domain !== "string" || !validDomain(input.domain)) return branch("defect", "VALIDATION");
|
|
98
|
+
const exchange = await this.client.getTDK(call, input.domain);
|
|
99
|
+
if (exchange.error === "credential") return branch("defect", "AUTHENTICATION");
|
|
100
|
+
if (exchange.error === "transport" || !exchange.response) return retry("AVAILABILITY");
|
|
101
|
+
const { status, body } = exchange.response;
|
|
102
|
+
if (status === 429) return retry("RATE_LIMIT", exchange.retryAfterMs);
|
|
103
|
+
if (status === 408 || status >= 500) return retry("AVAILABILITY", exchange.retryAfterMs);
|
|
104
|
+
if (exchange.error === "tooLarge") return branch("invalidResponse", "RESPONSE_TOO_LARGE");
|
|
105
|
+
if (status !== 200) return branch("providerRejected", status === 401 ? "AUTHENTICATION" : status === 403 ? "AUTHORIZATION" : status === 400 || status === 404 ? "VALIDATION" : "PROVIDER_REJECTION");
|
|
106
|
+
let wire;
|
|
107
|
+
try {
|
|
108
|
+
wire = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
109
|
+
} catch {
|
|
110
|
+
return branch("invalidResponse", "PROTOCOL");
|
|
111
|
+
}
|
|
112
|
+
if (!wire || typeof wire !== "object" || Array.isArray(wire)) return branch("invalidResponse", "PROTOCOL");
|
|
113
|
+
const response = wire;
|
|
114
|
+
if (typeof response.StateCode !== "number" || !Number.isInteger(response.StateCode)) return branch("invalidResponse", "PROTOCOL");
|
|
115
|
+
const state = response.StateCode;
|
|
116
|
+
if (state === 10025) return branch("notFound", "PROVIDER_REJECTION");
|
|
117
|
+
if ([10011, 10012, 10013, 10026].includes(state)) return retry("RATE_LIMIT", exchange.retryAfterMs);
|
|
118
|
+
if ([-1, 10020, 10024, 10029, 10034].includes(state)) return retry("AVAILABILITY", exchange.retryAfterMs);
|
|
119
|
+
if ([10001, 10003, 10004, 10009].includes(state)) return branch("providerRejected", "AUTHENTICATION");
|
|
120
|
+
if ([10002, 10005, 10008, 10022, 10027, 10032].includes(state)) return branch("providerRejected", "AUTHORIZATION");
|
|
121
|
+
if (state !== 1) return branch("providerRejected", "PROVIDER_REJECTION");
|
|
122
|
+
if (!response.Result || typeof response.Result !== "object" || Array.isArray(response.Result)) return branch("invalidResponse", "PROTOCOL");
|
|
123
|
+
const result = response.Result;
|
|
124
|
+
if ([result.Title, result.Keywords, result.Description, result.IP].some((value) => value !== void 0 && typeof value !== "string")) return branch("invalidResponse", "PROTOCOL");
|
|
125
|
+
return newQueryBranch("found", { domain: input.domain, title: result.Title ?? "", keywords: result.Keywords ?? "", description: result.Description ?? "", ipAddress: result.IP ?? "" });
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
function validDomain(domain) {
|
|
129
|
+
return domain.length >= 3 && domain.length <= 253 && domain === domain.toLowerCase() && domain.split(".").length >= 2 && domain.split(".").every((label) => label.length >= 1 && label.length <= 63 && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(label));
|
|
130
|
+
}
|
|
131
|
+
function header(headers, name) {
|
|
132
|
+
const value = Object.entries(headers).find(([key]) => key.toLowerCase() === name)?.[1];
|
|
133
|
+
return Array.isArray(value) ? value[0] ?? "" : value ?? "";
|
|
134
|
+
}
|
|
135
|
+
function failure(kind) {
|
|
136
|
+
return { provider: "chinaz", operation: "getSiteTDK", kind, message: "Chinaz site TDK query failed" };
|
|
137
|
+
}
|
|
138
|
+
function branch(name, kind) {
|
|
139
|
+
return newQueryBranch(name, { domain: "", title: "", keywords: "", description: "", ipAddress: "" }, {}, failure(kind));
|
|
140
|
+
}
|
|
141
|
+
function retry(kind, delay = 0) {
|
|
142
|
+
return newQueryRetry(failure(kind), delay);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/project.ts
|
|
146
|
+
function newProjectConnection2(project, connectionName) {
|
|
147
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
148
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "chinaz" && entry.connectionName === name);
|
|
149
|
+
if (!selected) throw new TypeError("Chinaz project connection is not configured");
|
|
150
|
+
const fields = selected.configuration;
|
|
151
|
+
const config = ConfigSchema.parse({ ...fields, ...fields.timeout !== void 0 ? { timeoutMs: parseDurationMilliseconds(fields.timeout) } : {} });
|
|
152
|
+
const credentials = {
|
|
153
|
+
async resolve(_call, signal) {
|
|
154
|
+
return decodeCredentials(await loadedProject.resolveCredential("chinaz", name, signal));
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
return new ChinazClient(config, credentials);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function parseDurationMilliseconds(value) {
|
|
161
|
+
if (typeof value === "number") return Math.ceil(value / 1e6);
|
|
162
|
+
if (typeof value !== "string") throw new TypeError("timeout must be a duration");
|
|
163
|
+
let remaining = value;
|
|
164
|
+
let milliseconds = 0;
|
|
165
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
166
|
+
while (remaining) {
|
|
167
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
168
|
+
if (!part) throw new TypeError("timeout must be a positive Go duration");
|
|
169
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
170
|
+
remaining = remaining.slice(part[0].length);
|
|
171
|
+
}
|
|
172
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("timeout must resolve to positive whole milliseconds");
|
|
173
|
+
return milliseconds;
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
ChinazClient,
|
|
177
|
+
ConfigSchema,
|
|
178
|
+
Connection,
|
|
179
|
+
ConnectorID,
|
|
180
|
+
CredentialMaterialError,
|
|
181
|
+
GetSiteTDKBranch,
|
|
182
|
+
GetSiteTDKBranchDefect,
|
|
183
|
+
GetSiteTDKBranchFound,
|
|
184
|
+
GetSiteTDKBranchInvalidResponse,
|
|
185
|
+
GetSiteTDKBranchNotFound,
|
|
186
|
+
GetSiteTDKBranchProviderRejected,
|
|
187
|
+
GetSiteTDKDefinition,
|
|
188
|
+
GetSiteTDKInputSchema,
|
|
189
|
+
GetSiteTDKMetadata,
|
|
190
|
+
ProviderID,
|
|
191
|
+
SiteTDKSchema,
|
|
192
|
+
decodeCredentials,
|
|
193
|
+
isCredentialMaterialError,
|
|
194
|
+
newConnection,
|
|
195
|
+
newConnectionWithOperations,
|
|
196
|
+
newGetSiteTDKStep,
|
|
197
|
+
newProjectConnection2 as newProjectConnection
|
|
198
|
+
};
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { O as Operations, C as Connection, G as GetSiteTDKInput, S as SiteTDK } from './connection-DDnMA7Kj.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for GetSiteTDKInput in scripted cases. */
|
|
7
|
+
declare const emptyGetSiteTDKInput: GetSiteTDKInput;
|
|
8
|
+
/** Go zero value for SiteTDK in scripted cases. */
|
|
9
|
+
declare const emptySiteTDK: SiteTDK;
|
|
10
|
+
/** Script the found branch. */
|
|
11
|
+
declare function getSiteTDKFound(value: SiteTDK, failure?: Failure): Case<SiteTDK>;
|
|
12
|
+
/** Script the notFound branch. */
|
|
13
|
+
declare function getSiteTDKNotFound(value: SiteTDK, failure?: Failure): Case<SiteTDK>;
|
|
14
|
+
/** Script the providerRejected branch. */
|
|
15
|
+
declare function getSiteTDKProviderRejected(value: SiteTDK, failure?: Failure): Case<SiteTDK>;
|
|
16
|
+
/** Script the invalidResponse branch. */
|
|
17
|
+
declare function getSiteTDKInvalidResponse(value: SiteTDK, failure?: Failure): Case<SiteTDK>;
|
|
18
|
+
/** Script the defect branch. */
|
|
19
|
+
declare function getSiteTDKDefect(value: SiteTDK, failure?: Failure): Case<SiteTDK>;
|
|
20
|
+
/** Script a safe retry of getSiteTDK. */
|
|
21
|
+
declare function getSiteTDKRetry(failure: Failure, retryAfterMs?: number): Case<SiteTDK>;
|
|
22
|
+
/** Manifest scenario foundSite for getSiteTDK. */
|
|
23
|
+
declare function getSiteTDKFoundSite(): Case<SiteTDK>;
|
|
24
|
+
/** Default getSiteTDK scenario. */
|
|
25
|
+
declare function getSiteTDKDefault(): Case<SiteTDK>;
|
|
26
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
27
|
+
declare class GeneratedMock implements Operations {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(connectionName: string);
|
|
30
|
+
connection(): Connection;
|
|
31
|
+
getSiteTDK(): MockQuery<GetSiteTDKInput, SiteTDK>;
|
|
32
|
+
assertNoFailures(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { GeneratedMock, emptyGetSiteTDKInput, emptySiteTDK, getSiteTDKDefault, getSiteTDKDefect, getSiteTDKFound, getSiteTDKFoundSite, getSiteTDKInvalidResponse, getSiteTDKNotFound, getSiteTDKProviderRejected, getSiteTDKRetry };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetSiteTDKDefinition,
|
|
3
|
+
GetSiteTDKInputSchema,
|
|
4
|
+
ProviderID,
|
|
5
|
+
SiteTDKSchema,
|
|
6
|
+
newConnectionWithOperations
|
|
7
|
+
} from "./chunk-TCBT664S.js";
|
|
8
|
+
|
|
9
|
+
// src/generated/mock.ts
|
|
10
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
11
|
+
var emptyGetSiteTDKInput = GetSiteTDKInputSchema.parse({
|
|
12
|
+
"domain": ""
|
|
13
|
+
});
|
|
14
|
+
var emptySiteTDK = SiteTDKSchema.parse({
|
|
15
|
+
"domain": "",
|
|
16
|
+
"title": "",
|
|
17
|
+
"keywords": "",
|
|
18
|
+
"description": "",
|
|
19
|
+
"ipAddress": ""
|
|
20
|
+
});
|
|
21
|
+
function getSiteTDKFound(value, failure) {
|
|
22
|
+
return branchCase("found", value, failure);
|
|
23
|
+
}
|
|
24
|
+
function getSiteTDKNotFound(value, failure) {
|
|
25
|
+
return branchCase("notFound", value, failure);
|
|
26
|
+
}
|
|
27
|
+
function getSiteTDKProviderRejected(value, failure) {
|
|
28
|
+
return branchCase("providerRejected", value, failure);
|
|
29
|
+
}
|
|
30
|
+
function getSiteTDKInvalidResponse(value, failure) {
|
|
31
|
+
return branchCase("invalidResponse", value, failure);
|
|
32
|
+
}
|
|
33
|
+
function getSiteTDKDefect(value, failure) {
|
|
34
|
+
return branchCase("defect", value, failure);
|
|
35
|
+
}
|
|
36
|
+
function getSiteTDKRetry(failure, retryAfterMs = 0) {
|
|
37
|
+
return retryCase(failure, retryAfterMs);
|
|
38
|
+
}
|
|
39
|
+
function getSiteTDKFoundSite() {
|
|
40
|
+
const value = SiteTDKSchema.parse({ "description": "Public example site", "domain": "example.com", "ipAddress": "192.0.2.1", "keywords": "example", "title": "Example Site" });
|
|
41
|
+
return branchCase("found", value);
|
|
42
|
+
}
|
|
43
|
+
function getSiteTDKDefault() {
|
|
44
|
+
return getSiteTDKFoundSite();
|
|
45
|
+
}
|
|
46
|
+
var GeneratedMock = class {
|
|
47
|
+
#getSiteTDK;
|
|
48
|
+
#connection;
|
|
49
|
+
constructor(connectionName) {
|
|
50
|
+
this.#getSiteTDK = newQuery(GetSiteTDKDefinition).default(getSiteTDKDefault());
|
|
51
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
52
|
+
}
|
|
53
|
+
connection() {
|
|
54
|
+
return this.#connection;
|
|
55
|
+
}
|
|
56
|
+
getSiteTDK() {
|
|
57
|
+
return this.#getSiteTDK;
|
|
58
|
+
}
|
|
59
|
+
assertNoFailures() {
|
|
60
|
+
this.#getSiteTDK.assertNoFailures();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
GeneratedMock,
|
|
65
|
+
emptyGetSiteTDKInput,
|
|
66
|
+
emptySiteTDK,
|
|
67
|
+
getSiteTDKDefault,
|
|
68
|
+
getSiteTDKDefect,
|
|
69
|
+
getSiteTDKFound,
|
|
70
|
+
getSiteTDKFoundSite,
|
|
71
|
+
getSiteTDKInvalidResponse,
|
|
72
|
+
getSiteTDKNotFound,
|
|
73
|
+
getSiteTDKProviderRejected,
|
|
74
|
+
getSiteTDKRetry
|
|
75
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-chinaz",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "chinaz connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/chinaz/typescript"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
14
|
+
},
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./mock": {
|
|
23
|
+
"types": "./dist/mock.d.ts",
|
|
24
|
+
"import": "./dist/mock.js"
|
|
25
|
+
},
|
|
26
|
+
"./dex-connector.json": "./dex-connector.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"dex-connector.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "eslint src test examples",
|
|
39
|
+
"test": "vitest run --exclude test/integration/**",
|
|
40
|
+
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
|
+
"example:worker": "tsx examples/basic/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/basic/start.ts",
|
|
43
|
+
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@superdurable/connectors-sdk": "0.1.1",
|
|
47
|
+
"@superdurable/dex": ">=1.28.0",
|
|
48
|
+
"zod": "^4.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/js": "^9.0.0",
|
|
52
|
+
"@types/node": "^22.0.0",
|
|
53
|
+
"eslint": "^9.0.0",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"tsx": "^4.23.15",
|
|
56
|
+
"typescript": "^5.9.0",
|
|
57
|
+
"typescript-eslint": "^8.0.0",
|
|
58
|
+
"vitest": "^3.0.0",
|
|
59
|
+
"yaml": "^2.9.1"
|
|
60
|
+
}
|
|
61
|
+
}
|