flowflex 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.
@@ -0,0 +1,66 @@
1
+ /** Options accepted by the `FlowFlex` constructor. */
2
+ export interface FlowFlexOptions {
3
+ /** Custom integration API key — starts with `cik_`. */
4
+ apiKey: string;
5
+ /** Custom integration API secret. */
6
+ apiSecret: string;
7
+ /**
8
+ * Integration code — the opaque public identifier in your event URL
9
+ * (`/v1/events/<code>`). Shown on the integration's detail page.
10
+ */
11
+ integrationCode: string;
12
+ /**
13
+ * FlowFlex host, e.g. `https://app.flowflex.com`. Do NOT include `/api`
14
+ * or `/v1` — the SDK appends the correct paths.
15
+ */
16
+ baseUrl: string;
17
+ /** Per-request timeout in milliseconds. Default: 30000. */
18
+ timeoutMs?: number;
19
+ /**
20
+ * Custom fetch implementation. Defaults to the global `fetch`
21
+ * (Node 18+ and all modern browsers). Provide one for older runtimes.
22
+ */
23
+ fetch?: typeof fetch;
24
+ /**
25
+ * Max attachment size in bytes the SDK will accept before uploading.
26
+ * Defaults to 25 MB (the backend's limit). Files larger than this fail fast
27
+ * client-side instead of after a full upload.
28
+ */
29
+ maxFileBytes?: number;
30
+ }
31
+ /** Response from the presigned upload-URL endpoint. */
32
+ export interface UploadUrlResponse {
33
+ assetId: string;
34
+ uploadUrl: string;
35
+ token: string;
36
+ }
37
+ /** Options for a single file attachment. */
38
+ export interface FileOptions {
39
+ /**
40
+ * Filename stored alongside the asset and used as the WhatsApp document
41
+ * filename. Required when the source is a Buffer/Blob with no inherent name.
42
+ */
43
+ filename?: string;
44
+ /**
45
+ * MIME type, e.g. `application/pdf`. Required when it cannot be inferred
46
+ * from the filename extension.
47
+ */
48
+ mime?: string;
49
+ /** Optional size in bytes — sent for server-side validation only. */
50
+ size?: number;
51
+ }
52
+ /** Options for `sendEvent`. */
53
+ export interface SendEventOptions {
54
+ /**
55
+ * Idempotency key — dedupes retries on the backend. A random UUID is
56
+ * generated if omitted.
57
+ */
58
+ idempotencyKey?: string;
59
+ }
60
+ /** Result returned by `sendEvent`. */
61
+ export interface SendEventResult {
62
+ /** Raw response body from the events endpoint. */
63
+ response: unknown;
64
+ /** Map of payload paths → assetId, for every file that was uploaded. */
65
+ uploadedAssets: Record<string, string>;
66
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "flowflex",
3
+ "version": "0.1.0",
4
+ "description": "Official FlowFlex SDK — fire custom-integration events and attach private files without handling presigned URLs yourself.",
5
+ "license": "UNLICENSED",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "browser": {
13
+ "import": "./dist/esm/browser.js",
14
+ "require": "./dist/browser.js"
15
+ },
16
+ "import": "./dist/esm/index.js",
17
+ "require": "./dist/index.js"
18
+ }
19
+ },
20
+ "browser": {
21
+ "./dist/index.js": "./dist/browser.js",
22
+ "./dist/esm/index.js": "./dist/esm/browser.js"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig.esm.json && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}')\"",
30
+ "clean": "rm -rf dist",
31
+ "prepublishOnly": "npm run clean && npm run build"
32
+ },
33
+ "engines": {
34
+ "node": ">=18"
35
+ },
36
+ "keywords": [
37
+ "flowflex",
38
+ "whatsapp",
39
+ "automation",
40
+ "flows",
41
+ "sdk"
42
+ ],
43
+ "devDependencies": {
44
+ "typescript": "^5.4.0",
45
+ "@types/node": "^20.0.0"
46
+ }
47
+ }