@sanity/client 7.15.0 → 7.17.0

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 (46) hide show
  1. package/dist/_chunks-cjs/config.cjs.map +1 -1
  2. package/dist/_chunks-cjs/isRecord.cjs.map +1 -1
  3. package/dist/_chunks-cjs/resolveEditInfo.cjs +1 -1
  4. package/dist/_chunks-cjs/resolveEditInfo.cjs.map +1 -1
  5. package/dist/_chunks-cjs/stegaClean.cjs.map +1 -1
  6. package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -1
  7. package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
  8. package/dist/_chunks-es/config.js.map +1 -1
  9. package/dist/_chunks-es/isRecord.js.map +1 -1
  10. package/dist/_chunks-es/resolveEditInfo.js +1 -1
  11. package/dist/_chunks-es/resolveEditInfo.js.map +1 -1
  12. package/dist/_chunks-es/stegaClean.js.map +1 -1
  13. package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -1
  14. package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
  15. package/dist/csm.cjs.map +1 -1
  16. package/dist/csm.js.map +1 -1
  17. package/dist/index.browser.cjs +62 -4
  18. package/dist/index.browser.cjs.map +1 -1
  19. package/dist/index.browser.d.cts +73 -28
  20. package/dist/index.browser.d.ts +73 -28
  21. package/dist/index.browser.js +63 -5
  22. package/dist/index.browser.js.map +1 -1
  23. package/dist/index.cjs +63 -5
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +73 -28
  26. package/dist/index.d.ts +73 -28
  27. package/dist/index.js +64 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/media-library.cjs.map +1 -1
  30. package/dist/media-library.js.map +1 -1
  31. package/dist/stega.browser.cjs.map +1 -1
  32. package/dist/stega.browser.d.cts +73 -28
  33. package/dist/stega.browser.d.ts +73 -28
  34. package/dist/stega.browser.js +1 -1
  35. package/dist/stega.browser.js.map +1 -1
  36. package/dist/stega.cjs.map +1 -1
  37. package/dist/stega.d.cts +73 -28
  38. package/dist/stega.d.ts +73 -28
  39. package/dist/stega.js +1 -1
  40. package/dist/stega.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/datasets/DatasetsClient.ts +93 -8
  43. package/src/projects/ProjectsClient.ts +22 -2
  44. package/src/types.ts +27 -0
  45. package/umd/sanityClient.js +71 -13
  46. package/umd/sanityClient.min.js +2 -2
package/dist/csm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"csm.js","sources":["../src/csm/resolvePerspectives.ts","../src/csm/createSourceDocumentResolver.ts","../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {validateApiPerspective} from '../config'\nimport type {StackablePerspective} from '../types'\nimport type {ClientPerspective} from './types'\n\n/**\n * This resolves the perspectives to how documents should be resolved when applying optimistic updates,\n * like in `applySourceDocuments`.\n * @internal\n */\nexport function resolvePerspectives(\n perspective: Exclude<ClientPerspective, 'raw'>,\n): ('published' | 'drafts' | StackablePerspective)[] {\n validateApiPerspective(perspective)\n\n if (Array.isArray(perspective)) {\n if (!perspective.includes('published')) {\n return [...perspective, 'published']\n }\n return perspective\n }\n switch (perspective) {\n case 'previewDrafts':\n case 'drafts':\n return ['drafts', 'published']\n case 'published':\n default:\n return ['published']\n }\n}\n","import {getDraftId, getPublishedId, getVersionId} from './draftUtils'\nimport {resolvePerspectives} from './resolvePerspectives'\nimport type {ClientPerspective, ContentSourceMapDocuments, SanityDocument} from './types'\n\n/** @internal */\nexport type ResolvedDocument = Partial<SanityDocument> &\n Required<Pick<SanityDocument, '_id' | '_type'>>\n\n/** @internal */\nexport type MatchedDocument = Partial<SanityDocument> &\n Required<Pick<SanityDocument, '_id' | '_type' | '_originalId'>>\n\n/** @internal */\nexport function createSourceDocumentResolver(\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => ResolvedDocument | null | undefined,\n _perspective: Exclude<ClientPerspective, 'raw'>,\n) {\n const perspectives = resolvePerspectives(_perspective)\n function findDocument(sourceDocument: ContentSourceMapDocuments[number]) {\n for (const perspective of perspectives) {\n let match: ReturnType<typeof getCachedDocument> = null\n if (perspective.startsWith('r')) {\n match = getCachedDocument({\n ...sourceDocument,\n _id: getVersionId(sourceDocument._id, perspective),\n })\n }\n if (perspective === 'drafts') {\n match = getCachedDocument({\n ...sourceDocument,\n _id: getDraftId(sourceDocument._id),\n })\n }\n if (perspective === 'published') {\n match = getCachedDocument({\n ...sourceDocument,\n _id: getPublishedId(sourceDocument._id),\n })\n }\n if (match) {\n return {...match, _id: getPublishedId(match._id), _originalId: match._id}\n }\n }\n return null\n }\n // define resolver that loops over source documents and perspectives\n return function resolveSourceDocument(\n sourceDocument: ContentSourceMapDocuments[number],\n ): MatchedDocument | null {\n return findDocument(sourceDocument)\n }\n}\n","import {createSourceDocumentResolver} from './createSourceDocumentResolver'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * Can be used to apply mutations to documents being edited in a Studio, or any mutation on Content Lake, to a result with extremely low latency.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) =>\n | (Partial<SanityDocument> & Required<Pick<SanityDocument, '_id' | '_type'>>)\n | null\n | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction,\n perspective: Exclude<ClientPerspective, 'raw'>,\n): Result {\n if (!resultSourceMap) return result\n\n const resolveDocument = createSourceDocumentResolver(getCachedDocument, perspective)\n const cachedDocuments = resultSourceMap.documents?.map?.(resolveDocument) || []\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n const cachedDocument = cachedDocuments[mapping.source.document]\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["paths.toString","paths.get"],"mappings":";;;AASO,SAAS,oBACd,aACmD;AAGnD,MAFA,uBAAuB,WAAW,GAE9B,MAAM,QAAQ,WAAW;AACtB,WAAA,YAAY,SAAS,WAAW,IAG9B,cAFE,CAAC,GAAG,aAAa,WAAW;AAIvC,UAAQ,aAAa;AAAA,IACnB,KAAK;AAAA,IACL,KAAK;AACI,aAAA,CAAC,UAAU,WAAW;AAAA,IAC/B,KAAK;AAAA,IACL;AACE,aAAO,CAAC,WAAW;AAAA,EAAA;AAEzB;ACfgB,SAAA,6BACd,mBAGA,cACA;AACM,QAAA,eAAe,oBAAoB,YAAY;AACrD,WAAS,aAAa,gBAAmD;AACvE,eAAW,eAAe,cAAc;AACtC,UAAI,QAA8C;AAmBlD,UAlBI,YAAY,WAAW,GAAG,MAC5B,QAAQ,kBAAkB;AAAA,QACxB,GAAG;AAAA,QACH,KAAK,aAAa,eAAe,KAAK,WAAW;AAAA,MAClD,CAAA,IAEC,gBAAgB,aAClB,QAAQ,kBAAkB;AAAA,QACxB,GAAG;AAAA,QACH,KAAK,WAAW,eAAe,GAAG;AAAA,MACnC,CAAA,IAEC,gBAAgB,gBAClB,QAAQ,kBAAkB;AAAA,QACxB,GAAG;AAAA,QACH,KAAK,eAAe,eAAe,GAAG;AAAA,MACvC,CAAA,IAEC;AACK,eAAA,EAAC,GAAG,OAAO,KAAK,eAAe,MAAM,GAAG,GAAG,aAAa,MAAM,IAAG;AAAA,IAAA;AAGrE,WAAA;AAAA,EAAA;AAGT,SAAO,SACL,gBACwB;AACxB,WAAO,aAAa,cAAc;AAAA,EACpC;AACF;ACjCO,SAAS,qBACd,QACA,iBACA,mBAMA,UACA,aACQ;AACJ,MAAA,CAAC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AAU,GAEpD,WAAW,gBAAgB;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AACI,MAAA;AAIL,WAAO,cAAc,QAAQ;AAC/B;"}
1
+ {"version":3,"file":"csm.js","sources":["../src/csm/resolvePerspectives.ts","../src/csm/createSourceDocumentResolver.ts","../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {validateApiPerspective} from '../config'\nimport type {StackablePerspective} from '../types'\nimport type {ClientPerspective} from './types'\n\n/**\n * This resolves the perspectives to how documents should be resolved when applying optimistic updates,\n * like in `applySourceDocuments`.\n * @internal\n */\nexport function resolvePerspectives(\n perspective: Exclude<ClientPerspective, 'raw'>,\n): ('published' | 'drafts' | StackablePerspective)[] {\n validateApiPerspective(perspective)\n\n if (Array.isArray(perspective)) {\n if (!perspective.includes('published')) {\n return [...perspective, 'published']\n }\n return perspective\n }\n switch (perspective) {\n case 'previewDrafts':\n case 'drafts':\n return ['drafts', 'published']\n case 'published':\n default:\n return ['published']\n }\n}\n","import {getDraftId, getPublishedId, getVersionId} from './draftUtils'\nimport {resolvePerspectives} from './resolvePerspectives'\nimport type {ClientPerspective, ContentSourceMapDocuments, SanityDocument} from './types'\n\n/** @internal */\nexport type ResolvedDocument = Partial<SanityDocument> &\n Required<Pick<SanityDocument, '_id' | '_type'>>\n\n/** @internal */\nexport type MatchedDocument = Partial<SanityDocument> &\n Required<Pick<SanityDocument, '_id' | '_type' | '_originalId'>>\n\n/** @internal */\nexport function createSourceDocumentResolver(\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => ResolvedDocument | null | undefined,\n _perspective: Exclude<ClientPerspective, 'raw'>,\n) {\n const perspectives = resolvePerspectives(_perspective)\n function findDocument(sourceDocument: ContentSourceMapDocuments[number]) {\n for (const perspective of perspectives) {\n let match: ReturnType<typeof getCachedDocument> = null\n if (perspective.startsWith('r')) {\n match = getCachedDocument({\n ...sourceDocument,\n _id: getVersionId(sourceDocument._id, perspective),\n })\n }\n if (perspective === 'drafts') {\n match = getCachedDocument({\n ...sourceDocument,\n _id: getDraftId(sourceDocument._id),\n })\n }\n if (perspective === 'published') {\n match = getCachedDocument({\n ...sourceDocument,\n _id: getPublishedId(sourceDocument._id),\n })\n }\n if (match) {\n return {...match, _id: getPublishedId(match._id), _originalId: match._id}\n }\n }\n return null\n }\n // define resolver that loops over source documents and perspectives\n return function resolveSourceDocument(\n sourceDocument: ContentSourceMapDocuments[number],\n ): MatchedDocument | null {\n return findDocument(sourceDocument)\n }\n}\n","import {createSourceDocumentResolver} from './createSourceDocumentResolver'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * Can be used to apply mutations to documents being edited in a Studio, or any mutation on Content Lake, to a result with extremely low latency.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) =>\n | (Partial<SanityDocument> & Required<Pick<SanityDocument, '_id' | '_type'>>)\n | null\n | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction,\n perspective: Exclude<ClientPerspective, 'raw'>,\n): Result {\n if (!resultSourceMap) return result\n\n const resolveDocument = createSourceDocumentResolver(getCachedDocument, perspective)\n const cachedDocuments = resultSourceMap.documents?.map?.(resolveDocument) || []\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n const cachedDocument = cachedDocuments[mapping.source.document]\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["paths.toString","paths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
1559
  *
1560
1560
  * @param name - Name of the dataset to create
1561
- * @param options - Options for the dataset
1561
+ * @param options - Options for the dataset, including optional embeddings configuration
1562
1562
  */
1563
1563
  create(name, options) {
1564
1564
  return _modify(this.#client, this.#httpRequest, "PUT", name, options);
@@ -1592,6 +1592,31 @@ class ObservableDatasetsClient {
1592
1592
  tag: null
1593
1593
  });
1594
1594
  }
1595
+ /**
1596
+ * Get embeddings settings for a dataset
1597
+ *
1598
+ * @param name - Name of the dataset
1599
+ */
1600
+ getEmbeddingsSettings(name) {
1601
+ return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
1602
+ uri: _embeddingsSettingsUri(this.#client, name),
1603
+ tag: null
1604
+ });
1605
+ }
1606
+ /**
1607
+ * Edit embeddings settings for a dataset
1608
+ *
1609
+ * @param name - Name of the dataset
1610
+ * @param settings - Embeddings settings to apply
1611
+ */
1612
+ editEmbeddingsSettings(name, settings) {
1613
+ return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
1614
+ method: "PUT",
1615
+ uri: _embeddingsSettingsUri(this.#client, name),
1616
+ body: settings,
1617
+ tag: null
1618
+ });
1619
+ }
1595
1620
  }
1596
1621
  class DatasetsClient {
1597
1622
  #client;
@@ -1603,7 +1628,7 @@ class DatasetsClient {
1603
1628
  * Create a new dataset with the given name
1604
1629
  *
1605
1630
  * @param name - Name of the dataset to create
1606
- * @param options - Options for the dataset
1631
+ * @param options - Options for the dataset, including optional embeddings configuration
1607
1632
  */
1608
1633
  create(name, options) {
1609
1634
  return resourceGuard("dataset", this.#client.config()), rxjs.lastValueFrom(
@@ -1640,6 +1665,39 @@ class DatasetsClient {
1640
1665
  _request(this.#client, this.#httpRequest, { uri, tag: null })
1641
1666
  );
1642
1667
  }
1668
+ /**
1669
+ * Get embeddings settings for a dataset
1670
+ *
1671
+ * @param name - Name of the dataset
1672
+ */
1673
+ getEmbeddingsSettings(name) {
1674
+ return resourceGuard("dataset", this.#client.config()), dataset(name), rxjs.lastValueFrom(
1675
+ _request(this.#client, this.#httpRequest, {
1676
+ uri: _embeddingsSettingsUri(this.#client, name),
1677
+ tag: null
1678
+ })
1679
+ );
1680
+ }
1681
+ /**
1682
+ * Edit embeddings settings for a dataset
1683
+ *
1684
+ * @param name - Name of the dataset
1685
+ * @param settings - Embeddings settings to apply
1686
+ */
1687
+ editEmbeddingsSettings(name, settings) {
1688
+ return resourceGuard("dataset", this.#client.config()), dataset(name), rxjs.lastValueFrom(
1689
+ _request(this.#client, this.#httpRequest, {
1690
+ method: "PUT",
1691
+ uri: _embeddingsSettingsUri(this.#client, name),
1692
+ body: settings,
1693
+ tag: null
1694
+ })
1695
+ );
1696
+ }
1697
+ }
1698
+ function _embeddingsSettingsUri(client, name) {
1699
+ const config = client.config();
1700
+ return config.useProjectHostname === !1 ? `/projects/${config.projectId}/datasets/${name}/settings/embeddings` : `/datasets/${name}/settings/embeddings`;
1643
1701
  }
1644
1702
  function _modify(client, httpRequest, method, name, options) {
1645
1703
  return resourceGuard("dataset", client.config()), dataset(name), _request(client, httpRequest, {
@@ -1731,7 +1789,7 @@ class ObservableProjectsClient {
1731
1789
  }
1732
1790
  list(options) {
1733
1791
  const query = {}, uri = "/projects";
1734
- return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), _request(this.#client, this.#httpRequest, { uri, query });
1792
+ return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership === !0 && (query.onlyExplicitMembership = "true"), _request(this.#client, this.#httpRequest, { uri, query });
1735
1793
  }
1736
1794
  /**
1737
1795
  * Fetch a project by project ID
@@ -1750,7 +1808,7 @@ class ProjectsClient {
1750
1808
  }
1751
1809
  list(options) {
1752
1810
  const query = {}, uri = "/projects";
1753
- return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), rxjs.lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
1811
+ return options?.includeMembers === !1 && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership === !0 && (query.onlyExplicitMembership = "true"), rxjs.lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
1754
1812
  }
1755
1813
  /**
1756
1814
  * Fetch a project by project ID