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,CAC1C,UAAkB,EAClB,YAAoB,EACpB,KAAa;IAEb,KAAK,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;IACzC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,CACL,2BAA2B,CAAC,UAAU,EAAE,YAAY,CAAC;QACrD,GAAG;QACH,SAAS,CAAC,IAAI,CAAC,+BAA+B;QAC9C,GAAG;QACH,KAAK,CACN,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,YAAoB,EACpB,UAAkB;IAElB,UAAU,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACnD,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAE/B,OAAO,CACL,2BAA2B,CAAC,UAAU,EAAE,YAAY,CAAC;QACrD,GAAG;QACH,SAAS,CAAC,IAAI,CAAC,oBAAoB;QACnC,GAAG;QACH,UAAU,CACX,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,YAAoB;IAEpB,YAAY,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACvD,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAEjC,OAAO,CACL,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC;QACvD,GAAG;QACH,SAAS,CAAC,IAAI,CAAC,sBAAsB;QACrC,GAAG;QACH,YAAY,CACb,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAAkB,EAAE,YAAoB;IAClF,OAAO,CACL,2BAA2B,CAAC,UAAU,EAAE,YAAY,CAAC;QACrD,GAAG;QACH,SAAS,CAAC,IAAI,CAAC,6BAA6B,CAC7C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { Constants } from \"./constants\";\nimport { trimSlashFromLeftAndRight, validateResourceId, validateItemResourceId } from \"./helper\";\n\n/**\n * Would be used when creating or deleting a DocumentCollection\n * or a User in Azure Cosmos DB database service\n * @hidden\n * Given a database id, this creates a database link.\n * @param databaseId - The database id\n * @returns A database link in the format of `dbs/{0}`\n * with `{0}` being a Uri escaped version of the databaseId\n */\nexport function createDatabaseUri(databaseId: string): string {\n databaseId = trimSlashFromLeftAndRight(databaseId);\n validateResourceId(databaseId);\n\n return Constants.Path.DatabasesPathSegment + \"/\" + databaseId;\n}\n\n/**\n * Given a database and collection id, this creates a collection link.\n * Would be used when updating or deleting a DocumentCollection, creating a\n * Document, a StoredProcedure, a Trigger, a UserDefinedFunction, or when executing a query\n * with CreateDocumentQuery in Azure Cosmos DB database service.\n * @param databaseId - The database id\n * @param collectionId - The collection id\n * @returns A collection link in the format of `dbs/{0}/colls/{1}`\n * with `{0}` being a Uri escaped version of the databaseId and `{1}` being collectionId\n * @hidden\n */\nexport function createDocumentCollectionUri(databaseId: string, collectionId: string): string {\n collectionId = trimSlashFromLeftAndRight(collectionId);\n validateResourceId(collectionId);\n\n return (\n createDatabaseUri(databaseId) + \"/\" + Constants.Path.CollectionsPathSegment + \"/\" + collectionId\n );\n}\n\n/**\n * Given a database and user id, this creates a user link.\n * Would be used when creating a Permission, or when replacing or deleting\n * a User in Azure Cosmos DB database service\n * @param databaseId - The database id\n * @param userId - The user id\n * @returns A user link in the format of `dbs/{0}/users/{1}`\n * with `{0}` being a Uri escaped version of the databaseId and `{1}` being userId\n * @hidden\n */\nexport function createUserUri(databaseId: string, userId: string): string {\n userId = trimSlashFromLeftAndRight(userId);\n validateResourceId(userId);\n\n return createDatabaseUri(databaseId) + \"/\" + Constants.Path.UsersPathSegment + \"/\" + userId;\n}\n\n/**\n * Given a database and collection id, this creates a collection link.\n * Would be used when creating an Attachment, or when replacing\n * or deleting a Document in Azure Cosmos DB database service\n * @param databaseId - The database id\n * @param collectionId - The collection id\n * @param documentId - The document id\n * @returns A document link in the format of\n * `dbs/{0}/colls/{1}/docs/{2}` with `{0}` being a Uri escaped version of\n * the databaseId, `{1}` being collectionId and `{2}` being the documentId\n * @hidden\n */\nexport function createDocumentUri(\n databaseId: string,\n collectionId: string,\n documentId: string\n): string {\n documentId = trimSlashFromLeftAndRight(documentId);\n validateItemResourceId(documentId);\n\n return (\n createDocumentCollectionUri(databaseId, collectionId) +\n \"/\" +\n Constants.Path.DocumentsPathSegment +\n \"/\" +\n documentId\n );\n}\n\n/**\n * Given a database, collection and document id, this creates a document link.\n * Would be used when replacing or deleting a Permission in Azure Cosmos DB database service.\n * @param databaseId -The database Id\n * @param userId -The user Id\n * @param permissionId - The permissionId\n * @returns A permission link in the format of `dbs/{0}/users/{1}/permissions/{2}`\n * with `{0}` being a Uri escaped version of the databaseId, `{1}` being userId and `{2}` being permissionId\n * @hidden\n */\nexport function createPermissionUri(\n databaseId: string,\n userId: string,\n permissionId: string\n): string {\n permissionId = trimSlashFromLeftAndRight(permissionId);\n validateResourceId(permissionId);\n\n return (\n createUserUri(databaseId, userId) +\n \"/\" +\n Constants.Path.PermissionsPathSegment +\n \"/\" +\n permissionId\n );\n}\n\n/**\n * Given a database, collection and stored proc id, this creates a stored proc link.\n * Would be used when replacing, executing, or deleting a StoredProcedure in\n * Azure Cosmos DB database service.\n * @param databaseId -The database Id\n * @param collectionId -The collection Id\n * @param storedProcedureId -The stored procedure Id\n * @returns A stored procedure link in the format of\n * `dbs/{0}/colls/{1}/sprocs/{2}` with `{0}` being a Uri escaped version of the databaseId,\n * `{1}` being collectionId and `{2}` being the storedProcedureId\n * @hidden\n */\nexport function createStoredProcedureUri(\n databaseId: string,\n collectionId: string,\n storedProcedureId: string\n): string {\n storedProcedureId = trimSlashFromLeftAndRight(storedProcedureId);\n validateResourceId(storedProcedureId);\n\n return (\n createDocumentCollectionUri(databaseId, collectionId) +\n \"/\" +\n Constants.Path.StoredProceduresPathSegment +\n \"/\" +\n storedProcedureId\n );\n}\n\n/**\n * Given a database, collection and trigger id, this creates a trigger link.\n * Would be used when replacing, executing, or deleting a Trigger in Azure Cosmos DB database service\n * @param databaseId -The database Id\n * @param collectionId -The collection Id\n * @param triggerId -The trigger Id\n * @returns A trigger link in the format of\n * `dbs/{0}/colls/{1}/triggers/{2}` with `{0}` being a Uri escaped version of the databaseId,\n * `{1}` being collectionId and `{2}` being the triggerId\n * @hidden\n */\nexport function createTriggerUri(\n databaseId: string,\n collectionId: string,\n triggerId: string\n): string {\n triggerId = trimSlashFromLeftAndRight(triggerId);\n validateResourceId(triggerId);\n\n return (\n createDocumentCollectionUri(databaseId, collectionId) +\n \"/\" +\n Constants.Path.TriggersPathSegment +\n \"/\" +\n triggerId\n );\n}\n\n/**\n * Given a database, collection and udf id, this creates a udf link.\n * Would be used when replacing, executing, or deleting a UserDefinedFunction in\n * Azure Cosmos DB database service\n * @param databaseId -The database Id\n * @param collectionId -The collection Id\n * @param udfId -The User Defined Function Id\n * @returns A udf link in the format of `dbs/{0}/colls/{1}/udfs/{2}`\n * with `{0}` being a Uri escaped version of the databaseId, `{1}` being collectionId and `{2}` being the udfId\n * @hidden\n */\nexport function createUserDefinedFunctionUri(\n databaseId: string,\n collectionId: string,\n udfId: string\n): string {\n udfId = trimSlashFromLeftAndRight(udfId);\n validateResourceId(udfId);\n\n return (\n createDocumentCollectionUri(databaseId, collectionId) +\n \"/\" +\n Constants.Path.UserDefinedFunctionsPathSegment +\n \"/\" +\n udfId\n );\n}\n\n/**\n * Given a database, collection and conflict id, this creates a conflict link.\n * Would be used when creating a Conflict in Azure Cosmos DB database service.\n * @param databaseId -The database Id\n * @param collectionId -The collection Id\n * @param conflictId -The conflict Id\n * @returns A conflict link in the format of `dbs/{0}/colls/{1}/conflicts/{2}`\n * with `{0}` being a Uri escaped version of the databaseId, `{1}` being collectionId and `{2}` being the conflictId\n * @hidden\n */\nexport function createConflictUri(\n databaseId: string,\n collectionId: string,\n conflictId: string\n): string {\n conflictId = trimSlashFromLeftAndRight(conflictId);\n validateResourceId(conflictId);\n\n return (\n createDocumentCollectionUri(databaseId, collectionId) +\n \"/\" +\n Constants.Path.ConflictsPathSegment +\n \"/\" +\n conflictId\n );\n}\n\n/**\n * Given a database, collection and conflict id, this creates a conflict link.\n * Would be used when creating a Conflict in Azure Cosmos DB database service.\n * @param databaseId -The database Id\n * @param collectionId -The collection Id\n * @param documentId -The document Id\n * @param attachmentId -The attachment Id\n * @returns A conflict link in the format of `dbs/{0}/colls/{1}/conflicts/{2}`\n * with `{0}` being a Uri escaped version of the databaseId, `{1}` being collectionId and `{2}` being the conflictId\n * @hidden\n */\nexport function createAttachmentUri(\n databaseId: string,\n collectionId: string,\n documentId: string,\n attachmentId: string\n): string {\n attachmentId = trimSlashFromLeftAndRight(attachmentId);\n validateResourceId(attachmentId);\n\n return (\n createDocumentUri(databaseId, collectionId, documentId) +\n \"/\" +\n Constants.Path.AttachmentsPathSegment +\n \"/\" +\n attachmentId\n );\n}\n\n/**\n * Given a database and collection, this creates a partition key ranges link in\n * the Azure Cosmos DB database service.\n * @param databaseId - The database Id\n * @param collectionId - The collection Id\n * @returns A partition key ranges link in the format of\n * `dbs/{0}/colls/{1}/pkranges` with `{0}` being a Uri escaped version of the databaseId and `{1}` being collectionId\n * @hidden\n */\nexport function createPartitionKeyRangesUri(databaseId: string, collectionId: string): string {\n return (\n createDocumentCollectionUri(databaseId, collectionId) +\n \"/\" +\n Constants.Path.PartitionKeyRangesPathSegment\n );\n}\n"]}
\No newline at end of file