@osdk/typescript-sdk-docs 0.4.0-beta.3 → 0.4.0-beta.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @osdk/typescript-sdk-docs
2
2
 
3
+ ## 0.4.0-beta.5
4
+
5
+ ### Minor Changes
6
+
7
+ - 1796b98: Update load all objects snippet
8
+
9
+ ## 0.4.0-beta.4
10
+
11
+ ### Minor Changes
12
+
13
+ - 2bb698d: Fix knn doc snippet
14
+
3
15
  ## 0.4.0-beta.3
4
16
 
5
17
  ### Minor Changes
@@ -323,7 +323,7 @@ export const snippets = {
323
323
  "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { Osdk, PageResult, Result } from \"@osdk/client\";\n\nconst response: Result<PageResult<Osdk.Instance<{{objectType}}>>>\n = await client({{objectType}}).fetchPageWithErrors({ $pageSize: 30 });\n\n// To fetch a page without a result wrapper, use fetchPage instead\nconst responseNoErrorWrapper: PageResult<Osdk.Instance<{{objectType}}>>\n = await client({{objectType}}).fetchPage({ $pageSize: 30 });\n"
324
324
  }],
325
325
  "loadAllObjectsReference": [{
326
- "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { Osdk } from \"@osdk/client\";\n\nconst objects: Osdk.Instance<{{objectType}}>[]= [];\n\nfor await(const obj of client({{objectType}}).asyncIter()) {\n objects.push(obj);\n}\nconst object = objects[0];"
326
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { Osdk } from \"@osdk/client\";\n\nasync function getAll(): Promise<Array<Osdk.Instance<{{objectType}}>>> {\n const objects: Osdk.Instance<{{objectType}}>[]= [];\n for await(const obj of client({{objectType}}).asyncIter()) {\n objects.push(obj);\n }\n\n return objects;\n}\n\n// If Array.fromAsync() is available in your target environment\nfunction getAllFromAsync(): Promise<Array<Osdk.Instance<{{objectType}}>>> {\n return Array.fromAsync(client({{objectType}}).asyncIter());\n}"
327
327
  }],
328
328
  "loadLinkedObjectReference": [{
329
329
  "template": "import { {{sourceObjectType}}, {{linkedObjectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { type Osdk, type Result } from \"@osdk/client\";\n\nfunction getLinked{{linkedObjectType}}(source: Osdk.Instance<{{sourceObjectType}}>, linkedObjectPrimaryKey: {{linkedPrimaryKeyPropertyV2.type}}): Result<Osdk.Instance<{{linkedObjectType}}>>\n{\n return source.$link.{{linkApiName}}.fetchOneWithErrors(linkedObjectPrimaryKey);\n}\n\n// You can also get a linked object without the result wrapper\nfunction getLinkedNoWrapper{{linkedObjectType}}(source: Osdk.Instance<{{sourceObjectType}}>, linkedObjectPrimaryKey: {{linkedPrimaryKeyPropertyV2.type}}): Osdk.Instance<{{linkedObjectType}}> {\n return source.$link.{{linkApiName}}.fetchOne(linkedObjectPrimaryKey);\n}",
@@ -568,10 +568,10 @@ export const snippets = {
568
568
  "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}WithExpression = await client({{objectType}})\n .withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n {{^isExtractPart}} \n baseObjectSet.pivotTo(\"{{linkName}}\")\n .selectProperty(\"{{property}}\")\n .{{operation}}(baseObjectSet.pivotTo(\"{{linkName}}\").selectProperty(\"{{property}}\"))\n {{/isExtractPart}}\n {{#isExtractPart}}\n baseObjectSet.pivotTo(\"{{linkName}}\")\n .selectProperty(\"{{property}}\").{{operation}}(\"DAY\")\n {{/isExtractPart}}\n });"
569
569
  }],
570
570
  "nearestNeighborsTextQuery": [{
571
- "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst result = await client({{objectType}})\n .nearestNeighbors(\"coffee\", 5, \"{{vectorProperty}}\")\n .fetchPage();"
571
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst result = await client({{objectType}})\n .nearestNeighbors(\"coffee\", 5, \"{{property}}\")\n .fetchPage();"
572
572
  }],
573
573
  "nearestNeighborsVectorQuery": [{
574
- "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\n// Note that this vector maps to an arbitrary string\n// It must match the dimension of the \"{{vectorProperty}}\" property: {{vectorDimensionSize}}\nconst vector_query = Array.from({ length: {{vectorDimensionSize}} }, () => 0.3),\nconst result = await client({{objectType}})\n .nearestNeighbors(vector_query, 5, \"{{vectorProperty}}\")\n .fetchPage();"
574
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\n// Note that this vector maps to an arbitrary string\n// It must match the dimension of the \"{{property}}\" property: {{vectorDimensionSize}}\nconst vector_query = Array.from({ length: {{vectorDimensionSize}} }, () => 0.3),\nconst result = await client({{objectType}})\n .nearestNeighbors(vector_query, 5, \"{{property}}\")\n .fetchPage();"
575
575
  }]
576
576
  }
577
577
  }