@antcde/connect-ts 0.4.18-rc.00a441c → 0.4.18-rc.1d0df62
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/build/comms/client.d.ts +10 -12
- package/build/comms/client.d.ts.map +1 -1
- package/build/comms/client.js +72 -157
- package/build/comms/compat.d.ts +18 -0
- package/build/comms/compat.d.ts.map +1 -0
- package/build/comms/compat.js +80 -0
- package/build/comms/host.d.ts +5 -18
- package/build/comms/host.d.ts.map +1 -1
- package/build/comms/host.js +88 -161
- package/build/comms/hostAPI.d.ts +49 -0
- package/build/comms/hostAPI.d.ts.map +1 -0
- package/build/comms/hostAPI.js +56 -0
- package/build/comms/models.d.ts +4 -0
- package/build/comms/models.d.ts.map +1 -1
- package/build/comms/python-schema.d.ts +4 -0
- package/build/comms/python-schema.d.ts.map +1 -0
- package/build/comms/python-schema.js +4 -0
- package/build/comms/signal.d.ts +5 -321
- package/build/comms/signal.d.ts.map +1 -1
- package/build/comms/signal.js +5 -9
- package/build/comms/signalChangeTypes.d.ts +47 -0
- package/build/comms/signalChangeTypes.d.ts.map +1 -0
- package/build/comms/signalChangeTypes.js +1 -0
- package/build/comms/signalTypes.d.ts +262 -0
- package/build/comms/signalTypes.d.ts.map +1 -0
- package/build/comms/signalTypes.js +6 -0
- package/build/comms/transport.d.ts +16 -0
- package/build/comms/transport.d.ts.map +1 -0
- package/build/comms/transport.js +51 -0
- package/build/comms/utils.d.ts +4 -36
- package/build/comms/utils.d.ts.map +1 -1
- package/build/comms/utils.js +6 -79
- package/build/index.d.ts +4 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/services/AppManifest.d.ts +39 -0
- package/build/services/AppManifest.d.ts.map +1 -0
- package/build/services/AppManifest.js +1 -0
- package/build/services/AppService.d.ts +4 -230
- package/build/services/AppService.d.ts.map +1 -1
- package/build/services/AppService.js +1 -2
- package/build/services/AppService.types.d.ts +173 -0
- package/build/services/AppService.types.d.ts.map +1 -0
- package/build/services/AppService.types.js +1 -0
- package/build/services/ProjectService.d.ts +24 -1
- package/build/services/ProjectService.d.ts.map +1 -1
- package/build/services/RBAC/PermissionService.d.ts +2 -2
- package/build/services/RBAC/PermissionService.d.ts.map +1 -1
- package/build/services/ResourceTypeService.d.ts +5 -6
- package/build/services/ResourceTypeService.d.ts.map +1 -1
- package/build/services/ResourceTypeService.js +0 -2
- package/build/services/TaskService.types.d.ts +3 -1
- package/build/services/TaskService.types.d.ts.map +1 -1
- package/build/services/TaskServiceQueries.d.ts.map +1 -1
- package/build/services/TaskServiceQueries.js +1 -0
- package/build/utils.d.ts +2 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +6 -0
- package/package.json +11 -7
package/build/comms/signal.d.ts
CHANGED
|
@@ -1,324 +1,9 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
2
|
import type { Message } from '../comms/utils';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import type { ImportProgressEvent } from "../services/RecordService";
|
|
8
|
-
import type { SbsRecord } from "../services/SbsService";
|
|
9
|
-
import type { Table } from "../services/TableService";
|
|
10
|
-
import type { Task, TaskAppendix } from "../services/TaskService";
|
|
11
|
-
import type { User } from "../services/UserService";
|
|
12
|
-
import type { JobProgressEvent, LimitChangeEvent } from "../types";
|
|
13
|
-
export declare const changes: readonly ["created", "updated", "deleted", "trashed", "restored"];
|
|
14
|
-
export type Change = typeof changes[number];
|
|
15
|
-
/**
|
|
16
|
-
* Constructing a Signal seems a bit too much, but this format makes it really easy to check on the receiving end:
|
|
17
|
-
*
|
|
18
|
-
* ```(signal: Signal) => signal.overlay && showOverlay(signal.overlay.action === 'show')```
|
|
19
|
-
*
|
|
20
|
-
* ```(signal: Signal) => signal.task && renderUI()```
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* You can construct a Signal with multiple properties, but they will be sent as single entry objects:
|
|
24
|
-
*
|
|
25
|
-
* ```
|
|
26
|
-
* client.signal.send({ overlay: {action: 'show' }, { sbs: {id: '123' }} })
|
|
27
|
-
*
|
|
28
|
-
* host.signal.receive.subscribe((s: Signal) => s.overlay && renderUI(s.overlay.action === 'show'))
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* NOTE: Prefer to add non-truthy/falsey values in order to support the above pattern-matching behavior.
|
|
32
|
-
*/
|
|
33
|
-
export interface Cause<T = any> {
|
|
34
|
-
id: string;
|
|
35
|
-
action?: Change;
|
|
36
|
-
data?: Partial<T>;
|
|
37
|
-
meta?: {
|
|
38
|
-
source: 'resource' | 'local' | 'timeseries';
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export type TaskLike = Pick<Task, 'id'>;
|
|
42
|
-
export interface DmsGallery {
|
|
43
|
-
files: DmsFile[];
|
|
44
|
-
index?: number;
|
|
45
|
-
projectId?: string;
|
|
46
|
-
licenseId?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface RecordDocument {
|
|
49
|
-
tableId: string;
|
|
50
|
-
recordId: string;
|
|
51
|
-
documentId: string;
|
|
52
|
-
name?: string;
|
|
53
|
-
}
|
|
54
|
-
export type ShowOverlay = boolean | TaskAppendix[] | TaskLike | null | undefined | DmsGallery | RecordDocument;
|
|
55
|
-
export interface RouteSignal {
|
|
56
|
-
query?: Record<string, string | null | (string | null)[]>;
|
|
57
|
-
path?: string;
|
|
58
|
-
}
|
|
59
|
-
export declare function isDmsGallery(value: any): value is DmsGallery;
|
|
60
|
-
export declare function isRecordDocument(value: any): value is RecordDocument;
|
|
61
|
-
export interface NavigateToApp {
|
|
62
|
-
app: {
|
|
63
|
-
title?: string;
|
|
64
|
-
id?: string;
|
|
65
|
-
favorite?: number;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
interface Navigate {
|
|
69
|
-
/**
|
|
70
|
-
* If it is one of the literals, it will try to navigate to that screen
|
|
71
|
-
* DEPRECATED If it is a string; it will assume a like-search for apps, so it will try to navigate to the first app it can find
|
|
72
|
-
* DEPRECATED Otherwise it will try to navigate to a favorite.
|
|
73
|
-
* Otherwise, it will look for an app with a specific ID, an app with a title (like & case-insensitive search), or a favorite index
|
|
74
|
-
*/
|
|
75
|
-
to: 'OS.dash' | 'OS.login' | 'OS.profile' | string | {
|
|
76
|
-
favorite: number;
|
|
77
|
-
} | NavigateToApp;
|
|
78
|
-
method?: 'push' | 'replace';
|
|
79
|
-
}
|
|
80
|
-
export interface DmsFileBatchChange {
|
|
81
|
-
id: string;
|
|
82
|
-
action: string;
|
|
83
|
-
data: Partial<DmsFile> & {
|
|
84
|
-
id: string;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export interface DmsFileBatchSignal {
|
|
88
|
-
type: 'dmsFileBatch';
|
|
89
|
-
changes: DmsFileBatchChange[];
|
|
90
|
-
actor_id: string | null;
|
|
91
|
-
}
|
|
92
|
-
export interface ChangeSignal {
|
|
93
|
-
user?: Cause<User>;
|
|
94
|
-
license?: Cause<License>;
|
|
95
|
-
project?: Cause<Project>;
|
|
96
|
-
task?: Cause<Task>;
|
|
97
|
-
sbs?: Cause<SbsRecord>;
|
|
98
|
-
table?: Cause<Table>;
|
|
99
|
-
column?: Cause<Column>;
|
|
100
|
-
dmsFile?: Cause<DmsFile>;
|
|
101
|
-
projectTask?: Cause<Task>;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* This is the core message that can be sent and received by host and client. It made to be is simple to add your own ones.
|
|
105
|
-
*
|
|
106
|
-
* The nested object looks quirky, but makes it simple on the receiving and to filter out the right message
|
|
107
|
-
*
|
|
108
|
-
* ```
|
|
109
|
-
* host.receive.subscribe((s) => s.task && doSomething(s.taks.id)) // task prop is check to be defined, so all set!
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export interface Signal extends ChangeSignal {
|
|
113
|
-
route?: RouteSignal;
|
|
114
|
-
overlay?: {
|
|
115
|
-
action: ShowOverlay;
|
|
116
|
-
};
|
|
117
|
-
navigate?: Navigate;
|
|
118
|
-
select?: {
|
|
119
|
-
project?: string | null;
|
|
120
|
-
task?: string | null;
|
|
121
|
-
sbs?: string | null;
|
|
122
|
-
};
|
|
123
|
-
notepad?: {
|
|
124
|
-
action: boolean | 'toggle';
|
|
125
|
-
};
|
|
126
|
-
immersive?: {
|
|
127
|
-
mode: boolean | 'toggle';
|
|
128
|
-
};
|
|
129
|
-
notifications?: {
|
|
130
|
-
action: boolean | 'toggle';
|
|
131
|
-
};
|
|
132
|
-
hotkeys?: {
|
|
133
|
-
ctrl?: true;
|
|
134
|
-
shift?: true;
|
|
135
|
-
};
|
|
136
|
-
ping?: true;
|
|
137
|
-
pong?: true;
|
|
138
|
-
dmsFileBatch?: DmsFileBatchSignal;
|
|
139
|
-
observe?: {
|
|
140
|
-
random: string;
|
|
141
|
-
type: keyof ChangeSignal | (string & {});
|
|
142
|
-
id?: string;
|
|
143
|
-
actions?: Change[];
|
|
144
|
-
scope?: ('project' | 'license')[];
|
|
145
|
-
};
|
|
146
|
-
unobserve?: {
|
|
147
|
-
random: string;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Import progress events relayed from WebSocket
|
|
151
|
-
* Sent by ant-os when async import progress is received
|
|
152
|
-
*/
|
|
153
|
-
importProgress?: ImportProgressEvent;
|
|
154
|
-
/**
|
|
155
|
-
* Generic job progress events relayed from WebSocket
|
|
156
|
-
* Sent by ant-os when async job progress is received (generation, export, validation, etc.)
|
|
157
|
-
*/
|
|
158
|
-
jobProgress?: JobProgressEvent;
|
|
159
|
-
/**
|
|
160
|
-
* Resource limit change events relayed from WebSocket
|
|
161
|
-
* Sent by ant-os when resource limits change (record created/deleted, project created, etc.)
|
|
162
|
-
*/
|
|
163
|
-
limitChange?: LimitChangeEvent;
|
|
164
|
-
/**
|
|
165
|
-
* Request ant-os to subscribe to an Echo channel on behalf of the app.
|
|
166
|
-
* Events received on the channel will be relayed back via signals.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* // Subscribe to table limit changes
|
|
171
|
-
* host.signal({
|
|
172
|
-
* subscribeChannel: {
|
|
173
|
-
* channel: `App.Table.${tableId}.Limits`,
|
|
174
|
-
* events: ['limit.change']
|
|
175
|
-
* }
|
|
176
|
-
* })
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
subscribeChannel?: {
|
|
180
|
-
/** The Echo channel name (e.g., "App.Table.{id}.Limits") */
|
|
181
|
-
channel: string;
|
|
182
|
-
/** Event names to listen for on this channel */
|
|
183
|
-
events: string[];
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* Request ant-os to unsubscribe from an Echo channel.
|
|
187
|
-
*/
|
|
188
|
-
unsubscribeChannel?: {
|
|
189
|
-
/** The Echo channel name to unsubscribe from */
|
|
190
|
-
channel: string;
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
* Arbitrary entity change signals for app-defined resource types.
|
|
194
|
-
* Observed via `signal.with('homeowner', id, actions, scope)`.
|
|
195
|
-
* Echo-backed through a generic `App.Project.{id}.Resources` channel.
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* ```typescript
|
|
199
|
-
* signal.send({ resource: { homeowner: { id: '123', action: 'updated' } } })
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
resource?: Record<string, Cause>;
|
|
203
|
-
/**
|
|
204
|
-
* Generic topic pub/sub via Echo whisper (client events).
|
|
205
|
-
* Sends a message to all other subscribers on the same topic — sender excluded.
|
|
206
|
-
* Topic name must match [a-zA-Z0-9_-] (no dots).
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* ```typescript
|
|
210
|
-
* // Publish to a project-scoped topic
|
|
211
|
-
* signal.send({ topic: { name: 'cursor-positions', data: { x: 100, y: 200 } } })
|
|
212
|
-
*
|
|
213
|
-
* // Publish to a license-scoped topic
|
|
214
|
-
* signal.send({ topic: { name: 'sync-status', data: { ready: true }, scope: 'license' } })
|
|
215
|
-
*
|
|
216
|
-
* // Receive topic events (manual filtering)
|
|
217
|
-
* signal.receive((s) => {
|
|
218
|
-
* if (s.topic?.name === 'cursor-positions') handleCursor(s.topic.data)
|
|
219
|
-
* })
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
topic?: {
|
|
223
|
-
name: string;
|
|
224
|
-
data?: any;
|
|
225
|
-
scope?: 'project' | 'license';
|
|
226
|
-
/**
|
|
227
|
-
* @internal OS-only loop-break marker. Stamped by the OS topic watcher
|
|
228
|
-
* and whisper handler when redistributing a topic signal to local hosts,
|
|
229
|
-
* so that same-window debug hosts (e.g. the dev host in apps.ts) which
|
|
230
|
-
* self-listen via postMessage cannot re-enter the watcher and cause a
|
|
231
|
-
* publish loop. User code must never set this.
|
|
232
|
-
*/
|
|
233
|
-
_loopBreakId?: string;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Request ant-os to open an app in split-screen mode alongside the current app.
|
|
237
|
-
* The current app stays in pane 0; the requested app opens in pane 1 by default.
|
|
238
|
-
*
|
|
239
|
-
* @example
|
|
240
|
-
* ```typescript
|
|
241
|
-
* // Open app by ID in a vertical (side-by-side) split
|
|
242
|
-
* signal.send({ openSplit: { app: { id: 'some-app-id' } } })
|
|
243
|
-
*
|
|
244
|
-
* // Open app by title in a horizontal (stacked) split on the left pane
|
|
245
|
-
* signal.send({ openSplit: { app: { title: 'My App' }, layout: 'h', pane: 0 } })
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
openSplit?: {
|
|
249
|
-
/** App to open in the split pane — resolve by id or title (case-insensitive) */
|
|
250
|
-
app: {
|
|
251
|
-
id?: string;
|
|
252
|
-
title?: string;
|
|
253
|
-
};
|
|
254
|
-
/** Which pane: 0 = left/top, 1 = right/bottom. Defaults to 1. */
|
|
255
|
-
pane?: 0 | 1;
|
|
256
|
-
/** Split direction: 'v' = side-by-side (default), 'h' = stacked */
|
|
257
|
-
layout?: 'h' | 'v';
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Request ant-os to open a flow/workflow in a floating window.
|
|
261
|
-
* Can be sent from any app via signals to show a task's flow editor.
|
|
262
|
-
*
|
|
263
|
-
* @example
|
|
264
|
-
* ```typescript
|
|
265
|
-
* signal.send({ openFlow: { taskId: 'some-task-id', title: 'My Workflow' } })
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
openFlow?: {
|
|
269
|
-
/** The root task ID to open in the flow editor */
|
|
270
|
-
taskId: string;
|
|
271
|
-
/** Optional window title (falls back to task title) */
|
|
272
|
-
title?: string;
|
|
273
|
-
/** Open in read-only mode (locks all editing) */
|
|
274
|
-
readonly?: boolean;
|
|
275
|
-
};
|
|
276
|
-
/**
|
|
277
|
-
* Request ant-os to close a flow window.
|
|
278
|
-
*/
|
|
279
|
-
closeFlow?: {
|
|
280
|
-
taskId: string;
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* Request ant-os to open a DMS file preview in a floating window.
|
|
284
|
-
* Supports images and PDFs — unsupported types trigger a download instead.
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```typescript
|
|
288
|
-
* signal.send({ openFilePreview: { fileId: 'dms-file-id', fileName: 'photo.jpg' } })
|
|
289
|
-
* ```
|
|
290
|
-
*/
|
|
291
|
-
openFilePreview?: {
|
|
292
|
-
/** DMS file token to preview (used to resolve download URL) */
|
|
293
|
-
fileToken: string;
|
|
294
|
-
/** Display name for the window title */
|
|
295
|
-
fileName?: string;
|
|
296
|
-
/** Project scope for download URL resolution */
|
|
297
|
-
projectId?: string;
|
|
298
|
-
/** License scope for download URL resolution (used when projectId is absent) */
|
|
299
|
-
licenseId?: string;
|
|
300
|
-
/** Pre-resolved content URL (blob or data URL). Skips DMS download when provided. */
|
|
301
|
-
contentUrl?: string;
|
|
302
|
-
/** File size in bytes (for details sidebar) */
|
|
303
|
-
fileSize?: number;
|
|
304
|
-
/** File extension without dot (for details sidebar icon) */
|
|
305
|
-
fileExtension?: string;
|
|
306
|
-
/** Owner display name */
|
|
307
|
-
ownerName?: string;
|
|
308
|
-
/** Owner avatar URL */
|
|
309
|
-
ownerAvatar?: string;
|
|
310
|
-
/** ISO date string — file creation date */
|
|
311
|
-
createdAt?: string;
|
|
312
|
-
/** ISO date string — last modified date */
|
|
313
|
-
updatedAt?: string;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Request ant-os to close a file preview window.
|
|
317
|
-
*/
|
|
318
|
-
closeFilePreview?: {
|
|
319
|
-
fileToken: string;
|
|
320
|
-
};
|
|
321
|
-
}
|
|
3
|
+
import type { ChangeSignal } from './signalChangeTypes';
|
|
4
|
+
import type { Signal } from './signalTypes';
|
|
5
|
+
export * from './signalChangeTypes';
|
|
6
|
+
export * from './signalTypes';
|
|
322
7
|
export interface SendSignal {
|
|
323
8
|
(...value: Signal[]): Promise<unknown>;
|
|
324
9
|
}
|
|
@@ -343,7 +28,7 @@ export interface SignalReceiver<S = Signal> {
|
|
|
343
28
|
* @param actions if no action is supplied, you will receive all actions
|
|
344
29
|
* @param scope optional array of specificity for wildcards - default undefined resolves to ['project', 'license']
|
|
345
30
|
*/
|
|
346
|
-
with: <K extends keyof ChangeSignal | (string & {})>(type: K, id?: string, actions?: Change[], scope?: ('project' | 'license')[]) => SignalReceiver<K extends keyof ChangeSignal ? ChangeSignal[K] : Cause>;
|
|
31
|
+
with: <K extends keyof ChangeSignal | (string & {})>(type: K, id?: string, actions?: import('./signalChangeTypes').Change[], scope?: ('project' | 'license')[]) => SignalReceiver<K extends keyof ChangeSignal ? ChangeSignal[K] : import('./signalChangeTypes').Cause>;
|
|
347
32
|
}
|
|
348
33
|
interface NewSignalInput {
|
|
349
34
|
receiver: Observable<Message<Array<Signal>>>;
|
|
@@ -351,5 +36,4 @@ interface NewSignalInput {
|
|
|
351
36
|
}
|
|
352
37
|
export declare function newSignaler(input: NewSignalInput): SignalSender & SignalReceiver;
|
|
353
38
|
export declare const changeSignalKeys: ReadonlySet<string>;
|
|
354
|
-
export {};
|
|
355
39
|
//# sourceMappingURL=signal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/comms/signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/comms/signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAE7B,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,aAAa,CAAA;IAC7C,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,MAAM,WAAW,YAAa,SAAQ,UAAU,EAAE,aAAa;CAC9D;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAA;AAEpC,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM;IACxC;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,WAAW,CAAA;IAEnD;;;;;;;OAOG;IACH,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,qBAAqB,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,qBAAqB,EAAE,KAAK,CAAC,CAAA;CACxQ;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAC5C,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC3C;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,GAAG,cAAc,CAkBhF;AAED,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAiJ,CAAA"}
|
package/build/comms/signal.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { concatMap, Subscription } from 'rxjs';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export function isRecordDocument(value) {
|
|
7
|
-
return typeof value === 'object' && value !== null && !!value.tableId && !!value.recordId && !!value.documentId;
|
|
8
|
-
}
|
|
2
|
+
import { randomUUID } from '../utils';
|
|
3
|
+
export * from './signalChangeTypes';
|
|
4
|
+
export * from './signalTypes';
|
|
9
5
|
export function newSignaler(input) {
|
|
10
6
|
const data = Array.of();
|
|
11
7
|
const toSingleEntrySignals = (s) => Object.entries(s).map(([key, value]) => ({ [key]: value }));
|
|
@@ -24,7 +20,7 @@ export function newSignaler(input) {
|
|
|
24
20
|
const receiver = newReceiver(input, send);
|
|
25
21
|
return Object.assign(send, builder, receiver);
|
|
26
22
|
}
|
|
27
|
-
export const changeSignalKeys = new Set(['user', 'license', 'project', 'task', 'sbs', 'table', 'column', 'dmsFile', 'projectTask']);
|
|
23
|
+
export const changeSignalKeys = new Set(['user', 'license', 'project', 'task', 'sbs', 'table', 'column', 'dmsFile', 'projectTask', 'licenseProjectTask']);
|
|
28
24
|
function newReceiver(input, send) {
|
|
29
25
|
const observable = input.receiver.pipe(concatMap(e => e.data));
|
|
30
26
|
const newChild = (type, id, actions, scope) => ({
|
|
@@ -49,7 +45,7 @@ function newReceiver(input, send) {
|
|
|
49
45
|
.subscribe(data => next(data));
|
|
50
46
|
subscription.add(child);
|
|
51
47
|
};
|
|
52
|
-
const random =
|
|
48
|
+
const random = randomUUID();
|
|
53
49
|
// Send observe signal to backend and setup local subscription
|
|
54
50
|
send({ observe: { type, id, actions, scope, random } }).then(() => {
|
|
55
51
|
if (!subscription.closed) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Column } from "../services/ColumnService";
|
|
2
|
+
import type { DmsFile } from "../services/DmsService";
|
|
3
|
+
import type { License } from "../services/LicenseService";
|
|
4
|
+
import type { Project } from "../services/ProjectService";
|
|
5
|
+
import type { SbsRecord } from "../services/SbsService";
|
|
6
|
+
import type { Table } from "../services/TableService";
|
|
7
|
+
import type { Task } from "../services/TaskService";
|
|
8
|
+
import type { User } from "../services/UserService";
|
|
9
|
+
export declare const changes: readonly ["created", "updated", "deleted", "trashed", "restored"];
|
|
10
|
+
export type Change = typeof changes[number];
|
|
11
|
+
export interface Cause<T = any> {
|
|
12
|
+
id: string;
|
|
13
|
+
action?: Change;
|
|
14
|
+
data?: Partial<T>;
|
|
15
|
+
meta?: {
|
|
16
|
+
source: 'resource' | 'local' | 'timeseries';
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface DmsFileBatchChange {
|
|
20
|
+
id: string;
|
|
21
|
+
action: string;
|
|
22
|
+
data: Partial<DmsFile> & {
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface DmsFileBatchSignal {
|
|
27
|
+
type: 'dmsFileBatch';
|
|
28
|
+
changes: DmsFileBatchChange[];
|
|
29
|
+
actor_id: string | null;
|
|
30
|
+
}
|
|
31
|
+
export interface ChangeSignal {
|
|
32
|
+
user?: Cause<User>;
|
|
33
|
+
license?: Cause<License>;
|
|
34
|
+
project?: Cause<Project>;
|
|
35
|
+
task?: Cause<Task>;
|
|
36
|
+
sbs?: Cause<SbsRecord>;
|
|
37
|
+
table?: Cause<Table>;
|
|
38
|
+
column?: Cause<Column>;
|
|
39
|
+
dmsFile?: Cause<DmsFile>;
|
|
40
|
+
projectTask?: Cause<Task>;
|
|
41
|
+
/**
|
|
42
|
+
* License-wide project task change. Backed by `App.License.{licenseId}.ProjectTasks`.
|
|
43
|
+
* Use instead of `projectTask` when tracking many projects — one subscription covers all.
|
|
44
|
+
*/
|
|
45
|
+
licenseProjectTask?: Cause<Task>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=signalChangeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signalChangeTypes.d.ts","sourceRoot":"","sources":["../../src/comms/signalChangeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,kCAAgC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,+BAA6B;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,mCAAiC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,mCAAiC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA6B;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,iCAA+B;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,gCAA8B;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,gCAA8B;AAElD,eAAO,MAAM,OAAO,mEAAoE,CAAA;AACxF,MAAM,MAAM,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,CAAA;AAE3C,MAAM,WAAW,KAAK,CAAC,CAAC,GAAG,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACjB,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,YAAY,CAAA;KAAE,CAAA;CACvD;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,kBAAkB,EAAE,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const changes = ['created', 'updated', 'deleted', 'trashed', 'restored'];
|