@epilot/sdk 2.8.3 → 2.8.5
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/definitions/blueprint-manifest-runtime.json +1 -1
- package/definitions/blueprint-manifest.json +571 -1
- package/definitions/snapshot-runtime.json +1 -1
- package/definitions/snapshot.json +222 -6
- package/dist/README-NBWAQWQS.js +7 -0
- package/dist/README-XCIDDEAE.cjs +7 -0
- package/dist/apis/access-token.cjs +6 -6
- package/dist/apis/access-token.js +1 -1
- package/dist/apis/address-suggestions.cjs +6 -6
- package/dist/apis/address-suggestions.js +1 -1
- package/dist/apis/address.cjs +6 -6
- package/dist/apis/address.js +1 -1
- package/dist/apis/ai-agents.cjs +6 -6
- package/dist/apis/ai-agents.js +1 -1
- package/dist/apis/app.cjs +6 -6
- package/dist/apis/app.js +1 -1
- package/dist/apis/audit-logs.cjs +6 -6
- package/dist/apis/audit-logs.js +1 -1
- package/dist/apis/automation.cjs +6 -6
- package/dist/apis/automation.js +1 -1
- package/dist/apis/billing.cjs +6 -6
- package/dist/apis/billing.js +1 -1
- package/dist/apis/blueprint-manifest.cjs +8 -8
- package/dist/apis/blueprint-manifest.d.cts +2 -2
- package/dist/apis/blueprint-manifest.d.ts +2 -2
- package/dist/apis/blueprint-manifest.js +2 -2
- package/dist/apis/calendar.cjs +6 -6
- package/dist/apis/calendar.js +1 -1
- package/dist/apis/configuration-hub.cjs +6 -6
- package/dist/apis/configuration-hub.js +1 -1
- package/dist/apis/consent.cjs +6 -6
- package/dist/apis/consent.js +1 -1
- package/dist/apis/customer-portal.cjs +6 -6
- package/dist/apis/customer-portal.js +1 -1
- package/dist/apis/dashboard.cjs +6 -6
- package/dist/apis/dashboard.js +1 -1
- package/dist/apis/data-governance.cjs +6 -6
- package/dist/apis/data-governance.js +1 -1
- package/dist/apis/deduplication.cjs +6 -6
- package/dist/apis/deduplication.js +1 -1
- package/dist/apis/design.cjs +6 -6
- package/dist/apis/design.js +1 -1
- package/dist/apis/document.cjs +6 -6
- package/dist/apis/document.js +1 -1
- package/dist/apis/email-settings.cjs +6 -6
- package/dist/apis/email-settings.js +1 -1
- package/dist/apis/email-template.cjs +6 -6
- package/dist/apis/email-template.js +1 -1
- package/dist/apis/entity-mapping.cjs +6 -6
- package/dist/apis/entity-mapping.js +1 -1
- package/dist/apis/entity.cjs +6 -6
- package/dist/apis/entity.js +1 -1
- package/dist/apis/environments.cjs +6 -6
- package/dist/apis/environments.js +1 -1
- package/dist/apis/event-catalog.cjs +6 -6
- package/dist/apis/event-catalog.js +1 -1
- package/dist/apis/file.cjs +6 -6
- package/dist/apis/file.js +1 -1
- package/dist/apis/iban.cjs +6 -6
- package/dist/apis/iban.js +1 -1
- package/dist/apis/integration-toolkit.cjs +6 -6
- package/dist/apis/integration-toolkit.js +1 -1
- package/dist/apis/journey.cjs +6 -6
- package/dist/apis/journey.js +1 -1
- package/dist/apis/kanban.cjs +6 -6
- package/dist/apis/kanban.js +1 -1
- package/dist/apis/message.cjs +6 -6
- package/dist/apis/message.js +1 -1
- package/dist/apis/metering.cjs +6 -6
- package/dist/apis/metering.js +1 -1
- package/dist/apis/notes.cjs +6 -6
- package/dist/apis/notes.js +1 -1
- package/dist/apis/notification.cjs +6 -6
- package/dist/apis/notification.js +1 -1
- package/dist/apis/organization.cjs +6 -6
- package/dist/apis/organization.js +1 -1
- package/dist/apis/partner-directory.cjs +6 -6
- package/dist/apis/partner-directory.js +1 -1
- package/dist/apis/permissions.cjs +6 -6
- package/dist/apis/permissions.js +1 -1
- package/dist/apis/pricing-tier.cjs +6 -6
- package/dist/apis/pricing-tier.js +1 -1
- package/dist/apis/pricing.cjs +6 -6
- package/dist/apis/pricing.js +1 -1
- package/dist/apis/purpose.cjs +6 -6
- package/dist/apis/purpose.js +1 -1
- package/dist/apis/query.cjs +6 -6
- package/dist/apis/query.js +1 -1
- package/dist/apis/sandbox.cjs +6 -6
- package/dist/apis/sandbox.js +1 -1
- package/dist/apis/sharing.cjs +6 -6
- package/dist/apis/sharing.js +1 -1
- package/dist/apis/snapshot.cjs +8 -8
- package/dist/apis/snapshot.d.cts +2 -2
- package/dist/apis/snapshot.d.ts +2 -2
- package/dist/apis/snapshot.js +2 -2
- package/dist/apis/submission.cjs +6 -6
- package/dist/apis/submission.js +1 -1
- package/dist/apis/target.cjs +6 -6
- package/dist/apis/target.js +1 -1
- package/dist/apis/targeting.cjs +6 -6
- package/dist/apis/targeting.js +1 -1
- package/dist/apis/template-variables.cjs +6 -6
- package/dist/apis/template-variables.js +1 -1
- package/dist/apis/user.cjs +6 -6
- package/dist/apis/user.js +1 -1
- package/dist/apis/validation-rules.cjs +6 -6
- package/dist/apis/validation-rules.js +1 -1
- package/dist/apis/webhooks.cjs +6 -6
- package/dist/apis/webhooks.js +1 -1
- package/dist/apis/workflow-definition.cjs +6 -6
- package/dist/apis/workflow-definition.js +1 -1
- package/dist/apis/workflow.cjs +6 -6
- package/dist/apis/workflow.js +1 -1
- package/dist/blueprint-manifest-WHYSBU66.cjs +7 -0
- package/dist/blueprint-manifest-WZVBTKUL.js +7 -0
- package/dist/{blueprint-manifest-runtime-FRLU3ZSF.js → blueprint-manifest-runtime-2344IUIE.js} +1 -1
- package/dist/{blueprint-manifest-runtime-EIDOROIQ.cjs → blueprint-manifest-runtime-WU5MWPVT.cjs} +2 -2
- package/dist/{blueprint-manifest.d-B8yDxagC.d.cts → blueprint-manifest.d-2-TORV8o.d.cts} +926 -4
- package/dist/{blueprint-manifest.d-B8yDxagC.d.ts → blueprint-manifest.d-2-TORV8o.d.ts} +926 -4
- package/dist/chunk-4SZCKUY2.js +14 -0
- package/dist/{chunk-76M3RIDP.js → chunk-5FXMXMNX.js} +5 -5
- package/dist/{chunk-NGHCQ2FA.cjs → chunk-T57MT6J5.cjs} +1 -1
- package/dist/chunk-ULKFBO7E.cjs +14 -0
- package/dist/{chunk-4YBWMDFP.js → chunk-UWGWRGGB.js} +1 -1
- package/dist/{chunk-FBQ4WDTG.cjs → chunk-XRIEGQXL.cjs} +5 -5
- package/dist/index.cjs +12 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/snapshot-GDJOEFJQ.js +7 -0
- package/dist/snapshot-UKV54UQQ.cjs +7 -0
- package/dist/{snapshot-runtime-NWQYU5UK.cjs → snapshot-runtime-5TT575JS.cjs} +2 -2
- package/dist/{snapshot-runtime-ALPJLXVW.js → snapshot-runtime-KWRGOKF4.js} +1 -1
- package/dist/{snapshot.d-DvoJ2n-v.d.cts → snapshot.d-C-n4wkIu.d.cts} +224 -62
- package/dist/{snapshot.d-DvoJ2n-v.d.ts → snapshot.d-C-n4wkIu.d.ts} +224 -62
- package/docs/blueprint-manifest.md +421 -95
- package/docs/snapshot.md +168 -15
- package/package.json +1 -1
- package/dist/README-46VYEGGW.js +0 -7
- package/dist/README-IVBISSWB.cjs +0 -7
- package/dist/blueprint-manifest-6DEYW5MW.js +0 -7
- package/dist/blueprint-manifest-GCV7H74X.cjs +0 -7
- package/dist/chunk-BJGLY4Z2.js +0 -14
- package/dist/chunk-K2QVMO5M.cjs +0 -14
- package/dist/snapshot-427N6KCO.js +0 -7
- package/dist/snapshot-NEMUND3M.cjs +0 -7
package/docs/snapshot.md
CHANGED
|
@@ -27,6 +27,7 @@ const { data } = await snapshotClient.createSnapshot(...)
|
|
|
27
27
|
**Snapshots**
|
|
28
28
|
- [`createSnapshot`](#createsnapshot)
|
|
29
29
|
- [`listSnapshots`](#listsnapshots)
|
|
30
|
+
- [`captureOrgSnapshot`](#captureorgsnapshot)
|
|
30
31
|
- [`getSnapshot`](#getsnapshot)
|
|
31
32
|
- [`deleteSnapshot`](#deletesnapshot)
|
|
32
33
|
- [`restoreSnapshot`](#restoresnapshot)
|
|
@@ -36,15 +37,19 @@ const { data } = await snapshotClient.createSnapshot(...)
|
|
|
36
37
|
|
|
37
38
|
**Schemas**
|
|
38
39
|
- [`Error`](#error)
|
|
40
|
+
- [`EmptyInventoryError`](#emptyinventoryerror)
|
|
39
41
|
- [`ResourceRef`](#resourceref)
|
|
40
42
|
- [`SnapshotResourceSummary`](#snapshotresourcesummary)
|
|
41
43
|
- [`SnapshotResourceList`](#snapshotresourcelist)
|
|
42
44
|
- [`SnapshotResourceDetail`](#snapshotresourcedetail)
|
|
43
45
|
- [`CreateSnapshotRequest`](#createsnapshotrequest)
|
|
46
|
+
- [`CreateOrgSnapshotRequest`](#createorgsnapshotrequest)
|
|
44
47
|
- [`CreateSnapshotResponse`](#createsnapshotresponse)
|
|
48
|
+
- [`RestoreSnapshotRequest`](#restoresnapshotrequest)
|
|
45
49
|
- [`RestoreSnapshotResponse`](#restoresnapshotresponse)
|
|
46
50
|
- [`Snapshot`](#snapshot)
|
|
47
51
|
- [`Operation`](#operation)
|
|
52
|
+
- [`SkippedResource`](#skippedresource)
|
|
48
53
|
- [`CallerIdentity`](#calleridentity)
|
|
49
54
|
|
|
50
55
|
### `createSnapshot`
|
|
@@ -115,7 +120,13 @@ const { data } = await client.listSnapshots({
|
|
|
115
120
|
"name": "string",
|
|
116
121
|
"user_id": "string",
|
|
117
122
|
"token_id": "string"
|
|
118
|
-
}
|
|
123
|
+
},
|
|
124
|
+
"skipped": [
|
|
125
|
+
{
|
|
126
|
+
"lineage_id": "string",
|
|
127
|
+
"reason": "modified"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
119
130
|
},
|
|
120
131
|
"restores": [
|
|
121
132
|
{
|
|
@@ -128,10 +139,24 @@ const { data } = await client.listSnapshots({
|
|
|
128
139
|
"name": "string",
|
|
129
140
|
"user_id": "string",
|
|
130
141
|
"token_id": "string"
|
|
131
|
-
}
|
|
142
|
+
},
|
|
143
|
+
"skipped": [
|
|
144
|
+
{
|
|
145
|
+
"lineage_id": "string",
|
|
146
|
+
"reason": "modified"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
132
149
|
}
|
|
133
150
|
],
|
|
134
|
-
"matched_count": 0
|
|
151
|
+
"matched_count": 0,
|
|
152
|
+
"scope": "selection",
|
|
153
|
+
"expires_at": "1970-01-01T00:00:00.000Z",
|
|
154
|
+
"capture_summary": {
|
|
155
|
+
"total": 0,
|
|
156
|
+
"captured": 0,
|
|
157
|
+
"skipped": 0,
|
|
158
|
+
"failed": 0
|
|
159
|
+
}
|
|
135
160
|
}
|
|
136
161
|
]
|
|
137
162
|
}
|
|
@@ -141,6 +166,30 @@ const { data } = await client.listSnapshots({
|
|
|
141
166
|
|
|
142
167
|
---
|
|
143
168
|
|
|
169
|
+
### `captureOrgSnapshot`
|
|
170
|
+
|
|
171
|
+
Snapshot the caller's whole organization now. Fetches a fresh inventory
|
|
172
|
+
of the org's configuration resources from configuration-hub-api, persists
|
|
173
|
+
it as an inventory artifact, and starts a `scope: "org
|
|
174
|
+
|
|
175
|
+
`POST /v1/snapshots:capture-org`
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
const { data } = await client.captureOrgSnapshot(
|
|
179
|
+
null,
|
|
180
|
+
{
|
|
181
|
+
name: 'string',
|
|
182
|
+
retention: {
|
|
183
|
+
value: 1,
|
|
184
|
+
unit: 'days'
|
|
185
|
+
},
|
|
186
|
+
excluded_types: ['string']
|
|
187
|
+
},
|
|
188
|
+
)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
144
193
|
### `getSnapshot`
|
|
145
194
|
|
|
146
195
|
Fetch a snapshot's metadata. Poll this endpoint to track create/restore progress.
|
|
@@ -175,7 +224,13 @@ const { data } = await client.getSnapshot({
|
|
|
175
224
|
"name": "string",
|
|
176
225
|
"user_id": "string",
|
|
177
226
|
"token_id": "string"
|
|
178
|
-
}
|
|
227
|
+
},
|
|
228
|
+
"skipped": [
|
|
229
|
+
{
|
|
230
|
+
"lineage_id": "string",
|
|
231
|
+
"reason": "modified"
|
|
232
|
+
}
|
|
233
|
+
]
|
|
179
234
|
},
|
|
180
235
|
"restores": [
|
|
181
236
|
{
|
|
@@ -188,10 +243,24 @@ const { data } = await client.getSnapshot({
|
|
|
188
243
|
"name": "string",
|
|
189
244
|
"user_id": "string",
|
|
190
245
|
"token_id": "string"
|
|
191
|
-
}
|
|
246
|
+
},
|
|
247
|
+
"skipped": [
|
|
248
|
+
{
|
|
249
|
+
"lineage_id": "string",
|
|
250
|
+
"reason": "modified"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
192
253
|
}
|
|
193
254
|
],
|
|
194
|
-
"matched_count": 0
|
|
255
|
+
"matched_count": 0,
|
|
256
|
+
"scope": "selection",
|
|
257
|
+
"expires_at": "1970-01-01T00:00:00.000Z",
|
|
258
|
+
"capture_summary": {
|
|
259
|
+
"total": 0,
|
|
260
|
+
"captured": 0,
|
|
261
|
+
"skipped": 0,
|
|
262
|
+
"failed": 0
|
|
263
|
+
}
|
|
195
264
|
}
|
|
196
265
|
```
|
|
197
266
|
|
|
@@ -217,14 +286,20 @@ const { data } = await client.deleteSnapshot({
|
|
|
217
286
|
|
|
218
287
|
Restore a snapshot to the org. Async — returns immediately; client polls
|
|
219
288
|
`getSnapshot` until the latest entry in `restores` moves from
|
|
220
|
-
`in_progress` to `completed
|
|
289
|
+
`in_progress` to one of `completed | partial | failed`.
|
|
221
290
|
|
|
222
291
|
`POST /v1/snapshots/{id}:restore`
|
|
223
292
|
|
|
224
293
|
```ts
|
|
225
|
-
const { data } = await client.restoreSnapshot(
|
|
226
|
-
|
|
227
|
-
|
|
294
|
+
const { data } = await client.restoreSnapshot(
|
|
295
|
+
{
|
|
296
|
+
id: '123e4567-e89b-12d3-a456-426614174000',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
preserve_modified: false,
|
|
300
|
+
preserve_co_owned: false
|
|
301
|
+
},
|
|
302
|
+
)
|
|
228
303
|
```
|
|
229
304
|
|
|
230
305
|
---
|
|
@@ -344,6 +419,23 @@ type Error = {
|
|
|
344
419
|
}
|
|
345
420
|
```
|
|
346
421
|
|
|
422
|
+
### `EmptyInventoryError`
|
|
423
|
+
|
|
424
|
+
Returned (422) when the org inventory contains no capturable resources
|
|
425
|
+
after filtering out sensitive, unsupported, and excluded types. The
|
|
426
|
+
`skipped_types` array explains why every type was dropped.
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
type EmptyInventoryError = {
|
|
431
|
+
message: string
|
|
432
|
+
skipped_types: Array<{
|
|
433
|
+
type: string
|
|
434
|
+
reason: string
|
|
435
|
+
}>
|
|
436
|
+
}
|
|
437
|
+
```
|
|
438
|
+
|
|
347
439
|
### `ResourceRef`
|
|
348
440
|
|
|
349
441
|
```ts
|
|
@@ -405,7 +497,7 @@ type SnapshotResourceDetail = {
|
|
|
405
497
|
type CreateSnapshotRequest = {
|
|
406
498
|
name: string
|
|
407
499
|
description?: string
|
|
408
|
-
trigger?: "manual" | "sync" | "blueprint_install"
|
|
500
|
+
trigger?: "manual" | "sync" | "blueprint_install" | "scheduled"
|
|
409
501
|
blueprint_instance_id?: string
|
|
410
502
|
resources: Array<{
|
|
411
503
|
type: string
|
|
@@ -414,6 +506,23 @@ type CreateSnapshotRequest = {
|
|
|
414
506
|
}
|
|
415
507
|
```
|
|
416
508
|
|
|
509
|
+
### `CreateOrgSnapshotRequest`
|
|
510
|
+
|
|
511
|
+
Request body for `captureOrgSnapshot`. All fields optional — an empty body
|
|
512
|
+
snapshots the whole org with a default name and the 90-day default TTL.
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
```ts
|
|
516
|
+
type CreateOrgSnapshotRequest = {
|
|
517
|
+
name?: string
|
|
518
|
+
retention?: {
|
|
519
|
+
value: number
|
|
520
|
+
unit: "days" | "weeks" | "months"
|
|
521
|
+
}
|
|
522
|
+
excluded_types?: string[]
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
417
526
|
### `CreateSnapshotResponse`
|
|
418
527
|
|
|
419
528
|
```ts
|
|
@@ -425,6 +534,21 @@ type CreateSnapshotResponse = {
|
|
|
425
534
|
}
|
|
426
535
|
```
|
|
427
536
|
|
|
537
|
+
### `RestoreSnapshotRequest`
|
|
538
|
+
|
|
539
|
+
Both flags default to `false`, which restores every captured resource —
|
|
540
|
+
Config Hub's manual-restore semantics. blueprint-manifest-api sets
|
|
541
|
+
both `true` when reverting a blueprint install so user edits and
|
|
542
|
+
cross-blueprint contributions survive. Each flag is independent so a
|
|
543
|
+
caller can preserve edits w
|
|
544
|
+
|
|
545
|
+
```ts
|
|
546
|
+
type RestoreSnapshotRequest = {
|
|
547
|
+
preserve_modified?: boolean
|
|
548
|
+
preserve_co_owned?: boolean
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
428
552
|
### `RestoreSnapshotResponse`
|
|
429
553
|
|
|
430
554
|
```ts
|
|
@@ -442,34 +566,50 @@ type Snapshot = {
|
|
|
442
566
|
org_id: string
|
|
443
567
|
name: string
|
|
444
568
|
description?: string
|
|
445
|
-
trigger: "manual" | "sync" | "blueprint_install"
|
|
569
|
+
trigger: "manual" | "sync" | "blueprint_install" | "scheduled"
|
|
446
570
|
blueprint_instance_id?: string
|
|
447
571
|
resource_counts: Record<string, number>
|
|
448
572
|
create: {
|
|
449
573
|
type: "create" | "restore"
|
|
450
574
|
started_at: string // date-time
|
|
451
575
|
completed_at?: string // date-time
|
|
452
|
-
status: "in_progress" | "completed" | "failed"
|
|
576
|
+
status: "in_progress" | "completed" | "partial" | "failed"
|
|
453
577
|
error?: string
|
|
454
578
|
triggered_by: {
|
|
455
579
|
name: { ... }
|
|
456
580
|
user_id?: { ... }
|
|
457
581
|
token_id?: { ... }
|
|
458
582
|
}
|
|
583
|
+
skipped?: Array<{
|
|
584
|
+
lineage_id: { ... }
|
|
585
|
+
reason: { ... }
|
|
586
|
+
}>
|
|
459
587
|
}
|
|
460
588
|
restores: Array<{
|
|
461
589
|
type: "create" | "restore"
|
|
462
590
|
started_at: string // date-time
|
|
463
591
|
completed_at?: string // date-time
|
|
464
|
-
status: "in_progress" | "completed" | "failed"
|
|
592
|
+
status: "in_progress" | "completed" | "partial" | "failed"
|
|
465
593
|
error?: string
|
|
466
594
|
triggered_by: {
|
|
467
595
|
name: { ... }
|
|
468
596
|
user_id?: { ... }
|
|
469
597
|
token_id?: { ... }
|
|
470
598
|
}
|
|
599
|
+
skipped?: Array<{
|
|
600
|
+
lineage_id: { ... }
|
|
601
|
+
reason: { ... }
|
|
602
|
+
}>
|
|
471
603
|
}>
|
|
472
604
|
matched_count?: number
|
|
605
|
+
scope?: "selection" | "org"
|
|
606
|
+
expires_at?: string // date-time
|
|
607
|
+
capture_summary?: {
|
|
608
|
+
total: number
|
|
609
|
+
captured: number
|
|
610
|
+
skipped: number
|
|
611
|
+
failed: number
|
|
612
|
+
}
|
|
473
613
|
}
|
|
474
614
|
```
|
|
475
615
|
|
|
@@ -480,13 +620,26 @@ type Operation = {
|
|
|
480
620
|
type: "create" | "restore"
|
|
481
621
|
started_at: string // date-time
|
|
482
622
|
completed_at?: string // date-time
|
|
483
|
-
status: "in_progress" | "completed" | "failed"
|
|
623
|
+
status: "in_progress" | "completed" | "partial" | "failed"
|
|
484
624
|
error?: string
|
|
485
625
|
triggered_by: {
|
|
486
626
|
name: string
|
|
487
627
|
user_id?: string
|
|
488
628
|
token_id?: string
|
|
489
629
|
}
|
|
630
|
+
skipped?: Array<{
|
|
631
|
+
lineage_id: string
|
|
632
|
+
reason: "modified" | "co_owned"
|
|
633
|
+
}>
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### `SkippedResource`
|
|
638
|
+
|
|
639
|
+
```ts
|
|
640
|
+
type SkippedResource = {
|
|
641
|
+
lineage_id: string
|
|
642
|
+
reason: "modified" | "co_owned"
|
|
490
643
|
}
|
|
491
644
|
```
|
|
492
645
|
|
package/package.json
CHANGED
package/dist/README-46VYEGGW.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./chunk-YPSWSI3M.js";
|
|
2
|
-
|
|
3
|
-
// src/docs/README.json
|
|
4
|
-
var README_default = "<h1 align=\"center\"><img alt=\"epilot\" src=\"https://raw.githubusercontent.com/epilot-dev/sdk-js/main/logo.png\" width=\"200\"><br>@epilot/sdk</h1>\n\n<p align=\"center\">\n <a href=\"https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI\"><img src=\"https://github.com/epilot-dev/sdk-js/workflows/CI/badge.svg\" alt=\"CI\"></a>\n <a href=\"https://www.npmjs.com/package/@epilot/sdk\"><img src=\"https://img.shields.io/npm/v/@epilot/sdk.svg\" alt=\"npm version\"></a>\n <a href=\"https://github.com/epilot-dev/sdk-js/blob/main/\"><img src=\"http://img.shields.io/:license-mit-blue.svg\" alt=\"License\"></a>\n</p>\n\n<p align=\"center\">JavaScript/TypeScript SDK for epilot APIs. Full types, tree-shakeable imports, and lazy-loaded OpenAPI specs.</p>\n\n## Install\n\n```bash\nnpm i @epilot/sdk axios openapi-client-axios\n```\n\n## Quick Start\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-bearer-token>')\n\nconst { data: entity } = await epilot.entity.createEntity(\n { slug: 'contact' },\n { first_name: 'John', last_name: 'Doe' },\n)\n\nconst { data: file } = await epilot.file.getFile({ id: 'file-123' })\n\nconst { data: executions } = await epilot.workflow.getExecutions()\n```\n\nAPI clients are built on [openapi-client-axios](https://openapistack.co/docs/openapi-client-axios/intro/), which generates fully typed operation methods on top of regular [axios](https://axios-http.com/docs/intro) instances. All standard axios features (interceptors, defaults, config) work as expected. Each operation is forwarded to a lazy singleton \u2014 the spec is loaded and the client initialized on first use, then cached.\n\nFull API documentation: [https://docs.epilot.io/api](https://docs.epilot.io/api)\n\n## API Reference\n\n<!-- api-reference-table -->\n| API | Import | Docs |\n| --- | ------ | ---- |\n| `epilot.accessToken` | `@epilot/sdk/access-token` | [docs](./docs/access-token.md) |\n| `epilot.address` | `@epilot/sdk/address` | [docs](./docs/address.md) |\n| `epilot.addressSuggestions` | `@epilot/sdk/address-suggestions` | [docs](./docs/address-suggestions.md) |\n| `epilot.aiAgents` | `@epilot/sdk/ai-agents` | [docs](./docs/ai-agents.md) |\n| `epilot.app` | `@epilot/sdk/app` | [docs](./docs/app.md) |\n| `epilot.auditLogs` | `@epilot/sdk/audit-logs` | [docs](./docs/audit-logs.md) |\n| `epilot.automation` | `@epilot/sdk/automation` | [docs](./docs/automation.md) |\n| `epilot.billing` | `@epilot/sdk/billing` | [docs](./docs/billing.md) |\n| `epilot.blueprintManifest` | `@epilot/sdk/blueprint-manifest` | [docs](./docs/blueprint-manifest.md) |\n| `epilot.calendar` | `@epilot/sdk/calendar` | [docs](./docs/calendar.md) |\n| `epilot.configurationHub` | `@epilot/sdk/configuration-hub` | [docs](./docs/configuration-hub.md) |\n| `epilot.consent` | `@epilot/sdk/consent` | [docs](./docs/consent.md) |\n| `epilot.customerPortal` | `@epilot/sdk/customer-portal` | [docs](./docs/customer-portal.md) |\n| `epilot.dashboard` | `@epilot/sdk/dashboard` | [docs](./docs/dashboard.md) |\n| `epilot.dataGovernance` | `@epilot/sdk/data-governance` | [docs](./docs/data-governance.md) |\n| `epilot.deduplication` | `@epilot/sdk/deduplication` | [docs](./docs/deduplication.md) |\n| `epilot.design` | `@epilot/sdk/design` | [docs](./docs/design.md) |\n| `epilot.document` | `@epilot/sdk/document` | [docs](./docs/document.md) |\n| `epilot.emailSettings` | `@epilot/sdk/email-settings` | [docs](./docs/email-settings.md) |\n| `epilot.emailTemplate` | `@epilot/sdk/email-template` | [docs](./docs/email-template.md) |\n| `epilot.entity` | `@epilot/sdk/entity` | [docs](./docs/entity.md) |\n| `epilot.entityMapping` | `@epilot/sdk/entity-mapping` | [docs](./docs/entity-mapping.md) |\n| `epilot.environments` | `@epilot/sdk/environments` | [docs](./docs/environments.md) |\n| `epilot.eventCatalog` | `@epilot/sdk/event-catalog` | [docs](./docs/event-catalog.md) |\n| `epilot.file` | `@epilot/sdk/file` | [docs](./docs/file.md) |\n| `epilot.iban` | `@epilot/sdk/iban` | [docs](./docs/iban.md) |\n| `epilot.integrationToolkit` | `@epilot/sdk/integration-toolkit` | [docs](./docs/integration-toolkit.md) |\n| `epilot.journey` | `@epilot/sdk/journey` | [docs](./docs/journey.md) |\n| `epilot.kanban` | `@epilot/sdk/kanban` | [docs](./docs/kanban.md) |\n| `epilot.message` | `@epilot/sdk/message` | [docs](./docs/message.md) |\n| `epilot.metering` | `@epilot/sdk/metering` | [docs](./docs/metering.md) |\n| `epilot.notes` | `@epilot/sdk/notes` | [docs](./docs/notes.md) |\n| `epilot.notification` | `@epilot/sdk/notification` | [docs](./docs/notification.md) |\n| `epilot.organization` | `@epilot/sdk/organization` | [docs](./docs/organization.md) |\n| `epilot.partnerDirectory` | `@epilot/sdk/partner-directory` | [docs](./docs/partner-directory.md) |\n| `epilot.permissions` | `@epilot/sdk/permissions` | [docs](./docs/permissions.md) |\n| `epilot.pricing` | `@epilot/sdk/pricing` | [docs](./docs/pricing.md) |\n| `epilot.pricingTier` | `@epilot/sdk/pricing-tier` | [docs](./docs/pricing-tier.md) |\n| `epilot.purpose` | `@epilot/sdk/purpose` | [docs](./docs/purpose.md) |\n| `epilot.query` | `@epilot/sdk/query` | [docs](./docs/query.md) |\n| `epilot.sandbox` | `@epilot/sdk/sandbox` | [docs](./docs/sandbox.md) |\n| `epilot.sharing` | `@epilot/sdk/sharing` | [docs](./docs/sharing.md) |\n| `epilot.submission` | `@epilot/sdk/submission` | [docs](./docs/submission.md) |\n| `epilot.targeting` | `@epilot/sdk/targeting` | [docs](./docs/targeting.md) |\n| `epilot.templateVariables` | `@epilot/sdk/template-variables` | [docs](./docs/template-variables.md) |\n| `epilot.user` | `@epilot/sdk/user` | [docs](./docs/user.md) |\n| `epilot.validationRules` | `@epilot/sdk/validation-rules` | [docs](./docs/validation-rules.md) |\n| `epilot.webhooks` | `@epilot/sdk/webhooks` | [docs](./docs/webhooks.md) |\n| `epilot.workflow` | `@epilot/sdk/workflow` | [docs](./docs/workflow.md) |\n| `epilot.workflowDefinition` | `@epilot/sdk/workflow-definition` | [docs](./docs/workflow-definition.md) |\n<!-- /api-reference-table -->\n\n## OpenAPI Spec\n\nRetrieve the full OpenAPI specification for any API at runtime. The spec is lazy-loaded on first call and cached.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\n// Via API handle\nconst entitySpec = await epilot.entity.openapi()\nconsole.log(entitySpec.info.title) // \"Entity API\"\nconsole.log(entitySpec.paths) // all paths with full schemas\n\n// Via top-level method\nconst spec = await epilot.openapi('entity')\n```\n\nFor tree-shakeable imports:\n\n```ts\nimport { openapi } from '@epilot/sdk/entity'\n\nconst spec = await openapi()\n```\n\n## Explicit Client Access\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-token>')\n\n// Get the cached singleton client\nconst entityClient = epilot.entity.getClient()\nconst { data } = await entityClient.getEntity({ slug: 'contact', id: '123' })\n\n// Create a fresh (non-singleton) client instance\nconst freshClient = epilot.entity.createClient()\nauthorize(freshClient, () => '<my-token>')\n```\n\n## Tree-Shakeable Imports\n\nImport only what you need. Other APIs never touch your bundle.\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/entity'\n\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\n\nconst { data } = await entityClient.getEntity({ slug: 'contact', id: '123' })\n\n// Or use the handle for direct operation forwarding\nimport { entity } from '@epilot/sdk/entity'\nconst { data } = await entity.getEntity({ slug: 'contact', id: '123' })\n```\n\n## Types\n\nEach API subpath re-exports all schema types generated from the OpenAPI spec. Import them directly:\n\n```ts\nimport type { Entity, EntitySchema, RelationAttribute } from '@epilot/sdk/entity'\nimport type { FileItem } from '@epilot/sdk/file'\nimport type { AutomationFlow } from '@epilot/sdk/automation'\n```\n\nThe `Client`, `OperationMethods`, and `PathsDictionary` types are also available for typing client instances:\n\n```ts\nimport type { Client } from '@epilot/sdk/entity'\n\nconst entityClient: Client = epilot.entity.getClient()\n```\n\n## Headers\n\n### Global Headers\n\nSet default headers applied to all clients. Useful for `x-epilot-org-id`, `x-epilot-user-id`, etc.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-token>')\nepilot.headers({\n 'x-epilot-org-id': 'org-123',\n 'x-epilot-user-id': 'user-456',\n})\n\nconst { data } = await epilot.entity.searchEntities(...)\n```\n\n### Standard Axios Headers\n\nUse standard axios `defaults.headers.common` on individual clients:\n\n```ts\nconst entityClient = epilot.entity.getClient()\nentityClient.defaults.headers.common['x-epilot-org-id'] = 'org-123'\n```\n\n## Auth Patterns\n\n`authorize()` accepts a string or a function. The function form is preferred \u2014 it is called on every request, so tokens stay fresh.\n\n```ts\nimport { authorize } from '@epilot/sdk'\nimport { getClient } from '@epilot/sdk/entity'\n\n// Per-client \u2014 function predicate (recommended)\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\n\n// Per-client \u2014 async function (e.g. OAuth / session)\nauthorize(entityClient, async () => {\n return await getTokenFromSession()\n})\n\n// Per-client \u2014 static string (sets default header once)\nauthorize(entityClient, 'my-static-api-token')\n```\n\n```ts\n// Global \u2014 applies to all clients resolved from the SDK\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-token>')\nepilot.authorize(async () => await getTokenFromSession())\nepilot.authorize('my-static-api-token')\n```\n\n## Fresh Client Instance\n\n```ts\nimport { createClient, authorize } from '@epilot/sdk/entity'\n\nconst entityClient = createClient()\nauthorize(entityClient, () => '<my-token>')\nentityClient.defaults.headers.common['x-epilot-org-id'] = 'org-123'\n```\n\n## Multiple SDK Instances\n\n```ts\nimport { createSDK } from '@epilot/sdk'\n\nconst sdk1 = createSDK()\nsdk1.authorize(() => '<token-for-org-1>')\nsdk1.headers({ 'x-epilot-org-id': 'org-1' })\n\nconst sdk2 = createSDK()\nsdk2.authorize(() => '<token-for-org-2>')\nsdk2.headers({ 'x-epilot-org-id': 'org-2' })\n```\n\n\n## Interceptors\n\nUse axios interceptors for custom request/response processing. Since clients are axios instances, you can use `client.interceptors` directly:\n\n```ts\nentityClient.interceptors.response.use((response) => {\n console.debug(`${response.config.method?.toUpperCase()} ${response.config.url}`, {\n status: response.status,\n data: response.data,\n })\n return response\n})\n```\n\nOr register global interceptors applied to all clients:\n\n```ts\nepilot.interceptors.request((config) => {\n config.headers['x-correlation-id'] = generateTraceId()\n return config\n})\n```\n\n## Auto-Retry (429 Too Many Requests)\n\nThe SDK automatically retries requests that receive a `429 Too Many Requests` response. It respects the `Retry-After` header (in seconds) to determine how long to wait before retrying.\n\nEnabled by default with up to 3 retries.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\n// Customize retry behavior\nepilot.retry({ maxRetries: 5, defaultDelayMs: 2000 })\n\n// Disable retries\nepilot.retry({ maxRetries: 0 })\n```\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `maxRetries` | `3` | Maximum number of retries. Set to `0` to disable. |\n| `defaultDelayMs` | `1000` | Fallback delay in ms when `Retry-After` header is missing. |\n\nFor individually imported clients (tree-shakeable imports), apply the interceptor manually:\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/entity'\nimport { applyRetryInterceptor } from '@epilot/sdk'\n\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\napplyRetryInterceptor({ client: entityClient, config: { maxRetries: 3 } })\n```\n\n## Large Response Handling (413 Payload Too Large)\n\nepilot APIs use a [large response middleware](https://github.com/epilot-dev/aws-lambda-utility-middlewares) to work around the AWS Lambda 6MB response limit. When a response exceeds ~5.1MB, the API uploads the payload to S3 and returns a presigned URL instead.\n\nThe SDK handles this transparently \u2014 it sends the opt-in `Accept` header and automatically fetches the full payload from S3 when a large response URL is returned. Enabled by default.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\n// Disable large response handling\nepilot.largeResponse({ enabled: false })\n```\n\nFor individually imported clients (tree-shakeable imports), apply the interceptor manually:\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/entity'\nimport { applyLargeResponseInterceptor } from '@epilot/sdk'\n\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\napplyLargeResponseInterceptor({ client: entityClient, config: { enabled: true } })\n```\n\n## Overrides & Custom APIs\n\nOverride built-in API specs or register custom APIs via `.epilot/sdk-overrides.json`. This is useful for testing new versions of an API spec or getting the latest types without waiting for an SDK release.\n\n```json\n{\n \"entity\": \"./specs/entity-openapi.json\",\n \"myNewApi\": \"./specs/my-new-api-openapi.json\"\n}\n```\n\n```ts\n// Built-in API with overridden spec\nconst { data } = await epilot.entity.getEntity({ slug: 'contact', id: '123' })\n```\n\n### Override Commands\n\n```bash\n# Apply all overrides from .epilot/sdk-overrides.json\nnpx epilot-sdk override\n\n# Override a single API\nnpx epilot-sdk override entity ./my-local-entity-spec.yaml\n\n# Regenerate types after spec changes\nnpx epilot-sdk typegen\n```\n\n<details>\n<summary>Migration from <code>@epilot/*-client</code></summary>\n\nDrop-in replacement \u2014 just change the import path:\n\n```ts\n// Before\nimport { getClient, createClient, authorize } from '@epilot/entity-client'\nimport type { Client, Entity } from '@epilot/entity-client'\n\n// After\nimport { getClient, createClient, authorize } from '@epilot/sdk/entity'\nimport type { Client, Entity } from '@epilot/sdk/entity'\n```\n\n</details>\n\n<details>\n<summary>Client Lifecycle</summary>\n\nWhen you call `authorize()`, `headers()`, `retry()`, `largeResponse()`, or `interceptors`, the SDK invalidates all cached client instances. The next operation call creates a fresh client with the updated configuration.\n\n**Operation methods are always up to date** \u2014 calls like `epilot.entity.getEntity(...)` re-resolve the client on every invocation, so they always use the latest config.\n\n**Direct `getClient()` references can go stale** \u2014 if you hold a reference and then change config, your reference still points to the old client:\n\n```ts\nconst entityClient = epilot.entity.getClient()\n\nepilot.authorize('new-token') // invalidates all cached clients\n\n// entityClient still has the old token\n// epilot.entity.getEntity(...) will use a new client with the new token\n```\n\nIf you need a long-lived reference that survives config changes, call `getClient()` again after changing config, or use operation methods directly.\n\n</details>\n";
|
|
5
|
-
export {
|
|
6
|
-
README_default as default
|
|
7
|
-
};
|
package/dist/README-IVBISSWB.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-NJK5F5TF.cjs');
|
|
2
|
-
|
|
3
|
-
// src/docs/README.json
|
|
4
|
-
var README_default = "<h1 align=\"center\"><img alt=\"epilot\" src=\"https://raw.githubusercontent.com/epilot-dev/sdk-js/main/logo.png\" width=\"200\"><br>@epilot/sdk</h1>\n\n<p align=\"center\">\n <a href=\"https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI\"><img src=\"https://github.com/epilot-dev/sdk-js/workflows/CI/badge.svg\" alt=\"CI\"></a>\n <a href=\"https://www.npmjs.com/package/@epilot/sdk\"><img src=\"https://img.shields.io/npm/v/@epilot/sdk.svg\" alt=\"npm version\"></a>\n <a href=\"https://github.com/epilot-dev/sdk-js/blob/main/\"><img src=\"http://img.shields.io/:license-mit-blue.svg\" alt=\"License\"></a>\n</p>\n\n<p align=\"center\">JavaScript/TypeScript SDK for epilot APIs. Full types, tree-shakeable imports, and lazy-loaded OpenAPI specs.</p>\n\n## Install\n\n```bash\nnpm i @epilot/sdk axios openapi-client-axios\n```\n\n## Quick Start\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-bearer-token>')\n\nconst { data: entity } = await epilot.entity.createEntity(\n { slug: 'contact' },\n { first_name: 'John', last_name: 'Doe' },\n)\n\nconst { data: file } = await epilot.file.getFile({ id: 'file-123' })\n\nconst { data: executions } = await epilot.workflow.getExecutions()\n```\n\nAPI clients are built on [openapi-client-axios](https://openapistack.co/docs/openapi-client-axios/intro/), which generates fully typed operation methods on top of regular [axios](https://axios-http.com/docs/intro) instances. All standard axios features (interceptors, defaults, config) work as expected. Each operation is forwarded to a lazy singleton \u2014 the spec is loaded and the client initialized on first use, then cached.\n\nFull API documentation: [https://docs.epilot.io/api](https://docs.epilot.io/api)\n\n## API Reference\n\n<!-- api-reference-table -->\n| API | Import | Docs |\n| --- | ------ | ---- |\n| `epilot.accessToken` | `@epilot/sdk/access-token` | [docs](./docs/access-token.md) |\n| `epilot.address` | `@epilot/sdk/address` | [docs](./docs/address.md) |\n| `epilot.addressSuggestions` | `@epilot/sdk/address-suggestions` | [docs](./docs/address-suggestions.md) |\n| `epilot.aiAgents` | `@epilot/sdk/ai-agents` | [docs](./docs/ai-agents.md) |\n| `epilot.app` | `@epilot/sdk/app` | [docs](./docs/app.md) |\n| `epilot.auditLogs` | `@epilot/sdk/audit-logs` | [docs](./docs/audit-logs.md) |\n| `epilot.automation` | `@epilot/sdk/automation` | [docs](./docs/automation.md) |\n| `epilot.billing` | `@epilot/sdk/billing` | [docs](./docs/billing.md) |\n| `epilot.blueprintManifest` | `@epilot/sdk/blueprint-manifest` | [docs](./docs/blueprint-manifest.md) |\n| `epilot.calendar` | `@epilot/sdk/calendar` | [docs](./docs/calendar.md) |\n| `epilot.configurationHub` | `@epilot/sdk/configuration-hub` | [docs](./docs/configuration-hub.md) |\n| `epilot.consent` | `@epilot/sdk/consent` | [docs](./docs/consent.md) |\n| `epilot.customerPortal` | `@epilot/sdk/customer-portal` | [docs](./docs/customer-portal.md) |\n| `epilot.dashboard` | `@epilot/sdk/dashboard` | [docs](./docs/dashboard.md) |\n| `epilot.dataGovernance` | `@epilot/sdk/data-governance` | [docs](./docs/data-governance.md) |\n| `epilot.deduplication` | `@epilot/sdk/deduplication` | [docs](./docs/deduplication.md) |\n| `epilot.design` | `@epilot/sdk/design` | [docs](./docs/design.md) |\n| `epilot.document` | `@epilot/sdk/document` | [docs](./docs/document.md) |\n| `epilot.emailSettings` | `@epilot/sdk/email-settings` | [docs](./docs/email-settings.md) |\n| `epilot.emailTemplate` | `@epilot/sdk/email-template` | [docs](./docs/email-template.md) |\n| `epilot.entity` | `@epilot/sdk/entity` | [docs](./docs/entity.md) |\n| `epilot.entityMapping` | `@epilot/sdk/entity-mapping` | [docs](./docs/entity-mapping.md) |\n| `epilot.environments` | `@epilot/sdk/environments` | [docs](./docs/environments.md) |\n| `epilot.eventCatalog` | `@epilot/sdk/event-catalog` | [docs](./docs/event-catalog.md) |\n| `epilot.file` | `@epilot/sdk/file` | [docs](./docs/file.md) |\n| `epilot.iban` | `@epilot/sdk/iban` | [docs](./docs/iban.md) |\n| `epilot.integrationToolkit` | `@epilot/sdk/integration-toolkit` | [docs](./docs/integration-toolkit.md) |\n| `epilot.journey` | `@epilot/sdk/journey` | [docs](./docs/journey.md) |\n| `epilot.kanban` | `@epilot/sdk/kanban` | [docs](./docs/kanban.md) |\n| `epilot.message` | `@epilot/sdk/message` | [docs](./docs/message.md) |\n| `epilot.metering` | `@epilot/sdk/metering` | [docs](./docs/metering.md) |\n| `epilot.notes` | `@epilot/sdk/notes` | [docs](./docs/notes.md) |\n| `epilot.notification` | `@epilot/sdk/notification` | [docs](./docs/notification.md) |\n| `epilot.organization` | `@epilot/sdk/organization` | [docs](./docs/organization.md) |\n| `epilot.partnerDirectory` | `@epilot/sdk/partner-directory` | [docs](./docs/partner-directory.md) |\n| `epilot.permissions` | `@epilot/sdk/permissions` | [docs](./docs/permissions.md) |\n| `epilot.pricing` | `@epilot/sdk/pricing` | [docs](./docs/pricing.md) |\n| `epilot.pricingTier` | `@epilot/sdk/pricing-tier` | [docs](./docs/pricing-tier.md) |\n| `epilot.purpose` | `@epilot/sdk/purpose` | [docs](./docs/purpose.md) |\n| `epilot.query` | `@epilot/sdk/query` | [docs](./docs/query.md) |\n| `epilot.sandbox` | `@epilot/sdk/sandbox` | [docs](./docs/sandbox.md) |\n| `epilot.sharing` | `@epilot/sdk/sharing` | [docs](./docs/sharing.md) |\n| `epilot.submission` | `@epilot/sdk/submission` | [docs](./docs/submission.md) |\n| `epilot.targeting` | `@epilot/sdk/targeting` | [docs](./docs/targeting.md) |\n| `epilot.templateVariables` | `@epilot/sdk/template-variables` | [docs](./docs/template-variables.md) |\n| `epilot.user` | `@epilot/sdk/user` | [docs](./docs/user.md) |\n| `epilot.validationRules` | `@epilot/sdk/validation-rules` | [docs](./docs/validation-rules.md) |\n| `epilot.webhooks` | `@epilot/sdk/webhooks` | [docs](./docs/webhooks.md) |\n| `epilot.workflow` | `@epilot/sdk/workflow` | [docs](./docs/workflow.md) |\n| `epilot.workflowDefinition` | `@epilot/sdk/workflow-definition` | [docs](./docs/workflow-definition.md) |\n<!-- /api-reference-table -->\n\n## OpenAPI Spec\n\nRetrieve the full OpenAPI specification for any API at runtime. The spec is lazy-loaded on first call and cached.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\n// Via API handle\nconst entitySpec = await epilot.entity.openapi()\nconsole.log(entitySpec.info.title) // \"Entity API\"\nconsole.log(entitySpec.paths) // all paths with full schemas\n\n// Via top-level method\nconst spec = await epilot.openapi('entity')\n```\n\nFor tree-shakeable imports:\n\n```ts\nimport { openapi } from '@epilot/sdk/entity'\n\nconst spec = await openapi()\n```\n\n## Explicit Client Access\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-token>')\n\n// Get the cached singleton client\nconst entityClient = epilot.entity.getClient()\nconst { data } = await entityClient.getEntity({ slug: 'contact', id: '123' })\n\n// Create a fresh (non-singleton) client instance\nconst freshClient = epilot.entity.createClient()\nauthorize(freshClient, () => '<my-token>')\n```\n\n## Tree-Shakeable Imports\n\nImport only what you need. Other APIs never touch your bundle.\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/entity'\n\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\n\nconst { data } = await entityClient.getEntity({ slug: 'contact', id: '123' })\n\n// Or use the handle for direct operation forwarding\nimport { entity } from '@epilot/sdk/entity'\nconst { data } = await entity.getEntity({ slug: 'contact', id: '123' })\n```\n\n## Types\n\nEach API subpath re-exports all schema types generated from the OpenAPI spec. Import them directly:\n\n```ts\nimport type { Entity, EntitySchema, RelationAttribute } from '@epilot/sdk/entity'\nimport type { FileItem } from '@epilot/sdk/file'\nimport type { AutomationFlow } from '@epilot/sdk/automation'\n```\n\nThe `Client`, `OperationMethods`, and `PathsDictionary` types are also available for typing client instances:\n\n```ts\nimport type { Client } from '@epilot/sdk/entity'\n\nconst entityClient: Client = epilot.entity.getClient()\n```\n\n## Headers\n\n### Global Headers\n\nSet default headers applied to all clients. Useful for `x-epilot-org-id`, `x-epilot-user-id`, etc.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-token>')\nepilot.headers({\n 'x-epilot-org-id': 'org-123',\n 'x-epilot-user-id': 'user-456',\n})\n\nconst { data } = await epilot.entity.searchEntities(...)\n```\n\n### Standard Axios Headers\n\nUse standard axios `defaults.headers.common` on individual clients:\n\n```ts\nconst entityClient = epilot.entity.getClient()\nentityClient.defaults.headers.common['x-epilot-org-id'] = 'org-123'\n```\n\n## Auth Patterns\n\n`authorize()` accepts a string or a function. The function form is preferred \u2014 it is called on every request, so tokens stay fresh.\n\n```ts\nimport { authorize } from '@epilot/sdk'\nimport { getClient } from '@epilot/sdk/entity'\n\n// Per-client \u2014 function predicate (recommended)\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\n\n// Per-client \u2014 async function (e.g. OAuth / session)\nauthorize(entityClient, async () => {\n return await getTokenFromSession()\n})\n\n// Per-client \u2014 static string (sets default header once)\nauthorize(entityClient, 'my-static-api-token')\n```\n\n```ts\n// Global \u2014 applies to all clients resolved from the SDK\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '<my-token>')\nepilot.authorize(async () => await getTokenFromSession())\nepilot.authorize('my-static-api-token')\n```\n\n## Fresh Client Instance\n\n```ts\nimport { createClient, authorize } from '@epilot/sdk/entity'\n\nconst entityClient = createClient()\nauthorize(entityClient, () => '<my-token>')\nentityClient.defaults.headers.common['x-epilot-org-id'] = 'org-123'\n```\n\n## Multiple SDK Instances\n\n```ts\nimport { createSDK } from '@epilot/sdk'\n\nconst sdk1 = createSDK()\nsdk1.authorize(() => '<token-for-org-1>')\nsdk1.headers({ 'x-epilot-org-id': 'org-1' })\n\nconst sdk2 = createSDK()\nsdk2.authorize(() => '<token-for-org-2>')\nsdk2.headers({ 'x-epilot-org-id': 'org-2' })\n```\n\n\n## Interceptors\n\nUse axios interceptors for custom request/response processing. Since clients are axios instances, you can use `client.interceptors` directly:\n\n```ts\nentityClient.interceptors.response.use((response) => {\n console.debug(`${response.config.method?.toUpperCase()} ${response.config.url}`, {\n status: response.status,\n data: response.data,\n })\n return response\n})\n```\n\nOr register global interceptors applied to all clients:\n\n```ts\nepilot.interceptors.request((config) => {\n config.headers['x-correlation-id'] = generateTraceId()\n return config\n})\n```\n\n## Auto-Retry (429 Too Many Requests)\n\nThe SDK automatically retries requests that receive a `429 Too Many Requests` response. It respects the `Retry-After` header (in seconds) to determine how long to wait before retrying.\n\nEnabled by default with up to 3 retries.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\n// Customize retry behavior\nepilot.retry({ maxRetries: 5, defaultDelayMs: 2000 })\n\n// Disable retries\nepilot.retry({ maxRetries: 0 })\n```\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `maxRetries` | `3` | Maximum number of retries. Set to `0` to disable. |\n| `defaultDelayMs` | `1000` | Fallback delay in ms when `Retry-After` header is missing. |\n\nFor individually imported clients (tree-shakeable imports), apply the interceptor manually:\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/entity'\nimport { applyRetryInterceptor } from '@epilot/sdk'\n\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\napplyRetryInterceptor({ client: entityClient, config: { maxRetries: 3 } })\n```\n\n## Large Response Handling (413 Payload Too Large)\n\nepilot APIs use a [large response middleware](https://github.com/epilot-dev/aws-lambda-utility-middlewares) to work around the AWS Lambda 6MB response limit. When a response exceeds ~5.1MB, the API uploads the payload to S3 and returns a presigned URL instead.\n\nThe SDK handles this transparently \u2014 it sends the opt-in `Accept` header and automatically fetches the full payload from S3 when a large response URL is returned. Enabled by default.\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\n// Disable large response handling\nepilot.largeResponse({ enabled: false })\n```\n\nFor individually imported clients (tree-shakeable imports), apply the interceptor manually:\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/entity'\nimport { applyLargeResponseInterceptor } from '@epilot/sdk'\n\nconst entityClient = getClient()\nauthorize(entityClient, () => '<my-token>')\napplyLargeResponseInterceptor({ client: entityClient, config: { enabled: true } })\n```\n\n## Overrides & Custom APIs\n\nOverride built-in API specs or register custom APIs via `.epilot/sdk-overrides.json`. This is useful for testing new versions of an API spec or getting the latest types without waiting for an SDK release.\n\n```json\n{\n \"entity\": \"./specs/entity-openapi.json\",\n \"myNewApi\": \"./specs/my-new-api-openapi.json\"\n}\n```\n\n```ts\n// Built-in API with overridden spec\nconst { data } = await epilot.entity.getEntity({ slug: 'contact', id: '123' })\n```\n\n### Override Commands\n\n```bash\n# Apply all overrides from .epilot/sdk-overrides.json\nnpx epilot-sdk override\n\n# Override a single API\nnpx epilot-sdk override entity ./my-local-entity-spec.yaml\n\n# Regenerate types after spec changes\nnpx epilot-sdk typegen\n```\n\n<details>\n<summary>Migration from <code>@epilot/*-client</code></summary>\n\nDrop-in replacement \u2014 just change the import path:\n\n```ts\n// Before\nimport { getClient, createClient, authorize } from '@epilot/entity-client'\nimport type { Client, Entity } from '@epilot/entity-client'\n\n// After\nimport { getClient, createClient, authorize } from '@epilot/sdk/entity'\nimport type { Client, Entity } from '@epilot/sdk/entity'\n```\n\n</details>\n\n<details>\n<summary>Client Lifecycle</summary>\n\nWhen you call `authorize()`, `headers()`, `retry()`, `largeResponse()`, or `interceptors`, the SDK invalidates all cached client instances. The next operation call creates a fresh client with the updated configuration.\n\n**Operation methods are always up to date** \u2014 calls like `epilot.entity.getEntity(...)` re-resolve the client on every invocation, so they always use the latest config.\n\n**Direct `getClient()` references can go stale** \u2014 if you hold a reference and then change config, your reference still points to the old client:\n\n```ts\nconst entityClient = epilot.entity.getClient()\n\nepilot.authorize('new-token') // invalidates all cached clients\n\n// entityClient still has the old token\n// epilot.entity.getEntity(...) will use a new client with the new token\n```\n\nIf you need a long-lived reference that survives config changes, call `getClient()` again after changing config, or use operation methods directly.\n\n</details>\n";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.default = README_default;
|