@niscorp/moss 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/DESIGN.md +77 -40
  3. package/DOCS.md +639 -81
  4. package/README.md +2 -2
  5. package/dist/{chunk-JYBHJDT7.cjs → chunk-C2DNDIQX.cjs} +5 -4
  6. package/dist/chunk-C2DNDIQX.cjs.map +1 -0
  7. package/dist/{chunk-BZK37HR3.cjs → chunk-DSTHFSTO.cjs} +1996 -1336
  8. package/dist/chunk-DSTHFSTO.cjs.map +1 -0
  9. package/dist/chunk-F45SFR7W.cjs +903 -0
  10. package/dist/chunk-F45SFR7W.cjs.map +1 -0
  11. package/dist/{chunk-PCPQMC7A.js → chunk-IMZZB4JE.js} +5 -4
  12. package/dist/chunk-IMZZB4JE.js.map +1 -0
  13. package/dist/{chunk-BQRPR2F7.js → chunk-MTC46PGQ.js} +1979 -1317
  14. package/dist/chunk-MTC46PGQ.js.map +1 -0
  15. package/dist/chunk-MYGVHWS5.js +870 -0
  16. package/dist/chunk-MYGVHWS5.js.map +1 -0
  17. package/dist/{chunk-FTZ6NFKZ.js → chunk-X2Q546EB.js} +3 -3
  18. package/dist/{chunk-FTZ6NFKZ.js.map → chunk-X2Q546EB.js.map} +1 -1
  19. package/dist/{chunk-5U2ZZUI5.cjs → chunk-Z2VA6AOE.cjs} +5 -5
  20. package/dist/{chunk-5U2ZZUI5.cjs.map → chunk-Z2VA6AOE.cjs.map} +1 -1
  21. package/dist/document-AbQUbQaP.d.ts +381 -0
  22. package/dist/document-wHHxIXJz.d.cts +381 -0
  23. package/dist/{index-BuDuOSyx.d.cts → index-Dml1klpZ.d.cts} +5 -1
  24. package/dist/{index-BuDuOSyx.d.ts → index-Dml1klpZ.d.ts} +5 -1
  25. package/dist/index.cjs +17 -17
  26. package/dist/index.d.cts +7 -9
  27. package/dist/index.d.ts +7 -9
  28. package/dist/index.js +3 -3
  29. package/dist/integrations.cjs +3 -3
  30. package/dist/integrations.d.cts +1 -1
  31. package/dist/integrations.d.ts +1 -1
  32. package/dist/integrations.js +1 -1
  33. package/dist/node.cjs +8 -8
  34. package/dist/node.d.cts +3 -4
  35. package/dist/node.d.ts +3 -4
  36. package/dist/node.js +4 -4
  37. package/dist/tide.d.cts +1 -1
  38. package/dist/tide.d.ts +1 -1
  39. package/dist/unverified.cjs +3 -3
  40. package/dist/unverified.js +2 -2
  41. package/dist/vite.cjs +9 -9
  42. package/dist/vite.d.cts +6 -1
  43. package/dist/vite.d.ts +6 -1
  44. package/dist/vite.js +4 -4
  45. package/package.json +13 -13
  46. package/dist/app-BoVB0_0j.d.ts +0 -143
  47. package/dist/app-Cc8VnOz8.d.cts +0 -143
  48. package/dist/chunk-BQRPR2F7.js.map +0 -1
  49. package/dist/chunk-BZK37HR3.cjs.map +0 -1
  50. package/dist/chunk-FTFME3HS.cjs +0 -383
  51. package/dist/chunk-FTFME3HS.cjs.map +0 -1
  52. package/dist/chunk-JYBHJDT7.cjs.map +0 -1
  53. package/dist/chunk-PCPQMC7A.js.map +0 -1
  54. package/dist/chunk-ZWB6QDGF.js +0 -374
  55. package/dist/chunk-ZWB6QDGF.js.map +0 -1
  56. package/dist/document-CU3muGbz.d.cts +0 -169
  57. package/dist/document-UFbAd-Ka.d.ts +0 -169
@@ -1,169 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { VerifyReport } from '@niscorp/charter';
3
- import { Shell, RenderNode, ActionDefinition } from '@niscorp/nova';
4
- import { ScopePolicy } from '@niscorp/vex';
5
- import { S as SocketAccept } from './socket-D90h1xSV.js';
6
- import { ScreenHead } from '@niscorp/nova/document';
7
-
8
- type IdentityReport = {
9
- principal: string;
10
- since: number;
11
- lastSeen: number;
12
- };
13
- type IdentityRecord = {
14
- roles: readonly string[];
15
- scope: Record<string, unknown>;
16
- installed?: readonly string[];
17
- tag?: string;
18
- };
19
-
20
- type ResolvedIdentity = {
21
- roles: readonly string[];
22
- scope: Record<string, unknown>;
23
- installed: readonly string[] | undefined;
24
- memoKey: string;
25
- record?: IdentityRecord;
26
- };
27
-
28
- type Catalog = {
29
- ids: readonly string[];
30
- hash: string;
31
- };
32
-
33
- type ExecuteAs = (role: string, fingerprint: string, context: Record<string, unknown>, scope?: Record<string, unknown>) => Promise<unknown>;
34
-
35
- type ShellConnection = {
36
- send: (text: string) => void;
37
- close: (code?: number, reason?: string) => void;
38
- seal?: (token: string) => Promise<string>;
39
- };
40
- type ShellSession = {
41
- readonly shell: Shell;
42
- attach: (connection: ShellConnection, options?: {
43
- delta?: boolean;
44
- }) => void;
45
- detach: (connection: ShellConnection) => void;
46
- resync: (connection: ShellConnection) => void;
47
- dispatch: (canvas: string, event: Record<string, unknown>) => void;
48
- publish: (channel: string, payload?: unknown) => void;
49
- back: () => boolean;
50
- popTo: (canvas: string, instance: string) => void;
51
- reset: () => void;
52
- };
53
- type ShellReport = {
54
- principal: string;
55
- connections: number;
56
- since: number;
57
- idleSince: number | null;
58
- canvases: {
59
- id: string;
60
- actions: readonly string[];
61
- }[];
62
- };
63
- type ShellSnapshot = {
64
- frame: RenderNode[];
65
- trees: Record<string, RenderNode[]>;
66
- seed?: string;
67
- settled: boolean;
68
- live: boolean;
69
- why: string[];
70
- drawnWith: string[];
71
- };
72
- type ShellOpening = {
73
- seed?: string;
74
- inputs?: Record<string, Record<string, unknown>>;
75
- };
76
- type ShellHost = {
77
- session: (token: string | null, principal: string | null, options?: ShellOpening) => Promise<ShellSession>;
78
- snapshot: (token: string | null, principal: string | null, options?: {
79
- waitMs?: number;
80
- inputs?: ShellOpening['inputs'];
81
- }) => Promise<ShellSnapshot>;
82
- deliver: (principal: string, channel: string, payload?: unknown) => boolean;
83
- list: () => ShellReport[];
84
- reset: (principal: string) => boolean;
85
- };
86
-
87
- type Env = {
88
- Variables: {
89
- principal: string | null;
90
- resolved: ResolvedIdentity;
91
- };
92
- };
93
- type MossServer = Hono<Env> & {
94
- socket: SocketAccept;
95
- shells?: ShellHost;
96
- principalOf: (token: string) => Promise<string | null>;
97
- page: (path: string) => {
98
- name: string;
99
- host: ShellHost;
100
- inputs: Record<string, Record<string, unknown>>;
101
- } | undefined;
102
- pages: readonly {
103
- name: string;
104
- path: string;
105
- }[];
106
- refresh: () => void;
107
- replaceActions: (source: string, actions: Record<string, ActionDefinition>) => void;
108
- actions: () => Readonly<Record<string, ActionDefinition>>;
109
- catalogOf: (principal: string | null) => Promise<Catalog>;
110
- policyForRoles: (roles: readonly string[]) => ScopePolicy;
111
- charterReport: () => VerifyReport;
112
- invalidateIdentity: (principal: string) => boolean;
113
- identity: (principal: string | null) => Promise<IdentityRecord>;
114
- executeAs: ExecuteAs;
115
- invalidateTenant: (tag: string) => number;
116
- nudge: (principal: string, channel: string) => void;
117
- close: () => void;
118
- identities?: {
119
- list: () => IdentityReport[];
120
- meter: () => {
121
- size: number;
122
- max: number;
123
- resolved: number;
124
- evicted: number;
125
- expired: number;
126
- };
127
- };
128
- };
129
-
130
- type DocumentHost = Pick<ShellHost, 'snapshot'>;
131
- type DocumentSource = {
132
- principalOf: (token: string) => Promise<string | null>;
133
- page: (path: string) => {
134
- name: string;
135
- host: DocumentHost;
136
- inputs: Record<string, Record<string, unknown>>;
137
- } | undefined;
138
- shells?: DocumentHost;
139
- };
140
- type DocumentConfig = {
141
- server: DocumentSource;
142
- template: string;
143
- request: {
144
- path: string;
145
- cookie?: string | null;
146
- host?: string | null;
147
- };
148
- draw: (snapshot: ShellSnapshot) => string | Promise<string>;
149
- htmlAttributes?: (snapshot: ShellSnapshot) => Record<string, string>;
150
- site?: string;
151
- tokenKey?: string;
152
- waitMs?: number;
153
- root?: string;
154
- };
155
- type DrawnDocument = {
156
- html: string;
157
- headers: Record<string, string>;
158
- drawn: boolean;
159
- principal: string | null;
160
- page?: string;
161
- head?: ScreenHead;
162
- live?: boolean;
163
- why?: string[];
164
- drawnWith?: string[];
165
- settled?: boolean;
166
- };
167
- declare const renderDocument: (config: DocumentConfig) => Promise<DrawnDocument>;
168
-
169
- export { type DocumentConfig as D, type ExecuteAs as E, type IdentityRecord as I, type MossServer as M, type ShellHost as S, type DrawnDocument as a, type ShellSnapshot as b, renderDocument as r };