@proveanything/smartlinks 2.0.29 → 2.0.31

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.
@@ -1,4 +1,4 @@
1
- import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse } from "../types/collection.js";
1
+ import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse, CollectionUser, CollectionAccessLevel, InviteUserInput } from "../types/collection.js";
2
2
  export declare namespace collection {
3
3
  /**
4
4
  * Retrieves a single Collection by its ID.
@@ -170,4 +170,35 @@ export declare namespace collection {
170
170
  * @throws ErrorResponse if the request fails
171
171
  */
172
172
  function assignSN(collectionId: string, codeId: string, value: any): Promise<any>;
173
+ /**
174
+ * List the users with access to a collection, each with their access level (admin only). Access is
175
+ * stored in the collection's `roles` map (userId → level); this resolves each to name/email.
176
+ * GET /admin/collection/:collectionId/getUsers
177
+ * @param collectionId - Identifier of the collection
178
+ * @returns Promise resolving to the collection's users
179
+ */
180
+ function getUsers(collectionId: string): Promise<CollectionUser[]>;
181
+ /**
182
+ * Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or
183
+ * `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an
184
+ * access level above your own, nor change a user whose level is above yours.
185
+ * POST /admin/collection/:collectionId/updateUserAccess
186
+ * @param collectionId - Identifier of the collection
187
+ * @param userId - The user (auth uid) whose access to change
188
+ * @param access - The new access level, or `null` to remove access
189
+ */
190
+ function setUserAccess(collectionId: string, userId: string, access: CollectionAccessLevel | null): Promise<void>;
191
+ /**
192
+ * Invite a user to a collection by email (admin only). Creates or links their account in the login /
193
+ * auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account)
194
+ * or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access
195
+ * on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow).
196
+ * POST /user/inviteUser
197
+ * @param collectionId - The collection the user is being added to (the invite's target)
198
+ * @param input - Invite details (email, optional name, access level, login collection, origin)
199
+ * @returns Promise resolving to the invited user's `{ uid }`
200
+ */
201
+ function inviteUser(collectionId: string, input: InviteUserInput): Promise<{
202
+ uid: string;
203
+ }>;
173
204
  }
@@ -253,4 +253,54 @@ export var collection;
253
253
  return post(path, { value });
254
254
  }
255
255
  collection.assignSN = assignSN;
256
+ /**
257
+ * List the users with access to a collection, each with their access level (admin only). Access is
258
+ * stored in the collection's `roles` map (userId → level); this resolves each to name/email.
259
+ * GET /admin/collection/:collectionId/getUsers
260
+ * @param collectionId - Identifier of the collection
261
+ * @returns Promise resolving to the collection's users
262
+ */
263
+ async function getUsers(collectionId) {
264
+ return request(`/admin/collection/${encodeURIComponent(collectionId)}/getUsers`);
265
+ }
266
+ collection.getUsers = getUsers;
267
+ /**
268
+ * Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or
269
+ * `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an
270
+ * access level above your own, nor change a user whose level is above yours.
271
+ * POST /admin/collection/:collectionId/updateUserAccess
272
+ * @param collectionId - Identifier of the collection
273
+ * @param userId - The user (auth uid) whose access to change
274
+ * @param access - The new access level, or `null` to remove access
275
+ */
276
+ async function setUserAccess(collectionId, userId, access) {
277
+ await post(`/admin/collection/${encodeURIComponent(collectionId)}/updateUserAccess`, {
278
+ userId,
279
+ access: access !== null && access !== void 0 ? access : 'None'
280
+ });
281
+ }
282
+ collection.setUserAccess = setUserAccess;
283
+ /**
284
+ * Invite a user to a collection by email (admin only). Creates or links their account in the login /
285
+ * auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account)
286
+ * or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access
287
+ * on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow).
288
+ * POST /user/inviteUser
289
+ * @param collectionId - The collection the user is being added to (the invite's target)
290
+ * @param input - Invite details (email, optional name, access level, login collection, origin)
291
+ * @returns Promise resolving to the invited user's `{ uid }`
292
+ */
293
+ async function inviteUser(collectionId, input) {
294
+ var _a, _b;
295
+ const consoleOrigin = (_a = input.consoleOrigin) !== null && _a !== void 0 ? _a : (typeof window !== 'undefined' ? window.location.origin : undefined);
296
+ return post(`/user/inviteUser`, {
297
+ email: input.email.trim(),
298
+ name: input.name,
299
+ collectionId: (_b = input.loginCollectionId) !== null && _b !== void 0 ? _b : 'global',
300
+ targetCollectionId: collectionId,
301
+ accessLevel: input.access,
302
+ consoleOrigin
303
+ });
304
+ }
305
+ collection.inviteUser = inviteUser;
256
306
  })(collection || (collection = {}));
@@ -1,4 +1,4 @@
1
- import type { IntegrationFlow, CreateFlowInput, UpdateFlowInput, ListFlowsQuery, FlowList, RunFlowInput, RunFlowResult, RunFlowSummary, RunFlowEnqueued, RecordTypesResponse } from "../types/integrations.js";
1
+ import type { IntegrationFlow, CreateFlowInput, UpdateFlowInput, ListFlowsQuery, FlowList, RunFlowInput, RunFlowResult, RunFlowSummary, RunFlowEnqueued, RecordTypesResponse, FlowRun, ListRunsQuery, RunList, ListRunItemsQuery, RunItemList, LoggingWindow, SetLoggingInput } from "../types/integrations.js";
2
2
  export declare namespace integrations {
3
3
  /** List flows in a collection. GET /integrations/flows */
4
4
  function listFlows(collectionId: string, query?: ListFlowsQuery): Promise<FlowList>;
@@ -31,4 +31,30 @@ export declare namespace integrations {
31
31
  function isRunSummary(r: RunFlowResult): r is RunFlowSummary;
32
32
  /** Type guard: the run was enqueued (async). */
33
33
  function isRunEnqueued(r: RunFlowResult): r is RunFlowEnqueued;
34
+ /** List a flow's runs, newest first. GET /integrations/flows/:id/runs */
35
+ function listRuns(collectionId: string, flowId: string, query?: ListRunsQuery): Promise<RunList>;
36
+ /** Get one run's summary. GET /integrations/flows/:id/runs/:runId */
37
+ function getRun(collectionId: string, flowId: string, runId: string): Promise<FlowRun>;
38
+ /**
39
+ * List a run's per-record items. GET /integrations/flows/:id/runs/:runId/items
40
+ * `request`/`response` are populated only for items captured while enhanced logging
41
+ * was active (and before the 24h body purge).
42
+ */
43
+ function listRunItems(collectionId: string, flowId: string, runId: string, query?: ListRunItemsQuery): Promise<RunItemList>;
44
+ /** Every run touching an entity (e.g. a product), across flows. GET /integrations/runs/entity/:entityId */
45
+ function listEntityRuns(collectionId: string, entityId: string, query?: {
46
+ limit?: number;
47
+ }): Promise<RunList>;
48
+ /** Is enhanced logging active for a connection? GET /integrations/logging/:connectionId */
49
+ function getLogging(collectionId: string, connectionId: string): Promise<{
50
+ window: LoggingWindow | null;
51
+ }>;
52
+ /** Enable enhanced logging. POST /integrations/logging/:connectionId (omit ttlMinutes = until cancelled) */
53
+ function setLogging(collectionId: string, connectionId: string, input?: SetLoggingInput): Promise<{
54
+ window: LoggingWindow;
55
+ }>;
56
+ /** Cancel enhanced logging now. DELETE /integrations/logging/:connectionId */
57
+ function cancelLogging(collectionId: string, connectionId: string): Promise<{
58
+ canceled: boolean;
59
+ }>;
34
60
  }
@@ -88,4 +88,51 @@ export var integrations;
88
88
  return r.enqueued === true;
89
89
  }
90
90
  integrations.isRunEnqueued = isRunEnqueued;
91
+ // --- Run logs -----------------------------------------------------------
92
+ // A run row is written for every execution (manual, event, scheduled, test). Per-record
93
+ // request/response detail is captured only while enhanced logging is active for the
94
+ // connection (see setLogging); otherwise runs carry metadata only.
95
+ /** List a flow's runs, newest first. GET /integrations/flows/:id/runs */
96
+ async function listRuns(collectionId, flowId, query = {}) {
97
+ return request(`${base(collectionId)}/${enc(flowId)}/runs${encodeQuery(query)}`);
98
+ }
99
+ integrations.listRuns = listRuns;
100
+ /** Get one run's summary. GET /integrations/flows/:id/runs/:runId */
101
+ async function getRun(collectionId, flowId, runId) {
102
+ return request(`${base(collectionId)}/${enc(flowId)}/runs/${enc(runId)}`);
103
+ }
104
+ integrations.getRun = getRun;
105
+ /**
106
+ * List a run's per-record items. GET /integrations/flows/:id/runs/:runId/items
107
+ * `request`/`response` are populated only for items captured while enhanced logging
108
+ * was active (and before the 24h body purge).
109
+ */
110
+ async function listRunItems(collectionId, flowId, runId, query = {}) {
111
+ return request(`${base(collectionId)}/${enc(flowId)}/runs/${enc(runId)}/items${encodeQuery(query)}`);
112
+ }
113
+ integrations.listRunItems = listRunItems;
114
+ /** Every run touching an entity (e.g. a product), across flows. GET /integrations/runs/entity/:entityId */
115
+ async function listEntityRuns(collectionId, entityId, query = {}) {
116
+ return request(`/admin/collection/${enc(collectionId)}/integrations/runs/entity/${enc(entityId)}${encodeQuery(query)}`);
117
+ }
118
+ integrations.listEntityRuns = listEntityRuns;
119
+ // --- Enhanced logging window (per connection) ---------------------------
120
+ // Full request/response capture is off by default. Turn it on for a connection while
121
+ // debugging; it applies to every flow on that connection and auto-expires (or runs until
122
+ // cancelled). Bodies are redacted at capture and purged after 24h.
123
+ /** Is enhanced logging active for a connection? GET /integrations/logging/:connectionId */
124
+ async function getLogging(collectionId, connectionId) {
125
+ return request(`/admin/collection/${enc(collectionId)}/integrations/logging/${enc(connectionId)}`);
126
+ }
127
+ integrations.getLogging = getLogging;
128
+ /** Enable enhanced logging. POST /integrations/logging/:connectionId (omit ttlMinutes = until cancelled) */
129
+ async function setLogging(collectionId, connectionId, input = {}) {
130
+ return post(`/admin/collection/${enc(collectionId)}/integrations/logging/${enc(connectionId)}`, input);
131
+ }
132
+ integrations.setLogging = setLogging;
133
+ /** Cancel enhanced logging now. DELETE /integrations/logging/:connectionId */
134
+ async function cancelLogging(collectionId, connectionId) {
135
+ return del(`/admin/collection/${enc(collectionId)}/integrations/logging/${enc(connectionId)}`);
136
+ }
137
+ integrations.cancelLogging = cancelLogging;
91
138
  })(integrations || (integrations = {}));
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.29 | Generated: 2026-09-29T10:33:46.286Z
3
+ Version: 2.0.31 | Generated: 2026-09-29T19:37:17.528Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -4711,6 +4711,27 @@ interface AppConfig {
4711
4711
  }
4712
4712
  ```
4713
4713
 
4714
+ **CollectionUser** (interface)
4715
+ ```typescript
4716
+ interface CollectionUser {
4717
+ uid: string
4718
+ access: CollectionAccessLevel | string
4719
+ name?: string
4720
+ email?: string
4721
+ }
4722
+ ```
4723
+
4724
+ **InviteUserInput** (interface)
4725
+ ```typescript
4726
+ interface InviteUserInput {
4727
+ email: string
4728
+ name?: string
4729
+ access: CollectionAccessLevel | string
4730
+ loginCollectionId?: string
4731
+ consoleOrigin?: string
4732
+ }
4733
+ ```
4734
+
4714
4735
  **CollectionResponse** = `Collection`
4715
4736
 
4716
4737
  **CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
@@ -4719,6 +4740,8 @@ interface AppConfig {
4719
4740
 
4720
4741
  **DomainTarget** = `"smartlinks" | "hub"`
4721
4742
 
4743
+ **CollectionAccessLevel** = `'Owner' | 'Admin' | 'Assigner' | 'Reporter' | 'User' | 'None'`
4744
+
4722
4745
  ### common
4723
4746
 
4724
4747
  **IdField** = `'userId' | 'contactId'`
@@ -6539,6 +6562,7 @@ interface FlowList {
6539
6562
  ```typescript
6540
6563
  interface RunFlowInput {
6541
6564
  entityId?: string
6565
+ trigger?: RunTrigger
6542
6566
  }
6543
6567
  ```
6544
6568
 
@@ -6551,6 +6575,128 @@ interface RunFlowSummary {
6551
6575
  sent: number
6552
6576
  failed: number
6553
6577
  status: RunStatus
6578
+ runId?: string
6579
+ }
6580
+ ```
6581
+
6582
+ **CapturedRequest** (interface)
6583
+ ```typescript
6584
+ interface CapturedRequest {
6585
+ transport: string
6586
+ method: string
6587
+ url: string
6588
+ headers: Record<string, string>
6589
+ partitionKey?: string
6590
+ body: unknown
6591
+ bodyBytes: number
6592
+ truncated: boolean
6593
+ }
6594
+ ```
6595
+
6596
+ **CapturedResponse** (interface)
6597
+ ```typescript
6598
+ interface CapturedResponse {
6599
+ status: number | null
6600
+ ok: boolean | null
6601
+ headers: Record<string, string>
6602
+ body: unknown
6603
+ bodyBytes: number
6604
+ truncated: boolean
6605
+ error: string | null
6606
+ }
6607
+ ```
6608
+
6609
+ **FlowRun** (interface)
6610
+ ```typescript
6611
+ interface FlowRun {
6612
+ id: string
6613
+ flowId: string
6614
+ connectionId?: string | null
6615
+ trigger: RunTrigger
6616
+ triggerEvent?: string | null
6617
+ triggerEntityId?: string | null
6618
+ status: FlowRunStatus
6619
+ records: number
6620
+ sent: number
6621
+ failed: number
6622
+ error?: string | null
6623
+ correlationId?: string | null
6624
+ captureLevel: CaptureLevel
6625
+ bodiesPurged: boolean
6626
+ startedAt: string
6627
+ completedAt?: string | null
6628
+ durationMs?: number | null
6629
+ }
6630
+ ```
6631
+
6632
+ **FlowRunItem** (interface)
6633
+ ```typescript
6634
+ interface FlowRunItem {
6635
+ id: string
6636
+ runId: string
6637
+ entityType: string
6638
+ entityId?: string | null
6639
+ entityLabel?: string | null
6640
+ status: FlowRunItemStatus
6641
+ skipReason?: string | null
6642
+ request?: CapturedRequest | null
6643
+ response?: CapturedResponse | null
6644
+ attempt: number
6645
+ durationMs?: number | null
6646
+ createdAt: string
6647
+ }
6648
+ ```
6649
+
6650
+ **ListRunsQuery** (interface)
6651
+ ```typescript
6652
+ interface ListRunsQuery {
6653
+ status?: FlowRunStatus
6654
+ trigger?: RunTrigger
6655
+ entityId?: string
6656
+ limit?: number
6657
+ cursor?: string
6658
+ }
6659
+ ```
6660
+
6661
+ **RunList** (interface)
6662
+ ```typescript
6663
+ interface RunList {
6664
+ runs: FlowRun[]; nextCursor?: string
6665
+ }
6666
+ ```
6667
+
6668
+ **ListRunItemsQuery** (interface)
6669
+ ```typescript
6670
+ interface ListRunItemsQuery {
6671
+ status?: FlowRunItemStatus; limit?: number; cursor?: string
6672
+ }
6673
+ ```
6674
+
6675
+ **RunItemList** (interface)
6676
+ ```typescript
6677
+ interface RunItemList {
6678
+ items: FlowRunItem[]; nextCursor?: string
6679
+ }
6680
+ ```
6681
+
6682
+ **LoggingWindow** (interface)
6683
+ ```typescript
6684
+ interface LoggingWindow {
6685
+ id: string
6686
+ connectionId: string
6687
+ level: CaptureLevel
6688
+ enabledBy?: string | null
6689
+ enabledAt: string
6690
+ expiresAt?: string | null
6691
+ canceledAt?: string | null
6692
+ }
6693
+ ```
6694
+
6695
+ **SetLoggingInput** (interface)
6696
+ ```typescript
6697
+ interface SetLoggingInput {
6698
+ ttlMinutes?: number
6699
+ level?: 'full' | 'errors_only'
6554
6700
  }
6555
6701
  ```
6556
6702
 
@@ -6637,6 +6783,14 @@ interface RecordTypesResponse {
6637
6783
 
6638
6784
  **UpdateFlowInput** = `Partial<Omit<CreateFlowInput, 'direction'>> & {`
6639
6785
 
6786
+ **RunTrigger** = `'manual' | 'event' | 'schedule' | 'test'`
6787
+
6788
+ **FlowRunStatus** = `'running' | 'success' | 'partial' | 'failed' | 'skipped'`
6789
+
6790
+ **FlowRunItemStatus** = `'sent' | 'failed' | 'skipped'`
6791
+
6792
+ **CaptureLevel** = `'metadata' | 'errors_only' | 'full'`
6793
+
6640
6794
  **RunFlowResult** = `RunFlowSummary | RunFlowEnqueued`
6641
6795
 
6642
6796
  ### interaction
@@ -10433,6 +10587,18 @@ Look up a serial number by code for a collection (admin only).
10433
10587
  value: any) → `Promise<any>`
10434
10588
  Assign a value to a serial number for a collection (admin only).
10435
10589
 
10590
+ **getUsers**(collectionId: string) → `Promise<CollectionUser[]>`
10591
+ List the users with access to a collection, each with their access level (admin only). Access is stored in the collection's `roles` map (userId → level); this resolves each to name/email. GET /admin/collection/:collectionId/getUsers
10592
+
10593
+ **setUserAccess**(collectionId: string,
10594
+ userId: string,
10595
+ access: CollectionAccessLevel | null) → `Promise<void>`
10596
+ Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an access level above your own, nor change a user whose level is above yours. POST /admin/collection/:collectionId/updateUserAccess
10597
+
10598
+ **inviteUser**(collectionId: string,
10599
+ input: InviteUserInput) → `Promise<`
10600
+ Invite a user to a collection by email (admin only). Creates or links their account in the login / auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account) or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow). POST /user/inviteUser
10601
+
10436
10602
  ### comms
10437
10603
 
10438
10604
  **getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
@@ -10815,6 +10981,27 @@ Type guard: the run executed inline and returned a summary.
10815
10981
  **isRunEnqueued**(r: RunFlowResult) → `r is RunFlowEnqueued`
10816
10982
  Type guard: the run was enqueued (async).
10817
10983
 
10984
+ **listRuns**(collectionId: string, flowId: string, query: ListRunsQuery = {}) → `Promise<RunList>`
10985
+ List a flow's runs, newest first. GET /integrations/flows/:id/runs
10986
+
10987
+ **getRun**(collectionId: string, flowId: string, runId: string) → `Promise<FlowRun>`
10988
+ Get one run's summary. GET /integrations/flows/:id/runs/:runId
10989
+
10990
+ **listRunItems**(collectionId: string, flowId: string, runId: string, query: ListRunItemsQuery = {}) → `Promise<RunItemList>`
10991
+ List a run's per-record items. GET /integrations/flows/:id/runs/:runId/items `request`/`response` are populated only for items captured while enhanced logging was active (and before the 24h body purge).
10992
+
10993
+ **listEntityRuns**(collectionId: string, entityId: string, query: { limit?: number } = {}) → `Promise<RunList>`
10994
+ Every run touching an entity (e.g. a product), across flows. GET /integrations/runs/entity/:entityId
10995
+
10996
+ **getLogging**(collectionId: string, connectionId: string) → `Promise<`
10997
+ Is enhanced logging active for a connection? GET /integrations/logging/:connectionId
10998
+
10999
+ **setLogging**(collectionId: string, connectionId: string, input: SetLoggingInput = {}) → `Promise<`
11000
+ Enable enhanced logging. POST /integrations/logging/:connectionId (omit ttlMinutes = until cancelled)
11001
+
11002
+ **cancelLogging**(collectionId: string, connectionId: string) → `Promise<`
11003
+ Cancel enhanced logging now. DELETE /integrations/logging/:connectionId
11004
+
10818
11005
  ### interactions
10819
11006
 
10820
11007
  **query**(collectionId: string,