@supacloud/compiler 0.42.1 → 0.43.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.
@@ -3797,11 +3797,22 @@ var init_dependent = __esm(() => {
3797
3797
  });
3798
3798
 
3799
3799
  // node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.mjs
3800
+ function IsTypeScriptEnumLike(value) {
3801
+ return IsObjectNotArray(value);
3802
+ }
3803
+ function TypeScriptEnumToEnumValues(type) {
3804
+ const keys = Keys(type).filter((key) => isNaN(key));
3805
+ return keys.reduce((result, key) => [...result, type[key]], []);
3806
+ }
3800
3807
  var init_typescript_enum_to_enum_values = __esm(() => {
3801
3808
  init_guard2();
3802
3809
  });
3803
3810
 
3804
3811
  // node_modules/typebox/build/type/types/enum.mjs
3812
+ function Enum(value, options) {
3813
+ const values = IsTypeScriptEnumLike(value) ? TypeScriptEnumToEnumValues(value) : value;
3814
+ return Create({ "~kind": "Enum" }, { enum: values }, options);
3815
+ }
3805
3816
  function IsEnum2(value) {
3806
3817
  return IsKind(value, "Enum");
3807
3818
  }
@@ -185,9 +185,11 @@ function parse(file, text) {
185
185
  return ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
186
186
  }
187
187
  function unique(items, description) {
188
- if (items.length !== 1)
188
+ const [item] = items;
189
+ if (items.length !== 1 || item === undefined) {
189
190
  throw new Error(`Expected exactly one ${description}; found ${items.length}`);
190
- return items[0];
191
+ }
192
+ return item;
191
193
  }
192
194
  function identifier(value) {
193
195
  if (!/^[A-Za-z_$][\w$]*$/.test(value))
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Local stand-in for @supacloud/app in fixture projects: noop implementations of decorators and tokens.
3
3
  * AST analysis matches decorators by name only and generated code does not import it;
4
- * implementation exists only so fixture sources can be dynamically imported and executed by bun.
4
+ * implementation lets fixture sources pass TypeScript checks and execute under bun.
5
5
  */
6
- export declare const RUNTIME_SOURCE = "export class InjectionToken<T = unknown> {\n readonly name: string;\n readonly scope?: string;\n\n constructor(name: string, options: { scope?: string } = {}) {\n this.name = name;\n this.scope = options.scope;\n }\n}\n\nexport function Injectable(_options: { scope?: string; deps?: unknown[] } = {}) {\n return () => {};\n}\n\nexport function Inject(_token: unknown) {\n return () => {};\n}\n\nexport function Module(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function defineModule(_options: Record<string, unknown>) {\n return class DefinedModule {};\n}\n\nexport function Command(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Job(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function Query(_options: Record<string, unknown>) {\n return () => {};\n}\n\nexport function InfraResource(_options: { name: string; kind: string }) {\n return () => {};\n}\n\nexport function Controller(_path: string) {\n return () => {};\n}\n\nfunction routeDecorator(_method: string) {\n return (_path: string, _options?: Record<string, unknown>) => () => {};\n}\n\nexport const Get = routeDecorator(\"GET\");\nexport const Post = routeDecorator(\"POST\");\nexport const Put = routeDecorator(\"PUT\");\nexport const Patch = routeDecorator(\"PATCH\");\nexport const Delete = routeDecorator(\"DELETE\");\nexport const Head = routeDecorator(\"HEAD\");\nexport const Options = routeDecorator(\"OPTIONS\");\n\nexport const REQUEST_CONTEXT = new InjectionToken(\"supacloud.request-context\", {\n scope: \"request\",\n});\nexport const JOB_CONTEXT = new InjectionToken(\"supacloud.job-context\", {\n scope: \"job\",\n});\n";
6
+ export declare const RUNTIME_SOURCE = "export class InjectionToken<T = unknown> {\n readonly name: string;\n readonly scope: string | undefined;\n\n constructor(name: string, options: { scope?: string } = {}) {\n this.name = name;\n this.scope = options.scope;\n }\n}\n\nexport function Injectable(_options: { scope?: string; deps?: unknown[] } = {}) {\n return (..._args: unknown[]) => {};\n}\n\nexport function Inject(_token: unknown) {\n return (..._args: unknown[]) => {};\n}\n\nexport function Module(_options: Record<string, unknown>) {\n return (..._args: unknown[]) => {};\n}\n\nexport function defineModule(_options: Record<string, unknown>) {\n return class DefinedModule {};\n}\n\nexport function Command(_options: Record<string, unknown>) {\n return (..._args: unknown[]) => {};\n}\n\nexport function Job(_options: Record<string, unknown>) {\n return (..._args: unknown[]) => {};\n}\n\nexport function Query(_options: Record<string, unknown>) {\n return (..._args: unknown[]) => {};\n}\n\nexport function InfraResource(_options: { name: string; kind: string }) {\n return (..._args: unknown[]) => {};\n}\n\nexport function Controller(_path: string | Record<string, unknown>) {\n return (..._args: unknown[]) => {};\n}\n\nexport function Body() {\n return (..._args: unknown[]) => {};\n}\n\nexport function Headers(_name?: string) {\n return (..._args: unknown[]) => {};\n}\n\nexport function UseGuards(..._guards: string[]) {\n return (..._args: unknown[]) => {};\n}\n\nfunction routeDecorator(_method: string) {\n return (_path: string, _options?: Record<string, unknown>) => (..._args: unknown[]) => {};\n}\n\nexport const Get = routeDecorator(\"GET\");\nexport const Post = routeDecorator(\"POST\");\nexport const Put = routeDecorator(\"PUT\");\nexport const Patch = routeDecorator(\"PATCH\");\nexport const Delete = routeDecorator(\"DELETE\");\nexport const Head = routeDecorator(\"HEAD\");\nexport const Options = routeDecorator(\"OPTIONS\");\n\nexport const REQUEST_CONTEXT = new InjectionToken(\"supacloud.request-context\", {\n scope: \"request\",\n});\nexport const JOB_CONTEXT = new InjectionToken(\"supacloud.job-context\", {\n scope: \"job\",\n});\n";
7
7
  export declare const FIXTURE_TSCONFIG = "{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"experimentalDecorators\": true,\n \"strict\": true\n }\n}\n";