@supacloud/cli 0.49.1 → 0.50.0

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 (2) hide show
  1. package/dist/index.js +209 -15
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -184371,9 +184371,10 @@ async function analyzeProject(rootDir, include, cache, changedPaths) {
184371
184371
  className: classInfo.decl.name?.text ?? name,
184372
184372
  name: stringLiteralProp(meta, "name") ?? classInfo.decl.name?.text ?? name,
184373
184373
  permission: stringLiteralProp(meta, "permission"),
184374
- transaction: commandModeProp(meta, "transaction") ?? "none",
184374
+ rpc: checkedRpc(meta, ctx),
184375
+ transaction: checkedCommandMode(meta, "transaction", ctx, classInfo.decl.name?.text ?? name) ?? "none",
184375
184376
  audit: stringLiteralProp(meta, "audit"),
184376
- idempotency: commandModeProp(meta, "idempotency") ?? "none",
184377
+ idempotency: checkedCommandMode(meta, "idempotency", ctx, classInfo.decl.name?.text ?? name) ?? "none",
184377
184378
  standalone: true,
184378
184379
  aspects: parseAspectRefs(getProp(meta, "aspects"), ctx, `command ${classInfo.decl.name?.text ?? name}`)
184379
184380
  });
@@ -184663,9 +184664,10 @@ function parseModule(candidate, nameByNode, ctx) {
184663
184664
  className: cls.name?.text ?? "<anonymous>",
184664
184665
  name: stringLiteralProp(meta, "name") ?? cls.name?.text ?? "<anonymous>",
184665
184666
  permission: stringLiteralProp(meta, "permission"),
184666
- transaction: commandModeProp(meta, "transaction") ?? "none",
184667
+ rpc: checkedRpc(meta, ctx),
184668
+ transaction: checkedCommandMode(meta, "transaction", ctx, cls.name?.text ?? "<anonymous>") ?? "none",
184667
184669
  audit: stringLiteralProp(meta, "audit"),
184668
- idempotency: commandModeProp(meta, "idempotency") ?? "none",
184670
+ idempotency: checkedCommandMode(meta, "idempotency", ctx, cls.name?.text ?? "<anonymous>") ?? "none",
184669
184671
  ...booleanProp(meta, "standalone") ? { standalone: true } : {},
184670
184672
  ...aspects2.length > 0 ? { aspects: aspects2 } : {}
184671
184673
  });
@@ -184795,6 +184797,31 @@ function commandModeProp(object, name) {
184795
184797
  const value = stringLiteralProp(object, name);
184796
184798
  return value === "required" || value === "none" ? value : undefined;
184797
184799
  }
184800
+ function checkedCommandMode(object, property, ctx, command) {
184801
+ const expression = getProp(object, property);
184802
+ const value = commandModeProp(object, property);
184803
+ if (expression && value === undefined) {
184804
+ const file = sourcePath(ctx.rootDir, expression.getSourceFile().fileName);
184805
+ ctx.diagnostics.push({
184806
+ severity: "error",
184807
+ code: "invalid-command-mode",
184808
+ errorCode: "SC4012",
184809
+ docsUrl: "https://supacloud.dev/errors/SC4012",
184810
+ message: `${command}.${property} must be the explicit literal "required" or "none"; invalid governance cannot be disabled silently.`,
184811
+ file,
184812
+ line: lineOf(expression),
184813
+ suggestion: `Choose the intended ${property} policy explicitly; use set_command_mode with value "required" or "none".`,
184814
+ fix: {
184815
+ type: "set_command_mode",
184816
+ targetFile: file,
184817
+ command,
184818
+ property,
184819
+ expectedExpression: nodeText(expression)
184820
+ }
184821
+ });
184822
+ }
184823
+ return value;
184824
+ }
184798
184825
  function parseProvider(el, exportsSet, ctx) {
184799
184826
  const file = sourcePath(ctx.rootDir, el.getSourceFile().fileName);
184800
184827
  const line = lineOf(el);
@@ -185255,6 +185282,10 @@ function parseController(input, ctx) {
185255
185282
  path: routePath,
185256
185283
  handler: propertyName(method.name)
185257
185284
  };
185285
+ const signature = ctx.checker.getSignatureFromDeclaration(method);
185286
+ const resultType = signature && ctx.checker.typeToString(signature.getReturnType());
185287
+ if (resultType && /\bResponse\b/.test(resultType))
185288
+ route.nativeResponse = true;
185258
185289
  const pathParams = [];
185259
185290
  const paramRegex = /:([a-zA-Z0-9_]+)/g;
185260
185291
  let match;
@@ -185403,6 +185434,23 @@ function parseController(input, ctx) {
185403
185434
  }
185404
185435
  const optionsArg = args[1];
185405
185436
  if (optionsArg && ts3.isObjectLiteralExpression(optionsArg)) {
185437
+ const contract = getProp(optionsArg, "contract");
185438
+ if (contract && ts3.isObjectLiteralExpression(contract)) {
185439
+ route.contract = {};
185440
+ for (const field of ["body", "response", "evidence"]) {
185441
+ const value = stringLiteralProp(contract, field);
185442
+ const allowed = field === "body" ? ["framework", "domain"] : field === "response" ? ["framework", "native-json", "binary", "stream"] : undefined;
185443
+ if (getProp(contract, field) && (!value || allowed && !allowed.includes(value))) {
185444
+ ctx.diagnostics.push({
185445
+ severity: "error",
185446
+ code: "invalid-route-contract",
185447
+ file,
185448
+ message: `Invalid contract.${field} on ${route.handler}; use an explicit supported string literal.`
185449
+ });
185450
+ } else if (value)
185451
+ Object.assign(route.contract, { [field]: value });
185452
+ }
185453
+ }
185406
185454
  for (const field of ["body", "params", "query", "response"]) {
185407
185455
  const schemaExpr = getProp(optionsArg, field);
185408
185456
  if (schemaExpr && ts3.isIdentifier(schemaExpr)) {
@@ -185410,6 +185458,11 @@ function parseController(input, ctx) {
185410
185458
  const importPath = importPathOf(schemaExpr, ctx);
185411
185459
  if (importPath)
185412
185460
  schemaImports[schemaExpr.text] = importPath;
185461
+ const declaration = resolveDeclaration(schemaExpr, ctx)[0];
185462
+ const typeName = ctx.checker.typeToString(ctx.checker.getTypeAtLocation(schemaExpr));
185463
+ const initializer = declaration && ts3.isVariableDeclaration(declaration) ? declaration.initializer : undefined;
185464
+ const opaque = /\bT(?:Unknown|Any)\b/.test(typeName) || initializer && ts3.isCallExpression(initializer) && ts3.isPropertyAccessExpression(initializer.expression) && ["Unknown", "Any"].includes(initializer.expression.name.text);
185465
+ (route.schemaKinds ??= {})[field] = opaque ? "opaque" : "declared";
185413
185466
  }
185414
185467
  }
185415
185468
  const commandExpr = getProp(optionsArg, "command");
@@ -185504,6 +185557,23 @@ function parseController(input, ctx) {
185504
185557
  schemaImports: Object.keys(schemaImports).length > 0 ? schemaImports : undefined
185505
185558
  };
185506
185559
  }
185560
+ function checkedRpc(meta, ctx) {
185561
+ const expression = getProp(meta, "rpc");
185562
+ if (!expression)
185563
+ return;
185564
+ const value = stringLiteralProp(meta, "rpc");
185565
+ if (value?.trim())
185566
+ return value;
185567
+ ctx.diagnostics.push({
185568
+ severity: "error",
185569
+ code: "invalid-command-rpc",
185570
+ file: sourcePath(ctx.rootDir, meta.getSourceFile().fileName),
185571
+ line: lineOf(meta),
185572
+ message: "Command rpc must be a non-empty string literal identifying a configured adapter.",
185573
+ suggestion: "Declare a named RPC adapter and its tested persistence capabilities."
185574
+ });
185575
+ return;
185576
+ }
185507
185577
  function classDeps(cls, ctx) {
185508
185578
  const injectable = parseInjectableOptions(cls, ctx);
185509
185579
  const ctor = cls.members.find(ts3.isConstructorDeclaration);
@@ -185859,6 +185929,7 @@ function parseAspectRefs(expression, ctx, owner) {
185859
185929
  const declaredFile = declaration.getSourceFile().fileName;
185860
185930
  const projectLocal = isProjectSourcePath(declaredFile, ctx.rootDir);
185861
185931
  refs.push({
185932
+ ...projectLocal ? { file: sourcePath(ctx.rootDir, declaredFile) } : {},
185862
185933
  name,
185863
185934
  expression: element.text,
185864
185935
  importPath: projectLocal ? modulePath(ctx.rootDir, declaredFile) : undefined,
@@ -186044,6 +186115,7 @@ var INTERFACES = `export interface CompiledRoute {
186044
186115
  }
186045
186116
 
186046
186117
  export interface CompiledCommand {
186118
+ rpc?: string;
186047
186119
  className: string;
186048
186120
  name: string;
186049
186121
  permission: string;
@@ -186569,6 +186641,7 @@ ${indent(item, 2)}`).join(",")}
186569
186641
  `transaction: ${JSON.stringify(command.transaction)}`,
186570
186642
  ...command.audit ? [`audit: ${JSON.stringify(command.audit)}`] : [],
186571
186643
  `idempotency: ${JSON.stringify(command.idempotency)}`,
186644
+ ...command.rpc ? [`rpc: ${JSON.stringify(command.rpc)}`] : [],
186572
186645
  ...command.standalone ? ["standalone: true"] : [],
186573
186646
  ...command.aspects && command.aspects.length > 0 ? [`aspects: ${this.renderAspects(command.aspects)}`] : []
186574
186647
  ];
@@ -187329,6 +187402,10 @@ var COMPILER_DIAGNOSTIC_CODES = {
187329
187402
  "invalid-job-scope": { code: "SC4007", docsUrl: "https://supacloud.dev/errors/SC4007" },
187330
187403
  "dynamic-aspect-reference": { code: "SC4010", docsUrl: "https://supacloud.dev/errors/SC4010" },
187331
187404
  "invalid-aspect-reference": { code: "SC4011", docsUrl: "https://supacloud.dev/errors/SC4011" },
187405
+ "invalid-command-mode": { code: "SC4012", docsUrl: "https://supacloud.dev/errors/SC4012" },
187406
+ "invalid-command-rpc": { code: "SC4013", docsUrl: "https://supacloud.dev/errors/SC4013" },
187407
+ "command-rpc-unavailable": { code: "SC4014", docsUrl: "https://supacloud.dev/errors/SC4014" },
187408
+ "invalid-route-contract": { code: "SC3020", docsUrl: "https://supacloud.dev/errors/SC3020" },
187332
187409
  "unused-root-provider": { code: "SC5001", docsUrl: "https://supacloud.dev/errors/SC5001" },
187333
187410
  "invalid-feature-states": { code: "SC6001", docsUrl: "https://supacloud.dev/errors/SC6001" },
187334
187411
  "duplicate-feature-transition": { code: "SC6002", docsUrl: "https://supacloud.dev/errors/SC6002" },
@@ -187758,8 +187835,18 @@ function validateGraph(graph, options = false) {
187758
187835
  permission: `${module.name}.${command.name}`
187759
187836
  });
187760
187837
  }
187838
+ if (command.rpc && (typeof options !== "object" || !Object.hasOwn(options.commandCapabilities?.rpc ?? {}, command.rpc))) {
187839
+ error("command-rpc-unavailable", `Command ${command.name} requires configured RPC adapter '${command.rpc}'.`, module.file, module.line);
187840
+ }
187761
187841
  if (typeof options === "object" && options.commandCapabilities) {
187762
- const caps = options.commandCapabilities;
187842
+ const hostCaps = options.commandCapabilities;
187843
+ const rpcCaps = command.rpc && Object.hasOwn(hostCaps.rpc ?? {}, command.rpc) ? hostCaps.rpc?.[command.rpc] : undefined;
187844
+ const caps = command.rpc ? {
187845
+ permission: hostCaps.permission,
187846
+ audit: rpcCaps?.audit === true,
187847
+ transaction: rpcCaps?.transaction === true,
187848
+ idempotency: rpcCaps?.idempotency === true
187849
+ } : hostCaps;
187763
187850
  const location = `${command.className} (${module.file})`;
187764
187851
  if (command.permission && caps.permission === false) {
187765
187852
  error("command-permission-unsupported", `Command ${command.name} declares permission, but runtime permission checks are unavailable (${location}).`, module.file, module.line);
@@ -188311,6 +188398,53 @@ function normalizeRelative(rootDir, filePath) {
188311
188398
  function isAnyKeyword(node) {
188312
188399
  return node.kind === ts5.SyntaxKind.AnyKeyword;
188313
188400
  }
188401
+ function inspectRouteContracts(graph) {
188402
+ return graph.modules.flatMap((module) => module.controllers.flatMap((controller) => controller.routes.map((route) => {
188403
+ const missing = [];
188404
+ if ((route.hasBodyBinding || route.handlerParams?.some((param) => param.kind === "body")) && !route.body)
188405
+ missing.push("body");
188406
+ if ((route.pathParams?.length || route.paramBindings?.length || route.handlerParams?.some((param) => param.kind === "param") || /:[^/]+/.test(`${controller.path}/${route.path}`)) && !route.params)
188407
+ missing.push("params");
188408
+ if ((route.queryBindings?.length || route.handlerParams?.some((param) => param.kind === "query")) && !route.query)
188409
+ missing.push("query");
188410
+ if (!route.response && !["binary", "stream"].includes(route.contract?.response ?? ""))
188411
+ missing.push("response");
188412
+ const body = !route.body ? "missing" : route.contract?.body === "domain" ? "domain" : route.schemaKinds?.body === "opaque" ? "opaque" : "framework-declared";
188413
+ const response = route.contract?.response ?? (route.nativeResponse ? "native-response-unclassified" : route.schemaKinds?.response === "opaque" ? "opaque" : !route.response ? "missing" : "framework-declared");
188414
+ return {
188415
+ module: module.name,
188416
+ controller: controller.className,
188417
+ handler: route.handler,
188418
+ method: route.method,
188419
+ path: `${controller.path}${route.path}`,
188420
+ file: controller.file,
188421
+ missing,
188422
+ validation: {
188423
+ body,
188424
+ response,
188425
+ schemas: route.schemaKinds ?? {},
188426
+ evidence: route.contract?.evidence ?? null,
188427
+ verified: false,
188428
+ obligations: [
188429
+ "Exercise actual HTTP request and response boundaries.",
188430
+ ...response === "opaque" ? ["Decode the response's business fields; an opaque schema accepts unvalidated output."] : [],
188431
+ ...body === "domain" || body === "opaque" ? ["Prove invalid input is rejected by the domain before writes."] : [],
188432
+ ...response === "native-json" || response === "native-response-unclassified" ? ["Validate serialized JSON explicitly; native Response bypasses framework response schemas."] : [],
188433
+ ...["binary", "stream"].includes(response) ? ["Test transport headers, access and bytes without JSON decoding."] : []
188434
+ ]
188435
+ }
188436
+ };
188437
+ })));
188438
+ }
188439
+ function validateRouteContracts(graph) {
188440
+ return inspectRouteContracts(graph).filter((route) => route.missing.length).map((route) => ({
188441
+ severity: "error",
188442
+ code: "route-contract-required",
188443
+ file: route.file,
188444
+ message: `${route.controller}.${route.handler} (${route.method} ${route.path}) is missing contract declarations: ${route.missing.join(", ")}.`,
188445
+ suggestion: "Declare the missing schemas and test actual request/response decoding. An opaque schema is not proof of validation."
188446
+ }));
188447
+ }
188314
188448
  async function compileProject(options) {
188315
188449
  const graph = await analyzeProject(options.rootDir, options.include, options.cache, options.changedPaths);
188316
188450
  const diagnostics = [
@@ -188332,6 +188466,8 @@ async function compileProject(options) {
188332
188466
  }
188333
188467
  }
188334
188468
  const typeSafety = resolveTypeSafety(options);
188469
+ if (options.requireRouteContracts)
188470
+ diagnostics.push(...validateRouteContracts(graph));
188335
188471
  const rendered = renderApplication(graph, {
188336
188472
  rootDir: options.rootDir,
188337
188473
  outDir: options.outDir,
@@ -188364,7 +188500,7 @@ async function compileProject(options) {
188364
188500
  treeShakeUnusedProviders: options.treeShakeUnusedProviders,
188365
188501
  artifactHashes: options.cache?.generatedHashes
188366
188502
  };
188367
- const written = !hasErrors || options.writeOnError !== false ? await generateApplication(graph, generatedOptions) : [];
188503
+ const written = !hasErrors || options.writeOnError === true ? await generateApplication(graph, generatedOptions) : [];
188368
188504
  const stats = graph.cacheStats ? {
188369
188505
  cacheHit: graph.cacheStats.reanalyzedModules.length === 0,
188370
188506
  changedFiles: [],
@@ -188395,6 +188531,8 @@ async function checkProject(options) {
188395
188531
  }
188396
188532
  }
188397
188533
  const typeSafety = resolveTypeSafety(options);
188534
+ if (options.requireRouteContracts)
188535
+ diagnostics.push(...validateRouteContracts(graph));
188398
188536
  const rendered = renderApplication(graph, {
188399
188537
  rootDir: options.rootDir,
188400
188538
  outDir: options.outDir,
@@ -188459,6 +188597,7 @@ var DEFAULT_SUPACLOUD_CONFIG = {
188459
188597
  outDir: "generated",
188460
188598
  include: ["**/*.module.ts", "**/*.ts"],
188461
188599
  strict: true,
188600
+ requireRouteContracts: false,
188462
188601
  generateClient: true,
188463
188602
  generatePermissions: true,
188464
188603
  treeShakeUnusedProviders: true,
@@ -188478,6 +188617,7 @@ function resolveSupacloudConfig(config = {}, cwd = process.cwd()) {
188478
188617
  outDir: resolve62(cwd, resolved.outDir ?? DEFAULT_SUPACLOUD_CONFIG.outDir),
188479
188618
  include: resolved.include ?? [...DEFAULT_SUPACLOUD_CONFIG.include],
188480
188619
  strict: resolved.strict ?? DEFAULT_SUPACLOUD_CONFIG.strict,
188620
+ requireRouteContracts: resolved.requireRouteContracts ?? DEFAULT_SUPACLOUD_CONFIG.requireRouteContracts,
188481
188621
  generateClient: resolved.generateClient ?? DEFAULT_SUPACLOUD_CONFIG.generateClient,
188482
188622
  generatePermissions: resolved.generatePermissions ?? DEFAULT_SUPACLOUD_CONFIG.generatePermissions,
188483
188623
  moduleBoundaryPreset: resolved.moduleBoundaryPreset ?? DEFAULT_SUPACLOUD_CONFIG.moduleBoundaryPreset,
@@ -188505,6 +188645,7 @@ function compileOptionsFromConfig(config, cwd = process.cwd()) {
188505
188645
  outDir: resolved.outDir,
188506
188646
  include: resolved.include,
188507
188647
  strict: resolved.strict,
188648
+ requireRouteContracts: resolved.requireRouteContracts,
188508
188649
  generateClient: resolved.generateClient,
188509
188650
  generatePermissions: resolved.generatePermissions,
188510
188651
  moduleBoundaryPreset: resolved.moduleBoundaryPreset,
@@ -188764,7 +188905,7 @@ test("partial and untagged inherited remote profiles cannot mix with selected fi
188764
188905
  // ../compiler/package.json
188765
188906
  var package_default = {
188766
188907
  name: "@supacloud/compiler",
188767
- version: "0.10.0",
188908
+ version: "0.12.0",
188768
188909
  description: "Static compiler for @supacloud/app metadata: builds the application graph from AST, validates it, and generates reflection-free factory code",
188769
188910
  type: "module",
188770
188911
  main: "./dist/index.js",
@@ -188819,13 +188960,18 @@ var package_default = {
188819
188960
  // ../app/package.json
188820
188961
  var package_default2 = {
188821
188962
  name: "@supacloud/app",
188822
- version: "0.9.0",
188963
+ version: "0.11.0",
188823
188964
  description: "Angular-style application metadata for SupaCloud: modules, DI tokens, providers, scopes, controllers and commands",
188824
188965
  type: "module",
188825
188966
  main: "./dist/index.js",
188826
188967
  module: "./dist/index.js",
188827
188968
  types: "./dist/index.d.ts",
188828
188969
  exports: {
188970
+ "./contracts": {
188971
+ types: "./dist/contract_client.d.ts",
188972
+ import: "./dist/contract_client.js",
188973
+ default: "./dist/contract_client.js"
188974
+ },
188829
188975
  ".": {
188830
188976
  types: "./dist/index.d.ts",
188831
188977
  import: "./dist/index.js",
@@ -188838,7 +188984,7 @@ var package_default2 = {
188838
188984
  ],
188839
188985
  scripts: {
188840
188986
  build: "bun run clean && bun run build:js && bun run build:types",
188841
- "build:js": "bun build src/index.ts --outdir dist --target node",
188987
+ "build:js": "bun build src/index.ts --outdir dist --target node && bun build src/contract_client.ts --outdir dist --target browser",
188842
188988
  "build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
188843
188989
  clean: "rm -rf dist",
188844
188990
  prepublishOnly: "bun run build",
@@ -188870,7 +189016,7 @@ var package_default2 = {
188870
189016
  // ../elysia/package.json
188871
189017
  var package_default3 = {
188872
189018
  name: "@supacloud/elysia",
188873
- version: "0.8.1",
189019
+ version: "0.10.0",
188874
189020
  description: "Elysia runtime adapter for SupaCloud compiled modules: application/request scopes, route registration and validation",
188875
189021
  type: "module",
188876
189022
  main: "./dist/index.js",
@@ -188889,7 +189035,7 @@ var package_default3 = {
188889
189035
  ],
188890
189036
  scripts: {
188891
189037
  build: "bun run clean && bun run build:js && bun run build:types",
188892
- "build:js": "bun build src/index.ts --outdir dist --target node --external elysia",
189038
+ "build:js": "bun build src/index.ts --outdir dist --target node --external elysia --external jose",
188893
189039
  "build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
188894
189040
  clean: "rm -rf dist",
188895
189041
  prepublishOnly: "bun run build",
@@ -188910,6 +189056,9 @@ var package_default3 = {
188910
189056
  url: "https://github.com/vibeunion/supacloud.git",
188911
189057
  directory: "packages/elysia"
188912
189058
  },
189059
+ dependencies: {
189060
+ jose: "^6.2.11"
189061
+ },
188913
189062
  peerDependencies: {
188914
189063
  elysia: "^1.4.30"
188915
189064
  },
@@ -189063,16 +189212,17 @@ export function createDemo() {
189063
189212
  return sandbox;
189064
189213
  }
189065
189214
  `,
189066
- "src/application.ts": `import { createApplication, type ApplicationOptions, type CommandGovernance } from "@supacloud/elysia";
189215
+ "src/application.ts": `import { createApplication, createSupAuthRequestContext, type SupAuthContextOptions, type ApplicationOptions, type CommandGovernance } from "@supacloud/elysia";
189067
189216
  import { createCompiledModules } from "../generated/application";
189068
189217
 
189069
189218
  export interface AppAdapters {
189070
189219
  deps: NonNullable<ApplicationOptions["deps"]>;
189071
189220
  requestContext: NonNullable<ApplicationOptions["requestContext"]>;
189072
189221
  commandGovernance: CommandGovernance;
189222
+ onExecution?: ApplicationOptions["onExecution"];
189073
189223
  }
189074
189224
 
189075
- // Supply trusted identity, persistent storage and durable governance in the host.
189225
+ // The host verifies external identity (SupAuth for unified login) before creating requestContext.
189076
189226
  export function createApp(adapters: AppAdapters) {
189077
189227
  return createApplication({
189078
189228
  ...adapters,
@@ -189080,6 +189230,10 @@ export function createApp(adapters: AppAdapters) {
189080
189230
  modules: createCompiledModules(),
189081
189231
  });
189082
189232
  }
189233
+
189234
+ export function createSupAuthApp(identity: SupAuthContextOptions, adapters: Omit<AppAdapters, "requestContext">) {
189235
+ return createApp({ ...adapters, requestContext: createSupAuthRequestContext(identity) });
189236
+ }
189083
189237
  `,
189084
189238
  "src/review/review.ts": `import {
189085
189239
  Body, Command, Controller, DB_CLIENT, Get, Inject, Param, Post,
@@ -189302,6 +189456,46 @@ and commit transition, idempotency receipt and audit atomically. For distributed
189302
189456
  side effects use a transactional outbox. Client state machines are projections,
189303
189457
  not a security boundary. Missing declared runtime adapters return an error.
189304
189458
 
189459
+ ## Unified User Center
189460
+
189461
+ For enterprise unified login, use SupAuth as the external user center. This
189462
+ starter exports createSupAuthApp(identity, adapters) from dist/application.js.
189463
+ Supply issuer, audience, clientId, projectId, an explicit HTTPS jwksUrl and resolveAccess
189464
+ that reads current application-local access. The runtime verifies credential
189465
+ signatures, configured issuer and audience, allowed asymmetric algorithms/keys
189466
+ and expiry before constructing requestContext. The token must have the
189467
+ authenticated user role and matching client_id/azp application binding.
189468
+ Invalid credentials return 401; verification service failures return 503.
189469
+ It does not create a user center.
189470
+
189471
+ Map the verified issuer and subject to application-local membership and
189472
+ permissions. A unified user does not automatically have access to every project.
189473
+ Never trust a body-supplied actor or an unverified decoded token. When identity
189474
+ cannot be verified, deny protected access; never fall back to the demo identity,
189475
+ local login or a service-role bypass. Do not duplicate passwords or token issuance
189476
+ in business modules. Recheck business authorization on idempotent replay.
189477
+
189478
+ Local compilation and deterministic tests do not require SupAuth credentials.
189479
+ Before production acceptance, test legitimate SupAuth sessions across two
189480
+ applications, cross-project denial, invalid/expired credentials and permission
189481
+ revocation. The local memory tests are not proof of these integration guarantees.
189482
+
189483
+ ## Inspection And Repair
189484
+
189485
+ \`\`\`sh
189486
+ bunx supacloud-compiler context review --root src --json
189487
+ bunx supacloud-compiler explain review --root src
189488
+ bunx supacloud-compiler check --json
189489
+ bunx supacloud-compiler fix ./fix.json --dry-run
189490
+ \`\`\`
189491
+
189492
+ Context packs include directional dependencies, relevant aspect files, diagnostics
189493
+ and static execution plans. Share these rather than credentials or production
189494
+ data. Fixes default to preview; use --write only after reviewing the selected
189495
+ policy. Invalid transaction/idempotency modes fail compilation instead of
189496
+ silently disabling governance. onExecution receives metadata-only trace events;
189497
+ durable audit still belongs to the command governance adapter.
189498
+
189305
189499
  ## CI
189306
189500
 
189307
189501
  After the first compilation, commit generated/. In CI run
@@ -193154,7 +193348,7 @@ function registerRemoteDevTools(server2, options = {}) {
193154
193348
  // package.json
193155
193349
  var package_default4 = {
193156
193350
  name: "@supacloud/cli",
193157
- version: "0.49.1",
193351
+ version: "0.50.0",
193158
193352
  description: "Project-scoped CLI for SupaCloud users",
193159
193353
  type: "module",
193160
193354
  main: "./dist/index.js",
@@ -193187,7 +193381,7 @@ var package_default4 = {
193187
193381
  },
193188
193382
  dependencies: {
193189
193383
  "@sinclair/typebox": "^0.34.52",
193190
- "@supacloud/compiler": "^0.10.0",
193384
+ "@supacloud/compiler": "^0.12.0",
193191
193385
  "@supacloud/db": "^0.2.0",
193192
193386
  fflate: "^0.8.3"
193193
193387
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/cli",
3
- "version": "0.49.1",
3
+ "version": "0.50.0",
4
4
  "description": "Project-scoped CLI for SupaCloud users",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@sinclair/typebox": "^0.34.52",
36
- "@supacloud/compiler": "^0.10.0",
36
+ "@supacloud/compiler": "^0.12.0",
37
37
  "@supacloud/db": "^0.2.0",
38
38
  "fflate": "^0.8.3"
39
39
  },