diff --git a/.changeset/mean-dragons-stare.md b/.changeset/mean-dragons-stare.md new file mode 100644 index 000000000..28f2f1e36 --- /dev/null +++ b/.changeset/mean-dragons-stare.md @@ -0,0 +1,5 @@ +--- +"@osdk/legacy-client": patch +--- + +Fix primary key encoding in URLs diff --git a/packages/legacy-client/src/client/net/getAllTimeSeriesPoints.ts b/packages/legacy-client/src/client/net/getAllTimeSeriesPoints.ts index edcc591d2..ec726f02e 100644 --- a/packages/legacy-client/src/client/net/getAllTimeSeriesPoints.ts +++ b/packages/legacy-client/src/client/net/getAllTimeSeriesPoints.ts @@ -46,7 +46,7 @@ export async function getAllTimeSeriesPoints( createOpenApiRequest(client.stack, client.fetch, undefined, true), client.ontology.metadata.ontologyApiName, apiName, - primaryKey, + encodeURIComponent(primaryKey), propertyName, body, ); diff --git a/packages/legacy-client/src/client/net/getFirstPoint.ts b/packages/legacy-client/src/client/net/getFirstPoint.ts index baf86a7a4..cf5519499 100644 --- a/packages/legacy-client/src/client/net/getFirstPoint.ts +++ b/packages/legacy-client/src/client/net/getFirstPoint.ts @@ -38,7 +38,7 @@ export async function getFirstPoint( createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objectApiName, - primaryKey, + encodeURIComponent(primaryKey), propertyName, ); return { diff --git a/packages/legacy-client/src/client/net/getLastPoint.ts b/packages/legacy-client/src/client/net/getLastPoint.ts index da3f31bd2..915694d8c 100644 --- a/packages/legacy-client/src/client/net/getLastPoint.ts +++ b/packages/legacy-client/src/client/net/getLastPoint.ts @@ -38,7 +38,7 @@ export async function getLastPoint( createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objectApiName, - primaryKey, + encodeURIComponent(primaryKey), propertyName, ); return { diff --git a/packages/legacy-client/src/client/net/getLinkedObject.ts b/packages/legacy-client/src/client/net/getLinkedObject.ts index 260897173..0ef49733d 100644 --- a/packages/legacy-client/src/client/net/getLinkedObject.ts +++ b/packages/legacy-client/src/client/net/getLinkedObject.ts @@ -65,7 +65,7 @@ export async function getLinkedObjectNoErrors( createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, sourceApiName, - primaryKey, + encodeURIComponent(primaryKey), linkTypeApiName, linkedObjectPrimaryKey, { diff --git a/packages/legacy-client/src/client/net/getLinkedObjectsPage.ts b/packages/legacy-client/src/client/net/getLinkedObjectsPage.ts index a4f6a0b94..650fe8f7e 100644 --- a/packages/legacy-client/src/client/net/getLinkedObjectsPage.ts +++ b/packages/legacy-client/src/client/net/getLinkedObjectsPage.ts @@ -33,7 +33,7 @@ export async function getLinkedObjectsPage( createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, sourceApiName, - primaryKey, + encodeURIComponent(primaryKey), linkTypeApiName, { pageSize: options?.pageSize, diff --git a/packages/legacy-client/src/client/net/getObject.ts b/packages/legacy-client/src/client/net/getObject.ts index a23c2f214..7408bb324 100644 --- a/packages/legacy-client/src/client/net/getObject.ts +++ b/packages/legacy-client/src/client/net/getObject.ts @@ -57,7 +57,7 @@ export async function getObjectWithoutErrors( createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objectApiName, - primaryKey.toString(), + encodeURIComponent(primaryKey.toString()), { select: selectedProperties.map(x => x.toString()), }, diff --git a/packages/legacy-client/src/client/net/iterateTimeSeriesPoints.ts b/packages/legacy-client/src/client/net/iterateTimeSeriesPoints.ts index 78212876b..ff35e1401 100644 --- a/packages/legacy-client/src/client/net/iterateTimeSeriesPoints.ts +++ b/packages/legacy-client/src/client/net/iterateTimeSeriesPoints.ts @@ -43,7 +43,7 @@ export async function* iterateTimeSeriesPoints( createOpenApiRequest(client.stack, client.fetch, undefined, true), client.ontology.metadata.ontologyApiName, apiName, - primaryKey, + encodeURIComponent(primaryKey), propertyName, body, ); diff --git a/packages/legacy-client/src/client/net/util/iterateLinkedObjects.ts b/packages/legacy-client/src/client/net/util/iterateLinkedObjects.ts index 34d35fdce..b6041948d 100644 --- a/packages/legacy-client/src/client/net/util/iterateLinkedObjects.ts +++ b/packages/legacy-client/src/client/net/util/iterateLinkedObjects.ts @@ -36,7 +36,7 @@ export async function* iterateLinkedObjects( createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, sourceApiName, - primaryKey, + encodeURIComponent(primaryKey), linkTypeApiName, { pageSize: options?.pageSize,