@superdurable/connector-yanwen 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 +52 -0
- package/dist/chunk-V7SS3J5F.js +123 -0
- package/dist/connection-Bz4q-IxQ.d.ts +89 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +192 -0
- package/dist/mock.d.ts +35 -0
- package/dist/mock.js +72 -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
|
+
# Yanwen TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@superdurable/connector-yanwen` reads authorized handover warehouse codes, names, and regions. It signs each read with the customer number, API token, and Unix millisecond timestamp. The token stays outside Flow input and output.
|
|
4
|
+
|
|
5
|
+
`examples/basic/` runs a Dex Flow, Worker, and Client using relative local imports. `npm run check` replays Go provider scenarios; `npm run test:integration` uses a synthetic provider with real Dex retry and persistence. Live Yanwen authorization is unverified.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "yanwen",
|
|
3
|
+
"releaseTag": "connectors/yanwen/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-yanwen",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newListWarehousesStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "listWarehouses",
|
|
14
|
+
"inputType": "ListWarehousesInput",
|
|
15
|
+
"description": "List handover warehouse codes, names, and regions available to the Yanwen customer.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "listed",
|
|
25
|
+
"field": "listed",
|
|
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": "ListWarehousesInput selects the authorized customer's entire warehouse list.",
|
|
47
|
+
"properties": {},
|
|
48
|
+
"type": "object"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
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_token", "user_id"]);
|
|
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_token"] != null && !(typeof fields["api_token"] === "string")) throw new CredentialMaterialError("credential api_token has an invalid type");
|
|
29
|
+
if (fields["user_id"] != null && !(typeof fields["user_id"] === "string")) throw new CredentialMaterialError("credential user_id has an invalid type");
|
|
30
|
+
const credentials = {};
|
|
31
|
+
if (!fields["user_id"]) throw new CredentialMaterialError("credential user_id is required");
|
|
32
|
+
credentials.userId = fields["user_id"] ?? "";
|
|
33
|
+
if (!fields["api_token"]) throw new CredentialMaterialError("credential api_token is required");
|
|
34
|
+
credentials.apiToken = new SecretString(fields["api_token"] ?? "");
|
|
35
|
+
return credentials;
|
|
36
|
+
}
|
|
37
|
+
var ListWarehousesInputSchema = z.strictObject({});
|
|
38
|
+
var WarehouseSchema = z.strictObject({
|
|
39
|
+
"code": z.string(),
|
|
40
|
+
"name": z.string(),
|
|
41
|
+
"area": z.string()
|
|
42
|
+
});
|
|
43
|
+
var WarehouseListSchema = z.strictObject({
|
|
44
|
+
"warehouses": z.array(WarehouseSchema).nullable()
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// src/generated/definitions.ts
|
|
48
|
+
var ConnectorID = "yanwen";
|
|
49
|
+
var ProviderID = "yanwen";
|
|
50
|
+
var ListWarehousesBranch = {
|
|
51
|
+
Listed: "listed",
|
|
52
|
+
ProviderRejected: "providerRejected",
|
|
53
|
+
InvalidResponse: "invalidResponse",
|
|
54
|
+
Defect: "defect"
|
|
55
|
+
};
|
|
56
|
+
var ListWarehousesBranchListed = ListWarehousesBranch.Listed;
|
|
57
|
+
var ListWarehousesBranchProviderRejected = ListWarehousesBranch.ProviderRejected;
|
|
58
|
+
var ListWarehousesBranchInvalidResponse = ListWarehousesBranch.InvalidResponse;
|
|
59
|
+
var ListWarehousesBranchDefect = ListWarehousesBranch.Defect;
|
|
60
|
+
var ListWarehousesDefinition = {
|
|
61
|
+
operation: { connectorId: ConnectorID, operationId: "listWarehouses" },
|
|
62
|
+
branches: [
|
|
63
|
+
{ id: "listed", description: "Yanwen returned a warehouse list, possibly empty." },
|
|
64
|
+
{ id: "providerRejected", description: "Yanwen rejected the account or request.", optional: true },
|
|
65
|
+
{ id: "invalidResponse", description: "Yanwen returned malformed or oversized warehouse data.", optional: true },
|
|
66
|
+
{ id: "defect", description: "The local connection is invalid.", optional: true }
|
|
67
|
+
],
|
|
68
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
69
|
+
};
|
|
70
|
+
var ListWarehousesMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
71
|
+
|
|
72
|
+
// src/generated/connection.ts
|
|
73
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
74
|
+
var Connection = class {
|
|
75
|
+
/** Stable provider and connection name. */
|
|
76
|
+
reference;
|
|
77
|
+
/** Bound provider operations. */
|
|
78
|
+
operations;
|
|
79
|
+
/** Validate a reference and bind operations. */
|
|
80
|
+
constructor(reference, operations) {
|
|
81
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
82
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
83
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
84
|
+
this.operations = operations;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function newConnection(client, reference) {
|
|
88
|
+
if (!client) throw new TypeError("connector client is required");
|
|
89
|
+
return new Connection(reference, client);
|
|
90
|
+
}
|
|
91
|
+
function newConnectionWithOperations(operations, reference) {
|
|
92
|
+
return new Connection(reference, operations);
|
|
93
|
+
}
|
|
94
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
95
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
96
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
97
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
98
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
99
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
ConfigSchema,
|
|
104
|
+
CredentialMaterialError,
|
|
105
|
+
isCredentialMaterialError,
|
|
106
|
+
decodeCredentials,
|
|
107
|
+
ListWarehousesInputSchema,
|
|
108
|
+
WarehouseSchema,
|
|
109
|
+
WarehouseListSchema,
|
|
110
|
+
ConnectorID,
|
|
111
|
+
ProviderID,
|
|
112
|
+
ListWarehousesBranch,
|
|
113
|
+
ListWarehousesBranchListed,
|
|
114
|
+
ListWarehousesBranchProviderRejected,
|
|
115
|
+
ListWarehousesBranchInvalidResponse,
|
|
116
|
+
ListWarehousesBranchDefect,
|
|
117
|
+
ListWarehousesDefinition,
|
|
118
|
+
ListWarehousesMetadata,
|
|
119
|
+
Connection,
|
|
120
|
+
newConnection,
|
|
121
|
+
newConnectionWithOperations,
|
|
122
|
+
newProjectConnection
|
|
123
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
/** HTTPS origin of the Yanwen order API. Leave blank for the displayed production endpoint; override only for the official sandbox or a provider-approved endpoint. */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Maximum duration of one warehouse-list query 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 warehouse-list response size in bytes as a positive integer. Leave blank for the displayed default; raise only if an authorized list exceeds it. */
|
|
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 API token from customer center > Account Management > Shipping Account Management at https://opendocs.yw56.com.cn/. Copy exactly; blank prevents requests. Dex protects it and uses it only to sign requests. */
|
|
22
|
+
apiToken: SecretString;
|
|
23
|
+
/** Required Yanwen customer number from https://opendocs.yw56.com.cn/ > customer center > Account Management > Shipping Account Management. Copy the non-secret customer number exactly; blank prevents requests. */
|
|
24
|
+
userId: string;
|
|
25
|
+
}
|
|
26
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
27
|
+
declare class CredentialMaterialError extends TypeError {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
31
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
32
|
+
/** Decode private credential fields for the connector. */
|
|
33
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
34
|
+
/** Host-owned source of private connector credentials. */
|
|
35
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
36
|
+
/** ListWarehousesInput selects the authorized customer's entire warehouse list. */
|
|
37
|
+
interface ListWarehousesInput {
|
|
38
|
+
}
|
|
39
|
+
/** Warehouse identifies a Yanwen handover warehouse. */
|
|
40
|
+
interface Warehouse {
|
|
41
|
+
/** Code is the provider's stable warehouse code. */
|
|
42
|
+
"code": string;
|
|
43
|
+
/** Name is the provider's warehouse name. */
|
|
44
|
+
"name": string;
|
|
45
|
+
/** Area is the provider's warehouse region. */
|
|
46
|
+
"area": string;
|
|
47
|
+
}
|
|
48
|
+
/** WarehouseList is a bounded list of authorized handover warehouses. */
|
|
49
|
+
interface WarehouseList {
|
|
50
|
+
/** Warehouses contains at most 500 warehouses. */
|
|
51
|
+
"warehouses": Array<Warehouse> | null;
|
|
52
|
+
}
|
|
53
|
+
/** Runtime validator for ListWarehousesInput. */
|
|
54
|
+
declare const ListWarehousesInputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
55
|
+
/** Runtime validator for Warehouse. */
|
|
56
|
+
declare const WarehouseSchema: z.ZodObject<{
|
|
57
|
+
code: z.ZodString;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
area: z.ZodString;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
/** Runtime validator for WarehouseList. */
|
|
62
|
+
declare const WarehouseListSchema: z.ZodObject<{
|
|
63
|
+
warehouses: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
64
|
+
code: z.ZodString;
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
area: z.ZodString;
|
|
67
|
+
}, z.core.$strict>>>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
|
|
70
|
+
/** Typed operations supplied by a client or mock. */
|
|
71
|
+
interface Operations {
|
|
72
|
+
/** Invoke listWarehouses through this connection. */
|
|
73
|
+
listWarehouses(): Query<ListWarehousesInput, WarehouseList>;
|
|
74
|
+
}
|
|
75
|
+
/** Named connector connection kept outside Flow state. */
|
|
76
|
+
declare class Connection<BoundOperations = Operations> {
|
|
77
|
+
/** Stable provider and connection name. */
|
|
78
|
+
readonly reference: ConnectionRef;
|
|
79
|
+
/** Bound provider operations. */
|
|
80
|
+
readonly operations: BoundOperations;
|
|
81
|
+
/** Validate a reference and bind operations. */
|
|
82
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
83
|
+
}
|
|
84
|
+
/** Bind a client to a named connection. */
|
|
85
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
86
|
+
/** Bind scripted operations to a named connection. */
|
|
87
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
88
|
+
|
|
89
|
+
export { Connection as C, type ListWarehousesInput as L, type Operations as O, type WarehouseList as W, type Config as a, type Credentials as b, ConfigSchema as c, CredentialMaterialError as d, type CredentialSource as e, ListWarehousesInputSchema as f, type Warehouse as g, WarehouseListSchema as h, WarehouseSchema as i, decodeCredentials as j, isCredentialMaterialError as k, newConnectionWithOperations as l, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { L as ListWarehousesInput, W as WarehouseList, C as Connection, O as Operations, a as Config, b as Credentials } from './connection-Bz4q-IxQ.js';
|
|
2
|
+
export { c as ConfigSchema, d as CredentialMaterialError, e as CredentialSource, f as ListWarehousesInputSchema, g as Warehouse, h as WarehouseListSchema, i as WarehouseSchema, j as decodeCredentials, k as isCredentialMaterialError, n as newConnection, l as newConnectionWithOperations } from './connection-Bz4q-IxQ.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 = "yanwen";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "yanwen";
|
|
13
|
+
/** Branch IDs for listWarehouses. */
|
|
14
|
+
declare const ListWarehousesBranch: {
|
|
15
|
+
readonly Listed: "listed";
|
|
16
|
+
readonly ProviderRejected: "providerRejected";
|
|
17
|
+
readonly InvalidResponse: "invalidResponse";
|
|
18
|
+
readonly Defect: "defect";
|
|
19
|
+
};
|
|
20
|
+
/** Yanwen returned a warehouse list, possibly empty. */
|
|
21
|
+
declare const ListWarehousesBranchListed: "listed";
|
|
22
|
+
/** Yanwen rejected the account or request. */
|
|
23
|
+
declare const ListWarehousesBranchProviderRejected: "providerRejected";
|
|
24
|
+
/** Yanwen returned malformed or oversized warehouse data. */
|
|
25
|
+
declare const ListWarehousesBranchInvalidResponse: "invalidResponse";
|
|
26
|
+
/** The local connection is invalid. */
|
|
27
|
+
declare const ListWarehousesBranchDefect: "defect";
|
|
28
|
+
/** Manifest definition for listWarehouses. */
|
|
29
|
+
declare const ListWarehousesDefinition: QueryDefinition;
|
|
30
|
+
/** Manifest metadata for listWarehouses. */
|
|
31
|
+
declare const ListWarehousesMetadata: {
|
|
32
|
+
readonly kind: "query";
|
|
33
|
+
readonly idempotency: "none";
|
|
34
|
+
readonly authorization: "required";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Configuration for the listWarehouses connector Step. */
|
|
38
|
+
interface ListWarehousesStepConfig<StepInput, OperationInput = ListWarehousesInput, OperationOutput = WarehouseList> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
39
|
+
/** Named connection supplying this operation. */
|
|
40
|
+
connection: Connection<{
|
|
41
|
+
listWarehouses(): Query<OperationInput, OperationOutput>;
|
|
42
|
+
}>;
|
|
43
|
+
/** Name matching the bound connection. */
|
|
44
|
+
connectionName: string;
|
|
45
|
+
/** Yanwen returned a warehouse list, possibly empty. */
|
|
46
|
+
listed: StepTarget<QueryResult<OperationOutput>>;
|
|
47
|
+
/** Yanwen rejected the account or request. */
|
|
48
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
49
|
+
/** Yanwen returned malformed or oversized warehouse data. */
|
|
50
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
51
|
+
/** The local connection is invalid. */
|
|
52
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
53
|
+
}
|
|
54
|
+
/** Build the listWarehouses Step from a named connection. */
|
|
55
|
+
declare function newListWarehousesStep<StepInput, OperationInput = ListWarehousesInput, OperationOutput = WarehouseList>(configuration: ListWarehousesStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
56
|
+
|
|
57
|
+
/** Open one named Yanwen connection from Dex project configuration. */
|
|
58
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
59
|
+
|
|
60
|
+
/** Optional provider transport and clock for deterministic verification. */
|
|
61
|
+
interface YanwenClientOptions {
|
|
62
|
+
/** Send one provider request. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
63
|
+
/** Supply the current time for request signatures. */ now?: () => Date;
|
|
64
|
+
}
|
|
65
|
+
/** Read authorized Yanwen handover warehouses with the current API token. */
|
|
66
|
+
declare class YanwenClient {
|
|
67
|
+
private readonly credentials;
|
|
68
|
+
private readonly baseUrl;
|
|
69
|
+
private readonly timeoutMs;
|
|
70
|
+
private readonly maxResponseBytes;
|
|
71
|
+
private readonly send;
|
|
72
|
+
private readonly now;
|
|
73
|
+
/** Validate endpoint and bounds without contacting Yanwen. */
|
|
74
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: YanwenClientOptions);
|
|
75
|
+
/** Bind the warehouse catalog Query. */ listWarehouses(): ListWarehousesOperation;
|
|
76
|
+
/** Sign and read one bounded warehouse catalog. */
|
|
77
|
+
request(call: Call): Promise<QueryAttempt<WarehouseList>>;
|
|
78
|
+
}
|
|
79
|
+
/** Read handover warehouse codes, names, and regions. */
|
|
80
|
+
declare class ListWarehousesOperation implements Query<ListWarehousesInput, WarehouseList> {
|
|
81
|
+
private readonly client;
|
|
82
|
+
/** Bind one validated client. */ constructor(client: YanwenClient);
|
|
83
|
+
/** Return the generated Query contract. */ definition(): QueryDefinition;
|
|
84
|
+
/** Invoke one safe provider read. */ invoke(call: Call): Promise<QueryAttempt<WarehouseList>>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { Config, Connection, ConnectorID, Credentials, ListWarehousesBranch, ListWarehousesBranchDefect, ListWarehousesBranchInvalidResponse, ListWarehousesBranchListed, ListWarehousesBranchProviderRejected, ListWarehousesDefinition, ListWarehousesInput, ListWarehousesMetadata, type ListWarehousesStepConfig, ProviderID, WarehouseList, YanwenClient, type YanwenClientOptions, newListWarehousesStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
CredentialMaterialError,
|
|
6
|
+
ListWarehousesBranch,
|
|
7
|
+
ListWarehousesBranchDefect,
|
|
8
|
+
ListWarehousesBranchInvalidResponse,
|
|
9
|
+
ListWarehousesBranchListed,
|
|
10
|
+
ListWarehousesBranchProviderRejected,
|
|
11
|
+
ListWarehousesDefinition,
|
|
12
|
+
ListWarehousesInputSchema,
|
|
13
|
+
ListWarehousesMetadata,
|
|
14
|
+
ProviderID,
|
|
15
|
+
WarehouseListSchema,
|
|
16
|
+
WarehouseSchema,
|
|
17
|
+
decodeCredentials,
|
|
18
|
+
isCredentialMaterialError,
|
|
19
|
+
newConnection,
|
|
20
|
+
newConnectionWithOperations,
|
|
21
|
+
newProjectConnection
|
|
22
|
+
} from "./chunk-V7SS3J5F.js";
|
|
23
|
+
|
|
24
|
+
// src/generated/steps.ts
|
|
25
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
26
|
+
function newListWarehousesStep(configuration) {
|
|
27
|
+
const { connection, connectionName, listed, 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.listWarehouses(), connection: connection.reference, branches: [
|
|
30
|
+
goToBranch("listed", listed),
|
|
31
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
32
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
33
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/client.ts
|
|
38
|
+
import { createHash } from "crypto";
|
|
39
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
40
|
+
import { BodyTooLargeError, parseRetryAfter, sendProviderRequest } from "@superdurable/connectors-sdk/providerhttp";
|
|
41
|
+
var empty = { warehouses: [] };
|
|
42
|
+
var YanwenClient = class {
|
|
43
|
+
/** Validate endpoint and bounds without contacting Yanwen. */
|
|
44
|
+
constructor(config, credentials, options = {}) {
|
|
45
|
+
this.credentials = credentials;
|
|
46
|
+
if (!config || !credentials) throw new TypeError("Yanwen configuration and credential source are required");
|
|
47
|
+
this.baseUrl = (config.baseUrl || "https://open.yw56.com.cn").replace(/\/$/, "");
|
|
48
|
+
const endpoint = new URL(this.baseUrl);
|
|
49
|
+
if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || endpoint.pathname !== "/") throw new TypeError("Yanwen endpoint must be an HTTPS origin");
|
|
50
|
+
this.timeoutMs = config.timeoutMs ?? 15e3;
|
|
51
|
+
this.maxResponseBytes = config.maxResponseBytes ?? 1048576;
|
|
52
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0 || this.maxResponseBytes > 16 << 20) throw new TypeError("Yanwen request bounds are invalid");
|
|
53
|
+
this.send = options.send ?? sendProviderRequest;
|
|
54
|
+
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
55
|
+
}
|
|
56
|
+
credentials;
|
|
57
|
+
baseUrl;
|
|
58
|
+
timeoutMs;
|
|
59
|
+
maxResponseBytes;
|
|
60
|
+
send;
|
|
61
|
+
now;
|
|
62
|
+
/** Bind the warehouse catalog Query. */
|
|
63
|
+
listWarehouses() {
|
|
64
|
+
return new ListWarehousesOperation(this);
|
|
65
|
+
}
|
|
66
|
+
/** Sign and read one bounded warehouse catalog. */
|
|
67
|
+
async request(call) {
|
|
68
|
+
let credentials;
|
|
69
|
+
try {
|
|
70
|
+
credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
71
|
+
} catch {
|
|
72
|
+
return branch("defect", "AUTHENTICATION");
|
|
73
|
+
}
|
|
74
|
+
const userID = credentials.userId;
|
|
75
|
+
const token = credentials.apiToken instanceof SecretString ? credentials.apiToken.reveal() : "";
|
|
76
|
+
if (typeof userID !== "string" || !userID || userID.length > 64 || userID.trim() !== userID || !/^[!-~]+$/.test(userID) || !token || token.length > 2048 || token.trim() !== token) return branch("defect", "AUTHENTICATION");
|
|
77
|
+
const timestamp = String(this.now().getTime());
|
|
78
|
+
const sign = createHash("md5").update(`${token}${userID}{}jsoncommon.warehouse.getlist${timestamp}V1.0${token}`).digest("hex");
|
|
79
|
+
const query = new URLSearchParams({ user_id: userID, format: "json", method: "common.warehouse.getlist", timestamp, version: "V1.0", sign });
|
|
80
|
+
const request = { url: `${this.baseUrl}/api/order?${query}`, method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json; charset=UTF-8" }, body: Buffer.from("{}"), timeoutMs: this.timeoutMs, maxResponseBytes: this.maxResponseBytes, addressPolicy: "publicHTTPS", signal: call.context.cancellationSignal };
|
|
81
|
+
let response;
|
|
82
|
+
try {
|
|
83
|
+
response = await this.send(request);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (error instanceof BodyTooLargeError && error.status === 200) return branch("invalidResponse", "RESPONSE_TOO_LARGE");
|
|
86
|
+
return retry("AVAILABILITY");
|
|
87
|
+
}
|
|
88
|
+
const retryAfter = Object.entries(response.headers).find(([name]) => name.toLowerCase() === "retry-after")?.[1];
|
|
89
|
+
const delay = parseRetryAfter(Array.isArray(retryAfter) ? retryAfter[0] ?? "" : retryAfter ?? "");
|
|
90
|
+
if (response.status === 429) return retry("RATE_LIMIT", delay);
|
|
91
|
+
if (response.status === 408 || response.status >= 500) return retry("AVAILABILITY", delay);
|
|
92
|
+
if (response.body.length > this.maxResponseBytes) return branch("invalidResponse", "RESPONSE_TOO_LARGE");
|
|
93
|
+
if (response.status !== 200) return branch("providerRejected", response.status === 401 ? "AUTHENTICATION" : response.status === 403 ? "AUTHORIZATION" : [400, 404, 412].includes(response.status) ? "VALIDATION" : "PROVIDER_REJECTION");
|
|
94
|
+
let data;
|
|
95
|
+
try {
|
|
96
|
+
data = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(response.body));
|
|
97
|
+
} catch {
|
|
98
|
+
return branch("invalidResponse", "PROTOCOL");
|
|
99
|
+
}
|
|
100
|
+
if (!isRecord(data) || typeof data.success !== "boolean" || typeof data.code !== "string" || !data.code) return branch("invalidResponse", "PROTOCOL");
|
|
101
|
+
if (!data.success || data.code !== "0") return data.code.startsWith("-") ? retry("AVAILABILITY", delay) : branch("providerRejected", "PROVIDER_REJECTION");
|
|
102
|
+
if (!Array.isArray(data.data) || data.data.length > 500) return branch("invalidResponse", "PROTOCOL");
|
|
103
|
+
const warehouses = [];
|
|
104
|
+
for (const item of data.data) {
|
|
105
|
+
if (!isRecord(item) || typeof item.code !== "string" || !item.code || typeof item.name !== "string" || !item.name || typeof item.area !== "string" || !item.area) return branch("invalidResponse", "PROTOCOL");
|
|
106
|
+
warehouses.push({ code: item.code, name: item.name, area: item.area });
|
|
107
|
+
}
|
|
108
|
+
return newQueryBranch("listed", { warehouses });
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var ListWarehousesOperation = class {
|
|
112
|
+
/** Bind one validated client. */
|
|
113
|
+
constructor(client) {
|
|
114
|
+
this.client = client;
|
|
115
|
+
}
|
|
116
|
+
client;
|
|
117
|
+
/** Return the generated Query contract. */
|
|
118
|
+
definition() {
|
|
119
|
+
return ListWarehousesDefinition;
|
|
120
|
+
}
|
|
121
|
+
/** Invoke one safe provider read. */
|
|
122
|
+
invoke(call) {
|
|
123
|
+
return this.client.request(call);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
function isRecord(value) {
|
|
127
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
128
|
+
}
|
|
129
|
+
function failure(kind) {
|
|
130
|
+
return { provider: "yanwen", operation: "listWarehouses", kind, message: "Yanwen warehouse request failed" };
|
|
131
|
+
}
|
|
132
|
+
function branch(name, kind) {
|
|
133
|
+
return newQueryBranch(name, empty, {}, failure(kind));
|
|
134
|
+
}
|
|
135
|
+
function retry(kind, delay = 0) {
|
|
136
|
+
return newQueryRetry(failure(kind), delay);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/project.ts
|
|
140
|
+
function newProjectConnection2(project, connectionName) {
|
|
141
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
142
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "yanwen" && entry.connectionName === name);
|
|
143
|
+
if (!selected) throw new TypeError("Yanwen project connection is not configured");
|
|
144
|
+
const fields = selected.configuration;
|
|
145
|
+
const config = ConfigSchema.parse({ ...fields, ...fields.timeout !== void 0 ? { timeoutMs: parseDurationMilliseconds(fields.timeout) } : {} });
|
|
146
|
+
const credentials = {
|
|
147
|
+
async resolve(_call, signal) {
|
|
148
|
+
return decodeCredentials(await loadedProject.resolveCredential("yanwen", name, signal));
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return new YanwenClient(config, credentials);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function parseDurationMilliseconds(value) {
|
|
155
|
+
if (typeof value === "number") return Math.ceil(value / 1e6);
|
|
156
|
+
if (typeof value !== "string") throw new TypeError("timeout must be a duration");
|
|
157
|
+
let remaining = value;
|
|
158
|
+
let milliseconds = 0;
|
|
159
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
160
|
+
while (remaining) {
|
|
161
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
162
|
+
if (!part) throw new TypeError("timeout must be a positive Go duration");
|
|
163
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
164
|
+
remaining = remaining.slice(part[0].length);
|
|
165
|
+
}
|
|
166
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("timeout must resolve to positive whole milliseconds");
|
|
167
|
+
return milliseconds;
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
ConfigSchema,
|
|
171
|
+
Connection,
|
|
172
|
+
ConnectorID,
|
|
173
|
+
CredentialMaterialError,
|
|
174
|
+
ListWarehousesBranch,
|
|
175
|
+
ListWarehousesBranchDefect,
|
|
176
|
+
ListWarehousesBranchInvalidResponse,
|
|
177
|
+
ListWarehousesBranchListed,
|
|
178
|
+
ListWarehousesBranchProviderRejected,
|
|
179
|
+
ListWarehousesDefinition,
|
|
180
|
+
ListWarehousesInputSchema,
|
|
181
|
+
ListWarehousesMetadata,
|
|
182
|
+
ProviderID,
|
|
183
|
+
WarehouseListSchema,
|
|
184
|
+
WarehouseSchema,
|
|
185
|
+
YanwenClient,
|
|
186
|
+
decodeCredentials,
|
|
187
|
+
isCredentialMaterialError,
|
|
188
|
+
newConnection,
|
|
189
|
+
newConnectionWithOperations,
|
|
190
|
+
newListWarehousesStep,
|
|
191
|
+
newProjectConnection2 as newProjectConnection
|
|
192
|
+
};
|
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, L as ListWarehousesInput, W as WarehouseList, g as Warehouse } from './connection-Bz4q-IxQ.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for ListWarehousesInput in scripted cases. */
|
|
7
|
+
declare const emptyListWarehousesInput: ListWarehousesInput;
|
|
8
|
+
/** Go zero value for Warehouse in scripted cases. */
|
|
9
|
+
declare const emptyWarehouse: Warehouse;
|
|
10
|
+
/** Go zero value for WarehouseList in scripted cases. */
|
|
11
|
+
declare const emptyWarehouseList: WarehouseList;
|
|
12
|
+
/** Script the listed branch. */
|
|
13
|
+
declare function listWarehousesListed(value: WarehouseList, failure?: Failure): Case<WarehouseList>;
|
|
14
|
+
/** Script the providerRejected branch. */
|
|
15
|
+
declare function listWarehousesProviderRejected(value: WarehouseList, failure?: Failure): Case<WarehouseList>;
|
|
16
|
+
/** Script the invalidResponse branch. */
|
|
17
|
+
declare function listWarehousesInvalidResponse(value: WarehouseList, failure?: Failure): Case<WarehouseList>;
|
|
18
|
+
/** Script the defect branch. */
|
|
19
|
+
declare function listWarehousesDefect(value: WarehouseList, failure?: Failure): Case<WarehouseList>;
|
|
20
|
+
/** Script a safe retry of listWarehouses. */
|
|
21
|
+
declare function listWarehousesRetry(failure: Failure, retryAfterMs?: number): Case<WarehouseList>;
|
|
22
|
+
/** Manifest scenario listedWarehouse for listWarehouses. */
|
|
23
|
+
declare function listWarehousesListedWarehouse(): Case<WarehouseList>;
|
|
24
|
+
/** Default listWarehouses scenario. */
|
|
25
|
+
declare function listWarehousesDefault(): Case<WarehouseList>;
|
|
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
|
+
listWarehouses(): MockQuery<ListWarehousesInput, WarehouseList>;
|
|
32
|
+
assertNoFailures(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { GeneratedMock, emptyListWarehousesInput, emptyWarehouse, emptyWarehouseList, listWarehousesDefault, listWarehousesDefect, listWarehousesInvalidResponse, listWarehousesListed, listWarehousesListedWarehouse, listWarehousesProviderRejected, listWarehousesRetry };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ListWarehousesDefinition,
|
|
3
|
+
ListWarehousesInputSchema,
|
|
4
|
+
ProviderID,
|
|
5
|
+
WarehouseListSchema,
|
|
6
|
+
WarehouseSchema,
|
|
7
|
+
newConnectionWithOperations
|
|
8
|
+
} from "./chunk-V7SS3J5F.js";
|
|
9
|
+
|
|
10
|
+
// src/generated/mock.ts
|
|
11
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
12
|
+
var emptyListWarehousesInput = ListWarehousesInputSchema.parse({});
|
|
13
|
+
var emptyWarehouse = WarehouseSchema.parse({
|
|
14
|
+
"code": "",
|
|
15
|
+
"name": "",
|
|
16
|
+
"area": ""
|
|
17
|
+
});
|
|
18
|
+
var emptyWarehouseList = WarehouseListSchema.parse({
|
|
19
|
+
"warehouses": []
|
|
20
|
+
});
|
|
21
|
+
function listWarehousesListed(value, failure) {
|
|
22
|
+
return branchCase("listed", value, failure);
|
|
23
|
+
}
|
|
24
|
+
function listWarehousesProviderRejected(value, failure) {
|
|
25
|
+
return branchCase("providerRejected", value, failure);
|
|
26
|
+
}
|
|
27
|
+
function listWarehousesInvalidResponse(value, failure) {
|
|
28
|
+
return branchCase("invalidResponse", value, failure);
|
|
29
|
+
}
|
|
30
|
+
function listWarehousesDefect(value, failure) {
|
|
31
|
+
return branchCase("defect", value, failure);
|
|
32
|
+
}
|
|
33
|
+
function listWarehousesRetry(failure, retryAfterMs = 0) {
|
|
34
|
+
return retryCase(failure, retryAfterMs);
|
|
35
|
+
}
|
|
36
|
+
function listWarehousesListedWarehouse() {
|
|
37
|
+
const value = WarehouseListSchema.parse({ "warehouses": [{ "area": "North China", "code": "01", "name": "Beijing Yanwen" }] });
|
|
38
|
+
return branchCase("listed", value);
|
|
39
|
+
}
|
|
40
|
+
function listWarehousesDefault() {
|
|
41
|
+
return listWarehousesListedWarehouse();
|
|
42
|
+
}
|
|
43
|
+
var GeneratedMock = class {
|
|
44
|
+
#listWarehouses;
|
|
45
|
+
#connection;
|
|
46
|
+
constructor(connectionName) {
|
|
47
|
+
this.#listWarehouses = newQuery(ListWarehousesDefinition).default(listWarehousesDefault());
|
|
48
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
49
|
+
}
|
|
50
|
+
connection() {
|
|
51
|
+
return this.#connection;
|
|
52
|
+
}
|
|
53
|
+
listWarehouses() {
|
|
54
|
+
return this.#listWarehouses;
|
|
55
|
+
}
|
|
56
|
+
assertNoFailures() {
|
|
57
|
+
this.#listWarehouses.assertNoFailures();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
GeneratedMock,
|
|
62
|
+
emptyListWarehousesInput,
|
|
63
|
+
emptyWarehouse,
|
|
64
|
+
emptyWarehouseList,
|
|
65
|
+
listWarehousesDefault,
|
|
66
|
+
listWarehousesDefect,
|
|
67
|
+
listWarehousesInvalidResponse,
|
|
68
|
+
listWarehousesListed,
|
|
69
|
+
listWarehousesListedWarehouse,
|
|
70
|
+
listWarehousesProviderRejected,
|
|
71
|
+
listWarehousesRetry
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-yanwen",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "yanwen connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/yanwen/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
|
+
}
|