@superdurable/connector-amplitude 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 +2 -2
- package/dex-connector.json +60 -0
- package/dist/chunk-JHZRBQDD.js +105 -0
- package/dist/connection-E9wVL-jD.d.ts +74 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +222 -0
- package/dist/mock.d.ts +33 -0
- package/dist/mock.js +70 -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,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Amplitude TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Implements `searchUsers`, returning matching user IDs and match type. Go-recorded conformance checks exact requests, branches, retries and outputs. Configure the project API key and secret key using the [connection guide](../README.md). See the [runnable Dex Flow](examples/user-search/README.md). Live provider authorization remains unverified.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "amplitude",
|
|
3
|
+
"releaseTag": "connectors/amplitude/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-amplitude",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newSearchUsersStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "searchUsers",
|
|
14
|
+
"inputType": "SearchUsersInput",
|
|
15
|
+
"description": "Search users and return their user IDs and match type.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "searched",
|
|
25
|
+
"field": "searched",
|
|
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": "SearchUsersInput identifies a user by ID, device ID, Amplitude ID, or user ID prefix.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"user": {
|
|
49
|
+
"description": "User is the non-secret search term accepted by Amplitude User Search.",
|
|
50
|
+
"type": "string"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": [
|
|
54
|
+
"user"
|
|
55
|
+
],
|
|
56
|
+
"type": "object"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
function decodeCredentials(value) {
|
|
10
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
11
|
+
const fields = value;
|
|
12
|
+
const allowed = /* @__PURE__ */ new Set(["apiKey", "secretKey"]);
|
|
13
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
14
|
+
if (fields["apiKey"] != null && !(typeof fields["apiKey"] === "string")) throw new TypeError("credential apiKey has an invalid type");
|
|
15
|
+
if (fields["secretKey"] != null && !(typeof fields["secretKey"] === "string")) throw new TypeError("credential secretKey has an invalid type");
|
|
16
|
+
const credentials = {};
|
|
17
|
+
if (!fields["apiKey"]) throw new TypeError("credential apiKey is required");
|
|
18
|
+
credentials.apiKey = new SecretString(fields["apiKey"] ?? "");
|
|
19
|
+
if (!fields["secretKey"]) throw new TypeError("credential secretKey is required");
|
|
20
|
+
credentials.secretKey = new SecretString(fields["secretKey"] ?? "");
|
|
21
|
+
return credentials;
|
|
22
|
+
}
|
|
23
|
+
var SearchUsersInputSchema = z.strictObject({
|
|
24
|
+
"user": z.string()
|
|
25
|
+
});
|
|
26
|
+
var UserSearchPageSchema = z.strictObject({
|
|
27
|
+
"user": z.string(),
|
|
28
|
+
"userIDs": z.array(z.string()).nullable(),
|
|
29
|
+
"matchType": z.string()
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// src/generated/definitions.ts
|
|
33
|
+
var ConnectorID = "amplitude";
|
|
34
|
+
var ProviderID = "amplitude";
|
|
35
|
+
var SearchUsersBranch = {
|
|
36
|
+
Searched: "searched",
|
|
37
|
+
ProviderRejected: "providerRejected",
|
|
38
|
+
InvalidResponse: "invalidResponse",
|
|
39
|
+
Defect: "defect"
|
|
40
|
+
};
|
|
41
|
+
var SearchUsersBranchSearched = SearchUsersBranch.Searched;
|
|
42
|
+
var SearchUsersBranchProviderRejected = SearchUsersBranch.ProviderRejected;
|
|
43
|
+
var SearchUsersBranchInvalidResponse = SearchUsersBranch.InvalidResponse;
|
|
44
|
+
var SearchUsersBranchDefect = SearchUsersBranch.Defect;
|
|
45
|
+
var SearchUsersDefinition = {
|
|
46
|
+
operation: { connectorId: ConnectorID, operationId: "searchUsers" },
|
|
47
|
+
branches: [
|
|
48
|
+
{ id: "searched", description: "Amplitude returned matching user IDs, possibly empty." },
|
|
49
|
+
{ id: "providerRejected", description: "Amplitude conclusively rejected the search.", optional: true },
|
|
50
|
+
{ id: "invalidResponse", description: "Amplitude returned malformed or oversized JSON.", optional: true },
|
|
51
|
+
{ id: "defect", description: "Local input or credentials are invalid.", optional: true }
|
|
52
|
+
],
|
|
53
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
54
|
+
};
|
|
55
|
+
var SearchUsersMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
56
|
+
|
|
57
|
+
// src/generated/connection.ts
|
|
58
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
59
|
+
var Connection = class {
|
|
60
|
+
/** Stable provider and connection name. */
|
|
61
|
+
reference;
|
|
62
|
+
/** Bound provider operations. */
|
|
63
|
+
operations;
|
|
64
|
+
/** Validate a reference and bind operations. */
|
|
65
|
+
constructor(reference, operations) {
|
|
66
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
67
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
68
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
69
|
+
this.operations = operations;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function newConnection(client, reference) {
|
|
73
|
+
if (!client) throw new TypeError("connector client is required");
|
|
74
|
+
return new Connection(reference, client);
|
|
75
|
+
}
|
|
76
|
+
function newConnectionWithOperations(operations, reference) {
|
|
77
|
+
return new Connection(reference, operations);
|
|
78
|
+
}
|
|
79
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
80
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
81
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
82
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
83
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
84
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
ConfigSchema,
|
|
89
|
+
decodeCredentials,
|
|
90
|
+
SearchUsersInputSchema,
|
|
91
|
+
UserSearchPageSchema,
|
|
92
|
+
ConnectorID,
|
|
93
|
+
ProviderID,
|
|
94
|
+
SearchUsersBranch,
|
|
95
|
+
SearchUsersBranchSearched,
|
|
96
|
+
SearchUsersBranchProviderRejected,
|
|
97
|
+
SearchUsersBranchInvalidResponse,
|
|
98
|
+
SearchUsersBranchDefect,
|
|
99
|
+
SearchUsersDefinition,
|
|
100
|
+
SearchUsersMetadata,
|
|
101
|
+
Connection,
|
|
102
|
+
newConnection,
|
|
103
|
+
newConnectionWithOperations,
|
|
104
|
+
newProjectConnection
|
|
105
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** Dashboard REST API HTTPS root. Blank uses the displayed US-region default; override with https://analytics.eu.amplitude.com for EU data residency or a verified regional host. Do not include path, query, or credentials. */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Maximum duration of one user search as a positive Go duration. Blank uses the displayed default; increase only for slow responses. Runtime value in milliseconds. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Maximum complete user-search JSON response in bytes as a positive integer. Blank uses the displayed default; increase if a project returns many matches. */
|
|
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 project API key from Amplitude > Organization settings > API Keys > select project > Generate API Key or existing key. Copy its complete value, not the key name; blank prevents calls. Dex sends it as the Basic-auth username. */
|
|
22
|
+
apiKey: SecretString;
|
|
23
|
+
/** Secret project secret key from Amplitude > Organization settings > API Keys > select project > Generate Secret Key. Copy the complete key at creation; the Key ID is not the secret. Blank prevents calls. Dex sends it as the Basic-auth password. */
|
|
24
|
+
secretKey: SecretString;
|
|
25
|
+
}
|
|
26
|
+
/** Decode private credential fields for the connector. */
|
|
27
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
28
|
+
/** Host-owned source of private connector credentials. */
|
|
29
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
30
|
+
/** SearchUsersInput identifies a user by ID, device ID, Amplitude ID, or user ID prefix. */
|
|
31
|
+
interface SearchUsersInput {
|
|
32
|
+
/** User is the non-secret search term accepted by Amplitude User Search. */
|
|
33
|
+
"user": string;
|
|
34
|
+
}
|
|
35
|
+
/** UserSearchPage contains the matched user IDs and Amplitude's match type. */
|
|
36
|
+
interface UserSearchPage {
|
|
37
|
+
/** User is the search term supplied to Amplitude. */
|
|
38
|
+
"user": string;
|
|
39
|
+
/** UserIDs are the matched user IDs in provider order. */
|
|
40
|
+
"userIDs": Array<string> | null;
|
|
41
|
+
/** MatchType names the matching strategy reported by Amplitude. */
|
|
42
|
+
"matchType": string;
|
|
43
|
+
}
|
|
44
|
+
/** Runtime validator for SearchUsersInput. */
|
|
45
|
+
declare const SearchUsersInputSchema: z.ZodObject<{
|
|
46
|
+
user: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
/** Runtime validator for UserSearchPage. */
|
|
49
|
+
declare const UserSearchPageSchema: z.ZodObject<{
|
|
50
|
+
user: z.ZodString;
|
|
51
|
+
userIDs: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
52
|
+
matchType: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
|
|
55
|
+
/** Typed operations supplied by a client or mock. */
|
|
56
|
+
interface Operations {
|
|
57
|
+
/** Invoke searchUsers through this connection. */
|
|
58
|
+
searchUsers(): Query<SearchUsersInput, UserSearchPage>;
|
|
59
|
+
}
|
|
60
|
+
/** Named connector connection kept outside Flow state. */
|
|
61
|
+
declare class Connection<BoundOperations = Operations> {
|
|
62
|
+
/** Stable provider and connection name. */
|
|
63
|
+
readonly reference: ConnectionRef;
|
|
64
|
+
/** Bound provider operations. */
|
|
65
|
+
readonly operations: BoundOperations;
|
|
66
|
+
/** Validate a reference and bind operations. */
|
|
67
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
68
|
+
}
|
|
69
|
+
/** Bind a client to a named connection. */
|
|
70
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
71
|
+
/** Bind scripted operations to a named connection. */
|
|
72
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
73
|
+
|
|
74
|
+
export { Connection as C, type Operations as O, type SearchUsersInput as S, type UserSearchPage as U, type Config as a, type Credentials as b, ConfigSchema as c, type CredentialSource as d, SearchUsersInputSchema as e, UserSearchPageSchema as f, decodeCredentials as g, newConnectionWithOperations as h, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { S as SearchUsersInput, U as UserSearchPage, C as Connection, O as Operations, a as Config, b as Credentials } from './connection-E9wVL-jD.js';
|
|
2
|
+
export { c as ConfigSchema, d as CredentialSource, e as SearchUsersInputSchema, f as UserSearchPageSchema, g as decodeCredentials, n as newConnection, h as newConnectionWithOperations } from './connection-E9wVL-jD.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 = "amplitude";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "amplitude";
|
|
13
|
+
/** Branch IDs for searchUsers. */
|
|
14
|
+
declare const SearchUsersBranch: {
|
|
15
|
+
readonly Searched: "searched";
|
|
16
|
+
readonly ProviderRejected: "providerRejected";
|
|
17
|
+
readonly InvalidResponse: "invalidResponse";
|
|
18
|
+
readonly Defect: "defect";
|
|
19
|
+
};
|
|
20
|
+
/** Amplitude returned matching user IDs, possibly empty. */
|
|
21
|
+
declare const SearchUsersBranchSearched: "searched";
|
|
22
|
+
/** Amplitude conclusively rejected the search. */
|
|
23
|
+
declare const SearchUsersBranchProviderRejected: "providerRejected";
|
|
24
|
+
/** Amplitude returned malformed or oversized JSON. */
|
|
25
|
+
declare const SearchUsersBranchInvalidResponse: "invalidResponse";
|
|
26
|
+
/** Local input or credentials are invalid. */
|
|
27
|
+
declare const SearchUsersBranchDefect: "defect";
|
|
28
|
+
/** Manifest definition for searchUsers. */
|
|
29
|
+
declare const SearchUsersDefinition: QueryDefinition;
|
|
30
|
+
/** Manifest metadata for searchUsers. */
|
|
31
|
+
declare const SearchUsersMetadata: {
|
|
32
|
+
readonly kind: "query";
|
|
33
|
+
readonly idempotency: "none";
|
|
34
|
+
readonly authorization: "required";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Configuration for the searchUsers connector Step. */
|
|
38
|
+
interface SearchUsersStepConfig<StepInput, OperationInput = SearchUsersInput, OperationOutput = UserSearchPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
39
|
+
/** Named connection supplying this operation. */
|
|
40
|
+
connection: Connection<{
|
|
41
|
+
searchUsers(): Query<OperationInput, OperationOutput>;
|
|
42
|
+
}>;
|
|
43
|
+
/** Name matching the bound connection. */
|
|
44
|
+
connectionName: string;
|
|
45
|
+
/** Amplitude returned matching user IDs, possibly empty. */
|
|
46
|
+
searched: StepTarget<QueryResult<OperationOutput>>;
|
|
47
|
+
/** Amplitude conclusively rejected the search. */
|
|
48
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
49
|
+
/** Amplitude returned malformed or oversized JSON. */
|
|
50
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
51
|
+
/** Local input or credentials are invalid. */
|
|
52
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
53
|
+
}
|
|
54
|
+
/** Build the searchUsers Step from a named connection. */
|
|
55
|
+
declare function newSearchUsersStep<StepInput, OperationInput = SearchUsersInput, OperationOutput = UserSearchPage>(configuration: SearchUsersStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
56
|
+
|
|
57
|
+
/** Open one named Amplitude connection from Dex project configuration. */
|
|
58
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
59
|
+
|
|
60
|
+
/** Injectable provider sender for tests and local applications. */
|
|
61
|
+
interface AmplitudeClientOptions {
|
|
62
|
+
/** Provider sender; omitted uses the SDK transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
63
|
+
}
|
|
64
|
+
interface Exchange {
|
|
65
|
+
status: number;
|
|
66
|
+
body: Uint8Array;
|
|
67
|
+
retryAfterMs: number;
|
|
68
|
+
error?: 'credential' | 'request' | 'tooLarge';
|
|
69
|
+
}
|
|
70
|
+
/** Authenticated Amplitude Dashboard REST API client for user searches. */
|
|
71
|
+
declare class AmplitudeClient {
|
|
72
|
+
private readonly credentials;
|
|
73
|
+
private readonly baseURL;
|
|
74
|
+
private readonly timeoutMs;
|
|
75
|
+
private readonly maxResponseBytes;
|
|
76
|
+
private readonly send;
|
|
77
|
+
/** Validate provider configuration without contacting Amplitude. */
|
|
78
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: AmplitudeClientOptions);
|
|
79
|
+
/** Bind the searchUsers Query. */ searchUsers(): SearchUsersOperation;
|
|
80
|
+
/** Resolve credentials and send one bounded user search. */
|
|
81
|
+
get(call: Call, user: string): Promise<Exchange>;
|
|
82
|
+
}
|
|
83
|
+
/** Search project users by Amplitude or external identity. */
|
|
84
|
+
declare class SearchUsersOperation implements Query<SearchUsersInput, UserSearchPage> {
|
|
85
|
+
private readonly client;
|
|
86
|
+
/** Bind the provider client. */ constructor(client: AmplitudeClient);
|
|
87
|
+
/** Return the generated Query definition. */ definition(): QueryDefinition;
|
|
88
|
+
/** Classify provider outcomes consistently with Go. */
|
|
89
|
+
invoke(call: Call, input: SearchUsersInput): Promise<QueryAttempt<UserSearchPage>>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { AmplitudeClient, type AmplitudeClientOptions, Config, Connection, ConnectorID, Credentials, ProviderID, SearchUsersBranch, SearchUsersBranchDefect, SearchUsersBranchInvalidResponse, SearchUsersBranchProviderRejected, SearchUsersBranchSearched, SearchUsersDefinition, SearchUsersInput, SearchUsersMetadata, SearchUsersOperation, type SearchUsersStepConfig, UserSearchPage, newProjectConnection, newSearchUsersStep };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
ProviderID,
|
|
6
|
+
SearchUsersBranch,
|
|
7
|
+
SearchUsersBranchDefect,
|
|
8
|
+
SearchUsersBranchInvalidResponse,
|
|
9
|
+
SearchUsersBranchProviderRejected,
|
|
10
|
+
SearchUsersBranchSearched,
|
|
11
|
+
SearchUsersDefinition,
|
|
12
|
+
SearchUsersInputSchema,
|
|
13
|
+
SearchUsersMetadata,
|
|
14
|
+
UserSearchPageSchema,
|
|
15
|
+
decodeCredentials,
|
|
16
|
+
newConnection,
|
|
17
|
+
newConnectionWithOperations,
|
|
18
|
+
newProjectConnection
|
|
19
|
+
} from "./chunk-JHZRBQDD.js";
|
|
20
|
+
|
|
21
|
+
// src/generated/steps.ts
|
|
22
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
23
|
+
function newSearchUsersStep(configuration) {
|
|
24
|
+
const { connection, connectionName, searched, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
25
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
26
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.searchUsers(), connection: connection.reference, branches: [
|
|
27
|
+
goToBranch("searched", searched),
|
|
28
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
29
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
30
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/project.ts
|
|
35
|
+
import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
36
|
+
import { z } from "zod";
|
|
37
|
+
|
|
38
|
+
// src/client.ts
|
|
39
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
40
|
+
import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
41
|
+
var emptyUsers = () => ({ user: "", userIDs: [], matchType: "" });
|
|
42
|
+
var AmplitudeClient = class {
|
|
43
|
+
/** Validate provider configuration without contacting Amplitude. */
|
|
44
|
+
constructor(config, credentials, options = {}) {
|
|
45
|
+
this.credentials = credentials;
|
|
46
|
+
if (!config || !credentials) throw new TypeError("Amplitude configuration and credentials are required");
|
|
47
|
+
this.baseURL = validateBaseURL(config.baseUrl ?? "https://amplitude.com").replace(/\/$/, "");
|
|
48
|
+
this.timeoutMs = config.timeoutMs ?? 15e3;
|
|
49
|
+
this.maxResponseBytes = config.maxResponseBytes ?? 1048576;
|
|
50
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0)
|
|
51
|
+
throw new TypeError("Amplitude request limits must be positive integers");
|
|
52
|
+
this.send = options.send ?? sendProviderRequest;
|
|
53
|
+
}
|
|
54
|
+
credentials;
|
|
55
|
+
baseURL;
|
|
56
|
+
timeoutMs;
|
|
57
|
+
maxResponseBytes;
|
|
58
|
+
send;
|
|
59
|
+
/** Bind the searchUsers Query. */
|
|
60
|
+
searchUsers() {
|
|
61
|
+
return new SearchUsersOperation(this);
|
|
62
|
+
}
|
|
63
|
+
/** Resolve credentials and send one bounded user search. */
|
|
64
|
+
async get(call, user) {
|
|
65
|
+
let apiKey;
|
|
66
|
+
let secretKey;
|
|
67
|
+
try {
|
|
68
|
+
const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
69
|
+
apiKey = credentials.apiKey instanceof SecretString ? credentials.apiKey.reveal() : "";
|
|
70
|
+
secretKey = credentials.secretKey instanceof SecretString ? credentials.secretKey.reveal() : "";
|
|
71
|
+
} catch {
|
|
72
|
+
return emptyExchange("credential");
|
|
73
|
+
}
|
|
74
|
+
if (!isHeaderSafeCredential(apiKey) || !isHeaderSafeCredential(secretKey) || apiKey.includes(":")) return emptyExchange("credential");
|
|
75
|
+
const url = new URL(`${this.baseURL}/api/2/usersearch`);
|
|
76
|
+
url.searchParams.set("user", user);
|
|
77
|
+
const request = {
|
|
78
|
+
url: url.toString(),
|
|
79
|
+
method: "GET",
|
|
80
|
+
headers: { Accept: "application/json", Authorization: `Basic ${Buffer.from(`${apiKey}:${secretKey}`).toString("base64")}` },
|
|
81
|
+
maxResponseBytes: this.maxResponseBytes,
|
|
82
|
+
timeoutMs: this.timeoutMs,
|
|
83
|
+
addressPolicy: this.baseURL.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
|
|
84
|
+
signal: call.context.cancellationSignal
|
|
85
|
+
};
|
|
86
|
+
let response;
|
|
87
|
+
let isTooLarge = false;
|
|
88
|
+
try {
|
|
89
|
+
response = await this.send(request);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof BodyTooLargeError && error.status !== void 0) {
|
|
92
|
+
response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
|
|
93
|
+
isTooLarge = true;
|
|
94
|
+
} else return emptyExchange("request");
|
|
95
|
+
}
|
|
96
|
+
const retryAfterMs = parseRetryAfter(header(response.headers, "retry-after"));
|
|
97
|
+
if (isTooLarge || response.body.length > this.maxResponseBytes)
|
|
98
|
+
return { status: response.status, body: new Uint8Array(), retryAfterMs, error: "tooLarge" };
|
|
99
|
+
return { status: response.status, body: response.body, retryAfterMs };
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var SearchUsersOperation = class {
|
|
103
|
+
/** Bind the provider client. */
|
|
104
|
+
constructor(client) {
|
|
105
|
+
this.client = client;
|
|
106
|
+
}
|
|
107
|
+
client;
|
|
108
|
+
/** Return the generated Query definition. */
|
|
109
|
+
definition() {
|
|
110
|
+
return SearchUsersDefinition;
|
|
111
|
+
}
|
|
112
|
+
/** Classify provider outcomes consistently with Go. */
|
|
113
|
+
async invoke(call, input) {
|
|
114
|
+
if (!isValidUserSearch(input?.user))
|
|
115
|
+
return terminal("defect", "VALIDATION", "user must contain 1\u2013256 printable characters");
|
|
116
|
+
const exchange = await this.client.get(call, input.user);
|
|
117
|
+
if (exchange.error === "credential") return terminal("defect", "AUTHENTICATION", "Amplitude credentials are unavailable or invalid");
|
|
118
|
+
if (exchange.error === "request") return retry("TRANSPORT", "Amplitude request failed");
|
|
119
|
+
if (exchange.status === 429) return retry("RATE_LIMIT", "Amplitude rate limited the request", exchange.retryAfterMs);
|
|
120
|
+
if (exchange.status === 408 || exchange.status >= 500) return retry("AVAILABILITY", "Amplitude is temporarily unavailable", exchange.retryAfterMs);
|
|
121
|
+
if (exchange.status !== 200) return terminal("providerRejected", "PROVIDER_REJECTION", `Amplitude rejected HTTP ${exchange.status}`);
|
|
122
|
+
if (exchange.error === "tooLarge") return terminal("invalidResponse", "RESPONSE_TOO_LARGE", "Amplitude response exceeded the configured limit");
|
|
123
|
+
const users = decodeUsers(exchange.body, input.user);
|
|
124
|
+
if (!users) return terminal("invalidResponse", "PROTOCOL", "Amplitude returned invalid user-search JSON");
|
|
125
|
+
return newQueryBranch("searched", users);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
function isValidUserSearch(value) {
|
|
129
|
+
return typeof value === "string" && value.length > 0 && value.trim() === value && new TextEncoder().encode(value).length <= 256 && [...value].every((character) => character.codePointAt(0) >= 32 && character.codePointAt(0) !== 127) && !/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF])/.test(value);
|
|
130
|
+
}
|
|
131
|
+
function emptyExchange(error) {
|
|
132
|
+
return { status: 0, body: new Uint8Array(), retryAfterMs: 0, error };
|
|
133
|
+
}
|
|
134
|
+
function failure(kind, message) {
|
|
135
|
+
return { provider: "amplitude", operation: "searchUsers", kind, message };
|
|
136
|
+
}
|
|
137
|
+
function terminal(branch, kind, message) {
|
|
138
|
+
return newQueryBranch(branch, emptyUsers(), {}, failure(kind, message));
|
|
139
|
+
}
|
|
140
|
+
function retry(kind, message, delay = 0) {
|
|
141
|
+
return newQueryRetry(failure(kind, message), delay);
|
|
142
|
+
}
|
|
143
|
+
function header(headers, name) {
|
|
144
|
+
const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
145
|
+
return Array.isArray(entry) ? entry[0] ?? "" : entry ?? "";
|
|
146
|
+
}
|
|
147
|
+
function isObject(value) {
|
|
148
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
149
|
+
}
|
|
150
|
+
function decodeUsers(body, user) {
|
|
151
|
+
let raw;
|
|
152
|
+
try {
|
|
153
|
+
raw = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
154
|
+
} catch {
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
157
|
+
if (!isObject(raw) || !Array.isArray(raw.matches) || typeof raw.type !== "string" || !raw.type) return void 0;
|
|
158
|
+
const userIDs = [];
|
|
159
|
+
for (const match of raw.matches) {
|
|
160
|
+
if (!isObject(match) || typeof match.user_id !== "string" || !match.user_id) return void 0;
|
|
161
|
+
userIDs.push(match.user_id);
|
|
162
|
+
}
|
|
163
|
+
return { user, userIDs, matchType: raw.type };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/project.ts
|
|
167
|
+
function newProjectConnection2(project, connectionName) {
|
|
168
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
169
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "amplitude" && entry.connectionName === name);
|
|
170
|
+
if (!selected) throw new TypeError("Amplitude project connection is not configured");
|
|
171
|
+
const fields = z.strictObject({ baseUrl: z.string().optional(), timeout: z.union([z.string(), z.number().int()]).optional(), maxResponseBytes: z.number().int().optional() }).parse(selected.configuration);
|
|
172
|
+
const timeoutMs = typeof fields.timeout === "number" ? Math.ceil(fields.timeout / 1e6) : fields.timeout ? parseDurationMilliseconds(fields.timeout) : void 0;
|
|
173
|
+
const config = {
|
|
174
|
+
...fields.baseUrl ? { baseUrl: fields.baseUrl } : {},
|
|
175
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
176
|
+
...fields.maxResponseBytes !== void 0 ? { maxResponseBytes: fields.maxResponseBytes } : {}
|
|
177
|
+
};
|
|
178
|
+
const credentials = {
|
|
179
|
+
async resolve(_call, signal) {
|
|
180
|
+
const privateFields = await loadedProject.resolveCredential("amplitude", name, signal);
|
|
181
|
+
if (typeof privateFields.apiKey !== "string" || typeof privateFields.secretKey !== "string") throw new TypeError("Amplitude credentials are unavailable");
|
|
182
|
+
return { apiKey: new SecretString2(privateFields.apiKey), secretKey: new SecretString2(privateFields.secretKey) };
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
return new AmplitudeClient(config, credentials);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function parseDurationMilliseconds(value) {
|
|
189
|
+
let remaining = value;
|
|
190
|
+
let milliseconds = 0;
|
|
191
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
192
|
+
while (remaining) {
|
|
193
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
194
|
+
if (!part) throw new TypeError("Amplitude timeout must be a positive Go duration");
|
|
195
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
196
|
+
remaining = remaining.slice(part[0].length);
|
|
197
|
+
}
|
|
198
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("Amplitude timeout must resolve to positive whole milliseconds");
|
|
199
|
+
return milliseconds;
|
|
200
|
+
}
|
|
201
|
+
export {
|
|
202
|
+
AmplitudeClient,
|
|
203
|
+
ConfigSchema,
|
|
204
|
+
Connection,
|
|
205
|
+
ConnectorID,
|
|
206
|
+
ProviderID,
|
|
207
|
+
SearchUsersBranch,
|
|
208
|
+
SearchUsersBranchDefect,
|
|
209
|
+
SearchUsersBranchInvalidResponse,
|
|
210
|
+
SearchUsersBranchProviderRejected,
|
|
211
|
+
SearchUsersBranchSearched,
|
|
212
|
+
SearchUsersDefinition,
|
|
213
|
+
SearchUsersInputSchema,
|
|
214
|
+
SearchUsersMetadata,
|
|
215
|
+
SearchUsersOperation,
|
|
216
|
+
UserSearchPageSchema,
|
|
217
|
+
decodeCredentials,
|
|
218
|
+
newConnection,
|
|
219
|
+
newConnectionWithOperations,
|
|
220
|
+
newProjectConnection2 as newProjectConnection,
|
|
221
|
+
newSearchUsersStep
|
|
222
|
+
};
|
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, S as SearchUsersInput, U as UserSearchPage } from './connection-E9wVL-jD.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for SearchUsersInput in scripted cases. */
|
|
7
|
+
declare const emptySearchUsersInput: SearchUsersInput;
|
|
8
|
+
/** Go zero value for UserSearchPage in scripted cases. */
|
|
9
|
+
declare const emptyUserSearchPage: UserSearchPage;
|
|
10
|
+
/** Script the searched branch. */
|
|
11
|
+
declare function searchUsersSearched(value: UserSearchPage, failure?: Failure): Case<UserSearchPage>;
|
|
12
|
+
/** Script the providerRejected branch. */
|
|
13
|
+
declare function searchUsersProviderRejected(value: UserSearchPage, failure?: Failure): Case<UserSearchPage>;
|
|
14
|
+
/** Script the invalidResponse branch. */
|
|
15
|
+
declare function searchUsersInvalidResponse(value: UserSearchPage, failure?: Failure): Case<UserSearchPage>;
|
|
16
|
+
/** Script the defect branch. */
|
|
17
|
+
declare function searchUsersDefect(value: UserSearchPage, failure?: Failure): Case<UserSearchPage>;
|
|
18
|
+
/** Script a safe retry of searchUsers. */
|
|
19
|
+
declare function searchUsersRetry(failure: Failure, retryAfterMs?: number): Case<UserSearchPage>;
|
|
20
|
+
/** Manifest scenario searchedDefault for searchUsers. */
|
|
21
|
+
declare function searchUsersSearchedDefault(): Case<UserSearchPage>;
|
|
22
|
+
/** Default searchUsers scenario. */
|
|
23
|
+
declare function searchUsersDefault(): Case<UserSearchPage>;
|
|
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
|
+
searchUsers(): MockQuery<SearchUsersInput, UserSearchPage>;
|
|
30
|
+
assertNoFailures(): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { GeneratedMock, GeneratedMock as Mock, emptySearchUsersInput, emptyUserSearchPage, searchUsersDefault, searchUsersDefect, searchUsersInvalidResponse, searchUsersProviderRejected, searchUsersRetry, searchUsersSearched, searchUsersSearchedDefault };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProviderID,
|
|
3
|
+
SearchUsersDefinition,
|
|
4
|
+
SearchUsersInputSchema,
|
|
5
|
+
UserSearchPageSchema,
|
|
6
|
+
newConnectionWithOperations
|
|
7
|
+
} from "./chunk-JHZRBQDD.js";
|
|
8
|
+
|
|
9
|
+
// src/generated/mock.ts
|
|
10
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
11
|
+
var emptySearchUsersInput = SearchUsersInputSchema.parse({
|
|
12
|
+
"user": ""
|
|
13
|
+
});
|
|
14
|
+
var emptyUserSearchPage = UserSearchPageSchema.parse({
|
|
15
|
+
"user": "",
|
|
16
|
+
"userIDs": [],
|
|
17
|
+
"matchType": ""
|
|
18
|
+
});
|
|
19
|
+
function searchUsersSearched(value, failure) {
|
|
20
|
+
return branchCase("searched", value, failure);
|
|
21
|
+
}
|
|
22
|
+
function searchUsersProviderRejected(value, failure) {
|
|
23
|
+
return branchCase("providerRejected", value, failure);
|
|
24
|
+
}
|
|
25
|
+
function searchUsersInvalidResponse(value, failure) {
|
|
26
|
+
return branchCase("invalidResponse", value, failure);
|
|
27
|
+
}
|
|
28
|
+
function searchUsersDefect(value, failure) {
|
|
29
|
+
return branchCase("defect", value, failure);
|
|
30
|
+
}
|
|
31
|
+
function searchUsersRetry(failure, retryAfterMs = 0) {
|
|
32
|
+
return retryCase(failure, retryAfterMs);
|
|
33
|
+
}
|
|
34
|
+
function searchUsersSearchedDefault() {
|
|
35
|
+
const value = UserSearchPageSchema.parse({ "matchType": "match_user_or_device_id", "user": "example-user", "userIDs": ["example-user"] });
|
|
36
|
+
return branchCase("searched", value);
|
|
37
|
+
}
|
|
38
|
+
function searchUsersDefault() {
|
|
39
|
+
return searchUsersSearchedDefault();
|
|
40
|
+
}
|
|
41
|
+
var GeneratedMock = class {
|
|
42
|
+
#searchUsers;
|
|
43
|
+
#connection;
|
|
44
|
+
constructor(connectionName) {
|
|
45
|
+
this.#searchUsers = newQuery(SearchUsersDefinition).default(searchUsersDefault());
|
|
46
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
47
|
+
}
|
|
48
|
+
connection() {
|
|
49
|
+
return this.#connection;
|
|
50
|
+
}
|
|
51
|
+
searchUsers() {
|
|
52
|
+
return this.#searchUsers;
|
|
53
|
+
}
|
|
54
|
+
assertNoFailures() {
|
|
55
|
+
this.#searchUsers.assertNoFailures();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
GeneratedMock,
|
|
60
|
+
GeneratedMock as Mock,
|
|
61
|
+
emptySearchUsersInput,
|
|
62
|
+
emptyUserSearchPage,
|
|
63
|
+
searchUsersDefault,
|
|
64
|
+
searchUsersDefect,
|
|
65
|
+
searchUsersInvalidResponse,
|
|
66
|
+
searchUsersProviderRejected,
|
|
67
|
+
searchUsersRetry,
|
|
68
|
+
searchUsersSearched,
|
|
69
|
+
searchUsersSearchedDefault
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-amplitude",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Amplitude connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/amplitude/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/user-search/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/user-search/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
|
+
}
|