wirejs-deploy-amplify-basic 0.0.148-payments → 0.0.150-payments

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.
@@ -70,6 +70,8 @@ backend.api.resources.lambda.role?.addToPrincipalPolicy(new PolicyStatement({
70
70
  ],
71
71
  }));
72
72
 
73
+ const allLambdas = [ backend.api.resources.lambda ];
74
+
73
75
  /**
74
76
  * CDK resources
75
77
  */
@@ -87,12 +89,11 @@ function isRealtimeService(resource: any): resource is {
87
89
  return resource.type === 'RealtimeService';
88
90
  }
89
91
 
90
- let realtime: RealtimeService | undefined;
91
92
  if (generated.some(isRealtimeService)) {
92
93
  const realtimeStack = new NestedStack(backend.stack, 'realtime', {
93
94
  description: 'Realtime service for distributed resources',
94
95
  });
95
- realtime = new RealtimeService(realtimeStack, 'realtime', {
96
+ const realtime = new RealtimeService(realtimeStack, 'realtime', {
96
97
  appId: APP_ID!,
97
98
  branchId: BRANCH_ID,
98
99
  publisher: backend.api,
@@ -102,6 +103,7 @@ if (generated.some(isRealtimeService)) {
102
103
  .map(r => r.options.namespace),
103
104
  });
104
105
  bucket.grantReadWrite(realtime.authHandler);
106
+ allLambdas.push(realtime.authHandler);
105
107
  }
106
108
 
107
109
  /**
@@ -165,12 +167,7 @@ for (const resource of generated) {
165
167
  }
166
168
  );
167
169
 
168
- const lambdasNeedingAccess = [
169
- backend.api.resources.lambda
170
- ];
171
- if (realtime) lambdasNeedingAccess.push(realtime.authHandler);
172
-
173
- for (const lambda of lambdasNeedingAccess) {
170
+ for (const lambda of allLambdas) {
174
171
  table.grantReadWriteData(lambda);
175
172
 
176
173
  // indexes created by custom resource and require explicit
@@ -39,12 +39,17 @@ export class RealtimeService extends Construct {
39
39
  entry: path.join(__dirname, 'authorizer-lambda.ts'),
40
40
  timeout: Duration.seconds(30),
41
41
  environment: {
42
- // global storage bucket currently used by `Secret` resource
42
+ // global storage bucket. TODO: remove?
43
43
  BUCKET: props.bucket,
44
44
 
45
+ // TODO: refactor. set env variables ... better.
46
+ // must match TABLE_NAME_PREFIX from outer scope.
47
+ TABLE_NAME_PREFIX: `${props.appId}-${props.branchId}-`,
48
+
45
49
  // NOTE: These MUST equal those defined in RealtimeService resource.
46
50
  SECRET_SCOPE: 'wirejs-global',
47
51
  SECRET_ID: 'realtime-secret',
52
+
48
53
  }
49
54
  });
50
55
 
@@ -274,7 +274,7 @@ async function tryAPIPath(context, res) {
274
274
  return false;
275
275
  }
276
276
 
277
- return proxyRequest(context, res, API_URL);
277
+ return proxyRequest(context, res, `${API_URL}${path}`);
278
278
  }
279
279
 
280
280
  /**
@@ -3,6 +3,6 @@
3
3
  "dependencies": {
4
4
  "jsdom": "^25.0.1",
5
5
  "wirejs-dom": "^1.0.42",
6
- "wirejs-resources": "^0.1.116-payments"
6
+ "wirejs-resources": "^0.1.118-payments"
7
7
  }
8
8
  }
package/build.js CHANGED
@@ -67,6 +67,10 @@ async function installDeps() {
67
67
  ...(packageData.dependencies || {}),
68
68
  'wirejs-resources': `file:${SELF_DIR}`
69
69
  };
70
+ packageData.overrides = {
71
+ ...(packageData.overrides || {}),
72
+ 'wirejs-resources': `file:${SELF_DIR}`
73
+ };
70
74
  await fs.promises.writeFile(
71
75
  path.join(CWD, 'package.json'),
72
76
  JSON.stringify(packageData, null, 2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.148-payments",
3
+ "version": "0.0.150-payments",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "recursive-copy": "^2.0.14",
43
43
  "rimraf": "^6.0.1",
44
44
  "wirejs-dom": "^1.0.42",
45
- "wirejs-resources": "^0.1.116-payments"
45
+ "wirejs-resources": "^0.1.118-payments"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@aws-amplify/backend": "^1.14.0",