@rool-dev/client 0.3.1 → 0.4.0-dev.22f8ef0
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/README.md +189 -90
- package/dist/auth-browser.d.ts.map +1 -1
- package/dist/auth-browser.js +45 -27
- package/dist/auth-browser.js.map +1 -1
- package/dist/client.d.ts +29 -26
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +90 -88
- package/dist/client.js.map +1 -1
- package/dist/graphql.d.ts +16 -13
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +113 -93
- package/dist/graphql.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/media.d.ts +7 -7
- package/dist/media.js +14 -14
- package/dist/space.d.ts +256 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +730 -0
- package/dist/space.js.map +1 -0
- package/dist/subscription.d.ts +2 -2
- package/dist/subscription.d.ts.map +1 -1
- package/dist/subscription.js +14 -17
- package/dist/subscription.js.map +1 -1
- package/dist/types.d.ts +101 -62
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/dist/graph.d.ts +0 -240
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -581
- package/dist/graph.js.map +0 -1
package/dist/graphql.js
CHANGED
|
@@ -12,13 +12,10 @@ export class GraphQLClient {
|
|
|
12
12
|
get graphqlUrl() {
|
|
13
13
|
return this.config.graphqlUrl;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
// Core Graph Operations
|
|
17
|
-
// ===========================================================================
|
|
18
|
-
async listGraphs() {
|
|
15
|
+
async listSpaces() {
|
|
19
16
|
const query = `
|
|
20
|
-
query
|
|
21
|
-
|
|
17
|
+
query ListSpaces {
|
|
18
|
+
listSpaces {
|
|
22
19
|
id
|
|
23
20
|
name
|
|
24
21
|
role
|
|
@@ -26,129 +23,152 @@ export class GraphQLClient {
|
|
|
26
23
|
}
|
|
27
24
|
`;
|
|
28
25
|
const response = await this.request(query);
|
|
29
|
-
return response.
|
|
26
|
+
return response.listSpaces;
|
|
30
27
|
}
|
|
31
|
-
async
|
|
28
|
+
async getSpace(spaceId) {
|
|
32
29
|
const query = `
|
|
33
|
-
query
|
|
34
|
-
|
|
30
|
+
query GetSpace($id: String!) {
|
|
31
|
+
getSpace(id: $id)
|
|
35
32
|
}
|
|
36
33
|
`;
|
|
37
|
-
const response = await this.request(query, {
|
|
38
|
-
return JSON.parse(response.
|
|
34
|
+
const response = await this.request(query, { id: spaceId });
|
|
35
|
+
return JSON.parse(response.getSpace);
|
|
39
36
|
}
|
|
40
|
-
async
|
|
37
|
+
async setSpace(spaceId, space) {
|
|
41
38
|
const mutation = `
|
|
42
|
-
mutation
|
|
43
|
-
|
|
39
|
+
mutation SetSpace($id: String!, $spaceData: String!, $connectionId: String) {
|
|
40
|
+
setSpace(id: $id, spaceData: $spaceData, connectionId: $connectionId)
|
|
44
41
|
}
|
|
45
42
|
`;
|
|
46
43
|
await this.request(mutation, {
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
id: spaceId,
|
|
45
|
+
spaceData: JSON.stringify(space),
|
|
49
46
|
connectionId: this.config.getConnectionId(),
|
|
50
47
|
});
|
|
51
48
|
}
|
|
52
|
-
async
|
|
49
|
+
async deleteSpace(spaceId) {
|
|
53
50
|
const mutation = `
|
|
54
|
-
mutation
|
|
55
|
-
|
|
51
|
+
mutation DeleteSpace($id: String!, $connectionId: String) {
|
|
52
|
+
deleteSpace(id: $id, connectionId: $connectionId)
|
|
56
53
|
}
|
|
57
54
|
`;
|
|
58
55
|
await this.request(mutation, {
|
|
59
|
-
|
|
56
|
+
id: spaceId,
|
|
60
57
|
connectionId: this.config.getConnectionId(),
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
|
-
async
|
|
60
|
+
async renameSpace(spaceId, name) {
|
|
64
61
|
const mutation = `
|
|
65
|
-
mutation
|
|
66
|
-
|
|
62
|
+
mutation RenameSpace($id: String!, $name: String!, $connectionId: String) {
|
|
63
|
+
renameSpace(id: $id, name: $name, connectionId: $connectionId)
|
|
67
64
|
}
|
|
68
65
|
`;
|
|
69
66
|
await this.request(mutation, {
|
|
70
|
-
|
|
67
|
+
id: spaceId,
|
|
71
68
|
name,
|
|
72
69
|
connectionId: this.config.getConnectionId(),
|
|
73
70
|
});
|
|
74
71
|
}
|
|
75
|
-
async
|
|
72
|
+
async setSpaceMeta(spaceId, meta) {
|
|
76
73
|
const mutation = `
|
|
77
|
-
mutation
|
|
78
|
-
|
|
74
|
+
mutation SetSpaceMeta($id: String!, $meta: String!, $connectionId: String) {
|
|
75
|
+
setSpaceMeta(id: $id, meta: $meta, connectionId: $connectionId)
|
|
79
76
|
}
|
|
80
77
|
`;
|
|
81
78
|
await this.request(mutation, {
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
id: spaceId,
|
|
80
|
+
meta: JSON.stringify(meta),
|
|
84
81
|
connectionId: this.config.getConnectionId(),
|
|
85
82
|
});
|
|
86
83
|
}
|
|
87
|
-
|
|
88
|
-
// AI Operations
|
|
89
|
-
// ===========================================================================
|
|
90
|
-
async promptGraph(graphId, prompt, options = {}) {
|
|
84
|
+
async link(spaceId, source, target, type) {
|
|
91
85
|
const mutation = `
|
|
92
|
-
mutation
|
|
93
|
-
$
|
|
94
|
-
$prompt: String!,
|
|
95
|
-
$nodeIds: [String!],
|
|
96
|
-
$edgeIds: [String!],
|
|
97
|
-
$metadata: JSON,
|
|
98
|
-
$responseSchema: JSON
|
|
99
|
-
) {
|
|
100
|
-
promptGraph(
|
|
101
|
-
graphId: $graphId,
|
|
102
|
-
prompt: $prompt,
|
|
103
|
-
nodeIds: $nodeIds,
|
|
104
|
-
edgeIds: $edgeIds,
|
|
105
|
-
metadata: $metadata,
|
|
106
|
-
responseSchema: $responseSchema
|
|
107
|
-
)
|
|
86
|
+
mutation Link($spaceId: String!, $source: String!, $target: String!, $type: String!, $connectionId: String) {
|
|
87
|
+
link(spaceId: $spaceId, source: $source, target: $target, type: $type, connectionId: $connectionId)
|
|
108
88
|
}
|
|
109
89
|
`;
|
|
110
|
-
|
|
111
|
-
|
|
90
|
+
await this.request(mutation, {
|
|
91
|
+
spaceId,
|
|
92
|
+
source,
|
|
93
|
+
target,
|
|
94
|
+
type,
|
|
95
|
+
connectionId: this.config.getConnectionId(),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
async unlink(spaceId, source, target) {
|
|
99
|
+
const mutation = `
|
|
100
|
+
mutation Unlink($spaceId: String!, $source: String!, $target: String!, $connectionId: String) {
|
|
101
|
+
unlink(spaceId: $spaceId, source: $source, target: $target, connectionId: $connectionId)
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
await this.request(mutation, {
|
|
105
|
+
spaceId,
|
|
106
|
+
source,
|
|
107
|
+
target,
|
|
108
|
+
connectionId: this.config.getConnectionId(),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async deleteObjects(spaceId, ids) {
|
|
112
|
+
const mutation = `
|
|
113
|
+
mutation DeleteObjects($spaceId: String!, $ids: [String!]!, $connectionId: String) {
|
|
114
|
+
deleteObjects(spaceId: $spaceId, ids: $ids, connectionId: $connectionId)
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
await this.request(mutation, {
|
|
118
|
+
spaceId,
|
|
119
|
+
ids,
|
|
120
|
+
connectionId: this.config.getConnectionId(),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async createObject(spaceId, id, data, meta, prompt) {
|
|
124
|
+
const mutation = `
|
|
125
|
+
mutation CreateObject($spaceId: String!, $id: String!, $data: String!, $meta: String, $prompt: String, $connectionId: String) {
|
|
126
|
+
createObject(spaceId: $spaceId, id: $id, data: $data, meta: $meta, prompt: $prompt, connectionId: $connectionId)
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
const result = await this.request(mutation, {
|
|
130
|
+
spaceId,
|
|
131
|
+
id,
|
|
132
|
+
data: JSON.stringify(data),
|
|
133
|
+
meta: meta ? JSON.stringify(meta) : undefined,
|
|
112
134
|
prompt,
|
|
113
|
-
|
|
114
|
-
edgeIds: options.edgeIds ?? [],
|
|
115
|
-
metadata: options.metadata,
|
|
116
|
-
responseSchema: options.responseSchema,
|
|
135
|
+
connectionId: this.config.getConnectionId(),
|
|
117
136
|
});
|
|
118
|
-
return
|
|
137
|
+
return result.createObject;
|
|
119
138
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const query = `
|
|
125
|
-
query GenerateImage($graphId: String!, $prompt: String!, $aspectRatio: String) {
|
|
126
|
-
generateImage(graphId: $graphId, prompt: $prompt, aspectRatio: $aspectRatio) {
|
|
127
|
-
url
|
|
128
|
-
}
|
|
139
|
+
async updateObject(spaceId, id, data, meta, prompt) {
|
|
140
|
+
const mutation = `
|
|
141
|
+
mutation UpdateObject($spaceId: String!, $id: String!, $data: String, $meta: String, $prompt: String, $connectionId: String) {
|
|
142
|
+
updateObject(spaceId: $spaceId, id: $id, data: $data, meta: $meta, prompt: $prompt, connectionId: $connectionId)
|
|
129
143
|
}
|
|
130
144
|
`;
|
|
131
|
-
const
|
|
132
|
-
|
|
145
|
+
const result = await this.request(mutation, {
|
|
146
|
+
spaceId,
|
|
147
|
+
id,
|
|
148
|
+
data: data ? JSON.stringify(data) : undefined,
|
|
149
|
+
meta: meta ? JSON.stringify(meta) : undefined,
|
|
133
150
|
prompt,
|
|
134
|
-
|
|
151
|
+
connectionId: this.config.getConnectionId(),
|
|
135
152
|
});
|
|
136
|
-
return
|
|
153
|
+
return result.updateObject;
|
|
137
154
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
155
|
+
// ===========================================================================
|
|
156
|
+
// AI Operations
|
|
157
|
+
// ===========================================================================
|
|
158
|
+
async prompt(spaceId, prompt, options = {}) {
|
|
159
|
+
const mutation = `
|
|
160
|
+
mutation Prompt($spaceId: String!, $prompt: String!, $objectIds: [String!], $responseSchema: JSON, $connectionId: String) {
|
|
161
|
+
prompt(spaceId: $spaceId, prompt: $prompt, objectIds: $objectIds, responseSchema: $responseSchema, connectionId: $connectionId)
|
|
144
162
|
}
|
|
145
163
|
`;
|
|
146
|
-
const response = await this.request(
|
|
147
|
-
|
|
164
|
+
const response = await this.request(mutation, {
|
|
165
|
+
spaceId,
|
|
148
166
|
prompt,
|
|
149
|
-
|
|
167
|
+
objectIds: options.objectIds ?? [],
|
|
168
|
+
responseSchema: options.responseSchema,
|
|
169
|
+
connectionId: this.config.getConnectionId(),
|
|
150
170
|
});
|
|
151
|
-
return response.
|
|
171
|
+
return response.prompt ?? null;
|
|
152
172
|
}
|
|
153
173
|
// ===========================================================================
|
|
154
174
|
// User / Collaboration Operations
|
|
@@ -185,34 +205,34 @@ export class GraphQLClient {
|
|
|
185
205
|
return null;
|
|
186
206
|
}
|
|
187
207
|
}
|
|
188
|
-
async
|
|
208
|
+
async listSpaceUsers(spaceId) {
|
|
189
209
|
const query = `
|
|
190
|
-
query
|
|
191
|
-
|
|
210
|
+
query ListSpaceUsers($spaceId: String!) {
|
|
211
|
+
listSpaceUsers(spaceId: $spaceId) {
|
|
192
212
|
id
|
|
193
213
|
email
|
|
194
214
|
role
|
|
195
215
|
}
|
|
196
216
|
}
|
|
197
217
|
`;
|
|
198
|
-
const response = await this.request(query, {
|
|
199
|
-
return response.
|
|
218
|
+
const response = await this.request(query, { spaceId });
|
|
219
|
+
return response.listSpaceUsers;
|
|
200
220
|
}
|
|
201
|
-
async
|
|
221
|
+
async addSpaceUser(spaceId, userId, role) {
|
|
202
222
|
const mutation = `
|
|
203
|
-
mutation
|
|
204
|
-
|
|
223
|
+
mutation AddSpaceUser($spaceId: String!, $userId: String!, $role: String!) {
|
|
224
|
+
addSpaceUser(spaceId: $spaceId, userId: $userId, role: $role)
|
|
205
225
|
}
|
|
206
226
|
`;
|
|
207
|
-
await this.request(mutation, {
|
|
227
|
+
await this.request(mutation, { spaceId, userId, role });
|
|
208
228
|
}
|
|
209
|
-
async
|
|
229
|
+
async removeSpaceUser(spaceId, userId) {
|
|
210
230
|
const mutation = `
|
|
211
|
-
mutation
|
|
212
|
-
|
|
231
|
+
mutation RemoveSpaceUser($spaceId: String!, $userId: String!) {
|
|
232
|
+
removeSpaceUser(spaceId: $spaceId, userId: $userId)
|
|
213
233
|
}
|
|
214
234
|
`;
|
|
215
|
-
await this.request(mutation, {
|
|
235
|
+
await this.request(mutation, { spaceId, userId });
|
|
216
236
|
}
|
|
217
237
|
// ===========================================================================
|
|
218
238
|
// Generic Query (escape hatch for app-specific queries)
|
package/dist/graphql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iBAAiB;AACjB,6DAA6D;AAC7D,gFAAgF;AAEhF,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iBAAiB;AACjB,6DAA6D;AAC7D,gFAAgF;AAEhF,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAWlC,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,0BAA0B;AAa9D,MAAM,OAAO,aAAa;IAChB,MAAM,CAAsB;IAEpC,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,KAAK,GAAG;;;;;;;;KAQb,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAkC,KAAK,CAAC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,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,MAAM,MAAM,GAAuB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEzD,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACpC,GAAwD,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YACxF,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { RoolClient } from './client.js';
|
|
2
|
-
export {
|
|
2
|
+
export { RoolSpace, generateEntityId } from './space.js';
|
|
3
3
|
export { EventEmitter } from './event-emitter.js';
|
|
4
|
-
export type {
|
|
4
|
+
export type { RoolObject, RoolSpaceData, RoolSpaceInfo, RoolEvent, RoolEventSource, RoolEventType, JSONPatchOp, RoolUser, RoolUserRole, UserResult, MediaItem, PromptOptions, ConnectionState, SpaceEvents, ObjectCreatedEvent, ObjectUpdatedEvent, ObjectDeletedEvent, LinkedEvent, UnlinkedEvent, MetaUpdatedEvent, SpaceResetEvent, RoolClientConfig, RoolClientEvents, AuthTokens, AuthProvider, } from './types.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,YAAY,EAEV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,YAAY,EAEV,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EAGX,QAAQ,EACR,YAAY,EACZ,UAAU,EAGV,SAAS,EAGT,aAAa,EAGb,eAAe,EAGf,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EAGf,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// =============================================================================
|
|
5
5
|
// Main client
|
|
6
6
|
export { RoolClient } from './client.js';
|
|
7
|
-
//
|
|
8
|
-
export {
|
|
7
|
+
// Space class
|
|
8
|
+
export { RoolSpace, generateEntityId } from './space.js';
|
|
9
9
|
// Event emitter (for extending)
|
|
10
10
|
export { EventEmitter } from './event-emitter.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/media.d.ts
CHANGED
|
@@ -9,28 +9,28 @@ export declare class MediaClient {
|
|
|
9
9
|
constructor(config: MediaClientConfig);
|
|
10
10
|
private mediaUrl;
|
|
11
11
|
/**
|
|
12
|
-
* List all media files for a
|
|
12
|
+
* List all media files for a space.
|
|
13
13
|
*/
|
|
14
|
-
list(
|
|
14
|
+
list(spaceId: string): Promise<MediaItem[]>;
|
|
15
15
|
/**
|
|
16
|
-
* Upload a file to a
|
|
16
|
+
* Upload a file to a space.
|
|
17
17
|
* Accepts File, Blob, or base64 data with content type.
|
|
18
18
|
*/
|
|
19
|
-
upload(
|
|
19
|
+
upload(spaceId: string, file: File | Blob | {
|
|
20
20
|
data: string;
|
|
21
21
|
contentType: string;
|
|
22
22
|
}): Promise<MediaItem>;
|
|
23
23
|
/**
|
|
24
24
|
* Get the download URL for a media file.
|
|
25
25
|
*/
|
|
26
|
-
getUrl(
|
|
26
|
+
getUrl(spaceId: string, uuid: string): string;
|
|
27
27
|
/**
|
|
28
28
|
* Download a media file as a Blob.
|
|
29
29
|
*/
|
|
30
|
-
download(
|
|
30
|
+
download(spaceId: string, uuid: string): Promise<Blob>;
|
|
31
31
|
/**
|
|
32
32
|
* Delete a media file.
|
|
33
33
|
*/
|
|
34
|
-
delete(
|
|
34
|
+
delete(spaceId: string, uuid: string): Promise<void>;
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=media.d.ts.map
|
package/dist/media.js
CHANGED
|
@@ -7,18 +7,18 @@ export class MediaClient {
|
|
|
7
7
|
constructor(config) {
|
|
8
8
|
this.config = config;
|
|
9
9
|
}
|
|
10
|
-
mediaUrl(
|
|
11
|
-
const base = `${this.config.mediaUrl}/${encodeURIComponent(
|
|
10
|
+
mediaUrl(spaceId, uuid) {
|
|
11
|
+
const base = `${this.config.mediaUrl}/${encodeURIComponent(spaceId)}`;
|
|
12
12
|
return uuid ? `${base}/${encodeURIComponent(uuid)}` : base;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* List all media files for a
|
|
15
|
+
* List all media files for a space.
|
|
16
16
|
*/
|
|
17
|
-
async list(
|
|
17
|
+
async list(spaceId) {
|
|
18
18
|
const token = await this.config.authManager.getToken();
|
|
19
19
|
if (!token)
|
|
20
20
|
throw new Error('Not authenticated');
|
|
21
|
-
const response = await fetch(this.mediaUrl(
|
|
21
|
+
const response = await fetch(this.mediaUrl(spaceId), {
|
|
22
22
|
method: 'GET',
|
|
23
23
|
headers: { Authorization: `Bearer ${token}` },
|
|
24
24
|
});
|
|
@@ -28,10 +28,10 @@ export class MediaClient {
|
|
|
28
28
|
return response.json();
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Upload a file to a
|
|
31
|
+
* Upload a file to a space.
|
|
32
32
|
* Accepts File, Blob, or base64 data with content type.
|
|
33
33
|
*/
|
|
34
|
-
async upload(
|
|
34
|
+
async upload(spaceId, file) {
|
|
35
35
|
const token = await this.config.authManager.getToken();
|
|
36
36
|
if (!token)
|
|
37
37
|
throw new Error('Not authenticated');
|
|
@@ -54,7 +54,7 @@ export class MediaClient {
|
|
|
54
54
|
contentType: file.contentType,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
const response = await fetch(this.mediaUrl(
|
|
57
|
+
const response = await fetch(this.mediaUrl(spaceId), {
|
|
58
58
|
method: 'POST',
|
|
59
59
|
headers,
|
|
60
60
|
body,
|
|
@@ -67,17 +67,17 @@ export class MediaClient {
|
|
|
67
67
|
/**
|
|
68
68
|
* Get the download URL for a media file.
|
|
69
69
|
*/
|
|
70
|
-
getUrl(
|
|
71
|
-
return this.mediaUrl(
|
|
70
|
+
getUrl(spaceId, uuid) {
|
|
71
|
+
return this.mediaUrl(spaceId, uuid);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Download a media file as a Blob.
|
|
75
75
|
*/
|
|
76
|
-
async download(
|
|
76
|
+
async download(spaceId, uuid) {
|
|
77
77
|
const token = await this.config.authManager.getToken();
|
|
78
78
|
if (!token)
|
|
79
79
|
throw new Error('Not authenticated');
|
|
80
|
-
const response = await fetch(this.mediaUrl(
|
|
80
|
+
const response = await fetch(this.mediaUrl(spaceId, uuid), {
|
|
81
81
|
method: 'GET',
|
|
82
82
|
headers: { Authorization: `Bearer ${token}` },
|
|
83
83
|
});
|
|
@@ -89,11 +89,11 @@ export class MediaClient {
|
|
|
89
89
|
/**
|
|
90
90
|
* Delete a media file.
|
|
91
91
|
*/
|
|
92
|
-
async delete(
|
|
92
|
+
async delete(spaceId, uuid) {
|
|
93
93
|
const token = await this.config.authManager.getToken();
|
|
94
94
|
if (!token)
|
|
95
95
|
throw new Error('Not authenticated');
|
|
96
|
-
const response = await fetch(this.mediaUrl(
|
|
96
|
+
const response = await fetch(this.mediaUrl(spaceId, uuid), {
|
|
97
97
|
method: 'DELETE',
|
|
98
98
|
headers: { Authorization: `Bearer ${token}` },
|
|
99
99
|
});
|