@microservices-sh/sdk-internal 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.
Files changed (3) hide show
  1. package/package.json +27 -0
  2. package/src/index.d.ts +147 -0
  3. package/src/index.js +1588 -0
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@microservices-sh/sdk-internal",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.d.ts",
10
+ "import": "./src/index.js",
11
+ "default": "./src/index.js"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@microservices-sh/module-contract": "0.1.0"
16
+ },
17
+ "files": [
18
+ "src"
19
+ ],
20
+ "license": "MIT",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "build": "node --check src/index.js"
26
+ }
27
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,147 @@
1
+ import type { AppComposition, ModuleContract, TemplateContract } from "@microservices-sh/module-contract";
2
+
3
+ export interface SdkError {
4
+ code: string;
5
+ message: string;
6
+ remediation: string;
7
+ details: Record<string, unknown>;
8
+ }
9
+
10
+ export type SdkResponse<T> =
11
+ | { ok: true; requestId: string; data: T; warnings: string[] }
12
+ | { ok: false; requestId: string; error: SdkError };
13
+
14
+ export interface GeneratedFile {
15
+ path: string;
16
+ contents: string;
17
+ }
18
+
19
+ export interface GeneratedProject {
20
+ composition: AppComposition;
21
+ files: GeneratedFile[];
22
+ nextSteps: string[];
23
+ }
24
+
25
+ export interface CheckResult {
26
+ status: "pass" | "pending" | "fail";
27
+ checks: Array<{ id: string; status: "pass" | "pending" | "fail"; message: string }>;
28
+ }
29
+
30
+ export interface ModuleDocSummary {
31
+ id: string;
32
+ name: string;
33
+ status: string;
34
+ docPath: string;
35
+ summary: string;
36
+ approvalRisk: string;
37
+ }
38
+
39
+ export interface ModuleDoc {
40
+ id: string;
41
+ path: string;
42
+ markdown: string;
43
+ module: Record<string, unknown>;
44
+ }
45
+
46
+ export interface AddModulePlan {
47
+ module: Record<string, unknown>;
48
+ action: "already-installed" | "install" | "planned-install";
49
+ alreadyInstalled: boolean;
50
+ missingDependencies: string[];
51
+ approvalRequired: boolean;
52
+ requiredSecrets: string[];
53
+ requiredResources: string[];
54
+ requiredPermissions: string[];
55
+ filesLikelyTouched: string[];
56
+ nextSteps: string[];
57
+ }
58
+
59
+ export interface SecretStatus {
60
+ module: string;
61
+ name: string;
62
+ configured: boolean;
63
+ scope: string;
64
+ valueVisibleToAgent: boolean;
65
+ }
66
+
67
+ export interface UpdateCheck {
68
+ schemaVersion: string | null;
69
+ registryVersion: string;
70
+ template: Record<string, unknown> | null;
71
+ current: Array<{ id: string; currentVersion: string; latestVersion: string; status: "current" | "update-available" }>;
72
+ available: Array<{ id: string; currentVersion: string; latestVersion: string; status: "update-available" }>;
73
+ unavailable: Array<{ id: string; currentVersion: string; reason: string }>;
74
+ policy: Record<string, unknown>;
75
+ }
76
+
77
+ export interface ModuleUpgradePlan {
78
+ module: {
79
+ id: string;
80
+ name: string;
81
+ status: string;
82
+ currentVersion: string;
83
+ targetVersion: string;
84
+ };
85
+ action: "upgrade-plan" | "no-op";
86
+ upgradeAvailable: boolean;
87
+ approvalRequired: boolean;
88
+ risk: "low" | "medium" | "high";
89
+ lockfile: {
90
+ schemaVersion: string | null;
91
+ registryVersion: string;
92
+ template: Record<string, unknown> | null;
93
+ source: string | null;
94
+ checksum: string | null;
95
+ contractSnapshotAvailable: boolean;
96
+ };
97
+ diff: Record<string, unknown>;
98
+ customizationImpact: {
99
+ configPreserved: boolean;
100
+ hooksToReview: string[];
101
+ overlaysToReview: unknown[];
102
+ forksToReview: unknown[];
103
+ };
104
+ filesLikelyTouched: string[];
105
+ permissionGate: {
106
+ required: boolean;
107
+ reasons: string[];
108
+ };
109
+ nextSteps: string[];
110
+ }
111
+
112
+ export function listTemplates(): SdkResponse<Array<Pick<TemplateContract, "id" | "name" | "version" | "status" | "summary" | "defaultModules" | "optionalModules">>>;
113
+ export function inspectTemplate(id: string): SdkResponse<TemplateContract>;
114
+ export function listModules(): SdkResponse<Array<Pick<ModuleContract, "id" | "name" | "version" | "status" | "category" | "summary" | "requires"> & { mount: string }>>;
115
+ export function inspectModule(id: string): SdkResponse<ModuleContract>;
116
+ export function listModuleDocs(): SdkResponse<ModuleDocSummary[]>;
117
+ export function getModuleDoc(id: string): SdkResponse<ModuleDoc>;
118
+ export function planAddModule(input?: Record<string, unknown> | string): SdkResponse<AddModulePlan>;
119
+ export function getSecretsStatus(input?: Record<string, unknown>): SdkResponse<{ secrets: SecretStatus[] }>;
120
+ export function checkUpdates(input?: Record<string, unknown>): SdkResponse<UpdateCheck>;
121
+ export function planModuleUpgrade(input?: Record<string, unknown> | string): SdkResponse<ModuleUpgradePlan>;
122
+ export function composeApp(input?: Record<string, unknown> | string): SdkResponse<AppComposition>;
123
+ export function validateConfig(input?: Record<string, unknown>): SdkResponse<{
124
+ valid: boolean;
125
+ warnings: string[];
126
+ requiredBindings: string[];
127
+ requiredStorage: string[];
128
+ customizationMode: string[];
129
+ }>;
130
+ export function generateProject(input?: Record<string, unknown>): SdkResponse<GeneratedProject>;
131
+ export function runChecks(input?: Record<string, unknown>): SdkResponse<CheckResult>;
132
+ export function createMicroservicesClient(): {
133
+ listTemplates: typeof listTemplates;
134
+ inspectTemplate: typeof inspectTemplate;
135
+ listModules: typeof listModules;
136
+ inspectModule: typeof inspectModule;
137
+ listModuleDocs: typeof listModuleDocs;
138
+ getModuleDoc: typeof getModuleDoc;
139
+ planAddModule: typeof planAddModule;
140
+ getSecretsStatus: typeof getSecretsStatus;
141
+ checkUpdates: typeof checkUpdates;
142
+ planModuleUpgrade: typeof planModuleUpgrade;
143
+ composeApp: typeof composeApp;
144
+ validateConfig: typeof validateConfig;
145
+ generateProject: typeof generateProject;
146
+ runChecks: typeof runChecks;
147
+ };