ag-common 0.0.166 → 0.0.169

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.
@@ -8,6 +8,9 @@ export declare const openApiImpl: (p: {
8
8
  NODE_ENV: string;
9
9
  baseUrl: string;
10
10
  endpointsBase: string;
11
+ /**
12
+ * 'default' will be applied to all functions
13
+ */
11
14
  lambdaConfig: ILambdaConfigs;
12
15
  certificate: certmgr.ICertificate;
13
16
  hostedZone: route53.IHostedZone;
@@ -52,6 +52,8 @@ const setupLambda = ({ lambdaConfig, pathV, verb, seenPermissions, authorizers,
52
52
  const writeTables = (0, array_1.distinctBy)([...(((_c = def === null || def === void 0 ? void 0 : def.dynamo) === null || _c === void 0 ? void 0 : _c.writes) || []), ...(((_d = lp === null || lp === void 0 ? void 0 : lp.dynamo) === null || _d === void 0 ? void 0 : _d.writes) || [])], (s) => s.shortName);
53
53
  const policies = [...(def.policies || []), ...((lp === null || lp === void 0 ? void 0 : lp.policies) || [])].filter(array_1.notEmpty);
54
54
  const layers = [...(def.layers || []), ...((lp === null || lp === void 0 ? void 0 : lp.layers) || [])].filter(array_1.notEmpty);
55
+ const memory = (lp === null || lp === void 0 ? void 0 : lp.memory) || (def === null || def === void 0 ? void 0 : def.memory) || 128;
56
+ const timeout = aws_cdk_lib_1.Duration.seconds((lp === null || lp === void 0 ? void 0 : lp.timeoutS) || (def === null || def === void 0 ? void 0 : def.timeoutS) || 30);
55
57
  let authorizerName = lp === null || lp === void 0 ? void 0 : lp.authorizerName;
56
58
  if (authorizerName === undefined) {
57
59
  authorizerName = def.authorizerName;
@@ -75,6 +77,8 @@ const setupLambda = ({ lambdaConfig, pathV, verb, seenPermissions, authorizers,
75
77
  policies,
76
78
  layers,
77
79
  authorizer,
80
+ memory,
81
+ timeout,
78
82
  };
79
83
  };
80
84
  const addApiPaths = (api, pathList, apiRoots) => {
@@ -108,7 +112,7 @@ const openApiImpl = (p) => {
108
112
  paths.forEach(({ fullPath, verbs, pathList }) => {
109
113
  const apiPath = addApiPaths(api, pathList, apiRoots);
110
114
  verbs.forEach((verb) => {
111
- const { environment, readTables, writeTables, policies, layers, authorizer, } = setupLambda({
115
+ const lc = setupLambda({
112
116
  lambdaConfig,
113
117
  pathV: fullPath,
114
118
  verb,
@@ -121,9 +125,9 @@ const openApiImpl = (p) => {
121
125
  functionName: lambdaName,
122
126
  runtime: aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_14_X,
123
127
  handler: 'handler',
124
- environment,
125
- memorySize: 128,
126
- timeout: aws_cdk_lib_1.Duration.seconds(30),
128
+ environment: lc.environment,
129
+ memorySize: lc.memory,
130
+ timeout: lc.timeout,
127
131
  description: '(cdk)',
128
132
  entry: entry,
129
133
  bundling: {
@@ -131,13 +135,13 @@ const openApiImpl = (p) => {
131
135
  },
132
136
  reservedConcurrentExecutions: 5,
133
137
  logRetention: aws_cdk_lib_1.aws_logs.RetentionDays.FIVE_DAYS,
134
- layers,
138
+ layers: lc.layers,
135
139
  });
136
- readTables.forEach((t) => t.table.grantReadData(lambdaV));
137
- writeTables.forEach((t) => t.table.grantReadWriteData(lambdaV));
138
- policies.forEach((p1) => lambdaV.addToRolePolicy(p1));
140
+ lc.readTables.forEach((t) => t.table.grantReadData(lambdaV));
141
+ lc.writeTables.forEach((t) => t.table.grantReadWriteData(lambdaV));
142
+ lc.policies.forEach((p1) => lambdaV.addToRolePolicy(p1));
139
143
  //
140
- apiPath.addMethod(verb.toUpperCase(), new aws_cdk_lib_1.aws_apigateway.LambdaIntegration(lambdaV, {}), { authorizer });
144
+ apiPath.addMethod(verb.toUpperCase(), new aws_cdk_lib_1.aws_apigateway.LambdaIntegration(lambdaV, {}), { authorizer: lc.authorizer });
141
145
  });
142
146
  });
143
147
  Object.keys(lambdaConfig).forEach((k) => {
@@ -29,6 +29,14 @@ export interface ILambdaConfig {
29
29
  * use the name of the lambda authorizer passed in in the openApiImpl config
30
30
  */
31
31
  authorizerName?: string;
32
+ /**
33
+ * timeout in seconds. defaults to 30
34
+ */
35
+ timeoutS?: number;
36
+ /**
37
+ * lambda memory. defaults to 128
38
+ */
39
+ memory?: number;
32
40
  }
33
41
  /**
34
42
  * 'default' will be applied to all functions
@@ -80,12 +80,12 @@ const TextEdit = ({ defaultValue = '', defaultEditing, disableEdit = false, plac
80
80
  onSubmit(value, false);
81
81
  }
82
82
  else {
83
+ if (!disableEdit && onClickOutsideWithNoValue) {
84
+ onClickOutsideWithNoValue();
85
+ }
83
86
  if (!disableEdit && editing && defaultEditing) {
84
87
  return;
85
88
  }
86
- if (onClickOutsideWithNoValue) {
87
- onClickOutsideWithNoValue();
88
- }
89
89
  setEditingRaw(false);
90
90
  }
91
91
  });
@@ -11,6 +11,7 @@ export * from './jwt';
11
11
  export * from './lang';
12
12
  export * from './plural';
13
13
  export * from './routes';
14
+ export * from './serviceWorker';
14
15
  export * from './useContextMenu';
15
16
  export * from './useLocalStorage';
16
17
  export * from './useLockBodyScroll';
@@ -23,6 +23,7 @@ __exportStar(require("./jwt"), exports);
23
23
  __exportStar(require("./lang"), exports);
24
24
  __exportStar(require("./plural"), exports);
25
25
  __exportStar(require("./routes"), exports);
26
+ __exportStar(require("./serviceWorker"), exports);
26
27
  __exportStar(require("./useContextMenu"), exports);
27
28
  __exportStar(require("./useLocalStorage"), exports);
28
29
  __exportStar(require("./useLockBodyScroll"), exports);
@@ -0,0 +1 @@
1
+ export declare function uninstallServiceWorkers(): Promise<void>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.uninstallServiceWorkers = void 0;
13
+ const async_1 = require("../../common/helpers/async");
14
+ function uninstallServiceWorkers() {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ if (typeof navigator === 'undefined') {
17
+ return;
18
+ }
19
+ yield navigator.serviceWorker
20
+ .getRegistrations()
21
+ .then((registrations) => __awaiter(this, void 0, void 0, function* () { return (0, async_1.asyncForEach)([...registrations], (r) => r.unregister()); }));
22
+ });
23
+ }
24
+ exports.uninstallServiceWorkers = uninstallServiceWorkers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.166",
3
+ "version": "0.0.169",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",