@artemis-apps/app-react 0.0.0-stage → 0.1.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.
- package/dist/app-account-menu.d.ts +2 -0
- package/dist/app-account-menu.js +12 -0
- package/dist/app-launcher.d.ts +5 -0
- package/dist/app-launcher.js +20 -0
- package/dist/app-session.api.d.ts +85 -0
- package/dist/app-session.api.js +8 -0
- package/dist/directory.api.d.ts +32 -0
- package/dist/directory.api.js +14 -0
- package/dist/entities/entities.api.d.ts +603 -0
- package/dist/entities/entities.api.js +147 -0
- package/dist/entities/entity-share-dialog.d.ts +24 -0
- package/dist/entities/entity-share-dialog.js +101 -0
- package/dist/entities/use-entities.d.ts +140 -0
- package/dist/entities/use-entities.js +92 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/launcher.api.d.ts +10 -0
- package/dist/launcher.api.js +7 -0
- package/dist/platform-provider.d.ts +10 -0
- package/dist/platform-provider.js +56 -0
- package/dist/session-redirect.d.ts +9 -0
- package/dist/session-redirect.js +18 -0
- package/dist/unenrolled-page.d.ts +14 -0
- package/dist/unenrolled-page.js +19 -0
- package/dist/use-app-session.d.ts +31 -0
- package/dist/use-app-session.js +12 -0
- package/dist/use-directory-accounts.d.ts +6 -0
- package/dist/use-directory-accounts.js +20 -0
- package/dist/use-directory-search.d.ts +17 -0
- package/dist/use-directory-search.js +19 -0
- package/dist/use-launcher.d.ts +13 -0
- package/dist/use-launcher.js +23 -0
- package/dist/use-sign-out.d.ts +4 -0
- package/dist/use-sign-out.js +10 -0
- package/package.json +52 -3
- package/README.md +0 -3
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { type EntityHandler, type EntityPointer, type EntityRef, type ProviderFilter, type ShareInput } from '@artemis-apps/contracts';
|
|
2
|
+
import { type HttpMethod } from '@artemis-apps/web-kit';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
/**
|
|
5
|
+
* A core API path, as the web client reaches it through its server's relay: a path on the page's
|
|
6
|
+
* origin (under the app's base path), fit for `fetch` as for an `<img src>`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function relayed(corePath: string): string;
|
|
9
|
+
/** An entity as an operation names it: its reference, and the share it is reached through. */
|
|
10
|
+
export interface EntityTarget extends EntityRef {
|
|
11
|
+
via: EntityPointer | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function fetchEntityTypes(signal?: AbortSignal): Promise<{
|
|
14
|
+
types: {
|
|
15
|
+
id: string;
|
|
16
|
+
version: number;
|
|
17
|
+
parent: string | null;
|
|
18
|
+
titleFields: string[];
|
|
19
|
+
schema: Record<string, z.JSONType>;
|
|
20
|
+
permissions: Record<string, string | null>;
|
|
21
|
+
operations: Record<string, string>;
|
|
22
|
+
kinds: string[];
|
|
23
|
+
actions: Record<string, {
|
|
24
|
+
permission: string;
|
|
25
|
+
target: "page" | "server";
|
|
26
|
+
}>;
|
|
27
|
+
messages: Partial<Record<"en" | "fr", {
|
|
28
|
+
name: string;
|
|
29
|
+
plural: string;
|
|
30
|
+
permissions: Record<string, {
|
|
31
|
+
label: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}>;
|
|
34
|
+
operations: Record<string, string>;
|
|
35
|
+
kinds: Record<string, string>;
|
|
36
|
+
actions: Record<string, string>;
|
|
37
|
+
}>>;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
/** The apps handling actions on entities of the type (opening, previewing them...), by kind. */
|
|
41
|
+
export declare function fetchEntityHandlers(type: string, signal?: AbortSignal): Promise<{
|
|
42
|
+
handlers: {
|
|
43
|
+
appId: string;
|
|
44
|
+
appName: string;
|
|
45
|
+
action: string;
|
|
46
|
+
kind: string;
|
|
47
|
+
iconUrl: string;
|
|
48
|
+
url: string;
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
/** The kinds of entities of the type the apps support: their icons, and whether they have a template. */
|
|
52
|
+
export declare function fetchEntityKinds(type: string, signal?: AbortSignal): Promise<{
|
|
53
|
+
kinds: {
|
|
54
|
+
appId: string;
|
|
55
|
+
appName: string;
|
|
56
|
+
kind: string;
|
|
57
|
+
iconUrl: string;
|
|
58
|
+
hasTemplate: boolean;
|
|
59
|
+
}[];
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* The file name a `Content-Disposition` header gives (`filename*`, RFC 5987, before `filename`);
|
|
63
|
+
* `undefined` without one.
|
|
64
|
+
*/
|
|
65
|
+
export declare function contentDispositionFileName(header: string | null): string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* The blank template an app offers for new entities of a kind (`hasTemplate`), in the language
|
|
68
|
+
* spoken when the app has one per language: a file, named as the app names it (its extension
|
|
69
|
+
* is the one new entities take).
|
|
70
|
+
*/
|
|
71
|
+
export declare function fetchKindTemplate(type: string, appId: string, kind: string, locale: string, signal?: AbortSignal): Promise<File>;
|
|
72
|
+
/** Where a `page` action runs on an entity: the handling app's page, the entity in its query. */
|
|
73
|
+
export declare function handleUrl(handler: Pick<EntityHandler, 'url' | 'kind'>, target: Omit<EntityTarget, 'type'>): string;
|
|
74
|
+
export interface EntityListOptions {
|
|
75
|
+
filter?: ProviderFilter;
|
|
76
|
+
/** Passed on to the providers (a range of dates, a search). */
|
|
77
|
+
params?: Record<string, string>;
|
|
78
|
+
}
|
|
79
|
+
/** Every entity of a type the account reaches, from every provider. */
|
|
80
|
+
export declare function listEntities<Data extends z.ZodType>(type: string, data: Data, { filter, params }?: EntityListOptions, signal?: AbortSignal): Promise<{
|
|
81
|
+
providers: {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
url: string;
|
|
85
|
+
iconUrl: string;
|
|
86
|
+
operations: string[];
|
|
87
|
+
available: boolean;
|
|
88
|
+
consented: boolean;
|
|
89
|
+
}[];
|
|
90
|
+
entities: (({
|
|
91
|
+
type: z.ZodString;
|
|
92
|
+
providerId: z.ZodString;
|
|
93
|
+
ownerId: z.ZodString;
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
96
|
+
type: z.ZodString;
|
|
97
|
+
id: z.ZodString;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
100
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
101
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
102
|
+
data: Data;
|
|
103
|
+
access: z.ZodObject<{
|
|
104
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
105
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
106
|
+
type: z.ZodString;
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
} extends infer T_1 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_1 as {
|
|
111
|
+
type: z.ZodString;
|
|
112
|
+
providerId: z.ZodString;
|
|
113
|
+
ownerId: z.ZodString;
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
116
|
+
type: z.ZodString;
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
120
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
121
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
122
|
+
data: Data;
|
|
123
|
+
access: z.ZodObject<{
|
|
124
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
125
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
126
|
+
type: z.ZodString;
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
}[k] extends {
|
|
131
|
+
_zod: {
|
|
132
|
+
optout: "optional";
|
|
133
|
+
};
|
|
134
|
+
} ? never : k]: T_1[k]["_zod"]["output"]; } : never) & ({
|
|
135
|
+
type: z.ZodString;
|
|
136
|
+
providerId: z.ZodString;
|
|
137
|
+
ownerId: z.ZodString;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
140
|
+
type: z.ZodString;
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
144
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
145
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
146
|
+
data: Data;
|
|
147
|
+
access: z.ZodObject<{
|
|
148
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
149
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
150
|
+
type: z.ZodString;
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
} extends infer T_2 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_2 as {
|
|
155
|
+
type: z.ZodString;
|
|
156
|
+
providerId: z.ZodString;
|
|
157
|
+
ownerId: z.ZodString;
|
|
158
|
+
id: z.ZodString;
|
|
159
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
160
|
+
type: z.ZodString;
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
}, z.core.$strip>>;
|
|
163
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
164
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
165
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
166
|
+
data: Data;
|
|
167
|
+
access: z.ZodObject<{
|
|
168
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
169
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
170
|
+
type: z.ZodString;
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
}, z.core.$strip>;
|
|
174
|
+
}[k] extends {
|
|
175
|
+
_zod: {
|
|
176
|
+
optout: "optional";
|
|
177
|
+
};
|
|
178
|
+
} ? k : never]?: T_2[k]["_zod"]["output"] | undefined; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never)[];
|
|
179
|
+
}>;
|
|
180
|
+
export declare function readEntity<Data extends z.ZodType>(target: EntityTarget, data: Data, signal?: AbortSignal): Promise<{
|
|
181
|
+
provider: {
|
|
182
|
+
id: string;
|
|
183
|
+
name: string;
|
|
184
|
+
url: string;
|
|
185
|
+
iconUrl: string;
|
|
186
|
+
operations: string[];
|
|
187
|
+
available: boolean;
|
|
188
|
+
consented: boolean;
|
|
189
|
+
};
|
|
190
|
+
entity: ({
|
|
191
|
+
type: z.ZodString;
|
|
192
|
+
providerId: z.ZodString;
|
|
193
|
+
ownerId: z.ZodString;
|
|
194
|
+
id: z.ZodString;
|
|
195
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
196
|
+
type: z.ZodString;
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
}, z.core.$strip>>;
|
|
199
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
200
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
201
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
202
|
+
data: Data;
|
|
203
|
+
access: z.ZodObject<{
|
|
204
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
205
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
206
|
+
type: z.ZodString;
|
|
207
|
+
id: z.ZodString;
|
|
208
|
+
}, z.core.$strip>>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
} extends infer T_1 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_1 as {
|
|
211
|
+
type: z.ZodString;
|
|
212
|
+
providerId: z.ZodString;
|
|
213
|
+
ownerId: z.ZodString;
|
|
214
|
+
id: z.ZodString;
|
|
215
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
216
|
+
type: z.ZodString;
|
|
217
|
+
id: z.ZodString;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
220
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
221
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
222
|
+
data: Data;
|
|
223
|
+
access: z.ZodObject<{
|
|
224
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
225
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
226
|
+
type: z.ZodString;
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
}, z.core.$strip>;
|
|
230
|
+
}[k] extends {
|
|
231
|
+
_zod: {
|
|
232
|
+
optout: "optional";
|
|
233
|
+
};
|
|
234
|
+
} ? never : k]: T_1[k]["_zod"]["output"]; } : never) & ({
|
|
235
|
+
type: z.ZodString;
|
|
236
|
+
providerId: z.ZodString;
|
|
237
|
+
ownerId: z.ZodString;
|
|
238
|
+
id: z.ZodString;
|
|
239
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
240
|
+
type: z.ZodString;
|
|
241
|
+
id: z.ZodString;
|
|
242
|
+
}, z.core.$strip>>;
|
|
243
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
244
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
245
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
246
|
+
data: Data;
|
|
247
|
+
access: z.ZodObject<{
|
|
248
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
249
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
250
|
+
type: z.ZodString;
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
}, z.core.$strip>>;
|
|
253
|
+
}, z.core.$strip>;
|
|
254
|
+
} extends infer T_2 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_2 as {
|
|
255
|
+
type: z.ZodString;
|
|
256
|
+
providerId: z.ZodString;
|
|
257
|
+
ownerId: z.ZodString;
|
|
258
|
+
id: z.ZodString;
|
|
259
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
260
|
+
type: z.ZodString;
|
|
261
|
+
id: z.ZodString;
|
|
262
|
+
}, z.core.$strip>>;
|
|
263
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
264
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
265
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
266
|
+
data: Data;
|
|
267
|
+
access: z.ZodObject<{
|
|
268
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
269
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
270
|
+
type: z.ZodString;
|
|
271
|
+
id: z.ZodString;
|
|
272
|
+
}, z.core.$strip>>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
}[k] extends {
|
|
275
|
+
_zod: {
|
|
276
|
+
optout: "optional";
|
|
277
|
+
};
|
|
278
|
+
} ? k : never]?: T_2[k]["_zod"]["output"] | undefined; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never;
|
|
279
|
+
}>;
|
|
280
|
+
export interface EntityCreation {
|
|
281
|
+
type: string;
|
|
282
|
+
providerId: string;
|
|
283
|
+
/** The parent it goes in (its owner owns the new entity), and the share reaching it. */
|
|
284
|
+
parent?: {
|
|
285
|
+
ownerId: string;
|
|
286
|
+
id: string;
|
|
287
|
+
via: EntityPointer | null;
|
|
288
|
+
};
|
|
289
|
+
/** The type's input: JSON, or a `FormData` (a file with its fields). */
|
|
290
|
+
body: unknown;
|
|
291
|
+
}
|
|
292
|
+
export declare function createEntity<Data extends z.ZodType>({ type, providerId, parent, body }: EntityCreation, data: Data): Promise<{
|
|
293
|
+
provider: {
|
|
294
|
+
id: string;
|
|
295
|
+
name: string;
|
|
296
|
+
url: string;
|
|
297
|
+
iconUrl: string;
|
|
298
|
+
operations: string[];
|
|
299
|
+
available: boolean;
|
|
300
|
+
consented: boolean;
|
|
301
|
+
};
|
|
302
|
+
entity: ({
|
|
303
|
+
type: z.ZodString;
|
|
304
|
+
providerId: z.ZodString;
|
|
305
|
+
ownerId: z.ZodString;
|
|
306
|
+
id: z.ZodString;
|
|
307
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
308
|
+
type: z.ZodString;
|
|
309
|
+
id: z.ZodString;
|
|
310
|
+
}, z.core.$strip>>;
|
|
311
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
312
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
313
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
314
|
+
data: Data;
|
|
315
|
+
access: z.ZodObject<{
|
|
316
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
317
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
318
|
+
type: z.ZodString;
|
|
319
|
+
id: z.ZodString;
|
|
320
|
+
}, z.core.$strip>>;
|
|
321
|
+
}, z.core.$strip>;
|
|
322
|
+
} extends infer T_1 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_1 as {
|
|
323
|
+
type: z.ZodString;
|
|
324
|
+
providerId: z.ZodString;
|
|
325
|
+
ownerId: z.ZodString;
|
|
326
|
+
id: z.ZodString;
|
|
327
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
328
|
+
type: z.ZodString;
|
|
329
|
+
id: z.ZodString;
|
|
330
|
+
}, z.core.$strip>>;
|
|
331
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
332
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
333
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
334
|
+
data: Data;
|
|
335
|
+
access: z.ZodObject<{
|
|
336
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
337
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
338
|
+
type: z.ZodString;
|
|
339
|
+
id: z.ZodString;
|
|
340
|
+
}, z.core.$strip>>;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
}[k] extends {
|
|
343
|
+
_zod: {
|
|
344
|
+
optout: "optional";
|
|
345
|
+
};
|
|
346
|
+
} ? never : k]: T_1[k]["_zod"]["output"]; } : never) & ({
|
|
347
|
+
type: z.ZodString;
|
|
348
|
+
providerId: z.ZodString;
|
|
349
|
+
ownerId: z.ZodString;
|
|
350
|
+
id: z.ZodString;
|
|
351
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
352
|
+
type: z.ZodString;
|
|
353
|
+
id: z.ZodString;
|
|
354
|
+
}, z.core.$strip>>;
|
|
355
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
356
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
357
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
358
|
+
data: Data;
|
|
359
|
+
access: z.ZodObject<{
|
|
360
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
361
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
362
|
+
type: z.ZodString;
|
|
363
|
+
id: z.ZodString;
|
|
364
|
+
}, z.core.$strip>>;
|
|
365
|
+
}, z.core.$strip>;
|
|
366
|
+
} extends infer T_2 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_2 as {
|
|
367
|
+
type: z.ZodString;
|
|
368
|
+
providerId: z.ZodString;
|
|
369
|
+
ownerId: z.ZodString;
|
|
370
|
+
id: z.ZodString;
|
|
371
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
372
|
+
type: z.ZodString;
|
|
373
|
+
id: z.ZodString;
|
|
374
|
+
}, z.core.$strip>>;
|
|
375
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
376
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
377
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
378
|
+
data: Data;
|
|
379
|
+
access: z.ZodObject<{
|
|
380
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
381
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
382
|
+
type: z.ZodString;
|
|
383
|
+
id: z.ZodString;
|
|
384
|
+
}, z.core.$strip>>;
|
|
385
|
+
}, z.core.$strip>;
|
|
386
|
+
}[k] extends {
|
|
387
|
+
_zod: {
|
|
388
|
+
optout: "optional";
|
|
389
|
+
};
|
|
390
|
+
} ? k : never]?: T_2[k]["_zod"]["output"] | undefined; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never;
|
|
391
|
+
}>;
|
|
392
|
+
export interface EntityUpdate {
|
|
393
|
+
/** The type's input; nothing for a move alone. */
|
|
394
|
+
body?: unknown;
|
|
395
|
+
/** Another parent of the same owner it moves to. */
|
|
396
|
+
parentId?: string;
|
|
397
|
+
}
|
|
398
|
+
export declare function updateEntity<Data extends z.ZodType>(target: EntityTarget, { body, parentId }: EntityUpdate, data: Data): Promise<{
|
|
399
|
+
provider: {
|
|
400
|
+
id: string;
|
|
401
|
+
name: string;
|
|
402
|
+
url: string;
|
|
403
|
+
iconUrl: string;
|
|
404
|
+
operations: string[];
|
|
405
|
+
available: boolean;
|
|
406
|
+
consented: boolean;
|
|
407
|
+
};
|
|
408
|
+
entity: ({
|
|
409
|
+
type: z.ZodString;
|
|
410
|
+
providerId: z.ZodString;
|
|
411
|
+
ownerId: z.ZodString;
|
|
412
|
+
id: z.ZodString;
|
|
413
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
414
|
+
type: z.ZodString;
|
|
415
|
+
id: z.ZodString;
|
|
416
|
+
}, z.core.$strip>>;
|
|
417
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
418
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
419
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
420
|
+
data: Data;
|
|
421
|
+
access: z.ZodObject<{
|
|
422
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
423
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
424
|
+
type: z.ZodString;
|
|
425
|
+
id: z.ZodString;
|
|
426
|
+
}, z.core.$strip>>;
|
|
427
|
+
}, z.core.$strip>;
|
|
428
|
+
} extends infer T_1 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_1 as {
|
|
429
|
+
type: z.ZodString;
|
|
430
|
+
providerId: z.ZodString;
|
|
431
|
+
ownerId: z.ZodString;
|
|
432
|
+
id: z.ZodString;
|
|
433
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
434
|
+
type: z.ZodString;
|
|
435
|
+
id: z.ZodString;
|
|
436
|
+
}, z.core.$strip>>;
|
|
437
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
438
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
439
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
440
|
+
data: Data;
|
|
441
|
+
access: z.ZodObject<{
|
|
442
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
443
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
444
|
+
type: z.ZodString;
|
|
445
|
+
id: z.ZodString;
|
|
446
|
+
}, z.core.$strip>>;
|
|
447
|
+
}, z.core.$strip>;
|
|
448
|
+
}[k] extends {
|
|
449
|
+
_zod: {
|
|
450
|
+
optout: "optional";
|
|
451
|
+
};
|
|
452
|
+
} ? never : k]: T_1[k]["_zod"]["output"]; } : never) & ({
|
|
453
|
+
type: z.ZodString;
|
|
454
|
+
providerId: z.ZodString;
|
|
455
|
+
ownerId: z.ZodString;
|
|
456
|
+
id: z.ZodString;
|
|
457
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
458
|
+
type: z.ZodString;
|
|
459
|
+
id: z.ZodString;
|
|
460
|
+
}, z.core.$strip>>;
|
|
461
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
462
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
463
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
464
|
+
data: Data;
|
|
465
|
+
access: z.ZodObject<{
|
|
466
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
467
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
468
|
+
type: z.ZodString;
|
|
469
|
+
id: z.ZodString;
|
|
470
|
+
}, z.core.$strip>>;
|
|
471
|
+
}, z.core.$strip>;
|
|
472
|
+
} extends infer T_2 extends z.core.$ZodLooseShape ? { -readonly [k in keyof T_2 as {
|
|
473
|
+
type: z.ZodString;
|
|
474
|
+
providerId: z.ZodString;
|
|
475
|
+
ownerId: z.ZodString;
|
|
476
|
+
id: z.ZodString;
|
|
477
|
+
parent: z.ZodNullable<z.ZodObject<{
|
|
478
|
+
type: z.ZodString;
|
|
479
|
+
id: z.ZodString;
|
|
480
|
+
}, z.core.$strip>>;
|
|
481
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
482
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
483
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
484
|
+
data: Data;
|
|
485
|
+
access: z.ZodObject<{
|
|
486
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
487
|
+
via: z.ZodNullable<z.ZodObject<{
|
|
488
|
+
type: z.ZodString;
|
|
489
|
+
id: z.ZodString;
|
|
490
|
+
}, z.core.$strip>>;
|
|
491
|
+
}, z.core.$strip>;
|
|
492
|
+
}[k] extends {
|
|
493
|
+
_zod: {
|
|
494
|
+
optout: "optional";
|
|
495
|
+
};
|
|
496
|
+
} ? k : never]?: T_2[k]["_zod"]["output"] | undefined; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never;
|
|
497
|
+
}>;
|
|
498
|
+
export declare function deleteEntity(target: EntityTarget): Promise<void>;
|
|
499
|
+
/** Where one of the type's own operations answers: for a link or a picture, or to call it. */
|
|
500
|
+
export declare function entityOperationUrl(target: EntityTarget, operation: string): string;
|
|
501
|
+
/** Calls one of the type's own operations that answers `204 No Content`. */
|
|
502
|
+
export declare function callEntityOperation(target: EntityTarget, operation: string, { method, body }?: {
|
|
503
|
+
method?: HttpMethod;
|
|
504
|
+
body?: unknown;
|
|
505
|
+
}): Promise<void>;
|
|
506
|
+
/** Calls one of the type's own operations that answers JSON. */
|
|
507
|
+
export declare function callEntityOperationJson<Schema extends z.ZodType>(target: EntityTarget, operation: string, schema: Schema, { method, body }?: {
|
|
508
|
+
method?: HttpMethod;
|
|
509
|
+
body?: unknown;
|
|
510
|
+
}): Promise<z.infer<Schema>>;
|
|
511
|
+
export declare function fetchEntitySharing(target: EntityTarget, signal?: AbortSignal): Promise<{
|
|
512
|
+
owner: {
|
|
513
|
+
id: string;
|
|
514
|
+
email: string;
|
|
515
|
+
name: string;
|
|
516
|
+
avatar: {
|
|
517
|
+
kind: "generated";
|
|
518
|
+
seed: string;
|
|
519
|
+
} | {
|
|
520
|
+
kind: "file";
|
|
521
|
+
fileId: string;
|
|
522
|
+
url: string;
|
|
523
|
+
};
|
|
524
|
+
} | null;
|
|
525
|
+
shares: {
|
|
526
|
+
account: {
|
|
527
|
+
id: string;
|
|
528
|
+
email: string;
|
|
529
|
+
name: string;
|
|
530
|
+
avatar: {
|
|
531
|
+
kind: "generated";
|
|
532
|
+
seed: string;
|
|
533
|
+
} | {
|
|
534
|
+
kind: "file";
|
|
535
|
+
fileId: string;
|
|
536
|
+
url: string;
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
permissions: string[];
|
|
540
|
+
grantedBy: {
|
|
541
|
+
id: string;
|
|
542
|
+
email: string;
|
|
543
|
+
name: string;
|
|
544
|
+
avatar: {
|
|
545
|
+
kind: "generated";
|
|
546
|
+
seed: string;
|
|
547
|
+
} | {
|
|
548
|
+
kind: "file";
|
|
549
|
+
fileId: string;
|
|
550
|
+
url: string;
|
|
551
|
+
};
|
|
552
|
+
} | null;
|
|
553
|
+
grantedAt: string;
|
|
554
|
+
}[];
|
|
555
|
+
permissions: string[];
|
|
556
|
+
}>;
|
|
557
|
+
export declare function updateEntityShare(target: EntityTarget, accountId: string, input: ShareInput): Promise<{
|
|
558
|
+
owner: {
|
|
559
|
+
id: string;
|
|
560
|
+
email: string;
|
|
561
|
+
name: string;
|
|
562
|
+
avatar: {
|
|
563
|
+
kind: "generated";
|
|
564
|
+
seed: string;
|
|
565
|
+
} | {
|
|
566
|
+
kind: "file";
|
|
567
|
+
fileId: string;
|
|
568
|
+
url: string;
|
|
569
|
+
};
|
|
570
|
+
} | null;
|
|
571
|
+
shares: {
|
|
572
|
+
account: {
|
|
573
|
+
id: string;
|
|
574
|
+
email: string;
|
|
575
|
+
name: string;
|
|
576
|
+
avatar: {
|
|
577
|
+
kind: "generated";
|
|
578
|
+
seed: string;
|
|
579
|
+
} | {
|
|
580
|
+
kind: "file";
|
|
581
|
+
fileId: string;
|
|
582
|
+
url: string;
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
permissions: string[];
|
|
586
|
+
grantedBy: {
|
|
587
|
+
id: string;
|
|
588
|
+
email: string;
|
|
589
|
+
name: string;
|
|
590
|
+
avatar: {
|
|
591
|
+
kind: "generated";
|
|
592
|
+
seed: string;
|
|
593
|
+
} | {
|
|
594
|
+
kind: "file";
|
|
595
|
+
fileId: string;
|
|
596
|
+
url: string;
|
|
597
|
+
};
|
|
598
|
+
} | null;
|
|
599
|
+
grantedAt: string;
|
|
600
|
+
}[];
|
|
601
|
+
permissions: string[];
|
|
602
|
+
}>;
|
|
603
|
+
export declare function deleteEntityShare(target: EntityTarget, accountId: string): Promise<void>;
|