@awsless/awsless 0.0.294 → 0.0.296
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/dist/bin.js +36 -19
- package/dist/server.d.ts +4 -4
- package/package.json +9 -9
package/dist/bin.js
CHANGED
|
@@ -1729,7 +1729,7 @@ var logError = (error) => {
|
|
|
1729
1729
|
symbol: color.error(icon.error)
|
|
1730
1730
|
});
|
|
1731
1731
|
} else if (error instanceof ExpectedError) {
|
|
1732
|
-
log6.message(error.message, {
|
|
1732
|
+
log6.message(color.error(error.message), {
|
|
1733
1733
|
symbol: color.error(icon.error)
|
|
1734
1734
|
});
|
|
1735
1735
|
} else if (error instanceof AppError2) {
|
|
@@ -2860,12 +2860,20 @@ import type { Mock } from 'vitest'
|
|
|
2860
2860
|
|
|
2861
2861
|
type Func = (...args: any[]) => any
|
|
2862
2862
|
|
|
2863
|
-
type Invoke<
|
|
2863
|
+
type Invoke<N extends string, F extends Func> = unknown extends Parameters<F>[0] ? InvokeWithoutPayload<N, F> : InvokeWithPayload<N, F>
|
|
2864
|
+
|
|
2865
|
+
type InvokeWithPayload<Name extends string, F extends Func> = {
|
|
2864
2866
|
readonly name: Name
|
|
2865
2867
|
readonly cached: (payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => InvokeResponse<F>
|
|
2866
2868
|
(payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>): InvokeResponse<F>
|
|
2867
2869
|
}
|
|
2868
2870
|
|
|
2871
|
+
type InvokeWithoutPayload<Name extends string, F extends Func> = {
|
|
2872
|
+
readonly name: Name
|
|
2873
|
+
readonly cached: (payload?: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => InvokeResponse<F>
|
|
2874
|
+
(payload?: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>): InvokeResponse<F>
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2869
2877
|
type Response<F extends Func> = PartialDeep<Awaited<InvokeResponse<F>>, { recurseIntoArrays: true }>
|
|
2870
2878
|
type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => Promise<Response<F>> | Response<F> | void | Promise<void> | Promise<Promise<void>>
|
|
2871
2879
|
type MockHandleOrResponse<F extends Func> = MockHandle<F> | Response<F>
|
|
@@ -4000,7 +4008,9 @@ var siteFeature = defineFeature({
|
|
|
4000
4008
|
const versions = [];
|
|
4001
4009
|
if (props.ssr) {
|
|
4002
4010
|
const { lambda, code } = createLambdaFunction(group, ctx, `site`, id, props.ssr);
|
|
4003
|
-
|
|
4011
|
+
if ("version" in code) {
|
|
4012
|
+
versions.push(code.version);
|
|
4013
|
+
}
|
|
4004
4014
|
ctx.onBind((name2, value) => {
|
|
4005
4015
|
lambda.addEnvironment(name2, value);
|
|
4006
4016
|
});
|
|
@@ -4352,11 +4362,18 @@ import type { Mock } from 'vitest'
|
|
|
4352
4362
|
|
|
4353
4363
|
type Func = (...args: any[]) => any
|
|
4354
4364
|
|
|
4355
|
-
type Invoke<
|
|
4365
|
+
type Invoke<N extends string, F extends Func> = unknown extends Parameters<F>[0] ? InvokeWithoutPayload<N, F> : InvokeWithPayload<N, F>
|
|
4366
|
+
|
|
4367
|
+
type InvokeWithPayload<Name extends string, F extends Func> = {
|
|
4356
4368
|
readonly name: Name
|
|
4357
4369
|
(payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>): Promise<void>
|
|
4358
4370
|
}
|
|
4359
4371
|
|
|
4372
|
+
type InvokeWithoutPayload<Name extends string, F extends Func> = {
|
|
4373
|
+
readonly name: Name
|
|
4374
|
+
(payload?: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>): Promise<void>
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4360
4377
|
type MockHandle<F extends Func> = (payload: Parameters<F>[0]) => void | Promise<void> | Promise<Promise<void>>
|
|
4361
4378
|
type MockBuilder<F extends Func> = (handle?: MockHandle<F>) => void
|
|
4362
4379
|
type MockObject<F extends Func> = Mock<Parameters<F>, ReturnType<F>>
|
|
@@ -4632,12 +4649,12 @@ var createApp = (props, filters = []) => {
|
|
|
4632
4649
|
const readyListeners = [];
|
|
4633
4650
|
const binds = [];
|
|
4634
4651
|
const bindListeners = [];
|
|
4635
|
-
const
|
|
4636
|
-
const
|
|
4652
|
+
const globalEnv = [];
|
|
4653
|
+
const globalEnvListeners = [];
|
|
4637
4654
|
const allLocalEnv = {};
|
|
4638
4655
|
const allLocalEnvListeners = {};
|
|
4639
|
-
const
|
|
4640
|
-
const
|
|
4656
|
+
const globalPolicies = [];
|
|
4657
|
+
const globalPoliciesListeners = [];
|
|
4641
4658
|
const allLocalPolicies = {};
|
|
4642
4659
|
const allLocalPolicyListeners = {};
|
|
4643
4660
|
for (const feature of features) {
|
|
@@ -4648,7 +4665,7 @@ var createApp = (props, filters = []) => {
|
|
|
4648
4665
|
base,
|
|
4649
4666
|
shared,
|
|
4650
4667
|
onPolicy(callback) {
|
|
4651
|
-
|
|
4668
|
+
globalPoliciesListeners.push(callback);
|
|
4652
4669
|
},
|
|
4653
4670
|
// onFunction(callback) {
|
|
4654
4671
|
// allFunctionListeners.push(callback)
|
|
@@ -4657,7 +4674,7 @@ var createApp = (props, filters = []) => {
|
|
|
4657
4674
|
// allFunctions.push(lambda)
|
|
4658
4675
|
// },
|
|
4659
4676
|
registerPolicy(policy) {
|
|
4660
|
-
|
|
4677
|
+
globalPolicies.push(policy);
|
|
4661
4678
|
},
|
|
4662
4679
|
registerTest(name, paths) {
|
|
4663
4680
|
tests.push({ name, paths });
|
|
@@ -4678,10 +4695,10 @@ var createApp = (props, filters = []) => {
|
|
|
4678
4695
|
bindListeners.push(cb);
|
|
4679
4696
|
},
|
|
4680
4697
|
addEnv(name, value) {
|
|
4681
|
-
|
|
4698
|
+
globalEnv.push({ name, value });
|
|
4682
4699
|
},
|
|
4683
4700
|
onEnv(cb) {
|
|
4684
|
-
|
|
4701
|
+
globalEnvListeners.push(cb);
|
|
4685
4702
|
},
|
|
4686
4703
|
onReady(cb) {
|
|
4687
4704
|
readyListeners.push(cb);
|
|
@@ -4723,7 +4740,7 @@ var createApp = (props, filters = []) => {
|
|
|
4723
4740
|
localPolicyListeners.push(callback);
|
|
4724
4741
|
},
|
|
4725
4742
|
registerPolicy(policy) {
|
|
4726
|
-
|
|
4743
|
+
globalPolicies.push(policy);
|
|
4727
4744
|
localPolicies.push(policy);
|
|
4728
4745
|
},
|
|
4729
4746
|
registerTest(name, paths) {
|
|
@@ -4772,22 +4789,22 @@ var createApp = (props, filters = []) => {
|
|
|
4772
4789
|
}
|
|
4773
4790
|
}
|
|
4774
4791
|
}
|
|
4775
|
-
for (const listener of
|
|
4776
|
-
for (const fn of
|
|
4792
|
+
for (const listener of globalPoliciesListeners) {
|
|
4793
|
+
for (const fn of globalPolicies) {
|
|
4777
4794
|
listener(fn);
|
|
4778
4795
|
}
|
|
4779
4796
|
}
|
|
4780
|
-
for (const listener of
|
|
4781
|
-
for (const env of
|
|
4797
|
+
for (const listener of globalEnvListeners) {
|
|
4798
|
+
for (const env of globalEnv) {
|
|
4782
4799
|
listener(env.name, env.value);
|
|
4783
4800
|
}
|
|
4784
4801
|
}
|
|
4785
4802
|
for (const stackConfig of filterdStacks) {
|
|
4786
4803
|
const policies = allLocalPolicies[stackConfig.name];
|
|
4787
|
-
const
|
|
4804
|
+
const envListeners = allLocalEnvListeners[stackConfig.name];
|
|
4788
4805
|
for (const dependency of stackConfig.depends ?? []) {
|
|
4789
4806
|
const policyListeners = allLocalPolicyListeners[dependency];
|
|
4790
|
-
const
|
|
4807
|
+
const env = allLocalEnv[dependency];
|
|
4791
4808
|
for (const policy of policies) {
|
|
4792
4809
|
for (const listener of policyListeners) {
|
|
4793
4810
|
listener(policy);
|
package/dist/server.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ type CronProps<H extends Handler<S>, S extends BaseSchema> = {
|
|
|
31
31
|
schema?: S;
|
|
32
32
|
logger?: Loggers;
|
|
33
33
|
};
|
|
34
|
-
declare const cron: <H extends Handler<S, unknown>, S extends BaseSchema<any, any>>(props: CronProps<H, S>) => (event: _awsless_lambda.Input<S>, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H
|
|
34
|
+
declare const cron: <H extends Handler<S, unknown>, S extends BaseSchema<any, any>>(props: CronProps<H, S>) => (event: _awsless_lambda.Input<S>, context?: _awsless_lambda.LambdaContext | undefined) => Promise<Awaited<ReturnType<H>>>;
|
|
35
35
|
|
|
36
36
|
type FunctionProps<H extends Handler<S>, S extends BaseSchema> = {
|
|
37
37
|
handle: H;
|
|
@@ -39,7 +39,7 @@ type FunctionProps<H extends Handler<S>, S extends BaseSchema> = {
|
|
|
39
39
|
logger?: Loggers;
|
|
40
40
|
logViewableErrors?: boolean;
|
|
41
41
|
};
|
|
42
|
-
declare const func: <H extends Handler<S, unknown>, S extends BaseSchema<any, any>>(props: FunctionProps<H, S>) => (event: _awsless_lambda.Input<S>, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H
|
|
42
|
+
declare const func: <H extends Handler<S, unknown>, S extends BaseSchema<any, any>>(props: FunctionProps<H, S>) => (event: _awsless_lambda.Input<S>, context?: _awsless_lambda.LambdaContext | undefined) => Promise<Awaited<ReturnType<H>>>;
|
|
43
43
|
|
|
44
44
|
type QueueProps<H extends Handler<S>, S extends BaseSchema> = {
|
|
45
45
|
handle: H;
|
|
@@ -50,7 +50,7 @@ declare const queue: <H extends Handler<SqsQueueSchema<S>, unknown>, S extends B
|
|
|
50
50
|
Records: {
|
|
51
51
|
body: string | valibot.Input<S>;
|
|
52
52
|
}[];
|
|
53
|
-
}, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H
|
|
53
|
+
}, context?: _awsless_lambda.LambdaContext | undefined) => Promise<Awaited<ReturnType<H>>>;
|
|
54
54
|
|
|
55
55
|
type TopicProps<H extends Handler<S>, S extends BaseSchema> = {
|
|
56
56
|
handle: H;
|
|
@@ -63,7 +63,7 @@ declare const topic: <H extends Handler<SnsTopicSchema<S>, unknown>, S extends B
|
|
|
63
63
|
Message: string | valibot.Input<S>;
|
|
64
64
|
};
|
|
65
65
|
}[];
|
|
66
|
-
}, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H
|
|
66
|
+
}, context?: _awsless_lambda.LambdaContext | undefined) => Promise<Awaited<ReturnType<H>>>;
|
|
67
67
|
|
|
68
68
|
interface FunctionMock {
|
|
69
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.296",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@awsless/
|
|
31
|
+
"@awsless/lambda": "^0.0.22",
|
|
32
32
|
"@awsless/redis": "^0.0.12",
|
|
33
|
+
"@awsless/open-search": "^0.0.12",
|
|
34
|
+
"@awsless/s3": "^0.0.15",
|
|
33
35
|
"@awsless/sns": "^0.0.7",
|
|
34
|
-
"@awsless/lambda": "^0.0.19",
|
|
35
|
-
"@awsless/ssm": "^0.0.7",
|
|
36
|
-
"@awsless/sqs": "^0.0.7",
|
|
37
36
|
"@awsless/validate": "^0.0.14",
|
|
38
|
-
"@awsless/
|
|
39
|
-
"@awsless/
|
|
37
|
+
"@awsless/sqs": "^0.0.7",
|
|
38
|
+
"@awsless/ssm": "^0.0.7",
|
|
39
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"zip-a-folder": "^3.1.6",
|
|
106
106
|
"zod": "^3.21.4",
|
|
107
107
|
"zod-to-json-schema": "^3.22.3",
|
|
108
|
+
"@awsless/formation": "^0.0.38",
|
|
108
109
|
"@awsless/duration": "^0.0.1",
|
|
109
110
|
"@awsless/size": "^0.0.1",
|
|
110
|
-
"@awsless/graphql": "^0.0.9",
|
|
111
111
|
"@awsless/validate": "^0.0.14",
|
|
112
|
-
"@awsless/
|
|
112
|
+
"@awsless/graphql": "^0.0.9",
|
|
113
113
|
"@awsless/code": "^0.0.10"
|
|
114
114
|
},
|
|
115
115
|
"scripts": {
|