@proveanything/smartlinks 1.0.30 → 1.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.
@@ -0,0 +1,6 @@
1
+ export declare namespace appRecord {
2
+ function get(collectionId: string, appId: string): Promise<any>;
3
+ function create(collectionId: string, appId: string, data: any): Promise<any>;
4
+ function update(collectionId: string, appId: string, data: any): Promise<any>;
5
+ function remove(collectionId: string, appId: string): Promise<void>;
6
+ }
@@ -0,0 +1,29 @@
1
+ // src/api/appRecord.ts
2
+ import { request, post, put, del } from "../http";
3
+ export var appRecord;
4
+ (function (appRecord) {
5
+ // Get app record (admin only)
6
+ async function get(collectionId, appId) {
7
+ const path = `/api/v1/admin/collection/${encodeURIComponent(collectionId)}/app/${encodeURIComponent(appId)}`;
8
+ return request(path);
9
+ }
10
+ appRecord.get = get;
11
+ // Create app record (admin only)
12
+ async function create(collectionId, appId, data) {
13
+ const path = `/api/v1/admin/collection/${encodeURIComponent(collectionId)}/app/${encodeURIComponent(appId)}`;
14
+ return post(path, data);
15
+ }
16
+ appRecord.create = create;
17
+ // Update app record (admin only)
18
+ async function update(collectionId, appId, data) {
19
+ const path = `/api/v1/admin/collection/${encodeURIComponent(collectionId)}/app/${encodeURIComponent(appId)}`;
20
+ return put(path, data);
21
+ }
22
+ appRecord.update = update;
23
+ // Delete app record (admin only)
24
+ async function remove(collectionId, appId) {
25
+ const path = `/api/v1/admin/collection/${encodeURIComponent(collectionId)}/app/${encodeURIComponent(appId)}`;
26
+ return del(path);
27
+ }
28
+ appRecord.remove = remove;
29
+ })(appRecord || (appRecord = {}));
@@ -13,6 +13,8 @@ export type VerifyTokenResponse = {
13
13
  account?: Record<string, any>;
14
14
  };
15
15
  export type AccountInfoResponse = {
16
+ jwtToken: string;
17
+ jwtExpiry: number;
16
18
  accessType: string;
17
19
  analyticsCode: string;
18
20
  analyticsId: string;
@@ -60,6 +62,16 @@ export declare namespace auth {
60
62
  * Returns user/account info if valid.
61
63
  */
62
64
  function verifyToken(token?: string): Promise<VerifyTokenResponse>;
65
+ /**
66
+ * Requests an admin JWT for the current user and a specific collection
67
+ * Returns JWT if valid.
68
+ */
69
+ function requestAdminJWT(collectionId: string): Promise<VerifyTokenResponse>;
70
+ /**
71
+ * Requests a JWT for the current user and a specific collection/product/proof
72
+ * Validates if the user has access to the resource, and returns a JWT
73
+ */
74
+ function requestPublicJWT(collectionId: string, productId: string, proofId: string): Promise<VerifyTokenResponse>;
63
75
  /**
64
76
  * Gets current account information for the logged in user.
65
77
  * Returns user, owner, account, and location objects.
package/dist/api/auth.js CHANGED
@@ -42,6 +42,24 @@ export var auth;
42
42
  return result;
43
43
  }
44
44
  auth.verifyToken = verifyToken;
45
+ /**
46
+ * Requests an admin JWT for the current user and a specific collection
47
+ * Returns JWT if valid.
48
+ */
49
+ async function requestAdminJWT(collectionId) {
50
+ // Use the provided token, or the one from getApiHeaders
51
+ return post("/admin/auth/requestJWT", { collectionId });
52
+ }
53
+ auth.requestAdminJWT = requestAdminJWT;
54
+ /**
55
+ * Requests a JWT for the current user and a specific collection/product/proof
56
+ * Validates if the user has access to the resource, and returns a JWT
57
+ */
58
+ async function requestPublicJWT(collectionId, productId, proofId) {
59
+ // Use the provided token, or the one from getApiHeaders
60
+ return post("/public/auth/requestJWT", { collectionId, productId, proofId });
61
+ }
62
+ auth.requestPublicJWT = requestPublicJWT;
45
63
  /**
46
64
  * Gets current account information for the logged in user.
47
65
  * Returns user, owner, account, and location objects.
@@ -2,6 +2,7 @@ export { collection } from "./collection";
2
2
  export { product } from "./product";
3
3
  export { proof } from "./proof";
4
4
  export { appConfiguration } from "./appConfiguration";
5
+ export { appRecord } from "./appRecord";
5
6
  export { asset } from "./asset";
6
7
  export { attestation } from "./attestation";
7
8
  export { auth } from "./auth";
package/dist/api/index.js CHANGED
@@ -4,6 +4,7 @@ export { collection } from "./collection";
4
4
  export { product } from "./product";
5
5
  export { proof } from "./proof";
6
6
  export { appConfiguration } from "./appConfiguration";
7
+ export { appRecord } from "./appRecord";
7
8
  export { asset } from "./asset";
8
9
  export { attestation } from "./attestation";
9
10
  export { auth } from "./auth";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",