@tomflow/proflow-platform-cli 0.1.15 → 0.1.17

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 (36) hide show
  1. package/DOCS.md +27 -0
  2. package/SETUP.md +7 -0
  3. package/dist/deployment/adapter.d.ts +58 -34
  4. package/dist/deployment/adapter.js +28 -12
  5. package/dist/deployment/descriptor.d.ts +5 -16
  6. package/dist/deployment/descriptor.js +10 -21
  7. package/dist/src/cli.js +131 -137
  8. package/dist/src/contracts.d.ts +0 -2
  9. package/dist/src/discovery/discover.d.ts +1 -3
  10. package/dist/src/discovery/discover.js +1 -10
  11. package/dist/src/errors.d.ts +1 -1
  12. package/dist/src/errors.js +0 -2
  13. package/dist/src/index.d.ts +0 -2
  14. package/dist/src/index.js +0 -1
  15. package/dist/src/lifecycle/dispatch.d.ts +4 -11
  16. package/dist/src/lifecycle/dispatch.js +28 -56
  17. package/dist/src/lifecycle/index.d.ts +4 -4
  18. package/dist/src/lifecycle/index.js +2 -2
  19. package/dist/src/lifecycle/thin.d.ts +19 -7
  20. package/dist/src/lifecycle/thin.js +80 -55
  21. package/dist/src/persistence/index.d.ts +0 -2
  22. package/dist/src/persistence/index.js +0 -1
  23. package/package.json +7 -5
  24. package/proflow.module.json +5 -20
  25. package/dist/src/binding/production-bindings.d.ts +0 -37
  26. package/dist/src/binding/production-bindings.js +0 -75
  27. package/dist/src/docs/aggregate.d.ts +0 -18
  28. package/dist/src/docs/aggregate.js +0 -44
  29. package/dist/src/docs/docs.d.ts +0 -16
  30. package/dist/src/docs/docs.js +0 -68
  31. package/dist/src/docs/index.d.ts +0 -2
  32. package/dist/src/docs/index.js +0 -1
  33. package/dist/src/persistence/config.d.ts +0 -6
  34. package/dist/src/persistence/config.js +0 -54
  35. package/dist/src/persistence/guards.d.ts +0 -1
  36. package/dist/src/persistence/guards.js +0 -7
@@ -1 +0,0 @@
1
- export { aggregateModuleDocs } from "./aggregate.js";
@@ -1,6 +0,0 @@
1
- import type { WorkspacePaths } from "../paths.ts";
2
- export interface MaterializedConfig {
3
- publicValues: Record<string, string>;
4
- secretValues: Record<string, string>;
5
- }
6
- export declare function loadConfig(paths: WorkspacePaths, moduleRef: string): Promise<MaterializedConfig | undefined>;
@@ -1,54 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { PlatformError } from "../errors.js";
4
- import { assertSafeFileName } from "./guards.js";
5
- function configFilePath(paths, moduleRef) {
6
- assertSafeFileName(moduleRef, "moduleRef");
7
- return join(paths.config, `${moduleRef}.json`);
8
- }
9
- function secretsFilePath(paths, moduleRef) {
10
- assertSafeFileName(moduleRef, "moduleRef");
11
- return join(paths.config, `${moduleRef}.secrets.json`);
12
- }
13
- function isStringMap(value) {
14
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
15
- return false;
16
- }
17
- return Object.values(value).every((item) => typeof item === "string");
18
- }
19
- function isMissingFile(error) {
20
- return (typeof error === "object" &&
21
- error !== null &&
22
- "code" in error &&
23
- error.code === "ENOENT");
24
- }
25
- async function readConfigValues(file, moduleRef, kind) {
26
- let raw;
27
- try {
28
- raw = await readFile(file, "utf8");
29
- }
30
- catch (error) {
31
- if (isMissingFile(error))
32
- return undefined;
33
- throw new PlatformError("CONFIG_INVALID", `cannot read ${kind} config for ${moduleRef}: ${error instanceof Error ? error.message : String(error)}`);
34
- }
35
- try {
36
- const parsed = JSON.parse(raw);
37
- if (!isStringMap(parsed))
38
- throw new TypeError("expected a JSON object whose values are strings");
39
- return parsed;
40
- }
41
- catch (error) {
42
- throw new PlatformError("CONFIG_INVALID", `${kind} config for ${moduleRef} is invalid JSON/config: ${error instanceof Error ? error.message : String(error)}`);
43
- }
44
- }
45
- export async function loadConfig(paths, moduleRef) {
46
- const publicValues = await readConfigValues(configFilePath(paths, moduleRef), moduleRef, "public");
47
- const secretValues = await readConfigValues(secretsFilePath(paths, moduleRef), moduleRef, "secret");
48
- if (publicValues === undefined && secretValues === undefined)
49
- return undefined;
50
- return {
51
- publicValues: publicValues ?? {},
52
- secretValues: secretValues ?? {},
53
- };
54
- }
@@ -1 +0,0 @@
1
- export declare function assertSafeFileName(name: string, kind: string): void;
@@ -1,7 +0,0 @@
1
- import { PlatformError } from "../errors.js";
2
- const SAFE_FILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
3
- export function assertSafeFileName(name, kind) {
4
- if (!SAFE_FILE_NAME.test(name)) {
5
- throw new PlatformError("INVALID_REQUEST", `invalid ${kind} name: ${name}`);
6
- }
7
- }