@objectstack/objectql 6.8.1 → 7.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/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +102 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -81,15 +81,18 @@ type RegistryLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
|
81
81
|
*/
|
|
82
82
|
interface SchemaRegistryOptions {
|
|
83
83
|
/**
|
|
84
|
-
* Whether the host kernel runs in multi-tenant mode. When `true
|
|
85
|
-
*
|
|
84
|
+
* Whether the host kernel runs in multi-tenant mode. When `true`, the
|
|
85
|
+
* registry auto-injects `organization_id` (lookup → sys_organization)
|
|
86
86
|
* into every registered user object that doesn't already declare it and
|
|
87
87
|
* isn't `managedBy` an external subsystem or explicitly opted-out via
|
|
88
88
|
* `systemFields: false`.
|
|
89
89
|
*
|
|
90
90
|
* Sourced from the `OS_MULTI_TENANT` env var when not explicitly set —
|
|
91
91
|
* matches how the SecurityPlugin and CLI startup banner pick the mode.
|
|
92
|
-
*
|
|
92
|
+
* Default is `false` (single-tenant) so local `dev`/`start` runs seed
|
|
93
|
+
* demo data inline at boot; set `OS_MULTI_TENANT=true` for cloud /
|
|
94
|
+
* production multi-org deployments. Pass an explicit boolean to override
|
|
95
|
+
* (useful in tests).
|
|
93
96
|
*/
|
|
94
97
|
multiTenant?: boolean;
|
|
95
98
|
}
|
|
@@ -396,6 +399,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
396
399
|
collapsed: boolean;
|
|
397
400
|
columns: 1 | 2 | 3 | 4;
|
|
398
401
|
fields: any[];
|
|
402
|
+
name?: string | undefined;
|
|
399
403
|
label?: string | undefined;
|
|
400
404
|
description?: string | undefined;
|
|
401
405
|
visibleOn?: {
|
|
@@ -421,6 +425,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
421
425
|
collapsed: boolean;
|
|
422
426
|
columns: 1 | 2 | 3 | 4;
|
|
423
427
|
fields: any[];
|
|
428
|
+
name?: string | undefined;
|
|
424
429
|
label?: string | undefined;
|
|
425
430
|
description?: string | undefined;
|
|
426
431
|
visibleOn?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -81,15 +81,18 @@ type RegistryLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
|
81
81
|
*/
|
|
82
82
|
interface SchemaRegistryOptions {
|
|
83
83
|
/**
|
|
84
|
-
* Whether the host kernel runs in multi-tenant mode. When `true
|
|
85
|
-
*
|
|
84
|
+
* Whether the host kernel runs in multi-tenant mode. When `true`, the
|
|
85
|
+
* registry auto-injects `organization_id` (lookup → sys_organization)
|
|
86
86
|
* into every registered user object that doesn't already declare it and
|
|
87
87
|
* isn't `managedBy` an external subsystem or explicitly opted-out via
|
|
88
88
|
* `systemFields: false`.
|
|
89
89
|
*
|
|
90
90
|
* Sourced from the `OS_MULTI_TENANT` env var when not explicitly set —
|
|
91
91
|
* matches how the SecurityPlugin and CLI startup banner pick the mode.
|
|
92
|
-
*
|
|
92
|
+
* Default is `false` (single-tenant) so local `dev`/`start` runs seed
|
|
93
|
+
* demo data inline at boot; set `OS_MULTI_TENANT=true` for cloud /
|
|
94
|
+
* production multi-org deployments. Pass an explicit boolean to override
|
|
95
|
+
* (useful in tests).
|
|
93
96
|
*/
|
|
94
97
|
multiTenant?: boolean;
|
|
95
98
|
}
|
|
@@ -396,6 +399,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
396
399
|
collapsed: boolean;
|
|
397
400
|
columns: 1 | 2 | 3 | 4;
|
|
398
401
|
fields: any[];
|
|
402
|
+
name?: string | undefined;
|
|
399
403
|
label?: string | undefined;
|
|
400
404
|
description?: string | undefined;
|
|
401
405
|
visibleOn?: {
|
|
@@ -421,6 +425,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
421
425
|
collapsed: boolean;
|
|
422
426
|
columns: 1 | 2 | 3 | 4;
|
|
423
427
|
fields: any[];
|
|
428
|
+
name?: string | undefined;
|
|
424
429
|
label?: string | undefined;
|
|
425
430
|
description?: string | undefined;
|
|
426
431
|
visibleOn?: {
|
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var SchemaRegistry = class {
|
|
|
179
179
|
if (options.multiTenant !== void 0) {
|
|
180
180
|
this.multiTenant = options.multiTenant;
|
|
181
181
|
} else {
|
|
182
|
-
this.multiTenant = String(process.env.OS_MULTI_TENANT ?? "
|
|
182
|
+
this.multiTenant = String(process.env.OS_MULTI_TENANT ?? "false").toLowerCase() !== "false";
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
get logLevel() {
|
|
@@ -1229,29 +1229,10 @@ var TYPE_TO_SCHEMA = {
|
|
|
1229
1229
|
flow: import_automation.FlowSchema,
|
|
1230
1230
|
workflow: import_automation.WorkflowRuleSchema,
|
|
1231
1231
|
approval: import_automation.ApprovalProcessSchema,
|
|
1232
|
+
job: import_system.JobSchema,
|
|
1232
1233
|
hook: import_data2.HookSchema
|
|
1233
1234
|
};
|
|
1234
|
-
var TYPE_TO_FORM =
|
|
1235
|
-
object: import_data2.objectForm,
|
|
1236
|
-
field: import_data2.fieldForm,
|
|
1237
|
-
hook: import_data2.hookForm,
|
|
1238
|
-
report: import_ui2.reportForm,
|
|
1239
|
-
view: import_ui2.viewForm,
|
|
1240
|
-
app: import_ui2.appForm,
|
|
1241
|
-
dashboard: import_ui2.dashboardForm,
|
|
1242
|
-
role: import_identity.roleForm,
|
|
1243
|
-
action: import_ui2.actionForm,
|
|
1244
|
-
page: import_ui2.pageForm,
|
|
1245
|
-
agent: import_ai.agentForm,
|
|
1246
|
-
tool: import_ai.toolForm,
|
|
1247
|
-
skill: import_ai.skillForm,
|
|
1248
|
-
flow: import_automation.flowForm,
|
|
1249
|
-
workflow: import_automation.workflowForm,
|
|
1250
|
-
approval: import_automation.approvalForm,
|
|
1251
|
-
permission: import_security.permissionForm,
|
|
1252
|
-
profile: import_security.permissionForm,
|
|
1253
|
-
email_template: import_system.emailTemplateForm
|
|
1254
|
-
};
|
|
1235
|
+
var TYPE_TO_FORM = import_system.METADATA_FORM_REGISTRY;
|
|
1255
1236
|
var _jsonSchemaCache = /* @__PURE__ */ new WeakMap();
|
|
1256
1237
|
function toJsonSchemaSafe(schema) {
|
|
1257
1238
|
const cached = _jsonSchemaCache.get(schema);
|
|
@@ -1361,6 +1342,81 @@ var HAND_CRAFTED_SCHEMAS = {
|
|
|
1361
1342
|
},
|
|
1362
1343
|
required: ["name", "label", "type"],
|
|
1363
1344
|
additionalProperties: true
|
|
1345
|
+
},
|
|
1346
|
+
// Validation rules live inside `object.validations[]`. The canonical
|
|
1347
|
+
// ValidationRuleSchema is a discriminated union of 9 variants; the
|
|
1348
|
+
// generic SchemaForm renderer treats unions as opaque JSON, so we
|
|
1349
|
+
// ship a *flat* form-friendly schema covering the common base
|
|
1350
|
+
// properties plus every variant-specific field as optional. Save-time
|
|
1351
|
+
// validation is unaffected — the union schema is still authoritative
|
|
1352
|
+
// at write time.
|
|
1353
|
+
validation: {
|
|
1354
|
+
type: "object",
|
|
1355
|
+
properties: {
|
|
1356
|
+
// --- Base fields (all variants) ---
|
|
1357
|
+
name: { type: "string", description: "Unique rule name (snake_case)" },
|
|
1358
|
+
label: { type: "string" },
|
|
1359
|
+
description: { type: "string" },
|
|
1360
|
+
type: {
|
|
1361
|
+
type: "string",
|
|
1362
|
+
enum: [
|
|
1363
|
+
"script",
|
|
1364
|
+
"unique",
|
|
1365
|
+
"state_machine",
|
|
1366
|
+
"format",
|
|
1367
|
+
"cross_field",
|
|
1368
|
+
"json",
|
|
1369
|
+
"async",
|
|
1370
|
+
"custom",
|
|
1371
|
+
"conditional"
|
|
1372
|
+
],
|
|
1373
|
+
default: "script",
|
|
1374
|
+
description: "Validation variant"
|
|
1375
|
+
},
|
|
1376
|
+
active: { type: "boolean", default: true },
|
|
1377
|
+
events: {
|
|
1378
|
+
type: "array",
|
|
1379
|
+
items: { type: "string", enum: ["insert", "update", "delete"] },
|
|
1380
|
+
default: ["insert", "update"]
|
|
1381
|
+
},
|
|
1382
|
+
priority: { type: "number", default: 100, minimum: 0, maximum: 9999 },
|
|
1383
|
+
severity: {
|
|
1384
|
+
type: "string",
|
|
1385
|
+
enum: ["error", "warning", "info"],
|
|
1386
|
+
default: "error"
|
|
1387
|
+
},
|
|
1388
|
+
message: { type: "string" },
|
|
1389
|
+
tags: { type: "array", items: { type: "string" } },
|
|
1390
|
+
// --- Variant-specific (all optional, gated by `type`) ---
|
|
1391
|
+
condition: {
|
|
1392
|
+
type: "string",
|
|
1393
|
+
description: "CEL predicate (type=script). True \u21D2 validation fails."
|
|
1394
|
+
},
|
|
1395
|
+
fields: {
|
|
1396
|
+
type: "array",
|
|
1397
|
+
items: { type: "string" },
|
|
1398
|
+
description: "Fields (type=unique / cross_field)."
|
|
1399
|
+
},
|
|
1400
|
+
scope: { type: "string", description: "CEL scope predicate (type=unique)." },
|
|
1401
|
+
caseSensitive: { type: "boolean", default: true },
|
|
1402
|
+
field: { type: "string", description: "Single field (type=state_machine / format)." },
|
|
1403
|
+
transitions: {
|
|
1404
|
+
type: "object",
|
|
1405
|
+
additionalProperties: { type: "array", items: { type: "string" } },
|
|
1406
|
+
description: "Map { OldState: [AllowedNewStates] } (type=state_machine)."
|
|
1407
|
+
},
|
|
1408
|
+
regex: { type: "string", description: "Regex (type=format)." },
|
|
1409
|
+
format: {
|
|
1410
|
+
type: "string",
|
|
1411
|
+
enum: ["email", "url", "phone", "json"],
|
|
1412
|
+
description: "Built-in format (type=format)."
|
|
1413
|
+
},
|
|
1414
|
+
url: { type: "string", description: "Endpoint URL (type=async)." },
|
|
1415
|
+
handler: { type: "string", description: "Handler reference (type=custom)." },
|
|
1416
|
+
when: { type: "string", description: "Outer condition (type=conditional)." }
|
|
1417
|
+
},
|
|
1418
|
+
required: ["name", "type", "message"],
|
|
1419
|
+
additionalProperties: true
|
|
1364
1420
|
}
|
|
1365
1421
|
};
|
|
1366
1422
|
var FORM_VIEW_TYPES = /* @__PURE__ */ new Set(["simple", "tabbed", "wizard", "split", "drawer", "modal"]);
|
|
@@ -4791,6 +4847,7 @@ var _ObjectQL = class _ObjectQL {
|
|
|
4791
4847
|
"workflows",
|
|
4792
4848
|
"approvals",
|
|
4793
4849
|
"webhooks",
|
|
4850
|
+
"jobs",
|
|
4794
4851
|
// Security Protocol
|
|
4795
4852
|
"roles",
|
|
4796
4853
|
"permissions",
|
|
@@ -6150,7 +6207,29 @@ var ObjectQLPlugin = class {
|
|
|
6150
6207
|
ctx.registerService("protocol", protocolShim);
|
|
6151
6208
|
ctx.logger.info("Protocol service registered");
|
|
6152
6209
|
ctx.registerService("analytics", {
|
|
6153
|
-
|
|
6210
|
+
// HttpDispatcher passes the raw POST body (AnalyticsQuery shape:
|
|
6211
|
+
// `{ cube, measures, dimensions, where?, filters?, ... }`). The
|
|
6212
|
+
// protocol shim's `analyticsQuery` expects the wrapped envelope
|
|
6213
|
+
// `{ cube, query }` and destructures `request.query` for dims /
|
|
6214
|
+
// measures. Reshape here so the destructure resolves to the
|
|
6215
|
+
// analytics query instead of `undefined` (which caused
|
|
6216
|
+
// "Cannot read properties of undefined (reading 'dimensions')").
|
|
6217
|
+
//
|
|
6218
|
+
// `analyticsQuery` also returns its own `{ success, data: { rows,
|
|
6219
|
+
// fields } }` envelope. HttpDispatcher wraps service responses
|
|
6220
|
+
// again with `success(result)`, so without unwrapping here the
|
|
6221
|
+
// client sees `{success, data:{success, data:{rows, fields}}}` —
|
|
6222
|
+
// KPI widgets read `data.rows` and silently get nothing. Unwrap
|
|
6223
|
+
// to the inner `{ rows, fields }` payload so a single wrap from
|
|
6224
|
+
// the dispatcher yields the canonical shape.
|
|
6225
|
+
query: async (body) => {
|
|
6226
|
+
const envelope = body && typeof body === "object" && "query" in body && "cube" in body ? body : { cube: body?.cube, query: body };
|
|
6227
|
+
const result = await protocolShim.analyticsQuery(envelope);
|
|
6228
|
+
if (result && typeof result === "object" && "success" in result && "data" in result) {
|
|
6229
|
+
return result.data;
|
|
6230
|
+
}
|
|
6231
|
+
return result;
|
|
6232
|
+
},
|
|
6154
6233
|
getMeta: async () => ({
|
|
6155
6234
|
cubes: [],
|
|
6156
6235
|
message: "Analytics meta endpoint not implemented by ObjectQL adapter"
|