@proveanything/smartlinks 1.4.8 → 1.5.1

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,371 @@
1
+ /**
2
+ * Visibility levels for app objects
3
+ */
4
+ export type Visibility = 'public' | 'owner' | 'admin';
5
+ /**
6
+ * Caller role types
7
+ */
8
+ export type CallerRole = 'admin' | 'owner' | 'public';
9
+ /**
10
+ * Paginated response wrapper for list endpoints
11
+ */
12
+ export interface PaginatedResponse<T> {
13
+ data: T[];
14
+ total: number;
15
+ limit: number;
16
+ offset: number;
17
+ }
18
+ /**
19
+ * Request body for aggregate endpoints
20
+ */
21
+ export interface AggregateRequest {
22
+ filters?: {
23
+ status?: string;
24
+ category?: string;
25
+ record_type?: string;
26
+ product_id?: string;
27
+ created_at?: {
28
+ gte?: string;
29
+ lte?: string;
30
+ };
31
+ closed_at?: '__notnull__' | {
32
+ gte?: string;
33
+ lte?: string;
34
+ };
35
+ expires_at?: {
36
+ lte?: string;
37
+ };
38
+ };
39
+ groupBy?: string[];
40
+ metrics?: string[];
41
+ timeSeriesField?: string;
42
+ timeSeriesInterval?: 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
43
+ }
44
+ /**
45
+ * Response from aggregate endpoints
46
+ */
47
+ export interface AggregateResponse {
48
+ groups?: ({
49
+ count: number;
50
+ } & Record<string, unknown>)[];
51
+ timeSeries?: ({
52
+ bucket: string;
53
+ count: number;
54
+ } & Record<string, unknown>)[];
55
+ count?: number;
56
+ avg_close_time_seconds?: number;
57
+ p50_close_time_seconds?: number;
58
+ p95_close_time_seconds?: number;
59
+ total_replies?: number;
60
+ avg_replies?: number;
61
+ }
62
+ /**
63
+ * Common query parameters for list endpoints
64
+ */
65
+ export interface ListQueryParams {
66
+ limit?: number;
67
+ offset?: number;
68
+ sort?: string;
69
+ includeDeleted?: boolean;
70
+ status?: string;
71
+ productId?: string;
72
+ createdAt?: string;
73
+ updatedAt?: string;
74
+ }
75
+ /**
76
+ * App Case object
77
+ */
78
+ export interface AppCase {
79
+ id: string;
80
+ orgId: string;
81
+ collectionId: string;
82
+ appId: string;
83
+ visibility: Visibility;
84
+ ref: string | null;
85
+ status: string;
86
+ priority: number | null;
87
+ category: string | null;
88
+ assignedTo: string | null;
89
+ productId: string | null;
90
+ proofId: string | null;
91
+ contactId: string | null;
92
+ createdAt: string;
93
+ updatedAt: string;
94
+ closedAt: string | null;
95
+ deletedAt: string | null;
96
+ data: Record<string, unknown>;
97
+ owner: Record<string, unknown>;
98
+ admin: Record<string, unknown>;
99
+ }
100
+ /**
101
+ * Input for creating a new case
102
+ */
103
+ export interface CreateCaseInput {
104
+ visibility?: Visibility;
105
+ ref?: string;
106
+ status?: string;
107
+ priority?: number;
108
+ category?: string;
109
+ assignedTo?: string;
110
+ productId?: string;
111
+ proofId?: string;
112
+ contactId?: string;
113
+ data?: Record<string, unknown>;
114
+ owner?: Record<string, unknown>;
115
+ admin?: Record<string, unknown>;
116
+ }
117
+ /**
118
+ * Input for updating a case
119
+ */
120
+ export interface UpdateCaseInput {
121
+ data?: Record<string, unknown>;
122
+ owner?: Record<string, unknown>;
123
+ admin?: Record<string, unknown>;
124
+ status?: string;
125
+ priority?: number;
126
+ category?: string;
127
+ assignedTo?: string;
128
+ ref?: string;
129
+ }
130
+ /**
131
+ * Input for appending to case history
132
+ */
133
+ export interface AppendHistoryInput {
134
+ entry?: Record<string, unknown>;
135
+ historyTarget?: 'owner' | 'admin';
136
+ status?: string;
137
+ priority?: number;
138
+ assignedTo?: string;
139
+ }
140
+ /**
141
+ * Request for case summary
142
+ */
143
+ export interface CaseSummaryRequest {
144
+ period?: {
145
+ from: string;
146
+ to: string;
147
+ };
148
+ }
149
+ /**
150
+ * Response from case summary endpoint
151
+ */
152
+ export interface CaseSummaryResponse {
153
+ total: number;
154
+ byStatus: Record<string, number>;
155
+ byPriority: Record<string, number>;
156
+ trend: {
157
+ week: string;
158
+ count: number;
159
+ }[];
160
+ }
161
+ /**
162
+ * Query parameters for listing cases
163
+ */
164
+ export interface CaseListQueryParams extends ListQueryParams {
165
+ category?: string;
166
+ priority?: string;
167
+ ref?: string;
168
+ proofId?: string;
169
+ contactId?: string;
170
+ assignedTo?: string;
171
+ closedAt?: string;
172
+ }
173
+ /**
174
+ * Reply entry in a thread
175
+ */
176
+ export interface ReplyEntry {
177
+ at: string;
178
+ authorId?: string;
179
+ authorType?: string;
180
+ [key: string]: unknown;
181
+ }
182
+ /**
183
+ * App Thread object
184
+ */
185
+ export interface AppThread {
186
+ id: string;
187
+ orgId: string;
188
+ collectionId: string;
189
+ appId: string;
190
+ visibility: Visibility;
191
+ slug: string | null;
192
+ title: string | null;
193
+ status: string;
194
+ authorId: string | null;
195
+ authorType: string;
196
+ productId: string | null;
197
+ proofId: string | null;
198
+ contactId: string | null;
199
+ parentType: string | null;
200
+ parentId: string | null;
201
+ replyCount: number;
202
+ lastReplyAt: string | null;
203
+ createdAt: string;
204
+ updatedAt: string;
205
+ deletedAt: string | null;
206
+ body: Record<string, unknown>;
207
+ replies: ReplyEntry[];
208
+ tags: string[];
209
+ data: Record<string, unknown>;
210
+ owner: Record<string, unknown>;
211
+ admin: Record<string, unknown>;
212
+ }
213
+ /**
214
+ * Input for creating a new thread
215
+ */
216
+ export interface CreateThreadInput {
217
+ visibility?: Visibility;
218
+ slug?: string;
219
+ title?: string;
220
+ status?: string;
221
+ authorId?: string;
222
+ authorType?: string;
223
+ productId?: string;
224
+ proofId?: string;
225
+ contactId?: string;
226
+ parentType?: string;
227
+ parentId?: string;
228
+ body?: Record<string, unknown>;
229
+ tags?: string[];
230
+ data?: Record<string, unknown>;
231
+ owner?: Record<string, unknown>;
232
+ admin?: Record<string, unknown>;
233
+ }
234
+ /**
235
+ * Input for updating a thread
236
+ */
237
+ export interface UpdateThreadInput {
238
+ body?: Record<string, unknown>;
239
+ tags?: string[];
240
+ data?: Record<string, unknown>;
241
+ owner?: Record<string, unknown>;
242
+ admin?: Record<string, unknown>;
243
+ title?: string;
244
+ slug?: string;
245
+ status?: string;
246
+ visibility?: Visibility;
247
+ }
248
+ /**
249
+ * Input for adding a reply to a thread
250
+ */
251
+ export interface ReplyInput {
252
+ authorId?: string;
253
+ authorType?: string;
254
+ [key: string]: unknown;
255
+ }
256
+ /**
257
+ * Query parameters for listing threads
258
+ */
259
+ export interface ThreadListQueryParams extends ListQueryParams {
260
+ slug?: string;
261
+ authorId?: string;
262
+ parentType?: string;
263
+ parentId?: string;
264
+ tag?: string;
265
+ contactId?: string;
266
+ }
267
+ /**
268
+ * App Record object
269
+ */
270
+ export interface AppRecord {
271
+ id: string;
272
+ orgId: string;
273
+ collectionId: string;
274
+ appId: string;
275
+ visibility: Visibility;
276
+ recordType: string;
277
+ ref: string | null;
278
+ status: string;
279
+ productId: string | null;
280
+ proofId: string | null;
281
+ contactId: string | null;
282
+ authorId: string | null;
283
+ authorType: string;
284
+ parentType: string | null;
285
+ parentId: string | null;
286
+ createdAt: string;
287
+ updatedAt: string;
288
+ startsAt: string | null;
289
+ expiresAt: string | null;
290
+ deletedAt: string | null;
291
+ data: Record<string, unknown>;
292
+ owner: Record<string, unknown>;
293
+ admin: Record<string, unknown>;
294
+ }
295
+ /**
296
+ * Input for creating a new record
297
+ */
298
+ export interface CreateRecordInput {
299
+ recordType: string;
300
+ visibility?: Visibility;
301
+ ref?: string;
302
+ status?: string;
303
+ productId?: string;
304
+ proofId?: string;
305
+ contactId?: string;
306
+ authorId?: string;
307
+ authorType?: string;
308
+ parentType?: string;
309
+ parentId?: string;
310
+ startsAt?: string;
311
+ expiresAt?: string;
312
+ data?: Record<string, unknown>;
313
+ owner?: Record<string, unknown>;
314
+ admin?: Record<string, unknown>;
315
+ }
316
+ /**
317
+ * Input for updating a record
318
+ */
319
+ export interface UpdateRecordInput {
320
+ data?: Record<string, unknown>;
321
+ owner?: Record<string, unknown>;
322
+ admin?: Record<string, unknown>;
323
+ status?: string;
324
+ visibility?: Visibility;
325
+ ref?: string;
326
+ recordType?: string;
327
+ startsAt?: string;
328
+ expiresAt?: string;
329
+ }
330
+ /**
331
+ * Query parameters for listing records
332
+ */
333
+ export interface RecordListQueryParams extends ListQueryParams {
334
+ recordType?: string;
335
+ ref?: string;
336
+ proofId?: string;
337
+ authorId?: string;
338
+ parentType?: string;
339
+ parentId?: string;
340
+ startsAt?: string;
341
+ expiresAt?: string;
342
+ contactId?: string;
343
+ }
344
+ /**
345
+ * Response from case related endpoint
346
+ */
347
+ export interface RelatedResponse {
348
+ threads: AppThread[];
349
+ records: AppRecord[];
350
+ }
351
+ /**
352
+ * Public create policy configuration
353
+ */
354
+ export interface PublicCreatePolicy {
355
+ cases?: PublicCreateRule;
356
+ threads?: PublicCreateRule;
357
+ records?: PublicCreateRule;
358
+ }
359
+ /**
360
+ * Rule for public create operations
361
+ */
362
+ export interface PublicCreateRule {
363
+ allow: {
364
+ anonymous?: boolean;
365
+ authenticated?: boolean;
366
+ };
367
+ enforce?: {
368
+ anonymous?: Partial<CreateCaseInput | CreateThreadInput | CreateRecordInput>;
369
+ authenticated?: Partial<CreateCaseInput | CreateThreadInput | CreateRecordInput>;
370
+ };
371
+ }
@@ -0,0 +1,2 @@
1
+ // src/types/appObjects.ts
2
+ export {};
@@ -28,3 +28,4 @@ export * from "./crate";
28
28
  export * from "./iframeResponder";
29
29
  export * from "./ai";
30
30
  export * from "./appManifest";
31
+ export * from "./appObjects";
@@ -30,3 +30,4 @@ export * from "./crate";
30
30
  export * from "./iframeResponder";
31
31
  export * from "./ai";
32
32
  export * from "./appManifest";
33
+ export * from "./appObjects";