@elyx-code/project-logic-tree 0.0.6178 → 0.0.6180

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.
@@ -74,7 +74,9 @@ export declare class ProjectState extends VersionedState implements IProject, Us
74
74
  activeVersion: boolean;
75
75
  initialized: boolean;
76
76
  startedInitialization: boolean;
77
- onCloseChangeSetCallback: ((changeSet: ChangeSet | null) => void) | null;
77
+ onCloseChangeSetCallback: ((changeSet: ChangeSet) => Promise<{
78
+ success: boolean;
79
+ }>) | null;
78
80
  constructor(initialData: IProject | IProjectTransfer);
79
81
  static sessionAuthor: string | null;
80
82
  static UUID: UUIDModule;
@@ -100,8 +102,13 @@ export declare class ProjectState extends VersionedState implements IProject, Us
100
102
  errors: EntityGenerationError[];
101
103
  modifiedData: IProjectGenerationTarget;
102
104
  };
103
- onCloseChangeSet(callback: (changeSet: ChangeSet | null) => void): void;
104
- closeChangeSet(changeSet: ChangeSet | null): void;
105
+ closePendingCallbacks(): Promise<void>;
106
+ onCloseChangeSet(callback: (changeSet: ChangeSet) => Promise<{
107
+ success: boolean;
108
+ }>): Promise<void>;
109
+ closeChangeSet(changeSet: ChangeSet): Promise<{
110
+ success: boolean;
111
+ }>;
105
112
  addChangeSet(changeSet: ChangeSet): ChangeSet;
106
113
  discardChangeSet(changeSet: ChangeSet | null): ProjectState;
107
114
  undo(): IChangeSet<ProjectState>;
@@ -1,13 +1,28 @@
1
- import { IProjectTransfer } from '../../definitions';
1
+ import { EntityId, IProjectShallowTransfer, IProjectTransfer, UserManagedElementShallowTransfer } from '../../definitions';
2
2
  import { ProjectState } from './project/project';
3
3
  import { UserManagedEntityState } from './types';
4
4
 
5
5
  export declare const CACHED_PROJECTS_BY_ID: {
6
6
  [id: string]: ProjectState;
7
7
  };
8
+ export interface IProjectFetchResult {
9
+ project: IProjectShallowTransfer;
10
+ record: Record<EntityId, UserManagedElementShallowTransfer>;
11
+ }
12
+ export type ProjectFetchResult = null | IProjectFetchResult;
8
13
  export interface IGetProjectOptions {
9
14
  empty?: boolean;
15
+ authToken?: string | null;
16
+ enrich?: boolean;
17
+ mock?: boolean;
18
+ baseUrl?: string;
19
+ ignoreCache?: boolean;
20
+ onFetch?: (projectId: EntityId) => Promise<ProjectFetchResult>;
10
21
  }
22
+ export declare const GET_PROJECT_OPTIONS_DEFAULTS: IGetProjectOptions;
23
+ export declare function initProjectFromFetchResult(result: IProjectFetchResult, { enrich }?: {
24
+ enrich: boolean;
25
+ }): ProjectState;
11
26
  export declare function initBaseProjectEntity(data: IProjectTransfer): ProjectState;
12
27
  export declare function getEntitiesCreatedSinceInitialization(projectState: ProjectState, preInitDate: string): UserManagedEntityState[];
13
28
  export declare function cloneProject(project: ProjectState, { enrich, }?: {
@@ -18,7 +33,7 @@ export declare function initProject(data: IProjectTransfer, { enrich, }?: {
18
33
  }): ProjectState;
19
34
  export declare function getProject(where: {
20
35
  id: string;
21
- }, options?: IGetProjectOptions): Promise<ProjectState | null>;
36
+ }, _options?: IGetProjectOptions): Promise<ProjectState | null>;
22
37
  export declare function deleteRootProject(where: {
23
38
  id: string;
24
39
  }): null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6178",
3
+ "version": "0.0.6180",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",
@@ -14,13 +14,14 @@
14
14
  "scripts": {
15
15
  "dev": "vite",
16
16
  "build": "tsc && vite build",
17
- "test": "jest --verbose"
17
+ "test:watch": "vitest",
18
+ "test": "vitest run"
18
19
  },
19
20
  "exports": {
20
21
  ".": {
21
- "import": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
22
23
  "require": "./dist/index.umd.cjs",
23
- "types": "./dist/index.d.ts"
24
+ "import": "./dist/index.js"
24
25
  }
25
26
  },
26
27
  "dependencies": {
@@ -33,31 +34,13 @@
33
34
  "zod-validation-error": "^3.3.0"
34
35
  },
35
36
  "devDependencies": {
36
- "@types/jest": "^27.4.1",
37
37
  "@types/node": "^20.5.0",
38
38
  "@types/pluralize": "^0.0.33",
39
39
  "@types/underscore": "^1.11.15",
40
- "jest": "^27.5.1",
41
- "ts-jest": "^27.1.4",
42
40
  "typescript": "^5.7.2",
43
- "vite": "^4.4.5",
44
- "vite-plugin-dts": "^3.5.2"
45
- },
46
- "jest": {
47
- "preset": "ts-jest/presets/js-with-ts",
48
- "testEnvironment": "jsdom",
49
- "roots": [
50
- "<rootDir>/src"
51
- ],
52
- "moduleNameMapper": {
53
- "^.+\\.(scss|css|less)$": "<rootDir>/__mocks__/defaultModuleMock.js",
54
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
55
- "@src/(.*)": "<rootDir>/src/$1"
56
- },
57
- "moduleDirectories": [
58
- "node_modules",
59
- "src"
60
- ]
41
+ "vite": "^4.5.9",
42
+ "vite-plugin-dts": "^3.5.2",
43
+ "vitest": "^3.0.4"
61
44
  },
62
45
  "repository": {
63
46
  "type": "git",