effortless-aws 0.7.2 → 0.8.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/README.md +1 -1
- package/dist/{chunk-5L76NICW.js → chunk-B4P7ZKNM.js} +11 -7
- package/dist/cli/index.js +1333 -642
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +77 -70
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/runtime/wrap-app.js +3 -3
- package/dist/runtime/wrap-fifo-queue.js +2 -2
- package/dist/runtime/wrap-http.js +2 -2
- package/dist/runtime/wrap-table-stream.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ type LambdaWithPermissions = LambdaConfig & {
|
|
|
113
113
|
/** Additional IAM permissions for the Lambda */
|
|
114
114
|
permissions?: Permission[];
|
|
115
115
|
};
|
|
116
|
-
type AnyParamRef = ParamRef<any
|
|
116
|
+
type AnyParamRef = ParamRef<any> | string;
|
|
117
117
|
/**
|
|
118
118
|
* Reference to an SSM Parameter Store parameter.
|
|
119
119
|
*
|
|
@@ -125,12 +125,13 @@ type ParamRef<T = string> = {
|
|
|
125
125
|
readonly transform?: (raw: string) => T;
|
|
126
126
|
};
|
|
127
127
|
/**
|
|
128
|
-
* Maps a
|
|
128
|
+
* Maps a config declaration to resolved value types.
|
|
129
|
+
* Plain strings resolve to `string`, `ParamRef<T>` resolves to `T`.
|
|
129
130
|
*
|
|
130
|
-
* @typeParam P - Record of
|
|
131
|
+
* @typeParam P - Record of config keys to string or ParamRef instances
|
|
131
132
|
*/
|
|
132
|
-
type
|
|
133
|
-
[K in keyof P]: P[K] extends ParamRef<infer T> ? T :
|
|
133
|
+
type ResolveConfig<P> = {
|
|
134
|
+
[K in keyof P]: P[K] extends ParamRef<infer T> ? T : string;
|
|
134
135
|
};
|
|
135
136
|
/**
|
|
136
137
|
* Declare an SSM Parameter Store parameter.
|
|
@@ -144,7 +145,7 @@ type ResolveParams<P> = {
|
|
|
144
145
|
*
|
|
145
146
|
* @example Simple string parameter
|
|
146
147
|
* ```typescript
|
|
147
|
-
*
|
|
148
|
+
* config: {
|
|
148
149
|
* dbUrl: param("database-url"),
|
|
149
150
|
* }
|
|
150
151
|
* ```
|
|
@@ -153,8 +154,8 @@ type ResolveParams<P> = {
|
|
|
153
154
|
* ```typescript
|
|
154
155
|
* import TOML from "smol-toml";
|
|
155
156
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
157
|
+
* config: {
|
|
158
|
+
* appConfig: param("app-config", TOML.parse),
|
|
158
159
|
* }
|
|
159
160
|
* ```
|
|
160
161
|
*/
|
|
@@ -175,7 +176,7 @@ declare function param<T>(key: string, transform: (raw: string) => T): ParamRef<
|
|
|
175
176
|
* ```typescript
|
|
176
177
|
* type User = { id: string; email: string };
|
|
177
178
|
*
|
|
178
|
-
* // Before (breaks inference for
|
|
179
|
+
* // Before (breaks inference for setup, deps, config):
|
|
179
180
|
* export const users = defineTable<User>({ pk: { name: "id", type: "string" } });
|
|
180
181
|
*
|
|
181
182
|
* // After (all generics inferred correctly):
|
|
@@ -190,7 +191,7 @@ declare function param<T>(key: string, transform: (raw: string) => T): ParamRef<
|
|
|
190
191
|
* export const orders = defineTable({
|
|
191
192
|
* pk: { name: "id", type: "string" },
|
|
192
193
|
* schema: typed<Order>(),
|
|
193
|
-
*
|
|
194
|
+
* setup: async () => ({ db: createClient() }),
|
|
194
195
|
* onRecord: async ({ record, ctx }) => {
|
|
195
196
|
* // record.new is Order, ctx is { db: Client } — all inferred
|
|
196
197
|
* },
|
|
@@ -275,7 +276,7 @@ type TableKey = {
|
|
|
275
276
|
/** DynamoDB Streams view type - determines what data is captured in stream records */
|
|
276
277
|
type StreamView = "NEW_AND_OLD_IMAGES" | "NEW_IMAGE" | "OLD_IMAGE" | "KEYS_ONLY";
|
|
277
278
|
/**
|
|
278
|
-
* Configuration options extracted from DefineTableOptions (without onRecord/
|
|
279
|
+
* Configuration options extracted from DefineTableOptions (without onRecord/setup)
|
|
279
280
|
*/
|
|
280
281
|
type TableConfig = LambdaWithPermissions & {
|
|
281
282
|
/** Partition key definition */
|
|
@@ -326,13 +327,15 @@ type FailedRecord<T = Record<string, unknown>> = {
|
|
|
326
327
|
error: unknown;
|
|
327
328
|
};
|
|
328
329
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* With
|
|
330
|
+
* Setup factory type — conditional on whether deps/config are declared.
|
|
331
|
+
* No deps/config: `() => C | Promise<C>`
|
|
332
|
+
* With deps/config: `(args: { deps?, config? }) => C | Promise<C>`
|
|
332
333
|
*/
|
|
333
|
-
type
|
|
334
|
-
|
|
335
|
-
})
|
|
334
|
+
type SetupFactory$2<C, D, P> = [D | P] extends [undefined] ? () => C | Promise<C> : (args: ([D] extends [undefined] ? {} : {
|
|
335
|
+
deps: ResolveDeps$2<D>;
|
|
336
|
+
}) & ([P] extends [undefined] ? {} : {
|
|
337
|
+
config: ResolveConfig<P & {}>;
|
|
338
|
+
})) => C | Promise<C>;
|
|
336
339
|
/**
|
|
337
340
|
* Callback function type for processing a single DynamoDB stream record
|
|
338
341
|
*/
|
|
@@ -344,7 +347,7 @@ type TableRecordFn<T = Record<string, unknown>, C = undefined, R = void, D = und
|
|
|
344
347
|
}) & ([D] extends [undefined] ? {} : {
|
|
345
348
|
deps: ResolveDeps$2<D>;
|
|
346
349
|
}) & ([P] extends [undefined] ? {} : {
|
|
347
|
-
|
|
350
|
+
config: ResolveConfig<P>;
|
|
348
351
|
}) & ([S] extends [undefined] ? {} : {
|
|
349
352
|
readStatic: (path: string) => string;
|
|
350
353
|
})) => Promise<R>;
|
|
@@ -360,7 +363,7 @@ type TableBatchCompleteFn<T = Record<string, unknown>, C = undefined, R = void,
|
|
|
360
363
|
}) & ([D] extends [undefined] ? {} : {
|
|
361
364
|
deps: ResolveDeps$2<D>;
|
|
362
365
|
}) & ([P] extends [undefined] ? {} : {
|
|
363
|
-
|
|
366
|
+
config: ResolveConfig<P>;
|
|
364
367
|
}) & ([S] extends [undefined] ? {} : {
|
|
365
368
|
readStatic: (path: string) => string;
|
|
366
369
|
})) => Promise<void>;
|
|
@@ -375,7 +378,7 @@ type TableBatchFn<T = Record<string, unknown>, C = undefined, D = undefined, P =
|
|
|
375
378
|
}) & ([D] extends [undefined] ? {} : {
|
|
376
379
|
deps: ResolveDeps$2<D>;
|
|
377
380
|
}) & ([P] extends [undefined] ? {} : {
|
|
378
|
-
|
|
381
|
+
config: ResolveConfig<P>;
|
|
379
382
|
}) & ([S] extends [undefined] ? {} : {
|
|
380
383
|
readStatic: (path: string) => string;
|
|
381
384
|
})) => Promise<void>;
|
|
@@ -393,12 +396,12 @@ type DefineTableBase<T = Record<string, unknown>, C = undefined, D = undefined,
|
|
|
393
396
|
*/
|
|
394
397
|
onError?: (error: unknown) => void;
|
|
395
398
|
/**
|
|
396
|
-
* Factory function to
|
|
399
|
+
* Factory function to initialize shared state for callbacks.
|
|
397
400
|
* Called once on cold start, result is cached and reused across invocations.
|
|
398
|
-
* When params are declared, receives
|
|
401
|
+
* When deps/params are declared, receives them as argument.
|
|
399
402
|
* Supports both sync and async return values.
|
|
400
403
|
*/
|
|
401
|
-
|
|
404
|
+
setup?: SetupFactory$2<C, D, P>;
|
|
402
405
|
/**
|
|
403
406
|
* Dependencies on other handlers (tables, queues, etc.).
|
|
404
407
|
* Typed clients are injected into the handler via the `deps` argument.
|
|
@@ -407,9 +410,9 @@ type DefineTableBase<T = Record<string, unknown>, C = undefined, D = undefined,
|
|
|
407
410
|
/**
|
|
408
411
|
* SSM Parameter Store parameters.
|
|
409
412
|
* Declare with `param()` helper. Values are fetched and cached at cold start.
|
|
410
|
-
* Typed values are injected into the handler via the `
|
|
413
|
+
* Typed values are injected into the handler via the `config` argument.
|
|
411
414
|
*/
|
|
412
|
-
|
|
415
|
+
config?: P;
|
|
413
416
|
/**
|
|
414
417
|
* Static file glob patterns to bundle into the Lambda ZIP.
|
|
415
418
|
* Files are accessible at runtime via the `readStatic` callback argument.
|
|
@@ -441,12 +444,12 @@ type DefineTableOptions<T = Record<string, unknown>, C = undefined, R = void, D
|
|
|
441
444
|
*/
|
|
442
445
|
type TableHandler<T = Record<string, unknown>, C = undefined, R = void, D = undefined, P = undefined, S extends string[] | undefined = undefined> = {
|
|
443
446
|
readonly __brand: "effortless-table";
|
|
444
|
-
readonly
|
|
447
|
+
readonly __spec: TableConfig;
|
|
445
448
|
readonly schema?: (input: unknown) => T;
|
|
446
449
|
readonly onError?: (error: unknown) => void;
|
|
447
|
-
readonly
|
|
450
|
+
readonly setup?: (...args: any[]) => C | Promise<C>;
|
|
448
451
|
readonly deps?: D;
|
|
449
|
-
readonly
|
|
452
|
+
readonly config?: P;
|
|
450
453
|
readonly static?: string[];
|
|
451
454
|
readonly onRecord?: TableRecordFn<T, C, R, D, P, S>;
|
|
452
455
|
readonly onBatchComplete?: TableBatchCompleteFn<T, C, R, D, P, S>;
|
|
@@ -549,7 +552,7 @@ type HttpConfig = LambdaWithPermissions & {
|
|
|
549
552
|
* Handler function type for HTTP endpoints
|
|
550
553
|
*
|
|
551
554
|
* @typeParam T - Type of the validated request body (from schema function)
|
|
552
|
-
* @typeParam C - Type of the
|
|
555
|
+
* @typeParam C - Type of the setup result (from setup function)
|
|
553
556
|
* @typeParam D - Type of the deps (from deps declaration)
|
|
554
557
|
* @typeParam P - Type of the params (from params declaration)
|
|
555
558
|
*/
|
|
@@ -562,23 +565,25 @@ type HttpHandlerFn<T = undefined, C = undefined, D = undefined, P = undefined, S
|
|
|
562
565
|
}) & ([D] extends [undefined] ? {} : {
|
|
563
566
|
deps: ResolveDeps$1<D>;
|
|
564
567
|
}) & ([P] extends [undefined] ? {} : {
|
|
565
|
-
|
|
568
|
+
config: ResolveConfig<P>;
|
|
566
569
|
}) & ([S] extends [undefined] ? {} : {
|
|
567
570
|
readStatic: (path: string) => string;
|
|
568
571
|
})) => Promise<HttpResponse>;
|
|
569
572
|
/**
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* With
|
|
573
|
+
* Setup factory type — conditional on whether deps/config are declared.
|
|
574
|
+
* No deps/config: `() => C | Promise<C>`
|
|
575
|
+
* With deps/config: `(args: { deps?, config? }) => C | Promise<C>`
|
|
573
576
|
*/
|
|
574
|
-
type
|
|
575
|
-
|
|
576
|
-
})
|
|
577
|
+
type SetupFactory$1<C, D, P> = [D | P] extends [undefined] ? () => C | Promise<C> : (args: ([D] extends [undefined] ? {} : {
|
|
578
|
+
deps: ResolveDeps$1<D>;
|
|
579
|
+
}) & ([P] extends [undefined] ? {} : {
|
|
580
|
+
config: ResolveConfig<P & {}>;
|
|
581
|
+
})) => C | Promise<C>;
|
|
577
582
|
/**
|
|
578
583
|
* Options for defining an HTTP endpoint
|
|
579
584
|
*
|
|
580
585
|
* @typeParam T - Type of the validated request body (inferred from schema function)
|
|
581
|
-
* @typeParam C - Type of the
|
|
586
|
+
* @typeParam C - Type of the setup result returned by setup function
|
|
582
587
|
* @typeParam D - Type of the deps (from deps declaration)
|
|
583
588
|
* @typeParam P - Type of the params (from params declaration)
|
|
584
589
|
*/
|
|
@@ -600,12 +605,12 @@ type DefineHttpOptions<T = undefined, C = undefined, D extends Record<string, An
|
|
|
600
605
|
*/
|
|
601
606
|
onError?: (error: unknown, req: HttpRequest) => HttpResponse;
|
|
602
607
|
/**
|
|
603
|
-
* Factory function to
|
|
608
|
+
* Factory function to initialize shared state for the request handler.
|
|
604
609
|
* Called once on cold start, result is cached and reused across invocations.
|
|
605
|
-
* When params are declared, receives
|
|
610
|
+
* When deps/params are declared, receives them as argument.
|
|
606
611
|
* Supports both sync and async return values.
|
|
607
612
|
*/
|
|
608
|
-
|
|
613
|
+
setup?: SetupFactory$1<C, D, P>;
|
|
609
614
|
/**
|
|
610
615
|
* Dependencies on other handlers (tables, queues, etc.).
|
|
611
616
|
* Typed clients are injected into the handler via the `deps` argument.
|
|
@@ -614,9 +619,9 @@ type DefineHttpOptions<T = undefined, C = undefined, D extends Record<string, An
|
|
|
614
619
|
/**
|
|
615
620
|
* SSM Parameter Store parameters.
|
|
616
621
|
* Declare with `param()` helper. Values are fetched and cached at cold start.
|
|
617
|
-
* Typed values are injected into the handler via the `
|
|
622
|
+
* Typed values are injected into the handler via the `config` argument.
|
|
618
623
|
*/
|
|
619
|
-
|
|
624
|
+
config?: P;
|
|
620
625
|
/**
|
|
621
626
|
* Static file glob patterns to bundle into the Lambda ZIP.
|
|
622
627
|
* Files are accessible at runtime via the `readStatic` callback argument.
|
|
@@ -631,12 +636,12 @@ type DefineHttpOptions<T = undefined, C = undefined, D extends Record<string, An
|
|
|
631
636
|
*/
|
|
632
637
|
type HttpHandler<T = undefined, C = undefined, D = undefined, P = undefined, S extends string[] | undefined = undefined> = {
|
|
633
638
|
readonly __brand: "effortless-http";
|
|
634
|
-
readonly
|
|
639
|
+
readonly __spec: HttpConfig;
|
|
635
640
|
readonly schema?: (input: unknown) => T;
|
|
636
641
|
readonly onError?: (error: unknown, req: HttpRequest) => HttpResponse;
|
|
637
|
-
readonly
|
|
642
|
+
readonly setup?: (...args: any[]) => C | Promise<C>;
|
|
638
643
|
readonly deps?: D;
|
|
639
|
-
readonly
|
|
644
|
+
readonly config?: P;
|
|
640
645
|
readonly static?: string[];
|
|
641
646
|
readonly onRequest: HttpHandlerFn<T, C, D, P, S>;
|
|
642
647
|
};
|
|
@@ -644,10 +649,10 @@ type HttpHandler<T = undefined, C = undefined, D = undefined, P = undefined, S e
|
|
|
644
649
|
* Define an HTTP endpoint that creates an API Gateway route + Lambda function
|
|
645
650
|
*
|
|
646
651
|
* @typeParam T - Type of the validated request body (inferred from schema function)
|
|
647
|
-
* @typeParam C - Type of the
|
|
652
|
+
* @typeParam C - Type of the setup result (inferred from setup function)
|
|
648
653
|
* @typeParam D - Type of the deps (from deps declaration)
|
|
649
654
|
* @typeParam P - Type of the params (from params declaration)
|
|
650
|
-
* @param options - Configuration, optional schema, optional
|
|
655
|
+
* @param options - Configuration, optional schema, optional setup factory, and request handler
|
|
651
656
|
* @returns Handler object used by the deployment system
|
|
652
657
|
*
|
|
653
658
|
* @example Basic GET endpoint
|
|
@@ -669,15 +674,15 @@ type HttpHandler<T = undefined, C = undefined, D = undefined, P = undefined, S e
|
|
|
669
674
|
* export const api = defineHttp({
|
|
670
675
|
* method: "GET",
|
|
671
676
|
* path: "/orders",
|
|
672
|
-
*
|
|
677
|
+
* config: {
|
|
673
678
|
* dbUrl: param("database-url"),
|
|
674
679
|
* },
|
|
675
|
-
*
|
|
676
|
-
* pool: createPool(
|
|
680
|
+
* setup: async ({ config }) => ({
|
|
681
|
+
* pool: createPool(config.dbUrl),
|
|
677
682
|
* }),
|
|
678
|
-
* onRequest: async ({ req, ctx,
|
|
683
|
+
* onRequest: async ({ req, ctx, config }) => ({
|
|
679
684
|
* status: 200,
|
|
680
|
-
* body: { dbUrl:
|
|
685
|
+
* body: { dbUrl: config.dbUrl }
|
|
681
686
|
* })
|
|
682
687
|
* });
|
|
683
688
|
* ```
|
|
@@ -705,7 +710,7 @@ type AppConfig = LambdaConfig & {
|
|
|
705
710
|
*/
|
|
706
711
|
type AppHandler = {
|
|
707
712
|
readonly __brand: "effortless-app";
|
|
708
|
-
readonly
|
|
713
|
+
readonly __spec: AppConfig;
|
|
709
714
|
};
|
|
710
715
|
/**
|
|
711
716
|
* Deploy a static site via Lambda + API Gateway.
|
|
@@ -747,7 +752,7 @@ type StaticSiteConfig = {
|
|
|
747
752
|
*/
|
|
748
753
|
type StaticSiteHandler = {
|
|
749
754
|
readonly __brand: "effortless-static-site";
|
|
750
|
-
readonly
|
|
755
|
+
readonly __spec: StaticSiteConfig;
|
|
751
756
|
};
|
|
752
757
|
/**
|
|
753
758
|
* Deploy a static site via S3 + CloudFront CDN.
|
|
@@ -825,13 +830,15 @@ type FifoQueueConfig = LambdaWithPermissions & {
|
|
|
825
830
|
contentBasedDeduplication?: boolean;
|
|
826
831
|
};
|
|
827
832
|
/**
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
* With
|
|
833
|
+
* Setup factory type — conditional on whether deps/config are declared.
|
|
834
|
+
* No deps/config: `() => C | Promise<C>`
|
|
835
|
+
* With deps/config: `(args: { deps?, config? }) => C | Promise<C>`
|
|
831
836
|
*/
|
|
832
|
-
type
|
|
833
|
-
|
|
834
|
-
})
|
|
837
|
+
type SetupFactory<C, D, P> = [D | P] extends [undefined] ? () => C | Promise<C> : (args: ([D] extends [undefined] ? {} : {
|
|
838
|
+
deps: ResolveDeps<D>;
|
|
839
|
+
}) & ([P] extends [undefined] ? {} : {
|
|
840
|
+
config: ResolveConfig<P & {}>;
|
|
841
|
+
})) => C | Promise<C>;
|
|
835
842
|
/**
|
|
836
843
|
* Per-message handler function.
|
|
837
844
|
* Called once per message in the batch. Failures are reported individually.
|
|
@@ -843,7 +850,7 @@ type FifoQueueMessageFn<T = unknown, C = undefined, D = undefined, P = undefined
|
|
|
843
850
|
}) & ([D] extends [undefined] ? {} : {
|
|
844
851
|
deps: ResolveDeps<D>;
|
|
845
852
|
}) & ([P] extends [undefined] ? {} : {
|
|
846
|
-
|
|
853
|
+
config: ResolveConfig<P>;
|
|
847
854
|
}) & ([S] extends [undefined] ? {} : {
|
|
848
855
|
readStatic: (path: string) => string;
|
|
849
856
|
})) => Promise<void>;
|
|
@@ -858,7 +865,7 @@ type FifoQueueBatchFn<T = unknown, C = undefined, D = undefined, P = undefined,
|
|
|
858
865
|
}) & ([D] extends [undefined] ? {} : {
|
|
859
866
|
deps: ResolveDeps<D>;
|
|
860
867
|
}) & ([P] extends [undefined] ? {} : {
|
|
861
|
-
|
|
868
|
+
config: ResolveConfig<P>;
|
|
862
869
|
}) & ([S] extends [undefined] ? {} : {
|
|
863
870
|
readStatic: (path: string) => string;
|
|
864
871
|
})) => Promise<void>;
|
|
@@ -875,11 +882,11 @@ type DefineFifoQueueBase<T = unknown, C = undefined, D = undefined, P = undefine
|
|
|
875
882
|
*/
|
|
876
883
|
onError?: (error: unknown) => void;
|
|
877
884
|
/**
|
|
878
|
-
* Factory function to
|
|
885
|
+
* Factory function to initialize shared state for the handler.
|
|
879
886
|
* Called once on cold start, result is cached and reused across invocations.
|
|
880
|
-
* When params are declared, receives
|
|
887
|
+
* When deps/params are declared, receives them as argument.
|
|
881
888
|
*/
|
|
882
|
-
|
|
889
|
+
setup?: SetupFactory<C, D, P>;
|
|
883
890
|
/**
|
|
884
891
|
* Dependencies on other handlers (tables, queues, etc.).
|
|
885
892
|
* Typed clients are injected into the handler via the `deps` argument.
|
|
@@ -889,7 +896,7 @@ type DefineFifoQueueBase<T = unknown, C = undefined, D = undefined, P = undefine
|
|
|
889
896
|
* SSM Parameter Store parameters.
|
|
890
897
|
* Declare with `param()` helper. Values are fetched and cached at cold start.
|
|
891
898
|
*/
|
|
892
|
-
|
|
899
|
+
config?: P;
|
|
893
900
|
/**
|
|
894
901
|
* Static file glob patterns to bundle into the Lambda ZIP.
|
|
895
902
|
* Files are accessible at runtime via the `readStatic` callback argument.
|
|
@@ -913,12 +920,12 @@ type DefineFifoQueueOptions<T = unknown, C = undefined, D extends Record<string,
|
|
|
913
920
|
*/
|
|
914
921
|
type FifoQueueHandler<T = unknown, C = undefined, D = undefined, P = undefined, S extends string[] | undefined = undefined> = {
|
|
915
922
|
readonly __brand: "effortless-fifo-queue";
|
|
916
|
-
readonly
|
|
923
|
+
readonly __spec: FifoQueueConfig;
|
|
917
924
|
readonly schema?: (input: unknown) => T;
|
|
918
925
|
readonly onError?: (error: unknown) => void;
|
|
919
|
-
readonly
|
|
926
|
+
readonly setup?: (...args: any[]) => C | Promise<C>;
|
|
920
927
|
readonly deps?: D;
|
|
921
|
-
readonly
|
|
928
|
+
readonly config?: P;
|
|
922
929
|
readonly static?: string[];
|
|
923
930
|
readonly onMessage?: FifoQueueMessageFn<T, C, D, P, S>;
|
|
924
931
|
readonly onBatch?: FifoQueueBatchFn<T, C, D, P, S>;
|
|
@@ -955,4 +962,4 @@ type FifoQueueHandler<T = unknown, C = undefined, D = undefined, P = undefined,
|
|
|
955
962
|
*/
|
|
956
963
|
declare const defineFifoQueue: <T = unknown, C = undefined, D extends Record<string, AnyTableHandler> | undefined = undefined, P extends Record<string, AnyParamRef> | undefined = undefined, S extends string[] | undefined = undefined>(options: DefineFifoQueueOptions<T, C, D, P, S>) => FifoQueueHandler<T, C, D, P, S>;
|
|
957
964
|
|
|
958
|
-
export { type AppConfig, type AppHandler, type ContentType, type DefineFifoQueueOptions, type DefineHttpOptions, type DefineTableOptions, type EffortlessConfig, type FailedRecord, type FifoQueueBatchFn, type FifoQueueConfig, type FifoQueueHandler, type FifoQueueMessage, type FifoQueueMessageFn, type HttpConfig, type HttpHandler, type HttpHandlerFn, type HttpMethod, type HttpRequest, type HttpResponse, type KeyType, type LambdaConfig, type LambdaWithPermissions, type LogLevel, type ParamRef, type QueryParams, type ResolveDeps$1 as ResolveDeps, type
|
|
965
|
+
export { type AppConfig, type AppHandler, type ContentType, type DefineFifoQueueOptions, type DefineHttpOptions, type DefineTableOptions, type EffortlessConfig, type FailedRecord, type FifoQueueBatchFn, type FifoQueueConfig, type FifoQueueHandler, type FifoQueueMessage, type FifoQueueMessageFn, type HttpConfig, type HttpHandler, type HttpHandlerFn, type HttpMethod, type HttpRequest, type HttpResponse, type KeyType, type LambdaConfig, type LambdaWithPermissions, type LogLevel, type ParamRef, type QueryParams, type ResolveConfig, type ResolveDeps$1 as ResolveDeps, type StaticSiteConfig, type StaticSiteHandler, type StreamView, type TableBatchCompleteFn, type TableBatchFn, type TableClient, type TableConfig, type TableHandler, type TableKey, type TableRecord, type TableRecordFn, defineApp, defineConfig, defineFifoQueue, defineHttp, defineStaticSite, defineTable, param, typed };
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,15 @@ var defineConfig = (config) => config;
|
|
|
3
3
|
|
|
4
4
|
// src/handlers/define-http.ts
|
|
5
5
|
var defineHttp = (options) => {
|
|
6
|
-
const { onRequest, onError,
|
|
6
|
+
const { onRequest, onError, setup, schema, deps, config, static: staticFiles, ...__spec } = options;
|
|
7
7
|
return {
|
|
8
8
|
__brand: "effortless-http",
|
|
9
|
-
|
|
9
|
+
__spec,
|
|
10
10
|
...schema ? { schema } : {},
|
|
11
11
|
...onError ? { onError } : {},
|
|
12
|
-
...
|
|
12
|
+
...setup ? { setup } : {},
|
|
13
13
|
...deps ? { deps } : {},
|
|
14
|
-
...
|
|
14
|
+
...config ? { config } : {},
|
|
15
15
|
...staticFiles ? { static: staticFiles } : {},
|
|
16
16
|
onRequest
|
|
17
17
|
};
|
|
@@ -19,15 +19,15 @@ var defineHttp = (options) => {
|
|
|
19
19
|
|
|
20
20
|
// src/handlers/define-table.ts
|
|
21
21
|
var defineTable = (options) => {
|
|
22
|
-
const { onRecord, onBatchComplete, onBatch, onError, schema,
|
|
22
|
+
const { onRecord, onBatchComplete, onBatch, onError, schema, setup, deps, config, static: staticFiles, ...__spec } = options;
|
|
23
23
|
return {
|
|
24
24
|
__brand: "effortless-table",
|
|
25
|
-
|
|
25
|
+
__spec,
|
|
26
26
|
...schema ? { schema } : {},
|
|
27
27
|
...onError ? { onError } : {},
|
|
28
|
-
...
|
|
28
|
+
...setup ? { setup } : {},
|
|
29
29
|
...deps ? { deps } : {},
|
|
30
|
-
...
|
|
30
|
+
...config ? { config } : {},
|
|
31
31
|
...staticFiles ? { static: staticFiles } : {},
|
|
32
32
|
...onRecord ? { onRecord } : {},
|
|
33
33
|
...onBatchComplete ? { onBatchComplete } : {},
|
|
@@ -38,26 +38,26 @@ var defineTable = (options) => {
|
|
|
38
38
|
// src/handlers/define-app.ts
|
|
39
39
|
var defineApp = (options) => ({
|
|
40
40
|
__brand: "effortless-app",
|
|
41
|
-
|
|
41
|
+
__spec: options
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
// src/handlers/define-static-site.ts
|
|
45
45
|
var defineStaticSite = (options) => ({
|
|
46
46
|
__brand: "effortless-static-site",
|
|
47
|
-
|
|
47
|
+
__spec: options
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// src/handlers/define-fifo-queue.ts
|
|
51
51
|
var defineFifoQueue = (options) => {
|
|
52
|
-
const { onMessage, onBatch, onError, schema,
|
|
52
|
+
const { onMessage, onBatch, onError, schema, setup, deps, config, static: staticFiles, ...__spec } = options;
|
|
53
53
|
return {
|
|
54
54
|
__brand: "effortless-fifo-queue",
|
|
55
|
-
|
|
55
|
+
__spec,
|
|
56
56
|
...schema ? { schema } : {},
|
|
57
57
|
...onError ? { onError } : {},
|
|
58
|
-
...
|
|
58
|
+
...setup ? { setup } : {},
|
|
59
59
|
...deps ? { deps } : {},
|
|
60
|
-
...
|
|
60
|
+
...config ? { config } : {},
|
|
61
61
|
...staticFiles ? { static: staticFiles } : {},
|
|
62
62
|
...onMessage ? { onMessage } : {},
|
|
63
63
|
...onBatch ? { onBatch } : {}
|