@di-framework/cli-plugin-platform 6.0.3 → 6.0.5

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 (69) hide show
  1. package/README.md +196 -21
  2. package/dist/args.d.ts +2 -1
  3. package/dist/args.js +9 -5
  4. package/dist/assets/http-adapter.js +63 -0
  5. package/dist/assets/platform/README.md +22 -6
  6. package/dist/assets/sqlite/BUILD-INFO.txt +1 -1
  7. package/dist/assets/wit/deps/wasi-clocks-0.2.12/package.wit +43 -0
  8. package/dist/assets/wit/deps/wasi-filesystem-0.2.12/package.wit +196 -0
  9. package/dist/assets/wit/deps/wasi-io-0.2.12/package.wit +66 -0
  10. package/dist/assets/wit/deps/wasi-logging/package.wit +36 -0
  11. package/dist/build.d.ts +3 -1
  12. package/dist/build.js +4 -2
  13. package/dist/command.js +31 -13
  14. package/dist/console/auth.d.ts +20 -0
  15. package/dist/console/auth.js +82 -0
  16. package/dist/console/catalog.d.ts +196 -0
  17. package/dist/console/catalog.js +821 -0
  18. package/dist/console/cluster.d.ts +30 -0
  19. package/dist/console/cluster.js +299 -0
  20. package/dist/console/errors.d.ts +10 -0
  21. package/dist/console/errors.js +32 -0
  22. package/dist/console/run.d.ts +18 -0
  23. package/dist/console/run.js +102 -0
  24. package/dist/console/server.d.ts +25 -0
  25. package/dist/console/server.js +668 -0
  26. package/dist/console/services.d.ts +47 -0
  27. package/dist/console/services.js +111 -0
  28. package/dist/console-ui/app.css +1 -0
  29. package/dist/console-ui/app.js +260 -0
  30. package/dist/console-ui/di-framework-mark.png +0 -0
  31. package/dist/console-ui/index.html +13 -0
  32. package/dist/deps.d.ts +2 -0
  33. package/dist/deps.js +5 -3
  34. package/dist/dev.js +10 -5
  35. package/dist/egress.d.ts +40 -0
  36. package/dist/egress.js +214 -0
  37. package/dist/host-interface.js +2 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.js +1 -0
  40. package/dist/manifest.d.ts +7 -0
  41. package/dist/manifest.js +35 -8
  42. package/dist/node-compat/console.d.ts +18 -0
  43. package/dist/node-compat/console.js +42 -0
  44. package/dist/node-compat/env.js +6 -0
  45. package/dist/node-compat/events.d.ts +20 -0
  46. package/dist/node-compat/events.js +55 -0
  47. package/dist/node-compat/fetch-runtime.d.ts +31 -0
  48. package/dist/node-compat/fetch-runtime.js +62 -0
  49. package/dist/node-compat/fs-promises.d.ts +30 -0
  50. package/dist/node-compat/fs-promises.js +3 -0
  51. package/dist/node-compat/fs.d.ts +79 -0
  52. package/dist/node-compat/fs.js +112 -5
  53. package/dist/node-compat/net.d.ts +2 -1
  54. package/dist/node-compat/net.js +3 -1
  55. package/dist/node-compat/storage.d.ts +87 -0
  56. package/dist/node-compat/storage.js +244 -0
  57. package/dist/node-compat/stream.d.ts +24 -0
  58. package/dist/node-compat/stream.js +70 -0
  59. package/dist/platform.js +2 -4
  60. package/dist/project.d.ts +5 -0
  61. package/dist/project.js +4 -0
  62. package/dist/service.d.ts +21 -2
  63. package/dist/service.js +71 -5
  64. package/dist/target.js +6 -1
  65. package/dist/wit.d.ts +8 -0
  66. package/dist/wit.js +28 -0
  67. package/dist/workload.d.ts +45 -0
  68. package/dist/workload.js +98 -26
  69. package/package.json +14 -4
@@ -0,0 +1,196 @@
1
+ export type JsonPatchOp = {
2
+ op: 'add' | 'replace' | 'remove';
3
+ path: string;
4
+ value?: unknown;
5
+ };
6
+ export type PartView = {
7
+ name: string;
8
+ kind: 'service' | 'component';
9
+ lifetime: 'long-lived' | 'on-demand';
10
+ /** Set when the host failed to start the part's current revision. */
11
+ failure?: string;
12
+ };
13
+ /**
14
+ * Newest host failure of one WorkloadDeployment, from the logs projection's `data.failures`.
15
+ * `workload` is the host workload name, `<currentReplicaSet name>-<suffix>`.
16
+ */
17
+ export type HostFailure = {
18
+ workload: string;
19
+ time: string;
20
+ level: 'WARN' | 'ERROR';
21
+ message: string;
22
+ };
23
+ /** Host failures by WorkloadDeployment name. */
24
+ export type HostFailures = ReadonlyMap<string, HostFailure>;
25
+ export type RouteView = {
26
+ id: string;
27
+ host: string;
28
+ path: string;
29
+ enabled: boolean;
30
+ /** Gateway address of an enabled route, when the platform publishes a route URL template. */
31
+ url?: string;
32
+ };
33
+ /** One variable on one part; the same name can be set on several parts. */
34
+ export type EnvView = {
35
+ key: string;
36
+ value: string;
37
+ part: string;
38
+ };
39
+ export type SecretView = {
40
+ name: string;
41
+ };
42
+ export type BackingBindingView = {
43
+ name: string;
44
+ service: string;
45
+ className: string;
46
+ ready: boolean;
47
+ detail?: string;
48
+ };
49
+ export type PrivateBindingView = {
50
+ name: string;
51
+ contract: string;
52
+ bound: boolean;
53
+ };
54
+ export type ApplicationSummary = {
55
+ name: string;
56
+ ready: boolean;
57
+ /** A part's current revision failed to start on the host. */
58
+ failed?: true;
59
+ detail?: string;
60
+ services: number;
61
+ components: number;
62
+ routeCount: number;
63
+ };
64
+ export type ApplicationView = ApplicationSummary & {
65
+ parts: PartView[];
66
+ routes: RouteView[];
67
+ environment: EnvView[];
68
+ secrets: SecretView[];
69
+ backingServices: BackingBindingView[];
70
+ privateBindings: PrivateBindingView[];
71
+ };
72
+ export type HostInterface = {
73
+ name?: string;
74
+ namespace?: string;
75
+ package?: string;
76
+ version?: string;
77
+ interfaces?: string[];
78
+ config?: Record<string, string>;
79
+ configFrom?: Array<{
80
+ name?: string;
81
+ }>;
82
+ secretFrom?: Array<{
83
+ name?: string;
84
+ }>;
85
+ };
86
+ export type WorkloadPart = {
87
+ name?: string;
88
+ image?: string;
89
+ service?: unknown;
90
+ localResources?: {
91
+ environment?: {
92
+ config?: Record<string, string>;
93
+ secretFrom?: Array<{
94
+ name?: string;
95
+ }>;
96
+ };
97
+ allowedIpNameLookups?: string[];
98
+ };
99
+ hostInterfaces?: HostInterface[];
100
+ };
101
+ export type WorkloadDocument = {
102
+ metadata?: {
103
+ name?: string;
104
+ namespace?: string;
105
+ labels?: Record<string, string>;
106
+ annotations?: Record<string, string>;
107
+ };
108
+ spec?: {
109
+ replicas?: number;
110
+ template?: {
111
+ spec?: {
112
+ hostSelector?: {
113
+ hostgroup?: string;
114
+ };
115
+ hostInterfaces?: HostInterface[];
116
+ components?: WorkloadPart[];
117
+ service?: WorkloadPart;
118
+ };
119
+ };
120
+ };
121
+ status?: {
122
+ readyReplicas?: number;
123
+ currentReplicaSet?: {
124
+ name?: string;
125
+ };
126
+ replicas?: {
127
+ ready?: number;
128
+ };
129
+ conditions?: Array<{
130
+ type?: string;
131
+ status?: string;
132
+ reason?: string;
133
+ message?: string;
134
+ }>;
135
+ };
136
+ };
137
+ export type BindingDocument = {
138
+ metadata?: {
139
+ name?: string;
140
+ labels?: Record<string, string>;
141
+ };
142
+ spec?: {
143
+ serviceName?: string;
144
+ bindingName?: string;
145
+ capability?: string;
146
+ workloadName?: string;
147
+ };
148
+ status?: {
149
+ conditions?: Array<{
150
+ type?: string;
151
+ status?: string;
152
+ message?: string;
153
+ }>;
154
+ };
155
+ };
156
+ export type WorkloadChange = {
157
+ workload: string;
158
+ ops: JsonPatchOp[];
159
+ };
160
+ export declare function assertResourceName(name: string, label: string): void;
161
+ export declare function isResourceName(name: string): boolean;
162
+ /** A tenant credential is one scope. Persistent workloads use the storage host group. */
163
+ export declare function workloadInTenantScope(document: WorkloadDocument, scope: {
164
+ namespace: string;
165
+ hostgroup?: string;
166
+ storageHostgroup?: string;
167
+ }): boolean;
168
+ export declare function tenantIdentity(hostgroup: string | undefined, target: string): {
169
+ tenant: string;
170
+ hostgroup?: string;
171
+ };
172
+ export declare function summarizeApplications(documents: readonly WorkloadDocument[], bindings?: readonly BindingDocument[], failures?: HostFailures): ApplicationView[];
173
+ export declare function toSummary(application: ApplicationView): ApplicationSummary;
174
+ /**
175
+ * A route's gateway address from the tenant's `di-platform-routes` URL template, e.g.
176
+ * `http://{host}.meshtastic.localhost:28180`. Undefined when the result is not an http(s) URL.
177
+ */
178
+ export declare function routeUrl(template: string, host: string, path: string): string | undefined;
179
+ /** Adds gateway links to the enabled routes. */
180
+ export declare function withRouteUrls(routes: readonly RouteView[], template: string | undefined): RouteView[];
181
+ /**
182
+ * wash rejects a wasi:http interface without `host` and keeps serving the old revision, so a route is
183
+ * never turned off by leaving that config empty. Turning off the primary host promotes the next alias.
184
+ * Turning off the last route removes the interface and remembers it in an annotation; turning a route
185
+ * on again restores it.
186
+ */
187
+ export declare function planRouteUpdate(documents: readonly WorkloadDocument[], routeId: string, enabled: boolean): WorkloadChange;
188
+ /** Sets a variable on the named part, or where it is already set, or on the first part. */
189
+ export declare function planEnvironmentSet(documents: readonly WorkloadDocument[], key: string, value: string, part?: string): WorkloadChange;
190
+ /** Removes a variable from the named part, or from the first part that sets it. */
191
+ export declare function planEnvironmentDelete(documents: readonly WorkloadDocument[], key: string, part?: string): WorkloadChange;
192
+ export declare function planSecretReassign(documents: readonly WorkloadDocument[], name: string, value: string): WorkloadChange | {
193
+ secret: string;
194
+ };
195
+ /** Names each binding's class from the bound BackingService (service name to class name). */
196
+ export declare function withServiceClasses(bindings: readonly BackingBindingView[], classes: ReadonlyMap<string, string>): BackingBindingView[];