@xemahq/object-projection-nest 0.1.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/LICENSE ADDED
@@ -0,0 +1,174 @@
1
+ Xema Business Source License 1.1
2
+
3
+ License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Neuralchowder Inc.
11
+
12
+ Licensed Work: Xema. The Licensed Work is (c) 2026 Neuralchowder Inc..
13
+
14
+ The Licensed Work includes, without limitation, Xema Core, Xema Runtime,
15
+ Xema Kernel, Xema control plane, Xema application runtime, Xema biome
16
+ runtime, Xema biome registry, Xema store services, Xema orchestration
17
+ services, Xema agents, Xema skills, Xema memory services, Xema APIs, Xema
18
+ user interfaces, Xema command-line tools, Xema deployment artifacts, Xema
19
+ templates, Xema specifications, Xema schemas, Xema manifests, Xema
20
+ documentation, Xema examples, and all source code, object code, binaries,
21
+ packages, modules, configuration files, manifests, schemas, examples,
22
+ templates, documentation, and derivative works included in or distributed
23
+ as part of the Xema software project.
24
+
25
+ The Licensed Work does not include any third-party software, libraries,
26
+ dependencies, packages, assets, or components that are distributed with the
27
+ Licensed Work but are governed by their own separate license terms. Such
28
+ third-party materials remain subject to their respective licenses.
29
+
30
+ A specific file, package, component, or directory may state that it is
31
+ governed by a different license. In that case, that specific file, package,
32
+ component, or directory is governed by the license expressly stated therein.
33
+
34
+ Additional Use Grant:
35
+
36
+ You may make production use of the Licensed Work, provided that your use
37
+ does not include offering, providing, making available, distributing,
38
+ hosting, managing, embedding, reselling, white-labeling, sublicensing,
39
+ commercializing, or otherwise making the Licensed Work, or any modified
40
+ version or derivative work of the Licensed Work, available to Third Parties
41
+ as part of a Competitive Offering.
42
+
43
+ The following definitions and clarifications form part of, and govern
44
+ the interpretation of, the Additional Use Grant set out above.
45
+
46
+ 1. "Production Use" means any use of the Licensed Work other than for
47
+ development, testing, evaluation, demonstration, experimentation,
48
+ benchmarking, or other non-production purposes.
49
+
50
+ 2. "Affiliate" means any entity that, directly or indirectly,
51
+ controls, is controlled by, or is under common control with you,
52
+ where "control" means ownership of more than fifty percent (50%) of
53
+ the voting interests of the entity, or the power to direct its
54
+ management.
55
+
56
+ 3. "Third Party" means any natural person or legal entity other than
57
+ you and your Affiliates.
58
+
59
+ 4. "Competitive Offering" means any product or service, made available
60
+ to one or more Third Parties for a fee or other consideration
61
+ (including without limitation on a paid, subscription,
62
+ advertising-supported, hosted, or managed-service basis), that is
63
+ offered or marketed as, or that competes with, a software platform,
64
+ runtime, orchestration system, agent or automation system,
65
+ extension or distribution marketplace, or other software system
66
+ that provides, in substantial part, the same or substantially
67
+ similar capabilities as those provided by the Licensed Work. A
68
+ product or service is a Competitive Offering whether the Licensed
69
+ Work is provided in whole or in part, alone or bundled with other
70
+ software, and whether modified or unmodified.
71
+
72
+ 5. Providing, hosting, or managing the Licensed Work for a Third Party,
73
+ or otherwise making the Licensed Work available to a Third Party as
74
+ a hosted or managed service such that the Third Party obtains the
75
+ principal value or functionality of the Licensed Work, is a
76
+ Competitive Offering and is not permitted by the Additional Use
77
+ Grant.
78
+
79
+ 6. Subject to the foregoing, the Additional Use Grant permits you to
80
+ make Production Use of the Licensed Work for your own internal
81
+ business purposes and to build, operate, and provide your own
82
+ products and services to Third Parties, provided that the Licensed
83
+ Work itself (whether modified or unmodified) is not the product or
84
+ service, and is not a Competitive Offering, made available to those
85
+ Third Parties.
86
+
87
+ 7. You may modify the Licensed Work and create derivative works for
88
+ any purpose permitted by this License. Any Production Use of such
89
+ modified or derivative works remains subject to the same
90
+ restrictions as the Licensed Work, including the prohibition on
91
+ Competitive Offerings.
92
+
93
+ 8. Use of the Licensed Work by your own employees, contractors, and
94
+ agents, acting on your behalf and for your benefit, is not by
95
+ itself making the Licensed Work available to a Third Party.
96
+
97
+ 9. Embedding or distributing the Licensed Work as a component of your
98
+ own product or service is permitted only where the Licensed Work
99
+ does not constitute the principal value of that product or service
100
+ and the product or service is not a Competitive Offering.
101
+
102
+ 10. Nothing in this Additional Use Grant grants any right to use any
103
+ name, trademark, service mark, or logo of the Licensor or its
104
+ Affiliates, except as reasonably required for customary
105
+ attribution.
106
+
107
+ 11. The rights stated in this Additional Use Grant are the maximum
108
+ rights granted for Production Use prior to the Change Date. Any
109
+ Production Use not expressly permitted requires a separate
110
+ commercial license from the Licensor.
111
+
112
+ 12. If any provision of this Additional Use Grant is held invalid or
113
+ unenforceable, that provision shall be limited or eliminated to
114
+ the minimum extent necessary so that the remainder of this
115
+ Additional Use Grant, and of this License, remains in full force
116
+ and effect. The Licensor reserves all rights not expressly granted
117
+ by this License.
118
+
119
+ Change Date: Four years from the date the specific version of the Licensed
120
+ Work is first publicly released by Licensor.
121
+
122
+ Change License: Mozilla Public License, Version 2.0
123
+
124
+ For information about alternative licensing arrangements, commercial
125
+ licensing, enterprise licensing, OEM licensing, appliance licensing, managed
126
+ service licensing, cloud provider licensing, or other commercial use of the
127
+ Licensed Work, please contact: licensing@neuralchowder.com
128
+
129
+ -----------------------------------------------------------------------------
130
+
131
+ Notice
132
+
133
+ Business Source License 1.1
134
+
135
+ Terms
136
+
137
+ The Licensor hereby grants you the right to copy, modify, create derivative
138
+ works, redistribute, and make non-production use of the Licensed Work. The
139
+ Licensor may make an Additional Use Grant, above, permitting limited
140
+ production use.
141
+
142
+ Effective on the Change Date, or the fourth anniversary of the first publicly
143
+ available distribution of a specific version of the Licensed Work under this
144
+ License, whichever comes first, the Licensor hereby grants you rights under
145
+ the terms of the Change License, and the rights granted in the paragraph above
146
+ terminate.
147
+
148
+ If your use of the Licensed Work does not comply with the requirements
149
+ currently in effect as described in this License, you must purchase a
150
+ commercial license from the Licensor, its affiliated entities, or authorized
151
+ resellers, or you must refrain from using the Licensed Work.
152
+
153
+ All copies of the original and modified Licensed Work, and derivative works of
154
+ the Licensed Work, are subject to this License. This License applies separately
155
+ for each version of the Licensed Work and the Change Date may vary for each
156
+ version of the Licensed Work released by Licensor.
157
+
158
+ You must conspicuously display this License on each original or modified copy
159
+ of the Licensed Work. If you receive the Licensed Work in original or modified
160
+ form from a third party, the terms and conditions set forth in this License
161
+ apply to your use of that work.
162
+
163
+ Any use of the Licensed Work in violation of this License will automatically
164
+ terminate your rights under this License for the current and all other
165
+ versions of the Licensed Work.
166
+
167
+ This License does not grant you any right in any trademark or logo of Licensor
168
+ or its affiliates, provided that you may use a trademark or logo of Licensor
169
+ as expressly required by this License.
170
+
171
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
172
+ "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS
173
+ OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS
174
+ FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @xemahq/object-projection-nest
2
+
3
+ This package belongs to Layer 1 — it is a kernel-side NestJS SDK with zero
4
+ domain knowledge and no dependency on any Xema service.
5
+
6
+ It ships the shared implementation of the **XSI plane-1 object projection**
7
+ surface that every XemaObject-owning service exposes so
8
+ `object-registry-api` can build the platform-wide object index:
9
+
10
+ | piece | export |
11
+ | --- | --- |
12
+ | `GET /describe-objects` wire DTOs | `DescribeObjectsResponseDto`, `XemaObjectResponseDto`, `XemaSpaceRefDto`, `XemaSubjectRefDto` |
13
+ | CloudEvent descriptor factory | `defineObjectProjectionEvents(serviceName)` |
14
+ | boot + periodic + debounced publisher | `ObjectProjectionPublisherService` |
15
+
16
+ ## Producer shape
17
+
18
+ A producing service adds one `describe-objects/` folder:
19
+
20
+ ```ts
21
+ // projection-events.registry.ts
22
+ export const { descriptor: ObjectRegistryProjectionPublishedEvent, descriptors } =
23
+ defineObjectProjectionEvents('knowledge-base-api');
24
+
25
+ // describe-objects.service.ts — builds the COMPLETE current slice
26
+ @Injectable()
27
+ export class DescribeObjectsService {
28
+ async buildEnvelope(): Promise<DescribeObjectsResponseDto> { /* … */ }
29
+ }
30
+
31
+ // projection-publisher.service.ts — PUSH path (optional; PULL alone is valid)
32
+ @Injectable()
33
+ export class ProjectionPublisherService extends ObjectProjectionPublisherService {
34
+ constructor(
35
+ publisher: DescriptorEventPublisherService,
36
+ describeObjects: DescribeObjectsService,
37
+ ) {
38
+ super(publisher, {
39
+ source: KNOWLEDGE_BASE_PROJECTION_SOURCE,
40
+ descriptor: ObjectRegistryProjectionPublishedEvent,
41
+ buildEnvelope: () => describeObjects.buildEnvelope(),
42
+ });
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Layout note
48
+
49
+ Sources live under `src/projection/` (not `src/lib/`) and the package declares a
50
+ `./*` subpath export. This is load-bearing, not cosmetic: the `@nestjs/swagger`
51
+ CLI plugin emits a `require()` of a DTO's *physical declaration path*, which
52
+ `tooling/codegen/scrub-swagger-plugin-paths.mjs` rewrites to
53
+ `@xemahq/<pkg>/<first-dir-under-dist>`. If that directory is not a resolvable
54
+ subpath export, every consuming pod crashes at boot with
55
+ `ERR_PACKAGE_PATH_NOT_EXPORTED`. Same convention as
56
+ `@xemahq/kernel-contracts`. Consumers import from the package root.
57
+
58
+ ## Invariants
59
+
60
+ - A projection is always the **COMPLETE** slice. The registry REPLACES its
61
+ cache slice keyed by `source` atomically; there is no delta primitive.
62
+ - `payload` is opaque on the wire. The per-kind payload schema is owned by the
63
+ producing service's domain contract; plane 1 carries it through and plane 3
64
+ (Capability) is the validation point.
65
+ - A row that cannot be projected (missing scope qualifier, missing version)
66
+ MUST throw a typed error carrying the row id. Never skip it silently.
67
+ - The publisher logs and does not rethrow on transport failure — a
68
+ cache-refresh push must not crash its host. The periodic tick retries and the
69
+ consumer can always recover the same slice over the pull path.
@@ -0,0 +1,2 @@
1
+ export * from './projection';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -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("./projection"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcA,+CAA6B"}
@@ -0,0 +1,29 @@
1
+ import { ObjectLifecycle, XemaObjectKind } from '@xemahq/kernel-contracts/object';
2
+ import { SpaceKind } from '@xemahq/kernel-contracts/space';
3
+ export declare class XemaSubjectRefDto {
4
+ kind: string;
5
+ ref: string;
6
+ }
7
+ export declare class XemaSpaceRefDto {
8
+ tier: SpaceKind;
9
+ orgId?: string;
10
+ projectId?: string;
11
+ appId?: string;
12
+ sessionId?: string;
13
+ biomeId?: string;
14
+ userId?: string;
15
+ }
16
+ export declare class XemaObjectResponseDto {
17
+ ref: string;
18
+ kind: XemaObjectKind;
19
+ scope: XemaSpaceRefDto;
20
+ owner: XemaSubjectRefDto;
21
+ version: string;
22
+ lifecycle: ObjectLifecycle;
23
+ payload: Record<string, unknown>;
24
+ }
25
+ export declare class DescribeObjectsResponseDto {
26
+ source: string;
27
+ objects: XemaObjectResponseDto[];
28
+ }
29
+ //# sourceMappingURL=describe-objects.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-objects.dto.d.ts","sourceRoot":"","sources":["../../src/projection/describe-objects.dto.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAmB3D,qBAAa,iBAAiB;IAM5B,IAAI,EAAG,MAAM,CAAC;IAMd,GAAG,EAAG,MAAM,CAAC;CACd;AAQD,qBAAa,eAAe;IAO1B,IAAI,EAAG,SAAS,CAAC;IAGjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,qBAAa,qBAAqB;IAKhC,GAAG,EAAG,MAAM,CAAC;IAOb,IAAI,EAAG,cAAc,CAAC;IAGtB,KAAK,EAAG,eAAe,CAAC;IAGxB,KAAK,EAAG,iBAAiB,CAAC;IAO1B,OAAO,EAAG,MAAM,CAAC;IAOjB,SAAS,EAAG,eAAe,CAAC;IAQ5B,OAAO,EAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAUD,qBAAa,0BAA0B;IAMrC,MAAM,EAAG,MAAM,CAAC;IAMhB,OAAO,EAAG,qBAAqB,EAAE,CAAC;CACnC"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DescribeObjectsResponseDto = exports.XemaObjectResponseDto = exports.XemaSpaceRefDto = exports.XemaSubjectRefDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const object_1 = require("@xemahq/kernel-contracts/object");
15
+ const space_1 = require("@xemahq/kernel-contracts/space");
16
+ class XemaSubjectRefDto {
17
+ kind;
18
+ ref;
19
+ }
20
+ exports.XemaSubjectRefDto = XemaSubjectRefDto;
21
+ __decorate([
22
+ (0, swagger_1.ApiProperty)({
23
+ description: 'Subject kind. Projections stamp `service` — the owning platform service, not the authoring human.',
24
+ example: 'service',
25
+ }),
26
+ __metadata("design:type", String)
27
+ ], XemaSubjectRefDto.prototype, "kind", void 0);
28
+ __decorate([
29
+ (0, swagger_1.ApiProperty)({
30
+ description: 'Subject reference; for a `service` subject, the service name.',
31
+ example: 'skill-registry-api',
32
+ }),
33
+ __metadata("design:type", String)
34
+ ], XemaSubjectRefDto.prototype, "ref", void 0);
35
+ class XemaSpaceRefDto {
36
+ tier;
37
+ orgId;
38
+ projectId;
39
+ appId;
40
+ sessionId;
41
+ biomeId;
42
+ userId;
43
+ }
44
+ exports.XemaSpaceRefDto = XemaSpaceRefDto;
45
+ __decorate([
46
+ (0, swagger_1.ApiProperty)({
47
+ enum: space_1.SpaceKind,
48
+ enumName: 'SpaceKind',
49
+ description: 'Ownership tier (system | org | project | app | session | biome | user).',
50
+ }),
51
+ __metadata("design:type", String)
52
+ ], XemaSpaceRefDto.prototype, "tier", void 0);
53
+ __decorate([
54
+ (0, swagger_1.ApiProperty)({ required: false }),
55
+ __metadata("design:type", String)
56
+ ], XemaSpaceRefDto.prototype, "orgId", void 0);
57
+ __decorate([
58
+ (0, swagger_1.ApiProperty)({ required: false }),
59
+ __metadata("design:type", String)
60
+ ], XemaSpaceRefDto.prototype, "projectId", void 0);
61
+ __decorate([
62
+ (0, swagger_1.ApiProperty)({ required: false }),
63
+ __metadata("design:type", String)
64
+ ], XemaSpaceRefDto.prototype, "appId", void 0);
65
+ __decorate([
66
+ (0, swagger_1.ApiProperty)({ required: false }),
67
+ __metadata("design:type", String)
68
+ ], XemaSpaceRefDto.prototype, "sessionId", void 0);
69
+ __decorate([
70
+ (0, swagger_1.ApiProperty)({ required: false }),
71
+ __metadata("design:type", String)
72
+ ], XemaSpaceRefDto.prototype, "biomeId", void 0);
73
+ __decorate([
74
+ (0, swagger_1.ApiProperty)({ required: false }),
75
+ __metadata("design:type", String)
76
+ ], XemaSpaceRefDto.prototype, "userId", void 0);
77
+ class XemaObjectResponseDto {
78
+ ref;
79
+ kind;
80
+ scope;
81
+ owner;
82
+ version;
83
+ lifecycle;
84
+ payload;
85
+ }
86
+ exports.XemaObjectResponseDto = XemaObjectResponseDto;
87
+ __decorate([
88
+ (0, swagger_1.ApiProperty)({
89
+ description: 'Canonical XemaObjectRef.',
90
+ example: 'xema://system/skill/software-engineering/requirements@1.0.0',
91
+ }),
92
+ __metadata("design:type", String)
93
+ ], XemaObjectResponseDto.prototype, "ref", void 0);
94
+ __decorate([
95
+ (0, swagger_1.ApiProperty)({
96
+ enum: object_1.XemaObjectKind,
97
+ enumName: 'XemaObjectKind',
98
+ description: 'Closed kind enum this object belongs to.',
99
+ }),
100
+ __metadata("design:type", String)
101
+ ], XemaObjectResponseDto.prototype, "kind", void 0);
102
+ __decorate([
103
+ (0, swagger_1.ApiProperty)({ type: XemaSpaceRefDto }),
104
+ __metadata("design:type", XemaSpaceRefDto)
105
+ ], XemaObjectResponseDto.prototype, "scope", void 0);
106
+ __decorate([
107
+ (0, swagger_1.ApiProperty)({ type: XemaSubjectRefDto }),
108
+ __metadata("design:type", XemaSubjectRefDto)
109
+ ], XemaObjectResponseDto.prototype, "owner", void 0);
110
+ __decorate([
111
+ (0, swagger_1.ApiProperty)({
112
+ description: 'Object version. Semver where the kind is semver-versioned, otherwise the kind-native revision token (commit SHA, monotonic revision, `1` for unversioned kinds).',
113
+ example: '1.0.0',
114
+ }),
115
+ __metadata("design:type", String)
116
+ ], XemaObjectResponseDto.prototype, "version", void 0);
117
+ __decorate([
118
+ (0, swagger_1.ApiProperty)({
119
+ enum: object_1.ObjectLifecycle,
120
+ enumName: 'ObjectLifecycle',
121
+ description: 'draft | published | archived.',
122
+ }),
123
+ __metadata("design:type", String)
124
+ ], XemaObjectResponseDto.prototype, "lifecycle", void 0);
125
+ __decorate([
126
+ (0, swagger_1.ApiProperty)({
127
+ type: 'object',
128
+ additionalProperties: true,
129
+ description: 'Kind-specific payload. The schema is owned by the producing service; plane 1 carries it opaquely.',
130
+ }),
131
+ __metadata("design:type", Object)
132
+ ], XemaObjectResponseDto.prototype, "payload", void 0);
133
+ class DescribeObjectsResponseDto {
134
+ source;
135
+ objects;
136
+ }
137
+ exports.DescribeObjectsResponseDto = DescribeObjectsResponseDto;
138
+ __decorate([
139
+ (0, swagger_1.ApiProperty)({
140
+ description: 'Owning-service identifier. The registry replaces the cache slice keyed by this value atomically.',
141
+ example: 'skill-registry-api',
142
+ }),
143
+ __metadata("design:type", String)
144
+ ], DescribeObjectsResponseDto.prototype, "source", void 0);
145
+ __decorate([
146
+ (0, swagger_1.ApiProperty)({
147
+ type: [XemaObjectResponseDto],
148
+ description: 'Full set of XemaObjects this service currently owns.',
149
+ }),
150
+ __metadata("design:type", Array)
151
+ ], DescribeObjectsResponseDto.prototype, "objects", void 0);
152
+ //# sourceMappingURL=describe-objects.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-objects.dto.js","sour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+ export * from './object-projection-publisher.service';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projection/index.ts"],"names":[],"mappings":"AAiBA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,20 @@
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("./describe-objects.dto"), exports);
18
+ __exportStar(require("./projection-events"), exports);
19
+ __exportStar(require("./object-projection-publisher.service"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/projection/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiBA,yDAAuC;AACvC,sDAAoC;AACpC,wEAAsD"}
@@ -0,0 +1,33 @@
1
+ import { Logger, type OnApplicationBootstrap, type OnApplicationShutdown } from '@nestjs/common';
2
+ import { DescriptorEventPublisherService } from '@xemahq/events/nest';
3
+ import type { DescribeObjectsResponseDto } from './describe-objects.dto';
4
+ import type { ObjectProjectionPublishedDescriptor } from './projection-events';
5
+ export declare const PROJECTION_DEBOUNCE_MS = 1000;
6
+ export declare const PROJECTION_REFRESH_INTERVAL_MS = 60000;
7
+ export declare const PLATFORM_ORG_ID = "system";
8
+ export declare enum ObjectProjectionPublishReason {
9
+ Boot = "boot",
10
+ Periodic = "periodic",
11
+ Manual = "manual",
12
+ Change = "change"
13
+ }
14
+ export interface ObjectProjectionPublisherOptions {
15
+ readonly source: string;
16
+ readonly descriptor: ObjectProjectionPublishedDescriptor;
17
+ buildEnvelope(): Promise<DescribeObjectsResponseDto>;
18
+ }
19
+ export declare abstract class ObjectProjectionPublisherService implements OnApplicationBootstrap, OnApplicationShutdown {
20
+ private readonly publisher;
21
+ private readonly options;
22
+ protected readonly logger: Logger;
23
+ private timer;
24
+ private debounceTimer;
25
+ private publishing;
26
+ protected constructor(publisher: DescriptorEventPublisherService, options: ObjectProjectionPublisherOptions);
27
+ onApplicationBootstrap(): Promise<void>;
28
+ onApplicationShutdown(): void;
29
+ protected scheduleRepublish(): void;
30
+ publishProjection(reason: ObjectProjectionPublishReason): Promise<void>;
31
+ private platformContext;
32
+ }
33
+ //# sourceMappingURL=object-projection-publisher.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-projection-publisher.service.d.ts","sourceRoot":"","sources":["../../src/projection/object-projection-publisher.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,+BAA+B,EAEhC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qBAAqB,CAAC;AAO/E,eAAO,MAAM,sBAAsB,OAAQ,CAAC;AAO5C,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAOrD,eAAO,MAAM,eAAe,WAAW,CAAC;AAMxC,oBAAY,6BAA6B;IACvC,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAKD,MAAM,WAAW,gCAAgC;IAO/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAMxB,QAAQ,CAAC,UAAU,EAAE,mCAAmC,CAAC;IAOzD,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACtD;AA8BD,8BAAsB,gCACpB,YAAW,sBAAsB,EAAE,qBAAqB;IAStD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAR1B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAElC,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,UAAU,CAAS;IAE3B,SAAS,aACU,SAAS,EAAE,+BAA+B,EAC1C,OAAO,EAAE,gCAAgC;IAOtD,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe7C,qBAAqB,IAAI,IAAI;IAmB7B,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAsB7B,iBAAiB,CACrB,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,IAAI,CAAC;IA2DhB,OAAO,CAAC,eAAe;CAQxB"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectProjectionPublisherService = exports.ObjectProjectionPublishReason = exports.PLATFORM_ORG_ID = exports.PROJECTION_REFRESH_INTERVAL_MS = exports.PROJECTION_DEBOUNCE_MS = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const common_1 = require("@nestjs/common");
6
+ const events_1 = require("@xemahq/events");
7
+ exports.PROJECTION_DEBOUNCE_MS = 1_000;
8
+ exports.PROJECTION_REFRESH_INTERVAL_MS = 60_000;
9
+ exports.PLATFORM_ORG_ID = 'system';
10
+ var ObjectProjectionPublishReason;
11
+ (function (ObjectProjectionPublishReason) {
12
+ ObjectProjectionPublishReason["Boot"] = "boot";
13
+ ObjectProjectionPublishReason["Periodic"] = "periodic";
14
+ ObjectProjectionPublishReason["Manual"] = "manual";
15
+ ObjectProjectionPublishReason["Change"] = "change";
16
+ })(ObjectProjectionPublishReason || (exports.ObjectProjectionPublishReason = ObjectProjectionPublishReason = {}));
17
+ class ObjectProjectionPublisherService {
18
+ publisher;
19
+ options;
20
+ logger;
21
+ timer;
22
+ debounceTimer;
23
+ publishing = false;
24
+ constructor(publisher, options) {
25
+ this.publisher = publisher;
26
+ this.options = options;
27
+ this.logger = new common_1.Logger(`ObjectProjectionPublisher(${options.source})`);
28
+ }
29
+ async onApplicationBootstrap() {
30
+ await this.publishProjection(ObjectProjectionPublishReason.Boot);
31
+ this.timer = setInterval(() => {
32
+ void this.publishProjection(ObjectProjectionPublishReason.Periodic);
33
+ }, exports.PROJECTION_REFRESH_INTERVAL_MS);
34
+ this.timer.unref();
35
+ }
36
+ onApplicationShutdown() {
37
+ if (this.timer) {
38
+ clearInterval(this.timer);
39
+ this.timer = undefined;
40
+ }
41
+ if (this.debounceTimer) {
42
+ clearTimeout(this.debounceTimer);
43
+ this.debounceTimer = undefined;
44
+ }
45
+ }
46
+ scheduleRepublish() {
47
+ if (this.debounceTimer) {
48
+ clearTimeout(this.debounceTimer);
49
+ }
50
+ this.debounceTimer = setTimeout(() => {
51
+ this.debounceTimer = undefined;
52
+ void this.publishProjection(ObjectProjectionPublishReason.Change);
53
+ }, exports.PROJECTION_DEBOUNCE_MS);
54
+ this.debounceTimer.unref();
55
+ }
56
+ async publishProjection(reason) {
57
+ if (this.publishing) {
58
+ this.logger.warn(`Skipping ${reason} projection publish — previous publish still in flight`);
59
+ return;
60
+ }
61
+ this.publishing = true;
62
+ try {
63
+ const envelope = await this.options.buildEnvelope();
64
+ if (envelope.source !== this.options.source) {
65
+ throw new Error(`Projection envelope source "${envelope.source}" does not match ` +
66
+ `the configured publisher source "${this.options.source}".`);
67
+ }
68
+ await this.publisher.publish(this.options.descriptor, envelope, this.platformContext(), {});
69
+ this.logger.log(`Published ${this.options.descriptor.type} ` +
70
+ `reason=${reason} source=${envelope.source} ` +
71
+ `objectCount=${envelope.objects.length}`);
72
+ }
73
+ catch (err) {
74
+ this.logger.error({
75
+ message: 'Failed to publish object-registry projection',
76
+ descriptor: this.options.descriptor.type,
77
+ reason,
78
+ error: err instanceof Error ? err.message : String(err),
79
+ });
80
+ }
81
+ finally {
82
+ this.publishing = false;
83
+ }
84
+ }
85
+ platformContext() {
86
+ return {
87
+ orgId: exports.PLATFORM_ORG_ID,
88
+ actorType: events_1.ActorType.SERVICE,
89
+ actorId: this.options.source,
90
+ correlationId: (0, node_crypto_1.randomUUID)(),
91
+ };
92
+ }
93
+ }
94
+ exports.ObjectProjectionPublisherService = ObjectProjectionPublisherService;
95
+ //# sourceMappingURL=object-projection-publisher.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-projection-publisher.service.js","sourceRoot":"","sources":["../../src/projection/object-projection-publisher.service.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,2CAIwB;AACxB,2CAA2C;AAc9B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAO/B,QAAA,8BAA8B,GAAG,MAAM,CAAC;AAOxC,QAAA,eAAe,GAAG,QAAQ,CAAC;AAMxC,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,8CAAa,CAAA;IACb,sDAAqB,CAAA;IACrB,kDAAiB,CAAA;IACjB,kDAAiB,CAAA;AACnB,CAAC,EALW,6BAA6B,6CAA7B,6BAA6B,QAKxC;AAwDD,MAAsB,gCAAgC;IAUjC;IACA;IARA,MAAM,CAAS;IAE1B,KAAK,CAA6B;IAClC,aAAa,CAA6B;IAC1C,UAAU,GAAG,KAAK,CAAC;IAE3B,YACmB,SAA0C,EAC1C,OAAyC;QADzC,cAAS,GAAT,SAAS,CAAiC;QAC1C,YAAO,GAAP,OAAO,CAAkC;QAE1D,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CACtB,6BAA6B,OA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,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC5B,aAAa,EAAE,IAAA,wBAAU,GAAE;SAC5B,CAAC;IACJ,CAAC;CACF;AA/ID,4EA+IC"}
@@ -0,0 +1,32 @@
1
+ import { type EventDescriptor } from '@xemahq/events';
2
+ import { z } from 'zod';
3
+ export declare const OBJECT_REGISTRY_PROJECTION_PUBLISHED_TYPE = "xema.object-registry.projection.published.v1";
4
+ export declare const XEMA_OBJECT_WIRE_SCHEMA: z.ZodObject<{
5
+ ref: z.ZodString;
6
+ kind: z.ZodString;
7
+ version: z.ZodString;
8
+ lifecycle: z.ZodString;
9
+ scope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
10
+ owner: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
12
+ }, z.core.$loose>;
13
+ export declare const OBJECT_PROJECTION_DATA_SCHEMA: z.ZodObject<{
14
+ source: z.ZodString;
15
+ objects: z.ZodArray<z.ZodObject<{
16
+ ref: z.ZodString;
17
+ kind: z.ZodString;
18
+ version: z.ZodString;
19
+ lifecycle: z.ZodString;
20
+ scope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
21
+ owner: z.ZodRecord<z.ZodString, z.ZodUnknown>;
22
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
23
+ }, z.core.$loose>>;
24
+ }, z.core.$strip>;
25
+ export declare const OBJECT_PROJECTION_HINT_SCHEMA: z.ZodObject<{}, z.core.$strip>;
26
+ export type ObjectProjectionPublishedDescriptor = EventDescriptor<typeof OBJECT_REGISTRY_PROJECTION_PUBLISHED_TYPE, typeof OBJECT_PROJECTION_DATA_SCHEMA, typeof OBJECT_PROJECTION_HINT_SCHEMA>;
27
+ export interface ObjectProjectionEvents {
28
+ readonly descriptor: ObjectProjectionPublishedDescriptor;
29
+ readonly descriptors: readonly [ObjectProjectionPublishedDescriptor];
30
+ }
31
+ export declare function defineObjectProjectionEvents(serviceName: string): ObjectProjectionEvents;
32
+ //# sourceMappingURL=projection-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection-events.d.ts","sourceRoot":"","sources":["../../src/projection/projection-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,yCAAyC,iDACN,CAAC;AAUjD,eAAO,MAAM,uBAAuB;;;;;;;;iBAUpB,CAAC;AAGjB,eAAO,MAAM,6BAA6B;;;;;;;;;;;iBAGxC,CAAC;AAGH,eAAO,MAAM,6BAA6B,gCAAe,CAAC;AAO1D,MAAM,MAAM,mCAAmC,GAAG,eAAe,CAC/D,OAAO,yCAAyC,EAChD,OAAO,6BAA6B,EACpC,OAAO,6BAA6B,CACrC,CAAC;AAUF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,mCAAmC,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,mCAAmC,CAAC,CAAC;CACtE;AAcD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,GAClB,sBAAsB,CAkBxB"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OBJECT_PROJECTION_HINT_SCHEMA = exports.OBJECT_PROJECTION_DATA_SCHEMA = exports.XEMA_OBJECT_WIRE_SCHEMA = exports.OBJECT_REGISTRY_PROJECTION_PUBLISHED_TYPE = void 0;
4
+ exports.defineObjectProjectionEvents = defineObjectProjectionEvents;
5
+ const events_1 = require("@xemahq/events");
6
+ const zod_1 = require("zod");
7
+ exports.OBJECT_REGISTRY_PROJECTION_PUBLISHED_TYPE = 'xema.object-registry.projection.published.v1';
8
+ exports.XEMA_OBJECT_WIRE_SCHEMA = zod_1.z
9
+ .object({
10
+ ref: zod_1.z.string().min(1),
11
+ kind: zod_1.z.string().min(1),
12
+ version: zod_1.z.string().min(1),
13
+ lifecycle: zod_1.z.string().min(1),
14
+ scope: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
15
+ owner: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
16
+ payload: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
17
+ })
18
+ .passthrough();
19
+ exports.OBJECT_PROJECTION_DATA_SCHEMA = zod_1.z.object({
20
+ source: zod_1.z.string().min(1),
21
+ objects: zod_1.z.array(exports.XEMA_OBJECT_WIRE_SCHEMA),
22
+ });
23
+ exports.OBJECT_PROJECTION_HINT_SCHEMA = zod_1.z.object({});
24
+ function defineObjectProjectionEvents(serviceName) {
25
+ const descriptor = (0, events_1.defineEvent)({
26
+ type: exports.OBJECT_REGISTRY_PROJECTION_PUBLISHED_TYPE,
27
+ source: (0, events_1.serviceSource)(serviceName),
28
+ schemaVersion: '1.0.0',
29
+ visibility: events_1.VisibilityTier.INTERNAL,
30
+ description: "XSI plane-1 projection of one owning service's slice of the XemaObject universe. Replaces the registry cache slice keyed by `source` atomically.",
31
+ data: exports.OBJECT_PROJECTION_DATA_SCHEMA,
32
+ hint: exports.OBJECT_PROJECTION_HINT_SCHEMA,
33
+ });
34
+ return Object.freeze({
35
+ descriptor,
36
+ descriptors: Object.freeze([descriptor]),
37
+ });
38
+ }
39
+ //# sourceMappingURL=projection-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection-events.js","sourceRoot":"","sources":["../../src/projection/projection-events.ts"],"names":[],"mappings":";;;AAwFA,oEAoBC;AA5GD,2CAKwB;AACxB,6BAAwB;AAcX,QAAA,yCAAyC,GACpD,8CAA8C,CAAC;AAUpC,QAAA,uBAAuB,GAAG,OAAC;KACrC,MAAM,CAAC;IACN,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC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ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@xemahq/object-projection-nest",
3
+ "version": "0.1.0",
4
+ "description": "Shared NestJS building blocks for the XSI plane-1 object projection surface (`GET /describe-objects` + the `xema.object-registry.projection.published.v1` CloudEvent) that every XemaObject-owning service implements.",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/",
7
+ "access": "public"
8
+ },
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "peerDependencies": {
15
+ "@nestjs/common": ">=11.0.0",
16
+ "@nestjs/swagger": ">=11.0.0",
17
+ "@xemahq/events": "^0.3.0",
18
+ "@xemahq/kernel-contracts": "^0.56.0",
19
+ "zod": "^4.3.6"
20
+ },
21
+ "devDependencies": {
22
+ "@nestjs/common": "11.1.13",
23
+ "@nestjs/swagger": "11.2.6",
24
+ "@types/node": "25.2.3",
25
+ "@xemahq/events": "^0.3.0",
26
+ "@xemahq/kernel-contracts": "^0.56.0",
27
+ "typescript": "5.9.3",
28
+ "zod": "^4.3.6"
29
+ },
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "xema-source": "./src/index.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "./*": {
37
+ "types": "./dist/*/index.d.ts",
38
+ "xema-source": "./src/*/index.ts",
39
+ "default": "./dist/*/index.js"
40
+ },
41
+ "./package.json": "./package.json"
42
+ },
43
+ "license": "LicenseRef-Xema-BSL-1.1",
44
+ "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
45
+ "homepage": "https://xema.dev",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/xema-dev/xema-base.git",
49
+ "directory": "packages/sdks/object-projection-nest"
50
+ },
51
+ "scripts": {
52
+ "clean": "rm -rf dist",
53
+ "build": "tsc -p tsconfig.json",
54
+ "typecheck": "tsc -p tsconfig.json --noEmit"
55
+ }
56
+ }