@superdurable/connector-newayz 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 +60 -0
- package/dist/chunk-FSXNQI6O.js +123 -0
- package/dist/connection-BiZD46lJ.d.ts +93 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +188 -0
- package/dist/mock.d.ts +33 -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
|
+
# Newayz TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Look up country, province, city, district, and network operator for one public IPv4 address.
|
|
4
|
+
|
|
5
|
+
Install `@superdurable/connector-newayz` 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 `getCurrentWeather` resolves credentials for each call. Local conformance tests replay the Go provider scenarios; live provider authorization has not been verified.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "newayz",
|
|
3
|
+
"releaseTag": "connectors/newayz/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-newayz",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newGetCurrentWeatherStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "getCurrentWeather",
|
|
14
|
+
"inputType": "GetCurrentWeatherInput",
|
|
15
|
+
"description": "Get current weather, temperature, humidity, and wind for one city code.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "fetched",
|
|
25
|
+
"field": "fetched",
|
|
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": "GetCurrentWeatherInput selects one six-digit Chinese city or district code.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"cityCode": {
|
|
49
|
+
"description": "CityCode is a six-digit administrative code such as 420100 for Wuhan.",
|
|
50
|
+
"type": "string"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": [
|
|
54
|
+
"cityCode"
|
|
55
|
+
],
|
|
56
|
+
"type": "object"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
@@ -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
|
+
"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(["access_key"]);
|
|
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["access_key"] != null && !(typeof fields["access_key"] === "string")) throw new CredentialMaterialError("credential access_key has an invalid type");
|
|
28
|
+
const credentials = {};
|
|
29
|
+
if (!fields["access_key"]) throw new CredentialMaterialError("credential access_key is required");
|
|
30
|
+
credentials.accessKey = new SecretString(fields["access_key"] ?? "");
|
|
31
|
+
return credentials;
|
|
32
|
+
}
|
|
33
|
+
var GetCurrentWeatherInputSchema = z.strictObject({
|
|
34
|
+
"cityCode": z.string()
|
|
35
|
+
});
|
|
36
|
+
var GetCurrentWeatherOutputSchema = z.strictObject({
|
|
37
|
+
"province": z.string(),
|
|
38
|
+
"city": z.string(),
|
|
39
|
+
"cityCode": z.string(),
|
|
40
|
+
"weather": z.string(),
|
|
41
|
+
"temperatureCelsius": z.string(),
|
|
42
|
+
"windDirection": z.string(),
|
|
43
|
+
"windPower": z.string(),
|
|
44
|
+
"humidityPercent": z.string(),
|
|
45
|
+
"reportTime": z.string()
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// src/generated/definitions.ts
|
|
49
|
+
var ConnectorID = "newayz";
|
|
50
|
+
var ProviderID = "newayz";
|
|
51
|
+
var GetCurrentWeatherBranch = {
|
|
52
|
+
Fetched: "fetched",
|
|
53
|
+
ProviderRejected: "providerRejected",
|
|
54
|
+
InvalidResponse: "invalidResponse",
|
|
55
|
+
Defect: "defect"
|
|
56
|
+
};
|
|
57
|
+
var GetCurrentWeatherBranchFetched = GetCurrentWeatherBranch.Fetched;
|
|
58
|
+
var GetCurrentWeatherBranchProviderRejected = GetCurrentWeatherBranch.ProviderRejected;
|
|
59
|
+
var GetCurrentWeatherBranchInvalidResponse = GetCurrentWeatherBranch.InvalidResponse;
|
|
60
|
+
var GetCurrentWeatherBranchDefect = GetCurrentWeatherBranch.Defect;
|
|
61
|
+
var GetCurrentWeatherDefinition = {
|
|
62
|
+
operation: { connectorId: ConnectorID, operationId: "getCurrentWeather" },
|
|
63
|
+
branches: [
|
|
64
|
+
{ id: "fetched", description: "WAYZ returned current weather for the city." },
|
|
65
|
+
{ id: "providerRejected", description: "WAYZ rejected the key, permission, quota, or city code.", optional: true },
|
|
66
|
+
{ id: "invalidResponse", description: "WAYZ returned malformed or oversized data.", optional: true },
|
|
67
|
+
{ id: "defect", description: "Local input or connection configuration is invalid.", optional: true }
|
|
68
|
+
],
|
|
69
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: { initialIntervalMs: 2e3, backoffCoefficient: 2, maximumIntervalMs: 3e4, maximumAttempts: 3, totalDurationMs: 3e5 } }
|
|
70
|
+
};
|
|
71
|
+
var GetCurrentWeatherMetadata = { 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
|
+
GetCurrentWeatherInputSchema,
|
|
109
|
+
GetCurrentWeatherOutputSchema,
|
|
110
|
+
ConnectorID,
|
|
111
|
+
ProviderID,
|
|
112
|
+
GetCurrentWeatherBranch,
|
|
113
|
+
GetCurrentWeatherBranchFetched,
|
|
114
|
+
GetCurrentWeatherBranchProviderRejected,
|
|
115
|
+
GetCurrentWeatherBranchInvalidResponse,
|
|
116
|
+
GetCurrentWeatherBranchDefect,
|
|
117
|
+
GetCurrentWeatherDefinition,
|
|
118
|
+
GetCurrentWeatherMetadata,
|
|
119
|
+
Connection,
|
|
120
|
+
newConnection,
|
|
121
|
+
newConnectionWithOperations,
|
|
122
|
+
newProjectConnection
|
|
123
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
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 duration of one HTTPS weather 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 weather response size in bytes as a positive integer. Blank uses the displayed default; increase only if a valid response grows beyond it. */
|
|
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 AccessKey from https://lotboard.newayz.com/ after registration, application approval, and enabling the Weather API. Copy its opaque value; Dex stores it as a credential. Blank prevents requests. */
|
|
19
|
+
accessKey: 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
|
+
/** GetCurrentWeatherInput selects one six-digit Chinese city or district code. */
|
|
32
|
+
interface GetCurrentWeatherInput {
|
|
33
|
+
/** CityCode is a six-digit administrative code such as 420100 for Wuhan. */
|
|
34
|
+
"cityCode": string;
|
|
35
|
+
}
|
|
36
|
+
/** GetCurrentWeatherOutput contains one WAYZ live weather observation. */
|
|
37
|
+
interface GetCurrentWeatherOutput {
|
|
38
|
+
/** Province is the province name. */
|
|
39
|
+
"province": string;
|
|
40
|
+
/** City is the city name. */
|
|
41
|
+
"city": string;
|
|
42
|
+
/** CityCode is the administrative code returned by WAYZ. */
|
|
43
|
+
"cityCode": string;
|
|
44
|
+
/** Weather is the current weather description. */
|
|
45
|
+
"weather": string;
|
|
46
|
+
/** TemperatureCelsius is the observed Celsius temperature as a decimal string. */
|
|
47
|
+
"temperatureCelsius": string;
|
|
48
|
+
/** WindDirection is the current wind direction. */
|
|
49
|
+
"windDirection": string;
|
|
50
|
+
/** WindPower is the provider wind scale string. */
|
|
51
|
+
"windPower": string;
|
|
52
|
+
/** HumidityPercent is the relative humidity percent as a decimal string. */
|
|
53
|
+
"humidityPercent": string;
|
|
54
|
+
/** ReportTime is the provider observation timestamp string. */
|
|
55
|
+
"reportTime": string;
|
|
56
|
+
}
|
|
57
|
+
/** Runtime validator for GetCurrentWeatherInput. */
|
|
58
|
+
declare const GetCurrentWeatherInputSchema: z.ZodObject<{
|
|
59
|
+
cityCode: z.ZodString;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
/** Runtime validator for GetCurrentWeatherOutput. */
|
|
62
|
+
declare const GetCurrentWeatherOutputSchema: z.ZodObject<{
|
|
63
|
+
province: z.ZodString;
|
|
64
|
+
city: z.ZodString;
|
|
65
|
+
cityCode: z.ZodString;
|
|
66
|
+
weather: z.ZodString;
|
|
67
|
+
temperatureCelsius: z.ZodString;
|
|
68
|
+
windDirection: z.ZodString;
|
|
69
|
+
windPower: z.ZodString;
|
|
70
|
+
humidityPercent: z.ZodString;
|
|
71
|
+
reportTime: z.ZodString;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
|
|
74
|
+
/** Typed operations supplied by a client or mock. */
|
|
75
|
+
interface Operations {
|
|
76
|
+
/** Invoke getCurrentWeather through this connection. */
|
|
77
|
+
getCurrentWeather(): Query<GetCurrentWeatherInput, GetCurrentWeatherOutput>;
|
|
78
|
+
}
|
|
79
|
+
/** Named connector connection kept outside Flow state. */
|
|
80
|
+
declare class Connection<BoundOperations = Operations> {
|
|
81
|
+
/** Stable provider and connection name. */
|
|
82
|
+
readonly reference: ConnectionRef;
|
|
83
|
+
/** Bound provider operations. */
|
|
84
|
+
readonly operations: BoundOperations;
|
|
85
|
+
/** Validate a reference and bind operations. */
|
|
86
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
87
|
+
}
|
|
88
|
+
/** Bind a client to a named connection. */
|
|
89
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
90
|
+
/** Bind scripted operations to a named connection. */
|
|
91
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
92
|
+
|
|
93
|
+
export { Connection as C, type GetCurrentWeatherInput as G, type Operations as O, type GetCurrentWeatherOutput as a, type Config as b, type Credentials as c, ConfigSchema as d, CredentialMaterialError as e, type CredentialSource as f, GetCurrentWeatherInputSchema as g, GetCurrentWeatherOutputSchema as h, decodeCredentials as i, isCredentialMaterialError as j, newConnectionWithOperations as k, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { G as GetCurrentWeatherInput, a as GetCurrentWeatherOutput, C as Connection, O as Operations, b as Config, c as Credentials } from './connection-BiZD46lJ.js';
|
|
2
|
+
export { d as ConfigSchema, e as CredentialMaterialError, f as CredentialSource, g as GetCurrentWeatherInputSchema, h as GetCurrentWeatherOutputSchema, i as decodeCredentials, j as isCredentialMaterialError, n as newConnection, k as newConnectionWithOperations } from './connection-BiZD46lJ.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 = "newayz";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "newayz";
|
|
13
|
+
/** Branch IDs for getCurrentWeather. */
|
|
14
|
+
declare const GetCurrentWeatherBranch: {
|
|
15
|
+
readonly Fetched: "fetched";
|
|
16
|
+
readonly ProviderRejected: "providerRejected";
|
|
17
|
+
readonly InvalidResponse: "invalidResponse";
|
|
18
|
+
readonly Defect: "defect";
|
|
19
|
+
};
|
|
20
|
+
/** WAYZ returned current weather for the city. */
|
|
21
|
+
declare const GetCurrentWeatherBranchFetched: "fetched";
|
|
22
|
+
/** WAYZ rejected the key, permission, quota, or city code. */
|
|
23
|
+
declare const GetCurrentWeatherBranchProviderRejected: "providerRejected";
|
|
24
|
+
/** WAYZ returned malformed or oversized data. */
|
|
25
|
+
declare const GetCurrentWeatherBranchInvalidResponse: "invalidResponse";
|
|
26
|
+
/** Local input or connection configuration is invalid. */
|
|
27
|
+
declare const GetCurrentWeatherBranchDefect: "defect";
|
|
28
|
+
/** Manifest definition for getCurrentWeather. */
|
|
29
|
+
declare const GetCurrentWeatherDefinition: QueryDefinition;
|
|
30
|
+
/** Manifest metadata for getCurrentWeather. */
|
|
31
|
+
declare const GetCurrentWeatherMetadata: {
|
|
32
|
+
readonly kind: "query";
|
|
33
|
+
readonly idempotency: "none";
|
|
34
|
+
readonly authorization: "required";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Configuration for the getCurrentWeather connector Step. */
|
|
38
|
+
interface GetCurrentWeatherStepConfig<StepInput, OperationInput = GetCurrentWeatherInput, OperationOutput = GetCurrentWeatherOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
39
|
+
/** Named connection supplying this operation. */
|
|
40
|
+
connection: Connection<{
|
|
41
|
+
getCurrentWeather(): Query<OperationInput, OperationOutput>;
|
|
42
|
+
}>;
|
|
43
|
+
/** Name matching the bound connection. */
|
|
44
|
+
connectionName: string;
|
|
45
|
+
/** WAYZ returned current weather for the city. */
|
|
46
|
+
fetched: StepTarget<QueryResult<OperationOutput>>;
|
|
47
|
+
/** WAYZ rejected the key, permission, quota, or city code. */
|
|
48
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
49
|
+
/** WAYZ returned malformed or oversized data. */
|
|
50
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
51
|
+
/** Local input or connection configuration is invalid. */
|
|
52
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
53
|
+
}
|
|
54
|
+
/** Build the getCurrentWeather Step from a named connection. */
|
|
55
|
+
declare function newGetCurrentWeatherStep<StepInput, OperationInput = GetCurrentWeatherInput, OperationOutput = GetCurrentWeatherOutput>(configuration: GetCurrentWeatherStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
56
|
+
|
|
57
|
+
/** Open one named Newayz connection from Dex project configuration. */
|
|
58
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
59
|
+
|
|
60
|
+
/** Optional HTTP transport for provider tests. */
|
|
61
|
+
interface NewayzClientOptions {
|
|
62
|
+
send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
63
|
+
}
|
|
64
|
+
/** Resolve WAYZ credentials for each current-weather query. */
|
|
65
|
+
declare class NewayzClient {
|
|
66
|
+
private readonly credentials;
|
|
67
|
+
private readonly timeoutMs;
|
|
68
|
+
private readonly maxResponseBytes;
|
|
69
|
+
private readonly send;
|
|
70
|
+
/** Validate settings without contacting WAYZ. */
|
|
71
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: NewayzClientOptions);
|
|
72
|
+
/** Bind the weather Query. */ getCurrentWeather(): GetCurrentWeatherOperation;
|
|
73
|
+
/** Send one bounded request without exposing the query-string credential. */
|
|
74
|
+
request(call: Call, cityCode: string): Promise<{
|
|
75
|
+
response?: ProviderResponse;
|
|
76
|
+
error?: 'credential' | 'transport' | 'tooLarge';
|
|
77
|
+
retryAfterMs: number;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
/** Query one live weather observation. */
|
|
81
|
+
declare class GetCurrentWeatherOperation implements Query<GetCurrentWeatherInput, GetCurrentWeatherOutput> {
|
|
82
|
+
private readonly client;
|
|
83
|
+
/** Bind the provider client. */ constructor(client: NewayzClient);
|
|
84
|
+
/** Return the generated Query definition. */ definition(): QueryDefinition;
|
|
85
|
+
/** Classify the provider response using the Go contract. */
|
|
86
|
+
invoke(call: Call, input: GetCurrentWeatherInput): Promise<QueryAttempt<GetCurrentWeatherOutput>>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { Config, Connection, ConnectorID, Credentials, GetCurrentWeatherBranch, GetCurrentWeatherBranchDefect, GetCurrentWeatherBranchFetched, GetCurrentWeatherBranchInvalidResponse, GetCurrentWeatherBranchProviderRejected, GetCurrentWeatherDefinition, GetCurrentWeatherInput, GetCurrentWeatherMetadata, GetCurrentWeatherOutput, type GetCurrentWeatherStepConfig, NewayzClient, type NewayzClientOptions, ProviderID, newGetCurrentWeatherStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
CredentialMaterialError,
|
|
6
|
+
GetCurrentWeatherBranch,
|
|
7
|
+
GetCurrentWeatherBranchDefect,
|
|
8
|
+
GetCurrentWeatherBranchFetched,
|
|
9
|
+
GetCurrentWeatherBranchInvalidResponse,
|
|
10
|
+
GetCurrentWeatherBranchProviderRejected,
|
|
11
|
+
GetCurrentWeatherDefinition,
|
|
12
|
+
GetCurrentWeatherInputSchema,
|
|
13
|
+
GetCurrentWeatherMetadata,
|
|
14
|
+
GetCurrentWeatherOutputSchema,
|
|
15
|
+
ProviderID,
|
|
16
|
+
decodeCredentials,
|
|
17
|
+
isCredentialMaterialError,
|
|
18
|
+
newConnection,
|
|
19
|
+
newConnectionWithOperations,
|
|
20
|
+
newProjectConnection
|
|
21
|
+
} from "./chunk-FSXNQI6O.js";
|
|
22
|
+
|
|
23
|
+
// src/generated/steps.ts
|
|
24
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
25
|
+
function newGetCurrentWeatherStep(configuration) {
|
|
26
|
+
const { connection, connectionName, fetched, 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.getCurrentWeather(), connection: connection.reference, branches: [
|
|
29
|
+
goToBranch("fetched", fetched),
|
|
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 empty = { province: "", city: "", cityCode: "", weather: "", temperatureCelsius: "", windDirection: "", windPower: "", humidityPercent: "", reportTime: "" };
|
|
40
|
+
var NewayzClient = class {
|
|
41
|
+
/** Validate settings without contacting WAYZ. */
|
|
42
|
+
constructor(config, credentials, options = {}) {
|
|
43
|
+
this.credentials = credentials;
|
|
44
|
+
if (!config || !credentials) throw new TypeError("WAYZ settings and credentials are required");
|
|
45
|
+
this.timeoutMs = config.timeoutMs || 1e4;
|
|
46
|
+
this.maxResponseBytes = config.maxResponseBytes || 262144;
|
|
47
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0 || this.maxResponseBytes > 16 * 1024 * 1024) throw new TypeError("WAYZ limits are invalid");
|
|
48
|
+
this.send = options.send ?? sendProviderRequest;
|
|
49
|
+
}
|
|
50
|
+
credentials;
|
|
51
|
+
timeoutMs;
|
|
52
|
+
maxResponseBytes;
|
|
53
|
+
send;
|
|
54
|
+
/** Bind the weather Query. */
|
|
55
|
+
getCurrentWeather() {
|
|
56
|
+
return new GetCurrentWeatherOperation(this);
|
|
57
|
+
}
|
|
58
|
+
/** Send one bounded request without exposing the query-string credential. */
|
|
59
|
+
async request(call, cityCode) {
|
|
60
|
+
let accessKey = "";
|
|
61
|
+
try {
|
|
62
|
+
const resolved = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
63
|
+
accessKey = resolved.accessKey instanceof SecretString ? resolved.accessKey.reveal() : "";
|
|
64
|
+
} catch {
|
|
65
|
+
return { error: "credential", retryAfterMs: 0 };
|
|
66
|
+
}
|
|
67
|
+
if (!accessKey || accessKey.length > 1024 || /[^\x21-\x7e]/.test(accessKey)) return { error: "credential", retryAfterMs: 0 };
|
|
68
|
+
const url = new URL("https://api.newayz.com/location/scenario/v1/weather");
|
|
69
|
+
url.searchParams.set("access_key", accessKey);
|
|
70
|
+
url.searchParams.set("city", cityCode);
|
|
71
|
+
url.searchParams.set("extensions", "base");
|
|
72
|
+
const request = { url: url.toString(), method: "GET", headers: { Accept: "application/json" }, timeoutMs: this.timeoutMs, maxResponseBytes: this.maxResponseBytes, addressPolicy: "publicHTTPS", signal: call.context.cancellationSignal };
|
|
73
|
+
let response;
|
|
74
|
+
try {
|
|
75
|
+
response = await this.send(request);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error instanceof BodyTooLargeError && error.status !== void 0) return { response: { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() }, error: "tooLarge", retryAfterMs: 0 };
|
|
78
|
+
return { error: "transport", retryAfterMs: 0 };
|
|
79
|
+
}
|
|
80
|
+
return { response, error: response.body.length > this.maxResponseBytes ? "tooLarge" : void 0, retryAfterMs: parseRetryAfter(header(response.headers, "retry-after")) };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var GetCurrentWeatherOperation = class {
|
|
84
|
+
/** Bind the provider client. */
|
|
85
|
+
constructor(client) {
|
|
86
|
+
this.client = client;
|
|
87
|
+
}
|
|
88
|
+
client;
|
|
89
|
+
/** Return the generated Query definition. */
|
|
90
|
+
definition() {
|
|
91
|
+
return GetCurrentWeatherDefinition;
|
|
92
|
+
}
|
|
93
|
+
/** Classify the provider response using the Go contract. */
|
|
94
|
+
async invoke(call, input) {
|
|
95
|
+
const cityCode = input?.cityCode;
|
|
96
|
+
if (typeof cityCode !== "string" || !/^\d{6}$/.test(cityCode)) return branch("defect", "VALIDATION");
|
|
97
|
+
const exchange = await this.client.request(call, cityCode);
|
|
98
|
+
if (exchange.error === "credential") return branch("defect", "AUTHENTICATION");
|
|
99
|
+
if (exchange.error === "transport" || !exchange.response) return retry("AVAILABILITY");
|
|
100
|
+
const { status, body } = exchange.response;
|
|
101
|
+
if (status === 429) return retry("RATE_LIMIT", exchange.retryAfterMs);
|
|
102
|
+
if (status === 408 || status >= 500) return retry("AVAILABILITY", exchange.retryAfterMs);
|
|
103
|
+
if (status !== 200) return branch("providerRejected", status === 401 ? "AUTHENTICATION" : status === 403 ? "AUTHORIZATION" : "PROVIDER_REJECTION");
|
|
104
|
+
if (exchange.error === "tooLarge") return branch("invalidResponse", "RESPONSE_TOO_LARGE");
|
|
105
|
+
let wire;
|
|
106
|
+
try {
|
|
107
|
+
wire = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
108
|
+
} catch {
|
|
109
|
+
return branch("invalidResponse", "PROTOCOL");
|
|
110
|
+
}
|
|
111
|
+
if (!wire || typeof wire !== "object" || Array.isArray(wire)) return branch("invalidResponse", "PROTOCOL");
|
|
112
|
+
const record = wire;
|
|
113
|
+
if (typeof record.status !== "string" || !record.status) return branch("invalidResponse", "PROTOCOL");
|
|
114
|
+
if (record.status !== "1" || record.infocode !== "10000") return branch("providerRejected", "PROVIDER_REJECTION");
|
|
115
|
+
if (!Array.isArray(record.lives) || record.lives.length !== 1 || !record.lives[0] || typeof record.lives[0] !== "object") return branch("invalidResponse", "PROTOCOL");
|
|
116
|
+
const live = record.lives[0];
|
|
117
|
+
if (live.adcode !== cityCode || typeof live.city !== "string" || !live.city || typeof live.weather !== "string" || !live.weather || typeof live.temperature !== "string" || !live.temperature) return branch("invalidResponse", "PROTOCOL");
|
|
118
|
+
const string = (key) => typeof live[key] === "string" ? live[key] : "";
|
|
119
|
+
return newQueryBranch("fetched", { province: string("province"), city: string("city"), cityCode, weather: string("weather"), temperatureCelsius: string("temperature"), windDirection: string("winddirection"), windPower: string("windpower"), humidityPercent: string("humidity"), reportTime: string("reporttime") });
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function header(headers, name) {
|
|
123
|
+
const value = Object.entries(headers).find(([key]) => key.toLowerCase() === name)?.[1];
|
|
124
|
+
return Array.isArray(value) ? value[0] ?? "" : value ?? "";
|
|
125
|
+
}
|
|
126
|
+
function failure(kind) {
|
|
127
|
+
return { provider: "newayz", operation: "getCurrentWeather", kind, message: "WAYZ current-weather query failed" };
|
|
128
|
+
}
|
|
129
|
+
function branch(name, kind) {
|
|
130
|
+
return newQueryBranch(name, empty, {}, failure(kind));
|
|
131
|
+
}
|
|
132
|
+
function retry(kind, delay = 0) {
|
|
133
|
+
return newQueryRetry(failure(kind), delay);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/project.ts
|
|
137
|
+
function newProjectConnection2(project, connectionName) {
|
|
138
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
139
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "newayz" && entry.connectionName === name);
|
|
140
|
+
if (!selected) throw new TypeError("Newayz project connection is not configured");
|
|
141
|
+
const fields = selected.configuration;
|
|
142
|
+
const config = ConfigSchema.parse({ ...fields, ...fields.timeout !== void 0 ? { timeoutMs: parseDurationMilliseconds(fields.timeout) } : {} });
|
|
143
|
+
const credentials = {
|
|
144
|
+
async resolve(_call, signal) {
|
|
145
|
+
return decodeCredentials(await loadedProject.resolveCredential("newayz", name, signal));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return new NewayzClient(config, credentials);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function parseDurationMilliseconds(value) {
|
|
152
|
+
if (typeof value === "number") return Math.ceil(value / 1e6);
|
|
153
|
+
if (typeof value !== "string") throw new TypeError("timeout must be a duration");
|
|
154
|
+
let remaining = value;
|
|
155
|
+
let milliseconds = 0;
|
|
156
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
157
|
+
while (remaining) {
|
|
158
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
159
|
+
if (!part) throw new TypeError("timeout must be a positive Go duration");
|
|
160
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
161
|
+
remaining = remaining.slice(part[0].length);
|
|
162
|
+
}
|
|
163
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("timeout must resolve to positive whole milliseconds");
|
|
164
|
+
return milliseconds;
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
ConfigSchema,
|
|
168
|
+
Connection,
|
|
169
|
+
ConnectorID,
|
|
170
|
+
CredentialMaterialError,
|
|
171
|
+
GetCurrentWeatherBranch,
|
|
172
|
+
GetCurrentWeatherBranchDefect,
|
|
173
|
+
GetCurrentWeatherBranchFetched,
|
|
174
|
+
GetCurrentWeatherBranchInvalidResponse,
|
|
175
|
+
GetCurrentWeatherBranchProviderRejected,
|
|
176
|
+
GetCurrentWeatherDefinition,
|
|
177
|
+
GetCurrentWeatherInputSchema,
|
|
178
|
+
GetCurrentWeatherMetadata,
|
|
179
|
+
GetCurrentWeatherOutputSchema,
|
|
180
|
+
NewayzClient,
|
|
181
|
+
ProviderID,
|
|
182
|
+
decodeCredentials,
|
|
183
|
+
isCredentialMaterialError,
|
|
184
|
+
newConnection,
|
|
185
|
+
newConnectionWithOperations,
|
|
186
|
+
newGetCurrentWeatherStep,
|
|
187
|
+
newProjectConnection2 as newProjectConnection
|
|
188
|
+
};
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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 GetCurrentWeatherInput, a as GetCurrentWeatherOutput } from './connection-BiZD46lJ.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for GetCurrentWeatherInput in scripted cases. */
|
|
7
|
+
declare const emptyGetCurrentWeatherInput: GetCurrentWeatherInput;
|
|
8
|
+
/** Go zero value for GetCurrentWeatherOutput in scripted cases. */
|
|
9
|
+
declare const emptyGetCurrentWeatherOutput: GetCurrentWeatherOutput;
|
|
10
|
+
/** Script the fetched branch. */
|
|
11
|
+
declare function getCurrentWeatherFetched(value: GetCurrentWeatherOutput, failure?: Failure): Case<GetCurrentWeatherOutput>;
|
|
12
|
+
/** Script the providerRejected branch. */
|
|
13
|
+
declare function getCurrentWeatherProviderRejected(value: GetCurrentWeatherOutput, failure?: Failure): Case<GetCurrentWeatherOutput>;
|
|
14
|
+
/** Script the invalidResponse branch. */
|
|
15
|
+
declare function getCurrentWeatherInvalidResponse(value: GetCurrentWeatherOutput, failure?: Failure): Case<GetCurrentWeatherOutput>;
|
|
16
|
+
/** Script the defect branch. */
|
|
17
|
+
declare function getCurrentWeatherDefect(value: GetCurrentWeatherOutput, failure?: Failure): Case<GetCurrentWeatherOutput>;
|
|
18
|
+
/** Script a safe retry of getCurrentWeather. */
|
|
19
|
+
declare function getCurrentWeatherRetry(failure: Failure, retryAfterMs?: number): Case<GetCurrentWeatherOutput>;
|
|
20
|
+
/** Manifest scenario wuhanCurrentWeather for getCurrentWeather. */
|
|
21
|
+
declare function getCurrentWeatherWuhanCurrentWeather(): Case<GetCurrentWeatherOutput>;
|
|
22
|
+
/** Default getCurrentWeather scenario. */
|
|
23
|
+
declare function getCurrentWeatherDefault(): Case<GetCurrentWeatherOutput>;
|
|
24
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
25
|
+
declare class GeneratedMock implements Operations {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(connectionName: string);
|
|
28
|
+
connection(): Connection;
|
|
29
|
+
getCurrentWeather(): MockQuery<GetCurrentWeatherInput, GetCurrentWeatherOutput>;
|
|
30
|
+
assertNoFailures(): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { GeneratedMock, emptyGetCurrentWeatherInput, emptyGetCurrentWeatherOutput, getCurrentWeatherDefault, getCurrentWeatherDefect, getCurrentWeatherFetched, getCurrentWeatherInvalidResponse, getCurrentWeatherProviderRejected, getCurrentWeatherRetry, getCurrentWeatherWuhanCurrentWeather };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetCurrentWeatherDefinition,
|
|
3
|
+
GetCurrentWeatherInputSchema,
|
|
4
|
+
GetCurrentWeatherOutputSchema,
|
|
5
|
+
ProviderID,
|
|
6
|
+
newConnectionWithOperations
|
|
7
|
+
} from "./chunk-FSXNQI6O.js";
|
|
8
|
+
|
|
9
|
+
// src/generated/mock.ts
|
|
10
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
11
|
+
var emptyGetCurrentWeatherInput = GetCurrentWeatherInputSchema.parse({
|
|
12
|
+
"cityCode": ""
|
|
13
|
+
});
|
|
14
|
+
var emptyGetCurrentWeatherOutput = GetCurrentWeatherOutputSchema.parse({
|
|
15
|
+
"province": "",
|
|
16
|
+
"city": "",
|
|
17
|
+
"cityCode": "",
|
|
18
|
+
"weather": "",
|
|
19
|
+
"temperatureCelsius": "",
|
|
20
|
+
"windDirection": "",
|
|
21
|
+
"windPower": "",
|
|
22
|
+
"humidityPercent": "",
|
|
23
|
+
"reportTime": ""
|
|
24
|
+
});
|
|
25
|
+
function getCurrentWeatherFetched(value, failure) {
|
|
26
|
+
return branchCase("fetched", value, failure);
|
|
27
|
+
}
|
|
28
|
+
function getCurrentWeatherProviderRejected(value, failure) {
|
|
29
|
+
return branchCase("providerRejected", value, failure);
|
|
30
|
+
}
|
|
31
|
+
function getCurrentWeatherInvalidResponse(value, failure) {
|
|
32
|
+
return branchCase("invalidResponse", value, failure);
|
|
33
|
+
}
|
|
34
|
+
function getCurrentWeatherDefect(value, failure) {
|
|
35
|
+
return branchCase("defect", value, failure);
|
|
36
|
+
}
|
|
37
|
+
function getCurrentWeatherRetry(failure, retryAfterMs = 0) {
|
|
38
|
+
return retryCase(failure, retryAfterMs);
|
|
39
|
+
}
|
|
40
|
+
function getCurrentWeatherWuhanCurrentWeather() {
|
|
41
|
+
const value = GetCurrentWeatherOutputSchema.parse({ "city": "\u6B66\u6C49\u5E02", "cityCode": "420100", "humidityPercent": "50", "province": "\u6E56\u5317\u7701", "reportTime": "2026-01-01 12:00:00", "temperatureCelsius": "20", "weather": "\u6674", "windDirection": "\u4E1C\u98CE", "windPower": "2" });
|
|
42
|
+
return branchCase("fetched", value);
|
|
43
|
+
}
|
|
44
|
+
function getCurrentWeatherDefault() {
|
|
45
|
+
return getCurrentWeatherWuhanCurrentWeather();
|
|
46
|
+
}
|
|
47
|
+
var GeneratedMock = class {
|
|
48
|
+
#getCurrentWeather;
|
|
49
|
+
#connection;
|
|
50
|
+
constructor(connectionName) {
|
|
51
|
+
this.#getCurrentWeather = newQuery(GetCurrentWeatherDefinition).default(getCurrentWeatherDefault());
|
|
52
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
53
|
+
}
|
|
54
|
+
connection() {
|
|
55
|
+
return this.#connection;
|
|
56
|
+
}
|
|
57
|
+
getCurrentWeather() {
|
|
58
|
+
return this.#getCurrentWeather;
|
|
59
|
+
}
|
|
60
|
+
assertNoFailures() {
|
|
61
|
+
this.#getCurrentWeather.assertNoFailures();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
GeneratedMock,
|
|
66
|
+
emptyGetCurrentWeatherInput,
|
|
67
|
+
emptyGetCurrentWeatherOutput,
|
|
68
|
+
getCurrentWeatherDefault,
|
|
69
|
+
getCurrentWeatherDefect,
|
|
70
|
+
getCurrentWeatherFetched,
|
|
71
|
+
getCurrentWeatherInvalidResponse,
|
|
72
|
+
getCurrentWeatherProviderRejected,
|
|
73
|
+
getCurrentWeatherRetry,
|
|
74
|
+
getCurrentWeatherWuhanCurrentWeather
|
|
75
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-newayz",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "newayz connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/newayz/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.11.0",
|
|
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
|
+
}
|