@atlaskit/editor-synced-block-provider 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/clients/block-service/blockService.js +92 -46
  3. package/dist/cjs/providers/block-service/blockServiceAPI.js +262 -75
  4. package/dist/cjs/providers/syncBlockProvider.js +85 -47
  5. package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +33 -6
  6. package/dist/es2019/clients/block-service/blockService.js +24 -0
  7. package/dist/es2019/providers/block-service/blockServiceAPI.js +105 -1
  8. package/dist/es2019/providers/syncBlockProvider.js +26 -13
  9. package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +31 -6
  10. package/dist/esm/clients/block-service/blockService.js +91 -45
  11. package/dist/esm/providers/block-service/blockServiceAPI.js +263 -74
  12. package/dist/esm/providers/syncBlockProvider.js +85 -47
  13. package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +33 -6
  14. package/dist/types/clients/block-service/blockService.d.ts +16 -0
  15. package/dist/types/providers/block-service/blockServiceAPI.d.ts +11 -0
  16. package/dist/types/providers/syncBlockProvider.d.ts +1 -1
  17. package/dist/types/providers/types.d.ts +1 -0
  18. package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +3 -0
  19. package/dist/types-ts4.5/clients/block-service/blockService.d.ts +16 -0
  20. package/dist/types-ts4.5/providers/block-service/blockServiceAPI.d.ts +11 -0
  21. package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +1 -1
  22. package/dist/types-ts4.5/providers/types.d.ts +1 -0
  23. package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +3 -0
  24. package/package.json +8 -2
@@ -1,5 +1,5 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
@@ -10,6 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
12
  import { useMemo } from 'react';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { getPageIdAndTypeFromConfluencePageAri } from '../clients/confluence/ari';
14
15
  import { fetchConfluencePageInfo } from '../clients/confluence/sourceInfo';
15
16
  import { SyncBlockError } from '../common/types';
@@ -66,7 +67,7 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
66
67
  }
67
68
 
68
69
  /**
69
- * Fetch the data from the fetch provider
70
+ * Fetch the data from the fetch provider using batch API
70
71
  *
71
72
  * @param nodes
72
73
  *
@@ -74,30 +75,66 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
74
75
  */
75
76
  }, {
76
77
  key: "fetchNodesData",
77
- value: function fetchNodesData(nodes) {
78
- var _this2 = this;
79
- var resourceIdSet = new Set(nodes.map(function (node) {
80
- return node.attrs.resourceId;
78
+ value: (function () {
79
+ var _fetchNodesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(nodes) {
80
+ var _this2 = this;
81
+ var resourceIdSet, resourceIds;
82
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
83
+ while (1) switch (_context.prev = _context.next) {
84
+ case 0:
85
+ resourceIdSet = new Set(nodes.map(function (node) {
86
+ return node.attrs.resourceId;
87
+ }));
88
+ resourceIds = _toConsumableArray(resourceIdSet);
89
+ if (!fg('platform_synced_block_dogfooding')) {
90
+ _context.next = 14;
91
+ break;
92
+ }
93
+ _context.prev = 3;
94
+ _context.next = 6;
95
+ return this.fetchProvider.batchFetchData(resourceIds);
96
+ case 6:
97
+ return _context.abrupt("return", _context.sent);
98
+ case 9:
99
+ _context.prev = 9;
100
+ _context.t0 = _context["catch"](3);
101
+ return _context.abrupt("return", resourceIds.map(function (resourceId) {
102
+ return {
103
+ error: SyncBlockError.Errored,
104
+ resourceId: resourceId
105
+ };
106
+ }));
107
+ case 12:
108
+ _context.next = 15;
109
+ break;
110
+ case 14:
111
+ return _context.abrupt("return", Promise.allSettled(resourceIds.map(function (resourceId) {
112
+ return _this2.fetchProvider.fetchData(resourceId).then(function (data) {
113
+ return data;
114
+ }, function () {
115
+ return {
116
+ error: SyncBlockError.Errored,
117
+ resourceId: resourceId
118
+ };
119
+ });
120
+ })).then(function (results) {
121
+ return results.filter(function (result) {
122
+ return result.status === 'fulfilled';
123
+ }).map(function (result) {
124
+ return result.value;
125
+ });
126
+ }));
127
+ case 15:
128
+ case "end":
129
+ return _context.stop();
130
+ }
131
+ }, _callee, this, [[3, 9]]);
81
132
  }));
82
- var resourceIds = _toConsumableArray(resourceIdSet);
83
- return Promise.allSettled(resourceIds.map(function (resourceId) {
84
- return _this2.fetchProvider.fetchData(resourceId).then(function (data) {
85
- return data;
86
- }, function () {
87
- return {
88
- error: SyncBlockError.Errored,
89
- resourceId: resourceId
90
- };
91
- });
92
- })).then(function (results) {
93
- return results.filter(function (result) {
94
- return result.status === 'fulfilled';
95
- }).map(function (result) {
96
- return result.value;
97
- });
98
- });
99
- }
100
-
133
+ function fetchNodesData(_x) {
134
+ return _fetchNodesData.apply(this, arguments);
135
+ }
136
+ return fetchNodesData;
137
+ }()
101
138
  /**
102
139
  * Write the data to the write provider
103
140
  *
@@ -107,22 +144,23 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
107
144
  * @returns Array of {resourceId?: string, error?: string}.
108
145
  * resourceId: resource id of the node if write successfully , error: reason for when write failed
109
146
  */
147
+ )
110
148
  }, {
111
149
  key: "writeNodesData",
112
150
  value: (function () {
113
- var _writeNodesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(nodes, data) {
151
+ var _writeNodesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(nodes, data) {
114
152
  var _this3 = this;
115
153
  var results;
116
- return _regeneratorRuntime.wrap(function _callee$(_context) {
117
- while (1) switch (_context.prev = _context.next) {
154
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
155
+ while (1) switch (_context2.prev = _context2.next) {
118
156
  case 0:
119
157
  if (this.writeProvider) {
120
- _context.next = 2;
158
+ _context2.next = 2;
121
159
  break;
122
160
  }
123
- return _context.abrupt("return", Promise.reject(new Error('Write provider not set')));
161
+ return _context2.abrupt("return", Promise.reject(new Error('Write provider not set')));
124
162
  case 2:
125
- _context.next = 4;
163
+ _context2.next = 4;
126
164
  return Promise.allSettled(nodes.map(function (_node, index) {
127
165
  var _this3$writeProvider;
128
166
  if (!_this3.writeProvider) {
@@ -134,8 +172,8 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
134
172
  return (_this3$writeProvider = _this3.writeProvider) === null || _this3$writeProvider === void 0 ? void 0 : _this3$writeProvider.writeData(data[index]);
135
173
  }));
136
174
  case 4:
137
- results = _context.sent;
138
- return _context.abrupt("return", results.map(function (result) {
175
+ results = _context2.sent;
176
+ return _context2.abrupt("return", results.map(function (result) {
139
177
  if (result.status === 'fulfilled') {
140
178
  return result.value;
141
179
  } else {
@@ -146,11 +184,11 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
146
184
  }));
147
185
  case 6:
148
186
  case "end":
149
- return _context.stop();
187
+ return _context2.stop();
150
188
  }
151
- }, _callee, this);
189
+ }, _callee2, this);
152
190
  }));
153
- function writeNodesData(_x, _x2) {
191
+ function writeNodesData(_x2, _x3) {
154
192
  return _writeNodesData.apply(this, arguments);
155
193
  }
156
194
  return writeNodesData;
@@ -180,19 +218,19 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
180
218
  }, {
181
219
  key: "deleteNodesData",
182
220
  value: (function () {
183
- var _deleteNodesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resourceIds) {
221
+ var _deleteNodesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resourceIds) {
184
222
  var _this4 = this;
185
223
  var results;
186
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
187
- while (1) switch (_context2.prev = _context2.next) {
224
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
225
+ while (1) switch (_context3.prev = _context3.next) {
188
226
  case 0:
189
227
  if (this.writeProvider) {
190
- _context2.next = 2;
228
+ _context3.next = 2;
191
229
  break;
192
230
  }
193
- return _context2.abrupt("return", Promise.reject(new Error('Write provider not set')));
231
+ return _context3.abrupt("return", Promise.reject(new Error('Write provider not set')));
194
232
  case 2:
195
- _context2.next = 4;
233
+ _context3.next = 4;
196
234
  return Promise.allSettled(resourceIds.map(function (resourceId) {
197
235
  if (!_this4.writeProvider) {
198
236
  return Promise.reject('Write provider not set');
@@ -200,8 +238,8 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
200
238
  return _this4.writeProvider.deleteData(resourceId);
201
239
  }));
202
240
  case 4:
203
- results = _context2.sent;
204
- return _context2.abrupt("return", results.map(function (result, index) {
241
+ results = _context3.sent;
242
+ return _context3.abrupt("return", results.map(function (result, index) {
205
243
  if (result.status === 'fulfilled') {
206
244
  return result.value;
207
245
  } else {
@@ -214,11 +252,11 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
214
252
  }));
215
253
  case 6:
216
254
  case "end":
217
- return _context2.stop();
255
+ return _context3.stop();
218
256
  }
219
- }, _callee2, this);
257
+ }, _callee3, this);
220
258
  }));
221
- function deleteNodesData(_x3) {
259
+ function deleteNodesData(_x4) {
222
260
  return _deleteNodesData.apply(this, arguments);
223
261
  }
224
262
  return deleteNodesData;
@@ -6,6 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import { logException } from '@atlaskit/editor-common/monitoring';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { SyncBlockError } from '../common/types';
10
11
  import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload } from '../utils/errorHandling';
11
12
  import { convertSyncBlockPMNodeToSyncBlockData } from '../utils/utils';
@@ -32,6 +33,11 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
32
33
  value: function setFireAnalyticsEvent(fireAnalyticsEvent) {
33
34
  this.fireAnalyticsEvent = fireAnalyticsEvent;
34
35
  }
36
+ }, {
37
+ key: "setCreateExperience",
38
+ value: function setCreateExperience(createExperience) {
39
+ this.createExperience = createExperience;
40
+ }
35
41
  }, {
36
42
  key: "isSourceBlock",
37
43
  value: function isSourceBlock(node) {
@@ -264,28 +270,49 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
264
270
  if (resourceId) {
265
271
  _this4.commitPendingCreation(true);
266
272
  } else {
267
- var _this4$fireAnalyticsE;
268
273
  _this4.commitPendingCreation(false);
269
- (_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block'));
274
+ if (fg('platform_synced_block_dogfooding')) {
275
+ var _this4$createExperien;
276
+ (_this4$createExperien = _this4.createExperience) === null || _this4$createExperien === void 0 || _this4$createExperien.failure({
277
+ reason: result.error || 'Failed to create bodied sync block'
278
+ });
279
+ } else {
280
+ var _this4$fireAnalyticsE;
281
+ (_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block'));
282
+ }
270
283
  }
271
284
  }).catch(function (error) {
272
- var _this4$fireAnalyticsE2;
273
285
  _this4.commitPendingCreation(false);
274
286
  logException(error, {
275
287
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
276
288
  });
277
- (_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, createErrorPayload(error.message));
289
+ if (fg('platform_synced_block_dogfooding')) {
290
+ var _this4$createExperien2;
291
+ (_this4$createExperien2 = _this4.createExperience) === null || _this4$createExperien2 === void 0 || _this4$createExperien2.failure({
292
+ reason: error.message
293
+ });
294
+ } else {
295
+ var _this4$fireAnalyticsE2;
296
+ (_this4$fireAnalyticsE2 = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE2 === void 0 || _this4$fireAnalyticsE2.call(_this4, createErrorPayload(error.message));
297
+ }
278
298
  });
279
299
  this.registerPendingCreation(resourceId);
280
300
  } catch (error) {
281
- var _this$fireAnalyticsEv3;
282
301
  if (this.hasPendingCreation()) {
283
302
  this.commitPendingCreation(false);
284
303
  }
285
304
  logException(error, {
286
305
  location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
287
306
  });
288
- (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, createErrorPayload(error.message));
307
+ if (fg('platform_synced_block_dogfooding')) {
308
+ var _this$createExperienc;
309
+ (_this$createExperienc = this.createExperience) === null || _this$createExperienc === void 0 || _this$createExperienc.failure({
310
+ reason: error.message
311
+ });
312
+ } else {
313
+ var _this$fireAnalyticsEv3;
314
+ (_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, createErrorPayload(error.message));
315
+ }
289
316
  }
290
317
  }
291
318
  }, {
@@ -90,11 +90,27 @@ type UpdateReferenceSyncedBlockOnDocumentRequest = {
90
90
  documentAri: string;
91
91
  noContent?: boolean;
92
92
  };
93
+ export type BatchRetrieveSyncedBlocksRequest = {
94
+ blockAris: string[];
95
+ };
96
+ export type BatchRetrieveSyncedBlocksResponse = {
97
+ error?: Array<BlockContentErrorResponse>;
98
+ success?: Array<BlockContentResponse>;
99
+ };
93
100
  export declare class BlockError extends Error {
94
101
  readonly status: number;
95
102
  constructor(status: number);
96
103
  }
97
104
  export declare const getSyncedBlockContent: ({ blockAri, }: GetSyncedBlockContentRequest) => Promise<BlockContentResponse>;
105
+ /**
106
+ * Batch retrieves multiple synced blocks by their ARIs.
107
+ *
108
+ * Calls the Block Service API endpoint: `POST /v1/block/batch-retrieve`
109
+ *
110
+ * @param blockAris - Array of block ARIs to retrieve
111
+ * @returns A promise containing arrays of successfully fetched blocks and any errors encountered
112
+ */
113
+ export declare const batchRetrieveSyncedBlocks: ({ blockAris, }: BatchRetrieveSyncedBlocksRequest) => Promise<BatchRetrieveSyncedBlocksResponse>;
98
114
  export declare const deleteSyncedBlock: ({ blockAri }: DeleteSyncedBlockRequest) => Promise<void>;
99
115
  export declare const updateSyncedBlock: ({ blockAri, content, stepVersion, }: UpdateSyncedBlockRequest) => Promise<void>;
100
116
  export declare const createSyncedBlock: ({ blockAri, blockInstanceId, sourceAri, product, content, stepVersion, }: CreateSyncedBlockRequest) => Promise<BlockContentResponse>;
@@ -11,6 +11,17 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
11
11
  private cloudId;
12
12
  constructor({ cloudId }: BlockServiceADFFetchProviderProps);
13
13
  fetchData(resourceId: string): Promise<SyncBlockInstance>;
14
+ /**
15
+ * Extracts the resourceId from a block ARI.
16
+ * Block ARI format: ari:cloud:blocks:<cloudId>:synced-block/<resourceId>
17
+ */
18
+ private extractResourceIdFromBlockAri;
19
+ /**
20
+ * Batch fetches multiple synced blocks by their resource IDs.
21
+ * @param resourceIds - Array of resource IDs to fetch
22
+ * @returns Array of SyncBlockInstance results
23
+ */
24
+ batchFetchData(resourceIds: string[]): Promise<SyncBlockInstance[]>;
14
25
  }
15
26
  interface BlockServiceADFWriteProviderProps {
16
27
  cloudId: string;
@@ -33,7 +33,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
33
33
  */
34
34
  nodeDataKey(node: SyncBlockNode): string;
35
35
  /**
36
- * Fetch the data from the fetch provider
36
+ * Fetch the data from the fetch provider using batch API
37
37
  *
38
38
  * @param nodes
39
39
  *
@@ -44,6 +44,7 @@ export type UpdateReferenceSyncBlockResult = {
44
44
  success: boolean;
45
45
  };
46
46
  export interface ADFFetchProvider {
47
+ batchFetchData: (resourceIds: ResourceId[]) => Promise<SyncBlockInstance[]>;
47
48
  fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
48
49
  }
49
50
  export interface ADFWriteProvider {
@@ -1,4 +1,5 @@
1
1
  import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
2
+ import type { Experience } from '@atlaskit/editor-common/experiences';
2
3
  import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import { type ResourceId, type SyncBlockAttrs } from '../common/types';
4
5
  import type { SyncBlockDataProvider } from '../providers/types';
@@ -15,8 +16,10 @@ export declare class SourceSyncBlockStoreManager {
15
16
  private deletionRetryInfo?;
16
17
  private pendingResourceId?;
17
18
  private creationCallback?;
19
+ createExperience: Experience | undefined;
18
20
  constructor(dataProvider?: SyncBlockDataProvider);
19
21
  setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
22
+ setCreateExperience(createExperience: Experience): void;
20
23
  isSourceBlock(node: PMNode): boolean;
21
24
  /**
22
25
  * Add/update a sync block node to/from the local cache
@@ -90,11 +90,27 @@ type UpdateReferenceSyncedBlockOnDocumentRequest = {
90
90
  documentAri: string;
91
91
  noContent?: boolean;
92
92
  };
93
+ export type BatchRetrieveSyncedBlocksRequest = {
94
+ blockAris: string[];
95
+ };
96
+ export type BatchRetrieveSyncedBlocksResponse = {
97
+ error?: Array<BlockContentErrorResponse>;
98
+ success?: Array<BlockContentResponse>;
99
+ };
93
100
  export declare class BlockError extends Error {
94
101
  readonly status: number;
95
102
  constructor(status: number);
96
103
  }
97
104
  export declare const getSyncedBlockContent: ({ blockAri, }: GetSyncedBlockContentRequest) => Promise<BlockContentResponse>;
105
+ /**
106
+ * Batch retrieves multiple synced blocks by their ARIs.
107
+ *
108
+ * Calls the Block Service API endpoint: `POST /v1/block/batch-retrieve`
109
+ *
110
+ * @param blockAris - Array of block ARIs to retrieve
111
+ * @returns A promise containing arrays of successfully fetched blocks and any errors encountered
112
+ */
113
+ export declare const batchRetrieveSyncedBlocks: ({ blockAris, }: BatchRetrieveSyncedBlocksRequest) => Promise<BatchRetrieveSyncedBlocksResponse>;
98
114
  export declare const deleteSyncedBlock: ({ blockAri }: DeleteSyncedBlockRequest) => Promise<void>;
99
115
  export declare const updateSyncedBlock: ({ blockAri, content, stepVersion, }: UpdateSyncedBlockRequest) => Promise<void>;
100
116
  export declare const createSyncedBlock: ({ blockAri, blockInstanceId, sourceAri, product, content, stepVersion, }: CreateSyncedBlockRequest) => Promise<BlockContentResponse>;
@@ -11,6 +11,17 @@ declare class BlockServiceADFFetchProvider implements ADFFetchProvider {
11
11
  private cloudId;
12
12
  constructor({ cloudId }: BlockServiceADFFetchProviderProps);
13
13
  fetchData(resourceId: string): Promise<SyncBlockInstance>;
14
+ /**
15
+ * Extracts the resourceId from a block ARI.
16
+ * Block ARI format: ari:cloud:blocks:<cloudId>:synced-block/<resourceId>
17
+ */
18
+ private extractResourceIdFromBlockAri;
19
+ /**
20
+ * Batch fetches multiple synced blocks by their resource IDs.
21
+ * @param resourceIds - Array of resource IDs to fetch
22
+ * @returns Array of SyncBlockInstance results
23
+ */
24
+ batchFetchData(resourceIds: string[]): Promise<SyncBlockInstance[]>;
14
25
  }
15
26
  interface BlockServiceADFWriteProviderProps {
16
27
  cloudId: string;
@@ -33,7 +33,7 @@ export declare class SyncBlockProvider extends SyncBlockDataProvider {
33
33
  */
34
34
  nodeDataKey(node: SyncBlockNode): string;
35
35
  /**
36
- * Fetch the data from the fetch provider
36
+ * Fetch the data from the fetch provider using batch API
37
37
  *
38
38
  * @param nodes
39
39
  *
@@ -44,6 +44,7 @@ export type UpdateReferenceSyncBlockResult = {
44
44
  success: boolean;
45
45
  };
46
46
  export interface ADFFetchProvider {
47
+ batchFetchData: (resourceIds: ResourceId[]) => Promise<SyncBlockInstance[]>;
47
48
  fetchData: (resourceId: ResourceId) => Promise<SyncBlockInstance>;
48
49
  }
49
50
  export interface ADFWriteProvider {
@@ -1,4 +1,5 @@
1
1
  import { type SyncBlockEventPayload } from '@atlaskit/editor-common/analytics';
2
+ import type { Experience } from '@atlaskit/editor-common/experiences';
2
3
  import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
4
  import { type ResourceId, type SyncBlockAttrs } from '../common/types';
4
5
  import type { SyncBlockDataProvider } from '../providers/types';
@@ -15,8 +16,10 @@ export declare class SourceSyncBlockStoreManager {
15
16
  private deletionRetryInfo?;
16
17
  private pendingResourceId?;
17
18
  private creationCallback?;
19
+ createExperience: Experience | undefined;
18
20
  constructor(dataProvider?: SyncBlockDataProvider);
19
21
  setFireAnalyticsEvent(fireAnalyticsEvent?: (payload: SyncBlockEventPayload) => void): void;
22
+ setCreateExperience(createExperience: Experience): void;
20
23
  isSourceBlock(node: PMNode): boolean;
21
24
  /**
22
25
  * Add/update a sync block node to/from the local cache
package/package.json CHANGED
@@ -28,12 +28,13 @@
28
28
  "@atlaskit/editor-json-transformer": "^8.31.0",
29
29
  "@atlaskit/editor-prosemirror": "^7.2.0",
30
30
  "@atlaskit/node-data-provider": "^8.0.0",
31
+ "@atlaskit/platform-feature-flags": "^1.1.0",
31
32
  "@babel/runtime": "^7.0.0",
32
33
  "@compiled/react": "^0.18.6",
33
34
  "uuid": "^3.1.0"
34
35
  },
35
36
  "peerDependencies": {
36
- "@atlaskit/editor-common": "^111.0.0",
37
+ "@atlaskit/editor-common": "^111.2.0",
37
38
  "react": "^18.2.0"
38
39
  },
39
40
  "devDependencies": {
@@ -76,11 +77,16 @@
76
77
  }
77
78
  },
78
79
  "name": "@atlaskit/editor-synced-block-provider",
79
- "version": "3.3.0",
80
+ "version": "3.4.1",
80
81
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
81
82
  "author": "Atlassian Pty Ltd",
82
83
  "license": "Apache-2.0",
83
84
  "publishConfig": {
84
85
  "registry": "https://registry.npmjs.org/"
86
+ },
87
+ "platform-feature-flags": {
88
+ "platform_synced_block_dogfooding": {
89
+ "type": "boolean"
90
+ }
85
91
  }
86
92
  }