@osdk/typescript-sdk-docs 0.4.0-beta.6 → 0.4.0
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 +7 -3
- package/build/browser/docs.js +0 -9
- package/build/browser/docs.js.map +1 -1
- package/build/browser/generatedNoCheck/docsNoComputedVariables.js +70 -73
- package/build/browser/generatedNoCheck/docsNoComputedVariables.js.map +1 -1
- package/build/cjs/index.cjs +70 -82
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/docs.js +0 -9
- package/build/esm/docs.js.map +1 -1
- package/build/esm/generatedNoCheck/docsNoComputedVariables.js +70 -73
- package/build/esm/generatedNoCheck/docsNoComputedVariables.js.map +1 -1
- package/package.json +4 -4
|
@@ -7,7 +7,7 @@ export const snippets = {
|
|
|
7
7
|
"1.0.0": {
|
|
8
8
|
"snippets": {
|
|
9
9
|
"loadSingleObjectGuide": [{
|
|
10
|
-
"template": "import { type GetObjectError, isOk, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\n\nconst result: Result<{{objectType}}, GetObjectError> = await client.ontology.objects.{{objectType}}.get(\"primaryKey\");\nif (isOk(result)) {\n const object: {{objectType}} = result.value;\n} else {\n console.error(result.error.errorType);\n}"
|
|
10
|
+
"template": "import { type GetObjectError, isOk, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst result: Result<{{objectType}}, GetObjectError> = await client.ontology.objects.{{objectType}}.get(\"primaryKey\");\nif (isOk(result)) {\n const object: {{objectType}} = result.value;\n} else {\n console.error(result.error.errorType);\n}"
|
|
11
11
|
}],
|
|
12
12
|
"loadObjectPageGuide": [{
|
|
13
13
|
"template": "import { isOk, type LoadObjectSetError, Page, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst firstPage: Result<Page<{{objectType}}>, LoadObjectSetError> = await client.ontology.objects.{{objectType}}.page({ pageSize: 30 });\n\nif (isOk(firstPage)) {\n const secondPage: Result<Page<{{objectType}}>, LoadObjectSetError> = await client.ontology.objects.{{objectType}}\n .page({ pageSize: 30, pageToken: firstPage.value.nextPageToken });\n\n const objects = isOk(secondPage) ? [...firstPage.value.data, ...secondPage.value.data] : firstPage.value.data;\n const object = objects[0];\n}"
|
|
@@ -156,10 +156,10 @@ export const snippets = {
|
|
|
156
156
|
"1.1.0": {
|
|
157
157
|
"snippets": {
|
|
158
158
|
"loadSingleObjectGuide": [{
|
|
159
|
-
"template": "import { type GetObjectError, isOk, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst result: Result<{{objectType}}, GetObjectError> = await client.ontology.objects.{{objectType}}.fetchOneWithErrors(\"primaryKey\");\nif (isOk(result)) {\n const object: {{objectType}} = result.value;\n} else {\n console.error(result.error.errorType);\n}\n// You can also fetch a single object without the Result wrapper\ntry {\n const object: {{objectType}} = await client.ontology.objects.{{objectType}}.fetchOne(\"primaryKey\");\n}\ncatch(e) {\n
|
|
159
|
+
"template": "import { type GetObjectError, isOk, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst result: Result<{{objectType}}, GetObjectError> = await client.ontology.objects.{{objectType}}.fetchOneWithErrors(\"primaryKey\");\nif (isOk(result)) {\n const object: {{objectType}} = result.value;\n} else {\n console.error(result.error.errorType);\n}\n// You can also fetch a single object without the Result wrapper\ntry {\n const object: {{objectType}} = await client.ontology.objects.{{objectType}}.fetchOne(\"primaryKey\");\n}\ncatch(e) {\n console.error(e);\n}"
|
|
160
160
|
}],
|
|
161
161
|
"loadObjectPageGuide": [{
|
|
162
|
-
"template": "import { isOk, type LoadObjectSetError, Page, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst firstPage: Result<Page<{{objectType}}>, LoadObjectSetError> = await client.ontology.objects.{{objectType}}.fetchPageWithErrors({ pageSize: 30 });\n\nif (isOk(firstPage)) {\n const secondPage: Result<Page<{{objectType}}>, LoadObjectSetError> = await client.ontology.objects.{{objectType}}\n .fetchPageWithErrors({ pageSize: 30, pageToken: firstPage.value.nextPageToken });\n\n const objects = isOk(secondPage) ? [...firstPage.value.data, ...secondPage.value.data] : firstPage.value.data;\n const object = objects[0];\n}\n\n// To fetch a page without a result wrapper, use fetchPage with a try/catch instead\ntry {\n const firstPage: Page<{{objectType}}> = await client.ontology.objects.{{objectType}}.fetchPage({ pageSize: 30 });\n const secondPage: Page<{{objectType}}> = await client.ontology.objects.{{objectType}}\n .fetchPage({ pageSize: 30, pageToken: firstPage.value.nextPageToken });\n const objects = [...firstPage.data, ...secondPage.data];\n const object = objects[0];\n}\ncatch (e) {\n
|
|
162
|
+
"template": "import { isOk, type LoadObjectSetError, Page, type Result } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst firstPage: Result<Page<{{objectType}}>, LoadObjectSetError> = await client.ontology.objects.{{objectType}}.fetchPageWithErrors({ pageSize: 30 });\n\nif (isOk(firstPage)) {\n const secondPage: Result<Page<{{objectType}}>, LoadObjectSetError> = await client.ontology.objects.{{objectType}}\n .fetchPageWithErrors({ pageSize: 30, pageToken: firstPage.value.nextPageToken });\n\n const objects = isOk(secondPage) ? [...firstPage.value.data, ...secondPage.value.data] : firstPage.value.data;\n const object = objects[0];\n}\n\n// To fetch a page without a result wrapper, use fetchPage with a try/catch instead\ntry {\n const firstPage: Page<{{objectType}}> = await client.ontology.objects.{{objectType}}.fetchPage({ pageSize: 30 });\n const secondPage: Page<{{objectType}}> = await client.ontology.objects.{{objectType}}\n .fetchPage({ pageSize: 30, pageToken: firstPage.value.nextPageToken });\n const objects = [...firstPage.data, ...secondPage.data];\n const object = objects[0];\n}\ncatch (e) {\n console.error(e);\n}"
|
|
163
163
|
}],
|
|
164
164
|
"orderObjectsGuide": [{
|
|
165
165
|
"template": "import { isOk, Page, type Result, type SearchObjectsError } from \"{{{packageName}}}\";\nimport { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\n\nconst page: Result<Page<{{objectType}}>, SearchObjectsError> = await client.ontology.objects.{{objectType}}\n .orderBy(sortBy => sortBy.{{titleProperty}}.asc())\n .fetchPageWithErrors({ pageSize: 30 });\n\nif (isOk(page)) {\n const objects = page.value.data;\n const object = objects[0];\n}"
|
|
@@ -305,36 +305,35 @@ export const snippets = {
|
|
|
305
305
|
"2.0.0": {
|
|
306
306
|
"snippets": {
|
|
307
307
|
"loadSingleObjectGuide": [{
|
|
308
|
-
"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\ntry {\n const object: Osdk.Instance<{{objectType}}> = await client({{objectType}}).fetchOne(
|
|
309
|
-
"computedVariables": ["primaryKeyPropertyValueV2"]
|
|
308
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type Result } from \"@osdk/client\";\n\nconst result: Result<Osdk.Instance<{{objectType}}>> = await client({{objectType}}).fetchOneWithErrors(\"<primaryKey>\");\nif (isOk(result)) {\n const object: Osdk.Instance<{{objectType}}> = result.value;\n} else {\n console.error(result.error.message);\n}\n// You can also fetch a single object without the Result wrapper\ntry {\n const object: Osdk.Instance<{{objectType}}> = await client({{objectType}}).fetchOne(\"<primaryKey>\");\n}\ncatch(e) {\n console.error(e);\n}"
|
|
310
309
|
}],
|
|
311
310
|
"loadObjectPageGuide": [{
|
|
312
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { type Osdk, type PageResult } from \"@osdk/client\";\n\
|
|
311
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type PageResult, type Result } from \"@osdk/client\";\n\nconst firstPage: Result<PageResult<Osdk.Instance<{{objectType}}>>>\n = await client({{objectType}}).fetchPageWithErrors({ $pageSize: 30 });\n\nif (isOk(firstPage)) {\n const secondPage: Result<PageResult<Osdk.Instance<{{objectType}}, never, \"{{titleProperty}}\">>>\n // You can also down select properties to only get the properties you need from the object\n = await client({{objectType}}).fetchPageWithErrors({ $select: [\"{{titleProperty}}\"], $pageSize: 30, $nextPageToken: firstPage.value.nextPageToken });\n\n const objects = isOk(secondPage) ? [...firstPage.value.data, ...secondPage.value.data] : firstPage.value.data;\n const object = objects[0];\n}\n\n // If you want to get rids, you need to add a flag to specifically request for it. Note how the return type now includes $rid rather than never\nconst secondPageWithRids: Result<PageResult<Osdk.Instance<{{objectType}}, \"$rid\", \"{{titleProperty}}\">>>\n = await client({{objectType}}).fetchPageWithErrors({ $select: [\"{{titleProperty}}\"], $includeRid:true, $pageSize: 30, $nextPageToken: firstPage.value.nextPageToken });\n\n// To fetch a page without a result wrapper, use fetchPage with a try/catch instead\ntry {\n const firstPage: PageResult<Osdk.Instance<{{objectType}}>>\n = await client({{objectType}}).fetchPage({ $pageSize: 30 });\n const secondPage: PageResult<Osdk.Instance<{{objectType}}>>\n = await client({{objectType}}).fetchPage({ $pageSize: 30, $nextPageToken: firstPage.nextPageToken });\n const objects = [...firstPage.data, ...secondPage.data];\n const object = objects[0];\n}\ncatch (e) {\n console.error(e);\n}"
|
|
313
312
|
}],
|
|
314
313
|
"orderObjectsGuide": [{
|
|
315
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { type Osdk, type PageResult } from \"@osdk/client\";\n\
|
|
314
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type PageResult, type Result } from \"@osdk/client\";\n\nconst page: Result<PageResult<Osdk.Instance<{{objectType}}>>> = await client({{objectType}})\n .fetchPageWithErrors({\n $orderBy: {\"{{titleProperty}}\": \"asc\"},\n $pageSize: 30\n });\n\nif (isOk(page)) {\n const objects = page.value.data;\n const object = objects[0];\n}"
|
|
316
315
|
}],
|
|
317
316
|
"searchObjectsGuide": [{
|
|
318
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { type Osdk, type PageResult } from \"@osdk/client\";\n\
|
|
317
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type PageResult, type Result } from \"@osdk/client\";\n\nconst page: Result<PageResult<Osdk.Instance<{{objectType}}>>> = await client({{objectType}})\n .where({\n {{titleProperty}}: {$isNull: true}\n })\n .fetchPageWithErrors({\n $pageSize: 30\n });\n\nif (isOk(page)) {\n const objects = page.value.data;\n const object = objects[0];\n}"
|
|
319
318
|
}],
|
|
320
319
|
"loadSingleObjectReference": [{
|
|
321
|
-
"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
|
|
322
|
-
"computedVariables": ["primaryKeyPropertyValueV2"]
|
|
320
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { Osdk, Result } from \"@osdk/client\";\n\nconst response: Result<Osdk.Instance<{{objectType}}>> = await client({{objectType}}).fetchOneWithErrors(\"<primaryKey>\");\n\n// You can also fetch a single object without the Result wrapper\n\nconst responseNoErrorWrapper: Osdk.Instance<{{objectType}}> = await client({{objectType}}).fetchOne(\"<primaryKey>\");\n\n"
|
|
323
321
|
}],
|
|
324
322
|
"loadObjectsReference": [{
|
|
325
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { Osdk, PageResult } from \"@osdk/client\";\
|
|
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"
|
|
326
324
|
}],
|
|
327
325
|
"loadAllObjectsReference": [{
|
|
328
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}"
|
|
329
327
|
}],
|
|
330
328
|
"loadLinkedObjectReference": [{
|
|
331
|
-
"template": "import {
|
|
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}",
|
|
330
|
+
"computedVariables": ["linkedPrimaryKeyPropertyV2"]
|
|
332
331
|
}],
|
|
333
332
|
"loadLinkedObjectsReference": [{
|
|
334
|
-
"template": "import { {{
|
|
333
|
+
"template": "import { {{linkedObjectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nfunction getLinked{{linkedObjectType}}(source: Osdk.Instance<{{sourceObjectType}}>) {\n {{#isLinkManySided}}\n return source.$link.{{linkApiName}}.fetchPageWithErrors({ $pageSize: 30 });\n {{/isLinkManySided}}\n {{^isLinkManySided}}\n return source.$link.{{linkApiName}}.fetchOneWithErrors();\n {{/isLinkManySided}}\n}\n\n// You can also get a linked object by doing an object set searcharound\nfunction getLinkedWithPivot{{linkedObjectType}}(){\n return client({{sourceObjectType}}).pivotTo({{linkApiName}}).fetchPage();\n}"
|
|
335
334
|
}],
|
|
336
335
|
"aggregationTemplate": [{
|
|
337
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst num{{objectType}} = await client({{objectType}})\n .where({
|
|
336
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst num{{objectType}} = await client({{objectType}})\n .where({{property}}: { $isNull : false }})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { name: \"exact\" },\n });"
|
|
338
337
|
}],
|
|
339
338
|
"countAggregationTemplate": [{
|
|
340
339
|
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst num{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: {$count: \"unordered\"},\n });"
|
|
@@ -346,49 +345,50 @@ export const snippets = {
|
|
|
346
345
|
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst distinct{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { \"{{property}}:exactDistinct\" : \"unordered\" },\n });"
|
|
347
346
|
}],
|
|
348
347
|
"numericAggregationTemplate": [{
|
|
349
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{operation}}{{objectType}} = await client({{objectType}})\n .
|
|
348
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{operation}}{{objectType}} = await client({{objectType}})\n .aggregation({\n $select: { \"{{property}}:{{operation}}\" : \"unordered\" }\n });"
|
|
350
349
|
}],
|
|
351
350
|
"fixedWidthGroupByTemplate": [{
|
|
352
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: { $fixedWidth: 10 } }\n });"
|
|
351
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}} : { $fixedWidth: 10 } }\n });"
|
|
353
352
|
}],
|
|
354
353
|
"durationGroupByTemplate": [{
|
|
355
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}:
|
|
354
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}} : $duration: [ {{#durationText}}{{arg}}{{/durationText}}, \"{{#durationText}}{{unit}}{{/durationText}}\"] }\n })"
|
|
356
355
|
}],
|
|
357
356
|
"exactGroupByTemplate": [{
|
|
358
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: \"exact\" }\n })"
|
|
357
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}} : \"exact\" }\n })"
|
|
359
358
|
}],
|
|
360
359
|
"rangeGroupByTemplate": [{
|
|
361
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: { $ranges: [[{{{propertyValueV2}}}, {{{propertyValueIncrementedV2}}} ]]} }\n });",
|
|
360
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst grouped{{objectType}} = await client({{objectType}})\n .aggregate({\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}} : { $ranges: [[{{{propertyValueV2}}}, {{{propertyValueIncrementedV2}}} ]]} }\n });",
|
|
362
361
|
"computedVariables": ["propertyValueV2", "propertyValueIncrementedV2"]
|
|
363
362
|
}],
|
|
364
363
|
"applyAction": [{
|
|
365
|
-
"template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#
|
|
364
|
+
"template": "import { {{actionApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentImports}}import type { AttachmentUpload } from \"@osdk/api\";{{/hasAttachmentImports}}{{#hasMediaParameter}}import type { MediaReference } from \"@osdk/api\";{{/hasMediaParameter}}\n\n\n{{#hasAttachmentUpload}}\nconst attachment: AttachmentUpload = uploadMyFile();\n{{/hasAttachmentUpload}}\n{{#attachmentProperty}}\nconst attachment: Attachment = {{{attachmentProperty}}};\n{{/attachmentProperty}}\n{{#hasMediaParameter}}\nconst mediaReference: MediaReference = uploadMedia();\n{{/hasMediaParameter}}\nconst result = await client({{actionApiName}}).applyAction(\n{{^hasParameters}}{},\n{{/hasParameters}}{{#hasParameters}}\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}}{{^last}}, {{/last}}\n {{/actionParameterSampleValuesV2}}\n },{{/hasParameters}}\n {\n $returnEdits: true,\n }\n);\n\nif (result.type === \"edits\") {\n // for new objects and updated objects edits will contain the primary key of the object\n const updatedObject = result.editedObjectTypes[0];\n console.log(\"Updated object\", updatedObject);\n}",
|
|
365
|
+
"computedVariables": ["actionParameterSampleValuesV2"]
|
|
366
366
|
}],
|
|
367
367
|
"batchApplyAction": [{
|
|
368
|
-
"template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#
|
|
368
|
+
"template": "import { {{actionApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentImports}}\nimport type { AttachmentUpload } from \"@osdk/api\";\n{{/hasAttachmentImports}}{{#hasMediaParameter}}import type { MediaReference } from \"@osdk/api\";{{/hasMediaParameter}}\n\n\n{{#hasAttachmentUpload}}\nconst attachment: AttachmentUpload = uploadMyFile();\n{{/hasAttachmentUpload}}\n{{#attachmentProperty}}\nconst attachment: Attachment = {{{attachmentProperty}}};\n{{/attachmentProperty}}\n{{#hasMediaParameter}}\nconst mediaReference: MediaReference = uploadMedia();\n{{/hasMediaParameter}}\nconst result = await client({{actionApiName}}).batchApplyAction(\n [\n {{^hasParameters}}{},{}{{/hasParameters}}{{#hasParameters}}\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}}{{^last}}, {{/last}}\n {{/actionParameterSampleValuesV2}}\n },\n {\n {{#actionParameterSampleValuesV2}}\n \"{{key}}\": {{{value}}}{{^last}}, {{/last}}\n {{/actionParameterSampleValuesV2}}\n },{{/hasParameters}}\n ],\n {\n $returnEdits: false,\n }\n);",
|
|
369
|
+
"computedVariables": ["actionParameterSampleValuesV2"]
|
|
369
370
|
}],
|
|
370
371
|
"uploadAttachment": [{
|
|
371
|
-
"template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport {
|
|
372
|
-
"computedVariables": ["propertyValueV2"]
|
|
372
|
+
"template": "// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { type Result, isOk } from \"@osdk/client\";\nimport type { AttachmentUpload } from \"@osdk/api\";\n\n// To upload an attachment with 2.0, it has to be linked to an action call\n\nasync function uploadMyFile() {\n const file = await fetch(\"file.json\");\n const blob = await file.blob();\n return createAttachmentUpload(blob, \"myFile\");\n}\n\nconst myAttachmentUpload: AttachmentUpload = await uploadMyFile();\n\nconst actionResult = client(attachmentUploadingAction).applyAction({ attachment: myAttachmentUpload });\n"
|
|
373
373
|
}],
|
|
374
374
|
"castInterfaceToObjectReference": [{
|
|
375
375
|
"template": "import { {{objectTypeApiName}}, {{interfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk } from \"@osdk/client\";\n\nconst page = await client({{interfaceApiName}}).fetchPageWithErrors();\n\nif (isOk(page)) {\n const interfaces = page.value.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}"
|
|
376
376
|
}],
|
|
377
377
|
"executeFunction": [{
|
|
378
|
-
"template": "
|
|
378
|
+
"template": "{{#needsImports}}\nimport { {{funcApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n{{#hasAttachmentImports}}import type { AttachmentUpload } from \"@osdk/api\";{{/hasAttachmentImports}}\n\n{{/needsImports}}\n{{#hasAttachmentUpload}}\nconst attachment: AttachmentUpload = uploadMyFile();\n{{/hasAttachmentUpload}}\n{{#attachmentProperty}}\nconst attachment: Attachment = {{{attachmentProperty}}};\n{{/attachmentProperty}}\nconst result = await client({{funcApiName}}).executeFunction({{{functionInputValuesV2}}});",
|
|
379
379
|
"computedVariables": ["functionInputValuesV2"]
|
|
380
380
|
}],
|
|
381
381
|
"stringStartsWithTemplate": [{
|
|
382
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $startsWith: \"foo\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $startsWith: \"foo\" }\n {{/structSubPropertyApiName}}\n })"
|
|
382
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $startsWith: \"foo\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}} : { $startsWith: \"foo\" }\n {{/structSubPropertyApiName}}\n })"
|
|
383
383
|
}],
|
|
384
384
|
"containsAllTermsInOrderTemplate": [{
|
|
385
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $containsAllTermsInOrder: \"foo bar\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $containsAllTermsInOrder: \"foo bar\" }\n {{/structSubPropertyApiName}}\n })"
|
|
385
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $containsAllTermsInOrder: \"foo bar\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}} : { $containsAllTermsInOrder: \"foo bar\" }\n {{/structSubPropertyApiName}}\n })"
|
|
386
386
|
}],
|
|
387
387
|
"containsAnyTermTemplate": [{
|
|
388
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $containsAnyTerm: \"foo bar\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $containsAnyTerm: \"foo bar\" }\n {{/structSubPropertyApiName}}\n })"
|
|
388
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $containsAnyTerm: \"foo bar\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}} : { $containsAnyTerm: \"foo bar\" }\n {{/structSubPropertyApiName}}\n })"
|
|
389
389
|
}],
|
|
390
390
|
"containsAllTermsTemplate": [{
|
|
391
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $containsAllTerms: \"foo bar\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $containsAllTerms: \"foo bar\" }\n {{/structSubPropertyApiName}}\n })"
|
|
391
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $containsAllTerms: \"foo bar\" }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}} : { $containsAllTerms: \"foo bar\" }\n {{/structSubPropertyApiName}}\n })"
|
|
392
392
|
}],
|
|
393
393
|
"equalityTemplate": [{
|
|
394
394
|
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $eq: {{{propertyValueV2}}} }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $eq: {{{propertyValueV2}}} }\n {{/structSubPropertyApiName}}\n });",
|
|
@@ -409,31 +409,31 @@ export const snippets = {
|
|
|
409
409
|
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $within: { $distance: [100, \"{{distanceUnit}}\"], $of: [-74.0060, 40.7128]} }}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $within: { $distance: [100, \"{{distanceUnit}}\"], $of: [-74.0060, 40.7128]}}\n {{/structSubPropertyApiName}}\n })"
|
|
410
410
|
}],
|
|
411
411
|
"withinBoundingBoxTemplate": [{
|
|
412
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $within: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $within: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}\n {{/structSubPropertyApiName}}\n });"
|
|
412
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $within: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $within: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}\n {{/structSubPropertyApiName}}\n\n });"
|
|
413
413
|
}],
|
|
414
414
|
"withinPolygonTemplate": [{
|
|
415
415
|
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $within: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]]}}}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $within: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]]}}\n {{/structSubPropertyApiName}}\n });"
|
|
416
416
|
}],
|
|
417
417
|
"intersectsPolygonTemplate": [{
|
|
418
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $intersects: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]
|
|
418
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $intersects: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]}}}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $intersects: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]}}\n {{/structSubPropertyApiName}}\n });"
|
|
419
419
|
}],
|
|
420
420
|
"intersectsBboxTemplate": [{
|
|
421
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}}: { $intersects: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}}: { $intersects: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}\n {{/structSubPropertyApiName}}\n });"
|
|
421
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({\n {{#structSubPropertyApiName}}\n {{property}}: { {{structSubPropertyApiName}} : { $intersects: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}}\n {{/structSubPropertyApiName}}\n {{^structSubPropertyApiName}}\n {{property}} : { $intersects: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128]}}\n {{/structSubPropertyApiName}}\n });"
|
|
422
422
|
}],
|
|
423
423
|
"notTemplate": [{
|
|
424
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({ $not: { {{
|
|
425
|
-
"computedVariables": ["
|
|
424
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({ $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true }}});",
|
|
425
|
+
"computedVariables": ["primaryKeyPropertyV2"]
|
|
426
426
|
}],
|
|
427
427
|
"andTemplate": [{
|
|
428
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({ $and:[\n { $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true }}},\n { {{
|
|
429
|
-
"computedVariables": ["primaryKeyPropertyV2"
|
|
428
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({ $and:[\n { $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true }}},\n { {{primaryKeyPropertyV2.apiName}}: { $eq: \"<primaryKey>\" }}\n ]});",
|
|
429
|
+
"computedVariables": ["primaryKeyPropertyV2"]
|
|
430
430
|
}],
|
|
431
431
|
"orTemplate": [{
|
|
432
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({ $or:[\n { $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true }}},\n { {{
|
|
433
|
-
"computedVariables": ["primaryKeyPropertyV2"
|
|
432
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst {{objectType}}ObjectSet = client({{objectType}})\n .where({ $or:[\n { $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true }}},\n { {{primaryKeyPropertyV2.apiName}}: { $eq: \"<primaryKey>\" }}\n ]});",
|
|
433
|
+
"computedVariables": ["primaryKeyPropertyV2"]
|
|
434
434
|
}],
|
|
435
435
|
"containsTemplate": [{
|
|
436
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst filteredObjects = client({{objectType}})\n .where({\n {{property}}: { $contains: {{{arrayElementValue}}} }\n })",
|
|
436
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst filteredObjects = client({{objectType}})\n .where({\n {{property}} : { $contains: {{{arrayElementValue}}} }\n })",
|
|
437
437
|
"computedVariables": ["arrayElementValue"]
|
|
438
438
|
}],
|
|
439
439
|
"loadInterfacesReference": [{
|
|
@@ -443,26 +443,25 @@ export const snippets = {
|
|
|
443
443
|
"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];"
|
|
444
444
|
}],
|
|
445
445
|
"loadOrderedInterfacesReference": [{
|
|
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\
|
|
446
|
+
"template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type PageResult, type Result } from \"@osdk/client\";\n\nconst page: Result<PageResult<Osdk<{{interfaceApiName}}>>> = await client({{interfaceApiName}})\n .fetchPageWithErrors({\n $orderBy: {\"someProperty\": \"asc\"},\n $pageSize: 30\n });\n\nif (isOk(page)) {\n const interfaces = page.value.data;\n const interface1 = interfaces[0];\n}"
|
|
447
447
|
}],
|
|
448
448
|
"searchInterfacesReference": [{
|
|
449
|
-
"template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type PageResult, type Result } from \"@osdk/client\";\n\nconst page: Result<PageResult<Osdk<{{interfaceApiName}}>>> = await client({{interfaceApiName}})\n .where({\n $and:[\n { $not: {
|
|
450
|
-
"computedVariables": ["propertyValueV2"]
|
|
449
|
+
"template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { isOk, type Osdk, type PageResult, type Result } from \"@osdk/client\";\n\nconst page: Result<PageResult<Osdk<{{interfaceApiName}}>>> = await client({{interfaceApiName}})\n .where({\n $and:[\n { $not: { someProperty: { $isNull: true }}},\n { someProperty: { $eq: \"foo\" }}\n ]\n })\n .fetchPageWithErrors({\n $pageSize: 30\n });\n\nif (isOk(page)) {\n const interfaces = page.value.data;\n const interface1 = interfaces[0];\n}"
|
|
451
450
|
}],
|
|
452
451
|
"loadTimeSeriesPointsSnippet": [{
|
|
453
|
-
"template": "import
|
|
452
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getAllTimeSeriesPoints(obj: {{objectType}}) {\n return obj.{{property}}.getAllPoints();\n}"
|
|
454
453
|
}],
|
|
455
454
|
"loadRelativeTimeSeriesPointsSnippet": [{
|
|
456
|
-
"template": "import
|
|
455
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\n// Only supports ranges in the past\nfunction getRelativeTimeSeriesPoints(obj: {{objectType}}) {\n return obj.{{property}}.getAllPoints({\n $before: 1,\n $unit: \"{{timeUnit}}\",\n })\n}"
|
|
457
456
|
}],
|
|
458
457
|
"loadAbsoluteTimeSeriesPointsSnippet": [{
|
|
459
|
-
"template": "import {
|
|
458
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getAbsoluteTimeSeriesPoints(obj: {{objectType}}) {\n return obj.{{property}}.getAllPoints({\n $startTime: \"2022-08-13T12:34:56Z\",\n $endTime: \"2022-08-14T12:34:56Z\",\n });\n}"
|
|
460
459
|
}],
|
|
461
460
|
"loadTimeSeriesFirstPointSnippet": [{
|
|
462
|
-
"template": "import
|
|
461
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getFirstTimeSeriesPoint(obj: {{objectType}}) {\n return obj.{{property}}.getFirstPoint();\n}"
|
|
463
462
|
}],
|
|
464
463
|
"loadTimeSeriesLastPointSnippet": [{
|
|
465
|
-
"template": "import
|
|
464
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getLastTimeSeriesPoint(obj: {{objectType}}) {\n return obj.{{property}}.getLastPoint();\n}"
|
|
466
465
|
}],
|
|
467
466
|
"loadGeotimeSeriesPointsSnippet": [{
|
|
468
467
|
"template": "// Upgrade to 2.1 for official support"
|
|
@@ -477,7 +476,7 @@ export const snippets = {
|
|
|
477
476
|
"template": "// Upgrade to 2.1 for official support"
|
|
478
477
|
}],
|
|
479
478
|
"loadObjectMetadataSnippet": [{
|
|
480
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst objectTypeMetadata = await client.fetchMetadata({{objectType}});\n\nif (objectTypeMetadata
|
|
479
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst objectTypeMetadata = await client.fetchMetadata({{objectType}});\n\nif (objectTypeMetadata.icon.type === \"blueprint\") {\n const blueprintIconName = objectTypeMetadata.icon.name;\n}\nconst currentVisibility = objectTypeMetadata.visibility;\nconst currentDescription = objectTypeMetadata.description;"
|
|
481
480
|
}],
|
|
482
481
|
"loadInterfaceMetadataSnippet": [{
|
|
483
482
|
"template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst interfaceTypeMetadata = await client.fetchMetadata({{interfaceApiName}});\n\nconst implementingObjectTypes = interfaceTypeMetadata.implementedBy;\nconst interfaceRid = interfaceTypeMetadata.rid;"
|
|
@@ -492,89 +491,87 @@ export const snippets = {
|
|
|
492
491
|
"template": "// Upgrade to 2.1 for official support"
|
|
493
492
|
}],
|
|
494
493
|
"derivedPropertyBaseExample": [{
|
|
495
|
-
"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(\"
|
|
494
|
+
"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(\"fooLink\").pivotTo(\"barLink\").selectProperty(\"foo\")\n })\n .where({\n \"newPropertyName\": { $gt: 10 }\n })\n .aggregate({\n $select: { \"newPropertyName:max\": \"unordered\" }\n });"
|
|
496
495
|
}],
|
|
497
496
|
"derivedPropertyApproximateDistinctAggregation": [{
|
|
498
|
-
"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(\"{{
|
|
497
|
+
"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(\"{{linkName}}\").aggregate(\"{{property}}:approximateDistinct\")\n })"
|
|
499
498
|
}],
|
|
500
499
|
"derivedPropertyExactDistinctAggregation": [{
|
|
501
|
-
"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(\"{{
|
|
500
|
+
"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(\"{{linkName}}\").aggregate(\"{{property}}:exactDistinct\")\n })"
|
|
502
501
|
}],
|
|
503
502
|
"derivedPropertyCollectToListAggregation": [{
|
|
504
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst maxObjectsInList = 75; // Adjust this value as needed between 1 and 100\nconst sum{{objectType}} = await client({{objectType}})\n .withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{
|
|
503
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst maxObjectsInList = 75; // Adjust this value as needed between 1 and 100\nconst sum{{objectType}} = await client({{objectType}})\n .withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkName}}\").aggregate(\"{{property}}:collectList\", maxObjectsInList)\n })"
|
|
505
504
|
}],
|
|
506
505
|
"derivedPropertyCollectToSetAggregation": [{
|
|
507
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst maxObjectsInSet = 75; // Adjust this value as needed between 1 and 100\nconst sum{{objectType}} = await client({{objectType}})\n .withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{
|
|
506
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst maxObjectsInSet = 75; // Adjust this value as needed between 1 and 100\nconst sum{{objectType}} = await client({{objectType}})\n .withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkName}}\").aggregate(\"{{property}}:collectSet\", maxObjectsInSet)\n })"
|
|
508
507
|
}],
|
|
509
508
|
"derivedPropertyCountAggregation": [{
|
|
510
|
-
"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(\"{{
|
|
509
|
+
"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(\"{{linkName}}\").aggregate(\"$count\")\n })"
|
|
511
510
|
}],
|
|
512
511
|
"derivedPropertySelectPropertyAggregation": [{
|
|
513
|
-
"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(\"{{
|
|
512
|
+
"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(\"{{linkName}}\").selectProperty(\"{{property}}\")\n })"
|
|
514
513
|
}],
|
|
515
514
|
"derivedPropertyApproximatePercentileAggregation": [{
|
|
516
|
-
"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(\"{{
|
|
515
|
+
"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(\"{{linkName}}\").aggregate(\"{{property}}:approximatePercentile\", 0.5)\n })"
|
|
517
516
|
}],
|
|
518
517
|
"derivedPropertyNumericAggregation": [{
|
|
519
|
-
"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(\"{{
|
|
518
|
+
"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(\"{{linkName}}\").aggregate(\"{{property}}:{{operation}}\")\n })"
|
|
520
519
|
}],
|
|
521
520
|
"objectSetOperationsGuide": [{
|
|
522
|
-
"template": "
|
|
521
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\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);"
|
|
523
522
|
}],
|
|
524
523
|
"objectSetOperationsUnion": [{
|
|
525
|
-
"template": "
|
|
524
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\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)"
|
|
526
525
|
}],
|
|
527
526
|
"objectSetOperationsSubtract": [{
|
|
528
|
-
"template": "
|
|
527
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\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\n// Return objects in objectSetA that are not present in either objectSetB or objectSetC\nconst result = objectSetA\n .subtract(objectSetB)\n .subtract(objectSetC); // alternatively: objectSetA.subtract(objectSetB, objectSetC)"
|
|
529
528
|
}],
|
|
530
529
|
"objectSetOperationsIntersect": [{
|
|
531
|
-
"template": "
|
|
530
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}/ontology/objects\";\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\n// Return all objects common to objectSetA, objectSetB and objectSetC\nconst result = objectSetA\n .intersect(objectSetB)\n .intersect(objectSetC); // alternatively: objectSetA.intersect(objectSetB, objectSetC)"
|
|
532
531
|
}],
|
|
533
532
|
"searchAround": [{
|
|
534
|
-
"template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\n// Object set containing objects a, b and c\nconst objects = client({{sourceObjectType}})\n .where({ {{rawLinkedPrimaryKeyProperty.apiName}}: { $in: [\"a\", \"b\", \"c\"]}});\n\n// Traverse the selected link type to find all objects of type\n//
|
|
533
|
+
"template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\n// Object set containing objects a, b and c\nconst objects = client({{sourceObjectType}})\n .where({ {{rawLinkedPrimaryKeyProperty.apiName}}: { $in: [\"a\", \"b\", \"c\"]}});\n\n// Traverse the selected link type to find all objects of type\n// {{linkedObjectType}} linked to objects a, b and c\nconst linkedObjects = await objects.pivotTo(\"{{linkApiName}}\");"
|
|
535
534
|
}]
|
|
536
535
|
}
|
|
537
536
|
},
|
|
538
537
|
"2.1.0": {
|
|
539
538
|
"snippets": {
|
|
540
539
|
"loadGeotimeSeriesPointsSnippet": [{
|
|
541
|
-
"template": "import
|
|
540
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getAllTimeSeriesPoints(obj: {{objectType}}) {\n return obj.{{property}}.getAllValues();\n}"
|
|
542
541
|
}],
|
|
543
542
|
"loadRelativeGeotimeSeriesPointsSnippet": [{
|
|
544
|
-
"template": "import
|
|
543
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\n// Only supports ranges in the past\nfunction getRelativeTimeSeriesPoints(obj: {{objectType}}) {\n return obj.{{property}}.getAllValues({\n $before: 1,\n $unit: \"{{timeUnit}}\",\n })\n}"
|
|
545
544
|
}],
|
|
546
545
|
"loadAbsoluteGeotimeSeriesPointsSnippet": [{
|
|
547
|
-
"template": "import
|
|
546
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getAbsoluteTimeSeriesPoints(obj: {{objectType}}) {\n return obj.{{property}}.getAllValues({\n $startTime: \"2022-08-13T12:34:56Z\",\n $endTime: \"2022-08-14T12:34:56Z\",\n });\n}"
|
|
548
547
|
}],
|
|
549
548
|
"loadGeotimeSeriesLastPointSnippet": [{
|
|
550
|
-
"template": "import
|
|
549
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n\nfunction getLastTimeSeriesPoint(obj: {{objectType}}) {\n return obj.{{property}}.getLatestValue();\n}"
|
|
551
550
|
}],
|
|
552
551
|
"subscribeToObjectSetInstructions": [{
|
|
553
|
-
"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
|
|
552
|
+
"template": "import { {{objectOrInterfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\n// A map of primary keys to objects loaded through the SDK\nconst objects: { [key: string]: {{objectOrInterfaceApiName}}.OsdkInstance } = ...\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 const currentObject = objects[update.object.$primaryKey];\n if (currentObject !== undefined) {\n currentObject[\"<propertyName>\"] = update.object[\"<propertyName>\"] ?? currentObject[\"<propertyName>\"];\n }\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 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 console.error(err);\n },\n onOutOfDate() {\n // We could not keep track of all changes. Please reload the objects in your set.\n },\n },\n { properties: [ {{#propertyNames}}\"{{.}}\", {{/propertyNames}}] }\n);\n\nsubscription.unsubscribe();"
|
|
554
553
|
}],
|
|
555
554
|
"uploadMedia": [{
|
|
556
|
-
"template": "import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\nimport { {{objectType}}
|
|
557
|
-
"computedVariables": ["propertyValueV2"]
|
|
555
|
+
"template": "import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\nimport { {{objectType}} } from \"{{{packageName}}}\"\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport { Result, isOk } from \"@osdk/client\";\nimport type { MediaReference } from \"@osdk/api\";\n\n// To upload media with 2.x, it has to be linked to an Action call\nasync function uploadMedia() {\n const file = await fetch(\"file.json\");\n const data = await file.blob();\n\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: \"MediaPropertyApi\",\n });\n}\n\nconst mediaReference: MediaReference = await uploadMedia();\nconst actionResult = client(mediaUploadingAction).applyAction({ media_parameter: mediaReference });"
|
|
558
556
|
}],
|
|
559
557
|
"readMedia": [{
|
|
560
|
-
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nconst result = await client({{objectType}}).fetchOne(
|
|
561
|
-
"computedVariables": ["primaryKeyPropertyValueV2"]
|
|
558
|
+
"template": "import { {{objectType}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { MediaMetadata, MediaReference } from \"@osdk/api\";\nimport { Osdk, Result } from \"@osdk/client\";\n\nconst result = await client({{objectType}}).fetchOne(\"<primaryKey>\");\n\n// Fetch metadata of a media property\nconst mediaMetadata = await result.{{property}}?.fetchMetadata();\n\n// Fetch contents of a media property\nconst response = await result.{{property}}?.fetchContents();\n\nif (response.ok) {\n const data = await response.blob();\n ...\n}"
|
|
562
559
|
}]
|
|
563
560
|
}
|
|
564
561
|
},
|
|
565
562
|
"2.4.0": {
|
|
566
563
|
"snippets": {
|
|
567
564
|
"derivedPropertyNumericExpression": [{
|
|
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
|
|
565
|
+
"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 {{^isUnary}}\n baseObjectSet.pivotTo(\"{{linkName}}\")\n .selectProperty(\"{{property}}\").{{operation}}(\n baseObjectSet.pivotTo(\"{{linkName}}\").aggregate(\"$count\"))\n {{/isUnary}}\n {{#isUnary}}\n baseObjectSet.pivotTo(\"{{linkName}}\").selectProperty(\"{{property}}\").{{operation}}()\n {{/isUnary}}\n });"
|
|
569
566
|
}],
|
|
570
567
|
"derivedPropertyDatetimeExpression": [{
|
|
571
|
-
"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
|
|
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 });"
|
|
572
569
|
}],
|
|
573
570
|
"nearestNeighborsTextQuery": [{
|
|
574
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();"
|
|
575
572
|
}],
|
|
576
573
|
"nearestNeighborsVectorQuery": [{
|
|
577
|
-
"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)
|
|
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();"
|
|
578
575
|
}]
|
|
579
576
|
}
|
|
580
577
|
}
|