@osdk/client 0.2.1 → 0.3.1

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/js/{chunk-MT2HE6AQ.mjs → chunk-DVD5PAXO.mjs} +119 -8
  3. package/build/js/chunk-DVD5PAXO.mjs.map +1 -0
  4. package/build/js/{chunk-CCKGGMYW.cjs → chunk-YVZITKIQ.cjs} +117 -6
  5. package/build/js/chunk-YVZITKIQ.cjs.map +1 -0
  6. package/build/js/index.cjs +15 -13
  7. package/build/js/index.cjs.map +1 -1
  8. package/build/js/index.mjs +12 -10
  9. package/build/js/index.mjs.map +1 -1
  10. package/build/js/public/objects.cjs +3 -3
  11. package/build/js/public/objects.mjs +1 -1
  12. package/build/types/Client.d.ts +2 -2
  13. package/build/types/Definitions.d.ts +4 -4
  14. package/build/types/OsdkObjectFrom.d.ts +2 -0
  15. package/build/types/definitions/LinkDefinitions.d.ts +19 -0
  16. package/build/types/definitions/LinkDefinitions.test.d.ts +1 -0
  17. package/build/types/generated/object-set-service/api/ObjectSetServiceV2/getLinks.d.ts +1 -1
  18. package/build/types/generated/ontology-metadata/api/GetFeatureConfigurationsResponse.d.ts +1 -0
  19. package/build/types/generated/ontology-metadata/api/OntologyMetadataGothamTypeMappingService/checkTranslationEligibility.d.ts +8 -0
  20. package/build/types/generated/ontology-metadata/api/OntologyMetadataGothamTypeMappingService.d.ts +1 -0
  21. package/build/types/generated/ontology-metadata/api/TypeGroupGetOrganizationsRequest.d.ts +7 -0
  22. package/build/types/generated/ontology-metadata/api/TypeGroupGetOrganizationsResponse.d.ts +9 -0
  23. package/build/types/generated/ontology-metadata/api/TypeGroupOrgsService/getOrganizationsForTypeGroups.d.ts +9 -0
  24. package/build/types/generated/ontology-metadata/api/TypeGroupOrgsService/setOrganizationsForTypeGroups.d.ts +9 -0
  25. package/build/types/generated/ontology-metadata/api/TypeGroupOrgsService.d.ts +2 -0
  26. package/build/types/generated/ontology-metadata/api/TypeGroupSetOrganizationsRequest.d.ts +11 -0
  27. package/build/types/generated/ontology-metadata/api/index.d.ts +4 -0
  28. package/build/types/generated/ontology-metadata/api/search/ActionTypeClause.d.ts +5 -1
  29. package/build/types/generated/ontology-metadata/api/typemapping/CaseSensitiveGothamObjectTypeUri.d.ts +6 -0
  30. package/build/types/generated/ontology-metadata/api/typemapping/CaseSensitiveGothamPropertyTypeUri.d.ts +6 -0
  31. package/build/types/generated/ontology-metadata/api/typemapping/CheckTranslationEligibilityRequest.d.ts +8 -0
  32. package/build/types/generated/ontology-metadata/api/typemapping/CheckTranslationEligibilityResponse.d.ts +7 -0
  33. package/build/types/generated/ontology-metadata/api/typemapping/ClientTranslationEligibilityResult.d.ts +10 -0
  34. package/build/types/generated/ontology-metadata/api/typemapping/GothamDatasourceDelegateId.d.ts +5 -0
  35. package/build/types/generated/ontology-metadata/api/typemapping/IntegrationClientType.d.ts +4 -0
  36. package/build/types/generated/ontology-metadata/api/typemapping/LoadGothamTypeInstallationStatusesResponse.d.ts +4 -4
  37. package/build/types/generated/ontology-metadata/api/typemapping/TranslatableDatasource.d.ts +5 -0
  38. package/build/types/generated/ontology-metadata/api/typemapping/TranslationEligibility.d.ts +11 -0
  39. package/build/types/generated/ontology-metadata/api/typemapping/UntranslatableSecurity.d.ts +7 -0
  40. package/build/types/generated/ontology-metadata/api/typemapping/UntranslatableSecurityFailureType.d.ts +1 -0
  41. package/build/types/generated/ontology-metadata/api/typemapping/index.d.ts +11 -0
  42. package/build/types/generated/ontology-metadata/branch/api/BranchStatus.d.ts +11 -1
  43. package/build/types/generated/ontology-metadata/branch/api/LoadOntologyBranchMarkingsRequest.d.ts +2 -0
  44. package/build/types/generated/ontology-metadata/branch/api/LoadOntologyBranchMarkingsResponse.d.ts +4 -0
  45. package/build/types/generated/ontology-metadata/branch/api/MediaReferencePropertyTypeConstraintError.d.ts +9 -0
  46. package/build/types/generated/ontology-metadata/branch/api/MediaReferencePropertyTypeHasNoDatasourcesError.d.ts +9 -0
  47. package/build/types/generated/ontology-metadata/branch/api/OntologyBranchService/loadOntologyBranchMarkings.d.ts +9 -0
  48. package/build/types/generated/ontology-metadata/branch/api/OntologyBranchService/setOntologyBranchOrganizationMarkings.d.ts +2 -2
  49. package/build/types/generated/ontology-metadata/branch/api/OntologyBranchService.d.ts +1 -0
  50. package/build/types/generated/ontology-metadata/branch/api/ValidationError.d.ts +6 -1
  51. package/build/types/generated/ontology-metadata/branch/api/index.d.ts +4 -0
  52. package/build/types/generatedNoCheck/Ontology.d.ts +483 -0
  53. package/build/types/generatedNoCheck/OntologyMetadata.d.ts +5 -0
  54. package/build/types/generatedNoCheck/index.d.ts +1 -0
  55. package/build/types/generatedNoCheck/ontology/actions/actionTakesObjectSet.d.ts +15 -0
  56. package/build/types/generatedNoCheck/ontology/actions/createOffice.d.ts +35 -0
  57. package/build/types/generatedNoCheck/ontology/actions/createOfficeAndEmployee.d.ts +45 -0
  58. package/build/types/generatedNoCheck/ontology/actions/index.d.ts +6 -0
  59. package/build/types/generatedNoCheck/ontology/actions/moveOffice.d.ts +35 -0
  60. package/build/types/generatedNoCheck/ontology/actions/promoteEmployee.d.ts +27 -0
  61. package/build/types/generatedNoCheck/ontology/actions/promoteEmployeeObject.d.ts +30 -0
  62. package/build/types/generatedNoCheck/ontology/interfaces.d.ts +1 -0
  63. package/build/types/generatedNoCheck/ontology/objects/Employee.d.ts +49 -0
  64. package/build/types/generatedNoCheck/ontology/objects/ObjectWithTimestampPrimaryKey.d.ts +18 -0
  65. package/build/types/generatedNoCheck/ontology/objects/Office.d.ts +35 -0
  66. package/build/types/generatedNoCheck/ontology/objects/equipment.d.ts +18 -0
  67. package/build/types/generatedNoCheck/ontology/objects/objectTypeWithAllPropertyTypes.d.ts +158 -0
  68. package/build/types/generatedNoCheck/ontology/objects.d.ts +5 -0
  69. package/build/types/internal/conversions/legacyToModernSingleAggregationResult.d.ts +2 -2
  70. package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +2 -2
  71. package/build/types/object/Attachment.d.ts +8 -0
  72. package/build/types/object/ObjectDefinitions.test.d.ts +1 -0
  73. package/build/types/object/convertWireToOsdkObjects.d.ts +5 -3
  74. package/build/types/object/convertWireToOsdkObjects.test.d.ts +1 -0
  75. package/build/types/object/fetchPageOrThrow.d.ts +6 -4
  76. package/build/types/object/getLinkedObjectByPkOrThrow.d.ts +4 -0
  77. package/build/types/object/getLinkedObjectOrThrow.d.ts +4 -0
  78. package/build/types/object/object.test.d.ts +1 -0
  79. package/build/types/object/pageLinkedObjectsOrThrow.d.ts +9 -0
  80. package/build/types/objectSet/ObjectSet.d.ts +2 -5
  81. package/build/types/objectSet/ObjectSetListenerWebsocket.d.ts +2 -2
  82. package/build/types/objectSet/createObjectSet.d.ts +3 -3
  83. package/build/types/objectSet/toConjureObjectSet.d.ts +3 -3
  84. package/build/types/query/WhereClause.d.ts +2 -2
  85. package/build/types/util/test/mockOntology.d.ts +59 -0
  86. package/package.json +8 -3
  87. package/build/js/chunk-CCKGGMYW.cjs.map +0 -1
  88. package/build/js/chunk-MT2HE6AQ.mjs.map +0 -1
  89. package/build/types/internal/net/V2_BASE.d.ts +0 -1
  90. package/build/types/internal/net/index.d.ts +0 -1
  91. package/build/types/internal/net/types.d.ts +0 -357
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/object/aggregateOrThrow.ts","../../src/internal/conversions/legacyToModernSingleAggregationResult.ts","../../src/internal/conversions/modernToLegacyAggregationClause.ts","../../src/internal/conversions/modernToLegacyGroupByClause.ts","../../src/internal/conversions/modernToLegacyWhereClause.ts","../../src/object/fetchPageOrThrow.ts","../../src/createCachedOntologyTransform.ts","../../src/object/convertWireToOsdkObjects.ts","../../src/object/index.ts"],"names":["invariant","createOpenApiRequest"],"mappings":";;;;;;;AAgBA,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,OAAOA,gBAAe;;;ACFtB,OAAO,eAAe;AACf,SAAS,sCAAs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AAO;AACT;;;AFjDA,eAAsB,iBAAiB,QAAQ,YAAY,MAAM,YAAY;AAAA,EAC3E,MAAM;AAAA,EACN;AACF,GAAG;AACD,QAAM,OAAO;AAAA,IACX;AAAA;AAAA,IAEA,QAAQ,MAAM,UAAU,CAAC;AAAA;AAAA,EAC3B;AAEA,MAAI,MAAM,eAAe;AACvB,SAAK,YAAY,KAAK;AAAA,EACxB;AACA,QAAM,IAAI,MAAM,gBAAgBA,sBAAqB,OAAO,OAAO,OAAO,KAAK,GAAG,OAAO,SAAS,SAAS,iBAAiB,IAAI;AAChI,2BAAyB,QAAQ,YAAY,EAAE,IAAI;AAInD,SAAO;AACT;;;AGtCA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { aggregateObjectsV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult, modernToLegacyAggregationClause, modernToLegacyGroupByClause, modernToLegacyWhereClause } from \"../internal/conversions/index.js\";\nexport async function aggregateOrThrow(clientCtx, objectType, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.select),\n groupBy: [],\n where: undefined\n };\n if (req.groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.groupBy);\n }\n if (req.where) {\n body.where = modernToLegacyWhereClause(req.where);\n // TODO: orderBy\n // TODO The token stuff here sucks\n }\n\n const result = await aggregateObjectsV2(createOpenApiRequest(clientCtx.stack, clientCtx.fetch), clientCtx.ontology.metadata.ontologyApiName, objectType, body);\n if (!req.groupBy) {\n !(result.data.length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"no group by clause should mean only one data result\") : invariant(false) : void 0;\n return legacyToModernSingleAggregationResult(result.data[0]);\n }\n const ret = result.data.map(entry => {\n return {\n group: entry.group,\n values: legacyToModernSingleAggregationResult(entry)\n };\n }); // fixme\n\n return ret; // FIXME\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n !(parts.length == 2) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"assumed we were getting a `${key}.${type}`\") : invariant(false) : void 0;\n if (!(parts[0] in accumulator)) {\n accumulator[parts[0]] = {};\n }\n accumulator[parts[0]][parts[1]] = curValue.value;\n return accumulator;\n }, {});\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function modernToLegacyAggregationClause(select) {\n return Object.entries(select).flatMap(([k, v]) => {\n if (Array.isArray(v)) {\n return v.map(v2 => {\n return {\n type: v2,\n name: `${k}.${v2}`,\n field: k\n };\n });\n } else {\n return [{\n type: v,\n // FIXME v has additional possible values\n name: `${k}.${v}`,\n field: k\n }];\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function modernToLegacyGroupByClause(groupByClause) {\n if (!groupByClause) return [];\n return Object.entries(groupByClause).flatMap(([field, type]) => {\n if (type === \"exact\") {\n return [{\n type,\n field\n }];\n } else if (type.exactWithLimit) {\n return [{\n type: \"exact\",\n field,\n maxGroupCount: type.exactWithLimit\n }];\n } else {\n return [];\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nexport function modernToLegacyWhereClause(whereClause) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map(modernToLegacyWhereClause)\n };\n } else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map(modernToLegacyWhereClause)\n };\n } else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not)\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n const [field, filter] = parts[0];\n !(filter != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Defined key values are only allowed when they are not undefined.\") : invariant(false) : void 0;\n if (typeof filter === \"string\" || typeof filter === \"number\") {\n return {\n type: \"eq\",\n field,\n value: filter\n };\n }\n !(Object.keys(filter).length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"WhereClause Filter with multiple properties isn't allowed\") : invariant(false) : void 0;\n const type = Object.keys(filter)[0];\n !(filter[type] != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n if (type === \"ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[type]\n }\n };\n }\n return {\n type,\n field,\n value: filter[type]\n };\n }\n return {\n type: \"and\",\n value: Object.entries(whereClause).map(([field, filter]) => {\n !(filter != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Defined key values are only allowed when they are not undefined.\") : invariant(false) : void 0;\n if (typeof filter === \"string\" || typeof filter === \"number\") {\n return {\n type: \"eq\",\n field,\n value: filter\n };\n }\n !(Object.keys(filter).length === 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"WhereClause Filter with multiple properties isn't allowed\") : invariant(false) : void 0;\n const q = Object.keys(filter)[0];\n !(filter[q] != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n if (q === \"ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[q]\n }\n };\n }\n return {\n type: q,\n field,\n value: filter[q]\n };\n })\n };\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { loadObjectSetV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\nexport async function fetchPageOrThrow(client, objectType, args, objectSet = {\n type: \"base\",\n objectType\n}) {\n const body = {\n objectSet,\n // We have to do the following case because LoadObjectSetRequestV2 isnt readonly\n select: args?.select ?? [] // FIXME?\n };\n\n if (args?.nextPageToken) {\n body.pageToken = args.nextPageToken;\n }\n const r = await loadObjectSetV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, body);\n convertWireToOsdkObjects(client, objectType, r.data);\n\n // any is okay here because we have properly converted the wire objects via prototypes\n // which don't type out correctly.\n return r;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Creates a getter function that caches based on the ontology.objects[type] value\n *\n * Any extra arguments are passed through, but only the first args passed in will be used and are not considered as part of the caching\n */\nexport function createCachedOntologyTransform(creator) {\n // We can use the ObjectTypeDefinition as the key because it will be a globally unique singleton\n // Use Map instead of WeakMap here so usage for things like object prototypes do not churn over time\n const cache = new Map();\n return (ontology, type) => {\n const objectDefinition = ontology.objects[type];\n let result = cache.get(objectDefinition);\n if (result == null) {\n result = creator(ontology, type);\n cache.set(objectDefinition, result);\n }\n return result;\n };\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createCachedOntologyTransform } from \"../createCachedOntologyTransform.js\";\nconst getPrototype = createCachedOntologyTransform(createPrototype);\nfunction createPrototype(ontology, type) {\n const objDef = ontology.objects[type];\n const proto = {};\n\n // Earlier versions of \"2.0\" included this by hand (even though it seems the wire gives it to us anyway).\n // Its deprecated but I'm it for now (lets delete after Dec 31, 2023) so our beta users can transition.\n Object.defineProperty(proto, \"__name\", {\n value: type,\n enumerable: false,\n configurable: false,\n writable: false\n });\n return proto;\n}\nexport function convertWireToOsdkObjects(client, apiName, objs) {\n const proto = getPrototype(client.ontology, apiName);\n for (const obj of objs) {\n Object.setPrototypeOf(obj, proto);\n\n // Saving this code in case we want to come back to temporal. For now its not worth the\n // risk and we can stick to string until we know what we want.\n // ====================================================================================================\n // FIXME\n // Im not going for performance for now, just something usable by beta users\n // Also not married to the $raw\n // obj[\"$raw\"] = {};\n\n // for (\n // const [key, def] of Object.entries(\n // client.ontology.objects[apiName].properties,\n // )\n // ) {\n // if (!(key in obj)) continue;\n // obj[\"$raw\"][key] = obj[key];\n\n // if (def.type === \"timestamp\") {\n // const value = obj[key] as string | undefined;\n // if (value !== undefined) {\n // obj[key] = Temporal.Instant.from(value);\n // }\n // } else if (def.type === \"datetime\") {\n // const value = obj[key] as string | undefined;\n // if (value !== undefined) {\n // obj[key] = Temporal.PlainDateTime.from(value);\n // }\n // }\n // }\n }\n\n return objs;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { aggregateOrThrow } from \"./aggregateOrThrow.js\";\nexport { fetchPageOrThrow } from \"./fetchPageOrThrow.js\";"]}
@@ -1 +0,0 @@
1
- export declare const V2_BASE = "api/v2/ontologies";
@@ -1 +0,0 @@
1
- export * as Wire from "./types.js";
@@ -1,357 +0,0 @@
1
- export interface AggregationClause {
2
- type: string;
3
- field?: string;
4
- name: string;
5
- }
6
- export type AggregationValueType = number | string | boolean;
7
- export type BaseGroupValue = number | string | boolean;
8
- export type Bucketing<T> = {
9
- startValue?: T;
10
- endValue: T;
11
- } | {
12
- startValue: T;
13
- endValue?: T;
14
- };
15
- export type GroupValue = BaseGroupValue | Bucketing<BaseGroupValue>;
16
- export interface WhereClauseV2 {
17
- type: string;
18
- field?: string;
19
- value?: string | number | BoundingBoxFilter | PolyGonGeoJson | DistanceOf | boolean | WhereClauseV2 | WhereClauseV2[];
20
- }
21
- export type BoundingBoxFilter = {
22
- topLeft: PointGeoJson;
23
- bottomRight: PointGeoJson;
24
- };
25
- export type PolyGonGeoJson = {
26
- type: "Polygon";
27
- coordinates: number[][][];
28
- };
29
- export type DistanceOf = {
30
- center: PointGeoJson;
31
- distance: {
32
- value: number;
33
- unit: string;
34
- };
35
- };
36
- export type PointGeoJson = {
37
- type: "Point";
38
- coordinates: number[];
39
- };
40
- export interface SearchClauseV2 {
41
- where?: WhereClauseV2;
42
- orderBy?: {
43
- fields: OrderByClause[];
44
- };
45
- pageSize?: number;
46
- pageToken?: string;
47
- }
48
- export interface OrderByClause {
49
- field: string;
50
- direction: string;
51
- }
52
- export type GroupByClause = GroupByExact | GroupByFixedWidth | GroupByDuration | GroupByRanges;
53
- export type GroupByExact = {
54
- type: "exact";
55
- field: string;
56
- maxGroupCount?: number;
57
- };
58
- export type GroupByFixedWidth = {
59
- type: "fixedWidth";
60
- field: string;
61
- fixedWidth: number;
62
- };
63
- export type TimeUnit = "MILLISECONDS" | "SECONDS" | "MINUTES" | "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS" | "QUARTERS";
64
- export type GroupByDuration = {
65
- type: "duration";
66
- field: string;
67
- unit: TimeUnit;
68
- value: number;
69
- };
70
- export type GroupByRanges = {
71
- type: "ranges";
72
- field: string;
73
- ranges: Array<{
74
- startValue?: string | number;
75
- endValue: string | number;
76
- } | {
77
- startValue: string | number;
78
- endValue?: string | number;
79
- }>;
80
- };
81
- export interface AggregateObjectsV2Body {
82
- aggregation: AggregationClause[];
83
- groupBy?: GroupByClause[];
84
- where?: SearchClauseV2;
85
- }
86
- export type AggregationAPIResponse = {
87
- excludedItems?: number;
88
- data: Array<{
89
- group: {
90
- [key: string]: GroupValue;
91
- };
92
- metrics: Array<{
93
- name: string;
94
- value: AggregationValueType;
95
- }>;
96
- }>;
97
- };
98
- export type AggregateObjectsResponseV2 = {
99
- excludedItems?: number;
100
- data: Array<AggregateObjectsResponseItemV2>;
101
- };
102
- export type AggregateObjectsResponseItemV2 = {
103
- group: Record<AggregationGroupKeyV2, AggregationGroupValueV2>;
104
- metrics: Array<AggregationMetricResultV2>;
105
- };
106
- export type AggregationGroupKeyV2 = string;
107
- export type AggregationGroupValueV2 = any;
108
- export type AggregationMetricResultV2 = {
109
- name: string;
110
- value?: any;
111
- };
112
- export type LoadObjectSetRequestV2 = {
113
- objectSet: ObjectSet;
114
- orderBy?: SearchOrderBy;
115
- select: Array<SelectedPropertyApiName>;
116
- pageToken?: PageToken;
117
- pageSize?: PageSize;
118
- };
119
- export type SearchOrderBy = {
120
- fields: Array<SearchOrdering>;
121
- };
122
- export type SearchOrdering = {
123
- field: string;
124
- direction?: string;
125
- };
126
- export type SelectedPropertyApiName = string;
127
- export type PageToken = string;
128
- export type PageSize = number;
129
- export type ObjectRid = string;
130
- export type ObjectSet = (ObjectSetBaseType & {
131
- type: "base";
132
- }) | (ObjectSetStaticType & {
133
- type: "static";
134
- }) | (ObjectSetReferenceType & {
135
- type: "reference";
136
- }) | (ObjectSetFilterType & {
137
- type: "filter";
138
- }) | (ObjectSetUnionType & {
139
- type: "union";
140
- }) | (ObjectSetIntersectionType & {
141
- type: "intersect";
142
- }) | (ObjectSetSubtractType & {
143
- type: "subtract";
144
- }) | (ObjectSetSearchAroundType & {
145
- type: "searchAround";
146
- });
147
- export type ObjectSetBaseType = {
148
- objectType: string;
149
- };
150
- export type ObjectSetStaticType = {
151
- objects: Array<ObjectRid>;
152
- };
153
- export type ObjectSetReferenceType = {
154
- reference: string;
155
- };
156
- export type ObjectSetFilterType = {
157
- objectSet: ObjectSet;
158
- where: SearchJsonQueryV2;
159
- };
160
- export type ObjectSetIntersectionType = {
161
- objectSets: Array<ObjectSet>;
162
- };
163
- /** */
164
- export type ObjectSetUnionType = {
165
- objectSets: Array<ObjectSet>;
166
- };
167
- export type ObjectSetSubtractType = {
168
- objectSets: Array<ObjectSet>;
169
- };
170
- export type ObjectSetSearchAroundType = {
171
- objectSet: ObjectSet;
172
- link: LinkTypeApiName;
173
- };
174
- export type LinkTypeApiName = string;
175
- export type SearchJsonQueryV2 = (LtQuery & {
176
- type: "lt";
177
- }) | (GtQuery & {
178
- type: "gt";
179
- }) | (LteQuery & {
180
- type: "lte";
181
- }) | (GteQuery & {
182
- type: "gte";
183
- }) | (EqualsQuery & {
184
- type: "eq";
185
- }) | (IsNullQuery & {
186
- type: "isNull";
187
- }) | (ContainsQuery & {
188
- type: "contains";
189
- }) | (AndQueryV2 & {
190
- type: "and";
191
- }) | (OrQueryV2 & {
192
- type: "or";
193
- }) | (NotQueryV2 & {
194
- type: "not";
195
- }) | (StartsWithQuery & {
196
- type: "startsWith";
197
- }) | (ContainsAllTermsInOrderQuery & {
198
- type: "containsAllTermsInOrder";
199
- }) | (ContainsAnyTermQuery & {
200
- type: "containsAnyTerm";
201
- }) | (ContainsAllTermsQuery & {
202
- type: "containsAllTerms";
203
- }) | (WithinDistanceOfQuery & {
204
- type: "withinDistanceOf";
205
- }) | (WithinBoundingBoxQuery & {
206
- type: "withinBoundingBox";
207
- }) | (IntersectsBoundingBoxQuery & {
208
- type: "intersectsBoundingBox";
209
- }) | (DoesNotIntersectBoundingBoxQuery & {
210
- type: "doesNotIntersectBoundingBox";
211
- }) | (WithinPolygonQuery & {
212
- type: "withinPolygon";
213
- }) | (IntersectsPolygonQuery & {
214
- type: "intersectsPolygon";
215
- }) | (DoesNotIntersectPolygonQuery & {
216
- type: "doesNotIntersectPolygon";
217
- });
218
- export type LtQuery = {
219
- field: string;
220
- value: any;
221
- };
222
- export type GtQuery = {
223
- field: string;
224
- value: any;
225
- };
226
- export type LteQuery = {
227
- field: string;
228
- value: any;
229
- };
230
- /** Returns objects where the specified field is greater than or equal to a value. */
231
- export type GteQuery = {
232
- field: string;
233
- value: any;
234
- };
235
- /** Returns objects where the specified field is equal to a value. */
236
- export type EqualsQuery = {
237
- field: string;
238
- value: any;
239
- };
240
- /** Returns objects based on the existence of the specified field. */
241
- export type IsNullQuery = {
242
- field: string;
243
- value: boolean;
244
- };
245
- /** Returns objects where the specified array contains a value. */
246
- export type ContainsQuery = {
247
- field: string;
248
- value: any;
249
- };
250
- export type AndQueryV2 = {
251
- value: Array<SearchJsonQueryV2>;
252
- };
253
- export type OrQueryV2 = {
254
- value: Array<SearchJsonQueryV2>;
255
- };
256
- export type NotQueryV2 = {
257
- value: SearchJsonQueryV2;
258
- };
259
- export type StartsWithQuery = {
260
- field: string;
261
- value: string;
262
- };
263
- export type ContainsAllTermsInOrderQuery = {
264
- field: string;
265
- value: string;
266
- };
267
- export type ContainsAnyTermQuery = {
268
- field: string;
269
- value: string;
270
- fuzzy?: Fuzzy;
271
- };
272
- export type ContainsAllTermsQuery = {
273
- field: string;
274
- value: string;
275
- fuzzy?: Fuzzy;
276
- };
277
- export type WithinDistanceOfQuery = {
278
- field: string;
279
- value: CenterPoint;
280
- };
281
- export type WithinBoundingBoxQuery = {
282
- field: string;
283
- value: BoundingBoxValue;
284
- };
285
- export type IntersectsBoundingBoxQuery = {
286
- field: string;
287
- value: BoundingBoxValue;
288
- };
289
- export type DoesNotIntersectBoundingBoxQuery = {
290
- field: string;
291
- value: BoundingBoxValue;
292
- };
293
- export type WithinPolygonQuery = {
294
- field: string;
295
- value: PolygonValue;
296
- };
297
- export type IntersectsPolygonQuery = {
298
- field: string;
299
- value: PolygonValue;
300
- };
301
- export type DoesNotIntersectPolygonQuery = {
302
- field: string;
303
- value: PolygonValue;
304
- };
305
- export type CenterPoint = {
306
- center: CenterPointTypes;
307
- distance: Distance;
308
- };
309
- export type CenterPointTypes = GeoPoint & {
310
- type: "Point";
311
- };
312
- export type GeoPoint = {
313
- coordinates: Position;
314
- bbox?: BBox;
315
- };
316
- export type Position = Array<Coordinate>;
317
- export type Fuzzy = boolean;
318
- export type Coordinate = number;
319
- export type BBox = Array<Coordinate>;
320
- export type Distance = {
321
- value: number;
322
- unit: DistanceUnit;
323
- };
324
- export type DistanceUnit = "MILLIMETERS" | "CENTIMETERS" | "METERS" | "KILOMETERS" | "INCHES" | "FEET" | "YARDS" | "MILES" | "NAUTICAL_MILES";
325
- export type BoundingBoxValue = {
326
- topLeft: WithinBoundingBoxPoint;
327
- bottomRight: WithinBoundingBoxPoint;
328
- };
329
- export type WithinBoundingBoxPoint = GeoPoint & {
330
- type: "Point";
331
- };
332
- export type PolygonValue = Polygon & {
333
- type: "Polygon";
334
- };
335
- export type Polygon = {
336
- coordinates: Array<LinearRing>;
337
- bbox?: BBox;
338
- };
339
- export type LinearRing = Array<Position>;
340
- type ApiValueBaseType = string | number | boolean;
341
- type ApiValueType = ApiValueBaseType[] | ApiValueBaseType;
342
- type rid = string;
343
- export type OntologyObjectV2 = {
344
- [key: string]: ApiValueType;
345
- } & {
346
- __rid: rid;
347
- __primaryKey: ApiValueType;
348
- };
349
- export type PagedResponse<T> = {
350
- data: T[];
351
- nextPageToken?: string;
352
- };
353
- export type PageOptions = {
354
- pageSize?: number;
355
- pageToken?: string;
356
- };
357
- export {};