@med1802/repository-manager 1.0.0 → 2.0.0
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 +287 -67
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -59
- package/dist/repositoryAccessor.d.ts +8 -0
- package/dist/repositoryAccessor.d.ts.map +1 -0
- package/dist/{repositoryInstance.js → repositoryAccessor.js} +11 -11
- package/dist/store.d.ts +6 -7
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +6 -6
- package/dist/types.d.ts +12 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/workspace.d.ts +10 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +61 -0
- package/package.json +1 -1
- package/src/index.ts +21 -73
- package/src/{repositoryInstance.ts → repositoryAccessor.ts} +11 -11
- package/src/store.ts +8 -9
- package/src/types.ts +14 -3
- package/src/workspace.ts +79 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/repositoryInstance.d.ts +0 -8
- package/dist/repositoryInstance.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# 🔄 Repository Manager
|
|
2
2
|
|
|
3
|
-
A lightweight, type-safe repository manager with dependency injection
|
|
3
|
+
A lightweight, type-safe repository manager with dependency injection, lifecycle management, and multi-workspace support for TypeScript/JavaScript applications.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- ✅ **Dependency Injection** - Inject infrastructure dependencies into repositories
|
|
8
8
|
- ✅ **Lifecycle Management** - Automatic connection/disconnection with reference counting
|
|
9
|
+
- ✅ **Multi-Workspace Support** - Manage multiple isolated workspaces with different dependencies
|
|
9
10
|
- ✅ **Type Safety** - Full TypeScript support with generics
|
|
10
11
|
- ✅ **Lazy Initialization** - Repository instances are created only when needed
|
|
12
|
+
- ✅ **Imperative API** - Define workspaces and repositories as needed
|
|
11
13
|
- ✅ **Logging** - Built-in logging with colored console output
|
|
12
14
|
- ✅ **Memory Efficient** - Automatic cleanup when no connections remain
|
|
13
15
|
|
|
@@ -22,155 +24,373 @@ npm install @med1802/repository-manager
|
|
|
22
24
|
```typescript
|
|
23
25
|
import { repositoryManager } from "@med1802/repository-manager";
|
|
24
26
|
|
|
25
|
-
// Define your
|
|
26
|
-
interface
|
|
27
|
+
// Define your dependencies interface
|
|
28
|
+
interface IDependencies {
|
|
27
29
|
httpClient: {
|
|
28
30
|
get(url: string): Promise<any>;
|
|
29
31
|
post(url: string, data: any): Promise<any>;
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
// Create
|
|
35
|
+
// Create manager instance
|
|
34
36
|
const manager = repositoryManager();
|
|
35
|
-
|
|
37
|
+
|
|
38
|
+
// Define infrastructure dependencies
|
|
39
|
+
const infrastructure: IDependencies = {
|
|
36
40
|
httpClient: {
|
|
37
41
|
get: async (url) => fetch(url).then((r) => r.json()),
|
|
38
42
|
post: async (url, data) =>
|
|
39
43
|
fetch(url, { method: "POST", body: JSON.stringify(data) }),
|
|
40
44
|
},
|
|
41
|
-
}
|
|
45
|
+
};
|
|
42
46
|
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return infrastructure.httpClient.get("/api/users");
|
|
48
|
-
},
|
|
49
|
-
async createUser(user: any) {
|
|
50
|
-
return infrastructure.httpClient.post("/api/users", user);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
47
|
+
// Create a workspace and define repositories
|
|
48
|
+
const { defineRepository } = manager.workspace(infrastructure, {
|
|
49
|
+
id: "app",
|
|
50
|
+
logging: true,
|
|
53
51
|
});
|
|
54
52
|
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
// Define repositories
|
|
54
|
+
defineRepository("userRepo", (infrastructure) => ({
|
|
55
|
+
async getUsers() {
|
|
56
|
+
return infrastructure.httpClient.get("/api/users");
|
|
57
|
+
},
|
|
58
|
+
async createUser(user: any) {
|
|
59
|
+
return infrastructure.httpClient.post("/api/users", user);
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
defineRepository("postRepo", (infrastructure) => ({
|
|
64
|
+
async getPosts() {
|
|
65
|
+
return infrastructure.httpClient.get("/api/posts");
|
|
66
|
+
},
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
// Use repositories with path format: "workspaceId/repositoryId"
|
|
70
|
+
const { repository: userRepo, disconnect } = manager.query("app/userRepo");
|
|
71
|
+
const users = await userRepo.getUsers();
|
|
58
72
|
|
|
59
73
|
// Cleanup when done
|
|
60
74
|
disconnect();
|
|
61
75
|
```
|
|
62
76
|
|
|
63
|
-
## API
|
|
77
|
+
## API Reference
|
|
64
78
|
|
|
65
79
|
### `repositoryManager()`
|
|
66
80
|
|
|
67
|
-
Creates a
|
|
81
|
+
Creates a repository manager instance.
|
|
82
|
+
|
|
83
|
+
**Returns:** Manager object with `workspace` and `query` methods
|
|
84
|
+
|
|
85
|
+
**Example:**
|
|
68
86
|
|
|
69
87
|
```typescript
|
|
70
88
|
const manager = repositoryManager();
|
|
71
89
|
```
|
|
72
90
|
|
|
73
|
-
### `
|
|
91
|
+
### `manager.workspace<I>(infrastructure, config)`
|
|
74
92
|
|
|
75
|
-
Creates a
|
|
93
|
+
Creates a workspace with infrastructure dependencies and returns a `defineRepository` function.
|
|
76
94
|
|
|
77
95
|
**Parameters:**
|
|
78
96
|
|
|
79
|
-
- `infrastructure` -
|
|
80
|
-
- `config` -
|
|
97
|
+
- `infrastructure: I` - Infrastructure dependencies to inject into repositories
|
|
98
|
+
- `config: IConfiguration` - Workspace configuration
|
|
99
|
+
- `id: string` - Unique identifier for the workspace
|
|
81
100
|
- `logging?: boolean` - Enable/disable logging (default: `false`)
|
|
82
101
|
|
|
83
|
-
**Returns:**
|
|
102
|
+
**Returns:** Object with `defineRepository` method
|
|
103
|
+
|
|
104
|
+
**Example:**
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
const { defineRepository } = manager.workspace(infrastructure, {
|
|
108
|
+
id: "app",
|
|
109
|
+
logging: true,
|
|
110
|
+
});
|
|
111
|
+
```
|
|
84
112
|
|
|
85
|
-
### `defineRepository(id
|
|
113
|
+
### `defineRepository(id, factory)`
|
|
86
114
|
|
|
87
|
-
Defines a repository
|
|
115
|
+
Defines a repository within the workspace.
|
|
88
116
|
|
|
89
117
|
**Parameters:**
|
|
90
118
|
|
|
91
|
-
- `id` - Unique identifier for the repository
|
|
92
|
-
- `
|
|
119
|
+
- `id: string` - Unique identifier for the repository
|
|
120
|
+
- `factory: (infrastructure: I) => R` - Factory function that receives infrastructure and returns repository instance
|
|
121
|
+
|
|
122
|
+
**Example:**
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
defineRepository("userRepo", (infrastructure) => ({
|
|
126
|
+
getUsers: () => infrastructure.httpClient.get("/users"),
|
|
127
|
+
}));
|
|
128
|
+
```
|
|
93
129
|
|
|
94
|
-
### `
|
|
130
|
+
### `manager.query<R>(path)`
|
|
95
131
|
|
|
96
|
-
Queries a repository
|
|
132
|
+
Queries a repository from a workspace using path format: `"workspaceId/repositoryId"`.
|
|
97
133
|
|
|
98
134
|
**Parameters:**
|
|
99
135
|
|
|
100
|
-
- `
|
|
136
|
+
- `path: string` - Path to repository in format `"workspaceId/repositoryId"`
|
|
101
137
|
|
|
102
138
|
**Returns:** Object with:
|
|
103
139
|
|
|
104
|
-
- `repository:
|
|
105
|
-
- `disconnect: () => void` -
|
|
140
|
+
- `repository: R` - The repository instance
|
|
141
|
+
- `disconnect: () => void` - Function to disconnect and cleanup
|
|
106
142
|
|
|
107
|
-
|
|
143
|
+
**Throws:** `Error` if workspace or repository is not found
|
|
108
144
|
|
|
109
|
-
|
|
145
|
+
**Example:**
|
|
110
146
|
|
|
111
147
|
```typescript
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
148
|
+
const { repository, disconnect } = manager.query<IUserRepo>("app/userRepo");
|
|
149
|
+
await repository.getUsers();
|
|
150
|
+
disconnect();
|
|
115
151
|
```
|
|
116
152
|
|
|
117
|
-
|
|
153
|
+
## Advanced Usage
|
|
154
|
+
|
|
155
|
+
### Multiple Workspaces
|
|
156
|
+
|
|
157
|
+
You can create multiple isolated workspaces with different dependencies:
|
|
118
158
|
|
|
119
159
|
```typescript
|
|
120
|
-
|
|
160
|
+
const manager = repositoryManager();
|
|
161
|
+
|
|
162
|
+
// API workspace
|
|
163
|
+
const { defineRepository: defineApiRepo } = manager.workspace(
|
|
164
|
+
{
|
|
165
|
+
httpClient: apiHttpClient,
|
|
166
|
+
cache: redisCache,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "api",
|
|
170
|
+
logging: true,
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
defineApiRepo("userRepo", (infrastructure) => ({
|
|
121
175
|
getUsers: () => infrastructure.httpClient.get("/users"),
|
|
122
176
|
}));
|
|
123
177
|
|
|
124
|
-
|
|
125
|
-
|
|
178
|
+
// Database workspace
|
|
179
|
+
const { defineRepository: defineDbRepo } = manager.workspace(
|
|
180
|
+
{
|
|
181
|
+
db: postgresClient,
|
|
182
|
+
logger: winstonLogger,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: "database",
|
|
186
|
+
logging: false,
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
defineDbRepo("orderRepo", (infrastructure) => ({
|
|
191
|
+
getOrders: () => infrastructure.db.query("SELECT * FROM orders"),
|
|
126
192
|
}));
|
|
127
193
|
|
|
128
|
-
|
|
129
|
-
const
|
|
194
|
+
// Access repositories from different workspaces
|
|
195
|
+
const { repository: userRepo } = manager.query("api/userRepo");
|
|
196
|
+
const { repository: orderRepo } = manager.query("database/orderRepo");
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### TypeScript Interfaces
|
|
200
|
+
|
|
201
|
+
Define clear interfaces for better type safety:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
interface IUserRepo {
|
|
205
|
+
getUsers(): Promise<User[]>;
|
|
206
|
+
createUser(user: User): Promise<User>;
|
|
207
|
+
updateUser(id: string, user: Partial<User>): Promise<User>;
|
|
208
|
+
deleteUser(id: string): Promise<void>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
interface IDependencies {
|
|
212
|
+
httpClient: IHttpClient;
|
|
213
|
+
cache: ICache;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const manager = repositoryManager();
|
|
217
|
+
|
|
218
|
+
const { defineRepository } = manager.workspace<IDependencies>(
|
|
219
|
+
{
|
|
220
|
+
httpClient: myHttpClient,
|
|
221
|
+
cache: myCache,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "app",
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
defineRepository<IUserRepo>(
|
|
229
|
+
"userRepo",
|
|
230
|
+
(infrastructure): IUserRepo => ({
|
|
231
|
+
async getUsers() {
|
|
232
|
+
/* ... */
|
|
233
|
+
},
|
|
234
|
+
async createUser(user) {
|
|
235
|
+
/* ... */
|
|
236
|
+
},
|
|
237
|
+
async updateUser(id, user) {
|
|
238
|
+
/* ... */
|
|
239
|
+
},
|
|
240
|
+
async deleteUser(id) {
|
|
241
|
+
/* ... */
|
|
242
|
+
},
|
|
243
|
+
})
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
// TypeScript knows the exact return type
|
|
247
|
+
const { repository } = manager.query<IUserRepo>("app/userRepo");
|
|
248
|
+
// repository has all IUserRepo methods with correct types
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Lifecycle Management with Reference Counting
|
|
252
|
+
|
|
253
|
+
Repositories use reference counting for automatic lifecycle management:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
// First query creates the repository instance
|
|
257
|
+
const conn1 = manager.query("app/userRepo"); // Connections: 1
|
|
258
|
+
const conn2 = manager.query("app/userRepo"); // Connections: 2 (reuses instance)
|
|
259
|
+
const conn3 = manager.query("app/userRepo"); // Connections: 3 (reuses instance)
|
|
260
|
+
|
|
261
|
+
conn1.disconnect(); // Connections: 2 (still active)
|
|
262
|
+
conn2.disconnect(); // Connections: 1 (still active)
|
|
263
|
+
conn3.disconnect(); // Connections: 0 (instance destroyed)
|
|
264
|
+
|
|
265
|
+
// Next query will create a new instance
|
|
266
|
+
const conn4 = manager.query("app/userRepo"); // Connections: 1 (new instance)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Using with React
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
import { useEffect } from "react";
|
|
273
|
+
|
|
274
|
+
function UserList() {
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
const { repository, disconnect } = manager.query<IUserRepo>("app/userRepo");
|
|
277
|
+
|
|
278
|
+
repository.getUsers().then(setUsers);
|
|
279
|
+
|
|
280
|
+
// Cleanup on unmount
|
|
281
|
+
return disconnect;
|
|
282
|
+
}, []);
|
|
283
|
+
|
|
284
|
+
return <div>{/* ... */}</div>;
|
|
285
|
+
}
|
|
130
286
|
```
|
|
131
287
|
|
|
132
|
-
###
|
|
288
|
+
### Logging
|
|
133
289
|
|
|
134
|
-
|
|
290
|
+
Enable logging to see connection lifecycle:
|
|
135
291
|
|
|
136
292
|
```typescript
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
const
|
|
293
|
+
const manager = repositoryManager();
|
|
294
|
+
|
|
295
|
+
const { defineRepository } = manager.workspace(infrastructure, {
|
|
296
|
+
id: "app",
|
|
297
|
+
logging: true, // Enables colored console output
|
|
298
|
+
});
|
|
140
299
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
300
|
+
// Console output will show:
|
|
301
|
+
// repository.connect (app/userRepo)
|
|
302
|
+
// ┌─────────┬──────────┬─────────────┐
|
|
303
|
+
// │ (index) │ id │ connections │
|
|
304
|
+
// ├─────────┼──────────┼─────────────┤
|
|
305
|
+
// │ 0 │ userRepo │ 1 │
|
|
306
|
+
// └─────────┴──────────┴─────────────┘
|
|
144
307
|
```
|
|
145
308
|
|
|
146
309
|
## Dependency Injection Pattern
|
|
147
310
|
|
|
148
|
-
This package follows the Dependency Inversion Principle (DIP)
|
|
311
|
+
This package follows the **Dependency Inversion Principle (DIP)**:
|
|
149
312
|
|
|
150
|
-
- **High-level modules** (repositories) depend on abstractions (
|
|
313
|
+
- **High-level modules** (repositories) depend on abstractions (dependencies interface)
|
|
151
314
|
- **Low-level modules** (infrastructure implementations) are injected
|
|
152
|
-
- Easy to test with mock
|
|
315
|
+
- Easy to test with mock dependencies
|
|
153
316
|
- Easy to swap implementations
|
|
154
317
|
|
|
155
318
|
```typescript
|
|
156
|
-
// Define
|
|
157
|
-
interface
|
|
319
|
+
// Define abstractions
|
|
320
|
+
interface IDatabase {
|
|
321
|
+
query(sql: string): Promise<any>;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
interface ICache {
|
|
325
|
+
get(key: string): Promise<any>;
|
|
326
|
+
set(key: string, value: any): Promise<void>;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
interface IDependencies {
|
|
158
330
|
database: IDatabase;
|
|
159
331
|
cache: ICache;
|
|
160
332
|
}
|
|
161
333
|
|
|
162
334
|
// Inject concrete implementations
|
|
163
|
-
const
|
|
164
|
-
database: new PostgreSQL(),
|
|
165
|
-
cache: new RedisCache(),
|
|
166
|
-
});
|
|
335
|
+
const manager = repositoryManager();
|
|
167
336
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
337
|
+
const { defineRepository } = manager.workspace<IDependencies>(
|
|
338
|
+
{
|
|
339
|
+
database: new PostgreSQLClient(),
|
|
340
|
+
cache: new RedisCache(),
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
id: "prod",
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
// Easy to test with mocks
|
|
348
|
+
const { defineRepository: defineTestRepo } = manager.workspace<IDependencies>(
|
|
349
|
+
{
|
|
350
|
+
database: new MockDatabase(),
|
|
351
|
+
cache: new MockCache(),
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "test",
|
|
355
|
+
}
|
|
356
|
+
);
|
|
172
357
|
```
|
|
173
358
|
|
|
359
|
+
## Design Patterns
|
|
360
|
+
|
|
361
|
+
This library implements several design patterns:
|
|
362
|
+
|
|
363
|
+
- **Dependency Injection** - Dependencies are injected into repositories
|
|
364
|
+
- **Factory Pattern** - Repositories are created using factory functions
|
|
365
|
+
- **Singleton Pattern** - Each repository is a singleton per workspace (with reference counting)
|
|
366
|
+
- **Repository Pattern** - Abstracts data access logic
|
|
367
|
+
- **Workspace Pattern** - Manages dependencies and lifecycle
|
|
368
|
+
|
|
369
|
+
## Error Handling
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
try {
|
|
373
|
+
const { repository } = manager.query("non-existent/repo");
|
|
374
|
+
} catch (error) {
|
|
375
|
+
console.error(error.message); // Container "non-existent" not found
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
try {
|
|
379
|
+
const { repository } = manager.query("app/non-existent");
|
|
380
|
+
} catch (error) {
|
|
381
|
+
console.error(error.message); // Repository "non-existent" not found
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Best Practices
|
|
386
|
+
|
|
387
|
+
1. **Define interfaces for dependencies and repositories** - Better type safety
|
|
388
|
+
2. **Use one workspace per context** - Separate API, database, etc.
|
|
389
|
+
3. **Always call disconnect** - Proper cleanup prevents memory leaks
|
|
390
|
+
4. **Enable logging during development** - Helps debug lifecycle issues
|
|
391
|
+
5. **Keep repositories focused** - Single responsibility principle
|
|
392
|
+
6. **Use dependency interfaces, not concrete classes** - Easier to test and swap
|
|
393
|
+
|
|
174
394
|
## License
|
|
175
395
|
|
|
176
396
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IConfiguration } from "./types";
|
|
2
2
|
declare const repositoryManager: () => {
|
|
3
|
-
|
|
4
|
-
defineRepository(id: string,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
workspace<I extends Record<string, any>>(infrastructure: I, config: IConfiguration): {
|
|
4
|
+
defineRepository: (id: string, repository: import("./types").repositoryType<I, any>) => void;
|
|
5
|
+
};
|
|
6
|
+
query<R = any>(path: string): {
|
|
7
|
+
repository: R;
|
|
8
|
+
disconnect(): void;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
export { repositoryManager };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,SAAS,CAAC;AAG1D,QAAA,MAAM,iBAAiB;cAGT,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,kBACrB,CAAC,UACT,cAAc;;;UAQlB,CAAC,cAAc,MAAM;;;;CAa9B,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,68 +1,24 @@
|
|
|
1
|
-
import { createRepositoryInstance } from "./repositoryInstance";
|
|
2
1
|
import { createStore } from "./store";
|
|
3
|
-
import {
|
|
2
|
+
import { createWorkspace } from "./workspace";
|
|
4
3
|
const repositoryManager = () => {
|
|
4
|
+
const store = createStore();
|
|
5
5
|
return {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
...config,
|
|
10
|
-
};
|
|
11
|
-
const store = createStore();
|
|
12
|
-
const logger = createLogger(defaultConfig);
|
|
13
|
-
const getRepository = (id) => store.getRepository(id);
|
|
14
|
-
const hasRepository = (id) => store.hasRepository(id);
|
|
15
|
-
const allRepositories = () => Array.from(store.entries()).map(([id, repository]) => ({
|
|
16
|
-
repository: id,
|
|
17
|
-
connections: repository.getConnections(),
|
|
18
|
-
}));
|
|
6
|
+
workspace(infrastructure, config) {
|
|
7
|
+
const workspace = createWorkspace(infrastructure, config);
|
|
8
|
+
store.setState(config.id, workspace);
|
|
19
9
|
return {
|
|
20
|
-
defineRepository
|
|
21
|
-
if (hasRepository(id))
|
|
22
|
-
return;
|
|
23
|
-
logger.log(() => {
|
|
24
|
-
store.setRepository(id, createRepositoryInstance(repositoryDefinition, infrastructure));
|
|
25
|
-
}, {
|
|
26
|
-
type: "repository.define",
|
|
27
|
-
scope: id,
|
|
28
|
-
metadata: () => {
|
|
29
|
-
return {
|
|
30
|
-
repositories: allRepositories().map(({ repository }) => ({
|
|
31
|
-
repository,
|
|
32
|
-
})),
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
queryRepository(id) {
|
|
38
|
-
const repository = getRepository(id);
|
|
39
|
-
if (!repository) {
|
|
40
|
-
throw new Error(`Repository "${id}" not found`);
|
|
41
|
-
}
|
|
42
|
-
logger.log(() => repository.connect(), {
|
|
43
|
-
type: "repository.connect",
|
|
44
|
-
scope: id,
|
|
45
|
-
metadata: () => {
|
|
46
|
-
return {
|
|
47
|
-
connections: allRepositories(),
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
repository: repository.getReference(),
|
|
53
|
-
disconnect: () => logger.log(() => repository.disconnect(), {
|
|
54
|
-
type: "repository.disconnect",
|
|
55
|
-
scope: id,
|
|
56
|
-
metadata: () => {
|
|
57
|
-
return {
|
|
58
|
-
connections: allRepositories(),
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
63
|
-
},
|
|
10
|
+
defineRepository: workspace.defineRepository,
|
|
64
11
|
};
|
|
65
12
|
},
|
|
13
|
+
query(path) {
|
|
14
|
+
const [containerId, repositoryId] = path.split("/");
|
|
15
|
+
const container = store.getState(containerId);
|
|
16
|
+
if (!container) {
|
|
17
|
+
throw new Error(`Container ${containerId} not found`);
|
|
18
|
+
}
|
|
19
|
+
const queryRepository = container.queryRepository;
|
|
20
|
+
return queryRepository(repositoryId);
|
|
21
|
+
},
|
|
66
22
|
};
|
|
67
23
|
};
|
|
68
24
|
export { repositoryManager };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare function createRepositoryAccessor<I extends Record<string, any>>(definition: (infrastructure: I) => unknown, infrastructure: I): {
|
|
2
|
+
readonly repository: unknown;
|
|
3
|
+
readonly connections: number;
|
|
4
|
+
connect(): void;
|
|
5
|
+
disconnect(): void;
|
|
6
|
+
};
|
|
7
|
+
export { createRepositoryAccessor };
|
|
8
|
+
//# sourceMappingURL=repositoryAccessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repositoryAccessor.d.ts","sourceRoot":"","sources":["../src/repositoryAccessor.ts"],"names":[],"mappings":"AAAA,iBAAS,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7D,UAAU,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,OAAO,EAC1C,cAAc,EAAE,CAAC;;;;;EAyBlB;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
function
|
|
2
|
-
let
|
|
1
|
+
function createRepositoryAccessor(definition, infrastructure) {
|
|
2
|
+
let repository = undefined;
|
|
3
3
|
let connections = 0;
|
|
4
4
|
return {
|
|
5
|
+
get repository() {
|
|
6
|
+
return repository;
|
|
7
|
+
},
|
|
8
|
+
get connections() {
|
|
9
|
+
return connections;
|
|
10
|
+
},
|
|
5
11
|
connect() {
|
|
6
12
|
if (connections === 0) {
|
|
7
|
-
|
|
13
|
+
repository = definition(infrastructure);
|
|
8
14
|
}
|
|
9
15
|
connections += 1;
|
|
10
16
|
},
|
|
@@ -13,15 +19,9 @@ function createRepositoryInstance(definition, infrastructure) {
|
|
|
13
19
|
return;
|
|
14
20
|
connections -= 1;
|
|
15
21
|
if (connections === 0) {
|
|
16
|
-
|
|
22
|
+
repository = undefined;
|
|
17
23
|
}
|
|
18
24
|
},
|
|
19
|
-
getReference() {
|
|
20
|
-
return reference;
|
|
21
|
-
},
|
|
22
|
-
getConnections() {
|
|
23
|
-
return connections;
|
|
24
|
-
},
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
export {
|
|
27
|
+
export { createRepositoryAccessor };
|
package/dist/store.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
entries(): MapIterator<[string, IRepositoryInstance]>;
|
|
1
|
+
declare function createStore<S>(): {
|
|
2
|
+
setState(id: string, item: S): void;
|
|
3
|
+
getState(id: string): S | undefined;
|
|
4
|
+
hasState(id: string): boolean;
|
|
5
|
+
deleteState(id: string): void;
|
|
6
|
+
getEntries(): MapIterator<[string, S]>;
|
|
8
7
|
};
|
|
9
8
|
export { createStore };
|
|
10
9
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,iBAAS,WAAW,CAAC,CAAC;iBAGL,MAAM,QAAQ,CAAC;iBAGf,MAAM;iBAGN,MAAM;oBAGH,MAAM;;EAOzB;AACD,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/store.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
function createStore() {
|
|
2
2
|
const state = new Map();
|
|
3
3
|
return {
|
|
4
|
-
|
|
5
|
-
state.set(id,
|
|
4
|
+
setState(id, item) {
|
|
5
|
+
state.set(id, item);
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
getState(id) {
|
|
8
8
|
return state.get(id);
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
hasState(id) {
|
|
11
11
|
return state.has(id);
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
deleteState(id) {
|
|
14
14
|
state.delete(id);
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
getEntries() {
|
|
17
17
|
return state.entries();
|
|
18
18
|
},
|
|
19
19
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
export type repositoryType<I = any, R = any> = (infrastructure: I) => R;
|
|
1
2
|
export interface IConfiguration {
|
|
3
|
+
id: string;
|
|
2
4
|
logging?: boolean;
|
|
3
5
|
}
|
|
4
|
-
export interface
|
|
6
|
+
export interface IWorkspace<I = any, R = any> {
|
|
7
|
+
defineRepository(id: string, repository: repositoryType<I, R>): void;
|
|
8
|
+
queryRepository(id: string): {
|
|
9
|
+
repository: ReturnType<repositoryType<I, R>>;
|
|
10
|
+
disconnect(): void;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface IRepositoryInstance<R = any> {
|
|
5
14
|
connect(): void;
|
|
6
15
|
disconnect(): void;
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
repository: ReturnType<repositoryType<any, R>> | undefined;
|
|
17
|
+
connections: number;
|
|
9
18
|
}
|
|
10
19
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IAC1C,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IACrE,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG;QAC3B,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,UAAU,IAAI,IAAI,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,GAAG;IAC1C,OAAO,IAAI,IAAI,CAAC;IAChB,UAAU,IAAI,IAAI,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IConfiguration, repositoryType } from "./types";
|
|
2
|
+
declare function createWorkspace<I extends Record<string, any>>(infrastructure: I, config: IConfiguration): {
|
|
3
|
+
defineRepository: (id: string, repository: repositoryType<I, any>) => void;
|
|
4
|
+
queryRepository: (id: string) => {
|
|
5
|
+
repository: any;
|
|
6
|
+
disconnect(): void;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export { createWorkspace };
|
|
10
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAEd,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,iBAAS,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpD,cAAc,EAAE,CAAC,EACjB,MAAM,EAAE,cAAc;2BAeQ,MAAM,cAAc,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC;0BAuB3C,MAAM;;;;EA2BpC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createLogger } from "./logger";
|
|
2
|
+
import { createRepositoryAccessor } from "./repositoryAccessor";
|
|
3
|
+
import { createStore } from "./store";
|
|
4
|
+
function createWorkspace(infrastructure, config) {
|
|
5
|
+
var _a;
|
|
6
|
+
const defaultConfig = {
|
|
7
|
+
id: config.id,
|
|
8
|
+
logging: (_a = config.logging) !== null && _a !== void 0 ? _a : false,
|
|
9
|
+
};
|
|
10
|
+
const logger = createLogger(defaultConfig);
|
|
11
|
+
const store = createStore();
|
|
12
|
+
const hasRepository = (id) => store.hasState(id);
|
|
13
|
+
const allRepositories = () => Array.from(store.getEntries()).map(([id, repository]) => ({
|
|
14
|
+
repository: id,
|
|
15
|
+
connections: repository.connections,
|
|
16
|
+
}));
|
|
17
|
+
const defineRepository = (id, repository) => {
|
|
18
|
+
if (hasRepository(id))
|
|
19
|
+
return;
|
|
20
|
+
logger.log(() => {
|
|
21
|
+
store.setState(id, createRepositoryAccessor(repository, infrastructure));
|
|
22
|
+
}, {
|
|
23
|
+
type: "repository.define",
|
|
24
|
+
scope: id,
|
|
25
|
+
metadata() {
|
|
26
|
+
return {
|
|
27
|
+
repositories: allRepositories().map(({ repository }) => ({
|
|
28
|
+
repository,
|
|
29
|
+
})),
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const queryRepository = (id) => {
|
|
35
|
+
const entity = store.getState(id);
|
|
36
|
+
if (!entity) {
|
|
37
|
+
throw new Error(`Repository "${id}" not found`);
|
|
38
|
+
}
|
|
39
|
+
logger.log(() => entity.connect(), {
|
|
40
|
+
type: "repository.connect",
|
|
41
|
+
scope: id,
|
|
42
|
+
metadata: () => {
|
|
43
|
+
return {
|
|
44
|
+
connections: allRepositories(),
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const { repository } = entity;
|
|
49
|
+
return {
|
|
50
|
+
repository,
|
|
51
|
+
disconnect() {
|
|
52
|
+
entity.disconnect();
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
defineRepository,
|
|
58
|
+
queryRepository,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export { createWorkspace };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,84 +1,32 @@
|
|
|
1
|
-
import { createRepositoryInstance } from "./repositoryInstance";
|
|
2
1
|
import { createStore } from "./store";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import type { IConfiguration, IWorkspace } from "./types";
|
|
3
|
+
import { createWorkspace } from "./workspace";
|
|
4
|
+
|
|
5
5
|
const repositoryManager = () => {
|
|
6
|
+
const store = createStore<IWorkspace<any>>();
|
|
6
7
|
return {
|
|
7
|
-
|
|
8
|
+
workspace<I extends Record<string, any>>(
|
|
8
9
|
infrastructure: I,
|
|
9
|
-
config
|
|
10
|
+
config: IConfiguration
|
|
10
11
|
) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
...config,
|
|
14
|
-
};
|
|
15
|
-
const store = createStore();
|
|
16
|
-
const logger = createLogger(defaultConfig);
|
|
17
|
-
|
|
18
|
-
const getRepository = (id: string) => store.getRepository(id);
|
|
19
|
-
const hasRepository = (id: string) => store.hasRepository(id);
|
|
20
|
-
const allRepositories = () =>
|
|
21
|
-
Array.from(store.entries()).map(([id, repository]) => ({
|
|
22
|
-
repository: id,
|
|
23
|
-
connections: repository.getConnections(),
|
|
24
|
-
}));
|
|
25
|
-
|
|
12
|
+
const workspace = createWorkspace(infrastructure, config);
|
|
13
|
+
store.setState(config.id, workspace);
|
|
26
14
|
return {
|
|
27
|
-
defineRepository
|
|
28
|
-
id: string,
|
|
29
|
-
repositoryDefinition: (infrastructure: I) => void
|
|
30
|
-
) {
|
|
31
|
-
if (hasRepository(id)) return;
|
|
32
|
-
logger.log(
|
|
33
|
-
() => {
|
|
34
|
-
store.setRepository(
|
|
35
|
-
id,
|
|
36
|
-
createRepositoryInstance(repositoryDefinition, infrastructure)
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: "repository.define",
|
|
41
|
-
scope: id,
|
|
42
|
-
metadata: () => {
|
|
43
|
-
return {
|
|
44
|
-
repositories: allRepositories().map(({ repository }) => ({
|
|
45
|
-
repository,
|
|
46
|
-
})),
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
},
|
|
52
|
-
queryRepository<R = any>(id: string) {
|
|
53
|
-
const repository = getRepository(id);
|
|
54
|
-
if (!repository) {
|
|
55
|
-
throw new Error(`Repository "${id}" not found`);
|
|
56
|
-
}
|
|
57
|
-
logger.log(() => repository.connect(), {
|
|
58
|
-
type: "repository.connect",
|
|
59
|
-
scope: id,
|
|
60
|
-
metadata: () => {
|
|
61
|
-
return {
|
|
62
|
-
connections: allRepositories(),
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
repository: repository.getReference() as R,
|
|
68
|
-
disconnect: () =>
|
|
69
|
-
logger.log(() => repository.disconnect(), {
|
|
70
|
-
type: "repository.disconnect",
|
|
71
|
-
scope: id,
|
|
72
|
-
metadata: () => {
|
|
73
|
-
return {
|
|
74
|
-
connections: allRepositories(),
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
}),
|
|
78
|
-
};
|
|
79
|
-
},
|
|
15
|
+
defineRepository: workspace.defineRepository,
|
|
80
16
|
};
|
|
81
17
|
},
|
|
18
|
+
query<R = any>(path: string) {
|
|
19
|
+
const [containerId, repositoryId] = path.split("/");
|
|
20
|
+
const container = store.getState(containerId);
|
|
21
|
+
if (!container) {
|
|
22
|
+
throw new Error(`Container ${containerId} not found`);
|
|
23
|
+
}
|
|
24
|
+
const queryRepository = container.queryRepository as IWorkspace<
|
|
25
|
+
any,
|
|
26
|
+
R
|
|
27
|
+
>["queryRepository"];
|
|
28
|
+
return queryRepository(repositoryId);
|
|
29
|
+
},
|
|
82
30
|
};
|
|
83
31
|
};
|
|
84
32
|
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
function
|
|
1
|
+
function createRepositoryAccessor<I extends Record<string, any>>(
|
|
2
2
|
definition: (infrastructure: I) => unknown,
|
|
3
3
|
infrastructure: I
|
|
4
4
|
) {
|
|
5
|
-
let
|
|
5
|
+
let repository = undefined as unknown;
|
|
6
6
|
let connections = 0;
|
|
7
7
|
return {
|
|
8
|
+
get repository() {
|
|
9
|
+
return repository;
|
|
10
|
+
},
|
|
11
|
+
get connections() {
|
|
12
|
+
return connections;
|
|
13
|
+
},
|
|
8
14
|
connect() {
|
|
9
15
|
if (connections === 0) {
|
|
10
|
-
|
|
16
|
+
repository = definition(infrastructure);
|
|
11
17
|
}
|
|
12
18
|
connections += 1;
|
|
13
19
|
},
|
|
@@ -15,16 +21,10 @@ function createRepositoryInstance<I extends Record<string, any>>(
|
|
|
15
21
|
if (connections === 0) return;
|
|
16
22
|
connections -= 1;
|
|
17
23
|
if (connections === 0) {
|
|
18
|
-
|
|
24
|
+
repository = undefined;
|
|
19
25
|
}
|
|
20
26
|
},
|
|
21
|
-
getReference() {
|
|
22
|
-
return reference;
|
|
23
|
-
},
|
|
24
|
-
getConnections() {
|
|
25
|
-
return connections;
|
|
26
|
-
},
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export {
|
|
30
|
+
export { createRepositoryAccessor };
|
package/src/store.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const state = new Map<string, IRepositoryInstance>();
|
|
1
|
+
function createStore<S>() {
|
|
2
|
+
const state = new Map<string, S>();
|
|
4
3
|
return {
|
|
5
|
-
|
|
6
|
-
state.set(id,
|
|
4
|
+
setState(id: string, item: S) {
|
|
5
|
+
state.set(id, item);
|
|
7
6
|
},
|
|
8
|
-
|
|
7
|
+
getState(id: string) {
|
|
9
8
|
return state.get(id);
|
|
10
9
|
},
|
|
11
|
-
|
|
10
|
+
hasState(id: string) {
|
|
12
11
|
return state.has(id);
|
|
13
12
|
},
|
|
14
|
-
|
|
13
|
+
deleteState(id: string) {
|
|
15
14
|
state.delete(id);
|
|
16
15
|
},
|
|
17
|
-
|
|
16
|
+
getEntries() {
|
|
18
17
|
return state.entries();
|
|
19
18
|
},
|
|
20
19
|
};
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
export type repositoryType<I = any, R = any> = (infrastructure: I) => R;
|
|
2
|
+
|
|
1
3
|
export interface IConfiguration {
|
|
4
|
+
id: string;
|
|
2
5
|
logging?: boolean;
|
|
3
6
|
}
|
|
4
7
|
|
|
5
|
-
export interface
|
|
8
|
+
export interface IWorkspace<I = any, R = any> {
|
|
9
|
+
defineRepository(id: string, repository: repositoryType<I, R>): void;
|
|
10
|
+
queryRepository(id: string): {
|
|
11
|
+
repository: ReturnType<repositoryType<I, R>>;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IRepositoryInstance<R = any> {
|
|
6
17
|
connect(): void;
|
|
7
18
|
disconnect(): void;
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
repository: ReturnType<repositoryType<any, R>> | undefined;
|
|
20
|
+
connections: number;
|
|
10
21
|
}
|
package/src/workspace.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createLogger } from "./logger";
|
|
2
|
+
import { createRepositoryAccessor } from "./repositoryAccessor";
|
|
3
|
+
import { createStore } from "./store";
|
|
4
|
+
import type {
|
|
5
|
+
IConfiguration,
|
|
6
|
+
IRepositoryInstance,
|
|
7
|
+
repositoryType,
|
|
8
|
+
} from "./types";
|
|
9
|
+
|
|
10
|
+
function createWorkspace<I extends Record<string, any>>(
|
|
11
|
+
infrastructure: I,
|
|
12
|
+
config: IConfiguration
|
|
13
|
+
) {
|
|
14
|
+
const defaultConfig: IConfiguration = {
|
|
15
|
+
id: config.id,
|
|
16
|
+
logging: config.logging ?? false,
|
|
17
|
+
};
|
|
18
|
+
const logger = createLogger(defaultConfig);
|
|
19
|
+
const store = createStore<IRepositoryInstance<any>>();
|
|
20
|
+
const hasRepository = (id: string) => store.hasState(id);
|
|
21
|
+
const allRepositories = () =>
|
|
22
|
+
Array.from(store.getEntries()).map(([id, repository]) => ({
|
|
23
|
+
repository: id,
|
|
24
|
+
connections: repository.connections,
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const defineRepository = (id: string, repository: repositoryType<I, any>) => {
|
|
28
|
+
if (hasRepository(id)) return;
|
|
29
|
+
logger.log(
|
|
30
|
+
() => {
|
|
31
|
+
store.setState(
|
|
32
|
+
id,
|
|
33
|
+
createRepositoryAccessor(repository, infrastructure)
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "repository.define",
|
|
38
|
+
scope: id,
|
|
39
|
+
metadata() {
|
|
40
|
+
return {
|
|
41
|
+
repositories: allRepositories().map(({ repository }) => ({
|
|
42
|
+
repository,
|
|
43
|
+
})),
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const queryRepository = (id: string) => {
|
|
51
|
+
const entity = store.getState(id);
|
|
52
|
+
if (!entity) {
|
|
53
|
+
throw new Error(`Repository "${id}" not found`);
|
|
54
|
+
}
|
|
55
|
+
logger.log(() => entity.connect(), {
|
|
56
|
+
type: "repository.connect",
|
|
57
|
+
scope: id,
|
|
58
|
+
metadata: () => {
|
|
59
|
+
return {
|
|
60
|
+
connections: allRepositories(),
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const { repository } = entity;
|
|
65
|
+
return {
|
|
66
|
+
repository,
|
|
67
|
+
disconnect() {
|
|
68
|
+
entity.disconnect();
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
defineRepository,
|
|
75
|
+
queryRepository,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { createWorkspace };
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"fileNames":["../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.full.d.ts","../../node_modules/.pnpm/@types+react@18.3.23/node_modules/@types/react/global.d.ts","../../node_modules/.pnpm/csstype@3.1.3/node_modules/csstype/index.d.ts","../../node_modules/.pnpm/@types+prop-types@15.7.15/node_modules/@types/prop-types/index.d.ts","../../node_modules/.pnpm/@types+react@18.3.23/node_modules/@types/react/index.d.ts","../../node_modules/.pnpm/@types+react@18.3.23/node_modules/@types/react/jsx-runtime.d.ts","./src/repositoryinstance.ts","./src/types.ts","./src/store.ts","./src/logger.ts","./src/index.ts","../../node_modules/.pnpm/@types+react-dom@18.3.7_@types+react@18.3.23/node_modules/@types/react-dom/index.d.ts"],"fileIdsList":[[47,48,49,50,51],[47,49],[47],[46],[43,44,45]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"08f6861df84fba9719c14d5adc3ba40be9f0c687639e6c4df3c05b9301b8ff94","impliedFormat":1},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"472f5aab7edc498a0a761096e8e254c5bc3323d07a1e7f5f8b8ec0d6395b60a0","affectsGlobalScope":true,"impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},{"version":"ace4a119abe4ca7ea58ca5e0b89420d791a9c68ff5fcb3d32187ffa495f47d36","signature":"9aad1a780fa42fe11f3209e60c109f32b00cd0661629e4faa909c43b80850a82"},{"version":"f3d695638d86fc0e49aa2923963c5491b0bef20f8fb1b582ff813364d3a22dfb","signature":"abbe52d6fc94ab7de123cc0eaf9c83a8b9b0b63d55e24c83188ccd145860cc6e"},{"version":"f5067e271313e63a819ff1c077910638e1475cc4f6be4fcf690d1b928fcf582c","signature":"c15a174d71579221241c22ceb238a46fcad2df8b873dc5c9450fd545f6416dfe"},{"version":"492c075c93e7422319653338cad79622e19a08cc9269f62600805c1fb52b1a36","signature":"935c0760e874c9d96997126152eb9b3b8d7104025b942bf0a92202583276ddbd"},{"version":"82f94351ad2096c90d036a069c887c8e08dce7f118d977eab88034d4a264c219","signature":"29a079aacb8d621cdf086d8325c3c6c92783dcc0119ef27893e9ba1486effd7e"},{"version":"17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","impliedFormat":1}],"root":[[48,52]],"options":{"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"jsx":4,"module":99,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"strict":true,"target":6},"referencedMap":[[52,1],[51,2],[48,3],[50,2],[49,3],[53,4],[46,5],[47,4]],"latestChangedDtsFile":"./dist/index.d.ts","version":"5.8.3"}
|
|
1
|
+
{"fileNames":["../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.full.d.ts","../../node_modules/.pnpm/@types+react@18.3.23/node_modules/@types/react/global.d.ts","../../node_modules/.pnpm/csstype@3.1.3/node_modules/csstype/index.d.ts","../../node_modules/.pnpm/@types+prop-types@15.7.15/node_modules/@types/prop-types/index.d.ts","../../node_modules/.pnpm/@types+react@18.3.23/node_modules/@types/react/index.d.ts","../../node_modules/.pnpm/@types+react@18.3.23/node_modules/@types/react/jsx-runtime.d.ts","./src/store.ts","./src/types.ts","./src/logger.ts","./src/repositoryaccessor.ts","./src/workspace.ts","./src/index.ts","../../node_modules/.pnpm/@types+react-dom@18.3.7_@types+react@18.3.23/node_modules/@types/react-dom/index.d.ts"],"fileIdsList":[[47,48,49,52],[47,49],[47],[47,48,49,50,51],[46],[43,44,45]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"08f6861df84fba9719c14d5adc3ba40be9f0c687639e6c4df3c05b9301b8ff94","impliedFormat":1},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"472f5aab7edc498a0a761096e8e254c5bc3323d07a1e7f5f8b8ec0d6395b60a0","affectsGlobalScope":true,"impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},{"version":"29f45bbe2abf2b552bc0816403ae39e7650bb21f28f43c3f5d6478fafa919469","signature":"b276ce62679f7f22b60b5138be9978d1bac7a631573eb734fa9dd8bc1519fad5"},{"version":"fb7a01b7c700e3e7acf97129366f7c5c7af0c38f5878f555788b2e29dcbecc0c","signature":"1be6a60484d09dd55b282a2742cbd7e7184d3a6cfc9b0bb1aa86cab8d3167853"},{"version":"492c075c93e7422319653338cad79622e19a08cc9269f62600805c1fb52b1a36","signature":"935c0760e874c9d96997126152eb9b3b8d7104025b942bf0a92202583276ddbd"},{"version":"bfc13d274c957851e358328fe3b6426dca102255a728b82f75ac080ee1639fc4","signature":"de9f36d1627208b72b4f18de5bb32ba5632cc4047c7300795e54ebaed9b3e379"},{"version":"f68271bf7ba0cb8862a38a1bc95abc22fc50666b4ccd9fce2cab6ebb45999f81","signature":"3ac28bf1517465765a387c8bf6fccbe15bbe804493e3e90aee9647dfecf5d8f2"},{"version":"60b550dcc5ed595cb1c6f8eb2e23f89c310d26fe35c6232c6378d9cb98a4e81d","signature":"044f56994ad4db06a91a53092997198f161ecdec1b3255bc831776b7493d1e7d"},{"version":"17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","impliedFormat":1}],"root":[[48,53]],"options":{"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"jsx":4,"module":99,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"strict":true,"target":6},"referencedMap":[[53,1],[50,2],[51,3],[48,3],[49,3],[52,4],[54,5],[46,6],[47,5]],"latestChangedDtsFile":"./dist/index.d.ts","version":"5.8.3"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare function createRepositoryInstance<I extends Record<string, any>>(definition: (infrastructure: I) => unknown, infrastructure: I): {
|
|
2
|
-
connect(): void;
|
|
3
|
-
disconnect(): void;
|
|
4
|
-
getReference(): unknown;
|
|
5
|
-
getConnections(): number;
|
|
6
|
-
};
|
|
7
|
-
export { createRepositoryInstance };
|
|
8
|
-
//# sourceMappingURL=repositoryInstance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repositoryInstance.d.ts","sourceRoot":"","sources":["../src/repositoryInstance.ts"],"names":[],"mappings":"AAAA,iBAAS,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7D,UAAU,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,OAAO,EAC1C,cAAc,EAAE,CAAC;;;;;EAyBlB;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|