@noya-app/noya-api-client-react 0.1.35 → 0.1.37

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/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { NoyaAPI } from '@noya-app/noya-api';
2
2
  export * from '@noya-app/noya-api';
3
- import * as _noya_app_noya_sketch_file from '@noya-app/noya-sketch-file';
4
- import * as _noya_app_noya_component from '@noya-app/noya-component';
3
+ import { Static } from '@noya-app/noya-multiplayer-react';
4
+ import { Resource, ActivityEvent } from '@noya-app/noya-schemas';
5
+ import { SelectConfig, SelectedShape } from '@noya-app/observable';
6
+ import { Table, EntitySchema, TableFetchOptions, RefetchFunction } from '@noya-app/observable-store';
5
7
 
6
8
  type NoyaAPIContextValue = NoyaAPI.Client;
7
9
  declare const NoyaAPIProvider: React.Provider<NoyaAPIContextValue | undefined>;
@@ -13,109 +15,30 @@ declare function useOptionalNoyaClient(): NoyaAPIContextValue | undefined;
13
15
  */
14
16
  declare function useNoyaClientOrFallback(): NoyaAPIContextValue;
15
17
 
16
- declare function useNoyaFiles(): {
17
- files: NoyaAPI.File[];
18
- loading: boolean;
19
- reload: () => Promise<void>;
20
- };
21
- declare function useNoyaFile(fileId?: string): {
22
- data: {
23
- document: _noya_app_noya_component.DS;
24
- schemaVersion: "0.1.0";
25
- } | {
26
- document: _noya_app_noya_sketch_file.SketchFile;
27
- schemaVersion: "0.1.0";
28
- } | {
29
- schemaVersion: "0.1.0";
30
- document?: unknown;
31
- } | {
32
- schemaVersion: "0.1.0";
33
- document?: unknown;
34
- } | {
35
- schemaVersion: "0.1.0";
36
- document?: unknown;
37
- };
38
- icon: string | null;
39
- name: string | null;
40
- version: number;
41
- id: string;
42
- description: string | null;
43
- toolId: string;
44
- createdAt: string;
45
- updatedAt: string;
46
- access: "private" | "read" | "write";
47
- workspaceAccess: "private" | "read" | "write";
48
- workspaceId: string;
49
- inputs: ({
50
- required: boolean;
51
- name: string;
52
- id: string;
53
- description: string | null;
54
- kind: "file";
55
- toolId: string | null;
56
- stableId: string;
57
- } | {
58
- required: boolean;
59
- name: string;
60
- id: string;
61
- description: string | null;
62
- kind: "data";
63
- stableId: string;
64
- schema?: any;
65
- } | {
66
- required: boolean;
67
- name: string;
68
- id: string;
69
- description: string | null;
70
- kind: "secret";
71
- stableId: string;
72
- authProvider: "github" | "figma" | null;
73
- authScope: string | null;
74
- })[];
75
- user?: {
76
- name: string | null;
77
- image: string | null;
78
- } | undefined;
79
- tool?: {
80
- name: string;
81
- id: string;
82
- } | undefined;
83
- userId?: string | undefined;
84
- accessibleByFiles?: any[] | undefined;
85
- accessibleFiles?: any[] | undefined;
86
- primarySite?: {
87
- url: string;
88
- id: string;
89
- createdAt: string;
90
- updatedAt: string;
91
- subdomain: string | null;
92
- } | null | undefined;
93
- } | undefined;
94
- declare function useNoyaIsOwnFile(fileId?: string): boolean;
95
18
  declare function useNoyaTools(initial?: NoyaAPI.Tool[]): {
96
19
  tools: {
97
20
  addedById?: string | undefined;
21
+ id: string;
98
22
  name: string;
23
+ createdAt: string;
99
24
  url: string;
100
- id: string;
101
25
  description: string | null;
26
+ updatedAt: string;
102
27
  tags: {
103
28
  toolCount?: number | undefined;
104
- name: string;
105
29
  id: string;
30
+ name: string;
106
31
  rank: number;
107
32
  }[];
108
- createdAt: string;
109
- updatedAt: string;
33
+ assets: string[];
110
34
  slug: string | null;
111
35
  tagline: string | null;
112
- assets: string[];
113
36
  homepageUrl: string | null;
114
37
  platform: "noya" | "external";
115
38
  verificationStatus: "pending" | "approved" | "rejected";
116
39
  creator: {
117
- name: string;
118
40
  id: string;
41
+ name: string;
119
42
  image: string | null;
120
43
  slug: string | null;
121
44
  } | null;
@@ -125,27 +48,27 @@ declare function useNoyaTools(initial?: NoyaAPI.Tool[]): {
125
48
  declare function useOptionalNoyaTools(initial?: NoyaAPI.Tool[]): {
126
49
  tools: {
127
50
  addedById?: string | undefined;
51
+ id: string;
128
52
  name: string;
53
+ createdAt: string;
129
54
  url: string;
130
- id: string;
131
55
  description: string | null;
56
+ updatedAt: string;
132
57
  tags: {
133
58
  toolCount?: number | undefined;
134
- name: string;
135
59
  id: string;
60
+ name: string;
136
61
  rank: number;
137
62
  }[];
138
- createdAt: string;
139
- updatedAt: string;
63
+ assets: string[];
140
64
  slug: string | null;
141
65
  tagline: string | null;
142
- assets: string[];
143
66
  homepageUrl: string | null;
144
67
  platform: "noya" | "external";
145
68
  verificationStatus: "pending" | "approved" | "rejected";
146
69
  creator: {
147
- name: string;
148
70
  id: string;
71
+ name: string;
149
72
  image: string | null;
150
73
  slug: string | null;
151
74
  } | null;
@@ -155,8 +78,8 @@ declare function useOptionalNoyaTools(initial?: NoyaAPI.Tool[]): {
155
78
  declare function useNoyaTags(): {
156
79
  tags: {
157
80
  toolCount?: number | undefined;
158
- name: string;
159
81
  id: string;
82
+ name: string;
160
83
  rank: number;
161
84
  }[];
162
85
  loading: boolean;
@@ -164,16 +87,16 @@ declare function useNoyaTags(): {
164
87
  declare function useOptionalNoyaTags(): {
165
88
  tags: {
166
89
  toolCount?: number | undefined;
167
- name: string;
168
90
  id: string;
91
+ name: string;
169
92
  rank: number;
170
93
  }[];
171
94
  loading: boolean;
172
95
  };
173
96
  declare function useNoyaCreators(): {
174
97
  creators: {
175
- name: string;
176
98
  id: string;
99
+ name: string;
177
100
  image: string | null;
178
101
  slug: string | null;
179
102
  }[];
@@ -181,8 +104,8 @@ declare function useNoyaCreators(): {
181
104
  };
182
105
  declare function useOptionalNoyaCreators(): {
183
106
  creators: {
184
- name: string;
185
107
  id: string;
108
+ name: string;
186
109
  image: string | null;
187
110
  slug: string | null;
188
111
  }[];
@@ -190,8 +113,25 @@ declare function useOptionalNoyaCreators(): {
190
113
  };
191
114
  declare function useNoyaAssets(fileId?: string): {
192
115
  assets: {
116
+ width: number | null;
117
+ height: number | null;
193
118
  id: string;
194
119
  createdAt: string;
120
+ userId: string | null;
121
+ url?: string | undefined;
122
+ size?: number | undefined;
123
+ contentType?: string | undefined;
124
+ }[];
125
+ loading: boolean;
126
+ };
127
+ declare function useNoyaAssetsByFileVersionId(fileVersionId: string): {
128
+ assets: {
129
+ width: number | null;
130
+ height: number | null;
131
+ id: string;
132
+ createdAt: string;
133
+ userId: string | null;
134
+ url?: string | undefined;
195
135
  size?: number | undefined;
196
136
  contentType?: string | undefined;
197
137
  }[];
@@ -199,40 +139,41 @@ declare function useNoyaAssets(fileId?: string): {
199
139
  };
200
140
  declare function useNoyaSecrets(fileId?: string): {
201
141
  secrets: {
202
- name: string;
203
142
  id: string;
204
- stableId: string;
143
+ name: string;
205
144
  fileId: string;
145
+ stableId: string;
206
146
  }[];
207
147
  loading: boolean;
208
148
  };
209
149
  declare function useNoyaSession(): {
210
150
  user: {
211
- name: string | null;
212
151
  id: string;
213
- image: string | null;
152
+ name: string | null;
214
153
  email: string | null;
154
+ image: string | null;
215
155
  };
216
156
  expires: string;
217
157
  } | null;
218
158
  declare function useOptionalNoyaSession(): {
219
159
  user: {
220
- name: string | null;
221
160
  id: string;
222
- image: string | null;
161
+ name: string | null;
223
162
  email: string | null;
163
+ image: string | null;
224
164
  };
225
165
  expires: string;
226
166
  } | null | undefined;
227
167
  declare function useNoyaBilling(): {
228
168
  subscriptions: {
169
+ id: string;
229
170
  items: {
230
171
  id: string;
231
172
  created: string;
232
173
  price: {
233
174
  type: string;
234
- active: boolean;
235
175
  id: string;
176
+ active: boolean;
236
177
  currency: string;
237
178
  nickname: string | null;
238
179
  recurringInterval: string;
@@ -243,7 +184,6 @@ declare function useNoyaBilling(): {
243
184
  };
244
185
  quantity: number;
245
186
  }[];
246
- id: string;
247
187
  status: string;
248
188
  currency: string;
249
189
  created: string;
@@ -258,15 +198,15 @@ declare function useNoyaBilling(): {
258
198
  }[];
259
199
  portalUrl: string | null;
260
200
  availableProducts: {
261
- active: boolean;
262
- name: string;
263
201
  id: string;
202
+ name: string;
264
203
  description: string | null;
204
+ active: boolean;
265
205
  created: string;
266
206
  prices: {
267
207
  type: string;
268
- active: boolean;
269
208
  id: string;
209
+ active: boolean;
270
210
  currency: string;
271
211
  nickname: string | null;
272
212
  recurringInterval: string;
@@ -287,9 +227,9 @@ declare function useNoyaWorkspaceBilling(workspaceId: string): {
287
227
  };
288
228
  declare function useNoyaEmailLists(): {
289
229
  emailLists: {
230
+ id: string;
290
231
  name: string;
291
232
  url: string;
292
- id: string;
293
233
  description: string | null;
294
234
  optIn: boolean;
295
235
  }[];
@@ -303,9 +243,9 @@ declare function useNoyaUserData(): {
303
243
  value?: unknown;
304
244
  }[];
305
245
  emailLists: {
246
+ id: string;
306
247
  name: string;
307
248
  url: string;
308
- id: string;
309
249
  description: string | null;
310
250
  optIn: boolean;
311
251
  }[];
@@ -322,9 +262,9 @@ declare function useOptionalNoyaUserData(): {
322
262
  value?: unknown;
323
263
  }[];
324
264
  emailLists: {
265
+ id: string;
325
266
  name: string;
326
267
  url: string;
327
- id: string;
328
268
  description: string | null;
329
269
  optIn: boolean;
330
270
  }[];
@@ -351,14 +291,14 @@ declare function useGeneratedComponentDescription(name: string): {
351
291
  };
352
292
  declare function useRandomImages(): {
353
293
  images: Record<string, {
294
+ metadata: {
295
+ color: string;
296
+ };
354
297
  url: string;
355
298
  source: {
356
299
  name: string;
357
300
  url: string;
358
301
  };
359
- metadata: {
360
- color: string;
361
- };
362
302
  user: {
363
303
  name: string;
364
304
  url: string;
@@ -393,16 +333,24 @@ declare function useGeneratedPageNames(): EnhancedGeneratedPageName[];
393
333
  declare function useGeneratedPageComponentNames(): EnhancedGeneratedPageName[];
394
334
  declare function useNoyaSites(): {
395
335
  sites: {
396
- url?: string | null | undefined;
336
+ publishedDeploymentId?: string | null | undefined;
337
+ publishedDeployment?: {
338
+ id: string;
339
+ createdAt: string;
340
+ fileVersionId: string | null;
341
+ siteId: string;
342
+ updatedAt: string;
343
+ } | undefined;
397
344
  id: string;
345
+ subdomain: string | null;
398
346
  createdAt: string;
399
347
  updatedAt: string;
400
- subdomain: string | null;
401
348
  deployments: {
402
349
  id: string;
403
350
  createdAt: string;
404
- updatedAt: string;
351
+ fileVersionId: string | null;
405
352
  siteId: string;
353
+ updatedAt: string;
406
354
  }[];
407
355
  }[];
408
356
  loading: boolean;
@@ -411,23 +359,32 @@ declare function useNoyaDeployments(): {
411
359
  deployments: {
412
360
  id: string;
413
361
  createdAt: string;
414
- updatedAt: string;
362
+ fileVersionId: string | null;
415
363
  siteId: string;
364
+ updatedAt: string;
416
365
  }[];
417
366
  loading: boolean;
418
367
  };
419
368
  declare function useNoyaSite(siteId: string): {
420
369
  site: {
421
- url?: string | null | undefined;
370
+ publishedDeploymentId?: string | null | undefined;
371
+ publishedDeployment?: {
372
+ id: string;
373
+ createdAt: string;
374
+ fileVersionId: string | null;
375
+ siteId: string;
376
+ updatedAt: string;
377
+ } | undefined;
422
378
  id: string;
379
+ subdomain: string | null;
423
380
  createdAt: string;
424
381
  updatedAt: string;
425
- subdomain: string | null;
426
382
  deployments: {
427
383
  id: string;
428
384
  createdAt: string;
429
- updatedAt: string;
385
+ fileVersionId: string | null;
430
386
  siteId: string;
387
+ updatedAt: string;
431
388
  }[];
432
389
  };
433
390
  };
@@ -435,8 +392,8 @@ declare function useNoyaPersonalAccessTokens(): {
435
392
  personalAccessTokens: {
436
393
  token?: string | undefined;
437
394
  rawToken?: string | undefined;
438
- name: string;
439
395
  id: string;
396
+ name: string;
440
397
  createdAt: string;
441
398
  lastUsedAt: string | null;
442
399
  }[];
@@ -444,36 +401,39 @@ declare function useNoyaPersonalAccessTokens(): {
444
401
  };
445
402
  declare function useNoyaWorkspaces(): {
446
403
  workspaces: {
447
- name: string;
448
404
  id: string;
405
+ name: string;
449
406
  createdAt: string;
450
407
  updatedAt: string;
451
408
  members: {
452
409
  id: string;
410
+ createdAt: string;
411
+ workspaceId: string;
412
+ userId: string;
413
+ updatedAt: string;
453
414
  role: "OWNER" | "ADMIN" | "MEMBER";
454
415
  user: {
455
- name: string | null;
456
416
  id: string;
457
- image: string | null;
417
+ name: string | null;
458
418
  email: string | null;
419
+ image: string | null;
459
420
  };
460
- createdAt: string;
461
- userId: string;
462
- updatedAt: string;
463
- workspaceId: string;
464
421
  }[];
465
422
  }[];
466
423
  loading: boolean;
467
424
  };
425
+ declare function useNoyaMultiplayerRoomToken(fileId: string): {
426
+ access: "read" | "write";
427
+ } | undefined;
468
428
  declare function useNoyaWorkspaceInvitations(workspaceId: string): {
469
429
  invitations: {
470
430
  id: string;
471
- role: "OWNER" | "ADMIN" | "MEMBER";
472
431
  email: string;
473
- token: string;
474
432
  createdAt: string;
475
- updatedAt: string;
476
433
  workspaceId: string;
434
+ updatedAt: string;
435
+ role: "OWNER" | "ADMIN" | "MEMBER";
436
+ token: string;
477
437
  invitedById: string;
478
438
  acceptedAt: string | null;
479
439
  expiresAt: string | null;
@@ -482,48 +442,87 @@ declare function useNoyaWorkspaceInvitations(workspaceId: string): {
482
442
  };
483
443
  declare function useNoyaOwnedFileVersions(fileId: string): {
484
444
  fileVersions: NoyaAPI.FileVersion[];
485
- loading: NoyaAPI.DataLoadingState;
445
+ loading: NoyaAPI.FetchStatus;
486
446
  reload: () => Promise<void>;
487
447
  };
488
448
  declare function useNoyaTemplates(): {
489
449
  templates: {
490
- name: string;
491
450
  id: string;
492
- description: string | null;
493
- status: "pending" | "approved" | "rejected";
494
- createdAt: string;
495
- updatedAt: string;
496
- workspaceId: string;
497
- fileId: string | null;
498
- fileVersionId: string;
499
- createdByUserId: string;
451
+ name: string;
500
452
  fileVersion: {
501
453
  data?: any;
502
- icon: string | null;
503
- name: string;
504
- version: number;
505
454
  id: string;
506
- description: string | null;
507
- toolId: string;
455
+ name: string;
508
456
  createdAt: string;
457
+ fileId: string | null;
509
458
  userId: string;
459
+ toolId: string;
460
+ description: string | null;
510
461
  updatedAt: string;
462
+ icon: string | null;
463
+ version: number;
511
464
  access: "private" | "read" | "write";
512
- fileId: string | null;
513
465
  dataCid: string;
514
466
  ownedByFileId: string | null;
515
467
  };
468
+ createdAt: string;
469
+ workspaceId: string;
516
470
  workspace: {
517
- name: string;
518
471
  id: string;
472
+ name: string;
519
473
  };
474
+ fileId: string | null;
475
+ fileVersionId: string;
476
+ description: string | null;
477
+ updatedAt: string;
478
+ status: "pending" | "approved" | "rejected";
479
+ createdByUserId: string;
520
480
  createdByUser: {
521
- name: string | null;
522
481
  id: string;
482
+ name: string | null;
523
483
  image: string | null;
524
484
  };
525
485
  }[];
526
486
  loading: boolean;
527
487
  };
528
488
 
529
- export { type EnhancedGeneratedPageName, NoyaAPIProvider, useGeneratedComponentDescription, useGeneratedComponentDescriptions, useGeneratedComponentNames, useGeneratedPageComponentNames, useGeneratedPageNames, useIsBeta, useMetadata, useNetworkRequests, useNoyaAssets, useNoyaBilling, useNoyaClient, useNoyaClientOrFallback, useNoyaCreators, useNoyaDeployments, useNoyaEmailLists, useNoyaFile, useNoyaFiles, useNoyaIsOwnFile, useNoyaOwnedFileVersions, useNoyaPersonalAccessTokens, useNoyaSecrets, useNoyaSession, useNoyaSite, useNoyaSites, useNoyaTags, useNoyaTemplates, useNoyaTools, useNoyaUserData, useNoyaWorkspaceBilling, useNoyaWorkspaceInvitations, useNoyaWorkspaces, useOptionalNoyaClient, useOptionalNoyaCreators, useOptionalNoyaSession, useOptionalNoyaTags, useOptionalNoyaTools, useOptionalNoyaUserData, useRandomIcons, useRandomImages };
489
+ type GetRowType<TTable extends Table<EntitySchema>> = Static<TTable["schema"]>;
490
+ type GetSelectConfig<TTable extends Table<EntitySchema>> = SelectConfig<GetRowType<TTable>[]>;
491
+ type UseTableOptions = Omit<TableFetchOptions, "autoStart">;
492
+ declare function useTable<TTable extends Table<any>, Config extends GetSelectConfig<TTable>>(table: TTable | null | undefined, { where, select, }: {
493
+ where?: Partial<Record<string, any>> & {
494
+ id?: string | null;
495
+ };
496
+ select: Config;
497
+ }, options?: UseTableOptions): {
498
+ status: NoyaAPI.FetchStatus;
499
+ data: SelectedShape<GetRowType<TTable>, Config>[];
500
+ refetch: () => void;
501
+ };
502
+ declare function useFileList<Config extends SelectConfig<NoyaAPI.FileListItem>>(select: Config, options?: UseTableOptions): {
503
+ status: NoyaAPI.FetchStatus;
504
+ data: SelectedShape<NoyaAPI.FileListItem, Config>[];
505
+ refetch: RefetchFunction;
506
+ };
507
+ declare function useFileListItem<Config extends SelectConfig<NoyaAPI.FileListItem>>(id: string | undefined, select: Config, options?: UseTableOptions): {
508
+ status: NoyaAPI.FetchStatus;
509
+ data: SelectedShape<NoyaAPI.FileListItem, Config> | undefined;
510
+ refetch: RefetchFunction;
511
+ };
512
+ declare function useResourcesList<Config extends SelectConfig<Resource>>(fileId: string, select: Config, options?: UseTableOptions): {
513
+ status: NoyaAPI.FetchStatus;
514
+ data: SelectedShape<Resource, Config>[];
515
+ refetch: RefetchFunction;
516
+ };
517
+ declare function useUser<Config extends SelectConfig<NoyaAPI.PublicUser>>(id: string | null | undefined, select: Config, options?: UseTableOptions): {
518
+ status: NoyaAPI.FetchStatus;
519
+ data: SelectedShape<NoyaAPI.PublicUser, Config> | undefined;
520
+ refetch: RefetchFunction;
521
+ };
522
+ declare function useActivityEventsList<Config extends SelectConfig<ActivityEvent>>(fileId: string, select: Config, options?: UseTableOptions): {
523
+ status: NoyaAPI.FetchStatus;
524
+ data: SelectedShape<ActivityEvent, Config>[];
525
+ refetch: RefetchFunction;
526
+ };
527
+
528
+ export { type EnhancedGeneratedPageName, NoyaAPIProvider, useActivityEventsList, useFileList, useFileListItem, useGeneratedComponentDescription, useGeneratedComponentDescriptions, useGeneratedComponentNames, useGeneratedPageComponentNames, useGeneratedPageNames, useIsBeta, useMetadata, useNetworkRequests, useNoyaAssets, useNoyaAssetsByFileVersionId, useNoyaBilling, useNoyaClient, useNoyaClientOrFallback, useNoyaCreators, useNoyaDeployments, useNoyaEmailLists, useNoyaMultiplayerRoomToken, useNoyaOwnedFileVersions, useNoyaPersonalAccessTokens, useNoyaSecrets, useNoyaSession, useNoyaSite, useNoyaSites, useNoyaTags, useNoyaTemplates, useNoyaTools, useNoyaUserData, useNoyaWorkspaceBilling, useNoyaWorkspaceInvitations, useNoyaWorkspaces, useOptionalNoyaClient, useOptionalNoyaCreators, useOptionalNoyaSession, useOptionalNoyaTags, useOptionalNoyaTools, useOptionalNoyaUserData, useRandomIcons, useRandomImages, useResourcesList, useTable, useUser };