import { Concept, InnerActions } from "../../app"; import { FetchConnectionQuery } from "../../DataStructures/FetchConnection"; export declare class LocalTransaction { protected transactionId: string; actions: InnerActions; protected success: boolean; protected pendingConnectionDeletions: number[]; constructor(); /** * Method to initialize the transactions for specified transaction */ initialize(): Promise; /** * Method to commi the created Transactions */ commitTransaction(): Promise; commitTransactionWithoutAuth(): Promise; /** * Method to rollback all the tranctions occured */ rollbackTransaction(): Promise; /** * Method to move concepts and connection to transaction collection * @param concept Concept */ protected markAction(): Promise; protected flushPendingConnectionDeletions(): Promise; /** * Deletions */ /** * Queries the backend for connections matching the given criteria and queues all * returned connection IDs for batched bulk deletion when commitTransaction() is called. * * **Nothing is deleted until commitTransaction() is called.** * Calling rollbackTransaction() discards the queue without touching the backend. * * Supported query permutations: * 1. `ofTheConceptId` + `toTheConceptId` + `type` — connections between two specific concepts * 2. `ofTheConceptId` + `type` — all connections FROM a concept of that type * 3. `toTheConceptId` + `type` — all connections TO a concept of that type * 4. `typeId` + `isComposition: true` — all internal connections of a composition * * For multiple queries in one go use {@link DeleteConnectionsBetweenBulk} — it sends * all queries in a single HTTP request. * * @param query - Partial FetchConnectionQuery with only the fields relevant to your permutation. * @returns The connection IDs queued for deletion by this call. * * @example * // Delete all connections of type "the_project_s_page" from concept 103927382 * const ids = await transaction.DeleteConnectionsBetween({ * ofTheConceptId: 103927382, * type: "the_project_s_page" * }); * await transaction.commitTransaction(); // deletion fires here * * @example * // Delete connections between two specific concepts * await transaction.DeleteConnectionsBetween({ * ofTheConceptId: 103927382, * toTheConceptId: 103927389, * type: "the_project_s_page" * }); * * @example * // Delete all internal connections of a composition * await transaction.DeleteConnectionsBetween({ * typeId: 101490186, * isComposition: true * }); * * @see {@link DeleteConnectionsBetweenBulk} for sending multiple queries in one HTTP request * @see {@link commitTransaction} where the queued deletions are executed in 300-id batches */ DeleteConnectionsBetween(query: Partial): Promise; /** * Same as {@link DeleteConnectionsBetween} but resolves multiple queries in a single * HTTP request to POST /api/get-connection-between. * * Prefer this over looping DeleteConnectionsBetween — all queries go to the backend * in one round trip, and all returned IDs are merged into the same pending-deletion queue. * The actual deletion fires in 300-id bulk batches inside commitTransaction(). * * @param queries - Array of partial FetchConnectionQuery objects, one per query permutation. * @returns All connection IDs queued for deletion across every query in this call. * * @example * // Three different queries → one HTTP request to get IDs → one bulk delete on commit * await transaction.DeleteConnectionsBetweenBulk([ * { ofTheConceptId: 103927382, type: "the_project_s_page" }, * { ofTheConceptId: 103927382, type: "the_project_s_tag" }, * { typeId: 101490186, isComposition: true }, * ]); * await transaction.commitTransaction(); * * @see {@link DeleteConnectionsBetween} for the single-query convenience wrapper * @see {@link commitTransaction} where the queued deletions are executed in 300-id batches */ DeleteConnectionsBetweenBulk(queries: Partial[]): Promise; /** * Concepts */ MakeTheInstanceConceptLocal(type: string, referent: string, composition: boolean | undefined, userId: number, accessId: number, sessionInformationId?: number, referentId?: number): Promise; MakeTheTypeConceptLocal(typeString: string, sessionId: number, sessionUserId: number, userId: number): Promise; CreateTheConceptLocal(referent: string, typecharacter: string, userId: number, categoryId: number, typeId: number, accessId: number, isComposition?: boolean, referentId?: number | null, actions?: InnerActions): Promise; /** * Connections */ CreateConnectionBetweenTwoConceptsLocal(ofTheConcept: Concept, toTheConcept: Concept, linker: string, both?: boolean): Promise; CreateTheConnectionLocal(ofTheConceptId: number, toTheConceptId: number, typeId: number, orderId?: number, typeString?: string, userId?: number): Promise; CreateConnection(ofTheConcept: Concept, toTheConcept: Concept, connectionTypeString: string): Promise; CreateConnectionBetweenEntityLocal(concept1Data: Concept, concept2Data: Concept, linker: string): Promise; /** * Compositions */ CreateTheCompositionLocal(json: any, ofTheConceptId?: number | null, ofTheConceptUserId?: number | null, mainKey?: number | null, userId?: number | null, accessId?: number | null, sessionInformationId?: number | null, automaticSync?: boolean): Promise; }