@lunora/codegen 1.0.0-alpha.265 → 1.0.0-alpha.266
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/index.d.mts +38 -10
- package/dist/index.d.ts +38 -10
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/AGENTS_FILENAME-DwlmRvXo.mjs +1 -0
- package/dist/packem_shared/CONTAINERS_FILENAME-D8YLxYhQ.mjs +1 -0
- package/dist/packem_shared/DEFAULT_TARGET-CaXPORLo.mjs +1 -0
- package/dist/packem_shared/FLAGS_FILENAME-BGFPEEjc.mjs +1 -0
- package/dist/packem_shared/MUTATORS_FILENAME-DwAZEI6d.mjs +1 -0
- package/dist/packem_shared/NOTIFY_FILENAME-DrBbzi0l.mjs +1 -0
- package/dist/packem_shared/{OPENRPC_VERSION-CGu1_YK7.mjs → OPENRPC_VERSION-BqeEI2Dn.mjs} +1 -1
- package/dist/packem_shared/QUEUES_FILENAME-D0AeAQz-.mjs +1 -0
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-YwnhjnM-.mjs +11 -0
- package/dist/packem_shared/SHAPES_FILENAME-C-CUVhR6.mjs +1 -0
- package/dist/packem_shared/WORKFLOWS_FILENAME-d1r1GnQd.mjs +1 -0
- package/dist/packem_shared/attribution-B7i322L0.mjs +1 -0
- package/dist/packem_shared/{buildOpenApiDocument-DOsv1HEF.mjs → buildOpenApiDocument-BYtXD9iB.mjs} +1 -1
- package/dist/packem_shared/capabilitiesUsedBy-_kfPZ5wC.mjs +1 -0
- package/dist/packem_shared/chain-C17a7v59.mjs +1 -0
- package/dist/packem_shared/classify-procedure-call-DC_O3oNQ.mjs +1 -0
- package/dist/packem_shared/context-property-calls-BvE4YxG6.mjs +1 -0
- package/dist/packem_shared/context-root-C4hjiCTo.mjs +1 -0
- package/dist/packem_shared/{database-calls-Br5z7dZL.mjs → database-calls-B6ylmcGA.mjs} +1 -1
- package/dist/packem_shared/discoverAuthApiCalls-CUM8XgDc.mjs +1 -0
- package/dist/packem_shared/discoverCrons-DI1xHRei.mjs +1 -0
- package/dist/packem_shared/discoverFunctions-B-7117i2.mjs +1 -0
- package/dist/packem_shared/discoverHttpRoutes-BT2HmWD_.mjs +1 -0
- package/dist/packem_shared/discoverHyperdriveCalls-Bir4M-bD.mjs +1 -0
- package/dist/packem_shared/discoverInserts-BHxWlrW0.mjs +1 -0
- package/dist/packem_shared/discoverMaskProcedures-DHqunTJ7.mjs +1 -0
- package/dist/packem_shared/discoverMigrations-DdeNFu0j.mjs +1 -0
- package/dist/packem_shared/discoverNondeterministicCalls-Deg23AAc.mjs +1 -0
- package/dist/packem_shared/discoverQueries-yKWWoX-Z.mjs +1 -0
- package/dist/packem_shared/discoverR2sqlCalls-C48f9S0b.mjs +1 -0
- package/dist/packem_shared/discoverRlsMetadata-DwG8EMHQ.mjs +1 -0
- package/dist/packem_shared/discoverRlsProcedures-D3UFRjOI.mjs +1 -0
- package/dist/packem_shared/discoverSandboxUsage-C-ntjbjl.mjs +1 -0
- package/dist/packem_shared/discoverSchema-DFN2L811.mjs +1 -0
- package/dist/packem_shared/discoverStorageRulesMetadata-B-f9lVjJ.mjs +1 -0
- package/dist/packem_shared/{emitApp-RNU41dtm.mjs → emitApp-Dec8sEI0.mjs} +2 -0
- package/dist/packem_shared/{exported-procedure-chains-CKLvyjfX.mjs → exported-procedure-chains-CmwqreGv.mjs} +1 -1
- package/dist/packem_shared/fingerprintSchemaSources-4S1x40Bs.mjs +1 -0
- package/dist/packem_shared/handler-reference-DaXlBYJx.mjs +1 -0
- package/dist/packem_shared/index-B5G7NWDW.mjs +1 -0
- package/dist/packem_shared/isTestPath-5ruOnRVA.mjs +1 -0
- package/dist/packem_shared/loadProjectConfig-D-yD5eRd.mjs +1 -0
- package/dist/packem_shared/modules-DQv8-RtF.mjs +1 -0
- package/dist/packem_shared/parse-validator-C2Osg6gv.mjs +1 -0
- package/dist/packem_shared/project-config-file-Cb5ouVEK.mjs +1 -0
- package/dist/packem_shared/readPackageDependencies-RHhGiz0k.mjs +1 -0
- package/dist/packem_shared/readServiceBindings-BcN87FPt.mjs +1 -0
- package/dist/packem_shared/unwrap-handler-return-CM6v2E3A.mjs +1 -0
- package/package.json +2 -1
- package/dist/packem_shared/AGENTS_FILENAME-C-halsN9.mjs +0 -1
- package/dist/packem_shared/CONTAINERS_FILENAME-DY4sWZYx.mjs +0 -1
- package/dist/packem_shared/DEFAULT_TARGET-7sHexLjO.mjs +0 -1
- package/dist/packem_shared/FLAGS_FILENAME-BINQ51Zq.mjs +0 -1
- package/dist/packem_shared/MUTATORS_FILENAME-CuG6xLJ1.mjs +0 -1
- package/dist/packem_shared/NOTIFY_FILENAME-C70ZrThq.mjs +0 -1
- package/dist/packem_shared/QUEUES_FILENAME-16xcVWpo.mjs +0 -1
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-BMzr0ydt.mjs +0 -11
- package/dist/packem_shared/SHAPES_FILENAME-e82UBLBE.mjs +0 -1
- package/dist/packem_shared/WORKFLOWS_FILENAME-Bcfd76Wf.mjs +0 -1
- package/dist/packem_shared/attribution-JcwxPpyK.mjs +0 -1
- package/dist/packem_shared/capabilitiesUsedBy-CzqyN9dX.mjs +0 -1
- package/dist/packem_shared/chain-BTbLDrrU.mjs +0 -1
- package/dist/packem_shared/classify-procedure-call-OnJoKgqu.mjs +0 -1
- package/dist/packem_shared/context-property-calls-BqKN1GyT.mjs +0 -1
- package/dist/packem_shared/context-root-Dlht00NP.mjs +0 -1
- package/dist/packem_shared/discoverAuthApiCalls-0t3X09mV.mjs +0 -1
- package/dist/packem_shared/discoverCrons-BqTY53L5.mjs +0 -1
- package/dist/packem_shared/discoverFunctions-B-hkqNPG.mjs +0 -1
- package/dist/packem_shared/discoverHttpRoutes-8f8UnwQk.mjs +0 -1
- package/dist/packem_shared/discoverHyperdriveCalls-BRbwJcK7.mjs +0 -1
- package/dist/packem_shared/discoverInserts-6RcjS-YR.mjs +0 -1
- package/dist/packem_shared/discoverMaskProcedures-B8LgCQ2X.mjs +0 -1
- package/dist/packem_shared/discoverMigrations-De3uDJi0.mjs +0 -1
- package/dist/packem_shared/discoverNondeterministicCalls-XHRCA4rr.mjs +0 -1
- package/dist/packem_shared/discoverQueries-B0vvHwFI.mjs +0 -1
- package/dist/packem_shared/discoverR2sqlCalls-BQ90jfu3.mjs +0 -1
- package/dist/packem_shared/discoverRlsMetadata-BuGLdQWs.mjs +0 -1
- package/dist/packem_shared/discoverRlsProcedures-Cy8-Q0AP.mjs +0 -1
- package/dist/packem_shared/discoverSandboxUsage-Bjl8A_hj.mjs +0 -1
- package/dist/packem_shared/discoverSchema-Cd3iH6q5.mjs +0 -1
- package/dist/packem_shared/discoverStorageRulesMetadata-C6sTEVS5.mjs +0 -1
- package/dist/packem_shared/fingerprintSchemaSources-BzFVnBfa.mjs +0 -1
- package/dist/packem_shared/handler-reference-Dzp5GZ5p.mjs +0 -1
- package/dist/packem_shared/index-BxGykPbL.mjs +0 -1
- package/dist/packem_shared/listLunoraSourceFiles-DRes9d5p.mjs +0 -1
- package/dist/packem_shared/loadProjectConfig-CuGQsqYS.mjs +0 -1
- package/dist/packem_shared/modules-CsA-QVJ6.mjs +0 -1
- package/dist/packem_shared/parse-validator-B4mFs19C.mjs +0 -1
- package/dist/packem_shared/readPackageDependencies-C6h6FZuP.mjs +0 -1
- package/dist/packem_shared/readServiceBindings-CnvEGOir.mjs +0 -1
- package/dist/packem_shared/unwrap-handler-return-D7E2TKkS.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -3228,13 +3228,29 @@ declare const AGENTS_FILENAME = "agents.ts";
|
|
|
3228
3228
|
*/
|
|
3229
3229
|
declare const discoverAgents: (project: Project, lunoraDirectory: string) => AgentIR[];
|
|
3230
3230
|
/**
|
|
3231
|
-
*
|
|
3232
|
-
*
|
|
3233
|
-
*
|
|
3234
|
-
*
|
|
3235
|
-
*
|
|
3236
|
-
|
|
3237
|
-
|
|
3231
|
+
* Whether `relativePath` (POSIX separators, with or without its extension) is
|
|
3232
|
+
* test code: a test file name, or anything under a test folder. Tests seed
|
|
3233
|
+
* tables across module boundaries and call functions from module scope by
|
|
3234
|
+
* design, so discovery skips them — they would bury real advisories and
|
|
3235
|
+
* architecture gaps under fixture noise. Secret discovery is the one reader
|
|
3236
|
+
* that keeps them (see `listLunoraSourceFiles`), and uses this to tell a
|
|
3237
|
+
* fixture apart.
|
|
3238
|
+
*/
|
|
3239
|
+
declare const isTestPath: (relativePath: string) => boolean;
|
|
3240
|
+
/**
|
|
3241
|
+
* The exported entry point: every discoverer calls this with a directory. Only
|
|
3242
|
+
* the readers that must see every file opt into `includeSkipped` — test files
|
|
3243
|
+
* and `codegen.exclude` matches included: secret discovery, because a vendor key
|
|
3244
|
+
* committed anywhere is still a leak, and the watcher fingerprint that decides
|
|
3245
|
+
* when that scan reruns. {@link walkLunoraSourceFiles}'s
|
|
3246
|
+
* accumulator/root/visited stay unexported because they are recursion state — a
|
|
3247
|
+
* caller passing a pre-filled accumulator or a stale `visited` silently changes
|
|
3248
|
+
* which files are discovered, and an exported signature freezes that hazard into
|
|
3249
|
+
* the public API snapshot.
|
|
3250
|
+
*/
|
|
3251
|
+
declare const listLunoraSourceFiles: (directory: string, options?: {
|
|
3252
|
+
includeSkipped?: boolean;
|
|
3253
|
+
}) => string[];
|
|
3238
3254
|
/**
|
|
3239
3255
|
* Discover `ctx.authApi.<method>(...)` (and bare `authApi.<method>(...)`) calls
|
|
3240
3256
|
* under the lunora source directory, each with its `CallSiteScope`.
|
|
@@ -4030,6 +4046,15 @@ interface ProjectConfigLiterals {
|
|
|
4030
4046
|
minSeverity?: string;
|
|
4031
4047
|
unreadable?: boolean;
|
|
4032
4048
|
};
|
|
4049
|
+
/**
|
|
4050
|
+
* `codegen.exclude`: extra globs (relative to `lunora/`) the source walk
|
|
4051
|
+
* skips on top of the built-in test-file patterns. `unreadable` when
|
|
4052
|
+
* `codegen` is declared but `exclude` is not an array of string literals.
|
|
4053
|
+
*/
|
|
4054
|
+
codegen?: {
|
|
4055
|
+
exclude?: string[];
|
|
4056
|
+
unreadable?: boolean;
|
|
4057
|
+
};
|
|
4033
4058
|
remote?: boolean;
|
|
4034
4059
|
/**
|
|
4035
4060
|
* `services`: binding key → `{ dir, entrypoint? }` (plan 457). `unreadable`
|
|
@@ -4063,6 +4088,8 @@ interface LunoraProjectConfig {
|
|
|
4063
4088
|
advisor?: unknown;
|
|
4064
4089
|
/** The `app` hook: receives the generated `defineApp()` builder and returns it. Read by `@lunora/vite`, not by the CLI. */
|
|
4065
4090
|
app?: unknown;
|
|
4091
|
+
/** Codegen source-walk settings (`exclude`). Read through {@link readProjectConfigLiterals}. */
|
|
4092
|
+
codegen?: unknown;
|
|
4066
4093
|
/** Remote-binding dev preference. */
|
|
4067
4094
|
remote?: unknown;
|
|
4068
4095
|
/** Deploy target id. */
|
|
@@ -4093,8 +4120,9 @@ interface LoadedProjectConfig {
|
|
|
4093
4120
|
*/
|
|
4094
4121
|
declare const loadProjectConfig: (projectRoot: string) => Promise<LoadedProjectConfig>;
|
|
4095
4122
|
/**
|
|
4096
|
-
* The `target`, `remote
|
|
4097
|
-
*
|
|
4123
|
+
* The `target`, `remote`, `advisor.minSeverity`, `codegen.exclude` and
|
|
4124
|
+
* `services` LITERALS declared in the config, without evaluating it — see the
|
|
4125
|
+
* module header for what this can and cannot see, and why.
|
|
4098
4126
|
*/
|
|
4099
4127
|
declare const readProjectConfigLiterals: (projectRoot: string) => ProjectConfigLiterals;
|
|
4100
4128
|
/**
|
|
@@ -4520,4 +4548,4 @@ declare const secretKindOf: (value: string) => string | undefined;
|
|
|
4520
4548
|
/** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
|
|
4521
4549
|
declare const redact: (value: string) => string;
|
|
4522
4550
|
declare const VERSION = "0.0.0";
|
|
4523
|
-
export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
|
|
4551
|
+
export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -3228,13 +3228,29 @@ declare const AGENTS_FILENAME = "agents.ts";
|
|
|
3228
3228
|
*/
|
|
3229
3229
|
declare const discoverAgents: (project: Project, lunoraDirectory: string) => AgentIR[];
|
|
3230
3230
|
/**
|
|
3231
|
-
*
|
|
3232
|
-
*
|
|
3233
|
-
*
|
|
3234
|
-
*
|
|
3235
|
-
*
|
|
3236
|
-
|
|
3237
|
-
|
|
3231
|
+
* Whether `relativePath` (POSIX separators, with or without its extension) is
|
|
3232
|
+
* test code: a test file name, or anything under a test folder. Tests seed
|
|
3233
|
+
* tables across module boundaries and call functions from module scope by
|
|
3234
|
+
* design, so discovery skips them — they would bury real advisories and
|
|
3235
|
+
* architecture gaps under fixture noise. Secret discovery is the one reader
|
|
3236
|
+
* that keeps them (see `listLunoraSourceFiles`), and uses this to tell a
|
|
3237
|
+
* fixture apart.
|
|
3238
|
+
*/
|
|
3239
|
+
declare const isTestPath: (relativePath: string) => boolean;
|
|
3240
|
+
/**
|
|
3241
|
+
* The exported entry point: every discoverer calls this with a directory. Only
|
|
3242
|
+
* the readers that must see every file opt into `includeSkipped` — test files
|
|
3243
|
+
* and `codegen.exclude` matches included: secret discovery, because a vendor key
|
|
3244
|
+
* committed anywhere is still a leak, and the watcher fingerprint that decides
|
|
3245
|
+
* when that scan reruns. {@link walkLunoraSourceFiles}'s
|
|
3246
|
+
* accumulator/root/visited stay unexported because they are recursion state — a
|
|
3247
|
+
* caller passing a pre-filled accumulator or a stale `visited` silently changes
|
|
3248
|
+
* which files are discovered, and an exported signature freezes that hazard into
|
|
3249
|
+
* the public API snapshot.
|
|
3250
|
+
*/
|
|
3251
|
+
declare const listLunoraSourceFiles: (directory: string, options?: {
|
|
3252
|
+
includeSkipped?: boolean;
|
|
3253
|
+
}) => string[];
|
|
3238
3254
|
/**
|
|
3239
3255
|
* Discover `ctx.authApi.<method>(...)` (and bare `authApi.<method>(...)`) calls
|
|
3240
3256
|
* under the lunora source directory, each with its `CallSiteScope`.
|
|
@@ -4030,6 +4046,15 @@ interface ProjectConfigLiterals {
|
|
|
4030
4046
|
minSeverity?: string;
|
|
4031
4047
|
unreadable?: boolean;
|
|
4032
4048
|
};
|
|
4049
|
+
/**
|
|
4050
|
+
* `codegen.exclude`: extra globs (relative to `lunora/`) the source walk
|
|
4051
|
+
* skips on top of the built-in test-file patterns. `unreadable` when
|
|
4052
|
+
* `codegen` is declared but `exclude` is not an array of string literals.
|
|
4053
|
+
*/
|
|
4054
|
+
codegen?: {
|
|
4055
|
+
exclude?: string[];
|
|
4056
|
+
unreadable?: boolean;
|
|
4057
|
+
};
|
|
4033
4058
|
remote?: boolean;
|
|
4034
4059
|
/**
|
|
4035
4060
|
* `services`: binding key → `{ dir, entrypoint? }` (plan 457). `unreadable`
|
|
@@ -4063,6 +4088,8 @@ interface LunoraProjectConfig {
|
|
|
4063
4088
|
advisor?: unknown;
|
|
4064
4089
|
/** The `app` hook: receives the generated `defineApp()` builder and returns it. Read by `@lunora/vite`, not by the CLI. */
|
|
4065
4090
|
app?: unknown;
|
|
4091
|
+
/** Codegen source-walk settings (`exclude`). Read through {@link readProjectConfigLiterals}. */
|
|
4092
|
+
codegen?: unknown;
|
|
4066
4093
|
/** Remote-binding dev preference. */
|
|
4067
4094
|
remote?: unknown;
|
|
4068
4095
|
/** Deploy target id. */
|
|
@@ -4093,8 +4120,9 @@ interface LoadedProjectConfig {
|
|
|
4093
4120
|
*/
|
|
4094
4121
|
declare const loadProjectConfig: (projectRoot: string) => Promise<LoadedProjectConfig>;
|
|
4095
4122
|
/**
|
|
4096
|
-
* The `target`, `remote
|
|
4097
|
-
*
|
|
4123
|
+
* The `target`, `remote`, `advisor.minSeverity`, `codegen.exclude` and
|
|
4124
|
+
* `services` LITERALS declared in the config, without evaluating it — see the
|
|
4125
|
+
* module header for what this can and cannot see, and why.
|
|
4098
4126
|
*/
|
|
4099
4127
|
declare const readProjectConfigLiterals: (projectRoot: string) => ProjectConfigLiterals;
|
|
4100
4128
|
/**
|
|
@@ -4520,4 +4548,4 @@ declare const secretKindOf: (value: string) => string | undefined;
|
|
|
4520
4548
|
/** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
|
|
4521
4549
|
declare const redact: (value: string) => string;
|
|
4522
4550
|
declare const VERSION = "0.0.0";
|
|
4523
|
-
export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
|
|
4551
|
+
export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as l,errorAdvisoryNames as n,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DFsutD7g.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as l,errorAdvisoryNames as n,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-DFsutD7g.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-DwlmRvXo.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-5ruOnRVA.mjs";import{default as h}from"./packem_shared/discoverAuthApiCalls-CUM8XgDc.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-D8YLxYhQ.mjs";import{default as P}from"./packem_shared/discoverCrons-DI1xHRei.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as U,mayReadCapabilityContext as y,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-_kfPZ5wC.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-BGFPEEjc.mjs";import{default as W}from"./packem_shared/discoverFunctions-B-7117i2.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-BT2HmWD_.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-Bir4M-bD.mjs";import{default as w}from"./packem_shared/discoverInserts-BHxWlrW0.mjs";import{d as Y}from"./packem_shared/index-B5G7NWDW.mjs";import{default as Z}from"./packem_shared/discoverMigrations-DdeNFu0j.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-DwAZEI6d.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-Deg23AAc.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-DrBbzi0l.mjs";import{default as de}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-yKWWoX-Z.mjs";import{QUEUES_FILENAME as ce,discoverQueues as xe}from"./packem_shared/QUEUES_FILENAME-D0AeAQz-.mjs";import{default as Ee}from"./packem_shared/discoverR2sqlCalls-C48f9S0b.mjs";import{default as Ae}from"./packem_shared/discoverRlsProcedures-D3UFRjOI.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-DwG8EMHQ.mjs";import{discoverSandboxUsage as Ne}from"./packem_shared/discoverSandboxUsage-C-ntjbjl.mjs";import{default as Re}from"./packem_shared/discoverSchema-DFN2L811.mjs";import{readServiceBindings as _e,resolveServiceBindings as he}from"./packem_shared/readServiceBindings-BcN87FPt.mjs";import{SHAPES_FILENAME as Le,discoverShapes as Me}from"./packem_shared/SHAPES_FILENAME-C-CUVhR6.mjs";import{default as Pe}from"./packem_shared/discoverStorageRulesMetadata-B-f9lVjJ.mjs";import{WORKFLOWS_FILENAME as be,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-d1r1GnQd.mjs";import{emitApp as Ge}from"./packem_shared/emitApp-Dec8sEI0.mjs";import{isD1GlobalTable as je,isHyperdriveGlobalTable as Be}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as We,emitOpenApi as Ke,emitOpenApiModule as Ve}from"./packem_shared/buildOpenApiDocument-BYtXD9iB.mjs";import{OPENRPC_VERSION as Qe,buildOpenRpcDocument as qe,emitOpenRpc as we,emitOpenRpcModule as Je}from"./packem_shared/OPENRPC_VERSION-BqeEI2Dn.mjs";import{DEFAULT_TARGET as Xe,platformMatrixIds as Ze,readProjectTarget as $e,resolveCodegenTarget as er}from"./packem_shared/DEFAULT_TARGET-CaXPORLo.mjs";import{l as or,r as tr}from"./packem_shared/project-config-file-Cb5ouVEK.mjs";import{SCHEMA_SNAPSHOT_FILENAME as sr,createCodegenProject as ir,findTsconfig as mr,refreshCodegenProject as fr,runCodegen as dr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-YwnhjnM-.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as nr,evaluateSchemaDrift as cr,parseSchemaSnapshot as xr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as Er}from"./packem_shared/fingerprintSchemaSources-4S1x40Bs.mjs";import{schemaFromIr as Ar}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as gr,validatorIrToJsonSchema as Cr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Or,SDK_TARGETS as Rr,generateSdk as Tr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as hr,secretKindOf as Ir}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Mr}from"./packem_shared/emitDrizzleSchema-DohtnI8c.mjs";import{default as Pr}from"./packem_shared/emitFunctions-evl8Mx1a.mjs";import{default as br}from"./packem_shared/emitServer-DymRagL2.mjs";import{e as yr}from"./packem_shared/shard-WXSIZRpD.mjs";import{G as Hr}from"./packem_shared/shared-BXUKWh7t.mjs";import{MESSAGE_SOLUTIONS as Br,findSolutionByMessage as kr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Kr,findProjectConfigFile as Vr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as Qr,t as qr,u as wr}from"./packem_shared/shard-runtime-B1nU9CRa.mjs";import{emitApi as Yr,emitCollections as Xr}from"./packem_shared/emitApi-xDIHPRPH.mjs";import{emitCrons as $r,emitScheduler as eo,emitVectors as ro,emitWranglerCronTriggers as oo}from"./packem_shared/emitCrons-DsXsg1uG.mjs";import{emitDataModel as ao}from"./packem_shared/emitDataModel-DSk9AkJe.mjs";import{isTypedSchema as io}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Xe as DEFAULT_TARGET,j as FLAGS_FILENAME,Hr as GENERATED_HEADER,gr as LUNORA_ERROR_CODES,Br as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,Qe as OPENRPC_VERSION,Kr as PROJECT_CONFIG_FILENAMES,ce as QUEUES_FILENAME,sr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Or as SDK_LANGUAGES,Rr as SDK_TARGETS,Le as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,be as WORKFLOWS_FILENAME,We as buildOpenApiDocument,qe as buildOpenRpcDocument,nr as buildSchemaSnapshot,b as capabilitiesUsedBy,ir as createCodegenProject,l as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,h as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyConfig,le as discoverQueries,xe as discoverQueues,Ee as discoverR2sqlCalls,ge as discoverRlsMetadata,Ae as discoverRlsProcedures,Ne as discoverSandboxUsage,Re as discoverSchema,Me as discoverShapes,Pe as discoverStorageRulesMetadata,Ue as discoverWorkflows,Qr as emitAgents,Yr as emitApi,Ge as emitApp,Xr as emitCollections,qr as emitContainers,$r as emitCrons,ao as emitDataModel,Mr as emitDrizzleSchema,Pr as emitFunctions,Ke as emitOpenApi,Ve as emitOpenApiModule,we as emitOpenRpc,Je as emitOpenRpcModule,eo as emitScheduler,br as emitServer,yr as emitShard,ro as emitVectors,wr as emitWorkflows,oo as emitWranglerCronTriggers,n as errorAdvisoryNames,c as errorPlatformDiagnosticNames,cr as evaluateSchemaDrift,kr as findLunoraSolution,Vr as findProjectConfigFile,mr as findTsconfig,Er as fingerprintSchemaSources,U as foldCapabilitySignals,m as formatAdvisories,Tr as generateSdk,je as isD1GlobalTable,Be as isHyperdriveGlobalTable,R as isTestPath,io as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,or as loadProjectConfig,y as mayReadCapabilityContext,xr as parseSchemaSnapshot,Ze as platformMatrixIds,de as readPackageDependencies,tr as readProjectConfigLiterals,$e as readProjectTarget,_e as readServiceBindings,hr as redact,fr as refreshCodegenProject,er as resolveCodegenTarget,he as resolveServiceBindings,dr as runCodegen,Ar as schemaFromIr,Ir as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Cr as validatorIrToJsonSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./isTestPath-5ruOnRVA.mjs";import{a as h}from"./attribution-B7i322L0.mjs";const E="agents.ts",v=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return e.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:e.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),x=(o,n,e)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${e}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},I=(o,n)=>{const e=o.getArguments()[0];if(!e||!a.isObjectLiteralExpression(e))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const t={className:b(n),exportName:n,name:d(n)},i=c(e,"name");i&&a.isPropertyAssignment(i)&&(t.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(e,"publicRun");r&&a.isPropertyAssignment(r)&&x(r.getInitializerOrThrow(),n,"publicRun")&&(t.publicRun=!0);const s=c(e,"voice");if(s&&a.isPropertyAssignment(s)){const m=s.getInitializerOrThrow();if(!a.isObjectLiteralExpression(m))throw l(m,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);t.voice=!0,t.voiceBindingName=N(n),t.voiceClassName=y(n)}return c(e,"onEmail")&&(t.onEmail=!0),t},S=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const i=t.getExpression();if(!a.isIdentifier(i)||!v(i))continue;const r=e.getNameNode();if(!a.isIdentifier(r)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(r,"defineAgent exports must be plain named exports (no destructuring)")}const s=h(e,"binding");s!==void 0&&n.push(I(t,s))}return n},T=o=>{const n=new Map,e=new Map;for(const t of o){const i=n.get(t.name);if(i!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${i}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const r=e.get(t.className);if(r!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${r}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},z=(o,n)=>{const e=f(n,E);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),i=S(t);return i.sort((r,s)=>r.exportName.localeCompare(s.exportName)),T(i),i};export{E as AGENTS_FILENAME,z as discoverAgents};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as T}from"node:fs";import{join as j}from"node:path";import{containerClassName as I,containerBindingName as A,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as O,isManagedImage as k,isCloudflareRegistryDigest as C,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as S,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as _,findObjectProperty as p,symbolConstInitializer as D,outermostValueWrapper as w,isWriteTarget as M}from"./isTestPath-5ruOnRVA.mjs";import{a as F}from"./attribution-B7i322L0.mjs";import{a as b}from"./project-config-file-Cb5ouVEK.mjs";const V="containers.ts",K=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const n of e.getDeclarations())if(s.isImportSpecifier(n))return n.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:n.getNameNode().getText()==="defineContainer";return!1},d=_("container"),y=(t,e,n)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${n}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},$=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const n=p(t,"registry");if(n&&s.isPropertyAssignment(n)){const r=n.getInitializerOrThrow();return f({registry:d(r,e,"image.registry")})}const i=p(t,"build");if(i&&s.isPropertyAssignment(i)){const r=i.getInitializerOrThrow();return f({build:d(r,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},B=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),R=new Set(["gracePeriodSeconds","stepPercentage"]),E=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},U=(t,e)=>e.getDescendantsOfKind(S.Identifier).some(n=>{if(n.getSymbol()!==t)return!1;let i=w(n),r=i.getParent();if(s.isCallExpression(r)&&r.getExpression().getText()==="Object.assign")return r.getArguments()[0]===i;for(;(s.isPropertyAccessExpression(r)||s.isElementAccessExpression(r))&&r.getExpression()===i;){if(M(r))return!0;i=w(r),r=i.getParent()}return!1}),z=16,L=(t,e,n,i)=>{let r={name:n,symbol:t},o;for(let c=0;c<z;c+=1){const l=D(r.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=E(l),s.isObjectLiteralExpression(o)&&r.symbol!==void 0&&U(r.symbol,e.getSourceFile()))throw a(e,`${i}: \`${r.name}\` is a const object that is written to elsewhere in this file, so its initializer is not the value the container runs with. Declare the settings where they are final.`);if(!s.isIdentifier(o))return o;r={name:o.getText(),symbol:o.getSymbol()}}return o},P=(t,e)=>{const n=E(t);return s.isIdentifier(n)?L(n.getSymbol(),n,n.getText(),e)??n:n},N=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(i=>i.getApparentType().getProperties().map(r=>r.getName()))},Y=(t,e,n)=>{const i=t.getExpression().getType(),r=e==="every"||i.isAny()||i.isUnknown()?["its keys"]:[...new Set(N(i))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(r.length>0)throw a(t,`${n}: this spread can set ${r.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},W=(t,e,n)=>{const i=b(t),r=s.isShorthandPropertyAssignment(t)?L(t.getValueSymbol(),t,i,n):void 0;if(r!==void 0)return[i,r];if(e==="every"||e.has(i))throw a(t,`${n}: \`${i}\` is deploy configuration codegen writes into wrangler.jsonc, so it must be a static literal — inline it, or name a module-scope \`const\` initialized with one.`)},m=(t,e,n,i=new Set)=>{const r=[],o=new Set(i).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))r.push([b(c),P(c.getInitializerOrThrow(),n)]);else if(s.isSpreadAssignment(c))r.push(...q(c,e,n,o));else{const l=W(c,e,n);l!==void 0&&r.push(l)}return r},q=(t,e,n,i)=>{const r=P(t.getExpression(),n);if(!s.isObjectLiteralExpression(r))return Y(t,e,n),[];if(i.has(r))throw a(t,`${n}: this spread refers back to an object it is part of, so it has no static value.`);return m(r,e,n,i)},x=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`buildArgs\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const n={};for(const[i,r]of m(t,"every",`container "${e}" buildArgs`))n[i]=d(r,e,`buildArgs.${i}`);return Object.keys(n).length>0?n:void 0},H=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`rollout\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const n={};for(const[i,r]of m(t,R,`container "${e}" rollout`))(i==="gracePeriodSeconds"||i==="stepPercentage")&&(n[i]=y(r,e,`rollout.${i}`));return n.gracePeriodSeconds===void 0&&n.stepPercentage===void 0?void 0:n},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},J=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},X=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const n={};for(const i of t.getProperties()){if(!s.isPropertyAssignment(i))throw a(i,`container "${e}": \`instanceType\` must be an object of static number literals`);const r=b(i);if(r!=="diskMb"&&r!=="memoryMib"&&r!=="vcpu")throw a(i,`container "${e}": unknown \`instanceType\` field "${r}" — expected vcpu, memoryMib, or diskMb`);n[r]=y(i.getInitializerOrThrow(),e,`instanceType.${r}`)}return n}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},G=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`images\` must be a static object literal — codegen writes it into wrangler.jsonc`);const n={};for(const[i,r]of m(t,"every",`container "${e}" images`)){const o=$(r,e);if(o.kind==="build")throw a(r,`container "${e}": \`images["${i}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!C(o.reference))throw a(r,`container "${e}": \`images["${i}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);n[i]=o}return n},Q=(t,e)=>{const n=t.findLast(([r])=>r==="schedulingPolicy");if(n===void 0)return;const i=d(n[1],e,"schedulingPolicy");if(i!=="default"&&i!=="durable_object")throw a(n[1],`container "${e}": unknown \`schedulingPolicy\` "${i}" — use "default" or "durable_object"`);return i==="durable_object"?i:void 0},Z=(t,e,n,i)=>{if(n!==void 0&&O.includes(t))throw a(e,`container "${i}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(n===void 0&&t==="images")throw a(e,`container "${i}": \`images\` needs schedulingPolicy "durable_object"`)},ee=(t,e,n,i)=>{const{base:r,policy:o}=n;switch(t){case"buildArgs":{r.buildArgs=x(e,i);break}case"enableInternet":{r.enableInternet=v(e);break}case"image":{n.scheduled||(o.image=$(e,i));break}case"images":{o.images=G(e,i);break}case"instanceType":{r.instanceType=X(e,i);break}case"maxInstances":{o.maxInstances=y(e,i,"maxInstances");break}case"name":{r.name=d(e,i,"name");break}case"rollout":{o.rollout=H(e,i);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${i}": \`sandbox\` must be a static true/false literal`);r.sandbox=c;break}case"sleepAfter":{r.sleepAfter=J(e);break}}},te=(t,e,n)=>{const i=t.findLast(([o])=>o==="image")?.[1];if(i===void 0||!(s.isStringLiteral(i)||s.isNoSubstitutionTemplateLiteral(i)))return;const r=i.getLiteralValue();if(!Object.hasOwn(e??{},r)&&!k(r))throw a(i,`container "${n}": \`image\` "${r}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ie=(t,e)=>{const n=t.getArguments()[0];if(!n||!s.isObjectLiteralExpression(n))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const i=m(n,B,`container "${e}"`),r=Q(i,e),o={base:{bindingName:A(e),className:I(e),exportName:e},policy:{},scheduled:r!==void 0};for(const[g,u]of i)Z(g,u,r,e),ee(g,u,o,e);const{base:c,policy:l}=o;if(r==="durable_object")return te(i,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:r};if(l.image===void 0)throw a(n,`container "${e}": defineContainer requires a static \`image\` property`);return{...c,image:l.image,...l.maxInstances===void 0?{}:{maxInstances:l.maxInstances},...l.rollout===void 0?{}:{rollout:l.rollout}}},ne=t=>{const e=[],n=new Map;for(const i of t.getVariableDeclarations()){const r=i.getInitializer();if(r?.getKind()!==S.CallExpression)continue;const o=r,c=o.getExpression();if(!s.isIdentifier(c)||!K(c))continue;const l=i.getNameNode();if(!s.isIdentifier(l)){if(i.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=F(i,"binding");if(g===void 0)continue;const u=ie(o,g),h=n.get(u.bindingName);if(h!==void 0)throw a(l,`containers "${h}" and "${u.exportName}" both map to the binding ${u.bindingName} — rename one so each container gets its own Durable Object binding`);n.set(u.bindingName,u.exportName),e.push(u)}return e},de=(t,e)=>{const n=j(e,V);if(!T(n))return[];const i=t.getSourceFile(n)??t.addSourceFileAtPath(n),r=ne(i);return r.sort((o,c)=>o.exportName.localeCompare(c.exportName)),r};export{V as CONTAINERS_FILENAME,de as discoverContainers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{r as g}from"./project-config-file-Cb5ouVEK.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",analyticsSql:"analyticsSql",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:null},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-5ruOnRVA.mjs";const d="flags.ts",u=new Set(["@lunora/flags/providers/flagship","lunorash/flags/flagship"]),m=e=>{const i=e.getSymbol();if(!i)return e.getText()==="flagshipProvider";for(const r of i.getDeclarations())if(t.isImportSpecifier(r))return u.has(r.getImportDeclaration().getModuleSpecifierValue())?r.getNameNode().getText()==="flagshipProvider":!1;return!1},v=(e,i)=>{const r=c(e,i);if(!r||!t.isPropertyAssignment(r))return;const o=r.getInitializerOrThrow();if(t.isStringLiteral(o)||t.isNoSubstitutionTemplateLiteral(o))return o.getLiteralValue()},h=e=>{const i=e.getArguments()[0];if(i&&t.isObjectLiteralExpression(i)){const r=v(i,"binding");if(r!==void 0&&r.length>0)return{bindingName:r,mode:"binding",provider:"flagship"}}return{mode:"http",provider:"flagship"}},S=e=>f(e.getArguments()[0],"provider"),b=(e,i)=>{const r=p(i,d);if(!l(r))return;const o=e.getSourceFile(r)??e.addSourceFileAtPath(r),n=g(o);if(!n||!t.isCallExpression(n))return{provider:"custom"};const s=S(n);if(s&&t.isCallExpression(s)){const a=s.getExpression();if(t.isIdentifier(a)&&m(a))return h(s)}return{provider:"custom"}};export{d as FLAGS_FILENAME,b as discoverFlags};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as E}from"node:fs";import{join as y}from"node:path";import{Node as o,SyntaxKind as l}from"ts-morph";import{diagnosticAt as I}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as M}from"./module-specifiers-WF8iAydP.mjs";import{p as A}from"./parse-validator-C2Osg6gv.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-5ruOnRVA.mjs";import{j as D,i as b,f as g,d as O}from"./attribution-B7i322L0.mjs";import{u as w}from"./unwrap-handler-return-CM6v2E3A.mjs";const z="mutators.ts",x=M,h=r=>{const e=r.getSymbol();if(!e)return r.getText()==="defineMutator";for(const t of e.getDeclarations())if(o.isImportSpecifier(t))return x(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineMutator":!1;return!1},C=r=>{const e=r.getSymbol();if(!e)return!1;for(const t of e.getDeclarations()){if(!o.isNamespaceImport(t))continue;const i=t.getFirstAncestorByKind(l.ImportDeclaration);return i!==void 0&&x(i.getModuleSpecifierValue())}return!1},N=r=>{if(o.isIdentifier(r))return h(r);if(o.isPropertyAccessExpression(r)){const e=r.getExpression();return r.getName()==="defineMutator"&&o.isIdentifier(e)&&C(e)}return!1},S=r=>{const e=r.getArguments()[0];return e&&o.isObjectLiteralExpression(e)?e:void 0},m=new WeakMap,p=r=>{let e=m.get(r.compilerNode);if(e===void 0){const t=r.getNameNode(),i=t?.getText();e=r.getSourceFile().getDescendantsOfKind(l.Identifier).filter(s=>s!==t&&s.getText()===i&&g(s)?.compilerNode===r.compilerNode).length===1&&O(r)===void 0,m.set(r.compilerNode,e)}return e},f=r=>{const e=o.isIdentifier(r)?g(r):void 0,t=o.isSourceFile(e?.getParent())||o.isSourceFile(e?.getParent()?.getParent()?.getParent());if(e===void 0||e.getSourceFile()!==r?.getSourceFile()||!t)return;if(o.isFunctionDeclaration(e))return e.hasBody()&&p(e)?e:void 0;const i=P(e)?d(e.getInitializer()):void 0;return(o.isArrowFunction(i)||o.isFunctionExpression(i))&&o.isVariableDeclaration(e)&&p(e)?i:void 0},G=r=>{const e=r.getInitializer();if(!o.isCallExpression(e)||!N(e.getExpression()))return;const t=c(S(e),"server");if(o.isMethodDeclaration(t))return t;if(o.isShorthandPropertyAssignment(t))return f(t.getNameNode());const i=o.isPropertyAssignment(t)?d(t.getInitializer()):void 0;return o.isArrowFunction(i)||o.isFunctionExpression(i)?i:f(i)},T=r=>{const e=c(r,"args");if(!e||!o.isPropertyAssignment(e))return{};const t=e.getInitializer();return t&&o.isObjectLiteralExpression(t)?A(t):{}},L=r=>{const e=c(r,"server");if(!e||!o.isPropertyAssignment(e))return"unknown";const t=e.getInitializer();return!t||!(o.isArrowFunction(t)||o.isFunctionExpression(t))?"unknown":w(t)},j=r=>{const e=c(r,"owner");if(!e||!o.isPropertyAssignment(e))return;const t=e.getInitializer();return t&&o.isStringLiteral(t)?t.getLiteralValue():void 0},R=r=>{const e=[];for(const t of r.getVariableDeclarations()){if(!t.isExported())continue;const i=t.getInitializer();if(i?.getKind()!==l.CallExpression)continue;const n=i,s=n.getExpression();if(!N(s))continue;const a=t.getNameNode();if(!o.isIdentifier(a))throw I(a,"defineMutator exports must be plain named exports (no destructuring)");const u=S(n);for(const v of D(t).filter(F=>b(F)))e.push({args:T(u),exportName:v,filePath:"mutators",line:n.getStartLineNumber(),owner:j(u),returnType:L(u)})}return e},J=(r,e)=>{const t=y(e,z);if(!E(t))return[];const i=r.getSourceFile(t)??r.addSourceFileAtPath(t),n=R(i);return n.sort((s,a)=>s.exportName.localeCompare(a.exportName)),n};export{z as MUTATORS_FILENAME,J as discoverMutators,N as isDefineMutatorCallee,S as mutatorLiteral,G as mutatorServerImplOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as P}from"node:fs";import{join as S}from"node:path";import{SyntaxKind as l,Node as f}from"ts-morph";import{listLunoraSourceFiles as p,lunoraRelativePath as y,defaultExportExpression as E,findObjectProperty as d,handlerOf as g}from"./isTestPath-5ruOnRVA.mjs";import{b as N,d as v}from"./attribution-B7i322L0.mjs";import{i as a}from"./context-root-C4hjiCTo.mjs";import{c as F}from"./classify-procedure-call-DC_O3oNQ.mjs";const O="notify.ts",A=new Set(["chat","inApp","send","webhook"]),h=new Set(["broadcast","send"]),b=e=>{const t=e.getInitializer();if(!t||!f.isCallExpression(t))return;const o=F(t);if(!o)return;const r=g(t,o.receiver);return r?{exportName:v(e)??e.getName(),handler:r,kind:o.kind}:void 0},m=e=>{const t=[];for(const o of N(e)){const r=b(o);r&&t.push(r)}return t},x=e=>a(e,["notify"])?"notify":a(e,["push"])||a(e,["notify","push"])?"push":void 0,k=e=>{if(!f.isPropertyAccessExpression(e))return;const t=e.getName(),o=x(e.getExpression());if(o==="notify"&&A.has(t))return`ctx.notify.${t}`;if(o==="push"&&h.has(t))return`ctx.push.${t}`},C=e=>f.isPropertyAccessExpression(e)?x(e.getExpression())==="push"&&h.has(e.getName()):!1,M=(e,t)=>{const o=[];for(const r of p(t)){const n=e.getSourceFile(r)??e.addSourceFileAtPath(r),c=y(t,r);for(const s of m(n))if(!(s.kind!=="query"&&s.kind!=="mutation"))for(const i of s.handler.getDescendantsOfKind(l.PropertyAccessExpression)){const u=k(i);u!==void 0&&o.push({callee:u,exportName:s.exportName,file:c,kind:s.kind,line:i.getStartLineNumber()})}}return o},D=(e,t)=>{for(const o of p(t)){const r=e.getSourceFile(o)??e.addSourceFileAtPath(o);for(const n of m(r))for(const c of n.handler.getDescendantsOfKind(l.PropertyAccessExpression))if(C(c))return!0}return!1},z=(e,t)=>{const o=S(t,O);if(!P(o))return;const r=e.getSourceFile(o)??e.addSourceFileAtPath(o),n=E(r);let c=!1,s=!1;if(n&&f.isCallExpression(n)){const i=n.getArguments()[0];i&&f.isObjectLiteralExpression(i)&&(c=d(i,"webPush")!==void 0,s=d(i,"fcm")!==void 0)}return{hasFcm:s,hasWebPush:c,usesPush:D(e,t)}};export{O as NOTIFY_FILENAME,M as discoverNotifyCalls,z as discoverNotifyConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m}from"./modules-
|
|
1
|
+
import{m}from"./modules-DQv8-RtF.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{s as p}from"./paths-C-9fwEgQ.mjs";import{validatorIrToJsonSchema as l,objectSchema as d,LUNORA_ERROR_CODES as i}from"./LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{G as R}from"./shared-BXUKWh7t.mjs";const h="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},f=(e,n)=>{const t=`${p(e.filePath)}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${t}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${t}", "args": { … } }\`).`,errors:i.map((r,a)=>({code:-32e3-a,data:{code:r},message:r})),name:t,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:d(e.args)}],result:{name:"result",schema:e.output?l(e.output):g},summary:`${e.kind}: ${t}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},O=e=>{const n=e.version??"0.0.0",s=e.functions.filter(o=>o.visibility!=="internal"&&o.kind!=="stream"),t=e.modules??[],r=s.map(o=>f(o,m(t,o.filePath))).toSorted((o,c)=>o.name.localeCompare(c.name));return{info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora RPC",version:n},methods:r,openrpc:h}},E=e=>`${JSON.stringify(O(e),void 0,2)}
|
|
2
2
|
`,b=e=>`${R}export const openRpcSpec = ${u(e,"Record<string, unknown>")};
|
|
3
3
|
`;export{h as OPENRPC_VERSION,O as buildOpenRpcDocument,E as emitOpenRpc,b as emitOpenRpcModule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as b}from"node:fs";import{join as h}from"node:path";import{LunoraError as f}from"@lunora/errors";import{queueDefaultName as y,queueBindingName as q}from"@lunora/queue";import{SyntaxKind as N,Node as c}from"ts-morph";import{diagnosticAt as d}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{findObjectProperty as m,stringPropertyFor as w}from"./isTestPath-5ruOnRVA.mjs";import{a as x}from"./attribution-B7i322L0.mjs";import{r as v}from"./handler-reference-DaXlBYJx.mjs";const E="queues.ts",S=i=>{const t=e=>e==="defineQueue"||e==="defineSubscription"||e==="defineTopic",o=i.getSymbol();if(!o){const e=i.getText();return t(e)?e:void 0}for(const e of o.getDeclarations()){if(!c.isImportSpecifier(e))continue;if(e.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/queue")return;const r=e.getNameNode().getText();return t(r)?r:void 0}},l=w("queue"),$=(i,t,o)=>{if(c.isNumericLiteral(i))return i.getLiteralValue();throw d(i,`queue "${t}": \`${o}\` must be a static numeric literal — it is deploy configuration codegen writes into wrangler.jsonc`)},I=(i,t)=>{const o=m(i,"name");if(!o||!c.isPropertyAssignment(o))return;const e=l(o.getInitializerOrThrow(),t,"name");if(e.length===0)throw d(o,`queue "${t}": \`name\` must be a non-empty string when provided`);return e},g=(i,t,o,e)=>{const r=v(m(i,"handler"),e)?.site,s={bindingName:q(t),exportName:t,mode:"push",name:I(i,t)??y(t),...o===void 0?{}:{topic:o},...r===void 0?{}:{handlerSite:r},tuning:{}},n=m(i,"mode");if(n&&c.isPropertyAssignment(n)){if(o!==void 0)throw d(n,`subscription "${t}": \`mode\` is not allowed — a subscription is always a push consumer`);const u=l(n.getInitializerOrThrow(),t,"mode");if(u!=="push"&&u!=="pull")throw d(n,`queue "${t}": \`mode\` must be "push" or "pull" (got ${JSON.stringify(u)})`);s.mode=u}const a=m(i,"deadLetterQueue");a&&c.isPropertyAssignment(a)&&(s.tuning.deadLetterQueue=l(a.getInitializerOrThrow(),t,"deadLetterQueue"));for(const u of["maxBatchSize","maxBatchTimeout","maxRetries","retryDelay"]){const p=m(i,u);p&&c.isPropertyAssignment(p)&&(s.tuning[u]=$(p.getInitializerOrThrow(),t,u))}return s},P=(i,t,o)=>{const e=i.getArguments()[0];if(!e||!c.isObjectLiteralExpression(e))throw d(i,`queue "${t}": defineQueue must be passed an inline object literal`);return g(e,t,void 0,o)},T=(i,t,o,e)=>{const[r,s]=i.getArguments();if(!r||!c.isIdentifier(r)||!o.has(r.getText()))throw d(r??i,`subscription "${t}": the first argument must name a \`defineTopic()\` export of lunora/queues.ts`);if(!s||!c.isObjectLiteralExpression(s))throw d(i,`subscription "${t}": defineSubscription must be passed an inline object literal`);return g(s,t,o.get(r.getText()),e)},A=i=>{const t=[];for(const o of i.getVariableDeclarations()){const e=o.getInitializer();if(e?.getKind()!==N.CallExpression)continue;const r=e,s=r.getExpression(),n=c.isIdentifier(s)?S(s):void 0;if(n===void 0)continue;const a=o.getNameNode();if(!c.isIdentifier(a)){if(o.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw d(a,`${n} exports must be plain named exports (no destructuring)`)}const u=x(o,"binding");u!==void 0&&t.push({call:r,exportName:u,factory:n,localName:a.getText()})}return t},Q=(i,t)=>{const o=A(i),e=new Map(o.filter(n=>n.factory==="defineTopic").map(n=>[n.localName,n.exportName])),r=[];for(const n of o)n.factory==="defineQueue"?r.push(P(n.call,n.exportName,t)):n.factory==="defineSubscription"&&r.push(T(n.call,n.exportName,e,t));const s=[...e.values()].map(n=>({exportName:n}));return{queues:r,topics:s}},L=i=>{const t=new Map,o=new Map;for(const e of i){const r=t.get(e.name);if(r!==void 0)throw new f("DUPLICATE_QUEUE_NAME",`Duplicate queue name "${e.name}": produced by both "${r}" and "${e.exportName}". Deployed queue names must be unique across the project.`,{status:500});t.set(e.name,e.exportName);const s=o.get(e.bindingName);if(s!==void 0)throw new f("DUPLICATE_QUEUE_BINDING",`Duplicate queue binding "${e.bindingName}": produced by both "${s}" and "${e.exportName}". Queue export names must yield unique binding names.`,{status:500});o.set(e.bindingName,e.exportName)}},O=(i,t)=>{const o=h(t,E);if(!b(o))return{queues:[],topics:[]};const e=i.getSourceFile(o)??i.addSourceFileAtPath(o),{queues:r,topics:s}=Q(e,t),n=r.toSorted((a,u)=>a.exportName.localeCompare(u.exportName));return L(n),{queues:n,topics:s.toSorted((a,u)=>a.exportName.localeCompare(u.exportName))}},V=(i,t)=>O(i,t).queues;export{E as QUEUES_FILENAME,O as discoverQueueDeclarations,V as discoverQueues};
|