@superdurable/connector-xingyapi 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 +6 -2
- package/dex-connector.json +60 -0
- package/dist/chunk-WSCQXDUD.js +116 -0
- package/dist/connection-Cz2aXiYh.d.ts +72 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +180 -0
- package/dist/mock.d.ts +35 -0
- package/dist/mock.js +73 -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,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# XingyAPI TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@superdurable/connector-xingyapi` implements the read-only `getInstanceOnlineStatus` Query. It accepts one managed instance GUID and returns its online status and account ID. An API Key is resolved from Dex Connections and sent to XingyAPI over HTTPS; the Key never enters Flow state or results.
|
|
4
|
+
|
|
5
|
+
Obtain a key through the provider account and API guidance linked in the [connector authorization guide](../connector.yaml). Leave timeout and maxResponseBytes blank for manifest defaults. Temporary transport and HTTP 408/429/5xx responses retry; provider refusals, malformed responses, and invalid local input select optional failure branches.
|
|
6
|
+
|
|
7
|
+
`examples/basic/` is a runnable Dex Flow, Worker, and Client. `npm run check` replays Go-recorded provider scenarios. `npm run test:integration` against `dexcli dev -open=false` verifies retry and persistence. Live provider authorization remains unverified without a user-controlled connection.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "xingyapi",
|
|
3
|
+
"releaseTag": "connectors/xingyapi/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-xingyapi",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newGetInstanceOnlineStatusStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "getInstanceOnlineStatus",
|
|
14
|
+
"inputType": "GetInstanceOnlineStatusInput",
|
|
15
|
+
"description": "Check a managed Enterprise WeChat instance's login status.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "checked",
|
|
25
|
+
"field": "checked",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "providerRejected",
|
|
30
|
+
"field": "providerRejected",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "invalidResponse",
|
|
35
|
+
"field": "invalidResponse",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "defect",
|
|
40
|
+
"field": "defect",
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"inputSchema": {
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"description": "GetInstanceOnlineStatusInput identifies an existing managed Enterprise WeChat instance.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"instanceGUID": {
|
|
49
|
+
"description": "InstanceGUID is the inst_xxxx identifier shown on the provider's 实例 page.",
|
|
50
|
+
"type": "string"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": [
|
|
54
|
+
"instanceGUID"
|
|
55
|
+
],
|
|
56
|
+
"type": "object"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var ConfigSchema = z.object({
|
|
5
|
+
"timeoutMs": z.number().int().optional(),
|
|
6
|
+
"maxResponseBytes": z.number().int().optional()
|
|
7
|
+
});
|
|
8
|
+
var CredentialMaterialError = class extends TypeError {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "CredentialMaterialError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
15
|
+
"project credential decoding failed",
|
|
16
|
+
"shared project credential decoding failed",
|
|
17
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
18
|
+
]);
|
|
19
|
+
function isCredentialMaterialError(error) {
|
|
20
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
21
|
+
}
|
|
22
|
+
function decodeCredentials(value) {
|
|
23
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
24
|
+
const fields = value;
|
|
25
|
+
const allowed = /* @__PURE__ */ new Set(["apiKey"]);
|
|
26
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
27
|
+
if (fields["apiKey"] != null && !(typeof fields["apiKey"] === "string")) throw new CredentialMaterialError("credential apiKey has an invalid type");
|
|
28
|
+
const credentials = {};
|
|
29
|
+
if (!fields["apiKey"]) throw new CredentialMaterialError("credential apiKey is required");
|
|
30
|
+
credentials.apiKey = new SecretString(fields["apiKey"] ?? "");
|
|
31
|
+
return credentials;
|
|
32
|
+
}
|
|
33
|
+
var GetInstanceOnlineStatusInputSchema = z.strictObject({
|
|
34
|
+
"instanceGUID": z.string()
|
|
35
|
+
});
|
|
36
|
+
var GetInstanceOnlineStatusOutputSchema = z.strictObject({
|
|
37
|
+
"isOnline": z.boolean(),
|
|
38
|
+
"accountID": z.string()
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// src/generated/definitions.ts
|
|
42
|
+
var ConnectorID = "xingyapi";
|
|
43
|
+
var ProviderID = "xingyapi";
|
|
44
|
+
var GetInstanceOnlineStatusBranch = {
|
|
45
|
+
Checked: "checked",
|
|
46
|
+
ProviderRejected: "providerRejected",
|
|
47
|
+
InvalidResponse: "invalidResponse",
|
|
48
|
+
Defect: "defect"
|
|
49
|
+
};
|
|
50
|
+
var GetInstanceOnlineStatusBranchChecked = GetInstanceOnlineStatusBranch.Checked;
|
|
51
|
+
var GetInstanceOnlineStatusBranchProviderRejected = GetInstanceOnlineStatusBranch.ProviderRejected;
|
|
52
|
+
var GetInstanceOnlineStatusBranchInvalidResponse = GetInstanceOnlineStatusBranch.InvalidResponse;
|
|
53
|
+
var GetInstanceOnlineStatusBranchDefect = GetInstanceOnlineStatusBranch.Defect;
|
|
54
|
+
var GetInstanceOnlineStatusDefinition = {
|
|
55
|
+
operation: { connectorId: ConnectorID, operationId: "getInstanceOnlineStatus" },
|
|
56
|
+
branches: [
|
|
57
|
+
{ id: "checked", description: "XingyAPI returned the instance login status." },
|
|
58
|
+
{ id: "providerRejected", description: "XingyAPI rejected the Key or request.", optional: true },
|
|
59
|
+
{ id: "invalidResponse", description: "XingyAPI returned malformed or oversized data.", optional: true },
|
|
60
|
+
{ id: "defect", description: "The local Key or instance GUID is invalid.", optional: true }
|
|
61
|
+
],
|
|
62
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
63
|
+
};
|
|
64
|
+
var GetInstanceOnlineStatusMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
65
|
+
|
|
66
|
+
// src/generated/connection.ts
|
|
67
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
68
|
+
var Connection = class {
|
|
69
|
+
/** Stable provider and connection name. */
|
|
70
|
+
reference;
|
|
71
|
+
/** Bound provider operations. */
|
|
72
|
+
operations;
|
|
73
|
+
/** Validate a reference and bind operations. */
|
|
74
|
+
constructor(reference, operations) {
|
|
75
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
76
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
77
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
78
|
+
this.operations = operations;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
function newConnection(client, reference) {
|
|
82
|
+
if (!client) throw new TypeError("connector client is required");
|
|
83
|
+
return new Connection(reference, client);
|
|
84
|
+
}
|
|
85
|
+
function newConnectionWithOperations(operations, reference) {
|
|
86
|
+
return new Connection(reference, operations);
|
|
87
|
+
}
|
|
88
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
89
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
90
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
91
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
92
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
93
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
ConfigSchema,
|
|
98
|
+
CredentialMaterialError,
|
|
99
|
+
isCredentialMaterialError,
|
|
100
|
+
decodeCredentials,
|
|
101
|
+
GetInstanceOnlineStatusInputSchema,
|
|
102
|
+
GetInstanceOnlineStatusOutputSchema,
|
|
103
|
+
ConnectorID,
|
|
104
|
+
ProviderID,
|
|
105
|
+
GetInstanceOnlineStatusBranch,
|
|
106
|
+
GetInstanceOnlineStatusBranchChecked,
|
|
107
|
+
GetInstanceOnlineStatusBranchProviderRejected,
|
|
108
|
+
GetInstanceOnlineStatusBranchInvalidResponse,
|
|
109
|
+
GetInstanceOnlineStatusBranchDefect,
|
|
110
|
+
GetInstanceOnlineStatusDefinition,
|
|
111
|
+
GetInstanceOnlineStatusMetadata,
|
|
112
|
+
Connection,
|
|
113
|
+
newConnection,
|
|
114
|
+
newConnectionWithOperations,
|
|
115
|
+
newProjectConnection
|
|
116
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CredentialProvider, SecretString, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** Maximum time for one instance status HTTP request, as a positive Go duration such as 5s or 1m. Blank uses the displayed default; increase only for a slow approved network. Runtime value in milliseconds. */
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
/** Maximum provider response size in bytes, as a positive integer. Blank uses the displayed default; increase only if the account response grows. */
|
|
9
|
+
maxResponseBytes?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Runtime schema for manifest configuration. */
|
|
12
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
13
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/** Private connector credentials resolved by the host. */
|
|
17
|
+
interface Credentials {
|
|
18
|
+
/** Secret API Key from https://open.xingyapi.com > API Key > create or select a Key. Copy it exactly; blank prevents requests. Dex stores it as a secret. */
|
|
19
|
+
apiKey: SecretString;
|
|
20
|
+
}
|
|
21
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
22
|
+
declare class CredentialMaterialError extends TypeError {
|
|
23
|
+
constructor(message: string);
|
|
24
|
+
}
|
|
25
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
26
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
27
|
+
/** Decode private credential fields for the connector. */
|
|
28
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
29
|
+
/** Host-owned source of private connector credentials. */
|
|
30
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
31
|
+
/** GetInstanceOnlineStatusInput identifies an existing managed Enterprise WeChat instance. */
|
|
32
|
+
interface GetInstanceOnlineStatusInput {
|
|
33
|
+
/** InstanceGUID is the inst_xxxx identifier shown on the provider's 实例 page. */
|
|
34
|
+
"instanceGUID": string;
|
|
35
|
+
}
|
|
36
|
+
/** GetInstanceOnlineStatusOutput reports whether a managed account is online. */
|
|
37
|
+
interface GetInstanceOnlineStatusOutput {
|
|
38
|
+
/** IsOnline is true when the provider returns code 0 and a nonzero account ID. */
|
|
39
|
+
"isOnline": boolean;
|
|
40
|
+
/** AccountID is the provider's decimal uin when online; it is empty when offline. */
|
|
41
|
+
"accountID": string;
|
|
42
|
+
}
|
|
43
|
+
/** Runtime validator for GetInstanceOnlineStatusInput. */
|
|
44
|
+
declare const GetInstanceOnlineStatusInputSchema: z.ZodObject<{
|
|
45
|
+
instanceGUID: z.ZodString;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
/** Runtime validator for GetInstanceOnlineStatusOutput. */
|
|
48
|
+
declare const GetInstanceOnlineStatusOutputSchema: z.ZodObject<{
|
|
49
|
+
isOnline: z.ZodBoolean;
|
|
50
|
+
accountID: z.ZodString;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
|
|
53
|
+
/** Typed operations supplied by a client or mock. */
|
|
54
|
+
interface Operations {
|
|
55
|
+
/** Invoke getInstanceOnlineStatus through this connection. */
|
|
56
|
+
getInstanceOnlineStatus(): Query<GetInstanceOnlineStatusInput, GetInstanceOnlineStatusOutput>;
|
|
57
|
+
}
|
|
58
|
+
/** Named connector connection kept outside Flow state. */
|
|
59
|
+
declare class Connection<BoundOperations = Operations> {
|
|
60
|
+
/** Stable provider and connection name. */
|
|
61
|
+
readonly reference: ConnectionRef;
|
|
62
|
+
/** Bound provider operations. */
|
|
63
|
+
readonly operations: BoundOperations;
|
|
64
|
+
/** Validate a reference and bind operations. */
|
|
65
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
66
|
+
}
|
|
67
|
+
/** Bind a client to a named connection. */
|
|
68
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
69
|
+
/** Bind scripted operations to a named connection. */
|
|
70
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
71
|
+
|
|
72
|
+
export { Connection as C, type GetInstanceOnlineStatusInput as G, type Operations as O, type GetInstanceOnlineStatusOutput as a, type Credentials as b, type Config as c, ConfigSchema as d, CredentialMaterialError as e, type CredentialSource as f, GetInstanceOnlineStatusInputSchema as g, GetInstanceOnlineStatusOutputSchema as h, decodeCredentials as i, isCredentialMaterialError as j, newConnectionWithOperations as k, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { G as GetInstanceOnlineStatusInput, a as GetInstanceOnlineStatusOutput, C as Connection, O as Operations, b as Credentials, c as Config } from './connection-Cz2aXiYh.js';
|
|
2
|
+
export { d as ConfigSchema, e as CredentialMaterialError, f as CredentialSource, g as GetInstanceOnlineStatusInputSchema, h as GetInstanceOnlineStatusOutputSchema, i as decodeCredentials, j as isCredentialMaterialError, n as newConnection, k as newConnectionWithOperations } from './connection-Cz2aXiYh.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 = "xingyapi";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "xingyapi";
|
|
13
|
+
/** Branch IDs for getInstanceOnlineStatus. */
|
|
14
|
+
declare const GetInstanceOnlineStatusBranch: {
|
|
15
|
+
readonly Checked: "checked";
|
|
16
|
+
readonly ProviderRejected: "providerRejected";
|
|
17
|
+
readonly InvalidResponse: "invalidResponse";
|
|
18
|
+
readonly Defect: "defect";
|
|
19
|
+
};
|
|
20
|
+
/** XingyAPI returned the instance login status. */
|
|
21
|
+
declare const GetInstanceOnlineStatusBranchChecked: "checked";
|
|
22
|
+
/** XingyAPI rejected the Key or request. */
|
|
23
|
+
declare const GetInstanceOnlineStatusBranchProviderRejected: "providerRejected";
|
|
24
|
+
/** XingyAPI returned malformed or oversized data. */
|
|
25
|
+
declare const GetInstanceOnlineStatusBranchInvalidResponse: "invalidResponse";
|
|
26
|
+
/** The local Key or instance GUID is invalid. */
|
|
27
|
+
declare const GetInstanceOnlineStatusBranchDefect: "defect";
|
|
28
|
+
/** Manifest definition for getInstanceOnlineStatus. */
|
|
29
|
+
declare const GetInstanceOnlineStatusDefinition: QueryDefinition;
|
|
30
|
+
/** Manifest metadata for getInstanceOnlineStatus. */
|
|
31
|
+
declare const GetInstanceOnlineStatusMetadata: {
|
|
32
|
+
readonly kind: "query";
|
|
33
|
+
readonly idempotency: "none";
|
|
34
|
+
readonly authorization: "required";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Configuration for the getInstanceOnlineStatus connector Step. */
|
|
38
|
+
interface GetInstanceOnlineStatusStepConfig<StepInput, OperationInput = GetInstanceOnlineStatusInput, OperationOutput = GetInstanceOnlineStatusOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
39
|
+
/** Named connection supplying this operation. */
|
|
40
|
+
connection: Connection<{
|
|
41
|
+
getInstanceOnlineStatus(): Query<OperationInput, OperationOutput>;
|
|
42
|
+
}>;
|
|
43
|
+
/** Name matching the bound connection. */
|
|
44
|
+
connectionName: string;
|
|
45
|
+
/** XingyAPI returned the instance login status. */
|
|
46
|
+
checked: StepTarget<QueryResult<OperationOutput>>;
|
|
47
|
+
/** XingyAPI rejected the Key or request. */
|
|
48
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
49
|
+
/** XingyAPI returned malformed or oversized data. */
|
|
50
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
51
|
+
/** The local Key or instance GUID is invalid. */
|
|
52
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
53
|
+
}
|
|
54
|
+
/** Build the getInstanceOnlineStatus Step from a named connection. */
|
|
55
|
+
declare function newGetInstanceOnlineStatusStep<StepInput, OperationInput = GetInstanceOnlineStatusInput, OperationOutput = GetInstanceOnlineStatusOutput>(configuration: GetInstanceOnlineStatusStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
56
|
+
|
|
57
|
+
/** Open one named XingyAPI connection from Dex project configuration. */
|
|
58
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
59
|
+
|
|
60
|
+
/** Optional provider transport for deterministic tests. */
|
|
61
|
+
interface XingyAPIClientOptions {
|
|
62
|
+
send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
63
|
+
}
|
|
64
|
+
/** Resolve the API Key for each instance status Query. */
|
|
65
|
+
declare class XingyAPIClient {
|
|
66
|
+
readonly credentials: CredentialProvider<Credentials>;
|
|
67
|
+
readonly timeoutMs: number;
|
|
68
|
+
readonly maxResponseBytes: number;
|
|
69
|
+
readonly send: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
70
|
+
/** Validate request limits without contacting the provider. */
|
|
71
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: XingyAPIClientOptions);
|
|
72
|
+
/** Bind the instance status Query. */
|
|
73
|
+
getInstanceOnlineStatus(): GetInstanceOnlineStatusOperation;
|
|
74
|
+
}
|
|
75
|
+
/** Read one managed Enterprise WeChat instance's login status. */
|
|
76
|
+
declare class GetInstanceOnlineStatusOperation implements Query<GetInstanceOnlineStatusInput, GetInstanceOnlineStatusOutput> {
|
|
77
|
+
private readonly client;
|
|
78
|
+
/** Bind a validated provider client. */ constructor(client: XingyAPIClient);
|
|
79
|
+
/** Return the generated Query contract. */ definition(): QueryDefinition;
|
|
80
|
+
/** Classify one provider attempt. */
|
|
81
|
+
invoke(call: Call, input: GetInstanceOnlineStatusInput): Promise<QueryAttempt<GetInstanceOnlineStatusOutput>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { Config, Connection, ConnectorID, Credentials, GetInstanceOnlineStatusBranch, GetInstanceOnlineStatusBranchChecked, GetInstanceOnlineStatusBranchDefect, GetInstanceOnlineStatusBranchInvalidResponse, GetInstanceOnlineStatusBranchProviderRejected, GetInstanceOnlineStatusDefinition, GetInstanceOnlineStatusInput, GetInstanceOnlineStatusMetadata, GetInstanceOnlineStatusOutput, type GetInstanceOnlineStatusStepConfig, ProviderID, XingyAPIClient, type XingyAPIClientOptions, newGetInstanceOnlineStatusStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
CredentialMaterialError,
|
|
6
|
+
GetInstanceOnlineStatusBranch,
|
|
7
|
+
GetInstanceOnlineStatusBranchChecked,
|
|
8
|
+
GetInstanceOnlineStatusBranchDefect,
|
|
9
|
+
GetInstanceOnlineStatusBranchInvalidResponse,
|
|
10
|
+
GetInstanceOnlineStatusBranchProviderRejected,
|
|
11
|
+
GetInstanceOnlineStatusDefinition,
|
|
12
|
+
GetInstanceOnlineStatusInputSchema,
|
|
13
|
+
GetInstanceOnlineStatusMetadata,
|
|
14
|
+
GetInstanceOnlineStatusOutputSchema,
|
|
15
|
+
ProviderID,
|
|
16
|
+
decodeCredentials,
|
|
17
|
+
isCredentialMaterialError,
|
|
18
|
+
newConnection,
|
|
19
|
+
newConnectionWithOperations,
|
|
20
|
+
newProjectConnection
|
|
21
|
+
} from "./chunk-WSCQXDUD.js";
|
|
22
|
+
|
|
23
|
+
// src/generated/steps.ts
|
|
24
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
25
|
+
function newGetInstanceOnlineStatusStep(configuration) {
|
|
26
|
+
const { connection, connectionName, checked, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
27
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
28
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getInstanceOnlineStatus(), connection: connection.reference, branches: [
|
|
29
|
+
goToBranch("checked", checked),
|
|
30
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
31
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
32
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/client.ts
|
|
37
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
38
|
+
import { BodyTooLargeError, parseRetryAfter, sendProviderRequest } from "@superdurable/connectors-sdk/providerhttp";
|
|
39
|
+
var endpoint = "https://api.xingyapi.com/api/personal/getInfo";
|
|
40
|
+
var emptyOutput = { isOnline: false, accountID: "" };
|
|
41
|
+
var XingyAPIClient = class {
|
|
42
|
+
/** Validate request limits without contacting the provider. */
|
|
43
|
+
constructor(config, credentials, options = {}) {
|
|
44
|
+
this.credentials = credentials;
|
|
45
|
+
if (!config || !credentials) throw new TypeError("XingyAPI configuration and credentials are required");
|
|
46
|
+
this.timeoutMs = config.timeoutMs ?? 1e4;
|
|
47
|
+
this.maxResponseBytes = config.maxResponseBytes ?? 1048576;
|
|
48
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0 || this.maxResponseBytes > 16 << 20) throw new TypeError("XingyAPI request limits are invalid");
|
|
49
|
+
this.send = options.send ?? sendProviderRequest;
|
|
50
|
+
}
|
|
51
|
+
credentials;
|
|
52
|
+
timeoutMs;
|
|
53
|
+
maxResponseBytes;
|
|
54
|
+
send;
|
|
55
|
+
/** Bind the instance status Query. */
|
|
56
|
+
getInstanceOnlineStatus() {
|
|
57
|
+
return new GetInstanceOnlineStatusOperation(this);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var GetInstanceOnlineStatusOperation = class {
|
|
61
|
+
/** Bind a validated provider client. */
|
|
62
|
+
constructor(client) {
|
|
63
|
+
this.client = client;
|
|
64
|
+
}
|
|
65
|
+
client;
|
|
66
|
+
/** Return the generated Query contract. */
|
|
67
|
+
definition() {
|
|
68
|
+
return GetInstanceOnlineStatusDefinition;
|
|
69
|
+
}
|
|
70
|
+
/** Classify one provider attempt. */
|
|
71
|
+
async invoke(call, input) {
|
|
72
|
+
if (!input || typeof input.instanceGUID !== "string" || !/^inst_[A-Za-z0-9_-]{1,128}$/.test(input.instanceGUID)) return branch("defect", "VALIDATION");
|
|
73
|
+
let apiKey = "";
|
|
74
|
+
try {
|
|
75
|
+
const fields = await this.client.credentials.resolve(call, call.context.cancellationSignal);
|
|
76
|
+
apiKey = fields.apiKey instanceof SecretString ? fields.apiKey.reveal() : "";
|
|
77
|
+
} catch {
|
|
78
|
+
return branch("defect", "AUTHENTICATION");
|
|
79
|
+
}
|
|
80
|
+
if (!apiKey || apiKey.length > 1024 || !/^[!-~]+$/.test(apiKey)) return branch("defect", "AUTHENTICATION");
|
|
81
|
+
let response;
|
|
82
|
+
let tooLarge = false;
|
|
83
|
+
try {
|
|
84
|
+
response = await this.client.send({ url: endpoint, method: "POST", headers: { "X-Nebula-Key": apiKey, "Content-Type": "application/json", Accept: "application/json" }, body: new TextEncoder().encode(JSON.stringify({ instance_guid: input.instanceGUID })), timeoutMs: this.client.timeoutMs, maxResponseBytes: this.client.maxResponseBytes, addressPolicy: "publicHTTPS", signal: call.context.cancellationSignal });
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (!(error instanceof BodyTooLargeError) || error.status === void 0) return retry("AVAILABILITY");
|
|
87
|
+
response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
|
|
88
|
+
tooLarge = true;
|
|
89
|
+
}
|
|
90
|
+
const retryAfterValue = Object.entries(response.headers).find(([key]) => key.toLowerCase() === "retry-after")?.[1];
|
|
91
|
+
const retryAfterMs = parseRetryAfter(Array.isArray(retryAfterValue) ? retryAfterValue[0] ?? "" : retryAfterValue ?? "");
|
|
92
|
+
if (response.status === 429) return retry("RATE_LIMIT", retryAfterMs);
|
|
93
|
+
if (response.status === 408 || response.status >= 500) return retry("AVAILABILITY", retryAfterMs);
|
|
94
|
+
if (response.status !== 200) return branch("providerRejected", response.status === 401 ? "AUTHENTICATION" : response.status === 403 ? "AUTHORIZATION" : "PROVIDER_REJECTION");
|
|
95
|
+
if (tooLarge || response.body.length > this.client.maxResponseBytes) return branch("invalidResponse", "RESPONSE_TOO_LARGE");
|
|
96
|
+
let raw = "";
|
|
97
|
+
let document;
|
|
98
|
+
try {
|
|
99
|
+
raw = new TextDecoder("utf-8", { fatal: true }).decode(response.body);
|
|
100
|
+
document = JSON.parse(raw);
|
|
101
|
+
} catch {
|
|
102
|
+
return branch("invalidResponse", "PROTOCOL");
|
|
103
|
+
}
|
|
104
|
+
if (!isRecord(document) || typeof document.ok !== "boolean" || !Number.isInteger(document.code)) return branch("invalidResponse", "PROTOCOL");
|
|
105
|
+
if (document.code === 50001 && !document.ok && document.message === "no account is currently logged in on this device") return newQueryBranch("checked", emptyOutput);
|
|
106
|
+
if (document.code === 5e4) return retry("AVAILABILITY", retryAfterMs);
|
|
107
|
+
if (document.code !== 0) return branch("providerRejected", document.code === 401 ? "AUTHENTICATION" : document.code === 40301 ? "AUTHORIZATION" : "PROVIDER_REJECTION");
|
|
108
|
+
if (!document.ok || !isRecord(document.data)) return branch("invalidResponse", "PROTOCOL");
|
|
109
|
+
const match = /"uin"\s*:\s*(?:"([0-9]{1,20})"|([0-9]{1,20}))(?![0-9])/.exec(raw);
|
|
110
|
+
const accountID = match?.[1] ?? match?.[2] ?? "";
|
|
111
|
+
if (!accountID || !/^[0-9]{1,20}$/.test(accountID)) return branch("invalidResponse", "PROTOCOL");
|
|
112
|
+
return newQueryBranch("checked", { isOnline: accountID !== "0", accountID: accountID === "0" ? "" : accountID });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function isRecord(value) {
|
|
116
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
117
|
+
}
|
|
118
|
+
function failure(kind) {
|
|
119
|
+
return { provider: "xingyapi", operation: "getInstanceOnlineStatus", kind, message: "XingyAPI instance status failed" };
|
|
120
|
+
}
|
|
121
|
+
function branch(name, kind) {
|
|
122
|
+
return newQueryBranch(name, emptyOutput, {}, failure(kind));
|
|
123
|
+
}
|
|
124
|
+
function retry(kind, delay = 0) {
|
|
125
|
+
return newQueryRetry(failure(kind), delay);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/project.ts
|
|
129
|
+
function newProjectConnection2(project, connectionName) {
|
|
130
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
131
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "xingyapi" && entry.connectionName === name);
|
|
132
|
+
if (!selected) throw new TypeError("XingyAPI project connection is not configured");
|
|
133
|
+
const fields = selected.configuration;
|
|
134
|
+
const config = ConfigSchema.parse({ ...fields, ...fields.timeout !== void 0 ? { timeoutMs: parseDurationMilliseconds(fields.timeout) } : {} });
|
|
135
|
+
const credentials = {
|
|
136
|
+
async resolve(_call, signal) {
|
|
137
|
+
return decodeCredentials(await loadedProject.resolveCredential("xingyapi", name, signal));
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return new XingyAPIClient(config, credentials);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function parseDurationMilliseconds(value) {
|
|
144
|
+
if (typeof value === "number") return Math.ceil(value / 1e6);
|
|
145
|
+
if (typeof value !== "string") throw new TypeError("timeout must be a duration");
|
|
146
|
+
let remaining = value;
|
|
147
|
+
let milliseconds = 0;
|
|
148
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
149
|
+
while (remaining) {
|
|
150
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
151
|
+
if (!part) throw new TypeError("timeout must be a positive Go duration");
|
|
152
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
153
|
+
remaining = remaining.slice(part[0].length);
|
|
154
|
+
}
|
|
155
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("timeout must resolve to positive whole milliseconds");
|
|
156
|
+
return milliseconds;
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
ConfigSchema,
|
|
160
|
+
Connection,
|
|
161
|
+
ConnectorID,
|
|
162
|
+
CredentialMaterialError,
|
|
163
|
+
GetInstanceOnlineStatusBranch,
|
|
164
|
+
GetInstanceOnlineStatusBranchChecked,
|
|
165
|
+
GetInstanceOnlineStatusBranchDefect,
|
|
166
|
+
GetInstanceOnlineStatusBranchInvalidResponse,
|
|
167
|
+
GetInstanceOnlineStatusBranchProviderRejected,
|
|
168
|
+
GetInstanceOnlineStatusDefinition,
|
|
169
|
+
GetInstanceOnlineStatusInputSchema,
|
|
170
|
+
GetInstanceOnlineStatusMetadata,
|
|
171
|
+
GetInstanceOnlineStatusOutputSchema,
|
|
172
|
+
ProviderID,
|
|
173
|
+
XingyAPIClient,
|
|
174
|
+
decodeCredentials,
|
|
175
|
+
isCredentialMaterialError,
|
|
176
|
+
newConnection,
|
|
177
|
+
newConnectionWithOperations,
|
|
178
|
+
newGetInstanceOnlineStatusStep,
|
|
179
|
+
newProjectConnection2 as newProjectConnection
|
|
180
|
+
};
|
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 GetInstanceOnlineStatusInput, a as GetInstanceOnlineStatusOutput } from './connection-Cz2aXiYh.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for GetInstanceOnlineStatusInput in scripted cases. */
|
|
7
|
+
declare const emptyGetInstanceOnlineStatusInput: GetInstanceOnlineStatusInput;
|
|
8
|
+
/** Go zero value for GetInstanceOnlineStatusOutput in scripted cases. */
|
|
9
|
+
declare const emptyGetInstanceOnlineStatusOutput: GetInstanceOnlineStatusOutput;
|
|
10
|
+
/** Script the checked branch. */
|
|
11
|
+
declare function getInstanceOnlineStatusChecked(value: GetInstanceOnlineStatusOutput, failure?: Failure): Case<GetInstanceOnlineStatusOutput>;
|
|
12
|
+
/** Script the providerRejected branch. */
|
|
13
|
+
declare function getInstanceOnlineStatusProviderRejected(value: GetInstanceOnlineStatusOutput, failure?: Failure): Case<GetInstanceOnlineStatusOutput>;
|
|
14
|
+
/** Script the invalidResponse branch. */
|
|
15
|
+
declare function getInstanceOnlineStatusInvalidResponse(value: GetInstanceOnlineStatusOutput, failure?: Failure): Case<GetInstanceOnlineStatusOutput>;
|
|
16
|
+
/** Script the defect branch. */
|
|
17
|
+
declare function getInstanceOnlineStatusDefect(value: GetInstanceOnlineStatusOutput, failure?: Failure): Case<GetInstanceOnlineStatusOutput>;
|
|
18
|
+
/** Script a safe retry of getInstanceOnlineStatus. */
|
|
19
|
+
declare function getInstanceOnlineStatusRetry(failure: Failure, retryAfterMs?: number): Case<GetInstanceOnlineStatusOutput>;
|
|
20
|
+
/** Manifest scenario onlineInstance for getInstanceOnlineStatus. */
|
|
21
|
+
declare function getInstanceOnlineStatusOnlineInstance(): Case<GetInstanceOnlineStatusOutput>;
|
|
22
|
+
/** Default getInstanceOnlineStatus scenario. */
|
|
23
|
+
declare function getInstanceOnlineStatusDefault(): Case<GetInstanceOnlineStatusOutput>;
|
|
24
|
+
/** Manifest scenario offlineInstance for getInstanceOnlineStatus. */
|
|
25
|
+
declare function getInstanceOnlineStatusOfflineInstance(): Case<GetInstanceOnlineStatusOutput>;
|
|
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
|
+
getInstanceOnlineStatus(): MockQuery<GetInstanceOnlineStatusInput, GetInstanceOnlineStatusOutput>;
|
|
32
|
+
assertNoFailures(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { GeneratedMock, emptyGetInstanceOnlineStatusInput, emptyGetInstanceOnlineStatusOutput, getInstanceOnlineStatusChecked, getInstanceOnlineStatusDefault, getInstanceOnlineStatusDefect, getInstanceOnlineStatusInvalidResponse, getInstanceOnlineStatusOfflineInstance, getInstanceOnlineStatusOnlineInstance, getInstanceOnlineStatusProviderRejected, getInstanceOnlineStatusRetry };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetInstanceOnlineStatusDefinition,
|
|
3
|
+
GetInstanceOnlineStatusInputSchema,
|
|
4
|
+
GetInstanceOnlineStatusOutputSchema,
|
|
5
|
+
ProviderID,
|
|
6
|
+
newConnectionWithOperations
|
|
7
|
+
} from "./chunk-WSCQXDUD.js";
|
|
8
|
+
|
|
9
|
+
// src/generated/mock.ts
|
|
10
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
11
|
+
var emptyGetInstanceOnlineStatusInput = GetInstanceOnlineStatusInputSchema.parse({
|
|
12
|
+
"instanceGUID": ""
|
|
13
|
+
});
|
|
14
|
+
var emptyGetInstanceOnlineStatusOutput = GetInstanceOnlineStatusOutputSchema.parse({
|
|
15
|
+
"isOnline": false,
|
|
16
|
+
"accountID": ""
|
|
17
|
+
});
|
|
18
|
+
function getInstanceOnlineStatusChecked(value, failure) {
|
|
19
|
+
return branchCase("checked", value, failure);
|
|
20
|
+
}
|
|
21
|
+
function getInstanceOnlineStatusProviderRejected(value, failure) {
|
|
22
|
+
return branchCase("providerRejected", value, failure);
|
|
23
|
+
}
|
|
24
|
+
function getInstanceOnlineStatusInvalidResponse(value, failure) {
|
|
25
|
+
return branchCase("invalidResponse", value, failure);
|
|
26
|
+
}
|
|
27
|
+
function getInstanceOnlineStatusDefect(value, failure) {
|
|
28
|
+
return branchCase("defect", value, failure);
|
|
29
|
+
}
|
|
30
|
+
function getInstanceOnlineStatusRetry(failure, retryAfterMs = 0) {
|
|
31
|
+
return retryCase(failure, retryAfterMs);
|
|
32
|
+
}
|
|
33
|
+
function getInstanceOnlineStatusOnlineInstance() {
|
|
34
|
+
const value = GetInstanceOnlineStatusOutputSchema.parse({ "accountID": "1688850000000001", "isOnline": true });
|
|
35
|
+
return branchCase("checked", value);
|
|
36
|
+
}
|
|
37
|
+
function getInstanceOnlineStatusDefault() {
|
|
38
|
+
return getInstanceOnlineStatusOnlineInstance();
|
|
39
|
+
}
|
|
40
|
+
function getInstanceOnlineStatusOfflineInstance() {
|
|
41
|
+
const value = GetInstanceOnlineStatusOutputSchema.parse({ "accountID": "", "isOnline": false });
|
|
42
|
+
return branchCase("checked", value);
|
|
43
|
+
}
|
|
44
|
+
var GeneratedMock = class {
|
|
45
|
+
#getInstanceOnlineStatus;
|
|
46
|
+
#connection;
|
|
47
|
+
constructor(connectionName) {
|
|
48
|
+
this.#getInstanceOnlineStatus = newQuery(GetInstanceOnlineStatusDefinition).default(getInstanceOnlineStatusDefault());
|
|
49
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
50
|
+
}
|
|
51
|
+
connection() {
|
|
52
|
+
return this.#connection;
|
|
53
|
+
}
|
|
54
|
+
getInstanceOnlineStatus() {
|
|
55
|
+
return this.#getInstanceOnlineStatus;
|
|
56
|
+
}
|
|
57
|
+
assertNoFailures() {
|
|
58
|
+
this.#getInstanceOnlineStatus.assertNoFailures();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
GeneratedMock,
|
|
63
|
+
emptyGetInstanceOnlineStatusInput,
|
|
64
|
+
emptyGetInstanceOnlineStatusOutput,
|
|
65
|
+
getInstanceOnlineStatusChecked,
|
|
66
|
+
getInstanceOnlineStatusDefault,
|
|
67
|
+
getInstanceOnlineStatusDefect,
|
|
68
|
+
getInstanceOnlineStatusInvalidResponse,
|
|
69
|
+
getInstanceOnlineStatusOfflineInstance,
|
|
70
|
+
getInstanceOnlineStatusOnlineInstance,
|
|
71
|
+
getInstanceOnlineStatusProviderRejected,
|
|
72
|
+
getInstanceOnlineStatusRetry
|
|
73
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-xingyapi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "XingyAPI IP-location connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/xingyapi/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
|
+
}
|