@osdk/typescript-sdk-docs 0.20.0 → 0.20.1-main-e786c2a2e84d224a471b3e714d96ed79b53468af
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 +6 -0
- package/build/browser/generatedNoCheck/docsNoComputedVariables.js +3 -3
- package/build/browser/generatedNoCheck/docsNoComputedVariables.js.map +1 -1
- package/build/cjs/index.cjs +3 -3
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/generatedNoCheck/docsNoComputedVariables.js +3 -3
- package/build/esm/generatedNoCheck/docsNoComputedVariables.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @osdk/typescript-sdk-docs
|
|
2
2
|
|
|
3
|
+
## 0.20.1-main-e786c2a2e84d224a471b3e714d96ed79b53468af
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c40b6e5: Remove the experimental `__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference` export. To upload media, pass `{ data, fileName }` directly to an Action's media parameter; the client uploads it via `uploadMedia` and links the resulting media item.
|
|
8
|
+
|
|
3
9
|
## 0.20.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -362,11 +362,11 @@ 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}}\
|
|
365
|
+
"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{{/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}",
|
|
366
366
|
"computedVariables": ["actionParameterSampleValuesV2"]
|
|
367
367
|
}],
|
|
368
368
|
"batchApplyAction": [{
|
|
369
|
-
"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}}\
|
|
369
|
+
"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{{/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}",
|
|
370
370
|
"computedVariables": ["actionParameterSampleValuesV2"]
|
|
371
371
|
}],
|
|
372
372
|
"uploadAttachment": [{
|
|
@@ -566,7 +566,7 @@ export const snippets = {
|
|
|
566
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 {
|
|
569
|
+
"template": "import { {{actionApiName}} } from \"{{{packageName}}}\"\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { MediaUpload } from \"@osdk/api\";\n// To upload media with 2.x, it has to be linked to an Action call\nconst file = await fetch(\"file.json\");\nconst data = await file.blob();\n// Pass the media data straight to a media parameter on the Action. The client uploads it\n// and links the resulting media item to the object.\nconst mediaUpload: MediaUpload = { data, fileName: \"myFile\" };\nconst actionResult = client({{actionApiName}}).applyAction({\n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{mediaParameter}}: mediaUpload\n});",
|
|
570
570
|
"computedVariables": ["propertyValueV2"]
|
|
571
571
|
}],
|
|
572
572
|
"readMedia": [{
|