@openpeepshq/client 0.9.0 → 0.10.0

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.
@@ -22,75 +22,45 @@ export declare const accounts: (rawClient: FetchClient) => {
22
22
  message?: string | undefined;
23
23
  key?: string | undefined;
24
24
  }, undefined, undefined>;
25
- export: import("@openpeepshq/fetch-client").TypedNoPayloadEndpoint<{
26
- account: {
27
- id: string;
28
- email: string;
29
- emailValidated: boolean;
30
- };
31
- profiles: {
32
- id: string;
33
- type: "guest" | "local" | "federated";
34
- createdAt: string;
35
- updatedAt: string;
36
- handle: string;
37
- memberships: {
38
- group: {
39
- handle: string;
40
- capabilities: Record<string, {
41
- add?: string[] | undefined;
42
- remove?: string[] | undefined;
43
- } | undefined>;
44
- id: string;
45
- createdAt: string;
46
- updatedAt: string;
47
- avatar?: string | null | undefined;
48
- header?: string | null | undefined;
49
- displayName?: string | undefined;
50
- description?: string | undefined;
51
- rules?: string | undefined;
52
- pinnedPostId?: string | undefined;
53
- discoverable?: boolean | undefined;
54
- deletedAt?: string | null | undefined;
55
- };
56
- roles?: ("none" | "local" | "member" | "moderator" | "admin" | "owner" | "invited")[] | null | undefined;
57
- }[] | undefined;
58
- deletedAt?: string | null | undefined;
59
- avatar?: string | null | undefined;
60
- header?: string | null | undefined;
61
- displayName?: string | undefined;
62
- bio?: string | undefined;
63
- location?: {
64
- text: string;
65
- coordinates?: {
66
- lat: number;
67
- lng: number;
68
- alt?: number | undefined;
69
- } | undefined;
70
- } | undefined;
71
- locked?: boolean | undefined;
72
- bot?: boolean | undefined;
73
- discoverable?: boolean | undefined;
74
- roles?: {
75
- key: string;
76
- displayName: string;
77
- }[] | undefined;
78
- fields?: {
79
- name: string;
80
- value: string;
81
- }[] | undefined;
82
- profileStats?: {
83
- followersCount: number;
84
- followingCount: number;
85
- } | undefined;
86
- pinnedPostId?: string | undefined;
87
- blockedByMe?: boolean | undefined;
88
- }[];
89
- }, {
90
- success: boolean;
91
- message?: string | undefined;
92
- key?: string | undefined;
93
- }, undefined, undefined>;
25
+ /**
26
+ * Personal-data export (GDPR-style). The archive is assembled
27
+ * asynchronously: `start()` enqueues the job and returns the `jobId`,
28
+ * `status(jobId)` is polled until `ready`, and `downloadUrl(token)`
29
+ * yields the one-time URL that streams the zip (auth is the token).
30
+ */
31
+ export: {
32
+ start: import("@openpeepshq/fetch-client").TypedPayloadEndpoint<{
33
+ jobId: string;
34
+ }, Record<string, never>, {
35
+ success: boolean;
36
+ message?: string | undefined;
37
+ key?: string | undefined;
38
+ }, undefined, undefined>;
39
+ status: import("@openpeepshq/fetch-client").TypedNoPayloadEndpoint<{
40
+ jobId: string;
41
+ state: "error" | "ready" | "building" | "expired" | "not-found";
42
+ downloadToken?: string | undefined;
43
+ expiresAt?: string | undefined;
44
+ error?: string | undefined;
45
+ }, {
46
+ success: boolean;
47
+ message?: string | undefined;
48
+ key?: string | undefined;
49
+ }, undefined, {
50
+ jobId: string;
51
+ }>;
52
+ /**
53
+ * One-time URL that streams the assembled archive. The token is the
54
+ * credential (single-use, 7-day TTL); no auth header is required.
55
+ * Resolves the client's base URL so it works in web and RN alike.
56
+ *
57
+ * The path is relative to the client base: `rawClient.getConfig()`
58
+ * already returns `<options.baseUrl>/api/openpeeps/core/v1` (set in
59
+ * `index.ts`), so appending the prefix again would double it and 404
60
+ * against the server route `/api/openpeeps/core/v1/.../download`.
61
+ */
62
+ downloadUrl: (downloadToken: string) => Promise<string>;
63
+ };
94
64
  createPushSubscription: import("@openpeepshq/fetch-client").TypedPayloadEndpoint<{
95
65
  type: "web";
96
66
  endpoint: string;
@@ -3,7 +3,31 @@ export const accounts = (rawClient) => ({
3
3
  current: {
4
4
  update: allpeepPayloadEndpoint(rawClient, '/accounts/current', 'patch'),
5
5
  read: allpeepNoPayloadEndpoint(rawClient, '/accounts/current'),
6
- export: allpeepNoPayloadEndpoint(rawClient, '/accounts/current/export'),
6
+ /**
7
+ * Personal-data export (GDPR-style). The archive is assembled
8
+ * asynchronously: `start()` enqueues the job and returns the `jobId`,
9
+ * `status(jobId)` is polled until `ready`, and `downloadUrl(token)`
10
+ * yields the one-time URL that streams the zip (auth is the token).
11
+ */
12
+ export: {
13
+ start: allpeepPayloadEndpoint(rawClient, '/accounts/current/export/request', 'post'),
14
+ status: allpeepNoPayloadEndpoint(rawClient, '/accounts/current/export/status'),
15
+ /**
16
+ * One-time URL that streams the assembled archive. The token is the
17
+ * credential (single-use, 7-day TTL); no auth header is required.
18
+ * Resolves the client's base URL so it works in web and RN alike.
19
+ *
20
+ * The path is relative to the client base: `rawClient.getConfig()`
21
+ * already returns `<options.baseUrl>/api/openpeeps/core/v1` (set in
22
+ * `index.ts`), so appending the prefix again would double it and 404
23
+ * against the server route `/api/openpeeps/core/v1/.../download`.
24
+ */
25
+ downloadUrl: async (downloadToken) => {
26
+ const config = await rawClient.getConfig();
27
+ const base = (config.baseUrl ?? '').replace(/\/$/, '');
28
+ return `${base}/accounts/current/export/download?token=${encodeURIComponent(downloadToken)}`;
29
+ },
30
+ },
7
31
  createPushSubscription: allpeepPayloadEndpoint(rawClient, '/accounts/current/push-subscriptions'),
8
32
  listPushSubscriptions: allpeepNoPayloadEndpoint(rawClient, '/accounts/current/push-subscriptions'),
9
33
  testPushSubscription: allpeepPayloadEndpoint(rawClient, '/accounts/current/push-subscriptions/test'),