@alwatr/nitrobase-reference 9.1.0 → 9.1.1

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/main.js CHANGED
@@ -1,5 +1,5 @@
1
- /* 📦 @alwatr/nitrobase-reference v9.1.0 */
2
- import{delay as N}from"@alwatr/delay";import{createLogger as Y}from"@alwatr/logger";import{getStoreId as Z,getStorePath as $}from"@alwatr/nitrobase-helper";import{StoreFileType as O,StoreFileExtension as L}from"@alwatr/nitrobase-types";import{createLogger as X}from"@alwatr/logger";var B=X("@alwatr/nitrobase-reference");q:B.logFileModule?.("collection-reference");class G{context__;updatedCallback__;static version="9.1.0";static fileFormatVersion=3;static newRefFromData(q,z,A){B.logMethodArgs?.("col.newRefFromData",q);let J=Date.now(),K={ok:!0,meta:{...q,rev:1,updated:J,created:J,lastAutoId:0,type:O.Collection,extension:L.Json,fv:G.fileFormatVersion,extra:{}},data:{}};return new G(K,z,A)}static newRefFromContext(q,z,A){return B.logMethodArgs?.("col.newRefFromContext",q.meta),new G(q,z,A)}validateContext__(){if(this.logger__.logMethod?.("validateContext__"),this.context__.ok!==!0)throw this.logger__.accident?.("validateContext__","store_not_ok"),Error("store_not_ok",{cause:{context:this.context__}});if(this.context__.meta===void 0)throw this.logger__.accident?.("validateContext__","store_meta_undefined"),Error("store_meta_undefined",{cause:{context:this.context__}});if(this.context__.meta.type!==O.Collection)throw this.logger__.accident?.("validateContext__","collection_type_invalid",this.context__.meta),Error("collection_type_invalid",{cause:this.context__.meta});if(this.context__.meta.fv!==G.fileFormatVersion)this.logger__.incident?.("validateContext__","store_file_version_incompatible",{old:this.context__.meta.fv,new:G.fileFormatVersion}),this.migrateContext__()}migrateContext__(){if(this.context__.meta.fv===G.fileFormatVersion)return;if(this.logger__.logMethod?.("migrateContext__"),this.context__.meta.fv>G.fileFormatVersion)throw this.logger__.accident("migrateContext__","store_version_incompatible",this.context__.meta),Error("store_version_incompatible",{cause:this.context__.meta});if(this.context__.meta.fv===1)this.context__.meta.fv=2;if(this.context__.meta.fv===2){if(this.context__.meta.schemaVer===void 0||this.context__.meta.schemaVer===0)this.context__.meta.schemaVer=1;delete this.context__.meta.ver,this.context__.meta.extra??={},this.context__.meta.fv=3}this.updated__()}id;path;hasUnprocessedChanges_=!1;logger__;constructor(q,z,A){this.context__=q;this.updatedCallback__=z;this.id=Z(this.context__.meta),this.path=$(this.context__.meta),A??=this.id.slice(0,20),this.logger__=Y(`col:${A}`),this.logger__.logMethodArgs?.("new",{id:this.id}),this.validateContext__()}get schemaVer(){return this.context__.meta.schemaVer??1}set schemaVer(q){this.logger__.logMethodArgs?.("set schemaVer",{old:this.context__.meta.schemaVer,new:q}),this.context__.meta.schemaVer=q,this.updated__()}_freeze=!1;get freeze(){return this._freeze}set freeze(q){this.logger__.logMethodArgs?.("freeze changed",{value:q}),this._freeze=q}hasItem(q){let z=Object.hasOwn(this.context__.data,q);return this.logger__.logMethodFull?.("hasItem",q,z),z}getStoreMeta(){return this.logger__.logMethod?.("getStoreMeta"),this.context__.meta}item__(q){let z=this.context__.data[q];if(z===void 0)throw this.logger__.accident("item__","collection_item_not_found",{itemId:q}),Error("collection_item_not_found",{cause:{itemId:q}});return z}getItemMeta(q){let z=this.item__(q).meta;return this.logger__.logMethodFull?.("getItemMeta",q,z),z}getItemData(q){return this.logger__.logMethodArgs?.("getItemData",q),this.item__(q).data}getItemContext_(q){return this.logger__.logMethodArgs?.("getItemContext_",q),this.context__.data[q]}addItem(q,z){if(this.logger__.logMethodArgs?.("addItem",{itemId:q,data:z}),this.hasItem(q))throw this.logger__.accident("addItem","collection_item_exist",{itemId:q}),Error("collection_item_exist",{cause:{itemId:q}});let A=Date.now();this.context__.data[q]={meta:{id:q,rev:0,created:A,updated:A},data:z},this.updated__(q)}appendItem(q){this.logger__.logMethodArgs?.("appendItem",q);let z=this.nextAutoIncrementId__();return this.addItem(z,q),z}removeItem(q){this.logger__.logMethodArgs?.("removeItem",q),delete this.context__.data[q],this.updated__()}replaceItemData(q,z){this.logger__.logMethodArgs?.("replaceItemData",{itemId:q,data:z}),this.item__(q).data=z,this.updated__(q)}mergeItemData(q,z){this.logger__.logMethodArgs?.("mergeItemData",{itemId:q,data:z}),Object.assign(this.item__(q).data,z),this.updated__(q)}save(q){this.logger__.logMethod?.("save"),this.updated__(q,!1)}saveImmediate(q){this.logger__.logMethod?.("saveImmediate"),this.updated__(q,!0)}keys(){return this.logger__.logMethod?.("keys"),Object.keys(this.context__.data)}values(){return this.logger__.logMethod?.("values"),Object.values(this.context__.data)}*ids(){this.logger__.logMethod?.("ids");for(let q in this.context__.data)yield q}*items(){this.logger__.logMethod?.("items");for(let q in this.context__.data)yield this.context__.data[q]}getFullContext_(){return this.logger__.logMethod?.("getFullContext_"),this.context__}updateDelayed_=!1;async updated__(q=null,z=!1){if(this.logger__.logMethodArgs?.("updated__",{id:q,immediate:z,delayed:this.updateDelayed_}),this.hasUnprocessedChanges_=!0,q!==null)this.refreshMeta_(q);if(z===!1&&this.updateDelayed_===!0)return;if(this.updateDelayed_=!0,z===!0||this.context__.meta.changeDebounce===void 0)await N.nextMacrotask();else await N.by(this.context__.meta.changeDebounce);if(this.updateDelayed_!==!0)return;if(this.updateDelayed_=!1,q===null)this.refreshMeta_(q);if(this._freeze===!0)return;this.updatedCallback__(this)}refreshMeta_(q){this.logger__.logMethodArgs?.("refreshMeta_",{id:q});let z=Date.now();if(this.context__.meta.rev++,this.context__.meta.updated=z,q!==null){let A=this.item__(q).meta;A.rev++,A.updated=z}}nextAutoIncrementId__(){this.logger__.logMethod?.("nextAutoIncrementId__");let q=this.context__.meta;do q.lastAutoId++;while(q.lastAutoId in this.context__.data);return q.lastAutoId}getExtraMeta(){return this.logger__.logMethod?.("getExtraMeta"),this.context__.meta.extra}replaceExtraMeta(q){this.logger__.logMethodArgs?.("replaceExtraMeta",q),this.context__.meta.extra=q,this.updated__()}mergeExtraMeta(q){this.logger__.logMethodArgs?.("mergeExtraMeta",q),Object.assign(this.context__.meta.extra,q),this.updated__()}}import{delay as Q}from"@alwatr/delay";import{createLogger as j}from"@alwatr/logger";import{getStoreId as P,getStorePath as U}from"@alwatr/nitrobase-helper";import{StoreFileType as V,StoreFileExtension as E}from"@alwatr/nitrobase-types";q:B.logFileModule?.("document-reference");class H{context__;updatedCallback__;static version="9.1.0";static fileFormatVersion=3;static newRefFromData(q,z,A,J){B.logMethodArgs?.("doc.newRefFromData",q);let K=Date.now(),W={ok:!0,meta:{...q,rev:1,updated:K,created:K,type:V.Document,extension:E.Json,fv:H.fileFormatVersion,extra:{}},data:z};return new H(W,A,J)}static newRefFromContext(q,z,A){return B.logMethodArgs?.("doc.newRefFromContext",q.meta),new H(q,z,A)}validateContext__(){if(this.logger__.logMethod?.("validateContext__"),this.context__.ok!==!0)throw this.logger__.accident?.("validateContext__","store_not_ok"),Error("store_not_ok",{cause:{context:this.context__}});if(this.context__.meta===void 0)throw this.logger__.accident?.("validateContext__","store_meta_undefined"),Error("store_meta_undefined",{cause:{context:this.context__}});if(this.context__.meta.type!==V.Document)throw this.logger__.accident?.("validateContext__","document_type_invalid",this.context__.meta),Error("document_type_invalid",{cause:this.context__.meta});if(this.context__.meta.fv!==H.fileFormatVersion)this.logger__.incident?.("validateContext__","store_file_version_incompatible",{old:this.context__.meta.fv,new:H.fileFormatVersion}),this.migrateContext__()}migrateContext__(){if(this.context__.meta.fv===H.fileFormatVersion)return;if(this.logger__.logMethod?.("migrateContext__"),this.context__.meta.fv>H.fileFormatVersion)throw this.logger__.accident("migrateContext__","store_version_incompatible",this.context__.meta),Error("store_version_incompatible",{cause:this.context__.meta});if(this.context__.meta.fv===1)this.context__.meta.fv=2;if(this.context__.meta.fv===2){if(this.context__.meta.schemaVer===void 0||this.context__.meta.schemaVer===0)this.context__.meta.schemaVer=1;delete this.context__.meta.ver,this.context__.meta.extra??={},this.context__.meta.fv=3}this.updated__()}id;path;hasUnprocessedChanges_=!1;logger__;constructor(q,z,A){this.context__=q;this.updatedCallback__=z;this.id=P(this.context__.meta),this.path=U(this.context__.meta),A??=this.id.slice(0,20),this.logger__=j(`doc:${A}`),this.logger__.logMethodArgs?.("new",{path:this.path}),this.validateContext__()}get schemaVer(){return this.context__.meta.schemaVer??1}set schemaVer(q){this.logger__.logMethodArgs?.("set schemaVer",{old:this.context__.meta.schemaVer,new:q}),this.context__.meta.schemaVer=q,this.updated__()}_freeze=!1;get freeze(){return this._freeze}set freeze(q){this.logger__.logMethodArgs?.("freeze changed",{value:q}),this._freeze=q}getData(){return this.logger__.logMethod?.("getData"),this.context__.data}getStoreMeta(){return this.logger__.logMethod?.("getStoreMeta"),this.context__.meta}replaceData(q){this.logger__.logMethodArgs?.("replaceData",q),this.context__.data=q,this.updated__()}mergeData(q){this.logger__.logMethodArgs?.("mergeData",q),Object.assign(this.context__.data,q),this.updated__()}save(){this.logger__.logMethod?.("save"),this.updated__()}saveImmediate(){this.logger__.logMethod?.("saveImmediate"),this.updated__(!0)}getFullContext_(){return this.logger__.logMethod?.("getFullContext_"),this.context__}updateDelayed_=!1;async updated__(q=!1){if(this.logger__.logMethodArgs?.("updated__",{immediate:q,delayed:this.updateDelayed_}),this.hasUnprocessedChanges_=!0,q!==!0&&this.updateDelayed_===!0)return;if(this.updateDelayed_=!0,q===!0||this.context__.meta.changeDebounce===void 0)await Q.nextMacrotask();else await Q.by(this.context__.meta.changeDebounce);if(this.updateDelayed_!==!0)return;if(this.updateDelayed_=!1,this.refreshMetadata_(),this._freeze===!0)return;this.updatedCallback__(this)}refreshMetadata_(){this.logger__.logMethod?.("refreshMetadata_"),this.context__.meta.updated=Date.now(),this.context__.meta.rev++}getExtraMeta(){return this.logger__.logMethod?.("getExtraMeta"),this.context__.meta.extra}replaceExtraMeta(q){this.logger__.logMethodArgs?.("replaceExtraMeta",q),this.context__.meta.extra=q,this.updated__()}mergeExtraMeta(q){this.logger__.logMethodArgs?.("mergeExtraMeta",q),Object.assign(this.context__.meta.extra,q),this.updated__()}}export{H as DocumentReference,G as CollectionReference};
1
+ /* 📦 @alwatr/nitrobase-reference v9.1.1 */
2
+ import{delay as N}from"@alwatr/delay";import{createLogger as Y}from"@alwatr/logger";import{getStoreId as Z,getStorePath as $}from"@alwatr/nitrobase-helper";import{StoreFileType as O,StoreFileExtension as L}from"@alwatr/nitrobase-types";import{createLogger as X}from"@alwatr/logger";var B=X("@alwatr/nitrobase-reference");q:B.logFileModule?.("collection-reference");class G{context__;updatedCallback__;static version="9.1.1";static fileFormatVersion=3;static newRefFromData(q,z,A){B.logMethodArgs?.("col.newRefFromData",q);let J=Date.now(),K={ok:!0,meta:{...q,rev:1,updated:J,created:J,lastAutoId:0,type:O.Collection,extension:L.Json,fv:G.fileFormatVersion,extra:{}},data:{}};return new G(K,z,A)}static newRefFromContext(q,z,A){return B.logMethodArgs?.("col.newRefFromContext",q.meta),new G(q,z,A)}validateContext__(){if(this.logger__.logMethod?.("validateContext__"),this.context__.ok!==!0)throw this.logger__.accident?.("validateContext__","store_not_ok"),Error("store_not_ok",{cause:{context:this.context__}});if(this.context__.meta===void 0)throw this.logger__.accident?.("validateContext__","store_meta_undefined"),Error("store_meta_undefined",{cause:{context:this.context__}});if(this.context__.meta.type!==O.Collection)throw this.logger__.accident?.("validateContext__","collection_type_invalid",this.context__.meta),Error("collection_type_invalid",{cause:this.context__.meta});if(this.context__.meta.fv!==G.fileFormatVersion)this.logger__.incident?.("validateContext__","store_file_version_incompatible",{old:this.context__.meta.fv,new:G.fileFormatVersion}),this.migrateContext__()}migrateContext__(){if(this.context__.meta.fv===G.fileFormatVersion)return;if(this.logger__.logMethod?.("migrateContext__"),this.context__.meta.fv>G.fileFormatVersion)throw this.logger__.accident("migrateContext__","store_version_incompatible",this.context__.meta),Error("store_version_incompatible",{cause:this.context__.meta});if(this.context__.meta.fv===1)this.context__.meta.fv=2;if(this.context__.meta.fv===2){if(this.context__.meta.schemaVer===void 0||this.context__.meta.schemaVer===0)this.context__.meta.schemaVer=1;delete this.context__.meta.ver,this.context__.meta.extra??={},this.context__.meta.fv=3}this.updated__()}id;path;hasUnprocessedChanges_=!1;logger__;constructor(q,z,A){this.context__=q;this.updatedCallback__=z;this.id=Z(this.context__.meta),this.path=$(this.context__.meta),A??=this.id.slice(0,20),this.logger__=Y(`col:${A}`),this.logger__.logMethodArgs?.("new",{id:this.id}),this.validateContext__()}get schemaVer(){return this.context__.meta.schemaVer??1}set schemaVer(q){this.logger__.logMethodArgs?.("set schemaVer",{old:this.context__.meta.schemaVer,new:q}),this.context__.meta.schemaVer=q,this.updated__()}_freeze=!1;get freeze(){return this._freeze}set freeze(q){this.logger__.logMethodArgs?.("freeze changed",{value:q}),this._freeze=q}hasItem(q){let z=Object.hasOwn(this.context__.data,q);return this.logger__.logMethodFull?.("hasItem",q,z),z}getStoreMeta(){return this.logger__.logMethod?.("getStoreMeta"),this.context__.meta}item__(q){let z=this.context__.data[q];if(z===void 0)throw this.logger__.accident("item__","collection_item_not_found",{itemId:q}),Error("collection_item_not_found",{cause:{itemId:q}});return z}getItemMeta(q){let z=this.item__(q).meta;return this.logger__.logMethodFull?.("getItemMeta",q,z),z}getItemData(q){return this.logger__.logMethodArgs?.("getItemData",q),this.item__(q).data}getItemContext_(q){return this.logger__.logMethodArgs?.("getItemContext_",q),this.context__.data[q]}addItem(q,z){if(this.logger__.logMethodArgs?.("addItem",{itemId:q,data:z}),this.hasItem(q))throw this.logger__.accident("addItem","collection_item_exist",{itemId:q}),Error("collection_item_exist",{cause:{itemId:q}});let A=Date.now();this.context__.data[q]={meta:{id:q,rev:0,created:A,updated:A},data:z},this.updated__(q)}appendItem(q){this.logger__.logMethodArgs?.("appendItem",q);let z=this.nextAutoIncrementId__();return this.addItem(z,q),z}removeItem(q){this.logger__.logMethodArgs?.("removeItem",q),delete this.context__.data[q],this.updated__()}replaceItemData(q,z){this.logger__.logMethodArgs?.("replaceItemData",{itemId:q,data:z}),this.item__(q).data=z,this.updated__(q)}mergeItemData(q,z){this.logger__.logMethodArgs?.("mergeItemData",{itemId:q,data:z}),Object.assign(this.item__(q).data,z),this.updated__(q)}save(q){this.logger__.logMethod?.("save"),this.updated__(q,!1)}saveImmediate(q){this.logger__.logMethod?.("saveImmediate"),this.updated__(q,!0)}keys(){return this.logger__.logMethod?.("keys"),Object.keys(this.context__.data)}values(){return this.logger__.logMethod?.("values"),Object.values(this.context__.data)}*ids(){this.logger__.logMethod?.("ids");for(let q in this.context__.data)yield q}*items(){this.logger__.logMethod?.("items");for(let q in this.context__.data)yield this.context__.data[q]}getFullContext_(){return this.logger__.logMethod?.("getFullContext_"),this.context__}updateDelayed_=!1;async updated__(q=null,z=!1){if(this.logger__.logMethodArgs?.("updated__",{id:q,immediate:z,delayed:this.updateDelayed_}),this.hasUnprocessedChanges_=!0,q!==null)this.refreshMeta_(q);if(z===!1&&this.updateDelayed_===!0)return;if(this.updateDelayed_=!0,z===!0||this.context__.meta.changeDebounce===void 0)await N.nextMacrotask();else await N.by(this.context__.meta.changeDebounce);if(this.updateDelayed_!==!0)return;if(this.updateDelayed_=!1,q===null)this.refreshMeta_(q);if(this._freeze===!0)return;this.updatedCallback__(this)}refreshMeta_(q){this.logger__.logMethodArgs?.("refreshMeta_",{id:q});let z=Date.now();if(this.context__.meta.rev++,this.context__.meta.updated=z,q!==null){let A=this.item__(q).meta;A.rev++,A.updated=z}}nextAutoIncrementId__(){this.logger__.logMethod?.("nextAutoIncrementId__");let q=this.context__.meta;do q.lastAutoId++;while(q.lastAutoId in this.context__.data);return q.lastAutoId}getExtraMeta(){return this.logger__.logMethod?.("getExtraMeta"),this.context__.meta.extra}replaceExtraMeta(q){this.logger__.logMethodArgs?.("replaceExtraMeta",q),this.context__.meta.extra=q,this.updated__()}mergeExtraMeta(q){this.logger__.logMethodArgs?.("mergeExtraMeta",q),Object.assign(this.context__.meta.extra,q),this.updated__()}}import{delay as Q}from"@alwatr/delay";import{createLogger as j}from"@alwatr/logger";import{getStoreId as P,getStorePath as U}from"@alwatr/nitrobase-helper";import{StoreFileType as V,StoreFileExtension as E}from"@alwatr/nitrobase-types";q:B.logFileModule?.("document-reference");class H{context__;updatedCallback__;static version="9.1.1";static fileFormatVersion=3;static newRefFromData(q,z,A,J){B.logMethodArgs?.("doc.newRefFromData",q);let K=Date.now(),W={ok:!0,meta:{...q,rev:1,updated:K,created:K,type:V.Document,extension:E.Json,fv:H.fileFormatVersion,extra:{}},data:z};return new H(W,A,J)}static newRefFromContext(q,z,A){return B.logMethodArgs?.("doc.newRefFromContext",q.meta),new H(q,z,A)}validateContext__(){if(this.logger__.logMethod?.("validateContext__"),this.context__.ok!==!0)throw this.logger__.accident?.("validateContext__","store_not_ok"),Error("store_not_ok",{cause:{context:this.context__}});if(this.context__.meta===void 0)throw this.logger__.accident?.("validateContext__","store_meta_undefined"),Error("store_meta_undefined",{cause:{context:this.context__}});if(this.context__.meta.type!==V.Document)throw this.logger__.accident?.("validateContext__","document_type_invalid",this.context__.meta),Error("document_type_invalid",{cause:this.context__.meta});if(this.context__.meta.fv!==H.fileFormatVersion)this.logger__.incident?.("validateContext__","store_file_version_incompatible",{old:this.context__.meta.fv,new:H.fileFormatVersion}),this.migrateContext__()}migrateContext__(){if(this.context__.meta.fv===H.fileFormatVersion)return;if(this.logger__.logMethod?.("migrateContext__"),this.context__.meta.fv>H.fileFormatVersion)throw this.logger__.accident("migrateContext__","store_version_incompatible",this.context__.meta),Error("store_version_incompatible",{cause:this.context__.meta});if(this.context__.meta.fv===1)this.context__.meta.fv=2;if(this.context__.meta.fv===2){if(this.context__.meta.schemaVer===void 0||this.context__.meta.schemaVer===0)this.context__.meta.schemaVer=1;delete this.context__.meta.ver,this.context__.meta.extra??={},this.context__.meta.fv=3}this.updated__()}id;path;hasUnprocessedChanges_=!1;logger__;constructor(q,z,A){this.context__=q;this.updatedCallback__=z;this.id=P(this.context__.meta),this.path=U(this.context__.meta),A??=this.id.slice(0,20),this.logger__=j(`doc:${A}`),this.logger__.logMethodArgs?.("new",{path:this.path}),this.validateContext__()}get schemaVer(){return this.context__.meta.schemaVer??1}set schemaVer(q){this.logger__.logMethodArgs?.("set schemaVer",{old:this.context__.meta.schemaVer,new:q}),this.context__.meta.schemaVer=q,this.updated__()}_freeze=!1;get freeze(){return this._freeze}set freeze(q){this.logger__.logMethodArgs?.("freeze changed",{value:q}),this._freeze=q}getData(){return this.logger__.logMethod?.("getData"),this.context__.data}getStoreMeta(){return this.logger__.logMethod?.("getStoreMeta"),this.context__.meta}replaceData(q){this.logger__.logMethodArgs?.("replaceData",q),this.context__.data=q,this.updated__()}mergeData(q){this.logger__.logMethodArgs?.("mergeData",q),Object.assign(this.context__.data,q),this.updated__()}save(){this.logger__.logMethod?.("save"),this.updated__()}saveImmediate(){this.logger__.logMethod?.("saveImmediate"),this.updated__(!0)}getFullContext_(){return this.logger__.logMethod?.("getFullContext_"),this.context__}updateDelayed_=!1;async updated__(q=!1){if(this.logger__.logMethodArgs?.("updated__",{immediate:q,delayed:this.updateDelayed_}),this.hasUnprocessedChanges_=!0,q!==!0&&this.updateDelayed_===!0)return;if(this.updateDelayed_=!0,q===!0||this.context__.meta.changeDebounce===void 0)await Q.nextMacrotask();else await Q.by(this.context__.meta.changeDebounce);if(this.updateDelayed_!==!0)return;if(this.updateDelayed_=!1,this.refreshMetadata_(),this._freeze===!0)return;this.updatedCallback__(this)}refreshMetadata_(){this.logger__.logMethod?.("refreshMetadata_"),this.context__.meta.updated=Date.now(),this.context__.meta.rev++}getExtraMeta(){return this.logger__.logMethod?.("getExtraMeta"),this.context__.meta.extra}replaceExtraMeta(q){this.logger__.logMethodArgs?.("replaceExtraMeta",q),this.context__.meta.extra=q,this.updated__()}mergeExtraMeta(q){this.logger__.logMethodArgs?.("mergeExtraMeta",q),Object.assign(this.context__.meta.extra,q),this.updated__()}}export{H as DocumentReference,G as CollectionReference};
3
3
 
4
- //# debugId=1445A22D1A02267664756E2164756E21
4
+ //# debugId=20B6F3D5A085093E64756E2164756E21
5
5
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -7,6 +7,6 @@
7
7
  "import {delay} from '@alwatr/delay';\nimport {createLogger} from '@alwatr/logger';\nimport {getStoreId, getStorePath} from '@alwatr/nitrobase-helper';\nimport {StoreFileType, StoreFileExtension, type StoreFileId, type DocumentContext, type StoreFileMeta} from '@alwatr/nitrobase-types';\n\nimport {logger} from './logger.js';\n\n__dev_mode__: logger.logFileModule?.('document-reference');\n\n/**\n * Represents a reference to a document of the AlwatrNitrobase.\n * Provides methods to interact with the document, such as get, set, update and save.\n */\nexport class DocumentReference<TDoc extends JsonObject = JsonObject> {\n /**\n * Alwatr nitrobase engine version string.\n */\n public static readonly version = __package_version__;\n\n /**\n * Alwatr nitrobase engine file format version number.\n */\n public static readonly fileFormatVersion = 3;\n\n /**\n * Creates new DocumentReference instance from stat and initial data.\n *\n * @param statId the document stat.\n * @param data the document data.\n * @param updatedCallback the callback to invoke when the document changed.\n * @template TDoc The document data type.\n * @returns A new document reference class.\n */\n public static newRefFromData<TDoc extends JsonObject>(\n statId: StoreFileId,\n data: TDoc,\n updatedCallback: (from: DocumentReference<TDoc>) => unknown,\n debugDomain?: string,\n ): DocumentReference<TDoc> {\n logger.logMethodArgs?.('doc.newRefFromData', statId);\n\n const now = Date.now();\n const initialContext: DocumentContext<TDoc> = {\n ok: true,\n meta: {\n ...statId,\n rev: 1,\n updated: now,\n created: now,\n type: StoreFileType.Document,\n extension: StoreFileExtension.Json,\n fv: DocumentReference.fileFormatVersion,\n extra: {},\n },\n data,\n };\n\n return new DocumentReference(initialContext, updatedCallback, debugDomain);\n }\n\n /**\n * Creates new DocumentReference instance from DocumentContext.\n *\n * @param context the document context.\n * @param updatedCallback the callback to invoke when the document changed.\n * @template TDoc The document data type.\n * @returns A new document reference class.\n */\n public static newRefFromContext<TDoc extends JsonObject>(\n context: DocumentContext<TDoc>,\n updatedCallback: (from: DocumentReference<TDoc>) => unknown,\n debugDomain?: string,\n ): DocumentReference<TDoc> {\n logger.logMethodArgs?.('doc.newRefFromContext', context.meta);\n return new DocumentReference(context, updatedCallback, debugDomain);\n }\n\n /**\n * Validates the document context and try to migrate it to the latest version.\n */\n private validateContext__(): void {\n this.logger__.logMethod?.('validateContext__');\n\n if (this.context__.ok !== true) {\n this.logger__.accident?.('validateContext__', 'store_not_ok');\n throw new Error('store_not_ok', {cause: {context: this.context__}});\n }\n\n if (this.context__.meta === undefined) {\n this.logger__.accident?.('validateContext__', 'store_meta_undefined');\n throw new Error('store_meta_undefined', {cause: {context: this.context__}});\n }\n\n if (this.context__.meta.type !== StoreFileType.Document) {\n this.logger__.accident?.('validateContext__', 'document_type_invalid', this.context__.meta);\n throw new Error('document_type_invalid', {cause: this.context__.meta});\n }\n\n if (this.context__.meta.fv !== DocumentReference.fileFormatVersion) {\n this.logger__.incident?.('validateContext__', 'store_file_version_incompatible', {\n old: this.context__.meta.fv,\n new: DocumentReference.fileFormatVersion,\n });\n this.migrateContext__();\n }\n }\n\n /**\n * Migrate the document context to the latest.\n */\n private migrateContext__(): void {\n if (this.context__.meta.fv === DocumentReference.fileFormatVersion) return;\n\n this.logger__.logMethod?.('migrateContext__');\n\n if (this.context__.meta.fv > DocumentReference.fileFormatVersion) {\n this.logger__.accident('migrateContext__', 'store_version_incompatible', this.context__.meta);\n throw new Error('store_version_incompatible', {cause: this.context__.meta});\n }\n\n if (this.context__.meta.fv === 1) {\n // migrate from v1 to v2\n // this.context__.meta.schemaVer = 0\n this.context__.meta.fv = 2;\n }\n\n if (this.context__.meta.fv === 2) {\n // migrate from v1 to v3\n if (this.context__.meta.schemaVer === undefined || this.context__.meta.schemaVer === 0) {\n this.context__.meta.schemaVer = 1;\n }\n delete (this.context__.meta as DictionaryOpt)['ver'];\n this.context__.meta.extra ??= {};\n this.context__.meta.fv = 3;\n }\n\n this.updated__();\n }\n\n /**\n * The ID of the document nitrobase file.\n */\n public readonly id: string;\n\n /**\n * The location path of the document nitrobase file.\n */\n public readonly path: string;\n\n /**\n * Indicates whether the document has unsaved changes.\n */\n public hasUnprocessedChanges_ = false;\n\n /**\n * Logger instance for this document.\n */\n private logger__;\n\n /**\n * Create a new document reference.\n * Document reference have methods to get, set, update and save the AlwatrNitrobase Document.\n *\n * @param context__ Document's context filled from the Alwatr Nitrobase (parent).\n * @param updatedCallback__ updated callback to invoke when the document is updated from the Alwatr Nitrobase (parent).\n * @template TDoc The document data type.\n */\n constructor(\n private readonly context__: DocumentContext<TDoc>,\n private readonly updatedCallback__: (from: DocumentReference<TDoc>) => unknown,\n debugDomain?: string,\n ) {\n this.id = getStoreId(this.context__.meta);\n this.path = getStorePath(this.context__.meta);\n\n debugDomain ??= this.id.slice(0, 20);\n this.logger__ = createLogger(`doc:${debugDomain}`);\n\n this.logger__.logMethodArgs?.('new', {path: this.path});\n\n this.validateContext__();\n }\n\n /**\n * Get nitrobase schema version\n *\n * @returns nitrobase schema version\n */\n public get schemaVer(): number {\n return this.context__.meta.schemaVer ?? 1;\n }\n\n /**\n * Set nitrobase schema version for migrate\n */\n public set schemaVer(ver: number) {\n this.logger__.logMethodArgs?.('set schemaVer', {old: this.context__.meta.schemaVer, new: ver});\n this.context__.meta.schemaVer = ver;\n this.updated__();\n }\n\n /**\n * Indicates whether the document data is frozen and cannot be saved.\n */\n private _freeze = false;\n\n /**\n * Gets the freeze status of the document data.\n *\n * @returns `true` if the document data is frozen, `false` otherwise.\n *\n * @example\n * ```typescript\n * const isFrozen = documentRef.freeze;\n * console.log(isFrozen); // Output: false\n * ```\n */\n public get freeze(): boolean {\n return this._freeze;\n }\n\n /**\n * Sets the freeze status of the document data.\n *\n * @param value - The freeze status to set.\n *\n * @example\n * ```typescript\n * documentRef.freeze = true;\n * console.log(documentRef.freeze); // Output: true\n * ```\n */\n public set freeze(value: boolean) {\n this.logger__.logMethodArgs?.('freeze changed', {value});\n this._freeze = value;\n }\n\n /**\n * Retrieves the document's data.\n *\n * @returns The document's data.\n *\n * @example\n * ```typescript\n * const documentData = documentRef.getData();\n * ```\n */\n public getData(): TDoc {\n this.logger__.logMethod?.('getData');\n return this.context__.data;\n }\n\n /**\n * Retrieves the document's metadata.\n *\n * @returns The document's metadata.\n *\n * @example\n * ```typescript\n * const documentMeta = documentRef.getStoreMeta();\n * ```\n */\n public getStoreMeta(): Readonly<StoreFileMeta> {\n this.logger__.logMethod?.('getStoreMeta');\n return this.context__.meta;\n }\n\n /**\n * Sets the document's data. replacing the existing data.\n *\n * @param data The new document data.\n *\n * @example\n * ```typescript\n * documentRef.replaceData({ a: 1, b: 2, c: 3 });\n * ```\n */\n public replaceData(data: TDoc): void {\n this.logger__.logMethodArgs?.('replaceData', data);\n (this.context__.data as unknown) = data;\n this.updated__();\n }\n\n /**\n * Updates document's data by merging a partial update into the document's data.\n *\n * @param data The part of data to merge into the document's data.\n *\n * @example\n * ```typescript\n * documentRef.mergeData({ c: 4 });\n * ```\n */\n public mergeData(data: Partial<TDoc>): void {\n this.logger__.logMethodArgs?.('mergeData', data);\n Object.assign(this.context__.data, data);\n this.updated__();\n }\n\n /**\n * Requests the Alwatr Nitrobase to save the document.\n * Saving may take some time in Alwatr Nitrobase due to the use of throttling.\n *\n * @example\n * ```typescript\n * documentRef.save();\n * ```\n */\n public save(): void {\n this.logger__.logMethod?.('save');\n this.updated__();\n }\n\n /**\n * Requests the Alwatr Nitrobase to save the document immediately.\n *\n * @example\n * ```typescript\n * documentRef.saveImmediate();\n * ```\n */\n public saveImmediate(): void {\n this.logger__.logMethod?.('saveImmediate');\n this.updated__(/* immediate: */ true);\n }\n\n /**\n * Retrieves the full context of the document.\n *\n * @returns The full context of the document.\n *\n * @example\n * ```typescript\n * const context = documentRef.getFullContext_();\n * ```\n */\n public getFullContext_(): Readonly<DocumentContext<TDoc>> {\n this.logger__.logMethod?.('getFullContext_');\n return this.context__;\n }\n\n public updateDelayed_ = false;\n\n /**\n * Update the document metadata and invoke the updated callback.\n * This method is throttled to prevent multiple updates in a short time.\n */\n private async updated__(immediate = false): Promise<void> {\n this.logger__.logMethodArgs?.('updated__', {immediate, delayed: this.updateDelayed_});\n\n this.hasUnprocessedChanges_ = true;\n\n if (immediate !== true && this.updateDelayed_ === true) return;\n // else\n\n this.updateDelayed_ = true;\n\n if (immediate === true || this.context__.meta.changeDebounce === undefined) {\n await delay.nextMacrotask();\n }\n else {\n await delay.by(this.context__.meta.changeDebounce);\n }\n\n if (this.updateDelayed_ !== true) return; // another parallel update finished!\n this.updateDelayed_ = false;\n\n this.refreshMetadata_();\n\n if (this._freeze === true) return; // prevent save if frozen\n this.updatedCallback__(this);\n }\n\n /**\n * Refresh/recalculate the document's metadata timestamp and revision.\n */\n protected refreshMetadata_(): void {\n this.logger__.logMethod?.('refreshMetadata_');\n this.context__.meta.updated = Date.now();\n this.context__.meta.rev++;\n }\n\n /**\n * Retrieves the document's extra metadata.\n *\n * @returns The document's extra metadata.\n *\n * @example\n * ```typescript\n * const colExtraMeta = documentRef.getExtraMeta();\n * ```\n */\n public getExtraMeta<T extends JsonObject>(): T {\n this.logger__.logMethod?.('getExtraMeta');\n return this.context__.meta.extra as T;\n }\n\n /**\n * Sets/replace the document's extra metadata.\n *\n * @param extraMeta The new document's extra metadata.\n *\n * @example\n * ```typescript\n * documentRef.replaceExtraMeta({ a: 1, b: 2, c: 3 });\n * ```\n */\n public replaceExtraMeta<T extends JsonObject>(extraMeta: T): void {\n this.logger__.logMethodArgs?.('replaceExtraMeta', extraMeta);\n this.context__.meta.extra = extraMeta;\n this.updated__();\n }\n\n /**\n * Updates document's extra metadata by merging a partial update.\n *\n * @param extraMeta The part of extra metadata to merge into the document's extra metadata.\n *\n * @example\n * ```typescript\n * documentRef.mergeExtraMeta({ c: 4 });\n * ```\n */\n public mergeExtraMeta<T extends JsonObject>(extraMeta: Partial<T>): void {\n this.logger__.logMethodArgs?.('mergeExtraMeta', extraMeta);\n Object.assign(this.context__.meta.extra, extraMeta);\n this.updated__();\n }\n}\n"
8
8
  ],
9
9
  "mappings": ";AAAA,gBAAQ,sBACR,uBAAQ,uBACR,qBAAQ,kBAAY,iCACpB,wBACE,wBACA,gCCLF,uBAAQ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iB,EAElB,KAAK,UAAY,GAAM,OAC3B,KAAK,kBAAkB,IAAI,EAMnB,gBAAgB,EAAS,CACjC,KAAK,SAAS,YAAY,kBAAkB,EAC5C,KAAK,UAAU,KAAK,QAAU,KAAK,IAAI,EACvC,KAAK,UAAU,KAAK,MAaf,YAAkC,EAAM,CAE7C,OADA,KAAK,SAAS,YAAY,cAAc,EACjC,KAAK,UAAU,KAAK,MAatB,gBAAsC,CAAC,EAAoB,CAChE,KAAK,SAAS,gBAAgB,mBAAoB,CAAS,EAC3D,KAAK,UAAU,KAAK,MAAQ,EAC5B,KAAK,UAAU,EAaV,cAAoC,CAAC,EAA6B,CACvE,KAAK,SAAS,gBAAgB,iBAAkB,CAAS,EACzD,OAAO,OAAO,KAAK,UAAU,KAAK,MAAO,CAAS,EAClD,KAAK,UAAU,EAEnB",
10
- "debugId": "1445A22D1A02267664756E2164756E21",
10
+ "debugId": "20B6F3D5A085093E64756E2164756E21",
11
11
  "names": []
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwatr/nitrobase-reference",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "Nitrobase is a blazingly fast, lightweight database built on JSON. It stores data entirely in memory for lightning-quick access, while also providing a JSON file backup for persistence. You can easily serve your data over the web using our high-performance accelerated Nginx server.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/Alwatr/alwatr",
11
11
  "directory": "pkg/nitrobase-old/reference"
12
12
  },
13
- "homepage": "https://github.com/Alwatr/alwatr/tree/main/pkg/nitrobase-old/reference#readme",
13
+ "homepage": "https://github.com/Alwatr/alwatr/tree/next/pkg/nitrobase-old/reference#readme",
14
14
  "bugs": "https://github.com/Alwatr/alwatr/issues",
15
15
  "exports": {
16
16
  ".": {
@@ -21,15 +21,15 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@alwatr/delay": "9.1.0",
25
- "@alwatr/logger": "9.1.0",
26
- "@alwatr/nitrobase-helper": "^9.1.0",
27
- "@alwatr/nitrobase-types": "^9.1.0",
28
- "@alwatr/type-helper": "9.1.0"
24
+ "@alwatr/delay": "9.1.1",
25
+ "@alwatr/logger": "9.1.1",
26
+ "@alwatr/nitrobase-helper": "^9.1.1",
27
+ "@alwatr/nitrobase-types": "^9.1.1",
28
+ "@alwatr/type-helper": "9.1.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@alwatr/nano-build": "9.1.0",
32
- "@alwatr/tsconfig-base": "9.1.0",
31
+ "@alwatr/nano-build": "9.1.1",
32
+ "@alwatr/tsconfig-base": "9.1.1",
33
33
  "@alwatr/type-helper": "workspace:*",
34
34
  "@types/node": "^25.5.0",
35
35
  "typescript": "^6.0.2"
@@ -74,5 +74,5 @@
74
74
  "typescript"
75
75
  ],
76
76
  "prettier": "@alwatr/nanolib/prettier-config",
77
- "gitHead": "4a25cd3e0499cf61dd761e87d3711abf9b0cd208"
77
+ "gitHead": "38fb79dd8b6cf48108ae6492ecd7a285c7633e9b"
78
78
  }