@objectstack/objectql 6.8.0 → 6.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.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +101 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -129,7 +129,7 @@ var SchemaRegistry = class {
|
|
|
129
129
|
if (options.multiTenant !== void 0) {
|
|
130
130
|
this.multiTenant = options.multiTenant;
|
|
131
131
|
} else {
|
|
132
|
-
this.multiTenant = String(process.env.OS_MULTI_TENANT ?? "
|
|
132
|
+
this.multiTenant = String(process.env.OS_MULTI_TENANT ?? "false").toLowerCase() !== "false";
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
get logLevel() {
|
|
@@ -1156,7 +1156,7 @@ import { PLURAL_TO_SINGULAR as PLURAL_TO_SINGULAR2, SINGULAR_TO_PLURAL as SINGUL
|
|
|
1156
1156
|
import { ListViewSchema, FormViewSchema, DashboardSchema, AppSchema as AppSchema2, PageSchema, ReportSchema, ActionSchema, reportForm, viewForm, appForm, dashboardForm, actionForm, pageForm } from "@objectstack/spec/ui";
|
|
1157
1157
|
import { RoleSchema, roleForm } from "@objectstack/spec/identity";
|
|
1158
1158
|
import { PermissionSetSchema, permissionForm } from "@objectstack/spec/security";
|
|
1159
|
-
import { EmailTemplateSchema, emailTemplateForm } from "@objectstack/spec/system";
|
|
1159
|
+
import { EmailTemplateSchema, emailTemplateForm, JobSchema } from "@objectstack/spec/system";
|
|
1160
1160
|
import { ToolSchema, SkillSchema, AgentSchema, agentForm, toolForm, skillForm } from "@objectstack/spec/ai";
|
|
1161
1161
|
import { FlowSchema, WorkflowRuleSchema, ApprovalProcessSchema, flowForm, workflowForm, approvalForm } from "@objectstack/spec/automation";
|
|
1162
1162
|
import { DEFAULT_METADATA_TYPE_REGISTRY as DEFAULT_METADATA_TYPE_REGISTRY2 } from "@objectstack/spec/kernel";
|
|
@@ -1179,6 +1179,7 @@ var TYPE_TO_SCHEMA = {
|
|
|
1179
1179
|
flow: FlowSchema,
|
|
1180
1180
|
workflow: WorkflowRuleSchema,
|
|
1181
1181
|
approval: ApprovalProcessSchema,
|
|
1182
|
+
job: JobSchema,
|
|
1182
1183
|
hook: HookSchema
|
|
1183
1184
|
};
|
|
1184
1185
|
var TYPE_TO_FORM = {
|
|
@@ -1311,6 +1312,81 @@ var HAND_CRAFTED_SCHEMAS = {
|
|
|
1311
1312
|
},
|
|
1312
1313
|
required: ["name", "label", "type"],
|
|
1313
1314
|
additionalProperties: true
|
|
1315
|
+
},
|
|
1316
|
+
// Validation rules live inside `object.validations[]`. The canonical
|
|
1317
|
+
// ValidationRuleSchema is a discriminated union of 9 variants; the
|
|
1318
|
+
// generic SchemaForm renderer treats unions as opaque JSON, so we
|
|
1319
|
+
// ship a *flat* form-friendly schema covering the common base
|
|
1320
|
+
// properties plus every variant-specific field as optional. Save-time
|
|
1321
|
+
// validation is unaffected — the union schema is still authoritative
|
|
1322
|
+
// at write time.
|
|
1323
|
+
validation: {
|
|
1324
|
+
type: "object",
|
|
1325
|
+
properties: {
|
|
1326
|
+
// --- Base fields (all variants) ---
|
|
1327
|
+
name: { type: "string", description: "Unique rule name (snake_case)" },
|
|
1328
|
+
label: { type: "string" },
|
|
1329
|
+
description: { type: "string" },
|
|
1330
|
+
type: {
|
|
1331
|
+
type: "string",
|
|
1332
|
+
enum: [
|
|
1333
|
+
"script",
|
|
1334
|
+
"unique",
|
|
1335
|
+
"state_machine",
|
|
1336
|
+
"format",
|
|
1337
|
+
"cross_field",
|
|
1338
|
+
"json",
|
|
1339
|
+
"async",
|
|
1340
|
+
"custom",
|
|
1341
|
+
"conditional"
|
|
1342
|
+
],
|
|
1343
|
+
default: "script",
|
|
1344
|
+
description: "Validation variant"
|
|
1345
|
+
},
|
|
1346
|
+
active: { type: "boolean", default: true },
|
|
1347
|
+
events: {
|
|
1348
|
+
type: "array",
|
|
1349
|
+
items: { type: "string", enum: ["insert", "update", "delete"] },
|
|
1350
|
+
default: ["insert", "update"]
|
|
1351
|
+
},
|
|
1352
|
+
priority: { type: "number", default: 100, minimum: 0, maximum: 9999 },
|
|
1353
|
+
severity: {
|
|
1354
|
+
type: "string",
|
|
1355
|
+
enum: ["error", "warning", "info"],
|
|
1356
|
+
default: "error"
|
|
1357
|
+
},
|
|
1358
|
+
message: { type: "string" },
|
|
1359
|
+
tags: { type: "array", items: { type: "string" } },
|
|
1360
|
+
// --- Variant-specific (all optional, gated by `type`) ---
|
|
1361
|
+
condition: {
|
|
1362
|
+
type: "string",
|
|
1363
|
+
description: "CEL predicate (type=script). True \u21D2 validation fails."
|
|
1364
|
+
},
|
|
1365
|
+
fields: {
|
|
1366
|
+
type: "array",
|
|
1367
|
+
items: { type: "string" },
|
|
1368
|
+
description: "Fields (type=unique / cross_field)."
|
|
1369
|
+
},
|
|
1370
|
+
scope: { type: "string", description: "CEL scope predicate (type=unique)." },
|
|
1371
|
+
caseSensitive: { type: "boolean", default: true },
|
|
1372
|
+
field: { type: "string", description: "Single field (type=state_machine / format)." },
|
|
1373
|
+
transitions: {
|
|
1374
|
+
type: "object",
|
|
1375
|
+
additionalProperties: { type: "array", items: { type: "string" } },
|
|
1376
|
+
description: "Map { OldState: [AllowedNewStates] } (type=state_machine)."
|
|
1377
|
+
},
|
|
1378
|
+
regex: { type: "string", description: "Regex (type=format)." },
|
|
1379
|
+
format: {
|
|
1380
|
+
type: "string",
|
|
1381
|
+
enum: ["email", "url", "phone", "json"],
|
|
1382
|
+
description: "Built-in format (type=format)."
|
|
1383
|
+
},
|
|
1384
|
+
url: { type: "string", description: "Endpoint URL (type=async)." },
|
|
1385
|
+
handler: { type: "string", description: "Handler reference (type=custom)." },
|
|
1386
|
+
when: { type: "string", description: "Outer condition (type=conditional)." }
|
|
1387
|
+
},
|
|
1388
|
+
required: ["name", "type", "message"],
|
|
1389
|
+
additionalProperties: true
|
|
1314
1390
|
}
|
|
1315
1391
|
};
|
|
1316
1392
|
var FORM_VIEW_TYPES = /* @__PURE__ */ new Set(["simple", "tabbed", "wizard", "split", "drawer", "modal"]);
|
|
@@ -4741,6 +4817,7 @@ var _ObjectQL = class _ObjectQL {
|
|
|
4741
4817
|
"workflows",
|
|
4742
4818
|
"approvals",
|
|
4743
4819
|
"webhooks",
|
|
4820
|
+
"jobs",
|
|
4744
4821
|
// Security Protocol
|
|
4745
4822
|
"roles",
|
|
4746
4823
|
"permissions",
|
|
@@ -6100,7 +6177,29 @@ var ObjectQLPlugin = class {
|
|
|
6100
6177
|
ctx.registerService("protocol", protocolShim);
|
|
6101
6178
|
ctx.logger.info("Protocol service registered");
|
|
6102
6179
|
ctx.registerService("analytics", {
|
|
6103
|
-
|
|
6180
|
+
// HttpDispatcher passes the raw POST body (AnalyticsQuery shape:
|
|
6181
|
+
// `{ cube, measures, dimensions, where?, filters?, ... }`). The
|
|
6182
|
+
// protocol shim's `analyticsQuery` expects the wrapped envelope
|
|
6183
|
+
// `{ cube, query }` and destructures `request.query` for dims /
|
|
6184
|
+
// measures. Reshape here so the destructure resolves to the
|
|
6185
|
+
// analytics query instead of `undefined` (which caused
|
|
6186
|
+
// "Cannot read properties of undefined (reading 'dimensions')").
|
|
6187
|
+
//
|
|
6188
|
+
// `analyticsQuery` also returns its own `{ success, data: { rows,
|
|
6189
|
+
// fields } }` envelope. HttpDispatcher wraps service responses
|
|
6190
|
+
// again with `success(result)`, so without unwrapping here the
|
|
6191
|
+
// client sees `{success, data:{success, data:{rows, fields}}}` —
|
|
6192
|
+
// KPI widgets read `data.rows` and silently get nothing. Unwrap
|
|
6193
|
+
// to the inner `{ rows, fields }` payload so a single wrap from
|
|
6194
|
+
// the dispatcher yields the canonical shape.
|
|
6195
|
+
query: async (body) => {
|
|
6196
|
+
const envelope = body && typeof body === "object" && "query" in body && "cube" in body ? body : { cube: body?.cube, query: body };
|
|
6197
|
+
const result = await protocolShim.analyticsQuery(envelope);
|
|
6198
|
+
if (result && typeof result === "object" && "success" in result && "data" in result) {
|
|
6199
|
+
return result.data;
|
|
6200
|
+
}
|
|
6201
|
+
return result;
|
|
6202
|
+
},
|
|
6104
6203
|
getMeta: async () => ({
|
|
6105
6204
|
cubes: [],
|
|
6106
6205
|
message: "Analytics meta endpoint not implemented by ObjectQL adapter"
|