{"version":3,"sources":["../node_modules/deepmerge/dist/cjs.js","../src/Dynamometer.ts","../src/utils/checkDocumentPath.ts","../src/utils/transformResponse.ts","../src/Document.ts","../src/utils/checkCollectionPath.ts","../src/Collection.ts"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","/**\n * Dynamometer: A utility class for working with AWS DynamoDB.\n *\n * This class provides a higher-level abstraction for interacting with DynamoDB tables.\n * It offers a simplified way to create and manage collections within a DynamoDB table.\n */\n\nimport { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb';\n\nimport { Collection, CollectionArgs } from './Collection';\n\n/**\n * Configuration type for Dynamometer.\n *\n * @property tableName - The name of the DynamoDB table.\n * @property generateId - Optional function to generate unique IDs.\n * @property delimiter - Optional delimiter used in composite keys.\n * @property partitionKey - Optional name for the partition key.\n * @property sortKey - Optional name for the sort key.\n * @property idField - Optional name for the ID field.\n */\nexport type DynamometerConfig = {\n  tableName: string;\n  generateId?: () => string;\n  delimiter?: string;\n  partitionKey?: string;\n  sortKey?: string;\n  idField?: string;\n};\n\n// Default configuration values for Dynamometer\nconst defaultConfig = {\n  delimiter: '#',\n  partitionKey: 'PK',\n  sortKey: 'SK',\n  idField: 'id',\n  generateId: () => crypto.randomUUID(),\n};\n\nexport class Dynamometer {\n  readonly dynamoDBDocument: DynamoDBDocument;\n\n  /**\n   * Private constructor to enforce the use of static factory methods.\n   *\n   * @param ddbDocClient - The DynamoDBDocument client.\n   * @param config - The configuration for the Dynamometer instance.\n   */\n  private constructor(\n    ddbDocClient: DynamoDBDocument,\n    readonly config: Required<DynamometerConfig>\n  ) {\n    this.dynamoDBDocument = ddbDocClient;\n  }\n\n  /**\n   * Static factory method to create a new Dynamometer instance.\n   *\n   * @param config - The configuration for the Dynamometer instance.\n   * @returns A new Dynamometer instance.\n   */\n  static create(config: DynamometerConfig): Dynamometer {\n    const dynamoDBDocument = DynamoDBDocument.from(new DynamoDBClient({}), {\n      marshallOptions: {\n        convertEmptyValues: false,\n        removeUndefinedValues: false,\n        convertClassInstanceToMap: false,\n      },\n      unmarshallOptions: {\n        wrapNumbers: false,\n      },\n    });\n\n    return new Dynamometer(dynamoDBDocument, {\n      tableName: config.tableName,\n      generateId: config.generateId ?? defaultConfig.generateId,\n      delimiter: config.delimiter ?? defaultConfig.delimiter,\n      partitionKey: config.partitionKey ?? defaultConfig.partitionKey,\n      sortKey: config.sortKey ?? defaultConfig.sortKey,\n      idField: config.idField ?? defaultConfig.idField,\n    });\n  }\n\n  /**\n   * Static factory method to create a new Dynamometer instance from an existing DynamoDBDocument.\n   *\n   * @param dynamoDBDocument - The existing DynamoDBDocument client.\n   * @param config - The configuration for the Dynamometer instance.\n   * @returns A new Dynamometer instance.\n   */\n  static fromDynamoDBDocument(\n    dynamoDBDocument: DynamoDBDocument,\n    config: DynamometerConfig\n  ) {\n    return new Dynamometer(\n      dynamoDBDocument,\n      Object.assign(defaultConfig, {\n        tableName: config.tableName,\n        generateId: config.generateId ?? defaultConfig.generateId,\n        delimiter: config.delimiter ?? defaultConfig.delimiter,\n        partitionKey: config.partitionKey ?? defaultConfig.partitionKey,\n        sortKey: config.sortKey ?? defaultConfig.sortKey,\n        idField: config.idField ?? defaultConfig.idField,\n      })\n    );\n  }\n\n  /**\n   * Create and return a new Collection instance.\n   *\n   * @param collectionPath - The path for the collection.\n   * @param args - Optional arguments for the collection.\n   * @returns A new Collection instance.\n   */\n  collection<T>(\n    collectionPath: string,\n    args?: CollectionArgs\n  ): Collection<T, undefined> {\n    return new Collection<T, undefined>(this, collectionPath);\n  }\n}\n","/**\n * checkDocumentPath: Validates the provided path for a document.\n *\n * This function checks if the provided path is valid for a document based on the specified delimiter.\n * It ensures that the path represents a document and not a collection.\n *\n * @param path - The path to be validated.\n * @param delimiter - The delimiter used in the path.\n *\n * @returns An array of segments from the path if the path is valid.\n *\n * @throws Error if the path represents a collection and not a document.\n */\nexport const checkDocumentPath = (path: string, delimiter: string) => {\n  const segments = path.split(delimiter);\n\n  if (segments.length % 2 == 1) {\n    throw new Error('This is a path for a Collection!');\n  }\n\n  return segments;\n};\n","import { DynamometerConfig } from '../Dynamometer';\n\n/**\n * transformResponse: Transforms a DynamoDB response into a desired format.\n *\n * This function takes a DynamoDB response and a configuration object, and returns the response\n * in a format where the sort key is replaced by a custom ID field. The partition key and sort key\n * are removed from the response, and the sort key's value is added back under a custom ID field.\n *\n * @template T - The type to which the response should be transformed.\n *\n * @param response - The original DynamoDB response to be transformed.\n * @param config - The configuration object containing details about the DynamoDB table structure.\n *\n * @returns The transformed response.\n */\nexport const transformResponse = <T>(\n  response: any,\n  config: Required<DynamometerConfig>\n): T => {\n  const {\n    [config.partitionKey]: partitionKey,\n    [config.sortKey]: sortKey,\n    ...rest\n  } = response;\n\n  return { ...rest, [config.idField]: sortKey } as T;\n};\n","/**\n * Document: Represents a single document within a DynamoDB table.\n *\n * This class provides methods to interact with a specific document within a DynamoDB table.\n * It allows for operations such as getting, setting, deleting, and updating the document.\n * Additionally, it provides a way to access sub-collections within the document.\n */\n\nimport { Collection, CollectionArgs } from './Collection';\nimport { Dynamometer } from './Dynamometer';\nimport { checkDocumentPath } from './utils/checkDocumentPath';\nimport { transformResponse } from './utils/transformResponse';\n// eslint-disable-next-line node/no-extraneous-import\nimport merge from 'deepmerge';\n\nexport class Document<Type, Parent = any> {\n  /**\n   * @param dynamometer - The Dynamometer instance associated with this document.\n   * @param _path - The path to the document within the DynamoDB table.\n   * @param id - The ID of the document.\n   * @param parent - The parent collection containing this document.\n   */\n  constructor(\n    readonly dynamometer: Dynamometer,\n    private readonly _path: string,\n    readonly id: string,\n    readonly parent: Parent\n  ) {\n    checkDocumentPath(this.path, dynamometer.config.delimiter);\n  }\n\n  /**\n   * Computes the full path to the document by appending the document ID to the provided path.\n   *\n   * @returns The full path to the document.\n   */\n  get path(): string {\n    return `${this._path}${this.dynamometer.config.delimiter}${this.id}`;\n  }\n\n  /**\n   * Create and return a new Collection instance within this document.\n   *\n   * @param collectionPath - The path for the sub-collection.\n   * @param args - Optional arguments for the sub-collection.\n   * @returns A new Collection instance.\n   */\n  collection<Type>(\n    collectionPath: string,\n    args?: CollectionArgs\n  ): Collection<Type, this> {\n    return new Collection<Type, this>(\n      this.dynamometer,\n      `${this.path}${this.dynamometer.config.delimiter}${collectionPath}`,\n      this,\n      args\n    );\n  }\n\n  /**\n   * Retrieve the data of this document from the DynamoDB table.\n   *\n   * @returns A promise that resolves with the document data.\n   */\n  async get(): Promise<Type | null> {\n    const response = await this.dynamometer.dynamoDBDocument.get({\n      TableName: this.dynamometer.config.tableName,\n      Key: {\n        [this.dynamometer.config.partitionKey]: this._path,\n        [this.dynamometer.config.sortKey]: this.id,\n      },\n    });\n\n    if (!response.Item) return null;\n\n    return transformResponse<Type>(response.Item, this.dynamometer.config);\n  }\n\n  /**\n   * Set or overwrite the data of this document in the DynamoDB table.\n   *\n   * @param data - The data to set for the document.\n   */\n  async set(data: any): Promise<void> {\n    await this.dynamometer.dynamoDBDocument.put({\n      TableName: this.dynamometer.config.tableName,\n      Item: {\n        [this.dynamometer.config.partitionKey]: this._path,\n        [this.dynamometer.config.sortKey]: this.id,\n        ...data,\n      },\n    });\n  }\n\n  /**\n   * Delete this document from the DynamoDB table.\n   */\n  async delete(): Promise<void> {\n    const response = await this.dynamometer.dynamoDBDocument.delete({\n      TableName: this.dynamometer.config.tableName,\n      Key: {\n        [this.dynamometer.config.partitionKey]: this._path,\n        [this.dynamometer.config.sortKey]: this.id,\n      },\n    });\n  }\n\n  /**\n   * Update the data of this document in the DynamoDB table.\n   *\n   * @param data - The data to update for the document.\n   */\n  async update(data: any): Promise<void> {\n    const response = await this.get();\n    await this.set(merge(response as any, data));\n  }\n}\n","/**\n * checkCollectionPath: Validates the provided path for a collection.\n *\n * This function checks if the provided path is valid for a collection based on the specified delimiter.\n * It ensures that:\n * 1. The path does not start with the delimiter.\n * 2. The path represents a collection and not a document.\n *\n * @param path - The path to be validated.\n * @param delimiter - The delimiter used in the path.\n *\n * @returns An array of segments from the path if the path is valid.\n *\n * @throws Error if the path starts with the delimiter.\n * @throws Error if the path represents a document and not a collection.\n */\nexport const checkCollectionPath = (path: string, delimiter: string) => {\n  if (path.charAt(0) === delimiter) {\n    throw new Error(`Collection name cannot start with char \"${delimiter}\".`);\n  }\n\n  const segments = path.split(delimiter);\n\n  if (segments.length % 2 == 0) {\n    throw new Error('This is a path for a document!');\n  }\n\n  return segments;\n};\n","/**\n * Collection: Represents a collection of documents within a DynamoDB table.\n *\n * This class provides methods to interact with a specific collection within a DynamoDB table.\n * It allows for operations such as querying, adding, and accessing individual documents within the collection.\n */\n\n// Import necessary modules\nimport { Document } from './Document';\nimport { Dynamometer } from './Dynamometer';\nimport { checkCollectionPath } from './utils/checkCollectionPath';\nimport { transformResponse } from './utils/transformResponse';\n\nexport type CollectionArgs = {\n  /**\n   * @description Adds a prefix to every document which is created within this collection.\n   * @example { prefix: 'COMMENT' } -> COMMENT#12345...\n   */\n  prefix?: string;\n};\n\nexport class Collection<Type, Parent = any> {\n  private beginsWithValue!: string;\n\n  /**\n   * @param dynamometer - The Dynamometer instance associated with this collection.\n   * @param path - The path to the collection within the DynamoDB table.\n   * @param parent - The parent document containing this collection (if any).\n   * @param args - Optional arguments for the collection.\n   */\n  constructor(\n    private readonly dynamometer: Dynamometer,\n    readonly path: string,\n    public parent?: Parent,\n    private readonly args?: CollectionArgs\n  ) {\n    checkCollectionPath(path, dynamometer.config.delimiter);\n  }\n\n  /**\n   * Retrieve all documents within this collection from the DynamoDB table.\n   *\n   * @returns A promise that resolves with an array of documents.\n   */\n  async get(): Promise<Array<Type>> {\n    const response = await this.dynamometer.dynamoDBDocument.query({\n      TableName: this.dynamometer.config.tableName,\n      KeyConditionExpression: `#PK = :PK${\n        this.beginsWithValue ? ' and begins_with(#SK, :SK)' : ''\n      }`,\n      ExpressionAttributeNames: {\n        '#PK': this.dynamometer.config.partitionKey,\n        ...(this.beginsWithValue && { '#SK': this.dynamometer.config.sortKey }),\n      },\n      ExpressionAttributeValues: {\n        ':PK': this.path,\n        ...(this.beginsWithValue && { ':SK': this.beginsWithValue }),\n      },\n    });\n    return (response.Items ?? []).map(item =>\n      transformResponse<Type>(item, this.dynamometer.config)\n    );\n  }\n\n  /**\n   * Filter documents within this collection based on a prefix for the sort key.\n   *\n   * @param sortKeyBeginsWith - The prefix for the sort key.\n   * @returns The current Collection instance for chaining.\n   */\n  beginsWith(sortKeyBeginsWith: string): Collection<Type> {\n    this.beginsWithValue = sortKeyBeginsWith;\n    return this;\n  }\n\n  /**\n   * Access a specific document within this collection.\n   *\n   * @param id - The ID of the document. If not provided, a new ID will be generated.\n   * @returns A Document instance representing the specified document.\n   */\n  doc(id: string = this.dynamometer.config.generateId()): Document<Type, this> {\n    return new Document(this.dynamometer, this.path, this.createId(id), this);\n  }\n\n  /**\n   * Add a new document to this collection in the DynamoDB table.\n   *\n   * @param data - The data for the new document.\n   * @returns A promise that resolves with a Document instance representing the newly added document.\n   */\n  async add(data: Type): Promise<Document<Type, this>> {\n    const uuid = this.dynamometer.config.generateId();\n    const response = await this.dynamometer.dynamoDBDocument.put({\n      TableName: this.dynamometer.config.tableName,\n      Item: {\n        ...data,\n        [this.dynamometer.config.partitionKey]: this.path,\n        [this.dynamometer.config.sortKey]: this.createId(uuid),\n      },\n    });\n    return new Document<Type, this>(this.dynamometer, this.path, uuid, this);\n  }\n\n  /**\n   * Create a document ID by optionally prefixing it based on the collection arguments.\n   *\n   * @param id - The base ID.\n   * @returns The created document ID.\n   */\n  private createId(id: string): string {\n    const delimiter = this.args?.prefix\n      ? this.dynamometer.config.delimiter\n      : '';\n    return `${this.args?.prefix ?? ''}${delimiter}${id}`;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAI,oBAAoB,SAAS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