@seedprotocol/sdk 0.4.5 → 0.4.6
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/{ArweaveClient-CgWK-JgT.js → ArweaveClient-Caio37h1.js} +3 -3
- package/dist/ArweaveClient-Caio37h1.js.map +1 -0
- package/dist/{ArweaveClient-WcG8CZAE.js → ArweaveClient-DLKAaS3K.js} +3 -3
- package/dist/ArweaveClient-DLKAaS3K.js.map +1 -0
- package/dist/{Db-DjFdIdR9.js → Db-C9fppVRl.js} +3 -3
- package/dist/Db-C9fppVRl.js.map +1 -0
- package/dist/{Db-DjofXdeU.js → Db-DJAG-5Di.js} +7 -5
- package/dist/Db-DJAG-5Di.js.map +1 -0
- package/dist/{EasClient-Aojewp6P.js → EasClient-DQGAIj-b.js} +2 -2
- package/dist/EasClient-DQGAIj-b.js.map +1 -0
- package/dist/{EasClient-BVFXp2O6.js → EasClient-T7Nx9185.js} +2 -2
- package/dist/EasClient-T7Nx9185.js.map +1 -0
- package/dist/{FileManager-C9zr4AJe.js → FileManager-BohtoKYo.js} +4 -3
- package/dist/FileManager-BohtoKYo.js.map +1 -0
- package/dist/{FileManager-CxGJLw5C.js → FileManager-d64CkqXy.js} +2 -2
- package/dist/FileManager-d64CkqXy.js.map +1 -0
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/service/actors/fetchDataFromEas.d.ts.map +1 -1
- package/dist/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/Item/service/actors/runPublish.d.ts.map +1 -1
- package/dist/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
- package/dist/Model/Model.d.ts.map +1 -1
- package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
- package/dist/{ModelProperty-CGdkocQ8.js → ModelProperty-Cpd9xiIM.js} +52 -18
- package/dist/ModelProperty-Cpd9xiIM.js.map +1 -0
- package/dist/{PathResolver-CX6GHoTS.js → PathResolver-CLZUWoX2.js} +2 -2
- package/dist/PathResolver-CLZUWoX2.js.map +1 -0
- package/dist/{PathResolver-z_WX47_o.js → PathResolver-D6M0rzKV.js} +2 -2
- package/dist/PathResolver-D6M0rzKV.js.map +1 -0
- package/dist/{QueryClient-ByKPdRmE.js → QueryClient-BUoz2Vb0.js} +2 -2
- package/dist/QueryClient-BUoz2Vb0.js.map +1 -0
- package/dist/{QueryClient-Cb1iJO-x.js → QueryClient-COQ_Rs4-.js} +2 -2
- package/dist/QueryClient-COQ_Rs4-.js.map +1 -0
- package/dist/Schema/Schema.d.ts.map +1 -1
- package/dist/Schema/service/actors/createModelInstances.d.ts.map +1 -1
- package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/Schema/service/actors/verifyModelInstancesInCache.d.ts.map +1 -1
- package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -1
- package/dist/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/{Schema-D1eqDHyt.js → Schema-BZKBy5Tx.js} +63 -24
- package/dist/Schema-BZKBy5Tx.js.map +1 -0
- package/dist/{SchemaValidationService-DyttFaV_.js → SchemaValidationService-F8No7BHp.js} +2 -2
- package/dist/SchemaValidationService-F8No7BHp.js.map +1 -0
- package/dist/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/browser/react/itemProperty.d.ts.map +1 -1
- package/dist/cjs/{ModelProperty-BeJvgKMw.js → ModelProperty-B4pV91tc.js} +32 -18
- package/dist/cjs/ModelProperty-B4pV91tc.js.map +1 -0
- package/dist/cjs/{Schema-CVs9J6eP.js → Schema-TErl3J36.js} +33 -24
- package/dist/cjs/Schema-TErl3J36.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-CDKcVRFQ.js → SchemaValidationService-p5BbJV9T.js} +2 -2
- package/dist/cjs/{SchemaValidationService-CDKcVRFQ.js.map → SchemaValidationService-p5BbJV9T.js.map} +1 -1
- package/dist/cjs/{getItem-B5RYPvrG.js → getItem-BrnLfC12.js} +2 -2
- package/dist/cjs/{getItem-B5RYPvrG.js.map → getItem-BrnLfC12.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-BD1qRob1.js → getPublishPayload-BcjCN_bD.js} +7 -5
- package/dist/cjs/getPublishPayload-BcjCN_bD.js.map +1 -0
- package/dist/cjs/{getPublishUploads-CnC9aYxs.js → getPublishUploads-5_oXzwol.js} +3 -3
- package/dist/cjs/{getPublishUploads-CnC9aYxs.js.map → getPublishUploads-5_oXzwol.js.map} +1 -1
- package/dist/cjs/{getSegmentedItemProperties-B_njnntx.js → getSegmentedItemProperties-WFdizUDv.js} +2 -2
- package/dist/cjs/{getSegmentedItemProperties-B_njnntx.js.map → getSegmentedItemProperties-WFdizUDv.js.map} +1 -1
- package/dist/cjs/{index-Dnywap_P.js → index-BrmvhXsG.js} +2 -2
- package/dist/cjs/index-BrmvhXsG.js.map +1 -0
- package/dist/cjs/{index-BeKPbbk0.js → index-CXI4VF1H.js} +330 -88
- package/dist/cjs/index-CXI4VF1H.js.map +1 -0
- package/dist/db/read/getModelSchemas.d.ts.map +1 -1
- package/dist/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/db/write/createNewItem.d.ts.map +1 -1
- package/dist/eas.d.ts.map +1 -1
- package/dist/events/files/download.d.ts.map +1 -1
- package/dist/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/{getItem-BB5HBCbK.js → getItem-DaQVdeae.js} +2 -2
- package/dist/getItem-DaQVdeae.js.map +1 -0
- package/dist/{getPublishPayload-uLm0AqN_.js → getPublishPayload-CWiLI1yd.js} +7 -5
- package/dist/getPublishPayload-CWiLI1yd.js.map +1 -0
- package/dist/{getPublishUploads-Dc-HqhO8.js → getPublishUploads-DhvcKD_9.js} +3 -3
- package/dist/getPublishUploads-DhvcKD_9.js.map +1 -0
- package/dist/{getSegmentedItemProperties-BrIqFNfD.js → getSegmentedItemProperties-Cp4kcWIF.js} +2 -2
- package/dist/getSegmentedItemProperties-Cp4kcWIF.js.map +1 -0
- package/dist/helpers/db.d.ts.map +1 -1
- package/dist/helpers/property.d.ts.map +1 -1
- package/dist/helpers/updateSchema.d.ts.map +1 -1
- package/dist/imports/json.d.ts.map +1 -1
- package/dist/{index-2FcQHgKp.js → index-DBy53qbb.js} +2 -2
- package/dist/index-DBy53qbb.js.map +1 -0
- package/dist/{index-DPll6EAp.js → index-Dk73a7JE.js} +343 -97
- package/dist/index-Dk73a7JE.js.map +1 -0
- package/dist/{index-LEY0Og1p.js → index-LfXKx_PE.js} +3 -3
- package/dist/index-LfXKx_PE.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +11 -8
- package/dist/main.js.map +1 -1
- package/dist/node/db/Db.d.ts.map +1 -1
- package/dist/node.js +10 -10
- package/dist/node.js.map +1 -1
- package/dist/{property-B15X7jLX.js → property-1o2MvYTm.js} +10 -4
- package/dist/property-1o2MvYTm.js.map +1 -0
- package/dist/{queries-BPDSpiEX.js → queries-DA4G0iEN.js} +2 -2
- package/dist/queries-DA4G0iEN.js.map +1 -0
- package/dist/services/publish/actors/preparePublishRequestData.d.ts.map +1 -1
- package/dist/services/publish/actors/upload.d.ts.map +1 -1
- package/dist/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
- package/dist/ArweaveClient-CgWK-JgT.js.map +0 -1
- package/dist/ArweaveClient-WcG8CZAE.js.map +0 -1
- package/dist/Db-DjFdIdR9.js.map +0 -1
- package/dist/Db-DjofXdeU.js.map +0 -1
- package/dist/EasClient-Aojewp6P.js.map +0 -1
- package/dist/EasClient-BVFXp2O6.js.map +0 -1
- package/dist/FileManager-C9zr4AJe.js.map +0 -1
- package/dist/FileManager-CxGJLw5C.js.map +0 -1
- package/dist/ModelProperty-CGdkocQ8.js.map +0 -1
- package/dist/PathResolver-CX6GHoTS.js.map +0 -1
- package/dist/PathResolver-z_WX47_o.js.map +0 -1
- package/dist/QueryClient-ByKPdRmE.js.map +0 -1
- package/dist/QueryClient-Cb1iJO-x.js.map +0 -1
- package/dist/Schema-D1eqDHyt.js.map +0 -1
- package/dist/SchemaValidationService-DyttFaV_.js.map +0 -1
- package/dist/cjs/ModelProperty-BeJvgKMw.js.map +0 -1
- package/dist/cjs/Schema-CVs9J6eP.js.map +0 -1
- package/dist/cjs/getPublishPayload-BD1qRob1.js.map +0 -1
- package/dist/cjs/index-BeKPbbk0.js.map +0 -1
- package/dist/cjs/index-Dnywap_P.js.map +0 -1
- package/dist/getItem-BB5HBCbK.js.map +0 -1
- package/dist/getPublishPayload-uLm0AqN_.js.map +0 -1
- package/dist/getPublishUploads-Dc-HqhO8.js.map +0 -1
- package/dist/getSegmentedItemProperties-BrIqFNfD.js.map +0 -1
- package/dist/index-2FcQHgKp.js.map +0 -1
- package/dist/index-DPll6EAp.js.map +0 -1
- package/dist/index-LEY0Og1p.js.map +0 -1
- package/dist/property-B15X7jLX.js.map +0 -1
- package/dist/queries-BPDSpiEX.js.map +0 -1
package/dist/node.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { enableMapSet } from 'immer';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
import { a as ModelPropertyDataTypes, P as Property, a2 as addModelsToDb, v as BasePathResolver, o as modelPropertiesToObject, a3 as SCHEMA_NJK } from './index-
|
|
4
|
-
export { B as Boolean, D as Date, a7 as INIT_SCRIPT_SUCCESS_MESSAGE, I as Image, a0 as Item, a4 as ItemProperty, J as Json, L as List, M as Model, N as Number, R as Relation, a8 as SCHEMA_TS, g as Text, y as appState, a6 as client, A as config, a5 as eventEmitter, j as getCorrectId, a9 as importJsonSchema, aa as loadSchemaFromFile, C as metadata, H as modelUids, q as models, ab as readJsonImportFile, X as seeds, ac as transformImportToSchemaFile, Y as versions } from './index-
|
|
3
|
+
import { a as ModelPropertyDataTypes, P as Property, a2 as addModelsToDb, v as BasePathResolver, o as modelPropertiesToObject, a3 as SCHEMA_NJK } from './index-Dk73a7JE.js';
|
|
4
|
+
export { B as Boolean, D as Date, a7 as INIT_SCRIPT_SUCCESS_MESSAGE, I as Image, a0 as Item, a4 as ItemProperty, J as Json, L as List, M as Model, N as Number, R as Relation, a8 as SCHEMA_TS, g as Text, y as appState, a6 as client, A as config, a5 as eventEmitter, j as getCorrectId, a9 as importJsonSchema, aa as loadSchemaFromFile, C as metadata, H as modelUids, q as models, ab as readJsonImportFile, X as seeds, ac as transformImportToSchemaFile, Y as versions } from './index-Dk73a7JE.js';
|
|
5
5
|
import pluralize from 'pluralize';
|
|
6
6
|
import 'drizzle-orm';
|
|
7
|
-
export { FileManager } from './FileManager-
|
|
8
|
-
export { Db } from './Db-
|
|
7
|
+
export { FileManager } from './FileManager-d64CkqXy.js';
|
|
8
|
+
export { Db } from './Db-DJAG-5Di.js';
|
|
9
9
|
import yaml from 'js-yaml';
|
|
10
10
|
import fs__default, { readFileSync } from 'fs';
|
|
11
|
-
export { PathResolver } from './PathResolver-
|
|
11
|
+
export { PathResolver } from './PathResolver-D6M0rzKV.js';
|
|
12
12
|
import * as tsImport from 'ts-import';
|
|
13
13
|
import { LoadMode } from 'ts-import';
|
|
14
14
|
import path from 'path';
|
|
@@ -19,12 +19,12 @@ import { execSync } from 'child_process';
|
|
|
19
19
|
import { fileURLToPath } from 'url';
|
|
20
20
|
import { drizzle } from 'drizzle-orm/libsql';
|
|
21
21
|
import { pushSQLiteSchema } from 'drizzle-kit/api';
|
|
22
|
-
import { s as schema } from './index-
|
|
22
|
+
import { s as schema } from './index-DBy53qbb.js';
|
|
23
23
|
import { createClient } from '@libsql/client';
|
|
24
24
|
import { camelCase, snakeCase } from 'lodash-es';
|
|
25
|
-
import './EasClient-
|
|
26
|
-
import './QueryClient-
|
|
27
|
-
import './ArweaveClient-
|
|
25
|
+
import './EasClient-T7Nx9185.js';
|
|
26
|
+
import './QueryClient-COQ_Rs4-.js';
|
|
27
|
+
import './ArweaveClient-DLKAaS3K.js';
|
|
28
28
|
import 'xstate';
|
|
29
29
|
import 'drizzle-orm/sqlite-core';
|
|
30
30
|
import 'nanoid';
|
|
@@ -37,7 +37,7 @@ import 'arweave';
|
|
|
37
37
|
import '@sinclair/typebox';
|
|
38
38
|
import 'fs/promises';
|
|
39
39
|
import 'graphql-request';
|
|
40
|
-
import './queries-
|
|
40
|
+
import './queries-DA4G0iEN.js';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Parses markdown frontmatter from a file
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../src/imports/markdown.ts","../src/node/webpack/index.ts","../src/node/helpers/index.ts","../src/node/helpers/scripts.ts","../src/node/codegen/drizzle.ts","../src/node/index.ts"],"sourcesContent":["import yaml from 'js-yaml'\nimport { readFileSync } from 'fs'\nimport { Property, ModelPropertyDataTypes } from '@/Schema'\nimport { ModelDefinitions } from '@/types'\nimport { addModelsToDb } from '../helpers/db'\nimport type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'\nimport { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy'\nimport type { Model } from '@/Model/Model'\n\n/**\n * Configuration structure expected in markdown frontmatter\n */\ntype SeedConfig = {\n seed: {\n model: string\n properties: {\n [propertyName: string]: {\n type: string\n target?: string\n }\n }\n }\n}\n\n/**\n * Parses markdown frontmatter from a file\n * @param filePath Path to the markdown file\n * @returns The parsed frontmatter as an object, or null if no frontmatter found\n */\nexport const parseMarkdownFrontmatter = (\n filePath: string,\n): Record<string, any> | null => {\n const content = readFileSync(filePath, 'utf-8')\n \n // Check for frontmatter delimiters (more flexible regex)\n // Matches --- at start, optional whitespace, content, ---, optional whitespace\n const frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---(\\s*\\n|$)/\n const match = content.match(frontmatterRegex)\n \n if (!match) {\n return null\n }\n \n const frontmatterYaml = match[1]\n \n try {\n const frontmatter = yaml.load(frontmatterYaml) as Record<string, any>\n return frontmatter\n } catch (error) {\n throw new Error(\n `Failed to parse YAML frontmatter in ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n\n/**\n * Converts a seed config from frontmatter to ModelDefinitions format\n * @param config The seed configuration from frontmatter\n * @returns ModelDefinitions object ready to be saved to database\n */\nexport const processSeedConfig = (config: SeedConfig): ModelDefinitions => {\n if (!config.seed) {\n throw new Error('No seed configuration found in frontmatter')\n }\n \n const { model: modelName, properties: propertiesConfig } = config.seed\n \n if (!modelName) {\n throw new Error('Model name is required in seed configuration')\n }\n \n if (!propertiesConfig || Object.keys(propertiesConfig).length === 0) {\n throw new Error('Properties are required in seed configuration')\n }\n \n // Convert property configs to Property definitions\n const schema: Record<string, any> = {}\n \n for (const [propertyName, propertyConfig] of Object.entries(propertiesConfig)) {\n const { type, target } = propertyConfig\n \n if (!type) {\n throw new Error(`Property type is required for ${propertyName}`)\n }\n \n // Map the type to Property constructor\n switch (type) {\n case ModelPropertyDataTypes.Text:\n schema[propertyName] = Property.Text()\n break\n case ModelPropertyDataTypes.Number:\n schema[propertyName] = Property.Number()\n break\n case ModelPropertyDataTypes.Boolean:\n schema[propertyName] = Property.Boolean()\n break\n case ModelPropertyDataTypes.Date:\n schema[propertyName] = Property.Date()\n break\n case ModelPropertyDataTypes.Image:\n schema[propertyName] = Property.Image()\n break\n case ModelPropertyDataTypes.Json:\n schema[propertyName] = Property.Json()\n break\n case ModelPropertyDataTypes.File:\n schema[propertyName] = Property.File()\n break\n case ModelPropertyDataTypes.Relation:\n if (!target) {\n throw new Error(\n `Target model is required for Relation property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.Relation(target)\n break\n case ModelPropertyDataTypes.List:\n if (!target) {\n throw new Error(\n `Target model is required for List property ${propertyName}`,\n )\n }\n schema[propertyName] = Property.List(target)\n break\n default:\n throw new Error(\n `Unknown property type: ${type} for property ${propertyName}`,\n )\n }\n }\n \n // Create a mock ModelClass structure that matches ModelDefinitions\n // This is a simplified version that works with addModelsToInternalDb\n const modelClass = {\n schema,\n create: async () => {\n throw new Error('Model.create() should not be called directly')\n },\n originalConstructor: class {},\n }\n \n return {\n [modelName]: modelClass as any as Model,\n }\n}\n\n/**\n * Reads a markdown file, parses frontmatter, and saves models/properties to database\n * @param filePath Path to the markdown file\n * @param db Database instance (BetterSQLite3Database or SqliteRemoteDatabase)\n * @returns The created ModelDefinitions\n */\nexport const saveModelsFromMarkdown = async (\n filePath: string,\n db: BetterSQLite3Database<any> | SqliteRemoteDatabase<any>,\n): Promise<ModelDefinitions> => {\n // Parse frontmatter\n const frontmatter = parseMarkdownFrontmatter(filePath)\n \n if (!frontmatter) {\n throw new Error(`No frontmatter found in ${filePath}`)\n }\n \n // Validate and process seed config\n const seedConfig = frontmatter as SeedConfig\n const modelDefinitions = processSeedConfig(seedConfig)\n \n // Save to database\n await addModelsToDb(modelDefinitions, undefined, undefined, undefined)\n \n return modelDefinitions\n}\n","// import path from \"path\";\n// import { fileURLToPath } from \"url\";\n\n// const __filename = fileURLToPath(import.meta.url);\n// const __dirname = path.dirname(__filename);\n\nexport const withSeed = (config: any, webpack: any, isServer: boolean) => {\n // If you need to include directories outside of the project root\n // config.module.rules.push({\n // test: /\\.ts$/,\n // include: [path.resolve(process.cwd(), 'schema.ts')],\n // use: 'ts-loader',\n // })\n\n config.plugins.push(\n // new webpack.DefinePlugin({\n // __dirname: JSON.stringify(__dirname),\n // }),\n new webpack.NormalModuleReplacementPlugin(/node:/, (resource: { request: string }) => {\n resource.request = resource.request.replace(/^node:/, '')\n }),\n )\n\n // config.externals.push({\n // 'fsevents': 'commonjs2 fsevents',\n // })\n\n // console.log('__dirname:', __dirname)\n // console.log('process.cwd():', process.cwd())\n\n // console.log('crypto-browserify exists:', fs.existsSync(path.resolve(process.cwd(), './node_modules/crypto-browserify')))\n // console.log('path-browserify exists:', fs.existsSync(path.resolve(process.cwd(), './node_modules/path-browserify')))\n\n if (!isServer) {\n // config.plugins.push(\n // new webpack.NormalModuleReplacementPlugin(/node:/, (resource: any) => {\n // resource.request = resource.request.replace(/^node:/, '')\n // }),\n // )\n // config.plugins.push(\n // new webpack.NormalModuleReplacementPlugin(\n // /^(node:)?fs$/,\n // (resource: any) => {\n // resource.request = '@zenfs/core';\n // }\n // )\n // )\n\n // config.module.rules.push({\n // test: /\\.js$/,\n // exclude: '/node_modules/@seedprotocol/sdk/node', // Exclude the 'node-files' directory\n // use: {\n // loader: 'babel-loader',\n // options: {\n // presets: ['next/babel'],\n // },\n // },\n // });\n\n\n // config.resolve.alias['fs/promises'] = '@zenfs/core/promises';\n\n config.resolve.alias['fs'] = '@zenfs/core'\n config.resolve.alias['node:fs'] = '@zenfs/core'\n config.resolve.alias['node:path'] = 'path-browserify'\n config.resolve.alias['path'] = 'path-browserify'\n\n // config.resolve.alias['fs'] = path.resolve(\n // process.cwd(),\n // './node_modules/@zenfs/core',\n // )\n // config.resolve.alias['node:fs'] = path.resolve(\n // process.cwd(),\n // './node_modules/@zenfs/core',\n // )\n // config.resolve.alias['@schema'] = path.resolve(process.cwd(), 'schema.ts')\n // // config.resolve.alias['crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')\n // // config.resolve.alias['node:crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')\n // config.resolve.alias['node:path'] = path.resolve(\n // process.cwd(),\n // './node_modules/path-browserify',\n // )\n // config.resolve.alias['path'] = path.resolve(\n // process.cwd(),\n // './node_modules/path-browserify',\n // )\n }\n\n if (isServer) {\n config.externals.push('@sqlite.org/sqlite-wasm')\n config.externals.push('nunjucks')\n config.externals.push('chokidar')\n config.externals.push('arweave')\n }\n\n // config.module.rules.push({\n // test: /seed\\.config\\.mjs$/,\n // use: [\n // {\n // loader: 'babel-loader',\n // options: {\n // plugins: ['@babel/plugin-syntax-dynamic-import'],\n // },\n // },\n // ],\n // })\n\n return config\n}\n","import fs from 'fs'\nimport * as tsImport from 'ts-import'\nimport { LoadMode } from 'ts-import'\nimport path from 'path'\nimport { glob } from 'glob'\nimport { rimraf } from 'rimraf'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:helpers')\n\nexport const getTsImport = async <T>(filePath: string): Promise<T> => {\n // Check if the config file exists\n if (!fs.existsSync(filePath)) {\n logger(`Typescript file not found at ${filePath}`)\n throw new Error(`Typescript file not found at ${filePath}`)\n }\n\n let result\n\n try {\n // Read the file content and transform relative imports to absolute paths\n // This fixes the issue where ts-import compiles to .mjs in cache and relative\n // imports resolve from the cache location instead of the original file location\n let fileContent = fs.readFileSync(filePath, 'utf-8')\n const fileDir = path.dirname(path.resolve(filePath))\n \n // Replace relative imports with absolute paths\n // Match: from '../../../../src/schema' or from '../../../something'\n const relativeImportRegex = /from\\s+['\"](\\.\\.\\/.*?)['\"]/g\n fileContent = fileContent.replace(relativeImportRegex, (match, importPath) => {\n const absolutePath = path.resolve(fileDir, importPath)\n // Convert to file:// URL for ESM compatibility, or use absolute path\n return `from '${absolutePath}'`\n })\n\n // Write to a temporary file and load that instead\n const tempFile = path.join(fileDir, `.temp.${path.basename(filePath)}`)\n fs.writeFileSync(tempFile, fileContent)\n \n try {\n result = await tsImport.load(tempFile, {\n mode: LoadMode.Compile,\n compileOptions: {\n compilerOptions: {\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n },\n },\n }).catch((e) => {\n logger('Error loading ts file:', e)\n throw e\n })\n } finally {\n // Clean up temp file\n if (fs.existsSync(tempFile)) {\n fs.unlinkSync(tempFile)\n }\n }\n\n } catch ( e ) {\n console.error(e)\n }\n\n\n return result\n}\n\nexport const deleteFilesWithExtension = async (\n dir: string,\n extension: string,\n) => {\n const pattern = path.join(dir, `**/*${extension}`)\n try {\n const files = await glob(pattern)\n for (const file of files) {\n try {\n await rimraf(file)\n logger(`Deleted: ${file}`)\n } catch (err) {\n logger('Error deleting file:', err)\n }\n }\n } catch (err) {\n logger('Error finding files:', err)\n }\n}\n","import { execSync } from 'child_process'\nimport path from 'path'\nimport fs from 'fs'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { generateSQLiteDrizzleJson, generateSQLiteMigration, generateMigration, pushSQLiteSchema } from 'drizzle-kit/api'\nimport * as schema from '@/seedSchema'\nimport { createClient } from '@libsql/client'\n\n// Get the directory of this file to resolve relative paths\n// @ts-ignore - rollup plugin-typescript doesn't recognize import.meta with module: \"preserve\"\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport const commandExists = (command: string): boolean => {\n try {\n execSync(`which ${command}`, { stdio: 'ignore' })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Finds the seed binary path, trying multiple locations\n * @returns The path to the seed binary, or null if not found\n */\nexport const findSeedBinary = (): string | null => {\n const cwd = process.cwd()\n \n // Try common locations for the seed binary\n const possiblePaths = [\n path.join(cwd, 'node_modules', '.bin', 'seed'),\n path.join(cwd, 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n // Try parent directories (for monorepos or nested projects)\n path.join(cwd, '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n path.join(cwd, '..', '..', 'node_modules', '.bin', 'seed'),\n path.join(cwd, '..', '..', 'node_modules', '@seedprotocol', 'cli', 'dist', 'bin.js'),\n ]\n \n for (const binPath of possiblePaths) {\n if (fs.existsSync(binPath)) {\n return binPath\n }\n }\n \n return null\n}\n\n/**\n * Checks if we're running in the monorepo by looking for the CLI package directory\n * @returns The path to the monorepo root, or null if not in monorepo\n */\nfunction getMonorepoRoot(): string | null {\n // Start from this file's location and walk up to find packages/cli\n let currentDir = __dirname\n \n // Walk up the directory tree looking for packages/cli\n for (let i = 0; i < 10; i++) { // Limit to 10 levels to avoid infinite loops\n const packagesDir = path.join(currentDir, 'packages')\n const cliDir = path.join(packagesDir, 'cli')\n \n if (fs.existsSync(cliDir) && fs.existsSync(path.join(cliDir, 'package.json'))) {\n // Found packages/cli, return the monorepo root (parent of packages)\n return path.dirname(packagesDir)\n }\n \n const parentDir = path.dirname(currentDir)\n if (parentDir === currentDir) {\n // Reached filesystem root\n break\n }\n currentDir = parentDir\n }\n \n return null\n}\n\n/**\n * Attempts to import the CLI package, preferring local monorepo version over published package\n * @returns The CLI module or null if not found\n */\nasync function importCliPackage(): Promise<any> {\n // First, try to import from local monorepo CLI (for development)\n const monorepoRoot = getMonorepoRoot()\n \n if (monorepoRoot) {\n const localCliDistPath = path.join(monorepoRoot, 'packages', 'cli', 'dist', 'index.js')\n const localCliSrcPath = path.join(monorepoRoot, 'packages', 'cli', 'src', 'index.ts')\n \n // Try built dist first (most reliable)\n if (fs.existsSync(localCliDistPath)) {\n try {\n const localCliDistUrl = pathToFileURL(localCliDistPath).href\n const cliModule = await import(localCliDistUrl)\n if (cliModule && typeof cliModule.init === 'function') {\n return cliModule\n }\n } catch (error: any) {\n // Dist import failed, try source\n }\n }\n \n // Try source (for development with tsx/ts-node)\n if (fs.existsSync(localCliSrcPath)) {\n try {\n const localCliSrcUrl = pathToFileURL(localCliSrcPath).href\n const cliModule = await import(localCliSrcUrl)\n if (cliModule && typeof cliModule.init === 'function') {\n return cliModule\n }\n } catch (error: any) {\n // Source import failed (TypeScript not compiled or not using tsx)\n }\n }\n }\n \n // Fall back to published package (for production/consumers)\n // Note: @seedprotocol/cli is not a dependency of the SDK to avoid circular dependencies\n // This is a dynamic import that may not be available in all environments\n try {\n // @ts-ignore - Dynamic import of optional CLI package\n // Using template literal to prevent Vite from statically analyzing this import\n const cliPackageName = '@seedprotocol/cli'\n const cliModule = await import(cliPackageName)\n if (cliModule && typeof cliModule.init === 'function') {\n return cliModule\n }\n } catch (importError: any) {\n // Published package not available\n return null\n }\n \n return null\n}\n\n/**\n * Runs seed init programmatically, trying multiple methods:\n * 1. Try to dynamically import and call the CLI package's init function (prefers local monorepo version)\n * 2. Try to find and execute the seed binary\n * 3. Fall back to using npx\n * @param schemaFileDir - Optional path to schema file directory\n * @param appFilesDirPath - Optional path to app files directory\n */\nexport const runSeedInit = async (\n schemaFileDir?: string,\n appFilesDirPath?: string\n): Promise<void> => {\n\n const dbDirExists = fs.existsSync(`${appFilesDirPath}/db`)\n if (!dbDirExists) {\n fs.mkdirSync(`${appFilesDirPath}/db`, { recursive: true })\n }\n\n const dbUrl = `file:${appFilesDirPath}/db/seed.db`\n const client = createClient({ url: dbUrl })\n\n const db = drizzle(client, {schema})\n\n const { apply, hasDataLoss, warnings, statementsToExecute } = await pushSQLiteSchema(schema, db);\n \n // You can inspect what will happen before applying\n \n await apply();\n\n\n // // First, try to dynamically import the CLI package's init function\n // // This prefers local monorepo version in development, falls back to published package\n // try {\n // const cliModule = await importCliPackage()\n // if (cliModule && typeof cliModule.init === 'function') {\n // await cliModule.init(schemaFileDir, appFilesDirPath)\n // return\n // }\n // } catch (importError: any) {\n // // CLI package not available, continue to other methods\n // console.log('[seedInit] CLI package not available, trying binary execution')\n // }\n \n // // Try to find and execute the binary\n // const seedBinary = findSeedBinary()\n \n // if (seedBinary) {\n // // Binary found, execute it directly\n // const args = ['init']\n // if (schemaFileDir) {\n // args.push(schemaFileDir)\n // }\n // if (appFilesDirPath) {\n // args.push(appFilesDirPath)\n // }\n \n // try {\n // execSync(`node \"${seedBinary}\" ${args.join(' ')}`, {\n // stdio: 'inherit',\n // cwd: process.cwd(),\n // })\n // return\n // } catch (error: any) {\n // console.warn(`[seedInit] Failed to execute binary at ${seedBinary}: ${error.message}`)\n // // Continue to npx fallback\n // }\n // }\n \n // // Final fallback: use npx\n // const args = ['seed', 'init']\n // if (schemaFileDir) {\n // args.push(schemaFileDir)\n // }\n // if (appFilesDirPath) {\n // args.push(appFilesDirPath)\n // }\n \n // try {\n // execSync(`npx ${args.join(' ')}`, {\n // stdio: 'inherit',\n // cwd: process.cwd(),\n // })\n // } catch (error: any) {\n // throw new Error(\n // `Failed to run seed init command. ` +\n // `Tried: CLI package import, binary execution, and npx. ` +\n // `Please ensure @seedprotocol/cli is installed: ${error.message}`\n // )\n // }\n}\n\n","import path from 'path'\nimport pluralize from 'pluralize'\nimport { camelCase, snakeCase } from 'lodash-es'\nimport { Model } from '@/Model/Model'\nimport { ModelPropertyDataTypes } from '@/Schema'\nimport { modelPropertiesToObject } from '@/helpers/model'\n\n// Define ILoader type locally to avoid importing from nunjucks (prevents bundling issues)\ntype ILoader = {\n getSource(name: string): { path: string; src: string; noCache: boolean }\n}\nimport { SCHEMA_NJK } from '@/helpers/constants'\nimport { getTsImport } from '@/node/helpers'\nimport fs from 'fs'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:codegen:drizzle')\n\n// Lazy load nunjucks to avoid bundling issues when only PathResolver is used\nlet nunjucksEnv: any = null\n\nconst getNunjucksEnv = async () => {\n if (!nunjucksEnv) {\n const nunjucks = await import('nunjucks')\n \n const TemplateLoader: ILoader = {\n getSource: (name: string) => {\n const pathResolver = BasePathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n let templateFilePath = templatePath\n if (name.includes(templatePath)) {\n templateFilePath = name\n } else {\n templateFilePath = path.join(templatePath, path.basename(name))\n }\n const src = fs.readFileSync(templateFilePath, 'utf-8')\n\n return {\n path: name,\n src,\n noCache: false,\n }\n },\n }\n\n // Configure Nunjucks\n nunjucksEnv = new nunjucks.Environment(TemplateLoader)\n\n nunjucksEnv.addFilter('camelCase', camelCase)\n nunjucksEnv.addFilter('snakeCase', snakeCase)\n nunjucksEnv.addFilter('pluralize', pluralize)\n }\n return nunjucksEnv\n}\n\nconst refNamesToExcludeFromRelations = [\n ModelPropertyDataTypes.Text,\n ModelPropertyDataTypes.Number,\n ModelPropertyDataTypes.Boolean,\n ModelPropertyDataTypes.Date,\n]\n\nexport const generateDrizzleSchemaCode = async (\n modelName: string,\n model: Model,\n): Promise<string> => {\n const properties = model.properties || []\n if (properties.length === 0) {\n throw new Error(`Model ${modelName} has no properties`)\n }\n const schema = modelPropertiesToObject(properties)\n const listProperties = Object.entries(schema).filter(\n ([key, propertyDef]) => propertyDef?.dataType === ModelPropertyDataTypes.List && !refNamesToExcludeFromRelations.includes(propertyDef?.ref!),\n )\n\n const pathResolver = BasePathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n const filePath = path.join(templatePath, SCHEMA_NJK)\n\n const env = await getNunjucksEnv()\n const schemaCode = env.render(filePath, {\n modelName,\n modelClass: model, // Keep modelClass name for template compatibility\n listProperties,\n })\n\n return schemaCode\n}\n\nexport const createDrizzleSchemaFilesFromConfig = async (\n configFilePath: string | undefined,\n outputDirPath: string | undefined,\n) => {\n const pathResolver = BasePathResolver.getInstance()\n const { dotSeedDir, appSchemaDir } = pathResolver.getAppPaths()\n\n // Use provided config file path or find the config file in the project root\n const schemaFilePath = configFilePath || pathResolver.findConfigFile() || path.join(dotSeedDir, 'seed.config.ts')\n\n const { models, } = await getTsImport<{\n models: Record<string, Model>\n }>(schemaFilePath)\n\n const writeToDir = outputDirPath || appSchemaDir\n\n for (const [modelName, modelClass] of Object.entries(models)) {\n const code = await generateDrizzleSchemaCode(modelName, modelClass)\n\n if (!fs.existsSync(writeToDir)) {\n fs.mkdirSync(writeToDir)\n }\n\n const filePath = path.join(writeToDir, `${modelName}Schema.ts`)\n\n await fs.promises.writeFile(filePath, code).catch((e) => console.error(e))\n }\n}\n\n // Helper to determine TypeScript type based on property type\n const seedTypeToJsType = (propertyType: string): string => {\n switch (propertyType) {\n case ModelPropertyDataTypes.Text:\n return 'string';\n case ModelPropertyDataTypes.Number:\n return 'number';\n case ModelPropertyDataTypes.Boolean:\n return 'boolean';\n case ModelPropertyDataTypes.Date:\n return 'string';\n case ModelPropertyDataTypes.List:\n return 'string[]';\n case ModelPropertyDataTypes.Relation:\n return 'string';\n case ModelPropertyDataTypes.Image:\n return 'string';\n case ModelPropertyDataTypes.File:\n return 'string';\n default:\n return 'any';\n }\n};\n\n\nexport const generateModelCode = async (values: Record<string, any>): Promise<string> => {\n const { modelName, properties } = values;\n const pathResolver = BasePathResolver.getInstance()\n const { templatePath } = pathResolver.getAppPaths()\n\n if (modelName === ModelPropertyDataTypes.Text || modelName === 'TestModel') {\n logger(`Model name is ${modelName}.`)\n }\n\n const nunjucks = await import('nunjucks')\n const njkEnv = new nunjucks.Environment(new nunjucks.FileSystemLoader(templatePath))\n njkEnv.addFilter('seedTypeToJsType', seedTypeToJsType)\n return njkEnv.render('model.njk', { modelName, properties })\n};\n","import { enableMapSet } from 'immer'\n\n// Core schema exports\nexport {\n Model,\n Property,\n Image,\n List,\n Text,\n Json,\n Relation,\n Boolean,\n Number,\n Date,\n} from '../Schema'\n\n// Core classes\nexport { Item } from '../Item/Item'\nexport { ItemProperty } from '../ItemProperty/ItemProperty'\n\n// Node.js specific exports\nexport { FileManager } from './helpers/FileManager'\nexport { Db } from './db/Db'\n\n// Schema exports\nexport { models, versions, seeds, metadata, appState, config, modelUids } from '../seedSchema'\n\n// Model access - use Model static methods instead\n// Models are accessible via Model.all(), Model.getById(), Model.getByName(), etc.\n\n// Helper exports\nexport { getCorrectId } from '../helpers'\n\n// Import exports\nexport * from '../imports'\n\n// Event bus\nexport { eventEmitter } from '../eventBus'\n\n// Webpack helper\nexport { withSeed } from './webpack'\n\n// Types\n// Note: PublishUpload type is available from '../db/read/getPublishUploads'\n// Type-only exports cause issues with Rollup's parser. Import directly if needed:\n// import type { PublishUpload } from '@seedprotocol/sdk/db/read/getPublishUploads'\n\n// Client\nexport { client } from '../client'\n\n// All types\nexport * from '../types'\n\n// CLI exports\nexport { PathResolver } from './helpers/PathResolver'\nexport { BasePathResolver } from '../helpers/PathResolver/BasePathResolver'\nexport { getTsImport } from './helpers'\nexport { commandExists, runSeedInit, findSeedBinary } from './helpers/scripts'\nexport { INIT_SCRIPT_SUCCESS_MESSAGE, SCHEMA_TS } from '../helpers/constants'\n// Codegen functions exported for CLI usage (Node.js only, so bundling concerns don't apply)\nexport { createDrizzleSchemaFilesFromConfig, generateModelCode } from './codegen/drizzle'\n\n// Side effect imports for CLI\nimport './helpers/EasClient'\nimport './helpers/QueryClient'\nimport './helpers/FileManager'\nimport './helpers/ArweaveClient'\nimport './helpers/PathResolver'\n\nenableMapSet() "],"names":["logger","fs","__filename"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,CACtC,QAAgB,KACc;IAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;;;IAI/C,MAAM,gBAAgB,GAAG,mCAAmC;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC;AAEhC,IAAA,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAwB;AACrE,QAAA,OAAO,WAAW;IACpB;IAAE,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,CAAA,oCAAA,EAAuC,QAAQ,KAAK,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAE,CAC7G;IACH;AACF;AAEA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAkB,KAAsB;AACxE,IAAA,IAAI,CAAC,MAAM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OAAO,UAAU;QACnB,KAAK,sBAAsB,CAAC,QAAQ;AAClC,YAAA,OAAO,QAAQ;QACjB,KAAK,sBAAsB,CAAC,KAAK;AAC/B,YAAA,OAAO,QAAQ;QACjB,KAAK,sBAAsB,CAAC,IAAI;AAC9B,YAAA,OAAO,QAAQ;AACjB,QAAA;AACE,YAAA,OAAO,KAAK;;AAElB,CAAC;MAGY,iBAAiB,GAAG,OAAO,MAA2B,KAAqB;AACtF,IAAA,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM;AACxC,IAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,EAAE;IACnD,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,WAAW,EAAE;IAEnD,IAAI,SAAS,KAAK,sBAAsB,CAAC,IAAI,IAAI,SAAS,KAAK,WAAW,EAAE;AAC1E,QAAA,MAAM,CAAC,CAAA,cAAA,EAAiB,SAAS,CAAA,CAAA,CAAG,CAAC;IACvC;AAEA,IAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AACzC,IAAA,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACpF,IAAA,MAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;AACtD,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAC9D;;ACxFA,YAAY,EAAE;;;;"}
|
|
1
|
+
{"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import pluralize from 'pluralize';
|
|
2
|
-
import { o as modelPropertiesToObject, p as BaseDb, q as models, r as properties } from './index-
|
|
2
|
+
import { o as modelPropertiesToObject, p as BaseDb, q as models, r as properties } from './index-Dk73a7JE.js';
|
|
3
3
|
import { eq, and } from 'drizzle-orm';
|
|
4
4
|
|
|
5
5
|
// Dynamic import to break circular dependency: Model -> ... -> helpers/property -> Model
|
|
@@ -38,8 +38,14 @@ import { eq, and } from 'drizzle-orm';
|
|
|
38
38
|
*/
|
|
39
39
|
const getPropertySchema = async (modelName, propertyName) => {
|
|
40
40
|
// Dynamic import to break circular dependency
|
|
41
|
-
const
|
|
42
|
-
const
|
|
41
|
+
const _mod_0 = await import('./index-Dk73a7JE.js');
|
|
42
|
+
const _ns_0 = _mod_0.aW;
|
|
43
|
+
const modelMod = _ns_0;
|
|
44
|
+
const { Model } = modelMod;
|
|
45
|
+
const _mod_1 = await import('./Schema-BZKBy5Tx.js');
|
|
46
|
+
const _ns_1 = _mod_1.b;
|
|
47
|
+
const schemaMod = _ns_1;
|
|
48
|
+
const { Schema } = schemaMod;
|
|
43
49
|
const model = await Model.getByNameAsync(modelName);
|
|
44
50
|
console.log('getPropertySchema model', model);
|
|
45
51
|
if (!model) {
|
|
@@ -273,4 +279,4 @@ const getPropertySchema = async (modelName, propertyName) => {
|
|
|
273
279
|
};
|
|
274
280
|
|
|
275
281
|
export { getPropertySchema as g };
|
|
276
|
-
//# sourceMappingURL=property-
|
|
282
|
+
//# sourceMappingURL=property-1o2MvYTm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-1o2MvYTm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as graphql } from './index-
|
|
1
|
+
import { _ as graphql } from './index-Dk73a7JE.js';
|
|
2
2
|
|
|
3
3
|
const GET_TRANSACTION_TAGS = graphql(/* GraphQL */ `
|
|
4
4
|
query GetTransactionTags($transactionId: ID!) {
|
|
@@ -13,4 +13,4 @@ const GET_TRANSACTION_TAGS = graphql(/* GraphQL */ `
|
|
|
13
13
|
`);
|
|
14
14
|
|
|
15
15
|
export { GET_TRANSACTION_TAGS as G };
|
|
16
|
-
//# sourceMappingURL=queries-
|
|
16
|
+
//# sourceMappingURL=queries-DA4G0iEN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries-DA4G0iEN.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preparePublishRequestData.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/preparePublishRequestData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAQlE,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"preparePublishRequestData.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/preparePublishRequestData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAQlE,eAAO,MAAM,yBAAyB,yGAyEpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAkBlE,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAkBlE,eAAO,MAAM,MAAM,yGA6EjB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateEntity.d.ts","sourceRoot":"","sources":["../../../../src/services/write/actors/validateEntity.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAA;IAChD,UAAU,EAAE,GAAG,CAAA;CAChB,CAAA;AASD,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"validateEntity.d.ts","sourceRoot":"","sources":["../../../../src/services/write/actors/validateEntity.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAA;IAChD,UAAU,EAAE,GAAG,CAAA;CAChB,CAAA;AASD,eAAO,MAAM,cAAc,EAoKrB,GAAG,CAAA"}
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sources":["../src/vite/index.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite'\nimport { nodePolyfills } from 'vite-plugin-node-polyfills'\n\nexport interface SeedVitePluginOptions {\n /**\n * Additional modules to alias to ZenFS equivalents.\n * @default ['fs', 'fs/promises', 'node:fs', 'node:fs/promises']\n */\n fsModules?: string[]\n\n /**\n * Whether to inject automatic ZenFS initialization script into index.html.\n * When true, injects a <script type=\"module\"> that imports from '@zenfs/core'/'@zenfs/dom'.\n * Browsers cannot resolve those bare specifiers, so the script fails at runtime unless you use\n * an import map or load ZenFS another way. Prefer false and initialize ZenFS in your entry:\n * import { configure } from '@zenfs/core'; import { IndexedDB } from '@zenfs/dom';\n * await configure({ mounts: { '/': IndexedDB } });\n * @default false\n */\n autoInit?: boolean\n\n /**\n * Enable debug logging.\n * @default false\n */\n debug?: boolean\n\n /**\n * Whether to automatically include vite-plugin-node-polyfills with sensible defaults.\n * @default true\n */\n includeNodePolyfills?: boolean\n}\n\nconst DEFAULT_FS_MODULES = [\n 'fs',\n 'fs/promises',\n 'node:fs',\n 'node:fs/promises',\n]\n\n/**\n * Minimal Vite plugin to make the SDK work in browser/Electron renderer:\n * - Aliases fs → @zenfs/core (and promises variant)\n * - Aliases path → path-browserify\n * - Ensures CommonJS in SDK dist is transformed by Vite's CommonJS plugin\n * - Optionally injects a simple ZenFS initialization script\n * - Optionally wires up vite-plugin-node-polyfills with safe defaults\n *\n * This plugin assumes the SDK does not bundle Node-only code in the browser entry.\n * For Electron, Node-only work (e.g. drizzle-kit, better-sqlite3) should run in the\n * main process; the renderer should only use browser-safe SDK usage.\n *\n * For the renderer build:\n * - Use the SDK's ESM entry: import from '@seedprotocol/sdk' (resolves to dist/main.js).\n * - When autoInit is false (default), initialize ZenFS in your entry:\n * import { configure } from '@zenfs/core'; import { IndexedDB } from '@zenfs/dom';\n * await configure({ mounts: { '/': IndexedDB } });\n */\nexport function seedVitePlugin(options: SeedVitePluginOptions = {}): Plugin[] {\n const {\n fsModules = DEFAULT_FS_MODULES,\n autoInit = false,\n debug = false,\n includeNodePolyfills = true,\n } = options\n\n const log = (...args: unknown[]) => {\n if (debug) console.log('[seed-vite-plugin]', ...args)\n }\n\n /**\n * Pre-plugin: configure aliases and optimizeDeps.\n */\n const configPlugin: Plugin = {\n name: 'seed-protocol:config',\n enforce: 'pre',\n\n config(userConfig) {\n const alias: Record<string, string> = {\n // Always use browser-friendly path implementation\n // path: 'path-browserify',\n }\n\n for (const mod of fsModules) {\n const isPromises = mod.includes('promises')\n const target = isPromises ? '@zenfs/core/promises' : '@zenfs/core'\n alias[mod] = target\n }\n\n // Merge with any existing aliases\n const existingAlias = userConfig.resolve?.alias\n if (Array.isArray(existingAlias)) {\n for (const [key, value] of Object.entries(alias)) {\n existingAlias.push({ find: key, replacement: value })\n }\n }\n\n const optimizeDeps: UserConfig['optimizeDeps'] = {\n ...(userConfig.optimizeDeps ?? {}),\n exclude: [\n ...(userConfig.optimizeDeps?.exclude ?? []),\n // Do not prebundle the SDK itself or clearly node-only tools\n '@seedprotocol/sdk',\n 'drizzle-kit',\n 'drizzle-orm',\n 'better-sqlite3',\n // sqlocal uses workers and should not be prebundled\n 'sqlocal',\n ],\n include: [\n ...(userConfig.optimizeDeps?.include ?? []),\n // Ensure ZenFS packages are discoverable\n '@zenfs/core',\n '@zenfs/dom',\n ],\n }\n\n return {\n resolve: {\n alias,\n },\n optimizeDeps,\n }\n },\n }\n\n /**\n * Post-plugin: build configuration + optional ZenFS init.\n */\n const mainPlugin: Plugin = {\n name: 'seed-protocol:main',\n enforce: 'post',\n\n config(userConfig) {\n const existingBuild = userConfig.build ?? {}\n const existingCommonjs = existingBuild.commonjsOptions ?? {}\n const existingRollupOptions = existingBuild.rollupOptions ?? {}\n const existingExternal = existingRollupOptions.external ?? []\n\n const include = [\n // Anything the user already had\n ...(Array.isArray(existingCommonjs.include)\n ? existingCommonjs.include\n : existingCommonjs.include\n ? [existingCommonjs.include]\n : []),\n // Always process node_modules and the SDK dist so require() is transformed\n /node_modules/,\n /seed-protocol-sdk[\\\\/]+dist[\\\\/]/,\n ]\n\n // Exclude packages that are already ESM or have special worker handling\n const exclude = [\n ...(Array.isArray(existingCommonjs.exclude)\n ? existingCommonjs.exclude\n : existingCommonjs.exclude\n ? [existingCommonjs.exclude]\n : []),\n // sqlocal is ESM and uses workers - don't transform it\n /node_modules[\\\\/]+sqlocal[\\\\/]/,\n ]\n\n const commonjsOptions = {\n ...existingCommonjs,\n include,\n exclude,\n transformMixedEsModules: true,\n }\n\n // Externalize Node.js-only dev/build tools that should never be bundled\n // These are build-time tools, not runtime dependencies\n const nodeOnlyPackages = [\n 'drizzle-kit',\n 'better-sqlite3', // Native SQLite binding (Node.js only)\n // Database drivers that drizzle-kit dynamically imports (should not be bundled)\n '@electric-sql/pglite',\n 'pg',\n 'postgres',\n '@vercel/postgres',\n '@neondatabase/serverless',\n 'mysql2',\n 'mysql2/promise',\n '@planetscale/database',\n ]\n\n const isNodeOnlyExternal = (id: string) =>\n nodeOnlyPackages.some(\n (pkg) =>\n id === pkg ||\n id.startsWith(`${pkg}/`) ||\n id.includes(`/${pkg}/`) ||\n id.endsWith(`/${pkg}`)\n )\n\n const externalList = (id: string, importer?: string, isResolved?: boolean) => {\n if (isNodeOnlyExternal(id)) return true\n if (typeof existingExternal === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (existingExternal as any)(id, importer, isResolved ?? false)\n }\n if (Array.isArray(existingExternal)) {\n return existingExternal.some((ext) => ext === id || id.startsWith(`${ext}/`))\n }\n return false\n }\n\n const rollupOptions = {\n ...existingRollupOptions,\n external: externalList,\n }\n\n const build = {\n ...existingBuild,\n commonjsOptions,\n rollupOptions,\n }\n\n // Worker options are TOP-LEVEL in Vite config, not under build.\n // Default 'iife' breaks when workers use code-splitting (e.g. sqlocal).\n const existingWorker = userConfig.worker ?? {}\n const worker = {\n ...existingWorker,\n format: existingWorker.format ?? 'es',\n }\n\n return {\n build,\n worker,\n }\n },\n\n transformIndexHtml(html) {\n if (!autoInit) return html\n\n const initScript = `\n<script type=\"module\">\nimport { configure } from '@zenfs/core';\nimport { IndexedDB } from '@zenfs/dom';\n\nif (!window.__seedFsReady) {\n window.__seedFsReady = configure({\n mounts: { '/': IndexedDB },\n }).catch((err) => {\n console.error('[seed-vite-plugin] ZenFS initialization failed', err);\n });\n}\n</script>`\n\n if (html.includes('</head>')) {\n return html.replace('</head>', `${initScript}\\n</head>`)\n }\n\n return html + initScript\n },\n }\n\n const plugins: Plugin[] = [configPlugin, mainPlugin]\n\n if (includeNodePolyfills) {\n log('Including vite-plugin-node-polyfills with default settings')\n plugins.push(\n nodePolyfills({\n // Let fs be handled by @zenfs/core instead of polyfills\n exclude: ['readline',],\n // Common set of browser-friendly polyfills used by many deps\n include: ['path', 'crypto', 'stream', 'util', 'buffer', 'events', 'string_decoder',],\n globals: {\n Buffer: true,\n global: true,\n process: true,\n },\n protocolImports: true,\n }) as unknown as Plugin,\n )\n }\n\n return plugins\n}\n"],"names":[],"mappings":";;AAkCA,MAAM,kBAAkB,GAAG;IACzB,IAA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ACxB;IACH;AAEA,IAAA,OAAO,OAAO;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"vite.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedprotocol/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "The SDK for Seed Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.cjs",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test:watch": "vitest",
|
|
30
30
|
"compile": "graphql-codegen --config codegen.ts",
|
|
31
31
|
"watch": "graphql-codegen -w",
|
|
32
|
-
"build:dev": "node scripts/build-with-tests.js \"rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && tsc -p tsconfig.declarations.json\"",
|
|
33
|
-
"build:publish": "node scripts/build-with-tests.js \"bun run sync-versions && rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && tsc -p tsconfig.declarations.json && npm publish --access public\"",
|
|
32
|
+
"build:dev": "node scripts/build-with-tests.js \"rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && node scripts/check-dist-fragile-dynamic-imports.js --fail && tsc -p tsconfig.declarations.json\"",
|
|
33
|
+
"build:publish": "node scripts/build-with-tests.js \"bun run sync-versions && rm -rf dist && NODE_ENV=production rollup -c && node scripts/check-dist-no-alias.js && node scripts/check-dist-fragile-dynamic-imports.js --fail && tsc -p tsconfig.declarations.json && npm publish --access public\"",
|
|
34
34
|
"build:cli": "node scripts/build-with-tests.js \"cd packages/cli && bun run build\"",
|
|
35
35
|
"build:all": "node scripts/build-with-tests.js \"bun run sync-versions && bun run build && bun run build:cli\"",
|
|
36
36
|
"sync-versions": "node scripts/sync-versions.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArweaveClient-CgWK-JgT.js","sources":["../src/browser/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from \"@/helpers/ArweaveClient/BaseArweaveClient\";\nimport { GraphQLClient } from \"graphql-request\";\nimport Arweave from \"arweave\";\nimport type {\n TransactionStatus,\n TransactionTag,\n GetDataOptions,\n DownloadFilesParams,\n DownloadResult,\n CreateTransactionOptions,\n} from \"@/types/arweave\";\nimport { GET_TRANSACTION_TAGS } from \"@/helpers/ArweaveClient/queries\";\nimport debug from \"debug\";\n\nconst logger = debug(\"seedSdk:browser:ArweaveClient\");\n\n// Cached Arweave instance\nlet _arweaveInstance: Arweave | null = null;\n\n/**\n * Get or create the Arweave instance for browser\n */\nconst getArweaveInstance = (): Arweave => {\n if (_arweaveInstance) {\n return _arweaveInstance;\n }\n\n const host = BaseArweaveClient.getHost();\n\n // Handle both ES modules and CommonJS exports from arweave package\n if (\"default\" in Arweave && typeof (Arweave as any).default?.init === \"function\") {\n _arweaveInstance = (Arweave as any).default.init({\n host,\n protocol: \"https\",\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol: \"https\",\n });\n }\n\n return _arweaveInstance!;\n};\n\nclass ArweaveClient extends BaseArweaveClient {\n /**\n * Get the GraphQL client for Arweave queries\n */\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(BaseArweaveClient.getEndpoint());\n }\n\n /**\n * Get the status of a transaction\n */\n static async getTransactionStatus(transactionId: string): Promise<TransactionStatus> {\n const url = BaseArweaveClient.getStatusUrl(transactionId);\n \n try {\n const response = await fetch(url);\n \n if (response.status === 404) {\n return {\n status: 404,\n confirmed: null,\n };\n }\n\n if (!response.ok) {\n return {\n status: response.status,\n confirmed: null,\n };\n }\n\n const data = await response.json();\n return {\n status: 200,\n confirmed: {\n block_height: data.block_height,\n block_indep_hash: data.block_indep_hash,\n number_of_confirmations: data.number_of_confirmations,\n },\n };\n } catch (error) {\n logger(\"Error fetching transaction status:\", error);\n return {\n status: 500,\n confirmed: null,\n };\n }\n }\n\n /**\n * Get transaction data\n */\n static async getTransactionData(\n transactionId: string,\n options?: GetDataOptions\n ): Promise<Uint8Array | string> {\n const arweave = getArweaveInstance();\n\n try {\n const data = await arweave.transactions.getData(transactionId, {\n decode: options?.decode ?? true,\n string: options?.string ?? false,\n });\n\n if (options?.string && typeof data === \"string\") {\n return data;\n }\n\n // Ensure we return Uint8Array\n if (data instanceof Uint8Array) {\n return data;\n }\n\n // Handle string data when not requesting string\n if (typeof data === \"string\") {\n return new TextEncoder().encode(data);\n }\n\n return data as Uint8Array;\n } catch (error) {\n logger(\"Error fetching transaction data:\", error);\n throw error;\n }\n }\n\n /**\n * Get transaction tags via GraphQL\n */\n static async getTransactionTags(transactionId: string): Promise<TransactionTag[]> {\n const client = this.getArweaveClient();\n \n try {\n const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });\n \n if (!result.tags?.tags) {\n return [];\n }\n\n return result.tags.tags.map((tag: { name: string; value: string }) => ({\n name: tag.name,\n value: tag.value,\n }));\n } catch (error) {\n logger(\"Error fetching transaction tags:\", error);\n return [];\n }\n }\n\n /**\n * Create a new unsigned transaction\n */\n static async createTransaction(\n data: string | Uint8Array,\n options?: CreateTransactionOptions\n ): Promise<any> {\n const arweave = getArweaveInstance();\n\n const tx = await arweave.createTransaction({\n data,\n });\n\n // Add tags if provided\n if (options?.tags) {\n for (const tag of options.tags) {\n tx.addTag(tag.name, tag.value);\n }\n }\n\n return tx;\n }\n\n /**\n * Download multiple files from Arweave\n */\n static async downloadFiles(params: DownloadFilesParams): Promise<DownloadResult[]> {\n const { transactionIds, excludedTransactions } = params;\n const results: DownloadResult[] = [];\n const host = BaseArweaveClient.getHost();\n\n for (const transactionId of transactionIds) {\n // Skip excluded transactions\n if (excludedTransactions?.has(transactionId)) {\n continue;\n }\n\n try {\n const url = `https://${host}/raw/${transactionId}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n results.push({\n transactionId,\n success: false,\n error: `HTTP ${response.status}: ${response.statusText}`,\n });\n continue;\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const data = new Uint8Array(arrayBuffer);\n\n // Detect content type\n const contentType = response.headers.get(\"content-type\") || undefined;\n\n results.push({\n transactionId,\n success: true,\n contentType,\n data,\n });\n } catch (error) {\n logger(`Error downloading transaction ${transactionId}:`, error);\n results.push({\n transactionId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient };"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAcA,MAAM,MAAM,GAAG,KAAK,CAAC,+BAA+B,CAAC;AAErD;AACA,IAAI,gBAAgB,GAAmB,IAAI;AAE3C;;AAEG;AACH,MAAM,kBAAkB,GAAG,MAAc;IACvC,IAAI,gBAAgB,EAAE;AACpB,QAAA,OAAO,gBAAgB;IACzB;AAEA,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE;;AAGxC,IAAA,IAAI,SAAS,IAAI,OAAO,IAAI,OAAQ,OAAe,CAAC,OAAO,EAAE,IAAI,KAAK,UAAU,EAAE;AAChF,QAAA,gBAAgB,GAAI,OAAe,CAAC,OAAO,CAAC,IAAI,CAAC;YAC/C,IAAI;AACJ,YAAA,QAAQ,EAAE,OAAO;AAClB,SAAA,CAAC;IACJ;SAAO;AACL,QAAA,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;YAC9B,IAAI;AACJ,YAAA,QAAQ,EAAE,OAAO;AAClB,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,gBAAiB;AAC1B,CAAC;AAED,MAAM,aAAc,SAAQ,iBAAiB,CAAA;AAC3C;;AAEG;AACH,IAAA,OAAO,gBAAgB,GAAA;QACrB,OAAO,IAAI,aAAa,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IAC3D;AAEA;;AAEG;AACH,IAAA,aAAa,oBAAoB,CAAC,aAAqB,EAAA;QACrD,MAAM,GAAG,GAAG,iBAAi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I;oBACb,WAAW;oBACX,IAAI;AACL,iBAAA,CAAC;YACJ;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,CAAA,8BAAA,EAAiC,aAAa,GAAG,EAAE,KAAK,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArweaveClient-WcG8CZAE.js","sources":["../src/node/helpers/ArweaveClient.ts"],"sourcesContent":["import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient';\nimport { GraphQLClient } from 'graphql-request';\nimport Arweave from 'arweave';\nimport type {\n TransactionStatus,\n TransactionTag,\n GetDataOptions,\n DownloadFilesParams,\n DownloadResult,\n CreateTransactionOptions,\n} from '@/types/arweave';\nimport { GET_TRANSACTION_TAGS } from '@/helpers/ArweaveClient/queries';\nimport debug from 'debug';\n\nconst logger = debug('seedSdk:node:ArweaveClient');\n\n// Cached Arweave instance\nlet _arweaveInstance: Arweave | null = null;\n\n/**\n * Get or create the Arweave instance for Node.js\n */\nconst getArweaveInstance = (): Arweave => {\n if (_arweaveInstance) {\n return _arweaveInstance;\n }\n\n const host = BaseArweaveClient.getHost();\n\n // Handle both ES modules and CommonJS exports from arweave package\n if ('default' in Arweave && typeof (Arweave as any).default?.init === 'function') {\n _arweaveInstance = (Arweave as any).default.init({\n host,\n protocol: 'https',\n });\n } else {\n _arweaveInstance = Arweave.init({\n host,\n protocol: 'https',\n });\n }\n\n return _arweaveInstance!;\n};\n\nclass ArweaveClient extends BaseArweaveClient {\n /**\n * Get the GraphQL client for Arweave queries\n */\n static getArweaveClient(): GraphQLClient {\n return new GraphQLClient(BaseArweaveClient.getEndpoint());\n }\n\n /**\n * Get the status of a transaction\n */\n static async getTransactionStatus(transactionId: string): Promise<TransactionStatus> {\n const url = BaseArweaveClient.getStatusUrl(transactionId);\n \n try {\n const response = await fetch(url);\n \n if (response.status === 404) {\n return {\n status: 404,\n confirmed: null,\n };\n }\n\n if (!response.ok) {\n return {\n status: response.status,\n confirmed: null,\n };\n }\n\n const data = await response.json();\n return {\n status: 200,\n confirmed: {\n block_height: data.block_height,\n block_indep_hash: data.block_indep_hash,\n number_of_confirmations: data.number_of_confirmations,\n },\n };\n } catch (error) {\n logger('Error fetching transaction status:', error);\n return {\n status: 500,\n confirmed: null,\n };\n }\n }\n\n /**\n * Get transaction data\n */\n static async getTransactionData(\n transactionId: string,\n options?: GetDataOptions\n ): Promise<Uint8Array | string> {\n const arweave = getArweaveInstance();\n\n try {\n const data = await arweave.transactions.getData(transactionId, {\n decode: options?.decode ?? true,\n string: options?.string ?? false,\n });\n\n if (options?.string && typeof data === 'string') {\n return data;\n }\n\n // Ensure we return Uint8Array\n if (data instanceof Uint8Array) {\n return data;\n }\n\n // Handle string data when not requesting string\n if (typeof data === 'string') {\n return new TextEncoder().encode(data);\n }\n\n return data as Uint8Array;\n } catch (error) {\n logger('Error fetching transaction data:', error);\n throw error;\n }\n }\n\n /**\n * Get transaction tags via GraphQL\n */\n static async getTransactionTags(transactionId: string): Promise<TransactionTag[]> {\n const client = this.getArweaveClient();\n \n try {\n const result = await client.request(GET_TRANSACTION_TAGS, { transactionId });\n \n if (!result.tags?.tags) {\n return [];\n }\n\n return result.tags.tags.map((tag: { name: string; value: string }) => ({\n name: tag.name,\n value: tag.value,\n }));\n } catch (error) {\n logger('Error fetching transaction tags:', error);\n return [];\n }\n }\n\n /**\n * Create a new unsigned transaction\n */\n static async createTransaction(\n data: string | Uint8Array,\n options?: CreateTransactionOptions\n ): Promise<any> {\n const arweave = getArweaveInstance();\n\n const tx = await arweave.createTransaction({\n data,\n });\n\n // Add tags if provided\n if (options?.tags) {\n for (const tag of options.tags) {\n tx.addTag(tag.name, tag.value);\n }\n }\n\n return tx;\n }\n\n /**\n * Download multiple files from Arweave\n */\n static async downloadFiles(params: DownloadFilesParams): Promise<DownloadResult[]> {\n const { transactionIds, excludedTransactions } = params;\n const results: DownloadResult[] = [];\n const host = BaseArweaveClient.getHost();\n\n for (const transactionId of transactionIds) {\n // Skip excluded transactions\n if (excludedTransactions?.has(transactionId)) {\n continue;\n }\n\n try {\n const url = `https://${host}/raw/${transactionId}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n results.push({\n transactionId,\n success: false,\n error: `HTTP ${response.status}: ${response.statusText}`,\n });\n continue;\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const data = new Uint8Array(arrayBuffer);\n\n // Detect content type\n const contentType = response.headers.get('content-type') || undefined;\n\n results.push({\n transactionId,\n success: true,\n contentType,\n data,\n });\n } catch (error) {\n logger(`Error downloading transaction ${transactionId}:`, error);\n results.push({\n transactionId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n}\n\nBaseArweaveClient.setPlatformClass(ArweaveClient);\n\nexport { ArweaveClient };"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAcA,MAAM,MAAM,GAAG,KAAK,CAAC,4BAA4B,CAAC;AAElD;AACA,IAAI,gBAAgB,GAAmB,IAAI;AAE3C;;AAEG;AACH,MAAM,kBAAkB,GAAG,MAAc;IACvC,IAAI,gBAAgB,EAAE;AACpB,QAAA,OAAO,gBAAgB;IACzB;AAEA,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE;;AAGxC,IAAA,IAAI,SAAS,IAAI,OAAO,IAAI,OAAQ,OAAe,CAAC,OAAO,EAAE,IAAI,KAAK,UAAU,EAAE;AAChF,QAAA,gBAAgB,GAAI,OAAe,CAAC,OAAO,CAAC,IAAI,CAAC;YAC/C,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AI,CAAC;wBACX,aAAa;AACb,wBAAA,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,QAAQ,QAAQ,CAAC,MAAM,CAAA,EAAA,EAAK,QAAQ,CAAC,UAAU,CAAA,CAAE;AACzD,qBAAA,CAAC;oBACF;gBACF;AAEA,gBAAA,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE;AAChD,gBAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;;AAGxC,gBAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS;gBAErE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,IAAI;oBACb,WAAW;oBACX,IAAI;AACL,iBAAA,CAAC;YACJ;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,CAAA,8BAAA,EAAiC,aAAa,GAAG,EAAE,KAAK,CAAC;gBAChE,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa;AACb,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;AAED,iBAAiB,CAAC,gBAAgB,CAAC,aAAa,CAAC;;;;"}
|
package/dist/Db-DjFdIdR9.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Db-DjFdIdR9.js","sources":["../src/browser/db/drizzleFiles.ts","../src/browser/db/Db.ts"],"sourcesContent":["// This file embeds the drizzle migration files as strings for browser runtime\n// These files are copied from src/db/drizzle at build time\n\n// Individual migration SQL files\nexport const migrationSql_0000_married_malice = `CREATE TABLE \\`appState\\` (\n\t\\`key\\` text,\n\t\\`value\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`appState_key_unique\\` ON \\`appState\\` (\\`key\\`);--> statement-breakpoint\nCREATE TABLE \\`config\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`key\\` text NOT NULL,\n\t\\`text\\` text,\n\t\\`json\\` text,\n\t\\`blob\\` blob\n);\n--> statement-breakpoint\nCREATE TABLE \\`metadata\\` (\n\t\\`local_id\\` text,\n\t\\`uid\\` text,\n\t\\`property_name\\` text,\n\t\\`property_value\\` text,\n\t\\`schema_uid\\` text,\n\t\\`model_type\\` text,\n\t\\`seed_local_id\\` text,\n\t\\`seed_uid\\` text,\n\t\\`version_local_id\\` text,\n\t\\`version_uid\\` text,\n\t\\`eas_data_type\\` text,\n\t\\`ref_value_type\\` text,\n\t\\`ref_schema_uid\\` text,\n\t\\`ref_seed_type\\` text,\n\t\\`ref_resolved_value\\` text,\n\t\\`ref_resolved_display_value\\` text,\n\t\\`local_storage_dir\\` text,\n\t\\`attestation_raw\\` text,\n\t\\`attestation_created_at\\` integer,\n\t\\`content_hash\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`metadata_local_id_unique\\` ON \\`metadata\\` (\\`local_id\\`);--> statement-breakpoint\nCREATE TABLE \\`models\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`name\\` text NOT NULL,\n\t\\`schema_file_id\\` text\n);\n--> statement-breakpoint\nCREATE TABLE \\`properties\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`name\\` text NOT NULL,\n\t\\`data_type\\` text NOT NULL,\n\t\\`model_id\\` integer NOT NULL,\n\t\\`ref_model_id\\` integer,\n\t\\`ref_value_type\\` text,\n\t\\`schema_file_id\\` text,\n\tFOREIGN KEY (\\`model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action,\n\tFOREIGN KEY (\\`ref_model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`unique_name_model_id\\` ON \\`properties\\` (\\`name\\`,\\`model_id\\`);--> statement-breakpoint\nCREATE TABLE \\`model_schemas\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`model_id\\` integer,\n\t\\`schema_id\\` integer,\n\tFOREIGN KEY (\\`model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action,\n\tFOREIGN KEY (\\`schema_id\\`) REFERENCES \\`schemas\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE TABLE \\`model_uids\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`uid\\` text NOT NULL,\n\t\\`model_id\\` integer NOT NULL,\n\tFOREIGN KEY (\\`model_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`model_uids_model_id_unique\\` ON \\`model_uids\\` (\\`model_id\\`);--> statement-breakpoint\nCREATE TABLE \\`property_uids\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`uid\\` text NOT NULL,\n\t\\`property_id\\` integer NOT NULL,\n\tFOREIGN KEY (\\`property_id\\`) REFERENCES \\`models\\`(\\`id\\`) ON UPDATE no action ON DELETE no action\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`property_uids_property_id_unique\\` ON \\`property_uids\\` (\\`property_id\\`);--> statement-breakpoint\nCREATE TABLE \\`schemas\\` (\n\t\\`id\\` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t\\`name\\` text NOT NULL,\n\t\\`version\\` integer NOT NULL,\n\t\\`schema_file_id\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer\n);\n--> statement-breakpoint\nCREATE TABLE \\`seeds\\` (\n\t\\`local_id\\` text,\n\t\\`uid\\` text,\n\t\\`schema_uid\\` text,\n\t\\`type\\` text,\n\t\\`attestation_raw\\` text,\n\t\\`attestation_created_at\\` integer,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer,\n\t\\`_marked_for_deletion\\` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`seeds_local_id_unique\\` ON \\`seeds\\` (\\`local_id\\`);--> statement-breakpoint\nCREATE TABLE \\`versions\\` (\n\t\\`local_id\\` text,\n\t\\`uid\\` text,\n\t\\`seed_local_id\\` text,\n\t\\`seed_uid\\` text,\n\t\\`seed_type\\` text,\n\t\\`note\\` text,\n\t\\`created_at\\` integer,\n\t\\`updated_at\\` integer,\n\t\\`attestation_created_at\\` integer,\n\t\\`attestation_raw\\` text\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX \\`versions_local_id_unique\\` ON \\`versions\\` (\\`local_id\\`);`\n\nexport const migrationSql_0001_sweet_bruce_banner = `ALTER TABLE \\`schemas\\` ADD \\`schema_data\\` text;--> statement-breakpoint\nALTER TABLE \\`schemas\\` ADD \\`is_draft\\` integer;`\n\nexport const migrationSql_0002_bitter_proudstar = `CREATE UNIQUE INDEX \\`unique_schema_file_id\\` ON \\`models\\` (\\`schema_file_id\\`);--> statement-breakpoint\nCREATE UNIQUE INDEX \\`unique_property_schema_file_id\\` ON \\`properties\\` (\\`schema_file_id\\`);--> statement-breakpoint\nCREATE UNIQUE INDEX \\`unique_schema_schema_file_id\\` ON \\`schemas\\` (\\`schema_file_id\\`);`\n\nexport const migrationSql_0003_cultured_senator_kelly = `ALTER TABLE \\`models\\` ADD \\`is_edited\\` integer;--> statement-breakpoint\nALTER TABLE \\`properties\\` ADD \\`is_edited\\` integer;--> statement-breakpoint\nALTER TABLE \\`schemas\\` ADD \\`is_edited\\` integer;`\n\n// Journal JSON file\nexport const journalJson = `{\n \"version\": \"7\",\n \"dialect\": \"sqlite\",\n \"entries\": [\n {\n \"idx\": 0,\n \"version\": \"6\",\n \"when\": 1765976502903,\n \"tag\": \"0000_married_malice\",\n \"breakpoints\": true\n },\n {\n \"idx\": 1,\n \"version\": \"6\",\n \"when\": 1766010851770,\n \"tag\": \"0001_sweet_bruce_banner\",\n \"breakpoints\": true\n },\n {\n \"idx\": 2,\n \"version\": \"6\",\n \"when\": 1767621120087,\n \"tag\": \"0002_bitter_proudstar\",\n \"breakpoints\": true\n },\n {\n \"idx\": 3,\n \"version\": \"6\",\n \"when\": 1768415440282,\n \"tag\": \"0003_cultured_senator_kelly\",\n \"breakpoints\": true\n }\n ]\n}`\n\n// Snapshot JSON file - this is large, so we'll import it dynamically if needed\n// For now, we'll read it from the actual file if ?raw works, otherwise we'll need to embed it\nexport const snapshotJson = `{\n \"version\": \"6\",\n \"dialect\": \"sqlite\",\n \"id\": \"0e6a6a99-2eb1-4b1d-815b-3d45dcae04a1\",\n \"prevId\": \"49b9a020-1b1c-4107-85ee-a5f8a958f1a2\",\n \"tables\": {\n \"appState\": {\n \"name\": \"appState\",\n \"columns\": {\n \"key\": {\n \"name\": \"key\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"value\": {\n \"name\": \"value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"appState_key_unique\": {\n \"name\": \"appState_key_unique\",\n \"columns\": [\n \"key\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"config\": {\n \"name\": \"config\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"key\": {\n \"name\": \"key\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"text\": {\n \"name\": \"text\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"json\": {\n \"name\": \"json\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"blob\": {\n \"name\": \"blob\",\n \"type\": \"blob\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"metadata\": {\n \"name\": \"metadata\",\n \"columns\": {\n \"local_id\": {\n \"name\": \"local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"property_name\": {\n \"name\": \"property_name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"property_value\": {\n \"name\": \"property_value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_uid\": {\n \"name\": \"schema_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"model_type\": {\n \"name\": \"model_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_local_id\": {\n \"name\": \"seed_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_uid\": {\n \"name\": \"seed_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"version_local_id\": {\n \"name\": \"version_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"version_uid\": {\n \"name\": \"version_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"eas_data_type\": {\n \"name\": \"eas_data_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_value_type\": {\n \"name\": \"ref_value_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_schema_uid\": {\n \"name\": \"ref_schema_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_seed_type\": {\n \"name\": \"ref_seed_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_resolved_value\": {\n \"name\": \"ref_resolved_value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_resolved_display_value\": {\n \"name\": \"ref_resolved_display_value\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"local_storage_dir\": {\n \"name\": \"local_storage_dir\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_raw\": {\n \"name\": \"attestation_raw\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_created_at\": {\n \"name\": \"attestation_created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"content_hash\": {\n \"name\": \"content_hash\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"metadata_local_id_unique\": {\n \"name\": \"metadata_local_id_unique\",\n \"columns\": [\n \"local_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"models\": {\n \"name\": \"models\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"name\": {\n \"name\": \"name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"schema_file_id\": {\n \"name\": \"schema_file_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_edited\": {\n \"name\": \"is_edited\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"unique_schema_file_id\": {\n \"name\": \"unique_schema_file_id\",\n \"columns\": [\n \"schema_file_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"properties\": {\n \"name\": \"properties\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"name\": {\n \"name\": \"name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"data_type\": {\n \"name\": \"data_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"model_id\": {\n \"name\": \"model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"ref_model_id\": {\n \"name\": \"ref_model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"ref_value_type\": {\n \"name\": \"ref_value_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_file_id\": {\n \"name\": \"schema_file_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_edited\": {\n \"name\": \"is_edited\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"unique_name_model_id\": {\n \"name\": \"unique_name_model_id\",\n \"columns\": [\n \"name\",\n \"model_id\"\n ],\n \"isUnique\": true\n },\n \"unique_property_schema_file_id\": {\n \"name\": \"unique_property_schema_file_id\",\n \"columns\": [\n \"schema_file_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"properties_model_id_models_id_fk\": {\n \"name\": \"properties_model_id_models_id_fk\",\n \"tableFrom\": \"properties\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n },\n \"properties_ref_model_id_models_id_fk\": {\n \"name\": \"properties_ref_model_id_models_id_fk\",\n \"tableFrom\": \"properties\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"ref_model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"model_schemas\": {\n \"name\": \"model_schemas\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"model_id\": {\n \"name\": \"model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_id\": {\n \"name\": \"schema_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {},\n \"foreignKeys\": {\n \"model_schemas_model_id_models_id_fk\": {\n \"name\": \"model_schemas_model_id_models_id_fk\",\n \"tableFrom\": \"model_schemas\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n },\n \"model_schemas_schema_id_schemas_id_fk\": {\n \"name\": \"model_schemas_schema_id_schemas_id_fk\",\n \"tableFrom\": \"model_schemas\",\n \"tableTo\": \"schemas\",\n \"columnsFrom\": [\n \"schema_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"model_uids\": {\n \"name\": \"model_uids\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"model_id\": {\n \"name\": \"model_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"model_uids_model_id_unique\": {\n \"name\": \"model_uids_model_id_unique\",\n \"columns\": [\n \"model_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"model_uids_model_id_models_id_fk\": {\n \"name\": \"model_uids_model_id_models_id_fk\",\n \"tableFrom\": \"model_uids\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"model_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"property_uids\": {\n \"name\": \"property_uids\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"property_id\": {\n \"name\": \"property_id\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"property_uids_property_id_unique\": {\n \"name\": \"property_uids_property_id_unique\",\n \"columns\": [\n \"property_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {\n \"property_uids_property_id_models_id_fk\": {\n \"name\": \"property_uids_property_id_models_id_fk\",\n \"tableFrom\": \"property_uids\",\n \"tableTo\": \"models\",\n \"columnsFrom\": [\n \"property_id\"\n ],\n \"columnsTo\": [\n \"id\"\n ],\n \"onDelete\": \"no action\",\n \"onUpdate\": \"no action\"\n }\n },\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"schemas\": {\n \"name\": \"schemas\",\n \"columns\": {\n \"id\": {\n \"name\": \"id\",\n \"type\": \"integer\",\n \"primaryKey\": true,\n \"notNull\": true,\n \"autoincrement\": true\n },\n \"name\": {\n \"name\": \"name\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"version\": {\n \"name\": \"version\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": true,\n \"autoincrement\": false\n },\n \"schema_file_id\": {\n \"name\": \"schema_file_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_data\": {\n \"name\": \"schema_data\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_draft\": {\n \"name\": \"is_draft\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"is_edited\": {\n \"name\": \"is_edited\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"unique_schema_schema_file_id\": {\n \"name\": \"unique_schema_schema_file_id\",\n \"columns\": [\n \"schema_file_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"seeds\": {\n \"name\": \"seeds\",\n \"columns\": {\n \"local_id\": {\n \"name\": \"local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"schema_uid\": {\n \"name\": \"schema_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"type\": {\n \"name\": \"type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_raw\": {\n \"name\": \"attestation_raw\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_created_at\": {\n \"name\": \"attestation_created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"_marked_for_deletion\": {\n \"name\": \"_marked_for_deletion\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"seeds_local_id_unique\": {\n \"name\": \"seeds_local_id_unique\",\n \"columns\": [\n \"local_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n },\n \"versions\": {\n \"name\": \"versions\",\n \"columns\": {\n \"local_id\": {\n \"name\": \"local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"uid\": {\n \"name\": \"uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_local_id\": {\n \"name\": \"seed_local_id\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_uid\": {\n \"name\": \"seed_uid\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"seed_type\": {\n \"name\": \"seed_type\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"note\": {\n \"name\": \"note\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"created_at\": {\n \"name\": \"created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"updated_at\": {\n \"name\": \"updated_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_created_at\": {\n \"name\": \"attestation_created_at\",\n \"type\": \"integer\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n },\n \"attestation_raw\": {\n \"name\": \"attestation_raw\",\n \"type\": \"text\",\n \"primaryKey\": false,\n \"notNull\": false,\n \"autoincrement\": false\n }\n },\n \"indexes\": {\n \"versions_local_id_unique\": {\n \"name\": \"versions_local_id_unique\",\n \"columns\": [\n \"local_id\"\n ],\n \"isUnique\": true\n }\n },\n \"foreignKeys\": {},\n \"compositePrimaryKeys\": {},\n \"uniqueConstraints\": {},\n \"checkConstraints\": {}\n }\n },\n \"views\": {},\n \"enums\": {},\n \"_meta\": {\n \"schemas\": {},\n \"tables\": {},\n \"columns\": {}\n },\n \"internal\": {\n \"indexes\": {}\n }\n}`\n","import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces/IDb\";\nimport debug from \"debug\";\nimport { sql } from \"drizzle-orm\";\nimport { readMigrationFiles } from \"drizzle-orm/migrator\";\nimport { drizzle, SqliteRemoteDatabase } from \"drizzle-orm/sqlite-proxy\";\nimport { migrate as drizzleMigrate } from \"drizzle-orm/sqlite-proxy/migrator\";\nimport { BROWSER_FS_TOP_DIR } from \"@/client/constants\";\nimport { BaseFileManager } from \"@/helpers\";\nimport * as schema from '@/seedSchema'\n// @ts-ignore - sqlocal/drizzle types may not be available during build\nimport { SQLocalDrizzle } from 'sqlocal/drizzle'\nimport {} from 'sqlocal'\nimport * as drizzleFiles from './drizzleFiles'\nimport { journalJson, snapshotJson } from './drizzleFiles'\nimport { Observable, distinctUntilChanged } from 'rxjs'\n\nconst logger = debug('seedSdk:browser:db:Db')\n\n\nclass Db extends BaseDb implements IDb {\n\n static sqliteWasmClient: any\n static filesDir: string | undefined\n static pathToDb: string | undefined\n static dbId: string | undefined\n static appDb: SqliteRemoteDatabase<Record<string, unknown>> | undefined\n static sqlocalInstance: SQLocalDrizzle | undefined\n\n constructor() {\n super()\n }\n\n static getAppDb() {\n return this.appDb\n }\n\n static isAppDbReady() {\n return !!this.appDb\n }\n\n static async prepareDb(filesDir: string) {\n\n logger('[Db.prepareDb] preparing database')\n\n this.filesDir = filesDir\n\n try {\n // Copy drizzle migration files from src/db/drizzle to filesDir/db\n await this.copyDrizzleFiles(filesDir)\n\n // Ensure meta directory exists\n const metaDirPath = `${filesDir}/db/meta`\n await BaseFileManager.createDirIfNotExists(metaDirPath)\n\n // Ensure _journal.json file exists in meta directory\n const journalFilePath = `${metaDirPath}/_journal.json`\n const journalExists = await BaseFileManager.pathExists(journalFilePath)\n if (!journalExists) {\n await BaseFileManager.saveFile(journalFilePath, JSON.stringify({\n version: 1,\n dialect: 'sqlite',\n entries: [],\n }, null, 2))\n }\n\n // Wait for journal file to be fully written before proceeding with migration\n // This is critical in browser/OPFS where writes may not be immediately readable\n logger('[Db.prepareDb] waiting for journal file to be fully written...')\n await BaseFileManager.waitForFileWithContent(journalFilePath, 100, 5000)\n logger('[Db.prepareDb] journal file is ready')\n\n // Initialize SQLocalDrizzle with reactive: true to enable reactive queries\n const sqlocalDrizzle = new SQLocalDrizzle({\n databasePath: `${this.filesDir}/db/seed.db`,\n reactive: true // Enable reactive queries\n })\n \n const { driver, batchDriver } = sqlocalDrizzle\n \n // Store SQLocalDrizzle instance for reactive queries\n this.sqlocalInstance = sqlocalDrizzle\n\n this.appDb = drizzle(\n driver, \n batchDriver, \n { \n schema, \n })\n\n logger('[Db.prepareDb] database prepared')\n\n await this.migrate()\n\n return this.appDb\n } catch (error) {\n logger('[Db.prepareDb] error', JSON.stringify(error))\n throw error\n }\n }\n\n // static async prepareDb(filesDir: string) {\n // console.log('prepareDb', filesDir)\n // if (Db.sqliteWasmClient) {\n // return this.dbId\n // }\n\n // this.filesDir = filesDir\n // this.pathToDb = `${filesDir}/db/${DB_NAME_APP}.db`\n\n // if (typeof document === 'undefined') {\n // return\n // }\n\n // let promiser\n\n // try {\n\n // let sqlite3Worker1Promiser\n\n // const sqliteWasm = await import('@sqlite.org/sqlite-wasm')\n\n // if (sqliteWasm && sqliteWasm.sqlite3Worker1Promiser) {\n // sqlite3Worker1Promiser = sqliteWasm.sqlite3Worker1Promiser\n // }\n\n // if (!sqlite3Worker1Promiser && window.sqlite3Worker1Promiser) {\n // sqlite3Worker1Promiser = window.sqlite3Worker1Promiser\n // }\n\n // if (!sqlite3Worker1Promiser) {\n // throw new Error('Failed to load sqlite3Worker1Promiser')\n // }\n\n // promiser = await new Promise<(event: string, config: Record<string, unknown>) => Promise<any>>((resolve) => {\n // const _promiser = sqlite3Worker1Promiser({\n // onready: () => {\n // resolve(_promiser);\n // },\n // });\n // }).catch((error) => {\n // console.error('Error from sqlite proxy server: ', JSON.stringify(error))\n // });\n\n // } catch ( e ) {\n // console.error('Error from sqlite proxy server: ', JSON.stringify(e))\n // }\n\n\n // if (!promiser) {\n // throw new Error('Failed to create promiser')\n // }\n\n // this.sqliteWasmClient = promiser\n\n // const responseGet = await this.sqliteWasmClient('config-get', {});\n\n // logger('[Db.prepareDb] Running SQLite3 version', responseGet.result.version.libVersion);\n\n // const responseOpen = await this.sqliteWasmClient('open', {\n // filename: `file:${filesDir}/db/${DB_NAME_APP}.db?vfs=opfs`,\n // });\n // const { dbId } = responseOpen;\n // logger(\n // '[Db.prepareDb] OPFS is available, created persisted database at',\n // responseOpen.result.filename.replace(/^file:(.*?)\\?vfs=opfs/, '$1'),\n // );\n\n // logger('[Db.prepareDb] dbId', dbId)\n \n // this.dbId = dbId\n \n // await this.migrate()\n // }\n\n static async connectToDb(filesDir: string,): Promise<string | undefined> {\n\n\n\n return this.dbId\n }\n\n static async copyDrizzleFiles(filesDir: string): Promise<void> {\n logger('[Db.copyDrizzleFiles] copying drizzle migration files')\n\n try {\n // Ensure db directory exists\n const dbDirPath = `${filesDir}/db`\n await BaseFileManager.createDirIfNotExists(dbDirPath)\n\n // Ensure meta directory exists\n const metaDirPath = `${dbDirPath}/meta`\n await BaseFileManager.createDirIfNotExists(metaDirPath)\n\n // Parse journal JSON to get all migration entries\n const journal = JSON.parse(journalJson)\n const entries = journal.entries || []\n\n if (entries.length === 0) {\n logger('[Db.copyDrizzleFiles] no migration entries found in journal')\n return\n }\n\n // Copy each migration SQL file (always overwrite to ensure they're up-to-date)\n // Each migration is exported as a separate variable (e.g., migrationSql_0000_married_malice)\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i]\n const tag = entry.tag // e.g., \"0000_married_malice\"\n const migrationFileName = `${tag}.sql`\n const migrationPath = `${dbDirPath}/${migrationFileName}`\n \n // Get the SQL for this migration from the exported variable\n const migrationVarName = `migrationSql_${tag}` as keyof typeof drizzleFiles\n const migrationContent = drizzleFiles[migrationVarName] as string | undefined\n \n if (!migrationContent) {\n logger(`[Db.copyDrizzleFiles] ERROR: No migration content found for ${migrationFileName} (variable: ${migrationVarName})`)\n throw new Error(`No migration content found for ${migrationFileName}. Expected variable: ${migrationVarName}`)\n }\n \n await BaseFileManager.saveFile(migrationPath, migrationContent.trim())\n logger(`[Db.copyDrizzleFiles] copied/updated migration SQL file: ${migrationFileName}`)\n }\n\n // Copy journal JSON file (always overwrite to ensure it's up-to-date with all migrations)\n const journalPath = `${metaDirPath}/_journal.json`\n await BaseFileManager.saveFile(journalPath, journalJson)\n logger('[Db.copyDrizzleFiles] copied/updated journal JSON file')\n\n // Copy snapshot JSON file (use the latest snapshot based on the highest idx in journal)\n // Snapshot files are named like: 0000_snapshot.json, 0001_snapshot.json, etc.\n // The tag format is like \"0000_married_malice\", so we extract the numeric prefix\n const latestEntry = entries[entries.length - 1]\n const tagPrefixMatch = latestEntry.tag.match(/^(\\d+_)/)\n const tagPrefix = tagPrefixMatch ? tagPrefixMatch[1] : '0000_'\n const snapshotFileName = `${tagPrefix}snapshot.json`\n const snapshotPath = `${metaDirPath}/${snapshotFileName}`\n // Always overwrite snapshot to ensure it's up-to-date\n await BaseFileManager.saveFile(snapshotPath, snapshotJson)\n logger(`[Db.copyDrizzleFiles] copied/updated snapshot JSON file: ${snapshotFileName}`)\n\n logger('[Db.copyDrizzleFiles] drizzle files copied successfully')\n } catch (error) {\n logger('[Db.copyDrizzleFiles] error copying drizzle files', error)\n // Don't throw - the files might already exist or migration might work without them\n // The migration will fail later if the files are truly needed\n }\n }\n\n static async migrate(): Promise<void> {\n\n if (!this.appDb) {\n throw new Error('Database not prepared')\n }\n\n const pathToDbDir = `${this.filesDir}/db`\n\n try {\n\n logger('[Db.migrate] calling readMigrationFiles')\n \n const migrations = readMigrationFiles({\n migrationsFolder: pathToDbDir,\n })\n\n logger('[Db.migrate] migrations', migrations)\n \n await drizzleMigrate(\n this.appDb,\n async (queriesToRun) => {\n logger('queriesToRun', queriesToRun)\n for (const query of queriesToRun) {\n logger('query', query)\n await this.appDb?.run(sql.raw(query))\n }\n },\n {\n migrationsFolder: pathToDbDir,\n },\n )\n\n logger('[Db.migrate] migrations completed')\n \n } catch (error) {\n logger('[Db.migrate] error', JSON.stringify(error))\n throw error\n }\n \n\n }\n\n // static async migrate(): Promise<void> {\n\n // const schemaGlobString = `${BROWSER_FS_TOP_DIR}/schema/*`\n // const pathToDbDir = `${this.filesDir}/db`\n // const dbName = DB_NAME_APP\n\n // logger('[Db.migrate] running migrations')\n\n // const drizzleDb = drizzle(\n // async (sql, params,) => {\n // try {\n // logger(\n // `executing sql`,\n // sql,\n // )\n\n // const finalResult = await this.exec(sql, params)\n\n // // logger(`finalResult with method: ${method}`, finalResult)\n // // Drizzle always waits for {rows: string[][]} or {rows: string[]} for the return value.\n\n // // When the method is get, you should return a value as {rows: string[]}.\n // // Otherwise, you should return {rows: string[][]}.\n\n // return { rows: finalResult }\n // } catch (e: any) {\n // console.error('Error from sqlite proxy server: ', JSON.stringify(e))\n // return { rows: [] }\n // }\n // },\n // {\n // schema,\n // // logger: true,\n // },\n // )\n\n // try {\n // const zenfs = await BaseFileManager.getFs()\n\n // logger('[Db.migrate] calling readMigrationFiles')\n\n // const migrations = readMigrationFiles({\n // migrationsFolder: pathToDbDir,\n // })\n\n // logger('[Db.migrate] migrations', migrations)\n\n // if (migrations.length > 0) {\n // const incomingMigrationHashes = migrations.map(\n // (migration) => migration.hash,\n // )\n\n // let existingMigrationHashes\n // let rows = []\n\n // try {\n\n // const queryMigrationsTable = await drizzleDb.run(\n // sql.raw(\n // `SELECT name \n // FROM sqlite_master \n // WHERE type='table' \n // AND name='__drizzle_migrations';`,\n // ),\n // )\n\n // logger('queryMigrationsTable', queryMigrationsTable)\n\n // if (queryMigrationsTable && queryMigrationsTable.rows && queryMigrationsTable.rows.length > 0) {\n // const query = await drizzleDb.run(\n // sql.raw(\n // `SELECT hash, created_at\n // FROM main.__drizzle_migrations;`,\n // ),\n // )\n \n // rows = query.rows\n // }\n\n // } catch (e) {\n // rows = []\n // }\n\n // if (rows && rows.length > 0) {\n // existingMigrationHashes = rows.map((row) => row[0])\n // }\n\n // if (existingMigrationHashes) {\n // let shouldRebuildDb = false\n // for (const existingHash of existingMigrationHashes) {\n // if (!incomingMigrationHashes.includes(existingHash)) {\n // shouldRebuildDb = true\n // break\n // }\n // }\n // if (shouldRebuildDb) {\n // await zenfs.promises.unlink(`${pathToDbDir}/${dbName}.db`)\n // }\n // }\n // }\n\n // logger('[Db.migrate] running migrations')\n\n // await drizzleMigrate(\n // drizzleDb,\n // async (queriesToRun) => {\n // // logger('queriesToRun', queriesToRun)\n // for (const query of queriesToRun) {\n // // logger('query', query)\n // await drizzleDb.run(sql.raw(query))\n // }\n // },\n // {\n // migrationsFolder: pathToDbDir,\n // },\n // )\n // } catch (error) {\n // logger('[Db.migrate] error', JSON.stringify(error))\n // // await BaseFileManager.waitForFile(`${pathToDbDir}/meta/_journal.json`)\n\n // // const journalExists = await BaseFileManager.pathExists(\n // // `${pathToDbDir}/meta/_journal.json`,\n // // )\n\n // // if (journalExists) {\n // // await this.migrate(pathToDbDir, dbName,)\n // // }\n\n // // if (!journalExists) {\n // // throw new Error('Failed to migrate database')\n // // }\n\n\n // }\n\n // this.appDb = drizzleDb\n\n // // Old code for migrating the database\n // // const createTempTableQuery = await appDb.run(\n // // sql.raw(\n // // `CREATE TEMP TABLE IF NOT EXISTS temp_last_inserted_id (id INTEGER, table TEXT);`,\n // // ),\n // // )\n // //\n // // logger(\n // // '[db/actors] [migrate] createTempTableQuery',\n // // createTempTableQuery,\n // // )\n\n // // const triggersQuery = await appDb.run(\n // // sql.raw(\n // // `SELECT name\n // // FROM main.sqlite_master\n // // WHERE type = 'trigger';`,\n // // ),\n // // )\n // //\n // // logger('[db/actors] [migrate] triggersQuery', triggersQuery)\n // //\n // // const triggers = triggersQuery.rows.map((row) => row[0])\n // //\n // // const tablesQuery = await appDb.run(\n // // sql.raw(\n // // `SELECT name\n // // FROM main.sqlite_master\n // // WHERE type = 'table';`,\n // // ),\n // // )\n // //\n // // logger('[db/actors] [migrate] tablesQuery', tablesQuery)\n // //\n // // const tableNames = tablesQuery.rows.map((row) => row[0])\n // // logger('[db/actors] [migrate] tableNames', tableNames)\n // // for (const tableName of tableNames) {\n // // const triggerName = `after_insert_${tableName}`\n // // if (triggers.includes(triggerName)) {\n // // continue\n // // }\n // // const createTriggerQuery = await appDb.run(\n // // sql.raw(\n // // `CREATE TRIGGER after_insert_${tableName}\n // // AFTER INSERT ON ${tableName}\n // // BEGIN\n // // DELETE FROM temp_last_inserted_id;\n // // INSERT INTO temp_last_inserted_id (id) VALUES (new.id);\n // // END;`,\n // // ),\n // // )\n // //\n // // logger(\n // // '[db/actors] [migrate] createTriggerQuery',\n // // createTriggerQuery,\n // // )\n // // }\n // }\n\n // static async exec(sql: string, params: any[]) {\n // const rowsToReturnRaw: SqliteWasmResult[] = []\n // const rowsValues: string[][] = []\n \n // // For a single exec command, the callback potentially gets called several times -- once for each row.\n // // So we need to collect all rows into a final array to return (execResult).\n // const rowsToReturn = await new Promise((resolve, reject) => {\n\n\n // this.sqliteWasmClient('exec', {\n // dbId:this.dbId,\n // sql,\n // bind: params,\n // callback: (result) => {\n // // Checks if this is the final callback of the query\n // if (!result || !result.row || !result.rowNumber) {\n // const returnResult = []\n // for (const currRow of rowsToReturnRaw) {\n // returnResult.push(currRow.row)\n // }\n // resolve(returnResult)\n // } else {\n // // If not the final response, add this row to the return array\n // rowsToReturnRaw.push(result)\n // }\n // },\n // }).catch(async (error) => {\n // reject(error)\n // })\n // })\n \n // return rowsToReturn || []\n // }\n\n /**\n * Execute a reactive query that emits new results whenever the underlying data changes.\n * \n * Supports two usage patterns:\n * 1. SQL tag function: liveQuery((sql) => sql`SELECT * FROM models`)\n * 2. Drizzle query builder: liveQuery(db.select().from(models))\n * \n * @param query - SQL query function or Drizzle query builder\n * @returns Observable that emits arrays of query results\n * \n * @example\n * ```typescript\n * // Using SQL tag function\n * const models$ = Db.liveQuery<ModelRow>(\n * (sql) => sql`SELECT * FROM models WHERE schema_file_id = ${schemaId}`\n * )\n * \n * // Using Drizzle query builder\n * const models$ = Db.liveQuery<ModelRow>(\n * appDb.select().from(models).where(eq(models.schemaFileId, schemaId))\n * )\n * \n * models$.subscribe(models => {\n * console.log('Models updated:', models)\n * })\n * ```\n */\n static liveQuery<T>(\n query: ((sql: any) => any) | any\n ): Observable<T[]> {\n if (!this.sqlocalInstance) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n \n if (!this.sqlocalInstance.reactiveQuery) {\n throw new Error('Reactive queries not enabled. Initialize SQLocalDrizzle with reactive: true.')\n }\n\n const baseObservable = new Observable<T[]>((subscriber) => {\n // Call SQLocal's reactiveQuery\n const reactiveQueryResult = this.sqlocalInstance!.reactiveQuery(query)\n \n // Subscribe to SQLocal's subscription API\n const subscription = reactiveQueryResult.subscribe(\n (data: Record<string, any>[]) => {\n // Emit data through RxJS Observable (cast to T[] since SQLocal returns Record<string, any>[])\n subscriber.next(data as T[])\n },\n (err: Error) => {\n console.error('[BaseDb.liveQuery] SQLocal reactiveQuery error:', err)\n // Emit error through RxJS Observable\n subscriber.error(err)\n }\n )\n \n // Cleanup: unsubscribe when Observable is unsubscribed\n return () => {\n subscription.unsubscribe()\n }\n })\n \n // Use distinctUntilChanged with JSON.stringify comparison\n // The comparator returns true if values are the same (skip emission)\n return baseObservable.pipe(\n distinctUntilChanged((prev, curr) => {\n // On first emission, prev will be undefined, so we always emit\n if (prev === undefined) {\n return false // false = different, so emit\n }\n \n // Compare using JSON.stringify\n try {\n const prevJson = JSON.stringify(prev)\n const currJson = JSON.stringify(curr)\n // Return true if same (skip), false if different (emit)\n return prevJson === currJson\n } catch (error) {\n // If JSON.stringify fails, fall back to reference equality\n console.warn('[BaseDb.liveQuery] distinctUntilChanged: JSON.stringify failed, using reference equality', error)\n return prev === curr\n }\n })\n )\n }\n}\n\nexport { Db }\n"],"names":["drizzleMigrate"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AACO,MAAM,gCAAgC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAwHiC;AAE1E,MAAM,oCAAoC,GAAG,CAAA;kDACF;AAE3C,MAAM,kCAAkC,GAAG,CAAA;;0FAEwC;AAEnF,MAAM,wCAAwC,GAAG,CAAA;;mDAEL;AAEnD;AACO,MAAM,WAAW,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCzB;AAEF;AACA;AACO,MAAM,YAAY,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AK,QAAQ;YAC9B;YAAE,OAAO,KAAK,EAAE;;AAEd,gBAAA,OAAO,CAAC,IAAI,CAAC,0FAA0F,EAAE,KAAK,CAAC;gBAC/G,OAAO,IAAI,KAAK,IAAI;YACtB;QACF,CAAC,CAAC,CACH;IACH;AACD;;;;"}
|
package/dist/Db-DjofXdeU.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Db-DjofXdeU.js","sources":["../src/node/db/Db.ts"],"sourcesContent":["import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces\";\nimport path from \"path\";\nimport { DrizzleConfig, } from \"drizzle-orm\";\nimport debug from 'debug'\nimport { appState } from '@/seedSchema'\nimport fs from 'fs'\nimport { createClient } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { pushSQLiteSchema } from 'drizzle-kit/api'\nimport * as schema from '@/seedSchema'\nimport { Observable, interval, switchMap, distinctUntilChanged, startWith } from 'rxjs'\n\nconst logger = debug('seedSdk:node:db:Db')\n\nexport interface DbConfig {\n dbUrl?: string\n schemaDir?: string\n outDir?: string\n}\n\nconst getConfig = async (dotSeedDir: string, config?: DbConfig) => {\n // Create config inline - config values can be passed in or use defaults\n const { defineConfig } = await import('drizzle-kit')\n const appSchemaDir = config?.schemaDir || path.join(dotSeedDir, 'schema')\n const outDir = config?.outDir || `${dotSeedDir}/db`\n const dbUrl = config?.dbUrl || `${dotSeedDir}/db/seed.db`\n\n const nodeDbConfig = defineConfig({\n schema: appSchemaDir,\n dialect: 'sqlite',\n out: outDir,\n dbCredentials: {\n url: dbUrl,\n }\n }) as DrizzleConfig & { dbCredentials: { url: string } }\n\n return nodeDbConfig\n}\n\nclass Db extends BaseDb implements IDb {\n static db: any\n\n constructor() {\n super()\n }\n\n static getAppDb() {\n return this.db\n }\n\n static isAppDbReady() {\n return true\n }\n\n static async prepareDb(filesDir: string, config?: DbConfig) {\n // Resolve and normalize the filesDir path\n const resolvedFilesDir = path.resolve(filesDir)\n \n // Ensure the filesDir exists first (parent directory)\n if (!fs.existsSync(resolvedFilesDir)) {\n fs.mkdirSync(resolvedFilesDir, { recursive: true })\n }\n \n const nodeDbConfig = await getConfig(resolvedFilesDir, config)\n const dbPath = nodeDbConfig.dbCredentials?.url || path.join(resolvedFilesDir, 'db', 'seed.db')\n\n // Ensure the database directory exists\n const dbDir = path.dirname(dbPath)\n const dbDirExists = fs.existsSync(dbDir)\n if (!dbDirExists) {\n fs.mkdirSync(dbDir, { recursive: true })\n }\n \n // Use the dbUrl from config if provided, otherwise construct from filesDir\n const dbUrl = config?.dbUrl \n ? (config.dbUrl.startsWith('file:') ? config.dbUrl : `file:${path.resolve(config.dbUrl)}`)\n : `file:${path.resolve(dbPath)}`\n const client = createClient({ url: dbUrl })\n \n const db = drizzle(client, {schema})\n \n const { apply, hasDataLoss, warnings, statementsToExecute } = await pushSQLiteSchema(schema, db);\n \n // You can inspect what will happen before applying\n await apply();\n\n this.db = db\n\n // OLD CODE: Resolve better-sqlite3 from project's node_modules first, then fall back to SDK's node_modules\n // This is important for tests and when the SDK is used as a dependency\n // const projectDir = path.dirname(filesDir) // filesDir is .seed, so projectDir is the project root\n // const projectBetterSqlite3Path = path.join(projectDir, 'node_modules', 'better-sqlite3')\n // \n // let Database: any\n // try {\n // const fs = await import('fs')\n // if (fs.existsSync(projectBetterSqlite3Path)) {\n // // Try to resolve from project's node_modules using the full path\n // // For Bun, we can try importing directly from the path\n // try {\n // // First try using createRequire (works in Node.js)\n // const { createRequire } = await import('module')\n // const projectRequire = createRequire(path.join(projectDir, 'package.json'))\n // const betterSqlite3Module = projectRequire('better-sqlite3')\n // Database = betterSqlite3Module.default || betterSqlite3Module\n // logger('[node/db/Db] Using better-sqlite3 from project node_modules via createRequire')\n // } catch (requireError: any) {\n // // If createRequire fails (e.g., in Bun), try direct path import\n // logger('[node/db/Db] createRequire failed, trying direct import:', requireError.message)\n // const betterSqlite3MainPath = path.join(projectBetterSqlite3Path, 'lib', 'database.js')\n // if (fs.existsSync(betterSqlite3MainPath)) {\n // // Use dynamic import with the full path\n // const betterSqlite3Module = await import(betterSqlite3MainPath)\n // Database = betterSqlite3Module.default || betterSqlite3Module.Database || betterSqlite3Module\n // logger('[node/db/Db] Using better-sqlite3 from project node_modules via direct import')\n // } else {\n // throw new Error(`better-sqlite3 main file not found at ${betterSqlite3MainPath}`)\n // }\n // }\n // } else {\n // // Fall back to regular import (from SDK's node_modules)\n // const betterSqlite3Module = await import('better-sqlite3')\n // Database = betterSqlite3Module.default || betterSqlite3Module\n // logger('[node/db/Db] Using better-sqlite3 from SDK node_modules')\n // }\n // } catch (importError: any) {\n // logger('[node/db/Db] Error importing better-sqlite3:', importError.message)\n // logger('[node/db/Db] projectDir:', projectDir)\n // logger('[node/db/Db] projectBetterSqlite3Path:', projectBetterSqlite3Path)\n // throw new Error(`Failed to import better-sqlite3: ${importError.message}. Please install better-sqlite3 in your project.`)\n // }\n\n // OLD CODE: Create Database instance\n // const sqlite = new Database(dbPath)\n // \n // OLD CODE: Create drizzle instance with the Database\n // const {drizzle} = await import('drizzle-orm/better-sqlite3')\n // this.db = drizzle(sqlite, {\n // logger: true,\n // })\n\n // // NEW CODE: Use libsql instead of better-sqlite3\n // // Resolve @libsql/client from project's node_modules first, then fall back to SDK's node_modules\n // const projectDir = path.dirname(filesDir) // filesDir is .seed, so projectDir is the project root\n // const projectLibsqlClientPath = path.join(projectDir, 'node_modules', '@libsql', 'client')\n \n // let createClient: any\n // try {\n // const fs = await import('fs')\n // if (fs.existsSync(projectLibsqlClientPath)) {\n // // Try to resolve from project's node_modules using the full path\n // try {\n // // First try using createRequire (works in Node.js)\n // const { createRequire } = await import('module')\n // const projectRequire = createRequire(path.join(projectDir, 'package.json'))\n // const libsqlClientModule = projectRequire('@libsql/client')\n // createClient = libsqlClientModule.createClient || libsqlClientModule.default?.createClient || libsqlClientModule.default\n // logger('[node/db/Db] Using @libsql/client from project node_modules via createRequire')\n // } catch (requireError: any) {\n // // If createRequire fails, try direct import\n // logger('[node/db/Db] createRequire failed, trying direct import:', requireError.message)\n // const libsqlClientModule = await import('@libsql/client')\n // createClient = libsqlClientModule.createClient\n // logger('[node/db/Db] Using @libsql/client from project node_modules via direct import')\n // }\n // } else {\n // // Fall back to regular import (from SDK's node_modules)\n // const libsqlClientModule = await import('@libsql/client')\n // createClient = libsqlClientModule.createClient\n // logger('[node/db/Db] Using @libsql/client from SDK node_modules')\n // }\n // } catch (importError: any) {\n // logger('[node/db/Db] Error importing @libsql/client:', importError.message)\n // logger('[node/db/Db] projectDir:', projectDir)\n // logger('[node/db/Db] projectLibsqlClientPath:', projectLibsqlClientPath)\n // throw new Error(`Failed to import @libsql/client: ${importError.message}. Please install @libsql/client in your project.`)\n // }\n\n // // Convert file path to file: URL for libsql\n // // If dbPath is already a file: URL, use it as is, otherwise convert it\n // const dbUrl = dbPath.startsWith('file:') ? dbPath : `file:${path.resolve(dbPath)}`\n \n // // Create libsql client instance\n // const client = createClient({ url: dbUrl })\n \n // // Create drizzle instance with the libsql client\n // const {drizzle} = await import('drizzle-orm/libsql')\n // this.db = drizzle(client, {\n // logger: true,\n // })\n\n // if (!this.db) {\n // throw new Error('Db not found')\n // }\n\n return this.db\n }\n\n static async connectToDb(pathToDir: string,) {\n\n return {\n id: this.db ? this.db.constructor.name : ''\n }\n }\n\n static async migrate(pathToDbDir: string, dbName: string, dbId: string) {\n const fs = await import('fs')\n const path = await import('path')\n \n // Ensure meta directory and _journal.json exist\n const metaDir = path.join(pathToDbDir, 'meta')\n const journalPath = path.join(metaDir, '_journal.json')\n \n try {\n if (!fs.existsSync(metaDir)) {\n fs.mkdirSync(metaDir, { recursive: true })\n }\n \n // Create a minimal _journal.json if it doesn't exist\n if (!fs.existsSync(journalPath)) {\n const minimalJournal = {\n version: \"7\",\n dialect: \"sqlite\",\n entries: []\n }\n fs.writeFileSync(journalPath, JSON.stringify(minimalJournal, null, 2))\n logger('Created minimal _journal.json file')\n } else {\n // Verify the journal file is valid JSON\n try {\n const journalContent = fs.readFileSync(journalPath, 'utf-8')\n const journal = JSON.parse(journalContent)\n if (!journal.dialect || !journal.version) {\n // Fix invalid journal\n const fixedJournal = {\n version: journal.version || \"7\",\n dialect: journal.dialect || \"sqlite\",\n entries: journal.entries || []\n }\n fs.writeFileSync(journalPath, JSON.stringify(fixedJournal, null, 2))\n logger('Fixed invalid _journal.json file')\n }\n } catch (parseError) {\n // If journal is invalid, recreate it\n const minimalJournal = {\n version: \"7\",\n dialect: \"sqlite\",\n entries: []\n }\n fs.writeFileSync(journalPath, JSON.stringify(minimalJournal, null, 2))\n logger('Recreated corrupted _journal.json file')\n }\n }\n } catch (error: any) {\n logger('Warning: Could not create meta/_journal.json:', error.message)\n // Continue anyway - the migrator might handle it\n }\n \n try {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n \n // OLD CODE: const {migrate} = await import('drizzle-orm/better-sqlite3/migrator')\n // migrationsFolder should point to the directory containing migration SQL files\n // In drizzle-kit, migrations are generated in the 'out' directory (which is pathToDbDir)\n // migrate(this.db, { migrationsFolder: pathToDbDir })\n \n // NEW CODE: Use libsql migrator\n const {migrate} = await import('drizzle-orm/libsql/migrator')\n // migrationsFolder should point to the directory containing migration SQL files\n // In drizzle-kit, migrations are generated in the 'out' directory (which is pathToDbDir)\n await migrate(this.db, { migrationsFolder: pathToDbDir })\n const queryResult = await this.db.select().from(appState)\n logger('queryResult', queryResult)\n } catch (error: any) {\n // Handle various migration errors gracefully in test environments\n const errorMessage = error.message || String(error) || ''\n const errorString = String(error)\n const isMigrationError = \n errorMessage.includes(\"Can't find meta/_journal.json\") || \n errorMessage.includes('_journal.json') ||\n errorMessage.includes(\"Cannot read properties of undefined\") ||\n errorMessage.includes(\"reading 'dialect'\") ||\n errorMessage.includes(\"undefined is not an object\") ||\n errorString.includes(\"dialect\") ||\n errorString.includes(\"undefined is not an object\")\n \n if (isMigrationError) {\n if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {\n logger('Warning: Migration failed, but continuing in test environment:', errorMessage || errorString)\n // Try to query the database anyway to see if it's usable\n try {\n if (this.db) {\n const queryResult = await this.db.select().from(appState)\n logger('Database is accessible despite migration error')\n return this.db\n }\n } catch (queryError) {\n logger('Database query also failed, but continuing in test environment')\n return this.db\n }\n }\n }\n throw error\n }\n\n return this.db\n }\n\n /**\n * Execute a reactive query that emits new results whenever the underlying data changes.\n * \n * NOTE: This is a stub implementation using polling. For production use, consider enhancing\n * with database triggers, change streams, or other real-time mechanisms.\n * \n * Currently supports Drizzle query builders. SQL tag functions are not supported in node\n * environment (use browser implementation for SQL tag functions).\n * \n * @param query - Drizzle query builder (SQL tag functions not supported in node)\n * @returns Observable that emits arrays of query results\n * \n * @example\n * ```typescript\n * import { models } from '@/seedSchema'\n * import { eq } from 'drizzle-orm'\n * \n * const appDb = Db.getAppDb()\n * const models$ = Db.liveQuery<ModelRow>(\n * appDb.select().from(models).where(eq(models.schemaFileId, schemaId))\n * )\n * \n * models$.subscribe(models => {\n * console.log('Models updated:', models)\n * })\n * ```\n */\n static liveQuery<T>(\n query: ((sql: any) => any) | any\n ): Observable<T[]> {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n \n // Polling interval (configurable, default: 1000ms)\n const pollInterval = 1000\n \n // Check if query is a function (SQL tag function) - not supported in node stub\n if (typeof query === 'function') {\n throw new Error('SQL tag functions are not supported in node liveQuery stub implementation. Use Drizzle query builders instead.')\n }\n \n // For Drizzle query builders, we need to execute them\n // Store the query builder for polling\n const queryBuilder = query\n \n return interval(pollInterval).pipe(\n startWith(0), // Execute immediately on subscription\n switchMap(async () => {\n try {\n // Execute the Drizzle query builder\n // Drizzle query builders return promises when executed\n const result = await Promise.resolve(queryBuilder)\n return result as T[]\n } catch (error) {\n logger('[Db.liveQuery] Error executing query:', error)\n throw error\n }\n }),\n distinctUntilChanged((prev, curr) => {\n // Only emit if results actually changed\n // Use JSON.stringify for deep comparison\n return JSON.stringify(pr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G;IACH,OAAO,SAAS,CACd,KAAgC,EAAA;AAEhC,QAAA,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;AACZ,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;QACpE;;QAGA,MAAM,YAAY,GAAG,IAAI;;AAGzB,QAAA,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;AAC/B,YAAA,MAAM,IAAI,KAAK,CAAC,gHAAgH,CAAC;QACnI;;;QAIA,MAAM,YAAY,GAAG,KAAK;AAE1B,QAAA,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAChC,SAAS,CAAC,CAAC,CAAC;QACZ,SAAS,CAAC,YAAW;AACnB,YAAA,IAAI;;;gBAGF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;AAClD,gBAAA,OAAO,MAAa;YACtB;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,MAAM,CAAC,uCAAuC,EAAE,KAAK,CAAC;AACtD,gBAAA,MAAM,KAAK;YACb;QACF,CAAC,CAAC,EACF,oBAAoB,CAAC,CAAC,IAAI,EAAE,IAAI,KAAI;;;AAGlC,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,CACH;IACH;AACD;AAED,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EasClient-Aojewp6P.js","sources":["../src/browser/helpers/EasClient.ts"],"sourcesContent":["import { BaseEasClient } from '@/helpers/EasClient/BaseEasClient'\nimport { EAS_ENDPOINT } from '@/client/constants'\nimport { GraphQLClient } from 'graphql-request'\n\nclass EasClient extends BaseEasClient {\n static getEasClient() {\n if (!this.easClient) {\n this.easClient = new GraphQLClient(EAS_ENDPOINT)\n }\n return this.easClient\n }\n}\n\nBaseEasClient.setPlatformClass(EasClient)\n\nexport { EasClient }\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,MAAM,SAAU,SAAQ,aAAa,CAAA;AACnC,IAAA,OAAO,YAAY,GAAA;AACjB,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC;QAClD;QACA,OAAO,IAAI,CAAC,SAAS;IACvB;AACD;AAED,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EasClient-BVFXp2O6.js","sources":["../src/node/helpers/EasClient.ts"],"sourcesContent":["import { BaseEasClient } from \"@/helpers/EasClient/BaseEasClient\"\nimport { EAS_ENDPOINT } from \"@/client/constants\"\nimport { GraphQLClient } from \"graphql-request\"\n\nclass EasClient extends BaseEasClient {\n static getEasClient() {\n if (!this.easClient) {\n this.easClient = new GraphQLClient(EAS_ENDPOINT)\n }\n return this.easClient\n }\n\n}\n\nBaseEasClient.setPlatformClass(EasClient)\n\nexport { EasClient }"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,MAAM,SAAU,SAAQ,aAAa,CAAA;AACnC,IAAA,OAAO,YAAY,GAAA;AACjB,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC;QAClD;QACA,OAAO,IAAI,CAAC,SAAS;IACvB;AAED;AAED,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC;;;;"}
|