@supacloud/compiler 0.45.1 → 0.46.1

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.d.ts CHANGED
@@ -25,7 +25,7 @@ export interface SupaCloudConfig {
25
25
  commandCapabilities?: CommandExecutionCapabilities;
26
26
  treeShakeUnusedProviders?: boolean;
27
27
  }
28
- export declare const DEFAULT_SUPACLOUD_CONFIG: Required<Omit<SupaCloudConfig, "include" | "moduleBoundaryPreset" | "moduleBoundaries" | "typeSafety" | "delivery" | "allowRouteCommandBindings" | "disallowControllerDirectDb" | "detectOrphanModules" | "openApi" | "effect">> & {
28
+ export declare const DEFAULT_SUPACLOUD_CONFIG: Required<Omit<SupaCloudConfig, "include" | "moduleBoundaryPreset" | "moduleBoundaries" | "typeSafety" | "delivery" | "allowRouteCommandBindings" | "openApi" | "effect">> & {
29
29
  include: string[];
30
30
  moduleBoundaryPreset: ModuleBoundaryPresetName;
31
31
  effect: NonNullable<CompileOptions["effect"]>;
@@ -47,8 +47,8 @@ export declare function resolveSupacloudConfig(config?: SupaCloudConfig, cwd?: s
47
47
  typeSafety?: NonNullable<CompileOptions["typeSafety"]>;
48
48
  databaseGovernance?: NonNullable<CompileOptions["databaseGovernance"]>;
49
49
  allowRouteCommandBindings?: boolean;
50
- disallowControllerDirectDb?: boolean;
51
- detectOrphanModules?: boolean;
50
+ disallowControllerDirectDb: boolean;
51
+ detectOrphanModules: boolean;
52
52
  effect?: NonNullable<CompileOptions["effect"]>;
53
53
  treeShakeUnusedProviders: boolean;
54
54
  graphql?: GraphqlOptions;
@@ -43,14 +43,19 @@ declare const requestSchema: Type.TObject<{
43
43
  }>>;
44
44
  targets: Type.TOptional<Type.TArray<Type.TObject<{
45
45
  name: Type.TString;
46
- kind: Type.TUnion<[Type.TLiteral<"api">, Type.TLiteral<"jobs">, Type.TLiteral<"webhook">]>;
47
- modules: Type.TArray<Type.TString>;
46
+ kind: Type.TUnion<[Type.TLiteral<"api">, Type.TLiteral<"jobs">, Type.TLiteral<"webhook">, Type.TLiteral<"function">]>;
47
+ modules: Type.TOptional<Type.TArray<Type.TString>>;
48
48
  isolation: Type.TOptional<Type.TUnion<[Type.TLiteral<"shared">, Type.TLiteral<"process">]>>;
49
49
  capabilities: Type.TOptional<Type.TArray<Type.TString>>;
50
50
  compute: Type.TOptional<Type.TObject<{
51
51
  cpuLimit: Type.TNumber;
52
52
  memoryLimitMiB: Type.TInteger;
53
53
  }>>;
54
+ function: Type.TOptional<Type.TObject<{
55
+ slug: Type.TString;
56
+ entrypoint: Type.TString;
57
+ verifyJwt: Type.TBoolean;
58
+ }>>;
54
59
  }>>>;
55
60
  runtime: Type.TOptional<Type.TObject<{
56
61
  processIsolation: Type.TBoolean;
@@ -10064,6 +10064,11 @@ function parseDeliveryOptions(value) {
10064
10064
  if (value.targets?.some((target) => target.compute && target.isolation === "shared")) {
10065
10065
  throw new DeliveryConfigurationError;
10066
10066
  }
10067
+ for (const target of value.targets ?? []) {
10068
+ const invalidShape = target.kind === "function" ? target.function === undefined || target.modules !== undefined || target.compute !== undefined : target.modules === undefined || target.function !== undefined;
10069
+ if (invalidShape)
10070
+ throw new DeliveryConfigurationError;
10071
+ }
10067
10072
  const migrations = value.build?.migrations ?? [];
10068
10073
  try {
10069
10074
  validateWorkerExecution(value.execution?.groups ?? []);
@@ -10080,7 +10085,7 @@ function parseDeliveryPlanResult(value) {
10080
10085
  throw new Error("Invalid delivery plan result.");
10081
10086
  return value;
10082
10087
  }
10083
- var objectOptions, reference, references, kind, isolation, DeliveryFilePathSchema, DeliveryOptionsSchema, DeliveryDiagnosticSchema, routeSchema, jobSchema, DeliveryTargetSchema, DeliveryPlanSchema, DeliveryPlanResultSchema, DeliveryConfigurationError;
10088
+ var objectOptions, reference, references, kind, isolation, DeliveryFilePathSchema, functionTarget, DeliveryOptionsSchema, DeliveryDiagnosticSchema, routeSchema, jobSchema, DeliveryTargetSchema, DeliveryPlanSchema, DeliveryPlanResultSchema, DeliveryConfigurationError;
10084
10089
  var init_delivery_schema = __esm(() => {
10085
10090
  init_build2();
10086
10091
  init_value2();
@@ -10088,22 +10093,28 @@ var init_delivery_schema = __esm(() => {
10088
10093
  objectOptions = { additionalProperties: false };
10089
10094
  reference = String2({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z][A-Za-z0-9_.:/-]*$" });
10090
10095
  references = _Array_(reference, { uniqueItems: true });
10091
- kind = Union([Literal("api"), Literal("jobs"), Literal("webhook")]);
10096
+ kind = Union([Literal("api"), Literal("jobs"), Literal("webhook"), Literal("function")]);
10092
10097
  isolation = Union([Literal("shared"), Literal("process")]);
10093
10098
  DeliveryFilePathSchema = String2({
10094
10099
  maxLength: 512,
10095
10100
  pattern: "^(?:[A-Za-z0-9_-][A-Za-z0-9_.-]*/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*$"
10096
10101
  });
10102
+ functionTarget = _Object_({
10103
+ slug: String2({ pattern: "^[a-z][a-z0-9-]{0,62}$" }),
10104
+ entrypoint: DeliveryFilePathSchema,
10105
+ verifyJwt: Boolean2()
10106
+ }, objectOptions);
10097
10107
  DeliveryOptionsSchema = _Object_({
10098
10108
  version: Literal(1),
10099
10109
  execution: Optional(WorkerExecutionSchema),
10100
10110
  targets: Optional(_Array_(_Object_({
10101
10111
  name: String2({ pattern: "^[a-z][a-z0-9-]{0,62}$" }),
10102
10112
  kind,
10103
- modules: _Array_(reference, { minItems: 1, uniqueItems: true }),
10113
+ modules: Optional(_Array_(reference, { minItems: 1, uniqueItems: true })),
10104
10114
  isolation: Optional(isolation),
10105
10115
  capabilities: Optional(references),
10106
- compute: Optional(ComputeResourcesSchema)
10116
+ compute: Optional(ComputeResourcesSchema),
10117
+ function: Optional(functionTarget)
10107
10118
  }, objectOptions))),
10108
10119
  runtime: Optional(_Object_({
10109
10120
  processIsolation: Boolean2(),
@@ -10181,6 +10192,7 @@ var init_delivery_schema = __esm(() => {
10181
10192
  routes: _Array_(routeSchema),
10182
10193
  jobs: _Array_(jobSchema),
10183
10194
  externalTokens: _Array_(String2()),
10195
+ function: Optional(functionTarget),
10184
10196
  requirements: _Object_({
10185
10197
  processIsolation: Boolean2(),
10186
10198
  durableQueue: Boolean2(),
@@ -1,3 +1,5 @@
1
1
  import type { ApplicationGraph, Diagnostic, EffectCompilerOptions } from "./types";
2
2
  /** Validates the static Effect contract without inspecting Effect runtime internals. */
3
3
  export declare function validateEffectPolicies(graph: ApplicationGraph, options?: EffectCompilerOptions): Diagnostic[];
4
+ /** A retrying job must replay the same request without duplicating a write. */
5
+ export declare function validateJobPolicies(graph: ApplicationGraph): Diagnostic[];
package/dist/index.d.ts CHANGED
@@ -54,7 +54,7 @@ export { camelName } from "./util";
54
54
  export { ANGULAR_ENTERPRISE_RULES, CLEAN_ARCHITECTURE_RULES, MODULAR_MONOLITH_RULES, MODULE_BOUNDARY_PROFILES, getModuleBoundaryPreset, getModuleBoundaryProfile, resolveModuleBoundaries, } from "./profiles";
55
55
  export type { ApplicationGraph, AspectRefNode, CachedModuleEntry, CheckProjectResult, CommandExecutionCapabilities, CommandNode, CompileOptions, DatabaseGovernanceOptions, CompileResult, CompileStats, ControllerNode, DependencyGraphCache, DependencyGraphIndex, Diagnostic, DiagnosticFix, EffectCompilerOptions, EffectErrorMappingNode, EffectRetryPolicy, EffectRouteNode, ModuleBoundaryPresetName, ModuleBoundaryProfile, ModuleBoundaryRule, ModuleNode, JobNode, ProviderKind, ProviderNode, QueryNode, RouteNode, Scope, TokenKind, TypeSafetyOptions, ValidateOptions, WatchEvent, WatchHandle, WatchOptions, FeatureSpecNode, FeatureTransitionNode, GraphqlOptions, GraphqlContractSummary, OpenApiOptions, OpenApiSecurityScheme, OpenApiServer, } from "./types";
56
56
  export { inspectRouteContracts, validateRouteContracts } from "./route-contracts";
57
- export { validateEffectPolicies } from "./effect-governance";
57
+ export { validateEffectPolicies, validateJobPolicies } from "./effect-governance";
58
58
  export { pullGraphqlSchema } from "./graphql-schema";
59
59
  export type { PullGraphqlSchemaOptions } from "./graphql-schema";
60
60
  export { checkGraphqlCompatibility, createRoleSnapshotReport, diffGraphqlSchemas, graphqlFeatureMatrix, introspectionQuery, readGraphqlSchema, schemaFromSource, } from "./graphql-governance";