Skip to content

Commit

Permalink
configure webpack and riff-raff for new handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbjacobson committed Mar 11, 2024
1 parent 5bd1553 commit abb9e29
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 34 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ jobs:
- tsc-target/apple-link-user-subscription.zip
mobile-purchases-apple-pubsub:
- tsc-target/apple-pubsub.zip
mobile-purchases-apple-pubsub-feast:
- tsc-target/apple-pubsub-feast.zip
mobile-purchases-apple-revalidate-receipts:
- tsc-target/apple-revalidate-receipts.zip
mobile-purchases-apple-subscription-status:
- tsc-target/apple-subscription-status.zip
mobile-purchases-apple-update-subscriptions:
- tsc-target/apple-update-subscriptions.zip
mobile-purchases-apple-update-subscriptions-feast:
- tsc-target/apple-update-subscriptions-feast.zip
mobile-purchases-delete-user-subscription:
- tsc-target/delete-user-subscription.zip
mobile-purchases-export-historical-data:
Expand Down
6 changes: 3 additions & 3 deletions cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "source-map-support/register";
import { GuRoot } from "@guardian/cdk/lib/constructs/root";
import { MobilePurchases } from "../lib/mobile-purchases";
import { FeastMobilePurchases } from "../lib/feast-mobile-purchases";

const app = new GuRoot();
new MobilePurchases(app, "MobilePurchases-CODE", { stack: "mobile", stage: "CODE", env: { region: "eu-west-1" } });
new MobilePurchases(app, "MobilePurchases-PROD", { stack: "mobile", stage: "PROD", env: { region: "eu-west-1" } });
new FeastMobilePurchases(app, "FeastMobilePurchases-CODE", { stack: "mobile", stage: "CODE", env: { region: "eu-west-1" } });
new FeastMobilePurchases(app, "FeastMobilePurchases-PROD", { stack: "mobile", stage: "PROD", env: { region: "eu-west-1" } });
10 changes: 0 additions & 10 deletions cdk/lib/__snapshots__/mobile-purchases-feast.test.ts.snap

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { App } from "aws-cdk-lib";
import { Template } from "aws-cdk-lib/assertions";
import { MobilePurchases } from "./mobile-purchases";
import { FeastMobilePurchases } from "./feast-mobile-purchases";

describe("The MobilePurchases stack", () => {
describe("The FeastMobilePurchases stack", () => {
it("matches the snapshot", () => {
const app = new App();
const stack = new MobilePurchases(app, "MobilePurchases", { stack: "mobile", stage: "TEST" });
const stack = new FeastMobilePurchases(app, "FeastMobilePurchases-TEST", { stack: "mobile", stage: "TEST" });
const template = Template.fromStack(stack);
expect(template.toJSON()).toMatchSnapshot();
});
Expand Down
26 changes: 13 additions & 13 deletions cdk/lib/mobile-purchases.ts → cdk/lib/feast-mobile-purchases.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import type { GuStackProps } from "@guardian/cdk/lib/constructs/core";
import { GuStack } from "@guardian/cdk/lib/constructs/core";
import type { App } from "aws-cdk-lib";
import {GuLambdaFunction} from "@guardian/cdk/lib/constructs/lambda";
import {Runtime} from "aws-cdk-lib/aws-lambda";
import type { App } from "aws-cdk-lib";
import {Duration} from "aws-cdk-lib";
import {Runtime} from "aws-cdk-lib/aws-lambda";

export class MobilePurchases extends GuStack {
export class FeastMobilePurchases extends GuStack {
constructor(scope: App, id: string, props: GuStackProps) {
super(scope, id, props);

const app = "mobile-purchases";


// Lambda Functions
new GuLambdaFunction(this,"applepubsub-v2", {
new GuLambdaFunction(this,"feast-apple-pubsub-lambda", {
app: app,
description: "Records new App Store Feast subs",
functionName: `${app}-applepubsub-v2-${this.stage}`,
fileName: "", // TODO
handler: "apple-pubsub-v2.handler",
functionName: `${app}-feast-apple-pubsub-${this.stage}`,
fileName: "feast-apple-pubsub.zip",
handler: "feast-apple-pubsub.handler",
runtime: Runtime.NODEJS_20_X,
memorySize: 128,
timeout: Duration.seconds(29),
timeout: Duration.seconds(30),
environment: {
App: app,
Stack: this.stack,
Stage: this.stage,
},
})

new GuLambdaFunction(this,"apple-v2-update-subscriptions-lambda", {
new GuLambdaFunction(this,"feast-apple-update-subscriptions-lambda", {
app: app,
description: "Updates App Store Feast subs",
functionName: `${app}-apple-v2-update-subscriptions-${this.stage}`,
fileName: "", // TODO
handler: "apple-update-subscriptions-v2.handler",
functionName: `${app}-feast-apple-update-subscriptions-${this.stage}`,
fileName: "feast-apple-update-subscriptions.zip",
handler: "feast-apple-update-subscriptions.handler",
runtime: Runtime.NODEJS_20_X,
memorySize: 512,
timeout: Duration.seconds(25),
timeout: Duration.seconds(30),
environment: {
App: app,
Stack: this.stack,
Expand Down
18 changes: 15 additions & 3 deletions riff-raff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ templates:
prefixStack: false

deployments:
mobile-purchases-feast-cloudformation:
feast-mobile-purchases-cloudformation:
type: cloud-formation
parameters:
templateStagePaths:
CODE: MobilePurchasesFeast-CODE.template.json
PROD: MobilePurchasesFeast-PROD.template.json
CODE: FeastMobilePurchases-CODE.template.json
PROD: FeastMobilePurchases-PROD.template.json

mobile-purchases-cloudformation:
type: cloud-formation
Expand Down Expand Up @@ -44,6 +44,12 @@ deployments:
functionNames: [mobile-purchases-applepubsub-]
fileName: apple-pubsub.zip

feast-mobile-purchases-apple-pubsub:
template: lambda
parameters:
functionNames: [ mobile-purchases-feast-applepubsub- ]
fileName: feast-apple-pubsub.zip

mobile-purchases-google-subscription-status:
template: lambda
parameters:
Expand Down Expand Up @@ -98,6 +104,12 @@ deployments:
functionNames: [mobile-purchases-apple-update-subscriptions-]
fileName: apple-update-subscriptions.zip

mobile-purchases-feast-apple-update-subscriptions:
template: lambda
parameters:
functionNames: [ mobile-purchases-feast-apple-update-subscriptions- ]
fileName: feast-apple-update-subscriptions.zip

mobile-purchases-export-subscription-tables:
template: lambda
parameters:
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const getEntries = (env) => {
const entries = {
"google-pubsub": "./typescript/src/pubsub/google.ts",
"apple-pubsub": "./typescript/src/pubsub/apple.ts",
"apple-pubsub-v2": "./typescript/src/pubsub/apple-v2.ts", // Feast app integration
"feast-apple-pubsub": "./typescript/src/pubsub/apple-feast.ts",
"google-subscription-status": "./typescript/src/subscription-status/googleSubStatus.ts",
"apple-subscription-status": "./typescript/src/subscription-status/appleSubStatus.ts",
"apple-fetch-offer-details": "./typescript/src/promotional-offers/appleFetchOfferDetails.ts",
Expand All @@ -14,7 +14,7 @@ const getEntries = (env) => {
"user-subscriptions": "./typescript/src/user/user.ts",
"google-update-subscriptions": "./typescript/src/update-subs/google.ts",
"apple-update-subscriptions": "./typescript/src/update-subs/apple.ts",
"apple-update-subscriptions-v2": "./typescript/src/update-subs/apple-v2.ts", // Feast app integration
"feast-apple-update-subscriptions": "./typescript/src/update-subs/apple-feast.ts",
"soft-opt-in-acquisitions": "./typescript/src/soft-opt-ins/acquisitions.ts",
"soft-opt-in-acquisitions-dlq-processor": "./typescript/src/soft-opt-ins/dlq-processor.ts",
"export-subscription-tables": "./typescript/src/export/exportSubscriptions.ts",
Expand Down

0 comments on commit abb9e29

Please sign in to comment.