@pooflabs/core 0.0.1 → 0.0.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/client/operations.d.ts +24 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -11,12 +11,36 @@ export declare function get(path: string, opts?: {
|
|
|
11
11
|
headers?: Record<string, string>;
|
|
12
12
|
};
|
|
13
13
|
}): Promise<any>;
|
|
14
|
+
export type RunExpressionOptions = {
|
|
15
|
+
returnType?: 'Bool' | 'String' | 'Int' | 'UInt';
|
|
16
|
+
_overrides?: {
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type RunExpressionResult = {
|
|
21
|
+
result: any;
|
|
22
|
+
trace?: {
|
|
23
|
+
variable: string;
|
|
24
|
+
resolvedValue: any;
|
|
25
|
+
operation?: string;
|
|
26
|
+
result?: any;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
14
29
|
export declare function runQuery(absolutePath: string, queryName: string, queryArgs: any): Promise<any>;
|
|
15
30
|
export declare function runQueryMany(many: {
|
|
16
31
|
absolutePath: string;
|
|
17
32
|
queryName: string;
|
|
18
33
|
queryArgs: any;
|
|
19
34
|
}[]): Promise<any>;
|
|
35
|
+
export declare function runExpression(expression: string, queryArgs: any, options?: RunExpressionOptions): Promise<RunExpressionResult>;
|
|
36
|
+
export declare function runExpressionMany(many: {
|
|
37
|
+
expression: string;
|
|
38
|
+
queryArgs: any;
|
|
39
|
+
returnType?: 'Bool' | 'String' | 'Int' | 'UInt';
|
|
40
|
+
_overrides?: {
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
}[]): Promise<RunExpressionResult[]>;
|
|
20
44
|
export declare function set(path: string, document: any, options?: SetOptions): Promise<any>;
|
|
21
45
|
export declare function setMany(many: {
|
|
22
46
|
path: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { init } from './client/config';
|
|
2
2
|
export { getConfig, ClientConfig } from './client/config';
|
|
3
|
-
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, SetOptions } from './client/operations';
|
|
3
|
+
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, runExpression, runExpressionMany, SetOptions, RunExpressionOptions, RunExpressionResult } from './client/operations';
|
|
4
4
|
export { subscribe } from './client/subscription';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export { getIdToken } from './utils/utils';
|
package/dist/index.js
CHANGED
|
@@ -6655,6 +6655,37 @@ async function runQueryMany(many) {
|
|
|
6655
6655
|
throw error;
|
|
6656
6656
|
}
|
|
6657
6657
|
}
|
|
6658
|
+
// NEW: Ad-hoc expression execution - first-class feature
|
|
6659
|
+
async function runExpression(expression, queryArgs, options) {
|
|
6660
|
+
const results = await runExpressionMany([Object.assign({ expression, queryArgs }, options)]);
|
|
6661
|
+
return results[0];
|
|
6662
|
+
}
|
|
6663
|
+
async function runExpressionMany(many) {
|
|
6664
|
+
try {
|
|
6665
|
+
let queries = [];
|
|
6666
|
+
let overrides = undefined;
|
|
6667
|
+
for (const { expression, queryArgs, returnType, _overrides } of many) {
|
|
6668
|
+
// Collect overrides from first query that has them (all queries share same request)
|
|
6669
|
+
if (_overrides && !overrides) {
|
|
6670
|
+
overrides = _overrides;
|
|
6671
|
+
}
|
|
6672
|
+
queries.push({ queryArgs, expression, returnType });
|
|
6673
|
+
}
|
|
6674
|
+
const response = await makeApiRequest('POST', 'queries', { queries }, overrides);
|
|
6675
|
+
// Map results - trace is automatically included by server for non-mainnet networks
|
|
6676
|
+
return response.data.queries.map((queryResult) => {
|
|
6677
|
+
const result = { result: queryResult.result };
|
|
6678
|
+
// Include trace if present (server includes it for non-mainnet networks)
|
|
6679
|
+
if (queryResult.trace) {
|
|
6680
|
+
result.trace = queryResult.trace;
|
|
6681
|
+
}
|
|
6682
|
+
return result;
|
|
6683
|
+
});
|
|
6684
|
+
}
|
|
6685
|
+
catch (error) {
|
|
6686
|
+
throw error;
|
|
6687
|
+
}
|
|
6688
|
+
}
|
|
6658
6689
|
async function set(path, document, options) {
|
|
6659
6690
|
const result = await setMany([{ path, document }], options);
|
|
6660
6691
|
// Clear cache entries that might be affected by this update
|
|
@@ -7607,6 +7638,8 @@ exports.getFiles = getFiles;
|
|
|
7607
7638
|
exports.getIdToken = getIdToken;
|
|
7608
7639
|
exports.init = init;
|
|
7609
7640
|
exports.refreshSession = refreshSession;
|
|
7641
|
+
exports.runExpression = runExpression;
|
|
7642
|
+
exports.runExpressionMany = runExpressionMany;
|
|
7610
7643
|
exports.runQuery = runQuery;
|
|
7611
7644
|
exports.runQueryMany = runQueryMany;
|
|
7612
7645
|
exports.set = set;
|