@komaci/common-shared 240.1.4 → 242.0.0

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.
package/build/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -13,6 +13,8 @@
13
13
  "ApexPageTrusted",
14
14
  "ApexPages",
15
15
  "ApexUITest",
16
+ "AtonitMktplceQA",
17
+ "Atonit_Mktplace",
16
18
  "Aura",
17
19
  "AuraDocs",
18
20
  "AuraIde",
@@ -303,6 +305,7 @@
303
305
  "commerce_checkout",
304
306
  "commerce_console",
305
307
  "commerce_dx_sampleapp",
308
+ "commerce_extension",
306
309
  "commerce_my_account",
307
310
  "commerce_ordermanagement",
308
311
  "commerce_ordersummary",
@@ -355,6 +358,7 @@
355
358
  "dataweave",
356
359
  "deployToDb",
357
360
  "designtime_cdp",
361
+ "designtime_d360_p13n",
358
362
  "designtime_journeys",
359
363
  "desktopDashboards",
360
364
  "devopsimpkg1",
@@ -372,6 +376,10 @@
372
376
  "devopsimpkg20",
373
377
  "devopsimpkg21",
374
378
  "devopsimpkg22",
379
+ "devopsimpkg23",
380
+ "devopsimpkg24",
381
+ "devopsimpkg25",
382
+ "devopsimpkg26",
375
383
  "devopsimpkg27",
376
384
  "devopsimpkg28",
377
385
  "devopsimpkg29",
@@ -430,6 +438,7 @@
430
438
  "experience",
431
439
  "experience_availability",
432
440
  "experience_einstein",
441
+ "experience_incident_mgmt",
433
442
  "experience_messaging",
434
443
  "explainability_setup",
435
444
  "externalServicesSetup",
@@ -613,6 +622,7 @@
613
622
  "mcontent_property_editor",
614
623
  "mcontent_workspace",
615
624
  "mfa_assistant",
625
+ "mobileBuilder",
616
626
  "mobile_setup",
617
627
  "mulesoft_citizen",
618
628
  "networkspulse",
@@ -685,6 +695,7 @@
685
695
  "runtime_hcc_scalecenter",
686
696
  "runtime_hello_studio",
687
697
  "runtime_hybrid_capabilities",
698
+ "runtime_incident_mgmt_components",
688
699
  "runtime_industries_actionablelist",
689
700
  "runtime_industries_actionplan",
690
701
  "runtime_industries_aiaccelerator",
@@ -711,6 +722,7 @@
711
722
  "runtime_industries_recurrence_impl",
712
723
  "runtime_industries_referralscoring",
713
724
  "runtime_industries_retailexecution",
725
+ "runtime_industries_serviceprocess",
714
726
  "runtime_industries_smartselling",
715
727
  "runtime_industries_smarttags",
716
728
  "runtime_industries_sustainability",
@@ -722,6 +734,7 @@
722
734
  "runtime_marketing_btobma",
723
735
  "runtime_marketing_litmuspreview",
724
736
  "runtime_marketing_shared",
737
+ "runtime_marketing_unifiedmarketing",
725
738
  "runtime_mc2",
726
739
  "runtime_media_adsales",
727
740
  "runtime_mobilesapp",
@@ -795,6 +808,7 @@
795
808
  "runtime_slack_block",
796
809
  "runtime_workdotcom_qmgmt",
797
810
  "rypple_corp",
811
+ "sales_bots",
798
812
  "sales_channel",
799
813
  "salesforceKomaci",
800
814
  "sbaa",
@@ -802,6 +816,7 @@
802
816
  "sbaa2",
803
817
  "scrt",
804
818
  "scrt_setup",
819
+ "se_included_flow",
805
820
  "search_dialog",
806
821
  "search_filters",
807
822
  "search_instrumentation",
@@ -854,6 +869,7 @@
854
869
  "setup_industries_tpm",
855
870
  "setup_industries_vertical_integration",
856
871
  "setup_lightning_visualforce",
872
+ "setup_marketing_unifiedmarketing",
857
873
  "setup_mc2",
858
874
  "setup_mobile_appclone",
859
875
  "setup_mobile_security",
@@ -922,6 +938,7 @@
922
938
  "sfdc_comm_admin",
923
939
  "sfdc_enablement",
924
940
  "sfdc_fieldservice",
941
+ "sfdc_gantt",
925
942
  "sfdc_payments_console",
926
943
  "sfdc_surveys",
927
944
  "sfdc_tableau_viz",
@@ -0,0 +1,38 @@
1
+ import { KomaciDocument } from 'packages/@komaci/types/build';
2
+ import { ModuleMetadata } from './types';
3
+ /**
4
+ * establish a base object for module metadata
5
+ * @returns A structured object for module metadata
6
+ */
7
+ export declare const initModuleMetadataObject: () => ModuleMetadata;
8
+ /**
9
+ *
10
+ * @param doc the KomaciDocument itself
11
+ * @param moduleMetadata data structure representing metadata about the module we are working on
12
+ */
13
+ export declare const initializeImportMetdataFromKomaciDocument: (doc: KomaciDocument, moduleMetadata: ModuleMetadata) => void;
14
+ /**
15
+ * From a given adg, collect as much metadata as possible ONLY from the komaci document
16
+ *
17
+ * This would include:
18
+ * - property initialization (any info we can collect ONLY from the komaci document)
19
+ * - function initialization
20
+ * - default generation name setup
21
+ * @param docAdgIndex the index of the adg in the KomaciDocument
22
+ * @param doc the KomaciDocument itself
23
+ * @param moduleMetadata data structure representing metadata about the module we are working on
24
+ */
25
+ export declare const initalizeAdgMetadata: (docAdgIndex: number, doc: KomaciDocument, moduleMetadata: ModuleMetadata) => void;
26
+ /**
27
+ * Update exports key in module metadata mapping the export name to associated adg object
28
+ * @param doc the KomaciDocument itself
29
+ * @param moduleMetadata data structure representing metadata about the module we are working on
30
+ */
31
+ export declare const mapExportNamesToAdgs: (doc: KomaciDocument, moduleMetadata: ModuleMetadata) => void;
32
+ /**
33
+ * Walk the compositions to see what props are being used, add this information to the adg metadata
34
+ * @param doc the KomaciDocument itself
35
+ * @param moduleMetadata data structure representing metadata about the module we are working on
36
+ */
37
+ export declare const addTemplateUsageForDefaultAdg: (doc: KomaciDocument, moduleMetadata: ModuleMetadata) => void;
38
+ //# sourceMappingURL=moduleMetadata.d.ts.map
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addTemplateUsageForDefaultAdg = exports.mapExportNamesToAdgs = exports.initalizeAdgMetadata = exports.initializeImportMetdataFromKomaciDocument = exports.initModuleMetadataObject = void 0;
4
+ /**
5
+ * establish a base object for module metadata
6
+ * @returns A structured object for module metadata
7
+ */
8
+ const initModuleMetadataObject = () => ({
9
+ importsByNamespace: new Map(),
10
+ importsByName: new Map(),
11
+ importIndexReference: new Map(),
12
+ adgs: [],
13
+ exports: {},
14
+ });
15
+ exports.initModuleMetadataObject = initModuleMetadataObject;
16
+ /**
17
+ *
18
+ * @param doc the KomaciDocument itself
19
+ * @param moduleMetadata data structure representing metadata about the module we are working on
20
+ */
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const initializeImportMetdataFromKomaciDocument = (doc, moduleMetadata) => {
23
+ // to be implemented
24
+ };
25
+ exports.initializeImportMetdataFromKomaciDocument = initializeImportMetdataFromKomaciDocument;
26
+ /**
27
+ * From a given adg, collect as much metadata as possible ONLY from the komaci document
28
+ *
29
+ * This would include:
30
+ * - property initialization (any info we can collect ONLY from the komaci document)
31
+ * - function initialization
32
+ * - default generation name setup
33
+ * @param docAdgIndex the index of the adg in the KomaciDocument
34
+ * @param doc the KomaciDocument itself
35
+ * @param moduleMetadata data structure representing metadata about the module we are working on
36
+ */
37
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
+ const initalizeAdgMetadata = (docAdgIndex, doc, moduleMetadata) => {
39
+ // if the moduleMetadata already has info about this adg we can assume we've shaken up this path of the tree already.
40
+ // pull in processing that is currently in komaciDocIntrospection
41
+ // we should walk the tree from this adg, processing properties, functions, parent ADGs
42
+ };
43
+ exports.initalizeAdgMetadata = initalizeAdgMetadata;
44
+ /**
45
+ * Update exports key in module metadata mapping the export name to associated adg object
46
+ * @param doc the KomaciDocument itself
47
+ * @param moduleMetadata data structure representing metadata about the module we are working on
48
+ */
49
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
50
+ const mapExportNamesToAdgs = (doc, moduleMetadata) => {
51
+ // to implement
52
+ };
53
+ exports.mapExportNamesToAdgs = mapExportNamesToAdgs;
54
+ /**
55
+ * Walk the compositions to see what props are being used, add this information to the adg metadata
56
+ * @param doc the KomaciDocument itself
57
+ * @param moduleMetadata data structure representing metadata about the module we are working on
58
+ */
59
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
60
+ const addTemplateUsageForDefaultAdg = (doc, moduleMetadata) => {
61
+ // to implement
62
+ };
63
+ exports.addTemplateUsageForDefaultAdg = addTemplateUsageForDefaultAdg;
64
+ //# sourceMappingURL=moduleMetadata.js.map
package/build/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NodePath } from '@babel/traverse';
2
2
  import * as t from '@babel/types';
3
- import { PrimitiveValue, PropertyReference, UnresolvedValue, ImportReference as KomaciDocImportReference, Binding } from '@komaci/types';
3
+ import { PrimitiveValue, PropertyReference, UnresolvedValue, ImportReference as KomaciDocImportReference, Binding, KomaciDocument, FunctionType } from '@komaci/types';
4
4
  /**
5
5
  * @typedef ClassPropertyInfo is an object that holds information about a class property
6
6
  * @property {t.ClassProperty | t.ClassMethod | NodePath<t.ClassProperty | t.ClassMethod>} classProp is the class property babel object.
@@ -129,6 +129,8 @@ export declare type BasePropertyContext = {
129
129
  type: PropertyTypes;
130
130
  /** If this property is used in priming through wires, compositions or implicitly through a getter */
131
131
  usedInPriming: boolean;
132
+ /** Reference which adg this property is defined in */
133
+ fromAdg?: string;
132
134
  };
133
135
  /**
134
136
  * Added metadata specifically for wire properties
@@ -152,11 +154,27 @@ export declare type ImportPropertyContext = BasePropertyContext & {
152
154
  export declare type ImportMetadata = {
153
155
  /** The name of the import as defined in the import object on komaci doc */
154
156
  name: string;
157
+ /** The alias set for an import in the original module. i.e. `import { item as importAlias } from 'importPath'` */
158
+ importAlias?: string;
159
+ /** alias generated for the import as part of resolvable module composition. */
160
+ generatorAlias?: string;
155
161
  /** The name of the import namespace as defined in the import object on komaci doc */
156
162
  resourceName: string;
157
163
  /** The referential id for this import. i.e. 0/names/0 */
158
164
  komaciDocImportRef: string;
165
+ /** flag representing if this import is from a namespace we support */
166
+ isFromInternalNamespace?: boolean;
167
+ /** flag representing if the import is from a library we support (used for pure functions i.e. getters and template string inflation) */
168
+ isFromSupportedLibrary?: boolean;
169
+ /** flag representing if this import is used as part of priming (in a wire, as part of a pure function, initial value, etc) */
170
+ usedInPriming?: boolean;
171
+ /**
172
+ * component id for if this import maps to a component used in a template
173
+ * this is only managed as part of processTemplateImports
174
+ */
175
+ componentId?: string;
159
176
  };
177
+ export declare type ImportIndexReference = Record<string, ImportMetadata>;
160
178
  /**
161
179
  * Map for all class properties and their basic, KomaciDoc analyzable metadata.
162
180
  *
@@ -190,4 +208,66 @@ export declare type ModuleContext = {
190
208
  astContext: AstContext;
191
209
  isExternal: boolean;
192
210
  };
211
+ /** types of nodes */
212
+ export declare enum FunctionTypes {
213
+ WIRE_FUNCTION = "WireFunction",
214
+ PRIMING_FUNCTION = "PrimingFunction",
215
+ GETTER_FUNCTION = "GetterFunction",
216
+ TEMPLATE_STRING = "TemplateStringFunction"
217
+ }
218
+ /**
219
+ * Basic information needed by all function nodes
220
+ */
221
+ export declare type BaseFunctionMetadata = {
222
+ input?: FunctionType['input'];
223
+ type: FunctionTypes;
224
+ requiredProperties: string[];
225
+ generatedName: string;
226
+ };
227
+ /**
228
+ * Metadata for a wire function
229
+ */
230
+ export declare type WireFunctionMetadata = BaseFunctionMetadata & {
231
+ type: FunctionTypes.WIRE_FUNCTION | FunctionTypes.PRIMING_FUNCTION;
232
+ /** context object to pass through to function node */
233
+ context: Record<string, string>;
234
+ };
235
+ /**
236
+ * Metadata for a hoisted function type. Currently this is Getter functions and Template String Functions.
237
+ */
238
+ export declare type HoistedFunctionMetadata = BaseFunctionMetadata & {
239
+ type: FunctionTypes.GETTER_FUNCTION | FunctionTypes.TEMPLATE_STRING;
240
+ /** ast node from the original component source */
241
+ componentAstNode?: t.ClassProperty | t.ClassMethod;
242
+ };
243
+ /**
244
+ * Union of possible function types
245
+ */
246
+ export declare type FunctionMetadata = HoistedFunctionMetadata | WireFunctionMetadata;
247
+ export declare type AdgMetadata = {
248
+ /** basic generated name for references from other adg. can be overriden if the adg is an export */
249
+ defaultGeneratedName: string;
250
+ /** the name given to this adg when exported */
251
+ exportName?: string;
252
+ /** list of properties used by the associated template */
253
+ propertiesUsedInTemplate: string[];
254
+ /** compositions uplifted from template komaci document */
255
+ compositions: KomaciDocument['compositions'];
256
+ /** properties consumable by this adg */
257
+ properties: Map<string, ClassPropertyContext>;
258
+ /** functions defined in this adg */
259
+ functions: FunctionMetadata[];
260
+ /** reference to the index in the adg array for the parent adg */
261
+ parentReference?: number;
262
+ };
263
+ /**
264
+ * Complete structure of Metadata needed to compose a resolvable module
265
+ */
266
+ export declare type ModuleMetadata = {
267
+ importsByNamespace: ConsumedImports;
268
+ importsByName: Map<string, ImportMetadata>;
269
+ importIndexReference: Map<string, string>;
270
+ adgs: AdgMetadata[];
271
+ exports: Record<string, AdgMetadata>;
272
+ };
193
273
  //# sourceMappingURL=types.d.ts.map
package/build/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PropertyTypes = void 0;
3
+ exports.FunctionTypes = exports.PropertyTypes = void 0;
4
4
  /**
5
5
  * Possbile types of properties we can encounter in a LWC
6
6
  */
@@ -13,4 +13,12 @@ var PropertyTypes;
13
13
  PropertyTypes["IMPORT_REFERENCE"] = "importReference";
14
14
  PropertyTypes["TEMPLATE_STRING"] = "templateString";
15
15
  })(PropertyTypes = exports.PropertyTypes || (exports.PropertyTypes = {}));
16
+ /** types of nodes */
17
+ var FunctionTypes;
18
+ (function (FunctionTypes) {
19
+ FunctionTypes["WIRE_FUNCTION"] = "WireFunction";
20
+ FunctionTypes["PRIMING_FUNCTION"] = "PrimingFunction";
21
+ FunctionTypes["GETTER_FUNCTION"] = "GetterFunction";
22
+ FunctionTypes["TEMPLATE_STRING"] = "TemplateStringFunction";
23
+ })(FunctionTypes = exports.FunctionTypes || (exports.FunctionTypes = {}));
16
24
  //# sourceMappingURL=types.js.map
package/build/utils.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import * as t from '@babel/types';
2
2
  import { NodePath } from '@babel/core';
3
- import { AstContext, ClassPropertyContext, ClassPropertyContexts, ClassPropertyInfo, ClassPropertyNodes, ConsumedImports, ImplicitConsumption, ImportDeclarationInfo, ImportDeclarations, ModuleLevelConsumption } from './types';
3
+ import { AstContext, ClassPropertyContext, ClassPropertyContexts, ClassPropertyInfo, ClassPropertyNodes, ConsumedImports, ImplicitConsumption, ImportDeclarationInfo, ImportDeclarations, ModuleLevelConsumption, ValidGetterContext, ValidTemplateContext } from './types';
4
+ import { FunctionType, KomaciDocument, Adg } from '@komaci/types';
4
5
  export declare const LIGHTNING_NS = "lightning";
5
6
  export declare const FORCE_NS = "force";
6
7
  export declare const ONE_NS = "one";
8
+ export declare const GETTER_FUNCTION = "GetterFunction";
9
+ export declare const TEMPLATED_STRING_FUNCTION = "TemplatedStringFunction";
7
10
  /**
8
11
  * collect node paths for different pieces of a given class so we can more effectively traverse them in the future
9
12
  *
@@ -150,4 +153,24 @@ export declare function isExpressionThisOrAlias(aliases: Set<string>, expr: t.Ex
150
153
  * @param id the id of the member we are referencing.
151
154
  */
152
155
  export declare function isDeclaredInAst(astContext: AstContext, declaredGetterVars: string[], id: string): boolean;
156
+ /**
157
+ * Function to update the Komaci Document with validated getter information. This function will update the functions array in the
158
+ * export default adg along with the property references in the property array.
159
+ * @param komaciScriptDoc the komaci document
160
+ * @param validGetterContext a collection
161
+ */
162
+ export declare function updateKomaciDocumentWithValidGetters(komaciScriptDoc: KomaciDocument, validGetterContext: ValidGetterContext[]): void;
163
+ /**
164
+ * Function to update the Komaci Document with validated template information. This function will update the functions array in the
165
+ * export default adg along with the property references in the property array.
166
+ * @param komaciScriptDoc the komaci document
167
+ * @param ValidTemplateContext details about the templates we've deemed to be valid
168
+ */
169
+ export declare function updateKomaciDocumentWithValidTemplatedStrings(komaciScriptDoc: KomaciDocument, templateStrings: ValidTemplateContext[]): void;
170
+ /**
171
+ * Update the functions array with the newly formed function reference and point the property to it
172
+ * @param adg The adg to update
173
+ * @param propertyName name of the property to update
174
+ */
175
+ export declare function addPropertyFunction(adg: Adg, propertyName: string, func: FunctionType): number;
153
176
  //# sourceMappingURL=utils.d.ts.map
package/build/utils.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -19,13 +23,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
23
  return result;
20
24
  };
21
25
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.isDeclaredInAst = exports.isExpressionThisOrAlias = exports.getThisAliasDeclaredInGetter = exports.isPropertyNodeUsed = exports.isGetterNodeUsed = exports.isPropertyUsed = exports.getClassMethodName = exports.getVariablesDeclaredInGetter = exports.isExternalModule = exports.getAstContextObject = exports.getAllClassMethods = exports.getAllModuleVaraibles = exports.getAllModuleFunctions = exports.getAllImportReferences = exports.getFromIdentifierOrStringLiteral = exports.collectImportUsage = exports.getMemberVarsFromGetter = exports.implicitConsumptionMetadata = exports.getClassPropertyInfos = exports.getClassProperties = exports.getPropertyMetadataFromAst = exports.ONE_NS = exports.FORCE_NS = exports.LIGHTNING_NS = void 0;
26
+ exports.addPropertyFunction = exports.updateKomaciDocumentWithValidTemplatedStrings = exports.updateKomaciDocumentWithValidGetters = exports.isDeclaredInAst = exports.isExpressionThisOrAlias = exports.getThisAliasDeclaredInGetter = exports.isPropertyNodeUsed = exports.isGetterNodeUsed = exports.isPropertyUsed = exports.getClassMethodName = exports.getVariablesDeclaredInGetter = exports.isExternalModule = exports.getAstContextObject = exports.getAllClassMethods = exports.getAllModuleVaraibles = exports.getAllModuleFunctions = exports.getAllImportReferences = exports.getFromIdentifierOrStringLiteral = exports.collectImportUsage = exports.getMemberVarsFromGetter = exports.implicitConsumptionMetadata = exports.getClassPropertyInfos = exports.getClassProperties = exports.getPropertyMetadataFromAst = exports.TEMPLATED_STRING_FUNCTION = exports.GETTER_FUNCTION = exports.ONE_NS = exports.FORCE_NS = exports.LIGHTNING_NS = void 0;
23
27
  const t = __importStar(require("@babel/types"));
24
28
  const core_1 = require("@babel/core");
25
29
  const allowlistNamespaces_1 = require("./allowlistNamespaces");
26
30
  exports.LIGHTNING_NS = 'lightning';
27
31
  exports.FORCE_NS = 'force';
28
32
  exports.ONE_NS = 'one';
33
+ exports.GETTER_FUNCTION = 'GetterFunction';
34
+ exports.TEMPLATED_STRING_FUNCTION = 'TemplatedStringFunction';
29
35
  /**
30
36
  * collect node paths for different pieces of a given class so we can more effectively traverse them in the future
31
37
  *
@@ -551,4 +557,115 @@ function isDeclaredInAst(astContext, declaredGetterVars, id) {
551
557
  (declaredGetterVars || []).find((varId) => varId === id) !== undefined);
552
558
  }
553
559
  exports.isDeclaredInAst = isDeclaredInAst;
560
+ /**
561
+ * Function to update the Komaci Document with validated getter information. This function will update the functions array in the
562
+ * export default adg along with the property references in the property array.
563
+ * @param komaciScriptDoc the komaci document
564
+ * @param validGetterContext a collection
565
+ */
566
+ function updateKomaciDocumentWithValidGetters(komaciScriptDoc, validGetterContext) {
567
+ if (komaciScriptDoc.exports) {
568
+ //get the exort mapping for the export default
569
+ const defaultExportMapping = komaciScriptDoc.exports['default'];
570
+ if (defaultExportMapping && defaultExportMapping.type === 'AdgReference') {
571
+ const defaultExportAdg = komaciScriptDoc.adgs?.[defaultExportMapping.value];
572
+ //foreach getter in the context.
573
+ validGetterContext.forEach((getter) => {
574
+ //Get the name of the getter.
575
+ const getterName = getter.getter.node.key.name;
576
+ const inputArr = {
577
+ type: 'ArrayValue',
578
+ value: [],
579
+ };
580
+ getter.memberUsage.forEach((member) => {
581
+ const primVal = {
582
+ type: 'PrimitiveValue',
583
+ value: member,
584
+ };
585
+ inputArr.value.push(primVal);
586
+ });
587
+ //create a new functionType obj with getter information.
588
+ const validGetterFunction = {
589
+ type: exports.GETTER_FUNCTION,
590
+ reference: { type: 'InternalReference', value: getter.generatedName },
591
+ input: [inputArr],
592
+ location: undefined,
593
+ };
594
+ //if we have an adg make changes to it.
595
+ if (defaultExportAdg) {
596
+ getter.f_index = addPropertyFunction(defaultExportAdg, getterName, validGetterFunction);
597
+ }
598
+ });
599
+ }
600
+ }
601
+ }
602
+ exports.updateKomaciDocumentWithValidGetters = updateKomaciDocumentWithValidGetters;
603
+ /**
604
+ * Function to update the Komaci Document with validated template information. This function will update the functions array in the
605
+ * export default adg along with the property references in the property array.
606
+ * @param komaciScriptDoc the komaci document
607
+ * @param ValidTemplateContext details about the templates we've deemed to be valid
608
+ */
609
+ function updateKomaciDocumentWithValidTemplatedStrings(komaciScriptDoc, templateStrings) {
610
+ if (komaciScriptDoc.exports?.default?.type === 'AdgReference') {
611
+ const adg = komaciScriptDoc.adgs?.[komaciScriptDoc.exports.default.value];
612
+ if (adg) {
613
+ templateStrings.forEach((template) => {
614
+ const propertyName = template.template.node.key.name;
615
+ const inputArr = {
616
+ type: 'ArrayValue',
617
+ value: [],
618
+ };
619
+ template.memberUsage.forEach((member) => {
620
+ const primVal = {
621
+ type: 'PrimitiveValue',
622
+ value: member,
623
+ };
624
+ inputArr.value.push(primVal);
625
+ });
626
+ const validTemplateStringFunction = {
627
+ type: exports.TEMPLATED_STRING_FUNCTION,
628
+ reference: {
629
+ type: 'InternalReference',
630
+ value: template.generatedName,
631
+ },
632
+ input: [inputArr],
633
+ location: undefined,
634
+ };
635
+ //if we have an adg make changes to it.
636
+ if (adg) {
637
+ template.f_index = addPropertyFunction(adg, propertyName, validTemplateStringFunction);
638
+ }
639
+ });
640
+ }
641
+ }
642
+ }
643
+ exports.updateKomaciDocumentWithValidTemplatedStrings = updateKomaciDocumentWithValidTemplatedStrings;
644
+ /**
645
+ * Update the functions array with the newly formed function reference and point the property to it
646
+ * @param adg The adg to update
647
+ * @param propertyName name of the property to update
648
+ */
649
+ function addPropertyFunction(adg, propertyName, func) {
650
+ if (!adg.functions) {
651
+ adg.functions = [];
652
+ }
653
+ if (!adg.properties) {
654
+ adg.properties = {};
655
+ }
656
+ //push getter onto array get the length.
657
+ const fIndex = adg.functions.push(func);
658
+ const refIndex = fIndex - 1;
659
+ //create new property to reference function array.
660
+ const property = {
661
+ isPublic: adg.properties[propertyName]?.isPublic || false,
662
+ input: {
663
+ type: 'FunctionReference',
664
+ value: refIndex,
665
+ },
666
+ };
667
+ adg.properties[propertyName] = property;
668
+ return refIndex;
669
+ }
670
+ exports.addPropertyFunction = addPropertyFunction;
554
671
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@komaci/common-shared",
3
- "version": "240.1.4",
3
+ "version": "242.0.0",
4
4
  "description": "Assets that are shared across Komaci commonjs packages",
5
5
  "homepage": "https://komaci.dev/",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "build/internal-namespaces.json"
29
29
  ],
30
30
  "devDependencies": {
31
- "@komaci/types": "240.1.4"
31
+ "@komaci/types": "242.0.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/core": "^7.9.0",