@synap-core/sdk 0.1.0 → 0.2.0
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/dist/client.d.ts +44 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +48 -11
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +25 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -6
- package/dist/index.js.map +1 -1
- package/dist/resources/entities.d.ts +3 -54
- package/dist/resources/entities.d.ts.map +1 -1
- package/dist/resources/preferences.d.ts +24 -0
- package/dist/resources/preferences.d.ts.map +1 -0
- package/dist/resources/preferences.js +30 -0
- package/dist/resources/preferences.js.map +1 -0
- package/dist/resources/views.d.ts +43 -0
- package/dist/resources/views.d.ts.map +1 -0
- package/dist/resources/views.js +54 -0
- package/dist/resources/views.js.map +1 -0
- package/dist/resources/workspaces.d.ts +50 -0
- package/dist/resources/workspaces.d.ts.map +1 -0
- package/dist/resources/workspaces.js +66 -0
- package/dist/resources/workspaces.js.map +1 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* Provides high-level APIs for interacting with Synap Data Pod.
|
|
5
5
|
* All mutations go through event sourcing, all queries are direct reads.
|
|
6
6
|
*/
|
|
7
|
-
import { type SynapClient as
|
|
7
|
+
import { type SynapClient as ClientType } from '@synap-core/client';
|
|
8
8
|
import { EntitiesAPI } from './resources/entities.js';
|
|
9
9
|
import { RelationsAPI } from './resources/relations.js';
|
|
10
10
|
import { EventsAPI } from './resources/events.js';
|
|
11
|
+
import { WorkspacesAPI } from './resources/workspaces.js';
|
|
12
|
+
import { ViewsAPI } from './resources/views.js';
|
|
13
|
+
import { PreferencesAPI } from './resources/preferences.js';
|
|
11
14
|
/**
|
|
12
15
|
* SDK Configuration
|
|
13
16
|
*/
|
|
@@ -31,6 +34,13 @@ export interface SynapSDKConfig {
|
|
|
31
34
|
* Custom fetch implementation (for React Native, etc.)
|
|
32
35
|
*/
|
|
33
36
|
fetch?: typeof globalThis.fetch;
|
|
37
|
+
/**
|
|
38
|
+
* Real-time configuration (optional)
|
|
39
|
+
*/
|
|
40
|
+
realtime?: {
|
|
41
|
+
userId: string;
|
|
42
|
+
userName: string;
|
|
43
|
+
};
|
|
34
44
|
}
|
|
35
45
|
/**
|
|
36
46
|
* Synap SDK - High-Level Client
|
|
@@ -39,29 +49,57 @@ export interface SynapSDKConfig {
|
|
|
39
49
|
* ```typescript
|
|
40
50
|
* const synap = new SynapSDK({
|
|
41
51
|
* url: 'https://api.synap.app',
|
|
42
|
-
* apiKey: 'sk_...'
|
|
52
|
+
* apiKey: 'sk_...',
|
|
53
|
+
* realtime: {
|
|
54
|
+
* userId: 'user-123',
|
|
55
|
+
* userName: 'Alice',
|
|
56
|
+
* },
|
|
43
57
|
* });
|
|
44
58
|
*
|
|
45
59
|
* // Use resource APIs
|
|
46
60
|
* const task = await synap.entities.create({ type: 'task', title: 'Call Marie' });
|
|
47
61
|
* await synap.relations.create(task.id, personId, 'assigned_to');
|
|
48
62
|
* const history = await synap.events.getHistory(task.id);
|
|
63
|
+
*
|
|
64
|
+
* // Workspaces
|
|
65
|
+
* const workspace = await synap.workspaces.create({ name: 'Team Workspace' });
|
|
66
|
+
*
|
|
67
|
+
* // Views
|
|
68
|
+
* const whiteboard = await synap.views.create({
|
|
69
|
+
* type: 'whiteboard',
|
|
70
|
+
* name: 'Brainstorm',
|
|
71
|
+
* workspaceId: workspace.id
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* // Real-time collaboration
|
|
75
|
+
* synap.realtime?.connectPresence(whiteboard.id);
|
|
76
|
+
* const ydoc = synap.realtime?.connectYjs(whiteboard.id);
|
|
49
77
|
* ```
|
|
50
78
|
*/
|
|
51
79
|
export declare class SynapSDK {
|
|
52
|
-
/** Internal
|
|
53
|
-
private readonly
|
|
80
|
+
/** Internal client */
|
|
81
|
+
private readonly _client;
|
|
54
82
|
/** Entities API - Generic entity operations */
|
|
55
83
|
readonly entities: EntitiesAPI;
|
|
56
84
|
/** Relations API - Relationship management */
|
|
57
85
|
readonly relations: RelationsAPI;
|
|
58
86
|
/** Events API - Event history and replay */
|
|
59
87
|
readonly events: EventsAPI;
|
|
88
|
+
/** Workspaces API - Multi-user workspace management (V3.0) */
|
|
89
|
+
readonly workspaces: WorkspacesAPI;
|
|
90
|
+
/** Views API - Whiteboards, timelines, kanban boards (V3.0) */
|
|
91
|
+
readonly views: ViewsAPI;
|
|
92
|
+
/** Preferences API - User preferences (V3.0) */
|
|
93
|
+
readonly preferences: PreferencesAPI;
|
|
60
94
|
constructor(config: SynapSDKConfig);
|
|
61
95
|
/**
|
|
62
|
-
* Get direct access to underlying
|
|
96
|
+
* Get direct access to underlying client
|
|
63
97
|
* Use this for advanced operations not covered by SDK APIs
|
|
64
98
|
*/
|
|
65
|
-
get client():
|
|
99
|
+
get client(): ClientType;
|
|
100
|
+
/**
|
|
101
|
+
* Get real-time client for WebSocket features
|
|
102
|
+
*/
|
|
103
|
+
get realtime(): import("@synap-core/client").RealtimeClient | null;
|
|
66
104
|
}
|
|
67
105
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,WAAW,IAAI,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,WAAW,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAA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4,13 @@
|
|
|
4
4
|
* Provides high-level APIs for interacting with Synap Data Pod.
|
|
5
5
|
* All mutations go through event sourcing, all queries are direct reads.
|
|
6
6
|
*/
|
|
7
|
-
import { createSynapClient } from '@synap/client';
|
|
7
|
+
import { createSynapClient } from '@synap-core/client';
|
|
8
8
|
import { EntitiesAPI } from './resources/entities.js';
|
|
9
9
|
import { RelationsAPI } from './resources/relations.js';
|
|
10
10
|
import { EventsAPI } from './resources/events.js';
|
|
11
|
+
import { WorkspacesAPI } from './resources/workspaces.js';
|
|
12
|
+
import { ViewsAPI } from './resources/views.js';
|
|
13
|
+
import { PreferencesAPI } from './resources/preferences.js';
|
|
11
14
|
/**
|
|
12
15
|
* Synap SDK - High-Level Client
|
|
13
16
|
*
|
|
@@ -15,44 +18,78 @@ import { EventsAPI } from './resources/events.js';
|
|
|
15
18
|
* ```typescript
|
|
16
19
|
* const synap = new SynapSDK({
|
|
17
20
|
* url: 'https://api.synap.app',
|
|
18
|
-
* apiKey: 'sk_...'
|
|
21
|
+
* apiKey: 'sk_...',
|
|
22
|
+
* realtime: {
|
|
23
|
+
* userId: 'user-123',
|
|
24
|
+
* userName: 'Alice',
|
|
25
|
+
* },
|
|
19
26
|
* });
|
|
20
27
|
*
|
|
21
28
|
* // Use resource APIs
|
|
22
29
|
* const task = await synap.entities.create({ type: 'task', title: 'Call Marie' });
|
|
23
30
|
* await synap.relations.create(task.id, personId, 'assigned_to');
|
|
24
31
|
* const history = await synap.events.getHistory(task.id);
|
|
32
|
+
*
|
|
33
|
+
* // Workspaces
|
|
34
|
+
* const workspace = await synap.workspaces.create({ name: 'Team Workspace' });
|
|
35
|
+
*
|
|
36
|
+
* // Views
|
|
37
|
+
* const whiteboard = await synap.views.create({
|
|
38
|
+
* type: 'whiteboard',
|
|
39
|
+
* name: 'Brainstorm',
|
|
40
|
+
* workspaceId: workspace.id
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Real-time collaboration
|
|
44
|
+
* synap.realtime?.connectPresence(whiteboard.id);
|
|
45
|
+
* const ydoc = synap.realtime?.connectYjs(whiteboard.id);
|
|
25
46
|
* ```
|
|
26
47
|
*/
|
|
27
48
|
export class SynapSDK {
|
|
28
|
-
/** Internal
|
|
29
|
-
|
|
49
|
+
/** Internal client */
|
|
50
|
+
_client;
|
|
30
51
|
/** Entities API - Generic entity operations */
|
|
31
52
|
entities;
|
|
32
53
|
/** Relations API - Relationship management */
|
|
33
54
|
relations;
|
|
34
55
|
/** Events API - Event history and replay */
|
|
35
56
|
events;
|
|
57
|
+
/** Workspaces API - Multi-user workspace management (V3.0) */
|
|
58
|
+
workspaces;
|
|
59
|
+
/** Views API - Whiteboards, timelines, kanban boards (V3.0) */
|
|
60
|
+
views;
|
|
61
|
+
/** Preferences API - User preferences (V3.0) */
|
|
62
|
+
preferences;
|
|
36
63
|
constructor(config) {
|
|
37
|
-
// Create underlying
|
|
38
|
-
this.
|
|
64
|
+
// Create underlying client
|
|
65
|
+
this._client = createSynapClient({
|
|
39
66
|
url: config.url,
|
|
40
67
|
headers: config.apiKey
|
|
41
68
|
? { Authorization: `Bearer ${config.apiKey}` }
|
|
42
69
|
: config.headers,
|
|
43
70
|
fetch: config.fetch,
|
|
71
|
+
realtime: config.realtime,
|
|
44
72
|
});
|
|
45
73
|
// Initialize resource APIs
|
|
46
|
-
this.entities = new EntitiesAPI(this.
|
|
47
|
-
this.relations = new RelationsAPI(this.
|
|
48
|
-
this.events = new EventsAPI(this.
|
|
74
|
+
this.entities = new EntitiesAPI(this._client);
|
|
75
|
+
this.relations = new RelationsAPI(this._client);
|
|
76
|
+
this.events = new EventsAPI(this._client);
|
|
77
|
+
this.workspaces = new WorkspacesAPI(this._client);
|
|
78
|
+
this.views = new ViewsAPI(this._client);
|
|
79
|
+
this.preferences = new PreferencesAPI(this._client);
|
|
49
80
|
}
|
|
50
81
|
/**
|
|
51
|
-
* Get direct access to underlying
|
|
82
|
+
* Get direct access to underlying client
|
|
52
83
|
* Use this for advanced operations not covered by SDK APIs
|
|
53
84
|
*/
|
|
54
85
|
get client() {
|
|
55
|
-
return this.
|
|
86
|
+
return this._client;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get real-time client for WebSocket features
|
|
90
|
+
*/
|
|
91
|
+
get realtime() {
|
|
92
|
+
return this._client.realtime;
|
|
56
93
|
}
|
|
57
94
|
}
|
|
58
95
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAkC,MAAM,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAkC,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAsC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,QAAQ;IACnB,sBAAsB;IACL,OAAO,CAAa;IAErC,+CAA+C;IAC/B,QAAQ,CAAc;IAEtC,8CAA8C;IAC9B,SAAS,CAAe;IAExC,4CAA4C;IAC5B,MAAM,CAAY;IAElC,8DAA8D;IAC9C,UAAU,CAAgB;IAE1C,+DAA+D;IAC/C,KAAK,CAAW;IAEhC,gDAAgD;IAChC,WAAW,CAAiB;IAE5C,YAAY,MAAsB;QAChC,2BAA2B;QAC3B,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC;YAC/B,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,OAAO,EAAE,MAAM,CAAC,MAAM;gBACpB,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,EAAE;gBAC9C,CAAC,CAAC,MAAM,CAAC,OAAO;YAClB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;QAEH,2BAA2B;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*
|
|
10
10
|
* const synap = new SynapSDK({
|
|
11
11
|
* url: 'https://api.synap.app',
|
|
12
|
-
* apiKey: 'your-api-key'
|
|
12
|
+
* apiKey: 'your-api-key',
|
|
13
|
+
* realtime: {
|
|
14
|
+
* userId: 'user-123',
|
|
15
|
+
* userName: 'Alice',
|
|
16
|
+
* },
|
|
13
17
|
* });
|
|
14
18
|
*
|
|
15
19
|
* // Create entity (event-sourced)
|
|
@@ -19,19 +23,33 @@
|
|
|
19
23
|
* metadata: { dueDate: '2024-12-20', priority: 'high' }
|
|
20
24
|
* });
|
|
21
25
|
*
|
|
22
|
-
* // Create
|
|
23
|
-
* await synap.
|
|
26
|
+
* // Create workspace
|
|
27
|
+
* const workspace = await synap.workspaces.create({ name: 'Team' });
|
|
24
28
|
*
|
|
25
|
-
* //
|
|
26
|
-
* const
|
|
27
|
-
*
|
|
29
|
+
* // Create whiteboard
|
|
30
|
+
* const board = await synap.views.create({
|
|
31
|
+
* type: 'whiteboard',
|
|
32
|
+
* name: 'Brainstorm',
|
|
33
|
+
* workspaceId: workspace.id,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Real-time collaboration
|
|
37
|
+
* synap.realtime?.connectPresence(board.id);
|
|
38
|
+
* const ydoc = synap.realtime?.connectYjs(board.id);
|
|
28
39
|
* ```
|
|
29
40
|
*/
|
|
30
41
|
export { SynapSDK, type SynapSDKConfig } from './client.js';
|
|
31
42
|
export { EntitiesAPI } from './resources/entities.js';
|
|
32
43
|
export { RelationsAPI } from './resources/relations.js';
|
|
33
44
|
export { EventsAPI } from './resources/events.js';
|
|
34
|
-
export
|
|
45
|
+
export { WorkspacesAPI } from './resources/workspaces.js';
|
|
46
|
+
export { ViewsAPI } from './resources/views.js';
|
|
47
|
+
export { PreferencesAPI } from './resources/preferences.js';
|
|
48
|
+
export type { EntityType, EntityMetadata, Entity, NewEntity, UpdateEntity, } from '@synap-core/types/entities';
|
|
49
|
+
export type { Workspace, WorkspaceMember, CreateWorkspaceInput, UpdateWorkspaceInput, } from '@synap-core/types/workspaces';
|
|
50
|
+
export type { View, CreateViewInput, UpdateViewInput, } from '@synap-core/types/views';
|
|
51
|
+
export type { UserPreferences, UpdatePreferencesInput, } from '@synap-core/types/preferences';
|
|
52
|
+
export type { UserPresence, YDoc, } from '@synap-core/types/realtime';
|
|
35
53
|
export type { Relation, RelationType, } from './types/relations.js';
|
|
36
54
|
export type { Event, EventFilter, } from './types/events.js';
|
|
37
55
|
//# 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":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,YAAY,EACV,UAAU,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,IAAI,EACJ,eAAe,EACf,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,eAAe,EACf,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EACV,YAAY,EACZ,IAAI,GACL,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,QAAQ,EACR,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,KAAK,EACL,WAAW,GACZ,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*
|
|
10
10
|
* const synap = new SynapSDK({
|
|
11
11
|
* url: 'https://api.synap.app',
|
|
12
|
-
* apiKey: 'your-api-key'
|
|
12
|
+
* apiKey: 'your-api-key',
|
|
13
|
+
* realtime: {
|
|
14
|
+
* userId: 'user-123',
|
|
15
|
+
* userName: 'Alice',
|
|
16
|
+
* },
|
|
13
17
|
* });
|
|
14
18
|
*
|
|
15
19
|
* // Create entity (event-sourced)
|
|
@@ -19,16 +23,26 @@
|
|
|
19
23
|
* metadata: { dueDate: '2024-12-20', priority: 'high' }
|
|
20
24
|
* });
|
|
21
25
|
*
|
|
22
|
-
* // Create
|
|
23
|
-
* await synap.
|
|
26
|
+
* // Create workspace
|
|
27
|
+
* const workspace = await synap.workspaces.create({ name: 'Team' });
|
|
24
28
|
*
|
|
25
|
-
* //
|
|
26
|
-
* const
|
|
27
|
-
*
|
|
29
|
+
* // Create whiteboard
|
|
30
|
+
* const board = await synap.views.create({
|
|
31
|
+
* type: 'whiteboard',
|
|
32
|
+
* name: 'Brainstorm',
|
|
33
|
+
* workspaceId: workspace.id,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Real-time collaboration
|
|
37
|
+
* synap.realtime?.connectPresence(board.id);
|
|
38
|
+
* const ydoc = synap.realtime?.connectYjs(board.id);
|
|
28
39
|
* ```
|
|
29
40
|
*/
|
|
30
41
|
export { SynapSDK } from './client.js';
|
|
31
42
|
export { EntitiesAPI } from './resources/entities.js';
|
|
32
43
|
export { RelationsAPI } from './resources/relations.js';
|
|
33
44
|
export { EventsAPI } from './resources/events.js';
|
|
45
|
+
export { WorkspacesAPI } from './resources/workspaces.js';
|
|
46
|
+
export { ViewsAPI } from './resources/views.js';
|
|
47
|
+
export { PreferencesAPI } from './resources/preferences.js';
|
|
34
48
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,QAAQ,EAAuB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -77,65 +77,14 @@ export declare class EntitiesAPI {
|
|
|
77
77
|
/**
|
|
78
78
|
* Get entity by ID (direct read)
|
|
79
79
|
*/
|
|
80
|
-
get(id: string): Promise<
|
|
81
|
-
type: string;
|
|
82
|
-
userId: string;
|
|
83
|
-
version: number;
|
|
84
|
-
id: string;
|
|
85
|
-
title: string | null;
|
|
86
|
-
preview: string | null;
|
|
87
|
-
documentId: string | null;
|
|
88
|
-
fileUrl: string | null;
|
|
89
|
-
filePath: string | null;
|
|
90
|
-
fileSize: number | null;
|
|
91
|
-
fileType: string | null;
|
|
92
|
-
checksum: string | null;
|
|
93
|
-
createdAt: string;
|
|
94
|
-
updatedAt: string;
|
|
95
|
-
deletedAt: string | null;
|
|
96
|
-
metadata?: unknown;
|
|
97
|
-
}>;
|
|
80
|
+
get(id: string): Promise<any>;
|
|
98
81
|
/**
|
|
99
82
|
* List entities (direct read)
|
|
100
83
|
*/
|
|
101
|
-
list(options?: ListEntitiesOptions): Promise<
|
|
102
|
-
type: string;
|
|
103
|
-
userId: string;
|
|
104
|
-
version: number;
|
|
105
|
-
id: string;
|
|
106
|
-
title: string | null;
|
|
107
|
-
preview: string | null;
|
|
108
|
-
documentId: string | null;
|
|
109
|
-
fileUrl: string | null;
|
|
110
|
-
filePath: string | null;
|
|
111
|
-
fileSize: number | null;
|
|
112
|
-
fileType: string | null;
|
|
113
|
-
checksum: string | null;
|
|
114
|
-
createdAt: string;
|
|
115
|
-
updatedAt: string;
|
|
116
|
-
deletedAt: string | null;
|
|
117
|
-
metadata?: unknown;
|
|
118
|
-
}[]>;
|
|
84
|
+
list(options?: ListEntitiesOptions): Promise<any>;
|
|
119
85
|
/**
|
|
120
86
|
* Search entities (direct read)
|
|
121
87
|
*/
|
|
122
|
-
search(options: SearchOptions): Promise<
|
|
123
|
-
type: string;
|
|
124
|
-
userId: string;
|
|
125
|
-
version: number;
|
|
126
|
-
id: string;
|
|
127
|
-
title: string | null;
|
|
128
|
-
preview: string | null;
|
|
129
|
-
documentId: string | null;
|
|
130
|
-
fileUrl: string | null;
|
|
131
|
-
filePath: string | null;
|
|
132
|
-
fileSize: number | null;
|
|
133
|
-
fileType: string | null;
|
|
134
|
-
checksum: string | null;
|
|
135
|
-
createdAt: string;
|
|
136
|
-
updatedAt: string;
|
|
137
|
-
deletedAt: string | null;
|
|
138
|
-
metadata?: unknown;
|
|
139
|
-
}[]>;
|
|
88
|
+
search(options: SearchOptions): Promise<any>;
|
|
140
89
|
}
|
|
141
90
|
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/resources/entities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,UAAU,GAAG,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,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAiBjF;;;;OAIG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAgBvD;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM;IAKpB;;OAEG;IACG,IAAI,CAAC,OAAO,GAAE,mBAAwB;IAQ5C;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa;CAQpC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preferences API - User preferences management
|
|
3
|
+
*
|
|
4
|
+
* Provides user preference CRUD operations.
|
|
5
|
+
*/
|
|
6
|
+
import type { SynapClient } from '@synap-core/client';
|
|
7
|
+
import type { UserPreferences, UpdatePreferencesInput } from '@synap-core/types/preferences';
|
|
8
|
+
export declare class PreferencesAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: SynapClient);
|
|
11
|
+
/**
|
|
12
|
+
* Get current user preferences
|
|
13
|
+
*/
|
|
14
|
+
get(): Promise<UserPreferences>;
|
|
15
|
+
/**
|
|
16
|
+
* Update user preferences
|
|
17
|
+
*/
|
|
18
|
+
update(input: UpdatePreferencesInput): Promise<UserPreferences>;
|
|
19
|
+
/**
|
|
20
|
+
* Reset preferences to defaults
|
|
21
|
+
*/
|
|
22
|
+
reset(): Promise<UserPreferences>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/resources/preferences.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AAEvC,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;IAIrC;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIrE;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,eAAe,CAAC;CAGxC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preferences API - User preferences management
|
|
3
|
+
*
|
|
4
|
+
* Provides user preference CRUD operations.
|
|
5
|
+
*/
|
|
6
|
+
export class PreferencesAPI {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get current user preferences
|
|
13
|
+
*/
|
|
14
|
+
async get() {
|
|
15
|
+
return this.client.trpc.preferences.get.query();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Update user preferences
|
|
19
|
+
*/
|
|
20
|
+
async update(input) {
|
|
21
|
+
return this.client.trpc.preferences.update.mutate(input);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reset preferences to defaults
|
|
25
|
+
*/
|
|
26
|
+
async reset() {
|
|
27
|
+
return this.client.trpc.preferences.reset.mutate();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/resources/preferences.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAA6B;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Views API - High-level view management
|
|
3
|
+
*
|
|
4
|
+
* Provides view CRUD operations for whiteboards, timelines, etc.
|
|
5
|
+
*/
|
|
6
|
+
import type { SynapClient } from '@synap-core/client';
|
|
7
|
+
import type { View, CreateViewInput, UpdateViewInput } from '@synap-core/types/views';
|
|
8
|
+
export declare class ViewsAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: SynapClient);
|
|
11
|
+
/**
|
|
12
|
+
* List all views
|
|
13
|
+
*/
|
|
14
|
+
list(options?: {
|
|
15
|
+
workspaceId?: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Get a specific view
|
|
20
|
+
*/
|
|
21
|
+
get(id: string): Promise<View>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new view
|
|
24
|
+
*/
|
|
25
|
+
create(input: CreateViewInput): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Update view metadata
|
|
28
|
+
*/
|
|
29
|
+
update(id: string, input: UpdateViewInput): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Save view content (manual save)
|
|
32
|
+
*/
|
|
33
|
+
save(id: string, content: unknown): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Delete a view
|
|
36
|
+
*/
|
|
37
|
+
delete(id: string): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Get view content
|
|
40
|
+
*/
|
|
41
|
+
getContent(id: string): Promise<any>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=views.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/resources/views.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,IAAI,EACJ,eAAe,EACf,eAAe,EAEhB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;OAEG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAI5D;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,eAAe;IAInC;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAI/C;;OAEG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAIvC;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM;IAIvB;;OAEG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Views API - High-level view management
|
|
3
|
+
*
|
|
4
|
+
* Provides view CRUD operations for whiteboards, timelines, etc.
|
|
5
|
+
*/
|
|
6
|
+
export class ViewsAPI {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List all views
|
|
13
|
+
*/
|
|
14
|
+
async list(options) {
|
|
15
|
+
return this.client.trpc.views.list.query(options);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get a specific view
|
|
19
|
+
*/
|
|
20
|
+
async get(id) {
|
|
21
|
+
return this.client.trpc.views.get.query({ id });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a new view
|
|
25
|
+
*/
|
|
26
|
+
async create(input) {
|
|
27
|
+
return this.client.trpc.views.create.mutate(input);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Update view metadata
|
|
31
|
+
*/
|
|
32
|
+
async update(id, input) {
|
|
33
|
+
return this.client.trpc.views.update.mutate({ id, ...input });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Save view content (manual save)
|
|
37
|
+
*/
|
|
38
|
+
async save(id, content) {
|
|
39
|
+
return this.client.trpc.views.save.mutate({ id, content });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Delete a view
|
|
43
|
+
*/
|
|
44
|
+
async delete(id) {
|
|
45
|
+
return this.client.trpc.views.delete.mutate({ id });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get view content
|
|
49
|
+
*/
|
|
50
|
+
async getContent(id) {
|
|
51
|
+
return this.client.trpc.views.getContent.query({ id });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.js","sourceRoot":"","sources":["../../src/resources/views.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,MAAM,OAAO,QAAQ;IACC;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,OAAiD;QAC1D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC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
|
+
* Provides workspace CRUD operations and member management.
|
|
5
|
+
*/
|
|
6
|
+
import type { SynapClient } from '@synap-core/client';
|
|
7
|
+
import type { Workspace, WorkspaceMember, CreateWorkspaceInput, UpdateWorkspaceInput, InviteMemberInput } from '@synap-core/types/workspaces';
|
|
8
|
+
export declare class WorkspacesAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: SynapClient);
|
|
11
|
+
/**
|
|
12
|
+
* List all workspaces the user has access to
|
|
13
|
+
*/
|
|
14
|
+
list(): Promise<Workspace[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a specific workspace
|
|
17
|
+
*/
|
|
18
|
+
get(id: string): Promise<Workspace>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new workspace
|
|
21
|
+
*/
|
|
22
|
+
create(input: CreateWorkspaceInput): Promise<Workspace>;
|
|
23
|
+
/**
|
|
24
|
+
* Update workspace details
|
|
25
|
+
*/
|
|
26
|
+
update(id: string, input: UpdateWorkspaceInput): Promise<Workspace>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete a workspace
|
|
29
|
+
*/
|
|
30
|
+
delete(id: string): Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* List workspace members
|
|
35
|
+
*/
|
|
36
|
+
listMembers(workspaceId: string): Promise<WorkspaceMember[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Invite a member to workspace
|
|
39
|
+
*/
|
|
40
|
+
invite(input: InviteMemberInput): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Remove a member from workspace
|
|
43
|
+
*/
|
|
44
|
+
removeMember(workspaceId: string, userId: string): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Accept an invitation
|
|
47
|
+
*/
|
|
48
|
+
acceptInvite(token: string): Promise<any>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/resources/workspaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAIlC;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAIzC;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;IAI7D;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;IAIzE;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAIvD;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAIlE;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,iBAAiB;IAIrC;;OAEG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAItD;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM;CAGjC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspaces API - High-level workspace management
|
|
3
|
+
*
|
|
4
|
+
* Provides workspace CRUD operations and member management.
|
|
5
|
+
*/
|
|
6
|
+
export class WorkspacesAPI {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List all workspaces the user has access to
|
|
13
|
+
*/
|
|
14
|
+
async list() {
|
|
15
|
+
return this.client.trpc.workspaces.list.query();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get a specific workspace
|
|
19
|
+
*/
|
|
20
|
+
async get(id) {
|
|
21
|
+
return this.client.trpc.workspaces.get.query({ id });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a new workspace
|
|
25
|
+
*/
|
|
26
|
+
async create(input) {
|
|
27
|
+
return this.client.trpc.workspaces.create.mutate(input);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Update workspace details
|
|
31
|
+
*/
|
|
32
|
+
async update(id, input) {
|
|
33
|
+
return this.client.trpc.workspaces.update.mutate({ id, ...input });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Delete a workspace
|
|
37
|
+
*/
|
|
38
|
+
async delete(id) {
|
|
39
|
+
return this.client.trpc.workspaces.delete.mutate({ id });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* List workspace members
|
|
43
|
+
*/
|
|
44
|
+
async listMembers(workspaceId) {
|
|
45
|
+
return this.client.trpc.workspaces.listMembers.query({ workspaceId });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Invite a member to workspace
|
|
49
|
+
*/
|
|
50
|
+
async invite(input) {
|
|
51
|
+
return this.client.trpc.workspaces.createInvite.mutate(input);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Remove a member from workspace
|
|
55
|
+
*/
|
|
56
|
+
async removeMember(workspaceId, userId) {
|
|
57
|
+
return this.client.trpc.workspaces.removeMember.mutate({ workspaceId, userId });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Accept an invitation
|
|
61
|
+
*/
|
|
62
|
+
async acceptInvite(token) {
|
|
63
|
+
return this.client.trpc.workspaces.acceptInvite.mutate({ token });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../src/resources/workspaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAA2B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAA2B;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,WAAmB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC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