@karmaniverous/smoz 0.1.8 → 0.2.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.
Files changed (52) hide show
  1. package/README.md +28 -4
  2. package/dist/cli/index.cjs +282 -122
  3. package/package.json +5 -8
  4. package/templates/{minimal → default}/app/config/app.config.ts +50 -50
  5. package/templates/{minimal → default}/app/config/openapi.ts +45 -45
  6. package/templates/{full → default}/app/functions/rest/hello/get/handler.ts +18 -18
  7. package/templates/{full → default}/app/functions/rest/hello/get/lambda.ts +28 -28
  8. package/templates/{minimal → default}/app/functions/rest/hello/get/openapi.ts +23 -23
  9. package/templates/{minimal → default}/app/functions/rest/openapi/get/handler.ts +22 -22
  10. package/templates/{minimal → default}/app/functions/rest/openapi/get/lambda.ts +29 -29
  11. package/templates/{full → default}/app/functions/rest/openapi/get/openapi.ts +20 -20
  12. package/templates/{project → default}/eslint.config.ts +6 -15
  13. package/templates/default/package.json +44 -0
  14. package/templates/default/serverless.ts +113 -0
  15. package/templates/default/tsconfig.eslint.json +13 -0
  16. package/templates/{minimal → default}/types/registers.d.ts +11 -11
  17. package/templates/.check/eslint.minimal.config.ts +0 -41
  18. package/templates/.check/eslint.templates.config.ts +0 -60
  19. package/templates/.check/tsconfig.eslintconfig.json +0 -6
  20. package/templates/.check/tsconfig.minimal.json +0 -14
  21. package/templates/.manifests/package.full.json +0 -22
  22. package/templates/.manifests/package.minimal.json +0 -22
  23. package/templates/.manifests/package.project.json +0 -24
  24. package/templates/full/app/config/app.config.ts +0 -50
  25. package/templates/full/app/config/openapi.ts +0 -44
  26. package/templates/full/app/functions/rest/hello/get/openapi.ts +0 -19
  27. package/templates/full/app/functions/rest/openapi/get/handler.ts +0 -20
  28. package/templates/full/app/functions/rest/openapi/get/lambda.ts +0 -29
  29. package/templates/full/app/functions/sqs/tick/handler.ts +0 -7
  30. package/templates/full/app/functions/sqs/tick/lambda.ts +0 -24
  31. package/templates/full/app/functions/sqs/tick/serverless.ts +0 -8
  32. package/templates/full/serverless.ts +0 -33
  33. package/templates/full/tsconfig.json +0 -25
  34. package/templates/full/types/registers.d.ts +0 -11
  35. package/templates/minimal/app/functions/rest/hello/get/handler.ts +0 -18
  36. package/templates/minimal/app/functions/rest/hello/get/lambda.ts +0 -28
  37. package/templates/minimal/app/functions/rest/openapi/get/openapi.ts +0 -20
  38. package/templates/minimal/app/generated/openapi.json +0 -8
  39. package/templates/minimal/serverless.ts +0 -34
  40. package/templates/minimal/tsconfig.json +0 -25
  41. /package/templates/{project → default}/.prettierrc.json +0 -0
  42. /package/templates/{project → default}/.vscode/extensions.json +0 -0
  43. /package/templates/{project → default}/.vscode/settings.json +0 -0
  44. /package/templates/{project → default}/README.md +0 -0
  45. /package/templates/{full → default}/app/generated/openapi.json +0 -0
  46. /package/templates/{project → default}/gitignore +0 -0
  47. /package/templates/{project → default}/test/smoke.test.ts +0 -0
  48. /package/templates/{project → default}/tsconfig.base.json +0 -0
  49. /package/templates/{project → default}/tsconfig.json +0 -0
  50. /package/templates/{project → default}/tsdoc.json +0 -0
  51. /package/templates/{project → default}/typedoc.json +0 -0
  52. /package/templates/{project → default}/vitest.config.ts +0 -0
@@ -1,28 +0,0 @@
1
- import { join } from 'node:path';
2
-
3
- import { toPosixPath } from '@karmaniverous/smoz';
4
- import { z } from 'zod';
5
-
6
- import { app, APP_ROOT_ABS } from '@/app/config/app.config';
7
-
8
- export const eventSchema = z.object({}).optional();
9
- export const responseSchema = z.object({ ok: z.boolean() });
10
- type FnApi = {
11
- handler: <T>(
12
- impl: () => Promise<T> | T,
13
- ) => (...args: unknown[]) => Promise<T>;
14
- openapi: (op: unknown) => void;
15
- };
16
-
17
- export const fn = app.defineFunction({
18
- functionName: 'hello_get',
19
- eventType: 'rest',
20
- httpContexts: ['public'],
21
- method: 'get',
22
- basePath: 'hello',
23
- contentType: 'application/json',
24
- eventSchema,
25
- responseSchema,
26
- callerModuleUrl: import.meta.url,
27
- endpointsRootAbs: toPosixPath(join(APP_ROOT_ABS, 'functions', 'rest')),
28
- }) as unknown as FnApi;
@@ -1,20 +0,0 @@
1
- import { fn, responseSchema } from './lambda';
2
-
3
- type FnOpenApiApi = {
4
- openapi: (op: unknown) => void;
5
- };
6
-
7
- const reg = fn as unknown as FnOpenApiApi;
8
-
9
- reg.openapi({
10
- summary: 'Get OpenAPI document',
11
- description:
12
- 'Return the OpenAPI 3.1 document. Generate it via "npm run openapi".',
13
- responses: {
14
- 200: {
15
- description: 'OpenAPI document',
16
- content: { 'application/json': { schema: responseSchema } },
17
- },
18
- },
19
- tags: ['openapi'],
20
- });
@@ -1,8 +0,0 @@
1
- {
2
- "openapi": "3.1.0",
3
- "info": { "title": "smoz-app", "version": "0.0.0" },
4
- "servers": [
5
- { "description": "Dev", "url": "http://localhost" }
6
- ],
7
- "paths": {}
8
- }
@@ -1,34 +0,0 @@
1
- import type { AWS } from '@serverless/typescript';
2
-
3
- import { app } from '@/app/config/app.config';
4
- /**
5
- * Template note:
6
- * - Templates do NOT commit generated register files under app/generated; they
7
- * are declared via ambient types (templates/minimal/types/registers.d.ts) so
8
- * TypeScript can typecheck without artifacts.
9
- * - To ensure side effects still run (endpoint/serverless registration) and to
10
- * satisfy noUncheckedSideEffectImports, import register modules as namespaces
11
- * and reference them via `void`.
12
- * - In real apps, `smoz init` seeds placeholders and `smoz register` rewrites
13
- * app/generated/register.*.ts at author time.
14
- */
15
- import * as __register_functions from '@/app/generated/register.functions';
16
- import * as __register_serverless from '@/app/generated/register.serverless';
17
- void __register_functions;
18
- void __register_serverless;
19
-
20
- const config: AWS = {
21
- service: '${param:SERVICE_NAME}',
22
- frameworkVersion: '4',
23
- stages: app.stages as NonNullable<AWS['stages']>,
24
- provider: {
25
- name: 'aws',
26
- region: '${param:REGION}' as NonNullable<AWS['provider']['region']>,
27
- runtime: 'nodejs22.x',
28
- environment: app.environment as NonNullable<AWS['provider']['environment']>,
29
- stage: '${opt:stage, "dev"}',
30
- },
31
- functions: app.buildAllServerlessFunctions() as NonNullable<AWS['functions']>,
32
- };
33
-
34
- export default config;
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": ".",
4
- "rootDir": ".",
5
- "outDir": ".tsbuild",
6
- "paths": {
7
- "@/*": ["*"],
8
- "@karmaniverous/smoz": ["../../.stan/dist/index.d.ts"]
9
- },
10
- "typeRoots": ["../../node_modules/@types", "./node_modules/@types"],
11
- "tsBuildInfoFile": ".tsbuild/tsconfig.tsbuildinfo"
12
- },
13
- "exclude": [
14
- ".serverless/**",
15
- "node_modules/**",
16
- "app/generated/**",
17
- "dist/**"
18
- ],
19
- "extends": "../project/tsconfig.base.json",
20
- "include": [
21
- "**/*.ts",
22
- "**/*.tsx",
23
- "**/*.d.ts"
24
- ]
25
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes