@fy-stack/cdn-construct 0.0.12 → 0.0.122

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.
@@ -1 +1 @@
1
- {"version":3,"file":"cdn-construct.d.ts","sourceRoot":"","sources":["../../src/lib/cdn-construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,YAAa,SAAQ,SAAS;IAClC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;gBAEjC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CA+DnE"}
1
+ {"version":3,"file":"cdn-construct.d.ts","sourceRoot":"","sources":["../../src/lib/cdn-construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,YAAa,SAAQ,SAAS;IAClC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;gBAEjC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAsDnE"}
@@ -10,19 +10,10 @@ class CDNConstruct extends constructs_1.Construct {
10
10
  super(scope, id);
11
11
  const routes = {};
12
12
  Object.assign(routes, Object.fromEntries(Object.entries(props.routes).map(([key, val]) => {
13
- if ('$app' in val) {
14
- const app = props.apps?.[val.$app];
15
- if (!app)
16
- throw new Error(`"${val.$app}" app not found`);
17
- app.function.addEnvironment('BASE_PATH', key);
18
- return [key, app];
19
- }
20
- else {
21
- const resource = props.resources?.[val.$resource];
22
- if (!resource)
23
- throw new Error(`${val.$resource} resource not found`);
24
- return [key, resource];
25
- }
13
+ const app = props.resources?.[val.$resource];
14
+ if (!app)
15
+ throw new Error(`"${val.$resource}" app not found`);
16
+ return [key, app];
26
17
  })));
27
18
  const { '/*': base, ...otherRoutes } = routes;
28
19
  if (!base)
@@ -1,14 +1,6 @@
1
- import type { CDNResource } from '@fy-stack/types';
2
- import type { Function } from 'aws-cdk-lib/aws-lambda';
1
+ import type { CDNResource, ResourceRef } from '@fy-stack/types';
3
2
  export interface CDNConstructProps {
4
- routes: Record<string, {
5
- $app: string;
6
- } | {
7
- $resource: string;
8
- }>;
9
- apps?: Record<string, (CDNResource & {
10
- function: Function;
11
- }) | undefined>;
3
+ routes: Record<string, ResourceRef>;
12
4
  resources?: Record<string, CDNResource | undefined>;
13
5
  }
14
6
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,WAAW,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;CACrD"}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fy-stack/cdn-construct",
3
- "version": "0.0.12",
3
+ "version": "0.0.122",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
- "@fy-stack/types": "0.0.12"
6
+ "@fy-stack/types": "0.0.122"
7
7
  },
8
8
  "peerDependencies": {
9
9
  "aws-cdk-lib": "2.164.1",