@salesforce/lds-runtime-mobile 1.354.0-dev11 → 1.354.0-dev13

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/dist/main.js CHANGED
@@ -19,11 +19,11 @@ import { withRegistration, register } from '@salesforce/lds-default-luvio';
19
19
  import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from '@salesforce/lds-instrumentation';
20
20
  import { HttpStatusCode, setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$h, createResourceParams as createResourceParams$h, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$f, resolveLink, createCustomAdapterEventEmitter, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
21
21
  import { isSupportedEntity, configuration, getObjectInfoAdapterFactory, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, extractRecordIdFromStoreKey, buildRecordRepKeyFromId, keyBuilderRecord, RecordRepresentationTTL, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, getRecordId18 as getRecordId18$1, getRecordsAdapterFactory as getRecordsAdapterFactory$1, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationVersion } from '@salesforce/lds-adapters-uiapi';
22
+ import { getInstrumentation, idleDetector } from 'o11y/client';
22
23
  import { Kind as Kind$1, visit as visit$1, isObjectType, defaultFieldResolver, buildSchema, parse as parse$5, extendSchema, isScalarType, execute, print } from '@luvio/graphql-parser';
23
24
  import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
24
25
  import graphqQueryFieldLimit from '@salesforce/gate/lmr.graphqQueryFieldLimit';
25
26
  import caseSensitiveUserId from '@salesforce/user/Id';
26
- import { idleDetector, getInstrumentation } from 'o11y/client';
27
27
  import { instrument as instrument$1 } from '@salesforce/lds-bindings';
28
28
  import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
29
29
  import LOCALE from '@salesforce/i18n/locale';
@@ -53,7 +53,7 @@ const { entries: entries$3, keys: keys$5 } = Object;
53
53
 
54
54
  const UI_API_BASE_URI = '/services/data/v64.0/ui-api';
55
55
 
56
- let instrumentation$2 = {
56
+ let instrumentation$3 = {
57
57
  aggregateUiChunkCount: (_cb) => { },
58
58
  aggregateUiConnectError: () => { },
59
59
  duplicateRequest: (_cb) => { },
@@ -65,7 +65,7 @@ let instrumentation$2 = {
65
65
  networkRateLimitExceeded: () => { },
66
66
  };
67
67
  function instrument(newInstrumentation) {
68
- instrumentation$2 = Object.assign(instrumentation$2, newInstrumentation);
68
+ instrumentation$3 = Object.assign(instrumentation$3, newInstrumentation);
69
69
  }
70
70
 
71
71
  const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
@@ -135,7 +135,7 @@ function mergeRecordFields$2(first, second) {
135
135
  * would otherwise cause a query length exception.
136
136
  */
137
137
  function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resourceRequest, resourceRequestContext) {
138
- instrumentation$2.getRecordAggregateInvoke();
138
+ instrumentation$3.getRecordAggregateInvoke();
139
139
  return networkAdapter(resourceRequest, resourceRequestContext).then((resp) => {
140
140
  const { body } = resp;
141
141
  // This response body could be an executeAggregateUi, which we don't natively support.
@@ -151,7 +151,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
151
151
  }
152
152
  const merged = body.compositeResponse.reduce((seed, response) => {
153
153
  if (response.httpStatusCode !== HttpStatusCode.Ok) {
154
- instrumentation$2.getRecordAggregateReject(() => recordId);
154
+ instrumentation$3.getRecordAggregateReject(() => recordId);
155
155
  throw createErrorResponse(HttpStatusCode.ServerError, {
156
156
  error: response.message,
157
157
  });
@@ -161,7 +161,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
161
161
  }
162
162
  return mergeRecordFields$2(seed, response.body);
163
163
  }, null);
164
- instrumentation$2.getRecordAggregateResolve(() => {
164
+ instrumentation$3.getRecordAggregateResolve(() => {
165
165
  return {
166
166
  recordId,
167
167
  apiName: merged.apiName,
@@ -169,7 +169,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
169
169
  });
170
170
  return createOkResponse$1(merged);
171
171
  }, (err) => {
172
- instrumentation$2.getRecordAggregateReject(() => recordId);
172
+ instrumentation$3.getRecordAggregateReject(() => recordId);
173
173
  // rethrow error
174
174
  throw err;
175
175
  });
@@ -247,7 +247,7 @@ function buildAndDispatchGetRecordAggregateUi(recordId, req, params) {
247
247
  const { networkAdapter, resourceRequest, resourceRequestContext } = req;
248
248
  const compositeRequest = buildGetRecordByFieldsCompositeRequest(resourceRequest, params);
249
249
  // W-12245125: Emit chunk size metrics
250
- instrumentation$2.aggregateUiChunkCount(() => compositeRequest.length);
250
+ instrumentation$3.aggregateUiChunkCount(() => compositeRequest.length);
251
251
  const aggregateUiParams = {
252
252
  compositeRequest,
253
253
  };
@@ -491,7 +491,7 @@ function platformNetworkAdapter(baseNetworkAdapter) {
491
491
  return (resourceRequest, resourceRequestContext) => {
492
492
  if (!tokenBucket.take(1)) {
493
493
  // We are hitting rate limiting, add some metrics
494
- instrumentation$2.networkRateLimitExceeded();
494
+ instrumentation$3.networkRateLimitExceeded();
495
495
  }
496
496
  const salesforceRequest = {
497
497
  networkAdapter: baseNetworkAdapter,
@@ -42716,6 +42716,211 @@ class UiApiDraftRecordService {
42716
42716
  }
42717
42717
  }
42718
42718
 
42719
+ function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
42720
+ if (adapterRequestContext === undefined) {
42721
+ return { eventObservers: observers };
42722
+ }
42723
+ if (adapterRequestContext.eventObservers === undefined) {
42724
+ return { ...adapterRequestContext, eventObservers: observers };
42725
+ }
42726
+ return {
42727
+ ...adapterRequestContext,
42728
+ eventObservers: adapterRequestContext.eventObservers.concat(observers),
42729
+ };
42730
+ }
42731
+ /**
42732
+ * Use this method to sanitize the unknown error object when
42733
+ * we are unsure of the type of the error thrown
42734
+ *
42735
+ * @param err Unknown object to sanitize
42736
+ * @returns an instance of error
42737
+ */
42738
+ function normalizeError(err) {
42739
+ if (err instanceof Error) {
42740
+ return err;
42741
+ }
42742
+ else if (typeof err === 'string') {
42743
+ return new Error(err);
42744
+ }
42745
+ return new Error(stringify$2(err));
42746
+ }
42747
+
42748
+ const O11Y_NAMESPACE_LDS_MOBILE = 'lds-mobile';
42749
+ // metrics
42750
+ /** GraphQL */
42751
+ const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
42752
+ const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
42753
+ const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
42754
+ const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
42755
+ const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
42756
+ const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
42757
+ const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
42758
+ /** Draft Queue */
42759
+ const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
42760
+ const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
42761
+ const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
42762
+ const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
42763
+ const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
42764
+ const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
42765
+ const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
42766
+ const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
42767
+ const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
42768
+ const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
42769
+ const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
42770
+ /** Content Document */
42771
+ const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
42772
+ const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
42773
+ /** Priming */
42774
+ const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
42775
+ const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
42776
+ const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
42777
+ const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
42778
+ // logs
42779
+ const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
42780
+ const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
42781
+ const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
42782
+ const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
42783
+ const ldsMobileInstrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
42784
+ const nimbusLogger = typeof __nimbus !== 'undefined' &&
42785
+ __nimbus.plugins !== undefined &&
42786
+ __nimbus.plugins.JSLoggerPlugin !== undefined
42787
+ ? __nimbus.plugins.JSLoggerPlugin
42788
+ : undefined;
42789
+ function reportGraphqlQueryParseError(err) {
42790
+ const error = normalizeError(err);
42791
+ const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
42792
+ // Metric
42793
+ reportGraphqlAdapterError(errorCode);
42794
+ // Log
42795
+ ldsMobileInstrumentation.error(error, errorCode);
42796
+ }
42797
+ function reportGraphqlSqlEvalPreconditionError(err) {
42798
+ const error = normalizeError(err);
42799
+ const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
42800
+ // Metric
42801
+ reportGraphqlAdapterError(errorCode);
42802
+ // Log
42803
+ ldsMobileInstrumentation.error(error, errorCode);
42804
+ }
42805
+ function reportGraphqlCreateSnapshotError(err) {
42806
+ const error = normalizeError(err);
42807
+ const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
42808
+ // Metric
42809
+ reportGraphqlAdapterError(errorCode);
42810
+ // Log
42811
+ ldsMobileInstrumentation.error(error, errorCode);
42812
+ }
42813
+ function reportGraphQlEvalDbReadDuration(duration) {
42814
+ ldsMobileInstrumentation.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
42815
+ }
42816
+ function reportGraphqlAdapterError(errorCode) {
42817
+ // Increment overall count with errorCode as tag
42818
+ ldsMobileInstrumentation.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
42819
+ }
42820
+ function reportGraphqlQueryInstrumentation(data) {
42821
+ const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
42822
+ const recordBuckets = [
42823
+ 1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
42824
+ ];
42825
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
42826
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
42827
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
42828
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
42829
+ }
42830
+ function incrementGraphQLRefreshUndfined() {
42831
+ ldsMobileInstrumentation.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
42832
+ }
42833
+ function reportDraftActionEvent(state, draftCount, message) {
42834
+ if (nimbusLogger) {
42835
+ nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
42836
+ }
42837
+ switch (state) {
42838
+ case 'added':
42839
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
42840
+ break;
42841
+ case 'uploading':
42842
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
42843
+ break;
42844
+ case 'completed':
42845
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
42846
+ break;
42847
+ case 'deleted':
42848
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
42849
+ break;
42850
+ case 'failed':
42851
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
42852
+ break;
42853
+ case 'updated':
42854
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
42855
+ break;
42856
+ }
42857
+ }
42858
+ function reportDraftQueueState(state, draftCount) {
42859
+ if (nimbusLogger) {
42860
+ nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
42861
+ }
42862
+ switch (state) {
42863
+ case 'started':
42864
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
42865
+ break;
42866
+ case 'error':
42867
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
42868
+ break;
42869
+ case 'waiting':
42870
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
42871
+ break;
42872
+ case 'stopped':
42873
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
42874
+ break;
42875
+ }
42876
+ }
42877
+ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
42878
+ let error;
42879
+ if (err.body !== undefined) {
42880
+ error = err.body;
42881
+ }
42882
+ else {
42883
+ error = normalizeError(err);
42884
+ }
42885
+ const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
42886
+ const errorType = error.errorType;
42887
+ const tags = {
42888
+ errorCode,
42889
+ };
42890
+ if (errorType !== undefined) {
42891
+ tags.errorType = errorType;
42892
+ }
42893
+ // Metric
42894
+ ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
42895
+ // Log
42896
+ ldsMobileInstrumentation.error(error, errorCode);
42897
+ }
42898
+ function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
42899
+ ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
42900
+ }
42901
+ /** Priming */
42902
+ function reportPrimingSessionCreated() {
42903
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
42904
+ }
42905
+ function reportPrimingError(errorType, recordCount) {
42906
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
42907
+ errorType,
42908
+ });
42909
+ }
42910
+ function reportPrimingSuccess(recordCount) {
42911
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
42912
+ }
42913
+ function reportPrimingConflict(resolutionType, recordCount) {
42914
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
42915
+ resolutionType,
42916
+ });
42917
+ }
42918
+ /** Network */
42919
+ function reportChunkCandidateUrlLength(urlLength) {
42920
+ const buckets = [8000, 10000, 12000, 14000, 16000];
42921
+ ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
42922
+ }
42923
+
42719
42924
  const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
42720
42925
  class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestActionHandler {
42721
42926
  constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
@@ -42726,6 +42931,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
42726
42931
  this.objectInfoService = objectInfoService;
42727
42932
  this.getRecord = getRecord;
42728
42933
  this.handlerId = QUICK_ACTION_HANDLER;
42934
+ this.instrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
42729
42935
  draftRecordService.registerRecordHandler(this);
42730
42936
  }
42731
42937
  async draftActionToSideEffects(queueEntry) {
@@ -42757,10 +42963,26 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
42757
42963
  luvio.storeIngest(key, ingestQuickActionExecutionRepresentation, response);
42758
42964
  }
42759
42965
  async handleActionCompleted(action, queueOperations) {
42966
+ /* performQuickAction will not return the new record itself, so before the action
42967
+ * is marked as completed, we need to fetch the actual record. This must be done before
42968
+ * the super method is called because the super method will revert the side effects that
42969
+ * were created for this action, and critically that means evicting the synthetic record
42970
+ * that was created to represent the draft of what would become the canonical record.
42971
+ * Since getRecord is a network call, it is better to have a small timeframe (on the order
42972
+ * of microseconds) where both the synthetic record and the canonical record are in the
42973
+ * store instead of the record missing from the store for the entire duration of the
42974
+ * network call.
42975
+ */
42976
+ try {
42977
+ await this.fetchRecordIntoStoreFromCompletedAction(action);
42978
+ }
42979
+ catch (error) {
42980
+ this.instrumentation.error(error, 'Error fetching the record created from performQuickAction adapter.');
42981
+ }
42760
42982
  await super.handleActionCompleted(action, queueOperations);
42761
- this.getLuvio();
42983
+ }
42984
+ async fetchRecordIntoStoreFromCompletedAction(action) {
42762
42985
  const canonicalId = action.response.body.id;
42763
- this.buildTagForTargetId(canonicalId);
42764
42986
  const prefix = canonicalId.substring(0, 3);
42765
42987
  if (prefix.length !== 3) {
42766
42988
  // if we can't get a prefix, don't do the rest
@@ -51165,211 +51387,6 @@ class NimbusDraftQueue {
51165
51387
  }
51166
51388
  }
51167
51389
 
51168
- function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
51169
- if (adapterRequestContext === undefined) {
51170
- return { eventObservers: observers };
51171
- }
51172
- if (adapterRequestContext.eventObservers === undefined) {
51173
- return { ...adapterRequestContext, eventObservers: observers };
51174
- }
51175
- return {
51176
- ...adapterRequestContext,
51177
- eventObservers: adapterRequestContext.eventObservers.concat(observers),
51178
- };
51179
- }
51180
- /**
51181
- * Use this method to sanitize the unknown error object when
51182
- * we are unsure of the type of the error thrown
51183
- *
51184
- * @param err Unknown object to sanitize
51185
- * @returns an instance of error
51186
- */
51187
- function normalizeError(err) {
51188
- if (err instanceof Error) {
51189
- return err;
51190
- }
51191
- else if (typeof err === 'string') {
51192
- return new Error(err);
51193
- }
51194
- return new Error(stringify$2(err));
51195
- }
51196
-
51197
- const O11Y_NAMESPACE_LDS_MOBILE = 'lds-mobile';
51198
- // metrics
51199
- /** GraphQL */
51200
- const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
51201
- const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
51202
- const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
51203
- const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
51204
- const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
51205
- const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
51206
- const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
51207
- /** Draft Queue */
51208
- const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
51209
- const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
51210
- const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
51211
- const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
51212
- const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
51213
- const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
51214
- const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
51215
- const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
51216
- const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
51217
- const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
51218
- const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
51219
- /** Content Document */
51220
- const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
51221
- const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
51222
- /** Priming */
51223
- const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
51224
- const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
51225
- const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
51226
- const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
51227
- // logs
51228
- const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
51229
- const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
51230
- const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
51231
- const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
51232
- const ldsMobileInstrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
51233
- const nimbusLogger = typeof __nimbus !== 'undefined' &&
51234
- __nimbus.plugins !== undefined &&
51235
- __nimbus.plugins.JSLoggerPlugin !== undefined
51236
- ? __nimbus.plugins.JSLoggerPlugin
51237
- : undefined;
51238
- function reportGraphqlQueryParseError(err) {
51239
- const error = normalizeError(err);
51240
- const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
51241
- // Metric
51242
- reportGraphqlAdapterError(errorCode);
51243
- // Log
51244
- ldsMobileInstrumentation.error(error, errorCode);
51245
- }
51246
- function reportGraphqlSqlEvalPreconditionError(err) {
51247
- const error = normalizeError(err);
51248
- const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
51249
- // Metric
51250
- reportGraphqlAdapterError(errorCode);
51251
- // Log
51252
- ldsMobileInstrumentation.error(error, errorCode);
51253
- }
51254
- function reportGraphqlCreateSnapshotError(err) {
51255
- const error = normalizeError(err);
51256
- const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
51257
- // Metric
51258
- reportGraphqlAdapterError(errorCode);
51259
- // Log
51260
- ldsMobileInstrumentation.error(error, errorCode);
51261
- }
51262
- function reportGraphQlEvalDbReadDuration(duration) {
51263
- ldsMobileInstrumentation.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
51264
- }
51265
- function reportGraphqlAdapterError(errorCode) {
51266
- // Increment overall count with errorCode as tag
51267
- ldsMobileInstrumentation.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
51268
- }
51269
- function reportGraphqlQueryInstrumentation(data) {
51270
- const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
51271
- const recordBuckets = [
51272
- 1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
51273
- ];
51274
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
51275
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
51276
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
51277
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
51278
- }
51279
- function incrementGraphQLRefreshUndfined() {
51280
- ldsMobileInstrumentation.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
51281
- }
51282
- function reportDraftActionEvent(state, draftCount, message) {
51283
- if (nimbusLogger) {
51284
- nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
51285
- }
51286
- switch (state) {
51287
- case 'added':
51288
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
51289
- break;
51290
- case 'uploading':
51291
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
51292
- break;
51293
- case 'completed':
51294
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
51295
- break;
51296
- case 'deleted':
51297
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
51298
- break;
51299
- case 'failed':
51300
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
51301
- break;
51302
- case 'updated':
51303
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
51304
- break;
51305
- }
51306
- }
51307
- function reportDraftQueueState(state, draftCount) {
51308
- if (nimbusLogger) {
51309
- nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
51310
- }
51311
- switch (state) {
51312
- case 'started':
51313
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
51314
- break;
51315
- case 'error':
51316
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
51317
- break;
51318
- case 'waiting':
51319
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
51320
- break;
51321
- case 'stopped':
51322
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
51323
- break;
51324
- }
51325
- }
51326
- function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
51327
- let error;
51328
- if (err.body !== undefined) {
51329
- error = err.body;
51330
- }
51331
- else {
51332
- error = normalizeError(err);
51333
- }
51334
- const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
51335
- const errorType = error.errorType;
51336
- const tags = {
51337
- errorCode,
51338
- };
51339
- if (errorType !== undefined) {
51340
- tags.errorType = errorType;
51341
- }
51342
- // Metric
51343
- ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
51344
- // Log
51345
- ldsMobileInstrumentation.error(error, errorCode);
51346
- }
51347
- function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
51348
- ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
51349
- }
51350
- /** Priming */
51351
- function reportPrimingSessionCreated() {
51352
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
51353
- }
51354
- function reportPrimingError(errorType, recordCount) {
51355
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
51356
- errorType,
51357
- });
51358
- }
51359
- function reportPrimingSuccess(recordCount) {
51360
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
51361
- }
51362
- function reportPrimingConflict(resolutionType, recordCount) {
51363
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
51364
- resolutionType,
51365
- });
51366
- }
51367
- /** Network */
51368
- function reportChunkCandidateUrlLength(urlLength) {
51369
- const buckets = [8000, 10000, 12000, 14000, 16000];
51370
- ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
51371
- }
51372
-
51373
51390
  /**
51374
51391
  * HOF (high-order-function) that instruments any async operation. If the operation
51375
51392
  * has an error then the hasError param will be set on the call to o11y.incrementCounter
@@ -52058,6 +52075,9 @@ class LdsInternalDataTable {
52058
52075
  }
52059
52076
 
52060
52077
  const tasker = idleDetector.declareNotifierTaskMulti('NimbusSqliteStore');
52078
+ const instrumentation$2 = getInstrumentation('lds-mobile');
52079
+ const GRAPHQL_QUERY_ROOT_KEY = 'UiApi::uiapi::Query[uiapi]__uiapi__query';
52080
+ const GRAPHQL_QUERY_ROOT_METRIC_NAME = 'gql-query-root-object-size';
52061
52081
  class NimbusSqliteStore {
52062
52082
  constructor(plugin, additionalTableMap = {}) {
52063
52083
  this.plugin = plugin;
@@ -52109,6 +52129,9 @@ class NimbusSqliteStore {
52109
52129
  }
52110
52130
  const table = this.getTable(segment);
52111
52131
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
52132
+ if (entries[GRAPHQL_QUERY_ROOT_KEY]) {
52133
+ this.trackGraphQLQueryRootSize(upsertOperation);
52134
+ }
52112
52135
  return this.batchOperationAsPromise([upsertOperation]);
52113
52136
  }
52114
52137
  setMetadata(entries, segment) {
@@ -52124,7 +52147,11 @@ class NimbusSqliteStore {
52124
52147
  if (cur.type === 'setEntries') {
52125
52148
  if (keys(cur.entries).length > 0) {
52126
52149
  const table = this.getTable(cur.segment);
52127
- acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
52150
+ const upsertOperation = table.entriesToUpsertOperations(cur.entries, cur.segment);
52151
+ if (cur.entries[GRAPHQL_QUERY_ROOT_KEY]) {
52152
+ this.trackGraphQLQueryRootSize(upsertOperation);
52153
+ }
52154
+ acc.push(upsertOperation);
52128
52155
  }
52129
52156
  }
52130
52157
  else if (cur.type === 'setMetadata') {
@@ -52209,6 +52236,19 @@ class NimbusSqliteStore {
52209
52236
  });
52210
52237
  }).finally(() => tasker.done());
52211
52238
  }
52239
+ trackGraphQLQueryRootSize(upsertOperation) {
52240
+ try {
52241
+ if (upsertOperation.type !== 'upsert') {
52242
+ return;
52243
+ }
52244
+ const row = upsertOperation.rows.find((r) => r[0] === GRAPHQL_QUERY_ROOT_KEY);
52245
+ if (!(row && row[1] && typeof row[1] === 'string')) {
52246
+ return;
52247
+ }
52248
+ instrumentation$2.trackValue(GRAPHQL_QUERY_ROOT_METRIC_NAME, row[1].length);
52249
+ }
52250
+ catch { }
52251
+ }
52212
52252
  }
52213
52253
 
52214
52254
  // These const values must be in sync with the latest
@@ -55763,4 +55803,4 @@ register({
55763
55803
  });
55764
55804
 
55765
55805
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, registerReportObserver, reportGraphqlQueryParseError };
55766
- // version: 1.354.0-dev11-5ded66ad52
55806
+ // version: 1.354.0-dev13-f27ca1a3a7
@@ -20,6 +20,7 @@ export declare class QuickActionExecutionRepresentationHandler extends AbstractR
20
20
  private readonly objectInfoService;
21
21
  private readonly getRecord;
22
22
  handlerId: string;
23
+ private readonly instrumentation;
23
24
  constructor(getLuvio: () => Luvio, draftRecordService: UiApiDraftRecordService, draftQueue: DraftQueue, networkAdapter: NetworkAdapter, isDraftId: (targetId: string) => boolean, sideEffectService: SideEffectService, objectInfoService: ObjectInfoService, getRecord: Adapter<GetRecordConfig, RecordRepresentation>);
24
25
  draftActionToSideEffects(queueEntry: DraftAction<PerformQuickActionResourceRequest, QuickActionExecutionRepresentation>): Promise<SideEffect[]>;
25
26
  getIdFromRequest(request: ResourceRequest): Promise<string>;
@@ -28,6 +29,7 @@ export declare class QuickActionExecutionRepresentationHandler extends AbstractR
28
29
  buildCacheKeysFromResponse(_response: QuickActionExecutionRepresentation): DurableStoreKeyMetadataMap;
29
30
  synchronousIngest(response: QuickActionExecutionRepresentation): void;
30
31
  handleActionCompleted(action: CompletedDraftAction<ResourceRequest, QuickActionExecutionRepresentation>, queueOperations: QueueOperation[]): Promise<void>;
32
+ private fetchRecordIntoStoreFromCompletedAction;
31
33
  private allFields;
32
34
  mergeRequestBody<T>(): T;
33
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.354.0-dev11",
3
+ "version": "1.354.0-dev13",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,24 +32,24 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@salesforce/lds-adapters-uiapi": "^1.354.0-dev11",
36
- "@salesforce/lds-bindings": "^1.354.0-dev11",
37
- "@salesforce/lds-instrumentation": "^1.354.0-dev11",
35
+ "@salesforce/lds-adapters-uiapi": "^1.354.0-dev13",
36
+ "@salesforce/lds-bindings": "^1.354.0-dev13",
37
+ "@salesforce/lds-instrumentation": "^1.354.0-dev13",
38
38
  "@salesforce/user": "0.0.21",
39
39
  "o11y": "250.7.0",
40
40
  "o11y_schema": "256.126.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.354.0-dev11",
44
- "@salesforce/lds-drafts": "^1.354.0-dev11",
45
- "@salesforce/lds-durable-records": "^1.354.0-dev11",
46
- "@salesforce/lds-network-adapter": "^1.354.0-dev11",
47
- "@salesforce/lds-network-nimbus": "^1.354.0-dev11",
48
- "@salesforce/lds-store-binary": "^1.354.0-dev11",
49
- "@salesforce/lds-store-nimbus": "^1.354.0-dev11",
50
- "@salesforce/lds-store-sql": "^1.354.0-dev11",
51
- "@salesforce/lds-utils-adapters": "^1.354.0-dev11",
52
- "@salesforce/nimbus-plugin-lds": "^1.354.0-dev11",
43
+ "@salesforce/lds-adapters-graphql": "^1.354.0-dev13",
44
+ "@salesforce/lds-drafts": "^1.354.0-dev13",
45
+ "@salesforce/lds-durable-records": "^1.354.0-dev13",
46
+ "@salesforce/lds-network-adapter": "^1.354.0-dev13",
47
+ "@salesforce/lds-network-nimbus": "^1.354.0-dev13",
48
+ "@salesforce/lds-store-binary": "^1.354.0-dev13",
49
+ "@salesforce/lds-store-nimbus": "^1.354.0-dev13",
50
+ "@salesforce/lds-store-sql": "^1.354.0-dev13",
51
+ "@salesforce/lds-utils-adapters": "^1.354.0-dev13",
52
+ "@salesforce/nimbus-plugin-lds": "^1.354.0-dev13",
53
53
  "babel-plugin-dynamic-import-node": "^2.3.3",
54
54
  "wait-for-expect": "^3.0.2"
55
55
  },
package/sfdc/main.js CHANGED
@@ -19,11 +19,11 @@ import { withRegistration, register } from 'force/ldsEngine';
19
19
  import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from 'force/ldsInstrumentation';
20
20
  import { HttpStatusCode, setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$h, createResourceParams as createResourceParams$h, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$f, resolveLink, createCustomAdapterEventEmitter, isFileReference, Environment, Luvio, InMemoryStore } from 'force/luvioEngine';
21
21
  import { isSupportedEntity, configuration, getObjectInfoAdapterFactory, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, extractRecordIdFromStoreKey, buildRecordRepKeyFromId, keyBuilderRecord, RecordRepresentationTTL, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, getRecordId18 as getRecordId18$1, getRecordsAdapterFactory as getRecordsAdapterFactory$1, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
22
+ import { getInstrumentation, idleDetector } from 'o11y/client';
22
23
  import { Kind as Kind$1, visit as visit$1, isObjectType, defaultFieldResolver, buildSchema, parse as parse$5, extendSchema, isScalarType, execute, print } from 'force/ldsGraphqlParser';
23
24
  import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
24
25
  import graphqQueryFieldLimit from '@salesforce/gate/lmr.graphqQueryFieldLimit';
25
26
  import caseSensitiveUserId from '@salesforce/user/Id';
26
- import { idleDetector, getInstrumentation } from 'o11y/client';
27
27
  import { instrument as instrument$1 } from 'force/ldsBindings';
28
28
  import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
29
29
  import LOCALE from '@salesforce/i18n/locale';
@@ -53,7 +53,7 @@ const { entries: entries$3, keys: keys$5 } = Object;
53
53
 
54
54
  const UI_API_BASE_URI = '/services/data/v64.0/ui-api';
55
55
 
56
- let instrumentation$2 = {
56
+ let instrumentation$3 = {
57
57
  aggregateUiChunkCount: (_cb) => { },
58
58
  aggregateUiConnectError: () => { },
59
59
  duplicateRequest: (_cb) => { },
@@ -65,7 +65,7 @@ let instrumentation$2 = {
65
65
  networkRateLimitExceeded: () => { },
66
66
  };
67
67
  function instrument(newInstrumentation) {
68
- instrumentation$2 = Object.assign(instrumentation$2, newInstrumentation);
68
+ instrumentation$3 = Object.assign(instrumentation$3, newInstrumentation);
69
69
  }
70
70
 
71
71
  const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
@@ -135,7 +135,7 @@ function mergeRecordFields$2(first, second) {
135
135
  * would otherwise cause a query length exception.
136
136
  */
137
137
  function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resourceRequest, resourceRequestContext) {
138
- instrumentation$2.getRecordAggregateInvoke();
138
+ instrumentation$3.getRecordAggregateInvoke();
139
139
  return networkAdapter(resourceRequest, resourceRequestContext).then((resp) => {
140
140
  const { body } = resp;
141
141
  // This response body could be an executeAggregateUi, which we don't natively support.
@@ -151,7 +151,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
151
151
  }
152
152
  const merged = body.compositeResponse.reduce((seed, response) => {
153
153
  if (response.httpStatusCode !== HttpStatusCode.Ok) {
154
- instrumentation$2.getRecordAggregateReject(() => recordId);
154
+ instrumentation$3.getRecordAggregateReject(() => recordId);
155
155
  throw createErrorResponse(HttpStatusCode.ServerError, {
156
156
  error: response.message,
157
157
  });
@@ -161,7 +161,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
161
161
  }
162
162
  return mergeRecordFields$2(seed, response.body);
163
163
  }, null);
164
- instrumentation$2.getRecordAggregateResolve(() => {
164
+ instrumentation$3.getRecordAggregateResolve(() => {
165
165
  return {
166
166
  recordId,
167
167
  apiName: merged.apiName,
@@ -169,7 +169,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
169
169
  });
170
170
  return createOkResponse$1(merged);
171
171
  }, (err) => {
172
- instrumentation$2.getRecordAggregateReject(() => recordId);
172
+ instrumentation$3.getRecordAggregateReject(() => recordId);
173
173
  // rethrow error
174
174
  throw err;
175
175
  });
@@ -247,7 +247,7 @@ function buildAndDispatchGetRecordAggregateUi(recordId, req, params) {
247
247
  const { networkAdapter, resourceRequest, resourceRequestContext } = req;
248
248
  const compositeRequest = buildGetRecordByFieldsCompositeRequest(resourceRequest, params);
249
249
  // W-12245125: Emit chunk size metrics
250
- instrumentation$2.aggregateUiChunkCount(() => compositeRequest.length);
250
+ instrumentation$3.aggregateUiChunkCount(() => compositeRequest.length);
251
251
  const aggregateUiParams = {
252
252
  compositeRequest,
253
253
  };
@@ -491,7 +491,7 @@ function platformNetworkAdapter(baseNetworkAdapter) {
491
491
  return (resourceRequest, resourceRequestContext) => {
492
492
  if (!tokenBucket.take(1)) {
493
493
  // We are hitting rate limiting, add some metrics
494
- instrumentation$2.networkRateLimitExceeded();
494
+ instrumentation$3.networkRateLimitExceeded();
495
495
  }
496
496
  const salesforceRequest = {
497
497
  networkAdapter: baseNetworkAdapter,
@@ -42716,6 +42716,211 @@ class UiApiDraftRecordService {
42716
42716
  }
42717
42717
  }
42718
42718
 
42719
+ function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
42720
+ if (adapterRequestContext === undefined) {
42721
+ return { eventObservers: observers };
42722
+ }
42723
+ if (adapterRequestContext.eventObservers === undefined) {
42724
+ return { ...adapterRequestContext, eventObservers: observers };
42725
+ }
42726
+ return {
42727
+ ...adapterRequestContext,
42728
+ eventObservers: adapterRequestContext.eventObservers.concat(observers),
42729
+ };
42730
+ }
42731
+ /**
42732
+ * Use this method to sanitize the unknown error object when
42733
+ * we are unsure of the type of the error thrown
42734
+ *
42735
+ * @param err Unknown object to sanitize
42736
+ * @returns an instance of error
42737
+ */
42738
+ function normalizeError(err) {
42739
+ if (err instanceof Error) {
42740
+ return err;
42741
+ }
42742
+ else if (typeof err === 'string') {
42743
+ return new Error(err);
42744
+ }
42745
+ return new Error(stringify$2(err));
42746
+ }
42747
+
42748
+ const O11Y_NAMESPACE_LDS_MOBILE = 'lds-mobile';
42749
+ // metrics
42750
+ /** GraphQL */
42751
+ const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
42752
+ const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
42753
+ const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
42754
+ const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
42755
+ const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
42756
+ const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
42757
+ const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
42758
+ /** Draft Queue */
42759
+ const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
42760
+ const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
42761
+ const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
42762
+ const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
42763
+ const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
42764
+ const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
42765
+ const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
42766
+ const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
42767
+ const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
42768
+ const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
42769
+ const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
42770
+ /** Content Document */
42771
+ const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
42772
+ const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
42773
+ /** Priming */
42774
+ const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
42775
+ const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
42776
+ const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
42777
+ const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
42778
+ // logs
42779
+ const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
42780
+ const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
42781
+ const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
42782
+ const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
42783
+ const ldsMobileInstrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
42784
+ const nimbusLogger = typeof __nimbus !== 'undefined' &&
42785
+ __nimbus.plugins !== undefined &&
42786
+ __nimbus.plugins.JSLoggerPlugin !== undefined
42787
+ ? __nimbus.plugins.JSLoggerPlugin
42788
+ : undefined;
42789
+ function reportGraphqlQueryParseError(err) {
42790
+ const error = normalizeError(err);
42791
+ const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
42792
+ // Metric
42793
+ reportGraphqlAdapterError(errorCode);
42794
+ // Log
42795
+ ldsMobileInstrumentation.error(error, errorCode);
42796
+ }
42797
+ function reportGraphqlSqlEvalPreconditionError(err) {
42798
+ const error = normalizeError(err);
42799
+ const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
42800
+ // Metric
42801
+ reportGraphqlAdapterError(errorCode);
42802
+ // Log
42803
+ ldsMobileInstrumentation.error(error, errorCode);
42804
+ }
42805
+ function reportGraphqlCreateSnapshotError(err) {
42806
+ const error = normalizeError(err);
42807
+ const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
42808
+ // Metric
42809
+ reportGraphqlAdapterError(errorCode);
42810
+ // Log
42811
+ ldsMobileInstrumentation.error(error, errorCode);
42812
+ }
42813
+ function reportGraphQlEvalDbReadDuration(duration) {
42814
+ ldsMobileInstrumentation.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
42815
+ }
42816
+ function reportGraphqlAdapterError(errorCode) {
42817
+ // Increment overall count with errorCode as tag
42818
+ ldsMobileInstrumentation.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
42819
+ }
42820
+ function reportGraphqlQueryInstrumentation(data) {
42821
+ const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
42822
+ const recordBuckets = [
42823
+ 1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
42824
+ ];
42825
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
42826
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
42827
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
42828
+ ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
42829
+ }
42830
+ function incrementGraphQLRefreshUndfined() {
42831
+ ldsMobileInstrumentation.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
42832
+ }
42833
+ function reportDraftActionEvent(state, draftCount, message) {
42834
+ if (nimbusLogger) {
42835
+ nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
42836
+ }
42837
+ switch (state) {
42838
+ case 'added':
42839
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
42840
+ break;
42841
+ case 'uploading':
42842
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
42843
+ break;
42844
+ case 'completed':
42845
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
42846
+ break;
42847
+ case 'deleted':
42848
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
42849
+ break;
42850
+ case 'failed':
42851
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
42852
+ break;
42853
+ case 'updated':
42854
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
42855
+ break;
42856
+ }
42857
+ }
42858
+ function reportDraftQueueState(state, draftCount) {
42859
+ if (nimbusLogger) {
42860
+ nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
42861
+ }
42862
+ switch (state) {
42863
+ case 'started':
42864
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
42865
+ break;
42866
+ case 'error':
42867
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
42868
+ break;
42869
+ case 'waiting':
42870
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
42871
+ break;
42872
+ case 'stopped':
42873
+ ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
42874
+ break;
42875
+ }
42876
+ }
42877
+ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
42878
+ let error;
42879
+ if (err.body !== undefined) {
42880
+ error = err.body;
42881
+ }
42882
+ else {
42883
+ error = normalizeError(err);
42884
+ }
42885
+ const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
42886
+ const errorType = error.errorType;
42887
+ const tags = {
42888
+ errorCode,
42889
+ };
42890
+ if (errorType !== undefined) {
42891
+ tags.errorType = errorType;
42892
+ }
42893
+ // Metric
42894
+ ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
42895
+ // Log
42896
+ ldsMobileInstrumentation.error(error, errorCode);
42897
+ }
42898
+ function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
42899
+ ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
42900
+ }
42901
+ /** Priming */
42902
+ function reportPrimingSessionCreated() {
42903
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
42904
+ }
42905
+ function reportPrimingError(errorType, recordCount) {
42906
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
42907
+ errorType,
42908
+ });
42909
+ }
42910
+ function reportPrimingSuccess(recordCount) {
42911
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
42912
+ }
42913
+ function reportPrimingConflict(resolutionType, recordCount) {
42914
+ ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
42915
+ resolutionType,
42916
+ });
42917
+ }
42918
+ /** Network */
42919
+ function reportChunkCandidateUrlLength(urlLength) {
42920
+ const buckets = [8000, 10000, 12000, 14000, 16000];
42921
+ ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
42922
+ }
42923
+
42719
42924
  const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
42720
42925
  class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestActionHandler {
42721
42926
  constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
@@ -42726,6 +42931,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
42726
42931
  this.objectInfoService = objectInfoService;
42727
42932
  this.getRecord = getRecord;
42728
42933
  this.handlerId = QUICK_ACTION_HANDLER;
42934
+ this.instrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
42729
42935
  draftRecordService.registerRecordHandler(this);
42730
42936
  }
42731
42937
  async draftActionToSideEffects(queueEntry) {
@@ -42757,10 +42963,26 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
42757
42963
  luvio.storeIngest(key, ingestQuickActionExecutionRepresentation, response);
42758
42964
  }
42759
42965
  async handleActionCompleted(action, queueOperations) {
42966
+ /* performQuickAction will not return the new record itself, so before the action
42967
+ * is marked as completed, we need to fetch the actual record. This must be done before
42968
+ * the super method is called because the super method will revert the side effects that
42969
+ * were created for this action, and critically that means evicting the synthetic record
42970
+ * that was created to represent the draft of what would become the canonical record.
42971
+ * Since getRecord is a network call, it is better to have a small timeframe (on the order
42972
+ * of microseconds) where both the synthetic record and the canonical record are in the
42973
+ * store instead of the record missing from the store for the entire duration of the
42974
+ * network call.
42975
+ */
42976
+ try {
42977
+ await this.fetchRecordIntoStoreFromCompletedAction(action);
42978
+ }
42979
+ catch (error) {
42980
+ this.instrumentation.error(error, 'Error fetching the record created from performQuickAction adapter.');
42981
+ }
42760
42982
  await super.handleActionCompleted(action, queueOperations);
42761
- this.getLuvio();
42983
+ }
42984
+ async fetchRecordIntoStoreFromCompletedAction(action) {
42762
42985
  const canonicalId = action.response.body.id;
42763
- this.buildTagForTargetId(canonicalId);
42764
42986
  const prefix = canonicalId.substring(0, 3);
42765
42987
  if (prefix.length !== 3) {
42766
42988
  // if we can't get a prefix, don't do the rest
@@ -51165,211 +51387,6 @@ class NimbusDraftQueue {
51165
51387
  }
51166
51388
  }
51167
51389
 
51168
- function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
51169
- if (adapterRequestContext === undefined) {
51170
- return { eventObservers: observers };
51171
- }
51172
- if (adapterRequestContext.eventObservers === undefined) {
51173
- return { ...adapterRequestContext, eventObservers: observers };
51174
- }
51175
- return {
51176
- ...adapterRequestContext,
51177
- eventObservers: adapterRequestContext.eventObservers.concat(observers),
51178
- };
51179
- }
51180
- /**
51181
- * Use this method to sanitize the unknown error object when
51182
- * we are unsure of the type of the error thrown
51183
- *
51184
- * @param err Unknown object to sanitize
51185
- * @returns an instance of error
51186
- */
51187
- function normalizeError(err) {
51188
- if (err instanceof Error) {
51189
- return err;
51190
- }
51191
- else if (typeof err === 'string') {
51192
- return new Error(err);
51193
- }
51194
- return new Error(stringify$2(err));
51195
- }
51196
-
51197
- const O11Y_NAMESPACE_LDS_MOBILE = 'lds-mobile';
51198
- // metrics
51199
- /** GraphQL */
51200
- const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
51201
- const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
51202
- const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
51203
- const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
51204
- const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
51205
- const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
51206
- const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
51207
- /** Draft Queue */
51208
- const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
51209
- const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
51210
- const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
51211
- const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
51212
- const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
51213
- const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
51214
- const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
51215
- const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
51216
- const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
51217
- const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
51218
- const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
51219
- /** Content Document */
51220
- const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
51221
- const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
51222
- /** Priming */
51223
- const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
51224
- const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
51225
- const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
51226
- const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
51227
- // logs
51228
- const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
51229
- const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
51230
- const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
51231
- const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
51232
- const ldsMobileInstrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
51233
- const nimbusLogger = typeof __nimbus !== 'undefined' &&
51234
- __nimbus.plugins !== undefined &&
51235
- __nimbus.plugins.JSLoggerPlugin !== undefined
51236
- ? __nimbus.plugins.JSLoggerPlugin
51237
- : undefined;
51238
- function reportGraphqlQueryParseError(err) {
51239
- const error = normalizeError(err);
51240
- const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
51241
- // Metric
51242
- reportGraphqlAdapterError(errorCode);
51243
- // Log
51244
- ldsMobileInstrumentation.error(error, errorCode);
51245
- }
51246
- function reportGraphqlSqlEvalPreconditionError(err) {
51247
- const error = normalizeError(err);
51248
- const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
51249
- // Metric
51250
- reportGraphqlAdapterError(errorCode);
51251
- // Log
51252
- ldsMobileInstrumentation.error(error, errorCode);
51253
- }
51254
- function reportGraphqlCreateSnapshotError(err) {
51255
- const error = normalizeError(err);
51256
- const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
51257
- // Metric
51258
- reportGraphqlAdapterError(errorCode);
51259
- // Log
51260
- ldsMobileInstrumentation.error(error, errorCode);
51261
- }
51262
- function reportGraphQlEvalDbReadDuration(duration) {
51263
- ldsMobileInstrumentation.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
51264
- }
51265
- function reportGraphqlAdapterError(errorCode) {
51266
- // Increment overall count with errorCode as tag
51267
- ldsMobileInstrumentation.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
51268
- }
51269
- function reportGraphqlQueryInstrumentation(data) {
51270
- const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
51271
- const recordBuckets = [
51272
- 1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
51273
- ];
51274
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
51275
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
51276
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
51277
- ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
51278
- }
51279
- function incrementGraphQLRefreshUndfined() {
51280
- ldsMobileInstrumentation.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
51281
- }
51282
- function reportDraftActionEvent(state, draftCount, message) {
51283
- if (nimbusLogger) {
51284
- nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
51285
- }
51286
- switch (state) {
51287
- case 'added':
51288
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
51289
- break;
51290
- case 'uploading':
51291
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
51292
- break;
51293
- case 'completed':
51294
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
51295
- break;
51296
- case 'deleted':
51297
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
51298
- break;
51299
- case 'failed':
51300
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
51301
- break;
51302
- case 'updated':
51303
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
51304
- break;
51305
- }
51306
- }
51307
- function reportDraftQueueState(state, draftCount) {
51308
- if (nimbusLogger) {
51309
- nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
51310
- }
51311
- switch (state) {
51312
- case 'started':
51313
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
51314
- break;
51315
- case 'error':
51316
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
51317
- break;
51318
- case 'waiting':
51319
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
51320
- break;
51321
- case 'stopped':
51322
- ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
51323
- break;
51324
- }
51325
- }
51326
- function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
51327
- let error;
51328
- if (err.body !== undefined) {
51329
- error = err.body;
51330
- }
51331
- else {
51332
- error = normalizeError(err);
51333
- }
51334
- const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
51335
- const errorType = error.errorType;
51336
- const tags = {
51337
- errorCode,
51338
- };
51339
- if (errorType !== undefined) {
51340
- tags.errorType = errorType;
51341
- }
51342
- // Metric
51343
- ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
51344
- // Log
51345
- ldsMobileInstrumentation.error(error, errorCode);
51346
- }
51347
- function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
51348
- ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
51349
- }
51350
- /** Priming */
51351
- function reportPrimingSessionCreated() {
51352
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
51353
- }
51354
- function reportPrimingError(errorType, recordCount) {
51355
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
51356
- errorType,
51357
- });
51358
- }
51359
- function reportPrimingSuccess(recordCount) {
51360
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
51361
- }
51362
- function reportPrimingConflict(resolutionType, recordCount) {
51363
- ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
51364
- resolutionType,
51365
- });
51366
- }
51367
- /** Network */
51368
- function reportChunkCandidateUrlLength(urlLength) {
51369
- const buckets = [8000, 10000, 12000, 14000, 16000];
51370
- ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
51371
- }
51372
-
51373
51390
  /**
51374
51391
  * HOF (high-order-function) that instruments any async operation. If the operation
51375
51392
  * has an error then the hasError param will be set on the call to o11y.incrementCounter
@@ -52058,6 +52075,9 @@ class LdsInternalDataTable {
52058
52075
  }
52059
52076
 
52060
52077
  const tasker = idleDetector.declareNotifierTaskMulti('NimbusSqliteStore');
52078
+ const instrumentation$2 = getInstrumentation('lds-mobile');
52079
+ const GRAPHQL_QUERY_ROOT_KEY = 'UiApi::uiapi::Query[uiapi]__uiapi__query';
52080
+ const GRAPHQL_QUERY_ROOT_METRIC_NAME = 'gql-query-root-object-size';
52061
52081
  class NimbusSqliteStore {
52062
52082
  constructor(plugin, additionalTableMap = {}) {
52063
52083
  this.plugin = plugin;
@@ -52109,6 +52129,9 @@ class NimbusSqliteStore {
52109
52129
  }
52110
52130
  const table = this.getTable(segment);
52111
52131
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
52132
+ if (entries[GRAPHQL_QUERY_ROOT_KEY]) {
52133
+ this.trackGraphQLQueryRootSize(upsertOperation);
52134
+ }
52112
52135
  return this.batchOperationAsPromise([upsertOperation]);
52113
52136
  }
52114
52137
  setMetadata(entries, segment) {
@@ -52124,7 +52147,11 @@ class NimbusSqliteStore {
52124
52147
  if (cur.type === 'setEntries') {
52125
52148
  if (keys(cur.entries).length > 0) {
52126
52149
  const table = this.getTable(cur.segment);
52127
- acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
52150
+ const upsertOperation = table.entriesToUpsertOperations(cur.entries, cur.segment);
52151
+ if (cur.entries[GRAPHQL_QUERY_ROOT_KEY]) {
52152
+ this.trackGraphQLQueryRootSize(upsertOperation);
52153
+ }
52154
+ acc.push(upsertOperation);
52128
52155
  }
52129
52156
  }
52130
52157
  else if (cur.type === 'setMetadata') {
@@ -52209,6 +52236,19 @@ class NimbusSqliteStore {
52209
52236
  });
52210
52237
  }).finally(() => tasker.done());
52211
52238
  }
52239
+ trackGraphQLQueryRootSize(upsertOperation) {
52240
+ try {
52241
+ if (upsertOperation.type !== 'upsert') {
52242
+ return;
52243
+ }
52244
+ const row = upsertOperation.rows.find((r) => r[0] === GRAPHQL_QUERY_ROOT_KEY);
52245
+ if (!(row && row[1] && typeof row[1] === 'string')) {
52246
+ return;
52247
+ }
52248
+ instrumentation$2.trackValue(GRAPHQL_QUERY_ROOT_METRIC_NAME, row[1].length);
52249
+ }
52250
+ catch { }
52251
+ }
52212
52252
  }
52213
52253
 
52214
52254
  // These const values must be in sync with the latest
@@ -55763,4 +55803,4 @@ register({
55763
55803
  });
55764
55804
 
55765
55805
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, registerReportObserver, reportGraphqlQueryParseError };
55766
- // version: 1.354.0-dev11-5ded66ad52
55806
+ // version: 1.354.0-dev13-f27ca1a3a7
@@ -20,6 +20,7 @@ export declare class QuickActionExecutionRepresentationHandler extends AbstractR
20
20
  private readonly objectInfoService;
21
21
  private readonly getRecord;
22
22
  handlerId: string;
23
+ private readonly instrumentation;
23
24
  constructor(getLuvio: () => Luvio, draftRecordService: UiApiDraftRecordService, draftQueue: DraftQueue, networkAdapter: NetworkAdapter, isDraftId: (targetId: string) => boolean, sideEffectService: SideEffectService, objectInfoService: ObjectInfoService, getRecord: Adapter<GetRecordConfig, RecordRepresentation>);
24
25
  draftActionToSideEffects(queueEntry: DraftAction<PerformQuickActionResourceRequest, QuickActionExecutionRepresentation>): Promise<SideEffect[]>;
25
26
  getIdFromRequest(request: ResourceRequest): Promise<string>;
@@ -28,6 +29,7 @@ export declare class QuickActionExecutionRepresentationHandler extends AbstractR
28
29
  buildCacheKeysFromResponse(_response: QuickActionExecutionRepresentation): DurableStoreKeyMetadataMap;
29
30
  synchronousIngest(response: QuickActionExecutionRepresentation): void;
30
31
  handleActionCompleted(action: CompletedDraftAction<ResourceRequest, QuickActionExecutionRepresentation>, queueOperations: QueueOperation[]): Promise<void>;
32
+ private fetchRecordIntoStoreFromCompletedAction;
31
33
  private allFields;
32
34
  mergeRequestBody<T>(): T;
33
35
  }