@snappy-stack/sdk 0.1.4 → 0.1.6

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,325 @@
1
+ interface SnappyConfig {
2
+ token: string;
3
+ sessionToken?: string;
4
+ baseUrl?: string;
5
+ locale?: string;
6
+ }
7
+ interface SnappyList<T> {
8
+ data: T[];
9
+ count: number;
10
+ _latency?: number;
11
+ }
12
+ interface SnappyOne<T> {
13
+ data: T;
14
+ _latency?: number;
15
+ }
16
+ interface Entry {
17
+ id: string;
18
+ collection_slug: string;
19
+ slug: string;
20
+ content: any;
21
+ status: 'DRAFT' | 'REVIEW' | 'SCHEDULED' | 'PUBLISHED' | 'ARCHIVED';
22
+ locale: string;
23
+ version: number;
24
+ published_at: string | null;
25
+ created_at: string;
26
+ updated_at: string;
27
+ }
28
+ interface Global {
29
+ id: string;
30
+ slug: string;
31
+ content: any;
32
+ locale: string;
33
+ updated_at: string;
34
+ }
35
+ interface Media {
36
+ id: string;
37
+ filename: string;
38
+ alt: string;
39
+ mime_type: string;
40
+ size: number;
41
+ folder: string;
42
+ status: 'PENDING' | 'COMPLETE';
43
+ url_original: string;
44
+ url_lg?: string;
45
+ url_md?: string;
46
+ url_thumb?: string;
47
+ url_og?: string;
48
+ created_at: string;
49
+ }
50
+ interface Project {
51
+ id: string;
52
+ slug: string;
53
+ name: string;
54
+ domain: string;
55
+ template: 'portfolio' | 'institution' | 'store' | 'artist';
56
+ modules: Record<string, boolean>;
57
+ status: 'ACTIVE' | 'INACTIVE';
58
+ payment_status: 'trial' | 'paid' | 'overdue' | 'suspended';
59
+ db_url: string;
60
+ db_token: string;
61
+ studio_name: string;
62
+ studio_url: string;
63
+ created_at: string;
64
+ updated_at: string;
65
+ }
66
+ interface User {
67
+ id: string;
68
+ email: string;
69
+ role: 'admin' | 'editor' | 'viewer';
70
+ }
71
+ interface Review {
72
+ id: string;
73
+ entry_id?: string;
74
+ author_name?: string;
75
+ rating?: number;
76
+ content?: string;
77
+ submitted_at?: string;
78
+ is_used: boolean;
79
+ status: 'ACTIVE' | 'INACTIVE';
80
+ expired_at: string | null;
81
+ created_at: string;
82
+ }
83
+ interface ReviewStatus {
84
+ exists: boolean;
85
+ is_used: boolean;
86
+ }
87
+ interface Heartbeat {
88
+ status: 'ACTIVE' | 'MAINTENANCE' | 'SUSPENDED' | 'INACTIVE';
89
+ payment_status: 'trial' | 'paid' | 'overdue' | 'suspended';
90
+ message?: string;
91
+ modules: Record<string, boolean>;
92
+ studio_name?: string;
93
+ studio_url?: string;
94
+ project_name?: string;
95
+ }
96
+ interface SiteSettings {
97
+ id: string;
98
+ site_name: string;
99
+ meta_description: string;
100
+ og_image_url: string;
101
+ favicon_url: string;
102
+ accent_primary: string;
103
+ accent_secondary: string;
104
+ font_heading: string;
105
+ font_body: string;
106
+ updated_at: string;
107
+ }
108
+ interface Social {
109
+ id: string;
110
+ platform: string;
111
+ url: string;
112
+ sort_order: number;
113
+ updated_at: string;
114
+ }
115
+ interface SnappyProfile {
116
+ site_settings?: SiteSettings;
117
+ socials?: Social[];
118
+ profile?: any;
119
+ contact?: any;
120
+ store_config?: any;
121
+ booking_config?: any;
122
+ reviews_config?: any;
123
+ ppdb_config?: any;
124
+ payment_config?: any;
125
+ }
126
+
127
+ declare class SnappyClient {
128
+ private config;
129
+ constructor(config: SnappyConfig);
130
+ private fetch;
131
+ content: {
132
+ getCollections: () => Promise<SnappyList<any>>;
133
+ collection: (slug: string) => {
134
+ getAll: (params?: {
135
+ locale?: string;
136
+ status?: string;
137
+ limit?: number;
138
+ offset?: number;
139
+ }) => Promise<SnappyList<Entry>>;
140
+ getOne: (id: string, locale?: string) => Promise<SnappyOne<Entry>>;
141
+ create: (data: any) => Promise<SnappyOne<Entry>>;
142
+ update: (id: string, data: any) => Promise<SnappyOne<Entry>>;
143
+ publish: (id: string, version: number) => Promise<SnappyOne<Entry>>;
144
+ delete: (id: string) => Promise<SnappyOne<any>>;
145
+ };
146
+ global: (slug: string) => {
147
+ get: (locale?: string) => Promise<SnappyOne<Global>>;
148
+ update: (data: any, locale?: string) => Promise<SnappyOne<Global>>;
149
+ };
150
+ };
151
+ profile: {
152
+ get: () => Promise<SnappyOne<any>>;
153
+ update: (data: any) => Promise<SnappyOne<any>>;
154
+ updateSocial: (data: {
155
+ id?: string;
156
+ platform: string;
157
+ url: string;
158
+ sort_order?: number;
159
+ }) => Promise<SnappyOne<any>>;
160
+ deleteSocial: (id: string) => Promise<SnappyOne<any>>;
161
+ updateSettings: (data: any) => Promise<SnappyOne<any>>;
162
+ };
163
+ collection(slug: string): {
164
+ getAll: (params?: {
165
+ locale?: string;
166
+ status?: string;
167
+ limit?: number;
168
+ offset?: number;
169
+ }) => Promise<SnappyList<Entry>>;
170
+ getOne: (id: string, locale?: string) => Promise<SnappyOne<Entry>>;
171
+ create: (data: any) => Promise<SnappyOne<Entry>>;
172
+ update: (id: string, data: any) => Promise<SnappyOne<Entry>>;
173
+ publish: (id: string, version: number) => Promise<SnappyOne<Entry>>;
174
+ delete: (id: string) => Promise<SnappyOne<any>>;
175
+ };
176
+ global(slug: string): {
177
+ get: (locale?: string) => Promise<SnappyOne<Global>>;
178
+ update: (data: any, locale?: string) => Promise<SnappyOne<Global>>;
179
+ };
180
+ media: {
181
+ stats: () => Promise<SnappyOne<{
182
+ used_bytes: number;
183
+ file_count: number;
184
+ }>>;
185
+ list: (params?: {
186
+ folder?: string;
187
+ limit?: number;
188
+ offset?: number;
189
+ }) => Promise<SnappyList<Media>>;
190
+ getOne: (id: string) => Promise<SnappyOne<Media>>;
191
+ process: (data: {
192
+ filename: string;
193
+ mime_type: string;
194
+ size: number;
195
+ folder?: string;
196
+ }) => Promise<SnappyOne<{
197
+ id: string;
198
+ uploadUrl: string;
199
+ filename: string;
200
+ }>>;
201
+ confirm: (id: string) => Promise<SnappyOne<Media>>;
202
+ renameFolder: (old_name: string, new_name: string) => Promise<SnappyOne<{
203
+ updated: number;
204
+ }>>;
205
+ delete: (id: string) => Promise<void>;
206
+ };
207
+ reviews: {
208
+ list: (status?: string) => Promise<SnappyList<Review>>;
209
+ getOne: (id: string) => Promise<SnappyOne<Review>>;
210
+ create: (data: {
211
+ entry_id?: string;
212
+ expires_in?: string;
213
+ }) => Promise<SnappyOne<Review>>;
214
+ submit: (id: string, data: {
215
+ author_name: string;
216
+ rating: number;
217
+ content: string;
218
+ }) => Promise<SnappyOne<{
219
+ message: string;
220
+ }>>;
221
+ delete: (id: string) => Promise<SnappyOne<{
222
+ message: string;
223
+ }>>;
224
+ };
225
+ releases: {
226
+ getAll: () => Promise<SnappyList<any>>;
227
+ create: (data: any) => Promise<SnappyOne<any>>;
228
+ publish: (id: string) => Promise<{
229
+ _latency: number;
230
+ }>;
231
+ };
232
+ heartbeat(): Promise<SnappyOne<Heartbeat>>;
233
+ search(query: string, locale?: string): Promise<SnappyList<any>>;
234
+ admin: {
235
+ getStats: () => Promise<{
236
+ _latency: number;
237
+ }>;
238
+ getCollections: () => Promise<{
239
+ _latency: number;
240
+ }>;
241
+ getProjects: () => Promise<SnappyList<Project>>;
242
+ getProject: (slug: string) => Promise<SnappyOne<Project>>;
243
+ updateProject: (slug: string, updates: any) => Promise<{
244
+ _latency: number;
245
+ }>;
246
+ updateStatus: (slug: string, status: string) => Promise<{
247
+ _latency: number;
248
+ }>;
249
+ updatePayment: (slug: string, status: string) => Promise<{
250
+ _latency: number;
251
+ }>;
252
+ rotateLicense: (slug: string) => Promise<{
253
+ _latency: number;
254
+ }>;
255
+ deleteProject: (slug: string) => Promise<{
256
+ _latency: number;
257
+ }>;
258
+ inviteUser: (email: string, permissions: string[], projectSlug: string) => Promise<{
259
+ _latency: number;
260
+ }>;
261
+ getMe: () => Promise<SnappyOne<User>>;
262
+ getProjectToken: (slug: string) => Promise<{
263
+ _latency: number;
264
+ }>;
265
+ getOrders: () => Promise<{
266
+ _latency: number;
267
+ }>;
268
+ getPPDBSubmissions: () => Promise<{
269
+ _latency: number;
270
+ }>;
271
+ getReviews: (status?: string) => Promise<{
272
+ _latency: number;
273
+ }>;
274
+ getProjectUsers: (slug: string) => Promise<{
275
+ _latency: number;
276
+ }>;
277
+ manageUser: (slug: string, userId: string, permissions: string[]) => Promise<{
278
+ _latency: number;
279
+ }>;
280
+ revokeUser: (slug: string, userId: string) => Promise<{
281
+ _latency: number;
282
+ }>;
283
+ };
284
+ /**
285
+ * Get the SNAPPY Score for the current project
286
+ */
287
+ getScore(): Promise<{
288
+ score: number;
289
+ warning?: string;
290
+ blocked: boolean;
291
+ }>;
292
+ }
293
+ declare class SnappyPublicClient {
294
+ private baseUrl;
295
+ constructor(config?: {
296
+ baseUrl?: string;
297
+ });
298
+ private fetch;
299
+ reviews: {
300
+ getOne: (id: string) => Promise<SnappyOne<ReviewStatus>>;
301
+ submit: (id: string, data: {
302
+ author_name: string;
303
+ rating: number;
304
+ content: string;
305
+ }) => Promise<SnappyOne<{
306
+ message: string;
307
+ }>>;
308
+ };
309
+ ppdb: {
310
+ submit: (data: any) => Promise<SnappyOne<{
311
+ message: string;
312
+ }>>;
313
+ };
314
+ orders: {
315
+ submit: (data: any) => Promise<SnappyOne<{
316
+ message: string;
317
+ }>>;
318
+ };
319
+ }
320
+ declare function createClient(config: SnappyConfig): SnappyClient;
321
+ declare function createPublicClient(config?: {
322
+ baseUrl?: string;
323
+ }): SnappyPublicClient;
324
+
325
+ export { type Entry as E, type Global as G, type Heartbeat as H, type Media as M, type Project as P, type Review as R, type SiteSettings as S, type User as U, type ReviewStatus as a, SnappyClient as b, type SnappyConfig as c, type SnappyList as d, type SnappyOne as e, type SnappyProfile as f, SnappyPublicClient as g, type Social as h, createClient as i, createPublicClient as j };
@@ -0,0 +1,325 @@
1
+ interface SnappyConfig {
2
+ token: string;
3
+ sessionToken?: string;
4
+ baseUrl?: string;
5
+ locale?: string;
6
+ }
7
+ interface SnappyList<T> {
8
+ data: T[];
9
+ count: number;
10
+ _latency?: number;
11
+ }
12
+ interface SnappyOne<T> {
13
+ data: T;
14
+ _latency?: number;
15
+ }
16
+ interface Entry {
17
+ id: string;
18
+ collection_slug: string;
19
+ slug: string;
20
+ content: any;
21
+ status: 'DRAFT' | 'REVIEW' | 'SCHEDULED' | 'PUBLISHED' | 'ARCHIVED';
22
+ locale: string;
23
+ version: number;
24
+ published_at: string | null;
25
+ created_at: string;
26
+ updated_at: string;
27
+ }
28
+ interface Global {
29
+ id: string;
30
+ slug: string;
31
+ content: any;
32
+ locale: string;
33
+ updated_at: string;
34
+ }
35
+ interface Media {
36
+ id: string;
37
+ filename: string;
38
+ alt: string;
39
+ mime_type: string;
40
+ size: number;
41
+ folder: string;
42
+ status: 'PENDING' | 'COMPLETE';
43
+ url_original: string;
44
+ url_lg?: string;
45
+ url_md?: string;
46
+ url_thumb?: string;
47
+ url_og?: string;
48
+ created_at: string;
49
+ }
50
+ interface Project {
51
+ id: string;
52
+ slug: string;
53
+ name: string;
54
+ domain: string;
55
+ template: 'portfolio' | 'institution' | 'store' | 'artist';
56
+ modules: Record<string, boolean>;
57
+ status: 'ACTIVE' | 'INACTIVE';
58
+ payment_status: 'trial' | 'paid' | 'overdue' | 'suspended';
59
+ db_url: string;
60
+ db_token: string;
61
+ studio_name: string;
62
+ studio_url: string;
63
+ created_at: string;
64
+ updated_at: string;
65
+ }
66
+ interface User {
67
+ id: string;
68
+ email: string;
69
+ role: 'admin' | 'editor' | 'viewer';
70
+ }
71
+ interface Review {
72
+ id: string;
73
+ entry_id?: string;
74
+ author_name?: string;
75
+ rating?: number;
76
+ content?: string;
77
+ submitted_at?: string;
78
+ is_used: boolean;
79
+ status: 'ACTIVE' | 'INACTIVE';
80
+ expired_at: string | null;
81
+ created_at: string;
82
+ }
83
+ interface ReviewStatus {
84
+ exists: boolean;
85
+ is_used: boolean;
86
+ }
87
+ interface Heartbeat {
88
+ status: 'ACTIVE' | 'MAINTENANCE' | 'SUSPENDED' | 'INACTIVE';
89
+ payment_status: 'trial' | 'paid' | 'overdue' | 'suspended';
90
+ message?: string;
91
+ modules: Record<string, boolean>;
92
+ studio_name?: string;
93
+ studio_url?: string;
94
+ project_name?: string;
95
+ }
96
+ interface SiteSettings {
97
+ id: string;
98
+ site_name: string;
99
+ meta_description: string;
100
+ og_image_url: string;
101
+ favicon_url: string;
102
+ accent_primary: string;
103
+ accent_secondary: string;
104
+ font_heading: string;
105
+ font_body: string;
106
+ updated_at: string;
107
+ }
108
+ interface Social {
109
+ id: string;
110
+ platform: string;
111
+ url: string;
112
+ sort_order: number;
113
+ updated_at: string;
114
+ }
115
+ interface SnappyProfile {
116
+ site_settings?: SiteSettings;
117
+ socials?: Social[];
118
+ profile?: any;
119
+ contact?: any;
120
+ store_config?: any;
121
+ booking_config?: any;
122
+ reviews_config?: any;
123
+ ppdb_config?: any;
124
+ payment_config?: any;
125
+ }
126
+
127
+ declare class SnappyClient {
128
+ private config;
129
+ constructor(config: SnappyConfig);
130
+ private fetch;
131
+ content: {
132
+ getCollections: () => Promise<SnappyList<any>>;
133
+ collection: (slug: string) => {
134
+ getAll: (params?: {
135
+ locale?: string;
136
+ status?: string;
137
+ limit?: number;
138
+ offset?: number;
139
+ }) => Promise<SnappyList<Entry>>;
140
+ getOne: (id: string, locale?: string) => Promise<SnappyOne<Entry>>;
141
+ create: (data: any) => Promise<SnappyOne<Entry>>;
142
+ update: (id: string, data: any) => Promise<SnappyOne<Entry>>;
143
+ publish: (id: string, version: number) => Promise<SnappyOne<Entry>>;
144
+ delete: (id: string) => Promise<SnappyOne<any>>;
145
+ };
146
+ global: (slug: string) => {
147
+ get: (locale?: string) => Promise<SnappyOne<Global>>;
148
+ update: (data: any, locale?: string) => Promise<SnappyOne<Global>>;
149
+ };
150
+ };
151
+ profile: {
152
+ get: () => Promise<SnappyOne<any>>;
153
+ update: (data: any) => Promise<SnappyOne<any>>;
154
+ updateSocial: (data: {
155
+ id?: string;
156
+ platform: string;
157
+ url: string;
158
+ sort_order?: number;
159
+ }) => Promise<SnappyOne<any>>;
160
+ deleteSocial: (id: string) => Promise<SnappyOne<any>>;
161
+ updateSettings: (data: any) => Promise<SnappyOne<any>>;
162
+ };
163
+ collection(slug: string): {
164
+ getAll: (params?: {
165
+ locale?: string;
166
+ status?: string;
167
+ limit?: number;
168
+ offset?: number;
169
+ }) => Promise<SnappyList<Entry>>;
170
+ getOne: (id: string, locale?: string) => Promise<SnappyOne<Entry>>;
171
+ create: (data: any) => Promise<SnappyOne<Entry>>;
172
+ update: (id: string, data: any) => Promise<SnappyOne<Entry>>;
173
+ publish: (id: string, version: number) => Promise<SnappyOne<Entry>>;
174
+ delete: (id: string) => Promise<SnappyOne<any>>;
175
+ };
176
+ global(slug: string): {
177
+ get: (locale?: string) => Promise<SnappyOne<Global>>;
178
+ update: (data: any, locale?: string) => Promise<SnappyOne<Global>>;
179
+ };
180
+ media: {
181
+ stats: () => Promise<SnappyOne<{
182
+ used_bytes: number;
183
+ file_count: number;
184
+ }>>;
185
+ list: (params?: {
186
+ folder?: string;
187
+ limit?: number;
188
+ offset?: number;
189
+ }) => Promise<SnappyList<Media>>;
190
+ getOne: (id: string) => Promise<SnappyOne<Media>>;
191
+ process: (data: {
192
+ filename: string;
193
+ mime_type: string;
194
+ size: number;
195
+ folder?: string;
196
+ }) => Promise<SnappyOne<{
197
+ id: string;
198
+ uploadUrl: string;
199
+ filename: string;
200
+ }>>;
201
+ confirm: (id: string) => Promise<SnappyOne<Media>>;
202
+ renameFolder: (old_name: string, new_name: string) => Promise<SnappyOne<{
203
+ updated: number;
204
+ }>>;
205
+ delete: (id: string) => Promise<void>;
206
+ };
207
+ reviews: {
208
+ list: (status?: string) => Promise<SnappyList<Review>>;
209
+ getOne: (id: string) => Promise<SnappyOne<Review>>;
210
+ create: (data: {
211
+ entry_id?: string;
212
+ expires_in?: string;
213
+ }) => Promise<SnappyOne<Review>>;
214
+ submit: (id: string, data: {
215
+ author_name: string;
216
+ rating: number;
217
+ content: string;
218
+ }) => Promise<SnappyOne<{
219
+ message: string;
220
+ }>>;
221
+ delete: (id: string) => Promise<SnappyOne<{
222
+ message: string;
223
+ }>>;
224
+ };
225
+ releases: {
226
+ getAll: () => Promise<SnappyList<any>>;
227
+ create: (data: any) => Promise<SnappyOne<any>>;
228
+ publish: (id: string) => Promise<{
229
+ _latency: number;
230
+ }>;
231
+ };
232
+ heartbeat(): Promise<SnappyOne<Heartbeat>>;
233
+ search(query: string, locale?: string): Promise<SnappyList<any>>;
234
+ admin: {
235
+ getStats: () => Promise<{
236
+ _latency: number;
237
+ }>;
238
+ getCollections: () => Promise<{
239
+ _latency: number;
240
+ }>;
241
+ getProjects: () => Promise<SnappyList<Project>>;
242
+ getProject: (slug: string) => Promise<SnappyOne<Project>>;
243
+ updateProject: (slug: string, updates: any) => Promise<{
244
+ _latency: number;
245
+ }>;
246
+ updateStatus: (slug: string, status: string) => Promise<{
247
+ _latency: number;
248
+ }>;
249
+ updatePayment: (slug: string, status: string) => Promise<{
250
+ _latency: number;
251
+ }>;
252
+ rotateLicense: (slug: string) => Promise<{
253
+ _latency: number;
254
+ }>;
255
+ deleteProject: (slug: string) => Promise<{
256
+ _latency: number;
257
+ }>;
258
+ inviteUser: (email: string, permissions: string[], projectSlug: string) => Promise<{
259
+ _latency: number;
260
+ }>;
261
+ getMe: () => Promise<SnappyOne<User>>;
262
+ getProjectToken: (slug: string) => Promise<{
263
+ _latency: number;
264
+ }>;
265
+ getOrders: () => Promise<{
266
+ _latency: number;
267
+ }>;
268
+ getPPDBSubmissions: () => Promise<{
269
+ _latency: number;
270
+ }>;
271
+ getReviews: (status?: string) => Promise<{
272
+ _latency: number;
273
+ }>;
274
+ getProjectUsers: (slug: string) => Promise<{
275
+ _latency: number;
276
+ }>;
277
+ manageUser: (slug: string, userId: string, permissions: string[]) => Promise<{
278
+ _latency: number;
279
+ }>;
280
+ revokeUser: (slug: string, userId: string) => Promise<{
281
+ _latency: number;
282
+ }>;
283
+ };
284
+ /**
285
+ * Get the SNAPPY Score for the current project
286
+ */
287
+ getScore(): Promise<{
288
+ score: number;
289
+ warning?: string;
290
+ blocked: boolean;
291
+ }>;
292
+ }
293
+ declare class SnappyPublicClient {
294
+ private baseUrl;
295
+ constructor(config?: {
296
+ baseUrl?: string;
297
+ });
298
+ private fetch;
299
+ reviews: {
300
+ getOne: (id: string) => Promise<SnappyOne<ReviewStatus>>;
301
+ submit: (id: string, data: {
302
+ author_name: string;
303
+ rating: number;
304
+ content: string;
305
+ }) => Promise<SnappyOne<{
306
+ message: string;
307
+ }>>;
308
+ };
309
+ ppdb: {
310
+ submit: (data: any) => Promise<SnappyOne<{
311
+ message: string;
312
+ }>>;
313
+ };
314
+ orders: {
315
+ submit: (data: any) => Promise<SnappyOne<{
316
+ message: string;
317
+ }>>;
318
+ };
319
+ }
320
+ declare function createClient(config: SnappyConfig): SnappyClient;
321
+ declare function createPublicClient(config?: {
322
+ baseUrl?: string;
323
+ }): SnappyPublicClient;
324
+
325
+ export { type Entry as E, type Global as G, type Heartbeat as H, type Media as M, type Project as P, type Review as R, type SiteSettings as S, type User as U, type ReviewStatus as a, SnappyClient as b, type SnappyConfig as c, type SnappyList as d, type SnappyOne as e, type SnappyProfile as f, SnappyPublicClient as g, type Social as h, createClient as i, createPublicClient as j };