@xemahq/kernel-contracts 0.49.1 → 0.49.3

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.
Files changed (51) hide show
  1. package/dist/app-definition/index.d.ts +10 -0
  2. package/dist/app-definition/index.d.ts.map +1 -0
  3. package/dist/app-definition/index.js +26 -0
  4. package/dist/app-definition/index.js.map +1 -0
  5. package/dist/app-definition/lib/action.d.ts +45 -0
  6. package/dist/app-definition/lib/action.d.ts.map +1 -0
  7. package/dist/app-definition/lib/action.js +11 -0
  8. package/dist/app-definition/lib/action.js.map +1 -0
  9. package/dist/app-definition/lib/authorization.d.ts +29 -0
  10. package/dist/app-definition/lib/authorization.d.ts.map +1 -0
  11. package/dist/app-definition/lib/authorization.js +37 -0
  12. package/dist/app-definition/lib/authorization.js.map +1 -0
  13. package/dist/app-definition/lib/automation.d.ts +15 -0
  14. package/dist/app-definition/lib/automation.d.ts.map +1 -0
  15. package/dist/app-definition/lib/automation.js +10 -0
  16. package/dist/app-definition/lib/automation.js.map +1 -0
  17. package/dist/app-definition/lib/component.d.ts +8 -0
  18. package/dist/app-definition/lib/component.d.ts.map +1 -0
  19. package/dist/app-definition/lib/component.js +8 -0
  20. package/dist/app-definition/lib/component.js.map +1 -0
  21. package/dist/app-definition/lib/data-mode.d.ts +6 -0
  22. package/dist/app-definition/lib/data-mode.d.ts.map +1 -0
  23. package/dist/app-definition/lib/data-mode.js +10 -0
  24. package/dist/app-definition/lib/data-mode.js.map +1 -0
  25. package/dist/app-definition/lib/definition.d.ts +56 -0
  26. package/dist/app-definition/lib/definition.d.ts.map +1 -0
  27. package/dist/app-definition/lib/definition.js +3 -0
  28. package/dist/app-definition/lib/definition.js.map +1 -0
  29. package/dist/app-definition/lib/field-type.d.ts +15 -0
  30. package/dist/app-definition/lib/field-type.d.ts.map +1 -0
  31. package/dist/app-definition/lib/field-type.js +19 -0
  32. package/dist/app-definition/lib/field-type.js.map +1 -0
  33. package/dist/app-definition/lib/page-kind.d.ts +9 -0
  34. package/dist/app-definition/lib/page-kind.d.ts.map +1 -0
  35. package/dist/app-definition/lib/page-kind.js +13 -0
  36. package/dist/app-definition/lib/page-kind.js.map +1 -0
  37. package/dist/app-definition/lib/widget.d.ts +45 -0
  38. package/dist/app-definition/lib/widget.d.ts.map +1 -0
  39. package/dist/app-definition/lib/widget.js +31 -0
  40. package/dist/app-definition/lib/widget.js.map +1 -0
  41. package/package.json +1 -1
  42. package/src/app-definition/index.ts +15 -0
  43. package/src/app-definition/lib/action.ts +66 -0
  44. package/src/app-definition/lib/authorization.ts +57 -0
  45. package/src/app-definition/lib/automation.ts +37 -0
  46. package/src/app-definition/lib/component.ts +48 -0
  47. package/src/app-definition/lib/data-mode.ts +17 -0
  48. package/src/app-definition/lib/definition.ts +113 -0
  49. package/src/app-definition/lib/field-type.ts +34 -0
  50. package/src/app-definition/lib/page-kind.ts +24 -0
  51. package/src/app-definition/lib/widget.ts +105 -0
@@ -0,0 +1,10 @@
1
+ export * from './lib/field-type';
2
+ export * from './lib/page-kind';
3
+ export * from './lib/component';
4
+ export * from './lib/widget';
5
+ export * from './lib/action';
6
+ export * from './lib/automation';
7
+ export * from './lib/authorization';
8
+ export * from './lib/data-mode';
9
+ export * from './lib/definition';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app-definition/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,26 @@
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/field-type"), exports);
18
+ __exportStar(require("./lib/page-kind"), exports);
19
+ __exportStar(require("./lib/component"), exports);
20
+ __exportStar(require("./lib/widget"), exports);
21
+ __exportStar(require("./lib/action"), exports);
22
+ __exportStar(require("./lib/automation"), exports);
23
+ __exportStar(require("./lib/authorization"), exports);
24
+ __exportStar(require("./lib/data-mode"), exports);
25
+ __exportStar(require("./lib/definition"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app-definition/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,mDAAiC;AACjC,kDAAgC;AAChC,kDAAgC;AAChC,+CAA6B;AAC7B,+CAA6B;AAC7B,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,mDAAiC"}
@@ -0,0 +1,45 @@
1
+ export declare enum AppActionKind {
2
+ UpdateRecord = "updateRecord",
3
+ TransitionField = "transitionField",
4
+ InvokeAgent = "invokeAgent",
5
+ InvokeCapability = "invokeCapability"
6
+ }
7
+ export type AppAction = {
8
+ key: string;
9
+ label: string;
10
+ entityKey: string;
11
+ kind: AppActionKind.UpdateRecord;
12
+ config: {
13
+ set: Record<string, string | number | boolean | null>;
14
+ };
15
+ } | {
16
+ key: string;
17
+ label: string;
18
+ entityKey: string;
19
+ kind: AppActionKind.TransitionField;
20
+ config: {
21
+ field: string;
22
+ order: string[];
23
+ };
24
+ } | {
25
+ key: string;
26
+ label: string;
27
+ entityKey: string;
28
+ kind: AppActionKind.InvokeAgent;
29
+ config: {
30
+ agentRef: string;
31
+ promptTemplate: string;
32
+ targetField: string;
33
+ outputKey?: string;
34
+ };
35
+ } | {
36
+ key: string;
37
+ label: string;
38
+ entityKey: string;
39
+ kind: AppActionKind.InvokeCapability;
40
+ config: {
41
+ capabilityRef: string;
42
+ input: Record<string, string | number | boolean | null>;
43
+ };
44
+ };
45
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/action.ts"],"names":[],"mappings":"AAQA,oBAAY,aAAa;IACvB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAK3B,gBAAgB,qBAAqB;CACtC;AAYD,MAAM,MAAM,SAAS,GACjB;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,YAAY,CAAC;IACjC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAA;KAAE,CAAC;CACnE,GACD;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC;IACpC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC5C,GACD;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC;IAChC,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,GACD;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,gBAAgB,CAAC;IACrC,MAAM,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;KACzD,CAAC;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppActionKind = void 0;
4
+ var AppActionKind;
5
+ (function (AppActionKind) {
6
+ AppActionKind["UpdateRecord"] = "updateRecord";
7
+ AppActionKind["TransitionField"] = "transitionField";
8
+ AppActionKind["InvokeAgent"] = "invokeAgent";
9
+ AppActionKind["InvokeCapability"] = "invokeCapability";
10
+ })(AppActionKind || (exports.AppActionKind = AppActionKind = {}));
11
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/app-definition/lib/action.ts"],"names":[],"mappings":";;;AAQA,IAAY,aASX;AATD,WAAY,aAAa;IACvB,8CAA6B,CAAA;IAC7B,oDAAmC,CAAA;IACnC,4CAA2B,CAAA;IAK3B,sDAAqC,CAAA;AACvC,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB"}
@@ -0,0 +1,29 @@
1
+ export declare enum AppRowPolicyOp {
2
+ Eq = "Eq",
3
+ Ne = "Ne",
4
+ In = "In",
5
+ NotIn = "NotIn",
6
+ IsNull = "IsNull",
7
+ IsNotNull = "IsNotNull"
8
+ }
9
+ export declare enum AppRowPolicySubject {
10
+ Id = "id",
11
+ Tenant = "tenant"
12
+ }
13
+ export declare enum AppReadAccessMode {
14
+ None = "none",
15
+ Aggregate = "aggregate",
16
+ Rows = "rows"
17
+ }
18
+ export declare enum AppAggregateMeasure {
19
+ Count = "count",
20
+ Average = "average",
21
+ Sum = "sum",
22
+ Min = "min",
23
+ Max = "max"
24
+ }
25
+ export declare enum AppAgentAccess {
26
+ Allow = "allow",
27
+ Deny = "deny"
28
+ }
29
+ //# sourceMappingURL=authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/authorization.ts"],"names":[],"mappings":"AAcA,oBAAY,cAAc;IACxB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAOD,oBAAY,mBAAmB;IAC7B,EAAE,OAAO;IACT,MAAM,WAAW;CAClB;AAGD,oBAAY,iBAAiB;IAE3B,IAAI,SAAS;IAEb,SAAS,cAAc;IAEvB,IAAI,SAAS;CACd;AAGD,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAGD,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,IAAI,SAAS;CACd"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppAgentAccess = exports.AppAggregateMeasure = exports.AppReadAccessMode = exports.AppRowPolicySubject = exports.AppRowPolicyOp = void 0;
4
+ var AppRowPolicyOp;
5
+ (function (AppRowPolicyOp) {
6
+ AppRowPolicyOp["Eq"] = "Eq";
7
+ AppRowPolicyOp["Ne"] = "Ne";
8
+ AppRowPolicyOp["In"] = "In";
9
+ AppRowPolicyOp["NotIn"] = "NotIn";
10
+ AppRowPolicyOp["IsNull"] = "IsNull";
11
+ AppRowPolicyOp["IsNotNull"] = "IsNotNull";
12
+ })(AppRowPolicyOp || (exports.AppRowPolicyOp = AppRowPolicyOp = {}));
13
+ var AppRowPolicySubject;
14
+ (function (AppRowPolicySubject) {
15
+ AppRowPolicySubject["Id"] = "id";
16
+ AppRowPolicySubject["Tenant"] = "tenant";
17
+ })(AppRowPolicySubject || (exports.AppRowPolicySubject = AppRowPolicySubject = {}));
18
+ var AppReadAccessMode;
19
+ (function (AppReadAccessMode) {
20
+ AppReadAccessMode["None"] = "none";
21
+ AppReadAccessMode["Aggregate"] = "aggregate";
22
+ AppReadAccessMode["Rows"] = "rows";
23
+ })(AppReadAccessMode || (exports.AppReadAccessMode = AppReadAccessMode = {}));
24
+ var AppAggregateMeasure;
25
+ (function (AppAggregateMeasure) {
26
+ AppAggregateMeasure["Count"] = "count";
27
+ AppAggregateMeasure["Average"] = "average";
28
+ AppAggregateMeasure["Sum"] = "sum";
29
+ AppAggregateMeasure["Min"] = "min";
30
+ AppAggregateMeasure["Max"] = "max";
31
+ })(AppAggregateMeasure || (exports.AppAggregateMeasure = AppAggregateMeasure = {}));
32
+ var AppAgentAccess;
33
+ (function (AppAgentAccess) {
34
+ AppAgentAccess["Allow"] = "allow";
35
+ AppAgentAccess["Deny"] = "deny";
36
+ })(AppAgentAccess || (exports.AppAgentAccess = AppAgentAccess = {}));
37
+ //# sourceMappingURL=authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../src/app-definition/lib/authorization.ts"],"names":[],"mappings":";;;AAcA,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,2BAAS,CAAA;IACT,2BAAS,CAAA;IACT,2BAAS,CAAA;IACT,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,yCAAuB,CAAA;AACzB,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB;AAOD,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,gCAAS,CAAA;IACT,wCAAiB,CAAA;AACnB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AAGD,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAE3B,kCAAa,CAAA;IAEb,4CAAuB,CAAA;IAEvB,kCAAa,CAAA;AACf,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;AAGD,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,sCAAe,CAAA;IACf,0CAAmB,CAAA;IACnB,kCAAW,CAAA;IACX,kCAAW,CAAA;IACX,kCAAW,CAAA;AACb,CAAC,EANW,mBAAmB,mCAAnB,mBAAmB,QAM9B;AAGD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB"}
@@ -0,0 +1,15 @@
1
+ export declare enum AppAutomationTrigger {
2
+ RecordCreated = "recordCreated",
3
+ RecordUpdated = "recordUpdated",
4
+ Scheduled = "scheduled"
5
+ }
6
+ export interface AppAutomation {
7
+ key: string;
8
+ trigger: AppAutomationTrigger;
9
+ entityKey: string;
10
+ action: string;
11
+ schedule?: {
12
+ everyMinutes: number;
13
+ };
14
+ }
15
+ //# sourceMappingURL=automation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/automation.ts"],"names":[],"mappings":"AAcA,oBAAY,oBAAoB;IAC9B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,SAAS,cAAc;CACxB;AAMD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAElB,MAAM,EAAE,MAAM,CAAC;IAMf,QAAQ,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CACrC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppAutomationTrigger = void 0;
4
+ var AppAutomationTrigger;
5
+ (function (AppAutomationTrigger) {
6
+ AppAutomationTrigger["RecordCreated"] = "recordCreated";
7
+ AppAutomationTrigger["RecordUpdated"] = "recordUpdated";
8
+ AppAutomationTrigger["Scheduled"] = "scheduled";
9
+ })(AppAutomationTrigger || (exports.AppAutomationTrigger = AppAutomationTrigger = {}));
10
+ //# sourceMappingURL=automation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.js","sourceRoot":"","sources":["../../../src/app-definition/lib/automation.ts"],"names":[],"mappings":";;;AAcA,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,uDAA+B,CAAA;IAC/B,uDAA+B,CAAA;IAC/B,+CAAuB,CAAA;AACzB,CAAC,EAJW,oBAAoB,oCAApB,oBAAoB,QAI/B"}
@@ -0,0 +1,8 @@
1
+ export declare enum AppComponentKind {
2
+ Code = "code"
3
+ }
4
+ export interface AppCodeComponent {
5
+ readonly kind: AppComponentKind.Code;
6
+ readonly source: string;
7
+ }
8
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/component.ts"],"names":[],"mappings":"AA+BA,oBAAY,gBAAgB;IAE1B,IAAI,SAAS;CACd;AASD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAErC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppComponentKind = void 0;
4
+ var AppComponentKind;
5
+ (function (AppComponentKind) {
6
+ AppComponentKind["Code"] = "code";
7
+ })(AppComponentKind || (exports.AppComponentKind = AppComponentKind = {}));
8
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/app-definition/lib/component.ts"],"names":[],"mappings":";;;AA+BA,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAE1B,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B"}
@@ -0,0 +1,6 @@
1
+ export declare enum AppDataMode {
2
+ None = "none",
3
+ Owned = "owned",
4
+ Annotated = "annotated"
5
+ }
6
+ //# sourceMappingURL=data-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-mode.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/data-mode.ts"],"names":[],"mappings":"AAYA,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;CACxB"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppDataMode = void 0;
4
+ var AppDataMode;
5
+ (function (AppDataMode) {
6
+ AppDataMode["None"] = "none";
7
+ AppDataMode["Owned"] = "owned";
8
+ AppDataMode["Annotated"] = "annotated";
9
+ })(AppDataMode || (exports.AppDataMode = AppDataMode = {}));
10
+ //# sourceMappingURL=data-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-mode.js","sourceRoot":"","sources":["../../../src/app-definition/lib/data-mode.ts"],"names":[],"mappings":";;;AAYA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,sCAAuB,CAAA;AACzB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB"}
@@ -0,0 +1,56 @@
1
+ import { AppFieldType } from './field-type';
2
+ import { AppPageKind } from './page-kind';
3
+ import { AppAction } from './action';
4
+ import { AppAutomation } from './automation';
5
+ import { AppWidget } from './widget';
6
+ import { AppCodeComponent } from './component';
7
+ export interface AppField {
8
+ key: string;
9
+ label: string;
10
+ type: AppFieldType;
11
+ required?: boolean;
12
+ enumValues?: string[];
13
+ referenceEntity?: string;
14
+ fields?: AppField[];
15
+ minItems?: number;
16
+ maxItems?: number;
17
+ }
18
+ export interface AppEntity {
19
+ key: string;
20
+ label: string;
21
+ fields: AppField[];
22
+ }
23
+ export interface AppSection {
24
+ key: string;
25
+ title: string;
26
+ description?: string;
27
+ fieldKeys: string[];
28
+ }
29
+ export interface AppPage {
30
+ slug: string;
31
+ title: string;
32
+ kind: AppPageKind;
33
+ entityKey?: string;
34
+ columns?: string[];
35
+ fields?: string[];
36
+ sections?: AppSection[];
37
+ widgets?: AppWidget[];
38
+ dateField?: string;
39
+ linkKey?: string;
40
+ component?: AppCodeComponent;
41
+ }
42
+ export interface AppLink {
43
+ key: string;
44
+ fromEntity: string;
45
+ refField: string;
46
+ toEntity: string;
47
+ }
48
+ export interface AppDefinition {
49
+ entities: AppEntity[];
50
+ pages: AppPage[];
51
+ navigation: string[];
52
+ actions?: AppAction[];
53
+ automations?: AppAutomation[];
54
+ links?: AppLink[];
55
+ }
56
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/definition.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,eAAe,CAAC,EAAE,MAAM,CAAC;IAKzB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,EAAE,CAAC;CACpB;AAQD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,WAAW,CAAC;IAElB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IAExB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IAEtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAOjB,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AASD,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,KAAK,EAAE,OAAO,EAAE,CAAC;IAEjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAE9B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;CACnB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/app-definition/lib/definition.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ export declare enum AppFieldType {
2
+ String = "string",
3
+ Text = "text",
4
+ Number = "number",
5
+ Decimal = "decimal",
6
+ Boolean = "boolean",
7
+ Date = "date",
8
+ DateTime = "datetime",
9
+ Enum = "enum",
10
+ Reference = "reference",
11
+ User = "user",
12
+ Object = "object",
13
+ List = "list"
14
+ }
15
+ //# sourceMappingURL=field-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-type.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/field-type.ts"],"names":[],"mappings":"AAQA,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;IAEb,MAAM,WAAW;IAEjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,SAAS,cAAc;IAEvB,IAAI,SAAS;IAKb,MAAM,WAAW;IAMjB,IAAI,SAAS;CACd"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppFieldType = void 0;
4
+ var AppFieldType;
5
+ (function (AppFieldType) {
6
+ AppFieldType["String"] = "string";
7
+ AppFieldType["Text"] = "text";
8
+ AppFieldType["Number"] = "number";
9
+ AppFieldType["Decimal"] = "decimal";
10
+ AppFieldType["Boolean"] = "boolean";
11
+ AppFieldType["Date"] = "date";
12
+ AppFieldType["DateTime"] = "datetime";
13
+ AppFieldType["Enum"] = "enum";
14
+ AppFieldType["Reference"] = "reference";
15
+ AppFieldType["User"] = "user";
16
+ AppFieldType["Object"] = "object";
17
+ AppFieldType["List"] = "list";
18
+ })(AppFieldType || (exports.AppFieldType = AppFieldType = {}));
19
+ //# sourceMappingURL=field-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-type.js","sourceRoot":"","sources":["../../../src/app-definition/lib/field-type.ts"],"names":[],"mappings":";;;AAQA,IAAY,YAyBX;AAzBD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IAEb,iCAAiB,CAAA;IAEjB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,6BAAa,CAAA;IACb,uCAAuB,CAAA;IAEvB,6BAAa,CAAA;IAKb,iCAAiB,CAAA;IAMjB,6BAAa,CAAA;AACf,CAAC,EAzBW,YAAY,4BAAZ,YAAY,QAyBvB"}
@@ -0,0 +1,9 @@
1
+ export declare enum AppPageKind {
2
+ List = "list",
3
+ Form = "form",
4
+ Detail = "detail",
5
+ Dashboard = "dashboard",
6
+ Timeline = "timeline",
7
+ Related = "related"
8
+ }
9
+ //# sourceMappingURL=page-kind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-kind.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/page-kind.ts"],"names":[],"mappings":"AAKA,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IAMvB,QAAQ,aAAa;IAOrB,OAAO,YAAY;CACpB"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppPageKind = void 0;
4
+ var AppPageKind;
5
+ (function (AppPageKind) {
6
+ AppPageKind["List"] = "list";
7
+ AppPageKind["Form"] = "form";
8
+ AppPageKind["Detail"] = "detail";
9
+ AppPageKind["Dashboard"] = "dashboard";
10
+ AppPageKind["Timeline"] = "timeline";
11
+ AppPageKind["Related"] = "related";
12
+ })(AppPageKind || (exports.AppPageKind = AppPageKind = {}));
13
+ //# sourceMappingURL=page-kind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-kind.js","sourceRoot":"","sources":["../../../src/app-definition/lib/page-kind.ts"],"names":[],"mappings":";;;AAKA,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,sCAAuB,CAAA;IAMvB,oCAAqB,CAAA;IAOrB,kCAAmB,CAAA;AACrB,CAAC,EAlBW,WAAW,2BAAX,WAAW,QAkBtB"}
@@ -0,0 +1,45 @@
1
+ import { AppCodeComponent } from './component';
2
+ export declare enum AppWidgetKind {
3
+ Stat = "stat",
4
+ Table = "table",
5
+ Chart = "chart"
6
+ }
7
+ export declare enum AppWidgetSourceKind {
8
+ Entity = "entity",
9
+ Capability = "capability",
10
+ Series = "series"
11
+ }
12
+ export declare enum AppWidgetAggregate {
13
+ Count = "count"
14
+ }
15
+ export declare enum AppChartType {
16
+ Bar = "bar",
17
+ Line = "line",
18
+ Donut = "donut"
19
+ }
20
+ export declare enum AppSeriesAggregateKind {
21
+ Count = "count",
22
+ Sum = "sum"
23
+ }
24
+ export type AppSeriesAggregate = {
25
+ kind: AppSeriesAggregateKind.Count;
26
+ } | {
27
+ kind: AppSeriesAggregateKind.Sum;
28
+ field: string;
29
+ };
30
+ export interface AppWidgetSeriesSource {
31
+ entityKey: string;
32
+ groupBy: string;
33
+ aggregate: AppSeriesAggregate;
34
+ chartType: AppChartType;
35
+ }
36
+ export interface AppWidget {
37
+ kind: AppWidgetKind;
38
+ title: string;
39
+ entityKey?: string;
40
+ aggregate?: AppWidgetAggregate;
41
+ filter?: Record<string, string | number | boolean>;
42
+ series?: AppWidgetSeriesSource;
43
+ component?: AppCodeComponent;
44
+ }
45
+ //# sourceMappingURL=widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../src/app-definition/lib/widget.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,KAAK,UAAU;IAMf,KAAK,UAAU;CAChB;AAQD,oBAAY,mBAAmB;IAC7B,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAGD,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;CAChB;AAOD,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAMD,oBAAY,sBAAsB;IAChC,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAMD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,sBAAsB,CAAC,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAOxD,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,YAAY,CAAC;CACzB;AAQD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IAKd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAE/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAEnD,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAO/B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppSeriesAggregateKind = exports.AppChartType = exports.AppWidgetAggregate = exports.AppWidgetSourceKind = exports.AppWidgetKind = void 0;
4
+ var AppWidgetKind;
5
+ (function (AppWidgetKind) {
6
+ AppWidgetKind["Stat"] = "stat";
7
+ AppWidgetKind["Table"] = "table";
8
+ AppWidgetKind["Chart"] = "chart";
9
+ })(AppWidgetKind || (exports.AppWidgetKind = AppWidgetKind = {}));
10
+ var AppWidgetSourceKind;
11
+ (function (AppWidgetSourceKind) {
12
+ AppWidgetSourceKind["Entity"] = "entity";
13
+ AppWidgetSourceKind["Capability"] = "capability";
14
+ AppWidgetSourceKind["Series"] = "series";
15
+ })(AppWidgetSourceKind || (exports.AppWidgetSourceKind = AppWidgetSourceKind = {}));
16
+ var AppWidgetAggregate;
17
+ (function (AppWidgetAggregate) {
18
+ AppWidgetAggregate["Count"] = "count";
19
+ })(AppWidgetAggregate || (exports.AppWidgetAggregate = AppWidgetAggregate = {}));
20
+ var AppChartType;
21
+ (function (AppChartType) {
22
+ AppChartType["Bar"] = "bar";
23
+ AppChartType["Line"] = "line";
24
+ AppChartType["Donut"] = "donut";
25
+ })(AppChartType || (exports.AppChartType = AppChartType = {}));
26
+ var AppSeriesAggregateKind;
27
+ (function (AppSeriesAggregateKind) {
28
+ AppSeriesAggregateKind["Count"] = "count";
29
+ AppSeriesAggregateKind["Sum"] = "sum";
30
+ })(AppSeriesAggregateKind || (exports.AppSeriesAggregateKind = AppSeriesAggregateKind = {}));
31
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../src/app-definition/lib/widget.ts"],"names":[],"mappings":";;;AASA,IAAY,aASX;AATD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,gCAAe,CAAA;IAMf,gCAAe,CAAA;AACjB,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB;AAQD,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,gDAAyB,CAAA;IACzB,wCAAiB,CAAA;AACnB,CAAC,EAJW,mBAAmB,mCAAnB,mBAAmB,QAI9B;AAGD,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,qCAAe,CAAA;AACjB,CAAC,EAFW,kBAAkB,kCAAlB,kBAAkB,QAE7B;AAOD,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAMD,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,qCAAW,CAAA;AACb,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/kernel-contracts",
3
- "version": "0.49.1",
3
+ "version": "0.49.3",
4
4
  "description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
@@ -0,0 +1,15 @@
1
+ // The App Forge declarative-definition SHAPE contract — the closed enums and the
2
+ // plain renderer-facing view models shared, byte-identically, by the app-forge
3
+ // server (which references the enums from its zod validation schema) and the App
4
+ // Forge web biome (which types its renderer view models with them). Pure Layer-0
5
+ // leaf: enums + interfaces only, zero runtime deps. The zod validation logic and
6
+ // the richer zod-inferred `*Def` types stay in the app-forge server.
7
+ export * from './lib/field-type';
8
+ export * from './lib/page-kind';
9
+ export * from './lib/component';
10
+ export * from './lib/widget';
11
+ export * from './lib/action';
12
+ export * from './lib/automation';
13
+ export * from './lib/authorization';
14
+ export * from './lib/data-mode';
15
+ export * from './lib/definition';
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Declarative record actions — the closed action-kind vocabulary + the action
3
+ * view models the App Forge renderer/builder interpret from the opaque
4
+ * definition JSON. Shared by the app-forge server's zod schema and the web
5
+ * surface. Stable wire strings.
6
+ */
7
+
8
+ /** Closed set of declarative action kinds an app definition may declare. */
9
+ export enum AppActionKind {
10
+ UpdateRecord = 'updateRecord',
11
+ TransitionField = 'transitionField',
12
+ InvokeAgent = 'invokeAgent',
13
+ /**
14
+ * Invoke a declared capability through the same governed path `invokeAgent`
15
+ * uses — the app's `capabilityPolicy` gate then the base capability router.
16
+ */
17
+ InvokeCapability = 'invokeCapability',
18
+ }
19
+
20
+ /**
21
+ * One executable record action — discriminated on `kind`.
22
+ *
23
+ * - `updateRecord` sets the configured field values on the record.
24
+ * - `transitionField` advances an enum field along the ordered `order` list.
25
+ * - `invokeAgent` invokes a platform agent (`agentRef`) with a `{{field-key}}`
26
+ * templated prompt; the agent's text result is written into `targetField`.
27
+ * - `invokeCapability` invokes a capability ref the app's `capabilityPolicy`
28
+ * must allow; `input` string values support `{{field-key}}` templating.
29
+ */
30
+ export type AppAction =
31
+ | {
32
+ key: string;
33
+ label: string;
34
+ entityKey: string;
35
+ kind: AppActionKind.UpdateRecord;
36
+ config: { set: Record<string, string | number | boolean | null> };
37
+ }
38
+ | {
39
+ key: string;
40
+ label: string;
41
+ entityKey: string;
42
+ kind: AppActionKind.TransitionField;
43
+ config: { field: string; order: string[] };
44
+ }
45
+ | {
46
+ key: string;
47
+ label: string;
48
+ entityKey: string;
49
+ kind: AppActionKind.InvokeAgent;
50
+ config: {
51
+ agentRef: string;
52
+ promptTemplate: string;
53
+ targetField: string;
54
+ outputKey?: string;
55
+ };
56
+ }
57
+ | {
58
+ key: string;
59
+ label: string;
60
+ entityKey: string;
61
+ kind: AppActionKind.InvokeCapability;
62
+ config: {
63
+ capabilityRef: string;
64
+ input: Record<string, string | number | boolean | null>;
65
+ };
66
+ };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Declarative-authorization closed vocabulary for an app entity — row-policy
3
+ * operators/subjects, read-access modes, aggregate measures, and agent access.
4
+ * These are the enums referenced by the app-forge server's authorization zod
5
+ * schemas (`z.nativeEnum(...)`); the AUTHOR-facing sub-schemas and the
6
+ * cross-validation logic stay in the server. Stable wire strings.
7
+ */
8
+
9
+ /**
10
+ * Closed set of row-policy comparison operators. NO expression language and NO
11
+ * client-supplied predicate — a clause is `{field, op, …}` only. `Eq`/`Ne`
12
+ * compare a field to a subject-bound value or a literal; `In`/`NotIn` test
13
+ * membership in a literal list; `IsNull`/`IsNotNull` are unary.
14
+ */
15
+ export enum AppRowPolicyOp {
16
+ Eq = 'Eq',
17
+ Ne = 'Ne',
18
+ In = 'In',
19
+ NotIn = 'NotIn',
20
+ IsNull = 'IsNull',
21
+ IsNotNull = 'IsNotNull',
22
+ }
23
+
24
+ /**
25
+ * What a row-policy clause (or tenancy) binds a field against. Closed — the only
26
+ * two request-time subject facts a policy may reference: the caller's identity
27
+ * (`id`) and its resolved tenant (`tenant`).
28
+ */
29
+ export enum AppRowPolicySubject {
30
+ Id = 'id',
31
+ Tenant = 'tenant',
32
+ }
33
+
34
+ /** Read shape an entity exposes. Closed. */
35
+ export enum AppReadAccessMode {
36
+ /** Nobody reads rows OR aggregates. */
37
+ None = 'none',
38
+ /** Only k-anonymised aggregates. */
39
+ Aggregate = 'aggregate',
40
+ /** Full rows, subject to `rowPolicy` + field masking. */
41
+ Rows = 'rows',
42
+ }
43
+
44
+ /** Closed set of aggregate measures a widget/aggregate path may compute. */
45
+ export enum AppAggregateMeasure {
46
+ Count = 'count',
47
+ Average = 'average',
48
+ Sum = 'sum',
49
+ Min = 'min',
50
+ Max = 'max',
51
+ }
52
+
53
+ /** Whether the agent capability path may touch an entity. Closed. */
54
+ export enum AppAgentAccess {
55
+ Allow = 'allow',
56
+ Deny = 'deny',
57
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Declarative automations — the closed trigger vocabulary + the automation view
3
+ * model the App Forge renderer/builder interpret from the opaque definition
4
+ * JSON. Shared by the app-forge server's zod schema and the web surface.
5
+ */
6
+
7
+ /**
8
+ * Closed set of automation triggers.
9
+ *
10
+ * - `recordCreated` / `recordUpdated` fire transactionally-adjacent to a record
11
+ * write, against the written record.
12
+ * - `scheduled` fires on a cluster-singleton Temporal Schedule and runs its
13
+ * action against every record of the bound entity on each tick.
14
+ */
15
+ export enum AppAutomationTrigger {
16
+ RecordCreated = 'recordCreated',
17
+ RecordUpdated = 'recordUpdated',
18
+ Scheduled = 'scheduled',
19
+ }
20
+
21
+ /**
22
+ * Trigger → action binding, run server-side after a record is created or
23
+ * updated (or on a schedule), from the PUBLISHED definition.
24
+ */
25
+ export interface AppAutomation {
26
+ key: string;
27
+ trigger: AppAutomationTrigger;
28
+ entityKey: string;
29
+ /** Key of the action to execute (must target the same entity). */
30
+ action: string;
31
+ /**
32
+ * REQUIRED when `trigger` is `scheduled` (and MUST be absent otherwise): the
33
+ * action runs against every record of the entity every `everyMinutes`
34
+ * minutes (integer 1..44640). Server-validated at publish.
35
+ */
36
+ schedule?: { everyMinutes: number };
37
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Custom-UI code component — the ADDITIVE Wave-12 extension to the App Forge
3
+ * declarative definition (plan `runtime-app-platform.md` Wave 12 / D19). A page
4
+ * or widget MAY carry a `component: { kind: 'code', source }` to render an
5
+ * author-written UI component INSTEAD of the generic declarative renderer.
6
+ *
7
+ * This surface is the SHAPE contract only — the closed `AppComponentKind` enum
8
+ * plus the plain {@link AppCodeComponent} interface shared, byte-identically,
9
+ * by the app-forge server (whose zod schema validates it) and the App Forge web
10
+ * renderer (which draws it). The COMPILE step (server-side esbuild against a
11
+ * pinned `@xemahq/app-ui`, the SRI'd ESM chunk, and the opaque-origin iframe
12
+ * runtime) is NOT part of this contract — it is the large multi-wave runtime the
13
+ * plan defers. Declaring a code component is additive: an absent `component`
14
+ * (the default on every page/widget today) preserves the current declarative
15
+ * behavior exactly.
16
+ *
17
+ * **Cost is not free and the platform must say so.** The moment a definition
18
+ * carries a code component, publishing it means COMPILING it, and the app stops
19
+ * being live-on-keystroke (plan Wave 12). Until the compiler + iframe runtime
20
+ * ship, the app-forge publish path FAILS CLOSED on any definition containing a
21
+ * code component (`APP_CUSTOM_UI_NOT_YET_AVAILABLE`) — it never silently accepts
22
+ * or ignores one.
23
+ */
24
+
25
+ /**
26
+ * Closed set of custom-UI component kinds. Only `code` exists — a
27
+ * server-compiled, author-authored component. A future non-code kind (e.g. a
28
+ * pinned marketplace component) is a one-line addition here plus a matching
29
+ * discriminated variant. Stable wire string; never compare against a free-form
30
+ * string.
31
+ */
32
+ export enum AppComponentKind {
33
+ /** An author-written UI component, compiled server-side against `@xemahq/app-ui`. */
34
+ Code = 'code',
35
+ }
36
+
37
+ /**
38
+ * A `kind: 'code'` custom-UI component authored against the pinned
39
+ * `@xemahq/app-ui` surface. `source` is the raw component module text; it is
40
+ * validated (length-bounded) and — once the compiler ships — type-checked and
41
+ * responsive-linted at PUBLISH time, never at author-keystroke time. Carried
42
+ * inside the opaque app-definition JSON on a page or widget.
43
+ */
44
+ export interface AppCodeComponent {
45
+ readonly kind: AppComponentKind.Code;
46
+ /** The raw component module source authored against `@xemahq/app-ui`. */
47
+ readonly source: string;
48
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `AppDataMode` — how an entity's data plane is provisioned per channel. Closed
3
+ * set; an entity omitting it defaults to {@link AppDataMode.Owned}. Referenced
4
+ * by the app-forge server's zod schema (`z.enum(AppDataMode)`); the
5
+ * `resolveDataMode` helper and the `AppDataModeSchema` stay in the server.
6
+ *
7
+ * - `None` — provision NO records at all.
8
+ * - `Owned` — the app owns the rows (the default); preview provisioning
9
+ * generates synthetic rows for it.
10
+ * - `Annotated` — owned rows that also carry provenance/annotation; preview
11
+ * provisioning generates synthetic rows and marks them synthetic.
12
+ */
13
+ export enum AppDataMode {
14
+ None = 'none',
15
+ Owned = 'owned',
16
+ Annotated = 'annotated',
17
+ }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * The declarative App Forge definition VIEW MODELS — the plain, renderer-facing
3
+ * interfaces the App Forge web biome interprets from the opaque app-definition
4
+ * JSON, plus the top-level {@link AppDefinition} shape.
5
+ *
6
+ * These are the SHAPE contract shared with the frontend; the app-forge server's
7
+ * zod schemas (validation, `superRefine`, and the richer zod-inferred `*Def`
8
+ * types carrying authorization sub-shapes) stay server-side and are NOT mirrored
9
+ * here. This surface carries only the closed enums and the plain interfaces the
10
+ * renderer needs.
11
+ */
12
+ import { AppFieldType } from './field-type';
13
+ import { AppPageKind } from './page-kind';
14
+ import { AppAction } from './action';
15
+ import { AppAutomation } from './automation';
16
+ import { AppWidget } from './widget';
17
+ import { AppCodeComponent } from './component';
18
+
19
+ /**
20
+ * One entity field. `object`/`list` fields carry a recursive nested `fields[]`
21
+ * item shape; `list` additionally carries `minItems`/`maxItems` count bounds.
22
+ */
23
+ export interface AppField {
24
+ key: string;
25
+ label: string;
26
+ type: AppFieldType;
27
+ required?: boolean;
28
+ /** Only for `type: AppFieldType.Enum`. */
29
+ enumValues?: string[];
30
+ /** Only for `type: AppFieldType.Reference` — key of the target entity. */
31
+ referenceEntity?: string;
32
+ /**
33
+ * Nested item shape — the typed sub-fields of an `object` field or of each
34
+ * item of a `list`. Present iff `type` is `object` or `list`; recursive.
35
+ */
36
+ fields?: AppField[];
37
+ /** `list` only: minimum item count. */
38
+ minItems?: number;
39
+ /** `list` only: maximum item count. */
40
+ maxItems?: number;
41
+ }
42
+
43
+ export interface AppEntity {
44
+ key: string;
45
+ label: string;
46
+ fields: AppField[];
47
+ }
48
+
49
+ /**
50
+ * A Form-page SECTION: a pure LAYOUT grouping over the page's field keys.
51
+ * `fieldKeys` names entity fields rendered together under `title` (in order); it
52
+ * is presentation metadata ONLY and changes no storage. A field may appear in at
53
+ * most one section; fields in no section render ungrouped.
54
+ */
55
+ export interface AppSection {
56
+ key: string;
57
+ title: string;
58
+ description?: string;
59
+ fieldKeys: string[];
60
+ }
61
+
62
+ export interface AppPage {
63
+ slug: string;
64
+ title: string;
65
+ kind: AppPageKind;
66
+ /** Bound entity for list/form/detail/timeline pages. */
67
+ entityKey?: string;
68
+ /** list: subset of field keys shown as columns. */
69
+ columns?: string[];
70
+ /** form: subset of field keys included in the form. */
71
+ fields?: string[];
72
+ /** form: optional section layout grouping the page's fields. */
73
+ sections?: AppSection[];
74
+ /** dashboard: widgets rendered from the widget-data endpoint. */
75
+ widgets?: AppWidget[];
76
+ /** timeline: the declared date/datetime field records are ordered by (desc). */
77
+ dateField?: string;
78
+ /** related: key of the {@link AppLink} this page reverse-looks-up. */
79
+ linkKey?: string;
80
+ /**
81
+ * Custom-UI (Wave 12): an author-written code component that renders this page
82
+ * INSTEAD of the generic declarative renderer. Additive — absent ⇒ the page
83
+ * renders declaratively (today's behavior). A definition carrying any code
84
+ * component is compile-gated at publish (see {@link AppCodeComponent}).
85
+ */
86
+ component?: AppCodeComponent;
87
+ }
88
+
89
+ /**
90
+ * An INTRA-APP link: `fromEntity.refField` is a `reference` to `toEntity`. A
91
+ * `related` page on a detail of `toEntity` reverse-looks-up the `fromEntity`
92
+ * records whose `refField` equals the subject record's id. The lookup runs
93
+ * SERVER-SIDE, so the row policy always applies. Cross-owner links are NOT this
94
+ * shape.
95
+ */
96
+ export interface AppLink {
97
+ key: string;
98
+ fromEntity: string;
99
+ refField: string;
100
+ toEntity: string;
101
+ }
102
+
103
+ /** The declarative app definition — purely renderer-interpreted, no scripting. */
104
+ export interface AppDefinition {
105
+ entities: AppEntity[];
106
+ pages: AppPage[];
107
+ /** Ordered page slugs shown in the app's navigation. */
108
+ navigation: string[];
109
+ actions?: AppAction[];
110
+ automations?: AppAutomation[];
111
+ /** Intra-app relationships a `related` page reverse-looks-up. */
112
+ links?: AppLink[];
113
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Closed set of field types a declarative app entity supports. This is the
3
+ * single source of truth for BOTH the app-forge server (whose zod validation
4
+ * references it via `z.enum(AppFieldType)`) and the App Forge web renderer
5
+ * (whose view models type `AppField.type` with it). The values are stable wire
6
+ * strings that appear inside the opaque app-definition JSON — never compare
7
+ * against a free-form string.
8
+ */
9
+ export enum AppFieldType {
10
+ String = 'string',
11
+ Text = 'text',
12
+ /** Binary-float money-UNSAFE number → `DOUBLE PRECISION`. */
13
+ Number = 'number',
14
+ /** Exact fixed-point number (money-safe) → `NUMERIC(38,9)`. */
15
+ Decimal = 'decimal',
16
+ Boolean = 'boolean',
17
+ Date = 'date',
18
+ DateTime = 'datetime',
19
+ Enum = 'enum',
20
+ Reference = 'reference',
21
+ /** A subject id (e.g. `user:<id>`) → `TEXT` holding the ref. */
22
+ User = 'user',
23
+ /**
24
+ * A nested, embedded object — a fixed set of typed sub-fields stored inline in
25
+ * ONE record. Maps to a `JSONB` column; requires a `fields[]` sub-schema.
26
+ */
27
+ Object = 'object',
28
+ /**
29
+ * A REPEATABLE list of typed objects — an array of `Object`-shaped items stored
30
+ * inline in ONE record. Requires a `fields[]` item sub-schema; carries an
31
+ * optional `minItems`/`maxItems` count bound. Maps to a `JSONB` column.
32
+ */
33
+ List = 'list',
34
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Closed set of page kinds the generic App Forge renderer knows how to draw.
3
+ * Lives inside the opaque app-definition JSON; shared by the server's zod
4
+ * schema and the web renderer's `AppPage.kind` view model. Stable wire strings.
5
+ */
6
+ export enum AppPageKind {
7
+ List = 'list',
8
+ Form = 'form',
9
+ Detail = 'detail',
10
+ Dashboard = 'dashboard',
11
+ /**
12
+ * A chronological view of ONE entity's records ordered by a declared
13
+ * `date`/`datetime` field (desc by default), sorted SERVER-SIDE inside the
14
+ * authorization fence.
15
+ */
16
+ Timeline = 'timeline',
17
+ /**
18
+ * A reverse-reference view: on a detail context (a record of entity A), the
19
+ * records of entity B that REFERENCE that record through a declared link. The
20
+ * lookup is a server-side `eq` filter on the ref field, permission-filtered by
21
+ * the row policy.
22
+ */
23
+ Related = 'related',
24
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Dashboard-widget closed vocabulary + the widget view models the App Forge
3
+ * renderer interprets from the opaque app-definition JSON. Shared by the
4
+ * app-forge server's zod schema and the web renderer. All values are stable
5
+ * wire strings — never compare against a free-form string.
6
+ */
7
+ import { AppCodeComponent } from './component';
8
+
9
+ /** Closed set of dashboard widget kinds. */
10
+ export enum AppWidgetKind {
11
+ Stat = 'stat',
12
+ Table = 'table',
13
+ /**
14
+ * A chart of a server-side group-by SERIES. Its render shape is a chart
15
+ * ({@link AppChartType}); its data source is an {@link AppWidgetSeriesSource}
16
+ * group-by aggregation resolved INSIDE the authorization fence.
17
+ */
18
+ Chart = 'chart',
19
+ }
20
+
21
+ /**
22
+ * Closed discriminator for a widget's DATA SOURCE. A widget draws from an
23
+ * ENTITY (a server-side count over the app's own store), a CAPABILITY (a
24
+ * governed capability query), or a SERIES (an entity group-by → a chart).
25
+ * Exactly one.
26
+ */
27
+ export enum AppWidgetSourceKind {
28
+ Entity = 'entity',
29
+ Capability = 'capability',
30
+ Series = 'series',
31
+ }
32
+
33
+ /** Closed set of server-side entity-widget aggregations (phase 1: count only). */
34
+ export enum AppWidgetAggregate {
35
+ Count = 'count',
36
+ }
37
+
38
+ /**
39
+ * Closed set of chart render shapes a series (chart) widget may declare. Maps
40
+ * 1:1 onto the kernel `@xemahq/ui-kernel/ui` chart primitives (BarChart /
41
+ * LineChart / DonutChart).
42
+ */
43
+ export enum AppChartType {
44
+ Bar = 'bar',
45
+ Line = 'line',
46
+ Donut = 'donut',
47
+ }
48
+
49
+ /**
50
+ * Closed set of series (group-by) aggregation measures. `count` counts the
51
+ * policy-visible rows per group; `sum` sums a numeric/decimal field per group.
52
+ */
53
+ export enum AppSeriesAggregateKind {
54
+ Count = 'count',
55
+ Sum = 'sum',
56
+ }
57
+
58
+ /**
59
+ * A series (chart) widget's group-by aggregation. `count` counts the
60
+ * policy-visible rows per group; `sum` sums a numeric field per group.
61
+ */
62
+ export type AppSeriesAggregate =
63
+ | { kind: AppSeriesAggregateKind.Count }
64
+ | { kind: AppSeriesAggregateKind.Sum; field: string };
65
+
66
+ /**
67
+ * The SERIES source of a chart widget: a server-side group-by aggregation over
68
+ * an entity, resolved inside the authorization fence. Lives inside the opaque
69
+ * definition JSON.
70
+ */
71
+ export interface AppWidgetSeriesSource {
72
+ entityKey: string;
73
+ /** The field whose distinct values become the chart buckets. */
74
+ groupBy: string;
75
+ aggregate: AppSeriesAggregate;
76
+ chartType: AppChartType;
77
+ }
78
+
79
+ /**
80
+ * One dashboard widget as authored in the definition. Exactly one data source:
81
+ * an entity source (`entityKey` + optional `aggregate`/`filter`), a capability
82
+ * source (out of the renderer view model — resolved server-side), or a series
83
+ * source (`series`, rendered as a chart).
84
+ */
85
+ export interface AppWidget {
86
+ kind: AppWidgetKind;
87
+ title: string;
88
+ /**
89
+ * Entity source — present for stat/table widgets. Absent for a chart widget
90
+ * (whose entity lives on {@link series}) and a capability widget.
91
+ */
92
+ entityKey?: string;
93
+ aggregate?: AppWidgetAggregate;
94
+ /** Simple equals filter: field key → required value. */
95
+ filter?: Record<string, string | number | boolean>;
96
+ /** Series (chart) source — present iff `kind === AppWidgetKind.Chart`. */
97
+ series?: AppWidgetSeriesSource;
98
+ /**
99
+ * Custom-UI (Wave 12): an author-written code component that renders this
100
+ * widget INSTEAD of the generic declarative widget renderer. Additive — absent
101
+ * ⇒ the widget renders declaratively (today's behavior). Compile-gated at
102
+ * publish (see {@link AppCodeComponent}).
103
+ */
104
+ component?: AppCodeComponent;
105
+ }