@proveanything/smartlinks 2.0.29 → 2.0.30

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,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.30 | Generated: 2026-09-29T17:13:26.956Z
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'`
@@ -10433,6 +10456,18 @@ Look up a serial number by code for a collection (admin only).
10433
10456
  value: any) → `Promise<any>`
10434
10457
  Assign a value to a serial number for a collection (admin only).
10435
10458
 
10459
+ **getUsers**(collectionId: string) → `Promise<CollectionUser[]>`
10460
+ 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
10461
+
10462
+ **setUserAccess**(collectionId: string,
10463
+ userId: string,
10464
+ access: CollectionAccessLevel | null) → `Promise<void>`
10465
+ 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
10466
+
10467
+ **inviteUser**(collectionId: string,
10468
+ input: InviteUserInput) → `Promise<`
10469
+ 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
10470
+
10436
10471
  ### comms
10437
10472
 
10438
10473
  **getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
package/dist/openapi.yaml CHANGED
@@ -4334,6 +4334,35 @@ paths:
4334
4334
  description: Unauthorized
4335
4335
  404:
4336
4336
  description: Not found
4337
+ /admin/collection/{collectionId}/getUsers:
4338
+ get:
4339
+ tags:
4340
+ - collection
4341
+ summary: List the users with access to a collection, each with their access level (admin only).
4342
+ operationId: collection_getUsers
4343
+ security:
4344
+ - bearerAuth: []
4345
+ parameters:
4346
+ - name: collectionId
4347
+ in: path
4348
+ required: true
4349
+ schema:
4350
+ type: string
4351
+ responses:
4352
+ 200:
4353
+ description: Success
4354
+ content:
4355
+ application/json:
4356
+ schema:
4357
+ type: array
4358
+ items:
4359
+ $ref: "#/components/schemas/CollectionUser"
4360
+ 400:
4361
+ description: Bad request
4362
+ 401:
4363
+ description: Unauthorized
4364
+ 404:
4365
+ description: Not found
4337
4366
  /admin/collection/{collectionId}/hub:
4338
4367
  post:
4339
4368
  tags:
@@ -8694,6 +8723,38 @@ paths:
8694
8723
  application/json:
8695
8724
  schema:
8696
8725
  $ref: "#/components/schemas/TranslationUpdateRequest"
8726
+ /admin/collection/{collectionId}/updateUserAccess:
8727
+ post:
8728
+ tags:
8729
+ - collection
8730
+ summary: "Grant, change, or remove a user's access level on a collection (admin only)."
8731
+ operationId: collection_setUserAccess
8732
+ security:
8733
+ - bearerAuth: []
8734
+ parameters:
8735
+ - name: collectionId
8736
+ in: path
8737
+ required: true
8738
+ schema:
8739
+ type: string
8740
+ responses:
8741
+ 200:
8742
+ description: Success
8743
+ content:
8744
+ application/json:
8745
+ schema: {}
8746
+ 400:
8747
+ description: Bad request
8748
+ 401:
8749
+ description: Unauthorized
8750
+ 404:
8751
+ description: Not found
8752
+ requestBody:
8753
+ required: true
8754
+ content:
8755
+ application/json:
8756
+ schema:
8757
+ $ref: "#/components/schemas/CollectionAccessLevel"
8697
8758
  /admin/collection/{encodedCollectionId}/comm/send:
8698
8759
  post:
8699
8760
  tags:
@@ -22709,6 +22770,38 @@ components:
22709
22770
  $ref: "#/components/schemas/AppConfig"
22710
22771
  required:
22711
22772
  - apps
22773
+ CollectionUser:
22774
+ type: object
22775
+ properties:
22776
+ uid:
22777
+ type: string
22778
+ access:
22779
+ type: object
22780
+ additionalProperties: true
22781
+ name:
22782
+ type: string
22783
+ email:
22784
+ type: string
22785
+ required:
22786
+ - uid
22787
+ - access
22788
+ InviteUserInput:
22789
+ type: object
22790
+ properties:
22791
+ email:
22792
+ type: string
22793
+ name:
22794
+ type: string
22795
+ access:
22796
+ type: object
22797
+ additionalProperties: true
22798
+ loginCollectionId:
22799
+ type: string
22800
+ consoleOrigin:
22801
+ type: string
22802
+ required:
22803
+ - email
22804
+ - access
22712
22805
  CollectionResponse:
22713
22806
  $ref: "#/components/schemas/Collection"
22714
22807
  CollectionCreateRequest:
@@ -22718,6 +22811,15 @@ components:
22718
22811
  DomainTarget:
22719
22812
  type: object
22720
22813
  additionalProperties: true
22814
+ CollectionAccessLevel:
22815
+ type: string
22816
+ enum:
22817
+ - Owner
22818
+ - Admin
22819
+ - Assigner
22820
+ - Reporter
22821
+ - User
22822
+ - None
22721
22823
  IdField:
22722
22824
  type: string
22723
22825
  enum:
@@ -153,3 +153,33 @@ export interface AppsConfigResponse extends Omit<AppConfigSettings, 'id' | 'apps
153
153
  /** Array of app catalog definitions for this collection. */
154
154
  apps: AppConfig[];
155
155
  }
156
+ /**
157
+ * A user's access level on a collection. Access is stored in the collection's `roles` map
158
+ * (userId → level). Server-enforced tiers are `User` < `Admin` < `Owner`; `Reporter` / `Assigner`
159
+ * are legacy values still accepted but not part of the enforced hierarchy. `None` removes access.
160
+ */
161
+ export type CollectionAccessLevel = 'Owner' | 'Admin' | 'Assigner' | 'Reporter' | 'User' | 'None';
162
+ /** A user who has access to a collection (as returned by {@link collection.getUsers}). */
163
+ export interface CollectionUser {
164
+ /** The user's id (auth uid). */
165
+ uid: string;
166
+ /** The user's access level on this collection. */
167
+ access: CollectionAccessLevel | string;
168
+ /** Display name, if known. */
169
+ name?: string;
170
+ /** Email address, if known. */
171
+ email?: string;
172
+ }
173
+ /** Input for {@link collection.inviteUser}. */
174
+ export interface InviteUserInput {
175
+ /** Email address to invite. */
176
+ email: string;
177
+ /** Optional display name (used when creating a brand-new account). */
178
+ name?: string;
179
+ /** Access level to grant on the collection. Apply it with {@link collection.setUserAccess} after inviting. */
180
+ access: CollectionAccessLevel | string;
181
+ /** The login / auth-kit collection the account lives in (for branding + where the login is created). Default `'global'`. */
182
+ loginCollectionId?: string;
183
+ /** Origin used to build the branded invite link. Defaults to `window.location.origin` in the browser. */
184
+ consoleOrigin?: string;
185
+ }
@@ -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.30 | Generated: 2026-09-29T17:13:26.956Z
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'`
@@ -10433,6 +10456,18 @@ Look up a serial number by code for a collection (admin only).
10433
10456
  value: any) → `Promise<any>`
10434
10457
  Assign a value to a serial number for a collection (admin only).
10435
10458
 
10459
+ **getUsers**(collectionId: string) → `Promise<CollectionUser[]>`
10460
+ 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
10461
+
10462
+ **setUserAccess**(collectionId: string,
10463
+ userId: string,
10464
+ access: CollectionAccessLevel | null) → `Promise<void>`
10465
+ 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
10466
+
10467
+ **inviteUser**(collectionId: string,
10468
+ input: InviteUserInput) → `Promise<`
10469
+ 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
10470
+
10436
10471
  ### comms
10437
10472
 
10438
10473
  **getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
package/openapi.yaml CHANGED
@@ -4334,6 +4334,35 @@ paths:
4334
4334
  description: Unauthorized
4335
4335
  404:
4336
4336
  description: Not found
4337
+ /admin/collection/{collectionId}/getUsers:
4338
+ get:
4339
+ tags:
4340
+ - collection
4341
+ summary: List the users with access to a collection, each with their access level (admin only).
4342
+ operationId: collection_getUsers
4343
+ security:
4344
+ - bearerAuth: []
4345
+ parameters:
4346
+ - name: collectionId
4347
+ in: path
4348
+ required: true
4349
+ schema:
4350
+ type: string
4351
+ responses:
4352
+ 200:
4353
+ description: Success
4354
+ content:
4355
+ application/json:
4356
+ schema:
4357
+ type: array
4358
+ items:
4359
+ $ref: "#/components/schemas/CollectionUser"
4360
+ 400:
4361
+ description: Bad request
4362
+ 401:
4363
+ description: Unauthorized
4364
+ 404:
4365
+ description: Not found
4337
4366
  /admin/collection/{collectionId}/hub:
4338
4367
  post:
4339
4368
  tags:
@@ -8694,6 +8723,38 @@ paths:
8694
8723
  application/json:
8695
8724
  schema:
8696
8725
  $ref: "#/components/schemas/TranslationUpdateRequest"
8726
+ /admin/collection/{collectionId}/updateUserAccess:
8727
+ post:
8728
+ tags:
8729
+ - collection
8730
+ summary: "Grant, change, or remove a user's access level on a collection (admin only)."
8731
+ operationId: collection_setUserAccess
8732
+ security:
8733
+ - bearerAuth: []
8734
+ parameters:
8735
+ - name: collectionId
8736
+ in: path
8737
+ required: true
8738
+ schema:
8739
+ type: string
8740
+ responses:
8741
+ 200:
8742
+ description: Success
8743
+ content:
8744
+ application/json:
8745
+ schema: {}
8746
+ 400:
8747
+ description: Bad request
8748
+ 401:
8749
+ description: Unauthorized
8750
+ 404:
8751
+ description: Not found
8752
+ requestBody:
8753
+ required: true
8754
+ content:
8755
+ application/json:
8756
+ schema:
8757
+ $ref: "#/components/schemas/CollectionAccessLevel"
8697
8758
  /admin/collection/{encodedCollectionId}/comm/send:
8698
8759
  post:
8699
8760
  tags:
@@ -22709,6 +22770,38 @@ components:
22709
22770
  $ref: "#/components/schemas/AppConfig"
22710
22771
  required:
22711
22772
  - apps
22773
+ CollectionUser:
22774
+ type: object
22775
+ properties:
22776
+ uid:
22777
+ type: string
22778
+ access:
22779
+ type: object
22780
+ additionalProperties: true
22781
+ name:
22782
+ type: string
22783
+ email:
22784
+ type: string
22785
+ required:
22786
+ - uid
22787
+ - access
22788
+ InviteUserInput:
22789
+ type: object
22790
+ properties:
22791
+ email:
22792
+ type: string
22793
+ name:
22794
+ type: string
22795
+ access:
22796
+ type: object
22797
+ additionalProperties: true
22798
+ loginCollectionId:
22799
+ type: string
22800
+ consoleOrigin:
22801
+ type: string
22802
+ required:
22803
+ - email
22804
+ - access
22712
22805
  CollectionResponse:
22713
22806
  $ref: "#/components/schemas/Collection"
22714
22807
  CollectionCreateRequest:
@@ -22718,6 +22811,15 @@ components:
22718
22811
  DomainTarget:
22719
22812
  type: object
22720
22813
  additionalProperties: true
22814
+ CollectionAccessLevel:
22815
+ type: string
22816
+ enum:
22817
+ - Owner
22818
+ - Admin
22819
+ - Assigner
22820
+ - Reporter
22821
+ - User
22822
+ - None
22721
22823
  IdField:
22722
22824
  type: string
22723
22825
  enum:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "2.0.29",
3
+ "version": "2.0.30",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",