@wefunder/sdk 0.1.0-beta.6 → 0.1.0-beta.8
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 +14 -0
- package/dist/index.cjs +36 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1074 -168
- package/dist/index.d.ts +1074 -168
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/examples_manifest.json +22 -2
- package/package.json +1 -1
package/examples_manifest.json
CHANGED
|
@@ -2,15 +2,35 @@
|
|
|
2
2
|
"manifestVersion": 1,
|
|
3
3
|
"lang": "JavaScript",
|
|
4
4
|
"label": "@wefunder/sdk",
|
|
5
|
-
"sdkVersion": "0.1.0-beta.
|
|
5
|
+
"sdkVersion": "0.1.0-beta.8",
|
|
6
6
|
"apiVersion": "2025-01-15",
|
|
7
7
|
"generatedBy": "scripts/build-examples-manifest.mjs",
|
|
8
8
|
"samples": {
|
|
9
|
+
"createIntent": "const { data: intent } = await wf.unwrap(\n wf.raw.createIntent({\n body: {\n action_name: \"syndicates.close_deal\",\n resource_type: \"Club\",\n resource_id: \"syn_example\",\n params: { fundraise_id: 99 },\n // Safe to retry: an existing pending/executed intent with this key is returned instead.\n idempotency_key: \"close-acme-series-a\",\n requested_by_agent: \"My Deal Bot\",\n },\n }),\n);\n// Hand this URL to a human — the action executes only after they approve.\nconsole.log(intent?.attributes?.review_url);",
|
|
9
10
|
"createWebhookSubscription": "const subscription = await wf.unwrap(\n wf.raw.createWebhookSubscription({\n path: { campaign_id: 1234 },\n body: {\n target_url: \"https://example.com/wefunder/webhooks\",\n events: [\"investment.confirmed\", \"investment.canceled\"],\n },\n }),\n);\nconsole.log(subscription);",
|
|
11
|
+
"deleteWebhookSubscription": "await wf.unwrap(wf.raw.deleteWebhookSubscription({ path: { campaign_id: 1234, webhook_id: 56 } }));",
|
|
12
|
+
"getAttributionMe": "const me = await wf.attribution.me();\nconsole.log(me);",
|
|
13
|
+
"getAttributionStats": "const stats = await wf.unwrap(\n wf.raw.getAttributionStats({\n path: { campaign_id: 1234 },\n query: { start_date: \"2026-01-01\", end_date: \"2026-03-31\", utm_source: \"newsletter\" },\n }),\n);\nconsole.log(stats.data);",
|
|
10
14
|
"getCurrentUser": "const me = await wf.users.me();\nconsole.log(\"Logged in as\", me.id);",
|
|
15
|
+
"getIntent": "const intent = await wf.intents.get(\"intent_abc123\");\nconsole.log(intent.attributes?.status); // pending | approved | executed | expired | rejected | failed",
|
|
11
16
|
"getOffering": "const offering = await wf.offerings.get(\"ofr_QfmTyP8qjfYAvkEgREyL3kLf\");\nconsole.log(offering.attributes?.company_name, offering.attributes?.state);",
|
|
17
|
+
"getPortfolio": "const summary = await wf.portfolio.get();\nconsole.log(\n summary.attributes?.total_current_value_cents,\n summary.attributes?.return_multiple,\n);",
|
|
18
|
+
"getSyndicate": "const syndicate = await wf.syndicates.get(42);\nconsole.log(syndicate.attributes?.name, syndicate.attributes?.deal_count);",
|
|
19
|
+
"getSyndicatePortfolio": "const { data: summary } = await wf.unwrap(\n wf.raw.getSyndicatePortfolio({\n path: { syndicate_id: \"syn_example\" },\n }),\n);\nconsole.log(summary?.attributes?.total_current_value_cents);",
|
|
20
|
+
"getWebhookSubscription": "const subscription = await wf.unwrap(\n wf.raw.getWebhookSubscription({ path: { campaign_id: 1234, webhook_id: 56 } }),\n);\nconsole.log(subscription.data);",
|
|
12
21
|
"guides/client-credentials": "const wf = await Wefunder.fromClientCredentials({\n clientId: process.env.WEFUNDER_CLIENT_ID!,\n clientSecret: process.env.WEFUNDER_CLIENT_SECRET!,\n scopes: [\"read:public\"],\n});\n\nconsole.log(\"mode:\", wf.mode); // \"live\" or \"test\", from the token prefix\n\n// client_credentials holds only read:public — browse public offerings.\n// (wf.users.me() would throw 403 insufficient_scope: it needs read:profile.)\nfor await (const offering of wf.offerings.all()) {\n console.log(offering.id);\n}",
|
|
22
|
+
"listActivity": "// Everything my connected apps did to syndicate members, most recent first.\nconst activity = await wf.unwrap(\n wf.raw.listActivity({\n query: { action_pattern: \"syndicates.member.*\", status: \"success\" },\n }),\n);\nfor (const event of activity.data ?? []) {\n console.log(event.attributes?.action, event.attributes?.created_at);\n}",
|
|
23
|
+
"listAttributedInvestments": "const investments = await wf.unwrap(\n wf.raw.listAttributedInvestments({\n path: { campaign_id: 1234 },\n query: { start_date: \"2026-01-01\", detail_level: \"anonymized\" },\n }),\n);\nfor (const investment of investments.data ?? []) {\n if (\"amount_tier\" in investment) {\n // Anonymized row: opaque tokens + an amount tier, never exact values or PII.\n console.log(investment.investor_token, investment.amount_tier, investment.attribution?.utm_source);\n }\n}",
|
|
24
|
+
"listAttributionCampaigns": "const campaigns = await wf.unwrap(wf.raw.listAttributionCampaigns());\nconsole.log(campaigns.data);",
|
|
25
|
+
"listCampaigns": "// Campaigns for companies where the authenticated user is a founder.\nconst page = await wf.campaigns.list();\nfor (const campaign of page.data ?? []) {\n console.log(campaign.id, campaign.attributes?.company_name, campaign.attributes?.amount_raised);\n}\n\n// Or stream every campaign lazily, one page fetched at a time:\nfor await (const campaign of wf.campaigns.all()) {\n console.log(campaign.attributes?.state);\n}",
|
|
26
|
+
"listConnectedApps": "const apps = await wf.unwrap(wf.raw.listConnectedApps());\nfor (const app of apps.data ?? []) {\n console.log(app.id, app.attributes?.name);\n}",
|
|
27
|
+
"listIntents": "// Which of my proposed actions are still waiting on human approval?\nconst page = await wf.intents.list({ status: \"pending\" });\nfor (const intent of page.data ?? []) {\n console.log(intent.id, intent.attributes?.action, intent.attributes?.review_url);\n}",
|
|
13
28
|
"listInvestments": "// Auto-paginate the full history lazily:\nfor await (const investment of wf.investments.all()) {\n console.log(investment.id);\n}\n\n// Or grab one page with its meta (next_cursor, etc.):\nconst page = await wf.investments.list();\nconsole.log(page.data?.length, page.meta?.next_cursor);",
|
|
14
|
-
"listOfferings": "// Browse live offerings, sorted. The cursor is opaque and handled for you.\nconst page = await wf.offerings.list({ sort: \"most_raised\" });\nfor (const offering of page.data ?? []) {\n console.log(offering.id, offering.attributes?.company_name);\n}\n\n// Or stream every offering lazily, one page fetched at a time:\nfor await (const offering of wf.offerings.all({ sort: \"newest\" })) {\n console.log(offering.id);\n}"
|
|
29
|
+
"listOfferings": "// Browse live offerings, sorted. The cursor is opaque and handled for you.\nconst page = await wf.offerings.list({ sort: \"most_raised\" });\nfor (const offering of page.data ?? []) {\n console.log(offering.id, offering.attributes?.company_name);\n}\n\n// Or stream every offering lazily, one page fetched at a time:\nfor await (const offering of wf.offerings.all({ sort: \"newest\" })) {\n console.log(offering.id);\n}",
|
|
30
|
+
"listPortfolioPositions": "for await (const position of wf.portfolio.positions.all({ status: \"active\" })) {\n console.log(\n position.id,\n position.attributes?.company?.name,\n position.attributes?.current_value_cents,\n );\n}",
|
|
31
|
+
"listSyndicatePortfolioPositions": "const page = await wf.unwrap(\n wf.raw.listSyndicatePortfolioPositions({\n path: { syndicate_id: \"syn_example\" },\n query: { status: \"active\", per_page: 25 },\n }),\n);\nfor (const position of page.data ?? []) {\n console.log(position.id, position.attributes?.investor_count);\n}",
|
|
32
|
+
"listSyndicates": "const page = await wf.syndicates.list({ limit: 50 });\nfor (const syndicate of page.data ?? []) {\n console.log(syndicate.id, syndicate.attributes?.name, syndicate.attributes?.member_count);\n}",
|
|
33
|
+
"listWebhookSubscriptions": "const subscriptions = await wf.unwrap(\n wf.raw.listWebhookSubscriptions({ path: { campaign_id: 1234 } }),\n);\nfor (const sub of subscriptions.data ?? []) {\n console.log(sub.id, sub.target_url, sub.events, sub.active);\n}",
|
|
34
|
+
"testWebhookSubscription": "const result = await wf.unwrap(\n wf.raw.testWebhookSubscription({ path: { campaign_id: 1234, webhook_id: 56 } }),\n);\nconsole.log(result.data);"
|
|
15
35
|
}
|
|
16
36
|
}
|