@alvera-ai/platform-sdk 0.10.0-rc.2 → 0.10.0-rc.21
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/.agent/AGENTS.md +440 -0
- package/.agent/account_management.md +455 -0
- package/.agent/action_status_updaters.md +262 -0
- package/.agent/ai_agents.md +423 -0
- package/.agent/ai_sandbox.md +265 -0
- package/.agent/async.md +111 -0
- package/.agent/connected_apps.md +407 -0
- package/.agent/cookbook/_fixtures/README.md +99 -0
- package/.agent/cookbook/_fixtures/accounts_receivable/_customers_accounts_receivable_customer.liquid +32 -0
- package/.agent/cookbook/_fixtures/accounts_receivable/_customers_accounts_receivable_mdm.liquid +20 -0
- package/.agent/cookbook/_fixtures/foundation/_lead_submissions_foundation_generic_table.liquid +33 -0
- package/.agent/cookbook/_fixtures/foundation/_lead_submissions_foundation_legal_entity.liquid +88 -0
- package/.agent/cookbook/_fixtures/foundation/_lead_submissions_foundation_mdm.liquid +48 -0
- package/.agent/cookbook/_fixtures/healthcare/_cahps_appointments_healthcare_appointment.liquid +47 -0
- package/.agent/cookbook/_fixtures/healthcare/_cahps_appointments_healthcare_mdm.liquid +24 -0
- package/.agent/cookbook/_fixtures/healthcare/_cahps_appointments_healthcare_patient.liquid +38 -0
- package/.agent/cookbook/_fixtures/payment_risk/_compliance_screenings_payment_risk_compliance_screening.liquid +59 -0
- package/.agent/cookbook/_fixtures/payment_risk/_compliance_screenings_payment_risk_mdm.liquid +36 -0
- package/.agent/cookbook/_fixtures/payment_risk/_payment_accounts_payment_risk_mdm.liquid +30 -0
- package/.agent/cookbook/_fixtures/payment_risk/_payment_accounts_payment_risk_payment_account.liquid +55 -0
- package/.agent/cookbook/_setup/accounts_receivable.md +282 -0
- package/.agent/cookbook/_setup/foundation.md +277 -0
- package/.agent/cookbook/_setup/healthcare.md +279 -0
- package/.agent/cookbook/_setup/payment_risk.md +283 -0
- package/.agent/cookbook/appointment-review-sms-workflow.md +761 -0
- package/.agent/cookbook/birthday-greeting-sms-trigger.md +656 -0
- package/.agent/cookbook/contact-us-triage-with-llm.md +603 -0
- package/.agent/cookbook/dunning-sms-for-delinquent.md +619 -0
- package/.agent/cookbook/kyc-notification-on-account-activation.md +619 -0
- package/.agent/cookbook/sanctions-screening-with-agent-review.md +711 -0
- package/.agent/cookbook/score-leads-with-llm-categorization.md +602 -0
- package/.agent/cookbook/welcome-sms-for-customers.md +607 -0
- package/.agent/data_activation_clients.md +557 -0
- package/.agent/data_sources.md +234 -0
- package/.agent/datalakes.md +712 -0
- package/.agent/debugging.md +137 -0
- package/.agent/errors.md +196 -0
- package/.agent/generic_tables.md +351 -0
- package/.agent/interoperability_contracts.md +351 -0
- package/.agent/mdm.md +293 -0
- package/.agent/mutations.md +152 -0
- package/.agent/templates.md +98 -0
- package/.agent/tool-call-configs.md +90 -0
- package/.agent/tools.md +546 -0
- package/.agent/type_naming.md +131 -0
- package/.agent/workflows.md +601 -0
- package/README.md +46 -0
- package/dist/bin/platform-sdk.d.mts +1 -0
- package/dist/bin/platform-sdk.mjs +106 -0
- package/dist/bin/platform-sdk.mjs.map +1 -0
- package/dist/index.d.mts +1200 -43201
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1859 -7319
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -10
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Data Sources
|
|
2
|
+
|
|
3
|
+
A **data source** declares an external system that the platform
|
|
4
|
+
ingests data from — a managed file drop, an upload endpoint,
|
|
5
|
+
a scheduled pull from an external SaaS, and so on. Each data
|
|
6
|
+
source scopes to exactly one datalake. A tenant can own many
|
|
7
|
+
data sources across many datalakes.
|
|
8
|
+
|
|
9
|
+
Data sources are **Platform-DB-resident**: their metadata lives
|
|
10
|
+
in the platform's tenant-wide DB, not in the per-datalake
|
|
11
|
+
schemas. As a consequence, data sources can be created against
|
|
12
|
+
a `new`-status datalake (no migration wait — see `datalakes.md`
|
|
13
|
+
§5 Lifecycle "Platform-DB / Datalake-DB split").
|
|
14
|
+
|
|
15
|
+
SDK namespace: `api.dataSources`.
|
|
16
|
+
|
|
17
|
+
## 1. Wire shape
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type {
|
|
21
|
+
DataSourceRequestWritable,
|
|
22
|
+
DataSourceResponse,
|
|
23
|
+
} from '@alvera-ai/platform-sdk'
|
|
24
|
+
|
|
25
|
+
const body: DataSourceRequestWritable = {
|
|
26
|
+
name: 'Vendor Inbound',
|
|
27
|
+
uri: 'api.vendor.example.com',
|
|
28
|
+
description: 'External vendor billing integration',
|
|
29
|
+
status: 'active',
|
|
30
|
+
is_default: false,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { data: created } = await api.dataSources.create(
|
|
34
|
+
tenantSlug,
|
|
35
|
+
datalakeSlug,
|
|
36
|
+
body,
|
|
37
|
+
)
|
|
38
|
+
// created.id — server-derived UUID
|
|
39
|
+
// created.name === body.name
|
|
40
|
+
// created.uri === body.uri
|
|
41
|
+
// created.datalake — references the parent datalake
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The body is flat — no discriminator. Every data source carries
|
|
45
|
+
the same five caller-supplied fields plus the universal server-
|
|
46
|
+
derived set (`id`, `slug`, `created_at`, `updated_at`).
|
|
47
|
+
|
|
48
|
+
## 2. Rules the type cannot encode
|
|
49
|
+
|
|
50
|
+
### `uri` is a free-form endpoint identifier
|
|
51
|
+
|
|
52
|
+
The `uri` field is typed as `string` but the platform doesn't
|
|
53
|
+
enforce a strict URL grammar. Values observed include hostname
|
|
54
|
+
patterns (`api.stripe.com`, `appLeadCaptureForms.airtable.com`)
|
|
55
|
+
and host-with-port patterns (`12345.athenahealth.com`). The
|
|
56
|
+
field is the agent-facing identifier the platform routes against
|
|
57
|
+
when downstream resources (data activation clients, tools) bind
|
|
58
|
+
to the source; pick a stable, identifiable value the operator
|
|
59
|
+
can recognize.
|
|
60
|
+
|
|
61
|
+
### `is_default` is per-datalake
|
|
62
|
+
|
|
63
|
+
At most one data source per datalake carries `is_default: true`.
|
|
64
|
+
Promoting a new source to default demotes the prior default
|
|
65
|
+
(operator-mediated; the SDK doesn't expose explicit demotion).
|
|
66
|
+
Most SDK consumers ship sources with `is_default: false`.
|
|
67
|
+
|
|
68
|
+
### A default Manual Upload data source is auto-created per datalake
|
|
69
|
+
|
|
70
|
+
When a datalake completes migration, the platform auto-creates
|
|
71
|
+
a data source named `"Alvera Manual Upload - <datalake_name>"`
|
|
72
|
+
with `uri: "<datalake_id>.alvera.ai"` and one bound Manual
|
|
73
|
+
Upload tool. This row carries `is_default: true` and serves as
|
|
74
|
+
the default sink for ad-hoc CSV / JSON uploads.
|
|
75
|
+
|
|
76
|
+
The default row CAN be PUT-updated, but the auto-creation runs
|
|
77
|
+
once at datalake migration. Filter on `is_default` when
|
|
78
|
+
listing for management UIs that should show only consumer-
|
|
79
|
+
created sources.
|
|
80
|
+
|
|
81
|
+
### `status` is an enum
|
|
82
|
+
|
|
83
|
+
The `status` field carries the source's lifecycle state. The
|
|
84
|
+
wire enum has three values: `'draft' | 'active' | 'inactive'`.
|
|
85
|
+
`'active'` is the typical create-time value; `'inactive'`
|
|
86
|
+
short-circuits the source from new ingestion runs without
|
|
87
|
+
removing it; `'draft'` is the unconfigured state, useful for
|
|
88
|
+
multi-step UI flows.
|
|
89
|
+
|
|
90
|
+
## 3. Field ownership
|
|
91
|
+
|
|
92
|
+
**Server-derived (Response-only).** The universal set from
|
|
93
|
+
`type_naming.md`. Data sources add no extras.
|
|
94
|
+
|
|
95
|
+
**Caller-supplied (round-trip).** Present on both
|
|
96
|
+
`DataSourceRequestWritable` and `DataSourceResponse`:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
name required string — agent-facing label
|
|
100
|
+
uri required string — endpoint identifier (free-form)
|
|
101
|
+
description optional string — narrative
|
|
102
|
+
status required enum — lifecycle state
|
|
103
|
+
is_default required bool — at most one true per datalake
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Write-only (Request-only).** None — data sources don't hold
|
|
107
|
+
credentials directly. Credential handling is the consuming
|
|
108
|
+
resource's responsibility (e.g. tools that connect to the
|
|
109
|
+
source carry the authentication; the source itself is just
|
|
110
|
+
a name + uri).
|
|
111
|
+
|
|
112
|
+
The `slug` returned in the Response is the canonical reference
|
|
113
|
+
for downstream scoping. Never pre-compute it client-side — see
|
|
114
|
+
`type_naming.md` "Never pre-compute the slug client-side".
|
|
115
|
+
|
|
116
|
+
## 4. Error envelopes
|
|
117
|
+
|
|
118
|
+
Standard JSON:API envelopes per `errors.md`. Common rejections:
|
|
119
|
+
|
|
120
|
+
| `source.pointer` | Cause |
|
|
121
|
+
|------------------------------------|-------------------------------------------------|
|
|
122
|
+
| `/name` | uniqueness within datalake (name collision) |
|
|
123
|
+
| `/uri` | empty/structurally invalid OR uniqueness within |
|
|
124
|
+
| | datalake (uri collision) |
|
|
125
|
+
| `/status` | value not in the typed enum |
|
|
126
|
+
| `/is_default` | another source already marked default |
|
|
127
|
+
|
|
128
|
+
All of these come back as a 422 `AlveraApiError` thrown from the
|
|
129
|
+
SDK on submit — both structural failures (Layer 1) and semantic
|
|
130
|
+
rejections like uniqueness / is_default conflict (Layer 2). The
|
|
131
|
+
SDK does not validate client-side. See `errors.md`.
|
|
132
|
+
|
|
133
|
+
## 5. Lifecycle
|
|
134
|
+
|
|
135
|
+
Data sources are **Platform-DB-resident** — no async migration,
|
|
136
|
+
no readiness poll. `.create` returns a ready-to-use row.
|
|
137
|
+
|
|
138
|
+
### Create
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
const { data: source } = await api.dataSources.create(
|
|
142
|
+
tenantSlug,
|
|
143
|
+
datalakeSlug,
|
|
144
|
+
body,
|
|
145
|
+
)
|
|
146
|
+
// source is immediately usable as a binding target for tools,
|
|
147
|
+
// data activation clients, etc.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Read shapes
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
.list(tenantSlug, datalakeSlug) Paged list:
|
|
154
|
+
{ data: DataSourceResponse[], meta }
|
|
155
|
+
.get(tenantSlug, datalakeSlug, idOrSlug) One row
|
|
156
|
+
.metadata(tenantSlug, datalakeSlug) Markdown string — catalog
|
|
157
|
+
.metadataDetails(tenantSlug, datalakeSlug, Markdown string — one source
|
|
158
|
+
idOrSlug)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The two `metadata` methods return `string` — agent-facing
|
|
162
|
+
markdown. `metadataDetails` takes the same id/slug as `.get`
|
|
163
|
+
(no composite key like `templates.metadataDetails`).
|
|
164
|
+
|
|
165
|
+
### Update
|
|
166
|
+
|
|
167
|
+
`PUT` replays the full body per `mutations.md`. Data sources
|
|
168
|
+
have no write-only fields, so the simple GET-then-spread
|
|
169
|
+
pattern works (no re-supply needed):
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const { data: current } = await api.dataSources.get(
|
|
173
|
+
tenantSlug, datalakeSlug, sourceId,
|
|
174
|
+
)
|
|
175
|
+
const next = { ...current, description: 'Now updated' }
|
|
176
|
+
const { data: updated } = await api.dataSources.update(
|
|
177
|
+
tenantSlug, datalakeSlug, sourceId, next,
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Delete (operator-only — no SDK surface)
|
|
182
|
+
|
|
183
|
+
There is **no `DELETE` endpoint** for data sources, and
|
|
184
|
+
correspondingly no `api.dataSources.delete(...)` method on the
|
|
185
|
+
typed client. Removal is operator-driven via the platform's
|
|
186
|
+
admin console.
|
|
187
|
+
|
|
188
|
+
For completeness, when an operator does remove a data source
|
|
189
|
+
the platform applies asymmetric cascade behavior by dependent
|
|
190
|
+
resource:
|
|
191
|
+
|
|
192
|
+
- All data activation clients bound via `data_source_id`
|
|
193
|
+
cascade-delete with the source.
|
|
194
|
+
- Workflow actions referencing the data source REJECT the
|
|
195
|
+
delete with a 422 — the operator must detach those actions
|
|
196
|
+
first.
|
|
197
|
+
|
|
198
|
+
The auto-created default Manual Upload source (see §2 "A
|
|
199
|
+
default Manual Upload data source is auto-created per
|
|
200
|
+
datalake") is **not removable** — even operator-driven deletes
|
|
201
|
+
reject it. The default exists for the lifetime of its parent
|
|
202
|
+
datalake.
|
|
203
|
+
|
|
204
|
+
Consumer-side, treat data sources as monotonically-growing
|
|
205
|
+
within a datalake. If your code path conceptually "removes" a
|
|
206
|
+
source (e.g. an integration test cleaning up), the only
|
|
207
|
+
SDK-visible option is to mark it `status: 'inactive'` via PUT —
|
|
208
|
+
the source row stays in the datalake.
|
|
209
|
+
|
|
210
|
+
## 6. Gotchas
|
|
211
|
+
|
|
212
|
+
1. **`.list()` is scoped to one datalake, not the tenant.** A
|
|
213
|
+
data source created on datalake A never appears in
|
|
214
|
+
`api.dataSources.list(tenantSlug, slugOfDatalakeB)`. The
|
|
215
|
+
platform filters strictly by the datalake in the path —
|
|
216
|
+
sibling-datalake sources are never surfaced in the active
|
|
217
|
+
datalake's response. If you're tracking sources across
|
|
218
|
+
multiple datalakes, iterate by datalake or use cross-datalake
|
|
219
|
+
discovery via a higher-level surface.
|
|
220
|
+
|
|
221
|
+
2. **`is_default` collisions surface at create time.** Posting
|
|
222
|
+
a source with `is_default: true` against a datalake that
|
|
223
|
+
already has a default returns a 422. The SDK does NOT
|
|
224
|
+
silently demote the existing default. Either pass
|
|
225
|
+
`is_default: false` and promote separately via operator
|
|
226
|
+
action, or coordinate with the existing default's owner.
|
|
227
|
+
|
|
228
|
+
3. **Data sources don't carry credentials.** A source is a
|
|
229
|
+
*named endpoint*, not an authenticated connection.
|
|
230
|
+
Authentication for the endpoint lives on the consuming
|
|
231
|
+
resource — typically a Tool's body (with its own
|
|
232
|
+
`tool_body_type` discriminator). The source-tool pair is
|
|
233
|
+
how connection credentials enter the system, not the
|
|
234
|
+
source alone.
|