@supacloud/cli 0.58.1 → 0.58.3

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 +38 -16
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -217359,7 +217359,7 @@ function scaffoldFiles(framework, slug) {
217359
217359
  "package.json": JSON.stringify({
217360
217360
  private: true,
217361
217361
  type: "module",
217362
- dependencies: { elysia: "^1.4.30" }
217362
+ dependencies: { elysia: "2.0.0-beta.19" }
217363
217363
  }, null, 2) + `
217364
217364
  `,
217365
217365
  "index.ts": `import { Elysia } from "elysia";
@@ -232710,9 +232710,7 @@ function parseController(input, ctx) {
232710
232710
  if (importPath)
232711
232711
  schemaImports[schemaExpr.text] = importPath;
232712
232712
  const declaration = resolveDeclaration(schemaExpr, ctx)[0];
232713
- const typeName = ctx.checker.typeToString(ctx.checker.getTypeAtLocation(schemaExpr));
232714
- const initializer = declaration && ts4.isVariableDeclaration(declaration) ? declaration.initializer : undefined;
232715
- const opaque = /\bT(?:Unknown|Any)\b/.test(typeName) || initializer && ts4.isCallExpression(initializer) && ts4.isPropertyAccessExpression(initializer.expression) && ["Unknown", "Any"].includes(initializer.expression.name.text);
232713
+ const opaque = isOpaqueSchema(schemaExpr, declaration, ctx);
232716
232714
  (route.schemaKinds ??= {})[field] = opaque ? "opaque" : "declared";
232717
232715
  }
232718
232716
  }
@@ -232767,9 +232765,7 @@ function parseController(input, ctx) {
232767
232765
  if (importPath)
232768
232766
  schemaImports[schemaExpr.text] = importPath;
232769
232767
  const declaration = resolveDeclaration(schemaExpr, ctx)[0];
232770
- const typeName = ctx.checker.typeToString(ctx.checker.getTypeAtLocation(schemaExpr));
232771
- const initializer = declaration && ts4.isVariableDeclaration(declaration) ? declaration.initializer : undefined;
232772
- const opaque = /\bT(?:Unknown|Any)\b/.test(typeName) || initializer && ts4.isCallExpression(initializer) && ts4.isPropertyAccessExpression(initializer.expression) && ["Unknown", "Any"].includes(initializer.expression.name.text);
232768
+ const opaque = isOpaqueSchema(schemaExpr, declaration, ctx);
232773
232769
  const previousKind = route.schemaKinds?.response;
232774
232770
  (route.schemaKinds ??= {}).response = opaque || previousKind === "opaque" ? "opaque" : "declared";
232775
232771
  }
@@ -232943,10 +232939,36 @@ function jobOptionError(ctx, code, message, node, errorCode, suggestion) {
232943
232939
  });
232944
232940
  }
232945
232941
  function jobSchemaKind(identifier, declaration, ctx) {
232946
- const typeName = ctx.checker.typeToString(ctx.checker.getTypeAtLocation(identifier));
232947
- const initializer = ts4.isVariableDeclaration(declaration) ? declaration.initializer : undefined;
232948
- const opaque = /\bT(?:Unknown|Any)\b/.test(typeName) || initializer && ts4.isCallExpression(initializer) && ts4.isPropertyAccessExpression(initializer.expression) && ["Unknown", "Any"].includes(initializer.expression.name.text);
232949
- return opaque ? "opaque" : "declared";
232942
+ return isOpaqueSchema(identifier, declaration, ctx) ? "opaque" : "declared";
232943
+ }
232944
+ function isOpaqueSchema(identifier, declaration, ctx) {
232945
+ function opaque(type, seen) {
232946
+ if (seen.has(type))
232947
+ return false;
232948
+ const nextSeen = new Set(seen).add(type);
232949
+ const kindProperty = type.getProperty("~kind");
232950
+ const kind = kindProperty && ctx.checker.getTypeOfSymbolAtLocation(kindProperty, identifier);
232951
+ if (kind?.isStringLiteral()) {
232952
+ if (kind.value === "Unknown" || kind.value === "Any")
232953
+ return true;
232954
+ if (kind.value === "Union" || kind.value === "Intersect") {
232955
+ const property = type.getProperty(kind.value === "Union" ? "anyOf" : "allOf");
232956
+ if (!property)
232957
+ return true;
232958
+ const members = ctx.checker.getIndexTypeOfType(ctx.checker.getTypeOfSymbolAtLocation(property, identifier), ts4.IndexKind.Number);
232959
+ if (!members)
232960
+ return true;
232961
+ const branches = members.isUnion() ? members.types : [members];
232962
+ return kind.value === "Union" ? branches.some((branch) => opaque(branch, nextSeen)) : branches.every((branch) => opaque(branch, nextSeen));
232963
+ }
232964
+ return false;
232965
+ }
232966
+ return /^T(?:Unknown|Any)\b/.test(ctx.checker.typeToString(type));
232967
+ }
232968
+ if (opaque(ctx.checker.getTypeAtLocation(identifier), new Set))
232969
+ return true;
232970
+ const initializer = declaration && ts4.isVariableDeclaration(declaration) ? declaration.initializer : undefined;
232971
+ return Boolean(initializer && ts4.isCallExpression(initializer) && ts4.isPropertyAccessExpression(initializer.expression) && ["Unknown", "Any"].includes(initializer.expression.name.text));
232950
232972
  }
232951
232973
  function checkedRpc(meta, ctx) {
232952
232974
  const expression = getProp(meta, "rpc");
@@ -240344,7 +240366,7 @@ test("partial and untagged inherited remote profiles cannot mix with selected fi
240344
240366
  // ../compiler/package.json
240345
240367
  var package_default = {
240346
240368
  name: "@supacloud/compiler",
240347
- version: "0.27.1",
240369
+ version: "0.27.3",
240348
240370
  description: "Static compiler for @supacloud/app metadata: builds the application graph from AST, validates it, and generates reflection-free factory code",
240349
240371
  type: "module",
240350
240372
  main: "./dist/index.js",
@@ -240474,7 +240496,7 @@ var package_default2 = {
240474
240496
  // ../elysia/package.json
240475
240497
  var package_default3 = {
240476
240498
  name: "@supacloud/elysia",
240477
- version: "0.20.0",
240499
+ version: "0.20.1",
240478
240500
  description: "Elysia runtime adapter for SupaCloud compiled modules: application/request scopes, route registration and validation",
240479
240501
  type: "module",
240480
240502
  main: "./dist/index.js",
@@ -240533,7 +240555,7 @@ var package_default3 = {
240533
240555
  "@supacloud/commands": "file:../commands"
240534
240556
  },
240535
240557
  peerDependencies: {
240536
- elysia: ">=2.0.0-beta.19 <3"
240558
+ elysia: "2.0.0-beta.19"
240537
240559
  },
240538
240560
  devDependencies: {
240539
240561
  "@supacloud/compiler": "file:../compiler",
@@ -246980,7 +247002,7 @@ function registerRemoteDevTools(server2, options = {}) {
246980
247002
  // package.json
246981
247003
  var package_default8 = {
246982
247004
  name: "@supacloud/cli",
246983
- version: "0.58.1",
247005
+ version: "0.58.3",
246984
247006
  description: "Project-scoped CLI for SupaCloud users",
246985
247007
  type: "module",
246986
247008
  main: "./dist/index.js",
@@ -247013,7 +247035,7 @@ var package_default8 = {
247013
247035
  },
247014
247036
  dependencies: {
247015
247037
  "@sinclair/typebox": "^0.34.52",
247016
- "@supacloud/compiler": "^0.27.1",
247038
+ "@supacloud/compiler": "^0.27.3",
247017
247039
  "@supacloud/delivery": "0.2.0",
247018
247040
  "@supacloud/db": "^0.2.0",
247019
247041
  fflate: "^0.8.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/cli",
3
- "version": "0.58.1",
3
+ "version": "0.58.3",
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.27.1",
36
+ "@supacloud/compiler": "^0.27.3",
37
37
  "@supacloud/delivery": "0.2.0",
38
38
  "@supacloud/db": "^0.2.0",
39
39
  "fflate": "^0.8.3",