@wix/data-resourceusage-service 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/data-resourceusage-service",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -18,7 +18,7 @@
18
18
  "type-bundles"
19
19
  ],
20
20
  "dependencies": {
21
- "@wix/data-resourceusage-service_data": "1.0.1"
21
+ "@wix/data-resourceusage-service_data": "1.0.3"
22
22
  },
23
23
  "devDependencies": {
24
24
  "glob": "^10.4.1",
@@ -42,5 +42,5 @@
42
42
  "fqdn": ""
43
43
  }
44
44
  },
45
- "falconPackageHash": "c462aa04e47589d7238874705692fc4a0a0e29ece62a447bef9141ef"
45
+ "falconPackageHash": "732284bd09fe5b555725ef23507c54cf616ebeff19e03581ec948e45"
46
46
  }
@@ -59,19 +59,320 @@ declare enum CollectionType {
59
59
  /** Collection located in externally connected storage. */
60
60
  EXTERNAL = "EXTERNAL"
61
61
  }
62
+ interface GetResourceUsageRequest {
63
+ /** ResourceUsage fields to return, if empty all are returned */
64
+ fields?: string[];
65
+ /** If true, operation queries collections for up-to-date values (rather than using cached values) */
66
+ consistentRead?: boolean;
67
+ }
62
68
  interface GetResourceUsageResponse {
63
69
  /** The retrieved ResourceUsage */
64
70
  resourceUsage?: ResourceUsage;
65
71
  }
72
+ interface BulkUpdateUsagesRequest {
73
+ updates?: InstanceUsageUpdate[];
74
+ }
75
+ interface DataCollectionResourceUsageUpdate {
76
+ /** Data Collection ID */
77
+ dataCollectionId?: string;
78
+ /** if true present values are added to existing, otherwise values are replaced */
79
+ relative?: boolean;
80
+ /** Data Collection item count in the live environment */
81
+ liveItemCount?: string | null;
82
+ /** Data Collection item count in the sandbox environment */
83
+ sandboxItemCount?: string | null;
84
+ /** Data Collection used storage in bytes in the live environment */
85
+ liveUsedStorageInBytes?: string | null;
86
+ /** Data Collection used storage in bytes in the sandbox environment */
87
+ sandboxUsedStorageInBytes?: string | null;
88
+ }
89
+ declare enum Segment {
90
+ BOTH = "BOTH",
91
+ LIVE = "LIVE",
92
+ SANDBOX = "SANDBOX"
93
+ }
94
+ interface InstanceUsageUpdate {
95
+ /** Data Instance ID */
96
+ instanceId?: string;
97
+ /** Usage updates per collection */
98
+ collections?: DataCollectionResourceUsageUpdate[];
99
+ /** if true all collections not in the list assumed to have 0 usage */
100
+ allCollectionsPresent?: boolean;
101
+ /** Indicates which segment is being updated */
102
+ segment?: Segment;
103
+ }
104
+ interface BulkUpdateUsagesResponse {
105
+ }
106
+ interface GetStoredUsageRequest {
107
+ instanceId?: string;
108
+ }
109
+ interface GetStoredUsageResponse {
110
+ usages?: DataCollectionResourceUsage[];
111
+ }
112
+ interface DomainEvent extends DomainEventBodyOneOf {
113
+ createdEvent?: EntityCreatedEvent;
114
+ updatedEvent?: EntityUpdatedEvent;
115
+ deletedEvent?: EntityDeletedEvent;
116
+ actionEvent?: ActionEvent;
117
+ /**
118
+ * Unique event ID.
119
+ * Allows clients to ignore duplicate webhooks.
120
+ */
121
+ _id?: string;
122
+ /**
123
+ * Assumes actions are also always typed to an entity_type
124
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
125
+ */
126
+ entityFqdn?: string;
127
+ /**
128
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
129
+ * This is although the created/updated/deleted notion is duplication of the oneof types
130
+ * Example: created/updated/deleted/started/completed/email_opened
131
+ */
132
+ slug?: string;
133
+ /** ID of the entity associated with the event. */
134
+ entityId?: string;
135
+ /** Event timestamp. */
136
+ eventTime?: Date;
137
+ /**
138
+ * Whether the event was triggered as a result of a privacy regulation application
139
+ * (for example, GDPR).
140
+ */
141
+ triggeredByAnonymizeRequest?: boolean | null;
142
+ /** If present, indicates the action that triggered the event. */
143
+ originatedFrom?: string | null;
144
+ /**
145
+ * A sequence number defining the order of updates to the underlying entity.
146
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
147
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
148
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
149
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
150
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
151
+ */
152
+ entityEventSequence?: string | null;
153
+ }
154
+ /** @oneof */
155
+ interface DomainEventBodyOneOf {
156
+ createdEvent?: EntityCreatedEvent;
157
+ updatedEvent?: EntityUpdatedEvent;
158
+ deletedEvent?: EntityDeletedEvent;
159
+ actionEvent?: ActionEvent;
160
+ }
161
+ interface EntityCreatedEvent {
162
+ entity?: string;
163
+ }
164
+ interface EntityUpdatedEvent {
165
+ /**
166
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
167
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
168
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
169
+ */
170
+ currentEntity?: string;
171
+ }
172
+ interface EntityDeletedEvent {
173
+ /** Entity that was deleted */
174
+ deletedEntity?: string | null;
175
+ }
176
+ interface ActionEvent {
177
+ body?: string;
178
+ }
179
+ interface Empty {
180
+ }
181
+ interface DataChangeEvent extends DataChangeEventEventOneOf {
182
+ dataChanged?: DataChanged;
183
+ /** resume point is lost so some changes may be lost */
184
+ changesLost?: ChangesLost;
185
+ referenceChanged?: ReferenceChanged;
186
+ /** segment access or mapping changed */
187
+ segmentChanged?: SegmentChanged;
188
+ /** segment migration started to new physical location */
189
+ segmentMigrationStarted?: SegmentMigrationStarted;
190
+ }
191
+ /** @oneof */
192
+ interface DataChangeEventEventOneOf {
193
+ dataChanged?: DataChanged;
194
+ /** resume point is lost so some changes may be lost */
195
+ changesLost?: ChangesLost;
196
+ referenceChanged?: ReferenceChanged;
197
+ /** segment access or mapping changed */
198
+ segmentChanged?: SegmentChanged;
199
+ /** segment migration started to new physical location */
200
+ segmentMigrationStarted?: SegmentMigrationStarted;
201
+ }
202
+ interface DataChanged extends DataChangedChangeOneOf {
203
+ /** inserted document */
204
+ inserted?: Record<string, any> | null;
205
+ /** full replaced document */
206
+ replaced?: Record<string, any> | null;
207
+ /** partial update, removed fields are set to Empty */
208
+ partial?: Record<string, any> | null;
209
+ /** deleted document ID */
210
+ removedId?: string;
211
+ /** physical cluster ID */
212
+ clusterId?: string;
213
+ /**
214
+ * physical source
215
+ * db.collection for MongoDB
216
+ */
217
+ source?: string;
218
+ /** instance ID */
219
+ tenantId?: string;
220
+ /** logical collection name */
221
+ collectionName?: string;
222
+ dataStore?: DataStore;
223
+ documentId?: string;
224
+ clusterTime?: Date;
225
+ /** raw resume token BSON */
226
+ resumeToken?: string;
227
+ /** Initiator of the request */
228
+ initiator?: Initiator;
229
+ }
230
+ /** @oneof */
231
+ interface DataChangedChangeOneOf {
232
+ /** inserted document */
233
+ inserted?: Record<string, any> | null;
234
+ /** full replaced document */
235
+ replaced?: Record<string, any> | null;
236
+ /** partial update, removed fields are set to Empty */
237
+ partial?: Record<string, any> | null;
238
+ /** deleted document ID */
239
+ removedId?: string;
240
+ }
241
+ declare enum Type {
242
+ /** Initiator is unknown */
243
+ Unknown = "Unknown",
244
+ /** Indicated that write has been initiated by SSR indexer */
245
+ SsrIndexer = "SsrIndexer"
246
+ }
247
+ declare enum DataStore {
248
+ Dev = "Dev",
249
+ Public = "Public"
250
+ }
251
+ interface Initiator {
252
+ type?: Type;
253
+ }
254
+ interface ChangesLost {
255
+ clusterId?: string;
256
+ }
257
+ interface ReferenceChanged {
258
+ /** physical cluster ID */
259
+ clusterId?: string;
260
+ /**
261
+ * physical source
262
+ * db.collection for MongoDB
263
+ */
264
+ source?: string;
265
+ /** instance ID */
266
+ tenantId?: string;
267
+ dataStore?: DataStore;
268
+ relationshipName?: string;
269
+ leftId?: string;
270
+ rightId?: string;
271
+ /** if reference is set or unset */
272
+ isRemoved?: boolean;
273
+ clusterTime?: Date;
274
+ /** raw resume token BSON */
275
+ resumeToken?: string;
276
+ /** ref created date */
277
+ createdAt?: Date;
278
+ }
279
+ interface SegmentChanged {
280
+ /** physical cluster ID */
281
+ clusterId?: string;
282
+ /**
283
+ * physical source
284
+ * db.collection for MongoDB
285
+ */
286
+ source?: string;
287
+ /** instance ID */
288
+ tenantId?: string;
289
+ /** segment */
290
+ dataStore?: DataStore;
291
+ /** new db name if changed */
292
+ newDatabase?: string | null;
293
+ /** new cluster if changed */
294
+ newClusterId?: string | null;
295
+ /** read permissions if changed */
296
+ readsEnabled?: boolean | null;
297
+ /** write permissions if changed */
298
+ writesEnabled?: boolean | null;
299
+ /** event time */
300
+ clusterTime?: Date;
301
+ /** raw resume token BSON */
302
+ resumeToken?: string;
303
+ }
304
+ interface SegmentMigrationStarted {
305
+ /** physical cluster ID */
306
+ clusterId?: string;
307
+ /**
308
+ * physical source
309
+ * db.collection for MongoDB
310
+ */
311
+ source?: string;
312
+ /** instance ID */
313
+ tenantId?: string;
314
+ /** segment */
315
+ dataStore?: DataStore;
316
+ /** new db name if changed */
317
+ newDatabase?: string;
318
+ /** new cluster if changed */
319
+ newClusterId?: string;
320
+ /** event time */
321
+ clusterTime?: Date;
322
+ /** raw resume token BSON */
323
+ resumeToken?: string;
324
+ }
325
+ interface MessageEnvelope {
326
+ /** App instance ID. */
327
+ instanceId?: string | null;
328
+ /** Event type. */
329
+ eventType?: string;
330
+ /** The identification type and identity data. */
331
+ identity?: IdentificationData;
332
+ /** Stringify payload. */
333
+ data?: string;
334
+ }
335
+ interface IdentificationData extends IdentificationDataIdOneOf {
336
+ /** ID of a site visitor that has not logged in to the site. */
337
+ anonymousVisitorId?: string;
338
+ /** ID of a site visitor that has logged in to the site. */
339
+ memberId?: string;
340
+ /** ID of a Wix user (site owner, contributor, etc.). */
341
+ wixUserId?: string;
342
+ /** ID of an app. */
343
+ appId?: string;
344
+ /** @readonly */
345
+ identityType?: WebhookIdentityType;
346
+ }
347
+ /** @oneof */
348
+ interface IdentificationDataIdOneOf {
349
+ /** ID of a site visitor that has not logged in to the site. */
350
+ anonymousVisitorId?: string;
351
+ /** ID of a site visitor that has logged in to the site. */
352
+ memberId?: string;
353
+ /** ID of a Wix user (site owner, contributor, etc.). */
354
+ wixUserId?: string;
355
+ /** ID of an app. */
356
+ appId?: string;
357
+ }
358
+ declare enum WebhookIdentityType {
359
+ UNKNOWN = "UNKNOWN",
360
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
361
+ MEMBER = "MEMBER",
362
+ WIX_USER = "WIX_USER",
363
+ APP = "APP"
364
+ }
365
+ interface DataCollectionResourceUsageNonNullableFields {
366
+ dataCollectionId: string;
367
+ liveItemCount: string;
368
+ liveUsedStorageInBytes: string;
369
+ dataCollectionType: CollectionType;
370
+ }
371
+ interface ResourceUsageNonNullableFields {
372
+ dataCollectionUsages: DataCollectionResourceUsageNonNullableFields[];
373
+ }
66
374
  interface GetResourceUsageResponseNonNullableFields {
67
- resourceUsage?: {
68
- dataCollectionUsages: {
69
- dataCollectionId: string;
70
- liveItemCount: string;
71
- liveUsedStorageInBytes: string;
72
- dataCollectionType: CollectionType;
73
- }[];
74
- };
375
+ resourceUsage?: ResourceUsageNonNullableFields;
75
376
  }
76
377
  interface GetResourceUsageOptions {
77
378
  /** ResourceUsage fields to return, if empty all are returned */
@@ -83,7 +384,8 @@ interface GetResourceUsageOptions {
83
384
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
84
385
  interface HttpClient {
85
386
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
86
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
387
+ fetchWithAuth: typeof fetch;
388
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
87
389
  }
88
390
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
89
391
  type HttpResponse<T = any> = {
@@ -113,13 +415,54 @@ declare global {
113
415
  }
114
416
  }
115
417
 
116
- declare function getResourceUsage$1(httpClient: HttpClient): (options?: GetResourceUsageOptions) => Promise<GetResourceUsageResponse & GetResourceUsageResponseNonNullableFields>;
418
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
117
419
 
118
- declare const getResourceUsage: BuildRESTFunction<typeof getResourceUsage$1>;
420
+ declare const getResourceUsage: ReturnType<typeof createRESTModule<typeof publicGetResourceUsage>>;
119
421
 
422
+ type context_ActionEvent = ActionEvent;
423
+ type context_BulkUpdateUsagesRequest = BulkUpdateUsagesRequest;
424
+ type context_BulkUpdateUsagesResponse = BulkUpdateUsagesResponse;
425
+ type context_ChangesLost = ChangesLost;
426
+ type context_CollectionType = CollectionType;
427
+ declare const context_CollectionType: typeof CollectionType;
428
+ type context_DataChangeEvent = DataChangeEvent;
429
+ type context_DataChangeEventEventOneOf = DataChangeEventEventOneOf;
430
+ type context_DataChanged = DataChanged;
431
+ type context_DataChangedChangeOneOf = DataChangedChangeOneOf;
432
+ type context_DataCollectionResourceUsage = DataCollectionResourceUsage;
433
+ type context_DataCollectionResourceUsageUpdate = DataCollectionResourceUsageUpdate;
434
+ type context_DataStore = DataStore;
435
+ declare const context_DataStore: typeof DataStore;
436
+ type context_DomainEvent = DomainEvent;
437
+ type context_DomainEventBodyOneOf = DomainEventBodyOneOf;
438
+ type context_Empty = Empty;
439
+ type context_EntityCreatedEvent = EntityCreatedEvent;
440
+ type context_EntityDeletedEvent = EntityDeletedEvent;
441
+ type context_EntityUpdatedEvent = EntityUpdatedEvent;
442
+ type context_GetResourceUsageOptions = GetResourceUsageOptions;
443
+ type context_GetResourceUsageRequest = GetResourceUsageRequest;
444
+ type context_GetResourceUsageResponse = GetResourceUsageResponse;
445
+ type context_GetResourceUsageResponseNonNullableFields = GetResourceUsageResponseNonNullableFields;
446
+ type context_GetStoredUsageRequest = GetStoredUsageRequest;
447
+ type context_GetStoredUsageResponse = GetStoredUsageResponse;
448
+ type context_IdentificationData = IdentificationData;
449
+ type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
450
+ type context_Initiator = Initiator;
451
+ type context_InstanceUsageUpdate = InstanceUsageUpdate;
452
+ type context_MessageEnvelope = MessageEnvelope;
453
+ type context_ReferenceChanged = ReferenceChanged;
454
+ type context_ResourceUsage = ResourceUsage;
455
+ type context_Segment = Segment;
456
+ declare const context_Segment: typeof Segment;
457
+ type context_SegmentChanged = SegmentChanged;
458
+ type context_SegmentMigrationStarted = SegmentMigrationStarted;
459
+ type context_Type = Type;
460
+ declare const context_Type: typeof Type;
461
+ type context_WebhookIdentityType = WebhookIdentityType;
462
+ declare const context_WebhookIdentityType: typeof WebhookIdentityType;
120
463
  declare const context_getResourceUsage: typeof getResourceUsage;
121
464
  declare namespace context {
122
- export { context_getResourceUsage as getResourceUsage };
465
+ export { type context_ActionEvent as ActionEvent, type context_BulkUpdateUsagesRequest as BulkUpdateUsagesRequest, type context_BulkUpdateUsagesResponse as BulkUpdateUsagesResponse, type context_ChangesLost as ChangesLost, context_CollectionType as CollectionType, type context_DataChangeEvent as DataChangeEvent, type context_DataChangeEventEventOneOf as DataChangeEventEventOneOf, type context_DataChanged as DataChanged, type context_DataChangedChangeOneOf as DataChangedChangeOneOf, type context_DataCollectionResourceUsage as DataCollectionResourceUsage, type context_DataCollectionResourceUsageUpdate as DataCollectionResourceUsageUpdate, context_DataStore as DataStore, type context_DomainEvent as DomainEvent, type context_DomainEventBodyOneOf as DomainEventBodyOneOf, type context_Empty as Empty, type context_EntityCreatedEvent as EntityCreatedEvent, type context_EntityDeletedEvent as EntityDeletedEvent, type context_EntityUpdatedEvent as EntityUpdatedEvent, type context_GetResourceUsageOptions as GetResourceUsageOptions, type context_GetResourceUsageRequest as GetResourceUsageRequest, type context_GetResourceUsageResponse as GetResourceUsageResponse, type context_GetResourceUsageResponseNonNullableFields as GetResourceUsageResponseNonNullableFields, type context_GetStoredUsageRequest as GetStoredUsageRequest, type context_GetStoredUsageResponse as GetStoredUsageResponse, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type context_Initiator as Initiator, type context_InstanceUsageUpdate as InstanceUsageUpdate, type context_MessageEnvelope as MessageEnvelope, type context_ReferenceChanged as ReferenceChanged, type context_ResourceUsage as ResourceUsage, context_Segment as Segment, type context_SegmentChanged as SegmentChanged, type context_SegmentMigrationStarted as SegmentMigrationStarted, context_Type as Type, context_WebhookIdentityType as WebhookIdentityType, context_getResourceUsage as getResourceUsage };
123
466
  }
124
467
 
125
468
  export { context as data };
@@ -362,15 +362,17 @@ declare enum WebhookIdentityType {
362
362
  WIX_USER = "WIX_USER",
363
363
  APP = "APP"
364
364
  }
365
+ interface DataCollectionResourceUsageNonNullableFields {
366
+ dataCollectionId: string;
367
+ liveItemCount: string;
368
+ liveUsedStorageInBytes: string;
369
+ dataCollectionType: CollectionType;
370
+ }
371
+ interface ResourceUsageNonNullableFields {
372
+ dataCollectionUsages: DataCollectionResourceUsageNonNullableFields[];
373
+ }
365
374
  interface GetResourceUsageResponseNonNullableFields {
366
- resourceUsage?: {
367
- dataCollectionUsages: {
368
- dataCollectionId: string;
369
- liveItemCount: string;
370
- liveUsedStorageInBytes: string;
371
- dataCollectionType: CollectionType;
372
- }[];
373
- };
375
+ resourceUsage?: ResourceUsageNonNullableFields;
374
376
  }
375
377
  interface GetResourceUsageOptions {
376
378
  /** ResourceUsage fields to return, if empty all are returned */
@@ -381,7 +383,8 @@ interface GetResourceUsageOptions {
381
383
 
382
384
  interface HttpClient {
383
385
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
384
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
386
+ fetchWithAuth: typeof fetch;
387
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
385
388
  }
386
389
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
387
390
  type HttpResponse<T = any> = {
@@ -69,15 +69,17 @@ interface GetResourceUsageResponse$1 {
69
69
  /** The retrieved ResourceUsage */
70
70
  resourceUsage?: ResourceUsage$1;
71
71
  }
72
+ interface DataCollectionResourceUsageNonNullableFields$1 {
73
+ dataCollectionId: string;
74
+ liveItemCount: string;
75
+ liveUsedStorageInBytes: string;
76
+ dataCollectionType: CollectionType$1;
77
+ }
78
+ interface ResourceUsageNonNullableFields$1 {
79
+ dataCollectionUsages: DataCollectionResourceUsageNonNullableFields$1[];
80
+ }
72
81
  interface GetResourceUsageResponseNonNullableFields$1 {
73
- resourceUsage?: {
74
- dataCollectionUsages: {
75
- dataCollectionId: string;
76
- liveItemCount: string;
77
- liveUsedStorageInBytes: string;
78
- dataCollectionType: CollectionType$1;
79
- }[];
80
- };
82
+ resourceUsage?: ResourceUsageNonNullableFields$1;
81
83
  }
82
84
 
83
85
  /** ResourceUsage describes site-wide resource limits and usage */
@@ -151,15 +153,17 @@ interface GetResourceUsageResponse {
151
153
  /** The retrieved ResourceUsage */
152
154
  resourceUsage?: ResourceUsage;
153
155
  }
156
+ interface DataCollectionResourceUsageNonNullableFields {
157
+ dataCollectionId: string;
158
+ liveItemCount: string;
159
+ liveUsedStorageInBytes: string;
160
+ dataCollectionType: CollectionType;
161
+ }
162
+ interface ResourceUsageNonNullableFields {
163
+ dataCollectionUsages: DataCollectionResourceUsageNonNullableFields[];
164
+ }
154
165
  interface GetResourceUsageResponseNonNullableFields {
155
- resourceUsage?: {
156
- dataCollectionUsages: {
157
- dataCollectionId: string;
158
- liveItemCount: string;
159
- liveUsedStorageInBytes: string;
160
- dataCollectionType: CollectionType;
161
- }[];
162
- };
166
+ resourceUsage?: ResourceUsageNonNullableFields;
163
167
  }
164
168
 
165
169
  type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {