@superdurable/connector-adobe-marketo 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 +6 -1
- package/dex-connector.json +818 -2
- package/dist/chunk-AYOHNIYZ.js +803 -0
- package/dist/connection-CS06EvUW.d.ts +518 -0
- package/dist/index.d.ts +886 -6
- package/dist/index.js +1238 -20
- package/dist/mock.d.ts +301 -3
- package/dist/mock.js +737 -5
- package/package.json +3 -3
- package/dist/chunk-N4RSR7PL.js +0 -134
- package/dist/connection-lQR7OxHI.d.ts +0 -81
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-adobe-marketo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Marketo connector for Dex TypeScript applications",
|
|
6
6
|
"repository": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"lint": "eslint src test examples",
|
|
39
|
-
"test": "vitest run --exclude test/integration/**",
|
|
39
|
+
"test": "vitest run --exclude 'test/integration/**'",
|
|
40
40
|
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
41
|
"example:worker": "tsx examples/lead-inspection/worker.ts",
|
|
42
42
|
"example:start": "tsx examples/lead-inspection/start.ts",
|
|
43
43
|
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@superdurable/connectors-sdk": "0.
|
|
46
|
+
"@superdurable/connectors-sdk": "0.13.0",
|
|
47
47
|
"@superdurable/dex": ">=1.28.0",
|
|
48
48
|
"zod": "^4.1.0"
|
|
49
49
|
},
|
package/dist/chunk-N4RSR7PL.js
DELETED
|
@@ -1,134 +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
|
-
"restEndpoint": z.string(),
|
|
6
|
-
"tokenEndpoint": z.string(),
|
|
7
|
-
"timeoutMs": z.number().int().optional(),
|
|
8
|
-
"maxResponseBytes": z.number().int().optional()
|
|
9
|
-
});
|
|
10
|
-
function decodeCredentials(value) {
|
|
11
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
12
|
-
const fields = value;
|
|
13
|
-
const allowed = /* @__PURE__ */ new Set(["access_token", "client_id", "client_secret"]);
|
|
14
|
-
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
15
|
-
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
16
|
-
if (fields["client_id"] != null && !(typeof fields["client_id"] === "string")) throw new TypeError("credential client_id has an invalid type");
|
|
17
|
-
if (fields["client_secret"] != null && !(typeof fields["client_secret"] === "string")) throw new TypeError("credential client_secret has an invalid type");
|
|
18
|
-
const credentials = {};
|
|
19
|
-
if (!fields["client_id"]) throw new TypeError("credential client_id is required");
|
|
20
|
-
credentials.clientId = fields["client_id"] ?? "";
|
|
21
|
-
if (!fields["client_secret"]) throw new TypeError("credential client_secret is required");
|
|
22
|
-
credentials.clientSecret = new SecretString(fields["client_secret"] ?? "");
|
|
23
|
-
credentials.accessToken = new SecretString(fields["access_token"] ?? "");
|
|
24
|
-
return credentials;
|
|
25
|
-
}
|
|
26
|
-
function decodeSharedCredentials(value) {
|
|
27
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
28
|
-
const fields = value;
|
|
29
|
-
const allowed = /* @__PURE__ */ new Set(["access_token", "client_id", "client_secret"]);
|
|
30
|
-
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
31
|
-
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
32
|
-
if (fields["client_id"] != null && !(typeof fields["client_id"] === "string")) throw new TypeError("credential client_id has an invalid type");
|
|
33
|
-
if (fields["client_secret"] != null && !(typeof fields["client_secret"] === "string")) throw new TypeError("credential client_secret has an invalid type");
|
|
34
|
-
const credentials = {};
|
|
35
|
-
if (!fields["client_id"]) throw new TypeError("credential client_id is required");
|
|
36
|
-
credentials.clientId = fields["client_id"] ?? "";
|
|
37
|
-
credentials.clientSecret = new SecretString(fields["client_secret"] ?? "");
|
|
38
|
-
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
39
|
-
credentials.accessToken = new SecretString(fields["access_token"] ?? "");
|
|
40
|
-
return credentials;
|
|
41
|
-
}
|
|
42
|
-
var GetLeadInputSchema = z.strictObject({
|
|
43
|
-
"leadId": z.number().int()
|
|
44
|
-
});
|
|
45
|
-
var LeadProfileSchema = z.strictObject({
|
|
46
|
-
"id": z.number().int(),
|
|
47
|
-
"firstName": z.string(),
|
|
48
|
-
"lastName": z.string()
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// src/generated/definitions.ts
|
|
52
|
-
var ConnectorID = "adobe-marketo";
|
|
53
|
-
var ProviderID = "adobe";
|
|
54
|
-
var GetLeadBranch = {
|
|
55
|
-
Found: "found",
|
|
56
|
-
NotFound: "notFound",
|
|
57
|
-
ProviderRejected: "providerRejected",
|
|
58
|
-
InvalidResponse: "invalidResponse",
|
|
59
|
-
Defect: "defect"
|
|
60
|
-
};
|
|
61
|
-
var GetLeadBranchFound = GetLeadBranch.Found;
|
|
62
|
-
var GetLeadBranchNotFound = GetLeadBranch.NotFound;
|
|
63
|
-
var GetLeadBranchProviderRejected = GetLeadBranch.ProviderRejected;
|
|
64
|
-
var GetLeadBranchInvalidResponse = GetLeadBranch.InvalidResponse;
|
|
65
|
-
var GetLeadBranchDefect = GetLeadBranch.Defect;
|
|
66
|
-
var GetLeadDefinition = {
|
|
67
|
-
operation: { connectorId: ConnectorID, operationId: "getLead" },
|
|
68
|
-
branches: [
|
|
69
|
-
{ id: "found", description: "Marketo returned the selected lead." },
|
|
70
|
-
{ id: "notFound", description: "Marketo returned no lead for the ID.", optional: true },
|
|
71
|
-
{ id: "providerRejected", description: "Marketo conclusively rejected the request.", optional: true },
|
|
72
|
-
{ id: "invalidResponse", description: "Marketo returned malformed or oversized JSON.", optional: true },
|
|
73
|
-
{ id: "defect", description: "Local input or connection configuration is invalid.", optional: true }
|
|
74
|
-
],
|
|
75
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
76
|
-
};
|
|
77
|
-
var GetLeadMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
78
|
-
|
|
79
|
-
// src/generated/connection.ts
|
|
80
|
-
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
81
|
-
import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
|
|
82
|
-
var Connection = class {
|
|
83
|
-
/** Stable provider and connection name. */
|
|
84
|
-
reference;
|
|
85
|
-
/** Bound provider operations. */
|
|
86
|
-
operations;
|
|
87
|
-
/** Validate a reference and bind operations. */
|
|
88
|
-
constructor(reference, operations) {
|
|
89
|
-
this.reference = ConnectionRefSchema.parse(reference);
|
|
90
|
-
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
91
|
-
if (!operations) throw new TypeError("connector operations are required");
|
|
92
|
-
this.operations = operations;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
function newConnection(client, reference) {
|
|
96
|
-
if (!client) throw new TypeError("connector client is required");
|
|
97
|
-
return new Connection(reference, client);
|
|
98
|
-
}
|
|
99
|
-
function newConnectionWithOperations(operations, reference) {
|
|
100
|
-
return new Connection(reference, operations);
|
|
101
|
-
}
|
|
102
|
-
function newProjectConnection(project, connectionName, createClient) {
|
|
103
|
-
if (!project) throw new TypeError("loaded project is required");
|
|
104
|
-
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
105
|
-
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
106
|
-
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
107
|
-
return newConnection(createClient(project, connectionName), reference);
|
|
108
|
-
}
|
|
109
|
-
function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
|
|
110
|
-
return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export {
|
|
114
|
-
ConfigSchema,
|
|
115
|
-
decodeCredentials,
|
|
116
|
-
decodeSharedCredentials,
|
|
117
|
-
GetLeadInputSchema,
|
|
118
|
-
LeadProfileSchema,
|
|
119
|
-
ConnectorID,
|
|
120
|
-
ProviderID,
|
|
121
|
-
GetLeadBranch,
|
|
122
|
-
GetLeadBranchFound,
|
|
123
|
-
GetLeadBranchNotFound,
|
|
124
|
-
GetLeadBranchProviderRejected,
|
|
125
|
-
GetLeadBranchInvalidResponse,
|
|
126
|
-
GetLeadBranchDefect,
|
|
127
|
-
GetLeadDefinition,
|
|
128
|
-
GetLeadMetadata,
|
|
129
|
-
Connection,
|
|
130
|
-
newConnection,
|
|
131
|
-
newConnectionWithOperations,
|
|
132
|
-
newProjectConnection,
|
|
133
|
-
newProjectCredentialProvider
|
|
134
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { RefreshingCredentialProvider, 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
|
-
/** Non-secret subscription REST endpoint from https://app.marketo.com/ > Admin > Integration > Web Services > REST API > Endpoint. Copy the complete HTTPS URL ending in /rest, such as https://123-ABC-456.mktorest.com/rest; blank prevents requests. */
|
|
7
|
-
restEndpoint: string;
|
|
8
|
-
/** Non-secret Identity URL from https://app.marketo.com/ > Admin > Integration > Web Services > REST API > Identity, followed by /oauth/token. Enter a complete HTTPS URL ending in /identity/oauth/token on the same subscription host as restEndpoint; blank prevents token minting. */
|
|
9
|
-
tokenEndpoint: string;
|
|
10
|
-
/** Maximum duration of one lead read as a positive Go duration. Leave blank for the displayed default; increase only for slow Marketo responses. Runtime value in milliseconds. */
|
|
11
|
-
timeoutMs?: number;
|
|
12
|
-
/** Maximum bytes in one complete lead response as a positive integer. Leave blank for the displayed default; increase only for unusually large responses. */
|
|
13
|
-
maxResponseBytes?: number;
|
|
14
|
-
}
|
|
15
|
-
/** Runtime schema for manifest configuration. */
|
|
16
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
17
|
-
restEndpoint: z.ZodString;
|
|
18
|
-
tokenEndpoint: z.ZodString;
|
|
19
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
20
|
-
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
/** Private connector credentials resolved by the host. */
|
|
23
|
-
interface Credentials {
|
|
24
|
-
/** Secret short-lived token derived from the custom service's Client ID and Client Secret. Leave blank for automatic minting; never paste a token. */
|
|
25
|
-
accessToken?: SecretString;
|
|
26
|
-
/** Non-secret Client ID from https://app.marketo.com/ > Admin > Integration > LaunchPoint > your Custom service > View Details. Copy the complete value; blank prevents token minting. */
|
|
27
|
-
clientId: string;
|
|
28
|
-
/** Secret Client Secret from https://app.marketo.com/ > Admin > Integration > LaunchPoint > your Custom service > View Details. Store only in Dex Web; blank prevents token minting. */
|
|
29
|
-
clientSecret: SecretString;
|
|
30
|
-
}
|
|
31
|
-
/** Decode private credential fields for the connector. */
|
|
32
|
-
declare function decodeCredentials(value: unknown): Credentials;
|
|
33
|
-
/** Decode shared credential fields for the connector. */
|
|
34
|
-
declare function decodeSharedCredentials(value: unknown): Credentials;
|
|
35
|
-
/** Host-owned source of private connector credentials. */
|
|
36
|
-
type CredentialSource = RefreshingCredentialProvider<Credentials>;
|
|
37
|
-
/** GetLeadInput selects one non-secret positive Marketo lead ID. */
|
|
38
|
-
interface GetLeadInput {
|
|
39
|
-
/** LeadID is the ID shown on a lead detail page or returned by a lead query. */
|
|
40
|
-
"leadId": number;
|
|
41
|
-
}
|
|
42
|
-
/** LeadProfile contains the selected ID and optional names, excluding email and other fields. */
|
|
43
|
-
interface LeadProfile {
|
|
44
|
-
/** ID is the Marketo lead ID. */
|
|
45
|
-
"id": number;
|
|
46
|
-
/** FirstName is the lead's first name, or empty when absent. */
|
|
47
|
-
"firstName": string;
|
|
48
|
-
/** LastName is the lead's last name, or empty when absent. */
|
|
49
|
-
"lastName": string;
|
|
50
|
-
}
|
|
51
|
-
/** Runtime validator for GetLeadInput. */
|
|
52
|
-
declare const GetLeadInputSchema: z.ZodObject<{
|
|
53
|
-
leadId: z.ZodNumber;
|
|
54
|
-
}, z.core.$strict>;
|
|
55
|
-
/** Runtime validator for LeadProfile. */
|
|
56
|
-
declare const LeadProfileSchema: z.ZodObject<{
|
|
57
|
-
id: z.ZodNumber;
|
|
58
|
-
firstName: z.ZodString;
|
|
59
|
-
lastName: z.ZodString;
|
|
60
|
-
}, z.core.$strict>;
|
|
61
|
-
|
|
62
|
-
/** Typed operations supplied by a client or mock. */
|
|
63
|
-
interface Operations {
|
|
64
|
-
/** Invoke getLead through this connection. */
|
|
65
|
-
getLead(): Query<GetLeadInput, LeadProfile>;
|
|
66
|
-
}
|
|
67
|
-
/** Named connector connection kept outside Flow state. */
|
|
68
|
-
declare class Connection<BoundOperations = Operations> {
|
|
69
|
-
/** Stable provider and connection name. */
|
|
70
|
-
readonly reference: ConnectionRef;
|
|
71
|
-
/** Bound provider operations. */
|
|
72
|
-
readonly operations: BoundOperations;
|
|
73
|
-
/** Validate a reference and bind operations. */
|
|
74
|
-
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
75
|
-
}
|
|
76
|
-
/** Bind a client to a named connection. */
|
|
77
|
-
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
78
|
-
/** Bind scripted operations to a named connection. */
|
|
79
|
-
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
80
|
-
|
|
81
|
-
export { Connection as C, type GetLeadInput as G, type LeadProfile as L, type Operations as O, type Config as a, type CredentialSource as b, ConfigSchema as c, type Credentials as d, GetLeadInputSchema as e, LeadProfileSchema as f, decodeCredentials as g, decodeSharedCredentials as h, newConnectionWithOperations as i, newConnection as n };
|