@particle-academy/instagram-business-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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@particle-academy/instagram-business-ui`,
4
+ `@particle-academy/instagram-business-js`,
5
+ `particle-academy/instagram-business-php` and `fancy-instagram-business`.
6
+
7
+ ## [0.1.0] - 2026-08-24
8
+
9
+ ### Added
10
+
11
+ - Create an image media container from a public URL and optional caption.
12
+ - Publish a container by wiring its returned id into `creation_id`.
13
+ - OAuth2 with App Secret Proof for Meta professional Instagram accounts.
14
+ - Deterministic fixtures for both publishing calls.
15
+
16
+ [0.1.0]: https://github.com/Fancy-Friends/instagram-business/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Particle Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # Instagram for Business
2
+
3
+ Instagram for Business for [fancy-flow][flow] — as **four imported, versioned packages**, one
4
+ per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
5
+ change.
6
+
7
+ [flow]: https://github.com/Particle-Academy/fancy-flow
8
+
9
+ | Runtime | Package | Install |
10
+ |---|---|---|
11
+ | Authoring surface (every host) | `@particle-academy/instagram-business-ui` | `npm install @particle-academy/instagram-business-ui` |
12
+ | Node | `@particle-academy/instagram-business-js` | `npm install @particle-academy/instagram-business-js` |
13
+ | PHP 8.4+ | `particle-academy/instagram-business-php` | `composer require particle-academy/instagram-business-php` |
14
+ | Python 3.11+ | `fancy-instagram-business` | `pip install fancy-instagram-business` |
15
+
16
+ The `ui` package is the editor surface and is React on every host — a PHP or
17
+ Python project installs it *and* its own runtime package, and never the `js` one.
18
+
19
+ ## What it costs you
20
+
21
+ One dependency: `@particle-academy/fancy-connector-core` (or
22
+ `particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
23
+ packages pull in themselves. The Python package has **zero** runtime
24
+ dependencies.
25
+
26
+ **No Instagram for Business SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
27
+ subject to the kit's full approval bar, and one per provider is hundreds of
28
+ dependencies nobody is tracking.
29
+
30
+ ## Setting it up
31
+
32
+ Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
33
+
34
+ ### Credentials
35
+
36
+ A Instagram for Business connection holds 4 values.
37
+
38
+ **Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
39
+
40
+ | Field | Scope | Secret | Where it comes from |
41
+ |---|---|---|---|
42
+ | **App ID** | per installation | not secret | From the Meta app dashboard. One value serves the installation. |
43
+ | **App secret (OAuth)** | per installation | **secret** | Used for the authorization-code exchange. |
44
+ | **App secret (proof)** | per installation | **secret** | Keys appsecret_proof on outgoing Graph API calls. |
45
+ | **Instagram access token** | per connected account | **secret** | The connected professional account's long-lived Meta access token. |
46
+
47
+ ### Authorising
48
+
49
+ Instagram for Business uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
50
+
51
+ - **Authorize URL** — https://www.facebook.com/v25.0/dialog/oauth
52
+ - **Token URL** — https://graph.facebook.com/v25.0/oauth/access_token
53
+ - **Scopes** — `instagram_basic`, `instagram_content_publish`, `pages_read_engagement`
54
+ - **Access token lifetime** — 5184000 seconds (60 days). A host that never refreshes works all afternoon and is broken by morning.
55
+
56
+ **This flow issues NO refresh token.** A connection is RE-AUTHORISED rather than refreshed when the access token expires — checked, not assumed.
57
+
58
+ ### The estate
59
+
60
+ **Instagram for Business has no test estate, and somebody checked.** Everything this connector does is real. Use the faker to build against it.
61
+
62
+ > Instagram publishing has no sandbox. Publishing creates a real post on a real professional account, and an unpublished container expires after 24 hours.
63
+
64
+ ## What it can do
65
+
66
+ ### Actions
67
+
68
+ #### `media_container_create` — Instagram media container
69
+
70
+ Create an Instagram image container. This reports success before any post exists: pass its id to Publish Instagram media, or the unpublished container expires after 24 hours without producing a post.
71
+
72
+ `POST /{igUserId}/media` · **unsafe to replay** — a retried durable run does it TWICE
73
+
74
+ | Input | Required | What it is |
75
+ |---|---|---|
76
+ | `igUserId` | yes | The professional Instagram account's numeric Graph API id. |
77
+ | `imageUrl` | yes | A publicly reachable image URL. Meta fetches its bytes while creating the container. |
78
+ | `caption` | no | The caption stored with the container and used when published. |
79
+
80
+ #### `media_publish` — Publish Instagram media
81
+
82
+ Publish a previously created Instagram media container as a real post.
83
+
84
+ `POST /{igUserId}/media_publish` · **unsafe to replay** — a retried durable run does it TWICE
85
+
86
+ | Input | Required | What it is |
87
+ |---|---|---|
88
+ | `igUserId` | yes | The same professional account id used to create the container. |
89
+ | `creationId` | yes | The id returned by Create Instagram media container. Unpublished containers expire after 24 hours. |
90
+
91
+ ## Run it before you have credentials
92
+
93
+ Every operation ships a **faker**, whether or not Instagram for Business has a sandbox. Set a
94
+ node's mode to `fake` and it returns the shape Instagram for Business actually publishes — the
95
+ same field names, deterministically — so you can wire the downstream nodes before
96
+ touching an account, a key, or a network.
97
+
98
+ ## This repository is generated
99
+
100
+ `provider/` is the source. Everything under `packages/` is emitted from it and
101
+ **must not be hand-edited** — CI regenerates and diffs on every push, and the
102
+ next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
103
+
104
+ ## Two namespaces, which do not match on purpose
105
+
106
+ The repo is `github.com/Fancy-Friends/instagram-business`; the packages publish under
107
+ `particle-academy`. Nothing derives one from the other — the names come from
108
+ weaver's `friends.json` and nowhere else.
109
+
110
+ ## Licence
111
+
112
+ MIT.
@@ -0,0 +1,111 @@
1
+ import { createHmac } from 'crypto';
2
+ import { callConnector } from '@particle-academy/fancy-connector-core';
3
+
4
+ // src/faker.ts
5
+ function fakeMediaContainerCreate({ config, fake }) {
6
+ return {
7
+ "id": "17889455560051444"
8
+ };
9
+ }
10
+ function fakeMediaPublish({ config, fake }) {
11
+ return {
12
+ "id": "17920238422030506"
13
+ };
14
+ }
15
+ var instagramBusinessFaker = (operation, request) => {
16
+ switch (operation) {
17
+ case "media_container_create":
18
+ return fakeMediaContainerCreate(request);
19
+ case "media_publish":
20
+ return fakeMediaPublish(request);
21
+ default:
22
+ throw new Error(
23
+ `instagram_business: 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.`
24
+ );
25
+ }
26
+ };
27
+ var CONNECTOR_API_VERSION = 1;
28
+ var INSTAGRAM_BUSINESS_BASE_URLS = {
29
+ "live": "https://graph.facebook.com/v25.0"
30
+ };
31
+ var INSTAGRAM_BUSINESS_REQUIRES = [
32
+ "accessToken",
33
+ "appSecret",
34
+ "clientId",
35
+ "clientSecret"
36
+ ];
37
+ function instagramBusinessAuthorize(credentials, request, _mode) {
38
+ const url = new URL(request.url);
39
+ url.searchParams.set("access_token", String(credentials.accessToken ?? ""));
40
+ const proof = createHmac("sha256", String(credentials.appSecret ?? "")).update(String(credentials.accessToken ?? "")).digest("hex");
41
+ url.searchParams.set("appsecret_proof", proof);
42
+ request.url = url.toString();
43
+ }
44
+ var INSTAGRAM_BUSINESS = {
45
+ service: "instagram_business",
46
+ title: "Instagram for Business",
47
+ sandbox: "none",
48
+ baseUrls: { ...INSTAGRAM_BUSINESS_BASE_URLS },
49
+ requires: [...INSTAGRAM_BUSINESS_REQUIRES],
50
+ authorize: instagramBusinessAuthorize,
51
+ faker: instagramBusinessFaker
52
+ };
53
+ var MEDIA_CONTAINER_CREATE_OPERATION = "media_container_create";
54
+ async function instagramBusinessMediaContainerCreate(options) {
55
+ const config = options.config ?? {};
56
+ if (config.igUserId === void 0 || config.igUserId === null || config.igUserId === "") {
57
+ throw new Error(`media_container_create: "igUserId" is required (Instagram user ID).`);
58
+ }
59
+ if (config.imageUrl === void 0 || config.imageUrl === null || config.imageUrl === "") {
60
+ throw new Error(`media_container_create: "imageUrl" is required (Image URL).`);
61
+ }
62
+ return callConnector(INSTAGRAM_BUSINESS, {
63
+ operation: MEDIA_CONTAINER_CREATE_OPERATION,
64
+ config,
65
+ input: options.input,
66
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
67
+ ...options.mode === void 0 ? {} : { mode: options.mode },
68
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
69
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
70
+ ...options.transport === void 0 ? {} : { transport: options.transport },
71
+ request: {
72
+ method: "POST",
73
+ path: `/${encodeURIComponent(String(config.igUserId))}/media`,
74
+ json: {
75
+ "image_url": String(config.imageUrl),
76
+ ...config.caption !== void 0 && config.caption !== null && config.caption !== "" ? { "caption": String(config.caption) } : {}
77
+ }
78
+ }
79
+ });
80
+ }
81
+ var MEDIA_PUBLISH_OPERATION = "media_publish";
82
+ async function instagramBusinessMediaPublish(options) {
83
+ const config = options.config ?? {};
84
+ if (config.igUserId === void 0 || config.igUserId === null || config.igUserId === "") {
85
+ throw new Error(`media_publish: "igUserId" is required (Instagram user ID).`);
86
+ }
87
+ if (config.creationId === void 0 || config.creationId === null || config.creationId === "") {
88
+ throw new Error(`media_publish: "creationId" is required (Creation ID).`);
89
+ }
90
+ return callConnector(INSTAGRAM_BUSINESS, {
91
+ operation: MEDIA_PUBLISH_OPERATION,
92
+ config,
93
+ input: options.input,
94
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
95
+ ...options.mode === void 0 ? {} : { mode: options.mode },
96
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
97
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
98
+ ...options.transport === void 0 ? {} : { transport: options.transport },
99
+ request: {
100
+ method: "POST",
101
+ path: `/${encodeURIComponent(String(config.igUserId))}/media_publish`,
102
+ json: {
103
+ "creation_id": String(config.creationId)
104
+ }
105
+ }
106
+ });
107
+ }
108
+
109
+ export { CONNECTOR_API_VERSION, INSTAGRAM_BUSINESS, INSTAGRAM_BUSINESS_BASE_URLS, INSTAGRAM_BUSINESS_REQUIRES, MEDIA_CONTAINER_CREATE_OPERATION, MEDIA_PUBLISH_OPERATION, instagramBusinessAuthorize, instagramBusinessFaker, instagramBusinessMediaContainerCreate, instagramBusinessMediaPublish };
110
+ //# sourceMappingURL=chunk-Z43FUIPD.js.map
111
+ //# sourceMappingURL=chunk-Z43FUIPD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/media-container-create.ts","../src/actions/media-publish.ts"],"names":["callConnector"],"mappings":";;;;AA0BA,SAAS,wBAAA,CAAyB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACxE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM;AAAA,GACR;AACF;AAEA,SAAS,gBAAA,CAAiB,EAAE,MAAA,EAAQ,IAAA,EAAK,EA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AA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,MAAA;AAAA,MACR,MAAM,CAAA,CAAA,EAAI,kBAAA,CAAmB,OAAO,MAAA,CAAO,QAAQ,CAAC,CAAC,CAAA,cAAA,CAAA;AAAA,MACrD,IAAA,EAAM;AAAA,QACJ,aAAA,EAAe,MAAA,CAAO,MAAA,CAAO,UAAU;AAAA;AACzC;AACF,GACD,CAAA;AACH","file":"chunk-Z43FUIPD.js","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 -- instagram_business\n */\n\n/**\n * The Instagram for Business faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Instagram for Business 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 fakeMediaContainerCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": \"17889455560051444\",\n };\n}\n\nfunction fakeMediaPublish({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": \"17920238422030506\",\n };\n}\n\nexport const instagramBusinessFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"media_container_create\":\n return fakeMediaContainerCreate(request);\n\n case \"media_publish\":\n return fakeMediaPublish(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 `instagram_business: 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 -- instagram_business\n */\n\n/**\n * Instagram for Business, as one service descriptor shared by every Instagram\n * for Business operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Instagram for Business: its base\n * URL, its auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Instagram publishing has no sandbox. Publishing creates a real post on a\n * real professional account, and an unpublished container expires after 24\n * hours.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { instagramBusinessFaker } 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 INSTAGRAM_BUSINESS_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 INSTAGRAM_BUSINESS_REQUIRES = [\n \"accessToken\",\n \"appSecret\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Instagram for Business's auth scheme to an outgoing request.\n *\n * Meta documents the token as a query parameter. appsecret_proof travels\n * beside it so installations requiring App Secret Proof do not reject every\n * call.\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 instagramBusinessAuthorize(\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.accessToken ?? \"\"));\n\n const proof = createHmac(\"sha256\", String(credentials.appSecret ?? \"\"))\n .update(String(credentials.accessToken ?? \"\"))\n .digest(\"hex\");\n\n url.searchParams.set(\"appsecret_proof\", proof);\n request.url = url.toString();\n}\n\n/** The Instagram for Business service, for the TypeScript runtime. */\nexport const INSTAGRAM_BUSINESS: ServiceDescriptor = {\n service: \"instagram_business\",\n title: \"Instagram for Business\",\n sandbox: \"none\",\n baseUrls: { ...INSTAGRAM_BUSINESS_BASE_URLS },\n requires: [...INSTAGRAM_BUSINESS_REQUIRES],\n authorize: instagramBusinessAuthorize,\n faker: instagramBusinessFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/media-container-create.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/media-container-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- instagram_business\n */\n\n/**\n * Create an Instagram image container. This reports success before any post\n * exists: pass its id to Publish Instagram media, or the unpublished container\n * expires after 24 hours without producing a post.\n *\n * POST /{igUserId}/media —\n * https://developers.facebook.com/docs/instagram-platform/content-publishing/#create-a-container\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 Instagram for Business or\n * calls the faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { INSTAGRAM_BUSINESS } from \"../service.js\";\n\nexport const MEDIA_CONTAINER_CREATE_OPERATION = \"media_container_create\";\n\nexport type MediaContainerCreateOptions = {\n /** The node's resolved config. Keys: igUserId, imageUrl, caption. */\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 instagramBusinessMediaContainerCreate(options: MediaContainerCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.igUserId === undefined || config.igUserId === null || config.igUserId === \"\") {\n throw new Error(`media_container_create: \"igUserId\" is required (Instagram user ID).`);\n }\n\n if (config.imageUrl === undefined || config.imageUrl === null || config.imageUrl === \"\") {\n throw new Error(`media_container_create: \"imageUrl\" is required (Image URL).`);\n }\n\n return callConnector(INSTAGRAM_BUSINESS, {\n operation: MEDIA_CONTAINER_CREATE_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: \"POST\",\n path: `/${encodeURIComponent(String(config.igUserId))}/media`,\n json: {\n \"image_url\": String(config.imageUrl),\n ...(config.caption !== undefined && config.caption !== null && config.caption !== \"\" ? { \"caption\": String(config.caption) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/media-publish.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/media-publish.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- instagram_business\n */\n\n/**\n * Publish a previously created Instagram media container as a real post.\n *\n * POST /{igUserId}/media_publish —\n * https://developers.facebook.com/docs/instagram-platform/content-publishing/#publish-the-container\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 Instagram for Business or\n * calls the faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { INSTAGRAM_BUSINESS } from \"../service.js\";\n\nexport const MEDIA_PUBLISH_OPERATION = \"media_publish\";\n\nexport type MediaPublishOptions = {\n /** The node's resolved config. Keys: igUserId, creationId. */\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 instagramBusinessMediaPublish(options: MediaPublishOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.igUserId === undefined || config.igUserId === null || config.igUserId === \"\") {\n throw new Error(`media_publish: \"igUserId\" is required (Instagram user ID).`);\n }\n\n if (config.creationId === undefined || config.creationId === null || config.creationId === \"\") {\n throw new Error(`media_publish: \"creationId\" is required (Creation ID).`);\n }\n\n return callConnector(INSTAGRAM_BUSINESS, {\n operation: MEDIA_PUBLISH_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: \"POST\",\n path: `/${encodeURIComponent(String(config.igUserId))}/media_publish`,\n json: {\n \"creation_id\": String(config.creationId),\n },\n },\n });\n}\n"]}
package/dist/flow.cjs ADDED
@@ -0,0 +1,151 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+ var crypto = require('crypto');
5
+ var instagramBusinessUi = require('@particle-academy/instagram-business-ui');
6
+
7
+ // src/flow.ts
8
+
9
+ // src/faker.ts
10
+ function fakeMediaContainerCreate({ config, fake }) {
11
+ return {
12
+ "id": "17889455560051444"
13
+ };
14
+ }
15
+ function fakeMediaPublish({ config, fake }) {
16
+ return {
17
+ "id": "17920238422030506"
18
+ };
19
+ }
20
+ var instagramBusinessFaker = (operation, request) => {
21
+ switch (operation) {
22
+ case "media_container_create":
23
+ return fakeMediaContainerCreate(request);
24
+ case "media_publish":
25
+ return fakeMediaPublish(request);
26
+ default:
27
+ throw new Error(
28
+ `instagram_business: 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.`
29
+ );
30
+ }
31
+ };
32
+ var INSTAGRAM_BUSINESS_BASE_URLS = {
33
+ "live": "https://graph.facebook.com/v25.0"
34
+ };
35
+ var INSTAGRAM_BUSINESS_REQUIRES = [
36
+ "accessToken",
37
+ "appSecret",
38
+ "clientId",
39
+ "clientSecret"
40
+ ];
41
+ function instagramBusinessAuthorize(credentials, request, _mode) {
42
+ const url = new URL(request.url);
43
+ url.searchParams.set("access_token", String(credentials.accessToken ?? ""));
44
+ const proof = crypto.createHmac("sha256", String(credentials.appSecret ?? "")).update(String(credentials.accessToken ?? "")).digest("hex");
45
+ url.searchParams.set("appsecret_proof", proof);
46
+ request.url = url.toString();
47
+ }
48
+ var INSTAGRAM_BUSINESS = {
49
+ service: "instagram_business",
50
+ title: "Instagram for Business",
51
+ sandbox: "none",
52
+ baseUrls: { ...INSTAGRAM_BUSINESS_BASE_URLS },
53
+ requires: [...INSTAGRAM_BUSINESS_REQUIRES],
54
+ authorize: instagramBusinessAuthorize,
55
+ faker: instagramBusinessFaker
56
+ };
57
+ var MEDIA_CONTAINER_CREATE_OPERATION = "media_container_create";
58
+ async function instagramBusinessMediaContainerCreate(options) {
59
+ const config = options.config ?? {};
60
+ if (config.igUserId === void 0 || config.igUserId === null || config.igUserId === "") {
61
+ throw new Error(`media_container_create: "igUserId" is required (Instagram user ID).`);
62
+ }
63
+ if (config.imageUrl === void 0 || config.imageUrl === null || config.imageUrl === "") {
64
+ throw new Error(`media_container_create: "imageUrl" is required (Image URL).`);
65
+ }
66
+ return fancyConnectorCore.callConnector(INSTAGRAM_BUSINESS, {
67
+ operation: MEDIA_CONTAINER_CREATE_OPERATION,
68
+ config,
69
+ input: options.input,
70
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
71
+ ...options.mode === void 0 ? {} : { mode: options.mode },
72
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
73
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
74
+ ...options.transport === void 0 ? {} : { transport: options.transport },
75
+ request: {
76
+ method: "POST",
77
+ path: `/${encodeURIComponent(String(config.igUserId))}/media`,
78
+ json: {
79
+ "image_url": String(config.imageUrl),
80
+ ...config.caption !== void 0 && config.caption !== null && config.caption !== "" ? { "caption": String(config.caption) } : {}
81
+ }
82
+ }
83
+ });
84
+ }
85
+ var MEDIA_PUBLISH_OPERATION = "media_publish";
86
+ async function instagramBusinessMediaPublish(options) {
87
+ const config = options.config ?? {};
88
+ if (config.igUserId === void 0 || config.igUserId === null || config.igUserId === "") {
89
+ throw new Error(`media_publish: "igUserId" is required (Instagram user ID).`);
90
+ }
91
+ if (config.creationId === void 0 || config.creationId === null || config.creationId === "") {
92
+ throw new Error(`media_publish: "creationId" is required (Creation ID).`);
93
+ }
94
+ return fancyConnectorCore.callConnector(INSTAGRAM_BUSINESS, {
95
+ operation: MEDIA_PUBLISH_OPERATION,
96
+ config,
97
+ input: options.input,
98
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
99
+ ...options.mode === void 0 ? {} : { mode: options.mode },
100
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
101
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
102
+ ...options.transport === void 0 ? {} : { transport: options.transport },
103
+ request: {
104
+ method: "POST",
105
+ path: `/${encodeURIComponent(String(config.igUserId))}/media_publish`,
106
+ json: {
107
+ "creation_id": String(config.creationId)
108
+ }
109
+ }
110
+ });
111
+ }
112
+
113
+ // src/flow.ts
114
+ var instagramBusinessMediaContainerExecutor = async (ctx) => {
115
+ const config = ctx.node.data?.config ?? {};
116
+ const result = await instagramBusinessMediaContainerCreate({
117
+ config,
118
+ input: ctx.inputs?.in
119
+ });
120
+ ctx.emit({
121
+ type: "log",
122
+ level: "info",
123
+ nodeId: ctx.node.id,
124
+ message: `instagram_business media_container_create ${result.data?.id} (${result.mode})`
125
+ });
126
+ return { __port: "out", value: result };
127
+ };
128
+ var instagramBusinessMediaPublishExecutor = async (ctx) => {
129
+ const config = ctx.node.data?.config ?? {};
130
+ const result = await instagramBusinessMediaPublish({
131
+ config,
132
+ input: ctx.inputs?.in
133
+ });
134
+ ctx.emit({
135
+ type: "log",
136
+ level: "info",
137
+ nodeId: ctx.node.id,
138
+ message: `instagram_business media_publish ${result.data?.id} (${result.mode})`
139
+ });
140
+ return { __port: "out", value: result };
141
+ };
142
+ var INSTAGRAM_BUSINESS_RUNNABLE_KINDS = [
143
+ { ...instagramBusinessUi.instagramBusinessMediaContainerKind, executor: instagramBusinessMediaContainerExecutor },
144
+ { ...instagramBusinessUi.instagramBusinessMediaPublishKind, executor: instagramBusinessMediaPublishExecutor }
145
+ ];
146
+
147
+ exports.INSTAGRAM_BUSINESS_RUNNABLE_KINDS = INSTAGRAM_BUSINESS_RUNNABLE_KINDS;
148
+ exports.instagramBusinessMediaContainerExecutor = instagramBusinessMediaContainerExecutor;
149
+ exports.instagramBusinessMediaPublishExecutor = instagramBusinessMediaPublishExecutor;
150
+ //# sourceMappingURL=flow.cjs.map
151
+ //# sourceMappingURL=flow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/media-container-create.ts","../src/actions/media-publish.ts","../src/flow.ts"],"names":["createHmac","callConnector","instagramBusinessMediaContainerKind","instagramBusinessMediaPublishKind"],"mappings":";;;;;;;;;AA0BA,SAAS,wBAAA,CAAyB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACxE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM;AAAA,GACR;AACF;AAEA,SAAS,gBAAA,CAAiB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAChE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM;AAAA,GACR;AACF;AAEO,IAAM,sBAAA,GAAyC,CAAC,SAAA,EAAW,OAAA,KAAY;AAC5E,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,wBAAA;AACH,MAAA,OAAO,yBAAyB,OAAO,CAAA;AAAA,IAEzC,KAAK,eAAA;AACH,MAAA,OAAO,iBAAiB,OAAO,CAAA;AAAA,IAEjC;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,wDAAwD,SAAS,CAAA,iJAAA;AAAA,OAGnE;AAAA;AAEN,CAAA;AChBO,IAAM,4BAAA,GAA+B;AAAA,EAC1C,MAAA,EAAQ;AACV,CAAA;AAGO,IAAM,2BAAA,GAA8B;AAAA,EACzC,aAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA;AAaO,SAAS,0BAAA,CACd,WAAA,EACA,OAAA,EACA,KAAA,EACM;AACN,EAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAG,CAAA;AAE/B,EAAA,GAAA,CAAI,aAAa,GAAA,CAAI,cAAA,EAAgB,OAAO,WAAA,CAAY,WAAA,IAAe,EAAE,CAAC,CAAA;AAE1E,EAAA,MAAM,QAAQA,iBAAA,CAAW,QAAA,EAAU,MAAA,CAAO,WAAA,CAAY,aAAa,EAAE,CAAC,CA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\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 -- instagram_business\n */\n\n/**\n * The Instagram for Business faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Instagram for Business 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 fakeMediaContainerCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": \"17889455560051444\",\n };\n}\n\nfunction fakeMediaPublish({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": \"17920238422030506\",\n };\n}\n\nexport const instagramBusinessFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"media_container_create\":\n return fakeMediaContainerCreate(request);\n\n case \"media_publish\":\n return fakeMediaPublish(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 `instagram_business: 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 -- instagram_business\n */\n\n/**\n * Instagram for Business, as one service descriptor shared by every Instagram\n * for Business operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Instagram for Business: its base\n * URL, its auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Instagram publishing has no sandbox. Publishing creates a real post on a\n * real professional account, and an unpublished container expires after 24\n * hours.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { instagramBusinessFaker } 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 INSTAGRAM_BUSINESS_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 INSTAGRAM_BUSINESS_REQUIRES = [\n \"accessToken\",\n \"appSecret\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Instagram for Business's auth scheme to an outgoing request.\n *\n * Meta documents the token as a query parameter. appsecret_proof travels\n * beside it so installations requiring App Secret Proof do not reject every\n * call.\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 instagramBusinessAuthorize(\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.accessToken ?? \"\"));\n\n const proof = createHmac(\"sha256\", String(credentials.appSecret ?? \"\"))\n .update(String(credentials.accessToken ?? \"\"))\n .digest(\"hex\");\n\n url.searchParams.set(\"appsecret_proof\", proof);\n request.url = url.toString();\n}\n\n/** The Instagram for Business service, for the TypeScript runtime. */\nexport const INSTAGRAM_BUSINESS: ServiceDescriptor = {\n service: \"instagram_business\",\n title: \"Instagram for Business\",\n sandbox: \"none\",\n baseUrls: { ...INSTAGRAM_BUSINESS_BASE_URLS },\n requires: [...INSTAGRAM_BUSINESS_REQUIRES],\n authorize: instagramBusinessAuthorize,\n faker: instagramBusinessFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/media-container-create.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/media-container-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- instagram_business\n */\n\n/**\n * Create an Instagram image container. This reports success before any post\n * exists: pass its id to Publish Instagram media, or the unpublished container\n * expires after 24 hours without producing a post.\n *\n * POST /{igUserId}/media —\n * https://developers.facebook.com/docs/instagram-platform/content-publishing/#create-a-container\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 Instagram for Business or\n * calls the faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { INSTAGRAM_BUSINESS } from \"../service.js\";\n\nexport const MEDIA_CONTAINER_CREATE_OPERATION = \"media_container_create\";\n\nexport type MediaContainerCreateOptions = {\n /** The node's resolved config. Keys: igUserId, imageUrl, caption. */\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 instagramBusinessMediaContainerCreate(options: MediaContainerCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.igUserId === undefined || config.igUserId === null || config.igUserId === \"\") {\n throw new Error(`media_container_create: \"igUserId\" is required (Instagram user ID).`);\n }\n\n if (config.imageUrl === undefined || config.imageUrl === null || config.imageUrl === \"\") {\n throw new Error(`media_container_create: \"imageUrl\" is required (Image URL).`);\n }\n\n return callConnector(INSTAGRAM_BUSINESS, {\n operation: MEDIA_CONTAINER_CREATE_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: \"POST\",\n path: `/${encodeURIComponent(String(config.igUserId))}/media`,\n json: {\n \"image_url\": String(config.imageUrl),\n ...(config.caption !== undefined && config.caption !== null && config.caption !== \"\" ? { \"caption\": String(config.caption) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/media-publish.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/media-publish.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- instagram_business\n */\n\n/**\n * Publish a previously created Instagram media container as a real post.\n *\n * POST /{igUserId}/media_publish —\n * https://developers.facebook.com/docs/instagram-platform/content-publishing/#publish-the-container\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 Instagram for Business or\n * calls the faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { INSTAGRAM_BUSINESS } from \"../service.js\";\n\nexport const MEDIA_PUBLISH_OPERATION = \"media_publish\";\n\nexport type MediaPublishOptions = {\n /** The node's resolved config. Keys: igUserId, creationId. */\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 instagramBusinessMediaPublish(options: MediaPublishOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.igUserId === undefined || config.igUserId === null || config.igUserId === \"\") {\n throw new Error(`media_publish: \"igUserId\" is required (Instagram user ID).`);\n }\n\n if (config.creationId === undefined || config.creationId === null || config.creationId === \"\") {\n throw new Error(`media_publish: \"creationId\" is required (Creation ID).`);\n }\n\n return callConnector(INSTAGRAM_BUSINESS, {\n operation: MEDIA_PUBLISH_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: \"POST\",\n path: `/${encodeURIComponent(String(config.igUserId))}/media_publish`,\n json: {\n \"creation_id\": String(config.creationId),\n },\n },\n });\n}\n","/**\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 -- instagram_business\n */\n\n/**\n * Instagram for Business's node kinds with their TypeScript executors attached\n * — for hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/instagram-business-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 { INSTAGRAM_BUSINESS } from \"./service.js\";\n\nimport {\n instagramBusinessMediaContainerKind,\n instagramBusinessMediaPublishKind,\n} from \"@particle-academy/instagram-business-ui\";\n\nimport { instagramBusinessMediaContainerCreate } from \"./actions/media-container-create.js\";\nimport { instagramBusinessMediaPublish } from \"./actions/media-publish.js\";\n\nexport const instagramBusinessMediaContainerExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await instagramBusinessMediaContainerCreate({\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: `instagram_business media_container_create ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const instagramBusinessMediaPublishExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await instagramBusinessMediaPublish({\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: `instagram_business media_publish ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const INSTAGRAM_BUSINESS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...instagramBusinessMediaContainerKind, executor: instagramBusinessMediaContainerExecutor },\n { ...instagramBusinessMediaPublishKind, executor: instagramBusinessMediaPublishExecutor },\n];\n"]}
@@ -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 -- instagram_business
12
+ */
13
+ /**
14
+ * Instagram for Business's node kinds with their TypeScript executors attached
15
+ * — for hosts that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/instagram-business-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 instagramBusinessMediaContainerExecutor: NodeExecutor;
23
+ declare const instagramBusinessMediaPublishExecutor: NodeExecutor;
24
+ /** The kinds a TypeScript host registers. */
25
+ declare const INSTAGRAM_BUSINESS_RUNNABLE_KINDS: NodeKindDefinition[];
26
+
27
+ export { INSTAGRAM_BUSINESS_RUNNABLE_KINDS, instagramBusinessMediaContainerExecutor, instagramBusinessMediaPublishExecutor };
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 -- instagram_business
12
+ */
13
+ /**
14
+ * Instagram for Business's node kinds with their TypeScript executors attached
15
+ * — for hosts that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/instagram-business-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 instagramBusinessMediaContainerExecutor: NodeExecutor;
23
+ declare const instagramBusinessMediaPublishExecutor: NodeExecutor;
24
+ /** The kinds a TypeScript host registers. */
25
+ declare const INSTAGRAM_BUSINESS_RUNNABLE_KINDS: NodeKindDefinition[];
26
+
27
+ export { INSTAGRAM_BUSINESS_RUNNABLE_KINDS, instagramBusinessMediaContainerExecutor, instagramBusinessMediaPublishExecutor };
package/dist/flow.js ADDED
@@ -0,0 +1,40 @@
1
+ import { instagramBusinessMediaContainerCreate, instagramBusinessMediaPublish } from './chunk-Z43FUIPD.js';
2
+ import '@particle-academy/fancy-connector-core';
3
+ import { instagramBusinessMediaContainerKind, instagramBusinessMediaPublishKind } from '@particle-academy/instagram-business-ui';
4
+
5
+ var instagramBusinessMediaContainerExecutor = async (ctx) => {
6
+ const config = ctx.node.data?.config ?? {};
7
+ const result = await instagramBusinessMediaContainerCreate({
8
+ config,
9
+ input: ctx.inputs?.in
10
+ });
11
+ ctx.emit({
12
+ type: "log",
13
+ level: "info",
14
+ nodeId: ctx.node.id,
15
+ message: `instagram_business media_container_create ${result.data?.id} (${result.mode})`
16
+ });
17
+ return { __port: "out", value: result };
18
+ };
19
+ var instagramBusinessMediaPublishExecutor = async (ctx) => {
20
+ const config = ctx.node.data?.config ?? {};
21
+ const result = await instagramBusinessMediaPublish({
22
+ config,
23
+ input: ctx.inputs?.in
24
+ });
25
+ ctx.emit({
26
+ type: "log",
27
+ level: "info",
28
+ nodeId: ctx.node.id,
29
+ message: `instagram_business media_publish ${result.data?.id} (${result.mode})`
30
+ });
31
+ return { __port: "out", value: result };
32
+ };
33
+ var INSTAGRAM_BUSINESS_RUNNABLE_KINDS = [
34
+ { ...instagramBusinessMediaContainerKind, executor: instagramBusinessMediaContainerExecutor },
35
+ { ...instagramBusinessMediaPublishKind, executor: instagramBusinessMediaPublishExecutor }
36
+ ];
37
+
38
+ export { INSTAGRAM_BUSINESS_RUNNABLE_KINDS, instagramBusinessMediaContainerExecutor, instagramBusinessMediaPublishExecutor };
39
+ //# sourceMappingURL=flow.js.map
40
+ //# sourceMappingURL=flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAsCO,IAAM,uCAAA,GAAwD,OAAO,GAAA,KAAQ;AAClF,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,qCAAA,CAAsC;AAAA,IACzD,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,0CAAA,EAA8C,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAC3G,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAEO,IAAM,qCAAA,GAAsD,OAAO,GAAA,KAAQ;AAChF,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,6BAAA,CAA8B;AAAA,IACjD,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,iCAAA,EAAqC,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAClG,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,iCAAA,GAA0D;AAAA,EACrE,EAAE,GAAG,mCAAA,EAAqC,QAAA,EAAU,uCAAA,EAAwC;AAAA,EAC5F,EAAE,GAAG,iCAAA,EAAmC,QAAA,EAAU,qCAAA;AACpD","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 -- instagram_business\n */\n\n/**\n * Instagram for Business's node kinds with their TypeScript executors attached\n * — for hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/instagram-business-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 { INSTAGRAM_BUSINESS } from \"./service.js\";\n\nimport {\n instagramBusinessMediaContainerKind,\n instagramBusinessMediaPublishKind,\n} from \"@particle-academy/instagram-business-ui\";\n\nimport { instagramBusinessMediaContainerCreate } from \"./actions/media-container-create.js\";\nimport { instagramBusinessMediaPublish } from \"./actions/media-publish.js\";\n\nexport const instagramBusinessMediaContainerExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await instagramBusinessMediaContainerCreate({\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: `instagram_business media_container_create ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const instagramBusinessMediaPublishExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await instagramBusinessMediaPublish({\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: `instagram_business media_publish ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const INSTAGRAM_BUSINESS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...instagramBusinessMediaContainerKind, executor: instagramBusinessMediaContainerExecutor },\n { ...instagramBusinessMediaPublishKind, executor: instagramBusinessMediaPublishExecutor },\n];\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,122 @@
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 fakeMediaContainerCreate({ config, fake }) {
8
+ return {
9
+ "id": "17889455560051444"
10
+ };
11
+ }
12
+ function fakeMediaPublish({ config, fake }) {
13
+ return {
14
+ "id": "17920238422030506"
15
+ };
16
+ }
17
+ var instagramBusinessFaker = (operation, request) => {
18
+ switch (operation) {
19
+ case "media_container_create":
20
+ return fakeMediaContainerCreate(request);
21
+ case "media_publish":
22
+ return fakeMediaPublish(request);
23
+ default:
24
+ throw new Error(
25
+ `instagram_business: 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.`
26
+ );
27
+ }
28
+ };
29
+ var CONNECTOR_API_VERSION = 1;
30
+ var INSTAGRAM_BUSINESS_BASE_URLS = {
31
+ "live": "https://graph.facebook.com/v25.0"
32
+ };
33
+ var INSTAGRAM_BUSINESS_REQUIRES = [
34
+ "accessToken",
35
+ "appSecret",
36
+ "clientId",
37
+ "clientSecret"
38
+ ];
39
+ function instagramBusinessAuthorize(credentials, request, _mode) {
40
+ const url = new URL(request.url);
41
+ url.searchParams.set("access_token", String(credentials.accessToken ?? ""));
42
+ const proof = crypto.createHmac("sha256", String(credentials.appSecret ?? "")).update(String(credentials.accessToken ?? "")).digest("hex");
43
+ url.searchParams.set("appsecret_proof", proof);
44
+ request.url = url.toString();
45
+ }
46
+ var INSTAGRAM_BUSINESS = {
47
+ service: "instagram_business",
48
+ title: "Instagram for Business",
49
+ sandbox: "none",
50
+ baseUrls: { ...INSTAGRAM_BUSINESS_BASE_URLS },
51
+ requires: [...INSTAGRAM_BUSINESS_REQUIRES],
52
+ authorize: instagramBusinessAuthorize,
53
+ faker: instagramBusinessFaker
54
+ };
55
+ var MEDIA_CONTAINER_CREATE_OPERATION = "media_container_create";
56
+ async function instagramBusinessMediaContainerCreate(options) {
57
+ const config = options.config ?? {};
58
+ if (config.igUserId === void 0 || config.igUserId === null || config.igUserId === "") {
59
+ throw new Error(`media_container_create: "igUserId" is required (Instagram user ID).`);
60
+ }
61
+ if (config.imageUrl === void 0 || config.imageUrl === null || config.imageUrl === "") {
62
+ throw new Error(`media_container_create: "imageUrl" is required (Image URL).`);
63
+ }
64
+ return fancyConnectorCore.callConnector(INSTAGRAM_BUSINESS, {
65
+ operation: MEDIA_CONTAINER_CREATE_OPERATION,
66
+ config,
67
+ input: options.input,
68
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
69
+ ...options.mode === void 0 ? {} : { mode: options.mode },
70
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
71
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
72
+ ...options.transport === void 0 ? {} : { transport: options.transport },
73
+ request: {
74
+ method: "POST",
75
+ path: `/${encodeURIComponent(String(config.igUserId))}/media`,
76
+ json: {
77
+ "image_url": String(config.imageUrl),
78
+ ...config.caption !== void 0 && config.caption !== null && config.caption !== "" ? { "caption": String(config.caption) } : {}
79
+ }
80
+ }
81
+ });
82
+ }
83
+ var MEDIA_PUBLISH_OPERATION = "media_publish";
84
+ async function instagramBusinessMediaPublish(options) {
85
+ const config = options.config ?? {};
86
+ if (config.igUserId === void 0 || config.igUserId === null || config.igUserId === "") {
87
+ throw new Error(`media_publish: "igUserId" is required (Instagram user ID).`);
88
+ }
89
+ if (config.creationId === void 0 || config.creationId === null || config.creationId === "") {
90
+ throw new Error(`media_publish: "creationId" is required (Creation ID).`);
91
+ }
92
+ return fancyConnectorCore.callConnector(INSTAGRAM_BUSINESS, {
93
+ operation: MEDIA_PUBLISH_OPERATION,
94
+ config,
95
+ input: options.input,
96
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
97
+ ...options.mode === void 0 ? {} : { mode: options.mode },
98
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
99
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
100
+ ...options.transport === void 0 ? {} : { transport: options.transport },
101
+ request: {
102
+ method: "POST",
103
+ path: `/${encodeURIComponent(String(config.igUserId))}/media_publish`,
104
+ json: {
105
+ "creation_id": String(config.creationId)
106
+ }
107
+ }
108
+ });
109
+ }
110
+
111
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
112
+ exports.INSTAGRAM_BUSINESS = INSTAGRAM_BUSINESS;
113
+ exports.INSTAGRAM_BUSINESS_BASE_URLS = INSTAGRAM_BUSINESS_BASE_URLS;
114
+ exports.INSTAGRAM_BUSINESS_REQUIRES = INSTAGRAM_BUSINESS_REQUIRES;
115
+ exports.MEDIA_CONTAINER_CREATE_OPERATION = MEDIA_CONTAINER_CREATE_OPERATION;
116
+ exports.MEDIA_PUBLISH_OPERATION = MEDIA_PUBLISH_OPERATION;
117
+ exports.instagramBusinessAuthorize = instagramBusinessAuthorize;
118
+ exports.instagramBusinessFaker = instagramBusinessFaker;
119
+ exports.instagramBusinessMediaContainerCreate = instagramBusinessMediaContainerCreate;
120
+ exports.instagramBusinessMediaPublish = instagramBusinessMediaPublish;
121
+ //# sourceMappingURL=index.cjs.map
122
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/media-container-create.ts","../src/actions/media-publish.ts"],"names":["createHmac","callConnector"],"mappings":";;;;;;AA0BA,SAAS,wBAAA,CAAyB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACxE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM;AAAA,GACR;AACF;AAEA,SAAS,gBAAA,CAAiB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAChE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM;AAAA,GACR;AACF;AAEO,IAAM,sBAAA,GAAyC,CAAC,SAAA,EAAW,OAAA,KAAY;AAC5E,EAAA,QAAQ,SAAA;AAAW,IACjB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AY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,MAAA;AAAA,MACR,MAAM,CAAA,CAAA,EAAI,kBAAA,CAAmB,OAAO,MAAA,CAAO,QAAQ,CAAC,CAAC,CAAA,cAAA,CAAA;AAAA,MACrD,IAAA,EAAM;AAAA,QACJ,aAAA,EAAe,MAAA,CAAO,MAAA,CAAO,UAAU;AAAA;AACzC;AACF,GACD,CAAA;AACH","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 -- instagram_business\n */\n\n/**\n * The Instagram for Business faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Instagram for Business 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 fakeMediaContainerCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": \"17889455560051444\",\n };\n}\n\nfunction fakeMediaPublish({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": \"17920238422030506\",\n };\n}\n\nexport const instagramBusinessFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"media_container_create\":\n return fakeMediaContainerCreate(request);\n\n case \"media_publish\":\n return fakeMediaPublish(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 `instagram_business: 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 -- instagram_business\n */\n\n/**\n * Instagram for Business, as one service descriptor shared by every Instagram\n * for Business operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Instagram for Business: its base\n * URL, its auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Instagram publishing has no sandbox. Publishing creates a real post on a\n * real professional account, and an unpublished container expires after 24\n * hours.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { instagramBusinessFaker } 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 INSTAGRAM_BUSINESS_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 INSTAGRAM_BUSINESS_REQUIRES = [\n \"accessToken\",\n \"appSecret\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Instagram for Business's auth scheme to an outgoing request.\n *\n * Meta documents the token as a query parameter. appsecret_proof travels\n * beside it so installations requiring App Secret Proof do not reject every\n * call.\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 instagramBusinessAuthorize(\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.accessToken ?? \"\"));\n\n const proof = createHmac(\"sha256\", String(credentials.appSecret ?? \"\"))\n .update(String(credentials.accessToken ?? \"\"))\n .digest(\"hex\");\n\n url.searchParams.set(\"appsecret_proof\", proof);\n request.url = url.toString();\n}\n\n/** The Instagram for Business service, for the TypeScript runtime. */\nexport const INSTAGRAM_BUSINESS: ServiceDescriptor = {\n service: \"instagram_business\",\n title: \"Instagram for Business\",\n sandbox: \"none\",\n baseUrls: { ...INSTAGRAM_BUSINESS_BASE_URLS },\n requires: [...INSTAGRAM_BUSINESS_REQUIRES],\n authorize: instagramBusinessAuthorize,\n faker: instagramBusinessFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/media-container-create.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/media-container-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- instagram_business\n */\n\n/**\n * Create an Instagram image container. This reports success before any post\n * exists: pass its id to Publish Instagram media, or the unpublished container\n * expires after 24 hours without producing a post.\n *\n * POST /{igUserId}/media —\n * https://developers.facebook.com/docs/instagram-platform/content-publishing/#create-a-container\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 Instagram for Business or\n * calls the faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { INSTAGRAM_BUSINESS } from \"../service.js\";\n\nexport const MEDIA_CONTAINER_CREATE_OPERATION = \"media_container_create\";\n\nexport type MediaContainerCreateOptions = {\n /** The node's resolved config. Keys: igUserId, imageUrl, caption. */\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 instagramBusinessMediaContainerCreate(options: MediaContainerCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.igUserId === undefined || config.igUserId === null || config.igUserId === \"\") {\n throw new Error(`media_container_create: \"igUserId\" is required (Instagram user ID).`);\n }\n\n if (config.imageUrl === undefined || config.imageUrl === null || config.imageUrl === \"\") {\n throw new Error(`media_container_create: \"imageUrl\" is required (Image URL).`);\n }\n\n return callConnector(INSTAGRAM_BUSINESS, {\n operation: MEDIA_CONTAINER_CREATE_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: \"POST\",\n path: `/${encodeURIComponent(String(config.igUserId))}/media`,\n json: {\n \"image_url\": String(config.imageUrl),\n ...(config.caption !== undefined && config.caption !== null && config.caption !== \"\" ? { \"caption\": String(config.caption) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/media-publish.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/media-publish.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- instagram_business\n */\n\n/**\n * Publish a previously created Instagram media container as a real post.\n *\n * POST /{igUserId}/media_publish —\n * https://developers.facebook.com/docs/instagram-platform/content-publishing/#publish-the-container\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 Instagram for Business or\n * calls the faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { INSTAGRAM_BUSINESS } from \"../service.js\";\n\nexport const MEDIA_PUBLISH_OPERATION = \"media_publish\";\n\nexport type MediaPublishOptions = {\n /** The node's resolved config. Keys: igUserId, creationId. */\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 instagramBusinessMediaPublish(options: MediaPublishOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.igUserId === undefined || config.igUserId === null || config.igUserId === \"\") {\n throw new Error(`media_publish: \"igUserId\" is required (Instagram user ID).`);\n }\n\n if (config.creationId === undefined || config.creationId === null || config.creationId === \"\") {\n throw new Error(`media_publish: \"creationId\" is required (Creation ID).`);\n }\n\n return callConnector(INSTAGRAM_BUSINESS, {\n operation: MEDIA_PUBLISH_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: \"POST\",\n path: `/${encodeURIComponent(String(config.igUserId))}/media_publish`,\n json: {\n \"creation_id\": String(config.creationId),\n },\n },\n });\n}\n"]}
@@ -0,0 +1,159 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } 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 -- instagram_business
12
+ */
13
+ /**
14
+ * Instagram for Business, as one service descriptor shared by every Instagram
15
+ * for Business operation.
16
+ *
17
+ * @particle-academy/fancy-connector-core carries what is true of ALL
18
+ * connectors. This carries what is true of Instagram for Business: its base
19
+ * URL, its auth scheme, its idempotency header, and its faker.
20
+ *
21
+ * ## The sandbox trap, written down where it is used
22
+ *
23
+ * Instagram publishing has no sandbox. Publishing creates a real post on a
24
+ * real professional account, and an unpublished container expires after 24
25
+ * hours.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect, after which the copy agrees with itself
33
+ * forever.
34
+ */
35
+ declare const CONNECTOR_API_VERSION = 1;
36
+ declare const INSTAGRAM_BUSINESS_BASE_URLS: {
37
+ readonly live: "https://graph.facebook.com/v25.0";
38
+ };
39
+ /** Credential keys a remote call cannot proceed without. */
40
+ declare const INSTAGRAM_BUSINESS_REQUIRES: readonly ["accessToken", "appSecret", "clientId", "clientSecret"];
41
+ /**
42
+ * Apply Instagram for Business's auth scheme to an outgoing request.
43
+ *
44
+ * Meta documents the token as a query parameter. appsecret_proof travels
45
+ * beside it so installations requiring App Secret Proof do not reject every
46
+ * call.
47
+ *
48
+ * The mode is passed in because for some providers auth and estate are the
49
+ * same decision expressed in the URL; here it is unused, and saying so is
50
+ * cheaper than wondering later whether it was forgotten.
51
+ */
52
+ declare function instagramBusinessAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
53
+ /** The Instagram for Business service, for the TypeScript runtime. */
54
+ declare const INSTAGRAM_BUSINESS: ServiceDescriptor;
55
+
56
+ /**
57
+ * GENERATED FILE — do not edit.
58
+ *
59
+ * Emitted from provider/fixtures/ by weaver's generator.
60
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
61
+ * being rejected, because it works until it silently does not. Fix
62
+ * provider/fixtures/ (or weaver's template/) and regenerate:
63
+ *
64
+ * npm run provider -- instagram_business
65
+ */
66
+ /**
67
+ * The Instagram for Business faker.
68
+ *
69
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
70
+ * NAMES Instagram for Business actually publishes, so an author can wire {{
71
+ * $json.data.id }} against a fake and have it keep working against the real
72
+ * thing.
73
+ *
74
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
75
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
76
+ * throw", which is the assertion that catches nothing.
77
+ */
78
+
79
+ declare const instagramBusinessFaker: ConnectorFaker;
80
+
81
+ /**
82
+ * GENERATED FILE — do not edit.
83
+ *
84
+ * Emitted from provider/actions/media-container-create.json by weaver's generator.
85
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
86
+ * being rejected, because it works until it silently does not. Fix
87
+ * provider/actions/media-container-create.json (or weaver's template/) and regenerate:
88
+ *
89
+ * npm run provider -- instagram_business
90
+ */
91
+ /**
92
+ * Create an Instagram image container. This reports success before any post
93
+ * exists: pass its id to Publish Instagram media, or the unpublished container
94
+ * expires after 24 hours without producing a post.
95
+ *
96
+ * POST /{igUserId}/media —
97
+ * https://developers.facebook.com/docs/instagram-platform/content-publishing/#create-a-container
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 Instagram for Business or
102
+ * calls the faker.
103
+ *
104
+ * sideEffects: unsafe-to-replay.
105
+ */
106
+
107
+ declare const MEDIA_CONTAINER_CREATE_OPERATION = "media_container_create";
108
+ type MediaContainerCreateOptions = {
109
+ /** The node's resolved config. Keys: igUserId, imageUrl, caption. */
110
+ config: Record<string, unknown>;
111
+ credentials?: Record<string, string | undefined>;
112
+ mode?: RequestedMode;
113
+ connectionId?: string | null;
114
+ input?: unknown;
115
+ attempts?: number;
116
+ /** Override the transport. The only way to exercise this without a network. */
117
+ transport?: Transport;
118
+ };
119
+ declare function instagramBusinessMediaContainerCreate(options: MediaContainerCreateOptions): Promise<ConnectorResult>;
120
+
121
+ /**
122
+ * GENERATED FILE — do not edit.
123
+ *
124
+ * Emitted from provider/actions/media-publish.json by weaver's generator.
125
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
126
+ * being rejected, because it works until it silently does not. Fix
127
+ * provider/actions/media-publish.json (or weaver's template/) and regenerate:
128
+ *
129
+ * npm run provider -- instagram_business
130
+ */
131
+ /**
132
+ * Publish a previously created Instagram media container as a real post.
133
+ *
134
+ * POST /{igUserId}/media_publish —
135
+ * https://developers.facebook.com/docs/instagram-platform/content-publishing/#publish-the-container
136
+ *
137
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
138
+ * no fake/real branch. This describes the request; callConnector resolves the
139
+ * connection, picks the estate, and either calls Instagram for Business or
140
+ * calls the faker.
141
+ *
142
+ * sideEffects: unsafe-to-replay.
143
+ */
144
+
145
+ declare const MEDIA_PUBLISH_OPERATION = "media_publish";
146
+ type MediaPublishOptions = {
147
+ /** The node's resolved config. Keys: igUserId, creationId. */
148
+ config: Record<string, unknown>;
149
+ credentials?: Record<string, string | undefined>;
150
+ mode?: RequestedMode;
151
+ connectionId?: string | null;
152
+ input?: unknown;
153
+ attempts?: number;
154
+ /** Override the transport. The only way to exercise this without a network. */
155
+ transport?: Transport;
156
+ };
157
+ declare function instagramBusinessMediaPublish(options: MediaPublishOptions): Promise<ConnectorResult>;
158
+
159
+ export { CONNECTOR_API_VERSION, INSTAGRAM_BUSINESS, INSTAGRAM_BUSINESS_BASE_URLS, INSTAGRAM_BUSINESS_REQUIRES, MEDIA_CONTAINER_CREATE_OPERATION, MEDIA_PUBLISH_OPERATION, type MediaContainerCreateOptions, type MediaPublishOptions, instagramBusinessAuthorize, instagramBusinessFaker, instagramBusinessMediaContainerCreate, instagramBusinessMediaPublish };
@@ -0,0 +1,159 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } 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 -- instagram_business
12
+ */
13
+ /**
14
+ * Instagram for Business, as one service descriptor shared by every Instagram
15
+ * for Business operation.
16
+ *
17
+ * @particle-academy/fancy-connector-core carries what is true of ALL
18
+ * connectors. This carries what is true of Instagram for Business: its base
19
+ * URL, its auth scheme, its idempotency header, and its faker.
20
+ *
21
+ * ## The sandbox trap, written down where it is used
22
+ *
23
+ * Instagram publishing has no sandbox. Publishing creates a real post on a
24
+ * real professional account, and an unpublished container expires after 24
25
+ * hours.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect, after which the copy agrees with itself
33
+ * forever.
34
+ */
35
+ declare const CONNECTOR_API_VERSION = 1;
36
+ declare const INSTAGRAM_BUSINESS_BASE_URLS: {
37
+ readonly live: "https://graph.facebook.com/v25.0";
38
+ };
39
+ /** Credential keys a remote call cannot proceed without. */
40
+ declare const INSTAGRAM_BUSINESS_REQUIRES: readonly ["accessToken", "appSecret", "clientId", "clientSecret"];
41
+ /**
42
+ * Apply Instagram for Business's auth scheme to an outgoing request.
43
+ *
44
+ * Meta documents the token as a query parameter. appsecret_proof travels
45
+ * beside it so installations requiring App Secret Proof do not reject every
46
+ * call.
47
+ *
48
+ * The mode is passed in because for some providers auth and estate are the
49
+ * same decision expressed in the URL; here it is unused, and saying so is
50
+ * cheaper than wondering later whether it was forgotten.
51
+ */
52
+ declare function instagramBusinessAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
53
+ /** The Instagram for Business service, for the TypeScript runtime. */
54
+ declare const INSTAGRAM_BUSINESS: ServiceDescriptor;
55
+
56
+ /**
57
+ * GENERATED FILE — do not edit.
58
+ *
59
+ * Emitted from provider/fixtures/ by weaver's generator.
60
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
61
+ * being rejected, because it works until it silently does not. Fix
62
+ * provider/fixtures/ (or weaver's template/) and regenerate:
63
+ *
64
+ * npm run provider -- instagram_business
65
+ */
66
+ /**
67
+ * The Instagram for Business faker.
68
+ *
69
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
70
+ * NAMES Instagram for Business actually publishes, so an author can wire {{
71
+ * $json.data.id }} against a fake and have it keep working against the real
72
+ * thing.
73
+ *
74
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
75
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
76
+ * throw", which is the assertion that catches nothing.
77
+ */
78
+
79
+ declare const instagramBusinessFaker: ConnectorFaker;
80
+
81
+ /**
82
+ * GENERATED FILE — do not edit.
83
+ *
84
+ * Emitted from provider/actions/media-container-create.json by weaver's generator.
85
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
86
+ * being rejected, because it works until it silently does not. Fix
87
+ * provider/actions/media-container-create.json (or weaver's template/) and regenerate:
88
+ *
89
+ * npm run provider -- instagram_business
90
+ */
91
+ /**
92
+ * Create an Instagram image container. This reports success before any post
93
+ * exists: pass its id to Publish Instagram media, or the unpublished container
94
+ * expires after 24 hours without producing a post.
95
+ *
96
+ * POST /{igUserId}/media —
97
+ * https://developers.facebook.com/docs/instagram-platform/content-publishing/#create-a-container
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 Instagram for Business or
102
+ * calls the faker.
103
+ *
104
+ * sideEffects: unsafe-to-replay.
105
+ */
106
+
107
+ declare const MEDIA_CONTAINER_CREATE_OPERATION = "media_container_create";
108
+ type MediaContainerCreateOptions = {
109
+ /** The node's resolved config. Keys: igUserId, imageUrl, caption. */
110
+ config: Record<string, unknown>;
111
+ credentials?: Record<string, string | undefined>;
112
+ mode?: RequestedMode;
113
+ connectionId?: string | null;
114
+ input?: unknown;
115
+ attempts?: number;
116
+ /** Override the transport. The only way to exercise this without a network. */
117
+ transport?: Transport;
118
+ };
119
+ declare function instagramBusinessMediaContainerCreate(options: MediaContainerCreateOptions): Promise<ConnectorResult>;
120
+
121
+ /**
122
+ * GENERATED FILE — do not edit.
123
+ *
124
+ * Emitted from provider/actions/media-publish.json by weaver's generator.
125
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
126
+ * being rejected, because it works until it silently does not. Fix
127
+ * provider/actions/media-publish.json (or weaver's template/) and regenerate:
128
+ *
129
+ * npm run provider -- instagram_business
130
+ */
131
+ /**
132
+ * Publish a previously created Instagram media container as a real post.
133
+ *
134
+ * POST /{igUserId}/media_publish —
135
+ * https://developers.facebook.com/docs/instagram-platform/content-publishing/#publish-the-container
136
+ *
137
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
138
+ * no fake/real branch. This describes the request; callConnector resolves the
139
+ * connection, picks the estate, and either calls Instagram for Business or
140
+ * calls the faker.
141
+ *
142
+ * sideEffects: unsafe-to-replay.
143
+ */
144
+
145
+ declare const MEDIA_PUBLISH_OPERATION = "media_publish";
146
+ type MediaPublishOptions = {
147
+ /** The node's resolved config. Keys: igUserId, creationId. */
148
+ config: Record<string, unknown>;
149
+ credentials?: Record<string, string | undefined>;
150
+ mode?: RequestedMode;
151
+ connectionId?: string | null;
152
+ input?: unknown;
153
+ attempts?: number;
154
+ /** Override the transport. The only way to exercise this without a network. */
155
+ transport?: Transport;
156
+ };
157
+ declare function instagramBusinessMediaPublish(options: MediaPublishOptions): Promise<ConnectorResult>;
158
+
159
+ export { CONNECTOR_API_VERSION, INSTAGRAM_BUSINESS, INSTAGRAM_BUSINESS_BASE_URLS, INSTAGRAM_BUSINESS_REQUIRES, MEDIA_CONTAINER_CREATE_OPERATION, MEDIA_PUBLISH_OPERATION, type MediaContainerCreateOptions, type MediaPublishOptions, instagramBusinessAuthorize, instagramBusinessFaker, instagramBusinessMediaContainerCreate, instagramBusinessMediaPublish };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { CONNECTOR_API_VERSION, INSTAGRAM_BUSINESS, INSTAGRAM_BUSINESS_BASE_URLS, INSTAGRAM_BUSINESS_REQUIRES, MEDIA_CONTAINER_CREATE_OPERATION, MEDIA_PUBLISH_OPERATION, instagramBusinessAuthorize, instagramBusinessFaker, instagramBusinessMediaContainerCreate, instagramBusinessMediaPublish } from './chunk-Z43FUIPD.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@particle-academy/instagram-business-js",
3
+ "version": "0.1.0",
4
+ "description": "Instagram for Business for Node — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP on @particle-academy/fancy-connector-core; no vendor SDK.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Fancy-Friends/instagram-business.git"
8
+ },
9
+ "homepage": "https://github.com/Fancy-Friends/instagram-business#readme",
10
+ "bugs": "https://github.com/Fancy-Friends/instagram-business/issues",
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "./flow": {
27
+ "import": {
28
+ "types": "./dist/flow.d.ts",
29
+ "default": "./dist/flow.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/flow.d.cts",
33
+ "default": "./dist/flow.cjs"
34
+ }
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md",
41
+ "CHANGELOG.md",
42
+ "LICENSE"
43
+ ],
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "lint": "tsc --noEmit",
47
+ "test": "node --import tsx --test tests/*.test.ts",
48
+ "prepublishOnly": "tsup"
49
+ },
50
+ "dependencies": {
51
+ "@particle-academy/fancy-connector-core": ">=0.3.1 <2.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
55
+ "@particle-academy/instagram-business-ui": ">=0.1.0 <0.2.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "@particle-academy/fancy-flow": {
59
+ "optional": true
60
+ },
61
+ "@particle-academy/instagram-business-ui": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
67
+ "@types/node": "^26.2.0",
68
+ "tsup": "^8.5.0",
69
+ "tsx": "^4.19.0",
70
+ "typescript": "^5.8.0"
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "keywords": [
76
+ "instagram_business",
77
+ "marketing",
78
+ "connector",
79
+ "api",
80
+ "fancy-ui",
81
+ "particle-academy"
82
+ ],
83
+ "license": "MIT",
84
+ "sideEffects": false,
85
+ "engines": {
86
+ "node": ">=22"
87
+ }
88
+ }