@osdk/typescript-sdk-docs 0.9.0 → 0.9.1-main-d15d3cfbd6062435cd1ed0fd47e94c3ecbc79d82

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,11 @@
1
1
  # @osdk/typescript-sdk-docs
2
2
 
3
+ ## 0.9.1-main-d15d3cfbd6062435cd1ed0fd47e94c3ecbc79d82
4
+
5
+ ### Patch Changes
6
+
7
+ - 56c5630: Drop redundant `--config $(find-up dprint.json)` from `lint`, `fix-lint`, and `format` scripts. dprint already auto-discovers `dprint.json` by walking up from cwd; the substitution was a no-op anyway since `find-up` is an npm package, not a CLI. Also fix the `uploadMediaOntologyEdits` documentation example so its `// @ts-ignore` survives dprint reformatting (the broken `format` step had been masking this).
8
+
3
9
  ## 0.9.0
4
10
 
5
11
  ### Minor Changes
@@ -362,7 +362,7 @@ export const snippets = {
362
362
  "computedVariables": ["propertyValueV2", "propertyValueIncrementedV2"]
363
363
  }],
364
364
  "applyAction": [{
365
- "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentProperty}}\nimport type { AttachmentUpload {{#hasMediaParameter}}, MediaReference {{/hasMediaParameter}} } from \"@osdk/api\";\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}{{#hasMediaParameter}}\nimport type { MediaReference } from \"@osdk/api\";\n{{/hasMediaParameter}}{{/hasAttachmentProperty}}\n{{#hasAttachmentProperty}}\nimport { createAttachmentUpload } from \"@osdk/client\";\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\n{{/hasMediaParameter}}\nimport { {{actionApiName}} {{#hasMediaParameter}}, {{objectType}} {{/hasMediaParameter}} } from \"{{{packageName}}}\";\n\nasync function callAction() {\n{{#hasAttachmentProperty}}\n // Create attachment upload\n const attachmentFile = await fetch(\"file.json\");\n const attachmentBlob = await attachmentFile.blob();\n const attachment: AttachmentUpload = createAttachmentUpload(attachmentBlob, \"myFile\");\n // alternatively, you can get the Rid from the attachment property on the object type you are modifying \n // const attachmentRid = objectTypeWithAttachment.{attachmentProperty}?.rid;\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\n // Create media reference\n const mediaFile = await fetch(\"media.mp4\");\n const mediaBlob = await mediaFile.blob();\n const mediaReference: MediaReference = await client(\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n ).createMediaReference({\n data: mediaBlob,\n fileName: \"myMedia\",\n objectType: {{objectType}},\n propertyType: \"{{property}}\",\n });\n // alternatively, you can get the Rid from the media property on the object type you are modifying\n // const mediaRid = objectTypeWithMedia.{mediaProperty}?.rid;\n{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).applyAction(\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n {\n $returnEdits: true,\n }\n );\n if (result.type === \"edits\") {\n // use the result object to report back on action results\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n }\n}",
365
+ "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentProperty}}\nimport type { AttachmentUpload {{#hasMediaParameter}}, MediaReference {{/hasMediaParameter}} } from \"@osdk/api\";\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}{{#hasMediaParameter}}\nimport type { MediaReference } from \"@osdk/api\";\n{{/hasMediaParameter}}{{/hasAttachmentProperty}}\n{{#hasAttachmentProperty}}\nimport { createAttachmentUpload } from \"@osdk/client\";\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\n{{/hasMediaParameter}}\nimport { {{actionApiName}} {{#hasMediaParameter}}, {{objectType}} {{/hasMediaParameter}} } from \"{{{packageName}}}\";\n\nasync function callAction() {\n{{#hasAttachmentProperty}}\n // Create attachment upload\n const attachmentFile = await fetch(\"file.json\");\n const attachmentBlob = await attachmentFile.blob();\n const attachment: AttachmentUpload = createAttachmentUpload(attachmentBlob, \"myFile\");\n // alternatively, you can get the Rid from the attachment property on the object type you are modifying\n // const attachmentRid = objectTypeWithAttachment.{attachmentProperty}?.rid;\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\n // Create media reference\n const mediaFile = await fetch(\"media.mp4\");\n const mediaBlob = await mediaFile.blob();\n const mediaReference: MediaReference = await client(\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n ).createMediaReference({\n data: mediaBlob,\n fileName: \"myMedia\",\n objectType: {{objectType}},\n propertyType: \"{{property}}\",\n });\n // alternatively, you can get the Rid from the media property on the object type you are modifying\n // const mediaRid = objectTypeWithMedia.{mediaProperty}?.rid;\n{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).applyAction(\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n {\n $returnEdits: true,\n }\n );\n if (result.type === \"edits\") {\n // use the result object to report back on action results\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n }\n}",
366
366
  "computedVariables": ["actionParameterSampleValuesV2"]
367
367
  }],
368
368
  "batchApplyAction": [{
@@ -370,7 +370,7 @@ export const snippets = {
370
370
  "computedVariables": ["actionParameterSampleValuesV2"]
371
371
  }],
372
372
  "uploadAttachment": [{
373
- "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { createAttachmentUpload } from \"@osdk/client\";\nimport type { AttachmentUpload } from \"@osdk/api\";\nimport { {{actionApiName}} } from \"{{{packageName}}}\";\n\n// To call an action with an attachment property, you first need to upload the file\nasync function createAttachmentReference() {\n const file = await fetch(\"file.json\");\n const blob = await file.blob();\n return createAttachmentUpload(blob, \"myFile\");\n}\n\nconst myAttachmentUpload: AttachmentUpload = await createAttachmentReference();\n// then pass the attachment to the action in the action parameter.\nconst actionResult = client({{actionApiName}}).applyAction({ \n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{property}}: myAttachmentUpload\n });",
373
+ "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { createAttachmentUpload } from \"@osdk/client\";\nimport type { AttachmentUpload } from \"@osdk/api\";\nimport { {{actionApiName}} } from \"{{{packageName}}}\";\n\n// To call an action with an attachment property, you first need to upload the file\nasync function createAttachmentReference() {\n const file = await fetch(\"file.json\");\n const blob = await file.blob();\n return createAttachmentUpload(blob, \"myFile\");\n}\n\nconst myAttachmentUpload: AttachmentUpload = await createAttachmentReference();\n// then pass the attachment to the action in the action parameter.\nconst actionResult = client({{actionApiName}}).applyAction({\n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{property}}: myAttachmentUpload\n });",
374
374
  "computedVariables": ["propertyValueV2"]
375
375
  }],
376
376
  "castInterfaceToObjectReference": [{
@@ -521,7 +521,7 @@ export const snippets = {
521
521
  "template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst sum{{objectType}} = await client({{objectType}})\n .withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:{{operation}}\")\n }).fetchPage();"
522
522
  }],
523
523
  "objectSetOperationsGuide": [{
524
- "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\n\nconst objectSetA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\"}})\nconst objectSetB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\"}})\nconst objectSetC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\"}})\n\n// Object set operations can be chained. e.g. To find all objects in objectSetA \n// that are present in objectSetB but do not exist in objectSetC:\nconst result = objectSetA\n .intersect(objectSetB)\n .subtract(objectSetC)"
524
+ "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\n\nconst objectSetA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\"}})\nconst objectSetB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\"}})\nconst objectSetC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\"}})\n\n// Object set operations can be chained. e.g. To find all objects in objectSetA\n// that are present in objectSetB but do not exist in objectSetC:\nconst result = objectSetA\n .intersect(objectSetB)\n .subtract(objectSetC)"
525
525
  }],
526
526
  "objectSetOperationsUnion": [{
527
527
  "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\n\nconst objectSetA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\"}})\nconst objectSetB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\"}})\nconst objectSetC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\"}})\n\n// Combine objectSetA, objectSetB and objectSetC\nconst result = objectSetA\n .union(objectSetB)\n .union(objectSetC) // alternatively: objectSetA.union(objectSetB, objectSetC)"
@@ -552,21 +552,21 @@ export const snippets = {
552
552
  "template": "import type { Osdk } from \"@osdk/client\";\nimport { type {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getLastTimeSeriesPoint(obj: Osdk.Instance<{{objectType}}>) {\n return obj.{{property}}?.getLatestValue();\n}"
553
553
  }],
554
554
  "subscribeToObjectSetInstructions": [{
555
- "template": "import { {{objectOrInterfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst subscription = client({{objectOrInterfaceApiName}}).subscribe(\n {\n onChange(update) {\n if (update.state === \"ADDED_OR_UPDATED\") {\n // An object has received an update or an object was added to the object set\n // Get the object using the $primaryKey from your cache\n // const currentObject = objects[update.object.$primaryKey];\n // use the update.object[\"<propertyName>\"] to update your cache \n //currentObject[\"<propertyName>\"] = update.object[\"<propertyName>\"] ?? currentObject[\"<propertyName>\"];\n }\n else if (update.state === \"REMOVED\") {\n // The object was removed from the object set, which could mean it was deleted or no longer meets the filter criteria\n // Remove the object from your cache using the $primaryKey\n // delete objects[update.object.$primaryKey];\n }\n },\n onSuccessfulSubscription() {\n // The subscription was successful and you can expect to receive updates\n },\n onError(err) {\n // There was an error with the subscription and you will not receive any more updates\n throw new Error(err.error instanceof Error ? err.error.message : String(err.error));\n },\n onOutOfDate() {\n // We could not keep track of all changes. Please reload the objects in your set.\n },\n },\n { properties: [ {{{propertyNames}}} ] }\n);\n\n// To stop receiving updates, call unsubscribe\nsubscription.unsubscribe();"
555
+ "template": "import { {{objectOrInterfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst subscription = client({{objectOrInterfaceApiName}}).subscribe(\n {\n onChange(update) {\n if (update.state === \"ADDED_OR_UPDATED\") {\n // An object has received an update or an object was added to the object set\n // Get the object using the $primaryKey from your cache\n // const currentObject = objects[update.object.$primaryKey];\n // use the update.object[\"<propertyName>\"] to update your cache\n //currentObject[\"<propertyName>\"] = update.object[\"<propertyName>\"] ?? currentObject[\"<propertyName>\"];\n }\n else if (update.state === \"REMOVED\") {\n // The object was removed from the object set, which could mean it was deleted or no longer meets the filter criteria\n // Remove the object from your cache using the $primaryKey\n // delete objects[update.object.$primaryKey];\n }\n },\n onSuccessfulSubscription() {\n // The subscription was successful and you can expect to receive updates\n },\n onError(err) {\n // There was an error with the subscription and you will not receive any more updates\n throw new Error(err.error instanceof Error ? err.error.message : String(err.error));\n },\n onOutOfDate() {\n // We could not keep track of all changes. Please reload the objects in your set.\n },\n },\n { properties: [ {{{propertyNames}}} ] }\n);\n\n// To stop receiving updates, call unsubscribe\nsubscription.unsubscribe();"
556
556
  }],
557
557
  "applyAction": [{
558
- "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentProperty}}\nimport type { AttachmentUpload {{#hasMediaParameter}}, MediaReference, MediaUpload {{/hasMediaParameter}} } from \"@osdk/api\";\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}{{#hasMediaParameter}}\nimport type { MediaReference, MediaUpload } from \"@osdk/api\";\n{{/hasMediaParameter}}{{/hasAttachmentProperty}}\n{{#hasAttachmentProperty}}\nimport { createAttachmentUpload } from \"@osdk/client\";\n{{/hasAttachmentProperty}}\nimport { {{actionApiName}} {{#hasMediaParameter}}, {{objectType}} {{/hasMediaParameter}} } from \"{{{packageName}}}\";\n\nasync function callAction() {\n{{#hasAttachmentProperty}}\n // Create attachment upload\n const attachmentFile = await fetch(\"file.json\");\n const attachmentBlob = await attachmentFile.blob();\n const attachment: AttachmentUpload = createAttachmentUpload(attachmentBlob, \"myFile\");\n // alternatively, you can get the Rid from the attachment property on the object type you are modifying \n // const attachmentRid = objectTypeWithAttachment.{attachmentProperty}?.rid;\n\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\n // You can upload media data via your Action\n const mediaFile = await fetch(\"media.mp4\");\n const mediaBlob = await mediaFile.blob();\n const mediaUpload: MediaUpload = { data: mediaBlob, fileName: \"myMedia\" };\n \n // You can also pass an existing media reference into your Action\n const objectPage = await client({{objectType}}).fetchPage();\n const mediaReference: MediaReference = objectPage.data[0].{{property}}!.getMediaReference();\n\n{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).applyAction(\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n {\n $returnEdits: true,\n }\n );\n if (result.type === \"edits\") {\n // use the result object to report back on action results\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n }\n}",
558
+ "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentProperty}}\nimport type { AttachmentUpload {{#hasMediaParameter}}, MediaReference, MediaUpload {{/hasMediaParameter}} } from \"@osdk/api\";\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}{{#hasMediaParameter}}\nimport type { MediaReference, MediaUpload } from \"@osdk/api\";\n{{/hasMediaParameter}}{{/hasAttachmentProperty}}\n{{#hasAttachmentProperty}}\nimport { createAttachmentUpload } from \"@osdk/client\";\n{{/hasAttachmentProperty}}\nimport { {{actionApiName}} {{#hasMediaParameter}}, {{objectType}} {{/hasMediaParameter}} } from \"{{{packageName}}}\";\n\nasync function callAction() {\n{{#hasAttachmentProperty}}\n // Create attachment upload\n const attachmentFile = await fetch(\"file.json\");\n const attachmentBlob = await attachmentFile.blob();\n const attachment: AttachmentUpload = createAttachmentUpload(attachmentBlob, \"myFile\");\n // alternatively, you can get the Rid from the attachment property on the object type you are modifying\n // const attachmentRid = objectTypeWithAttachment.{attachmentProperty}?.rid;\n\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\n // You can upload media data via your Action\n const mediaFile = await fetch(\"media.mp4\");\n const mediaBlob = await mediaFile.blob();\n const mediaUpload: MediaUpload = { data: mediaBlob, fileName: \"myMedia\" };\n\n // You can also pass an existing media reference into your Action\n const objectPage = await client({{objectType}}).fetchPage();\n const mediaReference: MediaReference = objectPage.data[0].{{property}}!.getMediaReference();\n\n{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).applyAction(\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n {\n $returnEdits: true,\n }\n );\n if (result.type === \"edits\") {\n // use the result object to report back on action results\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n }\n}",
559
559
  "computedVariables": ["actionParameterSampleValuesV2"]
560
560
  }],
561
561
  "batchApplyAction": [{
562
- "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentProperty}}\nimport type { AttachmentUpload {{#hasMediaParameter}}, MediaReference, MediaUpload {{/hasMediaParameter}} } from \"@osdk/api\";\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}{{#hasMediaParameter}}\nimport type { MediaReference, MediaUpload } from \"@osdk/api\";\n{{/hasMediaParameter}}{{/hasAttachmentProperty}}\n{{#hasAttachmentProperty}}\nimport { createAttachmentUpload } from \"@osdk/client\";\n{{/hasAttachmentProperty}}\nimport { {{actionApiName}} {{#hasMediaParameter}}, {{objectType}} {{/hasMediaParameter}} } from \"{{{packageName}}}\";\n\nasync function callBatchAction() {\n{{#hasAttachmentProperty}}\n // Create attachment upload\n const attachmentFile = await fetch(\"file.json\");\n const attachmentBlob = await attachmentFile.blob();\n const attachment: AttachmentUpload = createAttachmentUpload(attachmentBlob, \"myFile\");\n\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\n // You can upload media data via your Action\n const mediaFile = await fetch(\"media.mp4\");\n const mediaBlob = await mediaFile.blob();\n const mediaUpload: MediaUpload = { data: mediaBlob, fileName: \"myMedia\" };\n \n // You can also pass an existing media reference into your Action\n const objectPage = await client({{objectType}}).fetchPage();\n const mediaReference: MediaReference = objectPage.data[0].{{property}}!.getMediaReference();\n \n{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).batchApplyAction([\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n ],\n {\n $returnEdits: true,\n }\n );\n if (result.type === \"edits\") {\n // use the result object to report back on action results\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n }\n}",
562
+ "template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentProperty}}\nimport type { AttachmentUpload {{#hasMediaParameter}}, MediaReference, MediaUpload {{/hasMediaParameter}} } from \"@osdk/api\";\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}{{#hasMediaParameter}}\nimport type { MediaReference, MediaUpload } from \"@osdk/api\";\n{{/hasMediaParameter}}{{/hasAttachmentProperty}}\n{{#hasAttachmentProperty}}\nimport { createAttachmentUpload } from \"@osdk/client\";\n{{/hasAttachmentProperty}}\nimport { {{actionApiName}} {{#hasMediaParameter}}, {{objectType}} {{/hasMediaParameter}} } from \"{{{packageName}}}\";\n\nasync function callBatchAction() {\n{{#hasAttachmentProperty}}\n // Create attachment upload\n const attachmentFile = await fetch(\"file.json\");\n const attachmentBlob = await attachmentFile.blob();\n const attachment: AttachmentUpload = createAttachmentUpload(attachmentBlob, \"myFile\");\n\n{{/hasAttachmentProperty}}\n{{#hasMediaParameter}}\n // You can upload media data via your Action\n const mediaFile = await fetch(\"media.mp4\");\n const mediaBlob = await mediaFile.blob();\n const mediaUpload: MediaUpload = { data: mediaBlob, fileName: \"myMedia\" };\n\n // You can also pass an existing media reference into your Action\n const objectPage = await client({{objectType}}).fetchPage();\n const mediaReference: MediaReference = objectPage.data[0].{{property}}!.getMediaReference();\n\n{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).batchApplyAction([\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n },\n ],\n {\n $returnEdits: true,\n }\n );\n if (result.type === \"edits\") {\n // use the result object to report back on action results\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n }\n}",
563
563
  "computedVariables": ["actionParameterSampleValuesV2"]
564
564
  }],
565
565
  "uploadMediaOntologyEdits": [{
566
- "template": "import type { Client } from \"@osdk/client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\nimport type { Edits } from \"@osdk/functions\";\nimport { createEditBatch, uploadMedia } from \"@osdk/functions\";\n\nasync function createObject(client: Client): Promise<Edits.Object<{{objectType}}>[]> {\n const batch = createEditBatch<Edits.Object<{{objectType}}>>(client);\n \n const blob = new Blob([\"Hello, world\"], { type: \"text/plain\" });\n const mediaReference = await uploadMedia(client, { data: blob, fileName: \"foundryFile.txt\" });\n\n // @ts-ignore \n batch.create({{objectType}}, { myMediaProperty: mediaReference, /* Other properties... */ });\n\n return batch.getEdits();\n}\n\nexport default createObject;"
566
+ "template": "import type { Client } from \"@osdk/client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\nimport type { Edits } from \"@osdk/functions\";\nimport { createEditBatch, uploadMedia } from \"@osdk/functions\";\n\nasync function createObject(client: Client): Promise<Edits.Object<{{objectType}}>[]> {\n const batch = createEditBatch<Edits.Object<{{objectType}}>>(client);\n\n const blob = new Blob([\"Hello, world\"], { type: \"text/plain\" });\n const mediaReference = await uploadMedia(client, { data: blob, fileName: \"foundryFile.txt\" });\n\n const props = { myMediaProperty: mediaReference /* Other properties... */ };\n // @ts-ignore\n batch.create({{objectType}}, props);\n\n return batch.getEdits();\n}\n\nexport default createObject;"
567
567
  }],
568
568
  "uploadMedia": [{
569
- "template": "import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\nimport { {{objectType}}, {{actionApiName}} } from \"{{{packageName}}}\"\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { MediaReference } from \"@osdk/api\";\n// To upload media with 2.x, it has to be linked to an Action call\nasync function createMediaReference() {\n const file = await fetch(\"file.json\");\n const data = await file.blob();\n // Upload media to an object type with a media property. This returns a media reference that can passed to\n // a media parameter in an Action.\n return await client(\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n ).createMediaReference({\n data,\n fileName: \"myFile\",\n objectType: {{objectType}},\n propertyType: \"{{property}}\",\n });\n}\nconst mediaReference: MediaReference = await createMediaReference();\nconst actionResult = client({{actionApiName}}).applyAction({ \n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{mediaParameter}}: mediaReference \n});",
569
+ "template": "import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\nimport { {{objectType}}, {{actionApiName}} } from \"{{{packageName}}}\"\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { MediaReference } from \"@osdk/api\";\n// To upload media with 2.x, it has to be linked to an Action call\nasync function createMediaReference() {\n const file = await fetch(\"file.json\");\n const data = await file.blob();\n // Upload media to an object type with a media property. This returns a media reference that can passed to\n // a media parameter in an Action.\n return await client(\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n ).createMediaReference({\n data,\n fileName: \"myFile\",\n objectType: {{objectType}},\n propertyType: \"{{property}}\",\n });\n}\nconst mediaReference: MediaReference = await createMediaReference();\nconst actionResult = client({{actionApiName}}).applyAction({\n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{mediaParameter}}: mediaReference\n});",
570
570
  "computedVariables": ["propertyValueV2"]
571
571
  }],
572
572
  "readMedia": [{
@@ -581,7 +581,7 @@ export const snippets = {
581
581
  "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 {{^isUnary}}\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .aggregate(\"{{property}}\").{{operation}}(\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"$count\"))\n }).fetchPage();\n {{/isUnary}}\n {{#isUnary}}\n \"{{operation}}_{{property}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\").{{operation}}()\n }).fetchPage();\n {{/isUnary}}"
582
582
  }],
583
583
  "derivedPropertyDatetimeExpression": [{
584
- "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 {{^isExtractPart}} \n \"derivedPropertyDatetime_{{operation}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\")\n .{{operation}}(baseObjectSet.pivotTo(\"{{linkApiName}}\").selectProperty(\"{{property}}\"))\n {{/isExtractPart}}\n {{#isExtractPart}}\n \"YEARS_part_of_{{property}}_of_{{linkApiName}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\").extractPart(\"YEARS\")\n {{/isExtractPart}}\n }).fetchPage();"
584
+ "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 {{^isExtractPart}}\n \"derivedPropertyDatetime_{{operation}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\")\n .{{operation}}(baseObjectSet.pivotTo(\"{{linkApiName}}\").selectProperty(\"{{property}}\"))\n {{/isExtractPart}}\n {{#isExtractPart}}\n \"YEARS_part_of_{{property}}_of_{{linkApiName}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\").extractPart(\"YEARS\")\n {{/isExtractPart}}\n }).fetchPage();"
585
585
  }],
586
586
  "nearestNeighborsTextQuery": [{
587
587
  "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();"