{"version":3,"sources":["../../src/cloud-resourceusage-v1-resource-usage-data.universal.ts","../../src/cloud-resourceusage-v1-resource-usage-data.http.ts","../../src/cloud-resourceusage-v1-resource-usage-data.public.ts","../../src/cloud-resourceusage-v1-resource-usage-data.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n  renameKeysFromSDKRequestToRESTRequest,\n  renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixCloudResourceusageV1ResourceUsage from './cloud-resourceusage-v1-resource-usage-data.http.js';\n\n/** ResourceUsage describes site-wide resource limits and usage */\nexport interface ResourceUsage {\n  /**\n   * Used storage sum of Sandbox and Live environments, bytes\n   * Replaced by live_used_storage_in_bytes\n   * @deprecated\n   * @replacedBy live_used_storage_in_bytes + sandbox_used_storage_in_bytes\n   */\n  totalUsedStorageInBytes?: string | null;\n  /** Max storage, bytes */\n  totalUsedStorageInBytesLimit?: string | null;\n  /** Total number of native collections created */\n  collectionCount?: number | null;\n  /** Max number of native collections allowed */\n  collectionCountLimit?: number | null;\n  /**\n   * Total number of items in native collections sum of Sandbox and Live environments\n   * Replaced by live_item_count\n   * @deprecated\n   * @replacedBy live_item_count + sandbox_item_count\n   */\n  totalItemCount?: string | null;\n  /** Max number of items in native collections */\n  totalItemCountLimit?: string | null;\n  /** Resource usages per data collection */\n  dataCollectionUsages?: DataCollectionResourceUsage[];\n  /** Used storage in Live environment */\n  liveUsedStorageInBytes?: string | null;\n  /** Number of items in native collections in Live environment */\n  liveItemCount?: string | null;\n  /** Used storage in Sandbox environment */\n  sandboxUsedStorageInBytes?: string | null;\n  /** Number of items in native collections in Sandbox environment */\n  sandboxItemCount?: string | null;\n}\n\nexport interface DataCollectionResourceUsage {\n  /** Data Collection ID */\n  dataCollectionId?: string;\n  /** Data Collection display name */\n  displayName?: string | null;\n  /** Data Collection item count in the live environment */\n  liveItemCount?: string;\n  /** Data Collection item count in the sandbox environment, none if disabled */\n  sandboxItemCount?: string | null;\n  /** Data Collection used storage in bytes in the live environment */\n  liveUsedStorageInBytes?: string;\n  /** Data Collection used storage in bytes in the sandbox environment, none if disabled */\n  sandboxUsedStorageInBytes?: string | null;\n  /** Type of data collection, currently only NATIVE are returned in this API */\n  dataCollectionType?: CollectionTypeWithLiterals;\n  /** Indicates if the collection is deleted */\n  deleted?: boolean;\n}\n\nexport enum CollectionType {\n  /** User-created collection. */\n  NATIVE = 'NATIVE',\n  /** [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). */\n  WIX_APP = 'WIX_APP',\n  /** Collection created by a Wix Blocks app. */\n  BLOCKS_APP = 'BLOCKS_APP',\n  /** Collection located in externally connected storage. */\n  EXTERNAL = 'EXTERNAL',\n}\n\n/** @enumType */\nexport type CollectionTypeWithLiterals =\n  | CollectionType\n  | 'NATIVE'\n  | 'WIX_APP'\n  | 'BLOCKS_APP'\n  | 'EXTERNAL';\n\nexport interface GetResourceUsageRequest {\n  /** ResourceUsage fields to return, if empty all are returned */\n  fields?: string[];\n  /** If true, operation queries collections for up-to-date values (rather than using cached values) */\n  consistentRead?: boolean;\n}\n\nexport interface GetResourceUsageResponse {\n  /** The retrieved ResourceUsage */\n  resourceUsage?: ResourceUsage;\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n  createdEvent?: EntityCreatedEvent;\n  updatedEvent?: EntityUpdatedEvent;\n  deletedEvent?: EntityDeletedEvent;\n  actionEvent?: ActionEvent;\n  /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n  _id?: string;\n  /**\n   * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n   * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n   */\n  entityFqdn?: string;\n  /**\n   * Event action name, placed at the top level to make it easier for users to dispatch messages.\n   * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n   */\n  slug?: string;\n  /** ID of the entity associated with the event. */\n  entityId?: string;\n  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n  eventTime?: Date | null;\n  /**\n   * Whether the event was triggered as a result of a privacy regulation application\n   * (for example, GDPR).\n   */\n  triggeredByAnonymizeRequest?: boolean | null;\n  /** If present, indicates the action that triggered the event. */\n  originatedFrom?: string | null;\n  /**\n   * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n   * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n   */\n  entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n  createdEvent?: EntityCreatedEvent;\n  updatedEvent?: EntityUpdatedEvent;\n  deletedEvent?: EntityDeletedEvent;\n  actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n  entity?: string;\n}\n\nexport interface RestoreInfo {\n  deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n  /**\n   * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n   * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n   * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n   */\n  currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n  /** Entity that was deleted. */\n  deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n  body?: string;\n}\n\nexport interface Empty {}\n\n/**\n * Get current Resource Usage\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_DATA.RESOURCE_USAGE_READ\n * @fqn wix.cloud.resourceusage.v1.DataResourceUsageService.GetResourceUsage\n */\nexport async function getResourceUsage(\n  options?: GetResourceUsageOptions\n): Promise<\n  NonNullablePaths<\n    GetResourceUsageResponse,\n    | `resourceUsage.dataCollectionUsages`\n    | `resourceUsage.dataCollectionUsages.${number}.dataCollectionId`\n    | `resourceUsage.dataCollectionUsages.${number}.liveItemCount`\n    | `resourceUsage.dataCollectionUsages.${number}.liveUsedStorageInBytes`\n    | `resourceUsage.dataCollectionUsages.${number}.dataCollectionType`\n    | `resourceUsage.dataCollectionUsages.${number}.deleted`,\n    5\n  >\n> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[1] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({\n    fields: options?.fields,\n    consistentRead: options?.consistentRead,\n  });\n\n  const reqOpts =\n    ambassadorWixCloudResourceusageV1ResourceUsage.getResourceUsage(payload);\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n\n    return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: {\n          fields: '$[0].fields',\n          consistentRead: '$[0].consistentRead',\n        },\n        singleArgumentUnchanged: false,\n      },\n      ['options']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n\nexport interface GetResourceUsageOptions {\n  /** ResourceUsage fields to return, if empty all are returned */\n  fields?: string[];\n  /** If true, operation queries collections for up-to-date values (rather than using cached values) */\n  consistentRead?: boolean;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixCloudResourceusageV1DataResourceUsageServiceUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'editor._base_domain_': [\n      {\n        srcPath: '/_api/cloud-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n    'blocks._base_domain_': [\n      {\n        srcPath: '/_api/cloud-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n    'create.editorx': [\n      {\n        srcPath: '/_api/cloud-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/cloud-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n    _api_base_domain_: [\n      {\n        srcPath: '/_api/resourceusage.data-resource-usage',\n        destPath: '',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/wix-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/wix-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/wix-data/v1/resource-usage',\n        destPath: '/v1/resource-usage',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_data-resourceusage-service_data';\n\n/** Get current Resource Usage */\nexport function getResourceUsage(payload: object): RequestOptionsFactory<any> {\n  function __getResourceUsage({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.cloud.resourceusage.v1.resource_usage',\n      method: 'GET' as any,\n      methodFqn:\n        'wix.cloud.resourceusage.v1.DataResourceUsageService.GetResourceUsage',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveWixCloudResourceusageV1DataResourceUsageServiceUrl({\n        protoPath: '/v1/resource-usage',\n        data: payload,\n        host,\n      }),\n      params: toURLSearchParams(payload),\n    };\n\n    return metadata;\n  }\n\n  return __getResourceUsage;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n  GetResourceUsageOptions,\n  GetResourceUsageResponse,\n  getResourceUsage as universalGetResourceUsage,\n} from './cloud-resourceusage-v1-resource-usage-data.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/data-resourceusage-service' };\n\nexport function getResourceUsage(\n  httpClient: HttpClient\n): GetResourceUsageSignature {\n  return (options?: GetResourceUsageOptions) =>\n    universalGetResourceUsage(\n      options,\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface GetResourceUsageSignature {\n  /**\n   * Get current Resource Usage\n   */\n  (options?: GetResourceUsageOptions): Promise<\n    NonNullablePaths<\n      GetResourceUsageResponse,\n      | `resourceUsage.dataCollectionUsages`\n      | `resourceUsage.dataCollectionUsages.${number}.dataCollectionId`\n      | `resourceUsage.dataCollectionUsages.${number}.liveItemCount`\n      | `resourceUsage.dataCollectionUsages.${number}.liveUsedStorageInBytes`\n      | `resourceUsage.dataCollectionUsages.${number}.dataCollectionType`\n      | `resourceUsage.dataCollectionUsages.${number}.deleted`,\n      5\n    >\n  >;\n}\n\nexport {\n  ActionEvent,\n  CollectionType,\n  DataCollectionResourceUsage,\n  DomainEvent,\n  DomainEventBodyOneOf,\n  Empty,\n  EntityCreatedEvent,\n  EntityDeletedEvent,\n  EntityUpdatedEvent,\n  GetResourceUsageOptions,\n  GetResourceUsageRequest,\n  GetResourceUsageResponse,\n  ResourceUsage,\n  RestoreInfo,\n} from './cloud-resourceusage-v1-resource-usage-data.universal.js';\n","import { getResourceUsage as publicGetResourceUsage } from './cloud-resourceusage-v1-resource-usage-data.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const getResourceUsage: MaybeContext<\n  BuildRESTFunction<typeof publicGetResourceUsage> &\n    typeof publicGetResourceUsage\n> = /*#__PURE__*/ createRESTModule(publicGetResourceUsage);\n\nexport { CollectionType } from './cloud-resourceusage-v1-resource-usage-data.universal.js';\nexport {\n  ResourceUsage,\n  DataCollectionResourceUsage,\n  GetResourceUsageRequest,\n  GetResourceUsageResponse,\n  DomainEvent,\n  DomainEventBodyOneOf,\n  EntityCreatedEvent,\n  RestoreInfo,\n  EntityUpdatedEvent,\n  EntityDeletedEvent,\n  ActionEvent,\n  Empty,\n  GetResourceUsageOptions,\n} from './cloud-resourceusage-v1-resource-usage-data.universal.js';\nexport { CollectionTypeWithLiterals } from './cloud-resourceusage-v1-resource-usage-data.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS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