@synap-core/sdk 0.2.0 → 1.0.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/README.md +40 -140
- package/dist/index.cjs +115 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -0
- package/dist/index.d.ts +72 -47
- package/dist/index.js +80 -47
- package/dist/index.js.map +1 -1
- package/package.json +28 -24
- package/src/client.ts +193 -0
- package/src/index.ts +2 -0
- package/dist/client.d.ts +0 -105
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -95
- package/dist/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/resources/entities.d.ts +0 -90
- package/dist/resources/entities.d.ts.map +0 -1
- package/dist/resources/entities.js +0 -126
- package/dist/resources/entities.js.map +0 -1
- package/dist/resources/events.d.ts +0 -51
- package/dist/resources/events.d.ts.map +0 -1
- package/dist/resources/events.js +0 -92
- package/dist/resources/events.js.map +0 -1
- package/dist/resources/preferences.d.ts +0 -24
- package/dist/resources/preferences.d.ts.map +0 -1
- package/dist/resources/preferences.js +0 -30
- package/dist/resources/preferences.js.map +0 -1
- package/dist/resources/relations.d.ts +0 -71
- package/dist/resources/relations.d.ts.map +0 -1
- package/dist/resources/relations.js +0 -121
- package/dist/resources/relations.js.map +0 -1
- package/dist/resources/views.d.ts +0 -43
- package/dist/resources/views.d.ts.map +0 -1
- package/dist/resources/views.js +0 -54
- package/dist/resources/views.js.map +0 -1
- package/dist/resources/workspaces.d.ts +0 -50
- package/dist/resources/workspaces.d.ts.map +0 -1
- package/dist/resources/workspaces.js +0 -66
- package/dist/resources/workspaces.js.map +0 -1
- package/dist/types/events.d.ts +0 -24
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/events.js +0 -5
- package/dist/types/events.js.map +0 -1
- package/dist/types/relations.d.ts +0 -26
- package/dist/types/relations.d.ts.map +0 -1
- package/dist/types/relations.js +0 -5
- package/dist/types/relations.js.map +0 -1
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entities API - Generic Entity Operations
|
|
3
|
-
*
|
|
4
|
-
* ALL MUTATIONS are event-sourced (go through events.log)
|
|
5
|
-
* ALL QUERIES are direct reads (fast)
|
|
6
|
-
*/
|
|
7
|
-
import type { SynapClient } from '@synap/client';
|
|
8
|
-
import type { EntityType } from '@synap/types/entities';
|
|
9
|
-
export interface CreateEntityInput<T extends EntityType = EntityType> {
|
|
10
|
-
type: T;
|
|
11
|
-
title: string;
|
|
12
|
-
preview?: string;
|
|
13
|
-
content?: string;
|
|
14
|
-
metadata?: Record<string, unknown>;
|
|
15
|
-
}
|
|
16
|
-
export interface UpdateEntityInput {
|
|
17
|
-
title?: string;
|
|
18
|
-
preview?: string;
|
|
19
|
-
content?: string;
|
|
20
|
-
metadata?: Record<string, unknown>;
|
|
21
|
-
}
|
|
22
|
-
export interface ListEntitiesOptions {
|
|
23
|
-
type?: EntityType;
|
|
24
|
-
limit?: number;
|
|
25
|
-
}
|
|
26
|
-
export interface SearchOptions {
|
|
27
|
-
query: string;
|
|
28
|
-
types?: EntityType[];
|
|
29
|
-
limit?: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Entities API
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* // Create task (event-sourced)
|
|
37
|
-
* const task = await sdk.entities.create({
|
|
38
|
-
* type: 'task',
|
|
39
|
-
* title: 'Call Marie',
|
|
40
|
-
* metadata: { dueDate: '2024-12-20', priority: 'high' }
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* // Get entity (direct read)
|
|
44
|
-
* const entity = await sdk.entities.get(task.id);
|
|
45
|
-
*
|
|
46
|
-
* // List entities (direct read)
|
|
47
|
-
* const tasks = await sdk.entities.list({ type: 'task' });
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export declare class EntitiesAPI {
|
|
51
|
-
private readonly client;
|
|
52
|
-
constructor(client: SynapClient);
|
|
53
|
-
/**
|
|
54
|
-
* Create entity (event-sourced)
|
|
55
|
-
*
|
|
56
|
-
* Publishes `entities.create.requested` event → entitiesWorker → DB
|
|
57
|
-
*/
|
|
58
|
-
create<T extends EntityType>(input: CreateEntityInput<T>): Promise<{
|
|
59
|
-
entityId: string;
|
|
60
|
-
}>;
|
|
61
|
-
/**
|
|
62
|
-
* Update entity (event-sourced)
|
|
63
|
-
*
|
|
64
|
-
* Publishes `entities.update.requested` event → entitiesWorker → DB
|
|
65
|
-
*/
|
|
66
|
-
update(id: string, input: UpdateEntityInput): Promise<{
|
|
67
|
-
success: boolean;
|
|
68
|
-
}>;
|
|
69
|
-
/**
|
|
70
|
-
* Delete entity (event-sourced soft delete)
|
|
71
|
-
*
|
|
72
|
-
* Publishes `entities.delete.requested` event → entitiesWorker → DB
|
|
73
|
-
*/
|
|
74
|
-
delete(id: string): Promise<{
|
|
75
|
-
success: boolean;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Get entity by ID (direct read)
|
|
79
|
-
*/
|
|
80
|
-
get(id: string): Promise<any>;
|
|
81
|
-
/**
|
|
82
|
-
* List entities (direct read)
|
|
83
|
-
*/
|
|
84
|
-
list(options?: ListEntitiesOptions): Promise<any>;
|
|
85
|
-
/**
|
|
86
|
-
* Search entities (direct read)
|
|
87
|
-
*/
|
|
88
|
-
search(options: SearchOptions): Promise<any>;
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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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pB;;OAEG;IACG,IAAI,CAAC,OAAO,GAAE,mBAAwB;IAQ5C;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa;CAQpC"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entities API - Generic Entity Operations
|
|
3
|
-
*
|
|
4
|
-
* ALL MUTATIONS are event-sourced (go through events.log)
|
|
5
|
-
* ALL QUERIES are direct reads (fast)
|
|
6
|
-
*/
|
|
7
|
-
import { randomUUID } from 'node:crypto';
|
|
8
|
-
/**
|
|
9
|
-
* Entities API
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Create task (event-sourced)
|
|
14
|
-
* const task = await sdk.entities.create({
|
|
15
|
-
* type: 'task',
|
|
16
|
-
* title: 'Call Marie',
|
|
17
|
-
* metadata: { dueDate: '2024-12-20', priority: 'high' }
|
|
18
|
-
* });
|
|
19
|
-
*
|
|
20
|
-
* // Get entity (direct read)
|
|
21
|
-
* const entity = await sdk.entities.get(task.id);
|
|
22
|
-
*
|
|
23
|
-
* // List entities (direct read)
|
|
24
|
-
* const tasks = await sdk.entities.list({ type: 'task' });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export class EntitiesAPI {
|
|
28
|
-
client;
|
|
29
|
-
constructor(client) {
|
|
30
|
-
this.client = client;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Create entity (event-sourced)
|
|
34
|
-
*
|
|
35
|
-
* Publishes `entities.create.requested` event → entitiesWorker → DB
|
|
36
|
-
*/
|
|
37
|
-
async create(input) {
|
|
38
|
-
const entityId = randomUUID();
|
|
39
|
-
// Call events.log to publish create event
|
|
40
|
-
await this.client.events.log.mutate({
|
|
41
|
-
aggregateId: entityId,
|
|
42
|
-
aggregateType: 'entity',
|
|
43
|
-
eventType: 'entities.create.requested',
|
|
44
|
-
data: {
|
|
45
|
-
id: entityId,
|
|
46
|
-
entityType: input.type,
|
|
47
|
-
title: input.title,
|
|
48
|
-
preview: input.preview,
|
|
49
|
-
content: input.content,
|
|
50
|
-
metadata: input.metadata,
|
|
51
|
-
},
|
|
52
|
-
metadata: {},
|
|
53
|
-
version: 1,
|
|
54
|
-
source: 'api',
|
|
55
|
-
});
|
|
56
|
-
return { entityId };
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Update entity (event-sourced)
|
|
60
|
-
*
|
|
61
|
-
* Publishes `entities.update.requested` event → entitiesWorker → DB
|
|
62
|
-
*/
|
|
63
|
-
async update(id, input) {
|
|
64
|
-
await this.client.events.log.mutate({
|
|
65
|
-
aggregateId: id,
|
|
66
|
-
aggregateType: 'entity',
|
|
67
|
-
eventType: 'entities.update.requested',
|
|
68
|
-
data: {
|
|
69
|
-
entityId: id,
|
|
70
|
-
...input,
|
|
71
|
-
},
|
|
72
|
-
metadata: {},
|
|
73
|
-
version: 1, // TODO: Get actual version
|
|
74
|
-
source: 'api',
|
|
75
|
-
});
|
|
76
|
-
return { success: true };
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Delete entity (event-sourced soft delete)
|
|
80
|
-
*
|
|
81
|
-
* Publishes `entities.delete.requested` event → entitiesWorker → DB
|
|
82
|
-
*/
|
|
83
|
-
async delete(id) {
|
|
84
|
-
await this.client.events.log.mutate({
|
|
85
|
-
aggregateId: id,
|
|
86
|
-
aggregateType: 'entity',
|
|
87
|
-
eventType: 'entities.delete.requested',
|
|
88
|
-
data: {
|
|
89
|
-
entityId: id,
|
|
90
|
-
},
|
|
91
|
-
metadata: {},
|
|
92
|
-
version: 1,
|
|
93
|
-
source: 'api',
|
|
94
|
-
});
|
|
95
|
-
return { success: true };
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get entity by ID (direct read)
|
|
99
|
-
*/
|
|
100
|
-
async get(id) {
|
|
101
|
-
const result = await this.client.entities.get.query({ id });
|
|
102
|
-
return result.entity;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* List entities (direct read)
|
|
106
|
-
*/
|
|
107
|
-
async list(options = {}) {
|
|
108
|
-
const result = await this.client.entities.list.query({
|
|
109
|
-
type: options.type, // Type cast because router has different enum
|
|
110
|
-
limit: options.limit || 50,
|
|
111
|
-
});
|
|
112
|
-
return result.entities;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Search entities (direct read)
|
|
116
|
-
*/
|
|
117
|
-
async search(options) {
|
|
118
|
-
const result = await this.client.entities.search.query({
|
|
119
|
-
query: options.query,
|
|
120
|
-
type: options.types?.[0], // Type cast because router has different enum
|
|
121
|
-
limit: options.limit || 10,
|
|
122
|
-
});
|
|
123
|
-
return result.entities;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=entities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/resources/entities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA4BzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAuB,KAA2B;QAC5D,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC;QAE9B,0CAA0C;QAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YAClC,WAAW,EAAE,QAAQ;YACrB,aAAa,EAAE,QAAQ;YACvB,SAAS,EAAE,2BAA2B;YACtC,IAAI,EAAE;gBACJ,EAAE,EAAE,QAAQ;gBACZ,UAAU,EAAE,KAAK,CAAC,IAAI;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,OAAO,EAAE,KA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AAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,UAA+B,EAAE;QAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YACnD,IAAI,EAAE,OAAO,CAAC,IAAW,EAAE,8CAA8C;YACzE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAsB;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;YACrD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAQ,EAAE,8CAA8C;YAC/E,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Events API - Event History and Replay
|
|
3
|
-
*
|
|
4
|
-
* ALL OPERATIONS are direct reads (query event log)
|
|
5
|
-
*/
|
|
6
|
-
import type { SynapClient } from '@synap/client';
|
|
7
|
-
import type { Event, EventFilter } from '../types/events.js';
|
|
8
|
-
/**
|
|
9
|
-
* Events API
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Get event history for an entity
|
|
14
|
-
* const history = await sdk.events.getHistory(taskId);
|
|
15
|
-
*
|
|
16
|
-
* // Get user's event timeline
|
|
17
|
-
* const timeline = await sdk.events.getTimeline({
|
|
18
|
-
* limit: 100,
|
|
19
|
-
* after: new Date('2024-01-01')
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // Filter by event types
|
|
23
|
-
* const creates = await sdk.events.getHistory(entityId, {
|
|
24
|
-
* eventTypes: ['entities.create.validated', 'entities.update.validated']
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare class EventsAPI {
|
|
29
|
-
private readonly client;
|
|
30
|
-
constructor(client: SynapClient);
|
|
31
|
-
/**
|
|
32
|
-
* Get event history for a specific subject (entity, relation, etc.)
|
|
33
|
-
*
|
|
34
|
-
* Returns all events related to the subject in chronological order
|
|
35
|
-
*/
|
|
36
|
-
getHistory(subjectId: string, options?: Omit<EventFilter, 'subjectId'>): Promise<Event[]>;
|
|
37
|
-
/**
|
|
38
|
-
* Get user's complete event timeline
|
|
39
|
-
*
|
|
40
|
-
* Returns all events for the current user
|
|
41
|
-
*/
|
|
42
|
-
getTimeline(options?: EventFilter): Promise<Event[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Replay events to rebuild entity state
|
|
45
|
-
*
|
|
46
|
-
* Note: This is a client-side replay for now.
|
|
47
|
-
* For production, server-side projector rebuild is recommended.
|
|
48
|
-
*/
|
|
49
|
-
replay(subjectId: string): Promise<any>;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;OAIG;IACG,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAM,GAC3C,OAAO,CAAC,KAAK,EAAE,CAAC;IAmBnB;;;;OAIG;IACG,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAS9D;;;;;OAKG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAyB9C"}
|
package/dist/resources/events.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Events API - Event History and Replay
|
|
3
|
-
*
|
|
4
|
-
* ALL OPERATIONS are direct reads (query event log)
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Events API
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* // Get event history for an entity
|
|
12
|
-
* const history = await sdk.events.getHistory(taskId);
|
|
13
|
-
*
|
|
14
|
-
* // Get user's event timeline
|
|
15
|
-
* const timeline = await sdk.events.getTimeline({
|
|
16
|
-
* limit: 100,
|
|
17
|
-
* after: new Date('2024-01-01')
|
|
18
|
-
* });
|
|
19
|
-
*
|
|
20
|
-
* // Filter by event types
|
|
21
|
-
* const creates = await sdk.events.getHistory(entityId, {
|
|
22
|
-
* eventTypes: ['entities.create.validated', 'entities.update.validated']
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export class EventsAPI {
|
|
27
|
-
client;
|
|
28
|
-
constructor(client) {
|
|
29
|
-
this.client = client;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Get event history for a specific subject (entity, relation, etc.)
|
|
33
|
-
*
|
|
34
|
-
* Returns all events related to the subject in chronological order
|
|
35
|
-
*/
|
|
36
|
-
async getHistory(subjectId, options = {}) {
|
|
37
|
-
const events = await this.client.events.list.query({
|
|
38
|
-
// Note: The current events.list doesn't support subjectId filter
|
|
39
|
-
// For now, we'll get all events and filter client-side
|
|
40
|
-
// TODO: Enhance events.list router to support subjectId
|
|
41
|
-
limit: options.limit || 50,
|
|
42
|
-
type: options.eventTypes?.[0], // Current API only supports single type
|
|
43
|
-
});
|
|
44
|
-
// Client-side filter by subjectId
|
|
45
|
-
// TODO: Move this to server-side once router enhanced
|
|
46
|
-
// Type cast to any because Event shape from router doesn't match our SDK Event type
|
|
47
|
-
return events.filter((event) => event.data?.entityId === subjectId ||
|
|
48
|
-
event.data?.relationId === subjectId ||
|
|
49
|
-
event.data?.subjectId === subjectId);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get user's complete event timeline
|
|
53
|
-
*
|
|
54
|
-
* Returns all events for the current user
|
|
55
|
-
*/
|
|
56
|
-
async getTimeline(options = {}) {
|
|
57
|
-
const events = await this.client.events.list.query({
|
|
58
|
-
limit: options.limit || 50,
|
|
59
|
-
type: options.eventTypes?.[0],
|
|
60
|
-
});
|
|
61
|
-
return events;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Replay events to rebuild entity state
|
|
65
|
-
*
|
|
66
|
-
* Note: This is a client-side replay for now.
|
|
67
|
-
* For production, server-side projector rebuild is recommended.
|
|
68
|
-
*/
|
|
69
|
-
async replay(subjectId) {
|
|
70
|
-
const events = await this.getHistory(subjectId);
|
|
71
|
-
// Simple event replay (can be enhanced)
|
|
72
|
-
let state = {};
|
|
73
|
-
for (const event of events) {
|
|
74
|
-
switch (event.type) {
|
|
75
|
-
case 'entity.created':
|
|
76
|
-
case 'entities.create.validated':
|
|
77
|
-
state = { ...event.data };
|
|
78
|
-
break;
|
|
79
|
-
case 'entity.updated':
|
|
80
|
-
case 'entities.update.validated':
|
|
81
|
-
state = { ...state, ...event.data };
|
|
82
|
-
break;
|
|
83
|
-
case 'entity.deleted':
|
|
84
|
-
case 'entities.delete.validated':
|
|
85
|
-
state.deletedAt = event.timestamp;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return state;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,SAAS;IACS;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;OAIG;IACH,KAAK,CAAC,UAAU,CACd,SAAiB,EACjB,UAA0C,EAAE;QAE5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,iEAAiE;YACjE,uDAAuD;YACvD,wDAAwD;YACxD,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,wCAAwC;SACxE,CAAC,CAAC;QAEH,kCAAkC;QAClC,sDAAsD;QACtD,oFAAoF;QACpF,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAClC,KAAK,CAAC,IAAI,EAAE,QAAQ,KAAK,SAAS;YAClC,KAAK,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS;YACpC,KAAK,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAC3B,CAAC;IACb,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,UAAuB,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC9B,CAAC,CAAC;QAEH,OAAO,MAAe,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAEhD,wCAAwC;QACxC,IAAI,KAAK,GAAQ,EAAE,CAAC;QAEpB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;gBACnB,KAAK,gBAAgB,CAAC;gBACtB,KAAK,2BAA2B;oBAC9B,KAAK,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;oBAC1B,MAAM;gBACR,KAAK,gBAAgB,CAAC;gBACtB,KAAK,2BAA2B;oBAC9B,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;oBACpC,MAAM;gBACR,KAAK,gBAAgB,CAAC;gBACtB,KAAK,2BAA2B;oBAC9B,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;oBAClC,MAAM;YACV,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Relations API - Universal Relationship Management
|
|
3
|
-
*
|
|
4
|
-
* ALL MUTATIONS are event-sourced (go through events.log)
|
|
5
|
-
* ALL QUERIES are direct reads (fast)
|
|
6
|
-
*/
|
|
7
|
-
import type { SynapClient } from '@synap/client';
|
|
8
|
-
import type { RelationType, Relation, RelationFilter } from '../types/relations.js';
|
|
9
|
-
/**
|
|
10
|
-
* Relations API
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // Create relationship (event-sourced)
|
|
15
|
-
* await sdk.relations.create(taskId, personId, 'assigned_to');
|
|
16
|
-
*
|
|
17
|
-
* // Get relations (direct read)
|
|
18
|
-
* const relations = await sdk.relations.get(entityId, {
|
|
19
|
-
* type: 'assigned_to',
|
|
20
|
-
* direction: 'both'
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* // Get related entities (direct read)
|
|
24
|
-
* const people = await sdk.relations.getRelated(taskId, {
|
|
25
|
-
* type: 'assigned_to',
|
|
26
|
-
* direction: 'source'
|
|
27
|
-
* });
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare class RelationsAPI {
|
|
31
|
-
private readonly client;
|
|
32
|
-
constructor(client: SynapClient);
|
|
33
|
-
/**
|
|
34
|
-
* Create relationship (event-sourced)
|
|
35
|
-
*
|
|
36
|
-
* Publishes `relations.create.requested` event → relationsWorker → DB
|
|
37
|
-
*
|
|
38
|
-
* @param sourceId - Source entity ID
|
|
39
|
-
* @param targetId - Target entity ID
|
|
40
|
-
* @param type - Relationship type
|
|
41
|
-
* @param metadata - Optional metadata
|
|
42
|
-
*/
|
|
43
|
-
create(sourceId: string, targetId: string, type: RelationType | string, metadata?: Record<string, unknown>): Promise<{
|
|
44
|
-
relationId: string;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* Delete relationship (event-sourced)
|
|
48
|
-
*
|
|
49
|
-
* Publishes `relations.delete.requested` event → relationsWorker → DB
|
|
50
|
-
*/
|
|
51
|
-
delete(relationId: string): Promise<{
|
|
52
|
-
success: boolean;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Get relations for an entity (direct read)
|
|
56
|
-
*
|
|
57
|
-
* Returns relationship records (not the related entities themselves)
|
|
58
|
-
*/
|
|
59
|
-
get(entityId: string, options?: Omit<RelationFilter, 'entityId'>): Promise<Relation[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Get related entities (direct read with join)
|
|
62
|
-
*
|
|
63
|
-
* Returns the actual entity objects that are related
|
|
64
|
-
*/
|
|
65
|
-
getRelated(entityId: string, options?: Omit<RelationFilter, 'entityId'>): Promise<any>;
|
|
66
|
-
/**
|
|
67
|
-
* Get relation statistics for an entity (direct read)
|
|
68
|
-
*/
|
|
69
|
-
getStats(entityId: string): Promise<any>;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=relations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/resources/relations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGpF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;;;;OASG;IACG,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,YAAY,GAAG,MAAM,EAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAsBlC;;;;OAIG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAgB/D;;;;OAIG;IACG,GAAG,CACP,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAM,GAC7C,OAAO,CAAC,QAAQ,EAAE,CAAC;IAYtB;;;;OAIG;IACG,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAM;IAahD;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM;CAKhC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Relations API - Universal Relationship Management
|
|
3
|
-
*
|
|
4
|
-
* ALL MUTATIONS are event-sourced (go through events.log)
|
|
5
|
-
* ALL QUERIES are direct reads (fast)
|
|
6
|
-
*/
|
|
7
|
-
import { randomUUID } from 'node:crypto';
|
|
8
|
-
/**
|
|
9
|
-
* Relations API
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Create relationship (event-sourced)
|
|
14
|
-
* await sdk.relations.create(taskId, personId, 'assigned_to');
|
|
15
|
-
*
|
|
16
|
-
* // Get relations (direct read)
|
|
17
|
-
* const relations = await sdk.relations.get(entityId, {
|
|
18
|
-
* type: 'assigned_to',
|
|
19
|
-
* direction: 'both'
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // Get related entities (direct read)
|
|
23
|
-
* const people = await sdk.relations.getRelated(taskId, {
|
|
24
|
-
* type: 'assigned_to',
|
|
25
|
-
* direction: 'source'
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export class RelationsAPI {
|
|
30
|
-
client;
|
|
31
|
-
constructor(client) {
|
|
32
|
-
this.client = client;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create relationship (event-sourced)
|
|
36
|
-
*
|
|
37
|
-
* Publishes `relations.create.requested` event → relationsWorker → DB
|
|
38
|
-
*
|
|
39
|
-
* @param sourceId - Source entity ID
|
|
40
|
-
* @param targetId - Target entity ID
|
|
41
|
-
* @param type - Relationship type
|
|
42
|
-
* @param metadata - Optional metadata
|
|
43
|
-
*/
|
|
44
|
-
async create(sourceId, targetId, type, metadata) {
|
|
45
|
-
const relationId = randomUUID();
|
|
46
|
-
await this.client.events.log.mutate({
|
|
47
|
-
aggregateId: relationId,
|
|
48
|
-
aggregateType: 'relation',
|
|
49
|
-
eventType: 'relations.create.requested',
|
|
50
|
-
data: {
|
|
51
|
-
id: relationId,
|
|
52
|
-
sourceEntityId: sourceId,
|
|
53
|
-
targetEntityId: targetId,
|
|
54
|
-
type,
|
|
55
|
-
metadata,
|
|
56
|
-
},
|
|
57
|
-
metadata: {},
|
|
58
|
-
version: 1,
|
|
59
|
-
source: 'api',
|
|
60
|
-
});
|
|
61
|
-
return { relationId };
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Delete relationship (event-sourced)
|
|
65
|
-
*
|
|
66
|
-
* Publishes `relations.delete.requested` event → relationsWorker → DB
|
|
67
|
-
*/
|
|
68
|
-
async delete(relationId) {
|
|
69
|
-
await this.client.events.log.mutate({
|
|
70
|
-
aggregateId: relationId,
|
|
71
|
-
aggregateType: 'relation',
|
|
72
|
-
eventType: 'relations.delete.requested',
|
|
73
|
-
data: {
|
|
74
|
-
relationId,
|
|
75
|
-
},
|
|
76
|
-
metadata: {},
|
|
77
|
-
version: 1,
|
|
78
|
-
source: 'api',
|
|
79
|
-
});
|
|
80
|
-
return { success: true };
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get relations for an entity (direct read)
|
|
84
|
-
*
|
|
85
|
-
* Returns relationship records (not the related entities themselves)
|
|
86
|
-
*/
|
|
87
|
-
async get(entityId, options = {}) {
|
|
88
|
-
// Type assertion needed because relations router not in AppRouter type yet
|
|
89
|
-
const result = await this.client.relations.get.query({
|
|
90
|
-
entityId,
|
|
91
|
-
type: options.type,
|
|
92
|
-
direction: options.direction || 'both',
|
|
93
|
-
limit: options.limit || 50,
|
|
94
|
-
});
|
|
95
|
-
return result.relations;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get related entities (direct read with join)
|
|
99
|
-
*
|
|
100
|
-
* Returns the actual entity objects that are related
|
|
101
|
-
*/
|
|
102
|
-
async getRelated(entityId, options = {}) {
|
|
103
|
-
// Type assertion needed because relations router not in AppRouter type yet
|
|
104
|
-
const result = await this.client.relations.getRelated.query({
|
|
105
|
-
entityId,
|
|
106
|
-
type: options.type,
|
|
107
|
-
direction: options.direction || 'both',
|
|
108
|
-
limit: options.limit || 50,
|
|
109
|
-
});
|
|
110
|
-
return result.entities;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get relation statistics for an entity (direct read)
|
|
114
|
-
*/
|
|
115
|
-
async getStats(entityId) {
|
|
116
|
-
// Type assertion needed because relations router not in AppRouter type yet
|
|
117
|
-
const result = await this.client.relations.getStats.query({ entityId });
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=relations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relations.js","sourceRoot":"","sources":["../../src/resources/relations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,CACV,QAAgB,EAChB,QAAgB,EAChB,IAA2B,EAC3B,QAAkC;QAElC,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;QAEhC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YAClC,WAAW,EAAE,UAAU;YACvB,aAAa,EAAE,UAAU;YACzB,SAAS,EAAE,4BAA4B;YACvC,IAAI,EAAE;gBACJ,EAAE,EAAE,UAAU;gBACd,cAAc,EAAE,QAAQ;gBACxB,cAAc,EAAE,QAAQ;gBACxB,IAAI;gBACJ,QAAQ;aACT;YACD,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YAClC,WAAW,EAAE,UAAU;YACvB,aAAa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