@superdurable/connector-adyen 0.1.0 → 0.2.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/README.md +18 -1
- package/dex-connector.json +534 -2
- package/dist/chunk-P6IMRLQ6.js +489 -0
- package/dist/connection-DqqfBp8C.d.ts +300 -0
- package/dist/index.d.ts +503 -5
- package/dist/index.js +749 -17
- package/dist/mock.d.ts +157 -5
- package/dist/mock.js +391 -6
- package/package.json +3 -3
- package/dist/chunk-CHGEL2F6.js +0 -106
- package/dist/connection-ozFLV9Xy.d.ts +0 -72
package/dist/chunk-CHGEL2F6.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
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(["api_key"]);
|
|
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["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new TypeError("credential api_key has an invalid type");
|
|
15
|
-
const credentials = {};
|
|
16
|
-
if (!fields["api_key"]) throw new TypeError("credential api_key is required");
|
|
17
|
-
credentials.apiKey = new SecretString(fields["api_key"] ?? "");
|
|
18
|
-
return credentials;
|
|
19
|
-
}
|
|
20
|
-
var GetPaymentLinkInputSchema = z.strictObject({
|
|
21
|
-
"paymentLinkId": z.string()
|
|
22
|
-
});
|
|
23
|
-
var PaymentLinkStatusSchema = z.strictObject({
|
|
24
|
-
"id": z.string(),
|
|
25
|
-
"status": z.string(),
|
|
26
|
-
"currencyCode": z.string()
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// src/generated/definitions.ts
|
|
30
|
-
var ConnectorID = "adyen";
|
|
31
|
-
var ProviderID = "adyen";
|
|
32
|
-
var GetPaymentLinkBranch = {
|
|
33
|
-
Found: "found",
|
|
34
|
-
NotFound: "notFound",
|
|
35
|
-
ProviderRejected: "providerRejected",
|
|
36
|
-
InvalidResponse: "invalidResponse",
|
|
37
|
-
Defect: "defect"
|
|
38
|
-
};
|
|
39
|
-
var GetPaymentLinkBranchFound = GetPaymentLinkBranch.Found;
|
|
40
|
-
var GetPaymentLinkBranchNotFound = GetPaymentLinkBranch.NotFound;
|
|
41
|
-
var GetPaymentLinkBranchProviderRejected = GetPaymentLinkBranch.ProviderRejected;
|
|
42
|
-
var GetPaymentLinkBranchInvalidResponse = GetPaymentLinkBranch.InvalidResponse;
|
|
43
|
-
var GetPaymentLinkBranchDefect = GetPaymentLinkBranch.Defect;
|
|
44
|
-
var GetPaymentLinkDefinition = {
|
|
45
|
-
operation: { connectorId: ConnectorID, operationId: "getPaymentLink" },
|
|
46
|
-
branches: [
|
|
47
|
-
{ id: "found", description: "Adyen returned the payment link." },
|
|
48
|
-
{ id: "notFound", description: "Adyen did not expose the payment link.", optional: true },
|
|
49
|
-
{ id: "providerRejected", description: "Adyen conclusively rejected the lookup.", optional: true },
|
|
50
|
-
{ id: "invalidResponse", description: "Adyen returned malformed or oversized JSON.", optional: true },
|
|
51
|
-
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
52
|
-
],
|
|
53
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
54
|
-
};
|
|
55
|
-
var GetPaymentLinkMetadata = { 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
|
-
GetPaymentLinkInputSchema,
|
|
91
|
-
PaymentLinkStatusSchema,
|
|
92
|
-
ConnectorID,
|
|
93
|
-
ProviderID,
|
|
94
|
-
GetPaymentLinkBranch,
|
|
95
|
-
GetPaymentLinkBranchFound,
|
|
96
|
-
GetPaymentLinkBranchNotFound,
|
|
97
|
-
GetPaymentLinkBranchProviderRejected,
|
|
98
|
-
GetPaymentLinkBranchInvalidResponse,
|
|
99
|
-
GetPaymentLinkBranchDefect,
|
|
100
|
-
GetPaymentLinkDefinition,
|
|
101
|
-
GetPaymentLinkMetadata,
|
|
102
|
-
Connection,
|
|
103
|
-
newConnection,
|
|
104
|
-
newConnectionWithOperations,
|
|
105
|
-
newProjectConnection
|
|
106
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
/** Checkout API root as an absolute HTTPS URL. Blank uses the displayed test endpoint. For live, find your company prefix in Customer Area > Developers > API URLs > Prefix and use https://{PREFIX}-checkout-live.adyenpayments.com/checkout/v72; override only for live or a trusted local test gateway. */
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
/** Maximum duration of one API request as a positive Go duration such as 15s. Blank uses the displayed default; increase for slow payment link reads. Runtime value in milliseconds. */
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
/** Maximum complete payment link response in bytes as a positive integer. Blank uses the displayed default; increase for unusually large link metadata. */
|
|
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 server-side API key from Adyen Customer Area > Developers > API credentials > Payments > credential username > Server settings > Authentication > API key > Generate API key. Copy the complete opaque value when shown; blank prevents calls. Dex sends it only in the X-API-Key header. Use a key from the same test or live environment as baseUrl. */
|
|
22
|
-
apiKey: SecretString;
|
|
23
|
-
}
|
|
24
|
-
/** Decode private credential fields for the connector. */
|
|
25
|
-
declare function decodeCredentials(value: unknown): Credentials;
|
|
26
|
-
/** Host-owned source of private connector credentials. */
|
|
27
|
-
type CredentialSource = CredentialProvider<Credentials>;
|
|
28
|
-
/** GetPaymentLinkInput selects a payment link by its non-secret Adyen ID. */
|
|
29
|
-
interface GetPaymentLinkInput {
|
|
30
|
-
/** PaymentLinkID is a payment link ID returned by Adyen Checkout API. */
|
|
31
|
-
"paymentLinkId": string;
|
|
32
|
-
}
|
|
33
|
-
/** PaymentLinkStatus excludes shopper identities and payment details. */
|
|
34
|
-
interface PaymentLinkStatus {
|
|
35
|
-
/** ID is the Adyen payment link ID. */
|
|
36
|
-
"id": string;
|
|
37
|
-
/** Status is a payment link state such as completed. */
|
|
38
|
-
"status": string;
|
|
39
|
-
/** CurrencyCode is the link amount's ISO 4217 currency. */
|
|
40
|
-
"currencyCode": string;
|
|
41
|
-
}
|
|
42
|
-
/** Runtime validator for GetPaymentLinkInput. */
|
|
43
|
-
declare const GetPaymentLinkInputSchema: z.ZodObject<{
|
|
44
|
-
paymentLinkId: z.ZodString;
|
|
45
|
-
}, z.core.$strict>;
|
|
46
|
-
/** Runtime validator for PaymentLinkStatus. */
|
|
47
|
-
declare const PaymentLinkStatusSchema: z.ZodObject<{
|
|
48
|
-
id: z.ZodString;
|
|
49
|
-
status: z.ZodString;
|
|
50
|
-
currencyCode: z.ZodString;
|
|
51
|
-
}, z.core.$strict>;
|
|
52
|
-
|
|
53
|
-
/** Typed operations supplied by a client or mock. */
|
|
54
|
-
interface Operations {
|
|
55
|
-
/** Invoke getPaymentLink through this connection. */
|
|
56
|
-
getPaymentLink(): Query<GetPaymentLinkInput, PaymentLinkStatus>;
|
|
57
|
-
}
|
|
58
|
-
/** Named connector connection kept outside Flow state. */
|
|
59
|
-
declare class Connection<BoundOperations = Operations> {
|
|
60
|
-
/** Stable provider and connection name. */
|
|
61
|
-
readonly reference: ConnectionRef;
|
|
62
|
-
/** Bound provider operations. */
|
|
63
|
-
readonly operations: BoundOperations;
|
|
64
|
-
/** Validate a reference and bind operations. */
|
|
65
|
-
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
66
|
-
}
|
|
67
|
-
/** Bind a client to a named connection. */
|
|
68
|
-
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
69
|
-
/** Bind scripted operations to a named connection. */
|
|
70
|
-
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
71
|
-
|
|
72
|
-
export { Connection as C, type GetPaymentLinkInput as G, type Operations as O, type PaymentLinkStatus as P, type Config as a, type Credentials as b, ConfigSchema as c, type CredentialSource as d, GetPaymentLinkInputSchema as e, PaymentLinkStatusSchema as f, decodeCredentials as g, newConnectionWithOperations as h, newConnection as n };
|