ag-common 0.0.128 → 0.0.129

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.
@@ -2,7 +2,13 @@ import { APIGatewayProxyResult, DYNAMOKEYS } from '../types';
2
2
  export declare const returnCode: <T>(statusCode: number, body?: T | undefined, extraHeaders?: {
3
3
  [a: string]: string;
4
4
  } | undefined, fullSiteUrl?: string | undefined) => APIGatewayProxyResult;
5
- export declare const stripPKs: <T>(r: T, excludePK?: boolean) => T;
5
+ /**
6
+ * strip all dynamo generated keys. can optionally keep PK
7
+ * @param record
8
+ * @param keepPk if true, will keep PK. default true
9
+ * @returns stripped record
10
+ */
11
+ export declare const stripPKs: <T>(record: T, keepPk?: boolean) => T;
6
12
  export declare const generateDynamoPKS: ({ type, L1, L2, L3, L4, L5, L6, additionalPKValues, }: {
7
13
  type: string;
8
14
  L1: string;
@@ -33,21 +33,22 @@ const returnCode = (statusCode, body, extraHeaders, fullSiteUrl) => {
33
33
  };
34
34
  };
35
35
  exports.returnCode = returnCode;
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- const stripPKs = (r,
38
36
  /**
39
- * default true
40
- * if true, will keep PK
37
+ * strip all dynamo generated keys. can optionally keep PK
38
+ * @param record
39
+ * @param keepPk if true, will keep PK. default true
40
+ * @returns stripped record
41
41
  */
42
- excludePK = true) => {
43
- if (!r) {
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ const stripPKs = (record, keepPk = true) => {
44
+ if (!record) {
44
45
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
46
  return null;
46
47
  }
47
48
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
48
49
  // @ts-ignore
49
- const { PK, PK1, PK2, PK3, PK4, PK5, L1, L2, L3, L4, L5, L6 } = r, rest = __rest(r, ["PK", "PK1", "PK2", "PK3", "PK4", "PK5", "L1", "L2", "L3", "L4", "L5", "L6"]);
50
- if (!excludePK) {
50
+ const { PK, PK1, PK2, PK3, PK4, PK5, L1, L2, L3, L4, L5, L6 } = record, rest = __rest(record, ["PK", "PK1", "PK2", "PK3", "PK4", "PK5", "L1", "L2", "L3", "L4", "L5", "L6"]);
51
+ if (keepPk) {
51
52
  //@ts-ignore
52
53
  rest.PK = PK;
53
54
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Chevron: ({ width, className, colour, onToggle, point, }: {
2
3
  /**
3
4
  * default right
@@ -18,25 +18,25 @@ const IconStyled = (0, styled_components_1.default)(Icon_1.Icon) `
18
18
  margin: 0;
19
19
  padding: 0;
20
20
  `;
21
- const ChevronIcon = (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 -256 1792 1792" },
22
- react_1.default.createElement("path", { d: "M1679.339 301.56q0 53-37 90l-651 651q-38 38-91 38-54 0-90-38l-651-651q-38-36-38-90 0-53 38-91l74-75q39-37 91-37 53 0 90 37l486 486 486-486q37-37 90-37 52 0 91 37l75 75q37 39 37 91z" })));
21
+ const ChevronIcon = (react_1.default.createElement("svg", { width: "24", height: "24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
22
+ react_1.default.createElement("path", { d: "M10.294 9.698a.988.988 0 0 1 0-1.407 1.01 1.01 0 0 1 1.419 0l2.965 2.94a1.09 1.09 0 0 1 0 1.548l-2.955 2.93a1.01 1.01 0 0 1-1.638-.322.988.988 0 0 1 .218-1.085l2.318-2.297-2.327-2.307Z", fill: "inherit", className: "_14TyY7wB85QoVU" })));
23
23
  const Chevron = ({ width = '1.2rem', className, colour = 'black', onToggle, point = 'right', }) => {
24
24
  let rotate = 0;
25
25
  switch (point) {
26
26
  case 'down': {
27
- rotate = 180;
27
+ rotate = 270;
28
28
  break;
29
29
  }
30
30
  case 'left': {
31
- rotate = 270;
31
+ rotate = 0;
32
32
  break;
33
33
  }
34
34
  case 'up': {
35
- rotate = 0;
35
+ rotate = 90;
36
36
  break;
37
37
  }
38
38
  case 'right': {
39
- rotate = 90;
39
+ rotate = 180;
40
40
  }
41
41
  }
42
42
  return (react_1.default.createElement(SChevron, { className: className, onClick: () => onToggle === null || onToggle === void 0 ? void 0 : onToggle(), onTouchStart: () => onToggle === null || onToggle === void 0 ? void 0 : onToggle(), onKeyPress: (e) => e.key === 'Enter' && (onToggle === null || onToggle === void 0 ? void 0 : onToggle()) },
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare function DropdownList<T>({ options, value, onChange, placeholder, className, renderF, children, shadow, }: {
2
3
  options: T[];
3
4
  value?: T;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const HeadersRaw: ({ title, image, SiteShort, FullSiteUrl, siteDesc, }: {
2
3
  title?: string | undefined;
3
4
  image?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Loader: ({ name }: {
2
3
  name: string;
3
4
  }) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const LoginButton: ({ className, text, invert, savePath, loginPath, }: {
2
3
  invert?: boolean | undefined;
3
4
  text: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const LogoutButton: ({ className, invert, logout, }: {
2
3
  invert?: boolean | undefined;
3
4
  className?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Sidebar: ({ children, className, key, cookieDocument, }: {
2
3
  children: any;
3
4
  className?: string | undefined;
@@ -6,7 +7,7 @@ export declare const Sidebar: ({ children, className, key, cookieDocument, }: {
6
7
  */
7
8
  key?: string | undefined;
8
9
  /**
9
- * pass in SSR cookiedocument
10
+ * optionally pass in SSR cookiedocument
10
11
  */
11
12
  cookieDocument?: string | undefined;
12
13
  }) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface TableItem {
2
3
  content: JSX.Element;
3
4
  groupTitle: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const CheckboxEdit: ({ defaultValue, onSubmit, noGrow, }: {
2
3
  defaultValue: boolean;
3
4
  onSubmit: (val: boolean) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ColourEdit: ({ defaultValue, onSubmit, }: {
2
3
  defaultValue: string;
3
4
  onSubmit: (val: string) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ListboxEdit: ({ defaultValue, onSubmit, values, }: {
2
3
  defaultValue: string;
3
4
  onSubmit: (val: string[]) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { StyledComponent } from 'styled-components';
2
3
  export declare const ValueReadonly: StyledComponent<"div", any, {}, never>;
3
4
  export declare const TextEdit: ({ defaultValue, defaultEditing, onSubmit, disableEdit, placeholder, onEditingChange, onClickOutsideWithNoValue, onClickNotEditing, className, singleLine, }: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const UndoIcon: () => JSX.Element;
2
3
  export declare const PencilIcon: () => JSX.Element;
3
4
  export declare const SaveIcon: () => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ToastPosition } from 'react-hot-toast';
2
3
  interface Options {
3
4
  appearance: 'error' | 'success';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { AxiosWrapper, User } from '../../helpers/jwt';
2
3
  export declare const UserImageIcon: JSX.Element;
3
4
  export declare const UserImage: ({ image, className, }: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TLang, TResource } from '../../common/helpers/i18n';
2
3
  export declare const useTranslation: <T extends {
3
4
  [a: string]: TResource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.128",
3
+ "version": "0.0.129",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",