viasocket-apps 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,94 @@
1
+ /**
2
+ * Public types. Everything the API returns in snake_case is mapped to camelCase here, so the
3
+ * shape a caller sees is the shape a JavaScript codebase expects — and so that if a field is
4
+ * ever renamed upstream, it is renamed in one place.
5
+ */
6
+ export interface ViaSocketOptions {
7
+ /** Your organisation id, from the Install Code page. */
8
+ orgId: string;
9
+ /** The Apps API project id, from the Install Code page. */
10
+ projectId: string;
11
+ /**
12
+ * Your org's signing secret. Server-side only: anyone holding it can act as any of your
13
+ * users. Read it from an environment variable, never from a bundle.
14
+ */
15
+ secret: string;
16
+ /** Defaults to https://flow-api.viasocket.com. Override for a different environment. */
17
+ apiBaseUrl?: string;
18
+ /** Where actions run. Defaults to https://flow.sokt.io. */
19
+ runBaseUrl?: string;
20
+ /** Swap the transport — for tests, retries, or a runtime without a global fetch. */
21
+ fetch?: typeof fetch;
22
+ }
23
+ /** One choice a field accepts. Show the label; put the value in inputData. */
24
+ export interface Option {
25
+ label: string;
26
+ value: string;
27
+ }
28
+ export interface ListOptionsResult {
29
+ options: Option[];
30
+ /** Cursor for the next page on fields that paginate; null when there is no more. */
31
+ offset: string | null;
32
+ }
33
+ export interface ListOptionsParams {
34
+ /** The field you want choices for, exactly as it appears in the action's inputData. */
35
+ fieldKey: string;
36
+ /** The connection to read through. */
37
+ authId: string;
38
+ /**
39
+ * Everything the user has already chosen. Fields this one depends on must be present, or
40
+ * the list comes back empty.
41
+ */
42
+ existingFields?: Record<string, unknown>;
43
+ }
44
+ export interface EnableResult {
45
+ /** Your run URL for this app and this connection. A credential — keep it server-side. */
46
+ scriptId: string;
47
+ webhookUrl: string;
48
+ serviceId: string;
49
+ authId: string;
50
+ }
51
+ export interface SubscribeParams {
52
+ authId: string;
53
+ /** The event's own configuration — which channel, which sheet. */
54
+ inputData: Record<string, unknown>;
55
+ /** Your endpoint. We POST every event to it. Use this or `code`, not both. */
56
+ webhook?: string;
57
+ /** JavaScript run on each event instead of a webhook. */
58
+ code?: string;
59
+ /** Anything of yours; handed back with every delivery. */
60
+ meta?: Record<string, unknown>;
61
+ }
62
+ export interface SubscribeResult {
63
+ /** The subscription. Keep it — changing or ending the subscription needs it. */
64
+ scriptId: string;
65
+ /** The hook we registered on the app's side. */
66
+ hookUrl: string;
67
+ title: string;
68
+ authId: string;
69
+ inputData: Record<string, unknown>;
70
+ meta: Record<string, unknown>;
71
+ }
72
+ export interface UpdateSubscriptionParams {
73
+ code?: string;
74
+ meta?: Record<string, unknown>;
75
+ }
76
+ /** One flow of an end user: an enabled app, or a trigger subscription. */
77
+ export interface Flow {
78
+ /** The script_id. */
79
+ id: string;
80
+ title: string;
81
+ status: string;
82
+ webhook: string;
83
+ description: string;
84
+ authId: string;
85
+ serviceId: string;
86
+ }
87
+ export type FlowStatus = 0 | 1;
88
+ /** The envelope every viaSocket endpoint answers with. */
89
+ export interface Envelope<T = unknown> {
90
+ success: boolean;
91
+ message?: string;
92
+ data: T;
93
+ isCached?: boolean;
94
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Public types. Everything the API returns in snake_case is mapped to camelCase here, so the
3
+ * shape a caller sees is the shape a JavaScript codebase expects — and so that if a field is
4
+ * ever renamed upstream, it is renamed in one place.
5
+ */
6
+ export {};
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "viasocket-apps",
3
+ "version": "0.1.0",
4
+ "description": "Server-side client for the viaSocket Apps API: let your users connect Slack, GitHub, Google Sheets or any of 2,300+ apps from your own product, then run actions and receive events through one API.",
5
+ "keywords": ["viasocket", "integrations", "oauth", "api", "webhooks", "slack", "github", "google-sheets"],
6
+ "license": "MIT",
7
+ "author": "Walkover Web Solution",
8
+ "homepage": "https://github.com/Walkover-Web-Solution/viasocket-apps#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Walkover-Web-Solution/viasocket-apps.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Walkover-Web-Solution/viasocket-apps/issues"
15
+ },
16
+ "engines": {
17
+ "node": ">=20"
18
+ },
19
+ "main": "./dist/cjs/index.js",
20
+ "module": "./dist/esm/index.js",
21
+ "types": "./dist/esm/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/esm/index.d.ts",
25
+ "import": "./dist/esm/index.js",
26
+ "require": "./dist/cjs/index.js"
27
+ },
28
+ "./browser": {
29
+ "types": "./dist/esm/browser.d.ts",
30
+ "import": "./dist/esm/browser.js",
31
+ "require": "./dist/cjs/browser.js"
32
+ }
33
+ },
34
+ "files": ["dist", "README.md"],
35
+ "sideEffects": false,
36
+ "scripts": {
37
+ "build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/finish-build.mjs",
38
+ "test": "npm run build && node --test test/token.test.mjs test/client.test.mjs",
39
+ "prepublishOnly": "npm test"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^5.6.0"
43
+ }
44
+ }