@ossy/sdk 1.40.0 → 1.40.2
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 +27 -6
- package/build/public.index.d.ts +110 -257
- package/build/public.index.js +1 -1
- package/build/types/Actions.d.ts +71 -59
- package/build/types/platform-action.d.ts +5 -0
- package/build/types/public.index.d.ts +0 -1
- package/build/types/sdk.d.ts +19 -123
- package/package.json +3 -3
- package/build/types/adapter.d.ts +0 -28
package/README.md
CHANGED
|
@@ -70,19 +70,40 @@ const resource = await sdk.resources.get({ id: 'resource-id' })
|
|
|
70
70
|
|
|
71
71
|
## With React
|
|
72
72
|
|
|
73
|
-
Use `@ossy/sdk-react` for
|
|
73
|
+
Use `@ossy/sdk-react` for `WorkspaceProvider` and `useSdk()`. Domain hooks (`useResources`, `useAuthentication`, …) live in feature packages — see [@ossy/sdk-react README](../sdk-react/README.md).
|
|
74
74
|
|
|
75
75
|
```jsx
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
76
|
+
import { ReactSdk, WorkspaceProvider } from '@ossy/sdk-react'
|
|
77
|
+
import { AuthenticationProvider } from '@ossy/authentication'
|
|
78
78
|
|
|
79
|
-
const sdk =
|
|
79
|
+
const sdk = ReactSdk.of({ workspaceId: 'your-workspace-id' })
|
|
80
80
|
|
|
81
81
|
export const App = () => (
|
|
82
82
|
<WorkspaceProvider sdk={sdk}>
|
|
83
|
-
<
|
|
83
|
+
<AuthenticationProvider>
|
|
84
|
+
<YourApp />
|
|
85
|
+
</AuthenticationProvider>
|
|
84
86
|
</WorkspaceProvider>
|
|
85
87
|
)
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
## Invoking platform actions
|
|
91
|
+
|
|
92
|
+
**Writes and commands** use `sdk.invoke(action, payload)` with a platform action POJO or id string:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
import { SDK } from '@ossy/sdk'
|
|
96
|
+
import { BookingCreate } from '@ossy/booking'
|
|
97
|
+
|
|
98
|
+
const sdk = SDK.of({ workspaceId: 'your-workspace-id' })
|
|
99
|
+
|
|
100
|
+
// POJO (preferred) — importable on client and server
|
|
101
|
+
await sdk.invoke(BookingCreate, { consultantId, startAt, duration })
|
|
102
|
+
// HTTP: POST /actions with { action: 'booking/create', payload: { … } }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Reads** use location paths — not invoke:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
await sdk.resources.list({ location: '/@ossy/booking/services/' })
|
|
109
|
+
```
|
package/build/public.index.d.ts
CHANGED
|
@@ -1,324 +1,177 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Action, SDKConfig, ActionAccess } from '@ossy/types';
|
|
2
2
|
export * from '@ossy/types';
|
|
3
|
-
export {
|
|
3
|
+
export { ActionAccess, TaskStatus, Tasks } from '@ossy/types';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
type ActionRef = Action | string;
|
|
6
|
+
/** Normalize dot aliases to slash ids (`resources.list` → `resources/list`). */
|
|
7
|
+
declare function resolveActionId(action: ActionRef): string;
|
|
8
|
+
|
|
9
|
+
declare class SDK {
|
|
10
|
+
workspaceId?: string;
|
|
11
|
+
authorization?: string;
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
static of(config: SDKConfig): SDK;
|
|
14
|
+
constructor(config: SDKConfig);
|
|
15
|
+
updateConfig(intendedConfig: SDKConfig): void;
|
|
16
|
+
/** @deprecated Use `invoke(action, payload)` instead. */
|
|
17
|
+
get resources(): {
|
|
18
|
+
upload: ({ location, file }: {
|
|
19
|
+
location: string;
|
|
20
|
+
file: File;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
content: {
|
|
23
|
+
uploadUrl: string;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
list: (query: {
|
|
27
|
+
location?: string;
|
|
28
|
+
}) => Promise<unknown>;
|
|
29
|
+
uploadNamedVersion: ({ id, name, file }: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
file: File;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
uploadUrl: string;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
invoke: <TPayload extends Record<string, unknown> = Record<string, unknown>, TResult = unknown>(action: ActionRef, payload?: TPayload) => Promise<TResult>;
|
|
40
|
+
invokePlatformAction: (actionId: string, payload?: Record<string, unknown>) => Promise<any>;
|
|
41
|
+
handleResponse: (response: Response) => Response | Promise<any>;
|
|
21
42
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
get(_query?: string | Record<string, unknown>): Promise<Resource<Task>[]>;
|
|
29
|
-
getUnprocessed(): Promise<Resource<Task>[]>;
|
|
30
|
-
create({ type, resourceId }: {
|
|
31
|
-
type: TaskType;
|
|
32
|
-
resourceId: string;
|
|
33
|
-
}): Promise<Resource<Task>>;
|
|
43
|
+
|
|
44
|
+
/** Platform action POJO for CLI discovery and `sdk.invoke` action refs. */
|
|
45
|
+
interface PlatformAction<TPayload = Record<string, unknown>> {
|
|
46
|
+
id: string;
|
|
47
|
+
payload?: Partial<TPayload>;
|
|
48
|
+
access?: ActionAccess;
|
|
34
49
|
}
|
|
35
50
|
|
|
36
|
-
declare const ApiTokenGetAll:
|
|
37
|
-
declare const ApiTokenCreate:
|
|
51
|
+
declare const ApiTokenGetAll: PlatformAction;
|
|
52
|
+
declare const ApiTokenCreate: PlatformAction<{
|
|
38
53
|
name: string;
|
|
39
54
|
description: string;
|
|
40
55
|
expiresAt: string;
|
|
41
56
|
}>;
|
|
42
|
-
declare const ApiTokenInvalidate:
|
|
43
|
-
|
|
57
|
+
declare const ApiTokenInvalidate: PlatformAction<{
|
|
58
|
+
tokenId: string;
|
|
44
59
|
}>;
|
|
45
|
-
declare const WorkspacesList:
|
|
46
|
-
declare const WorkspacesGetCurrent:
|
|
47
|
-
declare const WorkspacesGet:
|
|
48
|
-
|
|
60
|
+
declare const WorkspacesList: PlatformAction;
|
|
61
|
+
declare const WorkspacesGetCurrent: PlatformAction;
|
|
62
|
+
declare const WorkspacesGet: PlatformAction<{
|
|
63
|
+
workspaceId: string;
|
|
49
64
|
}>;
|
|
50
|
-
declare const WorkspacesCreate:
|
|
65
|
+
declare const WorkspacesCreate: PlatformAction<{
|
|
51
66
|
name: string;
|
|
52
67
|
}>;
|
|
53
|
-
declare const WorkspacesImportResourceTemplates:
|
|
54
|
-
templates:
|
|
68
|
+
declare const WorkspacesImportResourceTemplates: PlatformAction<{
|
|
69
|
+
templates: unknown[];
|
|
55
70
|
}>;
|
|
56
|
-
declare const WorkspacesGetResourceTemplates:
|
|
57
|
-
declare const WorkspacesCreateApiToken:
|
|
71
|
+
declare const WorkspacesGetResourceTemplates: PlatformAction;
|
|
72
|
+
declare const WorkspacesCreateApiToken: PlatformAction<{
|
|
58
73
|
description: string;
|
|
59
74
|
}>;
|
|
60
|
-
declare const WorkspacesGetApiTokens:
|
|
61
|
-
declare const WorkspacesInviteUser:
|
|
75
|
+
declare const WorkspacesGetApiTokens: PlatformAction;
|
|
76
|
+
declare const WorkspacesInviteUser: PlatformAction<{
|
|
62
77
|
email: string;
|
|
63
78
|
}>;
|
|
64
|
-
declare const WorkspacesEnableService:
|
|
65
|
-
service:
|
|
79
|
+
declare const WorkspacesEnableService: PlatformAction<{
|
|
80
|
+
service: unknown;
|
|
66
81
|
}>;
|
|
67
|
-
declare const WorkspacesDisableService:
|
|
68
|
-
service:
|
|
82
|
+
declare const WorkspacesDisableService: PlatformAction<{
|
|
83
|
+
service: unknown;
|
|
69
84
|
}>;
|
|
70
|
-
declare const WorkspacesGetUsers:
|
|
71
|
-
declare const WorkspacesAddMember:
|
|
85
|
+
declare const WorkspacesGetUsers: PlatformAction;
|
|
86
|
+
declare const WorkspacesAddMember: PlatformAction<{
|
|
72
87
|
userId: string;
|
|
73
88
|
workspaceId: string;
|
|
74
89
|
createdBy?: string;
|
|
75
90
|
}>;
|
|
76
|
-
declare const WorkspacesRemoveMember:
|
|
91
|
+
declare const WorkspacesRemoveMember: PlatformAction<{
|
|
77
92
|
userId: string;
|
|
78
93
|
workspaceId: string;
|
|
79
94
|
}>;
|
|
80
|
-
declare const UserCurrentGet:
|
|
81
|
-
declare const UserCurrentGetHistory:
|
|
82
|
-
declare const UserCurrentUpdate:
|
|
83
|
-
|
|
95
|
+
declare const UserCurrentGet: PlatformAction;
|
|
96
|
+
declare const UserCurrentGetHistory: PlatformAction;
|
|
97
|
+
declare const UserCurrentUpdate: PlatformAction<{
|
|
98
|
+
firstName?: string;
|
|
99
|
+
lastName?: string;
|
|
100
|
+
email?: string;
|
|
84
101
|
}>;
|
|
85
|
-
declare const ResourcesCreateDirectory:
|
|
102
|
+
declare const ResourcesCreateDirectory: PlatformAction<{
|
|
86
103
|
type?: 'directory';
|
|
87
104
|
location: string;
|
|
88
105
|
name: string;
|
|
89
106
|
}>;
|
|
90
|
-
declare const ResourcesCreate:
|
|
107
|
+
declare const ResourcesCreate: PlatformAction<{
|
|
91
108
|
type: string;
|
|
92
109
|
location: string;
|
|
93
110
|
name: string;
|
|
94
|
-
content?:
|
|
111
|
+
content?: unknown;
|
|
95
112
|
}>;
|
|
96
|
-
declare const ResourcesUpload:
|
|
113
|
+
declare const ResourcesUpload: PlatformAction<{
|
|
97
114
|
location: string;
|
|
98
115
|
type: string;
|
|
99
116
|
name: string;
|
|
100
117
|
size: number;
|
|
101
118
|
}>;
|
|
102
|
-
declare const ResourcesUploadNamedVersion:
|
|
103
|
-
|
|
104
|
-
|
|
119
|
+
declare const ResourcesUploadNamedVersion: PlatformAction<{
|
|
120
|
+
resourceId: string;
|
|
121
|
+
namedVersion: string;
|
|
122
|
+
type: string;
|
|
105
123
|
size: number;
|
|
106
124
|
}>;
|
|
107
|
-
declare const ResourcesGet:
|
|
108
|
-
|
|
125
|
+
declare const ResourcesGet: PlatformAction<{
|
|
126
|
+
resourceId: string;
|
|
109
127
|
}>;
|
|
110
|
-
declare const ResourcesList:
|
|
111
|
-
|
|
128
|
+
declare const ResourcesList: PlatformAction<{
|
|
129
|
+
location?: string;
|
|
130
|
+
query?: Record<string, unknown>;
|
|
112
131
|
}>;
|
|
113
|
-
declare const ResourcesSearch:
|
|
114
|
-
declare const ResourceUpdateAccess:
|
|
115
|
-
|
|
132
|
+
declare const ResourcesSearch: PlatformAction<Record<string, unknown>>;
|
|
133
|
+
declare const ResourceUpdateAccess: PlatformAction<{
|
|
134
|
+
resourceId: string;
|
|
116
135
|
access: 'restricted' | 'public';
|
|
117
136
|
}>;
|
|
118
|
-
declare const ResourcesRemove:
|
|
119
|
-
|
|
137
|
+
declare const ResourcesRemove: PlatformAction<{
|
|
138
|
+
resourceId: string;
|
|
120
139
|
}>;
|
|
121
|
-
declare const ResourcesUpdateContent:
|
|
122
|
-
|
|
123
|
-
content:
|
|
140
|
+
declare const ResourcesUpdateContent: PlatformAction<{
|
|
141
|
+
resourceId: string;
|
|
142
|
+
content: unknown;
|
|
124
143
|
}>;
|
|
125
|
-
declare const ResourcesMove:
|
|
126
|
-
|
|
144
|
+
declare const ResourcesMove: PlatformAction<{
|
|
145
|
+
resourceId: string;
|
|
127
146
|
target: string;
|
|
128
147
|
}>;
|
|
129
|
-
declare const ResourcesRename:
|
|
130
|
-
|
|
148
|
+
declare const ResourcesRename: PlatformAction<{
|
|
149
|
+
resourceId: string;
|
|
131
150
|
name: string;
|
|
132
151
|
}>;
|
|
133
|
-
declare const AuthSignUp:
|
|
152
|
+
declare const AuthSignUp: PlatformAction<{
|
|
134
153
|
email: string;
|
|
135
154
|
firstName: string;
|
|
136
155
|
lastName: string;
|
|
137
156
|
}>;
|
|
138
|
-
declare const AuthSignIn:
|
|
157
|
+
declare const AuthSignIn: PlatformAction<{
|
|
139
158
|
email: string;
|
|
140
159
|
}>;
|
|
141
|
-
declare const AuthVerifySignIn:
|
|
160
|
+
declare const AuthVerifySignIn: PlatformAction<{
|
|
142
161
|
token: string;
|
|
143
162
|
}>;
|
|
144
|
-
declare const AuthVerifyInvitation:
|
|
163
|
+
declare const AuthVerifyInvitation: PlatformAction<{
|
|
145
164
|
workspaceId: string;
|
|
146
165
|
token: string;
|
|
147
166
|
}>;
|
|
148
|
-
declare const AuthGetAuthenticatedUser:
|
|
149
|
-
declare const AuthGetAuthenticatedUserHistory:
|
|
150
|
-
declare const AuthGetUser:
|
|
167
|
+
declare const AuthGetAuthenticatedUser: PlatformAction;
|
|
168
|
+
declare const AuthGetAuthenticatedUserHistory: PlatformAction;
|
|
169
|
+
declare const AuthGetUser: PlatformAction<{
|
|
151
170
|
id: string;
|
|
152
171
|
}>;
|
|
153
|
-
declare const AuthSignOff:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
workspaceId?: string;
|
|
157
|
-
authorization?: string;
|
|
158
|
-
baseUrl: string;
|
|
159
|
-
static of(config: SDKConfig): SDK;
|
|
160
|
-
constructor(config: SDKConfig);
|
|
161
|
-
updateConfig(intendedConfig: SDKConfig): void;
|
|
162
|
-
get apiTokens(): {
|
|
163
|
-
list: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
164
|
-
create: (_payload?: Required<{
|
|
165
|
-
name: string;
|
|
166
|
-
description: string;
|
|
167
|
-
expiresAt: string;
|
|
168
|
-
} | undefined>) => Promise<any>;
|
|
169
|
-
invalidate: (_payload?: Required<{
|
|
170
|
-
id: string;
|
|
171
|
-
} | undefined>) => Promise<any>;
|
|
172
|
-
};
|
|
173
|
-
get workspaces(): {
|
|
174
|
-
current: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
175
|
-
list: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
176
|
-
get: (_payload?: Required<{
|
|
177
|
-
id: string;
|
|
178
|
-
} | undefined>) => Promise<any>;
|
|
179
|
-
create: (_payload?: Required<{
|
|
180
|
-
name: string;
|
|
181
|
-
} | undefined>) => Promise<any>;
|
|
182
|
-
importResourceTemplates: (_payload?: Required<{
|
|
183
|
-
templates: any;
|
|
184
|
-
} | undefined>) => Promise<any>;
|
|
185
|
-
getResourceTemplates: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
186
|
-
createApiToken: (_payload?: Required<{
|
|
187
|
-
description: string;
|
|
188
|
-
} | undefined>) => Promise<any>;
|
|
189
|
-
getApiTokens: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
190
|
-
inviteUser: (_payload?: Required<{
|
|
191
|
-
email: string;
|
|
192
|
-
} | undefined>) => Promise<any>;
|
|
193
|
-
enableService: (_payload?: Required<{
|
|
194
|
-
service: any;
|
|
195
|
-
} | undefined>) => Promise<any>;
|
|
196
|
-
disableService: (_payload?: Required<{
|
|
197
|
-
service: any;
|
|
198
|
-
} | undefined>) => Promise<any>;
|
|
199
|
-
};
|
|
200
|
-
get users(): {
|
|
201
|
-
list: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
202
|
-
addWorkspace: (_payload?: Required<{
|
|
203
|
-
userId: string;
|
|
204
|
-
workspaceId: string;
|
|
205
|
-
createdBy?: string;
|
|
206
|
-
} | undefined>) => Promise<any>;
|
|
207
|
-
removeWorkspace: (_payload?: Required<{
|
|
208
|
-
userId: string;
|
|
209
|
-
workspaceId: string;
|
|
210
|
-
} | undefined>) => Promise<any>;
|
|
211
|
-
};
|
|
212
|
-
get currentUser(): {
|
|
213
|
-
get: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
214
|
-
update: (_payload?: Required<{
|
|
215
|
-
user: any;
|
|
216
|
-
} | undefined>) => Promise<any>;
|
|
217
|
-
history: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
218
|
-
};
|
|
219
|
-
get resources(): {
|
|
220
|
-
createDirectory: (_payload?: Required<{
|
|
221
|
-
type?: "directory";
|
|
222
|
-
location: string;
|
|
223
|
-
name: string;
|
|
224
|
-
} | undefined>) => Promise<any>;
|
|
225
|
-
create: (_payload?: Required<{
|
|
226
|
-
type: string;
|
|
227
|
-
location: string;
|
|
228
|
-
name: string;
|
|
229
|
-
content?: any;
|
|
230
|
-
} | undefined>) => Promise<any>;
|
|
231
|
-
access: (_payload?: Required<{
|
|
232
|
-
id: string;
|
|
233
|
-
access: "restricted" | "public";
|
|
234
|
-
} | undefined>) => Promise<any>;
|
|
235
|
-
upload: ({ location, file }: {
|
|
236
|
-
location: string;
|
|
237
|
-
file: File;
|
|
238
|
-
}) => Promise<any>;
|
|
239
|
-
uploadNamedVersion: ({ id, name, file }: {
|
|
240
|
-
id: string;
|
|
241
|
-
name: string;
|
|
242
|
-
file: File;
|
|
243
|
-
}) => void;
|
|
244
|
-
get: (_payload?: Required<{
|
|
245
|
-
id: string;
|
|
246
|
-
} | undefined>) => Promise<any>;
|
|
247
|
-
list: (query: ({
|
|
248
|
-
location?: string;
|
|
249
|
-
})) => Promise<any>;
|
|
250
|
-
search: (_payload?: Required<Record<string, unknown> | undefined>) => Promise<any>;
|
|
251
|
-
remove: (_payload?: Required<{
|
|
252
|
-
id: string;
|
|
253
|
-
} | undefined>) => Promise<any>;
|
|
254
|
-
updateContent: (_payload?: Required<{
|
|
255
|
-
id: string;
|
|
256
|
-
content: any;
|
|
257
|
-
} | undefined>) => Promise<any>;
|
|
258
|
-
move: (_payload?: Required<{
|
|
259
|
-
id: string;
|
|
260
|
-
target: string;
|
|
261
|
-
} | undefined>) => Promise<any>;
|
|
262
|
-
rename: (_payload?: Required<{
|
|
263
|
-
id: string;
|
|
264
|
-
name: string;
|
|
265
|
-
} | undefined>) => Promise<any>;
|
|
266
|
-
};
|
|
267
|
-
get auth(): {
|
|
268
|
-
signUp: (_payload?: Required<{
|
|
269
|
-
email: string;
|
|
270
|
-
firstName: string;
|
|
271
|
-
lastName: string;
|
|
272
|
-
} | undefined>) => Promise<any>;
|
|
273
|
-
signIn: (_payload?: Required<{
|
|
274
|
-
email: string;
|
|
275
|
-
} | undefined>) => Promise<any>;
|
|
276
|
-
verifySignIn: (_payload?: Required<{
|
|
277
|
-
token: string;
|
|
278
|
-
} | undefined>) => Promise<any>;
|
|
279
|
-
verifyInvitation: (_payload?: Required<{
|
|
280
|
-
workspaceId: string;
|
|
281
|
-
token: string;
|
|
282
|
-
} | undefined>) => Promise<any>;
|
|
283
|
-
getAuthenticatedUser: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
284
|
-
getAuthenticatedUserHistory: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
285
|
-
getUser: (_payload?: Required<{
|
|
286
|
-
id: string;
|
|
287
|
-
} | undefined>) => Promise<any>;
|
|
288
|
-
signOff: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
289
|
-
};
|
|
290
|
-
get tasks(): TasksClient;
|
|
291
|
-
makeRequest: <T extends Action>(action: T) => (_payload?: Required<T["payload"]>) => Promise<any>;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Unified interface for all SDK adapters.
|
|
296
|
-
*
|
|
297
|
-
* Adapters translate the generic `dispatch` / `query` calls into
|
|
298
|
-
* concrete operations — direct MongoDB writes (EventStoreAdapter),
|
|
299
|
-
* HTTP calls (HttpAdapter), or an in-memory store (InMemoryAdapter).
|
|
300
|
-
*
|
|
301
|
-
* Action names follow the pattern `{domain}/{verb}`, e.g.:
|
|
302
|
-
* - `workspaces/create`
|
|
303
|
-
* - `resources/create`
|
|
304
|
-
* - `user/join-workspace`
|
|
305
|
-
*
|
|
306
|
-
* Query names follow the same pattern, e.g.:
|
|
307
|
-
* - `workspaces/list`
|
|
308
|
-
* - `resources/list`
|
|
309
|
-
* - `resources/search`
|
|
310
|
-
*/
|
|
311
|
-
interface OssySdkAdapter {
|
|
312
|
-
/**
|
|
313
|
-
* Dispatch a write action. Returns the resulting entity/resource,
|
|
314
|
-
* or null for fire-and-forget operations.
|
|
315
|
-
*/
|
|
316
|
-
dispatch(action: string, payload: Record<string, unknown>): Promise<unknown>;
|
|
317
|
-
/**
|
|
318
|
-
* Execute a read query. Returns the matching data.
|
|
319
|
-
*/
|
|
320
|
-
query(name: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
321
|
-
}
|
|
172
|
+
declare const AuthSignOff: PlatformAction;
|
|
173
|
+
/** @deprecated Use `PlatformAction`. */
|
|
174
|
+
type RestAction<TPayload = Record<string, unknown>> = PlatformAction<TPayload>;
|
|
322
175
|
|
|
323
|
-
export { ApiTokenCreate, ApiTokenGetAll, ApiTokenInvalidate, AuthGetAuthenticatedUser, AuthGetAuthenticatedUserHistory, AuthGetUser, AuthSignIn, AuthSignOff, AuthSignUp, AuthVerifyInvitation, AuthVerifySignIn, ResourceUpdateAccess, ResourcesCreate, ResourcesCreateDirectory, ResourcesGet, ResourcesList, ResourcesMove, ResourcesRemove, ResourcesRename, ResourcesSearch, ResourcesUpdateContent, ResourcesUpload, ResourcesUploadNamedVersion, SDK, UserCurrentGet, UserCurrentGetHistory, UserCurrentUpdate, WorkspacesAddMember, WorkspacesCreate, WorkspacesCreateApiToken, WorkspacesDisableService, WorkspacesEnableService, WorkspacesGet, WorkspacesGetApiTokens, WorkspacesGetCurrent, WorkspacesGetResourceTemplates, WorkspacesGetUsers, WorkspacesImportResourceTemplates, WorkspacesInviteUser, WorkspacesList, WorkspacesRemoveMember };
|
|
324
|
-
export type {
|
|
176
|
+
export { ApiTokenCreate, ApiTokenGetAll, ApiTokenInvalidate, AuthGetAuthenticatedUser, AuthGetAuthenticatedUserHistory, AuthGetUser, AuthSignIn, AuthSignOff, AuthSignUp, AuthVerifyInvitation, AuthVerifySignIn, ResourceUpdateAccess, ResourcesCreate, ResourcesCreateDirectory, ResourcesGet, ResourcesList, ResourcesMove, ResourcesRemove, ResourcesRename, ResourcesSearch, ResourcesUpdateContent, ResourcesUpload, ResourcesUploadNamedVersion, SDK, UserCurrentGet, UserCurrentGetHistory, UserCurrentUpdate, WorkspacesAddMember, WorkspacesCreate, WorkspacesCreateApiToken, WorkspacesDisableService, WorkspacesEnableService, WorkspacesGet, WorkspacesGetApiTokens, WorkspacesGetCurrent, WorkspacesGetResourceTemplates, WorkspacesGetUsers, WorkspacesImportResourceTemplates, WorkspacesInviteUser, WorkspacesList, WorkspacesRemoveMember, resolveActionId };
|
|
177
|
+
export type { ActionRef, PlatformAction, RestAction };
|
package/build/public.index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={VisualContentDescriptors:"@ossy/tasks/visual-content-descriptors",ResizeCommonWeb:"@ossy/tasks/resize-common-web"},
|
|
1
|
+
const e={VisualContentDescriptors:"@ossy/tasks/visual-content-descriptors",ResizeCommonWeb:"@ossy/tasks/resize-common-web"},s={Queued:"queued",InProgress:"in progress",Success:"success",Failed:"failed"},t={id:"users/get-api-tokens"},i={id:"users/create-api-token"},r={id:"users/invalidate-api-token"},o={id:"workspaces/list"},a={id:"workspaces/get"},n={id:"workspaces/get"},c={id:"workspaces/create"},d={id:"workspaces/import-resource-templates"},u={id:"workspaces/get-resource-templates"},p={id:"workspaces/create-api-token"},h={id:"workspaces/get-api-tokens"},l={id:"workspaces/invite-user"},k={id:"workspaces/enable-service"},g={id:"workspaces/disable-service"},m={id:"workspaces/get-users"},w={id:"users/join-workspace"},y={id:"workspaces/remove-member"},b={id:"authentication/get-current-user"},v={id:"users/get-current-user-history"},f={id:"users/update-details"},j={id:"resources/create",payload:{type:"directory"}},z={id:"resources/create"},U={id:"resources/create"},P={id:"resources/upload-named-version"},I={id:"resources/get"},O={id:"resources/list"},T={id:"resources/search"},C={id:"resources/update-access"},S={id:"resources/delete"},R={id:"resources/update-content"},A={id:"resources/update-location"},q={id:"resources/update-name"},N={id:"authentication/sign-up"},V={id:"authentication/request-sign-in"},$={id:"authentication/verify-sign-in"},x={id:"workspaces/accept-invitation"},D={id:"authentication/get-current-user"},F={id:"users/get-current-user-history"},J={id:"authentication/get-current-user"},L={id:"authentication/sign-out"};function Q(e){const s="string"==typeof e?e:e.id;return s.includes(".")?s.replace(/\./g,"/"):s}class W{static of(e){return new W(e)}constructor(e){this.baseUrl="https://api.ossy.se/api/v0",this.invoke=(e,s)=>this.invokePlatformAction(Q(e),s),this.invokePlatformAction=(e,s)=>{const t={method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,payload:null!=s?s:{}})};this.workspaceId&&(t.headers=Object.assign(Object.assign({},t.headers),{workspaceId:this.workspaceId})),this.authorization&&(t.headers=Object.assign(Object.assign({},t.headers),{Authorization:this.authorization}));const i=this.baseUrl.replace(/\/api\/v0\/?$/,"");return fetch(i?`${i}/actions`:"/actions",t).then(this.handleResponse)},this.handleResponse=e=>{const s=e.headers.get("Content-Type")||"",t=e.status;return 400===t?e.json().then(e=>Promise.reject(e.error)):[200,204].includes(t)?s.includes("application/json")?e.json():e:Promise.reject(e)},this.updateConfig(e)}updateConfig(e){this.baseUrl=e.apiUrl||this.baseUrl,this.workspaceId=e.workspaceId||this.workspaceId,this.authorization=e.authorization||this.authorization}get resources(){return{upload:({location:e="/",file:s})=>{const t={type:s.type,location:e,name:s.name,size:s.size};return this.invoke(U,t).then(e=>fetch(e.content.uploadUrl,{method:"PUT",body:s}).then(()=>e))},list:e=>{const s=new URLSearchParams(Object.assign({},e)).toString();return this.invoke(O,{search:s})},uploadNamedVersion:({id:e,name:s,file:t})=>{const i={id:e,name:s,size:t.size};return this.invoke(P,i).then(e=>fetch(e.content.uploadUrl,{method:"PUT",body:t}).then(()=>e))}}}}export{i as ApiTokenCreate,t as ApiTokenGetAll,r as ApiTokenInvalidate,D as AuthGetAuthenticatedUser,F as AuthGetAuthenticatedUserHistory,J as AuthGetUser,V as AuthSignIn,L as AuthSignOff,N as AuthSignUp,x as AuthVerifyInvitation,$ as AuthVerifySignIn,C as ResourceUpdateAccess,z as ResourcesCreate,j as ResourcesCreateDirectory,I as ResourcesGet,O as ResourcesList,A as ResourcesMove,S as ResourcesRemove,q as ResourcesRename,T as ResourcesSearch,R as ResourcesUpdateContent,U as ResourcesUpload,P as ResourcesUploadNamedVersion,W as SDK,s as TaskStatus,e as Tasks,b as UserCurrentGet,v as UserCurrentGetHistory,f as UserCurrentUpdate,w as WorkspacesAddMember,c as WorkspacesCreate,p as WorkspacesCreateApiToken,g as WorkspacesDisableService,k as WorkspacesEnableService,n as WorkspacesGet,h as WorkspacesGetApiTokens,a as WorkspacesGetCurrent,u as WorkspacesGetResourceTemplates,m as WorkspacesGetUsers,d as WorkspacesImportResourceTemplates,l as WorkspacesInviteUser,o as WorkspacesList,y as WorkspacesRemoveMember,Q as resolveActionId};
|
package/build/types/Actions.d.ts
CHANGED
|
@@ -1,120 +1,132 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import type { ActionAccess } from '@ossy/types';
|
|
2
|
+
/** Platform action POJO for CLI discovery and `sdk.invoke` action refs. */
|
|
3
|
+
export interface PlatformAction<TPayload = Record<string, unknown>> {
|
|
4
|
+
id: string;
|
|
5
|
+
payload?: Partial<TPayload>;
|
|
6
|
+
access?: ActionAccess;
|
|
7
|
+
}
|
|
8
|
+
export type { ActionAccess };
|
|
9
|
+
export declare const ApiTokenGetAll: PlatformAction;
|
|
10
|
+
export declare const ApiTokenCreate: PlatformAction<{
|
|
5
11
|
name: string;
|
|
6
12
|
description: string;
|
|
7
13
|
expiresAt: string;
|
|
8
14
|
}>;
|
|
9
|
-
export declare const ApiTokenInvalidate:
|
|
10
|
-
|
|
15
|
+
export declare const ApiTokenInvalidate: PlatformAction<{
|
|
16
|
+
tokenId: string;
|
|
11
17
|
}>;
|
|
12
|
-
export declare const WorkspacesList:
|
|
13
|
-
export declare const WorkspacesGetCurrent:
|
|
14
|
-
export declare const WorkspacesGet:
|
|
15
|
-
|
|
18
|
+
export declare const WorkspacesList: PlatformAction;
|
|
19
|
+
export declare const WorkspacesGetCurrent: PlatformAction;
|
|
20
|
+
export declare const WorkspacesGet: PlatformAction<{
|
|
21
|
+
workspaceId: string;
|
|
16
22
|
}>;
|
|
17
|
-
export declare const WorkspacesCreate:
|
|
23
|
+
export declare const WorkspacesCreate: PlatformAction<{
|
|
18
24
|
name: string;
|
|
19
25
|
}>;
|
|
20
|
-
export declare const WorkspacesImportResourceTemplates:
|
|
21
|
-
templates:
|
|
26
|
+
export declare const WorkspacesImportResourceTemplates: PlatformAction<{
|
|
27
|
+
templates: unknown[];
|
|
22
28
|
}>;
|
|
23
|
-
export declare const WorkspacesGetResourceTemplates:
|
|
24
|
-
export declare const WorkspacesCreateApiToken:
|
|
29
|
+
export declare const WorkspacesGetResourceTemplates: PlatformAction;
|
|
30
|
+
export declare const WorkspacesCreateApiToken: PlatformAction<{
|
|
25
31
|
description: string;
|
|
26
32
|
}>;
|
|
27
|
-
export declare const WorkspacesGetApiTokens:
|
|
28
|
-
export declare const WorkspacesInviteUser:
|
|
33
|
+
export declare const WorkspacesGetApiTokens: PlatformAction;
|
|
34
|
+
export declare const WorkspacesInviteUser: PlatformAction<{
|
|
29
35
|
email: string;
|
|
30
36
|
}>;
|
|
31
|
-
export declare const WorkspacesEnableService:
|
|
32
|
-
service:
|
|
37
|
+
export declare const WorkspacesEnableService: PlatformAction<{
|
|
38
|
+
service: unknown;
|
|
33
39
|
}>;
|
|
34
|
-
export declare const WorkspacesDisableService:
|
|
35
|
-
service:
|
|
40
|
+
export declare const WorkspacesDisableService: PlatformAction<{
|
|
41
|
+
service: unknown;
|
|
36
42
|
}>;
|
|
37
|
-
export declare const WorkspacesGetUsers:
|
|
38
|
-
export declare const WorkspacesAddMember:
|
|
43
|
+
export declare const WorkspacesGetUsers: PlatformAction;
|
|
44
|
+
export declare const WorkspacesAddMember: PlatformAction<{
|
|
39
45
|
userId: string;
|
|
40
46
|
workspaceId: string;
|
|
41
47
|
createdBy?: string;
|
|
42
48
|
}>;
|
|
43
|
-
export declare const WorkspacesRemoveMember:
|
|
49
|
+
export declare const WorkspacesRemoveMember: PlatformAction<{
|
|
44
50
|
userId: string;
|
|
45
51
|
workspaceId: string;
|
|
46
52
|
}>;
|
|
47
|
-
export declare const UserCurrentGet:
|
|
48
|
-
export declare const UserCurrentGetHistory:
|
|
49
|
-
export declare const UserCurrentUpdate:
|
|
50
|
-
|
|
53
|
+
export declare const UserCurrentGet: PlatformAction;
|
|
54
|
+
export declare const UserCurrentGetHistory: PlatformAction;
|
|
55
|
+
export declare const UserCurrentUpdate: PlatformAction<{
|
|
56
|
+
firstName?: string;
|
|
57
|
+
lastName?: string;
|
|
58
|
+
email?: string;
|
|
51
59
|
}>;
|
|
52
|
-
export declare const ResourcesCreateDirectory:
|
|
60
|
+
export declare const ResourcesCreateDirectory: PlatformAction<{
|
|
53
61
|
type?: 'directory';
|
|
54
62
|
location: string;
|
|
55
63
|
name: string;
|
|
56
64
|
}>;
|
|
57
|
-
export declare const ResourcesCreate:
|
|
65
|
+
export declare const ResourcesCreate: PlatformAction<{
|
|
58
66
|
type: string;
|
|
59
67
|
location: string;
|
|
60
68
|
name: string;
|
|
61
|
-
content?:
|
|
69
|
+
content?: unknown;
|
|
62
70
|
}>;
|
|
63
|
-
export declare const ResourcesUpload:
|
|
71
|
+
export declare const ResourcesUpload: PlatformAction<{
|
|
64
72
|
location: string;
|
|
65
73
|
type: string;
|
|
66
74
|
name: string;
|
|
67
75
|
size: number;
|
|
68
76
|
}>;
|
|
69
|
-
export declare const ResourcesUploadNamedVersion:
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
export declare const ResourcesUploadNamedVersion: PlatformAction<{
|
|
78
|
+
resourceId: string;
|
|
79
|
+
namedVersion: string;
|
|
80
|
+
type: string;
|
|
72
81
|
size: number;
|
|
73
82
|
}>;
|
|
74
|
-
export declare const ResourcesGet:
|
|
75
|
-
|
|
83
|
+
export declare const ResourcesGet: PlatformAction<{
|
|
84
|
+
resourceId: string;
|
|
76
85
|
}>;
|
|
77
|
-
export declare const ResourcesList:
|
|
78
|
-
|
|
86
|
+
export declare const ResourcesList: PlatformAction<{
|
|
87
|
+
location?: string;
|
|
88
|
+
query?: Record<string, unknown>;
|
|
79
89
|
}>;
|
|
80
|
-
export declare const ResourcesSearch:
|
|
81
|
-
export declare const ResourceUpdateAccess:
|
|
82
|
-
|
|
90
|
+
export declare const ResourcesSearch: PlatformAction<Record<string, unknown>>;
|
|
91
|
+
export declare const ResourceUpdateAccess: PlatformAction<{
|
|
92
|
+
resourceId: string;
|
|
83
93
|
access: 'restricted' | 'public';
|
|
84
94
|
}>;
|
|
85
|
-
export declare const ResourcesRemove:
|
|
86
|
-
|
|
95
|
+
export declare const ResourcesRemove: PlatformAction<{
|
|
96
|
+
resourceId: string;
|
|
87
97
|
}>;
|
|
88
|
-
export declare const ResourcesUpdateContent:
|
|
89
|
-
|
|
90
|
-
content:
|
|
98
|
+
export declare const ResourcesUpdateContent: PlatformAction<{
|
|
99
|
+
resourceId: string;
|
|
100
|
+
content: unknown;
|
|
91
101
|
}>;
|
|
92
|
-
export declare const ResourcesMove:
|
|
93
|
-
|
|
102
|
+
export declare const ResourcesMove: PlatformAction<{
|
|
103
|
+
resourceId: string;
|
|
94
104
|
target: string;
|
|
95
105
|
}>;
|
|
96
|
-
export declare const ResourcesRename:
|
|
97
|
-
|
|
106
|
+
export declare const ResourcesRename: PlatformAction<{
|
|
107
|
+
resourceId: string;
|
|
98
108
|
name: string;
|
|
99
109
|
}>;
|
|
100
|
-
export declare const AuthSignUp:
|
|
110
|
+
export declare const AuthSignUp: PlatformAction<{
|
|
101
111
|
email: string;
|
|
102
112
|
firstName: string;
|
|
103
113
|
lastName: string;
|
|
104
114
|
}>;
|
|
105
|
-
export declare const AuthSignIn:
|
|
115
|
+
export declare const AuthSignIn: PlatformAction<{
|
|
106
116
|
email: string;
|
|
107
117
|
}>;
|
|
108
|
-
export declare const AuthVerifySignIn:
|
|
118
|
+
export declare const AuthVerifySignIn: PlatformAction<{
|
|
109
119
|
token: string;
|
|
110
120
|
}>;
|
|
111
|
-
export declare const AuthVerifyInvitation:
|
|
121
|
+
export declare const AuthVerifyInvitation: PlatformAction<{
|
|
112
122
|
workspaceId: string;
|
|
113
123
|
token: string;
|
|
114
124
|
}>;
|
|
115
|
-
export declare const AuthGetAuthenticatedUser:
|
|
116
|
-
export declare const AuthGetAuthenticatedUserHistory:
|
|
117
|
-
export declare const AuthGetUser:
|
|
125
|
+
export declare const AuthGetAuthenticatedUser: PlatformAction;
|
|
126
|
+
export declare const AuthGetAuthenticatedUserHistory: PlatformAction;
|
|
127
|
+
export declare const AuthGetUser: PlatformAction<{
|
|
118
128
|
id: string;
|
|
119
129
|
}>;
|
|
120
|
-
export declare const AuthSignOff:
|
|
130
|
+
export declare const AuthSignOff: PlatformAction;
|
|
131
|
+
/** @deprecated Use `PlatformAction`. */
|
|
132
|
+
export type RestAction<TPayload = Record<string, unknown>> = PlatformAction<TPayload>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Action } from '@ossy/types';
|
|
2
|
+
export type ActionRef = Action | string;
|
|
3
|
+
export declare function isActionRef(value: unknown): value is ActionRef;
|
|
4
|
+
/** Normalize dot aliases to slash ids (`resources.list` → `resources/list`). */
|
|
5
|
+
export declare function resolveActionId(action: ActionRef): string;
|
package/build/types/sdk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Action } from './Actions';
|
|
2
1
|
import { SDKConfig } from './config';
|
|
3
|
-
import {
|
|
2
|
+
import { resolveActionId, type ActionRef } from './platform-action';
|
|
3
|
+
export { resolveActionId, type ActionRef };
|
|
4
4
|
export declare class SDK {
|
|
5
5
|
workspaceId?: string;
|
|
6
6
|
authorization?: string;
|
|
@@ -8,134 +8,30 @@ export declare class SDK {
|
|
|
8
8
|
static of(config: SDKConfig): SDK;
|
|
9
9
|
constructor(config: SDKConfig);
|
|
10
10
|
updateConfig(intendedConfig: SDKConfig): void;
|
|
11
|
-
|
|
12
|
-
list: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
13
|
-
create: (_payload?: Required<{
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
expiresAt: string;
|
|
17
|
-
} | undefined>) => Promise<any>;
|
|
18
|
-
invalidate: (_payload?: Required<{
|
|
19
|
-
id: string;
|
|
20
|
-
} | undefined>) => Promise<any>;
|
|
21
|
-
};
|
|
22
|
-
get workspaces(): {
|
|
23
|
-
current: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
24
|
-
list: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
25
|
-
get: (_payload?: Required<{
|
|
26
|
-
id: string;
|
|
27
|
-
} | undefined>) => Promise<any>;
|
|
28
|
-
create: (_payload?: Required<{
|
|
29
|
-
name: string;
|
|
30
|
-
} | undefined>) => Promise<any>;
|
|
31
|
-
importResourceTemplates: (_payload?: Required<{
|
|
32
|
-
templates: any;
|
|
33
|
-
} | undefined>) => Promise<any>;
|
|
34
|
-
getResourceTemplates: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
35
|
-
createApiToken: (_payload?: Required<{
|
|
36
|
-
description: string;
|
|
37
|
-
} | undefined>) => Promise<any>;
|
|
38
|
-
getApiTokens: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
39
|
-
inviteUser: (_payload?: Required<{
|
|
40
|
-
email: string;
|
|
41
|
-
} | undefined>) => Promise<any>;
|
|
42
|
-
enableService: (_payload?: Required<{
|
|
43
|
-
service: any;
|
|
44
|
-
} | undefined>) => Promise<any>;
|
|
45
|
-
disableService: (_payload?: Required<{
|
|
46
|
-
service: any;
|
|
47
|
-
} | undefined>) => Promise<any>;
|
|
48
|
-
};
|
|
49
|
-
get users(): {
|
|
50
|
-
list: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
51
|
-
addWorkspace: (_payload?: Required<{
|
|
52
|
-
userId: string;
|
|
53
|
-
workspaceId: string;
|
|
54
|
-
createdBy?: string;
|
|
55
|
-
} | undefined>) => Promise<any>;
|
|
56
|
-
removeWorkspace: (_payload?: Required<{
|
|
57
|
-
userId: string;
|
|
58
|
-
workspaceId: string;
|
|
59
|
-
} | undefined>) => Promise<any>;
|
|
60
|
-
};
|
|
61
|
-
get currentUser(): {
|
|
62
|
-
get: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
63
|
-
update: (_payload?: Required<{
|
|
64
|
-
user: any;
|
|
65
|
-
} | undefined>) => Promise<any>;
|
|
66
|
-
history: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
67
|
-
};
|
|
11
|
+
/** @deprecated Use `invoke(action, payload)` instead. */
|
|
68
12
|
get resources(): {
|
|
69
|
-
createDirectory: (_payload?: Required<{
|
|
70
|
-
type?: "directory";
|
|
71
|
-
location: string;
|
|
72
|
-
name: string;
|
|
73
|
-
} | undefined>) => Promise<any>;
|
|
74
|
-
create: (_payload?: Required<{
|
|
75
|
-
type: string;
|
|
76
|
-
location: string;
|
|
77
|
-
name: string;
|
|
78
|
-
content?: any;
|
|
79
|
-
} | undefined>) => Promise<any>;
|
|
80
|
-
access: (_payload?: Required<{
|
|
81
|
-
id: string;
|
|
82
|
-
access: "restricted" | "public";
|
|
83
|
-
} | undefined>) => Promise<any>;
|
|
84
13
|
upload: ({ location, file }: {
|
|
85
14
|
location: string;
|
|
86
15
|
file: File;
|
|
87
|
-
}) => Promise<
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
content: {
|
|
18
|
+
uploadUrl: string;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
list: (query: {
|
|
22
|
+
location?: string;
|
|
23
|
+
}) => Promise<unknown>;
|
|
88
24
|
uploadNamedVersion: ({ id, name, file }: {
|
|
89
25
|
id: string;
|
|
90
26
|
name: string;
|
|
91
27
|
file: File;
|
|
92
|
-
}) =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
location?: string;
|
|
98
|
-
})) => Promise<any>;
|
|
99
|
-
search: (_payload?: Required<Record<string, unknown> | undefined>) => Promise<any>;
|
|
100
|
-
remove: (_payload?: Required<{
|
|
101
|
-
id: string;
|
|
102
|
-
} | undefined>) => Promise<any>;
|
|
103
|
-
updateContent: (_payload?: Required<{
|
|
104
|
-
id: string;
|
|
105
|
-
content: any;
|
|
106
|
-
} | undefined>) => Promise<any>;
|
|
107
|
-
move: (_payload?: Required<{
|
|
108
|
-
id: string;
|
|
109
|
-
target: string;
|
|
110
|
-
} | undefined>) => Promise<any>;
|
|
111
|
-
rename: (_payload?: Required<{
|
|
112
|
-
id: string;
|
|
113
|
-
name: string;
|
|
114
|
-
} | undefined>) => Promise<any>;
|
|
115
|
-
};
|
|
116
|
-
get auth(): {
|
|
117
|
-
signUp: (_payload?: Required<{
|
|
118
|
-
email: string;
|
|
119
|
-
firstName: string;
|
|
120
|
-
lastName: string;
|
|
121
|
-
} | undefined>) => Promise<any>;
|
|
122
|
-
signIn: (_payload?: Required<{
|
|
123
|
-
email: string;
|
|
124
|
-
} | undefined>) => Promise<any>;
|
|
125
|
-
verifySignIn: (_payload?: Required<{
|
|
126
|
-
token: string;
|
|
127
|
-
} | undefined>) => Promise<any>;
|
|
128
|
-
verifyInvitation: (_payload?: Required<{
|
|
129
|
-
workspaceId: string;
|
|
130
|
-
token: string;
|
|
131
|
-
} | undefined>) => Promise<any>;
|
|
132
|
-
getAuthenticatedUser: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
133
|
-
getAuthenticatedUserHistory: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
134
|
-
getUser: (_payload?: Required<{
|
|
135
|
-
id: string;
|
|
136
|
-
} | undefined>) => Promise<any>;
|
|
137
|
-
signOff: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
content: {
|
|
30
|
+
uploadUrl: string;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
138
33
|
};
|
|
139
|
-
|
|
140
|
-
|
|
34
|
+
invoke: <TPayload extends Record<string, unknown> = Record<string, unknown>, TResult = unknown>(action: ActionRef, payload?: TPayload) => Promise<TResult>;
|
|
35
|
+
invokePlatformAction: (actionId: string, payload?: Record<string, unknown>) => Promise<any>;
|
|
36
|
+
handleResponse: (response: Response) => Response | Promise<any>;
|
|
141
37
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/sdk",
|
|
3
3
|
"description": "Software Development Kit for interacting with our services",
|
|
4
|
-
"version": "1.40.
|
|
4
|
+
"version": "1.40.2",
|
|
5
5
|
"url": "git://github.com/ossy-se/packages/sdk",
|
|
6
6
|
"source": "src/public.index.ts",
|
|
7
7
|
"main": "build/public.index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ossy/types": "^1.40.
|
|
24
|
+
"@ossy/types": "^1.40.2"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"start": "",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"/build",
|
|
37
37
|
"README.md"
|
|
38
38
|
],
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "2b8745d57fee8b6c08787e2755b4df489291a5cd"
|
|
40
40
|
}
|
package/build/types/adapter.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified interface for all SDK adapters.
|
|
3
|
-
*
|
|
4
|
-
* Adapters translate the generic `dispatch` / `query` calls into
|
|
5
|
-
* concrete operations — direct MongoDB writes (EventStoreAdapter),
|
|
6
|
-
* HTTP calls (HttpAdapter), or an in-memory store (InMemoryAdapter).
|
|
7
|
-
*
|
|
8
|
-
* Action names follow the pattern `{domain}/{verb}`, e.g.:
|
|
9
|
-
* - `workspaces/create`
|
|
10
|
-
* - `resources/create`
|
|
11
|
-
* - `user/join-workspace`
|
|
12
|
-
*
|
|
13
|
-
* Query names follow the same pattern, e.g.:
|
|
14
|
-
* - `workspaces/list`
|
|
15
|
-
* - `resources/list`
|
|
16
|
-
* - `resources/search`
|
|
17
|
-
*/
|
|
18
|
-
export interface OssySdkAdapter {
|
|
19
|
-
/**
|
|
20
|
-
* Dispatch a write action. Returns the resulting entity/resource,
|
|
21
|
-
* or null for fire-and-forget operations.
|
|
22
|
-
*/
|
|
23
|
-
dispatch(action: string, payload: Record<string, unknown>): Promise<unknown>;
|
|
24
|
-
/**
|
|
25
|
-
* Execute a read query. Returns the matching data.
|
|
26
|
-
*/
|
|
27
|
-
query(name: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
28
|
-
}
|