@redocly/replay 0.29.0-next.1 → 0.29.0-next.3
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/{replay-AiChatProvider-Z_799APd.js → replay-AiChatProvider-Bnz0LDFD.js} +52 -52
- package/dist/{replay-AiChatProvider-B1_-wlJK.js → replay-AiChatProvider-C5p3nTV1.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-C_-_P0T7.js → replay-AiChatSqliteDBStorage-DYxoSZak.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-B9waB0dA.js → replay-AiChatSqliteDBStorage-Dfbp6Mt_.js} +1 -1
- package/dist/{replay-AiPanel-IRetnmbM.js → replay-AiPanel-BSg5Bap4.js} +1 -1
- package/dist/{replay-AiPanel-DvSoNrnz.js → replay-AiPanel-C0E1A47H.js} +4 -4
- package/dist/{replay-FileWatcher-CUqV5dPp.js → replay-FileWatcher-Ba9Ob_Sy.js} +1 -1
- package/dist/{replay-FileWatcher-CZZXT8GC.js → replay-FileWatcher-BiAGOR1Z.js} +2 -2
- package/dist/{replay-SemanticSearchService-BzE8FK8a.js → replay-SemanticSearchService-IInvoSoP.js} +1 -1
- package/dist/{replay-SemanticSearchService-B8R-ATMA.js → replay-SemanticSearchService-sIjG5Wxe.js} +20 -20
- package/dist/{replay-SqliteDBStorage-CPOEQnSp.js → replay-SqliteDBStorage-C-ovuJna.js} +1 -1
- package/dist/{replay-SqliteDBStorage-DVQZek3n.js → replay-SqliteDBStorage-DMoeVRXU.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-BfE1TXkK.js → replay-TauriFileSystemAdapter-CB9S1PNT.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-Zb6LTS_-.js → replay-TauriFileSystemAdapter-DDo2h7gX.js} +1 -1
- package/dist/{replay-TauriRootStorage-BY7MGWGe.js → replay-TauriRootStorage-BX-XrEN-.js} +1 -1
- package/dist/{replay-TauriRootStorage-CUGppZsY.js → replay-TauriRootStorage-CR1PyBgZ.js} +12 -12
- package/dist/{replay-agent-loop-BxPUGZq1.js → replay-agent-loop-4YtdgkDh.js} +5 -5
- package/dist/{replay-agent-loop-BB-UIrKo.js → replay-agent-loop-BmoYEhOB.js} +1 -1
- package/dist/{replay-ai-chat-mappers-C4L8p2zl.js → replay-ai-chat-mappers-42FEVsfw.js} +1 -1
- package/dist/{replay-ai-chat-mappers-DAyPOhQn.js → replay-ai-chat-mappers-CgjhiNr7.js} +1 -1
- package/dist/{replay-create-model-BnoDQ7OX.js → replay-create-model-4Yknbfme.js} +3 -3
- package/dist/{replay-create-model-ebcSRl3r.js → replay-create-model-kF4veQPK.js} +4 -4
- package/dist/{replay-db-og5UtVrp.js → replay-db-B3tQE-B9.js} +6 -6
- package/dist/{replay-db-xD_5VGuR.js → replay-db-_hwn1n5t.js} +1 -1
- package/dist/{replay-external-resolver-DtqY6Ddl.js → replay-external-resolver-DS7qAi0G.js} +2 -2
- package/dist/{replay-external-resolver-1bxcPBye.js → replay-external-resolver-DX5JrdGB.js} +1 -1
- package/dist/replay-index-BDRC1QoR.js +7199 -0
- package/dist/{replay-index-wPsTqXSf.js → replay-index-BYEUJTGe.js} +1 -1
- package/dist/{replay-index-PEthMsJx.js → replay-index-Bwbd4CsO.js} +31 -31
- package/dist/replay-index-CHdCQ_zw.js +4 -0
- package/dist/{replay-index-rbCwID24.js → replay-index-CtxNTrRQ.js} +1 -1
- package/dist/{replay-index-Clfun2IN.js → replay-index-DD1leCQo.js} +1 -1
- package/dist/{replay-index-C33Z16Rm.js → replay-index-KN9FLfwz.js} +54006 -39937
- package/dist/{replay-index-C7MCjO6i.js → replay-index-r6bsSAe6.js} +1 -1
- package/dist/replay-lint-BvndGL38.js +121 -0
- package/dist/replay-lint-C3ireP5A.js +22803 -0
- package/dist/replay-lint-graphql-CK8-ZL5Q.js +1 -0
- package/dist/replay-lint-graphql-DKP9oX8y.js +99 -0
- package/dist/{replay-periodic-revalidation-KHXYhF4T.js → replay-periodic-revalidation-BcWBqn6g.js} +1 -1
- package/dist/{replay-periodic-revalidation-Cuzq23M8.js → replay-periodic-revalidation-chHSyw20.js} +1 -1
- package/dist/{replay-resolve-C2l91lf8.js → replay-resolve-B1Kvf3fM.js} +1 -1
- package/dist/{replay-resolve-C0VBozxM.js → replay-resolve-DC-rmKvK.js} +1 -1
- package/dist/{replay-respect-run-BN4jlLVY.js → replay-respect-run-C24QylJ-.js} +1 -1
- package/dist/{replay-respect-run-B25T_yI0.js → replay-respect-run-DDZ9eF0k.js} +3 -3
- package/dist/{replay-tauri-path-DpnuyiYr.js → replay-tauri-path-Bz_q3KUG.js} +2 -2
- package/dist/{replay-tauri-path-9tVlry3g.js → replay-tauri-path-DBSmio5_.js} +1 -1
- package/dist/{replay-useAiChatQueries-Bi_6G8WU.js → replay-useAiChatQueries-C_GZ_b68.js} +1 -1
- package/dist/{replay-useAiChatQueries-DLSFwWvn.js → replay-useAiChatQueries-DQks2tVS.js} +4 -4
- package/dist/{replay-validate-key-BQB45O00.js → replay-validate-key-DScTTPU4.js} +1 -1
- package/dist/{replay-validate-key-DnQefCz3.js → replay-validate-key-c2nCLxiG.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +11 -11
- package/package.json +5 -2
- package/dist/replay-index-LcDbGH39.js +0 -7026
- package/dist/replay-index-_srgnXqd.js +0 -4
- package/dist/replay-lint-CVXT7IME.js +0 -30232
- package/dist/replay-lint-fhGv2lgR.js +0 -177
- package/dist/replay-lint-graphql-BhMbXKkF.js +0 -1956
- package/dist/replay-lint-graphql-DtQhF_PM.js +0 -3
package/dist/{replay-SemanticSearchService-B8R-ATMA.js → replay-SemanticSearchService-sIjG5Wxe.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as f,
|
|
1
|
+
import { i as f, Q as W, U as X, F as y } from "./replay-index-KN9FLfwz.js";
|
|
2
2
|
import { O as z } from "./replay-Observable-D6wKbFwB.js";
|
|
3
3
|
import { p as K } from "./replay-promise-map-limit-Db_42GvV.js";
|
|
4
4
|
function w(t) {
|
|
@@ -152,8 +152,8 @@ function ce(t) {
|
|
|
152
152
|
return { textParts: e, summaries: n };
|
|
153
153
|
}
|
|
154
154
|
function R(t) {
|
|
155
|
-
const { apiId: e, apiTitle: n, path: o, method: s, op: i, pathItem: r, globalSchemes: c, apiSecurity: a } = t, u = i.summary ?? "", l = w(i.description ?? ""), d = i.operationId ?? "", p = i.tags ?? [], m = s.toUpperCase(), g = V(i, r), h = ne(i.security, a, c),
|
|
156
|
-
d &&
|
|
155
|
+
const { apiId: e, apiTitle: n, path: o, method: s, op: i, pathItem: r, globalSchemes: c, apiSecurity: a } = t, u = i.summary ?? "", l = w(i.description ?? ""), d = i.operationId ?? "", p = i.tags ?? [], m = s.toUpperCase(), g = V(i, r), h = ne(i.security, a, c), x = h.length > 0 ? h.map((_) => `api_sec:${e}:${_.schemeName}`) : void 0, I = [n, `${m} ${o}`, u, l];
|
|
156
|
+
d && I.push(`operationId: ${d}`), p.length > 0 && I.push(`Tags: ${p.join(", ")}`), i.deprecated && I.push("DEPRECATED"), g.length > 0 && I.push(`Parameters: ${g.map(J).join(". ")}.`);
|
|
157
157
|
let k;
|
|
158
158
|
const v = [], T = i.requestBody;
|
|
159
159
|
if (T) {
|
|
@@ -162,16 +162,16 @@ function R(t) {
|
|
|
162
162
|
const N = re(_, {
|
|
163
163
|
hideReadOnly: m === "POST" || m === "PUT" || m === "PATCH"
|
|
164
164
|
});
|
|
165
|
-
N.textPart &&
|
|
165
|
+
N.textPart && I.push(N.textPart), k = N.schemaJson, v.push(...N.examples);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
const { textParts: B, summaries: A } = ce(
|
|
169
169
|
i.responses ?? {}
|
|
170
170
|
);
|
|
171
|
-
B.length > 0 &&
|
|
171
|
+
B.length > 0 && I.push(`Responses: ${B.join(", ")}.`);
|
|
172
172
|
const C = ie(h);
|
|
173
|
-
C &&
|
|
174
|
-
const E = `api_op:${e}:${o}:${s}:${d || `${o}-${s}`}`,
|
|
173
|
+
C && I.push(C);
|
|
174
|
+
const E = `api_op:${e}:${o}:${s}:${d || `${o}-${s}`}`, G = {
|
|
175
175
|
type: "api_operation",
|
|
176
176
|
id: E,
|
|
177
177
|
contentHash: "",
|
|
@@ -186,13 +186,13 @@ function R(t) {
|
|
|
186
186
|
parameterDetails: g.length > 0 ? g : void 0,
|
|
187
187
|
requestBodySchema: k,
|
|
188
188
|
responseSchemas: A.length > 0 ? A : void 0,
|
|
189
|
-
securitySchemeRefs:
|
|
189
|
+
securitySchemeRefs: x,
|
|
190
190
|
examples: v.length > 0 ? v : void 0
|
|
191
191
|
};
|
|
192
192
|
return {
|
|
193
193
|
id: E,
|
|
194
|
-
text: S(
|
|
195
|
-
payload:
|
|
194
|
+
text: S(I.filter(Boolean).join(" ")),
|
|
195
|
+
payload: G
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
function ae(t) {
|
|
@@ -338,11 +338,11 @@ function pe(t) {
|
|
|
338
338
|
const d = i.parameters ? le(i.parameters) : [];
|
|
339
339
|
d.length > 0 && l.push(`Parameters: ${d.map(J).join(". ")}.`), i.requestBody?.type && l.push(`Request body type: ${i.requestBody.type}`);
|
|
340
340
|
const m = (i.successCriteria ?? []).map((h) => {
|
|
341
|
-
let
|
|
342
|
-
return h.context && (
|
|
341
|
+
let x = h.condition;
|
|
342
|
+
return h.context && (x += ` context: ${h.context}`), h.type && (x += ` (${h.type})`), x;
|
|
343
343
|
});
|
|
344
344
|
if (m.length > 0 && l.push(`Success criteria: ${m.join("; ")}`), i.outputs?.length) {
|
|
345
|
-
const h = i.outputs.map((
|
|
345
|
+
const h = i.outputs.map((x) => `${x.key}=${x.value}`).filter(Boolean);
|
|
346
346
|
h.length && l.push(`Outputs: ${h.join(", ")}`);
|
|
347
347
|
}
|
|
348
348
|
const g = `step:${e}:${o}:${r}`;
|
|
@@ -368,7 +368,7 @@ function pe(t) {
|
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function Q(t) {
|
|
372
372
|
const e = [];
|
|
373
373
|
for (const n of t) {
|
|
374
374
|
const o = n.id, s = n.info?.title ?? "Untitled Collection";
|
|
@@ -385,7 +385,7 @@ function G(t) {
|
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
387
|
function fe(t, e) {
|
|
388
|
-
return [...L(t), ...
|
|
388
|
+
return [...L(t), ...Q(e)];
|
|
389
389
|
}
|
|
390
390
|
const O = 10, he = 4;
|
|
391
391
|
function H(t) {
|
|
@@ -398,7 +398,7 @@ function me(t) {
|
|
|
398
398
|
return W(X(t));
|
|
399
399
|
}
|
|
400
400
|
const ye = {};
|
|
401
|
-
class
|
|
401
|
+
class xe extends z {
|
|
402
402
|
constructor(e) {
|
|
403
403
|
super(), this.collectionName = e;
|
|
404
404
|
}
|
|
@@ -535,7 +535,7 @@ class Ie extends z {
|
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
const M = "replay_search",
|
|
538
|
+
const M = "replay_search", Ie = 384, $ = {
|
|
539
539
|
added: 0,
|
|
540
540
|
updated: 0,
|
|
541
541
|
removed: 0,
|
|
@@ -553,7 +553,7 @@ class ge extends z {
|
|
|
553
553
|
return this.projectId ? `${M}_${this.projectId}` : M;
|
|
554
554
|
}
|
|
555
555
|
createIndexer() {
|
|
556
|
-
const e = new
|
|
556
|
+
const e = new xe(this.collectionName);
|
|
557
557
|
return e.subscribe("indexing-activity", (n) => {
|
|
558
558
|
this.emit("indexing-activity", n);
|
|
559
559
|
}), e;
|
|
@@ -595,7 +595,7 @@ class ge extends z {
|
|
|
595
595
|
await f("plugin:velesdb|create_collection", {
|
|
596
596
|
request: {
|
|
597
597
|
name: this.collectionName,
|
|
598
|
-
dimension:
|
|
598
|
+
dimension: Ie,
|
|
599
599
|
metric: "cosine",
|
|
600
600
|
storage_mode: "full"
|
|
601
601
|
}
|
|
@@ -609,7 +609,7 @@ class ge extends z {
|
|
|
609
609
|
}
|
|
610
610
|
async indexCollections(e) {
|
|
611
611
|
if (!y()) return $;
|
|
612
|
-
const n = this.collectionName, o = this.getIndexer(), s =
|
|
612
|
+
const n = this.collectionName, o = this.getIndexer(), s = Q(e), i = { collectionIds: e.map((r) => r.id) };
|
|
613
613
|
return await this.ensureInitialized(), this.enqueueIndex(async () => this.collectionName !== n ? $ : o.indexDocuments(s, i), P);
|
|
614
614
|
}
|
|
615
615
|
async removeApi(e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Qe } from "./replay-index-
|
|
1
|
+
import { i as Qe } from "./replay-index-KN9FLfwz.js";
|
|
2
2
|
import { h as Ve } from "./replay-history.schema-B0lLwmdG.js";
|
|
3
3
|
import { s as Ue } from "./replay-step-context.schema-BOprzd6Z.js";
|
|
4
4
|
import { b as J, c as X, a as ee } from "./replay-ai-message-parts.schema-DKLf0SiG.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("./replay-index-LcDbGH39.js"),Te=require("./replay-history.schema-miM3Etuf.js"),Qe=require("./replay-step-context.schema-BuuXkAck.js"),C=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),t=require("./replay-indexes-Dqjl8m6C.js");class Ce{static[t.entityKind]="ConsoleLogWriter";write(e){console.log(e)}}class ve{static[t.entityKind]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new Ce}logQuery(e,s){const i=s.map(n=>{try{return JSON.stringify(n)}catch{return String(n)}}),r=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${r}`)}}class Le{static[t.entityKind]="NoopLogger";logQuery(){}}const re=Symbol.for("drizzle:PgInlineForeignKeys"),ne=Symbol.for("drizzle:EnableRLS");class $e extends t.Table{static[t.entityKind]="PgTable";static Symbol=Object.assign({},t.Table.Symbol,{InlineForeignKeys:re,EnableRLS:ne});[re]=[];[ne]=!1;[t.Table.Symbol.ExtraConfigBuilder]=void 0;[t.Table.Symbol.ExtraConfigColumns]={}}class Ne{static[t.entityKind]="PgPrimaryKeyBuilder";columns;name;constructor(e,s){this.columns=e,this.name=s}build(e){return new xe(e,this.columns,this.name)}}class xe{constructor(e,s,i){this.table=e,this.columns=s,this.name=i}static[t.entityKind]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[$e.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}class de{constructor(e,s,i){this.sourceTable=e,this.referencedTable=s,this.relationName=i,this.referencedTableName=s[t.Table.Symbol.Name]}static[t.entityKind]="Relation";referencedTableName;fieldName}class fe{constructor(e,s){this.table=e,this.config=s}static[t.entityKind]="Relations"}class A extends de{constructor(e,s,i,r){super(e,s,i?.relationName),this.config=i,this.isNullable=r}static[t.entityKind]="One";withFieldName(e){const s=new A(this.sourceTable,this.referencedTable,this.config,this.isNullable);return s.fieldName=e,s}}class J extends de{constructor(e,s,i){super(e,s,i?.relationName),this.config=i}static[t.entityKind]="Many";withFieldName(e){const s=new J(this.sourceTable,this.referencedTable,this.config);return s.fieldName=e,s}}function Re(){return{and:t.and,between:t.between,eq:t.eq,exists:t.exists,gt:t.gt,gte:t.gte,ilike:t.ilike,inArray:t.inArray,isNull:t.isNull,isNotNull:t.isNotNull,like:t.like,lt:t.lt,lte:t.lte,ne:t.ne,not:t.not,notBetween:t.notBetween,notExists:t.notExists,notLike:t.notLike,notIlike:t.notIlike,notInArray:t.notInArray,or:t.or,sql:t.sql}}function Be(){return{sql:t.sql,asc:t.asc,desc:t.desc}}function _e(o,e){Object.keys(o).length===1&&"default"in o&&!t.is(o.default,t.Table)&&(o=o.default);const s={},i={},r={};for(const[n,a]of Object.entries(o))if(t.is(a,t.Table)){const l=t.getTableUniqueName(a),c=i[l];s[l]=n,r[n]={tsName:n,dbName:a[t.Table.Symbol.Name],schema:a[t.Table.Symbol.Schema],columns:a[t.Table.Symbol.Columns],relations:c?.relations??{},primaryKey:c?.primaryKey??[]};for(const h of Object.values(a[t.Table.Symbol.Columns]))h.primary&&r[n].primaryKey.push(h);const u=a[t.Table.Symbol.ExtraConfigBuilder]?.(a[t.Table.Symbol.ExtraConfigColumns]);if(u)for(const h of Object.values(u))t.is(h,Ne)&&r[n].primaryKey.push(...h.columns)}else if(t.is(a,fe)){const l=t.getTableUniqueName(a.table),c=s[l],u=a.config(e(a.table));let h;for(const[f,w]of Object.entries(u))if(c){const q=r[c];q.relations[f]=w}else l in i||(i[l]={relations:{},primaryKey:h}),i[l].relations[f]=w}return{tables:r,tableNamesMap:s}}function Z(o,e){return new fe(o,s=>Object.fromEntries(Object.entries(e(s)).map(([i,r])=>[i,r.withFieldName(i)])))}function Oe(o){return function(s,i){return new A(o,s,i,i?.fields.reduce((r,n)=>r&&n.notNull,!0)??!1)}}function Me(o){return function(s,i){return new J(o,s,i)}}function Ae(o,e,s){if(t.is(s,A)&&s.config)return{fields:s.config.fields,references:s.config.references};const i=e[t.getTableUniqueName(s.referencedTable)];if(!i)throw new Error(`Table "${s.referencedTable[t.Table.Symbol.Name]}" not found in schema`);const r=o[i];if(!r)throw new Error(`Table "${i}" not found in schema`);const n=s.sourceTable,a=e[t.getTableUniqueName(n)];if(!a)throw new Error(`Table "${n[t.Table.Symbol.Name]}" not found in schema`);const l=[];for(const c of Object.values(r.relations))(s.relationName&&s!==c&&c.relationName===s.relationName||!s.relationName&&c.referencedTable===s.sourceTable)&&l.push(c);if(l.length>1)throw s.relationName?new Error(`There are multiple relations with name "${s.relationName}" in table "${i}"`):new Error(`There are multiple relations between "${i}" and "${s.sourceTable[t.Table.Symbol.Name]}". Please specify relation name`);if(l[0]&&t.is(l[0],A)&&l[0].config)return{fields:l[0].config.references,references:l[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${s.fieldName}"`)}function Ke(o){return{one:Oe(o),many:Me(o)}}function Y(o,e,s,i,r=n=>n){const n={};for(const[a,l]of i.entries())if(l.isJson){const c=e.relations[l.tsKey],u=s[a],h=typeof u=="string"?JSON.parse(u):u;n[l.tsKey]=t.is(c,A)?h&&Y(o,o[l.relationTableTsKey],h,l.selection,r):h.map(f=>Y(o,o[l.relationTableTsKey],f,l.selection,r))}else{const c=r(s[a]),u=l.field;let h;t.is(u,t.Column)?h=u:t.is(u,t.SQL)?h=u.decoder:h=u.sql.decoder,n[l.tsKey]=c===null?null:h.mapFromDriverValue(c)}return n}class I{constructor(e){this.table=e}static[t.entityKind]="ColumnAliasProxyHandler";get(e,s){return s==="table"?this.table:e[s]}}class X{constructor(e,s){this.alias=e,this.replaceOriginalName=s}static[t.entityKind]="TableAliasProxyHandler";get(e,s){if(s===t.Table.Symbol.IsAlias)return!0;if(s===t.Table.Symbol.Name)return this.alias;if(this.replaceOriginalName&&s===t.Table.Symbol.OriginalName)return this.alias;if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],name:this.alias,isAlias:!0};if(s===t.Table.Symbol.Columns){const r=e[t.Table.Symbol.Columns];if(!r)return r;const n={};return Object.keys(r).map(a=>{n[a]=new Proxy(r[a],new I(new Proxy(e,this)))}),n}const i=e[s];return t.is(i,t.Column)?new Proxy(i,new I(new Proxy(e,this))):i}}function H(o,e){return new Proxy(o,new X(e,!1))}function B(o,e){return new Proxy(o,new I(new Proxy(o.table,new X(e,!1))))}function me(o,e){return new t.SQL.Aliased(k(o.sql,e),o.fieldAlias)}function k(o,e){return t.sql.join(o.queryChunks.map(s=>t.is(s,t.Column)?B(s,e):t.is(s,t.SQL)?k(s,e):t.is(s,t.SQL.Aliased)?me(s,e):s))}class Q{static[t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,s){if(s==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],selectedFields:new Proxy(e[t.ViewBaseConfig].selectedFields,this)};if(typeof s=="symbol")return e[s];const r=(t.is(e,t.Subquery)?e._.selectedFields:t.is(e,t.View)?e[t.ViewBaseConfig].selectedFields:e)[s];if(t.is(r,t.SQL.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!r.isSelectionField)return r.sql;const n=r.clone();return n.isSelectionField=!0,n}if(t.is(r,t.SQL)){if(this.config.sqlBehavior==="sql")return r;throw new Error(`You tried to reference "${s}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return t.is(r,t.Column)?this.config.alias?new Proxy(r,new I(new Proxy(r.table,new X(this.config.alias,this.config.replaceOriginalName??!1)))):r:typeof r!="object"||r===null?r:new Proxy(r,new Q(this.config))}}class K{static[t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(s=>(e?.(),s),s=>{throw e?.(),s})}then(e,s){return this.execute().then(e,s)}}function M(o){return t.is(o,t.SQLiteTable)?[`${o[t.Table.Symbol.BaseName]}`]:t.is(o,t.Subquery)?o._.usedTables??[]:t.is(o,t.SQL)?o.usedTables??[]:[]}class ae extends K{constructor(e,s,i,r){super(),this.table=e,this.session=s,this.dialect=i,this.config={table:e,withList:r}}static[t.entityKind]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){const s=e[0](new Proxy(this.config.table[t.Table.Symbol.Columns],new Q({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(s)?s:[s];this.config.orderBy=i}else{const s=e;this.config.orderBy=s}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[t.SQLiteTable.Symbol.Columns]){return this.config.returning=t.orderSelectedFields(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...s}=this.dialect.sqlToQuery(this.getSQL());return s}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:M(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function Pe(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(s=>s.toLowerCase()).join("_")}function je(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((s,i,r)=>{const n=r===0?i.toLowerCase():`${i[0].toUpperCase()}${i.slice(1)}`;return s+n},"")}function Ee(o){return o}class Fe{static[t.entityKind]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Pe:e==="camelCase"?je:Ee}getColumnCasing(e){if(!e.keyAsName)return e.name;const s=e.table[t.Table.Symbol.Schema]??"public",i=e.table[t.Table.Symbol.OriginalName],r=`${s}.${i}.${e.name}`;return this.cache[r]||this.cacheTable(e.table),this.cache[r]}cacheTable(e){const s=e[t.Table.Symbol.Schema]??"public",i=e[t.Table.Symbol.OriginalName],r=`${s}.${i}`;if(!this.cachedTables[r]){for(const n of Object.values(e[t.Table.Symbol.Columns])){const a=`${r}.${n.name}`;this.cache[a]=this.convert(n.name)}this.cachedTables[r]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class ee extends Error{static[t.entityKind]="DrizzleError";constructor({message:e,cause:s}){super(e),this.name="DrizzleError",this.cause=s}}class _ extends Error{constructor(e,s,i){super(`Failed query: ${e}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("./replay-index-BDRC1QoR.js"),Te=require("./replay-history.schema-miM3Etuf.js"),Qe=require("./replay-step-context.schema-BuuXkAck.js"),C=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),t=require("./replay-indexes-Dqjl8m6C.js");class Ce{static[t.entityKind]="ConsoleLogWriter";write(e){console.log(e)}}class ve{static[t.entityKind]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new Ce}logQuery(e,s){const i=s.map(n=>{try{return JSON.stringify(n)}catch{return String(n)}}),r=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${r}`)}}class Le{static[t.entityKind]="NoopLogger";logQuery(){}}const re=Symbol.for("drizzle:PgInlineForeignKeys"),ne=Symbol.for("drizzle:EnableRLS");class $e extends t.Table{static[t.entityKind]="PgTable";static Symbol=Object.assign({},t.Table.Symbol,{InlineForeignKeys:re,EnableRLS:ne});[re]=[];[ne]=!1;[t.Table.Symbol.ExtraConfigBuilder]=void 0;[t.Table.Symbol.ExtraConfigColumns]={}}class Ne{static[t.entityKind]="PgPrimaryKeyBuilder";columns;name;constructor(e,s){this.columns=e,this.name=s}build(e){return new xe(e,this.columns,this.name)}}class xe{constructor(e,s,i){this.table=e,this.columns=s,this.name=i}static[t.entityKind]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[$e.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}class de{constructor(e,s,i){this.sourceTable=e,this.referencedTable=s,this.relationName=i,this.referencedTableName=s[t.Table.Symbol.Name]}static[t.entityKind]="Relation";referencedTableName;fieldName}class fe{constructor(e,s){this.table=e,this.config=s}static[t.entityKind]="Relations"}class A extends de{constructor(e,s,i,r){super(e,s,i?.relationName),this.config=i,this.isNullable=r}static[t.entityKind]="One";withFieldName(e){const s=new A(this.sourceTable,this.referencedTable,this.config,this.isNullable);return s.fieldName=e,s}}class J extends de{constructor(e,s,i){super(e,s,i?.relationName),this.config=i}static[t.entityKind]="Many";withFieldName(e){const s=new J(this.sourceTable,this.referencedTable,this.config);return s.fieldName=e,s}}function Re(){return{and:t.and,between:t.between,eq:t.eq,exists:t.exists,gt:t.gt,gte:t.gte,ilike:t.ilike,inArray:t.inArray,isNull:t.isNull,isNotNull:t.isNotNull,like:t.like,lt:t.lt,lte:t.lte,ne:t.ne,not:t.not,notBetween:t.notBetween,notExists:t.notExists,notLike:t.notLike,notIlike:t.notIlike,notInArray:t.notInArray,or:t.or,sql:t.sql}}function Be(){return{sql:t.sql,asc:t.asc,desc:t.desc}}function _e(o,e){Object.keys(o).length===1&&"default"in o&&!t.is(o.default,t.Table)&&(o=o.default);const s={},i={},r={};for(const[n,a]of Object.entries(o))if(t.is(a,t.Table)){const l=t.getTableUniqueName(a),c=i[l];s[l]=n,r[n]={tsName:n,dbName:a[t.Table.Symbol.Name],schema:a[t.Table.Symbol.Schema],columns:a[t.Table.Symbol.Columns],relations:c?.relations??{},primaryKey:c?.primaryKey??[]};for(const h of Object.values(a[t.Table.Symbol.Columns]))h.primary&&r[n].primaryKey.push(h);const u=a[t.Table.Symbol.ExtraConfigBuilder]?.(a[t.Table.Symbol.ExtraConfigColumns]);if(u)for(const h of Object.values(u))t.is(h,Ne)&&r[n].primaryKey.push(...h.columns)}else if(t.is(a,fe)){const l=t.getTableUniqueName(a.table),c=s[l],u=a.config(e(a.table));let h;for(const[f,w]of Object.entries(u))if(c){const q=r[c];q.relations[f]=w}else l in i||(i[l]={relations:{},primaryKey:h}),i[l].relations[f]=w}return{tables:r,tableNamesMap:s}}function Z(o,e){return new fe(o,s=>Object.fromEntries(Object.entries(e(s)).map(([i,r])=>[i,r.withFieldName(i)])))}function Oe(o){return function(s,i){return new A(o,s,i,i?.fields.reduce((r,n)=>r&&n.notNull,!0)??!1)}}function Me(o){return function(s,i){return new J(o,s,i)}}function Ae(o,e,s){if(t.is(s,A)&&s.config)return{fields:s.config.fields,references:s.config.references};const i=e[t.getTableUniqueName(s.referencedTable)];if(!i)throw new Error(`Table "${s.referencedTable[t.Table.Symbol.Name]}" not found in schema`);const r=o[i];if(!r)throw new Error(`Table "${i}" not found in schema`);const n=s.sourceTable,a=e[t.getTableUniqueName(n)];if(!a)throw new Error(`Table "${n[t.Table.Symbol.Name]}" not found in schema`);const l=[];for(const c of Object.values(r.relations))(s.relationName&&s!==c&&c.relationName===s.relationName||!s.relationName&&c.referencedTable===s.sourceTable)&&l.push(c);if(l.length>1)throw s.relationName?new Error(`There are multiple relations with name "${s.relationName}" in table "${i}"`):new Error(`There are multiple relations between "${i}" and "${s.sourceTable[t.Table.Symbol.Name]}". Please specify relation name`);if(l[0]&&t.is(l[0],A)&&l[0].config)return{fields:l[0].config.references,references:l[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${s.fieldName}"`)}function Ke(o){return{one:Oe(o),many:Me(o)}}function Y(o,e,s,i,r=n=>n){const n={};for(const[a,l]of i.entries())if(l.isJson){const c=e.relations[l.tsKey],u=s[a],h=typeof u=="string"?JSON.parse(u):u;n[l.tsKey]=t.is(c,A)?h&&Y(o,o[l.relationTableTsKey],h,l.selection,r):h.map(f=>Y(o,o[l.relationTableTsKey],f,l.selection,r))}else{const c=r(s[a]),u=l.field;let h;t.is(u,t.Column)?h=u:t.is(u,t.SQL)?h=u.decoder:h=u.sql.decoder,n[l.tsKey]=c===null?null:h.mapFromDriverValue(c)}return n}class I{constructor(e){this.table=e}static[t.entityKind]="ColumnAliasProxyHandler";get(e,s){return s==="table"?this.table:e[s]}}class X{constructor(e,s){this.alias=e,this.replaceOriginalName=s}static[t.entityKind]="TableAliasProxyHandler";get(e,s){if(s===t.Table.Symbol.IsAlias)return!0;if(s===t.Table.Symbol.Name)return this.alias;if(this.replaceOriginalName&&s===t.Table.Symbol.OriginalName)return this.alias;if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],name:this.alias,isAlias:!0};if(s===t.Table.Symbol.Columns){const r=e[t.Table.Symbol.Columns];if(!r)return r;const n={};return Object.keys(r).map(a=>{n[a]=new Proxy(r[a],new I(new Proxy(e,this)))}),n}const i=e[s];return t.is(i,t.Column)?new Proxy(i,new I(new Proxy(e,this))):i}}function H(o,e){return new Proxy(o,new X(e,!1))}function B(o,e){return new Proxy(o,new I(new Proxy(o.table,new X(e,!1))))}function me(o,e){return new t.SQL.Aliased(k(o.sql,e),o.fieldAlias)}function k(o,e){return t.sql.join(o.queryChunks.map(s=>t.is(s,t.Column)?B(s,e):t.is(s,t.SQL)?k(s,e):t.is(s,t.SQL.Aliased)?me(s,e):s))}class Q{static[t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,s){if(s==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(s===t.ViewBaseConfig)return{...e[t.ViewBaseConfig],selectedFields:new Proxy(e[t.ViewBaseConfig].selectedFields,this)};if(typeof s=="symbol")return e[s];const r=(t.is(e,t.Subquery)?e._.selectedFields:t.is(e,t.View)?e[t.ViewBaseConfig].selectedFields:e)[s];if(t.is(r,t.SQL.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!r.isSelectionField)return r.sql;const n=r.clone();return n.isSelectionField=!0,n}if(t.is(r,t.SQL)){if(this.config.sqlBehavior==="sql")return r;throw new Error(`You tried to reference "${s}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return t.is(r,t.Column)?this.config.alias?new Proxy(r,new I(new Proxy(r.table,new X(this.config.alias,this.config.replaceOriginalName??!1)))):r:typeof r!="object"||r===null?r:new Proxy(r,new Q(this.config))}}class K{static[t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(s=>(e?.(),s),s=>{throw e?.(),s})}then(e,s){return this.execute().then(e,s)}}function M(o){return t.is(o,t.SQLiteTable)?[`${o[t.Table.Symbol.BaseName]}`]:t.is(o,t.Subquery)?o._.usedTables??[]:t.is(o,t.SQL)?o.usedTables??[]:[]}class ae extends K{constructor(e,s,i,r){super(),this.table=e,this.session=s,this.dialect=i,this.config={table:e,withList:r}}static[t.entityKind]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){const s=e[0](new Proxy(this.config.table[t.Table.Symbol.Columns],new Q({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(s)?s:[s];this.config.orderBy=i}else{const s=e;this.config.orderBy=s}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[t.SQLiteTable.Symbol.Columns]){return this.config.returning=t.orderSelectedFields(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...s}=this.dialect.sqlToQuery(this.getSQL());return s}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:M(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function Pe(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(s=>s.toLowerCase()).join("_")}function je(o){return(o.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((s,i,r)=>{const n=r===0?i.toLowerCase():`${i[0].toUpperCase()}${i.slice(1)}`;return s+n},"")}function Ee(o){return o}class Fe{static[t.entityKind]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Pe:e==="camelCase"?je:Ee}getColumnCasing(e){if(!e.keyAsName)return e.name;const s=e.table[t.Table.Symbol.Schema]??"public",i=e.table[t.Table.Symbol.OriginalName],r=`${s}.${i}.${e.name}`;return this.cache[r]||this.cacheTable(e.table),this.cache[r]}cacheTable(e){const s=e[t.Table.Symbol.Schema]??"public",i=e[t.Table.Symbol.OriginalName],r=`${s}.${i}`;if(!this.cachedTables[r]){for(const n of Object.values(e[t.Table.Symbol.Columns])){const a=`${r}.${n.name}`;this.cache[a]=this.convert(n.name)}this.cachedTables[r]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class ee extends Error{static[t.entityKind]="DrizzleError";constructor({message:e,cause:s}){super(e),this.name="DrizzleError",this.cause=s}}class _ extends Error{constructor(e,s,i){super(`Failed query: ${e}
|
|
2
2
|
params: ${s}`),this.query=e,this.params=s,this.cause=i,Error.captureStackTrace(this,_),i&&(this.cause=i)}}class Ie extends ee{static[t.entityKind]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class te extends t.View{static[t.entityKind]="SQLiteViewBase"}class D{static[t.entityKind]="SQLiteDialect";casing;constructor(e){this.casing=new Fe(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;const s=[t.sql`with `];for(const[i,r]of e.entries())s.push(t.sql`${t.sql.identifier(r._.alias)} as (${r._.sql})`),i<e.length-1&&s.push(t.sql`, `);return s.push(t.sql` `),t.sql.join(s)}buildDeleteQuery({table:e,where:s,returning:i,withList:r,limit:n,orderBy:a}){const l=this.buildWithCTE(r),c=i?t.sql` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,u=s?t.sql` where ${s}`:void 0,h=this.buildOrderBy(a),f=this.buildLimit(n);return t.sql`${l}delete from ${e}${u}${c}${h}${f}`}buildUpdateSet(e,s){const i=e[t.Table.Symbol.Columns],r=Object.keys(i).filter(a=>s[a]!==void 0||i[a]?.onUpdateFn!==void 0),n=r.length;return t.sql.join(r.flatMap((a,l)=>{const c=i[a],u=c.onUpdateFn?.(),h=s[a]??(t.is(u,t.SQL)?u:t.sql.param(u,c)),f=t.sql`${t.sql.identifier(this.casing.getColumnCasing(c))} = ${h}`;return l<n-1?[f,t.sql.raw(", ")]:[f]}))}buildUpdateQuery({table:e,set:s,where:i,returning:r,withList:n,joins:a,from:l,limit:c,orderBy:u}){const h=this.buildWithCTE(n),f=this.buildUpdateSet(e,s),w=l&&t.sql.join([t.sql.raw(" from "),this.buildFromTable(l)]),q=this.buildJoins(a),S=r?t.sql` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,g=i?t.sql` where ${i}`:void 0,p=this.buildOrderBy(u),b=this.buildLimit(c);return t.sql`${h}update ${e} set ${f}${w}${q}${g}${S}${p}${b}`}buildSelection(e,{isSingleTable:s=!1}={}){const i=e.length,r=e.flatMap(({field:n},a)=>{const l=[];if(t.is(n,t.SQL.Aliased)&&n.isSelectionField)l.push(t.sql.identifier(n.fieldAlias));else if(t.is(n,t.SQL.Aliased)||t.is(n,t.SQL)){const c=t.is(n,t.SQL.Aliased)?n.sql:n;s?l.push(new t.SQL(c.queryChunks.map(u=>t.is(u,t.Column)?t.sql.identifier(this.casing.getColumnCasing(u)):u))):l.push(c),t.is(n,t.SQL.Aliased)&&l.push(t.sql` as ${t.sql.identifier(n.fieldAlias)}`)}else if(t.is(n,t.Column)){const c=n.table[t.Table.Symbol.Name];n.columnType==="SQLiteNumericBigInt"?s?l.push(t.sql`cast(${t.sql.identifier(this.casing.getColumnCasing(n))} as text)`):l.push(t.sql`cast(${t.sql.identifier(c)}.${t.sql.identifier(this.casing.getColumnCasing(n))} as text)`):s?l.push(t.sql.identifier(this.casing.getColumnCasing(n))):l.push(t.sql`${t.sql.identifier(c)}.${t.sql.identifier(this.casing.getColumnCasing(n))}`)}else if(t.is(n,t.Subquery)){const c=Object.entries(n._.selectedFields);if(c.length===1){const u=c[0][1],h=t.is(u,t.SQL)?u.decoder:t.is(u,t.Column)?{mapFromDriverValue:f=>u.mapFromDriverValue(f)}:u.sql.decoder;h&&(n._.sql.decoder=h)}l.push(n)}return a<i-1&&l.push(t.sql`, `),l});return t.sql.join(r)}buildJoins(e){if(!e||e.length===0)return;const s=[];if(e)for(const[i,r]of e.entries()){i===0&&s.push(t.sql` `);const n=r.table,a=r.on?t.sql` on ${r.on}`:void 0;if(t.is(n,t.SQLiteTable)){const l=n[t.SQLiteTable.Symbol.Name],c=n[t.SQLiteTable.Symbol.Schema],u=n[t.SQLiteTable.Symbol.OriginalName],h=l===u?void 0:r.alias;s.push(t.sql`${t.sql.raw(r.joinType)} join ${c?t.sql`${t.sql.identifier(c)}.`:void 0}${t.sql.identifier(u)}${h&&t.sql` ${t.sql.identifier(h)}`}${a}`)}else s.push(t.sql`${t.sql.raw(r.joinType)} join ${n}${a}`);i<e.length-1&&s.push(t.sql` `)}return t.sql.join(s)}buildLimit(e){return typeof e=="object"||typeof e=="number"&&e>=0?t.sql` limit ${e}`:void 0}buildOrderBy(e){const s=[];if(e)for(const[i,r]of e.entries())s.push(r),i<e.length-1&&s.push(t.sql`, `);return s.length>0?t.sql` order by ${t.sql.join(s)}`:void 0}buildFromTable(e){return t.is(e,t.Table)&&e[t.Table.Symbol.IsAlias]?t.sql`${t.sql`${t.sql.identifier(e[t.Table.Symbol.Schema]??"")}.`.if(e[t.Table.Symbol.Schema])}${t.sql.identifier(e[t.Table.Symbol.OriginalName])} ${t.sql.identifier(e[t.Table.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:s,fieldsFlat:i,where:r,having:n,table:a,joins:l,orderBy:c,groupBy:u,limit:h,offset:f,distinct:w,setOperators:q}){const S=i??t.orderSelectedFields(s);for(const $ of S)if(t.is($.field,t.Column)&&t.getTableName($.field.table)!==(t.is(a,t.Subquery)?a._.alias:t.is(a,te)?a[t.ViewBaseConfig].name:t.is(a,t.SQL)?void 0:t.getTableName(a))&&!(N=>l?.some(({alias:E})=>E===(N[t.Table.Symbol.IsAlias]?t.getTableName(N):N[t.Table.Symbol.BaseName])))($.field.table)){const N=t.getTableName($.field.table);throw new Error(`Your "${$.path.join("->")}" field references a column "${N}"."${$.field.name}", but the table "${N}" is not part of the query! Did you forget to join it?`)}const g=!l||l.length===0,p=this.buildWithCTE(e),b=w?t.sql` distinct`:void 0,v=this.buildSelection(S,{isSingleTable:g}),T=this.buildFromTable(a),m=this.buildJoins(l),x=r?t.sql` where ${r}`:void 0,L=n?t.sql` having ${n}`:void 0,d=[];if(u)for(const[$,N]of u.entries())d.push(N),$<u.length-1&&d.push(t.sql`, `);const y=d.length>0?t.sql` group by ${t.sql.join(d)}`:void 0,R=this.buildOrderBy(c),j=this.buildLimit(h),W=f?t.sql` offset ${f}`:void 0,P=t.sql`${p}select${b} ${v} from ${T}${m}${x}${y}${L}${R}${j}${W}`;return q.length>0?this.buildSetOperations(P,q):P}buildSetOperations(e,s){const[i,...r]=s;if(!i)throw new Error("Cannot pass undefined values to any set operator");return r.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),r)}buildSetOperationQuery({leftSelect:e,setOperator:{type:s,isAll:i,rightSelect:r,limit:n,orderBy:a,offset:l}}){const c=t.sql`${e.getSQL()} `,u=t.sql`${r.getSQL()}`;let h;if(a&&a.length>0){const S=[];for(const g of a)if(t.is(g,t.SQLiteColumn))S.push(t.sql.identifier(g.name));else if(t.is(g,t.SQL)){for(let p=0;p<g.queryChunks.length;p++){const b=g.queryChunks[p];t.is(b,t.SQLiteColumn)&&(g.queryChunks[p]=t.sql.identifier(this.casing.getColumnCasing(b)))}S.push(t.sql`${g}`)}else S.push(t.sql`${g}`);h=t.sql` order by ${t.sql.join(S,t.sql`, `)}`}const f=typeof n=="object"||typeof n=="number"&&n>=0?t.sql` limit ${n}`:void 0,w=t.sql.raw(`${s} ${i?"all ":""}`),q=l?t.sql` offset ${l}`:void 0;return t.sql`${c}${w}${u}${h}${f}${q}`}buildInsertQuery({table:e,values:s,onConflict:i,returning:r,withList:n,select:a}){const l=[],c=e[t.Table.Symbol.Columns],u=Object.entries(c).filter(([g,p])=>!p.shouldDisableInsert()),h=u.map(([,g])=>t.sql.identifier(this.casing.getColumnCasing(g)));if(a){const g=s;t.is(g,t.SQL)?l.push(g):l.push(g.getSQL())}else{const g=s;l.push(t.sql.raw("values "));for(const[p,b]of g.entries()){const v=[];for(const[T,m]of u){const x=b[T];if(x===void 0||t.is(x,t.Param)&&x.value===void 0){let L;if(m.default!==null&&m.default!==void 0)L=t.is(m.default,t.SQL)?m.default:t.sql.param(m.default,m);else if(m.defaultFn!==void 0){const d=m.defaultFn();L=t.is(d,t.SQL)?d:t.sql.param(d,m)}else if(!m.default&&m.onUpdateFn!==void 0){const d=m.onUpdateFn();L=t.is(d,t.SQL)?d:t.sql.param(d,m)}else L=t.sql`null`;v.push(L)}else v.push(x)}l.push(v),p<g.length-1&&l.push(t.sql`, `)}}const f=this.buildWithCTE(n),w=t.sql.join(l),q=r?t.sql` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,S=i?.length?t.sql.join(i):void 0;return t.sql`${f}insert into ${e} ${h} ${w}${S}${q}`}sqlToQuery(e,s){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:s})}buildRelationalQuery({fullSchema:e,schema:s,tableNamesMap:i,table:r,tableConfig:n,queryConfig:a,tableAlias:l,nestedQueryRelation:c,joinOn:u}){let h=[],f,w,q=[],S;const g=[];if(a===!0)h=Object.entries(n.columns).map(([v,T])=>({dbKey:T.name,tsKey:v,field:B(T,l),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{const b=Object.fromEntries(Object.entries(n.columns).map(([d,y])=>[d,B(y,l)]));if(a.where){const d=typeof a.where=="function"?a.where(b,Re()):a.where;S=d&&k(d,l)}const v=[];let T=[];if(a.columns){let d=!1;for(const[y,R]of Object.entries(a.columns))R!==void 0&&y in n.columns&&(!d&&R===!0&&(d=!0),T.push(y));T.length>0&&(T=d?T.filter(y=>a.columns?.[y]===!0):Object.keys(n.columns).filter(y=>!T.includes(y)))}else T=Object.keys(n.columns);for(const d of T){const y=n.columns[d];v.push({tsKey:d,value:y})}let m=[];a.with&&(m=Object.entries(a.with).filter(d=>!!d[1]).map(([d,y])=>({tsKey:d,queryConfig:y,relation:n.relations[d]})));let x;if(a.extras){x=typeof a.extras=="function"?a.extras(b,{sql:t.sql}):a.extras;for(const[d,y]of Object.entries(x))v.push({tsKey:d,value:me(y,l)})}for(const{tsKey:d,value:y}of v)h.push({dbKey:t.is(y,t.SQL.Aliased)?y.fieldAlias:n.columns[d].name,tsKey:d,field:t.is(y,t.Column)?B(y,l):y,relationTableTsKey:void 0,isJson:!1,selection:[]});let L=typeof a.orderBy=="function"?a.orderBy(b,Be()):a.orderBy??[];Array.isArray(L)||(L=[L]),q=L.map(d=>t.is(d,t.Column)?B(d,l):k(d,l)),f=a.limit,w=a.offset;for(const{tsKey:d,queryConfig:y,relation:R}of m){const j=Ae(s,i,R),W=t.getTableUniqueName(R.referencedTable),P=i[W],$=`${l}_${d}`,N=t.and(...j.fields.map((we,qe)=>t.eq(B(j.references[qe],$),B(we,l)))),E=this.buildRelationalQuery({fullSchema:e,schema:s,tableNamesMap:i,table:e[P],tableConfig:s[P],queryConfig:t.is(R,A)?y===!0?{limit:1}:{...y,limit:1}:y,tableAlias:$,joinOn:N,nestedQueryRelation:R}),Se=t.sql`(${E.sql})`.as(d);h.push({dbKey:d,tsKey:d,field:Se,relationTableTsKey:P,isJson:!0,selection:E.selection})}}if(h.length===0)throw new ee({message:`No fields selected for table "${n.tsName}" ("${l}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let p;if(S=t.and(u,S),c){let b=t.sql`json_array(${t.sql.join(h.map(({field:m})=>t.is(m,t.SQLiteColumn)?t.sql.identifier(this.casing.getColumnCasing(m)):t.is(m,t.SQL.Aliased)?m.sql:m),t.sql`, `)})`;t.is(c,J)&&(b=t.sql`coalesce(json_group_array(${b}), json_array())`);const v=[{dbKey:"data",tsKey:"data",field:b.as("data"),isJson:!0,relationTableTsKey:n.tsName,selection:h}];f!==void 0||w!==void 0||q.length>0?(p=this.buildSelectQuery({table:H(r,l),fields:{},fieldsFlat:[{path:[],field:t.sql.raw("*")}],where:S,limit:f,offset:w,orderBy:q,setOperators:[]}),S=void 0,f=void 0,w=void 0,q=void 0):p=H(r,l),p=this.buildSelectQuery({table:t.is(p,t.SQLiteTable)?p:new t.Subquery(p,{},l),fields:{},fieldsFlat:v.map(({field:m})=>({path:[],field:t.is(m,t.Column)?B(m,l):m})),joins:g,where:S,limit:f,offset:w,orderBy:q,setOperators:[]})}else p=this.buildSelectQuery({table:H(r,l),fields:{},fieldsFlat:h.map(({field:b})=>({path:[],field:t.is(b,t.Column)?B(b,l):b})),joins:g,where:S,limit:f,offset:w,orderBy:q,setOperators:[]});return{tableTsKey:n.tsName,sql:p,selection:h}}}class ke extends D{static[t.entityKind]="SQLiteSyncDialect";migrate(e,s,i){const r=i===void 0||typeof i=="string"?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",n=t.sql`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS ${t.sql.identifier(r)} (
|
|
4
4
|
id SERIAL PRIMARY KEY,
|
package/dist/{replay-TauriFileSystemAdapter-BfE1TXkK.js → replay-TauriFileSystemAdapter-CB9S1PNT.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as o, r as u, j as c, P as d, b as h, e as l, s as w, w as y, d as m, f } from "./replay-index-
|
|
1
|
+
import { m as o, r as u, j as c, P as d, b as h, e as l, s as w, w as y, d as m, f } from "./replay-index-KN9FLfwz.js";
|
|
2
2
|
import { O as E } from "./replay-Observable-D6wKbFwB.js";
|
|
3
3
|
const F = /* @__PURE__ */ new Set(["node_modules"]), T = /\(os error [23]\)/;
|
|
4
4
|
function g(r) {
|
package/dist/{replay-TauriFileSystemAdapter-Zb6LTS_-.js → replay-TauriFileSystemAdapter-DDo2h7gX.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./replay-index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./replay-index-BDRC1QoR.js"),o=require("./replay-Observable-bjJ6wkRB.js"),l=new Set(["node_modules"]),u=/\(os error [23]\)/;function d(n){return typeof n!="string"?!1:n.includes("No such file or directory")||n.includes("forbidden path")||u.test(n)}class h extends o.Observable{constructor(e){super(),this.baseDir=e,this.initializeDirectory(e)}baseDir;writeExcludedKeys=new Set;writeEndTimers=new Map;async initializeDirectory(e){await i.mkdir(e,{recursive:!0})}setWriteExcludedKeys(e){this.writeExcludedKeys=e}async ls(e){const t=await this.getFullPath(e);return this.getDirEntryFilesRecursively(t)}async getDirEntryFilesRecursively(e){try{const t=[],s=await i.readDir(e);for(const r of s)if(r.isDirectory){if(l.has(r.name))continue;const a=await i.join(e,r.name),c=await this.getDirEntryFilesRecursively(a);t.push(...c)}else{const a=await i.join(e,r.name),c=await i.PathUtils.relative(this.baseDir,a);t.push(c)}return t}catch(t){return t.includes("forbidden path")||console.error(t),[]}}async get(e){const t=await this.getFullPath(e);try{return await i.readTextFile(t)}catch(s){if(d(s))return null;try{if(!await i.exists(t))return null}catch{}throw console.error(s),s}}async has(e){const t=await this.getFullPath(e);return await i.exists(t)}async set(e,t){if(!this.writeExcludedKeys.has(e)){this.cancelWriteEndTimer(e),this.emit("write-start",e);try{const s=await this.getFullPath(e),r=i.sep(),a=s.split(r).slice(0,-1).join(r);await i.mkdir(a,{recursive:!0}),await i.writeTextFile(s,t)}finally{this.scheduleWriteEnd(e)}}}async remove(e){if(!this.writeExcludedKeys.has(e)){this.cancelWriteEndTimer(e),this.emit("write-start",e);try{const t=await this.getFullPath(e);await i.remove(t)}catch(t){!t.includes("No such file or directory")&&!t.includes("forbidden path")&&console.error(t)}finally{this.scheduleWriteEnd(e)}}}cancelWriteEndTimer(e){const t=this.writeEndTimers.get(e);t&&(clearTimeout(t),this.writeEndTimers.delete(e))}scheduleWriteEnd(e){this.cancelWriteEndTimer(e);const t=setTimeout(()=>{this.emit("write-end",e),this.writeEndTimers.delete(e)},1e3);this.writeEndTimers.set(e,t)}async rename(e,t){const s=await this.getFullPath(e),r=await this.getFullPath(t);await i.rename(s,r)}async getFullPath(e){return await i.join(this.baseDir,e??"")}}exports.TauriFileSystemAdapter=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./replay-index-LcDbGH39.js"),B=require("./replay-promise-map-limit-DRDkHc-b.js"),G=require("./replay-TauriFileSystemAdapter-Zb6LTS_-.js");var U={exports:{}},K;function oe(){return K||(K=1,(function(n){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function a(s,u,h){this.fn=s,this.context=u,this.once=h||!1}function o(s,u,h,f,y){if(typeof h!="function")throw new TypeError("The listener must be a function");var g=new a(h,f||s,y),v=t?t+u:u;return s._events[v]?s._events[v].fn?s._events[v]=[s._events[v],g]:s._events[v].push(g):(s._events[v]=g,s._eventsCount++),s}function p(s,u){--s._eventsCount===0?s._events=new r:delete s._events[u]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var u=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},c.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var y=0,g=f.length,v=new Array(g);y<g;y++)v[y]=f[y].fn;return v},c.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},c.prototype.emit=function(u,h,f,y,g,v){var b=t?t+u:u;if(!this._events[b])return!1;var l=this._events[b],T=arguments.length,F,w;if(l.fn){switch(l.once&&this.removeListener(u,l.fn,void 0,!0),T){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,h),!0;case 3:return l.fn.call(l.context,h,f),!0;case 4:return l.fn.call(l.context,h,f,y),!0;case 5:return l.fn.call(l.context,h,f,y,g),!0;case 6:return l.fn.call(l.context,h,f,y,g,v),!0}for(w=1,F=new Array(T-1);w<T;w++)F[w-1]=arguments[w];l.fn.apply(l.context,F)}else{var ae=l.length,x;for(w=0;w<ae;w++)switch(l[w].once&&this.removeListener(u,l[w].fn,void 0,!0),T){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,h);break;case 3:l[w].fn.call(l[w].context,h,f);break;case 4:l[w].fn.call(l[w].context,h,f,y);break;default:if(!F)for(x=1,F=new Array(T-1);x<T;x++)F[x-1]=arguments[x];l[w].fn.apply(l[w].context,F)}}return!0},c.prototype.on=function(u,h,f){return o(this,u,h,f,!1)},c.prototype.once=function(u,h,f){return o(this,u,h,f,!0)},c.prototype.removeListener=function(u,h,f,y){var g=t?t+u:u;if(!this._events[g])return this;if(!h)return p(this,g),this;var v=this._events[g];if(v.fn)v.fn===h&&(!y||v.once)&&(!f||v.context===f)&&p(this,g);else{for(var b=0,l=[],T=v.length;b<T;b++)(v[b].fn!==h||y&&!v[b].once||f&&v[b].context!==f)&&l.push(v[b]);l.length?this._events[g]=l.length===1?l[0]:l:p(this,g)}return this},c.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&p(this,h)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=t,c.EventEmitter=c,n.exports=c})(U)),U.exports}var ue=oe();const le=d.getDefaultExportFromCjs(ue);class re extends Error{constructor(e){super(e),this.name="TimeoutError"}}let ce=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const H=n=>globalThis.DOMException===void 0?new ce(n):new DOMException(n),J=n=>{const e=n.reason===void 0?H("This operation was aborted."):n.reason;return e instanceof Error?e:H(e)};function he(n,e,t,r){let a;const o=new Promise((p,c)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){p(n);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){const{signal:s}=r;s.aborted&&c(J(s)),s.addEventListener("abort",()=>{c(J(s))})}a=r.customTimers.setTimeout.call(void 0,()=>{const s=`Promise timed out after ${e} milliseconds`,u=t instanceof Error?t:new re(s);typeof n.cancel=="function"&&n.cancel(),c(u)},e),(async()=>{try{p(await n)}catch(s){c(s)}finally{r.customTimers.clearTimeout.call(void 0,a)}})()});return o.clear=()=>{clearTimeout(a),a=void 0},o}function fe(n,e,t){let r=0,a=n.length;for(;a>0;){const o=Math.trunc(a/2);let p=r+o;t(n[p],e)<=0?(r=++p,a-=o+1):a=o}return r}var Q=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},A;class de{constructor(){A.set(this,[])}enqueue(e,t){t={priority:0,...t};const r={priority:t.priority,run:e};if(this.size&&Q(this,A,"f")[this.size-1].priority>=t.priority){Q(this,A,"f").push(r);return}const a=fe(Q(this,A,"f"),r,(o,p)=>p.priority-o.priority);Q(this,A,"f").splice(a,0,r)}dequeue(){const e=Q(this,A,"f").shift();return e?.run}filter(e){return Q(this,A,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return Q(this,A,"f").length}}A=new WeakMap;var m=function(n,e,t,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!a:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(n,t):a?a.value=t:e.set(n,t),t},i=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},_,N,L,I,j,M,z,E,O,P,R,S,W,C,k,X,Z,ie,ee,te,D,Y,V,$,ne,q;class se extends Error{}class pe extends le{constructor(e){var t,r,a,o;if(super(),_.add(this),N.set(this,void 0),L.set(this,void 0),I.set(this,0),j.set(this,void 0),M.set(this,void 0),z.set(this,0),E.set(this,void 0),O.set(this,void 0),P.set(this,void 0),R.set(this,void 0),S.set(this,0),W.set(this,void 0),C.set(this,void 0),k.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:de,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(a=e.interval)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);m(this,N,e.carryoverConcurrencyCount,"f"),m(this,L,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),m(this,j,e.intervalCap,"f"),m(this,M,e.interval,"f"),m(this,P,new e.queueClass,"f"),m(this,R,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,m(this,k,e.throwOnTimeout===!0,"f"),m(this,C,e.autoStart===!1,"f")}get concurrency(){return i(this,W,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);m(this,W,e,"f"),i(this,_,"m",$).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:i(this,k,"f"),...t},new Promise((r,a)=>{i(this,P,"f").enqueue(async()=>{var o,p,c;m(this,S,(p=i(this,S,"f"),p++,p),"f"),m(this,I,(c=i(this,I,"f"),c++,c),"f");try{if(!((o=t.signal)===null||o===void 0)&&o.aborted)throw new se("The task was aborted.");let s=e({signal:t.signal});t.timeout&&(s=he(Promise.resolve(s),t.timeout)),t.signal&&(s=Promise.race([s,i(this,_,"m",ne).call(this,t.signal)]));const u=await s;r(u),this.emit("completed",u)}catch(s){if(s instanceof re&&!t.throwOnTimeout){r();return}a(s),this.emit("error",s)}finally{i(this,_,"m",ie).call(this)}},t),this.emit("add"),i(this,_,"m",D).call(this)})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return i(this,C,"f")?(m(this,C,!1,"f"),i(this,_,"m",$).call(this),this):this}pause(){m(this,C,!0,"f")}clear(){m(this,P,new(i(this,R,"f")),"f")}async onEmpty(){i(this,P,"f").size!==0&&await i(this,_,"m",q).call(this,"empty")}async onSizeLessThan(e){i(this,P,"f").size<e||await i(this,_,"m",q).call(this,"next",()=>i(this,P,"f").size<e)}async onIdle(){i(this,S,"f")===0&&i(this,P,"f").size===0||await i(this,_,"m",q).call(this,"idle")}get size(){return i(this,P,"f").size}sizeBy(e){return i(this,P,"f").filter(e).length}get pending(){return i(this,S,"f")}get isPaused(){return i(this,C,"f")}}N=new WeakMap,L=new WeakMap,I=new WeakMap,j=new WeakMap,M=new WeakMap,z=new WeakMap,E=new WeakMap,O=new WeakMap,P=new WeakMap,R=new WeakMap,S=new WeakMap,W=new WeakMap,C=new WeakMap,k=new WeakMap,_=new WeakSet,X=function(){return i(this,L,"f")||i(this,I,"f")<i(this,j,"f")},Z=function(){return i(this,S,"f")<i(this,W,"f")},ie=function(){var e;m(this,S,(e=i(this,S,"f"),e--,e),"f"),i(this,_,"m",D).call(this),this.emit("next")},ee=function(){i(this,_,"m",V).call(this),i(this,_,"m",Y).call(this),m(this,O,void 0,"f")},te=function(){const e=Date.now();if(i(this,E,"f")===void 0){const t=i(this,z,"f")-e;if(t<0)m(this,I,i(this,N,"f")?i(this,S,"f"):0,"f");else return i(this,O,"f")===void 0&&m(this,O,setTimeout(()=>{i(this,_,"m",ee).call(this)},t),"f"),!0}return!1},D=function(){if(i(this,P,"f").size===0)return i(this,E,"f")&&clearInterval(i(this,E,"f")),m(this,E,void 0,"f"),this.emit("empty"),i(this,S,"f")===0&&this.emit("idle"),!1;if(!i(this,C,"f")){const e=!i(this,_,"a",te);if(i(this,_,"a",X)&&i(this,_,"a",Z)){const t=i(this,P,"f").dequeue();return t?(this.emit("active"),t(),e&&i(this,_,"m",Y).call(this),!0):!1}}return!1},Y=function(){i(this,L,"f")||i(this,E,"f")!==void 0||(m(this,E,setInterval(()=>{i(this,_,"m",V).call(this)},i(this,M,"f")),"f"),m(this,z,Date.now()+i(this,M,"f"),"f"))},V=function(){i(this,I,"f")===0&&i(this,S,"f")===0&&i(this,E,"f")&&(clearInterval(i(this,E,"f")),m(this,E,void 0,"f")),m(this,I,i(this,N,"f")?i(this,S,"f"):0,"f"),i(this,_,"m",$).call(this)},$=function(){for(;i(this,_,"m",D).call(this););},ne=async function(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(new se("The task was aborted."))},{once:!0})})},q=async function(e,t){return new Promise(r=>{const a=()=>{t&&!t()||(this.off(e,a),r())};this.on(e,a)})};class ve{constructor(e){this.apisStorage=e}apisStorage;data=new Map;loading=new Set;pQueue=new pe({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,t=!1){this.data.has(e)&&!t||await this.loadAndParse(e,t)}async loadAndParse(e,t=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}t&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const r=d.isWebUrl(e)?d.SourceType.WEB:d.SourceType.FS,a=r===d.SourceType.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:p}=await d.loadAndBundleDefinition(a);if(!o){this.data.set(e,null),await d.clearNotificationsForSource(e);return}const c=this.apisStorage.parse({uri:e,type:r,content:o});this.data.set(e,{...c,fileDependencies:p}),await d.clearNotificationsForSource(e)}catch(o){if(this.data.set(e,null),o instanceof Error&&(o.message.includes("Unsupported specification")||o.message.includes("File not found"))){await d.clearNotificationsForSource(e);return}console.info("Error loading api "+e,o),await d.reportParseError(e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}class me extends d.RootStorage{apiLoader;constructor(e,t,r){const a=new G.TauriFileSystemAdapter(e.systemFilesDir),o=new G.TauriFileSystemAdapter(e.userFilesDir);super(a,o,e,!0,{filePaths:d.REDOCLY_CONFIG_FILE_NAMES,basePath:d.REPLAY_ENVIRONMENTS_SECTION_PATH,rebuildWhenUnparseable:!1},t,r),this.apiLoader=new ve(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",t=>{this.addWatchExcludedId(t)}),e.on("write-end",t=>{this.removeWatchExcludedId(t)})}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[d.createResource("storageOperation","read","storage")],void 0),t=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[d.createResource("storageOperation","loadUserState","storage")],e?.parentCtx),[r,a,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]),p=o.length>0?o:d.cloneObject(d.DEFAULT_ENVIRONMENTS);t?.setAttribute("status","completed"),t?.setAttribute("environmentCount",o.length),t?.setStatus(d.SpanStatusCode.OK),t?.end();const{apiFiles:c,collectionFiles:s}=await this.detectProjectFiles(e);await this.loadAndParseApis(c,e);const h=(await this.loadAndParseCollections(s,e)).filter(y=>y!==null),f=this.apiLoader.getAll();return e?.setAttribute("status","completed"),e?.setStatus(d.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:a,environments:p,apis:f,collections:h}}async detectProjectFiles(e){const t=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[d.createResource("storageOperation","detectFiles","storage")],e?.parentCtx),{api_files:r,collection_files:a}=await d.invoke("fs_scan",{dir:this.project.userFilesDir});return t?.setAttribute("status","completed"),t?.setAttribute("filesCount",r.length+a.length),t?.setAttribute("apiFilesCount",r.length),t?.setAttribute("collectionFilesCount",a.length),t?.setStatus(d.SpanStatusCode.OK),t?.end(),{apiFiles:r,collectionFiles:a}}readEnvironments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,t,r=!1){const a=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...d.createResource("storageOperation","parseApis","storage"),apisCount:e.length}],t?.parentCtx),o=await B.promiseMapLimit(e,20,async p=>{try{return await this.apiLoader.load(p.relative_path,r),this.apiLoader.get(p.relative_path)}catch(c){return console.info(`Error parsing YAML/JSON file ${p.absolute_path}:`,c),await d.reportParseError(p.relative_path,c),null}});return a?.setAttribute("status","completed"),a?.setAttribute("parsedApisCount",this.apiLoader.size),a?.setStatus(d.SpanStatusCode.OK),a?.end(),o}async loadAndParseCollections(e,t){const r=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...d.createResource("storageOperation","parseCollections","storage"),collectionsCount:e.length}],t?.parentCtx),a=await B.promiseMapLimit(e,20,async o=>{try{const p=await this.userFilesStorage.get(o.relative_path);if(!p)return null;const c=d.yaml.load(p);if(typeof c!="object"||c===null||typeof c.arazzo!="string")return await d.clearNotificationsForSource(o.relative_path),null;const s=[];await Promise.all(c.sourceDescriptions?.map(async f=>{const y=f.type,g=f.url,v=!y||y==="openapi",b=await d.apiUrlToApiId({projectPath:this.project.userFilesDir,apiUrl:g,collectionId:o.relative_path});if(v){const l=await this.apiLoader.get(b);l&&s.push(l)}}));const u=await d.PathUtils.join(this.project.userFilesDir,o.relative_path),h=await this.collectionsStorage.parse({uri:o.relative_path,type:d.SourceType.FS,content:c,fileDependencies:new Set([u])},s);return await d.clearNotificationsForSource(o.relative_path),h}catch(p){return console.info(`Error parsing Arazzo file ${o.relative_path}:`,p),await d.reportParseError(o.relative_path,p),null}});return r?.setAttribute("status","completed"),r?.setAttribute("parsedCollectionsCount",a.length),r?.setStatus(d.SpanStatusCode.OK),r?.end(),a}}exports.TauriRootStorage=me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./replay-index-BDRC1QoR.js"),B=require("./replay-promise-map-limit-DRDkHc-b.js"),G=require("./replay-TauriFileSystemAdapter-DDo2h7gX.js");var U={exports:{}},K;function oe(){return K||(K=1,(function(n){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function a(s,u,h){this.fn=s,this.context=u,this.once=h||!1}function o(s,u,h,f,y){if(typeof h!="function")throw new TypeError("The listener must be a function");var g=new a(h,f||s,y),v=t?t+u:u;return s._events[v]?s._events[v].fn?s._events[v]=[s._events[v],g]:s._events[v].push(g):(s._events[v]=g,s._eventsCount++),s}function p(s,u){--s._eventsCount===0?s._events=new r:delete s._events[u]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var u=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},c.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var y=0,g=f.length,v=new Array(g);y<g;y++)v[y]=f[y].fn;return v},c.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},c.prototype.emit=function(u,h,f,y,g,v){var b=t?t+u:u;if(!this._events[b])return!1;var l=this._events[b],T=arguments.length,F,w;if(l.fn){switch(l.once&&this.removeListener(u,l.fn,void 0,!0),T){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,h),!0;case 3:return l.fn.call(l.context,h,f),!0;case 4:return l.fn.call(l.context,h,f,y),!0;case 5:return l.fn.call(l.context,h,f,y,g),!0;case 6:return l.fn.call(l.context,h,f,y,g,v),!0}for(w=1,F=new Array(T-1);w<T;w++)F[w-1]=arguments[w];l.fn.apply(l.context,F)}else{var ae=l.length,x;for(w=0;w<ae;w++)switch(l[w].once&&this.removeListener(u,l[w].fn,void 0,!0),T){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,h);break;case 3:l[w].fn.call(l[w].context,h,f);break;case 4:l[w].fn.call(l[w].context,h,f,y);break;default:if(!F)for(x=1,F=new Array(T-1);x<T;x++)F[x-1]=arguments[x];l[w].fn.apply(l[w].context,F)}}return!0},c.prototype.on=function(u,h,f){return o(this,u,h,f,!1)},c.prototype.once=function(u,h,f){return o(this,u,h,f,!0)},c.prototype.removeListener=function(u,h,f,y){var g=t?t+u:u;if(!this._events[g])return this;if(!h)return p(this,g),this;var v=this._events[g];if(v.fn)v.fn===h&&(!y||v.once)&&(!f||v.context===f)&&p(this,g);else{for(var b=0,l=[],T=v.length;b<T;b++)(v[b].fn!==h||y&&!v[b].once||f&&v[b].context!==f)&&l.push(v[b]);l.length?this._events[g]=l.length===1?l[0]:l:p(this,g)}return this},c.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&p(this,h)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=t,c.EventEmitter=c,n.exports=c})(U)),U.exports}var ue=oe();const le=d.getDefaultExportFromCjs(ue);class re extends Error{constructor(e){super(e),this.name="TimeoutError"}}let ce=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}};const H=n=>globalThis.DOMException===void 0?new ce(n):new DOMException(n),J=n=>{const e=n.reason===void 0?H("This operation was aborted."):n.reason;return e instanceof Error?e:H(e)};function he(n,e,t,r){let a;const o=new Promise((p,c)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){p(n);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){const{signal:s}=r;s.aborted&&c(J(s)),s.addEventListener("abort",()=>{c(J(s))})}a=r.customTimers.setTimeout.call(void 0,()=>{const s=`Promise timed out after ${e} milliseconds`,u=t instanceof Error?t:new re(s);typeof n.cancel=="function"&&n.cancel(),c(u)},e),(async()=>{try{p(await n)}catch(s){c(s)}finally{r.customTimers.clearTimeout.call(void 0,a)}})()});return o.clear=()=>{clearTimeout(a),a=void 0},o}function fe(n,e,t){let r=0,a=n.length;for(;a>0;){const o=Math.trunc(a/2);let p=r+o;t(n[p],e)<=0?(r=++p,a-=o+1):a=o}return r}var Q=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},A;class de{constructor(){A.set(this,[])}enqueue(e,t){t={priority:0,...t};const r={priority:t.priority,run:e};if(this.size&&Q(this,A,"f")[this.size-1].priority>=t.priority){Q(this,A,"f").push(r);return}const a=fe(Q(this,A,"f"),r,(o,p)=>p.priority-o.priority);Q(this,A,"f").splice(a,0,r)}dequeue(){const e=Q(this,A,"f").shift();return e?.run}filter(e){return Q(this,A,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return Q(this,A,"f").length}}A=new WeakMap;var m=function(n,e,t,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!a:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(n,t):a?a.value=t:e.set(n,t),t},i=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},_,N,L,I,j,M,z,E,O,P,R,S,W,C,k,X,Z,ie,ee,te,D,Y,V,$,ne,q;class se extends Error{}class pe extends le{constructor(e){var t,r,a,o;if(super(),_.add(this),N.set(this,void 0),L.set(this,void 0),I.set(this,0),j.set(this,void 0),M.set(this,void 0),z.set(this,0),E.set(this,void 0),O.set(this,void 0),P.set(this,void 0),R.set(this,void 0),S.set(this,0),W.set(this,void 0),C.set(this,void 0),k.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:de,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(t=e.intervalCap)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(a=e.interval)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);m(this,N,e.carryoverConcurrencyCount,"f"),m(this,L,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),m(this,j,e.intervalCap,"f"),m(this,M,e.interval,"f"),m(this,P,new e.queueClass,"f"),m(this,R,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,m(this,k,e.throwOnTimeout===!0,"f"),m(this,C,e.autoStart===!1,"f")}get concurrency(){return i(this,W,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);m(this,W,e,"f"),i(this,_,"m",$).call(this)}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:i(this,k,"f"),...t},new Promise((r,a)=>{i(this,P,"f").enqueue(async()=>{var o,p,c;m(this,S,(p=i(this,S,"f"),p++,p),"f"),m(this,I,(c=i(this,I,"f"),c++,c),"f");try{if(!((o=t.signal)===null||o===void 0)&&o.aborted)throw new se("The task was aborted.");let s=e({signal:t.signal});t.timeout&&(s=he(Promise.resolve(s),t.timeout)),t.signal&&(s=Promise.race([s,i(this,_,"m",ne).call(this,t.signal)]));const u=await s;r(u),this.emit("completed",u)}catch(s){if(s instanceof re&&!t.throwOnTimeout){r();return}a(s),this.emit("error",s)}finally{i(this,_,"m",ie).call(this)}},t),this.emit("add"),i(this,_,"m",D).call(this)})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return i(this,C,"f")?(m(this,C,!1,"f"),i(this,_,"m",$).call(this),this):this}pause(){m(this,C,!0,"f")}clear(){m(this,P,new(i(this,R,"f")),"f")}async onEmpty(){i(this,P,"f").size!==0&&await i(this,_,"m",q).call(this,"empty")}async onSizeLessThan(e){i(this,P,"f").size<e||await i(this,_,"m",q).call(this,"next",()=>i(this,P,"f").size<e)}async onIdle(){i(this,S,"f")===0&&i(this,P,"f").size===0||await i(this,_,"m",q).call(this,"idle")}get size(){return i(this,P,"f").size}sizeBy(e){return i(this,P,"f").filter(e).length}get pending(){return i(this,S,"f")}get isPaused(){return i(this,C,"f")}}N=new WeakMap,L=new WeakMap,I=new WeakMap,j=new WeakMap,M=new WeakMap,z=new WeakMap,E=new WeakMap,O=new WeakMap,P=new WeakMap,R=new WeakMap,S=new WeakMap,W=new WeakMap,C=new WeakMap,k=new WeakMap,_=new WeakSet,X=function(){return i(this,L,"f")||i(this,I,"f")<i(this,j,"f")},Z=function(){return i(this,S,"f")<i(this,W,"f")},ie=function(){var e;m(this,S,(e=i(this,S,"f"),e--,e),"f"),i(this,_,"m",D).call(this),this.emit("next")},ee=function(){i(this,_,"m",V).call(this),i(this,_,"m",Y).call(this),m(this,O,void 0,"f")},te=function(){const e=Date.now();if(i(this,E,"f")===void 0){const t=i(this,z,"f")-e;if(t<0)m(this,I,i(this,N,"f")?i(this,S,"f"):0,"f");else return i(this,O,"f")===void 0&&m(this,O,setTimeout(()=>{i(this,_,"m",ee).call(this)},t),"f"),!0}return!1},D=function(){if(i(this,P,"f").size===0)return i(this,E,"f")&&clearInterval(i(this,E,"f")),m(this,E,void 0,"f"),this.emit("empty"),i(this,S,"f")===0&&this.emit("idle"),!1;if(!i(this,C,"f")){const e=!i(this,_,"a",te);if(i(this,_,"a",X)&&i(this,_,"a",Z)){const t=i(this,P,"f").dequeue();return t?(this.emit("active"),t(),e&&i(this,_,"m",Y).call(this),!0):!1}}return!1},Y=function(){i(this,L,"f")||i(this,E,"f")!==void 0||(m(this,E,setInterval(()=>{i(this,_,"m",V).call(this)},i(this,M,"f")),"f"),m(this,z,Date.now()+i(this,M,"f"),"f"))},V=function(){i(this,I,"f")===0&&i(this,S,"f")===0&&i(this,E,"f")&&(clearInterval(i(this,E,"f")),m(this,E,void 0,"f")),m(this,I,i(this,N,"f")?i(this,S,"f"):0,"f"),i(this,_,"m",$).call(this)},$=function(){for(;i(this,_,"m",D).call(this););},ne=async function(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(new se("The task was aborted."))},{once:!0})})},q=async function(e,t){return new Promise(r=>{const a=()=>{t&&!t()||(this.off(e,a),r())};this.on(e,a)})};class ve{constructor(e){this.apisStorage=e}apisStorage;data=new Map;loading=new Set;pQueue=new pe({concurrency:20});async get(e){return this.data.has(e)?this.data.get(e)??null:(await this.loadAndParse(e),this.data.get(e)??null)}async load(e,t=!1){this.data.has(e)&&!t||await this.loadAndParse(e,t)}async loadAndParse(e,t=!1){if(this.loading.has(e)){await this.pQueue.add(()=>this.get(e));return}t&&this.data.delete(e),this.loading.add(e),await this.pQueue.add(async()=>{const r=d.isWebUrl(e)?d.SourceType.WEB:d.SourceType.FS,a=r===d.SourceType.WEB?e:await this.apisStorage.getAbsolutePath(e);try{const{definition:o,fileDependencies:p}=await d.loadAndBundleDefinition(a);if(!o){this.data.set(e,null),await d.clearNotificationsForSource(e);return}const c=this.apisStorage.parse({uri:e,type:r,content:o});this.data.set(e,{...c,fileDependencies:p}),await d.clearNotificationsForSource(e)}catch(o){if(this.data.set(e,null),o instanceof Error&&(o.message.includes("Unsupported specification")||o.message.includes("File not found"))){await d.clearNotificationsForSource(e);return}console.info("Error loading api "+e,o),await d.reportParseError(e,o);return}}),this.loading.delete(e)}get size(){return this.data.size}delete(e){this.data.delete(e)}getAll(){return Array.from(this.data.values()).filter(e=>e!==null)}clear(){this.data.clear(),this.loading.clear()}}class me extends d.RootStorage{apiLoader;constructor(e,t,r){const a=new G.TauriFileSystemAdapter(e.systemFilesDir),o=new G.TauriFileSystemAdapter(e.userFilesDir);super(a,o,e,!0,{filePaths:d.REDOCLY_CONFIG_FILE_NAMES,basePath:d.REPLAY_ENVIRONMENTS_SECTION_PATH,rebuildWhenUnparseable:!1},t,r),this.apiLoader=new ve(this.apisStorage),this.setupWriteListeners(o)}setupWriteListeners(e){e.on("write-start",t=>{this.addWatchExcludedId(t)}),e.on("write-end",t=>{this.removeWatchExcludedId(t)})}async read(){const e=this.telemetry?.startSpan("com.redocly.storage.read",[d.createResource("storageOperation","read","storage")],void 0),t=this.telemetry?.startSpan("com.redocly.storage.loadUserState",[d.createResource("storageOperation","loadUserState","storage")],e?.parentCtx),[r,a,o]=await Promise.all([this.activeEnvironmentIdStorage.read(),this.tabsStateStorage.read(),this.environmentsStorage.read()]),p=o.length>0?o:d.cloneObject(d.DEFAULT_ENVIRONMENTS);t?.setAttribute("status","completed"),t?.setAttribute("environmentCount",o.length),t?.setStatus(d.SpanStatusCode.OK),t?.end();const{apiFiles:c,collectionFiles:s}=await this.detectProjectFiles(e);await this.loadAndParseApis(c,e);const h=(await this.loadAndParseCollections(s,e)).filter(y=>y!==null),f=this.apiLoader.getAll();return e?.setAttribute("status","completed"),e?.setStatus(d.SpanStatusCode.OK),e?.end(),{project:this.project,activeEnvironmentId:r,tabsState:a,environments:p,apis:f,collections:h}}async detectProjectFiles(e){const t=this.telemetry?.startSpan("com.redocly.storage.detectFiles",[d.createResource("storageOperation","detectFiles","storage")],e?.parentCtx),{api_files:r,collection_files:a}=await d.invoke("fs_scan",{dir:this.project.userFilesDir});return t?.setAttribute("status","completed"),t?.setAttribute("filesCount",r.length+a.length),t?.setAttribute("apiFilesCount",r.length),t?.setAttribute("collectionFilesCount",a.length),t?.setStatus(d.SpanStatusCode.OK),t?.end(),{apiFiles:r,collectionFiles:a}}readEnvironments(){return this.environmentsStorage.read()}deleteApiFromCache(e){this.apiLoader.delete(e)}async loadAndParseApis(e,t,r=!1){const a=this.telemetry?.startSpan("com.redocly.storage.parseApis",[{...d.createResource("storageOperation","parseApis","storage"),apisCount:e.length}],t?.parentCtx),o=await B.promiseMapLimit(e,20,async p=>{try{return await this.apiLoader.load(p.relative_path,r),this.apiLoader.get(p.relative_path)}catch(c){return console.info(`Error parsing YAML/JSON file ${p.absolute_path}:`,c),await d.reportParseError(p.relative_path,c),null}});return a?.setAttribute("status","completed"),a?.setAttribute("parsedApisCount",this.apiLoader.size),a?.setStatus(d.SpanStatusCode.OK),a?.end(),o}async loadAndParseCollections(e,t){const r=this.telemetry?.startSpan("com.redocly.storage.parseCollections",[{...d.createResource("storageOperation","parseCollections","storage"),collectionsCount:e.length}],t?.parentCtx),a=await B.promiseMapLimit(e,20,async o=>{try{const p=await this.userFilesStorage.get(o.relative_path);if(!p)return null;const c=d.yaml.load(p);if(typeof c!="object"||c===null||typeof c.arazzo!="string")return await d.clearNotificationsForSource(o.relative_path),null;const s=[];await Promise.all(c.sourceDescriptions?.map(async f=>{const y=f.type,g=f.url,v=!y||y==="openapi",b=await d.apiUrlToApiId({projectPath:this.project.userFilesDir,apiUrl:g,collectionId:o.relative_path});if(v){const l=await this.apiLoader.get(b);l&&s.push(l)}}));const u=await d.PathUtils.join(this.project.userFilesDir,o.relative_path),h=await this.collectionsStorage.parse({uri:o.relative_path,type:d.SourceType.FS,content:c,fileDependencies:new Set([u])},s);return await d.clearNotificationsForSource(o.relative_path),h}catch(p){return console.info(`Error parsing Arazzo file ${o.relative_path}:`,p),await d.reportParseError(o.relative_path,p),null}});return r?.setAttribute("status","completed"),r?.setAttribute("parsedCollectionsCount",a.length),r?.setStatus(d.SpanStatusCode.OK),r?.end(),a}}exports.TauriRootStorage=me;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as he, W as fe, X as k, Y as de, Z as N, _ as H, $ as pe, a0 as ve, a1 as _e, L as F, u as me, K as O, i as we, a2 as ye, a3 as ge, P as Pe, D as be } from "./replay-index-KN9FLfwz.js";
|
|
2
2
|
import { p as J } from "./replay-promise-map-limit-Db_42GvV.js";
|
|
3
|
-
import { TauriFileSystemAdapter as X } from "./replay-TauriFileSystemAdapter-
|
|
3
|
+
import { TauriFileSystemAdapter as X } from "./replay-TauriFileSystemAdapter-CB9S1PNT.js";
|
|
4
4
|
var K = { exports: {} }, Z;
|
|
5
5
|
function Ee() {
|
|
6
6
|
return Z || (Z = 1, (function(n) {
|
|
@@ -214,14 +214,14 @@ var v = function(n, e, t, r, a) {
|
|
|
214
214
|
if (t === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
215
215
|
if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
216
216
|
return t === "m" ? r : t === "a" ? r.call(n) : r ? r.value : e.get(n);
|
|
217
|
-
}, _, M, W, C, Y, z, j, E, L, g,
|
|
217
|
+
}, _, M, W, C, Y, z, j, E, L, g, $, P, D, I, q, re, se, oe, ne, ie, R, B, G, V, le, U;
|
|
218
218
|
class ue extends Error {
|
|
219
219
|
}
|
|
220
220
|
class xe extends Ae {
|
|
221
221
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
222
222
|
constructor(e) {
|
|
223
223
|
var t, r, a, o;
|
|
224
|
-
if (super(), _.add(this), M.set(this, void 0), W.set(this, void 0), C.set(this, 0), Y.set(this, void 0), z.set(this, void 0), j.set(this, 0), E.set(this, void 0), L.set(this, void 0), g.set(this, void 0),
|
|
224
|
+
if (super(), _.add(this), M.set(this, void 0), W.set(this, void 0), C.set(this, 0), Y.set(this, void 0), z.set(this, void 0), j.set(this, 0), E.set(this, void 0), L.set(this, void 0), g.set(this, void 0), $.set(this, void 0), P.set(this, 0), D.set(this, void 0), I.set(this, void 0), q.set(this, void 0), Object.defineProperty(this, "timeout", {
|
|
225
225
|
enumerable: !0,
|
|
226
226
|
configurable: !0,
|
|
227
227
|
writable: !0,
|
|
@@ -238,7 +238,7 @@ class xe extends Ae {
|
|
|
238
238
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r = (t = e.intervalCap) === null || t === void 0 ? void 0 : t.toString()) !== null && r !== void 0 ? r : ""}\` (${typeof e.intervalCap})`);
|
|
239
239
|
if (e.interval === void 0 || !(Number.isFinite(e.interval) && e.interval >= 0))
|
|
240
240
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o = (a = e.interval) === null || a === void 0 ? void 0 : a.toString()) !== null && o !== void 0 ? o : ""}\` (${typeof e.interval})`);
|
|
241
|
-
v(this, M, e.carryoverConcurrencyCount, "f"), v(this, W, e.intervalCap === Number.POSITIVE_INFINITY || e.interval === 0, "f"), v(this, Y, e.intervalCap, "f"), v(this, z, e.interval, "f"), v(this, g, new e.queueClass(), "f"), v(this,
|
|
241
|
+
v(this, M, e.carryoverConcurrencyCount, "f"), v(this, W, e.intervalCap === Number.POSITIVE_INFINITY || e.interval === 0, "f"), v(this, Y, e.intervalCap, "f"), v(this, z, e.interval, "f"), v(this, g, new e.queueClass(), "f"), v(this, $, e.queueClass, "f"), this.concurrency = e.concurrency, this.timeout = e.timeout, v(this, q, e.throwOnTimeout === !0, "f"), v(this, I, e.autoStart === !1, "f");
|
|
242
242
|
}
|
|
243
243
|
get concurrency() {
|
|
244
244
|
return s(this, D, "f");
|
|
@@ -251,7 +251,7 @@ class xe extends Ae {
|
|
|
251
251
|
async add(e, t = {}) {
|
|
252
252
|
return t = {
|
|
253
253
|
timeout: this.timeout,
|
|
254
|
-
throwOnTimeout: s(this,
|
|
254
|
+
throwOnTimeout: s(this, q, "f"),
|
|
255
255
|
...t
|
|
256
256
|
}, new Promise((r, a) => {
|
|
257
257
|
s(this, g, "f").enqueue(async () => {
|
|
@@ -273,7 +273,7 @@ class xe extends Ae {
|
|
|
273
273
|
} finally {
|
|
274
274
|
s(this, _, "m", oe).call(this);
|
|
275
275
|
}
|
|
276
|
-
}, t), this.emit("add"), s(this, _, "m",
|
|
276
|
+
}, t), this.emit("add"), s(this, _, "m", R).call(this);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
async addAll(e, t) {
|
|
@@ -295,7 +295,7 @@ class xe extends Ae {
|
|
|
295
295
|
Clear the queue.
|
|
296
296
|
*/
|
|
297
297
|
clear() {
|
|
298
|
-
v(this, g, new (s(this,
|
|
298
|
+
v(this, g, new (s(this, $, "f"))(), "f");
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
301
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -350,13 +350,13 @@ class xe extends Ae {
|
|
|
350
350
|
return s(this, I, "f");
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
M = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(),
|
|
353
|
+
M = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakSet(), re = function() {
|
|
354
354
|
return s(this, W, "f") || s(this, C, "f") < s(this, Y, "f");
|
|
355
355
|
}, se = function() {
|
|
356
356
|
return s(this, P, "f") < s(this, D, "f");
|
|
357
357
|
}, oe = function() {
|
|
358
358
|
var e;
|
|
359
|
-
v(this, P, (e = s(this, P, "f"), e--, e), "f"), s(this, _, "m",
|
|
359
|
+
v(this, P, (e = s(this, P, "f"), e--, e), "f"), s(this, _, "m", R).call(this), this.emit("next");
|
|
360
360
|
}, ne = function() {
|
|
361
361
|
s(this, _, "m", G).call(this), s(this, _, "m", B).call(this), v(this, L, void 0, "f");
|
|
362
362
|
}, ie = function() {
|
|
@@ -371,7 +371,7 @@ M = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), C = /* @__
|
|
|
371
371
|
}, t), "f"), !0;
|
|
372
372
|
}
|
|
373
373
|
return !1;
|
|
374
|
-
},
|
|
374
|
+
}, R = function() {
|
|
375
375
|
if (s(this, g, "f").size === 0)
|
|
376
376
|
return s(this, E, "f") && clearInterval(s(this, E, "f")), v(this, E, void 0, "f"), this.emit("empty"), s(this, P, "f") === 0 && this.emit("idle"), !1;
|
|
377
377
|
if (!s(this, I, "f")) {
|
|
@@ -389,7 +389,7 @@ M = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), C = /* @__
|
|
|
389
389
|
}, G = function() {
|
|
390
390
|
s(this, C, "f") === 0 && s(this, P, "f") === 0 && s(this, E, "f") && (clearInterval(s(this, E, "f")), v(this, E, void 0, "f")), v(this, C, s(this, M, "f") ? s(this, P, "f") : 0, "f"), s(this, _, "m", V).call(this);
|
|
391
391
|
}, V = function() {
|
|
392
|
-
for (; s(this, _, "m",
|
|
392
|
+
for (; s(this, _, "m", R).call(this); )
|
|
393
393
|
;
|
|
394
394
|
}, le = async function(e) {
|
|
395
395
|
return new Promise((t, r) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as O, p as w, T as L, i as J, c as D, s as $ } from "./replay-create-model-
|
|
2
|
-
import {
|
|
3
|
-
import { g as U } from "./replay-db-
|
|
1
|
+
import { a as O, p as w, T as L, i as J, c as D, s as $ } from "./replay-create-model-kF4veQPK.js";
|
|
2
|
+
import { H as g, I as _, J as S, K as M, T as W, L as I, N as z, O as K } from "./replay-index-KN9FLfwz.js";
|
|
3
|
+
import { g as U } from "./replay-db-B3tQE-B9.js";
|
|
4
4
|
import { L as G, C as B } from "./replay-defaults-CzR6jw9a.js";
|
|
5
5
|
function y(t) {
|
|
6
6
|
const e = t.toLowerCase(), n = [
|
|
@@ -1342,7 +1342,7 @@ function ot(t) {
|
|
|
1342
1342
|
messages: t,
|
|
1343
1343
|
emptyMessages: "remove",
|
|
1344
1344
|
reasoning: "none",
|
|
1345
|
-
toolCalls: `before-last-${
|
|
1345
|
+
toolCalls: `before-last-${W}-messages`
|
|
1346
1346
|
});
|
|
1347
1347
|
}
|
|
1348
1348
|
function at(t) {
|
|
@@ -1444,7 +1444,7 @@ class ct {
|
|
|
1444
1444
|
getActiveStateMessage;
|
|
1445
1445
|
constructor(e) {
|
|
1446
1446
|
const { activeConversationId: n, onFinish: o, onStepFinish: s, tools: a } = e;
|
|
1447
|
-
this.maxSteps = e.maxSteps ??
|
|
1447
|
+
this.maxSteps = e.maxSteps ?? z, this.getActiveStateMessage = e.getActiveStateMessage, this.model = this.createModel(e.model);
|
|
1448
1448
|
const r = ({ stepNumber: d, messages: m }) => {
|
|
1449
1449
|
const l = [], f = this.buildActiveStateMessage();
|
|
1450
1450
|
return f && l.push({ role: "user", content: f }), d === this.maxSteps - 1 && l.push({ role: "user", content: G }), l.length === 0 ? void 0 : { messages: [...m, ...l] };
|