@objectstack/runtime 3.0.10 → 3.0.11
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/http-dispatcher.test.ts +265 -0
- package/src/http-dispatcher.ts +16 -16
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/runtime@3.0.
|
|
2
|
+
> @objectstack/runtime@3.0.11 build /home/runner/work/spec/spec/packages/runtime
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.js [22m[32m52.
|
|
14
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m117.
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m54.
|
|
17
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m117.
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m52.37 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m117.43 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 118ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m54.25 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m117.49 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 127ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 6917ms
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m20.49 KB[39m
|
|
22
22
|
[32mDTS[39m [1mdist/index.d.cts [22m[32m20.49 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @objectstack/runtime
|
|
2
2
|
|
|
3
|
+
## 3.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [92d9d99]
|
|
8
|
+
- @objectstack/spec@3.0.11
|
|
9
|
+
- @objectstack/core@3.0.11
|
|
10
|
+
- @objectstack/rest@3.0.11
|
|
11
|
+
- @objectstack/types@3.0.11
|
|
12
|
+
|
|
3
13
|
## 3.0.10
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -342,7 +342,7 @@ var HttpDispatcher = class {
|
|
|
342
342
|
* path: sub-path after /auth/
|
|
343
343
|
*/
|
|
344
344
|
async handleAuth(path, method, body, context) {
|
|
345
|
-
const authService = this.getService(import_system.CoreServiceName.enum.auth);
|
|
345
|
+
const authService = await this.getService(import_system.CoreServiceName.enum.auth);
|
|
346
346
|
if (authService && typeof authService.handler === "function") {
|
|
347
347
|
const response = await authService.handler(context.request, context.response);
|
|
348
348
|
return { handled: true, result: response };
|
|
@@ -364,7 +364,7 @@ var HttpDispatcher = class {
|
|
|
364
364
|
const broker = this.ensureBroker();
|
|
365
365
|
const parts = path.replace(/^\/+/, "").split("/").filter(Boolean);
|
|
366
366
|
if (parts[0] === "types") {
|
|
367
|
-
const protocol = this.kernel?.context?.getService ? this.kernel.context.getService("protocol") : null;
|
|
367
|
+
const protocol = this.kernel?.context?.getService ? await this.kernel.context.getService("protocol") : null;
|
|
368
368
|
if (protocol && typeof protocol.getMetaTypes === "function") {
|
|
369
369
|
const result = await protocol.getMetaTypes({});
|
|
370
370
|
return { handled: true, response: this.success(result) };
|
|
@@ -379,7 +379,7 @@ var HttpDispatcher = class {
|
|
|
379
379
|
if (parts.length === 2) {
|
|
380
380
|
const [type, name] = parts;
|
|
381
381
|
if (method === "PUT" && body) {
|
|
382
|
-
const protocol = this.kernel?.context?.getService ? this.kernel.context.getService("protocol") : null;
|
|
382
|
+
const protocol = this.kernel?.context?.getService ? await this.kernel.context.getService("protocol") : null;
|
|
383
383
|
if (protocol && typeof protocol.saveMetaItem === "function") {
|
|
384
384
|
try {
|
|
385
385
|
const result = await protocol.saveMetaItem({ type, name, item: body });
|
|
@@ -401,7 +401,7 @@ var HttpDispatcher = class {
|
|
|
401
401
|
return { handled: true, response: this.success(data2) };
|
|
402
402
|
}
|
|
403
403
|
const singularType = type.endsWith("s") ? type.slice(0, -1) : type;
|
|
404
|
-
const protocol = this.kernel?.context?.getService ? this.kernel.context.getService("protocol") : null;
|
|
404
|
+
const protocol = this.kernel?.context?.getService ? await this.kernel.context.getService("protocol") : null;
|
|
405
405
|
if (protocol && typeof protocol.getMetaItem === "function") {
|
|
406
406
|
try {
|
|
407
407
|
const data2 = await protocol.getMetaItem({ type: singularType, name });
|
|
@@ -419,7 +419,7 @@ var HttpDispatcher = class {
|
|
|
419
419
|
if (parts.length === 1) {
|
|
420
420
|
const typeOrName = parts[0];
|
|
421
421
|
const packageId = query?.package || void 0;
|
|
422
|
-
const protocol = this.kernel?.context?.getService ? this.kernel.context.getService("protocol") : null;
|
|
422
|
+
const protocol = this.kernel?.context?.getService ? await this.kernel.context.getService("protocol") : null;
|
|
423
423
|
if (protocol && typeof protocol.getMetaItems === "function") {
|
|
424
424
|
try {
|
|
425
425
|
const data = await protocol.getMetaItems({ type: typeOrName, packageId });
|
|
@@ -448,7 +448,7 @@ var HttpDispatcher = class {
|
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
if (parts.length === 0) {
|
|
451
|
-
const protocol = this.kernel?.context?.getService ? this.kernel.context.getService("protocol") : null;
|
|
451
|
+
const protocol = this.kernel?.context?.getService ? await this.kernel.context.getService("protocol") : null;
|
|
452
452
|
if (protocol && typeof protocol.getMetaTypes === "function") {
|
|
453
453
|
const result = await protocol.getMetaTypes({});
|
|
454
454
|
return { handled: true, response: this.success(result) };
|
|
@@ -522,7 +522,7 @@ var HttpDispatcher = class {
|
|
|
522
522
|
* path: sub-path after /analytics/
|
|
523
523
|
*/
|
|
524
524
|
async handleAnalytics(path, method, body, context) {
|
|
525
|
-
const analyticsService = this.getService(import_system.CoreServiceName.enum.analytics);
|
|
525
|
+
const analyticsService = await this.getService(import_system.CoreServiceName.enum.analytics);
|
|
526
526
|
if (!analyticsService) return { handled: false };
|
|
527
527
|
const m = method.toUpperCase();
|
|
528
528
|
const subPath = path.replace(/^\/+/, "");
|
|
@@ -557,7 +557,7 @@ var HttpDispatcher = class {
|
|
|
557
557
|
async handlePackages(path, method, body, query, context) {
|
|
558
558
|
const m = method.toUpperCase();
|
|
559
559
|
const parts = path.replace(/^\/+/, "").split("/").filter(Boolean);
|
|
560
|
-
const qlService = this.getObjectQLService();
|
|
560
|
+
const qlService = await this.getObjectQLService();
|
|
561
561
|
const registry = qlService?.registry;
|
|
562
562
|
if (!registry) {
|
|
563
563
|
if (this.kernel.broker) {
|
|
@@ -657,7 +657,7 @@ var HttpDispatcher = class {
|
|
|
657
657
|
* path: sub-path after /storage/
|
|
658
658
|
*/
|
|
659
659
|
async handleStorage(path, method, file, context) {
|
|
660
|
-
const storageService = this.getService(import_system.CoreServiceName.enum["file-storage"]) || this.kernel.services?.["file-storage"];
|
|
660
|
+
const storageService = await this.getService(import_system.CoreServiceName.enum["file-storage"]) || this.kernel.services?.["file-storage"];
|
|
661
661
|
if (!storageService) {
|
|
662
662
|
return { handled: true, response: this.error("File storage not configured", 501) };
|
|
663
663
|
}
|
|
@@ -702,7 +702,7 @@ var HttpDispatcher = class {
|
|
|
702
702
|
if (parts[0] === "view" && parts[1]) {
|
|
703
703
|
const objectName = parts[1];
|
|
704
704
|
const type = parts[2] || query?.type || "list";
|
|
705
|
-
const protocol = this.kernel?.context?.getService ? this.kernel.context.getService("protocol") : null;
|
|
705
|
+
const protocol = this.kernel?.context?.getService ? await this.kernel.context.getService("protocol") : null;
|
|
706
706
|
if (protocol && typeof protocol.getUiView === "function") {
|
|
707
707
|
try {
|
|
708
708
|
const result = await protocol.getUiView({ object: objectName, type });
|
|
@@ -732,7 +732,7 @@ var HttpDispatcher = class {
|
|
|
732
732
|
* GET /:name/runs/:runId → getRun
|
|
733
733
|
*/
|
|
734
734
|
async handleAutomation(path, method, body, context, query) {
|
|
735
|
-
const automationService = this.getService(import_system.CoreServiceName.enum.automation);
|
|
735
|
+
const automationService = await this.getService(import_system.CoreServiceName.enum.automation);
|
|
736
736
|
if (!automationService) return { handled: false };
|
|
737
737
|
const m = method.toUpperCase();
|
|
738
738
|
const parts = path.replace(/^\/+/, "").split("/").filter(Boolean);
|
|
@@ -815,9 +815,9 @@ var HttpDispatcher = class {
|
|
|
815
815
|
}
|
|
816
816
|
return this.kernel.services || {};
|
|
817
817
|
}
|
|
818
|
-
getService(name) {
|
|
818
|
+
async getService(name) {
|
|
819
819
|
if (typeof this.kernel.getService === "function") {
|
|
820
|
-
return this.kernel.getService(name);
|
|
820
|
+
return await this.kernel.getService(name);
|
|
821
821
|
}
|
|
822
822
|
const services = this.getServicesMap();
|
|
823
823
|
return services[name];
|
|
@@ -826,17 +826,17 @@ var HttpDispatcher = class {
|
|
|
826
826
|
* Get the ObjectQL service which provides access to SchemaRegistry.
|
|
827
827
|
* Tries multiple access patterns since kernel structure varies.
|
|
828
828
|
*/
|
|
829
|
-
getObjectQLService() {
|
|
829
|
+
async getObjectQLService() {
|
|
830
830
|
if (typeof this.kernel.getService === "function") {
|
|
831
831
|
try {
|
|
832
|
-
const svc = this.kernel.getService("objectql");
|
|
832
|
+
const svc = await this.kernel.getService("objectql");
|
|
833
833
|
if (svc?.registry) return svc;
|
|
834
834
|
} catch {
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
837
|
if (this.kernel?.context?.getService) {
|
|
838
838
|
try {
|
|
839
|
-
const svc = this.kernel.context.getService("objectql");
|
|
839
|
+
const svc = await this.kernel.context.getService("objectql");
|
|
840
840
|
if (svc?.registry) return svc;
|
|
841
841
|
} catch {
|
|
842
842
|
}
|