@objectstack/runtime 7.8.0 → 7.9.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/dist/index.cjs +64 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +64 -15
- package/dist/index.js.map +1 -1
- package/package.json +18 -18
package/dist/index.cjs
CHANGED
|
@@ -3607,7 +3607,8 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
3607
3607
|
if (protocol && typeof protocol.getMetaItem === "function") {
|
|
3608
3608
|
try {
|
|
3609
3609
|
const organizationId = await this.resolveActiveOrganizationId(_context);
|
|
3610
|
-
const
|
|
3610
|
+
const previewDrafts = query?.preview === "draft";
|
|
3611
|
+
const data = await protocol.getMetaItem({ type: singularType, name, packageId, organizationId, previewDrafts });
|
|
3611
3612
|
return { handled: true, response: this.success(data) };
|
|
3612
3613
|
} catch (e) {
|
|
3613
3614
|
}
|
|
@@ -3649,7 +3650,8 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
3649
3650
|
if (protocol && typeof protocol.getMetaItems === "function") {
|
|
3650
3651
|
try {
|
|
3651
3652
|
const organizationId = await this.resolveActiveOrganizationId(_context);
|
|
3652
|
-
const
|
|
3653
|
+
const previewDrafts = query?.preview === "draft";
|
|
3654
|
+
const data = await protocol.getMetaItems({ type: typeOrName, packageId, organizationId, previewDrafts });
|
|
3653
3655
|
if (data && (data.items !== void 0 || Array.isArray(data))) {
|
|
3654
3656
|
return { handled: true, response: this.success(data) };
|
|
3655
3657
|
}
|
|
@@ -4003,6 +4005,24 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
4003
4005
|
}
|
|
4004
4006
|
return { handled: true, response: this.error("Draft publishing not supported", 501) };
|
|
4005
4007
|
}
|
|
4008
|
+
if (parts.length === 2 && parts[1] === "discard-drafts" && m === "POST") {
|
|
4009
|
+
const id = decodeURIComponent(parts[0]);
|
|
4010
|
+
const protocol = await this.resolveService("protocol");
|
|
4011
|
+
if (protocol && typeof protocol.discardPackageDrafts === "function") {
|
|
4012
|
+
try {
|
|
4013
|
+
const organizationId = await this.resolveActiveOrganizationId(_context);
|
|
4014
|
+
const result = await protocol.discardPackageDrafts({
|
|
4015
|
+
packageId: id,
|
|
4016
|
+
...organizationId ? { organizationId } : {},
|
|
4017
|
+
...body?.actor ? { actor: body.actor } : {}
|
|
4018
|
+
});
|
|
4019
|
+
return { handled: true, response: this.success(result) };
|
|
4020
|
+
} catch (e) {
|
|
4021
|
+
return { handled: true, response: this.error(e.message, e.statusCode || 500) };
|
|
4022
|
+
}
|
|
4023
|
+
}
|
|
4024
|
+
return { handled: true, response: this.error("Draft discarding not supported", 501) };
|
|
4025
|
+
}
|
|
4006
4026
|
if (parts.length === 2 && parts[1] === "revert" && m === "POST") {
|
|
4007
4027
|
const id = decodeURIComponent(parts[0]);
|
|
4008
4028
|
const metadataService = await this.getService(import_system2.CoreServiceName.enum.metadata);
|
|
@@ -4028,9 +4048,27 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
4028
4048
|
}
|
|
4029
4049
|
if (parts.length === 1 && m === "DELETE") {
|
|
4030
4050
|
const id = decodeURIComponent(parts[0]);
|
|
4031
|
-
const
|
|
4032
|
-
|
|
4033
|
-
|
|
4051
|
+
const registryRemoved = registry.uninstallPackage(id);
|
|
4052
|
+
let persisted = void 0;
|
|
4053
|
+
const protocol = await this.resolveService("protocol");
|
|
4054
|
+
if (protocol && typeof protocol.deletePackage === "function") {
|
|
4055
|
+
try {
|
|
4056
|
+
const organizationId = await this.resolveActiveOrganizationId(_context);
|
|
4057
|
+
const keepData = query?.keepData === "true" || query?.keepData === "1";
|
|
4058
|
+
persisted = await protocol.deletePackage({
|
|
4059
|
+
packageId: id,
|
|
4060
|
+
...organizationId ? { organizationId } : {},
|
|
4061
|
+
...keepData ? { keepData: true } : {}
|
|
4062
|
+
});
|
|
4063
|
+
} catch (e) {
|
|
4064
|
+
return { handled: true, response: this.error(e.message, e.statusCode || 500) };
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
const deletedCount = persisted?.deletedCount ?? 0;
|
|
4068
|
+
if (!registryRemoved && deletedCount === 0) {
|
|
4069
|
+
return { handled: true, response: this.error(`Package '${id}' not found`, 404) };
|
|
4070
|
+
}
|
|
4071
|
+
return { handled: true, response: this.success({ success: true, registryRemoved, persisted }) };
|
|
4034
4072
|
}
|
|
4035
4073
|
} catch (e) {
|
|
4036
4074
|
return { handled: true, response: this.error(e.message, e.statusCode || 500) };
|
|
@@ -6611,6 +6649,16 @@ var CAPABILITY_PROVIDERS = {
|
|
|
6611
6649
|
pkg: "@objectstack/service-ai",
|
|
6612
6650
|
export: "AIServicePlugin"
|
|
6613
6651
|
},
|
|
6652
|
+
// AI Studio — AI-driven metadata authoring ("online development"). This is
|
|
6653
|
+
// a commercial capability that ships in the private @objectstack/service-ai-studio
|
|
6654
|
+
// package (not part of the open-source framework). The dynamic import below
|
|
6655
|
+
// silently skips when the package isn't installed, so the open-source build
|
|
6656
|
+
// is unaffected; cloud and enterprise installs that ship the package light it
|
|
6657
|
+
// up. Pair with `ai` in `requires` (it attaches via the `ai:ready` hook).
|
|
6658
|
+
aiStudio: {
|
|
6659
|
+
pkg: "@objectstack/service-ai-studio",
|
|
6660
|
+
export: "AIStudioPlugin"
|
|
6661
|
+
},
|
|
6614
6662
|
analytics: {
|
|
6615
6663
|
pkg: "@objectstack/service-analytics",
|
|
6616
6664
|
export: "AnalyticsServicePlugin",
|
|
@@ -6937,6 +6985,7 @@ var ArtifactKernelFactory = class {
|
|
|
6937
6985
|
this.envRegistry = config.envRegistry;
|
|
6938
6986
|
this.logger = config.logger ?? console;
|
|
6939
6987
|
this.kernelConfig = config.kernelConfig;
|
|
6988
|
+
this.defaultRequires = config.defaultRequires ?? [];
|
|
6940
6989
|
this.authBaseSecret = (config.authBaseSecret ?? (0, import_types3.readEnvWithDeprecation)("OS_AUTH_SECRET", ["AUTH_SECRET", "BETTER_AUTH_SECRET"]) ?? "").trim();
|
|
6941
6990
|
}
|
|
6942
6991
|
async create(environmentId) {
|
|
@@ -7103,7 +7152,10 @@ var ArtifactKernelFactory = class {
|
|
|
7103
7152
|
});
|
|
7104
7153
|
}
|
|
7105
7154
|
const requiresRaw = (Array.isArray(bundle?.requires) ? bundle.requires : null) ?? (Array.isArray(sys?.requires) ? sys.requires : null) ?? [];
|
|
7106
|
-
const requires =
|
|
7155
|
+
const requires = [
|
|
7156
|
+
...requiresRaw,
|
|
7157
|
+
...this.defaultRequires
|
|
7158
|
+
].filter((x) => typeof x === "string" && x.length > 0);
|
|
7107
7159
|
if (requires.length > 0) {
|
|
7108
7160
|
const installed = await loadCapabilities({
|
|
7109
7161
|
kernel,
|
|
@@ -7762,13 +7814,7 @@ var MarketplaceProxyPlugin = class _MarketplaceProxyPlugin {
|
|
|
7762
7814
|
}
|
|
7763
7815
|
const target = `${cloudUrl}${incomingUrl.pathname}${incomingUrl.search}`;
|
|
7764
7816
|
if (method !== "GET" && method !== "HEAD") {
|
|
7765
|
-
return
|
|
7766
|
-
success: false,
|
|
7767
|
-
error: {
|
|
7768
|
-
code: "marketplace_method_not_allowed",
|
|
7769
|
-
message: `Marketplace proxy only forwards GET/HEAD; install via cloud.`
|
|
7770
|
-
}
|
|
7771
|
-
}, 405);
|
|
7817
|
+
return next();
|
|
7772
7818
|
}
|
|
7773
7819
|
const accept = c.req.header("accept") ?? "application/json";
|
|
7774
7820
|
const acceptLang = c.req.header("accept-language") ?? "";
|
|
@@ -7992,7 +8038,8 @@ var RuntimeConfigPlugin = class {
|
|
|
7992
8038
|
const rawApp = httpServer.getRawApp();
|
|
7993
8039
|
const features = {
|
|
7994
8040
|
installLocal: this.installLocal,
|
|
7995
|
-
marketplace: true
|
|
8041
|
+
marketplace: true,
|
|
8042
|
+
aiStudio: this.aiStudio
|
|
7996
8043
|
};
|
|
7997
8044
|
let envRegistry = null;
|
|
7998
8045
|
try {
|
|
@@ -8043,6 +8090,7 @@ var RuntimeConfigPlugin = class {
|
|
|
8043
8090
|
};
|
|
8044
8091
|
this.cloudUrl = config.controlPlaneUrl === "" ? "" : resolveCloudUrl(config.controlPlaneUrl) ?? "";
|
|
8045
8092
|
this.installLocal = !!config.installLocal;
|
|
8093
|
+
this.aiStudio = config.aiStudio !== false;
|
|
8046
8094
|
this.singleEnvironment = !!config.singleEnvironment;
|
|
8047
8095
|
const envName = (typeof process !== "undefined" ? process.env?.OS_PRODUCT_NAME : void 0)?.trim();
|
|
8048
8096
|
const envShort = (typeof process !== "undefined" ? process.env?.OS_PRODUCT_SHORT_NAME : void 0)?.trim();
|
|
@@ -8234,7 +8282,8 @@ var ObjectOSEnvironmentPlugin = class {
|
|
|
8234
8282
|
const factory = new ArtifactKernelFactory({
|
|
8235
8283
|
client,
|
|
8236
8284
|
envRegistry,
|
|
8237
|
-
logger: ctx.logger
|
|
8285
|
+
logger: ctx.logger,
|
|
8286
|
+
defaultRequires: this.config.defaultRequires
|
|
8238
8287
|
});
|
|
8239
8288
|
const kernelManager = new KernelManager({
|
|
8240
8289
|
factory,
|