Skip to content

Commit 2899e9e

Browse files
committed
docs: document storage APIs and environments
Add JSDoc public API, visibility, and runtime environment metadata for the storage package exports.
1 parent c1c7973 commit 2899e9e

5 files changed

Lines changed: 28 additions & 1 deletion

File tree

‎src/array.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313

1414
/**
1515
* "array" operations mapped to SQL Tables.
16+
* @private
17+
* @environment server
1618
*/
1719
function array(method, data) {
1820
const storageName = data.storageConfig?.name;

‎src/database.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313

1414
/**
1515
* "database" operations mapped to SQLite Files (emulated catalogs).
16+
* @private
17+
* @environment server
1618
*/
1719
function database(method, data) {
1820
const storageName = data.storageConfig?.name;

‎src/index.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import object from "./object.js";
2323
* Routes CRUD requests to appropriate SQLite database, array, or object modules.
2424
* @param {Object} data - CRUD request payload containing method, database, array, organization_id, etc.
2525
* @returns {Promise<Object>} Execution result from SQLite / libSQL database layer
26+
* @public
27+
* @environment server
2628
*/
2729
export async function send(data) {
2830
if (!data || !data.method) {
@@ -37,4 +39,11 @@ export async function send(data) {
3739
throw new Error(`Unsupported query target type: "${type}" in method "${data.method}"`);
3840
}
3941

40-
export default { send };
42+
export default { send };
43+
44+
/**
45+
* Lightweight SQLite CRUD wrapper and multi-tenant state routing client for the CoCreate ecosystem.
46+
*
47+
* @module sqlite
48+
* @environment server
49+
*/

‎src/object.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313

1414
/**
1515
* "object" operations mapped to SQL Rows.
16+
* @private
17+
* @environment server
1618
*/
1719
function object(method, data) {
1820
const storageName = data.storageConfig?.name;

‎src/utilities.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const organizations = {};
3030
* Dynamically resolves or caches a long-lived libSQL Database Client.
3131
* Supports standard local SQLite files ("file:local.db"), in-memory paths (":memory:"),
3232
* and remote Turso connections ("libsql://...") with cloud tokens.
33+
* @private
34+
* @environment server
3335
*/
3436
async function dbClient(data) {
3537
const storageUrl = data.storageConfig?.databaseUrl || data.storageConfig?.url;
@@ -106,6 +108,8 @@ process.on("orgDeleted", (organization_id) => {
106108

107109
/**
108110
* Safe transaction helper to update unstructured payloads with MongoDB behavior inside libSQL.
111+
* @private
112+
* @environment server
109113
*/
110114
async function executeUpdateTransaction(db, arrayName, docId, rawUpdateInput, requestData) {
111115
try {
@@ -166,6 +170,8 @@ async function executeUpdateTransaction(db, arrayName, docId, rawUpdateInput, re
166170

167171
/**
168172
* Applies MongoDB update operators recursively to maintain unified schema manipulation behaviors.
173+
* @private
174+
* @environment server
169175
*/
170176
function applyMongoUpdate(record, updatePayload) {
171177
let target = { ...record };
@@ -256,6 +262,8 @@ function applyMongoUpdate(record, updatePayload) {
256262

257263
/**
258264
* Translates standard MongoDB JSON filters into native SQLite query filters.
265+
* @private
266+
* @environment server
259267
*/
260268
function compileFilterToSQL(filter, organizationId) {
261269
let clauses = ["organization_id = ?"];
@@ -326,6 +334,8 @@ function compileFilterToSQL(filter, organizationId) {
326334

327335
/**
328336
* Resolves SQLite columns and rows back into unified JSON format.
337+
* @private
338+
* @environment server
329339
*/
330340
function parseSqlRow(row) {
331341
if (!row) return null;
@@ -367,6 +377,8 @@ function deleteNestedValue(obj, path) {
367377

368378
/**
369379
* Syncs the output response data arrays back cleanly.
380+
* @private
381+
* @environment server
370382
*/
371383
function createData(data, array, type) {
372384
if (data[type] && data[type][0] && data[type][0].isFilter === "isEmptyObjectFilter") {

0 commit comments

Comments
 (0)