@esri/solution-common 6.6.1-next.80 → 6.6.1-next.81
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.
|
@@ -164,9 +164,12 @@ export declare function getLayerSettings(layerInfos: any, url: string, itemId: s
|
|
|
164
164
|
* The feature service name will have a generated GUID appended.
|
|
165
165
|
*
|
|
166
166
|
* @param templates A collection of AGO item templates.
|
|
167
|
+
* @param templateDictionary Optional hash of values used to resolve `{{...}}` tokens in the name
|
|
168
|
+
* before applying the 50-char base-name limit. When omitted, names containing unresolved tokens
|
|
169
|
+
* are passed through untruncated (legacy behavior).
|
|
167
170
|
* @returns An updated collection of AGO templates with unique feature service names.
|
|
168
171
|
*/
|
|
169
|
-
export declare function setNamesAndTitles(templates: IItemTemplate[]): IItemTemplate[];
|
|
172
|
+
export declare function setNamesAndTitles(templates: IItemTemplate[], templateDictionary?: any): IItemTemplate[];
|
|
170
173
|
/**
|
|
171
174
|
* This is used when deploying views.
|
|
172
175
|
* We need to update fields referenced in adminLayerInfo for relationships prior to deploying the view.
|
|
@@ -243,6 +246,28 @@ export declare function getExistingLayersAndTables(url: string, ids: number[], a
|
|
|
243
246
|
* @private
|
|
244
247
|
*/
|
|
245
248
|
export declare function addFeatureServiceLayersAndTables(itemTemplate: IItemTemplate, templateDictionary: any, popupInfos: IPopupInfos, authentication: UserSession): Promise<void>;
|
|
249
|
+
/**
|
|
250
|
+
* Shorten any layer or table name longer than `maxNameLength` to a unique value of at most
|
|
251
|
+
* `maxNameLength` characters, in preparation for an addToDefinition call, and report the original
|
|
252
|
+
* names so they can be restored afterward.
|
|
253
|
+
*
|
|
254
|
+
* Mutates the `name` of each over-long layer/table in `layerChunks` in place.
|
|
255
|
+
*
|
|
256
|
+
* @param layerChunks The addToDefinition chunks whose `layers` and `tables` will be added
|
|
257
|
+
* @param maxNameLength Names longer than this are truncated to a unique value of this length
|
|
258
|
+
* @returns The original names to restore, as `{ layers: [{ id, name }], tables: [{ id, name }] }`
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
export declare function _truncateNamesForAddToDefinition(layerChunks: any[], maxNameLength: number): {
|
|
262
|
+
layers: Array<{
|
|
263
|
+
id: any;
|
|
264
|
+
name: string;
|
|
265
|
+
}>;
|
|
266
|
+
tables: Array<{
|
|
267
|
+
id: any;
|
|
268
|
+
name: string;
|
|
269
|
+
}>;
|
|
270
|
+
};
|
|
246
271
|
/**
|
|
247
272
|
* Updates a feature service with a list of layers and/or tables.
|
|
248
273
|
*
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports._getLayerChunkSize = exports._getNameMapping = exports._templatizeDefinitionQuery = exports._templatizeTimeInfo = exports._templatizeKeys = exports._templatizeTypeTemplates = exports._templatizeTemplates = exports._templatizeLabelingInfo = exports._templatizeArcadeExpressions = exports._templatizeAuthoringInfo = exports._templatizeTemporalRenderer = exports._templatizeGenRenderer = exports._templatizeRenderer = exports._templatizeDrawingInfo = exports._templatizeSimpleName = exports._templatizeDefinitionExpression = exports._templatizeDefinitionEditor = exports._templatizeMediaInfos = exports._templatizePopupElements = exports._templatizeExpressionInfos = exports._templatizeFieldName = exports._templatizePopupInfoFieldInfos = exports._templatizeName = exports._templatizePopupInfo = exports._templatizeRelationshipFields = exports._templatizeTopFilter = exports._templatizeAdminSourceLayerFields = exports._getDependantItemId = exports._templatizeAdminLayerInfoFields = exports._templatizeSourceServiceName = exports._processAdminObject = exports._templatizeAdminLayerInfo = exports._templatizeLayerFieldReferences = void 0;
|
|
18
|
+
exports._validateTypesTemplates = exports._validateTemplatesFields = exports._validateIndexes = exports._validateDisplayField = exports._validateFields = exports._templatizeLayer = exports._templatizeProperty = exports._templatize = exports.updatePopupInfo = exports._validateViewDomainFields = exports.postProcessFields = exports.updateLayerFieldReferences = exports._getSourceSpatialReferenceAndExtent = exports.validateSpatialReferenceAndExtent = exports.setDefaultSpatialReference = exports._updateTemplateDictionaryFields = exports._updateGeomFieldName = exports._updateSourceLayerFields = exports._updateItemFields = exports._getDynamicFieldNames = exports._getFieldNames = exports._updateForPortal = exports.removeLayerOptimization = exports._isSelfReferential = exports._updateAddOptions = exports._updateOrder = exports.addFeatureServiceDefinition = exports._truncateNamesForAddToDefinition = exports.addFeatureServiceLayersAndTables = exports.getExistingLayersAndTables = exports.getLayersAndTables = exports.deTemplatizeFieldInfos = exports.processContingentValues = exports.updateTemplateForInvalidDesignations = exports.updateSettingsFieldInfos = exports.setNamesAndTitles = exports.getLayerSettings = exports._setTrackingViewLayerSettings = exports._updateTypeKeywords = exports.updateTemplate = exports.cacheLayerInfo = exports._cachePopupInfo = exports.cachePopupInfos = exports._cacheFieldInfo = exports.cacheIndexes = exports.cacheContingentValues = exports.cacheFieldInfos = exports.deleteViewProps = exports.templatize = exports.getFeatureServiceRelatedRecords = void 0;
|
|
19
|
+
exports._getLayerChunkSize = exports._getNameMapping = exports._templatizeDefinitionQuery = exports._templatizeTimeInfo = exports._templatizeKeys = exports._templatizeTypeTemplates = exports._templatizeTemplates = exports._templatizeLabelingInfo = exports._templatizeArcadeExpressions = exports._templatizeAuthoringInfo = exports._templatizeTemporalRenderer = exports._templatizeGenRenderer = exports._templatizeRenderer = exports._templatizeDrawingInfo = exports._templatizeSimpleName = exports._templatizeDefinitionExpression = exports._templatizeDefinitionEditor = exports._templatizeMediaInfos = exports._templatizePopupElements = exports._templatizeExpressionInfos = exports._templatizeFieldName = exports._templatizePopupInfoFieldInfos = exports._templatizeName = exports._templatizePopupInfo = exports._templatizeRelationshipFields = exports._templatizeTopFilter = exports._templatizeAdminSourceLayerFields = exports._getDependantItemId = exports._templatizeAdminLayerInfoFields = exports._templatizeSourceServiceName = exports._processAdminObject = exports._templatizeAdminLayerInfo = exports._templatizeLayerFieldReferences = exports._validateEditFieldsInfo = void 0;
|
|
20
20
|
/**
|
|
21
21
|
* Provides general helper functions.
|
|
22
22
|
*
|
|
@@ -445,9 +445,12 @@ exports.getLayerSettings = getLayerSettings;
|
|
|
445
445
|
* The feature service name will have a generated GUID appended.
|
|
446
446
|
*
|
|
447
447
|
* @param templates A collection of AGO item templates.
|
|
448
|
+
* @param templateDictionary Optional hash of values used to resolve `{{...}}` tokens in the name
|
|
449
|
+
* before applying the 50-char base-name limit. When omitted, names containing unresolved tokens
|
|
450
|
+
* are passed through untruncated (legacy behavior).
|
|
448
451
|
* @returns An updated collection of AGO templates with unique feature service names.
|
|
449
452
|
*/
|
|
450
|
-
function setNamesAndTitles(templates) {
|
|
453
|
+
function setNamesAndTitles(templates, templateDictionary) {
|
|
451
454
|
const guid = (0, generalHelpers_1.generateGUID)();
|
|
452
455
|
const names = [];
|
|
453
456
|
return templates.map((t) => {
|
|
@@ -461,12 +464,20 @@ function setNamesAndTitles(templates) {
|
|
|
461
464
|
let baseName = t.item.name || t.item.title;
|
|
462
465
|
// If the name already contains a GUID remove it
|
|
463
466
|
baseName = baseName.replace(/_[0-9A-F]{32}/gi, "");
|
|
464
|
-
//
|
|
465
|
-
//
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
// Resolve any {{...}} tokens (e.g. {{params.buildSolution.items.<id>.title}}) so the
|
|
468
|
+
// base-name length limit reflects the value AGOL will actually see at create time.
|
|
469
|
+
const resolvedBaseName = templateDictionary
|
|
470
|
+
? (0, templatization_1.replaceInTemplate)(baseName, templateDictionary)
|
|
471
|
+
: baseName;
|
|
472
|
+
// Limit the base name to 50 chars so the full service name (base + "_" + 32-char guid)
|
|
473
|
+
// stays within AGOL's service-name length limit. This 50-char cap is long-standing
|
|
474
|
+
// behavior. If unresolved {{...}} tokens remain we can't know the resolved length, so
|
|
475
|
+
// leave the name untruncated.
|
|
476
|
+
const maxBaseNameLength = 50;
|
|
477
|
+
const stillTemplatized = resolvedBaseName.includes("{{");
|
|
478
|
+
const name = stillTemplatized
|
|
479
|
+
? resolvedBaseName + "_" + guid
|
|
480
|
+
: resolvedBaseName.substring(0, maxBaseNameLength) + "_" + guid;
|
|
470
481
|
// If the name + GUID already exists then append "_occurrenceCount"
|
|
471
482
|
t.item.name = names.indexOf(name) === -1 ? name : `${name}_${names.filter((n) => n === name).length}`;
|
|
472
483
|
names.push(name);
|
|
@@ -747,6 +758,53 @@ function addFeatureServiceLayersAndTables(itemTemplate, templateDictionary, popu
|
|
|
747
758
|
});
|
|
748
759
|
}
|
|
749
760
|
exports.addFeatureServiceLayersAndTables = addFeatureServiceLayersAndTables;
|
|
761
|
+
/**
|
|
762
|
+
* Shorten any layer or table name longer than `maxNameLength` to a unique value of at most
|
|
763
|
+
* `maxNameLength` characters, in preparation for an addToDefinition call, and report the original
|
|
764
|
+
* names so they can be restored afterward.
|
|
765
|
+
*
|
|
766
|
+
* Mutates the `name` of each over-long layer/table in `layerChunks` in place.
|
|
767
|
+
*
|
|
768
|
+
* @param layerChunks The addToDefinition chunks whose `layers` and `tables` will be added
|
|
769
|
+
* @param maxNameLength Names longer than this are truncated to a unique value of this length
|
|
770
|
+
* @returns The original names to restore, as `{ layers: [{ id, name }], tables: [{ id, name }] }`
|
|
771
|
+
* @private
|
|
772
|
+
*/
|
|
773
|
+
function _truncateNamesForAddToDefinition(layerChunks, maxNameLength) {
|
|
774
|
+
const restore = {
|
|
775
|
+
layers: [],
|
|
776
|
+
tables: [],
|
|
777
|
+
};
|
|
778
|
+
const allItems = [];
|
|
779
|
+
layerChunks.forEach((chunk) => {
|
|
780
|
+
chunk.layers.forEach((layer) => allItems.push({ item: layer, isLayer: true }));
|
|
781
|
+
chunk.tables.forEach((table) => allItems.push({ item: table, isLayer: false }));
|
|
782
|
+
});
|
|
783
|
+
// Reserve names that are already short enough so the truncated names won't collide with them.
|
|
784
|
+
const usedNames = new Set();
|
|
785
|
+
allItems.forEach(({ item }) => {
|
|
786
|
+
if (item.name.length <= maxNameLength) {
|
|
787
|
+
usedNames.add(item.name.toLowerCase());
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
allItems.forEach(({ item, isLayer }) => {
|
|
791
|
+
if (item.name.length > maxNameLength) {
|
|
792
|
+
const originalName = item.name;
|
|
793
|
+
let candidate = originalName.substring(0, maxNameLength);
|
|
794
|
+
let counter = 1;
|
|
795
|
+
// Keep the truncated name unique by trimming room for a numeric suffix when needed.
|
|
796
|
+
while (usedNames.has(candidate.toLowerCase())) {
|
|
797
|
+
const suffix = `_${counter++}`;
|
|
798
|
+
candidate = originalName.substring(0, maxNameLength - suffix.length) + suffix;
|
|
799
|
+
}
|
|
800
|
+
usedNames.add(candidate.toLowerCase());
|
|
801
|
+
item.name = candidate;
|
|
802
|
+
(isLayer ? restore.layers : restore.tables).push({ id: item.id, name: originalName });
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
return restore;
|
|
806
|
+
}
|
|
807
|
+
exports._truncateNamesForAddToDefinition = _truncateNamesForAddToDefinition;
|
|
750
808
|
/**
|
|
751
809
|
* Updates a feature service with a list of layers and/or tables.
|
|
752
810
|
*
|
|
@@ -859,9 +917,30 @@ function addFeatureServiceDefinition(serviceUrl, listToAdd, templateDictionary,
|
|
|
859
917
|
// will use async by default rather than chunk the layer requests when we have more layers
|
|
860
918
|
// than the defined chunk size
|
|
861
919
|
const useAsync = listToAdd.length > chunkSize;
|
|
920
|
+
// Shorten any over-long layer/table names to short, unique values before adding them.
|
|
921
|
+
// Names will be restored afterward with one updateDefinition call per layer/table.
|
|
922
|
+
const maxBackingTableNameLength = 30;
|
|
923
|
+
const restoreNames = _truncateNamesForAddToDefinition(layerChunks, maxBackingTableNameLength);
|
|
924
|
+
// Base admin URL used for the per-layer updateDefinition restore calls below.
|
|
925
|
+
const adminServiceUrl = (0, generalHelpers_1.checkUrlPathTermination)(serviceUrl.replace("/rest/services", "/rest/admin/services"));
|
|
862
926
|
layerChunks
|
|
863
927
|
.reduce((prev, curr) => prev.then(() => (0, restHelpers_1.addToServiceDefinition)(serviceUrl, curr, false, useAsync)), Promise.resolve(null))
|
|
864
|
-
.then(() =>
|
|
928
|
+
.then(() => {
|
|
929
|
+
// Restore the original (pre-truncation) display names.
|
|
930
|
+
// I was seeing the updateDefinition call succeed but the names not being restored when I was doing this
|
|
931
|
+
// with a single call at the service endpoint. So now we are doing this sequentially.
|
|
932
|
+
const restoreItems = [...restoreNames.layers, ...restoreNames.tables];
|
|
933
|
+
restoreItems
|
|
934
|
+
.reduce((prev, entry) => prev.then(() => {
|
|
935
|
+
const restoreUpdate = {
|
|
936
|
+
url: adminServiceUrl + entry.id + "/updateDefinition",
|
|
937
|
+
params: { updateDefinition: { name: entry.name } },
|
|
938
|
+
args: { authentication },
|
|
939
|
+
};
|
|
940
|
+
return (0, restHelpers_1.getRequest)(restoreUpdate, false, false, templateDictionary.isPortal);
|
|
941
|
+
}), Promise.resolve(null))
|
|
942
|
+
.then(() => resolve(null), (e) => reject((0, generalHelpers_1.fail)(e)));
|
|
943
|
+
}, (e) => reject((0, generalHelpers_1.fail)(e)));
|
|
865
944
|
}
|
|
866
945
|
});
|
|
867
946
|
}
|
|
@@ -164,9 +164,12 @@ export declare function getLayerSettings(layerInfos: any, url: string, itemId: s
|
|
|
164
164
|
* The feature service name will have a generated GUID appended.
|
|
165
165
|
*
|
|
166
166
|
* @param templates A collection of AGO item templates.
|
|
167
|
+
* @param templateDictionary Optional hash of values used to resolve `{{...}}` tokens in the name
|
|
168
|
+
* before applying the 50-char base-name limit. When omitted, names containing unresolved tokens
|
|
169
|
+
* are passed through untruncated (legacy behavior).
|
|
167
170
|
* @returns An updated collection of AGO templates with unique feature service names.
|
|
168
171
|
*/
|
|
169
|
-
export declare function setNamesAndTitles(templates: IItemTemplate[]): IItemTemplate[];
|
|
172
|
+
export declare function setNamesAndTitles(templates: IItemTemplate[], templateDictionary?: any): IItemTemplate[];
|
|
170
173
|
/**
|
|
171
174
|
* This is used when deploying views.
|
|
172
175
|
* We need to update fields referenced in adminLayerInfo for relationships prior to deploying the view.
|
|
@@ -243,6 +246,28 @@ export declare function getExistingLayersAndTables(url: string, ids: number[], a
|
|
|
243
246
|
* @private
|
|
244
247
|
*/
|
|
245
248
|
export declare function addFeatureServiceLayersAndTables(itemTemplate: IItemTemplate, templateDictionary: any, popupInfos: IPopupInfos, authentication: UserSession): Promise<void>;
|
|
249
|
+
/**
|
|
250
|
+
* Shorten any layer or table name longer than `maxNameLength` to a unique value of at most
|
|
251
|
+
* `maxNameLength` characters, in preparation for an addToDefinition call, and report the original
|
|
252
|
+
* names so they can be restored afterward.
|
|
253
|
+
*
|
|
254
|
+
* Mutates the `name` of each over-long layer/table in `layerChunks` in place.
|
|
255
|
+
*
|
|
256
|
+
* @param layerChunks The addToDefinition chunks whose `layers` and `tables` will be added
|
|
257
|
+
* @param maxNameLength Names longer than this are truncated to a unique value of this length
|
|
258
|
+
* @returns The original names to restore, as `{ layers: [{ id, name }], tables: [{ id, name }] }`
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
export declare function _truncateNamesForAddToDefinition(layerChunks: any[], maxNameLength: number): {
|
|
262
|
+
layers: Array<{
|
|
263
|
+
id: any;
|
|
264
|
+
name: string;
|
|
265
|
+
}>;
|
|
266
|
+
tables: Array<{
|
|
267
|
+
id: any;
|
|
268
|
+
name: string;
|
|
269
|
+
}>;
|
|
270
|
+
};
|
|
246
271
|
/**
|
|
247
272
|
* Updates a feature service with a list of layers and/or tables.
|
|
248
273
|
*
|
|
@@ -427,9 +427,12 @@ export function getLayerSettings(layerInfos, url, itemId, enterpriseIDMapping) {
|
|
|
427
427
|
* The feature service name will have a generated GUID appended.
|
|
428
428
|
*
|
|
429
429
|
* @param templates A collection of AGO item templates.
|
|
430
|
+
* @param templateDictionary Optional hash of values used to resolve `{{...}}` tokens in the name
|
|
431
|
+
* before applying the 50-char base-name limit. When omitted, names containing unresolved tokens
|
|
432
|
+
* are passed through untruncated (legacy behavior).
|
|
430
433
|
* @returns An updated collection of AGO templates with unique feature service names.
|
|
431
434
|
*/
|
|
432
|
-
export function setNamesAndTitles(templates) {
|
|
435
|
+
export function setNamesAndTitles(templates, templateDictionary) {
|
|
433
436
|
const guid = generateGUID();
|
|
434
437
|
const names = [];
|
|
435
438
|
return templates.map((t) => {
|
|
@@ -443,12 +446,20 @@ export function setNamesAndTitles(templates) {
|
|
|
443
446
|
let baseName = t.item.name || t.item.title;
|
|
444
447
|
// If the name already contains a GUID remove it
|
|
445
448
|
baseName = baseName.replace(/_[0-9A-F]{32}/gi, "");
|
|
446
|
-
//
|
|
447
|
-
//
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
// Resolve any {{...}} tokens (e.g. {{params.buildSolution.items.<id>.title}}) so the
|
|
450
|
+
// base-name length limit reflects the value AGOL will actually see at create time.
|
|
451
|
+
const resolvedBaseName = templateDictionary
|
|
452
|
+
? replaceInTemplate(baseName, templateDictionary)
|
|
453
|
+
: baseName;
|
|
454
|
+
// Limit the base name to 50 chars so the full service name (base + "_" + 32-char guid)
|
|
455
|
+
// stays within AGOL's service-name length limit. This 50-char cap is long-standing
|
|
456
|
+
// behavior. If unresolved {{...}} tokens remain we can't know the resolved length, so
|
|
457
|
+
// leave the name untruncated.
|
|
458
|
+
const maxBaseNameLength = 50;
|
|
459
|
+
const stillTemplatized = resolvedBaseName.includes("{{");
|
|
460
|
+
const name = stillTemplatized
|
|
461
|
+
? resolvedBaseName + "_" + guid
|
|
462
|
+
: resolvedBaseName.substring(0, maxBaseNameLength) + "_" + guid;
|
|
452
463
|
// If the name + GUID already exists then append "_occurrenceCount"
|
|
453
464
|
t.item.name = names.indexOf(name) === -1 ? name : `${name}_${names.filter((n) => n === name).length}`;
|
|
454
465
|
names.push(name);
|
|
@@ -721,6 +732,52 @@ export function addFeatureServiceLayersAndTables(itemTemplate, templateDictionar
|
|
|
721
732
|
}
|
|
722
733
|
});
|
|
723
734
|
}
|
|
735
|
+
/**
|
|
736
|
+
* Shorten any layer or table name longer than `maxNameLength` to a unique value of at most
|
|
737
|
+
* `maxNameLength` characters, in preparation for an addToDefinition call, and report the original
|
|
738
|
+
* names so they can be restored afterward.
|
|
739
|
+
*
|
|
740
|
+
* Mutates the `name` of each over-long layer/table in `layerChunks` in place.
|
|
741
|
+
*
|
|
742
|
+
* @param layerChunks The addToDefinition chunks whose `layers` and `tables` will be added
|
|
743
|
+
* @param maxNameLength Names longer than this are truncated to a unique value of this length
|
|
744
|
+
* @returns The original names to restore, as `{ layers: [{ id, name }], tables: [{ id, name }] }`
|
|
745
|
+
* @private
|
|
746
|
+
*/
|
|
747
|
+
export function _truncateNamesForAddToDefinition(layerChunks, maxNameLength) {
|
|
748
|
+
const restore = {
|
|
749
|
+
layers: [],
|
|
750
|
+
tables: [],
|
|
751
|
+
};
|
|
752
|
+
const allItems = [];
|
|
753
|
+
layerChunks.forEach((chunk) => {
|
|
754
|
+
chunk.layers.forEach((layer) => allItems.push({ item: layer, isLayer: true }));
|
|
755
|
+
chunk.tables.forEach((table) => allItems.push({ item: table, isLayer: false }));
|
|
756
|
+
});
|
|
757
|
+
// Reserve names that are already short enough so the truncated names won't collide with them.
|
|
758
|
+
const usedNames = new Set();
|
|
759
|
+
allItems.forEach(({ item }) => {
|
|
760
|
+
if (item.name.length <= maxNameLength) {
|
|
761
|
+
usedNames.add(item.name.toLowerCase());
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
allItems.forEach(({ item, isLayer }) => {
|
|
765
|
+
if (item.name.length > maxNameLength) {
|
|
766
|
+
const originalName = item.name;
|
|
767
|
+
let candidate = originalName.substring(0, maxNameLength);
|
|
768
|
+
let counter = 1;
|
|
769
|
+
// Keep the truncated name unique by trimming room for a numeric suffix when needed.
|
|
770
|
+
while (usedNames.has(candidate.toLowerCase())) {
|
|
771
|
+
const suffix = `_${counter++}`;
|
|
772
|
+
candidate = originalName.substring(0, maxNameLength - suffix.length) + suffix;
|
|
773
|
+
}
|
|
774
|
+
usedNames.add(candidate.toLowerCase());
|
|
775
|
+
item.name = candidate;
|
|
776
|
+
(isLayer ? restore.layers : restore.tables).push({ id: item.id, name: originalName });
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
return restore;
|
|
780
|
+
}
|
|
724
781
|
/**
|
|
725
782
|
* Updates a feature service with a list of layers and/or tables.
|
|
726
783
|
*
|
|
@@ -833,9 +890,30 @@ export function addFeatureServiceDefinition(serviceUrl, listToAdd, templateDicti
|
|
|
833
890
|
// will use async by default rather than chunk the layer requests when we have more layers
|
|
834
891
|
// than the defined chunk size
|
|
835
892
|
const useAsync = listToAdd.length > chunkSize;
|
|
893
|
+
// Shorten any over-long layer/table names to short, unique values before adding them.
|
|
894
|
+
// Names will be restored afterward with one updateDefinition call per layer/table.
|
|
895
|
+
const maxBackingTableNameLength = 30;
|
|
896
|
+
const restoreNames = _truncateNamesForAddToDefinition(layerChunks, maxBackingTableNameLength);
|
|
897
|
+
// Base admin URL used for the per-layer updateDefinition restore calls below.
|
|
898
|
+
const adminServiceUrl = checkUrlPathTermination(serviceUrl.replace("/rest/services", "/rest/admin/services"));
|
|
836
899
|
layerChunks
|
|
837
900
|
.reduce((prev, curr) => prev.then(() => addToServiceDefinition(serviceUrl, curr, false, useAsync)), Promise.resolve(null))
|
|
838
|
-
.then(() =>
|
|
901
|
+
.then(() => {
|
|
902
|
+
// Restore the original (pre-truncation) display names.
|
|
903
|
+
// I was seeing the updateDefinition call succeed but the names not being restored when I was doing this
|
|
904
|
+
// with a single call at the service endpoint. So now we are doing this sequentially.
|
|
905
|
+
const restoreItems = [...restoreNames.layers, ...restoreNames.tables];
|
|
906
|
+
restoreItems
|
|
907
|
+
.reduce((prev, entry) => prev.then(() => {
|
|
908
|
+
const restoreUpdate = {
|
|
909
|
+
url: adminServiceUrl + entry.id + "/updateDefinition",
|
|
910
|
+
params: { updateDefinition: { name: entry.name } },
|
|
911
|
+
args: { authentication },
|
|
912
|
+
};
|
|
913
|
+
return getRequest(restoreUpdate, false, false, templateDictionary.isPortal);
|
|
914
|
+
}), Promise.resolve(null))
|
|
915
|
+
.then(() => resolve(null), (e) => reject(fail(e)));
|
|
916
|
+
}, (e) => reject(fail(e)));
|
|
839
917
|
}
|
|
840
918
|
});
|
|
841
919
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
Built 06/
|
|
1
|
+
Built 06/25/2026 20:42:59.94
|
|
2
2
|
develop
|
|
3
|
-
commit
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
commit 8bce353fe3c3c3286c3d17f2c47ad0608160e78a
|
|
4
|
+
Merge: 0713c37c5 bdf44674f
|
|
5
|
+
Author: Previn Wong <pwong@esri.com>
|
|
6
|
+
Date: Thu Jun 25 16:16:57 2026 -0700
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Merge pull request #1591 from Esri/long-name-issue
|
|
9
|
+
|
|
10
|
+
Long name issue
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-common",
|
|
3
|
-
"version": "6.6.1-next.
|
|
3
|
+
"version": "6.6.1-next.81",
|
|
4
4
|
"description": "Provides general helper functions for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"esri",
|
|
97
97
|
"ES6"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "8bce353fe3c3c3286c3d17f2c47ad0608160e78a"
|
|
100
100
|
}
|