@proveanything/smartlinks 1.16.6 → 1.17.0

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/dist/openapi.yaml CHANGED
@@ -1261,6 +1261,11 @@ paths:
1261
1261
  required: false
1262
1262
  schema:
1263
1263
  type: string
1264
+ - name: moderationStatus
1265
+ in: query
1266
+ required: false
1267
+ schema:
1268
+ $ref: "#/components/schemas/AttestationModerationStatus"
1264
1269
  - name: recordedAfter
1265
1270
  in: query
1266
1271
  required: false
@@ -10237,6 +10242,11 @@ paths:
10237
10242
  required: false
10238
10243
  schema:
10239
10244
  type: string
10245
+ - name: moderationStatus
10246
+ in: query
10247
+ required: false
10248
+ schema:
10249
+ $ref: "#/components/schemas/AttestationModerationStatus"
10240
10250
  - name: recordedAfter
10241
10251
  in: query
10242
10252
  required: false
@@ -10273,7 +10283,7 @@ paths:
10273
10283
  post:
10274
10284
  tags:
10275
10285
  - attestations
10276
- summary: "Create an OWNER-authored attestation (public write) — the counterpart to the admin {@link create}."
10286
+ summary: attestations.publicCreate
10277
10287
  operationId: attestations_publicCreate
10278
10288
  security: []
10279
10289
  parameters:
@@ -10505,6 +10515,43 @@ paths:
10505
10515
  description: Unauthorized
10506
10516
  404:
10507
10517
  description: Not found
10518
+ /public/collection/{collectionId}/attestations/{attestationId}/moderate:
10519
+ post:
10520
+ tags:
10521
+ - attestations
10522
+ summary: Moderate a contributed attestation (proof OWNER by identity, or collection admin).
10523
+ operationId: attestations_moderate
10524
+ security: []
10525
+ parameters:
10526
+ - name: collectionId
10527
+ in: path
10528
+ required: true
10529
+ schema:
10530
+ type: string
10531
+ - name: attestationId
10532
+ in: path
10533
+ required: true
10534
+ schema:
10535
+ type: string
10536
+ responses:
10537
+ 200:
10538
+ description: Success
10539
+ content:
10540
+ application/json:
10541
+ schema:
10542
+ $ref: "#/components/schemas/ModerateAttestationResponse"
10543
+ 400:
10544
+ description: Bad request
10545
+ 401:
10546
+ description: Unauthorized
10547
+ 404:
10548
+ description: Not found
10549
+ requestBody:
10550
+ required: true
10551
+ content:
10552
+ application/json:
10553
+ schema:
10554
+ $ref: "#/components/schemas/ModerateAttestationInput"
10508
10555
  /public/collection/{collectionId}/comm/email/register:
10509
10556
  post:
10510
10557
  tags:
@@ -11115,6 +11162,11 @@ paths:
11115
11162
  required: false
11116
11163
  schema:
11117
11164
  type: string
11165
+ - name: moderationStatus
11166
+ in: query
11167
+ required: false
11168
+ schema:
11169
+ $ref: "#/components/schemas/AttestationModerationStatus"
11118
11170
  - name: recordedAfter
11119
11171
  in: query
11120
11172
  required: false
@@ -18720,6 +18772,10 @@ components:
18720
18772
  type: string
18721
18773
  authorId:
18722
18774
  type: string
18775
+ grantId:
18776
+ type: string
18777
+ moderationStatus:
18778
+ $ref: "#/components/schemas/AttestationModerationStatus"
18723
18779
  metadata:
18724
18780
  type: object
18725
18781
  additionalProperties: true
@@ -18842,10 +18898,29 @@ components:
18842
18898
  metadata:
18843
18899
  type: object
18844
18900
  additionalProperties: true
18901
+ guestName:
18902
+ type: string
18845
18903
  required:
18846
18904
  - subjectType
18847
18905
  - subjectId
18848
18906
  - attestationType
18907
+ ModerateAttestationInput:
18908
+ type: object
18909
+ properties:
18910
+ decision:
18911
+ type: string
18912
+ enum:
18913
+ - approve
18914
+ - reject
18915
+ required:
18916
+ - decision
18917
+ ModerateAttestationResponse:
18918
+ type: object
18919
+ properties:
18920
+ attestation:
18921
+ $ref: "#/components/schemas/Attestation"
18922
+ required:
18923
+ - attestation
18849
18924
  ListAttestationsResponse:
18850
18925
  type: object
18851
18926
  properties:
@@ -18985,6 +19060,8 @@ components:
18985
19060
  type: string
18986
19061
  attestationType:
18987
19062
  type: string
19063
+ moderationStatus:
19064
+ $ref: "#/components/schemas/AttestationModerationStatus"
18988
19065
  recordedAfter:
18989
19066
  type: string
18990
19067
  recordedBefore:
@@ -22783,6 +22860,276 @@ components:
22783
22860
  UploadMessage:
22784
22861
  type: object
22785
22862
  additionalProperties: true
22863
+ FieldMapping:
22864
+ type: object
22865
+ properties:
22866
+ targetPath:
22867
+ type: string
22868
+ sourcePath:
22869
+ type: string
22870
+ transformType:
22871
+ $ref: "#/components/schemas/TransformType"
22872
+ transformExpression:
22873
+ type: string
22874
+ required:
22875
+ - targetPath
22876
+ - transformType
22877
+ FlowConnectionAuth:
22878
+ type: object
22879
+ properties:
22880
+ method:
22881
+ $ref: "#/components/schemas/FlowAuthMethod"
22882
+ headerName:
22883
+ type: string
22884
+ credentialRef:
22885
+ type: string
22886
+ required:
22887
+ - method
22888
+ FlowConnection:
22889
+ type: object
22890
+ properties:
22891
+ baseUrl:
22892
+ type: string
22893
+ sendEndpoint:
22894
+ type: string
22895
+ fetchEndpoint:
22896
+ type: string
22897
+ defaultHeaders:
22898
+ type: object
22899
+ additionalProperties:
22900
+ type: string
22901
+ auth:
22902
+ $ref: "#/components/schemas/FlowConnectionAuth"
22903
+ IntegrationFlowConfig:
22904
+ type: object
22905
+ properties:
22906
+ connection:
22907
+ $ref: "#/components/schemas/FlowConnection"
22908
+ fieldMappings:
22909
+ type: array
22910
+ items:
22911
+ $ref: "#/components/schemas/FieldMapping"
22912
+ IntegrationFlow:
22913
+ type: object
22914
+ properties:
22915
+ id:
22916
+ type: string
22917
+ orgId:
22918
+ type: string
22919
+ collectionId:
22920
+ type: string
22921
+ appId:
22922
+ type: string
22923
+ direction:
22924
+ $ref: "#/components/schemas/FlowDirection"
22925
+ name:
22926
+ type: string
22927
+ status:
22928
+ $ref: "#/components/schemas/FlowStatus"
22929
+ eventTypes:
22930
+ type: array
22931
+ items:
22932
+ type: string
22933
+ schedule:
22934
+ type: string
22935
+ sourceEntity:
22936
+ type: string
22937
+ targetEntity:
22938
+ type: string
22939
+ config:
22940
+ $ref: "#/components/schemas/IntegrationFlowConfig"
22941
+ createdBy:
22942
+ type: string
22943
+ createdAt:
22944
+ type: string
22945
+ updatedAt:
22946
+ type: string
22947
+ deletedAt:
22948
+ type: string
22949
+ lastRunAt:
22950
+ type: string
22951
+ lastRunStatus:
22952
+ type: string
22953
+ lastRunError:
22954
+ type: string
22955
+ lastRunCount:
22956
+ type: number
22957
+ lastPollAt:
22958
+ type: string
22959
+ lastCursor:
22960
+ type: string
22961
+ totalSynced:
22962
+ type: number
22963
+ required:
22964
+ - id
22965
+ - orgId
22966
+ - collectionId
22967
+ - appId
22968
+ - direction
22969
+ - name
22970
+ - status
22971
+ - eventTypes
22972
+ - schedule
22973
+ - sourceEntity
22974
+ - targetEntity
22975
+ - config
22976
+ - createdBy
22977
+ - createdAt
22978
+ - updatedAt
22979
+ CreateFlowInput:
22980
+ type: object
22981
+ properties:
22982
+ appId:
22983
+ type: string
22984
+ direction:
22985
+ $ref: "#/components/schemas/FlowDirection"
22986
+ name:
22987
+ type: string
22988
+ status:
22989
+ $ref: "#/components/schemas/FlowStatus"
22990
+ eventTypes:
22991
+ type: array
22992
+ items:
22993
+ type: string
22994
+ schedule:
22995
+ type: string
22996
+ sourceEntity:
22997
+ type: string
22998
+ targetEntity:
22999
+ type: string
23000
+ config:
23001
+ $ref: "#/components/schemas/IntegrationFlowConfig"
23002
+ required:
23003
+ - appId
23004
+ - direction
23005
+ - name
23006
+ ListFlowsQuery:
23007
+ type: object
23008
+ properties:
23009
+ direction:
23010
+ $ref: "#/components/schemas/FlowDirection"
23011
+ status:
23012
+ $ref: "#/components/schemas/FlowStatus"
23013
+ appId:
23014
+ type: string
23015
+ FlowList:
23016
+ type: object
23017
+ properties:
23018
+ flows:
23019
+ type: array
23020
+ items:
23021
+ $ref: "#/components/schemas/IntegrationFlow"
23022
+ required:
23023
+ - flows
23024
+ RunFlowInput:
23025
+ type: object
23026
+ properties:
23027
+ entityId:
23028
+ type: string
23029
+ RunFlowSummary:
23030
+ type: object
23031
+ properties:
23032
+ flowId:
23033
+ type: string
23034
+ direction:
23035
+ $ref: "#/components/schemas/FlowDirection"
23036
+ records:
23037
+ type: number
23038
+ sent:
23039
+ type: number
23040
+ failed:
23041
+ type: number
23042
+ status:
23043
+ $ref: "#/components/schemas/RunStatus"
23044
+ required:
23045
+ - flowId
23046
+ - direction
23047
+ - records
23048
+ - sent
23049
+ - failed
23050
+ - status
23051
+ RunFlowEnqueued:
23052
+ type: object
23053
+ properties:
23054
+ enqueued:
23055
+ type: object
23056
+ additionalProperties: true
23057
+ flowId:
23058
+ type: string
23059
+ entityId:
23060
+ type: string
23061
+ required:
23062
+ - enqueued
23063
+ - flowId
23064
+ - entityId
23065
+ SecretMeta:
23066
+ type: object
23067
+ properties:
23068
+ ref:
23069
+ type: string
23070
+ name:
23071
+ type: string
23072
+ purpose:
23073
+ type: string
23074
+ hint:
23075
+ type: string
23076
+ keyVersion:
23077
+ type: number
23078
+ createdBy:
23079
+ type: string
23080
+ createdAt:
23081
+ type: string
23082
+ updatedAt:
23083
+ type: string
23084
+ rotatedAt:
23085
+ type: string
23086
+ required:
23087
+ - ref
23088
+ - name
23089
+ - purpose
23090
+ - hint
23091
+ - keyVersion
23092
+ - createdBy
23093
+ - createdAt
23094
+ - updatedAt
23095
+ SecretList:
23096
+ type: object
23097
+ properties:
23098
+ secrets:
23099
+ type: array
23100
+ items:
23101
+ $ref: "#/components/schemas/SecretMeta"
23102
+ required:
23103
+ - secrets
23104
+ SetSecretInput:
23105
+ type: object
23106
+ properties:
23107
+ value:
23108
+ type: string
23109
+ name:
23110
+ type: string
23111
+ purpose:
23112
+ type: string
23113
+ required:
23114
+ - value
23115
+ SetSecretResult:
23116
+ type: object
23117
+ properties:
23118
+ ref:
23119
+ type: string
23120
+ hint:
23121
+ type: string
23122
+ required:
23123
+ - ref
23124
+ - hint
23125
+ ListSecretsQuery:
23126
+ type: object
23127
+ properties:
23128
+ purpose:
23129
+ type: string
23130
+ RunFlowResult:
23131
+ type: object
23132
+ additionalProperties: true
22786
23133
  AdminInteractionsQueryRequest:
22787
23134
  type: object
22788
23135
  properties:
@@ -25832,6 +26179,8 @@ components:
25832
26179
  type: array
25833
26180
  items:
25834
26181
  $ref: "#/components/schemas/GrantScope"
26182
+ moderate:
26183
+ type: boolean
25835
26184
  audience:
25836
26185
  $ref: "#/components/schemas/GrantAudience"
25837
26186
  createdBy:
@@ -25872,6 +26221,8 @@ components:
25872
26221
  expiresAt:
25873
26222
  type: object
25874
26223
  additionalProperties: true
26224
+ moderate:
26225
+ type: boolean
25875
26226
  required:
25876
26227
  - scope
25877
26228
  RedeemGrantOptions:
@@ -17,6 +17,14 @@ export type AttestationSubjectType = 'container' | 'proof' | 'product' | 'tag' |
17
17
  * - `'admin'` — visible to admin callers only
18
18
  */
19
19
  export type AttestationVisibility = 'public' | 'owner' | 'admin';
20
+ /**
21
+ * Moderation state of an attestation (separate from {@link AttestationVisibility}).
22
+ * - `'approved'` — live; follows its declared visibility (the default)
23
+ * - `'pending'` — awaiting owner review; returned only to its author and to
24
+ * owner/admin audiences, never to the public, whatever its target visibility
25
+ * - `'rejected'` — owner declined; author + admin only
26
+ */
27
+ export type AttestationModerationStatus = 'approved' | 'pending' | 'rejected';
20
28
  /**
21
29
  * Resolved audience tier returned by public endpoints.
22
30
  * Tells the client which data zones are populated in the response.
@@ -59,6 +67,19 @@ export interface Attestation {
59
67
  source?: string;
60
68
  /** User ID or service account that recorded the fact */
61
69
  authorId?: string;
70
+ /**
71
+ * When authored under a `contribute` grant (rather than by identity), the id of
72
+ * the granting token — provenance for a contributed record. `null`/absent for
73
+ * owner/admin/identity writes.
74
+ */
75
+ grantId?: string | null;
76
+ /**
77
+ * Moderation gate, orthogonal to {@link visibility} and excluded from the hash
78
+ * chain. `'approved'` (default) is live; `'pending'` is held for owner review
79
+ * (visible only to its author and owner/admin audiences); `'rejected'` was
80
+ * declined. Contributions under a `moderate` grant start `'pending'`.
81
+ */
82
+ moderationStatus?: AttestationModerationStatus;
62
83
  /** Arbitrary extra metadata */
63
84
  metadata?: Record<string, any>;
64
85
  /** SHA-256 digest of this record (includes `prevHash`) */
@@ -129,10 +150,18 @@ export interface CreateAttestationInput {
129
150
  metadata?: Record<string, any>;
130
151
  }
131
152
  /**
132
- * Owner-authored attestation input (public write). The proof OWNER adds an
133
- * attestation to their own item. Restricted vs {@link CreateAttestationInput}:
134
- * no `adminData` (business-only zone), `visibility` limited to `'public' | 'owner'`,
135
- * and `authorId` is forced to the caller by the server (so it's omitted here).
153
+ * Public attestation write input, used by {@link attestations.publicCreate}.
154
+ *
155
+ * Authorised two ways, same input shape (the server decides from the request):
156
+ * 1. the proof OWNER (Firebase ID token) adds an attestation to their own item;
157
+ * 2. a holder of a `contribute`-scope grant adds one — set the grant token with
158
+ * `setGrantToken(token)` first; for a public-link (anonymous) grant, pass
159
+ * `guestName` for attribution.
160
+ *
161
+ * Restricted vs {@link CreateAttestationInput}: no `adminData` (business-only
162
+ * zone), `visibility` limited to `'public' | 'owner'`, and `authorId` / `grantId`
163
+ * are server-stamped (so they're omitted here). If the contribute grant was issued
164
+ * with `moderate: true`, the created record comes back `moderationStatus: 'pending'`.
136
165
  */
137
166
  export interface OwnerAttestationInput {
138
167
  subjectType: AttestationSubjectType;
@@ -146,6 +175,18 @@ export interface OwnerAttestationInput {
146
175
  unit?: string;
147
176
  source?: string;
148
177
  metadata?: Record<string, any>;
178
+ /**
179
+ * Attribution for an anonymous (public-link) contribute-grant write. Ignored
180
+ * for owner writes and for named-grant writes (attributed to the signed-in uid).
181
+ */
182
+ guestName?: string;
183
+ }
184
+ /** Owner/admin decision on a pending contributed attestation. */
185
+ export interface ModerateAttestationInput {
186
+ decision: 'approve' | 'reject';
187
+ }
188
+ export interface ModerateAttestationResponse {
189
+ attestation: Attestation;
149
190
  }
150
191
  export interface ListAttestationsResponse {
151
192
  attestations: Attestation[];
@@ -197,6 +238,12 @@ export interface ListAttestationsParams {
197
238
  /** Required */
198
239
  subjectId: string;
199
240
  attestationType?: string;
241
+ /**
242
+ * Filter by moderation state. Primarily for the owner review queue
243
+ * (`moderationStatus: 'pending'`). ANDs with the server's audience gate, so a
244
+ * public caller can never use it to widen access.
245
+ */
246
+ moderationStatus?: AttestationModerationStatus;
200
247
  /** ISO 8601 lower bound (inclusive) */
201
248
  recordedAfter?: string;
202
249
  /** ISO 8601 upper bound (inclusive) */
@@ -38,5 +38,6 @@ export * from "./appManifest";
38
38
  export * from "./appObjects";
39
39
  export * from "./loyalty";
40
40
  export * from "./translations";
41
+ export * from "./integrations";
41
42
  export * from "./config";
42
43
  export * from "./widgets";
@@ -40,5 +40,6 @@ export * from "./appManifest";
40
40
  export * from "./appObjects";
41
41
  export * from "./loyalty";
42
42
  export * from "./translations";
43
+ export * from "./integrations";
43
44
  export * from "./config";
44
45
  export * from "./widgets";
@@ -0,0 +1,136 @@
1
+ export type FlowDirection = 'inbound' | 'outbound';
2
+ export type FlowStatus = 'draft' | 'active' | 'paused' | 'error';
3
+ export type RunStatus = 'success' | 'partial' | 'error';
4
+ /** How one source field maps to one target field during transform. */
5
+ export type TransformType = 'direct' | 'static' | 'template' | 'jsonata' | 'ai';
6
+ export interface FieldMapping {
7
+ /** Dot-path in the produced target object (required). */
8
+ targetPath: string;
9
+ /** Dot-path in the source record. Used by `direct`. */
10
+ sourcePath?: string;
11
+ transformType: TransformType;
12
+ /** Constant (`static`) or Liquid template (`template`), etc. */
13
+ transformExpression?: string;
14
+ }
15
+ export type FlowAuthMethod = 'api_key' | 'bearer' | 'basic' | 'webhook' | 'oauth2' | 'none';
16
+ export interface FlowConnectionAuth {
17
+ method: FlowAuthMethod;
18
+ /** Header name for `api_key` (defaults server-side to X-API-Key). */
19
+ headerName?: string;
20
+ /** Opaque reference into the secret store; resolved server-side at execution. */
21
+ credentialRef?: string;
22
+ }
23
+ export interface FlowConnection {
24
+ baseUrl?: string;
25
+ /** Outbound: path appended to baseUrl for sends. */
26
+ sendEndpoint?: string;
27
+ /** Inbound: path appended to baseUrl for fetches. */
28
+ fetchEndpoint?: string;
29
+ defaultHeaders?: Record<string, string>;
30
+ auth?: FlowConnectionAuth;
31
+ }
32
+ export interface IntegrationFlowConfig {
33
+ connection?: FlowConnection;
34
+ fieldMappings?: FieldMapping[];
35
+ [key: string]: any;
36
+ }
37
+ export interface IntegrationFlow {
38
+ id: string;
39
+ orgId: string;
40
+ collectionId: string;
41
+ appId: string;
42
+ direction: FlowDirection;
43
+ name: string;
44
+ status: FlowStatus;
45
+ /** Event types this flow subscribes to, e.g. ['product.updated']. */
46
+ eventTypes: string[];
47
+ /** Cron/interval string for scheduled flows, or null. */
48
+ schedule: string | null;
49
+ sourceEntity: string | null;
50
+ targetEntity: string | null;
51
+ config: IntegrationFlowConfig;
52
+ createdBy: string | null;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ deletedAt?: string | null;
56
+ lastRunAt?: string | null;
57
+ lastRunStatus?: string | null;
58
+ lastRunError?: string | null;
59
+ lastRunCount?: number | null;
60
+ lastPollAt?: string | null;
61
+ lastCursor?: string | null;
62
+ totalSynced?: number | null;
63
+ }
64
+ export interface CreateFlowInput {
65
+ appId: string;
66
+ direction: FlowDirection;
67
+ name: string;
68
+ status?: FlowStatus;
69
+ eventTypes?: string[];
70
+ schedule?: string | null;
71
+ sourceEntity?: string | null;
72
+ targetEntity?: string | null;
73
+ config?: IntegrationFlowConfig;
74
+ }
75
+ export type UpdateFlowInput = Partial<Omit<CreateFlowInput, 'direction'>> & {
76
+ status?: FlowStatus;
77
+ };
78
+ export interface ListFlowsQuery {
79
+ direction?: FlowDirection;
80
+ status?: FlowStatus;
81
+ appId?: string;
82
+ }
83
+ export interface FlowList {
84
+ flows: IntegrationFlow[];
85
+ }
86
+ /** Options for a manual flow run. */
87
+ export interface RunFlowInput {
88
+ /** Run for a single source entity; omit for the flow's scheduled gather. */
89
+ entityId?: string;
90
+ }
91
+ /** Inline (synchronous) run summary. */
92
+ export interface RunFlowSummary {
93
+ flowId: string;
94
+ direction: FlowDirection;
95
+ records: number;
96
+ sent: number;
97
+ failed: number;
98
+ status: RunStatus;
99
+ }
100
+ /** Response when a run is enqueued (?async=true). */
101
+ export interface RunFlowEnqueued {
102
+ enqueued: true;
103
+ flowId: string;
104
+ entityId: string | null;
105
+ }
106
+ export type RunFlowResult = RunFlowSummary | RunFlowEnqueued;
107
+ /** Metadata for a stored secret. NEVER includes the value or ciphertext. */
108
+ export interface SecretMeta {
109
+ ref: string;
110
+ name: string | null;
111
+ purpose: string;
112
+ /** Masked hint (e.g. last few chars) — safe to display. */
113
+ hint: string;
114
+ keyVersion: number;
115
+ createdBy: string | null;
116
+ createdAt: string;
117
+ updatedAt: string;
118
+ rotatedAt?: string | null;
119
+ }
120
+ export interface SecretList {
121
+ secrets: SecretMeta[];
122
+ }
123
+ export interface SetSecretInput {
124
+ value: string;
125
+ name?: string;
126
+ /** Grouping/scoping label, defaults to 'integration' server-side. */
127
+ purpose?: string;
128
+ }
129
+ /** Result of set/rotate — the ref to store on a flow's connection, plus a hint. */
130
+ export interface SetSecretResult {
131
+ ref: string;
132
+ hint: string;
133
+ }
134
+ export interface ListSecretsQuery {
135
+ purpose?: string;
136
+ }
@@ -0,0 +1,10 @@
1
+ // src/types/integrations.ts
2
+ //
3
+ // Integration flows + the sealed-secret store that backs their credentials.
4
+ //
5
+ // A flow is one input/output pipeline: an inbound flow fetches from an external
6
+ // system and writes a SmartLinks entity; an outbound flow reads a SmartLinks entity,
7
+ // transforms it, and sends it out. Credentials are never stored on the flow — the
8
+ // connection carries a `credentialRef` into the secret store, resolved server-side
9
+ // only, at execution.
10
+ export {};