@ossy/sdk 1.40.0 → 1.40.1

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 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 React hooks (`useResource`, `useResources`) and wrap your app in `WorkspaceProvider`:
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 { SDK } from '@ossy/sdk'
77
- import { WorkspaceProvider } from '@ossy/sdk-react'
76
+ import { ReactSdk, WorkspaceProvider } from '@ossy/sdk-react'
77
+ import { AuthenticationProvider } from '@ossy/authentication'
78
78
 
79
- const sdk = SDK.of({ workspaceId: 'your-workspace-id' })
79
+ const sdk = ReactSdk.of({ workspaceId: 'your-workspace-id' })
80
80
 
81
81
  export const App = () => (
82
82
  <WorkspaceProvider sdk={sdk}>
83
- <YourApp />
83
+ <AuthenticationProvider>
84
+ <YourApp />
85
+ </AuthenticationProvider>
84
86
  </WorkspaceProvider>
85
87
  )
86
88
  ```
87
89
 
88
- See [@ossy/sdk-react README](../sdk-react/README.md) for hook usage.
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
+ ```
@@ -1,324 +1,177 @@
1
- import { Resource, Task, TaskType, Action, SDKConfig } from '@ossy/types';
1
+ import { Action, SDKConfig, ActionAccess } from '@ossy/types';
2
2
  export * from '@ossy/types';
3
- export { Action, TaskStatus, Tasks } from '@ossy/types';
3
+ export { ActionAccess, TaskStatus, Tasks } from '@ossy/types';
4
4
 
5
- interface ResourcesClient {
6
- search: (payload: Record<string, unknown>) => Promise<Resource<Task>[]>;
7
- create: (data: {
8
- type: string;
9
- location: string;
10
- name: string;
11
- content: {
12
- resourceId: string;
13
- status: string;
14
- result: undefined;
15
- };
16
- }) => Promise<Resource<Task>>;
17
- }
18
- interface TasksClientConfig {
19
- http?: unknown;
20
- resources: ResourcesClient;
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
- declare class TasksClient {
23
- static location: string;
24
- private http?;
25
- private resources;
26
- static of(config: TasksClientConfig): TasksClient;
27
- constructor(config: TasksClientConfig);
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: Action;
37
- declare const ApiTokenCreate: Action<{
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: Action<{
43
- id: string;
57
+ declare const ApiTokenInvalidate: PlatformAction<{
58
+ tokenId: string;
44
59
  }>;
45
- declare const WorkspacesList: Action;
46
- declare const WorkspacesGetCurrent: Action;
47
- declare const WorkspacesGet: Action<{
48
- id: string;
60
+ declare const WorkspacesList: PlatformAction;
61
+ declare const WorkspacesGetCurrent: PlatformAction;
62
+ declare const WorkspacesGet: PlatformAction<{
63
+ workspaceId: string;
49
64
  }>;
50
- declare const WorkspacesCreate: Action<{
65
+ declare const WorkspacesCreate: PlatformAction<{
51
66
  name: string;
52
67
  }>;
53
- declare const WorkspacesImportResourceTemplates: Action<{
54
- templates: any;
68
+ declare const WorkspacesImportResourceTemplates: PlatformAction<{
69
+ templates: unknown[];
55
70
  }>;
56
- declare const WorkspacesGetResourceTemplates: Action;
57
- declare const WorkspacesCreateApiToken: Action<{
71
+ declare const WorkspacesGetResourceTemplates: PlatformAction;
72
+ declare const WorkspacesCreateApiToken: PlatformAction<{
58
73
  description: string;
59
74
  }>;
60
- declare const WorkspacesGetApiTokens: Action;
61
- declare const WorkspacesInviteUser: Action<{
75
+ declare const WorkspacesGetApiTokens: PlatformAction;
76
+ declare const WorkspacesInviteUser: PlatformAction<{
62
77
  email: string;
63
78
  }>;
64
- declare const WorkspacesEnableService: Action<{
65
- service: any;
79
+ declare const WorkspacesEnableService: PlatformAction<{
80
+ service: unknown;
66
81
  }>;
67
- declare const WorkspacesDisableService: Action<{
68
- service: any;
82
+ declare const WorkspacesDisableService: PlatformAction<{
83
+ service: unknown;
69
84
  }>;
70
- declare const WorkspacesGetUsers: Action;
71
- declare const WorkspacesAddMember: Action<{
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: Action<{
91
+ declare const WorkspacesRemoveMember: PlatformAction<{
77
92
  userId: string;
78
93
  workspaceId: string;
79
94
  }>;
80
- declare const UserCurrentGet: Action;
81
- declare const UserCurrentGetHistory: Action;
82
- declare const UserCurrentUpdate: Action<{
83
- user: any;
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: Action<{
102
+ declare const ResourcesCreateDirectory: PlatformAction<{
86
103
  type?: 'directory';
87
104
  location: string;
88
105
  name: string;
89
106
  }>;
90
- declare const ResourcesCreate: Action<{
107
+ declare const ResourcesCreate: PlatformAction<{
91
108
  type: string;
92
109
  location: string;
93
110
  name: string;
94
- content?: any;
111
+ content?: unknown;
95
112
  }>;
96
- declare const ResourcesUpload: Action<{
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: Action<{
103
- id: string;
104
- name: string;
119
+ declare const ResourcesUploadNamedVersion: PlatformAction<{
120
+ resourceId: string;
121
+ namedVersion: string;
122
+ type: string;
105
123
  size: number;
106
124
  }>;
107
- declare const ResourcesGet: Action<{
108
- id: string;
125
+ declare const ResourcesGet: PlatformAction<{
126
+ resourceId: string;
109
127
  }>;
110
- declare const ResourcesList: Action<{
111
- search?: string;
128
+ declare const ResourcesList: PlatformAction<{
129
+ location?: string;
130
+ query?: Record<string, unknown>;
112
131
  }>;
113
- declare const ResourcesSearch: Action<Record<string, unknown>>;
114
- declare const ResourceUpdateAccess: Action<{
115
- id: string;
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: Action<{
119
- id: string;
137
+ declare const ResourcesRemove: PlatformAction<{
138
+ resourceId: string;
120
139
  }>;
121
- declare const ResourcesUpdateContent: Action<{
122
- id: string;
123
- content: any;
140
+ declare const ResourcesUpdateContent: PlatformAction<{
141
+ resourceId: string;
142
+ content: unknown;
124
143
  }>;
125
- declare const ResourcesMove: Action<{
126
- id: string;
144
+ declare const ResourcesMove: PlatformAction<{
145
+ resourceId: string;
127
146
  target: string;
128
147
  }>;
129
- declare const ResourcesRename: Action<{
130
- id: string;
148
+ declare const ResourcesRename: PlatformAction<{
149
+ resourceId: string;
131
150
  name: string;
132
151
  }>;
133
- declare const AuthSignUp: Action<{
152
+ declare const AuthSignUp: PlatformAction<{
134
153
  email: string;
135
154
  firstName: string;
136
155
  lastName: string;
137
156
  }>;
138
- declare const AuthSignIn: Action<{
157
+ declare const AuthSignIn: PlatformAction<{
139
158
  email: string;
140
159
  }>;
141
- declare const AuthVerifySignIn: Action<{
160
+ declare const AuthVerifySignIn: PlatformAction<{
142
161
  token: string;
143
162
  }>;
144
- declare const AuthVerifyInvitation: Action<{
163
+ declare const AuthVerifyInvitation: PlatformAction<{
145
164
  workspaceId: string;
146
165
  token: string;
147
166
  }>;
148
- declare const AuthGetAuthenticatedUser: Action;
149
- declare const AuthGetAuthenticatedUserHistory: Action;
150
- declare const AuthGetUser: Action<{
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: Action;
154
-
155
- declare class SDK {
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 { OssySdkAdapter };
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 };
@@ -1 +1 @@
1
- const e={VisualContentDescriptors:"@ossy/tasks/visual-content-descriptors",ResizeCommonWeb:"@ossy/tasks/resize-common-web"},t={Queued:"queued",InProgress:"in progress",Success:"success",Failed:"failed"};class s{static of(e){return new s(e)}constructor(e){this.http=null==e?void 0:e.http,this.resources=e.resources}get(e={}){const t="string"==typeof e?{id:e}:e;return t.location=s.location,this.resources.search({query:t})}getUnprocessed(){return this.resources.search({$and:[{$or:[{"content.nextReevaluation":{$exists:!1}},{"content.nextReevaluation":null},{"content.nextReevaluation":{$lt:Date.now()}}]},{"content.status":{$in:["queued","failed"]}},{location:"/@ossy/tasks/"},{type:{$regex:"^@ossy/media-tasks"}}]})}create({type:i,resourceId:o}){if(!Object.values(e).includes(i))throw new Error(`Task type ${i} does not exist`);if(!o)throw new Error("Resource ID is required");return this.resources.create({type:i,location:s.location,name:`[${t.Queued}] ${o}`,content:{resourceId:o,status:t.Queued,result:void 0}})}}s.location="/@ossy/tasks/";const i={id:"api-tokens.get-all",endpoint:"/users/me/tokens",method:"GET"},o={id:"api-tokens.create",endpoint:"/users/me/tokens",method:"POST"},n={id:"api-tokens.invalidate",endpoint:"/users/me/tokens/:id",method:"DELETE"},r={id:"workspaces.get-all",endpoint:"/workspaces",method:"GET"},a={id:"workspaces.get-current",endpoint:"/workspaces/current",method:"GET"},d={id:"workspaces.get",endpoint:"/workspaces/:id",method:"GET"},u={id:"workspaces.create",endpoint:"/workspaces",method:"POST"},h={id:"workspaces.import-resource-templates",endpoint:"/resource-templates",method:"POST"},c={id:"workspaces.get-resource-templates",endpoint:"/resource-templates",method:"GET"},p={id:"workspaces.create-api-token",endpoint:"/tokens",method:"POST"},m={id:"workspaces.get-api-tokens",endpoint:"/tokens",method:"GET"},k={id:"workspaces.invite-user",endpoint:"/invitations",method:"POST"},l={id:"workspaces.enable-service",endpoint:"/services/enable",method:"POST"},b={id:"workspaces.disable-service",endpoint:"/services/disable",method:"POST"},g={id:"workspaces.get-users",endpoint:"/users",method:"GET"},T={id:"workspaces.add-member",endpoint:"/users/:userId/workspaces",method:"POST"},R={id:"workspaces.remove-member",endpoint:"/users/:userId/workspaces/:workspaceId",method:"DELETE"},q={id:"user.get",endpoint:"/users/me",method:"GET"},w={id:"user.get-history",endpoint:"/users/me/history",method:"GET"},y={id:"user.update",endpoint:"/users/me",method:"PUT"},v={id:"resources.create-directory",endpoint:"/resources",method:"POST",payload:{type:"directory"}},E={id:"resources.create",endpoint:"/resources",method:"POST"},f={id:"resources.upload",endpoint:"/resources",method:"POST"},P={id:"resources.upload-named-version",endpoint:"/resources/:id/:name",method:"PUT"},O={id:"resources.get",endpoint:"/resources/:id",method:"GET"},U={id:"resources.list",endpoint:"/resources?:search",method:"GET"},S={id:"resources.search",endpoint:"/resources/search",method:"POST"},G={id:"resources.update-access",endpoint:"/resources/:id/access",method:"PUT"},I={id:"resources.remove",endpoint:"/resources/:id",method:"DELETE"},j={id:"resources.update-content",endpoint:"/resources/:id/content",method:"PUT"},z={id:"resources.move",endpoint:"/resources/:id/location",method:"PUT"},$={id:"resources.rename",endpoint:"/resources/:id/name",method:"PUT"},x={id:"auth.sign-up",endpoint:"/users/sign-up",method:"POST"},C={id:"auth.sign-in",endpoint:"/users/sign-in",method:"POST"},D={id:"auth.verify-sign-in",endpoint:"/users/verify-sign-in?token=:token",method:"GET"},A={id:"auth.verify-invitation",endpoint:"/workspaces/:workspaceId/invitations?token=:token",method:"GET"},L={id:"auth.get-authenticated-user",endpoint:"/users/me",method:"GET"},Q={id:"auth.get-authenticated-user-history",endpoint:"/users/me/history",method:"GET"},W={id:"auth.get-user",endpoint:"/users/:id",method:"GET"},N={id:"auth.sign-off",endpoint:"/users/sign-off",method:"GET"};class V{static of(e){return new V(e)}constructor(e){this.baseUrl="https://api.ossy.se/api/v0",this.makeRequest=e=>t=>{let s={};(t||e.payload)&&(s=Object.assign(Object.assign({},e.payload||{}),t||{}));let i="apiUrl"in s?null==s?void 0:s.apiUrl:this.baseUrl,o="workspaceId"in s?s.workspaceId:this.workspaceId,n="authorization"in s?s.authorization:this.authorization,r=e.endpoint;if(s){const t=Object.keys(s);r=e.endpoint,r=t.reduce((e,t)=>e.replace(`:${t}`,`${s[t]}`),e.endpoint)}const a=`${i}${r}`,d={method:e.method,credentials:"include",headers:{"Content-Type":"application/json"}};return o&&(d.headers=Object.assign(Object.assign({},d.headers),{workspaceId:o})),n&&(d.headers=Object.assign(Object.assign({},d.headers),{Authorization:n})),"GET"!==d.method&&s&&(d.body=JSON.stringify(s)),fetch(a,d).then(e=>{const t=e.headers.get("Content-Type")||"",s=e.status;return 400===s?e.json().then(e=>Promise.reject(e.error)):[200,204].includes(s)?t.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 apiTokens(){return{list:this.makeRequest(i).bind(this),create:this.makeRequest(o).bind(this),invalidate:this.makeRequest(n).bind(this)}}get workspaces(){return{current:this.makeRequest(a).bind(this),list:this.makeRequest(r).bind(this),get:this.makeRequest(d).bind(this),create:this.makeRequest(u).bind(this),importResourceTemplates:this.makeRequest(h).bind(this),getResourceTemplates:this.makeRequest(c).bind(this),createApiToken:this.makeRequest(p).bind(this),getApiTokens:this.makeRequest(m).bind(this),inviteUser:this.makeRequest(k).bind(this),enableService:this.makeRequest(l).bind(this),disableService:this.makeRequest(b).bind(this)}}get users(){return{list:this.makeRequest(g).bind(this),addWorkspace:this.makeRequest(T).bind(this),removeWorkspace:this.makeRequest(R).bind(this)}}get currentUser(){return{get:this.makeRequest(q).bind(this),update:this.makeRequest(y).bind(this),history:this.makeRequest(w).bind(this)}}get resources(){return{createDirectory:this.makeRequest(v).bind(this),create:this.makeRequest(E).bind(this),access:this.makeRequest(G).bind(this),upload:({location:e="/",file:t})=>{const s={type:t.type,location:e,name:t.name,size:t.size};return this.makeRequest(f)(s).then(e=>fetch(e.content.uploadUrl,{method:"PUT",body:t}).then(()=>e))},uploadNamedVersion:({id:e,name:t,file:s})=>{const i={id:e,name:t,size:s.size};this.makeRequest(P)(i).then(e=>fetch(e.content.uploadUrl,{method:"PUT",body:s}).then(()=>e))},get:this.makeRequest(O).bind(this),list:e=>{const t=new URLSearchParams(Object.assign({},e)).toString();return this.makeRequest(U)({search:t})},search:this.makeRequest(S).bind(this),remove:this.makeRequest(I).bind(this),updateContent:this.makeRequest(j).bind(this),move:this.makeRequest(z).bind(this),rename:this.makeRequest($).bind(this)}}get auth(){return{signUp:this.makeRequest(x).bind(this),signIn:this.makeRequest(C).bind(this),verifySignIn:this.makeRequest(D).bind(this),verifyInvitation:this.makeRequest(A).bind(this),getAuthenticatedUser:this.makeRequest(L).bind(this),getAuthenticatedUserHistory:this.makeRequest(Q).bind(this),getUser:this.makeRequest(W).bind(this),signOff:this.makeRequest(N).bind(this)}}get tasks(){return s.of({resources:this.resources})}}export{o as ApiTokenCreate,i as ApiTokenGetAll,n as ApiTokenInvalidate,L as AuthGetAuthenticatedUser,Q as AuthGetAuthenticatedUserHistory,W as AuthGetUser,C as AuthSignIn,N as AuthSignOff,x as AuthSignUp,A as AuthVerifyInvitation,D as AuthVerifySignIn,G as ResourceUpdateAccess,E as ResourcesCreate,v as ResourcesCreateDirectory,O as ResourcesGet,U as ResourcesList,z as ResourcesMove,I as ResourcesRemove,$ as ResourcesRename,S as ResourcesSearch,j as ResourcesUpdateContent,f as ResourcesUpload,P as ResourcesUploadNamedVersion,V as SDK,t as TaskStatus,e as Tasks,q as UserCurrentGet,w as UserCurrentGetHistory,y as UserCurrentUpdate,T as WorkspacesAddMember,u as WorkspacesCreate,p as WorkspacesCreateApiToken,b as WorkspacesDisableService,l as WorkspacesEnableService,d as WorkspacesGet,m as WorkspacesGetApiTokens,a as WorkspacesGetCurrent,c as WorkspacesGetResourceTemplates,g as WorkspacesGetUsers,h as WorkspacesImportResourceTemplates,k as WorkspacesInviteUser,r as WorkspacesList,R as WorkspacesRemoveMember};
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};
@@ -1,120 +1,132 @@
1
- import type { Action } from '@ossy/types';
2
- export type { Action };
3
- export declare const ApiTokenGetAll: Action;
4
- export declare const ApiTokenCreate: Action<{
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: Action<{
10
- id: string;
15
+ export declare const ApiTokenInvalidate: PlatformAction<{
16
+ tokenId: string;
11
17
  }>;
12
- export declare const WorkspacesList: Action;
13
- export declare const WorkspacesGetCurrent: Action;
14
- export declare const WorkspacesGet: Action<{
15
- id: string;
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: Action<{
23
+ export declare const WorkspacesCreate: PlatformAction<{
18
24
  name: string;
19
25
  }>;
20
- export declare const WorkspacesImportResourceTemplates: Action<{
21
- templates: any;
26
+ export declare const WorkspacesImportResourceTemplates: PlatformAction<{
27
+ templates: unknown[];
22
28
  }>;
23
- export declare const WorkspacesGetResourceTemplates: Action;
24
- export declare const WorkspacesCreateApiToken: Action<{
29
+ export declare const WorkspacesGetResourceTemplates: PlatformAction;
30
+ export declare const WorkspacesCreateApiToken: PlatformAction<{
25
31
  description: string;
26
32
  }>;
27
- export declare const WorkspacesGetApiTokens: Action;
28
- export declare const WorkspacesInviteUser: Action<{
33
+ export declare const WorkspacesGetApiTokens: PlatformAction;
34
+ export declare const WorkspacesInviteUser: PlatformAction<{
29
35
  email: string;
30
36
  }>;
31
- export declare const WorkspacesEnableService: Action<{
32
- service: any;
37
+ export declare const WorkspacesEnableService: PlatformAction<{
38
+ service: unknown;
33
39
  }>;
34
- export declare const WorkspacesDisableService: Action<{
35
- service: any;
40
+ export declare const WorkspacesDisableService: PlatformAction<{
41
+ service: unknown;
36
42
  }>;
37
- export declare const WorkspacesGetUsers: Action;
38
- export declare const WorkspacesAddMember: Action<{
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: Action<{
49
+ export declare const WorkspacesRemoveMember: PlatformAction<{
44
50
  userId: string;
45
51
  workspaceId: string;
46
52
  }>;
47
- export declare const UserCurrentGet: Action;
48
- export declare const UserCurrentGetHistory: Action;
49
- export declare const UserCurrentUpdate: Action<{
50
- user: any;
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: Action<{
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: Action<{
65
+ export declare const ResourcesCreate: PlatformAction<{
58
66
  type: string;
59
67
  location: string;
60
68
  name: string;
61
- content?: any;
69
+ content?: unknown;
62
70
  }>;
63
- export declare const ResourcesUpload: Action<{
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: Action<{
70
- id: string;
71
- name: string;
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: Action<{
75
- id: string;
83
+ export declare const ResourcesGet: PlatformAction<{
84
+ resourceId: string;
76
85
  }>;
77
- export declare const ResourcesList: Action<{
78
- search?: string;
86
+ export declare const ResourcesList: PlatformAction<{
87
+ location?: string;
88
+ query?: Record<string, unknown>;
79
89
  }>;
80
- export declare const ResourcesSearch: Action<Record<string, unknown>>;
81
- export declare const ResourceUpdateAccess: Action<{
82
- id: string;
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: Action<{
86
- id: string;
95
+ export declare const ResourcesRemove: PlatformAction<{
96
+ resourceId: string;
87
97
  }>;
88
- export declare const ResourcesUpdateContent: Action<{
89
- id: string;
90
- content: any;
98
+ export declare const ResourcesUpdateContent: PlatformAction<{
99
+ resourceId: string;
100
+ content: unknown;
91
101
  }>;
92
- export declare const ResourcesMove: Action<{
93
- id: string;
102
+ export declare const ResourcesMove: PlatformAction<{
103
+ resourceId: string;
94
104
  target: string;
95
105
  }>;
96
- export declare const ResourcesRename: Action<{
97
- id: string;
106
+ export declare const ResourcesRename: PlatformAction<{
107
+ resourceId: string;
98
108
  name: string;
99
109
  }>;
100
- export declare const AuthSignUp: Action<{
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: Action<{
115
+ export declare const AuthSignIn: PlatformAction<{
106
116
  email: string;
107
117
  }>;
108
- export declare const AuthVerifySignIn: Action<{
118
+ export declare const AuthVerifySignIn: PlatformAction<{
109
119
  token: string;
110
120
  }>;
111
- export declare const AuthVerifyInvitation: Action<{
121
+ export declare const AuthVerifyInvitation: PlatformAction<{
112
122
  workspaceId: string;
113
123
  token: string;
114
124
  }>;
115
- export declare const AuthGetAuthenticatedUser: Action;
116
- export declare const AuthGetAuthenticatedUserHistory: Action;
117
- export declare const AuthGetUser: Action<{
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: Action;
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;
@@ -2,4 +2,3 @@ export { Tasks, TaskStatus } from './tasks-client.js';
2
2
  export * from '@ossy/types';
3
3
  export * from './sdk';
4
4
  export * from './Actions';
5
- export type { OssySdkAdapter } from './adapter.js';
@@ -1,6 +1,6 @@
1
- import { Action } from './Actions';
2
1
  import { SDKConfig } from './config';
3
- import { TasksClient } from './tasks-client';
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
- get apiTokens(): {
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<any>;
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
- }) => void;
93
- get: (_payload?: Required<{
94
- id: string;
95
- } | undefined>) => Promise<any>;
96
- list: (query: ({
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
- get tasks(): TasksClient;
140
- makeRequest: <T extends Action>(action: T) => (_payload?: Required<T["payload"]>) => Promise<any>;
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.0",
4
+ "version": "1.40.1",
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.0"
24
+ "@ossy/types": "^1.40.1"
25
25
  },
26
26
  "scripts": {
27
27
  "start": "",
@@ -36,5 +36,5 @@
36
36
  "/build",
37
37
  "README.md"
38
38
  ],
39
- "gitHead": "d9d31182be64a448d575da432af2830d909ad4b9"
39
+ "gitHead": "c0ba5d90749690634e4dc2705178ff8d89dd3070"
40
40
  }
@@ -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
- }