16namespace neograph::program {
24enum class SourceKind { CanonicalJson, CppBuilder, JavaScript };
27 std::string source_id;
28 std::string content_identity;
30 bool operator==(
const ImportRef&)
const =
default;
39 std::string source_id;
40 std::string content_identity;
41 std::string source_text;
46struct SourceMapEntry {
47 std::string generated_pointer;
48 SourceCoordinate authored;
50 bool operator==(
const SourceMapEntry&)
const =
default;
59 std::string quickjs_release;
60 std::string quickjs_archive_digest;
61 std::string quickjs_build_options;
63 std::uint32_t profile_version = 0;
64 std::uint32_t ng_api_version = 0;
69NEOGRAPH_PROGRAM_API std::string_view to_string(
SourceKind kind)
noexcept;
70NEOGRAPH_PROGRAM_API
SourceKind source_kind_from_string(std::string_view value);
71NEOGRAPH_PROGRAM_API
void to_json(json& value,
const ImportRef& import_ref);
72NEOGRAPH_PROGRAM_API
void from_json(
const json& value, ImportRef& import_ref);
73NEOGRAPH_PROGRAM_API
void to_json(json& value,
const SourceMapEntry& entry);
74NEOGRAPH_PROGRAM_API
void to_json(json& value,
76NEOGRAPH_PROGRAM_API
void from_json(
const json& value,
78NEOGRAPH_PROGRAM_API
void from_json(
const json& value, SourceMapEntry& entry);
80class NEOGRAPH_PROGRAM_API ProgramSource {
82 static constexpr std::uint32_t STORAGE_SCHEMA_VERSION = 1;
83 static constexpr std::uint32_t JAVASCRIPT_PROGRAM_SCHEMA_VERSION =
84 LATEST_PROGRAM_SCHEMA_VERSION;
85 static constexpr std::uint32_t JAVASCRIPT_LANGUAGE_VERSION = 1;
86 static constexpr std::uint32_t JAVASCRIPT_HOST_API_VERSION = 1;
87 static constexpr std::string_view JAVASCRIPT_ENGINE =
"quickjs";
88 static constexpr std::string_view JAVASCRIPT_ENGINE_VERSION =
"2026-06-04";
89 static constexpr std::string_view JAVASCRIPT_QUICKJS_ARCHIVE_DIGEST =
90 "sha256:b376e839b322978313d929fd20663b11ba58b75df5a46c126dd19ea2fa70ad2a";
91 static constexpr std::string_view JAVASCRIPT_QUICKJS_BUILD_OPTIONS =
93 "CONFIG_VERSION=2026-06-04;QUICKJS_LIBC=disabled;STD_OS=disabled;"
94 "DYNAMIC_MODULES=disabled;MSVC_INTRINSICS=disabled;"
95 "NEOGRAPH_PLATFORM_PORT=msvc-v1;"
96 "NEOGRAPH_PLATFORM_PORT_SHA256="
97 "7f12d37b15bce57527714395552d1a0b64c4f5708c48fcb3f787f96ed0d1af51";
99 "CONFIG_VERSION=2026-06-04;QUICKJS_LIBC=disabled;STD_OS=disabled;"
100 "DYNAMIC_MODULES=disabled";
102 static constexpr std::string_view JAVASCRIPT_PROFILE =
"sealed-v1";
103 static constexpr std::uint32_t JAVASCRIPT_PROFILE_VERSION = 1;
104 static constexpr std::uint32_t JAVASCRIPT_NG_API_VERSION = 1;
113 static ProgramSource from_javascript(std::string source_id,
114 std::string source_text,
115 std::vector<ImportRef> imports = {},
116 std::vector<SourceMapEntry> source_map = {},
117 std::vector<SealedJavaScriptModule> sealed_modules = {});
119 static ProgramSource from_cpp_builder(std::string source_id,
120 std::uint32_t schema_version,
122 std::vector<ImportRef> imports = {},
123 std::vector<SourceMapEntry> source_map = {});
126 static ProgramSource parse(std::string_view stored_bytes);
129 std::uint32_t schema_version() const noexcept;
130 const std::
string& source_id() const noexcept;
131 json document() const;
132 const std::vector<ImportRef>& imports() const noexcept;
133 const std::vector<SourceMapEntry>& source_map() const noexcept;
138 const std::vector<SealedJavaScriptModule>& sealed_modules() const noexcept;
140 JavaScriptRuntimeIdentity javascript_runtime_identity() const;
146 const std::
string& source_hash() const noexcept;
147 const std::
string& canonical_document() const noexcept;
148 std::
string serialize_canonical() const;
152 explicit ProgramSource(std::shared_ptr<const Impl> impl);
153 std::shared_ptr<const Impl> impl_;
Stable, transport-neutral Program diagnostics and source coordinates.
Published Program source-schema version identifiers.
SourceKind
Source identity carried by Program values.
Exact identity of the private JavaScript frontend.
Exact source bytes for one reviewed pure JavaScript module.