@api-client/core 0.18.5 → 0.18.6

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.
@@ -0,0 +1,4 @@
1
+ import DOMPurify from 'dompurify';
2
+ declare let instance: typeof DOMPurify;
3
+ export default instance;
4
+ //# sourceMappingURL=dom_purify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom_purify.d.ts","sourceRoot":"","sources":["../../../src/lib/dom_purify.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,QAAA,IAAI,QAAQ,EAAE,OAAO,SAAS,CAAA;AAsB9B,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,23 @@
1
+ import DOMPurify from 'dompurify';
2
+ let instance;
3
+ function isNodeJsEnvironment() {
4
+ return (
5
+ // eslint-disable-next-line no-restricted-globals
6
+ typeof process !== 'undefined' &&
7
+ // eslint-disable-next-line no-restricted-globals
8
+ typeof process.versions !== 'undefined' &&
9
+ // eslint-disable-next-line no-restricted-globals
10
+ typeof process.versions.node !== 'undefined');
11
+ }
12
+ if (isNodeJsEnvironment()) {
13
+ const { JSDOM } = await import('jsdom');
14
+ const { window } = new JSDOM('<!DOCTYPE html>');
15
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
+ // @ts-ignore
17
+ instance = DOMPurify(window);
18
+ }
19
+ else {
20
+ instance = DOMPurify;
21
+ }
22
+ export default instance;
23
+ //# sourceMappingURL=dom_purify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom_purify.js","sourceRoot":"","sources":["../../../src/lib/dom_purify.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,IAAI,QAA0B,CAAA;AAE9B,SAAS,mBAAmB;IAC1B,OAAO;IACL,iDAAiD;IACjD,OAAO,OAAO,KAAK,WAAW;QAC9B,iDAAiD;QACjD,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW;QACvC,iDAAiD;QACjD,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CAC7C,CAAA;AACH,CAAC;AACD,IAAI,mBAAmB,EAAE,EAAE,CAAC;IAC1B,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAA;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAC/C,6DAA6D;IAC7D,aAAa;IACb,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;AAC9B,CAAC;KAAM,CAAC;IACN,QAAQ,GAAG,SAAS,CAAA;AACtB,CAAC;AAED,eAAe,QAAQ,CAAA","sourcesContent":["import DOMPurify from 'dompurify'\n\nlet instance: typeof DOMPurify\n\nfunction isNodeJsEnvironment(): boolean {\n return (\n // eslint-disable-next-line no-restricted-globals\n typeof process !== 'undefined' &&\n // eslint-disable-next-line no-restricted-globals\n typeof process.versions !== 'undefined' &&\n // eslint-disable-next-line no-restricted-globals\n typeof process.versions.node !== 'undefined'\n )\n}\nif (isNodeJsEnvironment()) {\n const { JSDOM } = await import('jsdom')\n const { window } = new JSDOM('<!DOCTYPE html>')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n instance = DOMPurify(window)\n} else {\n instance = DOMPurify\n}\n\nexport default instance\n"]}
@@ -1,7 +1,7 @@
1
- import DOMPurify from 'isomorphic-dompurify';
2
1
  import { snakeCase } from '@pawel-up/jexl/string.js';
2
+ import DOMPurify from '../../lib/dom_purify.js';
3
3
  export function sanitizeInput(input) {
4
- return DOMPurify.isSupported ? DOMPurify.sanitize(input) : input;
4
+ return DOMPurify.sanitize(input);
5
5
  }
6
6
  /**
7
7
  * Converts a string into a sanitized, database column friendly name.
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../../src/modeling/helpers/database.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAClE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB,EAAE,WAAW,GAAG,iBAAiB;IACrF,cAAc;IACd,IAAI,IAAI,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;IAEnC,0BAA0B;IAC1B,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAEtB,8EAA8E;IAC9E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IAEnC,mEAAmE;IACnE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;IAEtC,qFAAqF;IACrF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAEnC,OAAO,IAAI,IAAI,WAAW,CAAA;AAC5B,CAAC;AACD;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,WAAW,GAAG,gBAAgB;IACnF,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AACrD,CAAC","sourcesContent":["import DOMPurify from 'isomorphic-dompurify'\nimport { snakeCase } from '@pawel-up/jexl/string.js'\n\nexport function sanitizeInput(input: string): string {\n return DOMPurify.isSupported ? DOMPurify.sanitize(input) : input\n}\n\n/**\n * Converts a string into a sanitized, database column friendly name.\n * - Sanitizes the input using DOMPurify.\n * - Converts to lowercase.\n * - Replaces spaces and multiple underscores with a single underscore.\n * - Removes any characters that are not alphanumeric or underscore.\n *\n * @param inputName The string to format.\n * @returns A database column friendly name.\n */\nexport function toDatabaseColumnName(inputName: string, defaultName = 'untitled_column'): string {\n // 1. Sanitize\n let name = sanitizeInput(inputName)\n\n // 2. Convert to lowercase\n name = snakeCase(name)\n\n // 3. Replace spaces and multiple hyphens/underscores with a single underscore\n name = name.replace(/[\\s-]+/g, '_')\n\n // 4. Remove any characters that are not alphanumeric or underscore\n name = name.replace(/[^a-z0-9_]/g, '')\n\n // 5. Ensure it doesn't start or end with an underscore (optional, but good practice)\n name = name.replace(/^_+|_+$/g, '')\n\n return name || defaultName\n}\n/**\n * Converts a string into a sanitized, database table friendly name.\n * - Sanitizes the input using DOMPurify.\n * - Converts to lowercase.\n * - Replaces spaces and multiple underscores with a single underscore.\n * - Removes any characters that are not alphanumeric or underscore.\n *\n * @param inputName The string to format.\n * @returns A database table friendly name.\n */\nexport function toDatabaseTableName(inputName: string, defaultName = 'untitled_table'): string {\n return toDatabaseColumnName(inputName, defaultName)\n}\n"]}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../../src/modeling/helpers/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,SAAS,MAAM,yBAAyB,CAAA;AAE/C,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB,EAAE,WAAW,GAAG,iBAAiB;IACrF,cAAc;IACd,IAAI,IAAI,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;IAEnC,0BAA0B;IAC1B,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAEtB,8EAA8E;IAC9E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IAEnC,mEAAmE;IACnE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;IAEtC,qFAAqF;IACrF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAEnC,OAAO,IAAI,IAAI,WAAW,CAAA;AAC5B,CAAC;AACD;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,WAAW,GAAG,gBAAgB;IACnF,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AACrD,CAAC","sourcesContent":["import { snakeCase } from '@pawel-up/jexl/string.js'\nimport DOMPurify from '../../lib/dom_purify.js'\n\nexport function sanitizeInput(input: string): string {\n return DOMPurify.sanitize(input)\n}\n\n/**\n * Converts a string into a sanitized, database column friendly name.\n * - Sanitizes the input using DOMPurify.\n * - Converts to lowercase.\n * - Replaces spaces and multiple underscores with a single underscore.\n * - Removes any characters that are not alphanumeric or underscore.\n *\n * @param inputName The string to format.\n * @returns A database column friendly name.\n */\nexport function toDatabaseColumnName(inputName: string, defaultName = 'untitled_column'): string {\n // 1. Sanitize\n let name = sanitizeInput(inputName)\n\n // 2. Convert to lowercase\n name = snakeCase(name)\n\n // 3. Replace spaces and multiple hyphens/underscores with a single underscore\n name = name.replace(/[\\s-]+/g, '_')\n\n // 4. Remove any characters that are not alphanumeric or underscore\n name = name.replace(/[^a-z0-9_]/g, '')\n\n // 5. Ensure it doesn't start or end with an underscore (optional, but good practice)\n name = name.replace(/^_+|_+$/g, '')\n\n return name || defaultName\n}\n/**\n * Converts a string into a sanitized, database table friendly name.\n * - Sanitizes the input using DOMPurify.\n * - Converts to lowercase.\n * - Replaces spaces and multiple underscores with a single underscore.\n * - Removes any characters that are not alphanumeric or underscore.\n *\n * @param inputName The string to format.\n * @returns A database table friendly name.\n */\nexport function toDatabaseTableName(inputName: string, defaultName = 'untitled_table'): string {\n return toDatabaseColumnName(inputName, defaultName)\n}\n"]}