@proveanything/smartlinks 2.0.60 → 2.0.63
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 +1 -0
- package/dist/adminCardPayload.d.ts +9 -0
- package/dist/adminCardPayload.js +61 -0
- package/dist/adminCardsView.d.ts +72 -0
- package/dist/adminCardsView.js +187 -0
- package/dist/api/adminCards.d.ts +13 -0
- package/dist/api/adminCards.js +36 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/integrations.d.ts +14 -1
- package/dist/api/integrations.js +21 -0
- package/dist/docs/API_SUMMARY.md +199 -1
- package/dist/docs/admin-cards.md +187 -0
- package/dist/docs/integrations.md +14 -3
- package/dist/docs/overview.md +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/openapi.yaml +430 -0
- package/dist/types/adminCards.d.ts +180 -0
- package/dist/types/adminCards.js +15 -0
- package/dist/types/appManifest.d.ts +14 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/integrations.d.ts +97 -0
- package/docs/API_SUMMARY.md +199 -1
- package/docs/admin-cards.md +187 -0
- package/docs/integrations.md +14 -3
- package/docs/overview.md +2 -0
- package/openapi.yaml +430 -0
- package/package.json +1 -1
- package/scripts/doctor.mjs +55 -2
package/dist/openapi.yaml
CHANGED
|
@@ -4417,6 +4417,65 @@ paths:
|
|
|
4417
4417
|
description: Unauthorized
|
|
4418
4418
|
404:
|
|
4419
4419
|
description: Not found
|
|
4420
|
+
/admin/collection/{collectionId}/integrations/health:
|
|
4421
|
+
get:
|
|
4422
|
+
tags:
|
|
4423
|
+
- integrations
|
|
4424
|
+
summary: "Every flow at a glance: paused?, running?, last 24h, backlog."
|
|
4425
|
+
operationId: integrations_getHealth
|
|
4426
|
+
security:
|
|
4427
|
+
- bearerAuth: []
|
|
4428
|
+
parameters:
|
|
4429
|
+
- name: collectionId
|
|
4430
|
+
in: path
|
|
4431
|
+
required: true
|
|
4432
|
+
schema:
|
|
4433
|
+
type: string
|
|
4434
|
+
responses:
|
|
4435
|
+
200:
|
|
4436
|
+
description: Success
|
|
4437
|
+
content:
|
|
4438
|
+
application/json:
|
|
4439
|
+
schema:
|
|
4440
|
+
$ref: "#/components/schemas/IntegrationHealth"
|
|
4441
|
+
400:
|
|
4442
|
+
description: Bad request
|
|
4443
|
+
401:
|
|
4444
|
+
description: Unauthorized
|
|
4445
|
+
404:
|
|
4446
|
+
description: Not found
|
|
4447
|
+
/admin/collection/{collectionId}/integrations/lineage/product/{productId}:
|
|
4448
|
+
get:
|
|
4449
|
+
tags:
|
|
4450
|
+
- integrations
|
|
4451
|
+
summary: "Where a product's data came from (the provider record, when it was fetched and imported, by which run, with the current mapping or an older one) and where it went (each outbound flow's last delivery)."
|
|
4452
|
+
operationId: integrations_getProductLineage
|
|
4453
|
+
security:
|
|
4454
|
+
- bearerAuth: []
|
|
4455
|
+
parameters:
|
|
4456
|
+
- name: collectionId
|
|
4457
|
+
in: path
|
|
4458
|
+
required: true
|
|
4459
|
+
schema:
|
|
4460
|
+
type: string
|
|
4461
|
+
- name: productId
|
|
4462
|
+
in: path
|
|
4463
|
+
required: true
|
|
4464
|
+
schema:
|
|
4465
|
+
type: string
|
|
4466
|
+
responses:
|
|
4467
|
+
200:
|
|
4468
|
+
description: Success
|
|
4469
|
+
content:
|
|
4470
|
+
application/json:
|
|
4471
|
+
schema:
|
|
4472
|
+
$ref: "#/components/schemas/ProductLineage"
|
|
4473
|
+
400:
|
|
4474
|
+
description: Bad request
|
|
4475
|
+
401:
|
|
4476
|
+
description: Unauthorized
|
|
4477
|
+
404:
|
|
4478
|
+
description: Not found
|
|
4420
4479
|
/admin/collection/{collectionId}/integrations/record-types:
|
|
4421
4480
|
get:
|
|
4422
4481
|
tags:
|
|
@@ -15474,6 +15533,212 @@ components:
|
|
|
15474
15533
|
name: X-API-Key
|
|
15475
15534
|
description: API key for server-to-server calls
|
|
15476
15535
|
schemas:
|
|
15536
|
+
AdminCardRefresh:
|
|
15537
|
+
type: object
|
|
15538
|
+
properties:
|
|
15539
|
+
on:
|
|
15540
|
+
type: array
|
|
15541
|
+
items:
|
|
15542
|
+
$ref: "#/components/schemas/AdminCardRefreshOn"
|
|
15543
|
+
maxAge:
|
|
15544
|
+
type: object
|
|
15545
|
+
additionalProperties: true
|
|
15546
|
+
AdminCardDeclaration:
|
|
15547
|
+
type: object
|
|
15548
|
+
properties:
|
|
15549
|
+
id:
|
|
15550
|
+
type: string
|
|
15551
|
+
title:
|
|
15552
|
+
type: string
|
|
15553
|
+
description:
|
|
15554
|
+
type: string
|
|
15555
|
+
kind:
|
|
15556
|
+
type: string
|
|
15557
|
+
enum:
|
|
15558
|
+
- data
|
|
15559
|
+
- component
|
|
15560
|
+
function:
|
|
15561
|
+
type: string
|
|
15562
|
+
component:
|
|
15563
|
+
type: string
|
|
15564
|
+
sizes:
|
|
15565
|
+
type: array
|
|
15566
|
+
items:
|
|
15567
|
+
$ref: "#/components/schemas/AdminCardSize"
|
|
15568
|
+
priority:
|
|
15569
|
+
type: number
|
|
15570
|
+
levels:
|
|
15571
|
+
type: array
|
|
15572
|
+
items:
|
|
15573
|
+
type: string
|
|
15574
|
+
enum:
|
|
15575
|
+
- collection
|
|
15576
|
+
refresh:
|
|
15577
|
+
$ref: "#/components/schemas/AdminCardRefresh"
|
|
15578
|
+
required:
|
|
15579
|
+
- id
|
|
15580
|
+
- title
|
|
15581
|
+
AppManifestAdminCards:
|
|
15582
|
+
type: object
|
|
15583
|
+
properties:
|
|
15584
|
+
cards:
|
|
15585
|
+
type: array
|
|
15586
|
+
items:
|
|
15587
|
+
$ref: "#/components/schemas/AdminCardDeclaration"
|
|
15588
|
+
files:
|
|
15589
|
+
type: object
|
|
15590
|
+
additionalProperties: true
|
|
15591
|
+
js:
|
|
15592
|
+
type: object
|
|
15593
|
+
additionalProperties: true
|
|
15594
|
+
css:
|
|
15595
|
+
type: string
|
|
15596
|
+
required:
|
|
15597
|
+
- cards
|
|
15598
|
+
- js
|
|
15599
|
+
AdminCardAction:
|
|
15600
|
+
type: object
|
|
15601
|
+
properties:
|
|
15602
|
+
label:
|
|
15603
|
+
type: string
|
|
15604
|
+
path:
|
|
15605
|
+
type: string
|
|
15606
|
+
url:
|
|
15607
|
+
type: string
|
|
15608
|
+
required:
|
|
15609
|
+
- label
|
|
15610
|
+
AdminCardPayload:
|
|
15611
|
+
type: object
|
|
15612
|
+
properties:
|
|
15613
|
+
title:
|
|
15614
|
+
type: string
|
|
15615
|
+
value:
|
|
15616
|
+
type: object
|
|
15617
|
+
additionalProperties: true
|
|
15618
|
+
label:
|
|
15619
|
+
type: string
|
|
15620
|
+
unit:
|
|
15621
|
+
type: string
|
|
15622
|
+
trend:
|
|
15623
|
+
type: object
|
|
15624
|
+
additionalProperties: true
|
|
15625
|
+
status:
|
|
15626
|
+
type: object
|
|
15627
|
+
additionalProperties: true
|
|
15628
|
+
progress:
|
|
15629
|
+
type: object
|
|
15630
|
+
additionalProperties: true
|
|
15631
|
+
items:
|
|
15632
|
+
type: array
|
|
15633
|
+
items:
|
|
15634
|
+
type: object
|
|
15635
|
+
additionalProperties: true
|
|
15636
|
+
todo:
|
|
15637
|
+
type: array
|
|
15638
|
+
items:
|
|
15639
|
+
type: object
|
|
15640
|
+
additionalProperties: true
|
|
15641
|
+
actions:
|
|
15642
|
+
type: array
|
|
15643
|
+
items:
|
|
15644
|
+
$ref: "#/components/schemas/AdminCardAction"
|
|
15645
|
+
empty:
|
|
15646
|
+
type: object
|
|
15647
|
+
additionalProperties: true
|
|
15648
|
+
AdminCard:
|
|
15649
|
+
type: object
|
|
15650
|
+
properties:
|
|
15651
|
+
key:
|
|
15652
|
+
type: string
|
|
15653
|
+
appId:
|
|
15654
|
+
type: string
|
|
15655
|
+
cardId:
|
|
15656
|
+
type: string
|
|
15657
|
+
title:
|
|
15658
|
+
type: string
|
|
15659
|
+
description:
|
|
15660
|
+
type: string
|
|
15661
|
+
kind:
|
|
15662
|
+
type: string
|
|
15663
|
+
enum:
|
|
15664
|
+
- data
|
|
15665
|
+
- component
|
|
15666
|
+
sizes:
|
|
15667
|
+
type: array
|
|
15668
|
+
items:
|
|
15669
|
+
$ref: "#/components/schemas/AdminCardSize"
|
|
15670
|
+
size:
|
|
15671
|
+
$ref: "#/components/schemas/AdminCardSize"
|
|
15672
|
+
priority:
|
|
15673
|
+
type: number
|
|
15674
|
+
state:
|
|
15675
|
+
$ref: "#/components/schemas/AdminCardState"
|
|
15676
|
+
payload:
|
|
15677
|
+
$ref: "#/components/schemas/AdminCardPayload"
|
|
15678
|
+
computedAt:
|
|
15679
|
+
type: number
|
|
15680
|
+
error:
|
|
15681
|
+
type: string
|
|
15682
|
+
component:
|
|
15683
|
+
type: object
|
|
15684
|
+
additionalProperties: true
|
|
15685
|
+
required:
|
|
15686
|
+
- key
|
|
15687
|
+
- appId
|
|
15688
|
+
- cardId
|
|
15689
|
+
- title
|
|
15690
|
+
- kind
|
|
15691
|
+
- sizes
|
|
15692
|
+
- size
|
|
15693
|
+
- priority
|
|
15694
|
+
- state
|
|
15695
|
+
- payload
|
|
15696
|
+
- computedAt
|
|
15697
|
+
StudioHomeLayout:
|
|
15698
|
+
type: object
|
|
15699
|
+
properties:
|
|
15700
|
+
version:
|
|
15701
|
+
type: object
|
|
15702
|
+
additionalProperties: true
|
|
15703
|
+
cards:
|
|
15704
|
+
type: array
|
|
15705
|
+
items:
|
|
15706
|
+
type: object
|
|
15707
|
+
additionalProperties: true
|
|
15708
|
+
required:
|
|
15709
|
+
- version
|
|
15710
|
+
- cards
|
|
15711
|
+
AdminCardsResponse:
|
|
15712
|
+
type: object
|
|
15713
|
+
properties:
|
|
15714
|
+
cards:
|
|
15715
|
+
type: array
|
|
15716
|
+
items:
|
|
15717
|
+
$ref: "#/components/schemas/AdminCard"
|
|
15718
|
+
hidden:
|
|
15719
|
+
type: array
|
|
15720
|
+
items:
|
|
15721
|
+
$ref: "#/components/schemas/AdminCard"
|
|
15722
|
+
layout:
|
|
15723
|
+
$ref: "#/components/schemas/StudioHomeLayout"
|
|
15724
|
+
required:
|
|
15725
|
+
- cards
|
|
15726
|
+
- hidden
|
|
15727
|
+
- layout
|
|
15728
|
+
AdminCardSize:
|
|
15729
|
+
type: string
|
|
15730
|
+
enum:
|
|
15731
|
+
- small
|
|
15732
|
+
- medium
|
|
15733
|
+
- wide
|
|
15734
|
+
- full
|
|
15735
|
+
AdminCardRefreshOn:
|
|
15736
|
+
type: object
|
|
15737
|
+
additionalProperties: true
|
|
15738
|
+
AdminCardState:
|
|
15739
|
+
type: string
|
|
15740
|
+
enum:
|
|
15741
|
+
- fresh
|
|
15477
15742
|
ContentPart:
|
|
15478
15743
|
type: object
|
|
15479
15744
|
properties:
|
|
@@ -19648,6 +19913,8 @@ components:
|
|
|
19648
19913
|
realtime:
|
|
19649
19914
|
type: object
|
|
19650
19915
|
additionalProperties: true
|
|
19916
|
+
adminCards:
|
|
19917
|
+
$ref: "#/components/schemas/AppManifestAdminCards"
|
|
19651
19918
|
data:
|
|
19652
19919
|
$ref: "#/components/schemas/AppDataDeclaration"
|
|
19653
19920
|
headless:
|
|
@@ -26345,6 +26612,169 @@ components:
|
|
|
26345
26612
|
- id
|
|
26346
26613
|
- status
|
|
26347
26614
|
- attempts
|
|
26615
|
+
FlowHealth:
|
|
26616
|
+
type: object
|
|
26617
|
+
properties:
|
|
26618
|
+
flowId:
|
|
26619
|
+
type: string
|
|
26620
|
+
name:
|
|
26621
|
+
type: string
|
|
26622
|
+
direction:
|
|
26623
|
+
$ref: "#/components/schemas/FlowDirection"
|
|
26624
|
+
status:
|
|
26625
|
+
$ref: "#/components/schemas/FlowStatus"
|
|
26626
|
+
paused:
|
|
26627
|
+
type: object
|
|
26628
|
+
additionalProperties: true
|
|
26629
|
+
running:
|
|
26630
|
+
type: object
|
|
26631
|
+
additionalProperties: true
|
|
26632
|
+
lastRun:
|
|
26633
|
+
type: object
|
|
26634
|
+
additionalProperties: true
|
|
26635
|
+
last24h:
|
|
26636
|
+
type: object
|
|
26637
|
+
additionalProperties: true
|
|
26638
|
+
runs:
|
|
26639
|
+
type: number
|
|
26640
|
+
byStatus:
|
|
26641
|
+
type: object
|
|
26642
|
+
additionalProperties:
|
|
26643
|
+
type: number
|
|
26644
|
+
records:
|
|
26645
|
+
type: number
|
|
26646
|
+
delivered:
|
|
26647
|
+
type: number
|
|
26648
|
+
failed:
|
|
26649
|
+
type: number
|
|
26650
|
+
failureRate:
|
|
26651
|
+
type: number
|
|
26652
|
+
avgRunMs:
|
|
26653
|
+
type: number
|
|
26654
|
+
recordsPerSecond:
|
|
26655
|
+
type: number
|
|
26656
|
+
backlog:
|
|
26657
|
+
type: object
|
|
26658
|
+
additionalProperties: true
|
|
26659
|
+
landed:
|
|
26660
|
+
type: number
|
|
26661
|
+
waiting:
|
|
26662
|
+
type: number
|
|
26663
|
+
oldestWaitingSince:
|
|
26664
|
+
type: string
|
|
26665
|
+
retrying:
|
|
26666
|
+
type: number
|
|
26667
|
+
retriesDue:
|
|
26668
|
+
type: number
|
|
26669
|
+
gaveUp:
|
|
26670
|
+
type: number
|
|
26671
|
+
required:
|
|
26672
|
+
- flowId
|
|
26673
|
+
- name
|
|
26674
|
+
- direction
|
|
26675
|
+
- status
|
|
26676
|
+
- paused
|
|
26677
|
+
- running
|
|
26678
|
+
- lastRun
|
|
26679
|
+
- last24h
|
|
26680
|
+
- runs
|
|
26681
|
+
- byStatus
|
|
26682
|
+
- records
|
|
26683
|
+
- delivered
|
|
26684
|
+
- failed
|
|
26685
|
+
- failureRate
|
|
26686
|
+
- avgRunMs
|
|
26687
|
+
- recordsPerSecond
|
|
26688
|
+
- backlog
|
|
26689
|
+
- retrying
|
|
26690
|
+
- retriesDue
|
|
26691
|
+
- gaveUp
|
|
26692
|
+
IntegrationHealth:
|
|
26693
|
+
type: object
|
|
26694
|
+
properties:
|
|
26695
|
+
flows:
|
|
26696
|
+
type: array
|
|
26697
|
+
items:
|
|
26698
|
+
$ref: "#/components/schemas/FlowHealth"
|
|
26699
|
+
summary:
|
|
26700
|
+
type: object
|
|
26701
|
+
additionalProperties: true
|
|
26702
|
+
required:
|
|
26703
|
+
- flows
|
|
26704
|
+
- summary
|
|
26705
|
+
ProductLineage:
|
|
26706
|
+
type: object
|
|
26707
|
+
properties:
|
|
26708
|
+
productId:
|
|
26709
|
+
type: string
|
|
26710
|
+
sources:
|
|
26711
|
+
type: object
|
|
26712
|
+
additionalProperties: true
|
|
26713
|
+
source:
|
|
26714
|
+
type: string
|
|
26715
|
+
externalId:
|
|
26716
|
+
type: string
|
|
26717
|
+
flow:
|
|
26718
|
+
type: object
|
|
26719
|
+
additionalProperties: true
|
|
26720
|
+
fetchedAt:
|
|
26721
|
+
type: string
|
|
26722
|
+
processedAt:
|
|
26723
|
+
type: string
|
|
26724
|
+
processedRunId:
|
|
26725
|
+
type: string
|
|
26726
|
+
status:
|
|
26727
|
+
type: string
|
|
26728
|
+
enum:
|
|
26729
|
+
- sent
|
|
26730
|
+
- failed
|
|
26731
|
+
- dead
|
|
26732
|
+
lastError:
|
|
26733
|
+
type: string
|
|
26734
|
+
currentMapping:
|
|
26735
|
+
type: boolean
|
|
26736
|
+
mapping:
|
|
26737
|
+
type: array
|
|
26738
|
+
items:
|
|
26739
|
+
$ref: "#/components/schemas/FieldMapping"
|
|
26740
|
+
payload: {}
|
|
26741
|
+
deliveries:
|
|
26742
|
+
type: object
|
|
26743
|
+
additionalProperties: true
|
|
26744
|
+
lastSentAt:
|
|
26745
|
+
type: string
|
|
26746
|
+
attempts:
|
|
26747
|
+
type: number
|
|
26748
|
+
nextAttemptAt:
|
|
26749
|
+
type: string
|
|
26750
|
+
lastRunId:
|
|
26751
|
+
type: string
|
|
26752
|
+
recentRuns:
|
|
26753
|
+
type: array
|
|
26754
|
+
items:
|
|
26755
|
+
$ref: "#/components/schemas/FlowRun"
|
|
26756
|
+
required:
|
|
26757
|
+
- productId
|
|
26758
|
+
- sources
|
|
26759
|
+
- source
|
|
26760
|
+
- externalId
|
|
26761
|
+
- flow
|
|
26762
|
+
- fetchedAt
|
|
26763
|
+
- processedAt
|
|
26764
|
+
- processedRunId
|
|
26765
|
+
- status
|
|
26766
|
+
- lastError
|
|
26767
|
+
- currentMapping
|
|
26768
|
+
- mapping
|
|
26769
|
+
- deliveries
|
|
26770
|
+
- flow
|
|
26771
|
+
- status
|
|
26772
|
+
- lastSentAt
|
|
26773
|
+
- attempts
|
|
26774
|
+
- nextAttemptAt
|
|
26775
|
+
- lastError
|
|
26776
|
+
- lastRunId
|
|
26777
|
+
- recentRuns
|
|
26348
26778
|
FailedRecordList:
|
|
26349
26779
|
type: object
|
|
26350
26780
|
properties:
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin cards — what an app contributes to a collection's dashboard in Studio (docs/admin-cards.md).
|
|
3
|
+
*
|
|
4
|
+
* Two kinds, one contract:
|
|
5
|
+
* - **data** (the default, any publisher): the app declares the card and an ADMIN server function that
|
|
6
|
+
* returns an {@link AdminCardPayload}; Studio draws it. No app code runs in Studio.
|
|
7
|
+
* - **component** (first-party and approved publishers): a React component from the app's
|
|
8
|
+
* `adminCards` bundle, given the same cached payload as its `data` prop.
|
|
9
|
+
*
|
|
10
|
+
* Fast by construction: Studio loads every card in ONE request, served from a cache. A card is only
|
|
11
|
+
* recomputed when something it declares in `refresh.on` changed (or `refresh.maxAge` passed), in the
|
|
12
|
+
* background, within a time and size budget — so a dashboard never waits on 20 functions.
|
|
13
|
+
*/
|
|
14
|
+
/** Grid widths on a 12-column dashboard: small 3, medium 6, wide 8, full 12. One column on phones. */
|
|
15
|
+
export type AdminCardSize = 'small' | 'medium' | 'wide' | 'full';
|
|
16
|
+
/**
|
|
17
|
+
* What a card's data depends on — a change of this kind marks it stale. `records` / `records:<type>`
|
|
18
|
+
* are THIS app's records; the rest are the collection's.
|
|
19
|
+
*/
|
|
20
|
+
export type AdminCardRefreshOn = 'records' | `records:${string}` | 'products' | 'proofs' | 'assets' | 'apps' | 'collection' | 'settings' | `settings:${string}`;
|
|
21
|
+
export interface AdminCardRefresh {
|
|
22
|
+
/** Recompute when any of these change. Leave out only for data that changes without an event. */
|
|
23
|
+
on?: AdminCardRefreshOn[];
|
|
24
|
+
/**
|
|
25
|
+
* The longest a payload is shown before it's recomputed anyway: seconds, or "30m" / "6h" / "2d".
|
|
26
|
+
* Default 6h; minimum 1m. Use it for data with no change event (visits, time-based counts).
|
|
27
|
+
*/
|
|
28
|
+
maxAge?: number | string;
|
|
29
|
+
}
|
|
30
|
+
/** One card an app contributes — `app.manifest.json` → `adminCards.cards[]`. */
|
|
31
|
+
export interface AdminCardDeclaration {
|
|
32
|
+
/** Unique within the app: letters, digits, `-` and `_`, up to 40. */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Shown as the card's heading (the payload may override it). */
|
|
35
|
+
title: string;
|
|
36
|
+
/** One line for the "add a card" picker. */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** `data` (default) or `component`. */
|
|
39
|
+
kind?: 'data' | 'component';
|
|
40
|
+
/**
|
|
41
|
+
* The ADMIN http server function that returns this card's {@link AdminCardPayload} (a function
|
|
42
|
+
* declared in `functions.definitions` with `visibility: "admin"`). Required for `data` cards;
|
|
43
|
+
* optional for `component` cards, whose component then gets the payload as `data`.
|
|
44
|
+
*/
|
|
45
|
+
function?: string;
|
|
46
|
+
/** `component` cards: the export name in the `adminCards` bundle. */
|
|
47
|
+
component?: string;
|
|
48
|
+
/** Sizes the card supports; the first is its default. Default `["medium"]`. */
|
|
49
|
+
sizes?: AdminCardSize[];
|
|
50
|
+
/** Lower comes first when the collection hasn't arranged its dashboard. Default 100. */
|
|
51
|
+
priority?: number;
|
|
52
|
+
/** Where the card can appear. Only `collection` (the dashboard) today. */
|
|
53
|
+
levels?: Array<'collection'>;
|
|
54
|
+
refresh?: AdminCardRefresh;
|
|
55
|
+
}
|
|
56
|
+
/** `app.manifest.json` → `adminCards`. */
|
|
57
|
+
export interface AppManifestAdminCards {
|
|
58
|
+
cards: AdminCardDeclaration[];
|
|
59
|
+
/** The `adminCards` bundle — only when the app has `component` cards. */
|
|
60
|
+
files?: {
|
|
61
|
+
js: {
|
|
62
|
+
umd: string;
|
|
63
|
+
esm?: string;
|
|
64
|
+
};
|
|
65
|
+
css?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** A link from a card into the app's admin (`path`, e.g. "/enquiries?status=new") or elsewhere (`url`). */
|
|
69
|
+
export interface AdminCardAction {
|
|
70
|
+
label: string;
|
|
71
|
+
/** A path inside this app's admin. */
|
|
72
|
+
path?: string;
|
|
73
|
+
/** An absolute https URL (opens in a new tab). */
|
|
74
|
+
url?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What a card's function returns. Every field is optional — return the ones the card needs. Studio
|
|
78
|
+
* draws them in a fixed, consistent layout; there's no HTML or styling. Max ~8KB as JSON.
|
|
79
|
+
*/
|
|
80
|
+
export interface AdminCardPayload {
|
|
81
|
+
/** Overrides the declared title (e.g. "3 new enquiries"). */
|
|
82
|
+
title?: string;
|
|
83
|
+
/** The headline number or short value. */
|
|
84
|
+
value?: number | string;
|
|
85
|
+
/** Shown after/under the value ("enquiries this week"). */
|
|
86
|
+
label?: string;
|
|
87
|
+
unit?: string;
|
|
88
|
+
/** Change against a previous period. `good` says whether this direction is good news (for colour). */
|
|
89
|
+
trend?: {
|
|
90
|
+
direction: 'up' | 'down' | 'flat';
|
|
91
|
+
label?: string;
|
|
92
|
+
good?: boolean;
|
|
93
|
+
};
|
|
94
|
+
/** One status line. `attention` and `error` also surface in the To do strip. */
|
|
95
|
+
status?: {
|
|
96
|
+
tone: 'ok' | 'attention' | 'neutral' | 'error';
|
|
97
|
+
text: string;
|
|
98
|
+
};
|
|
99
|
+
/** Setup or completion progress ("4 of 6 steps"). */
|
|
100
|
+
progress?: {
|
|
101
|
+
done: number;
|
|
102
|
+
total: number;
|
|
103
|
+
label?: string;
|
|
104
|
+
};
|
|
105
|
+
/** A short list — at most 5 are shown. */
|
|
106
|
+
items?: Array<{
|
|
107
|
+
title: string;
|
|
108
|
+
subtitle?: string;
|
|
109
|
+
meta?: string;
|
|
110
|
+
path?: string;
|
|
111
|
+
}>;
|
|
112
|
+
/** Things that need doing — collected into the dashboard's To do strip. */
|
|
113
|
+
todo?: Array<{
|
|
114
|
+
text: string;
|
|
115
|
+
action?: AdminCardAction;
|
|
116
|
+
}>;
|
|
117
|
+
/** At most two buttons. */
|
|
118
|
+
actions?: AdminCardAction[];
|
|
119
|
+
/** Shown instead of the body when there's nothing yet ("No enquiries yet"). */
|
|
120
|
+
empty?: {
|
|
121
|
+
text: string;
|
|
122
|
+
action?: AdminCardAction;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** How fresh a card's payload is. */
|
|
126
|
+
export type AdminCardState =
|
|
127
|
+
/** Up to date. */
|
|
128
|
+
'fresh'
|
|
129
|
+
/** The last payload, being recomputed in the background (a newer one arrives by realtime). */
|
|
130
|
+
| 'stale'
|
|
131
|
+
/** Never computed yet, and not ready in time — it arrives by realtime. */
|
|
132
|
+
| 'pending'
|
|
133
|
+
/** The last attempt failed; `payload` is the last good one, if any. */
|
|
134
|
+
| 'error';
|
|
135
|
+
/** One card on the dashboard, as `adminCards.list` returns it — in display order. */
|
|
136
|
+
export interface AdminCard {
|
|
137
|
+
/** `<appId>:<cardId>` — the key used in the layout. */
|
|
138
|
+
key: string;
|
|
139
|
+
/** The contributing app, or `platform` for Studio's own cards (products, contacts, visitors). */
|
|
140
|
+
appId: string;
|
|
141
|
+
cardId: string;
|
|
142
|
+
title: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
kind: 'data' | 'component';
|
|
145
|
+
sizes: AdminCardSize[];
|
|
146
|
+
/** The size to draw it at (the layout's choice, else the card's default). */
|
|
147
|
+
size: AdminCardSize;
|
|
148
|
+
priority: number;
|
|
149
|
+
state: AdminCardState;
|
|
150
|
+
payload: AdminCardPayload | null;
|
|
151
|
+
/** When `payload` was computed (ms since epoch). */
|
|
152
|
+
computedAt: number | null;
|
|
153
|
+
/** Why the last attempt failed (state `error`). */
|
|
154
|
+
error?: string;
|
|
155
|
+
/** `component` cards: the bundle to load and the export to mount. */
|
|
156
|
+
component?: {
|
|
157
|
+
name: string;
|
|
158
|
+
files: NonNullable<AppManifestAdminCards['files']>;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A collection's dashboard layout — the `studioHome` settings group. Owned by the collection (every
|
|
163
|
+
* admin sees the same dashboard). Cards not listed follow, by priority; installed apps' new cards
|
|
164
|
+
* appear on their own; cards of uninstalled apps drop out.
|
|
165
|
+
*/
|
|
166
|
+
export interface StudioHomeLayout {
|
|
167
|
+
version: 1;
|
|
168
|
+
cards: Array<{
|
|
169
|
+
key: string;
|
|
170
|
+
size?: AdminCardSize;
|
|
171
|
+
hidden?: boolean;
|
|
172
|
+
}>;
|
|
173
|
+
}
|
|
174
|
+
/** `adminCards.list` → the whole dashboard in one call. */
|
|
175
|
+
export interface AdminCardsResponse {
|
|
176
|
+
cards: AdminCard[];
|
|
177
|
+
/** Cards the layout hides (for the "add a card" picker). */
|
|
178
|
+
hidden: AdminCard[];
|
|
179
|
+
layout: StudioHomeLayout | null;
|
|
180
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/types/adminCards.ts
|
|
2
|
+
/**
|
|
3
|
+
* Admin cards — what an app contributes to a collection's dashboard in Studio (docs/admin-cards.md).
|
|
4
|
+
*
|
|
5
|
+
* Two kinds, one contract:
|
|
6
|
+
* - **data** (the default, any publisher): the app declares the card and an ADMIN server function that
|
|
7
|
+
* returns an {@link AdminCardPayload}; Studio draws it. No app code runs in Studio.
|
|
8
|
+
* - **component** (first-party and approved publishers): a React component from the app's
|
|
9
|
+
* `adminCards` bundle, given the same cached payload as its `data` prop.
|
|
10
|
+
*
|
|
11
|
+
* Fast by construction: Studio loads every card in ONE request, served from a cache. A card is only
|
|
12
|
+
* recomputed when something it declares in `refresh.on` changed (or `refresh.maxAge` passed), in the
|
|
13
|
+
* background, within a time and size budget — so a dashboard never waits on 20 functions.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import type { AppDataDeclaration, AppHeadlessDeclaration } from './headless.js';
|
|
4
4
|
import type { RealtimeChannelDeclaration } from './realtime.js';
|
|
5
|
+
import type { AppManifestAdminCards } from './adminCards.js';
|
|
5
6
|
/**
|
|
6
7
|
* A bundle (widget or container) as returned by the collection widgets endpoint.
|
|
7
8
|
*
|
|
@@ -817,6 +818,19 @@ export interface AppManifest {
|
|
|
817
818
|
realtime?: {
|
|
818
819
|
channels: RealtimeChannelDeclaration[];
|
|
819
820
|
};
|
|
821
|
+
/**
|
|
822
|
+
* Cards this app adds to the collection's dashboard in Studio. A `data` card names an ADMIN server
|
|
823
|
+
* function returning an `AdminCardPayload`; Studio draws it, from a cache, recomputing only when
|
|
824
|
+
* something in `refresh.on` changed. @see AdminCardDeclaration · docs/admin-cards.md
|
|
825
|
+
*
|
|
826
|
+
* ```json
|
|
827
|
+
* "adminCards": { "cards": [
|
|
828
|
+
* { "id": "unanswered", "title": "FAQ", "function": "cardUnanswered", "sizes": ["small", "medium"],
|
|
829
|
+
* "refresh": { "on": ["records:question"], "maxAge": "1d" } }
|
|
830
|
+
* ] }
|
|
831
|
+
* ```
|
|
832
|
+
*/
|
|
833
|
+
adminCards?: AppManifestAdminCards;
|
|
820
834
|
/**
|
|
821
835
|
* The app's public data model: its data types, how each is stored, fields, examples and read
|
|
822
836
|
* recipes. Required for `headless`. @see AppDataDeclaration · docs/headless-providers.md
|
package/dist/types/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from "./analytics.js";
|
|
|
25
25
|
export * from "./location.js";
|
|
26
26
|
export * from "./jobs.js";
|
|
27
27
|
export * from "./realtime.js";
|
|
28
|
+
export * from "./adminCards.js";
|
|
28
29
|
export * from "./tags.js";
|
|
29
30
|
export * from "./navigation.js";
|
|
30
31
|
export * from "./order.js";
|
package/dist/types/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./analytics.js";
|
|
|
27
27
|
export * from "./location.js";
|
|
28
28
|
export * from "./jobs.js";
|
|
29
29
|
export * from "./realtime.js";
|
|
30
|
+
export * from "./adminCards.js";
|
|
30
31
|
export * from "./tags.js";
|
|
31
32
|
export * from "./navigation.js";
|
|
32
33
|
export * from "./order.js";
|