@sera4/essentia 3.0.12 → 3.0.13

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.
Files changed (87) hide show
  1. package/package.json +9 -3
  2. package/package.tar.gz +0 -0
  3. package/scripts/publish.sh +46 -0
  4. package/dist/ts/cache/index.d.ts +0 -33
  5. package/dist/ts/cache/index.js +0 -171
  6. package/dist/ts/cache/index.js.map +0 -1
  7. package/dist/ts/configurations/server-config.d.ts +0 -4
  8. package/dist/ts/configurations/server-config.js +0 -2
  9. package/dist/ts/configurations/server-config.js.map +0 -1
  10. package/dist/ts/constants/index.d.ts +0 -7
  11. package/dist/ts/constants/index.js +0 -8
  12. package/dist/ts/constants/index.js.map +0 -1
  13. package/dist/ts/cycle/index.d.ts +0 -53
  14. package/dist/ts/cycle/index.js +0 -169
  15. package/dist/ts/cycle/index.js.map +0 -1
  16. package/dist/ts/dns/DnsCache.d.ts +0 -50
  17. package/dist/ts/dns/DnsCache.js +0 -137
  18. package/dist/ts/dns/DnsCache.js.map +0 -1
  19. package/dist/ts/dns/index.d.ts +0 -4
  20. package/dist/ts/dns/index.js +0 -4
  21. package/dist/ts/dns/index.js.map +0 -1
  22. package/dist/ts/formatter/index.d.ts +0 -44
  23. package/dist/ts/formatter/index.js +0 -76
  24. package/dist/ts/formatter/index.js.map +0 -1
  25. package/dist/ts/hal/index.d.ts +0 -26
  26. package/dist/ts/hal/index.js +0 -70
  27. package/dist/ts/hal/index.js.map +0 -1
  28. package/dist/ts/health/index.d.ts +0 -53
  29. package/dist/ts/health/index.js +0 -165
  30. package/dist/ts/health/index.js.map +0 -1
  31. package/dist/ts/helpers/index.d.ts +0 -1
  32. package/dist/ts/helpers/index.js +0 -2
  33. package/dist/ts/helpers/index.js.map +0 -1
  34. package/dist/ts/helpers/test-server-wrapper.d.ts +0 -56
  35. package/dist/ts/helpers/test-server-wrapper.js +0 -144
  36. package/dist/ts/helpers/test-server-wrapper.js.map +0 -1
  37. package/dist/ts/index.d.ts +0 -22
  38. package/dist/ts/index.js +0 -27
  39. package/dist/ts/index.js.map +0 -1
  40. package/dist/ts/last-commit/index.d.ts +0 -12
  41. package/dist/ts/last-commit/index.js +0 -82
  42. package/dist/ts/last-commit/index.js.map +0 -1
  43. package/dist/ts/logger/index.d.ts +0 -3
  44. package/dist/ts/logger/index.js +0 -4
  45. package/dist/ts/logger/index.js.map +0 -1
  46. package/dist/ts/logger/s4-logger.d.ts +0 -23
  47. package/dist/ts/logger/s4-logger.js +0 -105
  48. package/dist/ts/logger/s4-logger.js.map +0 -1
  49. package/dist/ts/paginator/index.d.ts +0 -2
  50. package/dist/ts/paginator/index.js +0 -3
  51. package/dist/ts/paginator/index.js.map +0 -1
  52. package/dist/ts/paginator/s4-pagination.d.ts +0 -26
  53. package/dist/ts/paginator/s4-pagination.js +0 -49
  54. package/dist/ts/paginator/s4-pagination.js.map +0 -1
  55. package/dist/ts/paginator/sql-pagination.d.ts +0 -52
  56. package/dist/ts/paginator/sql-pagination.js +0 -157
  57. package/dist/ts/paginator/sql-pagination.js.map +0 -1
  58. package/dist/ts/paper-trail/helpers.d.ts +0 -14
  59. package/dist/ts/paper-trail/helpers.js +0 -74
  60. package/dist/ts/paper-trail/helpers.js.map +0 -1
  61. package/dist/ts/paper-trail/index.d.ts +0 -54
  62. package/dist/ts/paper-trail/index.js +0 -236
  63. package/dist/ts/paper-trail/index.js.map +0 -1
  64. package/dist/ts/prompts/index.d.ts +0 -21
  65. package/dist/ts/prompts/index.js +0 -68
  66. package/dist/ts/prompts/index.js.map +0 -1
  67. package/dist/ts/queue/index.d.ts +0 -232
  68. package/dist/ts/queue/index.js +0 -451
  69. package/dist/ts/queue/index.js.map +0 -1
  70. package/dist/ts/queue/publisher.d.ts +0 -41
  71. package/dist/ts/queue/publisher.js +0 -84
  72. package/dist/ts/queue/publisher.js.map +0 -1
  73. package/dist/ts/queue/queue-logger.d.ts +0 -10
  74. package/dist/ts/queue/queue-logger.js +0 -35
  75. package/dist/ts/queue/queue-logger.js.map +0 -1
  76. package/dist/ts/queue/subscriber.d.ts +0 -55
  77. package/dist/ts/queue/subscriber.js +0 -98
  78. package/dist/ts/queue/subscriber.js.map +0 -1
  79. package/dist/ts/safe-proxy/index.d.ts +0 -35
  80. package/dist/ts/safe-proxy/index.js +0 -54
  81. package/dist/ts/safe-proxy/index.js.map +0 -1
  82. package/dist/ts/serializer/index.d.ts +0 -52
  83. package/dist/ts/serializer/index.js +0 -83
  84. package/dist/ts/serializer/index.js.map +0 -1
  85. package/dist/ts/utils/index.d.ts +0 -49
  86. package/dist/ts/utils/index.js +0 -157
  87. package/dist/ts/utils/index.js.map +0 -1
@@ -1,55 +0,0 @@
1
- interface Exchange {
2
- name: string;
3
- type: string;
4
- options?: any;
5
- }
6
- interface Queue {
7
- name: string;
8
- options?: any;
9
- }
10
- interface MessagePayload {
11
- metadata: any;
12
- error?: any;
13
- original_content?: string;
14
- [key: string]: any;
15
- }
16
- type MessageCallback = (payload: MessagePayload, error?: any) => void;
17
- /**
18
- * A subscriber for AMQP service
19
- */
20
- export declare class Subscriber {
21
- private exchange;
22
- private queue;
23
- private _key;
24
- private name;
25
- private channel;
26
- private callbacks;
27
- get key(): string;
28
- /**
29
- * Builds a subscriber
30
- * @param exchange name of the AMQP exchange
31
- * @param queue name of the AMQP service
32
- * @param key routing key. This will be used to bind the queue to the exchange
33
- * @param name a useful name to be printed in the logs
34
- */
35
- constructor(exchange: Exchange, queue: Queue, key: string, name: string);
36
- /**
37
- * Initializes the subscriber on the given connection.
38
- * During this call, the exchange and the queues are asserted
39
- * and bound via the key provided in the constructor.
40
- * @param conn amqp connection object
41
- */
42
- init(conn: any): Promise<void>;
43
- /**
44
- * Closes the channel
45
- * @returns promise
46
- */
47
- closeChannel(): Promise<void>;
48
- /**
49
- * Register a new callback to receive message through this
50
- * subscriber object
51
- * @param cb A callback to be called when a message arrives
52
- */
53
- registerCallback(cb: MessageCallback): void;
54
- }
55
- export {};
@@ -1,98 +0,0 @@
1
- import logger from "./queue-logger.js";
2
- /**
3
- * A subscriber for AMQP service
4
- */
5
- export class Subscriber {
6
- get key() {
7
- return this._key;
8
- }
9
- /**
10
- * Builds a subscriber
11
- * @param exchange name of the AMQP exchange
12
- * @param queue name of the AMQP service
13
- * @param key routing key. This will be used to bind the queue to the exchange
14
- * @param name a useful name to be printed in the logs
15
- */
16
- constructor(exchange, queue, key, name) {
17
- this.exchange = exchange;
18
- this.queue = queue;
19
- this._key = key;
20
- this.name = name;
21
- this.channel = null;
22
- this.callbacks = [];
23
- }
24
- /**
25
- * Initializes the subscriber on the given connection.
26
- * During this call, the exchange and the queues are asserted
27
- * and bound via the key provided in the constructor.
28
- * @param conn amqp connection object
29
- */
30
- async init(conn) {
31
- logger.debug(`Initializing SUB channel for ${this.name}`);
32
- if (this.channel) {
33
- logger.warn(`SUB channel for ${this.name} already initialized`);
34
- return;
35
- }
36
- this.channel = await conn.createChannel();
37
- if (!this.channel) {
38
- throw new Error(`Cannot create SUB channel for ${this.name}`);
39
- }
40
- this.channel.on("error", (err) => {
41
- logger.debug(`Connection error for ${this.name}`, err);
42
- this.channel = null;
43
- });
44
- this.channel.on("close", () => {
45
- logger.debug(`Connection closed for ${this.name}`);
46
- this.channel = null;
47
- });
48
- logger.debug(`Initialized SUB channel for ${this.name}`);
49
- const { name: exchangeName, options: exchangeOptions, type } = this.exchange;
50
- const { name: queueName, options: queueOptions } = this.queue;
51
- await this.channel.assertExchange(exchangeName, type, exchangeOptions);
52
- await this.channel.assertQueue(queueName, queueOptions);
53
- logger.debug(`Binding queue ${queueName} on ${exchangeName} exchange for ${this._key} key`);
54
- await this.channel.bindQueue(queueName, exchangeName, this._key);
55
- this.channel.consume(queueName, (msg) => {
56
- const { fields, content } = msg;
57
- let payload = { metadata: fields };
58
- let error = null;
59
- try {
60
- const parsedContent = JSON.parse(content.toString());
61
- payload = { ...parsedContent, metadata: fields };
62
- }
63
- catch (e) {
64
- logger.error("Failed to parse incoming message:", e);
65
- error = e;
66
- payload = { error, original_content: content.toString(), metadata: fields };
67
- }
68
- logger.debug(`Got message from exchange '${fields.exchange}' with key '${fields.routingKey}'`);
69
- logger.debug("Content", payload);
70
- this.callbacks.forEach(cb => {
71
- cb(payload, error);
72
- });
73
- this.channel.ack(msg);
74
- }, { noAck: false });
75
- }
76
- /**
77
- * Closes the channel
78
- * @returns promise
79
- */
80
- async closeChannel() {
81
- if (this.channel) {
82
- logger.debug("Closing subscriber channel", this.name);
83
- return this.channel.close();
84
- }
85
- else {
86
- logger.error("Can't close a null subscriber channel");
87
- }
88
- }
89
- /**
90
- * Register a new callback to receive message through this
91
- * subscriber object
92
- * @param cb A callback to be called when a message arrives
93
- */
94
- registerCallback(cb) {
95
- this.callbacks.push(cb);
96
- }
97
- }
98
- //# sourceMappingURL=subscriber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../../../ts/queue/subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAsBvC;;GAEG;AACH,MAAM,OAAO,UAAU;IAQrB,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;OAMG;IACH,YAAY,QAAkB,EAAE,KAAY,EAAE,GAAW,EAAE,IAAY;QACrE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,IAAS;QAClB,MAAM,CAAC,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE1D,IAAI,IAAI,CAAC,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,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY;QAChB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,EAAmB;QAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1,35 +0,0 @@
1
- import { AxiosResponse } from "axios";
2
- interface Locals {
3
- account?: {
4
- id?: string;
5
- };
6
- tenant?: {
7
- id?: string;
8
- };
9
- membership?: {
10
- id?: string;
11
- } | null;
12
- }
13
- interface RequestOptions {
14
- headers?: Record<string, string>;
15
- data?: any;
16
- }
17
- interface ProxyLocals {
18
- account?: {
19
- id?: string;
20
- };
21
- tenant?: {
22
- id?: string;
23
- };
24
- membership?: {
25
- id?: string;
26
- } | null;
27
- }
28
- declare class SafeProxy {
29
- constructor();
30
- post(locals: Locals, url: string, options?: RequestOptions): Promise<AxiosResponse>;
31
- delete(locals: Locals, url: string, options?: RequestOptions): Promise<AxiosResponse>;
32
- private _proxyRequest;
33
- }
34
- export declare const safeProxy: SafeProxy;
35
- export type { Locals, RequestOptions, ProxyLocals };
@@ -1,54 +0,0 @@
1
- import axios from "axios";
2
- import _ from 'lodash';
3
- const { omitBy, isNil } = _;
4
- /* A class which safely wraps an axios connection in order to pass the current user through to
5
- * the next service. Useful when one of our microservices requires auth as either an admin (sera4tal)
6
- * or as the end user (example: DELETE /auth/sessions/:id
7
- *
8
- * Similar to proxy however this isn't a proxy, it's a full out new call that we can manage
9
- * each method requires a res.locals from a pre-authd session
10
- */
11
- class SafeProxy {
12
- constructor() {
13
- }
14
- // a safe post request
15
- // locals = res.locals - your authentication details
16
- post(locals, url, options = { headers: {}, data: {} }) {
17
- const { account, tenant, membership } = locals;
18
- return this._proxyRequest({ account, tenant, membership }, url, "post", options);
19
- }
20
- delete(locals, url, options = { headers: {}, data: {} }) {
21
- const { account, tenant, membership } = locals;
22
- return this._proxyRequest({ account, tenant, membership }, url, "delete", options);
23
- }
24
- /* private methods */
25
- // supports get, delete, post
26
- // options includes { headers, data } for post / delete payloads
27
- async _proxyRequest(locals, url, method = "get", options) {
28
- let request;
29
- const membership = locals.membership ? JSON.stringify(locals.membership) : null;
30
- const headers = omitBy({
31
- ...options.headers,
32
- "tws-account-id": locals.account?.id,
33
- "tws-tenant-id": locals.tenant?.id,
34
- "tws-membership-id": locals.membership?.id,
35
- "tws-membership": membership
36
- }, isNil);
37
- switch (method) {
38
- case "post":
39
- request = axios.post(url, { ...options.data }, { headers });
40
- break;
41
- case "delete":
42
- request = axios.delete(url, { data: options.data, headers });
43
- break;
44
- case "get":
45
- request = axios.get(url, { headers });
46
- break;
47
- default:
48
- throw new Error("unknown type called in proxyRequest");
49
- }
50
- return request;
51
- }
52
- }
53
- export const safeProxy = new SafeProxy();
54
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/safe-proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AA+B5B;;;;;;GAMG;AACH,MAAM,SAAS;IACb;IACA,CAAC;IAED,sBAAsB;IACtB,oDAAoD;IACpD,IAAI,CAAC,MAAc,EAAE,GAAW,EAAE,UAA0B,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACnF,MA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OAAO,EAAE,CAAC,CAAC;gBAC5D,MAAM;YACR,KAAK,QAAQ;gBACX,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC7D,MAAM;YACR,KAAK,KAAK;gBACR,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;gBACtC,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
@@ -1,52 +0,0 @@
1
- interface SerializerOptions {
2
- hide?: string[];
3
- remove?: string[];
4
- decorators?: Decorator[];
5
- includeAllFields?: boolean;
6
- includeFields?: Record<string, boolean>;
7
- }
8
- interface EachOptions {
9
- includeAllFields?: boolean;
10
- includeFields?: Record<string, boolean>;
11
- handlerOptions?: Record<string, any>;
12
- serializer?: string;
13
- includes?: Array<Record<string, any>>;
14
- }
15
- interface Decorator {
16
- name: string;
17
- handler?: (value: any) => any;
18
- advHandler?: (value: any, object: any, options: Record<string, any>) => any;
19
- }
20
- interface ModelInstance {
21
- get: () => Record<string, any>;
22
- prototype: {
23
- toJSON: (options?: EachOptions) => Record<string, any>;
24
- get: () => Record<string, any>;
25
- };
26
- }
27
- interface CustomSerializers {
28
- [name: string]: (data: Record<string, any>) => Record<string, any>;
29
- }
30
- declare const _default: {
31
- /**
32
- * Serializes a Sequelize Model.
33
- * @param {Object} Model the sequelize model to add this plugin to
34
- * @param {Object} options various options for serialization. These can be:
35
- * • hide - an array of fields to be omitted
36
- * • remove - an array of fields to be REMOVED so they cannot be unhidden
37
- * • decorators - an array of special decorators to run during serialization
38
- * • handler - a handler for transforming data using only the values
39
- * • advhandler - an advanced handler for transforming data using the value, object or options
40
- * • includeAllFields - show fields that are normally hidden
41
- * • includeFields[..] - show specific fields that are normally hidden
42
- */
43
- serialize: (Model: ModelInstance, options?: SerializerOptions) => void;
44
- /**
45
- * Registers a custom serializer.
46
- * @param {String} name the name of the custom serializer
47
- * @param {Function} serializer a custom serializer function associated with the name
48
- */
49
- register: (name: string, serializer: (data: Record<string, any>) => Record<string, any>) => void;
50
- };
51
- export default _default;
52
- export type { SerializerOptions, EachOptions, Decorator, ModelInstance, CustomSerializers };
@@ -1,83 +0,0 @@
1
- import _ from "lodash";
2
- const customSerializers = {};
3
- export default {
4
- /**
5
- * Serializes a Sequelize Model.
6
- * @param {Object} Model the sequelize model to add this plugin to
7
- * @param {Object} options various options for serialization. These can be:
8
- * • hide - an array of fields to be omitted
9
- * • remove - an array of fields to be REMOVED so they cannot be unhidden
10
- * • decorators - an array of special decorators to run during serialization
11
- * • handler - a handler for transforming data using only the values
12
- * • advhandler - an advanced handler for transforming data using the value, object or options
13
- * • includeAllFields - show fields that are normally hidden
14
- * • includeFields[..] - show specific fields that are normally hidden
15
- */
16
- serialize: (Model, options = {}) => {
17
- Model.prototype.toJSON = function (eachOptions = {}) {
18
- const hide = options.hide || [];
19
- const remove = options.remove || [];
20
- // ignore hide principles; but still do NOT show null
21
- const includeAllFields = eachOptions.includeAllFields;
22
- // optionally force a normally hidden fields to be seen (by name)
23
- const includeFields = eachOptions.includeFields || {};
24
- const handlerOptions = eachOptions.handlerOptions || {};
25
- const values = this.get();
26
- if (options.decorators) {
27
- options.decorators.forEach(dec => {
28
- const k = dec.name;
29
- const v = values[k];
30
- // the advanced handler takes more parameters
31
- if (dec.advHandler) {
32
- values[k] = dec.advHandler(v, this, handlerOptions);
33
- }
34
- else if (dec.handler) {
35
- values[k] = dec.handler(v);
36
- }
37
- });
38
- }
39
- // for security reasons, some fields may need to be removed, such as
40
- // password salts and mfa tokens
41
- remove.forEach((field) => {
42
- delete values[field];
43
- });
44
- // hidden fields CAN be resurrected if NOT null, and forced to be
45
- // included
46
- let serialized = _.omitBy(values, (v, k) => {
47
- if (v === null)
48
- return true;
49
- let omitted = (includeAllFields ? false : hide.includes(k));
50
- if (omitted && includeFields[k])
51
- omitted = false;
52
- return omitted;
53
- });
54
- const s = eachOptions.serializer;
55
- if (s && customSerializers[s]) {
56
- serialized = customSerializers[s](serialized);
57
- }
58
- if (Array.isArray(eachOptions.includes)) {
59
- // Attach any included options that are
60
- // not null or undefined
61
- eachOptions.includes.forEach(include => {
62
- if (include) {
63
- const key = Object.keys(include)[0];
64
- const value = include[key];
65
- if (value) {
66
- serialized[key] = value;
67
- }
68
- }
69
- });
70
- }
71
- return serialized;
72
- };
73
- },
74
- /**
75
- * Registers a custom serializer.
76
- * @param {String} name the name of the custom serializer
77
- * @param {Function} serializer a custom serializer function associated with the name
78
- */
79
- register: (name, serializer) => {
80
- customSerializers[name] = serializer;
81
- }
82
- };
83
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/serializer/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAoCvB,MAAM,iBAAiB,GAAsB,EAAE,CAAC;AAEhD,eAAe;IACb;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,CAAC,KAAoB,EAAE,UAA6B,EAAE,EAAQ,EAAE;QACzE,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,UAAS,cAA2B,EAAE;YAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;YACpC,qDAAqD;YACrD,MAAM,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;YAEtD,iEAAiE;YACjE,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,IAAI,EAAE,CAAC;YACtD,MAAM,cAAc,GAAG,WAAW,CAAC,cAAc,IAAI,EAAE,CAAC;YAExD,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AC,UAAU,CAAC;YACjC,IAAI,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9B,UAAU,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACxC,uCAAuC;gBACvC,wBAAwB;gBACxB,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBACrC,IAAI,OAAO,EAAE,CAAC;wBACZ,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;wBACpC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;wBAC3B,IAAI,KAAK,EAAE,CAAC;4BACV,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;wBAC1B,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAY,EAAE,UAA8D,EAAQ,EAAE;QAC/F,iBAAiB,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;IACvC,CAAC;CACF,CAAC"}
@@ -1,49 +0,0 @@
1
- interface RecursiveIteratorMeta {
2
- node: any;
3
- parent: any;
4
- path: string[];
5
- }
6
- export declare const utils: {
7
- isValidUuidV4: (input: any) => boolean;
8
- convertToIntegerArray(input: any): number[];
9
- convertToArray: (input: any) => string[];
10
- isBlank: (str: any) => boolean;
11
- getRouteType: (domain: string) => number;
12
- isWebRoute: (sessionType: any) => boolean;
13
- isApiRoute: (sessionType: any) => boolean;
14
- isMobileRoute: (sessionType: any) => boolean;
15
- isOtherRoute: (sessionType: any) => boolean;
16
- recursiveOmitBy: (object: any, callback: (meta: RecursiveIteratorMeta) => boolean, ...recursiveIteratorOpts: any[]) => any;
17
- /**
18
- * Helper function to safely update JSONB columns in Sequelize models
19
- *
20
- * @param model - The Sequelize model instance
21
- * @param columnName - The name of the JSONB column to update
22
- * @param obj - The object to merge with existing column data
23
- *
24
- * Features:
25
- * - Merges new data with existing data
26
- * - Removes null/undefined values recursively
27
- * - Only updates if data actually changed
28
- * - Handles errors gracefully
29
- * - Triggers sequelize's changed method to mark the column as changed *** VERY IMPORTANT ***
30
- *
31
- * Usage:
32
- * // In a model prototype method
33
- * Account.prototype.setOptions = function(obj) {
34
- * utils.setJSONBOptionsForColumn(this, "options", obj);
35
- * };
36
- *
37
- * // Direct usage
38
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: null }); // will remove the field
39
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: undefined }); // will remove the field
40
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: "value" }); // will set the field
41
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: "value" } }); // will set the subfield
42
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: null } }); // will remove the subfield
43
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: undefined } }); // will remove the subfield
44
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: "value" } }); // will set the subfield
45
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: null } }); // will remove the subfield
46
- */
47
- setJSONBOptionsForColumn: (model: any, columnName: string, obj: any) => void;
48
- };
49
- export {};
@@ -1,157 +0,0 @@
1
- import RecursiveIterator from 'recursive-iterator';
2
- import { TWS_ROUTE_TYPES } from "../constants/index.js";
3
- import _ from "lodash";
4
- const { merge, isEqual } = _;
5
- import logger from "../logger/s4-logger.js";
6
- // Helper function to delete object properties by path
7
- const delObjectPath = (obj, path) => {
8
- const keys = path.split('.');
9
- const lastKey = keys.pop();
10
- const target = keys.reduce((current, key) => current && current[key], obj);
11
- if (target && target.hasOwnProperty(lastKey)) {
12
- delete target[lastKey];
13
- }
14
- };
15
- export const utils = {
16
- isValidUuidV4: (input) => {
17
- if (!input) {
18
- return false;
19
- }
20
- else {
21
- return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(input);
22
- }
23
- },
24
- // convert a regular string or Array to array (ie, "[1,2,3, 0xA]", "1,2,3,10")
25
- // useful for controller inputs
26
- // - also accepts hex
27
- convertToIntegerArray(input) {
28
- return this.convertToArray(input)
29
- .filter((el) => /^[0-9]+/.test(el))
30
- .map((el) => parseInt(el))
31
- .filter((el) => Number.isInteger(el));
32
- },
33
- convertToArray: (input) => {
34
- if (Array.isArray(input)) {
35
- return input;
36
- }
37
- else {
38
- if (!!input) {
39
- if (typeof input === "number") {
40
- return [input.toString()];
41
- }
42
- let matches;
43
- if (matches = input.match(/\[(.*?)\]/)) {
44
- input = matches[1];
45
- }
46
- input = input.replace(/[\[\]]/, '');
47
- return input.replace(/\s+/, '').split(',').filter((el) => /^[0-9A-Za-z-.]+/.test(el));
48
- }
49
- else {
50
- return [];
51
- }
52
- }
53
- },
54
- isBlank: (str) => {
55
- return ((str === null) || (str === undefined) || /^\s*$/.test(str));
56
- },
57
- getRouteType: (domain) => {
58
- if (!domain)
59
- return -1;
60
- let routeType;
61
- switch (true) {
62
- case /^(tws-web|local-gateway)/i.test(domain):
63
- routeType = TWS_ROUTE_TYPES['web'];
64
- break;
65
- case /^tws-mob/i.test(domain):
66
- routeType = TWS_ROUTE_TYPES['mobile'];
67
- break;
68
- case /^(tws-api-)/i.test(domain):
69
- routeType = TWS_ROUTE_TYPES['api'];
70
- break;
71
- default:
72
- routeType = TWS_ROUTE_TYPES['other'];
73
- }
74
- return routeType;
75
- },
76
- isWebRoute: (sessionType) => (parseInt(sessionType) === TWS_ROUTE_TYPES['web']),
77
- isApiRoute: (sessionType) => (parseInt(sessionType) === TWS_ROUTE_TYPES['api']),
78
- isMobileRoute: (sessionType) => (parseInt(sessionType) === TWS_ROUTE_TYPES['mobile']),
79
- isOtherRoute: (sessionType) => {
80
- const value = parseInt(sessionType);
81
- return ((value === TWS_ROUTE_TYPES['other']) || isNaN(value)) ? true : false;
82
- },
83
- recursiveOmitBy: (object, callback, ...recursiveIteratorOpts) => {
84
- const results = merge({}, object);
85
- for (let meta of new RecursiveIterator(object, ...recursiveIteratorOpts)) {
86
- const shouldOmit = callback(meta);
87
- if (shouldOmit) {
88
- // Check if this is an array element
89
- const pathParts = meta.path;
90
- const lastPart = pathParts[pathParts.length - 1];
91
- if (!isNaN(Number(lastPart)) && Array.isArray(meta.parent)) {
92
- // This is an array element, remove it from the array
93
- const parentPath = pathParts.slice(0, -1).join('.');
94
- const parent = parentPath ? pathParts.slice(0, -1).reduce((current, key) => current && current[key], results) : results;
95
- if (parent && Array.isArray(parent[pathParts[pathParts.length - 2]])) {
96
- const arrayIndex = parseInt(lastPart);
97
- parent[pathParts[pathParts.length - 2]].splice(arrayIndex, 1);
98
- }
99
- }
100
- else {
101
- // This is an object property, delete it
102
- delObjectPath(results, meta.path.join('.'));
103
- }
104
- }
105
- }
106
- return results;
107
- },
108
- /**
109
- * Helper function to safely update JSONB columns in Sequelize models
110
- *
111
- * @param model - The Sequelize model instance
112
- * @param columnName - The name of the JSONB column to update
113
- * @param obj - The object to merge with existing column data
114
- *
115
- * Features:
116
- * - Merges new data with existing data
117
- * - Removes null/undefined values recursively
118
- * - Only updates if data actually changed
119
- * - Handles errors gracefully
120
- * - Triggers sequelize's changed method to mark the column as changed *** VERY IMPORTANT ***
121
- *
122
- * Usage:
123
- * // In a model prototype method
124
- * Account.prototype.setOptions = function(obj) {
125
- * utils.setJSONBOptionsForColumn(this, "options", obj);
126
- * };
127
- *
128
- * // Direct usage
129
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: null }); // will remove the field
130
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: undefined }); // will remove the field
131
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: "value" }); // will set the field
132
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: "value" } }); // will set the subfield
133
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: null } }); // will remove the subfield
134
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: undefined } }); // will remove the subfield
135
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: "value" } }); // will set the subfield
136
- * utils.setJSONBOptionsForColumn(account, "auth_options", { field: { subfield: null } }); // will remove the subfield
137
- */
138
- setJSONBOptionsForColumn: (model, columnName, obj) => {
139
- try {
140
- if (!model[columnName])
141
- model[columnName] = {};
142
- // Merge incoming options
143
- const newOptions = merge({}, model[columnName], obj);
144
- // Clean null/undefined values
145
- const cleaned = utils.recursiveOmitBy(newOptions, ({ node }) => node === undefined || node === null);
146
- const isEqualResult = isEqual(model[columnName], cleaned);
147
- if (!isEqualResult) {
148
- model.set(columnName, JSON.parse(JSON.stringify(cleaned)));
149
- }
150
- }
151
- catch (e) {
152
- logger.warn(`Error setting ${columnName}:`, e);
153
- throw e;
154
- }
155
- }
156
- };
157
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;AAC7B,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,sDAAsD;AACtD,MAAM,aAAa,GAAG,CAAC,GAAQ,EAAE,IAAY,EAAQ,EAAE;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAG,CAAC;IAC5B,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