@awsless/awsless 0.0.247 → 0.0.248

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.
@@ -0,0 +1,11 @@
1
+ declare const getAuthName: <N extends string>(name: N) => `app--auth--${N}`;
2
+ interface AuthResources {
3
+ }
4
+ declare const Auth: AuthResources;
5
+ declare const getAuthProps: (name: string) => {
6
+ readonly name: `app--auth--${string}`;
7
+ readonly userPoolId: string;
8
+ readonly clientId: string;
9
+ };
10
+
11
+ export { Auth as A, getAuthProps as a, AuthResources as b, getAuthName as g };
package/dist/bin.js CHANGED
@@ -990,6 +990,14 @@ var SitesSchema = z27.record(
990
990
  z27.object({
991
991
  domain: ResourceIdSchema.describe("The domain id to link your site with."),
992
992
  subDomain: z27.string().optional(),
993
+ // bind: z
994
+ // .object({
995
+ // auth: z.array(ResourceIdSchema),
996
+ // graphql: z.array(ResourceIdSchema),
997
+ // // http: z.array(ResourceIdSchema),
998
+ // // rest: z.array(ResourceIdSchema),
999
+ // })
1000
+ // .optional(),
993
1001
  static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
994
1002
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
995
1003
  // bind: z.object({
@@ -2632,7 +2640,7 @@ var functionFeature = defineFeature({
2632
2640
  });
2633
2641
 
2634
2642
  // src/feature/graphql/index.ts
2635
- import { paramCase as paramCase5 } from "change-case";
2643
+ import { constantCase as constantCase3, paramCase as paramCase5 } from "change-case";
2636
2644
  import { mergeTypeDefs } from "@graphql-tools/merge";
2637
2645
  import { generate } from "@awsless/graphql";
2638
2646
  import { buildSchema, print } from "graphql";
@@ -2972,6 +2980,7 @@ var graphqlFeature = defineFeature({
2972
2980
  evaluateTargetHealth: false
2973
2981
  }
2974
2982
  });
2983
+ ctx.bindEnv(`GRAPHQL_${constantCase3(id)}_ENDPOINT`, domainName);
2975
2984
  }
2976
2985
  }
2977
2986
  },
@@ -3119,7 +3128,7 @@ var pubsubFeature = defineFeature({
3119
3128
  });
3120
3129
 
3121
3130
  // src/feature/queue/index.ts
3122
- import { camelCase as camelCase4, constantCase as constantCase3 } from "change-case";
3131
+ import { camelCase as camelCase4, constantCase as constantCase4 } from "change-case";
3123
3132
  import { relative as relative2 } from "path";
3124
3133
  import deepmerge2 from "deepmerge";
3125
3134
  import { Node as Node9, aws as aws9 } from "@awsless/formation";
@@ -3195,7 +3204,7 @@ var queueFeature = defineFeature({
3195
3204
  });
3196
3205
  ctx.onFunction(({ lambda: lambda2, policy: policy2 }) => {
3197
3206
  policy2.addStatement(queue2.permissions);
3198
- lambda2.addEnvironment(`QUEUE_${constantCase3(ctx.stack.name)}_${constantCase3(id)}_URL`, queue2.url);
3207
+ lambda2.addEnvironment(`QUEUE_${constantCase4(ctx.stack.name)}_${constantCase4(id)}_URL`, queue2.url);
3199
3208
  });
3200
3209
  }
3201
3210
  }
@@ -3483,7 +3492,7 @@ var vpcFeature = defineFeature({
3483
3492
  });
3484
3493
 
3485
3494
  // src/feature/auth/index.ts
3486
- import { constantCase as constantCase4 } from "change-case";
3495
+ import { constantCase as constantCase5 } from "change-case";
3487
3496
  import { Node as Node14, aws as aws14 } from "@awsless/formation";
3488
3497
  var authFeature = defineFeature({
3489
3498
  name: "auth",
@@ -3536,8 +3545,8 @@ var authFeature = defineFeature({
3536
3545
  functionArn: item.lambda.arn,
3537
3546
  sourceArn: userPoolArn
3538
3547
  });
3539
- item.lambda.addEnvironment(`AUTH_${constantCase4(id)}_USER_POOL_ID`, userPoolId);
3540
- item.lambda.addEnvironment(`AUTH_${constantCase4(id)}_CLIENT_ID`, clientId);
3548
+ item.lambda.addEnvironment(`AUTH_${constantCase5(id)}_USER_POOL_ID`, userPoolId);
3549
+ item.lambda.addEnvironment(`AUTH_${constantCase5(id)}_CLIENT_ID`, clientId);
3541
3550
  item.policy.addStatement({
3542
3551
  actions: ["cognito:*"],
3543
3552
  resources: [
@@ -3586,6 +3595,8 @@ var authFeature = defineFeature({
3586
3595
  userSrp: true
3587
3596
  }
3588
3597
  });
3598
+ ctx.bindEnv(`AUTH_${constantCase5(id)}_USER_POOL_ID`, userPool.id);
3599
+ ctx.bindEnv(`AUTH_${constantCase5(id)}_CLIENT_ID`, client.id);
3589
3600
  ctx.shared.set(`auth-${id}-user-pool-arn`, userPool.arn);
3590
3601
  ctx.shared.set(`auth-${id}-user-pool-id`, userPool.id);
3591
3602
  ctx.shared.set(`auth-${id}-client-id`, client.id);
@@ -3595,7 +3606,7 @@ var authFeature = defineFeature({
3595
3606
 
3596
3607
  // src/feature/http/index.ts
3597
3608
  import { Node as Node15, aws as aws15 } from "@awsless/formation";
3598
- import { camelCase as camelCase5 } from "change-case";
3609
+ import { camelCase as camelCase5, constantCase as constantCase6 } from "change-case";
3599
3610
  import { relative as relative3 } from "path";
3600
3611
  var parseRoute = (route) => {
3601
3612
  const [method, ...paths] = route.split(" ");
@@ -3705,6 +3716,7 @@ var httpFeature = defineFeature({
3705
3716
  })
3706
3717
  ]
3707
3718
  });
3719
+ ctx.shared.set(`http-${id}-listener-arn`, listener.arn);
3708
3720
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
3709
3721
  new aws15.route53.RecordSet(group2, domainName, {
3710
3722
  hostedZoneId: ctx.shared.get(`hosted-zone-${props.domain}-id`),
@@ -3716,7 +3728,7 @@ var httpFeature = defineFeature({
3716
3728
  dnsName: loadBalancer.dnsName
3717
3729
  }
3718
3730
  });
3719
- ctx.shared.set(`http-${id}-listener-arn`, listener.arn);
3731
+ ctx.bindEnv(`HTTP_${constantCase6(id)}_ENDPOINT`, domainName);
3720
3732
  }
3721
3733
  },
3722
3734
  onStack(ctx) {
@@ -3762,7 +3774,7 @@ var httpFeature = defineFeature({
3762
3774
 
3763
3775
  // src/feature/search/index.ts
3764
3776
  import { Node as Node16, aws as aws16 } from "@awsless/formation";
3765
- import { constantCase as constantCase5 } from "change-case";
3777
+ import { constantCase as constantCase7 } from "change-case";
3766
3778
  var typeGenCode6 = `
3767
3779
  import { AnyStruct, Table } from '@awsless/open-search'
3768
3780
 
@@ -3818,7 +3830,7 @@ var searchFeature = defineFeature({
3818
3830
  }
3819
3831
  ctx.onFunction(({ lambda, policy }) => {
3820
3832
  lambda.addEnvironment(
3821
- `SEARCH_${constantCase5(ctx.stack.name)}_${constantCase5(id)}_DOMAIN`,
3833
+ `SEARCH_${constantCase7(ctx.stack.name)}_${constantCase7(id)}_DOMAIN`,
3822
3834
  openSearch.domainEndpoint
3823
3835
  );
3824
3836
  policy.addStatement({
@@ -3870,6 +3882,7 @@ var siteFeature = defineFeature({
3870
3882
  if (props.ssr) {
3871
3883
  const { lambda, code } = createLambdaFunction(group, ctx, `site`, id, props.ssr);
3872
3884
  versions.push(code.version);
3885
+ ctx.registerSiteFunction(lambda);
3873
3886
  new aws17.lambda.Permission(group, "permission", {
3874
3887
  principal: "*",
3875
3888
  // principal: 'cloudfront.amazonaws.com',
@@ -4042,6 +4055,7 @@ var siteFeature = defineFeature({
4042
4055
 
4043
4056
  // src/feature/rest/index.ts
4044
4057
  import { Node as Node18, aws as aws18 } from "@awsless/formation";
4058
+ import { constantCase as constantCase8 } from "change-case";
4045
4059
  var restFeature = defineFeature({
4046
4060
  name: "rest",
4047
4061
  onApp(ctx) {
@@ -4084,6 +4098,7 @@ var restFeature = defineFeature({
4084
4098
  }
4085
4099
  });
4086
4100
  record.dependsOn(domain, mapping);
4101
+ ctx.bindEnv(`REST_${constantCase8(id)}_ENDPOINT`, domainName);
4087
4102
  }
4088
4103
  }
4089
4104
  },
@@ -4243,6 +4258,8 @@ var createApp = (props, filters = []) => {
4243
4258
  const app = new App(props.appConfig.name);
4244
4259
  const base = new Stack(app, "base");
4245
4260
  const shared = new SharedData();
4261
+ const binds = [];
4262
+ const siteFunctions = [];
4246
4263
  const configs = /* @__PURE__ */ new Set();
4247
4264
  const tests = [];
4248
4265
  const builders = [];
@@ -4267,6 +4284,12 @@ var createApp = (props, filters = []) => {
4267
4284
  },
4268
4285
  registerBuild(type, name, builder) {
4269
4286
  builders.push({ type, name, builder });
4287
+ },
4288
+ registerSiteFunction(lambda) {
4289
+ siteFunctions.push(lambda);
4290
+ },
4291
+ bindEnv(name, value) {
4292
+ binds.push({ name, value });
4270
4293
  }
4271
4294
  });
4272
4295
  }
@@ -4304,6 +4327,12 @@ var createApp = (props, filters = []) => {
4304
4327
  },
4305
4328
  registerConfig(name) {
4306
4329
  configs.add(name);
4330
+ },
4331
+ registerSiteFunction(lambda) {
4332
+ siteFunctions.push(lambda);
4333
+ },
4334
+ bindEnv(name, value) {
4335
+ binds.push({ name, value });
4307
4336
  }
4308
4337
  });
4309
4338
  }
@@ -4318,6 +4347,11 @@ var createApp = (props, filters = []) => {
4318
4347
  listener(fn);
4319
4348
  }
4320
4349
  }
4350
+ for (const lambda of siteFunctions) {
4351
+ for (const { name, value } of binds) {
4352
+ lambda.addEnvironment(name, value);
4353
+ }
4354
+ }
4321
4355
  for (const stackConfig of filterdStacks) {
4322
4356
  const functions = allLocalFunctions[stackConfig.name];
4323
4357
  for (const dependency of stackConfig.depends ?? []) {
@@ -4333,6 +4367,7 @@ var createApp = (props, filters = []) => {
4333
4367
  app,
4334
4368
  base,
4335
4369
  tests,
4370
+ binds,
4336
4371
  shared,
4337
4372
  configs,
4338
4373
  builders
@@ -4520,20 +4555,20 @@ var config = (program2) => {
4520
4555
  import { confirm as confirm3 } from "@clack/prompts";
4521
4556
 
4522
4557
  // src/util/workspace.ts
4523
- import { WorkSpace, aws as aws19, local } from "@awsless/formation";
4558
+ import { WorkSpace, aws as aws20, local } from "@awsless/formation";
4524
4559
  import { minutes as minutes4 } from "@awsless/duration";
4525
4560
  import { dirname as dirname8, join as join9 } from "path";
4526
4561
  import { mkdir as mkdir2, readFile as readFile6, rm, writeFile as writeFile2 } from "fs/promises";
4527
4562
  var createWorkSpace = (props) => {
4528
- const lockProvider = new aws19.dynamodb.LockProvider({
4563
+ const lockProvider = new aws20.dynamodb.LockProvider({
4529
4564
  ...props,
4530
4565
  tableName: "awsless-locks"
4531
4566
  });
4532
- const stateProvider = new aws19.s3.StateProvider({
4567
+ const stateProvider = new aws20.s3.StateProvider({
4533
4568
  ...props,
4534
4569
  bucket: "awsless-state"
4535
4570
  });
4536
- const cloudProviders = aws19.createCloudProviders({
4571
+ const cloudProviders = aws20.createCloudProviders({
4537
4572
  ...props,
4538
4573
  timeout: minutes4(60)
4539
4574
  });
@@ -4910,7 +4945,7 @@ var deploy = (program2) => {
4910
4945
  };
4911
4946
 
4912
4947
  // src/cli/command/diff.ts
4913
- import { WorkSpace as WorkSpace2, aws as aws20 } from "@awsless/formation";
4948
+ import { WorkSpace as WorkSpace2, aws as aws21 } from "@awsless/formation";
4914
4949
  import chalk7 from "chalk";
4915
4950
  var diff = (program2) => {
4916
4951
  program2.command("diff").description("Diff your app with AWS").action(async (filters) => {
@@ -4922,12 +4957,12 @@ var diff = (program2) => {
4922
4957
  const { app, builders } = createApp({ appConfig, stackConfigs, accountId }, filters);
4923
4958
  await buildAssets(builders);
4924
4959
  const workspace = new WorkSpace2({
4925
- stateProvider: new aws20.dynamodb.DynamoDBStateProvider({
4960
+ stateProvider: new aws21.dynamodb.DynamoDBStateProvider({
4926
4961
  credentials,
4927
4962
  region,
4928
4963
  tableName: "awsless-state"
4929
4964
  }),
4930
- cloudProviders: aws20.createCloudProviders({
4965
+ cloudProviders: aws21.createCloudProviders({
4931
4966
  credentials,
4932
4967
  region: appConfig.region
4933
4968
  })
@@ -5272,6 +5307,49 @@ var auth = (program2) => {
5272
5307
  commands5.forEach((cb) => cb(command));
5273
5308
  };
5274
5309
 
5310
+ // src/cli/command/bind.ts
5311
+ import { spawn } from "child_process";
5312
+ import { unwrap as unwrap2 } from "@awsless/formation";
5313
+ import { note as note3 } from "@clack/prompts";
5314
+ var bind = (program2) => {
5315
+ program2.command("bind").argument("<command...>", "The command to execute").description(`Bind your site environment variables to a command`).action(async (commands7) => {
5316
+ await layout("bind", async ({ appConfig, stackConfigs }) => {
5317
+ const region = appConfig.region;
5318
+ const credentials = getCredentials(appConfig.profile);
5319
+ const accountId = await getAccountId(credentials, region);
5320
+ const { app, binds } = createApp({ appConfig, stackConfigs, accountId });
5321
+ const { workspace } = createWorkSpace({
5322
+ credentials,
5323
+ region
5324
+ });
5325
+ await workspace.hydrate(app);
5326
+ const env = {};
5327
+ for (const { name, value } of binds) {
5328
+ env[name] = unwrap2(value);
5329
+ }
5330
+ note3(wrap(list(env)), "Bind Env");
5331
+ const command = commands7.join(" ");
5332
+ spawn(command, {
5333
+ env: {
5334
+ // Pass the process env vars
5335
+ ...process.env,
5336
+ // Pass the site bind env vars
5337
+ ...env,
5338
+ // Basic info
5339
+ AWS_REGION: appConfig.region,
5340
+ AWS_ACCOUNT_ID: accountId
5341
+ // Give AWS access
5342
+ // AWS_ACCESS_KEY_ID: credentials.accessKeyId,
5343
+ // AWS_SECRET_ACCESS_KEY: credentials.secretAccessKey,
5344
+ // AWS_SESSION_TOKEN: credentials.sessionToken,
5345
+ },
5346
+ stdio: "inherit",
5347
+ shell: true
5348
+ });
5349
+ });
5350
+ });
5351
+ };
5352
+
5275
5353
  // src/cli/command/index.ts
5276
5354
  var commands6 = [
5277
5355
  bootstrap,
@@ -5281,7 +5359,7 @@ var commands6 = [
5281
5359
  diff,
5282
5360
  del2,
5283
5361
  dev,
5284
- // bind,
5362
+ bind,
5285
5363
  auth,
5286
5364
  state,
5287
5365
  resource,
@@ -807,6 +807,14 @@ var SitesSchema = z24.record(
807
807
  z24.object({
808
808
  domain: ResourceIdSchema.describe("The domain id to link your site with."),
809
809
  subDomain: z24.string().optional(),
810
+ // bind: z
811
+ // .object({
812
+ // auth: z.array(ResourceIdSchema),
813
+ // graphql: z.array(ResourceIdSchema),
814
+ // // http: z.array(ResourceIdSchema),
815
+ // // rest: z.array(ResourceIdSchema),
816
+ // })
817
+ // .optional(),
810
818
  static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
811
819
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
812
820
  // bind: z.object({
@@ -0,0 +1,61 @@
1
+ // src/lib/resource/util.ts
2
+ import { paramCase } from "change-case";
3
+ var APP = process.env.APP ?? "app";
4
+ var STACK = process.env.STACK ?? "stack";
5
+ var bindLocalResourceName = (type) => {
6
+ return (name, stack = STACK) => {
7
+ return [APP, paramCase(stack), paramCase(type), paramCase(name)].join(
8
+ "--"
9
+ );
10
+ };
11
+ };
12
+ var bindGlobalResourceName = (type) => {
13
+ return (name) => {
14
+ return [APP, paramCase(type), paramCase(name)].join("--");
15
+ };
16
+ };
17
+ var createProxy = /* @__NO_SIDE_EFFECTS__ */ (cb) => {
18
+ const cache = /* @__PURE__ */ new Map();
19
+ return new Proxy(
20
+ {},
21
+ {
22
+ get(_, name) {
23
+ if (!cache.has(name)) {
24
+ cache.set(name, cb(name));
25
+ }
26
+ return cache.get(name);
27
+ }
28
+ }
29
+ );
30
+ };
31
+
32
+ // src/lib/resource/auth.ts
33
+ import { constantCase } from "change-case";
34
+ var getAuthName = bindGlobalResourceName("auth");
35
+ var Auth = /* @__PURE__ */ createProxy((name) => {
36
+ return getAuthProps(name);
37
+ });
38
+ var getAuthProps = (name) => {
39
+ const env = process.env;
40
+ const id = constantCase(name);
41
+ return {
42
+ name: getAuthName(name),
43
+ // userPoolId: env[`AWSLESS_CLIENT_AUTH_${id}_USER_POOL_ID`]!,
44
+ // clientId: env[`AWSLESS_CLIENT_AUTH_${id}_CLIENT_ID`]!,
45
+ // clientSecret: env[`AWSLESS_CLIENT_AUTH_${id}_CLIENT_SECRET`]!,
46
+ userPoolId: env[`AUTH_${id}_USER_POOL_ID`],
47
+ clientId: env[`AUTH_${id}_CLIENT_ID`]
48
+ // clientSecret: env[`AUTH_${id}_CLIENT_SECRET`]!,
49
+ };
50
+ };
51
+
52
+ export {
53
+ APP,
54
+ STACK,
55
+ bindLocalResourceName,
56
+ bindGlobalResourceName,
57
+ createProxy,
58
+ getAuthName,
59
+ Auth,
60
+ getAuthProps
61
+ };
package/dist/client.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { A as Auth } from './auth-b89f6013.js';
2
+
1
3
  interface HTTP {
2
4
  }
3
5
  type Method = 'GET' | 'POST';
package/dist/client.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ Auth
3
+ } from "./chunk-RRXFYZJQ.js";
4
+
1
5
  // src/lib/resource/http.ts
2
6
  var createHttpFetcher = (host) => {
3
7
  return async ({ method, path, headers, body, query }) => {
@@ -41,6 +45,7 @@ var createHttpClient = (fetcher) => {
41
45
  };
42
46
  };
43
47
  export {
48
+ Auth,
44
49
  createHttpClient,
45
50
  createHttpFetcher
46
51
  };
package/dist/server.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { A as Auth, b as AuthResources, g as getAuthName, a as getAuthProps } from './auth-b89f6013.js';
1
2
  import * as _awsless_lambda from '@awsless/lambda';
2
3
  import { Handler, Loggers } from '@awsless/lambda';
3
4
  import { BaseSchema, SnsTopicSchema, SqsQueueSchema } from '@awsless/validate';
@@ -17,17 +18,6 @@ interface TaskResources {
17
18
  }
18
19
  declare const Task: TaskResources;
19
20
 
20
- declare const getAuthName: <N extends string>(name: N) => `app--auth--${N}`;
21
- interface AuthResources {
22
- }
23
- declare const Auth: AuthResources;
24
- declare const getAuthProps: (name: string) => {
25
- readonly name: `app--auth--${string}`;
26
- readonly userPoolId: string;
27
- readonly clientId: string;
28
- readonly clientSecret: string;
29
- };
30
-
31
21
  declare const getTableName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--table--${N}`;
32
22
  interface TableResources {
33
23
  }
@@ -129,4 +119,4 @@ interface TaskMockResponse {
129
119
  }
130
120
  declare const mockTask: (cb: (mock: TaskMock) => void) => TaskMockResponse;
131
121
 
132
- export { APP, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, CronProps, Fn, Function, FunctionMock, FunctionMockResponse, FunctionProps, FunctionResources, Queue, QueueMock, QueueMockResponse, QueueProps, QueueResources, STACK, Search, SearchResources, Store, StoreResources, Table, TableResources, Task, TaskMock, TaskMockResponse, TaskResources, Topic, TopicMock, TopicMockResponse, TopicProps, TopicResources, cron, func, getAuthName, getAuthProps, getCacheProps, getConfigName, getFunctionName, getQueueName, getSearchName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockQueue, mockTask, mockTopic, queue, topic };
122
+ export { APP, Cache, CacheResources, Config, ConfigResources, CronProps, Fn, Function, FunctionMock, FunctionMockResponse, FunctionProps, FunctionResources, Queue, QueueMock, QueueMockResponse, QueueProps, QueueResources, STACK, Search, SearchResources, Store, StoreResources, Table, TableResources, Task, TaskMock, TaskMockResponse, TaskResources, Topic, TopicMock, TopicMockResponse, TopicProps, TopicResources, cron, func, getCacheProps, getConfigName, getFunctionName, getQueueName, getSearchName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockQueue, mockTask, mockTopic, queue, topic };
package/dist/server.js CHANGED
@@ -1,33 +1,13 @@
1
- // src/lib/resource/util.ts
2
- import { paramCase } from "change-case";
3
- var APP = process.env.APP ?? "app";
4
- var STACK = process.env.STACK ?? "stack";
5
- var bindLocalResourceName = (type) => {
6
- return (name, stack = STACK) => {
7
- return [APP, paramCase(stack), paramCase(type), paramCase(name)].join(
8
- "--"
9
- );
10
- };
11
- };
12
- var bindGlobalResourceName = (type) => {
13
- return (name) => {
14
- return [APP, paramCase(type), paramCase(name)].join("--");
15
- };
16
- };
17
- var createProxy = /* @__NO_SIDE_EFFECTS__ */ (cb) => {
18
- const cache2 = /* @__PURE__ */ new Map();
19
- return new Proxy(
20
- {},
21
- {
22
- get(_, name) {
23
- if (!cache2.has(name)) {
24
- cache2.set(name, cb(name));
25
- }
26
- return cache2.get(name);
27
- }
28
- }
29
- );
30
- };
1
+ import {
2
+ APP,
3
+ Auth,
4
+ STACK,
5
+ bindGlobalResourceName,
6
+ bindLocalResourceName,
7
+ createProxy,
8
+ getAuthName,
9
+ getAuthProps
10
+ } from "./chunk-RRXFYZJQ.js";
31
11
 
32
12
  // src/lib/resource/function.ts
33
13
  import { invoke } from "@awsless/lambda";
@@ -84,26 +64,6 @@ var Task = /* @__PURE__ */ createProxy((stackName) => {
84
64
  });
85
65
  });
86
66
 
87
- // src/lib/resource/auth.ts
88
- import { constantCase } from "change-case";
89
- var getAuthName = bindGlobalResourceName("auth");
90
- var Auth = /* @__PURE__ */ createProxy((name) => {
91
- return getAuthProps(name);
92
- });
93
- var getAuthProps = (name) => {
94
- const env = process.env;
95
- const id = constantCase(name);
96
- return {
97
- name: getAuthName(name),
98
- // userPoolId: env[`AWSLESS_CLIENT_AUTH_${id}_USER_POOL_ID`]!,
99
- // clientId: env[`AWSLESS_CLIENT_AUTH_${id}_CLIENT_ID`]!,
100
- // clientSecret: env[`AWSLESS_CLIENT_AUTH_${id}_CLIENT_SECRET`]!,
101
- userPoolId: env[`AUTH_${id}_USER_POOL_ID`],
102
- clientId: env[`AUTH_${id}_CLIENT_ID`],
103
- clientSecret: env[`AUTH_${id}_CLIENT_SECRET`]
104
- };
105
- };
106
-
107
67
  // src/lib/resource/table.ts
108
68
  var getTableName = bindLocalResourceName("table");
109
69
  var Table = /* @__PURE__ */ createProxy((stack) => {
@@ -135,10 +95,10 @@ import {
135
95
  sendMessage,
136
96
  sendMessageBatch
137
97
  } from "@awsless/sqs";
138
- import { constantCase as constantCase2 } from "change-case";
98
+ import { constantCase } from "change-case";
139
99
  var getQueueName = bindLocalResourceName("queue");
140
100
  var getQueueUrl = (name, stack = STACK) => {
141
- return process.env[`QUEUE_${constantCase2(stack)}_${constantCase2(name)}_URL`];
101
+ return process.env[`QUEUE_${constantCase(stack)}_${constantCase(name)}_URL`];
142
102
  };
143
103
  var Queue = /* @__PURE__ */ createProxy((stack) => {
144
104
  return createProxy((queue2) => {
@@ -167,10 +127,10 @@ var Queue = /* @__PURE__ */ createProxy((stack) => {
167
127
  });
168
128
 
169
129
  // src/lib/resource/cache.ts
170
- import { constantCase as constantCase3 } from "change-case";
130
+ import { constantCase as constantCase2 } from "change-case";
171
131
  import { command } from "@awsless/redis";
172
132
  var getCacheProps = (name, stack = STACK) => {
173
- const prefix = `CACHE_${constantCase3(stack)}_${constantCase3(name)}`;
133
+ const prefix = `CACHE_${constantCase2(stack)}_${constantCase2(name)}`;
174
134
  return {
175
135
  host: process.env[`${prefix}_HOST`],
176
136
  port: parseInt(process.env[`${prefix}_PORT`], 10)
@@ -241,14 +201,14 @@ var Store = /* @__PURE__ */ createProxy((stack) => {
241
201
 
242
202
  // src/lib/resource/config.ts
243
203
  import { ssm } from "@awsless/ssm";
244
- import { paramCase as paramCase2 } from "change-case";
204
+ import { paramCase } from "change-case";
245
205
  var getConfigName = (name) => {
246
206
  return `/.awsless/${APP}/${name}`;
247
207
  };
248
- var TEST = process.env.NODE_ENV === "test";
208
+ var IS_TEST = process.env.NODE_ENV === "test";
249
209
  var CONFIGS = process.env.CONFIG;
250
210
  var loadConfigData = /* @__NO_SIDE_EFFECTS__ */ async () => {
251
- if (!TEST && CONFIGS) {
211
+ if (!IS_TEST && CONFIGS) {
252
212
  const keys = CONFIGS.split(",");
253
213
  if (keys.length > 0) {
254
214
  const paths = {};
@@ -265,17 +225,17 @@ var Config = /* @__PURE__ */ new Proxy(
265
225
  {},
266
226
  {
267
227
  get(_, name) {
268
- const key = paramCase2(name);
228
+ const key = paramCase(name);
269
229
  const value = data[key];
270
230
  if (typeof value === "undefined") {
271
231
  throw new Error(
272
- `The "${name}" config value hasn't been set yet. ${TEST ? `Use "Config.${name} = 'VAlUE'" to define your mock value.` : `Define access to the desired config value inside your awsless stack file.`}`
232
+ `The "${name}" config value hasn't been set yet. ${IS_TEST ? `Use "Config.${name} = 'VAlUE'" to define your mock value.` : `Define access to the desired config value inside your awsless stack file.`}`
273
233
  );
274
234
  }
275
235
  return value;
276
236
  },
277
237
  set(_, name, value) {
278
- const key = paramCase2(name);
238
+ const key = paramCase(name);
279
239
  data[key] = value;
280
240
  return true;
281
241
  }
@@ -283,12 +243,12 @@ var Config = /* @__PURE__ */ new Proxy(
283
243
  );
284
244
 
285
245
  // src/lib/resource/search.ts
286
- import { constantCase as constantCase4 } from "change-case";
246
+ import { constantCase as constantCase3 } from "change-case";
287
247
  import { searchClient, define } from "@awsless/open-search";
288
248
  var getSearchName = bindLocalResourceName("search");
289
249
  var getSearchProps = (name, stack = STACK) => {
290
250
  return {
291
- domain: process.env[`CACHE_${constantCase4(stack)}_${constantCase4(name)}_DOMAIN`]
251
+ domain: process.env[`CACHE_${constantCase3(stack)}_${constantCase3(name)}_DOMAIN`]
292
252
  };
293
253
  };
294
254
  var Search = /* @__PURE__ */ createProxy((stack) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.247",
3
+ "version": "0.0.248",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -28,12 +28,12 @@
28
28
  }
29
29
  },
30
30
  "peerDependencies": {
31
+ "@awsless/lambda": "^0.0.19",
31
32
  "@awsless/open-search": "^0.0.12",
32
33
  "@awsless/redis": "^0.0.12",
34
+ "@awsless/s3": "^0.0.10",
33
35
  "@awsless/sns": "^0.0.7",
34
- "@awsless/lambda": "^0.0.19",
35
36
  "@awsless/sqs": "^0.0.7",
36
- "@awsless/s3": "^0.0.10",
37
37
  "@awsless/ssm": "^0.0.7",
38
38
  "@awsless/validate": "^0.0.14",
39
39
  "@awsless/weak-cache": "^0.0.1"
@@ -97,11 +97,11 @@
97
97
  "wrap-ansi": "^8.1.0",
98
98
  "zod": "^3.21.4",
99
99
  "zod-to-json-schema": "^3.22.3",
100
+ "@awsless/duration": "^0.0.1",
101
+ "@awsless/size": "^0.0.1",
100
102
  "@awsless/graphql": "^0.0.9",
101
103
  "@awsless/validate": "^0.0.14",
102
104
  "@awsless/formation": "^0.0.27",
103
- "@awsless/size": "^0.0.1",
104
- "@awsless/duration": "^0.0.1",
105
105
  "@awsless/code": "^0.0.10"
106
106
  },
107
107
  "scripts": {