@onyx.dev/onyx-database 1.0.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -1
- package/dist/{aggregates-BGXzij4U.d.cts → aggregates-LoteczVS.d.cts} +214 -1
- package/dist/{aggregates-BGXzij4U.d.ts → aggregates-LoteczVS.d.ts} +214 -1
- package/dist/edge.cjs +226 -0
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.d.cts +2 -2
- package/dist/edge.d.ts +2 -2
- package/dist/edge.js +226 -1
- package/dist/edge.js.map +1 -1
- package/dist/gen/cli/generate.cjs +221 -0
- package/dist/gen/cli/generate.cjs.map +1 -1
- package/dist/index.cjs +227 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +227 -1
- package/dist/index.js.map +1 -1
- package/dist/schema/cli/schema.cjs +222 -0
- package/dist/schema/cli/schema.cjs.map +1 -1
- package/package.json +1 -1
package/dist/edge.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OnyxFacade } from './aggregates-
|
|
2
|
-
export {
|
|
1
|
+
import { O as OnyxFacade } from './aggregates-LoteczVS.cjs';
|
|
2
|
+
export { r as AiChatClient, l as AiChatCompletionChoice, p as AiChatCompletionChunk, o as AiChatCompletionChunkChoice, n as AiChatCompletionChunkDelta, j as AiChatCompletionRequest, m as AiChatCompletionResponse, q as AiChatCompletionStream, k as AiChatCompletionUsage, f as AiChatMessage, c as AiChatRole, w as AiErrorResponse, v as AiModel, u as AiModelsResponse, A as AiRequestOptions, s as AiScriptApprovalRequest, t as AiScriptApprovalResponse, h as AiTool, e as AiToolCall, d as AiToolCallFunction, i as AiToolChoice, g as AiToolFunction, a6 as FetchImpl, a5 as FetchResponse, F as FullTextQuery, af as ICascadeBuilder, ag as ICascadeRelationshipBuilder, ac as IConditionBuilder, I as IOnyxDatabase, ad as IQueryBuilder, ae as ISaveBuilder, a1 as LogicalOperator, b as OnyxConfig, a4 as OnyxDocument, a8 as QueryCondition, a7 as QueryCriteria, a0 as QueryCriteriaOperator, ab as QueryPage, Q as QueryResults, a as QueryResultsPromise, R as RetryOptions, E as SchemaAttribute, W as SchemaAttributeChange, B as SchemaDataType, $ as SchemaDiff, M as SchemaEntity, T as SchemaHistoryEntry, D as SchemaIdentifier, C as SchemaIdentifierGenerator, H as SchemaIndex, X as SchemaIndexChange, G as SchemaIndexType, J as SchemaResolver, Y as SchemaResolverChange, P as SchemaRevision, N as SchemaRevisionMetadata, _ as SchemaTableDiff, L as SchemaTrigger, Z as SchemaTriggerChange, K as SchemaTriggerEvent, U as SchemaUpsertRequest, V as SchemaValidationResult, S as SecretMetadata, x as SecretRecord, z as SecretSaveRequest, y as SecretsListResponse, a9 as SelectQuery, a2 as Sort, a3 as StreamAction, aa as UpdateQuery, ah as asc, aH as avg, ap as between, az as contains, aA as containsIgnoreCase, aJ as count, ai as desc, aj as eq, aq as gt, ar as gte, al as inOp, aF as isNull, ax as like, aQ as lower, as as lt, at as lte, au as matches, aL as max, aO as median, aK as min, ak as neq, aB as notContains, aC as notContainsIgnoreCase, an as notIn, ay as notLike, aw as notMatches, aG as notNull, aE as notStartsWith, ao as notWithin, aT as percentile, aS as replace, av as search, aD as startsWith, aM as std, aR as substring, aI as sum, aP as upper, aN as variance, am as within } from './aggregates-LoteczVS.cjs';
|
|
3
3
|
|
|
4
4
|
declare const onyx: OnyxFacade;
|
|
5
5
|
|
package/dist/edge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OnyxFacade } from './aggregates-
|
|
2
|
-
export {
|
|
1
|
+
import { O as OnyxFacade } from './aggregates-LoteczVS.js';
|
|
2
|
+
export { r as AiChatClient, l as AiChatCompletionChoice, p as AiChatCompletionChunk, o as AiChatCompletionChunkChoice, n as AiChatCompletionChunkDelta, j as AiChatCompletionRequest, m as AiChatCompletionResponse, q as AiChatCompletionStream, k as AiChatCompletionUsage, f as AiChatMessage, c as AiChatRole, w as AiErrorResponse, v as AiModel, u as AiModelsResponse, A as AiRequestOptions, s as AiScriptApprovalRequest, t as AiScriptApprovalResponse, h as AiTool, e as AiToolCall, d as AiToolCallFunction, i as AiToolChoice, g as AiToolFunction, a6 as FetchImpl, a5 as FetchResponse, F as FullTextQuery, af as ICascadeBuilder, ag as ICascadeRelationshipBuilder, ac as IConditionBuilder, I as IOnyxDatabase, ad as IQueryBuilder, ae as ISaveBuilder, a1 as LogicalOperator, b as OnyxConfig, a4 as OnyxDocument, a8 as QueryCondition, a7 as QueryCriteria, a0 as QueryCriteriaOperator, ab as QueryPage, Q as QueryResults, a as QueryResultsPromise, R as RetryOptions, E as SchemaAttribute, W as SchemaAttributeChange, B as SchemaDataType, $ as SchemaDiff, M as SchemaEntity, T as SchemaHistoryEntry, D as SchemaIdentifier, C as SchemaIdentifierGenerator, H as SchemaIndex, X as SchemaIndexChange, G as SchemaIndexType, J as SchemaResolver, Y as SchemaResolverChange, P as SchemaRevision, N as SchemaRevisionMetadata, _ as SchemaTableDiff, L as SchemaTrigger, Z as SchemaTriggerChange, K as SchemaTriggerEvent, U as SchemaUpsertRequest, V as SchemaValidationResult, S as SecretMetadata, x as SecretRecord, z as SecretSaveRequest, y as SecretsListResponse, a9 as SelectQuery, a2 as Sort, a3 as StreamAction, aa as UpdateQuery, ah as asc, aH as avg, ap as between, az as contains, aA as containsIgnoreCase, aJ as count, ai as desc, aj as eq, aq as gt, ar as gte, al as inOp, aF as isNull, ax as like, aQ as lower, as as lt, at as lte, au as matches, aL as max, aO as median, aK as min, ak as neq, aB as notContains, aC as notContainsIgnoreCase, an as notIn, ay as notLike, aw as notMatches, aG as notNull, aE as notStartsWith, ao as notWithin, aT as percentile, aS as replace, av as search, aD as startsWith, aM as std, aR as substring, aI as sum, aP as upper, aN as variance, am as within } from './aggregates-LoteczVS.js';
|
|
3
3
|
|
|
4
4
|
declare const onyx: OnyxFacade;
|
|
5
5
|
|
package/dist/edge.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/config/defaults.ts
|
|
2
2
|
var DEFAULT_BASE_URL = "https://api.onyx.dev";
|
|
3
|
+
var DEFAULT_AI_BASE_URL = "https://ai.onyx.dev";
|
|
3
4
|
var sanitizeBaseUrl = (u) => u.replace(/\/+$/, "");
|
|
4
5
|
|
|
5
6
|
// src/errors/config-error.ts
|
|
@@ -51,6 +52,7 @@ function readEnv(targetId) {
|
|
|
51
52
|
if (targetId && envId !== targetId) return {};
|
|
52
53
|
const res = dropUndefined({
|
|
53
54
|
baseUrl: pick("ONYX_DATABASE_BASE_URL"),
|
|
55
|
+
aiBaseUrl: pick("ONYX_AI_BASE_URL"),
|
|
54
56
|
databaseId: envId,
|
|
55
57
|
apiKey: pick("ONYX_DATABASE_API_KEY"),
|
|
56
58
|
apiSecret: pick("ONYX_DATABASE_API_SECRET")
|
|
@@ -69,11 +71,13 @@ async function resolveConfig(input) {
|
|
|
69
71
|
const env = readEnv(input?.databaseId);
|
|
70
72
|
const merged = {
|
|
71
73
|
baseUrl: DEFAULT_BASE_URL,
|
|
74
|
+
aiBaseUrl: DEFAULT_AI_BASE_URL,
|
|
72
75
|
...dropUndefined(env),
|
|
73
76
|
...dropUndefined(input)
|
|
74
77
|
};
|
|
75
78
|
dbg("merged (pre-validate):", mask(merged));
|
|
76
79
|
const baseUrl = sanitizeBaseUrl(merged.baseUrl ?? DEFAULT_BASE_URL);
|
|
80
|
+
const aiBaseUrl = sanitizeBaseUrl(merged.aiBaseUrl ?? DEFAULT_AI_BASE_URL);
|
|
77
81
|
const databaseId = merged.databaseId ?? "";
|
|
78
82
|
const apiKey = merged.apiKey ?? "";
|
|
79
83
|
const apiSecret = merged.apiSecret ?? "";
|
|
@@ -98,6 +102,7 @@ async function resolveConfig(input) {
|
|
|
98
102
|
}
|
|
99
103
|
const resolved = {
|
|
100
104
|
baseUrl,
|
|
105
|
+
aiBaseUrl,
|
|
101
106
|
databaseId,
|
|
102
107
|
apiKey,
|
|
103
108
|
apiSecret,
|
|
@@ -1118,6 +1123,7 @@ var OnyxDatabaseImpl = class {
|
|
|
1118
1123
|
cfgPromise;
|
|
1119
1124
|
resolved = null;
|
|
1120
1125
|
http = null;
|
|
1126
|
+
aiHttp = null;
|
|
1121
1127
|
streams = /* @__PURE__ */ new Set();
|
|
1122
1128
|
requestLoggingEnabled;
|
|
1123
1129
|
responseLoggingEnabled;
|
|
@@ -1152,6 +1158,30 @@ var OnyxDatabaseImpl = class {
|
|
|
1152
1158
|
databaseId: this.resolved.databaseId
|
|
1153
1159
|
};
|
|
1154
1160
|
}
|
|
1161
|
+
async ensureAiClient() {
|
|
1162
|
+
if (!this.resolved) {
|
|
1163
|
+
this.resolved = await this.cfgPromise;
|
|
1164
|
+
}
|
|
1165
|
+
if (!this.aiHttp) {
|
|
1166
|
+
this.aiHttp = new HttpClient({
|
|
1167
|
+
baseUrl: this.resolved.aiBaseUrl,
|
|
1168
|
+
apiKey: this.resolved.apiKey,
|
|
1169
|
+
apiSecret: this.resolved.apiSecret,
|
|
1170
|
+
fetchImpl: this.resolved.fetch,
|
|
1171
|
+
requestLoggingEnabled: this.requestLoggingEnabled,
|
|
1172
|
+
responseLoggingEnabled: this.responseLoggingEnabled,
|
|
1173
|
+
retryEnabled: this.resolved.retryEnabled,
|
|
1174
|
+
maxRetries: this.resolved.maxRetries,
|
|
1175
|
+
retryInitialDelayMs: this.resolved.retryInitialDelayMs
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
return {
|
|
1179
|
+
http: this.aiHttp,
|
|
1180
|
+
fetchImpl: this.resolved.fetch,
|
|
1181
|
+
aiBaseUrl: this.resolved.aiBaseUrl,
|
|
1182
|
+
databaseId: this.resolved.databaseId
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1155
1185
|
registerStream(handle) {
|
|
1156
1186
|
this.streams.add(handle);
|
|
1157
1187
|
return {
|
|
@@ -1164,7 +1194,34 @@ var OnyxDatabaseImpl = class {
|
|
|
1164
1194
|
}
|
|
1165
1195
|
};
|
|
1166
1196
|
}
|
|
1197
|
+
getRequestLoggingEnabled() {
|
|
1198
|
+
return this.requestLoggingEnabled;
|
|
1199
|
+
}
|
|
1200
|
+
getResponseLoggingEnabled() {
|
|
1201
|
+
return this.responseLoggingEnabled;
|
|
1202
|
+
}
|
|
1167
1203
|
/** -------- IOnyxDatabase -------- */
|
|
1204
|
+
chat() {
|
|
1205
|
+
return new AiChatClientImpl(
|
|
1206
|
+
() => this.ensureAiClient(),
|
|
1207
|
+
(handle) => this.registerStream(handle),
|
|
1208
|
+
() => this.requestLoggingEnabled,
|
|
1209
|
+
() => this.responseLoggingEnabled
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
async getModels() {
|
|
1213
|
+
const { http } = await this.ensureAiClient();
|
|
1214
|
+
return http.request("GET", "/v1/models");
|
|
1215
|
+
}
|
|
1216
|
+
async getModel(modelId) {
|
|
1217
|
+
const { http } = await this.ensureAiClient();
|
|
1218
|
+
const path = `/v1/models/${encodeURIComponent(modelId)}`;
|
|
1219
|
+
return http.request("GET", path);
|
|
1220
|
+
}
|
|
1221
|
+
async requestScriptApproval(input) {
|
|
1222
|
+
const { http } = await this.ensureAiClient();
|
|
1223
|
+
return http.request("POST", "/api/script-approvals", input);
|
|
1224
|
+
}
|
|
1168
1225
|
from(table) {
|
|
1169
1226
|
return new QueryBuilderImpl(this, String(table), this.defaultPartition);
|
|
1170
1227
|
}
|
|
@@ -1177,6 +1234,14 @@ var OnyxDatabaseImpl = class {
|
|
|
1177
1234
|
qb.select(...fields);
|
|
1178
1235
|
return qb;
|
|
1179
1236
|
}
|
|
1237
|
+
search(queryText, minScore) {
|
|
1238
|
+
const qb = new QueryBuilderImpl(
|
|
1239
|
+
this,
|
|
1240
|
+
"ALL",
|
|
1241
|
+
this.defaultPartition
|
|
1242
|
+
);
|
|
1243
|
+
return qb.search(queryText, minScore);
|
|
1244
|
+
}
|
|
1180
1245
|
cascade(...relationships) {
|
|
1181
1246
|
const cb = new CascadeBuilderImpl(this);
|
|
1182
1247
|
return cb.cascade(...relationships);
|
|
@@ -1463,6 +1528,7 @@ var QueryBuilderImpl = class {
|
|
|
1463
1528
|
toSelectQuery() {
|
|
1464
1529
|
return {
|
|
1465
1530
|
type: "SelectQuery",
|
|
1531
|
+
table: this.table,
|
|
1466
1532
|
fields: this.fields,
|
|
1467
1533
|
conditions: this.serializableConditions(),
|
|
1468
1534
|
sort: this.sort,
|
|
@@ -1502,6 +1568,13 @@ var QueryBuilderImpl = class {
|
|
|
1502
1568
|
this.resolvers = flat.length > 0 ? flat : null;
|
|
1503
1569
|
return this;
|
|
1504
1570
|
}
|
|
1571
|
+
search(queryText, minScore) {
|
|
1572
|
+
return this.and({
|
|
1573
|
+
field: "__full_text__",
|
|
1574
|
+
operator: "MATCHES",
|
|
1575
|
+
value: { queryText, minScore: minScore ?? null }
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1505
1578
|
where(condition) {
|
|
1506
1579
|
const c2 = toCondition(condition);
|
|
1507
1580
|
if (!this.conditions) {
|
|
@@ -1698,6 +1771,153 @@ var CascadeBuilderImpl = class {
|
|
|
1698
1771
|
return this.db.delete(table, primaryKey, opts);
|
|
1699
1772
|
}
|
|
1700
1773
|
};
|
|
1774
|
+
var AiChatClientImpl = class {
|
|
1775
|
+
constructor(resolveAiClient, registerStream, requestLoggingEnabled, responseLoggingEnabled) {
|
|
1776
|
+
this.resolveAiClient = resolveAiClient;
|
|
1777
|
+
this.registerStream = registerStream;
|
|
1778
|
+
this.requestLoggingEnabled = requestLoggingEnabled;
|
|
1779
|
+
this.responseLoggingEnabled = responseLoggingEnabled;
|
|
1780
|
+
}
|
|
1781
|
+
normalizeEventData(rawEvent) {
|
|
1782
|
+
const lines = rawEvent.split("\n");
|
|
1783
|
+
const dataLines = [];
|
|
1784
|
+
for (const line of lines) {
|
|
1785
|
+
const trimmed = line.trim();
|
|
1786
|
+
if (!trimmed || trimmed.startsWith(":")) continue;
|
|
1787
|
+
if (trimmed.startsWith("data:")) {
|
|
1788
|
+
dataLines.push(trimmed.slice(5).trim());
|
|
1789
|
+
} else {
|
|
1790
|
+
dataLines.push(trimmed);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
if (!dataLines.length) return null;
|
|
1794
|
+
const joined = dataLines.join("\n").trim();
|
|
1795
|
+
return joined.length > 0 ? joined : null;
|
|
1796
|
+
}
|
|
1797
|
+
logRequest(url, body, headers) {
|
|
1798
|
+
if (!this.requestLoggingEnabled()) return;
|
|
1799
|
+
console.log(`POST ${url}`);
|
|
1800
|
+
if (body != null) {
|
|
1801
|
+
const serialized = typeof body === "string" ? body : JSON.stringify(body);
|
|
1802
|
+
console.log(serialized);
|
|
1803
|
+
}
|
|
1804
|
+
const headerLog = { ...headers };
|
|
1805
|
+
if (headerLog["x-onyx-secret"]) headerLog["x-onyx-secret"] = "[REDACTED]";
|
|
1806
|
+
console.log("Headers:", headerLog);
|
|
1807
|
+
}
|
|
1808
|
+
logResponse(status, statusText, raw) {
|
|
1809
|
+
if (!this.responseLoggingEnabled()) return;
|
|
1810
|
+
const statusLine = `${status} ${statusText}`.trim();
|
|
1811
|
+
console.log(statusLine);
|
|
1812
|
+
if (raw && raw.trim().length > 0) {
|
|
1813
|
+
console.log(raw);
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
toOnyxError(status, statusText, raw) {
|
|
1817
|
+
let parsed = raw;
|
|
1818
|
+
try {
|
|
1819
|
+
parsed = parseJsonAllowNaN(raw);
|
|
1820
|
+
} catch {
|
|
1821
|
+
}
|
|
1822
|
+
const message = typeof parsed === "object" && parsed !== null && "error" in parsed && typeof parsed.error === "object" && typeof parsed.error?.message === "string" ? String(parsed.error.message) : `${status} ${statusText}`;
|
|
1823
|
+
return new OnyxHttpError(message, status, statusText, parsed, raw);
|
|
1824
|
+
}
|
|
1825
|
+
async create(request, options) {
|
|
1826
|
+
const body = { ...request, stream: !!request.stream };
|
|
1827
|
+
const { http, fetchImpl, aiBaseUrl, databaseId } = await this.resolveAiClient();
|
|
1828
|
+
const params = new URLSearchParams();
|
|
1829
|
+
const scopedDb = options?.databaseId ?? databaseId;
|
|
1830
|
+
if (scopedDb) params.append("databaseId", scopedDb);
|
|
1831
|
+
const path = `/v1/chat/completions${params.size ? `?${params.toString()}` : ""}`;
|
|
1832
|
+
if (!body.stream) {
|
|
1833
|
+
return http.request("POST", path, body);
|
|
1834
|
+
}
|
|
1835
|
+
const url = `${aiBaseUrl}${path}`;
|
|
1836
|
+
const headers = http.headers({ Accept: "text/event-stream" });
|
|
1837
|
+
this.logRequest(url, body, headers);
|
|
1838
|
+
const res = await fetchImpl(url, {
|
|
1839
|
+
method: "POST",
|
|
1840
|
+
headers,
|
|
1841
|
+
body: JSON.stringify(body)
|
|
1842
|
+
});
|
|
1843
|
+
if (!res.ok) {
|
|
1844
|
+
const raw = await res.text();
|
|
1845
|
+
this.logResponse(res.status, res.statusText, raw);
|
|
1846
|
+
throw this.toOnyxError(res.status, res.statusText, raw);
|
|
1847
|
+
}
|
|
1848
|
+
this.logResponse(res.status, res.statusText);
|
|
1849
|
+
const bodyStream = res.body;
|
|
1850
|
+
const reader = bodyStream && typeof bodyStream.getReader === "function" ? bodyStream.getReader() : null;
|
|
1851
|
+
if (!reader) {
|
|
1852
|
+
throw new OnyxHttpError(
|
|
1853
|
+
"Streaming response body is not readable",
|
|
1854
|
+
res.status,
|
|
1855
|
+
res.statusText,
|
|
1856
|
+
null,
|
|
1857
|
+
""
|
|
1858
|
+
);
|
|
1859
|
+
}
|
|
1860
|
+
let canceled = false;
|
|
1861
|
+
const handle = {
|
|
1862
|
+
cancel: () => {
|
|
1863
|
+
if (canceled) return;
|
|
1864
|
+
canceled = true;
|
|
1865
|
+
try {
|
|
1866
|
+
reader.cancel?.();
|
|
1867
|
+
} catch {
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
const registered = this.registerStream(handle);
|
|
1872
|
+
const normalizeEvent = (rawEvent) => this.normalizeEventData(rawEvent);
|
|
1873
|
+
const stream = {
|
|
1874
|
+
async *[Symbol.asyncIterator]() {
|
|
1875
|
+
const decoder = new TextDecoder("utf-8");
|
|
1876
|
+
let buffer = "";
|
|
1877
|
+
try {
|
|
1878
|
+
while (!canceled) {
|
|
1879
|
+
const { done, value } = await reader.read();
|
|
1880
|
+
if (done) break;
|
|
1881
|
+
if (value) {
|
|
1882
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1883
|
+
}
|
|
1884
|
+
let splitIndex = buffer.indexOf("\n\n");
|
|
1885
|
+
while (splitIndex !== -1) {
|
|
1886
|
+
const rawEvent = buffer.slice(0, splitIndex);
|
|
1887
|
+
buffer = buffer.slice(splitIndex + 2);
|
|
1888
|
+
const data = normalizeEvent(rawEvent);
|
|
1889
|
+
if (data === "[DONE]") return;
|
|
1890
|
+
if (data) {
|
|
1891
|
+
try {
|
|
1892
|
+
yield parseJsonAllowNaN(data);
|
|
1893
|
+
} catch {
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
splitIndex = buffer.indexOf("\n\n");
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
buffer += decoder.decode();
|
|
1900
|
+
const remaining = buffer.trim();
|
|
1901
|
+
if (remaining && remaining !== "[DONE]") {
|
|
1902
|
+
const data = normalizeEvent(remaining);
|
|
1903
|
+
if (data && data !== "[DONE]") {
|
|
1904
|
+
try {
|
|
1905
|
+
yield parseJsonAllowNaN(data);
|
|
1906
|
+
} catch {
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
} finally {
|
|
1911
|
+
registered.cancel();
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
cancel() {
|
|
1915
|
+
registered.cancel();
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
return stream;
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1701
1921
|
function createOnyxFacade(resolveConfig2) {
|
|
1702
1922
|
let cachedCfg = null;
|
|
1703
1923
|
function resolveConfigWithCache(config) {
|
|
@@ -1853,6 +2073,10 @@ var ConditionBuilderImpl = class {
|
|
|
1853
2073
|
|
|
1854
2074
|
// src/helpers/conditions.ts
|
|
1855
2075
|
var c = (field, operator, value) => new ConditionBuilderImpl({ field, operator, value });
|
|
2076
|
+
var fullText = (queryText, minScore) => ({
|
|
2077
|
+
queryText,
|
|
2078
|
+
minScore: minScore ?? null
|
|
2079
|
+
});
|
|
1856
2080
|
var eq = (field, value) => c(field, "EQUAL", value);
|
|
1857
2081
|
var neq = (field, value) => c(field, "NOT_EQUAL", value);
|
|
1858
2082
|
function inOp(field, values) {
|
|
@@ -1875,6 +2099,7 @@ var gte = (field, value) => c(field, "GREATER_THAN_EQUAL", value);
|
|
|
1875
2099
|
var lt = (field, value) => c(field, "LESS_THAN", value);
|
|
1876
2100
|
var lte = (field, value) => c(field, "LESS_THAN_EQUAL", value);
|
|
1877
2101
|
var matches = (field, regex) => c(field, "MATCHES", regex);
|
|
2102
|
+
var search = (queryText, minScore) => c("__full_text__", "MATCHES", fullText(queryText, minScore));
|
|
1878
2103
|
var notMatches = (field, regex) => c(field, "NOT_MATCHES", regex);
|
|
1879
2104
|
var like = (field, pattern) => c(field, "LIKE", pattern);
|
|
1880
2105
|
var notLike = (field, pattern) => c(field, "NOT_LIKE", pattern);
|
|
@@ -1906,6 +2131,6 @@ var percentile = (attribute, p) => `percentile(${attribute}, ${p})`;
|
|
|
1906
2131
|
var sdkName = "@onyx.dev/onyx-database";
|
|
1907
2132
|
var sdkVersion = "0.1.0";
|
|
1908
2133
|
|
|
1909
|
-
export { QueryResults, asc, avg, between, contains, containsIgnoreCase, count, desc, eq, gt, gte, inOp, isNull, like, lower, lt, lte, matches, max, median, min, neq, notContains, notContainsIgnoreCase, notIn, notLike, notMatches, notNull, notStartsWith, notWithin, onyx, percentile, replace, sdkName, sdkVersion, startsWith, std, substring, sum, upper, variance, within };
|
|
2134
|
+
export { QueryResults, asc, avg, between, contains, containsIgnoreCase, count, desc, eq, gt, gte, inOp, isNull, like, lower, lt, lte, matches, max, median, min, neq, notContains, notContainsIgnoreCase, notIn, notLike, notMatches, notNull, notStartsWith, notWithin, onyx, percentile, replace, sdkName, sdkVersion, search, startsWith, std, substring, sum, upper, variance, within };
|
|
1910
2135
|
//# sourceMappingURL=edge.js.map
|
|
1911
2136
|
//# sourceMappingURL=edge.js.map
|