@osdk/faux 0.3.0-beta.2 → 0.3.0-beta.3
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 +15 -0
- package/build/browser/FauxFoundry/FauxOntology.js +4 -2
- package/build/browser/FauxFoundry/FauxOntology.js.map +1 -1
- package/build/cjs/index.cjs +21 -19
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/FauxFoundry/FauxOntology.js +4 -2
- package/build/esm/FauxFoundry/FauxOntology.js.map +1 -1
- package/build/types/FauxFoundry/FauxOntology.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @osdk/shared.test
|
|
2
2
|
|
|
3
|
+
## 0.3.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7bdac45: Update Platform SDK dependency
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7bdac45]
|
|
12
|
+
- Updated dependencies [7bdac45]
|
|
13
|
+
- Updated dependencies [20962bc]
|
|
14
|
+
- Updated dependencies [e48be06]
|
|
15
|
+
- @osdk/generator-converters@2.5.0-beta.3
|
|
16
|
+
- @osdk/api@2.5.0-beta.3
|
|
17
|
+
|
|
3
18
|
## 0.3.0-beta.2
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -33,7 +33,8 @@ export class FauxOntology {
|
|
|
33
33
|
objectTypes: {},
|
|
34
34
|
ontology,
|
|
35
35
|
queryTypes: {},
|
|
36
|
-
sharedPropertyTypes: {}
|
|
36
|
+
sharedPropertyTypes: {},
|
|
37
|
+
valueTypes: {}
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
get apiName() {
|
|
@@ -52,7 +53,8 @@ export class FauxOntology {
|
|
|
52
53
|
actionTypes: filterRecord(this.#ontology.actionTypes, request.actionTypes),
|
|
53
54
|
queryTypes: this.#getFilteredQueryTypes(request),
|
|
54
55
|
interfaceTypes: filterRecord(this.#ontology.interfaceTypes, request.interfaceTypes),
|
|
55
|
-
sharedPropertyTypes: {}
|
|
56
|
+
sharedPropertyTypes: {},
|
|
57
|
+
valueTypes: {}
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
getAllInterfaceTypes() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FauxOntology.js","names":["semver","valid","invariant","ActionNotFoundError","LinkTypeNotFound","ObjectNotFoundError","ObjectTypeDoesNotExistError","QueryNotFoundError","OpenApiCallError","FauxOntology","ontology","actionImpl","Map","queryImpl","constructor","actionTypes","interfaceTypes","objectTypes","queryTypes","sharedPropertyTypes","apiName","getOntologyFullMetadata","getFilteredOntologyMetadata","request","Object","fromEntries","entries","filter","objectType","includes","map","objectTypeApiName","objectTypeDefinition","linkTypes","linkType","filterRecord","getFilteredQueryTypes","getAllInterfaceTypes","values","getAllObjectTypes","getAllActionTypes","getAllQueryTypes","getInterfaceType","interfaceType","ret","undefined","getObjectTypeFullMetadata","getObjectTypeFullMetadataOrThrow","getActionDef","actionTypeApiName","actionType","getActionImpl","impl","get","process","env","NODE_ENV","getQueryDef","queryTypeApiNameAndVersion","queryType","convertToVersionedApiName","getQueryImpl","queryTypeApiName","version","versionMap","rsort","Array","from","keys","getInterfaceToObjectTypeMappings","objectApiNames","objectDefs","ifaceToObjMap","objDef","ifaceApiName","properties","implementsInterfaces2","getLinkTypeSideV2","linkTypeName","find","a","getOtherLinkTypeSideV2OrThrow","thisSideLink","otherObj","candidates","l","linkTypeRid","length","candidate","getBothLinkTypeSides","leftObjectType","leftLinkName","rightObjectType","leftTypeSideV2","rightTypeSideV2","registerObjectType","def","Error","registerActionType","implementation","set","registerQueryType","has","registerInterfaceType","registerSharedPropertyType","#getFilteredQueryTypes","remappedQueryTypes","x","queryTypeDefinition","indexOf","#convertToVersionedApiName","extractVersion","split","record","key"],"sources":["FauxOntology.ts"],"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 { type ObjectTypeDefinition } from \"@osdk/api\";\nimport type * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type {\n LoadOntologyMetadataRequest,\n VersionedQueryTypeApiName,\n} from \"@osdk/internal.foundry.ontologies\";\nimport semver, { valid } from \"semver\";\nimport invariant from \"tiny-invariant\";\nimport type { ReadonlyDeep } from \"type-fest\";\nimport {\n ActionNotFoundError,\n LinkTypeNotFound,\n ObjectNotFoundError,\n ObjectTypeDoesNotExistError,\n QueryNotFoundError,\n} from \"../errors.js\";\nimport { OpenApiCallError } from \"../handlers/util/handleOpenApiCall.js\";\nimport type { FauxActionImpl } from \"./FauxActionImpl.js\";\nimport type { FauxQueryImpl } from \"./FauxQueryImpl.js\";\nimport type { TH_ObjectTypeFullMetadata } from \"./typeHelpers/TH_ObjectTypeFullMetadata.js\";\n\n/**\n * Currently Unsupported Concepts:\n * - many:many links.\n */\nexport class FauxOntology {\n #ontology: OntologiesV2.OntologyFullMetadata;\n #actionImpl: Map<OntologiesV2.ActionTypeApiName, FauxActionImpl> = new Map();\n #queryImpl: Map<\n OntologiesV2.QueryApiName,\n Map<OntologiesV2.FunctionVersion, FauxQueryImpl>\n > = new Map();\n\n constructor(ontology: OntologiesV2.OntologyV2) {\n this.#ontology = {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology,\n queryTypes: {},\n sharedPropertyTypes: {},\n };\n }\n\n get apiName(): OntologiesV2.OntologyApiName {\n return this.#ontology.ontology.apiName;\n }\n\n getOntologyFullMetadata(): OntologiesV2.OntologyFullMetadata {\n return this.#ontology;\n }\n\n getFilteredOntologyMetadata(\n request: OntologiesV2.LoadOntologyMetadataRequest,\n ): OntologiesV2.OntologyFullMetadata {\n return {\n ontology: this.#ontology.ontology,\n objectTypes: Object.fromEntries(\n Object.entries(this.#ontology.objectTypes).filter(([objectType]) =>\n request.objectTypes.includes(objectType)\n ).map(([objectTypeApiName, objectTypeDefinition]) => [\n objectTypeApiName,\n {\n ...objectTypeDefinition,\n linkTypes: objectTypeDefinition.linkTypes.filter(linkType =>\n request.linkTypes.includes(linkType.apiName)\n ),\n },\n ]),\n ),\n actionTypes: filterRecord(\n this.#ontology.actionTypes,\n request.actionTypes,\n ),\n queryTypes: this.#getFilteredQueryTypes(request),\n\n interfaceTypes: filterRecord(\n this.#ontology.interfaceTypes,\n request.interfaceTypes,\n ),\n sharedPropertyTypes: {},\n };\n }\n\n getAllInterfaceTypes(): OntologiesV2.InterfaceType[] {\n return Object.values(this.#ontology.interfaceTypes);\n }\n\n getAllObjectTypes(): OntologiesV2.ObjectTypeFullMetadata[] {\n return Object.values(this.#ontology.objectTypes);\n }\n\n getAllActionTypes(): OntologiesV2.ActionTypeV2[] {\n return Object.values(this.#ontology.actionTypes);\n }\n\n getAllQueryTypes(): OntologiesV2.QueryTypeV2[] {\n return Object.values(this.#ontology.queryTypes);\n }\n\n getInterfaceType(interfaceType: string): OntologiesV2.InterfaceType {\n const ret = this.#ontology.interfaceTypes[interfaceType];\n\n if (ret === undefined) {\n throw new OpenApiCallError(\n 404,\n ObjectNotFoundError(interfaceType, \"\"),\n );\n }\n\n return (\n this.#ontology.interfaceTypes[interfaceType]\n );\n }\n\n public getObjectTypeFullMetadata(\n objectTypeApiName: string,\n ): OntologiesV2.ObjectTypeFullMetadata | undefined {\n return this.#ontology.objectTypes[objectTypeApiName];\n }\n\n public getObjectTypeFullMetadataOrThrow(\n objectTypeApiName: string,\n ): OntologiesV2.ObjectTypeFullMetadata {\n const objectType = this.#ontology.objectTypes[objectTypeApiName];\n if (objectType === undefined) {\n throw new OpenApiCallError(\n 404,\n ObjectTypeDoesNotExistError(objectTypeApiName),\n );\n }\n return objectType;\n }\n\n public getActionDef(actionTypeApiName: string): OntologiesV2.ActionTypeV2 {\n const actionType = this.#ontology.actionTypes[actionTypeApiName];\n if (actionType === undefined) {\n throw new OpenApiCallError(\n 404,\n ActionNotFoundError(),\n );\n }\n return actionType;\n }\n\n public getActionImpl(actionTypeApiName: string): FauxActionImpl {\n const impl = this.#actionImpl.get(actionTypeApiName);\n invariant(impl, \"Action implementation not found for \" + actionTypeApiName);\n return impl;\n }\n\n public getQueryDef(\n queryTypeApiNameAndVersion: string,\n ): OntologiesV2.QueryTypeV2 {\n const queryType = this.#ontology\n .queryTypes[this.#convertToVersionedApiName(queryTypeApiNameAndVersion)];\n if (queryType === undefined) {\n throw new OpenApiCallError(\n 404,\n QueryNotFoundError(queryTypeApiNameAndVersion),\n );\n }\n return queryType;\n }\n\n public getQueryImpl(\n queryTypeApiName: string,\n version?: string,\n ): FauxQueryImpl {\n const versionMap = this.#queryImpl.get(queryTypeApiName);\n\n const impl = version !== undefined\n ? versionMap?.get(version)\n : versionMap?.get(semver.rsort(Array.from(versionMap.keys() ?? []))[0]);\n\n if (!impl) {\n throw new OpenApiCallError(\n 404,\n QueryNotFoundError(queryTypeApiName),\n );\n }\n invariant(impl, \"Query implementation not found for \" + queryTypeApiName);\n return impl;\n }\n\n public getInterfaceToObjectTypeMappings(\n objectApiNames: Iterable<OntologiesV2.ObjectTypeApiName>,\n ): Record<\n OntologiesV2.InterfaceTypeApiName,\n OntologiesV2.InterfaceToObjectTypeMappings\n > {\n const objectDefs = Array.from(objectApiNames).map(apiName =>\n this.getObjectTypeFullMetadataOrThrow(apiName)\n );\n\n const ifaceToObjMap: Record<\n OntologiesV2.InterfaceTypeApiName,\n OntologiesV2.InterfaceToObjectTypeMappings\n > = {};\n\n for (const objDef of objectDefs) {\n for (\n const [ifaceApiName, { properties }] of Object.entries(\n objDef.implementsInterfaces2,\n )\n ) {\n if (ifaceToObjMap[ifaceApiName] === undefined) {\n ifaceToObjMap[ifaceApiName] = {};\n }\n\n ifaceToObjMap[ifaceApiName][objDef.objectType.apiName] = properties;\n }\n }\n\n return ifaceToObjMap;\n }\n\n public getLinkTypeSideV2(\n objectTypeApiName: string,\n linkTypeName: string,\n ): OntologiesV2.LinkTypeSideV2 {\n const objectType = this.getObjectTypeFullMetadataOrThrow(objectTypeApiName);\n const linkType = objectType.linkTypes.find((a) =>\n a.apiName === linkTypeName\n );\n if (linkType === undefined) {\n throw new OpenApiCallError(\n 404,\n LinkTypeNotFound(objectTypeApiName, linkTypeName),\n );\n }\n return linkType;\n }\n\n public getOtherLinkTypeSideV2OrThrow(\n objectTypeApiName: string,\n linkTypeName: string,\n ): OntologiesV2.LinkTypeSideV2 {\n const thisSideLink = this.getLinkTypeSideV2(\n objectTypeApiName,\n linkTypeName,\n );\n const otherObj = this.getObjectTypeFullMetadataOrThrow(\n thisSideLink.objectTypeApiName,\n );\n const candidates = otherObj.linkTypes.filter(l =>\n l.linkTypeRid === thisSideLink.linkTypeRid\n );\n if (otherObj.objectType.apiName !== objectTypeApiName) {\n // if its not the same object type then there should only be one\n invariant(\n candidates.length === 1,\n \"Expected only one candidate link type\",\n );\n return candidates[0];\n }\n // if its the same object type, then this could be a link that points to itself that\n // is 1:1, many:1 or many:many. In the 1:1 case, the link could have the same name\n // and there would only be 1 entry in that case. Otherwise there should be 2 entries\n // and we want the one that doesn't match the one passed in.\n if (candidates.length === 1) {\n return candidates[0];\n }\n invariant(\n candidates.length === 2,\n \"Expected only two candidate link types\",\n );\n const candidate = candidates.find(l => l.apiName !== thisSideLink.apiName);\n invariant(\n candidate,\n \"Expected to find a candidate link type that is not the same as the one passed in\",\n );\n return candidate;\n }\n\n getBothLinkTypeSides(\n leftObjectType: string,\n leftLinkName: string,\n rightObjectType: string,\n ): [OntologiesV2.LinkTypeSideV2, OntologiesV2.LinkTypeSideV2] {\n const leftTypeSideV2 = this.getLinkTypeSideV2(\n leftObjectType,\n leftLinkName,\n );\n\n // the rhs passed in should match the target of the lhs\n invariant(rightObjectType === leftTypeSideV2.objectTypeApiName);\n\n const rightTypeSideV2 = this.getOtherLinkTypeSideV2OrThrow(\n leftObjectType,\n leftLinkName,\n );\n\n return [leftTypeSideV2, rightTypeSideV2];\n }\n\n registerObjectType<Q extends ObjectTypeDefinition>(\n def: TH_ObjectTypeFullMetadata<Q>,\n ): void;\n registerObjectType(\n def: ReadonlyDeep<OntologiesV2.ObjectTypeFullMetadata>,\n ): void;\n registerObjectType<Q extends ObjectTypeDefinition>(\n def:\n | TH_ObjectTypeFullMetadata<Q>\n | OntologiesV2.ObjectTypeFullMetadata,\n ): void {\n if (def.objectType.apiName in this.#ontology.objectTypes) {\n throw new Error(\n `ObjectType ${def.objectType.apiName} already registered`,\n );\n }\n this.#ontology.objectTypes[def.objectType.apiName] = def;\n }\n\n registerActionType<Q extends OntologiesV2.ActionTypeV2>(\n def: Q,\n implementation?: FauxActionImpl<Q>,\n ): void;\n registerActionType(\n def: OntologiesV2.ActionTypeV2,\n implementation?: FauxActionImpl,\n ): void;\n registerActionType(\n def: OntologiesV2.ActionTypeV2,\n implementation?: FauxActionImpl,\n ): void {\n if (def.apiName in this.#ontology.actionTypes) {\n throw new Error(\n `ActionType ${def.apiName} already registered`,\n );\n }\n this.#ontology.actionTypes[def.apiName] = def;\n if (implementation) {\n this.#actionImpl.set(def.apiName, implementation);\n }\n }\n\n registerQueryType(\n def: OntologiesV2.QueryTypeV2,\n implementation?: FauxQueryImpl,\n ): void {\n if (`${def.apiName}:${def.version}` in this.#ontology.queryTypes) {\n throw new Error(\n `QueryType ${def.apiName} already registered`,\n );\n }\n this.#ontology\n .queryTypes[\n `${def.apiName}:${def.version}` as VersionedQueryTypeApiName\n ] = def;\n if (implementation) {\n if (!this.#queryImpl.has(def.apiName)) {\n this.#queryImpl.set(def.apiName, new Map());\n }\n if (!valid(def.version)) {\n throw new Error(\n `QueryType ${def.apiName} version ${def.version} is not semver valid`,\n );\n }\n this.#queryImpl.get(def.apiName)?.set(\n def.version,\n implementation,\n );\n }\n }\n\n registerInterfaceType(def: OntologiesV2.InterfaceType): void {\n if (def.apiName in this.#ontology.interfaceTypes) {\n throw new Error(\n `InterfaceType ${def.apiName} already registered`,\n );\n }\n this.#ontology.interfaceTypes[def.apiName] = def;\n }\n\n registerSharedPropertyType(def: OntologiesV2.SharedPropertyType): void {\n if (def.apiName in this.#ontology.sharedPropertyTypes) {\n throw new Error(\n `SharedPropertyType ${def.apiName} already registered`,\n );\n }\n this.#ontology.sharedPropertyTypes[def.apiName] = def;\n }\n\n #getFilteredQueryTypes(request: LoadOntologyMetadataRequest): Record<\n OntologiesV2.QueryApiName,\n OntologiesV2.QueryTypeV2\n > {\n const remappedQueryTypes = request.queryTypes.map(x =>\n this.#convertToVersionedApiName(x)\n );\n return Object.fromEntries(\n Object.entries(this.#ontology.queryTypes).filter((\n [queryTypeApiName],\n ) => remappedQueryTypes.includes(queryTypeApiName)).map((\n [queryTypeApiName, queryTypeDefinition],\n ) => [\n request.queryTypes[remappedQueryTypes.indexOf(queryTypeApiName)],\n queryTypeDefinition,\n ]),\n );\n }\n\n #convertToVersionedApiName(\n apiName: string,\n ): VersionedQueryTypeApiName {\n // If a query is requested without a version, we remap it to include a versioned api name with the latest version\n if (extractVersion(apiName) !== undefined) {\n return apiName as VersionedQueryTypeApiName;\n }\n const version = semver.rsort(\n Object.keys(this.#ontology.queryTypes).filter(\n queryTypeApiName => queryTypeApiName.split(\":\")[0] === apiName,\n ).map(x => extractVersion(x)),\n )[0];\n return `${apiName}:${version}`;\n }\n}\n\nfunction filterRecord<T>(\n record: Record<string, T>,\n keys: string[],\n): Record<string, T> {\n return Object.fromEntries(\n Object.entries(record).filter(([key]) => keys.includes(key)),\n );\n}\n\nfunction extractVersion(\n apiName: string,\n): string {\n return apiName.split(\":\")[1];\n}\n"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CAACwF,kBAAkB,CAACG,OAAO,CAAC/C,gBAAgB,CAAC,CAAC,EAChE8C,mBAAmB,CACpB,CACH,CAAC;EACH;EAEA,CAAChD,yBAAyBkD,CACxB1F,OAAe,EACY;IAC3B;IACA,IAAI2F,cAAc,CAAC3F,OAAO,CAAC,KAAKyB,SAAS,EAAE;MACzC,OAAOzB,OAAO;IAChB;IACA,MAAM2C,OAAO,GAAG/D,MAAM,CAACiE,KAAK,CAC1BzC,MAAM,CAAC4C,IAAI,CAAC,IAAI,CAAC,CAAC1D,QAAQ,CAACQ,UAAU,CAAC,CAACS,MAAM,CAC3CmC,gBAAgB,IAAIA,gBAAgB,CAACkD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK5F,OACzD,CAAC,CAACU,GAAG,CAAC6E,CAAC,IAAII,cAAc,CAACJ,CAAC,CAAC,CAC9B,CAAC,CAAC,CAAC,CAAC;IACJ,OAAO,GAAGvF,OAAO,IAAI2C,OAAO,EAAE;EAChC;AACF;AAEA,SAAS5B,YAAYA,CACnB8E,MAAyB,EACzB7C,IAAc,EACK;EACnB,OAAO5C,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACuF,MAAM,CAAC,CAACtF,MAAM,CAAC,CAAC,CAACuF,GAAG,CAAC,KAAK9C,IAAI,CAACvC,QAAQ,CAACqF,GAAG,CAAC,CAC7D,CAAC;AACH;AAEA,SAASH,cAAcA,CACrB3F,OAAe,EACP;EACR,OAAOA,OAAO,CAAC4F,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FauxOntology.js","names":["semver","valid","invariant","ActionNotFoundError","LinkTypeNotFound","ObjectNotFoundError","ObjectTypeDoesNotExistError","QueryNotFoundError","OpenApiCallError","FauxOntology","ontology","actionImpl","Map","queryImpl","constructor","actionTypes","interfaceTypes","objectTypes","queryTypes","sharedPropertyTypes","valueTypes","apiName","getOntologyFullMetadata","getFilteredOntologyMetadata","request","Object","fromEntries","entries","filter","objectType","includes","map","objectTypeApiName","objectTypeDefinition","linkTypes","linkType","filterRecord","getFilteredQueryTypes","getAllInterfaceTypes","values","getAllObjectTypes","getAllActionTypes","getAllQueryTypes","getInterfaceType","interfaceType","ret","undefined","getObjectTypeFullMetadata","getObjectTypeFullMetadataOrThrow","getActionDef","actionTypeApiName","actionType","getActionImpl","impl","get","process","env","NODE_ENV","getQueryDef","queryTypeApiNameAndVersion","queryType","convertToVersionedApiName","getQueryImpl","queryTypeApiName","version","versionMap","rsort","Array","from","keys","getInterfaceToObjectTypeMappings","objectApiNames","objectDefs","ifaceToObjMap","objDef","ifaceApiName","properties","implementsInterfaces2","getLinkTypeSideV2","linkTypeName","find","a","getOtherLinkTypeSideV2OrThrow","thisSideLink","otherObj","candidates","l","linkTypeRid","length","candidate","getBothLinkTypeSides","leftObjectType","leftLinkName","rightObjectType","leftTypeSideV2","rightTypeSideV2","registerObjectType","def","Error","registerActionType","implementation","set","registerQueryType","has","registerInterfaceType","registerSharedPropertyType","#getFilteredQueryTypes","remappedQueryTypes","x","queryTypeDefinition","indexOf","#convertToVersionedApiName","extractVersion","split","record","key"],"sources":["FauxOntology.ts"],"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 { type ObjectTypeDefinition } from \"@osdk/api\";\nimport type * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type {\n LoadOntologyMetadataRequest,\n VersionedQueryTypeApiName,\n} from \"@osdk/internal.foundry.ontologies\";\nimport semver, { valid } from \"semver\";\nimport invariant from \"tiny-invariant\";\nimport type { ReadonlyDeep } from \"type-fest\";\nimport {\n ActionNotFoundError,\n LinkTypeNotFound,\n ObjectNotFoundError,\n ObjectTypeDoesNotExistError,\n QueryNotFoundError,\n} from \"../errors.js\";\nimport { OpenApiCallError } from \"../handlers/util/handleOpenApiCall.js\";\nimport type { FauxActionImpl } from \"./FauxActionImpl.js\";\nimport type { FauxQueryImpl } from \"./FauxQueryImpl.js\";\nimport type { TH_ObjectTypeFullMetadata } from \"./typeHelpers/TH_ObjectTypeFullMetadata.js\";\n\n/**\n * Currently Unsupported Concepts:\n * - many:many links.\n */\nexport class FauxOntology {\n #ontology: OntologiesV2.OntologyFullMetadata;\n #actionImpl: Map<OntologiesV2.ActionTypeApiName, FauxActionImpl> = new Map();\n #queryImpl: Map<\n OntologiesV2.QueryApiName,\n Map<OntologiesV2.FunctionVersion, FauxQueryImpl>\n > = new Map();\n\n constructor(ontology: OntologiesV2.OntologyV2) {\n this.#ontology = {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology,\n queryTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n };\n }\n\n get apiName(): OntologiesV2.OntologyApiName {\n return this.#ontology.ontology.apiName;\n }\n\n getOntologyFullMetadata(): OntologiesV2.OntologyFullMetadata {\n return this.#ontology;\n }\n\n getFilteredOntologyMetadata(\n request: OntologiesV2.LoadOntologyMetadataRequest,\n ): OntologiesV2.OntologyFullMetadata {\n return {\n ontology: this.#ontology.ontology,\n objectTypes: Object.fromEntries(\n Object.entries(this.#ontology.objectTypes).filter(([objectType]) =>\n request.objectTypes.includes(objectType)\n ).map(([objectTypeApiName, objectTypeDefinition]) => [\n objectTypeApiName,\n {\n ...objectTypeDefinition,\n linkTypes: objectTypeDefinition.linkTypes.filter(linkType =>\n request.linkTypes.includes(linkType.apiName)\n ),\n },\n ]),\n ),\n actionTypes: filterRecord(\n this.#ontology.actionTypes,\n request.actionTypes,\n ),\n queryTypes: this.#getFilteredQueryTypes(request),\n\n interfaceTypes: filterRecord(\n this.#ontology.interfaceTypes,\n request.interfaceTypes,\n ),\n sharedPropertyTypes: {},\n valueTypes: {},\n };\n }\n\n getAllInterfaceTypes(): OntologiesV2.InterfaceType[] {\n return Object.values(this.#ontology.interfaceTypes);\n }\n\n getAllObjectTypes(): OntologiesV2.ObjectTypeFullMetadata[] {\n return Object.values(this.#ontology.objectTypes);\n }\n\n getAllActionTypes(): OntologiesV2.ActionTypeV2[] {\n return Object.values(this.#ontology.actionTypes);\n }\n\n getAllQueryTypes(): OntologiesV2.QueryTypeV2[] {\n return Object.values(this.#ontology.queryTypes);\n }\n\n getInterfaceType(interfaceType: string): OntologiesV2.InterfaceType {\n const ret = this.#ontology.interfaceTypes[interfaceType];\n\n if (ret === undefined) {\n throw new OpenApiCallError(\n 404,\n ObjectNotFoundError(interfaceType, \"\"),\n );\n }\n\n return (\n this.#ontology.interfaceTypes[interfaceType]\n );\n }\n\n public getObjectTypeFullMetadata(\n objectTypeApiName: string,\n ): OntologiesV2.ObjectTypeFullMetadata | undefined {\n return this.#ontology.objectTypes[objectTypeApiName];\n }\n\n public getObjectTypeFullMetadataOrThrow(\n objectTypeApiName: string,\n ): OntologiesV2.ObjectTypeFullMetadata {\n const objectType = this.#ontology.objectTypes[objectTypeApiName];\n if (objectType === undefined) {\n throw new OpenApiCallError(\n 404,\n ObjectTypeDoesNotExistError(objectTypeApiName),\n );\n }\n return objectType;\n }\n\n public getActionDef(actionTypeApiName: string): OntologiesV2.ActionTypeV2 {\n const actionType = this.#ontology.actionTypes[actionTypeApiName];\n if (actionType === undefined) {\n throw new OpenApiCallError(\n 404,\n ActionNotFoundError(),\n );\n }\n return actionType;\n }\n\n public getActionImpl(actionTypeApiName: string): FauxActionImpl {\n const impl = this.#actionImpl.get(actionTypeApiName);\n invariant(impl, \"Action implementation not found for \" + actionTypeApiName);\n return impl;\n }\n\n public getQueryDef(\n queryTypeApiNameAndVersion: string,\n ): OntologiesV2.QueryTypeV2 {\n const queryType = this.#ontology\n .queryTypes[this.#convertToVersionedApiName(queryTypeApiNameAndVersion)];\n if (queryType === undefined) {\n throw new OpenApiCallError(\n 404,\n QueryNotFoundError(queryTypeApiNameAndVersion),\n );\n }\n return queryType;\n }\n\n public getQueryImpl(\n queryTypeApiName: string,\n version?: string,\n ): FauxQueryImpl {\n const versionMap = this.#queryImpl.get(queryTypeApiName);\n\n const impl = version !== undefined\n ? versionMap?.get(version)\n : versionMap?.get(semver.rsort(Array.from(versionMap.keys() ?? []))[0]);\n\n if (!impl) {\n throw new OpenApiCallError(\n 404,\n QueryNotFoundError(queryTypeApiName),\n );\n }\n invariant(impl, \"Query implementation not found for \" + queryTypeApiName);\n return impl;\n }\n\n public getInterfaceToObjectTypeMappings(\n objectApiNames: Iterable<OntologiesV2.ObjectTypeApiName>,\n ): Record<\n OntologiesV2.InterfaceTypeApiName,\n OntologiesV2.InterfaceToObjectTypeMappings\n > {\n const objectDefs = Array.from(objectApiNames).map(apiName =>\n this.getObjectTypeFullMetadataOrThrow(apiName)\n );\n\n const ifaceToObjMap: Record<\n OntologiesV2.InterfaceTypeApiName,\n OntologiesV2.InterfaceToObjectTypeMappings\n > = {};\n\n for (const objDef of objectDefs) {\n for (\n const [ifaceApiName, { properties }] of Object.entries(\n objDef.implementsInterfaces2,\n )\n ) {\n if (ifaceToObjMap[ifaceApiName] === undefined) {\n ifaceToObjMap[ifaceApiName] = {};\n }\n\n ifaceToObjMap[ifaceApiName][objDef.objectType.apiName] = properties;\n }\n }\n\n return ifaceToObjMap;\n }\n\n public getLinkTypeSideV2(\n objectTypeApiName: string,\n linkTypeName: string,\n ): OntologiesV2.LinkTypeSideV2 {\n const objectType = this.getObjectTypeFullMetadataOrThrow(objectTypeApiName);\n const linkType = objectType.linkTypes.find((a) =>\n a.apiName === linkTypeName\n );\n if (linkType === undefined) {\n throw new OpenApiCallError(\n 404,\n LinkTypeNotFound(objectTypeApiName, linkTypeName),\n );\n }\n return linkType;\n }\n\n public getOtherLinkTypeSideV2OrThrow(\n objectTypeApiName: string,\n linkTypeName: string,\n ): OntologiesV2.LinkTypeSideV2 {\n const thisSideLink = this.getLinkTypeSideV2(\n objectTypeApiName,\n linkTypeName,\n );\n const otherObj = this.getObjectTypeFullMetadataOrThrow(\n thisSideLink.objectTypeApiName,\n );\n const candidates = otherObj.linkTypes.filter(l =>\n l.linkTypeRid === thisSideLink.linkTypeRid\n );\n if (otherObj.objectType.apiName !== objectTypeApiName) {\n // if its not the same object type then there should only be one\n invariant(\n candidates.length === 1,\n \"Expected only one candidate link type\",\n );\n return candidates[0];\n }\n // if its the same object type, then this could be a link that points to itself that\n // is 1:1, many:1 or many:many. In the 1:1 case, the link could have the same name\n // and there would only be 1 entry in that case. Otherwise there should be 2 entries\n // and we want the one that doesn't match the one passed in.\n if (candidates.length === 1) {\n return candidates[0];\n }\n invariant(\n candidates.length === 2,\n \"Expected only two candidate link types\",\n );\n const candidate = candidates.find(l => l.apiName !== thisSideLink.apiName);\n invariant(\n candidate,\n \"Expected to find a candidate link type that is not the same as the one passed in\",\n );\n return candidate;\n }\n\n getBothLinkTypeSides(\n leftObjectType: string,\n leftLinkName: string,\n rightObjectType: string,\n ): [OntologiesV2.LinkTypeSideV2, OntologiesV2.LinkTypeSideV2] {\n const leftTypeSideV2 = this.getLinkTypeSideV2(\n leftObjectType,\n leftLinkName,\n );\n\n // the rhs passed in should match the target of the lhs\n invariant(rightObjectType === leftTypeSideV2.objectTypeApiName);\n\n const rightTypeSideV2 = this.getOtherLinkTypeSideV2OrThrow(\n leftObjectType,\n leftLinkName,\n );\n\n return [leftTypeSideV2, rightTypeSideV2];\n }\n\n registerObjectType<Q extends ObjectTypeDefinition>(\n def: TH_ObjectTypeFullMetadata<Q>,\n ): void;\n registerObjectType(\n def: ReadonlyDeep<OntologiesV2.ObjectTypeFullMetadata>,\n ): void;\n registerObjectType<Q extends ObjectTypeDefinition>(\n def:\n | TH_ObjectTypeFullMetadata<Q>\n | OntologiesV2.ObjectTypeFullMetadata,\n ): void {\n if (def.objectType.apiName in this.#ontology.objectTypes) {\n throw new Error(\n `ObjectType ${def.objectType.apiName} already registered`,\n );\n }\n this.#ontology.objectTypes[def.objectType.apiName] = def;\n }\n\n registerActionType<Q extends OntologiesV2.ActionTypeV2>(\n def: Q,\n implementation?: FauxActionImpl<Q>,\n ): void;\n registerActionType(\n def: OntologiesV2.ActionTypeV2,\n implementation?: FauxActionImpl,\n ): void;\n registerActionType(\n def: OntologiesV2.ActionTypeV2,\n implementation?: FauxActionImpl,\n ): void {\n if (def.apiName in this.#ontology.actionTypes) {\n throw new Error(\n `ActionType ${def.apiName} already registered`,\n );\n }\n this.#ontology.actionTypes[def.apiName] = def;\n if (implementation) {\n this.#actionImpl.set(def.apiName, implementation);\n }\n }\n\n registerQueryType(\n def: OntologiesV2.QueryTypeV2,\n implementation?: FauxQueryImpl,\n ): void {\n if (`${def.apiName}:${def.version}` in this.#ontology.queryTypes) {\n throw new Error(\n `QueryType ${def.apiName} already registered`,\n );\n }\n this.#ontology\n .queryTypes[\n `${def.apiName}:${def.version}` as VersionedQueryTypeApiName\n ] = def;\n if (implementation) {\n if (!this.#queryImpl.has(def.apiName)) {\n this.#queryImpl.set(def.apiName, new Map());\n }\n if (!valid(def.version)) {\n throw new Error(\n `QueryType ${def.apiName} version ${def.version} is not semver valid`,\n );\n }\n this.#queryImpl.get(def.apiName)?.set(\n def.version,\n implementation,\n );\n }\n }\n\n registerInterfaceType(def: OntologiesV2.InterfaceType): void {\n if (def.apiName in this.#ontology.interfaceTypes) {\n throw new Error(\n `InterfaceType ${def.apiName} already registered`,\n );\n }\n this.#ontology.interfaceTypes[def.apiName] = def;\n }\n\n registerSharedPropertyType(def: OntologiesV2.SharedPropertyType): void {\n if (def.apiName in this.#ontology.sharedPropertyTypes) {\n throw new Error(\n `SharedPropertyType ${def.apiName} already registered`,\n );\n }\n this.#ontology.sharedPropertyTypes[def.apiName] = def;\n }\n\n #getFilteredQueryTypes(request: LoadOntologyMetadataRequest): Record<\n OntologiesV2.QueryApiName,\n OntologiesV2.QueryTypeV2\n > {\n const remappedQueryTypes = request.queryTypes.map(x =>\n this.#convertToVersionedApiName(x)\n );\n return Object.fromEntries(\n Object.entries(this.#ontology.queryTypes).filter((\n [queryTypeApiName],\n ) => remappedQueryTypes.includes(queryTypeApiName)).map((\n [queryTypeApiName, queryTypeDefinition],\n ) => [\n request.queryTypes[remappedQueryTypes.indexOf(queryTypeApiName)],\n queryTypeDefinition,\n ]),\n );\n }\n\n #convertToVersionedApiName(\n apiName: string,\n ): VersionedQueryTypeApiName {\n // If a query is requested without a version, we remap it to include a versioned api name with the latest version\n if (extractVersion(apiName) !== undefined) {\n return apiName as VersionedQueryTypeApiName;\n }\n const version = semver.rsort(\n Object.keys(this.#ontology.queryTypes).filter(\n queryTypeApiName => queryTypeApiName.split(\":\")[0] === apiName,\n ).map(x => extractVersion(x)),\n )[0];\n return `${apiName}:${version}`;\n }\n}\n\nfunction filterRecord<T>(\n record: Record<string, T>,\n keys: string[],\n): Record<string, T> {\n return Object.fromEntries(\n Object.entries(record).filter(([key]) => keys.includes(key)),\n );\n}\n\nfunction extractVersion(\n apiName: string,\n): string {\n return apiName.split(\":\")[1];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,MAAM,IAAIC,KAAK,QAAQ,QAAQ;AACtC,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SACEC,mBAAmB,EACnBC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,EAC3BC,kBAAkB,QACb,cAAc;AACrB,SAASC,gBAAgB,QAAQ,uCAAuC;AAKxE;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EACxB,CAACC,QAAQ;EACT,CAACC,UAAU,GAAwD,IAAIC,GAAG,CAAC,CAAC;EAC5E,CAACC,SAAS,GAGN,IAAID,GAAG,CAAC,CAAC;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B,CAACkD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK5F,OACzD,CAAC,CAACU,GAAG,CAAC6E,CAAC,IAAII,cAAc,CAACJ,CAAC,CAAC,CAC9B,CAAC,CAAC,CAAC,CAAC;IACJ,OAAO,GAAGvF,OAAO,IAAI2C,OAAO,EAAE;EAChC;AACF;AAEA,SAAS5B,YAAYA,CACnB8E,MAAyB,EACzB7C,IAAc,EACK;EACnB,OAAO5C,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACuF,MAAM,CAAC,CAACtF,MAAM,CAAC,CAAC,CAACuF,GAAG,CAAC,KAAK9C,IAAI,CAACvC,QAAQ,CAACqF,GAAG,CAAC,CAC7D,CAAC;AACH;AAEA,SAASH,cAAcA,CACrB3F,OAAe,EACP;EACR,OAAOA,OAAO,CAAC4F,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9B","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1683,7 +1683,7 @@ __export(Actions_exports, {
|
|
|
1683
1683
|
applyBatch: () => applyBatch2
|
|
1684
1684
|
});
|
|
1685
1685
|
|
|
1686
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1686
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
1687
1687
|
var Action_exports = {};
|
|
1688
1688
|
__export(Action_exports, {
|
|
1689
1689
|
apply: () => apply,
|
|
@@ -1790,7 +1790,7 @@ function parseUrl(baseUrl, endpointPath) {
|
|
|
1790
1790
|
return new URL(`api${endpointPath}`, baseUrl);
|
|
1791
1791
|
}
|
|
1792
1792
|
|
|
1793
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1793
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
1794
1794
|
var _apply = [1, "/v2/ontologies/{0}/actions/{1}/apply", 3];
|
|
1795
1795
|
function apply($ctx, ...args) {
|
|
1796
1796
|
return foundryPlatformFetch($ctx, _apply, ...args);
|
|
@@ -1804,7 +1804,7 @@ function applyBatch($ctx, ...args) {
|
|
|
1804
1804
|
return foundryPlatformFetch($ctx, _applyBatch, ...args);
|
|
1805
1805
|
}
|
|
1806
1806
|
|
|
1807
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1807
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ActionTypeV2.js
|
|
1808
1808
|
var ActionTypeV2_exports = {};
|
|
1809
1809
|
__export(ActionTypeV2_exports, {
|
|
1810
1810
|
get: () => get,
|
|
@@ -1824,7 +1824,7 @@ function getByRid($ctx, ...args) {
|
|
|
1824
1824
|
return foundryPlatformFetch($ctx, _getByRid, ...args);
|
|
1825
1825
|
}
|
|
1826
1826
|
|
|
1827
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1827
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Attachment.js
|
|
1828
1828
|
var Attachment_exports = {};
|
|
1829
1829
|
__export(Attachment_exports, {
|
|
1830
1830
|
get: () => get2,
|
|
@@ -1849,7 +1849,7 @@ function get2($ctx, ...args) {
|
|
|
1849
1849
|
return foundryPlatformFetch($ctx, _get2, ...args);
|
|
1850
1850
|
}
|
|
1851
1851
|
|
|
1852
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1852
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/AttachmentPropertyV2.js
|
|
1853
1853
|
var AttachmentPropertyV2_exports = {};
|
|
1854
1854
|
__export(AttachmentPropertyV2_exports, {
|
|
1855
1855
|
getAttachment: () => getAttachment,
|
|
@@ -1874,7 +1874,7 @@ function readAttachmentByRid($ctx, ...args) {
|
|
|
1874
1874
|
return foundryPlatformFetch($ctx, _readAttachmentByRid, ...args);
|
|
1875
1875
|
}
|
|
1876
1876
|
|
|
1877
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1877
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/LinkedObjectV2.js
|
|
1878
1878
|
var LinkedObjectV2_exports = {};
|
|
1879
1879
|
__export(LinkedObjectV2_exports, {
|
|
1880
1880
|
getLinkedObject: () => getLinkedObject,
|
|
@@ -1889,7 +1889,7 @@ function getLinkedObject($ctx, ...args) {
|
|
|
1889
1889
|
return foundryPlatformFetch($ctx, _getLinkedObject, ...args);
|
|
1890
1890
|
}
|
|
1891
1891
|
|
|
1892
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1892
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/MediaReferenceProperty.js
|
|
1893
1893
|
var MediaReferenceProperty_exports = {};
|
|
1894
1894
|
__export(MediaReferenceProperty_exports, {
|
|
1895
1895
|
getMediaContent: () => getMediaContent,
|
|
@@ -1914,7 +1914,7 @@ function uploadMedia($ctx, ...args) {
|
|
|
1914
1914
|
return foundryPlatformFetch($ctx, _uploadMedia, ...args);
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
1917
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1917
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ObjectTypeV2.js
|
|
1918
1918
|
var ObjectTypeV2_exports = {};
|
|
1919
1919
|
__export(ObjectTypeV2_exports, {
|
|
1920
1920
|
get: () => get3,
|
|
@@ -1944,7 +1944,7 @@ function getOutgoingLinkType($ctx, ...args) {
|
|
|
1944
1944
|
return foundryPlatformFetch($ctx, _getOutgoingLinkType, ...args);
|
|
1945
1945
|
}
|
|
1946
1946
|
|
|
1947
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1947
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyInterface.js
|
|
1948
1948
|
var OntologyInterface_exports = {};
|
|
1949
1949
|
__export(OntologyInterface_exports, {
|
|
1950
1950
|
aggregate: () => aggregate,
|
|
@@ -1979,7 +1979,7 @@ function getOutgoingInterfaceLinkType($ctx, ...args) {
|
|
|
1979
1979
|
return foundryPlatformFetch($ctx, _getOutgoingInterfaceLinkType, ...args);
|
|
1980
1980
|
}
|
|
1981
1981
|
|
|
1982
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1982
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectSet.js
|
|
1983
1983
|
var OntologyObjectSet_exports = {};
|
|
1984
1984
|
__export(OntologyObjectSet_exports, {
|
|
1985
1985
|
aggregate: () => aggregate2,
|
|
@@ -2014,7 +2014,7 @@ function aggregate2($ctx, ...args) {
|
|
|
2014
2014
|
return foundryPlatformFetch($ctx, _aggregate2, ...args);
|
|
2015
2015
|
}
|
|
2016
2016
|
|
|
2017
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2017
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectV2.js
|
|
2018
2018
|
var OntologyObjectV2_exports = {};
|
|
2019
2019
|
__export(OntologyObjectV2_exports, {
|
|
2020
2020
|
aggregate: () => aggregate3,
|
|
@@ -2044,7 +2044,7 @@ function aggregate3($ctx, ...args) {
|
|
|
2044
2044
|
return foundryPlatformFetch($ctx, _aggregate3, ...args);
|
|
2045
2045
|
}
|
|
2046
2046
|
|
|
2047
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2047
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyTransaction.js
|
|
2048
2048
|
var OntologyTransaction_exports = {};
|
|
2049
2049
|
__export(OntologyTransaction_exports, {
|
|
2050
2050
|
postEdits: () => postEdits
|
|
@@ -2054,7 +2054,7 @@ function postEdits($ctx, ...args) {
|
|
|
2054
2054
|
return foundryPlatformFetch($ctx, _postEdits, ...args);
|
|
2055
2055
|
}
|
|
2056
2056
|
|
|
2057
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2057
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyV2.js
|
|
2058
2058
|
var OntologyV2_exports = {};
|
|
2059
2059
|
__export(OntologyV2_exports, {
|
|
2060
2060
|
get: () => get7,
|
|
@@ -2079,7 +2079,7 @@ function loadMetadata($ctx, ...args) {
|
|
|
2079
2079
|
return foundryPlatformFetch($ctx, _loadMetadata, ...args);
|
|
2080
2080
|
}
|
|
2081
2081
|
|
|
2082
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2082
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Query.js
|
|
2083
2083
|
var Query_exports = {};
|
|
2084
2084
|
__export(Query_exports, {
|
|
2085
2085
|
execute: () => execute
|
|
@@ -2089,7 +2089,7 @@ function execute($ctx, ...args) {
|
|
|
2089
2089
|
return foundryPlatformFetch($ctx, _execute, ...args);
|
|
2090
2090
|
}
|
|
2091
2091
|
|
|
2092
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2092
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/QueryType.js
|
|
2093
2093
|
var QueryType_exports = {};
|
|
2094
2094
|
__export(QueryType_exports, {
|
|
2095
2095
|
get: () => get8,
|
|
@@ -2104,7 +2104,7 @@ function get8($ctx, ...args) {
|
|
|
2104
2104
|
return foundryPlatformFetch($ctx, _get8, ...args);
|
|
2105
2105
|
}
|
|
2106
2106
|
|
|
2107
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2107
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesPropertyV2.js
|
|
2108
2108
|
var TimeSeriesPropertyV2_exports = {};
|
|
2109
2109
|
__export(TimeSeriesPropertyV2_exports, {
|
|
2110
2110
|
getFirstPoint: () => getFirstPoint,
|
|
@@ -2124,7 +2124,7 @@ function streamPoints($ctx, ...args) {
|
|
|
2124
2124
|
return foundryPlatformFetch($ctx, _streamPoints, ...args);
|
|
2125
2125
|
}
|
|
2126
2126
|
|
|
2127
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2127
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.27.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesValueBankProperty.js
|
|
2128
2128
|
var TimeSeriesValueBankProperty_exports = {};
|
|
2129
2129
|
__export(TimeSeriesValueBankProperty_exports, {
|
|
2130
2130
|
getLatestValue: () => getLatestValue,
|
|
@@ -2885,7 +2885,8 @@ var FauxOntology = class {
|
|
|
2885
2885
|
objectTypes: {},
|
|
2886
2886
|
ontology,
|
|
2887
2887
|
queryTypes: {},
|
|
2888
|
-
sharedPropertyTypes: {}
|
|
2888
|
+
sharedPropertyTypes: {},
|
|
2889
|
+
valueTypes: {}
|
|
2889
2890
|
};
|
|
2890
2891
|
}
|
|
2891
2892
|
get apiName() {
|
|
@@ -2904,7 +2905,8 @@ var FauxOntology = class {
|
|
|
2904
2905
|
actionTypes: filterRecord(this.#ontology.actionTypes, request.actionTypes),
|
|
2905
2906
|
queryTypes: this.#getFilteredQueryTypes(request),
|
|
2906
2907
|
interfaceTypes: filterRecord(this.#ontology.interfaceTypes, request.interfaceTypes),
|
|
2907
|
-
sharedPropertyTypes: {}
|
|
2908
|
+
sharedPropertyTypes: {},
|
|
2909
|
+
valueTypes: {}
|
|
2908
2910
|
};
|
|
2909
2911
|
}
|
|
2910
2912
|
getAllInterfaceTypes() {
|