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,16 +1,140 @@
|
|
|
1
1
|
import { Concept, InnerActions } from "../../app";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
3
|
+
* Creates a connection in local storage (IndexedDB) without syncing to the backend.
|
|
4
|
+
*
|
|
5
|
+
* This is the primary function for creating offline-first connections. The connection is stored
|
|
6
|
+
* locally in IndexedDB and memory, but NOT immediately sent to the backend. Sync happens
|
|
7
|
+
* later via LocalSyncData.SyncDataOnline().
|
|
8
|
+
*
|
|
9
|
+
* **Virtual ID System:**
|
|
10
|
+
* - Generates a negative ID (e.g., -67890) 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 backend and LocalGhostIdTree
|
|
15
|
+
*
|
|
16
|
+
* **Connection Types:**
|
|
17
|
+
* - **Internal Connections**: orderId < 3 (within a composition)
|
|
18
|
+
* - typeId is typically the composition ID
|
|
19
|
+
* - **External Connections**: orderId >= 999 (between different entities)
|
|
20
|
+
* - typeId is a type concept ID
|
|
21
|
+
* - typeString provides human-readable type name
|
|
22
|
+
*
|
|
23
|
+
* **Self-Connection Prevention:**
|
|
24
|
+
* If ofTheConceptId equals toTheConceptId, returns an empty connection (prevents loops).
|
|
25
|
+
*
|
|
26
|
+
* @param ofTheConceptId - Source concept ID (FROM). The connection originates here.
|
|
27
|
+
* Can be negative (local) or positive (server) ID.
|
|
28
|
+
* @param toTheConceptId - Target concept ID (TO). The connection points here.
|
|
29
|
+
* Can be negative (local) or positive (server) ID.
|
|
30
|
+
* @param typeId - The type classification for this connection.
|
|
31
|
+
* - For internal connections: composition ID
|
|
32
|
+
* - For external connections: type concept ID
|
|
33
|
+
* @param orderId - Order identifier for sorting multiple connections.
|
|
34
|
+
* - < 3: Internal connection
|
|
35
|
+
* - >= 999: External connection
|
|
36
|
+
* - Defaults to 1
|
|
37
|
+
* @param typeString - Human-readable type name (e.g., "the_person_email").
|
|
38
|
+
* Used primarily for external connections. Defaults to empty string.
|
|
39
|
+
* @param userId - The ID of the user creating this connection. Defaults to 999 (system).
|
|
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 Connection object with negative ID.
|
|
44
|
+
* Returns empty connection (all IDs = 0) if self-connection attempted.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Create internal connection (within composition)
|
|
48
|
+
* const internalConn = await CreateTheConnectionLocal(
|
|
49
|
+
* projectId, // -12345
|
|
50
|
+
* taskId, // -67890
|
|
51
|
+
* compositionId,// -11111
|
|
52
|
+
* 1, // orderId < 3 = internal
|
|
53
|
+
* "", // no typeString needed
|
|
54
|
+
* 101 // userId
|
|
55
|
+
* );
|
|
56
|
+
* console.log(internalConn.id); // -99999 (negative = local)
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Create external connection (between entities)
|
|
60
|
+
* const externalConn = await CreateTheConnectionLocal(
|
|
61
|
+
* personId, // 123
|
|
62
|
+
* emailId, // 456
|
|
63
|
+
* emailTypeId, // 789
|
|
64
|
+
* 1000, // orderId >= 999 = external
|
|
65
|
+
* "the_person_email", // typeString for external
|
|
66
|
+
* 101
|
|
67
|
+
* );
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // Track actions for batch operations
|
|
71
|
+
* const actions = { concepts: [], connections: [] };
|
|
72
|
+
* await CreateTheConnectionLocal(id1, id2, typeId, 1, "", 101, actions);
|
|
73
|
+
* await CreateTheConnectionLocal(id2, id3, typeId, 1, "", 101, actions);
|
|
74
|
+
* console.log(actions.connections.length); // 2
|
|
75
|
+
* // All created connections tracked for potential rollback
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // Self-connection prevention
|
|
79
|
+
* const selfConn = await CreateTheConnectionLocal(123, 123, 5, 1);
|
|
80
|
+
* console.log(selfConn.id); // 0 (empty connection, prevented)
|
|
81
|
+
*
|
|
82
|
+
* @throws Logs errors and re-throws for handling by caller
|
|
83
|
+
*
|
|
84
|
+
* @see {@link CreateConnection} for simplified connection creation with concepts
|
|
85
|
+
* @see {@link LocalSyncData} for syncing local connections to backend
|
|
86
|
+
* @see {@link createTheConnection} for creating server-synced connections directly
|
|
14
87
|
*/
|
|
15
88
|
export declare function CreateTheConnectionLocal(ofTheConceptId: number, toTheConceptId: number, typeId: number, orderId?: number, typeString?: string, userId?: number, actions?: InnerActions): Promise<any>;
|
|
89
|
+
/**
|
|
90
|
+
* Simplified connection creator that accepts concepts and a type string.
|
|
91
|
+
*
|
|
92
|
+
* This is a convenience wrapper around CreateTheConnectionLocal that:
|
|
93
|
+
* 1. Accepts Concept objects instead of IDs
|
|
94
|
+
* 2. Creates the connection type concept if it doesn't exist
|
|
95
|
+
* 3. Extracts necessary IDs automatically
|
|
96
|
+
* 4. Sets appropriate defaults for local connections
|
|
97
|
+
*
|
|
98
|
+
* **Advantages:**
|
|
99
|
+
* - More intuitive API (pass concepts, not IDs)
|
|
100
|
+
* - Automatic type concept creation/retrieval
|
|
101
|
+
* - Less boilerplate code
|
|
102
|
+
* - Type-safe with TypeScript
|
|
103
|
+
*
|
|
104
|
+
* **Process:**
|
|
105
|
+
* 1. Creates/retrieves type concept from connectionTypeString
|
|
106
|
+
* 2. Extracts userId from source concept
|
|
107
|
+
* 3. Calls CreateTheConnectionLocal with extracted IDs
|
|
108
|
+
* 4. Returns the created connection
|
|
109
|
+
*
|
|
110
|
+
* @param ofTheConcept - The source Concept object (FROM)
|
|
111
|
+
* @param toTheConcept - The target Concept object (TO)
|
|
112
|
+
* @param connectionTypeString - Type name as string (e.g., "the_person_email").
|
|
113
|
+
* A type concept will be created if it doesn't exist.
|
|
114
|
+
* @param actions - Action tracking object for batch operations. Defaults to empty arrays.
|
|
115
|
+
*
|
|
116
|
+
* @returns Promise resolving to the created Connection object
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* // Simple usage with concepts
|
|
120
|
+
* const person = await CreateTheConceptLocal('Alice', 'the_person', 101, 1, 1, 2);
|
|
121
|
+
* const email = await CreateTheConceptLocal('alice@example.com', 'the_email', 101, 1, 2, 2);
|
|
122
|
+
*
|
|
123
|
+
* const connection = await CreateConnection(person, email, 'the_person_email');
|
|
124
|
+
* // Connection created with:
|
|
125
|
+
* // - ofTheConceptId: person.id
|
|
126
|
+
* // - toTheConceptId: email.id
|
|
127
|
+
* // - typeId: auto-generated from 'the_person_email'
|
|
128
|
+
* // - orderId: 1000 (external connection)
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* // With action tracking
|
|
132
|
+
* const actions = { concepts: [], connections: [] };
|
|
133
|
+
* const conn1 = await CreateConnection(concept1, concept2, 'links_to', actions);
|
|
134
|
+
* const conn2 = await CreateConnection(concept2, concept3, 'links_to', actions);
|
|
135
|
+
* console.log(actions.connections.length); // 2
|
|
136
|
+
*
|
|
137
|
+
* @see {@link CreateTheConnectionLocal} for the underlying implementation
|
|
138
|
+
* @see {@link MakeTheTypeConceptLocal} for type concept creation
|
|
139
|
+
*/
|
|
16
140
|
export declare function CreateConnection(ofTheConcept: Concept, toTheConcept: Concept, connectionTypeString: string, actions?: InnerActions): Promise<any>;
|
|
@@ -1 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deletes a concept from local storage (IndexedDB).
|
|
3
|
+
*
|
|
4
|
+
* This function removes a concept from LocalConceptsData, effectively deleting it
|
|
5
|
+
* from the local IndexedDB cache. This is a local-only delete - it does NOT sync
|
|
6
|
+
* the deletion to the backend.
|
|
7
|
+
*
|
|
8
|
+
* **Important Notes:**
|
|
9
|
+
* - Only deletes from local storage (IndexedDB)
|
|
10
|
+
* - Does NOT delete from backend server
|
|
11
|
+
* - Does NOT automatically delete related connections
|
|
12
|
+
* - For full deletion including backend, use DeleteConceptById
|
|
13
|
+
* - Works with both negative (local) and positive (synced) IDs
|
|
14
|
+
*
|
|
15
|
+
* **Use Cases:**
|
|
16
|
+
* - Cleaning up local draft concepts
|
|
17
|
+
* - Removing concepts before they're synced
|
|
18
|
+
* - Local cache management
|
|
19
|
+
* - Testing and development
|
|
20
|
+
*
|
|
21
|
+
* **Process:**
|
|
22
|
+
* 1. Fetches the concept via GetTheConceptLocal
|
|
23
|
+
* 2. Removes it from LocalConceptsData
|
|
24
|
+
* 3. Updates IndexedDB
|
|
25
|
+
*
|
|
26
|
+
* @param id - The concept ID to delete (negative for local, positive for synced)
|
|
27
|
+
*
|
|
28
|
+
* @returns Promise that resolves when deletion is complete
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Delete a local concept
|
|
32
|
+
* await DeleteConceptLocal(-12345);
|
|
33
|
+
* console.log("Local concept deleted");
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Delete after checking existence
|
|
37
|
+
* const concept = await GetTheConceptLocal(-67890);
|
|
38
|
+
* if (concept.id !== 0) {
|
|
39
|
+
* await DeleteConceptLocal(concept.id);
|
|
40
|
+
* console.log("Deleted:", concept.characterValue);
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* @see {@link DeleteConceptById} for full deletion including backend
|
|
44
|
+
* @see {@link GetTheConceptLocal} for retrieving concepts before deletion
|
|
45
|
+
* @see {@link LocalConceptsData.RemoveConcept} for the underlying removal operation
|
|
46
|
+
*/
|
|
1
47
|
export declare function DeleteConceptLocal(id: number): Promise<any>;
|
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Retrieves all compositions of a specific type from local storage.
|
|
3
|
+
*
|
|
4
|
+
* **Process Flow**:
|
|
5
|
+
* 1. Finds the type concept by compositionName (e.g., "the_project")
|
|
6
|
+
* 2. Queries all concepts with that typeId belonging to the user
|
|
7
|
+
* 3. Fetches full composition for each concept
|
|
8
|
+
* 4. Returns array of complete compositions
|
|
9
|
+
*
|
|
10
|
+
* @param compositionName - The type name of compositions to retrieve (e.g., "the_project", "the_person")
|
|
11
|
+
* @param userId - User ID to filter compositions by ownership
|
|
12
|
+
* @returns Array of composition objects (empty array if type not found)
|
|
13
|
+
* @throws Error if lookup or composition fetching fails
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Get all local projects for a user
|
|
17
|
+
* const projects = await GetCompositionListLocal("the_project", 101);
|
|
18
|
+
* // Returns: [{id: -1, data: {...}}, {id: -2, data: {...}}]
|
|
6
19
|
*/
|
|
7
20
|
export declare function GetCompositionListLocal(compositionName: string, userId: number): Promise<any>;
|
|
8
21
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
22
|
+
* Retrieves all compositions of a specific type with DATAID format (includes concept ID).
|
|
23
|
+
*
|
|
24
|
+
* Same as GetCompositionListLocal but returns compositions in data-id wrapper format,
|
|
25
|
+
* which includes both the composition data and its concept ID for easier reference.
|
|
26
|
+
*
|
|
27
|
+
* @param compositionName - The type name of compositions to retrieve
|
|
28
|
+
* @param userId - User ID to filter compositions by ownership
|
|
29
|
+
* @returns Array of composition objects in {id, data} format
|
|
30
|
+
* @throws Error if lookup or composition fetching fails
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Get all local projects with IDs
|
|
34
|
+
* const projects = await GetCompositionListLocalWithId("the_project", 101);
|
|
35
|
+
* // Returns: [{id: -1, data: {the_name: "Project A"}}, {id: -2, data: {...}}]
|
|
13
36
|
*/
|
|
14
37
|
export declare function GetCompositionListLocalWithId(compositionName: string, userId: number): Promise<any>;
|
|
@@ -1,2 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves a complete composition structure from local storage (IndexedDB).
|
|
3
|
+
*
|
|
4
|
+
* This function fetches a composition using local-only data, building a hierarchical
|
|
5
|
+
* structure from local connections and concepts. If the concept has been synced to the
|
|
6
|
+
* backend, it can automatically fall back to fetching from the server.
|
|
7
|
+
*
|
|
8
|
+
* **Process:**
|
|
9
|
+
* 1. Fetches all local connections for the composition
|
|
10
|
+
* 2. Identifies all connected concept IDs
|
|
11
|
+
* 3. Retrieves the main concept from LocalConceptsData
|
|
12
|
+
* 4. If concept not found locally, checks if it's been synced (TranslateLocalToReal)
|
|
13
|
+
* 5. Falls back to server GetComposition if concept is synced
|
|
14
|
+
* 6. Recursively builds composition tree from local data
|
|
15
|
+
* 7. Organizes output by concept type
|
|
16
|
+
*
|
|
17
|
+
* **Local vs Server:**
|
|
18
|
+
* - Prioritizes local data (IndexedDB)
|
|
19
|
+
* - Automatic fallback to server if concept synced
|
|
20
|
+
* - Uses LocalConnectionData for connections
|
|
21
|
+
* - Uses LocalConceptsData for concepts
|
|
22
|
+
*
|
|
23
|
+
* **Output Format (JUSTDATA):**
|
|
24
|
+
* Returns an object keyed by the main concept's type:
|
|
25
|
+
* ```
|
|
26
|
+
* {
|
|
27
|
+
* "Person": {
|
|
28
|
+
* name: "Alice",
|
|
29
|
+
* email: {...},
|
|
30
|
+
* projects: {...}
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param id - The concept ID (can be negative for local or positive for synced)
|
|
36
|
+
*
|
|
37
|
+
* @returns Promise resolving to composition data organized by concept type
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Get local composition
|
|
41
|
+
* const localComp = await GetCompositionLocal(-12345);
|
|
42
|
+
* console.log(localComp["Project"]);
|
|
43
|
+
* // Returns all data connected to this local project
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Get synced concept (automatically falls back to server)
|
|
47
|
+
* const syncedComp = await GetCompositionLocal(-67890);
|
|
48
|
+
* // If concept synced to server, fetches from there
|
|
49
|
+
*
|
|
50
|
+
* @throws Re-throws errors for handling by caller
|
|
51
|
+
*
|
|
52
|
+
* @see {@link GetCompositionLocalWithId} for composition with ID and data wrapper
|
|
53
|
+
* @see {@link GetComposition} for server-only composition retrieval
|
|
54
|
+
* @see {@link recursiveFetchLocal} for the recursive building logic
|
|
55
|
+
*/
|
|
1
56
|
export declare function GetCompositionLocal(id: number): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves a local composition with ID and data wrapper (DATAID format).
|
|
59
|
+
*
|
|
60
|
+
* This is a variant of GetCompositionLocal that returns the composition data
|
|
61
|
+
* wrapped in an object that includes both the data and the concept ID. This format
|
|
62
|
+
* is useful for tracking which concept the data belongs to.
|
|
63
|
+
*
|
|
64
|
+
* **Output Format (DATAID):**
|
|
65
|
+
* ```
|
|
66
|
+
* {
|
|
67
|
+
* data: {
|
|
68
|
+
* "Person": {
|
|
69
|
+
* name: "Alice",
|
|
70
|
+
* email: {...}
|
|
71
|
+
* }
|
|
72
|
+
* },
|
|
73
|
+
* id: 12345
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* **Differences from GetCompositionLocal:**
|
|
78
|
+
* - Returns { data, id } wrapper object
|
|
79
|
+
* - Same local data retrieval process
|
|
80
|
+
* - Same recursive building logic
|
|
81
|
+
* - No automatic server fallback
|
|
82
|
+
*
|
|
83
|
+
* @param id - The concept ID (negative for local, positive for synced)
|
|
84
|
+
*
|
|
85
|
+
* @returns Promise resolving to object with { data, id } structure
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* const result = await GetCompositionLocalWithId(-12345);
|
|
89
|
+
* console.log(result.id); // -12345
|
|
90
|
+
* console.log(result.data.Project); // Composition data
|
|
91
|
+
*
|
|
92
|
+
* @throws Re-throws errors for handling by caller
|
|
93
|
+
*
|
|
94
|
+
* @see {@link GetCompositionLocal} for standard format without ID wrapper
|
|
95
|
+
* @see {@link GetCompositionWithId} for server version
|
|
96
|
+
*/
|
|
2
97
|
export declare function GetCompositionLocalWithId(id: number): Promise<any>;
|
|
@@ -1,10 +1,56 @@
|
|
|
1
1
|
import { Concept } from "../../app";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a local concept by character value with typeId=51 (standard type).
|
|
4
|
+
*
|
|
5
|
+
* Simple lookup in LocalConceptsData for concepts matching the character value
|
|
6
|
+
* and having typeId of 51.
|
|
7
|
+
*
|
|
8
|
+
* @param characterValue - The character value to search for
|
|
9
|
+
* @returns Concept matching the character and type, or empty concept if not found
|
|
10
|
+
*/
|
|
2
11
|
export default function GetConceptByCharacterLocal(characterValue: string): Promise<Concept>;
|
|
3
12
|
/**
|
|
13
|
+
* Retrieves a local concept by character value, handling hierarchical type names.
|
|
4
14
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
15
|
+
* **Complex Logic**: For compound names (e.g., "the_person_email"):
|
|
16
|
+
* 1. Splits string by underscore
|
|
17
|
+
* 2. Recursively processes first part to get category ID
|
|
18
|
+
* 3. Searches using character value and derived category
|
|
19
|
+
* 4. Falls back to simple character search for single words
|
|
20
|
+
*
|
|
21
|
+
* **Special Case**: Returns concept with id=1 for character value "the".
|
|
22
|
+
*
|
|
23
|
+
* @param character - The character value to find (e.g., "the_status", "the_person_email")
|
|
24
|
+
* @returns Concept associated with the character value
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const concept = await GetConceptByCharacterAndCategoryLocal("the_person_email");
|
|
28
|
+
* // Splits into "the_person" (category) and searches with that context
|
|
7
29
|
*/
|
|
8
30
|
export declare function GetConceptByCharacterAndCategoryLocal(character: string): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves a concept by character value and category ID from local memory.
|
|
33
|
+
*
|
|
34
|
+
* Direct lookup in LocalConceptsData without server fallback.
|
|
35
|
+
*
|
|
36
|
+
* @param value - The character value to search for
|
|
37
|
+
* @param categoryId - The category ID to filter by
|
|
38
|
+
* @returns Concept matching the character and category, or empty concept if not found
|
|
39
|
+
*/
|
|
9
40
|
export declare function GetConceptByCategoryAndCharacterLocalMemory(value: string, categoryId: number): Promise<Concept>;
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves a concept by character value with automatic server fallback.
|
|
43
|
+
*
|
|
44
|
+
* **Complex Logic**:
|
|
45
|
+
* 1. First checks LocalConceptsData for existing concept
|
|
46
|
+
* 2. If not found (id==0 or null), fetches from server via GetLocalConceptByCharacterValue
|
|
47
|
+
* 3. After server fetch, rechecks LocalConceptsData (now populated)
|
|
48
|
+
* 4. Returns the concept or throws error
|
|
49
|
+
*
|
|
50
|
+
* Use this when you need guaranteed concept retrieval with server sync.
|
|
51
|
+
*
|
|
52
|
+
* @param characterValue - The character value to search for
|
|
53
|
+
* @returns Concept from local storage, fetching from server if needed
|
|
54
|
+
* @throws Error if server fetch fails
|
|
55
|
+
*/
|
|
10
56
|
export declare function GetConceptByCharacterLocalFull(characterValue: string): Promise<Concept>;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
import { Connection } from "../../app";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves all connections originating from a specific concept with a given type.
|
|
4
|
+
*
|
|
5
|
+
* Searches local storage (IndexedDB) for connections where:
|
|
6
|
+
* - ofTheConceptId matches the provided concept ID
|
|
7
|
+
* - typeId matches the provided type
|
|
8
|
+
*
|
|
9
|
+
* @param ofTheConcept - The source concept ID (connections originating from this concept)
|
|
10
|
+
* @param typeId - The connection type ID to filter by
|
|
11
|
+
* @param userId - User ID (currently not used in filtering)
|
|
12
|
+
* @returns Array of Connection objects matching the criteria (empty array if none found)
|
|
13
|
+
* @throws Error if local storage query fails
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Get all "has_property" connections from a person concept
|
|
17
|
+
* const connections = await GetConnectionOfTheConceptLocal(personId, 42, userId);
|
|
18
|
+
*/
|
|
2
19
|
export declare function GetConnectionOfTheConceptLocal(ofTheConcept: number, typeId: number, userId: number): Promise<Connection[]>;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves all related compositions from local storage by relation name.
|
|
3
|
+
*
|
|
4
|
+
* **Process Flow (Complex Logic)**:
|
|
5
|
+
* 1. Converts relation string to type concept (e.g., "the_email" → type concept)
|
|
6
|
+
* 2. Finds all connections from source concept with that relation type
|
|
7
|
+
* 3. For each connection, retrieves the target composition
|
|
8
|
+
* 4. Returns array of all related compositions
|
|
9
|
+
*
|
|
10
|
+
* @param id - The source concept ID to get relations from
|
|
11
|
+
* @param relation - The relation name (e.g., "the_email", "the_address")
|
|
12
|
+
* @param userId - User ID for permissions
|
|
13
|
+
* @returns Array of composition objects representing related entities
|
|
14
|
+
* @throws Error if relation lookup or composition retrieval fails
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Get all email addresses related to a person
|
|
18
|
+
* const emails = await GetRelationLocal(personId, "the_email", userId);
|
|
19
|
+
* // Returns: [emailComposition1, emailComposition2, ...]
|
|
20
|
+
*/
|
|
1
21
|
export declare function GetRelationLocal(id: number, relation: string, userId: number): Promise<any>;
|
|
@@ -1,9 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Retrieves a concept by ID with support for both local (virtual) and server concepts.
|
|
3
|
+
*
|
|
4
|
+
* This is the primary function for fetching concepts in offline/local mode. It intelligently
|
|
5
|
+
* handles three types of concept IDs and retrieves from appropriate sources:
|
|
6
|
+
*
|
|
7
|
+
* **ID Types Handled:**
|
|
8
|
+
* 1. **Negative IDs (Virtual/Local)**: Concepts created locally not yet synced
|
|
9
|
+
* - Stored in LocalConceptsData (IndexedDB)
|
|
10
|
+
* - Return negative IDs
|
|
11
|
+
*
|
|
12
|
+
* 2. **Synced Virtual IDs**: Originally local concepts now synced to backend
|
|
13
|
+
* - Looked up via LocalGhostIdTree (maps negative to positive IDs)
|
|
14
|
+
* - Returns positive (real) ID with ghostId reference
|
|
15
|
+
*
|
|
16
|
+
* 3. **Positive IDs (Server)**: Real backend concepts
|
|
17
|
+
* - Fetched via GetTheConcept from backend
|
|
18
|
+
* - Converted to LConcept format
|
|
19
|
+
* - May have undefined ghostId
|
|
20
|
+
*
|
|
21
|
+
* **Retrieval Strategy:**
|
|
22
|
+
* - If id < 0: Check LocalConceptsData → Check LocalGhostIdTree
|
|
23
|
+
* - If id >= 0: Fetch from backend → Convert to LConcept
|
|
24
|
+
* - Routes through service worker if enabled
|
|
25
|
+
* - Returns default empty concept if not found
|
|
26
|
+
*
|
|
27
|
+
* **Ghost ID System:**
|
|
28
|
+
* - ghostId: Original negative ID (preserved after sync)
|
|
29
|
+
* - id: Current ID (negative if local, positive if synced)
|
|
30
|
+
* - LocalGhostIdTree maintains the mapping
|
|
31
|
+
*
|
|
32
|
+
* @param id - The concept ID to retrieve. Can be:
|
|
33
|
+
* - Negative (e.g., -12345) for local-only concepts
|
|
34
|
+
* - Positive (e.g., 789) for server concepts
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise resolving to a Concept object in LConcept format.
|
|
37
|
+
* Returns default concept (id=0) if not found.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Get a local concept (negative ID)
|
|
41
|
+
* const localConcept = await GetTheConceptLocal(-12345);
|
|
42
|
+
* console.log(localConcept.id); // -12345
|
|
43
|
+
* console.log(localConcept.characterValue); // "Draft Note"
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Get a synced concept (originally local, now on server)
|
|
47
|
+
* const syncedConcept = await GetTheConceptLocal(-12345);
|
|
48
|
+
* console.log(syncedConcept.id); // 789 (now positive, synced)
|
|
49
|
+
* console.log(syncedConcept.ghostId); // -12345 (original ID preserved)
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Get a server concept
|
|
53
|
+
* const serverConcept = await GetTheConceptLocal(456);
|
|
54
|
+
* console.log(serverConcept.id); // 456
|
|
55
|
+
* // Converted to LConcept format for consistency
|
|
56
|
+
*
|
|
57
|
+
* @throws Logs errors but returns default concept instead of throwing
|
|
58
|
+
*
|
|
59
|
+
* @see {@link CreateTheConceptLocal} for creating local concepts
|
|
60
|
+
* @see {@link GetTheConcept} for fetching server concepts only
|
|
61
|
+
* @see {@link convertFromConceptToLConcept} for format conversion
|
|
8
62
|
*/
|
|
9
63
|
export declare function GetTheConceptLocal(id: number): Promise<any>;
|
|
@@ -1,2 +1,22 @@
|
|
|
1
1
|
import { InnerActions } from "../../app";
|
|
2
|
+
/**
|
|
3
|
+
* Gets or creates a local concept - implements get-or-create pattern.
|
|
4
|
+
*
|
|
5
|
+
* Checks LocalConceptsData for existing concept matching referent and typeId.
|
|
6
|
+
* If found, returns existing concept. If not found, creates new local concept.
|
|
7
|
+
*
|
|
8
|
+
* **Special Case**: If typeCharacter is "the", sets categoryId to 1 (system category).
|
|
9
|
+
*
|
|
10
|
+
* @param referent - The character value/name of the concept
|
|
11
|
+
* @param typeCharacter - Type name string (e.g., "the_name")
|
|
12
|
+
* @param userId - User ID creating the concept
|
|
13
|
+
* @param categoryId - Category classification ID
|
|
14
|
+
* @param typeId - Type classification ID
|
|
15
|
+
* @param actions - Action tracking for batch operations
|
|
16
|
+
* @returns Existing or newly created Concept
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const concept = await MakeTheConceptLocal("Active", "the_status", 101, 1, 5);
|
|
20
|
+
* // Returns existing "Active" status or creates new one
|
|
21
|
+
*/
|
|
2
22
|
export default function MakeTheConceptLocal(referent: string, typeCharacter: string, userId: number, categoryId: number, typeId: number, actions?: InnerActions): Promise<any>;
|