@encodeagent/platform-helper-util 1.2508.1241505

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 (122) hide show
  1. package/README.md +121 -0
  2. package/dist/__tests__/core.test.d.ts +5 -0
  3. package/dist/__tests__/core.test.d.ts.map +1 -0
  4. package/dist/__tests__/core.test.js +128 -0
  5. package/dist/__tests__/core.test.js.map +1 -0
  6. package/dist/__tests__/shortid.test.d.ts +5 -0
  7. package/dist/__tests__/shortid.test.d.ts.map +1 -0
  8. package/dist/__tests__/shortid.test.js +72 -0
  9. package/dist/__tests__/shortid.test.js.map +1 -0
  10. package/dist/__tests__/slug.test.d.ts +5 -0
  11. package/dist/__tests__/slug.test.d.ts.map +1 -0
  12. package/dist/__tests__/slug.test.js +31 -0
  13. package/dist/__tests__/slug.test.js.map +1 -0
  14. package/dist/__tests__/token.test.d.ts +5 -0
  15. package/dist/__tests__/token.test.d.ts.map +1 -0
  16. package/dist/__tests__/token.test.js +49 -0
  17. package/dist/__tests__/token.test.js.map +1 -0
  18. package/dist/__tests__/uuid.test.d.ts +5 -0
  19. package/dist/__tests__/uuid.test.d.ts.map +1 -0
  20. package/dist/__tests__/uuid.test.js +42 -0
  21. package/dist/__tests__/uuid.test.js.map +1 -0
  22. package/dist/__tests__/value-of-object.test.d.ts +5 -0
  23. package/dist/__tests__/value-of-object.test.d.ts.map +1 -0
  24. package/dist/__tests__/value-of-object.test.js +49 -0
  25. package/dist/__tests__/value-of-object.test.js.map +1 -0
  26. package/dist/ai/llm.d.ts +90 -0
  27. package/dist/ai/llm.d.ts.map +1 -0
  28. package/dist/ai/llm.js +524 -0
  29. package/dist/ai/llm.js.map +1 -0
  30. package/dist/ai/model.d.ts +14 -0
  31. package/dist/ai/model.d.ts.map +1 -0
  32. package/dist/ai/model.js +120 -0
  33. package/dist/ai/model.js.map +1 -0
  34. package/dist/ai/types.d.ts +85 -0
  35. package/dist/ai/types.d.ts.map +1 -0
  36. package/dist/ai/types.js +15 -0
  37. package/dist/ai/types.js.map +1 -0
  38. package/dist/ai/util.d.ts +28 -0
  39. package/dist/ai/util.d.ts.map +1 -0
  40. package/dist/ai/util.js +43 -0
  41. package/dist/ai/util.js.map +1 -0
  42. package/dist/auth.d.ts +34 -0
  43. package/dist/auth.d.ts.map +1 -0
  44. package/dist/auth.js +568 -0
  45. package/dist/auth.js.map +1 -0
  46. package/dist/colors.d.ts +79 -0
  47. package/dist/colors.d.ts.map +1 -0
  48. package/dist/colors.js +492 -0
  49. package/dist/colors.js.map +1 -0
  50. package/dist/constants.d.ts +86 -0
  51. package/dist/constants.d.ts.map +1 -0
  52. package/dist/constants.js +2578 -0
  53. package/dist/constants.js.map +1 -0
  54. package/dist/core.d.ts +337 -0
  55. package/dist/core.d.ts.map +1 -0
  56. package/dist/core.js +1165 -0
  57. package/dist/core.js.map +1 -0
  58. package/dist/cost.d.ts +35 -0
  59. package/dist/cost.d.ts.map +1 -0
  60. package/dist/cost.js +143 -0
  61. package/dist/cost.js.map +1 -0
  62. package/dist/file.d.ts +55 -0
  63. package/dist/file.d.ts.map +1 -0
  64. package/dist/file.js +273 -0
  65. package/dist/file.js.map +1 -0
  66. package/dist/html.d.ts +44 -0
  67. package/dist/html.d.ts.map +1 -0
  68. package/dist/html.js +420 -0
  69. package/dist/html.js.map +1 -0
  70. package/dist/index.d.ts +53 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +313 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/markdown.d.ts +20 -0
  75. package/dist/markdown.d.ts.map +1 -0
  76. package/dist/markdown.js +38 -0
  77. package/dist/markdown.js.map +1 -0
  78. package/dist/metadata.d.ts +39 -0
  79. package/dist/metadata.d.ts.map +1 -0
  80. package/dist/metadata.js +110 -0
  81. package/dist/metadata.js.map +1 -0
  82. package/dist/record.d.ts +67 -0
  83. package/dist/record.d.ts.map +1 -0
  84. package/dist/record.js +404 -0
  85. package/dist/record.js.map +1 -0
  86. package/dist/shortid.d.ts +42 -0
  87. package/dist/shortid.d.ts.map +1 -0
  88. package/dist/shortid.js +42 -0
  89. package/dist/shortid.js.map +1 -0
  90. package/dist/slug.d.ts +24 -0
  91. package/dist/slug.d.ts.map +1 -0
  92. package/dist/slug.js +43 -0
  93. package/dist/slug.js.map +1 -0
  94. package/dist/token.d.ts +34 -0
  95. package/dist/token.d.ts.map +1 -0
  96. package/dist/token.js +20 -0
  97. package/dist/token.js.map +1 -0
  98. package/dist/tree.d.ts +27 -0
  99. package/dist/tree.d.ts.map +1 -0
  100. package/dist/tree.js +193 -0
  101. package/dist/tree.js.map +1 -0
  102. package/dist/types.d.ts +270 -0
  103. package/dist/types.d.ts.map +1 -0
  104. package/dist/types.js +29 -0
  105. package/dist/types.js.map +1 -0
  106. package/dist/uuid.d.ts +25 -0
  107. package/dist/uuid.d.ts.map +1 -0
  108. package/dist/uuid.js +32 -0
  109. package/dist/uuid.js.map +1 -0
  110. package/dist/value-of-object.d.ts +25 -0
  111. package/dist/value-of-object.d.ts.map +1 -0
  112. package/dist/value-of-object.js +123 -0
  113. package/dist/value-of-object.js.map +1 -0
  114. package/dist/web-content.d.ts +54 -0
  115. package/dist/web-content.d.ts.map +1 -0
  116. package/dist/web-content.js +268 -0
  117. package/dist/web-content.js.map +1 -0
  118. package/dist/web.d.ts +36 -0
  119. package/dist/web.d.ts.map +1 -0
  120. package/dist/web.js +162 -0
  121. package/dist/web.js.map +1 -0
  122. package/package.json +68 -0
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @fileoverview Record manipulation utilities including data conversion, validation, filtering, and context extraction for database operations
3
+ * @copyright PrimeObjects Software Inc. (C) 2024 All Rights Reserved
4
+ * @author EncodeAgent Team.
5
+ * @copyright © 2024 PrimeObjects Software Inc. All rights reserved.
6
+ * @license Proprietary - Subject to PrimeObjects License Agreements
7
+ * @contact encode.agent@primeobjects.com
8
+ * @website https://www.encodeagent.com/
9
+ *
10
+ * This software contains proprietary and confidential information of
11
+ * PrimeObjects Software Inc. Any reproduction or distribution of this
12
+ * software, in whole or in part, without written permission of
13
+ * PrimeObjects Software Inc. is strictly prohibited.
14
+ *
15
+ * Unauthorized copying of this file, via any medium, is strictly prohibited.
16
+ * This file is proprietary and confidential.
17
+ */
18
+ import { IContext } from "./types";
19
+ export declare const convertRecordForCreate: (record: Record<string, any>) => Record<string, any>;
20
+ export declare const getRecordDisplayByDisplayFields: (record: Record<string, any>, displayFields?: string[]) => string;
21
+ export declare const getRecordEntityFolder: (data: Record<string, any>, entityNameOnly: boolean) => string;
22
+ export declare const getEntityFolder: (entityName: string, entityType?: string) => string;
23
+ export declare const getRecordDisplay: (record: Record<string, any>, settings?: {
24
+ entity?: Record<string, any>;
25
+ displayFields?: string[];
26
+ includeSearchDisplay?: boolean;
27
+ maxLength?: number;
28
+ emptyReturnUndefined?: boolean;
29
+ allowUseRecordId?: boolean;
30
+ }) => string | undefined;
31
+ export declare const getRecordAbstract: (record: Record<string, any>, settings?: {
32
+ entity?: Record<string, any>;
33
+ abstractFields?: string[];
34
+ maxLength?: number;
35
+ includeContent?: boolean;
36
+ }) => string;
37
+ export declare const getRecordContentByContentFields: (record: Record<string, any>, contentFields?: string[]) => string;
38
+ export declare const getRecordContent: (record: Record<string, any>, settings?: {
39
+ entity?: Record<string, any>;
40
+ contentFields?: string[];
41
+ includeSearchDisplay?: boolean;
42
+ maxLength?: number;
43
+ emptyReturnUndefined?: boolean;
44
+ }) => string | undefined;
45
+ export declare const getRecordAddress: (record: Record<string, any>, prefix: string) => string;
46
+ export declare const getRecordMedia: (record: Record<string, any>) => string;
47
+ export declare const getRecordFullName: (user: Record<string, any>, settings?: {
48
+ skipFullNameProp?: boolean;
49
+ skipNameProp?: boolean;
50
+ skipEmailProp?: boolean;
51
+ }) => string;
52
+ export declare const getRecordEmailAddress: (record: Record<string, any>, emailOnly?: boolean) => string | undefined;
53
+ export declare const getRecordPageMetadata: (record: Record<string, any>, settings?: {
54
+ siteName?: string;
55
+ }) => Record<string, any>;
56
+ export declare const applyRecordSlug: (record: Record<string, any>) => Record<string, any>;
57
+ export declare const getRecordSlug: (record: Record<string, any>) => string | undefined;
58
+ export type TRecordFilePath = {
59
+ solutionId: string;
60
+ organizationId: string;
61
+ recordId: string;
62
+ entityName: string;
63
+ fieldName?: string;
64
+ };
65
+ export declare const getRecordFilePath: (props: TRecordFilePath) => string;
66
+ export declare const getContextFromRecord: (record: Record<string, any>) => IContext;
67
+ //# sourceMappingURL=record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,wBA6BjE,CAAC;AAEF,eAAO,MAAM,+BAA+B,GACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,gBAAgB,MAAM,EAAE,WAa3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAC9B,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,gBAAgB,OAAO,KACxB,MAOF,CAAC;AAEF,eAAO,MAAM,eAAe,GACxB,YAAY,MAAM,EAClB,aAAa,MAAM,KACpB,MAMF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,WAAW;IACP,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,KACF,MAA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qBAAqB,GAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,YAAY,OAAO,KACpB,MAAM,GAAG,SAWX,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,WAAW;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,wBA0BnC,CAAC;AAEF,eAAO,MAAM,eAAe,GACxB,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAUpB,CAAC;AAEF,eAAO,MAAM,aAAa,GACtB,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC5B,MAAM,GAAG,SAaX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,eAAe,KAAG,MAI1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,QA6BlE,CAAC"}
package/dist/record.js ADDED
@@ -0,0 +1,404 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Record manipulation utilities including data conversion, validation, filtering, and context extraction for database operations
4
+ * @copyright PrimeObjects Software Inc. (C) 2024 All Rights Reserved
5
+ * @author EncodeAgent Team.
6
+ * @copyright © 2024 PrimeObjects Software Inc. All rights reserved.
7
+ * @license Proprietary - Subject to PrimeObjects License Agreements
8
+ * @contact encode.agent@primeobjects.com
9
+ * @website https://www.encodeagent.com/
10
+ *
11
+ * This software contains proprietary and confidential information of
12
+ * PrimeObjects Software Inc. Any reproduction or distribution of this
13
+ * software, in whole or in part, without written permission of
14
+ * PrimeObjects Software Inc. is strictly prohibited.
15
+ *
16
+ * Unauthorized copying of this file, via any medium, is strictly prohibited.
17
+ * This file is proprietary and confidential.
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.getContextFromRecord = exports.getRecordFilePath = exports.getRecordSlug = exports.applyRecordSlug = exports.getRecordPageMetadata = exports.getRecordEmailAddress = exports.getRecordFullName = exports.getRecordMedia = exports.getRecordAddress = exports.getRecordContent = exports.getRecordContentByContentFields = exports.getRecordAbstract = exports.getRecordDisplay = exports.getEntityFolder = exports.getRecordEntityFolder = exports.getRecordDisplayByDisplayFields = exports.convertRecordForCreate = void 0;
21
+ const lodash_1 = require("lodash");
22
+ const core_1 = require("./core");
23
+ const slug_1 = require("./slug");
24
+ const uuid_1 = require("./uuid");
25
+ const convertRecordForCreate = (record) => {
26
+ const newRecord = (0, lodash_1.cloneDeep)(record);
27
+ delete newRecord.createdBy;
28
+ delete newRecord.createdOn;
29
+ delete newRecord.ownedBy;
30
+ delete newRecord.ownedOn;
31
+ delete newRecord.modifiedBy;
32
+ delete newRecord.modifiedOn;
33
+ delete newRecord["_rid"];
34
+ delete newRecord["_self"];
35
+ delete newRecord["_etag"];
36
+ delete newRecord["_attachments"];
37
+ delete newRecord["_ts"];
38
+ delete newRecord["_id"];
39
+ delete newRecord.slug;
40
+ delete newRecord.slugs;
41
+ delete newRecord.searchDisplay;
42
+ delete newRecord.searchContent;
43
+ delete newRecord.display;
44
+ delete newRecord.system;
45
+ delete newRecord.stateCode;
46
+ delete newRecord.statusCode;
47
+ delete newRecord.organizationId;
48
+ delete newRecord.solutionId;
49
+ delete newRecord.partitionKey;
50
+ delete newRecord.isPublished;
51
+ delete newRecord.isGlobal;
52
+ newRecord.id = (0, uuid_1.newGuid)();
53
+ return newRecord;
54
+ };
55
+ exports.convertRecordForCreate = convertRecordForCreate;
56
+ const getRecordDisplayByDisplayFields = (record, displayFields) => {
57
+ let result = "";
58
+ if (displayFields && (0, lodash_1.isArray)(displayFields) && !(0, core_1.isNonEmptyString)(result)) {
59
+ for (let i = 0; i < displayFields.length && !(0, core_1.isNonEmptyString)(result); i++) {
60
+ result = record[displayFields[i]];
61
+ }
62
+ }
63
+ return result;
64
+ };
65
+ exports.getRecordDisplayByDisplayFields = getRecordDisplayByDisplayFields;
66
+ const getRecordEntityFolder = (data, entityNameOnly) => {
67
+ let entityFolder = (0, core_1.isNonEmptyString)(data.entityType) && !entityNameOnly
68
+ ? `${data.entityName ?? ""}/${data.entityType}`
69
+ : data.entityName ?? "";
70
+ if (entityFolder.length == 0)
71
+ entityFolder = "Unknown";
72
+ return entityFolder;
73
+ };
74
+ exports.getRecordEntityFolder = getRecordEntityFolder;
75
+ const getEntityFolder = (entityName, entityType) => {
76
+ let entityFolder = (0, core_1.isNonEmptyString)(entityType)
77
+ ? `${entityName}/${entityType}`
78
+ : entityName;
79
+ if (entityFolder.length == 0)
80
+ entityFolder = "Unknown";
81
+ return entityFolder;
82
+ };
83
+ exports.getEntityFolder = getEntityFolder;
84
+ const getRecordDisplay = (record, settings) => {
85
+ if (!(0, core_1.isObject)(record))
86
+ return "";
87
+ let result = "";
88
+ const includeSearchDisplay = settings?.includeSearchDisplay == true;
89
+ const maxLength = settings?.maxLength;
90
+ const entity = settings?.entity;
91
+ const displayFields = settings?.displayFields ?? entity?.displayFields;
92
+ const allowUseRecordId = settings?.allowUseRecordId == true;
93
+ if ((0, core_1.isNonEmptyString)(record._ui?.highlight?.title)) {
94
+ result = record._ui?.highlight?.title;
95
+ }
96
+ if (includeSearchDisplay && !(0, core_1.isNonEmptyString)(result, true)) {
97
+ result = record.searchDisplay;
98
+ }
99
+ if (displayFields &&
100
+ (0, lodash_1.isArray)(displayFields) &&
101
+ !(0, core_1.isNonEmptyString)(result, true)) {
102
+ result = (0, exports.getRecordDisplayByDisplayFields)(record, displayFields);
103
+ }
104
+ if (!(0, core_1.isNonEmptyString)(result, true))
105
+ result = (0, exports.getRecordFullName)(record);
106
+ if (!(0, core_1.isNonEmptyString)(result, true) &&
107
+ (0, core_1.isNonEmptyString)(record.displayValue, true))
108
+ result = record.displayValue;
109
+ const number = !(0, core_1.isNonEmptyString)(result, true) && (0, core_1.isNonEmptyString)(record.number, true)
110
+ ? `${record.number} - `
111
+ : "";
112
+ if (!(0, core_1.isNonEmptyString)(result, true) && (0, core_1.isNonEmptyString)(record.title, true))
113
+ result = `${number}${record.title}`;
114
+ if (!(0, core_1.isNonEmptyString)(result, true) && (0, core_1.isNonEmptyString)(record.name, true))
115
+ result = `${number}${record.name}`;
116
+ if (!(0, core_1.isNonEmptyString)(result, true) &&
117
+ (0, core_1.isNonEmptyString)(record.subject, true))
118
+ result = `${number}${record.subject}`;
119
+ if (!(0, core_1.isNonEmptyString)(result, true) && (0, core_1.isNonEmptyString)(record.text, true))
120
+ result = record.text;
121
+ if (!(0, core_1.isNonEmptyString)(result, true) &&
122
+ (0, core_1.isNonEmptyString)(record.symbol, true))
123
+ result = record.symbol;
124
+ if (!(0, core_1.isNonEmptyString)(result, true) && (0, core_1.isNonEmptyString)(record.code, true))
125
+ result = record.code;
126
+ result = result
127
+ .replace(/&nbsp;/g, " ")
128
+ .replace(/\r/g, " ")
129
+ .replace(/\n/g, " ")
130
+ .replace(/\t/g, " ")
131
+ .replace(/!/g, "! ")
132
+ .replace(/\?/g, "? ")
133
+ .replace(/\./g, ". ")
134
+ .replace(/,/g, ", ")
135
+ .replace(/;/g, "; ")
136
+ .replace(new RegExp(`( ){2,}`, "g"), " ")
137
+ .trim();
138
+ if ((0, lodash_1.isNumber)(maxLength) && result.length > maxLength) {
139
+ result = `${result.substring(0, maxLength)} ...`;
140
+ }
141
+ return (((0, core_1.isNonEmptyString)(result, true)
142
+ ? result
143
+ : allowUseRecordId
144
+ ? record.id
145
+ : "") ?? (settings?.emptyReturnUndefined ? undefined : ""));
146
+ };
147
+ exports.getRecordDisplay = getRecordDisplay;
148
+ const getRecordAbstract = (record, settings) => {
149
+ if (!(0, core_1.isObject)(record))
150
+ return "";
151
+ let result = "";
152
+ if ((0, lodash_1.isArray)(record?.highlight?.searchContent) &&
153
+ record?.highlight?.searchContent?.length > 0) {
154
+ result = record.highlight.searchContent[0];
155
+ }
156
+ if (!(0, core_1.isNonEmptyString)(result) && (0, core_1.isNonEmptyString)(record.summary))
157
+ result = record.summary;
158
+ if (!(0, core_1.isNonEmptyString)(result) && (0, core_1.isNonEmptyString)(record.description))
159
+ result = record.description;
160
+ if (!(0, core_1.isNonEmptyString)(result) && (0, core_1.isNonEmptyString)(record.abstract))
161
+ result = record.abstract;
162
+ if (settings?.includeContent &&
163
+ !(0, core_1.isNonEmptyString)(result) &&
164
+ (0, core_1.isNonEmptyString)(record.searchContent)) {
165
+ result = record.searchContent;
166
+ }
167
+ result = result
168
+ .replace(/&nbsp;/g, " ")
169
+ .replace(/\r/g, " ")
170
+ .replace(/\n/g, " ")
171
+ .replace(/\t/g, " ")
172
+ .replace(/!/g, "! ")
173
+ .replace(/\?/g, "? ")
174
+ .replace(/\./g, ". ")
175
+ .replace(/,/g, ", ")
176
+ .replace(/;/g, "; ")
177
+ .replace(new RegExp(`( ){2,}`, "g"), " ")
178
+ .trim();
179
+ if (settings &&
180
+ (0, lodash_1.isNumber)(settings?.maxLength) &&
181
+ result.length > settings?.maxLength) {
182
+ result = `${result.substring(0, settings?.maxLength)} ...`;
183
+ }
184
+ return result;
185
+ };
186
+ exports.getRecordAbstract = getRecordAbstract;
187
+ const getRecordContentByContentFields = (record, contentFields) => {
188
+ let result = "";
189
+ if (contentFields && (0, lodash_1.isArray)(contentFields) && !(0, core_1.isNonEmptyString)(result)) {
190
+ for (let i = 0; i < contentFields.length && !(0, core_1.isNonEmptyString)(result); i++) {
191
+ result = record[contentFields[i]];
192
+ }
193
+ }
194
+ return result;
195
+ };
196
+ exports.getRecordContentByContentFields = getRecordContentByContentFields;
197
+ const getRecordContent = (record, settings) => {
198
+ if (!(0, core_1.isObject)(record))
199
+ return "";
200
+ let result = "";
201
+ const includeSearchDisplay = settings?.includeSearchDisplay == true;
202
+ const maxLength = settings?.maxLength;
203
+ const entity = settings?.entity;
204
+ const contentFields = settings?.contentFields ??
205
+ entity?.contentFields ?? [
206
+ "description",
207
+ "note",
208
+ "detail",
209
+ "content",
210
+ "summary",
211
+ "introduction",
212
+ "abstract",
213
+ "title",
214
+ "subject",
215
+ "firstName",
216
+ "lastName",
217
+ "name"
218
+ ];
219
+ if ((0, core_1.isNonEmptyString)(record._ui?.highlight?.content)) {
220
+ result = record._ui?.highlight?.content;
221
+ }
222
+ if (includeSearchDisplay && !(0, core_1.isNonEmptyString)(result, true)) {
223
+ result = record.searchContent;
224
+ }
225
+ if (contentFields &&
226
+ (0, lodash_1.isArray)(contentFields) &&
227
+ !(0, core_1.isNonEmptyString)(result, true)) {
228
+ result = (0, exports.getRecordContentByContentFields)(record, contentFields);
229
+ }
230
+ if ((0, lodash_1.isNumber)(maxLength) &&
231
+ (0, core_1.isNonEmptyString)(result, true) &&
232
+ result.length > maxLength) {
233
+ result = `${result.substring(0, maxLength)} ...`;
234
+ }
235
+ return (0, core_1.isNonEmptyString)(result, true)
236
+ ? result.trim()
237
+ : settings?.emptyReturnUndefined
238
+ ? undefined
239
+ : "";
240
+ };
241
+ exports.getRecordContent = getRecordContent;
242
+ const getRecordAddress = (record, prefix) => {
243
+ if (!(0, core_1.isObject)(record))
244
+ return "";
245
+ const line1 = (0, core_1.isNonEmptyString)(record[`${prefix}Line1`])
246
+ ? record[`${prefix}Line1`]
247
+ : "";
248
+ const line2 = (0, core_1.isNonEmptyString)(record[`${prefix}Line2`])
249
+ ? record[`${prefix}Line2`]
250
+ : "";
251
+ const city = (0, core_1.isNonEmptyString)(record[`${prefix}City`])
252
+ ? record[`${prefix}City`]
253
+ : "";
254
+ const postalCode = (0, core_1.isNonEmptyString)(record[`${prefix}PostalCode`])
255
+ ? record[`${prefix}PostalCode`]
256
+ : "";
257
+ const state = (0, core_1.isNonEmptyString)(record[`${prefix}State`])
258
+ ? record[`${prefix}State`]
259
+ : "";
260
+ const country = (0, core_1.isNonEmptyString)(record[`${prefix}Country`])
261
+ ? record[`${prefix}Country`]
262
+ : "";
263
+ if ((line1.length > 0 &&
264
+ city.length > 0 &&
265
+ state.length > 0 &&
266
+ country.length > 0) ||
267
+ (postalCode.length > 0 && country.length > 0)) {
268
+ return `${line1} ${line2},${city},${state},${postalCode},${country}`;
269
+ }
270
+ return "";
271
+ };
272
+ exports.getRecordAddress = getRecordAddress;
273
+ const getRecordMedia = (record) => {
274
+ if (!(0, core_1.isObject)(record))
275
+ return "";
276
+ if ((0, core_1.isNonEmptyString)(record.media))
277
+ return record.media;
278
+ if ((0, core_1.isNonEmptyString)(record.photoUrl))
279
+ return record.photoUrl;
280
+ if (record.source && (0, core_1.isNonEmptyString)(record.source.photoUrl))
281
+ return record.source.photoUrl;
282
+ return "";
283
+ };
284
+ exports.getRecordMedia = getRecordMedia;
285
+ const getRecordFullName = (user, settings) => {
286
+ const { skipFullNameProp, skipNameProp, skipEmailProp } = settings ?? {};
287
+ if (!(0, core_1.isObject)(user))
288
+ return "";
289
+ const email = (0, core_1.isNonEmptyString)(user.email) ? user.email.trim() : "";
290
+ const name = (0, core_1.isNonEmptyString)(user.name) ? user.name.trim() : "";
291
+ let fullName = (0, core_1.isNonEmptyString)(user.fullName) && !skipFullNameProp
292
+ ? user.fullName.trim()
293
+ : "";
294
+ const firstName = (0, core_1.isNonEmptyString)(user.firstName)
295
+ ? user.firstName.trim()
296
+ : "";
297
+ const lastName = (0, core_1.isNonEmptyString)(user.lastName)
298
+ ? user.lastName.trim()
299
+ : "";
300
+ if (fullName.length == 0 ||
301
+ (firstName.length > 0 && lastName.length > 0) ||
302
+ (fullName.length > 0 && fullName == email)) {
303
+ fullName = `${firstName} ${lastName.length > 0 ? " " + lastName : ""}`.trim();
304
+ }
305
+ if (user.lcid === 2052)
306
+ fullName = fullName.replace(/ /g, "");
307
+ fullName = fullName.replace(/\s\s+/g, " ").trim();
308
+ if (!skipNameProp)
309
+ fullName = fullName.length > 0 ? fullName : name;
310
+ if (!skipEmailProp)
311
+ fullName = fullName.length > 0 ? fullName : email;
312
+ return fullName;
313
+ };
314
+ exports.getRecordFullName = getRecordFullName;
315
+ const getRecordEmailAddress = (record, emailOnly) => {
316
+ if ((0, core_1.isObject)(record) && (0, core_1.isEmail)(record.email)) {
317
+ const fullName = (0, exports.getRecordFullName)(record);
318
+ if ((0, core_1.isNonEmptyString)(fullName) && !emailOnly) {
319
+ return `${fullName} <${record.email}>`;
320
+ }
321
+ else {
322
+ return record.email;
323
+ }
324
+ }
325
+ return undefined;
326
+ };
327
+ exports.getRecordEmailAddress = getRecordEmailAddress;
328
+ const getRecordPageMetadata = (record, settings) => {
329
+ const result = {};
330
+ const recordDisplay = (0, exports.getRecordDisplay)(record);
331
+ if (!(0, core_1.isNonEmptyString)(recordDisplay)) {
332
+ result.title =
333
+ (0, core_1.isObject)(settings) && settings?.siteName
334
+ ? `${settings?.siteName} - ${(0, exports.getRecordAbstract)(record, {
335
+ maxLength: 64
336
+ })}`
337
+ : (0, exports.getRecordAbstract)(record, { maxLength: 64 });
338
+ }
339
+ else {
340
+ result.title =
341
+ (0, core_1.isObject)(settings) && settings?.siteName
342
+ ? `${settings?.siteName} - ${recordDisplay}`
343
+ : recordDisplay;
344
+ }
345
+ result.id = record.id;
346
+ result.description = (0, exports.getRecordAbstract)(record, { maxLength: 128 });
347
+ result.type = "article";
348
+ const media = (0, exports.getRecordMedia)(record);
349
+ if ((0, core_1.isNonEmptyString)(media))
350
+ result.image = media;
351
+ return result;
352
+ };
353
+ exports.getRecordPageMetadata = getRecordPageMetadata;
354
+ const applyRecordSlug = (record) => {
355
+ const curSlug = (0, exports.getRecordSlug)(record);
356
+ if (curSlug) {
357
+ if (!(0, lodash_1.isArray)(record.slugs))
358
+ record.slugs = [];
359
+ if (!(0, lodash_1.find)(record.slugs, (slug) => slug == curSlug)) {
360
+ record.slugs = (0, lodash_1.uniq)([...record.slugs, curSlug]);
361
+ }
362
+ record.slug = curSlug;
363
+ }
364
+ return record;
365
+ };
366
+ exports.applyRecordSlug = applyRecordSlug;
367
+ const getRecordSlug = (record) => {
368
+ if (!record.id)
369
+ return undefined;
370
+ const id = record.id;
371
+ let curSlug = (0, exports.getRecordDisplay)(record);
372
+ if ((0, core_1.isNonEmptyString)(record.customSlug)) {
373
+ curSlug = record.customSlug;
374
+ }
375
+ curSlug = (0, slug_1.slug)(curSlug ?? id)?.substring(0, 128);
376
+ curSlug = `${curSlug}-${id.split("-")[1]}`;
377
+ return curSlug;
378
+ };
379
+ exports.getRecordSlug = getRecordSlug;
380
+ const getRecordFilePath = (props) => {
381
+ const { solutionId, organizationId, recordId, entityName } = props;
382
+ const fieldName = props.fieldName ?? "file";
383
+ return `${solutionId}/${organizationId}/${entityName}/${recordId}/${fieldName}`;
384
+ };
385
+ exports.getRecordFilePath = getRecordFilePath;
386
+ const getContextFromRecord = (record) => {
387
+ const { solutionId, domain, sourceIp, userId, organizationId, user, organization, solution, error, log, aiServices, stage } = record;
388
+ return {
389
+ solutionId,
390
+ domain,
391
+ sourceIp,
392
+ userId,
393
+ organizationId,
394
+ user,
395
+ organization,
396
+ solution,
397
+ error,
398
+ log,
399
+ aiServices,
400
+ stage
401
+ };
402
+ };
403
+ exports.getContextFromRecord = getContextFromRecord;
404
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,mCAAkE;AAClE,iCAA6D;AAC7D,iCAA8B;AAC9B,iCAAiC;AAG1B,MAAM,sBAAsB,GAAG,CAAC,MAA2B,EAAE,EAAE;IAClE,MAAM,SAAS,GAAG,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC,SAAS,CAAC;IAC3B,OAAO,SAAS,CAAC,SAAS,CAAC;IAC3B,OAAO,SAAS,CAAC,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AAI,EACJ,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,GAAG,EACH,UAAU,EACV,KAAK,EACR,GAAG,MAAM,CAAC;IACX,OAAO;QACH,UAAU;QACV,MAAM;QACN,QAAQ;QACR,MAAM;QACN,cAAc;QACd,IAAI;QACJ,YAAY;QACZ,QAAQ;QACR,KAAK;QACL,GAAG;QACH,UAAU;QACV,KAAK;KACR,CAAC;AACN,CAAC,CAAC;AA7BW,QAAA,oBAAoB,wBA6B/B"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @fileoverview Short identifier generation utilities for creating compact, URL-safe unique identifiers
3
+ * @copyright PrimeObjects Software Inc. (C) 2024 All Rights Reserved
4
+ * @author EncodeAgent Team.
5
+ * @copyright © 2024 PrimeObjects Software Inc. All rights reserved.
6
+ * @license Proprietary - Subject to PrimeObjects License Agreements
7
+ * @contact encode.agent@primeobjects.com
8
+ * @website https://www.encodeagent.com/
9
+ *
10
+ * This software contains proprietary and confidential information of
11
+ * PrimeObjects Software Inc. Any reproduction or distribution of this
12
+ * software, in whole or in part, without written permission of
13
+ * PrimeObjects Software Inc. is strictly prohibited.
14
+ *
15
+ * Unauthorized copying of this file, via any medium, is strictly prohibited.
16
+ * This file is proprietary and confidential.
17
+ */
18
+ /**
19
+ * Settings for short ID generation
20
+ * @interface ShortIdSettings
21
+ */
22
+ interface ShortIdSettings {
23
+ /** Keep periods in the generated ID */
24
+ keepPeriod?: boolean;
25
+ /** Keep underscores in the generated ID */
26
+ keepUnderscore?: boolean;
27
+ /** Keep pipe characters in the generated ID */
28
+ keepPipe?: boolean;
29
+ /** Keep spaces in the generated ID */
30
+ keepSpace?: boolean;
31
+ }
32
+ /**
33
+ * Generates a new short ID with customizable character replacement
34
+ * @param {ShortIdSettings} [settings] - Configuration for character handling
35
+ * @returns {string} A new short ID string
36
+ * @example
37
+ * const id = newShortId(); // "Hk-3TI8lg"
38
+ * const idWithPeriods = newShortId({ keepPeriod: true }); // "Hk.3TI8lg"
39
+ */
40
+ export declare const newShortId: (settings?: ShortIdSettings) => string;
41
+ export {};
42
+ //# sourceMappingURL=shortid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortid.d.ts","sourceRoot":"","sources":["../src/shortid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;GAGG;AACH,UAAU,eAAe;IACrB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,eAAe,KAAG,MAOvD,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Short identifier generation utilities for creating compact, URL-safe unique identifiers
4
+ * @copyright PrimeObjects Software Inc. (C) 2024 All Rights Reserved
5
+ * @author EncodeAgent Team.
6
+ * @copyright © 2024 PrimeObjects Software Inc. All rights reserved.
7
+ * @license Proprietary - Subject to PrimeObjects License Agreements
8
+ * @contact encode.agent@primeobjects.com
9
+ * @website https://www.encodeagent.com/
10
+ *
11
+ * This software contains proprietary and confidential information of
12
+ * PrimeObjects Software Inc. Any reproduction or distribution of this
13
+ * software, in whole or in part, without written permission of
14
+ * PrimeObjects Software Inc. is strictly prohibited.
15
+ *
16
+ * Unauthorized copying of this file, via any medium, is strictly prohibited.
17
+ * This file is proprietary and confidential.
18
+ */
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.newShortId = void 0;
24
+ const shortid_1 = __importDefault(require("shortid"));
25
+ /**
26
+ * Generates a new short ID with customizable character replacement
27
+ * @param {ShortIdSettings} [settings] - Configuration for character handling
28
+ * @returns {string} A new short ID string
29
+ * @example
30
+ * const id = newShortId(); // "Hk-3TI8lg"
31
+ * const idWithPeriods = newShortId({ keepPeriod: true }); // "Hk.3TI8lg"
32
+ */
33
+ const newShortId = (settings) => {
34
+ const v = shortid_1.default.generate();
35
+ return v
36
+ .replace(/\./g, settings?.keepPeriod ? "." : "-")
37
+ .replace(/\ /g, settings?.keepSpace ? " " : "-")
38
+ .replace(/\|/g, settings?.keepPipe ? "|" : "-")
39
+ .replace(new RegExp(`( ){2,}`, "g"), "-");
40
+ };
41
+ exports.newShortId = newShortId;
42
+ //# sourceMappingURL=shortid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortid.js","sourceRoot":"","sources":["../src/shortid.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;AAEH,sDAA8B;AAiB9B;;;;;;;GAOG;AACI,MAAM,UAAU,GAAG,CAAC,QAA0B,EAAU,EAAE;IAC7D,MAAM,CAAC,GAAG,iBAAO,CAAC,QAAQ,EAAE,CAAC;IAC7B,OAAO,CAAC;SACH,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;SAChD,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;SAC/C,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;SAC9C,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC,CAAC;AAPW,QAAA,UAAU,cAOrB"}
package/dist/slug.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @fileoverview URL-friendly slug generation utilities for creating clean, SEO-optimized identifiers from text strings
3
+ * @copyright PrimeObjects Software Inc. (C) 2024 All Rights Reserved
4
+ * @author EncodeAgent Team.
5
+ * @copyright © 2024 PrimeObjects Software Inc. All rights reserved.
6
+ * @license Proprietary - Subject to PrimeObjects License Agreements
7
+ * @contact encode.agent@primeobjects.com
8
+ * @website https://www.encodeagent.com/
9
+ *
10
+ * This software contains proprietary and confidential information of
11
+ * PrimeObjects Software Inc. Any reproduction or distribution of this
12
+ * software, in whole or in part, without written permission of
13
+ * PrimeObjects Software Inc. is strictly prohibited.
14
+ *
15
+ * Unauthorized copying of this file, via any medium, is strictly prohibited.
16
+ * This file is proprietary and confidential.
17
+ */
18
+ export declare const slug: (text: string, settings?: {
19
+ keepPeriod?: boolean;
20
+ keepUnderscore?: boolean;
21
+ keepPipe?: boolean;
22
+ keepSpace?: boolean;
23
+ }) => string | undefined;
24
+ //# sourceMappingURL=slug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../src/slug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,eAAO,MAAM,IAAI,GACb,MAAM,MAAM,EACZ,WAAU;IACN,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CAClB,KACP,MAAM,GAAG,SAkBX,CAAC"}