@startsimpli/integrations 0.1.0 → 0.1.3
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 +338 -0
- package/src/components/CredentialSchemaForm.tsx +196 -0
- package/src/components/index.ts +20 -0
- package/src/components/pages/ConnectionsPage.tsx +426 -0
- package/src/components/pages/types.ts +176 -0
|
@@ -0,0 +1,176 @@
|
|
|
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
|
+
}): Promise<Connection>;
|
|
160
|
+
checkConnection(slug: string, id: string): Promise<{
|
|
161
|
+
ok: boolean; account_label: string; detail: string;
|
|
162
|
+
}>;
|
|
163
|
+
disconnect(slug: string, id: string): Promise<void>;
|
|
164
|
+
connectionChoices(slug: string, id: string, params?: {
|
|
165
|
+
kind?: string; cursor?: string;
|
|
166
|
+
}): Promise<ConnectionChoicePage>;
|
|
167
|
+
wireTarget(slug: string, id: string, input: {
|
|
168
|
+
choice_id: string; name?: string; options?: Record<string, unknown>;
|
|
169
|
+
}): Promise<ConnectionTarget>;
|
|
170
|
+
confirmTarget(slug: string, id: string, destinationId: string): Promise<ConnectionTarget>;
|
|
171
|
+
connectionActions(slug: string, id: string): Promise<{ results: ConnectorAction[] }>;
|
|
172
|
+
invokeConnectionAction(slug: string, id: string, action: string, input: {
|
|
173
|
+
destination_id: string; record_type?: string; records?: unknown[];
|
|
174
|
+
}): Promise<ConnectionInvokeResult>;
|
|
175
|
+
connectionRuns(slug: string, id: string): Promise<{ results: ConnectionRun[] }>;
|
|
176
|
+
}
|