mftsccs-browser 2.2.20-beta → 2.2.22-beta
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 +1073 -11
- package/dist/bundle.js +2 -0
- package/dist/bundle.js.LICENSE.txt +1 -0
- package/dist/main.bundle.js +1 -1
- package/dist/serviceWorker.bundle.js +1 -1
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +21 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +18 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +16 -0
- package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +25 -0
- package/dist/types/Api/Create/CreateTheGhostConnectionApi.d.ts +16 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +16 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +13 -0
- package/dist/types/Api/Delete/DeleteUserInBackend.d.ts +18 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +1 -0
- package/dist/types/Api/DeleteConnectionBulkApi.d.ts +19 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +19 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +19 -0
- package/dist/types/Api/GetAiData.d.ts +9 -0
- package/dist/types/Api/GetAllConcepts.d.ts +10 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +11 -0
- package/dist/types/Api/GetAllConnections.d.ts +10 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +20 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +20 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +10 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +10 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +11 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +10 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +12 -0
- package/dist/types/Api/GetConceptBulk.d.ts +10 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +14 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +10 -0
- package/dist/types/Api/GetConnection.d.ts +13 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +14 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +15 -0
- package/dist/types/Api/GetConnections/GetConnectionsByTypeApi.d.ts +12 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +9 -0
- package/dist/types/Api/GetReservedIds.d.ts +9 -0
- package/dist/types/Api/Images/GetImages.d.ts +14 -0
- package/dist/types/Api/Local/GetLocalConceptByCharacterValue.d.ts +11 -0
- package/dist/types/Api/Login.d.ts +77 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +13 -0
- package/dist/types/Api/Prototype/CreatePrototype.d.ts +12 -0
- package/dist/types/Api/Prototype/Selector.d.ts +11 -0
- package/dist/types/Api/RecursiveSearch.d.ts +61 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +16 -0
- package/dist/types/Api/Search/Search.d.ts +72 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +25 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +13 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +14 -0
- package/dist/types/Api/Search/SearchWithTypeAndLinker.d.ts +12 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +10 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +11 -0
- package/dist/types/Api/SearchConcept/GetTypeConceptByBulk.d.ts +13 -0
- package/dist/types/Api/Session/CreateSession.d.ts +14 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +11 -0
- package/dist/types/Api/Signin.d.ts +21 -0
- package/dist/types/Api/Signup.d.ts +53 -11
- package/dist/types/Api/Translate/TranslateLocalToReal.d.ts +10 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +14 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +1 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +30 -0
- package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +19 -0
- package/dist/types/Services/AccessControl/AccessControlService.d.ts +267 -0
- package/dist/types/Services/AccessControl/PermissionSet.d.ts +8 -0
- package/dist/types/Services/CreateTheConcept.d.ts +118 -0
- package/dist/types/Services/CreateTheConnection.d.ts +59 -6
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +13 -0
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +16 -0
- package/dist/types/Services/GetComposition.d.ts +64 -7
- package/dist/types/Services/GetTheConcept.d.ts +91 -4
- package/dist/types/Services/Local/ConvertFromLConceptToConcept.d.ts +39 -0
- package/dist/types/Services/Local/ConvertFromLConnectionToConnection.d.ts +45 -0
- package/dist/types/Services/Local/CreateConnectionBetweenTwoConceptsLocal.d.ts +41 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +44 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +6 -1
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +8 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +8 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +100 -10
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +80 -18
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +135 -11
- package/dist/types/Services/Local/DeleteConceptLocal.d.ts +46 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +31 -8
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +95 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +48 -2
- package/dist/types/Services/Local/GetConnectionOfTheConceptLocal.d.ts +17 -0
- package/dist/types/Services/Local/GetRelationLocal.d.ts +20 -0
- package/dist/types/Services/Local/GetTheConceptLocal.d.ts +60 -6
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +20 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +160 -14
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +29 -9
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +39 -0
- package/dist/types/Services/MakeTheLocalConcept.d.ts +0 -0
- package/dist/types/Services/MakeTheName.d.ts +2 -0
- package/dist/types/Services/auth/AuthService.d.ts +1 -0
- package/dist/types/Widgets/BaseObserver.d.ts +14 -11
- package/dist/types/Widgets/BaseWidget.d.ts +24 -11
- package/dist/types/Widgets/BuilderSpeceficFunctions.d.ts +9 -0
- package/dist/types/Widgets/BuilderStatefulWidget.d.ts +352 -2
- package/dist/types/Widgets/CacheWidget.service.d.ts +60 -0
- package/dist/types/Widgets/NormalizeStyles.service.d.ts +9 -0
- package/dist/types/Widgets/RenderPage.service.d.ts +9 -4
- package/dist/types/Widgets/RenderWidgetLibrary.service.d.ts +12 -4
- package/dist/types/Widgets/RenderWidgetService.d.ts +158 -21
- package/dist/types/Widgets/StatefulWidget.d.ts +94 -29
- package/dist/types/Widgets/WidgetBuild.d.ts +41 -0
- package/dist/types/Widgets/WidgetTree.d.ts +31 -0
- package/dist/types/Widgets/mainView.class.d.ts +21 -0
- package/dist/types/WrapperFunctions/DepenedencyObserver.d.ts +48 -27
- package/dist/types/WrapperFunctions/GetCompositionListObservable.d.ts +34 -2
- package/dist/types/WrapperFunctions/GetCompositionObservable.d.ts +24 -2
- package/dist/types/WrapperFunctions/GetLinkListObservable.d.ts +38 -9
- package/dist/types/WrapperFunctions/GetLinkObservable.d.ts +30 -12
- package/dist/types/WrapperFunctions/RecursiveSearchObservable.d.ts +34 -16
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +41 -5
- package/dist/types/WrapperFunctions/SearchLinkMultipleAllObservable.d.ts +24 -3
- package/dist/types/app.d.ts +183 -12
- package/package.json +1 -1
|
@@ -1,9 +1,96 @@
|
|
|
1
1
|
import { Concept } from "../DataStructures/Concept";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Retrieves a concept by its ID with intelligent caching and multi-source lookup.
|
|
4
|
+
*
|
|
5
|
+
* This is the primary function for fetching concepts in the system. It implements a sophisticated
|
|
6
|
+
* multi-level retrieval strategy:
|
|
7
|
+
*
|
|
8
|
+
* **Retrieval Strategy:**
|
|
9
|
+
* 1. Checks in-memory promise cache to prevent duplicate requests
|
|
10
|
+
* 2. For negative IDs: Fetches from local IndexedDB (LocalConceptsData)
|
|
11
|
+
* 3. For positive IDs: Checks local ConceptsData cache first
|
|
12
|
+
* 4. If not in cache: Fetches from backend API
|
|
13
|
+
* 5. Automatically resolves and attaches the concept's type information
|
|
14
|
+
* 6. Routes through service worker if enabled for better performance
|
|
15
|
+
*
|
|
16
|
+
* **Features:**
|
|
17
|
+
* - Promise caching prevents duplicate concurrent requests for the same concept
|
|
18
|
+
* - Automatic type resolution (fetches and attaches type concept)
|
|
19
|
+
* - Access tracking integration (increments access counter if enabled)
|
|
20
|
+
* - Service worker support for background processing
|
|
21
|
+
* - Error logging and performance monitoring
|
|
22
|
+
* - Supports both server concepts (positive IDs) and local concepts (negative IDs)
|
|
23
|
+
*
|
|
24
|
+
* @param id - The unique identifier of the concept to retrieve.
|
|
25
|
+
* Positive IDs = server concepts, Negative IDs = local-only concepts
|
|
26
|
+
* @param userId - The ID of the user requesting the concept. Used for access tracking
|
|
27
|
+
* and audit logging. Defaults to 999 (system/anonymous user)
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise resolving to the Concept object if found, or a default empty Concept if not found
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Get a server concept
|
|
33
|
+
* const concept = await GetTheConcept(12345, 101);
|
|
34
|
+
* console.log(concept.characterValue); // "Alice Smith"
|
|
35
|
+
* console.log(concept.type?.characterValue); // "Person" (auto-resolved)
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Get a local concept (negative ID)
|
|
39
|
+
* const localConcept = await GetTheConcept(-5, 101);
|
|
40
|
+
* console.log(localConcept.characterValue); // "Local Draft"
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Multiple concurrent calls use the same promise (efficient)
|
|
44
|
+
* const [c1, c2, c3] = await Promise.all([
|
|
45
|
+
* GetTheConcept(123),
|
|
46
|
+
* GetTheConcept(123), // Same ID - uses cached promise
|
|
47
|
+
* GetTheConcept(123) // Same ID - uses cached promise
|
|
48
|
+
* ]);
|
|
49
|
+
* // Only one actual fetch is performed
|
|
50
|
+
*
|
|
51
|
+
* @throws Will log errors but returns a default empty concept instead of throwing
|
|
52
|
+
*
|
|
53
|
+
* @see {@link CreateTheConcept} for creating new concepts
|
|
54
|
+
* @see {@link GetConceptBulk} for fetching multiple concepts efficiently
|
|
55
|
+
* @see {@link AddTypeConcept} for manually adding type information to a concept
|
|
7
56
|
*/
|
|
8
57
|
export default function GetTheConcept(id: number, userId?: number): Promise<Concept>;
|
|
58
|
+
/**
|
|
59
|
+
* Fetches and attaches type information to a concept if not already present.
|
|
60
|
+
*
|
|
61
|
+
* This utility function ensures that a concept has its type information loaded and attached.
|
|
62
|
+
* Every concept has a `typeId` that references another concept representing its type
|
|
63
|
+
* (e.g., a person concept might have typeId=1 which points to a "Person" type concept).
|
|
64
|
+
*
|
|
65
|
+
* **Process:**
|
|
66
|
+
* 1. Checks if concept.type is already set (if yes, does nothing)
|
|
67
|
+
* 2. Attempts to fetch type concept from local cache (ConceptsData)
|
|
68
|
+
* 3. If not in cache and typeId is valid: fetches from backend API
|
|
69
|
+
* 4. Attaches the type concept to concept.type property
|
|
70
|
+
* 5. Routes through service worker if enabled
|
|
71
|
+
*
|
|
72
|
+
* **Type Concept:**
|
|
73
|
+
* A type concept is a special concept that represents a classification or category.
|
|
74
|
+
* For example: "Person", "Document", "Organization" are type concepts.
|
|
75
|
+
*
|
|
76
|
+
* @param concept - The concept object to which type information should be added.
|
|
77
|
+
* The concept must have a valid `typeId` property.
|
|
78
|
+
*
|
|
79
|
+
* @returns Promise that resolves when type information has been attached (or confirmed present)
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const concept = await GetTheConcept(12345);
|
|
83
|
+
* console.log(concept.type); // might be null
|
|
84
|
+
*
|
|
85
|
+
* await AddTypeConcept(concept);
|
|
86
|
+
* console.log(concept.type?.characterValue); // "Person"
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Ensure multiple concepts have their types loaded
|
|
90
|
+
* const concepts = await GetConceptBulk([1, 2, 3, 4, 5]);
|
|
91
|
+
* await Promise.all(concepts.map(c => AddTypeConcept(c)));
|
|
92
|
+
* // All concepts now have their type information
|
|
93
|
+
*
|
|
94
|
+
* @see {@link GetTheConcept} which automatically calls this function
|
|
95
|
+
*/
|
|
9
96
|
export declare function AddTypeConcept(concept: Concept): Promise<Concept | undefined>;
|
|
@@ -1,2 +1,41 @@
|
|
|
1
1
|
import { Concept } from "../../DataStructures/Concept";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a local concept (LConcept) to a standard Concept format.
|
|
4
|
+
*
|
|
5
|
+
* This function is part of the local/server concept conversion system. Currently, it
|
|
6
|
+
* performs a passthrough as LConcept and Concept share the same structure. This function
|
|
7
|
+
* exists for:
|
|
8
|
+
* - API consistency and symmetry with convertFromConceptToLConcept
|
|
9
|
+
* - Future extensibility if conversion logic is needed
|
|
10
|
+
* - Type clarity in code (explicit conversion intent)
|
|
11
|
+
*
|
|
12
|
+
* **LConcept vs Concept:**
|
|
13
|
+
* - LConcept: Local-only concepts stored in IndexedDB (negative IDs)
|
|
14
|
+
* - Concept: Server-synced concepts (positive IDs)
|
|
15
|
+
* - Both use the same Concept class structure
|
|
16
|
+
*
|
|
17
|
+
* **When to Use:**
|
|
18
|
+
* - Preparing local concepts for backend sync
|
|
19
|
+
* - Converting local concepts to server format
|
|
20
|
+
* - Type-safe conversion in TypeScript
|
|
21
|
+
* - Maintaining code clarity and intent
|
|
22
|
+
*
|
|
23
|
+
* @param lconcept - The local concept to convert
|
|
24
|
+
*
|
|
25
|
+
* @returns The concept in standard Concept format (currently identical to input)
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Convert local concept before syncing
|
|
29
|
+
* const localConcept = await CreateTheConceptLocal('Draft', 'the_note', 101, 1, 3, 2);
|
|
30
|
+
* const serverConcept = ConvertFromLConceptToConcept(localConcept);
|
|
31
|
+
* // Now ready for backend sync
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Type-safe conversion
|
|
35
|
+
* const lconcepts = await GetAllLocalConcepts();
|
|
36
|
+
* const concepts = lconcepts.map(lc => ConvertFromLConceptToConcept(lc));
|
|
37
|
+
*
|
|
38
|
+
* @see {@link convertFromConceptToLConcept} for the reverse conversion
|
|
39
|
+
* @see {@link CreateTheConceptLocal} for creating local concepts
|
|
40
|
+
*/
|
|
2
41
|
export declare function ConvertFromLConceptToConcept(lconcept: Concept): Concept;
|
|
@@ -1,2 +1,47 @@
|
|
|
1
1
|
import { Connection } from "../../DataStructures/Connection";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a local connection (LConnection) to a standard Connection format.
|
|
4
|
+
*
|
|
5
|
+
* This function extracts the essential properties from a local connection and creates
|
|
6
|
+
* a new Connection object. It's part of the local/server conversion system used when
|
|
7
|
+
* preparing local connections for backend sync.
|
|
8
|
+
*
|
|
9
|
+
* **Properties Transferred:**
|
|
10
|
+
* - id: Connection identifier
|
|
11
|
+
* - ofTheConceptId: Source concept ID
|
|
12
|
+
* - toTheConceptId: Target concept ID
|
|
13
|
+
* - typeId: Connection type ID
|
|
14
|
+
* - orderId: Order for sorting connections
|
|
15
|
+
*
|
|
16
|
+
* **LConnection vs Connection:**
|
|
17
|
+
* - LConnection: Local-only connections stored in IndexedDB (negative IDs)
|
|
18
|
+
* - Connection: Server-synced connections (positive IDs)
|
|
19
|
+
* - Both use the same Connection class structure
|
|
20
|
+
*
|
|
21
|
+
* **Use Cases:**
|
|
22
|
+
* - Preparing local connections for backend sync
|
|
23
|
+
* - Converting local data to server format
|
|
24
|
+
* - Data export and serialization
|
|
25
|
+
* - Maintaining consistency across local and server data
|
|
26
|
+
*
|
|
27
|
+
* @param lconnection - The local connection to convert
|
|
28
|
+
*
|
|
29
|
+
* @returns A new Connection object with properties copied from the local connection
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Convert local connection before syncing
|
|
33
|
+
* const localConn = await CreateTheConnectionLocal(fromId, toId, typeId, 1);
|
|
34
|
+
* const serverConn = ConvertFromLConnectionToConnection(localConn);
|
|
35
|
+
* // Now ready for backend sync
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Batch conversion
|
|
39
|
+
* const localConnections = await GetAllLocalConnections();
|
|
40
|
+
* const serverConnections = localConnections.map(lc =>
|
|
41
|
+
* ConvertFromLConnectionToConnection(lc)
|
|
42
|
+
* );
|
|
43
|
+
*
|
|
44
|
+
* @see {@link CreateTheConnectionLocal} for creating local connections
|
|
45
|
+
* @see {@link ConvertFromLConceptToConcept} for concept conversion
|
|
46
|
+
*/
|
|
2
47
|
export declare function ConvertFromLConnectionToConnection(lconnection: Connection): Connection;
|
|
@@ -1,3 +1,44 @@
|
|
|
1
1
|
import { Concept } from "../../app";
|
|
2
2
|
import { InnerActions } from "../../Constants/general.const";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a named connection between two concepts with optional bidirectional linking.
|
|
5
|
+
*
|
|
6
|
+
* **Complex Naming Logic**:
|
|
7
|
+
* - Forward connection type: "{ofType}_s_{linker}_s" (e.g., "person_s_knows_s")
|
|
8
|
+
* - Backward connection type: "{toType}_s_{linker}_by" (e.g., "person_s_knows_by")
|
|
9
|
+
* - Uses type.characterValue from concepts to build meaningful connection names
|
|
10
|
+
*
|
|
11
|
+
* **Bidirectional Mode (both=true)**:
|
|
12
|
+
* - Creates two connections: A→B and B→A
|
|
13
|
+
* - Forward: ofTheConcept → toTheConcept with "{ofType}_s_{linker}_s"
|
|
14
|
+
* - Backward: toTheConcept → ofTheConcept with "{toType}_s_{linker}_by"
|
|
15
|
+
*
|
|
16
|
+
* @param ofTheConcept - Source concept (connection starts here)
|
|
17
|
+
* @param toTheConcept - Target concept (connection points here)
|
|
18
|
+
* @param linker - Relationship name (e.g., "knows", "works_at", "has")
|
|
19
|
+
* @param both - If true, creates bidirectional connection (both A→B and B→A)
|
|
20
|
+
* @param actions - Action tracking for batch operations
|
|
21
|
+
* @returns The forward connection object
|
|
22
|
+
* @throws Error if connection creation fails
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Create unidirectional "Alice knows Bob"
|
|
26
|
+
* const conn = await CreateConnectionBetweenTwoConceptsLocal(
|
|
27
|
+
* aliceConcept,
|
|
28
|
+
* bobConcept,
|
|
29
|
+
* "knows",
|
|
30
|
+
* false
|
|
31
|
+
* );
|
|
32
|
+
* // Creates: person_s_knows_s connection from Alice to Bob
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Create bidirectional "Alice friends Bob" (both directions)
|
|
36
|
+
* await CreateConnectionBetweenTwoConceptsLocal(
|
|
37
|
+
* aliceConcept,
|
|
38
|
+
* bobConcept,
|
|
39
|
+
* "friends",
|
|
40
|
+
* true
|
|
41
|
+
* );
|
|
42
|
+
* // Creates: person_s_friends_s (Alice→Bob) AND person_s_friends_by (Bob→Alice)
|
|
43
|
+
*/
|
|
3
44
|
export declare function CreateConnectionBetweenTwoConceptsLocal(ofTheConcept: Concept, toTheConcept: Concept, linker: string, both?: boolean, actions?: InnerActions): Promise<any>;
|
|
@@ -1,2 +1,46 @@
|
|
|
1
1
|
import { Concept } from "../../DataStructures/Concept";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a default empty local concept with all properties set to zero/default values.
|
|
4
|
+
*
|
|
5
|
+
* This utility function generates a blank Concept object that can be used as a placeholder
|
|
6
|
+
* or default return value when a concept is not found. All IDs and values are set to 0
|
|
7
|
+
* or empty defaults.
|
|
8
|
+
*
|
|
9
|
+
* **Default Values:**
|
|
10
|
+
* - id: 0 (indicates empty/not found)
|
|
11
|
+
* - userId: 0
|
|
12
|
+
* - typeId: 0
|
|
13
|
+
* - categoryId: 0
|
|
14
|
+
* - referentId: 0
|
|
15
|
+
* - characterValue: "0"
|
|
16
|
+
* - accessId: 0
|
|
17
|
+
* - isNew: false
|
|
18
|
+
* - entryTimeStamp: current date
|
|
19
|
+
* - updatedTimeStamp: current date
|
|
20
|
+
* - typeCharacter: "0"
|
|
21
|
+
*
|
|
22
|
+
* **Use Cases:**
|
|
23
|
+
* - Default return value when concept not found
|
|
24
|
+
* - Placeholder for conditional logic
|
|
25
|
+
* - Initial state before loading data
|
|
26
|
+
* - Template for creating new concepts
|
|
27
|
+
*
|
|
28
|
+
* @returns A Concept object with all properties set to default/zero values
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Use as default return
|
|
32
|
+
* let concept = await GetTheConceptLocal(id);
|
|
33
|
+
* if (concept.id === 0) {
|
|
34
|
+
* concept = CreateDefaultLConcept();
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Check if concept is valid
|
|
39
|
+
* const concept = CreateDefaultLConcept();
|
|
40
|
+
* console.log(concept.id); // 0
|
|
41
|
+
* console.log(concept.characterValue); // "0"
|
|
42
|
+
*
|
|
43
|
+
* @see {@link CreateTheConceptLocal} for creating actual local concepts
|
|
44
|
+
* @see {@link GetTheConceptLocal} for retrieving local concepts
|
|
45
|
+
*/
|
|
2
46
|
export declare function CreateDefaultLConcept(): Concept;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Loads local concepts from IndexedDB into memory-based binary tree for fast lookup.
|
|
3
|
+
*
|
|
4
|
+
* Retrieves all stored local concepts from IndexedDB and adds them to LocalConceptsData
|
|
5
|
+
* in-memory structure. Sets flags indicating local data is ready for use.
|
|
6
|
+
*
|
|
7
|
+
* @throws Error if IndexedDB read fails (retries after 2s delay)
|
|
3
8
|
*/
|
|
4
9
|
export default function CreateLocalBinaryTreeFromIndexDb(): Promise<void>;
|
|
5
10
|
/**
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a binary search tree indexed by typeId for fast type-based concept lookup.
|
|
3
|
+
*
|
|
4
|
+
* Loads all local concepts from IndexedDB and organizes them into a binary tree
|
|
5
|
+
* structure where each node is keyed by typeId. Enables O(log n) lookups by type.
|
|
6
|
+
*
|
|
7
|
+
* @throws Error if IndexedDB read or tree construction fails
|
|
8
|
+
*/
|
|
1
9
|
export declare function CreateLocalBinaryTypeTreeFromData(): Promise<void>;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a binary search tree indexed by characterValue for fast text-based concept lookup.
|
|
3
|
+
*
|
|
4
|
+
* Loads all local concepts from IndexedDB and organizes them into a binary tree
|
|
5
|
+
* structure where each node is keyed by characterValue. Enables O(log n) lookups by text.
|
|
6
|
+
*
|
|
7
|
+
* @throws Error if IndexedDB read or tree construction fails
|
|
8
|
+
*/
|
|
1
9
|
export declare function CreateLocalCharacterBinaryTreeFromData(): Promise<void>;
|
|
@@ -1,14 +1,104 @@
|
|
|
1
1
|
import { InnerActions } from "../../app";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
3
|
+
* Converts a JSON object into a local composition structure with concepts and connections.
|
|
4
|
+
*
|
|
5
|
+
* This powerful function recursively transforms any JSON object into the concept-connection
|
|
6
|
+
* system, creating local concepts for each key-value pair and establishing connections
|
|
7
|
+
* between them to preserve the hierarchical structure.
|
|
8
|
+
*
|
|
9
|
+
* **JSON to Composition Conversion:**
|
|
10
|
+
* - JSON keys become type concepts (e.g., "name", "email")
|
|
11
|
+
* - JSON string/number values become instance concepts
|
|
12
|
+
* - Nested objects/arrays create sub-compositions
|
|
13
|
+
* - Connections preserve parent-child relationships
|
|
14
|
+
* - All data stored locally (IndexedDB) for offline use
|
|
15
|
+
*
|
|
16
|
+
* **Recursive Process:**
|
|
17
|
+
* 1. Iterates through each key in JSON object
|
|
18
|
+
* 2. For nested objects/arrays: Creates composition concept + recurse
|
|
19
|
+
* 3. For primitive values: Creates instance concept
|
|
20
|
+
* 4. Creates connections from parent to child concepts
|
|
21
|
+
* 5. Returns the main/root concept
|
|
22
|
+
*
|
|
23
|
+
* **Example Transformation:**
|
|
24
|
+
* ```javascript
|
|
25
|
+
* Input JSON:
|
|
26
|
+
* {
|
|
27
|
+
* name: "Alice",
|
|
28
|
+
* email: "alice@example.com",
|
|
29
|
+
* address: {
|
|
30
|
+
* city: "NYC",
|
|
31
|
+
* zip: "10001"
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* Creates:
|
|
36
|
+
* - Concept: "name" (type) → "Alice" (instance)
|
|
37
|
+
* - Concept: "email" (type) → "alice@example.com" (instance)
|
|
38
|
+
* - Concept: "address" (composition concept)
|
|
39
|
+
* - Concept: "city" → "NYC"
|
|
40
|
+
* - Concept: "zip" → "10001"
|
|
41
|
+
* - Connections linking all concepts in hierarchy
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param json - The JSON object/array to convert to composition structure.
|
|
45
|
+
* Can be any depth of nesting.
|
|
46
|
+
* @param ofTheConceptId - Parent concept ID if this is a sub-composition.
|
|
47
|
+
* Null for root composition. Used for connecting to parent.
|
|
48
|
+
* @param ofTheConceptUserId - User ID of the parent concept.
|
|
49
|
+
* Used for ownership tracking in nested structures.
|
|
50
|
+
* @param mainKey - The main composition ID (root concept ID).
|
|
51
|
+
* Used as typeId for internal connections. Null for root.
|
|
52
|
+
* @param userId - User ID of the creator. Defaults to 999 (system).
|
|
53
|
+
* @param accessId - Access control level. Defaults to 999 (system).
|
|
54
|
+
* @param sessionInformationId - Session ID. Defaults to 999 (system).
|
|
55
|
+
* @param automaticSync - Reserved for future automatic sync feature.
|
|
56
|
+
* Currently not fully implemented.
|
|
57
|
+
* @param actions - Action tracking object that accumulates all created concepts
|
|
58
|
+
* and connections for batch operations. Defaults to empty arrays.
|
|
59
|
+
*
|
|
60
|
+
* @returns Promise resolving to the main/root Concept of the composition
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Simple flat object
|
|
64
|
+
* const json = { name: "Alice", age: 30 };
|
|
65
|
+
* const mainConcept = await CreateTheCompositionLocal(
|
|
66
|
+
* json,
|
|
67
|
+
* null, // No parent
|
|
68
|
+
* null,
|
|
69
|
+
* null,
|
|
70
|
+
* 101, // userId
|
|
71
|
+
* 2, // accessId
|
|
72
|
+
* 999
|
|
73
|
+
* );
|
|
74
|
+
* console.log(mainConcept.id); // Root concept ID
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Nested object with action tracking
|
|
78
|
+
* const actions = { concepts: [], connections: [] };
|
|
79
|
+
* const userData = {
|
|
80
|
+
* profile: {
|
|
81
|
+
* firstName: "Alice",
|
|
82
|
+
* lastName: "Smith"
|
|
83
|
+
* },
|
|
84
|
+
* settings: {
|
|
85
|
+
* theme: "dark"
|
|
86
|
+
* }
|
|
87
|
+
* };
|
|
88
|
+
* const root = await CreateTheCompositionLocal(
|
|
89
|
+
* userData,
|
|
90
|
+
* null, null, null,
|
|
91
|
+
* 101, 2, 999,
|
|
92
|
+
* false,
|
|
93
|
+
* actions
|
|
94
|
+
* );
|
|
95
|
+
* console.log(actions.concepts.length); // Total concepts created
|
|
96
|
+
* console.log(actions.connections.length); // Total connections created
|
|
97
|
+
*
|
|
98
|
+
* @throws Logs errors but does not throw. Returns created concepts even on partial failure.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link MakeTheInstanceConceptLocal} for individual concept creation
|
|
101
|
+
* @see {@link CreateTheConnectionLocal} for connection creation
|
|
102
|
+
* @see {@link GetCompositionLocal} for retrieving created compositions
|
|
13
103
|
*/
|
|
14
104
|
export declare function CreateTheCompositionLocal(json: any, ofTheConceptId?: number | null, ofTheConceptUserId?: number | null, mainKey?: number | null, userId?: number | null, accessId?: number | null, sessionInformationId?: number | null, automaticSync?: boolean, actions?: InnerActions): Promise<any>;
|
|
@@ -1,22 +1,84 @@
|
|
|
1
1
|
import { InnerActions } from "../../app";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
3
|
+
* Creates a concept in local storage (IndexedDB) without syncing to the backend.
|
|
4
|
+
*
|
|
5
|
+
* This is the primary function for creating offline-first concepts. The concept is stored
|
|
6
|
+
* locally in IndexedDB and memory, but NOT immediately sent to the backend. Sync happens
|
|
7
|
+
* later via the LocalSyncData class.
|
|
8
|
+
*
|
|
9
|
+
* **Virtual ID System:**
|
|
10
|
+
* - Generates a negative ID (e.g., -12345) to indicate local/virtual status
|
|
11
|
+
* - id and ghostId are initially equal and both negative
|
|
12
|
+
* - After backend sync: id becomes positive (real backend ID)
|
|
13
|
+
* - ghostId remains negative (preserves original local ID)
|
|
14
|
+
* - Mapping is stored in LocalGhostIdTree for future lookups
|
|
15
|
+
*
|
|
16
|
+
* **Sync Process:**
|
|
17
|
+
* 1. Create locally with negative ID
|
|
18
|
+
* 2. Use LocalSyncData to sync to backend
|
|
19
|
+
* 3. Backend returns positive ID
|
|
20
|
+
* 4. Update local concept with positive ID
|
|
21
|
+
* 5. Preserve negative ID as ghostId
|
|
22
|
+
* 6. Store mapping in LocalGhostIdTree
|
|
23
|
+
*
|
|
24
|
+
* **Special Case:**
|
|
25
|
+
* If referent is "the", returns a special concept with id=1 (system concept).
|
|
26
|
+
*
|
|
27
|
+
* @param referent - The character value (text/name) of the concept.
|
|
28
|
+
* This is the human-readable content (e.g., "Draft Note", "Local Task")
|
|
29
|
+
* @param typecharacter - The type name as a string (e.g., "the_note", "the_person").
|
|
30
|
+
* Used for display and classification.
|
|
31
|
+
* @param userId - The ID of the user creating this concept. Used for ownership.
|
|
32
|
+
* @param categoryId - The category classification ID for further classification within type.
|
|
33
|
+
* @param typeId - The type classification ID. Must correspond to typecharacter.
|
|
34
|
+
* @param accessId - Access control level (e.g., 1=Public, 2=Private).
|
|
35
|
+
* Usually matches the user's access level.
|
|
36
|
+
* @param isComposition - Set to true if this concept represents a composition root.
|
|
37
|
+
* Defaults to false.
|
|
38
|
+
* @param referentId - Optional reference to another concept ID. Used for instance relationships.
|
|
39
|
+
* Defaults to 0 (no reference).
|
|
40
|
+
* @param actions - Action tracking object that accumulates created concepts and connections.
|
|
41
|
+
* Used for batch operations and rollback. Defaults to empty arrays.
|
|
42
|
+
*
|
|
43
|
+
* @returns Promise resolving to the created Concept object with negative ID
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Create a local draft note
|
|
47
|
+
* const draftNote = await CreateTheConceptLocal(
|
|
48
|
+
* "Meeting Notes - Draft", // referent
|
|
49
|
+
* "the_note", // typecharacter
|
|
50
|
+
* 101, // userId
|
|
51
|
+
* 1, // categoryId
|
|
52
|
+
* 3, // typeId
|
|
53
|
+
* 2 // accessId (Private)
|
|
54
|
+
* );
|
|
55
|
+
* console.log(draftNote.id); // -12345 (negative = local)
|
|
56
|
+
* console.log(draftNote.ghostId); // -12345 (same initially)
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Create with composition flag
|
|
60
|
+
* const project = await CreateTheConceptLocal(
|
|
61
|
+
* "Local Project",
|
|
62
|
+
* "the_project",
|
|
63
|
+
* 101,
|
|
64
|
+
* 1,
|
|
65
|
+
* 5,
|
|
66
|
+
* 2,
|
|
67
|
+
* true // isComposition = true
|
|
68
|
+
* );
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Track actions for batch operations
|
|
72
|
+
* const actions = { concepts: [], connections: [] };
|
|
73
|
+
* const concept1 = await CreateTheConceptLocal("Item 1", "the_item", 101, 1, 4, 2, false, 0, actions);
|
|
74
|
+
* const concept2 = await CreateTheConceptLocal("Item 2", "the_item", 101, 1, 4, 2, false, 0, actions);
|
|
75
|
+
* console.log(actions.concepts.length); // 2
|
|
76
|
+
* // All created concepts tracked in actions array
|
|
77
|
+
*
|
|
78
|
+
* @throws Logs errors and re-throws for handling by caller
|
|
79
|
+
*
|
|
80
|
+
* @see {@link GetTheConceptLocal} for retrieving local concepts
|
|
81
|
+
* @see {@link LocalSyncData} for syncing local concepts to backend
|
|
82
|
+
* @see {@link CreateTheConcept} for creating server-synced concepts directly
|
|
21
83
|
*/
|
|
22
84
|
export default function CreateTheConceptLocal(referent: string, typecharacter: string, userId: number, categoryId: number, typeId: number, accessId: number, isComposition?: boolean, referentId?: number | null, actions?: InnerActions): Promise<any>;
|