@venizia/ignis-connectors 0.2.0-12 → 0.2.0-13
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/cjs/common/index.d.ts +2 -0
- package/dist/cjs/common/index.d.ts.map +1 -0
- package/dist/cjs/common/index.js +18 -0
- package/dist/cjs/common/index.js.map +1 -0
- package/dist/cjs/common/scope-filter.d.ts +10 -0
- package/dist/cjs/common/scope-filter.d.ts.map +1 -0
- package/dist/cjs/common/scope-filter.js +53 -0
- package/dist/cjs/common/scope-filter.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/common/index.d.ts +2 -0
- package/dist/esm/common/index.d.ts.map +1 -0
- package/dist/esm/common/index.js +2 -0
- package/dist/esm/common/index.js.map +1 -0
- package/dist/esm/common/scope-filter.d.ts +10 -0
- package/dist/esm/common/scope-filter.d.ts.map +1 -0
- package/dist/esm/common/scope-filter.js +49 -0
- package/dist/esm/common/scope-filter.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./scope-filter"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refuses to boot when `settings.scopeFilter` is declared where it cannot be honoured. Both cases
|
|
3
|
+
* are silent at runtime and fail in OPPOSITE directions: a search-backed model returns more rows,
|
|
4
|
+
* a context-less one returns none. The caller supplies `asyncContextEnabled` so no application
|
|
5
|
+
* config type reaches into this tier.
|
|
6
|
+
*/
|
|
7
|
+
export declare const assertScopeFilterSupported: (opts: {
|
|
8
|
+
asyncContextEnabled: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
//# sourceMappingURL=scope-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-filter.d.ts","sourceRoot":"","sources":["../../../src/common/scope-filter.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,MAAM;IAAE,mBAAmB,EAAE,OAAO,CAAA;CAAE,KAAG,IA4CnF,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertScopeFilterSupported = void 0;
|
|
4
|
+
const common_1 = require("@venizia/ignis-helpers/common");
|
|
5
|
+
const core_1 = require("@venizia/ignis-helpers/core");
|
|
6
|
+
const ignis_kernel_1 = require("@venizia/ignis-kernel");
|
|
7
|
+
const models_1 = require("../search/core/models");
|
|
8
|
+
/**
|
|
9
|
+
* Refuses to boot when `settings.scopeFilter` is declared where it cannot be honoured. Both cases
|
|
10
|
+
* are silent at runtime and fail in OPPOSITE directions: a search-backed model returns more rows,
|
|
11
|
+
* a context-less one returns none. The caller supplies `asyncContextEnabled` so no application
|
|
12
|
+
* config type reaches into this tier.
|
|
13
|
+
*/
|
|
14
|
+
const assertScopeFilterSupported = (opts) => {
|
|
15
|
+
const models = ignis_kernel_1.MetadataRegistry.getInstance().getAllModels();
|
|
16
|
+
const searchBacked = [];
|
|
17
|
+
const withoutAmbientContext = [];
|
|
18
|
+
for (const [name, entry] of models) {
|
|
19
|
+
if (!entry.metadata?.settings?.scopeFilter) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const modelClass = (0, common_1.resolveValue)(entry.target);
|
|
23
|
+
if (modelClass === models_1.BaseSearchEntity || modelClass.prototype instanceof models_1.BaseSearchEntity) {
|
|
24
|
+
searchBacked.push(name);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (!opts.asyncContextEnabled) {
|
|
28
|
+
withoutAmbientContext.push(name);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (searchBacked.length > 0) {
|
|
32
|
+
throw (0, core_1.getError)({
|
|
33
|
+
message: [
|
|
34
|
+
`[assertScopeFilterSupported] settings.scopeFilter on a search-backed model | models: ${searchBacked.join(', ')}`,
|
|
35
|
+
'Search repositories never read this setting, so no row scope is applied.',
|
|
36
|
+
'Unlike the relational path, a missing scope here returns MORE rows rather than none - nothing fails, the result is just wider.',
|
|
37
|
+
'Scope the search query in the application, and remove settings.scopeFilter from the model.',
|
|
38
|
+
].join(' | '),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (withoutAmbientContext.length > 0) {
|
|
42
|
+
throw (0, core_1.getError)({
|
|
43
|
+
message: [
|
|
44
|
+
`[assertScopeFilterSupported] settings.scopeFilter declared while asyncContext.enable is false | models: ${withoutAmbientContext.join(', ')}`,
|
|
45
|
+
'scopeFilter.resolve() takes no arguments, so the ambient request context is its only input.',
|
|
46
|
+
'With no context store every resolve() returns undefined, onMissing denies by default, and EVERY query on these models matches zero rows - with nothing naming the flag as the cause.',
|
|
47
|
+
'Set asyncContext.enable to true, or remove settings.scopeFilter.',
|
|
48
|
+
].join(' | '),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.assertScopeFilterSupported = assertScopeFilterSupported;
|
|
53
|
+
//# sourceMappingURL=scope-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-filter.js","sourceRoot":"","sources":["../../../src/common/scope-filter.ts"],"names":[],"mappings":";;;AAAA,0DAA6D;AAC7D,sDAAuD;AACvD,wDAAyD;AACzD,iDAAwD;AAExD;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CAAC,IAAsC,EAAQ,EAAE;IACzF,MAAM,MAAM,GAAG,+BAAgB,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC;IAE7D,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,qBAAqB,GAAa,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,qBAAY,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE9C,IAAI,UAAU,KAAK,yBAAgB,IAAI,UAAU,CAAC,SAAS,YAAY,yBAAgB,EAAE,CAAC;YACxF,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,SAAS;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAA,eAAQ,EAAC;YACb,OAAO,EAAE;gBACP,wFAAwF,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACjH,0EAA0E;gBAC1E,gIAAgI;gBAChI,4FAA4F;aAC7F,CAAC,IAAI,CAAC,KAAK,CAAC;SACd,CAAC,CAAC;IACL,CAAC;IAED,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,IAAA,eAAQ,EAAC;YACb,OAAO,EAAE;gBACP,2GAA2G,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAC7I,6FAA6F;gBAC7F,sLAAsL;gBACtL,kEAAkE;aACnE,CAAC,IAAI,CAAC,KAAK,CAAC;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AA5CW,QAAA,0BAA0B,8BA4CrC"}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./common"), exports);
|
|
17
18
|
__exportStar(require("./relational/core"), exports);
|
|
18
19
|
__exportStar(require("./search/core"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,oDAAkC;AAClC,gDAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refuses to boot when `settings.scopeFilter` is declared where it cannot be honoured. Both cases
|
|
3
|
+
* are silent at runtime and fail in OPPOSITE directions: a search-backed model returns more rows,
|
|
4
|
+
* a context-less one returns none. The caller supplies `asyncContextEnabled` so no application
|
|
5
|
+
* config type reaches into this tier.
|
|
6
|
+
*/
|
|
7
|
+
export declare const assertScopeFilterSupported: (opts: {
|
|
8
|
+
asyncContextEnabled: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
//# sourceMappingURL=scope-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-filter.d.ts","sourceRoot":"","sources":["../../../src/common/scope-filter.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,MAAM;IAAE,mBAAmB,EAAE,OAAO,CAAA;CAAE,KAAG,IA4CnF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { resolveValue } from '@venizia/ignis-helpers/common';
|
|
2
|
+
import { getError } from '@venizia/ignis-helpers/core';
|
|
3
|
+
import { MetadataRegistry } from '@venizia/ignis-kernel';
|
|
4
|
+
import { BaseSearchEntity } from '../search/core/models/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Refuses to boot when `settings.scopeFilter` is declared where it cannot be honoured. Both cases
|
|
7
|
+
* are silent at runtime and fail in OPPOSITE directions: a search-backed model returns more rows,
|
|
8
|
+
* a context-less one returns none. The caller supplies `asyncContextEnabled` so no application
|
|
9
|
+
* config type reaches into this tier.
|
|
10
|
+
*/
|
|
11
|
+
export const assertScopeFilterSupported = (opts) => {
|
|
12
|
+
const models = MetadataRegistry.getInstance().getAllModels();
|
|
13
|
+
const searchBacked = [];
|
|
14
|
+
const withoutAmbientContext = [];
|
|
15
|
+
for (const [name, entry] of models) {
|
|
16
|
+
if (!entry.metadata?.settings?.scopeFilter) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const modelClass = resolveValue(entry.target);
|
|
20
|
+
if (modelClass === BaseSearchEntity || modelClass.prototype instanceof BaseSearchEntity) {
|
|
21
|
+
searchBacked.push(name);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!opts.asyncContextEnabled) {
|
|
25
|
+
withoutAmbientContext.push(name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (searchBacked.length > 0) {
|
|
29
|
+
throw getError({
|
|
30
|
+
message: [
|
|
31
|
+
`[assertScopeFilterSupported] settings.scopeFilter on a search-backed model | models: ${searchBacked.join(', ')}`,
|
|
32
|
+
'Search repositories never read this setting, so no row scope is applied.',
|
|
33
|
+
'Unlike the relational path, a missing scope here returns MORE rows rather than none - nothing fails, the result is just wider.',
|
|
34
|
+
'Scope the search query in the application, and remove settings.scopeFilter from the model.',
|
|
35
|
+
].join(' | '),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (withoutAmbientContext.length > 0) {
|
|
39
|
+
throw getError({
|
|
40
|
+
message: [
|
|
41
|
+
`[assertScopeFilterSupported] settings.scopeFilter declared while asyncContext.enable is false | models: ${withoutAmbientContext.join(', ')}`,
|
|
42
|
+
'scopeFilter.resolve() takes no arguments, so the ambient request context is its only input.',
|
|
43
|
+
'With no context store every resolve() returns undefined, onMissing denies by default, and EVERY query on these models matches zero rows - with nothing naming the flag as the cause.',
|
|
44
|
+
'Set asyncContext.enable to true, or remove settings.scopeFilter.',
|
|
45
|
+
].join(' | '),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=scope-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-filter.js","sourceRoot":"","sources":["../../../src/common/scope-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAsC,EAAQ,EAAE;IACzF,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC;IAE7D,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,qBAAqB,GAAa,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE9C,IAAI,UAAU,KAAK,gBAAgB,IAAI,UAAU,CAAC,SAAS,YAAY,gBAAgB,EAAE,CAAC;YACxF,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,SAAS;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE;gBACP,wFAAwF,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACjH,0EAA0E;gBAC1E,gIAAgI;gBAChI,4FAA4F;aAC7F,CAAC,IAAI,CAAC,KAAK,CAAC;SACd,CAAC,CAAC;IACL,CAAC;IAED,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE;gBACP,2GAA2G,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAC7I,6FAA6F;gBAC7F,sLAAsL;gBACtL,kEAAkE;aACnE,CAAC,IAAI,CAAC,KAAK,CAAC;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-connectors",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-13",
|
|
4
4
|
"description": "Datasource and repository connectors for the IGNIS framework: the engine-neutral relational and search tiers, plus Postgres, SQLite, PGlite, Typesense and Meilisearch behind sub-paths.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"@venizia/ignis-filter": "^0.2.0-5",
|
|
124
124
|
"@venizia/ignis-helpers": "^0.2.0-8",
|
|
125
125
|
"@venizia/ignis-inversion": "^0.2.0-3",
|
|
126
|
-
"@venizia/ignis-kernel": "^0.2.0-
|
|
126
|
+
"@venizia/ignis-kernel": "^0.2.0-13",
|
|
127
127
|
"lodash": "^4.18.1",
|
|
128
128
|
"reflect-metadata": "^0.2.2",
|
|
129
129
|
"zod": "^4.4.3"
|