@xemahq/kernel-contracts 0.16.2 → 0.17.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/agent-workspace/awp-spec.json +1 -1
- package/dist/lifecycle-events/index.d.ts +2 -0
- package/dist/lifecycle-events/index.d.ts.map +1 -0
- package/dist/lifecycle-events/index.js +18 -0
- package/dist/lifecycle-events/index.js.map +1 -0
- package/dist/lifecycle-events/lib/lifecycle-events.d.ts +25 -0
- package/dist/lifecycle-events/lib/lifecycle-events.d.ts.map +1 -0
- package/dist/lifecycle-events/lib/lifecycle-events.js +32 -0
- package/dist/lifecycle-events/lib/lifecycle-events.js.map +1 -0
- package/package.json +1 -1
- package/src/lifecycle-events/index.ts +1 -0
- package/src/lifecycle-events/lib/lifecycle-events.ts +103 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lifecycle-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,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("./lib/lifecycle-events"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lifecycle-events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare enum LifecycleEventType {
|
|
3
|
+
OrganizationDeleted = "organization.organization.deleted",
|
|
4
|
+
ProjectDeleted = "project.project.deleted",
|
|
5
|
+
UserDeleted = "user.user.deleted"
|
|
6
|
+
}
|
|
7
|
+
export declare const IDENTITY_LIFECYCLE_EVENT_SOURCE: "/services/identity-api";
|
|
8
|
+
export declare const PROJECT_LIFECYCLE_EVENT_SOURCE: "/services/project-registry-api";
|
|
9
|
+
export declare const LIFECYCLE_EVENT_SCHEMA_VERSION: "1.0.0";
|
|
10
|
+
export declare const OrganizationDeletedEventSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export declare const ProjectDeletedEventSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
orgId: z.ZodString;
|
|
16
|
+
projectId: z.ZodString;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
export declare const UserDeletedEventSchema: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
orgId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export type OrganizationDeletedEventPayload = z.infer<typeof OrganizationDeletedEventSchema>;
|
|
23
|
+
export type ProjectDeletedEventPayload = z.infer<typeof ProjectDeletedEventSchema>;
|
|
24
|
+
export type UserDeletedEventPayload = z.infer<typeof UserDeletedEventSchema>;
|
|
25
|
+
//# sourceMappingURL=lifecycle-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../../src/lifecycle-events/lib/lifecycle-events.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,oBAAY,kBAAkB;IAE5B,mBAAmB,sCAAsC;IAEzD,cAAc,4BAA4B;IAS1C,WAAW,sBAAsB;CAClC;AAGD,eAAO,MAAM,+BAA+B,EAAG,wBAAiC,CAAC;AAGjF,eAAO,MAAM,8BAA8B,EACzC,gCAAyC,CAAC;AAG5C,eAAO,MAAM,8BAA8B,EAAG,OAAgB,CAAC;AAO/D,eAAO,MAAM,8BAA8B;;kBAIhC,CAAC;AAOZ,eAAO,MAAM,yBAAyB;;;;kBAM3B,CAAC;AAOZ,eAAO,MAAM,sBAAsB;;;kBAKxB,CAAC;AAEZ,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,yBAAyB,CACjC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserDeletedEventSchema = exports.ProjectDeletedEventSchema = exports.OrganizationDeletedEventSchema = exports.LIFECYCLE_EVENT_SCHEMA_VERSION = exports.PROJECT_LIFECYCLE_EVENT_SOURCE = exports.IDENTITY_LIFECYCLE_EVENT_SOURCE = exports.LifecycleEventType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var LifecycleEventType;
|
|
6
|
+
(function (LifecycleEventType) {
|
|
7
|
+
LifecycleEventType["OrganizationDeleted"] = "organization.organization.deleted";
|
|
8
|
+
LifecycleEventType["ProjectDeleted"] = "project.project.deleted";
|
|
9
|
+
LifecycleEventType["UserDeleted"] = "user.user.deleted";
|
|
10
|
+
})(LifecycleEventType || (exports.LifecycleEventType = LifecycleEventType = {}));
|
|
11
|
+
exports.IDENTITY_LIFECYCLE_EVENT_SOURCE = '/services/identity-api';
|
|
12
|
+
exports.PROJECT_LIFECYCLE_EVENT_SOURCE = '/services/project-registry-api';
|
|
13
|
+
exports.LIFECYCLE_EVENT_SCHEMA_VERSION = '1.0.0';
|
|
14
|
+
exports.OrganizationDeletedEventSchema = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
id: zod_1.z.string(),
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
exports.ProjectDeletedEventSchema = zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
id: zod_1.z.string(),
|
|
22
|
+
orgId: zod_1.z.string(),
|
|
23
|
+
projectId: zod_1.z.string(),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
exports.UserDeletedEventSchema = zod_1.z
|
|
27
|
+
.object({
|
|
28
|
+
id: zod_1.z.string(),
|
|
29
|
+
orgId: zod_1.z.string().optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
//# sourceMappingURL=lifecycle-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-events.js","sourceRoot":"","sources":["../../../src/lifecycle-events/lib/lifecycle-events.ts"],"names":[],"mappings":";;;AA2BA,6BAAwB;AAOxB,IAAY,kBAcX;AAdD,WAAY,kBAAkB;IAE5B,+EAAyD,CAAA;IAEzD,gEAA0C,CAAA;IAS1C,uDAAiC,CAAA;AACnC,CAAC,EAdW,kBAAkB,kCAAlB,kBAAkB,QAc7B;AAGY,QAAA,+BAA+B,GAAG,wBAAiC,CAAC;AAGpE,QAAA,8BAA8B,GACzC,gCAAyC,CAAC;AAG/B,QAAA,8BAA8B,GAAG,OAAgB,CAAC;AAOlD,QAAA,8BAA8B,GAAG,OAAC;KAC5C,MAAM,CAAC;IACN,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC;KACD,MAAM,EAAE,CAAC;AAOC,QAAA,yBAAyB,GAAG,OAAC;KACvC,MAAM,CAAC;IACN,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,MAAM,EAAE,CAAC;AAOC,QAAA,sBAAsB,GAAG,OAAC;KACpC,MAAM,CAAC;IACN,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC;KACD,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/kernel-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the 32 kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/lifecycle-events';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// ── Canonical platform lifecycle-deletion event contracts ──
|
|
3
|
+
//
|
|
4
|
+
// `organization.organization.deleted`, `project.project.deleted`, and
|
|
5
|
+
// `identity.user.deleted` are the three CANONICAL cascade-cleanup signals every
|
|
6
|
+
// stateful biome subscribes to. Before this contract existed, each of the
|
|
7
|
+
// ~14 consumers hand-re-declared the same `type` string, `source`, and payload
|
|
8
|
+
// `data` shape in its own `consumed-events.registry.ts` — drift waiting to
|
|
9
|
+
// happen on a producer-side change.
|
|
10
|
+
//
|
|
11
|
+
// These contracts live in the KERNEL (Layer 0) so a subscriber depends on the
|
|
12
|
+
// kernel package, never on the producer service. The producers
|
|
13
|
+
// (`project-registry-api` for project, `identity-api` for org + user) import
|
|
14
|
+
// the SAME enum + schema to emit; subscribers import them to match — one source
|
|
15
|
+
// of truth, zero service-to-service code coupling. This mirrors the
|
|
16
|
+
// search-source / mail-source registries (`@xemahq/kernel-contracts/*`) that
|
|
17
|
+
// let a consumer act on any producer's events without importing its client.
|
|
18
|
+
//
|
|
19
|
+
// NOTE: This subpath holds the type strings + payload schemas ONLY. The
|
|
20
|
+
// descriptor wrapper (`defineEvent(...)`) lives in the Layer-1 runtime package
|
|
21
|
+
// `@xemahq/events`, which Layer 0 must not depend on. A consumer keeps its
|
|
22
|
+
// `defineEvent({ type: ..., data: ... })` call but sources the `type` from
|
|
23
|
+
// `LifecycleEventType` and the `data` from these schemas instead of re-typing
|
|
24
|
+
// them. Do not change a `type` string without a coordinated migration — every
|
|
25
|
+
// other service matches on it.
|
|
26
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
27
|
+
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Closed set of canonical platform lifecycle-deletion event `type`s. These are
|
|
32
|
+
* the wire identifiers consumers subscribe to for cascade cleanup — never a
|
|
33
|
+
* free-form string at a call site.
|
|
34
|
+
*/
|
|
35
|
+
export enum LifecycleEventType {
|
|
36
|
+
/** An organization was deleted — cascade-delete all of the org's data. */
|
|
37
|
+
OrganizationDeleted = 'organization.organization.deleted',
|
|
38
|
+
/** A project was deleted — cascade-delete all project-scoped data. */
|
|
39
|
+
ProjectDeleted = 'project.project.deleted',
|
|
40
|
+
/**
|
|
41
|
+
* A user was deleted — cascade-delete that user's user-scoped data.
|
|
42
|
+
*
|
|
43
|
+
* The wire string is `user.user.deleted` — the value identity-api (the
|
|
44
|
+
* producer) actually emits (`WebhookEvents.USER_DELETED`). The lone
|
|
45
|
+
* consumer that today declares `identity.user.deleted` (memory-api) never
|
|
46
|
+
* fires on a real delete; adopting this descriptor fixes that mismatch.
|
|
47
|
+
*/
|
|
48
|
+
UserDeleted = 'user.user.deleted',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Producer URI of the org + user deletion events (identity is the source). */
|
|
52
|
+
export const IDENTITY_LIFECYCLE_EVENT_SOURCE = '/services/identity-api' as const;
|
|
53
|
+
|
|
54
|
+
/** Producer URI of the project deletion event. */
|
|
55
|
+
export const PROJECT_LIFECYCLE_EVENT_SOURCE =
|
|
56
|
+
'/services/project-registry-api' as const;
|
|
57
|
+
|
|
58
|
+
/** Schema version stamped on every canonical lifecycle-deletion event. */
|
|
59
|
+
export const LIFECYCLE_EVENT_SCHEMA_VERSION = '1.0.0' as const;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* `organization.organization.deleted` payload. Identity emits only the org id;
|
|
63
|
+
* the org id also rides the envelope's `ehorgid` extension, so consumers that
|
|
64
|
+
* scope by extension never even read the body.
|
|
65
|
+
*/
|
|
66
|
+
export const OrganizationDeletedEventSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
id: z.string(),
|
|
69
|
+
})
|
|
70
|
+
.strict();
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* `project.project.deleted` payload. Canonical cascade signal — carries the
|
|
74
|
+
* full project triple so a consumer can scope deletes by `orgId` and/or
|
|
75
|
+
* `projectId` without a lookup.
|
|
76
|
+
*/
|
|
77
|
+
export const ProjectDeletedEventSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
id: z.string(),
|
|
80
|
+
orgId: z.string(),
|
|
81
|
+
projectId: z.string(),
|
|
82
|
+
})
|
|
83
|
+
.strict();
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* `identity.user.deleted` payload. `orgId` is optional because a user is a
|
|
87
|
+
* cross-org subject; an org-scoped consumer reads `ehorgid` from the envelope
|
|
88
|
+
* to bound the cascade to its own org.
|
|
89
|
+
*/
|
|
90
|
+
export const UserDeletedEventSchema = z
|
|
91
|
+
.object({
|
|
92
|
+
id: z.string(),
|
|
93
|
+
orgId: z.string().optional(),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
|
|
97
|
+
export type OrganizationDeletedEventPayload = z.infer<
|
|
98
|
+
typeof OrganizationDeletedEventSchema
|
|
99
|
+
>;
|
|
100
|
+
export type ProjectDeletedEventPayload = z.infer<
|
|
101
|
+
typeof ProjectDeletedEventSchema
|
|
102
|
+
>;
|
|
103
|
+
export type UserDeletedEventPayload = z.infer<typeof UserDeletedEventSchema>;
|