@osdk/typescript-sdk-docs 0.4.0-beta.6 → 0.5.0-beta.2
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 +7 -5
- package/build/browser/generatedNoCheck/docsNoComputedVariables.js.map +1 -1
- package/build/cjs/index.cjs +7 -5
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/generatedNoCheck/docsNoComputedVariables.js +7 -5
- package/build/esm/generatedNoCheck/docsNoComputedVariables.js.map +1 -1
- package/package.json +4 -4
package/build/cjs/index.cjs
CHANGED
|
@@ -366,17 +366,19 @@ var snippets = {
|
|
|
366
366
|
"computedVariables": ["propertyValueV2", "propertyValueIncrementedV2"]
|
|
367
367
|
}],
|
|
368
368
|
"applyAction": [{
|
|
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}}\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
|
|
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}}\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}',
|
|
370
|
+
"computedVariables": ["actionParameterSampleValuesV2"]
|
|
370
371
|
}],
|
|
371
372
|
"batchApplyAction": [{
|
|
372
|
-
"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 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 // 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{{/hasMediaParameter}}\n const result = await client({{actionApiName}}).batchApplyAction([\n {\n {{#actionParameterSampleValuesV2}}\n "{{key}}": {{{value}}},\n {{/actionParameterSampleValuesV2}}\n
|
|
373
|
+
"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 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 // 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{{/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}',
|
|
374
|
+
"computedVariables": ["actionParameterSampleValuesV2"]
|
|
373
375
|
}],
|
|
374
376
|
"uploadAttachment": [{
|
|
375
377
|
"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 });',
|
|
376
378
|
"computedVariables": ["propertyValueV2"]
|
|
377
379
|
}],
|
|
378
380
|
"castInterfaceToObjectReference": [{
|
|
379
|
-
"template": 'import { {{objectTypeApiName}}, {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport {
|
|
381
|
+
"template": 'import { {{objectTypeApiName}}, {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport { type Osdk } from "@osdk/client";\n try {\n const page = await client({{interfaceApiName}}).fetchPage();\n\n const interfaces = page.data;\n const {{interfaceApiNameCamelCase}}: Osdk<{{interfaceApiName}}> = interfaces[0];\n\n // Cast from interface to object type\n const {{objectTypeApiNameCamelCase}}: Osdk<{{objectTypeApiName}}> = {{interfaceApiNameCamelCase}}.$as({{objectTypeApiName}});\n // Or from object type back to interface\n const {{interfaceApiNameCamelCase}}2: Osdk<{{interfaceApiName}}> = {{objectTypeApiNameCamelCase}}.$as({{interfaceApiName}});\n } catch (e) {\n throw e;\n }'
|
|
380
382
|
}],
|
|
381
383
|
"executeFunction": [{
|
|
382
384
|
"template": '// Edit this import if your client location differs\nimport { client } from "./client";\n{{#hasAttachmentProperty}}\n{{#hasAttachmentUpload}}\nimport type { AttachmentUpload } from "@osdk/api";\nimport { createAttachmentUpload } from "@osdk/client";\nimport { {{funcApiName}} } from "{{{packageName}}}";\n{{/hasAttachmentUpload}}\n{{^hasAttachmentUpload}}\nimport type { Osdk } from "@osdk/client";\nimport { {{funcApiName}}, type {{objectType}} } from "{{{packageName}}}";\n{{/hasAttachmentUpload}}\n\n{{#hasAttachmentUpload}}\nasync function callFunctionWithAttachmentUpload() {\n async function createAttachmentReference() {\n const file = await fetch("file.json");\n const blob = await file.blob();\n return createAttachmentUpload(blob, "myFile");\n }\n const attachment: AttachmentUpload = await createAttachmentReference();\n{{/hasAttachmentUpload}}\n{{^hasAttachmentUpload}}\nasync function callFunctionWithAttachmentLoaded(objectWithAttachment: Osdk.Instance<{{objectType}}>) {\n const attachment = objectWithAttachment.{{attachmentProperty}}?.rid;\n if (attachment == null) {\n throw new Error("Attachment is required");\n }\n{{/hasAttachmentUpload}}\n const result = await client({{funcApiName}}).executeFunction({{{functionInputValuesV2}}});\n return result;\n}\n{{/hasAttachmentProperty}}\n{{^hasAttachmentProperty}}\nimport { {{funcApiName}} } from "{{{packageName}}}";\n\nconst result = await client({{funcApiName}}).executeFunction({{{functionInputValuesV2}}});\n{{/hasAttachmentProperty}}',
|
|
@@ -441,7 +443,7 @@ var snippets = {
|
|
|
441
443
|
"computedVariables": ["arrayElementValue"]
|
|
442
444
|
}],
|
|
443
445
|
"loadInterfacesReference": [{
|
|
444
|
-
"template": 'import { {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport { type Osdk, type PageResult
|
|
446
|
+
"template": 'import { {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport { type Osdk, type PageResult } from "@osdk/client";\n\nconst response: PageResult<Osdk<{{interfaceApiName}}>>\n = await client({{interfaceApiName}}).fetchPage({ $pageSize: 30 });'
|
|
445
447
|
}],
|
|
446
448
|
"loadAllInterfacesReference": [{
|
|
447
449
|
"template": 'import { {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport type { Osdk } from "@osdk/client";\n\nconst interfaces: Osdk<{{interfaceApiName}}>[] = [];\n\nfor await(const int of client({{interfaceApiName}}).asyncIter()) {\n interfaces.push(int);\n}\nconst interface1 = interfaces[0];'
|
|
@@ -450,7 +452,7 @@ var snippets = {
|
|
|
450
452
|
"template": 'import { {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport { type Osdk, type PageResult } from "@osdk/client";\n\ntry {\n const page: PageResult<Osdk<{{interfaceApiName}}>> = await client({{interfaceApiName}})\n .fetchPage({\n $orderBy: { {{property}}: "asc"},\n $pageSize: 30\n });\n} catch (e) {\n throw e;\n}'
|
|
451
453
|
}],
|
|
452
454
|
"searchInterfacesReference": [{
|
|
453
|
-
"template": 'import { {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport {
|
|
455
|
+
"template": 'import { {{interfaceApiName}} } from "{{{packageName}}}";\n// Edit this import if your client location differs\nimport { client } from "./client";\nimport { type Osdk, type PageResult } from "@osdk/client";\n\ntry {\n const page: PageResult<Osdk<{{interfaceApiName}}>> = await client({{interfaceApiName}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $startsWith: "foo" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $startsWith: "foo" }\n {{/structSubPropertyApiName}}\n })\n .fetchPage({\n $pageSize: 30\n });\n\n const interfaces = page.data;\n const interface1 = interfaces[0];\n} catch (e) {\n throw e;\n}',
|
|
454
456
|
"computedVariables": ["propertyValueV2"]
|
|
455
457
|
}],
|
|
456
458
|
"loadTimeSeriesPointsSnippet": [{
|