@ztimson/momentum 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +22 -7
- package/dist/actions.d.ts.map +1 -1
- package/dist/ai.d.ts +34 -2
- package/dist/ai.d.ts.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/data.d.ts +50 -29
- package/dist/data.d.ts.map +1 -1
- package/dist/index.js +188 -75
- package/dist/index.mjs +188 -75
- package/dist/permissions.d.ts +14 -5
- package/dist/permissions.d.ts.map +1 -1
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/storage.d.ts +7 -8
- package/dist/storage.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/actions.d.ts
CHANGED
|
@@ -26,6 +26,12 @@ export type ToolArgs = {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
export type LogEntry = {
|
|
30
|
+
/** Log level */
|
|
31
|
+
level: 'debug' | 'log' | 'info' | 'warn' | 'error';
|
|
32
|
+
/** Message parts */
|
|
33
|
+
message: any[];
|
|
34
|
+
};
|
|
29
35
|
/** Action model */
|
|
30
36
|
export type Action = Meta & {
|
|
31
37
|
/** Action name */
|
|
@@ -60,14 +66,16 @@ export type ActionResult = {
|
|
|
60
66
|
readonly duration: number;
|
|
61
67
|
/** Start timestamp */
|
|
62
68
|
readonly start: Date;
|
|
63
|
-
/** Console
|
|
64
|
-
readonly
|
|
65
|
-
/** Console errors */
|
|
66
|
-
readonly stderr: any[];
|
|
69
|
+
/** Console logs with levels and timestamps */
|
|
70
|
+
readonly logs: LogEntry[];
|
|
67
71
|
/** HTTP Response */
|
|
68
72
|
readonly response?: any;
|
|
69
73
|
/** Action return value */
|
|
70
74
|
readonly return?: any;
|
|
75
|
+
/** Captured HTTP headers (REST actions only) */
|
|
76
|
+
readonly headers?: Record<string, any>;
|
|
77
|
+
/** HTTP status code (REST actions only) */
|
|
78
|
+
readonly statusCode?: number;
|
|
71
79
|
};
|
|
72
80
|
/** Action triggers - Ordered to optimize filtering */
|
|
73
81
|
export declare enum ActionType {
|
|
@@ -93,12 +101,19 @@ export declare class Actions extends AssetController<Action> {
|
|
|
93
101
|
protected momentum: Momentum;
|
|
94
102
|
constructor(momentum: Momentum);
|
|
95
103
|
/**
|
|
96
|
-
* Manually trigger an actions execution
|
|
104
|
+
* Manually trigger an actions execution with real-time updates
|
|
97
105
|
* @param {string} id Action ID
|
|
106
|
+
* @param {(payload: ActionUpdate) => any} callback Get updates in real time
|
|
98
107
|
* @param {HttpRequestOptions} opts Additional arguments
|
|
99
|
-
* @return {Promise<
|
|
108
|
+
* @return {Promise<string>} Run UID for socket subscription
|
|
109
|
+
*/
|
|
110
|
+
debug(id: string, callback?: (payload: Partial<ActionResult>) => any, opts?: HttpRequestOptions): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Terminate a running action
|
|
113
|
+
* @param {string} id Action ID
|
|
114
|
+
* @return {Promise<boolean>} Success status
|
|
100
115
|
*/
|
|
101
|
-
|
|
116
|
+
terminate(id: string): Promise<boolean>;
|
|
102
117
|
/**
|
|
103
118
|
* Run an HTTP action
|
|
104
119
|
* @param {string} path HTTP path excluding `/api/actions/run`
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAY,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAA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AAI,IAAI;CACT;AAED,wCAAwC;AACxC,qBAAa,OAAQ,SAAQ,eAAe,CAAC,MAAM,CAAC;IACvC,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;IAIxC;;;;;;OAMG;IACG,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,GAAG,EAAE,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAY3H;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvC;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,CAAC,CAAC;CAG/D"}
|
package/dist/ai.d.ts
CHANGED
|
@@ -54,17 +54,49 @@ export type AiModel = {
|
|
|
54
54
|
/** Authentication token */
|
|
55
55
|
token?: string;
|
|
56
56
|
};
|
|
57
|
+
export type AiMessageSchema = {
|
|
58
|
+
[key: string]: {
|
|
59
|
+
/** Argument type */
|
|
60
|
+
type: 'array' | 'boolean' | 'number' | 'object' | 'string';
|
|
61
|
+
/** Argument description */
|
|
62
|
+
description: string;
|
|
63
|
+
/** Required argument */
|
|
64
|
+
required?: boolean;
|
|
65
|
+
/** Default value */
|
|
66
|
+
default?: any;
|
|
67
|
+
/** Options */
|
|
68
|
+
enum?: string[];
|
|
69
|
+
/** Minimum value or length */
|
|
70
|
+
min?: number;
|
|
71
|
+
/** Maximum value or length */
|
|
72
|
+
max?: number;
|
|
73
|
+
/** Match pattern */
|
|
74
|
+
pattern?: string;
|
|
75
|
+
/** Child arguments */
|
|
76
|
+
items?: {
|
|
77
|
+
[key: string]: AiMessageSchema;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
57
81
|
/**
|
|
58
82
|
* Configuration options defining the interaction settings for an AI agent session.
|
|
59
83
|
* Includes identification of the target agent, optional context information parsed separately from user messages, file attachments to be processed with the message, and a streaming callback handler that manages progress events such as response chunks, completion status, and tool invocation updates.
|
|
60
84
|
*/
|
|
61
85
|
export type AiOptions = {
|
|
86
|
+
/** Disable history, personality, and memory for question (Default: true) */
|
|
87
|
+
anonymous?: boolean;
|
|
62
88
|
/** Which AI agent are you speaking to */
|
|
63
89
|
agent?: string;
|
|
64
|
-
/** Additional context information
|
|
90
|
+
/** Additional context information to attach to message */
|
|
65
91
|
context?: any;
|
|
66
|
-
/**
|
|
92
|
+
/** Attach files to message context */
|
|
67
93
|
files?: File[];
|
|
94
|
+
/** Format response to match JSON schema */
|
|
95
|
+
schema?: AiMessageSchema;
|
|
96
|
+
/** Add to agents system prompt */
|
|
97
|
+
system?: string;
|
|
98
|
+
/** Override agents temperature */
|
|
99
|
+
temperature?: number;
|
|
68
100
|
};
|
|
69
101
|
/** Skills the LLM can call learn on demand */
|
|
70
102
|
export type AiSkill = Meta & {
|
package/dist/ai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAE,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,qBAAqB;AACrB,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG;IAC5B,iBAAiB;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,M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,EAAE,MAAM,EAAE,OAAO,GAAE,SAAS,GAAG;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA2B5F;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAO/B;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;CAG1C"}
|
package/dist/core.d.ts
CHANGED
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,KAAK,CAAC;AAEpE,YAAY;AACZ,MAAM,MAAM,KAAK,GAAG;IACnB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,8BAA8B;IAC9B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG;QAC9B,mBAAmB;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACF,CAAA;AAED,gCAAgC;AAChC,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,GAAG,CAAC;AAEnC,uBAAuB;AACvB,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,qBAAqB;AACrB,MAAM,MAAM,IAAI,GAAG;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,KAAK,CAAC;AAEpE,YAAY;AACZ,MAA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B,qBAAqB;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,wBAAwB;IACxB,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,mBAAmB;IACnB,OAAO,EAAE,CAAC,CAAC;CACX,CAAA;AAED,OAAO,EACN,KAAK,iBAAiB,EACtB,EAAE,EAAE,GAAG,EAAE,SAAS,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,gBAAgB,EAChB,MAAM,gBAAgB,CAAC;AAExB,4CAA4C;AAC5C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAC7B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;CACxB,CAAC;AAEF,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAEhD,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CA0CjF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,WAMvC"}
|
package/dist/data.d.ts
CHANGED
|
@@ -13,6 +13,24 @@ export type Filter<T = any> = {
|
|
|
13
13
|
};
|
|
14
14
|
/** Generic MongoDB document */
|
|
15
15
|
export type Document<T> = Meta & T;
|
|
16
|
+
/** Read query options */
|
|
17
|
+
export type ReadOptions = {
|
|
18
|
+
limit?: number;
|
|
19
|
+
page?: number;
|
|
20
|
+
sortBy?: string;
|
|
21
|
+
sortDir?: 'asc' | 'desc';
|
|
22
|
+
};
|
|
23
|
+
/** Delete query options */
|
|
24
|
+
export type DeleteOptions = {
|
|
25
|
+
limit?: number;
|
|
26
|
+
};
|
|
27
|
+
/** Update query options */
|
|
28
|
+
export type UpdateOptions<T = any> = {
|
|
29
|
+
filter?: Filter<T>;
|
|
30
|
+
append?: boolean;
|
|
31
|
+
limit?: number;
|
|
32
|
+
upsert?: boolean;
|
|
33
|
+
};
|
|
16
34
|
/** Raw MongoDB query */
|
|
17
35
|
export type RawQuery = {
|
|
18
36
|
/** Query operation type */
|
|
@@ -33,53 +51,56 @@ export declare class Data extends PathEventEmitter {
|
|
|
33
51
|
[key: string]: Unsubscribe;
|
|
34
52
|
};
|
|
35
53
|
constructor(momentum: Momentum);
|
|
54
|
+
protected dataUrl(collection: string, pk?: number, filter?: any, options?: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}): string;
|
|
36
57
|
/**
|
|
37
|
-
* Create new document in collection
|
|
58
|
+
* Create new document(s) in collection
|
|
38
59
|
* @param {string} collection Target collection
|
|
39
|
-
* @param {Document<T>}
|
|
40
|
-
* @return {Promise<Document<T
|
|
60
|
+
* @param {Document<T> | Document<T>[]} documents New document(s)
|
|
61
|
+
* @return {Promise<Document<T> | Document<T>[]>} New saved document(s)
|
|
41
62
|
*/
|
|
42
|
-
create<T>(collection: string,
|
|
63
|
+
create<T>(collection: string, documents: Document<T> | Document<T>[]): Promise<Document<T> | Document<T>[]>;
|
|
43
64
|
/**
|
|
44
|
-
* Delete document from collection
|
|
65
|
+
* Delete document(s) from collection
|
|
45
66
|
* @param {string} collection Target collection
|
|
46
|
-
* @param {number}
|
|
47
|
-
* @
|
|
67
|
+
* @param {number | Filter<T>} filter Document ID or filter object
|
|
68
|
+
* @param {DeleteOptions} options Delete options
|
|
69
|
+
* @return {Promise<number[]>} Array of deleted document IDs
|
|
48
70
|
*/
|
|
49
|
-
delete(collection: string, id: number): Promise<number[]>;
|
|
50
|
-
delete<T>(collection: string, filter: Filter<T
|
|
71
|
+
delete(collection: string, id: number, options?: DeleteOptions): Promise<number[]>;
|
|
72
|
+
delete<T>(collection: string, filter: Filter<T>, options?: DeleteOptions): Promise<number[]>;
|
|
51
73
|
/**
|
|
52
|
-
* Read collection
|
|
53
|
-
* @param {string} collection
|
|
54
|
-
* @
|
|
74
|
+
* Read document(s) from collection
|
|
75
|
+
* @param {string} collection Target collection
|
|
76
|
+
* @param {number | Filter<T>} filter Document ID or filter object
|
|
77
|
+
* @param {ReadOptions} options Read options (limit, page, sortBy, sortDir)
|
|
78
|
+
* @return {Promise<T | T[]>} Single document if ID provided, array of documents if filter or no filter provided
|
|
55
79
|
*/
|
|
56
|
-
read<T extends Meta>(collection: string): Promise<T[]>;
|
|
57
|
-
read<T extends Meta>(collection: string,
|
|
58
|
-
read<T extends Meta>(collection: string, filter
|
|
80
|
+
read<T extends Meta>(collection: string, filter?: undefined, options?: ReadOptions): Promise<T[]>;
|
|
81
|
+
read<T extends Meta>(collection: string, filter?: number, options?: ReadOptions): Promise<T>;
|
|
82
|
+
read<T extends Meta>(collection: string, filter?: Filter<T>, options?: ReadOptions): Promise<T[]>;
|
|
59
83
|
/**
|
|
60
|
-
* Update document in collection
|
|
84
|
+
* Update document(s) in collection
|
|
61
85
|
* @param {string} collection Target collection
|
|
62
|
-
* @param {Document<T>}
|
|
63
|
-
* @param {
|
|
86
|
+
* @param {Document<T> | Document<T>[]} documents Document(s) to update
|
|
87
|
+
* @param {UpdateOptions<T>} options Update options (filter, append, limit, upsert)
|
|
64
88
|
* @return {Promise<Document<T> | Document<T>[]>} Updated document(s)
|
|
65
89
|
*/
|
|
66
|
-
update<T>(collection: string,
|
|
67
|
-
filter?: Filter<T>;
|
|
68
|
-
append?: boolean;
|
|
69
|
-
}): Promise<Document<T> | Document<T>[]>;
|
|
90
|
+
update<T>(collection: string, documents: Document<T> | Document<T>[], options?: UpdateOptions<T>): Promise<Document<T> | Document<T>[]>;
|
|
70
91
|
/**
|
|
71
|
-
*
|
|
92
|
+
* Execute raw MongoDB query
|
|
72
93
|
* @param {string} collection Target collection name
|
|
73
|
-
* @param {RawQuery} query Raw query
|
|
94
|
+
* @param {RawQuery} query Raw MongoDB query object
|
|
74
95
|
* @return {Promise<any>} Query response
|
|
75
96
|
*/
|
|
76
97
|
raw<T>(collection: string, query: RawQuery): Promise<any>;
|
|
77
98
|
/**
|
|
78
|
-
* Subscribe to live updates
|
|
79
|
-
* @param path
|
|
80
|
-
* @param {(value: T[]) => any
|
|
81
|
-
* @param opts
|
|
82
|
-
* @return {
|
|
99
|
+
* Subscribe to live data updates
|
|
100
|
+
* @param {string} path Data path to subscribe to
|
|
101
|
+
* @param {(value: T | T[]) => any} callback Function called with updated data
|
|
102
|
+
* @param {object} opts Options object with reload flag
|
|
103
|
+
* @return {Unsubscribe} Function to unsubscribe from updates
|
|
83
104
|
*/
|
|
84
105
|
sync<T>(path: string, callback: ((value: T | T[]) => any), opts?: {
|
|
85
106
|
reload?: boolean;
|
package/dist/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,KAAK,IAAI,EAAE,gBAAgB,EAAM,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtG,gFAAgF;AAChF,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;AAE3D,4CAA4C;AAC5C,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,GAAG,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,C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,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAkBjG;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,GAAE,aAAa,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAmB3I;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IASzD;;;;;;OAMG;IACH,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,GAAE;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,WAAW;CAmBtG"}
|
package/dist/index.js
CHANGED
|
@@ -1087,18 +1087,36 @@
|
|
|
1087
1087
|
return timestamp;
|
|
1088
1088
|
}
|
|
1089
1089
|
function uploadWithProgress(options) {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1090
|
+
if (typeof XMLHttpRequest !== "undefined") {
|
|
1091
|
+
return new PromiseProgress((res, rej, prog) => {
|
|
1092
|
+
const xhr = new XMLHttpRequest();
|
|
1093
|
+
const formData2 = new FormData();
|
|
1094
|
+
options.files.forEach((f) => formData2.append("files", f));
|
|
1095
|
+
xhr.withCredentials = !!options.withCredentials;
|
|
1096
|
+
xhr.upload.addEventListener("progress", (event) => event.lengthComputable ? prog(event.loaded / event.total) : null);
|
|
1097
|
+
xhr.addEventListener("loadend", () => res(JSONAttemptParse(xhr.responseText)));
|
|
1098
|
+
xhr.addEventListener("error", () => rej(JSONAttemptParse(xhr.responseText)));
|
|
1099
|
+
xhr.addEventListener("timeout", () => rej({ error: "Request timed out" }));
|
|
1100
|
+
xhr.open("POST", options.url);
|
|
1101
|
+
Object.entries(options.headers || {}).forEach(([key, value]) => xhr.setRequestHeader(key, value));
|
|
1102
|
+
xhr.send(formData2);
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
return new PromiseProgress(async (res, rej) => {
|
|
1106
|
+
try {
|
|
1107
|
+
const formData2 = new FormData();
|
|
1108
|
+
options.files.forEach((f) => formData2.append("files", f));
|
|
1109
|
+
const response = await fetch(options.url, { method: "POST", headers: options.headers || {}, body: formData2 });
|
|
1110
|
+
if (!response.ok) {
|
|
1111
|
+
const error = await response.text();
|
|
1112
|
+
rej(JSONAttemptParse(error));
|
|
1113
|
+
} else {
|
|
1114
|
+
const result = await response.text();
|
|
1115
|
+
res(JSONAttemptParse(result));
|
|
1116
|
+
}
|
|
1117
|
+
} catch (error) {
|
|
1118
|
+
rej(error);
|
|
1119
|
+
}
|
|
1102
1120
|
});
|
|
1103
1121
|
}
|
|
1104
1122
|
class HttpResponse extends Response {
|
|
@@ -1251,8 +1269,10 @@
|
|
|
1251
1269
|
methods;
|
|
1252
1270
|
/** Whether this path contains glob patterns */
|
|
1253
1271
|
hasGlob;
|
|
1254
|
-
/** Internal cache for
|
|
1272
|
+
/** Internal cache for parsed path data (plain objects, not instances) */
|
|
1255
1273
|
static pathEventCache = /* @__PURE__ */ new Map();
|
|
1274
|
+
/** Max size for path cache before LRU eviction */
|
|
1275
|
+
static MAX_PATH_CACHE_SIZE = 1e3;
|
|
1256
1276
|
/** Cache for compiled permissions (path + required permissions → result) */
|
|
1257
1277
|
static permissionCache = /* @__PURE__ */ new Map();
|
|
1258
1278
|
/** Max size for permission cache before LRU eviction */
|
|
@@ -1312,7 +1332,16 @@
|
|
|
1312
1332
|
return;
|
|
1313
1333
|
}
|
|
1314
1334
|
if (PathEvent.pathEventCache.has(e)) {
|
|
1315
|
-
|
|
1335
|
+
const cached = PathEvent.pathEventCache.get(e);
|
|
1336
|
+
PathEvent.pathEventCache.delete(e);
|
|
1337
|
+
PathEvent.pathEventCache.set(e, cached);
|
|
1338
|
+
this.module = cached.module;
|
|
1339
|
+
this.fullPath = cached.fullPath;
|
|
1340
|
+
this.dir = cached.dir;
|
|
1341
|
+
this.path = cached.path;
|
|
1342
|
+
this.name = cached.name;
|
|
1343
|
+
this.methods = new ASet(cached.methods);
|
|
1344
|
+
this.hasGlob = cached.hasGlob;
|
|
1316
1345
|
return;
|
|
1317
1346
|
}
|
|
1318
1347
|
let [p, method] = e.replaceAll(/(^|\/)\*+\/?$/g, "").split(":");
|
|
@@ -1325,7 +1354,19 @@
|
|
|
1325
1354
|
this.name = "";
|
|
1326
1355
|
this.methods = new ASet(p === "*" ? ["*"] : method.split(""));
|
|
1327
1356
|
this.hasGlob = true;
|
|
1328
|
-
PathEvent.pathEventCache.
|
|
1357
|
+
if (PathEvent.pathEventCache.size >= PathEvent.MAX_PATH_CACHE_SIZE) {
|
|
1358
|
+
const firstKey = PathEvent.pathEventCache.keys().next().value;
|
|
1359
|
+
if (firstKey) PathEvent.pathEventCache.delete(firstKey);
|
|
1360
|
+
}
|
|
1361
|
+
PathEvent.pathEventCache.set(e, {
|
|
1362
|
+
module: this.module,
|
|
1363
|
+
fullPath: this.fullPath,
|
|
1364
|
+
dir: this.dir,
|
|
1365
|
+
path: this.path,
|
|
1366
|
+
name: this.name,
|
|
1367
|
+
methods: [...this.methods],
|
|
1368
|
+
hasGlob: this.hasGlob
|
|
1369
|
+
});
|
|
1329
1370
|
return;
|
|
1330
1371
|
}
|
|
1331
1372
|
let temp = p.split("/").filter((p2) => !!p2);
|
|
@@ -1336,7 +1377,19 @@
|
|
|
1336
1377
|
this.name = temp.pop() || "";
|
|
1337
1378
|
this.hasGlob = this.fullPath.includes("*");
|
|
1338
1379
|
this.methods = new ASet(method.split(""));
|
|
1339
|
-
PathEvent.pathEventCache.
|
|
1380
|
+
if (PathEvent.pathEventCache.size >= PathEvent.MAX_PATH_CACHE_SIZE) {
|
|
1381
|
+
const firstKey = PathEvent.pathEventCache.keys().next().value;
|
|
1382
|
+
if (firstKey) PathEvent.pathEventCache.delete(firstKey);
|
|
1383
|
+
}
|
|
1384
|
+
PathEvent.pathEventCache.set(e, {
|
|
1385
|
+
module: this.module,
|
|
1386
|
+
fullPath: this.fullPath,
|
|
1387
|
+
dir: this.dir,
|
|
1388
|
+
path: this.path,
|
|
1389
|
+
name: this.name,
|
|
1390
|
+
methods: [...this.methods],
|
|
1391
|
+
hasGlob: this.hasGlob
|
|
1392
|
+
});
|
|
1340
1393
|
}
|
|
1341
1394
|
/**
|
|
1342
1395
|
* Check if a filter pattern matches a target path
|
|
@@ -1830,13 +1883,29 @@
|
|
|
1830
1883
|
}
|
|
1831
1884
|
momentum;
|
|
1832
1885
|
/**
|
|
1833
|
-
* Manually trigger an actions execution
|
|
1886
|
+
* Manually trigger an actions execution with real-time updates
|
|
1834
1887
|
* @param {string} id Action ID
|
|
1888
|
+
* @param {(payload: ActionUpdate) => any} callback Get updates in real time
|
|
1835
1889
|
* @param {HttpRequestOptions} opts Additional arguments
|
|
1836
|
-
* @return {Promise<
|
|
1890
|
+
* @return {Promise<string>} Run UID for socket subscription
|
|
1891
|
+
*/
|
|
1892
|
+
async debug(id, callback, opts = {}) {
|
|
1893
|
+
const uid = await this.momentum.api.request({ url: `api/actions/debug/${id}`, method: "POST", ...opts }).then((resp) => resp.uid);
|
|
1894
|
+
if (!this.momentum.socket || !callback) return uid;
|
|
1895
|
+
const unsubscribe = this.momentum.socket.on(`actions/${uid}:x`, (event, payload) => {
|
|
1896
|
+
if (payload.return) unsubscribe();
|
|
1897
|
+
callback(payload);
|
|
1898
|
+
});
|
|
1899
|
+
await this.momentum.socket.subscribe(`actions/${uid}`);
|
|
1900
|
+
return uid;
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Terminate a running action
|
|
1904
|
+
* @param {string} id Action ID
|
|
1905
|
+
* @return {Promise<boolean>} Success status
|
|
1837
1906
|
*/
|
|
1838
|
-
|
|
1839
|
-
return this.momentum.api.request({ url: `api/actions/
|
|
1907
|
+
terminate(id) {
|
|
1908
|
+
return this.momentum.api.request({ url: `api/actions/terminate/${id}`, method: "POST" }).then((resp) => resp.success);
|
|
1840
1909
|
}
|
|
1841
1910
|
/**
|
|
1842
1911
|
* Run an HTTP action
|
|
@@ -1845,7 +1914,7 @@
|
|
|
1845
1914
|
* @return {Promise<T>} HTTP response
|
|
1846
1915
|
*/
|
|
1847
1916
|
run(path, opts = {}) {
|
|
1848
|
-
return this.momentum.api.request({ ...opts, url: `api/
|
|
1917
|
+
return this.momentum.api.request({ ...opts, url: `api${path.startsWith("/") ? "" : "/"}${path}` });
|
|
1849
1918
|
}
|
|
1850
1919
|
}
|
|
1851
1920
|
class Agents extends AssetController {
|
|
@@ -1891,7 +1960,7 @@
|
|
|
1891
1960
|
reader.onload = () => res([f.name, reader.result]);
|
|
1892
1961
|
reader.readAsDataURL(f);
|
|
1893
1962
|
})))).reduce((acc, f) => ({ ...acc, [f[0]]: f[1] }), {});
|
|
1894
|
-
const q = {
|
|
1963
|
+
const q = { ...options, question: question.trim(), files: Object.keys(files).length ? files : void 0 };
|
|
1895
1964
|
if (options.stream && this.momentum.socket?.connected) {
|
|
1896
1965
|
let unsub = () => {
|
|
1897
1966
|
};
|
|
@@ -3128,40 +3197,51 @@ Must be either: call, email or sms`);
|
|
|
3128
3197
|
}
|
|
3129
3198
|
momentum;
|
|
3130
3199
|
subscribers = {};
|
|
3200
|
+
dataUrl(collection, pk, filter, options) {
|
|
3201
|
+
const params = new URLSearchParams();
|
|
3202
|
+
if (filter) params.set("q", JSON.stringify(filter));
|
|
3203
|
+
Object.entries(options ?? {}).forEach(([key, value]) => {
|
|
3204
|
+
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
3205
|
+
});
|
|
3206
|
+
const query = params.toString();
|
|
3207
|
+
return `api/data/${collection}${pk != null ? `/${pk}` : ""}${query ? `?${query}` : ""}`;
|
|
3208
|
+
}
|
|
3131
3209
|
/**
|
|
3132
|
-
* Create new document in collection
|
|
3210
|
+
* Create new document(s) in collection
|
|
3133
3211
|
* @param {string} collection Target collection
|
|
3134
|
-
* @param {Document<T>}
|
|
3135
|
-
* @return {Promise<Document<T
|
|
3212
|
+
* @param {Document<T> | Document<T>[]} documents New document(s)
|
|
3213
|
+
* @return {Promise<Document<T> | Document<T>[]>} New saved document(s)
|
|
3136
3214
|
*/
|
|
3137
|
-
create(collection,
|
|
3138
|
-
if (!collection || !
|
|
3215
|
+
create(collection, documents) {
|
|
3216
|
+
if (!collection || !documents) throw new Error("Cannot create document, missing collection or document");
|
|
3139
3217
|
return this.momentum.api.request({
|
|
3140
3218
|
url: `api/` + PES`data/${collection}`,
|
|
3141
3219
|
method: "POST",
|
|
3142
|
-
body:
|
|
3220
|
+
body: documents
|
|
3143
3221
|
}).then((resp) => {
|
|
3144
|
-
|
|
3222
|
+
if (!resp) return null;
|
|
3223
|
+
makeArray(resp).forEach((r) => this.emit(PES`data/${collection}/${r._id}:c`, r));
|
|
3145
3224
|
return resp;
|
|
3146
3225
|
});
|
|
3147
3226
|
}
|
|
3148
|
-
async delete(collection, filter) {
|
|
3149
|
-
if (!collection ||
|
|
3150
|
-
const pk = typeof filter == "object" ? filter?.
|
|
3151
|
-
const q = typeof filter == "object" ?
|
|
3152
|
-
const url =
|
|
3227
|
+
async delete(collection, filter, options) {
|
|
3228
|
+
if (!collection || filter == null) throw new Error("Cannot delete document, missing collection or filter");
|
|
3229
|
+
const pk = typeof filter == "object" ? filter?._id ?? null : filter;
|
|
3230
|
+
const q = typeof filter == "object" && pk == null ? filter : null;
|
|
3231
|
+
const url = this.dataUrl(collection, pk, q, options);
|
|
3153
3232
|
const ids = await this.momentum.api.request({ url, method: "DELETE" });
|
|
3154
3233
|
ids.forEach((id) => this.emit(PES`data/${collection}/${id}:d`, id));
|
|
3155
3234
|
return ids;
|
|
3156
3235
|
}
|
|
3157
|
-
read(collection, filter) {
|
|
3236
|
+
read(collection, filter, options) {
|
|
3158
3237
|
if (!collection) throw new Error("Cannot read documents, missing collection");
|
|
3159
3238
|
const pk = typeof filter == "object" ? filter?.["_id"] ?? null : filter;
|
|
3160
|
-
const q = typeof filter == "object"
|
|
3161
|
-
const url =
|
|
3239
|
+
const q = typeof filter == "object" && filter != null && Object.keys(filter).length && pk == null ? filter : null;
|
|
3240
|
+
const url = this.dataUrl(collection, pk, q, options);
|
|
3162
3241
|
return this.momentum.api.request({ url }).then((resp) => {
|
|
3242
|
+
if (!resp) return null;
|
|
3163
3243
|
if (Array.isArray(resp)) {
|
|
3164
|
-
if (!q) this.emit(PES`data/${collection}:r`, collection, resp);
|
|
3244
|
+
if (!q && !options?.limit) this.emit(PES`data/${collection}:r`, collection, resp);
|
|
3165
3245
|
else resp.forEach((r) => this.emit(PES`data/${collection}/${r._id}:r`, collection, resp));
|
|
3166
3246
|
} else {
|
|
3167
3247
|
this.emit(PES`data/${collection}/${resp._id}:r`, collection, resp);
|
|
@@ -3170,31 +3250,34 @@ Must be either: call, email or sms`);
|
|
|
3170
3250
|
});
|
|
3171
3251
|
}
|
|
3172
3252
|
/**
|
|
3173
|
-
* Update document in collection
|
|
3253
|
+
* Update document(s) in collection
|
|
3174
3254
|
* @param {string} collection Target collection
|
|
3175
|
-
* @param {Document<T>}
|
|
3176
|
-
* @param {
|
|
3255
|
+
* @param {Document<T> | Document<T>[]} documents Document(s) to update
|
|
3256
|
+
* @param {UpdateOptions<T>} options Update options (filter, append, limit, upsert)
|
|
3177
3257
|
* @return {Promise<Document<T> | Document<T>[]>} Updated document(s)
|
|
3178
3258
|
*/
|
|
3179
|
-
update(collection,
|
|
3180
|
-
if (!collection || !
|
|
3181
|
-
const
|
|
3182
|
-
const
|
|
3183
|
-
const
|
|
3259
|
+
update(collection, documents, options = {}) {
|
|
3260
|
+
if (!collection || !documents) throw new Error("Cannot update document, missing collection or document");
|
|
3261
|
+
const { filter, append, ...queryOptions } = options;
|
|
3262
|
+
const isArray = Array.isArray(documents);
|
|
3263
|
+
const firstDoc = isArray ? documents[0] : documents;
|
|
3264
|
+
const pk = isArray ? null : filter ? filter?._id ?? firstDoc._id : firstDoc._id;
|
|
3265
|
+
const q = filter && filter?._id == null ? filter : null;
|
|
3266
|
+
const url = this.dataUrl(collection, pk, q, queryOptions);
|
|
3184
3267
|
return this.momentum.api.request({
|
|
3185
3268
|
url,
|
|
3186
|
-
method:
|
|
3187
|
-
body:
|
|
3269
|
+
method: append === false ? "PUT" : "PATCH",
|
|
3270
|
+
body: documents
|
|
3188
3271
|
}).then((resp) => {
|
|
3189
|
-
if (
|
|
3190
|
-
|
|
3272
|
+
if (!resp) return null;
|
|
3273
|
+
makeArray(resp).forEach((r) => this.emit(PES`data/${collection}/${r._id}:u`, r));
|
|
3191
3274
|
return resp;
|
|
3192
3275
|
});
|
|
3193
3276
|
}
|
|
3194
3277
|
/**
|
|
3195
|
-
*
|
|
3278
|
+
* Execute raw MongoDB query
|
|
3196
3279
|
* @param {string} collection Target collection name
|
|
3197
|
-
* @param {RawQuery} query Raw query
|
|
3280
|
+
* @param {RawQuery} query Raw MongoDB query object
|
|
3198
3281
|
* @return {Promise<any>} Query response
|
|
3199
3282
|
*/
|
|
3200
3283
|
raw(collection, query) {
|
|
@@ -3206,11 +3289,11 @@ Must be either: call, email or sms`);
|
|
|
3206
3289
|
});
|
|
3207
3290
|
}
|
|
3208
3291
|
/**
|
|
3209
|
-
* Subscribe to live updates
|
|
3210
|
-
* @param path
|
|
3211
|
-
* @param {(value: T[]) => any
|
|
3212
|
-
* @param opts
|
|
3213
|
-
* @return {
|
|
3292
|
+
* Subscribe to live data updates
|
|
3293
|
+
* @param {string} path Data path to subscribe to
|
|
3294
|
+
* @param {(value: T | T[]) => any} callback Function called with updated data
|
|
3295
|
+
* @param {object} opts Options object with reload flag
|
|
3296
|
+
* @return {Unsubscribe} Function to unsubscribe from updates
|
|
3214
3297
|
*/
|
|
3215
3298
|
sync(path, callback, opts = {}) {
|
|
3216
3299
|
const e = PES`data/${path}`;
|
|
@@ -4023,17 +4106,11 @@ ${log}`;
|
|
|
4023
4106
|
/**
|
|
4024
4107
|
* Download module
|
|
4025
4108
|
* @param {string} path Path to target
|
|
4026
|
-
* @param {
|
|
4109
|
+
* @param {rename?: string} rename Rename file on download
|
|
4027
4110
|
* @return {PromiseProgress<Blob>} File as blob with progress tracking
|
|
4028
4111
|
*/
|
|
4029
|
-
download(path,
|
|
4030
|
-
|
|
4031
|
-
return this.momentum.api.request({ url: `api/${this.module}/${path}?download=true`, decode: false }).then(async (response) => {
|
|
4032
|
-
const blob = await response.blob();
|
|
4033
|
-
const name = opts.downloadAs || path.split("/").pop();
|
|
4034
|
-
downloadFile(blob, name);
|
|
4035
|
-
return response;
|
|
4036
|
-
});
|
|
4112
|
+
download(path, rename) {
|
|
4113
|
+
return this.open(path, rename || "download");
|
|
4037
4114
|
}
|
|
4038
4115
|
/**
|
|
4039
4116
|
* Retrieve file/folder metadata
|
|
@@ -4073,11 +4150,19 @@ ${log}`;
|
|
|
4073
4150
|
return response;
|
|
4074
4151
|
});
|
|
4075
4152
|
}
|
|
4076
|
-
open(path, target = "_blank") {
|
|
4153
|
+
open(path, target = typeof window !== "undefined" ? "_blank" : "blob") {
|
|
4077
4154
|
if (!path) throw new Error("Cannot download file, missing module");
|
|
4078
4155
|
const link = `${this.momentum.url.toString()}api/${this.module}/${path}`.replaceAll(/([^:])\/+/g, "$1/") + (!this.momentum.api.sameOrigin && this.momentum.api.token ? `?token=${this.momentum.api.token}` : "");
|
|
4079
|
-
if (
|
|
4080
|
-
return window.open(link, target);
|
|
4156
|
+
if (target === "url" || target === false) return link;
|
|
4157
|
+
if (target === "_blank" || target == "_self") return window.open(link, target);
|
|
4158
|
+
return this.momentum.api.request({ url: `api/${this.module}/${path}?download=true`, decode: false }).then(async (response) => {
|
|
4159
|
+
const blob = await response.blob();
|
|
4160
|
+
if (target !== "blob") {
|
|
4161
|
+
const name = target === "download" ? path.split("/").pop() : target;
|
|
4162
|
+
downloadFile(blob, name);
|
|
4163
|
+
}
|
|
4164
|
+
return blob;
|
|
4165
|
+
});
|
|
4081
4166
|
}
|
|
4082
4167
|
text(path, set) {
|
|
4083
4168
|
if (!path) throw new Error("Missing path");
|
|
@@ -4256,7 +4341,7 @@ ${log}`;
|
|
|
4256
4341
|
}
|
|
4257
4342
|
momentum;
|
|
4258
4343
|
}
|
|
4259
|
-
const version = "1.4.
|
|
4344
|
+
const version = "1.4.2";
|
|
4260
4345
|
class WebRtc extends PathEventEmitter {
|
|
4261
4346
|
constructor(momentum) {
|
|
4262
4347
|
super("webrtc");
|
|
@@ -4377,18 +4462,46 @@ ${log}`;
|
|
|
4377
4462
|
this.momentum = momentum;
|
|
4378
4463
|
}
|
|
4379
4464
|
momentum;
|
|
4465
|
+
static create = (event) => new PathEvent(event);
|
|
4466
|
+
static combine = PathEvent.combine;
|
|
4467
|
+
static filter = PathEvent.filter;
|
|
4468
|
+
static has = PathEvent.has;
|
|
4469
|
+
static hasFatal = PathEvent.hasFatal;
|
|
4470
|
+
static hasAll = PathEvent.hasAll;
|
|
4471
|
+
static hasAllFatal = PathEvent.hasAllFatal;
|
|
4380
4472
|
/** Get all permissions */
|
|
4381
4473
|
all = () => this.momentum.auth.session?.permissions || [];
|
|
4474
|
+
combine(...events) {
|
|
4475
|
+
return PathEvent.combine(...events);
|
|
4476
|
+
}
|
|
4477
|
+
create(event) {
|
|
4478
|
+
return new PathEvent(event);
|
|
4479
|
+
}
|
|
4382
4480
|
/** Filter list of permissions to ones the user has */
|
|
4383
|
-
filter = (...events) =>
|
|
4481
|
+
filter = (...events) => {
|
|
4482
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4483
|
+
return PathEvent.filter(check, ...events.flat());
|
|
4484
|
+
};
|
|
4384
4485
|
/** Does user have any permissions (or) */
|
|
4385
|
-
has = (...events) =>
|
|
4486
|
+
has = (...events) => {
|
|
4487
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4488
|
+
return PathEvent.has(check, ...events.flat());
|
|
4489
|
+
};
|
|
4386
4490
|
/** Does user have all permissions (and) */
|
|
4387
|
-
hasAll = (...events) =>
|
|
4491
|
+
hasAll = (...events) => {
|
|
4492
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4493
|
+
return PathEvent.hasAll(check, ...events.flat());
|
|
4494
|
+
};
|
|
4388
4495
|
/** Raise error if user has no permissions (or) */
|
|
4389
|
-
hasFatal = (...events) =>
|
|
4496
|
+
hasFatal = (...events) => {
|
|
4497
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4498
|
+
return PathEvent.hasFatal(check, ...events.flat());
|
|
4499
|
+
};
|
|
4390
4500
|
/** Raise error if user missing any permissions (and) */
|
|
4391
|
-
hasAllFatal = (...events) =>
|
|
4501
|
+
hasAllFatal = (...events) => {
|
|
4502
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4503
|
+
return PathEvent.hasAllFatal(check, ...events.flat());
|
|
4504
|
+
};
|
|
4392
4505
|
}
|
|
4393
4506
|
class Momentum extends PathEventEmitter {
|
|
4394
4507
|
static pathEvent = PathEvent;
|
package/dist/index.mjs
CHANGED
|
@@ -1083,18 +1083,36 @@ function timestampFilename(name, date = /* @__PURE__ */ new Date()) {
|
|
|
1083
1083
|
return timestamp;
|
|
1084
1084
|
}
|
|
1085
1085
|
function uploadWithProgress(options) {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1086
|
+
if (typeof XMLHttpRequest !== "undefined") {
|
|
1087
|
+
return new PromiseProgress((res, rej, prog) => {
|
|
1088
|
+
const xhr = new XMLHttpRequest();
|
|
1089
|
+
const formData2 = new FormData();
|
|
1090
|
+
options.files.forEach((f) => formData2.append("files", f));
|
|
1091
|
+
xhr.withCredentials = !!options.withCredentials;
|
|
1092
|
+
xhr.upload.addEventListener("progress", (event) => event.lengthComputable ? prog(event.loaded / event.total) : null);
|
|
1093
|
+
xhr.addEventListener("loadend", () => res(JSONAttemptParse(xhr.responseText)));
|
|
1094
|
+
xhr.addEventListener("error", () => rej(JSONAttemptParse(xhr.responseText)));
|
|
1095
|
+
xhr.addEventListener("timeout", () => rej({ error: "Request timed out" }));
|
|
1096
|
+
xhr.open("POST", options.url);
|
|
1097
|
+
Object.entries(options.headers || {}).forEach(([key, value]) => xhr.setRequestHeader(key, value));
|
|
1098
|
+
xhr.send(formData2);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
return new PromiseProgress(async (res, rej) => {
|
|
1102
|
+
try {
|
|
1103
|
+
const formData2 = new FormData();
|
|
1104
|
+
options.files.forEach((f) => formData2.append("files", f));
|
|
1105
|
+
const response = await fetch(options.url, { method: "POST", headers: options.headers || {}, body: formData2 });
|
|
1106
|
+
if (!response.ok) {
|
|
1107
|
+
const error = await response.text();
|
|
1108
|
+
rej(JSONAttemptParse(error));
|
|
1109
|
+
} else {
|
|
1110
|
+
const result = await response.text();
|
|
1111
|
+
res(JSONAttemptParse(result));
|
|
1112
|
+
}
|
|
1113
|
+
} catch (error) {
|
|
1114
|
+
rej(error);
|
|
1115
|
+
}
|
|
1098
1116
|
});
|
|
1099
1117
|
}
|
|
1100
1118
|
class HttpResponse extends Response {
|
|
@@ -1247,8 +1265,10 @@ class PathEvent {
|
|
|
1247
1265
|
methods;
|
|
1248
1266
|
/** Whether this path contains glob patterns */
|
|
1249
1267
|
hasGlob;
|
|
1250
|
-
/** Internal cache for
|
|
1268
|
+
/** Internal cache for parsed path data (plain objects, not instances) */
|
|
1251
1269
|
static pathEventCache = /* @__PURE__ */ new Map();
|
|
1270
|
+
/** Max size for path cache before LRU eviction */
|
|
1271
|
+
static MAX_PATH_CACHE_SIZE = 1e3;
|
|
1252
1272
|
/** Cache for compiled permissions (path + required permissions → result) */
|
|
1253
1273
|
static permissionCache = /* @__PURE__ */ new Map();
|
|
1254
1274
|
/** Max size for permission cache before LRU eviction */
|
|
@@ -1308,7 +1328,16 @@ class PathEvent {
|
|
|
1308
1328
|
return;
|
|
1309
1329
|
}
|
|
1310
1330
|
if (PathEvent.pathEventCache.has(e)) {
|
|
1311
|
-
|
|
1331
|
+
const cached = PathEvent.pathEventCache.get(e);
|
|
1332
|
+
PathEvent.pathEventCache.delete(e);
|
|
1333
|
+
PathEvent.pathEventCache.set(e, cached);
|
|
1334
|
+
this.module = cached.module;
|
|
1335
|
+
this.fullPath = cached.fullPath;
|
|
1336
|
+
this.dir = cached.dir;
|
|
1337
|
+
this.path = cached.path;
|
|
1338
|
+
this.name = cached.name;
|
|
1339
|
+
this.methods = new ASet(cached.methods);
|
|
1340
|
+
this.hasGlob = cached.hasGlob;
|
|
1312
1341
|
return;
|
|
1313
1342
|
}
|
|
1314
1343
|
let [p, method] = e.replaceAll(/(^|\/)\*+\/?$/g, "").split(":");
|
|
@@ -1321,7 +1350,19 @@ class PathEvent {
|
|
|
1321
1350
|
this.name = "";
|
|
1322
1351
|
this.methods = new ASet(p === "*" ? ["*"] : method.split(""));
|
|
1323
1352
|
this.hasGlob = true;
|
|
1324
|
-
PathEvent.pathEventCache.
|
|
1353
|
+
if (PathEvent.pathEventCache.size >= PathEvent.MAX_PATH_CACHE_SIZE) {
|
|
1354
|
+
const firstKey = PathEvent.pathEventCache.keys().next().value;
|
|
1355
|
+
if (firstKey) PathEvent.pathEventCache.delete(firstKey);
|
|
1356
|
+
}
|
|
1357
|
+
PathEvent.pathEventCache.set(e, {
|
|
1358
|
+
module: this.module,
|
|
1359
|
+
fullPath: this.fullPath,
|
|
1360
|
+
dir: this.dir,
|
|
1361
|
+
path: this.path,
|
|
1362
|
+
name: this.name,
|
|
1363
|
+
methods: [...this.methods],
|
|
1364
|
+
hasGlob: this.hasGlob
|
|
1365
|
+
});
|
|
1325
1366
|
return;
|
|
1326
1367
|
}
|
|
1327
1368
|
let temp = p.split("/").filter((p2) => !!p2);
|
|
@@ -1332,7 +1373,19 @@ class PathEvent {
|
|
|
1332
1373
|
this.name = temp.pop() || "";
|
|
1333
1374
|
this.hasGlob = this.fullPath.includes("*");
|
|
1334
1375
|
this.methods = new ASet(method.split(""));
|
|
1335
|
-
PathEvent.pathEventCache.
|
|
1376
|
+
if (PathEvent.pathEventCache.size >= PathEvent.MAX_PATH_CACHE_SIZE) {
|
|
1377
|
+
const firstKey = PathEvent.pathEventCache.keys().next().value;
|
|
1378
|
+
if (firstKey) PathEvent.pathEventCache.delete(firstKey);
|
|
1379
|
+
}
|
|
1380
|
+
PathEvent.pathEventCache.set(e, {
|
|
1381
|
+
module: this.module,
|
|
1382
|
+
fullPath: this.fullPath,
|
|
1383
|
+
dir: this.dir,
|
|
1384
|
+
path: this.path,
|
|
1385
|
+
name: this.name,
|
|
1386
|
+
methods: [...this.methods],
|
|
1387
|
+
hasGlob: this.hasGlob
|
|
1388
|
+
});
|
|
1336
1389
|
}
|
|
1337
1390
|
/**
|
|
1338
1391
|
* Check if a filter pattern matches a target path
|
|
@@ -1826,13 +1879,29 @@ class Actions extends AssetController {
|
|
|
1826
1879
|
}
|
|
1827
1880
|
momentum;
|
|
1828
1881
|
/**
|
|
1829
|
-
* Manually trigger an actions execution
|
|
1882
|
+
* Manually trigger an actions execution with real-time updates
|
|
1830
1883
|
* @param {string} id Action ID
|
|
1884
|
+
* @param {(payload: ActionUpdate) => any} callback Get updates in real time
|
|
1831
1885
|
* @param {HttpRequestOptions} opts Additional arguments
|
|
1832
|
-
* @return {Promise<
|
|
1886
|
+
* @return {Promise<string>} Run UID for socket subscription
|
|
1887
|
+
*/
|
|
1888
|
+
async debug(id, callback, opts = {}) {
|
|
1889
|
+
const uid = await this.momentum.api.request({ url: `api/actions/debug/${id}`, method: "POST", ...opts }).then((resp) => resp.uid);
|
|
1890
|
+
if (!this.momentum.socket || !callback) return uid;
|
|
1891
|
+
const unsubscribe = this.momentum.socket.on(`actions/${uid}:x`, (event, payload) => {
|
|
1892
|
+
if (payload.return) unsubscribe();
|
|
1893
|
+
callback(payload);
|
|
1894
|
+
});
|
|
1895
|
+
await this.momentum.socket.subscribe(`actions/${uid}`);
|
|
1896
|
+
return uid;
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Terminate a running action
|
|
1900
|
+
* @param {string} id Action ID
|
|
1901
|
+
* @return {Promise<boolean>} Success status
|
|
1833
1902
|
*/
|
|
1834
|
-
|
|
1835
|
-
return this.momentum.api.request({ url: `api/actions/
|
|
1903
|
+
terminate(id) {
|
|
1904
|
+
return this.momentum.api.request({ url: `api/actions/terminate/${id}`, method: "POST" }).then((resp) => resp.success);
|
|
1836
1905
|
}
|
|
1837
1906
|
/**
|
|
1838
1907
|
* Run an HTTP action
|
|
@@ -1841,7 +1910,7 @@ class Actions extends AssetController {
|
|
|
1841
1910
|
* @return {Promise<T>} HTTP response
|
|
1842
1911
|
*/
|
|
1843
1912
|
run(path, opts = {}) {
|
|
1844
|
-
return this.momentum.api.request({ ...opts, url: `api/
|
|
1913
|
+
return this.momentum.api.request({ ...opts, url: `api${path.startsWith("/") ? "" : "/"}${path}` });
|
|
1845
1914
|
}
|
|
1846
1915
|
}
|
|
1847
1916
|
class Agents extends AssetController {
|
|
@@ -1887,7 +1956,7 @@ class Ai extends PathEventEmitter {
|
|
|
1887
1956
|
reader.onload = () => res([f.name, reader.result]);
|
|
1888
1957
|
reader.readAsDataURL(f);
|
|
1889
1958
|
})))).reduce((acc, f) => ({ ...acc, [f[0]]: f[1] }), {});
|
|
1890
|
-
const q = {
|
|
1959
|
+
const q = { ...options, question: question.trim(), files: Object.keys(files).length ? files : void 0 };
|
|
1891
1960
|
if (options.stream && this.momentum.socket?.connected) {
|
|
1892
1961
|
let unsub = () => {
|
|
1893
1962
|
};
|
|
@@ -3124,40 +3193,51 @@ class Data extends PathEventEmitter {
|
|
|
3124
3193
|
}
|
|
3125
3194
|
momentum;
|
|
3126
3195
|
subscribers = {};
|
|
3196
|
+
dataUrl(collection, pk, filter, options) {
|
|
3197
|
+
const params = new URLSearchParams();
|
|
3198
|
+
if (filter) params.set("q", JSON.stringify(filter));
|
|
3199
|
+
Object.entries(options ?? {}).forEach(([key, value]) => {
|
|
3200
|
+
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
3201
|
+
});
|
|
3202
|
+
const query = params.toString();
|
|
3203
|
+
return `api/data/${collection}${pk != null ? `/${pk}` : ""}${query ? `?${query}` : ""}`;
|
|
3204
|
+
}
|
|
3127
3205
|
/**
|
|
3128
|
-
* Create new document in collection
|
|
3206
|
+
* Create new document(s) in collection
|
|
3129
3207
|
* @param {string} collection Target collection
|
|
3130
|
-
* @param {Document<T>}
|
|
3131
|
-
* @return {Promise<Document<T
|
|
3208
|
+
* @param {Document<T> | Document<T>[]} documents New document(s)
|
|
3209
|
+
* @return {Promise<Document<T> | Document<T>[]>} New saved document(s)
|
|
3132
3210
|
*/
|
|
3133
|
-
create(collection,
|
|
3134
|
-
if (!collection || !
|
|
3211
|
+
create(collection, documents) {
|
|
3212
|
+
if (!collection || !documents) throw new Error("Cannot create document, missing collection or document");
|
|
3135
3213
|
return this.momentum.api.request({
|
|
3136
3214
|
url: `api/` + PES`data/${collection}`,
|
|
3137
3215
|
method: "POST",
|
|
3138
|
-
body:
|
|
3216
|
+
body: documents
|
|
3139
3217
|
}).then((resp) => {
|
|
3140
|
-
|
|
3218
|
+
if (!resp) return null;
|
|
3219
|
+
makeArray(resp).forEach((r) => this.emit(PES`data/${collection}/${r._id}:c`, r));
|
|
3141
3220
|
return resp;
|
|
3142
3221
|
});
|
|
3143
3222
|
}
|
|
3144
|
-
async delete(collection, filter) {
|
|
3145
|
-
if (!collection ||
|
|
3146
|
-
const pk = typeof filter == "object" ? filter?.
|
|
3147
|
-
const q = typeof filter == "object" ?
|
|
3148
|
-
const url =
|
|
3223
|
+
async delete(collection, filter, options) {
|
|
3224
|
+
if (!collection || filter == null) throw new Error("Cannot delete document, missing collection or filter");
|
|
3225
|
+
const pk = typeof filter == "object" ? filter?._id ?? null : filter;
|
|
3226
|
+
const q = typeof filter == "object" && pk == null ? filter : null;
|
|
3227
|
+
const url = this.dataUrl(collection, pk, q, options);
|
|
3149
3228
|
const ids = await this.momentum.api.request({ url, method: "DELETE" });
|
|
3150
3229
|
ids.forEach((id) => this.emit(PES`data/${collection}/${id}:d`, id));
|
|
3151
3230
|
return ids;
|
|
3152
3231
|
}
|
|
3153
|
-
read(collection, filter) {
|
|
3232
|
+
read(collection, filter, options) {
|
|
3154
3233
|
if (!collection) throw new Error("Cannot read documents, missing collection");
|
|
3155
3234
|
const pk = typeof filter == "object" ? filter?.["_id"] ?? null : filter;
|
|
3156
|
-
const q = typeof filter == "object"
|
|
3157
|
-
const url =
|
|
3235
|
+
const q = typeof filter == "object" && filter != null && Object.keys(filter).length && pk == null ? filter : null;
|
|
3236
|
+
const url = this.dataUrl(collection, pk, q, options);
|
|
3158
3237
|
return this.momentum.api.request({ url }).then((resp) => {
|
|
3238
|
+
if (!resp) return null;
|
|
3159
3239
|
if (Array.isArray(resp)) {
|
|
3160
|
-
if (!q) this.emit(PES`data/${collection}:r`, collection, resp);
|
|
3240
|
+
if (!q && !options?.limit) this.emit(PES`data/${collection}:r`, collection, resp);
|
|
3161
3241
|
else resp.forEach((r) => this.emit(PES`data/${collection}/${r._id}:r`, collection, resp));
|
|
3162
3242
|
} else {
|
|
3163
3243
|
this.emit(PES`data/${collection}/${resp._id}:r`, collection, resp);
|
|
@@ -3166,31 +3246,34 @@ class Data extends PathEventEmitter {
|
|
|
3166
3246
|
});
|
|
3167
3247
|
}
|
|
3168
3248
|
/**
|
|
3169
|
-
* Update document in collection
|
|
3249
|
+
* Update document(s) in collection
|
|
3170
3250
|
* @param {string} collection Target collection
|
|
3171
|
-
* @param {Document<T>}
|
|
3172
|
-
* @param {
|
|
3251
|
+
* @param {Document<T> | Document<T>[]} documents Document(s) to update
|
|
3252
|
+
* @param {UpdateOptions<T>} options Update options (filter, append, limit, upsert)
|
|
3173
3253
|
* @return {Promise<Document<T> | Document<T>[]>} Updated document(s)
|
|
3174
3254
|
*/
|
|
3175
|
-
update(collection,
|
|
3176
|
-
if (!collection || !
|
|
3177
|
-
const
|
|
3178
|
-
const
|
|
3179
|
-
const
|
|
3255
|
+
update(collection, documents, options = {}) {
|
|
3256
|
+
if (!collection || !documents) throw new Error("Cannot update document, missing collection or document");
|
|
3257
|
+
const { filter, append, ...queryOptions } = options;
|
|
3258
|
+
const isArray = Array.isArray(documents);
|
|
3259
|
+
const firstDoc = isArray ? documents[0] : documents;
|
|
3260
|
+
const pk = isArray ? null : filter ? filter?._id ?? firstDoc._id : firstDoc._id;
|
|
3261
|
+
const q = filter && filter?._id == null ? filter : null;
|
|
3262
|
+
const url = this.dataUrl(collection, pk, q, queryOptions);
|
|
3180
3263
|
return this.momentum.api.request({
|
|
3181
3264
|
url,
|
|
3182
|
-
method:
|
|
3183
|
-
body:
|
|
3265
|
+
method: append === false ? "PUT" : "PATCH",
|
|
3266
|
+
body: documents
|
|
3184
3267
|
}).then((resp) => {
|
|
3185
|
-
if (
|
|
3186
|
-
|
|
3268
|
+
if (!resp) return null;
|
|
3269
|
+
makeArray(resp).forEach((r) => this.emit(PES`data/${collection}/${r._id}:u`, r));
|
|
3187
3270
|
return resp;
|
|
3188
3271
|
});
|
|
3189
3272
|
}
|
|
3190
3273
|
/**
|
|
3191
|
-
*
|
|
3274
|
+
* Execute raw MongoDB query
|
|
3192
3275
|
* @param {string} collection Target collection name
|
|
3193
|
-
* @param {RawQuery} query Raw query
|
|
3276
|
+
* @param {RawQuery} query Raw MongoDB query object
|
|
3194
3277
|
* @return {Promise<any>} Query response
|
|
3195
3278
|
*/
|
|
3196
3279
|
raw(collection, query) {
|
|
@@ -3202,11 +3285,11 @@ class Data extends PathEventEmitter {
|
|
|
3202
3285
|
});
|
|
3203
3286
|
}
|
|
3204
3287
|
/**
|
|
3205
|
-
* Subscribe to live updates
|
|
3206
|
-
* @param path
|
|
3207
|
-
* @param {(value: T[]) => any
|
|
3208
|
-
* @param opts
|
|
3209
|
-
* @return {
|
|
3288
|
+
* Subscribe to live data updates
|
|
3289
|
+
* @param {string} path Data path to subscribe to
|
|
3290
|
+
* @param {(value: T | T[]) => any} callback Function called with updated data
|
|
3291
|
+
* @param {object} opts Options object with reload flag
|
|
3292
|
+
* @return {Unsubscribe} Function to unsubscribe from updates
|
|
3210
3293
|
*/
|
|
3211
3294
|
sync(path, callback, opts = {}) {
|
|
3212
3295
|
const e = PES`data/${path}`;
|
|
@@ -4019,17 +4102,11 @@ class Storage extends PathEventEmitter {
|
|
|
4019
4102
|
/**
|
|
4020
4103
|
* Download module
|
|
4021
4104
|
* @param {string} path Path to target
|
|
4022
|
-
* @param {
|
|
4105
|
+
* @param {rename?: string} rename Rename file on download
|
|
4023
4106
|
* @return {PromiseProgress<Blob>} File as blob with progress tracking
|
|
4024
4107
|
*/
|
|
4025
|
-
download(path,
|
|
4026
|
-
|
|
4027
|
-
return this.momentum.api.request({ url: `api/${this.module}/${path}?download=true`, decode: false }).then(async (response) => {
|
|
4028
|
-
const blob = await response.blob();
|
|
4029
|
-
const name = opts.downloadAs || path.split("/").pop();
|
|
4030
|
-
downloadFile(blob, name);
|
|
4031
|
-
return response;
|
|
4032
|
-
});
|
|
4108
|
+
download(path, rename) {
|
|
4109
|
+
return this.open(path, rename || "download");
|
|
4033
4110
|
}
|
|
4034
4111
|
/**
|
|
4035
4112
|
* Retrieve file/folder metadata
|
|
@@ -4069,11 +4146,19 @@ class Storage extends PathEventEmitter {
|
|
|
4069
4146
|
return response;
|
|
4070
4147
|
});
|
|
4071
4148
|
}
|
|
4072
|
-
open(path, target = "_blank") {
|
|
4149
|
+
open(path, target = typeof window !== "undefined" ? "_blank" : "blob") {
|
|
4073
4150
|
if (!path) throw new Error("Cannot download file, missing module");
|
|
4074
4151
|
const link = `${this.momentum.url.toString()}api/${this.module}/${path}`.replaceAll(/([^:])\/+/g, "$1/") + (!this.momentum.api.sameOrigin && this.momentum.api.token ? `?token=${this.momentum.api.token}` : "");
|
|
4075
|
-
if (
|
|
4076
|
-
return window.open(link, target);
|
|
4152
|
+
if (target === "url" || target === false) return link;
|
|
4153
|
+
if (target === "_blank" || target == "_self") return window.open(link, target);
|
|
4154
|
+
return this.momentum.api.request({ url: `api/${this.module}/${path}?download=true`, decode: false }).then(async (response) => {
|
|
4155
|
+
const blob = await response.blob();
|
|
4156
|
+
if (target !== "blob") {
|
|
4157
|
+
const name = target === "download" ? path.split("/").pop() : target;
|
|
4158
|
+
downloadFile(blob, name);
|
|
4159
|
+
}
|
|
4160
|
+
return blob;
|
|
4161
|
+
});
|
|
4077
4162
|
}
|
|
4078
4163
|
text(path, set) {
|
|
4079
4164
|
if (!path) throw new Error("Missing path");
|
|
@@ -4252,7 +4337,7 @@ class Static extends Storage {
|
|
|
4252
4337
|
}
|
|
4253
4338
|
momentum;
|
|
4254
4339
|
}
|
|
4255
|
-
const version = "1.4.
|
|
4340
|
+
const version = "1.4.2";
|
|
4256
4341
|
class WebRtc extends PathEventEmitter {
|
|
4257
4342
|
constructor(momentum) {
|
|
4258
4343
|
super("webrtc");
|
|
@@ -4373,18 +4458,46 @@ class Permissions {
|
|
|
4373
4458
|
this.momentum = momentum;
|
|
4374
4459
|
}
|
|
4375
4460
|
momentum;
|
|
4461
|
+
static create = (event) => new PathEvent(event);
|
|
4462
|
+
static combine = PathEvent.combine;
|
|
4463
|
+
static filter = PathEvent.filter;
|
|
4464
|
+
static has = PathEvent.has;
|
|
4465
|
+
static hasFatal = PathEvent.hasFatal;
|
|
4466
|
+
static hasAll = PathEvent.hasAll;
|
|
4467
|
+
static hasAllFatal = PathEvent.hasAllFatal;
|
|
4376
4468
|
/** Get all permissions */
|
|
4377
4469
|
all = () => this.momentum.auth.session?.permissions || [];
|
|
4470
|
+
combine(...events) {
|
|
4471
|
+
return PathEvent.combine(...events);
|
|
4472
|
+
}
|
|
4473
|
+
create(event) {
|
|
4474
|
+
return new PathEvent(event);
|
|
4475
|
+
}
|
|
4378
4476
|
/** Filter list of permissions to ones the user has */
|
|
4379
|
-
filter = (...events) =>
|
|
4477
|
+
filter = (...events) => {
|
|
4478
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4479
|
+
return PathEvent.filter(check, ...events.flat());
|
|
4480
|
+
};
|
|
4380
4481
|
/** Does user have any permissions (or) */
|
|
4381
|
-
has = (...events) =>
|
|
4482
|
+
has = (...events) => {
|
|
4483
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4484
|
+
return PathEvent.has(check, ...events.flat());
|
|
4485
|
+
};
|
|
4382
4486
|
/** Does user have all permissions (and) */
|
|
4383
|
-
hasAll = (...events) =>
|
|
4487
|
+
hasAll = (...events) => {
|
|
4488
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4489
|
+
return PathEvent.hasAll(check, ...events.flat());
|
|
4490
|
+
};
|
|
4384
4491
|
/** Raise error if user has no permissions (or) */
|
|
4385
|
-
hasFatal = (...events) =>
|
|
4492
|
+
hasFatal = (...events) => {
|
|
4493
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4494
|
+
return PathEvent.hasFatal(check, ...events.flat());
|
|
4495
|
+
};
|
|
4386
4496
|
/** Raise error if user missing any permissions (and) */
|
|
4387
|
-
hasAllFatal = (...events) =>
|
|
4497
|
+
hasAllFatal = (...events) => {
|
|
4498
|
+
const check = Array.isArray(events[0]) ? events.shift() : this.all();
|
|
4499
|
+
return PathEvent.hasAllFatal(check, ...events.flat());
|
|
4500
|
+
};
|
|
4388
4501
|
}
|
|
4389
4502
|
class Momentum extends PathEventEmitter {
|
|
4390
4503
|
static pathEvent = PathEvent;
|
package/dist/permissions.d.ts
CHANGED
|
@@ -3,17 +3,26 @@ import { Momentum } from './momentum';
|
|
|
3
3
|
export declare class Permissions {
|
|
4
4
|
protected momentum: Momentum;
|
|
5
5
|
constructor(momentum: Momentum);
|
|
6
|
+
static create: (event: string | PathEvent) => PathEvent;
|
|
7
|
+
static combine: typeof PathEvent.combine;
|
|
8
|
+
static filter: typeof PathEvent.filter;
|
|
9
|
+
static has: typeof PathEvent.has;
|
|
10
|
+
static hasFatal: typeof PathEvent.hasFatal;
|
|
11
|
+
static hasAll: typeof PathEvent.hasAll;
|
|
12
|
+
static hasAllFatal: typeof PathEvent.hasAllFatal;
|
|
6
13
|
/** Get all permissions */
|
|
7
14
|
all: () => string[];
|
|
15
|
+
combine(...events: (string | PathEvent)[]): PathEvent;
|
|
16
|
+
create(event: string | PathEvent): PathEvent;
|
|
8
17
|
/** Filter list of permissions to ones the user has */
|
|
9
|
-
filter: (...events: (string | PathEvent)[]) => PathEvent[];
|
|
18
|
+
filter: (...events: (string | PathEvent | string[] | PathEvent[])[]) => PathEvent[];
|
|
10
19
|
/** Does user have any permissions (or) */
|
|
11
|
-
has: (...events: (string | PathEvent)[]) => boolean;
|
|
20
|
+
has: (...events: (string | PathEvent | string[] | PathEvent[])[]) => boolean;
|
|
12
21
|
/** Does user have all permissions (and) */
|
|
13
|
-
hasAll: (...events: (string | PathEvent)[]) => boolean;
|
|
22
|
+
hasAll: (...events: (string | PathEvent | string[] | PathEvent[])[]) => boolean;
|
|
14
23
|
/** Raise error if user has no permissions (or) */
|
|
15
|
-
hasFatal: (...events: (string | PathEvent)[]) => void;
|
|
24
|
+
hasFatal: (...events: (string | PathEvent | string[] | PathEvent[])[]) => void;
|
|
16
25
|
/** Raise error if user missing any permissions (and) */
|
|
17
|
-
hasAllFatal: (...events: (string | PathEvent)[]) => void;
|
|
26
|
+
hasAllFatal: (...events: (string | PathEvent | string[] | PathEvent[])[]) => void;
|
|
18
27
|
}
|
|
19
28
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,qBAAa,WAAW;IACX,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;IAExC,0BAA0B;IAC1B,GAAG,QAAO,MAAM,EAAE,CAAkD;
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,qBAAa,WAAW;IACX,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;IAExC,MAAM,CAAC,MAAM,GAAI,OAAO,MAAM,GAAG,SAAS,eAA0B;IACpE,MAAM,CAAC,OAAO,2BAAqB;IACnC,MAAM,CAAC,MAAM,0BAAoB;IACjC,MAAM,CAAC,GAAG,uBAAiB;IAC3B,MAAM,CAAC,QAAQ,4BAAsB;IACrC,MAAM,CAAC,MAAM,0BAAoB;IACjC,MAAM,CAAC,WAAW,+BAAyB;IAE3C,0BAA0B;IAC1B,GAAG,QAAO,MAAM,EAAE,CAAkD;IAEpE,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IAEzC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAEhC,sDAAsD;IACtD,MAAM,GAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,SAAS,GAAG,MAAM,EA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C,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,CAAC,EAAE,CAAA;CAC9E,CAAA;AAED,qBAAa,OAAQ,SAAQ,mBAAmB,CAAC,MAAM,CAAC;IAC3C,SAAS,CAAC,QAAQ,EAAE,QAAQ;gBAAlB,QAAQ,EAAE,QAAQ;CAGxC"}
|
package/dist/storage.d.ts
CHANGED
|
@@ -52,12 +52,10 @@ export declare class Storage extends PathEventEmitter {
|
|
|
52
52
|
/**
|
|
53
53
|
* Download module
|
|
54
54
|
* @param {string} path Path to target
|
|
55
|
-
* @param {
|
|
55
|
+
* @param {rename?: string} rename Rename file on download
|
|
56
56
|
* @return {PromiseProgress<Blob>} File as blob with progress tracking
|
|
57
57
|
*/
|
|
58
|
-
download(path: string,
|
|
59
|
-
'downloadAs'?: string;
|
|
60
|
-
}): PromiseProgress<Blob>;
|
|
58
|
+
download(path: string, rename?: string): PromiseProgress<Blob>;
|
|
61
59
|
/**
|
|
62
60
|
* Retrieve file/folder metadata
|
|
63
61
|
* @param {string} path Path to target
|
|
@@ -80,11 +78,12 @@ export declare class Storage extends PathEventEmitter {
|
|
|
80
78
|
/**
|
|
81
79
|
* Create file link & open
|
|
82
80
|
* @param {string} path Path to target
|
|
83
|
-
* @param {false} target
|
|
84
|
-
* @return {string} URL
|
|
81
|
+
* @param {'url' | 'blob' | 'download' | false | '_blank' | '_self' | string} target File destination: url/false - returns absolute URL, blob - returns blob object, download/string - downloads/renames file, _blank/_self - Redirects / opens in new tab
|
|
82
|
+
* @return {string | Blob | Window | null} URL, Blob, or Window depending on target
|
|
85
83
|
*/
|
|
86
|
-
open(path: string, target: false): string;
|
|
87
|
-
open(path: string, target
|
|
84
|
+
open(path: string, target: 'url' | false): string;
|
|
85
|
+
open(path: string, target: 'blob' | 'download' | string): PromiseProgress<Blob>;
|
|
86
|
+
open(path: string, target: '_blank' | '_self'): Window | null;
|
|
88
87
|
/**
|
|
89
88
|
* Read file as text via extraction or OCR
|
|
90
89
|
* @param {string} path Path to target
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,IAAI,EAAK,MAAM,QAAQ,CAAC;AACrC,OAAO,EACN,KAAK,EACL,eAAe,EAKf,gBAAgB,EAAO,WAAW,EAAE,SAAS,EAC7C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,4BAA4B;AAC5B,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG;IAChC,sBAAsB;IACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC1C,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC3B,CAAA;AAED,uBAAuB;AACvB,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG;IAC7B,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;C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um",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Client library for momentum",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Momentum"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"postbuild": "npm run build:docs && node -e \"const fs=require('fs');fs.cpSync('dist/index.mjs','../server/public/momentum.mjs');fs.cpSync('dist/index.js','../server/public/momentum.js');fs.cpSync('dist/momentum.worker.mjs','../server/public/momentum.worker.mjs')\""
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ztimson/utils": "^0.29.
|
|
36
|
+
"@ztimson/utils": "^0.29.7"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^22.5.4",
|