@startsimpli/integrations 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/package.json +18 -9
- package/src/__tests__/connections.test.tsx +453 -0
- package/src/components/CredentialSchemaForm.tsx +196 -0
- package/src/components/index.ts +20 -0
- package/src/components/pages/ConnectionsPage.tsx +610 -0
- package/src/components/pages/types.ts +197 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The STRUCTURAL contract `ConnectionsPage` is handed.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately re-declared here rather than imported from `@startsimpli/api`:
|
|
5
|
+
* the composer takes an *injected* api the same way `TeamSettingsPage` does, so
|
|
6
|
+
* it must depend on a SHAPE, not on a client. A test hands it an object
|
|
7
|
+
* literal; an app hands it `apiClient.foundry`, whose method names are these on
|
|
8
|
+
* purpose. Neither one needs a React context or an app-local provider.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface ConnectorFieldSpec {
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* The server's own vocabulary — `text`, `url`, `select`, `secret`, ... A type
|
|
16
|
+
* this build has never heard of degrades to a text input rather than blanking
|
|
17
|
+
* the form: the catalog is DATA and will outrun the deployed bundle.
|
|
18
|
+
*/
|
|
19
|
+
type?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Server-enforced companion of `type: "secret"` — a connector cannot override
|
|
22
|
+
* it. Either one masks the field; `secret` is accepted too for callers that
|
|
23
|
+
* hand-build a schema.
|
|
24
|
+
*/
|
|
25
|
+
write_only?: boolean;
|
|
26
|
+
secret?: boolean;
|
|
27
|
+
mask?: string;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
help?: string;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
options?: Array<{ value: string; label: string }> | null;
|
|
32
|
+
default?: string | null;
|
|
33
|
+
pattern?: string | null;
|
|
34
|
+
docs_url?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A schema as the catalog SHIPS it: `{version, fields[]}`, array order = render
|
|
39
|
+
* order. Accepting a bare array too is not sloppiness — a caller composing a
|
|
40
|
+
* schema by hand should not have to know the envelope, and the envelope is
|
|
41
|
+
* exactly the thing that may gain a version this build does not recognise.
|
|
42
|
+
*/
|
|
43
|
+
export interface ConnectorSchema {
|
|
44
|
+
version?: number;
|
|
45
|
+
fields?: ConnectorFieldSpec[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ConnectorSchemaLike = ConnectorSchema | ConnectorFieldSpec[] | null | undefined;
|
|
49
|
+
|
|
50
|
+
export interface ConnectorCatalogEntry {
|
|
51
|
+
key: string;
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
logo_url: string;
|
|
55
|
+
docs_url: string;
|
|
56
|
+
capabilities: string[];
|
|
57
|
+
auth_mode: string;
|
|
58
|
+
credential_schema: ConnectorSchemaLike;
|
|
59
|
+
config_schema: ConnectorSchemaLike;
|
|
60
|
+
record_types: string[];
|
|
61
|
+
supports_webhooks: boolean;
|
|
62
|
+
/** A row whose class will not import says so here rather than vanishing. */
|
|
63
|
+
availability: { available: boolean; reason: string };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type ConnectionStatus = 'connected' | 'needs_reauth' | 'error' | 'disabled';
|
|
67
|
+
|
|
68
|
+
export interface Connection {
|
|
69
|
+
id: string;
|
|
70
|
+
public_id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
connector_key: string;
|
|
73
|
+
connector_name: string;
|
|
74
|
+
external_account_id: string;
|
|
75
|
+
account_label: string;
|
|
76
|
+
capabilities_enabled: string[];
|
|
77
|
+
config: Record<string, unknown>;
|
|
78
|
+
status: ConnectionStatus;
|
|
79
|
+
health: string;
|
|
80
|
+
auth_mode: string;
|
|
81
|
+
check_error?: string;
|
|
82
|
+
last_checked_at?: string | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** What to RENDER, never what to allow. The server refuses on its own. */
|
|
86
|
+
export interface ConnectionPermissions {
|
|
87
|
+
view: boolean;
|
|
88
|
+
manage: boolean;
|
|
89
|
+
issue_tokens: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface ConnectionChoice {
|
|
93
|
+
id: string;
|
|
94
|
+
label: string;
|
|
95
|
+
kind: string;
|
|
96
|
+
selectable: boolean;
|
|
97
|
+
reason: string;
|
|
98
|
+
remediation: string;
|
|
99
|
+
hidden_by_default: boolean;
|
|
100
|
+
detail: Record<string, unknown>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface ConnectionChoicePage {
|
|
104
|
+
results: ConnectionChoice[];
|
|
105
|
+
kind: string;
|
|
106
|
+
cursor: string | null;
|
|
107
|
+
has_more: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ConnectionTarget {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
provider_key: string;
|
|
114
|
+
entity_type: string;
|
|
115
|
+
is_active: boolean;
|
|
116
|
+
destination_config: Record<string, unknown>;
|
|
117
|
+
verified: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface ConnectorAction {
|
|
121
|
+
name: string;
|
|
122
|
+
label: string;
|
|
123
|
+
input_schema: Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface ConnectionInvokeResult {
|
|
127
|
+
ok: boolean;
|
|
128
|
+
action: string;
|
|
129
|
+
destination_id: string;
|
|
130
|
+
run_id: string;
|
|
131
|
+
run_status: string;
|
|
132
|
+
external_ref: string | null;
|
|
133
|
+
output: Record<string, unknown>;
|
|
134
|
+
error: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface ConnectionRun {
|
|
138
|
+
id: string;
|
|
139
|
+
kind: string;
|
|
140
|
+
object_id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
status: string;
|
|
143
|
+
run_type: string;
|
|
144
|
+
occurred_at: string;
|
|
145
|
+
error_message: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface ConnectionsApi {
|
|
149
|
+
connectorCatalog(slug: string): Promise<{ results: ConnectorCatalogEntry[] }>;
|
|
150
|
+
connections(slug: string): Promise<{
|
|
151
|
+
results: Connection[];
|
|
152
|
+
permissions: ConnectionPermissions;
|
|
153
|
+
}>;
|
|
154
|
+
connect(slug: string, input: {
|
|
155
|
+
connector_key: string;
|
|
156
|
+
name?: string;
|
|
157
|
+
credentials?: Record<string, unknown>;
|
|
158
|
+
config?: Record<string, unknown>;
|
|
159
|
+
/**
|
|
160
|
+
* WHICH VERBS THIS ACCOUNT IS ALLOWED. Omitting it used to leave the server
|
|
161
|
+
* to write `[]`, which enables nothing at all — a green card that cannot
|
|
162
|
+
* poll, cannot be invoked and cannot receive a webhook (bd
|
|
163
|
+
* startsim-768w.22.22). The composer always sends it now, and the server
|
|
164
|
+
* refuses an empty list rather than storing the inert card.
|
|
165
|
+
*/
|
|
166
|
+
capabilities_enabled?: string[];
|
|
167
|
+
}): Promise<Connection>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Edit a connection in place. The only field this page changes today is
|
|
171
|
+
* `capabilities_enabled`, and it must be changeable AFTER connect: every
|
|
172
|
+
* connection that already exists was written before the connect form asked,
|
|
173
|
+
* so nothing the connect form does can reach them. Turning `poll` on here is
|
|
174
|
+
* what creates the scheduled ingest leg, server-side, in the same request.
|
|
175
|
+
*/
|
|
176
|
+
updateConnection(slug: string, id: string, input: {
|
|
177
|
+
name?: string;
|
|
178
|
+
capabilities_enabled?: string[];
|
|
179
|
+
config?: Record<string, unknown>;
|
|
180
|
+
}): Promise<Connection>;
|
|
181
|
+
checkConnection(slug: string, id: string): Promise<{
|
|
182
|
+
ok: boolean; account_label: string; detail: string;
|
|
183
|
+
}>;
|
|
184
|
+
disconnect(slug: string, id: string): Promise<void>;
|
|
185
|
+
connectionChoices(slug: string, id: string, params?: {
|
|
186
|
+
kind?: string; cursor?: string;
|
|
187
|
+
}): Promise<ConnectionChoicePage>;
|
|
188
|
+
wireTarget(slug: string, id: string, input: {
|
|
189
|
+
choice_id: string; name?: string; options?: Record<string, unknown>;
|
|
190
|
+
}): Promise<ConnectionTarget>;
|
|
191
|
+
confirmTarget(slug: string, id: string, destinationId: string): Promise<ConnectionTarget>;
|
|
192
|
+
connectionActions(slug: string, id: string): Promise<{ results: ConnectorAction[] }>;
|
|
193
|
+
invokeConnectionAction(slug: string, id: string, action: string, input: {
|
|
194
|
+
destination_id: string; record_type?: string; records?: unknown[];
|
|
195
|
+
}): Promise<ConnectionInvokeResult>;
|
|
196
|
+
connectionRuns(slug: string, id: string): Promise<{ results: ConnectionRun[] }>;
|
|
197
|
+
}
|