@particle-academy/facebook-lead-ads-js 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/dist/flow.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/actions/ + triggers/ by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/actions/ + triggers/ (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- facebook_lead_ads
12
+ */
13
+ /**
14
+ * Facebook Lead Ads's node kinds with their TypeScript executors attached —
15
+ * for hosts that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/facebook-lead-ads-ui carries no
18
+ * executor: the editor is React on every host, so a PHP or Python project
19
+ * installs the ui package and never this one.
20
+ */
21
+
22
+ declare const facebookLeadAdsLeadExecutor: NodeExecutor;
23
+ declare const facebookLeadAdsWebhookTriggerExecutor: NodeExecutor;
24
+ /** The kinds a TypeScript host registers. */
25
+ declare const FACEBOOK_LEAD_ADS_RUNNABLE_KINDS: NodeKindDefinition[];
26
+
27
+ export { FACEBOOK_LEAD_ADS_RUNNABLE_KINDS, facebookLeadAdsLeadExecutor, facebookLeadAdsWebhookTriggerExecutor };
package/dist/flow.js ADDED
@@ -0,0 +1,40 @@
1
+ import { facebookLeadAdsLeadGet, FACEBOOK_LEAD_ADS, FACEBOOK_LEAD_ADS_LEADGEN } from './chunk-JVNM4F6J.js';
2
+ import { resolveConnection, triggerEvent } from '@particle-academy/fancy-connector-core';
3
+ import { facebookLeadAdsLeadKind, facebookLeadAdsWebhookTriggerKind } from '@particle-academy/facebook-lead-ads-ui';
4
+
5
+ var facebookLeadAdsLeadExecutor = async (ctx) => {
6
+ const config = ctx.node.data?.config ?? {};
7
+ const result = await facebookLeadAdsLeadGet({
8
+ config,
9
+ input: ctx.inputs?.in
10
+ });
11
+ ctx.emit({
12
+ type: "log",
13
+ level: "info",
14
+ nodeId: ctx.node.id,
15
+ message: `facebook_lead_ads lead_get ${result.data?.id} (${result.mode})`
16
+ });
17
+ return { __port: "out", value: result };
18
+ };
19
+ var facebookLeadAdsWebhookTriggerExecutor = async (ctx) => {
20
+ const config = ctx.node.data?.config ?? {};
21
+ const connection = resolveConnection({
22
+ service: FACEBOOK_LEAD_ADS.service,
23
+ operation: "leadgen",
24
+ sandbox: FACEBOOK_LEAD_ADS.sandbox,
25
+ baseUrls: FACEBOOK_LEAD_ADS.baseUrls,
26
+ requires: FACEBOOK_LEAD_ADS.requires,
27
+ connectionId: typeof config.connection === "string" ? config.connection : null,
28
+ requested: typeof config.mode === "string" ? config.mode : null
29
+ });
30
+ const event = triggerEvent(FACEBOOK_LEAD_ADS_LEADGEN, connection, ctx.inputs?.in, config);
31
+ return { __port: "out", value: event };
32
+ };
33
+ var FACEBOOK_LEAD_ADS_RUNNABLE_KINDS = [
34
+ { ...facebookLeadAdsLeadKind, executor: facebookLeadAdsLeadExecutor },
35
+ { ...facebookLeadAdsWebhookTriggerKind, executor: facebookLeadAdsWebhookTriggerExecutor }
36
+ ];
37
+
38
+ export { FACEBOOK_LEAD_ADS_RUNNABLE_KINDS, facebookLeadAdsLeadExecutor, facebookLeadAdsWebhookTriggerExecutor };
39
+ //# sourceMappingURL=flow.js.map
40
+ //# sourceMappingURL=flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAsCO,IAAM,2BAAA,GAA4C,OAAO,GAAA,KAAQ;AACtE,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,sBAAA,CAAuB;AAAA,IAC1C,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ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D","file":"flow.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- facebook_lead_ads\n */\n\n/**\n * Facebook Lead Ads's node kinds with their TypeScript executors attached —\n * for hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/facebook-lead-ads-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { FACEBOOK_LEAD_ADS } from \"./service.js\";\n\nimport {\n facebookLeadAdsLeadKind,\n facebookLeadAdsWebhookTriggerKind,\n} from \"@particle-academy/facebook-lead-ads-ui\";\n\nimport { facebookLeadAdsLeadGet } from \"./actions/lead-get.js\";\nimport { FACEBOOK_LEAD_ADS_LEADGEN } from \"./triggers/leadgen.js\";\n\nexport const facebookLeadAdsLeadExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await facebookLeadAdsLeadGet({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `facebook_lead_ads lead_get ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const facebookLeadAdsWebhookTriggerExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n const connection = resolveConnection({\n service: FACEBOOK_LEAD_ADS.service,\n operation: \"leadgen\",\n sandbox: FACEBOOK_LEAD_ADS.sandbox,\n baseUrls: FACEBOOK_LEAD_ADS.baseUrls,\n requires: FACEBOOK_LEAD_ADS.requires,\n connectionId: typeof config.connection === \"string\" ? config.connection : null,\n requested: typeof config.mode === \"string\" ? (config.mode as RequestedMode) : null,\n });\n\n const event = triggerEvent(FACEBOOK_LEAD_ADS_LEADGEN, connection, ctx.inputs?.in, config);\n\n return { __port: \"out\", value: event };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const FACEBOOK_LEAD_ADS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...facebookLeadAdsLeadKind, executor: facebookLeadAdsLeadExecutor },\n { ...facebookLeadAdsWebhookTriggerKind, executor: facebookLeadAdsWebhookTriggerExecutor },\n];\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,151 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
5
+
6
+ // src/faker.ts
7
+ function fakeLeadGet({ config, fake }) {
8
+ return {
9
+ "id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
10
+ "created_time": "2026-08-24T09:15:00+0000",
11
+ "ad_id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
12
+ "form_id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
13
+ "field_data": [
14
+ {
15
+ "name": "full_name",
16
+ "values": [
17
+ "Ada Lovelace"
18
+ ]
19
+ },
20
+ {
21
+ "name": "email",
22
+ "values": [
23
+ "ada@example.test"
24
+ ]
25
+ },
26
+ {
27
+ "name": "phone_number",
28
+ "values": [
29
+ "+15550100"
30
+ ]
31
+ },
32
+ {
33
+ "name": "what_are_you_interested_in",
34
+ "values": [
35
+ "Enterprise plan"
36
+ ]
37
+ }
38
+ ]
39
+ };
40
+ }
41
+ function fakeLeadgen({ config, fake }) {
42
+ const boundLeadid = Array.from({ length: 15 }, () => fake.int(0, 9)).join("");
43
+ return {
44
+ "leadgen_id": boundLeadid,
45
+ "page_id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
46
+ "form_id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
47
+ "ad_id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
48
+ "adgroup_id": Array.from({ length: 15 }, () => fake.int(0, 9)).join(""),
49
+ "created_time": 1787577300
50
+ };
51
+ }
52
+ var facebookLeadAdsFaker = (operation, request) => {
53
+ switch (operation) {
54
+ case "lead_get":
55
+ return fakeLeadGet(request);
56
+ case "leadgen":
57
+ return fakeLeadgen(request);
58
+ default:
59
+ throw new Error(
60
+ `facebook_lead_ads: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
61
+ );
62
+ }
63
+ };
64
+ var CONNECTOR_API_VERSION = 1;
65
+ var FACEBOOK_LEAD_ADS_BASE_URLS = {
66
+ "live": "https://graph.facebook.com/v25.0"
67
+ };
68
+ var FACEBOOK_LEAD_ADS_REQUIRES = [
69
+ "pageAccessToken",
70
+ "appSecret",
71
+ "clientId",
72
+ "clientSecret"
73
+ ];
74
+ function facebookLeadAdsAuthorize(credentials, request, _mode) {
75
+ const url = new URL(request.url);
76
+ url.searchParams.set("access_token", String(credentials.pageAccessToken ?? ""));
77
+ const proof = crypto.createHmac("sha256", String(credentials.appSecret ?? "")).update(String(credentials.pageAccessToken ?? "")).digest("hex");
78
+ url.searchParams.set("appsecret_proof", proof);
79
+ request.url = url.toString();
80
+ }
81
+ var FACEBOOK_LEAD_ADS = {
82
+ service: "facebook_lead_ads",
83
+ title: "Facebook Lead Ads",
84
+ sandbox: "none",
85
+ baseUrls: { ...FACEBOOK_LEAD_ADS_BASE_URLS },
86
+ requires: [...FACEBOOK_LEAD_ADS_REQUIRES],
87
+ authorize: facebookLeadAdsAuthorize,
88
+ faker: facebookLeadAdsFaker
89
+ };
90
+ var LEAD_GET_OPERATION = "lead_get";
91
+ async function facebookLeadAdsLeadGet(options) {
92
+ const config = options.config ?? {};
93
+ if (config.leadId === void 0 || config.leadId === null || config.leadId === "") {
94
+ throw new Error(`lead_get: "leadId" is required (Lead ID).`);
95
+ }
96
+ return fancyConnectorCore.callConnector(FACEBOOK_LEAD_ADS, {
97
+ operation: LEAD_GET_OPERATION,
98
+ config,
99
+ input: options.input,
100
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
101
+ ...options.mode === void 0 ? {} : { mode: options.mode },
102
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
103
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
104
+ ...options.transport === void 0 ? {} : { transport: options.transport },
105
+ request: {
106
+ method: "GET",
107
+ path: `/${encodeURIComponent(String(config.leadId))}`,
108
+ query: {}
109
+ }
110
+ });
111
+ }
112
+ var FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER = "X-Hub-Signature-256";
113
+ var FACEBOOK_LEAD_ADS_LEADGEN_SCHEME = {
114
+ algorithm: "SHA-256",
115
+ payload: (raw, timestamp) => raw,
116
+ encoding: "hex"
117
+ };
118
+ function parseFacebookLeadAdsSignature(raw) {
119
+ return { signature: raw.startsWith("sha256=") ? raw.slice(7) : raw };
120
+ }
121
+ var FACEBOOK_LEAD_ADS_LEADGEN = {
122
+ service: "facebook_lead_ads",
123
+ operation: "leadgen",
124
+ delivery: "webhook",
125
+ setup: "In the Meta app dashboard, add a Webhooks product, subscribe to the PAGE object and tick the `leadgen` field, and point the callback URL at the route your host mounts for this trigger. Meta first sends a GET carrying `hub.mode=subscribe`, `hub.verify_token` and `hub.challenge` -- the host must echo `hub.challenge` back as the body and check `hub.verify_token` against the value set in the dashboard, or the subscription is never activated. Then subscribe the app to each Page (`POST /{pageId}/subscribed_apps` with `subscribed_fields=leadgen`), which is a SEPARATE step: a webhook configured but not subscribed per Page delivers nothing and reports nothing.",
126
+ verification: {
127
+ signatureHeader: FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER,
128
+ scheme: FACEBOOK_LEAD_ADS_LEADGEN_SCHEME,
129
+ parse: parseFacebookLeadAdsSignature
130
+ },
131
+ faker: facebookLeadAdsFaker
132
+ };
133
+ function verifyFacebookLeadAdsDelivery(delivery, appSecret, now) {
134
+ return fancyConnectorCore.verifyDelivery(FACEBOOK_LEAD_ADS_LEADGEN, delivery, appSecret, now);
135
+ }
136
+
137
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
138
+ exports.FACEBOOK_LEAD_ADS = FACEBOOK_LEAD_ADS;
139
+ exports.FACEBOOK_LEAD_ADS_BASE_URLS = FACEBOOK_LEAD_ADS_BASE_URLS;
140
+ exports.FACEBOOK_LEAD_ADS_LEADGEN = FACEBOOK_LEAD_ADS_LEADGEN;
141
+ exports.FACEBOOK_LEAD_ADS_LEADGEN_SCHEME = FACEBOOK_LEAD_ADS_LEADGEN_SCHEME;
142
+ exports.FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER = FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER;
143
+ exports.FACEBOOK_LEAD_ADS_REQUIRES = FACEBOOK_LEAD_ADS_REQUIRES;
144
+ exports.LEAD_GET_OPERATION = LEAD_GET_OPERATION;
145
+ exports.facebookLeadAdsAuthorize = facebookLeadAdsAuthorize;
146
+ exports.facebookLeadAdsFaker = facebookLeadAdsFaker;
147
+ exports.facebookLeadAdsLeadGet = facebookLeadAdsLeadGet;
148
+ exports.parseFacebookLeadAdsSignature = parseFacebookLeadAdsSignature;
149
+ exports.verifyFacebookLeadAdsDelivery = verifyFacebookLeadAdsDelivery;
150
+ //# sourceMappingURL=index.cjs.map
151
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/lead-get.ts","../src/triggers/leadgen.ts"],"names":["createHmac","callConnector","verifyDelivery"],"mappings":";;;;;;AA0BA,SAAS,WAAA,CAAY,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC3D,EAAA,OAAO;AAA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EAAO;AAAA,GACT;AAAA,EACA,KAAA,EAAO;AACT;AAYO,SAAS,6BAAA,CACd,QAAA,EACA,SAAA,EACA,GAAA,EAC8B;AAC9B,EAAA,OAAOC,iCAAA,CAAe,yBAAA,EAA2B,QAAA,EAAU,SAAA,EAAW,GAAG,CAAA;AAC3E","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- facebook_lead_ads\n */\n\n/**\n * The Facebook Lead Ads faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Facebook Lead Ads actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeLeadGet({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"created_time\": \"2026-08-24T09:15:00+0000\",\n \"ad_id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"form_id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"field_data\": [\n {\n \"name\": \"full_name\",\n \"values\": [\n \"Ada Lovelace\",\n ],\n },\n {\n \"name\": \"email\",\n \"values\": [\n \"ada@example.test\",\n ],\n },\n {\n \"name\": \"phone_number\",\n \"values\": [\n \"+15550100\",\n ],\n },\n {\n \"name\": \"what_are_you_interested_in\",\n \"values\": [\n \"Enterprise plan\",\n ],\n },\n ],\n };\n}\n\nfunction fakeLeadgen({ config, fake }: FakeRequest): unknown {\n const boundLeadid = Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\");\n\n return {\n \"leadgen_id\": boundLeadid,\n \"page_id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"form_id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"ad_id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"adgroup_id\": Array.from({ length: 15 }, () => fake.int(0, 9)).join(\"\"),\n \"created_time\": 1787577300,\n };\n}\n\nexport const facebookLeadAdsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"lead_get\":\n return fakeLeadGet(request);\n\n case \"leadgen\":\n return fakeLeadgen(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `facebook_lead_ads: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- facebook_lead_ads\n */\n\n/**\n * Facebook Lead Ads, as one service descriptor shared by every Facebook Lead\n * Ads operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Facebook Lead Ads: its base URL,\n * its auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Facebook Lead Ads has no sandbox. Meta's Lead Ads Testing Tool creates a\n * test lead on the REAL form, which fires the real webhook and appears\n * alongside real leads until somebody deletes it. Anything this reads is real\n * customer data belonging to a real advertiser.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { facebookLeadAdsFaker } from \"./faker.js\";\nimport { createHmac } from \"node:crypto\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const FACEBOOK_LEAD_ADS_BASE_URLS = {\n \"live\": \"https://graph.facebook.com/v25.0\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const FACEBOOK_LEAD_ADS_REQUIRES = [\n \"pageAccessToken\",\n \"appSecret\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Facebook Lead Ads's auth scheme to an outgoing request.\n *\n * Same as facebook-pages: Meta takes the token as a QUERY PARAMETER, and\n * appsecret_proof has to go in the query regardless, so both live in one place\n * and a request stays readable in a log.\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function facebookLeadAdsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n const url = new URL(request.url);\n\n url.searchParams.set(\"access_token\", String(credentials.pageAccessToken ?? \"\"));\n\n const proof = createHmac(\"sha256\", String(credentials.appSecret ?? \"\"))\n .update(String(credentials.pageAccessToken ?? \"\"))\n .digest(\"hex\");\n\n url.searchParams.set(\"appsecret_proof\", proof);\n request.url = url.toString();\n}\n\n/** The Facebook Lead Ads service, for the TypeScript runtime. */\nexport const FACEBOOK_LEAD_ADS: ServiceDescriptor = {\n service: \"facebook_lead_ads\",\n title: \"Facebook Lead Ads\",\n sandbox: \"none\",\n baseUrls: { ...FACEBOOK_LEAD_ADS_BASE_URLS },\n requires: [...FACEBOOK_LEAD_ADS_REQUIRES],\n authorize: facebookLeadAdsAuthorize,\n faker: facebookLeadAdsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/lead-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/lead-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- facebook_lead_ads\n */\n\n/**\n * Read one lead's answers by id. Pair this with the `leadgen` trigger, whose\n * delivery carries only the id.\n *\n * GET /{leadId} —\n * https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Facebook Lead Ads or calls\n * the faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { FACEBOOK_LEAD_ADS } from \"../service.js\";\n\nexport const LEAD_GET_OPERATION = \"lead_get\";\n\nexport type LeadGetOptions = {\n /** The node's resolved config. Keys: leadId. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function facebookLeadAdsLeadGet(options: LeadGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.leadId === undefined || config.leadId === null || config.leadId === \"\") {\n throw new Error(`lead_get: \"leadId\" is required (Lead ID).`);\n }\n\n return callConnector(FACEBOOK_LEAD_ADS, {\n operation: LEAD_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/${encodeURIComponent(String(config.leadId))}`,\n query: {},\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/triggers/leadgen.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/triggers/leadgen.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- facebook_lead_ads\n */\n\n/**\n * Facebook Lead Ads's webhook trigger — the delivery contract.\n *\n * Kept beside the service descriptor rather than inside a node, because a\n * signature scheme is a fact about FACEBOOK LEAD ADS. Two Facebook Lead Ads\n * triggers must not be able to disagree about how a delivery is verified.\n */\n\nimport { verifyDelivery, type HmacScheme, type InboundDelivery, type TriggerDescriptor, type WebhookVerification } from \"@particle-academy/fancy-connector-core\";\nimport { facebookLeadAdsFaker } from \"../faker.js\";\n\nexport const FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER = \"X-Hub-Signature-256\";\n\nexport const FACEBOOK_LEAD_ADS_LEADGEN_SCHEME: HmacScheme = {\n algorithm: \"SHA-256\",\n payload: (raw, timestamp) => raw,\n encoding: \"hex\",\n};\n\n/** Strip the `sha256=` prefix the provider sends. */\nexport function parseFacebookLeadAdsSignature(raw: string): { signature?: string } {\n return { signature: raw.startsWith(\"sha256=\") ? raw.slice(7) : raw };\n}\n\nexport const FACEBOOK_LEAD_ADS_LEADGEN: TriggerDescriptor = {\n service: \"facebook_lead_ads\",\n operation: \"leadgen\",\n delivery: \"webhook\",\n setup:\n \"In the Meta app dashboard, add a Webhooks product, subscribe to the PAGE object and tick the `leadgen` field, and point the callback URL at the route your host mounts for this trigger. Meta first sends a GET carrying `hub.mode=subscribe`, `hub.verify_token` and `hub.challenge` -- the host must echo `hub.challenge` back as the body and check `hub.verify_token` against the value set in the dashboard, or the subscription is never activated. Then subscribe the app to each Page (`POST /{pageId}/subscribed_apps` with `subscribed_fields=leadgen`), which is a SEPARATE step: a webhook configured but not subscribed per Page delivers nothing and reports nothing.\",\n verification: {\n signatureHeader: FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER,\n scheme: FACEBOOK_LEAD_ADS_LEADGEN_SCHEME,\n parse: parseFacebookLeadAdsSignature,\n },\n faker: facebookLeadAdsFaker,\n};\n\n/**\n * Verify one inbound Facebook Lead Ads delivery.\n *\n * The host calls this BEFORE starting a run, with the body exactly as\n * received. Re-serialised JSON changes key order and whitespace, and produces\n * a mismatch that looks precisely like a wrong secret — hours of debugging the\n * wrong thing.\n *\n * The secret is the connection's `appSecret`.\n */\nexport function verifyFacebookLeadAdsDelivery(\n delivery: InboundDelivery,\n appSecret: string | undefined,\n now?: number,\n): Promise<WebhookVerification> {\n return verifyDelivery(FACEBOOK_LEAD_ADS_LEADGEN, delivery, appSecret, now);\n}\n"]}
@@ -0,0 +1,156 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult, TriggerDescriptor, HmacScheme, InboundDelivery, WebhookVerification } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- facebook_lead_ads
12
+ */
13
+ /**
14
+ * Facebook Lead Ads, as one service descriptor shared by every Facebook Lead
15
+ * Ads operation.
16
+ *
17
+ * @particle-academy/fancy-connector-core carries what is true of ALL
18
+ * connectors. This carries what is true of Facebook Lead Ads: its base URL,
19
+ * its auth scheme, its idempotency header, and its faker.
20
+ *
21
+ * ## The sandbox trap, written down where it is used
22
+ *
23
+ * Facebook Lead Ads has no sandbox. Meta's Lead Ads Testing Tool creates a
24
+ * test lead on the REAL form, which fires the real webhook and appears
25
+ * alongside real leads until somebody deletes it. Anything this reads is real
26
+ * customer data belonging to a real advertiser.
27
+ */
28
+
29
+ /**
30
+ * The connector API version this package was GENERATED against.
31
+ *
32
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
33
+ * very claim it exists to detect, after which the copy agrees with itself
34
+ * forever.
35
+ */
36
+ declare const CONNECTOR_API_VERSION = 1;
37
+ declare const FACEBOOK_LEAD_ADS_BASE_URLS: {
38
+ readonly live: "https://graph.facebook.com/v25.0";
39
+ };
40
+ /** Credential keys a remote call cannot proceed without. */
41
+ declare const FACEBOOK_LEAD_ADS_REQUIRES: readonly ["pageAccessToken", "appSecret", "clientId", "clientSecret"];
42
+ /**
43
+ * Apply Facebook Lead Ads's auth scheme to an outgoing request.
44
+ *
45
+ * Same as facebook-pages: Meta takes the token as a QUERY PARAMETER, and
46
+ * appsecret_proof has to go in the query regardless, so both live in one place
47
+ * and a request stays readable in a log.
48
+ *
49
+ * The mode is passed in because for some providers auth and estate are the
50
+ * same decision expressed in the URL; here it is unused, and saying so is
51
+ * cheaper than wondering later whether it was forgotten.
52
+ */
53
+ declare function facebookLeadAdsAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
54
+ /** The Facebook Lead Ads service, for the TypeScript runtime. */
55
+ declare const FACEBOOK_LEAD_ADS: ServiceDescriptor;
56
+
57
+ /**
58
+ * GENERATED FILE — do not edit.
59
+ *
60
+ * Emitted from provider/fixtures/ by weaver's generator.
61
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
62
+ * being rejected, because it works until it silently does not. Fix
63
+ * provider/fixtures/ (or weaver's template/) and regenerate:
64
+ *
65
+ * npm run provider -- facebook_lead_ads
66
+ */
67
+ /**
68
+ * The Facebook Lead Ads faker.
69
+ *
70
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
71
+ * NAMES Facebook Lead Ads actually publishes, so an author can wire {{
72
+ * $json.data.id }} against a fake and have it keep working against the real
73
+ * thing.
74
+ *
75
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
76
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
77
+ * throw", which is the assertion that catches nothing.
78
+ */
79
+
80
+ declare const facebookLeadAdsFaker: ConnectorFaker;
81
+
82
+ /**
83
+ * GENERATED FILE — do not edit.
84
+ *
85
+ * Emitted from provider/actions/lead-get.json by weaver's generator.
86
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
87
+ * being rejected, because it works until it silently does not. Fix
88
+ * provider/actions/lead-get.json (or weaver's template/) and regenerate:
89
+ *
90
+ * npm run provider -- facebook_lead_ads
91
+ */
92
+ /**
93
+ * Read one lead's answers by id. Pair this with the `leadgen` trigger, whose
94
+ * delivery carries only the id.
95
+ *
96
+ * GET /{leadId} —
97
+ * https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving
98
+ *
99
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
100
+ * no fake/real branch. This describes the request; callConnector resolves the
101
+ * connection, picks the estate, and either calls Facebook Lead Ads or calls
102
+ * the faker.
103
+ */
104
+
105
+ declare const LEAD_GET_OPERATION = "lead_get";
106
+ type LeadGetOptions = {
107
+ /** The node's resolved config. Keys: leadId. */
108
+ config: Record<string, unknown>;
109
+ credentials?: Record<string, string | undefined>;
110
+ mode?: RequestedMode;
111
+ connectionId?: string | null;
112
+ input?: unknown;
113
+ attempts?: number;
114
+ /** Override the transport. The only way to exercise this without a network. */
115
+ transport?: Transport;
116
+ };
117
+ declare function facebookLeadAdsLeadGet(options: LeadGetOptions): Promise<ConnectorResult>;
118
+
119
+ /**
120
+ * GENERATED FILE — do not edit.
121
+ *
122
+ * Emitted from provider/triggers/leadgen.json by weaver's generator.
123
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
124
+ * being rejected, because it works until it silently does not. Fix
125
+ * provider/triggers/leadgen.json (or weaver's template/) and regenerate:
126
+ *
127
+ * npm run provider -- facebook_lead_ads
128
+ */
129
+ /**
130
+ * Facebook Lead Ads's webhook trigger — the delivery contract.
131
+ *
132
+ * Kept beside the service descriptor rather than inside a node, because a
133
+ * signature scheme is a fact about FACEBOOK LEAD ADS. Two Facebook Lead Ads
134
+ * triggers must not be able to disagree about how a delivery is verified.
135
+ */
136
+
137
+ declare const FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER = "X-Hub-Signature-256";
138
+ declare const FACEBOOK_LEAD_ADS_LEADGEN_SCHEME: HmacScheme;
139
+ /** Strip the `sha256=` prefix the provider sends. */
140
+ declare function parseFacebookLeadAdsSignature(raw: string): {
141
+ signature?: string;
142
+ };
143
+ declare const FACEBOOK_LEAD_ADS_LEADGEN: TriggerDescriptor;
144
+ /**
145
+ * Verify one inbound Facebook Lead Ads delivery.
146
+ *
147
+ * The host calls this BEFORE starting a run, with the body exactly as
148
+ * received. Re-serialised JSON changes key order and whitespace, and produces
149
+ * a mismatch that looks precisely like a wrong secret — hours of debugging the
150
+ * wrong thing.
151
+ *
152
+ * The secret is the connection's `appSecret`.
153
+ */
154
+ declare function verifyFacebookLeadAdsDelivery(delivery: InboundDelivery, appSecret: string | undefined, now?: number): Promise<WebhookVerification>;
155
+
156
+ export { CONNECTOR_API_VERSION, FACEBOOK_LEAD_ADS, FACEBOOK_LEAD_ADS_BASE_URLS, FACEBOOK_LEAD_ADS_LEADGEN, FACEBOOK_LEAD_ADS_LEADGEN_SCHEME, FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER, FACEBOOK_LEAD_ADS_REQUIRES, LEAD_GET_OPERATION, type LeadGetOptions, facebookLeadAdsAuthorize, facebookLeadAdsFaker, facebookLeadAdsLeadGet, parseFacebookLeadAdsSignature, verifyFacebookLeadAdsDelivery };
@@ -0,0 +1,156 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult, TriggerDescriptor, HmacScheme, InboundDelivery, WebhookVerification } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- facebook_lead_ads
12
+ */
13
+ /**
14
+ * Facebook Lead Ads, as one service descriptor shared by every Facebook Lead
15
+ * Ads operation.
16
+ *
17
+ * @particle-academy/fancy-connector-core carries what is true of ALL
18
+ * connectors. This carries what is true of Facebook Lead Ads: its base URL,
19
+ * its auth scheme, its idempotency header, and its faker.
20
+ *
21
+ * ## The sandbox trap, written down where it is used
22
+ *
23
+ * Facebook Lead Ads has no sandbox. Meta's Lead Ads Testing Tool creates a
24
+ * test lead on the REAL form, which fires the real webhook and appears
25
+ * alongside real leads until somebody deletes it. Anything this reads is real
26
+ * customer data belonging to a real advertiser.
27
+ */
28
+
29
+ /**
30
+ * The connector API version this package was GENERATED against.
31
+ *
32
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
33
+ * very claim it exists to detect, after which the copy agrees with itself
34
+ * forever.
35
+ */
36
+ declare const CONNECTOR_API_VERSION = 1;
37
+ declare const FACEBOOK_LEAD_ADS_BASE_URLS: {
38
+ readonly live: "https://graph.facebook.com/v25.0";
39
+ };
40
+ /** Credential keys a remote call cannot proceed without. */
41
+ declare const FACEBOOK_LEAD_ADS_REQUIRES: readonly ["pageAccessToken", "appSecret", "clientId", "clientSecret"];
42
+ /**
43
+ * Apply Facebook Lead Ads's auth scheme to an outgoing request.
44
+ *
45
+ * Same as facebook-pages: Meta takes the token as a QUERY PARAMETER, and
46
+ * appsecret_proof has to go in the query regardless, so both live in one place
47
+ * and a request stays readable in a log.
48
+ *
49
+ * The mode is passed in because for some providers auth and estate are the
50
+ * same decision expressed in the URL; here it is unused, and saying so is
51
+ * cheaper than wondering later whether it was forgotten.
52
+ */
53
+ declare function facebookLeadAdsAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
54
+ /** The Facebook Lead Ads service, for the TypeScript runtime. */
55
+ declare const FACEBOOK_LEAD_ADS: ServiceDescriptor;
56
+
57
+ /**
58
+ * GENERATED FILE — do not edit.
59
+ *
60
+ * Emitted from provider/fixtures/ by weaver's generator.
61
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
62
+ * being rejected, because it works until it silently does not. Fix
63
+ * provider/fixtures/ (or weaver's template/) and regenerate:
64
+ *
65
+ * npm run provider -- facebook_lead_ads
66
+ */
67
+ /**
68
+ * The Facebook Lead Ads faker.
69
+ *
70
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
71
+ * NAMES Facebook Lead Ads actually publishes, so an author can wire {{
72
+ * $json.data.id }} against a fake and have it keep working against the real
73
+ * thing.
74
+ *
75
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
76
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
77
+ * throw", which is the assertion that catches nothing.
78
+ */
79
+
80
+ declare const facebookLeadAdsFaker: ConnectorFaker;
81
+
82
+ /**
83
+ * GENERATED FILE — do not edit.
84
+ *
85
+ * Emitted from provider/actions/lead-get.json by weaver's generator.
86
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
87
+ * being rejected, because it works until it silently does not. Fix
88
+ * provider/actions/lead-get.json (or weaver's template/) and regenerate:
89
+ *
90
+ * npm run provider -- facebook_lead_ads
91
+ */
92
+ /**
93
+ * Read one lead's answers by id. Pair this with the `leadgen` trigger, whose
94
+ * delivery carries only the id.
95
+ *
96
+ * GET /{leadId} —
97
+ * https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving
98
+ *
99
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
100
+ * no fake/real branch. This describes the request; callConnector resolves the
101
+ * connection, picks the estate, and either calls Facebook Lead Ads or calls
102
+ * the faker.
103
+ */
104
+
105
+ declare const LEAD_GET_OPERATION = "lead_get";
106
+ type LeadGetOptions = {
107
+ /** The node's resolved config. Keys: leadId. */
108
+ config: Record<string, unknown>;
109
+ credentials?: Record<string, string | undefined>;
110
+ mode?: RequestedMode;
111
+ connectionId?: string | null;
112
+ input?: unknown;
113
+ attempts?: number;
114
+ /** Override the transport. The only way to exercise this without a network. */
115
+ transport?: Transport;
116
+ };
117
+ declare function facebookLeadAdsLeadGet(options: LeadGetOptions): Promise<ConnectorResult>;
118
+
119
+ /**
120
+ * GENERATED FILE — do not edit.
121
+ *
122
+ * Emitted from provider/triggers/leadgen.json by weaver's generator.
123
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
124
+ * being rejected, because it works until it silently does not. Fix
125
+ * provider/triggers/leadgen.json (or weaver's template/) and regenerate:
126
+ *
127
+ * npm run provider -- facebook_lead_ads
128
+ */
129
+ /**
130
+ * Facebook Lead Ads's webhook trigger — the delivery contract.
131
+ *
132
+ * Kept beside the service descriptor rather than inside a node, because a
133
+ * signature scheme is a fact about FACEBOOK LEAD ADS. Two Facebook Lead Ads
134
+ * triggers must not be able to disagree about how a delivery is verified.
135
+ */
136
+
137
+ declare const FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER = "X-Hub-Signature-256";
138
+ declare const FACEBOOK_LEAD_ADS_LEADGEN_SCHEME: HmacScheme;
139
+ /** Strip the `sha256=` prefix the provider sends. */
140
+ declare function parseFacebookLeadAdsSignature(raw: string): {
141
+ signature?: string;
142
+ };
143
+ declare const FACEBOOK_LEAD_ADS_LEADGEN: TriggerDescriptor;
144
+ /**
145
+ * Verify one inbound Facebook Lead Ads delivery.
146
+ *
147
+ * The host calls this BEFORE starting a run, with the body exactly as
148
+ * received. Re-serialised JSON changes key order and whitespace, and produces
149
+ * a mismatch that looks precisely like a wrong secret — hours of debugging the
150
+ * wrong thing.
151
+ *
152
+ * The secret is the connection's `appSecret`.
153
+ */
154
+ declare function verifyFacebookLeadAdsDelivery(delivery: InboundDelivery, appSecret: string | undefined, now?: number): Promise<WebhookVerification>;
155
+
156
+ export { CONNECTOR_API_VERSION, FACEBOOK_LEAD_ADS, FACEBOOK_LEAD_ADS_BASE_URLS, FACEBOOK_LEAD_ADS_LEADGEN, FACEBOOK_LEAD_ADS_LEADGEN_SCHEME, FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER, FACEBOOK_LEAD_ADS_REQUIRES, LEAD_GET_OPERATION, type LeadGetOptions, facebookLeadAdsAuthorize, facebookLeadAdsFaker, facebookLeadAdsLeadGet, parseFacebookLeadAdsSignature, verifyFacebookLeadAdsDelivery };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { CONNECTOR_API_VERSION, FACEBOOK_LEAD_ADS, FACEBOOK_LEAD_ADS_BASE_URLS, FACEBOOK_LEAD_ADS_LEADGEN, FACEBOOK_LEAD_ADS_LEADGEN_SCHEME, FACEBOOK_LEAD_ADS_LEADGEN_SIGNATURE_HEADER, FACEBOOK_LEAD_ADS_REQUIRES, LEAD_GET_OPERATION, facebookLeadAdsAuthorize, facebookLeadAdsFaker, facebookLeadAdsLeadGet, parseFacebookLeadAdsSignature, verifyFacebookLeadAdsDelivery } from './chunk-JVNM4F6J.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}