@onyx.dev/onyx-database 2.0.1 → 2.1.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 +42 -14
- package/dist/{aggregates-BPpzRHGH.d.cts → aggregates-DREvey7b.d.cts} +1 -1
- package/dist/{aggregates-BPpzRHGH.d.ts → aggregates-DREvey7b.d.ts} +1 -1
- package/dist/edge.cjs +25 -7
- 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 +25 -7
- package/dist/edge.js.map +1 -1
- package/dist/gen/cli/generate.cjs +24 -6
- package/dist/gen/cli/generate.cjs.map +1 -1
- package/dist/index.cjs +25 -7
- 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 +25 -7
- package/dist/index.js.map +1 -1
- package/dist/schema/cli/schema.cjs +24 -6
- 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 { t as AiChatClient, l as AiChatCompletionChoice, q as AiChatCompletionChunk, p as AiChatCompletionChunkChoice, o as AiChatCompletionChunkDelta, j as AiChatCompletionRequest, m as AiChatCompletionResponse, r as AiChatCompletionStream, k as AiChatCompletionUsage, f as AiChatMessage, s as AiChatOptions, c as AiChatRole, B as AiClient, z as AiErrorResponse, y as AiModel, x as AiModelsResponse, A as AiRequestOptions, u as AiScriptApprovalRequest, w as AiScriptApprovalResponse, h as AiTool, e as AiToolCall, d as AiToolCallFunction, i as AiToolChoice, g as AiToolFunction, aa as FetchImpl, a9 as FetchResponse, F as FullTextQuery, aj as ICascadeBuilder, ak as ICascadeRelationshipBuilder, ag as IConditionBuilder, I as IOnyxDatabase, ah as IQueryBuilder, ai as ISaveBuilder, a5 as LogicalOperator, b as OnyxConfig, a8 as OnyxDocument, ac as QueryCondition, ab as QueryCriteria, a4 as QueryCriteriaOperator, af as QueryPage, Q as QueryResults, a as QueryResultsPromise, R as RetryOptions, K as SchemaAttribute, _ as SchemaAttributeChange, G as SchemaDataType, a3 as SchemaDiff, U as SchemaEntity, X as SchemaHistoryEntry, J as SchemaIdentifier, H as SchemaIdentifierGenerator, M as SchemaIndex, $ as SchemaIndexChange, L as SchemaIndexType, N as SchemaResolver, a0 as SchemaResolverChange, W as SchemaRevision, V as SchemaRevisionMetadata, a2 as SchemaTableDiff, T as SchemaTrigger, a1 as SchemaTriggerChange, P as SchemaTriggerEvent, Y as SchemaUpsertRequest, Z as SchemaValidationResult, S as SecretMetadata, C as SecretRecord, E as SecretSaveRequest, D as SecretsListResponse, ad as SelectQuery, a6 as Sort, a7 as StreamAction, ae as UpdateQuery, al as asc, aL as avg, at as between, aD as contains, aE as containsIgnoreCase, aN as count, am as desc, an as eq, aX as format, au as gt, av as gte, ap as inOp, aJ as isNull, aB as like, aU as lower, aw as lt, ax as lte, ay as matches, aP as max, aS as median, aO as min, ao as neq, aF as notContains, aG as notContainsIgnoreCase, ar as notIn, aC as notLike, aA as notMatches, aK as notNull, aI as notStartsWith, as as notWithin, aY as percentile, aW as replace, n as sdkName, v as sdkVersion, az as search, aH as startsWith, aQ as std, aV as substring, aM as sum, aT as upper, aR as variance, aq as within } from './aggregates-
|
|
1
|
+
import { O as OnyxFacade } from './aggregates-DREvey7b.cjs';
|
|
2
|
+
export { t as AiChatClient, l as AiChatCompletionChoice, q as AiChatCompletionChunk, p as AiChatCompletionChunkChoice, o as AiChatCompletionChunkDelta, j as AiChatCompletionRequest, m as AiChatCompletionResponse, r as AiChatCompletionStream, k as AiChatCompletionUsage, f as AiChatMessage, s as AiChatOptions, c as AiChatRole, B as AiClient, z as AiErrorResponse, y as AiModel, x as AiModelsResponse, A as AiRequestOptions, u as AiScriptApprovalRequest, w as AiScriptApprovalResponse, h as AiTool, e as AiToolCall, d as AiToolCallFunction, i as AiToolChoice, g as AiToolFunction, aa as FetchImpl, a9 as FetchResponse, F as FullTextQuery, aj as ICascadeBuilder, ak as ICascadeRelationshipBuilder, ag as IConditionBuilder, I as IOnyxDatabase, ah as IQueryBuilder, ai as ISaveBuilder, a5 as LogicalOperator, b as OnyxConfig, a8 as OnyxDocument, ac as QueryCondition, ab as QueryCriteria, a4 as QueryCriteriaOperator, af as QueryPage, Q as QueryResults, a as QueryResultsPromise, R as RetryOptions, K as SchemaAttribute, _ as SchemaAttributeChange, G as SchemaDataType, a3 as SchemaDiff, U as SchemaEntity, X as SchemaHistoryEntry, J as SchemaIdentifier, H as SchemaIdentifierGenerator, M as SchemaIndex, $ as SchemaIndexChange, L as SchemaIndexType, N as SchemaResolver, a0 as SchemaResolverChange, W as SchemaRevision, V as SchemaRevisionMetadata, a2 as SchemaTableDiff, T as SchemaTrigger, a1 as SchemaTriggerChange, P as SchemaTriggerEvent, Y as SchemaUpsertRequest, Z as SchemaValidationResult, S as SecretMetadata, C as SecretRecord, E as SecretSaveRequest, D as SecretsListResponse, ad as SelectQuery, a6 as Sort, a7 as StreamAction, ae as UpdateQuery, al as asc, aL as avg, at as between, aD as contains, aE as containsIgnoreCase, aN as count, am as desc, an as eq, aX as format, au as gt, av as gte, ap as inOp, aJ as isNull, aB as like, aU as lower, aw as lt, ax as lte, ay as matches, aP as max, aS as median, aO as min, ao as neq, aF as notContains, aG as notContainsIgnoreCase, ar as notIn, aC as notLike, aA as notMatches, aK as notNull, aI as notStartsWith, as as notWithin, aY as percentile, aW as replace, n as sdkName, v as sdkVersion, az as search, aH as startsWith, aQ as std, aV as substring, aM as sum, aT as upper, aR as variance, aq as within } from './aggregates-DREvey7b.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 { t as AiChatClient, l as AiChatCompletionChoice, q as AiChatCompletionChunk, p as AiChatCompletionChunkChoice, o as AiChatCompletionChunkDelta, j as AiChatCompletionRequest, m as AiChatCompletionResponse, r as AiChatCompletionStream, k as AiChatCompletionUsage, f as AiChatMessage, s as AiChatOptions, c as AiChatRole, B as AiClient, z as AiErrorResponse, y as AiModel, x as AiModelsResponse, A as AiRequestOptions, u as AiScriptApprovalRequest, w as AiScriptApprovalResponse, h as AiTool, e as AiToolCall, d as AiToolCallFunction, i as AiToolChoice, g as AiToolFunction, aa as FetchImpl, a9 as FetchResponse, F as FullTextQuery, aj as ICascadeBuilder, ak as ICascadeRelationshipBuilder, ag as IConditionBuilder, I as IOnyxDatabase, ah as IQueryBuilder, ai as ISaveBuilder, a5 as LogicalOperator, b as OnyxConfig, a8 as OnyxDocument, ac as QueryCondition, ab as QueryCriteria, a4 as QueryCriteriaOperator, af as QueryPage, Q as QueryResults, a as QueryResultsPromise, R as RetryOptions, K as SchemaAttribute, _ as SchemaAttributeChange, G as SchemaDataType, a3 as SchemaDiff, U as SchemaEntity, X as SchemaHistoryEntry, J as SchemaIdentifier, H as SchemaIdentifierGenerator, M as SchemaIndex, $ as SchemaIndexChange, L as SchemaIndexType, N as SchemaResolver, a0 as SchemaResolverChange, W as SchemaRevision, V as SchemaRevisionMetadata, a2 as SchemaTableDiff, T as SchemaTrigger, a1 as SchemaTriggerChange, P as SchemaTriggerEvent, Y as SchemaUpsertRequest, Z as SchemaValidationResult, S as SecretMetadata, C as SecretRecord, E as SecretSaveRequest, D as SecretsListResponse, ad as SelectQuery, a6 as Sort, a7 as StreamAction, ae as UpdateQuery, al as asc, aL as avg, at as between, aD as contains, aE as containsIgnoreCase, aN as count, am as desc, an as eq, aX as format, au as gt, av as gte, ap as inOp, aJ as isNull, aB as like, aU as lower, aw as lt, ax as lte, ay as matches, aP as max, aS as median, aO as min, ao as neq, aF as notContains, aG as notContainsIgnoreCase, ar as notIn, aC as notLike, aA as notMatches, aK as notNull, aI as notStartsWith, as as notWithin, aY as percentile, aW as replace, n as sdkName, v as sdkVersion, az as search, aH as startsWith, aQ as std, aV as substring, aM as sum, aT as upper, aR as variance, aq as within } from './aggregates-
|
|
1
|
+
import { O as OnyxFacade } from './aggregates-DREvey7b.js';
|
|
2
|
+
export { t as AiChatClient, l as AiChatCompletionChoice, q as AiChatCompletionChunk, p as AiChatCompletionChunkChoice, o as AiChatCompletionChunkDelta, j as AiChatCompletionRequest, m as AiChatCompletionResponse, r as AiChatCompletionStream, k as AiChatCompletionUsage, f as AiChatMessage, s as AiChatOptions, c as AiChatRole, B as AiClient, z as AiErrorResponse, y as AiModel, x as AiModelsResponse, A as AiRequestOptions, u as AiScriptApprovalRequest, w as AiScriptApprovalResponse, h as AiTool, e as AiToolCall, d as AiToolCallFunction, i as AiToolChoice, g as AiToolFunction, aa as FetchImpl, a9 as FetchResponse, F as FullTextQuery, aj as ICascadeBuilder, ak as ICascadeRelationshipBuilder, ag as IConditionBuilder, I as IOnyxDatabase, ah as IQueryBuilder, ai as ISaveBuilder, a5 as LogicalOperator, b as OnyxConfig, a8 as OnyxDocument, ac as QueryCondition, ab as QueryCriteria, a4 as QueryCriteriaOperator, af as QueryPage, Q as QueryResults, a as QueryResultsPromise, R as RetryOptions, K as SchemaAttribute, _ as SchemaAttributeChange, G as SchemaDataType, a3 as SchemaDiff, U as SchemaEntity, X as SchemaHistoryEntry, J as SchemaIdentifier, H as SchemaIdentifierGenerator, M as SchemaIndex, $ as SchemaIndexChange, L as SchemaIndexType, N as SchemaResolver, a0 as SchemaResolverChange, W as SchemaRevision, V as SchemaRevisionMetadata, a2 as SchemaTableDiff, T as SchemaTrigger, a1 as SchemaTriggerChange, P as SchemaTriggerEvent, Y as SchemaUpsertRequest, Z as SchemaValidationResult, S as SecretMetadata, C as SecretRecord, E as SecretSaveRequest, D as SecretsListResponse, ad as SelectQuery, a6 as Sort, a7 as StreamAction, ae as UpdateQuery, al as asc, aL as avg, at as between, aD as contains, aE as containsIgnoreCase, aN as count, am as desc, an as eq, aX as format, au as gt, av as gte, ap as inOp, aJ as isNull, aB as like, aU as lower, aw as lt, ax as lte, ay as matches, aP as max, aS as median, aO as min, ao as neq, aF as notContains, aG as notContainsIgnoreCase, ar as notIn, aC as notLike, aA as notMatches, aK as notNull, aI as notStartsWith, as as notWithin, aY as percentile, aW as replace, n as sdkName, v as sdkVersion, az as search, aH as startsWith, aQ as std, aV as substring, aM as sum, aT as upper, aR as variance, aq as within } from './aggregates-DREvey7b.js';
|
|
3
3
|
|
|
4
4
|
declare const onyx: OnyxFacade;
|
|
5
5
|
|
package/dist/edge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var name = "@onyx.dev/onyx-database";
|
|
3
|
-
var version = "2.0
|
|
3
|
+
var version = "2.1.0";
|
|
4
4
|
|
|
5
5
|
// src/config/defaults.ts
|
|
6
6
|
var DEFAULT_BASE_URL = "https://api.onyx.dev";
|
|
@@ -1975,20 +1975,38 @@ var AiChatClientImpl = class {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
};
|
|
1977
1977
|
function createOnyxFacade(resolveConfig2) {
|
|
1978
|
-
|
|
1978
|
+
const cachedCfgs = /* @__PURE__ */ new Map();
|
|
1979
|
+
const cacheKey = (databaseId, apiKey) => {
|
|
1980
|
+
const id = typeof databaseId === "string" && databaseId.trim() !== "" ? databaseId.trim() : null;
|
|
1981
|
+
const key = typeof apiKey === "string" && apiKey.trim() !== "" ? apiKey.trim() : null;
|
|
1982
|
+
return id && key ? `${id}-${key}` : null;
|
|
1983
|
+
};
|
|
1979
1984
|
function resolveConfigWithCache(config) {
|
|
1980
1985
|
const ttl = config?.ttl ?? DEFAULT_CACHE_TTL;
|
|
1981
1986
|
const now = Date.now();
|
|
1982
|
-
|
|
1983
|
-
|
|
1987
|
+
const hintKey = cacheKey(config?.databaseId, config?.apiKey) ?? "__default__";
|
|
1988
|
+
const existing = cachedCfgs.get(hintKey);
|
|
1989
|
+
if (existing && existing.expires > now) {
|
|
1990
|
+
return existing.promise;
|
|
1984
1991
|
}
|
|
1992
|
+
if (existing) cachedCfgs.delete(hintKey);
|
|
1985
1993
|
const { ttl: _ttl, requestLoggingEnabled: _reqLog, responseLoggingEnabled: _resLog, ...rest } = config ?? {};
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1994
|
+
const expires = now + ttl;
|
|
1995
|
+
const promise = resolveConfig2(rest).then((resolved) => {
|
|
1996
|
+
const resolvedKey = cacheKey(resolved.databaseId, resolved.apiKey) ?? hintKey;
|
|
1997
|
+
const nextExpires = Date.now() + ttl;
|
|
1998
|
+
cachedCfgs.set(resolvedKey, { promise, expires: nextExpires });
|
|
1999
|
+
if (resolvedKey !== hintKey) {
|
|
2000
|
+
const stale = cachedCfgs.get(hintKey);
|
|
2001
|
+
if (stale && stale.promise === promise) cachedCfgs.delete(hintKey);
|
|
2002
|
+
}
|
|
2003
|
+
return resolved;
|
|
2004
|
+
});
|
|
2005
|
+
cachedCfgs.set(hintKey, { promise, expires });
|
|
1988
2006
|
return promise;
|
|
1989
2007
|
}
|
|
1990
2008
|
function clearCacheConfig() {
|
|
1991
|
-
|
|
2009
|
+
cachedCfgs.clear();
|
|
1992
2010
|
}
|
|
1993
2011
|
return {
|
|
1994
2012
|
init(config) {
|