@wefunder/sdk 0.1.0-beta.5 → 0.1.0-beta.6
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/examples_manifest.json +16 -0
- package/package.json +7 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifestVersion": 1,
|
|
3
|
+
"lang": "JavaScript",
|
|
4
|
+
"label": "@wefunder/sdk",
|
|
5
|
+
"sdkVersion": "0.1.0-beta.6",
|
|
6
|
+
"apiVersion": "2025-01-15",
|
|
7
|
+
"generatedBy": "scripts/build-examples-manifest.mjs",
|
|
8
|
+
"samples": {
|
|
9
|
+
"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);",
|
|
10
|
+
"getCurrentUser": "const me = await wf.users.me();\nconsole.log(\"Logged in as\", me.id);",
|
|
11
|
+
"getOffering": "const offering = await wf.offerings.get(\"ofr_QfmTyP8qjfYAvkEgREyL3kLf\");\nconsole.log(offering.attributes?.company_name, offering.attributes?.state);",
|
|
12
|
+
"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}",
|
|
13
|
+
"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}"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wefunder/sdk",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.6",
|
|
4
4
|
"description": "Official TypeScript SDK for the Wefunder API (beta)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,17 +39,21 @@
|
|
|
39
39
|
"./package.json": "./package.json"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
|
-
"dist"
|
|
42
|
+
"dist",
|
|
43
|
+
"examples_manifest.json"
|
|
43
44
|
],
|
|
44
45
|
"scripts": {
|
|
45
46
|
"generate": "openapi-ts",
|
|
46
47
|
"build": "tsup",
|
|
47
48
|
"typecheck": "tsc --noEmit",
|
|
49
|
+
"typecheck:examples": "tsc -p tsconfig.examples.json",
|
|
50
|
+
"build:examples": "node scripts/build-examples-manifest.mjs",
|
|
51
|
+
"version": "npm run build:examples && git add examples_manifest.json",
|
|
48
52
|
"test": "vitest run",
|
|
49
53
|
"test:watch": "vitest",
|
|
50
54
|
"test:e2e": "vitest run --config vitest.config.e2e.ts",
|
|
51
55
|
"sync-spec": "node scripts/sync-spec.mjs",
|
|
52
|
-
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
56
|
+
"prepublishOnly": "npm run typecheck && npm run typecheck:examples && npm test && npm run build"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
59
|
"@hey-api/openapi-ts": "^0.99.0",
|