@proveanything/smartlinks 1.0.29 → 1.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.
- package/API_SUMMARY.md +672 -213
- package/README.md +430 -0
- package/dist/http.d.ts +5 -3
- package/dist/http.js +5 -3
- package/package.json +19 -3
- package/build-docs.ts +0 -69
- package/debug.log +0 -6
- package/examples/browser-demo.html +0 -43
- package/examples/node-demo.ts +0 -50
- package/examples/react-demo.tsx +0 -58
- package/generate-api-summary.js +0 -279
- package/generate-api-summary.ts +0 -83
- package/openapi.yaml +0 -130
- package/scripts/copy-docs.js +0 -11
- package/src/api/appConfiguration.ts +0 -104
- package/src/api/asset.ts +0 -133
- package/src/api/attestation.ts +0 -69
- package/src/api/auth.ts +0 -103
- package/src/api/batch.ts +0 -173
- package/src/api/claimSet.ts +0 -131
- package/src/api/collection.ts +0 -117
- package/src/api/crate.ts +0 -43
- package/src/api/form.ts +0 -57
- package/src/api/index.ts +0 -14
- package/src/api/product.ts +0 -128
- package/src/api/proof.ts +0 -32
- package/src/api/serialNumber.ts +0 -0
- package/src/api/variant.ts +0 -173
- package/src/http.ts +0 -363
- package/src/index.ts +0 -29
- package/src/types/appConfiguration.ts +0 -12
- package/src/types/asset.ts +0 -9
- package/src/types/attestation.ts +0 -19
- package/src/types/batch.ts +0 -15
- package/src/types/collection.ts +0 -68
- package/src/types/error.ts +0 -10
- package/src/types/index.ts +0 -11
- package/src/types/product.ts +0 -33
- package/src/types/proof.ts +0 -20
- package/src/types/serialNumber.ts +0 -0
- package/src/types/variant.ts +0 -15
- package/tsconfig.json +0 -15
- package/typedoc.json +0 -18
package/src/http.ts
DELETED
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
// src/http.ts
|
|
2
|
-
// This module replaces the ApiClient constructor. It keeps baseURL, apiKey, bearerToken
|
|
3
|
-
// in module-scope variables, and provides a shared `request<T>(path)` helper that will
|
|
4
|
-
// be used by all namespaced files (collection.ts, product.ts, etc.).
|
|
5
|
-
|
|
6
|
-
let baseURL: string | null = null
|
|
7
|
-
let apiKey: string | undefined = undefined
|
|
8
|
-
let bearerToken: string | undefined = undefined
|
|
9
|
-
let proxyMode: boolean = false
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Call this once (e.g. at app startup) to configure baseURL/auth.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Configuration options
|
|
15
|
-
* @property {string} options.baseURL - The root URL of the Smartlinks API (e.g. "https://smartlinks.app/api/v1")
|
|
16
|
-
* @property {string} [options.apiKey] - (Optional) API key for X-API-Key header
|
|
17
|
-
* @property {string} [options.bearerToken] - (Optional) Bearer token for AUTHORIZATION header
|
|
18
|
-
* @property {boolean} [options.proxyMode] - (Optional) Tells the API that it is running in an iframe via parent proxy
|
|
19
|
-
*/
|
|
20
|
-
export function initializeApi(options: {
|
|
21
|
-
baseURL: string
|
|
22
|
-
apiKey?: string
|
|
23
|
-
bearerToken?: string
|
|
24
|
-
proxyMode?: boolean
|
|
25
|
-
}): void {
|
|
26
|
-
baseURL = options.baseURL.replace(/\/+\$/, "") // trim trailing slash
|
|
27
|
-
apiKey = options.apiKey
|
|
28
|
-
bearerToken = options.bearerToken
|
|
29
|
-
proxyMode = !!options.proxyMode
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Allows setting the bearerToken at runtime (e.g. after login/logout).
|
|
34
|
-
*/
|
|
35
|
-
export function setBearerToken(token: string | undefined) {
|
|
36
|
-
bearerToken = token
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Map of pending proxy requests: id -> {resolve, reject}
|
|
40
|
-
const proxyPending: Record<string, { resolve: (data: any) => void, reject: (err: any) => void }> = {}
|
|
41
|
-
|
|
42
|
-
function generateProxyId(): string {
|
|
43
|
-
return "proxy_" + Math.random().toString(36).slice(2) + Date.now()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Shared listener for proxy responses
|
|
47
|
-
function ensureProxyListener() {
|
|
48
|
-
if ((window as any)._smartlinksProxyListener) return
|
|
49
|
-
window.addEventListener("message", (event) => {
|
|
50
|
-
const msg = event.data
|
|
51
|
-
if (!msg || !msg._smartlinksProxyResponse || !msg.id) return
|
|
52
|
-
const pending = proxyPending[msg.id]
|
|
53
|
-
if (pending) {
|
|
54
|
-
if (msg.error) {
|
|
55
|
-
pending.reject(new Error(msg.error))
|
|
56
|
-
} else {
|
|
57
|
-
pending.resolve(msg.data)
|
|
58
|
-
}
|
|
59
|
-
delete proxyPending[msg.id]
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
;(window as any)._smartlinksProxyListener = true
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Proxy request implementation
|
|
66
|
-
async function proxyRequest<T>(
|
|
67
|
-
method: string,
|
|
68
|
-
path: string,
|
|
69
|
-
body?: any,
|
|
70
|
-
headers?: Record<string, string>,
|
|
71
|
-
options?: RequestInit
|
|
72
|
-
): Promise<T> {
|
|
73
|
-
ensureProxyListener()
|
|
74
|
-
const id = generateProxyId()
|
|
75
|
-
const msg = {
|
|
76
|
-
_smartlinksProxyRequest: true,
|
|
77
|
-
id,
|
|
78
|
-
method,
|
|
79
|
-
path,
|
|
80
|
-
body,
|
|
81
|
-
headers,
|
|
82
|
-
options,
|
|
83
|
-
}
|
|
84
|
-
return new Promise<T>((resolve, reject) => {
|
|
85
|
-
proxyPending[id] = { resolve, reject }
|
|
86
|
-
window.parent.postMessage(msg, "*")
|
|
87
|
-
// Optionally: add a timeout here to reject if no response
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Internal helper that performs a GET request to \`\${baseURL}\${path}\`,
|
|
93
|
-
* injecting headers for apiKey or bearerToken if present.
|
|
94
|
-
* Returns the parsed JSON as T, or throws an Error.
|
|
95
|
-
*/
|
|
96
|
-
export async function request<T>(path: string): Promise<T> {
|
|
97
|
-
if (proxyMode) {
|
|
98
|
-
return proxyRequest<T>("GET", path)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (!baseURL) {
|
|
102
|
-
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.")
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const url = `${baseURL}${path}`
|
|
106
|
-
const headers: Record<string, string> = {
|
|
107
|
-
"Content-Type": "application/json",
|
|
108
|
-
}
|
|
109
|
-
if (apiKey) {
|
|
110
|
-
headers["X-API-Key"] = apiKey
|
|
111
|
-
}
|
|
112
|
-
if (bearerToken) {
|
|
113
|
-
headers["AUTHORIZATION"] = `Bearer ${bearerToken}`
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const response = await fetch(url, {
|
|
117
|
-
method: "GET",
|
|
118
|
-
headers,
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
if (!response.ok) {
|
|
122
|
-
// Try to parse ErrorResponse; if that fails, throw generic
|
|
123
|
-
try {
|
|
124
|
-
const errBody = (await response.json()) as import("./types/error").ErrorResponse
|
|
125
|
-
throw new Error(`Error ${errBody.code}: ${errBody.message}`)
|
|
126
|
-
} catch {
|
|
127
|
-
throw new Error(`Request to ${url} failed with status ${response.status}`)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return (await response.json()) as T
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Internal helper that performs a POST request to `${baseURL}${path}`,
|
|
136
|
-
* injecting headers for apiKey or bearerToken if present.
|
|
137
|
-
* If body is FormData, Content-Type is not set.
|
|
138
|
-
* Returns the parsed JSON as T, or throws an Error.
|
|
139
|
-
*/
|
|
140
|
-
export async function post<T>(
|
|
141
|
-
path: string,
|
|
142
|
-
body: any,
|
|
143
|
-
extraHeaders?: Record<string, string>
|
|
144
|
-
): Promise<T> {
|
|
145
|
-
if (proxyMode) {
|
|
146
|
-
return proxyRequest<T>("POST", path, body, extraHeaders)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!baseURL) {
|
|
150
|
-
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.")
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const url = `${baseURL}${path}`
|
|
154
|
-
const headers: Record<string, string> = extraHeaders ? { ...extraHeaders } : {}
|
|
155
|
-
|
|
156
|
-
if (apiKey) headers["X-API-Key"] = apiKey
|
|
157
|
-
if (bearerToken) headers["AUTHORIZATION"] = `Bearer ${bearerToken}`
|
|
158
|
-
|
|
159
|
-
// Only set Content-Type for non-FormData bodies
|
|
160
|
-
if (!(body instanceof FormData)) {
|
|
161
|
-
headers["Content-Type"] = "application/json"
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const response = await fetch(url, {
|
|
165
|
-
method: "POST",
|
|
166
|
-
headers,
|
|
167
|
-
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
if (!response.ok) {
|
|
171
|
-
try {
|
|
172
|
-
const errBody = (await response.json()) as import("./types/error").ErrorResponse
|
|
173
|
-
throw new Error(`Error ${errBody.code}: ${errBody.message}`)
|
|
174
|
-
} catch {
|
|
175
|
-
throw new Error(`Request to ${url} failed with status ${response.status}`)
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return (await response.json()) as T
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Internal helper that performs a PUT request to `${baseURL}${path}`,
|
|
184
|
-
* injecting headers for apiKey or bearerToken if present.
|
|
185
|
-
* If body is FormData, Content-Type is not set.
|
|
186
|
-
* Returns the parsed JSON as T, or throws an Error.
|
|
187
|
-
*/
|
|
188
|
-
export async function put<T>(
|
|
189
|
-
path: string,
|
|
190
|
-
body: any,
|
|
191
|
-
extraHeaders?: Record<string, string>
|
|
192
|
-
): Promise<T> {
|
|
193
|
-
if (proxyMode) {
|
|
194
|
-
return proxyRequest<T>("PUT", path, body, extraHeaders)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (!baseURL) {
|
|
198
|
-
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.")
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const url = `${baseURL}${path}`
|
|
202
|
-
const headers: Record<string, string> = extraHeaders ? { ...extraHeaders } : {}
|
|
203
|
-
|
|
204
|
-
if (apiKey) headers["X-API-Key"] = apiKey
|
|
205
|
-
if (bearerToken) headers["AUTHORIZATION"] = `Bearer ${bearerToken}`
|
|
206
|
-
|
|
207
|
-
// Only set Content-Type for non-FormData bodies
|
|
208
|
-
if (!(body instanceof FormData)) {
|
|
209
|
-
headers["Content-Type"] = "application/json"
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const response = await fetch(url, {
|
|
213
|
-
method: "PUT",
|
|
214
|
-
headers,
|
|
215
|
-
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
if (!response.ok) {
|
|
219
|
-
try {
|
|
220
|
-
const errBody = (await response.json()) as import("./types/error").ErrorResponse
|
|
221
|
-
throw new Error(`Error ${errBody.code}: ${errBody.message}`)
|
|
222
|
-
} catch {
|
|
223
|
-
throw new Error(`Request to ${url} failed with status ${response.status}`)
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return (await response.json()) as T
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Internal helper that performs a request to `${baseURL}${path}` with custom options,
|
|
232
|
-
* injecting headers for apiKey or bearerToken if present.
|
|
233
|
-
* Returns the parsed JSON as T, or throws an Error.
|
|
234
|
-
*/
|
|
235
|
-
export async function requestWithOptions<T>(
|
|
236
|
-
path: string,
|
|
237
|
-
options: RequestInit
|
|
238
|
-
): Promise<T> {
|
|
239
|
-
if (proxyMode) {
|
|
240
|
-
return proxyRequest<T>(options.method || "GET", path, options.body, options.headers as Record<string, string>, options)
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (!baseURL) {
|
|
244
|
-
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.")
|
|
245
|
-
}
|
|
246
|
-
const url = `${baseURL}${path}`
|
|
247
|
-
|
|
248
|
-
// Safely merge headers, converting Headers/init to Record<string, string>
|
|
249
|
-
let extraHeaders: Record<string, string> = {}
|
|
250
|
-
if (options.headers) {
|
|
251
|
-
if (options.headers instanceof Headers) {
|
|
252
|
-
options.headers.forEach((value, key) => {
|
|
253
|
-
extraHeaders[key] = value
|
|
254
|
-
})
|
|
255
|
-
} else if (Array.isArray(options.headers)) {
|
|
256
|
-
for (const [key, value] of options.headers) {
|
|
257
|
-
extraHeaders[key] = value
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
extraHeaders = { ...(options.headers as Record<string, string>) }
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const headers: Record<string, string> = {
|
|
265
|
-
"Content-Type": "application/json",
|
|
266
|
-
...(apiKey ? { "X-API-Key": apiKey } : {}),
|
|
267
|
-
...(bearerToken ? { "AUTHORIZATION": `Bearer ${bearerToken}` } : {}),
|
|
268
|
-
...extraHeaders,
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const response = await fetch(url, {
|
|
272
|
-
...options,
|
|
273
|
-
headers,
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
if (!response.ok) {
|
|
277
|
-
try {
|
|
278
|
-
const errBody = (await response.json()) as import("./types/error").ErrorResponse
|
|
279
|
-
throw new Error(`Error ${errBody.code}: ${errBody.message}`)
|
|
280
|
-
} catch {
|
|
281
|
-
throw new Error(`Request to ${url} failed with status ${response.status}`)
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return (await response.json()) as T
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Internal helper that performs a DELETE request to `${baseURL}${path}`,
|
|
290
|
-
* injecting headers for apiKey or bearerToken if present.
|
|
291
|
-
* Returns the parsed JSON as T, or throws an Error.
|
|
292
|
-
*/
|
|
293
|
-
export async function del<T>(
|
|
294
|
-
path: string,
|
|
295
|
-
extraHeaders?: Record<string, string>
|
|
296
|
-
): Promise<T> {
|
|
297
|
-
if (proxyMode) {
|
|
298
|
-
return proxyRequest<T>("DELETE", path, undefined, extraHeaders)
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (!baseURL) {
|
|
302
|
-
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.")
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const url = `${baseURL}${path}`
|
|
306
|
-
const headers: Record<string, string> = extraHeaders ? { ...extraHeaders } : {}
|
|
307
|
-
|
|
308
|
-
if (apiKey) headers["X-API-Key"] = apiKey
|
|
309
|
-
if (bearerToken) headers["AUTHORIZATION"] = `Bearer ${bearerToken}`
|
|
310
|
-
|
|
311
|
-
const response = await fetch(url, {
|
|
312
|
-
method: "DELETE",
|
|
313
|
-
headers,
|
|
314
|
-
})
|
|
315
|
-
|
|
316
|
-
if (!response.ok) {
|
|
317
|
-
try {
|
|
318
|
-
const errBody = (await response.json()) as import("./types/error").ErrorResponse
|
|
319
|
-
throw new Error(`Error ${errBody.code}: ${errBody.message}`)
|
|
320
|
-
} catch {
|
|
321
|
-
throw new Error(`Request to ${url} failed with status ${response.status}`)
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// If the response is empty, just return undefined
|
|
326
|
-
if (response.status === 204) return undefined as T
|
|
327
|
-
return (await response.json()) as T
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Returns the common headers used for API requests, including apiKey and bearerToken if set.
|
|
332
|
-
*/
|
|
333
|
-
export function getApiHeaders(): Record<string, string> {
|
|
334
|
-
const headers: Record<string, string> = {}
|
|
335
|
-
if (apiKey) headers["X-API-Key"] = apiKey
|
|
336
|
-
if (bearerToken) headers["AUTHORIZATION"] = `Bearer ${bearerToken}`
|
|
337
|
-
return headers
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Sends a custom proxy message in proxyMode and waits for a matching reply.
|
|
342
|
-
* @param request - The request type string
|
|
343
|
-
* @param params - The parameters object
|
|
344
|
-
* @returns The data from the proxy response
|
|
345
|
-
*/
|
|
346
|
-
export async function sendCustomProxyMessage<T = any>(request: string, params: any): Promise<T> {
|
|
347
|
-
if (!proxyMode) {
|
|
348
|
-
throw new Error("sendCustomProxyMessage can only be used in proxyMode");
|
|
349
|
-
}
|
|
350
|
-
ensureProxyListener();
|
|
351
|
-
const id = generateProxyId();
|
|
352
|
-
const msg = {
|
|
353
|
-
_smartlinksCustomProxyRequest: true,
|
|
354
|
-
id,
|
|
355
|
-
request,
|
|
356
|
-
params,
|
|
357
|
-
};
|
|
358
|
-
return new Promise<T>((resolve, reject) => {
|
|
359
|
-
proxyPending[id] = { resolve, reject };
|
|
360
|
-
window.parent.postMessage(msg, "*");
|
|
361
|
-
// Optionally: add a timeout here to reject if no response
|
|
362
|
-
});
|
|
363
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
// Top-level entrypoint of the npm package. Re-export initializeApi + all namespaces.
|
|
3
|
-
|
|
4
|
-
export { initializeApi, request, sendCustomProxyMessage } from "./http"
|
|
5
|
-
export * from "./api"
|
|
6
|
-
export * from "./types"
|
|
7
|
-
|
|
8
|
-
// Explicitly re-export types for documentation
|
|
9
|
-
export type {
|
|
10
|
-
LoginResponse,
|
|
11
|
-
VerifyTokenResponse,
|
|
12
|
-
AccountInfoResponse,
|
|
13
|
-
} from "./api/auth"
|
|
14
|
-
export type {
|
|
15
|
-
AttestationResponse,
|
|
16
|
-
AttestationCreateRequest,
|
|
17
|
-
AttestationUpdateRequest,
|
|
18
|
-
} from "./types/attestation"
|
|
19
|
-
export type {
|
|
20
|
-
BatchResponse,
|
|
21
|
-
BatchCreateRequest,
|
|
22
|
-
BatchUpdateRequest,
|
|
23
|
-
} from "./types/batch"
|
|
24
|
-
export type {
|
|
25
|
-
VariantResponse,
|
|
26
|
-
VariantCreateRequest,
|
|
27
|
-
VariantUpdateRequest,
|
|
28
|
-
} from "./types/variant"
|
|
29
|
-
export type { AppConfigOptions } from "./api/appConfiguration"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/types/appConfiguration.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents an App Configuration object.
|
|
4
|
-
*/
|
|
5
|
-
export interface AppConfigurationResponse {
|
|
6
|
-
/** Unique identifier for the app configuration */
|
|
7
|
-
id: string
|
|
8
|
-
/** Name of the app configuration */
|
|
9
|
-
name: string
|
|
10
|
-
/** Key-value pairs representing configuration settings */
|
|
11
|
-
settings?: Record<string, any>
|
|
12
|
-
}
|
package/src/types/asset.ts
DELETED
package/src/types/attestation.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface AttestationResponse {
|
|
2
|
-
id: string
|
|
3
|
-
createdAt: string
|
|
4
|
-
updatedAt: string
|
|
5
|
-
public: Record<string, any>
|
|
6
|
-
private: Record<string, any>
|
|
7
|
-
proof: Record<string, any>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface AttestationCreateRequest {
|
|
11
|
-
public: Record<string, any>
|
|
12
|
-
private: Record<string, any>
|
|
13
|
-
proof: Record<string, any>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface AttestationUpdateRequest {
|
|
17
|
-
type?: string
|
|
18
|
-
data?: Record<string, any>
|
|
19
|
-
}
|
package/src/types/batch.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// src/types/batch.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Batch object.
|
|
4
|
-
*/
|
|
5
|
-
export type BatchResponse = any
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Request payload for creating a new batch.
|
|
9
|
-
*/
|
|
10
|
-
export type BatchCreateRequest = any
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Request payload for updating an existing batch.
|
|
14
|
-
*/
|
|
15
|
-
export type BatchUpdateRequest = any
|
package/src/types/collection.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// src/types/collection.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Collection object.
|
|
4
|
-
*/
|
|
5
|
-
export interface CollectionResponse {
|
|
6
|
-
/** Unique identifier for the collection */
|
|
7
|
-
id: string
|
|
8
|
-
/** Human-readable title of the collection */
|
|
9
|
-
title: string
|
|
10
|
-
/** Description of collection */
|
|
11
|
-
description: string
|
|
12
|
-
|
|
13
|
-
/** URL to the collection's larger header/hero image */
|
|
14
|
-
headerImage?: {
|
|
15
|
-
/** URL to the asset */
|
|
16
|
-
url: string
|
|
17
|
-
/** Thumbnail URLs in different sizes */
|
|
18
|
-
thumbnails: {
|
|
19
|
-
x100: string
|
|
20
|
-
x200: string
|
|
21
|
-
x512: string
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/** URL to the collection's logo image */
|
|
25
|
-
logoImage?: {
|
|
26
|
-
/** URL to the asset */
|
|
27
|
-
url: string
|
|
28
|
-
/** Thumbnail URLs in different sizes */
|
|
29
|
-
thumbnails: {
|
|
30
|
-
x100: string
|
|
31
|
-
x200: string
|
|
32
|
-
x512: string
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** Collection's loader image */
|
|
36
|
-
loaderImage?: {
|
|
37
|
-
/** Override name for the file */
|
|
38
|
-
overwriteName: string
|
|
39
|
-
/** Name of the asset */
|
|
40
|
-
name: string
|
|
41
|
-
/** File type/extension */
|
|
42
|
-
type: string
|
|
43
|
-
/** URL to the asset */
|
|
44
|
-
url: string
|
|
45
|
-
}
|
|
46
|
-
/** Array of supported languages */
|
|
47
|
-
languages?: {
|
|
48
|
-
/** Language code (e.g., "fr", "it", "es") */
|
|
49
|
-
code: string
|
|
50
|
-
/** Human-readable language name (e.g., "French", "Italian") */
|
|
51
|
-
lang: string
|
|
52
|
-
/** Whether this language is supported */
|
|
53
|
-
supported: boolean
|
|
54
|
-
}[],
|
|
55
|
-
/** User roles mapping with user IDs as keys and role names as values */
|
|
56
|
-
roles: {
|
|
57
|
-
[userId: string]: string
|
|
58
|
-
}
|
|
59
|
-
/** Array of group tag names */
|
|
60
|
-
groupTags?: string[]
|
|
61
|
-
/** Whether the collection has a custom domain */
|
|
62
|
-
redirectUrl?: string
|
|
63
|
-
/** The shortId of this collection */
|
|
64
|
-
shortId: string,
|
|
65
|
-
/** if dark mode is enabled for this collection */
|
|
66
|
-
dark?: boolean
|
|
67
|
-
|
|
68
|
-
}
|
package/src/types/error.ts
DELETED
package/src/types/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// src/types/index.ts
|
|
2
|
-
// Re-export all type modules so consumers can import types directly
|
|
3
|
-
|
|
4
|
-
export * from "./collection"
|
|
5
|
-
export * from "./product"
|
|
6
|
-
export * from "./proof"
|
|
7
|
-
export * from "./appConfiguration"
|
|
8
|
-
export * from "./error"
|
|
9
|
-
export * from "./asset"
|
|
10
|
-
export * from "./batch"
|
|
11
|
-
export * from "./variant"
|
package/src/types/product.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// src/types/product.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Product Item object.
|
|
4
|
-
*/
|
|
5
|
-
export interface ProductResponse {
|
|
6
|
-
/** Unique identifier for the product */
|
|
7
|
-
id: string
|
|
8
|
-
/** Name of the product */
|
|
9
|
-
name: string
|
|
10
|
-
/** Unique identifier for the product's collection */
|
|
11
|
-
collectionId: string
|
|
12
|
-
/** Detailed description of the product */
|
|
13
|
-
description: string
|
|
14
|
-
/** Hero image asset object */
|
|
15
|
-
heroImage: {
|
|
16
|
-
/** URL to the asset */
|
|
17
|
-
url: string
|
|
18
|
-
/** Thumbnail URLs in different sizes */
|
|
19
|
-
thumbnails: {
|
|
20
|
-
x100: string
|
|
21
|
-
x200: string
|
|
22
|
-
x512: string
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/** Flexible map of tags with true/false values */
|
|
26
|
-
groupTags: {
|
|
27
|
-
[tagName: string]: boolean
|
|
28
|
-
}
|
|
29
|
-
/** Flexible key/value data map */
|
|
30
|
-
data: {
|
|
31
|
-
[key: string]: any
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/types/proof.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/types/proof.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Proof object.
|
|
4
|
-
*/
|
|
5
|
-
export interface ProofResponse {
|
|
6
|
-
/** Unique identifier for the collection */
|
|
7
|
-
collectionId: string
|
|
8
|
-
/** Creation timestamp */
|
|
9
|
-
createdAt: string
|
|
10
|
-
/** Unique identifier for the proof */
|
|
11
|
-
id: string
|
|
12
|
-
/** Unique identifier for the product */
|
|
13
|
-
productId: string
|
|
14
|
-
/** Unique identifier for the token */
|
|
15
|
-
tokenId: string
|
|
16
|
-
/** Unique identifier for the user */
|
|
17
|
-
userId: string
|
|
18
|
-
/** Arbitrary key-value pairs for proof values */
|
|
19
|
-
values: Record<string, any>
|
|
20
|
-
}
|
|
File without changes
|
package/src/types/variant.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// src/types/variant.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Variant object.
|
|
4
|
-
*/
|
|
5
|
-
export type VariantResponse = any
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Request payload for creating a new variant.
|
|
9
|
-
*/
|
|
10
|
-
export type VariantCreateRequest = any
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Request payload for updating an existing variant.
|
|
14
|
-
*/
|
|
15
|
-
export type VariantUpdateRequest = any
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2017",
|
|
4
|
-
"module": "ES6",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
-
},
|
|
12
|
-
"include": [
|
|
13
|
-
"src/**/*"
|
|
14
|
-
]
|
|
15
|
-
}
|
package/typedoc.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"entryPoints": ["src/index.ts"],
|
|
3
|
-
"out": "docs",
|
|
4
|
-
"json": "docs/documentation.json",
|
|
5
|
-
"excludeInternal": true,
|
|
6
|
-
"excludePrivate": true,
|
|
7
|
-
"excludeProtected": true,
|
|
8
|
-
"excludeExternals": true,
|
|
9
|
-
"includeVersion": false,
|
|
10
|
-
"disableSources": true,
|
|
11
|
-
"hideGenerator": true,
|
|
12
|
-
"sort": ["source-order"],
|
|
13
|
-
"categorizeByGroup": false,
|
|
14
|
-
"searchInComments": false,
|
|
15
|
-
"cleanOutputDir": true,
|
|
16
|
-
"treatWarningsAsErrors": false,
|
|
17
|
-
"skipErrorChecking": true
|
|
18
|
-
}
|