@awsless/awsless 0.0.323 → 0.0.326

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.
@@ -886,6 +886,10 @@ var SitesSchema = z22.record(
886
886
 
887
887
  // src/feature/store/schema.ts
888
888
  import { z as z23 } from "zod";
889
+ var DeletionProtectionSchema = z23.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
890
+ var StoreDefaultSchema = z23.object({
891
+ deletionProtection: DeletionProtectionSchema.optional()
892
+ }).optional();
889
893
  var StoresSchema = z23.union([
890
894
  z23.array(ResourceIdSchema).transform((list) => {
891
895
  const stores = {};
@@ -898,6 +902,7 @@ var StoresSchema = z23.union([
898
902
  ResourceIdSchema,
899
903
  z23.object({
900
904
  // cors: CorsSchema,
905
+ deletionProtection: DeletionProtectionSchema.optional(),
901
906
  versioning: z23.boolean().default(false).describe("Enable versioning of your store."),
902
907
  events: z23.object({
903
908
  // create
@@ -957,6 +962,10 @@ var StreamsSchema = z24.record(
957
962
  // src/feature/table/schema.ts
958
963
  import { z as z25 } from "zod";
959
964
  var KeySchema = z25.string().min(1).max(255);
965
+ var DeletionProtectionSchema2 = z25.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
966
+ var TableDefaultSchema = z25.object({
967
+ deletionProtection: DeletionProtectionSchema2.optional()
968
+ }).optional();
960
969
  var TablesSchema = z25.record(
961
970
  ResourceIdSchema,
962
971
  z25.object({
@@ -974,6 +983,7 @@ var TablesSchema = z25.record(
974
983
  timeToLiveAttribute: KeySchema.optional().describe(
975
984
  "The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
976
985
  ),
986
+ deletionProtection: DeletionProtectionSchema2.optional(),
977
987
  stream: z25.object({
978
988
  type: z25.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
979
989
  "When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
@@ -1139,7 +1149,10 @@ var AppSchema = z32.object({
1139
1149
  graphql: GraphQLDefaultSchema,
1140
1150
  http: HttpDefaultSchema,
1141
1151
  rest: RestDefaultSchema,
1142
- pubsub: PubSubDefaultSchema
1152
+ pubsub: PubSubDefaultSchema,
1153
+ table: TableDefaultSchema,
1154
+ store: StoreDefaultSchema
1155
+ // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
1143
1156
  }).default({}).describe("Default properties")
1144
1157
  });
1145
1158
 
package/dist/server.d.ts CHANGED
@@ -93,9 +93,9 @@ interface SearchResources {
93
93
  }
94
94
  declare const Search: SearchResources;
95
95
 
96
- declare const getSiteBucketName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--site--${N}`;
96
+ declare const getSiteBucketName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--site--${N}--${string}`;
97
97
 
98
- declare const getStoreName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--store--${N}`;
98
+ declare const getStoreName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app--${S}--store--${N}--${string}`;
99
99
  interface StoreResources {
100
100
  }
101
101
  declare const Store: StoreResources;
package/dist/server.js CHANGED
@@ -16,14 +16,37 @@ import { WeakCache } from "@awsless/weak-cache";
16
16
  import { paramCase } from "change-case";
17
17
  var APP = process.env.APP ?? "app";
18
18
  var STACK = process.env.STACK ?? "stack";
19
+ var bindPostfixedLocalResourceName = (type, postfix) => {
20
+ return (name, stack = STACK) => {
21
+ return [
22
+ //
23
+ APP,
24
+ paramCase(stack),
25
+ paramCase(type),
26
+ paramCase(name),
27
+ postfix
28
+ ].join("--");
29
+ };
30
+ };
19
31
  var bindLocalResourceName = (type) => {
20
32
  return (name, stack = STACK) => {
21
- return [APP, paramCase(stack), paramCase(type), paramCase(name)].join("--");
33
+ return [
34
+ //
35
+ APP,
36
+ paramCase(stack),
37
+ paramCase(type),
38
+ paramCase(name)
39
+ ].join("--");
22
40
  };
23
41
  };
24
42
  var bindGlobalResourceName = (type) => {
25
43
  return (name) => {
26
- return [APP, paramCase(type), paramCase(name)].join("--");
44
+ return [
45
+ //
46
+ APP,
47
+ paramCase(type),
48
+ paramCase(name)
49
+ ].join("--");
27
50
  };
28
51
  };
29
52
 
@@ -340,11 +363,11 @@ var Search = /* @__PURE__ */ createProxy((stack) => {
340
363
  });
341
364
 
342
365
  // src/lib/server/site.ts
343
- var getSiteBucketName = bindLocalResourceName("site");
366
+ var getSiteBucketName = bindPostfixedLocalResourceName("site", process.env.APP_ID);
344
367
 
345
368
  // src/lib/server/store.ts
346
369
  import { deleteObject, getObject, headObject, putObject } from "@awsless/s3";
347
- var getStoreName = bindLocalResourceName("store");
370
+ var getStoreName = bindPostfixedLocalResourceName("store", process.env.APP_ID);
348
371
  var Store = /* @__PURE__ */ createProxy((stack) => {
349
372
  return createProxy((name) => {
350
373
  const bucket = getStoreName(name, stack);