@getstrata/bootstrap 0.2.6 → 0.2.7
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/dist/bootstrap/contracts.d.ts +2 -0
- package/dist/bootstrap/providers/storage.d.ts +3 -0
- package/dist/bootstrap/scimRoutes.d.ts +1 -1
- package/dist/core/auth/membershipScope.d.ts +16 -0
- package/dist/core/auth/membershipService.d.ts +24 -0
- package/dist/core/database/baseRepository.d.ts +6 -1
- package/dist/core/database/connectionContext.d.ts +2 -1
- package/dist/core/database/defaultConnection.d.ts +6 -0
- package/dist/core/database/queryProxy.d.ts +3 -0
- package/dist/core/database/repositoryConnection.d.ts +3 -3
- package/dist/core/jobs/dispatchWebhookJob.d.ts +0 -1
- package/dist/core/queue/queueMetrics.d.ts +15 -0
- package/dist/core/security/safeFetch.d.ts +2 -0
- package/dist/core/security/safeUrl.d.ts +16 -1
- package/dist/core/tenant/tenantDatabaseScope.d.ts +2 -1
- package/dist/db/connection/index.d.ts +1 -1
- package/dist/domain/workhub.d.ts +35 -0
- package/dist/entries/applicationRegistry.js +185 -0
- package/dist/entries/config.js +42 -0
- package/dist/entries/context.js +4208 -0
- package/dist/entries/contracts.js +92 -0
- package/dist/entries/createWebRoutes.js +996 -0
- package/dist/entries/httpKernel.js +264 -0
- package/dist/entries/providers/view.js +635 -0
- package/dist/entries/providers.js +4094 -0
- package/dist/framework/public-api.d.ts +29 -6
- package/dist/index.js +290 -109
- package/dist/modules/organization/repository.d.ts +14 -0
- package/dist/modules/organization/table.d.ts +3 -0
- package/dist/modules/organization/types.d.ts +10 -0
- package/dist/modules/scim/controller.d.ts +2 -1
- package/dist/modules/scim/scimResponse.d.ts +1 -1
- package/dist/modules/scim/service.d.ts +4 -7
- package/dist/modules/user/repository.d.ts +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// ../../src/bootstrap/contracts.ts
|
|
3
|
+
class ServiceContainer {
|
|
4
|
+
services = new Map;
|
|
5
|
+
singletonFactories = new Map;
|
|
6
|
+
bindings = new Map;
|
|
7
|
+
set(key, value) {
|
|
8
|
+
this.singletonFactories.delete(key);
|
|
9
|
+
this.bindings.delete(key);
|
|
10
|
+
this.services.set(key, value);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
singleton(key, factory) {
|
|
14
|
+
this.bindings.delete(key);
|
|
15
|
+
this.services.delete(key);
|
|
16
|
+
this.singletonFactories.set(key, factory);
|
|
17
|
+
}
|
|
18
|
+
bind(key, factory) {
|
|
19
|
+
this.singletonFactories.delete(key);
|
|
20
|
+
this.services.delete(key);
|
|
21
|
+
this.bindings.set(key, factory);
|
|
22
|
+
}
|
|
23
|
+
get(key) {
|
|
24
|
+
if (this.services.has(key)) {
|
|
25
|
+
return this.services.get(key);
|
|
26
|
+
}
|
|
27
|
+
const singletonFactory = this.singletonFactories.get(key);
|
|
28
|
+
if (singletonFactory) {
|
|
29
|
+
const value = singletonFactory(this);
|
|
30
|
+
this.services.set(key, value);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
const binding = this.bindings.get(key);
|
|
34
|
+
if (binding) {
|
|
35
|
+
return binding(this);
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Service "${key}" is not registered.`);
|
|
38
|
+
}
|
|
39
|
+
resolve(key) {
|
|
40
|
+
return this.get(key);
|
|
41
|
+
}
|
|
42
|
+
has(key) {
|
|
43
|
+
return this.services.has(key) || this.singletonFactories.has(key) || this.bindings.has(key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class ConfigStore {
|
|
48
|
+
values = new Map;
|
|
49
|
+
set(key, value) {
|
|
50
|
+
this.values.set(key, value);
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
get(key) {
|
|
54
|
+
return this.values.get(key);
|
|
55
|
+
}
|
|
56
|
+
require(key) {
|
|
57
|
+
if (!this.values.has(key)) {
|
|
58
|
+
throw new Error(`Config key "${key}" is not defined.`);
|
|
59
|
+
}
|
|
60
|
+
return this.values.get(key);
|
|
61
|
+
}
|
|
62
|
+
has(key) {
|
|
63
|
+
return this.values.has(key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var requiredDependencyKeys = [
|
|
67
|
+
"container",
|
|
68
|
+
"cache",
|
|
69
|
+
"storage"
|
|
70
|
+
];
|
|
71
|
+
function getRequiredDependency(dependencies, key) {
|
|
72
|
+
const dependency = dependencies[key];
|
|
73
|
+
if (dependency === undefined) {
|
|
74
|
+
throw new Error(`Required dependency "${key}" is not registered.`);
|
|
75
|
+
}
|
|
76
|
+
return dependency;
|
|
77
|
+
}
|
|
78
|
+
function assertAppDependenciesComplete(dependencies) {
|
|
79
|
+
for (const key of requiredDependencyKeys) {
|
|
80
|
+
getRequiredDependency(dependencies, key);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function resolveService(dependencies, token) {
|
|
84
|
+
return dependencies.container.resolve(token);
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
resolveService,
|
|
88
|
+
getRequiredDependency,
|
|
89
|
+
assertAppDependenciesComplete,
|
|
90
|
+
ServiceContainer,
|
|
91
|
+
ConfigStore
|
|
92
|
+
};
|