@rool-dev/client 0.3.1-dev.5873a0f → 0.3.1-dev.5aaae9e
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 -85
- 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 -11
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +119 -64
- 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 +255 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +728 -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 +100 -56
- 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 -236
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -588
- 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,96 +23,154 @@ 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) {
|
|
73
|
+
const mutation = `
|
|
74
|
+
mutation SetSpaceMeta($id: String!, $meta: String!, $connectionId: String) {
|
|
75
|
+
setSpaceMeta(id: $id, meta: $meta, connectionId: $connectionId)
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
await this.request(mutation, {
|
|
79
|
+
id: spaceId,
|
|
80
|
+
meta: JSON.stringify(meta),
|
|
81
|
+
connectionId: this.config.getConnectionId(),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async link(spaceId, source, target, type) {
|
|
76
85
|
const mutation = `
|
|
77
|
-
mutation
|
|
78
|
-
|
|
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)
|
|
79
88
|
}
|
|
80
89
|
`;
|
|
81
90
|
await this.request(mutation, {
|
|
82
|
-
|
|
83
|
-
|
|
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, objectType, fields, meta, prompt) {
|
|
124
|
+
const mutation = `
|
|
125
|
+
mutation CreateObject($spaceId: String!, $id: String!, $objectType: String!, $fields: String, $meta: String, $prompt: String, $connectionId: String) {
|
|
126
|
+
createObject(spaceId: $spaceId, id: $id, objectType: $objectType, fields: $fields, meta: $meta, prompt: $prompt, connectionId: $connectionId)
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
const result = await this.request(mutation, {
|
|
130
|
+
spaceId,
|
|
131
|
+
id,
|
|
132
|
+
objectType,
|
|
133
|
+
fields: fields ? JSON.stringify(fields) : undefined,
|
|
134
|
+
meta: meta ? JSON.stringify(meta) : undefined,
|
|
135
|
+
prompt,
|
|
136
|
+
connectionId: this.config.getConnectionId(),
|
|
137
|
+
});
|
|
138
|
+
return result.createObject;
|
|
139
|
+
}
|
|
140
|
+
async updateObject(spaceId, id, objectType, fields, meta, prompt) {
|
|
141
|
+
const mutation = `
|
|
142
|
+
mutation UpdateObject($spaceId: String!, $id: String!, $objectType: String, $fields: String, $meta: String, $prompt: String, $connectionId: String) {
|
|
143
|
+
updateObject(spaceId: $spaceId, id: $id, objectType: $objectType, fields: $fields, meta: $meta, prompt: $prompt, connectionId: $connectionId)
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
const result = await this.request(mutation, {
|
|
147
|
+
spaceId,
|
|
148
|
+
id,
|
|
149
|
+
objectType,
|
|
150
|
+
fields: fields ? JSON.stringify(fields) : undefined,
|
|
151
|
+
meta: meta ? JSON.stringify(meta) : undefined,
|
|
152
|
+
prompt,
|
|
84
153
|
connectionId: this.config.getConnectionId(),
|
|
85
154
|
});
|
|
155
|
+
return result.updateObject;
|
|
86
156
|
}
|
|
87
157
|
// ===========================================================================
|
|
88
158
|
// AI Operations
|
|
89
159
|
// ===========================================================================
|
|
90
|
-
async
|
|
160
|
+
async prompt(spaceId, prompt, options = {}) {
|
|
91
161
|
const mutation = `
|
|
92
|
-
mutation
|
|
93
|
-
$
|
|
94
|
-
$prompt: String!,
|
|
95
|
-
$nodeIds: [String!],
|
|
96
|
-
$edgeIds: [String!],
|
|
97
|
-
$responseSchema: JSON,
|
|
98
|
-
$connectionId: String
|
|
99
|
-
) {
|
|
100
|
-
promptGraph(
|
|
101
|
-
graphId: $graphId,
|
|
102
|
-
prompt: $prompt,
|
|
103
|
-
nodeIds: $nodeIds,
|
|
104
|
-
edgeIds: $edgeIds,
|
|
105
|
-
responseSchema: $responseSchema,
|
|
106
|
-
connectionId: $connectionId
|
|
107
|
-
)
|
|
162
|
+
mutation Prompt($spaceId: String!, $prompt: String!, $objectIds: [String!], $responseSchema: JSON, $connectionId: String) {
|
|
163
|
+
prompt(spaceId: $spaceId, prompt: $prompt, objectIds: $objectIds, responseSchema: $responseSchema, connectionId: $connectionId)
|
|
108
164
|
}
|
|
109
165
|
`;
|
|
110
166
|
const response = await this.request(mutation, {
|
|
111
|
-
|
|
167
|
+
spaceId,
|
|
112
168
|
prompt,
|
|
113
|
-
|
|
114
|
-
edgeIds: options.edgeIds ?? [],
|
|
169
|
+
objectIds: options.objectIds ?? [],
|
|
115
170
|
responseSchema: options.responseSchema,
|
|
116
171
|
connectionId: this.config.getConnectionId(),
|
|
117
172
|
});
|
|
118
|
-
return response.
|
|
173
|
+
return response.prompt ?? null;
|
|
119
174
|
}
|
|
120
175
|
// ===========================================================================
|
|
121
176
|
// User / Collaboration Operations
|
|
@@ -152,34 +207,34 @@ export class GraphQLClient {
|
|
|
152
207
|
return null;
|
|
153
208
|
}
|
|
154
209
|
}
|
|
155
|
-
async
|
|
210
|
+
async listSpaceUsers(spaceId) {
|
|
156
211
|
const query = `
|
|
157
|
-
query
|
|
158
|
-
|
|
212
|
+
query ListSpaceUsers($spaceId: String!) {
|
|
213
|
+
listSpaceUsers(spaceId: $spaceId) {
|
|
159
214
|
id
|
|
160
215
|
email
|
|
161
216
|
role
|
|
162
217
|
}
|
|
163
218
|
}
|
|
164
219
|
`;
|
|
165
|
-
const response = await this.request(query, {
|
|
166
|
-
return response.
|
|
220
|
+
const response = await this.request(query, { spaceId });
|
|
221
|
+
return response.listSpaceUsers;
|
|
167
222
|
}
|
|
168
|
-
async
|
|
223
|
+
async addSpaceUser(spaceId, userId, role) {
|
|
169
224
|
const mutation = `
|
|
170
|
-
mutation
|
|
171
|
-
|
|
225
|
+
mutation AddSpaceUser($spaceId: String!, $userId: String!, $role: String!) {
|
|
226
|
+
addSpaceUser(spaceId: $spaceId, userId: $userId, role: $role)
|
|
172
227
|
}
|
|
173
228
|
`;
|
|
174
|
-
await this.request(mutation, {
|
|
229
|
+
await this.request(mutation, { spaceId, userId, role });
|
|
175
230
|
}
|
|
176
|
-
async
|
|
231
|
+
async removeSpaceUser(spaceId, userId) {
|
|
177
232
|
const mutation = `
|
|
178
|
-
mutation
|
|
179
|
-
|
|
233
|
+
mutation RemoveSpaceUser($spaceId: String!, $userId: String!) {
|
|
234
|
+
removeSpaceUser(spaceId: $spaceId, userId: $userId)
|
|
180
235
|
}
|
|
181
236
|
`;
|
|
182
|
-
await this.request(mutation, {
|
|
237
|
+
await this.request(mutation, { spaceId, userId });
|
|
183
238
|
}
|
|
184
239
|
// ===========================================================================
|
|
185
240
|
// 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,CAAC;QAC5E,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAe;QAC5B,MAAM,KAAK,GAAG;;;;KAIb,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAuB,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAe,EAAE,KAAoB;QAClD,MAAM,QAAQ,GAAG;;;;KAIhB,CAAC;QACF,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC3B,EAAE,EAAE,OAAO;YACX,SA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C,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
|
});
|