@plusscommunities/pluss-maintenance-aws-forms 2.1.46 → 2.1.47

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.
package/createJob.js CHANGED
@@ -18,6 +18,12 @@ const { values } = require("./values.config");
18
18
 
19
19
  const properties = new PropertyRepository();
20
20
 
21
+ // Property linking also needs the Aurora wiring gs injects only in
22
+ // environments with the database stack; without it, requests keep the
23
+ // pre-property behaviour (free-text room required).
24
+ const propertyLinkingEnabled =
25
+ values.linkToProperty === true && !!process.env.POSTGRES_SECRET_ARN;
26
+
21
27
  module.exports.createJob = (event, context, callback) => {
22
28
  // Avoids waiting on the pooled DB connection to close before returning.
23
29
  context.callbackWaitsForEmptyEventLoop = false;
@@ -33,7 +39,7 @@ module.exports.createJob = (event, context, callback) => {
33
39
  );
34
40
  }
35
41
  // With linking on, location is resolved later; without it, room is required now.
36
- const hasLocation = values.linkToProperty || !_.isUndefined(data.room);
42
+ const hasLocation = propertyLinkingEnabled || !_.isUndefined(data.room);
37
43
  if (
38
44
  !data.userID ||
39
45
  _.isUndefined(data.userName) ||
@@ -71,7 +77,7 @@ module.exports.createJob = (event, context, callback) => {
71
77
 
72
78
  // Resolved server-side, never taken from the request, so a resident cannot spoof a property.
73
79
  let resolvedProperty = null;
74
- if (values.linkToProperty) {
80
+ if (propertyLinkingEnabled) {
75
81
  // An explicit propertyId is honoured for any actor holding the tracking
76
82
  // permission (staff can also submit as themselves); it is client input,
77
83
  // so resolution fails closed.
@@ -126,7 +132,7 @@ module.exports.createJob = (event, context, callback) => {
126
132
  const room = propertyName || data.room;
127
133
 
128
134
  // No property link and no room means no location.
129
- if (values.linkToProperty && !room) {
135
+ if (propertyLinkingEnabled && !room) {
130
136
  log("createJob", "InsufficientInput", data.userID);
131
137
  return callback(
132
138
  null,
package/editJob.js CHANGED
@@ -17,6 +17,12 @@ const { values } = require("./values.config");
17
17
 
18
18
  const properties = new PropertyRepository();
19
19
 
20
+ // Property linking also needs the Aurora wiring gs injects only in
21
+ // environments with the database stack; without it, edits keep the
22
+ // pre-property behaviour (free-text room only).
23
+ const propertyLinkingEnabled =
24
+ values.linkToProperty === true && !!process.env.POSTGRES_SECRET_ARN;
25
+
20
26
  module.exports.editJob = (event, context, callback) => {
21
27
  // Avoids waiting on the pooled DB connection to close before returning.
22
28
  context.callbackWaitsForEmptyEventLoop = false;
@@ -45,7 +51,12 @@ module.exports.editJob = (event, context, callback) => {
45
51
  }),
46
52
  );
47
53
  }
48
- if (values.linkToProperty) {
54
+ if (!propertyLinkingEnabled) {
55
+ // Without a resolver a client-supplied link cannot be verified, so
56
+ // never persist one; stored links on existing jobs are untouched.
57
+ delete data.job.propertyId;
58
+ delete data.job.propertyName;
59
+ } else {
49
60
  // A set propertyId is client input; verify it against the job's own
50
61
  // site (the site the edit was authorised for), failing closed.
51
62
  if (data.job.propertyId != null) {
package/feature.config.js CHANGED
@@ -18,7 +18,11 @@ exports.entity = {
18
18
  exports.serverless = {
19
19
  name: values.serviceKey,
20
20
  useVpc: true, // Enable VPC routing for static outbound IP (requires vpcConfig in config/index.js)
21
- usePostgres: true, // Wires the Aurora app secret for property resolution (requires useVpc)
21
+ // Aurora app secret is only used for property resolution, so only the
22
+ // property-linking variant asks for it — clone variants (forms/enquiry/
23
+ // feedback) stay off Aurora entirely. gs also skips this wiring in
24
+ // environments without the database stack (config/index.js postgresEnabled).
25
+ usePostgres: values.linkToProperty === true, // requires useVpc
22
26
  apis: [
23
27
  {
24
28
  name: "getJobType",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws-forms",
3
- "version": "2.1.46",
3
+ "version": "2.1.47",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "scripts": {
6
6
  "gc": "node ../../tools/gc ./",