@rafads/config 1.5.38
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/config.test.d.ts +2 -0
- package/dist/config.test.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +368 -0
- package/dist/index.js.map +1 -0
- package/dist/load-plugins.d.ts +27 -0
- package/dist/load-plugins.d.ts.map +1 -0
- package/dist/load-plugins.test.d.ts +2 -0
- package/dist/load-plugins.test.d.ts.map +1 -0
- package/dist/load.d.ts +17 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/schema.d.ts +235 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/sink.d.ts +23 -0
- package/dist/sink.d.ts.map +1 -0
- package/dist/write.d.ts +36 -0
- package/dist/write.d.ts.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../src/config.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ExecutorFileConfig, PluginConfig, IntegrationConfig, OpenApiIntegrationConfig, GraphqlIntegrationConfig, McpRemoteIntegrationConfig, McpStdioIntegrationConfig, McpAuthConfig, SecretMetadata, ConfigHeaderValue, SECRET_REF_PREFIX, } from "./schema";
|
|
2
|
+
export { loadConfig, ConfigParseError } from "./load";
|
|
3
|
+
export { loadPluginsFromJsonc } from "./load-plugins";
|
|
4
|
+
export type { LoadPluginsFromJsoncOptions } from "./load-plugins";
|
|
5
|
+
export { addIntegrationToConfig, removeIntegrationFromConfig, writeConfig, addSecretToConfig, removeSecretFromConfig, } from "./write";
|
|
6
|
+
export type { ConfigFileSink, ConfigFileSinkOptions } from "./sink";
|
|
7
|
+
export { makeFileConfigSink, headerToConfigValue, headersToConfigValues } from "./sink";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
// src/schema.ts
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
var SECRET_REF_PREFIX = "secret-public-ref:";
|
|
4
|
+
var ConfigHeaderValue = Schema.Union([
|
|
5
|
+
Schema.String,
|
|
6
|
+
Schema.Struct({
|
|
7
|
+
value: Schema.String,
|
|
8
|
+
prefix: Schema.optional(Schema.String)
|
|
9
|
+
})
|
|
10
|
+
]);
|
|
11
|
+
var ConfigHeaders = Schema.Record(Schema.String, ConfigHeaderValue);
|
|
12
|
+
var OpenApiIntegrationConfig = Schema.Struct({
|
|
13
|
+
kind: Schema.Literal("openapi"),
|
|
14
|
+
spec: Schema.String,
|
|
15
|
+
baseUrl: Schema.optional(Schema.String),
|
|
16
|
+
namespace: Schema.optional(Schema.String),
|
|
17
|
+
headers: Schema.optional(ConfigHeaders)
|
|
18
|
+
});
|
|
19
|
+
var GraphqlIntegrationConfig = Schema.Struct({
|
|
20
|
+
kind: Schema.Literal("graphql"),
|
|
21
|
+
endpoint: Schema.String,
|
|
22
|
+
introspectionJson: Schema.optional(Schema.NullOr(Schema.String)),
|
|
23
|
+
namespace: Schema.optional(Schema.String),
|
|
24
|
+
headers: Schema.optional(ConfigHeaders)
|
|
25
|
+
});
|
|
26
|
+
var StringMap = Schema.Record(Schema.String, Schema.String);
|
|
27
|
+
var McpAuthConfig = Schema.Union([
|
|
28
|
+
Schema.Struct({ kind: Schema.Literal("none") }),
|
|
29
|
+
Schema.Struct({
|
|
30
|
+
kind: Schema.Literal("header"),
|
|
31
|
+
headerName: Schema.String,
|
|
32
|
+
secret: Schema.String,
|
|
33
|
+
prefix: Schema.optional(Schema.String)
|
|
34
|
+
}),
|
|
35
|
+
Schema.Struct({
|
|
36
|
+
kind: Schema.Literal("oauth2"),
|
|
37
|
+
/** Stable id of the SDK Connection holding access + refresh token
|
|
38
|
+
* material. The connection names its owner explicitly (org or user),
|
|
39
|
+
* so the id resolves to exactly one connection — no scope stack, no
|
|
40
|
+
* per-user shadowing. Core resolves its value (refreshing oauth
|
|
41
|
+
* tokens) at execute time via the connection's provider. */
|
|
42
|
+
connectionId: Schema.String
|
|
43
|
+
})
|
|
44
|
+
]);
|
|
45
|
+
var McpRemoteIntegrationConfig = Schema.Struct({
|
|
46
|
+
kind: Schema.Literal("mcp"),
|
|
47
|
+
transport: Schema.Literal("remote"),
|
|
48
|
+
name: Schema.String,
|
|
49
|
+
endpoint: Schema.String,
|
|
50
|
+
remoteTransport: Schema.optional(Schema.Literals(["streamable-http", "sse", "auto"])),
|
|
51
|
+
namespace: Schema.optional(Schema.String),
|
|
52
|
+
queryParams: Schema.optional(ConfigHeaders),
|
|
53
|
+
headers: Schema.optional(ConfigHeaders),
|
|
54
|
+
auth: Schema.optional(McpAuthConfig)
|
|
55
|
+
});
|
|
56
|
+
var McpStdioIntegrationConfig = Schema.Struct({
|
|
57
|
+
kind: Schema.Literal("mcp"),
|
|
58
|
+
transport: Schema.Literal("stdio"),
|
|
59
|
+
name: Schema.String,
|
|
60
|
+
command: Schema.String,
|
|
61
|
+
args: Schema.optional(Schema.Array(Schema.String)),
|
|
62
|
+
env: Schema.optional(StringMap),
|
|
63
|
+
cwd: Schema.optional(Schema.String),
|
|
64
|
+
namespace: Schema.optional(Schema.String)
|
|
65
|
+
});
|
|
66
|
+
var IntegrationConfig = Schema.Union([
|
|
67
|
+
OpenApiIntegrationConfig,
|
|
68
|
+
GraphqlIntegrationConfig,
|
|
69
|
+
McpRemoteIntegrationConfig,
|
|
70
|
+
McpStdioIntegrationConfig
|
|
71
|
+
]);
|
|
72
|
+
var SecretMetadata = Schema.Struct({
|
|
73
|
+
name: Schema.String,
|
|
74
|
+
provider: Schema.optional(Schema.String),
|
|
75
|
+
purpose: Schema.optional(Schema.String)
|
|
76
|
+
});
|
|
77
|
+
var PluginConfig = Schema.Struct({
|
|
78
|
+
package: Schema.String,
|
|
79
|
+
options: Schema.optional(Schema.Record(Schema.String, Schema.Unknown))
|
|
80
|
+
});
|
|
81
|
+
var ExecutorFileConfig = Schema.Struct({
|
|
82
|
+
$schema: Schema.optional(Schema.String),
|
|
83
|
+
name: Schema.optional(Schema.String),
|
|
84
|
+
plugins: Schema.optional(Schema.Array(PluginConfig)),
|
|
85
|
+
integrations: Schema.optional(Schema.Array(IntegrationConfig)),
|
|
86
|
+
secrets: Schema.optional(Schema.Record(Schema.String, SecretMetadata))
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/load.ts
|
|
90
|
+
import { Effect, Schema as Schema2 } from "effect";
|
|
91
|
+
import { FileSystem } from "effect";
|
|
92
|
+
import * as jsonc from "jsonc-parser";
|
|
93
|
+
var ConfigParseError = class extends Schema2.TaggedErrorClass()(
|
|
94
|
+
"ConfigParseError",
|
|
95
|
+
{
|
|
96
|
+
path: Schema2.String,
|
|
97
|
+
message: Schema2.String
|
|
98
|
+
}
|
|
99
|
+
) {
|
|
100
|
+
};
|
|
101
|
+
var loadConfig = (path) => Effect.gen(function* () {
|
|
102
|
+
const fs2 = yield* FileSystem.FileSystem;
|
|
103
|
+
const exists = yield* fs2.exists(path);
|
|
104
|
+
if (!exists) return null;
|
|
105
|
+
const raw = yield* fs2.readFileString(path);
|
|
106
|
+
const errors = [];
|
|
107
|
+
const parsed = jsonc.parse(raw, errors);
|
|
108
|
+
if (errors.length > 0) {
|
|
109
|
+
const msg = errors.map((e) => `offset ${e.offset}: ${jsonc.printParseErrorCode(e.error)}`).join("; ");
|
|
110
|
+
return yield* new ConfigParseError({ path, message: msg });
|
|
111
|
+
}
|
|
112
|
+
const decoded = yield* Schema2.decodeUnknownEffect(ExecutorFileConfig)(parsed).pipe(
|
|
113
|
+
Effect.mapError(
|
|
114
|
+
(error) => new ConfigParseError({
|
|
115
|
+
path,
|
|
116
|
+
message: error.issue.toString()
|
|
117
|
+
})
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
return decoded;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// src/load-plugins.ts
|
|
124
|
+
import { createRequire } from "module";
|
|
125
|
+
import { dirname, isAbsolute, resolve as resolvePath } from "path";
|
|
126
|
+
import { pathToFileURL } from "url";
|
|
127
|
+
import * as fs from "fs";
|
|
128
|
+
import * as jsonc2 from "jsonc-parser";
|
|
129
|
+
import { Effect as Effect2, Schema as Schema3 } from "effect";
|
|
130
|
+
var LoadPluginsError = class extends Schema3.TaggedErrorClass()(
|
|
131
|
+
"LoadPluginsError",
|
|
132
|
+
{
|
|
133
|
+
message: Schema3.String,
|
|
134
|
+
cause: Schema3.optional(Schema3.Unknown)
|
|
135
|
+
}
|
|
136
|
+
) {
|
|
137
|
+
};
|
|
138
|
+
var loadPluginsFromJsonc = async (options) => Effect2.runPromise(loadPluginsFromJsoncEffect(options));
|
|
139
|
+
var loadPluginsFromJsoncEffect = (options) => Effect2.gen(function* () {
|
|
140
|
+
const { path, deps } = options;
|
|
141
|
+
if (!fs.existsSync(path)) return null;
|
|
142
|
+
const raw = fs.readFileSync(path, "utf8");
|
|
143
|
+
const errors = [];
|
|
144
|
+
const parsed = jsonc2.parse(raw, errors);
|
|
145
|
+
if (errors.length > 0) {
|
|
146
|
+
const msg = errors.map((e) => `offset ${e.offset}: ${jsonc2.printParseErrorCode(e.error)}`).join("; ");
|
|
147
|
+
return yield* new LoadPluginsError({
|
|
148
|
+
message: `[load-plugins] failed to parse ${path}: ${msg}`
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const config = yield* Schema3.decodeUnknownEffect(ExecutorFileConfig)(parsed).pipe(
|
|
152
|
+
Effect2.mapError(
|
|
153
|
+
(error) => new LoadPluginsError({
|
|
154
|
+
message: `[load-plugins] failed to decode ${path}: ${error.issue.toString()}`,
|
|
155
|
+
cause: error
|
|
156
|
+
})
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
const entries = config.plugins ?? null;
|
|
160
|
+
if (!entries || entries.length === 0) return null;
|
|
161
|
+
const { createJiti } = yield* Effect2.tryPromise({
|
|
162
|
+
try: () => import("jiti"),
|
|
163
|
+
catch: (cause) => new LoadPluginsError({
|
|
164
|
+
message: `[load-plugins] failed to import jiti.`,
|
|
165
|
+
cause
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
const jiti = createJiti(pathToFileURL(path).href, {
|
|
169
|
+
interopDefault: true,
|
|
170
|
+
moduleCache: false
|
|
171
|
+
});
|
|
172
|
+
const fromDir = dirname(path);
|
|
173
|
+
const require2 = createRequire(isAbsolute(path) ? path : resolvePath(fromDir, "_anchor.js"));
|
|
174
|
+
const loaded = [];
|
|
175
|
+
for (const entry of entries) {
|
|
176
|
+
const serverEntry = `${entry.package}/server`;
|
|
177
|
+
const resolved = yield* Effect2.try({
|
|
178
|
+
try: () => require2.resolve(serverEntry),
|
|
179
|
+
catch: (cause) => new LoadPluginsError({
|
|
180
|
+
message: `[load-plugins] cannot resolve "${serverEntry}" from ${fromDir}. Is "${entry.package}" installed and does it export "./server"?`,
|
|
181
|
+
cause
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
const mod = yield* Effect2.tryPromise({
|
|
185
|
+
try: () => jiti.import(resolved),
|
|
186
|
+
catch: (cause) => new LoadPluginsError({
|
|
187
|
+
message: `[load-plugins] failed to import "${serverEntry}" from ${resolved}.`,
|
|
188
|
+
cause
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
const factory = typeof mod === "function" ? mod : mod.default ?? null;
|
|
192
|
+
if (!factory || typeof factory !== "function") {
|
|
193
|
+
return yield* new LoadPluginsError({
|
|
194
|
+
message: `[load-plugins] "${serverEntry}" did not export a default definePlugin(...) factory.`
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const merged = { ...deps ?? {}, ...entry.options ?? {} };
|
|
198
|
+
loaded.push(factory(merged));
|
|
199
|
+
}
|
|
200
|
+
return loaded;
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// src/write.ts
|
|
204
|
+
import { Effect as Effect3 } from "effect";
|
|
205
|
+
import { FileSystem as FileSystem2 } from "effect";
|
|
206
|
+
import * as jsonc3 from "jsonc-parser";
|
|
207
|
+
var ConfigWriteError = class {
|
|
208
|
+
constructor(path, cause) {
|
|
209
|
+
this.path = path;
|
|
210
|
+
this.cause = cause;
|
|
211
|
+
}
|
|
212
|
+
path;
|
|
213
|
+
cause;
|
|
214
|
+
_tag = "ConfigWriteError";
|
|
215
|
+
};
|
|
216
|
+
var FORMATTING = {
|
|
217
|
+
tabSize: 2,
|
|
218
|
+
insertSpaces: true,
|
|
219
|
+
eol: "\n"
|
|
220
|
+
};
|
|
221
|
+
var DEFAULT_CONFIG = `{
|
|
222
|
+
"integrations": []
|
|
223
|
+
}
|
|
224
|
+
`;
|
|
225
|
+
var readOrCreate = (fs2, path) => Effect3.gen(function* () {
|
|
226
|
+
const exists = yield* fs2.exists(path);
|
|
227
|
+
if (exists) return yield* fs2.readFileString(path);
|
|
228
|
+
yield* fs2.writeFileString(path, DEFAULT_CONFIG);
|
|
229
|
+
return DEFAULT_CONFIG;
|
|
230
|
+
});
|
|
231
|
+
var addIntegrationToConfig = (path, integration) => Effect3.gen(function* () {
|
|
232
|
+
const fs2 = yield* FileSystem2.FileSystem;
|
|
233
|
+
let text = yield* readOrCreate(fs2, path);
|
|
234
|
+
let tree = jsonc3.parseTree(text);
|
|
235
|
+
let integrationsNode = tree ? jsonc3.findNodeAtLocation(tree, ["integrations"]) : void 0;
|
|
236
|
+
if (!integrationsNode) {
|
|
237
|
+
const edits = jsonc3.modify(text, ["integrations"], [integration], {
|
|
238
|
+
formattingOptions: FORMATTING
|
|
239
|
+
});
|
|
240
|
+
text = jsonc3.applyEdits(text, edits);
|
|
241
|
+
} else {
|
|
242
|
+
const ns = "namespace" in integration ? integration.namespace : void 0;
|
|
243
|
+
if (ns && integrationsNode.children) {
|
|
244
|
+
for (let i = integrationsNode.children.length - 1; i >= 0; i--) {
|
|
245
|
+
const child = integrationsNode.children[i];
|
|
246
|
+
const nsNode = jsonc3.findNodeAtLocation(child, ["namespace"]);
|
|
247
|
+
if (nsNode && jsonc3.getNodeValue(nsNode) === ns) {
|
|
248
|
+
const edits2 = jsonc3.modify(text, ["integrations", i], void 0, {
|
|
249
|
+
formattingOptions: FORMATTING
|
|
250
|
+
});
|
|
251
|
+
text = jsonc3.applyEdits(text, edits2);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
tree = jsonc3.parseTree(text);
|
|
255
|
+
integrationsNode = tree ? jsonc3.findNodeAtLocation(tree, ["integrations"]) : void 0;
|
|
256
|
+
}
|
|
257
|
+
const count = integrationsNode?.children?.length ?? 0;
|
|
258
|
+
const edits = jsonc3.modify(text, ["integrations", count], integration, {
|
|
259
|
+
formattingOptions: FORMATTING
|
|
260
|
+
});
|
|
261
|
+
text = jsonc3.applyEdits(text, edits);
|
|
262
|
+
}
|
|
263
|
+
yield* fs2.writeFileString(path, text);
|
|
264
|
+
});
|
|
265
|
+
var removeIntegrationFromConfig = (path, namespace) => Effect3.gen(function* () {
|
|
266
|
+
const fs2 = yield* FileSystem2.FileSystem;
|
|
267
|
+
const exists = yield* fs2.exists(path);
|
|
268
|
+
if (!exists) return;
|
|
269
|
+
let text = yield* fs2.readFileString(path);
|
|
270
|
+
const tree = jsonc3.parseTree(text);
|
|
271
|
+
if (!tree) return;
|
|
272
|
+
const integrationsNode = jsonc3.findNodeAtLocation(tree, ["integrations"]);
|
|
273
|
+
if (!integrationsNode?.children) return;
|
|
274
|
+
for (let i = integrationsNode.children.length - 1; i >= 0; i--) {
|
|
275
|
+
const child = integrationsNode.children[i];
|
|
276
|
+
const nsNode = jsonc3.findNodeAtLocation(child, ["namespace"]);
|
|
277
|
+
if (nsNode && jsonc3.getNodeValue(nsNode) === namespace) {
|
|
278
|
+
const edits = jsonc3.modify(text, ["integrations", i], void 0, {
|
|
279
|
+
formattingOptions: FORMATTING
|
|
280
|
+
});
|
|
281
|
+
text = jsonc3.applyEdits(text, edits);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
yield* fs2.writeFileString(path, text);
|
|
285
|
+
});
|
|
286
|
+
var writeConfig = (path, config) => Effect3.gen(function* () {
|
|
287
|
+
const fs2 = yield* FileSystem2.FileSystem;
|
|
288
|
+
const text = yield* Effect3.try({
|
|
289
|
+
try: () => JSON.stringify(config, null, 2) + "\n",
|
|
290
|
+
catch: (cause) => new ConfigWriteError(path, cause)
|
|
291
|
+
});
|
|
292
|
+
yield* fs2.writeFileString(path, text);
|
|
293
|
+
});
|
|
294
|
+
var addSecretToConfig = (path, secretId, metadata) => Effect3.gen(function* () {
|
|
295
|
+
const fs2 = yield* FileSystem2.FileSystem;
|
|
296
|
+
let text = yield* readOrCreate(fs2, path);
|
|
297
|
+
const edits = jsonc3.modify(text, ["secrets", secretId], metadata, {
|
|
298
|
+
formattingOptions: FORMATTING
|
|
299
|
+
});
|
|
300
|
+
text = jsonc3.applyEdits(text, edits);
|
|
301
|
+
yield* fs2.writeFileString(path, text);
|
|
302
|
+
});
|
|
303
|
+
var removeSecretFromConfig = (path, secretId) => Effect3.gen(function* () {
|
|
304
|
+
const fs2 = yield* FileSystem2.FileSystem;
|
|
305
|
+
const exists = yield* fs2.exists(path);
|
|
306
|
+
if (!exists) return;
|
|
307
|
+
let text = yield* fs2.readFileString(path);
|
|
308
|
+
const edits = jsonc3.modify(text, ["secrets", secretId], void 0, {
|
|
309
|
+
formattingOptions: FORMATTING
|
|
310
|
+
});
|
|
311
|
+
text = jsonc3.applyEdits(text, edits);
|
|
312
|
+
yield* fs2.writeFileString(path, text);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// src/sink.ts
|
|
316
|
+
import { Effect as Effect4 } from "effect";
|
|
317
|
+
var headerToConfigValue = (value) => {
|
|
318
|
+
if (typeof value === "string") return value;
|
|
319
|
+
const ref = `${SECRET_REF_PREFIX}${value.secretId}`;
|
|
320
|
+
return value.prefix ? { value: ref, prefix: value.prefix } : ref;
|
|
321
|
+
};
|
|
322
|
+
var headersToConfigValues = (headers) => {
|
|
323
|
+
if (!headers) return void 0;
|
|
324
|
+
const out = {};
|
|
325
|
+
for (const [k, v] of Object.entries(headers)) out[k] = headerToConfigValue(v);
|
|
326
|
+
return out;
|
|
327
|
+
};
|
|
328
|
+
var defaultOnError = (op, err) => {
|
|
329
|
+
console.warn(`[config-sink] ${op} failed`, err);
|
|
330
|
+
};
|
|
331
|
+
var makeFileConfigSink = (options) => {
|
|
332
|
+
const { path, fsLayer, onError = defaultOnError } = options;
|
|
333
|
+
return {
|
|
334
|
+
upsertIntegration: (integration) => addIntegrationToConfig(path, integration).pipe(
|
|
335
|
+
Effect4.provide(fsLayer),
|
|
336
|
+
Effect4.catch((err) => Effect4.sync(() => onError("upsert", err)))
|
|
337
|
+
),
|
|
338
|
+
removeIntegration: (namespace) => removeIntegrationFromConfig(path, namespace).pipe(
|
|
339
|
+
Effect4.provide(fsLayer),
|
|
340
|
+
Effect4.catch((err) => Effect4.sync(() => onError("remove", err)))
|
|
341
|
+
)
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
export {
|
|
345
|
+
ConfigHeaderValue,
|
|
346
|
+
ConfigParseError,
|
|
347
|
+
ExecutorFileConfig,
|
|
348
|
+
GraphqlIntegrationConfig,
|
|
349
|
+
IntegrationConfig,
|
|
350
|
+
McpAuthConfig,
|
|
351
|
+
McpRemoteIntegrationConfig,
|
|
352
|
+
McpStdioIntegrationConfig,
|
|
353
|
+
OpenApiIntegrationConfig,
|
|
354
|
+
PluginConfig,
|
|
355
|
+
SECRET_REF_PREFIX,
|
|
356
|
+
SecretMetadata,
|
|
357
|
+
addIntegrationToConfig,
|
|
358
|
+
addSecretToConfig,
|
|
359
|
+
headerToConfigValue,
|
|
360
|
+
headersToConfigValues,
|
|
361
|
+
loadConfig,
|
|
362
|
+
loadPluginsFromJsonc,
|
|
363
|
+
makeFileConfigSink,
|
|
364
|
+
removeIntegrationFromConfig,
|
|
365
|
+
removeSecretFromConfig,
|
|
366
|
+
writeConfig
|
|
367
|
+
};
|
|
368
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts","../src/load.ts","../src/load-plugins.ts","../src/write.ts","../src/sink.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n// ---------------------------------------------------------------------------\n// Header values\n//\n// Three forms:\n// \"static-value\" — literal string\n// \"secret-public-ref:my-token\" — secret reference (no prefix)\n// { value: \"secret-public-ref:x\", prefix } — secret reference with prefix\n// ---------------------------------------------------------------------------\n\nexport const SECRET_REF_PREFIX = \"secret-public-ref:\";\n\nexport const ConfigHeaderValue = Schema.Union([\n Schema.String,\n Schema.Struct({\n value: Schema.String,\n prefix: Schema.optional(Schema.String),\n }),\n]);\nexport type ConfigHeaderValue = typeof ConfigHeaderValue.Type;\n\nconst ConfigHeaders = Schema.Record(Schema.String, ConfigHeaderValue);\n\n// ---------------------------------------------------------------------------\n// Integration configs — discriminated union on \"kind\"\n// ---------------------------------------------------------------------------\n\nexport const OpenApiIntegrationConfig = Schema.Struct({\n kind: Schema.Literal(\"openapi\"),\n spec: Schema.String,\n baseUrl: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(ConfigHeaders),\n});\nexport type OpenApiIntegrationConfig = typeof OpenApiIntegrationConfig.Type;\n\nexport const GraphqlIntegrationConfig = Schema.Struct({\n kind: Schema.Literal(\"graphql\"),\n endpoint: Schema.String,\n introspectionJson: Schema.optional(Schema.NullOr(Schema.String)),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(ConfigHeaders),\n});\nexport type GraphqlIntegrationConfig = typeof GraphqlIntegrationConfig.Type;\n\nconst StringMap = Schema.Record(Schema.String, Schema.String);\n\nexport const McpAuthConfig = Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"none\") }),\n Schema.Struct({\n kind: Schema.Literal(\"header\"),\n headerName: Schema.String,\n secret: Schema.String,\n prefix: Schema.optional(Schema.String),\n }),\n Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n /** Stable id of the SDK Connection holding access + refresh token\n * material. The connection names its owner explicitly (org or user),\n * so the id resolves to exactly one connection — no scope stack, no\n * per-user shadowing. Core resolves its value (refreshing oauth\n * tokens) at execute time via the connection's provider. */\n connectionId: Schema.String,\n }),\n]);\nexport type McpAuthConfig = typeof McpAuthConfig.Type;\n\nexport const McpRemoteIntegrationConfig = Schema.Struct({\n kind: Schema.Literal(\"mcp\"),\n transport: Schema.Literal(\"remote\"),\n name: Schema.String,\n endpoint: Schema.String,\n remoteTransport: Schema.optional(Schema.Literals([\"streamable-http\", \"sse\", \"auto\"])),\n namespace: Schema.optional(Schema.String),\n queryParams: Schema.optional(ConfigHeaders),\n headers: Schema.optional(ConfigHeaders),\n auth: Schema.optional(McpAuthConfig),\n});\nexport type McpRemoteIntegrationConfig = typeof McpRemoteIntegrationConfig.Type;\n\nexport const McpStdioIntegrationConfig = Schema.Struct({\n kind: Schema.Literal(\"mcp\"),\n transport: Schema.Literal(\"stdio\"),\n name: Schema.String,\n command: Schema.String,\n args: Schema.optional(Schema.Array(Schema.String)),\n env: Schema.optional(StringMap),\n cwd: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n});\nexport type McpStdioIntegrationConfig = typeof McpStdioIntegrationConfig.Type;\n\nexport const IntegrationConfig = Schema.Union([\n OpenApiIntegrationConfig,\n GraphqlIntegrationConfig,\n McpRemoteIntegrationConfig,\n McpStdioIntegrationConfig,\n]);\nexport type IntegrationConfig = typeof IntegrationConfig.Type;\n\n// ---------------------------------------------------------------------------\n// Secret metadata\n// ---------------------------------------------------------------------------\n\nexport const SecretMetadata = Schema.Struct({\n name: Schema.String,\n provider: Schema.optional(Schema.String),\n purpose: Schema.optional(Schema.String),\n});\nexport type SecretMetadata = typeof SecretMetadata.Type;\n\n// ---------------------------------------------------------------------------\n// Plugin manifest\n//\n// `plugins` is the install list. Each entry is a published npm package\n// that exports a `definePlugin(...)` factory under `./server`. The host\n// loads each at boot via jiti and calls the factory with merged\n// `options` plus host-injected deps (`configFile`, etc.). This is the\n// dynamic sibling of the static `executor.config.ts` plugin tuple — when\n// `plugins` is set, the host uses it; otherwise it falls back to the\n// statically-typed config.\n// ---------------------------------------------------------------------------\n\nexport const PluginConfig = Schema.Struct({\n package: Schema.String,\n options: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n});\nexport type PluginConfig = typeof PluginConfig.Type;\n\n// ---------------------------------------------------------------------------\n// Top-level config\n// ---------------------------------------------------------------------------\n\nexport const ExecutorFileConfig = Schema.Struct({\n $schema: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n plugins: Schema.optional(Schema.Array(PluginConfig)),\n integrations: Schema.optional(Schema.Array(IntegrationConfig)),\n secrets: Schema.optional(Schema.Record(Schema.String, SecretMetadata)),\n});\nexport type ExecutorFileConfig = typeof ExecutorFileConfig.Type;\n","import { Effect, Schema } from \"effect\";\nimport { FileSystem } from \"effect\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport * as jsonc from \"jsonc-parser\";\nimport { ExecutorFileConfig } from \"./schema\";\n\nexport class ConfigParseError extends Schema.TaggedErrorClass<ConfigParseError>()(\n \"ConfigParseError\",\n {\n path: Schema.String,\n message: Schema.String,\n },\n) {}\n\n/**\n * Load and validate an executor config file.\n * Returns null if the file doesn't exist.\n */\nexport const loadConfig = (\n path: string,\n): Effect.Effect<\n ExecutorFileConfig | null,\n ConfigParseError | PlatformError,\n FileSystem.FileSystem\n> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const exists = yield* fs.exists(path);\n if (!exists) return null;\n\n const raw = yield* fs.readFileString(path);\n\n const errors: jsonc.ParseError[] = [];\n const parsed = jsonc.parse(raw, errors);\n\n if (errors.length > 0) {\n const msg = errors\n .map((e) => `offset ${e.offset}: ${jsonc.printParseErrorCode(e.error)}`)\n .join(\"; \");\n return yield* new ConfigParseError({ path, message: msg });\n }\n\n const decoded = yield* Schema.decodeUnknownEffect(ExecutorFileConfig)(parsed).pipe(\n Effect.mapError(\n (error) =>\n new ConfigParseError({\n path,\n message: error.issue.toString(),\n }),\n ),\n );\n\n return decoded;\n });\n","// ---------------------------------------------------------------------------\n// loadPluginsFromJsonc — runtime plugin loader.\n//\n// Reads `executor.jsonc#plugins`, dynamically imports each package's\n// `./server` entry via jiti (so workspace TS sources work in dev and\n// published `dist/*.js` works after install), and calls the exported\n// `definePlugin(...)` factory with merged `options` plus host-injected\n// deps. Returns the resulting `Plugin[]` ready to hand to\n// `composePluginApi` / `createExecutor`.\n//\n// jiti is used instead of bare `import()` because:\n// - workspace plugins under monorepo dev expose `.ts` source via the\n// `bun` export condition; Node's loader can't read those directly,\n// jiti transpiles on the fly.\n// - in a published environment the package's `default` condition\n// points at `dist/*.js`, which jiti loads as a normal ESM module.\n//\n// The convention is: every plugin package exports a `./server` subpath\n// whose default export is a `ConfiguredPlugin` (the result of\n// `definePlugin(...)`). Calling that with `{ ...options, ...deps }`\n// returns a concrete `Plugin`.\n// ---------------------------------------------------------------------------\n\nimport { createRequire } from \"node:module\";\nimport { dirname, isAbsolute, resolve as resolvePath } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport * as fs from \"node:fs\";\nimport * as jsonc from \"jsonc-parser\";\nimport { Effect, Schema } from \"effect\";\n\nimport type { AnyPlugin } from \"@rafads/sdk\";\n\n// Plugins are invoked dynamically by name — exact author types are\n// unknown at the call site, so the loader treats every factory as\n// `(options?: unknown) => AnyPlugin`. The plugin author's types still\n// hold inside the plugin's own module; we just don't propagate them\n// across the runtime boundary.\ntype LooseConfiguredPlugin = (options?: Record<string, unknown>) => AnyPlugin;\n\nimport { ExecutorFileConfig } from \"./schema\";\n\nexport class LoadPluginsError extends Schema.TaggedErrorClass<LoadPluginsError>()(\n \"LoadPluginsError\",\n {\n message: Schema.String,\n cause: Schema.optional(Schema.Unknown),\n },\n) {}\n\nexport interface LoadPluginsFromJsoncOptions {\n /** Absolute path to `executor.jsonc` (or compatible). */\n readonly path: string;\n /**\n * Host-injected deps merged into each plugin's options. Common keys:\n * `configFile` (the `ConfigFileSink`), env-derived credentials, etc.\n * Plugins ignore deps they don't accept — `definePlugin` strips\n * unknown keys before forwarding to the author factory.\n */\n readonly deps?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Returns the plugins listed in jsonc, or `null` if the file is missing\n * or has no `plugins` array. The host treats `null` as \"fall back to\n * the static `executor.config.ts` factory.\"\n */\nexport const loadPluginsFromJsonc = async (\n options: LoadPluginsFromJsoncOptions,\n): Promise<readonly AnyPlugin[] | null> => Effect.runPromise(loadPluginsFromJsoncEffect(options));\n\nconst loadPluginsFromJsoncEffect = (\n options: LoadPluginsFromJsoncOptions,\n): Effect.Effect<readonly AnyPlugin[] | null, LoadPluginsError> =>\n Effect.gen(function* () {\n const { path, deps } = options;\n if (!fs.existsSync(path)) return null;\n\n const raw = fs.readFileSync(path, \"utf8\");\n const errors: jsonc.ParseError[] = [];\n const parsed = jsonc.parse(raw, errors);\n if (errors.length > 0) {\n const msg = errors\n .map((e) => `offset ${e.offset}: ${jsonc.printParseErrorCode(e.error)}`)\n .join(\"; \");\n return yield* new LoadPluginsError({\n message: `[load-plugins] failed to parse ${path}: ${msg}`,\n });\n }\n\n const config = yield* Schema.decodeUnknownEffect(ExecutorFileConfig)(parsed).pipe(\n Effect.mapError(\n (error) =>\n new LoadPluginsError({\n message: `[load-plugins] failed to decode ${path}: ${error.issue.toString()}`,\n cause: error,\n }),\n ),\n );\n\n const entries = config.plugins ?? null;\n if (!entries || entries.length === 0) return null;\n\n // jiti is created once per call; `moduleCache: false` ensures a\n // restart picks up freshly-installed packages without process restart\n // (relevant when the dev server kicks a reload after `executor plugin\n // install`).\n const { createJiti } = yield* Effect.tryPromise({\n try: () => import(\"jiti\"),\n catch: (cause) =>\n new LoadPluginsError({\n message: `[load-plugins] failed to import jiti.`,\n cause,\n }),\n });\n const jiti = createJiti(pathToFileURL(path).href, {\n interopDefault: true,\n moduleCache: false,\n });\n\n const fromDir = dirname(path);\n // require.resolve is anchored to the jsonc's directory so plugin\n // packages resolve from the host app's `node_modules` regardless of\n // CWD.\n const require = createRequire(isAbsolute(path) ? path : resolvePath(fromDir, \"_anchor.js\"));\n\n const loaded: AnyPlugin[] = [];\n for (const entry of entries) {\n const serverEntry = `${entry.package}/server`;\n const resolved = yield* Effect.try({\n try: () => require.resolve(serverEntry),\n catch: (cause) =>\n new LoadPluginsError({\n message:\n `[load-plugins] cannot resolve \"${serverEntry}\" from ${fromDir}. ` +\n `Is \"${entry.package}\" installed and does it export \"./server\"?`,\n cause,\n }),\n });\n const mod = (yield* Effect.tryPromise({\n try: () => jiti.import(resolved),\n catch: (cause) =>\n new LoadPluginsError({\n message: `[load-plugins] failed to import \"${serverEntry}\" from ${resolved}.`,\n cause,\n }),\n })) as { default?: LooseConfiguredPlugin } | LooseConfiguredPlugin;\n const factory = (\n typeof mod === \"function\" ? mod : (mod.default ?? null)\n ) as LooseConfiguredPlugin | null;\n if (!factory || typeof factory !== \"function\") {\n return yield* new LoadPluginsError({\n message:\n `[load-plugins] \"${serverEntry}\" did not export a default ` +\n `definePlugin(...) factory.`,\n });\n }\n const merged = { ...(deps ?? {}), ...(entry.options ?? {}) };\n loaded.push(factory(merged));\n }\n\n return loaded;\n });\n","import { Effect } from \"effect\";\nimport { FileSystem } from \"effect\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport * as jsonc from \"jsonc-parser\";\nimport type { IntegrationConfig, ExecutorFileConfig } from \"./schema\";\n\nexport class ConfigWriteError {\n readonly _tag = \"ConfigWriteError\";\n constructor(\n readonly path: string,\n readonly cause: unknown,\n ) {}\n}\n\nconst FORMATTING: jsonc.FormattingOptions = {\n tabSize: 2,\n insertSpaces: true,\n eol: \"\\n\",\n};\n\nconst DEFAULT_CONFIG = `{\n \"integrations\": []\n}\n`;\n\n/** Read the raw JSONC text from a config file, or create a default one. */\nconst readOrCreate = (\n fs: FileSystem.FileSystem,\n path: string,\n): Effect.Effect<string, PlatformError> =>\n Effect.gen(function* () {\n const exists = yield* fs.exists(path);\n if (exists) return yield* fs.readFileString(path);\n yield* fs.writeFileString(path, DEFAULT_CONFIG);\n return DEFAULT_CONFIG;\n });\n\n/**\n * Add an integration entry to the config file. Creates the file if it doesn't exist.\n * Preserves existing comments and formatting.\n */\nexport const addIntegrationToConfig = (\n path: string,\n integration: IntegrationConfig,\n): Effect.Effect<void, PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n let text = yield* readOrCreate(fs, path);\n\n // Ensure \"integrations\" array exists\n let tree = jsonc.parseTree(text);\n let integrationsNode = tree ? jsonc.findNodeAtLocation(tree, [\"integrations\"]) : undefined;\n\n if (!integrationsNode) {\n const edits = jsonc.modify(text, [\"integrations\"], [integration], {\n formattingOptions: FORMATTING,\n });\n text = jsonc.applyEdits(text, edits);\n } else {\n // Remove existing entry with same namespace (if any) to avoid duplicates\n const ns = \"namespace\" in integration ? integration.namespace : undefined;\n if (ns && integrationsNode.children) {\n for (let i = integrationsNode.children.length - 1; i >= 0; i--) {\n const child = integrationsNode.children[i]!;\n const nsNode = jsonc.findNodeAtLocation(child, [\"namespace\"]);\n if (nsNode && jsonc.getNodeValue(nsNode) === ns) {\n const edits = jsonc.modify(text, [\"integrations\", i], undefined, {\n formattingOptions: FORMATTING,\n });\n text = jsonc.applyEdits(text, edits);\n }\n }\n // Re-parse after removals\n tree = jsonc.parseTree(text);\n integrationsNode = tree ? jsonc.findNodeAtLocation(tree, [\"integrations\"]) : undefined;\n }\n\n const count = integrationsNode?.children?.length ?? 0;\n const edits = jsonc.modify(text, [\"integrations\", count], integration, {\n formattingOptions: FORMATTING,\n });\n text = jsonc.applyEdits(text, edits);\n }\n\n yield* fs.writeFileString(path, text);\n });\n\n/**\n * Remove an integration from the config file by namespace.\n */\nexport const removeIntegrationFromConfig = (\n path: string,\n namespace: string,\n): Effect.Effect<void, PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const exists = yield* fs.exists(path);\n if (!exists) return;\n\n let text = yield* fs.readFileString(path);\n const tree = jsonc.parseTree(text);\n if (!tree) return;\n\n const integrationsNode = jsonc.findNodeAtLocation(tree, [\"integrations\"]);\n if (!integrationsNode?.children) return;\n\n // Walk backwards so indices stay valid after each removal\n for (let i = integrationsNode.children.length - 1; i >= 0; i--) {\n const child = integrationsNode.children[i]!;\n const nsNode = jsonc.findNodeAtLocation(child, [\"namespace\"]);\n if (nsNode && jsonc.getNodeValue(nsNode) === namespace) {\n const edits = jsonc.modify(text, [\"integrations\", i], undefined, {\n formattingOptions: FORMATTING,\n });\n text = jsonc.applyEdits(text, edits);\n }\n }\n\n yield* fs.writeFileString(path, text);\n });\n\n/**\n * Write a full config object to a file.\n */\nexport const writeConfig = (\n path: string,\n config: ExecutorFileConfig,\n): Effect.Effect<void, ConfigWriteError | PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const text = yield* Effect.try({\n try: () => JSON.stringify(config, null, 2) + \"\\n\",\n catch: (cause) => new ConfigWriteError(path, cause),\n });\n yield* fs.writeFileString(path, text);\n });\n\n/**\n * Add secret metadata to the config file.\n */\nexport const addSecretToConfig = (\n path: string,\n secretId: string,\n metadata: { name: string; provider?: string; purpose?: string },\n): Effect.Effect<void, PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n let text = yield* readOrCreate(fs, path);\n\n const edits = jsonc.modify(text, [\"secrets\", secretId], metadata, {\n formattingOptions: FORMATTING,\n });\n text = jsonc.applyEdits(text, edits);\n\n yield* fs.writeFileString(path, text);\n });\n\n/**\n * Remove secret metadata from the config file.\n */\nexport const removeSecretFromConfig = (\n path: string,\n secretId: string,\n): Effect.Effect<void, PlatformError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n\n const exists = yield* fs.exists(path);\n if (!exists) return;\n\n let text = yield* fs.readFileString(path);\n const edits = jsonc.modify(text, [\"secrets\", secretId], undefined, {\n formattingOptions: FORMATTING,\n });\n text = jsonc.applyEdits(text, edits);\n\n yield* fs.writeFileString(path, text);\n });\n","// ---------------------------------------------------------------------------\n// ConfigFileSink — best-effort write-back of integration changes to executor.jsonc.\n//\n// Plugins (openapi, graphql, mcp) call `sink.upsertIntegration` after their DB\n// writes so the committable file stays in sync with runtime state. Errors\n// are logged and swallowed — a failed file write must never fail a DB\n// mutation, and the next successful mutation (or a boot-time sync) will\n// eventually reconcile.\n//\n// The FileSystem layer is injected so library code here doesn't pick a\n// platform binding. The host app provides NodeFileSystem (or BunFileSystem).\n// ---------------------------------------------------------------------------\n\nimport { Effect } from \"effect\";\nimport type { Layer } from \"effect\";\nimport type { FileSystem } from \"effect\";\n\nimport { SECRET_REF_PREFIX, type ConfigHeaderValue, type IntegrationConfig } from \"./schema\";\nimport { addIntegrationToConfig, removeIntegrationFromConfig } from \"./write\";\n\n// Translate a plugin-side header value (`{ secretId, prefix? }` for secret\n// refs) into the config file's `secret-public-ref:<id>` string form.\ntype PluginHeaderValue = string | { secretId: string; prefix?: string };\n\nexport const headerToConfigValue = (value: PluginHeaderValue): ConfigHeaderValue => {\n if (typeof value === \"string\") return value;\n const ref = `${SECRET_REF_PREFIX}${value.secretId}`;\n return value.prefix ? { value: ref, prefix: value.prefix } : ref;\n};\n\nexport const headersToConfigValues = (\n headers: Record<string, PluginHeaderValue> | undefined,\n): Record<string, ConfigHeaderValue> | undefined => {\n if (!headers) return undefined;\n const out: Record<string, ConfigHeaderValue> = {};\n for (const [k, v] of Object.entries(headers)) out[k] = headerToConfigValue(v);\n return out;\n};\n\nexport interface ConfigFileSink {\n readonly upsertIntegration: (integration: IntegrationConfig) => Effect.Effect<void>;\n readonly removeIntegration: (namespace: string) => Effect.Effect<void>;\n}\n\nexport interface ConfigFileSinkOptions {\n readonly path: string;\n readonly fsLayer: Layer.Layer<FileSystem.FileSystem>;\n /** Called when a file operation fails. Defaults to console.warn. */\n readonly onError?: (op: \"upsert\" | \"remove\", err: unknown) => void;\n}\n\nconst defaultOnError = (op: \"upsert\" | \"remove\", err: unknown): void => {\n console.warn(`[config-sink] ${op} failed`, err);\n};\n\nexport const makeFileConfigSink = (options: ConfigFileSinkOptions): ConfigFileSink => {\n const { path, fsLayer, onError = defaultOnError } = options;\n\n return {\n upsertIntegration: (integration) =>\n addIntegrationToConfig(path, integration).pipe(\n Effect.provide(fsLayer),\n Effect.catch((err: unknown) => Effect.sync(() => onError(\"upsert\", err))),\n ),\n\n removeIntegration: (namespace) =>\n removeIntegrationFromConfig(path, namespace).pipe(\n Effect.provide(fsLayer),\n Effect.catch((err: unknown) => Effect.sync(() => onError(\"remove\", err))),\n ),\n };\n};\n"],"mappings":";AAAA,SAAS,cAAc;AAWhB,IAAM,oB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AAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,OAAO,EAAG,KAAI,CAAC,IAAI,oBAAoB,CAAC;AAC5E,SAAO;AACT;AAcA,IAAM,iBAAiB,CAAC,IAAyB,QAAuB;AACtE,UAAQ,KAAK,iBAAiB,EAAE,WAAW,GAAG;AAChD;AAEO,IAAM,qBAAqB,CAAC,YAAmD;AACpF,QAAM,EAAE,MAAM,SAAS,UAAU,eAAe,IAAI;AAEpD,SAAO;AAAA,IACL,mBAAmB,CAAC,gBAClB,uBAAuB,MAAM,WAAW,EAAE;AAAA,MACxCC,QAAO,QAAQ,OAAO;AAAA,MACtBA,QAAO,MAAM,CAAC,QAAiBA,QAAO,KAAK,MAAM,QAAQ,UAAU,GAAG,CAAC,CAAC;AAAA,IAC1E;AAAA,IAEF,mBAAmB,CAAC,cAClB,4BAA4B,MAAM,SAAS,EAAE;AAAA,MAC3CA,QAAO,QAAQ,OAAO;AAAA,MACtBA,QAAO,MAAM,CAAC,QAAiBA,QAAO,KAAK,MAAM,QAAQ,UAAU,GAAG,CAAC,CAAC;AAAA,IAC1E;AAAA,EACJ;AACF;","names":["Schema","Schema","fs","jsonc","Effect","Schema","Schema","Effect","require","Effect","FileSystem","jsonc","fs","edits","Effect","Effect"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { AnyPlugin } from "@rafads/sdk";
|
|
3
|
+
declare const LoadPluginsError_base: Schema.Class<LoadPluginsError, Schema.TaggedStruct<"LoadPluginsError", {
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
readonly cause: Schema.optional<Schema.Unknown>;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
export declare class LoadPluginsError extends LoadPluginsError_base {
|
|
8
|
+
}
|
|
9
|
+
export interface LoadPluginsFromJsoncOptions {
|
|
10
|
+
/** Absolute path to `executor.jsonc` (or compatible). */
|
|
11
|
+
readonly path: string;
|
|
12
|
+
/**
|
|
13
|
+
* Host-injected deps merged into each plugin's options. Common keys:
|
|
14
|
+
* `configFile` (the `ConfigFileSink`), env-derived credentials, etc.
|
|
15
|
+
* Plugins ignore deps they don't accept — `definePlugin` strips
|
|
16
|
+
* unknown keys before forwarding to the author factory.
|
|
17
|
+
*/
|
|
18
|
+
readonly deps?: Readonly<Record<string, unknown>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the plugins listed in jsonc, or `null` if the file is missing
|
|
22
|
+
* or has no `plugins` array. The host treats `null` as "fall back to
|
|
23
|
+
* the static `executor.config.ts` factory."
|
|
24
|
+
*/
|
|
25
|
+
export declare const loadPluginsFromJsonc: (options: LoadPluginsFromJsoncOptions) => Promise<readonly AnyPlugin[] | null>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=load-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-plugins.d.ts","sourceRoot":"","sources":["../src/load-plugins.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;;;;;AAW7C,qBAAa,gBAAiB,SAAQ,qBAMrC;CAAG;AAEJ,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,2BAA2B,KACnC,OAAO,CAAC,SAAS,SAAS,EAAE,GAAG,IAAI,CAA2D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-plugins.test.d.ts","sourceRoot":"","sources":["../src/load-plugins.test.ts"],"names":[],"mappings":""}
|
package/dist/load.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { FileSystem } from "effect";
|
|
3
|
+
import type { PlatformError } from "effect/PlatformError";
|
|
4
|
+
import { ExecutorFileConfig } from "./schema";
|
|
5
|
+
declare const ConfigParseError_base: Schema.Class<ConfigParseError, Schema.TaggedStruct<"ConfigParseError", {
|
|
6
|
+
readonly path: Schema.String;
|
|
7
|
+
readonly message: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
export declare class ConfigParseError extends ConfigParseError_base {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Load and validate an executor config file.
|
|
13
|
+
* Returns null if the file doesn't exist.
|
|
14
|
+
*/
|
|
15
|
+
export declare const loadConfig: (path: string) => Effect.Effect<ExecutorFileConfig | null, ConfigParseError | PlatformError, FileSystem.FileSystem>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;;;;;AAE9C,qBAAa,gBAAiB,SAAQ,qBAMrC;CAAG;AAEJ;;;GAGG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,KACX,MAAM,CAAC,MAAM,CACd,kBAAkB,GAAG,IAAI,EACzB,gBAAgB,GAAG,aAAa,EAChC,UAAU,CAAC,UAAU,CA+BnB,CAAC"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const SECRET_REF_PREFIX = "secret-public-ref:";
|
|
3
|
+
export declare const ConfigHeaderValue: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
4
|
+
readonly value: Schema.String;
|
|
5
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
6
|
+
}>]>;
|
|
7
|
+
export type ConfigHeaderValue = typeof ConfigHeaderValue.Type;
|
|
8
|
+
export declare const OpenApiIntegrationConfig: Schema.Struct<{
|
|
9
|
+
readonly kind: Schema.Literal<"openapi">;
|
|
10
|
+
readonly spec: Schema.String;
|
|
11
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
12
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
13
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
14
|
+
readonly value: Schema.String;
|
|
15
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
16
|
+
}>]>>>;
|
|
17
|
+
}>;
|
|
18
|
+
export type OpenApiIntegrationConfig = typeof OpenApiIntegrationConfig.Type;
|
|
19
|
+
export declare const GraphqlIntegrationConfig: Schema.Struct<{
|
|
20
|
+
readonly kind: Schema.Literal<"graphql">;
|
|
21
|
+
readonly endpoint: Schema.String;
|
|
22
|
+
readonly introspectionJson: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
23
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
24
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
25
|
+
readonly value: Schema.String;
|
|
26
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
27
|
+
}>]>>>;
|
|
28
|
+
}>;
|
|
29
|
+
export type GraphqlIntegrationConfig = typeof GraphqlIntegrationConfig.Type;
|
|
30
|
+
export declare const McpAuthConfig: Schema.Union<readonly [Schema.Struct<{
|
|
31
|
+
readonly kind: Schema.Literal<"none">;
|
|
32
|
+
}>, Schema.Struct<{
|
|
33
|
+
readonly kind: Schema.Literal<"header">;
|
|
34
|
+
readonly headerName: Schema.String;
|
|
35
|
+
readonly secret: Schema.String;
|
|
36
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
39
|
+
/** Stable id of the SDK Connection holding access + refresh token
|
|
40
|
+
* material. The connection names its owner explicitly (org or user),
|
|
41
|
+
* so the id resolves to exactly one connection — no scope stack, no
|
|
42
|
+
* per-user shadowing. Core resolves its value (refreshing oauth
|
|
43
|
+
* tokens) at execute time via the connection's provider. */
|
|
44
|
+
readonly connectionId: Schema.String;
|
|
45
|
+
}>]>;
|
|
46
|
+
export type McpAuthConfig = typeof McpAuthConfig.Type;
|
|
47
|
+
export declare const McpRemoteIntegrationConfig: Schema.Struct<{
|
|
48
|
+
readonly kind: Schema.Literal<"mcp">;
|
|
49
|
+
readonly transport: Schema.Literal<"remote">;
|
|
50
|
+
readonly name: Schema.String;
|
|
51
|
+
readonly endpoint: Schema.String;
|
|
52
|
+
readonly remoteTransport: Schema.optional<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>;
|
|
53
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
54
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
55
|
+
readonly value: Schema.String;
|
|
56
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
57
|
+
}>]>>>;
|
|
58
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
59
|
+
readonly value: Schema.String;
|
|
60
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
61
|
+
}>]>>>;
|
|
62
|
+
readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
63
|
+
readonly kind: Schema.Literal<"none">;
|
|
64
|
+
}>, Schema.Struct<{
|
|
65
|
+
readonly kind: Schema.Literal<"header">;
|
|
66
|
+
readonly headerName: Schema.String;
|
|
67
|
+
readonly secret: Schema.String;
|
|
68
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
69
|
+
}>, Schema.Struct<{
|
|
70
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
71
|
+
/** Stable id of the SDK Connection holding access + refresh token
|
|
72
|
+
* material. The connection names its owner explicitly (org or user),
|
|
73
|
+
* so the id resolves to exactly one connection — no scope stack, no
|
|
74
|
+
* per-user shadowing. Core resolves its value (refreshing oauth
|
|
75
|
+
* tokens) at execute time via the connection's provider. */
|
|
76
|
+
readonly connectionId: Schema.String;
|
|
77
|
+
}>]>>;
|
|
78
|
+
}>;
|
|
79
|
+
export type McpRemoteIntegrationConfig = typeof McpRemoteIntegrationConfig.Type;
|
|
80
|
+
export declare const McpStdioIntegrationConfig: Schema.Struct<{
|
|
81
|
+
readonly kind: Schema.Literal<"mcp">;
|
|
82
|
+
readonly transport: Schema.Literal<"stdio">;
|
|
83
|
+
readonly name: Schema.String;
|
|
84
|
+
readonly command: Schema.String;
|
|
85
|
+
readonly args: Schema.optional<Schema.$Array<Schema.String>>;
|
|
86
|
+
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
87
|
+
readonly cwd: Schema.optional<Schema.String>;
|
|
88
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
89
|
+
}>;
|
|
90
|
+
export type McpStdioIntegrationConfig = typeof McpStdioIntegrationConfig.Type;
|
|
91
|
+
export declare const IntegrationConfig: Schema.Union<readonly [Schema.Struct<{
|
|
92
|
+
readonly kind: Schema.Literal<"openapi">;
|
|
93
|
+
readonly spec: Schema.String;
|
|
94
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
95
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
96
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
97
|
+
readonly value: Schema.String;
|
|
98
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
99
|
+
}>]>>>;
|
|
100
|
+
}>, Schema.Struct<{
|
|
101
|
+
readonly kind: Schema.Literal<"graphql">;
|
|
102
|
+
readonly endpoint: Schema.String;
|
|
103
|
+
readonly introspectionJson: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
104
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
105
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
106
|
+
readonly value: Schema.String;
|
|
107
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
108
|
+
}>]>>>;
|
|
109
|
+
}>, Schema.Struct<{
|
|
110
|
+
readonly kind: Schema.Literal<"mcp">;
|
|
111
|
+
readonly transport: Schema.Literal<"remote">;
|
|
112
|
+
readonly name: Schema.String;
|
|
113
|
+
readonly endpoint: Schema.String;
|
|
114
|
+
readonly remoteTransport: Schema.optional<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>;
|
|
115
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
116
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
117
|
+
readonly value: Schema.String;
|
|
118
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
119
|
+
}>]>>>;
|
|
120
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
121
|
+
readonly value: Schema.String;
|
|
122
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
123
|
+
}>]>>>;
|
|
124
|
+
readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
125
|
+
readonly kind: Schema.Literal<"none">;
|
|
126
|
+
}>, Schema.Struct<{
|
|
127
|
+
readonly kind: Schema.Literal<"header">;
|
|
128
|
+
readonly headerName: Schema.String;
|
|
129
|
+
readonly secret: Schema.String;
|
|
130
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
131
|
+
}>, Schema.Struct<{
|
|
132
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
133
|
+
/** Stable id of the SDK Connection holding access + refresh token
|
|
134
|
+
* material. The connection names its owner explicitly (org or user),
|
|
135
|
+
* so the id resolves to exactly one connection — no scope stack, no
|
|
136
|
+
* per-user shadowing. Core resolves its value (refreshing oauth
|
|
137
|
+
* tokens) at execute time via the connection's provider. */
|
|
138
|
+
readonly connectionId: Schema.String;
|
|
139
|
+
}>]>>;
|
|
140
|
+
}>, Schema.Struct<{
|
|
141
|
+
readonly kind: Schema.Literal<"mcp">;
|
|
142
|
+
readonly transport: Schema.Literal<"stdio">;
|
|
143
|
+
readonly name: Schema.String;
|
|
144
|
+
readonly command: Schema.String;
|
|
145
|
+
readonly args: Schema.optional<Schema.$Array<Schema.String>>;
|
|
146
|
+
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
147
|
+
readonly cwd: Schema.optional<Schema.String>;
|
|
148
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
149
|
+
}>]>;
|
|
150
|
+
export type IntegrationConfig = typeof IntegrationConfig.Type;
|
|
151
|
+
export declare const SecretMetadata: Schema.Struct<{
|
|
152
|
+
readonly name: Schema.String;
|
|
153
|
+
readonly provider: Schema.optional<Schema.String>;
|
|
154
|
+
readonly purpose: Schema.optional<Schema.String>;
|
|
155
|
+
}>;
|
|
156
|
+
export type SecretMetadata = typeof SecretMetadata.Type;
|
|
157
|
+
export declare const PluginConfig: Schema.Struct<{
|
|
158
|
+
readonly package: Schema.String;
|
|
159
|
+
readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
160
|
+
}>;
|
|
161
|
+
export type PluginConfig = typeof PluginConfig.Type;
|
|
162
|
+
export declare const ExecutorFileConfig: Schema.Struct<{
|
|
163
|
+
readonly $schema: Schema.optional<Schema.String>;
|
|
164
|
+
readonly name: Schema.optional<Schema.String>;
|
|
165
|
+
readonly plugins: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
166
|
+
readonly package: Schema.String;
|
|
167
|
+
readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
168
|
+
}>>>;
|
|
169
|
+
readonly integrations: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
170
|
+
readonly kind: Schema.Literal<"openapi">;
|
|
171
|
+
readonly spec: Schema.String;
|
|
172
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
173
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
174
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
175
|
+
readonly value: Schema.String;
|
|
176
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
177
|
+
}>]>>>;
|
|
178
|
+
}>, Schema.Struct<{
|
|
179
|
+
readonly kind: Schema.Literal<"graphql">;
|
|
180
|
+
readonly endpoint: Schema.String;
|
|
181
|
+
readonly introspectionJson: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
182
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
183
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
184
|
+
readonly value: Schema.String;
|
|
185
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
186
|
+
}>]>>>;
|
|
187
|
+
}>, Schema.Struct<{
|
|
188
|
+
readonly kind: Schema.Literal<"mcp">;
|
|
189
|
+
readonly transport: Schema.Literal<"remote">;
|
|
190
|
+
readonly name: Schema.String;
|
|
191
|
+
readonly endpoint: Schema.String;
|
|
192
|
+
readonly remoteTransport: Schema.optional<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>;
|
|
193
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
194
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
195
|
+
readonly value: Schema.String;
|
|
196
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
197
|
+
}>]>>>;
|
|
198
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
199
|
+
readonly value: Schema.String;
|
|
200
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
201
|
+
}>]>>>;
|
|
202
|
+
readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
203
|
+
readonly kind: Schema.Literal<"none">;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
readonly kind: Schema.Literal<"header">;
|
|
206
|
+
readonly headerName: Schema.String;
|
|
207
|
+
readonly secret: Schema.String;
|
|
208
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
209
|
+
}>, Schema.Struct<{
|
|
210
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
211
|
+
/** Stable id of the SDK Connection holding access + refresh token
|
|
212
|
+
* material. The connection names its owner explicitly (org or user),
|
|
213
|
+
* so the id resolves to exactly one connection — no scope stack, no
|
|
214
|
+
* per-user shadowing. Core resolves its value (refreshing oauth
|
|
215
|
+
* tokens) at execute time via the connection's provider. */
|
|
216
|
+
readonly connectionId: Schema.String;
|
|
217
|
+
}>]>>;
|
|
218
|
+
}>, Schema.Struct<{
|
|
219
|
+
readonly kind: Schema.Literal<"mcp">;
|
|
220
|
+
readonly transport: Schema.Literal<"stdio">;
|
|
221
|
+
readonly name: Schema.String;
|
|
222
|
+
readonly command: Schema.String;
|
|
223
|
+
readonly args: Schema.optional<Schema.$Array<Schema.String>>;
|
|
224
|
+
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
225
|
+
readonly cwd: Schema.optional<Schema.String>;
|
|
226
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
227
|
+
}>]>>>;
|
|
228
|
+
readonly secrets: Schema.optional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
229
|
+
readonly name: Schema.String;
|
|
230
|
+
readonly provider: Schema.optional<Schema.String>;
|
|
231
|
+
readonly purpose: Schema.optional<Schema.String>;
|
|
232
|
+
}>>>;
|
|
233
|
+
}>;
|
|
234
|
+
export type ExecutorFileConfig = typeof ExecutorFileConfig.Type;
|
|
235
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,iBAAiB;;;IAM5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAQ9D,eAAO,MAAM,wBAAwB;;;;;;;;;EAMnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAC,IAAI,CAAC;AAE5E,eAAO,MAAM,wBAAwB;;;;;;;;;EAMnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAC,IAAI,CAAC;AAI5E,eAAO,MAAM,aAAa;;;;;;;;;IAUtB;;;;iEAI6D;;IAG/D,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AAEtD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;QAVnC;;;;qEAI6D;;;EAgB/D,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAC,IAAI,CAAC;AAEhF,eAAO,MAAM,yBAAyB;;;;;;;;;EASpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAC;AAE9E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAnC1B;;;;qEAI6D;;;;;;;;;;;;IAoC/D,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAM9D,eAAO,MAAM,cAAc;;;;EAIzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAcxD,eAAO,MAAM,YAAY;;;EAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC;AAMpD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA5E3B;;;;yEAI6D;;;;;;;;;;;;;;;;;;EA8E/D,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAC"}
|
package/dist/sink.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { Layer } from "effect";
|
|
3
|
+
import type { FileSystem } from "effect";
|
|
4
|
+
import { type ConfigHeaderValue, type IntegrationConfig } from "./schema";
|
|
5
|
+
type PluginHeaderValue = string | {
|
|
6
|
+
secretId: string;
|
|
7
|
+
prefix?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const headerToConfigValue: (value: PluginHeaderValue) => ConfigHeaderValue;
|
|
10
|
+
export declare const headersToConfigValues: (headers: Record<string, PluginHeaderValue> | undefined) => Record<string, ConfigHeaderValue> | undefined;
|
|
11
|
+
export interface ConfigFileSink {
|
|
12
|
+
readonly upsertIntegration: (integration: IntegrationConfig) => Effect.Effect<void>;
|
|
13
|
+
readonly removeIntegration: (namespace: string) => Effect.Effect<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface ConfigFileSinkOptions {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly fsLayer: Layer.Layer<FileSystem.FileSystem>;
|
|
18
|
+
/** Called when a file operation fails. Defaults to console.warn. */
|
|
19
|
+
readonly onError?: (op: "upsert" | "remove", err: unknown) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const makeFileConfigSink: (options: ConfigFileSinkOptions) => ConfigFileSink;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../src/sink.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAqB,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7F,KAAK,iBAAiB,GAAG,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,mBAAmB,GAAI,OAAO,iBAAiB,KAAG,iBAI9D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,KACrD,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAKtC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpF,QAAQ,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACrD,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CACpE;AAMD,eAAO,MAAM,kBAAkB,GAAI,SAAS,qBAAqB,KAAG,cAgBnE,CAAC"}
|
package/dist/write.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { FileSystem } from "effect";
|
|
3
|
+
import type { PlatformError } from "effect/PlatformError";
|
|
4
|
+
import type { IntegrationConfig, ExecutorFileConfig } from "./schema";
|
|
5
|
+
export declare class ConfigWriteError {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly cause: unknown;
|
|
8
|
+
readonly _tag = "ConfigWriteError";
|
|
9
|
+
constructor(path: string, cause: unknown);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Add an integration entry to the config file. Creates the file if it doesn't exist.
|
|
13
|
+
* Preserves existing comments and formatting.
|
|
14
|
+
*/
|
|
15
|
+
export declare const addIntegrationToConfig: (path: string, integration: IntegrationConfig) => Effect.Effect<void, PlatformError, FileSystem.FileSystem>;
|
|
16
|
+
/**
|
|
17
|
+
* Remove an integration from the config file by namespace.
|
|
18
|
+
*/
|
|
19
|
+
export declare const removeIntegrationFromConfig: (path: string, namespace: string) => Effect.Effect<void, PlatformError, FileSystem.FileSystem>;
|
|
20
|
+
/**
|
|
21
|
+
* Write a full config object to a file.
|
|
22
|
+
*/
|
|
23
|
+
export declare const writeConfig: (path: string, config: ExecutorFileConfig) => Effect.Effect<void, ConfigWriteError | PlatformError, FileSystem.FileSystem>;
|
|
24
|
+
/**
|
|
25
|
+
* Add secret metadata to the config file.
|
|
26
|
+
*/
|
|
27
|
+
export declare const addSecretToConfig: (path: string, secretId: string, metadata: {
|
|
28
|
+
name: string;
|
|
29
|
+
provider?: string;
|
|
30
|
+
purpose?: string;
|
|
31
|
+
}) => Effect.Effect<void, PlatformError, FileSystem.FileSystem>;
|
|
32
|
+
/**
|
|
33
|
+
* Remove secret metadata from the config file.
|
|
34
|
+
*/
|
|
35
|
+
export declare const removeSecretFromConfig: (path: string, secretId: string) => Effect.Effect<void, PlatformError, FileSystem.FileSystem>;
|
|
36
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEtE,qBAAa,gBAAgB;IAGzB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO;IAHzB,QAAQ,CAAC,IAAI,sBAAsB;gBAExB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO;CAE1B;AAyBD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,EACZ,aAAa,iBAAiB,KAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,CAyCvD,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACtC,MAAM,MAAM,EACZ,WAAW,MAAM,KAChB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,CA2BvD,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,QAAQ,kBAAkB,KACzB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,aAAa,EAAE,UAAU,CAAC,UAAU,CAQ1E,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,EACZ,UAAU,MAAM,EAChB,UAAU;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,CAWvD,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,EACZ,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,CAcvD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rafads/config",
|
|
3
|
+
"version": "1.5.38",
|
|
4
|
+
"homepage": "https://github.com/UsefulSoftwareCo/executor/tree/main/packages/core/config",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/UsefulSoftwareCo/executor/issues"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/UsefulSoftwareCo/executor.git",
|
|
12
|
+
"directory": "packages/core/config"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup && tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src",
|
|
31
|
+
"typecheck": "tsgo --noEmit",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"typecheck:slow": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@rafads/sdk": "1.5.38",
|
|
37
|
+
"jiti": "^2.6.1",
|
|
38
|
+
"jsonc-parser": "^3.3.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@effect/platform-node": "4.0.0-beta.59",
|
|
42
|
+
"@effect/vitest": "4.0.0-beta.59",
|
|
43
|
+
"@types/node": "^24.3.1",
|
|
44
|
+
"effect": "4.0.0-beta.59",
|
|
45
|
+
"tsup": "^8.5.0",
|
|
46
|
+
"typescript": "^5.9.3",
|
|
47
|
+
"vitest": "^4.1.5"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"effect": "4.0.0-beta.59"
|
|
51
|
+
}
|
|
52
|
+
}
|