@objectstack/objectql 7.6.0 → 7.7.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 +13 -8
- package/dist/index.d.ts +13 -8
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -81,11 +81,13 @@ 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.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* isn't `managedBy` an external subsystem
|
|
88
|
-
* `systemFields:
|
|
84
|
+
* Whether the host kernel runs in multi-tenant mode. The `organization_id`
|
|
85
|
+
* column itself is auto-injected regardless of this flag (lookup →
|
|
86
|
+
* sys_organization, on every registered object that doesn't already declare
|
|
87
|
+
* it, isn't `managedBy` an external subsystem, and hasn't opted out via
|
|
88
|
+
* `systemFields`/`tenancy.enabled:false`). When `true` the injected column
|
|
89
|
+
* is additionally INDEXED — single-tenant stacks skip the index since
|
|
90
|
+
* nothing ever filters by organization.
|
|
89
91
|
*
|
|
90
92
|
* Sourced from the `OS_MULTI_TENANT` env var when not explicitly set —
|
|
91
93
|
* matches how the SecurityPlugin and CLI startup banner pick the mode.
|
|
@@ -107,9 +109,12 @@ interface SchemaRegistryOptions {
|
|
|
107
109
|
* via the natural `{ ...sys, ...authored }` merge.
|
|
108
110
|
*
|
|
109
111
|
* Currently injects:
|
|
110
|
-
* - `organization_id` —
|
|
111
|
-
*
|
|
112
|
-
*
|
|
112
|
+
* - `organization_id` — always provisioned (unless the object opts out via
|
|
113
|
+
* `systemFields`/`tenancy.enabled:false` or is `better-auth` managed) so
|
|
114
|
+
* the column never depends on the global multi-tenant flag. Required-false;
|
|
115
|
+
* org-scoping populates it on insert in multi-tenant mode, and it stays
|
|
116
|
+
* NULL on single-tenant stacks. Only the column's INDEX is gated on
|
|
117
|
+
* `multiTenant` (no per-tenant filtering exists single-tenant).
|
|
113
118
|
* - `created_at` / `created_by` / `updated_at` / `updated_by` — audit
|
|
114
119
|
* fields. Marked `system: true, readonly: true` so detail views can
|
|
115
120
|
* surface them in a dedicated "System Information" section while
|
package/dist/index.d.ts
CHANGED
|
@@ -81,11 +81,13 @@ 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.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* isn't `managedBy` an external subsystem
|
|
88
|
-
* `systemFields:
|
|
84
|
+
* Whether the host kernel runs in multi-tenant mode. The `organization_id`
|
|
85
|
+
* column itself is auto-injected regardless of this flag (lookup →
|
|
86
|
+
* sys_organization, on every registered object that doesn't already declare
|
|
87
|
+
* it, isn't `managedBy` an external subsystem, and hasn't opted out via
|
|
88
|
+
* `systemFields`/`tenancy.enabled:false`). When `true` the injected column
|
|
89
|
+
* is additionally INDEXED — single-tenant stacks skip the index since
|
|
90
|
+
* nothing ever filters by organization.
|
|
89
91
|
*
|
|
90
92
|
* Sourced from the `OS_MULTI_TENANT` env var when not explicitly set —
|
|
91
93
|
* matches how the SecurityPlugin and CLI startup banner pick the mode.
|
|
@@ -107,9 +109,12 @@ interface SchemaRegistryOptions {
|
|
|
107
109
|
* via the natural `{ ...sys, ...authored }` merge.
|
|
108
110
|
*
|
|
109
111
|
* Currently injects:
|
|
110
|
-
* - `organization_id` —
|
|
111
|
-
*
|
|
112
|
-
*
|
|
112
|
+
* - `organization_id` — always provisioned (unless the object opts out via
|
|
113
|
+
* `systemFields`/`tenancy.enabled:false` or is `better-auth` managed) so
|
|
114
|
+
* the column never depends on the global multi-tenant flag. Required-false;
|
|
115
|
+
* org-scoping populates it on insert in multi-tenant mode, and it stays
|
|
116
|
+
* NULL on single-tenant stacks. Only the column's INDEX is gated on
|
|
117
|
+
* `multiTenant` (no per-tenant filtering exists single-tenant).
|
|
113
118
|
* - `created_at` / `created_by` / `updated_at` / `updated_by` — audit
|
|
114
119
|
* fields. Marked `system: true, readonly: true` so detail views can
|
|
115
120
|
* surface them in a dedicated "System Information" section while
|
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ function applySystemFields(schema, opts) {
|
|
|
110
110
|
if (schema.managedBy === "better-auth") return schema;
|
|
111
111
|
const sf = typeof schema.systemFields === "object" && schema.systemFields !== null ? schema.systemFields : void 0;
|
|
112
112
|
const tenancyDisabled = schema.tenancy?.enabled === false;
|
|
113
|
-
const wantTenant =
|
|
113
|
+
const wantTenant = sf?.tenant !== false && !tenancyDisabled;
|
|
114
114
|
const wantAudit = sf?.audit !== false;
|
|
115
115
|
const additions = {};
|
|
116
116
|
if (wantTenant && !schema.fields?.organization_id) {
|
|
@@ -119,11 +119,11 @@ function applySystemFields(schema, opts) {
|
|
|
119
119
|
reference: "sys_organization",
|
|
120
120
|
label: "Organization",
|
|
121
121
|
required: false,
|
|
122
|
-
indexed:
|
|
122
|
+
indexed: opts.multiTenant,
|
|
123
123
|
hidden: true,
|
|
124
124
|
readonly: true,
|
|
125
125
|
system: true,
|
|
126
|
-
description: "Tenant scope (auto-populated by
|
|
126
|
+
description: "Tenant scope (auto-populated by org-scoping on insert; NULL on single-tenant stacks)."
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
if (wantAudit) {
|
|
@@ -7078,7 +7078,11 @@ var _ObjectQL = class _ObjectQL {
|
|
|
7078
7078
|
const driver = this.getDriver(object);
|
|
7079
7079
|
let id = data.id;
|
|
7080
7080
|
if (!id && options?.where && typeof options.where === "object" && "id" in options.where) {
|
|
7081
|
-
|
|
7081
|
+
const whereId = options.where.id;
|
|
7082
|
+
const t = typeof whereId;
|
|
7083
|
+
if (whereId !== null && (t === "string" || t === "number" || t === "bigint")) {
|
|
7084
|
+
id = whereId;
|
|
7085
|
+
}
|
|
7082
7086
|
}
|
|
7083
7087
|
const opCtx = {
|
|
7084
7088
|
object,
|
|
@@ -7803,6 +7807,7 @@ var MetadataFacade = class {
|
|
|
7803
7807
|
|
|
7804
7808
|
// src/plugin.ts
|
|
7805
7809
|
var import_system3 = require("@objectstack/spec/system");
|
|
7810
|
+
var import_metadata_core3 = require("@objectstack/metadata-core");
|
|
7806
7811
|
function hasLoadMetaFromDb(service) {
|
|
7807
7812
|
return typeof service === "object" && service !== null && typeof service["loadMetaFromDb"] === "function";
|
|
7808
7813
|
}
|
|
@@ -7839,6 +7844,21 @@ var ObjectQLPlugin = class {
|
|
|
7839
7844
|
ctx.logger.info("ObjectQL engine registered", {
|
|
7840
7845
|
services: ["objectql", "data", "manifest"]
|
|
7841
7846
|
});
|
|
7847
|
+
if (this.environmentId === void 0) {
|
|
7848
|
+
this.ql.registerApp({
|
|
7849
|
+
id: "com.objectstack.metadata-objects",
|
|
7850
|
+
name: "Metadata Platform Objects",
|
|
7851
|
+
version: "1.0.0",
|
|
7852
|
+
type: "plugin",
|
|
7853
|
+
scope: "system",
|
|
7854
|
+
objects: [
|
|
7855
|
+
import_metadata_core3.SysMetadataObject,
|
|
7856
|
+
import_metadata_core3.SysMetadataHistoryObject,
|
|
7857
|
+
import_metadata_core3.SysMetadataAuditObject,
|
|
7858
|
+
import_metadata_core3.SysViewDefinitionObject
|
|
7859
|
+
]
|
|
7860
|
+
});
|
|
7861
|
+
}
|
|
7842
7862
|
const protocolShim = new ObjectStackProtocolImplementation(
|
|
7843
7863
|
this.ql,
|
|
7844
7864
|
() => ctx.getServices ? ctx.getServices() : /* @__PURE__ */ new Map(),
|