mftsccs-node 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1148 -11
- package/dist/bundle.js +1 -0
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +45 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +52 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +53 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +58 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +44 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +56 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +65 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +77 -0
- package/dist/types/Api/GetAiData.d.ts +37 -0
- package/dist/types/Api/GetAllConcepts.d.ts +43 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +46 -0
- package/dist/types/Api/GetAllConnections.d.ts +49 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +82 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +93 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +54 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +63 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +52 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +33 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +41 -0
- package/dist/types/Api/GetConcept.d.ts +49 -0
- package/dist/types/Api/GetConceptBulk.d.ts +71 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +78 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +49 -0
- package/dist/types/Api/GetConnection.d.ts +51 -0
- package/dist/types/Api/GetConnectionBulk.d.ts +48 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +52 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +58 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +37 -0
- package/dist/types/Api/GetReservedIds.d.ts +38 -0
- package/dist/types/Api/Login.d.ts +39 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +40 -0
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +42 -0
- package/dist/types/Api/RecursiveSearch.d.ts +44 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +48 -0
- package/dist/types/Api/Search/Search.d.ts +68 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +71 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +92 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +99 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +41 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +49 -0
- package/dist/types/Api/Session/CreateSession.d.ts +47 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +44 -0
- package/dist/types/Api/Signin.d.ts +51 -0
- package/dist/types/Api/Signup.d.ts +47 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +51 -0
- package/dist/types/Constants/ApiConstants.d.ts +249 -0
- package/dist/types/Constants/FormatConstants.d.ts +87 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +262 -0
- package/dist/types/DataStructures/BinaryCharacterTree.d.ts +227 -0
- package/dist/types/DataStructures/BinaryTree.d.ts +151 -0
- package/dist/types/DataStructures/BinaryTypeTree.d.ts +211 -0
- package/dist/types/DataStructures/CharacterRepository.d.ts +117 -0
- package/dist/types/DataStructures/Composition/Composition.d.ts +117 -0
- package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +114 -0
- package/dist/types/DataStructures/Composition/CompositionNode.d.ts +223 -0
- package/dist/types/DataStructures/Concept.d.ts +139 -0
- package/dist/types/DataStructures/ConceptData.d.ts +317 -0
- package/dist/types/DataStructures/ConceptsToDraw.d.ts +179 -0
- package/dist/types/DataStructures/Connection.d.ts +103 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +126 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +193 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +95 -0
- package/dist/types/DataStructures/ConnectionData.d.ts +209 -0
- package/dist/types/DataStructures/Count/CountInfo.d.ts +79 -0
- package/dist/types/DataStructures/FilterSearch.d.ts +93 -0
- package/dist/types/DataStructures/IdentifierFlags.d.ts +45 -0
- package/dist/types/DataStructures/Local/LConcept.d.ts +126 -0
- package/dist/types/DataStructures/Local/LConnection.d.ts +101 -0
- package/dist/types/DataStructures/Local/LNode.d.ts +217 -0
- package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +145 -0
- package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +147 -0
- package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +160 -0
- package/dist/types/DataStructures/Local/LocalConceptData.d.ts +114 -0
- package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +125 -0
- package/dist/types/DataStructures/Local/LocalSyncData.d.ts +103 -0
- package/dist/types/DataStructures/Node.d.ts +29 -0
- package/dist/types/DataStructures/PatcherStructure.d.ts +94 -0
- package/dist/types/DataStructures/ReferentInfo.d.ts +75 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +111 -0
- package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +236 -0
- package/dist/types/DataStructures/Responses/StandardResponses.d.ts +71 -0
- package/dist/types/DataStructures/Returner.d.ts +66 -0
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +187 -0
- package/dist/types/DataStructures/Search/SearchStructure.d.ts +78 -0
- package/dist/types/DataStructures/SearchQuery.d.ts +146 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +51 -0
- package/dist/types/DataStructures/Session/SessionData.d.ts +131 -0
- package/dist/types/DataStructures/SettingData.d.ts +37 -0
- package/dist/types/DataStructures/Settings.d.ts +31 -0
- package/dist/types/DataStructures/SigninModel.d.ts +54 -0
- package/dist/types/DataStructures/SignupModel.d.ts +54 -0
- package/dist/types/DataStructures/SyncData.d.ts +232 -0
- package/dist/types/DataStructures/TheCharacter.d.ts +100 -0
- package/dist/types/DataStructures/TheTexts.d.ts +106 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +320 -0
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +132 -0
- package/dist/types/DataStructures/User/UserNode.d.ts +150 -0
- package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
- package/dist/types/Database/NoIndexDb.d.ts +178 -0
- package/dist/types/Database/indexdblocal.d.ts +45 -0
- package/dist/types/Database/indexeddb.d.ts +46 -0
- package/dist/types/Drawing/ConceptDraw.d.ts +29 -0
- package/dist/types/Drawing/ConceptEvents.d.ts +47 -0
- package/dist/types/Helpers/CheckIfExists.d.ts +169 -0
- package/dist/types/Helpers/RemoveFromArray.d.ts +72 -0
- package/dist/types/Helpers/UniqueInsert.d.ts +29 -0
- package/dist/types/Services/CheckForConnectionDeletion.d.ts +193 -0
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +57 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +51 -0
- package/dist/types/Services/Common/RegexFunction.d.ts +29 -0
- package/dist/types/Services/Composition/BuildComposition.d.ts +40 -0
- package/dist/types/Services/Composition/CompositionCache.d.ts +93 -0
- package/dist/types/Services/Composition/CreateCompositionCache.d.ts +46 -0
- package/dist/types/Services/ConceptFinding/GetConceptByCharacterAndCategory.d.ts +5 -0
- package/dist/types/Services/Conversion/ConvertConcepts.d.ts +90 -0
- package/dist/types/Services/CreateBinaryTreeFromData.d.ts +39 -0
- package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +43 -0
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +211 -0
- package/dist/types/Services/CreateDefaultConcept.d.ts +117 -0
- package/dist/types/Services/CreateTheComposition.d.ts +103 -0
- package/dist/types/Services/CreateTheConcept.d.ts +184 -0
- package/dist/types/Services/CreateTheConnection.d.ts +61 -0
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +132 -0
- package/dist/types/Services/CreateTypeTreeFromData.d.ts +44 -0
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +60 -0
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +64 -0
- package/dist/types/Services/DeleteConcept.d.ts +137 -0
- package/dist/types/Services/DeleteConnection.d.ts +196 -0
- package/dist/types/Services/FindConeceptsFromConnection.d.ts +181 -0
- package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +159 -0
- package/dist/types/Services/GenerateHexNumber.d.ts +65 -0
- package/dist/types/Services/GetAccessIdOfUser.d.ts +0 -0
- package/dist/types/Services/GetComposition.d.ts +342 -0
- package/dist/types/Services/GetCompositionBulk.d.ts +259 -0
- package/dist/types/Services/GetCompositionList.d.ts +132 -0
- package/dist/types/Services/GetConceptByCharacter.d.ts +87 -0
- package/dist/types/Services/GetConnections.d.ts +74 -0
- package/dist/types/Services/GetDataFromIndexDb.d.ts +81 -0
- package/dist/types/Services/GetLink.d.ts +107 -0
- package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +102 -0
- package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +59 -0
- package/dist/types/Services/GetRelation.d.ts +167 -0
- package/dist/types/Services/GetTheConcept.d.ts +73 -0
- package/dist/types/Services/GetTheReferent.d.ts +76 -0
- package/dist/types/Services/InitializeSystem.d.ts +121 -0
- package/dist/types/Services/Local/CreateConnectionListFromDatat.d.ts +0 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +50 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +50 -0
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +55 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +61 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +72 -0
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +60 -0
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +58 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +105 -0
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +98 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +58 -0
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +73 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +91 -0
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +73 -0
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +103 -0
- package/dist/types/Services/MakeTheCharacter.d.ts +76 -0
- package/dist/types/Services/MakeTheCharacterData.d.ts +67 -0
- package/dist/types/Services/MakeTheConcept.d.ts +2 -0
- package/dist/types/Services/MakeTheInstanceConcept.d.ts +78 -0
- package/dist/types/Services/MakeTheLocalConcept.d.ts +0 -0
- package/dist/types/Services/MakeTheName.d.ts +83 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +70 -0
- package/dist/types/Services/MakeTheTypeConcept.d.ts +71 -0
- package/dist/types/Services/Mqtt/publishMessage.d.ts +28 -0
- package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
- package/dist/types/Services/PatchComposition.d.ts +107 -0
- package/dist/types/Services/Search/DataIdFormat.d.ts +104 -0
- package/dist/types/Services/Search/FormatData.d.ts +101 -0
- package/dist/types/Services/Search/JustIdFormat.d.ts +98 -0
- package/dist/types/Services/Search/SearchLinkInternal.d.ts +30 -0
- package/dist/types/Services/Search/SearchLinkMultiple.d.ts +61 -0
- package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +101 -0
- package/dist/types/Services/Search/orderingConnections.d.ts +36 -0
- package/dist/types/Services/Security/GetRequestHeader.d.ts +10 -0
- package/dist/types/Services/SplitStrings.d.ts +51 -0
- package/dist/types/Services/UpdateComposition.d.ts +125 -0
- package/dist/types/Services/User/UserTranslation.d.ts +108 -0
- package/dist/types/Services/View/ViewInternalData.d.ts +33 -0
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +159 -0
- package/dist/types/app.d.ts +162 -0
- package/package.json +1 -1
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SyncData module for managing synchronization of concepts and connections in CCS-JS.
|
|
3
|
+
* This module provides queuing and batch synchronization of local changes to the backend server,
|
|
4
|
+
* with support for transactional operations and rollback capabilities.
|
|
5
|
+
* @module DataStructures/SyncData
|
|
6
|
+
*/
|
|
7
|
+
import { Concept } from "./Concept";
|
|
8
|
+
import { Connection } from "./Connection";
|
|
9
|
+
import { InnerActions } from "./Transaction/Transaction";
|
|
10
|
+
/**
|
|
11
|
+
* Container for transactional sync data.
|
|
12
|
+
* Stores concepts and connections that are part of a transaction.
|
|
13
|
+
*/
|
|
14
|
+
type syncContainer = {
|
|
15
|
+
/** Unique transaction identifier */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Transaction data containing concepts and connections */
|
|
18
|
+
data: InnerActions;
|
|
19
|
+
/** ISO timestamp of when the transaction was created */
|
|
20
|
+
createdDate: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Manages synchronization of concepts and connections between local storage and backend.
|
|
24
|
+
* Provides queuing, batch processing, and transaction support for data synchronization.
|
|
25
|
+
*
|
|
26
|
+
* @class SyncData
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Add items to sync queue
|
|
30
|
+
* SyncData.AddConcept(myConcept);
|
|
31
|
+
* SyncData.AddConnection(myConnection);
|
|
32
|
+
*
|
|
33
|
+
* // Sync to backend
|
|
34
|
+
* await SyncData.SyncDataOnline();
|
|
35
|
+
*
|
|
36
|
+
* // Transaction support
|
|
37
|
+
* await SyncData.initializeTransaction("txn-123");
|
|
38
|
+
* await SyncData.markTransactionActions("txn-123", actions);
|
|
39
|
+
* await SyncData.SyncDataOnline("txn-123");
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* This class provides both immediate and batched synchronization modes.
|
|
44
|
+
* Transactions are automatically cleaned up after 7 days (604800000 ms).
|
|
45
|
+
*/
|
|
46
|
+
export declare class SyncData {
|
|
47
|
+
/** Queue of concepts waiting to be synchronized to backend */
|
|
48
|
+
static conceptsSyncArray: Concept[];
|
|
49
|
+
/** Queue of connections waiting to be synchronized to backend */
|
|
50
|
+
static connectionSyncArray: Connection[];
|
|
51
|
+
/** Collection of transactional sync operations */
|
|
52
|
+
static transactionCollections: syncContainer[];
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a concept already exists in the sync queue.
|
|
55
|
+
*
|
|
56
|
+
* @param {Concept} concept - The concept to check
|
|
57
|
+
* @returns {boolean} True if the concept is in the sync queue, false otherwise
|
|
58
|
+
*
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
static CheckContains(concept: Concept): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Removes all sync data related to a specific concept ID.
|
|
64
|
+
* Removes the concept and any connections that reference it.
|
|
65
|
+
*
|
|
66
|
+
* @param {number} id - The concept ID to remove from sync queues
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* SyncData.SyncDataDelete(123);
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Also removes connections where the concept appears as ofTheConceptId, toTheConceptId, or typeId.
|
|
75
|
+
*/
|
|
76
|
+
static SyncDataDelete(id: number): void;
|
|
77
|
+
/**
|
|
78
|
+
* Checks if a connection already exists in the sync queue.
|
|
79
|
+
*
|
|
80
|
+
* @param {Connection} connection - The connection to check
|
|
81
|
+
* @returns {boolean} True if the connection is in the sync queue, false otherwise
|
|
82
|
+
*
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
static CheckContainsConnection(connection: Connection): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Adds a concept to the synchronization queue.
|
|
88
|
+
*
|
|
89
|
+
* @param {Concept} concept - The concept to add to sync queue
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* SyncData.AddConcept(myConcept);
|
|
94
|
+
* // Later...
|
|
95
|
+
* await SyncData.SyncDataOnline();
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
static AddConcept(concept: Concept): void;
|
|
99
|
+
/**
|
|
100
|
+
* Removes a concept from the synchronization queue.
|
|
101
|
+
*
|
|
102
|
+
* @param {Concept} concept - The concept to remove from sync queue
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* SyncData.RemoveConcept(myConcept);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
static RemoveConcept(concept: Concept): void;
|
|
110
|
+
/**
|
|
111
|
+
* Adds a connection to the synchronization queue.
|
|
112
|
+
*
|
|
113
|
+
* @param {Connection} connection - The connection to add to sync queue
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* SyncData.AddConnection(myConnection);
|
|
118
|
+
* // Later...
|
|
119
|
+
* await SyncData.SyncDataOnline();
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
static AddConnection(connection: Connection): void;
|
|
123
|
+
/**
|
|
124
|
+
* Removes a connection from the synchronization queue.
|
|
125
|
+
*
|
|
126
|
+
* @param {Connection} connection - The connection to remove from sync queue
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* SyncData.RemoveConnection(myConnection);
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
static RemoveConnection(connection: Connection): void;
|
|
134
|
+
/**
|
|
135
|
+
* Synchronizes queued data to the backend server.
|
|
136
|
+
* Can sync either a specific transaction or all queued data.
|
|
137
|
+
*
|
|
138
|
+
* @param {string} [transactionId] - Optional transaction ID to sync specific transaction
|
|
139
|
+
* @returns {Promise<string>} Returns "done" when synchronization completes
|
|
140
|
+
* @throws {Error} If synchronization fails
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* // Sync all queued data
|
|
145
|
+
* await SyncData.SyncDataOnline();
|
|
146
|
+
*
|
|
147
|
+
* // Sync specific transaction
|
|
148
|
+
* await SyncData.SyncDataOnline("txn-123");
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* - If transactionId is provided, only that transaction is synced and removed from collection
|
|
153
|
+
* - Otherwise, all queued concepts and connections are synced
|
|
154
|
+
* - Automatically cleans up transactions older than 7 days (604800000 ms)
|
|
155
|
+
* - Adds data to permanent storage before sending to backend
|
|
156
|
+
*/
|
|
157
|
+
static SyncDataOnline(transactionId?: string): Promise<"done" | undefined>;
|
|
158
|
+
/**
|
|
159
|
+
* Initializes a new transaction container for tracking related changes.
|
|
160
|
+
*
|
|
161
|
+
* @param {string} transactionId - Unique identifier for the transaction
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* await SyncData.initializeTransaction("txn-123");
|
|
166
|
+
* // Make changes...
|
|
167
|
+
* await SyncData.markTransactionActions("txn-123", actions);
|
|
168
|
+
* await SyncData.SyncDataOnline("txn-123");
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @remarks
|
|
172
|
+
* Does nothing if a transaction with the same ID already exists.
|
|
173
|
+
* Creates an empty container with the current timestamp.
|
|
174
|
+
*/
|
|
175
|
+
static initializeTransaction(transactionId: string): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Marks specific actions as part of a transaction.
|
|
178
|
+
* Removes these actions from the general sync queues to prevent duplication.
|
|
179
|
+
*
|
|
180
|
+
* @param {string} transactionId - The transaction ID
|
|
181
|
+
* @param {InnerActions} actions - The concepts and connections to mark as part of transaction
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const actions = {
|
|
186
|
+
* concepts: [concept1, concept2],
|
|
187
|
+
* connections: [connection1, connection2]
|
|
188
|
+
* };
|
|
189
|
+
* await SyncData.markTransactionActions("txn-123", actions);
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
193
|
+
* - Updates the transaction container with the actions
|
|
194
|
+
* - Removes marked items from conceptsSyncArray and connectionSyncArray
|
|
195
|
+
* - Matches items by both id and ghostId to handle temporary IDs
|
|
196
|
+
*/
|
|
197
|
+
static markTransactionActions(transactionId: string, actions: InnerActions): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Rolls back a transaction by removing it from the transaction collection.
|
|
200
|
+
*
|
|
201
|
+
* @param {string} transactionId - The transaction ID to rollback
|
|
202
|
+
* @param {InnerActions} actions - The actions to rollback (currently unused)
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* await SyncData.rollbackTransaction("txn-123", actions);
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* Currently only removes the transaction from collection if it doesn't already exist.
|
|
211
|
+
* The logic may need review as it checks for existence before removal.
|
|
212
|
+
*/
|
|
213
|
+
static rollbackTransaction(transactionId: string, actions: InnerActions): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Synchronizes queued data to local IndexedDB storage only (not to backend).
|
|
216
|
+
*
|
|
217
|
+
* @returns {Promise<string>} Returns "done" when local sync completes
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* await SyncData.syncDataLocalDb();
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @remarks
|
|
225
|
+
* - Stores concepts to "localconcept" database
|
|
226
|
+
* - Stores connections to "localconnection" database
|
|
227
|
+
* - Clears the sync queues after storing
|
|
228
|
+
* - Used for offline persistence without backend sync
|
|
229
|
+
*/
|
|
230
|
+
static syncDataLocalDb(): Promise<string>;
|
|
231
|
+
}
|
|
232
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Character data structure for the CCS-JS system.
|
|
3
|
+
* @module DataStructures/TheCharacter
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents a character entity in the system with associated user, security, access, and session information.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* TheCharacter class encapsulates character data along with comprehensive metadata including
|
|
10
|
+
* user ownership, security credentials, access control, and session tracking. Each character
|
|
11
|
+
* maintains references to multiple user contexts for fine-grained authorization control.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const character = new TheCharacter(
|
|
16
|
+
* 1001, // userId
|
|
17
|
+
* "A", // data
|
|
18
|
+
* 5001, // securityId
|
|
19
|
+
* 1001, // securityUserId
|
|
20
|
+
* 6001, // accessId
|
|
21
|
+
* 1001, // accessUserId
|
|
22
|
+
* 7001, // sessionId
|
|
23
|
+
* 1001, // sessionUserId
|
|
24
|
+
* "2025-10-30T12:00:00Z", // entryTimestamp
|
|
25
|
+
* true // isNew
|
|
26
|
+
* );
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class TheCharacter {
|
|
30
|
+
/**
|
|
31
|
+
* Unique identifier for the character.
|
|
32
|
+
* @defaultValue 0
|
|
33
|
+
*/
|
|
34
|
+
id: number;
|
|
35
|
+
/**
|
|
36
|
+
* ID of the user who owns this character.
|
|
37
|
+
*/
|
|
38
|
+
userId: number;
|
|
39
|
+
/**
|
|
40
|
+
* The actual character data (typically a single character string).
|
|
41
|
+
*/
|
|
42
|
+
data: string;
|
|
43
|
+
/**
|
|
44
|
+
* Security level or security context identifier for this character.
|
|
45
|
+
*/
|
|
46
|
+
securityId: number;
|
|
47
|
+
/**
|
|
48
|
+
* User ID associated with the security context.
|
|
49
|
+
*/
|
|
50
|
+
securityUserId: number;
|
|
51
|
+
/**
|
|
52
|
+
* Access control identifier for this character.
|
|
53
|
+
*/
|
|
54
|
+
accessId: number;
|
|
55
|
+
/**
|
|
56
|
+
* User ID associated with the access control.
|
|
57
|
+
*/
|
|
58
|
+
accessUserId: number;
|
|
59
|
+
/**
|
|
60
|
+
* Session identifier tracking when this character was accessed.
|
|
61
|
+
*/
|
|
62
|
+
sessionId: number;
|
|
63
|
+
/**
|
|
64
|
+
* User ID associated with the session.
|
|
65
|
+
*/
|
|
66
|
+
sessionUserId: number;
|
|
67
|
+
/**
|
|
68
|
+
* Flag indicating whether this is a newly created character.
|
|
69
|
+
* @defaultValue false
|
|
70
|
+
*/
|
|
71
|
+
isNew: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new TheCharacter instance.
|
|
74
|
+
*
|
|
75
|
+
* @param userId - The ID of the user who owns this character
|
|
76
|
+
* @param data - The character data (will be converted to string)
|
|
77
|
+
* @param securityId - Security level or context identifier
|
|
78
|
+
* @param securityUserId - User ID for the security context
|
|
79
|
+
* @param accessId - Access control identifier
|
|
80
|
+
* @param accessUserId - User ID for access control
|
|
81
|
+
* @param sessionId - Session tracking identifier
|
|
82
|
+
* @param sessionUserId - User ID for the session
|
|
83
|
+
* @param entryTimestamp - Timestamp when the character was created/entered (currently unused in initialization)
|
|
84
|
+
* @param isNew - Whether this is a newly created character
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* The data parameter is explicitly converted to a string using template literals.
|
|
88
|
+
* The entryTimestamp parameter is accepted but not currently stored in the instance.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const char = new TheCharacter(
|
|
93
|
+
* 1, "X", 100, 1, 200, 1, 300, 1, "2025-10-30", true
|
|
94
|
+
* );
|
|
95
|
+
* console.log(char.data); // "X"
|
|
96
|
+
* console.log(char.isNew); // true
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
constructor(userId: number, data: string, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionId: number, sessionUserId: number, entryTimestamp: string, isNew: boolean);
|
|
100
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Text data structure for the CCS-JS system.
|
|
3
|
+
* @module DataStructures/TheTexts
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents a text entity in the system with comprehensive metadata and security tracking.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* TheTexts class encapsulates text data along with user ownership, security credentials,
|
|
10
|
+
* access control, session tracking, and timestamp information. This class is similar to
|
|
11
|
+
* TheCharacter but designed for longer text strings and includes an entry timestamp for
|
|
12
|
+
* temporal tracking. It provides complete audit trail capabilities through its multiple
|
|
13
|
+
* user context references.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const text = new TheTexts(
|
|
18
|
+
* 1001, // userId
|
|
19
|
+
* "Hello World", // data
|
|
20
|
+
* 5001, // securityId
|
|
21
|
+
* 1001, // securityUserId
|
|
22
|
+
* 6001, // accessId
|
|
23
|
+
* 1001, // accessUserId
|
|
24
|
+
* 7001, // sessionId
|
|
25
|
+
* 1001, // sessionUserId
|
|
26
|
+
* "2025-10-30T12:00:00Z", // entryTimestamp
|
|
27
|
+
* true // isNew
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class TheTexts {
|
|
32
|
+
/**
|
|
33
|
+
* Unique identifier for the text entity.
|
|
34
|
+
* @defaultValue 0
|
|
35
|
+
*/
|
|
36
|
+
id: number;
|
|
37
|
+
/**
|
|
38
|
+
* ID of the user who owns this text.
|
|
39
|
+
*/
|
|
40
|
+
userId: number;
|
|
41
|
+
/**
|
|
42
|
+
* The actual text data content.
|
|
43
|
+
*/
|
|
44
|
+
data: string;
|
|
45
|
+
/**
|
|
46
|
+
* Security level or security context identifier for this text.
|
|
47
|
+
*/
|
|
48
|
+
securityId: number;
|
|
49
|
+
/**
|
|
50
|
+
* User ID associated with the security context.
|
|
51
|
+
*/
|
|
52
|
+
securityUserId: number;
|
|
53
|
+
/**
|
|
54
|
+
* Access control identifier for this text.
|
|
55
|
+
*/
|
|
56
|
+
accessId: number;
|
|
57
|
+
/**
|
|
58
|
+
* User ID associated with the access control.
|
|
59
|
+
*/
|
|
60
|
+
accessUserId: number;
|
|
61
|
+
/**
|
|
62
|
+
* Session identifier tracking when this text was accessed.
|
|
63
|
+
*/
|
|
64
|
+
sessionId: number;
|
|
65
|
+
/**
|
|
66
|
+
* User ID associated with the session.
|
|
67
|
+
*/
|
|
68
|
+
sessionUserId: number;
|
|
69
|
+
/**
|
|
70
|
+
* ISO 8601 timestamp indicating when this text entry was created or modified.
|
|
71
|
+
*/
|
|
72
|
+
entryTimestamp: string;
|
|
73
|
+
/**
|
|
74
|
+
* Flag indicating whether this is a newly created text entry.
|
|
75
|
+
*/
|
|
76
|
+
isNew: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new TheTexts instance.
|
|
79
|
+
*
|
|
80
|
+
* @param userId - The ID of the user who owns this text
|
|
81
|
+
* @param data - The text content
|
|
82
|
+
* @param securityId - Security level or context identifier
|
|
83
|
+
* @param securityUserId - User ID for the security context
|
|
84
|
+
* @param accessId - Access control identifier
|
|
85
|
+
* @param accessUserId - User ID for access control
|
|
86
|
+
* @param sessionId - Session tracking identifier
|
|
87
|
+
* @param sessionUserId - User ID for the session
|
|
88
|
+
* @param entryTimestamp - ISO 8601 timestamp when the text was created/entered
|
|
89
|
+
* @param isNew - Whether this is a newly created text entry
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Unlike TheCharacter, this constructor stores the entryTimestamp property,
|
|
93
|
+
* making it suitable for temporal tracking and audit trails.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const text = new TheTexts(
|
|
98
|
+
* 1, "Sample text", 100, 1, 200, 1, 300, 1,
|
|
99
|
+
* new Date().toISOString(), true
|
|
100
|
+
* );
|
|
101
|
+
* console.log(text.data); // "Sample text"
|
|
102
|
+
* console.log(text.entryTimestamp); // "2025-10-30T12:00:00.000Z"
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
constructor(userId: number, data: string, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionId: number, sessionUserId: number, entryTimestamp: string, isNew: boolean);
|
|
106
|
+
}
|