@rool-dev/client 0.3.1-dev.ff91c85 → 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 -84
- 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 -16
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +71 -90
- 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 -57
- 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 -242
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -592
- 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,168 +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
|
-
|
|
79
|
+
id: spaceId,
|
|
83
80
|
meta: JSON.stringify(meta),
|
|
84
81
|
connectionId: this.config.getConnectionId(),
|
|
85
82
|
});
|
|
86
83
|
}
|
|
87
|
-
async
|
|
84
|
+
async link(spaceId, source, target, type) {
|
|
88
85
|
const mutation = `
|
|
89
|
-
mutation
|
|
90
|
-
|
|
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)
|
|
91
88
|
}
|
|
92
89
|
`;
|
|
93
90
|
await this.request(mutation, {
|
|
94
|
-
|
|
95
|
-
id,
|
|
91
|
+
spaceId,
|
|
96
92
|
source,
|
|
97
93
|
target,
|
|
98
94
|
type,
|
|
99
95
|
connectionId: this.config.getConnectionId(),
|
|
100
96
|
});
|
|
101
97
|
}
|
|
102
|
-
async
|
|
98
|
+
async unlink(spaceId, source, target) {
|
|
103
99
|
const mutation = `
|
|
104
|
-
mutation
|
|
105
|
-
|
|
100
|
+
mutation Unlink($spaceId: String!, $source: String!, $target: String!, $connectionId: String) {
|
|
101
|
+
unlink(spaceId: $spaceId, source: $source, target: $target, connectionId: $connectionId)
|
|
106
102
|
}
|
|
107
103
|
`;
|
|
108
104
|
await this.request(mutation, {
|
|
109
|
-
|
|
105
|
+
spaceId,
|
|
110
106
|
source,
|
|
111
107
|
target,
|
|
112
108
|
connectionId: this.config.getConnectionId(),
|
|
113
109
|
});
|
|
114
110
|
}
|
|
115
|
-
async
|
|
111
|
+
async deleteObjects(spaceId, ids) {
|
|
116
112
|
const mutation = `
|
|
117
|
-
mutation
|
|
118
|
-
|
|
113
|
+
mutation DeleteObjects($spaceId: String!, $ids: [String!]!, $connectionId: String) {
|
|
114
|
+
deleteObjects(spaceId: $spaceId, ids: $ids, connectionId: $connectionId)
|
|
119
115
|
}
|
|
120
116
|
`;
|
|
121
117
|
await this.request(mutation, {
|
|
122
|
-
|
|
118
|
+
spaceId,
|
|
123
119
|
ids,
|
|
124
120
|
connectionId: this.config.getConnectionId(),
|
|
125
121
|
});
|
|
126
122
|
}
|
|
127
|
-
async
|
|
123
|
+
async createObject(spaceId, id, data, meta, prompt) {
|
|
128
124
|
const mutation = `
|
|
129
|
-
mutation
|
|
130
|
-
|
|
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)
|
|
131
127
|
}
|
|
132
128
|
`;
|
|
133
|
-
await this.request(mutation, {
|
|
134
|
-
|
|
129
|
+
const result = await this.request(mutation, {
|
|
130
|
+
spaceId,
|
|
135
131
|
id,
|
|
136
|
-
|
|
137
|
-
fields: fields ? JSON.stringify(fields) : undefined,
|
|
132
|
+
data: JSON.stringify(data),
|
|
138
133
|
meta: meta ? JSON.stringify(meta) : undefined,
|
|
139
134
|
prompt,
|
|
140
135
|
connectionId: this.config.getConnectionId(),
|
|
141
136
|
});
|
|
137
|
+
return result.createObject;
|
|
142
138
|
}
|
|
143
|
-
async
|
|
139
|
+
async updateObject(spaceId, id, data, meta, prompt) {
|
|
144
140
|
const mutation = `
|
|
145
|
-
mutation
|
|
146
|
-
|
|
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)
|
|
147
143
|
}
|
|
148
144
|
`;
|
|
149
|
-
await this.request(mutation, {
|
|
150
|
-
|
|
145
|
+
const result = await this.request(mutation, {
|
|
146
|
+
spaceId,
|
|
151
147
|
id,
|
|
152
|
-
|
|
153
|
-
fields: fields ? JSON.stringify(fields) : undefined,
|
|
148
|
+
data: data ? JSON.stringify(data) : undefined,
|
|
154
149
|
meta: meta ? JSON.stringify(meta) : undefined,
|
|
155
150
|
prompt,
|
|
156
151
|
connectionId: this.config.getConnectionId(),
|
|
157
152
|
});
|
|
153
|
+
return result.updateObject;
|
|
158
154
|
}
|
|
159
155
|
// ===========================================================================
|
|
160
156
|
// AI Operations
|
|
161
157
|
// ===========================================================================
|
|
162
|
-
async
|
|
158
|
+
async prompt(spaceId, prompt, options = {}) {
|
|
163
159
|
const mutation = `
|
|
164
|
-
mutation
|
|
165
|
-
$
|
|
166
|
-
$prompt: String!,
|
|
167
|
-
$nodeIds: [String!],
|
|
168
|
-
$edgeIds: [String!],
|
|
169
|
-
$responseSchema: JSON,
|
|
170
|
-
$connectionId: String
|
|
171
|
-
) {
|
|
172
|
-
promptGraph(
|
|
173
|
-
graphId: $graphId,
|
|
174
|
-
prompt: $prompt,
|
|
175
|
-
nodeIds: $nodeIds,
|
|
176
|
-
edgeIds: $edgeIds,
|
|
177
|
-
responseSchema: $responseSchema,
|
|
178
|
-
connectionId: $connectionId
|
|
179
|
-
)
|
|
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)
|
|
180
162
|
}
|
|
181
163
|
`;
|
|
182
164
|
const response = await this.request(mutation, {
|
|
183
|
-
|
|
165
|
+
spaceId,
|
|
184
166
|
prompt,
|
|
185
|
-
|
|
186
|
-
edgeIds: options.edgeIds ?? [],
|
|
167
|
+
objectIds: options.objectIds ?? [],
|
|
187
168
|
responseSchema: options.responseSchema,
|
|
188
169
|
connectionId: this.config.getConnectionId(),
|
|
189
170
|
});
|
|
190
|
-
return response.
|
|
171
|
+
return response.prompt ?? null;
|
|
191
172
|
}
|
|
192
173
|
// ===========================================================================
|
|
193
174
|
// User / Collaboration Operations
|
|
@@ -224,34 +205,34 @@ export class GraphQLClient {
|
|
|
224
205
|
return null;
|
|
225
206
|
}
|
|
226
207
|
}
|
|
227
|
-
async
|
|
208
|
+
async listSpaceUsers(spaceId) {
|
|
228
209
|
const query = `
|
|
229
|
-
query
|
|
230
|
-
|
|
210
|
+
query ListSpaceUsers($spaceId: String!) {
|
|
211
|
+
listSpaceUsers(spaceId: $spaceId) {
|
|
231
212
|
id
|
|
232
213
|
email
|
|
233
214
|
role
|
|
234
215
|
}
|
|
235
216
|
}
|
|
236
217
|
`;
|
|
237
|
-
const response = await this.request(query, {
|
|
238
|
-
return response.
|
|
218
|
+
const response = await this.request(query, { spaceId });
|
|
219
|
+
return response.listSpaceUsers;
|
|
239
220
|
}
|
|
240
|
-
async
|
|
221
|
+
async addSpaceUser(spaceId, userId, role) {
|
|
241
222
|
const mutation = `
|
|
242
|
-
mutation
|
|
243
|
-
|
|
223
|
+
mutation AddSpaceUser($spaceId: String!, $userId: String!, $role: String!) {
|
|
224
|
+
addSpaceUser(spaceId: $spaceId, userId: $userId, role: $role)
|
|
244
225
|
}
|
|
245
226
|
`;
|
|
246
|
-
await this.request(mutation, {
|
|
227
|
+
await this.request(mutation, { spaceId, userId, role });
|
|
247
228
|
}
|
|
248
|
-
async
|
|
229
|
+
async removeSpaceUser(spaceId, userId) {
|
|
249
230
|
const mutation = `
|
|
250
|
-
mutation
|
|
251
|
-
|
|
231
|
+
mutation RemoveSpaceUser($spaceId: String!, $userId: String!) {
|
|
232
|
+
removeSpaceUser(spaceId: $spaceId, userId: $userId)
|
|
252
233
|
}
|
|
253
234
|
`;
|
|
254
|
-
await this.request(mutation, {
|
|
235
|
+
await this.request(mutation, { spaceId, userId });
|
|
255
236
|
}
|
|
256
237
|
// ===========================================================================
|
|
257
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;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,
|
|
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;;;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AM,EAAE,MAAM;YACd,OAAO;YACP,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;QAEH,IAAI,CAAC,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
|
});
|